mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +00:00
Add mask parameter to setting_data_get_list
This commit is contained in:
parent
fd50638b8f
commit
da3734e8c7
@ -68,7 +68,8 @@ static int menu_info_screen_iterate(unsigned action)
|
|||||||
char needle[PATH_MAX];
|
char needle[PATH_MAX];
|
||||||
unsigned info_type = 0;
|
unsigned info_type = 0;
|
||||||
rarch_setting_t *current_setting = NULL;
|
rarch_setting_t *current_setting = NULL;
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
rarch_setting_t *setting_data = (rarch_setting_t *)
|
||||||
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false);
|
||||||
file_list_t *list = (file_list_t*)driver.menu->selection_buf;
|
file_list_t *list = (file_list_t*)driver.menu->selection_buf;
|
||||||
|
|
||||||
if (!driver.menu || !setting_data)
|
if (!driver.menu || !setting_data)
|
||||||
@ -80,7 +81,7 @@ static int menu_info_screen_iterate(unsigned action)
|
|||||||
current_setting = (rarch_setting_t*)menu_entries_get_last_setting(
|
current_setting = (rarch_setting_t*)menu_entries_get_last_setting(
|
||||||
list->list[driver.menu->selection_ptr].label,
|
list->list[driver.menu->selection_ptr].label,
|
||||||
driver.menu->selection_ptr,
|
driver.menu->selection_ptr,
|
||||||
setting_data_get_list(false));
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false));
|
||||||
|
|
||||||
if (current_setting)
|
if (current_setting)
|
||||||
strlcpy(needle, current_setting->name, sizeof(needle));
|
strlcpy(needle, current_setting->name, sizeof(needle));
|
||||||
@ -768,7 +769,7 @@ static int menu_action_ok(const char *menu_path,
|
|||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
unsigned type = 0;
|
unsigned type = 0;
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t *)
|
rarch_setting_t *setting_data = (rarch_setting_t *)
|
||||||
setting_data_get_list(false);
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false);
|
||||||
rarch_setting_t *setting = (rarch_setting_t*)
|
rarch_setting_t *setting = (rarch_setting_t*)
|
||||||
setting_data_find_setting(setting_data, menu_label);
|
setting_data_find_setting(setting_data, menu_label);
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ static void glui_frame(void)
|
|||||||
file_list_get_at_offset(driver.menu->selection_buf, i, &path,
|
file_list_get_at_offset(driver.menu->selection_buf, i, &path,
|
||||||
&entry_label, &type);
|
&entry_label, &type);
|
||||||
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(
|
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(
|
||||||
setting_data_get_list(false),
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false),
|
||||||
driver.menu->selection_buf->list[i].label);
|
driver.menu->selection_buf->list[i].label);
|
||||||
(void)setting;
|
(void)setting;
|
||||||
|
|
||||||
|
@ -801,8 +801,8 @@ static void lakka_context_destroy(void *data)
|
|||||||
|
|
||||||
void lakka_init_settings(void)
|
void lakka_init_settings(void)
|
||||||
{
|
{
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list(false);
|
rarch_setting_t *setting_data = (rarch_setting_t*)
|
||||||
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false);
|
||||||
menu_category_t *category = (menu_category_t*)&categories[0];
|
menu_category_t *category = (menu_category_t*)&categories[0];
|
||||||
|
|
||||||
strlcpy(category->name, "Settings", sizeof(category->name));
|
strlcpy(category->name, "Settings", sizeof(category->name));
|
||||||
|
@ -356,7 +356,7 @@ static void rgui_render(void)
|
|||||||
file_list_get_at_offset(driver.menu->selection_buf, i, &path,
|
file_list_get_at_offset(driver.menu->selection_buf, i, &path,
|
||||||
&entry_label, &type);
|
&entry_label, &type);
|
||||||
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(
|
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(
|
||||||
setting_data_get_list(false),
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false),
|
||||||
driver.menu->selection_buf->list[i].label);
|
driver.menu->selection_buf->list[i].label);
|
||||||
(void)setting;
|
(void)setting;
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ int menu_action_setting_set(unsigned id, const char *label,
|
|||||||
rarch_setting_t *setting = (rarch_setting_t*)menu_entries_get_last_setting(
|
rarch_setting_t *setting = (rarch_setting_t*)menu_entries_get_last_setting(
|
||||||
list->list[driver.menu->selection_ptr].label,
|
list->list[driver.menu->selection_ptr].label,
|
||||||
driver.menu->selection_ptr,
|
driver.menu->selection_ptr,
|
||||||
setting_data_get_list(false)
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (setting)
|
if (setting)
|
||||||
|
@ -169,7 +169,7 @@ int menu_entries_push_list(menu_handle_t *menu,
|
|||||||
char tmp[256];
|
char tmp[256];
|
||||||
size_t list_size = 0;
|
size_t list_size = 0;
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t *)
|
rarch_setting_t *setting_data = (rarch_setting_t *)
|
||||||
setting_data_get_list(true);
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, true);
|
||||||
bool do_action = false;
|
bool do_action = false;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -72,7 +72,8 @@ void st_uint_callback(void *userdata, const char *str)
|
|||||||
{
|
{
|
||||||
menu_handle_t *menu = (menu_handle_t*)userdata;
|
menu_handle_t *menu = (menu_handle_t*)userdata;
|
||||||
rarch_setting_t *current_setting = NULL;
|
rarch_setting_t *current_setting = NULL;
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
rarch_setting_t *setting_data = (rarch_setting_t *)
|
||||||
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false);
|
||||||
|
|
||||||
if (str && *str && setting_data)
|
if (str && *str && setting_data)
|
||||||
{
|
{
|
||||||
@ -88,7 +89,8 @@ void st_string_callback(void *userdata, const char *str)
|
|||||||
{
|
{
|
||||||
menu_handle_t *menu = (menu_handle_t*)userdata;
|
menu_handle_t *menu = (menu_handle_t*)userdata;
|
||||||
rarch_setting_t *current_setting = NULL;
|
rarch_setting_t *current_setting = NULL;
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
rarch_setting_t *setting_data = (rarch_setting_t *)
|
||||||
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false);
|
||||||
|
|
||||||
if (str && *str && setting_data)
|
if (str && *str && setting_data)
|
||||||
{
|
{
|
||||||
|
@ -361,7 +361,8 @@ int menu_shader_manager_setting_toggle(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
rarch_setting_t *current_setting = NULL;
|
rarch_setting_t *current_setting = NULL;
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
rarch_setting_t *setting_data = (rarch_setting_t *)
|
||||||
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false);
|
||||||
|
|
||||||
|
|
||||||
if (!strcmp(label, "video_shader_default_filter"))
|
if (!strcmp(label, "video_shader_default_filter"))
|
||||||
|
@ -1731,7 +1731,8 @@ void setting_data_get_label(char *type_str,
|
|||||||
size_t type_str_size, unsigned *w, unsigned type,
|
size_t type_str_size, unsigned *w, unsigned type,
|
||||||
const char *menu_label, const char *label, unsigned index)
|
const char *menu_label, const char *label, unsigned index)
|
||||||
{
|
{
|
||||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list(false);
|
rarch_setting_t *setting_data = (rarch_setting_t*)
|
||||||
|
setting_data_get_list(SL_FLAG_ALL_SETTINGS, false);
|
||||||
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
||||||
driver.menu->selection_buf->list[index].label);
|
driver.menu->selection_buf->list[index].label);
|
||||||
|
|
||||||
@ -4557,7 +4558,8 @@ rarch_setting_t *setting_data_get_mainmenu(bool need_refresh)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* flatten this array to save ourselves some kilobytes */
|
/* flatten this array to save ourselves some kilobytes */
|
||||||
if (!(list = (rarch_setting_t*)realloc(list, list_info->index * sizeof(rarch_setting_t))))
|
if (!(list = (rarch_setting_t*)
|
||||||
|
realloc(list, list_info->index * sizeof(rarch_setting_t))))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
settings_info_list_free(list_info);
|
settings_info_list_free(list_info);
|
||||||
@ -4575,13 +4577,15 @@ error:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rarch_setting_t *setting_data_get_list(bool need_refresh)
|
rarch_setting_t *setting_data_get_list(unsigned mask, bool need_refresh)
|
||||||
{
|
{
|
||||||
|
static unsigned last_mask = 0;
|
||||||
rarch_setting_info_t *list_info = NULL;
|
rarch_setting_info_t *list_info = NULL;
|
||||||
static rarch_setting_t* list = NULL;
|
static rarch_setting_t* list = NULL;
|
||||||
|
|
||||||
if (list)
|
if (list)
|
||||||
{
|
{
|
||||||
|
if (mask == last_mask)
|
||||||
if (!need_refresh)
|
if (!need_refresh)
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
@ -4596,56 +4600,103 @@ rarch_setting_t *setting_data_get_list(bool need_refresh)
|
|||||||
if (!list)
|
if (!list)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_MAIN_MENU)
|
||||||
|
{
|
||||||
|
if (!setting_data_append_list_main_menu_options(&list, list_info))
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_DRIVER_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_driver_options(&list, list_info))
|
if (!setting_data_append_list_driver_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_GENERAL_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_general_options(&list, list_info))
|
if (!setting_data_append_list_general_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_GENERAL_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_video_options(&list, list_info))
|
if (!setting_data_append_list_video_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_SHADER_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_shader_options(&list, list_info))
|
if (!setting_data_append_list_shader_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_FONT_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_font_options(&list, list_info))
|
if (!setting_data_append_list_font_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_AUDIO_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_audio_options(&list, list_info))
|
if (!setting_data_append_list_audio_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_INPUT_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_input_options(&list, list_info))
|
if (!setting_data_append_list_input_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_OVERLAY_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_overlay_options(&list, list_info))
|
if (!setting_data_append_list_overlay_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_MENU_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_menu_options(&list, list_info))
|
if (!setting_data_append_list_menu_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_NETPLAY_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_netplay_options(&list, list_info))
|
if (!setting_data_append_list_netplay_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_USER_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_user_options(&list, list_info))
|
if (!setting_data_append_list_user_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_PATH_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_path_options(&list, list_info))
|
if (!setting_data_append_list_path_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask & SL_FLAG_PRIVACY_OPTIONS)
|
||||||
|
{
|
||||||
if (!setting_data_append_list_privacy_options(&list, list_info))
|
if (!setting_data_append_list_privacy_options(&list, list_info))
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
rarch_setting_t terminator = { ST_NONE };
|
rarch_setting_t terminator = { ST_NONE };
|
||||||
if (!(settings_list_append(&list, list_info, terminator)))
|
if (!(settings_list_append(&list, list_info, terminator)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* flatten this array to save ourselves some kilobytes. */
|
/* flatten this array to save ourselves some kilobytes. */
|
||||||
if (!(list = (rarch_setting_t*)realloc(list, list_info->index * sizeof(rarch_setting_t))))
|
if (!(list = (rarch_setting_t*)
|
||||||
|
realloc(list, list_info->index * sizeof(rarch_setting_t))))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
settings_info_list_free(list_info);
|
settings_info_list_free(list_info);
|
||||||
|
|
||||||
|
last_mask = mask;
|
||||||
|
|
||||||
/* do not optimize into return realloc(),
|
/* do not optimize into return realloc(),
|
||||||
* list is static and must be written. */
|
* list is static and must be written. */
|
||||||
return (rarch_setting_t*)list;
|
return (rarch_setting_t*)list;
|
||||||
|
@ -93,7 +93,7 @@ void setting_data_get_label(char *type_str,
|
|||||||
size_t type_str_size, unsigned *w, unsigned type,
|
size_t type_str_size, unsigned *w, unsigned type,
|
||||||
const char *menu_label, const char *label, unsigned index);
|
const char *menu_label, const char *label, unsigned index);
|
||||||
#endif
|
#endif
|
||||||
rarch_setting_t* setting_data_get_list(bool need_refresh);
|
rarch_setting_t* setting_data_get_list(unsigned mask, bool need_refresh);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,27 @@ enum setting_flags
|
|||||||
SD_FLAG_IS_CATEGORY = (1 << 10),
|
SD_FLAG_IS_CATEGORY = (1 << 10),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum setting_list_flags
|
||||||
|
{
|
||||||
|
SL_FLAG_MAIN_MENU = (1 << 0),
|
||||||
|
SL_FLAG_DRIVER_OPTIONS = (1 << 1),
|
||||||
|
SL_FLAG_GENERAL_OPTIONS = (1 << 2),
|
||||||
|
SL_FLAG_VIDEO_OPTIONS = (1 << 3),
|
||||||
|
SL_FLAG_SHADER_OPTIONS = (1 << 4),
|
||||||
|
SL_FLAG_FONT_OPTIONS = (1 << 5),
|
||||||
|
SL_FLAG_AUDIO_OPTIONS = (1 << 6),
|
||||||
|
SL_FLAG_INPUT_OPTIONS = (1 << 7),
|
||||||
|
SL_FLAG_OVERLAY_OPTIONS = (1 << 8),
|
||||||
|
SL_FLAG_MENU_OPTIONS = (1 << 9),
|
||||||
|
SL_FLAG_NETPLAY_OPTIONS = (1 << 10),
|
||||||
|
SL_FLAG_USER_OPTIONS = (1 << 11),
|
||||||
|
SL_FLAG_PATH_OPTIONS = (1 << 12),
|
||||||
|
SL_FLAG_PRIVACY_OPTIONS = (1 << 13),
|
||||||
|
SL_FLAG_ALL = (1 << 14),
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SL_FLAG_ALL_SETTINGS (SL_FLAG_ALL - SL_FLAG_MAIN_MENU)
|
||||||
|
|
||||||
typedef void (*change_handler_t)(void *data);
|
typedef void (*change_handler_t)(void *data);
|
||||||
|
|
||||||
typedef struct rarch_setting_info
|
typedef struct rarch_setting_info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user