Skip to content

Commit

Permalink
split up memoryview function to it's own lua unit. (not necessary, bu…
Browse files Browse the repository at this point in the history
…t looks better)
  • Loading branch information
cheatengine@gmail.com committed Jan 8, 2013
1 parent 09f8595 commit 5474bca
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 178 deletions.
38 changes: 5 additions & 33 deletions Cheat Engine/LuaHandler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ implementation
LuaStringlist, LuaCustomControl, LuaGraphicControl, LuaPanel, LuaImage, LuaButton,
LuaCheckbox, LuaGroupbox, LuaListbox, LuaCombobox, LuaTrackbar, LuaListColumn,
LuaEdit, LuaMemo, LuaCollection, LuaListColumns, LuaListitem, LuaListItems,
LuaTimer, LuaListview, LuaGenericHotkey, LuaTableFile, LuaMemoryRecordHotkey;
LuaTimer, LuaListview, LuaGenericHotkey, LuaTableFile, LuaMemoryRecordHotkey,
LuaMemoryView;

resourcestring
rsLUA_DoScriptWasNotCalledRomTheMainThread = 'LUA_DoScript was not called '
Expand Down Expand Up @@ -2524,44 +2525,15 @@ function getMemoryViewForm(L: PLua_state): integer; cdecl;
luaclass_newClass(l, MemoryBrowser);
end;


function getMainForm(L: PLua_state): integer; cdecl;
begin
result:=1;
lua_pop(L, lua_gettop(l));
luaclass_newClass(l, mainform);
end;

function memoryview_getDisassemblerView(L: PLua_state): integer; cdecl;
var m: TMemoryBrowser;
parameters: integer;
begin
result:=0;
parameters:=lua_gettop(L);
if parameters=1 then
begin
m:=lua_toceuserdata(L, -1);
lua_pop(L, lua_gettop(l));

luaclass_newClass(L, m.disassemblerview);
result:=1;
end else lua_pop(L, lua_gettop(l));
end;

function memoryview_getHexadecimalView(L: PLua_state): integer; cdecl;
var m: TMemoryBrowser;
parameters: integer;
begin
result:=0;
parameters:=lua_gettop(L);
if parameters=1 then
begin
m:=lua_toceuserdata(L, -1);
lua_pop(L, lua_gettop(l));

luaclass_newClass(L, m.hexview);
result:=1;
end else lua_pop(L, lua_gettop(l));
end;


function getAddressList(L: PLua_state): integer; cdecl;
Expand Down Expand Up @@ -4289,8 +4261,8 @@ procedure InitializeLua;
lua_register(LuaVM, 'createFileStream', createFileStream);

Lua_register(LuaVM, 'getMemoryViewForm', getMemoryViewForm);
lua_register(LuaVM, 'memoryview_getDisassemblerView', memoryview_getDisassemblerView);
lua_register(LuaVM, 'memoryview_getHexadecimalView', memoryview_getHexadecimalView);

initializeLuaMemoryview;


Lua_register(LuaVM, 'getMainForm', getMainForm);
Expand Down
49 changes: 49 additions & 0 deletions Cheat Engine/LuaMemoryView.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
unit LuaMemoryView;

{$mode delphi}

interface

uses
forms, Classes, SysUtils, lua;

procedure initializeLuaMemoryview;

implementation

uses luahandler, luaclass, MemoryBrowserFormUnit;

function createMemoryView(L: PLua_state): integer; cdecl;
begin
luaclass_newClass(L, TMemoryBrowser.Create(application));
result:=1;
end;

function memoryview_getHexadecimalView(L: PLua_state): integer; cdecl;
var m: TMemoryBrowser;
begin
m:=luaclass_getClassObject(L);
luaclass_newClass(L, m.hexview);
result:=1;
end;

function memoryview_getDisassemblerView(L: PLua_state): integer; cdecl;
var m: TMemoryBrowser;
begin
m:=luaclass_getClassObject(L);
luaclass_newClass(L, m.disassemblerview);
result:=1;
end;


procedure initializeLuaMemoryView;
begin
lua_register(LuaVM, 'createMemoryView', createMemoryView);
lua_register(LuaVM, 'memoryview_getDisassemblerView', memoryview_getDisassemblerView);
lua_register(LuaVM, 'memoryview_getHexadecimalView', memoryview_getHexadecimalView);

end;

end.


5 changes: 3 additions & 2 deletions Cheat Engine/MainUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7491,8 +7491,9 @@ procedure TMainForm.Label59Click(Sender: TObject);
exportlist: pchar;
max: integer;
begin
memorybrowser.hexview.address:=GetStackStart;
memorybrowser.show;
TMemoryBrowser.Create(application).show;
{ memorybrowser.hexview.address:=GetStackStart;
memorybrowser.show;}


{
Expand Down
1 change: 1 addition & 0 deletions Cheat Engine/MemoryBrowserFormUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,7 @@ procedure TMemoryBrowser.FormCreate(Sender: TObject);
hexview.popupmenu:=memorypopup;

hexview.OnKeyDown:=hexviewKeyDown;
hexview.Name:='HexadecimalView';


memoryaddress:=$00400000;
Expand Down
9 changes: 7 additions & 2 deletions Cheat Engine/bin/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1390,8 +1390,13 @@ methods
Memoryview class: (Inheritance: Form->ScrollingWinControl->CustomControl->WinControl->Control->Component->Object)
memoryview_getDisassemblerView(memoryView): Returns the visual disassembler object on the memoryview window
memoryview_getHexadecimalView(memoryView): Returns the visual hexadecimal object on the memoryview window
createMemoryView() - Creates a new memoryview window. This window will not receive debug events. Use getMemoryViewForm() function to get the main memoryview window
properties
DisassemblerView: The disassemblerview class of this memoryview object
HexadecimalView: The hexadecimalview class of this memoryview object
methods
getDisassemblerView(): Returns the visual disassembler object on the memoryview window
getHexadecimalView(): Returns the visual hexadecimal object on the memoryview window
Disassemblerview class: (Inheritance: Panel->CustomControl->WinControl->Control->Component->Object)
The visual disassembler used on the memory view window
Expand Down
Loading

0 comments on commit 5474bca

Please sign in to comment.