diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 28bff7681..3c12b0d1f 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -1768,7 +1768,7 @@ EmulatorWindow::ControllerHotKey EmulatorWindow::ProcessControllerHotkey( selected_title_index, 0, (int)recently_launched_titles_.size() - 1); // Must clear dialogs to prevent stacking - imgui_drawer_.get()->ClearDialogs(); + ClearDialogs(); // Titles may contain Unicode characters such as At World’s End // Must use ImGUI font that can render these Unicode characters @@ -1941,7 +1941,7 @@ void EmulatorWindow::DisplayHotKeysConfig() { msg += "Controller Hotkeys: " + xe::string_util::BoolToString(cvars::controller_hotkeys); - imgui_drawer_.get()->ClearDialogs(); + ClearDialogs(); xe::ui::ImGuiDialog::ShowMessageBox(imgui_drawer_.get(), "Controller Hotkeys", msg); } @@ -1973,7 +1973,7 @@ xe::X_STATUS EmulatorWindow::RunTitle( XELOGE("{}", log_msg); - imgui_drawer_.get()->ClearDialogs(); + ClearDialogs(); xe::ui::ImGuiDialog::ShowMessageBox(imgui_drawer_.get(), "Title Launch Failed!", log_msg); @@ -2020,7 +2020,7 @@ xe::X_STATUS EmulatorWindow::RunTitle( display_config_dialog_.reset(); } - imgui_drawer_.get()->ClearDialogs(); + ClearDialogs(); if (result) { XELOGE("Failed to launch target: {:08X}", result); @@ -2148,5 +2148,18 @@ void EmulatorWindow::AddRecentlyLaunchedTitle( file.close(); } +void EmulatorWindow::ClearDialogs() { + if (profile_config_dialog_) { + profile_config_dialog_.reset(); + } + + if (display_config_dialog_) { + display_config_dialog_.reset(); + } + + imgui_drawer_.get()->ClearDialogs(); + kernel::xam::xam_dialogs_shown_ = 0; +} + } // namespace app } // namespace xe diff --git a/src/xenia/app/emulator_window.h b/src/xenia/app/emulator_window.h index 5a25518fe..4f1c59da9 100644 --- a/src/xenia/app/emulator_window.h +++ b/src/xenia/app/emulator_window.h @@ -249,6 +249,8 @@ class EmulatorWindow { void AddRecentlyLaunchedTitle(std::filesystem::path path_to_file, std::string title_name); + void ClearDialogs(); + Emulator* emulator_; ui::WindowedAppContext& app_context_; EmulatorWindowListener window_listener_;