aboutsummaryrefslogtreecommitdiff
path: root/brlyt.h
blob: 98a8b77b31fc05e84be9bbc14cf0e7ad85dd511d (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
 *  brlyt.h
 *
 *
 *  Created by Alex Marshall on 09/01/27.
 *  Updated by Stephen Simpson on 09/03/11.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef BRLYT_H_
#define BRLYT_H_

#include "types.h"

typedef struct
{
    fourcc        magic;            // RLYT
    u32        unk1;            // 0xFEFF0008
    u32        filesize;        // The filesize of the brlyt.
    u16        lyt_offset;        // Offset to the lyt1 section.
    u16        unk2;            // Number of sections.
} brlyt_header;

typedef struct
{
    fourcc        magic;            // The magic.
    u32        length;            // How long the entry is.
} brlyt_entry_header;

typedef struct
{
    fourcc        magic;            // The magic.
    u32        length;            // How long the entry is.
    u32        data_location;        // The location of the data in the BRLYT file.
} brlyt_entry;

typedef struct
{
    unsigned char flag1;
    unsigned char flag2;
    unsigned char alpha;
    unsigned char alpha2;
    char name[24];
    float x;
    float y;
    float z;
    float flip_x;
    float flip_y;
    float angle;
    float xmag;
    float ymag;
    float width;
    float height;
} brlyt_pane_chunk;

typedef struct
{
    u16 len1;
    u16 len2;
    u16 mat_off;
    u16 font_idx;
    u8 unk4;
    u8 pad[3];    // [0, 0, 0]
    u32 name_offs;
    u32 color1;
    u32 color2;
    float font_size_x;
    float font_size_y;
    float char_space;
    float line_space;
} brlyt_text_chunk;

typedef struct
{
    u32 vtx_colors[4];    // [4294967295L, 4294967295L, 4294967295L, 4294967295L]
    u16 mat_off;
    u8 num_texcoords;
    u8 padding;        // 0
} brlyt_pic_chunk;

typedef struct				//0001-0004
{
	u32 unk1[4];		// all 0x00000000
	u8 unk2[4];		// 0x01 0x00 0x00 0x00
	u32 unk3;		// 0x00000068
	u32 unk4;		// 0x0000009c
	u32 unk5[4];		// all 0xffffffff
	u16 unk6[6];		// 0x00 0x0100 0x00 0x00 0x00 0x00
	float unk7[6];		// 3f800000 0x00 0x00 3f800000 3f800000 3f800000
	u16 unk8[4];		// 0x0000 0x0
} brlyt_wnd_addon;

/*
typedef struct			// 0003-0004
{
	u32 unk1[4];		// all 0x00000000
	u8 unk2[4];		// 0x01 0x00 0x00 0x00
	u32 unk3;		// 0x00000068
	u32 unk4;		// 0x0000009c
	u32 unk5[4];		// all 0xffffffff
	u16 unk6[6];		// 0x00 0x0100 0x00 0x00 0x00 0x00
	float unk7[6];		// 3f800000 0x00 0x00 3f800000 3f800000 3f800000
	u16 unk8[4];		// 0x0000 0x00a0 0x0001 0x0000
}
*/

typedef struct
{
    char a;
    char pad[3];
    float width;
    float height;
} brlyt_lytheader_chunk;

typedef struct
{
    char name[16];
    u16 numsubs;
    u16 unk;
} brlyt_group_chunk;

typedef struct
{
    u16 num;
    u16 offs;
} brlyt_numoffs_chunk;

typedef struct
{
    char name[20];
    s16 tev_color[4];
    s16 unk_color[4];
    s16 unk_color_2[4];
    u32 tev_kcolor[4];
    u32 flags;
} brlyt_material_chunk;

typedef struct
{
    int offset;
    int unk;
} brlyt_offsunk_chunk;

typedef struct
{
    u16 tex_offs;
    u8 wrap_s;
    u8 wrap_t;
} brlyt_texref_chunk;

typedef struct
{
    float unk[5];
} brlyt_ua2_chunk;

typedef struct
{
    u8 unk[4];
} brlyt_4b_chunk;

typedef struct
{
    u32 a;
    u32 b;
    float c;
    float d;  // found to be floating point  * 04/22 *
    float e;  // found to be floating point  * 04/22 *
} brlyt_ua7_chunk;

typedef struct
{
    u8 unk[16];
} brlyt_10b_chunk;

void swapBytes(unsigned char* char1, unsigned char* char2);
int bitExtraction(unsigned int num, unsigned int start, unsigned int end);

void parse_brlyt(char *filename);
void make_brlyt(char* infile, char* outfile);

#endif //BRLYT_H_