[rom] Fix writing AUDI data

The length of the audio chunk was incorrect and did not include the
format bytes.  This was also the source of the "garbage four bytes"
that were being chopped off before.
This commit is contained in:
Zorchenhimer 2025-11-16 17:38:41 -05:00
parent 2b9bc6f09f
commit 6831274a25
Signed by: Zorchenhimer
GPG Key ID: 70A1AB767AAB9C20
1 changed files with 4 additions and 3 deletions

View File

@ -56,7 +56,9 @@ func (sb *StudyBox) rawBytes() ([]byte, error) {
return nil, err return nil, err
} }
err = binary.Write(buffer, binary.LittleEndian, uint32(len(sb.Audio.Data))) // This length is the full size of the chunk, including the format from the
// switch below.
err = binary.Write(buffer, binary.LittleEndian, uint32(len(sb.Audio.Data)+4))
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -81,8 +83,7 @@ func (sb *StudyBox) rawBytes() ([]byte, error) {
return nil, err return nil, err
} }
// For some reason there's 4 extra bytes. no idea why. chomp them off. _, err = buffer.Write(sb.Audio.Data[0 : uint32(len(sb.Audio.Data))])
_, err = buffer.Write(sb.Audio.Data[0 : uint32(len(sb.Audio.Data))-4])
if err != nil { if err != nil {
return nil, err return nil, err
} }