mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Get rid of more expensive superfluous wrapper functions for menu code
This commit is contained in:
parent
2b4d87a983
commit
cd219f807b
@ -59,24 +59,27 @@ static int action_select_default(const char *path, const char *label, unsigned t
|
||||
if (!cbs)
|
||||
return -1;
|
||||
|
||||
switch (cbs->setting->type)
|
||||
if (cbs->setting)
|
||||
{
|
||||
case ST_BOOL:
|
||||
case ST_INT:
|
||||
case ST_UINT:
|
||||
case ST_FLOAT:
|
||||
action = MENU_ACTION_RIGHT;
|
||||
break;
|
||||
case ST_PATH:
|
||||
case ST_DIR:
|
||||
case ST_ACTION:
|
||||
case ST_STRING:
|
||||
case ST_HEX:
|
||||
case ST_BIND:
|
||||
action = MENU_ACTION_OK;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (cbs->setting->type)
|
||||
{
|
||||
case ST_BOOL:
|
||||
case ST_INT:
|
||||
case ST_UINT:
|
||||
case ST_FLOAT:
|
||||
action = MENU_ACTION_RIGHT;
|
||||
break;
|
||||
case ST_PATH:
|
||||
case ST_DIR:
|
||||
case ST_ACTION:
|
||||
case ST_STRING:
|
||||
case ST_HEX:
|
||||
case ST_BIND:
|
||||
action = MENU_ACTION_OK;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == MENU_ACTION_NOOP)
|
||||
|
@ -2214,10 +2214,10 @@ static int menu_displaylist_parse_settings_internal(void *data,
|
||||
for (;;)
|
||||
{
|
||||
bool time_to_exit = false;
|
||||
const char *short_description =
|
||||
menu_setting_get_short_description(setting);
|
||||
const char *short_description = setting->short_description;
|
||||
const char *name = menu_setting_get_name(setting);
|
||||
enum setting_type type = setting->type;
|
||||
rarch_setting_t **list = &setting;
|
||||
|
||||
switch (parse_type)
|
||||
{
|
||||
@ -2322,7 +2322,7 @@ loop:
|
||||
|
||||
if (time_to_exit)
|
||||
break;
|
||||
menu_settings_list_increment(&setting);
|
||||
(*list = *list + 1);
|
||||
}
|
||||
|
||||
if (count == 0 && add_empty_entry)
|
||||
@ -2399,10 +2399,10 @@ static int menu_displaylist_parse_settings_internal_enum(void *data,
|
||||
for (;;)
|
||||
{
|
||||
bool time_to_exit = false;
|
||||
const char *short_description =
|
||||
menu_setting_get_short_description(setting);
|
||||
const char *short_description = setting->short_description;
|
||||
const char *name = menu_setting_get_name(setting);
|
||||
enum setting_type type = setting->type;
|
||||
rarch_setting_t **list = &setting;
|
||||
|
||||
switch (parse_type)
|
||||
{
|
||||
@ -2507,7 +2507,7 @@ loop:
|
||||
|
||||
if (time_to_exit)
|
||||
break;
|
||||
menu_settings_list_increment(&setting);
|
||||
(*list = *list + 1);
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
|
@ -483,14 +483,6 @@ static void menu_settings_info_list_free(rarch_setting_info_t *list_info)
|
||||
free(list_info);
|
||||
}
|
||||
|
||||
void menu_settings_list_increment(rarch_setting_t **list)
|
||||
{
|
||||
if (!list || !*list)
|
||||
return;
|
||||
|
||||
*list = *list + 1;
|
||||
}
|
||||
|
||||
void menu_settings_list_current_add_range(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
@ -676,24 +668,18 @@ const char *menu_setting_get_parent_group(rarch_setting_t *setting)
|
||||
return setting->parent_group;
|
||||
}
|
||||
|
||||
const char *menu_setting_get_short_description(rarch_setting_t *setting)
|
||||
{
|
||||
if (!setting)
|
||||
return NULL;
|
||||
return setting->short_description;
|
||||
}
|
||||
|
||||
static rarch_setting_t *menu_setting_find_internal(rarch_setting_t *setting,
|
||||
const char *label)
|
||||
{
|
||||
uint32_t needle = msg_hash_calculate(label);
|
||||
uint32_t needle = msg_hash_calculate(label);
|
||||
rarch_setting_t **list = &setting;
|
||||
|
||||
for (; setting->type != ST_NONE; menu_settings_list_increment(&setting))
|
||||
for (; setting->type != ST_NONE; (*list = *list + 1))
|
||||
{
|
||||
if (needle == setting->name_hash && setting->type <= ST_GROUP)
|
||||
{
|
||||
const char *name = menu_setting_get_name(setting);
|
||||
const char *short_description = menu_setting_get_short_description(setting);
|
||||
const char *short_description = setting->short_description;
|
||||
/* make sure this isn't a collision */
|
||||
if (!string_is_equal(label, name))
|
||||
continue;
|
||||
@ -714,11 +700,12 @@ static rarch_setting_t *menu_setting_find_internal(rarch_setting_t *setting,
|
||||
static rarch_setting_t *menu_setting_find_internal_enum(rarch_setting_t *setting,
|
||||
enum msg_hash_enums enum_idx)
|
||||
{
|
||||
for (; setting->type != ST_NONE; menu_settings_list_increment(&setting))
|
||||
rarch_setting_t **list = &setting;
|
||||
for (; setting->type != ST_NONE; (*list = *list + 1))
|
||||
{
|
||||
if (setting->enum_idx == enum_idx && setting->type <= ST_GROUP)
|
||||
{
|
||||
const char *short_description = menu_setting_get_short_description(setting);
|
||||
const char *short_description = setting->short_description;
|
||||
if (string_is_empty(short_description))
|
||||
return NULL;
|
||||
|
||||
@ -6705,12 +6692,13 @@ bool menu_setting_free(void *data)
|
||||
{
|
||||
unsigned values, n;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
rarch_setting_t **list = &setting;
|
||||
|
||||
if (!setting)
|
||||
return false;
|
||||
|
||||
/* Free data which was previously tagged */
|
||||
for (; setting->type != ST_NONE; menu_settings_list_increment(&setting))
|
||||
for (; setting->type != ST_NONE; (*list = *list + 1))
|
||||
for (values = setting->free_flags, n = 0; values != 0; values >>= 1, n++)
|
||||
if (values & 1)
|
||||
switch (1 << n)
|
||||
|
@ -131,16 +131,12 @@ const char *menu_setting_get_values(rarch_setting_t *setting);
|
||||
|
||||
const char *menu_setting_get_name(rarch_setting_t *setting);
|
||||
|
||||
const char *menu_setting_get_short_description(rarch_setting_t *setting);
|
||||
|
||||
const char *menu_setting_get_parent_group(rarch_setting_t *setting);
|
||||
|
||||
uint32_t menu_setting_get_index(rarch_setting_t *setting);
|
||||
|
||||
void *setting_get_ptr(rarch_setting_t *setting);
|
||||
|
||||
void menu_settings_list_increment(rarch_setting_t **list);
|
||||
|
||||
void general_write_handler(void *data);
|
||||
|
||||
void general_read_handler(void *data);
|
||||
|
@ -1820,8 +1820,7 @@ static int setting_generic_action_ok_linefeed(void *data, bool wraparound)
|
||||
{
|
||||
menu_input_ctx_line_t line;
|
||||
input_keyboard_line_complete_t cb = NULL;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
const char *short_description = menu_setting_get_short_description(setting);
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -1844,7 +1843,7 @@ static int setting_generic_action_ok_linefeed(void *data, bool wraparound)
|
||||
break;
|
||||
}
|
||||
|
||||
line.label = short_description;
|
||||
line.label = setting->short_description;
|
||||
line.label_setting = setting->name;
|
||||
line.type = 0;
|
||||
line.idx = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user