Skip to content

Commit

Permalink
Expand SNES memory exposure (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
CasualPokePlayer authored Nov 9, 2024
1 parent 9427646 commit 8d8ef92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/rcheevos/consoleinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,18 @@ static const rc_memory_regions_t rc_memory_regions_scv = { _rc_memory_regions_sc
/* ===== Super Nintendo ===== */
/* https://en.wikibooks.org/wiki/Super_NES_Programming/SNES_memory_map#LoROM */
static const rc_memory_region_t _rc_memory_regions_snes[] = {
{ 0x000000U, 0x01FFFFU, 0x7E0000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
{ 0x020000U, 0x03FFFFU, 0xFE0000U, RC_MEMORY_TYPE_SAVE_RAM, "Cartridge RAM" }
{ 0x000000U, 0x01FFFFU, 0x07E0000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
/* Cartridge RAM here could be in a variety of places in SNES memory, depending on the ROM type.
* Due to this, we place Cartridge RAM outside of the possible native addressing space.
* Note that this also covers SA-1 BW-RAM (which is exposed as RETRO_MEMORY_SAVE_RAM for libretro).
*/
{ 0x020000U, 0x09FFFFU, 0x1000000U, RC_MEMORY_TYPE_SAVE_RAM, "Cartridge RAM" },
/* I-RAM on the SA-1 is normally at 0x003000. However, this address typically just has a mirror of System RAM for other ROM types.
* To avoid conflicts, don't use 0x003000, instead map it outside of the possible native addressing space.
*/
{ 0x0A0000U, 0x0A07FFU, 0x1080000U, RC_MEMORY_TYPE_SYSTEM_RAM, "I-RAM (SA-1)" }
};
static const rc_memory_regions_t rc_memory_regions_snes = { _rc_memory_regions_snes, 2 };
static const rc_memory_regions_t rc_memory_regions_snes = { _rc_memory_regions_snes, 3 };

/* ===== Thomson TO8 ===== */
/* https://github.com/mamedev/mame/blob/master/src/mame/drivers/thomson.cpp#L1617 */
Expand Down
2 changes: 1 addition & 1 deletion test/rcheevos/test_consoleinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void test_consoleinfo(void) {
TEST_PARAMS2(test_memory, RC_CONSOLE_SEGA_CD, 0x090000);
TEST_PARAMS2(test_memory, RC_CONSOLE_SG1000, 0x006000);
TEST_PARAMS2(test_memory, RC_CONSOLE_SUPER_CASSETTEVISION, 0x010000);
TEST_PARAMS2(test_memory, RC_CONSOLE_SUPER_NINTENDO, 0x040000);
TEST_PARAMS2(test_memory, RC_CONSOLE_SUPER_NINTENDO, 0x0A0800);
TEST_PARAMS2(test_memory, RC_CONSOLE_SUPERVISION, 0x006000);
TEST_PARAMS2(test_memory, RC_CONSOLE_THOMSONTO8, 0x080000);
TEST_PARAMS2(test_memory, RC_CONSOLE_TI83, 0x08000);
Expand Down

0 comments on commit 8d8ef92

Please sign in to comment.