Skip to content

Commit

Permalink
some fixes to the invoke dialog/script and make it available to the gui
Browse files Browse the repository at this point in the history
  • Loading branch information
cheat-engine committed May 23, 2017
1 parent 10a7e6b commit 72b0c1d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ void CPipeServer::GetMethodParameters()
WriteByte(0);
}

//param types
if (paramcount)
{
gpointer iter = NULL;
MonoType *paramtype=mono_signature_get_params((MonoMethodSignature*)methodsignature, &iter);
Expand Down
Binary file modified Cheat Engine/bin/autorun/dlls/MonoDataCollector32.dll
Binary file not shown.
Binary file modified Cheat Engine/bin/autorun/dlls/MonoDataCollector64.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Cheat Engine/bin/autorun/forms/MonoDataCollector.frm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<FormData>
<monoForm Class="TCEForm" Encoding="Ascii85">eN_m@/1]d=lWrU+X:qrwEi+6{1^mlt9rlGshT@1bAZap+x9wX.Yb%LZS?OtA*1BEz^[email protected]=LTzs_WjlCQX9S@o6uXWRD%S5igIND7II!x3HR]acJaH/T=]y8g;S-IsCwU,cv!3-zjgTeCe9YbHgbJBAuJWJy8.Emg/kj0(CCeRI(x=4s.(OvT!E#*Ju6y;3or!Vt(q#(RAgN])jMRM_HyVedF}j^EXj;N$C!L+WzjSZ!$6htvl}H#PqzZMJ4L3?7$lD[ebW$:OoaO}SKYdVRVeYp#cyMp.emQ*epUb){WWGRxP@871LF?DGkNlbbo@utlc^T{*I,Rn6+5geN(Cal+vX=xA{3^!Qs;PsHFcCL,Y{aUL!]lT@W@-O}@9a..[A(?p*4u#jeykaPl$zbK7!Y#Lt6kS1.L7A/ygT^PJRW4?A]-]83LLnk+!Ok[o9%%s$}[NC-Li/2W/uV[TWz9JjTvRb{TqN0gC5vgIH.eHlyS=(V}C-$iCrHC/NIX-6MZtRH7:-+76,fx4%3^Z]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 changes: 41 additions & 8 deletions Cheat Engine/bin/autorun/monoscript.lua
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,9 @@ function mono_findClass(namespace, classname)

--searches all images for a specific class
local ass=mono_enumAssemblies()
local result=0
local result

if ass==nil then return nil end

for i=1, #ass do

Expand All @@ -955,13 +957,14 @@ function mono_findClass(namespace, classname)
end


return 0
return nil
end

function mono_class_findMethod(class, methodname)
if debug_canBreak() then return nil end

if methodname==nil then return 0 end
if methodname==nil then return nil end
if monopipe==nil then return nil end

monopipe.lock()
monopipe.writeByte(MONOCMD_FINDMETHOD)
Expand All @@ -983,7 +986,7 @@ function mono_findMethod(namespace, classname, methodname)

local class=mono_findClass(namespace, classname)
local result=0
if class~=0 then
if class and (class~=0) then
result=mono_class_findMethod(class, methodname)
end

Expand Down Expand Up @@ -1063,6 +1066,7 @@ end
function mono_method_get_parameters(method)
--like mono_method_getSignature but returns it in a more raw format (no need to string parse)
if debug_canBreak() then return nil end
if monopipe==nil then return nil end

if method==nil then return nil end
local result={}
Expand All @@ -1080,6 +1084,9 @@ function mono_method_get_parameters(method)
--names
for i=1, paramcount do
local namelength=monopipe.readByte()

if namelength==nil then return nil end

result.parameters[i]={}

if namelength>0 then
Expand All @@ -1106,6 +1113,7 @@ function mono_method_getSignature(method)
if debug_canBreak() then return nil end

if method==nil then return nil end
if monopipe==nil then return nil end

local result=''
local parameternames={}
Expand Down Expand Up @@ -1311,9 +1319,11 @@ function mono_invoke_method_dialog(domain, method)
--parameter fields will be of the proper type

--the instance field may be a dropdown dialog which gets populated by mono_class_findInstancesOfClass* or a <new instance> button where the user can choose which constructor etc...
if method==nil then return nil,'Method==nil' end

local types, paramnames, returntype=mono_method_getSignature(method)

if types==nil then return ' ERR:types==nil' end
if types==nil then return nil,'types==nil' end

local mifinfo={}

Expand Down Expand Up @@ -1464,6 +1474,7 @@ function mono_invoke_method_dialog(domain, method)

mifinfo.btnOk.OnClick=function(b)
local instance=getAddressSafe(mifinfo.cbInstance.Text)

if instance==nil then
instance=tonumber(mifinfo.cbInstance.Text)
end
Expand All @@ -1478,6 +1489,7 @@ function mono_invoke_method_dialog(domain, method)
--use monoTypeToVartypeLookup to convert it to the type mono_method_invole likes it
local args={}
for i=1, #params.parameters do
args[i]={}
args[i].type=monoTypeToVartypeLookup[params.parameters[i].type]
if args[i].type==vtString then
args[i].value=mifinfo.parameters[i].edtVarText.Text
Expand All @@ -1490,8 +1502,16 @@ function mono_invoke_method_dialog(domain, method)
return
end
end

mono_invoke_method(domain, method, instance, args)

_G.args=args
_G.instance=instance
_G.method=method
_G.bla=123

local r=mono_invoke_method(domain, method, instance, args)
if r then
print(r)
end

end

Expand Down Expand Up @@ -1613,6 +1633,15 @@ function monoform_miShowILDisassemblyClick(sender)

end

function monoform_miInvokeMethodClick(sender)
local node=monoForm.TV.Selected

if (node~=nil) and (node.Level==4) and (node.Parent.Text=='methods') then
mono_invoke_method_dialog(nil, node.data)
end


end

function monoform_miRejitClick(sender)
if (monoForm.TV.Selected~=nil) then
Expand Down Expand Up @@ -1681,6 +1710,9 @@ function monoform_miFindInstancesOfClass(sender)
end
end




--[[
function monoform_miCreateObject(sender)
if (monoForm.TV.Selected~=nil) then
Expand Down Expand Up @@ -1865,6 +1897,7 @@ function monoform_context_onpopup(sender)

local methodsEnabled = (node~=nil) and (node.Level==4) and (node.Parent.Text=='methods')
monoForm.miRejit.Enabled = methodsEnabled
monoForm.miInvokeMethod.Enabled = methodsEnabled
monoForm.miGetILCode.Enabled = methodsEnabled
monoForm.miShowILDisassembly.Enabled = methodsEnabled
local structuresEnabled = (node~=nil) and (node.Data~=nil) and (node.Level==2)
Expand Down Expand Up @@ -2783,7 +2816,7 @@ function monoAA_GETMONOSTRUCT(parameters, syntaxcheckonly)
namespace=namespace:match "^%s*(.-)%s*$"

local class=mono_findClass(namespace, classname)
if (class==0) then
if (class==nil) or (class==0) then
return nil,"The class "..namespace..":"..classname.." could not be found"
end

Expand Down

0 comments on commit 72b0c1d

Please sign in to comment.