Access system and video ram using Librero API

This commit is contained in:
retrowertz 2018-01-04 16:43:31 +08:00
parent f905c4d0f6
commit c578b36dfb
1 changed files with 12 additions and 0 deletions

View File

@ -482,12 +482,18 @@ void *retro_get_memory_data(unsigned type)
void* data;
switch(type)
{
case RETRO_MEMORY_SYSTEM_RAM:
data = gb.ram;
break;
case RETRO_MEMORY_SAVE_RAM:
if (gb.cartridge_type->has_battery && gb.mbc_ram_size != 0)
data = gb.mbc_ram;
else
data = NULL;
break;
case RETRO_MEMORY_VIDEO_RAM:
data = gb.vram;
break;
case RETRO_MEMORY_RTC:
if(gb.cartridge_type->has_battery)
data = &gb.rtc_real;
@ -507,12 +513,18 @@ size_t retro_get_memory_size(unsigned type)
size_t size;
switch(type)
{
case RETRO_MEMORY_SYSTEM_RAM:
size = gb.ram_size;
break;
case RETRO_MEMORY_SAVE_RAM:
if (gb.cartridge_type->has_battery && gb.mbc_ram_size != 0)
size = gb.mbc_ram_size;
else
size = 0;
break;
case RETRO_MEMORY_VIDEO_RAM:
size = gb.vram_size;
break;
case RETRO_MEMORY_RTC:
if(gb.cartridge_type->has_battery)
size = sizeof (gb.rtc_real);