Merge pull request #6 from retro-wertz/libretro_api
Access system and video ram using Librero API
This commit is contained in:
commit
968399a409
@ -482,12 +482,18 @@ void *retro_get_memory_data(unsigned type)
|
|||||||
void* data;
|
void* data;
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
case RETRO_MEMORY_SYSTEM_RAM:
|
||||||
|
data = gb.ram;
|
||||||
|
break;
|
||||||
case RETRO_MEMORY_SAVE_RAM:
|
case RETRO_MEMORY_SAVE_RAM:
|
||||||
if (gb.cartridge_type->has_battery && gb.mbc_ram_size != 0)
|
if (gb.cartridge_type->has_battery && gb.mbc_ram_size != 0)
|
||||||
data = gb.mbc_ram;
|
data = gb.mbc_ram;
|
||||||
else
|
else
|
||||||
data = NULL;
|
data = NULL;
|
||||||
break;
|
break;
|
||||||
|
case RETRO_MEMORY_VIDEO_RAM:
|
||||||
|
data = gb.vram;
|
||||||
|
break;
|
||||||
case RETRO_MEMORY_RTC:
|
case RETRO_MEMORY_RTC:
|
||||||
if(gb.cartridge_type->has_battery)
|
if(gb.cartridge_type->has_battery)
|
||||||
data = &gb.rtc_real;
|
data = &gb.rtc_real;
|
||||||
@ -507,12 +513,18 @@ size_t retro_get_memory_size(unsigned type)
|
|||||||
size_t size;
|
size_t size;
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
case RETRO_MEMORY_SYSTEM_RAM:
|
||||||
|
size = gb.ram_size;
|
||||||
|
break;
|
||||||
case RETRO_MEMORY_SAVE_RAM:
|
case RETRO_MEMORY_SAVE_RAM:
|
||||||
if (gb.cartridge_type->has_battery && gb.mbc_ram_size != 0)
|
if (gb.cartridge_type->has_battery && gb.mbc_ram_size != 0)
|
||||||
size = gb.mbc_ram_size;
|
size = gb.mbc_ram_size;
|
||||||
else
|
else
|
||||||
size = 0;
|
size = 0;
|
||||||
break;
|
break;
|
||||||
|
case RETRO_MEMORY_VIDEO_RAM:
|
||||||
|
size = gb.vram_size;
|
||||||
|
break;
|
||||||
case RETRO_MEMORY_RTC:
|
case RETRO_MEMORY_RTC:
|
||||||
if(gb.cartridge_type->has_battery)
|
if(gb.cartridge_type->has_battery)
|
||||||
size = sizeof (gb.rtc_real);
|
size = sizeof (gb.rtc_real);
|
||||||
|
Loading…
Reference in New Issue
Block a user