Fix MAME NVRAM that resets after exit on Android
Close the emulated machine through MAME's own exit flow, then check whether the exact configured `nvram_directory` received or updated the machine's file. NVRAM is written on exit for machines that use EEPROM or other non-volatile devices. If no write occurs, isolate machine support, effective path, Android access, and forced process termination before touching ROMs or save states.
Do this in order
- 01
Record the port and MAME revision, machine short name, symptom, effective NVRAM path, and whether the machine actually exposes a persistent setting.
- 02
Back up CFG, NVRAM, diff, and state directories without deleting or merging them.
- 03
Change one harmless in-machine setting, return to gameplay, then exit the machine through MAME and close the app normally.
- 04
Inspect the configured NVRAM directory for a file or timestamp change; do not assume the visible ROM folder owns persistence.
- 05
If nothing changes, capture effective configuration and logs, confirm the directory is writable through the wrapper, and repeat without Android force-stop or task killing.
- 06
Cold-launch the same version and machine, verify the setting, and classify failure as support, path/access, clean-exit, or version migration before restoring one layer.
Decision and diagnostic table
| Evidence | Diagnosis | Action |
|---|---|---|
| NVRAM file updates and reloads | Persistence path works | Keep path and clean-exit flow |
| Updates only after normal exit | Forced termination prevents final write | Use MAME exit; review Android policy |
| CFG changes, NVRAM does not | Different data owners or no machine NVRAM | Confirm machine behavior and NVRAM path |
| Old file exists in another folder | Path changed after update | Restore deliberately; do not merge blindly |
NVRAM belongs to the emulated machine
MAME uses NVRAM files for EEPROM, non-volatile RAM, and other programmable devices when a machine has them. Controller mappings and DIP settings usually belong to CFG, while save states serialize a running machine.
Exit is part of the write test
Upstream MAME reads NVRAM at machine start and writes it on exit. Android force-stop, a vendor task killer, or a wrapper crash can prevent the final write even when the directory is correct.
The effective directory is evidence
The default relative folder is not a universal Android path. Use the port's effective configuration or notification and prove the selected destination is writable; a remembered path string is not a retained storage grant.
Use only ROM, BIOS, device, CHD, artwork, audio, and other media you created, dumped lawfully, or received under permission covering your use. Technical identity, a working emulator, and a published hash do not grant content rights.