webstation-broker
DeveloperPython referenceemulators

emulators.rom_cache

Opt-in local copy cache for ROMs that live on a slow library mount.

Opt-in local copy cache for ROMs that live on a slow library mount.

With ROM_CACHE_ENABLED on, a launch of a launcher that sets Emulator.rom_cacheable boots from a copy of the ROM on local disk instead of from ROM_ROOT. The copy is made either before the boot (blocking) or alongside a boot from the library, for the next launch (background).

Only launch() ever sees a cached path. Resolving the boot file, the session's rom_file, save restores and the activate response all stay on the ROM_ROOT path, so the many ROM_ROOT containment checks in the launchers keep working unchanged. The launchers that write the booted path into save data (resume state owner markers) map it back with logical().

An entry mirrors the ROM's path under ROM_ROOT, so <ROM_CACHE_DIR>/<key>/library/ps2/game.iso is the copy of <ROM_ROOT>/library/ps2/game.iso. Launchers that read a title id from the ROM's parent folders (Xenia, RPCS3) see the same folder names either way, and mapping a cached path back is pure path arithmetic.

attributelog
= logging.getLogger(__name__)
attributePHASE
= 'copying_rom'

The extraction_phase a blocking copy reports while the launch waits on it.

attributeMANIFEST
= '.rom-cache.json'

File inside an entry naming its source and the fingerprint the copy was taken at.

attributeLAST_ACCESSED_MARKER
= '.last_accessed'

File inside an entry, touched on every launch, whose mtime drives age and LRU eviction.