Cheat engine code format

For topics which do not fit in other specific forums.
User avatar
H3ML5XLAXBKU
Posts: 17
Joined: Wed Jun 24, 2020 4:43 am
Has thanked: 5 times
Been thanked: 5 times

Cheat engine code format

Unread post by H3ML5XLAXBKU »

I have a question about converting cheats codes from raw format to the format used by Cheat Engine. I followed the link to Gamehacking.org, but couldn't find codes for the games I'm interested in provided in the MiSTer format. I'm keen to convert some codes myself, but found the explanation provided on the Github page pretty brief. Could anyone knowledgable confirm some points for me?

Using the given example
01 00 00 00 A0 1C FF 00 B5 00 00 00 FF 00 00 00

I understand that this can be broken into 4 parts
01 00 00 00 -> Determines if compare is enabled
A0 1C FF 00 -> Is the ROM address that to be modified.
B5 00 00 00 -> This is the compare value
FF 00 00 00 -> The replace value.

So, am I correct to believe that the first set can only ever be true (01 00 00 00) or false(00 00 00 00)? And if it is false, then the compare value would also be 00 00 00 00?

So here are some examples:

1 - I found a SNES code, C35CBE:05, based on my understanding this would be
00 00 00 00 BE 5C C3 00 00 00 00 00 05 00 00 00

2 - I used this site to convert a NES Game Genie code, AEKNLPZA, and get three values
value: 00
compare: 02
address: 71CB
(How would I express these as RAW, like the above SNES code?)

So this would be
01 00 00 00 CB 71 00 00 02 00 00 00 00 00 00 00

3 - Using the same site for this code SXTIEG gives 5CE0:A5
value: A5
compare: 00
address: 5CE0

My guess is
00 00 00 00 E0 5C 00 00 00 00 00 00 A5 00 00 00

Am I on the right track?
User avatar
H3ML5XLAXBKU
Posts: 17
Joined: Wed Jun 24, 2020 4:43 am
Has thanked: 5 times
Been thanked: 5 times

Re: Cheat engine code format

Unread post by H3ML5XLAXBKU »

So when I made the above post I didn't realise how easy it was to download cheat packs from gamehacking.org

However, until I found that out I had started going down a rabbit hole thinking about how to make my own cheat packs using a ruby script.

I know I don't need to do this anymore, but I'm kind of interested in following through. Currently, my sticking point is the format of the '.gg' files contents and how to generate them. Anyone have any insight, or at least links to more information?
User avatar
Newsdee
Top Contributor
Posts: 873
Joined: Mon May 25, 2020 1:07 am
Has thanked: 104 times
Been thanked: 239 times

Re: Cheat engine code format

Unread post by Newsdee »

The .gg files are binary files. I edit them with HxD:
https://mh-nexus.de/en/hxd/

So if you have a SNES code like the left, it translates to this binary data (I added the "|" for clarity):

Code: Select all

7E0420:00    --->    00 00 00 00 | 20 04 7E 00 | 00 00 00 00 | 00 00 00 00
That's memory address 007E0420 (in reverse order i.e. little endian since the 20 goes first).
The other four banks of bytes correspond to the fields indicated by the wiki.

The :00 at the end corresponds to the last bank, with least significant byte written first, e.g.:

Code: Select all

7E0D0C:23    --->    00 00 00 00 | 0C 0D 7E 00 | 00 00 00 00 | 23 00 00 00
User avatar
H3ML5XLAXBKU
Posts: 17
Joined: Wed Jun 24, 2020 4:43 am
Has thanked: 5 times
Been thanked: 5 times

Re: Cheat engine code format

Unread post by H3ML5XLAXBKU »

Thanks for explanation and link.

Still looking into this, but have been pretty distracted with work.
Post Reply