Skip to content

Commit

Permalink
libretro, improve 32x save/load for run-ahead
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Jan 3, 2022
1 parent b72662e commit 92f7a43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pico/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions platform/libretro/libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 92f7a43

Please sign in to comment.