aboutsummaryrefslogtreecommitdiff
path: root/brlan.h
blob: bc91159231da009b40c09760f87c83eb064419a4 (plain) (blame)
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
#ifndef BRLAN_H_
#define BRLAN_H_

#include "types.h"

typedef enum
{
    RLPA_ENTRY    = 0,
    RLTS_ENTRY    = 1,
    RLVI_ENTRY    = 2,
    RLVC_ENTRY    = 3,
    RLMC_ENTRY    = 4,
    RLTP_ENTRY    = 5
} brlan_entry_type;

typedef struct
{
    fourcc        magic;            // "pai1" in ASCII.
    u32        size;            // Size of section, which is rest of the file. (header.file_size - header.offset_pai1)
    u16        framesize;        // Framesize
    u8        flags;            // Flags
    u8        unk1;            // Unknown
    u16        num_timgs;        // Number of timgs?
    u16        num_entries;        // Number of tags in the brlan.
    u32        unk2;            // Only if bit 25 of flags is set.
    u32        entry_offset;        // Offset to entries. (Relative to start of pai1 header.)
} brlan_pai1_header_type2;

typedef struct
{
    fourcc        magic;            // "RLAN" in ASCII.
    u32        unk1;            // Always 0xFEFF 0x0008. Possibly a versioning string.
    u32        file_size;        // Size of whole file, including the header.
    u16        pai1_offset;        // The offset to the pai1 header from the start of file.
    u16        pai1_count;        // How many pai1 sections there are (duh, only 1... wtf?)
} brlan_header;

typedef struct
{
    fourcc        magic;            // "pai1" in ASCII.
    u32        size;            // Size of section, which is rest of the file. (header.file_size - header.offset_pai1)
    u16        framesize;        // Framesize
    u8        flags;            // Flags
    u8        unk1;            // Unknown
    u16        num_timgs;        // Number of timgs?
    u16        num_entries;        // Number of tags in the brlan.
} brlan_pai1_universal;

typedef struct
{
    fourcc        magic;            // "pai1" in ASCII.
    u32        size;            // Size of section, which is rest of the file. (header.file_size - header.offset_pai1)
    u16        framesize;        // Framesize
    u8        flags;            // Flags
    u8        unk1;            // Unknown
    u16        num_timgs;        // Number of timgs?
    u16        num_entries;        // Number of tags in the brlan.
    u32        entry_offset;        // Offset to entries. (Relative to start of pai1 header.)
} brlan_pai1_header_type1;

typedef struct
{
    char        name[20];        // Name of the BRLAN entry. (Must be defined in the BRLYT)
    u8          num_tags;
    u8          is_material;    // if 0 it's the name of a pane
    u8          pad[2];
} brlan_entry;

typedef struct
{
    fourcc        magic;
    u8        entry_count;        // How many entries in this chunk.
    u8        pad1;            // All cases I've seen is zero.
    u8        pad2;            // All cases I've seen is zero.
    u8        pad3;            // All cases I've seen is zero.
} tag_header;

typedef struct
{
    u32        offset;            // Offset to the data pointed to by this entry.
                        // Relative to the start of the RLPA header.
} tag_entry;

typedef struct
{
    u16        type;            // Type (look at animtypes)
    u16        unk1;            // Every case has been 0x0200 // 0x0100 for pairs
    u16        coord_count;        // How many coordinates.
    u16        pad1;            // All cases I've seen is zero.
    u32        unk2;            // ??? In every case I've seen, it is 0x0000000C.
} tag_entryinfo;

typedef struct
{                        // Bits not listed here are currently unknown.
    u32        part1;            // If Bit 9 is set in flags, this is an f32, with a coordinate. (Bit 17 seems to act the same)
    u32        part2;            // If Bit 16 is set in flags, this is an f32, with another coordinate. (Bit 17 seems to act the same)
    u32        part3;            // With Bit 16 set in flags, this seems to be yet another coordinate. (Bit 17 seems to act the same)
} tag_data;

typedef struct
{
    u32        part1;
    u16        part2;
    u16        padding;
} tag_data2;


void parse_brlan(char* filename, char *filenameout);
void make_brlan(char* infile, char* outfile);

#endif //BRLAN_H_