Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in cartridge RAM to SMS/GG memory maps #313

Merged
merged 3 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions src/rcheevos/consoleinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,19 @@ static const rc_memory_region_t _rc_memory_regions_gamecube[] = {
static const rc_memory_regions_t rc_memory_regions_gamecube = { _rc_memory_regions_gamecube, 1 };

/* ===== Game Gear ===== */
/* http://www.smspower.org/Development/MemoryMap */
/* https://www.smspower.org/Development/MemoryMap */
/* https://www.smspower.org/Development/Mappers */
static const rc_memory_region_t _rc_memory_regions_game_gear[] = {
{ 0x000000U, 0x001FFFU, 0x00C000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }
{ 0x000000U, 0x001FFFU, 0x00C000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
/* GG/SMS have various possible mappings for cartridge memory depending on the mapper used.
* However, these ultimately do not map all of their memory at once, typically requiring banking.
* Thus, the "real address" used is just a virtual address mapping all cartridge memory in one contiguous block.
* Note that this may possibly refer to non-battery backed "extended RAM" so this isn't strictly RC_MEMORY_TYPE_SAVE_RAM.
* libretro cores expose "extended RAM" as RETRO_MEMORY_SAVE_RAM regardless however.
*/
{ 0x002000U, 0x009FFFU, 0x010000U, RC_MEMORY_TYPE_SAVE_RAM, "Cartridge RAM" }
};
static const rc_memory_regions_t rc_memory_regions_game_gear = { _rc_memory_regions_game_gear, 1 };
static const rc_memory_regions_t rc_memory_regions_game_gear = { _rc_memory_regions_game_gear, 2 };

/* ===== Intellivision ===== */
/* http://wiki.intellivision.us/index.php/Memory_Map */
Expand Down Expand Up @@ -531,14 +539,22 @@ static const rc_memory_region_t _rc_memory_regions_magnavox_odyssey_2[] = {
static const rc_memory_regions_t rc_memory_regions_magnavox_odyssey_2 = { _rc_memory_regions_magnavox_odyssey_2, 2 };

/* ===== Master System ===== */
/* http://www.smspower.org/Development/MemoryMap */
/* https://www.smspower.org/Development/MemoryMap */
/* https://www.smspower.org/Development/Mappers */
static const rc_memory_region_t _rc_memory_regions_master_system[] = {
{ 0x000000U, 0x001FFFU, 0x00C000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }
{ 0x000000U, 0x001FFFU, 0x00C000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
/* GG/SMS have various possible mappings for cartridge memory depending on the mapper used.
* However, these ultimately do not map all of their memory at once, typically requiring banking.
* Thus, the "real address" used is just a virtual address mapping all cartridge memory in one contiguous block.
* Note that this may possibly refer to non-battery backed "extended RAM" so this isn't strictly RC_MEMORY_TYPE_SAVE_RAM.
* libretro cores expose "extended RAM" as RETRO_MEMORY_SAVE_RAM regardless however.
*/
{ 0x002000U, 0x009FFFU, 0x010000U, RC_MEMORY_TYPE_SAVE_RAM, "Cartridge RAM" }
};
static const rc_memory_regions_t rc_memory_regions_master_system = { _rc_memory_regions_master_system, 1 };
static const rc_memory_regions_t rc_memory_regions_master_system = { _rc_memory_regions_master_system, 2 };

/* ===== MegaDrive (Genesis) ===== */
/* http://www.smspower.org/Development/MemoryMap */
/* https://www.smspower.org/Development/MemoryMap */
static const rc_memory_region_t _rc_memory_regions_megadrive[] = {
{ 0x000000U, 0x00FFFFU, 0xFF0000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
{ 0x010000U, 0x01FFFFU, 0x000000U, RC_MEMORY_TYPE_SAVE_RAM, "Cartridge RAM" }
Expand Down Expand Up @@ -772,7 +788,7 @@ static const rc_memory_region_t _rc_memory_regions_saturn[] = {
static const rc_memory_regions_t rc_memory_regions_saturn = { _rc_memory_regions_saturn, 2 };

/* ===== SG-1000 ===== */
/* http://www.smspower.org/Development/MemoryMap */
/* https://www.smspower.org/Development/MemoryMap */
static const rc_memory_region_t _rc_memory_regions_sg1000[] = {
{ 0x000000U, 0x0003FFU, 0xC000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
/* https://github.com/libretro/FBNeo/blob/697801c6262be6ca91615cf905444d3e039bc06f/src/burn/drv/sg1000/d_sg1000.cpp#L210-L237 */
Expand Down
4 changes: 2 additions & 2 deletions test/rcheevos/test_consoleinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ void test_consoleinfo(void) {
TEST_PARAMS2(test_memory, RC_CONSOLE_GAMEBOY_COLOR, 0x016000);
TEST_PARAMS2(test_memory, RC_CONSOLE_GAMEBOY_ADVANCE, 0x058000);
TEST_PARAMS2(test_memory, RC_CONSOLE_GAMECUBE, 0x01800000);
TEST_PARAMS2(test_memory, RC_CONSOLE_GAME_GEAR, 0x002000);
TEST_PARAMS2(test_memory, RC_CONSOLE_GAME_GEAR, 0x00A000);
TEST_PARAMS2(test_memory, RC_CONSOLE_INTELLIVISION, 0x040080);
TEST_PARAMS2(test_memory, RC_CONSOLE_INTERTON_VC_4000, 0x000600);
TEST_PARAMS2(test_memory, RC_CONSOLE_MAGNAVOX_ODYSSEY2, 0x000140);
TEST_PARAMS2(test_memory, RC_CONSOLE_MASTER_SYSTEM, 0x002000);
TEST_PARAMS2(test_memory, RC_CONSOLE_MASTER_SYSTEM, 0x00A000);
TEST_PARAMS2(test_memory, RC_CONSOLE_MEGA_DRIVE, 0x020000);
TEST_PARAMS2(test_memory, RC_CONSOLE_MEGADUCK, 0x010000);
TEST_PARAMS2(test_memory, RC_CONSOLE_MSX, 0x080000);
Expand Down
Loading