diff options
Diffstat (limited to 'arm9/src/font.c')
-rw-r--r-- | arm9/src/font.c | 66 |
1 files changed, 62 insertions, 4 deletions
diff --git a/arm9/src/font.c b/arm9/src/font.c index e09b0341..6c838892 100644 --- a/arm9/src/font.c +++ b/arm9/src/font.c @@ -1,16 +1,17 @@ #include "global.h" #include "font.h" #include "gf_gfx_loader.h" +#include "graphic/font.naix" #include "render_text.h" #include "string16.h" #include "text.h" -#include "graphic/font.naix" +#include "unk_0201B8B8.h" 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 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 }, @@ -164,10 +165,67 @@ THUMB_FUNC s32 GetFontAttribute(u8 fontId, s32 attr) 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); + 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); + GfGfxLoader_GXLoadPal( + NARC_GRAPHIC_FONT, NARC_font_narc_0007_NCLR, layer, baseAddr, 0x20, heap_id); +} + +THUMB_FUNC s32 FUN_02002F08(u32 param0, struct String *str, u32 param2) +{ + GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL); + + return StringGetWidth(UNK_02106FC8->unk94[param0], String_c_str(str), param2); +} + +THUMB_FUNC u32 FUN_02002F40(u32 param0, struct String *str, u32 param2, u32 param3) +{ + u32 r0 = FUN_02002E14(param0, str, param2); + if (r0 < param3) + { + return (param3 - r0) / 2; + } + + return 0; +} + +THUMB_FUNC u32 FUN_02002F58(const u16 *str) +{ + u32 r5 = 1; + while (*str != EOS) + { + if (*str == 0xFFFE) + { + str = MsgArray_SkipControlCode(str); + continue; + } + + if (*str == 0xE000) + { + r5++; + str++; + continue; + } + + str++; + } + + return r5; +} + +THUMB_FUNC u32 FUN_02002F90(struct String *str) +{ + return FUN_02002F58(String_c_str(str)); +} + +THUMB_FUNC s32 FUN_02002F9C(u32 param0, struct String *str) +{ + GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL); + + return StringGetWidth_SingleLine_HandleClearToControlCode( + UNK_02106FC8->unk94[param0], String_c_str(str)); } |