Allow SYSTEM_RAM to be queried in games that do not have SRAM

This commit is contained in:
lifning 2017-09-18 00:50:07 -07:00
parent 997360b114
commit ac67b0a430

View File

@ -2189,13 +2189,10 @@ unsigned retro_get_region(void) { return vdp_pal ? RETRO_REGION_PAL : RETRO_REGI
void *retro_get_memory_data(unsigned id) void *retro_get_memory_data(unsigned id)
{ {
if (!sram.on)
return NULL;
switch (id) switch (id)
{ {
case RETRO_MEMORY_SAVE_RAM: case RETRO_MEMORY_SAVE_RAM:
return sram.sram; return sram.on ? sram.sram : NULL;
case RETRO_MEMORY_SYSTEM_RAM: case RETRO_MEMORY_SYSTEM_RAM:
return work_ram; return work_ram;
default: default:
@ -2207,13 +2204,13 @@ size_t retro_get_memory_size(unsigned id)
{ {
int i; int i;
if (!sram.on)
return 0;
switch (id) switch (id)
{ {
case RETRO_MEMORY_SAVE_RAM: case RETRO_MEMORY_SAVE_RAM:
{ {
if (!sram.on)
return 0;
/* if emulation is not running, we assume the frontend is requesting SRAM size for loading */ /* if emulation is not running, we assume the frontend is requesting SRAM size for loading */
if (!is_running) if (!is_running)
{ {