[Audio] ADAT with u16 stream table decodes only 8 bogus streams instead of 503 #37
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/rpatty-dev--PercyStar#37
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@crexlight on GitHub · 2026-11-22 12:42 UTC · original
PercyStar mis-parses some GTA6 ADAT (.awc) payloads that use a u16 stream table instead of the assumed u32 stream table.
For example this ADAT:
audio.rpf/sound_5186_Resident_Frontend__Hud_503st.awcshows only 8 streams (they play garbage instead of proper sound), but it is actually 503 streams there.Possible root cause
parse_adat_header()computes the chunk-table start as:let mut off = 16 + sc * 4;This assumes the stream table contains
sc u32entries. For this bank the stream table isu16[sc], so the chunk table starts at a different 8-byte alignment. PercyStar scans the wrong alignment, happens to find 8 fake 0x55 entries, and therefore skips the backward fallback that would have found the real 503 chunks.@rpatty-dev on GitHub · 2026-11-22 14:33 UTC · original
Fixed in
main(6ca2efe)!parse_adat_header()insrc/awc.rsnow evaluates candidate chunk-table offsets (16 + sc * 4foru32stream tables,16 + sc * 2and 8-byte aligned(16 + sc * 2 + 7) & !7foru16stream tables, plus backward fallback fromhdr_sz), scoring each candidate by valid0x55chunks (sz > 0,coff >= hdr_sz,coff < data.len()),scmatch, and minimal bogus tag hits.Added unit test
awc::tests::adat_u16_stream_table_parses_all_streams(66/66tests passing).