From 5a8eeb353d505af656d2f7efff7b2c73e1bd6e07 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Mon, 27 Mar 2017 19:30:49 -0500 Subject: [PATCH] Mostly decompile text.s --- asm/battle_message.s | 6 +- asm/contest.s | 4 +- asm/daycare.s | 2 +- asm/evolution_scene.s | 4 +- asm/field_message_box.s | 2 +- asm/link.s | 6 +- asm/menu_helpers.s | 2 +- asm/naming_screen.s | 2 +- asm/pokeblock_feed.s | 2 +- asm/rom_8184DA4.s | 26 +- asm/rom_81BAD84.s | 8 +- asm/scrcmd.s | 2 +- asm/text.s | 3592 ----------------- asm/window.s | 88 +- data/graphics/fonts/down_arrow.png | Bin 0 -> 156 bytes data/graphics/fonts/down_arrow_RS.png | Bin 0 -> 156 bytes data/graphics/fonts/keypad_icons.png | Bin 0 -> 297 bytes .../fonts/unused_frlg_blanked_down_arrow.png | Bin 0 -> 135 bytes .../graphics/fonts/unused_frlg_down_arrow.png | Bin 0 -> 189 bytes data/text.s | 94 - graphics_file_rules.mk | 15 + include/text.h | 78 +- ld_script.txt | 3 +- src/string_util.c | 88 +- src/text.c | 2626 +++++++++++- sym_common.txt | 12 +- sym_ewram.txt | 2 +- 27 files changed, 2795 insertions(+), 3869 deletions(-) delete mode 100644 asm/text.s create mode 100644 data/graphics/fonts/down_arrow.png create mode 100644 data/graphics/fonts/down_arrow_RS.png create mode 100644 data/graphics/fonts/keypad_icons.png create mode 100644 data/graphics/fonts/unused_frlg_blanked_down_arrow.png create mode 100644 data/graphics/fonts/unused_frlg_down_arrow.png delete mode 100644 data/text.s diff --git a/asm/battle_message.s b/asm/battle_message.s index cf7ff1d90..89b159706 100644 --- a/asm/battle_message.s +++ b/asm/battle_message.s @@ -2883,7 +2883,7 @@ _0814FA36: _0814FAC6: cmp r7, 0x16 bne _0814FAE0 - ldr r0, =gUnknown_03003014 + ldr r0, =gTextFlags ldrb r2, [r0] movs r1, 0x3 negs r1, r1 @@ -2891,7 +2891,7 @@ _0814FAC6: b _0814FAE8 .pool _0814FAE0: - ldr r0, =gUnknown_03003014 + ldr r0, =gTextFlags ldrb r1, [r0] movs r2, 0x2 orrs r1, r2 @@ -2949,7 +2949,7 @@ _0814FB54: lsls r0, 24 lsrs r6, r0, 24 _0814FB5C: - ldr r0, =gUnknown_03003014 + ldr r0, =gTextFlags ldrb r1, [r0] movs r2, 0x1 orrs r1, r2 diff --git a/asm/contest.s b/asm/contest.s index b4286013e..0e66e6d65 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -166,7 +166,7 @@ sub_80D77E4: @ 80D77E4 ands r0, r1 cmp r0, 0 beq _080D7818 - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x2 negs r0, r0 @@ -175,7 +175,7 @@ sub_80D77E4: @ 80D77E4 b _080D7822 .pool _080D7818: - ldr r0, =gUnknown_03003014 + ldr r0, =gTextFlags ldrb r1, [r0] movs r2, 0x1 orrs r1, r2 diff --git a/asm/daycare.s b/asm/daycare.s index 05a8370f2..929c543bb 100644 --- a/asm/daycare.s +++ b/asm/daycare.s @@ -2893,7 +2893,7 @@ sub_807109C: @ 807109C adds r0, r2, 0 ands r0, r1 strb r0, [r3, 0xC] - ldr r3, =gUnknown_03003014 + ldr r3, =gTextFlags ldrb r1, [r3] movs r0, 0x3 negs r0, r0 diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index edc7318ca..4b679428c 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -960,7 +960,7 @@ sub_813E1D4: @ 813E1D4 strh r0, [r1] ldr r0, =gUnknown_02022E22 strh r4, [r0] - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r0, [r2] movs r1, 0x2 orrs r0, r1 @@ -2939,7 +2939,7 @@ _0813F634: ldr r0, [r4] bl Free str r5, [r4] - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x3 negs r0, r0 diff --git a/asm/field_message_box.s b/asm/field_message_box.s index 6f5e6dda8..35267e8d4 100644 --- a/asm/field_message_box.s +++ b/asm/field_message_box.s @@ -10,7 +10,7 @@ sub_8098128: @ 8098128 ldr r1, =gUnknown_020375BC movs r0, 0 strb r0, [r1] - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x2 negs r0, r0 diff --git a/asm/link.s b/asm/link.s index 9436f909b..0d5cfde11 100644 --- a/asm/link.s +++ b/asm/link.s @@ -26532,7 +26532,7 @@ sub_80173E0: @ 80173E0 negs r0, r0 ands r0, r1 strb r0, [r2, 0xC] - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x3 negs r0, r0 @@ -45458,7 +45458,7 @@ _08020C26: ldr r0, =c2_exit_to_overworld_2_switch cmp r4, r0 bne _08020C5A - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r0, [r2] movs r1, 0x4 orrs r0, r1 @@ -45585,7 +45585,7 @@ _08020D10: bl CreateTask ldr r1, [r6] strb r0, [r1, 0xA] - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x5 negs r0, r0 diff --git a/asm/menu_helpers.s b/asm/menu_helpers.s index 32ed2997e..98003c7f0 100644 --- a/asm/menu_helpers.s +++ b/asm/menu_helpers.s @@ -139,7 +139,7 @@ DisplayMessageAndContinueTask: @ 8121E7C ldr r1, [sp, 0x30] bl StringExpandPlaceholders _08121EC0: - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r0, [r2] movs r1, 0x1 orrs r0, r1 diff --git a/asm/naming_screen.s b/asm/naming_screen.s index 63626fdb5..d189a83ee 100644 --- a/asm/naming_screen.s +++ b/asm/naming_screen.s @@ -899,7 +899,7 @@ _080E3586: movs r0, 0 movs r1, 0 bl sub_81973C4 - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r0, [r2] movs r1, 0x1 orrs r0, r1 diff --git a/asm/pokeblock_feed.s b/asm/pokeblock_feed.s index 3cef9b2b0..904e0a6cf 100644 --- a/asm/pokeblock_feed.s +++ b/asm/pokeblock_feed.s @@ -735,7 +735,7 @@ _0817A260: ldr r1, =gUnknown_085E93A9 bl StringExpandPlaceholders _0817A268: - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r0, [r2] movs r1, 0x1 orrs r0, r1 diff --git a/asm/rom_8184DA4.s b/asm/rom_8184DA4.s index 9b38c3e5c..1882225cc 100644 --- a/asm/rom_8184DA4.s +++ b/asm/rom_8184DA4.s @@ -32554,7 +32554,7 @@ sub_81965D8: @ 81965D8 movs r0, 0xE0 orrs r1, r0 strb r1, [r2, 0xD] - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x3 negs r0, r0 @@ -32583,7 +32583,7 @@ sub_8196648: @ 8196648 ands r0, r1 cmp r0, 0 beq _0819666C - ldr r0, =gUnknown_03003014 + ldr r0, =gTextFlags ldrb r1, [r0] movs r2, 0x1 orrs r1, r2 @@ -32591,7 +32591,7 @@ sub_8196648: @ 8196648 b _08196678 .pool _0819666C: - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x2 negs r0, r0 @@ -34182,7 +34182,7 @@ AddTextPrinterParametrized: @ 8197238 ands r1, r4 orrs r1, r6 strb r1, [r0, 0xD] - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x3 negs r0, r0 @@ -34211,7 +34211,7 @@ AddTextPrinterForMessage: @ 81972C4 lsls r0, 24 lsrs r0, 24 movs r5, 0 - ldr r3, =gUnknown_03003014 + ldr r3, =gTextFlags movs r4, 0x1 ands r0, r4 ldrb r2, [r3] @@ -34248,7 +34248,7 @@ AddTextPrinterForMessage_2: @ 8197310 sub sp, 0x10 lsls r0, 24 lsrs r0, 24 - ldr r3, =gUnknown_03003014 + ldr r3, =gTextFlags movs r4, 0x1 ands r0, r4 ldrb r2, [r3] @@ -34289,7 +34289,7 @@ AddTextPrinterWithCustomSpeedForMessage: @ 819735C lsrs r0, 24 lsls r3, 24 lsrs r3, 24 - ldr r4, =gUnknown_03003014 + ldr r4, =gTextFlags movs r5, 0x1 ands r0, r5 ldrb r2, [r4] @@ -35036,7 +35036,7 @@ sub_8197948: @ 8197948 thumb_func_start sub_8197964 sub_8197964: @ 8197964 push {lr} - ldr r0, =gUnknown_03003014 + ldr r0, =gTextFlags ldrb r1, [r0] movs r0, 0x8 ands r0, r1 @@ -35218,7 +35218,7 @@ AddTextPrinterWithCallbackForMessage: @ 8197A9C adds r5, r1, 0 lsls r0, 24 lsrs r0, 24 - ldr r3, =gUnknown_03003014 + ldr r3, =gTextFlags movs r4, 0x1 ands r0, r4 ldrb r2, [r3] @@ -82275,7 +82275,7 @@ _081B017A: movs r0, 0 strb r0, [r6, 0x9] _081B017E: - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x5 negs r0, r0 @@ -88278,7 +88278,7 @@ sub_81B3300: @ 81B3300 movs r2, 0x4F movs r3, 0xD bl SetWindowBorderStyle - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r0, [r2] movs r1, 0x1 orrs r0, r1 @@ -101186,7 +101186,7 @@ _081BA2A6: beq _081BA2E8 subs r0, r1, 0x1 strb r0, [r6, 0x1E] - ldr r0, =gUnknown_03003014 + ldr r0, =gTextFlags ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -101210,7 +101210,7 @@ _081BA2D0: b _081BA50E .pool _081BA2E8: - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x4 ands r0, r1 diff --git a/asm/rom_81BAD84.s b/asm/rom_81BAD84.s index caa355533..757831b5e 100644 --- a/asm/rom_81BAD84.s +++ b/asm/rom_81BAD84.s @@ -32680,7 +32680,7 @@ sub_81CC194: @ 81CC194 ands r0, r1 cmp r0, 0 beq _081CC1B8 - ldr r0, =gUnknown_03003014 + ldr r0, =gTextFlags ldrb r1, [r0] movs r2, 0x1 orrs r1, r2 @@ -32688,7 +32688,7 @@ sub_81CC194: @ 81CC194 b _081CC1C4 .pool _081CC1B8: - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r1, [r2] movs r0, 0x2 negs r0, r0 @@ -46190,7 +46190,7 @@ sub_81D2BF4: @ 81D2BF4 movs r0, 0x3 movs r1, 0x11 bl FillWindowPixelBuffer - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r0, [r2] movs r1, 0x1 orrs r0, r1 @@ -63097,7 +63097,7 @@ sub_81DB620: @ 81DB620 lsls r4, r0, 1 adds r4, r0 lsls r4, 2 - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows adds r4, r0 lsls r7, r3, 5 ldrb r0, [r4, 0x3] diff --git a/asm/scrcmd.s b/asm/scrcmd.s index 84e4f3a0a..cf3917979 100644 --- a/asm/scrcmd.s +++ b/asm/scrcmd.s @@ -3300,7 +3300,7 @@ s9B_unknown: @ 809AC0C bne _0809AC1C ldr r3, [r4, 0x64] _0809AC1C: - ldr r2, =gUnknown_03003014 + ldr r2, =gTextFlags ldrb r0, [r2] movs r1, 0x4 orrs r0, r1 diff --git a/asm/text.s b/asm/text.s deleted file mode 100644 index 659b4c622..000000000 --- a/asm/text.s +++ /dev/null @@ -1,3592 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start CopyGlyphToWindow -@ int CopyGlyphToWindow(struct TextPrinter *x) -CopyGlyphToWindow: @ 8004DA0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8C - adds r3, r0, 0 - ldrb r1, [r3, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r1, =gUnknown_02020004 - adds r1, r0, r1 - adds r2, r1, 0 - ldrb r7, [r1, 0x3] - lsls r0, r7, 3 - ldrb r6, [r3, 0x8] - subs r4, r0, r6 - ldr r5, =gUnknown_03002F90 - adds r0, r5, 0 - adds r0, 0x80 - ldrb r0, [r0] - cmp r4, r0 - ble _08004DD2 - adds r4, r0, 0 -_08004DD2: - ldrb r0, [r1, 0x4] - lsls r0, 3 - ldrb r3, [r3, 0x9] - subs r0, r3 - adds r1, r5, 0 - adds r1, 0x81 - ldrb r1, [r1] - cmp r0, r1 - ble _08004DE6 - adds r0, r1, 0 -_08004DE6: - str r6, [sp] - mov r8, r3 - adds r3, r5, 0 - ldr r2, [r2, 0x8] - mov r9, r2 - lsls r1, r7, 5 - str r1, [sp, 0x4] - cmp r4, 0x8 - ble _08004DFA - b _08004F94 -_08004DFA: - cmp r0, 0x8 - bgt _08004E84 - mov r1, r8 - str r3, [sp, 0x8] - adds r2, r6, 0 - adds r2, r4 - mov r8, r2 - adds r0, r1, r0 - str r0, [sp, 0xC] - str r6, [sp, 0x10] - cmp r1, r0 - bcc _08004E14 - b _080052AA -_08004E14: - ldr r3, [sp, 0x8] - ldm r3!, {r5} - str r3, [sp, 0x8] - ldr r4, [sp, 0x10] - adds r0, r1, 0x1 - mov r10, r0 - cmp r4, r8 - bcs _08004E72 - movs r2, 0x7 - mov r12, r2 - lsrs r0, r1, 3 - ldr r2, [sp, 0x4] - adds r3, r0, 0 - muls r3, r2 - adds r7, r3, 0 - mov r3, r12 - ands r1, r3 - lsls r6, r1, 2 -_08004E38: - adds r3, r5, 0 - movs r0, 0xF - ands r3, r0 - cmp r3, 0 - beq _08004E6A - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_08004E6A: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _08004E38 -_08004E72: - mov r1, r10 - ldr r2, [sp, 0xC] - cmp r1, r2 - bcc _08004E14 - b _080052AA - .pool -_08004E84: - mov r1, r8 - str r3, [sp, 0x14] - ldr r3, [sp] - adds r3, r4 - mov r12, r3 - adds r2, r1, 0 - adds r2, 0x8 - str r2, [sp, 0x18] - ldr r3, [sp] - str r3, [sp, 0x1C] - mov r2, r12 - str r2, [sp, 0x74] - ldr r3, [sp, 0x18] - str r3, [sp, 0x88] - subs r0, 0x8 - str r0, [sp, 0x80] - cmp r1, r3 - bcs _08004F0E -_08004EA8: - ldr r0, [sp, 0x14] - ldm r0!, {r5} - str r0, [sp, 0x14] - ldr r4, [sp, 0x1C] - adds r2, r1, 0x1 - mov r8, r2 - cmp r4, r12 - bcs _08004F06 - movs r3, 0x7 - mov r10, r3 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r10 - ands r1, r0 - lsls r6, r1, 2 -_08004ECC: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _08004EFE - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r10 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_08004EFE: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r12 - bcc _08004ECC -_08004F06: - mov r1, r8 - ldr r2, [sp, 0x18] - cmp r1, r2 - bcc _08004EA8 -_08004F0E: - ldr r1, [sp, 0x88] - ldr r3, =gUnknown_03002FD0 - str r3, [sp, 0x20] - ldr r0, [sp, 0x74] - mov r8, r0 - ldr r2, [sp, 0x80] - adds r2, r1, r2 - str r2, [sp, 0x24] - ldr r3, [sp] - str r3, [sp, 0x28] - cmp r1, r2 - bcc _08004F28 - b _080052AA -_08004F28: - ldr r0, [sp, 0x20] - ldm r0!, {r5} - str r0, [sp, 0x20] - ldr r4, [sp, 0x28] - adds r2, r1, 0x1 - mov r10, r2 - cmp r4, r8 - bcs _08004F86 - movs r3, 0x7 - mov r12, r3 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r12 - ands r1, r0 - lsls r6, r1, 2 -_08004F4C: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _08004F7E - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_08004F7E: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _08004F4C -_08004F86: - mov r1, r10 - ldr r2, [sp, 0x24] - cmp r1, r2 - bcc _08004F28 - b _080052AA - .pool -_08004F94: - cmp r0, 0x8 - ble _08004F9A - b _080050A4 -_08004F9A: - mov r1, r8 - str r3, [sp, 0x2C] - ldr r3, [sp] - adds r3, 0x8 - mov r12, r3 - add r0, r8 - str r0, [sp, 0x30] - ldr r0, [sp] - str r0, [sp, 0x34] - ldr r2, [sp, 0x30] - str r2, [sp, 0x78] - str r3, [sp, 0x84] - subs r4, 0x8 - str r4, [sp, 0x7C] - cmp r8, r2 - bcs _0800501C -_08004FBA: - ldr r0, [sp, 0x2C] - ldm r0!, {r5} - str r0, [sp, 0x2C] - ldr r4, [sp, 0x34] - adds r2, r1, 0x1 - mov r10, r2 - cmp r4, r12 - bcs _08005014 - lsrs r0, r1, 3 - ldr r2, [sp, 0x4] - adds r3, r0, 0 - muls r3, r2 - adds r7, r3, 0 - movs r3, 0x7 - ands r1, r3 - lsls r6, r1, 2 -_08004FDA: - adds r3, r5, 0 - movs r0, 0xF - ands r3, r0 - cmp r3, 0 - beq _0800500C - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - movs r1, 0x7 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800500C: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r12 - bcc _08004FDA -_08005014: - mov r1, r10 - ldr r2, [sp, 0x30] - cmp r1, r2 - bcc _08004FBA -_0800501C: - mov r1, r8 - ldr r3, =gUnknown_03002FB0 - str r3, [sp, 0x38] - ldr r0, [sp, 0x84] - ldr r2, [sp, 0x7C] - adds r0, r2 - mov r8, r0 - ldr r3, [sp, 0x78] - str r3, [sp, 0x3C] - ldr r0, [sp, 0x84] - str r0, [sp, 0x40] - cmp r1, r3 - bcc _08005038 - b _080052AA -_08005038: - ldr r2, [sp, 0x38] - ldm r2!, {r5} - str r2, [sp, 0x38] - ldr r4, [sp, 0x40] - adds r3, r1, 0x1 - mov r10, r3 - cmp r4, r8 - bcs _08005096 - movs r0, 0x7 - mov r12, r0 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r12 - ands r1, r0 - lsls r6, r1, 2 -_0800505C: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _0800508E - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800508E: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _0800505C -_08005096: - mov r1, r10 - ldr r2, [sp, 0x3C] - cmp r1, r2 - bcc _08005038 - b _080052AA - .pool -_080050A4: - mov r1, r8 - str r5, [sp, 0x44] - ldr r3, [sp] - adds r3, 0x8 - mov r12, r3 - mov r2, r8 - adds r2, 0x8 - str r2, [sp, 0x48] - ldr r3, [sp] - str r3, [sp, 0x4C] - str r2, [sp, 0x88] - subs r0, 0x8 - str r0, [sp, 0x80] - mov r0, r12 - str r0, [sp, 0x84] - subs r4, 0x8 - str r4, [sp, 0x7C] - cmp r8, r2 - bcs _0800512C -_080050CA: - ldr r2, [sp, 0x44] - ldm r2!, {r5} - str r2, [sp, 0x44] - ldr r4, [sp, 0x4C] - adds r3, r1, 0x1 - mov r10, r3 - cmp r4, r12 - bcs _08005124 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - movs r0, 0x7 - ands r1, r0 - lsls r6, r1, 2 -_080050EA: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _0800511C - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - movs r1, 0x7 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800511C: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r12 - bcc _080050EA -_08005124: - mov r1, r10 - ldr r2, [sp, 0x48] - cmp r1, r2 - bcc _080050CA -_0800512C: - mov r1, r8 - ldr r3, =gUnknown_03002FB0 - str r3, [sp, 0x50] - ldr r0, [sp, 0x84] - ldr r2, [sp, 0x7C] - adds r0, r2 - mov r8, r0 - ldr r3, [sp, 0x88] - str r3, [sp, 0x54] - ldr r0, [sp, 0x84] - str r0, [sp, 0x58] - cmp r1, r3 - bcs _080051AC -_08005146: - ldr r2, [sp, 0x50] - ldm r2!, {r5} - str r2, [sp, 0x50] - ldr r4, [sp, 0x58] - adds r3, r1, 0x1 - mov r10, r3 - cmp r4, r8 - bcs _080051A4 - movs r0, 0x7 - mov r12, r0 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r12 - ands r1, r0 - lsls r6, r1, 2 -_0800516A: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _0800519C - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800519C: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _0800516A -_080051A4: - mov r1, r10 - ldr r2, [sp, 0x54] - cmp r1, r2 - bcc _08005146 -_080051AC: - ldr r1, [sp, 0x88] - ldr r3, =gUnknown_03002FD0 - str r3, [sp, 0x5C] - ldr r0, [sp, 0x84] - mov r8, r0 - ldr r2, [sp, 0x80] - adds r2, r1, r2 - str r2, [sp, 0x60] - ldr r3, [sp] - str r3, [sp, 0x64] - cmp r1, r2 - bcs _0800522A -_080051C4: - ldr r0, [sp, 0x5C] - ldm r0!, {r5} - str r0, [sp, 0x5C] - ldr r4, [sp, 0x64] - adds r2, r1, 0x1 - mov r10, r2 - cmp r4, r8 - bcs _08005222 - movs r3, 0x7 - mov r12, r3 - lsrs r0, r1, 3 - ldr r3, [sp, 0x4] - adds r2, r0, 0 - muls r2, r3 - adds r7, r2, 0 - mov r0, r12 - ands r1, r0 - lsls r6, r1, 2 -_080051E8: - adds r3, r5, 0 - movs r1, 0xF - ands r3, r1 - cmp r3, 0 - beq _0800521A - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800521A: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _080051E8 -_08005222: - mov r1, r10 - ldr r2, [sp, 0x60] - cmp r1, r2 - bcc _080051C4 -_0800522A: - ldr r4, [sp, 0x84] - ldr r1, [sp, 0x88] - ldr r3, =gUnknown_03002FF0 - str r3, [sp, 0x68] - ldr r0, [sp, 0x7C] - adds r0, r4 - mov r8, r0 - ldr r2, [sp, 0x80] - adds r2, r1, r2 - str r2, [sp, 0x6C] - str r4, [sp, 0x70] - cmp r1, r2 - bcs _080052AA -_08005244: - ldr r3, [sp, 0x68] - ldm r3!, {r5} - str r3, [sp, 0x68] - ldr r4, [sp, 0x70] - adds r0, r1, 0x1 - mov r10, r0 - cmp r4, r8 - bcs _080052A2 - movs r2, 0x7 - mov r12, r2 - lsrs r0, r1, 3 - ldr r2, [sp, 0x4] - adds r3, r0, 0 - muls r3, r2 - adds r7, r3, 0 - mov r3, r12 - ands r1, r3 - lsls r6, r1, 2 -_08005268: - adds r3, r5, 0 - movs r0, 0xF - ands r3, r0 - cmp r3, 0 - beq _0800529A - lsrs r2, r4, 3 - lsls r2, 5 - add r2, r9 - adds r0, r4, 0 - mov r1, r12 - ands r0, r1 - lsrs r0, 1 - adds r2, r0 - adds r2, r7 - adds r2, r6 - movs r1, 0x1 - ands r1, r4 - lsls r1, 2 - lsls r3, r1 - movs r0, 0xF0 - asrs r0, r1 - ldrb r1, [r2] - ands r0, r1 - orrs r3, r0 - strb r3, [r2] -_0800529A: - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r8 - bcc _08005268 -_080052A2: - mov r1, r10 - ldr r2, [sp, 0x6C] - cmp r1, r2 - bcc _08005244 -_080052AA: - add sp, 0x8C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end CopyGlyphToWindow - - thumb_func_start ClearTextSpan -@ void ClearTextSpan(TextPrinter *textPrinter, u32 width) -ClearTextSpan: @ 80052C8 - push {r4-r6,lr} - sub sp, 0x10 - adds r4, r0, 0 - adds r6, r1, 0 - ldr r0, =gLastTextBgColor - ldrh r5, [r0] - cmp r5, 0 - beq _0800531E - ldrb r1, [r4, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r1, =gUnknown_02020004 - adds r0, r1 - ldr r1, [r0, 0x8] - str r1, [sp, 0x8] - ldrb r2, [r0, 0x3] - lsls r2, 3 - ldr r3, =0xffff0000 - ldr r1, [sp, 0xC] - ands r1, r3 - orrs r1, r2 - str r1, [sp, 0xC] - ldrb r2, [r0, 0x4] - lsls r2, 19 - ldr r0, =0x0000ffff - ands r0, r1 - orrs r0, r2 - str r0, [sp, 0xC] - ldr r0, =gUnknown_03002F90 - adds r0, 0x81 - ldrb r1, [r4, 0x8] - ldrb r2, [r4, 0x9] - lsls r3, r6, 16 - lsrs r3, 16 - ldrb r0, [r0] - str r0, [sp] - lsls r0, r5, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - add r0, sp, 0x8 - bl FillBitmapRect4Bit -_0800531E: - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end ClearTextSpan - - thumb_func_start Font0Func -@ int Font0Func(struct TextPrinter *x) -Font0Func: @ 800533C - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005360 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005360: - adds r0, r2, 0 - bl RenderText - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Font0Func - - thumb_func_start Font1Func -@ int Font1Func(struct TextPrinter *x) -Font1Func: @ 8005370 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005398 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005398: - adds r0, r2, 0 - bl RenderText - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Font1Func - - thumb_func_start Font2Func -@ int Font2Func(struct TextPrinter *x) -Font2Func: @ 80053A8 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080053D0 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_080053D0: - adds r0, r2, 0 - bl RenderText - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Font2Func - - thumb_func_start Font3Func -@ int Font3Func(struct TextPrinter *x) -Font3Func: @ 80053E0 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005408 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x3 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005408: - adds r0, r2, 0 - bl RenderText - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Font3Func - - thumb_func_start Font4Func -@ int Font4Func(struct TextPrinter *x) -Font4Func: @ 8005418 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005440 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005440: - adds r0, r2, 0 - bl RenderText - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Font4Func - - thumb_func_start Font5Func -@ int Font5Func(struct TextPrinter *x) -Font5Func: @ 8005450 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08005478 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x5 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_08005478: - adds r0, r2, 0 - bl RenderText - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Font5Func - - thumb_func_start Font7Func -@ int Font7Func(struct TextPrinter *x) -Font7Func: @ 8005488 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080054B0 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x7 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_080054B0: - adds r0, r2, 0 - bl RenderText - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Font7Func - - thumb_func_start Font8Func -@ int Font8Func(struct TextPrinter *x) -Font8Func: @ 80054C0 - push {lr} - adds r2, r0, 0 - adds r3, r2, 0 - adds r3, 0x14 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080054E8 - ldrb r1, [r2, 0x14] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] -_080054E8: - adds r0, r2, 0 - bl RenderText - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Font8Func - - thumb_func_start TextPrinterInitDownArrowCounters -@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter) -TextPrinterInitDownArrowCounters: @ 80054F8 - push {lr} - adds r2, r0, 0 - adds r2, 0x14 - ldr r0, =gUnknown_03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08005514 - movs r0, 0 - strb r0, [r2, 0x2] - b _08005524 - .pool -_08005514: - ldrb r0, [r2, 0x1] - movs r1, 0x61 - negs r1, r1 - ands r1, r0 - movs r0, 0x20 - negs r0, r0 - ands r1, r0 - strb r1, [r2, 0x1] -_08005524: - pop {r0} - bx r0 - thumb_func_end TextPrinterInitDownArrowCounters - - thumb_func_start TextPrinterDrawDownArrow -@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) -TextPrinterDrawDownArrow: @ 8005528 - push {r4-r7,lr} - sub sp, 0x18 - adds r5, r0, 0 - adds r6, r5, 0 - adds r6, 0x14 - ldr r7, =gUnknown_03003014 - ldrb r1, [r7] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _080055EE - ldrb r2, [r6, 0x1] - movs r0, 0x1F - ands r0, r2 - cmp r0, 0 - beq _08005560 - ldr r0, [r5, 0x14] - lsls r0, 19 - lsrs r0, 27 - subs r0, 0x1 - movs r1, 0x1F - ands r0, r1 - movs r1, 0x20 - negs r1, r1 - b _080055E8 - .pool -_08005560: - ldrb r0, [r5, 0x4] - ldrb r2, [r5, 0xD] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - ldrb r2, [r5, 0x8] - ldrb r3, [r5, 0x9] - movs r4, 0x8 - str r4, [sp] - movs r4, 0x10 - str r4, [sp, 0x4] - bl FillWindowPixelRect - ldr r0, [r7] - lsls r0, 30 - lsrs r0, 31 - cmp r0, 0 - beq _0800558A - cmp r0, 0x1 - beq _08005594 -_0800558A: - ldr r7, =gDownArrowTiles - b _08005596 - .pool -_08005594: - ldr r7, =gDarkDownArrowTiles -_08005596: - ldrb r0, [r5, 0x4] - ldr r2, =gDownArrowYCoords - ldr r1, [r6] - lsls r1, 17 - lsrs r1, 30 - adds r1, r2 - ldrb r3, [r1] - movs r4, 0x8 - str r4, [sp] - movs r2, 0x10 - str r2, [sp, 0x4] - ldrb r1, [r5, 0x8] - str r1, [sp, 0x8] - ldrb r1, [r5, 0x9] - str r1, [sp, 0xC] - str r4, [sp, 0x10] - str r2, [sp, 0x14] - adds r1, r7, 0 - movs r2, 0 - bl BlitBitmapRectToWindow - ldrb r0, [r5, 0x4] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r6, 0x1] - movs r1, 0x20 - negs r1, r1 - ands r1, r0 - movs r0, 0x8 - orrs r1, r0 - strb r1, [r6, 0x1] - ldr r0, [r6] - lsls r0, 17 - lsrs r0, 30 - adds r0, 0x1 - movs r2, 0x3 - ands r0, r2 - lsls r0, 5 - movs r2, 0x61 - negs r2, r2 -_080055E8: - ands r1, r2 - orrs r1, r0 - strb r1, [r6, 0x1] -_080055EE: - add sp, 0x18 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end TextPrinterDrawDownArrow - - thumb_func_start TextPrinterClearDownArrow -@ void TextPrinterClearDownArrow(struct TextPrinter *textPrinter) -TextPrinterClearDownArrow: @ 8005600 - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r0, 0 - ldrb r0, [r5, 0x4] - ldrb r2, [r5, 0xD] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - ldrb r2, [r5, 0x8] - ldrb r3, [r5, 0x9] - movs r4, 0x8 - str r4, [sp] - movs r4, 0x10 - str r4, [sp, 0x4] - bl FillWindowPixelRect - ldrb r0, [r5, 0x4] - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end TextPrinterClearDownArrow - - thumb_func_start TextPrinterWaitAutoMode -@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) -TextPrinterWaitAutoMode: @ 8005634 - push {lr} - adds r1, r0, 0 - adds r1, 0x14 - ldrb r0, [r1, 0x2] - cmp r0, 0x31 - beq _08005648 - adds r0, 0x1 - strb r0, [r1, 0x2] - movs r0, 0 - b _0800564A -_08005648: - movs r0, 0x1 -_0800564A: - pop {r1} - bx r1 - thumb_func_end TextPrinterWaitAutoMode - - thumb_func_start TextPrinterWaitWithDownArrow -@ bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) -TextPrinterWaitWithDownArrow: @ 8005650 - push {r4,lr} - adds r2, r0, 0 - movs r4, 0 - ldr r0, =gUnknown_03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08005674 - adds r0, r2, 0 - bl TextPrinterWaitAutoMode - lsls r0, 24 - lsrs r4, r0, 24 - b _0800568E - .pool -_08005674: - adds r0, r2, 0 - bl TextPrinterDrawDownArrow - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0800568E - movs r4, 0x1 - movs r0, 0x5 - bl audio_play -_0800568E: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end TextPrinterWaitWithDownArrow - - thumb_func_start TextPrinterWait -@ bool8 TextPrinterWait(struct TextPrinter *textPrinter) -TextPrinterWait: @ 800569C - push {r4,lr} - adds r2, r0, 0 - movs r4, 0 - ldr r0, =gUnknown_03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080056C0 - adds r0, r2, 0 - bl TextPrinterWaitAutoMode - lsls r0, 24 - lsrs r4, r0, 24 - b _080056D4 - .pool -_080056C0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _080056D4 - movs r4, 0x1 - movs r0, 0x5 - bl audio_play -_080056D4: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end TextPrinterWait - - thumb_func_start DrawDownArrow -@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *counter, u8 *yCoordIndex) -DrawDownArrow: @ 80056E0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - ldr r4, [sp, 0x38] - ldr r5, [sp, 0x3C] - mov r9, r5 - ldr r5, [sp, 0x40] - mov r10, r5 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - mov r1, r9 - ldrb r0, [r1] - cmp r0, 0 - beq _0800571A - subs r0, 0x1 - strb r0, [r1] - b _0800579A -_0800571A: - lsls r1, r3, 4 - orrs r1, r3 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x8 - str r0, [sp] - movs r0, 0x10 - str r0, [sp, 0x4] - adds r0, r5, 0 - mov r2, r8 - adds r3, r7, 0 - bl FillWindowPixelRect - cmp r4, 0 - bne _0800579A - ldr r0, =gUnknown_03003014 - ldr r0, [r0] - lsls r0, 30 - lsrs r0, 31 - cmp r0, 0 - beq _08005748 - cmp r0, 0x1 - beq _08005754 -_08005748: - ldr r6, =gDownArrowTiles - b _08005756 - .pool -_08005754: - ldr r6, =gDarkDownArrowTiles -_08005756: - ldr r2, =gDownArrowYCoords - mov r0, r10 - ldrb r1, [r0] - movs r0, 0x3 - ands r0, r1 - adds r0, r2 - ldrb r3, [r0] - movs r4, 0x8 - str r4, [sp] - movs r1, 0x10 - str r1, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - subs r0, r7, 0x2 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - str r4, [sp, 0x10] - str r1, [sp, 0x14] - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0 - bl BlitBitmapRectToWindow - adds r0, r5, 0 - movs r1, 0x2 - bl CopyWindowToVram - mov r1, r9 - strb r4, [r1] - mov r5, r10 - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] -_0800579A: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DrawDownArrow - - thumb_func_start RenderText -@ u16 RenderText(struct TextPrinter *textPrinter) -RenderText: @ 80057B4 - push {r4-r6,lr} - adds r6, r0, 0 - adds r4, r6, 0 - adds r4, 0x14 - ldrb r0, [r6, 0x1C] - cmp r0, 0x6 - bls _080057C4 - b _08005D6C -_080057C4: - lsls r0, 2 - ldr r1, =_080057D4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080057D4: - .4byte _080057F0 - .4byte _08005C78 - .4byte _08005C8C - .4byte _08005CB8 - .4byte _08005CF0 - .4byte _08005D48 - .4byte _08005D5A -_080057F0: - ldr r2, =gMain - ldrh r1, [r2, 0x2C] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0800580A - ldrb r1, [r4] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0800580A - movs r0, 0 - strb r0, [r6, 0x1E] -_0800580A: - ldrb r1, [r6, 0x1E] - cmp r1, 0 - beq _0800584C - ldrb r0, [r6, 0x1D] - cmp r0, 0 - beq _0800584C - subs r0, r1, 0x1 - strb r0, [r6, 0x1E] - ldr r0, =gUnknown_03003014 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08005828 - b _08005B56 -_08005828: - ldrh r1, [r2, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08005834 - b _08005B56 -_08005834: - ldrb r0, [r4] - movs r1, 0x10 - orrs r0, r1 - strb r0, [r4] - movs r0, 0 - strb r0, [r6, 0x1E] - b _08005B56 - .pool -_0800584C: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 17 - ands r0, r1 - cmp r0, 0 - bne _08005874 - ldr r0, =gUnknown_03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08005874 - movs r0, 0x3 - b _08005876 - .pool -_08005874: - ldrb r0, [r6, 0x1D] -_08005876: - strb r0, [r6, 0x1E] - ldr r0, [r6] - ldrb r3, [r0] - adds r0, 0x1 - str r0, [r6] - adds r0, r3, 0 - subs r0, 0xF8 - cmp r0, 0x7 - bls _0800588A - b _08005B90 -_0800588A: - lsls r0, 2 - ldr r1, =_08005898 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08005898: - .4byte _08005B6C - .4byte _08005B5A - .4byte _08005B4C - .4byte _08005B48 - .4byte _080058E0 - .4byte _080058DC - .4byte _080058B8 - .4byte _08005D6C -_080058B8: - ldrb r0, [r6, 0x6] - strb r0, [r6, 0x8] - ldrb r1, [r6, 0x5] - ldr r0, =gFonts - ldr r2, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r6, 0xB] - ldrb r0, [r0, 0x5] - adds r1, r0 - ldrb r0, [r6, 0x9] - adds r0, r1 - b _08005ABA - .pool -_080058DC: - ldr r0, [r6] - b _08005B30 -_080058E0: - ldr r0, [r6] - ldrb r3, [r0] - adds r0, 0x1 - str r0, [r6] - subs r0, r3, 0x1 - cmp r0, 0x17 - bls _080058F0 - b _08005B90 -_080058F0: - lsls r0, 2 - ldr r1, =_08005900 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08005900: - .4byte _08005960 - .4byte _08005982 - .4byte _080059A6 - .4byte _080059C0 - .4byte _08005A0E - .4byte _08005A12 - .4byte _08005A0A - .4byte _08005A2A - .4byte _08005A3A - .4byte _08005A58 - .4byte _08005A5C - .4byte _08005B5A - .4byte _08005A90 - .4byte _08005A98 - .4byte _08005AA4 - .4byte _08005A76 - .4byte _08005AD8 - .4byte _08005AF2 - .4byte _08005B02 - .4byte _08005B26 - .4byte _08005B36 - .4byte _08005B3E - .4byte _08005ABE - .4byte _08005ACC -_08005960: - ldr r2, [r6] - ldrb r1, [r2] - lsls r1, 4 - ldrb r3, [r6, 0xC] - movs r0, 0xF - ands r0, r3 - orrs r0, r1 - strb r0, [r6, 0xC] - adds r2, 0x1 - str r2, [r6] - lsls r0, 24 - lsrs r0, 28 - ldrb r2, [r6, 0xD] - lsls r1, r2, 28 - lsrs r1, 28 - lsrs r2, 4 - b _08005A06 -_08005982: - ldr r1, [r6] - ldrb r2, [r1] - movs r0, 0xF - ands r0, r2 - ldrb r3, [r6, 0xD] - movs r2, 0x10 - negs r2, r2 - ands r2, r3 - orrs r2, r0 - strb r2, [r6, 0xD] - adds r1, 0x1 - str r1, [r6] - ldrb r0, [r6, 0xC] - lsrs r0, 4 - lsls r1, r2, 28 - lsrs r1, 28 - lsrs r2, 4 - b _08005A06 -_080059A6: - ldr r1, [r6] - ldrb r0, [r1] - lsls r0, 4 - ldrb r3, [r6, 0xD] - movs r2, 0xF - ands r2, r3 - orrs r2, r0 - strb r2, [r6, 0xD] - adds r1, 0x1 - str r1, [r6] - ldrb r0, [r6, 0xC] - lsrs r0, 4 - b _080059FE -_080059C0: - ldr r3, [r6] - ldrb r1, [r3] - lsls r1, 4 - ldrb r4, [r6, 0xC] - movs r2, 0xF - adds r0, r2, 0 - ands r0, r4 - orrs r0, r1 - strb r0, [r6, 0xC] - adds r5, r3, 0x1 - str r5, [r6] - ldrb r3, [r3, 0x1] - adds r1, r2, 0 - ands r1, r3 - ldrb r4, [r6, 0xD] - movs r3, 0x10 - negs r3, r3 - ands r3, r4 - orrs r3, r1 - strb r3, [r6, 0xD] - adds r4, r5, 0x1 - str r4, [r6] - ldrb r1, [r5, 0x1] - lsls r1, 4 - ands r2, r3 - orrs r2, r1 - strb r2, [r6, 0xD] - adds r4, 0x1 - str r4, [r6] - lsls r0, 24 - lsrs r0, 28 -_080059FE: - lsls r1, r2, 28 - lsrs r1, 28 - lsls r2, 24 - lsrs r2, 28 -_08005A06: - bl GenerateFontHalfRowLookupTable -_08005A0A: - movs r0, 0x2 - b _08005D6E -_08005A0E: - ldr r0, [r6] - b _08005B30 -_08005A12: - ldr r0, [r6] - ldrb r0, [r0] - movs r1, 0xF - ands r1, r0 - ldrb r2, [r4] - movs r0, 0x10 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4] - ldr r0, [r6] - b _08005B30 -_08005A2A: - ldr r0, [r6] - ldrb r1, [r0] - strb r1, [r6, 0x1E] - adds r0, 0x1 - str r0, [r6] - movs r0, 0x6 - strb r0, [r6, 0x1C] - b _08005A0A -_08005A3A: - movs r0, 0x1 - strb r0, [r6, 0x1C] - ldr r0, =gUnknown_03003014 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _08005A4C - b _08005B56 -_08005A4C: - movs r0, 0 - strb r0, [r4, 0x2] - b _08005B56 - .pool -_08005A58: - movs r0, 0x5 - b _08005D56 -_08005A5C: - ldr r0, [r6] - ldrb r3, [r0] - adds r1, r0, 0x1 - str r1, [r6] - ldrb r0, [r0, 0x1] - lsls r0, 8 - orrs r3, r0 - adds r1, 0x1 - str r1, [r6] - adds r0, r3, 0 - bl song_play_for_text - b _08005A0A -_08005A76: - ldr r0, [r6] - ldrb r3, [r0] - adds r1, r0, 0x1 - str r1, [r6] - ldrb r0, [r0, 0x1] - lsls r0, 8 - orrs r3, r0 - adds r1, 0x1 - str r1, [r6] - adds r0, r3, 0 - bl audio_play - b _08005A0A -_08005A90: - ldr r1, [r6] - ldrb r0, [r1] - ldrb r3, [r6, 0x6] - b _08005AF8 -_08005A98: - ldr r1, [r6] - ldrb r0, [r1] - ldrb r2, [r6, 0x7] - adds r0, r2 - strb r0, [r6, 0x9] - b _08005AFC -_08005AA4: - ldrb r0, [r6, 0x4] - ldrb r2, [r6, 0xD] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - bl FillWindowPixelBuffer - ldrb r0, [r6, 0x6] - strb r0, [r6, 0x8] - ldrb r0, [r6, 0x7] -_08005ABA: - strb r0, [r6, 0x9] - b _08005A0A -_08005ABE: - ldr r0, =gMPlay_BGM - bl m4aMPlayStop - b _08005A0A - .pool -_08005ACC: - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _08005A0A - .pool -_08005AD8: - ldr r0, [r6] - ldrb r4, [r0] - adds r0, 0x1 - str r0, [r6] - cmp r4, 0 - ble _08005A0A - adds r0, r6, 0 - adds r1, r4, 0 - bl ClearTextSpan - ldrb r0, [r6, 0x8] - adds r0, r4 - b _08005C6E -_08005AF2: - ldr r1, [r6] - ldrb r0, [r6, 0x6] - ldrb r3, [r1] -_08005AF8: - adds r0, r3 - strb r0, [r6, 0x8] -_08005AFC: - adds r1, 0x1 - str r1, [r6] - b _08005A0A -_08005B02: - ldr r0, [r6] - ldrb r2, [r0] - ldrb r1, [r6, 0x6] - adds r2, r1 - adds r0, 0x1 - str r0, [r6] - ldrb r0, [r6, 0x8] - subs r4, r2, r0 - cmp r4, 0 - bgt _08005B18 - b _08005A0A -_08005B18: - adds r0, r6, 0 - adds r1, r4, 0 - bl ClearTextSpan - ldrb r0, [r6, 0x8] - adds r0, r4 - b _08005C6E -_08005B26: - ldr r0, [r6] - ldrb r2, [r0] - adds r1, r6, 0 - adds r1, 0x20 - strb r2, [r1] -_08005B30: - adds r0, 0x1 - str r0, [r6] - b _08005A0A -_08005B36: - adds r1, r6, 0 - adds r1, 0x21 - movs r0, 0x1 - b _08005B44 -_08005B3E: - adds r1, r6, 0 - adds r1, 0x21 - movs r0, 0 -_08005B44: - strb r0, [r1] - b _08005A0A -_08005B48: - movs r0, 0x2 - b _08005B4E -_08005B4C: - movs r0, 0x3 -_08005B4E: - strb r0, [r6, 0x1C] - adds r0, r6, 0 - bl TextPrinterInitDownArrowCounters -_08005B56: - movs r0, 0x3 - b _08005D6E -_08005B5A: - ldr r0, [r6] - ldrb r3, [r0] - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - orrs r3, r1 - adds r0, 0x1 - str r0, [r6] - b _08005B90 -_08005B6C: - ldr r0, [r6] - ldrb r3, [r0] - adds r0, 0x1 - str r0, [r6] - ldrb r0, [r6, 0x4] - adds r1, r3, 0 - ldrb r2, [r6, 0x8] - ldrb r3, [r6, 0x9] - bl DrawKeypadIcon - ldr r1, =gUnknown_03002F90 - adds r1, 0x80 - strb r0, [r1] - ldrb r3, [r6, 0xA] - adds r0, r3 - b _08005C6A - .pool -_08005B90: - ldr r0, [r4] - lsls r0, 28 - lsrs r0, 28 - cmp r0, 0x8 - bhi _08005C10 - lsls r0, 2 - ldr r1, =_08005BA8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08005BA8: - .4byte _08005BCC - .4byte _08005BDA - .4byte _08005BE8 - .4byte _08005BE8 - .4byte _08005BE8 - .4byte _08005BE8 - .4byte _08005C10 - .4byte _08005BF6 - .4byte _08005C04 -_08005BCC: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl DecompressGlyphFont0 - b _08005C10 -_08005BDA: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl DecompressGlyphFont1 - b _08005C10 -_08005BE8: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl DecompressGlyphFont2 - b _08005C10 -_08005BF6: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl DecompressGlyphFont7 - b _08005C10 -_08005C04: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r1, [r0] - adds r0, r3, 0 - bl DecompressGlyphFont8 -_08005C10: - adds r0, r6, 0 - bl CopyGlyphToWindow - adds r2, r6, 0 - adds r2, 0x20 - ldrb r0, [r2] - cmp r0, 0 - beq _08005C48 - ldr r1, =gUnknown_03002F90 - adds r1, 0x80 - ldrb r0, [r1] - ldrb r3, [r6, 0x8] - adds r0, r3 - strb r0, [r6, 0x8] - ldrb r2, [r2] - ldrb r0, [r1] - subs r4, r2, r0 - cmp r4, 0 - ble _08005C70 - adds r0, r6, 0 - adds r1, r4, 0 - bl ClearTextSpan - ldrb r0, [r6, 0x8] - adds r0, r4 - b _08005C6E - .pool -_08005C48: - adds r0, r6, 0 - adds r0, 0x21 - ldrb r0, [r0] - cmp r0, 0 - beq _08005C64 - ldr r0, =gUnknown_03002F90 - adds r0, 0x80 - ldrb r1, [r6, 0xA] - ldrb r0, [r0] - adds r1, r0 - ldrb r0, [r6, 0x8] - b _08005C6C - .pool -_08005C64: - ldr r0, =gUnknown_03002F90 - adds r0, 0x80 - ldrb r0, [r0] -_08005C6A: - ldrb r1, [r6, 0x8] -_08005C6C: - adds r0, r1 -_08005C6E: - strb r0, [r6, 0x8] -_08005C70: - movs r0, 0 - b _08005D6E - .pool -_08005C78: - adds r0, r6, 0 - bl TextPrinterWait - lsls r0, 16 - cmp r0, 0 - bne _08005C86 - b _08005B56 -_08005C86: - movs r0, 0 - strb r0, [r6, 0x1C] - b _08005B56 -_08005C8C: - adds r0, r6, 0 - bl TextPrinterWaitWithDownArrow - lsls r0, 16 - cmp r0, 0 - bne _08005C9A - b _08005B56 -_08005C9A: - ldrb r0, [r6, 0x4] - ldrb r2, [r6, 0xD] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - bl FillWindowPixelBuffer - ldrb r0, [r6, 0x6] - movs r1, 0 - strb r0, [r6, 0x8] - ldrb r0, [r6, 0x7] - strb r0, [r6, 0x9] - strb r1, [r6, 0x1C] - b _08005B56 -_08005CB8: - adds r0, r6, 0 - bl TextPrinterWaitWithDownArrow - lsls r0, 16 - cmp r0, 0 - bne _08005CC6 - b _08005B56 -_08005CC6: - adds r0, r6, 0 - bl TextPrinterClearDownArrow - ldrb r1, [r6, 0x5] - ldr r0, =gFonts - ldr r2, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r6, 0xB] - ldrb r0, [r0, 0x5] - adds r1, r0 - strb r1, [r6, 0x1F] - ldrb r0, [r6, 0x6] - strb r0, [r6, 0x8] - movs r0, 0x4 - strb r0, [r6, 0x1C] - b _08005B56 - .pool -_08005CF0: - ldrb r0, [r6, 0x1F] - cmp r0, 0 - beq _08005D44 - bl sub_8197964 - ldr r1, =gWindowVerticalScrollSpeeds - adds r0, r1 - ldrb r4, [r0] - ldrb r2, [r6, 0x1F] - cmp r2, r4 - bge _08005D20 - ldrb r0, [r6, 0x4] - ldrb r1, [r6, 0xD] - lsls r1, 28 - lsrs r3, r1, 4 - orrs r3, r1 - lsrs r3, 24 - movs r1, 0 - bl ScrollWindow - movs r0, 0 - b _08005D38 - .pool -_08005D20: - ldrb r0, [r6, 0x4] - ldrb r1, [r6, 0xD] - lsls r1, 28 - lsrs r3, r1, 4 - orrs r3, r1 - lsrs r3, 24 - movs r1, 0 - adds r2, r4, 0 - bl ScrollWindow - ldrb r0, [r6, 0x1F] - subs r0, r4 -_08005D38: - strb r0, [r6, 0x1F] - ldrb r0, [r6, 0x4] - movs r1, 0x2 - bl CopyWindowToVram - b _08005B56 -_08005D44: - strb r0, [r6, 0x1C] - b _08005B56 -_08005D48: - bl mplay_has_finished_maybe - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _08005D56 - b _08005B56 -_08005D56: - strb r0, [r6, 0x1C] - b _08005B56 -_08005D5A: - ldrb r0, [r6, 0x1E] - adds r1, r0, 0 - cmp r1, 0 - beq _08005D68 - subs r0, 0x1 - strb r0, [r6, 0x1E] - b _08005B56 -_08005D68: - strb r1, [r6, 0x1C] - b _08005B56 -_08005D6C: - movs r0, 0x1 -_08005D6E: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end RenderText - - thumb_func_start GetStringWidthFixedWidthFont -@ u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing) -GetStringWidthFixedWidthFont: @ 8005D74 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - movs r2, 0 - mov r1, sp - adds r1, 0x7 -_08005D8C: - strb r2, [r1] - subs r1, 0x1 - cmp r1, sp - bge _08005D8C - movs r5, 0 - movs r6, 0 - adds r4, r0, 0 - movs r2, 0 -_08005D9C: - adds r0, r4, r2 - ldrb r3, [r0] - adds r2, 0x1 - adds r0, r3, 0 - subs r0, 0xF7 - cmp r0, 0x8 - bhi _08005E6A - lsls r0, 2 - ldr r1, =_08005DB8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08005DB8: - .4byte _08005E64 - .4byte _08005E68 - .4byte _08005E68 - .4byte _08005E70 - .4byte _08005E70 - .4byte _08005DEC - .4byte _08005E64 - .4byte _08005DDC - .4byte _08005DDC -_08005DDC: - mov r1, sp - adds r0, r1, r6 - strb r5, [r0] - movs r5, 0 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - b _08005E70 -_08005DEC: - adds r0, r4, r2 - ldrb r0, [r0] - adds r2, 0x1 - subs r0, 0x1 - cmp r0, 0x15 - bhi _08005E70 - lsls r0, 2 - ldr r1, =_08005E08 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08005E08: - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E60 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E70 - .4byte _08005E64 - .4byte _08005E70 - .4byte _08005E70 - .4byte _08005E62 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E70 - .4byte _08005E62 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E64 - .4byte _08005E70 - .4byte _08005E70 -_08005E60: - adds r2, 0x1 -_08005E62: - adds r2, 0x1 -_08005E64: - adds r2, 0x1 - b _08005E70 -_08005E68: - adds r2, 0x1 -_08005E6A: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_08005E70: - cmp r3, 0xFF - bne _08005D9C - movs r5, 0 - movs r2, 0 -_08005E78: - mov r1, sp - adds r0, r1, r2 - ldrb r1, [r0] - cmp r5, r1 - bcs _08005E84 - ldrb r5, [r0] -_08005E84: - adds r2, 0x1 - cmp r2, 0x7 - ble _08005E78 - adds r0, r7, 0 - movs r1, 0 - bl GetFontAttribute - add r0, r8 - lsls r0, 24 - lsrs r0, 24 - muls r0, r5 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end GetStringWidthFixedWidthFont - - thumb_func_start GetFontWidthFunc -@ u8 GetFontWidthFunc(u16 glyphId) -GetFontWidthFunc: @ 8005EA8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r3, 0 - ldr r0, =gGlyphWidthFuncs - adds r2, r0, 0x4 - adds r1, r0, 0 -_08005EB6: - ldr r0, [r1] - cmp r4, r0 - bne _08005EC4 - ldr r0, [r2] - b _08005ED0 - .pool -_08005EC4: - adds r2, 0x8 - adds r1, 0x8 - adds r3, 0x1 - cmp r3, 0x8 - bls _08005EB6 - movs r0, 0 -_08005ED0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end GetFontWidthFunc - - thumb_func_start GetStringWidth -@ s32 GetStringWidth(u8 fontId, u8 *str, u16 letterSpacing) -GetStringWidth: @ 8005ED8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - lsls r2, 16 - lsrs r5, r2, 16 - movs r0, 0 - mov r9, r0 - movs r7, 0 - adds r0, r6, 0 - bl GetFontWidthFunc - mov r8, r0 - cmp r0, 0 - bne _08005F06 -_08005F02: - movs r0, 0 - b _0800612E -_08005F06: - lsls r0, r5, 16 - asrs r2, r0, 16 - movs r1, 0x1 - negs r1, r1 - str r0, [sp, 0x4] - cmp r2, r1 - bne _08005F24 - adds r0, r6, 0 - movs r1, 0x2 - bl GetFontAttribute - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - b _08005F26 -_08005F24: - mov r10, r2 -_08005F26: - movs r2, 0 - str r2, [sp] - movs r5, 0 - movs r6, 0 - b _0800611E -_08005F30: - ldrb r1, [r4] - adds r0, r1, 0 - subs r0, 0xF7 - cmp r0, 0x7 - bls _08005F3C - b _080060F8 -_08005F3C: - lsls r0, 2 - ldr r1, =_08005F4C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08005F4C: - .4byte _08005FA2 - .4byte _080060BC - .4byte _080060BC - .4byte _0800611C - .4byte _0800611C - .4byte _08005FEA - .4byte _08005F78 - .4byte _08005F6C -_08005F6C: - ldr r0, [sp] - cmp r5, r0 - bls _08005F74 - str r5, [sp] -_08005F74: - movs r5, 0 - b _0800611C -_08005F78: - adds r4, 0x1 - ldrb r0, [r4] - cmp r0, 0x3 - beq _08005F98 - cmp r0, 0x3 - bgt _08005F8A - cmp r0, 0x2 - beq _08005F90 - b _08005F02 -_08005F8A: - cmp r0, 0x4 - beq _08005FA0 - b _08005F02 -_08005F90: - ldr r6, =gStringVar1 - b _08005FA2 - .pool -_08005F98: - ldr r6, =gStringVar2 - b _08005FA2 - .pool -_08005FA0: - ldr r6, =gStringVar3 -_08005FA2: - cmp r6, 0 - bne _08005FE0 - adds r4, 0x1 - ldrb r0, [r4] - bl sub_81AFC74 - adds r6, r0, 0 - b _08005FE0 - .pool -_08005FB8: - ldrb r0, [r6] - adds r6, 0x1 - mov r1, r9 - bl _call_via_r8 - cmp r7, 0 - ble _08005FD0 - cmp r0, r7 - bge _08005FCC - adds r0, r7, 0 -_08005FCC: - adds r5, r0 - b _08005FE0 -_08005FD0: - adds r5, r0 - mov r2, r9 - cmp r2, 0 - beq _08005FE0 - ldrb r0, [r4, 0x1] - cmp r0, 0xFF - beq _08005FE0 - add r5, r10 -_08005FE0: - ldrb r0, [r6] - cmp r0, 0xFF - bne _08005FB8 - movs r6, 0 - b _0800611C -_08005FEA: - adds r4, 0x1 - ldrb r0, [r4] - subs r0, 0x1 - cmp r0, 0x15 - bls _08005FF6 - b _0800611C -_08005FF6: - lsls r0, 2 - ldr r1, =_08006004 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08006004: - .4byte _08006060 - .4byte _08006060 - .4byte _08006060 - .4byte _0800605C - .4byte _08006060 - .4byte _08006064 - .4byte _0800611C - .4byte _08006060 - .4byte _0800611C - .4byte _0800611C - .4byte _0800605E - .4byte _08006060 - .4byte _08006060 - .4byte _08006060 - .4byte _0800611C - .4byte _0800605E - .4byte _08006090 - .4byte _08006098 - .4byte _0800609E - .4byte _080060AA - .4byte _080060B0 - .4byte _080060B6 -_0800605C: - adds r4, 0x1 -_0800605E: - adds r4, 0x1 -_08006060: - adds r4, 0x1 - b _0800611C -_08006064: - adds r4, 0x1 - ldrb r0, [r4] - bl GetFontWidthFunc - mov r8, r0 - cmp r0, 0 - bne _08006074 - b _08005F02 -_08006074: - ldr r0, [sp, 0x4] - asrs r1, r0, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _0800611C - ldrb r0, [r4] - movs r1, 0x2 - bl GetFontAttribute - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - b _0800611C -_08006090: - adds r4, 0x1 - ldrb r0, [r4] -_08006094: - adds r5, r0 - b _0800611C -_08006098: - adds r4, 0x1 - ldrb r5, [r4] - b _0800611C -_0800609E: - adds r4, 0x1 - ldrb r0, [r4] - cmp r0, r5 - bls _0800611C - adds r5, r0, 0 - b _0800611C -_080060AA: - adds r4, 0x1 - ldrb r7, [r4] - b _0800611C -_080060B0: - movs r2, 0x1 - mov r9, r2 - b _0800611C -_080060B6: - movs r0, 0 - mov r9, r0 - b _0800611C -_080060BC: - ldrb r0, [r4] - cmp r0, 0xF9 - bne _080060D6 - adds r4, 0x1 - ldrb r0, [r4] - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - orrs r0, r1 - mov r1, r9 - bl _call_via_r8 - b _080060E2 -_080060D6: - adds r4, 0x1 - ldrb r0, [r4] - bl GetKeypadIconWidth - lsls r0, 24 - lsrs r0, 24 -_080060E2: - cmp r7, 0 - ble _080060EE - cmp r0, r7 - bge _08006094 - adds r0, r7, 0 - b _08006094 -_080060EE: - adds r5, r0 - mov r0, r9 - cmp r0, 0 - beq _0800611C - b _08006114 -_080060F8: - adds r0, r1, 0 - mov r1, r9 - bl _call_via_r8 - cmp r7, 0 - ble _0800610C - cmp r0, r7 - bge _08006094 - adds r0, r7, 0 - b _08006094 -_0800610C: - adds r5, r0 - mov r2, r9 - cmp r2, 0 - beq _0800611C -_08006114: - ldrb r0, [r4, 0x1] - cmp r0, 0xFF - beq _0800611C - add r5, r10 -_0800611C: - adds r4, 0x1 -_0800611E: - ldrb r0, [r4] - cmp r0, 0xFF - beq _08006126 - b _08005F30 -_08006126: - ldr r0, [sp] - cmp r5, r0 - bls _0800612E - adds r0, r5, 0 -_0800612E: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end GetStringWidth - - thumb_func_start RenderTextFont9 -@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) -RenderTextFont9: @ 8006140 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - mov r9, r0 - adds r6, r2, 0 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x4] - mov r4, sp - adds r4, 0x1 - mov r5, sp - adds r5, 0x2 - mov r0, sp - adds r1, r4, 0 - adds r2, r5, 0 - bl SaveTextColors - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0 - str r0, [sp, 0xC] - movs r0, 0x3 - mov r10, r0 - movs r0, 0x1 - movs r1, 0 - movs r2, 0x3 - bl GenerateFontHalfRowLookupTable - adds r7, r6, 0 - movs r6, 0 -_08006182: - adds r0, r7, r6 - ldrb r0, [r0] - mov r8, r0 - adds r6, 0x1 - subs r0, 0xF7 - cmp r0, 0x8 - bhi _0800627E - lsls r0, 2 - ldr r1, =_080061A0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080061A0: - .4byte _08006276 - .4byte _08006276 - .4byte _08006276 - .4byte _080062B8 - .4byte _080062B8 - .4byte _080061C4 - .4byte _08006276 - .4byte _080062B8 - .4byte _080062B8 -_080061C4: - adds r0, r7, r6 - ldrb r0, [r0] - adds r6, 0x1 - subs r0, 0x1 - cmp r0, 0x15 - bhi _080062B8 - lsls r0, 2 - ldr r1, =_080061E0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080061E0: - .4byte _0800624A - .4byte _08006254 - .4byte _0800625C - .4byte _08006238 - .4byte _08006276 - .4byte _08006270 - .4byte _080062B8 - .4byte _08006276 - .4byte _080062B8 - .4byte _080062B8 - .4byte _0800627A - .4byte _08006276 - .4byte _08006276 - .4byte _08006276 - .4byte _080062B8 - .4byte _0800627A - .4byte _08006276 - .4byte _08006276 - .4byte _08006276 - .4byte _08006276 - .4byte _080062B8 - .4byte _080062B8 -_08006238: - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0x8] - adds r6, 0x1 - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0xC] - adds r6, 0x1 - b _0800625C -_0800624A: - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0x8] - adds r6, 0x1 - b _08006266 -_08006254: - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0xC] - b _08006262 -_0800625C: - adds r0, r7, r6 - ldrb r0, [r0] - mov r10, r0 -_08006262: - adds r6, 0x1 - ldr r0, [sp, 0x8] -_08006266: - ldr r1, [sp, 0xC] - mov r2, r10 - bl GenerateFontHalfRowLookupTable - b _080062B8 -_08006270: - adds r0, r7, r6 - ldrb r0, [r0] - str r0, [sp, 0x4] -_08006276: - adds r6, 0x1 - b _080062B8 -_0800627A: - adds r6, 0x1 - b _08006276 -_0800627E: - ldr r0, [sp, 0x4] - cmp r0, 0x1 - beq _08006290 - cmp r0, 0x9 - bne _08006290 - mov r0, r8 - bl DecompressGlyphFont9 - b _08006298 -_08006290: - mov r0, r8 - movs r1, 0x1 - bl DecompressGlyphFont1 -_08006298: - ldr r4, =gUnknown_03002F90 - ldr r5, =0x04000008 - adds r0, r4, 0 - mov r1, r9 - adds r2, r5, 0 - bl CpuSet - adds r4, 0x40 - mov r1, r9 - adds r1, 0x20 - adds r0, r4, 0 - adds r2, r5, 0 - bl CpuSet - movs r0, 0x40 - add r9, r0 -_080062B8: - mov r0, r8 - cmp r0, 0xFF - beq _080062C0 - b _08006182 -_080062C0: - mov r0, sp - mov r1, sp - adds r1, 0x1 - mov r2, sp - adds r2, 0x2 - bl RestoreTextColors - movs r0, 0x1 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end RenderTextFont9 - - thumb_func_start DrawKeypadIcon -@ u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y) -DrawKeypadIcon: @ 80062E8 - push {r4,r5,lr} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - ldr r4, =gKeypadIcons - lsrs r1, 22 - adds r1, r4 - ldrh r5, [r1] - lsls r5, 5 - ldr r4, =gKeypadIconTiles - adds r5, r4 - movs r4, 0x80 - str r4, [sp] - str r4, [sp, 0x4] - str r2, [sp, 0x8] - str r3, [sp, 0xC] - ldrb r4, [r1, 0x2] - str r4, [sp, 0x10] - ldrb r1, [r1, 0x3] - str r1, [sp, 0x14] - adds r1, r5, 0 - movs r2, 0 - movs r3, 0 - bl BlitBitmapRectToWindow - adds r0, r4, 0 - add sp, 0x18 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end DrawKeypadIcon - - thumb_func_start GetKeypadIconTileOffset -@ u8 GetKeypadIconTileOffset(u8 keypadIconId) -GetKeypadIconTileOffset: @ 8006338 - lsls r0, 24 - ldr r1, =gKeypadIcons - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetKeypadIconTileOffset - - thumb_func_start GetKeypadIconWidth -@ u8 GetKeypadIconWidth(u8 keypadIconId) -GetKeypadIconWidth: @ 8006348 - lsls r0, 24 - ldr r1, =gKeypadIcons - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0, 0x2] - bx lr - .pool - thumb_func_end GetKeypadIconWidth - - thumb_func_start GetKeypadIconHeight -@ u8 GetKeypadIconHeight(u8 keypadIconId) -GetKeypadIconHeight: @ 8006358 - lsls r0, 24 - ldr r1, =gKeypadIcons - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0, 0x3] - bx lr - .pool - thumb_func_end GetKeypadIconHeight - - thumb_func_start SetDefaultFontsPointer -@ void SetDefaultFontsPointer() -SetDefaultFontsPointer: @ 8006368 - push {lr} - ldr r0, =gFontInfos - bl SetFontsPointer - pop {r0} - bx r0 - .pool - thumb_func_end SetDefaultFontsPointer - - thumb_func_start GetFontAttribute -@ u8 GetFontAttribute(u8 fontId, u8 attributeId) -GetFontAttribute: @ 8006378 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - cmp r1, 0x7 - bhi _08006456 - lsls r0, r1, 2 - ldr r1, =_08006398 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08006398: - .4byte _080063B8 - .4byte _080063CC - .4byte _080063E0 - .4byte _080063F4 - .4byte _08006408 - .4byte _0800641C - .4byte _08006430 - .4byte _08006448 -_080063B8: - ldr r1, =gFontInfos - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x4] - b _08006456 - .pool -_080063CC: - ldr r1, =gFontInfos - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x5] - b _08006456 - .pool -_080063E0: - ldr r1, =gFontInfos - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x6] - b _08006456 - .pool -_080063F4: - ldr r1, =gFontInfos - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x7] - b _08006456 - .pool -_08006408: - ldr r0, =gFontInfos - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x8] - b _0800643C - .pool -_0800641C: - ldr r0, =gFontInfos - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x8] - b _08006454 - .pool -_08006430: - ldr r0, =gFontInfos - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x9] -_0800643C: - lsls r0, 28 - lsrs r0, 28 - b _08006456 - .pool -_08006448: - ldr r0, =gFontInfos - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x9] -_08006454: - lsrs r0, 4 -_08006456: - pop {r1} - bx r1 - .pool - thumb_func_end GetFontAttribute - - thumb_func_start GetMenuCursorDimensionByFont -@ u8 GetMenuCursorDimensionByFont(u8 fontId, u8 whichDimension) -GetMenuCursorDimensionByFont: @ 8006460 - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gMenuCursorDimensions - lsrs r0, 23 - adds r1, r0 - adds r1, r2 - ldrb r0, [r1] - bx lr - .pool - thumb_func_end GetMenuCursorDimensionByFont - - thumb_func_start DecompressGlyphFont0 -@ void DecompressGlyphFont0(u16 glyphId, bool8 isJapanese) -DecompressGlyphFont0: @ 8006478 - push {r4,r5,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _080064C4 - lsrs r2, r0, 20 - lsls r2, 9 - movs r0, 0xF - ands r0, r3 - lsls r0, 4 - ldr r1, =gFont0JapaneseGlyphs - adds r0, r1 - adds r5, r2, r0 - ldr r4, =gUnknown_03002F90 - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - movs r0, 0xC - strb r0, [r4] - b _08006534 - .pool -_080064C4: - lsls r1, r3, 6 - ldr r0, =gFont0LatinGlyphs - adds r5, r1, r0 - ldr r4, =gUnknown_03002F90 - ldr r0, =gFont0LatinGlyphWidths - adds r0, r3, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _08006500 - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - b _0800652C - .pool -_08006500: - 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 - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl DecompressGlyphTile -_0800652C: - ldr r0, =gUnknown_03002F90 - adds r0, 0x81 - movs r1, 0xD - strb r1, [r0] -_08006534: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressGlyphFont0 - - thumb_func_start GetGlyphWidthFont0 -@ u8 GetGlyphWidthFont0(u16 glyphId, bool8 isJapanese) -GetGlyphWidthFont0: @ 8006540 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006558 - ldr r0, =gFont0LatinGlyphWidths - adds r0, r2, r0 - ldrb r0, [r0] - b _0800655A - .pool -_08006558: - movs r0, 0x8 -_0800655A: - pop {r1} - bx r1 - thumb_func_end GetGlyphWidthFont0 - - thumb_func_start DecompressGlyphFont7 -@ void DecompressGlyphFont7(u16 glyphId, bool8 isJapanese) -DecompressGlyphFont7: @ 8006560 - push {r4-r6,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _080065AC - lsrs r2, r0, 20 - lsls r2, 9 - movs r5, 0xF - adds r0, r3, 0 - ands r0, r5 - lsls r0, 4 - ldr r1, =gFont1JapaneseGlyphs - adds r0, r1 - adds r6, r2, r0 - ldr r4, =gUnknown_03002F90 - adds r0, r6, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r6, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - strb r5, [r4] - b _0800661C - .pool -_080065AC: - lsls r1, r3, 6 - ldr r0, =gFont7LatinGlyphs - adds r6, r1, r0 - ldr r4, =gUnknown_03002F90 - ldr r0, =gFont7LatinGlyphWidths - adds r0, r3, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _080065E8 - adds r0, r6, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r6, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - b _08006614 - .pool -_080065E8: - adds r0, r6, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r6, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl DecompressGlyphTile - adds r0, r6, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r6, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl DecompressGlyphTile -_08006614: - ldr r0, =gUnknown_03002F90 - adds r0, 0x81 - movs r1, 0xF - strb r1, [r0] -_0800661C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressGlyphFont7 - - thumb_func_start GetGlyphWidthFont7 -@ u8 GetGlyphWidthFont7(u16 glyphId, bool8 isJapanese) -GetGlyphWidthFont7: @ 8006628 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006640 - ldr r0, =gFont7LatinGlyphWidths - adds r0, r2, r0 - ldrb r0, [r0] - b _08006642 - .pool -_08006640: - movs r0, 0x8 -_08006642: - pop {r1} - bx r1 - thumb_func_end GetGlyphWidthFont7 - - thumb_func_start DecompressGlyphFont8 -@ void DecompressGlyphFont8(u16 glyphId, bool8 isJapanese) -DecompressGlyphFont8: @ 8006648 - push {r4,r5,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _08006694 - lsrs r2, r0, 20 - lsls r2, 9 - movs r0, 0xF - ands r0, r3 - lsls r0, 4 - ldr r1, =gFont0JapaneseGlyphs - adds r0, r1 - adds r5, r2, r0 - ldr r4, =gUnknown_03002F90 - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - movs r0, 0xC - strb r0, [r4] - b _08006704 - .pool -_08006694: - lsls r1, r3, 6 - ldr r0, =gFont8LatinGlyphs - adds r5, r1, r0 - ldr r4, =gUnknown_03002F90 - ldr r0, =gFont8LatinGlyphWidths - adds r0, r3, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _080066D0 - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - b _080066FC - .pool -_080066D0: - 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 - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl DecompressGlyphTile -_080066FC: - ldr r0, =gUnknown_03002F90 - adds r0, 0x81 - movs r1, 0xC - strb r1, [r0] -_08006704: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressGlyphFont8 - - thumb_func_start GetGlyphWidthFont8 -@ u8 GetGlyphWidthFont8(u16 glyphId, bool8 isJapanese) -GetGlyphWidthFont8: @ 8006710 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006728 - ldr r0, =gFont8LatinGlyphWidths - adds r0, r2, r0 - ldrb r0, [r0] - b _0800672A - .pool -_08006728: - movs r0, 0x8 -_0800672A: - pop {r1} - bx r1 - thumb_func_end GetGlyphWidthFont8 - - thumb_func_start DecompressGlyphFont2 -@ void DecompressGlyphFont2(u16 glyphId, bool8 isJapanese) -DecompressGlyphFont2: @ 8006730 - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - cmp r1, 0x1 - bne _080067A0 - lsrs r2, r0, 19 - lsls r2, 9 - movs r0, 0x7 - ands r0, r6 - lsls r0, 5 - ldr r1, =gFont2JapaneseGlyphs - adds r0, r1 - adds r4, r2, r0 - ldr r5, =gUnknown_03002F90 - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - movs r1, 0x88 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x60 - bl DecompressGlyphTile - ldr r0, =gFont2JapaneseGlyphWidths - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r5, 0 - adds r1, 0x81 - movs r0, 0xE - strb r0, [r1] - b _08006810 - .pool -_080067A0: - lsls r1, r6, 6 - ldr r0, =gFont2LatinGlyphs - adds r4, r1, r0 - ldr r5, =gUnknown_03002F90 - ldr r0, =gFont2LatinGlyphWidths - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _080067DC - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x20 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - b _08006808 - .pool -_080067DC: - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x20 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x30 - adds r1, r5, 0 - adds r1, 0x60 - bl DecompressGlyphTile -_08006808: - ldr r0, =gUnknown_03002F90 - adds r0, 0x81 - movs r1, 0xE - strb r1, [r0] -_08006810: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressGlyphFont2 - - thumb_func_start GetGlyphWidthFont2 -@ u8 GetGlyphWidthFont2(u16 glyphId, bool8 isJapanese) -GetGlyphWidthFont2: @ 800681C - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006830 - ldr r0, =gFont2LatinGlyphWidths - b _08006832 - .pool -_08006830: - ldr r0, =gFont2JapaneseGlyphWidths -_08006832: - adds r0, r2, r0 - ldrb r0, [r0] - pop {r1} - bx r1 - .pool - thumb_func_end GetGlyphWidthFont2 - - thumb_func_start DecompressGlyphFont1 -@ void DecompressGlyphFont1(u16 glyphId, bool8 isJapanese) -DecompressGlyphFont1: @ 8006840 - push {r4-r6,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _0800688C - lsrs r2, r0, 20 - lsls r2, 9 - movs r5, 0xF - adds r0, r3, 0 - ands r0, r5 - lsls r0, 4 - ldr r1, =gFont1JapaneseGlyphs - adds r0, r1 - adds r6, r2, r0 - ldr r4, =gUnknown_03002F90 - adds r0, r6, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r6, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - strb r5, [r4] - b _080068FC - .pool -_0800688C: - lsls r1, r3, 6 - ldr r0, =gFont1LatinGlyphs - adds r6, r1, r0 - ldr r4, =gUnknown_03002F90 - ldr r0, =gFont1LatinGlyphWidths - adds r0, r3, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - cmp r1, 0x8 - bhi _080068C8 - adds r0, r6, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r6, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - b _080068F4 - .pool -_080068C8: - adds r0, r6, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r6, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl DecompressGlyphTile - adds r0, r6, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r6, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl DecompressGlyphTile -_080068F4: - ldr r0, =gUnknown_03002F90 - adds r0, 0x81 - movs r1, 0xF - strb r1, [r0] -_080068FC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressGlyphFont1 - - thumb_func_start GetGlyphWidthFont1 -@ u8 GetGlyphWidthFont1(u16 glyphId, bool8 isJapanese) -GetGlyphWidthFont1: @ 8006908 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _08006920 - ldr r0, =gFont1LatinGlyphWidths - adds r0, r2, r0 - ldrb r0, [r0] - b _08006922 - .pool -_08006920: - movs r0, 0x8 -_08006922: - pop {r1} - bx r1 - thumb_func_end GetGlyphWidthFont1 - - thumb_func_start DecompressGlyphFont9 -@ void DecompressGlyphFont9(u16 glyphId) -DecompressGlyphFont9: @ 8006928 - push {r4,r5,lr} - lsls r0, 16 - lsrs r4, r0, 20 - lsls r4, 9 - movs r1, 0xF0 - lsls r1, 12 - ands r1, r0 - lsrs r1, 12 - ldr r0, =gFont9JapaneseGlyphs - adds r1, r0 - adds r4, r1 - ldr r5, =gUnknown_03002F90 - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - movs r0, 0x80 - lsls r0, 1 - adds r4, r0 - adds r1, r5, 0 - adds r1, 0x40 - adds r0, r4, 0 - bl DecompressGlyphTile - adds r1, r5, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r5, 0x81 - movs r0, 0xC - strb r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end DecompressGlyphFont9 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/window.s b/asm/window.s index 6165ce5de..602f2a156 100644 --- a/asm/window.s +++ b/asm/window.s @@ -42,7 +42,7 @@ _080031E4: ldr r0, =gDummyWindowTemplate ldr r2, [r0] ldr r3, [r0, 0x4] - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows movs r0, 0 movs r4, 0x1F mov r8, r4 @@ -165,7 +165,7 @@ _080032CA: b _08003250 .pool _0800330C: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows adds r0, r1, 0 adds r0, 0x8 ldr r2, [sp, 0x4] @@ -233,7 +233,7 @@ AddWindow: @ 8003380 sub sp, 0x4 mov r8, r0 movs r6, 0 - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows ldrb r0, [r1] cmp r0, 0xFF beq _080033B0 @@ -346,7 +346,7 @@ _0800346A: b _080034C0 .pool _08003484: - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r1, r6, 1 adds r1, r6 lsls r1, 2 @@ -394,7 +394,7 @@ AddWindowWithoutTileMap: @ 80034D8 push {r4-r6,lr} adds r5, r0, 0 movs r4, 0 - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows ldrb r0, [r1] cmp r0, 0xFF beq _080034FE @@ -437,7 +437,7 @@ _08003528: b _08003564 .pool _08003534: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r4, 1 adds r0, r4 lsls r0, 2 @@ -474,7 +474,7 @@ RemoveWindow: @ 8003574 push {r4-r7,lr} lsls r0, 24 lsrs r6, r0, 24 - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r6, 1 adds r0, r6 lsls r0, 2 @@ -515,7 +515,7 @@ _080035A0: bl Free str r5, [r4] _080035CE: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r6, 1 adds r0, r6 lsls r0, 2 @@ -556,7 +556,7 @@ _08003620: subs r5, 0x1 cmp r5, 0 bge _0800360A - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows adds r4, r0, 0 adds r4, 0x8 movs r6, 0 @@ -588,7 +588,7 @@ CopyWindowToVram: @ 8003658 lsls r1, 24 lsrs r3, r1, 24 adds r5, r3, 0 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r1, r0, 1 adds r1, r0 lsls r1, 2 @@ -661,7 +661,7 @@ CopyWindowRectToVram: @ 80036D8 beq _08003782 cmp r3, 0 beq _08003782 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r0, r6, 1 adds r0, r6 lsls r0, 2 @@ -747,7 +747,7 @@ PutWindowTilemap: @ 800378C sub sp, 0x1C lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r1, r0, 1 adds r1, r0 lsls r1, 2 @@ -818,7 +818,7 @@ PutWindowRectTilemapOverridePalette: @ 80037EC lsls r5, 24 lsrs r5, 24 str r5, [sp, 0x20] - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r1, r0, 1 adds r1, r0 lsls r1, 2 @@ -892,7 +892,7 @@ ClearWindowTilemap: @ 80038A4 sub sp, 0x18 lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r1, r0, 1 adds r1, r0 lsls r1, 2 @@ -949,7 +949,7 @@ PutWindowRectTilemap: @ 80038F4 lsls r4, 24 lsrs r4, 24 mov r8, r4 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r1, r0, 1 adds r1, r0 lsls r1, 2 @@ -1097,7 +1097,7 @@ BlitBitmapRectToWindow: @ 80039DC lsrs r4, 16 orrs r4, r5 str r4, [sp, 0x18] - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r5, r0, 1 adds r5, r0 lsls r5, 2 @@ -1194,7 +1194,7 @@ BlitBitmapRectToWindowWithColorKey: @ 8003A9C lsrs r4, 16 orrs r4, r5 str r4, [sp, 0x18] - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r5, r0, 1 adds r5, r0 lsls r5, 2 @@ -1268,7 +1268,7 @@ FillWindowPixelRect: @ 8003B64 lsls r4, 16 lsrs r4, 16 mov r8, r4 - ldr r5, =gUnknown_02020004 + ldr r5, =gWindows lsls r4, r0, 1 adds r4, r0 lsls r4, 2 @@ -1320,7 +1320,7 @@ CopyToWindowPixelBuffer: @ 8003BF0 lsrs r2, r3, 16 cmp r5, 0 beq _08003C24 - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r4, 1 adds r0, r4 lsls r0, 2 @@ -1335,7 +1335,7 @@ CopyToWindowPixelBuffer: @ 8003BF0 b _08003C3C .pool _08003C24: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r4, 1 adds r0, r4 lsls r0, 2 @@ -1362,7 +1362,7 @@ FillWindowPixelBuffer: @ 8003C48 lsrs r0, 24 lsls r1, 24 lsrs r1, 24 - ldr r5, =gUnknown_02020004 + ldr r5, =gWindows lsls r4, r0, 1 adds r4, r0 lsls r4, 2 @@ -1412,7 +1412,7 @@ ScrollWindow: @ 8003C94 str r2, [sp] lsls r3, 24 lsrs r3, 24 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r1, r0, 1 adds r1, r0 lsls r1, 2 @@ -1929,7 +1929,7 @@ CallWindowFunction: @ 8004058 mov r8, r1 lsls r0, 24 lsrs r0, 24 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows lsls r1, r0, 1 adds r1, r0 lsls r1, 2 @@ -1988,7 +1988,7 @@ _080040C4: .4byte _08004120 .4byte _08004134 _080040E4: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r3, 1 adds r0, r3 lsls r0, 2 @@ -1998,7 +1998,7 @@ _080040E4: b _08004144 .pool _080040F8: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r3, 1 adds r0, r3 lsls r0, 2 @@ -2008,7 +2008,7 @@ _080040F8: b _08004144 .pool _0800410C: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r3, 1 adds r0, r3 lsls r0, 2 @@ -2018,7 +2018,7 @@ _0800410C: b _08004144 .pool _08004120: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r3, 1 adds r0, r3 lsls r0, 2 @@ -2028,7 +2028,7 @@ _08004120: b _08004144 .pool _08004134: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r0, r3, 1 adds r0, r3 lsls r0, 2 @@ -2070,7 +2070,7 @@ _08004168: .4byte _08004200 .4byte _08004214 _08004188: - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows lsls r1, r2, 1 adds r1, r2 lsls r1, 2 @@ -2079,7 +2079,7 @@ _08004188: b _0800422A .pool _0800419C: - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows lsls r1, r2, 1 adds r1, r2 lsls r1, 2 @@ -2088,7 +2088,7 @@ _0800419C: b _0800422A .pool _080041B0: - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows lsls r1, r2, 1 adds r1, r2 lsls r1, 2 @@ -2097,7 +2097,7 @@ _080041B0: b _0800422A .pool _080041C4: - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows lsls r1, r2, 1 adds r1, r2 lsls r1, 2 @@ -2106,7 +2106,7 @@ _080041C4: b _0800422A .pool _080041D8: - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows lsls r1, r2, 1 adds r1, r2 lsls r1, 2 @@ -2115,7 +2115,7 @@ _080041D8: b _0800422A .pool _080041EC: - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows lsls r1, r2, 1 adds r1, r2 lsls r1, 2 @@ -2124,7 +2124,7 @@ _080041EC: b _0800422A .pool _08004200: - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows lsls r1, r2, 1 adds r1, r2 lsls r1, 2 @@ -2133,7 +2133,7 @@ _08004200: b _0800422A .pool _08004214: - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows lsls r1, r2, 1 adds r1, r2 lsls r1, 2 @@ -2156,7 +2156,7 @@ GetNumActiveWindowsOnBg: @ 8004230 lsls r0, 24 lsrs r4, r0, 24 movs r3, 0 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows movs r1, 0x1F _0800423C: ldrb r0, [r2] @@ -2192,7 +2192,7 @@ AddWindow8Bit: @ 8004260 push {r5-r7} mov r9, r0 movs r6, 0 - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows ldrb r0, [r1] cmp r0, 0xFF beq _0800428E @@ -2286,7 +2286,7 @@ _08004322: b _08004356 .pool _08004338: - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r2, r6, 1 adds r2, r6 lsls r2, 2 @@ -2320,7 +2320,7 @@ FillWindowPixelBuffer8Bit: @ 8004368 lsrs r0, 24 lsls r1, 24 lsrs r5, r1, 24 - ldr r6, =gUnknown_02020004 + ldr r6, =gWindows lsls r1, r0, 1 adds r1, r0 lsls r4, r1, 2 @@ -2378,7 +2378,7 @@ FillWindowPixelRect8Bit: @ 80043A8 lsls r4, 16 lsrs r4, 16 mov r8, r4 - ldr r5, =gUnknown_02020004 + ldr r5, =gWindows lsls r4, r0, 1 adds r4, r0 lsls r4, 2 @@ -2470,7 +2470,7 @@ BlitBitmapRectToWindow4BitTo8Bit: @ 8004434 lsrs r4, 16 orrs r4, r5 str r4, [sp, 0x1C] - ldr r1, =gUnknown_02020004 + ldr r1, =gWindows lsls r5, r0, 1 adds r5, r0 lsls r5, 2 @@ -2531,7 +2531,7 @@ CopyWindowToVram8Bit: @ 8004500 lsls r1, r0, 1 adds r1, r0 lsls r1, 2 - ldr r0, =gUnknown_02020004 + ldr r0, =gWindows adds r3, r1, r0 str r3, [r6] ldr r4, =gUnknown_02020188 @@ -2585,7 +2585,7 @@ GetNumActiveWindowsOnBg8Bit: @ 8004578 lsls r0, 24 lsrs r4, r0, 24 movs r3, 0 - ldr r2, =gUnknown_02020004 + ldr r2, =gWindows movs r1, 0x1F _08004584: ldrb r0, [r2] diff --git a/data/graphics/fonts/down_arrow.png b/data/graphics/fonts/down_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..5b6c7e7bdd2fc5d4cc51eb5ce2001089defafcf1 GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^96)Tq!VDzuai~>*H~~H(uEl4U{Qv(yDJkjd)w9ny zIR5V~R+z&v<=Yg)ptDPkegjH9d-n`TGW?&zaCWa(@sd~9*D(V1s(ZRPhH%VGPB_3i zW6G2%5;J0A=1kyV6BTD&&?D>-$GF_jCgA`tD+BXlZp}5WO(8%n44$rjF6*2UngCbb BI#~b! literal 0 HcmV?d00001 diff --git a/data/graphics/fonts/down_arrow_RS.png b/data/graphics/fonts/down_arrow_RS.png new file mode 100644 index 0000000000000000000000000000000000000000..b762471c63a57092229c8ef31ad99a563ca5831e GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^96)Tq!VDzuai~>*H~~H(u0Yz$%j-Xo0^|Qc@;{LH zfA#8FpcoK5d-e_}Fz4+5>b=i^43F~XCO}bjPZ!4!j+w~`2UsOoSy?3|rcM!=$ib$l n%DA9M$s>+oxt~qK0bW*yCMVXZ{Tee=K_+>+`njxgN@xNA8a^>@ literal 0 HcmV?d00001 diff --git a/data/graphics/fonts/keypad_icons.png b/data/graphics/fonts/keypad_icons.png new file mode 100644 index 0000000000000000000000000000000000000000..8a9ecbcba49e6dde7efaaf04c82bd5af69253ac6 GIT binary patch literal 297 zcmV+^0oMMBP)lR(2$c4eF;dN>#rFUI|K{%I|Ns90|C|8Ly-IVW>esFT0002A zNkl`+xekxqgy4pyQR8Mibd2l7!Zq-bEwlRC*j zgntu63>%o;n3MS(QDYN3N%AOQmdHi`4GJjxe9GElF|=nDm^(n)W_ueys+2YSdWAe)978O6lM^IZ g7bl4HFmW(2um~_P*85iU0c9CHUHx3vIVCg!0J#q_-T(jq literal 0 HcmV?d00001 diff --git a/data/graphics/fonts/unused_frlg_down_arrow.png b/data/graphics/fonts/unused_frlg_down_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..882e3a68782b668de8ed74ff0e5aba48e86662bf GIT binary patch literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNErn9gt!);UGo3`|D>d(t5?rH z-tIrfontColor_h, textWindow->bgColor, textWindow->shadowColor); + GenerateFontHalfRowLookupTable(textSubPrinter->fontColor_h, textSubPrinter->bgColor, textSubPrinter->shadowColor); if (speed != 0xFF && speed != 0x0) { --gTempTextPrinter.text_speed; - gTextPrinters[textWindow->windowId] = gTempTextPrinter; + gTextPrinters[textSubPrinter->windowId] = gTempTextPrinter; } else { @@ -95,8 +240,8 @@ u16 AddTextPrinter(struct TextWindow *textWindow, u8 speed, void (*callback)(str } if (speed != 0xFF) - CopyWindowToVram(gTempTextPrinter.window.windowId, 2); - gTextPrinters[textWindow->windowId].sub_union.sub.active = 0; + CopyWindowToVram(gTempTextPrinter.subPrinter.windowId, 2); + gTextPrinters[textSubPrinter->windowId].sub_union.sub.active = 0; } gUnknown_03002F84[0] = 0; return TRUE; @@ -116,10 +261,10 @@ void RunTextPrinters(void) temp = RenderFont(&gTextPrinters[i]); switch (temp) { case 0: - CopyWindowToVram(gTextPrinters[i].window.windowId, 2); + CopyWindowToVram(gTextPrinters[i].subPrinter.windowId, 2); case 3: if (gTextPrinters[i].callback != 0) - gTextPrinters[i].callback(&gTextPrinters[i].window, temp); + gTextPrinters[i].callback(&gTextPrinters[i].subPrinter, temp); break; case 1: gTextPrinters[i].sub_union.sub.active = 0; @@ -141,7 +286,7 @@ u32 RenderFont(struct TextPrinter *textPrinter) u32 ret; while (TRUE) { - ret = gFonts[textPrinter->window.fontId].fontFunction(textPrinter); + ret = gFonts[textPrinter->subPrinter.fontId].fontFunction(textPrinter); if (ret != 2) return ret; } @@ -268,7 +413,7 @@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) __attribute__((naked)) void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) { - asm(" push {r4-r7,lr}\n\ + asm("push {r4-r7,lr}\n\ mov r7, r10\n\ mov r6, r9\n\ mov r5, r8\n\ @@ -738,10 +883,8 @@ void RestoreTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor) GenerateFontHalfRowLookupTable(*fgColor, *bgColor, *shadowColor); } -// struct means TextWindow, no struct means TextPrinter - -//#ifdef NONMATCHING -void DecompressGlyphTile(u16 *src, u32 *dest) +#ifdef NONMATCHING +void DecompressGlyphTile(const u16 *src, u16 *dest) { u32 temp; @@ -762,9 +905,9 @@ void DecompressGlyphTile(u16 *src, u32 *dest) *(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[0] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[0] >> 8]]; *(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]]; } -/*#else +#else __attribute__((naked)) -void DecompressGlyphTile(u16 *src, u32 *dest) +void DecompressGlyphTile(const u16 *src, u16 *dest) { asm("push {r4-r7,lr}\n\ mov r7, r8\n\ @@ -927,7 +1070,7 @@ void DecompressGlyphTile(u16 *src, u32 *dest) bx r0\n\ .pool"); } -#endif*/ +#endif u8 GetLastTextColor(u8 colorType) { @@ -944,4 +1087,2413 @@ u8 GetLastTextColor(u8 colorType) } } +__attribute__((naked)) +void CopyGlyphToWindow(struct TextPrinter *x) +{ + asm("push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, #0x8C\n\ + add r3, r0, #0\n\ + ldrb r1, [r3, #0x4]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + ldr r1, =gWindows\n\ + add r1, r0, r1\n\ + add r2, r1, #0\n\ + ldrb r7, [r1, #0x3]\n\ + lsl r0, r7, #3\n\ + ldrb r6, [r3, #0x8]\n\ + sub r4, r0, r6\n\ + ldr r5, =gUnknown_03002F90\n\ + add r0, r5, #0\n\ + add r0, #0x80\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + ble _08004DD2\n\ + add r4, r0, #0\n\ +_08004DD2:\n\ + ldrb r0, [r1, #0x4]\n\ + lsl r0, #3\n\ + ldrb r3, [r3, #0x9]\n\ + sub r0, r3\n\ + add r1, r5, #0\n\ + add r1, #0x81\n\ + ldrb r1, [r1]\n\ + cmp r0, r1\n\ + ble _08004DE6\n\ + add r0, r1, #0\n\ +_08004DE6:\n\ + str r6, [sp]\n\ + mov r8, r3\n\ + add r3, r5, #0\n\ + ldr r2, [r2, #0x8]\n\ + mov r9, r2\n\ + lsl r1, r7, #5\n\ + str r1, [sp, #0x4]\n\ + cmp r4, #0x8\n\ + ble _08004DFA\n\ + b _08004F94\n\ +_08004DFA:\n\ + cmp r0, #0x8\n\ + bgt _08004E84\n\ + mov r1, r8\n\ + str r3, [sp, #0x8]\n\ + add r2, r6, #0\n\ + add r2, r4\n\ + mov r8, r2\n\ + add r0, r1, r0\n\ + str r0, [sp, #0xC]\n\ + str r6, [sp, #0x10]\n\ + cmp r1, r0\n\ + bcc _08004E14\n\ + b _080052AA\n\ +_08004E14:\n\ + ldr r3, [sp, #0x8]\n\ + ldm r3!, {r5}\n\ + str r3, [sp, #0x8]\n\ + ldr r4, [sp, #0x10]\n\ + add r0, r1, #0x1\n\ + mov r10, r0\n\ + cmp r4, r8\n\ + bcs _08004E72\n\ + mov r2, #0x7\n\ + mov r12, r2\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, r12\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ +_08004E38:\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _08004E6A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_08004E6A:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08004E38\n\ +_08004E72:\n\ + mov r1, r10\n\ + ldr r2, [sp, #0xC]\n\ + cmp r1, r2\n\ + bcc _08004E14\n\ + b _080052AA\n\ + .pool\n\ +_08004E84:\n\ + mov r1, r8\n\ + str r3, [sp, #0x14]\n\ + ldr r3, [sp]\n\ + add r3, r4\n\ + mov r12, r3\n\ + add r2, r1, #0\n\ + add r2, #0x8\n\ + str r2, [sp, #0x18]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x1C]\n\ + mov r2, r12\n\ + str r2, [sp, #0x74]\n\ + ldr r3, [sp, #0x18]\n\ + str r3, [sp, #0x88]\n\ + sub r0, #0x8\n\ + str r0, [sp, #0x80]\n\ + cmp r1, r3\n\ + bcs _08004F0E\n\ +_08004EA8:\n\ + ldr r0, [sp, #0x14]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x14]\n\ + ldr r4, [sp, #0x1C]\n\ + add r2, r1, #0x1\n\ + mov r8, r2\n\ + cmp r4, r12\n\ + bcs _08004F06\n\ + mov r3, #0x7\n\ + mov r10, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r10\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ +_08004ECC:\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _08004EFE\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r10\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_08004EFE:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _08004ECC\n\ +_08004F06:\n\ + mov r1, r8\n\ + ldr r2, [sp, #0x18]\n\ + cmp r1, r2\n\ + bcc _08004EA8\n\ +_08004F0E:\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FD0\n\ + str r3, [sp, #0x20]\n\ + ldr r0, [sp, #0x74]\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x24]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x28]\n\ + cmp r1, r2\n\ + bcc _08004F28\n\ + b _080052AA\n\ +_08004F28:\n\ + ldr r0, [sp, #0x20]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x20]\n\ + ldr r4, [sp, #0x28]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r8\n\ + bcs _08004F86\n\ + mov r3, #0x7\n\ + mov r12, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ +_08004F4C:\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _08004F7E\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_08004F7E:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08004F4C\n\ +_08004F86:\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x24]\n\ + cmp r1, r2\n\ + bcc _08004F28\n\ + b _080052AA\n\ + .pool\n\ +_08004F94:\n\ + cmp r0, #0x8\n\ + ble _08004F9A\n\ + b _080050A4\n\ +_08004F9A:\n\ + mov r1, r8\n\ + str r3, [sp, #0x2C]\n\ + ldr r3, [sp]\n\ + add r3, #0x8\n\ + mov r12, r3\n\ + add r0, r8\n\ + str r0, [sp, #0x30]\n\ + ldr r0, [sp]\n\ + str r0, [sp, #0x34]\n\ + ldr r2, [sp, #0x30]\n\ + str r2, [sp, #0x78]\n\ + str r3, [sp, #0x84]\n\ + sub r4, #0x8\n\ + str r4, [sp, #0x7C]\n\ + cmp r8, r2\n\ + bcs _0800501C\n\ +_08004FBA:\n\ + ldr r0, [sp, #0x2C]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x2C]\n\ + ldr r4, [sp, #0x34]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r12\n\ + bcs _08005014\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, #0x7\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ +_08004FDA:\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _0800500C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, #0x7\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_0800500C:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _08004FDA\n\ +_08005014:\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x30]\n\ + cmp r1, r2\n\ + bcc _08004FBA\n\ +_0800501C:\n\ + mov r1, r8\n\ + ldr r3, =gUnknown_03002FB0\n\ + str r3, [sp, #0x38]\n\ + ldr r0, [sp, #0x84]\n\ + ldr r2, [sp, #0x7C]\n\ + add r0, r2\n\ + mov r8, r0\n\ + ldr r3, [sp, #0x78]\n\ + str r3, [sp, #0x3C]\n\ + ldr r0, [sp, #0x84]\n\ + str r0, [sp, #0x40]\n\ + cmp r1, r3\n\ + bcc _08005038\n\ + b _080052AA\n\ +_08005038:\n\ + ldr r2, [sp, #0x38]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x38]\n\ + ldr r4, [sp, #0x40]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r8\n\ + bcs _08005096\n\ + mov r0, #0x7\n\ + mov r12, r0\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ +_0800505C:\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800508E\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_0800508E:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _0800505C\n\ +_08005096:\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x3C]\n\ + cmp r1, r2\n\ + bcc _08005038\n\ + b _080052AA\n\ + .pool\n\ +_080050A4:\n\ + mov r1, r8\n\ + str r5, [sp, #0x44]\n\ + ldr r3, [sp]\n\ + add r3, #0x8\n\ + mov r12, r3\n\ + mov r2, r8\n\ + add r2, #0x8\n\ + str r2, [sp, #0x48]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x4C]\n\ + str r2, [sp, #0x88]\n\ + sub r0, #0x8\n\ + str r0, [sp, #0x80]\n\ + mov r0, r12\n\ + str r0, [sp, #0x84]\n\ + sub r4, #0x8\n\ + str r4, [sp, #0x7C]\n\ + cmp r8, r2\n\ + bcs _0800512C\n\ +_080050CA:\n\ + ldr r2, [sp, #0x44]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x44]\n\ + ldr r4, [sp, #0x4C]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r12\n\ + bcs _08005124\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, #0x7\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ +_080050EA:\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800511C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, #0x7\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_0800511C:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _080050EA\n\ +_08005124:\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x48]\n\ + cmp r1, r2\n\ + bcc _080050CA\n\ +_0800512C:\n\ + mov r1, r8\n\ + ldr r3, =gUnknown_03002FB0\n\ + str r3, [sp, #0x50]\n\ + ldr r0, [sp, #0x84]\n\ + ldr r2, [sp, #0x7C]\n\ + add r0, r2\n\ + mov r8, r0\n\ + ldr r3, [sp, #0x88]\n\ + str r3, [sp, #0x54]\n\ + ldr r0, [sp, #0x84]\n\ + str r0, [sp, #0x58]\n\ + cmp r1, r3\n\ + bcs _080051AC\n\ +_08005146:\n\ + ldr r2, [sp, #0x50]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x50]\n\ + ldr r4, [sp, #0x58]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r8\n\ + bcs _080051A4\n\ + mov r0, #0x7\n\ + mov r12, r0\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ +_0800516A:\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800519C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_0800519C:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _0800516A\n\ +_080051A4:\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x54]\n\ + cmp r1, r2\n\ + bcc _08005146\n\ +_080051AC:\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FD0\n\ + str r3, [sp, #0x5C]\n\ + ldr r0, [sp, #0x84]\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x60]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x64]\n\ + cmp r1, r2\n\ + bcs _0800522A\n\ +_080051C4:\n\ + ldr r0, [sp, #0x5C]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x5C]\n\ + ldr r4, [sp, #0x64]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r8\n\ + bcs _08005222\n\ + mov r3, #0x7\n\ + mov r12, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ +_080051E8:\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800521A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_0800521A:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _080051E8\n\ +_08005222:\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x60]\n\ + cmp r1, r2\n\ + bcc _080051C4\n\ +_0800522A:\n\ + ldr r4, [sp, #0x84]\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FF0\n\ + str r3, [sp, #0x68]\n\ + ldr r0, [sp, #0x7C]\n\ + add r0, r4\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x6C]\n\ + str r4, [sp, #0x70]\n\ + cmp r1, r2\n\ + bcs _080052AA\n\ +_08005244:\n\ + ldr r3, [sp, #0x68]\n\ + ldm r3!, {r5}\n\ + str r3, [sp, #0x68]\n\ + ldr r4, [sp, #0x70]\n\ + add r0, r1, #0x1\n\ + mov r10, r0\n\ + cmp r4, r8\n\ + bcs _080052A2\n\ + mov r2, #0x7\n\ + mov r12, r2\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, r12\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ +_08005268:\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _0800529A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ +_0800529A:\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08005268\n\ +_080052A2:\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x6C]\n\ + cmp r1, r2\n\ + bcc _08005244\n\ +_080052AA:\n\ + add sp, #0x8C\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +// struct means TextSubPrinter, no struct means TextPrinter + +void ClearTextSpan(struct TextPrinter *textPrinter, u32 width) +{ + struct Window *window; + struct Bitmap pixels_data; + u8* gUnk; + u8* glyphHeight; + + if (gLastTextBgColor != 0) + { + window = &gWindows[textPrinter->subPrinter.windowId]; + pixels_data.pixels = window->tileData; + pixels_data.width = window->width << 3; + pixels_data.height = window->height << 3; + + gUnk = gUnknown_03002F90; + glyphHeight = &gUnk[0x81]; + + FillBitmapRect4Bit( + &pixels_data, + textPrinter->subPrinter.currentX, + textPrinter->subPrinter.currentY, + width, + *glyphHeight, + gLastTextBgColor); + } +} + +u16 Font0Func(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->field_1_top == 0) + { + textPrinter->sub_union.sub.font_type = 0; + subStruct->field_1_top = 1; + } + return RenderText(textPrinter); +} + +u16 Font1Func(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->field_1_top == 0) + { + textPrinter->sub_union.sub.font_type = 1; + subStruct->field_1_top = 1; + } + return RenderText(textPrinter); +} + +u16 Font2Func(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->field_1_top == 0) + { + textPrinter->sub_union.sub.font_type = 2; + subStruct->field_1_top = 1; + } + return RenderText(textPrinter); +} + +u16 Font3Func(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->field_1_top == 0) + { + textPrinter->sub_union.sub.font_type = 3; + subStruct->field_1_top = 1; + } + return RenderText(textPrinter); +} + +u16 Font4Func(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->field_1_top == 0) + { + textPrinter->sub_union.sub.font_type = 4; + subStruct->field_1_top = 1; + } + return RenderText(textPrinter); +} + +u16 Font5Func(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->field_1_top == 0) + { + textPrinter->sub_union.sub.font_type = 5; + subStruct->field_1_top = 1; + } + return RenderText(textPrinter); +} + +u16 Font7Func(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->field_1_top == 0) + { + textPrinter->sub_union.sub.font_type = 7; + subStruct->field_1_top = 1; + } + return RenderText(textPrinter); +} + +u16 Font8Func(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->field_1_top == 0) + { + textPrinter->sub_union.sub.font_type = 8; + subStruct->field_1_top = 1; + } + return RenderText(textPrinter); +} + +void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (gTextFlags.flag_2 == 1) + subStruct->frames_visible_counter = 0; + else + { + subStruct->field_1_upmid = 0; + subStruct->field_1 = 0; + } +} + +void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + const u8 *arrowTiles; + + if (gTextFlags.flag_2 == 0) + { + if (subStruct->field_1 != 0) + { + subStruct->field_1 = ((*(u32*)&textPrinter->sub_union.sub) << 19 >> 27) - 1; // convoluted way of getting field_1, necessary to match + } + else + { + FillWindowPixelRect( + textPrinter->subPrinter.windowId, + textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor, + textPrinter->subPrinter.currentX, + textPrinter->subPrinter.currentY, + 0x8, + 0x10); + + switch (gTextFlags.flag_1) + { + case 0: + default: + arrowTiles = gDownArrowTiles; + break; + case 1: + arrowTiles = gDarkDownArrowTiles; + break; + } + + BlitBitmapRectToWindow( + textPrinter->subPrinter.windowId, + arrowTiles, + 0, + gDownArrowYCoords[*(u32*)subStruct << 17 >> 30], // subStruct->field_1_upmid but again, stupidly retrieved + 0x8, + 0x10, + textPrinter->subPrinter.currentX, + textPrinter->subPrinter.currentY, + 0x8, + 0x10); + CopyWindowToVram(textPrinter->subPrinter.windowId, 0x2); + + subStruct->field_1 = 0x8; + subStruct->field_1_upmid = (*(u32*)subStruct << 17 >> 30) + 1; + } + } +} + +void TextPrinterClearDownArrow(struct TextPrinter *textPrinter) +{ + FillWindowPixelRect( + textPrinter->subPrinter.windowId, + textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor, + textPrinter->subPrinter.currentX, + textPrinter->subPrinter.currentY, + 0x8, + 0x10); + CopyWindowToVram(textPrinter->subPrinter.windowId, 0x2); +} + +bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + + if (subStruct->frames_visible_counter == 49) + { + return TRUE; + } + else + { + ++subStruct->frames_visible_counter; + return FALSE; + } +} + +bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) +{ + u8 result = 0; + if (gTextFlags.flag_2 != 0) + { + result = TextPrinterWaitAutoMode(textPrinter); + } + else + { + TextPrinterDrawDownArrow(textPrinter); + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + result = 1; + audio_play(5); + } + } + return result; +} + +bool8 TextPrinterWait(struct TextPrinter *textPrinter) +{ + u8 result = 0; + if (gTextFlags.flag_2 != 0) + { + result = TextPrinterWaitAutoMode(textPrinter); + } + else + { + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + result = 1; + audio_play(5); + } + } + return result; +} + +void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *counter, u8 *yCoordIndex) +{ + const u8 *arrowTiles; + + if (*counter != 0) + { + --*counter; + } + else + { + FillWindowPixelRect(windowId, (bgColor << 4) | bgColor, x, y, 0x8, 0x10); + if (drawArrow == 0) + { + switch (gTextFlags.flag_1) + { + case 0: + default: + arrowTiles = gDownArrowTiles; + break; + case 1: + arrowTiles = gDarkDownArrowTiles; + break; + } + + BlitBitmapRectToWindow( + windowId, + arrowTiles, + 0, + gDownArrowYCoords[*yCoordIndex & 3], + 0x8, + 0x10, + x, + y - 2, + 0x8, + 0x10); + CopyWindowToVram(windowId, 0x2); + *counter = 8; + ++*yCoordIndex; + } + } +} + +__attribute__((naked)) +u16 RenderText(struct TextPrinter *textPrinter) // 80057B4 +{ + asm("push {r4-r6,lr}\n\ + add r6, r0, #0\n\ + add r4, r6, #0\n\ + add r4, #0x14\n\ + ldrb r0, [r6, #0x1C]\n\ + cmp r0, #0x6\n\ + bls _080057C4\n\ + b _08005D6C\n\ +_080057C4:\n\ + lsl r0, #2\n\ + ldr r1, =_080057D4\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_080057D4:\n\ + .4byte _080057F0\n\ + .4byte _08005C78\n\ + .4byte _08005C8C\n\ + .4byte _08005CB8\n\ + .4byte _08005CF0\n\ + .4byte _08005D48\n\ + .4byte _08005D5A\n\ +_080057F0:\n\ + ldr r2, =gMain\n\ + ldrh r1, [r2, #0x2C]\n\ + mov r0, #0x3\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _0800580A\n\ + ldrb r1, [r4]\n\ + mov r0, #0x10\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _0800580A\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1E]\n\ +_0800580A:\n\ + ldrb r1, [r6, #0x1E]\n\ + cmp r1, #0\n\ + beq _0800584C\n\ + ldrb r0, [r6, #0x1D]\n\ + cmp r0, #0\n\ + beq _0800584C\n\ + sub r0, r1, #0x1\n\ + strb r0, [r6, #0x1E]\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x1\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005828\n\ + b _08005B56\n\ +_08005828:\n\ + ldrh r1, [r2, #0x2E]\n\ + mov r0, #0x3\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005834\n\ + b _08005B56\n\ +_08005834:\n\ + ldrb r0, [r4]\n\ + mov r1, #0x10\n\ + orr r0, r1\n\ + strb r0, [r4]\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1E]\n\ + b _08005B56\n\ + .pool\n\ +_0800584C:\n\ + ldr r0, =gBattleTypeFlags\n\ + ldr r0, [r0]\n\ + mov r1, #0x80\n\ + lsl r1, #17\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005874\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x4\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _08005874\n\ + mov r0, #0x3\n\ + b _08005876\n\ + .pool\n\ +_08005874:\n\ + ldrb r0, [r6, #0x1D]\n\ +_08005876:\n\ + strb r0, [r6, #0x1E]\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + add r0, r3, #0\n\ + sub r0, #0xF8\n\ + cmp r0, #0x7\n\ + bls _0800588A\n\ + b _08005B90\n\ +_0800588A:\n\ + lsl r0, #2\n\ + ldr r1, =_08005898\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_08005898:\n\ + .4byte _08005B6C\n\ + .4byte _08005B5A\n\ + .4byte _08005B4C\n\ + .4byte _08005B48\n\ + .4byte _080058E0\n\ + .4byte _080058DC\n\ + .4byte _080058B8\n\ + .4byte _08005D6C\n\ +_080058B8:\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + ldrb r1, [r6, #0x5]\n\ + ldr r0, =gFonts\n\ + ldr r2, [r0]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + add r0, r2\n\ + ldrb r1, [r6, #0xB]\n\ + ldrb r0, [r0, #0x5]\n\ + add r1, r0\n\ + ldrb r0, [r6, #0x9]\n\ + add r0, r1\n\ + b _08005ABA\n\ + .pool\n\ +_080058DC:\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ +_080058E0:\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + sub r0, r3, #0x1\n\ + cmp r0, #0x17\n\ + bls _080058F0\n\ + b _08005B90\n\ +_080058F0:\n\ + lsl r0, #2\n\ + ldr r1, =_08005900\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_08005900:\n\ + .4byte _08005960\n\ + .4byte _08005982\n\ + .4byte _080059A6\n\ + .4byte _080059C0\n\ + .4byte _08005A0E\n\ + .4byte _08005A12\n\ + .4byte _08005A0A\n\ + .4byte _08005A2A\n\ + .4byte _08005A3A\n\ + .4byte _08005A58\n\ + .4byte _08005A5C\n\ + .4byte _08005B5A\n\ + .4byte _08005A90\n\ + .4byte _08005A98\n\ + .4byte _08005AA4\n\ + .4byte _08005A76\n\ + .4byte _08005AD8\n\ + .4byte _08005AF2\n\ + .4byte _08005B02\n\ + .4byte _08005B26\n\ + .4byte _08005B36\n\ + .4byte _08005B3E\n\ + .4byte _08005ABE\n\ + .4byte _08005ACC\n\ +_08005960:\n\ + ldr r2, [r6]\n\ + ldrb r1, [r2]\n\ + lsl r1, #4\n\ + ldrb r3, [r6, #0xC]\n\ + mov r0, #0xF\n\ + and r0, r3\n\ + orr r0, r1\n\ + strb r0, [r6, #0xC]\n\ + add r2, #0x1\n\ + str r2, [r6]\n\ + lsl r0, #24\n\ + lsr r0, #28\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsr r2, #4\n\ + b _08005A06\n\ +_08005982:\n\ + ldr r1, [r6]\n\ + ldrb r2, [r1]\n\ + mov r0, #0xF\n\ + and r0, r2\n\ + ldrb r3, [r6, #0xD]\n\ + mov r2, #0x10\n\ + neg r2, r2\n\ + and r2, r3\n\ + orr r2, r0\n\ + strb r2, [r6, #0xD]\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r6, #0xC]\n\ + lsr r0, #4\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsr r2, #4\n\ + b _08005A06\n\ +_080059A6:\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + lsl r0, #4\n\ + ldrb r3, [r6, #0xD]\n\ + mov r2, #0xF\n\ + and r2, r3\n\ + orr r2, r0\n\ + strb r2, [r6, #0xD]\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r6, #0xC]\n\ + lsr r0, #4\n\ + b _080059FE\n\ +_080059C0:\n\ + ldr r3, [r6]\n\ + ldrb r1, [r3]\n\ + lsl r1, #4\n\ + ldrb r4, [r6, #0xC]\n\ + mov r2, #0xF\n\ + add r0, r2, #0\n\ + and r0, r4\n\ + orr r0, r1\n\ + strb r0, [r6, #0xC]\n\ + add r5, r3, #0x1\n\ + str r5, [r6]\n\ + ldrb r3, [r3, #0x1]\n\ + add r1, r2, #0\n\ + and r1, r3\n\ + ldrb r4, [r6, #0xD]\n\ + mov r3, #0x10\n\ + neg r3, r3\n\ + and r3, r4\n\ + orr r3, r1\n\ + strb r3, [r6, #0xD]\n\ + add r4, r5, #0x1\n\ + str r4, [r6]\n\ + ldrb r1, [r5, #0x1]\n\ + lsl r1, #4\n\ + and r2, r3\n\ + orr r2, r1\n\ + strb r2, [r6, #0xD]\n\ + add r4, #0x1\n\ + str r4, [r6]\n\ + lsl r0, #24\n\ + lsr r0, #28\n\ +_080059FE:\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsl r2, #24\n\ + lsr r2, #28\n\ +_08005A06:\n\ + bl GenerateFontHalfRowLookupTable\n\ +_08005A0A:\n\ + mov r0, #0x2\n\ + b _08005D6E\n\ +_08005A0E:\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ +_08005A12:\n\ + ldr r0, [r6]\n\ + ldrb r0, [r0]\n\ + mov r1, #0xF\n\ + and r1, r0\n\ + ldrb r2, [r4]\n\ + mov r0, #0x10\n\ + neg r0, r0\n\ + and r0, r2\n\ + orr r0, r1\n\ + strb r0, [r4]\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ +_08005A2A:\n\ + ldr r0, [r6]\n\ + ldrb r1, [r0]\n\ + strb r1, [r6, #0x1E]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + mov r0, #0x6\n\ + strb r0, [r6, #0x1C]\n\ + b _08005A0A\n\ +_08005A3A:\n\ + mov r0, #0x1\n\ + strb r0, [r6, #0x1C]\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x4\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005A4C\n\ + b _08005B56\n\ +_08005A4C:\n\ + mov r0, #0\n\ + strb r0, [r4, #0x2]\n\ + b _08005B56\n\ + .pool\n\ +_08005A58:\n\ + mov r0, #0x5\n\ + b _08005D56\n\ +_08005A5C:\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r1, r0, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r0, #0x1]\n\ + lsl r0, #8\n\ + orr r3, r0\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + add r0, r3, #0\n\ + bl song_play_for_text\n\ + b _08005A0A\n\ +_08005A76:\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r1, r0, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r0, #0x1]\n\ + lsl r0, #8\n\ + orr r3, r0\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + add r0, r3, #0\n\ + bl audio_play\n\ + b _08005A0A\n\ +_08005A90:\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + ldrb r3, [r6, #0x6]\n\ + b _08005AF8\n\ +_08005A98:\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + ldrb r2, [r6, #0x7]\n\ + add r0, r2\n\ + strb r0, [r6, #0x9]\n\ + b _08005AFC\n\ +_08005AA4:\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r2, #28\n\ + lsr r1, r2, #4\n\ + orr r1, r2\n\ + lsr r1, #24\n\ + bl FillWindowPixelBuffer\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + ldrb r0, [r6, #0x7]\n\ +_08005ABA:\n\ + strb r0, [r6, #0x9]\n\ + b _08005A0A\n\ +_08005ABE:\n\ + ldr r0, =gMPlay_BGM\n\ + bl m4aMPlayStop\n\ + b _08005A0A\n\ + .pool\n\ +_08005ACC:\n\ + ldr r0, =gMPlay_BGM\n\ + bl m4aMPlayContinue\n\ + b _08005A0A\n\ + .pool\n\ +_08005AD8:\n\ + ldr r0, [r6]\n\ + ldrb r4, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + cmp r4, #0\n\ + ble _08005A0A\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ +_08005AF2:\n\ + ldr r1, [r6]\n\ + ldrb r0, [r6, #0x6]\n\ + ldrb r3, [r1]\n\ +_08005AF8:\n\ + add r0, r3\n\ + strb r0, [r6, #0x8]\n\ +_08005AFC:\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + b _08005A0A\n\ +_08005B02:\n\ + ldr r0, [r6]\n\ + ldrb r2, [r0]\n\ + ldrb r1, [r6, #0x6]\n\ + add r2, r1\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + ldrb r0, [r6, #0x8]\n\ + sub r4, r2, r0\n\ + cmp r4, #0\n\ + bgt _08005B18\n\ + b _08005A0A\n\ +_08005B18:\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ +_08005B26:\n\ + ldr r0, [r6]\n\ + ldrb r2, [r0]\n\ + add r1, r6, #0\n\ + add r1, #0x20\n\ + strb r2, [r1]\n\ +_08005B30:\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + b _08005A0A\n\ +_08005B36:\n\ + add r1, r6, #0\n\ + add r1, #0x21\n\ + mov r0, #0x1\n\ + b _08005B44\n\ +_08005B3E:\n\ + add r1, r6, #0\n\ + add r1, #0x21\n\ + mov r0, #0\n\ +_08005B44:\n\ + strb r0, [r1]\n\ + b _08005A0A\n\ +_08005B48:\n\ + mov r0, #0x2\n\ + b _08005B4E\n\ +_08005B4C:\n\ + mov r0, #0x3\n\ +_08005B4E:\n\ + strb r0, [r6, #0x1C]\n\ + add r0, r6, #0\n\ + bl TextPrinterInitDownArrowCounters\n\ +_08005B56:\n\ + mov r0, #0x3\n\ + b _08005D6E\n\ +_08005B5A:\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + mov r2, #0x80\n\ + lsl r2, #1\n\ + add r1, r2, #0\n\ + orr r3, r1\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + b _08005B90\n\ +_08005B6C:\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + ldrb r0, [r6, #0x4]\n\ + add r1, r3, #0\n\ + ldrb r2, [r6, #0x8]\n\ + ldrb r3, [r6, #0x9]\n\ + bl DrawKeypadIcon\n\ + ldr r1, =gUnknown_03002F90\n\ + add r1, #0x80\n\ + strb r0, [r1]\n\ + ldrb r3, [r6, #0xA]\n\ + add r0, r3\n\ + b _08005C6A\n\ + .pool\n\ +_08005B90:\n\ + ldr r0, [r4]\n\ + lsl r0, #28\n\ + lsr r0, #28\n\ + cmp r0, #0x8\n\ + bhi _08005C10\n\ + lsl r0, #2\n\ + ldr r1, =_08005BA8\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_08005BA8:\n\ + .4byte _08005BCC\n\ + .4byte _08005BDA\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005C10\n\ + .4byte _08005BF6\n\ + .4byte _08005C04\n\ +_08005BCC:\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont0\n\ + b _08005C10\n\ +_08005BDA:\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont1\n\ + b _08005C10\n\ +_08005BE8:\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont2\n\ + b _08005C10\n\ +_08005BF6:\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont7\n\ + b _08005C10\n\ +_08005C04:\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont8\n\ +_08005C10:\n\ + add r0, r6, #0\n\ + bl CopyGlyphToWindow\n\ + add r2, r6, #0\n\ + add r2, #0x20\n\ + ldrb r0, [r2]\n\ + cmp r0, #0\n\ + beq _08005C48\n\ + ldr r1, =gUnknown_03002F90\n\ + add r1, #0x80\n\ + ldrb r0, [r1]\n\ + ldrb r3, [r6, #0x8]\n\ + add r0, r3\n\ + strb r0, [r6, #0x8]\n\ + ldrb r2, [r2]\n\ + ldrb r0, [r1]\n\ + sub r4, r2, r0\n\ + cmp r4, #0\n\ + ble _08005C70\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ + .pool\n\ +_08005C48:\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r0, [r0]\n\ + cmp r0, #0\n\ + beq _08005C64\n\ + ldr r0, =gUnknown_03002F90\n\ + add r0, #0x80\n\ + ldrb r1, [r6, #0xA]\n\ + ldrb r0, [r0]\n\ + add r1, r0\n\ + ldrb r0, [r6, #0x8]\n\ + b _08005C6C\n\ + .pool\n\ +_08005C64:\n\ + ldr r0, =gUnknown_03002F90\n\ + add r0, #0x80\n\ + ldrb r0, [r0]\n\ +_08005C6A:\n\ + ldrb r1, [r6, #0x8]\n\ +_08005C6C:\n\ + add r0, r1\n\ +_08005C6E:\n\ + strb r0, [r6, #0x8]\n\ +_08005C70:\n\ + mov r0, #0\n\ + b _08005D6E\n\ + .pool\n\ +_08005C78:\n\ + add r0, r6, #0\n\ + bl TextPrinterWait\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005C86\n\ + b _08005B56\n\ +_08005C86:\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ +_08005C8C:\n\ + add r0, r6, #0\n\ + bl TextPrinterWaitWithDownArrow\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005C9A\n\ + b _08005B56\n\ +_08005C9A:\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r2, #28\n\ + lsr r1, r2, #4\n\ + orr r1, r2\n\ + lsr r1, #24\n\ + bl FillWindowPixelBuffer\n\ + ldrb r0, [r6, #0x6]\n\ + mov r1, #0\n\ + strb r0, [r6, #0x8]\n\ + ldrb r0, [r6, #0x7]\n\ + strb r0, [r6, #0x9]\n\ + strb r1, [r6, #0x1C]\n\ + b _08005B56\n\ +_08005CB8:\n\ + add r0, r6, #0\n\ + bl TextPrinterWaitWithDownArrow\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005CC6\n\ + b _08005B56\n\ +_08005CC6:\n\ + add r0, r6, #0\n\ + bl TextPrinterClearDownArrow\n\ + ldrb r1, [r6, #0x5]\n\ + ldr r0, =gFonts\n\ + ldr r2, [r0]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + add r0, r2\n\ + ldrb r1, [r6, #0xB]\n\ + ldrb r0, [r0, #0x5]\n\ + add r1, r0\n\ + strb r1, [r6, #0x1F]\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + mov r0, #0x4\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ + .pool\n\ +_08005CF0:\n\ + ldrb r0, [r6, #0x1F]\n\ + cmp r0, #0\n\ + beq _08005D44\n\ + bl sub_8197964\n\ + ldr r1, =gWindowVerticalScrollSpeeds\n\ + add r0, r1\n\ + ldrb r4, [r0]\n\ + ldrb r2, [r6, #0x1F]\n\ + cmp r2, r4\n\ + bge _08005D20\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r1, [r6, #0xD]\n\ + lsl r1, #28\n\ + lsr r3, r1, #4\n\ + orr r3, r1\n\ + lsr r3, #24\n\ + mov r1, #0\n\ + bl ScrollWindow\n\ + mov r0, #0\n\ + b _08005D38\n\ + .pool\n\ +_08005D20:\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r1, [r6, #0xD]\n\ + lsl r1, #28\n\ + lsr r3, r1, #4\n\ + orr r3, r1\n\ + lsr r3, #24\n\ + mov r1, #0\n\ + add r2, r4, #0\n\ + bl ScrollWindow\n\ + ldrb r0, [r6, #0x1F]\n\ + sub r0, r4\n\ +_08005D38:\n\ + strb r0, [r6, #0x1F]\n\ + ldrb r0, [r6, #0x4]\n\ + mov r1, #0x2\n\ + bl CopyWindowToVram\n\ + b _08005B56\n\ +_08005D44:\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ +_08005D48:\n\ + bl mplay_has_finished_maybe\n\ + lsl r0, #24\n\ + lsr r0, #24\n\ + cmp r0, #0\n\ + beq _08005D56\n\ + b _08005B56\n\ +_08005D56:\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ +_08005D5A:\n\ + ldrb r0, [r6, #0x1E]\n\ + add r1, r0, #0\n\ + cmp r1, #0\n\ + beq _08005D68\n\ + sub r0, #0x1\n\ + strb r0, [r6, #0x1E]\n\ + b _08005B56\n\ +_08005D68:\n\ + strb r1, [r6, #0x1C]\n\ + b _08005B56\n\ +_08005D6C:\n\ + mov r0, #0x1\n\ +_08005D6E:\n\ + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1"); +} + +u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing) +{ + int i; + u8 width; + int temp; + int temp2; + u8 line; + int strPos; + u8 lineWidths[8]; + u8 *strLocal; + + for (i = 0; i < 8; i++) + { + lineWidths[i] = 0; + } + + width = 0; + line = 0; + strLocal = str; + strPos = 0; + + do + { + temp = strLocal[strPos++]; + switch (temp) + { + case 0xFE: + case 0xFF: + lineWidths[line] = width; + width = 0; + line++; + break; + case 0xFC: + temp2 = strLocal[strPos++]; + switch (temp2) + { + case 0x4: + ++strPos; + case 0xB: + case 0x10: + ++strPos; + case 0x1: + case 0x2: + case 0x3: + case 0x5: + case 0x6: + case 0x8: + case 0xC: + case 0xD: + case 0xE: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + ++strPos; + break; + case 0x7: + case 0x9: + case 0xA: + case 0xF: + case 0x15: + case 0x16: + default: + break; + } + break; + case 0xF7: + case 0xFD: + ++strPos; + break; + case 0xFA: + case 0xFB: + break; + case 0xF8: + case 0xF9: + ++strPos; + default: + ++width; + break; + } + } while (temp != 0xFF); + + for (width = 0, strPos = 0; strPos < 8; ++strPos) + { + if (width < lineWidths[strPos]) + width = lineWidths[strPos]; + } + + return (u8)(GetFontAttribute(fontId, 0) + letterSpacing) * width; +} + +u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32) +{ + u32 i; + + for (i = 0; i < 9; ++i) + { + if (glyphId == gGlyphWidthFuncs[i].font_id) + return gGlyphWidthFuncs[i].func; + } + + return 0; +} + +s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing) +{ + bool8 isJapanese; + int minGlyphWidth; + u32 (*func)(u16 glyphId, bool32 isJapanese); + s32 result; + int localLetterSpacing; + u32 lineWidth; + u8 *bufferPointer; + int glyphWidth; + u32 width; + + isJapanese = 0; + minGlyphWidth = 0; + + func = GetFontWidthFunc(fontId); + if (func == NULL) + return 0; + + if (letterSpacing == -1) + localLetterSpacing = GetFontAttribute(fontId, 2); + else + localLetterSpacing = letterSpacing; + + width = 0; + lineWidth = 0; + bufferPointer = 0; + + while (*str != 0xFF) + { + switch (*str) + { + case 0xFE: + if (lineWidth > width) + width = lineWidth; + lineWidth = 0; + break; + case 0xFD: + switch (*++str) + { + case 0x2: + bufferPointer = gStringVar1; + break; + case 0x3: + bufferPointer = gStringVar2; + break; + case 0x4: + bufferPointer = gStringVar3; + break; + default: + return 0; + } + case 0xF7: + if (bufferPointer == NULL) + bufferPointer = sub_81AFC74(*++str); + while (*bufferPointer != 0xFF) + { + glyphWidth = func(*bufferPointer++, isJapanese); + if (minGlyphWidth > 0) + { + if (glyphWidth < minGlyphWidth) + glyphWidth = minGlyphWidth; + lineWidth += glyphWidth; + } + else + { + lineWidth += glyphWidth; + if (isJapanese && str[1] != 0xFF) + lineWidth += localLetterSpacing; + } + } + bufferPointer = 0; + break; + case 0xFC: + switch (*++str) + { + case 0x4: + ++str; + case 0xB: + case 0x10: + ++str; + case 0x1: + case 0x2: + case 0x3: + case 0x5: + case 0x8: + case 0xC: + case 0xD: + case 0xE: + ++str; + break; + case 0x6: + func = GetFontWidthFunc(*++str); + if (func == NULL) + return 0; + if (letterSpacing == -1) + localLetterSpacing = GetFontAttribute(*str, 2); + break; + case 0x11: + glyphWidth = *++str; + lineWidth += glyphWidth; + break; + case 0x12: + lineWidth = *++str; + break; + case 0x13: + if (*++str > lineWidth) + lineWidth = *str; + break; + case 0x14: + minGlyphWidth = *++str; + break; + case 0x15: + isJapanese = 1; + break; + case 0x16: + isJapanese = 0; + break; + case 0x7: + case 0x9: + case 0xA: + case 0xF: + default: + break; + } + break; + case 0xF8: + case 0xF9: + if (*str == 0xF9) + glyphWidth = func(*++str | 0x100, isJapanese); + else + glyphWidth = GetKeypadIconWidth(*++str); + + if (minGlyphWidth > 0) + { + if (glyphWidth < minGlyphWidth) + glyphWidth = minGlyphWidth; + lineWidth += glyphWidth; + } + else + { + lineWidth += glyphWidth; + if (isJapanese && str[1] != 0xFF) + lineWidth += localLetterSpacing; + } + break; + case 0xFA: + case 0xFB: + break; + default: + glyphWidth = func(*str, isJapanese); + if (minGlyphWidth > 0) + { + if (glyphWidth < minGlyphWidth) + glyphWidth = minGlyphWidth; + lineWidth += glyphWidth; + } + else + { + lineWidth += glyphWidth; + if (isJapanese && str[1] != 0xFF) + lineWidth += localLetterSpacing; + } + break; + } + ++str; + } + + if (lineWidth > width) + return lineWidth; + return width; +} + +u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) +{ + u8 shadowColor; + u8 *strLocal; + int strPos; + int temp; + int temp2; + u8 colorBackup[3]; + u8 fgColor; + u8 bgColor; + + SaveTextColors(&colorBackup[0], &colorBackup[1], &colorBackup[2]); + + fgColor = 1; + bgColor = 0; + shadowColor = 3; + + GenerateFontHalfRowLookupTable(1, 0, 3); + strLocal = str; + strPos = 0; + + do + { + temp = strLocal[strPos++]; + switch (temp) + { + case 0xFC: + temp2 = strLocal[strPos++]; + switch (temp2) + { + case 0x4: + fgColor = strLocal[strPos++]; + bgColor = strLocal[strPos++]; + shadowColor = strLocal[strPos++]; + GenerateFontHalfRowLookupTable(fgColor, bgColor, shadowColor); + continue; + case 0x1: + fgColor = strLocal[strPos++]; + GenerateFontHalfRowLookupTable(fgColor, bgColor, shadowColor); + continue; + case 0x2: + bgColor = strLocal[strPos++]; + GenerateFontHalfRowLookupTable(fgColor, bgColor, shadowColor); + continue; + case 0x3: + shadowColor = strLocal[strPos++]; + GenerateFontHalfRowLookupTable(fgColor, bgColor, shadowColor); + continue; + case 0x6: + fontId = strLocal[strPos++]; + break; + case 0xB: + case 0x10: + ++strPos; + case 0x5: + case 0x8: + case 0xC: + case 0xD: + case 0xE: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + ++strPos; + break; + case 0x7: + case 0x9: + case 0xA: + case 0xF: + case 0x15: + case 0x16: + default: + continue; + } + break; + case 0xF7: + case 0xF8: + case 0xF9: + case 0xFD: + ++strPos; + break; + case 0xFA: + case 0xFB: + case 0xFE: + case 0xFF: + break; + default: + switch (fontId) + { + case 9: + DecompressGlyphFont9(temp); + break; + case 1: + default: + DecompressGlyphFont1(temp, 1); + break; + } + + CpuCopy32(gUnknown_03002F90, pixels, 0x20); + CpuCopy32(gUnknown_03002F90 + 0x40, pixels + 0x20, 0x20); + pixels += 0x40; + break; + } + } + while (temp != 0xFF); + + RestoreTextColors(&colorBackup[0], &colorBackup[1], &colorBackup[2]); + return 1; +} + +u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y) +{ + BlitBitmapRectToWindow( + windowId, + gKeypadIconTiles + (gKeypadIcons[keypadIconId].tile_offset * 0x20), + 0, + 0, + 0x80, + 0x80, + x, + y, + gKeypadIcons[keypadIconId].width, + gKeypadIcons[keypadIconId].height); + return gKeypadIcons[keypadIconId].width; +} + +u8 GetKeypadIconTileOffset(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].tile_offset; +} + +u8 GetKeypadIconWidth(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].width; +} + +u8 GetKeypadIconHeight(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].height; +} + +void SetDefaultFontsPointer() +{ + SetFontsPointer(&gFontInfos[0]); +} + +u8 GetFontAttribute(u8 fontId, u8 attributeId) +{ + int result = 0; + switch (attributeId) + { + case 0: + result = gFontInfos[fontId].maxLetterWidth; + break; + case 1: + result = gFontInfos[fontId].maxLetterHeight; + break; + case 2: + result = gFontInfos[fontId].letterSpacing; + break; + case 3: + result = gFontInfos[fontId].lineSpacing; + break; + case 4: + result = gFontInfos[fontId].fontColor_l; + break; + case 5: + result = gFontInfos[fontId].fontColor_h; + break; + case 6: + result = gFontInfos[fontId].bgColor; + break; + case 7: + result = gFontInfos[fontId].shadowColor; + break; + } + return result; +} + +u8 GetMenuCursorDimensionByFont(u8 fontId, u8 whichDimension) +{ + return gMenuCursorDimensions[fontId][whichDimension]; +} + +void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == 1) + { + glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40)); // gUnknown_03002FD0 + gUnknown_03002F90[0x80] = 8; // gGlyphWidth + gUnknown_03002F90[0x81] = 12; // gGlyphHeight + } + else + { + glyphs = gFont0LatinGlyphs + (0x20 * glyphId); + gUnknown_03002F90[0x80] = gFont0LatinGlyphWidths[glyphId]; + + if (gUnknown_03002F90[0x80] <= 8) + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + } + else + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); + } + + gUnknown_03002F90[0x81] = 13; + } +} + +u32 GetGlyphWidthFont0(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == 1) + return 8; + else + return gFont0LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == 1) + { + int eff; + glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40)); // gUnknown_03002FD0 + gUnknown_03002F90[0x80] = 8; // gGlyphWidth + gUnknown_03002F90[0x81] = 15; // gGlyphHeight + } + else + { + glyphs = gFont7LatinGlyphs + (0x20 * glyphId); + gUnknown_03002F90[0x80] = gFont7LatinGlyphWidths[glyphId]; + + if (gUnknown_03002F90[0x80] <= 8) + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + } + else + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); + } + + gUnknown_03002F90[0x81] = 15; + } +} + +u32 GetGlyphWidthFont7(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == 1) + return 8; + else + return gFont7LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == 1) + { + glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40)); // gUnknown_03002FD0 + gUnknown_03002F90[0x80] = 8; // gGlyphWidth + gUnknown_03002F90[0x81] = 12; // gGlyphHeight + } + else + { + glyphs = gFont8LatinGlyphs + (0x20 * glyphId); + gUnknown_03002F90[0x80] = gFont8LatinGlyphWidths[glyphId]; + + if (gUnknown_03002F90[0x80] <= 8) + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + } + else + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); + } + + gUnknown_03002F90[0x81] = 12; + } +} + +u32 GetGlyphWidthFont8(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == 1) + return 8; + else + return gFont8LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == 1) + { + glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90 + 0x60)); // gUnknown_03002FF0 + gUnknown_03002F90[0x80] = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth + gUnknown_03002F90[0x81] = 14; // gGlyphHeight + } + else + { + glyphs = gFont2LatinGlyphs + (0x20 * glyphId); + gUnknown_03002F90[0x80] = gFont2LatinGlyphWidths[glyphId]; + + if (gUnknown_03002F90[0x80] <= 8) + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + } + else + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); + } + + gUnknown_03002F90[0x81] = 14; + } +} + +u32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == 1) + return gFont2JapaneseGlyphWidths[glyphId]; + else + return gFont2LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == 1) + { + int eff; + glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40)); // gUnknown_03002FD0 + gUnknown_03002F90[0x80] = 8; // gGlyphWidth + gUnknown_03002F90[0x81] = 15; // gGlyphHeight + } + else + { + glyphs = gFont1LatinGlyphs + (0x20 * glyphId); + gUnknown_03002F90[0x80] = gFont1LatinGlyphWidths[glyphId]; + + if (gUnknown_03002F90[0x80] <= 8) + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + } + else + { + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); + } + + gUnknown_03002F90[0x81] = 15; + } +} + +u32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == 1) + return 8; + else + return gFont1LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont9(u16 glyphId) +{ + const u16* glyphs; + + glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 4)) + (0x8 * (glyphId & 0xF)); + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40)); + gUnknown_03002F90[0x80] = 8; + gUnknown_03002F90[0x81] = 12; +} diff --git a/sym_common.txt b/sym_common.txt index a2d59df3c..477cc9ae5 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -64,9 +64,17 @@ gUnknown_03002FD0: @ 3002FD0 .space 0x20 gUnknown_03002FF0: @ 3002FF0 - .space 0x24 + .space 0x20 -gUnknown_03003014: @ 3003014 +gGlyphWidth: @ 3003010 + .space 0x1 + +gGlyphHeight: @ 3003011 + .space 0x1 + + .align 2 + +gTextFlags: @ 3003014 .space 0x4 gUnknown_03003018: @ 3003018 diff --git a/sym_ewram.txt b/sym_ewram.txt index 5551dcf17..225215462 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,7 +1,7 @@ gTrainerId: @ 2020000 .space 0x4 -gUnknown_02020004: @ 2020004 +gWindows: @ 2020004 .space 0x180 gUnknown_02020184: @ 2020184