From 8df65ef7a08ee617dc858e4f40429c01f866f1dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Thu, 20 May 2021 19:22:55 +0200 Subject: more extern cleanups --- include/text.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 40f4d03a..0874f21d 100644 --- a/include/text.h +++ b/include/text.h @@ -2,11 +2,12 @@ #define POKEDIAMOND_TEXT_H #include "global.h" +#include "unk_02016B94.h" struct TextPrinterTemplate { const u16* currentChar; - u32 windowId; + struct Window *windowId; u8 padding[1]; u8 fontId; u8 x; -- cgit v1.2.3 From 11f1419d080f346574b7a83d528c42a9473d41ec Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 21 May 2021 12:51:26 -0400 Subject: ListMenuPrint --- include/text.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 40f4d03a..1218a0b3 100644 --- a/include/text.h +++ b/include/text.h @@ -3,10 +3,17 @@ #include "global.h" +// TODO: Move to its own header, and fill it out +struct Window +{ + u8 * unk_00; + u8 unk_04; +}; + struct TextPrinterTemplate { const u16* currentChar; - u32 windowId; + struct Window * window; u8 padding[1]; u8 fontId; u8 x; @@ -69,9 +76,9 @@ BOOL FUN_0201BD44(u32 param0); void FUN_0201BD5C(void); u8 FUN_0201BD70(u32 param0); void FUN_0201BD7C(u32 param0); -u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)); -u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, u8 (*callback)(struct TextPrinterTemplate *, u16)); -u16 AddTextPrinterParameterized3(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, u8 (*callback)(struct TextPrinterTemplate *, u16)); +u16 AddTextPrinterParameterized(struct Window * window, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)); +u16 AddTextPrinterParameterized2(struct Window * window, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, u8 (*callback)(struct TextPrinterTemplate *, u16)); +u16 AddTextPrinterParameterized3(struct Window * window, u32 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, u8 (*callback)(struct TextPrinterTemplate *, u16)); u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)); void RunTextPrinter(u32 param0, struct TextPrinter *printer); u32 RenderFont(struct TextPrinter *printer); -- cgit v1.2.3 From 70b098f92d46c134388e02bd8c436649fe31e999 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 21 May 2021 19:43:41 -0400 Subject: Fix parameterization --- include/text.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 1218a0b3..78bfb9d4 100644 --- a/include/text.h +++ b/include/text.h @@ -2,13 +2,8 @@ #define POKEDIAMOND_TEXT_H #include "global.h" - -// TODO: Move to its own header, and fill it out -struct Window -{ - u8 * unk_00; - u8 unk_04; -}; +#include "window.h" +#include "font.h" struct TextPrinterTemplate { -- cgit v1.2.3 From 4d5947ecb02e28fce1cd1156bd6908571fbf29bd Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 21 May 2021 21:50:44 -0400 Subject: Adjust typing in text.c routines --- include/text.h | 66 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 78bfb9d4..c9afc9b3 100644 --- a/include/text.h +++ b/include/text.h @@ -7,49 +7,49 @@ struct TextPrinterTemplate { - const u16* currentChar; - struct Window * window; - u8 padding[1]; - u8 fontId; - u8 x; - u8 y; - u8 currentX; - u8 currentY; - u8 letterSpacing; - u8 lineSpacing; - u8 unk; - u8 fgColor; - u8 bgColor; - u8 shadowColor; - union - { - struct - { - u16 unk2; - u8 unk3; - u8 unk4; - }; - u32 Unk20; //todo this can't be right - }; + const u16* currentChar; // 0 + struct Window * window; // 4 + u8 padding[1]; // 8 + u8 fontId; // 9 + u8 x; // a + u8 y; // b + u8 currentX; // c + u8 currentY; // d + u8 letterSpacing; // e + u8 lineSpacing; // f + u8 unk; // 10 + u8 fgColor; // 11 + u8 bgColor; // 12 + u8 shadowColor; // 13 + u16 unk2; // 14 + u8 unk3; // 16 + u8 unk4; // 17 +}; + +struct Font +{ + u8 filler[20]; + void * unk20; }; struct TextPrinter { struct TextPrinterTemplate printerTemplate; - u8 (*callback)(struct TextPrinterTemplate *, u16); // 0x10 + u8 (*callback)(struct TextPrinterTemplate *, u16); // 0x18 u8 subStructFields[7]; // always cast to struct TextPrinterSubStruct... so why bother - u8 active; - u8 state; // 0x1C - u8 textSpeedBottom:7; + // 1c + u8 active; // 23 + u8 state; // 0x24 + u8 textSpeedBottom:7; // 25 u8 textSpeedTop:1; - u8 delayCounter; - u8 scrollDistance; - u8 minLetterSpacing; // 0x20 + u8 delayCounter; // 26 + u8 scrollDistance; // 27 + u8 minLetterSpacing; // 0x28 u8 Unk29; // used to be japanese, not sure about that anymore u16 Unk2A; - void *Unk2C; + u16 *Unk2C; }; struct FontInfo @@ -80,7 +80,7 @@ u32 RenderFont(struct TextPrinter *printer); void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); void DecompressGlyphTile(const u16 *src, u16 *dst); void FUN_0201C1A8(struct TextPrinter *printer); -void *FUN_0201C1B0(void); +u16 *FUN_0201C1B0(void); void FUN_0201C1EC(struct TextPrinter *printer, u32 param1, u32 param2, u32 param3); void FUN_0201C238(struct TextPrinter *printer); -- cgit v1.2.3 From de6f8fc978e5297d3f425d2d6c8517e9bb8e75ff Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 22 May 2021 10:37:04 -0400 Subject: Merge conflicting prototypes --- include/text.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index c9afc9b3..57185a05 100644 --- a/include/text.h +++ b/include/text.h @@ -5,6 +5,17 @@ #include "window.h" #include "font.h" +#define CHAR_0 0x00A2 +#define CHAR_1 0x00A3 +#define CHAR_2 0x00A4 +#define CHAR_3 0x00A5 +#define CHAR_4 0x00A6 +#define CHAR_5 0x00A7 +#define CHAR_6 0x00A8 +#define CHAR_7 0x00A9 +#define CHAR_8 0x00AA +#define CHAR_9 0x00AB + struct TextPrinterTemplate { const u16* currentChar; // 0 @@ -26,12 +37,6 @@ struct TextPrinterTemplate u8 unk4; // 17 }; -struct Font -{ - u8 filler[20]; - void * unk20; -}; - struct TextPrinter { struct TextPrinterTemplate printerTemplate; -- cgit v1.2.3 From e14ce23516daf20a5fcd9ca6ca53f30d33c4ef24 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 22 May 2021 18:11:00 -0400 Subject: Decompile list_menu_items --- include/text.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 57185a05..514e8ba7 100644 --- a/include/text.h +++ b/include/text.h @@ -16,9 +16,15 @@ #define CHAR_8 0x00AA #define CHAR_9 0x00AB +union StrbufForPrint +{ + struct String * wrapped; + const u16 * raw; +}; + struct TextPrinterTemplate { - const u16* currentChar; // 0 + union StrbufForPrint currentChar; // 0 struct Window * window; // 4 u8 padding[1]; // 8 u8 fontId; // 9 @@ -76,9 +82,9 @@ BOOL FUN_0201BD44(u32 param0); void FUN_0201BD5C(void); u8 FUN_0201BD70(u32 param0); void FUN_0201BD7C(u32 param0); -u16 AddTextPrinterParameterized(struct Window * window, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)); -u16 AddTextPrinterParameterized2(struct Window * window, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, u8 (*callback)(struct TextPrinterTemplate *, u16)); -u16 AddTextPrinterParameterized3(struct Window * window, u32 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, u8 (*callback)(struct TextPrinterTemplate *, u16)); +u16 AddTextPrinterParameterized(struct Window * window, u8 fontId, struct String *str, u32 x, u32 y, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)); +u16 AddTextPrinterParameterized2(struct Window * window, u8 fontId, struct String *str, u32 x, u32 y, u32 speed, u32 colors, u8 (*callback)(struct TextPrinterTemplate *, u16)); +u16 AddTextPrinterParameterized3(struct Window * window, u32 fontId, struct String *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, u8 (*callback)(struct TextPrinterTemplate *, u16)); u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)); void RunTextPrinter(u32 param0, struct TextPrinter *printer); u32 RenderFont(struct TextPrinter *printer); -- cgit v1.2.3