From 8c49eed56c29d7bc66422d9eb1ca06c3b6a24638 Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Mon, 3 Oct 2022 15:42:36 +0200 Subject: [PATCH] rarch_setting - remove dont_use_enum_idx_representation value - set it as a flag instead --- menu/menu_driver.c | 3 ++- menu/menu_setting.c | 33 ++++++++++++++++++++------------- setting_list.h | 4 ++-- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 999ffa504e..3308abf3d5 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -469,7 +469,8 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, cbs && cbs->setting && cbs->setting->enum_value_idx != MSG_UNKNOWN - && !cbs->setting->dont_use_enum_idx_representation) + && !(cbs->setting->flags + & SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION)) strlcpy(entry->path, msg_hash_to_str(cbs->setting->enum_value_idx), sizeof(entry->path)); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1becfb703e..4ecb0a4567 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1393,7 +1393,8 @@ static rarch_setting_t setting_action_setting(const char* name, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -1455,8 +1456,6 @@ static rarch_setting_t setting_group_setting( result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = false; - return result; } @@ -1531,7 +1530,8 @@ static rarch_setting_t setting_float_setting(const char* name, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -1606,7 +1606,8 @@ static rarch_setting_t setting_uint_setting(const char* name, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -1683,7 +1684,8 @@ static rarch_setting_t setting_size_setting(const char* name, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -1759,7 +1761,8 @@ static rarch_setting_t setting_hex_setting(const char* name, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -1835,7 +1838,8 @@ static rarch_setting_t setting_bind_setting(const char* name, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -1981,7 +1985,8 @@ static rarch_setting_t setting_string_setting(enum setting_type type, break; } - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -2083,7 +2088,8 @@ static rarch_setting_t setting_subgroup_setting(enum setting_type type, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -2162,7 +2168,8 @@ static rarch_setting_t setting_bool_setting(const char* name, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -2237,7 +2244,8 @@ static rarch_setting_t setting_int_setting(const char* name, result.cmd_trigger_idx = CMD_EVENT_NONE; result.cmd_trigger_event_triggered = false; - result.dont_use_enum_idx_representation = dont_use_enum_idx; + if (dont_use_enum_idx) + result.flags |= SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION; return result; } @@ -21725,7 +21733,6 @@ void menu_setting_free(rarch_setting_t *setting) (*&list)[pos].enum_idx = MSG_UNKNOWN; \ (*&list)[pos].enum_value_idx = MSG_UNKNOWN; \ (*&list)[pos].type = ST_NONE; \ - (*&list)[pos].dont_use_enum_idx_representation = false; \ (*&list)[pos].index = 0; \ (*&list)[pos].index_offset = 0; \ (*&list)[pos].offset_by = 0; \ diff --git a/setting_list.h b/setting_list.h index 8d0626c092..c79af248eb 100644 --- a/setting_list.h +++ b/setting_list.h @@ -83,7 +83,8 @@ enum setting_flags SD_FLAG_ADVANCED = (1 << 9), SD_FLAG_LAKKA_ADVANCED = (1 << 10), SD_FLAG_ENFORCE_MINRANGE = (1 << 11), - SD_FLAG_ENFORCE_MAXRANGE = (1 << 12) + SD_FLAG_ENFORCE_MAXRANGE = (1 << 12), + SD_FLAG_DONT_USE_ENUM_IDX_REPRESENTATION = (1 << 13) }; enum settings_free_flags @@ -200,7 +201,6 @@ struct rarch_setting uint8_t index; bool cmd_trigger_event_triggered; - bool dont_use_enum_idx_representation; }; /**