From b1b2c91eb3fce4aa1423ad0cf0ca846b2daea4c7 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 6 Jul 2014 14:02:00 -0700 Subject: [PATCH 1/2] Fix issues on win32 with multithreading. We weren't properly rechecking based on spurious wakeups (which technically can happen on x64 too.) --- Core/ThreadEventQueue.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Core/ThreadEventQueue.h b/Core/ThreadEventQueue.h index 3fdc0d043a..cddfa69852 100644 --- a/Core/ThreadEventQueue.h +++ b/Core/ThreadEventQueue.h @@ -75,9 +75,13 @@ struct ThreadEventQueue : public B { eventsHaveRun_ = true; do { - if (!HasEvents()) { + while (!HasEvents() && !ShouldExitEventLoop() && threadEnabled_) { eventsWait_.wait(eventsLock_); } + // Quit the loop if the queue is drained and coreState has tripped, or threading is disabled. + if (!HasEvents()) { + break; + } for (Event ev = GetNextEvent(); EventType(ev) != EVENT_INVALID; ev = GetNextEvent()) { eventsLock_.unlock(); @@ -95,11 +99,6 @@ struct ThreadEventQueue : public B { } eventsLock_.lock(); } - - // Quit the loop if the queue is drained and coreState has tripped, or threading is disabled. - if (ShouldExitEventLoop() || !threadEnabled_) { - break; - } } while (CoreTiming::GetTicks() < globalticks); // This will force the waiter to check coreState, even if we didn't actually drain. From 408ea88cd6abff8773dceddc57aaa844f903df5c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 6 Jul 2014 14:02:45 -0700 Subject: [PATCH 2/2] Fix incorrect state after reset in multithreading. This would change coreState from CORE_POWERUP too early. It's already done in BootDone(). --- UI/EmuScreen.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index aacb6ac442..c635bbf9b6 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -178,10 +178,13 @@ void EmuScreen::sendMessage(const char *message, const char *value) { PSP_Shutdown(); bootPending_ = false; invalid_ = true; + host->UpdateDisassembly(); } else if (!strcmp(message, "reset")) { PSP_Shutdown(); bootPending_ = true; invalid_ = true; + host->UpdateDisassembly(); + std::string resetError; if (!PSP_InitStart(PSP_CoreParameter(), &resetError)) { ELOG("Error resetting: %s", resetError.c_str()); @@ -189,13 +192,6 @@ void EmuScreen::sendMessage(const char *message, const char *value) { System_SendMessage("event", "failstartgame"); return; } -#ifndef MOBILE_DEVICE - if (g_Config.bAutoRun) { - Core_EnableStepping(false); - } else { - Core_EnableStepping(true); - } -#endif } else if (!strcmp(message, "boot")) { const char *ext = strrchr(value, '.'); if (!strcmp(ext, ".ppst")) {