-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcore_clu.bt
49 lines (44 loc) · 1.17 KB
/
core_clu.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
// Template created by Mark "hogsy" Sowden <[email protected]>
/* Core Design, CLU (cluster) format
*
* Usages:
* - Herdy Gerdy (2002, PS2)
*
* Notes:
* Levels use the original level name as the description,
* while the stored file uses a hashed name instead, hence
* why the CLU names for levels appear somewhat random.
*
* Table of contents is sorted by hash, hence why the last
* 32-bit value increments (was pretty confusing at first!)
* This is also why the table of contents doesn't match with
* the order of the data.
*/
struct CLUHeader
{
uint32_t magic; /* 'CLU\0' */
uint32_t version; /* always appears to be 2 - changed to 1 in later version */
uint32_t headerLength;
uint32_t numIndices;
uint32_t hash;
uint32_t unused;
char description[ 60 ];
};
struct CLUIndex
{
uint32_t nameOffset; /* always resolves to 4 bytes before data, because it's unused */
uint32_t size;
uint32_t offset;
uint32_t hash;
};
/* hashing...
uint32_t hash = 0;
char c;
while ( ( c = *string ) != '\0' ) {
hash += ( hash << 7 ) + ( hash << 1 ) + ( uint32_t ) c;
string++;
}
return hash;
*/
struct CLUHeader header;
struct CLUIndex indices[ header.numIndices ];