Libretro: Fix saving in GB games (fixes #486)

This commit is contained in:
Jeffrey Pfau 2017-01-04 16:02:22 -08:00
parent 61a657afcf
commit 68985d88e9
2 changed files with 23 additions and 13 deletions

View File

@ -13,6 +13,7 @@ Bugfixes:
- GBA BIOS: Implement BitUnPack - GBA BIOS: Implement BitUnPack
- ARM7: Fix MLA/*MULL/*MLAL timing - ARM7: Fix MLA/*MULL/*MLAL timing
- GBA: Fix multiboot ROM loading - GBA: Fix multiboot ROM loading
- Libretro: Fix saving in GB games (fixes mgba.io/i/486)
Misc: Misc:
- SDL: Remove scancode key input - SDL: Remove scancode key input
- GBA Video: Clean up unused timers - GBA Video: Clean up unused timers

View File

@ -13,12 +13,12 @@
#include <mgba/core/version.h> #include <mgba/core/version.h>
#ifdef M_CORE_GB #ifdef M_CORE_GB
#include <mgba/gb/core.h> #include <mgba/gb/core.h>
#include <mgba/internal/gb/gb.h>
#endif #endif
#ifdef M_CORE_GBA #ifdef M_CORE_GBA
#include <mgba/gba/core.h> #include <mgba/gba/core.h>
#include <mgba/gba/interface.h> #include <mgba/gba/interface.h>
#include <mgba/internal/gba/gba.h> #include <mgba/internal/gba/gba.h>
#include <mgba/internal/gba/video.h>
#endif #endif
#include <mgba-util/circle-buffer.h> #include <mgba-util/circle-buffer.h>
#include <mgba-util/memory.h> #include <mgba-util/memory.h>
@ -524,6 +524,8 @@ size_t retro_get_memory_size(unsigned id) {
if (id != RETRO_MEMORY_SAVE_RAM) { if (id != RETRO_MEMORY_SAVE_RAM) {
return 0; return 0;
} }
#ifdef M_CORE_GBA
if (core->platform(core) == PLATFORM_GBA) {
switch (((struct GBA*) core->board)->memory.savedata.type) { switch (((struct GBA*) core->board)->memory.savedata.type) {
case SAVEDATA_AUTODETECT: case SAVEDATA_AUTODETECT:
case SAVEDATA_FLASH1M: case SAVEDATA_FLASH1M:
@ -537,6 +539,13 @@ size_t retro_get_memory_size(unsigned id) {
case SAVEDATA_FORCE_NONE: case SAVEDATA_FORCE_NONE:
return 0; return 0;
} }
}
#endif
#ifdef M_CORE_GB
if (core->platform(core) == PLATFORM_GB) {
return ((struct GB*) core->board)->sramSize;
}
#endif
return 0; return 0;
} }