add autoAssembleCheck and fix the combobox in the exe generator

This commit is contained in:
Dark Byte 2017-04-11 02:17:22 +02:00
parent 9ccbdef528
commit 3b8fd28951
6 changed files with 79 additions and 23 deletions

View File

@ -2158,6 +2158,49 @@ begin
result:=deAllocEx(getcurrentprocess, L);
end;
function AutoAssembleCheck_lua(L: PLua_State): integer; cdecl;
var
script: tstringlist;
enable: boolean;
targetself: boolean;
begin
script:=tstringlist.create;
if lua_gettop(L)=0 then
begin
lua_pushboolean(L,false);
lua_pushstring(L,'No parameters given');
exit(2);
end;
try
script.text:=Lua_ToString(L,1);
if lua_gettop(L)=2 then
enable:=lua_toboolean(L,2)
else
enable:=true;
if lua_gettop(L)=3 then
targetself:=lua_toboolean(L,3)
else
targetself:=false;
try
lua_pushboolean(L,autoassemble(script,false,enable,true,targetself));
exit(1);
except
on e:exception do
begin
lua_pushboolean(L,false);
lua_pushstring(L,e.message);
exit(2);
end;
end;
finally
script.free;
end;
end;
function autoAssemble_lua(L: PLua_State): integer; cdecl;
var
parameters: integer;
@ -8250,6 +8293,7 @@ begin
lua_register(L, 'readBytesLocal', readbyteslocal);
lua_register(L, 'writeBytesLocal', writebyteslocal);
lua_register(L, 'autoAssemble', autoAssemble_lua);
lua_register(L, 'autoAssembleCheck', AutoAssembleCheck_lua);
lua_register(L, 'deAlloc', deAlloc_lua);
lua_register(L, 'deAllocLocal', deAllocLocal_lua);
lua_register(L, 'showMessage', showMessage_lua);

View File

@ -2285,6 +2285,8 @@ begin
if findwindow=nil then findwindow:=TFindwindow.create(self);
findwindow.firstscan:=true;
findwindow.editStart.text:=inttohex(hexview.SelectionStart,8);
findwindow.ShowModal;
end;

View File

@ -159,6 +159,8 @@ generateAPIHookScript(address, addresstojumpto, addresstogetnewcalladdress OPT)
autoAssemble(text, targetself OPTIONAL, disableInfo OPTIONAL) : runs the auto assembler with the given text. Returns true on success, with as secondary a table you can use when disabling (if targetself is set it will assemble into Cheat Engine itself). If disableInfo is provided the [Disable] section will be handled
autoAssemble(text, disableInfo OPTIONAL)
autoAssembleCheck(text, enable, targetself) : Checks the script for syntax errors. Returns true on succes, false with an error message on failure
registerExeTrainerFeature(FeatureName:String, function():table): adds a new feature to the exe trainer generator window, and calls your function when the user builds an .exe trainer. The function should return a table with table entries: PathToFile and RelativePath.
example output:
[1]:

View File

@ -1,13 +1,6 @@
find higher resolution icons
memview hexview: Add a header showing details about the selection (bytecount, hex->dec)
memview: ctrl+f ->adjust from region
exe trainer generator compression isn't properly sized
don't forget the test buttons in advanced options
add a filter in the processlist to filter out system processes
make an "Appication list" process window

View File

@ -21,22 +21,22 @@ object frmExeTrainerGenerator: TfrmExeTrainerGenerator
Left = 0
Height = 206
Top = 0
Width = 321
Width = 312
AutoSize = True
BevelOuter = bvNone
ClientHeight = 206
ClientWidth = 321
ClientWidth = 312
TabOrder = 0
object GroupBox1: TGroupBox
Left = 0
Height = 58
Top = 39
Width = 321
Width = 312
Align = alTop
AutoSize = True
Caption = 'Process'
ClientHeight = 38
ClientWidth = 317
ClientWidth = 308
TabOrder = 0
object rb32: TRadioButton
AnchorSideLeft.Control = GroupBox1
@ -67,7 +67,7 @@ object frmExeTrainerGenerator: TfrmExeTrainerGenerator
Left = 0
Height = 61
Top = 97
Width = 321
Width = 312
Align = alTop
AutoSize = True
Caption = 'Features used'
@ -76,7 +76,7 @@ object frmExeTrainerGenerator: TfrmExeTrainerGenerator
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 3
ClientHeight = 41
ClientWidth = 317
ClientWidth = 308
TabOrder = 1
object cbSpeedhack: TCheckBox
Left = 0
@ -151,7 +151,7 @@ object frmExeTrainerGenerator: TfrmExeTrainerGenerator
Left = 241
Height = 23
Top = 171
Width = 80
Width = 71
BorderSpacing.Left = 3
ItemHeight = 15
ItemIndex = 3
@ -207,12 +207,12 @@ object frmExeTrainerGenerator: TfrmExeTrainerGenerator
Left = 0
Height = 39
Top = 0
Width = 321
Width = 312
Align = alTop
AutoSize = True
Caption = 'Trainer size'
ClientHeight = 19
ClientWidth = 317
ClientWidth = 308
TabOrder = 5
object cbTiny: TRadioButton
AnchorSideLeft.Control = cbGigantic
@ -286,22 +286,22 @@ object frmExeTrainerGenerator: TfrmExeTrainerGenerator
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Panel2
Left = 324
Left = 315
Height = 211
Top = 0
Width = 273
Width = 282
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 3
Caption = 'Extra files'
ClientHeight = 191
ClientWidth = 269
ClientWidth = 278
TabOrder = 2
object ListView1: TListView
Left = 0
Height = 158
Top = 0
Width = 269
Width = 278
Align = alClient
Columns = <
item
@ -325,12 +325,12 @@ object frmExeTrainerGenerator: TfrmExeTrainerGenerator
Left = 0
Height = 33
Top = 158
Width = 269
Width = 278
Align = alBottom
AutoSize = True
BevelOuter = bvNone
ClientHeight = 33
ClientWidth = 269
ClientWidth = 278
TabOrder = 1
object btnRemoveFile: TButton
AnchorSideLeft.Control = btnAddFile

View File

@ -674,7 +674,10 @@ begin
end;
procedure TfrmExeTrainerGenerator.FormShow(Sender: TObject);
var i:integer;
var
i,s:integer;
cbi: TComboboxInfo;
extrasize: integer;
begin
i:=max(max(button3.Width, btnAddFile.Width), btnRemoveFile.Width);
@ -682,6 +685,18 @@ begin
btnAddFile.Width:=i;
btnRemoveFile.Width:=i;
groupbox3.Constraints.MinHeight:=panel1.height;
cbi.cbSize:=sizeof(cbi);
if GetComboBoxInfo(comboCompression.handle, @cbi) then
extrasize:=cbi.rcButton.Right-cbi.rcButton.Left+cbi.rcItem.Left
else
extrasize:=16;
s:=0;
for i:=0 to comboCompression.Items.Count-1 do
s:=max(s, canvas.GetTextWidth(comboCompression.items[i]));
comboCompression.Constraints.MinWidth:=s+extrasize;
end;
procedure TfrmExeTrainerGenerator.ListView1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);