Launching MAME games from command line

The following command

retroarch -L mame vr.zip

launches internal MAME menu:

I can start the game from there but how to make it launch directly like it does when selected from GUI?

You need to put the complete path in quotation marks.

retroarch -L "/home/user/.config/retroarch/cores/mame_libretro.so" "/home/users/games/arcade/mame-roms/game.zip"

wait… edit:

This is for saving a ‘.cmd’ file.
You only need the game in quotes with the full address:

retroarch -L mame '/home/yop/Games/Arcade/MAME/roms/vr.zip'

MAME now uses a content loading system. In the quick menu you can see the different loading options.

1 Like

The game doesn’t need to be in quotes either. Quotes are generally needed, when there is a space in the path or some special characters to not confuse the terminal (the shell, more specifically).

But for the question of the OP, I wonder what setting is it that causes the game to load or to show the menu. I play through these commandline options often and game loads instantly on mame for me, by only specifying core with L and the game path (no quotes).

I forgot that I am on an older version of MAME. So this might have changed. Totally forgot this.

It’s not about the quotes it’s more about /. Overall launching through command line works in some mysterious ways:

  • retroarch -L mame vr fails to launch

    [libretro INFO] ------------------------
    [libretro INFO] MAME 0.261 (68520cf)
    [libretro INFO] ------------------------
    [INFO] [Content]: Content loading skipped. Implementation will load it on its own.
    [libretro ERROR] Error parsing game path: "vr"
    [libretro ERROR] Error parsing system name: "vr"
    [libretro ERROR] Error parsing parent path: "vr"
    [libretro INFO] Starting game from command line: "vr"
    [libretro WARN] Parse path failed: "vr"
    [libretro WARN] Parse systemname failed: "vr"
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    [libretro INFO] System found: "vr"
    [INFO] [Environ]: SET_ROTATION: 0
    opr14742.bin NOT FOUND (tried in vr)
    opr14743.bin NOT FOUND (tried in vr)
    opr-14744.58 NOT FOUND (tried in vr)
    opr-14745.59 NOT FOUND (tried in vr)
    opr-14746.62 NOT FOUND (tried in vr)
    opr-14747.63 NOT FOUND (tried in vr)
    opr14748.bin NOT FOUND (tried in vr)
    315-5571.bin NOT FOUND (tried in vr)
    315-5572.bin NOT FOUND (tried in vr)
    epr-14882.14 NOT FOUND (tried in vr)
    epr-14883.15 NOT FOUND (tried in vr)
    epr-14878a.4 NOT FOUND (tried in vr)
    epr-14879a.5 NOT FOUND (tried in vr)
    mpr-14880.6 NOT FOUND (tried in vr)
    mpr-14881.7 NOT FOUND (tried in vr)
    mpr-14884.8 NOT FOUND (tried in vr)
    mpr-14885.9 NOT FOUND (tried in vr)
    mpr-14886.10 NOT FOUND (tried in vr)
    mpr-14887.11 NOT FOUND (tried in vr)
    mpr-14888.12 NOT FOUND (tried in vr)
    mpr-14889.13 NOT FOUND (tried in vr)
    315-5573.bin NOT FOUND (tried in vr)
    epr-14870a.7 NOT FOUND (tried in vr)
    mpr-14873.32 NOT FOUND (tried in vr)
    mpr-14876.4 NOT FOUND (tried in vr)
    mpr-14890.26 NOT FOUND (tried in vr)
    mpr-14891.27 NOT FOUND (tried in vr)
    mpr-14892.28 NOT FOUND (tried in vr)
    mpr-14893.29 NOT FOUND (tried in vr)
    mpr-14894.30 NOT FOUND (tried in vr)
    mpr-14895.31 NOT FOUND (tried in vr)
    mpr-14896.32 NOT FOUND (tried in vr)
    mpr-14897.33 NOT FOUND (tried in vr)
    mpr-14898.39 NOT FOUND (tried in vr)
    mpr-14899.40 NOT FOUND (tried in vr)
    mpr-14900.41 NOT FOUND (tried in vr)
    mpr-14901.42 NOT FOUND (tried in vr)
    93c45.bin NOT FOUND (tried in vr)
    epr-14869.25 NOT FOUND (tried in model1io vr)
    epr-15112.17 NOT FOUND (tried in m1comm vr)
    Fatal error: Required files are missing, the machine cannot be run.
    
  • retroarch -L mame vr.zip launches MAME Menu

    [libretro INFO] ------------------------
    [libretro INFO] MAME 0.261 (68520cf)
    [libretro INFO] ------------------------
    [INFO] [Content]: Content loading skipped. Implementation will load it on its own.
    [libretro ERROR] Error parsing system name: "vr.zip"
    [libretro ERROR] Error parsing parent path: "vr.zip"
    [libretro INFO] Starting game: "vr.zip"
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    
  • retroarch -L mame ./vr launches game, console errors

    [libretro INFO] ------------------------
    [libretro INFO] MAME 0.261 (68520cf)
    [libretro INFO] ------------------------
    [INFO] [Content]: Content loading skipped. Implementation will load it on its own.
    [libretro ERROR] Error parsing game path: "./vr"
    [libretro ERROR] Error parsing system name: "./vr"
    [libretro ERROR] Error parsing parent path: "./vr"
    [libretro INFO] Starting game from command line: "vr"
    [libretro WARN] Parse path failed: "vr"
    [libretro WARN] Parse systemname failed: "vr"
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    [libretro INFO] System found: "vr"
    
  • retroarch -L mame ./vr.zip launches game, console errors

    [libretro INFO] ------------------------
    [libretro INFO] MAME 0.261 (68520cf)
    [libretro INFO] ------------------------
    [INFO] [Content]: Content loading skipped. Implementation will load it on its own.
    [libretro ERROR] Error parsing system name: "./vr.zip"
    [libretro ERROR] Error parsing parent path: "./vr.zip"
    [libretro INFO] Starting game: "./vr.zip"
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    
  • retroarch -L mame "$PWD/vr" launches game, console error

    [libretro INFO] ------------------------
    [libretro INFO] MAME 0.261 (68520cf)
    [libretro INFO] ------------------------
    [INFO] [Content]: Content loading skipped. Implementation will load it on its own.
    [libretro ERROR] Error parsing game path: "/home/user/mame/vr"
    [libretro INFO] Starting game from command line: "vr"
    [libretro WARN] Parse path failed: "vr"
    [libretro WARN] Parse systemname failed: "vr"
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    [libretro INFO] System found: "vr"
    
  • retroarch -L mame "$PWD/vr.zip" launches game, no errors

    [libretro INFO] ------------------------
    [libretro INFO] MAME 0.261 (68520cf)
    [libretro INFO] ------------------------
    [INFO] [Content]: Content loading skipped. Implementation will load it on its own.
    [libretro INFO] Starting game: "/home/user/mame/vr.zip"
    [libretro INFO] Game name: vr
    [libretro INFO] Game description: Virtua Racing
    

