📄 formsettingsunit.pas
字号:
mainform.advancedbutton.Visible:=cbShowAdvanced.checked;
//save to the registry
reg:=Tregistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\Software\Cheat Engine',true) then
begin
//write the settings
reg.WriteBool('Undo',cbshowundo.checked);
reg.WriteBool('Advanced',cbShowAdvanced.checked);
reg.WriteBool('SeperateThread',checkThread.checked);
reg.WriteInteger('ScanThreadpriority',combothreadpriority.itemindex);
reg.WriteInteger('Buffersize',bufsize);
reg.WriteInteger('Maxresults',newmax);
reg.WriteBool('UseDebugRegs',rbDebugRegisters.checked);
reg.writebool('Show Disassembler',cbShowDisassembler.checked);
reg.WriteBool('Center on popup',cbCenterOnPopup.checked);
reg.WriteInteger('Update interval',updateinterval);
reg.WriteInteger('Freeze interval',freezeinterval);
reg.writebool('Show values as signed',cbShowAsSigned.checked);
reg.writebool('Handle binarys as decimals',cbBinariesAsDecimal.checked);
reg.WriteInteger('Network Update Interval',Networkupdateinterval);
reg.WriteBool('Show debugger options',cbShowDebugOptions.checked);
reg.WriteBool('Replace incomplete opcodes with NOPS',replacewithnops.checked);
reg.WriteBool('Ask for replace with NOPS',askforreplacewithnops.checked);
reg.WriteBool('Use Anti-debugdetection',checkbox1.checked);
reg.WriteBool('Handle unhandled breakpoints',cbhandlebreakpoints.Checked);
reg.WriteBool('Fastscan on by default',cbFastscan.checked);
reg.WriteBool('Hardware breakpoints',rbDebugAsBreakpoint.checked);
reg.WriteBool('Update Foundaddress list',cbUpdatefoundList.checked);
reg.WriteInteger('Update Foundaddress list Interval',foundinterval);
{$ifndef net}
mainform.UpdateFoundlisttimer.Interval:=foundinterval;
{$endif}
reg.writebool('skip PAGE_NOCACHE',cbSkip_PAGE_NOCACHE.Checked);
reg.WriteBool('Break when debuging',cbBreakOnAttach.Checked);
reg.WriteBool('Hide all windows',cbHideAllWindows.checked);
reg.WriteBool('Really hide all windows',temphideall);
//save donthidelist
{$ifndef net}
setlength(donthidelist,length(tempdonthidelist));
for i:=0 to length(tempdonthidelist)-1 do
begin
donthidelist[i]:=tempdonthidelist[i];
reg.writestring('Do not hide '+IntToStr(i),tempdonthidelist[i]);
end;
//end
reg.writestring('Do not hide '+IntToStr(length(tempdonthidelist)),'');
reg.WriteBool('MEM_PRIVATE',cbMemPrivate.checked);
reg.WriteBool('MEM_IMAGE',cbMemImage.Checked);
reg.WriteBool('MEM_MAPPED',cbMemMapped.Checked);
onlyfront:=not temphideall;
reg.WriteBool('Low Memory Usage',cbLowMemoryUsage.checked);
reg.writebool('Use Hyperscan if posible',cbEnableHyperscanWhenPossible.checked);
//check the module list
if frmModuleSafety<>nil then //modified
begin
freemem(modulelist);
modulelist:=tempmodulelist;
modulelistsize:=tempmodulelistsize;
tempmodulelist:=nil;
denylist:=tempdenylist;
denylistglobal:=tempdenylistglobal;
reg.WriteBinaryData('Module List',ModuleList^,modulelistsize);
reg.writeInteger('modulelistsize',modulelistsize);
reg.WriteBool('Global Denylist',DenyListGlobal);
reg.WriteBool('ModuleList as Denylist',DenyList);
end;
//check the hotkeys
if (frmHotkeyConfig<>nil) and (ClickedOK) then
begin
//save the hotkeylist
reg.WriteBinaryData('Show Cheat Engine Hotkey',frmHotkeyConfig.newhotkeys[0][0],10);
reg.WriteBinaryData('Pause process Hotkey',frmHotkeyConfig.newhotkeys[1][0],10);
reg.WriteBinaryData('Toggle speedhack Hotkey',frmHotkeyConfig.newhotkeys[2][0],10);
reg.WriteFloat('Speedhack 1 speed',frmHotkeyConfig.newspeedhackspeed1.speed);
reg.WriteInteger('Speedhack 1 sleeptime',frmHotkeyConfig.newspeedhackspeed1.sleeptime);
reg.WriteFloat('Speedhack 2 speed',frmHotkeyConfig.newspeedhackspeed2.speed);
reg.WriteInteger('Speedhack 2 sleeptime',frmHotkeyConfig.newspeedhackspeed2.sleeptime);
reg.WriteFloat('Speedhack 3 speed',frmHotkeyConfig.newspeedhackspeed3.speed);
reg.WriteInteger('Speedhack 3 sleeptime',frmHotkeyConfig.newspeedhackspeed3.sleeptime);
reg.WriteFloat('Speedhack 4 speed',frmHotkeyConfig.newspeedhackspeed4.speed);
reg.WriteInteger('Speedhack 4 sleeptime',frmHotkeyConfig.newspeedhackspeed4.sleeptime);
reg.WriteFloat('Speedhack 5 speed',frmHotkeyConfig.newspeedhackspeed5.speed);
reg.WriteInteger('Speedhack 5 sleeptime',frmHotkeyConfig.newspeedhackspeed5.sleeptime);
mainunit2.speedhackspeed1:=frmhotkeyconfig.newspeedhackspeed1;
mainunit2.speedhackspeed2:=frmhotkeyconfig.newspeedhackspeed2;
mainunit2.speedhackspeed3:=frmhotkeyconfig.newspeedhackspeed3;
mainunit2.speedhackspeed4:=frmhotkeyconfig.newspeedhackspeed4;
mainunit2.speedhackspeed5:=frmhotkeyconfig.newspeedhackspeed5;
reg.WriteBinaryData('Set Speedhack speed 1 Hotkey',frmHotkeyConfig.newhotkeys[3][0],10);
reg.WriteBinaryData('Set Speedhack speed 2 Hotkey',frmHotkeyConfig.newhotkeys[4][0],10);
reg.WriteBinaryData('Set Speedhack speed 3 Hotkey',frmHotkeyConfig.newhotkeys[5][0],10);
reg.WriteBinaryData('Set Speedhack speed 4 Hotkey',frmHotkeyConfig.newhotkeys[6][0],10);
reg.WriteBinaryData('Set Speedhack speed 5 Hotkey',frmHotkeyConfig.newhotkeys[7][0],10);
reg.WriteBinaryData('Increase Speedhack speed',frmHotkeyConfig.newhotkeys[8][0],10);
reg.WriteFloat('Increase Speedhack delta',frmHotkeyConfig.speedupdelta);
reg.WriteBinaryData('Decrease Speedhack speed',frmHotkeyConfig.newhotkeys[9][0],10);
reg.WriteFloat('Decrease Speedhack delta',frmHotkeyConfig.slowdowndelta);
mainunit2.speedupdelta:=frmhotkeyconfig.speedupdelta;
mainunit2.slowdowndelta:=frmhotkeyconfig.slowdowndelta;
reg.WriteBinaryData('Binary Hotkey',frmHotkeyConfig.newhotkeys[10][0],10);
reg.WriteBinaryData('Byte Hotkey',frmHotkeyConfig.newhotkeys[11][0],10);
reg.WriteBinaryData('2 Bytes Hotkey',frmHotkeyConfig.newhotkeys[12][0],10);
reg.WriteBinaryData('4 Bytes Hotkey',frmHotkeyConfig.newhotkeys[13][0],10);
reg.WriteBinaryData('8 Bytes Hotkey',frmHotkeyConfig.newhotkeys[14][0],10);
reg.WriteBinaryData('Float Hotkey',frmHotkeyConfig.newhotkeys[15][0],10);
reg.WriteBinaryData('Double Hotkey',frmHotkeyConfig.newhotkeys[16][0],10);
reg.WriteBinaryData('Text Hotkey',frmHotkeyConfig.newhotkeys[17][0],10);
reg.WriteBinaryData('Array of Byte Hotkey',frmHotkeyConfig.newhotkeys[18][0],10);
reg.WriteBinaryData('New Scan Hotkey',frmHotkeyConfig.newhotkeys[19][0],10);
reg.WriteBinaryData('Unknown Initial Value Hotkey',frmHotkeyConfig.newhotkeys[20][0],10);
reg.WriteBinaryData('Increased Value Hotkey',frmHotkeyConfig.newhotkeys[21][0],10);
reg.WriteBinaryData('Decreased Value Hotkey',frmHotkeyConfig.newhotkeys[22][0],10);
reg.WriteBinaryData('Changed Value Hotkey',frmHotkeyConfig.newhotkeys[23][0],10);
reg.WriteBinaryData('Unchanged Value Hotkey',frmHotkeyConfig.newhotkeys[24][0],10);
reg.WriteBinaryData('Undo Last scan Hotkey',frmHotkeyConfig.newhotkeys[25][0],10);
reg.WriteBinaryData('Cancel scan Hotkey',frmHotkeyConfig.newhotkeys[26][0],10);
//apply these hotkey changes
for i:=0 to 26 do
begin
found:=false;
for j:=0 to length(hotkeythread.hotkeylist)-1 do
begin
if (hotkeythread.hotkeylist[j].id=i) and (hotkeythread.hotkeylist[j].handler2) then
begin
//found it
hotkeythread.hotkeylist[j].keys:=frmHotkeyConfig.newhotkeys[i];
found:=true;
break;
end;
end;
if not found then //add it
begin
j:=length(hotkeythread.hotkeylist);
setlength(hotkeythread.hotkeylist,j+1);
hotkeythread.hotkeylist[j].keys:=frmHotkeyConfig.newhotkeys[i];
hotkeythread.hotkeylist[j].windowtonotify:=mainform.Handle;
hotkeythread.hotkeylist[j].id:=i;
hotkeythread.hotkeylist[j].handler2:=true;
end;
checkkeycombo(frmHotkeyConfig.newhotkeys[i]);
end;
end;
{$endif}
reg.WriteBool('StealthOnExecute',cbStealth.Checked);
reg.WriteBool('Protect CE',cbProtectMe.Checked);
reg.WriteBool('Undo memory changes',cbUndoMemoryChanges.checked);
reg.WriteBool('Undo memory changes:Force writable',cbForceUndo.checked);
reg.WriteBool('Use dbk32 QueryMemoryRegionEx',cbKernelQueryMemoryRegion.checked);
reg.WriteBool('Use dbk32 ReadWriteProcessMemory',cbKernelReadWriteProcessMemory.checked);
reg.WriteBool('Use dbk32 OpenProcess',cbKernelOpenProcess.checked);
reg.WriteBool('Use Processwatcher',cbProcessWatcher.checked);
reg.WriteBool('Use Kernel Debugger',cbKdebug.checked);
reg.WriteInteger('Unrandomizer: default value',unrandomizersettings.defaultreturn);
reg.WriteBool('Unrandomizer: incremental',unrandomizersettings.incremental);
end;
finally
reg.CloseKey;
reg.free;
end;
SetAssociations;
{$ifndef net}
mainform.FreezeTimer.Interval:=freezeinterval;
mainform.UpdateTimer.Interval:=updateinterval;
{$else}
mainform.FreezeTimer.Interval:=freezeinterval;
mainform.UpdateTimer.Interval:=networkupdateinterval;
{$endif}
Skip_PAGE_NOCACHE:=cbSkip_PAGE_NOCACHE.Checked;
{$ifndef net}
Scan_MEM_PRIVATE:=cbMemPrivate.checked;
Scan_MEM_IMAGE:=cbMemImage.Checked;
Scan_MEM_MAPPED:=cbMemMapped.Checked;
{$endif}
laststatePopupHide:=tempstatepopuphide;
lastpopupmodifier:=temppopupmodifier;
laststatePause:=tempstatepause;
lastPausemodifier:=temppausemodifier;
laststateSpeedhack:=tempstatespeedhack;
lastSpeedhackmodifier:=tempspeedhackmodifier;
modalresult:=mrok;
end;
procedure TformSettings.checkThreadClick(Sender: TObject);
begin
if checkthread.checked then
begin
label3.Enabled:=true;
combothreadpriority.enabled:=true;
end
else
begin
label3.Enabled:=false;
combothreadpriority.enabled:=false;
end;
end;
procedure TformSettings.EditMaxKeyPress(Sender: TObject; var Key: Char);
var getal: string;
getal2: Integer;
i: integer;
begin
decimal(key);
getal:=EditMax.text+key;
val(getal,getal2,i);
if getal2>32000 then
begin
beep;
key:=chr(0);
end;
end;
procedure TformSettings.EditBufSizeKeyPress(Sender: TObject;
var Key: Char);
begin
decimal(key);
end;
procedure TformSettings.Default1Click(Sender: TObject);
begin
editbufsize.Text:='512';
end;
procedure TformSettings.Default2Click(Sender: TObject);
begin
editmax.text:='50';
end;
procedure TformSettings.FormShow(Sender: TObject);
function CheckAssociation(ext: string):boolean;
var reg: TRegistry;
temp: string;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CLASSES_ROOT;
reg.LazyWrite := false;
try
reg.OpenKey(ext+'\shell\open\command',false);
except
result:=false;
reg.free;
exit;
end;
temp:=reg.ReadString('');
if temp<>application.ExeName+' "%1"' then
begin
result:=false;
reg.CloseKey;
reg.free;
exit;
end;
result:=true;
end;
var reg: TRegistry;
i: integer;
begin
clickedok:=false;
tempstatepopuphide:=laststatePopupHide;
temppopupmodifier:=lastpopupmodifier;
tempstatepause:=laststatePause;
temppausemodifier:=lastPausemodifier;
tempstatespeedhack:=laststateSpeedhack;
tempspeedhackmodifier:=lastSpeedhackmodifier;
{$ifndef net}
setlength(tempdonthidelist,length(donthidelist));
for i:=0 to length(donthidelist)-1 do
tempdonthidelist[i]:=donthidelist[i];
{$endif net}
if IsDebuggerPresentLocation=0 then
begin
checkbox1.Enabled:=false;
checkbox2.Enabled:=false;
end;
{$ifndef net}
if debuggerthread<>nil then
begin
rbDebugAsBreakpoint.Enabled:=false;
rbInt3AsBreakpoint.Enabled:=false;
end
else
begin
rbDebugAsBreakpoint.Enabled:=true;
rbInt3AsBreakpoint.Enabled:=true;
end;
{$endif}
cbCT.checked:=CheckAssociation('.CT');
cbCET.checked:=CheckAssociation('.CET');
cbCT2.checked:=CheckAssociation('.CT2');
cbCT3.checked:=CheckAssociation('.CT3');
cbGH.checked:=CheckAssociation('.GH');
label1.Enabled:=not mainform.nextscanbutton.enabled;
editbufsize.enabled:=not mainform.nextscanbutton.enabled;
//load the settings from the register and apply them to this window
{$ifndef net}
if GetSystemType<3 then //not a supported os for hardware breakpoints
begin
rdWriteExceptions.Checked:=true;
rbDebugRegisters.Enabled:=false;
rbDebugAsBreakpoint.enabled:=false;
rbInt3AsBreakpoint.enabled:=true;
label6.Enabled:=false;
label7.Enabled:=false;
end;
btnUnrandomizerconfig.Enabled:=not mainform.cbUnrandomizer.Checked;
{$endif}
end;
procedure TformSettings.cbShowDisassemblerClick(Sender: TObject);
begin
if cbshowdisassembler.Checked then
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -