Street Fighter 6 script

Get answers to questions about using mGalaxy.
Post Reply
Dudeman
Newbie
Newbie
Posts: 5
Joined: Mon Jun 05, 2023 1:28 am

Hi all,
I recently built my first windows based cabinet and I really like how mgalaxy is working for me.  With the recent release of Street Fighter 6 I thought it would be cool to add it to my cabinet.  I was able to easily add the Microsoft [Applications] system and create a lnk file for the game and it launches perfectly which is super cool!  The only issue I'm having is that when I exit the game I end up on the Windows desktop with mgalaxy minimized.  I see that this seems to be a common issue for some other people on the forum from time to time and it's often resolved with a script.  I tried installing autoit-v3 in hopes that the default Microsoft [Applications] script would resolve my issue but it hasn't.  I was hoping to maybe get some assistance or guidance here.  I'm sure the Street Fighter series is popular around this community and it would be really great to have the latest version working seamlessly on our cabinets.
Thanks in advance for any help that any one can lend.  I'm happy to provide any more information that might be needed.
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

I have this issue too generaly on lot of arcade game, it's because they are using loader.
This kind of application, are application that launcch application that launch other applications, ect ....

The script probably kill an application (that make you return to windows) but another one is still running (and mGalaxy is waiting for this one is closing)

Something you can do is using the "process manager", and look wich one is still running, if you find the good one, mGalaxy will return back.

If I m right, the better solution is using a custom script, with the application name "in hard" in the script.

Or more often, mGalaxy is back "to fast", because it was monitoring the loader and not the real application, here I have an exemple of a personnal script, it's an old one but it can perhaps help you.
It's the one I m using for windows application (with cmd.exe) but inside you can find a "patch" used for tetris

Code: Select all

;Parsing
Local $count = StringInStr($CmdLineRaw, ".exe", 0 , 1, 1)
local $app = StringLeft ( $CmdLineRaw, $count + 4 )
local $command = StringTrimLeft( $CmdLineRaw, $count + 4 )
if not $command then exit 0

;Get more info
$count = StringInStr($command, '"', 0 , 1, 1)
local $link = StringTrimLeft ( $command, $count  )
$link = StringTrimRight ( $link, 1 )
Local $aDetails = FileGetShortcut($link)
If @error Then exit
local $tmp = StringSplit($aDetails[0], "\")
local $apptorun = $tmp[$tmp[0]]


;run command
;Run ('"' & $app & '" ' & $command)
ShellExecute('"' & $link & '"')

;wait for application launched with protection loop
;wait for 5 s and exit if no application found
local $protloop = 10
While not(ProcessExists($apptorun))
    $protloop = $protloop - 1
   if ($protloop < 0) then exit 0
   sleep(500)
WEnd

;try to put in front
local $PID = GetProcessPID($apptorun)
local $WinName =  ProcessGetWindow($PID)
WinSetState($WinName,"",@SW_SHOW)
WinSetState($WinName,"",@SW_ENABLE)

;wait for close
While (ProcessExists($apptorun) or (ProcessExists("cmd.exe")))
   sleep(500)
WEnd

;To resolve bug in taito  Xom Tetris gran master
local $list = ProcessList("game.exe")
if $list[0][0] > 0 Then
   local $PID = $list[1][1]
   ProcessWaitClose($PID)
endif

Exit 0
It's an extract, can share missing fonction if needed, but you can find them on mGalaxy scripts.

If mGalaxy is still freezed (waiting for a special application is closed) it's the first issue, if mGalaxy is running (it have missed the full screen return) it's the second one.





Last edited by Aeliss on Mon Jun 05, 2023 4:18 pm, edited 1 time in total.
Dudeman
Newbie
Newbie
Posts: 5
Joined: Mon Jun 05, 2023 1:28 am

Thanks for the quick reply!  This sounds like it's probably the issue I'm running into.  Hard coding the process name into the script makes a lot of sense and I'll try it later tonight to see if I can get it working.  I do just have a couple of quick questions.

1. Did you modify the default script for the Microsoft [Applications] system?  Or would I be better off creating a new custom system for this game with the custom script?
2. It looks like just the code I have below is what needs to be added to the default script, but with the correct process name.  Is that right or is there more code in the script that you provided that is custom and that I should include?

Code: Select all

;To resolve bug in taito  Xom Tetris gran master
local $list = ProcessList("game.exe")
if $list[0][0] > 0 Then
   local $PID = $list[1][1]
   ProcessWaitClose($PID)
endif
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

For me better to create a new one, to be sure it will not cause issue on the original one.
And yes there is so much useless code in this script ^^, had so much issue with arcade game.

But yes for the second issue, if it's the one you have (just need to check the mgalaxy state) it's the usefull part.

Code: Select all

;wait for close
While (ProcessExists($apptorun) or (ProcessExists("cmd.exe")))
   sleep(500)
WEnd

;To resolve bug in taito  Xom Tetris gran master
local $list = ProcessList("game.exe")
if $list[0][0] > 0 Then
   local $PID = $list[1][1]
   ProcessWaitClose($PID)
endif
In fact mGalaxy is waiting for "cmd.exe close", but the problem is for this game it need to wait too the process "game.exe" (cmd.exe can be closed before this one).

Here you have the capture of the shortcut used for this game
You will understand the problem when looking the command line, cmd.exe is running typex_loader.exe that is running game.exe

But first check mGalaxy state to see if you are in case 1 or 2
Attachments
t1.png
Last edited by Aeliss on Tue Jun 06, 2023 3:45 pm, edited 1 time in total.
Dudeman
Newbie
Newbie
Posts: 5
Joined: Mon Jun 05, 2023 1:28 am

Thanks so much for the help.  I spent two hours last night reviewing your script and the other mgalaxy built in scripts.  I ended up getting everything working!
The pain with this particular program (the steam version of street fighter 6) was that it launches a process called streetfighter6, then that process closes and another process is spawned with the same name.  So I had to add a sleep of 30 seconds during the startup before looking for the process id to make sure I got the correct process and not the launcher.
I will clean up my script in the next day or two and paste it here in case it's helpful to other people in the future.
User avatar
mgalaxy
Administrator
Administrator
Posts: 1190
Joined: Tue Dec 05, 2006 7:46 pm

Thanks for your help Aeliss! :)

