diff --git a/Core/Core.cpp b/Core/Core.cpp index 1351788364..f0c19dcd72 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -161,9 +161,9 @@ void Core_RunLoop() { // Simple throttling to not burn the GPU in the menu. time_update(); double diffTime = time_now_d() - startTime; - int sleepTime = (int)(1000000.0 / 60.0) - (int)(diffTime * 1000000.0); + int sleepTime = (int)(1000.0 / 60.0) - (int)(diffTime * 1000.0); if (sleepTime > 0) - Sleep(sleepTime / 1000); + Sleep(sleepTime); if (!windowHidden) { GL_SwapBuffers(); } diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 274d7268f0..8b30c7d3e5 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -546,7 +546,12 @@ void DoFrameTiming(bool &throttle, bool &skipFrame, float timestep) { } else { // Wait until we've caught up. while (time_now_d() < nextFrameTime) { +#ifdef _WIN32 sleep_ms(1); // Sleep for 1ms on this thread +#else + const double left = nextFrameTime - curFrameTime; + usleep((long)(left * 1000000)); +#endif time_update(); } } @@ -557,7 +562,7 @@ void DoFrameTiming(bool &throttle, bool &skipFrame, float timestep) { } void DoFrameIdleTiming() { - if (!FrameTimingThrottled() || wasPaused) { + if (!FrameTimingThrottled() || !g_Config.bEnableSound || wasPaused) { return; } @@ -582,7 +587,12 @@ void DoFrameIdleTiming() { // Give a little extra wiggle room in case the next vblank does more work. const double goal = lastFrameTime + numVBlanksSinceFlip * scaledVblank - 0.001; while (time_now_d() < goal) { +#ifdef _WIN32 sleep_ms(1); +#else + const double left = goal - time_now_d(); + usleep((long)(left * 1000000)); +#endif time_update(); } } @@ -727,8 +737,8 @@ void hleLagSync(u64 userdata, int cyclesLate) { time_update(); // Don't lag too long ever, if they leave it paused. while (time_now_d() < goal && goal < time_now_d() + 0.01) { - const double left = goal - time_now_d(); #ifndef _WIN32 + const double left = goal - time_now_d(); usleep((long)(left * 1000000)); #endif time_update(); diff --git a/native b/native index 22f41720b3..84df417a01 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 22f41720b322c44d558546996f205bf6c06104d3 +Subproject commit 84df417a01c425c64cd7d5dfe44a598a72c94611