if you play NDS games on open source handhelds, there are good chances it’s using one of the emulation solutions: a. retroarch as frontend + melonds/melondsds core b. android system with orginal drasticDS app c. linux version of drastic software(or its modified version)
when you trying to add cheat codes for DS games, the method may vary depends on which emulation solutions your handhelds is using.
for solution a, you can just add cheat code like any other emulators in Retroarch, just copy cheat codes in libretro cheat formats(.cht files) into retroarch cheats folder, and then import cheats file using retroarch’s cheat menu.
for solution b, the orignal drastic use 「usrcheat.dat」file (Located in the /drastic/ folder) as Cheat Databases. which means when it read game rom files, it’ll use the game ID in rom data to find a match in the cheat database, and show cheat codes options. so the easiest way of use cheats is replacing the original usrcheat.dat file(13MB+) with a larger one (like this 54MB+ one made by DeadSkullzJr https://gbatemp.net/threads/deadskullzjrs-nds-i-cheat-databases.488711/ )
for solution c, it’s bascally the same with solution b(cause it still is drasticDS)
if you’re playing an not-so-popular verson of roms (like an japanese distribution , an modified rom or fantranslated version), the Game ID may have no match in the cheat database and the drasticDS 「Configure Cheats」options respond nothing, then you may need to search cheat code for your rom version on internet and add it to usrcheat.dat manully. you can follow this guide https://www.drastic-ds.com/viewtopic.php?f=7&t=288 you’ll need R4CCE.exe to edit usrcheat.dat. notice that r4cce can’t work with non-english filenames, so rename the .dat file you want to edit or the rom file you want to read Game ID from to latin characters before use r4cce. as the picture in the guide shows, the Game ID on R4CCE ui has two parts, the 4 characters in the red box and the 8 characters in the green box. for my understanding, drastic will first try to match both parts for the rom file, and if failed, only the red box part matched will still show cheat code. the red box part is the real gameID, coded by nintendo and printed in the package box when distribution. the green box part is more of an 「unofficial rom-version ID」, came from doing some calculating to game rom’s CRC checksum (i don’t really understand https://forums.desmume.org/viewtopic.php?id=11156 ). the green box part may be changed for modified rom or fan-translating version rom files, but the red box part should stay the same. the two part Game ID can be read from rom files using r4cce following the guide.
Besides cheat database, Drastic also support 「custom cheat files」(.cht) after version2.3.0.0 (released in 2015). it’s much easy to use than cheat database, so it’s highly recommended for solution b&c. unlike cheat database, custom cheat files is based on filename matching. i.e. your game rom file is 「digimon.nds」,then use any text editor (like notepad++) to creat an txt file with same name(「digimon.txt」), and paste the cheat code you find into the txt file under this format:
[your cheat code description]+
〇〇〇〇〇〇〇〇 〇〇〇〇〇〇〇〇
〇〇〇〇〇〇〇〇 〇〇〇〇〇〇〇〇
〇〇〇〇〇〇〇〇 〇〇〇〇〇〇〇〇
The square brackets [ ] and plus mark + is important. text between [ ] will show as cheat title in drastic’s「Configure Cheats」menu; the plus mark means this cheat will be active as default when game started(lose it if you don’t want that). the 〇〇 represent actionreplay cheat codes. After editing and saving, change file name「digimon.txt」to 「digimon.cht」, and copy it to /drastic/cheats/ folder. when open roms in drastic, the cheats file will automatically loaded.
Notice that although drastic’s custom cheat files use same filename extension with Retroarch(*.cht), the text formats are completely different. DO NOT copy retroarch cheat files without editing it into drastic format first. Also in different version of drastic, cheat code description may not support non-latin words. for more information and cheat code formats example, read「-- Cheat Codes --」section in 「drastic_readme.txt」under the same folder with 「usrcheat.dat」.
extra notes for cfw:
drastic folder in custom firmware may be buried quite deep(i.e. the /drastic/ folder is located at YOURSDCARD:\Emus\tg5040\NDS.pak\drastic in nextUI), you may want to read cfw documents to find out; custom firmware may redirecting drastic’s cheats folder to its global cheats directory(i.e. in nextUI, NDS.apk after version0.6.0 redirecting YOURSDCARD:\Emus\tg5040\NDS.pak\drastic\cheats to YOURSDCARD:\cheats\NDS, so put drastic’s custom cheat files there instead).

