Skip to content

v1.1.0

Choose a tag to compare

@drpetersonfernandes drpetersonfernandes released this 18 Jul 02:44
· 233 commits to main since this release

New: UnitBytes property on ChdFile

ChdFile now exposes UnitBytes — the unit size used for parent block address translation.

Version Source
V5 Read directly from the CHD header (big-endian uint32 at offset 60)
V1-V4 HDD Derived from GDDD metadata: parses BPS (bytes-per-sector) from the "CYLS:%d,HEADS:%d,SECS:%d,BPS:%d" format
V1-V4 CD/GD-ROM Detects CHCD, CHTR, CHT2, CHGT, CHGD metadata tags → returns 2448 (CD frame size: 2352 data + 96 subcode)
V1-V4 fallback Returns HunkBytes (1:1 mapping)

The V1-V4 derivation logic mirrors libchdr's header_guess_unitbytes() exactly.

Usage

ChdFile.Open("game.chd", out var chd);
using (chd)
{
    Console.WriteLine($"HunkBytes: {chd.HunkBytes}");
    Console.WriteLine($"UnitBytes: {chd.UnitBytes}");
    // For a CD-ROM CHD:    HunkBytes=19584, UnitBytes=2448
    // For a hard disk CHD:  HunkBytes=4096,  UnitBytes=512
    // For a raw image CHD:  HunkBytes=4096,  UnitBytes=4096
}

Internal: refactoring

  • CdFrameSize constant visibility changed from private to internal in CHDReaders.cs (needed by ChdFile.GuessUnitBytes())
  • Pattern matching used for metadata tag checks in GuessUnitBytes()

Version

All assemblies bumped from 1.0.0 to 1.1.0. NuGet package CHDSharp version updated to 1.1.0.