Skip to content

Instantly share code, notes, and snippets.

@alvesvaren
Created August 7, 2024 18:41
Show Gist options
  • Save alvesvaren/e450bda9885eb28734b0afa5771ae7bd to your computer and use it in GitHub Desktop.
Save alvesvaren/e450bda9885eb28734b0afa5771ae7bd to your computer and use it in GitHub Desktop.
Clip the cursor to apex in dx12 mode
#Requires AutoHotkey v2.0
; r5apex.exe if not using dx12 beta
exeName := "r5apex_dx12.exe"
#SingleInstance force
pData := DllCall("GlobalAlloc", "uint", 0, "uptr", 16, "ptr")
loop
{
if WinActive("ahk_exe " exeName) {
; Get window bounds
WinGetPos(&X, &Y, &Width, &Height, "ahk_exe " exeName)
NumPut("UPtr", X + 2, pData + 0)
NumPut("UPtr", Y + 2, pData + 4)
NumPut("UPtr", X + Width - 2, pData + 8)
NumPut("UPtr", Y + Height - 2, pData + 12)
ClipCursor(true, pData)
} else {
ClipCursor(false)
Sleep(100)
}
}
OnExit(_ => DllCall("GlobalFree", "ptr", pData))
ClipCursor(Confine, ptr := 0)
{
val := Confine ? DllCall("ClipCursor", "Ptr", ptr) : DllCall("ClipCursor")
return val
}
@alvesvaren
Copy link
Author

Start the game with -anticheat_settings=SettingsDX12.json and works best in borderless windowed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment