Add auto save state on end.

This commit is contained in:
Themaister 2012-06-02 21:33:37 +02:00
parent ddb03333e3
commit 7a4ef581a4
5 changed files with 27 additions and 0 deletions

View File

@ -277,6 +277,11 @@ static const bool block_sram_overwrite = false;
// When the ROM is loaded, state index will be set to the highest existing value.
static const bool savestate_auto_index = false;
// Automatically saves a savestate at the end of RetroArch's lifetime.
// The path is $SRAM_PATH.auto.
// RetroArch will automatically load any savestate with this path on startup.
static const bool savestate_auto_save = false;
// Slowmotion ratio.
static const float slowmotion_ratio = 3.0;

View File

@ -181,6 +181,7 @@ struct settings
bool block_sram_overwrite;
bool savestate_auto_index;
bool savestate_auto_save;
bool network_cmd_enable;
uint16_t network_cmd_port;

View File

@ -1642,6 +1642,18 @@ static void load_auto_state(void)
}
}
static void save_auto_state(void)
{
if (!g_settings.savestate_auto_save)
return;
char savestate_name_auto[PATH_MAX];
fill_pathname_noext(savestate_name_auto, g_extern.savestate_name,
".auto", sizeof(savestate_name_auto));
save_state(savestate_name_auto);
}
void rarch_load_state(void)
{
char load_path[PATH_MAX];
@ -2558,6 +2570,8 @@ void rarch_main_deinit(void)
deinit_movie();
#endif
save_auto_state();
pretro_unload_game();
pretro_deinit();
uninit_drivers();

View File

@ -8,6 +8,11 @@
# This will be overridden by explicit command line options.
# savestate_directory =
# Automatically saves a savestate at the end of RetroArch's lifetime.
# The path is $SRAM_PATH.auto.
# RetroArch will automatically load any savestate with this path on startup.
# savestate_auto_save = false
# Load libretro from a dynamic location for dynamically built RetroArch.
# This option is mandatory.
# libretro_path = "/path/to/libretro.so"

View File

@ -189,6 +189,7 @@ void config_set_defaults(void)
g_settings.block_sram_overwrite = block_sram_overwrite;
g_settings.savestate_auto_index = savestate_auto_index;
g_settings.savestate_auto_save = savestate_auto_save;
g_settings.network_cmd_enable = network_cmd_enable;
g_settings.network_cmd_port = network_cmd_port;
@ -458,6 +459,7 @@ bool config_load_file(const char *path)
CONFIG_GET_BOOL(block_sram_overwrite, "block_sram_overwrite");
CONFIG_GET_BOOL(savestate_auto_index, "savestate_auto_index");
CONFIG_GET_BOOL(savestate_auto_save, "savestate_auto_save");
CONFIG_GET_BOOL(network_cmd_enable, "network_cmd_enable");
CONFIG_GET_INT(network_cmd_port, "network_cmd_port");