Merge pull request #2828 from CookiePLMonster/keyed-osd

Add keys to more OSD messages
This commit is contained in:
Connor McLaughlin 2022-05-13 22:34:32 +10:00 committed by GitHub
commit 6f932c29a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 27 deletions

View file

@ -149,8 +149,9 @@ void GPU_HW::UpdateHWSettings(bool* framebuffer_changed, bool* shaders_changed)
if (m_resolution_scale != resolution_scale) if (m_resolution_scale != resolution_scale)
{ {
g_host_interface->AddFormattedOSDMessage( g_host_interface->AddKeyedFormattedOSDMessage(
10.0f, g_host_interface->TranslateString("OSDMessage", "Resolution scale set to %ux (display %ux%u, VRAM %ux%u)"), "ResolutionScale", 10.0f,
g_host_interface->TranslateString("OSDMessage", "Resolution scale set to %ux (display %ux%u, VRAM %ux%u)"),
resolution_scale, m_crtc_state.display_vram_width * resolution_scale, resolution_scale, m_crtc_state.display_vram_width * resolution_scale,
resolution_scale * m_crtc_state.display_vram_height, VRAM_WIDTH * resolution_scale, resolution_scale * m_crtc_state.display_vram_height, VRAM_WIDTH * resolution_scale,
VRAM_HEIGHT * resolution_scale); VRAM_HEIGHT * resolution_scale);
@ -160,14 +161,15 @@ void GPU_HW::UpdateHWSettings(bool* framebuffer_changed, bool* shaders_changed)
{ {
if (per_sample_shading) if (per_sample_shading)
{ {
g_host_interface->AddFormattedOSDMessage( g_host_interface->AddKeyedFormattedOSDMessage(
10.0f, g_host_interface->TranslateString("OSDMessage", "Multisample anti-aliasing set to %ux (SSAA)."), "Multisampling", 10.0f,
multisamples); g_host_interface->TranslateString("OSDMessage", "Multisample anti-aliasing set to %ux (SSAA)."), multisamples);
} }
else else
{ {
g_host_interface->AddFormattedOSDMessage( g_host_interface->AddKeyedFormattedOSDMessage(
10.0f, g_host_interface->TranslateString("OSDMessage", "Multisample anti-aliasing set to %ux."), multisamples); "Multisampling", 10.0f,
g_host_interface->TranslateString("OSDMessage", "Multisample anti-aliasing set to %ux."), multisamples);
} }
} }

View file

@ -1074,8 +1074,8 @@ void HostInterface::ToggleSoftwareRendering()
const GPURenderer new_renderer = g_gpu->IsHardwareRenderer() ? GPURenderer::Software : g_settings.gpu_renderer; const GPURenderer new_renderer = g_gpu->IsHardwareRenderer() ? GPURenderer::Software : g_settings.gpu_renderer;
AddFormattedOSDMessage(5.0f, TranslateString("OSDMessage", "Switching to %s renderer..."), AddKeyedFormattedOSDMessage("SoftwareRendering", 5.0f, TranslateString("OSDMessage", "Switching to %s renderer..."),
Settings::GetRendererDisplayName(new_renderer)); Settings::GetRendererDisplayName(new_renderer));
System::RecreateGPU(new_renderer); System::RecreateGPU(new_renderer);
OnDisplayInvalidated(); OnDisplayInvalidated();
} }

View file

@ -2594,24 +2594,25 @@ void CommonHostInterface::RegisterGraphicsHotkeys()
if (pressed && System::IsValid()) if (pressed && System::IsValid())
{ {
g_settings.gpu_pgxp_cpu = !g_settings.gpu_pgxp_cpu; g_settings.gpu_pgxp_cpu = !g_settings.gpu_pgxp_cpu;
if (!g_settings.gpu_pgxp_enable)
return;
g_gpu->RestoreGraphicsAPIState(); g_gpu->RestoreGraphicsAPIState();
g_gpu->UpdateSettings(); g_gpu->UpdateSettings();
g_gpu->ResetGraphicsAPIState(); g_gpu->ResetGraphicsAPIState();
System::ClearMemorySaveStates(); System::ClearMemorySaveStates();
AddOSDMessage(g_settings.gpu_pgxp_cpu ? AddKeyedOSDMessage("TogglePGXPCPU",
TranslateStdString("OSDMessage", "PGXP CPU mode is now enabled.") : g_settings.gpu_pgxp_cpu ?
TranslateStdString("OSDMessage", "PGXP CPU mode is now disabled."), TranslateStdString("OSDMessage", "PGXP CPU mode is now enabled.") :
5.0f); TranslateStdString("OSDMessage", "PGXP CPU mode is now disabled."),
5.0f);
if (g_settings.gpu_pgxp_enable) PGXP::Shutdown();
{ PGXP::Initialize();
PGXP::Shutdown();
PGXP::Initialize();
// we need to recompile all blocks if pgxp is toggled on/off // we need to recompile all blocks if pgxp is toggled on/off
if (g_settings.IsUsingCodeCache()) if (g_settings.IsUsingCodeCache())
CPU::CodeCache::Flush(); CPU::CodeCache::Flush();
}
} }
}); });
} }
@ -4056,14 +4057,14 @@ void CommonHostInterface::TogglePostProcessing()
g_settings.display_post_processing = !g_settings.display_post_processing; g_settings.display_post_processing = !g_settings.display_post_processing;
if (g_settings.display_post_processing) if (g_settings.display_post_processing)
{ {
AddOSDMessage(TranslateStdString("OSDMessage", "Post-processing is now enabled."), 10.0f); AddKeyedOSDMessage("PostProcessing", TranslateStdString("OSDMessage", "Post-processing is now enabled."), 10.0f);
if (!m_display->SetPostProcessingChain(g_settings.display_post_process_chain)) if (!m_display->SetPostProcessingChain(g_settings.display_post_process_chain))
AddOSDMessage(TranslateStdString("OSDMessage", "Failed to load post processing shader chain."), 20.0f); AddOSDMessage(TranslateStdString("OSDMessage", "Failed to load post processing shader chain."), 20.0f);
} }
else else
{ {
AddOSDMessage(TranslateStdString("OSDMessage", "Post-processing is now disabled."), 10.0f); AddKeyedOSDMessage("PostProcessing", TranslateStdString("OSDMessage", "Post-processing is now disabled."), 10.0f);
m_display->SetPostProcessingChain({}); m_display->SetPostProcessingChain({});
} }
} }
@ -4112,15 +4113,17 @@ void CommonHostInterface::ToggleWidescreen()
if (g_settings.gpu_widescreen_hack) if (g_settings.gpu_widescreen_hack)
{ {
AddFormattedOSDMessage( AddKeyedFormattedOSDMessage(
5.0f, TranslateString("OSDMessage", "Widescreen hack is now enabled, and aspect ratio is set to %s."), "WidescreenHack", 5.0f,
TranslateString("OSDMessage", "Widescreen hack is now enabled, and aspect ratio is set to %s."),
TranslateString("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio)) TranslateString("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio))
.GetCharArray()); .GetCharArray());
} }
else else
{ {
AddFormattedOSDMessage( AddKeyedFormattedOSDMessage(
5.0f, TranslateString("OSDMessage", "Widescreen hack is now disabled, and aspect ratio is set to %s."), "WidescreenHack", 5.0f,
TranslateString("OSDMessage", "Widescreen hack is now disabled, and aspect ratio is set to %s."),
TranslateString("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio)) TranslateString("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio))
.GetCharArray()); .GetCharArray());
} }