NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
lyt_resources.h
1#ifndef NW4R_LYT_RESOURCES_H
2#define NW4R_LYT_RESOURCES_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/lyt/lyt_types.h>
6
7namespace nw4r {
8namespace lyt {
9namespace res {
10
11/******************************************************************************
12 *
13 * BinaryFileHeader
14 *
15 ******************************************************************************/
17 char signature[4]; // at 0x0
18 u16 byteOrder; // at 0x4
19 u16 version; // at 0x6
20 ulong fileSize; // at 0x8
21 u16 headerSize; // at 0xC
22 u16 dataBlocks; // at 0xE
23};
24
25/******************************************************************************
26 *
27 * DataBlockHeader
28 *
29 ******************************************************************************/
31 char kind[4]; // at 0x0
32 ulong size; // at 0x4
33};
34
35/******************************************************************************
36 *
37 * Texture
38 *
39 ******************************************************************************/
40struct Texture {
41 ulong nameStrOffset; // at 0x0
42 u8 type; // at 0x4
43 u8 PADDING_0x5[0x8 - 0x5]; // at 0x5
44};
45/******************************************************************************
46 *
47 * TextureList
48 *
49 ******************************************************************************/
51 res::DataBlockHeader blockHeader; // at 0x0
52 u16 texNum; // at 0x8
53 u8 PADDING_0xA[0xC - 0xA]; // at 0xA
54};
55
56/******************************************************************************
57 *
58 * Font
59 *
60 ******************************************************************************/
61struct Font {
62 ulong nameStrOffset; // at 0x0
63 u8 type; // at 0x4
64 u8 PADDING_0x5[0x8 - 0x5]; // at 0x5
65};
66/******************************************************************************
67 *
68 * FontList
69 *
70 ******************************************************************************/
71struct FontList {
72 res::DataBlockHeader blockHeader; // at 0x0
73 u16 fontNum; // at 0x8
74 u8 PADDING_0xA[0xC - 0xA]; // at 0xA
75};
76
77/******************************************************************************
78 *
79 * MaterialList
80 *
81 ******************************************************************************/
83 res::DataBlockHeader blockHeader; // at 0x0
84 u16 materialNum; // at 0x8
85 u8 PADDING_0xA[0xC - 0xA]; // at 0xA
86};
87
88/******************************************************************************
89 *
90 * TexMap
91 *
92 ******************************************************************************/
93struct TexMap {
94 u16 texIdx; // at 0x0
95 u8 wrapS; // at 0x2
96 u8 wrapT; // at 0x3
97};
98
99} // namespace res
100
101/******************************************************************************
102 *
103 * ResBlockSet
104 *
105 ******************************************************************************/
107 const res::TextureList* pTextureList; // at 0x0
108 const res::FontList* pFontList; // at 0x4
109 const res::MaterialList* pMaterialList; // at 0x8
110 ResourceAccessor* pResAccessor; // at 0xC
111};
112
113/******************************************************************************
114 *
115 * MaterialResourceNum
116 *
117 ******************************************************************************/
119 ulong bits;
120
121 u8 GetTexMapNum() const {
122 return detail::GetBits(bits, 0, 4);
123 }
124 u8 GetTexSRTNum() const {
125 return detail::GetBits(bits, 4, 4);
126 }
127 u8 GetTexCoordGenNum() const {
128 return detail::GetBits(bits, 8, 4);
129 }
130 bool HasTevSwapTable() const {
131 return detail::TestBit(bits, 12);
132 }
133 u8 GetIndTexSRTNum() const {
134 return detail::GetBits(bits, 13, 2);
135 }
136 u8 GetIndTexStageNum() const {
137 return detail::GetBits(bits, 15, 3);
138 }
139 u8 GetTevStageNum() const {
140 return detail::GetBits(bits, 18, 5);
141 }
142 bool HasAlphaCompare() const {
143 return detail::TestBit(bits, 23);
144 }
145 bool HasBlendMode() const {
146 return detail::TestBit(bits, 24);
147 }
148 u8 GetChanCtrlNum() const {
149 return detail::GetBits(bits, 25, 1);
150 }
151 u8 GetMatColNum() const {
152 return detail::GetBits(bits, 27, 1);
153 }
154};
155
156} // namespace lyt
157} // namespace nw4r
158
159#endif
2D graphics drawing library.