Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'BXT_DISABLE_VSYNC' environment variable #424

Merged
merged 3 commits into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
17 changes: 17 additions & 0 deletions BunnymodXT/modules/ClientDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char*>("HUD_Frame time: %f\n"), time);

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **BXT_DISABLE_VSYNC** - if set, disables the V-Sync on initialization.
- **BXT_DISABLE_VSYNC** - if set, disables the V-Sync on initialization (Windows-only).


## Building

Expand Down