Jump to content

Recommended Posts

Posted

Hello I was able to easily find out how to utilize Autoit to detect game pad joy sticks and buttons with this code. But why can i not find anything to simply send a gamepad button.

Is there any UDF or examples on a simple send gamepad button. I'm going to use it to remap keyboard inputs to gamepad. Not Gamepad to keyboard.

I'm surprised there is no UDF or simple send button functions to interact with gamepads. Please if anyone can Help i would be much appreciated.

 

;======================================
;   _JoyInit()
;======================================
Func _JoyInit()
    Local $joy
    Global $JOYINFOEX_struct = "dword[13]"

    $joy = DllStructCreate($JOYINFOEX_struct)
    If @error Then Return 0
    DllStructSetData($joy, 1, DllStructGetSize($joy), 1);dwSize = sizeof(struct)
    DllStructSetData($joy, 1, 255, 2) ;dwFlags = GetAll
    Return $joy
EndFunc   ;==>_JoyInit

;======================================
;   _GetJoy($lpJoy,$iJoy)
;   $lpJoy  Return from _JoyInit()
;   $iJoy   Joystick # 0-15
;   Return  Array containing X-Pos, Y-Pos, Z-Pos, R-Pos, U-Pos, V-Pos,POV
;           Buttons down
;
;           *POV This is a digital game pad, not analog joystick
;           65535   = Not pressed
;           0       = U
;           4500    = UR
;           9000    = R
;           Goes around clockwise increasing 4500 for each position
;======================================
Func _GetJoy($lpJoy, $iJoy)
    Local $coor, $ret

    Dim $coor[8]
    DllCall("Winmm.dll", "int", "joyGetPosEx", _
            "int", $iJoy, _
            "ptr", DllStructGetPtr($lpJoy))

    If Not @error Then
        $coor[0] = DllStructGetData($lpJoy, 1, 3)
        $coor[1] = DllStructGetData($lpJoy, 1, 4)
        $coor[2] = DllStructGetData($lpJoy, 1, 5)
        $coor[3] = DllStructGetData($lpJoy, 1, 6)
        $coor[4] = DllStructGetData($lpJoy, 1, 7)
        $coor[5] = DllStructGetData($lpJoy, 1, 8)
        $coor[6] = DllStructGetData($lpJoy, 1, 11)
        $coor[7] = DllStructGetData($lpJoy, 1, 9)
    EndIf

    Return $coor
EndFunc   ;==>_GetJoy

 

 

Posted (edited)
18 hours ago, Somerset said:

Dude that was a sample of what i found as a search return. Is it really so hard to use a search engine?

https://www.oneswitch.org.uk/art.php?id=33

I apologize if I came across rude. I'm just looking for a udf or a point in the right direction. Ty for finding a work around I have REWASD that does this already. 

On 9/1/2023 at 12:55 PM, Nine said:

Yes, and I suggest you write it. ;)

https://learn.microsoft.com/en-us/windows/win32/api/joystickapi/nf-joystickapi-joysetcapture

Is that what you are looking for ?

That is really close I taught myself autoit years ago and only somewhat understand c++. There is Vjoy udf I recall from years ago. Maybe thats where I should start with.

 BTW What's up with the hostile responses?

I've used autoit for years and everyone is usually very helpfully. In at least pointing me in the right direction so I can write my own programs. Ty again if anyone knows of any udfs that allow you to send commands to a gamepad. That would be much appreciated. 

 

This is the closest thing i could find

 

Edited by Jblz619

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...