Jump to content
LaunchBox Community Forums

Bulk additional app causing MAME to not close on ESC


fishy1988

Recommended Posts

Hello.

I have an additional app .exe that is run at the startup of my MAME lightgun games (a script which I will soon do for all of my 4:3 lightgun games). It's purpose is to send a serial command to my Gun4IR lightguns to tell them to use a setting called "content aspect ratio" - whereby the default setting is for fullscreen (you need to differentiate with Gun4ir for it to work properly). 

Long story short I am using a compiled script from a youtuber Brad D which accomplishes this perfectly (below - where M3.1 is the serial command which switches the gun to content aspect ratio, and M3.0 switches it back to fullscreen). 

Run, %COMSPEC% /C echo M3.1 > COM3
Run, %COMSPEC% /C echo M3.1 > COM4
Escape::
    Run,%COMSPEC% /C echo M3.0 > COM3
    Run,%COMSPEC% /C echo M3.0 > COM4
    ExitApp
return

The problem is once I hit ESC to exit my game, it will kick me back to Launchbox and MAME remains open but minimised. 

Can someone please point me in the right direction so MAME closes as well with this arrangement- I am obviously hopeless with this stuff. 

Thanks very much in advance. 

Fishy

 

Link to comment
Share on other sites

3 hours ago, fishy1988 said:

Can someone please point me in the right direction so MAME closes as well with this arrangement

Assuming you use this script only for MAME and you're talking stand-alone MAME (vs Retroarch MAME core) and that it does indeed work to set and reset the COM ports, respectively, have the script also close MAME after resetting the COM ports.

Run, %COMSPEC% /C echo M3.1 > COM3
Run, %COMSPEC% /C echo M3.1 > COM4
Escape::
    Run,%COMSPEC% /C echo M3.0 > COM3
    Run,%COMSPEC% /C echo M3.0 > COM4
    WinClose, ahk_exe mame.exe
    ExitApp
return

 

  • Thanks 1
Link to comment
Share on other sites

On 8/15/2023 at 10:35 PM, JoeViking245 said:

Assuming you use this script only for MAME and you're talking stand-alone MAME (vs Retroarch MAME core) and that it does indeed work to set and reset the COM ports, respectively, have the script also close MAME after resetting the COM ports.

Run, %COMSPEC% /C echo M3.1 > COM3
Run, %COMSPEC% /C echo M3.1 > COM4
Escape::
    Run,%COMSPEC% /C echo M3.0 > COM3
    Run,%COMSPEC% /C echo M3.0 > COM4
    WinClose, ahk_exe mame.exe
    ExitApp
return

 

Yes correct I'm using standalone MAME. Thanks Joe I will try this tonight. 

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

Hi,

Bumping this topic back to the top as I have a similar question. What if I want the second part of this script to run but only at exit of MAME. NOT when I press escape. For example, if I am in a MAME menu and press escape I just want to go back to the game or back one menu, not exit mame. As it is currenlty written it will exit Mame. Can this be modified so it watches when MAME exits on its own and then runs the script?

So basically at start (which currently works):

RUN, %COMSPEC% /C ECHO M3.1 > COM7
RUN, %COMSPEC% /C ECHO M3.1 > COM8

On Close (when MAME closes on its own):

RUN, %COMSPEC% /C ECHO M3.0 > COM7
RUN, %COMSPEC% /C ECHO M3.0 > COM8

 

Thanks for the help.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...