Refactor JUTFont symbols (#71)

* fix JUTFont args

* fix

Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
notyourav 2021-01-06 17:36:27 -08:00 committed by GitHub
parent 88fca194f8
commit b8ecef0ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 267 additions and 207 deletions

View File

@ -986,7 +986,7 @@ lbl_802EC14C:
/* 802EC158 002E9098 41 82 00 14 */ beq lbl_802EC16C
/* 802EC15C 002E909C 7F C4 F3 78 */ mr r4, r30
/* 802EC160 002E90A0 38 A0 00 00 */ li r5, 0
/* 802EC164 002E90A4 4B FF 2E 31 */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 802EC164 002E90A4 4B FF 2E 31 */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 802EC168 002E90A8 7C 7F 1B 78 */ mr r31, r3
lbl_802EC16C:
/* 802EC16C 002E90AC 28 1F 00 00 */ cmplwi r31, 0
@ -2232,7 +2232,7 @@ lbl_802ED318:
/* 802ED324 002EA264 41 82 00 14 */ beq lbl_802ED338
/* 802ED328 002EA268 7F C4 F3 78 */ mr r4, r30
/* 802ED32C 002EA26C 38 A0 00 00 */ li r5, 0
/* 802ED330 002EA270 4B FF 1C 65 */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 802ED330 002EA270 4B FF 1C 65 */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 802ED334 002EA274 7C 7F 1B 78 */ mr r31, r3
lbl_802ED338:
/* 802ED338 002EA278 28 1F 00 00 */ cmplwi r31, 0
@ -3693,7 +3693,7 @@ lbl_802EE7C0:
/* 802EE7CC 002EB70C 41 82 00 14 */ beq lbl_802EE7E0
/* 802EE7D0 002EB710 7F C4 F3 78 */ mr r4, r30
/* 802EE7D4 002EB714 38 A0 00 00 */ li r5, 0
/* 802EE7D8 002EB718 4B FF 07 BD */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 802EE7D8 002EB718 4B FF 07 BD */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 802EE7DC 002EB71C 7C 7F 1B 78 */ mr r31, r3
lbl_802EE7E0:
/* 802EE7E0 002EB720 28 1F 00 00 */ cmplwi r31, 0
@ -5154,7 +5154,7 @@ lbl_802EFC68:
/* 802EFC74 002ECBB4 41 82 00 14 */ beq lbl_802EFC88
/* 802EFC78 002ECBB8 7F C4 F3 78 */ mr r4, r30
/* 802EFC7C 002ECBBC 38 A0 00 00 */ li r5, 0
/* 802EFC80 002ECBC0 4B FE F3 15 */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 802EFC80 002ECBC0 4B FE F3 15 */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 802EFC84 002ECBC4 7C 7F 1B 78 */ mr r31, r3
lbl_802EFC88:
/* 802EFC88 002ECBC8 28 1F 00 00 */ cmplwi r31, 0
@ -6604,7 +6604,7 @@ lbl_802F10E8:
/* 802F10F4 002EE034 41 82 00 14 */ beq lbl_802F1108
/* 802F10F8 002EE038 7F C4 F3 78 */ mr r4, r30
/* 802F10FC 002EE03C 38 A0 00 00 */ li r5, 0
/* 802F1100 002EE040 4B FE DE 95 */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 802F1100 002EE040 4B FE DE 95 */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 802F1104 002EE044 7C 7F 1B 78 */ mr r31, r3
lbl_802F1108:
/* 802F1108 002EE048 28 1F 00 00 */ cmplwi r31, 0

View File

@ -673,7 +673,7 @@ lbl_802F4C6C:
/* 802F4C7C 002F1BBC 80 74 00 04 */ lwz r3, 4(r20)
/* 802F4C80 002F1BC0 38 81 00 14 */ addi r4, r1, 0x14
/* 802F4C84 002F1BC4 38 A1 00 10 */ addi r5, r1, 0x10
/* 802F4C88 002F1BC8 4B FE A1 3D */ bl setGradColor__7JUTFontF6TColor6TColor
/* 802F4C88 002F1BC8 4B FE A1 3D */ bl setGradColor__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor
lbl_802F4C8C:
/* 802F4C8C 002F1BCC 3B 80 00 00 */ li r28, 0
/* 802F4C90 002F1BD0 80 74 00 04 */ lwz r3, 4(r20)
@ -1415,7 +1415,7 @@ lbl_802F571C:
/* 802F572C 002F266C 80 7A 00 04 */ lwz r3, 4(r26)
/* 802F5730 002F2670 38 81 00 20 */ addi r4, r1, 0x20
/* 802F5734 002F2674 38 A1 00 1C */ addi r5, r1, 0x1c
/* 802F5738 002F2678 4B FE 96 8D */ bl setGradColor__7JUTFontF6TColor6TColor
/* 802F5738 002F2678 4B FE 96 8D */ bl setGradColor__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor
/* 802F573C 002F267C 48 00 01 F4 */ b lbl_802F5930
lbl_802F5740:
/* 802F5740 002F2680 7F 43 D3 78 */ mr r3, r26
@ -1463,7 +1463,7 @@ lbl_802F57D4:
/* 802F57E4 002F2724 80 7A 00 04 */ lwz r3, 4(r26)
/* 802F57E8 002F2728 38 81 00 14 */ addi r4, r1, 0x14
/* 802F57EC 002F272C 38 A1 00 10 */ addi r5, r1, 0x10
/* 802F57F0 002F2730 4B FE 95 D5 */ bl setGradColor__7JUTFontF6TColor6TColor
/* 802F57F0 002F2730 4B FE 95 D5 */ bl setGradColor__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor
/* 802F57F4 002F2734 48 00 01 3C */ b lbl_802F5930
lbl_802F57F8:
/* 802F57F8 002F2738 7F 43 D3 78 */ mr r3, r26
@ -1545,7 +1545,7 @@ lbl_802F5904:
/* 802F5914 002F2854 80 7A 00 04 */ lwz r3, 4(r26)
/* 802F5918 002F2858 38 81 00 0C */ addi r4, r1, 0xc
/* 802F591C 002F285C 38 A1 00 08 */ addi r5, r1, 8
/* 802F5920 002F2860 4B FE 94 A5 */ bl setGradColor__7JUTFontF6TColor6TColor
/* 802F5920 002F2860 4B FE 94 A5 */ bl setGradColor__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor
/* 802F5924 002F2864 48 00 00 0C */ b lbl_802F5930
lbl_802F5928:
/* 802F5928 002F2868 93 FB 00 00 */ stw r31, 0(r27)

View File

@ -424,7 +424,7 @@ J2DTextBox_NS_initiate:
/* 802FFC94 002FCBD4 41 82 00 14 */ beq lbl_802FFCA8
/* 802FFC98 002FCBD8 7F 44 D3 78 */ mr r4, r26
/* 802FFC9C 002FCBDC 38 A0 00 00 */ li r5, 0
/* 802FFCA0 002FCBE0 4B FD F2 F5 */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 802FFCA0 002FCBE0 4B FD F2 F5 */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 802FFCA4 002FCBE4 7C 60 1B 78 */ mr r0, r3
lbl_802FFCA8:
/* 802FFCA8 002FCBE8 90 1B 01 00 */ stw r0, 0x100(r27)
@ -600,7 +600,7 @@ J2DTextBox_NS_private_readStream:
/* 802FFF2C 002FCE6C 41 82 00 14 */ beq lbl_802FFF40
/* 802FFF30 002FCE70 7F 64 DB 78 */ mr r4, r27
/* 802FFF34 002FCE74 38 A0 00 00 */ li r5, 0
/* 802FFF38 002FCE78 4B FD F0 5D */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 802FFF38 002FCE78 4B FD F0 5D */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 802FFF3C 002FCE7C 7C 60 1B 78 */ mr r0, r3
lbl_802FFF40:
/* 802FFF40 002FCE80 90 1C 01 00 */ stw r0, 0x100(r28)

View File

@ -80,7 +80,7 @@ lbl_80271DB4:
/* 80271DD8 0026ED18 41 82 00 14 */ beq lbl_80271DEC
/* 80271DDC 0026ED1C 80 8D 82 10 */ lwz r4, lbl_80450790-_SDA_BASE_(r13)
/* 80271DE0 0026ED20 38 A0 00 00 */ li r5, 0
/* 80271DE4 0026ED24 48 06 D1 B1 */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 80271DE4 0026ED24 48 06 D1 B1 */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 80271DE8 0026ED28 7C 60 1B 78 */ mr r0, r3
lbl_80271DEC:
/* 80271DEC 0026ED2C 90 0D 8C 30 */ stw r0, lbl_804511B0-_SDA_BASE_(r13)

View File

@ -116,7 +116,7 @@ JUTAssertion_NS_flushMessage_dbPrint:
/* 802E4ADC 002E1A1C 90 01 00 0C */ stw r0, 0xc(r1)
/* 802E4AE0 002E1A20 7F E3 FB 78 */ mr r3, r31
/* 802E4AE4 002E1A24 38 81 00 0C */ addi r4, r1, 0xc
/* 802E4AE8 002E1A28 4B FF A2 89 */ bl setCharColor__7JUTFontF6TColor
/* 802E4AE8 002E1A28 4B FF A2 89 */ bl setCharColor__7JUTFontFQ28JUtility6TColor
/* 802E4AEC 002E1A2C 3C 60 80 43 */ lis r3, lbl_80434870@ha
/* 802E4AF0 002E1A30 38 63 48 70 */ addi r3, r3, lbl_80434870@l
/* 802E4AF4 002E1A34 48 08 40 F1 */ bl strlen
@ -153,7 +153,7 @@ JUTAssertion_NS_flushMessage_dbPrint:
/* 802E4B70 002E1AB0 38 84 48 70 */ addi r4, r4, lbl_80434870@l
/* 802E4B74 002E1AB4 7F C5 F3 78 */ mr r5, r30
/* 802E4B78 002E1AB8 38 C0 00 01 */ li r6, 1
/* 802E4B7C 002E1ABC 4B FF A2 AD */ bl drawString_size_scale__7JUTFontFffffPcUlb
/* 802E4B7C 002E1ABC 4B FF A2 AD */ bl drawString_size_scale__7JUTFontFffffPCcUlb
/* 802E4B80 002E1AC0 3C 60 80 43 */ lis r3, lbl_804348B0@ha
/* 802E4B84 002E1AC4 38 63 48 B0 */ addi r3, r3, lbl_804348B0@l
/* 802E4B88 002E1AC8 48 08 40 5D */ bl strlen
@ -190,7 +190,7 @@ JUTAssertion_NS_flushMessage_dbPrint:
/* 802E4C04 002E1B44 38 84 48 B0 */ addi r4, r4, lbl_804348B0@l
/* 802E4C08 002E1B48 7F C5 F3 78 */ mr r5, r30
/* 802E4C0C 002E1B4C 38 C0 00 01 */ li r6, 1
/* 802E4C10 002E1B50 4B FF A2 19 */ bl drawString_size_scale__7JUTFontFffffPcUlb
/* 802E4C10 002E1B50 4B FF A2 19 */ bl drawString_size_scale__7JUTFontFffffPCcUlb
lbl_802E4C14:
/* 802E4C14 002E1B54 E3 E1 00 48 */ psq_l f31, 72(r1), 0, qr0
/* 802E4C18 002E1B58 CB E1 00 40 */ lfd f31, 0x40(r1)

View File

@ -399,7 +399,7 @@ lbl_802E78D0:
/* 802E78F4 002E4834 90 01 00 2C */ stw r0, 0x2c(r1)
/* 802E78F8 002E4838 80 79 00 4C */ lwz r3, 0x4c(r25)
/* 802E78FC 002E483C 38 81 00 2C */ addi r4, r1, 0x2c
/* 802E7900 002E4840 4B FF 74 71 */ bl setCharColor__7JUTFontF6TColor
/* 802E7900 002E4840 4B FF 74 71 */ bl setCharColor__7JUTFontFQ28JUtility6TColor
/* 802E7904 002E4844 48 00 01 18 */ b lbl_802E7A1C
lbl_802E7908:
/* 802E7908 002E4848 80 19 00 34 */ lwz r0, 0x34(r25)
@ -415,7 +415,7 @@ lbl_802E7908:
/* 802E7930 002E4870 90 01 00 24 */ stw r0, 0x24(r1)
/* 802E7934 002E4874 80 79 00 4C */ lwz r3, 0x4c(r25)
/* 802E7938 002E4878 38 81 00 24 */ addi r4, r1, 0x24
/* 802E793C 002E487C 4B FF 74 35 */ bl setCharColor__7JUTFontF6TColor
/* 802E793C 002E487C 4B FF 74 35 */ bl setCharColor__7JUTFontFQ28JUtility6TColor
/* 802E7940 002E4880 48 00 00 DC */ b lbl_802E7A1C
lbl_802E7944:
/* 802E7944 002E4884 38 00 00 E6 */ li r0, 0xe6
@ -428,7 +428,7 @@ lbl_802E7944:
/* 802E7960 002E48A0 90 01 00 1C */ stw r0, 0x1c(r1)
/* 802E7964 002E48A4 80 79 00 4C */ lwz r3, 0x4c(r25)
/* 802E7968 002E48A8 38 81 00 1C */ addi r4, r1, 0x1c
/* 802E796C 002E48AC 4B FF 74 05 */ bl setCharColor__7JUTFontF6TColor
/* 802E796C 002E48AC 4B FF 74 05 */ bl setCharColor__7JUTFontFQ28JUtility6TColor
/* 802E7970 002E48B0 48 00 00 AC */ b lbl_802E7A1C
lbl_802E7974:
/* 802E7974 002E48B4 38 00 00 E6 */ li r0, 0xe6
@ -441,7 +441,7 @@ lbl_802E7974:
/* 802E7990 002E48D0 90 01 00 14 */ stw r0, 0x14(r1)
/* 802E7994 002E48D4 80 79 00 4C */ lwz r3, 0x4c(r25)
/* 802E7998 002E48D8 38 81 00 14 */ addi r4, r1, 0x14
/* 802E799C 002E48DC 4B FF 73 D5 */ bl setCharColor__7JUTFontF6TColor
/* 802E799C 002E48DC 4B FF 73 D5 */ bl setCharColor__7JUTFontFQ28JUtility6TColor
/* 802E79A0 002E48E0 48 00 00 7C */ b lbl_802E7A1C
lbl_802E79A4:
/* 802E79A4 002E48E4 80 6D 8F A8 */ lwz r3, lbl_80451528-_SDA_BASE_(r13)
@ -527,7 +527,7 @@ lbl_802E7A40:
/* 802E7ADC 002E4A1C FC 80 D8 90 */ fmr f4, f27
/* 802E7AE0 002E4A20 7F A4 EB 78 */ mr r4, r29
/* 802E7AE4 002E4A24 38 C0 00 01 */ li r6, 1
/* 802E7AE8 002E4A28 4B FF 73 41 */ bl drawString_size_scale__7JUTFontFffffPcUlb
/* 802E7AE8 002E4A28 4B FF 73 41 */ bl drawString_size_scale__7JUTFontFffffPCcUlb
/* 802E7AEC 002E4A2C 48 00 00 60 */ b lbl_802E7B4C
lbl_802E7AF0:
/* 802E7AF0 002E4A30 80 6D 8F A8 */ lwz r3, lbl_80451528-_SDA_BASE_(r13)

View File

@ -178,7 +178,7 @@ JUTDbPrint_NS_flush_X1_:
/* 802E0398 002DD2D8 90 01 00 08 */ stw r0, 8(r1)
/* 802E039C 002DD2DC 80 7C 00 04 */ lwz r3, 4(r28)
/* 802E03A0 002DD2E0 38 81 00 08 */ addi r4, r1, 8
/* 802E03A4 002DD2E4 4B FF E9 CD */ bl setCharColor__7JUTFontF6TColor
/* 802E03A4 002DD2E4 4B FF E9 CD */ bl setCharColor__7JUTFontFQ28JUtility6TColor
/* 802E03A8 002DD2E8 48 00 00 60 */ b lbl_802E0408
lbl_802E03AC:
/* 802E03AC 002DD2EC 88 1C 00 0C */ lbz r0, 0xc(r28)
@ -276,7 +276,7 @@ JUTDbPrint_NS_drawString:
/* 802E0500 002DD440 7F C4 F3 78 */ mr r4, r30
/* 802E0504 002DD444 7F A5 EB 78 */ mr r5, r29
/* 802E0508 002DD448 38 C0 00 01 */ li r6, 1
/* 802E050C 002DD44C 4B FF E9 1D */ bl drawString_size_scale__7JUTFontFffffPcUlb
/* 802E050C 002DD44C 4B FF E9 1D */ bl drawString_size_scale__7JUTFontFffffPCcUlb
/* 802E0510 002DD450 E3 E1 00 48 */ psq_l f31, 72(r1), 0, qr0
/* 802E0514 002DD454 CB E1 00 40 */ lfd f31, 0x40(r1)
/* 802E0518 002DD458 39 61 00 40 */ addi r11, r1, 0x40

View File

@ -1,18 +0,0 @@
.include "macros.inc"
.section .text, "ax" # 802decf8
.global __ct__7JUTFontFv
__ct__7JUTFontFv:
/* 802DECF8 002DBC38 3C 80 80 3A */ lis r4, lbl_803A31F0@ha
/* 802DECFC 002DBC3C 38 04 31 F0 */ addi r0, r4, lbl_803A31F0@l
/* 802DED00 002DBC40 90 03 00 00 */ stw r0, 0(r3)
/* 802DED04 002DBC44 38 00 FF FF */ li r0, -1
/* 802DED08 002DBC48 90 03 00 0C */ stw r0, 0xc(r3)
/* 802DED0C 002DBC4C 90 03 00 10 */ stw r0, 0x10(r3)
/* 802DED10 002DBC50 90 03 00 14 */ stw r0, 0x14(r3)
/* 802DED14 002DBC54 90 03 00 18 */ stw r0, 0x18(r3)
/* 802DED18 002DBC58 38 00 00 00 */ li r0, 0
/* 802DED1C 002DBC5C 98 03 00 04 */ stb r0, 4(r3)
/* 802DED20 002DBC60 4E 80 00 20 */ blr

View File

@ -85,7 +85,7 @@ messageSet:
/* 8009CCBC 00099BFC 3C 80 80 38 */ lis r4, lbl_8037B3E0@ha
/* 8009CCC0 00099C00 38 84 B3 E0 */ addi r4, r4, lbl_8037B3E0@l
/* 8009CCC4 00099C04 38 A0 00 00 */ li r5, 0
/* 8009CCC8 00099C08 48 24 22 CD */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 8009CCC8 00099C08 48 24 22 CD */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 8009CCCC 00099C0C 3B C1 00 D4 */ addi r30, r1, 0xd4
/* 8009CCD0 00099C10 38 80 00 C8 */ li r4, 0xc8
/* 8009CCD4 00099C14 98 81 00 60 */ stb r4, 0x60(r1)

View File

@ -8377,7 +8377,7 @@ lbl_800148BC:
/* 800148C8 00011808 41 82 00 14 */ beq lbl_800148DC
/* 800148CC 0001180C 80 9F 00 00 */ lwz r4, 0(r31)
/* 800148D0 00011810 7F 45 D3 78 */ mr r5, r26
/* 800148D4 00011814 48 2C A6 C1 */ bl __ct__10JUTResFontFPCcP7JKRHeap
/* 800148D4 00011814 48 2C A6 C1 */ bl __ct__10JUTResFontFPC7ResFONTP7JKRHeap
/* 800148D8 00011818 7C 60 1B 78 */ mr r0, r3
lbl_800148DC:
/* 800148DC 0001181C 90 1E 00 00 */ stw r0, 0(r30)

View File

@ -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;
};

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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)

