📄 foundlisthelper.pas.svn-base
字号:
//so means it wasn't loaded yet, klet's rebase it again (reload resultfile)
if RebaseAgainThread=nil then
begin
RebaseAgainThread:=TRebaseAgain.Create(true);
RebaseAgainThread.foundlist:=self;
RebaseAgainThread.Resume;
end;
end;
end;
function TFoundList.GetAddress(i: integer):dword;
var a: dword;
b: string;
begin
result:=getaddress(i,a,b);
end;
function TFoundList.GetAddress(i: integer;var extra: dword; var value: string): dword;
var j,k,l: integer;
currentaddress: dword;
read1: byte;
read2: word;
read3: dword;
read4: single;
read5: double;
read6: Int64;
read7: pchar;
read72: pwidechar;
read8: array of byte;
read9: pbyte;
count: dword;
nrofbytes: integer;
temp,temp2: string;
vtype: integer;
begin
if i=-1 then exit;
extra:=0;
value:='';
result:=0;
currentaddress:=GetAddressOnly(i,extra);
result:=currentaddress;
j:=i-addresslistfirst;
if valuelist[j]='' then
begin
if vartype=9 then
begin
//override vtype with the type it scanned
case TVariableType(extra) of
vtByte: vtype:=0;
vtWord: vtype:=1;
vtDword: vtype:=2;
vtQword: vtype:=6;
vtSingle: vtype:=3;
vtDouble: vtype:=4;
end;
end else vtype:=vartype;
case vtype of
0: //byte
begin
if readprocessmemory(processhandle,pointer(currentaddress),@read1,1,count) then
begin
if hexadecimal then
valuelist[j]:=IntToHex(read1,2)
else if signed then
valuelist[j]:=IntToStr(ShortInt(read1))
else
valuelist[j]:=IntToStr(read1);
end
else valuelist[j]:='??';
end;
1: //word
begin
if readprocessmemory(processhandle,pointer(currentaddress),@read2,2,count) then
begin
if hexadecimal then
valuelist[j]:=IntToHex(read2,4)
else if signed then
valuelist[j]:=IntToStr(SmallInt(read2))
else
valuelist[j]:=IntToStr(read2);
end
else valuelist[j]:='??';
end;
2: //dword
begin
if readprocessmemory(processhandle,pointer(currentaddress),@read3,4,count) then
begin
if hexadecimal then
valuelist[j]:=IntToHex(read3,8)
else if signed then
valuelist[j]:=IntToStr(Longint(read3))
else
valuelist[j]:=IntToStr(read3);
end
else valuelist[j]:='??';
end;
3:
begin //float
if readprocessmemory(processhandle,pointer(currentaddress),@read4,4,count) then
valuelist[j]:=FloatToStr(read4)
else
valuelist[j]:='??';
end;
4:
begin //double
if readprocessmemory(processhandle,pointer(currentaddress),@read5,8,count) then
valuelist[j]:=FloatToStr(read5)
else
valuelist[j]:='??';
end;
5:
begin //binary
//read the bytes
nrofbytes:=1+((addresslistb[j].bit+varlength) div 8);
setlength(read8,nrofbytes);
if readprocessmemory(processhandle,pointer(addresslistb[j].address),@read8[0],nrofbytes,count) then
begin
//convert what i need to a string of bits
temp:='';
j:=addresslistb[j].bit;
read9:=@read8[0];
for k:=1 to varlength do
begin
temp:=temp+IntToStr(getbit(j,read9^));
inc(j);
if j>=8 then
begin
j:=0;
inc(read9);
end;
end;
temp2:='';
for k:=length(temp) downto 1 do
temp2:=temp2+temp[k];
if binaryasdecimal then
begin
try
valuelist[j]:=IntToStr(bintoint(temp2));
except
valuelist[j]:='...';
end;
end else valuelist[j]:=temp2;
end
else
valuelist[j]:='??';
end;
6:
begin //int64
if readprocessmemory(processhandle,pointer(currentaddress),@read6,8,count) then
begin
if hexadecimal then
valuelist[j]:=inttohex(read6,16)
else
valuelist[j]:=inttostr(read6)
end
else
valuelist[j]:='??';
end;
7:
begin //text
if unicode then
begin
getmem(read72,varlength*2+2);
if readprocessmemory(processhandle,pointer(addresslist[j]),read72,varlength*2,count) then
begin
read72[varlength]:=chr(0);
valuelist[j]:=read72;
end
else valuelist[j]:='??';
freemem(read72);
end
else
begin
getmem(read7,varlength+1);
if readprocessmemory(processhandle,pointer(addresslist[j]),read7,varlength,count) then
begin
read7[varlength]:=chr(0);
valuelist[j]:=read7;
end
else valuelist[j]:='??';
freemem(read7);
end;
end;
8:
begin //array of byte
setlength(read8,varlength);
if readprocessmemory(processhandle,pointer(addresslist[j]),read8,varlength,count) then
begin
temp:='';
for j:=0 to varlength-1 do
temp:=temp+IntToHex(read8[j],2)+' ';
valuelist[j]:=temp;
end else valuelist[j]:='??';
setlength(read8,0);
end;
end;
end;
value:=valuelist[j];
end;
function TFoundList.Initialize(vartype: integer):int64;
var dataType: String[6]; //REGION or NORMAL (Always region in this procedure)
begin
result:=0;
Deinitialize;
fvartype:=vartype;
if fileexists(CheatEngineDir+'Addresses.TMP') then
begin
try
addressfile:=tfilestream.Create(CheatEngineDir+'Addresses.TMP',fmOpenRead or fmShareDenyNone);
except
foundlist.Items.Count:=0;
scantype:=fs_advanced;
exit;
end;
try
addressfile.ReadBuffer(dataType,7);
if datatype='REGION' then
begin
foundlist.Items.Count:=0;
scantype:=fs_advanced;
end
else
begin
scantype:=fs_addresslist;
if vartype in [5,9] then //bit, or all (address+bit)
begin
result:=(addressfile.Size-sizeof(datatype)) div 8;
foundlist.Items.Count:=result;
end
else //normal (address)
begin
result:=(addressfile.Size-sizeof(datatype)) div 4;
foundlist.Items.Count:=result;
end;
rebaseaddresslist(0);
end;
except
foundlist.Items.Count:=0;
scantype:=fs_advanced;
end;
end
else
begin
foundlist.Items.Count:=0;
scantype:=fs_advanced;
end;
end;
function TFoundList.Initialize(vartype,varlength: integer; hexadecimal,signed,binaryasdecimal,unicode: boolean):int64;
begin
result:=Initialize(vartype);
if scantype=fs_addresslist then
begin
self.fvartype:=vartype;
self.hexadecimal:=hexadecimal;
self.signed:=signed;
self.varlength:=varlength;
self.binaryasdecimal:=binaryasdecimal;
self.unicode:=unicode;
end;
end;
procedure TFoundlist.Deinitialize;
begin
clear;
if addressfile<>nil then
freeandnil(addressfile);
end;
procedure TFoundlist.deleteresults;
begin
Deinitialize;
deletefile(pchar(CheatEngineDir+'Addresses.TMP'));
deletefile(pchar(CheatEngineDir+'Memory.TMP'));
end;
constructor TFoundlist.create(foundlist: tlistview; foundcountlabel: tlabel);
begin
self.foundlist:=foundlist;
self.foundcountlabel:=foundcountlabel;
deleteresults;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -