NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
ut_ResFontBase.h
1#ifndef NW4R_UT_RES_FONT_BASE_H
2#define NW4R_UT_RES_FONT_BASE_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/ut/ut_Font.h>
6
7namespace nw4r {
8namespace ut {
9
10enum FontMapMethod {
11 FONT_MAPMETHOD_DIRECT,
12 FONT_MAPMETHOD_TABLE,
13 FONT_MAPMETHOD_SCAN
14};
15
17 u8 cellWidth; // at 0x0
18 u8 cellHeight; // at 0x1
19 s8 baselinePos; // at 0x2
20 u8 maxCharWidth; // at 0x3
21 ulong sheetSize; // at 0x4
22 u16 sheetNum; // at 0x8
23 u16 sheetFormat; // at 0xA
24 u16 sheetRow; // at 0xC
25 u16 sheetLine; // at 0xE
26 u16 sheetWidth; // at 0x10
27 u16 sheetHeight; // at 0x12
28 u8* sheetImage; // at 0x14
29};
30
31struct FontWidth {
32 u16 indexBegin; // at 0x0
33 u16 indexEnd; // at 0x2
34 FontWidth* pNext; // at 0x4
35 CharWidths widthTable[]; // at 0x8
36};
37
39 u16 ccodeBegin; // at 0x0
40 u16 ccodeEnd; // at 0x2
41 u16 mappingMethod; // at 0x4
42 u16 reserved; // at 0x6
43 FontCodeMap* pNext; // at 0x8
44 u16 mapInfo[]; // at 0xC
45};
46
48 u8 fontType; // at 0x0
49 s8 linefeed; // at 0x1
50 u16 alterCharIndex; // at 0x2
51 CharWidths defaultWidth; // at 0x4
52 u8 encoding; // at 0x7
53 FontTextureGlyph* pGlyph; // at 0x8
54 FontWidth* pWidth; // at 0xC
55 FontCodeMap* pMap; // at 0x10
56 u8 height; // at 0x14
57 u8 width; // at 0x15
58 u8 ascent; // at 0x16
59};
60
61namespace detail {
62
63/******************************************************************************
64 *
65 * ResFontBase
66 *
67 ******************************************************************************/
68class ResFontBase : public Font {
69public:
70 static const u16 GLYPH_INDEX_NOT_FOUND = 0xFFFF;
71
72public:
73 ResFontBase();
74 virtual ~ResFontBase(); // at 0x8
75
76 virtual int GetWidth() const; // at 0xC
77 virtual int GetHeight() const; // at 0x10
78
79 virtual int GetAscent() const; // at 0x14
80 virtual int GetDescent() const; // at 0x18
81 virtual int GetBaselinePos() const; // at 0x1C
82
83 virtual int GetCellHeight() const; // at 0x20
84 virtual int GetCellWidth() const; // at 0x24
85 virtual int GetMaxCharWidth() const; // at 0x28
86
87 virtual Type GetType() const; // at 0x2C
88 virtual GXTexFmt GetTextureFormat() const; // at 0x30
89 virtual int GetLineFeed() const; // at 0x34
90
91 virtual CharWidths GetDefaultCharWidths() const; // at 0x38
92 virtual void SetDefaultCharWidths(const CharWidths& rWidths); // at 0x3C
93
94 virtual bool SetAlternateChar(u16 ch); // at 0x40
95 virtual void SetLineFeed(int lf); // at 0x44
96
97 virtual int GetCharWidth(u16 ch) const; // at 0x48
98 virtual CharWidths GetCharWidths(u16 ch) const; // at 0x4C
99 virtual void GetGlyph(Glyph* pGlyph, u16 ch) const; // at 0x50
100 virtual FontEncoding GetEncoding() const; // at 0x54
101
102protected:
103 bool IsManaging(const void* pBuffer) const {
104 return mResource == pBuffer;
105 }
106
107 void SetResourceBuffer(void* pBuffer, FontInformation* pInfo);
108
109private:
110 u16 GetGlyphIndex(u16 ch) const;
111
112 u16 FindGlyphIndex(u16 ch) const;
113 u16 FindGlyphIndex(const FontCodeMap* pMap, u16 ch) const;
114
115 const CharWidths& GetCharWidthsFromIndex(u16 index) const;
116 const CharWidths& GetCharWidthsFromIndex(const FontWidth* pWidth,
117 u16 index) const;
118
119 void GetGlyphFromIndex(Glyph* pGlyph, u16 index) const;
120
121private:
122 void* mResource; // at 0x10
123 FontInformation* mFontInfo; // at 0x14
124};
125
126} // namespace detail
127} // namespace ut
128} // namespace nw4r
129
130#endif
Debugging library which includes various utilities used by the rest of nw4r.
Definition ut_list.cpp:4