diff options
author | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-06-21 18:39:48 +0200 |
---|---|---|
committer | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-06-21 18:39:48 +0200 |
commit | b5f7ed050093b9c233c22eb6f3bef5bf9653df93 (patch) | |
tree | 76206b91c25e8e5974f9fd45033f8336946386ae | |
parent | 0cf772380460abc0a2a74db4c1705a3b4c464144 (diff) |
rename into font.c and add headers
-rw-r--r-- | arm9/arm9.lsf | 2 | ||||
-rw-r--r-- | arm9/src/error_message_reset.c | 2 | ||||
-rw-r--r-- | arm9/src/font.c (renamed from arm9/src/unk_02002C14.c) | 34 | ||||
-rw-r--r-- | arm9/src/list_menu.c | 1 | ||||
-rw-r--r-- | arm9/src/main.c | 3 | ||||
-rw-r--r-- | arm9/src/render_text.c | 12 | ||||
-rw-r--r-- | arm9/src/text.c | 2 | ||||
-rw-r--r-- | arm9/src/text_02054590.c | 3 | ||||
-rw-r--r-- | arm9/src/unk_02064E4C.c | 3 | ||||
-rw-r--r-- | include/font.h | 25 | ||||
-rw-r--r-- | include/text.h | 1 |
11 files changed, 51 insertions, 37 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/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/unk_02002C14.c b/arm9/src/font.c index b8c59cad..7bf618f5 100644 --- a/arm9/src/unk_02002C14.c +++ b/arm9/src/font.c @@ -1,23 +1,17 @@ #include "global.h" +#include "font.h" #include "gf_gfx_loader.h" #include "render_text.h" #include "string16.h" #include "text.h" -struct UnkStruct *UNK_02106FC8; +struct UnkStruct_02002C14 *UNK_02106FC8; -struct UnkStruct -{ - u8 unk00[0x84]; - void *unk84[4]; - void *unk94[4]; -}; - -struct UnkStruct UNK_02106FCC; +struct UnkStruct_02002C14 UNK_02106FCC; const u16 UNK_020ECB54[] = { 0, 0, 1, 0, 2, 0, 3, 0 }; -const struct FontInfo UNK_020ECB64[5] = { +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 }, @@ -41,7 +35,7 @@ THUMB_FUNC void FUN_02002C14() UNK_02106FC8->unk94[i] = NULL; } - SetFontsPointer(&UNK_020ECB64[0]); + SetFontsPointer(&gFontInfos[0]); } THUMB_FUNC void FUN_02002C50(u32 param0, u32 param1) @@ -192,7 +186,7 @@ _02002D88: } #endif -THUMB_FUNC struct UnkStruct *FUN_02002D94(u32 param0, u32 param1) +THUMB_FUNC struct UnkStruct_02002C14 *FUN_02002D94(u32 param0, u32 param1) { FUN_02021750(UNK_02106FC8->unk94[param0], param1); @@ -233,28 +227,28 @@ THUMB_FUNC s32 GetFontAttribute(u8 fontId, s32 attr) switch (attr) { case 0: - ret = UNK_020ECB64[fontId].maxLetterWidth; + ret = gFontInfos[fontId].maxLetterWidth; break; case 1: - ret = UNK_020ECB64[fontId].maxLetterHeight; + ret = gFontInfos[fontId].maxLetterHeight; break; case 2: - ret = UNK_020ECB64[fontId].letterSpacing; + ret = gFontInfos[fontId].letterSpacing; break; case 3: - ret = UNK_020ECB64[fontId].lineSpacing; + ret = gFontInfos[fontId].lineSpacing; break; case 4: - ret = UNK_020ECB64[fontId].unk; + ret = gFontInfos[fontId].unk; break; case 5: - ret = UNK_020ECB64[fontId].fgColor; + ret = gFontInfos[fontId].fgColor; break; case 6: - ret = UNK_020ECB64[fontId].bgColor; + ret = gFontInfos[fontId].bgColor; break; case 7: - ret = UNK_020ECB64[fontId].shadowColor; + ret = gFontInfos[fontId].shadowColor; break; } 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 766862f1..5b33ea34 100644 --- a/arm9/src/text_02054590.c +++ b/arm9/src/text_02054590.c @@ -1,10 +1,9 @@ #include "text_02054590.h" #include "text.h" #include "bg_window.h" +#include "font.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..bddf6411 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(s32 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" |