📄 unit2.pas
字号:
end;
procedure TMainForm.CommentButtonMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if comments.Memo1.Lines.Count=0 then
begin
Commentbutton.Hint:='No Comments!';
exit;
end;
Commentbutton.Hint:=copy(comments.Memo1.Text,1,20);
if length(comments.Memo1.Text)>20 then Commentbutton.Hint:=Commentbutton.Hint+'...';
end;
procedure TMainForm.SpeedButton2Click(Sender: TObject);
var i: integer;
begin
if numberofrecords>0 then
begin
if messagedlg('Are you sure you want to delete all addresses?',mtWarning,[mbYes,mbNo],0)=mrNo then exit;
for i:=0 to numberofrecords-1 do
begin
output[0]:=CS_DeleteAddress;
pword(@output[1])^:=i;
sendbuf(3);
end;
numberofRecords:=0;
updatelist; //make sure the wipeout is successfull
updatescreen;
end;
end;
procedure TMainForm.CommentButtonClick(Sender: TObject);
begin
comments.showmodal;
end;
procedure TMainForm.SaveButtonClick(Sender: TObject);
var savefile: File;
actualwritten: Integer;
Controle: String[6];
records: dword;
x: Pchar;
begin
if (savedialog1.FileName='') and (opendialog1.filename<>'') then
begin
//set the filename the table was opened with to the filename you save as default to
//and dont forget to change the extension to .CT3
savedialog1.FileName:=ChangeFileExt(opendialog1.FileName,'');
end;
SaveDialog1.InitialDir:=cheatenginedir;
if Savedialog1.Execute then
begin
savetable(savedialog1.FileName);
end;
end;
procedure TMainForm.LoadButtonClick(Sender: TObject);
var merge: boolean;
app: word;
Extension: string;
begin
merge:=false;
if CheckIfSaved=false then exit;
OpenDialog1.InitialDir:=cheatenginedir;
if Opendialog1.Execute then
begin
Extension:=uppercase(extractfileext(opendialog1.filename));
if (Extension<>'.GH') and
(Extension<>'.CET') and
(Extension<>'.CT2') and
(Extension<>'.CT3') and
(Extension<>'.CT') and
(Extension<>'.EXE') then raise exception.create('Unknown extention');
if ((numberofrecords>0)) and (Extension<>'.EXE') then app:=messagedlg('You wish to merge the current table with this table?',mtConfirmation,mbYesNoCancel,0);
case app of
mrCancel: exit;
mrYes: merge:=true;
mrNo: merge:=false;
end;
LoadTable(Opendialog1.filename,merge);
end;
resync;
Updatescreen;
updatelist;
end;
procedure TMainForm.FControlEnter(Sender: TObject);
begin
LastSelected:=LastLastSelected;
Updatescreen;
end;
procedure TMainForm.FControlExit(Sender: TObject);
begin
LastLastSelected:=LastSelected;
Lastselected:=-1;
Updatescreen;
end;
procedure TMainForm.Label28Click(Sender: TObject);
var newdesc: string;
begin
if lastselected<>scrollbar1.position+(sender as TLabel).tag then exit;
newdesc:=InputBox('Description','Change the description to:',memrec[scrollbar1.position+(sender as TLabel).tag].Description);
if newdesc='' then newdesc:='No description!';
memrec[scrollbar1.position+(sender as TLabel).tag].Description:=newdesc;
updatescreen;
//updatelist not needed
end;
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose:=CheckIfSaved;
end;
procedure TMainForm.AddressClick(Sender: TObject);
var adr: String;
newadr: dword;
error: Integer;
bit: Byte;
begin
if memrec[scrollbar1.position+(sender as TLabel).tag].Frozen then
raise Exception.Create('You first have to unfreeze this address before you can change it');
if memrec[scrollbar1.position+(sender as TLabel).tag].VarType=5 then //bit
adr:=inputbox('Address','Give the new address: (use ^ to specify the startbit)',address[(sender as TLabel).tag].caption) else
adr:=inputbox('Address','Give the new address:',address[(sender as TLabel).tag].caption);
if adr='DEBUG' then
begin
showmessage(IntToStr(scrollbar1.position)+' - '+IntToStr((Sender As TLabel).tag));
showmessage(IntToStr(scrollbar1.position+(sender as TLabel).tag)+' - '+address[scrollbar1.position+(sender as TLabel).tag].caption);
end;
if memrec[scrollbar1.position+(sender as TLabel).tag].VarType=5 then
if pos('^',adr)=0 then
raise exception.Create('A binary type needs a startbit! (notation:xxxxxxxx^x)');
if adr[1]<>'$' then adr:='$'+adr;
val(adr,newadr,error);
if error=0 then memrec[scrollbar1.position+(sender as TLabel).tag].Address:=newadr else
if adr[error]='^' then
begin
//newadr contains the right address
//now just set the right bit
if length(adr)-error>1 then
raise exception.Create(adr+' is not an valid address!');
try
Bit:=StrToInt(adr[length(adr)]);
except
raise exception.Create(adr+' is not an valid address!');
end;
if bit>7 then
raise exception.Create(adr+' is not an valid address!');
//we made it to here so I assume this address is valid ;-)
memrec[scrollbar1.position+(sender as TLabel).tag].Address:=newadr;
memrec[scrollbar1.position+(sender as TLabel).tag].Bit:=Bit;
end else
raise exception.Create(adr+' is not an valid address!');
updatescreen;
updatelist;
end;
procedure TMainForm.Typeclick(Sender: TObject);
var i,j: Integer;
oldType: Integer;
begin
OldType:=memrec[scrollbar1.position+(sender as TLabel).tag].VarType;
if memrec[scrollbar1.position+(sender as TLabel).tag].Frozen then
Raise Exception.Create('You can''t change the type of an frozen value. First unfreeze it!');
TypeForm.NrOfRecord:=scrollbar1.position+(sender as TLabel).tag;
If memrec[scrollbar1.position+(sender as TLabel).tag].VarType=0 then TypeForm.VarType.itemindex:=1 else //byte
If memrec[scrollbar1.position+(sender as TLabel).tag].VarType=1 then TypeForm.VarType.itemindex:=2 else //word
If memrec[scrollbar1.position+(sender as TLabel).tag].VarType=2 then TypeForm.VarType.itemindex:=3 else //dword
If memrec[scrollbar1.position+(sender as TLabel).tag].VarType=3 then TypeForm.VarType.itemindex:=5 else //float
If memrec[scrollbar1.position+(sender as TLabel).tag].VarType=4 then TypeForm.VarType.itemindex:=6 else //double
If memrec[scrollbar1.position+(sender as TLabel).tag].VarType=5 then TypeForm.VarType.itemindex:=0 else //bit
If memrec[scrollbar1.position+(sender as TLabel).tag].VarType=6 then TypeForm.VarType.itemindex:=4 else //int64
If memrec[scrollbar1.position+(sender as TLabel).tag].VarType=7 then TypeForm.VarType.itemindex:=7 else //text
if memrec[scrollbar1.position+(sender as TLabel).Tag].VarType=8 then Typeform.VarType.ItemIndex:=8;
case memrec[scrollbar1.position+(sender as TLabel).tag].Bit of
0 : TypeForm.RadioButton1.checked:=true;
1 : TypeForm.RadioButton2.checked:=true;
2 : TypeForm.RadioButton3.checked:=true;
3 : TypeForm.RadioButton4.checked:=true;
4 : TypeForm.RadioButton5.checked:=true;
5 : TypeForm.RadioButton6.checked:=true;
6 : TypeForm.RadioButton7.checked:=true;
7 : TypeForm.RadioButton8.checked:=true;
end;
TypeForm.Showmodal;
if oldtype=memrec[scrollbar1.position+(sender as TLabel).tag].VarType then exit;
i:=0;
j:=0;
while (i<numberofrecords-1) and (j<1) do
begin
if selected[i] then inc(j);
inc(i);
end;
if (i>1) then
begin
j:=memrec[scrollbar1.position+(sender as TLabel).tag].VarType;
for i:=0 to numberofrecords-1 do
begin
if (selected[i]) and (not memrec[i].Frozen) then
memrec[i].VarType:=j;
end;
end;
resync;
updatescreen;
updatelist;
end;
procedure TMainForm.FControlKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var i,j: Integer;
comfirm: Dword;
doit: Boolean;
freeze: Boolean;
db: Byte;
dw: Word;
dd: dword;
di64: Int64;
a: single;
b: double;
error: Dword;
controle: String;
select: Integer;
count: integer;
begin
if ((key=ord('C')) and (ssCtrl in Shift) and not (ssAlt in Shift)) then copyselectedrecords;
if ((key=ord('V')) and (ssCtrl in Shift) and not (ssAlt in Shift)) then Paste;
if ((key=ord('X')) and (ssCtrl in Shift) and not (ssAlt in Shift)) then begin
copyselectedrecords;
deleterecords;
end;
case key of
ord('A')..ord('Z'),ord('0')..ord('9'): begin
if not (ssCtrl in Shift) then
begin
select:=-1;
for i:=lastselected+1 to numberofrecords-1 do
begin
if (length(memrec[i].description[1])>0) and (uppercase(memrec[i].description[1])=uppercase(chr(key))) then
begin
select:=i;
break;
end;
end;
if select=-1 then exit;
if not ((ssShift) in (Shift)) then FirstShiftSelected:=-1;
if ssShift in Shift then //ctrl does nothing
begin
if lastselected<numberofRecords-1 then
begin
if FirstShiftSelected=-1 then FirstShiftSelected:=lastselected;
//select everything from FirstShiftSelected to sel
for i:=0 to numberofrecords-1 do selected[i]:=false;
Lastselected:=select;
if FirstShiftSelected<lastselected then
for i:=FirstShiftselected to lastselected do selected[i]:=true
else
for i:=FirstShiftSelected downto lastselected do selected[i]:=true;
end;
end
else
begin
if lastselected<numberofRecords-1 then
begin
for i:=0 to numberofRecords-1 do selected[i]:=false;
Lastselected:=select;
selected[LastSelected]:=true;
end;
end;
if lastselected<scrollbar1.position then scrollbar1.Position:=lastselected;
if lastselected>scrollbar1.position+5 then scrollbar1.Position:=lastselected-5;
Updatescreen;
end;
end;
VK_RETURN:begin
value[lastselected-scrollbar1.position].OnDblClick(value[lastselected-scrollbar1.position]);
end;
VK_HOME: begin
if not ((ssShift) in (Shift)) then FirstShiftSelected:=-1;
if ssShift in Shift then //ctrl does nothing
begin
if lastselected>0 then
begin
if FirstShiftSelected=-1 then FirstShiftSelected:=lastselected;
//select everything from FirstShiftSelected to sel
for i:=0 to numberofrecords-1 do selected[i]:=false;
Lastselected:=0;
if FirstShiftSelected<lastselected then
for i:=FirstShiftselected to lastselected do selected[i]:=true
else
for i:=FirstShiftSelected downto lastselected do selected[i]:=true;
end;
scrollbar1.position:=0;
end
else
begin
if lastselected>0 then
begin
for i:=0 to numberofRecords-1 do selected[i]:=false;
Lastselected:=0;
selected[lastselected]:=true;
scrollbar1.Position:=0;
end;
end;
Updatescreen;
end;
VK_END: begin
//
if not ((ssShift) in (Shift)) then FirstShiftSelected:=-1;
if ssShift in Shift then //ctrl does nothing
begin
if lastselected<numberofRecords-1 then
begin
if FirstShiftSelected=-1 then FirstShiftSelected:=lastselected;
//select everything from FirstShiftSelected to sel
for i:=0 to numberofrecords-1 do selected[i]:=false;
Lastselected:=numberofrecords-1;
if FirstShiftSelected<lastselected then
for i:=FirstShiftselected to lastselected do selected[i]:=true
else
for i:=FirstShiftSelected downto lastselected do selected[i]:=true;
end;
end
else
begin
if lastselected<numberofRecords-1 then
begin
for i:=0 to numberofRecords-1 do selected[i]:=false;
Lastselected:=numberofrecords-1;
selected[LastSelected]:=true;
end;
end;
if lastselected<scrollbar1.position then scrollbar1.Position:=lastselected;
if lastselected>scrollbar1.position+5 then scrollbar1.Position:=lastselected-5;
Updatescreen;
end;
VK_UP: begin
if not ((ssShift) in (Shift)) then FirstShiftSelected:=-1;
if ssShift in Shift then //ctrl does nothing
begin
if lastselected>0 then
begin
if FirstShiftSelected=-1 then FirstShiftSelected:=lastselected;
//select everything from FirstShiftSelected to sel
for i:=0 to numberofrecords-1 do selected[i]:=false;
Lastselected:=lastselected-1;
if FirstShiftSelected<lastselected then
for i:=FirstShiftselected to lastselected do selected[i]:=true
else
for i:=FirstShiftSelected downto lastselected do selected[i]:=true;
end;
end
else
begin
if lastselected>0 then
begin
for i:=0 to numberofRecords-1 do selected[i]:=false;
Lastselected:=lastselected-1;
selected[lastselected]:=true;
end;
end;
if lastselected>scrollbar1.position+5 then scrollbar1.Position:=lastselected-5;
if lastselected<scrollbar1.position then scrollbar1.Position:=lastselected;
Updatescreen;
end;
VK_DOWN: begin
if not ((ssShift) in (Shift)) then FirstShiftSelected:=-1;
if ssShift in Shift then //ctrl does nothing
begin
if lastselected<numberofRecords-1 then
begin
if FirstShiftSelected=-1 then FirstShiftSelected:=lastselected;
//select everything from FirstShiftSelected to sel
for i:=0 to numberofrecords-1 do selected[i]:=false;
Lastselected:=lastselected+1;
if FirstShiftSelected<lastselected then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -