diff --git a/src/core/fullscreen_ui.cpp b/src/core/fullscreen_ui.cpp index 2915a1ff9..e6a3be796 100644 --- a/src/core/fullscreen_ui.cpp +++ b/src/core/fullscreen_ui.cpp @@ -3826,7 +3826,7 @@ void FullscreenUI::DrawDisplaySettingsPage() DrawEnumSetting(bsi, FSUI_CSTR("Aspect Ratio"), FSUI_CSTR("Changes the aspect ratio used to display the console's output to the screen."), "Display", "AspectRatio", Settings::DEFAULT_DISPLAY_ASPECT_RATIO, &Settings::ParseDisplayAspectRatio, - &Settings::GetDisplayAspectRatioName, &Settings::GetDisplayAspectRatioName, + &Settings::GetDisplayAspectRatioName, &Settings::GetDisplayAspectRatioDisplayName, DisplayAspectRatio::Count); DrawEnumSetting(bsi, FSUI_CSTR("Crop Mode"), diff --git a/src/core/game_database.cpp b/src/core/game_database.cpp index f00711750..4870d9f8a 100644 --- a/src/core/game_database.cpp +++ b/src/core/game_database.cpp @@ -194,7 +194,7 @@ const char* GameDatabase::GetCompatibilityRatingDisplayName(CompatibilityRating TRANSLATE_NOOP("GameListCompatibilityRating", "Graphical/Audio Issues"), TRANSLATE_NOOP("GameListCompatibilityRating", "No Issues")}}; return (rating >= CompatibilityRating::Unknown && rating < CompatibilityRating::Count) ? - names[static_cast(rating)] : + Host::TranslateToCString("GameListCompatibilityRating", names[static_cast(rating)]) : ""; } @@ -228,8 +228,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && settings.cpu_execution_mode != CPUExecutionMode::Interpreter) { Host::AddKeyedOSDMessage("gamedb_force_interpreter", - TRANSLATE_STR("OSDMessage", "CPU interpreter forced by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "CPU interpreter forced by game settings."), osd_duration); } settings.cpu_execution_mode = CPUExecutionMode::Interpreter; @@ -240,8 +239,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && settings.gpu_renderer != GPURenderer::Software) { Host::AddKeyedOSDMessage("gamedb_force_software", - TRANSLATE_STR("OSDMessage", "Software renderer forced by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "Software renderer forced by game settings."), osd_duration); } settings.gpu_renderer = GPURenderer::Software; @@ -253,8 +251,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { Host::AddKeyedOSDMessage( "gamedb_force_software_rb", - TRANSLATE_STR("OSDMessage", "Using software renderer for readbacks based on game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "Using software renderer for readbacks based on game settings."), osd_duration); } settings.gpu_use_software_renderer_for_readbacks = true; @@ -265,8 +262,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && settings.gpu_disable_interlacing) { Host::AddKeyedOSDMessage("gamedb_force_interlacing", - TRANSLATE_STR("OSDMessage", "Interlacing forced by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "Interlacing forced by game settings."), osd_duration); } settings.gpu_disable_interlacing = false; @@ -277,8 +273,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && settings.gpu_true_color) { Host::AddKeyedOSDMessage("gamedb_disable_true_color", - TRANSLATE_STR("OSDMessage", "True color disabled by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "True color disabled by game settings."), osd_duration); } settings.gpu_true_color = false; @@ -289,8 +284,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && settings.gpu_resolution_scale > 1) { Host::AddKeyedOSDMessage("gamedb_disable_upscaling", - TRANSLATE_STR("OSDMessage", "Upscaling disabled by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "Upscaling disabled by game settings."), osd_duration); } settings.gpu_resolution_scale = 1; @@ -314,8 +308,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes (settings.display_aspect_ratio == DisplayAspectRatio::R16_9 || settings.gpu_widescreen_hack)) { Host::AddKeyedOSDMessage("gamedb_disable_widescreen", - TRANSLATE_STR("OSDMessage", "Widescreen disabled by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "Widescreen disabled by game settings."), osd_duration); } settings.display_aspect_ratio = DisplayAspectRatio::R4_3; @@ -326,9 +319,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_force_ntsc_timings) { - Host::AddKeyedOSDMessage( - "gamedb_disable_force_ntsc_timings", - TRANSLATE_STR("OSDMessage", "Forcing NTSC Timings disallowed by game settings."), osd_duration); + Host::AddKeyedOSDMessage("gamedb_disable_force_ntsc_timings", + TRANSLATE_STR("OSDMessage", "Forcing NTSC Timings disallowed by game settings."), + osd_duration); } settings.gpu_force_ntsc_timings = false; @@ -338,9 +331,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_pgxp_enable) { - Host::AddKeyedOSDMessage( - "gamedb_disable_pgxp", - TRANSLATE_STR("OSDMessage", "PGXP geometry correction disabled by game settings."), osd_duration); + Host::AddKeyedOSDMessage("gamedb_disable_pgxp", + TRANSLATE_STR("OSDMessage", "PGXP geometry correction disabled by game settings."), + osd_duration); } settings.gpu_pgxp_enable = false; @@ -351,8 +344,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_culling) { Host::AddKeyedOSDMessage("gamedb_disable_pgxp_culling", - TRANSLATE_STR("OSDMessage", "PGXP culling disabled by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "PGXP culling disabled by game settings."), osd_duration); } settings.gpu_pgxp_culling = false; @@ -364,8 +356,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { Host::AddKeyedOSDMessage( "gamedb_disable_pgxp_texture", - TRANSLATE_STR("OSDMessage", "PGXP perspective corrected textures disabled by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "PGXP perspective corrected textures disabled by game settings."), osd_duration); } settings.gpu_pgxp_texture_correction = false; @@ -378,8 +369,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { Host::AddKeyedOSDMessage( "gamedb_disable_pgxp_texture", - TRANSLATE_STR("OSDMessage", "PGXP perspective corrected colors disabled by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "PGXP perspective corrected colors disabled by game settings."), osd_duration); } settings.gpu_pgxp_color_correction = false; @@ -390,8 +380,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_vertex_cache) { Host::AddKeyedOSDMessage("gamedb_force_pgxp_vertex_cache", - TRANSLATE_STR("OSDMessage", "PGXP vertex cache forced by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "PGXP vertex cache forced by game settings."), osd_duration); } settings.gpu_pgxp_vertex_cache = true; @@ -402,8 +391,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_cpu) { Host::AddKeyedOSDMessage("gamedb_force_pgxp_cpu", - TRANSLATE_STR("OSDMessage", "PGXP CPU mode forced by game settings."), - osd_duration); + TRANSLATE_STR("OSDMessage", "PGXP CPU mode forced by game settings."), osd_duration); } settings.gpu_pgxp_cpu = true; @@ -472,17 +460,15 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (!supported_controller_string.IsEmpty()) supported_controller_string.AppendString(", "); - supported_controller_string.AppendString( - TRANSLATE("ControllerType", Settings::GetControllerTypeDisplayName(supported_ctype))); + supported_controller_string.AppendString(Settings::GetControllerTypeDisplayName(supported_ctype)); } Host::AddKeyedFormattedOSDMessage( "gamedb_controller_unsupported", 30.0f, - TRANSLATE("OSDMessage", - "Controller in port %u (%s) is not supported for %s.\nSupported controllers: " - "%s\nPlease configure a supported controller from the list above."), - i + 1u, TRANSLATE("ControllerType", Settings::GetControllerTypeDisplayName(ctype)), - System::GetGameTitle().c_str(), supported_controller_string.GetCharArray()); + TRANSLATE("OSDMessage", "Controller in port %u (%s) is not supported for %s.\nSupported controllers: " + "%s\nPlease configure a supported controller from the list above."), + i + 1u, Settings::GetControllerTypeDisplayName(ctype), System::GetGameTitle().c_str(), + supported_controller_string.GetCharArray()); } } } diff --git a/src/core/game_list.cpp b/src/core/game_list.cpp index 2ad94c4eb..5fcaf42bb 100644 --- a/src/core/game_list.cpp +++ b/src/core/game_list.cpp @@ -107,7 +107,7 @@ const char* GameList::GetEntryTypeDisplayName(EntryType type) static std::array(EntryType::Count)> names = { {TRANSLATE_NOOP("GameList", "Disc"), TRANSLATE_NOOP("GameList", "PS-EXE"), TRANSLATE_NOOP("GameList", "Playlist"), TRANSLATE_NOOP("GameList", "PSF")}}; - return names[static_cast(type)]; + return Host::TranslateToCString("GameList", names[static_cast(type)]); } bool GameList::IsGameListLoaded() diff --git a/src/core/settings.cpp b/src/core/settings.cpp index b69017551..f6aabbab2 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -11,9 +11,9 @@ #include "common/string_util.h" #include "controller.h" #include "host.h" -#include "util/host_display.h" #include "host_settings.h" #include "system.h" +#include "util/host_display.h" #include #include #include @@ -644,8 +644,7 @@ void Settings::FixIncompatibleSettings(bool display_osd_messages) { Host::AddKeyedOSDMessage( "pgxp_disabled_sw", - TRANSLATE_STR("OSDMessage", "PGXP is incompatible with the software renderer, disabling PGXP."), - 10.0f); + TRANSLATE_STR("OSDMessage", "PGXP is incompatible with the software renderer, disabling PGXP."), 10.0f); } g_settings.gpu_pgxp_enable = false; } @@ -662,16 +661,15 @@ void Settings::FixIncompatibleSettings(bool display_osd_messages) #if defined(__ANDROID__) && defined(__arm__) && !defined(__aarch64__) && !defined(_M_ARM64) if (g_settings.rewind_enable) { - Host::AddKeyedOSDMessage( - "rewind_disabled_android", - TRANSLATE_STR("OSDMessage", "Rewind is not supported on 32-bit ARM for Android."), 30.0f); + Host::AddKeyedOSDMessage("rewind_disabled_android", + TRANSLATE_STR("OSDMessage", "Rewind is not supported on 32-bit ARM for Android."), 30.0f); g_settings.rewind_enable = false; } if (g_settings.IsRunaheadEnabled()) { - Host::AddKeyedOSDMessage( - "rewind_disabled_android", - TRANSLATE_STR("OSDMessage", "Runahead is not supported on 32-bit ARM for Android."), 30.0f); + Host::AddKeyedOSDMessage("rewind_disabled_android", + TRANSLATE_STR("OSDMessage", "Runahead is not supported on 32-bit ARM for Android."), + 30.0f); g_settings.runahead_frames = 0; } #endif @@ -679,8 +677,7 @@ void Settings::FixIncompatibleSettings(bool display_osd_messages) if (g_settings.IsRunaheadEnabled() && g_settings.rewind_enable) { Host::AddKeyedOSDMessage("rewind_disabled_android", - TRANSLATE_STR("OSDMessage", "Rewind is disabled because runahead is enabled."), - 10.0f); + TRANSLATE_STR("OSDMessage", "Rewind is disabled because runahead is enabled."), 10.0f); g_settings.rewind_enable = false; } @@ -728,8 +725,8 @@ static std::array s_log_level_names = { static std::array s_log_level_display_names = { {TRANSLATE_NOOP("LogLevel", "None"), TRANSLATE_NOOP("LogLevel", "Error"), TRANSLATE_NOOP("LogLevel", "Warning"), TRANSLATE_NOOP("LogLevel", "Performance"), TRANSLATE_NOOP("LogLevel", "Information"), - TRANSLATE_NOOP("LogLevel", "Verbose"), TRANSLATE_NOOP("LogLevel", "Developer"), TRANSLATE_NOOP("LogLevel", "Profile"), - TRANSLATE_NOOP("LogLevel", "Debug"), TRANSLATE_NOOP("LogLevel", "Trace")}}; + TRANSLATE_NOOP("LogLevel", "Verbose"), TRANSLATE_NOOP("LogLevel", "Developer"), + TRANSLATE_NOOP("LogLevel", "Profile"), TRANSLATE_NOOP("LogLevel", "Debug"), TRANSLATE_NOOP("LogLevel", "Trace")}}; std::optional Settings::ParseLogLevelName(const char* str) { @@ -752,13 +749,14 @@ const char* Settings::GetLogLevelName(LOGLEVEL level) const char* Settings::GetLogLevelDisplayName(LOGLEVEL level) { - return s_log_level_display_names[static_cast(level)]; + return Host::TranslateToCString("LogLevel", s_log_level_display_names[static_cast(level)]); } static std::array s_console_region_names = {{"Auto", "NTSC-J", "NTSC-U", "PAL"}}; static std::array s_console_region_display_names = { {TRANSLATE_NOOP("ConsoleRegion", "Auto-Detect"), TRANSLATE_NOOP("ConsoleRegion", "NTSC-J (Japan)"), - TRANSLATE_NOOP("ConsoleRegion", "NTSC-U/C (US, Canada)"), TRANSLATE_NOOP("ConsoleRegion", "PAL (Europe, Australia)")}}; + TRANSLATE_NOOP("ConsoleRegion", "NTSC-U/C (US, Canada)"), + TRANSLATE_NOOP("ConsoleRegion", "PAL (Europe, Australia)")}}; std::optional Settings::ParseConsoleRegionName(const char* str) { @@ -781,7 +779,7 @@ const char* Settings::GetConsoleRegionName(ConsoleRegion region) const char* Settings::GetConsoleRegionDisplayName(ConsoleRegion region) { - return s_console_region_display_names[static_cast(region)]; + return Host::TranslateToCString("ConsoleRegion", s_console_region_display_names[static_cast(region)]); } static std::array s_disc_region_names = {{"NTSC-J", "NTSC-U", "PAL", "Other", "Non-PS1"}}; @@ -811,7 +809,7 @@ const char* Settings::GetDiscRegionName(DiscRegion region) const char* Settings::GetDiscRegionDisplayName(DiscRegion region) { - return s_disc_region_display_names[static_cast(region)]; + return Host::TranslateToCString("DiscRegion", s_disc_region_display_names[static_cast(region)]); } static std::array s_cpu_execution_mode_names = {{"Interpreter", "CachedInterpreter", "Recompiler"}}; @@ -841,7 +839,7 @@ const char* Settings::GetCPUExecutionModeName(CPUExecutionMode mode) const char* Settings::GetCPUExecutionModeDisplayName(CPUExecutionMode mode) { - return s_cpu_execution_mode_display_names[static_cast(mode)]; + return Host::TranslateToCString("CPUExecutionMode", s_cpu_execution_mode_display_names[static_cast(mode)]); } static std::array(CPUFastmemMode::Count)> s_cpu_fastmem_mode_names = { @@ -872,7 +870,7 @@ const char* Settings::GetCPUFastmemModeName(CPUFastmemMode mode) const char* Settings::GetCPUFastmemModeDisplayName(CPUFastmemMode mode) { - return s_cpu_fastmem_mode_display_names[static_cast(mode)]; + return Host::TranslateToCString("CPUFastmemMode", s_cpu_fastmem_mode_display_names[static_cast(mode)]); } static constexpr auto s_gpu_renderer_names = make_array( @@ -919,7 +917,7 @@ const char* Settings::GetRendererName(GPURenderer renderer) const char* Settings::GetRendererDisplayName(GPURenderer renderer) { - return s_gpu_renderer_display_names[static_cast(renderer)]; + return Host::TranslateToCString("GPURenderer", s_gpu_renderer_display_names[static_cast(renderer)]); } RenderAPI Settings::GetRenderAPIForRenderer(GPURenderer renderer) @@ -976,13 +974,14 @@ const char* Settings::GetTextureFilterName(GPUTextureFilter filter) const char* Settings::GetTextureFilterDisplayName(GPUTextureFilter filter) { - return s_texture_filter_display_names[static_cast(filter)]; + return Host::TranslateToCString("GPUTextureFilter", s_texture_filter_display_names[static_cast(filter)]); } static constexpr auto s_downsample_mode_names = make_array("Disabled", "Box", "Adaptive"); -static constexpr auto s_downsample_mode_display_names = make_array( - TRANSLATE_NOOP("GPUDownsampleMode", "Disabled"), TRANSLATE_NOOP("GPUDownsampleMode", "Box (Downsample 3D/Smooth All)"), - TRANSLATE_NOOP("GPUDownsampleMode", "Adaptive (Preserve 3D/Smooth 2D)")); +static constexpr auto s_downsample_mode_display_names = + make_array(TRANSLATE_NOOP("GPUDownsampleMode", "Disabled"), + TRANSLATE_NOOP("GPUDownsampleMode", "Box (Downsample 3D/Smooth All)"), + TRANSLATE_NOOP("GPUDownsampleMode", "Adaptive (Preserve 3D/Smooth 2D)")); std::optional Settings::ParseDownsampleModeName(const char* str) { @@ -1005,7 +1004,7 @@ const char* Settings::GetDownsampleModeName(GPUDownsampleMode mode) const char* Settings::GetDownsampleModeDisplayName(GPUDownsampleMode mode) { - return s_downsample_mode_display_names[static_cast(mode)]; + return Host::TranslateToCString("GPUDownsampleMode", s_downsample_mode_display_names[static_cast(mode)]); } static std::array s_display_crop_mode_names = {{"None", "Overscan", "Borders"}}; @@ -1034,12 +1033,13 @@ const char* Settings::GetDisplayCropModeName(DisplayCropMode crop_mode) const char* Settings::GetDisplayCropModeDisplayName(DisplayCropMode crop_mode) { - return s_display_crop_mode_display_names[static_cast(crop_mode)]; + return Host::TranslateToCString("DisplayCropMode", s_display_crop_mode_display_names[static_cast(crop_mode)]); } static std::array(DisplayAspectRatio::Count)> s_display_aspect_ratio_names = { - {TRANSLATE_NOOP("DisplayAspectRatio", "Auto (Game Native)"), TRANSLATE_NOOP("DisplayAspectRatio", "Auto (Match Window)"), - TRANSLATE_NOOP("DisplayAspectRatio", "Custom"), "4:3", "16:9", "19:9", "20:9", "PAR 1:1"}}; + {TRANSLATE_NOOP("DisplayAspectRatio", "Auto (Game Native)"), + TRANSLATE_NOOP("DisplayAspectRatio", "Auto (Match Window)"), TRANSLATE_NOOP("DisplayAspectRatio", "Custom"), "4:3", + "16:9", "19:9", "20:9", "PAR 1:1"}}; static constexpr std::array(DisplayAspectRatio::Count)> s_display_aspect_ratio_values = { {-1.0f, -1.0f, -1.0f, 4.0f / 3.0f, 16.0f / 9.0f, 19.0f / 9.0f, 20.0f / 9.0f, -1.0f}}; @@ -1062,6 +1062,11 @@ const char* Settings::GetDisplayAspectRatioName(DisplayAspectRatio ar) return s_display_aspect_ratio_names[static_cast(ar)]; } +const char* Settings::GetDisplayAspectRatioDisplayName(DisplayAspectRatio ar) +{ + return Host::TranslateToCString("DisplayAspectRatio", s_display_aspect_ratio_names[static_cast(ar)]); +} + float Settings::GetDisplayAspectRatioValue() const { switch (display_aspect_ratio) @@ -1165,16 +1170,16 @@ const char* Settings::GetAudioBackendName(AudioBackend backend) const char* Settings::GetAudioBackendDisplayName(AudioBackend backend) { - return s_audio_backend_display_names[static_cast(backend)]; + return Host::TranslateToCString("AudioBackend", s_audio_backend_display_names[static_cast(backend)]); } static std::array s_controller_type_names = { {"None", "DigitalController", "AnalogController", "AnalogJoystick", "GunCon", "PlayStationMouse", "NeGcon"}}; static std::array s_controller_display_names = { {TRANSLATE_NOOP("ControllerType", "None"), TRANSLATE_NOOP("ControllerType", "Digital Controller"), - TRANSLATE_NOOP("ControllerType", "Analog Controller (DualShock)"), TRANSLATE_NOOP("ControllerType", "Analog Joystick"), - TRANSLATE_NOOP("ControllerType", "GunCon"), TRANSLATE_NOOP("ControllerType", "PlayStation Mouse"), - TRANSLATE_NOOP("ControllerType", "NeGcon")}}; + TRANSLATE_NOOP("ControllerType", "Analog Controller (DualShock)"), + TRANSLATE_NOOP("ControllerType", "Analog Joystick"), TRANSLATE_NOOP("ControllerType", "GunCon"), + TRANSLATE_NOOP("ControllerType", "PlayStation Mouse"), TRANSLATE_NOOP("ControllerType", "NeGcon")}}; std::optional Settings::ParseControllerTypeName(const char* str) { @@ -1197,7 +1202,7 @@ const char* Settings::GetControllerTypeName(ControllerType type) const char* Settings::GetControllerTypeDisplayName(ControllerType type) { - return s_controller_display_names[static_cast(type)]; + return Host::TranslateToCString("ControllerType", s_controller_display_names[static_cast(type)]); } static std::array s_memory_card_type_names = { @@ -1230,7 +1235,7 @@ const char* Settings::GetMemoryCardTypeName(MemoryCardType type) const char* Settings::GetMemoryCardTypeDisplayName(MemoryCardType type) { - return s_memory_card_type_display_names[static_cast(type)]; + return Host::TranslateToCString("MemoryCardType", s_memory_card_type_display_names[static_cast(type)]); } std::string Settings::GetDefaultSharedMemoryCardName(u32 slot) @@ -1283,7 +1288,7 @@ const char* Settings::GetMultitapModeName(MultitapMode mode) const char* Settings::GetMultitapModeDisplayName(MultitapMode mode) { - return s_multitap_enable_mode_display_names[static_cast(mode)]; + return Host::TranslateToCString("MultitapMode", s_multitap_enable_mode_display_names[static_cast(mode)]); } std::string EmuFolders::AppRoot; diff --git a/src/core/settings.h b/src/core/settings.h index 8533692b7..2d52a72b3 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -374,6 +374,7 @@ struct Settings static std::optional ParseDisplayAspectRatio(const char* str); static const char* GetDisplayAspectRatioName(DisplayAspectRatio ar); + static const char* GetDisplayAspectRatioDisplayName(DisplayAspectRatio ar); static std::optional ParseDisplayAlignment(const char* str); static const char* GetDisplayAlignmentName(DisplayAlignment alignment); diff --git a/src/core/system.cpp b/src/core/system.cpp index 593bebb41..f0e3c4330 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -4387,9 +4387,8 @@ void System::ToggleWidescreen() { Host::AddKeyedOSDMessage( "WidescreenHack", - fmt::format( - TRANSLATE_FS("OSDMessage", "Widescreen hack is now enabled, and aspect ratio is set to {}."), - TRANSLATE("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio))), + fmt::format(TRANSLATE_FS("OSDMessage", "Widescreen hack is now enabled, and aspect ratio is set to {}."), + Settings::GetDisplayAspectRatioDisplayName(g_settings.display_aspect_ratio)), 5.0f); } else @@ -4397,8 +4396,7 @@ void System::ToggleWidescreen() Host::AddKeyedOSDMessage( "WidescreenHack", fmt::format(TRANSLATE_FS("OSDMessage", "Widescreen hack is now disabled, and aspect ratio is set to {}."), - TRANSLATE("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio)), - 5.0f)); + Settings::GetDisplayAspectRatioDisplayName(g_settings.display_aspect_ratio), 5.0f)); } GTE::UpdateAspectRatio(); diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index 840478489..fe6377b39 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -112,7 +112,7 @@ template static QComboBox* addChoiceTweakOption(SettingsDialog* dialog, QTableWidget* table, QString name, std::string section, std::string key, std::optional (*parse_callback)(const char*), const char* (*get_value_callback)(T), const char* (*get_display_callback)(T), - const char* tr_context, u32 num_values, T default_value) + u32 num_values, T default_value) { const int row = table->rowCount(); @@ -124,7 +124,7 @@ static QComboBox* addChoiceTweakOption(SettingsDialog* dialog, QTableWidget* tab QComboBox* cb = new QComboBox(table); for (u32 i = 0; i < num_values; i++) - cb->addItem(qApp->translate(tr_context, get_display_callback(static_cast(i)))); + cb->addItem(QString::fromUtf8(get_display_callback(static_cast(i)))); if (!section.empty() || !key.empty()) { @@ -229,7 +229,7 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsDialog* dialog, QWidget* m_ui.setupUi(this); for (u32 i = 0; i < static_cast(LOGLEVEL_COUNT); i++) - m_ui.logLevel->addItem(qApp->translate("LogLevel", Settings::GetLogLevelDisplayName(static_cast(i)))); + m_ui.logLevel->addItem(QString::fromUtf8(Settings::GetLogLevelDisplayName(static_cast(i)))); SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.logLevel, "Logging", "LogLevel", &Settings::ParseLogLevelName, &Settings::GetLogLevelName, Settings::DEFAULT_LOG_LEVEL); @@ -303,8 +303,8 @@ void AdvancedSettingsWidget::addTweakOptions() "RecompilerBlockLinking", true); addChoiceTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable Recompiler Fast Memory Access"), "CPU", "FastmemMode", Settings::ParseCPUFastmemMode, Settings::GetCPUFastmemModeName, - Settings::GetCPUFastmemModeDisplayName, "CPUFastmemMode", - static_cast(CPUFastmemMode::Count), Settings::DEFAULT_CPU_FASTMEM_MODE); + Settings::GetCPUFastmemModeDisplayName, static_cast(CPUFastmemMode::Count), + Settings::DEFAULT_CPU_FASTMEM_MODE); addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Use Old MDEC Routines"), "Hacks", "UseOldMDECRoutines", false); diff --git a/src/duckstation-qt/audiosettingswidget.cpp b/src/duckstation-qt/audiosettingswidget.cpp index ab52c2627..7f60f4e9c 100644 --- a/src/duckstation-qt/audiosettingswidget.cpp +++ b/src/duckstation-qt/audiosettingswidget.cpp @@ -19,10 +19,7 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsDialog* dialog, QWidget* parent m_ui.setupUi(this); for (u32 i = 0; i < static_cast(AudioBackend::Count); i++) - { - m_ui.audioBackend->addItem( - qApp->translate("AudioBackend", Settings::GetAudioBackendDisplayName(static_cast(i)))); - } + m_ui.audioBackend->addItem(QString::fromUtf8(Settings::GetAudioBackendDisplayName(static_cast(i)))); SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.audioBackend, "Audio", "Backend", &Settings::ParseAudioBackend, &Settings::GetAudioBackendName, Settings::DEFAULT_AUDIO_BACKEND); diff --git a/src/duckstation-qt/consolesettingswidget.cpp b/src/duckstation-qt/consolesettingswidget.cpp index 882f8fbcc..c04841e3e 100644 --- a/src/duckstation-qt/consolesettingswidget.cpp +++ b/src/duckstation-qt/consolesettingswidget.cpp @@ -18,15 +18,12 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsDialog* dialog, QWidget* pa m_ui.setupUi(this); for (u32 i = 0; i < static_cast(ConsoleRegion::Count); i++) - { - m_ui.region->addItem( - qApp->translate("ConsoleRegion", Settings::GetConsoleRegionDisplayName(static_cast(i)))); - } + m_ui.region->addItem(QString::fromUtf8(Settings::GetConsoleRegionDisplayName(static_cast(i)))); for (u32 i = 0; i < static_cast(CPUExecutionMode::Count); i++) { m_ui.cpuExecutionMode->addItem( - qApp->translate("CPUExecutionMode", Settings::GetCPUExecutionModeDisplayName(static_cast(i)))); + QString::fromUtf8(Settings::GetCPUExecutionModeDisplayName(static_cast(i)))); } static constexpr float TIME_PER_SECTOR_DOUBLE_SPEED = 1000.0f / 150.0f; diff --git a/src/duckstation-qt/displaysettingswidget.cpp b/src/duckstation-qt/displaysettingswidget.cpp index 8da67f4bc..95f1af139 100644 --- a/src/duckstation-qt/displaysettingswidget.cpp +++ b/src/duckstation-qt/displaysettingswidget.cpp @@ -74,8 +74,7 @@ DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* pa onAspectRatioChanged(); dialog->registerWidgetHelp( - m_ui.renderer, tr("Renderer"), - qApp->translate("GPURenderer", Settings::GetRendererDisplayName(Settings::DEFAULT_GPU_RENDERER)), + m_ui.renderer, tr("Renderer"), QString::fromUtf8(Settings::GetRendererDisplayName(Settings::DEFAULT_GPU_RENDERER)), tr("Chooses the backend to use for rendering the console/game visuals.
Depending on your system and hardware, " "Direct3D 11 and OpenGL hardware backends may be available.
The software renderer offers the best " "compatibility, but is the slowest and does not offer any enhancements.")); @@ -88,19 +87,19 @@ DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* pa tr("Chooses the fullscreen resolution and frequency.")); dialog->registerWidgetHelp( m_ui.displayAspectRatio, tr("Aspect Ratio"), - qApp->translate("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(Settings::DEFAULT_DISPLAY_ASPECT_RATIO)), + QString::fromUtf8(Settings::GetDisplayAspectRatioDisplayName(Settings::DEFAULT_DISPLAY_ASPECT_RATIO)), tr("Changes the aspect ratio used to display the console's output to the screen. The default is Auto (Game Native) " "which automatically adjusts the aspect ratio to match how a game would be shown on a typical TV of the era.")); dialog->registerWidgetHelp( m_ui.displayCropMode, tr("Crop Mode"), - qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(Settings::DEFAULT_DISPLAY_CROP_MODE)), + QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(Settings::DEFAULT_DISPLAY_CROP_MODE)), tr("Determines how much of the area typically not visible on a consumer TV set to crop/hide.
" "Some games display content in the overscan area, or use it for screen effects.
May " "not display correctly with the \"All Borders\" setting. \"Only Overscan\" offers a good " "compromise between stability and hiding black borders.")); dialog->registerWidgetHelp( m_ui.displayAlignment, tr("Position"), - qApp->translate("DisplayCropMode", Settings::GetDisplayAlignmentDisplayName(Settings::DEFAULT_DISPLAY_ALIGNMENT)), + QString::fromUtf8(Settings::GetDisplayAlignmentDisplayName(Settings::DEFAULT_DISPLAY_ALIGNMENT)), tr("Determines the position on the screen when black borders must be added.")); dialog->registerWidgetHelp(m_ui.displayLinearFiltering, tr("Linear Upscaling"), tr("Checked"), tr("Uses bilinear texture filtering when displaying the console's framebuffer to the " @@ -164,26 +163,25 @@ void DisplaySettingsWidget::setupAdditionalUi() { for (u32 i = 0; i < static_cast(GPURenderer::Count); i++) { - m_ui.renderer->addItem( - qApp->translate("GPURenderer", Settings::GetRendererDisplayName(static_cast(i)))); + m_ui.renderer->addItem(QString::fromUtf8(Settings::GetRendererDisplayName(static_cast(i)))); } for (u32 i = 0; i < static_cast(DisplayAspectRatio::Count); i++) { m_ui.displayAspectRatio->addItem( - qApp->translate("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(static_cast(i)))); + QString::fromUtf8(Settings::GetDisplayAspectRatioDisplayName(static_cast(i)))); } for (u32 i = 0; i < static_cast(DisplayCropMode::Count); i++) { m_ui.displayCropMode->addItem( - qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(static_cast(i)))); + QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(static_cast(i)))); } for (u32 i = 0; i < static_cast(DisplayAlignment::Count); i++) { m_ui.displayAlignment->addItem( - qApp->translate("DisplayAlignment", Settings::GetDisplayAlignmentDisplayName(static_cast(i)))); + QString::fromUtf8(Settings::GetDisplayAlignmentDisplayName(static_cast(i)))); } } diff --git a/src/duckstation-qt/enhancementsettingswidget.cpp b/src/duckstation-qt/enhancementsettingswidget.cpp index 1f6f87b12..3a89d2d72 100644 --- a/src/duckstation-qt/enhancementsettingswidget.cpp +++ b/src/duckstation-qt/enhancementsettingswidget.cpp @@ -91,7 +91,7 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(SettingsDialog* dialog, QWi "Only applies to the hardware renderers.")); dialog->registerWidgetHelp( m_ui.textureFiltering, tr("Texture Filtering"), - qApp->translate("GPUTextureFilter", Settings::GetTextureFilterDisplayName(GPUTextureFilter::Nearest)), + QString::fromUtf8(Settings::GetTextureFilterDisplayName(GPUTextureFilter::Nearest)), tr("Smooths out the blockiness of magnified textures on 3D object by using filtering.
Will have a " "greater effect on higher resolution scales. Only applies to the hardware renderers.
The JINC2 and " "especially xBR filtering modes are very demanding, and may not be worth the speed penalty.")); @@ -148,13 +148,13 @@ void EnhancementSettingsWidget::setupAdditionalUi() for (u32 i = 0; i < static_cast(GPUTextureFilter::Count); i++) { m_ui.textureFiltering->addItem( - qApp->translate("GPUTextureFilter", Settings::GetTextureFilterDisplayName(static_cast(i)))); + QString::fromUtf8(Settings::GetTextureFilterDisplayName(static_cast(i)))); } for (u32 i = 0; i < static_cast(GPUDownsampleMode::Count); i++) { m_ui.gpuDownsampleMode->addItem( - qApp->translate("GPUDownsampleMode", Settings::GetDownsampleModeDisplayName(static_cast(i)))); + QString::fromUtf8(Settings::GetDownsampleModeDisplayName(static_cast(i)))); } } diff --git a/src/duckstation-qt/gamesummarywidget.cpp b/src/duckstation-qt/gamesummarywidget.cpp index 652f72244..a00adc329 100644 --- a/src/duckstation-qt/gamesummarywidget.cpp +++ b/src/duckstation-qt/gamesummarywidget.cpp @@ -34,14 +34,14 @@ GameSummaryWidget::GameSummaryWidget(const std::string& path, const std::string& for (u32 i = 0; i < static_cast(DiscRegion::Count); i++) { m_ui.region->addItem(QtUtils::GetIconForRegion(static_cast(i)), - qApp->translate("DiscRegion", Settings::GetDiscRegionDisplayName(static_cast(i)))); + QString::fromUtf8(Settings::GetDiscRegionDisplayName(static_cast(i)))); } for (u32 i = 0; i < static_cast(GameDatabase::CompatibilityRating::Count); i++) { m_ui.compatibility->addItem(QtUtils::GetIconForCompatibility(static_cast(i)), - qApp->translate("GameListCompatibilityRating", GameDatabase::GetCompatibilityRatingDisplayName( - static_cast(i)))); + QString::fromUtf8(GameDatabase::GetCompatibilityRatingDisplayName( + static_cast(i)))); } populateUi(path, serial, region, entry); @@ -113,8 +113,7 @@ void GameSummaryWidget::populateUi(const std::string& path, const std::string& s { if (!controllers.isEmpty()) controllers.append(", "); - controllers.append( - qApp->translate("ControllerType", Settings::GetControllerTypeDisplayName(static_cast(i)))); + controllers.append(Settings::GetControllerTypeDisplayName(static_cast(i))); } } } diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index bd1a2a480..d97254d4f 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1567,8 +1567,8 @@ void MainWindow::setupAdditionalUi() for (u32 i = 0; i < static_cast(CPUExecutionMode::Count); i++) { const CPUExecutionMode mode = static_cast(i); - QAction* action = m_ui.menuCPUExecutionMode->addAction( - qApp->translate("CPUExecutionMode", Settings::GetCPUExecutionModeDisplayName(mode))); + QAction* action = + m_ui.menuCPUExecutionMode->addAction(QString::fromUtf8(Settings::GetCPUExecutionModeDisplayName(mode))); action->setCheckable(true); connect(action, &QAction::triggered, [this, mode]() { Host::SetBaseStringSettingValue("CPU", "ExecutionMode", Settings::GetCPUExecutionModeName(mode)); @@ -1582,8 +1582,7 @@ void MainWindow::setupAdditionalUi() for (u32 i = 0; i < static_cast(GPURenderer::Count); i++) { const GPURenderer renderer = static_cast(i); - QAction* action = - m_ui.menuRenderer->addAction(qApp->translate("GPURenderer", Settings::GetRendererDisplayName(renderer))); + QAction* action = m_ui.menuRenderer->addAction(QString::fromUtf8(Settings::GetRendererDisplayName(renderer))); action->setCheckable(true); connect(action, &QAction::triggered, [this, renderer]() { Host::SetBaseStringSettingValue("GPU", "Renderer", Settings::GetRendererName(renderer)); @@ -1597,8 +1596,8 @@ void MainWindow::setupAdditionalUi() for (u32 i = 0; i < static_cast(DisplayCropMode::Count); i++) { const DisplayCropMode crop_mode = static_cast(i); - QAction* action = m_ui.menuCropMode->addAction( - qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(crop_mode))); + QAction* action = + m_ui.menuCropMode->addAction(QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(crop_mode))); action->setCheckable(true); connect(action, &QAction::triggered, [this, crop_mode]() { Host::SetBaseStringSettingValue("Display", "CropMode", Settings::GetDisplayCropModeName(crop_mode)); @@ -2335,8 +2334,8 @@ void MainWindow::updateDebugMenuCPUExecutionMode() if (!current_mode.has_value()) return; - const QString current_mode_display_name( - qApp->translate("CPUExecutionMode", Settings::GetCPUExecutionModeDisplayName(current_mode.value()))); + const QString current_mode_display_name = + QString::fromUtf8(Settings::GetCPUExecutionModeDisplayName(current_mode.value())); for (QObject* obj : m_ui.menuCPUExecutionMode->children()) { QAction* action = qobject_cast(obj); @@ -2353,8 +2352,8 @@ void MainWindow::updateDebugMenuGPURenderer() if (!current_renderer.has_value()) return; - const QString current_renderer_display_name( - qApp->translate("GPURenderer", Settings::GetRendererDisplayName(current_renderer.value()))); + const QString current_renderer_display_name = + QString::fromUtf8(Settings::GetRendererDisplayName(current_renderer.value())); for (QObject* obj : m_ui.menuRenderer->children()) { QAction* action = qobject_cast(obj); @@ -2370,8 +2369,8 @@ void MainWindow::updateDebugMenuCropMode() if (!current_crop_mode.has_value()) return; - const QString current_crop_mode_display_name( - qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(current_crop_mode.value()))); + const QString current_crop_mode_display_name = + QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(current_crop_mode.value())); for (QObject* obj : m_ui.menuCropMode->children()) { QAction* action = qobject_cast(obj); diff --git a/src/duckstation-qt/memorycardsettingswidget.cpp b/src/duckstation-qt/memorycardsettingswidget.cpp index f8c7e6f23..e6d3fb7e3 100644 --- a/src/duckstation-qt/memorycardsettingswidget.cpp +++ b/src/duckstation-qt/memorycardsettingswidget.cpp @@ -118,7 +118,7 @@ void MemoryCardSettingsWidget::createPortSettingsUi(SettingsDialog* dialog, int for (int i = 0; i < static_cast(MemoryCardType::Count); i++) { ui->memory_card_type->addItem( - qApp->translate("MemoryCardType", Settings::GetMemoryCardTypeDisplayName(static_cast(i)))); + QString::fromUtf8(Settings::GetMemoryCardTypeDisplayName(static_cast(i)))); } const MemoryCardType default_value = (index == 0) ? MemoryCardType::PerGameTitle : MemoryCardType::None;