If anyone knows, please let me know.. going insane!!

Code: Select all
Local $joy,$coord,$h,$s,$msg
$joy = _JoyInit()
If $CmdLine[0] == 1 Then
Run ( '"snes9x.exe" -fullscreen "' & $CmdLine[1] & '"' )
$coord=_GetJoy($joy,0)
While $coord[7] <> 1
$coord=_GetJoy($joy,0)
Sleep(500)
WEnd
WinClose ( "Snes9X")
$lpJoy=0 ; Joyclose
EndIf
exit 0
;======================================
; _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
;======================================
; _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
[The extension has been deactivated and can no longer be displayed.]
Thanks very much Davhuit, I just gave it a try and it works perfect.davhuit wrote: And here's the profile I use if some peoples are interested.
It emulate the "ESC" key by holding "LT" then pressing the right analog stick, though you can custom the "LT" or "Right analog stick pressure" if you want (LT is on the first page of the profile, and the right stick click on the second page).