mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Add need_refresh parameter to setting_data_get_list
This commit is contained in:
parent
0aa4465aa4
commit
8dbe11613d
@ -128,7 +128,7 @@ NSWindowDelegate>
|
||||
NSMutableArray* thisGroup = nil;
|
||||
NSMutableArray* thisSubGroup = nil;
|
||||
self.settings = [NSMutableArray array];
|
||||
setting_data = (const rarch_setting_t *)setting_data_get_list();
|
||||
setting_data = (const rarch_setting_t *)setting_data_get_list(true);
|
||||
|
||||
for (i = 0; setting_data[i].type; i ++)
|
||||
{
|
||||
@ -246,7 +246,7 @@ NSWindowDelegate>
|
||||
{
|
||||
char buffer[PATH_MAX];
|
||||
rarch_setting_t* setting_data, *setting = NULL;
|
||||
setting_data = (rarch_setting_t*)setting_data_get_list();
|
||||
setting_data = (rarch_setting_t*)setting_data_get_list(false);
|
||||
setting = (rarch_setting_t*)&setting_data[[item intValue]];
|
||||
|
||||
if ([[tableColumn identifier] isEqualToString:BOXSTRING("left")])
|
||||
@ -282,7 +282,7 @@ NSWindowDelegate>
|
||||
if ([[tableColumn identifier] isEqualToString:BOXSTRING("left")])
|
||||
return [tableColumn dataCell];
|
||||
|
||||
setting_data = (const rarch_setting_t *)setting_data_get_list();
|
||||
setting_data = (const rarch_setting_t *)setting_data_get_list(false);
|
||||
setting = (const rarch_setting_t *)&setting_data[[item intValue]];
|
||||
|
||||
switch (setting->type)
|
||||
@ -304,7 +304,7 @@ NSWindowDelegate>
|
||||
|
||||
if ([item isKindOfClass:[NSNumber class]])
|
||||
{
|
||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list();
|
||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list(false);
|
||||
rarch_setting_t *setting = (rarch_setting_t*)&setting_data[[item intValue]];
|
||||
|
||||
switch (setting->type)
|
||||
@ -334,7 +334,7 @@ NSWindowDelegate>
|
||||
|
||||
if ([item isKindOfClass:[NSNumber class]])
|
||||
{
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
||||
rarch_setting_t *setting = (rarch_setting_t*)&setting_data[[item intValue]];
|
||||
NSString *editor_string = (NSString*)editor.string;
|
||||
|
||||
|
@ -808,7 +808,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
_pathToSave = BOXSTRING(g_defaults.config_path);
|
||||
}
|
||||
|
||||
setting_data = (rarch_setting_t*)setting_data_get_list();
|
||||
setting_data = (rarch_setting_t*)setting_data_get_list(true);
|
||||
setting_data_load_config_path(setting_data, _pathToSave.UTF8String);
|
||||
|
||||
// HACK: Load the key mapping table
|
||||
@ -858,7 +858,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
|
||||
if (config)
|
||||
{
|
||||
setting_data_save_config(setting_data_get_list(), config);
|
||||
setting_data_save_config(setting_data_get_list(false), config);
|
||||
config_file_write(config, self.pathToSave.UTF8String);
|
||||
config_file_free(config);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ static int menu_info_screen_iterate(unsigned action)
|
||||
char needle[PATH_MAX];
|
||||
unsigned info_type = 0;
|
||||
rarch_setting_t *current_setting = NULL;
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
||||
file_list_t *list = (file_list_t*)driver.menu->selection_buf;
|
||||
|
||||
if (!driver.menu || !setting_data)
|
||||
@ -80,7 +80,7 @@ static int menu_info_screen_iterate(unsigned action)
|
||||
current_setting = (rarch_setting_t*)menu_entries_get_last_setting(
|
||||
list->list[driver.menu->selection_ptr].label,
|
||||
driver.menu->selection_ptr,
|
||||
setting_data_get_list());
|
||||
setting_data_get_list(false));
|
||||
|
||||
if (current_setting)
|
||||
strlcpy(needle, current_setting->name, sizeof(needle));
|
||||
@ -768,7 +768,7 @@ static int menu_action_ok(const char *menu_path,
|
||||
const char *path = NULL;
|
||||
unsigned type = 0;
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)
|
||||
setting_data_get_list();
|
||||
setting_data_get_list(false);
|
||||
rarch_setting_t *setting = (rarch_setting_t*)
|
||||
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,
|
||||
&entry_label, &type);
|
||||
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(
|
||||
setting_data_get_list(),
|
||||
setting_data_get_list(false),
|
||||
driver.menu->selection_buf->list[i].label);
|
||||
(void)setting;
|
||||
|
||||
|
@ -801,7 +801,7 @@ static void lakka_context_destroy(void *data)
|
||||
|
||||
void lakka_init_settings(void)
|
||||
{
|
||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list();
|
||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list(false);
|
||||
|
||||
menu_category_t *category = (menu_category_t*)&categories[0];
|
||||
|
||||
|
@ -356,7 +356,7 @@ static void rgui_render(void)
|
||||
file_list_get_at_offset(driver.menu->selection_buf, i, &path,
|
||||
&entry_label, &type);
|
||||
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(
|
||||
setting_data_get_list(),
|
||||
setting_data_get_list(false),
|
||||
driver.menu->selection_buf->list[i].label);
|
||||
(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(
|
||||
list->list[driver.menu->selection_ptr].label,
|
||||
driver.menu->selection_ptr,
|
||||
setting_data_get_list()
|
||||
setting_data_get_list(false)
|
||||
);
|
||||
|
||||
if (setting)
|
||||
|
@ -167,7 +167,7 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
char tmp[256];
|
||||
size_t list_size = 0;
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)
|
||||
setting_data_get_list();
|
||||
setting_data_get_list(true);
|
||||
bool do_action = false;
|
||||
|
||||
#if 0
|
||||
@ -211,7 +211,6 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
!strcmp(label, "Netplay Options")
|
||||
)
|
||||
{
|
||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list();
|
||||
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
||||
label);
|
||||
|
||||
@ -242,7 +241,6 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
}
|
||||
else if (!strcmp(label, "settings"))
|
||||
{
|
||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list();
|
||||
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
||||
"Driver Options");
|
||||
|
||||
|
@ -72,7 +72,7 @@ void st_uint_callback(void *userdata, const char *str)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)userdata;
|
||||
rarch_setting_t *current_setting = NULL;
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
||||
|
||||
if (str && *str && setting_data)
|
||||
{
|
||||
@ -88,7 +88,7 @@ void st_string_callback(void *userdata, const char *str)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)userdata;
|
||||
rarch_setting_t *current_setting = NULL;
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
||||
|
||||
if (str && *str && setting_data)
|
||||
{
|
||||
|
@ -361,7 +361,7 @@ int menu_shader_manager_setting_toggle(
|
||||
#endif
|
||||
|
||||
rarch_setting_t *current_setting = NULL;
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
|
||||
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list(false);
|
||||
|
||||
|
||||
if (!strcmp(label, "video_shader_default_filter"))
|
||||
|
110
settings_data.c
110
settings_data.c
@ -1791,7 +1791,7 @@ void setting_data_get_label(char *type_str,
|
||||
size_t type_str_size, unsigned *w, unsigned type,
|
||||
const char *menu_label, const char *label, unsigned index)
|
||||
{
|
||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list();
|
||||
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list(false);
|
||||
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
||||
driver.menu->selection_buf->list[index].label);
|
||||
|
||||
@ -2331,58 +2331,6 @@ void *rarch_setting_list_new(unsigned size)
|
||||
return list;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
|
||||
{
|
||||
rarch_setting_info_t *list_info = NULL;
|
||||
rarch_setting_group_info_t group_info;
|
||||
rarch_setting_group_info_t subgroup_info;
|
||||
static rarch_setting_t* list = NULL;
|
||||
|
||||
(void)group_info;
|
||||
(void)subgroup_info;
|
||||
|
||||
if (list)
|
||||
{
|
||||
if (!regenerate)
|
||||
return list;
|
||||
|
||||
rarch_setting_list_free(list);
|
||||
}
|
||||
|
||||
list_info = (rarch_setting_info_t*)rarch_setting_info_list_new();
|
||||
if (!list_info)
|
||||
return NULL;
|
||||
|
||||
list = (rarch_setting_t*)rarch_setting_list_new(list_info->size);
|
||||
if (!list)
|
||||
goto error;
|
||||
|
||||
if (!setting_data_get_list_main_menu_options(&list, list_info))
|
||||
goto error;
|
||||
|
||||
rarch_setting_t terminator = { ST_NONE };
|
||||
if (!(data_list_append(&list, list_info, terminator)))
|
||||
goto error;
|
||||
|
||||
/* flatten this array to save ourselves some kilobytes */
|
||||
if (!(list = (rarch_setting_t*)realloc(list, list_info->index * sizeof(rarch_setting_t))))
|
||||
goto error;
|
||||
|
||||
rarch_setting_info_list_free(list_info);
|
||||
|
||||
/* do not optimize into return realloc(),
|
||||
* list is static and must be written. */
|
||||
return (rarch_setting_t*)list;
|
||||
|
||||
error:
|
||||
RARCH_ERR("Allocation failed.\n");
|
||||
rarch_setting_info_list_free(list_info);
|
||||
rarch_setting_list_free(list);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool setting_data_get_list_driver_options(
|
||||
rarch_setting_t **list,
|
||||
@ -2951,15 +2899,69 @@ bool setting_data_get_list_privacy_options(
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* TODO - combine this with setting_data_get_list. */
|
||||
|
||||
rarch_setting_t *setting_data_get_list(void)
|
||||
rarch_setting_t *setting_data_get_mainmenu(bool need_refresh)
|
||||
{
|
||||
rarch_setting_info_t *list_info = NULL;
|
||||
static rarch_setting_t* list = NULL;
|
||||
|
||||
if (list)
|
||||
{
|
||||
if (!need_refresh)
|
||||
return list;
|
||||
|
||||
rarch_setting_list_free(list);
|
||||
}
|
||||
|
||||
list_info = (rarch_setting_info_t*)rarch_setting_info_list_new();
|
||||
if (!list_info)
|
||||
return NULL;
|
||||
|
||||
list = (rarch_setting_t*)rarch_setting_list_new(list_info->size);
|
||||
if (!list)
|
||||
goto error;
|
||||
|
||||
if (!setting_data_get_list_main_menu_options(&list, list_info))
|
||||
goto error;
|
||||
|
||||
rarch_setting_t terminator = { ST_NONE };
|
||||
if (!(data_list_append(&list, list_info, terminator)))
|
||||
goto error;
|
||||
|
||||
/* flatten this array to save ourselves some kilobytes */
|
||||
if (!(list = (rarch_setting_t*)realloc(list, list_info->index * sizeof(rarch_setting_t))))
|
||||
goto error;
|
||||
|
||||
rarch_setting_info_list_free(list_info);
|
||||
|
||||
/* do not optimize into return realloc(),
|
||||
* list is static and must be written. */
|
||||
return (rarch_setting_t*)list;
|
||||
|
||||
error:
|
||||
RARCH_ERR("Allocation failed.\n");
|
||||
rarch_setting_info_list_free(list_info);
|
||||
rarch_setting_list_free(list);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
rarch_setting_t *setting_data_get_list(bool need_refresh)
|
||||
{
|
||||
rarch_setting_info_t *list_info = NULL;
|
||||
static rarch_setting_t* list = NULL;
|
||||
|
||||
if (list)
|
||||
{
|
||||
if (!need_refresh)
|
||||
return list;
|
||||
|
||||
rarch_setting_list_free(list);
|
||||
}
|
||||
|
||||
list_info = (rarch_setting_info_t*)rarch_setting_info_list_new();
|
||||
if (!list_info)
|
||||
return NULL;
|
||||
|
@ -202,7 +202,7 @@ void setting_data_get_label(char *type_str,
|
||||
size_t type_str_size, unsigned *w, unsigned type,
|
||||
const char *menu_label, const char *label, unsigned index);
|
||||
#endif
|
||||
rarch_setting_t* setting_data_get_list(void);
|
||||
rarch_setting_t* setting_data_get_list(bool need_refresh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user