tooling: read 0xFA sound format tags in AWC sound-effect banks #780

Merged
legacy-code-archaeologist merged 1 commit from upstream-pr/786 into main 2026-11-23 03:47:08 +00:00
legacy-code-archaeologist commented 2026-11-23 03:18:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-23T03:18:15Z.


Change

tools/awc_metadata.py now accepts either a 0x76 or a 0xFA sound format tag per sound in a sound-effect bank. Before, it rejected any bank that used 0xFA. Both tags are read as in the public reader's 0x76 and 0xFA cases (vgmstream awc.c @ 24ffd6ce, lines 488–527):

  • sample count at offset 0 and sample rate at offset 8;
  • codec ID at offset 28 (0x76) or 19 (0xFA);
  • 32 or 20 bytes read.

A sound must have exactly one format tag. A sound with 0x76 plus 0xFA, or with two 0xFA tags, is now rejected. Before this change, 0xFA was ignored, so a sound with 0x76 plus 0xFA was accepted. The public reader keeps the last format tag of a sound in that case. Music banks are unaffected.

Builds on #583 (same file). Opened after it landed.

Verification

At 7dd70a2 on Windows 11 (build 26100.9168), Python 3.12.10:

  • out\pe-env\Scripts\python.exe -B tests\awc_metadata_check.py -v: 12 tests OK.
    • The new test_fa_format_tags reads a two-sound bank with one 0xFA and one 0x76 tag through a metadata-only read guard.
    • It holds a decoy byte at the 0x76 codec offset of the 0xFA tag, so reading 0xFA like 0x76 is detected.
    • It has three negative controls: a truncated 0xFA tag, 0x76 plus 0xFA on one sound, and two 0xFA tags on one sound.
  • The new test fails against the previous version of the tool.
  • These mutations are each detected: the 0xFA codec offset, the 0xFA minimum length, and accepting more than one format tag.
  • tests/docs_links_check.py and tests/bidi_controls_check.py: passed.

Evidence and follow-up

The fixture is synthetic bytes built in the test (MIT, this repository). No local bank with 0xFA tags was inspected.

  • Updated: docs/experiments.md#awc-sound-effect-format-metadata
  • Reproduce: ctest --preset dev --no-tests=error -R '^audio_awc_metadata$' -V

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: written with Claude Code, precommit review by a fresh agent; checked and submitted by the account owner.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6551539910 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/786). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-23T03:18:15Z. --- ## Change `tools/awc_metadata.py` now accepts either a `0x76` or a `0xFA` sound format tag per sound in a sound-effect bank. Before, it rejected any bank that used `0xFA`. Both tags are read as in the public reader's `0x76` and `0xFA` cases (vgmstream `awc.c` @ `24ffd6ce`, lines 488–527): - sample count at offset 0 and sample rate at offset 8; - codec ID at offset 28 (`0x76`) or 19 (`0xFA`); - 32 or 20 bytes read. A sound must have exactly one format tag. A sound with `0x76` plus `0xFA`, or with two `0xFA` tags, is now rejected. Before this change, `0xFA` was ignored, so a sound with `0x76` plus `0xFA` was accepted. The public reader keeps the last format tag of a sound in that case. Music banks are unaffected. Builds on #583 (same file). Opened after it landed. ## Verification At `7dd70a2` on Windows 11 (build 26100.9168), Python 3.12.10: - `out\pe-env\Scripts\python.exe -B tests\awc_metadata_check.py -v`: 12 tests OK. - The new `test_fa_format_tags` reads a two-sound bank with one `0xFA` and one `0x76` tag through a metadata-only read guard. - It holds a decoy byte at the `0x76` codec offset of the `0xFA` tag, so reading `0xFA` like `0x76` is detected. - It has three negative controls: a truncated `0xFA` tag, `0x76` plus `0xFA` on one sound, and two `0xFA` tags on one sound. - The new test fails against the previous version of the tool. - These mutations are each detected: the `0xFA` codec offset, the `0xFA` minimum length, and accepting more than one format tag. - `tests/docs_links_check.py` and `tests/bidi_controls_check.py`: passed. ## Evidence and follow-up The fixture is synthetic bytes built in the test (MIT, this repository). No local bank with `0xFA` tags was inspected. - Updated: `docs/experiments.md#awc-sound-effect-format-metadata` - Reproduce: `ctest --preset dev --no-tests=error -R '^audio_awc_metadata$' -V` ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: written with Claude Code, precommit review by a fresh agent; checked and submitted by the account owner. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:44:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!780
No description provided.