Skip to content

Commit

Permalink
don't emulate 60hz vblank on 60hz monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Oct 2, 2024
1 parent f9fa3b0 commit 95a5f72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions inc/dd.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ typedef struct CNCDDRAW
DWORD gui_thread_id;
BOOL show_driver_warning;
BOOL windowed_hack;
BOOL wait_for_real_vblank;

struct
{
Expand Down
10 changes: 9 additions & 1 deletion src/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,14 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
g_config.fullscreen = FALSE;
}
}
else if (g_config.maxgameticks == 0)
{
// no need to emulate 60hz vblank if we got a 60hz monitor
if (g_ddraw.mode.dmDisplayFrequency == 60 || g_ddraw.mode.dmDisplayFrequency == 59)
{
g_ddraw.wait_for_real_vblank = TRUE;
}
}
}

BOOL zooming = g_ddraw.zoom.enabled;
Expand Down Expand Up @@ -1544,7 +1552,7 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)

HRESULT dd_WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent)
{
if (g_config.maxgameticks == -2)
if (g_config.maxgameticks == -2 || g_ddraw.wait_for_real_vblank)
{
/* Workaround for DwmFlush() freeze (e.g. slow alt+tab) issue on windows 7 SP1 */
if (g_ddraw.renderer == ogl_render_main && !IsWine() && !IsWindows8OrGreater())
Expand Down

0 comments on commit 95a5f72

Please sign in to comment.