[WiP] Adding Cheat Support to more cores

Thanks Offline for working on this. Much Appreciated.

On a separate train of thought, I wonder if it’s even possible to auto load the cheat file based on the game? A pain to have to search and manually load the cheat file every time.

Did anyone ask for cheats in BSNES!?

First things first, don’t ask me how this works because I have no idea. All I did was add decoding functions to the cheat class, and next thing I know the cheats are already fully active.

Cheat Formats Supported:

  • RAW - 012345:AB
  • Game Genie - 0123-ABCD
  • PAR - 012345AB
  • Gold Finger - 12345ABXXXXC60

Known Issues:

  • ROM cheats can’t be turned off, save for by reopening the game and not loading any savestates from when the cheats were turned on. I can’t for the life of me figure out how or why the cheats are even being run, so I can’t fix it at this time.
  • Multi-byte Gold Finger cheats not implemented. I’d have to move the decoding to outside the cheats class to have a shot at it and I’m not ready to refactor the code to that extent. These cheats throw warnings to stdout. Ideally a warning would print to the onscreen text, but I’m too lazy to look up the retroarch API and figure out how to do that at this time.
  • SGB cheats not implemented yet. Related to that, I’m currently looking for documentation on the Xploder for GameBoy cheat format, and have come up empty on it.

This will be ported to bsnes-mercury and bsnes-c++98 after all resolvable known issues are resolved.


Auto loading of cheat files is a brilliant feature request. I have no idea how to go about to it, and it will require updates to Retroarch itself and not just the cores. I’ll add it to the list.

  • Mednafen PSX - Figure out the internal cheat format. Add multiline support.
  • MAME - Write conversion functions from RA’s cheats to MAME’s internal format.
  • VBA-M - Cleanup code, port to other GBA cores
  • BSNES - Figure out how the codes are being run, write functions for decoding SGB cheats
  • Retroarch - Create an option for auto-loading cheat files.

I think the VBA work will be next.

4 Likes

I’ve been watching this thread and your progress for a while. Didn’t want to clutter up the thread but there are very few responses. I just wanted to thank you for the great work. Keep up the great job!

Thanks a lot for this, I look forward to trying out the nightly build with these updates!

Awesome work - I just added a post asking for autoloading of cheat files, then I saw this thread. This is the current user experience when using cheats:

  1. Load RA
  2. Load ROM
  3. Load State
  4. Locate and load cheat file
  5. Enable relevant cheats
  6. PLAY!

I believe 4 and 5 should be handled automatically by RA saving the cheat state from the last time you played that ROM. Also, for your list:

Snes9x - multiline codes don’t work, which is, like, 70% of the cheats in the RA SNES cheat files. Also, might be worth looking at the Yabause Saturn core?

I had some free time, so I played with Snes9x. Only the main Snes9x has these changes; 2002,2005, and 2010 have not been touched as of this time. Pull request submitted

  • Add support for multiline cheats. Delimiters are "+,.; "
  • Fix GoldFinger cheats. Addresses are now properly decoded. Values are accurately processed. Multibyte cheats are supported.
  • Add support for GameHacking.org RAW cheats. 123456:78

I have no plans to touch Yabause at this time. I have no Saturn games to test on, and by the time I get around to it, Mednafen SGX will have completely supplanted it.

3 Likes

I tried out the latest Genesis Plus GX core and the cheats worked perfectly, thanks for this!

Are there plans to add cheat support to the bsnes Accuracy or Nestopia cores?

This is great. Can I just get these updated cores with the Core Updater in RA?

Yep, I just downloaded the Genesis Plus GX core through the online updater.

Aside from autoloading cheat files and states (my biggest request), my second biggest would be an adjustment to the format of the cheat files themselves. An example:

cheats = “22” cheat0_desc = “Max EXP” cheat0_code = “5327-1FAA” cheat0_enable = “false” cheat1_desc = “Create A New Character That Starts With 153 Max H.P.” cheat1_code = “BBBF-CFD9” cheat1_enable = “false”

If you’re building a cheat file, it’s pretty annoying having to manually number, incrementally, each cheat. Why can’t RA just enumerate the cheats and figure out the total number itself when it loads the file?

1 Like

This. This so much. This is the one thing i absolutely hate about the way RA handles cheats. It just adds more work than it is needed, as with most emus you can just paste the whole code and not have to worry about numbering or descriptions.

I did some more work improving cheats in bsnes.

Multibyte goldfinger cheats now work, bringing SNES cheat support to all known formats. Cheat support including the above has been transferred to bsnes-mercury.

There, now the SNES is perfected as far as I can tell.

4 Likes

Awesome! So do cheats work in the bsnes-accuracy core now aswell?

I just retested everything. Works in bsnes-libretro and bsnes-mercury, performance, balanced, and accuracy. Won’t yet work in bsnes-libretro-cplusplus98. Also, will take a day or two to appear in the core updater.

2 Likes

That’s fantastic, thanks so much for working on this, it’s much appreciated :grinning:

That’s awesome - thanks Offline. I’ve been using Snes9X instead of BSNES for ages because of cheats.

Having said that, there’s nothing wrong with Snes9x.

So does Mednafen have no support at all, currently? Tried codes from the built-in database, and some I got off the web and none worked.

EDIT: Single codes like this work 8009D7D8C350, just no spaces or plus signs allowed.

Any chance of adding multiline codes?

If you are referring to Mednaen-PSX then yes, multi-line codes do work. You need to split them into multiple entries. Take a look here.

It would be nice if you could put them all under one entry though like other emulators.

Contrary to what many people would think, adding multiline cheats to the PS1, N64, possibly Saturn, and definitely any console newer than those is much harder than simply putting the codes on separate lines. This is because the GameShark introduced more advanced code types than simple memory writing. If statements, repeat codes, and more are all possible, and a single one of these codes takes up multiple code lines. Depending on how the emulator the libretro core is based on, these codes are all handled differently. In Mupen64Plus, you could get away with splitting the lines up and putting them as separate codes. In Mednafen PSX, not so much. Instead, you have to decode a codeline over the top of previously decoded code lines to get them to function, which is not something that can be done outside of source code editing. To make matters worse, Beetle PSX is based on such an outdated version of Mednafen that I had to backport a good amount of the code to get anything to work.

Anyway, after much toiling and pulling of hair, Beetle PSX should shortly work with multiline codes.

1 Like

Amazing! Can’t wait to grab it through Core Updater and test it out.