diff --git a/gfx/drivers_context/win32_common.c b/gfx/drivers_context/win32_common.c index 8f823d5a4c..3f0090d827 100644 --- a/gfx/drivers_context/win32_common.c +++ b/gfx/drivers_context/win32_common.c @@ -55,6 +55,7 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam) WPARAM mode = wparam & 0xffff; unsigned cmd = RARCH_CMD_NONE; bool do_wm_close = false; + settings_t *settings = config_get_ptr(); switch (mode) { @@ -70,13 +71,13 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam) { extensions = "All Files\0*.*\0 Libretro core(.dll)\0*.dll\0"; title = "Load Core"; - initial_dir = g_settings.libretro_directory; + initial_dir = settings->libretro_directory; } else if (mode == ID_M_LOAD_CONTENT) { extensions = "All Files\0*.*\0\0"; title = "Load Content"; - initial_dir = g_settings.menu_content_directory; + initial_dir = settings->menu_content_directory; } if (win32_browser(owner, win32_file, extensions, title, initial_dir)) @@ -84,7 +85,7 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam) switch (mode) { case ID_M_LOAD_CORE: - strlcpy(g_settings.libretro, win32_file, sizeof(g_settings.libretro)); + strlcpy(settings->libretro, win32_file, sizeof(settings->libretro)); cmd = RARCH_CMD_LOAD_CORE; break; case ID_M_LOAD_CONTENT: @@ -145,12 +146,12 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam) else if (mode == ID_M_STATE_INDEX_AUTO) { signed idx = -1; - g_settings.state_slot = idx; + settings->state_slot = idx; } else if (mode >= (ID_M_STATE_INDEX_AUTO+1) && mode <= (ID_M_STATE_INDEX_AUTO+10)) { signed idx = (mode - (ID_M_STATE_INDEX_AUTO+1)); - g_settings.state_slot = idx; + settings->state_slot = idx; } break; } diff --git a/gfx/video_monitor.c b/gfx/video_monitor.c index 40b8c4d8ab..a48025107b 100644 --- a/gfx/video_monitor.c +++ b/gfx/video_monitor.c @@ -25,24 +25,25 @@ void video_monitor_adjust_system_rates(void) float timing_skew; const struct retro_system_timing *info = (const struct retro_system_timing*)&g_extern.system.av_info.timing; + settings_t *settings = config_get_ptr(); g_extern.system.force_nonblock = false; if (info->fps <= 0.0) return; - timing_skew = fabs(1.0f - info->fps / g_settings.video.refresh_rate); + timing_skew = fabs(1.0f - info->fps / settings->video.refresh_rate); /* We don't want to adjust pitch too much. If we have extreme cases, * just don't readjust at all. */ - if (timing_skew <= g_settings.audio.max_timing_skew) + if (timing_skew <= settings->audio.max_timing_skew) return; RARCH_LOG("Timings deviate too much. Will not adjust. (Display = %.2f Hz, Game = %.2f Hz)\n", - g_settings.video.refresh_rate, + settings->video.refresh_rate, (float)info->fps); - if (info->fps <= g_settings.video.refresh_rate) + if (info->fps <= settings->video.refresh_rate) return; /* We won't be able to do VSync reliably when game FPS > monitor FPS. */ @@ -59,11 +60,13 @@ void video_monitor_adjust_system_rates(void) void video_monitor_set_refresh_rate(float hz) { char msg[PATH_MAX_LENGTH]; + settings_t *settings = config_get_ptr(); + snprintf(msg, sizeof(msg), "Setting refresh rate to: %.3f Hz.", hz); rarch_main_msg_queue_push(msg, 1, 180, false); RARCH_LOG("%s\n", msg); - g_settings.video.refresh_rate = hz; + settings->video.refresh_rate = hz; } /** @@ -75,9 +78,10 @@ void video_monitor_compute_fps_statistics(void) { double avg_fps = 0.0, stddev = 0.0; unsigned samples = 0; - runloop_t *runloop = rarch_main_get_ptr(); + runloop_t *runloop = rarch_main_get_ptr(); + settings_t *settings = config_get_ptr(); - if (g_settings.video.threaded) + if (settings->video.threaded) { RARCH_LOG("Monitor FPS estimation is disabled for threaded video.\n"); return; @@ -118,14 +122,15 @@ bool video_monitor_fps_statistics(double *refresh_rate, double *deviation, unsigned *sample_points) { unsigned i; - retro_time_t accum = 0, avg, accum_var = 0; - unsigned samples = 0; - runloop_t *runloop = rarch_main_get_ptr(); + retro_time_t accum = 0, avg, accum_var = 0; + unsigned samples = 0; + runloop_t *runloop = rarch_main_get_ptr(); + settings_t *settings = config_get_ptr(); samples = min(MEASURE_FRAME_TIME_SAMPLES_COUNT, runloop->measure_data.frame_time_samples_count); - if (g_settings.video.threaded || (samples < 2)) + if (settings->video.threaded || (samples < 2)) return false; /* Measure statistics on frame time (microsecs), *not* FPS. */ diff --git a/gfx/video_state_tracker.c b/gfx/video_state_tracker.c index 92d427caf0..fe9a42a1ed 100644 --- a/gfx/video_state_tracker.c +++ b/gfx/video_state_tracker.c @@ -259,6 +259,7 @@ static void state_tracker_update_input(state_tracker_t *tracker) { unsigned i; uint16_t state[2] = {0}; + settings_t *settings = config_get_ptr(); static const unsigned buttons[] = { RETRO_DEVICE_ID_JOYPAD_R, @@ -286,11 +287,11 @@ static void state_tracker_update_input(state_tracker_t *tracker) return; for (i = 0; i < 2; i++) - input_push_analog_dpad(g_settings.input.binds[i], - g_settings.input.analog_dpad_mode[i]); + input_push_analog_dpad(settings->input.binds[i], + settings->input.analog_dpad_mode[i]); for (i = 0; i < MAX_USERS; i++) - input_push_analog_dpad(g_settings.input.autoconf_binds[i], - g_settings.input.analog_dpad_mode[i]); + input_push_analog_dpad(settings->input.autoconf_binds[i], + settings->input.analog_dpad_mode[i]); if (!driver->block_libretro_input) { @@ -306,9 +307,9 @@ static void state_tracker_update_input(state_tracker_t *tracker) } for (i = 0; i < 2; i++) - input_pop_analog_dpad(g_settings.input.binds[i]); + input_pop_analog_dpad(settings->input.binds[i]); for (i = 0; i < MAX_USERS; i++) - input_pop_analog_dpad(g_settings.input.autoconf_binds[i]); + input_pop_analog_dpad(settings->input.autoconf_binds[i]); for (i = 0; i < 2; i++) tracker->input_state[i] = state[i]; diff --git a/gfx/video_texture.c b/gfx/video_texture.c index 33a3e195d2..e567b779c9 100644 --- a/gfx/video_texture.c +++ b/gfx/video_texture.c @@ -83,7 +83,9 @@ unsigned video_texture_load(void *data, enum texture_backend_type type, enum texture_filter_type filter_type) { - if (g_settings.video.threaded + settings_t *settings = config_get_ptr(); + + if (settings->video.threaded && !g_extern.system.hw_render_callback.context_type) { driver_t *driver = driver_get_ptr(); diff --git a/input/input_autodetect.c b/input/input_autodetect.c index 444e0bf5b0..d6bdbe1cd0 100644 --- a/input/input_autodetect.c +++ b/input/input_autodetect.c @@ -47,6 +47,7 @@ static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf, int input_vid = 0, input_pid = 0; bool cond_found_idx, cond_found_general, cond_found_vid = false, cond_found_pid = false; + settings_t *settings = config_get_ptr(); if (!conf) return false; @@ -85,8 +86,8 @@ static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf, return false; found: - g_settings.input.autoconfigured[idx] = true; - input_autoconfigure_joypad_conf(conf, g_settings.input.autoconf_binds[idx]); + settings->input.autoconfigured[idx] = true; + input_autoconfigure_joypad_conf(conf, settings->input.autoconf_binds[idx]); snprintf(msg, sizeof(msg), "Joypad port #%u (%s) configured.", idx, name); @@ -105,29 +106,30 @@ void input_config_autoconfigure_joypad(unsigned idx, size_t i; bool internal_only, block_osd_spam; struct string_list *list = NULL; + settings_t *settings = config_get_ptr(); - if (!g_settings.input.autodetect_enable) + if (!settings->input.autodetect_enable) return; /* This will be the case if input driver is reinit. * No reason to spam autoconfigure messages * every time (fine in log). */ - block_osd_spam = g_settings.input.autoconfigured[idx] && name; + block_osd_spam = settings->input.autoconfigured[idx] && name; for (i = 0; i < RARCH_BIND_LIST_END; i++) { - g_settings.input.autoconf_binds[idx][i].joykey = NO_BTN; - g_settings.input.autoconf_binds[idx][i].joyaxis = AXIS_NONE; - g_settings.input.autoconf_binds[idx][i].joykey_label[0] = '\0'; - g_settings.input.autoconf_binds[idx][i].joyaxis_label[0] = '\0'; + settings->input.autoconf_binds[idx][i].joykey = NO_BTN; + settings->input.autoconf_binds[idx][i].joyaxis = AXIS_NONE; + settings->input.autoconf_binds[idx][i].joykey_label[0] = '\0'; + settings->input.autoconf_binds[idx][i].joyaxis_label[0] = '\0'; } - g_settings.input.autoconfigured[idx] = false; + settings->input.autoconfigured[idx] = false; if (!name) return; /* if false, load from both cfg files and internal */ - internal_only = !*g_settings.input.autoconfig_dir; + internal_only = !*settings->input.autoconfig_dir; #if defined(HAVE_BUILTIN_AUTOCONFIG) /* First internal */ @@ -148,7 +150,7 @@ void input_config_autoconfigure_joypad(unsigned idx, return; /* Now try files */ - list = dir_list_new(g_settings.input.autoconfig_dir, "cfg", false); + list = dir_list_new(settings->input.autoconfig_dir, "cfg", false); if (!list) return; @@ -172,9 +174,10 @@ void input_config_autoconfigure_joypad(unsigned idx, const struct retro_keybind *input_get_auto_bind(unsigned port, unsigned id) { - unsigned joy_idx = g_settings.input.joypad_map[port]; + settings_t *settings = config_get_ptr(); + unsigned joy_idx = settings->input.joypad_map[port]; if (joy_idx < MAX_USERS) - return &g_settings.input.autoconf_binds[joy_idx][id]; + return &settings->input.autoconf_binds[joy_idx][id]; return NULL; } diff --git a/input/input_common.c b/input/input_common.c index d4d077d2ab..4c9df8c504 100644 --- a/input/input_common.c +++ b/input/input_common.c @@ -329,6 +329,8 @@ void input_config_parse_joy_axis(config_file_t *conf, const char *prefix, static void input_get_bind_string_joykey(char *buf, const char *prefix, const struct retro_keybind *bind, size_t size) { + settings_t *settings = config_get_ptr(); + if (GET_HAT_DIR(bind->joykey)) { const char *dir; @@ -352,7 +354,7 @@ static void input_get_bind_string_joykey(char *buf, const char *prefix, break; } - if (bind->joykey_label[0] != '\0' && g_settings.input.autoconfig_descriptor_label_show) + if (bind->joykey_label[0] != '\0' && settings->input.autoconfig_descriptor_label_show) snprintf(buf, size, "%s %s ", prefix, bind->joykey_label); else snprintf(buf, size, "%sHat #%u %s ", prefix, @@ -360,7 +362,7 @@ static void input_get_bind_string_joykey(char *buf, const char *prefix, } else { - if (bind->joykey_label[0] != '\0' && g_settings.input.autoconfig_descriptor_label_show) + if (bind->joykey_label[0] != '\0' && settings->input.autoconfig_descriptor_label_show) snprintf(buf, size, "%s%s (btn) ", prefix, bind->joykey_label); else snprintf(buf, size, "%s%u (btn) ", prefix, (unsigned)bind->joykey); @@ -372,6 +374,7 @@ static void input_get_bind_string_joyaxis(char *buf, const char *prefix, { unsigned axis = 0; char dir = '\0'; + settings_t *settings = config_get_ptr(); if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE) { @@ -383,7 +386,7 @@ static void input_get_bind_string_joyaxis(char *buf, const char *prefix, dir = '+'; axis = AXIS_POS_GET(bind->joyaxis); } - if (bind->joyaxis_label[0] != '\0' && g_settings.input.autoconfig_descriptor_label_show) + if (bind->joyaxis_label[0] != '\0' && settings->input.autoconfig_descriptor_label_show) snprintf(buf, size, "%s%s (axis) ", prefix, bind->joyaxis_label); else snprintf(buf, size, "%s%c%u (axis) ", prefix, dir, axis); diff --git a/input/input_driver.c b/input/input_driver.c index 7ac11f86d0..5f1227fe97 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -145,8 +145,9 @@ const char* config_get_input_driver_options(void) void find_input_driver(void) { - int i = find_driver_index("input_driver", g_settings.input.driver); driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); + int i = find_driver_index("input_driver", settings->input.driver); if (i >= 0) driver->input = (const input_driver_t*)input_driver_find_handle(i); @@ -154,7 +155,7 @@ void find_input_driver(void) { unsigned d; RARCH_ERR("Couldn't find any input driver named \"%s\"\n", - g_settings.input.driver); + settings->input.driver); RARCH_LOG_OUTPUT("Available input drivers are:\n"); for (d = 0; input_driver_find_handle(d); d++) RARCH_LOG_OUTPUT("\t%s\n", input_driver_find_ident(d)); diff --git a/input/input_joypad.c b/input/input_joypad.c index 148798433b..ee5d7850c1 100644 --- a/input/input_joypad.c +++ b/input/input_joypad.c @@ -55,7 +55,8 @@ const char *input_joypad_name(const rarch_joypad_driver_t *drv, bool input_joypad_set_rumble(const rarch_joypad_driver_t *drv, unsigned port, enum retro_rumble_effect effect, uint16_t strength) { - unsigned joy_idx = g_settings.input.joypad_map[port]; + settings_t *settings = config_get_ptr(); + unsigned joy_idx = settings->input.joypad_map[port]; if (!drv || !drv->set_rumble) return false; @@ -90,7 +91,8 @@ bool input_joypad_pressed( uint32_t joyaxis; uint64_t joykey; const struct retro_keybind *auto_binds = NULL; - unsigned joy_idx = g_settings.input.joypad_map[port]; + settings_t *settings = config_get_ptr(); + unsigned joy_idx = settings->input.joypad_map[port]; if (joy_idx >= MAX_USERS) return false; @@ -98,7 +100,7 @@ bool input_joypad_pressed( return false; /* Auto-binds are per joypad, not per user. */ - auto_binds = g_settings.input.autoconf_binds[joy_idx]; + auto_binds = settings->input.autoconf_binds[joy_idx]; joykey = binds[key].joykey; if (joykey == NO_BTN) @@ -113,7 +115,7 @@ bool input_joypad_pressed( axis = drv->axis(joy_idx, joyaxis); scaled_axis = (float)abs(axis) / 0x8000; - return scaled_axis > g_settings.input.axis_threshold; + return scaled_axis > settings->input.axis_threshold; } /** @@ -147,7 +149,8 @@ int16_t input_joypad_analog(const rarch_joypad_driver_t *drv, const struct retro_keybind *auto_binds = NULL; const struct retro_keybind *bind_minus = NULL; const struct retro_keybind *bind_plus = NULL; - unsigned joy_idx = g_settings.input.joypad_map[port]; + settings_t *settings = config_get_ptr(); + unsigned joy_idx = settings->input.joypad_map[port]; if (!drv) return 0; @@ -156,7 +159,7 @@ int16_t input_joypad_analog(const rarch_joypad_driver_t *drv, return 0; /* Auto-binds are per joypad, not per user. */ - auto_binds = g_settings.input.autoconf_binds[joy_idx]; + auto_binds = settings->input.autoconf_binds[joy_idx]; input_conv_analog_id_to_bind_id(idx, ident, &ident_minus, &ident_plus); diff --git a/input/input_remapping.c b/input/input_remapping.c index 3494527e1d..32e401c4fd 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -31,13 +31,14 @@ bool input_remapping_load_file(const char *path) { unsigned i, j; - config_file_t *conf = config_file_new(path); + config_file_t *conf = config_file_new(path); + settings_t *settings = config_get_ptr(); if (!conf) return false; - strlcpy(g_settings.input.remapping_path, path, - sizeof(g_settings.input.remapping_path)); + strlcpy(settings->input.remapping_path, path, + sizeof(settings->input.remapping_path)); for (i = 0; i < MAX_USERS; i++) { @@ -54,7 +55,7 @@ bool input_remapping_load_file(const char *path) snprintf(key_ident[j], sizeof(key_ident[j]), "%s_%s", buf, key_strings[j]); if (config_get_int(conf, key_ident[j], &key_remap)) - g_settings.input.remap_ids[i][j] = key_remap; + settings->input.remap_ids[i][j] = key_remap; } } @@ -75,8 +76,9 @@ void input_remapping_save_file(const char *path) char buf[PATH_MAX_LENGTH]; char remap_file[PATH_MAX_LENGTH]; config_file_t *conf = NULL; + settings_t *settings = config_get_ptr(); - fill_pathname_join(buf, g_settings.input_remapping_directory, + fill_pathname_join(buf, settings->input_remapping_directory, path, sizeof(buf)); fill_pathname_noext(remap_file, buf, ".rmp", sizeof(remap_file)); @@ -89,7 +91,7 @@ void input_remapping_save_file(const char *path) if (!conf) return; - for (i = 0; i < g_settings.input.max_users; i++) + for (i = 0; i < settings->input.max_users; i++) { char key_ident[RARCH_FIRST_META_KEY][128]; char key_strings[RARCH_FIRST_META_KEY][128] = { "b", "y", "select", "start", @@ -100,7 +102,7 @@ void input_remapping_save_file(const char *path) for (j = 0; j < RARCH_FIRST_META_KEY; j++) { snprintf(key_ident[j], sizeof(key_ident[j]), "%s_%s", buf, key_strings[j]); - config_set_int(conf, key_ident[j], g_settings.input.remap_ids[i][j]); + config_set_int(conf, key_ident[j], settings->input.remap_ids[i][j]); } } @@ -111,10 +113,11 @@ void input_remapping_save_file(const char *path) void input_remapping_set_defaults(void) { unsigned i, j; + settings_t *settings = config_get_ptr(); for (i = 0; i < MAX_USERS; i++) { for (j = 0; j < RARCH_BIND_LIST_END; j++) - g_settings.input.remap_ids[i][j] = g_settings.input.binds[i][j].id; + settings->input.remap_ids[i][j] = settings->input.binds[i][j].id; } } diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index a5687d2d30..418b693b0f 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -94,11 +94,12 @@ int cb_core_updater_download(void *data_, size_t len) const char* file_ext = NULL; char output_path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH]; char *data = (char*)data_; + settings_t *settings = config_get_ptr(); if (!data) return -1; - fill_pathname_join(output_path, g_settings.libretro_directory, + fill_pathname_join(output_path, settings->libretro_directory, core_updater_path, sizeof(output_path)); f = fopen(output_path, "wb"); @@ -117,14 +118,14 @@ int cb_core_updater_download(void *data_, size_t len) #ifdef HAVE_ZLIB file_ext = path_get_extension(output_path); - if (!g_settings.network.buildbot_auto_extract_archive) + if (!settings->network.buildbot_auto_extract_archive) return 0; if (!strcasecmp(file_ext,"zip")) { if (!zlib_parse_file(output_path, NULL, zlib_extract_core_callback, - (void*)g_settings.libretro_directory)) + (void*)settings->libretro_directory)) RARCH_LOG("Could not process ZIP file.\n"); } #endif diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index d1492860f5..9a70de2f50 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -131,7 +131,8 @@ static int deferred_push_core_information(void *data, void *userdata, core_info_t *info = NULL; file_list_t *list = (file_list_t*)data; file_list_t *menu_list = (file_list_t*)userdata; - driver_t *driver = driver_get_ptr(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!list || !menu_list) return -1; @@ -218,7 +219,7 @@ static int deferred_push_core_information(void *data, void *userdata, { core_info_list_update_missing_firmware( g_extern.core_info, info->path, - g_settings.system_directory); + settings->system_directory); menu_list_push(list, "Firmware: ", "", MENU_SETTINGS_CORE_INFO_NONE, 0); @@ -278,11 +279,12 @@ static int deferred_push_rdb_entry_detail(void *data, void *userdata, char path_rdl[PATH_MAX_LENGTH], path_base[PATH_MAX_LENGTH]; unsigned i, j; database_info_list_t *db_info = NULL; - file_list_t *list = NULL; - file_list_t *menu_list = NULL; - struct string_list *str_list = NULL; - menu_handle_t *menu = menu_driver_resolve(); - driver_t *driver = driver_get_ptr(); + file_list_t *list = NULL; + file_list_t *menu_list = NULL; + struct string_list *str_list = NULL; + menu_handle_t *menu = menu_driver_resolve(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -315,7 +317,7 @@ static int deferred_push_rdb_entry_detail(void *data, void *userdata, path_remove_extension(path_base); strlcat(path_base, ".rdl", sizeof(path_base)); - fill_pathname_join(path_rdl, g_settings.content_database, path_base, + fill_pathname_join(path_rdl, settings->content_database, path_base, sizeof(path_rdl)); menu_database_realloc(path_rdl, false); @@ -624,6 +626,7 @@ static int deferred_push_cursor_manager_list_deferred(void *data, void *userdata file_list_t *list = NULL; file_list_t *menu_list = NULL; menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -646,7 +649,7 @@ static int deferred_push_cursor_manager_list_deferred(void *data, void *userdata if (!config_get_string(conf, "rdb", &rdb)) return -1; - fill_pathname_join(rdb_path, g_settings.content_database, + fill_pathname_join(rdb_path, settings->content_database, rdb, sizeof(rdb_path)); menu_database_populate_query(list, rdb_path, query); @@ -861,7 +864,7 @@ static int deferred_push_core_information(void *data, void *userdata, { core_info_list_update_missing_firmware( g_extern.core_info, info->path, - g_settings.system_directory); + settings->system_directory); menu_list_push(list, "Firmware: ", "", MENU_SETTINGS_CORE_INFO_NONE, 0); @@ -995,10 +998,11 @@ static int deferred_push_settings(void *data, void *userdata, const char *path, const char *label, unsigned type) { rarch_setting_t *setting = NULL; - file_list_t *list = NULL; - file_list_t *menu_list = NULL; - menu_handle_t *menu = menu_driver_resolve(); - driver_t *driver = driver_get_ptr(); + file_list_t *list = NULL; + file_list_t *menu_list = NULL; + menu_handle_t *menu = menu_driver_resolve(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -1016,7 +1020,7 @@ static int deferred_push_settings(void *data, void *userdata, menu_list_clear(list); - if (g_settings.menu.collapse_subgroups_enable) + if (settings->menu.collapse_subgroups_enable) { for (; setting->type != ST_NONE; setting++) { @@ -1417,7 +1421,8 @@ static int deferred_push_core_input_remapping_options(void *data, void *userdata { unsigned p, retro_id; file_list_t *list = (file_list_t*)data; - driver_t *driver = driver_get_ptr(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); (void)userdata; (void)type; @@ -1431,7 +1436,7 @@ static int deferred_push_core_input_remapping_options(void *data, void *userdata menu_list_push(list, "Remap File Save As", "remap_file_save_as", MENU_SETTING_ACTION, 0); - for (p = 0; p < g_settings.input.max_users; p++) + for (p = 0; p < settings->input.max_users; p++) { for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++) { @@ -1701,14 +1706,16 @@ int deferred_push_content_list(void *data, void *userdata, static int deferred_push_database_manager_list(void *data, void *userdata, const char *path, const char *label, unsigned type) { - return menu_entries_parse_list((file_list_t*)data, (file_list_t*)userdata, g_settings.content_database, label, type, + settings_t *settings = config_get_ptr(); + return menu_entries_parse_list((file_list_t*)data, (file_list_t*)userdata, settings->content_database, label, type, MENU_FILE_RDB, "rdb", NULL); } static int deferred_push_cursor_manager_list(void *data, void *userdata, const char *path, const char *label, unsigned type) { - return menu_entries_parse_list((file_list_t*)data, (file_list_t*)userdata, g_settings.cursor_directory, label, type, + settings_t *settings = config_get_ptr(); + return menu_entries_parse_list((file_list_t*)data, (file_list_t*)userdata, settings->cursor_directory, label, type, MENU_FILE_CURSOR, "dbc", NULL); } @@ -1849,6 +1856,8 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, const char *elem0, const char *elem1) { + settings_t *settings = config_get_ptr(); + if (!cbs) return; @@ -1858,7 +1867,7 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, { if (menu_entries_common_is_settings_entry(elem0)) { - if (!g_settings.menu.collapse_subgroups_enable) + if (!settings->menu.collapse_subgroups_enable) { cbs->action_deferred_push = deferred_push_settings_subgroup; return; diff --git a/menu/menu_entries_cbs_iterate.c b/menu/menu_entries_cbs_iterate.c index 28668f6d8d..01a4955a2a 100644 --- a/menu/menu_entries_cbs_iterate.c +++ b/menu/menu_entries_cbs_iterate.c @@ -68,8 +68,9 @@ static int archive_load(void) const char *menu_path = NULL; const char *menu_label = NULL; const char* path = NULL; - unsigned int type = 0; - menu_handle_t *menu = menu_driver_resolve(); + unsigned int type = 0; + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -97,7 +98,7 @@ static int archive_load(void) case 0: menu_list_push_stack_refresh( menu->menu_list, - g_settings.libretro_directory, + settings->libretro_directory, "deferred_core_list", 0, menu->navigation.selection_ptr); @@ -159,10 +160,12 @@ static int mouse_post_iterate(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, unsigned action) { menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; - if (!g_settings.menu.mouse.enable) + if (!settings->menu.mouse.enable) { menu->mouse.wheeldown = false; menu->mouse.wheelup = false; @@ -242,7 +245,8 @@ static int action_iterate_help(const char *label, unsigned action) char desc[ARRAY_SIZE(binds)][64]; char msg[PATH_MAX_LENGTH]; menu_handle_t *menu = menu_driver_resolve(); - driver_t *driver = driver_get_ptr(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return 0; @@ -253,7 +257,7 @@ static int action_iterate_help(const char *label, unsigned action) for (i = 0; i < ARRAY_SIZE(binds); i++) { const struct retro_keybind *keybind = (const struct retro_keybind*) - &g_settings.input.binds[0][binds[i]]; + &settings->input.binds[0][binds[i]]; const struct retro_keybind *auto_bind = (const struct retro_keybind*) input_get_auto_bind(0, binds[i]); @@ -352,7 +356,9 @@ static int action_iterate_info(const char *label, unsigned action) static int action_iterate_load_open_zip(const char *label, unsigned action) { - switch (g_settings.archive.mode) + settings_t *settings = config_get_ptr(); + + switch (settings->archive.mode) { case 0: return load_or_open_zip_iterate(action); @@ -377,6 +383,8 @@ static int action_iterate_menu_viewport(const char *label, unsigned action) video_viewport_t *custom = &g_extern.console.screen.viewports.custom_vp; menu_handle_t *menu = menu_driver_resolve(); driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; @@ -384,7 +392,7 @@ static int action_iterate_menu_viewport(const char *label, unsigned action) geom = (struct retro_game_geometry*)&g_extern.system.av_info.geometry; - if (g_settings.video.scale_integer) + if (settings->video.scale_integer) { stride_x = geom->base_width; stride_y = geom->base_height; @@ -457,7 +465,7 @@ static int action_iterate_menu_viewport(const char *label, unsigned action) menu_list_pop_stack(menu->menu_list); if (type == MENU_SETTINGS_CUSTOM_VIEWPORT - && !g_settings.video.scale_integer) + && !settings->video.scale_integer) { menu_list_push_stack(menu->menu_list, "", "custom_viewport_2", 0, menu->navigation.selection_ptr); @@ -465,7 +473,7 @@ static int action_iterate_menu_viewport(const char *label, unsigned action) break; case MENU_ACTION_START: - if (!g_settings.video.scale_integer) + if (!settings->video.scale_integer) { video_viewport_t vp; @@ -503,7 +511,7 @@ static int action_iterate_menu_viewport(const char *label, unsigned action) if (driver->video_data && driver->menu_ctx && driver->menu_ctx->render) driver->menu_ctx->render(); - if (g_settings.video.scale_integer) + if (settings->video.scale_integer) { custom->x = 0; custom->y = 0; @@ -591,10 +599,12 @@ static int mouse_iterate(unsigned *action) menu_handle_t *menu = menu_driver_resolve(); runloop_t *runloop = rarch_main_get_ptr(); driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; - if (!g_settings.menu.mouse.enable) + if (!settings->menu.mouse.enable) { menu->mouse.left = 0; menu->mouse.right = 0; diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 979501d415..ad977a4cd0 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -118,14 +118,15 @@ extern size_t hack_shader_pass; static int action_ok_shader_pass(const char *path, const char *label, unsigned type, size_t idx) { - hack_shader_pass = type - MENU_SETTINGS_SHADER_PASS_0; - menu_handle_t *menu = menu_driver_resolve(); + hack_shader_pass = type - MENU_SETTINGS_SHADER_PASS_0; + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; return menu_list_push_stack_refresh( menu->menu_list, - g_settings.video.shader_dir, + settings->video.shader_dir, label, type, idx); @@ -173,44 +174,53 @@ static int action_ok_push_default(const char *path, static int action_ok_shader_preset(const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; + return menu_list_push_stack_refresh( menu->menu_list, - g_settings.video.shader_dir, + settings->video.shader_dir, label, type, idx); } static int action_ok_push_content_list(const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; + return menu_list_push_stack_refresh( menu->menu_list, - g_settings.menu_content_directory, + settings->menu_content_directory, label, MENU_FILE_DIRECTORY, idx); } static int action_ok_disk_image_append_list(const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; return menu_list_push_stack_refresh( menu->menu_list, - g_settings.menu_content_directory, label, type, + settings->menu_content_directory, label, type, idx); } static int action_ok_configurations_list(const char *path, const char *label, unsigned type, size_t idx) { - const char *dir = g_settings.menu_config_directory; - menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + menu_handle_t *menu = menu_driver_resolve(); + const char *dir = settings->menu_config_directory; if (!menu) return -1; @@ -223,13 +233,14 @@ static int action_ok_configurations_list(const char *path, static int action_ok_cheat_file(const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; return menu_list_push_stack_refresh( menu->menu_list, - g_settings.cheat_database, + settings->cheat_database, label, type, idx); } @@ -242,13 +253,14 @@ static int action_ok_audio_dsp_plugin(const char *path, static int action_ok_video_filter(const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; return menu_list_push_stack_refresh( menu->menu_list, - g_settings.video.filter_dir, + settings->video.filter_dir, "deferred_video_filter", 0, idx); } @@ -257,8 +269,9 @@ static int action_ok_core_updater_list(const char *path, const char *label, unsigned type, size_t idx) { char url_path[PATH_MAX_LENGTH]; - menu_handle_t *menu = menu_driver_resolve(); - driver_t *driver = driver_get_ptr(); + menu_handle_t *menu = menu_driver_resolve(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -271,15 +284,13 @@ static int action_ok_core_updater_list(const char *path, core_updater_list_type = type; #endif - if (g_settings.network.buildbot_url[0] == '\0') - { + if (settings->network.buildbot_url[0] == '\0') return -1; - } #ifdef HAVE_NETWORKING rarch_main_command(RARCH_CMD_NETWORK_INIT); - fill_pathname_join(url_path, g_settings.network.buildbot_url, + fill_pathname_join(url_path, settings->network.buildbot_url, ".index", sizeof(url_path)); rarch_main_data_msg_queue_push(DATA_TYPE_HTTP, url_path, "cb_core_updater_list", 0, 1, @@ -294,26 +305,30 @@ static int action_ok_core_updater_list(const char *path, static int action_ok_remap_file(const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; return menu_list_push_stack_refresh( menu->menu_list, - g_settings.input_remapping_directory, + settings->input_remapping_directory, label, type, idx); } static int action_ok_core_list(const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; return menu_list_push_stack_refresh( menu->menu_list, - g_settings.libretro_directory, + settings->libretro_directory, label, type, idx); } @@ -343,9 +358,11 @@ static int action_ok_remap_file_load(const char *path, static int action_ok_video_filter_file_load(const char *path, const char *label, unsigned type, size_t idx) { - const char *menu_path = NULL; char filter_path[PATH_MAX_LENGTH]; - menu_handle_t *menu = menu_driver_resolve(); + const char *menu_path = NULL; + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; @@ -357,8 +374,8 @@ static int action_ok_video_filter_file_load(const char *path, fill_pathname_join(filter_path, menu_path, path, sizeof(filter_path)); - strlcpy(g_settings.video.softfilter_plugin, filter_path, - sizeof(g_settings.video.softfilter_plugin)); + strlcpy(settings->video.softfilter_plugin, filter_path, + sizeof(settings->video.softfilter_plugin)); rarch_main_command(RARCH_CMD_REINIT); @@ -399,11 +416,12 @@ static int action_ok_cheat_file_load(const char *path, static int action_ok_menu_wallpaper_load(const char *path, const char *label, unsigned type, size_t idx) { - const char *menu_label = NULL; - const char *menu_path = NULL; - rarch_setting_t *setting = NULL; char wallpaper_path[PATH_MAX_LENGTH]; - menu_handle_t *menu = menu_driver_resolve(); + const char *menu_label = NULL; + const char *menu_path = NULL; + rarch_setting_t *setting = NULL; + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -419,7 +437,7 @@ static int action_ok_menu_wallpaper_load(const char *path, if (path_file_exists(wallpaper_path)) { - strlcpy(g_settings.menu.wallpaper, wallpaper_path, sizeof(g_settings.menu.wallpaper)); + strlcpy(settings->menu.wallpaper, wallpaper_path, sizeof(settings->menu.wallpaper)); rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE, wallpaper_path, "cb_menu_wallpaper", 0, 1, true); @@ -518,12 +536,14 @@ static int action_ok_path_use_directory(const char *path, static int action_ok_core_load_deferred(const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; if (path) - strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro)); + strlcpy(settings->libretro, path, sizeof(settings->libretro)); strlcpy(g_extern.fullpath, menu->deferred_path, sizeof(g_extern.fullpath)); @@ -566,15 +586,17 @@ static int action_ok_core_load(const char *path, const char *label, unsigned type, size_t idx) { const char *menu_path = NULL; - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; menu_list_get_last_stack(menu->menu_list, &menu_path, NULL, NULL); - fill_pathname_join(g_settings.libretro, menu_path, path, - sizeof(g_settings.libretro)); + fill_pathname_join(settings->libretro, menu_path, path, + sizeof(settings->libretro)); rarch_main_command(RARCH_CMD_LOAD_CORE); menu_list_flush_stack(menu->menu_list, MENU_SETTINGS); #if defined(HAVE_DYNAMIC) @@ -645,7 +667,9 @@ static int action_ok_database_manager_list(const char *path, const char *label, unsigned type, size_t idx) { char rdb_path[PATH_MAX_LENGTH]; - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); + if (!menu) return -1; if (!path) @@ -653,7 +677,7 @@ static int action_ok_database_manager_list(const char *path, if (!label) return -1; - fill_pathname_join(rdb_path, g_settings.content_database, + fill_pathname_join(rdb_path, settings->content_database, path, sizeof(rdb_path)); return menu_list_push_stack_refresh( @@ -667,12 +691,13 @@ static int action_ok_cursor_manager_list(const char *path, const char *label, unsigned type, size_t idx) { char cursor_path[PATH_MAX_LENGTH]; - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; - fill_pathname_join(cursor_path, g_settings.cursor_directory, + fill_pathname_join(cursor_path, settings->cursor_directory, path, sizeof(cursor_path)); return menu_list_push_stack_refresh( @@ -734,7 +759,8 @@ static int action_ok_file_load_with_detect_core(const char *path, { int ret; const char *menu_path = NULL; - menu_handle_t *menu = menu_driver_resolve(); + menu_handle_t *menu = menu_driver_resolve(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -756,7 +782,7 @@ static int action_ok_file_load_with_detect_core(const char *path, if (ret == 0) menu_list_push_stack_refresh( menu->menu_list, - g_settings.libretro_directory, + settings->libretro_directory, "deferred_core_list", 0, idx); @@ -831,8 +857,9 @@ static int action_ok_custom_viewport(const char *path, { /* Start with something sane. */ video_viewport_t *custom = &g_extern.console.screen.viewports.custom_vp; - menu_handle_t *menu = menu_driver_resolve(); - driver_t *driver = driver_get_ptr(); + menu_handle_t *menu = menu_driver_resolve(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -852,7 +879,7 @@ static int action_ok_custom_viewport(const char *path, aspectratio_lut[ASPECT_RATIO_CUSTOM].value = (float)custom->width / custom->height; - g_settings.video.aspect_ratio_idx = ASPECT_RATIO_CUSTOM; + settings->video.aspect_ratio_idx = ASPECT_RATIO_CUSTOM; rarch_main_command(RARCH_CMD_VIDEO_SET_ASPECT_RATIO); return 0; @@ -889,8 +916,9 @@ static int action_ok_core_updater_download(const char *path, { #ifdef HAVE_NETWORKING char core_path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH]; + settings_t *settings = config_get_ptr(); - fill_pathname_join(core_path, g_settings.network.buildbot_url, + fill_pathname_join(core_path, settings->network.buildbot_url, path, sizeof(core_path)); strlcpy(core_updater_path, path, sizeof(core_updater_path)); diff --git a/menu/menu_entries_cbs_representation.c b/menu/menu_entries_cbs_representation.c index b5d255288e..2ac21ed070 100644 --- a/menu/menu_entries_cbs_representation.c +++ b/menu/menu_entries_cbs_representation.c @@ -45,9 +45,11 @@ static void menu_action_setting_disp_set_label_remap_file_load( const char *path, char *path_buf, size_t path_buf_size) { + settings_t *settings = config_get_ptr(); + *w = 19; strlcpy(path_buf, path, path_buf_size); - fill_pathname_base(type_str, g_settings.input.remapping_path, + fill_pathname_base(type_str, settings->input.remapping_path, type_str_size); } @@ -116,13 +118,15 @@ static void menu_action_setting_disp_set_label_filter( const char *path, char *path_buf, size_t path_buf_size) { + settings_t *settings = config_get_ptr(); + *type_str = '\0'; *w = 19; strlcpy(path_buf, path, path_buf_size); strlcpy(type_str, "N/A", type_str_size); - if (*g_settings.video.softfilter_plugin) - strlcpy(type_str, path_basename(g_settings.video.softfilter_plugin), + if (*settings->video.softfilter_plugin) + strlcpy(type_str, path_basename(settings->video.softfilter_plugin), type_str_size); } @@ -188,10 +192,12 @@ static void menu_action_setting_disp_set_label_shader_default_filter( const char *path, char *path_buf, size_t path_buf_size) { + settings_t *settings = config_get_ptr(); + *type_str = '\0'; *w = 19; snprintf(type_str, type_str_size, "%s", - g_settings.video.smooth ? "Linear" : "Nearest"); + settings->video.smooth ? "Linear" : "Nearest"); } static void menu_action_setting_disp_set_label_shader_parameter( @@ -333,16 +339,17 @@ static void menu_action_setting_disp_set_label_input_desc( const char *path, char *path_buf, size_t path_buf_size) { + settings_t *settings = config_get_ptr(); unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN; unsigned inp_desc_user = inp_desc_index_offset / RARCH_FIRST_CUSTOM_BIND; unsigned inp_desc_button_index_offset = inp_desc_index_offset - (inp_desc_user * RARCH_FIRST_CUSTOM_BIND); - unsigned remap_id = g_settings.input.remap_ids + unsigned remap_id = settings->input.remap_ids [inp_desc_user][inp_desc_button_index_offset]; snprintf(type_str, type_str_size, "%s", - g_settings.input.binds[inp_desc_user][remap_id].desc); + settings->input.binds[inp_desc_user][remap_id].desc); *w = 19; strlcpy(path_buf, path, path_buf_size); } diff --git a/menu/menu_entries_cbs_start.c b/menu/menu_entries_cbs_start.c index b913d5eac3..5464be51f1 100644 --- a/menu/menu_entries_cbs_start.c +++ b/menu/menu_entries_cbs_start.c @@ -27,7 +27,9 @@ static int action_start_remap_file_load(unsigned type, const char *label, unsigned action) { - g_settings.input.remapping_path[0] = '\0'; + settings_t *settings = config_get_ptr(); + + settings->input.remapping_path[0] = '\0'; input_remapping_set_defaults(); return 0; } @@ -35,7 +37,9 @@ static int action_start_remap_file_load(unsigned type, const char *label, static int action_start_video_filter_file_load(unsigned type, const char *label, unsigned action) { - g_settings.video.softfilter_plugin[0] = '\0'; + settings_t *settings = config_get_ptr(); + + settings->video.softfilter_plugin[0] = '\0'; rarch_main_command(RARCH_CMD_REINIT); return 0; } @@ -62,6 +66,7 @@ static int action_start_performance_counters_core(unsigned type, const char *lab static int action_start_input_desc(unsigned type, const char *label, unsigned action) { + settings_t *settings = config_get_ptr(); unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN; unsigned inp_desc_user = inp_desc_index_offset / RARCH_FIRST_CUSTOM_BIND; unsigned inp_desc_button_index_offset = inp_desc_index_offset - (inp_desc_user * RARCH_FIRST_CUSTOM_BIND); @@ -69,8 +74,8 @@ static int action_start_input_desc(unsigned type, const char *label, (void)label; (void)action; - g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset] = - g_settings.input.binds[inp_desc_user][inp_desc_button_index_offset].id; + settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] = + settings->input.binds[inp_desc_user][inp_desc_button_index_offset].id; return 0; } diff --git a/menu/menu_entries_cbs_toggle.c b/menu/menu_entries_cbs_toggle.c index dbd2db3d18..d182f8afbe 100644 --- a/menu/menu_entries_cbs_toggle.c +++ b/menu/menu_entries_cbs_toggle.c @@ -117,20 +117,17 @@ static int action_toggle_input_desc(unsigned type, const char *label, unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN; unsigned inp_desc_user = inp_desc_index_offset / RARCH_FIRST_CUSTOM_BIND; unsigned inp_desc_button_index_offset = inp_desc_index_offset - (inp_desc_user * RARCH_FIRST_CUSTOM_BIND); + settings_t *settings = config_get_ptr(); switch (action) { case MENU_ACTION_LEFT: - if (g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset] > 0) - { - g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset]--; - } + if (settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] > 0) + settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset]--; break; case MENU_ACTION_RIGHT: - if (g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset] < RARCH_FIRST_CUSTOM_BIND) - { - g_settings.input.remap_ids[inp_desc_user][inp_desc_button_index_offset]++; - } + if (settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] < RARCH_FIRST_CUSTOM_BIND) + settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset]++; break; } @@ -140,17 +137,17 @@ static int action_toggle_input_desc(unsigned type, const char *label, static int action_toggle_save_state(unsigned type, const char *label, unsigned action, bool wraparound) { + settings_t *settings = config_get_ptr(); + switch (action) { case MENU_ACTION_LEFT: /* Slot -1 is (auto) slot. */ - if (g_settings.state_slot >= 0) - { - g_settings.state_slot--; - } + if (settings->state_slot >= 0) + settings->state_slot--; break; case MENU_ACTION_RIGHT: - g_settings.state_slot++; + settings->state_slot++; break; } diff --git a/menu/menu_navigation.c b/menu/menu_navigation.c index 31dd26af19..e1621999af 100644 --- a/menu/menu_navigation.c +++ b/menu/menu_navigation.c @@ -47,7 +47,8 @@ void menu_navigation_clear(menu_navigation_t *nav, bool pending_push) **/ void menu_navigation_decrement(menu_navigation_t *nav, unsigned scroll_speed) { - driver_t *driver = driver_get_ptr(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!nav) return; @@ -57,7 +58,7 @@ void menu_navigation_decrement(menu_navigation_t *nav, unsigned scroll_speed) nav->selection_ptr - scroll_speed, true); else { - if (g_settings.menu.navigation.wraparound.vertical_enable) + if (settings->menu.navigation.wraparound.vertical_enable) menu_navigation_set(nav, menu_list_get_size(driver->menu->menu_list) - 1, true); else @@ -75,7 +76,9 @@ void menu_navigation_decrement(menu_navigation_t *nav, unsigned scroll_speed) **/ void menu_navigation_increment(menu_navigation_t *nav, unsigned scroll_speed) { - driver_t *driver = driver_get_ptr(); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); + if (!nav) return; @@ -84,7 +87,7 @@ void menu_navigation_increment(menu_navigation_t *nav, unsigned scroll_speed) nav->selection_ptr + scroll_speed, true); else { - if (g_settings.menu.navigation.wraparound.vertical_enable) + if (settings->menu.navigation.wraparound.vertical_enable) menu_navigation_clear(nav, false); else menu_navigation_set(nav, diff --git a/settings_data.c b/settings_data.c index b274c0d208..83c4de5fc1 100644 --- a/settings_data.c +++ b/settings_data.c @@ -3865,11 +3865,12 @@ static bool setting_data_append_list_video_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Video Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); - CONFIG_BOOL(g_settings.fps_show, + CONFIG_BOOL(settings->fps_show, "fps_show", "Show Framerate", fps_show, @@ -3881,7 +3882,7 @@ static bool setting_data_append_list_video_options( general_read_handler); CONFIG_BOOL( - g_settings.video.shared_context, + settings->video.shared_context, "video_shared_context", "HW Shared Context Enable", false, @@ -3897,7 +3898,7 @@ static bool setting_data_append_list_video_options( START_SUB_GROUP(list, list_info, "Monitor", group_info.name, subgroup_info); CONFIG_UINT( - g_settings.video.monitor_index, + settings->video.monitor_index, "video_monitor_index", "Monitor Index", monitor_index, @@ -3913,7 +3914,7 @@ static bool setting_data_append_list_video_options( #if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE) CONFIG_BOOL( - g_settings.video.fullscreen, + settings->video.fullscreen, "video_fullscreen", "Use Fullscreen mode", fullscreen, @@ -3927,7 +3928,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO); #endif CONFIG_BOOL( - g_settings.video.windowed_fullscreen, + settings->video.windowed_fullscreen, "video_windowed_fullscreen", "Windowed Fullscreen Mode", windowed_fullscreen, @@ -3939,7 +3940,7 @@ static bool setting_data_append_list_video_options( general_read_handler); CONFIG_UINT( - g_settings.video.fullscreen_x, + settings->video.fullscreen_x, "video_fullscreen_x", "Fullscreen Width", fullscreen_x, @@ -3950,7 +3951,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_UINT( - g_settings.video.fullscreen_y, + settings->video.fullscreen_y, "video_fullscreen_y", "Fullscreen Height", fullscreen_y, @@ -3961,7 +3962,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_FLOAT( - g_settings.video.refresh_rate, + settings->video.refresh_rate, "video_refresh_rate", "Refresh Rate", refresh_rate, @@ -3973,7 +3974,7 @@ static bool setting_data_append_list_video_options( settings_list_current_add_range(list, list_info, 0, 0, 0.001, true, false); CONFIG_FLOAT( - g_settings.video.refresh_rate, + settings->video.refresh_rate, "video_refresh_rate_auto", "Estimated Monitor FPS", refresh_rate, @@ -3990,7 +3991,7 @@ static bool setting_data_append_list_video_options( &setting_data_get_string_representation_st_float_video_refresh_rate_auto; CONFIG_BOOL( - g_settings.video.force_srgb_disable, + settings->video.force_srgb_disable, "video_force_srgb_disable", "Force-disable sRGB FBO", false, @@ -4007,7 +4008,7 @@ static bool setting_data_append_list_video_options( START_SUB_GROUP(list, list_info, "Aspect", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.video.force_aspect, + settings->video.force_aspect, "video_force_aspect", "Force aspect ratio", force_aspect, @@ -4019,7 +4020,7 @@ static bool setting_data_append_list_video_options( general_read_handler); CONFIG_FLOAT( - g_settings.video.aspect_ratio, + settings->video.aspect_ratio, "video_aspect_ratio", "Aspect Ratio", aspect_ratio, @@ -4030,7 +4031,7 @@ static bool setting_data_append_list_video_options( general_read_handler); CONFIG_BOOL( - g_settings.video.aspect_ratio_auto, + settings->video.aspect_ratio_auto, "video_aspect_ratio_auto", "Use Auto Aspect Ratio", aspect_ratio_auto, @@ -4042,7 +4043,7 @@ static bool setting_data_append_list_video_options( general_read_handler); CONFIG_UINT( - g_settings.video.aspect_ratio_idx, + settings->video.aspect_ratio_idx, "aspect_ratio_index", "Aspect Ratio Index", aspect_ratio_idx, @@ -4072,7 +4073,7 @@ static bool setting_data_append_list_video_options( #if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE) CONFIG_FLOAT( - g_settings.video.scale, + settings->video.scale, "video_scale", "Windowed Scale", scale, @@ -4085,7 +4086,7 @@ static bool setting_data_append_list_video_options( #endif CONFIG_BOOL( - g_settings.video.scale_integer, + settings->video.scale_integer, "video_scale_integer", "Integer Scale", scale_integer, @@ -4142,7 +4143,7 @@ static bool setting_data_append_list_video_options( #ifdef GEKKO CONFIG_UINT( - g_settings.video.viwidth, + settings->video.viwidth, "video_viwidth", "Set Screen Width", video_viwidth, @@ -4153,7 +4154,7 @@ static bool setting_data_append_list_video_options( settings_list_current_add_range(list, list_info, 640, 720, 2, true, true); CONFIG_BOOL( - g_settings.video.vfilter, + settings->video.vfilter, "video_vfilter", "Deflicker", video_vfilter, @@ -4166,7 +4167,7 @@ static bool setting_data_append_list_video_options( #endif CONFIG_BOOL( - g_settings.video.smooth, + settings->video.smooth, "video_smooth", "Use Bilinear Filtering", video_smooth, @@ -4192,7 +4193,7 @@ static bool setting_data_append_list_video_options( #endif CONFIG_UINT( - g_settings.video.rotation, + settings->video.rotation, "video_rotation", "Rotation", 0, @@ -4241,7 +4242,7 @@ static bool setting_data_append_list_video_options( #if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) CONFIG_BOOL( - g_settings.video.threaded, + settings->video.threaded, "video_threaded", "Threaded Video", video_threaded, @@ -4256,7 +4257,7 @@ static bool setting_data_append_list_video_options( #endif CONFIG_BOOL( - g_settings.video.vsync, + settings->video.vsync, "video_vsync", "VSync", vsync, @@ -4268,7 +4269,7 @@ static bool setting_data_append_list_video_options( general_read_handler); CONFIG_UINT( - g_settings.video.swap_interval, + settings->video.swap_interval, "video_swap_interval", "VSync Swap Interval", swap_interval, @@ -4281,7 +4282,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO|SD_FLAG_ADVANCED); CONFIG_BOOL( - g_settings.video.hard_sync, + settings->video.hard_sync, "video_hard_sync", "Hard GPU Sync", hard_sync, @@ -4293,7 +4294,7 @@ static bool setting_data_append_list_video_options( general_read_handler); CONFIG_UINT( - g_settings.video.hard_sync_frames, + settings->video.hard_sync_frames, "video_hard_sync_frames", "Hard GPU Sync Frames", hard_sync_frames, @@ -4305,7 +4306,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_UINT( - g_settings.video.frame_delay, + settings->video.frame_delay, "video_frame_delay", "Frame Delay", frame_delay, @@ -4318,7 +4319,7 @@ static bool setting_data_append_list_video_options( #if !defined(RARCH_MOBILE) CONFIG_BOOL( - g_settings.video.black_frame_insertion, + settings->video.black_frame_insertion, "video_black_frame_insertion", "Black Frame Insertion", black_frame_insertion, @@ -4339,7 +4340,7 @@ static bool setting_data_append_list_video_options( subgroup_info); CONFIG_BOOL( - g_settings.video.post_filter_record, + settings->video.post_filter_record, "video_post_filter_record", "Post filter record Enable", post_filter_record, @@ -4352,7 +4353,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( - g_settings.video.gpu_record, + settings->video.gpu_record, "video_gpu_record", "GPU Record Enable", gpu_record, @@ -4365,7 +4366,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( - g_settings.video.gpu_screenshot, + settings->video.gpu_screenshot, "video_gpu_screenshot", "GPU Screenshot Enable", gpu_screenshot, @@ -4378,7 +4379,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( - g_settings.video.allow_rotate, + settings->video.allow_rotate, "video_allow_rotate", "Allow rotation", allow_rotate, @@ -4391,7 +4392,7 @@ static bool setting_data_append_list_video_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( - g_settings.video.crop_overscan, + settings->video.crop_overscan, "video_crop_overscan", "Crop Overscan (reload)", crop_overscan, @@ -4422,7 +4423,7 @@ static bool setting_data_append_list_video_options( #ifdef _XBOX1 CONFIG_UINT( - g_settings.video.swap_interval, + settings->video.swap_interval, "video_filter_flicker", "Flicker filter", 0, @@ -4444,12 +4445,13 @@ static bool setting_data_append_list_font_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Font Settings"); START_SUB_GROUP(list, list_info, "Messages", group_info.name, subgroup_info); CONFIG_PATH( - g_settings.video.font_path, + settings->video.font_path, "video_font_path", "Font Path", "", @@ -4460,7 +4462,7 @@ static bool setting_data_append_list_font_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY); CONFIG_FLOAT( - g_settings.video.font_size, + settings->video.font_size, "video_font_size", "OSD Font Size", font_size, @@ -4473,7 +4475,7 @@ static bool setting_data_append_list_font_options( #ifndef RARCH_CONSOLE CONFIG_BOOL( - g_settings.video.font_enable, + settings->video.font_enable, "video_font_enable", "OSD Font Enable", font_enable, @@ -4486,7 +4488,7 @@ static bool setting_data_append_list_font_options( #endif CONFIG_FLOAT( - g_settings.video.msg_pos_x, + settings->video.msg_pos_x, "video_message_pos_x", "Message X Position", message_pos_offset_x, @@ -4498,7 +4500,7 @@ static bool setting_data_append_list_font_options( settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true); CONFIG_FLOAT( - g_settings.video.msg_pos_y, + settings->video.msg_pos_y, "video_message_pos_y", "Message Y Position", message_pos_offset_y, @@ -4521,12 +4523,13 @@ static bool setting_data_append_list_audio_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Audio Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.audio.enable, + settings->audio.enable, "audio_enable", "Audio Enable", audio_enable, @@ -4538,7 +4541,7 @@ static bool setting_data_append_list_audio_options( general_read_handler); CONFIG_BOOL( - g_settings.audio.mute_enable, + settings->audio.mute_enable, "audio_mute_enable", "Audio Mute", false, @@ -4550,7 +4553,7 @@ static bool setting_data_append_list_audio_options( general_read_handler); CONFIG_FLOAT( - g_settings.audio.volume, + settings->audio.volume, "audio_volume", "Volume Level", audio_volume, @@ -4585,7 +4588,7 @@ static bool setting_data_append_list_audio_options( subgroup_info); CONFIG_BOOL( - g_settings.audio.sync, + settings->audio.sync, "audio_sync", "Audio Sync Enable", audio_sync, @@ -4598,7 +4601,7 @@ static bool setting_data_append_list_audio_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_UINT( - g_settings.audio.latency, + settings->audio.latency, "audio_latency", "Audio Latency", g_defaults.settings.out_latency ? @@ -4611,7 +4614,7 @@ static bool setting_data_append_list_audio_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DEFERRED|SD_FLAG_ADVANCED); CONFIG_FLOAT( - g_settings.audio.rate_control_delta, + settings->audio.rate_control_delta, "audio_rate_control_delta", "Audio Rate Control Delta", rate_control_delta, @@ -4631,7 +4634,7 @@ static bool setting_data_append_list_audio_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_FLOAT( - g_settings.audio.max_timing_skew, + settings->audio.max_timing_skew, "audio_max_timing_skew", "Audio Maximum Timing Skew", max_timing_skew, @@ -4651,7 +4654,7 @@ static bool setting_data_append_list_audio_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_UINT( - g_settings.audio.block_frames, + settings->audio.block_frames, "audio_block_frames", "Block Frames", 0, @@ -4671,7 +4674,7 @@ static bool setting_data_append_list_audio_options( subgroup_info); CONFIG_STRING( - g_settings.audio.device, + settings->audio.device, "audio_device", "Device", "", @@ -4682,7 +4685,7 @@ static bool setting_data_append_list_audio_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT | SD_FLAG_ADVANCED); CONFIG_UINT( - g_settings.audio.out_rate, + settings->audio.out_rate, "audio_out_rate", "Audio Output Rate", out_rate, @@ -4693,10 +4696,10 @@ static bool setting_data_append_list_audio_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_PATH( - g_settings.audio.dsp_plugin, + settings->audio.dsp_plugin, "audio_dsp_plugin", "DSP Plugin", - g_settings.audio.filter_dir, + settings->audio.filter_dir, group_info.name, subgroup_info.name, general_write_handler, @@ -4718,12 +4721,13 @@ static bool setting_data_append_list_input_options( rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; unsigned i, user; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Input Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_UINT( - g_settings.input.max_users, + settings->input.max_users, "input_max_users", "Max Users", MAX_USERS, @@ -4734,7 +4738,7 @@ static bool setting_data_append_list_input_options( settings_list_current_add_range(list, list_info, 1, MAX_USERS, 1, true, true); CONFIG_BOOL( - g_settings.input.remap_binds_enable, + settings->input.remap_binds_enable, "input_remap_binds_enable", "Remap Binds Enable", true, @@ -4746,7 +4750,7 @@ static bool setting_data_append_list_input_options( general_read_handler); CONFIG_BOOL( - g_settings.input.autodetect_enable, + settings->input.autodetect_enable, "input_autodetect_enable", "Autoconfig Enable", input_autodetect_enable, @@ -4758,7 +4762,7 @@ static bool setting_data_append_list_input_options( general_read_handler); CONFIG_BOOL( - g_settings.input.autoconfig_descriptor_label_show, + settings->input.autoconfig_descriptor_label_show, "autoconfig_descriptor_label_show", "Show Autoconfig Descriptor Labels", true, @@ -4770,7 +4774,7 @@ static bool setting_data_append_list_input_options( general_read_handler); CONFIG_BOOL( - g_settings.input.input_descriptor_label_show, + settings->input.input_descriptor_label_show, "input_descriptor_label_show", "Show Core Input Descriptor Labels", input_descriptor_label_show, @@ -4782,7 +4786,7 @@ static bool setting_data_append_list_input_options( general_read_handler); CONFIG_BOOL( - g_settings.input.input_descriptor_hide_unbound, + settings->input.input_descriptor_hide_unbound, "input_descriptor_hide_unbound", "Hide Unbound Core Input Descriptors", input_descriptor_hide_unbound, @@ -4814,7 +4818,7 @@ static bool setting_data_append_list_input_options( general_write_handler, general_read_handler); - for (user = 0; user < g_settings.input.max_users; user ++) + for (user = 0; user < settings->input.max_users; user ++) { /* These constants match the string lengths. * Keep them up to date or you'll get some really obvious bugs. @@ -4856,7 +4860,7 @@ static bool setting_data_append_list_input_options( "User %d Bind Default All", user + 1); CONFIG_UINT( - g_settings.input.libretro_device[user], + settings->input.libretro_device[user], key_type[user], label_type[user], user, @@ -4872,7 +4876,7 @@ static bool setting_data_append_list_input_options( &setting_data_get_string_representation_uint_libretro_device; CONFIG_UINT( - g_settings.input.analog_dpad_mode[user], + settings->input.analog_dpad_mode[user], key_analog[user], label_analog[user], user, @@ -4927,7 +4931,7 @@ static bool setting_data_append_list_input_options( subgroup_info); CONFIG_FLOAT( - g_settings.input.axis_threshold, + settings->input.axis_threshold, "input_axis_threshold", "Input Axis Threshold", axis_threshold, @@ -4939,7 +4943,7 @@ static bool setting_data_append_list_input_options( settings_list_current_add_range(list, list_info, 0, 1.00, 0.001, true, true); CONFIG_UINT( - g_settings.input.turbo_period, + settings->input.turbo_period, "input_turbo_period", "Turbo Period", turbo_period, @@ -4950,7 +4954,7 @@ static bool setting_data_append_list_input_options( settings_list_current_add_range(list, list_info, 1, 0, 1, true, false); CONFIG_UINT( - g_settings.input.turbo_duty_cycle, + settings->input.turbo_duty_cycle, "input_duty_cycle", "Duty Cycle", turbo_duty_cycle, @@ -4979,14 +4983,14 @@ static bool setting_data_append_list_input_options( if (!keybind || !keybind->meta) continue; - CONFIG_BIND(g_settings.input.binds[0][i], 0, 0, + CONFIG_BIND(settings->input.binds[0][i], 0, 0, keybind->base, keybind->desc, &retro_keybinds_1[i], group_info.name, subgroup_info.name); settings_list_current_add_bind_type(list, list_info, i + MENU_SETTINGS_BIND_BEGIN); } END_SUB_GROUP(list, list_info); - for (user = 0; user < g_settings.input.max_users; user++) + for (user = 0; user < settings->input.max_users; user++) { /* This constants matches the string length. * Keep it up to date or you'll get some really obvious bugs. @@ -5017,7 +5021,7 @@ static bool setting_data_append_list_input_options( continue; if ( - g_settings.input.input_descriptor_label_show + settings->input.input_descriptor_label_show && (i < RARCH_FIRST_META_KEY) && (g_extern.has_set_input_descriptors) && (i != RARCH_TURBO_ENABLE) @@ -5030,7 +5034,7 @@ static bool setting_data_append_list_input_options( { snprintf(label, sizeof(label), "%s %s", buffer[user], "N/A"); - if (g_settings.input.input_descriptor_hide_unbound) + if (settings->input.input_descriptor_hide_unbound) do_add = false; } } @@ -5042,7 +5046,7 @@ static bool setting_data_append_list_input_options( if (do_add) { CONFIG_BIND( - g_settings.input.binds[user][i], + settings->input.binds[user][i], user + 1, user, strdup(name), /* TODO: Find a way to fix these memleaks. */ @@ -5068,12 +5072,13 @@ static bool setting_data_append_list_overlay_options( #ifdef HAVE_OVERLAY rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Overlay Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.input.overlay_enable, + settings->input.overlay_enable, "input_overlay_enable", "Overlay Enable", true, @@ -5086,7 +5091,7 @@ static bool setting_data_append_list_overlay_options( (*list)[list_info->index - 1].change_handler = overlay_enable_toggle_change_handler; CONFIG_PATH( - g_settings.input.overlay, + settings->input.overlay, "input_overlay", "Overlay Preset", g_extern.overlay_dir, @@ -5099,7 +5104,7 @@ static bool setting_data_append_list_overlay_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY); CONFIG_FLOAT( - g_settings.input.overlay_opacity, + settings->input.overlay_opacity, "input_overlay_opacity", "Overlay Opacity", 0.7f, @@ -5113,7 +5118,7 @@ static bool setting_data_append_list_overlay_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO); CONFIG_FLOAT( - g_settings.input.overlay_scale, + settings->input.overlay_scale, "input_overlay_scale", "Overlay Scale", 1.0f, @@ -5140,12 +5145,13 @@ static bool setting_data_append_list_osk_overlay_options( #ifdef HAVE_OVERLAY rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Onscreen Keyboard Overlay Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.osk.enable, + settings->osk.enable, "input_osk_overlay_enable", "OSK Overlay Enable", true, @@ -5157,7 +5163,7 @@ static bool setting_data_append_list_osk_overlay_options( general_read_handler); CONFIG_PATH( - g_settings.osk.overlay, + settings->osk.overlay, "input_osk_overlay", "OSK Overlay Preset", g_extern.osk_overlay_dir, @@ -5182,12 +5188,13 @@ static bool setting_data_append_list_menu_options( #ifdef HAVE_MENU rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Menu Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_PATH( - g_settings.menu.wallpaper, + settings->menu.wallpaper, "menu_wallpaper", "Menu Wallpaper", "", @@ -5199,7 +5206,7 @@ static bool setting_data_append_list_menu_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY); CONFIG_BOOL( - g_settings.menu.pause_libretro, + settings->menu.pause_libretro, "menu_pause_libretro", "Pause Libretro", true, @@ -5213,7 +5220,7 @@ static bool setting_data_append_list_menu_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO); CONFIG_BOOL( - g_settings.menu.mouse.enable, + settings->menu.mouse.enable, "menu_mouse_enable", "Mouse Enable", false, @@ -5229,7 +5236,7 @@ static bool setting_data_append_list_menu_options( START_SUB_GROUP(list, list_info, "Navigation", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.menu.navigation.wraparound.horizontal_enable, + settings->menu.navigation.wraparound.horizontal_enable, "menu_navigation_wraparound_horizontal_enable", "Navigation Wrap-Around Horizontal", true, @@ -5241,7 +5248,7 @@ static bool setting_data_append_list_menu_options( general_read_handler); CONFIG_BOOL( - g_settings.menu.navigation.wraparound.vertical_enable, + settings->menu.navigation.wraparound.vertical_enable, "menu_navigation_wraparound_vertical_enable", "Navigation Wrap-Around Vertical", true, @@ -5257,7 +5264,7 @@ static bool setting_data_append_list_menu_options( START_SUB_GROUP(list, list_info, "Settings View", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.menu.collapse_subgroups_enable, + settings->menu.collapse_subgroups_enable, "menu_collapse_subgroups_enable", "Collapse SubGroups", collapse_subgroups_enable, @@ -5270,7 +5277,7 @@ static bool setting_data_append_list_menu_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); CONFIG_BOOL( - g_settings.menu.show_advanced_settings, + settings->menu.show_advanced_settings, "menu_show_advanced_settings", "Show advanced settings", show_advanced_settings, @@ -5283,7 +5290,7 @@ static bool setting_data_append_list_menu_options( #ifdef HAVE_THREADS CONFIG_BOOL( - g_settings.menu.threaded_data_runloop_enable, + settings->menu.threaded_data_runloop_enable, "threaded_data_runloop_enable", "Threaded data runloop", true, @@ -5297,7 +5304,7 @@ static bool setting_data_append_list_menu_options( /* These colors are hints. The menu driver is not required to use them. */ CONFIG_HEX( - g_settings.menu.entry_normal_color, + settings->menu.entry_normal_color, "menu_entry_normal_color", "Menu entry normal color", menu_entry_normal_color, @@ -5308,7 +5315,7 @@ static bool setting_data_append_list_menu_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); CONFIG_HEX( - g_settings.menu.entry_hover_color, + settings->menu.entry_hover_color, "menu_entry_hover_color", "Menu entry hover color", menu_entry_hover_color, @@ -5319,7 +5326,7 @@ static bool setting_data_append_list_menu_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); CONFIG_HEX( - g_settings.menu.title_color, + settings->menu.title_color, "menu_title_color", "Menu title color", menu_title_color, @@ -5334,7 +5341,7 @@ static bool setting_data_append_list_menu_options( START_SUB_GROUP(list, list_info, "Browser", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.menu.navigation.browser.filter.supported_extensions_enable, + settings->menu.navigation.browser.filter.supported_extensions_enable, "menu_navigation_browser_filter_supported_extensions_enable", "Browser - Filter by supported extensions", true, @@ -5346,7 +5353,7 @@ static bool setting_data_append_list_menu_options( general_read_handler); CONFIG_BOOL( - g_settings.menu_show_start_screen, + settings->menu_show_start_screen, "rgui_show_start_screen", "Show Start Screen", menu_show_start_screen, @@ -5358,7 +5365,7 @@ static bool setting_data_append_list_menu_options( general_read_handler); CONFIG_BOOL( - g_settings.menu.timedate_enable, + settings->menu.timedate_enable, "menu_timedate_enable", "Show time / date", true, @@ -5370,7 +5377,7 @@ static bool setting_data_append_list_menu_options( general_read_handler); CONFIG_BOOL( - g_settings.menu.core_enable, + settings->menu.core_enable, "menu_core_enable", "Show core name", true, @@ -5396,12 +5403,13 @@ static bool setting_data_append_list_ui_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "UI Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.video.disable_composition, + settings->video.disable_composition, "video_disable_composition", "Window Compositing Disable Hint", disable_composition, @@ -5415,7 +5423,7 @@ static bool setting_data_append_list_ui_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO); CONFIG_BOOL( - g_settings.pause_nonactive, + settings->pause_nonactive, "pause_nonactive", "Window Unfocus Pause Hint", pause_nonactive, @@ -5427,7 +5435,7 @@ static bool setting_data_append_list_ui_options( general_read_handler); CONFIG_BOOL( - g_settings.ui.menubar_enable, + settings->ui.menubar_enable, "ui_menubar_enable", "Menubar Enable Hint", true, @@ -5439,7 +5447,7 @@ static bool setting_data_append_list_ui_options( general_read_handler); CONFIG_BOOL( - g_settings.ui.suspend_screensaver_enable, + settings->ui.suspend_screensaver_enable, "suspend_screensaver_enable", "Suspend Screensaver Enable Hint", true, @@ -5463,12 +5471,13 @@ static bool setting_data_append_list_archive_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Archive Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_UINT( - g_settings.archive.mode, + settings->archive.mode, "archive_mode", "Archive Mode", 0, @@ -5493,13 +5502,14 @@ static bool setting_data_append_list_core_updater_options( #ifdef HAVE_NETWORKING rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Core Updater Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_STRING( - g_settings.network.buildbot_url, + settings->network.buildbot_url, "core_updater_buildbot_url", "Buildbot Core URL", buildbot_server_url, @@ -5510,7 +5520,7 @@ static bool setting_data_append_list_core_updater_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); CONFIG_STRING( - g_settings.network.buildbot_assets_url, + settings->network.buildbot_assets_url, "core_updater_buildbot_assets_url", "Buildbot Assets URL", buildbot_assets_server_url, @@ -5521,7 +5531,7 @@ static bool setting_data_append_list_core_updater_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); CONFIG_BOOL( - g_settings.network.buildbot_auto_extract_archive, + settings->network.buildbot_auto_extract_archive, "core_updater_auto_extract_archive", "Automatically extract downloaded archive", true, @@ -5546,6 +5556,7 @@ static bool setting_data_append_list_netplay_options( #ifdef HAVE_NETPLAY rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Network Settings"); @@ -5564,7 +5575,7 @@ static bool setting_data_append_list_netplay_options( general_read_handler); CONFIG_BOOL( - g_settings.input.netplay_client_swap_input, + settings->input.netplay_client_swap_input, "netplay_client_swap_input", "Swap Netplay Input", netplay_client_swap_input, @@ -5646,7 +5657,7 @@ static bool setting_data_append_list_netplay_options( #if defined(HAVE_NETWORK_CMD) CONFIG_BOOL( - g_settings.network_cmd_enable, + settings->network_cmd_enable, "network_cmd_enable", "Network Commands", network_cmd_enable, @@ -5659,7 +5670,7 @@ static bool setting_data_append_list_netplay_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); #if 0 CONFIG_INT( - g_settings.network_cmd_port, + settings->network_cmd_port, "network_cmd_port", "Network Command Port", network_cmd_port, @@ -5669,7 +5680,7 @@ static bool setting_data_append_list_netplay_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); #endif CONFIG_BOOL( - g_settings.stdin_cmd_enable, + settings->stdin_cmd_enable, "stdin_cmd_enable", "stdin command", stdin_cmd_enable, @@ -5748,12 +5759,13 @@ static bool setting_data_append_list_playlist_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Playlist Settings"); START_SUB_GROUP(list, list_info, "History", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.history_list_enable, + settings->history_list_enable, "history_list_enable", "History List Enable", true, @@ -5765,7 +5777,7 @@ static bool setting_data_append_list_playlist_options( general_read_handler); CONFIG_UINT( - g_settings.content_history_size, + settings->content_history_size, "game_history_size", "History List Size", default_content_history_size, @@ -5787,12 +5799,13 @@ static bool setting_data_append_list_user_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "User Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_STRING( - g_settings.username, + settings->username, "netplay_nickname", "Username", "", @@ -5803,7 +5816,7 @@ static bool setting_data_append_list_user_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); CONFIG_UINT( - g_settings.user_language, + settings->user_language, "user_language", "Language", def_user_language, @@ -5835,13 +5848,14 @@ static bool setting_data_append_list_path_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Path Settings"); START_SUB_GROUP(list, list_info, "Paths", group_info.name, subgroup_info); #ifdef HAVE_MENU CONFIG_DIR( - g_settings.menu_content_directory, + settings->menu_content_directory, "rgui_browser_directory", "Browser Directory", "", @@ -5856,7 +5870,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.core_assets_directory, + settings->core_assets_directory, "core_assets_directory", "Core Assets Directory", "", @@ -5871,7 +5885,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.assets_directory, + settings->assets_directory, "assets_directory", "Assets Directory", "", @@ -5886,7 +5900,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.menu_config_directory, + settings->menu_config_directory, "rgui_config_directory", "Config Directory", "", @@ -5903,7 +5917,7 @@ static bool setting_data_append_list_path_options( #endif CONFIG_DIR( - g_settings.libretro_directory, + settings->libretro_directory, "libretro_dir_path", "Core Directory", g_defaults.core_dir, @@ -5919,7 +5933,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.libretro_info_path, + settings->libretro_info_path, "libretro_info_path", "Core Info Directory", g_defaults.core_info_dir, @@ -5936,7 +5950,7 @@ static bool setting_data_append_list_path_options( #ifdef HAVE_LIBRETRODB CONFIG_DIR( - g_settings.content_database, + settings->content_database, "content_database_path", "Content Database Directory", "", @@ -5951,7 +5965,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.cursor_directory, + settings->cursor_directory, "cursor_directory", "Cursor Directory", "", @@ -5967,7 +5981,7 @@ static bool setting_data_append_list_path_options( #endif CONFIG_DIR( - g_settings.cheat_database, + settings->cheat_database, "cheat_database_path", "Cheat Database Directory", "", @@ -5982,7 +5996,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_PATH( - g_settings.content_history_path, + settings->content_history_path, "game_history_path", "Content History Path", "", @@ -5993,7 +6007,7 @@ static bool setting_data_append_list_path_options( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY); CONFIG_DIR( - g_settings.video.filter_dir, + settings->video.filter_dir, "video_filter_dir", "VideoFilter Directory", "", @@ -6008,7 +6022,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.audio.filter_dir, + settings->audio.filter_dir, "audio_filter_dir", "AudioFilter Directory", "", @@ -6023,7 +6037,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.video.shader_dir, + settings->video.shader_dir, "video_shader_dir", "Shader Directory", g_defaults.shader_dir, @@ -6070,7 +6084,7 @@ static bool setting_data_append_list_path_options( #endif CONFIG_DIR( - g_settings.screenshot_directory, + settings->screenshot_directory, "screenshot_directory", "Screenshot Directory", "", @@ -6085,7 +6099,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.input.autoconfig_dir, + settings->input.autoconfig_dir, "joypad_autoconfig_dir", "Joypad Autoconfig Directory", "", @@ -6100,7 +6114,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.input_remapping_directory, + settings->input_remapping_directory, "input_remapping_directory", "Input Remapping Directory", "", @@ -6115,7 +6129,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.playlist_directory, + settings->playlist_directory, "playlist_directory", "Playlist Directory", "", @@ -6160,7 +6174,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.system_directory, + settings->system_directory, "system_directory", "System Directory", "", @@ -6175,7 +6189,7 @@ static bool setting_data_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - g_settings.extraction_directory, + settings->extraction_directory, "extraction_directory", "Extraction Directory", "", @@ -6200,12 +6214,13 @@ static bool setting_data_append_list_privacy_options( { rarch_setting_group_info_t group_info; rarch_setting_group_info_t subgroup_info; + settings_t *settings = config_get_ptr(); START_GROUP(group_info, "Privacy Settings"); START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info); CONFIG_BOOL( - g_settings.camera.allow, + settings->camera.allow, "camera_allow", "Allow Camera", false, @@ -6217,7 +6232,7 @@ static bool setting_data_append_list_privacy_options( general_read_handler); CONFIG_BOOL( - g_settings.location.allow, + settings->location.allow, "location_allow", "Allow Location", false, diff --git a/tools/retroarch-joyconfig.c b/tools/retroarch-joyconfig.c index a5401f7586..e0361b0cd3 100644 --- a/tools/retroarch-joyconfig.c +++ b/tools/retroarch-joyconfig.c @@ -46,6 +46,11 @@ static char *g_auto_path = NULL; static char *g_driver = NULL; static unsigned g_meta_level = 0; +settings_t *config_get_ptr(void) +{ + return &g_settings; +} + driver_t *driver_get_ptr(void) { return &driver;