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 --- arm9/arm9.lsf | 1 + arm9/asm/unk_02002C14.s | 2 +- arm9/asm/unk_0201BCBC.s | 144 +++--------------------------------------------- arm9/global.inc | 2 +- arm9/src/text.c | 85 ++++++++++++++++++++++++++++ include/text.h | 56 ++++++++++++++++++- 6 files changed, 150 insertions(+), 140 deletions(-) create mode 100644 arm9/src/text.c diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index b762561e..8f0b150b 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -55,6 +55,7 @@ Static arm9 Object unk_0201B6D0.o Object unk_0201B8B8.o Object math_util.o + Object text.o Object unk_0201BCBC.o Object unk_0201C24C.o Object unk_0201C360.o diff --git a/arm9/asm/unk_02002C14.s b/arm9/asm/unk_02002C14.s index c6fd3590..c4049d4b 100644 --- a/arm9/asm/unk_02002C14.s +++ b/arm9/asm/unk_02002C14.s @@ -53,7 +53,7 @@ _02002C22: cmp r1, #0x4 blo _02002C22 ldr r0, _02002C4C ; =UNK_020ECB64 - bl FUN_0201BCBC + bl SetFontsPointer pop {r4, pc} nop _02002C44: .word UNK_02106FCC diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s index 49d206bb..1f8efdda 100644 --- a/arm9/asm/unk_0201BCBC.s +++ b/arm9/asm/unk_0201BCBC.s @@ -1,146 +1,16 @@ .include "asm/macros.inc" .include "global.inc" - .section .data - - .global gFonts -gFonts: ; 0x02105BB4 - .word 0 - - .section .bss - - .global UNK_021C570C -UNK_021C570C: ; 0x021C570C - .space 0x8 - - .global UNK_021C5714 -UNK_021C5714: ; 0x021C5714 - .space 0x20 - - .global UNK_021C5734 -UNK_021C5734: ; 0x021C5734 - .space 0x200 + .extern gFonts + .extern UNK_021C570C + .extern UNK_021C5714 + .extern UNK_021C5734 + .extern FUN_0201BCC8 + .extern FUN_0201BCFC + .extern FUN_0201BD44 .text - thumb_func_start FUN_0201BCBC -FUN_0201BCBC: ; 0x0201BCBC - ldr r1, _0201BCC4 ; =gFonts - str r0, [r1, #0x0] - bx lr - nop -_0201BCC4: .word gFonts - - thumb_func_start FUN_0201BCC8 -FUN_0201BCC8: ; 0x0201BCC8 - push {r4-r6, lr} - ldr r4, _0201BCF8 ; =UNK_021C5714 - mov r5, #0x0 -_0201BCCE: - ldr r3, [r4, #0x0] - cmp r3, #0x0 - bne _0201BCE8 - ldr r6, _0201BCF8 ; =UNK_021C5714 - lsl r4, r5, #0x2 - bl FUN_0200CA7C - str r0, [r6, r4] - ldr r0, [r6, r4] - cmp r0, #0x0 - bne _0201BCF0 - mov r5, #0x8 - b _0201BCF0 -_0201BCE8: - add r5, r5, #0x1 - add r4, r4, #0x4 - cmp r5, #0x8 - blt _0201BCCE -_0201BCF0: - lsl r0, r5, #0x18 - lsr r0, r0, #0x18 - pop {r4-r6, pc} - nop -_0201BCF8: .word UNK_021C5714 - - thumb_func_start FUN_0201BCFC -FUN_0201BCFC: ; 0x0201BCFC - push {r4-r6, lr} - add r5, r0, #0x0 - cmp r5, #0x8 - blo _0201BD08 - bl ErrorHandling -_0201BD08: - ldr r6, _0201BD40 ; =UNK_021C5714 - lsl r4, r5, #0x2 - ldr r0, [r6, r4] - cmp r0, #0x0 - bne _0201BD16 - bl ErrorHandling -_0201BD16: - cmp r5, #0x8 - bhs _0201BD3C - ldr r0, [r6, r4] - cmp r0, #0x0 - beq _0201BD3C - bl FUN_0201B6C8 - add r5, r0, #0x0 - beq _0201BD32 - bl FUN_0201C238 - add r0, r5, #0x0 - bl FreeToHeap -_0201BD32: - ldr r0, [r6, r4] - bl FUN_0200CAB4 - mov r0, #0x0 - str r0, [r6, r4] -_0201BD3C: - pop {r4-r6, pc} - nop -_0201BD40: .word UNK_021C5714 - - thumb_func_start FUN_0201BD44 -FUN_0201BD44: ; 0x0201BD44 - lsl r1, r0, #0x2 - ldr r0, _0201BD58 ; =UNK_021C5714 - ldr r0, [r0, r1] - cmp r0, #0x0 - beq _0201BD52 - mov r0, #0x1 - bx lr -_0201BD52: - mov r0, #0x0 - bx lr - nop -_0201BD58: .word UNK_021C5714 - - thumb_func_start FUN_0201BD5C -FUN_0201BD5C: ; 0x0201BD5C - mov r1, #0x0 - ldr r2, _0201BD6C ; =UNK_021C5714 - add r0, r1, #0x0 -_0201BD62: - add r1, r1, #0x1 - stmia r2!, {r0} - cmp r1, #0x8 - blt _0201BD62 - bx lr - .balign 4 -_0201BD6C: .word UNK_021C5714 - - thumb_func_start FUN_0201BD70 -FUN_0201BD70: ; 0x0201BD70 - push {r3, lr} - bl FUN_0201BD44 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - pop {r3, pc} - - thumb_func_start FUN_0201BD7C -FUN_0201BD7C: ; 0x0201BD7C - ldr r3, _0201BD80 ; =FUN_0201BCFC - bx r3 - .balign 4 -_0201BD80: .word FUN_0201BCFC - thumb_func_start AddTextPrinterParameterized AddTextPrinterParameterized: ; 0x0201BD84 push {r3, lr} diff --git a/arm9/global.inc b/arm9/global.inc index d703c8eb..d6759f95 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1153,7 +1153,7 @@ .extern MTX22_2DAffine .extern CircularDistance .extern MathUtil_0201BC84 -.extern FUN_0201BCBC +.extern SetFontsPointer .extern FUN_0201BD5C .extern FUN_0201BD70 .extern FUN_0201BD7C diff --git a/arm9/src/text.c b/arm9/src/text.c new file mode 100644 index 00000000..cd846135 --- /dev/null +++ b/arm9/src/text.c @@ -0,0 +1,85 @@ +#include "text.h" +#include "heap.h" + +const struct FontInfo *gFonts = NULL; + +u8 UNK_021C5734[0x200]; +u32 UNK_021C5714[8]; +u8 UNK_021C570C[8]; + +extern u32 FUN_0200CA7C(void *param0, u32 param1, u32 param2); + +extern void *FUN_0201B6C8(void); +extern void FUN_0200CAB4(u32 param0); +extern void FUN_0201C238(void); + +THUMB_FUNC void SetFontsPointer(const struct FontInfo *fonts) +{ + gFonts = fonts; +} + +THUMB_FUNC u8 FUN_0201BCC8(void *param0, u32 param1, u32 param2) +{ + u32 *r4 = UNK_021C5714; + s32 i; + for (i = 0; i < 8; i++, r4++) + { + if (r4[0] != 0) + { + continue; + } + UNK_021C5714[i] = FUN_0200CA7C(param0, param1, param2); + if (UNK_021C5714[i] != 0) + { + break; + } + i = 8; + break; + } + return (u8)i; +} + +THUMB_FUNC void FUN_0201BCFC(u32 param0) +{ + GF_ASSERT(param0 < 8); + GF_ASSERT(UNK_021C5714[param0] != 0); + if (param0 >= 8) + { + return; + } + if (UNK_021C5714[param0] == 0) + { + return; + } + void *r5 = FUN_0201B6C8(); + if (r5) + { + FUN_0201C238(); + FreeToHeap(r5); + } + FUN_0200CAB4(UNK_021C5714[param0]); + UNK_021C5714[param0] = 0; +} + +THUMB_FUNC BOOL FUN_0201BD44(u32 param0) +{ + return UNK_021C5714[param0] ? TRUE : FALSE; +} + +THUMB_FUNC void FUN_0201BD5C(void) +{ + for (s32 i = 0; i < 8; i++) + { + UNK_021C5714[i] = 0; + } +} + +THUMB_FUNC u8 FUN_0201BD70(u32 param0) +{ + return (u8)FUN_0201BD44(param0); +} + +THUMB_FUNC void FUN_0201BD7C(u32 param0) +{ + FUN_0201BCFC(param0); +} 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 --- arm9/asm/unk_0201BCBC.s | 47 ----------------------------------------------- arm9/src/text.c | 24 ++++++++++++++++++++++++ arm9/src/text_02054590.c | 16 +++++++--------- include/text.h | 26 +++++++++++++++----------- include/text_02054590.h | 6 +++--- 5 files changed, 49 insertions(+), 70 deletions(-) diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s index 1f8efdda..777ebe72 100644 --- a/arm9/asm/unk_0201BCBC.s +++ b/arm9/asm/unk_0201BCBC.s @@ -11,53 +11,6 @@ .text - thumb_func_start AddTextPrinterParameterized -AddTextPrinterParameterized: ; 0x0201BD84 - push {r3, lr} - sub sp, #0x18 - str r0, [sp, #0x4] - lsl r0, r3, #0x18 - lsr r3, r0, #0x18 - ldr r0, [sp, #0x20] - str r2, [sp, #0x0] - add r2, sp, #0x0 - strb r1, [r2, #0x9] - lsl r0, r0, #0x18 - strb r3, [r2, #0xa] - lsr r0, r0, #0x18 - strb r0, [r2, #0xb] - strb r3, [r2, #0xc] - strb r0, [r2, #0xd] - ldr r0, _0201BDDC ; =gFonts - lsl r1, r1, #0x3 - ldr r0, [r0, #0x0] - add r1, r0, r1 - ldrb r0, [r1, #0x2] - strb r0, [r2, #0xe] - ldrb r0, [r1, #0x3] - strb r0, [r2, #0xf] - ldrb r0, [r1, #0x4] - strb r0, [r2, #0x10] - ldrb r0, [r1, #0x5] - strb r0, [r2, #0x11] - ldrb r0, [r1, #0x6] - strb r0, [r2, #0x12] - ldrb r0, [r1, #0x7] - ldr r1, [sp, #0x24] - strb r0, [r2, #0x13] - mov r0, #0x0 - strh r0, [r2, #0x14] - strb r0, [r2, #0x16] - mov r0, #0xff - strb r0, [r2, #0x17] - ldr r2, [sp, #0x28] - add r0, sp, #0x0 - bl AddTextPrinter - add sp, #0x18 - pop {r3, pc} - nop -_0201BDDC: .word gFonts - thumb_func_start AddTextPrinterParameterized2 AddTextPrinterParameterized2: ; 0x0201BDE0 push {r3, lr} diff --git a/arm9/src/text.c b/arm9/src/text.c index cd846135..1a62608d 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -8,6 +8,7 @@ u32 UNK_021C5714[8]; u8 UNK_021C570C[8]; extern u32 FUN_0200CA7C(void *param0, u32 param1, u32 param2); +extern u16 AddTextPrinter(struct TextPrinterTemplate *template, u32 speed, void (*callback)(void *, u16)); extern void *FUN_0201B6C8(void); extern void FUN_0200CAB4(u32 param0); @@ -83,3 +84,26 @@ THUMB_FUNC void FUN_0201BD7C(u32 param0) { FUN_0201BCFC(param0); } + +THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, void (*callback)(void *, u16)) +{ + struct TextPrinterTemplate printerTemplate; + + printerTemplate.windowId = windowId; + printerTemplate.currentChar = str; + printerTemplate.fontId = fontId; + printerTemplate.x = (u8)x; + printerTemplate.y = (u8)y; + printerTemplate.currentX = (u8)x; + printerTemplate.currentY = (u8)y; + printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; + printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; + printerTemplate.unk = gFonts[fontId].unk; + printerTemplate.fgColor = gFonts[fontId].fgColor; + printerTemplate.bgColor = gFonts[fontId].bgColor; + printerTemplate.shadowColor = gFonts[fontId].shadowColor; + printerTemplate.unk2 = 0; + printerTemplate.unk3 = 0; + printerTemplate.unk4 = 255; + return AddTextPrinter(&printerTemplate, speed, callback); +} diff --git a/arm9/src/text_02054590.c b/arm9/src/text_02054590.c index f0c63a2b..393ac3b2 100644 --- a/arm9/src/text_02054590.c +++ b/arm9/src/text_02054590.c @@ -1,4 +1,5 @@ #include "text_02054590.h" +#include "text.h" extern void FUN_0201BD5C(void); extern void FUN_02002ED0(u32 param0, u32 param1, u32 param2); @@ -15,9 +16,6 @@ extern void FUN_02019620(u32 *param0, u32 param1); extern void FUN_02002B60(u8 param0); extern void FUN_02002B7C(u32 param0); extern void FUN_02002BB8(u32 param0); -extern void AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u32 speed, void (*callback)(void *, u16)); - -extern u32 FUN_0201BD70(void); extern void FUN_0200D300(u32 param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5, u32 param6); extern void FUN_0200D6F8(u32 *param0, u32 param1, u32 param2, u32 param3, u8 param4); @@ -57,25 +55,25 @@ THUMB_FUNC void FUN_0205464C(u32 *param0) FUN_02019620(param0, 15); } -THUMB_FUNC void FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3) +THUMB_FUNC u16 FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3) { FUN_02002B60(param3); FUN_02002B7C(0); FUN_02002BB8(0); - AddTextPrinterParameterized(windowId, 1, str, 0, 0, (u32)Options_GetTextFrameDelay(options), NULL); + return AddTextPrinterParameterized(windowId, 1, str, 0, 0, (u32)Options_GetTextFrameDelay(options), NULL); } -THUMB_FUNC void DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5) +THUMB_FUNC u16 DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5) { FUN_02002B60(a4); FUN_02002B7C(a5); FUN_02002BB8(0); - AddTextPrinterParameterized(windowId, fontId, str, 0, 0, speed, NULL); + return AddTextPrinterParameterized(windowId, fontId, str, 0, 0, speed, NULL); } -THUMB_FUNC u8 FUN_020546C8(void) //bool8? +THUMB_FUNC u8 FUN_020546C8(u32 param0) //bool8? { - return !FUN_0201BD70(); + return !FUN_0201BD70(param0); } THUMB_FUNC void FUN_020546E0(u32 param0, u32 param1, u32 param2, u32 param3) 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 diff --git a/include/text_02054590.h b/include/text_02054590.h index 37b286f3..401fa11f 100644 --- a/include/text_02054590.h +++ b/include/text_02054590.h @@ -8,9 +8,9 @@ void FUN_02054590(u32 param0, u32 param1); void FUN_020545B8(u32 param0, u32 param1, u32 param2); void FUN_02054608(u32 *param0, struct Options *options); void FUN_0205464C(u32 *param0); -void FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3); -void DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5); -u8 FUN_020546C8(void); +u16 FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3); +u16 DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5); +u8 FUN_020546C8(u32 param0); void FUN_020546E0(u32 param0, u32 param1, u32 param2, u32 param3); void FUN_02054744(u32 *param0, u32 param1, u32 param2); -- 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 --- arm9/asm/unk_0201BCBC.s | 94 ------------------------------------------------- arm9/src/text.c | 46 ++++++++++++++++++++++++ include/text.h | 2 ++ 3 files changed, 48 insertions(+), 94 deletions(-) diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s index 777ebe72..b87c3b7b 100644 --- a/arm9/asm/unk_0201BCBC.s +++ b/arm9/asm/unk_0201BCBC.s @@ -11,100 +11,6 @@ .text - thumb_func_start AddTextPrinterParameterized2 -AddTextPrinterParameterized2: ; 0x0201BDE0 - push {r3, lr} - sub sp, #0x18 - str r0, [sp, #0x4] - lsl r0, r3, #0x18 - lsr r3, r0, #0x18 - ldr r0, [sp, #0x20] - str r2, [sp, #0x0] - add r2, sp, #0x0 - strb r1, [r2, #0x9] - lsl r0, r0, #0x18 - strb r3, [r2, #0xa] - lsr r0, r0, #0x18 - strb r0, [r2, #0xb] - strb r3, [r2, #0xc] - strb r0, [r2, #0xd] - ldr r0, _0201BE38 ; =gFonts - lsl r1, r1, #0x3 - ldr r0, [r0, #0x0] - add r1, r0, r1 - ldrb r0, [r1, #0x2] - strb r0, [r2, #0xe] - ldrb r0, [r1, #0x3] - strb r0, [r2, #0xf] - ldrb r0, [r1, #0x4] - ldr r1, [sp, #0x28] - strb r0, [r2, #0x10] - lsr r0, r1, #0x10 - strb r0, [r2, #0x11] - lsr r0, r1, #0x8 - strb r0, [r2, #0x13] - strb r1, [r2, #0x12] - mov r0, #0x0 - strh r0, [r2, #0x14] - strb r0, [r2, #0x16] - mov r0, #0xff - strb r0, [r2, #0x17] - ldr r1, [sp, #0x24] - ldr r2, [sp, #0x2c] - add r0, sp, #0x0 - bl AddTextPrinter - add sp, #0x18 - pop {r3, pc} - nop -_0201BE38: .word gFonts - - thumb_func_start AddTextPrinterParameterized3 -AddTextPrinterParameterized3: ; 0x0201BE3C - push {r3, lr} - sub sp, #0x18 - str r0, [sp, #0x4] - lsl r0, r3, #0x18 - lsr r3, r0, #0x18 - ldr r0, [sp, #0x20] - str r2, [sp, #0x0] - add r2, sp, #0x0 - strb r1, [r2, #0x9] - lsl r0, r0, #0x18 - strb r3, [r2, #0xa] - lsr r0, r0, #0x18 - strb r0, [r2, #0xb] - strb r3, [r2, #0xc] - strb r0, [r2, #0xd] - ldr r0, [sp, #0x2c] - strb r0, [r2, #0xe] - ldr r0, [sp, #0x30] - strb r0, [r2, #0xf] - ldr r0, _0201BE94 ; =gFonts - ldr r3, [r0, #0x0] - lsl r0, r1, #0x3 - add r0, r3, r0 - ldrb r0, [r0, #0x4] - ldr r1, [sp, #0x28] - strb r0, [r2, #0x10] - lsr r0, r1, #0x10 - strb r0, [r2, #0x11] - lsr r0, r1, #0x8 - strb r0, [r2, #0x13] - strb r1, [r2, #0x12] - mov r0, #0x0 - strh r0, [r2, #0x14] - strb r0, [r2, #0x16] - mov r0, #0xff - strb r0, [r2, #0x17] - ldr r1, [sp, #0x24] - ldr r2, [sp, #0x34] - add r0, sp, #0x0 - bl AddTextPrinter - add sp, #0x18 - pop {r3, pc} - nop -_0201BE94: .word gFonts - thumb_func_start AddTextPrinter AddTextPrinter: ; 0x0201BE98 push {r3-r7, lr} diff --git a/arm9/src/text.c b/arm9/src/text.c index 1a62608d..0379769f 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -107,3 +107,49 @@ THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *st printerTemplate.unk4 = 255; return AddTextPrinter(&printerTemplate, speed, callback); } + +THUMB_FUNC u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, void (*callback)(void *, u16)) +{ + struct TextPrinterTemplate printerTemplate; + + printerTemplate.windowId = windowId; + printerTemplate.currentChar = str; + printerTemplate.fontId = fontId; + printerTemplate.x = (u8)x; + printerTemplate.y = (u8)y; + printerTemplate.currentX = (u8)x; + printerTemplate.currentY = (u8)y; + printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; + printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; + printerTemplate.unk = gFonts[fontId].unk; + printerTemplate.fgColor = colors >> 16; + printerTemplate.shadowColor = colors >> 8; + printerTemplate.bgColor = colors; + printerTemplate.unk2 = 0; + printerTemplate.unk3 = 0; + printerTemplate.unk4 = 255; + return AddTextPrinter(&printerTemplate, speed, callback); +} + +THUMB_FUNC 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)) +{ + struct TextPrinterTemplate printerTemplate; + + printerTemplate.windowId = windowId; + printerTemplate.currentChar = str; + printerTemplate.fontId = fontId; + printerTemplate.x = (u8)x; + printerTemplate.y = (u8)y; + printerTemplate.currentX = (u8)x; + printerTemplate.currentY = (u8)y; + printerTemplate.letterSpacing = letterSpacing; + printerTemplate.lineSpacing = lineSpacing; + printerTemplate.unk = gFonts[fontId].unk; + printerTemplate.fgColor = colors >> 16; + printerTemplate.shadowColor = colors >> 8; + printerTemplate.bgColor = colors; + printerTemplate.unk2 = 0; + printerTemplate.unk3 = 0; + printerTemplate.unk4 = 255; + return AddTextPrinter(&printerTemplate, speed, callback); +} 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 07e173da2d25146e8671118dd7ff7b2d158e41a3 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 10 Mar 2021 23:43:52 +0000 Subject: attempt to fix build --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22fd0531..20cbdfad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ env: CALCROM_DISCORD_WEBHOOK_AVATAR_URL: "https://i.imgur.com/38BQHdd.png" CALCROM_DISCORD_WEBHOOK_USERNAME: OK CALCROM_WEBHOOK_URL: ${{ secrets.WEBHOOKURL }} - + ACCEPT_EULA: Y jobs: build: -- cgit v1.2.3 From a4ff58c3adee6e7c11bb6e141ed7e7417983fb43 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 10 Mar 2021 23:48:18 +0000 Subject: try to fix again --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20cbdfad..582fad70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,6 @@ env: CALCROM_DISCORD_WEBHOOK_AVATAR_URL: "https://i.imgur.com/38BQHdd.png" CALCROM_DISCORD_WEBHOOK_USERNAME: OK CALCROM_WEBHOOK_URL: ${{ secrets.WEBHOOKURL }} - ACCEPT_EULA: Y jobs: build: @@ -19,7 +18,7 @@ jobs: - name: Update and Install Software run: | sudo apt update - sudo apt -y --fix-missing upgrade + sudo ACCEPT_EULA=Y apt -y --fix-missing upgrade sudo apt -y install g++-8-multilib linux-libc-dev binutils-arm-none-eabi sudo dpkg --add-architecture i386 wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - -- 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 --- arm9/asm/unk_0201BCBC.s | 159 ----------------------------------------------- arm9/src/text.c | 102 +++++++++++++++++++++++------- arm9/src/text_02054590.c | 4 +- include/text.h | 17 ++--- include/text_02054590.h | 4 +- 5 files changed, 95 insertions(+), 191 deletions(-) diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s index b87c3b7b..40471942 100644 --- a/arm9/asm/unk_0201BCBC.s +++ b/arm9/asm/unk_0201BCBC.s @@ -11,165 +11,6 @@ .text - thumb_func_start AddTextPrinter -AddTextPrinter: ; 0x0201BE98 - push {r3-r7, lr} - add r7, r0, #0x0 - ldr r0, _0201BFD0 ; =gFonts - add r6, r1, #0x0 - ldr r0, [r0, #0x0] - add r5, r2, #0x0 - cmp r0, #0x0 - bne _0201BEAC - mov r0, #0xff - pop {r3-r7, pc} -_0201BEAC: - mov r0, #0x0 - mov r1, #0x30 - bl AllocFromHeap - add r4, r0, #0x0 - mov r1, #0x1 - add r0, #0x23 - strb r1, [r0, #0x0] - add r0, r4, #0x0 - mov r3, #0x0 - add r0, #0x24 - strb r3, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x25 - ldrb r2, [r0, #0x0] - mov r0, #0x7f - bic r2, r0 - lsl r0, r6, #0x18 - lsr r1, r0, #0x18 - mov r0, #0x7f - and r0, r1 - add r1, r2, #0x0 - orr r1, r0 - add r0, r4, #0x0 - add r0, #0x25 - strb r1, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x26 - strb r3, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x27 - strb r3, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x29 - strb r3, [r0, #0x0] - add r1, r3, #0x0 -_0201BEF4: - add r0, r4, r3 - add r3, r3, #0x1 - strb r1, [r0, #0x1c] - cmp r3, #0x7 - blt _0201BEF4 - add r3, r7, #0x0 - add r2, r4, #0x0 - ldmia r3!, {r0-r1} - stmia r2!, {r0-r1} - ldmia r3!, {r0-r1} - stmia r2!, {r0-r1} - ldmia r3!, {r0-r1} - stmia r2!, {r0-r1} - ldr r0, [r4, #0x0] - bl String_c_str - str r0, [r4, #0x0] - ldr r0, _0201BFD4 ; =UNK_021C570C - str r5, [r4, #0x18] - mov r1, #0x0 - strb r1, [r0, #0x0] - add r0, r4, #0x0 - bl FUN_0201C1A8 - cmp r6, #0xff - beq _0201BF74 - cmp r6, #0x0 - beq _0201BF74 - add r0, r4, #0x0 - add r0, #0x25 - ldrb r2, [r0, #0x0] - mov r1, #0x7f - add r0, r2, #0x0 - bic r0, r1 - lsl r1, r2, #0x19 - lsr r1, r1, #0x19 - add r1, #0xff - lsl r1, r1, #0x18 - lsr r2, r1, #0x18 - mov r1, #0x7f - and r1, r2 - orr r1, r0 - add r0, r4, #0x0 - add r0, #0x25 - strb r1, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x25 - ldrb r1, [r0, #0x0] - mov r0, #0x80 - mov r2, #0x1 - orr r1, r0 - add r0, r4, #0x0 - add r0, #0x25 - strb r1, [r0, #0x0] - ldr r0, _0201BFD8 ; =FUN_0201BFDC - add r1, r4, #0x0 - bl FUN_0201BCC8 - add r1, r4, #0x0 - add r1, #0x28 - strb r0, [r1, #0x0] - add r4, #0x28 - ldrb r0, [r4, #0x0] - pop {r3-r7, pc} -_0201BF74: - add r0, r4, #0x0 - add r0, #0x25 - ldrb r1, [r0, #0x0] - mov r0, #0x7f - mov r5, #0x0 - bic r1, r0 - add r0, r4, #0x0 - add r0, #0x25 - strb r1, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x25 - ldrb r1, [r0, #0x0] - mov r0, #0x80 - bic r1, r0 - add r0, r4, #0x0 - add r0, #0x25 - strb r1, [r0, #0x0] - ldrb r0, [r7, #0x11] - ldrb r1, [r7, #0x12] - ldrb r2, [r7, #0x13] - bl FUN_0201C05C - mov r7, #0x1 - lsl r7, r7, #0xa -_0201BFA4: - add r0, r4, #0x0 - bl RenderFont - cmp r0, #0x1 - beq _0201BFB4 - add r5, r5, #0x1 - cmp r5, r7 - blo _0201BFA4 -_0201BFB4: - cmp r6, #0xff - beq _0201BFBE - ldr r0, [r4, #0x4] - bl FUN_020191D0 -_0201BFBE: - add r0, r4, #0x0 - bl FUN_0201C238 - add r0, r4, #0x0 - bl FreeToHeap - mov r0, #0x8 - pop {r3-r7, pc} - nop -_0201BFD0: .word gFonts -_0201BFD4: .word UNK_021C570C -_0201BFD8: .word FUN_0201BFDC - thumb_func_start FUN_0201BFDC FUN_0201BFDC: ; 0x0201BFDC push {r4, lr} diff --git a/arm9/src/text.c b/arm9/src/text.c index 0379769f..ccc86bab 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -1,5 +1,6 @@ #include "text.h" #include "heap.h" +#include "string16.h" const struct FontInfo *gFonts = NULL; @@ -7,19 +8,24 @@ u8 UNK_021C5734[0x200]; u32 UNK_021C5714[8]; u8 UNK_021C570C[8]; -extern u32 FUN_0200CA7C(void *param0, u32 param1, u32 param2); -extern u16 AddTextPrinter(struct TextPrinterTemplate *template, u32 speed, void (*callback)(void *, u16)); +extern u32 FUN_0200CA7C(void *func, struct TextPrinter *printer, u32 param2); -extern void *FUN_0201B6C8(void); +extern struct TextPrinter *FUN_0201B6C8(void); extern void FUN_0200CAB4(u32 param0); -extern void FUN_0201C238(void); +extern void FUN_0201C238(struct TextPrinter *printer); + +extern u32 RenderFont(struct TextPrinter *printer); +extern void FUN_0201C1A8(struct TextPrinter *printer); +extern FUN_0201BFDC(); //no idea what this is +extern void FUN_0201C05C(u8 fgColor, u8 bgColor, u8 shadowColor); +extern void FUN_020191D0(u32 windowId); THUMB_FUNC void SetFontsPointer(const struct FontInfo *fonts) { gFonts = fonts; } -THUMB_FUNC u8 FUN_0201BCC8(void *param0, u32 param1, u32 param2) +THUMB_FUNC u8 FUN_0201BCC8(void *func, struct TextPrinter *printer, u32 param2) { u32 *r4 = UNK_021C5714; s32 i; @@ -29,7 +35,7 @@ THUMB_FUNC u8 FUN_0201BCC8(void *param0, u32 param1, u32 param2) { continue; } - UNK_021C5714[i] = FUN_0200CA7C(param0, param1, param2); + UNK_021C5714[i] = FUN_0200CA7C(func, printer, param2); if (UNK_021C5714[i] != 0) { break; @@ -52,11 +58,11 @@ THUMB_FUNC void FUN_0201BCFC(u32 param0) { return; } - void *r5 = FUN_0201B6C8(); - if (r5) + struct TextPrinter *printer = FUN_0201B6C8(); + if (printer) { - FUN_0201C238(); - FreeToHeap(r5); + FUN_0201C238(printer); + FreeToHeap((void *)printer); } FUN_0200CAB4(UNK_021C5714[param0]); UNK_021C5714[param0] = 0; @@ -85,7 +91,7 @@ THUMB_FUNC void FUN_0201BD7C(u32 param0) FUN_0201BCFC(param0); } -THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, void (*callback)(void *, u16)) +THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, void (*callback)(struct TextPrinterTemplate *, u16)) { struct TextPrinterTemplate printerTemplate; @@ -108,7 +114,7 @@ THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *st return AddTextPrinter(&printerTemplate, speed, callback); } -THUMB_FUNC u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, void (*callback)(void *, u16)) +THUMB_FUNC u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, void (*callback)(struct TextPrinterTemplate *, u16)) { struct TextPrinterTemplate printerTemplate; @@ -122,16 +128,16 @@ THUMB_FUNC u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u8 *s printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; printerTemplate.unk = gFonts[fontId].unk; - printerTemplate.fgColor = colors >> 16; - printerTemplate.shadowColor = colors >> 8; - printerTemplate.bgColor = colors; + printerTemplate.fgColor = (u8)(colors >> 16); + printerTemplate.shadowColor = (u8)(colors >> 8); + printerTemplate.bgColor = (u8)colors; printerTemplate.unk2 = 0; printerTemplate.unk3 = 0; printerTemplate.unk4 = 255; return AddTextPrinter(&printerTemplate, speed, callback); } -THUMB_FUNC 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)) +THUMB_FUNC 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)) { struct TextPrinterTemplate printerTemplate; @@ -142,14 +148,68 @@ THUMB_FUNC u16 AddTextPrinterParameterized3(u32 windowId, u8 fontId, const u8 *s printerTemplate.y = (u8)y; printerTemplate.currentX = (u8)x; printerTemplate.currentY = (u8)y; - printerTemplate.letterSpacing = letterSpacing; - printerTemplate.lineSpacing = lineSpacing; + printerTemplate.letterSpacing = (u8)letterSpacing; + printerTemplate.lineSpacing = (u8)lineSpacing; printerTemplate.unk = gFonts[fontId].unk; - printerTemplate.fgColor = colors >> 16; - printerTemplate.shadowColor = colors >> 8; - printerTemplate.bgColor = colors; + printerTemplate.fgColor = (u8)(colors >> 16); + printerTemplate.shadowColor = (u8)(colors >> 8); + printerTemplate.bgColor = (u8)colors; printerTemplate.unk2 = 0; printerTemplate.unk3 = 0; printerTemplate.unk4 = 255; return AddTextPrinter(&printerTemplate, speed, callback); } + +THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, void (*callback)(struct TextPrinterTemplate *, u16)) +{ + if (!gFonts) + return 0xff; + + struct TextPrinter *printer = (struct TextPrinter *)AllocFromHeap(0, sizeof(struct TextPrinter)); + + printer->active = TRUE; + printer->state = 0; + printer->textSpeedBottom = (u8)speed; + printer->delayCounter = 0; + printer->scrollDistance = 0; + printer->japanese = 0; + + for (s32 i = 0; i < 7; i++) + { + printer->subStructFields[i] = 0; + } + + printer->printerTemplate = *printerTemplate; + printer->printerTemplate.currentChar = String_c_str((struct String *)printer->printerTemplate.currentChar); //TODO clean up + printer->callback = callback; + UNK_021C570C[0] = 0; + FUN_0201C1A8(printer); + if (speed != 0xff && speed != 0) + { + printer->textSpeedBottom += 0xff; + printer->textSpeedTop = 1; + printer->minLetterSpacing = FUN_0201BCC8(FUN_0201BFDC, printer, 1); + return printer->minLetterSpacing; + } + else + { + u32 j = 0; + printer->textSpeedBottom = 0; + printer->textSpeedTop = 0; + FUN_0201C05C(printerTemplate->fgColor, printerTemplate->bgColor, printerTemplate->shadowColor); //GenerateFontHalfRowLookupTable ? + for (; j < 0x400; ++j) + { + if (RenderFont(printer) == 1) + { + break; + } + } + if (speed != 0xff) + { + FUN_020191D0(printer->printerTemplate.windowId); // CopyWindowToVram? + } + FUN_0201C238(printer); + FreeToHeap((void *)printer); + return 8; + } +} diff --git a/arm9/src/text_02054590.c b/arm9/src/text_02054590.c index 393ac3b2..470a2fe3 100644 --- a/arm9/src/text_02054590.c +++ b/arm9/src/text_02054590.c @@ -55,7 +55,7 @@ THUMB_FUNC void FUN_0205464C(u32 *param0) FUN_02019620(param0, 15); } -THUMB_FUNC u16 FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3) +THUMB_FUNC u16 FUN_02054658(u8 windowId, const u16 *str, struct Options *options, u8 param3) { FUN_02002B60(param3); FUN_02002B7C(0); @@ -63,7 +63,7 @@ THUMB_FUNC u16 FUN_02054658(u8 windowId, const u8 *str, struct Options *options, return AddTextPrinterParameterized(windowId, 1, str, 0, 0, (u32)Options_GetTextFrameDelay(options), NULL); } -THUMB_FUNC u16 DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5) +THUMB_FUNC u16 DrawFieldMessage(u8 windowId, const u16 *str, u8 fontId, u32 speed, u8 a4, u32 a5) { FUN_02002B60(a4); FUN_02002B7C(a5); 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 diff --git a/include/text_02054590.h b/include/text_02054590.h index 401fa11f..725bd9b4 100644 --- a/include/text_02054590.h +++ b/include/text_02054590.h @@ -8,8 +8,8 @@ void FUN_02054590(u32 param0, u32 param1); void FUN_020545B8(u32 param0, u32 param1, u32 param2); void FUN_02054608(u32 *param0, struct Options *options); void FUN_0205464C(u32 *param0); -u16 FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3); -u16 DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5); +u16 FUN_02054658(u8 windowId, const u16 *str, struct Options *options, u8 param3); +u16 DrawFieldMessage(u8 windowId, const u16 *str, u8 fontId, u32 speed, u8 a4, u32 a5); u8 FUN_020546C8(u32 param0); void FUN_020546E0(u32 param0, u32 param1, u32 param2, u32 param3); void FUN_02054744(u32 *param0, u32 param1, u32 param2); -- cgit v1.2.3 From c7b8a8b0762c5eef4a678eb9cbc036e4fbb5568b Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 12 Mar 2021 03:30:43 +0000 Subject: name GenerateFontHalfRowLookupTable and CopyWindowToVram --- arm9/asm/unk_020010A8.s | 8 ++++---- arm9/asm/unk_02001B80.s | 6 +++--- arm9/asm/unk_020023C0.s | 6 +++--- arm9/asm/unk_0200CABC.s | 6 +++--- arm9/asm/unk_02016B94.s | 4 ++-- arm9/asm/unk_0201BCBC.s | 8 ++++---- arm9/asm/unk_02048120.s | 2 +- arm9/asm/unk_020625EC.s | 2 +- arm9/asm/unk_020653EC.s | 2 +- arm9/asm/unk_020772F0.s | 12 ++++++------ arm9/asm/unk_02083D48.s | 2 +- arm9/asm/unk_02086414.s | 2 +- arm9/global.inc | 4 ++-- arm9/modules/05/asm/mod05_021E1AD8.s | 2 +- arm9/modules/05/asm/mod05_021E2E88.s | 2 +- arm9/modules/05/asm/module_05.s | 2 +- arm9/modules/06/asm/module_06.s | 18 +++++++++--------- arm9/modules/12/asm/module_12.s | 6 +++--- arm9/modules/14/asm/module_14.s | 4 ++-- arm9/modules/15/asm/module_15.s | 2 +- arm9/modules/16/asm/module_16.s | 8 ++++---- arm9/modules/17/asm/module_17.s | 12 ++++++------ arm9/modules/18/asm/module_18.s | 26 +++++++++++++------------- arm9/modules/24/asm/module_24.s | 2 +- arm9/modules/51/asm/module_51.s | 6 +++--- arm9/modules/53/asm/module_53.s | 10 +++++----- arm9/modules/54/asm/module_54.s | 2 +- arm9/modules/57/asm/module_57.s | 2 +- arm9/modules/58/asm/module_58.s | 4 ++-- arm9/modules/59/asm/mod59_021D74E0_asm.s | 4 ++-- arm9/modules/59/asm/mod59_021D9868.s | 2 +- arm9/modules/60/asm/module_60.s | 10 +++++----- arm9/modules/61/asm/module_61.s | 8 ++++---- arm9/modules/62/asm/module_62.s | 20 ++++++++++---------- arm9/modules/65/asm/module_65.s | 6 +++--- arm9/modules/66/asm/module_66.s | 12 ++++++------ arm9/modules/73/asm/module_73.s | 2 +- arm9/modules/74/asm/module_74.s | 6 +++--- arm9/modules/77/asm/module_77.s | 8 ++++---- arm9/modules/80/asm/module_80.s | 6 +++--- arm9/modules/81/asm/module_81.s | 4 ++-- arm9/modules/82/asm/module_82.s | 6 +++--- arm9/modules/83/asm/module_83.s | 14 +++++++------- arm9/modules/84/asm/module_84_thumb2.s | 2 +- arm9/src/text.c | 8 ++++---- 45 files changed, 145 insertions(+), 145 deletions(-) diff --git a/arm9/asm/unk_020010A8.s b/arm9/asm/unk_020010A8.s index f3c838d8..440ba8e2 100644 --- a/arm9/asm/unk_020010A8.s +++ b/arm9/asm/unk_020010A8.s @@ -170,7 +170,7 @@ _020011AC: mov r1, #0x1 bl FUN_02001B64 ldr r0, [r5, #0xc] - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0x0 pop {r3-r7, pc} .balign 4 @@ -353,7 +353,7 @@ FUN_02001328: ; 0x02001328 add r0, r4, #0x0 bl FUN_020017AC ldr r0, [r4, #0xc] - bl FUN_020191D0 + bl CopyWindowToVram pop {r4, pc} .balign 4 @@ -1473,7 +1473,7 @@ _02001B1A: mov r1, #0x0 bl FUN_02001B64 ldr r0, [r4, #0xc] - bl FUN_020191D0 + bl CopyWindowToVram b _02001B5E _02001B38: ldr r1, [sp, #0xc] @@ -1489,7 +1489,7 @@ _02001B38: mov r1, #0x0 bl FUN_02001B64 ldr r0, [r4, #0xc] - bl FUN_020191D0 + bl CopyWindowToVram _02001B5E: mov r0, #0x0 add sp, #0x10 diff --git a/arm9/asm/unk_02001B80.s b/arm9/asm/unk_02001B80.s index 3ad4b3b7..4962171d 100644 --- a/arm9/asm/unk_02001B80.s +++ b/arm9/asm/unk_02001B80.s @@ -14,11 +14,11 @@ UNK_020ECAC8: ; 0x020ECAC8 thumb_func_start FUN_02001B80 FUN_02001B80: ; 0x02001B80 - ldr r3, _02001B88 ; =FUN_020191D0 + ldr r3, _02001B88 ; =CopyWindowToVram ldr r0, [r0, #0xc] bx r3 nop -_02001B88: .word FUN_020191D0 +_02001B88: .word CopyWindowToVram thumb_func_start FUN_02001B8C FUN_02001B8C: ; 0x02001B8C @@ -94,7 +94,7 @@ FUN_02001C14: ; 0x02001C14 bl FUN_02001B8C add r4, r0, #0x0 ldr r0, [r4, #0x4] - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0x0 add sp, #0x8 pop {r4, pc} diff --git a/arm9/asm/unk_020023C0.s b/arm9/asm/unk_020023C0.s index 604c7211..baa1b890 100644 --- a/arm9/asm/unk_020023C0.s +++ b/arm9/asm/unk_020023C0.s @@ -290,7 +290,7 @@ _0200259E: ldrb r0, [r4, #0x11] ldrb r1, [r4, #0x12] ldrb r2, [r4, #0x13] - bl FUN_0201C05C + bl GenerateFontHalfRowLookupTable b _020026CA _020025B4: ldr r0, [r4, #0x0] @@ -309,7 +309,7 @@ _020025B4: lsr r0, r0, #0x1f beq _020026CA ldr r0, [r4, #0x4] - bl FUN_020191D0 + bl CopyWindowToVram b _020026CA _020025DE: ldr r0, [r4, #0x0] @@ -570,7 +570,7 @@ _020027F2: add r0, #0x27 strb r1, [r0, #0x0] ldr r0, [r4, #0x4] - bl FUN_020191D0 + bl CopyWindowToVram b _02002806 _02002800: mov r0, #0x0 diff --git a/arm9/asm/unk_0200CABC.s b/arm9/asm/unk_0200CABC.s index 70ccee6d..0920c2fb 100644 --- a/arm9/asm/unk_0200CABC.s +++ b/arm9/asm/unk_0200CABC.s @@ -308,7 +308,7 @@ FUN_0200CCA4: ; 0x0200CCA4 cmp r4, #0x0 bne _0200CCF4 add r0, r5, #0x0 - bl FUN_020191D0 + bl CopyWindowToVram _0200CCF4: add sp, #0x20 pop {r3-r7, pc} @@ -791,7 +791,7 @@ FUN_0200D0BC: ; 0x0200D0BC cmp r4, #0x0 bne _0200D0D6 add r0, r5, #0x0 - bl FUN_020191D0 + bl CopyWindowToVram _0200D0D6: add r0, r5, #0x0 add r1, r6, #0x0 @@ -1622,7 +1622,7 @@ _0200D788: cmp r0, #0x0 bne _0200D794 add r0, r5, #0x0 - bl FUN_020191D0 + bl CopyWindowToVram _0200D794: add r0, r5, #0x0 add r1, r4, #0x0 diff --git a/arm9/asm/unk_02016B94.s b/arm9/asm/unk_02016B94.s index a97700a5..61fc9de5 100644 --- a/arm9/asm/unk_02016B94.s +++ b/arm9/asm/unk_02016B94.s @@ -5283,8 +5283,8 @@ _020191C8: bl FreeToHeap pop {r4-r6, pc} - thumb_func_start FUN_020191D0 -FUN_020191D0: ; 0x020191D0 + thumb_func_start CopyWindowToVram +CopyWindowToVram: ; 0x020191D0 push {r4, lr} add r4, r0, #0x0 bne _020191DA diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s index 40471942..5d1a9d7f 100644 --- a/arm9/asm/unk_0201BCBC.s +++ b/arm9/asm/unk_0201BCBC.s @@ -29,7 +29,7 @@ FUN_0201BFDC: ; 0x0201BFDC ldrb r0, [r4, #0x11] ldrb r1, [r4, #0x12] ldrb r2, [r4, #0x13] - bl FUN_0201C05C + bl GenerateFontHalfRowLookupTable add r0, r4, #0x0 bl RenderFont cmp r0, #0x0 @@ -41,7 +41,7 @@ FUN_0201BFDC: ; 0x0201BFDC pop {r4, pc} _0201C014: ldr r0, [r4, #0x4] - bl FUN_020191D0 + bl CopyWindowToVram _0201C01A: ldr r2, [r4, #0x18] cmp r2, #0x0 @@ -82,8 +82,8 @@ _0201C04C: pop {r4, pc} .balign 4 - thumb_func_start FUN_0201C05C -FUN_0201C05C: ; 0x0201C05C + thumb_func_start GenerateFontHalfRowLookupTable +GenerateFontHalfRowLookupTable: ; 0x0201C05C push {r3-r7, lr} sub sp, #0x30 ldr r3, _0201C0F8 ; =UNK_021C570C diff --git a/arm9/asm/unk_02048120.s b/arm9/asm/unk_02048120.s index f28f76eb..3c92ba05 100644 --- a/arm9/asm/unk_02048120.s +++ b/arm9/asm/unk_02048120.s @@ -122,7 +122,7 @@ _020481E6: _020481F2: add r0, r4, #0x0 add r0, #0xc - bl FUN_020191D0 + bl CopyWindowToVram ldr r1, _02048210 ; =FUN_02048214 add r0, r6, #0x0 add r2, r4, #0x0 diff --git a/arm9/asm/unk_020625EC.s b/arm9/asm/unk_020625EC.s index 8383e9bb..2ec122fa 100644 --- a/arm9/asm/unk_020625EC.s +++ b/arm9/asm/unk_020625EC.s @@ -1814,7 +1814,7 @@ _020633D6: _020633EA: add r0, r4, #0x0 add r0, #0xd4 - bl FUN_020191D0 + bl CopyWindowToVram add r1, r4, #0x0 ldr r0, [sp, #0x18] add r1, #0x21 diff --git a/arm9/asm/unk_020653EC.s b/arm9/asm/unk_020653EC.s index 45f5de1d..3d43d136 100644 --- a/arm9/asm/unk_020653EC.s +++ b/arm9/asm/unk_020653EC.s @@ -2129,7 +2129,7 @@ _0206649E: strb r0, [r5, r1] add r1, #0x4c add r0, r5, r1 - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, _020664D4 ; =0x00000139 strb r7, [r5, r0] add sp, #0x10 diff --git a/arm9/asm/unk_020772F0.s b/arm9/asm/unk_020772F0.s index eba7f739..ecca3742 100644 --- a/arm9/asm/unk_020772F0.s +++ b/arm9/asm/unk_020772F0.s @@ -1036,7 +1036,7 @@ _02077594: str r0, [r4, r1] sub r1, #0x10 add r0, r4, r1 - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, _020776AC ; =0x0000045C mov r1, #0x6 str r1, [r4, r0] @@ -3338,7 +3338,7 @@ FUN_02078894: ; 0x02078894 str r3, [sp, #0x8] bl AddTextPrinterParameterized add r0, r5, #0x0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0xc pop {r4-r5, pc} @@ -3371,7 +3371,7 @@ _020788DE: str r1, [sp, #0xc] bl AddTextPrinterParameterized2 add r0, r5, #0x0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x10 pop {r4-r6, pc} nop @@ -3560,7 +3560,7 @@ _020789D8: bl FUN_020788C4 ldr r0, _02078B74 ; =0x00000438 add r0, r5, r0 - bl FUN_020191D0 + bl CopyWindowToVram _02078A90: mov r0, #0x13 str r0, [sp, #0x0] @@ -4717,7 +4717,7 @@ _0207936A: mov r0, #0xfa lsl r0, r0, #0x2 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram b _020793BC _0207939E: mov r0, #0xc @@ -5298,7 +5298,7 @@ _020797FC: cmp r7, #0x5 blt _020797FC add r0, r5, #0x0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x18 pop {r3-r7, pc} .balign 4 diff --git a/arm9/asm/unk_02083D48.s b/arm9/asm/unk_02083D48.s index bb880a24..4a15e685 100644 --- a/arm9/asm/unk_02083D48.s +++ b/arm9/asm/unk_02083D48.s @@ -171,7 +171,7 @@ _02083D9C: mov r0, #0xb2 lsl r0, r0, #0x2 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram pop {r3-r5, pc} _02083DBA: ldr r1, _02083DEC ; =0x000043CC diff --git a/arm9/asm/unk_02086414.s b/arm9/asm/unk_02086414.s index 09d66fb6..de7be3b2 100644 --- a/arm9/asm/unk_02086414.s +++ b/arm9/asm/unk_02086414.s @@ -554,7 +554,7 @@ FUN_02086784: ; 0x02086784 mov r1, #0xf bl FUN_02019620 add r0, r5, #0x0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r4-r7, pc} diff --git a/arm9/global.inc b/arm9/global.inc index d6759f95..0053d427 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1078,7 +1078,7 @@ .extern FUN_02019150 .extern FUN_02019178 .extern FUN_020191A4 -.extern FUN_020191D0 +.extern CopyWindowToVram .extern FUN_02019220 .extern FUN_02019270 .extern FUN_0201928C @@ -1160,7 +1160,7 @@ .extern AddTextPrinterParameterized .extern AddTextPrinterParameterized2 .extern AddTextPrinterParameterized3 -.extern FUN_0201C05C +.extern GenerateFontHalfRowLookupTable .extern FUN_0201C100 .extern FUN_0201C1EC .extern FUN_0201C24C diff --git a/arm9/modules/05/asm/mod05_021E1AD8.s b/arm9/modules/05/asm/mod05_021E1AD8.s index 3dc5d0bb..0b72da2a 100644 --- a/arm9/modules/05/asm/mod05_021E1AD8.s +++ b/arm9/modules/05/asm/mod05_021E1AD8.s @@ -1334,7 +1334,7 @@ _021E2496: add r0, #8 add r1, #0xa8 str r0, [r1] - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, _021E253C ; =MOD05_021E25A4 add r1, r5, #0 mov r2, #0 diff --git a/arm9/modules/05/asm/mod05_021E2E88.s b/arm9/modules/05/asm/mod05_021E2E88.s index f49a1f99..6d69341c 100644 --- a/arm9/modules/05/asm/mod05_021E2E88.s +++ b/arm9/modules/05/asm/mod05_021E2E88.s @@ -309,7 +309,7 @@ _021E3078: _021E30F2: add r5, #0x20 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x1c pop {r4, r5, r6, r7, pc} .balign 4, 0 diff --git a/arm9/modules/05/asm/module_05.s b/arm9/modules/05/asm/module_05.s index 23f6ea7b..ad35672e 100644 --- a/arm9/modules/05/asm/module_05.s +++ b/arm9/modules/05/asm/module_05.s @@ -15281,7 +15281,7 @@ _021EFF54: str r0, [r5, #4] add r0, r5, #0 add r0, #0x20 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #9 str r0, [r5, #0x48] mov r0, #0 diff --git a/arm9/modules/06/asm/module_06.s b/arm9/modules/06/asm/module_06.s index d39eedbd..1dd5e52a 100644 --- a/arm9/modules/06/asm/module_06.s +++ b/arm9/modules/06/asm/module_06.s @@ -11394,7 +11394,7 @@ _0223EEB8: str r0, [r2, #0x5c] ldr r0, [r1] add r0, #0x20 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x34 pop {r3, r4} pop {r3} @@ -11857,7 +11857,7 @@ _0223F2AA: ldr r0, _0223F330 ; =0x02252420 ldr r0, [r0] add r0, #0x30 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0 mov r1, #1 add r0, #0x97 @@ -12170,7 +12170,7 @@ _0223F53C: ldr r0, _0223F580 ; =0x02252420 ldr r0, [r0] add r0, #0x20 - bl FUN_020191D0 + bl CopyWindowToVram _0223F57A: add sp, #8 pop {r3, pc} @@ -12615,7 +12615,7 @@ _0223F910: ldr r0, _0223F950 ; =0x02252420 ldr r0, [r0] add r0, #0x30 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #1 add r4, #0x97 strb r0, [r4] @@ -14670,7 +14670,7 @@ _022409D2: str r0, [r5] add r5, #0x34 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x34 pop {r4, r5, r6, r7, pc} nop @@ -14859,7 +14859,7 @@ _02240B4A: str r0, [r5, #4] add r5, #0x44 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x34 pop {r3, r4, r5, r6, pc} nop @@ -15262,7 +15262,7 @@ _02240EE0: ldr r0, [sp, #0x30] bl DestroyMsgData ldr r0, [sp, #0x24] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x34 pop {r4, r5, r6, r7, pc} .align 2, 0 @@ -41077,7 +41077,7 @@ _0224D60C: add r0, r6, #0 bl String_dtor add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0 add sp, #0x30 pop {r3, r4, r5, r6, r7, pc} @@ -41877,7 +41877,7 @@ _0224DCEC: bl AddTextPrinterParameterized2 str r0, [r5, #0xc] ldr r0, [r5, #4] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x10 pop {r4, r5, r6, pc} nop diff --git a/arm9/modules/12/asm/module_12.s b/arm9/modules/12/asm/module_12.s index c24f23a7..4f1ef252 100644 --- a/arm9/modules/12/asm/module_12.s +++ b/arm9/modules/12/asm/module_12.s @@ -15228,7 +15228,7 @@ MOD12_02234EFC: ; 0x02234EFC bl FUN_02019620 add r4, #0x34 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram pop {r4, pc} .align 2, 0 @@ -15294,7 +15294,7 @@ _02234F42: strb r0, [r5, r1] add r0, r5, #0 add r0, #0x34 - bl FUN_020191D0 + bl CopyWindowToVram _02234F96: ldr r0, [r5, #0x30] mov r1, #1 @@ -47017,7 +47017,7 @@ _022440EE: bl FUN_02019620 ldr r0, [r4] add r0, #0x34 - bl FUN_020191D0 + bl CopyWindowToVram mov r6, #0 add r5, r6, #0 mov r7, #6 diff --git a/arm9/modules/14/asm/module_14.s b/arm9/modules/14/asm/module_14.s index 0bded4bf..824cb507 100644 --- a/arm9/modules/14/asm/module_14.s +++ b/arm9/modules/14/asm/module_14.s @@ -22720,7 +22720,7 @@ MOD14_021E26E4: ; 0x021E26E4 bl AddTextPrinterParameterized2 ldr r0, [r5, #0x10] add r0, #0x20 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r5, #0 add r1, r6, #0 bl MOD14_021E2940 @@ -24687,7 +24687,7 @@ MOD14_021E355C: ; 0x021E355C bl FUN_02019620 add r0, r4, #0 add r0, #0x88 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0 bl MOD14_021E4764 mov r0, #0x60 diff --git a/arm9/modules/15/asm/module_15.s b/arm9/modules/15/asm/module_15.s index 6c23c898..f7f9881d 100644 --- a/arm9/modules/15/asm/module_15.s +++ b/arm9/modules/15/asm/module_15.s @@ -5512,7 +5512,7 @@ MOD15_021D9ECC: ; 0x021D9ECC bl FUN_020136F8 add r5, #0x2c add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x10 pop {r3, r4, r5, pc} nop diff --git a/arm9/modules/16/asm/module_16.s b/arm9/modules/16/asm/module_16.s index e30640a5..cfff4a29 100644 --- a/arm9/modules/16/asm/module_16.s +++ b/arm9/modules/16/asm/module_16.s @@ -3520,7 +3520,7 @@ MOD16_021D8F60: ; 0x021D8F60 mov r1, #0 bl FUN_02019620 add r0, r4, #4 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r3, r4, pc} thumb_func_end MOD16_021D8F60 @@ -27385,7 +27385,7 @@ MOD16_021E3E6C: ; 0x021E3E6C bl MOD16_021DB728 ldr r0, [r4] add r0, r0, #4 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x18 pop {r3, r4, r5, pc} .align 2, 0 @@ -42170,7 +42170,7 @@ MOD16_021EACB0: ; 0x021EACB0 bl MOD16_021EABC4 ldr r0, [r4] add r0, r0, #4 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #8 pop {r3, r4, r5, pc} .align 2, 0 @@ -51475,7 +51475,7 @@ MOD16_021EF318: ; 0x021EF318 mov r1, #0 bl FUN_02019620 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0 add sp, #0x14 pop {r4, r5, pc} diff --git a/arm9/modules/17/asm/module_17.s b/arm9/modules/17/asm/module_17.s index 1f3abbf2..3615681b 100644 --- a/arm9/modules/17/asm/module_17.s +++ b/arm9/modules/17/asm/module_17.s @@ -4734,7 +4734,7 @@ MOD17_021D9918: ; 0x021D9918 bl DestroyMsgData ldr r0, _021D99D4 ; =0x000006A8 ldr r0, [r5, r0] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x18 pop {r3, r4, r5, r6, r7, pc} nop @@ -4792,7 +4792,7 @@ MOD17_021D99E0: ; 0x021D99E0 bl DestroyMsgData ldr r0, _021D9A58 ; =0x000006A8 ldr r0, [r5, r0] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x10 pop {r3, r4, r5, r6, r7, pc} nop @@ -4871,7 +4871,7 @@ _021D9AD0: bl DestroyMsgData ldr r0, _021D9B08 ; =0x000006A8 ldr r0, [r5, r0] - bl FUN_020191D0 + bl CopyWindowToVram add r0, r6, #0 add sp, #0x10 pop {r3, r4, r5, r6, r7, pc} @@ -11828,7 +11828,7 @@ MOD17_021DCC68: ; 0x021DCC68 bl FUN_0200D0BC _021DCCCC: ldr r0, [r5] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r4, r5, r6, r7, pc} .align 2, 0 @@ -12423,7 +12423,7 @@ _021DD0D0: mov r3, #5 bl MOD17_021DCD80 ldr r0, [r7, #0x18] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x60 pop {r3, r4, r5, r6, r7, pc} .align 2, 0 @@ -14327,7 +14327,7 @@ _021DDFD0: mov r0, #0x19 lsl r0, r0, #4 ldr r0, [r4, r0] - bl FUN_020191D0 + bl CopyWindowToVram pop {r4, pc} thumb_func_end MOD17_021DDFAC diff --git a/arm9/modules/18/asm/module_18.s b/arm9/modules/18/asm/module_18.s index 6581e679..233dbc05 100644 --- a/arm9/modules/18/asm/module_18.s +++ b/arm9/modules/18/asm/module_18.s @@ -23390,7 +23390,7 @@ _02244AF8: add r3, r1, #0 bl FUN_0201A8C8 ldr r0, [sp, #0xc] - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, [r5] add r0, r0, #1 str r0, [r5] @@ -29597,7 +29597,7 @@ _02247AFA: str r0, [r5, #0x20] add r5, #0xc add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram bl FUN_0204F7E4 add sp, #0x34 pop {r4, r5, r6, r7, pc} @@ -29749,7 +29749,7 @@ _02247C40: str r0, [r5, #0x20] add r5, #0xc add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x38 pop {r3, r4, r5, r6, r7, pc} .align 2, 0 @@ -29902,7 +29902,7 @@ _02247D6C: str r0, [r5, #0x20] add r5, #0xc add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x34 pop {r3, r4, r5, r6, pc} .align 2, 0 @@ -31282,7 +31282,7 @@ _02248870: str r0, [r5, #0x1c] add r5, #8 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x34 pop {r3, r4, r5, r6, pc} .align 2, 0 @@ -38615,7 +38615,7 @@ _0224C396: strh r1, [r5, r0] add r0, r5, #0 add r0, #0x10 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r5, #0 add sp, #0x34 pop {r4, r5, pc} @@ -39232,7 +39232,7 @@ _0224C87C: str r0, [r5, #0x48] add r5, #0x10 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x34 pop {r4, r5, r6, r7, pc} .align 2, 0 @@ -39493,7 +39493,7 @@ _0224CB1A: bl FUN_02019620 add r4, #0x20 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r3, r4, pc} .align 2, 0 @@ -39534,7 +39534,7 @@ MOD18_0224CB34: ; 0x0224CB34 bl FUN_02019620 add r0, r5, #0 add r0, #0x30 - bl FUN_020191D0 + bl CopyWindowToVram bl MOD18_0223D658 bl MOD18_0224DBB4 ldr r2, [r5, #0x68] @@ -42405,10 +42405,10 @@ _0224E186: bl FUN_020010A8 str r0, [r5, #0x28] add r0, r5, #4 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r5, #0 add r0, #0x14 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #1 add r5, #0x38 strb r0, [r5] @@ -42960,10 +42960,10 @@ _0224E5CE: str r0, [r5, #0x2c] add r0, r5, #0 add r0, #8 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r5, #0 add r0, #0x18 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #4 bl FUN_0205EB38 str r0, [r5, #4] diff --git a/arm9/modules/24/asm/module_24.s b/arm9/modules/24/asm/module_24.s index e7eb3899..2888f12d 100644 --- a/arm9/modules/24/asm/module_24.s +++ b/arm9/modules/24/asm/module_24.s @@ -843,7 +843,7 @@ _02254E68: add r0, r5, #0 bl MOD24_02254D00 ldr r0, [r5, #0x70] - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #8 bl FUN_02016B90 cmp r0, #0 diff --git a/arm9/modules/51/asm/module_51.s b/arm9/modules/51/asm/module_51.s index 0eea16a7..848caed1 100644 --- a/arm9/modules/51/asm/module_51.s +++ b/arm9/modules/51/asm/module_51.s @@ -167,7 +167,7 @@ _02254960: mov r1, #0 bl FUN_02019620 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, [sp, #0x18] add r2, r4, #4 lsl r0, r0, #0x18 @@ -196,7 +196,7 @@ _02254960: bl FUN_02019620 add r0, r5, #0 add r0, #0x10 - bl FUN_020191D0 + bl CopyWindowToVram lsl r0, r6, #0x18 lsr r0, r0, #0x18 str r0, [sp] @@ -224,7 +224,7 @@ _02254960: bl FUN_02019620 add r0, r5, #0 add r0, #0x20 - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, [sp, #0x20] add r4, r4, #1 add r0, #0x10 diff --git a/arm9/modules/53/asm/module_53.s b/arm9/modules/53/asm/module_53.s index 366c45bd..f55e7c99 100644 --- a/arm9/modules/53/asm/module_53.s +++ b/arm9/modules/53/asm/module_53.s @@ -2104,7 +2104,7 @@ _021D8660: mov r0, #0xb2 lsl r0, r0, #2 add r0, r5, r0 - bl FUN_020191D0 + bl CopyWindowToVram b _021D86BA _021D8672: add r0, r5, #0 @@ -2125,7 +2125,7 @@ _021D8672: mov r0, #0xb2 lsl r0, r0, #2 add r0, r5, r0 - bl FUN_020191D0 + bl CopyWindowToVram bl FUN_02031190 cmp r0, #0 bne _021D86BA @@ -2827,7 +2827,7 @@ _021D8C22: mov r0, #0xb2 lsl r0, r0, #2 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram _021D8C32: mov r0, #0x92 lsl r0, r0, #2 @@ -3245,7 +3245,7 @@ _021D8F0A: cmp r0, #0 beq _021D8F2A ldr r0, [sp, #0x10] - bl FUN_020191D0 + bl CopyWindowToVram _021D8F2A: ldr r0, [sp, #0x14] ldr r1, [sp, #0x18] @@ -3477,7 +3477,7 @@ _021D90C0: bl AddTextPrinterParameterized2 _021D90DC: add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r6, r6, #1 add r7, #8 add r4, r4, #4 diff --git a/arm9/modules/54/asm/module_54.s b/arm9/modules/54/asm/module_54.s index 49c51d11..2091a0c6 100644 --- a/arm9/modules/54/asm/module_54.s +++ b/arm9/modules/54/asm/module_54.s @@ -2890,7 +2890,7 @@ _021D8BE4: cmp r0, #5 blt _021D8B2A add r0, r6, #0 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #1 add sp, #0x28 pop {r3, r4, r5, r6, r7, pc} diff --git a/arm9/modules/57/asm/module_57.s b/arm9/modules/57/asm/module_57.s index 6f58ea67..2e0c7acd 100644 --- a/arm9/modules/57/asm/module_57.s +++ b/arm9/modules/57/asm/module_57.s @@ -3560,7 +3560,7 @@ _021D9164: add r3, r1, #0 bl FUN_020196F4 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x10 pop {r4, pc} .align 2, 0 diff --git a/arm9/modules/58/asm/module_58.s b/arm9/modules/58/asm/module_58.s index a22e6e08..3e04165c 100644 --- a/arm9/modules/58/asm/module_58.s +++ b/arm9/modules/58/asm/module_58.s @@ -1650,7 +1650,7 @@ _021DA7A4: mov r0, #0xb1 lsl r0, r0, #2 add r0, r5, r0 - bl FUN_020191D0 + bl CopyWindowToVram b _021DA7EC _021DA7D4: mov r0, #0xc3 @@ -2104,7 +2104,7 @@ _021DAAEA: cmp r0, #0 beq _021DAB0A add r0, r7, #0 - bl FUN_020191D0 + bl CopyWindowToVram _021DAB0A: ldr r0, [sp, #0x10] ldr r1, [sp, #0x14] diff --git a/arm9/modules/59/asm/mod59_021D74E0_asm.s b/arm9/modules/59/asm/mod59_021D74E0_asm.s index 77f574fd..cd947e57 100644 --- a/arm9/modules/59/asm/mod59_021D74E0_asm.s +++ b/arm9/modules/59/asm/mod59_021D74E0_asm.s @@ -1105,7 +1105,7 @@ _021D7DF2: bl FUN_0200CCA4 add r0, r5, #0 add r0, #0x30 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #1 str r0, [r5, #0x2c] b _021D7E96 @@ -1293,7 +1293,7 @@ _021D7FCC: b _021D803C _021D7FD8: add r0, #0x1c - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #2 str r0, [r4, #0x54] b _021D803C diff --git a/arm9/modules/59/asm/mod59_021D9868.s b/arm9/modules/59/asm/mod59_021D9868.s index 4e03cbe3..3a2ba4ad 100644 --- a/arm9/modules/59/asm/mod59_021D9868.s +++ b/arm9/modules/59/asm/mod59_021D9868.s @@ -559,7 +559,7 @@ _021D9C9A: bl String_dtor add r0, r4, #0 add r0, #0x10 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #2 mov r1, #1 bl FUN_0201797C diff --git a/arm9/modules/60/asm/module_60.s b/arm9/modules/60/asm/module_60.s index 81f6d273..d55b37fc 100644 --- a/arm9/modules/60/asm/module_60.s +++ b/arm9/modules/60/asm/module_60.s @@ -1077,13 +1077,13 @@ _021D7DB6: blo _021D7DB6 add r0, r6, #0 add r0, #0x2c - bl FUN_020191D0 + bl CopyWindowToVram add r0, r6, #0 add r0, #0x3c - bl FUN_020191D0 + bl CopyWindowToVram add r6, #0x4c add r0, r6, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r5, #0 bl String_dtor add sp, #0x10 @@ -1238,7 +1238,7 @@ MOD60_021D7EA4: ; 0x021D7EA4 bl AddTextPrinterParameterized2 ldr r0, [sp, #0x10] add r0, #0x3c - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, [sp, #0x10] ldr r1, [r0, #0x10] mov r0, #2 @@ -1365,7 +1365,7 @@ _021D8002: ldr r0, [sp, #0x10] add r0, #0x3c str r0, [sp, #0x10] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x24 pop {r4, r5, r6, r7, pc} .align 2, 0 diff --git a/arm9/modules/61/asm/module_61.s b/arm9/modules/61/asm/module_61.s index ed38301b..bcb6e9b6 100644 --- a/arm9/modules/61/asm/module_61.s +++ b/arm9/modules/61/asm/module_61.s @@ -1488,7 +1488,7 @@ _021D80BE: cmp r4, #5 bge _021D80D0 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram _021D80D0: add r4, r4, #1 add r5, #0x10 @@ -1561,7 +1561,7 @@ _021D8122: ldr r0, [sp, #0x10] bl String_dtor add r0, r6, #0 - bl FUN_020191D0 + bl CopyWindowToVram _021D8164: add r7, r7, #1 add r5, #8 @@ -1622,7 +1622,7 @@ _021D8196: ldr r1, [sp, #0x14] ldr r0, [sp, #0x18] add r0, r0, r1 - bl FUN_020191D0 + bl CopyWindowToVram add r6, r6, #1 cmp r6, #2 blt _021D8196 @@ -1646,7 +1646,7 @@ _021D81F8: bl AddTextPrinterParameterized2 add r4, #0x74 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x1c pop {r4, r5, r6, r7, pc} .align 2, 0 diff --git a/arm9/modules/62/asm/module_62.s b/arm9/modules/62/asm/module_62.s index 76088322..86eebba7 100644 --- a/arm9/modules/62/asm/module_62.s +++ b/arm9/modules/62/asm/module_62.s @@ -3253,7 +3253,7 @@ MOD62_0222EE78: ; 0x0222EE78 mov r1, #0xf bl FUN_02019620 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0xc pop {r3, r4, r5, r6, pc} _0222EE96: @@ -3278,7 +3278,7 @@ _0222EE96: str r1, [sp, #8] bl AddTextPrinterParameterized add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r5, #0 bl String_dtor add r0, r6, #0 @@ -3333,7 +3333,7 @@ MOD62_0222EEE0: ; 0x0222EEE0 mov r1, #0xf bl FUN_02019620 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r4, r5, r6, r7, pc} thumb_func_end MOD62_0222EEE0 @@ -3379,7 +3379,7 @@ MOD62_0222EF44: ; 0x0222EF44 mov r1, #0xf bl FUN_02019620 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r4, r5, r6, r7, pc} thumb_func_end MOD62_0222EF44 @@ -3554,7 +3554,7 @@ _0222F0E2: mov r1, #0xee bl FUN_02019620 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram b _0222F152 _0222F0FE: add r0, r5, #0 @@ -3589,7 +3589,7 @@ _0222F0FE: mov r3, #7 bl AddTextPrinterParameterized2 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0 bl String_dtor _0222F152: @@ -3623,7 +3623,7 @@ MOD62_0222F168: ; 0x0222F168 mov r1, #0xee bl FUN_02019620 add r0, r5, r4 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r4, r5, r6, r7, pc} _0222F194: @@ -3655,7 +3655,7 @@ _0222F194: str r1, [sp, #0xc] bl AddTextPrinterParameterized2 add r0, r5, r4 - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, [sp, #0x10] bl String_dtor add sp, #0x14 @@ -3695,7 +3695,7 @@ MOD62_0222F208: ; 0x0222F208 mov r1, #0xf bl FUN_02019620 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0xc pop {r3, r4, r5, r6, pc} _0222F226: @@ -3720,7 +3720,7 @@ _0222F226: str r1, [sp, #8] bl AddTextPrinterParameterized add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r5, #0 bl String_dtor add r0, r6, #0 diff --git a/arm9/modules/65/asm/module_65.s b/arm9/modules/65/asm/module_65.s index 4ff5aca1..890b3348 100644 --- a/arm9/modules/65/asm/module_65.s +++ b/arm9/modules/65/asm/module_65.s @@ -1889,7 +1889,7 @@ _021D8392: add r4, #0xe8 lsl r0, r0, #4 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram pop {r3, r4, r5, r6, r7, pc} thumb_func_end MOD65_021D8280 @@ -1960,7 +1960,7 @@ _021D83D2: mov r0, #0x52 lsl r0, r0, #2 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x10 pop {r3, r4, r5, pc} _021D8434: @@ -2148,7 +2148,7 @@ _021D8578: bl MOD65_021D847C add r0, r4, #0 add r0, #0xf8 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #0x7f lsl r0, r0, #2 ldr r0, [r4, r0] diff --git a/arm9/modules/66/asm/module_66.s b/arm9/modules/66/asm/module_66.s index 8f27daeb..65c5c857 100644 --- a/arm9/modules/66/asm/module_66.s +++ b/arm9/modules/66/asm/module_66.s @@ -1362,10 +1362,10 @@ _021D7F44: mov r1, #1 bl AddTextPrinterParameterized add r0, r7, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r4, #0x58 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #0 add sp, #0xc pop {r4, r5, r6, r7, pc} @@ -1784,7 +1784,7 @@ _021D8278: bl String_dtor _021D82AA: add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r4, r5, r6, r7, pc} .align 2, 0 @@ -1803,7 +1803,7 @@ MOD66_021D82B8: ; 0x021D82B8 mov r1, #0 bl FUN_02019620 add r0, r6, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r6, #0 bl FUN_02019570 add sp, #0x10 @@ -2117,7 +2117,7 @@ MOD66_021D84C8: ; 0x021D84C8 str r1, [sp, #0xc] bl AddTextPrinterParameterized2 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r6, #0 bl String_dtor add sp, #0x1c @@ -2231,7 +2231,7 @@ MOD66_021D8554: ; 0x021D8554 bl FUN_02019620 add r0, r4, #0 add r0, #0x28 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0 add r0, #0x38 bl FUN_02019570 diff --git a/arm9/modules/73/asm/module_73.s b/arm9/modules/73/asm/module_73.s index e06f4d00..b4e14758 100644 --- a/arm9/modules/73/asm/module_73.s +++ b/arm9/modules/73/asm/module_73.s @@ -6114,7 +6114,7 @@ _021DA446: mov r1, #1 bl AddTextPrinterParameterized2 ldr r0, [r5, #8] - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #2 mov r1, #1 bl FUN_0201E6E4 diff --git a/arm9/modules/74/asm/module_74.s b/arm9/modules/74/asm/module_74.s index 637691d0..14dc995b 100644 --- a/arm9/modules/74/asm/module_74.s +++ b/arm9/modules/74/asm/module_74.s @@ -1059,7 +1059,7 @@ MOD74_021D7C10: ; 0x021D7C10 add r0, r4, #0 bl AddTextPrinterParameterized2 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x14 pop {r4, r5, r6, r7, pc} nop @@ -1425,7 +1425,7 @@ _021D7FC0: blt _021D7FA4 _021D7FF0: ldr r0, [sp, #0x14] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x24 pop {r4, r5, r6, r7, pc} nop @@ -1607,7 +1607,7 @@ _021D813C: _021D8172: add r0, r4, #0 add r0, #0x8c - bl FUN_020191D0 + bl CopyWindowToVram add r0, r4, #0 mov r1, #0 bl MOD74_021D8388 diff --git a/arm9/modules/77/asm/module_77.s b/arm9/modules/77/asm/module_77.s index 4536decb..8ed82bcb 100644 --- a/arm9/modules/77/asm/module_77.s +++ b/arm9/modules/77/asm/module_77.s @@ -1821,7 +1821,7 @@ _021D83B2: mov r3, #7 bl FUN_0200CCA4 ldr r0, [sp] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x24 pop {r4, r5, r6, r7, pc} nop @@ -1911,7 +1911,7 @@ _021D8462: mov r3, #7 bl FUN_0200CCA4 ldr r0, [sp] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x2c pop {r4, r5, r6, r7, pc} nop @@ -2024,7 +2024,7 @@ MOD77_021D8510: ; 0x021D8510 bl String_dtor ldr r0, _021D85CC ; =0x0000C044 add r0, r5, r0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0xc pop {r3, r4, r5, r6, pc} .align 2, 0 @@ -2110,7 +2110,7 @@ _021D865C: bl String_dtor ldr r0, _021D8690 ; =0x0000C044 add r0, r5, r0 - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x10 pop {r3, r4, r5, r6, r7, pc} .align 2, 0 diff --git a/arm9/modules/80/asm/module_80.s b/arm9/modules/80/asm/module_80.s index 9e91c64e..128c6280 100644 --- a/arm9/modules/80/asm/module_80.s +++ b/arm9/modules/80/asm/module_80.s @@ -3650,7 +3650,7 @@ _0222F220: add r0, r5, #0 bl MOD80_0222F300 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r6, r6, #1 add r4, r4, #4 add r5, #0x10 @@ -9153,7 +9153,7 @@ MOD80_02231EA8: ; 0x02231EA8 bl FUN_02019620 ldr r0, _02231FE4 ; =0x00000EC8 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #0x15 str r0, [sp] mov r0, #0x1b @@ -11970,7 +11970,7 @@ _0223357E: mov r1, #0 bl FUN_02019620 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, [sp, #0x14] add r6, #0x16 add r0, r0, #1 diff --git a/arm9/modules/81/asm/module_81.s b/arm9/modules/81/asm/module_81.s index 927b69b6..b7492d39 100644 --- a/arm9/modules/81/asm/module_81.s +++ b/arm9/modules/81/asm/module_81.s @@ -2485,7 +2485,7 @@ _022390F4: bl FUN_0200D06C add r0, r4, #0 add r0, #0x44 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #0 str r0, [r4, #8] str r6, [r5] @@ -9609,7 +9609,7 @@ _0223C982: bl FUN_0200D06C add r0, r4, #0 add r0, #0x48 - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, _0223CA90 ; =0x00000484 bl PlayBGM mov r0, #0 diff --git a/arm9/modules/82/asm/module_82.s b/arm9/modules/82/asm/module_82.s index f1cd74ed..925315fb 100644 --- a/arm9/modules/82/asm/module_82.s +++ b/arm9/modules/82/asm/module_82.s @@ -2550,7 +2550,7 @@ MOD82_0222E988: ; 0x0222E988 mov r0, #0xda lsl r0, r0, #4 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #0xd str r0, [r4, #0x1c] mov r0, #3 @@ -3141,7 +3141,7 @@ MOD82_0222EE28: ; 0x0222EE28 mov r0, #0xd9 lsl r0, r0, #4 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #0x1d str r0, [r4, #0x1c] mov r0, #3 @@ -3289,7 +3289,7 @@ MOD82_0222EF54: ; 0x0222EF54 mov r0, #0xda lsl r0, r0, #4 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #0x20 str r0, [r4, #0x1c] mov r0, #3 diff --git a/arm9/modules/83/asm/module_83.s b/arm9/modules/83/asm/module_83.s index 59fd717f..92b5807e 100644 --- a/arm9/modules/83/asm/module_83.s +++ b/arm9/modules/83/asm/module_83.s @@ -8257,7 +8257,7 @@ MOD83_022317A8: ; 0x022317A8 str r3, [sp, #0xc] bl AddTextPrinterParameterized2 add r0, r5, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r7, #0 bl String_dtor add r0, r4, #0 @@ -9162,7 +9162,7 @@ _02231EBE: bl String_dtor _02231F20: add r0, r6, #0 - bl FUN_020191D0 + bl CopyWindowToVram ldr r1, [r4, #0xc] ldr r0, [r4, #0x10] mul r0, r1 @@ -10697,7 +10697,7 @@ _02232B94: bl FUN_02019620 ldr r0, _02232D1C ; =0x00002AA8 add r0, r4, r0 - bl FUN_020191D0 + bl CopyWindowToVram ldr r0, _02232D18 ; =0x00002BD0 mov r1, #0 str r1, [r4, r0] @@ -11191,7 +11191,7 @@ _02232FAE: cmp r6, #0 beq _02232FB8 ldr r0, [sp, #0x10] - bl FUN_020191D0 + bl CopyWindowToVram _02232FB8: ldr r0, [sp, #0x1c] bl DestroyMsgData @@ -11260,7 +11260,7 @@ MOD83_02232FE4: ; 0x02232FE4 str r3, [sp, #0xc] bl AddTextPrinterParameterized2 add r0, r4, #0 - bl FUN_020191D0 + bl CopyWindowToVram add r0, r6, #0 bl String_dtor ldr r0, _02233078 ; =0x000029A4 @@ -15626,7 +15626,7 @@ _0223507A: tst r0, r4 bne _02235086 ldr r0, [r5] - bl FUN_020191D0 + bl CopyWindowToVram _02235086: mov r0, #8 tst r0, r4 @@ -17219,7 +17219,7 @@ _02235C5C: cmp r4, #0 bne _02235CCA ldr r0, [sp, #0x2c] - bl FUN_020191D0 + bl CopyWindowToVram add sp, #0x78 pop {r3, r4, r5, r6, r7, pc} _02235CCA: diff --git a/arm9/modules/84/asm/module_84_thumb2.s b/arm9/modules/84/asm/module_84_thumb2.s index eef0fa0b..048adbf9 100644 --- a/arm9/modules/84/asm/module_84_thumb2.s +++ b/arm9/modules/84/asm/module_84_thumb2.s @@ -581,7 +581,7 @@ MOD84_021D84F8: ; 0x021D84F8 ldr r0, [r4, #0x24] bl FUN_02019270 ldr r0, [r4, #0x24] - bl FUN_020191D0 + bl CopyWindowToVram mov r0, #0x4b mov r1, #1 bl FUN_02018FF4 diff --git a/arm9/src/text.c b/arm9/src/text.c index ccc86bab..58bfa220 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -17,8 +17,8 @@ extern void FUN_0201C238(struct TextPrinter *printer); extern u32 RenderFont(struct TextPrinter *printer); extern void FUN_0201C1A8(struct TextPrinter *printer); extern FUN_0201BFDC(); //no idea what this is -extern void FUN_0201C05C(u8 fgColor, u8 bgColor, u8 shadowColor); -extern void FUN_020191D0(u32 windowId); +extern void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); +extern void CopyWindowToVram(u32 windowId); THUMB_FUNC void SetFontsPointer(const struct FontInfo *fonts) { @@ -196,7 +196,7 @@ THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 s u32 j = 0; printer->textSpeedBottom = 0; printer->textSpeedTop = 0; - FUN_0201C05C(printerTemplate->fgColor, printerTemplate->bgColor, printerTemplate->shadowColor); //GenerateFontHalfRowLookupTable ? + GenerateFontHalfRowLookupTable(printerTemplate->fgColor, printerTemplate->bgColor, printerTemplate->shadowColor); for (; j < 0x400; ++j) { if (RenderFont(printer) == 1) @@ -206,7 +206,7 @@ THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 s } if (speed != 0xff) { - FUN_020191D0(printer->printerTemplate.windowId); // CopyWindowToVram? + CopyWindowToVram(printer->printerTemplate.windowId); // CopyWindowToVram? } FUN_0201C238(printer); FreeToHeap((void *)printer); -- 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 --- arm9/asm/unk_0201BCBC.s | 58 ------------------------------------------------- arm9/src/text.c | 49 +++++++++++++++++++++++++++++++++++------ include/text.h | 16 ++++++++------ 3 files changed, 51 insertions(+), 72 deletions(-) diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s index 5d1a9d7f..5fd08f38 100644 --- a/arm9/asm/unk_0201BCBC.s +++ b/arm9/asm/unk_0201BCBC.s @@ -11,64 +11,6 @@ .text - thumb_func_start FUN_0201BFDC -FUN_0201BFDC: ; 0x0201BFDC - push {r4, lr} - ldr r0, _0201C044 ; =UNK_021C570C - add r4, r1, #0x0 - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - bne _0201C042 - add r0, r4, #0x0 - add r0, #0x29 - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - bne _0201C036 - mov r0, #0x0 - strh r0, [r4, #0x2a] - ldrb r0, [r4, #0x11] - ldrb r1, [r4, #0x12] - ldrb r2, [r4, #0x13] - bl GenerateFontHalfRowLookupTable - add r0, r4, #0x0 - bl RenderFont - cmp r0, #0x0 - beq _0201C014 - cmp r0, #0x1 - beq _0201C02C - cmp r0, #0x3 - beq _0201C01A - pop {r4, pc} -_0201C014: - ldr r0, [r4, #0x4] - bl CopyWindowToVram -_0201C01A: - ldr r2, [r4, #0x18] - cmp r2, #0x0 - beq _0201C042 - ldrh r1, [r4, #0x2a] - add r0, r4, #0x0 - blx r2 - add r4, #0x29 - strb r0, [r4, #0x0] - pop {r4, pc} -_0201C02C: - add r4, #0x28 - ldrb r0, [r4, #0x0] - bl FUN_0201BCFC - pop {r4, pc} -_0201C036: - ldrh r1, [r4, #0x2a] - ldr r2, [r4, #0x18] - add r0, r4, #0x0 - blx r2 - add r4, #0x29 - strb r0, [r4, #0x0] -_0201C042: - pop {r4, pc} - .balign 4 -_0201C044: .word UNK_021C570C - thumb_func_start RenderFont RenderFont: ; 0x0201C048 push {r4, lr} diff --git a/arm9/src/text.c b/arm9/src/text.c index 58bfa220..04f443e9 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -16,7 +16,6 @@ extern void FUN_0201C238(struct TextPrinter *printer); extern u32 RenderFont(struct TextPrinter *printer); extern void FUN_0201C1A8(struct TextPrinter *printer); -extern FUN_0201BFDC(); //no idea what this is extern void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); extern void CopyWindowToVram(u32 windowId); @@ -91,7 +90,7 @@ THUMB_FUNC void FUN_0201BD7C(u32 param0) FUN_0201BCFC(param0); } -THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, void (*callback)(struct TextPrinterTemplate *, u16)) +THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)) { struct TextPrinterTemplate printerTemplate; @@ -114,7 +113,7 @@ THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u16 *s return AddTextPrinter(&printerTemplate, speed, callback); } -THUMB_FUNC u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, void (*callback)(struct TextPrinterTemplate *, u16)) +THUMB_FUNC u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u16 *str, u32 x, u32 y, u32 speed, u32 colors, u8 (*callback)(struct TextPrinterTemplate *, u16)) { struct TextPrinterTemplate printerTemplate; @@ -137,7 +136,7 @@ THUMB_FUNC u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u16 * return AddTextPrinter(&printerTemplate, speed, callback); } -THUMB_FUNC 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)) +THUMB_FUNC 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)) { struct TextPrinterTemplate printerTemplate; @@ -160,7 +159,7 @@ THUMB_FUNC u16 AddTextPrinterParameterized3(u32 windowId, u8 fontId, const u16 * return AddTextPrinter(&printerTemplate, speed, callback); } -THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, void (*callback)(struct TextPrinterTemplate *, u16)) +THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)) { if (!gFonts) return 0xff; @@ -172,7 +171,7 @@ THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 s printer->textSpeedBottom = (u8)speed; printer->delayCounter = 0; printer->scrollDistance = 0; - printer->japanese = 0; + printer->Unk29 = 0; for (s32 i = 0; i < 7; i++) { @@ -188,7 +187,7 @@ THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 s { printer->textSpeedBottom += 0xff; printer->textSpeedTop = 1; - printer->minLetterSpacing = FUN_0201BCC8(FUN_0201BFDC, printer, 1); + printer->minLetterSpacing = FUN_0201BCC8(RunTextPrinter, printer, 1); return printer->minLetterSpacing; } else @@ -213,3 +212,39 @@ THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 s return 8; } } + +THUMB_FUNC void RunTextPrinter(u32 param0, struct TextPrinter *printer) +{ +#pragma unused(param0) + if (UNK_021C570C[0] == 0) + { + if (printer->Unk29 == 0) + { + printer->Unk2A = 0; + GenerateFontHalfRowLookupTable(printer->printerTemplate.fgColor, printer->printerTemplate.bgColor, printer->printerTemplate.shadowColor); + u32 temp = RenderFont(printer); + switch (temp) + { + case 0: + CopyWindowToVram(printer->printerTemplate.windowId); + //fallthrough + case 3: + if (printer->callback == NULL) + { + return; + } + printer->Unk29 = printer->callback(&printer->printerTemplate, printer->Unk2A); //TODO check + return; + case 1: + FUN_0201BCFC(printer->minLetterSpacing); + return; + default: + return; + } + } + else + { + printer->Unk29 = printer->callback(&printer->printerTemplate, printer->Unk2A); + } + } +} 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 --- .../nonmatchings/GenerateFontHalfRowLookupTable.s | 93 ++++++++ arm9/asm/unk_0201BCBC.s | 101 -------- arm9/src/text.c | 260 ++++++++++++++++++++- arm9/temp.c | 0 include/text.h | 4 +- tools/asm_processor/.gitattributes | 1 + tools/asm_processor/compile.sh | 38 +-- 7 files changed, 371 insertions(+), 126 deletions(-) create mode 100644 arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s create mode 100644 arm9/temp.c create mode 100644 tools/asm_processor/.gitattributes diff --git a/arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s b/arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s new file mode 100644 index 00000000..2d51a2ae --- /dev/null +++ b/arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s @@ -0,0 +1,93 @@ + .include "asm/macros.inc" + .include "global.inc" + + .extern UNK_021C570C + .extern UNK_021C5734 + + thumb_func_start GenerateFontHalfRowLookupTable +GenerateFontHalfRowLookupTable: ; 0x0201C05C + push {r3-r7, lr} + sub sp, #0x30 + ldr r3, _0201C0F8 ; =UNK_021C570C + mov r5, #0x0 + str r5, [sp, #0x20] + str r0, [sp, #0x24] + str r2, [sp, #0x28] + str r1, [sp, #0x2c] + strh r1, [r3, #0x6] + strh r0, [r3, #0x2] + add r0, sp, #0x20 + strh r2, [r3, #0x4] + str r5, [sp, #0x14] + str r0, [sp, #0x8] + mov r12, r0 + mov lr, r0 + str r0, [sp, #0x18] +_0201C07E: + mov r0, #0x0 + str r0, [sp, #0x10] + ldr r0, [sp, #0x18] + str r0, [sp, #0x4] + ldr r0, [sp, #0x8] + ldr r0, [r0, #0x0] + str r0, [sp, #0x1c] +_0201C08C: + mov r0, #0x0 + str r0, [sp, #0xc] + mov r0, lr + str r0, [sp, #0x0] + ldr r0, [sp, #0x4] + ldr r0, [r0, #0x0] + lsl r7, r0, #0x4 +_0201C09A: + ldr r0, [sp, #0x0] + mov r3, #0x0 + ldr r0, [r0, #0x0] + mov r4, r12 + lsl r6, r0, #0x8 +_0201C0A4: + ldr r0, [r4, #0x0] + add r1, r7, #0x0 + lsl r0, r0, #0xc + orr r0, r6 + orr r1, r0 + ldr r0, [sp, #0x1c] + add r3, r3, #0x1 + add r2, r0, #0x0 + orr r2, r1 + lsl r1, r5, #0x1 + ldr r0, _0201C0FC ; =UNK_021C5734 + add r5, r5, #0x1 + add r4, r4, #0x4 + strh r2, [r0, r1] + cmp r3, #0x4 + blt _0201C0A4 + ldr r0, [sp, #0x0] + add r0, r0, #0x4 + str r0, [sp, #0x0] + ldr r0, [sp, #0xc] + add r0, r0, #0x1 + str r0, [sp, #0xc] + cmp r0, #0x4 + blt _0201C09A + ldr r0, [sp, #0x4] + add r0, r0, #0x4 + str r0, [sp, #0x4] + ldr r0, [sp, #0x10] + add r0, r0, #0x1 + str r0, [sp, #0x10] + cmp r0, #0x4 + blt _0201C08C + ldr r0, [sp, #0x8] + add r0, r0, #0x4 + str r0, [sp, #0x8] + ldr r0, [sp, #0x14] + add r0, r0, #0x1 + str r0, [sp, #0x14] + cmp r0, #0x4 + blt _0201C07E + add sp, #0x30 + pop {r3-r7, pc} + .balign 4 +_0201C0F8: .word UNK_021C570C +_0201C0FC: .word UNK_021C5734 diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s index 5fd08f38..65282b4a 100644 --- a/arm9/asm/unk_0201BCBC.s +++ b/arm9/asm/unk_0201BCBC.s @@ -11,107 +11,6 @@ .text - thumb_func_start RenderFont -RenderFont: ; 0x0201C048 - push {r4, lr} - add r4, r0, #0x0 -_0201C04C: - ldrb r0, [r4, #0x9] - add r1, r4, #0x0 - bl FontFunc - cmp r0, #0x2 - beq _0201C04C - pop {r4, pc} - .balign 4 - - thumb_func_start GenerateFontHalfRowLookupTable -GenerateFontHalfRowLookupTable: ; 0x0201C05C - push {r3-r7, lr} - sub sp, #0x30 - ldr r3, _0201C0F8 ; =UNK_021C570C - mov r5, #0x0 - str r5, [sp, #0x20] - str r0, [sp, #0x24] - str r2, [sp, #0x28] - str r1, [sp, #0x2c] - strh r1, [r3, #0x6] - strh r0, [r3, #0x2] - add r0, sp, #0x20 - strh r2, [r3, #0x4] - str r5, [sp, #0x14] - str r0, [sp, #0x8] - mov r12, r0 - mov lr, r0 - str r0, [sp, #0x18] -_0201C07E: - mov r0, #0x0 - str r0, [sp, #0x10] - ldr r0, [sp, #0x18] - str r0, [sp, #0x4] - ldr r0, [sp, #0x8] - ldr r0, [r0, #0x0] - str r0, [sp, #0x1c] -_0201C08C: - mov r0, #0x0 - str r0, [sp, #0xc] - mov r0, lr - str r0, [sp, #0x0] - ldr r0, [sp, #0x4] - ldr r0, [r0, #0x0] - lsl r7, r0, #0x4 -_0201C09A: - ldr r0, [sp, #0x0] - mov r3, #0x0 - ldr r0, [r0, #0x0] - mov r4, r12 - lsl r6, r0, #0x8 -_0201C0A4: - ldr r0, [r4, #0x0] - add r1, r7, #0x0 - lsl r0, r0, #0xc - orr r0, r6 - orr r1, r0 - ldr r0, [sp, #0x1c] - add r3, r3, #0x1 - add r2, r0, #0x0 - orr r2, r1 - lsl r1, r5, #0x1 - ldr r0, _0201C0FC ; =UNK_021C5734 - add r5, r5, #0x1 - add r4, r4, #0x4 - strh r2, [r0, r1] - cmp r3, #0x4 - blt _0201C0A4 - ldr r0, [sp, #0x0] - add r0, r0, #0x4 - str r0, [sp, #0x0] - ldr r0, [sp, #0xc] - add r0, r0, #0x1 - str r0, [sp, #0xc] - cmp r0, #0x4 - blt _0201C09A - ldr r0, [sp, #0x4] - add r0, r0, #0x4 - str r0, [sp, #0x4] - ldr r0, [sp, #0x10] - add r0, r0, #0x1 - str r0, [sp, #0x10] - cmp r0, #0x4 - blt _0201C08C - ldr r0, [sp, #0x8] - add r0, r0, #0x4 - str r0, [sp, #0x8] - ldr r0, [sp, #0x14] - add r0, r0, #0x1 - str r0, [sp, #0x14] - cmp r0, #0x4 - blt _0201C07E - add sp, #0x30 - pop {r3-r7, pc} - .balign 4 -_0201C0F8: .word UNK_021C570C -_0201C0FC: .word UNK_021C5734 - thumb_func_start FUN_0201C100 FUN_0201C100: ; 0x0201C100 ldrh r2, [r0, #0x0] diff --git a/arm9/src/text.c b/arm9/src/text.c index 04f443e9..8ec3efe8 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -8,23 +8,23 @@ u8 UNK_021C5734[0x200]; u32 UNK_021C5714[8]; u8 UNK_021C570C[8]; -extern u32 FUN_0200CA7C(void *func, struct TextPrinter *printer, u32 param2); +extern u32 FUN_0200CA7C(void (*func)(u32, struct TextPrinter *), struct TextPrinter *printer, u32 param2); extern struct TextPrinter *FUN_0201B6C8(void); extern void FUN_0200CAB4(u32 param0); extern void FUN_0201C238(struct TextPrinter *printer); -extern u32 RenderFont(struct TextPrinter *printer); extern void FUN_0201C1A8(struct TextPrinter *printer); -extern void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); extern void CopyWindowToVram(u32 windowId); +extern u32 FontFunc(u8 fontId, struct TextPrinter *printer); + THUMB_FUNC void SetFontsPointer(const struct FontInfo *fonts) { gFonts = fonts; } -THUMB_FUNC u8 FUN_0201BCC8(void *func, struct TextPrinter *printer, u32 param2) +THUMB_FUNC u8 FUN_0201BCC8(void (*func)(u32, struct TextPrinter *), struct TextPrinter *printer, u32 param2) { u32 *r4 = UNK_021C5714; s32 i; @@ -233,7 +233,7 @@ THUMB_FUNC void RunTextPrinter(u32 param0, struct TextPrinter *printer) { return; } - printer->Unk29 = printer->callback(&printer->printerTemplate, printer->Unk2A); //TODO check + printer->Unk29 = printer->callback(&printer->printerTemplate, printer->Unk2A); return; case 1: FUN_0201BCFC(printer->minLetterSpacing); @@ -248,3 +248,253 @@ THUMB_FUNC void RunTextPrinter(u32 param0, struct TextPrinter *printer) } } } + +THUMB_FUNC u32 RenderFont(struct TextPrinter *printer) +{ + u32 ret; + while (TRUE) + { + ret = FontFunc(printer->printerTemplate.fontId, printer); + if (ret != 2) + { + return ret; + } + } +} + +#ifdef NONMATCHING +THUMB_FUNC void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) +{ + u32 fg12, bg12, shadow12; + u32 temp; + + u16 *current = UNK_021C570C; + + bg12 = bgColor << 12; + fg12 = fgColor << 12; + shadow12 = shadowColor << 12; + + temp = (bgColor << 8) | (bgColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (bgColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (bgColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bgColor << 8) | (fgColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (fgColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (fgColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bgColor << 8) | (shadowColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (shadowColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (shadowColor << 4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bgColor << 8) | (bgColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (bgColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (bgColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bgColor << 8) | (fgColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (fgColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (fgColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bgColor << 8) | (shadowColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (shadowColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (shadowColor << 4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bgColor << 8) | (bgColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (bgColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (bgColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bgColor << 8) | (fgColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (fgColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (fgColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bgColor << 8) | (shadowColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fgColor << 8) | (shadowColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadowColor << 8) | (shadowColor << 4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; +} +#else +THUMB_FUNC void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) //TODO use asm preprocessor +{ + asm { + // push {r3-r7, lr} + sub sp, #0x30 + ldr r3, =UNK_021C570C + mov r5, #0x0 + str r5, [sp, #0x20] + str r0, [sp, #0x24] + str r2, [sp, #0x28] + str r1, [sp, #0x2c] + strh r1, [r3, #0x6] + strh r0, [r3, #0x2] + add r0, sp, #0x20 + strh r2, [r3, #0x4] + str r5, [sp, #0x14] + str r0, [sp, #0x8] + mov r12, r0 + mov lr, r0 + str r0, [sp, #0x18] + _0201C07E: + mov r0, #0x0 + str r0, [sp, #0x10] + ldr r0, [sp, #0x18] + str r0, [sp, #0x4] + ldr r0, [sp, #0x8] + ldr r0, [r0, #0x0] + str r0, [sp, #0x1c] + _0201C08C: + mov r0, #0x0 + str r0, [sp, #0xc] + mov r0, lr + str r0, [sp, #0x0] + ldr r0, [sp, #0x4] + ldr r0, [r0, #0x0] + lsl r7, r0, #0x4 + _0201C09A: + ldr r0, [sp, #0x0] + mov r3, #0x0 + ldr r0, [r0, #0x0] + mov r4, r12 + lsl r6, r0, #0x8 + _0201C0A4: + ldr r0, [r4, #0x0] + add r1, r7, #0x0 + lsl r0, r0, #0xc + orr r0, r6 + orr r1, r0 + ldr r0, [sp, #0x1c] + add r3, r3, #0x1 + add r2, r0, #0x0 + orr r2, r1 + lsl r1, r5, #0x1 + ldr r0, =UNK_021C5734 + add r5, r5, #0x1 + add r4, r4, #0x4 + strh r2, [r0, r1] + cmp r3, #0x4 + blt _0201C0A4 + ldr r0, [sp, #0x0] + add r0, r0, #0x4 + str r0, [sp, #0x0] + ldr r0, [sp, #0xc] + add r0, r0, #0x1 + str r0, [sp, #0xc] + cmp r0, #0x4 + blt _0201C09A + ldr r0, [sp, #0x4] + add r0, r0, #0x4 + str r0, [sp, #0x4] + ldr r0, [sp, #0x10] + add r0, r0, #0x1 + str r0, [sp, #0x10] + cmp r0, #0x4 + blt _0201C08C + ldr r0, [sp, #0x8] + add r0, r0, #0x4 + str r0, [sp, #0x8] + ldr r0, [sp, #0x14] + add r0, r0, #0x1 + str r0, [sp, #0x14] + cmp r0, #0x4 + blt _0201C07E + add sp, #0x30 + // pop {r3-r7, pc} + } +} +#endif diff --git a/arm9/temp.c b/arm9/temp.c new file mode 100644 index 00000000..e69de29b 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 diff --git a/tools/asm_processor/.gitattributes b/tools/asm_processor/.gitattributes new file mode 100644 index 00000000..75c2cbe5 --- /dev/null +++ b/tools/asm_processor/.gitattributes @@ -0,0 +1 @@ +compile.sh text eol=lf diff --git a/tools/asm_processor/compile.sh b/tools/asm_processor/compile.sh index 7d950644..786da404 100644 --- a/tools/asm_processor/compile.sh +++ b/tools/asm_processor/compile.sh @@ -1,19 +1,19 @@ -#!/bin/bash - -CC="$1" -shift -AS="$1" -shift - -temp="$(mktemp)" -../tools/asm_processor/asm_processor.py "$2" --assembler "$AS" > "$temp.c" && -$CC -c "$temp.c" -o "$1" - -prelude=$(mktemp prelude.XXXXXX) -cat ../include/macros.inc >> "$prelude" -cat global.inc >> "$prelude" - -../tools/asm_processor/asm_processor.py "$2" --post-process "$1" --assembler "$AS" --asm-prelude "$prelude" -$DEVKITARM/bin/arm-none-eabi-objcopy --remove-section .comment "$1" "$1" -rm "$prelude" -rm "$temp" +#!/bin/bash + +CC="$1" +shift +AS="$1" +shift + +temp="$(mktemp)" +../tools/asm_processor/asm_processor.py "$2" --assembler "$AS" > "$temp.c" && +$CC -c "$temp.c" -o "$1" + +prelude=$(mktemp prelude.XXXXXX) +cat ../include/macros.inc >> "$prelude" +cat global.inc >> "$prelude" + +../tools/asm_processor/asm_processor.py "$2" --post-process "$1" --assembler "$AS" --asm-prelude "$prelude" +arm-none-eabi-objcopy --remove-section .comment "$1" "$1" +rm "$prelude" +rm "$temp" -- 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 --- arm9/arm9.lsf | 1 - arm9/asm/unk_0201BCBC.s | 187 ------------------------------------------------ arm9/asm/unk_02021590.s | 36 +++++----- arm9/global.inc | 2 +- arm9/src/text.c | 68 +++++++++++++++++- include/text.h | 20 ++++-- 6 files changed, 101 insertions(+), 213 deletions(-) delete mode 100644 arm9/asm/unk_0201BCBC.s diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 8f0b150b..b8accee4 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -56,7 +56,6 @@ Static arm9 Object unk_0201B8B8.o Object math_util.o Object text.o - Object unk_0201BCBC.o Object unk_0201C24C.o Object unk_0201C360.o Object unk_0201C620.o diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s deleted file mode 100644 index 65282b4a..00000000 --- a/arm9/asm/unk_0201BCBC.s +++ /dev/null @@ -1,187 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .extern gFonts - .extern UNK_021C570C - .extern UNK_021C5714 - .extern UNK_021C5734 - .extern FUN_0201BCC8 - .extern FUN_0201BCFC - .extern FUN_0201BD44 - - .text - - thumb_func_start FUN_0201C100 -FUN_0201C100: ; 0x0201C100 - ldrh r2, [r0, #0x0] - lsr r2, r2, #0x8 - lsl r3, r2, #0x1 - ldr r2, _0201C1A4 ; =UNK_021C5734 - ldrh r3, [r2, r3] - strh r3, [r1, #0x0] - ldrh r3, [r0, #0x0] - lsl r3, r3, #0x18 - lsr r3, r3, #0x17 - ldrh r3, [r2, r3] - strh r3, [r1, #0x2] - ldrh r3, [r0, #0x2] - lsr r3, r3, #0x8 - lsl r3, r3, #0x1 - ldrh r3, [r2, r3] - strh r3, [r1, #0x4] - ldrh r3, [r0, #0x2] - lsl r3, r3, #0x18 - lsr r3, r3, #0x17 - ldrh r3, [r2, r3] - strh r3, [r1, #0x6] - ldrh r3, [r0, #0x4] - lsr r3, r3, #0x8 - lsl r3, r3, #0x1 - ldrh r3, [r2, r3] - strh r3, [r1, #0x8] - ldrh r3, [r0, #0x4] - lsl r3, r3, #0x18 - lsr r3, r3, #0x17 - ldrh r3, [r2, r3] - strh r3, [r1, #0xa] - ldrh r3, [r0, #0x6] - lsr r3, r3, #0x8 - lsl r3, r3, #0x1 - ldrh r3, [r2, r3] - strh r3, [r1, #0xc] - ldrh r3, [r0, #0x6] - lsl r3, r3, #0x18 - lsr r3, r3, #0x17 - ldrh r3, [r2, r3] - strh r3, [r1, #0xe] - ldrh r3, [r0, #0x8] - lsr r3, r3, #0x8 - lsl r3, r3, #0x1 - ldrh r3, [r2, r3] - strh r3, [r1, #0x10] - ldrh r3, [r0, #0x8] - lsl r3, r3, #0x18 - lsr r3, r3, #0x17 - ldrh r3, [r2, r3] - strh r3, [r1, #0x12] - ldrh r3, [r0, #0xa] - lsr r3, r3, #0x8 - lsl r3, r3, #0x1 - ldrh r3, [r2, r3] - strh r3, [r1, #0x14] - ldrh r3, [r0, #0xa] - lsl r3, r3, #0x18 - lsr r3, r3, #0x17 - ldrh r3, [r2, r3] - strh r3, [r1, #0x16] - ldrh r3, [r0, #0xc] - lsr r3, r3, #0x8 - lsl r3, r3, #0x1 - ldrh r3, [r2, r3] - strh r3, [r1, #0x18] - ldrh r3, [r0, #0xc] - lsl r3, r3, #0x18 - lsr r3, r3, #0x17 - ldrh r3, [r2, r3] - strh r3, [r1, #0x1a] - ldrh r3, [r0, #0xe] - lsr r3, r3, #0x8 - lsl r3, r3, #0x1 - ldrh r3, [r2, r3] - strh r3, [r1, #0x1c] - ldrh r0, [r0, #0xe] - lsl r0, r0, #0x18 - lsr r0, r0, #0x17 - ldrh r0, [r2, r0] - strh r0, [r1, #0x1e] - bx lr - .balign 4 -_0201C1A4: .word UNK_021C5734 - - thumb_func_start FUN_0201C1A8 -FUN_0201C1A8: ; 0x0201C1A8 - mov r1, #0x0 - str r1, [r0, #0x2c] - bx lr - .balign 4 - - thumb_func_start FUN_0201C1B0 -FUN_0201C1B0: ; 0x0201C1B0 - push {r3-r5, lr} - sub sp, #0x8 - mov r1, #0x6 - mov r0, #0x0 - lsl r1, r1, #0x8 - bl AllocFromHeap - mov r2, #0x0 - add r5, r0, #0x0 - str r2, [sp, #0x0] - mov r0, #0xe - mov r1, #0x5 - add r3, sp, #0x4 - bl FUN_02006BB0 - add r4, r0, #0x0 - ldr r0, [sp, #0x4] - mov r2, #0x6 - ldr r0, [r0, #0x14] - add r1, r5, #0x0 - lsl r2, r2, #0x8 - bl MIi_CpuCopy32 - add r0, r4, #0x0 - bl FreeToHeap - add r0, r5, #0x0 - add sp, #0x8 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0201C1EC -FUN_0201C1EC: ; 0x0201C1EC - push {r3-r7, lr} - sub sp, #0x18 - add r4, r0, #0x0 - ldr r0, [r4, #0x2c] - add r7, r3, #0x0 - ldr r5, [r4, #0x4] - cmp r0, #0x0 - bne _0201C202 - bl FUN_0201C1B0 - str r0, [r4, #0x2c] -_0201C202: - mov r0, #0x6 - lsl r0, r0, #0x6 - add r6, r7, #0x0 - mul r6, r0 - add r0, r5, #0x0 - ldr r4, [r4, #0x2c] - bl FUN_0201AB0C - sub r0, r0, #0x3 - lsl r0, r0, #0x13 - mov r1, #0x18 - lsr r2, r0, #0x10 - str r1, [sp, #0x0] - mov r0, #0x20 - str r0, [sp, #0x4] - str r2, [sp, #0x8] - mov r2, #0x0 - str r2, [sp, #0xc] - str r1, [sp, #0x10] - str r0, [sp, #0x14] - add r0, r5, #0x0 - add r1, r4, r6 - add r3, r2, #0x0 - bl FUN_02019658 - add sp, #0x18 - pop {r3-r7, pc} - - thumb_func_start FUN_0201C238 -FUN_0201C238: ; 0x0201C238 - push {r4, lr} - add r4, r0, #0x0 - ldr r0, [r4, #0x2c] - cmp r0, #0x0 - beq _0201C24A - bl FreeToHeap - mov r0, #0x0 - str r0, [r4, #0x2c] -_0201C24A: - pop {r4, pc} diff --git a/arm9/asm/unk_02021590.s b/arm9/asm/unk_02021590.s index d526846f..67d46c65 100644 --- a/arm9/asm/unk_02021590.s +++ b/arm9/asm/unk_02021590.s @@ -309,47 +309,47 @@ _02021798: ; jump table (using 16-bit offset) _020217A0: add r0, r4, r5 add r1, r6, #0x0 - bl FUN_0201C100 + bl DecompressGlyphTile b _02021802 _020217AA: add r0, r4, r5 add r1, r6, #0x0 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, r5 add r1, r6, #0x0 add r0, #0x10 add r1, #0x40 - bl FUN_0201C100 + bl DecompressGlyphTile b _02021802 _020217C0: add r0, r4, r5 add r1, r6, #0x0 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, r5 add r1, r6, #0x0 add r0, #0x10 add r1, #0x20 - bl FUN_0201C100 + bl DecompressGlyphTile b _02021802 _020217D6: add r0, r4, r5 add r1, r6, #0x0 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, r5 add r1, r6, #0x0 add r0, #0x10 add r1, #0x20 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, r5 add r1, r6, #0x0 add r0, #0x20 add r1, #0x40 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, r5 add r1, r6, #0x0 add r0, #0x30 add r1, #0x60 - bl FUN_0201C100 + bl DecompressGlyphTile _02021802: ldr r1, [sp, #0x0] ldr r2, [r7, #0x70] @@ -400,50 +400,50 @@ _02021856: add r0, r4, #0x0 add r0, #0x14 add r1, r5, #0x0 - bl FUN_0201C100 + bl DecompressGlyphTile b _020218C0 _02021862: add r0, r4, #0x0 add r0, #0x14 add r1, r5, #0x0 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, #0x0 add r1, r5, #0x0 add r0, #0x24 add r1, #0x40 - bl FUN_0201C100 + bl DecompressGlyphTile b _020218C0 _0202187A: add r0, r4, #0x0 add r0, #0x14 add r1, r5, #0x0 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, #0x0 add r1, r5, #0x0 add r0, #0x24 add r1, #0x20 - bl FUN_0201C100 + bl DecompressGlyphTile b _020218C0 _02021892: add r0, r4, #0x0 add r0, #0x14 add r1, r5, #0x0 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, #0x0 add r1, r5, #0x0 add r0, #0x24 add r1, #0x20 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, #0x0 add r1, r5, #0x0 add r0, #0x34 add r1, #0x40 - bl FUN_0201C100 + bl DecompressGlyphTile add r0, r4, #0x0 add r1, r5, #0x0 add r0, #0x44 add r1, #0x60 - bl FUN_0201C100 + bl DecompressGlyphTile _020218C0: ldr r2, [r4, #0x70] add r0, r4, #0x0 diff --git a/arm9/global.inc b/arm9/global.inc index 0053d427..d816d92a 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1161,7 +1161,7 @@ .extern AddTextPrinterParameterized2 .extern AddTextPrinterParameterized3 .extern GenerateFontHalfRowLookupTable -.extern FUN_0201C100 +.extern DecompressGlyphTile .extern FUN_0201C1EC .extern FUN_0201C24C .extern FUN_0201C29C diff --git a/arm9/src/text.c b/arm9/src/text.c index 8ec3efe8..6207d913 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -1,10 +1,11 @@ #include "text.h" #include "heap.h" #include "string16.h" +#include "MI_memory.h" const struct FontInfo *gFonts = NULL; -u8 UNK_021C5734[0x200]; +u16 UNK_021C5734[0x100]; u32 UNK_021C5714[8]; u8 UNK_021C570C[8]; @@ -12,13 +13,18 @@ extern u32 FUN_0200CA7C(void (*func)(u32, struct TextPrinter *), struct TextPrin extern struct TextPrinter *FUN_0201B6C8(void); extern void FUN_0200CAB4(u32 param0); -extern void FUN_0201C238(struct TextPrinter *printer); extern void FUN_0201C1A8(struct TextPrinter *printer); extern void CopyWindowToVram(u32 windowId); extern u32 FontFunc(u8 fontId, struct TextPrinter *printer); +extern void *FUN_02006BB0(u32 param0, u32 param1, u32 param2, struct TextPrinter **param3, u32 param4); + +extern u32 FUN_0201AB0C(u32 windowId); +extern void FUN_02019658(u32 param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5, u32 param6, u32 param7, u32 param8, u32 param9); + + THUMB_FUNC void SetFontsPointer(const struct FontInfo *fonts) { gFonts = fonts; @@ -498,3 +504,61 @@ THUMB_FUNC void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadow } } #endif + +THUMB_FUNC void DecompressGlyphTile(const u16 *src, u16 *dst) +{ + dst[0] = UNK_021C5734[(u32)src[0] >> 8]; + dst[1] = UNK_021C5734[(u8)src[0]]; + dst[2] = UNK_021C5734[(u32)src[1] >> 8]; + dst[3] = UNK_021C5734[(u8)src[1]]; + dst[4] = UNK_021C5734[(u32)src[2] >> 8]; + dst[5] = UNK_021C5734[(u8)src[2]]; + dst[6] = UNK_021C5734[(u32)src[3] >> 8]; + dst[7] = UNK_021C5734[(u8)src[3]]; + dst[8] = UNK_021C5734[(u32)src[4] >> 8]; + dst[9] = UNK_021C5734[(u8)src[4]]; + dst[10] = UNK_021C5734[(u32)src[5] >> 8]; + dst[11] = UNK_021C5734[(u8)src[5]]; + dst[12] = UNK_021C5734[(u32)src[6] >> 8]; + dst[13] = UNK_021C5734[(u8)src[6]]; + dst[14] = UNK_021C5734[(u32)src[7] >> 8]; + dst[15] = UNK_021C5734[(u8)src[7]]; +} + +THUMB_FUNC void FUN_0201C1A8(struct TextPrinter *printer) +{ + printer->Unk2C = NULL; +} + +THUMB_FUNC void *FUN_0201C1B0(void) +{ + void *res = AllocFromHeap(0, sizeof(struct TextPrinter) * 32); + struct TextPrinter *var; + void *tmp = FUN_02006BB0(14, 5, 0, &var, 0); + MIi_CpuCopy32((void *)var->printerTemplate.Unk20, res, sizeof(struct TextPrinter) * 32); //todo Unk20 can't be right here + FreeToHeap(tmp); + return res; +} + +THUMB_FUNC void FUN_0201C1EC(struct TextPrinter *printer, u32 param1, u32 param2, u32 param3) +{ +#pragma unused (param1, param2) + u32 windowId = printer->printerTemplate.windowId; + if (printer->Unk2C == NULL) + { + printer->Unk2C = FUN_0201C1B0(); + } + u32 r6 = (u32)printer->Unk2C + param3 * (sizeof(struct TextPrinter) * 8); + u32 r2 = ((FUN_0201AB0C(windowId) - 3) << 0x13) >> 0x10; + FUN_02019658(windowId, r6, 0, 0, 24, 32, r2, 0, 24, 32); +} + +THUMB_FUNC void FUN_0201C238(struct TextPrinter *printer) +{ + if (printer->Unk2C == NULL) + { + return; + } + FreeToHeap(printer->Unk2C); + printer->Unk2C = NULL; +} 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