mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-30 09:35:40 +00:00
CommonHostInterface: Fix translatability of widescreen hack toggle message
This commit is contained in:
parent
6eb0496d77
commit
8dd36f4474
|
@ -3357,24 +3357,48 @@ void CommonHostInterface::ReloadPostProcessingShaders()
|
||||||
void CommonHostInterface::ToggleWidescreen()
|
void CommonHostInterface::ToggleWidescreen()
|
||||||
{
|
{
|
||||||
g_settings.gpu_widescreen_hack = !g_settings.gpu_widescreen_hack;
|
g_settings.gpu_widescreen_hack = !g_settings.gpu_widescreen_hack;
|
||||||
const GameSettings::Entry* gs = m_game_list->GetGameSettings(System::GetRunningPath(), System::GetRunningCode());
|
|
||||||
DisplayAspectRatio userRatio;
|
|
||||||
if (gs && gs->display_aspect_ratio.has_value())
|
|
||||||
userRatio = gs->display_aspect_ratio.value();
|
|
||||||
else
|
|
||||||
userRatio = Settings::ParseDisplayAspectRatio(
|
|
||||||
m_settings_interface
|
|
||||||
->GetStringValue("Display", "AspectRatio", Settings::GetDisplayAspectRatioName(DisplayAspectRatio::Auto))
|
|
||||||
.c_str())
|
|
||||||
.value_or(DisplayAspectRatio::Auto);
|
|
||||||
if (userRatio == DisplayAspectRatio::Auto || userRatio == DisplayAspectRatio::PAR1_1 || userRatio == DisplayAspectRatio::R4_3)
|
|
||||||
g_settings.display_aspect_ratio = g_settings.gpu_widescreen_hack ? DisplayAspectRatio::R16_9 : userRatio;
|
|
||||||
else
|
|
||||||
g_settings.display_aspect_ratio = g_settings.gpu_widescreen_hack ? userRatio : DisplayAspectRatio::Auto;
|
|
||||||
|
|
||||||
String arMessage;
|
const GameSettings::Entry* gs = m_game_list->GetGameSettings(System::GetRunningPath(), System::GetRunningCode());
|
||||||
arMessage.AppendFormattedString("Widescreen Hack is now %s and aspect ratio set to %s.", g_settings.gpu_widescreen_hack ? "enabled" : "disabled", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio));
|
DisplayAspectRatio user_ratio;
|
||||||
AddOSDMessage(TranslateStdString("OSDMessage", arMessage), 5.0f);
|
if (gs && gs->display_aspect_ratio.has_value())
|
||||||
|
{
|
||||||
|
user_ratio = gs->display_aspect_ratio.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::lock_guard<std::recursive_mutex> guard(m_settings_mutex);
|
||||||
|
user_ratio = Settings::ParseDisplayAspectRatio(
|
||||||
|
m_settings_interface
|
||||||
|
->GetStringValue("Display", "AspectRatio",
|
||||||
|
Settings::GetDisplayAspectRatioName(Settings::DEFAULT_DISPLAY_ASPECT_RATIO))
|
||||||
|
.c_str())
|
||||||
|
.value_or(DisplayAspectRatio::Auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user_ratio == DisplayAspectRatio::Auto || user_ratio == DisplayAspectRatio::PAR1_1 ||
|
||||||
|
user_ratio == DisplayAspectRatio::R4_3)
|
||||||
|
{
|
||||||
|
g_settings.display_aspect_ratio = g_settings.gpu_widescreen_hack ? DisplayAspectRatio::R16_9 : user_ratio;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_settings.display_aspect_ratio = g_settings.gpu_widescreen_hack ? user_ratio : DisplayAspectRatio::Auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_settings.gpu_widescreen_hack)
|
||||||
|
{
|
||||||
|
AddFormattedOSDMessage(
|
||||||
|
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))
|
||||||
|
.GetCharArray());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddFormattedOSDMessage(
|
||||||
|
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))
|
||||||
|
.GetCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
GTE::UpdateAspectRatio();
|
GTE::UpdateAspectRatio();
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,7 @@ public:
|
||||||
/// Reloads post processing shaders with the current configuration.
|
/// Reloads post processing shaders with the current configuration.
|
||||||
void ReloadPostProcessingShaders();
|
void ReloadPostProcessingShaders();
|
||||||
|
|
||||||
/// Toggle Widescreen Hack and Aspect Ratio
|
/// Toggle Widescreen Hack and Aspect Ratio
|
||||||
void ToggleWidescreen();
|
void ToggleWidescreen();
|
||||||
|
|
||||||
/// Parses a fullscreen mode into its components (width * height @ refresh hz)
|
/// Parses a fullscreen mode into its components (width * height @ refresh hz)
|
||||||
|
|
Loading…
Reference in a new issue