Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


findMethod

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
KalasDev
Master Cheater
Reputation: 1

Joined: 29 May 2016
Posts: 311

PostPosted: Sat Sep 15, 2018 5:11 pm    Post subject: findMethod Reply with quote

Code:
mono_invoke_method(nil, mono_findMethod('','DebugConsole', '_godmode'), 1, { {type=vtString, Value=on} })


I know the "value" is wrong, what should it be instead of "value"[/code]
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sun Sep 16, 2018 1:22 am    Post subject: Reply with quote

mono_invoke_method uses the following params:
Code:
mono_invoke_method(domain, method, object, args)


You are passing 1 as the object which would be invalid.

Other thing would be ensuring _godmode is a string. Your find method call may need to be modded as well to look for the get/set accessor function of the property (I assume _godmode is a property based on what you gave.). So that would possibly be 'set__godmode' instead of just _godmode. Then assuming 1 was the value you were thinking of giving, perhaps it should be:

{{type=vtDword, value=1}}

You may also need to give an actual object instead of 1 or nil too if DebugConsole is a an instanced object.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
KalasDev
Master Cheater
Reputation: 1

Joined: 29 May 2016
Posts: 311

PostPosted: Sun Sep 16, 2018 3:16 am    Post subject: Reply with quote

Uh huh, thanks a lot for the reply.

Yes the address should work with 0x1, tested it with a couple of other stuff, but again the set_godmode may be needing an address to check if it's for the player or not, more specifically I guess :thinking:
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun Sep 16, 2018 9:02 am    Post subject: Reply with quote

It's a method as can be seen in a screenshot he showed on the Cheat The Game discord
I had him try/use 1 for the address in some debugmenu:addGold method (not the console) since it didn't seem like it should actually need an instance address for what it was doing and 0 didn't work but didn't crash either (at a guess likely a basic check simply because it wasn't made a static function in the source). It worked, so of course it was tried here as well. Not sure how many others he may have tried it with.

However I've never tried to pass a string to a mono method so i couldn't really figure this one out over discord, though I did suggest the obvious {type:vtString, 'on'} (seemed to break the monopipe ex) and writing a wide string to memory and passing the address as vtQword, as well as writing the length before the string as a word since I saw something like that in monoscript.lua (though I can't remember now if that was tried or if the obvious variations of mem+2 and length=chars vs length= bytes were tried)


_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sun Sep 16, 2018 11:28 pm    Post subject: Reply with quote

{{type=vtString, value='on'}}

Should be the way to go with that then, or instead of 'on' try '1'.

The object param should be nil or an actual object, passing 1 would be giving it an invalid object unless CE does some vodoo behind the scenes with it. (Not too sure since I haven't really used the mono stuff much at all.)

You could use a tool like dnSpy to dig into this more to see what _godmode does with the value passed to it and such as well to know exactly what it expects aside from just it being a string type.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
KalasDev
Master Cheater
Reputation: 1

Joined: 29 May 2016
Posts: 311

PostPosted: Mon Sep 17, 2018 1:29 am    Post subject: Reply with quote

Thanks atom0s and FreeER, and I found with DnSpy these stuff:

https://imgur.com/a/y30dbrJ

I'm going to try the SetGodMode as I haven't seen it before using the Mono Features alone in the Class called: CheatsBridge.

And since it's a bool, I'm not quite sure what kind of vt I should use, I assume for the most It should be vtBoolean and a value of 1.

mono_invoke_method(nil, mono_findMethod('','DebugConsole', 'SetGodMode'), 1, { {type=vtBoolean, Value=1} })
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Sep 17, 2018 6:37 am    Post subject: Reply with quote

Well that definitely shows _godmode using the object (this) though only to call other methods so can't say for sure whether those actually access the memory in any way. It also shows that it wants 'on', 'off', or 'toggle' which kind of explains why it takes a string rather than just a booean, since there are 3 values not just 2, though it also looks like it takes input straight from the user at a console without checking the input elsewhere to verify it makes sense.

As for a boolean, the CE vt type equivalent is vtByte. You can see the table at the top of monoscript.lua
Code:
monoTypeToVartypeLookup[MONO_TYPE_BOOLEAN]=vtByte
monoTypeToVartypeLookup[MONO_TYPE_CHAR]=vtString
monoTypeToVartypeLookup[MONO_TYPE_I1]=vtByte
monoTypeToVartypeLookup[MONO_TYPE_U1]=vtByte
monoTypeToVartypeLookup[MONO_TYPE_I2]=vtWord
monoTypeToVartypeLookup[MONO_TYPE_U2]=vtWord
monoTypeToVartypeLookup[MONO_TYPE_I4]=vtDword
monoTypeToVartypeLookup[MONO_TYPE_U4]=vtDword
monoTypeToVartypeLookup[MONO_TYPE_I8]=vtQword
monoTypeToVartypeLookup[MONO_TYPE_U8]=vtQword
monoTypeToVartypeLookup[MONO_TYPE_R4]=vtSingle
monoTypeToVartypeLookup[MONO_TYPE_R8]=vtDouble
monoTypeToVartypeLookup[MONO_TYPE_STRING]=vtPointer --pointer to a string object
monoTypeToVartypeLookup[MONO_TYPE_PTR]=vtPointer
monoTypeToVartypeLookup[MONO_TYPE_BYREF]=vtPointer
monoTypeToVartypeLookup[MONO_TYPE_CLASS]=vtPointer
monoTypeToVartypeLookup[MONO_TYPE_FNPTR]=vtPointer
monoTypeToVartypeLookup[MONO_TYPE_GENERICINST]=vtPointer
monoTypeToVartypeLookup[MONO_TYPE_ARRAY]=vtPointer
monoTypeToVartypeLookup[MONO_TYPE_SZARRAY]=vtPointer



btw, you'll need to change DebugConsole in the find method call, since it's not part of the DebugConsole class but rather the CheatsBridge class.

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
KalasDev
Master Cheater
Reputation: 1

Joined: 29 May 2016
Posts: 311

PostPosted: Mon Sep 17, 2018 7:54 am    Post subject: Reply with quote

Uh huh I see thanks FreeER Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites