script wait until joy8 is pressed

Get answers to questions about using mGalaxy.
User avatar
h3xl3y
Newbie
Newbie
Posts: 40
Joined: Fri Mar 29, 2013 2:55 pm

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 ?
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

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.
User avatar
h3xl3y
Newbie
Newbie
Posts: 40
Joined: Fri Mar 29, 2013 2:55 pm

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
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

What do you want to do with this script ?
User avatar
h3xl3y
Newbie
Newbie
Posts: 40
Joined: Fri Mar 29, 2013 2:55 pm

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
Image
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

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/
User avatar
h3xl3y
Newbie
Newbie
Posts: 40
Joined: Fri Mar 29, 2013 2:55 pm

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
User avatar
h3xl3y
Newbie
Newbie
Posts: 40
Joined: Fri Mar 29, 2013 2:55 pm

Ok, i got it resolved
Thanks for the link
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

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 ?
User avatar
h3xl3y
Newbie
Newbie
Posts: 40
Joined: Fri Mar 29, 2013 2:55 pm

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
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

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.
User avatar
mgalaxy
Administrator
Administrator
Posts: 1192
Joined: Tue Dec 05, 2006 7:46 pm

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:
Last edited by mgalaxy on Mon Mar 24, 2014 12:44 pm, edited 1 time in total.
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

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)
Last edited by Aeliss on Mon Mar 24, 2014 7:24 pm, edited 1 time in total.
User avatar
h3xl3y
Newbie
Newbie
Posts: 40
Joined: Fri Mar 29, 2013 2:55 pm

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.
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

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.
Post Reply