blob: 36db669ccb5e880a4be7a5ccab3a793752d2a13d (
plain)
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
|
#ifndef __NEWER_LEVELINFO_H
#define __NEWER_LEVELINFO_H
#include <common.h>
class LevelInfo {
public:
struct Header {
u32 magic;
u32 sectionCount;
u32 sectionOffsets[1];
};
struct Section {
u32 levelCount;
};
struct Entry {
u8 world;
u8 level;
u8 reserved1;
u8 reserved2;
u8 nameLength;
u8 reserved3;
u16 flags;
u32 nameOffset;
};
private:
Header *data;
public:
void load(void *buffer);
Entry *search(int world, int level);
u32 sectionCount() {
return data->sectionCount;
}
Section *getSectionByIndex(u32 index) {
return (Section*)(((char*)data) + data->sectionOffsets[index]);
}
Entry *getLevelsForSection(Section *section) {
return (Entry*)(section + 1);
}
char *getNameForLevel(Entry *entry) {
return (char*)data + entry->nameOffset;
}
};
#endif
|