From: kub Date: Mon, 3 Jan 2022 22:36:44 +0000 (+0100) Subject: libretro, improve 32x save/load for run-ahead X-Git-Tag: v2.00~383 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92f7a430ca1c8598514ce5800d28a287d01f699c;p=picodrive.git libretro, improve 32x save/load for run-ahead --- diff --git a/pico/state.c b/pico/state.c index 307e5d65..f1a67fee 100644 --- a/pico/state.c +++ b/pico/state.c @@ -347,6 +347,7 @@ static int state_save(void *file) CHECKED_WRITE(chwc->chunk, chwc->size, chwc->ptr); } + CHECKED_WRITE(0, 0, NULL); retval = 0; out: @@ -540,6 +541,8 @@ static int state_load(void *file) break; #endif default: + if (len|chunk == 0) + goto readend; if (carthw_chunks != NULL) { carthw_state_chunk *chwc; diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index 0af186b0..8aadedf7 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -872,9 +872,14 @@ int state_fseek(void *file, long offset, int whence) size_t retro_serialize_size(void) { struct savestate_state state = { 0, }; + unsigned AHW = PicoIn.AHW; int ret; + /* we need the max possible size here, so include 32X for MD and MCD */ + if (!(AHW & (PAHW_SMS|PAHW_PICO|PAHW_SVP))) + PicoIn.AHW |= PAHW_32X; ret = PicoStateFP(&state, 1, NULL, state_skip, NULL, state_fseek); + PicoIn.AHW = AHW; if (ret != 0) return 0;