Skip to content

Commit

Permalink
Libretro: Fix saving in GB games (fixes #486)
Browse files Browse the repository at this point in the history
  • Loading branch information
endrift committed Jan 27, 2017
1 parent 75f6ff8 commit dbbebc4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Bugfixes: Bugfixes:
- 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)


0.5.2: (2016-12-31) 0.5.2: (2016-12-31)
Bugfixes: Bugfixes:
Expand Down
33 changes: 21 additions & 12 deletions src/platform/libretro/libretro.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -524,19 +524,28 @@ size_t retro_get_memory_size(unsigned id) {
if (id != RETRO_MEMORY_SAVE_RAM) { if (id != RETRO_MEMORY_SAVE_RAM) {
return 0; return 0;
} }
switch (((struct GBA*) core->board)->memory.savedata.type) { #ifdef M_CORE_GBA
case SAVEDATA_AUTODETECT: if (core->platform(core) == PLATFORM_GBA) {
case SAVEDATA_FLASH1M: switch (((struct GBA*) core->board)->memory.savedata.type) {
return SIZE_CART_FLASH1M; case SAVEDATA_AUTODETECT:
case SAVEDATA_FLASH512: case SAVEDATA_FLASH1M:
return SIZE_CART_FLASH512; return SIZE_CART_FLASH1M;
case SAVEDATA_EEPROM: case SAVEDATA_FLASH512:
return SIZE_CART_EEPROM; return SIZE_CART_FLASH512;
case SAVEDATA_SRAM: case SAVEDATA_EEPROM:
return SIZE_CART_SRAM; return SIZE_CART_EEPROM;
case SAVEDATA_FORCE_NONE: case SAVEDATA_SRAM:
return 0; return SIZE_CART_SRAM;
case SAVEDATA_FORCE_NONE:
return 0;
}
} }
#endif
#ifdef M_CORE_GB
if (core->platform(core) == PLATFORM_GB) {
return ((struct GB*) core->board)->sramSize;
}
#endif
return 0; return 0;
} }


Expand Down

0 comments on commit dbbebc4

Please sign in to comment.