mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
Add SRAM autosave option to RGUI.
This commit is contained in:
parent
b714a6d7d1
commit
1cab391be8
@ -135,6 +135,7 @@ typedef enum
|
||||
RGUI_SETTINGS_CORE_OPTIONS,
|
||||
RGUI_SETTINGS_REWIND_ENABLE,
|
||||
RGUI_SETTINGS_REWIND_GRANULARITY,
|
||||
RGUI_SETTINGS_SRAM_AUTOSAVE,
|
||||
RGUI_SETTINGS_SAVESTATE_SAVE,
|
||||
RGUI_SETTINGS_SAVESTATE_LOAD,
|
||||
RGUI_SETTINGS_DISK_INDEX,
|
||||
|
@ -544,7 +544,10 @@ static void render_text(rgui_handle_t *rgui)
|
||||
strlcpy(type_str, "OFF", sizeof(type_str));
|
||||
break;
|
||||
case RGUI_SETTINGS_REWIND_GRANULARITY:
|
||||
snprintf(type_str, sizeof(type_str), "%d", g_settings.rewind_granularity);
|
||||
snprintf(type_str, sizeof(type_str), "%u", g_settings.rewind_granularity);
|
||||
break;
|
||||
case RGUI_SETTINGS_SRAM_AUTOSAVE:
|
||||
strlcpy(type_str, g_settings.autosave_interval ? "ON" : "OFF", sizeof(type_str));
|
||||
break;
|
||||
case RGUI_SETTINGS_SAVESTATE_SAVE:
|
||||
case RGUI_SETTINGS_SAVESTATE_LOAD:
|
||||
@ -786,6 +789,22 @@ static int rgui_settings_toggle_setting(rgui_handle_t *rgui, unsigned setting, r
|
||||
else if (action == RGUI_ACTION_START)
|
||||
g_settings.rewind_granularity = 1;
|
||||
break;
|
||||
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
|
||||
case RGUI_SETTINGS_SRAM_AUTOSAVE:
|
||||
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT || action == RGUI_ACTION_LEFT)
|
||||
{
|
||||
rarch_deinit_autosave();
|
||||
g_settings.autosave_interval = (!g_settings.autosave_interval) * 10;
|
||||
if (g_settings.autosave_interval)
|
||||
rarch_init_autosave();
|
||||
}
|
||||
else if (action == RGUI_ACTION_START)
|
||||
{
|
||||
rarch_deinit_autosave();
|
||||
g_settings.autosave_interval = 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case RGUI_SETTINGS_SAVESTATE_SAVE:
|
||||
case RGUI_SETTINGS_SAVESTATE_LOAD:
|
||||
if (action == RGUI_ACTION_OK)
|
||||
@ -1133,6 +1152,9 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui)
|
||||
|
||||
rgui_list_push(rgui->selection_buf, "Rewind", RGUI_SETTINGS_REWIND_ENABLE, 0);
|
||||
rgui_list_push(rgui->selection_buf, "Rewind Granularity", RGUI_SETTINGS_REWIND_GRANULARITY, 0);
|
||||
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
|
||||
rgui_list_push(rgui->selection_buf, "SRAM Autosave", RGUI_SETTINGS_SRAM_AUTOSAVE, 0);
|
||||
#endif
|
||||
rgui_list_push(rgui->selection_buf, "Mute Audio", RGUI_SETTINGS_AUDIO_MUTE, 0);
|
||||
rgui_list_push(rgui->selection_buf, "Audio Control Rate", RGUI_SETTINGS_AUDIO_CONTROL_RATE, 0);
|
||||
#ifdef GEKKO
|
||||
|
@ -690,6 +690,8 @@ void rarch_set_fullscreen(bool fullscreen);
|
||||
void rarch_disk_control_set_eject(bool state, bool log);
|
||||
void rarch_disk_control_set_index(unsigned index);
|
||||
void rarch_disk_control_append_image(const char *path);
|
||||
void rarch_init_autosave(void);
|
||||
void rarch_deinit_autosave(void);
|
||||
|
||||
void rarch_load_state(void);
|
||||
void rarch_save_state(void);
|
||||
|
12
retroarch.c
12
retroarch.c
@ -1669,7 +1669,7 @@ static void init_libretro_cbs(void)
|
||||
}
|
||||
|
||||
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
|
||||
static void init_autosave(void)
|
||||
void rarch_init_autosave(void)
|
||||
{
|
||||
int ram_types[2] = {-1, -1};
|
||||
const char *ram_paths[2] = {NULL, NULL};
|
||||
@ -1722,7 +1722,7 @@ static void init_autosave(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void deinit_autosave(void)
|
||||
void rarch_deinit_autosave(void)
|
||||
{
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(g_extern.autosave); i++)
|
||||
{
|
||||
@ -2445,7 +2445,7 @@ void rarch_disk_control_append_image(const char *path)
|
||||
msg_queue_push(g_extern.msg_queue, msg, 0, 180);
|
||||
|
||||
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
|
||||
deinit_autosave();
|
||||
rarch_deinit_autosave();
|
||||
#endif
|
||||
|
||||
// Update paths for our new image.
|
||||
@ -2456,7 +2456,7 @@ void rarch_disk_control_append_image(const char *path)
|
||||
fill_pathnames();
|
||||
|
||||
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
|
||||
init_autosave();
|
||||
rarch_init_autosave();
|
||||
#endif
|
||||
|
||||
rarch_disk_control_set_eject(false, false);
|
||||
@ -2966,7 +2966,7 @@ int rarch_main_init(int argc, char *argv[])
|
||||
|
||||
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
|
||||
if (g_extern.use_sram)
|
||||
init_autosave();
|
||||
rarch_init_autosave();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
@ -3102,7 +3102,7 @@ void rarch_main_deinit(void)
|
||||
|
||||
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
|
||||
if (g_extern.use_sram)
|
||||
deinit_autosave();
|
||||
rarch_deinit_autosave();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
|
Loading…
x
Reference in New Issue
Block a user