Skip to content

feat: add read-only My Pokemon Ranch extraction - #71

Open
NewBarkTownKris wants to merge 1 commit into
sofianeelhor:devfrom
NewBarkTownKris:feat/ranch-read-only-save-support
Open

NewBarkTownKris wants to merge 1 commit into
sofianeelhor:devfrom
NewBarkTownKris:feat/ranch-read-only-save-support

Conversation

@NewBarkTownKris

Copy link
Copy Markdown

Open original Diamond/Pearl My Pokémon Ranch saves as read-only storage: browse the actual capacity, copy Pokémon to the Bank, and export native RK4 records. The existing generic reader path does not validate Ranch's SHA-1 or safely distinguish this source from writable saves.

Validate the checksum, header, block bounds, object arrays, capacity, and ownership types before invoking the pinned reader. Expose a read-only capability through Domain, enforce it in engine mutations and the safe writer (including restores and risk overrides), and hide source edit/deposit/withdraw actions while keeping copy/export available. Ranch has no party; its last page exposes only real slots. Serialization preserves the original bytes. Other formats keep their existing defaults and write pipeline.

Dolphin discovery recognizes the USA Ranch main savedata.bin, excludes its backup, and handles both title-ID folder layouts and Android document-provider paths. A format-conversion warning explains loss of Ranch ownership metadata. No new navigation screen, dependencies, assets, or submodule changes are introduced.

Scope: original DP-format Ranch, verified with USA saves. The unverified Platinum revision is refused; this PR does not add Ranch write support. Native Bank-copy editing is handled by the separate companion fix, #70; merging that fix first avoids losing Ranch-only metadata when subsequently editing a copied record. Both branches start from dev and merge together cleanly.

Verification:

  • Release Engine tests: 977 passed; Domain tests: 620 passed. Android Debug build completed with zero warnings/errors; Release APK publish also checked locally.
  • Synthetic tests exercise corrupt digests, hostile offsets/counts/owners, partial pages, all session mutation guards, indirect editors, writer/restore refusal without backup or write, native exports, conversion warnings, and Dolphin discovery. Optional private fixtures remain under ignored .local-testdata/ and are not required in CI.
  • Private validation: two USA main saves with 975 and 992 Pokémon, plus their backups; all native records and unchanged source bytes checked. A separate FileBankService save/reopen probe preserved every native record and format tag.
  • AYN Thor, Android 13: combined Diagnostics build installed alongside production; source browsing, partial pages, Bank copy across process restart, and native RK4 Android export checked. Merging this branch with fix: preserve native Ranch records when editing Bank copies #70 reproduces that tested implementation exactly; only the tests were reorganized. Integration with the pending PBR work (feat: add Battle Revolution save support #69) was also checked locally (1,006 Engine and 631 Domain tests passed in the combined test branch).
  • Pokémon Box: Ruby & Sapphire already has a reader. Its USA GCI was verified separately: 830 native PK3 exports, Bank storage/reopen, and first/middle/last pages on the same device. No Box parser change is included here.

Format evidence: existing pinned SAV4Ranch reader and RK4 definition, cross-checked with private original-revision saves and synthetic fixtures. No ROMs, saves, APKs, or private logs are included. Branched from and targeting dev, following the contribution instructions.

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