How to Relative Address Cheats work?

If you are having problems finding or using cheats for an Emulator (particularly MAME/MESS) or have found a trick that you wish to share this is the place to do it. But please read the Cheat FAQ first.
Post Reply
kelvSYC
Posts: 1121
Joined: Thu Sep 27, 2001 1:00 am
Location: Calgary, AB, Canada

How to Relative Address Cheats work?

Post by kelvSYC »

Needed for the Guide:

I need to know on a technical detail (ie. on the same level as other cheats) how an RAC determines the address from a base and an offset, and the significance of the different parts of an RAC.
kelvSYC's Guide to the Cheat Engine - http://members.shaw.ca/kelvsyc/cheatguide.html

The New Move List Cheat Collection - http://mamecheat.co.uk/forums/viewtopic.php?p=6469

Underscore Command - What better game is there?
User avatar
ianpatt
Posts: 336
Joined: Sat Sep 22, 2001 1:00 am
Location: San Francisco, CA

Post by ianpatt »

The cheat engine calculates the effective address by reading a value (usually 32 bits, but this can be changed in the cheat) from memory. The displacement/offset is then added to the read value, which becomes the effective address for the cheat.

Pseudocode again:

Code: Select all

UInt32 effectiveAddress;

effectiveAddress = Read(action->cpu, action->address, action->addressBytes);
effectiveAddress = effectiveAddress + action->offset;

return Read(action->cpu, effectiveAddress, action->bytes);
Post Reply