Page 1 of 2
script wait until joy8 is pressed
Posted: Sun Mar 16, 2014 7:22 pm
by h3xl3y
Hi
Who knows a easy way to detect when a button is pressed on the XBox360 controller in Autoit ?
the button i am interested to detect is Start (joy8 as detected in Windows)
i had this code previously to press Space on keyboard but now i need the Start button from Xbox360 controller
Code: Select all
Run( $app1 )
Do
Sleep(1)
Until _IsPressed( "20" ) ;Space
ProcessClose( $app1 )
Any ideea ?
Re: script wait until joy8 is pressed
Posted: Mon Mar 17, 2014 5:15 pm
by Aeliss
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
Code to exit when button 7 is pressed, Not sure It work for 360 pad.
Re: script wait until joy8 is pressed
Posted: Wed Mar 19, 2014 5:52 pm
by h3xl3y
I tried several variants of that code but didn't work
maybe you can give a more specific example
i never made scripts with joy keys so maybe i missed something
Is there an easy way to do it like edit something from mGalaxy ?
from Xpadder is not working because mGalaxy recognizes my controller now
so it does not work anymore with a mGalaxy profile from Xpadder
Re: script wait until joy8 is pressed
Posted: Thu Mar 20, 2014 6:32 pm
by Aeliss
What do you want to do with this script ?
Re: script wait until joy8 is pressed
Posted: Fri Mar 21, 2014 6:27 pm
by h3xl3y
I have made a Splash screen that appears when i launch a game that stays paused until i press Space on keyboard and then launches the emulator.
At least that is how it did work until mGalaxy5.2
before i had Space key set on Start button (x360 pad) trough Xpadder
but now i take the x360 pad launch the game and need to press Space on keyboard before play the game.
so that is why i need to detect joy key press
here is a example of Splash screen i made
Re: script wait until joy8 is pressed
Posted: Fri Mar 21, 2014 8:08 pm
by Aeliss
Ha nice ^^, usefull.
But I think It will be easier to modify the splash screen, it s a special application (coded by you ?) or a script ?
Take a look here perhaps, if you use autoit >
http://www.autoitscript.com/forum/topic ... ontroller/
Re: script wait until joy8 is pressed
Posted: Fri Mar 21, 2014 10:07 pm
by h3xl3y
It's a aplication i found on some forum.
I don't have the code for it so cannot modify it.
i will look at that example to see if i can use it, thanks
Re: script wait until joy8 is pressed
Posted: Sat Mar 22, 2014 12:39 am
by h3xl3y
Ok, i got it resolved
Thanks for the link
Re: script wait until joy8 is pressed
Posted: Sat Mar 22, 2014 10:40 am
by Aeliss
It s an application just to made a splash screen and your have made yourself the screen, or this application made all itself for all emul ?
Re: script wait until joy8 is pressed
Posted: Sat Mar 22, 2014 2:08 pm
by h3xl3y
The Spash.exe loads a image.png that is in the same folder with the exe.
each system need to have in folder a Splash.exe and a png image
the png i made in Photoshop for each system i want to know the controls
i did this because if you don't use a system for a while you forget how you set the controls
and there are systems that have many more buttons than NES
if you want i can make a short video to see it in action
Re: script wait until joy8 is pressed
Posted: Sat Mar 22, 2014 2:49 pm
by Aeliss
Yep, I m totally agree with you. But in fact, it s not the splash function that draws me, because I use the "note" window function in mGalaxy to remember the command but your image.
It s really nice, I realy like the design, I think I will take your image and edit it for all other system.
Re: script wait until joy8 is pressed
Posted: Mon Mar 24, 2014 12:29 pm
by mgalaxy
Aeliss,
I had some spare time this WE and wrote a little application to help generate such a diagram.
If it does interest you I'll post it here!
You get a base image of an XBOX360 controller, you then fill the fields and choose a picture of the "emulated" controller...the application export the resulting image to a png file.
Here is a sample of the output file:
Re: script wait until joy8 is pressed
Posted: Mon Mar 24, 2014 7:21 pm
by Aeliss
Nice ^^.
And I think we aren't alone interested by this util.
Just 3 suggestions.
Have you an exemple for the more classic "emulated" controller, I m really bad with photoshop (I had too much problem just for convert the system image to icon file).
I really like the h3xl3y design, the background is perhaps "too much" but the button and numeric pad visual presentation is perfect for me.
I think it will be useful to export the result in rtf format too (to use it directly on mGalaxy, I don't think all users can make the rtf file with the png), I have take a look on a rtf file with an image and I think It isn't hard to make. Or more harder, integrate your application inside mGalaxy and make it generating your png with ini/xml file inside the system folder.
And yes I m interested by your app
and ofc I can help if you are interested by my request and if it s need to much time (for convertion, I m a noob for picture)
Re: script wait until joy8 is pressed
Posted: Mon Mar 24, 2014 7:54 pm
by h3xl3y
Is good if you can make them automatic but i am planning to use "Note" menu for systems info and i already have created the splash screen for almost all systems i want to use.
Re: script wait until joy8 is pressed
Posted: Mon Mar 24, 2014 8:02 pm
by Aeliss
Yep, from my memory there isn't yet front end with this functionnality and on system like n64, I m sure I m not alone who don't remember the command.