The variations without file extension cannot work, because you are giving over a path to a file that does not exist. No surprise there. The one with ./vr where you say it launches game, it actually does not, because said reason. Does the last one with "$PWD/vr.zip" plays the game directly? I would assume so, because pwd is translated to the current working directory in which you are currently. If this works, then I wonder why ./vr.zip does not. Because the dot . is the current working directory. This is weird to me.

I assume you are on a Linux based system, right?

It does work for me. You have different results?

All do except the first two: vr and vr.zip. The only difference being different (unimportant?) errors in the log.

Yes and I’m starting games with current directory set to /home/user/mame/ where the game files are.

Recently, MAME supported systems, and the content is defined with quotation marks. In cmd files, it is necessary to place the full path even to the core.

It is now customary for, people who come to ask questions end up teaching.

PWD defines the current directory, that is, you are in the directory that contains the roms. defines the current directory and / is for accessing a directory. If you are in Home, this does not work. :neutral_face:

The way MAME loads the games from the ternimal, is as I indicated above.

I think here is a fallback in action, looking at the output. MAME or Libretro first looksup filename, in example ./vr without a file extension. As there is no file in the current folder with the name vr (they are all named with .zip), then it fallsback to looking up in MAMEs internal database. In this case it matches the internal database of vr, which is Virtua Racing. Therefore it could find the game you was asking for, even with the errors displayed.

I think this fallback was confusing you why it sometimes works and sometimes not. The variant vr surprises me a little bit here, that it does not work. I can only speculate at this point, so let’s stop here. I assume you are in the same directory as the rom folder, right?

Yes from the same directory. I tested various command lines just for the sake of getting a bigger picture. My main issue was that vr.zip launched MAME menu instead of game and Alex suggestion pointed me in the right direction. I can do with ./vr.zip but IMO it’s unfortunate that these give different results.