Can toggle rewind enable in runtime.

This commit is contained in:
Themaister 2013-03-16 14:28:10 +01:00
parent 92fba644b7
commit e3c85b174c
3 changed files with 15 additions and 9 deletions

View File

@ -606,15 +606,19 @@ static int rgui_settings_toggle_setting(unsigned setting, rgui_action_t action,
switch (setting) switch (setting)
{ {
case RGUI_SETTINGS_REWIND_ENABLE: case RGUI_SETTINGS_REWIND_ENABLE:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_LEFT || action == RGUI_ACTION_RIGHT) if (action == RGUI_ACTION_OK ||
action == RGUI_ACTION_LEFT ||
action == RGUI_ACTION_RIGHT)
{ {
menu_settings_set(S_REWIND); menu_settings_set(S_REWIND);
if (g_settings.rewind_enable)
if (g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW)) rarch_init_rewind();
menu_settings_msg(S_MSG_RESTART_RARCH, 180);
} }
else if (action == RGUI_ACTION_START) else if (action == RGUI_ACTION_START)
{
g_settings.rewind_enable = false; g_settings.rewind_enable = false;
rarch_deinit_rewind();
}
break; break;
case RGUI_SETTINGS_REWIND_GRANULARITY: case RGUI_SETTINGS_REWIND_GRANULARITY:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT) if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT)

View File

@ -647,6 +647,8 @@ void rarch_render_cached_frame(void);
void rarch_init_msg_queue(void); void rarch_init_msg_queue(void);
void rarch_deinit_msg_queue(void); void rarch_deinit_msg_queue(void);
void rarch_input_poll(void); void rarch_input_poll(void);
void rarch_init_rewind(void);
void rarch_deinit_rewind(void);
void rarch_load_state(void); void rarch_load_state(void);
void rarch_save_state(void); void rarch_save_state(void);

View File

@ -1432,9 +1432,9 @@ static void deinit_cheats(void)
cheat_manager_free(g_extern.cheat); cheat_manager_free(g_extern.cheat);
} }
static void init_rewind(void) void rarch_init_rewind(void)
{ {
if (!g_settings.rewind_enable) if (!g_settings.rewind_enable || g_extern.state_manager)
return; return;
g_extern.state_size = pretro_serialize_size(); g_extern.state_size = pretro_serialize_size();
@ -1469,7 +1469,7 @@ static void init_rewind(void)
RARCH_WARN("Failed to init rewind buffer. Rewinding will be disabled.\n"); RARCH_WARN("Failed to init rewind buffer. Rewinding will be disabled.\n");
} }
static void deinit_rewind(void) void rarch_deinit_rewind(void)
{ {
if (g_extern.state_manager) if (g_extern.state_manager)
state_manager_free(g_extern.state_manager); state_manager_free(g_extern.state_manager);
@ -2802,7 +2802,7 @@ int rarch_main_init(int argc, char *argv[])
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (!g_extern.netplay) if (!g_extern.netplay)
#endif #endif
init_rewind(); rarch_init_rewind();
init_libretro_cbs(); init_libretro_cbs();
init_controllers(); init_controllers();
@ -2971,7 +2971,7 @@ void rarch_main_deinit(void)
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (!g_extern.netplay) if (!g_extern.netplay)
#endif #endif
deinit_rewind(); rarch_deinit_rewind();
deinit_cheats(); deinit_cheats();