Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Problem trying to launch mame game behind a batch file..  (Read 3718 times)

0 Members and 1 Guest are viewing this topic.

tscottn

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:January 07, 2022, 02:18:13 pm
  • I want to build my own arcade controls!
Problem trying to launch mame game behind a batch file..
« on: February 18, 2019, 03:26:09 pm »
Well let me see if I can explain this correctly so maybe a expert here can point me in the direction of a solution...

my mame cab is running windows 7 using attract mode as the FE.

I would like the system to launch Galaga on startup and then when I exit out of the game I would like it to start the FE.  I have it all running fine using a batch file that looks kind of like this..

pushd d:\blah blah

call "d:\blah blah\mame.exe" galaga

pushd d:\blah blah

call "d:\blah blah\attract.exe"

(obviously substitute the "blah" for my actual directories)

this all works fine and dandy except!!!!  when the batch file calls the first program ( in this case its mame.exe running the galaga rom) the game goes to a minimized state because the CMD window is still open in front of mame waiting for the exit of mame in order to call attract mode. 

I have tried using the minimize option for the batch file but it seems that as long as the CMD is still open it will always minimize mame behind it..  I hope this makes sense and maybe someone has a solution..  Thanks.. 

Unfortunately there is no option to run a specific rom directly on startup of Attract mode that I can see.  I think  there is a option for random or last game played but thats it.. no specific rom on start.. 

thanks again

big10p

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 698
  • Last login:May 01, 2023, 01:46:23 pm
  • Mmmm, arcade classics!
Re: Problem trying to launch mame game behind a batch file..
« Reply #1 on: February 18, 2019, 04:11:25 pm »
Not familiar with pushd or why you're using call. Anyway, have you tried simply:

d:
cd "blah\mame"
mame.exe galaga
cd "blah\attract mode"
attract.exe

tscottn

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:January 07, 2022, 02:18:13 pm
  • I want to build my own arcade controls!
Re: Problem trying to launch mame game behind a batch file..
« Reply #2 on: February 19, 2019, 12:23:20 am »
hi, yes tried the simplest method and it seems  that doing it the way you suggest causes a few issues.. first is that mame is then set in the background behind the FE.. so the FE takes over the screen.. also I can actually use a pause command in the batch file however then when the FE does load in the back behind mame/galaga you can hear all the video sounds from the FE because its not in a suspended mode.. which is what would happen in you ran a rom from within the FE

I hope that makes sense.. I was hoping some others have already accomplished this but it looks like I may be on my own here.. I may just go back to the original setup and load the FE only..  oh well..  ))  thanks for the response..

big10p

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 698
  • Last login:May 01, 2023, 01:46:23 pm
  • Mmmm, arcade classics!
Re: Problem trying to launch mame game behind a batch file..
« Reply #3 on: February 19, 2019, 04:18:45 am »
I'm confused. I thought you wanted MAME to run Galaga, and then when you quit MAME, load the FE? So, not sure why you're talking about the FE running behind MAME, etc. I just tried the batch file above, and it seems to work fine for me.

Mr. Peabody

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 813
  • Last login:March 05, 2025, 05:44:10 pm
Re: Problem trying to launch mame game behind a batch file..
« Reply #4 on: February 20, 2019, 07:18:54 pm »
.....is Galaga that special a game to go to such lengths?

killallhumans

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 37
  • Last login:May 21, 2021, 06:57:37 pm
  • What does this red button do?
Re: Problem trying to launch mame game behind a batch file..
« Reply #5 on: February 23, 2019, 01:34:52 pm »
tscottn:

How about one better? NO BATCH FILE!
I can write one small program that will start your whole arcade for you.
* No black box to ugly things up.
* No overlapping FE. Batch file is not waiting for mame to exit.
* Fade-in splash screen, optional. Startup sound, optional.
* Source code, in case you want to make changes.
What i need:
Correct paths. No more blah, blah, blah.
List of all items and events you want to make your arcade run.
Optional:
Logo.
Wallpaper, for splash background.
Name of startup sound.
Desktop resolution. 1920x1080, 1366x768, 1024x768, 800x600, or vert 1080x1920, 768x1366, 768x1024, 600x800.
Cocktail Table? No problem. Head 2 head, side by side, or 2-up splash screen.

