Repository navigation
Share hash formatting and fixed-width header helpers - #4
Merged
Merged
Conversation
Add a shared Hashes type for CUE and DAT output so CRC32, MD5, SHA1, and SHA256 calculation and hex formatting live in one place. Keep DAT hash attributes lowercase while preserving uppercase human-facing SHA1 output.
Add common helpers for fixed-width and null-padded strings, then reuse them in disc and cartridge header parsers. Move shared Nintendo disc DAT metadata and typed-header parsing into the common Nintendo disc module so Wii and GameCube wrappers stay thinner.
There was a problem hiding this comment.
Pull request overview
This pull request centralizes hash computation/formatting and fixed-width / null-padded header string parsing, then updates multiple systems and output pipelines to use the shared utilities for consistent DAT and human-facing output.
Changes:
- Introduces a shared
output::hashmodule (Hashes,compute_hashes, and hex formatting helpers) and wires it into DAT/CUE/disc output paths. - Adds shared string-reading helpers in
systems::helpersand replaces duplicated fixed-width / null-padded parsing across multiple systems. - Moves Nintendo disc DAT metadata + typed header parsing into the shared Nintendo disc module and updates Wii/GameCube parsing to use typed parsing.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/systems/wii.rs | Switches Wii parsing to typed Nintendo-disc parsing and delegates DAT metadata to the shared header. |
| src/systems/segacd.rs | Replaces local fixed-width string extraction with shared read_fixed_string. |
| src/systems/odyssey2.rs | Uses shared SHA1 formatting helper for consistent display output. |
| src/systems/helpers.rs | Adds shared fixed-width and null-padded string readers used by multiple systems. |
| src/systems/gba.rs | Uses shared null-padded string reader for title parsing. |
| src/systems/gamecube.rs | Switches GameCube parsing to typed Nintendo-disc parsing and delegates DAT metadata to the shared header. |
| src/systems/gameboy.rs | Uses shared null-padded string reader for title parsing. |
| src/systems/fds.rs | Uses shared SHA1 formatting helper for consistent display output. |
| src/systems/disc/sega_ip.rs | Replaces local fixed-width string extraction with shared read_fixed_string. |
| src/systems/disc/pvd.rs | Replaces local fixed-width string extraction with shared read_fixed_string. |
| src/systems/disc/nintendo_disc.rs | Adds typed parsing + shared DAT metadata on NintendoDiscHeader; centralizes title parsing helpers. |
| src/systems/disc/mod.rs | Switches disc SHA1 formatting import to the new output::hash module. |
| src/systems/atari/lynx.rs | Uses shared null-padded string reader for header strings. |
| src/output/mod.rs | Exposes the new output::hash module. |
| src/output/hash.rs | Adds shared hash computation + hex formatting utilities (Hashes, compute_hashes, helpers). |
| src/output/dat.rs | Refactors DAT generation to use shared Hashes and centralizes game metadata detection. |
| src/output/cue.rs | Refactors CUE hashing to use shared Hashes/compute_hashes and shared SHA1 formatting. |
| src/main.rs | Updates CLI output to use Hashes for SHA1 display (and removes now-unneeded import). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hashestype for CUE/DAT hash calculation and hex formattingVerification
cargo fmt --checkcargo testcargo clippy --all-targets --all-features -- -D warnings