-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspyro_sfx_projectdetails.bt
126 lines (108 loc) · 3.4 KB
/
spyro_sfx_projectdetails.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
// File: SpyroProjectDetails.bt
// Authors: jmarti856, Swyter
// Version: 1.0
// Purpose: Parse Temporal SFX files.
// Category: Audio
// File Mask: __projectdetails.sfx
// ID Bytes: 4D 55 53 58
//------------------------------------------------
//*===============================================================================================
//* Typedefs for the sfx file
//*===============================================================================================
typedef char ID[4];
typedef char Padding[2];
//*===============================================================================================
//* DEFINE STRUCTS USED IN THE SFX FILE
//*===============================================================================================
//The first parameters of the header ara always little endian
LittleEndian();
typedef struct
{
ID Magic;
uint Hashcode <format=hex>;
uint FileVersion;
uint FileSize <format=hex>;
ID Platform;
uint TimeStamp;
uint unk;
uint structPadding;
} CommonHeader;
typedef struct
{
uint MemoryStart <format=hex>;
uint MemoryLength;
} SpecificFileHeader <read=Str("memstart: %#x total_len: %#x", MemoryStart, MemoryLength)>;
typedef struct
{
uint MemSlotsCount;
uint MemSlotsOffset;
uint SoundBanksCount;
uint SoundBanksOffset;
} DataOffsets <read=Str("memslots: %u at +%#x, soundbanks: %u at +%#x", MemSlotsCount, MemSlotsOffset, SoundBanksCount, SoundBanksOffset)>;
typedef struct
{
uint SlotNumber;
uint MemorySize;
uint Quantity;
} MemorySlots <read=Str("slot %u | size: %4u, quant: %u", SlotNumber, MemorySize, Quantity)>;
typedef struct
{
uint HashCode;
uint SlotNum;
} SoundbankSlot <read=Str("%#010x | slot: %u", HashCode, SlotNum)>;
typedef struct
{
uint StereoStreamCount;
uint MonoStreamCount;
uint ProjectCode;
int Flags[10];
} ProjectFlags;
//*===============================================================================================
//* READ FILE
//*===============================================================================================
// Define the headers
SetBackColor(cLtPurple);
CommonHeader header;
// Check for valid header
if(header.Magic != "MUSX")
{
Warning( "File is not a valid SFX file. Template stopped." );
return -1;
}
if (header.Platform[0] == 'G' && header.Platform[1] == 'C') /* For GC */
{
Printf("[i] This is a GameCube SFX. Changing endianness to big-endian.");
BigEndian();
}
// Read Soundbanks Header
SetBackColor(cGreen);
SpecificFileHeader specHeader;
//Go to MemoryStart pos
if (FSeek(specHeader.MemoryStart) < 0)
{
Warning( "Error searching the SFX start position");
return -1;
}
//Get Offsets
DataOffsets posOffsets; SetBackColor(cNone); ubyte pad[16];
//Get Flags Count
SetBackColor(cDkRed); ProjectFlags data_maybe; /* swy: these must be wrong, they overlay with the memory slot data that comes afterwards */
//Get Memory Slots
FSeek(specHeader.MemoryStart + posOffsets.MemSlotsOffset); SetBackColor(cBlue);
local int index = 0;
for (index = 0; index < posOffsets.MemSlotsCount; index++)
{
SetBackColor(cLtRed);
MemorySlots memSlots;
}
//Get SoundBanks Slots
FSeek(specHeader.MemoryStart + posOffsets.SoundBanksOffset);
index = 0;
for (index = 0; index < posOffsets.SoundBanksCount; index++)
{
SetBackColor(cAqua);
SoundbankSlot soundBank;
}