Skip to content

Commit

Permalink
FullscreenUI: Fix deadlock/abort in Graphics Settings
Browse files Browse the repository at this point in the history
Regression from b9f4a01.

Closes #11249.
  • Loading branch information
stenzek authored May 14, 2024
1 parent e520dc2 commit 67f1d6e
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pcsx2/ImGui/FullscreenUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ namespace FullscreenUI
static void DrawInterfaceSettingsPage();
static void DrawBIOSSettingsPage();
static void DrawEmulationSettingsPage();
static void DrawGraphicsSettingsPage();
static void DrawGraphicsSettingsPage(SettingsInterface* bsi, bool show_advanced_settings);
static void DrawAudioSettingsPage();
static void DrawMemoryCardSettingsPage();
static void DrawControllerSettingsPage();
Expand Down Expand Up @@ -2811,6 +2811,9 @@ void FullscreenUI::DrawSettingsWindow()
ImVec2(io.DisplaySize.x, LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY + LAYOUT_MENU_BUTTON_Y_PADDING * 2.0f + 2.0f));

const float bg_alpha = VMManager::HasValidVM() ? 0.90f : 1.0f;
SettingsInterface* bsi = GetEditingSettingsInterface();
const bool game_settings = IsEditingGameSettings(bsi);
const bool show_advanced_settings = ShouldShowAdvancedSettings(bsi);

if (BeginFullscreenWindow(
ImVec2(0.0f, 0.0f), heading_size, "settings_category", ImVec4(UIPrimaryColor.x, UIPrimaryColor.y, UIPrimaryColor.z, bg_alpha)))
Expand All @@ -2833,11 +2836,7 @@ void FullscreenUI::DrawSettingsWindow()
FSUI_NSTR("Folder Settings"), FSUI_NSTR("Advanced Settings"), FSUI_NSTR("Patches"), FSUI_NSTR("Cheats"),
FSUI_NSTR("Game Fixes")};

SettingsInterface* bsi = GetEditingSettingsInterface();
const bool game_settings = IsEditingGameSettings(bsi);

const u32 count = game_settings ? (ShouldShowAdvancedSettings(bsi) ? std::size(per_game_pages) : (std::size(per_game_pages) - 1)) :
std::size(global_pages);
const u32 count = game_settings ? (show_advanced_settings ? std::size(per_game_pages) : (std::size(per_game_pages) - 1)) : std::size(global_pages);
const char* const* icons = game_settings ? per_game_icons : global_icons;
const SettingsPage* pages = game_settings ? per_game_pages : global_pages;
u32 index = 0;
Expand Down Expand Up @@ -2935,7 +2934,7 @@ void FullscreenUI::DrawSettingsWindow()
break;

case SettingsPage::Graphics:
DrawGraphicsSettingsPage();
DrawGraphicsSettingsPage(bsi, show_advanced_settings);
break;

case SettingsPage::Audio:
Expand Down Expand Up @@ -3442,7 +3441,7 @@ void FullscreenUI::DrawClampingModeSetting(SettingsInterface* bsi, const char* t
}
}

void FullscreenUI::DrawGraphicsSettingsPage()
void FullscreenUI::DrawGraphicsSettingsPage(SettingsInterface* bsi, bool show_advanced_settings)
{
static constexpr const char* s_renderer_names[] = {
FSUI_NSTR("Automatic (Default)"),
Expand Down Expand Up @@ -3602,8 +3601,6 @@ void FullscreenUI::DrawGraphicsSettingsPage()
FSUI_NSTR("WebP"),
};

SettingsInterface* bsi = GetEditingSettingsInterface();

const GSRendererType renderer =
static_cast<GSRendererType>(GetEffectiveIntSetting(bsi, "EmuCore/GS", "Renderer", static_cast<int>(GSRendererType::Auto)));
const bool is_hardware = (renderer == GSRendererType::Auto || renderer == GSRendererType::DX11 || renderer == GSRendererType::DX12 ||
Expand Down Expand Up @@ -3912,8 +3909,6 @@ void FullscreenUI::DrawGraphicsSettingsPage()

static constexpr const char* s_gsdump_compression[] = {FSUI_NSTR("Uncompressed"), FSUI_NSTR("LZMA (xz)"), FSUI_NSTR("Zstandard (zst)")};

const bool show_advanced_settings = ShouldShowAdvancedSettings(bsi);

if (show_advanced_settings)
{
MenuHeading(FSUI_CSTR("Advanced"));
Expand Down

0 comments on commit 67f1d6e

Please sign in to comment.