Skip to content

Commit

Permalink
tweak(input/five): release cursor capture for the game's cursor
Browse files Browse the repository at this point in the history
Custom bits of UI (NUI focus, as well as the F8 console/dear ImGui) do
this already, which makes the game's mouse cursor (such as in the pause
menu) behave differently.

This commit solves this by hooking up the QueryMayLockCursor event to a
flag specifying if the cursor is visible.
  • Loading branch information
blattersturm committed Jan 7, 2024
1 parent 0b61c93 commit ce04dca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions code/components/rage-input-five/src/InputHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,17 @@ static HookFunction hookFunction([]()

// cancel out ioLogitechLedDevice
hook::jump(hook::get_pattern("85 C0 0F 85 ? ? 00 00 48 8B CB FF 15", -0x77), Return0);

// hook up cursor lock to CMousePointer::_bIsVisible
static auto isPointerVisible = hook::get_address<bool*>(hook::get_pattern("80 3D ? ? ? ? 00 0F 45 C6 88 05 ? ? ? ? 48 8B 5C", 10), 2, 6) + 2;

InputHook::QueryMayLockCursor.Connect([](int& may)
{
if (*isPointerVisible)
{
may = FALSE;
}
});
});

fwEvent<HWND, UINT, WPARAM, LPARAM, bool&, LRESULT&> InputHook::DeprecatedOnWndProc;
Expand Down

0 comments on commit ce04dca

Please sign in to comment.