mirror of
https://github.com/libretro/RetroArch
synced 2025-03-27 05:37:40 +00:00
(Menu) Add SD_FLAG_EXIT to signal to the menu that we want to cleanly
exit out of the menu
This commit is contained in:
parent
d6659cd4d6
commit
3d689bd40f
@ -215,7 +215,7 @@ static int menu_common_setting_set_perf(unsigned setting, unsigned action,
|
||||
}
|
||||
|
||||
|
||||
static void menu_common_setting_set_current_path_selection(
|
||||
static int menu_common_setting_set_current_path_selection(
|
||||
rarch_setting_t *setting, const char *start_path,
|
||||
const char *label, unsigned type,
|
||||
unsigned action)
|
||||
@ -234,18 +234,28 @@ static void menu_common_setting_set_current_path_selection(
|
||||
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
|
||||
if (setting->flags & SD_FLAG_EXIT)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void menu_common_setting_set_current_string_path(
|
||||
static int menu_common_setting_set_current_string_path(
|
||||
rarch_setting_t *setting, const char *dir, const char *path)
|
||||
{
|
||||
fill_pathname_join(setting->value.string, dir, path, setting->size);
|
||||
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
|
||||
if (setting->flags & SD_FLAG_EXIT)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_common_set_current_string_based_on_label(
|
||||
int menu_common_set_current_string_based_on_label(
|
||||
const char *label, const char *str)
|
||||
{
|
||||
if (!strcmp(label, "video_shader_preset_save_as"))
|
||||
@ -256,27 +266,38 @@ void menu_common_set_current_string_based_on_label(
|
||||
driver.menu_ctx->backend->shader_manager_save_preset(str, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_common_setting_set_current_string(
|
||||
int menu_common_setting_set_current_string(
|
||||
rarch_setting_t *setting, const char *str)
|
||||
{
|
||||
strlcpy(setting->value.string, str, setting->size);
|
||||
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
|
||||
if (setting->flags & SD_FLAG_EXIT)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void handle_setting(rarch_setting_t *setting,
|
||||
static int handle_setting(rarch_setting_t *setting,
|
||||
unsigned id, const char *label, unsigned action)
|
||||
{
|
||||
if (setting->type == ST_BOOL)
|
||||
menu_action_setting_boolean(setting, action);
|
||||
else if (setting->type == ST_UINT)
|
||||
menu_action_setting_unsigned_integer(setting, id, action);
|
||||
else if (setting->type == ST_FLOAT)
|
||||
menu_action_setting_fraction(setting, action);
|
||||
else if (setting->type == ST_DIR)
|
||||
return menu_action_setting_boolean(setting, action);
|
||||
if (setting->type == ST_UINT)
|
||||
return menu_action_setting_unsigned_integer(setting, id, action);
|
||||
if (setting->type == ST_FLOAT)
|
||||
return menu_action_setting_fraction(setting, action);
|
||||
if (setting->type == ST_PATH)
|
||||
return menu_common_setting_set_current_path_selection(setting,
|
||||
setting->default_value.string, setting->name, id, action);
|
||||
|
||||
if (setting->type == ST_DIR)
|
||||
{
|
||||
if (action == MENU_ACTION_START)
|
||||
{
|
||||
@ -284,12 +305,14 @@ static void handle_setting(rarch_setting_t *setting,
|
||||
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
|
||||
if (setting->flags & SD_FLAG_EXIT)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (setting->type == ST_PATH)
|
||||
menu_common_setting_set_current_path_selection(setting,
|
||||
setting->default_value.string, setting->name, id, action);
|
||||
else if (setting->type == ST_STRING)
|
||||
|
||||
if (setting->type == ST_STRING)
|
||||
{
|
||||
if (
|
||||
(setting->flags & SD_FLAG_ALLOW_INPUT) ||
|
||||
@ -304,6 +327,8 @@ static void handle_setting(rarch_setting_t *setting,
|
||||
else
|
||||
menu_action_setting_driver(setting, action);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int menu_setting_set(unsigned id, const char *label,
|
||||
@ -316,7 +341,7 @@ static int menu_setting_set(unsigned id, const char *label,
|
||||
);
|
||||
|
||||
if (setting)
|
||||
handle_setting(setting, id, label, action);
|
||||
return handle_setting(setting, id, label, action);
|
||||
else
|
||||
{
|
||||
setting = (rarch_setting_t*)get_last_setting(
|
||||
@ -350,7 +375,7 @@ static int menu_setting_set(unsigned id, const char *label,
|
||||
}
|
||||
}
|
||||
|
||||
handle_setting(setting, id, label, action);
|
||||
return handle_setting(setting, id, label, action);
|
||||
}
|
||||
else if (!strcmp(label, "video_shader_num_passes"))
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "menu_input_line_cb.h"
|
||||
#include "menu_action.h"
|
||||
|
||||
void menu_action_setting_boolean(
|
||||
int menu_action_setting_boolean(
|
||||
rarch_setting_t *setting, unsigned action)
|
||||
{
|
||||
if (
|
||||
@ -55,9 +55,14 @@ void menu_action_setting_boolean(
|
||||
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
|
||||
if (setting->flags & SD_FLAG_EXIT)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_action_setting_unsigned_integer(
|
||||
int menu_action_setting_unsigned_integer(
|
||||
rarch_setting_t *setting, unsigned id, unsigned action)
|
||||
{
|
||||
if (id == MENU_FILE_LINEFEED)
|
||||
@ -106,9 +111,14 @@ void menu_action_setting_unsigned_integer(
|
||||
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
|
||||
if (setting->flags & SD_FLAG_EXIT)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_action_setting_fraction(
|
||||
int menu_action_setting_fraction(
|
||||
rarch_setting_t *setting, unsigned action)
|
||||
{
|
||||
if (!strcmp(setting->name, "video_refresh_rate_auto"))
|
||||
@ -188,6 +198,11 @@ void menu_action_setting_fraction(
|
||||
|
||||
if (setting->change_handler)
|
||||
setting->change_handler(setting);
|
||||
|
||||
if (setting->flags & SD_FLAG_EXIT)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_action_setting_driver(
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
#include "../../settings_data.h"
|
||||
|
||||
void menu_action_setting_boolean(
|
||||
int menu_action_setting_boolean(
|
||||
rarch_setting_t *setting, unsigned action);
|
||||
|
||||
void menu_action_setting_fraction(
|
||||
int menu_action_setting_fraction(
|
||||
rarch_setting_t *setting, unsigned action);
|
||||
|
||||
void menu_action_setting_unsigned_integer(
|
||||
int menu_action_setting_unsigned_integer(
|
||||
rarch_setting_t *setting, unsigned id, unsigned action);
|
||||
|
||||
void menu_action_setting_driver(
|
||||
|
@ -2375,11 +2375,11 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
|
||||
}
|
||||
if (g_extern.main_is_init && !g_extern.libretro_dummy)
|
||||
{
|
||||
CONFIG_BOOL(lists[9], "savestate", "Save State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
CONFIG_BOOL(lists[10], "loadstate", "Load State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
CONFIG_BOOL(lists[9], "savestate", "Save State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_EXIT)
|
||||
CONFIG_BOOL(lists[10], "loadstate", "Load State", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_EXIT)
|
||||
CONFIG_BOOL(lists[11], "take_screenshot", "Take Screenshot", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
|
||||
CONFIG_BOOL(lists[12], "resume_content", "Resume Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
|
||||
CONFIG_BOOL(lists[13], "restart_content", "Restart Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
|
||||
CONFIG_BOOL(lists[12], "resume_content", "Resume Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION) WITH_FLAGS(SD_FLAG_EXIT)
|
||||
CONFIG_BOOL(lists[13], "restart_content", "Restart Content", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION) WITH_FLAGS(SD_FLAG_EXIT)
|
||||
}
|
||||
#ifndef HAVE_DYNAMIC
|
||||
CONFIG_BOOL(lists[14], "restart_retroarch", "Restart RetroArch", false, "", "",GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
|
||||
|
@ -55,6 +55,7 @@ enum setting_flags
|
||||
SD_FLAG_ALLOW_INPUT = (1 << 5),
|
||||
SD_FLAG_PUSH_ACTION = (1 << 6),
|
||||
SD_FLAG_IS_DRIVER = (1 << 7),
|
||||
SD_FLAG_EXIT = (1 << 8),
|
||||
};
|
||||
|
||||
typedef struct rarch_setting_t
|
||||
|
Loading…
x
Reference in New Issue
Block a user