Do not allow skipping display frames (except in extreme lag), so that the user sees every emulated frame and the HUD updates every frame.

This commit is contained in:
SuuperW 2018-06-28 11:34:38 -05:00
parent a8fa8a44d6
commit ee8fdebcf1
1 changed files with 6 additions and 1 deletions

View File

@ -1965,6 +1965,8 @@ slock_t *display_mutex = NULL;
sthread_t *display_thread = NULL; sthread_t *display_thread = NULL;
volatile bool display_die = false; volatile bool display_die = false;
HANDLE display_wakeup_event = INVALID_HANDLE_VALUE; HANDLE display_wakeup_event = INVALID_HANDLE_VALUE;
HANDLE display_done_event = INVALID_HANDLE_VALUE;
DWORD display_done_timeout = 500;
int displayPostponeType = 0; int displayPostponeType = 0;
DWORD displayPostponeUntil = ~0; DWORD displayPostponeUntil = ~0;
@ -2112,7 +2114,7 @@ void displayThread(void *arg)
} }
displayProc(); displayProc();
SetEvent(display_done_event);
} while (!display_die); } while (!display_die);
} }
@ -2289,6 +2291,8 @@ static void StepRunLoop_User()
Hud.fps = mainLoopData.fps; Hud.fps = mainLoopData.fps;
Hud.fps3d = GPU->GetFPSRender3D(); Hud.fps3d = GPU->GetFPSRender3D();
// wait for the HUD to update from last frame
WaitForSingleObject(display_done_event, display_done_timeout);
Display(); Display();
mainLoopData.fps3d = Hud.fps3d; mainLoopData.fps3d = Hud.fps3d;
@ -2991,6 +2995,7 @@ int _main()
display_invoke_ready_event = CreateEvent(NULL, TRUE, FALSE, NULL); display_invoke_ready_event = CreateEvent(NULL, TRUE, FALSE, NULL);
display_invoke_done_event = CreateEvent(NULL, FALSE, FALSE, NULL); display_invoke_done_event = CreateEvent(NULL, FALSE, FALSE, NULL);
display_wakeup_event = CreateEvent(NULL, FALSE, FALSE, NULL); display_wakeup_event = CreateEvent(NULL, FALSE, FALSE, NULL);
display_done_event = CreateEvent(NULL, FALSE, FALSE, NULL);
// struct configured_features my_config; // struct configured_features my_config;