Merge pull request #6 from retro-wertz/libretro_api

Access system and video ram using Librero API
This commit is contained in:
Twinaphex 2018-01-04 11:38:11 +01:00 committed by GitHub
commit 968399a409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);