melonDS icon indicating copy to clipboard operation
melonDS copied to clipboard

Cheat File Support [Feature Request]

Open LocalBoomer opened this issue 5 years ago • 11 comments

A few emulators and most flashcarts support the use of cheat code files. (.dat, .db, .xml etc.) Would be really nice to see this feature in melonDS as well.

LocalBoomer avatar Aug 19 '20 00:08 LocalBoomer

I'd like to see a few of them so I can give it a try

I already have a usrcheat.dat, the format doesn't seem too complicated to parse

Arisotura avatar Aug 24 '20 19:08 Arisotura

There are some other formats here that might have some easier ones to work with incase .dat ends up being problematic.

LocalBoomer avatar Aug 25 '20 14:08 LocalBoomer

Any update on this?

~just sent ten Euros as a thanks

Eclypticon avatar Jun 20 '21 15:06 Eclypticon

thanks :P

it wouldn't be difficult to import cheats, it's just matter of coding a thing for it; I've been having other things to worry about lately...

Arisotura avatar Jun 20 '21 16:06 Arisotura

I did this in the meantime to help. https://github.com/Phosphorus-M/Cheat-Parser

At the moment it works with several games, so I gave it a try.

The original urcheats in format XML and the version in melonDS image

Phosphorus-M avatar Dec 16 '21 13:12 Phosphorus-M

I would open an issue for this but this had already opened, so I wanna remind that feature request. Plus having adjustable pane in cheat code editor and a hotkey for enabling/disabling cheats would be neat.

abx-dx avatar Mar 23 '22 17:03 abx-dx

Perhaps if you don't mind using code from other projects:

  • woodrpg has an implementation of the R4 CheatCode database (usrcheat.dat):
    • https://github.com/lifehackerhansol/woodrpg/blob/main/akmenu4/arm9/source/cheatwnd.cpp
    • https://github.com/lifehackerhansol/woodrpg/blob/main/akmenu4/arm9/source/cheatwnd.h
    • (this has been reused quite a few times, notably in TWiLight Menu++)
  • nitrohax has an XML implementation, though this may not be too useful as it's a human-readable XML: https://github.com/chishm/nitrohax/blob/master/arm9/source/cheat.cpp

The XML format is fairly simple; the gameid is sNDSHeader->gameCode + header CRC32 (iirc 0x200?) The R4 database works similarly, but also a binary format. Unfortunately code is documentation for this one; no one has really laid out in plaintext how it works. It is more widely used than XML, though.

Hope this helps (if at all).

lifehackerhansol avatar Jun 07 '23 08:06 lifehackerhansol

Just downloaded melonDS on my Galaxy S22 Ultra as I heard it has local multiplayer...

I'm sorry I scoured the internet for information but none of the answers seem to be working. I cannot seem to get the XML file for Pokémon White 2 to work as it crashes the game...

Specifically the game is Pokemon - White Version 2 (Experience + Trade Evolution Patched).nds

I keep seeing I need a dat file in the directory of the game but importing the xml with or without the dat file crashes the game... It's extremely possible it's my format of the xml file but I doubt it as it's the same xml file I use in other Emulators from the website gamehacking but codes from pokemoncoders.

My suggestion is adding the ability to add individual codes like many other emulators do... Even DrasticDS has an option to separately input individual codes.

RepoDraghon avatar Mar 25 '24 00:03 RepoDraghon

the android port is not made by the same people here

sandwichwater avatar Mar 25 '24 18:03 sandwichwater

Thanks for letting me know

RepoDraghon avatar Mar 25 '24 18:03 RepoDraghon

Plus one to this. Right now we have to use Desmume as a cheat database parser, painstakingly copy and paste all the desired cheats from Desmume into MelonDS. There must be a better way.

daninthemix avatar Apr 18 '24 10:04 daninthemix

@daninthemix As far as I know Desmume uses usrcheat.dat, you can also use https://www.gamebrew.org/wiki/R4_Cheat_Code_Editor to copy or edit cheat codes.

directentis1 avatar Mar 23 '25 14:03 directentis1

I did this in the meantime to help. Phosphorus-M/Cheat-Parser

At the moment it works with several games, so I gave it a try.

The original urcheats in format XML and the version in melonDS image

How do I get this to work? Running Windows.

Maverynthia avatar Jul 12 '25 06:07 Maverynthia

@Maverynthia

If you are not a programmer, you can download this exe and then in the same folder where download the exe execute the following with cmd:

cheat_parser.exe GAME_ID LOCATION_CHEATS_XML OUTPUT_MCH

Replace GAME_ID for the ID of the rom Replace LOCATION_CHEATS_XML for the place where you put the cheats.xml file Replace OUTPUT_MCH for the place where do you want to save the output, the output must end with the extension .mch

Phosphorus-M avatar Jul 12 '25 21:07 Phosphorus-M