Preserve installed MAME settings in isolated ordinary runs

This commit is contained in:
Александр Петров
2026-09-17 22:59:47 +03:00
parent 5dc7998324
commit 0ade3b4821
4 changed files with 76 additions and 12 deletions
+10 -1
View File
@@ -4,6 +4,7 @@ from __future__ import annotations
import argparse
from pathlib import Path
import shutil
import subprocess
import sys
import tempfile
@@ -43,13 +44,21 @@ def main() -> int:
state = Path(directory)
for name in ("cfg", "nvram", "diff", "snapshot"):
(state / name).mkdir()
# Настройки и NVRAM установленной среды берутся копией: MAME
# перезаписывает их при выходе, а MAME_HOME должен остаться нетронутым.
for name in ("cfg", "nvram"):
source = profile.home / name if profile.home else None
if source and source.is_dir():
shutil.copytree(source, state / name, dirs_exist_ok=True)
snapshots = Path(args.snapshot_dir).resolve() if args.snapshot_dir else state / "snapshot"
snapshots.mkdir(parents=True, exist_ok=True)
write_keyboard_config(state / "cfg")
command = [str(profile.binary), "sprinter", "-noreadconfig",
"-rompath", str(profile.rompath), "-bios", profile.bios,
"-kbd", "ms_naturl,bios=sp2k", "-video", args.video,
"-window", "-skip_gameinfo", "-beta:wd179x:0", "35hd",
"-window", "-skip_gameinfo",
"-beta:wd179x:0", "35hd",
"-beta:wd179x:1", "35hd",
"-flop2", str(profile.dss_image),
"-hard1", str(profile.system_hdd_image)]
if "floppy" in media: