Author Topic: Street Fighter 6 script  (Read 1381 times)

mgalaxy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1165
    • Email
Re: Street Fighter 6 script
« Reply #10 on: June 10, 2023, 09:12:45 AM »
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"

Aeliss

  • Hero Member
  • *****
  • Posts: 900
Re: Street Fighter 6 script
« Reply #9 on: June 10, 2023, 08:59:54 AM »
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 ?

mgalaxy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1165
    • Email
Re: Street Fighter 6 script
« Reply #8 on: June 10, 2023, 04:34:29 AM »
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:
Quote
<Emulator name="Cmd" hidden="false">
      <Systems>
         <System name="Arcade" option="TeknoParrot shortcuts" script="false" cmd="/C &quot;%path%slash%file%ext&quot;" extensions="lnk"/>
         <System name="Microsoft [Applications]" option="" script="false" cmd="/C &quot;%path%slash%file%ext&quot;" extensions="lnk"/>
and edit this line that way
Quote
<System name="Microsoft [Applications]" option="" script="true" cmd="/C &quot;%path%slash%file%ext&quot;" extensions="lnk"/>

Waiting for your feedback ;)


PS: Here's the text that will accompany the use of 'Cmd' in mGalaxy_Runway
Quote
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
« Last Edit: June 10, 2023, 05:47:14 AM by mgalaxy »

Aeliss

  • Hero Member
  • *****
  • Posts: 900
Re: Street Fighter 6 script
« Reply #7 on: June 07, 2023, 12:06:09 PM »
Quote
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/docs/libfunctions/_WinAPI_GetProcessFileName.htm )
Because using timer sometime fail ^^.
« Last Edit: June 07, 2023, 12:09:03 PM by Aeliss »

mgalaxy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1165
    • Email
Re: Street Fighter 6 script
« Reply #6 on: June 06, 2023, 11:54:08 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 Edit: June 06, 2023, 11:59:42 PM by mgalaxy »

Dudeman

  • Newbie
  • *
  • Posts: 5
Re: Street Fighter 6 script
« Reply #5 on: June 06, 2023, 11:40:16 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.

Aeliss

  • Hero Member
  • *****
  • Posts: 900
Re: Street Fighter 6 script
« Reply #4 on: June 06, 2023, 10:39:36 AM »
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]
;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
« Last Edit: June 06, 2023, 10:45:57 AM by Aeliss »

Dudeman

  • Newbie
  • *
  • Posts: 5
Re: Street Fighter 6 script
« Reply #3 on: June 05, 2023, 01:43:44 PM »
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]
;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
  • *****
  • Posts: 900
Re: Street Fighter 6 script
« Reply #2 on: June 05, 2023, 11:14:16 AM »
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: (autoit) [Select]
;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 Edit: June 05, 2023, 11:18:28 AM by Aeliss »

Dudeman

  • Newbie
  • *
  • Posts: 5
Street Fighter 6 script
« Reply #1 on: June 04, 2023, 08:34:38 PM »
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.