From aa64f61b84d6b52f4073cf9acef1a927cd9010e6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 22 Sep 2017 00:01:07 -0400 Subject: [PATCH] Finish decomp of unk_text_util_2 --- asm/unk_text_util_2.s | 60 ------------------------------------------- ld_script.txt | 1 - src/unk_text_util_2.c | 21 ++++++++++++++- 3 files changed, 20 insertions(+), 62 deletions(-) delete mode 100755 asm/unk_text_util_2.s diff --git a/asm/unk_text_util_2.s b/asm/unk_text_util_2.s deleted file mode 100755 index c1ab255949..0000000000 --- a/asm/unk_text_util_2.s +++ /dev/null @@ -1,60 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start DecompressGlyphFont6 -DecompressGlyphFont6: @ 81BA668 - push {r4,r5,lr} - lsls r0, 16 - lsrs r2, r0, 19 - lsls r2, 9 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - lsrs r1, 11 - ldr r0, =gFont6BrailleGlyphs - adds r1, r0 - adds r5, r2, r1 - ldr r4, =gUnknown_03002F90 - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - movs r1, 0x88 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x60 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x80 - movs r1, 0x10 - strb r1, [r0] - adds r0, 0x1 - strb r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressGlyphFont6 - - thumb_func_start GetGlyphWidthFont6 -GetGlyphWidthFont6: @ 81BA6CC - movs r0, 0x10 - bx lr - thumb_func_end GetGlyphWidthFont6 - - .align 2, 0 @ Don't pad with nop. diff --git a/ld_script.txt b/ld_script.txt index bafc672857..aee6ae59ac 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -254,7 +254,6 @@ SECTIONS { asm/party_menu.o(.text); asm/battle_tent.o(.text); src/unk_text_util_2.o(.text); - asm/unk_text_util_2.o(.text); src/multiboot.o(.text); asm/unk_81BAD84.o(.text); asm/battle_controller_player_partner.o(.text); diff --git a/src/unk_text_util_2.c b/src/unk_text_util_2.c index 23f3ca1b6c..d9bd9d98d2 100644 --- a/src/unk_text_util_2.c +++ b/src/unk_text_util_2.c @@ -5,8 +5,9 @@ #include "sound.h" extern const u8 gUnknown_08616124[]; +extern const u16 gFont6BrailleGlyphs[]; -void DecompressGlyphFont6(u16); +static void DecompressGlyphFont6(u16); u16 Font6Func(struct TextPrinter *textPrinter) { @@ -198,3 +199,21 @@ u16 Font6Func(struct TextPrinter *textPrinter) } return 1; } + +static void DecompressGlyphFont6(u16 glyph) +{ + const u16 *glyphs; + + glyphs = gFont6BrailleGlyphs + 0x100 * (glyph / 8) + 0x10 * (glyph % 8); + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90 + 0x60)); + gUnknown_03002F90[0x80] = 0x10; + gUnknown_03002F90[0x81] = 0x10; +} + +u8 GetGlyphWidthFont6(void) +{ + return 0x10; +}