mirror of
https://github.com/zeldaret/tp
synced 2026-07-07 14:13:27 -04:00
Refactor JUTFont symbols (#71)
* fix JUTFont args * fix Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
@@ -2,61 +2,63 @@
|
||||
#define JSYSTEM_JUTILITY_JUTFONT_H
|
||||
|
||||
#include "global.h"
|
||||
#include "gx/GX.h"
|
||||
|
||||
static const unsigned int CLR_WHITE = 0xFFFFFFFF;
|
||||
static const unsigned int CLR_BLACK = 0;
|
||||
namespace JUtility {
|
||||
|
||||
typedef const char* ResFONT;
|
||||
|
||||
struct TColor {
|
||||
TColor() { *(u32*)&r = 0xFFFFFFFF; }
|
||||
struct TColor : _GXColor {
|
||||
TColor() { set(-1); }
|
||||
|
||||
TColor(u32 raw) { *(u32*)&r = raw; }
|
||||
|
||||
u32 Raw() { return *(u32*)&r; }
|
||||
void set(u32 col) { *(u32*)&r = col; }
|
||||
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 a;
|
||||
u32 toUInt32() const { return *(u32*)&r; }
|
||||
|
||||
operator u32() const { return toUInt32(); }
|
||||
void operator=(const TColor& rhs) { ((_GXColor*)this)->operator=(rhs); }
|
||||
};
|
||||
|
||||
} // namespace JUtility
|
||||
|
||||
class JUTFont {
|
||||
public:
|
||||
JUTFont();
|
||||
virtual ~JUTFont();
|
||||
virtual ~JUTFont() {}
|
||||
|
||||
struct TWidth {};
|
||||
|
||||
virtual void setGX() = 0;
|
||||
virtual void setGX(TColor col1, TColor col2);
|
||||
/* 0x0c */ virtual void setGX() = 0;
|
||||
/* 0x10 */ virtual void setGX(JUtility::TColor col1, JUtility::TColor col2);
|
||||
/* 0x14 */ virtual f32 drawChar_scale(f32 a1, f32 a2, f32 a3, f32 a4, int a5, bool a6) = 0;
|
||||
/* 0x18 */ virtual u16 getLeading() const = 0;
|
||||
/* 0x1c */ virtual u16 getAscent() const = 0;
|
||||
/* 0x20 */ virtual u16 getDescent() const = 0;
|
||||
/* 0x24 */ virtual u32 getHeight() const = 0;
|
||||
/* 0x28 */ virtual u32 getWidth() const = 0;
|
||||
/* 0x2c */ virtual void getWidthEntry(int i_no, TWidth* width) const;
|
||||
/* 0x30 */ virtual u32 getCellWidth() const;
|
||||
/* 0x34 */ virtual u32 getCellHeight() const;
|
||||
/* 0x38 */ virtual u32 getFontType() const = 0;
|
||||
/* 0x3c */ virtual void getResFont() const = 0;
|
||||
/* 0x40 */ virtual bool isLeadByte(int a1) const = 0;
|
||||
|
||||
virtual void drawChar_scale(float a1, float a2, float a3, float a4, int a5, bool a6);
|
||||
virtual u16 getLeading() = 0;
|
||||
virtual u16 getAscent() = 0;
|
||||
virtual u16 getDescent() = 0;
|
||||
virtual u32 getHeight() = 0;
|
||||
virtual u32 getWidth() = 0;
|
||||
virtual void getWidthEntry(s32 i_no, TWidth* width);
|
||||
virtual u32 getCellWidth();
|
||||
virtual u32 getCellHeight();
|
||||
virtual u32 getFontType() = 0;
|
||||
virtual TColor getResFont() = 0;
|
||||
virtual bool isLeadByte(s32 a1) = 0;
|
||||
static bool isLeadByte_1Byte(int b);
|
||||
static bool isLeadByte_2Byte(int b);
|
||||
static bool isLeadByte_ShiftJIS(int b);
|
||||
|
||||
void initialize_state();
|
||||
void setCharColor(TColor col1);
|
||||
void setGradColor(TColor col1, TColor col2);
|
||||
float drawString_size_scale(float a1, float a2, float a3, float a4, char* a5, unsigned long usz,
|
||||
bool a7);
|
||||
void setCharColor(JUtility::TColor col1);
|
||||
void setGradColor(JUtility::TColor col1, JUtility::TColor col2);
|
||||
f32 drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* a5, u32 usz, bool a7);
|
||||
|
||||
bool unk4;
|
||||
u8 unk4;
|
||||
bool unk5;
|
||||
int unk8;
|
||||
TColor mColor1;
|
||||
TColor mColor2;
|
||||
TColor mColor3;
|
||||
TColor mColor4;
|
||||
JUtility::TColor mColor1;
|
||||
JUtility::TColor mColor2;
|
||||
JUtility::TColor mColor3;
|
||||
JUtility::TColor mColor4;
|
||||
int unk1C;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,54 +4,72 @@
|
||||
#include "JSystem/JKernel/JKRHeap/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTFont/JUTFont.h"
|
||||
|
||||
// todo: move
|
||||
inline u8 JSUHiByte(u16 i) {
|
||||
return i >> 8;
|
||||
}
|
||||
inline u8 JSULoByte(u16 i) {
|
||||
return i & 0xff;
|
||||
}
|
||||
|
||||
struct ResFONT {};
|
||||
|
||||
class JUTResFont : JUTFont {
|
||||
public:
|
||||
JUTResFont();
|
||||
JUTResFont(ResFONT font, JKRHeap* heap);
|
||||
JUTResFont(const ResFONT* font, JKRHeap* heap);
|
||||
~JUTResFont();
|
||||
|
||||
struct Unknown {
|
||||
struct Unknown2 {
|
||||
struct Cell {
|
||||
u32 filler0;
|
||||
u32 filler4;
|
||||
u32 filler8;
|
||||
u16 unkC;
|
||||
u16 unkE;
|
||||
u16 width;
|
||||
u16 height;
|
||||
};
|
||||
Unknown2* unk0;
|
||||
Cell* cell;
|
||||
};
|
||||
|
||||
virtual void setGX();
|
||||
virtual void setGX(TColor col1, TColor col2);
|
||||
virtual void drawChar_scale(float a1, float a2, float a3, float a4, int a5, bool a6);
|
||||
virtual void getWidthEntry(s32 i_no, TWidth* width);
|
||||
virtual u32 getCellWidth();
|
||||
virtual u32 getCellHeight();
|
||||
virtual bool isLeadByte(s32 a1);
|
||||
// virtuals
|
||||
/* 0x0c */ virtual void setGX();
|
||||
/* 0x10 */ virtual void setGX(JUtility::TColor col1, JUtility::TColor col2);
|
||||
/* 0x14 */ virtual f32 drawChar_scale(f32 a1, f32 a2, f32 a3, f32 a4, int a5, bool a6);
|
||||
|
||||
virtual void loadImage(s32 a1, u32 a2);
|
||||
virtual void setBlock();
|
||||
/* 0x2c */ virtual void getWidthEntry(int i_no, TWidth* width) const;
|
||||
/* 0x30 */ virtual u32 getCellWidth() const;
|
||||
/* 0x34 */ virtual u32 getCellHeight() const;
|
||||
/* 0x40 */ virtual bool isLeadByte(int a1) const;
|
||||
/* 0x44 */ virtual void loadImage(int a1, GXTexMapID a2);
|
||||
/* 0x48 */ virtual void setBlock();
|
||||
|
||||
// inlines
|
||||
void delete_and_initialize() {
|
||||
deleteMemBlocks_ResFont();
|
||||
initialize_state();
|
||||
}
|
||||
|
||||
// member functions
|
||||
void deleteMemBlocks_ResFont();
|
||||
void initialize_state();
|
||||
bool initiate(ResFONT font, JKRHeap* heap);
|
||||
bool protected_initiate(ResFONT font, JKRHeap* heap);
|
||||
bool initiate(const ResFONT* font, JKRHeap* heap);
|
||||
bool protected_initiate(const ResFONT* font, JKRHeap* heap);
|
||||
u32 countBlock();
|
||||
void loadFont(s32 a1, u32 a2, TWidth* a3);
|
||||
u32 getFontCode(s32 a1);
|
||||
s32 convertSjis(s32 a1, u16* a2);
|
||||
void loadFont(int a1, GXTexMapID a2, TWidth* a3);
|
||||
int getFontCode(int a1) const;
|
||||
u32 convertSjis(int a1, u16* a2) const;
|
||||
|
||||
u32 unk20;
|
||||
u8 filler24[0x20];
|
||||
u32 unk44;
|
||||
u32 unk48;
|
||||
u32 filler4C;
|
||||
JKRHeap* unk50;
|
||||
u32 unk54;
|
||||
Unknown* unk58;
|
||||
u32 unk5C;
|
||||
u8 filler60[0xC];
|
||||
bool (**unk6C)(s32 a1);
|
||||
/* 0x20 */ u32 unk20;
|
||||
/* 0x24 */ u8 filler24[0x20];
|
||||
/* 0x44 */ u32 unk44;
|
||||
/* 0x48 */ const ResFONT* pFontFile;
|
||||
/* 0x4c */ u32 filler4C;
|
||||
/* 0x50 */ JKRHeap* pMemBlocks;
|
||||
/* 0x54 */ u32 unk54;
|
||||
/* 0x58 */ Unknown* unk58;
|
||||
/* 0x5c */ u32 unk5C;
|
||||
/* 0x60 */ u16 mBlockCounts[6];
|
||||
/* 0x6c */ bool (**unk6C)(int a1);
|
||||
};
|
||||
|
||||
#endif // JSYSTEM_JUTILITY_JUT_RES_FONT
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/* 802DF81C 002DC75C 7C BB 2B 78 */ mr r27, r5
|
||||
/* 802DF820 002DC760 38 A0 00 00 */ li r5, 0
|
||||
/* 802DF824 002DC764 38 C1 00 08 */ addi r6, r1, 8
|
||||
/* 802DF828 002DC768 48 00 03 C1 */ bl loadFont__10JUTResFontFlUlPQ27JUTFont6TWidth
|
||||
/* 802DF828 002DC768 48 00 03 C1 */ bl loadFont__10JUTResFontFi11_GXTexMapIDPQ27JUTFont6TWidth
|
||||
/* 802DF82C 002DC76C 88 1E 00 05 */ lbz r0, 5(r30)
|
||||
/* 802DF830 002DC770 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 802DF834 002DC774 40 82 00 0C */ bne lbl_802DF840
|
||||
|
||||
@@ -94,7 +94,7 @@ lbl_802DFF0C:
|
||||
lbl_802DFF28:
|
||||
/* 802DFF28 002DCE68 7F A3 EB 78 */ mr r3, r29
|
||||
/* 802DFF2C 002DCE6C 7F C4 F3 78 */ mr r4, r30
|
||||
/* 802DFF30 002DCE70 48 00 01 95 */ bl convertSjis__10JUTResFontFlPUs
|
||||
/* 802DFF30 002DCE70 48 00 01 95 */ bl convertSjis__10JUTResFontCFiPUs
|
||||
/* 802DFF34 002DCE74 7C 7F 1B 78 */ mr r31, r3
|
||||
/* 802DFF38 002DCE78 48 00 00 0C */ b lbl_802DFF44
|
||||
lbl_802DFF3C:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* 802DFC74 002DCBB4 93 C1 00 08 */ stw r30, 8(r1)
|
||||
/* 802DFC78 002DCBB8 7C 7E 1B 78 */ mr r30, r3
|
||||
/* 802DFC7C 002DCBBC 7C BF 2B 78 */ mr r31, r5
|
||||
/* 802DFC80 002DCBC0 48 00 01 59 */ bl getFontCode__10JUTResFontFl
|
||||
/* 802DFC80 002DCBC0 48 00 01 59 */ bl getFontCode__10JUTResFontCFi
|
||||
/* 802DFC84 002DCBC4 38 A0 00 00 */ li r5, 0
|
||||
/* 802DFC88 002DCBC8 98 BF 00 00 */ stb r5, 0(r31)
|
||||
/* 802DFC8C 002DCBCC 80 9E 00 4C */ lwz r4, 0x4c(r30)
|
||||
|
||||
Reference in New Issue
Block a user