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 


Multiple AOBs - Same opcodes - "Different" Functio

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

Joined: 30 May 2017
Posts: 11

PostPosted: Wed Jan 11, 2023 9:01 pm    Post subject: Multiple AOBs - Same opcodes - "Different" Functio Reply with quote

So, I'm trying to make a simple relic multiplier code for Risk of Rain 2.

Typically, I narrow down an address that has a relic and find out what instructions write to it and then do an AOB injection for that instruction. This time however the instruction doesn't stick after restart. Come to find out there's actually two functions that use the same opcodes but have a different jump instruction at the end. Using the Mono dissector, I was able to find out the names of the functions and they are the same... but different.

Here are the functions and offsets with the instruction I am hoping to inject at.
`DMD<GiveItem>?1075834880:_RoR2_Inventory::GiveItem+15b`
`RoR2.Inventory:GiveItem+15b `

The byte string in question:

`89 11 3B C6 0F 85 29 00 00 00 49 8B 47 38 48 8B C8 48 8B D7 83 38 00 48 8D 6D 00 49 BB XX`

The byte string shows up twice with the exception of 'xx`. ` xx` keeps changing on restart and it's a `mov` instruction for referecing a different function that's related. Those bytes keep changing on reboot though.

I'm not too great with Mono so I've avoided using it, but it has helped me find instructions like this before. I've just never encountered a constantly changing byte string.

My question is, how can I write my code so that it finds the right instruction to inject into every time? The correct instruction is
`DMD<GiveItem>?1075834880:_RoR2_Inventory::GiveItem+15b` `mov [rcx],ecx`

Attached is the memory view for both (I couldn't have Mono features activated for two instances of CE attached to the same process)

Left is `DMD<GiveItem>?1075834880:_RoR2_Inventory::GiveItem+15b`
Right is `RoR2.Inventory:GiveItem+15b `

highlighted up until the `xx` Bytes change



Risk of Rain 2 giveitem memory view.png
 Description:
 Filesize:  199.95 KB
 Viewed:  1630 Time(s)

Risk of Rain 2 giveitem memory view.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Wed Jan 11, 2023 11:13 pm    Post subject: Reply with quote

It would be nice if you could inject at the instruction above that (i.e. +158 ). That way, the `jne` won't be included as part of the injection. (disregard if some other instruction jumps directly to +15B)

I'm not great with mono, but I'd do this:
Code:
{$lua}
if syntaxcheck then return 'define(address,0)' end

local addr = getAddressSafe'DMD<GiveItem>?1075834880:_RoR2_Inventory::GiveItem+15b'
assert(addr, 'Could not get address of injection point')

return ('define(address,%08X)'):format(addr)
{$asm}
define(bytes,4C 8B F0 89 11)

[ENABLE]
assert(address,bytes)
...
Basically the full injection template, but use a {$lua} block to get the address.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
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