ekeeke / Genesis-Plus-GX

An enhanced port of Genesis Plus - accurate & portable Sega 8/16 bit emulator
Other
672 stars 193 forks source link

retro_get_memory_data returns only Genesis RAM (and not Sega CD's) #518

Closed MatPoliquin closed 11 months ago

MatPoliquin commented 11 months ago

For some project I need to access RAM data for the Sega CD. For Genesis only games it works well but for Sega CD it doesn't so I took a look at retro_get_memory_data and it seems it only returns Genesis ram data.

I am not too familiar with Sega CD dev but looking at the code I would guess if I return scd.prg_ram value instead of work_ram that would be enough? Is there games that access both ram modules (Genesis + Sega CD) at same time?

void *retro_get_memory_data(unsigned id) { switch (id) { case RETRO_MEMORY_SAVE_RAM: return sram.on ? sram.sram : NULL; case RETRO_MEMORY_SYSTEM_RAM: return work_ram; default: return NULL; } }

ekeeke commented 11 months ago

I am not responsible of the libretro port and have no idea what this function is supposed to return or what it is used for so I suggest you ask that question to libretro devs on the libretro fork repository.

And yes, Mega CD games can use both CPUs and so have access to Mega Drive Work RAM as well as Mega-CD PRG-RAM but also Word-RAM. To some extent, it should expose all accessible RAM (including Z80 RAM) so I guess you need to be able to define the possible values of that 'id' parameter somewhere in the libretro core because 'SYSTEM_RAM' can be different things in a system with multiple CPUs and RAM modules.