Skip to content

feat: add optional Gen1Recomp SD backup and restore - #13

Open
dmuiX wants to merge 1 commit into
prodeveloper0:mainfrom
dmuiX:feat/gen1recomp-backup-restore
Open

dmuiX wants to merge 1 commit into
prodeveloper0:mainfrom
dmuiX:feat/gen1recomp-backup-restore

Conversation

@dmuiX

@dmuiX dmuiX commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Add an optional, isolated backup/restore adapter for Gen1Recomp save files stored on SD rather than in Horizon save data.

The feature is invisible when the expected Gen1Recomp directory is absent. It can also be disabled with homebrew.gen1recomp=0.

Isolation

Gen1Recomp deliberately does not use or modify the native title archive, fingerprint or sync-state pipeline:

  • source: sdmc:/switch/gen1recomp/pokemon-love2d;
  • separate synthetic server title ID: 484247454E315243 (HBGEN1RC);
  • separate per-account .syncstate.gen1;
  • runs after the native portion of the existing sysmodule round;
  • failures do not alter native results or scheduling.

Only the configured default account owns this SD source, avoiding duplicate uploads for a filesystem tree that has no Horizon account ownership.

Archive safety

  • maximum 256 files;
  • maximum 4 MiB per file and 32 MiB total;
  • maximum traversal depth 8;
  • regular files only; symlinks and special files rejected;
  • safe relative names only;
  • source fingerprint checked before and after archiving;
  • publication is atomic and preserves the previous archive on failure;
  • aborts if an application starts while the SD tree is being read.

Restore safety

The app downloads only the latest HBGEN1RC revision and accepts only saves/ plus options.lua. It rejects traversal, directories, duplicates, oversized files and corrupt/CRC-failing archives before changing active files. Existing data is retained as *.before-unss-restore, rename failures roll back, and an explicit confirmation screen is required.

Supporting change

Directory walking now shares one callback instance and has a depth limit. This avoids recursive std::function copies on the sysmodule stack and lets callers detect partial traversal.

Validation

  • clean app and sysmodule build succeeded;
  • host smoke harness covers fingerprints, busy-source rejection, source mutation/ABA detection and publication rollback;
  • hardware backup uploaded and independently downloaded/decompressed/CRC-checked;
  • app restore was verified against Yellow and Crystal saves plus options.lua;
  • native sysmodule behavior remains independent from this adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant