RetroAchievements / rcheevos

Library to parse and evaluate achievements and leaderboards for RetroAchievements
MIT License
90 stars 34 forks source link

Add Extended RAM / Save RAM for SMS/GG #301

Closed CasualPokePlayer closed 5 months ago

CasualPokePlayer commented 10 months ago

https://retroachievements.org/game/12638

This reportedly has memory exposure issues, with character stats somehow unable to be found in RAM. This is due to the game actually storing a lot of info in Save RAM rather than System RAM, and rcheevos' memory map only has System RAM exposed.

GG and SMS would both only have System RAM exposed, but cartridges may offer Extended (volatile) RAM, battery backed SRAM, or EEPROM (although this last one is probably not going to store many useful things considering it isn't random accessible).

Extended RAM would be limited to GG with Ernie Els Golf (E) (En,Fr,De,Es,It) with a variant of the CodeMasters mapper? Presumably the mapper would also work on SMS, although no retail games would use it (and it seems most emulators just emulate these as the same mapper, giving Extended RAM to other CodeMasters mapper games which don't actually use it). This Extended RAM would be 8KiB, and would be mapped to 0x6000-0x7FFF and mirrored at 0xA000-0xBFFF, although this would also overlap with the ROM (these regions are banked).

EEPROM seems to be limited GG too, with only a few games having it (presumably, it would work on SMS, although no retail games would use it). This would just be 128 bytes of non-volatile memory, which can't be randomly accessed by the game, requiring a slow read/write process, bit-banging at 0x8000-0xBFFF (exact address doesn't matter here, they all map to EEPROM control).

Most games would use the standard Sega mapper which features battery backed SRAM. This can go as high as 32KiB, and is mapped at 0x8000-0xBFFF. This would also overlap with ROM (banking done again), and only half of the total possible SRAM is mappable here, so only 16KiB may be visible at one time.

Extended RAM, battery backed SRAM, and EEPROM are all mutually exclusive.

https://www.smspower.org/Development/Mappers seems to have some docs on the CodeMasters and Sega mappers.