Let me know if this would meet your needs.
And hell, IT'S FREE!   :applaud:
- David
« Last Edit: February 23, 2019, 04:51:20 pm by killallhumans »
Auto•It 3 fixes everything.
Game loading, lights, sounds,
control mapping, screen rotation...
Compile scripts to EXEs and drop them
into your arcade Frontend.

killallhumans

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 37
  • Last login:May 21, 2021, 06:57:37 pm
  • What does this red button do?
Re: Problem trying to launch mame game behind a batch file..
« Reply #6 on: February 23, 2019, 09:08:06 pm »
.....is Galaga that special a game to go to such lengths?

Prob cabinet theme. It's special to tscottn, and that's all that matters. I'm sure each of us have
features in our arcades to make them unique and express our own individual style.
Every time i help someone else with their arcade project, i get twice as many new ideas for my
next build.  :cheers:
Auto•It 3 fixes everything.
Game loading, lights, sounds,
control mapping, screen rotation...
Compile scripts to EXEs and drop them
into your arcade Frontend.

tscottn

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:January 07, 2022, 02:18:13 pm
  • I want to build my own arcade controls!
Re: Problem trying to launch mame game behind a batch file..
« Reply #7 on: February 24, 2019, 11:39:20 pm »
.....is Galaga that special a game to go to such lengths?

Prob cabinet theme. It's special to tscottn, and that's all that matters. I'm sure each of us have
features in our arcades to make them unique and express our own individual style.
Every time i help someone else with their arcade project, i get twice as many new ideas for my
next build.  :cheers:
well said sir.  My arcade is actually Galaga themed and it is my fav game from back in the day, so yes it is pretty special to m,me, hence why I would like to have it run the game from the start.

tscottn

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:January 07, 2022, 02:18:13 pm
  • I want to build my own arcade controls!
Re: Problem trying to launch mame game behind a batch file..
« Reply #8 on: February 24, 2019, 11:41:11 pm »
tscottn:

How about one better? NO BATCH FILE!
I can write one small program that will start your whole arcade for you.
* No black box to ugly things up.
* No overlapping FE. Batch file is not waiting for mame to exit.
* Fade-in splash screen, optional. Startup sound, optional.
* Source code, in case you want to make changes.
What i need:
Correct paths. No more blah, blah, blah.
List of all items and events you want to make your arcade run.
Optional:
Logo.
Wallpaper, for splash background.
Name of startup sound.
Desktop resolution. 1920x1080, 1366x768, 1024x768, 800x600, or vert 1080x1920, 768x1366, 768x1024, 600x800.
Cocktail Table? No problem. Head 2 head, side by side, or 2-up splash screen.

Let me know if this would meet your needs.
And hell, IT'S FREE!   :applaud:
- David

Well, im not sure how I can pass this offer up.  Thanks a lot killallhumans.  I will send you a PM with the details you requested.  Cant wait to try it out!


killallhumans

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 37
  • Last login:May 21, 2021, 06:57:37 pm
  • What does this red button do?
Re: Problem trying to launch mame game behind a batch file..
« Reply #9 on: February 25, 2019, 03:23:51 pm »
Holy cow! Look at what I found.
Now we have to do a splash screen.
Don't worry about black background. I can clean that out to show your wallpaper.
Auto•It 3 fixes everything.
Game loading, lights, sounds,
control mapping, screen rotation...
Compile scripts to EXEs and drop them
into your arcade Frontend.

killallhumans

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 37
  • Last login:May 21, 2021, 06:57:37 pm
  • What does this red button do?
Re: Problem trying to launch mame game behind a batch file..
« Reply #10 on: February 25, 2019, 07:03:12 pm »
For anyone else keeping tabs on this thread, I wouldn't want to leave you out.
Code: [Select]
#NoTrayIcon
#include <File.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
Dim $_GuiDelete

Local $sTestPath = _PathFull('splash.png')
If Not FileExists ('splash.png') Then FileInstall ('splash.png', $sTestPath)
Local $sSoundPath = _PathFull('splash.wav')
If Not FileExists ('splash.wav') Then FileInstall ('splash.wav', $sSoundPath)

$sPng = 'splash.png'
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ($sPng)

