Support older WLD3 "v200" container header - #3
Open
BaesTheorem wants to merge 1 commit into
Open
Conversation
WTDecoder.decode() only accepted the v300 header line (`WLD3.wav WildTangent 3D 300 Compressed and Patented`). Older WildTangent assets ship a v200 header (`WLD3 WildTangent 3D 200 Compressed and Patented`) which differs in two ways: a leading space instead of `.wav` (no explicit type tag), and version "200" instead of "300". The payload encryption, CAB, and MSZIP steps are identical between the two versions; only the header line differs. This change replaces the single-version header check with one that accepts both, defaulting the base type to "wav" for the v200 sound containers (their payloads are wav/media), and leaving v300 parsing untouched. Adds two small v200 sample_files fixtures and a subprocess smoke test that decodes them and asserts a valid RIFF/WAVE payload. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Support older WLD3 "v200" container header
What
WTDecoder.decode()inpywttools/wtextract.pyonly accepts the v300 header line:Older WildTangent assets use a v200 header:
Two differences: a leading space after the
WLD3magic instead of.wav(there is no explicit type tag), and version200instead of300. On a v200 file the current code fails at the magic-line check and exits withFile does not have correct Magic Line.Why it's safe
The payload encryption, CAB packaging, and MSZIP steps are identical between v200 and v300. Only the one header line differs. This PR replaces the single-version header check with one that accepts both versions, defaulting
base_typeto"wav"for the v200 sound containers (their payloads are wav/media, and the header carries no type tag to parse). v300 parsing is left byte-for-byte unchanged.The code change is minimal:
Evidence
Validated on 6 real v200
sound.wwvfiles.Before (upstream) on a v200 file:
After (patched), all 6 decode to valid RIFF/WAVE:
The existing v300 sample (
sample_files/test.wwv) still decodes to a 381004 B RIFF/WAVE with the patch applied, so there is no regression.Fixtures & test
Added the two smallest v200 samples as fixtures under
sample_files/(where the repo already keeps samples):sample_files/test_v200_whistle.wwv(~8.5 KB)sample_files/test_v200_hum.wwv(~9 KB)and
pywttools/test_wtextract_v200.py, a stdlib-unittestsmoke test (no third-party runner) that decodes both fixtures via the CLI and asserts aRIFF/WAVEpayload. Run it with:The remaining four validated files (EXPLOSION2, LAUNCH_CANNON, OCEAN, SPLASH) were left out to avoid bloating the PR.
Provenance
The fixtures are extracted from WildTangent "Cannonballs" (2002), a game distributed as free abandonware. They contain only game sound effects (a whistle and a hum), no personal or copyrighted-music data.
🤖 Generated with Claude Code