Expose more SRAM settings in RGUI.

Also treat save state slot -1 as the "auto save slot".
This commit is contained in:
Themaister 2014-02-15 11:12:34 +01:00
parent a788009e7c
commit b86ca166bf
6 changed files with 71 additions and 15 deletions

View File

@ -1949,6 +1949,10 @@ void menu_populate_entries(void *data, unsigned menu_type)
#ifdef HAVE_SCREENSHOTS
file_list_push(rgui->selection_buf, "GPU Screenshots", RGUI_SETTINGS_GPU_SCREENSHOT, 0);
#endif
file_list_push(rgui->selection_buf, "Savestate Autosave On Exit", RGUI_SETTINGS_SAVESTATE_AUTO_SAVE, 0);
file_list_push(rgui->selection_buf, "Savestate Autoload", RGUI_SETTINGS_SAVESTATE_AUTO_LOAD, 0);
file_list_push(rgui->selection_buf, "Block SRAM Overwrite", RGUI_SETTINGS_BLOCK_SRAM_OVERWRITE, 0);
file_list_push(rgui->selection_buf, "Config Save On Exit", RGUI_SETTINGS_CONFIG_SAVE_ON_EXIT, 0);
file_list_push(rgui->selection_buf, "Per-Core Configs", RGUI_SETTINGS_PER_CORE_CONFIG, 0);
#if defined(HAVE_THREADS)

View File

@ -129,6 +129,9 @@ typedef enum
RGUI_SETTINGS_DRIVER_MENU,
RGUI_SETTINGS_SCREENSHOT,
RGUI_SETTINGS_GPU_SCREENSHOT,
RGUI_SETTINGS_SAVESTATE_AUTO_SAVE,
RGUI_SETTINGS_SAVESTATE_AUTO_LOAD,
RGUI_SETTINGS_BLOCK_SRAM_OVERWRITE,
RGUI_SCREENSHOT_DIR_PATH,
RGUI_BROWSER_DIR_PATH,
RGUI_SHADER_DIR_PATH,

View File

