diff --git a/command.c b/command.c index 16b07e09b4..d3d32c9bb5 100644 --- a/command.c +++ b/command.c @@ -1318,7 +1318,7 @@ static void command_event_set_savestate_auto_index(void) dir_list_free(dir_list); - configuration_set_int(settings, settings->state_slot, max_idx); + configuration_set_int(settings, settings->ints.state_slot, max_idx); RARCH_LOG("%s: #%d\n", msg_hash_to_str(MSG_FOUND_LAST_STATE_SLOT), @@ -1702,11 +1702,12 @@ static bool command_event_main_state(unsigned cmd) if (global) { settings_t *settings = config_get_ptr(); + int state_slot = settings->ints.state_slot; - if (settings->state_slot > 0) + if (state_slot > 0) snprintf(path, sizeof(path), "%s%d", - global->name.savestate, settings->state_slot); - else if (settings->state_slot < 0) + global->name.savestate, state_slot); + else if (state_slot < 0) fill_pathname_join_delim(path, global->name.savestate, "auto", '.', sizeof(path)); else @@ -1938,8 +1939,8 @@ bool command_event(enum event_command cmd, void *data) if (settings->bools.savestate_auto_index) { - int new_state_slot = settings->state_slot + 1; - configuration_set_int(settings, settings->state_slot, new_state_slot); + int new_state_slot = settings->ints.state_slot + 1; + configuration_set_int(settings, settings->ints.state_slot, new_state_slot); } } return command_event_main_state(cmd); @@ -1947,18 +1948,18 @@ bool command_event(enum event_command cmd, void *data) { settings_t *settings = config_get_ptr(); /* Slot -1 is (auto) slot. */ - if (settings->state_slot >= 0) + if (settings->ints.state_slot >= 0) { - int new_state_slot = settings->state_slot - 1; - configuration_set_int(settings, settings->state_slot, new_state_slot); + int new_state_slot = settings->ints.state_slot - 1; + configuration_set_int(settings, settings->ints.state_slot, new_state_slot); } } break; case CMD_EVENT_SAVE_STATE_INCREMENT: { settings_t *settings = config_get_ptr(); - int new_state_slot = settings->state_slot + 1; - configuration_set_int(settings, settings->state_slot, new_state_slot); + int new_state_slot = settings->ints.state_slot + 1; + configuration_set_int(settings, settings->ints.state_slot, new_state_slot); } break; case CMD_EVENT_TAKE_SCREENSHOT: diff --git a/configuration.c b/configuration.c index 5f312025e1..4441270b54 100644 --- a/configuration.c +++ b/configuration.c @@ -986,10 +986,10 @@ static struct config_int_setting *populate_settings_int(settings_t *settings, in SETTING_INT("video_swap_interval", &settings->video.swap_interval, true, swap_interval, false); SETTING_INT("video_rotation", &settings->video.rotation, true, ORIENTATION_NORMAL, false); SETTING_INT("aspect_ratio_index", &settings->video.aspect_ratio_idx, true, aspect_ratio_idx, false); - SETTING_INT("state_slot", (unsigned*)&settings->state_slot, false, 0 /* TODO */, false); + SETTING_INT("state_slot", (unsigned*)&settings->ints.state_slot, false, 0 /* TODO */, false); #ifdef HAVE_NETWORKING SETTING_INT("netplay_ip_port", &settings->netplay.port, true, RARCH_DEFAULT_PORT, false); - SETTING_INT("netplay_check_frames", (unsigned*)&settings->netplay.check_frames, true, netplay_check_frames, false); + SETTING_INT("netplay_check_frames", (unsigned*)&settings->ints.netplay_check_frames, true, netplay_check_frames, false); SETTING_INT("netplay_input_latency_frames_min",&settings->netplay.input_latency_frames_min, true, 0, false); SETTING_INT("netplay_input_latency_frames_range",&settings->netplay.input_latency_frames_range, true, 0, false); #endif @@ -1909,7 +1909,7 @@ static bool config_load_file(const char *path, bool set_defaults, if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_STATELESS_MODE, NULL)) CONFIG_GET_BOOL_BASE(conf, settings, bools.netplay_stateless_mode, "netplay_stateless_mode"); if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL)) - CONFIG_GET_INT_BASE(conf, settings, netplay.check_frames, "netplay_check_frames"); + CONFIG_GET_INT_BASE(conf, settings, ints.netplay_check_frames, "netplay_check_frames"); if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT, NULL)) CONFIG_GET_INT_BASE(conf, settings, netplay.port, "netplay_ip_port"); #endif diff --git a/configuration.h b/configuration.h index 5a148cf61a..cb0d070b5d 100644 --- a/configuration.h +++ b/configuration.h @@ -242,6 +242,14 @@ typedef struct settings float fastforward_ratio; } floats; + struct + { + int netplay_check_frames; + int location_update_interval_ms; + int location_update_interval_distance; + int state_slot; + } ints; + bool modified; video_viewport_t video_viewport_custom; @@ -327,8 +335,6 @@ typedef struct settings struct { char driver[32]; - int update_interval_ms; - int update_interval_distance; } location; struct @@ -340,14 +346,12 @@ typedef struct settings unsigned block_frames; unsigned latency; - #ifdef HAVE_WASAPI struct { unsigned sh_buffer_length; /* in frames (0 disables buffering) */ } wasapi; #endif - } audio; struct @@ -396,8 +400,6 @@ typedef struct settings char browse_url[4096]; - int state_slot; - struct { char cheat_database[PATH_MAX_LENGTH]; @@ -449,7 +451,6 @@ typedef struct settings { char server[255]; unsigned port; - int check_frames; unsigned input_latency_frames_min; unsigned input_latency_frames_range; char password[128]; @@ -457,6 +458,7 @@ typedef struct settings } netplay; #endif + unsigned bundle_assets_extract_version_current; unsigned bundle_assets_extract_last_version; unsigned content_history_size; @@ -466,7 +468,7 @@ typedef struct settings unsigned network_cmd_port; unsigned network_remote_base_port; #ifdef HAVE_LANGEXTRA - unsigned int user_language; + unsigned user_language; #endif size_t rewind_buffer_size; diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index d7949e532e..83358f713e 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -656,8 +656,8 @@ static void menu_action_setting_disp_set_label_state( strlcpy(s2, path, len2); *w = 16; - snprintf(s, len, "%d", settings->state_slot); - if (settings->state_slot == -1) + snprintf(s, len, "%d", settings->ints.state_slot); + if (settings->ints.state_slot == -1) strlcat(s, " (Auto)", len); } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 1d1ffbf064..7987745920 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1022,10 +1022,10 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) if (global) { - if (settings->state_slot > 0) + if (settings->ints.state_slot > 0) snprintf(path, sizeof(path), "%s%d", - global->name.savestate, settings->state_slot); - else if (settings->state_slot < 0) + global->name.savestate, settings->ints.state_slot); + else if (settings->ints.state_slot < 0) fill_pathname_join_delim(path, global->name.savestate, "auto", '.', sizeof(path)); else diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 072c956213..51a1844ae9 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2141,7 +2141,7 @@ static bool setting_append_list( CONFIG_INT( list, list_info, - &settings->state_slot, + &settings->ints.state_slot, MENU_ENUM_LABEL_STATE_SLOT, MENU_ENUM_LABEL_VALUE_STATE_SLOT, 0, @@ -5813,7 +5813,7 @@ static bool setting_append_list( CONFIG_INT( list, list_info, - &settings->netplay.check_frames, + &settings->ints.netplay_check_frames, MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES, MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, netplay_check_frames, diff --git a/movie.c b/movie.c index d637084084..dd351b114a 100644 --- a/movie.c +++ b/movie.c @@ -506,9 +506,9 @@ static bool runloop_check_movie_init(void) configuration_set_uint(settings, settings->rewind_granularity, 1); - if (settings->state_slot > 0) + if (settings->ints.state_slot > 0) snprintf(path, sizeof(path), "%s%d", - bsv_movie_state.movie_path, settings->state_slot); + bsv_movie_state.movie_path, settings->ints.state_slot); else strlcpy(path, bsv_movie_state.movie_path, sizeof(path)); diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 8562bb704c..2ba561f848 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -1211,7 +1211,7 @@ bool init_netplay(void *direct_host, const char *server, unsigned port) netplay_is_client ? (!netplay_client_deferred ? port : server_port_deferred ) : (port != 0 ? port : RARCH_DEFAULT_PORT), settings->bools.netplay_stateless_mode, - settings->netplay.check_frames, + settings->ints.netplay_check_frames, &cbs, settings->bools.netplay_nat_traversal, settings->username, diff --git a/retroarch.c b/retroarch.c index 04937486b4..717ffda33b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -733,7 +733,7 @@ static void retroarch_parse_input(int argc, char *argv[]) retroarch_override_setting_set( RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES, NULL); - configuration_set_int(settings, settings->netplay.check_frames, (int)strtoul(optarg, NULL, 0)); + configuration_set_int(settings, settings->ints.netplay_check_frames, (int)strtoul(optarg, NULL, 0)); } break; diff --git a/runloop.c b/runloop.c index f2e4242890..d38f2fdeb0 100644 --- a/runloop.c +++ b/runloop.c @@ -933,15 +933,15 @@ static enum runloop_state runloop_check_state( if (runloop_cmd_triggered(trigger_input, RARCH_STATE_SLOT_PLUS)) { char msg[128]; - int new_state_slot = settings->state_slot + 1; + int new_state_slot = settings->ints.state_slot + 1; msg[0] = '\0'; - configuration_set_int(settings, settings->state_slot, new_state_slot); + configuration_set_int(settings, settings->ints.state_slot, new_state_slot); snprintf(msg, sizeof(msg), "%s: %d", msg_hash_to_str(MSG_STATE_SLOT), - settings->state_slot); + settings->ints.state_slot); runloop_msg_queue_push(msg, 2, 180, true); @@ -950,18 +950,18 @@ static enum runloop_state runloop_check_state( else if (runloop_cmd_triggered(trigger_input, RARCH_STATE_SLOT_MINUS)) { char msg[128]; - int new_state_slot = settings->state_slot - 1; + int new_state_slot = settings->ints.state_slot - 1; msg[0] = '\0'; - if (settings->state_slot > 0) + if (settings->ints.state_slot > 0) { - configuration_set_int(settings, settings->state_slot, new_state_slot); + configuration_set_int(settings, settings->ints.state_slot, new_state_slot); } snprintf(msg, sizeof(msg), "%s: %d", msg_hash_to_str(MSG_STATE_SLOT), - settings->state_slot); + settings->ints.state_slot); runloop_msg_queue_push(msg, 2, 180, true); diff --git a/tasks/task_save.c b/tasks/task_save.c index eb2af2e439..c8e6da4a41 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -639,7 +639,7 @@ static bool task_push_undo_save_state(const char *path, void *data, size_t size) state->data = data; state->size = size; state->undo_save = true; - state->state_slot = settings->state_slot; + state->state_slot = settings->ints.state_slot; task->type = TASK_TYPE_BLOCKING; task->state = state; @@ -997,7 +997,7 @@ static void task_push_save_state(const char *path, void *data, size_t size, bool state->autosave = autosave; state->mute = autosave; /* don't show OSD messages if we are auto-saving */ state->thumbnail_enable = settings->bools.savestate_thumbnail_enable; - state->state_slot = settings->state_slot; + state->state_slot = settings->ints.state_slot; task->type = TASK_TYPE_BLOCKING; task->state = state; @@ -1067,7 +1067,7 @@ static void task_push_load_and_save_state(const char *path, void *data, state->undo_data = data; state->autosave = autosave; state->mute = autosave; /* don't show OSD messages if we are auto-saving */ - state->state_slot = settings->state_slot; + state->state_slot = settings->ints.state_slot; task->state = state; task->type = TASK_TYPE_BLOCKING; @@ -1203,13 +1203,13 @@ bool content_load_state(const char *path, strlcpy(state->path, path, sizeof(state->path)); state->load_to_backup_buffer = load_to_backup_buffer; state->autoload = autoload; - state->state_slot = settings->state_slot; + state->state_slot = settings->ints.state_slot; - task->type = TASK_TYPE_BLOCKING; - task->state = state; - task->handler = task_load_handler; - task->callback = content_load_state_cb; - task->title = strdup(msg_hash_to_str(MSG_LOADING_STATE)); + task->type = TASK_TYPE_BLOCKING; + task->state = state; + task->handler = task_load_handler; + task->callback = content_load_state_cb; + task->title = strdup(msg_hash_to_str(MSG_LOADING_STATE)); task_queue_ctl(TASK_QUEUE_CTL_PUSH, task); diff --git a/ui/drivers/ui_win32.c b/ui/drivers/ui_win32.c index 65176e3de7..8008ac9d50 100644 --- a/ui/drivers/ui_win32.c +++ b/ui/drivers/ui_win32.c @@ -701,13 +701,13 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam) else if (mode == ID_M_STATE_INDEX_AUTO) { signed idx = -1; - configuration_set_int(settings, settings->state_slot, idx); + configuration_set_int(settings, settings->ints.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)); - configuration_set_int(settings, settings->state_slot, idx); + configuration_set_int(settings, settings->ints.state_slot, idx); } break; }