From a8f514601040353c837c33bf7b03dc7b6c65408d Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 25 Jul 2022 17:36:38 +1000 Subject: [PATCH] GameDatabase: Add some missing OSD message keys --- src/core/analog_controller.cpp | 6 +-- src/core/game_database.cpp | 78 +++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/src/core/analog_controller.cpp b/src/core/analog_controller.cpp index b2b213290..b9ab90794 100644 --- a/src/core/analog_controller.cpp +++ b/src/core/analog_controller.cpp @@ -45,7 +45,8 @@ void AnalogController::Reset() { if (g_settings.controller_disable_analog_mode_forcing) { - Host::AddOSDMessage( + Host::AddKeyedOSDMessage( + "analog_controller_mode_ignored", Host::TranslateStdString( "OSDMessage", "Analog mode forcing is disabled by game settings. Controller will start in digital mode."), 10.0f); @@ -280,8 +281,7 @@ void AnalogController::UpdateHostVibration() { // Curve from https://github.com/KrossX/Pokopom/blob/master/Pokopom/Input_XInput.cpp#L210 const u8 state = m_motor_state[motor]; - const double x = - static_cast(std::min(state + static_cast(m_rumble_bias), 255)); + const double x = static_cast(std::min(state + static_cast(m_rumble_bias), 255)); const double strength = 0.006474549734772402 * std::pow(x, 3.0) - 1.258165252213538 * std::pow(x, 2.0) + 156.82454281087692 * x + 3.637978807091713e-11; diff --git a/src/core/game_database.cpp b/src/core/game_database.cpp index 910fbc3ff..a10425f6c 100644 --- a/src/core/game_database.cpp +++ b/src/core/game_database.cpp @@ -240,8 +240,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.cpu_execution_mode != CPUExecutionMode::Interpreter) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "CPU interpreter forced by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_force_interpreter", + Host::TranslateStdString("OSDMessage", "CPU interpreter forced by game settings."), + osd_duration); } settings.cpu_execution_mode = CPUExecutionMode::Interpreter; @@ -251,8 +252,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_renderer != GPURenderer::Software) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "Software renderer forced by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_force_software", + Host::TranslateStdString("OSDMessage", "Software renderer forced by game settings."), + osd_duration); } settings.gpu_renderer = GPURenderer::Software; @@ -262,7 +264,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_disable_interlacing) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "Interlacing forced by game settings."), osd_duration); + Host::AddKeyedOSDMessage("gamedb_force_interlacing", + Host::TranslateStdString("OSDMessage", "Interlacing forced by game settings."), + osd_duration); } settings.gpu_disable_interlacing = false; @@ -272,8 +276,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_true_color) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "True color disabled by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_disable_true_color", + Host::TranslateStdString("OSDMessage", "True color disabled by game settings."), + osd_duration); } settings.gpu_true_color = false; @@ -283,7 +288,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_resolution_scale > 1) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "Upscaling disabled by game settings."), osd_duration); + Host::AddKeyedOSDMessage("gamedb_disable_upscaling", + Host::TranslateStdString("OSDMessage", "Upscaling disabled by game settings."), + osd_duration); } settings.gpu_resolution_scale = 1; @@ -293,8 +300,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_scaled_dithering) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "Scaled dithering disabled by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_disable_scaled_dithering", + Host::TranslateStdString("OSDMessage", "Scaled dithering disabled by game settings."), + osd_duration); } settings.gpu_scaled_dithering = false; @@ -305,8 +313,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes if (display_osd_messages && (settings.display_aspect_ratio == DisplayAspectRatio::R16_9 || settings.gpu_widescreen_hack)) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "Widescreen disabled by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_disable_widescreen", + Host::TranslateStdString("OSDMessage", "Widescreen disabled by game settings."), + osd_duration); } settings.display_aspect_ratio = DisplayAspectRatio::R4_3; @@ -317,8 +326,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_force_ntsc_timings) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "Forcing NTSC Timings disallowed by game settings."), - osd_duration); + Host::AddKeyedOSDMessage( + "gamedb_disable_force_ntsc_timings", + Host::TranslateStdString("OSDMessage", "Forcing NTSC Timings disallowed by game settings."), osd_duration); } settings.gpu_force_ntsc_timings = false; @@ -328,8 +338,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_pgxp_enable) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "PGXP geometry correction disabled by game settings."), - osd_duration); + Host::AddKeyedOSDMessage( + "gamedb_disable_pgxp", + Host::TranslateStdString("OSDMessage", "PGXP geometry correction disabled by game settings."), osd_duration); } settings.gpu_pgxp_enable = false; @@ -339,8 +350,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_culling) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "PGXP culling disabled by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_disable_pgxp_culling", + Host::TranslateStdString("OSDMessage", "PGXP culling disabled by game settings."), + osd_duration); } settings.gpu_pgxp_culling = false; @@ -350,8 +362,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_texture_correction) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "PGXP texture correction disabled by game settings."), - osd_duration); + Host::AddKeyedOSDMessage( + "gamedb_disable_pgxp_texture", + Host::TranslateStdString("OSDMessage", "PGXP texture correction disabled by game settings."), osd_duration); } settings.gpu_pgxp_texture_correction = false; @@ -361,8 +374,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_vertex_cache) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "PGXP vertex cache forced by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_force_pgxp_vertex_cache", + Host::TranslateStdString("OSDMessage", "PGXP vertex cache forced by game settings."), + osd_duration); } settings.gpu_pgxp_vertex_cache = true; @@ -372,8 +386,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_cpu) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "PGXP CPU mode forced by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_force_pgxp_cpu", + Host::TranslateStdString("OSDMessage", "PGXP CPU mode forced by game settings."), + osd_duration); } settings.gpu_pgxp_cpu = true; @@ -383,19 +398,14 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes { if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_depth_buffer) { - Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "PGXP Depth Buffer disabled by game settings."), - osd_duration); + Host::AddKeyedOSDMessage("gamedb_disable_pgxp_depth", + Host::TranslateStdString("OSDMessage", "PGXP Depth Buffer disabled by game settings."), + osd_duration); } settings.gpu_pgxp_depth_buffer = false; } - if (HasTrait(Trait::ForceSoftwareRenderer)) - { - Log_WarningPrint("Using software renderer for readbacks."); - settings.gpu_renderer = GPURenderer::Software; - } - if (HasTrait(Trait::ForceRecompilerMemoryExceptions)) { Log_WarningPrint("Memory exceptions for recompiler forced by game settings."); @@ -451,8 +461,8 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes Host::TranslateString("ControllerType", Settings::GetControllerTypeDisplayName(supported_ctype))); } - Host::AddFormattedOSDMessage( - 30.0f, + Host::AddKeyedFormattedOSDMessage( + "gamedb_controller_unsupported", 30.0f, Host::TranslateString("OSDMessage", "Controller in port %u (%s) is not supported for %s.\nSupported controllers: " "%s\nPlease configure a supported controller from the list above."),