Skip to content
This repository has been archived by the owner on Apr 21, 2019. It is now read-only.

Commit

Permalink
fixed wrong structure for XInputGetState
Browse files Browse the repository at this point in the history
  • Loading branch information
jakolion committed Apr 14, 2019
1 parent 7498106 commit 5ad42d2
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions hotkeys.au3
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,10 @@ endfunc


func GetXboxButtonStatus( $controllerIndex )
$struct = DllStructCreate( "dword;short;ubyte;ubyte;short;short;short;short" )
$struct = DllStructCreate( "dword;word;ubyte;ubyte;short;short;short;short" )
$pointer = DllStructGetPtr( $struct )
DllCall( "xinput1_3.dll", "dword", "XInputGetState", "dword", $controllerIndex, "ptr", $pointer )
$result = DllStructGetData( $struct, 2 )
; for some reason pressing GAMEPAD_Y returns -32768
; therefore we change these bits to 32768 (0x8000)
if Number( BitAND( -32768, $result ) <> 0 ) then
; reset bits for -32768
$flippedGamepadY = BitNOT( -32768 )
$result = BitAND( $flippedGamepadY, $result )
; set bits for 32768 (0x8000)
$result = BitOR( 0x8000, $result )
endif
return $result
return DllStructGetData( $struct, 2 )
endfunc


Expand Down

0 comments on commit 5ad42d2

Please sign in to comment.