From 2590f03bc13c58a30ace8514dd775a8ae1aff832 Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Mon, 27 Oct 2025 20:12:31 +0900 Subject: [PATCH] [Emulator] Delegate to UI thread instead of assert --- src/xenia/emulator.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 523b3fadd..ae64b8c9f 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -1445,7 +1445,15 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path, const std::string_view module_path) { // Making changes to the UI (setting the icon) and executing game config // load callbacks which expect to be called from the UI thread. - assert_true(display_window_->app_context().IsInUIThread()); + // If not on UI thread, dispatch to it synchronously. + if (!display_window_->app_context().IsInUIThread()) { + X_STATUS result = X_STATUS_UNSUCCESSFUL; + display_window_->app_context().CallInUIThreadSynchronous( + [this, &path, &module_path, &result]() { + result = CompleteLaunch(path, module_path); + }); + return result; + } // Setup NullDevices for raw HDD partition accesses // Cache/STFC code baked into games tries reading/writing to these