[XAM] Implemented game exit behavior in XamLoaderTerminateTitle
This commit is contained in:
committed by
Radosław Gliński
parent
44e1a64f35
commit
c6298dd0e3
@@ -342,6 +342,32 @@ void XamLoaderLaunchTitle_entry(lpstring_t raw_name_ptr, dword_t flags) {
|
|||||||
DECLARE_XAM_EXPORT1(XamLoaderLaunchTitle, kNone, kSketchy);
|
DECLARE_XAM_EXPORT1(XamLoaderLaunchTitle, kNone, kSketchy);
|
||||||
|
|
||||||
void XamLoaderTerminateTitle_entry() {
|
void XamLoaderTerminateTitle_entry() {
|
||||||
|
std::string title = "Title terminated";
|
||||||
|
std::string message = "Game requested exit to dashboard.";
|
||||||
|
assert_always("Game requested exit to dashboard via XamLoaderTerminateTitle");
|
||||||
|
|
||||||
|
auto display_window = kernel_state()->emulator()->display_window();
|
||||||
|
auto imgui_drawer = kernel_state()->emulator()->imgui_drawer();
|
||||||
|
|
||||||
|
if (display_window && imgui_drawer) {
|
||||||
|
display_window->app_context().CallInUIThreadSynchronous(
|
||||||
|
[imgui_drawer, title, message]() {
|
||||||
|
auto dialog = xe::ui::ImGuiDialog::ShowMessageBox(
|
||||||
|
imgui_drawer, title.c_str(), message.c_str());
|
||||||
|
|
||||||
|
std::jthread([dialog]() {
|
||||||
|
while (!dialog->IsClosing()) {
|
||||||
|
std::this_thread::yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
config::SaveConfig();
|
||||||
|
xe::FlushLog();
|
||||||
|
|
||||||
|
std::quick_exit(0);
|
||||||
|
}).detach();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// This function does not return.
|
// This function does not return.
|
||||||
kernel_state()->TerminateTitle();
|
kernel_state()->TerminateTitle();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user