Skip to content

Commit

Permalink
on failure try using the windows codepage
Browse files Browse the repository at this point in the history
  • Loading branch information
cheat-engine committed Jul 26, 2017
1 parent d1b5238 commit 8b42120
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions Cheat Engine/PointerscanresultReader.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
}
interface

uses windows, LCLIntf, sysutils, classes, CEFuncProc, NewKernelHandler, symbolhandler, math, dialogs;
uses windows, LCLIntf, sysutils, classes, CEFuncProc, NewKernelHandler,
symbolhandler, math, dialogs, LazUTF8;

resourcestring
rsPSRCorruptedPointerscanFile = 'Corrupted pointerscan file';
Expand Down Expand Up @@ -127,14 +128,14 @@ TPointerscanresultReader=class
property BaseScanRange: qword read foriginalBaseScanRange;
end;

procedure findAllResultFilesForThisPtr(filename: string; rs: TStrings);
procedure findAllResultFilesForThisPtr(filename: string; rs: TStrings; lookupmode: integer=0);

implementation

uses ProcessHandlerUnit, PointerscanStructures, Maps, AvgLvlTree;


procedure findAllResultFilesForThisPtr(filename: string; rs: TStrings);
procedure findAllResultFilesForThisPtr(filename: string; rs: TStrings; lookupmode: integer=0);
var
fr: TRawbyteSearchRec;
i,j: integer;
Expand Down Expand Up @@ -162,6 +163,9 @@ procedure findAllResultFilesForThisPtr(filename: string; rs: TStrings);

filemap:=TMap.Create(its8, sizeof(pointer));

if lookupmode=1 then
filename:=UTF8ToWinCP(filename);

path:=ExtractFilePath(filename);

if FindFirst(filename+'.results.*', 0, fr)=0 then
Expand All @@ -181,8 +185,17 @@ procedure findAllResultFilesForThisPtr(filename: string; rs: TStrings);
until FindNext(fr)<>0;

FindClose(fr);
end
else
begin
if lookupmode<1 then
begin
findAllResultFilesForThisPtr(filename, rs, lookupmode+1);
exit;
end;
end;


it:=TMapIterator.Create(filemap);
it.First;
while not it.EOM do
Expand Down Expand Up @@ -645,8 +658,11 @@ constructor TPointerscanresultReader.create(filename: string; original: TPointer

//get the filenames
fnames:=tstringlist.create;

findAllResultFilesForThisPtr(filename, fnames);




setlength(filenames, fnames.count);
for i:=0 to fnames.count-1 do
filenames[i]:=fnames[i];
Expand Down Expand Up @@ -715,6 +731,10 @@ constructor TPointerscanresultReader.create(filename: string; original: TPointer


fCanResume:=fileexists(filename+'.resume.config') and fileexists(filename+'.resume.scandata') and fileexists(filename+'.resume.queue');

if length(filenames)=0 then
MessageDlg('There was an error loading the results. Check that the path is readable', mtError, [mbok],0);

end;

procedure TPointerscanresultReader.ReleaseFiles;
Expand Down

0 comments on commit 8b42120

Please sign in to comment.