This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Game Genie support for NES
To add Game Genie codes, create a .ggcodes file next to the .nes you want to add game genie codes for. The file is a simple CSV with each line containing "code(s), comment", like this example for Super Mario Bros 1:
SXIOPO, Inf lives
APZLGG+APZLTG+GAZUAG, Mega jump
YAZULG+YAZUIG+YAZUYG, Moon Gravity
OZTLLX+AATLGZ+SZLIVO, Always fire
YSAOPE+YEAOZA+YEAPYA, World 8-1
YSAOPE+YEAOZA+AOAPYA, World H-1
YSAOPE+YEAOZA+LXAPYA, World -1
TVVOAE, Circus music
PIGPOG, All sorts of fun
GOZSXX, Invincibility
NPEPNY, Bullet bills 1-1
PINAOO, Cool colors
You can also comment out a line by putting // or # in front of a line.
These codes are collected by parse_roms and put in a static array in nes_roms.c. You can have a max of 16 codes (triple codes, like the World 8-1 code above, count as 1). Each rom is assigned a unique monotonically increasing id which references a rom structure in persistent_config_ram containing a 16 bit variable, each bit identifying which codes is currently active.
Before loading a rom, the user can select which game genie codes are active. When the rom is started, the set of game genie codes are converted into a list of addresses, values, and compares stored statically in game_genie.c. When a new PRG ROM bank is loaded into memory (in mmc_bankrom), the memory in that space is patched by calling into gameGeniePatchRom. A special function was added in nes_mem.c to allow writes to PRG memory.
To compile with game-genie support, add GAME_GENIE=1 to your make line.
Depends on kbeckmann/retro-go-stm32#17