 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
tuxlu How do I cheat?
Reputation: 0
Joined: 24 Sep 2023 Posts: 7
|
Posted: Mon Oct 13, 2025 7:58 pm Post subject: structure compare across game reboots |
|
|
hi!
So I was battling with shared instructions on my cheat and wanted to know if there was a better way.
So I have my instruction I want to change:
- i change it, of course the game crashes because shared instructions
- I do "find out whate adresses this instruction accesses". I have 530 results (that's a lot)
- I choose the correct adress in group one and 3 or 5 others as group 2, and do a "scan for commonalities"
- Of course they don't have obvious commonalities, so I do a structure compare on a register I know is used in the instruction. (ex: RDI in mov [rdi+04],rax )
- I don't really see much obvious commonalities between the 2 groups, but I find what appears to be static values in my "correct" RDI offsets, that are different than what can be found in my "invalid" group.
- so if I compare like 3 of theses RDI offsets values with these "magic static numbers" that should be enough (like RDI +4 == 42 && RDI + 12 == 1337 && ...)
- problem: when I relaunch the game I notice that these values were in fact not static. Well, some of them are, but not the majority.
So what do?
I'd like to compare the same structures across game relaunches.
Of course adresses will be different, but MaxLevel/StructSize will be the same.
As when you save Structure Compare scans results in .sptr , it also saves the results in .sptr.results.x , I was a bit sad that in the Structure Compare window, when you open a .sptr it only loads the addresses, and doesn't even keep the ones from the window's previous scan.
Maybe I'm missing something, but can't I just load the results of a previous scan from last game boot, and compare them with the live result of the new scan with the game running?
For now my solution has been:
- going to the correct RDI address in the memory viewer
- copying everything from RDI-64 to RDI+512 (or more),
- putting the result in a line of a text file
- rebooting the game, refinding the correct RDI and repeating steps
- create a python script comparing the 2 lines of text and finding common values, printing their offset and value.
- repeat this a 3rd time if necessary
and NO, i did not just take screenshots of the memory view to then try to align them in layers with Paint.NET, that would be so hacky and time wasteful
So is there an easier/smarter way?
Thanks again in advance for your help, I always got deep and insightful answers here ( but no pressure )
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4703
|
Posted: Tue Oct 14, 2025 12:12 pm Post subject: |
|
|
tuxlu wrote: | I'd like to compare the same structures across game relaunches. | That would be more difficult than you describe in your post. Pointers in the structure can point to other memory that can be used in the comparison. In general, you'd need a dump of the entire working memory of the process.
I'd try to work around the problem. Injecting somewhere else is often better, such as a caller. e.g. say you want to make the player invincible, and the callstack when damaging stuff looks like this:
Code: | player taking damage:
update -> damagePlayer -> subtractHealth
enemy taking damage:
update -> damageEnemy -> subtractHealth | Injecting code in the `subtractHealth` function is annoying since both the player and enemies use that function. It's better to replace the call to the `subtractHealth` function in the `damagePlayer` function with NOPs, or do an early return in the damagePlayer function.
Another alternative is to find or make a pointer to the player instance that you can use to compare against RDI directly. To find one, use the pointer scanner; to make one, do a code injection at a better injection point (search "injection copy"). You don't need to do a code injection that accesses the same address- get any address in the same struct, or even any address in a different struct that has a pointer to the relevant struct (e.g. a `gameState` class might have a pointer to a `playerData` instance).
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
|
|
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
|
|