[App] Reset dialogs on refresh

This commit is contained in:
Adrian 2024-11-25 21:10:30 +00:00 committed by Radosław Gliński
parent c71649161e
commit cfd7da696f
2 changed files with 19 additions and 4 deletions

View File

@ -1768,7 +1768,7 @@ EmulatorWindow::ControllerHotKey EmulatorWindow::ProcessControllerHotkey(
selected_title_index, 0, (int)recently_launched_titles_.size() - 1); selected_title_index, 0, (int)recently_launched_titles_.size() - 1);
// Must clear dialogs to prevent stacking // Must clear dialogs to prevent stacking
imgui_drawer_.get()->ClearDialogs(); ClearDialogs();
// Titles may contain Unicode characters such as At Worlds End // Titles may contain Unicode characters such as At Worlds End
// Must use ImGUI font that can render these Unicode characters // Must use ImGUI font that can render these Unicode characters
@ -1941,7 +1941,7 @@ void EmulatorWindow::DisplayHotKeysConfig() {
msg += "Controller Hotkeys: " + msg += "Controller Hotkeys: " +
xe::string_util::BoolToString(cvars::controller_hotkeys); xe::string_util::BoolToString(cvars::controller_hotkeys);
imgui_drawer_.get()->ClearDialogs(); ClearDialogs();
xe::ui::ImGuiDialog::ShowMessageBox(imgui_drawer_.get(), "Controller Hotkeys", xe::ui::ImGuiDialog::ShowMessageBox(imgui_drawer_.get(), "Controller Hotkeys",
msg); msg);
} }
@ -1973,7 +1973,7 @@ xe::X_STATUS EmulatorWindow::RunTitle(
XELOGE("{}", log_msg); XELOGE("{}", log_msg);
imgui_drawer_.get()->ClearDialogs(); ClearDialogs();
xe::ui::ImGuiDialog::ShowMessageBox(imgui_drawer_.get(), xe::ui::ImGuiDialog::ShowMessageBox(imgui_drawer_.get(),
"Title Launch Failed!", log_msg); "Title Launch Failed!", log_msg);
@ -2020,7 +2020,7 @@ xe::X_STATUS EmulatorWindow::RunTitle(
display_config_dialog_.reset(); display_config_dialog_.reset();
} }
imgui_drawer_.get()->ClearDialogs(); ClearDialogs();
if (result) { if (result) {
XELOGE("Failed to launch target: {:08X}", result); XELOGE("Failed to launch target: {:08X}", result);
@ -2148,5 +2148,18 @@ void EmulatorWindow::AddRecentlyLaunchedTitle(
file.close(); 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 app
} // namespace xe } // namespace xe

View File

@ -249,6 +249,8 @@ class EmulatorWindow {
void AddRecentlyLaunchedTitle(std::filesystem::path path_to_file, void AddRecentlyLaunchedTitle(std::filesystem::path path_to_file,
std::string title_name); std::string title_name);
void ClearDialogs();
Emulator* emulator_; Emulator* emulator_;
ui::WindowedAppContext& app_context_; ui::WindowedAppContext& app_context_;
EmulatorWindowListener window_listener_; EmulatorWindowListener window_listener_;