Dynamic Cheats
EmulatorJS allows you to load cheat codes dynamically from JSON files.
1. Create a Cheats Folder
First, you need a directory on your web server to host your cheat files.
- Example:
/emulatorjs/cheats/
2. Add Your JSON Files
Create a JSON file for each system. The filename must match the core name used in your configuration (e.g., nes.json for the NES core, snes.json for SNES).
JSON Structure
The JSON file should use the game's title as the key, followed by an array of objects containing the description and the cheat code.
Example: nes.json
{
"Super Mario Bros.": [
{ "desc": "Super jump", "code": "TPZLTG" },
{ "desc": "Mega-jump", "code": "APZLGG" }
],
"The Legend of Zelda": [
{ "desc": "Infinite Health", "code": "SZLZZZ" }
]
}
3. Update Your Configuration
In your main EmulatorJS configuration file, add the path to your cheats folder (do not link directly to the .json file).
window.EJS_cheatPath = "/emulatorjs/cheats/";
How It Works
- Matching: EmulatorJS will attempt to match the name of the loaded game file to the keys in your JSON. For example, if your ROM file is named
super-mario.nes, it will successfully match with the entry"Super Mario Bros."in your JSON. - Manual Fallback: If a system or specific game is not found in your JSON files, you can still use the emulator's built-in menu to add cheats manually as usual or select the correct game from the list.