$_Gui = GUICreate ('gui', 768, 1366, 0, 0, -1, BitOR ($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
For $iFadeIn = 1 To 255 Step 10
    $hImage = _ImageResize ($sPng, 768, 1366)
    _SetBitMap ($_Gui, $hImage, 768, 1366, $iFadeIn)
    GUISetState (@SW_SHOW)
Next
$sSnd = 'splash.wav'
SoundPlay($sSnd, 1)
Sleep (500)
For $iFadeOut = 255 To 1 Step -10
    $hImage = _ImageResize ($sPng, 768, 1366)
    _SetBitMap ($_Gui, $hImage, 768, 1366, $iFadeOut)
    GUISetState (@SW_SHOW)
Next

_GDIPlus_GraphicsDispose ($hImage)
_GDIPlus_Shutdown ()
While Not $_GuiDelete
    $_GuiDelete = Not GUIDelete (WinGetHandle ('gui'))
 WEnd
Exit

Func _SetBitmap ($hGUI, $hImage, $n_width, $n_height, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC (0)
    $hMemDC = _WinAPI_CreateCompatibleDC ($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ($hImage)
    $hOld = _WinAPI_SelectObject ($hMemDC, $hBitmap)
    $tSize = DllStructCreate ($tagSIZE)
    $pSize = DllStructGetPtr ($tSize)
    DllStructSetData ($tSize, 'X', $n_width)
    DllStructSetData ($tSize, 'Y', $n_height)
    $tSource = DllStructCreate ($tagPOINT)
    $pSource = DllStructGetPtr ($tSource)
    $tBlend = DllStructCreate ($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr ($tBlend)
    DllStructSetData ($tBlend, 'Alpha', $iOpacity)
    DllStructSetData ($tBlend, 'Format', 1)
    _WinAPI_UpdateLayeredWindow ($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC (0, $hScrDC)
    _WinAPI_SelectObject ($hMemDC, $hOld)
    _WinAPI_DeleteObject ($hBitmap)
    _WinAPI_DeleteDC ($hMemDC)
EndFunc ;==> _SetBitmap ()

Func _ImageResize ($sInImage, $newW, $newH, $sOutImage = '')
    Local $oldImage, $GC, $newBmp, $newGC
    If $sOutImage = '' Then _GDIPlus_Startup ()
    $oldImage = _GDIPlus_ImageLoadFromFile ($sInImage)
    $GC = _GDIPlus_ImageGetGraphicsContext ($oldImage)
    $newBmp = _GDIPlus_BitmapCreateFromGraphics ($newW, $newH, $GC)
    $newGC = _GDIPlus_ImageGetGraphicsContext ($newBmp)
    _GDIPlus_GraphicsDrawImageRect ($newGC, $oldImage, 0, 0, $newW, $newH)
    _GDIPlus_GraphicsDispose ($GC)
    _GDIPlus_GraphicsDispose ($newGC)
    _GDIPlus_ImageDispose ($oldImage)
    If $sOutImage = '' Then
    Return $newBmp
    Else
    _GDIPlus_ImageSaveToFile ($newBmp, $sOutImage)
    _GDIPlus_BitmapDispose ($newBmp)
    _GDIPlus_Shutdown ()
    Return 1
    EndIf
EndFunc ;==> _ImageResize ()
« Last Edit: February 25, 2019, 07:34:31 pm by killallhumans »
Auto•It 3 fixes everything.
Game loading, lights, sounds,
control mapping, screen rotation...
Compile scripts to EXEs and drop them
into your arcade Frontend.

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 822
  • Last login:August 18, 2025, 10:00:47 am
Re: Problem trying to launch mame game behind a batch file..
« Reply #11 on: February 26, 2019, 12:31:24 am »
Autoit script, right? The right choice ;)

killallhumans

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 37
  • Last login:May 21, 2021, 06:57:37 pm
  • What does this red button do?
Re: Problem trying to launch mame game behind a batch file..
« Reply #12 on: February 26, 2019, 06:50:11 am »
Yes, Sir.
Look for 768x1366. Change them to 1920x1080, or whatever your desktop is.
Also look for 0, 0, just before it, if you want to move it, and other setting will
be your image size. Sleep sets delay. Step sets frames and speed.
You'll need one 32-bit png named splash.png, and one wave file named splash.wav
They must be located in same folder, unless you edit path in script. Tinker any way
your heart desires. I hope you enjoy, and find a good use for it.
- David


ps
For two screens, moving 0, 0 off your desktop, will place it on your other screen.
Anyone for a breathing marquee?  :lol
« Last Edit: February 26, 2019, 07:16:55 am by killallhumans »
Auto•It 3 fixes everything.
Game loading, lights, sounds,
control mapping, screen rotation...
Compile scripts to EXEs and drop them
into your arcade Frontend.