Skip to content

feat: allow applying patches on hash mismatch with explicit override#32

Merged
GregTheGreek merged 2 commits into
mainfrom
feat/apply-hash-mismatch-override
Jul 6, 2026
Merged

feat: allow applying patches on hash mismatch with explicit override#32
GregTheGreek merged 2 commits into
mainfrom
feat/apply-hash-mismatch-override

Conversation

@GregTheGreek

Copy link
Copy Markdown
Owner

Summary

Hash mismatches (patch-embedded CRC32/MD5 checks and --verify-* specs) no longer dead-end an apply: the CLI accepts --force (and hints at it on failure), and the GUI asks for confirmation with an "Apply anyway" dialog before retrying with the override. Bypassed checks surface as warnings (stderr / warning toast); structural checks (sizes, offsets, encoding) still fail hard.

Notable details:

  • RUP patches with no MD5-matching file scope fall back to the first scope in lenient mode.
  • A RUP single-file patch with a non-matching ROM now errors NoMatchingFile instead of Truncated (top-level EOF now treated as end of scopes).
  • ApplyOptions.ignore_hash_mismatch uses serde(default), so stored library records and older frontends stay compatible.

Test plan

  • cargo test --workspace --all-targets --exclude rompatch-gui (new lenient tests for BPS/UPS/RUP + apply pipeline)
  • cargo fmt / cargo clippy (workspace and GUI) clean
  • UI tsc --noEmit + vite build clean
  • Manual CLI run: wrong ROM fails with hint; --force applies with warnings and correct output bytes
  • Manual GUI run: mismatch dialog -> Apply anyway -> warning toast

Hash checks (BPS/UPS CRC32s, RUP MD5s, APS-N64 cart id/CRC, PMSR CRC,
and --verify-* specs) can now be downgraded to warnings instead of
aborting the apply. The override must be explicit: the CLI requires
--force (and hints at it when a mismatch aborts), and the GUI shows a
confirmation dialog offering "Apply anyway" before retrying.

Structural checks (sizes, offsets, encoding) still fail hard. RUP
patches whose source MD5 matches no file scope fall back to the first
scope in lenient mode. Bypassed mismatches are reported via
ApplyOutcome::hash_warnings, printed by the CLI, and surfaced as a
warning toast in the GUI.

Co-Authored-By: Claude
@GregTheGreek
GregTheGreek marked this pull request as ready for review July 6, 2026 13:15
@GregTheGreek
GregTheGreek merged commit 3121db4 into main Jul 6, 2026
7 checks passed
@GregTheGreek
GregTheGreek deleted the feat/apply-hash-mismatch-override branch July 6, 2026 13:17
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