📄 opensave.pas
字号:
unit OpenSave; //should be called loadsave but oh well...
interface
{$ifdef net}
uses unit2,dialogs,windows,Classes,Graphics,Controls,commentsunit,advancedoptionsunit,SysUtils,ceclient,netapis,cefuncproc;
{$else}
uses mainunit,windows,standaloneunit,SysUtils,advancedoptionsunit,commentsunit,
cefuncproc,classes,formmemorymodifier,formMemoryTrainerUnit,shellapi,
MemoryTrainerDesignUnit,StdCtrls,ExtraTrainerComponents,Graphics,Controls,
ExtCtrls,Dialogs,newkernelhandler;
{$endif}
var CurrentTableVersion: dword=7;
procedure SaveTable(Filename: string);
procedure LoadTable(Filename: string;merge: boolean);
procedure SaveCEM(Filename:string;address,size:dword);
{$ifndef net}
procedure LoadExe(filename: string);
{$endif}
{type TCEPointer=record
Address: Dword; //only used when last pointer in list
offset: dword;
end;}
type
MemoryRecordV6 = record
Description : string;
Address : dword;
interpretableaddress: string;
VarType : byte;
unicode : boolean;
IsPointer: Boolean;
pointers: array of TCEPointer;
Bit : Byte;
bitlength: integer;
Frozen : boolean;
FrozenValue : Int64;
OldValue: string; //not saved
Frozendirection: integer; //0=always freeze,1=only freeze when going up,2=only freeze when going down
Group: Byte;
ShowAsHex: boolean;
autoassemblescript: string;
allocs: TCEAllocArray;
end;
MemoryRecordV5 = record
Description : string;
Address : dword;
VarType : byte;
Unicode : boolean;
IsPointer: Boolean;
pointers: array of TCEPointer;
Bit : Byte;
bitlength: integer;
Frozen : boolean;
FrozenValue : Int64;
Frozendirection: integer; //0=always freeze,1=only freeze when going up,2=only freeze when going down
Group: Byte;
ShowAsHex: boolean;
end;
MemoryRecordV4 = record
Description : string[50];
Address : dword;
VarType : byte;
IsPointer: Boolean;
pointers: array of TCEPointer;
Bit : Byte;
bitlength: integer;
Frozen : boolean;
FrozenValue : Int64;
Frozendirection: integer; //0=always freeze,1=only freeze when going up,2=only freeze when going down
Group: Byte;
ShowAsHex: boolean;
end;
MemoryRecordV3 = record
Description : string[50];
Address : dword;
VarType : byte;
IsPointer: Boolean;
pointers: array of TCEPointer;
Bit : Byte;
bitlength: integer;
Frozen : boolean;
FrozenValue : Int64;
Frozendirection: integer; //0=always freeze,1=only freeze when going up,2=only freeze when going down
Group: Byte;
end;
MemoryRecordV2 = record
Description : string[50];
Address : dword;
VarType : byte;
Bit : Byte;
bitlength: integer;
Frozen : boolean;
FrozenValue : Int64;
Frozendirection: integer; //0=always freeze,1=only freeze when going up,2=only freeze when going down
Group: Byte;
end;
MemoryRecordV1 = record
Description : string[50];
Address : dword;
VarType : byte;
Bit : Byte;
bitlength: integer;
Frozen : boolean;
FrozenValue : Int64;
Group: Byte;
x,y: dword;
end;
type
MemoryRecordcet3 = record
Description : string[50];
Address : dword;
VarType : byte;
Bit : Byte;
Frozen : boolean;
FrozenValue : Int64;
Group: Byte;
end;
type
MemoryRecordOld = record
Description : string[50];
Address : dword;
VarType : byte;
Frozen : boolean;
FrozenValue : Dword;
end;
{$ifdef net}
var processhandle: thandle;
{$endif}
resourcestring strunknowncomponent='There is a unknown component in the trainer! compnr=';
implementation
uses symbolhandler;
{$ifndef net}
procedure LoadTrainer6(trainer:TFilestream);
var temp: dword;
tempb: boolean;
tempc: tcolor;
tempi: integer;
tempbc: tbevelcut;
tempbk: tbevelkind;
tempcursor: tcursor;
i,j,k:integer;
x: pchar;
image: pointer;
// trainerdata1: array of TTrainerData1;
begin
with frmMemoryModifier do
begin
//size of trainerdata
trainer.ReadBuffer(temp,4);
setlength(frmMemoryModifier.trainerdata,temp);
for i:=0 to length(trainerdata)-1 do
begin
//description
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
trainerdata[i].description:=x;
freemem(x);
//hotkeytext
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
trainerdata[i].hotkeytext:=x;
freemem(x);
trainer.readbuffer(trainerdata[i].hotkey,2);
trainer.readBuffer(trainerdata[i].hotshift,sizeof(trainerdata[i].hotshift));
trainer.ReadBuffer(temp,4);
setlength(trainerdata[i].codeentrys,temp);
//opcodes of this cheat
for j:=0 to length(trainerdata[i].codeentrys)-1 do
begin
//address
trainer.ReadBuffer(trainerdata[i].codeentrys[j].address,4);
//modulename
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
trainerdata[i].codeentrys[j].modulename:=x;
freemem(x);
//module offset
trainer.ReadBuffer(trainerdata[i].codeentrys[j].moduleoffset,4);
//original opcode
trainer.ReadBuffer(temp,4);
setlength(trainerdata[i].codeentrys[j].originalopcode,temp);
trainer.ReadBuffer(pointer(trainerdata[i].codeentrys[j].originalopcode)^,temp);
end;
//address entrys
trainer.ReadBuffer(temp,4);
setlength(trainerdata[i].addressentrys,temp);
for j:=0 to length(trainerdata[i].addressentrys)-1 do
begin
trainer.ReadBuffer(trainerdata[i].addressentrys[j].address,sizeof(trainerdata[i].addressentrys[j].address));
//interpretable address
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
trainerdata[i].addressentrys[j].interpretableaddress:=x;
freemem(x);
trainer.ReadBuffer(trainerdata[i].addressentrys[j].ispointer,sizeof(trainerdata[i].addressentrys[j].ispointer));
trainer.ReadBuffer(tempi,4);
setlength(trainerdata[i].addressentrys[j].pointers,tempi);
for k:=0 to tempi-1 do
begin
trainer.readBuffer(trainerdata[i].addressentrys[j].pointers[k].address,sizeof(trainerdata[i].addressentrys[j].pointers[k].address));
//interpretable address
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
trainerdata[i].addressentrys[j].pointers[k].interpretableaddress:=x;
freemem(x);
trainer.readBuffer(trainerdata[i].addressentrys[j].pointers[k].offset,sizeof(trainerdata[i].addressentrys[j].pointers[k].offset));
end;
trainer.ReadBuffer(trainerdata[i].addressentrys[j].bit,sizeof(trainerdata[i].addressentrys[j].bit));
trainer.ReadBuffer(trainerdata[i].addressentrys[j].memtyp,sizeof(trainerdata[i].addressentrys[j].memtyp));
trainer.Readbuffer(trainerdata[i].addressentrys[j].frozen,sizeof(trainerdata[i].addressentrys[j].frozen));
trainer.Readbuffer(trainerdata[i].addressentrys[j].frozendirection,sizeof(trainerdata[i].addressentrys[j].frozendirection));
trainer.Readbuffer(trainerdata[i].addressentrys[j].setvalue,sizeof(trainerdata[i].addressentrys[j].setvalue));
trainer.ReadBuffer(trainerdata[i].addressentrys[j].userinput,sizeof(trainerdata[i].addressentrys[j].userinput));
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
trainerdata[i].addressentrys[j].value:=x;
freemem(x);
// trainer.Readbuffer(trainerdata[i].addressentrys[j].value,50);
if trainerdata[i].addressentrys[j].userinput then
begin
trainerdata[i].hasedit:=true;
trainerdata[i].editvalue:=trainerdata[i].addressentrys[j].value;
end;
//interpretable address
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
trainerdata[i].addressentrys[j].autoassemblescript:=x;
freemem(x);
end;
end;
//title
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
edittitle.Text:=x;
freemem(x);
//launch filename
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
edit2.Text:=x;
freemem(x);
//autolaunch
trainer.ReadBuffer(tempb,sizeof(tempb));
checkbox2.Checked:=tempb;
//popup on keypress
trainer.ReadBuffer(tempb,sizeof(tempb));
checkbox1.Checked:=tempb;
//process name
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
combobox1.Text:=x;
freemem(x);
//hotkeytext
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
edithotkey.Text:=x;
freemem(x);
//hotkey+shiftstate
trainer.ReadBuffer(laststate,sizeof(laststate));
trainer.ReadBuffer(lastshiftstate,sizeof(lastshiftstate));
//abouttext
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
memo1.Text:=x;
freemem(x);
//freeze interval
trainer.ReadBuffer(tempi,sizeof(tempi));
editFreezeInterval.text:=inttostr(tempi);
trainer.ReadBuffer(temp,4);
if temp=$666 then
begin
//default
//leftside image
trainer.ReadBuffer(temp,4); //size of the image
if temp>0 then
begin
//getmem(image,temp);
//trainer.ReadBuffer(image^,temp);
frmMemorytrainerpreview.Image1.Picture.Bitmap.LoadFromStream(trainer);
end;
//windowwidth
trainer.readbuffer(temp,sizeof(frmMemorytrainerpreview.Width));
frmMemorytrainerpreview.Width:=temp;
//windowheight
trainer.readbuffer(temp,sizeof(frmMemorytrainerpreview.height));
frmMemorytrainerpreview.height:=temp;
//leftsidewidth
trainer.readbuffer(temp,sizeof(frmMemorytrainerpreview.Panel1.Width));
frmMemorytrainerpreview.Panel1.Width:=temp;
//leftsideheight
trainer.readbuffer(temp,sizeof(frmMemorytrainerpreview.Panel1.height));
frmMemorytrainerpreview.Panel1.height:=temp;
end
else
begin
//user defined
frmMemoryModifier.dontshowdefault:=true; //obsolete
frmMemoryModifier.Button7.Click;
//windowwidth
trainer.readbuffer(temp,4);
frmTrainerDesigner.Width:=temp;
//windowheight
trainer.readbuffer(temp,4);
frmTrainerDesigner.height:=temp;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -