📄 opensave.pas
字号:
//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);
//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));
trainer.ReadBuffer(trainerdata[i].addressentrys[j].ispointer,sizeof(trainerdata[i].addressentrys[j].ispointer));
trainer.ReadBuffer(temp,4);
setlength(trainerdata[i].addressentrys[j].pointers,temp);
trainer.WriteBuffer(temp,4);
for k:=0 to temp-1 do
begin
trainer.readBuffer(trainerdata[i].addressentrys[j].pointers[k].address,sizeof(trainerdata[i].addressentrys[j].pointers[k].address));
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(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;
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);
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;
while true do
begin
trainer.ReadBuffer(temp,4);
case temp of
0: begin
//tbutton
with tbutton.create(frmTrainerDesigner) do
begin
trainer.ReadBuffer(temp,sizeof(integer));
left:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
top:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
width:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
height:=temp;
//caption
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
caption:=x;
freemem(x);
trainer.ReadBuffer(temp,sizeof(tag));
tag:=temp;
parent:=frmTrainerDesigner;
onmousedown:=frmTrainerDesigner.MouseDown;
onmousemove:=frmTrainerDesigner.MouseMove;
onmouseup:=frmTrainerDesigner.MouseUp;
end;
end;
1: begin
//cheatlist
with tcheatlist.create(frmTrainerDesigner) do
begin
trainer.ReadBuffer(temp,sizeof(integer));
left:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
top:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
width:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
height:=temp;
trainer.ReadBuffer(tempc,sizeof(tcolor));
activationcolor:=tempc;
trainer.ReadBuffer(tempc,sizeof(tcolor));
color:=tempc;
trainer.ReadBuffer(tempc,sizeof(tcolor));
textcolor:=tempc;
trainer.ReadBuffer(tempi,sizeof(integer));
hotkeyleft:=tempi;
trainer.ReadBuffer(tempi,sizeof(integer));
descriptionleft:=tempi;
trainer.ReadBuffer(tempi,sizeof(integer));
editleft:=tempi;
trainer.ReadBuffer(tempi,sizeof(integer));
editwidth:=tempi;
trainer.ReadBuffer(tempbc,sizeof(tbevelcut));
bevelinner:=tempbc;
trainer.ReadBuffer(tempbc,sizeof(tbevelcut));
bevelouter:=tempbc;
trainer.ReadBuffer(tempi,sizeof(integer));
bevelwidth:=tempi;
trainer.ReadBuffer(tempbk,sizeof(tbevelkind));
bevelkind:=tempbk;
parent:=frmTrainerDesigner;
onmousedown:=frmTrainerDesigner.MouseDown;
onmousemove:=frmTrainerDesigner.MouseMove;
onmouseup:=frmTrainerDesigner.MouseUp;
end;
end;
2: begin
//tcheat
with tcheat.create(frmTrainerDesigner) do
begin
trainer.ReadBuffer(temp,sizeof(integer));
left:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
top:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
width:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
height:=temp;
trainer.ReadBuffer(cheatnr,sizeof(integer));
trainer.ReadBuffer(tempc,sizeof(tcolor));
activationcolor:=tempc;
trainer.ReadBuffer(tempc,sizeof(tcolor));
color:=tempc;
trainer.ReadBuffer(tempc,sizeof(tcolor));
textcolor:=tempc;
trainer.ReadBuffer(tempi,sizeof(integer));
hotkeyleft:=tempi;
trainer.ReadBuffer(tempi,sizeof(integer));
descriptionleft:=tempi;
trainer.ReadBuffer(tempi,sizeof(integer));
editleft:=tempi;
trainer.ReadBuffer(tempi,sizeof(integer));
editwidth:=tempi;
parent:=frmTrainerDesigner;
onmousedown:=frmTrainerDesigner.MouseDown;
onmousemove:=frmTrainerDesigner.MouseMove;
onmouseup:=frmTrainerDesigner.MouseUp;
end;
end;
3: begin
//timage
with timage.create(frmTrainerDesigner) do
begin
trainer.ReadBuffer(temp,sizeof(integer));
left:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
top:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
width:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
height:=temp;
trainer.ReadBuffer(tempcursor,sizeof(tcursor));
cursor:=tempcursor;
trainer.ReadBuffer(tempb,sizeof(tempb));
stretch:=tempb;
trainer.ReadBuffer(tempb,sizeof(tempb));
transparent:=tempb;
trainer.ReadBuffer(tempi,sizeof(integer));
tag:=tempi;
trainer.ReadBuffer(temp,4);
if temp>0 then
begin
picture.Bitmap.LoadFromStream(trainer);
end;
parent:=frmTrainerDesigner;
onmousedown:=frmTrainerDesigner.MouseDown;
onmousemove:=frmTrainerDesigner.MouseMove;
onmouseup:=frmTrainerDesigner.MouseUp;
end;
end;
4: begin
with tlabel.Create(frmTrainerDesigner) do
begin
trainer.ReadBuffer(temp,sizeof(integer));
left:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
top:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
width:=temp;
trainer.ReadBuffer(temp,sizeof(integer));
height:=temp;
//caption
trainer.ReadBuffer(temp,4);
getmem(x,temp+1);
trainer.ReadBuffer(x^,temp);
x[temp]:=#0;
caption:=x;
freemem(x);
trainer.ReadBuffer(tempc,sizeof(tcolor));
font.Color:=tempc;
parent:=frmTrainerDesigner;
onmousedown:=frmTrainerDesigner.MouseDown;
onmousemove:=frmTrainerDesigner.MouseMove;
onmouseup:=frmTrainerDesigner.MouseUp;
end;
end;
$ffffffff: break;
else raise exception.Create(strunknowncomponent+Inttostr(temp));
end;
end;
end;
end;
//fill in the list of cheats
for i:=0 to length(frmMemoryModifier.trainerdata)-1 do
begin
frmMemoryModifier.recordview.Items.Add.caption:=frmMemoryModifier.trainerdata[i].description;
frmMemoryModifier.recordview.Items[frmMemoryModifier.recordview.Items.count-1].SubItems.add(frmMemoryModifier.trainerdata[i].hotkeytext);
end;
frmMemoryTrainerPreview.UpdateScreen;
if frmtrainerdesigner<>nil then frmtrainerdesigner.updatecheats
//freemem(x);
end;
procedure LoadTrainer2(trainer:tfilestream);
{type TcodeEntry1 = record
address: dword;
originalopcode: array of byte;
end;
type TAddressEntry1 = record
address: dword;
bit: byte;
memtyp: integer;
frozen: boolean;
setvalue: boolean;
userinput: boole
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -