Gampad tastendruck auslessen

  • Tach leute
    ich mal wider :D
    Ich habe eine frage bezüglich des auslessens von tasten.
    Und ich Frage mich ob es nicht evt möglich währe den tastendruck eines GamePads auszulessen (Oder abzufangen)
    In meinem falle ist es das GamePad "Saitek P380 Dual Analog"
    Ist kein Hightech teil, doch für die verwendung von Nintendo 64/PS1 & PS2 Emulators reicht das ding alle mal :D

    Mein vorhaben ist,ob es nicht möglich ist mit autoit die tastendrücke abzufangen und auf die tastatur um zu leiten.
    Sprich. wen ich nach "Oben" auf dem Pad drücke soll er dafür die "W" taste drücken
    "Links" = "D"
    "Unten" = "S"
    "Links" = "A"
    usw...

    Gibt es da möglichkeiten mit autoit dies zu machen???

    Skilkor

    2 Mal editiert, zuletzt von Skilkor (19. August 2010 um 00:12)

  • Eben aus diesem grund Frag ich ja :D da ich nicht bezüglich zusatz software nichts gefunden habe... nur kostenpflichtiges das Kompatible mit 100´000 anderen GamePads ist.

    Gäb es den überhaupt ne Möglichkeit sowas zu machen?
    Performance hin oder her :D
    an der kann man ja immer ein bischen feilen :D

    Skilkor

    Edit:
    Mit den verschiedenen Controller progs bei den Emulators Bekomm ich die "Name" teils angezeigt der tasten....
    Kann das was Helfen??

    (PS Es geht nich um die Emulators sondern darum normale pc games mit dem gampad zu spielen :D)

    Einmal editiert, zuletzt von Skilkor (16. August 2010 um 23:46)

  • Hier haste n Plugin das sollte mit jedem Controller funktionieren der unter Windows erkannt wird, bei mir funkts mit meinem Joypad u. Joystick.


    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Local $joy,$coor,$h,$s,$msg

    [/autoit] [autoit][/autoit] [autoit]

    $joy = _JoyInit()

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("Joystick Test",300,300)
    $h= GuiCtrlCreatelabel("",10,10,290,290)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    while 1
    $msg = GUIGetMSG()
    $coor = _GetJoy($joy,0)
    $s = "Joystick(0):" & @CRLF & _
    "X: " & $coor[0] & @CRLF & _
    "Y: " & $coor[1] & @CRLF & _
    "Z: " & $coor[2] & @CRLF & _
    "R: " & $coor[3] & @CRLF & _
    "U: " & $coor[4] & @CRLF & _
    "V: " & $coor[5] & @CRLF & _
    "POV: " & $coor[6] & @CRLF & _
    "Buttons: " & $coor[7]
    GUICtrlSetData($h,$s,1)
    sleep(10)
    if $msg = $GUI_EVENT_CLOSE Then Exitloop
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    _JoyClose($joy)

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    $joy = DllStructCreate($JOYINFOEX_struct)
    if @error Then Return 0
    DllStructSet($joy,1,DllStructSize($joy),1);dwSize = sizeof(struct)
    DllStructSet($joy,1,255,2) ;dwFlags = GetAll
    return $joy
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    return $coor
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _JoyClose($lpJoy)
    ; Free the memory allocated for the joystick struct
    ;======================================
    Func _JoyClose($lpJoy)
    DllStructFree($lpJoy)
    EndFunc

    [/autoit]
  • Ich würde es mal mit dem Programm Xpadder (http://www.xpadder.com/) probieren.

    Falls du es versuchst mit Autoit umzusetzen könntest du evtl. die Prospeed.dll verwenden. Die hat auch Funktionen zum Gamepad, hab aber persönlich noch keine Erfahrung damit.

  • @ Rodny le lude
    Danke erst einmal doch ich bekomm ein fehler wen ich es ausführen möchte, brauch ich dazu noch etwas zusätzlich?
    Fehler

    Zitat

    C:\Users\***\Desktop\Scripte\Controller.au3 (62) : ==> Missing separator character after keyword.:
    DllCall("Winmm.dll","int","joyGetPosEx",_
    DllCall("Winmm.dll","int","joyGetPosEx",_^ ERROR

    @hulle
    Der Xpadder ist kostenpflichtig
    auch wen es nur 7Euro sind xD

    BTW, Ihr habt mich auf eine Idee gebracht, wegen dll´s
    Die Emulators verwenden dll´s alls PlugIn´s
    in den kategorien
    Grafik
    Pad
    CDVD
    und die PS2Emu noch
    USB
    FW
    DEV9
    Ich hab mir die Pad dlls angeschaut
    die Imformativste war die LilyPad.dll
    die ich mit dem Script von funkey ausgelssen habe.
    Hier die funcs der dll

    Spoiler anzeigen
    [autoit]

    [0]|PADabout
    [1]|PADclose
    [2]|PADconfigure
    [3]|PADinit
    [4]|PADkeyEvent
    [5]|PADopen
    [6]|PADpoll
    [7]|PADquery
    [8]|PADreadPort1
    [9]|PADreadPort2
    [10]|PADshutdown
    [11]|PADstartPoll
    [12]|PADtest
    [13]|PADupdate
    [14]|PS2EgetLibName
    [15]|PS2EgetLibType
    [16]|PS2EgetLibVersion2
    [17]|PSEgetLibName
    [18]|PSEgetLibType
    [19]|PSEgetLibVersion
    ========================
    Tasten:
    _____________________________________
    PC Control: |PS2 Control:
    _____________________________________
    Z-Rotation + |R-Stick Right
    Z-Rotation - |R-Stick Left
    |
    Z-Achse + |R-Stick Down
    Z-Achse - |R-Stick Up
    |
    Y-Achse + |L-Stick Down
    Y-Achse - |L-Stick Up
    |
    X-Achse + |L-Stick Right
    X-Achse - |L-Stick Left
    |
    Mehrwegschalter N |Up
    Mehrwegschalter E |Right
    Mehrwegschalter S |Down
    Mehrwegschalter W |Left
    |
    Taste 0 |Square (Kreis)
    Taste 1 |Triangle (Dreieck)
    Taste 2 |Cross (X)
    Taste 3 |Circle (Viereck)
    Taste 4 |L1
    Taste 5 |L2
    Taste 6 |R1
    Taste 7 |R2
    Taste 8 |Select
    Taste 9 |Start
    Taste 10 |L3 (Analogstick Taste Links)
    Taste 11 |R3 (Analogstick Taste rechts)

    [/autoit]


    Ich habe noch die Functionen und so aufgeschrieben vll hilft das was mir den passenden tip zu geben :D
    die Frage ist jetz nur, wie kann ich das verwenden??

    Skilkor

    3 Mal editiert, zuletzt von Skilkor (17. August 2010 um 17:10)

  • Mag den Niemand Helfen??
    Es geht mir doch eig nur um die verwendung der dll ^^
    da ich mir nicht sicher bin wie, da es ja auch nicht direkt ne normale dll ist (auch keine system dll)

    Spoiler anzeigen
    [autoit]

    [0]|PADabout
    [1]|PADclose
    [2]|PADconfigure
    [3]|PADinit
    [4]|PADkeyEvent
    [5]|PADopen
    [6]|PADpoll
    [7]|PADquery
    [8]|PADreadPort1
    [9]|PADreadPort2
    [10]|PADshutdown
    [11]|PADstartPoll
    [12]|PADtest
    [13]|PADupdate
    [14]|PS2EgetLibName
    [15]|PS2EgetLibType
    [16]|PS2EgetLibVersion2
    [17]|PSEgetLibName
    [18]|PSEgetLibType
    [19]|PSEgetLibVersion
    ========================
    Tasten:
    _____________________________________
    PC Control: |PS2 Control:
    _____________________________________
    Z-Rotation + |R-Stick Right
    Z-Rotation - |R-Stick Left
    |
    Z-Achse + |R-Stick Down
    Z-Achse - |R-Stick Up
    |
    Y-Achse + |L-Stick Down
    Y-Achse - |L-Stick Up
    |
    X-Achse + |L-Stick Right
    X-Achse - |L-Stick Left
    |
    Mehrwegschalter N |Up
    Mehrwegschalter E |Right
    Mehrwegschalter S |Down
    Mehrwegschalter W |Left
    |
    Taste 0 |Square (Kreis)
    Taste 1 |Triangle (Dreieck)
    Taste 2 |Cross (X)
    Taste 3 |Circle (Viereck)
    Taste 4 |L1
    Taste 5 |L2
    Taste 6 |R1
    Taste 7 |R2
    Taste 8 |Select
    Taste 9 |Start
    Taste 10 |L3 (Analogstick Taste Links)
    Taste 11 |R3 (Analogstick Taste rechts)

    [/autoit]
  • Zitat


    C:\Users\***\Desktop\Scripte\Controller.au3 (62) : ==> Missing separator character after keyword.:
    DllCall("Winmm.dll","int","joyGetPosEx",_
    DllCall("Winmm.dll","int","joyGetPosEx",_^ ERROR

    Hast Du es einmal versucht, mit einem Leerzeichen vor dem "_" in der ersten und zweiten Zeile des DllCall ?

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"

  • ehm nein, aber nach der korektur kommt folgendes

    Zitat

    C:\Users\***\Desktop\Scripte\GamePad\pad_Plugin.au3 (39) : ==> Unknown function name.:
    DllStructSet($joy,1 DllStructSize($joy),1)
    DllStructSet($joy,1 ^ ERROR


    Dabei handelt es ich um diesen abschnitt

    Spoiler anzeigen
    [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    $joy = DllStructCreate($JOYINFOEX_struct)
    if @error Then Return 0
    DllStructSet($joy,1 DllStructSize($joy),1);dwSize = sizeof(struct) dlls
    DllStructSet($joy,1,255,2) ;dwFlags = GetAll
    return $joy
    EndFunc

    [/autoit]
    Spoiler anzeigen
    [autoit]

    DllStructSet($joy,1 DllStructSize($joy),1);dwSize = sizeof(struct) dlls
    DllStructSet($joy,1,255,2) ;dwFlags = GetAll

    [/autoit]
  • in dem Skript von Rodny le lude fehlen Funktionen (warscheins included)

    mfg (Auto)Bert

  • versuch das Script mal funkt 100%

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;655535

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Xbox 360 Controller", 300, 400)
    $X0 = GUICtrlCreateLabel('', 10, 10, 30, 20)
    $S0 = GUICtrlCreateSlider(40, 05, 250, 20, 0x0010)
    $X1 = GUICtrlCreateLabel('', 10, 30, 30, 20)
    $S1 = GUICtrlCreateSlider(40, 25, 250, 20, 0x0010)
    $X2 = GUICtrlCreateLabel('', 10, 50, 30, 20)
    $S2 = GUICtrlCreateSlider(40, 45, 250, 20, 0x0010)
    $X3 = GUICtrlCreateLabel('', 10, 70, 30, 20)
    $S3 = GUICtrlCreateSlider(40, 65, 250, 20, 0x0010)
    $X4 = GUICtrlCreateLabel('', 10, 90, 30, 20)
    $S4 = GUICtrlCreateSlider(40, 85, 250, 20, 0x0010)
    $X5 = GUICtrlCreateLabel('', 10, 110, 30, 20)
    $X6 = GUICtrlCreateLabel('', 10, 130, 30, 20)
    $X7 = GUICtrlCreateLabel('', 10, 150, 30, 20)
    GUICtrlCreateLabel('Buttons Pressed:', 10, 170, 280, 20)
    $XB = GUICtrlCreateLabel('', 10, 190, 280, 20)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $joy = _JoyInit()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(10)
    $msg = GUIGetMsg()
    $j = _GetJoy($joy, 0)
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    ;Get Array values from _GetJoy return and display
    For $a = 0 To 7
    $control = Execute('$X' & $a)
    If GUICtrlRead($control) <> $j[$a] Then GUICtrlSetData($control, $j[$a])
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;Get buttons pressed and display
    $Spressed = GetPressed($j[7])
    If GUICtrlRead($XB) <> $Spressed Then GUICtrlSetData($XB, $Spressed)

    [/autoit] [autoit][/autoit] [autoit]

    ;Set sliders to correct position
    For $a = 0 To 4
    SetSliders($j[$a], $a)
    Next
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func GetPressed($Val)
    $SButtons = ''
    If BitAND($Val, 1) Then $SButtons &= '(A)'
    If BitAND($Val, 2) Then $SButtons &= '(B)'
    If BitAND($Val, 4) Then $SButtons &= '(X)'
    If BitAND($Val, 8) Then $SButtons &= '(Y)'
    If BitAND($Val, 16) Then $SButtons &= '(LB)'
    If BitAND($Val, 32) Then $SButtons &= '(RB)'
    If BitAND($Val, 64) Then $SButtons &= '(Back)'
    If BitAND($Val, 128) Then $SButtons &= '(Start)'
    If BitAND($Val, 256) Then $SButtons &= '(LS)'
    If BitAND($Val, 512) Then $SButtons &= '(RS)'
    Return $SButtons
    EndFunc ;==>GetPressed

    [/autoit] [autoit][/autoit] [autoit]

    Func SetSliders($Val, $Slide)
    $control = Execute('$S' & $Slide)
    If $Val = 65535 Then
    GUICtrlSetData($control, 0)
    ElseIf $Val = 0 Then
    GUICtrlSetData($control, 100)
    Else
    GUICtrlSetData($control, ((65535 - $Val) / 65535) * 100)
    EndIf
    EndFunc ;==>SetSliders

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _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

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _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

    [/autoit]
  • Joa das funktioniert :D ich versuch mal das Script richtig zu verstehen und evt ein neues zuschreiben das mit der LilyPad.dll fungiert.
    Wen ich dran scheitere (Wen dan nur weill ich niemand finde der mit das mit dem verwenden der dll´s erläutert) hab ich ja das noch.

    Thx @ all for helping me :D