NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_respltt.h
1#ifndef NW4R_G3D_RES_RES_PLTT_H
2#define NW4R_G3D_RES_RES_PLTT_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/res/g3d_rescommon.h>
6
7#include <revolution/GX.h>
8
9namespace nw4r {
10namespace g3d {
11
13 ResBlockHeaderData header; // at 0x0
14 ulong revision; // at 0x8
15 s32 toResFileData; // at 0xC
16 s32 toPlttData; // at 0x10
17 s32 name; // at 0x14
18 GXTlutFmt fmt; // at 0x18
19 u16 numEntries; // at 0x1C
20 u16 PADDING_0x1E; // at 0x1E
21 s32 original_path; // at 0x20
22 s32 toResUserData; // at 0x24
23};
24
25class ResPltt : public ResCommon<ResPlttData> {
26public:
27 static const ulong SIGNATURE = 'PLT0';
28 static const int REVISION = 1;
29
30public:
31 NW4R_G3D_RESOURCE_FUNC_DEF(ResPltt);
32
33 void Init() {
34 DCStore(false);
35 }
36
37 ulong GetRevision() const {
38 return ref().revision;
39 }
40
41 bool CheckRevision() const {
42 return GetRevision() == REVISION;
43 }
44
45 void DCStore(bool sync);
46
47 u16* GetPlttData() {
48 ResPlttData& r = ref();
49
50 // clang-format off
51 return r.toPlttData != 0
52 ? reinterpret_cast<u16*>(reinterpret_cast<u8*>(&r) + r.toPlttData)
53 : NULL;
54 // clang-format on
55 }
56
57 const u16* GetPlttData() const {
58 const ResPlttData& r = ref();
59
60 // clang-format off
61 return r.toPlttData != 0
62 ? reinterpret_cast<const u16*>(reinterpret_cast<const u8*>(&r) + r.toPlttData)
63 : NULL;
64 // clang-format on
65 }
66
67 GXTlutFmt GetFmt() const {
68 return ref().fmt;
69 }
70
71 ulong GetNumEntries() const {
72 return ref().numEntries;
73 }
74};
75
76} // namespace g3d
77} // namespace nw4r
78
79#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10