Skip to content

feat: US-001+US-002 - External companion: snapshot from parsed save + external save path resolution (Domain) - #7

Merged
Varonal merged 2 commits into
mainfrom
ralph/external-companion
Nov 19, 2026
Merged

Varonal merged 2 commits into
mainfrom
ralph/external-companion

Conversation

@Varonal

@Varonal Varonal commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Summary (US-002)

  • New ExternalSavePathResolver in PKForge.Domain/ExternalSavePaths.cs — pure path algebra, zero I/O: existence is checked by the caller via an injected Func<string,bool>, so "no save on disk yet" returns an empty list (companion's no-save mode), never a crash.
  • CandidatePaths(romPath, emulator) → all candidates, most likely first; ExistingPaths(romPath, emulator, fileExists) → only existing ones.
  • Extensible Conventions registry covering RetroArch (sibling .srm/.sav, then RetroArch/saves), melonDS (sibling .sav, then melonDS folders + Android/data/...), Azahar/CitraMmj (sibling .sav + NAND nand/data/<titleid>/save/00000001 when the ROM name carries a 16-hex title id), Dolphin (individual .gci only — never memory cards, consistent with EmulatorSaveHeuristics), plus a default sibling convention (.sav/.srm/.dsv/.bin + main) for DraStic/Linkboy/PizzaBoy/Eden.
  • Null/empty romPath → empty list; paths normalized to / on any host.
  • 12 xunit tests in ExternalSavePathsTests.cs: one per convention, title-id extraction, separator normalization, no-directory ROM, empty-list degradation, registry extensibility.
  • prd.json: US-002 passes: true; progress.txt: appended learnings.

Verification

  • CI (this PR): dotnet test tests/PKForge.Domain.Tests -c Release + dotnet build src/PKForge.App -f net10.0-android.
  • Local: no .NET SDK in this sandbox — static checks (EmulatorKind members, resolver API, usings) passed.
  • Manual on device (in prd.json notes, covered by US-003): companion picks up the real .srm/.sav the external emulator writes.

mistral-vibe and others added 2 commits November 19, 2026 15:39
ExternalSavePathResolver (PKForge.Domain/ExternalSavePaths.cs): pure path
algebra, no I/O — existence is checked by the caller through an injected
Func<string,bool>, so 'no save on disk yet' yields an empty list (the
companion's no-save mode) instead of crashing.

- CandidatePaths(romPath, emulator): all candidates, most likely first.
  Conventions registry (extensible IReadOnlyDictionary) covers RetroArch
  (sibling .srm/.sav, then RetroArch/saves), melonDS (sibling .sav, then
  melonDS folders + Android/data), Azahar/CitraMmj (sibling .sav + NAND
  nand/data/<titleid>/save/00000001 when the ROM name carries a 16-hex title
  id), Dolphin (individual .gci only, never memory cards), and a default
  sibling convention (.sav/.srm/.dsv/.bin + 'main') for the rest.
- ExistingPaths(romPath, emulator, fileExists): only what exists; empty when none.
- Null/empty romPath -> empty list, never throws. Paths normalized to '/'.

12 xunit tests: per-emulator conventions, title-id extraction, separator
normalization, no-directory ROM, empty-list degradation, registry extensibility.

prd.json: US-002 passes=true. progress.txt: appended learnings (pure-path
pattern with injected existence check, Path normalization, GeneratedRegex
partial, emulator save layouts).

Co-authored-by: Varonal <Varonal@users.noreply.github.com>
… the emulator-specific extension is present

Co-authored-by: Varonal <Varonal@users.noreply.github.com>
@Varonal
Varonal merged commit 703324a into main Nov 19, 2026
1 check passed
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.

2 participants