Reads the launch
PreMame checks the MAME command line before the real emulator starts and looks for the loaded cart or software name.
Utility
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.
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
PreMame checks the MAME command line before the real emulator starts and looks for the loaded cart or software name.
It checks the configured artwork folder for a matching per-game .lay and decides whether a temporary swap is needed.
If a matching file was used, PreMame restores the original default.lay automatically when MAME closes.
Why it helps
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.
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.
If no matching per-game file exists, the normal console default.lay stays in place and MAME launches normally.
Layout Builder still creates the actual exported files. PreMame only decides which finished layout gets presented to MAME at startup.
How to use it
PreMame.ini.PreMame.ini, such as mame.exe or mame64.exe.PreMame.ini.default.lay file in the console artwork folder.
In a folder such as artwork\\snes, you might keep:
default.laySuper Mario World 1.laySuper Mario Kart.layF-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
PreMame backs up the current default.lay, swaps in the matching game layout,
launches MAME, and restores the original file when MAME closes.
The normal shared default.lay remains untouched and MAME starts with the standard artwork flow.
The wrapper still works because the swap-and-restore workflow does not rely on the Lua bridge plugin.
No console default swap is needed, so the normal per-game MAME artwork flow continues unchanged.
Guide notes
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.
real_exe value in PreMame.ini.default.lay looks changed while the game is running, that is expected during the temporary swap.default.lay and you do not need the wrapper for that system.Bottom line
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.