View File

@ -499,38 +499,6 @@ void __dl__FPv(void);
void __dla__FPv(void);
}
extern "C" {
struct TColor;
extern void GXBegin(u8, u8, u16);
extern void GXLoadTexObj(u32*, s32);
extern void GXInitTexObjLOD(f32, f32, f32, u32*, s32, s32, u32, u8, u32);
extern void GXInitTexObj(u32*, u32, u32, u32, u32, u32, u8);
extern void GXSetNumChans(u32);
extern void GXSetNumTevStages(u32);
extern void GXSetNumTexGens(u32);
extern void GXSetTevOrder(u32, u32, u32, u32);
extern void GXSetChanCtrl(u32, u32, u32, u32, u32, u32, s32);
extern void GXSetTevOp(s32, s32);
extern void GXSetTevColor(s32, TColor);
extern void GXSetTevColorIn(s32, u32, u32, u32, u32);
extern void GXSetTevAlphaIn(s32, u32, u32, u32, u32);
extern void GXSetTevColorOp(s32, u32, u32, u32, u32, u32);
extern void GXSetTevAlphaOp(s32, u32, u32, u32, u32, u32);
extern void GXSetBlendMode(u32, u32, u32, u32);
extern void GXSetVtxAttrFmt(u32, u32, u32, u32, u32);
extern void GXClearVtxDesc();
extern void GXSetVtxDesc(u32, u32);
typedef void (*GXDrawDoneCallback)(void);
extern void GXSetDrawDoneCallback(GXDrawDoneCallback);
extern void GXDrawDone(void);
extern void GXAbortFrame(void);
extern void GXFlush(void);
extern OSThread* GXSetCurrentGXThread(void);
extern OSThread* GXGetCurrentGXThread(void);
}
extern "C" {
void VIWaitForRetrace(void);
void VISetBlack(s32);

View File

@ -3,6 +3,34 @@
#include "dolphin/types.h"
typedef enum _GXTexMapID {
GX_TEXMAP1 = 1,
GX_TEXMAP2 = 2,
GX_TEXMAP0 = 0,
GX_TEXMAP5 = 5,
GX_TEXMAP6 = 6,
GX_TEXMAP3 = 3,
GX_TEXMAP4 = 4,
GX_TEXMAP_NULL = 255,
GX_TEX_DISABLE = 256,
GX_TEXMAP7 = 7,
GX_MAX_TEXMAP = 8
} GXTexMapID;
struct _GXColor {
void operator=(const _GXColor& rhs) {
r = rhs.r;
g = rhs.g;
b = rhs.b;
a = rhs.a;
}
u8 r;
u8 g;
u8 b;
u8 a;
};
struct GXRenderModeObj {
s32 vi_tv_mode;
u16 fb_width;
@ -22,6 +50,34 @@ struct GXRenderModeObj {
extern "C" {
f32 GXGetYScaleFactor(u16 efb_height, u16 xfb_height);
u16 GXGetNumXfbLines(u32 efb_height, f32 y_scale);
void GXBegin(u8, u8, u16);
void GXLoadTexObj(u32*, s32);
void GXInitTexObjLOD(f32, f32, f32, u32*, s32, s32, u32, u8, u32);
void GXInitTexObj(u32*, u32, u32, u32, u32, u32, u8);
void GXSetNumChans(u32);
void GXSetNumTevStages(u32);
void GXSetNumTexGens(u32);
void GXSetTevOrder(u32, u32, u32, u32);
void GXSetChanCtrl(u32, u32, u32, u32, u32, u32, s32);
void GXSetTevOp(s32, s32);
void GXSetTevColor(s32, _GXColor);
void GXSetTevColorIn(s32, u32, u32, u32, u32);
void GXSetTevAlphaIn(s32, u32, u32, u32, u32);
void GXSetTevColorOp(s32, u32, u32, u32, u32, u32);
void GXSetTevAlphaOp(s32, u32, u32, u32, u32, u32);
void GXSetBlendMode(u32, u32, u32, u32);
void GXSetVtxAttrFmt(u32, u32, u32, u32, u32);
void GXClearVtxDesc();
void GXSetVtxDesc(u32, u32);
typedef void (*GXDrawDoneCallback)(void);
void GXSetDrawDoneCallback(GXDrawDoneCallback);
void GXDrawDone(void);
void GXAbortFrame(void);
void GXFlush(void);
OSThread* GXSetCurrentGXThread(void);
OSThread* GXGetCurrentGXThread(void);
}
#endif

View File

@ -758,6 +758,9 @@ SECTIONS {
"__dt__7JKRFileFv" = 0x802D7B90;
}
FORCEACTIVE {
isLeadByte_1Byte__7JUTFontFi
isLeadByte_2Byte__7JUTFontFi
isLeadByte_ShiftJIS__7JUTFontFi
parseBlock_object__Q37JStudio3stb6TParseFRCQ47JStudio3stb4data20TParse_TBlock_objectUl
parseHeader__Q37JStudio3stb6TParseFRCQ47JStudio3stb4data14TParse_THeaderUl
parseBlock_next__Q37JStudio3stb6TParseFPPCvPUlUl
@ -802,13 +805,13 @@ FORCEACTIVE {
startCtrl__8daItem_cFv
startControl__8daItem_cFv
endControl__8daItem_cFv
loadImage__10JUTResFontFlUl
isLeadByte__10JUTResFontFl
getCellHeight__10JUTResFontFv
getCellWidth__10JUTResFontFv
getWidthEntry__10JUTResFontFlPQ27JUTFont6TWidth
loadImage__10JUTResFontFi11_GXTexMapID
isLeadByte__10JUTResFontCFi
getCellHeight__10JUTResFontCFv
getCellWidth__10JUTResFontCFv
getWidthEntry__10JUTResFontCFiPQ27JUTFont6TWidth
drawChar_scale__10JUTResFontFffffib
setGX__10JUTResFontF6TColor6TColor
setGX__10JUTResFontFQ28JUtility6TColorQ28JUtility6TColor
setGX__10JUTResFontFv
setBlock__10JUTResFontFv
draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole

View File

@ -1,39 +1,53 @@
#include "JSystem/JUtility/JUTFont/JUTFont.h"
#ifdef NONMATCHING
JUTFont::JUTFont() {
mColor1 = TColor();
mColor2 = TColor();
mColor3 = TColor();
mColor4 = TColor();
unk4 = false;
JUTFont::JUTFont() : mColor1(), mColor2(), mColor3(), mColor4() {
unk4 = 0;
}
#endif
void JUTFont::initialize_state() {
setCharColor(TColor());
setCharColor(JUtility::TColor());
unk5 = false;
unk8 = 0;
unk4 = false;
}
void JUTFont::setCharColor(TColor col1) {
void JUTFont::setCharColor(JUtility::TColor col1) {
mColor1 = col1;
mColor2 = col1;
mColor3 = col1;
mColor4 = col1;
}
void JUTFont::setGradColor(TColor col1, TColor col2) {
void JUTFont::setGradColor(JUtility::TColor col1, JUtility::TColor col2) {
mColor1 = col1;
mColor2 = col1;
mColor3 = col2;
mColor4 = col2;
}
asm float JUTFont::drawString_size_scale(float a1, float a2, float a3, float a4, char* a5,
unsigned long usz, bool a7) {
nofralloc
#ifdef NONMATCHING // regalloc
f32 JUTFont::drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* str, u32 usz,
bool a7) {
f32 temp = a1;
for (; usz > 0; usz--, str++) {
u32 b = *(u8*)str;
if (isLeadByte(b)) {
str++;
b = (b << 8 | *(u8*)str);
usz--;
}
a1 += drawChar_scale(temp, a2, a3, a4, b, a7);
a7 = 1;
}
return a1 - temp;
}
#else
asm f32 JUTFont::drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* a5, u32 usz,
bool a7) {
nofralloc
#include "JSystem/JUtility/JUTFont/asm/drawString_size_scale.s"
}
}
#endif

View File

@ -1,11 +1,11 @@
#include "JSystem/JUtility/JUTResFont.h"
extern "C" {
extern void convertSjis__10JUTResFontFlPUs(); // remove when JUTResFont::getFontCode decompiled
extern void getFontCode__10JUTResFontFl(); // remove when JUTResFont::getWidthEntry decompiled
extern void convertSjis__10JUTResFontCFiPUs(); // remove when JUTResFont::getFontCode decompiled
extern void getFontCode__10JUTResFontCFi(); // remove when JUTResFont::getWidthEntry decompiled
extern void
loadFont__10JUTResFontFlUlPQ27JUTFont6TWidth(); // remove when JUTResFont::drawChar_scale
// decompiled
loadFont__10JUTResFontFi11_GXTexMapIDPQ27JUTFont6TWidth(); // remove when
// JUTResFont::drawChar_scale decompiled
extern void countBlock__10JUTResFontFv(); // remove when JUTResFont::protected_initiate decompiled
extern void
initialize_state__7JUTFontFv(); // remove when JUTResFont::protected_initiate decompiled
@ -32,34 +32,26 @@ JUTResFont::JUTResFont() {
((JUTFont*)this)->initialize_state();
}
JUTResFont::JUTResFont(ResFONT font, JKRHeap* heap) {
JUTResFont::JUTResFont(const ResFONT* font, JKRHeap* heap) {
initialize_state();
((JUTFont*)this)->initialize_state();
initiate(font, heap);
}
#ifdef NONMATCHING
JUTResFont::~JUTResFont() {
if (unk4) {
deleteMemBlocks_ResFont();
initialize_state();
delete_and_initialize();
((JUTFont*)this)->initialize_state();
}
}
#else
asm JUTResFont::~JUTResFont() {
nofralloc
#include "JSystem/JUtility/asm/JUTResFont__dtor.s"
}
#endif
void JUTResFont::deleteMemBlocks_ResFont() {
delete[](void*) unk50;
delete[](void*) pMemBlocks;
}
void JUTResFont::initialize_state() {
unk48 = 0;
unk50 = NULL;
pFontFile = NULL;
pMemBlocks = NULL;
unk54 = 0;
unk58 = NULL;
unk5C = 0;
@ -68,10 +60,9 @@ void JUTResFont::initialize_state() {
unk44 = 0xFFFFFFFF;
}
bool JUTResFont::initiate(ResFONT font, JKRHeap* heap) {
bool JUTResFont::initiate(const ResFONT* font, JKRHeap* heap) {
if (!protected_initiate(font, heap)) {
deleteMemBlocks_ResFont();
initialize_state();
delete_and_initialize();
((JUTFont*)this)->initialize_state();
unk4 = false;
return false;
@ -80,7 +71,7 @@ bool JUTResFont::initiate(ResFONT font, JKRHeap* heap) {
return true;
}
asm bool JUTResFont::protected_initiate(ResFONT font, JKRHeap* heap) {
asm bool JUTResFont::protected_initiate(const ResFONT* font, JKRHeap* heap) {
nofralloc
#include "JSystem/JUtility/asm/JUTResFont__protected_initiate.s"
}
@ -112,8 +103,8 @@ void JUTResFont::setGX() {
GXSetVtxDesc(0xd, 0x1);
}
void JUTResFont::setGX(TColor col1, TColor col2) {
if ((col1.Raw() == CLR_BLACK) && (col2.Raw() == CLR_WHITE)) {
void JUTResFont::setGX(JUtility::TColor col1, JUtility::TColor col2) {
if ((u32(col1) == 0) && (u32(col2) == 0xFFFFFFFF)) {
setGX();
return;
}
@ -144,52 +135,79 @@ void JUTResFont::setGX(TColor col1, TColor col2) {
GXSetVtxDesc(0xd, 0x1);
}
asm void JUTResFont::drawChar_scale(float a1, float a2, float a3, float a4, int a5, bool a6) {
asm float JUTResFont::drawChar_scale(f32 a1, f32 a2, f32 a3, f32 a4, int a5, bool a6) {
nofralloc
#include "JSystem/JUtility/asm/JUTResFont__drawChar_scale.s"
}
void JUTResFont::loadFont(s32 a1, u32 a2, TWidth* a3) {
if (a3 != NULL)
void JUTResFont::loadFont(int a1, GXTexMapID a2, TWidth* a3) {
if (a3 != NULL) // for variable width?
getWidthEntry(a1, a3);
u32 code = getFontCode(a1);
loadImage(code, a2);
loadImage(getFontCode(a1), a2);
}
asm void JUTResFont::getWidthEntry(s32 i_no, TWidth* width){nofralloc
asm void JUTResFont::getWidthEntry(int i_no, TWidth* width) const {nofralloc
#include "JSystem/JUtility/asm/JUTResFont__getWidthEntry.s"
}
u32 JUTResFont::getCellWidth() {
if (unk58 != NULL && unk58->unk0 != NULL)
return unk58->unk0->unkC;
u32 JUTResFont::getCellWidth() const {
if (unk58 != NULL && unk58->cell != NULL)
return unk58->cell->width;
return getWidth();
}
u32 JUTResFont::getCellHeight() {
if (unk58 != NULL && unk58->unk0 != NULL)
return unk58->unk0->unkE;
u32 JUTResFont::getCellHeight() const {
if (unk58 != NULL && unk58->cell != NULL)
return unk58->cell->height;
return getHeight();
}
bool JUTResFont::isLeadByte(s32 a1) {
return (*unk6C)(a1);
bool JUTResFont::isLeadByte(int a1) const {
return (*unk6C)(a1); // saoAboutEncoding_
}
asm u32 JUTResFont::getFontCode(s32 a1) {
asm int JUTResFont::getFontCode(int a1) const {
nofralloc
#include "JSystem/JUtility/asm/JUTResFont__getFontCode.s"
}
asm void JUTResFont::loadImage(s32 a1, u32 a2) {
nofralloc
asm void JUTResFont::loadImage(int a1, _GXTexMapID a2){nofralloc
#include "JSystem/JUtility/asm/JUTResFont__loadImage.s"
}
asm s32 JUTResFont::convertSjis(s32 a1, u16* a2) {
nofralloc
#include "JSystem/JUtility/asm/JUTResFont__convertSjis.s"
u32 JUTResFont::convertSjis(int a1, u16* a2) const {
u8 hi = JSUHiByte(a1);
u8 lo = JSULoByte(a1);
// SJIS lo byte is always 0x80-0xFF
s32 temp = lo - 0x40;
if (temp >= 0x40)
temp--;
u16 off = 0x31C;
if (a2 != NULL)
off = *a2;
return (temp + (hi - 0x88) * 0xBC) - 0x5E + off;
}
bool JUTFont::isLeadByte_1Byte(int b) {
return false;
}
bool JUTFont::isLeadByte_2Byte(int b) {
return true;
}
bool JUTFont::isLeadByte_ShiftJIS(int b) {
bool result = false;
// 00 - 0x7F = ASCII, 0xA1 - 0xDF = JIS, everything else = SJIS
if (((0x81 <= b) && (b <= 0x9f)) || ((0xe0 <= b && (b <= 0xfc))))
result = true;
return result;
}

View File

@ -472,7 +472,6 @@ TEXT_O_FILES := \
$(BUILD_DIR)/asm/JUtility/JUTPalette.o \
$(BUILD_DIR)/asm/JUtility/JUTNameTab.o \
$(BUILD_DIR)/asm/JUtility/JUTGraphFifo.o \
$(BUILD_DIR)/asm/JUtility/JUTFont.o \
$(BUILD_DIR)/libs/JSystem/JUtility/JUTFont.o \
$(BUILD_DIR)/libs/JSystem/JUtility/JUTResFont.o \
$(BUILD_DIR)/asm/JUtility/JUTDbPrint.o \