BST hexpat

This commit is contained in:
PJB3005
2026-07-31 02:17:09 +02:00
parent 5cf52b8240
commit 9b0af0bf5c
+71
View File
@@ -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> {
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<TGroup> mGroupOffsets[mNumGroups];
};
struct Root {
u32 mSectionNumber;
Offset<TSection> mSectionOffsets[mSectionNumber];
};
struct THeader {
type::Magic<"BST "> mMagic;
padding[8];
Root* mRoot : u32;
};
THeader header @ 0x0;