mirror of
https://github.com/rommapp/romm.git
synced 2026-12-03 10:33:22 +01:00
PPSSPP doesn't save a single file per game like every other core -- it
mirrors a real PSP memory stick under saves/<core>/PSP/SAVEDATA/<slot>/
as several small files (PARAM.SFO, the actual save data, ICON0.PNG, ...)
that only make sense as a set, plus saves/<core>/PSP/SYSTEM/CACHE/ holds
pure engine caches with no save data at all. Neither fits the existing
one-WebDAV-path-per-asset model.
Ports the retroarch-webdav-romm shim's pspSave.ts approach: a save
folder's files are bundled into a single zip stored as one RomM Save
(slot=None), and unbundled again for GET/manifest purposes. The rom is
resolved from the folder's PARAM.SFO TITLE (normalized-matched against
roms on the psp platform) with PSP_SERIAL_MAP as an explicit override and
fallback for titles that don't normalize-match automatically. Files that
arrive before the folder resolves (RetroArch doesn't guarantee PARAM.SFO
lands first) are buffered on disk until it does, and merged in once
resolved.
Manifest lists each bundle member as its own {path, hash} entry, since
RetroArch diffs per-file, not per-bundle.
Also fixes a latent zipfile bug this surfaced: zipfile_inflate64 (pulled
in elsewhere for ROM archive reading) replaces zipfile._get_compressor
with a signature CPython 3.13's own ZipFile.writestr() can't call --
RomM already has a shim for this (utils/zip_cache.py's
_ensure_zipfile_writable), just needed calling here too.