Back Home

Utility

PreMame MAME Wrapper

An optional launcher that lets console systems use separate per-game .lay files, then safely falls back to the normal shared default.lay when no match exists.

Per-game console .lay loading Safe default.lay restore Works without the bridge plugin Pairs with Layout Builder export
Best use case

Use PreMame when a console system normally shares one artwork\\system\\default.lay, but you want each game to have its own finished layout file without manually swapping artwork every time.

What it is

A small launcher for per-game console layout swapping

Reads the launch

PreMame checks the MAME command line before the real emulator starts and looks for the loaded cart or software name.

Finds a matching layout

It checks the configured artwork folder for a matching per-game .lay and decides whether a temporary swap is needed.

Restores safely

If a matching file was used, PreMame restores the original default.lay automatically when MAME closes.

Why it helps

Keep console layouts separate without building one giant default file

Cleaner project structure

Instead of stuffing every console game's score rules, helper rows, and artwork into one huge shared layout, each game can keep its own dedicated exported .lay.

More layout freedom

Different games can have different helper rows such as coins, rings, timer, or player counts without forcing those choices onto every other title in the same system.

Safe fallback behavior

If no matching per-game file exists, the normal console default.lay stays in place and MAME launches normally.

Built to complement the builder

Layout Builder still creates the actual exported files. PreMame only decides which finished layout gets presented to MAME at startup.

How to use it

The normal wrapper workflow

Setup steps

  1. Place PreMame beside the real MAME executable, or point it to the real executable in PreMame.ini.
  2. Set the real MAME executable name in PreMame.ini, such as mame.exe or mame64.exe.
  3. Map each console system to the correct artwork folder in PreMame.ini.
  4. Keep the normal shared default.lay file in the console artwork folder.
  5. Export each per-game layout using the real detected game name so PreMame can find it.
  6. Launch the console game through PreMame instead of starting MAME directly.

Typical example

In a folder such as artwork\\snes, you might keep:

  • default.lay
  • Super Mario World 1.lay
  • Super Mario Kart.lay
  • F-Zero.lay

If the launched game matches one of those names, PreMame temporarily swaps that file in as default.lay for the session.

Behavior summary

What happens in each situation

Matching per-game .lay exists

PreMame backs up the current default.lay, swaps in the matching game layout, launches MAME, and restores the original file when MAME closes.

No matching file exists

The normal shared default.lay remains untouched and MAME starts with the standard artwork flow.

Bridge plugin disabled

The wrapper still works because the swap-and-restore workflow does not rely on the Lua bridge plugin.

Arcade title with its own layout

No console default swap is needed, so the normal per-game MAME artwork flow continues unchanged.

Guide notes

Important naming and troubleshooting points

Important naming rule

For console use, exported final and custom .lay files should use the real detected game or profile name that MAME resolves for the loaded cart. That is the name PreMame searches for when deciding whether a per-game layout exists.

Troubleshooting

  • If the console still uses the shared layout, check whether the exported filename matches the cart or software name MAME actually reports.
  • If the wrong MAME executable starts, update the real_exe value in PreMame.ini.
  • If default.lay looks changed while the game is running, that is expected during the temporary swap.
  • If you do not need per-game console layouts, keep using the normal shared default.lay and you do not need the wrapper for that system.

Bottom line

Use Layout Builder to create the files, then let PreMame choose the right one

PreMame is the optional handoff layer for console systems that normally use one shared layout. It gives you per-game flexibility while still restoring the original default.lay safely after each session.