[Emulator] Delegate to UI thread instead of assert

This commit is contained in:
Herman S.
2025-10-27 20:12:31 +09:00
parent c261027225
commit 2590f03bc1

View File

@@ -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