mirror of
https://github.com/libretro/RetroArch
synced 2025-04-11 00:44:20 +00:00
Refactors in retroarch.c to do with game reset
This commit is contained in:
parent
ff2158b2a4
commit
4bbb05f415
@ -758,7 +758,6 @@ bool config_load_file(const char *path, bool set_defaults);
|
|||||||
bool config_save_file(const char *path);
|
bool config_save_file(const char *path);
|
||||||
bool config_read_keybinds(const char *path);
|
bool config_read_keybinds(const char *path);
|
||||||
|
|
||||||
void rarch_game_reset(void);
|
|
||||||
void rarch_main_clear_state(void);
|
void rarch_main_clear_state(void);
|
||||||
void rarch_init_system_info(void);
|
void rarch_init_system_info(void);
|
||||||
int rarch_main(int argc, char *argv[]);
|
int rarch_main(int argc, char *argv[]);
|
||||||
|
25
retroarch.c
25
retroarch.c
@ -1729,16 +1729,18 @@ void rarch_deinit_autosave(void)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 0; i < g_extern.num_autosave; i++)
|
for (i = 0; i < g_extern.num_autosave; i++)
|
||||||
autosave_free(g_extern.autosave[i]);
|
autosave_free(g_extern.autosave[i]);
|
||||||
free(g_extern.autosave);
|
|
||||||
|
if (g_extern.autosave)
|
||||||
|
free(g_extern.autosave);
|
||||||
g_extern.autosave = NULL;
|
g_extern.autosave = NULL;
|
||||||
|
|
||||||
g_extern.num_autosave = 0;
|
g_extern.num_autosave = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void set_savestate_auto_index(void)
|
static void set_savestate_auto_index(void)
|
||||||
{
|
{
|
||||||
char state_dir[PATH_MAX];
|
char state_dir[PATH_MAX], state_base[PATH_MAX];
|
||||||
char state_base[PATH_MAX];
|
|
||||||
|
|
||||||
if (!g_settings.savestate_auto_index)
|
if (!g_settings.savestate_auto_index)
|
||||||
return;
|
return;
|
||||||
@ -2324,21 +2326,12 @@ static void check_oneshot(void)
|
|||||||
old_rewind_state = new_rewind_state;
|
old_rewind_state = new_rewind_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rarch_game_reset(void)
|
|
||||||
{
|
|
||||||
RARCH_LOG("Resetting content.\n");
|
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
|
||||||
msg_queue_push(g_extern.msg_queue, "Reset.", 1, 120);
|
|
||||||
pretro_reset();
|
|
||||||
init_controllers(); // bSNES since v073r01 resets controllers to JOYPAD after a reset, so just enforce it here.
|
|
||||||
}
|
|
||||||
|
|
||||||
static void check_reset(void)
|
static void check_reset(void)
|
||||||
{
|
{
|
||||||
static bool old_state = false;
|
static bool old_state = false;
|
||||||
bool new_state = input_key_pressed_func(RARCH_RESET);
|
bool new_state = input_key_pressed_func(RARCH_RESET);
|
||||||
if (new_state && !old_state)
|
if (new_state && !old_state)
|
||||||
rarch_game_reset();
|
rarch_main_command(RARCH_CMD_RESET);
|
||||||
|
|
||||||
old_state = new_state;
|
old_state = new_state;
|
||||||
}
|
}
|
||||||
@ -3111,7 +3104,11 @@ void rarch_main_command(unsigned action)
|
|||||||
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
||||||
break;
|
break;
|
||||||
case RARCH_CMD_RESET:
|
case RARCH_CMD_RESET:
|
||||||
rarch_game_reset();
|
RARCH_LOG("Resetting content.\n");
|
||||||
|
msg_queue_clear(g_extern.msg_queue);
|
||||||
|
msg_queue_push(g_extern.msg_queue, "Reset.", 1, 120);
|
||||||
|
pretro_reset();
|
||||||
|
init_controllers(); // bSNES since v073r01 resets controllers to JOYPAD after a reset, so just enforce it here.
|
||||||
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
||||||
break;
|
break;
|
||||||
case RARCH_CMD_SAVE_STATE:
|
case RARCH_CMD_SAVE_STATE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user