diff --git a/Core/Core.cpp b/Core/Core.cpp index 5153b2e4b7e3..14ae476d1c49 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -153,6 +153,9 @@ bool UpdateScreenScale(int width, int height, bool smallWindow) { } void UpdateRunLoop() { + time_update(); + double startTime = time_now_d(); + if (windowHidden && g_Config.bPauseWhenMinimized) { sleep_ms(16); return; @@ -167,6 +170,16 @@ void UpdateRunLoop() { if (GetUIState() != UISTATE_EXIT) { NativeRender(); } + + if (GetUIState() != UISTATE_INGAME || !PSP_IsInited()) { + // Simple throttling to not burn the GPU in the menu. + time_update(); + double diffTime = time_now_d() - startTime; + int sleepTime = (int)(1000.0 / 60.0) - (int)(diffTime * 1000.0); + + if (sleepTime > 0) + sleep_ms(sleepTime); + } } #if defined(USING_WIN_UI) @@ -186,27 +199,15 @@ void GPU_SwapBuffers() { void Core_RunLoop() { while ((GetUIState() != UISTATE_INGAME || !PSP_IsInited()) && GetUIState() != UISTATE_EXIT) { - time_update(); -#if defined(USING_WIN_UI) - double startTime = time_now_d(); UpdateRunLoop(); - - // Simple throttling to not burn the GPU in the menu. - time_update(); - double diffTime = time_now_d() - startTime; - int sleepTime = (int)(1000.0 / 60.0) - (int)(diffTime * 1000.0); - if (sleepTime > 0) - Sleep(sleepTime); +#if defined(USING_WIN_UI) if (!windowHidden) { GPU_SwapBuffers(); } -#else - UpdateRunLoop(); #endif } while (!coreState && GetUIState() == UISTATE_INGAME) { - time_update(); UpdateRunLoop(); #if defined(USING_WIN_UI) if (!windowHidden && !Core_IsStepping()) { diff --git a/GPU/GLES/GLES_GPU.cpp b/GPU/GLES/GLES_GPU.cpp index aa5ab008d7be..a359c0d92efb 100644 --- a/GPU/GLES/GLES_GPU.cpp +++ b/GPU/GLES/GLES_GPU.cpp @@ -539,7 +539,7 @@ void GLES_GPU::BeginFrame() { } inline void GLES_GPU::UpdateVsyncInterval(bool force) { -#ifdef _WIN32 +#ifndef USING_GLES2 int desiredVSyncInterval = g_Config.bVSync ? 1 : 0; if (PSP_CoreParameter().unthrottle) { desiredVSyncInterval = 0; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 6d542e3b3f24..9512b37e5c6c 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -197,7 +197,7 @@ void GameSettingsScreen::CreateViews() { hwscale->OnChoice.Handle(this, &GameSettingsScreen::OnHwScaleChange); // To refresh the display mode #endif -#ifdef _WIN32 +#ifndef USING_GLES2 graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gs->T("VSync"))); #endif CheckBox *mipmapping = graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping")));