Skip to content

Commit 31a76be

Browse files
committed
fix(window): register r_borderless before window creation and reuse it in dvars
1 parent 26509e9 commit 31a76be

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/component/engine/mouse_input/mouse_input.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ namespace mouse_input
234234
pending_event.dx = dx;
235235
pending_event.dy = dy;
236236

237+
if ((dx != 0 || dy != 0) && (*game::keyCatchers & 0x10) == 0)
238+
{
239+
gamepad::note_mouse_activity();
240+
}
241+
237242
if (gamepad::should_hide_cursor() && (*game::keyCatchers & 0x10) == 0)
238243
{
239244
return 0;

src/component/engine/patches/patches.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,11 @@ namespace patches
389389
public:
390390
void post_load() override
391391
{
392+
if (!game::Dvar_FindVar("r_borderless"))
393+
{
394+
dvars::r_borderless = dvars::Dvar_RegisterBool("r_borderless", 0, "Do not use a border in windowed mode", game::dvar_flags::saved);
395+
}
396+
392397
// branding - intercept import for CreateWindowExA to change window title
393398
utils::hook::set(game::game_offset(0x1047627C), create_window_ex_stub);
394399

src/game/dvars.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,14 @@ namespace dvars
302302

303303
scheduler::once([]
304304
{
305-
r_borderless = dvars::Dvar_RegisterBool("r_borderless", 0, "Do not use a border in windowed mode", game::dvar_flags::saved);
305+
if (auto* const existing_borderless = game::Dvar_FindVar("r_borderless"))
306+
{
307+
r_borderless = existing_borderless;
308+
}
309+
else
310+
{
311+
r_borderless = dvars::Dvar_RegisterBool("r_borderless", 0, "Do not use a border in windowed mode", game::dvar_flags::saved);
312+
}
306313
dvars::Dvar_RegisterBool("g_debugVelocity", 0, "[DEBUG] Print velocity information to console", game::dvar_flags::none);
307314
dvars::Dvar_RegisterBool("g_debugLocalization", 0, "[DEBUG] Print information to console about unlocalized strings", game::dvar_flags::none);
308315
bot_maxHealth = dvars::Dvar_RegisterInt("bot_maxHealth", "Maximum health for bots on spawn", 100, 1, 1000, game::dvar_flags::none);

0 commit comments

Comments
 (0)