Author Topic: Mame Roms not launching via .Bat file  (Read 19637 times)

makaveeti

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Mame Roms not launching via .Bat file
« on: June 20, 2017, 12:59:18 AM »
Hi guys,

I'm using RetroFE for windows. I've configured mame and my mame roms in RetroFE. With default launcher settings all works fine.

I made a .bat file to try launch 2 applications 1. ahk (autohotkey) and 2. mame + rom however the roms will not launch from RetroFE. The log file doesn't show any errors.

contents of launcher file -
executable = emulators\MAME\mame64.bat
arguments = %ITEM_FILEPATH%

contents of batch file -
@echo off

pushd "D:\Emulators\RetroFE080\emulators\autohotkey"
start ahk.exe mame.ahk

pushd "D:\Emulators\RetroFE080\emulators\Mame"
mame64.exe %1

I've made .bat files (coded to run several programs) for my windows games in RetroFE and they all work fine.

I tested the above code with Emulation Station for windows and it works fine. Feels like the item_filepath is not being passed through in RetroFE.

What am I doing wrong?


dustind900

  • Full Member
  • ***
  • Posts: 104
  • Karma: +9/-3
    • View Profile
Re: Mame Roms not launching via .Bat file
« Reply #1 on: June 20, 2017, 03:48:36 AM »
try adding quotes like below
Code: [Select]
executable = emulators\MAME\mame64.bat
arguments = "%ITEM_FILEPATH%"

or try
Code: [Select]
executable = emulators\MAME\mame64.bat
arguments = "%ITEM_NAME%"

Or you could just use your ahk script to launch mame. Compile the code and point your launcher to the ahk executable. Be sure to use
Code: [Select]
RunWait, mame64.exe %1%
not
Code: [Select]
Run, mame64.exe %1%
the latter will cause RetroFE to gain focus again because it will assume the ahk executable is the emulator and as soon as it closes RetroFE will gain focus leaving your game running in the background. The your launcher would be something like this
Code: [Select]
executable = emulators\MAME\mame.exe <-- Compiled ahk script
arguments = "%ITEM_NAME%"

If you need help with the ahk code I can help you out. Just post your code

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1543
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Mame Roms not launching via .Bat file
« Reply #2 on: June 20, 2017, 09:47:21 AM »
MAME doesn't use the filename+path for execution; just the game name. As such, %ITEM_NAME% is indeed the variable to use rather than %ITEM_FILEPATH%.

Sent from my SM-G920F using Tapatalk


makaveeti

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Mame Roms not launching via .Bat file
« Reply #3 on: June 20, 2017, 02:18:23 PM »
@pieter - I tried both %ITEM_NAME% and %ITEM_FILEPATH% with and without quotes however this doesn't work.

@dustind900 - I'm not sure how I would go about adding the code to my AHK script. The script it designed to exit mame when I hold button9 on my gamepad for 2 seconds. I've pasted the code for the script below:

Joy9::
 KeyWait,Joy9,T2 ;wait 2 seconds for release key
 If (ErrorLevel) ;more than 2 sec have passed
 {
  Process, Close,  mame64.exe
  Exitapp
 }

Return


I'd like to add that running the .bat file manually from the command prompt (i.e. start command prompt, mame64.bat gamename) works ok but it doesn't when enacted from RetroFE.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1543
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Mame Roms not launching via .Bat file
« Reply #4 on: June 20, 2017, 02:35:38 PM »
Would you mind attaching your log.txt?

Sent from my SM-G920F using Tapatalk


makaveeti

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Mame Roms not launching via .Bat file
« Reply #5 on: June 20, 2017, 02:52:47 PM »
Sure. I launched RetroFE, Tried the game Crude Buster (cbuster) and then manually exited from RetroFE.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1543
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Mame Roms not launching via .Bat file
« Reply #6 on: June 20, 2017, 02:57:03 PM »
Ok, and launching
emulators\MAME\mame64.bat "cbuster"
directly from the command line does work?

makaveeti

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Mame Roms not launching via .Bat file
« Reply #7 on: June 20, 2017, 02:59:33 PM »
Yes it works manually directly from the command line. It launches both the AHK script and the game as per the code in the bat file.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1543
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Mame Roms not launching via .Bat file
« Reply #8 on: June 20, 2017, 03:00:11 PM »
pushd "D:\Emulators\RetroFE080\emulators\Mame"
mame64.exe %1

Should that not be
pushd "D:\Emulators\RetroFE080\emulators\Mame\mame64.exe" %1
in stead?

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1543
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Mame Roms not launching via .Bat file
« Reply #9 on: June 20, 2017, 03:04:47 PM »
Yes it works manually directly from the command line. It launches both the AHK script and the game as per the code in the bat file.

Ok, I will try to free up some time this week to investigate what might be the problem here. I'm not anywhere near my arcade setup at the moment. :)

makaveeti

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Mame Roms not launching via .Bat file
« Reply #10 on: June 20, 2017, 03:33:59 PM »
Thanks Pieter.


Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1543
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Mame Roms not launching via .Bat file
« Reply #11 on: June 20, 2017, 05:05:11 PM »
No problem. Can you attach the .bat file as well?
What directory did you launch from whe you used the commandline? I suspect it's a directory issue...

Sent from my SM-G920F using Tapatalk


makaveeti

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Mame Roms not launching via .Bat file
« Reply #12 on: June 20, 2017, 05:17:43 PM »
the bat file resides in "emulators\Mame"

when I use the command line manually, i launch from the same directory above.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1543
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Mame Roms not launching via .Bat file
« Reply #13 on: June 20, 2017, 05:21:58 PM »
So you launch the script from emulators\Mame when testing from the commandline? Can you try launching from the RetroFE directory using the command I mentioned earlier? I think that Windows is causing some issues with the start directory when launching a .bat file.

Sent from my SM-G920F using Tapatalk


makaveeti

  • Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Mame Roms not launching via .Bat file
« Reply #14 on: June 20, 2017, 05:29:01 PM »
Correct and that works.

Trying with the command below results in an error stating the directory name is invalid. I believe this is because the pushd command only applies to directories and not files.

pushd "D:\Emulators\RetroFE080\emulators\Mame\mame64.exe" %1