From 7087582a3674792442d47a3f15caab268d51a87d Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 14 Nov 2024 21:04:23 +0100 Subject: [PATCH] overlays: translate home menu settings Also fix potential lambda text capture issue --- .../HomeMenu/overlay_home_menu_settings.cpp | 99 +++++++++---------- .../HomeMenu/overlay_home_menu_settings.h | 52 ++++++---- rpcs3/Emu/localized_string_id.h | 49 +++++++++ rpcs3/rpcs3qt/gui_application.h | 1 - rpcs3/rpcs3qt/localized_emu.h | 49 +++++++++ 5 files changed, 178 insertions(+), 72 deletions(-) diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp index c63802e366..d1dfeb3932 100644 --- a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp @@ -3,7 +3,6 @@ #include "overlay_home_menu_components.h" #include "Emu/system_config.h" -// TODO: Localization of the setting names // TODO: Localization of the dropdown values namespace rsx @@ -27,14 +26,14 @@ namespace rsx home_menu_settings_audio::home_menu_settings_audio(s16 x, s16 y, u16 width, u16 height, bool use_separators, home_menu_page* parent) : home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_AUDIO)) { - add_signed_slider(&g_cfg.audio.volume, "Master Volume", " %", 1); - add_dropdown(&g_cfg.audio.renderer, "Audio Backend"); + add_signed_slider(&g_cfg.audio.volume, "Master Volume", localized_string_id::HOME_MENU_SETTINGS_AUDIO_MASTER_VOLUME, " %", 1); + add_dropdown(&g_cfg.audio.renderer, "Audio Backend", localized_string_id::HOME_MENU_SETTINGS_AUDIO_BACKEND); - add_checkbox(&g_cfg.audio.enable_buffering, "Enable Buffering"); - add_signed_slider(&g_cfg.audio.desired_buffer_duration, "Desired Audio Buffer Duration", " ms", 1); + add_checkbox(&g_cfg.audio.enable_buffering, "Enable Buffering", localized_string_id::HOME_MENU_SETTINGS_AUDIO_BUFFERING); + add_signed_slider(&g_cfg.audio.desired_buffer_duration, "Desired Audio Buffer Duration", localized_string_id::HOME_MENU_SETTINGS_AUDIO_BUFFER_DURATION, " ms", 1); - add_checkbox(&g_cfg.audio.enable_time_stretching, "Enable Time Stretching"); - add_signed_slider(&g_cfg.audio.time_stretching_threshold, "Time Stretching Threshold", " %", 1); + add_checkbox(&g_cfg.audio.enable_time_stretching, "Enable Time Stretching", localized_string_id::HOME_MENU_SETTINGS_AUDIO_TIME_STRETCHING); + add_signed_slider(&g_cfg.audio.time_stretching_threshold, "Time Stretching Threshold", localized_string_id::HOME_MENU_SETTINGS_AUDIO_TIME_STRETCHING_THRESHOLD, " %", 1); apply_layout(); } @@ -42,16 +41,16 @@ namespace rsx home_menu_settings_video::home_menu_settings_video(s16 x, s16 y, u16 width, u16 height, bool use_separators, home_menu_page* parent) : home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_VIDEO)) { - add_dropdown(&g_cfg.video.frame_limit, "Frame Limit"); - add_unsigned_slider(&g_cfg.video.anisotropic_level_override, "Anisotropic Filter Override", "x", 2, {{0, "Auto"}}, {14}); + add_dropdown(&g_cfg.video.frame_limit, "Frame Limit", localized_string_id::HOME_MENU_SETTINGS_VIDEO_FRAME_LIMIT); + add_unsigned_slider(&g_cfg.video.anisotropic_level_override, "Anisotropic Filter Override", localized_string_id::HOME_MENU_SETTINGS_VIDEO_ANISOTROPIC_OVERRIDE, "x", 2, {{0, "Auto"}}, {14}); - add_dropdown(&g_cfg.video.output_scaling, "Output Scaling"); + add_dropdown(&g_cfg.video.output_scaling, "Output Scaling", localized_string_id::HOME_MENU_SETTINGS_VIDEO_OUTPUT_SCALING); if (g_cfg.video.renderer == video_renderer::vulkan && g_cfg.video.output_scaling == output_scaling_mode::fsr) { - add_unsigned_slider(&g_cfg.video.vk.rcas_sharpening_intensity, "FidelityFX CAS Sharpening Intensity", " %", 1); + add_unsigned_slider(&g_cfg.video.vk.rcas_sharpening_intensity, "FidelityFX CAS Sharpening Intensity", localized_string_id::HOME_MENU_SETTINGS_VIDEO_RCAS_SHARPENING, " %", 1); } - add_checkbox(&g_cfg.video.stretch_to_display_area, "Stretch To Display Area"); + add_checkbox(&g_cfg.video.stretch_to_display_area, "Stretch To Display Area", localized_string_id::HOME_MENU_SETTINGS_VIDEO_STRETCH_TO_DISPLAY); apply_layout(); } @@ -59,15 +58,15 @@ namespace rsx home_menu_settings_advanced::home_menu_settings_advanced(s16 x, s16 y, u16 width, u16 height, bool use_separators, home_menu_page* parent) : home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_ADVANCED)) { - add_signed_slider(&g_cfg.core.preferred_spu_threads, "Preferred SPU Threads", "", 1); - add_unsigned_slider(&g_cfg.core.max_cpu_preempt_count_per_frame, "Max Power Saving CPU-Preemptions", "", 1); - add_checkbox(&g_cfg.core.rsx_accurate_res_access, "Accurate RSX reservation access"); - add_dropdown(&g_cfg.core.sleep_timers_accuracy, "Sleep Timers Accuracy"); - add_signed_slider(&g_cfg.core.max_spurs_threads, "Max SPURS Threads", "", 1); + add_signed_slider(&g_cfg.core.preferred_spu_threads, "Preferred SPU Threads", localized_string_id::HOME_MENU_SETTINGS_ADVANCED_PREFERRED_SPU_THREADS, "", 1); + add_unsigned_slider(&g_cfg.core.max_cpu_preempt_count_per_frame, "Max Power Saving CPU-Preemptions", localized_string_id::HOME_MENU_SETTINGS_ADVANCED_MAX_CPU_PREEMPTIONS, "", 1); + add_checkbox(&g_cfg.core.rsx_accurate_res_access, "Accurate RSX reservation access", localized_string_id::HOME_MENU_SETTINGS_ADVANCED_ACCURATE_RSX_RESERVATION_ACCESS); + add_dropdown(&g_cfg.core.sleep_timers_accuracy, "Sleep Timers Accuracy", localized_string_id::HOME_MENU_SETTINGS_ADVANCED_SLEEP_TIMERS_ACCURACY); + add_signed_slider(&g_cfg.core.max_spurs_threads, "Max SPURS Threads", localized_string_id::HOME_MENU_SETTINGS_ADVANCED_MAX_SPURS_THREADS, "", 1); - add_unsigned_slider(&g_cfg.video.driver_wakeup_delay, "Driver Wake-Up Delay", " µs", 20, {}, {}, g_cfg.video.driver_wakeup_delay.min, 800); - add_signed_slider(&g_cfg.video.vblank_rate, "VBlank Frequency", " Hz", 30); - add_checkbox(&g_cfg.video.vblank_ntsc, "VBlank NTSC Fixup"); + add_unsigned_slider(&g_cfg.video.driver_wakeup_delay, "Driver Wake-Up Delay", localized_string_id::HOME_MENU_SETTINGS_ADVANCED_DRIVER_WAKE_UP_DELAY, " µs", 20, {}, {}, g_cfg.video.driver_wakeup_delay.min, 800); + add_signed_slider(&g_cfg.video.vblank_rate, "VBlank Frequency", localized_string_id::HOME_MENU_SETTINGS_ADVANCED_VBLANK_FREQUENCY, " Hz", 30); + add_checkbox(&g_cfg.video.vblank_ntsc, "VBlank NTSC Fixup", localized_string_id::HOME_MENU_SETTINGS_ADVANCED_VBLANK_NTSC); apply_layout(); } @@ -75,17 +74,17 @@ namespace rsx home_menu_settings_input::home_menu_settings_input(s16 x, s16 y, u16 width, u16 height, bool use_separators, home_menu_page* parent) : home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_INPUT)) { - add_checkbox(&g_cfg.io.background_input_enabled, "Background Input Enabled"); - add_checkbox(&g_cfg.io.keep_pads_connected, "Keep Pads Connected"); - add_checkbox(&g_cfg.io.show_move_cursor, "Show PS Move Cursor"); + add_checkbox(&g_cfg.io.background_input_enabled, "Background Input Enabled", localized_string_id::HOME_MENU_SETTINGS_INPUT_BACKGROUND_INPUT); + add_checkbox(&g_cfg.io.keep_pads_connected, "Keep Pads Connected", localized_string_id::HOME_MENU_SETTINGS_INPUT_KEEP_PADS_CONNECTED); + add_checkbox(&g_cfg.io.show_move_cursor, "Show PS Move Cursor", localized_string_id::HOME_MENU_SETTINGS_INPUT_SHOW_PS_MOVE_CURSOR); if (g_cfg.io.camera == camera_handler::qt) { - add_dropdown(&g_cfg.io.camera_flip_option, "Camera Flip"); + add_dropdown(&g_cfg.io.camera_flip_option, "Camera Flip", localized_string_id::HOME_MENU_SETTINGS_INPUT_CAMERA_FLIP); } - add_dropdown(&g_cfg.io.pad_mode, "Pad Handler Mode"); - add_unsigned_slider(&g_cfg.io.pad_sleep, "Pad Handler Sleep", " µs", 100); + add_dropdown(&g_cfg.io.pad_mode, "Pad Handler Mode", localized_string_id::HOME_MENU_SETTINGS_INPUT_PAD_MODE); + add_unsigned_slider(&g_cfg.io.pad_sleep, "Pad Handler Sleep", localized_string_id::HOME_MENU_SETTINGS_INPUT_PAD_SLEEP, " µs", 100); apply_layout(); } @@ -93,11 +92,11 @@ namespace rsx home_menu_settings_overlays::home_menu_settings_overlays(s16 x, s16 y, u16 width, u16 height, bool use_separators, home_menu_page* parent) : home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_OVERLAYS)) { - add_checkbox(&g_cfg.misc.show_trophy_popups, "Show Trophy Popups"); - add_checkbox(&g_cfg.misc.show_rpcn_popups, "Show RPCN Popups"); - add_checkbox(&g_cfg.misc.show_shader_compilation_hint, "Show Shader Compilation Hint"); - add_checkbox(&g_cfg.misc.show_ppu_compilation_hint, "Show PPU Compilation Hint"); - add_checkbox(&g_cfg.misc.show_autosave_autoload_hint, "Show Autosave/Autoload Hint"); + add_checkbox(&g_cfg.misc.show_trophy_popups, "Show Trophy Popups", localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_TROPHY_POPUPS); + add_checkbox(&g_cfg.misc.show_rpcn_popups, "Show RPCN Popups", localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_RPCN_POPUPS); + add_checkbox(&g_cfg.misc.show_shader_compilation_hint, "Show Shader Compilation Hint", localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_SHADER_COMPILATION_HINT); + add_checkbox(&g_cfg.misc.show_ppu_compilation_hint, "Show PPU Compilation Hint", localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_PPU_COMPILATION_HINT); + add_checkbox(&g_cfg.misc.show_autosave_autoload_hint, "Show Autosave/Autoload Hint", localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_AUTO_SAVE_LOAD_HINT); apply_layout(); } @@ -105,25 +104,25 @@ namespace rsx home_menu_settings_performance_overlay::home_menu_settings_performance_overlay(s16 x, s16 y, u16 width, u16 height, bool use_separators, home_menu_page* parent) : home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY)) { - add_checkbox(&g_cfg.video.perf_overlay.perf_overlay_enabled, "Enable Performance Overlay"); - add_checkbox(&g_cfg.video.perf_overlay.framerate_graph_enabled, "Enable Framerate Graph"); - add_checkbox(&g_cfg.video.perf_overlay.frametime_graph_enabled, "Enable Frametime Graph"); + add_checkbox(&g_cfg.video.perf_overlay.perf_overlay_enabled, "Enable Performance Overlay", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE); + add_checkbox(&g_cfg.video.perf_overlay.framerate_graph_enabled, "Enable Framerate Graph", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE_FRAMERATE_GRAPH); + add_checkbox(&g_cfg.video.perf_overlay.frametime_graph_enabled, "Enable Frametime Graph", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE_FRAMETIME_GRAPH); - add_dropdown(&g_cfg.video.perf_overlay.level, "Detail level"); - add_dropdown(&g_cfg.video.perf_overlay.framerate_graph_detail_level, "Framerate Graph Detail Level"); - add_dropdown(&g_cfg.video.perf_overlay.frametime_graph_detail_level, "Frametime Graph Detail Level"); + add_dropdown(&g_cfg.video.perf_overlay.level, "Detail level", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_DETAIL_LEVEL); + add_dropdown(&g_cfg.video.perf_overlay.framerate_graph_detail_level, "Framerate Graph Detail Level", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMERATE_DETAIL_LEVEL); + add_dropdown(&g_cfg.video.perf_overlay.frametime_graph_detail_level, "Frametime Graph Detail Level", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMETIME_DETAIL_LEVEL); - add_unsigned_slider(&g_cfg.video.perf_overlay.framerate_datapoint_count, "Framerate Datapoints", "", 1); - add_unsigned_slider(&g_cfg.video.perf_overlay.frametime_datapoint_count, "Frametime Datapoints", "", 1); - add_unsigned_slider(&g_cfg.video.perf_overlay.update_interval, "Metrics Update Interval", " ms", 1); + add_unsigned_slider(&g_cfg.video.perf_overlay.framerate_datapoint_count, "Framerate Datapoints", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMERATE_DATAPOINT_COUNT, "", 1); + add_unsigned_slider(&g_cfg.video.perf_overlay.frametime_datapoint_count, "Frametime Datapoints", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMETIME_DATAPOINT_COUNT, "", 1); + add_unsigned_slider(&g_cfg.video.perf_overlay.update_interval, "Metrics Update Interval", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_UPDATE_INTERVAL, " ms", 1); - add_dropdown(&g_cfg.video.perf_overlay.position, "Position"); - add_checkbox(&g_cfg.video.perf_overlay.center_x, "Center Horizontally"); - add_checkbox(&g_cfg.video.perf_overlay.center_y, "Center Vertically"); - add_unsigned_slider(&g_cfg.video.perf_overlay.margin_x, "Horizontal Margin", " px", 1); - add_unsigned_slider(&g_cfg.video.perf_overlay.margin_y, "Vertical Margin", " px", 1); - add_unsigned_slider(&g_cfg.video.perf_overlay.font_size, "Font Size", " px", 1); - add_unsigned_slider(&g_cfg.video.perf_overlay.opacity, "Opacity", " %", 1); + add_dropdown(&g_cfg.video.perf_overlay.position, "Position", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_POSITION); + add_checkbox(&g_cfg.video.perf_overlay.center_x, "Center Horizontally", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_CENTER_X); + add_checkbox(&g_cfg.video.perf_overlay.center_y, "Center Vertically", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_CENTER_Y); + add_unsigned_slider(&g_cfg.video.perf_overlay.margin_x, "Horizontal Margin", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_MARGIN_X, " px", 1); + add_unsigned_slider(&g_cfg.video.perf_overlay.margin_y, "Vertical Margin", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_MARGIN_Y, " px", 1); + add_unsigned_slider(&g_cfg.video.perf_overlay.font_size, "Font Size", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FONT_SIZE, " px", 1); + add_unsigned_slider(&g_cfg.video.perf_overlay.opacity, "Opacity", localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_OPACITY, " %", 1); apply_layout(); } @@ -131,9 +130,9 @@ namespace rsx home_menu_settings_debug::home_menu_settings_debug(s16 x, s16 y, u16 width, u16 height, bool use_separators, home_menu_page* parent) : home_menu_settings_page(x, y, width, height, use_separators, parent, get_localized_string(localized_string_id::HOME_MENU_SETTINGS_DEBUG)) { - add_checkbox(&g_cfg.video.overlay, "Debug Overlay"); - add_checkbox(&g_cfg.video.disable_video_output, "Disable Video Output"); - add_float_slider(&g_cfg.video.texture_lod_bias, "Texture LOD Bias Addend", "", 0.25f); + add_checkbox(&g_cfg.video.overlay, "Debug Overlay", localized_string_id::HOME_MENU_SETTINGS_DEBUG_OVERLAY); + add_checkbox(&g_cfg.video.disable_video_output, "Disable Video Output", localized_string_id::HOME_MENU_SETTINGS_DEBUG_DISABLE_VIDEO_OUTPUT); + add_float_slider(&g_cfg.video.texture_lod_bias, "Texture LOD Bias Addend", localized_string_id::HOME_MENU_SETTINGS_DEBUG_TEXTURE_LOD_BIAS, "", 0.25f); apply_layout(); } diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.h b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.h index 5e2b3209da..07a11f41c7 100644 --- a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.h +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.h @@ -21,19 +21,21 @@ namespace rsx { using home_menu_page::home_menu_page; - void add_checkbox(cfg::_bool* setting, const std::string& text) + void add_checkbox(cfg::_bool* setting, const std::string& text, localized_string_id loc_id) { ensure(setting && setting->get_is_dynamic()); - std::unique_ptr elem = std::make_unique(setting, text); - add_item(elem, [this, setting, text](pad_button btn) -> page_navigation + const std::string localized_text = get_localized_string(loc_id); + std::unique_ptr elem = std::make_unique(setting, localized_text); + + add_item(elem, [this, setting, _text = text](pad_button btn) -> page_navigation { if (btn != pad_button::cross) return page_navigation::stay; if (setting) { const bool value = !setting->get(); - rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %d", text, title, setting->get_name(), value); + rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %d", _text, title, setting->get_name(), value); setting->set(value); Emu.GetCallbacks().update_emu_settings(); if (m_config_changed) *m_config_changed = true; @@ -45,12 +47,14 @@ namespace rsx } template - void add_dropdown(cfg::_enum* setting, const std::string& text) + void add_dropdown(cfg::_enum* setting, const std::string& text, localized_string_id loc_id) { ensure(setting && setting->get_is_dynamic()); - std::unique_ptr elem = std::make_unique>(setting, text); - add_item(elem, [this, setting, text](pad_button btn) -> page_navigation + const std::string localized_text = get_localized_string(loc_id); + std::unique_ptr elem = std::make_unique>(setting, localized_text); + + add_item(elem, [this, setting, _text = text](pad_button btn) -> page_navigation { if (btn != pad_button::cross) return page_navigation::stay; @@ -72,11 +76,11 @@ namespace rsx } if (const std::string& next_value = ::at32(list, new_index); setting->from_string(next_value)) { - rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %s", text, title, setting->get_name(), next_value); + rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %s", _text, title, setting->get_name(), next_value); } else { - rsx_log.error("Can't toggle '%s' in '%s'. Setting '%s' to '%s' failed", text, title, setting->get_name(), next_value); + rsx_log.error("Can't toggle '%s' in '%s'. Setting '%s' to '%s' failed", _text, title, setting->get_name(), next_value); } Emu.GetCallbacks().update_emu_settings(); if (m_config_changed) *m_config_changed = true; @@ -88,12 +92,14 @@ namespace rsx } template - void add_signed_slider(cfg::_int* setting, const std::string& text, const std::string& suffix, s64 step_size, std::map special_labels = {}, s64 minimum = Min, s64 maximum = Max) + void add_signed_slider(cfg::_int* setting, const std::string& text, localized_string_id loc_id, const std::string& suffix, s64 step_size, std::map special_labels = {}, s64 minimum = Min, s64 maximum = Max) { ensure(setting && setting->get_is_dynamic()); - std::unique_ptr elem = std::make_unique>(setting, text, suffix, special_labels, minimum, maximum); - add_item(elem, [this, setting, text, step_size, minimum, maximum](pad_button btn) -> page_navigation + const std::string localized_text = get_localized_string(loc_id); + std::unique_ptr elem = std::make_unique>(setting, localized_text, suffix, special_labels, minimum, maximum); + + add_item(elem, [this, setting, _text = text, step_size, minimum, maximum](pad_button btn) -> page_navigation { if (setting) { @@ -114,7 +120,7 @@ namespace rsx if (value != setting->get()) { - rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %d", text, title, setting->get_name(), value); + rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %d", _text, title, setting->get_name(), value); setting->set(value); Emu.GetCallbacks().update_emu_settings(); if (m_config_changed) *m_config_changed = true; @@ -127,13 +133,15 @@ namespace rsx } template - void add_unsigned_slider(cfg::uint* setting, const std::string& text, const std::string& suffix, u64 step_size, std::map special_labels = {}, const std::set& exceptions = {}, u64 minimum = Min, u64 maximum = Max) + void add_unsigned_slider(cfg::uint* setting, const std::string& text, localized_string_id loc_id, const std::string& suffix, u64 step_size, std::map special_labels = {}, const std::set& exceptions = {}, u64 minimum = Min, u64 maximum = Max) { ensure(setting && setting->get_is_dynamic()); ensure(!exceptions.contains(minimum) && !exceptions.contains(maximum)); - std::unique_ptr elem = std::make_unique>(setting, text, suffix, special_labels, minimum, maximum); - add_item(elem, [this, setting, text, step_size, minimum, maximum, exceptions](pad_button btn) -> page_navigation + const std::string localized_text = get_localized_string(loc_id); + std::unique_ptr elem = std::make_unique>(setting, localized_text, suffix, special_labels, minimum, maximum); + + add_item(elem, [this, setting, _text = text, step_size, minimum, maximum, exceptions](pad_button btn) -> page_navigation { if (setting) { @@ -162,7 +170,7 @@ namespace rsx if (value != setting->get()) { - rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %d", text, title, setting->get_name(), value); + rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %d", _text, title, setting->get_name(), value); setting->set(value); Emu.GetCallbacks().update_emu_settings(); if (m_config_changed) *m_config_changed = true; @@ -175,12 +183,14 @@ namespace rsx } template - void add_float_slider(cfg::_float* setting, const std::string& text, const std::string& suffix, f32 step_size, std::map special_labels = {}, s32 minimum = Min, s32 maximum = Max) + void add_float_slider(cfg::_float* setting, const std::string& text, localized_string_id loc_id, const std::string& suffix, f32 step_size, std::map special_labels = {}, s32 minimum = Min, s32 maximum = Max) { ensure(setting && setting->get_is_dynamic()); - std::unique_ptr elem = std::make_unique>(setting, text, suffix, special_labels, minimum, maximum); - add_item(elem, [this, setting, text, step_size, minimum, maximum](pad_button btn) -> page_navigation + const std::string localized_text = get_localized_string(loc_id); + std::unique_ptr elem = std::make_unique>(setting, localized_text, suffix, special_labels, minimum, maximum); + + add_item(elem, [this, setting, _text = text, step_size, minimum, maximum](pad_button btn) -> page_navigation { if (setting) { @@ -201,7 +211,7 @@ namespace rsx if (value != setting->get()) { - rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %.2f", text, title, setting->get_name(), value); + rsx_log.notice("User toggled '%s' in '%s'. Setting '%s' to %.2f", _text, title, setting->get_name(), value); setting->set(value); Emu.GetCallbacks().update_emu_settings(); if (m_config_changed) *m_config_changed = true; diff --git a/rpcs3/Emu/localized_string_id.h b/rpcs3/Emu/localized_string_id.h index b549efce65..6a731c0fc1 100644 --- a/rpcs3/Emu/localized_string_id.h +++ b/rpcs3/Emu/localized_string_id.h @@ -204,12 +204,61 @@ enum class localized_string_id HOME_MENU_SETTINGS_DISCARD, HOME_MENU_SETTINGS_DISCARD_BUTTON, HOME_MENU_SETTINGS_AUDIO, + HOME_MENU_SETTINGS_AUDIO_MASTER_VOLUME, + HOME_MENU_SETTINGS_AUDIO_BACKEND, + HOME_MENU_SETTINGS_AUDIO_BUFFERING, + HOME_MENU_SETTINGS_AUDIO_BUFFER_DURATION, + HOME_MENU_SETTINGS_AUDIO_TIME_STRETCHING, + HOME_MENU_SETTINGS_AUDIO_TIME_STRETCHING_THRESHOLD, HOME_MENU_SETTINGS_VIDEO, + HOME_MENU_SETTINGS_VIDEO_FRAME_LIMIT, + HOME_MENU_SETTINGS_VIDEO_ANISOTROPIC_OVERRIDE, + HOME_MENU_SETTINGS_VIDEO_OUTPUT_SCALING, + HOME_MENU_SETTINGS_VIDEO_RCAS_SHARPENING, + HOME_MENU_SETTINGS_VIDEO_STRETCH_TO_DISPLAY, HOME_MENU_SETTINGS_INPUT, + HOME_MENU_SETTINGS_INPUT_BACKGROUND_INPUT, + HOME_MENU_SETTINGS_INPUT_KEEP_PADS_CONNECTED, + HOME_MENU_SETTINGS_INPUT_SHOW_PS_MOVE_CURSOR, + HOME_MENU_SETTINGS_INPUT_CAMERA_FLIP, + HOME_MENU_SETTINGS_INPUT_PAD_MODE, + HOME_MENU_SETTINGS_INPUT_PAD_SLEEP, HOME_MENU_SETTINGS_ADVANCED, + HOME_MENU_SETTINGS_ADVANCED_PREFERRED_SPU_THREADS, + HOME_MENU_SETTINGS_ADVANCED_MAX_CPU_PREEMPTIONS, + HOME_MENU_SETTINGS_ADVANCED_ACCURATE_RSX_RESERVATION_ACCESS, + HOME_MENU_SETTINGS_ADVANCED_SLEEP_TIMERS_ACCURACY, + HOME_MENU_SETTINGS_ADVANCED_MAX_SPURS_THREADS, + HOME_MENU_SETTINGS_ADVANCED_DRIVER_WAKE_UP_DELAY, + HOME_MENU_SETTINGS_ADVANCED_VBLANK_FREQUENCY, + HOME_MENU_SETTINGS_ADVANCED_VBLANK_NTSC, HOME_MENU_SETTINGS_OVERLAYS, + HOME_MENU_SETTINGS_OVERLAYS_SHOW_TROPHY_POPUPS, + HOME_MENU_SETTINGS_OVERLAYS_SHOW_RPCN_POPUPS, + HOME_MENU_SETTINGS_OVERLAYS_SHOW_SHADER_COMPILATION_HINT, + HOME_MENU_SETTINGS_OVERLAYS_SHOW_PPU_COMPILATION_HINT, + HOME_MENU_SETTINGS_OVERLAYS_SHOW_AUTO_SAVE_LOAD_HINT, HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE_FRAMERATE_GRAPH, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE_FRAMETIME_GRAPH, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_DETAIL_LEVEL, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMERATE_DETAIL_LEVEL, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMETIME_DETAIL_LEVEL, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMERATE_DATAPOINT_COUNT, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMETIME_DATAPOINT_COUNT, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_UPDATE_INTERVAL, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_POSITION, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_CENTER_X, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_CENTER_Y, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_MARGIN_X, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_MARGIN_Y, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FONT_SIZE, + HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_OPACITY, HOME_MENU_SETTINGS_DEBUG, + HOME_MENU_SETTINGS_DEBUG_OVERLAY, + HOME_MENU_SETTINGS_DEBUG_DISABLE_VIDEO_OUTPUT, + HOME_MENU_SETTINGS_DEBUG_TEXTURE_LOD_BIAS, HOME_MENU_SCREENSHOT, HOME_MENU_SAVESTATE, HOME_MENU_SAVESTATE_AND_EXIT, diff --git a/rpcs3/rpcs3qt/gui_application.h b/rpcs3/rpcs3qt/gui_application.h index d37836e04a..aa43425b31 100644 --- a/rpcs3/rpcs3qt/gui_application.h +++ b/rpcs3/rpcs3qt/gui_application.h @@ -94,7 +94,6 @@ private: } m_native_event_filter; QTranslator m_translator; - QTranslator m_translator_qt; QString m_language_code; QTimer m_timer; diff --git a/rpcs3/rpcs3qt/localized_emu.h b/rpcs3/rpcs3qt/localized_emu.h index e791360597..d2098bc4b3 100644 --- a/rpcs3/rpcs3qt/localized_emu.h +++ b/rpcs3/rpcs3qt/localized_emu.h @@ -225,12 +225,61 @@ private: case localized_string_id::HOME_MENU_SETTINGS_DISCARD: return tr("Discard the current settings' changes?"); case localized_string_id::HOME_MENU_SETTINGS_DISCARD_BUTTON: return tr("Discard"); case localized_string_id::HOME_MENU_SETTINGS_AUDIO: return tr("Audio"); + case localized_string_id::HOME_MENU_SETTINGS_AUDIO_MASTER_VOLUME: return tr("Master Volume", "Audio"); + case localized_string_id::HOME_MENU_SETTINGS_AUDIO_BACKEND: return tr("Audio Backend", "Audio"); + case localized_string_id::HOME_MENU_SETTINGS_AUDIO_BUFFERING: return tr("Enable Buffering", "Audio"); + case localized_string_id::HOME_MENU_SETTINGS_AUDIO_BUFFER_DURATION: return tr("Desired Audio Buffer Duration", "Audio"); + case localized_string_id::HOME_MENU_SETTINGS_AUDIO_TIME_STRETCHING: return tr("Enable Time Stretching", "Audio"); + case localized_string_id::HOME_MENU_SETTINGS_AUDIO_TIME_STRETCHING_THRESHOLD: return tr("Time Stretching Threshold", "Audio"); case localized_string_id::HOME_MENU_SETTINGS_VIDEO: return tr("Video"); + case localized_string_id::HOME_MENU_SETTINGS_VIDEO_FRAME_LIMIT: return tr("Frame Limit", "Video"); + case localized_string_id::HOME_MENU_SETTINGS_VIDEO_ANISOTROPIC_OVERRIDE: return tr("Anisotropic Filter Override", "Video"); + case localized_string_id::HOME_MENU_SETTINGS_VIDEO_OUTPUT_SCALING: return tr("Output Scaling", "Video"); + case localized_string_id::HOME_MENU_SETTINGS_VIDEO_RCAS_SHARPENING: return tr("FidelityFX CAS Sharpening Intensity", "Video"); + case localized_string_id::HOME_MENU_SETTINGS_VIDEO_STRETCH_TO_DISPLAY: return tr("Stretch To Display Area", "Video"); case localized_string_id::HOME_MENU_SETTINGS_INPUT: return tr("Input"); + case localized_string_id::HOME_MENU_SETTINGS_INPUT_BACKGROUND_INPUT: return tr("Background Input Enabled", "Input"); + case localized_string_id::HOME_MENU_SETTINGS_INPUT_KEEP_PADS_CONNECTED: return tr("Keep Pads Connected", "Input"); + case localized_string_id::HOME_MENU_SETTINGS_INPUT_SHOW_PS_MOVE_CURSOR: return tr("Show PS Move Cursor", "Input"); + case localized_string_id::HOME_MENU_SETTINGS_INPUT_CAMERA_FLIP: return tr("Camera Flip", "Input"); + case localized_string_id::HOME_MENU_SETTINGS_INPUT_PAD_MODE: return tr("Pad Handler Mode", "Input"); + case localized_string_id::HOME_MENU_SETTINGS_INPUT_PAD_SLEEP: return tr("Pad Handler Sleep", "Input"); case localized_string_id::HOME_MENU_SETTINGS_ADVANCED: return tr("Advanced"); + case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_PREFERRED_SPU_THREADS: return tr("Preferred SPU Threads", "Advanced"); + case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_MAX_CPU_PREEMPTIONS: return tr("Max Power Saving CPU-Preemptions", "Advanced"); + case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_ACCURATE_RSX_RESERVATION_ACCESS: return tr("Accurate RSX reservation access", "Advanced"); + case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_SLEEP_TIMERS_ACCURACY: return tr("Sleep Timers Accuracy", "Advanced"); + case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_MAX_SPURS_THREADS: return tr("Max SPURS Threads", "Advanced"); + case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_DRIVER_WAKE_UP_DELAY: return tr("Driver Wake-Up Delay", "Advanced"); + case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_VBLANK_FREQUENCY: return tr("VBlank Frequency", "Advanced"); + case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_VBLANK_NTSC: return tr("VBlank NTSC Fixup", "Advanced"); case localized_string_id::HOME_MENU_SETTINGS_OVERLAYS: return tr("Overlays"); + case localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_TROPHY_POPUPS: return tr("Show Trophy Popups", "Overlays"); + case localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_RPCN_POPUPS: return tr("Show RPCN Popups", "Overlays"); + case localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_SHADER_COMPILATION_HINT: return tr("Show Shader Compilation Hint", "Overlays"); + case localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_PPU_COMPILATION_HINT: return tr("Show PPU Compilation Hint", "Overlays"); + case localized_string_id::HOME_MENU_SETTINGS_OVERLAYS_SHOW_AUTO_SAVE_LOAD_HINT: return tr("Show Autosave/Autoload Hint", "Overlays"); case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY: return tr("Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE: return tr("Enable Performance Overlay", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE_FRAMERATE_GRAPH: return tr("Enable Framerate Graph", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_ENABLE_FRAMETIME_GRAPH: return tr("Enable Frametime Graph", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_DETAIL_LEVEL: return tr("Detail level", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMERATE_DETAIL_LEVEL: return tr("Framerate Graph Detail Level", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMETIME_DETAIL_LEVEL: return tr("Frametime Graph Detail Level", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMERATE_DATAPOINT_COUNT: return tr("Framerate Datapoints", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FRAMETIME_DATAPOINT_COUNT: return tr("Frametime Datapoints", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_UPDATE_INTERVAL: return tr("Metrics Update Interval", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_POSITION: return tr("Position", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_CENTER_X: return tr("Center Horizontally", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_CENTER_Y: return tr("Center Vertically", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_MARGIN_X: return tr("Horizontal Margin", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_MARGIN_Y: return tr("Vertical Margin", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_FONT_SIZE: return tr("Font Size", "Performance Overlay"); + case localized_string_id::HOME_MENU_SETTINGS_PERFORMANCE_OVERLAY_OPACITY: return tr("Opacity", "Performance Overlay"); case localized_string_id::HOME_MENU_SETTINGS_DEBUG: return tr("Debug"); + case localized_string_id::HOME_MENU_SETTINGS_DEBUG_OVERLAY: return tr("Debug Overlay", "Debug"); + case localized_string_id::HOME_MENU_SETTINGS_DEBUG_DISABLE_VIDEO_OUTPUT: return tr("Disable Video Output", "Debug"); + case localized_string_id::HOME_MENU_SETTINGS_DEBUG_TEXTURE_LOD_BIAS: return tr("Texture LOD Bias Addend", "Debug"); case localized_string_id::HOME_MENU_SCREENSHOT: return tr("Take Screenshot"); case localized_string_id::HOME_MENU_SAVESTATE: return tr("Save Emulation State"); case localized_string_id::HOME_MENU_SAVESTATE_AND_EXIT: return tr("Save Emulation State And Exit");