Recover misaligned ADAT stream tables when forward scan misses streams #57

Manually merged
github merged 1 commit from gh-pr/57/head into gh-pr/57/base 2026-11-27 02:33:12 +00:00
Owner

@⁠worstgirlinamerica on GitHub · 2026-11-24 01:10 UTC · original
worstgirlinamerica:fix/awc-503-stream-table → main · +98 −10 · 1 files · 1 commits · merged 2026-11-24 11:05 UTC

Fixes #48

Summary

The ADAT parser kept a forward table candidate whenever it found any plausible 0x55 chunks, even when that count disagreed with the header's declared stream count. In sound_5186_Resident_Frontend__Hud_503st.awc, the u32 candidate found 8 bogus entries for a 503-stream bank, so the existing backward recovery did not run. PercyStar showed 8 streams at an implausible 16,174 Hz instead of the 503 real 48 kHz streams.

Changes

  • Run the existing bounded backward table scan when a nonempty forward result disagrees with the declared stream count
  • Replace the selected candidate only when backward recovery finds exactly the declared number of bounded 0x55 chunks
  • Pair recovered 0x76 sample rates with their corresponding 0x55 data chunks
  • Add a synthetic regression test for eight false forward entries and a late 503-entry table; no game audio is included

Testing

  • Issue #48 sample: 8 streams before -> 503 playable streams after; all 48 kHz, 462 mono and 41 stereo

  • Archive-wide screen: 41 count-mismatch candidates; 40 decoded all declared streams (5,656 tracks) with no decoder errors; one 9-stream candidate had only 3 playable streams after recovery and remains unexplained. Its previous forward candidate also failed to decode

  • PercyStar carver-to-player path on the issue sample, sound_5186_Resident_Frontend__Hud_503st.awc, returned 503 tracks

  • sound_4183_2st.awc: unchanged at 1 stereo stream, 48 kHz, 200.04 s

  • sound_4659_271st.awc: unchanged at 271 mono streams, 48 kHz

  • Full test suite: 121 passed, 0 failed, 5 ignored

**@⁠worstgirlinamerica** on GitHub · 2026-11-24 01:10 UTC · [original](https://github.com/rpatty-dev/PercyStar/pull/57) `worstgirlinamerica:fix/awc-503-stream-table` → `main` · +98 −10 · 1 files · 1 commits · merged 2026-11-24 11:05 UTC Fixes #48 ## Summary The ADAT parser kept a forward table candidate whenever it found any plausible `0x55` chunks, even when that count disagreed with the header's declared stream count. In `sound_5186_Resident_Frontend__Hud_503st.awc`, the u32 candidate found 8 bogus entries for a 503-stream bank, so the existing backward recovery did not run. PercyStar showed 8 streams at an implausible 16,174 Hz instead of the 503 real 48 kHz streams. ## Changes - Run the existing bounded backward table scan when a nonempty forward result disagrees with the declared stream count - Replace the selected candidate only when backward recovery finds exactly the declared number of bounded `0x55` chunks - Pair recovered `0x76` sample rates with their corresponding `0x55` data chunks - Add a synthetic regression test for eight false forward entries and a late 503-entry table; no game audio is included ## Testing - Issue #48 sample: 8 streams before -> 503 playable streams after; all 48 kHz, 462 mono and 41 stereo - Archive-wide screen: 41 count-mismatch candidates; 40 decoded all declared streams (5,656 tracks) with no decoder errors; one 9-stream candidate had only 3 playable streams after recovery and remains unexplained. Its previous forward candidate also failed to decode - PercyStar carver-to-player path on the issue sample, ```sound_5186_Resident_Frontend__Hud_503st.awc```, returned 503 tracks - `sound_4183_2st.awc`: unchanged at 1 stereo stream, 48 kHz, 200.04 s - `sound_4659_271st.awc`: unchanged at 271 mono streams, 48 kHz - Full test suite: 121 passed, 0 failed, 5 ignored
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 02:33:10 +00:00
github manually merged commit 07cfa2e41f into gh-pr/57/base 2026-11-27 02:33:12 +00:00
Author
Owner

@⁠rpatty-dev on GitHub · 2026-11-24 11:15 UTC · original

merged this one thank you so much for fixing the adat tables really appreciate it

**@⁠rpatty-dev** on GitHub · 2026-11-24 11:15 UTC · [original](https://github.com/rpatty-dev/PercyStar/pull/57#issuecomment-7129855543) merged this one thank you so much for fixing the adat tables really appreciate it
This discussion has been locked. Commenting is limited to contributors.
No description provided.