diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index b83baaee4a..2bd374c522 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1030,8 +1030,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( { switch (label_hash) { - case MENU_LABEL_SAVE_STATE: - case MENU_LABEL_LOAD_STATE: + case MENU_LABEL_STATE_SLOT: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_state); break; @@ -1107,6 +1106,8 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( case MENU_LABEL_CORE_INFORMATION: case MENU_LABEL_SYSTEM_INFORMATION: case MENU_LABEL_DEBUG_INFORMATION: + case MENU_LABEL_SAVE_STATE: + case MENU_LABEL_LOAD_STATE: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_menu_more); break; diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 5dbc82d44b..d0a5f5575c 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -85,13 +85,6 @@ static int action_left_input_desc(unsigned type, const char *label, return 0; } -static int action_left_save_state(unsigned type, const char *label, - bool wraparound) -{ - event_command(EVENT_CMD_SAVE_STATE_DECREMENT); - return 0; -} - static int action_left_scroll(unsigned type, const char *label, bool wraparound) { @@ -383,10 +376,6 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, { switch (label_hash) { - case MENU_LABEL_SAVESTATE: - case MENU_LABEL_LOADSTATE: - BIND_ACTION_LEFT(cbs, action_left_save_state); - break; case MENU_LABEL_VIDEO_SHADER_SCALE_PASS: BIND_ACTION_LEFT(cbs, action_left_shader_scale_pass); break; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 5484e1b2e1..e04eca879e 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -112,14 +112,6 @@ int action_right_input_desc(unsigned type, const char *label, return 0; } -static int action_right_save_state(unsigned type, const char *label, - bool wraparound) -{ - event_command(EVENT_CMD_SAVE_STATE_INCREMENT); - - return 0; -} - static int action_right_scroll(unsigned type, const char *label, bool wraparound) { @@ -507,10 +499,6 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, { switch (label_hash) { - case MENU_LABEL_SAVESTATE: - case MENU_LABEL_LOADSTATE: - BIND_ACTION_RIGHT(cbs, action_right_save_state); - break; case MENU_LABEL_VIDEO_SHADER_SCALE_PASS: BIND_ACTION_RIGHT(cbs, action_right_shader_scale_pass); break; diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index 8b38bc505d..800f5db4ec 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -26,6 +26,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash) { switch (hash) { + case MENU_LABEL_STATE_SLOT: + return "state_slot"; case MENU_LABEL_CHEEVOS_USERNAME: return "cheevos_username"; case MENU_LABEL_CHEEVOS_PASSWORD: @@ -684,6 +686,8 @@ const char *menu_hash_to_str_us(uint32_t hash) switch (hash) { + case MENU_LABEL_VALUE_STATE_SLOT: + return "State Slot"; case MENU_LABEL_VALUE_ACCOUNTS_CHEEVOS_SETTINGS: return "Accounts Cheevos"; case MENU_LABEL_VALUE_ACCOUNTS_CHEEVOS_USERNAME: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 7de322fae6..49931433f2 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1478,6 +1478,9 @@ int menu_displaylist_parse_settings(void *data, menu_displaylist_info_t *info, case PARSE_ACTION: precond = ST_ACTION; break; + case PARSE_ONLY_INT: + precond = ST_INT; + break; case PARSE_ONLY_UINT: precond = ST_UINT; break; @@ -1527,6 +1530,10 @@ int menu_displaylist_parse_settings(void *data, menu_displaylist_info_t *info, if (type == ST_ACTION) break; goto loop; + case PARSE_ONLY_INT: + if (type == ST_INT) + break; + goto loop; case PARSE_ONLY_UINT: if (type == ST_UINT) break; @@ -1567,6 +1574,7 @@ loop: case PARSE_ONLY_BIND: case PARSE_ONLY_FLOAT: case PARSE_ONLY_BOOL: + case PARSE_ONLY_INT: case PARSE_ONLY_UINT: case PARSE_ACTION: time_to_exit = true; @@ -1668,6 +1676,9 @@ static int menu_displaylist_parse_load_content_settings(menu_displaylist_info_t menu_hash_to_str(MENU_LABEL_TAKE_SCREENSHOT), MENU_SETTING_ACTION_SCREENSHOT, 0, 0); + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_STATE_SLOT), PARSE_ONLY_INT, true); + menu_entries_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_SAVE_STATE), menu_hash_to_str(MENU_LABEL_SAVE_STATE), diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 40dba32a6e..0de4b8c8a4 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -37,13 +37,14 @@ enum PARSE_NONE = (1 << 0), PARSE_GROUP = (1 << 1), PARSE_ACTION = (1 << 2), - PARSE_ONLY_UINT = (1 << 3), - PARSE_ONLY_BOOL = (1 << 4), - PARSE_ONLY_FLOAT = (1 << 5), - PARSE_ONLY_BIND = (1 << 6), - PARSE_ONLY_GROUP = (1 << 7), - PARSE_ONLY_SUB_GROUP = (1 << 8), - PARSE_SUB_GROUP = (1 << 9) + PARSE_ONLY_INT = (1 << 3), + PARSE_ONLY_UINT = (1 << 4), + PARSE_ONLY_BOOL = (1 << 5), + PARSE_ONLY_FLOAT = (1 << 6), + PARSE_ONLY_BIND = (1 << 7), + PARSE_ONLY_GROUP = (1 << 8), + PARSE_ONLY_SUB_GROUP = (1 << 9), + PARSE_SUB_GROUP = (1 << 10) }; enum diff --git a/menu/menu_hash.h b/menu/menu_hash.h index 641f1a20e6..a409a0ce30 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -22,6 +22,10 @@ extern "C" { #endif +#define MENU_LABEL_VALUE_STATE_SLOT 0xa1dec768U + +#define MENU_LABEL_STATE_SLOT 0x27b67f67U + #define MENU_LABEL_INPUT_HOTKEY_BINDS_BEGIN 0x5a56139bU #define MENU_LABEL_INPUT_SETTINGS 0x78b4a7c5U diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 43719b20aa..47011565d0 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3045,6 +3045,18 @@ static bool setting_append_list_main_menu_options( START_GROUP(group_info, menu_hash_to_str(MENU_VALUE_MAIN_MENU), parent_group); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info, parent_group); + CONFIG_INT( + settings->state_slot, + menu_hash_to_str(MENU_LABEL_STATE_SLOT), + menu_hash_to_str(MENU_LABEL_VALUE_STATE_SLOT), + 0, + group_info.name, + subgroup_info.name, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, -1, 0, 1, true, false); + CONFIG_ACTION( menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), menu_hash_to_str(MENU_LABEL_VALUE_CONTENT_SETTINGS),