From 2da7bdbb1175802e55103c4f9df95e035aa38c40 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Fri, 26 Jan 2018 23:41:52 -0600 Subject: [PATCH] Begin menu.s decomp --- asm/battle_frontier_1.s | 38 + asm/menu.s | 2720 --------------------------------------- data/new_menu_helpers.s | 53 - include/gba/defines.h | 4 +- include/menu.h | 6 +- ld_script.txt | 4 +- src/menu.c | 849 ++++++++++++ src/new_menu_helpers.c | 35 +- sym_ewram.txt | 7 +- 9 files changed, 912 insertions(+), 2804 deletions(-) delete mode 100644 data/new_menu_helpers.s create mode 100644 src/menu.c diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index 91c8215e5..976543692 100644 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -16009,6 +16009,44 @@ _0819715C: pop {r0} bx r0 .pool + thumb_func_end sub_8197080 + thumb_func_start sub_8197184 +sub_8197184: @ 8197184 + push {r4,r5,lr} + adds r4, r1, 0 + adds r5, r2, 0 + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + bl GetWindowAttribute + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnknown_0860EA6C + movs r2, 0x80 + lsls r2, 1 + lsls r4, 16 + lsrs r4, 16 + adds r3, r4, 0 + bl LoadBgTiles + ldr r0, =gUnknown_0860EA4C + lsls r5, 20 + lsrs r5, 16 + adds r1, r5, 0 + movs r2, 0x20 + bl LoadPalette + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8197184 + + thumb_func_start sub_81971C4 +sub_81971C4: @ 81971C4 + push {lr} + bl sub_819645C + pop {r0} + bx r0 + thumb_func_end sub_81971C4 .align 2, 0 @ Don't pad with nop. diff --git a/asm/menu.s b/asm/menu.s index cbea45c75..607efb8ef 100644 --- a/asm/menu.s +++ b/asm/menu.s @@ -5,2726 +5,6 @@ .text - thumb_func_start AddTextPrinterWithCallbackForMessage -@ void AddTextPrinterWithCallbackForMessage(u8 allowSkippingDelayWithButtonPress, void ( *callback)(u16, struct TextPrinter *)) -AddTextPrinterWithCallbackForMessage: @ 8197A9C - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r1, 0 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gTextFlags - movs r4, 0x1 - ands r0, r4 - ldrb r2, [r3] - movs r1, 0x2 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3] - bl GetPlayerTextSpeed - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r2, =gStringVar4 - str r5, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParameterized - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end AddTextPrinterWithCallbackForMessage - - thumb_func_start sub_8197AE8 -sub_8197AE8: @ 8197AE8 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - cmp r4, 0x1 - bne _08197B12 - movs r0, 0 - bl CopyBgTilemapBufferToVram -_08197B12: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8197AE8 - - thumb_func_start sub_8197B1C -sub_8197B1C: @ 8197B1C - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CD9C - strh r2, [r0] - ldr r0, =gUnknown_0203CD9E - strb r3, [r0] - ldr r1, =sub_8197BB4 - adds r0, r5, 0 - bl CallWindowFunction - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl PutWindowTilemap - cmp r4, 0x1 - bne _08197B52 - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram -_08197B52: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197B1C - - thumb_func_start sub_8197B64 -sub_8197B64: @ 8197B64 - push {r4-r6,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CD9C - strh r2, [r0] - ldr r5, =gUnknown_0203CD9E - adds r0, r6, 0 - movs r1, 0x5 - bl GetWindowAttribute - strb r0, [r5] - ldr r1, =sub_8197BB4 - adds r0, r6, 0 - bl CallWindowFunction - adds r0, r6, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r6, 0 - bl PutWindowTilemap - cmp r4, 0x1 - bne _08197BA2 - adds r0, r6, 0 - movs r1, 0x3 - bl CopyWindowToVram -_08197BA2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197B64 - - thumb_func_start sub_8197BB4 -sub_8197BB4: @ 8197BB4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - mov r8, r0 - adds r5, r2, 0 - adds r6, r3, 0 - ldr r2, [sp, 0x44] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r0, r1, 24 - lsls r5, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r1, r2, 24 - lsrs r1, 24 - str r1, [sp, 0x10] - ldr r2, =gUnknown_0203CD9C - ldrh r1, [r2] - adds r1, 0x1 - lsls r1, 16 - lsrs r1, 16 - lsrs r3, r0, 24 - str r3, [sp, 0xC] - movs r3, 0xFE - lsls r3, 24 - adds r2, r0, r3 - lsrs r2, 24 - str r2, [sp, 0x14] - lsrs r0, r5, 24 - mov r9, r0 - movs r2, 0xFF - lsls r2, 24 - adds r5, r2 - lsrs r5, 24 - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - ldr r3, =gUnknown_0203CD9E - mov r10, r3 - ldrb r0, [r3] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0x14] - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r0, =gUnknown_0203CD9C - ldrh r1, [r0] - adds r1, 0x3 - lsls r1, 16 - lsrs r1, 16 - ldr r0, [sp, 0xC] - subs r0, 0x1 - lsls r2, r0, 24 - lsrs r2, 24 - str r2, [sp, 0x18] - str r4, [sp] - str r4, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0x18] - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r3, =gUnknown_0203CD9C - ldrh r1, [r3] - adds r1, 0x4 - lsls r1, 16 - lsrs r1, 16 - subs r0, r6, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x1C] - str r0, [sp] - str r4, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0xC] - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r3, =gUnknown_0203CD9C - ldrh r1, [r3] - adds r1, 0x5 - lsls r1, 16 - lsrs r1, 16 - ldr r0, [sp, 0xC] - adds r7, r0, r6 - subs r0, r7, 0x1 - lsls r2, r0, 24 - lsrs r2, 24 - str r2, [sp, 0x20] - str r4, [sp] - str r4, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0x20] - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r3, =gUnknown_0203CD9C - ldrh r1, [r3] - adds r1, 0x6 - lsls r1, 16 - lsrs r1, 16 - lsls r2, r7, 24 - lsrs r7, r2, 24 - str r4, [sp] - str r4, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - adds r2, r7, 0 - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r3, =gUnknown_0203CD9C - ldrh r1, [r3] - adds r1, 0x7 - lsls r1, 16 - lsrs r1, 16 - str r4, [sp] - movs r5, 0x5 - str r5, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0x14] - mov r3, r9 - bl FillBgTilemapBufferRect - ldr r3, =gUnknown_0203CD9C - ldrh r1, [r3] - adds r1, 0x9 - lsls r1, 16 - lsrs r1, 16 - adds r6, 0x1 - lsls r6, 24 - lsrs r6, 24 - str r6, [sp] - str r5, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0x18] - mov r3, r9 - bl FillBgTilemapBufferRect - ldr r3, =gUnknown_0203CD9C - ldrh r1, [r3] - adds r1, 0xA - lsls r1, 16 - lsrs r1, 16 - str r4, [sp] - str r5, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - adds r2, r7, 0 - mov r3, r9 - bl FillBgTilemapBufferRect - ldr r3, =0x00000801 - adds r1, r3, 0 - ldr r0, =gUnknown_0203CD9C - ldrh r0, [r0] - adds r1, r0 - lsls r1, 16 - lsrs r1, 16 - ldr r2, [sp, 0x10] - add r9, r2 - mov r3, r9 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - str r4, [sp] - str r4, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0x14] - bl FillBgTilemapBufferRect - ldr r3, =0x00000803 - adds r1, r3, 0 - ldr r0, =gUnknown_0203CD9C - ldrh r0, [r0] - adds r1, r0 - lsls r1, 16 - lsrs r1, 16 - str r4, [sp] - str r4, [sp, 0x4] - mov r2, r10 - ldrb r0, [r2] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0x18] - mov r3, r9 - bl FillBgTilemapBufferRect - ldr r3, =0x00000804 - adds r1, r3, 0 - ldr r0, =gUnknown_0203CD9C - ldrh r0, [r0] - adds r1, r0 - lsls r1, 16 - lsrs r1, 16 - ldr r2, [sp, 0x1C] - str r2, [sp] - str r4, [sp, 0x4] - mov r3, r10 - ldrb r0, [r3] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0xC] - mov r3, r9 - bl FillBgTilemapBufferRect - ldr r0, =0x00000805 - adds r1, r0, 0 - ldr r2, =gUnknown_0203CD9C - ldrh r2, [r2] - adds r1, r2 - lsls r1, 16 - lsrs r1, 16 - str r4, [sp] - str r4, [sp, 0x4] - mov r3, r10 - ldrb r0, [r3] - str r0, [sp, 0x8] - mov r0, r8 - ldr r2, [sp, 0x20] - mov r3, r9 - bl FillBgTilemapBufferRect - ldr r0, =0x00000806 - adds r1, r0, 0 - ldr r2, =gUnknown_0203CD9C - ldrh r2, [r2] - adds r1, r2 - lsls r1, 16 - lsrs r1, 16 - str r4, [sp] - str r4, [sp, 0x4] - mov r3, r10 - ldrb r0, [r3] - str r0, [sp, 0x8] - mov r0, r8 - adds r2, r7, 0 - mov r3, r9 - bl FillBgTilemapBufferRect - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197BB4 - - thumb_func_start sub_8197DF8 -sub_8197DF8: @ 8197DF8 - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =sub_8197E30 - adds r0, r5, 0 - bl CallWindowFunction - adds r0, r5, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl ClearWindowTilemap - cmp r4, 0x1 - bne _08197E26 - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram -_08197E26: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197DF8 - - thumb_func_start sub_8197E30 -sub_8197E30: @ 8197E30 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r1, 0 - adds r5, r2, 0 - ldr r1, [sp, 0x18] - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsls r5, 24 - lsls r3, 24 - lsls r1, 24 - movs r2, 0xFD - lsls r2, 24 - adds r4, r2 - lsrs r4, 24 - movs r2, 0xFF - lsls r2, 24 - adds r5, r2 - lsrs r5, 24 - movs r2, 0xC0 - lsls r2, 19 - adds r3, r2 - lsrs r3, 24 - str r3, [sp] - movs r2, 0x80 - lsls r2, 18 - adds r1, r2 - lsrs r1, 24 - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - adds r2, r4, 0 - adds r3, r5, 0 - bl FillBgTilemapBufferRect - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8197E30 - - thumb_func_start SetWindowBorderStyle -@ void SetWindowBorderStyle(u8 windowId, bool copyToVram, s16 tileStart, s8 palette) -SetWindowBorderStyle: @ 8197E80 - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CD9C - strh r2, [r0] - ldr r0, =gUnknown_0203CD9E - strb r3, [r0] - ldr r1, =DrawWindowBorder - adds r0, r5, 0 - bl CallWindowFunction - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl PutWindowTilemap - cmp r4, 0x1 - bne _08197EB6 - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram -_08197EB6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SetWindowBorderStyle - - thumb_func_start sub_8197EC8 -sub_8197EC8: @ 8197EC8 - push {r4-r6,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CD9C - strh r2, [r0] - ldr r5, =gUnknown_0203CD9E - adds r0, r6, 0 - movs r1, 0x5 - bl GetWindowAttribute - strb r0, [r5] - ldr r1, =DrawWindowBorder - adds r0, r6, 0 - bl CallWindowFunction - adds r0, r6, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r6, 0 - bl PutWindowTilemap - cmp r4, 0x1 - bne _08197F06 - adds r0, r6, 0 - movs r1, 0x3 - bl CopyWindowToVram -_08197F06: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197EC8 - - thumb_func_start DrawWindowBorder -DrawWindowBorder: @ 8197F18 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - mov r9, r0 - adds r6, r1, 0 - adds r4, r2, 0 - ldr r0, [sp, 0x38] - mov r1, r9 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - lsls r6, 24 - lsls r4, 24 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x10] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x14] - ldr r2, =gUnknown_0203CD9C - ldrh r1, [r2] - lsrs r0, r6, 24 - str r0, [sp, 0xC] - movs r2, 0xFF - lsls r2, 24 - adds r6, r2 - lsrs r6, 24 - lsrs r0, r4, 24 - mov r8, r0 - adds r4, r2 - lsrs r4, 24 - movs r5, 0x1 - str r5, [sp] - str r5, [sp, 0x4] - ldr r7, =gUnknown_0203CD9E - ldrb r0, [r7] - str r0, [sp, 0x8] - mov r0, r9 - adds r2, r6, 0 - adds r3, r4, 0 - bl FillBgTilemapBufferRect - ldr r2, =gUnknown_0203CD9C - ldrh r1, [r2] - adds r1, 0x1 - lsls r1, 16 - lsrs r1, 16 - ldr r0, [sp, 0x10] - str r0, [sp] - str r5, [sp, 0x4] - ldrb r0, [r7] - str r0, [sp, 0x8] - mov r0, r9 - ldr r2, [sp, 0xC] - adds r3, r4, 0 - bl FillBgTilemapBufferRect - ldr r2, =gUnknown_0203CD9C - ldrh r1, [r2] - adds r1, 0x2 - lsls r1, 16 - lsrs r1, 16 - ldr r0, [sp, 0xC] - ldr r2, [sp, 0x10] - adds r0, r2 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - str r5, [sp] - str r5, [sp, 0x4] - ldrb r0, [r7] - str r0, [sp, 0x8] - mov r0, r9 - mov r2, r10 - adds r3, r4, 0 - bl FillBgTilemapBufferRect - ldr r0, =gUnknown_0203CD9C - ldrh r1, [r0] - adds r1, 0x3 - lsls r1, 16 - lsrs r1, 16 - str r5, [sp] - ldr r2, [sp, 0x14] - str r2, [sp, 0x4] - ldrb r0, [r7] - str r0, [sp, 0x8] - mov r0, r9 - adds r2, r6, 0 - mov r3, r8 - bl FillBgTilemapBufferRect - ldr r0, =gUnknown_0203CD9C - ldrh r1, [r0] - adds r1, 0x5 - lsls r1, 16 - lsrs r1, 16 - str r5, [sp] - ldr r2, [sp, 0x14] - str r2, [sp, 0x4] - ldrb r0, [r7] - str r0, [sp, 0x8] - mov r0, r9 - mov r2, r10 - mov r3, r8 - bl FillBgTilemapBufferRect - ldr r0, =gUnknown_0203CD9C - ldrh r1, [r0] - adds r1, 0x6 - lsls r1, 16 - lsrs r1, 16 - ldr r2, [sp, 0x14] - add r8, r2 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - str r5, [sp] - str r5, [sp, 0x4] - ldrb r0, [r7] - str r0, [sp, 0x8] - mov r0, r9 - adds r2, r6, 0 - mov r3, r8 - bl FillBgTilemapBufferRect - ldr r2, =gUnknown_0203CD9C - ldrh r1, [r2] - adds r1, 0x7 - lsls r1, 16 - lsrs r1, 16 - ldr r0, [sp, 0x10] - str r0, [sp] - str r5, [sp, 0x4] - ldrb r0, [r7] - str r0, [sp, 0x8] - mov r0, r9 - ldr r2, [sp, 0xC] - mov r3, r8 - bl FillBgTilemapBufferRect - ldr r2, =gUnknown_0203CD9C - ldrh r1, [r2] - adds r1, 0x8 - lsls r1, 16 - lsrs r1, 16 - str r5, [sp] - str r5, [sp, 0x4] - ldrb r0, [r7] - str r0, [sp, 0x8] - mov r0, r9 - mov r2, r10 - mov r3, r8 - bl FillBgTilemapBufferRect - 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 DrawWindowBorder - - thumb_func_start sub_8198070 -sub_8198070: @ 8198070 - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =sub_81980A8 - adds r0, r5, 0 - bl CallWindowFunction - adds r0, r5, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl ClearWindowTilemap - cmp r4, 0x1 - bne _0819809E - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram -_0819809E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8198070 - - thumb_func_start sub_81980A8 -sub_81980A8: @ 81980A8 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r1, 0 - adds r5, r2, 0 - ldr r1, [sp, 0x18] - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsls r5, 24 - lsls r3, 24 - lsls r1, 24 - movs r2, 0xFF - lsls r2, 24 - adds r4, r2 - lsrs r4, 24 - adds r5, r2 - lsrs r5, 24 - movs r2, 0x80 - lsls r2, 18 - adds r3, r2 - lsrs r3, 24 - str r3, [sp] - adds r1, r2 - lsrs r1, 24 - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - adds r2, r4, 0 - adds r3, r5, 0 - bl FillBgTilemapBufferRect - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81980A8 - - thumb_func_start sub_81980F0 -sub_81980F0: @ 81980F0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - ldr r4, [sp, 0x20] - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - lsrs r5, r3, 24 - lsls r4, 16 - lsrs r4, 16 - mov r0, sp - movs r1, 0 - movs r2, 0x8 - bl memset - cmp r6, 0x3 - bls _08198126 - movs r1, 0 - mov r0, sp - strb r1, [r0] - b _0819812A -_08198126: - mov r0, sp - strb r6, [r0] -_0819812A: - mov r1, sp - mov r0, r8 - strb r0, [r1, 0x2] - movs r0, 0x2 - strb r0, [r1, 0x4] - movs r0, 0x1E - subs r0, r7 - strb r0, [r1, 0x1] - strb r7, [r1, 0x3] - strb r5, [r1, 0x5] - strh r4, [r1, 0x6] - ldr r4, =gUnknown_0203CDA0 - mov r0, sp - bl AddWindow - strb r0, [r4] - cmp r5, 0xF - bls _08198158 - movs r5, 0xF0 - b _0819815C - .pool -_08198158: - lsls r0, r5, 28 - lsrs r5, r0, 24 -_0819815C: - ldr r0, =gUnknown_0860F0B0 - adds r1, r5, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0203CDA0 - ldrb r0, [r0] - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81980F0 - - thumb_func_start sub_8198180 -sub_8198180: @ 8198180 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r6, r0, 0 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - ldr r5, =gUnknown_0203CDA0 - ldrb r0, [r5] - cmp r0, 0xFF - beq _081981EE - bl PutWindowTilemap - ldrb r0, [r5] - movs r1, 0xFF - bl FillWindowPixelBuffer - movs r0, 0 - adds r1, r6, 0 - movs r2, 0 - bl GetStringWidth - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - movs r1, 0x1 - bl GetWindowAttribute - movs r2, 0xEC - subs r2, r7 - lsls r0, 3 - subs r2, r0 - subs r2, r4 - lsls r2, 24 - lsrs r2, 24 - ldrb r0, [r5] - ldr r1, =gUnknown_0860F0D0 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - movs r3, 0x1 - bl box_print - mov r0, r8 - cmp r0, 0 - beq _081981EE - ldrb r0, [r5] - movs r1, 0x3 - bl CopyWindowToVram -_081981EE: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8198180 - - thumb_func_start sub_8198204 -sub_8198204: @ 8198204 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - mov r10, r0 - adds r6, r1, 0 - ldr r0, [sp, 0x38] - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r4, 0 - ldr r0, =gUnknown_0203CDA0 - ldrb r1, [r0] - adds r7, r0, 0 - cmp r1, 0xFF - beq _081982C8 - cmp r2, 0 - beq _08198244 - add r0, sp, 0x14 - strb r4, [r0] - adds r1, r0, 0 - b _0819824A - .pool -_08198244: - add r1, sp, 0x14 - movs r0, 0xF - strb r0, [r1] -_0819824A: - movs r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0x2 - strb r0, [r1, 0x2] - adds r5, r7, 0 - ldrb r0, [r5] - bl PutWindowTilemap - ldrb r0, [r5] - movs r1, 0xFF - bl FillWindowPixelBuffer - cmp r6, 0 - beq _0819829E - movs r0, 0 - adds r1, r6, 0 - movs r2, 0 - bl GetStringWidth - lsls r0, 16 - lsrs r4, r0, 16 - ldrb r0, [r5] - movs r1, 0x1 - bl GetWindowAttribute - movs r2, 0xEC - mov r1, r8 - subs r2, r1 - lsls r0, 3 - subs r2, r0 - subs r2, r4 - lsls r2, 24 - lsrs r2, 24 - ldrb r0, [r5] - add r1, sp, 0x14 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - movs r3, 0x1 - bl box_print -_0819829E: - ldrb r0, [r7] - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - add r2, sp, 0x14 - str r2, [sp, 0x8] - str r1, [sp, 0xC] - mov r1, r10 - str r1, [sp, 0x10] - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x1 - bl AddTextPrinterParameterized2 - mov r2, r9 - cmp r2, 0 - beq _081982C8 - ldrb r0, [r7] - movs r1, 0x3 - bl CopyWindowToVram -_081982C8: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8198204 - - thumb_func_start sub_81982D8 -sub_81982D8: @ 81982D8 - push {lr} - ldr r1, =gUnknown_0203CDA0 - ldrb r0, [r1] - cmp r0, 0xFF - beq _081982E8 - movs r1, 0x3 - bl CopyWindowToVram -_081982E8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81982D8 - - thumb_func_start sub_81982F0 -sub_81982F0: @ 81982F0 - push {r4,lr} - ldr r4, =gUnknown_0203CDA0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _08198308 - movs r1, 0xFF - bl FillWindowPixelBuffer - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram -_08198308: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81982F0 - - thumb_func_start sub_8198314 -sub_8198314: @ 8198314 - push {r4,lr} - ldr r4, =gUnknown_0203CDA0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _0819833C - movs r1, 0 - bl FillWindowPixelBuffer - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] -_0819833C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8198314 - - thumb_func_start sub_8198348 -sub_8198348: @ 8198348 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r4, [sp, 0x18] - mov r8, r4 - ldr r4, [sp, 0x1C] - ldr r5, [sp, 0x20] - ldr r6, [sp, 0x24] - mov r12, r6 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r7, r5, 24 - ldr r5, =gUnknown_0203CD90 - movs r6, 0 - strb r2, [r5] - strb r3, [r5, 0x1] - strb r6, [r5, 0x3] - subs r4, 0x1 - strb r4, [r5, 0x4] - strb r0, [r5, 0x5] - strb r1, [r5, 0x6] - mov r0, r8 - strb r0, [r5, 0x8] - mov r4, r12 - strb r4, [r5, 0xB] - cmp r7, 0 - blt _08198388 - movs r0, 0x4 - ldrsb r0, [r5, r0] - cmp r7, r0 - ble _08198390 -_08198388: - strb r6, [r5, 0x2] - b _08198392 - .pool -_08198390: - strb r7, [r5, 0x2] -_08198392: - movs r0, 0 - bl MoveMenuCursor - ldr r0, =gUnknown_0203CD90 - ldrb r0, [r0, 0x2] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8198348 - - thumb_func_start sub_81983AC -sub_81983AC: @ 81983AC - push {r4-r6,lr} - sub sp, 0x10 - ldr r4, [sp, 0x20] - ldr r5, [sp, 0x24] - ldr r6, [sp, 0x28] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - str r4, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r4, 0 - str r4, [sp, 0xC] - bl sub_8198348 - lsls r0, 24 - lsrs r0, 24 - add sp, 0x10 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81983AC - - thumb_func_start sub_81983EC -sub_81983EC: @ 81983EC - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x14 - mov r8, r0 - adds r6, r1, 0 - ldr r4, [sp, 0x28] - ldr r5, [sp, 0x2C] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r6, 24 - lsrs r6, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - movs r1, 0x1 - str r2, [sp, 0xC] - str r3, [sp, 0x10] - bl GetMenuCursorDimensionByFont - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - mov r0, r8 - adds r1, r6, 0 - ldr r2, [sp, 0xC] - ldr r3, [sp, 0x10] - bl sub_81983AC - lsls r0, 24 - lsrs r0, 24 - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81983EC - - thumb_func_start RedrawMenuCursor -@ void RedrawMenuCursor(s8 oldPos, s8 newPos) -RedrawMenuCursor: @ 8198448 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0xC - adds r6, r0, 0 - mov r8, r1 - lsls r6, 24 - lsrs r6, 24 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r5, =gUnknown_0203CD90 - ldrb r0, [r5, 0x6] - movs r1, 0 - bl GetMenuCursorDimensionByFont - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r5, 0x6] - movs r1, 0x1 - bl GetMenuCursorDimensionByFont - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r5, 0x5] - mov r9, r1 - ldrb r2, [r5] - ldrb r1, [r5, 0x8] - adds r3, r1, 0 - muls r3, r6 - ldrb r6, [r5, 0x1] - adds r3, r6 - lsls r3, 16 - lsrs r3, 16 - str r4, [sp] - str r0, [sp, 0x4] - mov r0, r9 - movs r1, 0x11 - bl FillWindowPixelRect - ldrb r0, [r5, 0x5] - ldrb r1, [r5, 0x6] - ldr r2, =gText_SelectorArrow3 - ldrb r3, [r5] - ldrb r4, [r5, 0x8] - mov r6, r8 - muls r6, r4 - adds r4, r6, 0 - ldrb r5, [r5, 0x1] - adds r4, r5 - lsls r4, 24 - lsrs r4, 24 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - str r4, [sp, 0x8] - bl PrintTextOnWindow - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RedrawMenuCursor - - thumb_func_start MoveMenuCursor -@ s8 MoveMenuCursor(s8 cursorDelta) -MoveMenuCursor: @ 81984D8 - push {r4,r5,lr} - ldr r1, =gUnknown_0203CD90 - ldrb r5, [r1, 0x2] - movs r2, 0x2 - ldrsb r2, [r1, r2] - lsls r0, 24 - asrs r3, r0, 24 - adds r2, r3 - movs r0, 0x3 - ldrsb r0, [r1, r0] - adds r4, r1, 0 - cmp r2, r0 - bge _081984FC - ldrb r0, [r4, 0x4] - b _0819850A - .pool -_081984FC: - movs r0, 0x4 - ldrsb r0, [r4, r0] - cmp r2, r0 - ble _08198508 - ldrb r0, [r4, 0x3] - b _0819850A -_08198508: - adds r0, r3, r5 -_0819850A: - strb r0, [r4, 0x2] - ldrb r1, [r4, 0x2] - adds r0, r5, 0 - bl RedrawMenuCursor - ldrb r0, [r4, 0x2] - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end MoveMenuCursor - - thumb_func_start MoveMenuCursorNoWrapAround -@ s8 MoveMenuCursorNoWrapAround(s8 cursorDelta) -MoveMenuCursorNoWrapAround: @ 819851C - push {r4,r5,lr} - ldr r1, =gUnknown_0203CD90 - ldrb r5, [r1, 0x2] - movs r2, 0x2 - ldrsb r2, [r1, r2] - lsls r0, 24 - asrs r3, r0, 24 - adds r2, r3 - movs r0, 0x3 - ldrsb r0, [r1, r0] - adds r4, r1, 0 - cmp r2, r0 - bge _08198540 - ldrb r0, [r4, 0x3] - b _0819854E - .pool -_08198540: - movs r0, 0x4 - ldrsb r0, [r4, r0] - cmp r2, r0 - ble _0819854C - ldrb r0, [r4, 0x4] - b _0819854E -_0819854C: - adds r0, r3, r5 -_0819854E: - strb r0, [r4, 0x2] - ldrb r1, [r4, 0x2] - adds r0, r5, 0 - bl RedrawMenuCursor - ldrb r0, [r4, 0x2] - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end MoveMenuCursorNoWrapAround - - thumb_func_start GetMenuCursorPos -GetMenuCursorPos: @ 8198560 - ldr r0, =gUnknown_0203CD90 - ldrb r0, [r0, 0x2] - bx lr - .pool - thumb_func_end GetMenuCursorPos - - thumb_func_start ProcessMenuInput -ProcessMenuInput: @ 819856C - push {r4,lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08198598 - ldr r4, =gUnknown_0203CD90 - ldrb r0, [r4, 0xB] - cmp r0, 0 - bne _08198588 - movs r0, 0x5 - bl PlaySE -_08198588: - movs r0, 0x2 - ldrsb r0, [r4, r0] - b _081985D2 - .pool -_08198598: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081985A6 - movs r0, 0x1 - negs r0, r0 - b _081985D2 -_081985A6: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081985BA - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - negs r0, r0 - b _081985CA -_081985BA: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081985CE - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 -_081985CA: - bl MoveMenuCursor -_081985CE: - movs r0, 0x2 - negs r0, r0 -_081985D2: - pop {r4} - pop {r1} - bx r1 - thumb_func_end ProcessMenuInput - - thumb_func_start ProcessMenuInputNoWrapAround -@ int ProcessMenuInputNoWrapAround() -ProcessMenuInputNoWrapAround: @ 81985D8 - push {r4-r6,lr} - ldr r4, =gUnknown_0203CD90 - ldrb r5, [r4, 0x2] - adds r6, r5, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08198608 - ldrb r0, [r4, 0xB] - cmp r0, 0 - bne _081985F8 - movs r0, 0x5 - bl PlaySE -_081985F8: - movs r0, 0x2 - ldrsb r0, [r4, r0] - b _08198650 - .pool -_08198608: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08198616 - movs r0, 0x1 - negs r0, r0 - b _08198650 -_08198616: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08198630 - movs r0, 0x1 - negs r0, r0 - bl MoveMenuCursorNoWrapAround - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - beq _0819864C - b _08198646 -_08198630: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0819864C - movs r0, 0x1 - bl MoveMenuCursorNoWrapAround - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - beq _0819864C -_08198646: - movs r0, 0x5 - bl PlaySE -_0819864C: - movs r0, 0x2 - negs r0, r0 -_08198650: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end ProcessMenuInputNoWrapAround - - thumb_func_start ProcessMenuInput_other -ProcessMenuInput_other: @ 8198658 - push {r4,lr} - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08198684 - ldr r4, =gUnknown_0203CD90 - ldrb r0, [r4, 0xB] - cmp r0, 0 - bne _08198674 - movs r0, 0x5 - bl PlaySE -_08198674: - movs r0, 0x2 - ldrsb r0, [r4, r0] - b _081986BC - .pool -_08198684: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08198692 - movs r0, 0x1 - negs r0, r0 - b _081986BC -_08198692: - ldrh r0, [r2, 0x30] - movs r1, 0xF0 - ands r1, r0 - cmp r1, 0x40 - bne _081986A8 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - negs r0, r0 - b _081986B4 -_081986A8: - cmp r1, 0x80 - bne _081986B8 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 -_081986B4: - bl MoveMenuCursor -_081986B8: - movs r0, 0x2 - negs r0, r0 -_081986BC: - pop {r4} - pop {r1} - bx r1 - thumb_func_end ProcessMenuInput_other - - thumb_func_start ProcessMenuInputNoWrapAround_other -ProcessMenuInputNoWrapAround_other: @ 81986C4 - push {r4-r6,lr} - ldr r4, =gUnknown_0203CD90 - ldrb r5, [r4, 0x2] - adds r6, r5, 0 - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081986F4 - ldrb r0, [r4, 0xB] - cmp r0, 0 - bne _081986E4 - movs r0, 0x5 - bl PlaySE -_081986E4: - movs r0, 0x2 - ldrsb r0, [r4, r0] - b _0819873A - .pool -_081986F4: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08198702 - movs r0, 0x1 - negs r0, r0 - b _0819873A -_08198702: - ldrh r0, [r2, 0x30] - movs r1, 0xF0 - ands r1, r0 - cmp r1, 0x40 - bne _0819871E - movs r0, 0x1 - negs r0, r0 - bl MoveMenuCursorNoWrapAround - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - beq _08198736 - b _08198730 -_0819871E: - cmp r1, 0x80 - bne _08198736 - movs r0, 0x1 - bl MoveMenuCursorNoWrapAround - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - beq _08198736 -_08198730: - movs r0, 0x5 - bl PlaySE -_08198736: - movs r0, 0x2 - negs r0, r0 -_0819873A: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end ProcessMenuInputNoWrapAround_other - - thumb_func_start PrintTextArray -PrintTextArray: @ 8198740 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - ldr r4, [sp, 0x2C] - ldr r5, [sp, 0x30] - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - lsls r4, 24 - lsrs r7, r4, 24 - lsls r5, 24 - lsrs r5, 24 - movs r4, 0 - cmp r4, r5 - bcs _081987A4 -_08198774: - lsls r0, r4, 3 - ldr r1, [sp, 0x34] - adds r0, r1 - ldr r2, [r0] - adds r0, r7, 0 - muls r0, r4 - add r0, r8 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r6, 0 - mov r1, r10 - mov r3, r9 - bl PrintTextOnWindow - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08198774 -_081987A4: - adds r0, r6, 0 - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end PrintTextArray - - thumb_func_start sub_81987BC -sub_81987BC: @ 81987BC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r4, [sp, 0x40] - ldr r5, [sp, 0x44] - ldr r6, [sp, 0x4C] - ldr r7, [sp, 0x50] - mov r8, r7 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x14] - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x18] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x1C] - lsls r4, 24 - lsrs r4, 24 - mov r10, r4 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - mov r9, r6 - mov r0, r8 - lsls r0, 24 - lsrs r6, r0, 24 - movs r4, 0 - cmp r4, r5 - bcs _0819883C -_08198804: - lsls r0, r4, 3 - ldr r1, [sp, 0x48] - adds r0, r1 - ldr r2, [r0] - mov r0, r10 - muls r0, r4 - ldr r1, [sp, 0x1C] - adds r0, r1, r0 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - mov r0, r9 - str r0, [sp, 0xC] - str r6, [sp, 0x10] - adds r0, r7, 0 - ldr r1, [sp, 0x14] - ldr r3, [sp, 0x18] - bl sub_8199F74 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08198804 -_0819883C: - adds r0, r7, 0 - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81987BC - - thumb_func_start sub_8198854 -sub_8198854: @ 8198854 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - mov r8, r0 - adds r6, r1, 0 - adds r4, r2, 0 - adds r5, r3, 0 - ldr r7, [sp, 0x24] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r6, 24 - lsrs r6, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - movs r1, 0 - bl GetFontAttribute - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - str r4, [sp] - str r5, [sp, 0x4] - str r7, [sp, 0x8] - mov r0, r8 - adds r1, r6, 0 - movs r3, 0x1 - bl PrintTextArray - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8198854 - - thumb_func_start AddItemMenuActionTextPrinters -AddItemMenuActionTextPrinters: @ 81988A4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r6, r1, 0 - mov r8, r2 - ldr r1, [sp, 0x38] - mov r9, r1 - ldr r1, [sp, 0x3C] - ldr r2, [sp, 0x40] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x10] - lsls r6, 24 - lsrs r6, 24 - mov r4, r8 - lsls r4, 24 - lsrs r4, 24 - mov r8, r4 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x14] - mov r0, r9 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - lsrs r7, r2, 24 - mov r0, sp - ldrb r1, [r0, 0x10] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - adds r0, r6, 0 - movs r1, 0x5 - bl GetFontAttribute - mov r3, sp - lsls r0, 4 - ldrb r2, [r3, 0xC] - movs r5, 0xF - adds r1, r5, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xC] - adds r0, r6, 0 - movs r1, 0x6 - bl GetFontAttribute - mov r3, sp - adds r1, r5, 0 - ands r1, r0 - ldrb r2, [r3, 0xD] - movs r4, 0x10 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0xD] - adds r0, r6, 0 - movs r1, 0x7 - bl GetFontAttribute - mov r3, sp - lsls r0, 4 - ldrb r2, [r3, 0xD] - adds r1, r5, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xD] - adds r0, r6, 0 - movs r1, 0x4 - bl GetFontAttribute - mov r1, sp - ands r5, r0 - ldrb r0, [r1, 0xC] - ands r4, r0 - orrs r4, r5 - strb r4, [r1, 0xC] - mov r0, sp - mov r2, r9 - strb r2, [r0, 0xA] - adds r0, r6, 0 - movs r1, 0x3 - bl GetFontAttribute - mov r1, sp - strb r0, [r1, 0xB] - mov r0, sp - mov r4, r8 - strb r4, [r0, 0x6] - strb r4, [r0, 0x8] - movs r4, 0 - cmp r4, r7 - bcs _0819899E - mov r5, sp -_0819896E: - ldr r1, [sp, 0x48] - adds r0, r1, r4 - ldrb r0, [r0] - lsls r0, 3 - ldr r2, [sp, 0x44] - adds r0, r2 - ldr r0, [r0] - str r0, [sp] - mov r0, r10 - muls r0, r4 - ldr r1, [sp, 0x14] - adds r0, r1, r0 - strb r0, [r5, 0x7] - strb r0, [r5, 0x9] - mov r0, sp - movs r1, 0xFF - movs r2, 0 - bl AddTextPrinter - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r7 - bcc _0819896E -_0819899E: - ldr r0, [sp, 0x10] - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end AddItemMenuActionTextPrinters - - thumb_func_start sub_81989B8 -sub_81989B8: @ 81989B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x14 - mov r9, r0 - adds r4, r1, 0 - adds r6, r2, 0 - mov r8, r3 - ldr r7, [sp, 0x30] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - adds r0, r4, 0 - movs r1, 0 - bl GetFontAttribute - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r4, 0 - movs r1, 0x2 - bl GetFontAttribute - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - str r6, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - str r7, [sp, 0xC] - ldr r0, [sp, 0x34] - str r0, [sp, 0x10] - mov r0, r9 - adds r1, r4, 0 - adds r2, r5, 0 - movs r3, 0x1 - bl AddItemMenuActionTextPrinters - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81989B8 - - thumb_func_start SetWindowTemplateFields -@ void SetWindowTemplateFields(WindowTemplate *template, char bg_id, char x, char y, char w, char h, char a7, s16 a8) -SetWindowTemplateFields: @ 8198A24 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r4, [sp, 0x18] - ldr r5, [sp, 0x1C] - ldr r6, [sp, 0x20] - ldr r7, [sp, 0x24] - mov r8, r7 - strb r1, [r0] - strb r2, [r0, 0x1] - strb r3, [r0, 0x2] - strb r4, [r0, 0x3] - strb r5, [r0, 0x4] - strb r6, [r0, 0x5] - mov r1, r8 - strh r1, [r0, 0x6] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end SetWindowTemplateFields - - thumb_func_start sub_8198A50 -sub_8198A50: @ 8198A50 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x18 - mov r8, r0 - ldr r0, [sp, 0x2C] - ldr r4, [sp, 0x30] - ldr r5, [sp, 0x34] - ldr r6, [sp, 0x38] - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 16 - lsrs r6, 16 - str r0, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - str r6, [sp, 0xC] - add r0, sp, 0x10 - bl SetWindowTemplateFields - ldr r0, [sp, 0x10] - ldr r1, [sp, 0x14] - mov r2, r8 - str r0, [r2] - str r1, [r2, 0x4] - mov r0, r8 - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r2} - bx r2 - thumb_func_end sub_8198A50 - - thumb_func_start sub_8198AA4 -sub_8198AA4: @ 8198AA4 - push {r4-r6,lr} - sub sp, 0x18 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r0, [sp, 0x28] - ldr r1, [sp, 0x2C] - ldr r2, [sp, 0x30] - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 16 - lsrs r2, 16 - str r3, [sp] - str r0, [sp, 0x4] - str r1, [sp, 0x8] - str r2, [sp, 0xC] - add r0, sp, 0x10 - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl SetWindowTemplateFields - add r0, sp, 0x10 - bl AddWindow - lsls r0, 16 - lsrs r0, 16 - add sp, 0x18 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8198AA4 - - thumb_func_start sub_8198AF8 -sub_8198AF8: @ 8198AF8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - adds r6, r1, 0 - mov r8, r2 - mov r9, r3 - ldr r4, [sp, 0x3C] - ldr r5, [sp, 0x40] - ldr r1, [sp, 0x44] - mov r10, r1 - lsls r6, 24 - lsrs r6, 24 - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - mov r1, r9 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - mov r1, r10 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - ldr r7, =gUnknown_0203CD9F - bl AddWindow - strb r0, [r7] - ldrb r0, [r7] - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r5, 0 - bl SetWindowBorderStyle - ldr r0, =gText_YesNo - str r0, [sp, 0xC] - add r1, sp, 0xC - ldrb r0, [r7] - strb r0, [r1, 0x4] - adds r0, r1, 0 - strb r6, [r0, 0x5] - adds r0, r6, 0 - movs r1, 0 - bl GetFontAttribute - add r1, sp, 0xC - add r0, r8 - strb r0, [r1, 0x6] - adds r0, r1, 0 - mov r1, r9 - strb r1, [r0, 0x7] - adds r1, r0, 0 - ldrb r0, [r0, 0x6] - strb r0, [r1, 0x8] - adds r0, r1, 0 - ldrb r0, [r0, 0x7] - strb r0, [r1, 0x9] - adds r0, r6, 0 - movs r1, 0x5 - bl GetFontAttribute - add r3, sp, 0xC - lsls r0, 4 - ldrb r2, [r3, 0xC] - movs r5, 0xF - adds r1, r5, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xC] - adds r0, r6, 0 - movs r1, 0x6 - bl GetFontAttribute - add r3, sp, 0xC - adds r1, r5, 0 - ands r1, r0 - ldrb r2, [r3, 0xD] - movs r4, 0x10 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0xD] - adds r0, r6, 0 - movs r1, 0x7 - bl GetFontAttribute - add r3, sp, 0xC - lsls r0, 4 - ldrb r2, [r3, 0xD] - adds r1, r5, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xD] - adds r0, r6, 0 - movs r1, 0x4 - bl GetFontAttribute - add r1, sp, 0xC - ands r5, r0 - ldrb r0, [r1, 0xC] - ands r4, r0 - orrs r4, r5 - strb r4, [r1, 0xC] - adds r0, r6, 0 - movs r1, 0x2 - bl GetFontAttribute - add r1, sp, 0xC - strb r0, [r1, 0xA] - adds r0, r6, 0 - movs r1, 0x3 - bl GetFontAttribute - add r1, sp, 0xC - strb r0, [r1, 0xB] - adds r0, r1, 0 - movs r1, 0xFF - movs r2, 0 - bl AddTextPrinter - adds r0, r6, 0 - movs r1, 0x1 - bl GetFontAttribute - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r7] - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - mov r0, r10 - str r0, [sp, 0x8] - adds r0, r1, 0 - adds r1, r6, 0 - mov r2, r8 - mov r3, r9 - bl sub_81983AC - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8198AF8 - - thumb_func_start sub_8198C34 -sub_8198C34: @ 8198C34 - push {lr} - sub sp, 0xC - lsls r1, 24 - lsrs r1, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 24 - lsrs r3, 24 - str r2, [sp] - str r3, [sp, 0x4] - movs r2, 0 - str r2, [sp, 0x8] - movs r3, 0x1 - bl sub_8198AF8 - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_8198C34 - - thumb_func_start ProcessMenuInputNoWrap_ -ProcessMenuInputNoWrap_: @ 8198C58 - push {r4,lr} - bl ProcessMenuInputNoWrapAround - lsls r0, 24 - asrs r4, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _08198C6E - bl sub_8198C78 -_08198C6E: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end ProcessMenuInputNoWrap_ - - thumb_func_start sub_8198C78 -sub_8198C78: @ 8198C78 - push {r4,lr} - ldr r4, =gUnknown_0203CD9F - ldrb r0, [r4] - movs r1, 0x1 - bl sub_8198070 - ldrb r0, [r4] - bl RemoveWindow - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8198C78 - - thumb_func_start sub_8198C94 -sub_8198C94: @ 8198C94 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r4, [sp, 0x40] - ldr r5, [sp, 0x44] - ldr r6, [sp, 0x48] - ldr r7, [sp, 0x4C] - mov r8, r7 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0xC] - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x10] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x14] - lsls r4, 24 - lsrs r4, 24 - str r4, [sp, 0x18] - lsls r5, 24 - lsrs r5, 24 - str r5, [sp, 0x1C] - lsls r6, 24 - lsrs r6, 24 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r5, 0 - cmp r5, r9 - bcs _08198D3A -_08198CE0: - movs r4, 0 - adds r1, r5, 0x1 - mov r8, r1 - cmp r4, r6 - bcs _08198D30 - ldr r7, [sp, 0x1C] - adds r0, r7, 0 - muls r0, r5 - ldr r1, [sp, 0x14] - adds r0, r1, r0 - lsls r0, 24 - lsrs r7, r0, 24 -_08198CF8: - adds r0, r5, 0 - muls r0, r6 - adds r0, r4 - lsls r0, 3 - ldr r1, [sp, 0x50] - adds r0, r1 - ldr r2, [r0] - ldr r0, [sp, 0x18] - adds r3, r0, 0 - muls r3, r4 - ldr r1, [sp, 0x10] - adds r3, r1, r3 - lsls r3, 24 - lsrs r3, 24 - str r7, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - mov r0, r10 - ldr r1, [sp, 0xC] - bl PrintTextOnWindow - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _08198CF8 -_08198D30: - mov r7, r8 - lsls r0, r7, 24 - lsrs r5, r0, 24 - cmp r5, r9 - bcc _08198CE0 -_08198D3A: - mov r0, r10 - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8198C94 - - thumb_func_start sub_8198D54 -sub_8198D54: @ 8198D54 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - mov r9, r0 - mov r8, r1 - adds r4, r2, 0 - adds r5, r3, 0 - ldr r6, [sp, 0x34] - ldr r3, [sp, 0x38] - ldr r7, [sp, 0x3C] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - movs r1, 0 - str r3, [sp, 0x14] - bl GetFontAttribute - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - str r4, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - ldr r3, [sp, 0x14] - str r3, [sp, 0xC] - str r7, [sp, 0x10] - mov r0, r9 - mov r1, r8 - movs r3, 0 - bl sub_8198C94 - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8198D54 - - thumb_func_start sub_8198DBC -sub_8198DBC: @ 8198DBC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r4, [sp, 0x40] - ldr r5, [sp, 0x44] - ldr r6, [sp, 0x48] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x10] - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x14] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x18] - lsls r4, 24 - lsrs r4, 24 - str r4, [sp, 0x1C] - lsls r5, 24 - lsrs r5, 24 - mov r8, r5 - lsls r6, 24 - lsrs r6, 24 - mov r10, r6 - mov r0, sp - ldrb r1, [r0, 0x10] - strb r1, [r0, 0x4] - strb r7, [r0, 0x5] - adds r0, r7, 0 - movs r1, 0x5 - bl GetFontAttribute - mov r3, sp - lsls r0, 4 - ldrb r2, [r3, 0xC] - movs r5, 0xF - adds r1, r5, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xC] - adds r0, r7, 0 - movs r1, 0x6 - bl GetFontAttribute - mov r3, sp - adds r1, r5, 0 - ands r1, r0 - ldrb r2, [r3, 0xD] - movs r4, 0x10 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0xD] - adds r0, r7, 0 - movs r1, 0x7 - bl GetFontAttribute - mov r3, sp - lsls r0, 4 - ldrb r2, [r3, 0xD] - adds r1, r5, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xD] - adds r0, r7, 0 - movs r1, 0x4 - bl GetFontAttribute - mov r1, sp - ands r5, r0 - ldrb r0, [r1, 0xC] - ands r4, r0 - orrs r4, r5 - strb r4, [r1, 0xC] - adds r0, r7, 0 - movs r1, 0x2 - bl GetFontAttribute - mov r1, sp - strb r0, [r1, 0xA] - adds r0, r7, 0 - movs r1, 0x3 - bl GetFontAttribute - mov r1, sp - strb r0, [r1, 0xB] - movs r6, 0 - cmp r6, r10 - bcs _08198EDE -_08198E7A: - movs r5, 0 - adds r2, r6, 0x1 - mov r9, r2 - cmp r5, r8 - bcs _08198ED4 - mov r4, sp -_08198E86: - mov r0, r8 - muls r0, r6 - adds r0, r5 - ldr r1, [sp, 0x50] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 3 - ldr r2, [sp, 0x4C] - adds r0, r2 - ldr r0, [r0] - str r0, [sp] - ldr r1, [sp, 0x1C] - adds r0, r1, 0 - muls r0, r5 - ldr r2, [sp, 0x14] - adds r0, r2, r0 - strb r0, [r4, 0x6] - adds r0, r7, 0 - movs r1, 0x1 - bl GetFontAttribute - adds r1, r6, 0 - muls r1, r0 - ldr r0, [sp, 0x18] - adds r1, r0, r1 - strb r1, [r4, 0x7] - ldrb r0, [r4, 0x6] - strb r0, [r4, 0x8] - strb r1, [r4, 0x9] - mov r0, sp - movs r1, 0xFF - movs r2, 0 - bl AddTextPrinter - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r8 - bcc _08198E86 -_08198ED4: - mov r1, r9 - lsls r0, r1, 24 - lsrs r6, r0, 24 - cmp r6, r10 - bcc _08198E7A -_08198EDE: - ldr r0, [sp, 0x10] - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8198DBC - - thumb_func_start sub_8198EF8 -sub_8198EF8: @ 8198EF8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - mov r8, r0 - adds r3, r1, 0 - adds r4, r2, 0 - ldr r5, [sp, 0x30] - ldr r6, [sp, 0x34] - ldr r7, [sp, 0x38] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - adds r0, r3, 0 - movs r1, 0 - str r3, [sp, 0x14] - bl GetFontAttribute - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - str r4, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - str r7, [sp, 0xC] - ldr r0, [sp, 0x3C] - str r0, [sp, 0x10] - mov r0, r8 - ldr r3, [sp, 0x14] - adds r1, r3, 0 - movs r3, 0 - bl sub_8198DBC - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8198EF8 - - thumb_func_start sub_8198F58 -sub_8198F58: @ 8198F58 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r4, [sp, 0x20] - mov r12, r4 - ldr r4, [sp, 0x24] - mov r8, r4 - ldr r4, [sp, 0x28] - mov r9, r4 - ldr r4, [sp, 0x2C] - mov r10, r4 - ldr r4, [sp, 0x30] - ldr r5, [sp, 0x34] - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r7, r5, 24 - ldr r5, =gUnknown_0203CD90 - movs r6, 0 - strb r2, [r5] - strb r3, [r5, 0x1] - strb r6, [r5, 0x3] - subs r4, 0x1 - strb r4, [r5, 0x4] - strb r0, [r5, 0x5] - strb r1, [r5, 0x6] - mov r0, r12 - strb r0, [r5, 0x7] - mov r4, r8 - strb r4, [r5, 0x8] - mov r0, r9 - strb r0, [r5, 0x9] - mov r4, r10 - strb r4, [r5, 0xA] - cmp r7, 0 - blt _08198FAC - movs r0, 0x4 - ldrsb r0, [r5, r0] - cmp r7, r0 - ble _08198FB4 -_08198FAC: - strb r6, [r5, 0x2] - b _08198FB6 - .pool -_08198FB4: - strb r7, [r5, 0x2] -_08198FB6: - movs r0, 0 - movs r1, 0 - bl sub_8199134 - ldr r0, =gUnknown_0203CD90 - ldrb r0, [r0, 0x2] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8198F58 - thumb_func_start sub_8198FD4 sub_8198FD4: @ 8198FD4 push {r4-r6,lr} diff --git a/data/new_menu_helpers.s b/data/new_menu_helpers.s deleted file mode 100644 index c11d73d7c..000000000 --- a/data/new_menu_helpers.s +++ /dev/null @@ -1,53 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_0860F074:: @ 860F074 - .incbin "graphics/interface/860F074.gbapal" - -gUnknown_0860F094:: @ 860F094 - .byte 8, 4, 1, 0 - -gUnknown_0860F098:: @ 860F098 - window_template 0, 2, 15, 27, 4, 15, 0x194 - null_window_template - -gUnknown_0860F0A8:: @ 860F0A8 - window_template 0, 21, 9, 5, 4, 15, 0x125 - - @ These are not referenced in src/new_menu_helpers.c; rather, they are in src/menu.c. Regardless, they were plopped here. - -gUnknown_0860F0B0:: @ 860F0B0 - .incbin "graphics/interface/860F0B0.gbapal" - -gUnknown_0860F0D0:: @ 860F0D0 - .byte 15, 1, 2, 0 - -gUnknown_0860F0D4:: @ 860F0D4 - .2byte 0xC0C, 0 - .2byte 0xC20, 32 - .2byte 0xC20, 100 - .2byte 0xC20, 0x60 - .2byte 0xC20, 0x80 - .2byte 0xC20, 0x48 - .2byte 0xC20, 0x44 - .2byte 0xC20, 0x6C - .2byte 0xC20, 0x68 - .2byte 0xC20, 0x88 - .2byte 0xC20, 0xA4 - .2byte 0xC20, 0x24 - .2byte 0xC20, 0x28 - .2byte 0xC20, 0x2C - .2byte 0xC20, 0x40 - .2byte 0xC20, 0x84 - .2byte 0xC20, 0x4C - .2byte 0xC20, 0xA0 - .2byte 0xC20, 0x8C - .2byte 0xC2A, 0xA8 - .2byte 0xC2A, 0xC0 - .2byte 0xC2A, 0xC8 - .2byte 0xC2A, 0xE0 - .2byte 0xC2A, 0xE8 - .2byte 0x808, 0xAE - .2byte 0x808, 0xAF diff --git a/include/gba/defines.h b/include/gba/defines.h index 702d4a352..6925864a2 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -39,8 +39,8 @@ #define BG_CHAR_ADDR(n) (BG_VRAM + (BG_CHAR_SIZE * (n))) #define BG_SCREEN_ADDR(n) (BG_VRAM + (BG_SCREEN_SIZE * (n))) -#define BG_TILE_H_FLIP(n) (0x400 | (n)) -#define BG_TILE_V_FLIP(n) (0x800 | (n)) +#define BG_TILE_H_FLIP(n) (0x400 + (n)) +#define BG_TILE_V_FLIP(n) (0x800 + (n)) // text-mode BG #define OBJ_VRAM0 (VRAM + 0x10000) diff --git a/include/menu.h b/include/menu.h index 425908aea..2b9ec4438 100644 --- a/include/menu.h +++ b/include/menu.h @@ -30,15 +30,15 @@ void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); void reset_temp_tile_data_buffers(void); int decompress_and_copy_tile_data_to_vram(u8 bg_id, const void *src, int size, u16 offset, u8 mode); bool8 free_temp_tile_data_buffers_if_possible(void); -u64 sub_8198A50(struct WindowTemplate*, u8, u8, u8, u8, u8, u8, u16); // returns something but it isn't used, fix when menu.s is decomp'd +struct WindowTemplate sub_8198A50(u8, u8, u8, u8, u8, u8, u16); void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); s8 ProcessMenuInputNoWrap_(void); void do_scheduled_bg_tilemap_copies_to_vram(void); void clear_scheduled_bg_copies_to_vram(void); void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const struct TextColor *color, s8 speed, const u8 *str); -void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u16 a3); +void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u8 a3); void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void sub_8197DF8(u8 windowId, bool8 copyToVram); -u8 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16); +u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16); #endif // GUARD_MENU_H diff --git a/ld_script.txt b/ld_script.txt index ab9a456d0..22de4292e 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -248,6 +248,7 @@ SECTIONS { src/lilycove_lady.o(.text); asm/battle_frontier_1.o(.text); src/new_menu_helpers.o(.text); + src/menu.o(.text); asm/menu.o(.text); asm/battle_frontier_2.o(.text); asm/item_menu.o(.text); @@ -520,7 +521,8 @@ SECTIONS { src/battle_dome_cards.o(.rodata); src/lilycove_lady.o(.rodata); data/battle_frontier_1.o(.rodata); - data/new_menu_helpers.o(.rodata); + src/new_menu_helpers.o(.rodata); + src/menu.o(.rodata); data/battle_frontier_2.o(.rodata); data/item_menu.o(.rodata); data/menu_indicators.o(.rodata); diff --git a/src/menu.c b/src/menu.c new file mode 100644 index 000000000..9ff8d47b6 --- /dev/null +++ b/src/menu.c @@ -0,0 +1,849 @@ +#include "global.h" +#include "new_menu_helpers.h" +#include "bg.h" +#include "window.h" +#include "palette.h" +#include "menu.h" +#include "constants/songs.h" +#include "main.h" +#include "sound.h" + +struct SomeUnkStruct +{ + u8 unk1; + u8 unk2; + u16 unk3; +}; + +struct Menu +{ + u8 left; + u8 top; + s8 cursorPos; + s8 minCursorPos; + s8 maxCursorPos; + u8 windowId; + u8 fontId; + u8 menu_field_7; + u8 cursorHeight; + u8 menu_field_9; + u8 menu_field_A; + u8 menu_field_B; +}; + +extern EWRAM_DATA struct Menu gUnknown_0203CD90; +extern EWRAM_DATA u16 gUnknown_0203CD9C; +extern EWRAM_DATA u8 gUnknown_0203CD9E; +extern EWRAM_DATA u8 gUnknown_0203CD9F; +extern EWRAM_DATA u8 gUnknown_0203CDA0; + +const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal"); +const u8 gUnknown_0860F0D0[] = { 15, 1, 2 }; +const struct SomeUnkStruct gUnknown_0860F0D4[] = +{ + { 12, 12, 0x00 }, + { 32, 12, 0x20 }, + { 32, 12, 0x64 }, + { 32, 12, 0x60 }, + { 32, 12, 0x80 }, + { 32, 12, 0x48 }, + { 32, 12, 0x44 }, + { 32, 12, 0x6C }, + { 32, 12, 0x68 }, + { 32, 12, 0x88 }, + { 32, 12, 0xA4 }, + { 32, 12, 0x24 }, + { 32, 12, 0x28 }, + { 32, 12, 0x2C }, + { 32, 12, 0x40 }, + { 32, 12, 0x84 }, + { 32, 12, 0x4C }, + { 32, 12, 0xA0 }, + { 32, 12, 0x8C }, + { 42, 12, 0xA8 }, + { 42, 12, 0xC0 }, + { 42, 12, 0xC8 }, + { 42, 12, 0xE0 }, + { 42, 12, 0xE8 }, + { 8, 8, 0xAE }, + { 8, 8, 0xAF }, +}; + +extern const u8 gText_SelectorArrow3[]; +extern const u8 gText_YesNo[]; + +extern void sub_8197BB4(u8, u8, u8, u8, u8, u8); +extern void sub_8197E30(u8, u8, u8, u8, u8, u8); +extern void DrawWindowBorder(u8, u8, u8, u8, u8, u8); +extern void sub_81980A8(u8, u8, u8, u8, u8, u8); +extern u8 MoveMenuCursor(s8); +extern u8 sub_8199134(s8, s8); +extern void sub_8199F74(u8, u8, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8, u8); +extern void sub_8198C78(void); + +void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextSubPrinter *, u16)) +{ + gTextFlags.flag_0 = a1; + AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3); +} + +void sub_8197AE8(bool8 copyToVram) +{ + FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x11); + if (copyToVram == TRUE) + CopyBgTilemapBufferToVram(0); +} + +void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a3, u8 a4) +{ + gUnknown_0203CD9C = a3; + gUnknown_0203CD9E = a4; + CallWindowFunction(windowId, sub_8197BB4); + FillWindowPixelBuffer(windowId, 0x11); + PutWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void sub_8197B64(u8 windowId, bool8 copyToVram, u16 a3) +{ + gUnknown_0203CD9C = a3; + gUnknown_0203CD9E = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM); + CallWindowFunction(windowId, sub_8197BB4); + FillWindowPixelBuffer(windowId, 0x11); + PutWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void sub_8197BB4(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 1, + tilemapLeft - 2, + tilemapTop - 1, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 3, + tilemapLeft - 1, + tilemapTop - 1, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 4, + tilemapLeft, + tilemapTop - 1, + width - 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 5, + tilemapLeft + width - 1, + tilemapTop - 1, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 6, + tilemapLeft + width, + tilemapTop - 1, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 7, + tilemapLeft - 2, + tilemapTop, + 1, + 5, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 9, + tilemapLeft - 1, + tilemapTop, + width + 1, + 5, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 10, + tilemapLeft + width, + tilemapTop, + 1, + 5, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(gUnknown_0203CD9C + 1), + tilemapLeft - 2, + tilemapTop + height, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(gUnknown_0203CD9C + 3), + tilemapLeft - 1, + tilemapTop + height, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(gUnknown_0203CD9C + 4), + tilemapLeft, + tilemapTop + height, + width - 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(gUnknown_0203CD9C + 5), + tilemapLeft + width - 1, + tilemapTop + height, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(gUnknown_0203CD9C + 6), + tilemapLeft + width, + tilemapTop + height, + 1, + 1, + gUnknown_0203CD9E); +} + +void sub_8197DF8(u8 windowId, bool8 copyToVram) +{ + CallWindowFunction(windowId, sub_8197E30); + FillWindowPixelBuffer(windowId, 0); + ClearWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void sub_8197E30(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + FillBgTilemapBufferRect(bg, 0, tilemapLeft - 3, tilemapTop - 1, width + 6, height + 2, 0); +} + +void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 paletteNum) +{ + gUnknown_0203CD9C = baseTileNum; + gUnknown_0203CD9E = paletteNum; + CallWindowFunction(windowId, DrawWindowBorder); + FillWindowPixelBuffer(windowId, 0x11); + PutWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void sub_8197EC8(u8 windowId, bool8 copyToVram, u16 baseTileNum) +{ + gUnknown_0203CD9C = baseTileNum; + gUnknown_0203CD9E = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM); + CallWindowFunction(windowId, DrawWindowBorder); + FillWindowPixelBuffer(windowId, 0x11); + PutWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void DrawWindowBorder(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 0, + tilemapLeft - 1, + tilemapTop - 1, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 1, + tilemapLeft, + tilemapTop - 1, + width, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 2, + tilemapLeft + width, + tilemapTop - 1, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 3, + tilemapLeft - 1, + tilemapTop, + 1, + height, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 5, + tilemapLeft + width, + tilemapTop, + 1, + height, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 6, + tilemapLeft - 1, + tilemapTop + height, + 1, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 7, + tilemapLeft, + tilemapTop + height, + width, + 1, + gUnknown_0203CD9E); + FillBgTilemapBufferRect(bg, + gUnknown_0203CD9C + 8, + tilemapLeft + width, + tilemapTop + height, + 1, + 1, + gUnknown_0203CD9E); +} + +void sub_8198070(u8 windowId, bool8 copyToVram) +{ + CallWindowFunction(windowId, sub_81980A8); + FillWindowPixelBuffer(windowId, 0); + ClearWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void sub_81980A8(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + FillBgTilemapBufferRect(bg, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0); +} + +u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile) +{ + struct WindowTemplate window; + memset(&window, 0, sizeof(window)); + + if (bg > 3) + window.priority = 0; + else + window.priority = bg; + + window.tilemapTop = yPos; + window.height = 2; + window.tilemapLeft = 0x1E - xPos; + window.width = xPos; + window.paletteNum = palette; + window.baseBlock = baseTile; + + gUnknown_0203CDA0 = AddWindow(&window); + + if (palette > 15) + palette = 15 * 16; + else + palette *= 16; + + LoadPalette(gUnknown_0860F0B0, palette, sizeof(gUnknown_0860F0B0)); + return gUnknown_0203CDA0; +} + +void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram) +{ + u16 width = 0; + + if (gUnknown_0203CDA0 != 0xFF) + { + PutWindowTilemap(gUnknown_0203CDA0); + FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF); + width = GetStringWidth(0, string, 0); + box_print(gUnknown_0203CDA0, + 0, + 0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a2 - width, + 1, + gUnknown_0860F0D0, + 0, + string); + if (copyToVram) + CopyWindowToVram(gUnknown_0203CDA0, 3); + } +} + +void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram) +{ + struct TextColor color; + u16 width = 0; + + if (gUnknown_0203CDA0 != 0xFF) + { + if (a3 != 0) + { + color.fgColor = 0; + color.bgColor = 1; + color.shadowColor = 2; + } + else + { + color.fgColor = 15; + color.bgColor = 1; + color.shadowColor = 2; + } + PutWindowTilemap(gUnknown_0203CDA0); + FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF); + if (string2 != NULL) + { + width = GetStringWidth(0, string2, 0); + box_print(gUnknown_0203CDA0, + 0, + 0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a4 - width, + 1, + &color, + 0, + string2); + } + AddTextPrinterParameterized2(gUnknown_0203CDA0, 1, 4, 1, 0, 0, &color, 0, string); + if (copyToVram) + CopyWindowToVram(gUnknown_0203CDA0, 3); + } +} + +void sub_81982D8(void) +{ + if (gUnknown_0203CDA0 != 0xFF) + CopyWindowToVram(gUnknown_0203CDA0, 3); +} + +void sub_81982F0(void) +{ + if (gUnknown_0203CDA0 != 0xFF) + { + FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF); + CopyWindowToVram(gUnknown_0203CDA0, 3); + } +} + +void sub_8198314(void) +{ + if (gUnknown_0203CDA0 != 0xFF) + { + FillWindowPixelBuffer(gUnknown_0203CDA0, 0); + ClearWindowTilemap(gUnknown_0203CDA0); + CopyWindowToVram(gUnknown_0203CDA0, 3); + RemoveWindow(gUnknown_0203CDA0); + gUnknown_0203CDA0 = 0xFF; + } +} + +u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 cursorPos, u8 a7) +{ + s32 pos; + + gUnknown_0203CD90.left = left; + gUnknown_0203CD90.top = top; + gUnknown_0203CD90.minCursorPos = 0; + gUnknown_0203CD90.maxCursorPos = numChoices - 1; + gUnknown_0203CD90.windowId = windowId; + gUnknown_0203CD90.fontId = fontId; + gUnknown_0203CD90.cursorHeight = cursorHeight; + gUnknown_0203CD90.menu_field_B = a7; + + pos = cursorPos; + + if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos) + gUnknown_0203CD90.cursorPos = 0; + else + gUnknown_0203CD90.cursorPos = pos; + + MoveMenuCursor(0); + return gUnknown_0203CD90.cursorPos; +} + +u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 cursorPos) +{ + return sub_8198348(windowId, fontId, left, top, cursorHeight, numChoices, cursorPos, 0); +} + +u8 sub_81983EC(u8 windowId, u8 fontId, u8 left, u8 top, u8 numChoices, u8 cursorPos) +{ + return sub_81983AC(windowId, fontId, left, top, GetMenuCursorDimensionByFont(fontId, 1), numChoices, cursorPos); +} + +void RedrawMenuCursor(u8 oldPos, u8 newPos) +{ + u8 width, height; + + width = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 0); + height = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 1); + FillWindowPixelRect(gUnknown_0203CD90.windowId, 0x11, gUnknown_0203CD90.left, gUnknown_0203CD90.cursorHeight * oldPos + gUnknown_0203CD90.top, width, height); + PrintTextOnWindow(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.cursorHeight * newPos + gUnknown_0203CD90.top, 0, 0); +} + +u8 MoveMenuCursor(s8 cursorDelta) +{ + u8 oldPos = gUnknown_0203CD90.cursorPos; + int newPos = gUnknown_0203CD90.cursorPos + cursorDelta; + + if (newPos < gUnknown_0203CD90.minCursorPos) + gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.maxCursorPos; + else if (newPos > gUnknown_0203CD90.maxCursorPos) + gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.minCursorPos; + else + gUnknown_0203CD90.cursorPos += cursorDelta; + + RedrawMenuCursor(oldPos, gUnknown_0203CD90.cursorPos); + return gUnknown_0203CD90.cursorPos; +} + +u8 MoveMenuCursorNoWrapAround(s8 cursorDelta) +{ + u8 oldPos = gUnknown_0203CD90.cursorPos; + int newPos = gUnknown_0203CD90.cursorPos + cursorDelta; + + if (newPos < gUnknown_0203CD90.minCursorPos) + gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.minCursorPos; + else if (newPos > gUnknown_0203CD90.maxCursorPos) + gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.maxCursorPos; + else + gUnknown_0203CD90.cursorPos += cursorDelta; + + RedrawMenuCursor(oldPos, gUnknown_0203CD90.cursorPos); + return gUnknown_0203CD90.cursorPos; +} + +u8 GetMenuCursorPos(void) +{ + return gUnknown_0203CD90.cursorPos; +} + +s8 ProcessMenuInput(void) +{ + if (gMain.newKeys & A_BUTTON) + { + if (!gUnknown_0203CD90.menu_field_B) + PlaySE(SE_SELECT); + return gUnknown_0203CD90.cursorPos; + } + + if (gMain.newKeys & B_BUTTON) + { + return -1; + } + + if (gMain.newKeys & DPAD_UP) + { + PlaySE(SE_SELECT); + MoveMenuCursor(-1); + return -2; + } + else if (gMain.newKeys & DPAD_DOWN) + { + PlaySE(SE_SELECT); + MoveMenuCursor(1); + return -2; + } + + return -2; +} + +s8 ProcessMenuInputNoWrapAround(void) +{ + u8 oldPos = gUnknown_0203CD90.cursorPos; + + if (gMain.newKeys & A_BUTTON) + { + if (!gUnknown_0203CD90.menu_field_B) + PlaySE(SE_SELECT); + return gUnknown_0203CD90.cursorPos; + } + + if (gMain.newKeys & B_BUTTON) + { + return -1; + } + + if (gMain.newKeys & DPAD_UP) + { + if (oldPos != MoveMenuCursorNoWrapAround(-1)) + PlaySE(SE_SELECT); + return -2; + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (oldPos != MoveMenuCursorNoWrapAround(1)) + PlaySE(SE_SELECT); + return -2; + } + + return -2; +} + +s8 ProcessMenuInput_other(void) +{ + if (gMain.newKeys & A_BUTTON) + { + if (!gUnknown_0203CD90.menu_field_B) + PlaySE(SE_SELECT); + return gUnknown_0203CD90.cursorPos; + } + + if (gMain.newKeys & B_BUTTON) + { + return -1; + } + + if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + { + PlaySE(SE_SELECT); + MoveMenuCursor(-1); + return -2; + } + else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + { + PlaySE(SE_SELECT); + MoveMenuCursor(1); + return -2; + } + + return -2; +} + +s8 ProcessMenuInputNoWrapAround_other(void) +{ + u8 oldPos = gUnknown_0203CD90.cursorPos; + + if (gMain.newKeys & A_BUTTON) + { + if (!gUnknown_0203CD90.menu_field_B) + PlaySE(SE_SELECT); + return gUnknown_0203CD90.cursorPos; + } + + if (gMain.newKeys & B_BUTTON) + { + return -1; + } + + if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) + { + if (oldPos != MoveMenuCursorNoWrapAround(-1)) + PlaySE(SE_SELECT); + return -2; + } + else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) + { + if (oldPos != MoveMenuCursorNoWrapAround(1)) + PlaySE(SE_SELECT); + return -2; + } + + return -2; +} + +void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs) +{ + u8 i; + for (i = 0; i < itemCount; i++) + { + PrintTextOnWindow(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL); + } + CopyWindowToVram(windowId, 2); +} + +void sub_81987BC(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, u8 a6, u8 a7) +{ + u8 i; + for (i = 0; i < itemCount; i++) + { + sub_8199F74(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL, a6, a7); + } + CopyWindowToVram(windowId, 2); +} + +void sub_8198854(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs) +{ + PrintTextArray(windowId, fontId, GetFontAttribute(fontId, 0), 1, lineHeight, itemCount, strs); +} + +void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8) +{ + u8 i; + struct TextSubPrinter printer; + + printer.windowId = windowId; + printer.fontId = fontId; + printer.fgColor = GetFontAttribute(fontId, 5); + printer.bgColor = GetFontAttribute(fontId, 6); + printer.shadowColor = GetFontAttribute(fontId, 7); + printer.fontColor_l = GetFontAttribute(fontId, 4); + printer.letterSpacing = letterSpacing; + printer.lineSpacing = GetFontAttribute(fontId, 3); + printer.x = left; + printer.currentX = left; + + for (i = 0; i < itemCount; i++) + { + printer.current_text_offset = strs[a8[i]].text; + printer.y = (lineHeight * i) + top; + printer.currentY = printer.y; + AddTextPrinter(&printer, 0xFF, 0); + } + + CopyWindowToVram(windowId, 2); +} + +void sub_81989B8(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a5) +{ + AddItemMenuActionTextPrinters(windowId, fontId, GetFontAttribute(fontId, 0), 1, GetFontAttribute(fontId, 2), lineHeight, itemCount, strs, a5); +} + +void SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) +{ + template->priority = bg; + template->tilemapLeft = left; + template->tilemapTop = top; + template->width = width; + template->height = height; + template->paletteNum = paletteNum; + template->baseBlock = baseBlock; +} + +struct WindowTemplate sub_8198A50(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) +{ + struct WindowTemplate template; + SetWindowTemplateFields(&template, bg, left, top, width, height, paletteNum, baseBlock); + return template; +} + +u16 sub_8198AA4(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) +{ + struct WindowTemplate template; + SetWindowTemplateFields(&template, bg, left, top, width, height, paletteNum, baseBlock); + return AddWindow(&template); +} + +void sub_8198AF8(struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 cursorPos) +{ + struct TextSubPrinter printer; + + gUnknown_0203CD9F = AddWindow(window); + SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum); + + printer.current_text_offset = gText_YesNo; + printer.windowId = gUnknown_0203CD9F; + printer.fontId = fontId; + printer.x = GetFontAttribute(fontId, 0) + left; + printer.y = top; + printer.currentX = printer.x; + printer.currentY = printer.y; + printer.fgColor = GetFontAttribute(fontId, 5); + printer.bgColor = GetFontAttribute(fontId, 6); + printer.shadowColor = GetFontAttribute(fontId, 7); + printer.fontColor_l = GetFontAttribute(fontId, 4); + printer.letterSpacing = GetFontAttribute(fontId, 2); + printer.lineSpacing = GetFontAttribute(fontId, 3); + + AddTextPrinter(&printer, 0xFF, 0); + + sub_81983AC(gUnknown_0203CD9F, fontId, left, top, GetFontAttribute(fontId, 1), 2, cursorPos); +} + +void sub_8198C34(struct WindowTemplate *window, u8 fontId, u16 baseTileNum, u8 paletteNum) +{ + sub_8198AF8(window, fontId, 0, 1, baseTileNum, paletteNum, 0); +} + +s8 ProcessMenuInputNoWrap_(void) +{ + s8 result = ProcessMenuInputNoWrapAround(); + if (result != -2) + sub_8198C78(); + return result; +} + +void sub_8198C78(void) +{ + sub_8198070(gUnknown_0203CD9F, TRUE); + RemoveWindow(gUnknown_0203CD9F); +} + +void sub_8198C94(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 a7, const struct MenuAction *strs) +{ + u8 i; + u8 j; + for (i = 0; i < a7; i++) + { + for (j = 0; j < a6; j++) + { + PrintTextOnWindow(windowId, fontId, strs[(i * a6) + j].text, (a4 * j) + left, (a5 * i) + top, 0xFF, NULL); + } + } + CopyWindowToVram(windowId, 2); +} + +void sub_8198D54(u8 windowId, u8 fontId, u8 a2, u8 a3, u8 a4, u8 a5, const struct MenuAction *strs) +{ + sub_8198C94(windowId, fontId, GetFontAttribute(fontId, 0), 0, a2, a3, a4, a5, strs); +} + +void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *strs, const u8 *a8) +{ + u8 i; + u8 j; + struct TextSubPrinter printer; + + printer.windowId = windowId; + printer.fontId = fontId; + printer.fgColor = GetFontAttribute(fontId, 5); + printer.bgColor = GetFontAttribute(fontId, 6); + printer.shadowColor = GetFontAttribute(fontId, 7); + printer.fontColor_l = GetFontAttribute(fontId, 4); + printer.letterSpacing = GetFontAttribute(fontId, 2); + printer.lineSpacing = GetFontAttribute(fontId, 3); + + for (i = 0; i < itemCount2; i++) + { + for (j = 0; j < itemCount; j++) + { + printer.current_text_offset = strs[a8[(itemCount * i) + j]].text; + printer.x = (a4 * j) + left; + printer.y = (GetFontAttribute(fontId, 1) * i) + top; + printer.currentX = printer.x; + printer.currentY = printer.y; + AddTextPrinter(&printer, 0xFF, 0); + } + } + + CopyWindowToVram(windowId, 2); +} + +void sub_8198EF8(u8 windowId, u8 fontId, u8 a2, u8 a3, u8 a4, u8 a5, const struct MenuAction *strs, const u8 *a8) +{ + sub_8198DBC(windowId, fontId, GetFontAttribute(fontId, 0), 0, a2, a4, a5, strs, a8); +} + +u8 sub_8198F58(u8 a0, u8 a1, s8 a2, s8 a3, u8 a4, u8 a5, u8 a6, u8 a7, u8 a8, u8 a9) +{ + s32 pos; + + gUnknown_0203CD90.left = a2; + gUnknown_0203CD90.top = a3; + gUnknown_0203CD90.minCursorPos = 0; + gUnknown_0203CD90.maxCursorPos = a8 - 1; + gUnknown_0203CD90.windowId = a0; + gUnknown_0203CD90.fontId = a1; + gUnknown_0203CD90.menu_field_7 = a4; + gUnknown_0203CD90.cursorHeight = a5; + gUnknown_0203CD90.menu_field_9 = a6; + gUnknown_0203CD90.menu_field_A = a7; + + pos = a9; + + if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos) + gUnknown_0203CD90.cursorPos = 0; + else + gUnknown_0203CD90.cursorPos = pos; + + sub_8199134(0, 0); + return gUnknown_0203CD90.cursorPos; +} diff --git a/src/new_menu_helpers.c b/src/new_menu_helpers.c index baa053a22..a4aad4058 100644 --- a/src/new_menu_helpers.c +++ b/src/new_menu_helpers.c @@ -13,17 +13,23 @@ #define DLG_WINDOW_PALETTE_NUM 15 #define DLG_WINDOW_BASE_TILE_NUM 0x200 -extern EWRAM_DATA u8 gUnknown_0203CD8C; -extern EWRAM_DATA u8 gUnknown_0203CD8D; +static EWRAM_DATA u8 gUnknown_0203CD8C = 0; +static EWRAM_DATA u8 gUnknown_0203CD8D = 0; -extern const u8 gUnknown_0860EA6C[]; -extern const u16 gUnknown_0860EA4C[]; -extern const u16 gUnknown_0860F074[]; -extern const u8 gUnknown_0860F094[]; -extern const struct WindowTemplate gUnknown_0860F098[]; -extern const struct WindowTemplate gUnknown_0860F0A8; +const u16 gUnknown_0860F074[] = INCBIN_U16("graphics/interface/860F074.gbapal"); +static const u8 gUnknown_0860F094[] = { 8, 4, 1 }; + +static const struct WindowTemplate gUnknown_0860F098[] = +{ + { 0x00, 0x02, 0x0F, 0x1B, 0x04, 0x0F, 0x194 }, + DUMMY_WIN_TEMPLATE +}; + +static const struct WindowTemplate gUnknown_0860F0A8 = +{ + 0x00, 0x15, 0x09, 0x05, 0x04, 0x0F, 0x125 +}; -extern void sub_819645C(void); // Forward declarations extern void sub_81973A4(void); extern void DrawStandardFrame(u8, u8, u8, u8, u8, u8); @@ -31,17 +37,6 @@ extern void DrawDialogueFrame(u8, u8, u8, u8, u8, u8); extern void sub_81977BC(u8, u8, u8, u8, u8, u8); extern void sub_8197804(u8, u8, u8, u8, u8, u8); -void sub_8197184(u8 window, u32 destTile, u32 destPalette) -{ - LoadBgTiles(GetWindowAttribute(window, WINDOW_PRIORITY), gUnknown_0860EA6C, 0x100, destTile); - LoadPalette(gUnknown_0860EA4C, destPalette * 16, 32); -} - -void sub_81971C4(void) -{ - sub_819645C(); -} - void sub_81971D0(void) { InitWindows(gUnknown_0860F098); diff --git a/sym_ewram.txt b/sym_ewram.txt index c04f524d8..4765f6730 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1340,12 +1340,9 @@ gUnknown_0203CD80: @ 203CD80 gUnknown_0203CD88: @ 203CD88 .space 0x4 -gUnknown_0203CD8C: @ 203CD8C - .space 0x1 - -gUnknown_0203CD8D: @ 203CD8D - .space 0x3 + .include "src/new_menu_helpers.o" + .align 2 gUnknown_0203CD90: @ 203CD90 .space 0xC