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 


Getting fields/values from mono dissect?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Kajih
Cheater
Reputation: 1

Joined: 08 Feb 2021
Posts: 32

PostPosted: Wed Feb 17, 2021 2:29 pm    Post subject: Getting fields/values from mono dissect? Reply with quote

Hi, If I find an instruction that modifies a value, say health for instance. Is there a way to get the address of that value from the instruction itself and add it to my cheat table?

So I am using Mono Dissect to find health, I found the class and then the the correct instance and I know my health is at 54 offset, so I copy the address of the instance and then add instance+54 in my cheat table. I then attach the debugger on that variable and find where damage is applied in the game.

looks like this:
PlayerHealth:DoApplyDamage+806 F3 0F11 6F 54 movss [rdi+54], xmm5

Now I basically nop this and its fine, but what I want to know is that is there anyway to retrieve the address of [rdi+54] and add it to my table through using a script or use LUA and Mono Dissect somehow to always get the correct instance of the class through code?

Basically trying to find alternate ways to auto populate values to a cheat table without using AOB or Pointer Scans if I use Mono Dissector Methods.


Alternately, would also like to know how I would set a float here as well. I have another location where you have a limited amount of uses on a candle, I found where the candle gets used so if I nop, I get unlimited uses. However I would like to not only get unlimited but set the percentage to 100.

I am replacing movss [rsi+44],xmm5 to this:

Code:

{$STRICT}
define(candle_bytes, F3 0F 11 6E 44)

[ENABLE]
{$lua}
if syntaxcheck then return end
if LaunchMonoDataCollector() ~= 0 then
   local mID_1 = mono_findMethod('Assembly-CSharp','CandlestickBehavior', 'Update')
   mono_compile_method(mID_1)
end

{$asm}
alloc(newmem,$1000)

newmem:
assert(CandlestickBehavior:Update+1b0, lantern_bytes)
CandlestickBehavior:Update+1b0:
   push rax                     // save rax (we'll overwrite it later)
   push (float)100              // push value to add to stack
   movss xmm5, dword ptr [rsp]  // load and move from stack
   pop rax                      // remove from stack
   pop rax                      // restore rax
   movss [rsi+44],xmm5          // write value to memory

[DISABLE]
CandlestickBehavior:Update+1b0:
   db candle_bytes
dealloc(newmem)


However this does not seem to be working, the candle stops burning but the amount rsi+44 (which seems to be the percentage) is not set to 100. Also when I disable the script, the code does not seem to go back to the original, looks like two empty bytes are added at the bottom of the original instruction. I can post more details if needed.

The game I am testing on is Ghost of a Tale (windows store version).
Back to top
View user's profile Send private message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Wed Feb 17, 2021 2:41 pm    Post subject: Reply with quote

You have to jump to newmem.

Code:
assert(CandlestickBehavior:Update+1b0, lantern_bytes)

label(healthPtr)
registersymbol(healthPtr)

newmem:
  mov [healthPtr],rsi
   push rax                     // save rax (we'll overwrite it later)
   push (float)100              // push value to add to stack
   movss xmm5, dword ptr [rsp]  // load and move from stack
   pop rax                      // remove from stack
   pop rax                      // restore rax
   movss [rsi+44],xmm5          // write value to memory
jmp return
healthPtr:
dq 0


CandlestickBehavior:Update+1b0:
jmp newmem
return:


[healthPtr]+44 will be your pointer to use in the table.
Back to top
View user's profile Send private message
Kajih
Cheater
Reputation: 1

Joined: 08 Feb 2021
Posts: 32

PostPosted: Wed Feb 17, 2021 6:30 pm    Post subject: Reply with quote

Works like a charm and you've answered everything I needed. Major kudos and thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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