webstation-broker
DeveloperPython referenceemulators

emulators.dolphin

Dolphin (GameCube/Wii) launcher: ROM resolution, hotkey save states, and boot-time resume.

Dolphin (GameCube/Wii) launcher: ROM resolution, hotkey save states, and boot-time resume.

Dolphin has no control socket, but it takes every setting it needs on the command line: -C writes into the layered config, so nothing here has to patch an INI, and -s loads a state file by path at boot, so a resume that is already on disk never depends on a keystroke landing. What is left is the mid-session save, which only the hotkey can reach; the broker runs as the same user as the session, so xdotool talks to Xwayland directly.

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.

attributeUSER_DIR
= xdg_data_dir('dolphin-emu')

Dolphin's data directory: states, memory cards and the NAND.

Dolphin's own XDG default rather than a directory pinned with -u, because -u also drags the config into <dir>/Config, where the desktop launcher, which passes none, would never read it.

Not configurable, and deliberately: the broker and the emulator have to agree on this path or the broker archives a directory nothing writes to, so launch exports the root it resolved to rather than leaving the child to resolve its own. A knob here could only ever break that agreement.

attributeSTATE_DIR
= USER_DIR / 'StateSaves'

Directory Dolphin writes its .sNN save states into.

attributeCONFIG_DIR
= xdg_config_dir('dolphin-emu')

Dolphin's INI directory, where the pad bindings are seeded.

Dolphin's own default, which is what the desktop launcher reads, so a pad a player rebinds in a desktop session is the same pad a broker launch gets. Not configurable, for the same reason as USER_DIR.

attributeDOLPHIN_LOG_PATH
= Path(os.environ.get('DOLPHIN_LOG_PATH', '/config/dolphin.log'))

Log file the broker tails for this emulator (env DOLPHIN_LOG_PATH, default /config/dolphin.log).

attributeSTATE_SLOT
= int(os.environ.get('DOLPHIN_STATE_SLOT', '1'))

The one slot the broker works in (env DOLPHIN_STATE_SLOT, default 1).

RomM holds the library of states, so a requested slot resolves to this one and the routes echo the effective slot.

attributeGC_SLOT_A_DEVICE
= 8

EXIDeviceType::MemoryCardFolder, the GC slot A device pinned at launch.

It keeps saves as loose .gci files under GC/<region>/Card A rather than one .raw card image.

attributeSAVE_KEY
= f'shift+F{STATE_SLOT}'

xdotool key for saving the working slot; Dolphin's own default is Shift+F<n> for slot n.

attributeLOAD_KEY
= f'F{STATE_SLOT}'

xdotool key for loading the working slot; Dolphin's own default is F<n> for slot n.

attributeSTATE_WAIT
= float(os.environ.get('DOLPHIN_STATE_WAIT', '20.0'))

Seconds a save state has to land on disk after the save hotkey (env DOLPHIN_STATE_WAIT, default 20).

attributeLOAD_WAIT
= float(os.environ.get('DOLPHIN_LOAD_WAIT', '20.0'))

Seconds Dolphin has to read the state back after the load hotkey (env DOLPHIN_LOAD_WAIT, default 20).

attributeLOAD_SETTLE
= float(os.environ.get('DOLPHIN_LOAD_SETTLE', '2.0'))

Seconds a load gets to deserialize after the state file has been read (env DOLPHIN_LOAD_SETTLE).

Nothing observable marks the end of the deserialize, only the read that starts it, so this is the one bounded guess in the load path. Defaults to 2 seconds.

attributeRESUME_LOAD_WAIT
= float(os.environ.get('DOLPHIN_RESUME_LOAD_WAIT', '90.0'))

Seconds a deferred resume waits for a state file to arrive (env DOLPHIN_RESUME_LOAD_WAIT, default 90).

attributeRESUME_LOAD_SETTLE
= float(os.environ.get('DOLPHIN_RESUME_LOAD_SETTLE', '5.0'))

How long the window has to be up before a hotkey is worth sending (env DOLPHIN_RESUME_LOAD_SETTLE).

Dolphin maps its window before the core is running, and a load that early is dropped. Defaults to 5 seconds.

attributeROM_EXTENSIONS
= ('.rvz', '.wia', '.gcz', '.iso', '.gcm', '.ciso', '.wbfs', '.wad', '.dol', '.elf')

Discs Dolphin boots, best first.

A folder holding several candidates picks the compressed image over the raw one beside it.