Remove AspectWidth and AspectHeight, instead introduce CustomAspectRatio option

This commit is contained in:
JaceCear 2025-03-07 15:54:34 +01:00
parent 27526bb41d
commit b168872d8a
4 changed files with 6 additions and 25 deletions

View file

@ -2922,19 +2922,17 @@ void Video::ComputeViewportDimensions()
case EAspectRatio::Custom: case EAspectRatio::Custom:
{ {
uint32_t horzAspect = Config::AspectWidth; float customAspectRatio = Config::CustomAspectRatio;
uint32_t vertAspect = Config::AspectHeight;
float customAspectRatio = float(horzAspect) / float(vertAspect);
if (aspectRatio > customAspectRatio) if (aspectRatio > customAspectRatio)
{ {
s_viewportWidth = height * horzAspect / vertAspect; s_viewportWidth = height * customAspectRatio;
s_viewportHeight = height; s_viewportHeight = height;
} }
else else
{ {
s_viewportWidth = width; s_viewportWidth = width;
s_viewportHeight = width * vertAspect / horzAspect; s_viewportHeight = width * (1. / customAspectRatio);
} }
break; break;
@ -7370,8 +7368,6 @@ void VideoConfigValueChangedCallback(IConfigDef* config)
// Config options that require internal resolution resize // Config options that require internal resolution resize
g_needsResize |= g_needsResize |=
config == &Config::AspectRatio || config == &Config::AspectRatio ||
config == &Config::AspectWidth ||
config == &Config::AspectHeight ||
config == &Config::ResolutionScale || config == &Config::ResolutionScale ||
config == &Config::AntiAliasing || config == &Config::AntiAliasing ||
config == &Config::ShadowResolution; config == &Config::ShadowResolution;

View file

@ -547,7 +547,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EAspectRatio)
{ EAspectRatio::Wide, { "16:9", "16:9: locks the game to a widescreen aspect ratio." } }, { EAspectRatio::Wide, { "16:9", "16:9: locks the game to a widescreen aspect ratio." } },
{ EAspectRatio::Narrow, { "4:3", "4:3: locks the game to a narrow aspect ratio." } }, { EAspectRatio::Narrow, { "4:3", "4:3: locks the game to a narrow aspect ratio." } },
{ EAspectRatio::OriginalNarrow, { "ORIGINAL 4:3", "Original 4:3: locks the game to a narrow aspect ratio and retains parity with the game's original implementation." } }, { EAspectRatio::OriginalNarrow, { "ORIGINAL 4:3", "Original 4:3: locks the game to a narrow aspect ratio and retains parity with the game's original implementation." } },
{ EAspectRatio::Custom, { "Custom", "Custom: The aspect ratio is set to the values in 'Aspect Width' and 'Aspect Height'." } } { EAspectRatio::Custom, { "Custom", "Custom:\nThe aspect ratio is set by using the CustomAspectRatio value in the config.toml file." } }
} }
}, },
{ {
@ -566,7 +566,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EAspectRatio)
{ EAspectRatio::Wide, { "16:9", "16:9: Stellt das Spiel in einem Breitbildschirm-Format dar." } }, { EAspectRatio::Wide, { "16:9", "16:9: Stellt das Spiel in einem Breitbildschirm-Format dar." } },
{ EAspectRatio::Narrow, { "4:3", "4:3: Stellt das Spiel in einem Mittel-Format dar." } }, { EAspectRatio::Narrow, { "4:3", "4:3: Stellt das Spiel in einem Mittel-Format dar." } },
{ EAspectRatio::OriginalNarrow, { "ORIGINAL 4:3", "Original 4:3: Stellt das Spiel in einem Mittel-Format dar, was der ursprünglichen Implementation originalgetreut bleibt." } }, { EAspectRatio::OriginalNarrow, { "ORIGINAL 4:3", "Original 4:3: Stellt das Spiel in einem Mittel-Format dar, was der ursprünglichen Implementation originalgetreut bleibt." } },
{ EAspectRatio::Custom, { "Benutzerdefiniert", "Benutzerdefiniert:\nDas Seitenverhältnis entspricht den Werten in 'Seitenverhältnis-\nBreite' und 'Seitenverhältnis-\nHöhe'." } } { EAspectRatio::Custom, { "Benutzerdefiniert", "Benutzerdefiniert:\nDas Seitenverhältnis entspricht dem Wert CustomAspectRatio in der Datei config.toml." } }
} }
}, },
{ {
@ -598,18 +598,6 @@ CONFIG_DEFINE_ENUM_LOCALE(EAspectRatio)
} }
}; };
CONFIG_DEFINE_LOCALE(AspectWidth)
{
{ ELanguage::English, { "Aspect Width", "Adjust aspect width for custom aspect ratios." } },
{ ELanguage::German, { "Seitenverhältnis-Breite", "Passe die Breite für benutzerdefinierte Seitenverhältnisse an." } }
};
CONFIG_DEFINE_LOCALE(AspectHeight)
{
{ ELanguage::English, { "Aspect Height", "Adjust aspect height for custom aspect ratios." } },
{ ELanguage::German, { "Seitenverhältnis-Höhe", "Passe die Höhe für benutzerdefinierte Seitenverhältnisse an." } }
};
// Japanese Notes: This localization should include furigana. // Japanese Notes: This localization should include furigana.
CONFIG_DEFINE_LOCALE(ResolutionScale) CONFIG_DEFINE_LOCALE(ResolutionScale)
{ {

View file

@ -1266,8 +1266,6 @@ static void DrawConfigOptions()
DrawConfigOption(rowCount++, yOffset, &Config::Monitor, canChangeMonitor, monitorReason, 0, 0, displayCount - 1, false); DrawConfigOption(rowCount++, yOffset, &Config::Monitor, canChangeMonitor, monitorReason, 0, 0, displayCount - 1, false);
DrawConfigOption(rowCount++, yOffset, &Config::AspectRatio, true); DrawConfigOption(rowCount++, yOffset, &Config::AspectRatio, true);
DrawConfigOption(rowCount++, yOffset, &Config::AspectWidth, true, nullptr, 1, 50, 100);
DrawConfigOption(rowCount++, yOffset, &Config::AspectHeight, true, nullptr, 1, 50, 100);
DrawConfigOption(rowCount++, yOffset, &Config::ResolutionScale, true, nullptr, 0.25f, 1.0f, 2.0f); DrawConfigOption(rowCount++, yOffset, &Config::ResolutionScale, true, nullptr, 0.25f, 1.0f, 2.0f);
DrawConfigOption(rowCount++, yOffset, &Config::Fullscreen, true); DrawConfigOption(rowCount++, yOffset, &Config::Fullscreen, true);
DrawConfigOption(rowCount++, yOffset, &Config::VSync, true); DrawConfigOption(rowCount++, yOffset, &Config::VSync, true);

View file

@ -56,8 +56,7 @@ CONFIG_DEFINE("Video", int32_t, WindowHeight, 720);
CONFIG_DEFINE_ENUM("Video", EWindowState, WindowState, EWindowState::Normal); CONFIG_DEFINE_ENUM("Video", EWindowState, WindowState, EWindowState::Normal);
CONFIG_DEFINE_LOCALISED("Video", int32_t, Monitor, 0); CONFIG_DEFINE_LOCALISED("Video", int32_t, Monitor, 0);
CONFIG_DEFINE_ENUM_LOCALISED("Video", EAspectRatio, AspectRatio, EAspectRatio::Auto); CONFIG_DEFINE_ENUM_LOCALISED("Video", EAspectRatio, AspectRatio, EAspectRatio::Auto);
CONFIG_DEFINE_LOCALISED("Video", int32_t, AspectWidth, 16); CONFIG_DEFINE("Video", float, CustomAspectRatio, (16.0f / 9.0f));
CONFIG_DEFINE_LOCALISED("Video", int32_t, AspectHeight, 9);
CONFIG_DEFINE_LOCALISED("Video", float, ResolutionScale, 1.0f); CONFIG_DEFINE_LOCALISED("Video", float, ResolutionScale, 1.0f);
CONFIG_DEFINE_LOCALISED("Video", bool, Fullscreen, true); CONFIG_DEFINE_LOCALISED("Video", bool, Fullscreen, true);
CONFIG_DEFINE_LOCALISED("Video", bool, VSync, true); CONFIG_DEFINE_LOCALISED("Video", bool, VSync, true);