From e085c3ee760d1321545e9d8d010092e3ed572003 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 21 Feb 2013 01:05:37 -0800 Subject: [PATCH] Fix crash on quit / pause not working. --- Core/Core.cpp | 2 +- Core/HLE/sceDisplay.cpp | 7 +++++-- headless/Headless.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Core/Core.cpp b/Core/Core.cpp index 252800ebac..fefd4e04d3 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -72,8 +72,8 @@ void Core_RunLoop() if (coreState == CORE_NEXTFRAME) { #ifdef _WIN32 - GL_SwapBuffers(); coreState = CORE_RUNNING; + GL_SwapBuffers(); #endif } } diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 81d264e590..152b322fed 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -403,12 +403,15 @@ void hleEnterVblank(u64 userdata, int cyclesLate) { if (skipFrame) { gstate_c.skipDrawReason |= SKIPDRAW_SKIPFRAME; numSkippedFrames++; - } else { + } else { numSkippedFrames = 0; } if (!skipFlip) { - coreState = CORE_NEXTFRAME; + // Might've just quit / been paused. + if (coreState == CORE_RUNNING) { + coreState = CORE_NEXTFRAME; + } CoreTiming::ScheduleEvent(0 - cyclesLate, afterFlipEvent, 0); gpu->CopyDisplayToOutput(); diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 0eb3f0d51d..37e616bf77 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -197,8 +197,8 @@ int main(int argc, const char* argv[]) // If we were rendering, this might be a nice time to do something about it. if (coreState == CORE_NEXTFRAME) { - headlessHost->SwapBuffers(); coreState = CORE_RUNNING; + headlessHost->SwapBuffers(); } }