-
Notifications
You must be signed in to change notification settings - Fork 0
/
spyro_sfx_musicdetails.bt
75 lines (65 loc) · 2.26 KB
/
spyro_sfx_musicdetails.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
//------------------------------------------------
//--- 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: __musicdetails.sfx
// ID Bytes: 4D 55 53 58
//------------------------------------------------
//*===============================================================================================
//* Typedefs for the sfx file
//*===============================================================================================
typedef char ID[4];
//*===============================================================================================
//* 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 MinHashCode<format=hex>;
uint MaxhashCode<format=hex>;
} HashCodesLimits <read=Str("[/] first: %#10x, last: %#10x", MinHashCode, MaxhashCode)>;
typedef struct
{
uint MusicHashCode <format=hex>;
float DurationInSeconds;
uint MusicLooping;
uint Uservalue;
} MusicData <read=Str("%#010x | %fs looping: %u user: %u", MusicHashCode, DurationInSeconds, MusicLooping, Uservalue)>;
//*===============================================================================================
//* 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;
}
//Read the minimum and maximum hashcode
SetBackColor(cGreen);
HashCodesLimits data;
local int TotalItems = (header.FileSize - 48)/16;
local int index = 0;
SetBackColor(cBlue);
while (!FEof()) /* swy: read entries until we reach the end of the file; we could also potentially check for the last hashcode (i.e. MaxhashCode) */
{
MusicData musData;
}