Files
sow-tools/internal/erf
archvillainetteandClaude Opus 5 6b7d5ce693
ci / ci (pull_request) Successful in 3m34s
fix(erf): align restype numbers with upstream neverwinter.nim
Five entries in the restype table disagreed with upstream
neverwinter.nim's restype.nim, so HAKs written from those source
extensions were labelled with a type the game reads as something else:

  gff  0x07F7 (2039, upstream bte) -> 0x07F5 (2037)
  ltr  0x0813 (2067, upstream bak) -> 0x07F4 (2036)
  jpg  0x081C (2076, upstream tml) -> 0x0821 (2081)
  dfa                              -> dft (0x07FD/2045 was already right,
                                      only the name was a typo)
  mdb  0x0816 (2070, upstream xbc) -> removed

Upstream registers no restype for mdb, so there is no correct number to
give it; keeping it squatting on xbc silently mislabels the resource.
It is dropped from AssetExtensions too, which turns .mdb into a loud
"unsupported extension" build error instead of a corrupt HAK entry. No
asset in the current corpus uses any of these paths.

Root cause of the miss: the init() consistency guard only panicked when
a number was missing from the reverse map. Its `if canonicalExt == ext
{ continue }` branch did nothing when the two maps disagreed, so a
mismatch was never caught. The guard now panics on disagreement and
also checks the reverse direction.

Adds a conformance test pinning the shared numbers against upstream,
including the four numbers upstream reserves for other extensions, and
a test that the two maps are mutual inverses.

Refs ShadowsOverWestgate/sow-tools#64

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 18:36:03 +02:00
..