diff --git a/BunnymodXT/modules/ClientDLL.cpp b/BunnymodXT/modules/ClientDLL.cpp index 9d6f42d5..003aca5d 100644 --- a/BunnymodXT/modules/ClientDLL.cpp +++ b/BunnymodXT/modules/ClientDLL.cpp @@ -1637,6 +1637,23 @@ HOOK_DEF_1(ClientDLL, void, __cdecl, HUD_Frame, double, time) orig_forcehltv_found = HwDLL::GetInstance().ORIG_Cmd_FindCmd("dem_forcehltv"); } + #ifdef _WIN32 + static bool check_vsync = true; + if (check_vsync) + { + bool bxtDisableVSync = getenv("BXT_DISABLE_VSYNC"); + if (bxtDisableVSync) + { + typedef BOOL(APIENTRY* PFNWGLSWAPINTERVALPROC)(int); + PFNWGLSWAPINTERVALPROC wglSwapIntervalEXT = 0; + wglSwapIntervalEXT = (PFNWGLSWAPINTERVALPROC)wglGetProcAddress("wglSwapIntervalEXT"); + if (wglSwapIntervalEXT) + wglSwapIntervalEXT(0); + } + check_vsync = false; + } + #endif + if (CVars::_bxt_taslog.GetBool() && pEngfuncs) pEngfuncs->Con_Printf(const_cast("HUD_Frame time: %f\n"), time); diff --git a/README.md b/README.md index c873be78..b036e824 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Use the [Bunnymod XT Launcher](https://github.com/YaLTeR/bxt-launcher). - **SPTLIB_DEBUG** - if set to 1, logs all dlopen, dlclose and dlsym calls. - **BXT_DISABLE_DEBUG_CONSOLE** - if set, disables the Bunnymod XT debug console. - **BXT_DISABLE_DISCORD_RPC** - if set, disables the Discord RPC module. +- **BXT_DISABLE_VSYNC** - if set, disables the V-Sync on initialization (Windows-only). ## Building