@ -435,14 +435,33 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
g_settings.rewind_granularity = 1;
break;
case RGUI_SETTINGS_CONFIG_SAVE_ON_EXIT:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT
|| action == RGUI_ACTION_LEFT)
{
g_extern.config_save_on_exit = !g_extern.config_save_on_exit;
}
else if (action == RGUI_ACTION_START)
g_extern.config_save_on_exit = true;
break;
case RGUI_SETTINGS_SAVESTATE_AUTO_SAVE:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT
|| action == RGUI_ACTION_LEFT)
g_settings.savestate_auto_save = !g_settings.savestate_auto_save;
else if (action == RGUI_ACTION_START)
g_settings.savestate_auto_save = false;
break;
case RGUI_SETTINGS_SAVESTATE_AUTO_LOAD:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT
|| action == RGUI_ACTION_LEFT)
g_settings.savestate_auto_load = !g_settings.savestate_auto_load;
else if (action == RGUI_ACTION_START)
g_settings.savestate_auto_load = true;
break;
case RGUI_SETTINGS_BLOCK_SRAM_OVERWRITE:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT
|| action == RGUI_ACTION_LEFT)
g_settings.block_sram_overwrite = !g_settings.block_sram_overwrite;
else if (action == RGUI_ACTION_START)
g_settings.block_sram_overwrite = false;
break;
case RGUI_SETTINGS_PER_CORE_CONFIG:
if (action == RGUI_ACTION_OK || action == RGUI_ACTION_RIGHT
|| action == RGUI_ACTION_LEFT)
@ -491,7 +510,8 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
g_extern.state_slot = 0;
else if (action == RGUI_ACTION_LEFT)
{
if (g_extern.state_slot != 0)
// Slot -1 is (auto) slot.
if (g_extern.state_slot >= 0)
g_extern.state_slot--;
}
else if (action == RGUI_ACTION_RIGHT)
@ -1073,7 +1093,7 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
}
else if (action == RGUI_ACTION_LEFT)
{
if(g_extern.console.screen.gamma_correction > 0)
if (g_extern.console.screen.gamma_correction > 0)
{
g_extern.console.screen.gamma_correction--;
if (driver.video_poke && driver.video_poke->apply_state_changes)
@ -1082,7 +1102,7 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
}
else if (action == RGUI_ACTION_RIGHT)
{
if(g_extern.console.screen.gamma_correction < MAX_GAMMA_SETTING)
if (g_extern.console.screen.gamma_correction < MAX_GAMMA_SETTING)
{
g_extern.console.screen.gamma_correction++;
if (driver.video_poke && driver.video_poke->apply_state_changes)
@ -1759,6 +1779,15 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
case RGUI_SETTINGS_CONFIG_SAVE_ON_EXIT:
strlcpy(type_str, g_extern.config_save_on_exit ? "ON" : "OFF", type_str_size);
break;
case RGUI_SETTINGS_SAVESTATE_AUTO_SAVE:
strlcpy(type_str, g_settings.savestate_auto_save ? "ON" : "OFF", type_str_size);
break;
case RGUI_SETTINGS_SAVESTATE_AUTO_LOAD:
strlcpy(type_str, g_settings.savestate_auto_load ? "ON" : "OFF", type_str_size);
break;
case RGUI_SETTINGS_BLOCK_SRAM_OVERWRITE:
strlcpy(type_str, g_settings.block_sram_overwrite ? "ON" : "OFF", type_str_size);
break;
case RGUI_SETTINGS_PER_CORE_CONFIG:
strlcpy(type_str, g_settings.core_specific_config ? "ON" : "OFF", type_str_size);
break;
@ -1770,7 +1799,10 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
break;
case RGUI_SETTINGS_SAVESTATE_SAVE:
case RGUI_SETTINGS_SAVESTATE_LOAD:
snprintf(type_str, type_str_size, "%d", g_extern.state_slot);
if (g_extern.state_slot < 0)
strlcpy(type_str, "-1 (auto)", type_str_size);
else
snprintf(type_str, type_str_size, "%d", g_extern.state_slot);
break;
case RGUI_SETTINGS_AUDIO_MUTE:
strlcpy(type_str, g_extern.audio_data.mute ? "ON" : "OFF", type_str_size);
@ -1843,7 +1875,6 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
case RGUI_SETTINGS_VIDEO_OPTIONS:
case RGUI_SETTINGS_AUDIO_OPTIONS:
case RGUI_SETTINGS_DISK_OPTIONS:
case RGUI_SETTINGS_SAVE_CONFIG:
#ifdef HAVE_SHADER_MANAGER
case RGUI_SETTINGS_SHADER_OPTIONS:
case RGUI_SETTINGS_SHADER_PRESET:
@ -1857,7 +1888,6 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
case RGUI_SETTINGS_DRIVERS:
case RGUI_SETTINGS_CUSTOM_BIND_ALL:
case RGUI_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
case RGUI_START_SCREEN:
strlcpy(type_str, "...", type_str_size);
break;
#ifdef HAVE_OVERLAY
@ -1974,7 +2004,7 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
strlcpy(type_str, (g_extern.lifecycle_state & (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE)) ? "ON" : "OFF", type_str_size);
break;
default:
type_str[0] = 0;
*type_str = '\0';
*w = 0;
break;
}

View File

@ -406,7 +406,7 @@ struct global
char bps_name[PATH_MAX];
char ips_name[PATH_MAX];
unsigned state_slot;
int state_slot;
struct
{

View File

@ -1978,7 +1978,9 @@ void rarch_load_state(void)
char load_path[PATH_MAX];
if (g_extern.state_slot > 0)
snprintf(load_path, sizeof(load_path), "%s%u", g_extern.savestate_name, g_extern.state_slot);
snprintf(load_path, sizeof(load_path), "%s%d", g_extern.savestate_name, g_extern.state_slot);
else if (g_extern.state_slot < 0)
snprintf(load_path, sizeof(load_path), "%s.auto", g_extern.savestate_name);
else
snprintf(load_path, sizeof(load_path), "%s", g_extern.savestate_name);
@ -1988,7 +1990,12 @@ void rarch_load_state(void)
if (size)
{
if (load_state(load_path))
snprintf(msg, sizeof(msg), "Loaded state from slot #%u.", g_extern.state_slot);
{
if (g_extern.state_slot < 0)
snprintf(msg, sizeof(msg), "Loaded state from slot #-1 (auto).");
else
snprintf(msg, sizeof(msg), "Loaded state from slot #%d.", g_extern.state_slot);
}
else
snprintf(msg, sizeof(msg), "Failed to load state from \"%s\".", load_path);
}
@ -2008,7 +2015,9 @@ void rarch_save_state(void)
char save_path[PATH_MAX];
if (g_extern.state_slot > 0)
snprintf(save_path, sizeof(save_path), "%s%u", g_extern.savestate_name, g_extern.state_slot);
snprintf(save_path, sizeof(save_path), "%s%d", g_extern.savestate_name, g_extern.state_slot);
else if (g_extern.state_slot < 0)
snprintf(save_path, sizeof(save_path), "%s.auto", g_extern.savestate_name);
else
snprintf(save_path, sizeof(save_path), "%s", g_extern.savestate_name);
@ -2018,7 +2027,12 @@ void rarch_save_state(void)
if (size)
{
if (save_state(save_path))
snprintf(msg, sizeof(msg), "Saved state to slot #%u.", g_extern.state_slot);
{
if (g_extern.state_slot < 0)
snprintf(msg, sizeof(msg), "Saved state to slot #-1 (auto).");
else
snprintf(msg, sizeof(msg), "Saved state to slot #%u.", g_extern.state_slot);
}
else
snprintf(msg, sizeof(msg), "Failed to save state to \"%s\".", save_path);
}

View File

@ -1324,6 +1324,11 @@ bool config_save_file(const char *path)
#endif
config_set_float(conf, "video_font_size", g_settings.video.font_size);
config_set_bool(conf, "block_sram_overwrite", g_settings.block_sram_overwrite);
config_set_bool(conf, "savestate_auto_index", g_settings.savestate_auto_index);
config_set_bool(conf, "savestate_auto_save", g_settings.savestate_auto_save);
config_set_bool(conf, "savestate_auto_load", g_settings.savestate_auto_load);
// g_extern
config_set_bool(conf, "config_save_on_exit", g_extern.config_save_on_exit);
config_set_int(conf, "sound_mode", g_extern.console.sound.mode);