-
Notifications
You must be signed in to change notification settings - Fork 1
/
sphinx_sfx.bt
69 lines (46 loc) · 2.27 KB
/
sphinx_sfx.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
//--------------------------------------
//--- 010 Editor v6.0.3 Binary Template
//
// File: Sphinx .sfx files
// Author: Swyter
// Revision: 2016-02-29, 2016-03-24
// Purpose: GameCube version (kind of supports PS2 too)
//--------------------------------------
// unlike other Eurocom formats for the
// GCM this one is big endian, wth??
//LittleEndian();
// further info: looks like the format was originally made for l-endian platforms like the PS2, later ported to b-endian platforms like the GCN resulting
// in some fields being flipped, others not, in the case of EDB files even its GEOM magic is reversed in GCN, look like is interpreted as a 32bit number/const.
// NOTE: fields prefixed by xx_ depend on platform endianess. GCN = big-e, PS2 = litle-e.
LittleEndian();
struct
{
char le_magic[4]; // MUSX [4D 55 53 58]
/* same as the filename: _bin_gc/music/hce0002a.sfx => E0002Ah
(HC may stand for something like `hardcoded` or `HW converted`) */
uint le_hash_ref <format=hex>;
uint le_unk_const <format=hex>; // 0xc9000000
uint le_total_size <format=hex>; // confirmed
/* next fields are platform-dependent */
if (ReadUInt() == 0x0800) LittleEndian(); else BigEndian();
uint xx_properties_addr <format=hex>; // 0x0800
uint xx_properties_size <format=hex>; // 0x0130
uint xx_soundbank_addr <format=hex>; // 0x1000
/* size of the soundbank, basically total_size - 1000h bytes,
as the start address of the soundback seems hardcoded at 0x1000 */
uint xx_soundbank_size <format=hex>;
} head;
FSeek(head.xx_properties_addr);
/* always starts at 800h, seems to share format between platforms */
uint unk_coefs[head.xx_properties_size/sizeof(uint)] <format=hex>;
FSeek(head.xx_soundbank_addr);
/* always starts at 1000h */
ubyte soundbank[head.xx_soundbank_size] <format=hex>;
// adpcm coeffs? at 0x800
// data bank? starts always at 0x1000 for some reason
// these files look empty, interesting:
// /home/swyter/github/sphinxtools/x:/sphinx/binary/_bin_gc/music/hce00029.sfx
// /home/swyter/github/sphinxtools/x:/sphinx/binary/_bin_gc/music/hce0002a.sfx
// for comparison:
// /home/swyter/github/sphinxtools/x:/sphinx/binary/_bin_gc/music/hce00000.sfx
// /home/swyter/github/sphinxtools/x:/sphinx/binary/_bin_ps2/music/hce00000.sfx