KovaaK/SensitivityMatcher

360 is off with preset engine.

Opened this issue · 2 comments

ErNoI commented

I am using the Quake/Source Engine for Apex Legends. I have set my Apex sensitivity in the matcher. When go in to apex and do the 360 its of by 1 centimeter. I have setup kovaak with the same settings(Res, Sens, Fov etc...). In kovaaks it does a perfect 360 but in apex its off. The wierd thing is that sometimes it is to short and sometimes to far in Apex.

When tinkering around with the source code I noticed that Kovaak uses the mouse_event api which is depreciated and occasionally Windows ignores these calls. I am not sure why it sometimes does that, but I believe it is because the system may be busy at that time.
I was originally going to modify the source code to use the latest api (SendInput) which I think fixes this problem. Or at least if it doesn't it should be easy to just have a loop which uses SendInput until Windows accepts it.

Unfortunately, I couldn't figure out how to do this in AuoIt3 - I can do it fine in other languages but there's something about AutoIt that I don't understand....Feel free to tinker with what I have so far. Also, within the next few days I will be starting a new project, on GitHub, that implements a tool like this on an stm32 blue pill to avoid problems such as it not working on all games, Windows occasionally ignoring API calls and multi-OS support.

#include <MsgBoxConstants.au3>
#include <WinAPIError.au3>
#include <WinAPISysWin.au3>
;StructLayoutMouseInput and StructLayoutInput are strings which are definitions of the custom structure.
Local Const $StructLayoutMouseInput = _
    'long dx;' & _
    'long dy;' & _
    'dword mouseData;' & _
    'dword dwFlags;' & _
    'dword time;' & _
    'ulong_ptr dwExtraInfo'
Local Const $StructLayoutInput = _
    'dword type;' & _
    $StructLayoutMouseInput & ';' & _ ;Paste in the structure for the union
    'dword;' & _ ;Add padding for the rest of the union we don't use.
    'dword'
;Create an array, with one element, of the INPUT structure (note MOUSEINPUT structure embedded in INPUT).
Local $structInput = DllStructCreate($StructLayoutInput)
If @error Then
    MsgBox($MB_SYSTEMMODAL, "", "Error in DllStructCreate, Code: " & @error)
EndIf
MsgBox($MB_SYSTEMMODAL, Default, _
       "Size of INPUT structure = " & DllStructGetSize($structInput) & @CRLF & _
       "INPUT structure string = " & $StructLayoutInput & @CRLF)
;Used to set dwFlags
; Local $MOUSEEVENTF_MOVE = 0x0001
Local Const $INPUT_MOUSE = 0
llStructSetData($structInput, "type", $INPUT_MOUSE)
ocal $deltaX = 50
Local $deltaY = 10
DllStructSetData($structInput, "dx", $deltaX)
DllStructSetData($structInput, "dy", $deltaY)
;~ DllStructSetData($structInput, "mouseData", 0) ;Used for mouse buttons, but we aren't using them XD.
DllStructSetData($structInput, "dwFlags", 0x0001)
;~ DllStructSetData($structInput, "time", 0)
;~ DllStructSetData($structInput, "dwExtraInfo", _WinAPI_GetMessageExtraInfo())
MsgBox($MB_SYSTEMMODAL, Default, "structInput:" & @CRLF & _
    "   type = " & DllStructGetData($structInput, "type") & @CRLF & _
    "   MOUSEINPUT struct:" & @CRLF & _
    "       dx          = " & DllStructGetData($structInput, "dx") & @CRLF & _
    "       dy          = " & DllStructGetData($structInput, "dy") & @CRLF & _
    "       mouseData   = " & DllStructGetData($structInput, "mouseData") & @CRLF & _
    "       dwFlags     = " & DllStructGetData($structInput, "dwFlags")   & @CRLF & _
    "       time        = " & DllStructGetData($structInput, "mouseData") & @CRLF & _
    "       dwExtraInfo = " & DllStructGetData($structInput, "mouseData"))
Local $result = DllCall("user32.dll", "uint", "SendInput", "uint", 1, "ptr", DllStructGetPtr($structInput), "int", DllStructGetSize($structInput))
If @error Then
    MsgBox($MB_SYSTEMMODAL, "", "Error in DllCall SendInput, Code: " & @error)
EndIf
MsgBox($MB_SYSTEMMODAL, Default, "Result --> " & $result[0] & @CRLF & "GetLastErrorMessage() --> " & _WinAPI_GetLastErrorMessage ())
;Release resources of the structure
$structInput = 0
;~ $X = 50
;~ $Y = 10
;~ DllCall("user32.dll", "none",     "mouse_event", _
;~                       "long", $MOUSEEVENTF_MOVE, _
;~                       "long",                $X, _
;~                       "long",                $Y, _
;~                       "long",                 0, _
;~                       "long",                 0)
;~ ConsoleWrite(_WinAPI_GetLastErrorMessage())


; sleep(5000)
; MouseMove(10, 100) ; Move the mouse cursor to the x, y position of 10, 100.

I'm experiencing something like this, but inverse: the aim is off in Kovaak 2.0 and perfect in PUBG