VideoCommon: fix -Wshadow-uncaptured-local warning and simplify

This commit is contained in:
Tillmann Karras 2024-10-16 02:39:23 +01:00
parent 904ac5592d
commit 0e41adb7b7

View File

@ -15,9 +15,8 @@ std::unique_ptr<WidescreenManager> g_widescreen;
WidescreenManager::WidescreenManager() WidescreenManager::WidescreenManager()
{ {
std::optional<bool> is_game_widescreen = GetWidescreenOverride(); if (std::optional<bool> is_game_widescreen = GetWidescreenOverride())
if (is_game_widescreen.has_value()) m_is_game_widescreen = *is_game_widescreen;
m_is_game_widescreen = is_game_widescreen.value();
// Throw a warning as unsupported aspect ratio modes have no specific behavior to them // Throw a warning as unsupported aspect ratio modes have no specific behavior to them
const bool is_valid_suggested_aspect_mode = const bool is_valid_suggested_aspect_mode =
@ -34,14 +33,13 @@ WidescreenManager::WidescreenManager()
[this](u32 bits) { [this](u32 bits) {
if (bits & (CONFIG_CHANGE_BIT_ASPECT_RATIO)) if (bits & (CONFIG_CHANGE_BIT_ASPECT_RATIO))
{ {
std::optional<bool> is_game_widescreen = GetWidescreenOverride();
// If the widescreen flag isn't being overridden by any settings, // If the widescreen flag isn't being overridden by any settings,
// reset it to default if heuristic aren't running or to the last // reset it to default if heuristic aren't running or to the last
// heuristic value if they were running. // heuristic value if they were running.
if (!is_game_widescreen.has_value()) if (std::optional<bool> is_game_widescreen = GetWidescreenOverride())
is_game_widescreen = (m_heuristic_state == HeuristicState::Active_Found_Anamorphic); m_is_game_widescreen = *is_game_widescreen;
if (is_game_widescreen.has_value()) else
m_is_game_widescreen = is_game_widescreen.value(); m_is_game_widescreen = (m_heuristic_state == HeuristicState::Active_Found_Anamorphic);
} }
}, },
"Widescreen"); "Widescreen");