Created
August 7, 2024 18:41
-
-
Save alvesvaren/e450bda9885eb28734b0afa5771ae7bd to your computer and use it in GitHub Desktop.
Clip the cursor to apex in dx12 mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No longer works because Respawn decided to disallow running ahk scripts while in game at all