From 75b9be7f7c53ead5beb594e01dab4a33d6b780a3 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 10 Mar 2021 17:26:54 +0000 Subject: start of text.c --- include/text.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 8b7fe896..fb31b86b 100644 --- a/include/text.h +++ b/include/text.h @@ -1,6 +1,60 @@ #ifndef POKEDIAMOND_TEXT_H #define POKEDIAMOND_TEXT_H -void GetSpeciesNameIntoArray(u16 species, u32 heap_id, u16 * dest); +#include "global.h" + +struct TextPrinterTemplate +{ + const u8* currentChar; + u8 windowId; + u8 fontId; + u8 x; + u8 y; + u8 currentX; // 0x8 + u8 currentY; + u8 letterSpacing; + u8 lineSpacing; + u8 unk:4; // 0xC + u8 fgColor:4; + u8 bgColor:4; + u8 shadowColor:4; +}; + +struct TextPrinter +{ + struct TextPrinterTemplate printerTemplate; + + void (*callback)(struct TextPrinterTemplate *, u16); // 0x10 + + u8 subStructFields[7]; // always cast to struct TextPrinterSubStruct... so why bother + u8 active; + u8 state; // 0x1C + u8 textSpeed; + u8 delayCounter; + u8 scrollDistance; + u8 minLetterSpacing; // 0x20 + u8 japanese; +}; + +struct FontInfo +{ + u16 (*fontFunction)(struct TextPrinter *x); + u8 maxLetterWidth; + u8 maxLetterHeight; + u8 letterSpacing; + u8 lineSpacing; + u8 unk:4; + u8 fgColor:4; + u8 bgColor:4; + u8 shadowColor:4; +}; + +void SetFontsPointer(const struct FontInfo *fonts); +u8 FUN_0201BCC8(void *param0, u32 param1, u32 param2); +void FUN_0201BCFC(u32 param0); +BOOL FUN_0201BD44(u32 param0); +void FUN_0201BD5C(void); +u8 FUN_0201BD70(u32 param0); +void FUN_0201BCFC(u32 param0); #endif //POKEDIAMOND_TEXT_H -- cgit v1.2.3 From 253e743399d41bd5b3a10b65308a962924563196 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 10 Mar 2021 21:45:44 +0000 Subject: AddTextPrinterParameterized --- include/text.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index fb31b86b..ca7ea133 100644 --- a/include/text.h +++ b/include/text.h @@ -6,18 +6,22 @@ struct TextPrinterTemplate { const u8* currentChar; - u8 windowId; + u32 windowId; + u8 padding[1]; u8 fontId; u8 x; u8 y; - u8 currentX; // 0x8 + u8 currentX; u8 currentY; u8 letterSpacing; u8 lineSpacing; - u8 unk:4; // 0xC - u8 fgColor:4; - u8 bgColor:4; - u8 shadowColor:4; + u8 unk; + u8 fgColor; + u8 bgColor; + u8 shadowColor; + u16 unk2; + u8 unk3; + u8 unk4; }; struct TextPrinter @@ -38,15 +42,14 @@ struct TextPrinter struct FontInfo { - u16 (*fontFunction)(struct TextPrinter *x); u8 maxLetterWidth; u8 maxLetterHeight; u8 letterSpacing; u8 lineSpacing; - u8 unk:4; - u8 fgColor:4; - u8 bgColor:4; - u8 shadowColor:4; + u8 unk; + u8 fgColor; + u8 bgColor; + u8 shadowColor; }; void SetFontsPointer(const struct FontInfo *fonts); @@ -56,5 +59,6 @@ BOOL FUN_0201BD44(u32 param0); void FUN_0201BD5C(void); u8 FUN_0201BD70(u32 param0); void FUN_0201BCFC(u32 param0); +u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, void (*callback)(void *, u16)); #endif //POKEDIAMOND_TEXT_H -- cgit v1.2.3 From c00f7030cbfd128dec0387d7ea9e45885d0d0f93 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 10 Mar 2021 22:41:14 +0000 Subject: paramatised2 and 3 --- include/text.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index ca7ea133..edc5f58c 100644 --- a/include/text.h +++ b/include/text.h @@ -60,5 +60,7 @@ void FUN_0201BD5C(void); u8 FUN_0201BD70(u32 param0); void FUN_0201BCFC(u32 param0); u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, void (*callback)(void *, u16)); +u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, void (*callback)(void *, u16)); +u16 AddTextPrinterParameterized3(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, void (*callback)(void *, u16)); #endif //POKEDIAMOND_TEXT_H -- cgit v1.2.3 From 82b20d5a8badb77010fb5dfc4d20b9282985703a Mon Sep 17 00:00:00 2001 From: red031000 Date: Thu, 11 Mar 2021 22:03:17 +0000 Subject: decompile AddTextPrinter --- include/text.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index edc5f58c..fab36565 100644 --- a/include/text.h +++ b/include/text.h @@ -5,7 +5,7 @@ struct TextPrinterTemplate { - const u8* currentChar; + const u16* currentChar; u32 windowId; u8 padding[1]; u8 fontId; @@ -33,11 +33,13 @@ struct TextPrinter u8 subStructFields[7]; // always cast to struct TextPrinterSubStruct... so why bother u8 active; u8 state; // 0x1C - u8 textSpeed; + u8 textSpeedBottom:7; + u8 textSpeedTop:1; u8 delayCounter; u8 scrollDistance; u8 minLetterSpacing; // 0x20 u8 japanese; + u8 padding[6]; }; struct FontInfo @@ -53,14 +55,15 @@ struct FontInfo }; void SetFontsPointer(const struct FontInfo *fonts); -u8 FUN_0201BCC8(void *param0, u32 param1, u32 param2); +u8 FUN_0201BCC8(void *func, struct TextPrinter *printer, u32 param2); void FUN_0201BCFC(u32 param0); BOOL FUN_0201BD44(u32 param0); void FUN_0201BD5C(void); u8 FUN_0201BD70(u32 param0); -void FUN_0201BCFC(u32 param0); -u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, void (*callback)(void *, u16)); -u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, void (*callback)(void *, u16)); -u16 AddTextPrinterParameterized3(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, void (*callback)(void *, u16)); +void FUN_0201BD7C(u32 param0); +u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, void (*callback)(struct TextPrinterTemplate *, u16)); +u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, void (*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, void (*callback)(struct TextPrinterTemplate *, u16)); +u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, void (*callback)(struct TextPrinterTemplate *, u16)); #endif //POKEDIAMOND_TEXT_H -- cgit v1.2.3 From fd3ac04d131ba3237c90695b2a59f11959af75ce Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 12 Mar 2021 04:04:34 +0000 Subject: RunTextPrinter --- include/text.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index fab36565..06b7f52a 100644 --- a/include/text.h +++ b/include/text.h @@ -28,7 +28,7 @@ struct TextPrinter { struct TextPrinterTemplate printerTemplate; - void (*callback)(struct TextPrinterTemplate *, u16); // 0x10 + u8 (*callback)(struct TextPrinterTemplate *, u16); // 0x10 u8 subStructFields[7]; // always cast to struct TextPrinterSubStruct... so why bother u8 active; @@ -38,8 +38,9 @@ struct TextPrinter u8 delayCounter; u8 scrollDistance; u8 minLetterSpacing; // 0x20 - u8 japanese; - u8 padding[6]; + u8 Unk29; // used to be japanese, not sure about that anymore + u16 Unk2A; + u8 padding[4]; }; struct FontInfo @@ -61,9 +62,10 @@ 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, void (*callback)(struct TextPrinterTemplate *, u16)); -u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, void (*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, void (*callback)(struct TextPrinterTemplate *, u16)); -u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, void (*callback)(struct TextPrinterTemplate *, u16)); +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 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)); +void RunTextPrinter(u32 param0, struct TextPrinter *printer); #endif //POKEDIAMOND_TEXT_H -- cgit v1.2.3 From 63bcf753d4d57c1585140c7b3eec1aace1e89caf Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 12 Mar 2021 17:21:48 +0000 Subject: GenerateFontHalfRowLookupTable nonmatching --- include/text.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 06b7f52a..48c3cbf4 100644 --- a/include/text.h +++ b/include/text.h @@ -56,7 +56,7 @@ struct FontInfo }; void SetFontsPointer(const struct FontInfo *fonts); -u8 FUN_0201BCC8(void *func, struct TextPrinter *printer, u32 param2); +u8 FUN_0201BCC8(void (*func)(u32, struct TextPrinter *), struct TextPrinter *printer, u32 param2); void FUN_0201BCFC(u32 param0); BOOL FUN_0201BD44(u32 param0); void FUN_0201BD5C(void); @@ -67,5 +67,7 @@ u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u16 *str, u32 x, 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 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)); void RunTextPrinter(u32 param0, struct TextPrinter *printer); +u32 RenderFont(struct TextPrinter *printer); +void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); #endif //POKEDIAMOND_TEXT_H -- cgit v1.2.3 From bc398f3c399b5211a8b8ed38702670df654c66db Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 12 Mar 2021 20:54:37 +0000 Subject: finished text.c --- include/text.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 48c3cbf4..40f4d03a 100644 --- a/include/text.h +++ b/include/text.h @@ -19,9 +19,16 @@ struct TextPrinterTemplate u8 fgColor; u8 bgColor; u8 shadowColor; - u16 unk2; - u8 unk3; - u8 unk4; + union + { + struct + { + u16 unk2; + u8 unk3; + u8 unk4; + }; + u32 Unk20; //todo this can't be right + }; }; struct TextPrinter @@ -40,7 +47,7 @@ struct TextPrinter u8 minLetterSpacing; // 0x20 u8 Unk29; // used to be japanese, not sure about that anymore u16 Unk2A; - u8 padding[4]; + void *Unk2C; }; struct FontInfo @@ -69,5 +76,10 @@ u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, u8 (* void RunTextPrinter(u32 param0, struct TextPrinter *printer); 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); +void FUN_0201C1EC(struct TextPrinter *printer, u32 param1, u32 param2, u32 param3); +void FUN_0201C238(struct TextPrinter *printer); #endif //POKEDIAMOND_TEXT_H -- cgit v1.2.3