emulators.flycast.Flycast
Exit-only Flycast (Sega Dreamcast) launcher.
Exit-only Flycast (Sega Dreamcast) launcher.
Save state is triggered by a graceful window-close request (Alt+F4) rather than a control socket, since Flycast has no other clean shutdown path; see the module docstring for the full hardware/protocol rationale.
Attributes
attributename= 'flycast'attributedisplay_name= 'Flycast'attributesave_root= DATA_DIR.parentattributesave_subtrees= (DATA_DIR.name,)attributerom_extensions= ROM_EXTENSIONSattributelog_path= FLYCAST_LOG_PATHattributeterm_timeout= float(os.environ.get('FLYCAST_STOP_WAIT', '20'))Functions
func__init__(self) -> NoneInitialize the emulator with no ROM loaded yet.
paramselfReturns
Nonefuncresolve_rom_file(self, path) -> Optional[Path]Resolve a ROM path to a single playable disc image or file.
paramselfparampathPathA direct file path, or a folder searched up to one level deep for the best candidate, ranked by disc number, extension preference, and path depth.
Returns
typing.OptionalThe resolved file path, or None if no suitable candidate was
func_xdotool(self, *args) -> Optional[str]Run xdotool, returning its stdout, or None if it failed.
paramselfparamargsstr= ()Returns
typing.Optional[str]func_window(self) -> Optional[str]The window id belonging to this launch's own process, or None.
Matched by title then confirmed by pid rather than trusting the first title hit, since Alt+F4 acts on whatever id comes back and a stray match would close the wrong thing instead of just failing a hotkey.
paramselfReturns
typing.Optional[str]funclaunch(self, rom_path, resume_slot) -> NoneStop any running instance and launch Flycast for the given ROM.
paramselfparamrom_pathPathThe resolved disc image or file to boot.
paramresume_slotOptional[int]If not None and a resume state exists for this rom, enable auto-load on boot; otherwise boot fresh.
Returns
Nonefuncstop(self) -> NoneRequest a graceful exit via Alt+F4, then escalate if it does not take.
Activates the emulator's own window and sends Alt+F4 to trigger Flycast's only clean-shutdown path (SDL_QUIT). Falls back to the base class's SIGTERM/SIGKILL escalation if no window can be found or activated, or if the process has not exited within term_timeout.
paramselfReturns
Nonefuncclear_working_slot(self) -> NoneDrop every resume state left in DATA_DIR before a restore.
The name only stops being ambiguous once the rom is known, and that happens after this runs (activate resolves the rom, clears the slot, then launches), so a leftover from an earlier local session for the same title would otherwise sit here with a newer mtime than the incoming archive member and get skipped by extract_save_archive's newer-file guard. Anything still here belongs to a session that already exited, so dropping it all is the same trade-off DuckStation's clear_working_slot makes.
paramselfReturns
Nonefuncsave_and_exit(self, slot) -> dictStop the emulator and report whether this exit actually saved state.
paramselfparamslotOptional[int]The resume slot to report on. If None, the emulator is stopped without inspecting any resume state.
Returns
dictA dict with "state_saved" (bool), "state_slot" (the given