diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-05-21 21:50:44 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-05-21 21:50:44 -0400 |
commit | 4d5947ecb02e28fce1cd1156bd6908571fbf29bd (patch) | |
tree | 44a49d8d53db30994487ecb9358d38ce47767e34 | |
parent | 70b098f92d46c134388e02bd8c436649fe31e999 (diff) |
Adjust typing in text.c routines
-rw-r--r-- | arm9/asm/unk_02001B80.s | 2 | ||||
-rw-r--r-- | arm9/asm/unk_0200CABC.s | 2 | ||||
-rw-r--r-- | arm9/asm/unk_02016B94.s | 22 | ||||
-rw-r--r-- | arm9/asm/unk_020772F0.s | 2 | ||||
-rw-r--r-- | arm9/global.inc | 6 | ||||
-rw-r--r-- | arm9/modules/05/asm/mod05_021E2E88.s | 18 | ||||
-rw-r--r-- | arm9/modules/14/asm/module_14.s | 2 | ||||
-rw-r--r-- | arm9/modules/15/asm/module_15.s | 4 | ||||
-rw-r--r-- | arm9/modules/16/asm/module_16.s | 2 | ||||
-rw-r--r-- | arm9/modules/53/asm/module_53.s | 2 | ||||
-rw-r--r-- | arm9/modules/58/asm/module_58.s | 2 | ||||
-rw-r--r-- | arm9/modules/75/asm/module_75.s | 8 | ||||
-rw-r--r-- | arm9/modules/84/asm/module_84_thumb2.s | 2 | ||||
-rw-r--r-- | arm9/src/script_buffers.c | 6 | ||||
-rw-r--r-- | arm9/src/text.c | 19 | ||||
-rw-r--r-- | include/text.h | 66 |
16 files changed, 83 insertions, 82 deletions
diff --git a/arm9/asm/unk_02001B80.s b/arm9/asm/unk_02001B80.s index 696f470c..18e10da6 100644 --- a/arm9/asm/unk_02001B80.s +++ b/arm9/asm/unk_02001B80.s @@ -913,7 +913,7 @@ FUN_02002218: ; 0x02002218 mov r2, #0x0 str r3, [sp, #0x14] add r3, r2, #0x0 - bl FUN_02019658 + bl BlitBitmapRectToWindow add sp, #0x18 pop {r4, pc} nop diff --git a/arm9/asm/unk_0200CABC.s b/arm9/asm/unk_0200CABC.s index 69afdbe7..27b27a76 100644 --- a/arm9/asm/unk_0200CABC.s +++ b/arm9/asm/unk_0200CABC.s @@ -879,7 +879,7 @@ FUN_0200D148: ; 0x0200D148 mov r0, #0x0 str r0, [sp, #0x10] add r0, sp, #0x1c - bl FUN_02018A60 + bl BlitBitmapRect4Bit add sp, #0x24 pop {r4-r5, pc} diff --git a/arm9/asm/unk_02016B94.s b/arm9/asm/unk_02016B94.s index a6817b28..0a68dea2 100644 --- a/arm9/asm/unk_02016B94.s +++ b/arm9/asm/unk_02016B94.s @@ -4256,8 +4256,8 @@ _02018A54: .word 0x0400100A _02018A58: .word 0x0400100C _02018A5C: .word 0x0400100E - thumb_func_start FUN_02018A60 -FUN_02018A60: ; 0x02018A60 + thumb_func_start BlitBitmapRect4Bit +BlitBitmapRect4Bit: ; 0x02018A60 push {r3-r7, lr} sub sp, #0x68 str r2, [sp, #0x8] @@ -4560,8 +4560,8 @@ _02018C92: _02018C98: .word 0x0000FFFF _02018C9C: .word 0x00003FE0 - thumb_func_start FUN_02018CA0 -FUN_02018CA0: ; 0x02018CA0 + thumb_func_start BlitBitmapRect8Bit +BlitBitmapRect8Bit: ; 0x02018CA0 push {r3-r7, lr} sub sp, #0x50 str r2, [sp, #0x8] @@ -5917,8 +5917,8 @@ _0201963C: bl MIi_CpuClearFast pop {r3-r5, pc} - thumb_func_start FUN_02019658 -FUN_02019658: ; 0x02019658 + thumb_func_start BlitBitmapRectToWindow +BlitBitmapRectToWindow: ; 0x02019658 push {r4-r5, lr} sub sp, #0x1c add r4, sp, #0x18 @@ -5936,13 +5936,13 @@ FUN_02019658: ; 0x02019658 str r4, [sp, #0x14] mov r4, #0x0 str r4, [sp, #0x18] - bl FUN_02019684 + bl BlitBitmapRect add sp, #0x1c pop {r4-r5, pc} .balign 4 - thumb_func_start FUN_02019684 -FUN_02019684: ; 0x02019684 + thumb_func_start BlitBitmapRect +BlitBitmapRect: ; 0x02019684 push {r4-r5, lr} sub sp, #0x24 str r1, [sp, #0x1c] @@ -5980,7 +5980,7 @@ FUN_02019684: ; 0x02019684 ldrh r0, [r4, #0x28] str r0, [sp, #0x10] add r0, sp, #0x1c - bl FUN_02018A60 + bl BlitBitmapRect4Bit add sp, #0x24 pop {r4-r5, pc} _020196D6: @@ -5994,7 +5994,7 @@ _020196D6: ldrh r0, [r4, #0x28] str r0, [sp, #0x10] add r0, sp, #0x1c - bl FUN_02018CA0 + bl BlitBitmapRect8Bit add sp, #0x24 pop {r4-r5, pc} .balign 4 diff --git a/arm9/asm/unk_020772F0.s b/arm9/asm/unk_020772F0.s index 80d633bb..16a7190f 100644 --- a/arm9/asm/unk_020772F0.s +++ b/arm9/asm/unk_020772F0.s @@ -4119,7 +4119,7 @@ _02078EB4: mov r2, #0x0 ldr r0, [sp, #0x18] add r3, r2, #0x0 - bl FUN_02019658 + bl BlitBitmapRectToWindow b _02078F56 _02078F00: ldr r0, _02078F78 ; =0x0000D004 diff --git a/arm9/global.inc b/arm9/global.inc index 4bb2f382..b3f4dcbb 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1068,7 +1068,7 @@ .extern FUN_0201886C .extern FUN_02018878 .extern FUN_02018884 -.extern FUN_02018A60 +.extern BlitBitmapRect4Bit .extern FUN_02018F4C .extern AllocWindows .extern InitWindow @@ -1099,8 +1099,8 @@ .extern FUN_020195E4 .extern FUN_0201960C .extern FillWindowPixelBuffer -.extern FUN_02019658 -.extern FUN_02019684 +.extern BlitBitmapRectToWindow +.extern BlitBitmapRect .extern FillWindowPixelRect .extern FUN_0201974C .extern ScrollWindow diff --git a/arm9/modules/05/asm/mod05_021E2E88.s b/arm9/modules/05/asm/mod05_021E2E88.s index f83ed12c..75d92e5b 100644 --- a/arm9/modules/05/asm/mod05_021E2E88.s +++ b/arm9/modules/05/asm/mod05_021E2E88.s @@ -159,7 +159,7 @@ _021E2F92: ldr r1, [r5, #0x34] add r0, #0x20 ldr r1, [r1, #0x14] - bl FUN_02019658 + bl BlitBitmapRectToWindow ldr r0, [sp, #0x18] mov r1, #8 add r0, r0, #1 @@ -178,7 +178,7 @@ _021E2F92: ldr r1, [r1, #0x14] add r0, #0x20 mov r2, #0x18 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r0, #8 str r0, [sp] str r0, [sp, #4] @@ -192,7 +192,7 @@ _021E2F92: ldr r1, [r1, #0x14] add r0, #0x20 mov r2, #0x38 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r1, #8 str r1, [sp] lsl r0, r4, #0x10 @@ -208,7 +208,7 @@ _021E2F92: add r0, #0x20 mov r2, #0x40 mov r3, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r1, #8 str r1, [sp] str r1, [sp, #4] @@ -223,7 +223,7 @@ _021E2F92: ldr r1, [r1, #0x14] add r0, #0x20 mov r2, #0x20 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r1, #8 str r1, [sp] lsl r0, r4, #0x10 @@ -240,7 +240,7 @@ _021E2F92: add r0, #0x20 mov r2, #0x30 mov r3, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow ldr r0, [sp, #0x18] mov r7, #0 cmp r0, #0 @@ -266,7 +266,7 @@ _021E3078: ldr r1, [r1, #0x14] mov r2, #0x10 mov r3, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r0, #8 str r0, [sp] str r0, [sp, #4] @@ -282,7 +282,7 @@ _021E3078: ldr r1, [r1, #0x14] mov r2, #0x48 mov r3, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r0, #8 str r0, [sp] str r0, [sp, #4] @@ -299,7 +299,7 @@ _021E3078: ldr r1, [r1, #0x14] mov r2, #0x28 mov r3, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow add r0, r7, #1 lsl r0, r0, #0x18 lsr r7, r0, #0x18 diff --git a/arm9/modules/14/asm/module_14.s b/arm9/modules/14/asm/module_14.s index 3af57590..3a321743 100644 --- a/arm9/modules/14/asm/module_14.s +++ b/arm9/modules/14/asm/module_14.s @@ -21087,7 +21087,7 @@ _021E1AA0: ldr r1, [r1, #0x14] lsr r2, r2, #0x10 lsr r3, r3, #0x10 - bl FUN_02019684 + bl BlitBitmapRect add sp, #0x1c pop {r4, r5, pc} .align 2, 0 diff --git a/arm9/modules/15/asm/module_15.s b/arm9/modules/15/asm/module_15.s index 3c379dc5..cd1cb9eb 100644 --- a/arm9/modules/15/asm/module_15.s +++ b/arm9/modules/15/asm/module_15.s @@ -7416,7 +7416,7 @@ _021DADD4: ldr r1, [r5, #0x2c] add r0, #0x10 add r3, r2, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r1, #0x60 lsl r2, r7, #0x10 lsl r3, r6, #0x10 @@ -7436,7 +7436,7 @@ _021DADD4: ldr r1, [r5, #0x2c] add r0, #0x10 lsr r3, r3, #0x10 - bl FUN_02019658 + bl BlitBitmapRectToWindow add sp, #0x18 pop {r3, r4, r5, r6, r7, pc} nop diff --git a/arm9/modules/16/asm/module_16.s b/arm9/modules/16/asm/module_16.s index 45bf6e83..adc8e5c2 100644 --- a/arm9/modules/16/asm/module_16.s +++ b/arm9/modules/16/asm/module_16.s @@ -9139,7 +9139,7 @@ MOD16_021DB7F4: ; 0x021DB7F4 str r0, [sp, #0x10] str r0, [sp, #0x14] ldr r0, [sp, #0x18] - bl FUN_02019658 + bl BlitBitmapRectToWindow _021DB848: add sp, #0x20 pop {r3, r4, r5, r6, r7, pc} diff --git a/arm9/modules/53/asm/module_53.s b/arm9/modules/53/asm/module_53.s index 93468fe6..f49ce02c 100644 --- a/arm9/modules/53/asm/module_53.s +++ b/arm9/modules/53/asm/module_53.s @@ -2915,7 +2915,7 @@ _021D8C9C: mov r1, ip lsr r2, r2, #0x10 lsr r3, r3, #0x10 - bl FUN_02019658 + bl BlitBitmapRectToWindow add sp, #0x1c pop {r4, r5, r6, r7, pc} thumb_func_end MOD53_021D8C58 diff --git a/arm9/modules/58/asm/module_58.s b/arm9/modules/58/asm/module_58.s index 9a7a8402..7f3bd998 100644 --- a/arm9/modules/58/asm/module_58.s +++ b/arm9/modules/58/asm/module_58.s @@ -1780,7 +1780,7 @@ _021DA888: mov r1, ip lsr r2, r2, #0x10 lsr r3, r3, #0x10 - bl FUN_02019658 + bl BlitBitmapRectToWindow add sp, #0x1c pop {r4, r5, r6, r7, pc} thumb_func_end MOD58_021DA844 diff --git a/arm9/modules/75/asm/module_75.s b/arm9/modules/75/asm/module_75.s index 197cb819..82294cbf 100644 --- a/arm9/modules/75/asm/module_75.s +++ b/arm9/modules/75/asm/module_75.s @@ -7898,7 +7898,7 @@ _021EA9A8: ldr r1, [r1, #0x14] add r0, #0x54 mov r3, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow add r5, #0x54 add r0, r5, #0 bl FUN_02019220 @@ -7979,7 +7979,7 @@ _021EAA4C: add r0, r6, #0 ldr r1, [r1, #0x14] mov r3, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow add r0, r4, #1 lsl r0, r0, #0x18 lsr r4, r0, #0x18 @@ -8617,7 +8617,7 @@ MOD75_021EAF70: ; 0x021EAF70 add r0, r5, #4 ldr r1, [r1, #0x14] mov r2, #0x28 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r0, #6 add r1, r6, #0 bl FreeToHeapExplicit @@ -8692,7 +8692,7 @@ MOD75_021EB004: ; 0x021EB004 add r0, r5, #4 ldr r1, [r1, #0x14] add r3, r2, #0 - bl FUN_02019658 + bl BlitBitmapRectToWindow mov r0, #6 add r1, r6, #0 bl FreeToHeapExplicit diff --git a/arm9/modules/84/asm/module_84_thumb2.s b/arm9/modules/84/asm/module_84_thumb2.s index 087f0fe0..82d292c6 100644 --- a/arm9/modules/84/asm/module_84_thumb2.s +++ b/arm9/modules/84/asm/module_84_thumb2.s @@ -750,7 +750,7 @@ _021D864C: ldr r0, [r5, #0x24] ldr r1, [r1, #0xc] lsr r3, r3, #0x10 - bl FUN_02019658 + bl BlitBitmapRectToWindow _021D86D0: mov r1, #1 str r1, [r5, #0x18] diff --git a/arm9/src/script_buffers.c b/arm9/src/script_buffers.c index 55ceca6a..e17654d8 100644 --- a/arm9/src/script_buffers.c +++ b/arm9/src/script_buffers.c @@ -21,7 +21,7 @@ extern void StringCat_HandleTrainerName(struct String * dest, const struct Strin extern void StrAddChar(struct String * str, u16 val); extern void * FUN_02006BB0(NarcId, s32, s32, struct UnkStruct_0200B870_sub **, u32); extern BOOL UncompressFromNarc(NarcId narcId, s32 memberNo, BOOL a2, u32 heap_id, BOOL a4); -extern void FUN_02019658(int, u8 *, u16, u16, u16, u16, u16, u16, u16, u16); +extern void BlitBitmapRectToWindow(int, u8 *, u16, u16, u16, u16, u16, u16, u16, u16); extern void FillWindowPixelRect(int, u8, u16, u16, u16, u16); const u16 UNK_020ECE6C[][2] = { @@ -805,7 +805,7 @@ void MessagePrinter_delete(struct UnkStruct_0200B870 * a0) void FUN_0200B9A8(struct UnkStruct_0200B870 * a0, int a1, int a2, int a3, int a4) { - FUN_02019658(a2, a0->unk_4->unk_14 + UNK_020ECE6C[a1][0], 0, 0, UNK_020ECE6C[a1][1], 8, (u16)a3, (u16)a4, UNK_020ECE6C[a1][1], 8); + BlitBitmapRectToWindow(a2, a0->unk_4->unk_14 + UNK_020ECE6C[a1][0], 0, 0, UNK_020ECE6C[a1][1], 8, (u16)a3, (u16)a4, UNK_020ECE6C[a1][1], 8); } void FUN_0200B9EC(struct UnkStruct_0200B870 * string, u32 value, u32 n, enum PrintingMode mode, int sp30, int r5, int r7) @@ -815,7 +815,7 @@ void FUN_0200B9EC(struct UnkStruct_0200B870 * string, u32 value, u32 n, enum Pri { if (string->data[i] >= 0x00A2 && string->data[i] <= 0x00AB) { - FUN_02019658(sp30, string->unk_4->unk_14 + (string->data[i] - 0x00A2) * 32, 0, 0, 8, 8, (u16)r5, (u16)r7, 8, 8); + BlitBitmapRectToWindow(sp30, string->unk_4->unk_14 + (string->data[i] - 0x00A2) * 32, 0, 0, 8, 8, (u16)r5, (u16)r7, 8, 8); } else { diff --git a/arm9/src/text.c b/arm9/src/text.c index bbaa3472..b4adba16 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -2,6 +2,7 @@ #include "heap.h" #include "string16.h" #include "MI_memory.h" +#include "filesystem.h" const struct FontInfo *gFonts = NULL; @@ -22,9 +23,9 @@ extern void CopyWindowToVram(struct Window * window); extern u32 FontFunc(u8 fontId, struct TextPrinter *printer); -extern void *FUN_02006BB0(u32 param0, u32 param1, u32 param2, struct TextPrinter **param3, u32 param4); +extern void *FUN_02006BB0(NarcId narcId, s32 param1, BOOL param2, void *param3, u32 heap_id); -extern void FUN_02019658(struct Window * param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5, u32 param6, u32 param7, u32 param8, u32 param9); +extern void BlitBitmapRectToWindow(struct Window * window, void * src, u16 srcX, u16 srcY, u16 srcWidth, u16 srcHeight, u16 dstX, u16 dstY, u16 dstWidth, u16 dstHeight); THUMB_FUNC void SetFontsPointer(const struct FontInfo *fonts) @@ -329,12 +330,12 @@ THUMB_FUNC void FUN_0201C1A8(struct TextPrinter *printer) printer->Unk2C = NULL; } -THUMB_FUNC void *FUN_0201C1B0(void) +THUMB_FUNC u16 *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 + void *res = AllocFromHeap(0, 32 * 24 * sizeof(u16)); + struct Font * var; + void *tmp = FUN_02006BB0(NARC_GRAPHIC_FONT, 5, 0, &var, 0); + MIi_CpuCopy32(var->unk20, res, 32 * 24 * sizeof(u16)); FreeToHeap(tmp); return res; } @@ -347,9 +348,9 @@ THUMB_FUNC void FUN_0201C1EC(struct TextPrinter *printer, u32 param1, u32 param2 { printer->Unk2C = FUN_0201C1B0(); } - u32 r6 = (u32)printer->Unk2C + param3 * (sizeof(struct TextPrinter) * 8); + u16 * r6 = printer->Unk2C + param3 * 6 * 32; u16 r2 = (GetWindowWidth(window) - 3) * 8; - FUN_02019658(window, r6, 0, 0, 24, 32, r2, 0, 24, 32); + BlitBitmapRectToWindow(window, r6, 0, 0, 24, 32, r2, 0, 24, 32); } THUMB_FUNC void FUN_0201C238(struct TextPrinter *printer) diff --git a/include/text.h b/include/text.h index 78bfb9d4..c9afc9b3 100644 --- a/include/text.h +++ b/include/text.h @@ -7,49 +7,49 @@ struct TextPrinterTemplate { - const u16* currentChar; - struct Window * window; - u8 padding[1]; - u8 fontId; - u8 x; - u8 y; - u8 currentX; - u8 currentY; - u8 letterSpacing; - u8 lineSpacing; - u8 unk; - u8 fgColor; - u8 bgColor; - u8 shadowColor; - union - { - struct - { - u16 unk2; - u8 unk3; - u8 unk4; - }; - u32 Unk20; //todo this can't be right - }; + const u16* currentChar; // 0 + struct Window * window; // 4 + u8 padding[1]; // 8 + u8 fontId; // 9 + u8 x; // a + u8 y; // b + u8 currentX; // c + u8 currentY; // d + u8 letterSpacing; // e + u8 lineSpacing; // f + u8 unk; // 10 + u8 fgColor; // 11 + u8 bgColor; // 12 + u8 shadowColor; // 13 + u16 unk2; // 14 + u8 unk3; // 16 + u8 unk4; // 17 +}; + +struct Font +{ + u8 filler[20]; + void * unk20; }; struct TextPrinter { struct TextPrinterTemplate printerTemplate; - u8 (*callback)(struct TextPrinterTemplate *, u16); // 0x10 + u8 (*callback)(struct TextPrinterTemplate *, u16); // 0x18 u8 subStructFields[7]; // always cast to struct TextPrinterSubStruct... so why bother - u8 active; - u8 state; // 0x1C - u8 textSpeedBottom:7; + // 1c + u8 active; // 23 + u8 state; // 0x24 + u8 textSpeedBottom:7; // 25 u8 textSpeedTop:1; - u8 delayCounter; - u8 scrollDistance; - u8 minLetterSpacing; // 0x20 + u8 delayCounter; // 26 + u8 scrollDistance; // 27 + u8 minLetterSpacing; // 0x28 u8 Unk29; // used to be japanese, not sure about that anymore u16 Unk2A; - void *Unk2C; + u16 *Unk2C; }; struct FontInfo @@ -80,7 +80,7 @@ u32 RenderFont(struct TextPrinter *printer); void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); void DecompressGlyphTile(const u16 *src, u16 *dst); void FUN_0201C1A8(struct TextPrinter *printer); -void *FUN_0201C1B0(void); +u16 *FUN_0201C1B0(void); void FUN_0201C1EC(struct TextPrinter *printer, u32 param1, u32 param2, u32 param3); void FUN_0201C238(struct TextPrinter *printer); |