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 


Mono: Add static field address crashes my game

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
MarcRené
Newbie cheater
Reputation: 0

Joined: 20 Mar 2017
Posts: 15

PostPosted: Wed May 23, 2018 10:00 am    Post subject: Mono: Add static field address crashes my game Reply with quote

Hi all,

currently I am fiddling with "Vaporum" (Nice Dungeon Crawler) in the GoG Version.

Found out that there is a very interesting variable called "CheatsEnabled", which is a boolean. I would like to have the address of this variable into my cheat table because turning it to 1 would enable the Hotkey Left shift + left ctrl + / to activate cheat mode.

So I used the mono feature and went into the mono dissector.
At the path Assembly-CSharp\VapBuildSettings\static fields\CheatsEnabled I made a right-click, chose "Fields" and then "Add static field address".

Got my table entry but if it is activated, the game instantly crashes.

Code:

[ENABLE]
label(classname)
label(namespace)
label(assemblyname)
label(fieldname)
label(status)
label(domain)
label(assembly)
label(field)
label(VapBuildSettings.CheatsEnabled)
label(VapBuildSettings.CheatsEnabled.threadexit)
alloc(VapBuildSettings.CheatsEnabled.threadstart, 2048)

registersymbol(VapBuildSettings.CheatsEnabled)

VapBuildSettings.CheatsEnabled.threadstart:
mov [VapBuildSettings.CheatsEnabled],0

call mono.mono_get_root_domain
cmp eax,0
je VapBuildSettings.CheatsEnabled.threadexit
mov [domain],eax

push [domain]
call mono.mono_thread_attach
add esp,4

push status
push assemblyname
call mono.mono_assembly_load_with_partial_name
add esp,8
cmp eax,0
je VapBuildSettings.CheatsEnabled.threadexit

push eax
call mono.mono_assembly_get_image
add esp,4
cmp eax,0
je VapBuildSettings.CheatsEnabled.threadexit
mov [assembly], eax

push classname
push namespace
push eax
call mono.mono_class_from_name_case
add esp,C
cmp eax,0
je VapBuildSettings.CheatsEnabled.threadexit
push fieldname
push eax
call mono.mono_class_get_field_from_name
add esp,8
cmp eax,0
je VapBuildSettings.CheatsEnabled.threadexit
mov [field], eax
push eax
call mono.mono_field_get_parent
add esp,4
cmp eax,0
je VapBuildSettings.CheatsEnabled.threadexit
push eax
push [domain]
call mono.mono_class_vtable
add esp,8
cmp eax,0
je VapBuildSettings.CheatsEnabled.threadexit
push eax
call mono.mono_vtable_get_static_field_data
add esp,4
cmp eax,0
je VapBuildSettings.CheatsEnabled.threadexit
push eax // save data on stack
push [field]
call mono.mono_field_get_offset
add esp,4
pop ebx // restore data
add eax,ebx
mov [VapBuildSettings.CheatsEnabled],eax
jmp VapBuildSettings.CheatsEnabled.threadexit
///////////////////////////////////////////////////////
// Data section
VapBuildSettings.CheatsEnabled:
dd 0
assemblyname:
db 'Assembly-CSharp',0
namespace:
db '',0
classname:
db 'VapBuildSettings',0
fieldname:
db 'CheatsEnabled',0
status:
dd 0
domain:
dd 0
assembly:
dd 0
field:
dd 0
VapBuildSettings.CheatsEnabled.threadexit:
ret
createthread(VapBuildSettings.CheatsEnabled.threadstart)

[DISABLE]
unregistersymbol(VapBuildSettings.CheatsEnabled)
dealloc(VapBuildSettings.CheatsEnabled.threadstart)


Any ideas?

Best regards,
Marc
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 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