Author Topic: Need help with BAT file to use different MAME versions for certain games  (Read 5565 times)

jp

  • Newbie
  • *
  • Posts: 2
You guys rock! I edited the BAT file as you suggested to replace %1 with %3 and included the .zip extension and it worked perfectly. Thank you so much!

mgalaxy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1165
    • Email
It's because mGalaxy don't use the same command line

mGalaxy use
Code: [Select]
-rompath "%path" %file%ext -volume -%volume(32,0) -skip_gameinfo -nowindow
 so I think %1 = -rompath here.

You can use autoitscript , easier to use and more powerfull, mGalaxy use them to escape from some emuls.

Aeliss is right!
I'll take some time to try to help you...but can't check everything cause I'm not at home!
Hope that it'll help!

Code: [Select]
if %1==dkong goto mame112
if %1==kinst goto mame112
if %1==kinst2 goto mame112

rem default MAME launch
cd 125
mame %1 %2 %3 %4 %5 %6
cd ..
goto end

:mame112
cd 112
mame %1 %2 %3 %4 %5 %6
cd ..
goto end

:end

Explanations:

mame %1 %2 %3 %4 %5 %6 : each % (%1, %2,..) is an identifier for arguments passed in the command line.

So, if the main goal is to send a rom name to mame through a batch file one should send:
Code: [Select]
batchfile.exe "pacman"
The batch file would check for the rom name this way:
If argument #1 = "pacman" then goto 'mame112'
In code
Code: [Select]
if %1=="pacman" goto mame112

:mame112
cd 112
mame %1
cd ..
goto end

:end

The mGalaxy part now:
Code: [Select]
-rompath "%path" %file%ext -volume -%volume(32,0) -skip_gameinfo -nowindowYou have here a copy of the command line TEMPLATE, filled with arguments, that is sent to mame by mGalaxy.
You can see that there too mGalaxy uses identifiers!
They are here called '%path', '%file', '%ext', '%volume'.
In running mode, mGalaxy will substitute those identifiers with the real value...ok?

So, if you want to send the rom name as first argument to your batchfile, this template should simply be:
Code: [Select]
%file
This was the theory. To summarize:
To have it working, 2 solutions:

1. You don't want to edit the batch file (so, you'll have to edit mGalaxy settings):
In mGalaxy folder > Data > BaseSystems > BaseSystems.xml: edit this file and find the 'mame' block of code to add a new line for your batch/exe system.
If you only want to send the rom name (as with my example) the final block of code should look like this:
Code: (xml) [Select]
<System type="Arcade">
   <Name ss="75" em="MAME" tgdb="Arcade" gb="84|ARC">Multi-system [MAME]</Name>
   <Emu selected="MAME">
      <Cmd hidden="true" name="MAME" value="-rompath &quot;%path&quot; %file%ext -volume -%volume(32,0) -skip_gameinfo -nowindow" extensions=".zip,.7z,.chd"/>
      <Cmd hidden="true" name="My Custom System" value="%file" extensions=".zip,.7z,.chd"/>
   </Emu>
</System>
Now, back to mGalaxy_Runway, you now can create a new "MAME" system and choose "My Custom System" (and make it point to your batch/exe file)
From now, when you'll launch a game in mGalaxy, the rom name only will be sent to your bach/exe file, which in turn will check for the name then run mame with this rom name!

2. You don't want to edit mGalaxy settings (so, you'll have to edit your batch file)
This is the preferred way! That's simpler...and you won't need to start again with new mGalaxy version

Now that you're mastering the identifiers system ;) you understand that you want to check for the name with the correct identifier!
With mGalaxy sending "-rompath &quot;%path&quot; %file%ext -volume -%volume(32,0) -skip_gameinfo -nowindow"
...the rom name (actually with the 'extension' identifier joinded to it) is in #3 position (%file%ext). So you'll have to check %3 in your batch file.

ATTENTION: one little problem here! In the mGalaxy command line template the romname and extension are joined (%file%ext). So, I hope that it won't be a problem for you, but you'll have to check for the romname + extension in your batch file!
The ending file should look like this:

Code: [Select]
if %3==dkong.zip goto mame112
if %3==kinst.zip goto mame112
if %3==kinst2.zip goto mame112

rem default MAME launch
cd 125
mame %1 %2 %3 %4 %5 %6
cd ..
goto end

:mame112
cd 112
mame %1 %2 %3 %4 %5 %6
cd ..
goto end

:end
« Last Edit: May 20, 2017, 06:29:04 AM by mgalaxy »

Aeliss

  • Hero Member
  • *****
  • Posts: 900
It's because mGalaxy don't use the same command line

mGalaxy use
Code: [Select]
mame.exe -rompath "%path" %file%ext -volume -%volume(32,0) -skip_gameinfo -nowindow
 so I think %1 = -rompath here.

You can use autoitscript , easier to use and more powerfull, mGalaxy use them to escape from some emuls.

jp

  • Newbie
  • *
  • Posts: 2
Hi all,
I have MAME0169 fully working with mGalaxy  but have a handful of games that I want to use MAME0162 for. I did some searching online and found that I could create a BAT file to launch a different mame.exe file for specific games, but I can't get it working.

Here's my setup:
Under C:\Program Files I have a folder called mame. Inside that folder I have separate folders for mame0162 and mame0169, both include a mame.exe and a mame.ini file.

I created a BAT file (using the format I found in this thread), used a utility to convert it to an EXE, and put it in C:\Program Files\mame. I then went into Runway and selected this new EXE as the App Path for MAME. The EXE file looks like this:

if %1==kidniki goto mame0162

rem default MAME
cd mame0169
mame %1 %2 %3 %4 %5 %6
cd ..
goto end

:mame0162
cd mame0162
mame %1 %2 %3 %4 %5 %6
cd ..
goto end

:end


The issue I'm having is that mGalaxy always uses the default (no match) path and launches mame0169. I've tried it with a bunch of different games and had the same results.

I'm pretty sure the issue is with my BAT file but I'm not too script-savvy and can't figure it out. Can anyone help?

Thanks!
JP



« Last Edit: May 18, 2017, 02:09:27 PM by jp »