Skip to content

Share hash formatting and fixed-width header helpers - #4

Merged
pathawks merged 2 commits into
mainfrom
review-fixes
Jul 5, 2026
Merged

pathawks merged 2 commits into
mainfrom
review-fixes

Conversation

@pathawks

@pathawks pathawks commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a shared Hashes type for CUE/DAT hash calculation and hex formatting
  • keep DAT hash attributes lowercase while preserving uppercase human-facing hash output
  • add shared helpers for fixed-width and null-padded header strings
  • move common Nintendo disc DAT metadata and typed-header parsing into the shared Nintendo disc module

Verification

  • cargo fmt --check
  • cargo test
  • cargo clippy --all-targets --all-features -- -D warnings

pathawks added 2 commits July 5, 2026 12:24
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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::hash module (Hashes, compute_hashes, and hex formatting helpers) and wires it into DAT/CUE/disc output paths.
  • Adds shared string-reading helpers in systems::helpers and 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.

@pathawks
pathawks merged commit 2db2158 into main Jul 5, 2026
1 check passed
@pathawks
pathawks deleted the review-fixes branch July 6, 2026 03:49
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