From 9b0af0bf5c9d5d81830364f02cc01f3b270be483 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Fri, 31 Jul 2026 02:17:09 +0200 Subject: [PATCH] BST hexpat --- docs/imhex/jaudio/bst.hexpat | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 docs/imhex/jaudio/bst.hexpat diff --git a/docs/imhex/jaudio/bst.hexpat b/docs/imhex/jaudio/bst.hexpat new file mode 100644 index 0000000000..07bf28684e --- /dev/null +++ b/docs/imhex/jaudio/bst.hexpat @@ -0,0 +1,71 @@ +#pragma endian big + +#include "std/sys.pat" +#include "type/magic.pat" +#include "std/array.pat" + +/** + * Wrapper for a file-global pointer that allows it to be stored in an array. + */ +struct Offset { + T* offset : u32 [[inline]]; +}; + +struct ItemSoundEffect { + u8 mPriority; + u8 mVolume; + padding[2]; + u32 mSwBit; + float mPitch; +}; + +struct ItemSequence { + u8 mPriority; + u8 mVolume; + u16 mResourceId; +}; + +struct ItemStream { + u8 mPriority; + u8 mVolume; + u16 mStreamPanParameters; + char* mStreamFilePath[] : u32; +}; + +struct SoundTableGroupEntry { + u8 mTypeId; + if (mTypeId == 0x51) { + ItemSoundEffect* mOffset : u24 [[inline]]; + } else if (mTypeId == 0x60) { + ItemSequence* mOffset : u24 [[inline]]; + } else if (mTypeId == 0x70 || mTypeId == 0x71) { + ItemStream* mOffset : u24 [[inline]]; + } else { + u24 mOffset; + } +}; + +struct TGroup { + u32 mNumItems; + padding[4]; + SoundTableGroupEntry mEntries[mNumItems]; +}; + +struct TSection { + u32 mNumGroups; + Offset mGroupOffsets[mNumGroups]; +}; + +struct Root { + u32 mSectionNumber; + Offset mSectionOffsets[mSectionNumber]; +}; + +struct THeader { + type::Magic<"BST "> mMagic; + + padding[8]; + Root* mRoot : u32; +}; + +THeader header @ 0x0; \ No newline at end of file