Skip to content

Instantly share code, notes, and snippets.

@Thealexbarney
Created February 1, 2018 22:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thealexbarney/698664af1aed7122a33f591f96498f30 to your computer and use it in GitHub Desktop.
Save Thealexbarney/698664af1aed7122a33f591f96498f30 to your computer and use it in GitHub Desktop.
010 Editor template for Square Enix MABF files
//------------------------------------------------
//--- 010 Editor v8.0 Binary Template
//
// File: Square Enix MABF
// Authors:
// Version:
// Purpose:
// Category:
// File Mask: *.mab
// ID Bytes: mabf
// History:
//------------------------------------------------
SetBackColor(cLtGray);
uint GetNextMultiple(uint value, uint multiple)
{
return ((value + multiple - 1) / multiple) * multiple;
}
typedef struct
{
char id[4];
uint32 unk04;
int32 offset;
uint32 unk0c;
} Offset;
typedef struct
{
int16 unk00;
int16 Length;
FSkip(0x0c);
float unk[8];
} ModeBody;
struct ModeSection(int count)
{
uchar unk00;
uchar unk01;
int16 headerLength;
int32 unk04;
int32 length;
int32 unk0c;
float unk10;
int32 unk14;
float unk18;
float unk1c;
int32 unk20;
int32 unk24;
int32 unk28;
int32 unk2c;
char id[16];
ModeBody body[count] <optimize=false>;
};
typedef struct
{
local int base = FTell();
int16 unk00;
int16 tableOffset;
int16 entryCount;
FSeek(base + tableOffset);
int32 entriesOffset[entryCount];
} SectionHeader;
typedef struct
{
uchar unk00;
uchar length;
int16 fileHeaderSize;
int16 frameSize;
int16 loopStartFrame;
int16 loopEndFrame;
int16 paddingSamples;
int16 unk0c;
int16 unk0e;
} MtrlEntryHcaHeader;
typedef struct
{
uint16 type_Q;
int16 length;
int32 unk04;
int32 unk08;
int32 unk0a;
} UnknownStruct;
typedef struct
{
int16 unk00;
int16 length;
uchar channelCount;
uchar codec;
int16 entryId;
int32 sampleRate;
int32 loopStart;
int32 loopEnd;
int32 fileHeaderSize;
int32 fileBodySize;
int32 unk1c;
if(codec == 7) {
MtrlEntryHcaHeader hcaHeader;
}
} MtrlEntryHeader;
typedef struct
{
local int base = FTell();
local int i;
uchar unk00;
Printf("%i\n", unk00);
uchar entryId;
int16 nameOffset;
int32 unk04;
int32 unk08;
int32 sampleCount;
int32 loopStart;
int32 loopEnd;
int16 unk18;
int16 unk1a;
int32 unk1c;
uchar codec;
uchar unk21;
uchar entryId2;
uchar unk23;
float unk24;
int32 unk28;
int16 unk2c;
uchar unk2e;
uchar unk2f;
float unk30;
int16 unk34;
uchar unk36;
uchar unk37;
int32 unk38;
int32 unk3c;
FSeek(base + nameOffset);
char name[ReadStringLength(FTell(), 666)];
FSeek(GetNextMultiple(FTell(), 16));
local int structCount = 0;
while(ReadUInt() < 0x1000 && ReadUInt() > 0)
{
int32 structOffsets;
structCount++;
}
for(i = 0; i < structCount; i++)
{
FSeek(base + structOffsets[i]);
UnknownStruct unkStructs;
}
} MuscEntry;
typedef struct
{
local int base = FTell();
local int i;
int16 unk00;
int16 nameOffset;
uchar entryCount;
uchar unk05;
int16 unk06;
int32 archiveId;
int32 unk0c;
int32 unk10;
int32 unk14;
int32 unk18;
int32 unk1c;
int16 unk20;
int16 unk22;
int16 unk24;
int16 unk26;
float unk28;
int16 unk2c;
int16 unk2e;
int32 unk30;
int32 unk34;
int32 unk38;
int32 unk3c;
int32 unk40;
int32 sampleRate;
int32 nameLength;
float unk4c;
FSeek(base + nameOffset);
char name[nameLength];
FSeek(GetNextMultiple(FTell(), 16));
int32 entryOffsets[entryCount];
int32 modeOffset;
for(i = 0; i < entryCount; i++)
{
FSeek(base + entryOffsets[i]);
MuscEntry entry;
}
FSeek(base + modeOffset);
ModeSection modeSection(entryCount);
} MuscHeader;
char magic[4];
ubyte version;
ubyte unk05;
uint16 headerSize;
ubyte unk08;
ubyte descriptorLength;
uint16 unk0A;
uint32 fileSize;
FSeek(headerSize);
char descriptor[descriptorLength];
FSeek(GetNextMultiple(FTell(), 16));
Offset musc;
Offset inst;
Offset mtrl;
FSeek(musc.offset);
SectionHeader muscSection;
FSeek(inst.offset);
SectionHeader instSection;
FSeek(mtrl.offset);
SectionHeader mtrlSection;
local int i;
for(i = 0; i < muscSection.entryCount; i++)
{
FSeek(musc.offset + muscSection.entriesOffset[i]);
MuscHeader muscEntry;
}
for(i = 0; i < mtrlSection.entryCount; i++)
{
FSeek(mtrl.offset + mtrlSection.entriesOffset[i]);
MtrlEntryHeader mtrlEntry;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment