MAME CFG vs NVRAM vs diff vs save state files: reset the right layer
Use CFG for MAME configuration such as inputs, DIP settings, and bookkeeping; NVRAM for emulated EEPROM and other non-volatile devices; diff files for writes layered over a compressed hard-disk image; and save states for a serialized running-machine snapshot. Back up every relevant layer, close MAME cleanly, then isolate or restore only the layer that matches the symptom.
Do this in order
- 01
Record the MAME or port version, machine short name, configured CFG, NVRAM, diff, and state directories, and the exact symptom.
- 02
Exit MAME normally so configuration and emulated non-volatile devices finish writing, then copy the relevant machine files to a dated backup.
- 03
Classify the symptom: controls or DIP/bookkeeping, retained machine memory, writes to an emulated hard disk, or a manual/autosave snapshot.
- 04
Move only the suspected machine-specific file out of the active directory; never delete the original or reset every persistence directory at once.
- 05
Cold-start the same lawful test machine with the same MAME version and compare the one changed behavior against the backup.
- 06
Restore the last known-good file if the diagnosis is wrong, and record the port path plus exact layer before upgrading or migrating.
Decision and diagnostic table
| Layer | What it normally stores | Typical symptom |
|---|---|---|
| CFG | Input assignments, DIP switches, bookkeeping, UI/debugger layout | Controls or operator settings reset |
| NVRAM | EEPROM and other emulated non-volatile device contents | In-machine settings or progress reset |
| diff | Writes layered over an emulated compressed hard disk | Installed data or disk changes disappear |
| Save state | Serialized running-machine snapshot | Manual state or autosave will not load |
CFG and NVRAM represent different owners
MAME writes configuration files when it exits and uses them for emulator-side settings including input assignments, DIP switches, and bookkeeping statistics. NVRAM models storage devices that existed in the emulated machine.
A control remap belongs to CFG; an EEPROM-backed operator value may belong to NVRAM. Back up both before a service-menu change, but diagnose them separately.
A diff file protects the original CHD
MAME's diff directory stores writes made to an emulated compressed hard disk so the original image remains unchanged. A missing or unwritable diff layer can lose installed software or other disk changes even when the CHD itself verifies.
Do not merge, rename, or download another CHD to repair a diff-path problem. Preserve the original authorized image and test the writable layer.
Save states are tied to machine support and build
State files capture a broader running-machine snapshot and are read or written on demand or through autosave. Driver state support is a separate gate, and a state from another MAME generation may be incompatible.
Never make a state the only copy of durable progress. Keep machine-native persistence, a version record, and a last-known-good build where practical.
Persistence files do not grant rights to the underlying game or disk image. Inspect any backup before sharing it, and exclude ROM, BIOS, CHD, commercial NVRAM data, artwork, music, credentials, and private storage exports.