I'll try to find a universal solution to this problem (which avoids having to hard-code the name) this weekend!
Last edited by mgalaxy on Wed Jun 07, 2023 4:59 am, edited 1 time in total.
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

it launches a process called streetfighter6, then that process closes and another process is spawned with the same name.  So I had to add a sleep of 30 seconds during the startup before looking for the process id to make sure I got the correct process and not the launcher
Lol seriously ?
So this situation will be harder for @mGalaxy ^^

There is no way to reconize them ? Same path ? ( https://www.autoitscript.com/autoit3/do ... leName.htm )
Because using timer sometime fail ^^.
Last edited by Aeliss on Wed Jun 07, 2023 5:09 pm, edited 1 time in total.
User avatar
mgalaxy
Administrator
Administrator
Posts: 1190
Joined: Tue Dec 05, 2006 7:46 pm

Voila, I come to help with a script that could potentially solve these loader/main application problems!
Just drag the enclosed file into the "mGalaxy > Data > Scripts" folder!
Then open "mGalaxy > Data > Definition > Emulators.xml"
Locate this block of code and line:
<Emulator name="Cmd" hidden="false">
<Systems>
<System name="Arcade" option="TeknoParrot shortcuts" script="false" cmd="/C "%path%slash%file%ext"" extensions="lnk"/>
<System name="Microsoft [Applications]" option="" script="false" cmd="/C "%path%slash%file%ext"" extensions="lnk"/>
and edit this line that way
<System name="Microsoft [Applications]" option="" script="true" cmd="/C "%path%slash%file%ext"" extensions="lnk"/>
Waiting for your feedback ;)


PS: Here's the text that will accompany the use of 'Cmd' in mGalaxy_Runway
Additional information about using the script

As with many emulators, Windows games do not necessarily respond to pressing the 'ESC' key to quit!
(In mGalaxy, this key is associated with quitting the game by default).
Therefore, scripts are used (an extra layer between mGalaxy and the game) to intercept the 'ESC' key and then 'force' the game to quit.

However, sometimes when you start a Windows game, the game you think you've started can turn out to be a 'loader' (a small program whose purpose is to start the main program).
So we told mGalaxy what we thought was the game...but in fact it was an intermediate piece of software, and so when we later press the 'ESC' key to quit, it's actually the 'loader' that the script will want to quit...and the 'real' game will continue to run.

To overcome this problem, the script used for Window games works in a different way:
It will 'track down' the 'parent' folder from which the game originated, and ask to close any application/loader that has been launched from that folder in the meantime.
Here are some examples of situations where the script can be used

GameFolder
├── MainGame.exe


GameFolder
├── Loader.exe
├── MainGame.exe


GameFolder
├── Loader.exe
├── SubFolder
│  └── MainGame.exe
Attachments

[The extension has been deactivated and can no longer be displayed.]

Last edited by mgalaxy on Sat Jun 10, 2023 10:47 am, edited 1 time in total.
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

He ? I have an old version but in my "script" folder I have a script called "Microsoft [Applications].au3"
This script will not make conflict with it ?
User avatar
mgalaxy
Administrator
Administrator
Posts: 1190
Joined: Tue Dec 05, 2006 7:46 pm

Aeliss wrote: He ? I have an old version but in my "script" folder I have a script called "Microsoft [Applications].au3"
This script will not make conflict with it ?
This script is for v8.0 (2020) or upper.
It might work if you rename the script to "Microsoft [Applications].au3"
Post Reply