webstation-broker
DeveloperPython referenceemulatorsemulators.rpcs3

emulators.rpcs3.Rpcs3

RPCS3 (PS3) launcher: exit-only savestates via PINE, plus archive boot support.

RPCS3 (PS3) launcher: exit-only savestates via PINE, plus archive boot support.

Attributes

attributename
= 'rpcs3'
attributedisplay_name
= 'RPCS3'
attributesave_root
= DEV_HDD0
attributerom_extensions
= ROM_EXTENSIONS
attributelog_path
= RPCS3_LOG_PATH
attributeterm_timeout
= float(os.environ.get('RPCS3_STOP_WAIT', '2'))
attributesave_subtreestuple[str, ...]

CellSaveData saves, save states, plus the cellGameData save dirs under game/.

game/ mixes save data with installed PKG titles and RPCS3's $locks dir, so the dump enumerates only the dirs without a bootable EBOOT.BIN. A restore inverts the problem: the archive holds nothing but previously dumped save dirs, and those dirs don't exist on disk yet, so the whole game/ prefix is declared to let them through.

Functions

func__init__(self) -> None

Initialize per-session launch/extraction tracking state.

paramself

Returns

None
funcclear_working_slot(self) -> None

Create the savestates symlink and wipe stale savestates before a restore.

RPCS3 has no fixed slot to clear, but activate() calls this before it ever reads save_subtrees to restore an archive, which makes it the one place that is safe to create the savestates symlink: it runs on every activate, but never during a bare construction (registry sweeps build every emulator against real, unredirected paths).

It also wipes every title's savestates dir and flips _restoring on early. Wiping first means a leftover local state from a previous session never outranks (by mtime) whatever this session's archive restores, and it caps SSTATE_ROOT at whatever the current session itself produces rather than growing across every activate. Flipping _restoring here, not just in prepare_restore(), matters because api.py reads save_subtrees for the restore extract before it ever calls prepare_restore().

paramself

Returns

None
funcprepare_restore(self) -> None

Stop any running instance and mark the session as archive-restoring.

paramself

Returns

None
funcresolve_rom_file(self, path) -> Optional[Path]

Resolve a RomM path to a single bootable PKG, disc, or ISO.

A file is taken as is. A directory is searched for the game's installer/disc layout via _ROM_SEARCH_GLOBS.

paramself
parampathPath

RomM's resolved rom path, file or directory.

Returns

typing.Optional

The path to boot, or None if nothing bootable was found.

func_xdotool(self, *args) -> Optional[str]

Run xdotool, returning its stdout, or None if it failed.

paramself
paramargsstr
= ()

Returns

typing.Optional[str]
func_game_window(self) -> Optional[str]
paramself

Returns

typing.Optional[str]
func_send_key(self, key) -> bool

Focus the render window and send key through XTEST.

Activating first is what makes this survive the player clicking back into the page: XTEST delivers to whatever holds focus, so a key sent at an unfocused RPCS3 goes to the desktop instead.

paramself
paramkeystr

Returns

bool
funclaunch(self, rom_path, resume_slot) -> None

Stop any running instance and boot rpcs3 for the given ROM.

Installs PKGs and extracts archives as needed, then resolves a savestate to boot into when a resume slot is requested and one exists for the title.

paramself
paramrom_pathPath

RomM's resolved rom path (file or directory).

paramresume_slotOptional[int]

Slot to resume from, or None for a fresh boot.

Returns

None
func_boot_watchdog(self, seq) -> None

Confirm the launched game reaches a running state via PINE.

Also opportunistically resolves the title id via MsgID for boots that had no serial from the file path alone (a bare .iso).

A process still alive when the deadline passes without ever reporting running is the boot-error-dialog case: RPCS3 does not exit on its own, so nothing else in the broker would ever notice.

paramself
paramseqint

Returns

None
funcsave_and_exit(self, slot) -> dict

Send the save-state hotkey, then stop the emulator.

paramself
paramslotOptional[int]

Slot to save to, or None to exit without saving.

Returns

dict

A dict with state_saved, state_slot, and state_file (path,

funcstop(self) -> None

Kill the process and remove any extracted archive copy if caching is off.

paramself

Returns

None
func_session_save_dirs(self) -> list[Path]

This title's save dirs.

A dir qualifies by name (prefixed with the session serial) or by containing a file written while the session ran.

paramself

Returns

list[pathlib.Path]

On this page