Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion GPU/GLES/GLES_GPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")));
Expand Down