summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Akashi <rubenru09@aol.com>2021-06-23 00:11:42 +0100
committerGitHub <noreply@github.com>2021-06-23 00:11:42 +0100
commit5e61b9f18d4592bd964e238e2d3f45265f863cea (patch)
tree4d57137cd2097018e31d2db19d72c22f51942834
parentcec1d428f458997fe3e4c0ac4abf0dc6b36ba699 (diff)
parent66d408a02664eabd153377fe3f4842da0da2d627 (diff)
Merge branch 'master' into 0202A1E0
-rw-r--r--arm9/arm9.lsf2
-rw-r--r--arm9/asm/unk_02002C14.s432
-rw-r--r--arm9/src/error_message_reset.c2
-rw-r--r--arm9/src/font.c173
-rw-r--r--arm9/src/list_menu.c1
-rw-r--r--arm9/src/main.c3
-rw-r--r--arm9/src/render_text.c12
-rw-r--r--arm9/src/text.c2
-rw-r--r--arm9/src/text_02054590.c3
-rw-r--r--arm9/src/unk_02064E4C.c3
-rw-r--r--include/font.h25
-rw-r--r--include/text.h1
12 files changed, 210 insertions, 449 deletions
diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf
index 19c29a3c..66c41c14 100644
--- a/arm9/arm9.lsf
+++ b/arm9/arm9.lsf
@@ -10,7 +10,7 @@ Static arm9
Object unk_02001B80.o
Object string_util.o
Object render_text.o
- Object unk_02002C14.o
+ Object font.o
Object unk_02002F08.o
Object unk_020030E8.o
Object sound.o
diff --git a/arm9/asm/unk_02002C14.s b/arm9/asm/unk_02002C14.s
deleted file mode 100644
index 60d27fed..00000000
--- a/arm9/asm/unk_02002C14.s
+++ /dev/null
@@ -1,432 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .section .bss
-
- .global UNK_02106FC8
-UNK_02106FC8: ; 0x02106FC8
- .space 0x4
-
- .global UNK_02106FCC
-UNK_02106FCC: ; 0x02106FCC
- .space 0xa4
-
- .section .rodata
-
- .global UNK_020ECB54
-UNK_020ECB54: ; 0x020ECB54
- .short 0x0000, 0x0000
- .short 0x0001, 0x0000
- .short 0x0002, 0x0000
- .short 0x0003, 0x0000
-
- .global UNK_020ECB64
-UNK_020ECB64: ; 0x020ECB64
- .byte 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02
- .byte 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02
- .byte 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02
- .byte 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02
- .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-
- .text
-
- thumb_func_start FUN_02002C14
-FUN_02002C14: ; 0x02002C14
- push {r4, lr}
- ldr r0, _02002C44 ; =UNK_02106FCC
- ldr r4, _02002C48 ; =UNK_02106FC8
- mov r1, #0x0
- str r0, [r4, #0x0]
- add r2, r1, #0x0
- add r0, r1, #0x0
-_02002C22:
- ldr r3, [r4, #0x0]
- add r1, r1, #0x1
- add r3, r3, r2
- add r3, #0x84
- str r0, [r3, #0x0]
- ldr r3, [r4, #0x0]
- add r3, r3, r2
- add r3, #0x94
- add r2, r2, #0x4
- str r0, [r3, #0x0]
- cmp r1, #0x4
- blo _02002C22
- ldr r0, _02002C4C ; =UNK_020ECB64
- bl SetFontsPointer
- pop {r4, pc}
- nop
-_02002C44: .word UNK_02106FCC
-_02002C48: .word UNK_02106FC8
-_02002C4C: .word UNK_020ECB64
-
- thumb_func_start FUN_02002C50
-FUN_02002C50: ; 0x02002C50
- push {r3-r4, lr}
- sub sp, #0x4
- str r1, [sp, #0x0]
- lsl r4, r0, #0x2
- ldr r1, _02002C78 ; =UNK_020ECB54
- ldr r3, _02002C7C ; =UNK_020ECB54 + 2
- ldrh r1, [r1, r4]
- ldrh r3, [r3, r4]
- mov r0, #0xe
- mov r2, #0x1
- bl FUN_02021590
- ldr r1, _02002C80 ; =UNK_02106FC8
- ldr r1, [r1, #0x0]
- add r1, r1, r4
- add r1, #0x94
- str r0, [r1, #0x0]
- add sp, #0x4
- pop {r3-r4, pc}
- nop
-_02002C78: .word UNK_020ECB54
-_02002C7C: .word UNK_020ECB54 + 2
-_02002C80: .word UNK_02106FC8
-
- thumb_func_start FUN_02002C84
-FUN_02002C84: ; 0x02002C84
- push {r3-r5, lr}
- add r4, r0, #0x0
- add r5, r1, #0x0
- cmp r4, #0x4
- blt _02002C92
- bl GF_AssertFail
-_02002C92:
- ldr r0, _02002CBC ; =UNK_02106FC8
- lsl r4, r4, #0x2
- ldr r0, [r0, #0x0]
- add r0, r0, r4
- add r0, #0x94
- ldr r0, [r0, #0x0]
- cmp r0, #0x0
- bne _02002CA6
- bl GF_AssertFail
-_02002CA6:
- ldr r0, _02002CBC ; =UNK_02106FC8
- mov r1, #0x0
- ldr r0, [r0, #0x0]
- add r2, r5, #0x0
- add r0, r0, r4
- add r0, #0x94
- ldr r0, [r0, #0x0]
- bl FUN_020215E0
- pop {r3-r5, pc}
- nop
-_02002CBC: .word UNK_02106FC8
-
- thumb_func_start FUN_02002CC0
-FUN_02002CC0: ; 0x02002CC0
- push {r4, lr}
- add r4, r0, #0x0
- cmp r4, #0x4
- blt _02002CCC
- bl GF_AssertFail
-_02002CCC:
- ldr r0, _02002CF4 ; =UNK_02106FC8
- lsl r4, r4, #0x2
- ldr r0, [r0, #0x0]
- add r0, r0, r4
- add r0, #0x94
- ldr r0, [r0, #0x0]
- cmp r0, #0x0
- bne _02002CE0
- bl GF_AssertFail
-_02002CE0:
- ldr r0, _02002CF4 ; =UNK_02106FC8
- mov r1, #0x1
- ldr r0, [r0, #0x0]
- mov r2, #0x0
- add r0, r0, r4
- add r0, #0x94
- ldr r0, [r0, #0x0]
- bl FUN_020215E0
- pop {r4, pc}
- .balign 4
-_02002CF4: .word UNK_02106FC8
-
- thumb_func_start FUN_02002CF8
-FUN_02002CF8: ; 0x02002CF8
- push {r3-r7, lr}
- add r4, r0, #0x0
- cmp r4, #0x4
- blt _02002D04
- bl GF_AssertFail
-_02002D04:
- ldr r0, _02002D8C ; =UNK_02106FC8
- lsl r6, r4, #0x2
- ldr r7, [r0, #0x0]
- add r0, r7, r6
- add r0, #0x84
- ldr r0, [r0, #0x0]
- mov r12, r0
- cmp r0, #0x0
- beq _02002D68
- ldr r2, _02002D90 ; =UNK_020ECB54
- mov r1, #0x0
- ldrh r0, [r2, r6]
- add r3, r7, #0x0
-_02002D1E:
- cmp r1, r4
- beq _02002D3E
- ldrh r5, [r2, #0x0]
- cmp r5, r0
- bne _02002D3E
- add r5, r3, #0x0
- add r5, #0x94
- ldr r5, [r5, #0x0]
- cmp r5, #0x0
- beq _02002D3E
- lsl r0, r1, #0x2
- add r2, r7, r0
- add r2, #0x84
- mov r0, r12
- str r0, [r2, #0x0]
- b _02002D48
-_02002D3E:
- add r1, r1, #0x1
- add r2, r2, #0x4
- add r3, r3, #0x4
- cmp r1, #0x4
- blo _02002D1E
-_02002D48:
- cmp r1, #0x4
- bne _02002D68
- ldr r0, _02002D8C ; =UNK_02106FC8
- lsl r5, r4, #0x2
- ldr r0, [r0, #0x0]
- add r0, r0, r5
- add r0, #0x84
- ldr r0, [r0, #0x0]
- bl FreeToHeap
- ldr r0, _02002D8C ; =UNK_02106FC8
- mov r1, #0x0
- ldr r0, [r0, #0x0]
- add r0, r0, r5
- add r0, #0x84
- str r1, [r0, #0x0]
-_02002D68:
- ldr r0, _02002D8C ; =UNK_02106FC8
- ldr r0, [r0, #0x0]
- add r0, r0, r6
- add r0, #0x94
- ldr r0, [r0, #0x0]
- cmp r0, #0x0
- beq _02002D88
- bl FUN_020215C8
- ldr r0, _02002D8C ; =UNK_02106FC8
- mov r2, #0x0
- ldr r1, [r0, #0x0]
- lsl r0, r4, #0x2
- add r0, r1, r0
- add r0, #0x94
- str r2, [r0, #0x0]
-_02002D88:
- pop {r3-r7, pc}
- nop
-_02002D8C: .word UNK_02106FC8
-_02002D90: .word UNK_020ECB54
-
- thumb_func_start FUN_02002D94
-FUN_02002D94: ; 0x02002D94
- push {r3, lr}
- ldr r2, _02002DAC ; =UNK_02106FC8
- lsl r0, r0, #0x2
- ldr r2, [r2, #0x0]
- add r0, r2, r0
- add r0, #0x94
- ldr r0, [r0, #0x0]
- bl FUN_02021750
- ldr r0, _02002DAC ; =UNK_02106FC8
- ldr r0, [r0, #0x0]
- pop {r3, pc}
- .balign 4
-_02002DAC: .word UNK_02106FC8
-
- thumb_func_start FontFunc
-FontFunc: ; 0x02002DB0
- push {r4, lr}
- add r3, r1, #0x0
- add r3, #0x1c
- ldrb r2, [r3, #0x1]
- lsl r2, r2, #0x18
- lsr r2, r2, #0x1f
- bne _02002DD8
- ldrb r2, [r3, #0x0]
- mov r4, #0xf
- lsl r0, r0, #0x18
- bic r2, r4
- lsr r4, r0, #0x18
- mov r0, #0xf
- and r0, r4
- orr r0, r2
- strb r0, [r3, #0x0]
- ldrb r2, [r3, #0x1]
- mov r0, #0x80
- orr r0, r2
- strb r0, [r3, #0x1]
-_02002DD8:
- add r0, r1, #0x0
- bl RenderText
- pop {r4, pc}
-
- thumb_func_start FUN_02002DE0
-FUN_02002DE0: ; 0x02002DE0
- push {r4-r6, lr}
- lsl r4, r0, #0x2
- ldr r0, _02002E10 ; =UNK_02106FC8
- add r5, r1, #0x0
- ldr r0, [r0, #0x0]
- add r6, r2, #0x0
- add r0, r0, r4
- add r0, #0x94
- ldr r0, [r0, #0x0]
- cmp r0, #0x0
- bne _02002DFA
- bl GF_AssertFail
-_02002DFA:
- ldr r0, _02002E10 ; =UNK_02106FC8
- add r1, r5, #0x0
- ldr r0, [r0, #0x0]
- add r2, r6, #0x0
- add r0, r0, r4
- add r0, #0x94
- ldr r0, [r0, #0x0]
- bl FUN_020218D8
- pop {r4-r6, pc}
- nop
-_02002E10: .word UNK_02106FC8
-
- thumb_func_start FUN_02002E14
-FUN_02002E14: ; 0x02002E14
- push {r4-r6, lr}
- lsl r4, r0, #0x2
- ldr r0, _02002E48 ; =UNK_02106FC8
- add r5, r1, #0x0
- ldr r0, [r0, #0x0]
- add r6, r2, #0x0
- add r0, r0, r4
- add r0, #0x94
- ldr r0, [r0, #0x0]
- cmp r0, #0x0
- bne _02002E2E
- bl GF_AssertFail
-_02002E2E:
- add r0, r5, #0x0
- bl String_c_str
- add r1, r0, #0x0
- ldr r0, _02002E48 ; =UNK_02106FC8
- add r2, r6, #0x0
- ldr r0, [r0, #0x0]
- add r0, r0, r4
- add r0, #0x94
- ldr r0, [r0, #0x0]
- bl FUN_020218D8
- pop {r4-r6, pc}
- .balign 4
-_02002E48: .word UNK_02106FC8
-
- thumb_func_start GetFontAttribute
-GetFontAttribute: ; 0x02002E4C
- mov r2, #0x0
- cmp r1, #0x7
- bhi _02002EAC
- add r1, r1, r1
- add r1, pc
- ldrh r1, [r1, #0x6]
- lsl r1, r1, #0x10
- asr r1, r1, #0x10
- add pc, r1
-_02002E5E: ; jump table (using 16-bit offset)
- .short _02002E6E - _02002E5E - 2; case 0
- .short _02002E76 - _02002E5E - 2; case 1
- .short _02002E7E - _02002E5E - 2; case 2
- .short _02002E86 - _02002E5E - 2; case 3
- .short _02002E8E - _02002E5E - 2; case 4
- .short _02002E96 - _02002E5E - 2; case 5
- .short _02002E9E - _02002E5E - 2; case 6
- .short _02002EA6 - _02002E5E - 2; case 7
-_02002E6E:
- lsl r1, r0, #0x3
- ldr r0, _02002EB0 ; =UNK_020ECB64
- ldrb r2, [r0, r1]
- b _02002EAC
-_02002E76:
- lsl r1, r0, #0x3
- ldr r0, _02002EB4 ; =UNK_020ECB64 + 1
- ldrb r2, [r0, r1]
- b _02002EAC
-_02002E7E:
- lsl r1, r0, #0x3
- ldr r0, _02002EB8 ; =UNK_020ECB64 + 2
- ldrb r2, [r0, r1]
- b _02002EAC
-_02002E86:
- lsl r1, r0, #0x3
- ldr r0, _02002EBC ; =UNK_020ECB64 + 3
- ldrb r2, [r0, r1]
- b _02002EAC
-_02002E8E:
- lsl r1, r0, #0x3
- ldr r0, _02002EC0 ; =UNK_020ECB64 + 4
- ldrb r2, [r0, r1]
- b _02002EAC
-_02002E96:
- lsl r1, r0, #0x3
- ldr r0, _02002EC4 ; =UNK_020ECB64 + 5
- ldrb r2, [r0, r1]
- b _02002EAC
-_02002E9E:
- lsl r1, r0, #0x3
- ldr r0, _02002EC8 ; =UNK_020ECB64 + 6
- ldrb r2, [r0, r1]
- b _02002EAC
-_02002EA6:
- lsl r1, r0, #0x3
- ldr r0, _02002ECC ; =UNK_020ECB64 + 7
- ldrb r2, [r0, r1]
-_02002EAC:
- add r0, r2, #0x0
- bx lr
- .balign 4
-_02002EB0: .word UNK_020ECB64
-_02002EB4: .word UNK_020ECB64 + 1
-_02002EB8: .word UNK_020ECB64 + 2
-_02002EBC: .word UNK_020ECB64 + 3
-_02002EC0: .word UNK_020ECB64 + 4
-_02002EC4: .word UNK_020ECB64 + 5
-_02002EC8: .word UNK_020ECB64 + 6
-_02002ECC: .word UNK_020ECB64 + 7
-
- thumb_func_start FUN_02002ED0
-FUN_02002ED0: ; 0x02002ED0
- push {r4, lr}
- sub sp, #0x8
- add r4, r0, #0x0
- mov r0, #0x20
- str r0, [sp, #0x0]
- add r3, r1, #0x0
- str r2, [sp, #0x4]
- mov r0, #0xe
- mov r1, #0x6
- add r2, r4, #0x0
- bl GfGfxLoader_GXLoadPal
- add sp, #0x8
- pop {r4, pc}
-
- thumb_func_start FUN_02002EEC
-FUN_02002EEC: ; 0x02002EEC
- push {r4, lr}
- sub sp, #0x8
- add r4, r0, #0x0
- mov r0, #0x20
- str r0, [sp, #0x0]
- add r3, r1, #0x0
- str r2, [sp, #0x4]
- mov r0, #0xe
- mov r1, #0x7
- add r2, r4, #0x0
- bl GfGfxLoader_GXLoadPal
- add sp, #0x8
- pop {r4, pc}
diff --git a/arm9/src/error_message_reset.c b/arm9/src/error_message_reset.c
index e0d01bde..d49e8e51 100644
--- a/arm9/src/error_message_reset.c
+++ b/arm9/src/error_message_reset.c
@@ -5,6 +5,7 @@
#include "unk_0202F150.h"
#include "bg_window.h"
#include "PAD_pad.h"
+#include "font.h"
const struct WindowTemplate UNK_020FF49C = {
@@ -43,7 +44,6 @@ u32 sErrorMessagePrinterLock;
extern void FUN_0200E3A0(PMLCDTarget, int);
extern void FUN_0200CB00(struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5);
-extern void FUN_02002ED0(u32 param0, u32 param1, u32 param2);
extern void FUN_0200CCA4(struct Window *param0, u32 param1, u32 param2, u32 param3);
extern void FUN_0200E394(u32 param0);
extern void FUN_0200A274(u32 param0, u32 param1, u32 param2);
diff --git a/arm9/src/font.c b/arm9/src/font.c
new file mode 100644
index 00000000..98885671
--- /dev/null
+++ b/arm9/src/font.c
@@ -0,0 +1,173 @@
+#include "global.h"
+#include "font.h"
+#include "gf_gfx_loader.h"
+#include "render_text.h"
+#include "string16.h"
+#include "text.h"
+#include "graphic/font.naix"
+
+struct UnkStruct_02002C14 *UNK_02106FC8;
+
+struct UnkStruct_02002C14 UNK_02106FCC;
+
+const u16 UNK_020ECB54[4][2] = { {0, 0}, {1, 0}, {2, 0}, {3, 0} };
+
+const struct FontInfo gFontInfos[5] = {
+ { 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02 },
+ { 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02 },
+ { 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02 },
+ { 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02 },
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+};
+
+extern u32 FUN_02021590(u32, u16, u32, u16, u32);
+extern void FUN_020215E0(u32, u32, u32);
+extern void FUN_020215C8(u32 param0);
+extern void FUN_02021750(void *, u32);
+extern u32 FUN_020218D8(void *, u16 *str, u32);
+
+THUMB_FUNC void FUN_02002C14()
+{
+ UNK_02106FC8 = &UNK_02106FCC;
+
+ for (u32 i = 0; i < 4; i++)
+ {
+ UNK_02106FC8->unk84[i] = NULL;
+ UNK_02106FC8->unk94[i] = NULL;
+ }
+
+ SetFontsPointer(&gFontInfos[0]);
+}
+
+THUMB_FUNC void FUN_02002C50(u32 param0, u32 param1)
+{
+ UNK_02106FC8->unk94[param0] =
+ FUN_02021590(14, UNK_020ECB54[param0][0], 1, UNK_020ECB54[param0][1], param1);
+}
+
+THUMB_FUNC void FUN_02002C84(s32 param0, u32 param1)
+{
+ GF_ASSERT(param0 < 4);
+ GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL);
+
+ FUN_020215E0(UNK_02106FC8->unk94[param0], 0, param1);
+}
+
+THUMB_FUNC void FUN_02002CC0(s32 param0)
+{
+ GF_ASSERT(param0 < 4);
+ GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL);
+
+ FUN_020215E0(UNK_02106FC8->unk94[param0], 1, 0);
+}
+
+THUMB_FUNC void FUN_02002CF8(int param0)
+{
+
+ GF_ASSERT(param0 < 4);
+
+ if (UNK_02106FC8->unk84[param0] != NULL)
+ {
+ u32 i;
+ for (i = 0; i < 4; i++)
+ {
+ if (i != param0 && UNK_020ECB54[i][0] == UNK_020ECB54[param0][0] &&
+ UNK_02106FC8->unk94[i] != NULL)
+ {
+ UNK_02106FC8->unk84[i] = UNK_02106FC8->unk84[param0];
+ break;
+ }
+ }
+
+ if (i == 4)
+ {
+ FreeToHeap(UNK_02106FC8->unk84[param0]);
+ UNK_02106FC8->unk84[param0] = NULL;
+ }
+ }
+
+ if (UNK_02106FC8->unk94[param0] != NULL)
+ {
+ FUN_020215C8(UNK_02106FC8->unk94[param0]);
+ UNK_02106FC8->unk94[param0] = NULL;
+ }
+}
+
+THUMB_FUNC struct UnkStruct_02002C14 *FUN_02002D94(u32 param0, u32 param1)
+{
+ FUN_02021750(UNK_02106FC8->unk94[param0], param1);
+
+ return UNK_02106FC8;
+}
+
+THUMB_FUNC u32 FontFunc(u32 fontId, struct TextPrinter *printer)
+{
+ struct TextPrinterSubStruct *subStruct =
+ (struct TextPrinterSubStruct *)(&printer->subStructFields);
+
+ if (subStruct->hasGlyphIdBeenSet == 0)
+ {
+ subStruct->glyphId = fontId;
+ subStruct->hasGlyphIdBeenSet = 1;
+ }
+
+ return RenderText(printer);
+}
+
+THUMB_FUNC u32 FUN_02002DE0(u32 param0, u16 *str, u32 param2)
+{
+ GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL);
+
+ FUN_020218D8(UNK_02106FC8->unk94[param0], str, param2);
+}
+
+THUMB_FUNC u32 FUN_02002E14(u32 param0, struct String *str, u32 param2)
+{
+ GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL);
+
+ FUN_020218D8(UNK_02106FC8->unk94[param0], String_c_str(str), param2);
+}
+
+THUMB_FUNC s32 GetFontAttribute(u8 fontId, s32 attr)
+{
+ u8 ret = 0;
+ switch (attr)
+ {
+ case 0:
+ ret = gFontInfos[fontId].maxLetterWidth;
+ break;
+ case 1:
+ ret = gFontInfos[fontId].maxLetterHeight;
+ break;
+ case 2:
+ ret = gFontInfos[fontId].letterSpacing;
+ break;
+ case 3:
+ ret = gFontInfos[fontId].lineSpacing;
+ break;
+ case 4:
+ ret = gFontInfos[fontId].unk;
+ break;
+ case 5:
+ ret = gFontInfos[fontId].fgColor;
+ break;
+ case 6:
+ ret = gFontInfos[fontId].bgColor;
+ break;
+ case 7:
+ ret = gFontInfos[fontId].shadowColor;
+ break;
+ }
+
+ return ret;
+}
+
+THUMB_FUNC void FUN_02002ED0(u32 layer, u32 baseAddr, u32 heap_id)
+{
+ GfGfxLoader_GXLoadPal(NARC_GRAPHIC_FONT, NARC_font_narc_0006_NCLR, layer, baseAddr, 0x20, heap_id);
+}
+
+THUMB_FUNC void FUN_02002EEC(u32 layer, u32 baseAddr, u32 heap_id)
+{
+ GfGfxLoader_GXLoadPal(NARC_GRAPHIC_FONT, NARC_font_narc_0007_NCLR, layer, baseAddr, 0x20, heap_id);
+}
diff --git a/arm9/src/list_menu.c b/arm9/src/list_menu.c
index 033d06f9..b21818d3 100644
--- a/arm9/src/list_menu.c
+++ b/arm9/src/list_menu.c
@@ -3,6 +3,7 @@
#include "main.h"
#include "list_menu.h"
#include "text.h"
+#include "font.h"
void ListMenuPrintEntries(struct ListMenu * list, u16 startIndex, u16 yOffset, u16 count);
void ListMenuDrawCursor(struct ListMenu * list);
diff --git a/arm9/src/main.c b/arm9/src/main.c
index 979fb7ca..46f8add7 100644
--- a/arm9/src/main.c
+++ b/arm9/src/main.c
@@ -15,6 +15,7 @@
#include "unk_02031734.h"
#include "unk_0202F150.h"
#include "module_52.h"
+#include "font.h"
FS_EXTERN_OVERLAY(MODULE_52);
FS_EXTERN_OVERLAY(MODULE_63);
@@ -27,8 +28,6 @@ struct UnkStruct_02016FA8 UNK_02016FA8;
extern void FUN_02022294(void);
extern void GF_InitRTCWork(void);
-extern void FUN_02002C14(void);
-extern void FUN_02002C50(int, int);
extern int FUN_020337E8(int);
extern void FUN_02034188(int, int);
extern void FUN_02089D90(int);
diff --git a/arm9/src/render_text.c b/arm9/src/render_text.c
index af0218c8..34777739 100644
--- a/arm9/src/render_text.c
+++ b/arm9/src/render_text.c
@@ -4,6 +4,7 @@
#include "string_util.h"
#include "text.h"
#include "unk_0201B8B8.h"
+#include "font.h"
u16 unk00;
@@ -11,7 +12,6 @@ TextFlags gTextFlags;
const u8 UNK_020ECB50[] = { 0, 1, 2, 1 };
-extern const char *FUN_02002D94(u8, u16);
extern void PlaySE(u16);
THUMB_FUNC u32 RenderText(struct TextPrinter *printer)
@@ -207,16 +207,16 @@ THUMB_FUNC u32 RenderText(struct TextPrinter *printer)
return 3;
}
- const char *r5 = FUN_02002D94(subStruct->glyphId, currentChar);
+ struct UnkStruct_02002C14 *r5 = FUN_02002D94(subStruct->glyphId, currentChar);
CopyGlyphToWindow(printer->printerTemplate.window,
- r5,
- r5[0x80],
- r5[0x81],
+ r5->buf,
+ r5->width,
+ r5->height,
printer->printerTemplate.currentX,
printer->printerTemplate.currentY,
printer->printerTemplate.unk2);
- printer->printerTemplate.currentX += r5[0x80] + printer->printerTemplate.letterSpacing;
+ printer->printerTemplate.currentX += r5->width + printer->printerTemplate.letterSpacing;
return 0;
case 1:
diff --git a/arm9/src/text.c b/arm9/src/text.c
index 36349b8b..8ca16d55 100644
--- a/arm9/src/text.c
+++ b/arm9/src/text.c
@@ -5,6 +5,7 @@
#include "filesystem.h"
#include "script_buffers.h"
#include "unk_0200CA44.h"
+#include "font.h"
const struct FontInfo *gFonts = NULL;
@@ -19,7 +20,6 @@ extern struct TextPrinter *FUN_0201B6C8(void);
extern void FUN_0201C1A8(struct TextPrinter *printer);
-extern u32 FontFunc(u8 fontId, struct TextPrinter *printer);
extern void * GfGfxLoader_GetCharData(NarcId, s32, s32, struct UnkStruct_0200B870_sub **, u32);
diff --git a/arm9/src/text_02054590.c b/arm9/src/text_02054590.c
index f5527257..3c3d0fed 100644
--- a/arm9/src/text_02054590.c
+++ b/arm9/src/text_02054590.c
@@ -1,11 +1,10 @@
#include "text_02054590.h"
#include "text.h"
#include "bg_window.h"
+#include "font.h"
#include "render_text.h"
extern void FUN_0201BD5C(void);
-extern void FUN_02002ED0(u32 param0, u32 param1, u32 param2);
-extern void FUN_02002EEC(u32 param0, u32 param1, u32 param2);
extern void FUN_0200CD68(
struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5);
diff --git a/arm9/src/unk_02064E4C.c b/arm9/src/unk_02064E4C.c
index 90ff8340..6bcb5d33 100644
--- a/arm9/src/unk_02064E4C.c
+++ b/arm9/src/unk_02064E4C.c
@@ -1,11 +1,10 @@
#include "global.h"
#include "map_header.h"
#include "unk_02064E4C.h"
+#include "font.h"
#pragma thumb on
-// TODO: types of a0 and a2 aren't known yet
-extern void FUN_02002E14(void * a0, struct String * str, void * a2);
void FUN_02064E4C(struct MsgData * msgData, u16 map_sec, struct String * dest)
{
diff --git a/include/font.h b/include/font.h
index e5e64e88..3818fb7b 100644
--- a/include/font.h
+++ b/include/font.h
@@ -1,6 +1,29 @@
#ifndef POKEDIAMOND_FONT_H
#define POKEDIAMOND_FONT_H
-extern s32 GetFontAttribute(u8 fontId, s32 attr);
+#include "global.h"
+#include "text.h"
+
+struct UnkStruct_02002C14
+{
+ const char buf[0x80];
+ u8 width;
+ u8 height;
+ void *unk84[4];
+ void *unk94[4];
+};
+
+void FUN_02002C14();
+void FUN_02002C50(u32 param0, u32 param1);
+void FUN_02002C84(s32 param0, u32 param1);
+void FUN_02002CC0(s32 param0);
+void FUN_02002CF8(int param0);
+struct UnkStruct_02002C14 *FUN_02002D94(u32 param0, u32 param1);
+u32 FontFunc(u32 fontId, struct TextPrinter *printer);
+u32 FUN_02002DE0(u32 param0, u16 *str, u32 param2);
+u32 FUN_02002E14(u32 param0, struct String *str, u32 param2);
+s32 GetFontAttribute(u8 fontId, s32 attr);
+void FUN_02002ED0(u32 layer, u32 baseAddr, u32 heap_id);
+void FUN_02002EEC(u32 layer, u32 baseAddr, u32 heap_id);
#endif // POKEDIAMOND_FONT_H
diff --git a/include/text.h b/include/text.h
index 034447c7..ad0698a0 100644
--- a/include/text.h
+++ b/include/text.h
@@ -2,7 +2,6 @@
#define POKEDIAMOND_TEXT_H
#include "global.h"
-#include "font.h"
#include "bg_window.h"