GBA Savedata: Update and fix Sharkport importing (fixes #658)
Vicki Pfau vi@endrift.com
Tue, 13 Jun 2017 22:01:36 -0700
1 files changed,
4 insertions(+),
13 deletions(-)
jump to
M
src/gba/sharkport.c
→
src/gba/sharkport.c
@@ -115,24 +115,14 @@ }
uint32_t copySize = size - 0x1C; switch (gba->memory.savedata.type) { - case SAVEDATA_SRAM: - if (copySize > SIZE_CART_SRAM) { - copySize = SIZE_CART_SRAM; - } - break; case SAVEDATA_FLASH512: if (copySize > SIZE_CART_FLASH512) { GBASavedataForceType(&gba->memory.savedata, SAVEDATA_FLASH1M, gba->memory.savedata.realisticTiming); } // Fall through - case SAVEDATA_FLASH1M: - if (copySize > SIZE_CART_FLASH1M) { - copySize = SIZE_CART_FLASH1M; - } - break; - case SAVEDATA_EEPROM: - if (copySize > SIZE_CART_EEPROM) { - copySize = SAVEDATA_EEPROM; + default: + if (copySize > GBASavedataSize(&gba->memory.savedata)) { + copySize = GBASavedataSize(&gba->memory.savedata); } break; case SAVEDATA_FORCE_NONE:@@ -141,6 +131,7 @@ goto cleanup;
} memcpy(gba->memory.savedata.data, &payload[0x1C], copySize); + gba->memory.savedata.vf && gba->memory.savedata.vf->sync(gba->memory.savedata.vf, gba->memory.savedata.data, size); free(payload); return true;