diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 764d8052d1e6..d043cbfab9b4 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -2433,13 +2433,13 @@ static void rcheevos_client_load_game_callback(int result, #ifdef HAVE_THREADS if (!task_is_on_main_thread()) { - /* Have to "schedule" this. CMD_EVENT_REWIND_INIT should + /* Have to "schedule" this. CMD_EVENT_REWIND_REINIT should * only be called on the main thread */ - rcheevos_locals.queued_command = CMD_EVENT_REWIND_INIT; + rcheevos_locals.queued_command = CMD_EVENT_REWIND_REINIT; } else #endif - command_event(CMD_EVENT_REWIND_INIT, NULL); + command_event(CMD_EVENT_REWIND_REINIT, NULL); } #endif } @@ -3144,6 +3144,7 @@ bool rcheevos_load(const void *data) { rcheevos_enforce_hardcore_settings(); } +#ifndef HAVE_RC_CLIENT else { #if HAVE_REWIND @@ -3167,6 +3168,7 @@ bool rcheevos_load(const void *data) } #endif } +#endif /* provide hooks for reading files */ rc_hash_reset_cdreader_hooks(); diff --git a/command.h b/command.h index fbfc1d262ece..59ed89395c28 100644 --- a/command.h +++ b/command.h @@ -88,6 +88,8 @@ enum event_command CMD_EVENT_REWIND_DEINIT, /* Initializes rewind. */ CMD_EVENT_REWIND_INIT, + /* Reinitializes rewind (primarily if the state size changes). */ + CMD_EVENT_REWIND_REINIT, /* Toggles rewind. */ CMD_EVENT_REWIND_TOGGLE, /* Initializes autosave. */ diff --git a/retroarch.c b/retroarch.c index b8d37eaa2864..52a66bf4ce4b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2995,6 +2995,17 @@ bool command_event(enum event_command cmd, void *data) } } } +#endif + break; + case CMD_EVENT_REWIND_REINIT: +#ifdef HAVE_REWIND + /* to reinitialize the the rewind state manager, we have to recreate it. + * the easiest way to do that is a full deinit followed by an init. */ + if (runloop_st->rewind_st.state != NULL) + { + command_event(CMD_EVENT_REWIND_DEINIT, NULL); + command_event(CMD_EVENT_REWIND_INIT, NULL); + } #endif break; case CMD_EVENT_REWIND_TOGGLE: