webstation-broker
DeveloperPython referenceemulators

emulators.duckstation

DuckStation launcher (RomM platform `psx`): disc resolution, ini patching, and shutdown save states.

DuckStation launcher (RomM platform psx): disc resolution, ini patching, and shutdown save states.

DuckStation has no runtime control channel; the whole lifecycle rides its CLI and settings.

Resume: -statefile <sav> loads a state as part of boot. The broker resolves the state file itself because -resume and -state abort with an error dialog when the file is missing.

Save: SIGTERM triggers a graceful shutdown which, with Main/SaveStateOnExit=true, writes <serial>_resume.sav into savestates/ before the process exits. The write is confirmed by diffing the directory across stop(). The resume state is the only state a shutdown produces, so it doubles as the broker's save state; the slot number is carried only for API symmetry.

attributelog
= logging.getLogger(__name__)
attributeROM_ROOT
= Path(os.environ.get('ROM_ROOT', '/romm'))

Root of the RomM library mount (env ROM_ROOT, default /romm).

A resolved disc image must sit under it; candidates resolving outside are discarded.

attributeDATA_DIR
= Path(os.environ.get('DUCKSTATION_DATA_DIR', _default_data_dir()))

DuckStation's data root (env DUCKSTATION_DATA_DIR, default from _default_data_dir).

attributeINI_PATH
= DATA_DIR / 'settings.ini'

The settings.ini the broker patches before every launch.

attributeSSTATE_DIR
= DATA_DIR / 'savestates'

Directory DuckStation writes <serial>_resume.sav into on shutdown.

attributeDUCKSTATION_LOG_PATH
= Path(os.environ.get('DUCKSTATION_LOG_PATH', '/config/duckstation.log'))

Log file the broker tails for this emulator (env DUCKSTATION_LOG_PATH).

Defaults to /config/duckstation.log.

attributeROM_EXTENSIONS
= ('.m3u', '.chd', '.cue', '.pbp', '.ccd', '.mds', '.iso', '.img', '.ecm', '.bin', '.exe', '.psexe')

Disc formats duckstation-qt can boot, best first.

A folder holding several candidates picks by this order so an .m3u playlist or .chd beats the raw .bin beside it.