diff --git a/configuration.c b/configuration.c index c9e4e3cb2e..5ee135c9b7 100644 --- a/configuration.c +++ b/configuration.c @@ -3462,16 +3462,17 @@ static bool config_load_file(global_t *global, } #ifdef HAVE_NETWORKGAMEPAD - for (i = 0; i < MAX_USERS; i++) { char tmp[64]; - bool tmp_bool = false; - size_t _len = strlcpy(tmp, "network_remote_enable_user_p", sizeof(tmp)); - snprintf(tmp + _len, sizeof(tmp) - _len, "%u", i + 1); - - if (config_get_bool(conf, tmp, &tmp_bool)) - configuration_set_bool(settings, - settings->bools.network_remote_enable_user[i], tmp_bool); + size_t _len = strlcpy(tmp, "network_remote_enable_user_p", sizeof(tmp)); + for (i = 0; i < MAX_USERS; i++) + { + bool tmp_bool = false; + snprintf(tmp + _len, sizeof(tmp) - _len, "%u", i + 1); + if (config_get_bool(conf, tmp, &tmp_bool)) + configuration_set_bool(settings, + settings->bools.network_remote_enable_user[i], tmp_bool); + } } #endif @@ -3509,26 +3510,27 @@ static bool config_load_file(global_t *global, *size_settings[i].ptr = *size_settings[i].ptr * 1024 * 1024; } - for (i = 0; i < MAX_USERS; i++) { - char buf[64]; char prefix[24]; - size_t _len; - buf[0] = '\0'; - _len = strlcpy(prefix, "input_player", sizeof(prefix)); - snprintf(prefix + _len, sizeof(prefix) - _len, "%u", i + 1); + size_t _len = strlcpy(prefix, "input_player", sizeof(prefix)); + for (i = 0; i < MAX_USERS; i++) + { + char buf[64]; + buf[0] = '\0'; + snprintf(prefix + _len, sizeof(prefix) - _len, "%u", i + 1); - strlcpy(buf, prefix, sizeof(buf)); - strlcat(buf, "_analog_dpad_mode", sizeof(buf)); - CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], buf); + strlcpy(buf, prefix, sizeof(buf)); + strlcat(buf, "_analog_dpad_mode", sizeof(buf)); + CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], buf); - strlcpy(buf, prefix, sizeof(buf)); - strlcat(buf, "_joypad_index", sizeof(buf)); - CONFIG_GET_INT_BASE(conf, settings, uints.input_joypad_index[i], buf); + strlcpy(buf, prefix, sizeof(buf)); + strlcat(buf, "_joypad_index", sizeof(buf)); + CONFIG_GET_INT_BASE(conf, settings, uints.input_joypad_index[i], buf); - strlcpy(buf, prefix, sizeof(buf)); - strlcat(buf, "_mouse_index", sizeof(buf)); - CONFIG_GET_INT_BASE(conf, settings, uints.input_mouse_index[i], buf); + strlcpy(buf, prefix, sizeof(buf)); + strlcat(buf, "_mouse_index", sizeof(buf)); + CONFIG_GET_INT_BASE(conf, settings, uints.input_mouse_index[i], buf); + } } /* LED map for use by the led driver */ diff --git a/core_info.c b/core_info.c index 90ff52358c..25e8522449 100644 --- a/core_info.c +++ b/core_info.c @@ -1599,6 +1599,8 @@ static void core_info_resolve_firmware( core_info_t *info, config_file_t *conf) { unsigned i; + size_t _len; + char prefix[12]; unsigned firmware_count = 0; core_info_firmware_t *firmware = NULL; @@ -1611,18 +1613,17 @@ static void core_info_resolve_firmware( if (!firmware) return; + _len = strlcpy(prefix, "firmware", sizeof(prefix)); + for (i = 0; i < firmware_count; i++) { - char prefix[12]; char path_key[64]; char desc_key[64]; char opt_key[64]; struct config_entry_list *entry = NULL; bool tmp_bool = false; - prefix[0] = '\0'; - - snprintf(prefix, sizeof(prefix), "firmware%u_", i); + snprintf(prefix + _len, sizeof(prefix) - _len, "%u_", i); strlcpy(path_key, prefix, sizeof(path_key)); strlcat(path_key, "path", sizeof(path_key)); strlcpy(desc_key, prefix, sizeof(desc_key)); diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 6ed4514d02..2963f0916b 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3958,6 +3958,7 @@ void video_driver_frame(const void *data, unsigned width, tmp[0] = '\0'; len = 0; + /* TODO/FIXME - localize */ if (video_st->frame_delay_target > 0) len = snprintf(tmp, sizeof(latency_stats), " Frame Delay: %2u ms\n" @@ -3983,10 +3984,12 @@ void video_driver_frame(const void *data, unsigned width, if (len) { - strlcpy(latency_stats, "LATENCY\n", sizeof(latency_stats)); - strlcat(latency_stats, tmp, sizeof(latency_stats)); + /* TODO/FIXME - localize */ + strlcpy(latency_stats, "LATENCY\n", sizeof(latency_stats)); + strlcat(latency_stats, tmp, sizeof(latency_stats)); } + /* TODO/FIXME - localize */ snprintf(video_info.stat_text, sizeof(video_info.stat_text), "CORE AV_INFO\n" diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index ad7d4eb853..721c3a64f3 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -1008,20 +1008,19 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, } } - if ( string_starts_with_size(label, "input_player", STRLEN_CONST("input_player")) && - string_ends_with_size(label, "_joypad_index", strlen(label), + if ( string_starts_with_size(label, "input_player", STRLEN_CONST("input_player")) + && string_ends_with_size(label, "_joypad_index", strlen(label), STRLEN_CONST("_joypad_index"))) { unsigned i; + char lbl_setting[128]; + size_t _len = strlcpy(lbl_setting, "input_player", sizeof(lbl_setting)); for (i = 0; i < MAX_USERS; i++) { - char label_setting[128]; - label_setting[0] = '\0'; + snprintf(lbl_setting + _len, sizeof(lbl_setting) - _len, "%d", i + 1); + strlcat(lbl_setting, "_joypad_index", sizeof(lbl_setting)); - snprintf(label_setting, - sizeof(label_setting), "input_player%d_joypad_index", i + 1); - - if (!string_is_equal(label, label_setting)) + if (!string_is_equal(label, lbl_setting)) continue; BIND_ACTION_LEFT(cbs, bind_left_generic); diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index c8641c34fd..eb1134b2bb 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2121,13 +2121,13 @@ static int generic_action_ok(const char *path, case ACTION_OK_LOAD_REMAPPING_FILE: #ifdef HAVE_CONFIGFILE { + char conf_key[64]; config_file_t *conf = config_file_new_from_path_to_string( action_path); retro_ctx_controller_info_t pad; unsigned current_device = 0; unsigned port = 0; int conf_val = 0; - char conf_key[64]; flush_char = msg_hash_to_str(flush_id); conf_key[0] = '\0'; @@ -2136,16 +2136,17 @@ static int generic_action_ok(const char *path, { if (input_remapping_load_file(conf, action_path)) { + size_t _len = strlcpy(conf_key, "input_libretro_device_p", sizeof(conf_key)); for (port = 0; port < MAX_USERS; port++) { - snprintf(conf_key, sizeof(conf_key), "input_libretro_device_p%u", port + 1); + snprintf(conf_key + _len, sizeof(conf_key) - _len, "%u", port + 1); if (!config_get_int(conf, conf_key, &conf_val)) continue; current_device = input_config_get_device(port); input_config_set_device(port, current_device); - pad.port = port; - pad.device = current_device; + pad.port = port; + pad.device = current_device; core_set_controller_port_device(&pad); } } @@ -3693,20 +3694,20 @@ static int action_ok_remap_file_flush(const char *path, /* Log result */ if (success) { + /* TODO/FIXME - localize */ RARCH_LOG( "[Remaps]: Saved input remapping options to \"%s\".\n", path_remapfile ? path_remapfile : "UNKNOWN"); - snprintf(msg, sizeof(msg), "%s \"%s\"", msg_hash_to_str(MSG_REMAP_FILE_FLUSHED), remapfile); } else { + /* TODO/FIXME - localize */ RARCH_LOG( "[Remaps]: Failed to save input remapping options to \"%s\".\n", path_remapfile ? path_remapfile : "UNKNOWN"); - snprintf(msg, sizeof(msg), "%s \"%s\"", msg_hash_to_str(MSG_REMAP_FILE_FLUSH_FAILED), remapfile); @@ -3857,10 +3858,10 @@ static int action_ok_set_switch_cpu_profile(const char *path, char command[PATH_MAX_LENGTH] = {0}; #ifdef HAVE_LAKKA_SWITCH char* profile_name = SWITCH_CPU_PROFILES[entry_idx]; - + /* TODO/FIXME - localize */ snprintf(command, sizeof(command), "cpu-profile set '%s'", profile_name); - system(command); + /* TODO/FIXME - localize */ snprintf(command, sizeof(command), "Current profile set to %s", profile_name); #else unsigned profile_clock = SWITCH_CPU_SPEEDS_VALUES[entry_idx]; @@ -3877,6 +3878,7 @@ static int action_ok_set_switch_cpu_profile(const char *path, clkrstSetClockRate(&session, profile_clock); clkrstCloseSession(&session); } + /* TODO/FIXME - localize */ snprintf(command, sizeof(command), "Current Clock set to %i", profile_clock); #endif @@ -3894,23 +3896,15 @@ static int action_ok_set_switch_gpu_profile(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { char command[PATH_MAX_LENGTH]; - char *profile_name = SWITCH_GPU_PROFILES[entry_idx]; - - command[0] = '\0'; - - snprintf(command, sizeof(command), - "gpu-profile set '%s'", - profile_name); - + char *profile_name = SWITCH_GPU_PROFILES[entry_idx]; + size_t _len = strlcpy(command, "gpu-profile set ", sizeof(command)); + snprintf(command + _len, sizeof(command) - _len, "'%s'", profile_name); system(command); - - snprintf(command, sizeof(command), - "Current profile set to %s", - profile_name); - + /* TODO/FIXME - localize */ + strlcpy(command, "Current profile set to ", sizeof(command)); + strlcat(command, profile_name, sizeof(command)); runloop_msg_queue_push(command, 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - return -1; } @@ -4049,7 +4043,6 @@ int action_ok_core_option_dropdown_list(const char *path, return 0; push_dropdown_list: - /* If this option is not a boolean toggle, * push drop-down list */ snprintf(option_path_str, sizeof(option_path_str), @@ -7167,16 +7160,19 @@ static int action_ok_video_resolution(const char *path, video_driver_set_video_mode(width, height, true); #ifdef GEKKO if (width == 0 || height == 0) - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_DEFAULT)); + snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_DEFAULT)); else #endif { if (!string_is_empty(desc)) - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_DESC), - width, height, desc); + snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_DESC), + width, height, desc); else - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_NO_DESC), - width, height); + snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_SCREEN_RESOLUTION_APPLYING_NO_DESC), + width, height); } runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 6e2cedae66..d049400f04 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -1136,19 +1136,19 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, } } - if ( string_starts_with_size(label, "input_player", STRLEN_CONST("input_player")) && - string_ends_with_size(label, "_joypad_index", strlen(label), + if ( string_starts_with_size(label, "input_player", STRLEN_CONST("input_player")) + && string_ends_with_size(label, "_joypad_index", strlen(label), STRLEN_CONST("_joypad_index"))) { unsigned i; + char lbl_setting[128]; + size_t _len = strlcpy(lbl_setting, "input_player", sizeof(lbl_setting)); for (i = 0; i < MAX_USERS; i++) { - char label_setting[128]; - label_setting[0] = '\0'; + snprintf(lbl_setting + _len, sizeof(lbl_setting) - _len, "%d", i + 1); + strlcat(lbl_setting, "_joypad_index", sizeof(lbl_setting)); - snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1); - - if (!string_is_equal(label, label_setting)) + if (!string_is_equal(label, lbl_setting)) continue; BIND_ACTION_RIGHT(cbs, bind_right_generic); @@ -1162,8 +1162,8 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, return 0; } - if ( strstr(label, "rdb_entry") || - string_starts_with_size(label, "content_info", STRLEN_CONST("content_info"))) + if ( strstr(label, "rdb_entry") + || string_starts_with_size(label, "content_info", STRLEN_CONST("content_info"))) { BIND_ACTION_RIGHT(cbs, action_right_scroll); } diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index d8090df6e8..0703ac8c68 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -1282,10 +1282,16 @@ static int action_bind_sublabel_systeminfo_controller_entry( } } - snprintf(tmp, sizeof(tmp), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PORT_DEVICE_INFO), - input_config_get_device_display_name(controller) ? input_config_get_device_display_name(controller) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), - input_config_get_device_display_name(controller) ? input_config_get_device_config_name(controller) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), - input_config_get_device_vid(controller), input_config_get_device_pid(controller)); + snprintf(tmp, sizeof(tmp), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PORT_DEVICE_INFO), + input_config_get_device_display_name(controller) + ? input_config_get_device_display_name(controller) + : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), + input_config_get_device_display_name(controller) + ? input_config_get_device_config_name(controller) + : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), + input_config_get_device_vid(controller), + input_config_get_device_pid(controller)); strlcpy(s, tmp, len); return 0; @@ -1316,8 +1322,9 @@ static int action_bind_sublabel_cpu_policy_entry_list( int idx = atoi(path); if (drivers) { - snprintf(s, len, "%s | Freq: %u MHz\n", drivers[idx]->scaling_governor, - drivers[idx]->current_frequency / 1000); + size_t _len = strlcpy(s, drivers[idx]->scaling_governor, len); + snprintf(s + _len, len - _len, " | Freq: %u MHz\n", + drivers[idx]->current_frequency / 1000); return 0; } @@ -1370,10 +1377,11 @@ static int action_bind_sublabel_subsystem_add( if (subsystem && runloop_st->subsystem_current_count > 0) { if (content_get_subsystem_rom_id() < subsystem->num_roms) - snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SUBSYSTEM_CONTENT_INFO), - content_get_subsystem() == type - MENU_SETTINGS_SUBSYSTEM_ADD - ? subsystem->roms[content_get_subsystem_rom_id()].desc - : subsystem->roms[0].desc); + snprintf(s, len, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SUBSYSTEM_CONTENT_INFO), + (content_get_subsystem() == type - MENU_SETTINGS_SUBSYSTEM_ADD) + ? subsystem->roms[content_get_subsystem_rom_id()].desc + : subsystem->roms[0].desc); } return 0; @@ -1431,13 +1439,12 @@ static int action_bind_sublabel_remap_kbd_sublabel( unsigned user_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) / RARCH_ANALOG_BIND_LIST_END; size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PORT), len); - snprintf(s + _len, len - _len, " %u: %s", - user_idx + 1, - input_config_get_device_display_name(user_idx) ? - input_config_get_device_display_name(user_idx) : - (input_config_get_device_name(user_idx) ? - input_config_get_device_name(user_idx) : - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); + snprintf(s + _len, len - _len, " %u: %s", user_idx + 1, + input_config_get_device_display_name(user_idx) + ? input_config_get_device_display_name(user_idx) + : (input_config_get_device_name(user_idx) + ? input_config_get_device_name(user_idx) + : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); return 0; } @@ -1448,6 +1455,7 @@ static int action_bind_sublabel_audio_mixer_stream( const char *label, const char *path, char *s, size_t len) { + size_t _len; char msg[64]; unsigned offset = (type - MENU_SETTINGS_AUDIO_MIXER_STREAM_BEGIN); audio_mixer_stream_t *stream = audio_driver_mixer_get_stream(offset); @@ -1484,7 +1492,8 @@ static int action_bind_sublabel_audio_mixer_stream( break; } - snprintf(s, len, "%s | %s: %.2f dB", msg, + _len = strlcpy(s, msg, len); + snprintf(s + _len, len - _len, " | %s: %.2f dB", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME), stream->volume); return 0; @@ -1511,16 +1520,15 @@ static int action_bind_sublabel_remap_sublabel( * the port to which the corresponding * controller is connected... */ port = settings->uints.input_joypad_index[port]; - _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PORT), len); snprintf(s + _len, len - _len, " %u: %s", port + 1, - input_config_get_device_display_name(port) ? - input_config_get_device_display_name(port) : - (input_config_get_device_name(port) ? - input_config_get_device_name(port) : - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); + input_config_get_device_display_name(port) + ? input_config_get_device_display_name(port) + : (input_config_get_device_name(port) + ? input_config_get_device_name(port) + : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); return 0; } @@ -1587,6 +1595,7 @@ static int action_bind_sublabel_netplay_room(file_list_t *list, const char *label, const char *path, char *s, size_t len) { + size_t _len; char buf[512]; struct netplay_room *room; net_driver_state_t *net_st = networking_state_get_ptr(); @@ -1596,12 +1605,12 @@ static int action_bind_sublabel_netplay_room(file_list_t *list, return -1; room = &net_st->room_list[room_index]; + _len = strlcpy(s, msg_hash_to_str(MSG_PROGRAM), len); - snprintf(s, len, - "%s: %s (%s)\n" + snprintf(s + _len, len - _len, + ": %s (%s)\n" "%s: %s (%s)\n" "%s: %s ", - msg_hash_to_str(MSG_PROGRAM), !string_is_empty(room->retroarch_version) ? room->retroarch_version : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), (!string_is_empty(room->frontend) && @@ -1616,13 +1625,12 @@ static int action_bind_sublabel_netplay_room(file_list_t *list, room->gamename : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)); - if (string_is_empty(room->subsystem_name) || - string_is_equal_case_insensitive(room->subsystem_name, "N/A")) + if ( string_is_empty(room->subsystem_name) + || string_is_equal_case_insensitive(room->subsystem_name, "N/A")) snprintf(buf, sizeof(buf), "(%08lX)", (unsigned long)(unsigned)room->gamecrc); else { - size_t _len; buf[0 ] = '('; buf[1 ] = '\0'; _len = strlcat(buf, room->subsystem_name, sizeof(buf)); @@ -5234,17 +5242,15 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, strlen(label), STRLEN_CONST("_analog_dpad_mode"))) { unsigned i; + char key_input_adc_type[64]; + size_t _len = strlcpy(key_input_adc_type, "input_player", sizeof(key_input_adc_type)); for (i = 0; i < MAX_USERS; i++) { - char key_input_adc_type[64]; - key_input_adc_type[0] = '\0'; - - snprintf(key_input_adc_type, sizeof(key_input_adc_type), - "input_player%u_analog_dpad_mode", i + 1); - + snprintf(key_input_adc_type + _len, + sizeof(key_input_adc_type) - _len, "%u", i + 1); + strlcat(key_input_adc_type, "_analog_dpad_mode", sizeof(key_input_adc_type)); if (!string_is_equal(label, key_input_adc_type)) continue; - BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_adc_type); return 0; } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b978a72ee9..1549549eca 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1886,10 +1886,11 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) if (frontend->get_os) { frontend->get_os(tmp2, sizeof(tmp2), &major, &minor); - snprintf(tmp, sizeof(tmp), "%s: %s (v%d.%d)", + len = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_OS), - tmp2, - major, minor); + sizeof(tmp)); + snprintf(tmp + len, sizeof(tmp) - len, ": %s (v%d.%d)", + tmp2, major, minor); if (menu_entries_append(list, tmp, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) @@ -1898,9 +1899,11 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) if (frontend->get_rating) { - snprintf(tmp, sizeof(tmp), "%s: %d", + len = strlcpy(tmp, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETRORATING_LEVEL), + sizeof(tmp)); + snprintf(tmp + len, sizeof(tmp) - len, ": %d", frontend->get_rating()); if (menu_entries_append(list, tmp, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, @@ -2047,10 +2050,11 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) if (video_context_driver_get_metrics(&metrics)) { - snprintf(tmp, sizeof(tmp), "%s: %.2f", + len = strlcpy(tmp, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_HEIGHT), - val); + sizeof(tmp)); + snprintf(tmp + len, sizeof(tmp) - len, ": %.2f", val); if (menu_entries_append(list, tmp, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) @@ -2061,10 +2065,11 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) if (video_context_driver_get_metrics(&metrics)) { - snprintf(tmp, sizeof(tmp), "%s: %.2f", + len = strlcpy(tmp, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_DPI), - val); + sizeof(tmp)); + snprintf(tmp + len, sizeof(tmp) - len, ": %.2f", val); if (menu_entries_append(list, tmp, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) @@ -4136,18 +4141,20 @@ static unsigned menu_displaylist_parse_playlists( #if defined(HAVE_LIBRETRODB) if (settings->bools.menu_content_show_explore) { - /* list any custom explore views above playlists */ + char label[512]; + size_t _len = strlcpy(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_VIEW), + sizeof(label)); + + /* List any custom explore views above playlists */ for (i = 0; i < list_size; i++) { - char label[512]; const char *path = str_list.elems[i].data; const char *fname = path_basename(path); const char *fext = path_get_extension(fname); if (!string_is_equal_noncase(fext, "lvw")) continue; - snprintf(label, sizeof(label), "%s: %.*s", - msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_VIEW), + snprintf(label + _len, sizeof(label) - _len, ": %.*s", (int)(fext - 1 - fname), fname); if (menu_entries_append(info_list, label, path, MENU_ENUM_LABEL_GOTO_EXPLORE, @@ -5366,8 +5373,7 @@ static int menu_displaylist_parse_input_description_list( * We need to record the current user/button indices, * and so have to convert 'info->type' to a string * and pass it as the entry label... */ - snprintf(entry_label, sizeof(entry_label), - "%u", info->type); + snprintf(entry_label, sizeof(entry_label), "%u", info->type); /* Loop over core input definitions */ for (j = 0; j < RARCH_CUSTOM_BIND_LIST_END; j++) @@ -5962,17 +5968,16 @@ static int menu_displaylist_parse_disc_info(file_list_t *info_list, char drive_string[256] = {0}; size_t pos = snprintf(drive_string, sizeof(drive_string), msg_drive_number, i + 1); - pos += snprintf(drive_string + pos, sizeof(drive_string) - pos, ": %s", list->elems[i].data); + pos += snprintf(drive_string + pos, + sizeof(drive_string) - pos, + ": %s", list->elems[i].data); drive[0] = list->elems[i].attr.i; drive[1] = '\0'; if (menu_entries_append(info_list, - drive_string, - drive, - MSG_UNKNOWN, - type, - 0, i, NULL)) + drive_string, drive, MSG_UNKNOWN, + type, 0, i, NULL)) count++; } @@ -6795,6 +6800,8 @@ unsigned menu_displaylist_build_list( case DISPLAYLIST_AUDIO_MIXER_SETTINGS_LIST: { #ifdef HAVE_AUDIOMIXER + char msg_lbl[128]; + size_t _len = strlcpy(msg_lbl, "audio_mixer_stream_", sizeof(msg_lbl)); #if 1 /* TODO - for developers - * turn this into #if 0 if you want to be able to see @@ -6805,11 +6812,9 @@ unsigned menu_displaylist_build_list( #endif { char msg[128]; - char msg_lbl[128]; snprintf(msg, sizeof(msg), msg_hash_to_str(MENU_ENUM_LABEL_MIXER_STREAM), i+1, "\n"); - snprintf(msg_lbl, sizeof(msg_lbl), "audio_mixer_stream_%d\n", i); - if (menu_entries_append(list, msg, msg_lbl, - MSG_UNKNOWN, + snprintf(msg_lbl + _len, sizeof(msg_lbl) - _len, "%d\n", i); + if (menu_entries_append(list, msg, msg_lbl, MSG_UNKNOWN, (MENU_SETTINGS_AUDIO_MIXER_STREAM_BEGIN + i), 0, 0, NULL)) count++; @@ -7572,8 +7577,8 @@ unsigned menu_displaylist_build_list( for (i = 0; i < interfaces.size; i++) { - struct net_ifinfo_entry *entry = &interfaces.entries[i]; char host_trimmed[64]; + struct net_ifinfo_entry *entry = &interfaces.entries[i]; /* Trim "%"-suffix from host */ strlcpy(host_trimmed, entry->host, sizeof(host_trimmed)); @@ -7597,13 +7602,15 @@ unsigned menu_displaylist_build_list( #ifdef HAVE_CHEATS if (cheat_manager_alloc_if_empty()) { + unsigned i; + size_t _len; + char cheat_label[128]; + char on_string[32]; + char off_string[32]; menu_search_terms_t *search_terms= menu_entries_search_get_terms(); bool search_active = search_terms && (search_terms->size > 0); unsigned num_cheats = cheat_manager_get_size(); unsigned num_cheats_shown = 0; - unsigned i; - char on_string[32]; - char off_string[32]; on_string[0] = '\0'; off_string[0] = '\0'; @@ -7692,15 +7699,13 @@ unsigned menu_displaylist_build_list( MENU_SETTING_ACTION, 0, 0, NULL)) count++; + _len = strlcpy(cheat_label, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT), sizeof(cheat_label)); + for (i = 0; i < num_cheats; i++) { const char *cheat_description = cheat_manager_get_desc(i); - char cheat_label[128]; - cheat_label[0] = '\0'; - - snprintf(cheat_label, sizeof(cheat_label), - "%s #%u: ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT), i); + snprintf(cheat_label + _len, sizeof(cheat_label) + _len, " #%u: ", i); if (!string_is_empty(cheat_description)) strlcat(cheat_label, cheat_description, sizeof(cheat_label)); @@ -7708,8 +7713,8 @@ unsigned menu_displaylist_build_list( * entries */ if (search_active) { - bool entry_valid = true; size_t j; + bool entry_valid = true; for (j = 0; j < search_terms->size; j++) { @@ -8104,12 +8109,12 @@ unsigned menu_displaylist_build_list( { if (disk_control_enabled(&sys_info->disk_control)) { + unsigned i; unsigned num_images = disk_control_get_num_images(&sys_info->disk_control); unsigned current_image = disk_control_get_image_index(&sys_info->disk_control); unsigned num_digits = 0; - unsigned i; /* If core supports labels, index value string * should be padded to maximum width (otherwise @@ -8121,8 +8126,7 @@ unsigned menu_displaylist_build_list( { num_digits++; digit_counter = digit_counter / 10; - } - while (digit_counter > 0); + } while (digit_counter > 0); } /* Loop through disk images */ @@ -8377,19 +8381,17 @@ unsigned menu_displaylist_build_list( count++; } - { - cheat_label[0] = '\0'; - snprintf(cheat_label, sizeof(cheat_label), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES), - cheat_manager_state.num_matches); + cheat_label[0] = '\0'; + snprintf(cheat_label, sizeof(cheat_label), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES), + cheat_manager_state.num_matches); - if (menu_entries_append(list, - cheat_label, - msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADD_MATCHES), - MENU_ENUM_LABEL_CHEAT_ADD_MATCHES, - MENU_SETTING_ACTION, 0, 0, NULL)) - count++; - } + if (menu_entries_append(list, + cheat_label, + msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADD_MATCHES), + MENU_ENUM_LABEL_CHEAT_ADD_MATCHES, + MENU_SETTING_ACTION, 0, 0, NULL)) + count++; if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, MENU_ENUM_LABEL_CHEAT_DELETE_MATCH, @@ -8409,14 +8411,15 @@ unsigned menu_displaylist_build_list( cheat_label[0] = '\0'; - cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_VIEW, cheat_manager_state.match_idx, &address, &address_mask, &prev_val, &curr_val) ; + cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_VIEW, + cheat_manager_state.match_idx, + &address, &address_mask, &prev_val, &curr_val) ; snprintf(cheat_label, sizeof(cheat_label), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_MATCH), address, address_mask); + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_MATCH), + address, address_mask); if (menu_entries_append(list, - cheat_label, - "", - MSG_UNKNOWN, + cheat_label, "", MSG_UNKNOWN, MENU_SETTINGS_CHEAT_MATCH, 0, 0, NULL)) count++; } @@ -8429,13 +8432,11 @@ unsigned menu_displaylist_build_list( { rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_DELETE_MATCH); if (setting) - setting->max = cheat_manager_state.num_matches-1; - setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_COPY_MATCH); - if (setting) - setting->max = cheat_manager_state.num_matches-1; - setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY); - if (setting) - setting->max = cheat_manager_state.total_memory_size>0?cheat_manager_state.total_memory_size-1:0 ; + setting->max = cheat_manager_state.num_matches-1; + if ((setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_COPY_MATCH))) + setting->max = cheat_manager_state.num_matches-1; + if ((setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY))) + setting->max = cheat_manager_state.total_memory_size>0?cheat_manager_state.total_memory_size-1:0 ; } } #endif @@ -11374,7 +11375,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; if (selection >= count) info->flags |= MD_FLAG_NEED_CLEAR; } @@ -11399,23 +11400,20 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, if ((file = filestream_open(file_path, RETRO_VFS_FILE_ACCESS_READ, 0))) { - const cdrom_toc_t *toc = retro_vfs_file_get_cdrom_toc(); + unsigned i; + const cdrom_toc_t *toc = retro_vfs_file_get_cdrom_toc(); unsigned first_data_track = 1; - - atip = cdrom_has_atip(filestream_get_vfs_handle(file)); + atip = cdrom_has_atip( + filestream_get_vfs_handle(file)); filestream_close(file); + for (i = 0; i < toc->num_tracks; i++) { - unsigned i; - - for (i = 0; i < toc->num_tracks; i++) + if (!toc->track[i].audio) { - if (!toc->track[i].audio) - { - first_data_track = i + 1; - break; - } + first_data_track = i + 1; + break; } } @@ -11427,8 +11425,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, { if (!string_is_empty(cd_info.title)) { - char title[sizeof("Title: ")+sizeof(cd_info.title)]; - snprintf(title, sizeof(title), "Title: %s", cd_info.title); + char title[sizeof("Title: ") + sizeof(cd_info.title)]; /* TODO/FIXME - C89 compliance */ + strlcpy(title, "Title: ", sizeof(title)); + strlcat(title, cd_info.title, sizeof(title)); if (menu_entries_append(info->list, title, @@ -11473,10 +11472,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, if (!string_is_empty(cd_info.version)) { char version[256]; - /* TODO/FIXME - why are we using a Qt core version string - * message here? */ - snprintf(version, sizeof(version), - "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE_VERSION), cd_info.version); + /* TODO/FIXME - localize */ + strlcpy(version, "Version: ", sizeof(version)); + strlcat(version, cd_info.version, sizeof(version)); if (menu_entries_append(info->list, version, @@ -11585,7 +11583,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, cdrom_lba_to_msf(toc->track[i].track_size, &min, &sec, &frame); - snprintf(length_string + strlen(length_string), sizeof(length_string) - strlen(length_string), "%02d:%02d.%02d", min, sec, frame); + snprintf(length_string + strlen(length_string), + sizeof(length_string) - strlen(length_string), + "%02d:%02d.%02d", min, sec, frame); if (menu_entries_append(info->list, length_string, @@ -11605,6 +11605,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } else { + /* TODO/FIXME - localize */ RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n"); runloop_msg_queue_push( @@ -11621,8 +11622,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; break; } case DISPLAYLIST_LOAD_DISC: @@ -11638,8 +11639,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; break; #else case DISPLAYLIST_CDROM_DETAIL_INFO: @@ -11760,18 +11761,17 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE *profile = NULL; #endif const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]); - - runloop_msg_queue_push("Warning : extended overclocking can damage the Switch", 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - + /* TODO/FIXME - localize */ + runloop_msg_queue_push("Warning : extended overclocking can damage the Switch", + 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - #ifdef HAVE_LAKKA_SWITCH profile = popen("cpu-profile get", "r"); fgets(current_profile, PATH_MAX_LENGTH, profile); pclose(profile); - - snprintf(text, sizeof(text), - "Current profile: %s", current_profile); + /* TODO/FIXME - localize */ + snprintf(text, sizeof(text), "Current profile: %s", + current_profile); #else u32 currentClock = 0; if (hosversionBefore(8, 0, 0)) @@ -11783,13 +11783,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, clkrstGetClockRate(&session, ¤tClock); clkrstCloseSession(&session); } - snprintf(text, sizeof(text), "Current Clock : %i", currentClock); + snprintf(text, sizeof(text), "Current Clock: %i", currentClock); #endif if (menu_entries_append(info->list, - text, - "", - 0, - MENU_INFO_MESSAGE, 0, 0, NULL)) + text, "", 0, MENU_INFO_MESSAGE, + 0, 0, NULL)) count++; for (i = 0; i < profiles_count; i++) @@ -11797,21 +11795,17 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, char title[PATH_MAX_LENGTH]; char* profile = SWITCH_CPU_PROFILES[i]; char* speed = SWITCH_CPU_SPEEDS[i]; - title[0] = '\0'; - - snprintf(title, sizeof(title), "%s (%s)", profile, speed); - + size_t _len = strlcpy(title, profile, sizeof(title)); + snprintf(title + _len, sizeof(title) - _len, " (%s)", speed); if (menu_entries_append(info->list, - title, - "", - 0, MENU_SET_SWITCH_CPU_PROFILE, 0, i, NULL)) + title, "", 0, MENU_SET_SWITCH_CPU_PROFILE, 0, + i, NULL)) count++; - } info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; break; } #if defined(HAVE_LAKKA_SWITCH) @@ -11823,7 +11817,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE *profile = NULL; const size_t profiles_count = sizeof(SWITCH_GPU_PROFILES)/sizeof(SWITCH_GPU_PROFILES[1]); - runloop_msg_queue_push("Warning : extended overclocking can damage the Switch", 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); + runloop_msg_queue_push("Warning : extended overclocking can damage the Switch", + 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); profile = popen("gpu-profile get", "r"); fgets(current_profile, PATH_MAX_LENGTH, profile); @@ -11832,8 +11827,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); /* TODO/FIXME - Localize */ - snprintf(text, sizeof(text), - "Current profile : %s", current_profile); + strlcpy(text, "Current profile : ", sizeof(text)); + strlcat(text, current_profile, sizeof(text)); if (menu_entries_append(info->list, text, "", 0, MENU_INFO_MESSAGE, 0, 0, NULL)) count++; @@ -11843,16 +11838,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, char title[PATH_MAX_LENGTH]; char* profile = SWITCH_GPU_PROFILES[i]; char* speed = SWITCH_GPU_SPEEDS[i]; - - snprintf(title, sizeof(title), "%s (%s)", profile, speed); + size_t _len = strlcpy(title, profile, sizeof(title)); + snprintf(title + _len, sizeof(title)i - _len, " (%s)", speed); if (menu_entries_append(info->list, title, "", 0, MENU_SET_SWITCH_GPU_PROFILE, 0, i, NULL)) count++; } info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; break; } #endif /* HAVE_LAKKA_SWITCH */ @@ -11914,8 +11909,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, MENU_SETTING_NO_ITEM, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; break; case DISPLAYLIST_MIXER_STREAM_SETTINGS_LIST: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -12002,8 +11997,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; break; case DISPLAYLIST_NETPLAY_LAN_SCAN_SETTINGS_LIST: case DISPLAYLIST_OPTIONS_MANAGEMENT: @@ -12028,7 +12023,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DATABASE_ENTRY: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -12117,8 +12112,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_SORT - | MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_REFRESH + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_OPTIONS_SHADERS: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -12230,7 +12225,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, { size_t _len2; char buf[128]; - snprintf(buf_tmp + _len, sizeof(buf_tmp) - _len," #%u", i); + snprintf(buf_tmp + _len, sizeof(buf_tmp) - _len, " #%u", i); if (menu_entries_append(info->list, buf_tmp, shdr_pass, MENU_ENUM_LABEL_VIDEO_SHADER_PASS, @@ -12283,8 +12278,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; #endif break; case DISPLAYLIST_CORE_CONTENT_DIRS_SUBDIR: @@ -12314,8 +12309,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; string_list_deinitialize(&str_list); #endif @@ -12342,8 +12337,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; #endif } break; @@ -12362,8 +12357,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; #endif break; case DISPLAYLIST_CORES_UPDATER: @@ -12447,7 +12442,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_THUMBNAILS_UPDATER: #ifdef HAVE_NETWORKING @@ -12464,8 +12459,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; #endif break; case DISPLAYLIST_PL_THUMBNAILS_UPDATER: @@ -12482,8 +12477,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; #endif break; case DISPLAYLIST_LAKKA: @@ -12501,8 +12496,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_CLEAR; #endif break; case DISPLAYLIST_PLAYLIST_COLLECTION: @@ -12534,14 +12529,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, char path_playlist[PATH_MAX_LENGTH]; playlist_t *playlist = NULL; const char *dir_playlist = settings->paths.directory_playlist; - fill_pathname_join_special( - path_playlist, - dir_playlist, - info->path, + fill_pathname_join_special(path_playlist, dir_playlist, info->path, sizeof(path_playlist)); - menu_displaylist_set_new_playlist(menu, - settings, path_playlist, true); + menu_displaylist_set_new_playlist(menu, settings, path_playlist, + true); strlcpy(path_playlist, msg_hash_to_str(MENU_ENUM_LABEL_COLLECTION), @@ -12563,8 +12555,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, * > Display lists generated from playlists * must never be sorted */ info->flags &= ~MD_FLAG_NEED_SORT; - info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + info->flags |= MD_FLAG_NEED_REFRESH + | MD_FLAG_NEED_PUSH; } } break; @@ -12576,9 +12568,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); if (history_list_enable) count = menu_displaylist_parse_playlist_generic( - menu, info, - settings, - "history", + menu, info, settings, "history", path_content_history, false, /* Not a collection */ false, /* Do not sort */ @@ -12598,10 +12588,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, * > Display lists generated from playlists * must never be sorted */ info->flags &= ~MD_FLAG_NEED_SORT; - info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + info->flags |= MD_FLAG_NEED_REFRESH + | MD_FLAG_NEED_PUSH; if (history_needs_navigation_clear(menu, g_defaults.content_history)) - info->flags |= MD_FLAG_NEED_NAVIGATION_CLEAR; + info->flags |= MD_FLAG_NEED_NAVIGATION_CLEAR; break; case DISPLAYLIST_FAVORITES: { @@ -12609,9 +12599,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); count = menu_displaylist_parse_playlist_generic(menu, info, - settings, - "favorites", - path_content_favorites, + settings, "favorites", path_content_favorites, false, /* Not a conventional collection */ true, /* Enable sorting (if allowed by user config) */ &ret); @@ -12632,8 +12620,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, * > Display lists generated from playlists * must never be sorted */ info->flags &= ~MD_FLAG_NEED_SORT; - info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + info->flags |= MD_FLAG_NEED_REFRESH + | MD_FLAG_NEED_PUSH; } break; case DISPLAYLIST_MUSIC_HISTORY: @@ -12671,10 +12659,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, * > Display lists generated from playlists * must never be sorted */ info->flags &= ~MD_FLAG_NEED_SORT; - info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + info->flags |= MD_FLAG_NEED_REFRESH + | MD_FLAG_NEED_PUSH; if (history_needs_navigation_clear(menu, g_defaults.music_history)) - info->flags |= MD_FLAG_NEED_NAVIGATION_CLEAR; + info->flags |= MD_FLAG_NEED_NAVIGATION_CLEAR; } break; case DISPLAYLIST_VIDEO_HISTORY: @@ -12748,8 +12736,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, MENU_ENUM_LABEL_DETECT_CORE_LIST_OK_CURRENT_CORE); info->flags &= ~MD_FLAG_NEED_SORT; - info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + info->flags |= MD_FLAG_NEED_REFRESH + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_CORES_COLLECTION_SUPPORTED: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -12760,8 +12748,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE); info->flags &= ~MD_FLAG_NEED_SORT; - info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + info->flags |= MD_FLAG_NEED_REFRESH + | MD_FLAG_NEED_PUSH; core_selected = true; break; case DISPLAYLIST_CORE_INFO: @@ -12787,7 +12775,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, if (selection >= count) info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_NAVIGATION_CLEAR; + | MD_FLAG_NEED_NAVIGATION_CLEAR; info->flags |= MD_FLAG_NEED_PUSH; } break; @@ -12796,15 +12784,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, count = menu_displaylist_parse_core_backup_list( info->list, info->path, settings, true); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_CORE_DELETE_BACKUP_LIST: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); count = menu_displaylist_parse_core_backup_list( info->list, info->path, settings, false); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_NAVIGATION_CLEAR; + | MD_FLAG_NEED_PUSH + | MD_FLAG_NEED_NAVIGATION_CLEAR; break; case DISPLAYLIST_CORE_MANAGER_LIST: { @@ -12843,7 +12831,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, count = menu_displaylist_parse_core_manager_steam_list(info->list, settings); info->flags &= ~MD_FLAG_NEED_REFRESH; info->flags |= MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_NAVIGATION_CLEAR; + | MD_FLAG_NEED_NAVIGATION_CLEAR; /* No core dlcs were found */ if (count == 0) @@ -12860,7 +12848,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, info->flags &= ~MD_FLAG_NEED_REFRESH; info->flags |= MD_FLAG_NEED_PUSH - | MD_FLAG_NEED_NAVIGATION_CLEAR; + | MD_FLAG_NEED_NAVIGATION_CLEAR; count = menu_displaylist_parse_core_information_steam(info->list, info->path, settings); @@ -13100,7 +13088,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, if (selection >= count) info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_NAVIGATION_CLEAR; + | MD_FLAG_NEED_NAVIGATION_CLEAR; info->flags |= MD_FLAG_NEED_PUSH; } break; @@ -13131,7 +13119,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, if (selection >= count) info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_NAVIGATION_CLEAR; + | MD_FLAG_NEED_NAVIGATION_CLEAR; info->flags |= MD_FLAG_NEED_PUSH; } break; @@ -13161,7 +13149,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, if (selection >= count) info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_NAVIGATION_CLEAR; + | MD_FLAG_NEED_NAVIGATION_CLEAR; info->flags |= MD_FLAG_NEED_PUSH; } break; @@ -13219,7 +13207,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, MENU_SETTING_DROPDOWN_ITEM_VIDEO_SHADER_PARAM); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_VIDEO_SHADER_PRESET_PARAMETER: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -13229,7 +13217,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, MENU_SETTINGS_SHADER_PRESET_PARAMETER_0, MENU_SETTING_DROPDOWN_ITEM_VIDEO_SHADER_PRESET_PARAM); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_INPUT_DEVICE_TYPE: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -13243,7 +13231,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL)) count++; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; #ifdef ANDROID case DISPLAYLIST_DROPDOWN_LIST_INPUT_SELECT_PHYSICAL_KEYBOARD: @@ -13258,7 +13246,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL)) count++; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; #endif case DISPLAYLIST_DROPDOWN_LIST_INPUT_DESCRIPTION: @@ -13273,7 +13261,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL)) count++; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_INPUT_DESCRIPTION_KBD: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -13287,7 +13275,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL)) count++; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_AUDIO_DEVICE: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -13301,7 +13289,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, FILE_TYPE_NONE, 0, 0, NULL)) count++; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; #ifdef HAVE_NETWORKING case DISPLAYLIST_DROPDOWN_LIST_NETPLAY_MITM_SERVER: @@ -13317,7 +13305,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, count++; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; #endif case DISPLAYLIST_SAVING_SETTINGS_LIST: @@ -13507,7 +13495,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; /* Special pass */ switch (type) @@ -13532,14 +13520,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, * must never be sorted */ info->flags &= ~MD_FLAG_NEED_SORT; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); ret = menu_displaylist_parse_horizontal_content_actions (menu, settings, info->list); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; if (core_selected) { @@ -13800,7 +13788,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, ret = 0; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_MAIN_MENU: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -14037,7 +14025,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, ret = MENU_DISPLAYLIST_PARSE_SETTINGS(info->list, lbl, PARSE_NONE, true, MENU_SETTINGS_INPUT_BEGIN); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; } break; case DISPLAYLIST_DATABASES: @@ -14185,7 +14173,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, * must never be sorted */ info->flags &= ~MD_FLAG_NEED_SORT; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_IMAGES_HISTORY: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -14221,7 +14209,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, * must never be sorted */ info->flags &= ~MD_FLAG_NEED_SORT; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; #if defined(HAVE_IMAGEVIEWER) if (history_needs_navigation_clear(menu, g_defaults.image_history)) info->flags |= MD_FLAG_NEED_NAVIGATION_CLEAR; @@ -14346,7 +14334,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, MENU_SETTING_NO_ITEM, 0, 0, NULL); info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; } break; case DISPLAYLIST_CORES: @@ -14379,7 +14367,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, msg_hash_to_str(MENU_ENUM_LABEL_CORE_LIST))) info->flags |= MD_FLAG_PUSH_BUILTIN_CORES; info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DEFAULT: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -14716,7 +14704,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; } break; case DISPLAYLIST_DROPDOWN_LIST_VIDEO_SHADER_NUM_PASSES: @@ -14750,7 +14738,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; } #endif break; @@ -15047,7 +15035,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_NONE: break; @@ -15096,7 +15084,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } info->flags |= MD_FLAG_NEED_REFRESH - | MD_FLAG_NEED_PUSH; + | MD_FLAG_NEED_PUSH; } if (ret != 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 402630e56d..26d52a6e8f 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -625,16 +625,6 @@ static int setting_bind_action_start(rarch_setting_t *setting) return 0; } -#if 0 -static void setting_get_string_representation_hex(rarch_setting_t *setting, - char *s, size_t len) -{ - if (setting) - snprintf(s, len, "%08x", - *setting->value.target.unsigned_integer); -} -#endif - void setting_get_string_representation_hex_and_uint( rarch_setting_t *setting, char *s, size_t len) { @@ -6198,12 +6188,9 @@ static void setting_get_string_representation_video_frame_delay(rarch_setting_t if (*setting->value.target.unsigned_integer == 0) { - if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST))) - snprintf(s, len, "%s", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY_AUTOMATIC)); - else - snprintf(s, len, "%s (%u %s)", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY_AUTOMATIC), + size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY_AUTOMATIC), len); + if (!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST))) + snprintf(s + _len, len - _len, " (%u %s)", video_st->frame_delay_effective, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY_EFFECTIVE)); } @@ -6694,8 +6681,6 @@ static void setting_get_string_representation_uint_user_language( { const char *modes[RETRO_LANGUAGE_LAST]; uint32_t translated[RETRO_LANGUAGE_LAST]; - const char *rating; - #define LANG_DATA(STR) \ modes[RETRO_LANGUAGE_##STR] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_##STR); \ translated[RETRO_LANGUAGE_##STR] = LANGUAGE_PROGRESS_##STR##_TRANSLATED; \ @@ -6745,18 +6730,17 @@ static void setting_get_string_representation_uint_user_language( LANG_DATA(HUNGARIAN) if (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE) == RETRO_LANGUAGE_ENGLISH) + snprintf(s, len, "%s", modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)]); + else { - snprintf(s, len, "%s", - modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)]); - } else { - rating = msg_hash_to_str( - translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 95 ? MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_95_PLUS : - translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 74 ? MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_75_PLUS : - translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 49 ? MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_50_PLUS : - translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 24 ? MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_25_PLUS : - MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_25_MINUS); + const char *rating = msg_hash_to_str( + translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 95 ? MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_95_PLUS : + translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 74 ? MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_75_PLUS : + translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 49 ? MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_50_PLUS : + translated[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)] > 24 ? MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_25_PLUS : + MENU_ENUM_LABEL_VALUE_LNG_COMPLETION_25_MINUS); snprintf(s, len, "%s [%s]", - modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], rating); + modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], rating); } } #endif @@ -7598,15 +7582,11 @@ static void get_string_representation_input_device_index( if (!string_is_empty(device_name)) { unsigned idx = input_config_get_device_name_index(map); + size_t _len = strlcpy(s, device_name, len); /* If idx is non-zero, it's part of a set */ if (idx > 0) - snprintf(s, len, - "%s (%u)", - device_name, - idx); - else - strlcpy(s, device_name, len); + snprintf(s + _len, len - _len, " (%u)", idx); } else snprintf(s, len, diff --git a/retroarch.c b/retroarch.c index 44ec096c11..d05602122c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2252,39 +2252,29 @@ bool command_event(enum event_command cmd, void *data) settings->bools.run_ahead_enabled = !(settings->bools.run_ahead_enabled); - if (!settings->bools.run_ahead_enabled) - { - runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_DISABLED), - 1, 100, false, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - } - else + if (settings->bools.run_ahead_enabled) { char msg[256]; - - if (!settings->bools.run_ahead_secondary_instance) - { - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_RUNAHEAD_ENABLED), + if (settings->bools.run_ahead_secondary_instance) + snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_RUNAHEAD_ENABLED_WITH_SECOND_INSTANCE), settings->uints.run_ahead_frames); - - runloop_msg_queue_push( - msg, 1, 100, false, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - } else - { - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_RUNAHEAD_ENABLED_WITH_SECOND_INSTANCE), + snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_RUNAHEAD_ENABLED), settings->uints.run_ahead_frames); - - runloop_msg_queue_push( - msg, 1, 100, false, - NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - } + runloop_msg_queue_push(msg, 1, 100, false, + NULL, MESSAGE_QUEUE_ICON_DEFAULT, + MESSAGE_QUEUE_CATEGORY_INFO); /* Disable preemptive frames */ settings->bools.preemptive_frames_enable = false; preempt_deinit(runloop_st); } + else + runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_DISABLED), + 1, 100, false, + NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); } #endif break; @@ -2303,11 +2293,9 @@ bool command_event(enum event_command cmd, void *data) settings->bools.preemptive_frames_hide_warnings = old_warn; if (old_inited && !runloop_st->preempt_data) - { runloop_msg_queue_push(msg_hash_to_str(MSG_PREEMPT_DISABLED), 1, 100, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - } else if (runloop_st->preempt_data) { char msg[256]; diff --git a/tasks/task_content.c b/tasks/task_content.c index e750cda267..032e6a19a1 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -781,6 +781,7 @@ static bool content_file_extract_from_archive( tmp_path[0] = '\0'; msg[0] = '\0'; + /* TODO/FIXME - localize */ RARCH_LOG("[Content]: Core requires uncompressed content - " "extracting archive to temporary directory.\n"); @@ -808,6 +809,7 @@ static bool content_file_extract_from_archive( /* Update content path pointer */ *content_path = tmp_path_ptr; + /* TODO/FIXME - localize */ RARCH_LOG("[Content]: Content successfully extracted to: \"%s\".\n", tmp_path); @@ -1071,7 +1073,7 @@ static bool content_file_load( * (This disclaimer is out dated but I don't want to remove it)*/ if (!CopyFileFromAppW(wcontent_path, wnew_path, false)) { - int err = GetLastError(); + /* TODO/FIXME - localize */ snprintf(msg, sizeof(msg), "%s \"%s\". (during copy read or write)\n", msg_hash_to_str(MSG_COULD_NOT_READ_CONTENT_FILE), content_path); @@ -1175,6 +1177,7 @@ static const struct retro_subsystem_info *content_file_init_subsystem( if (!special) { + /* TODO/FIXME - localize */ snprintf(msg, sizeof(msg), "Failed to find subsystem \"%s\" in libretro implementation.\n", path_get(RARCH_PATH_SUBSYSTEM)); @@ -1192,6 +1195,7 @@ static const struct retro_subsystem_info *content_file_init_subsystem( if (special->num_roms != subsystem->size) { + /* TODO/FIXME - localize */ snprintf(msg, sizeof(msg), "Libretro core requires %u content files for " "subsystem \"%s\", but %u content files were provided.\n", @@ -1203,6 +1207,7 @@ static const struct retro_subsystem_info *content_file_init_subsystem( } else if (subsystem && subsystem->size) { + /* TODO/FIXME - localize */ snprintf(msg, sizeof(msg), "Libretro core takes no content for subsystem \"%s\", " "but %u content files were provided.\n",