webstation-broker
DeveloperPython referenceemulatorsemulators.shadps4

emulators.shadps4.Shadps4

PlayStation 4 via shadPS4, driven over its stdin IPC protocol.

PlayStation 4 via shadPS4, driven over its stdin IPC protocol.

The binary is picked from the launcher's versions tree at launch time and spawned fullscreen with SHADPS4_ENABLE_IPC=true and a stdin pipe. RUN then START are written straight away so the game boots without waiting on the RUN deadline, and the stop writes STOP, which pushes SDL_EVENT_QUIT, the same path as a window close. shadPS4 registers no SIGTERM/SIGINT handler, so a bare SIGTERM would kill it hard and leave read-write save mounts with their sce_sys/corrupted marker in place; SIGTERM is only the escalation after STOP times out or the pipe breaks.

There are no save states: persistence is the game's own save data under home/1000/savedata, keyed by game serial, which is what the archive carries. A resume slot is logged and ignored.

Attributes

attributename
= 'shadps4'

Provider key, shadps4.

attributedisplay_name
= 'shadPS4'

Human-readable name.

attributesave_root
= DATA_DIR

The data directory the save subtree hangs off.

attributesave_subtrees
= ('home/1000/savedata',)

Save data plus its per-title param.sfo, under the default PS4 user.

attributerom_extensions
= ROM_EXTENSIONS

Bootable formats.

attributelog_path
= SHADPS4_LOG_PATH

The emulator log file.

attributeterm_timeout
= float(os.environ.get('SHADPS4_STOP_WAIT', '20'))

Seconds STOP gets before SIGTERM (env SHADPS4_STOP_WAIT, default 20).

Functions

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

The path shadPS4 should boot for path.

paramself
parampathPath

A ROM file, or a game folder.

Returns

typing.Optional

The file itself, the folder's eboot.bin, the folder when it

funclaunch(self, rom_path, resume_slot) -> None

Spawn the newest shadPS4 with IPC enabled and boot the game.

Raises

  • RuntimeError: When no binary is found under VERSIONS_DIR.
paramself
paramrom_pathPath

The file or folder to boot.

paramresume_slotOptional[int]

Ignored with a log line; shadPS4 has no save states.

Returns

None
func_ipc_send(self, cmd) -> bool

Write one IPC command line to the emulator's stdin.

paramself
paramcmdstr

The command, such as RUN or START; a newline is appended.

Returns

bool

True when the line was written and flushed, False when there is

funcstop(self) -> None

Ask shadPS4 to quit over IPC, escalating to the base SIGTERM stop.

STOP is written to stdin and the process given term_timeout to exit on its own; a broken pipe or a timeout falls through to the SIGTERM then SIGKILL sequence in the base class.

paramself

Returns

None

On this page