From ba3247d5cd27070c51e28437e8880dec72d973b5 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Sat, 20 Oct 2018 20:25:28 -0400 Subject: [PATCH] decompiled more, stuck on sub_81B1760 --- asm/party_menu.s | 121 ---------------------------------------- include/party_menu.h | 2 +- include/strings.h | 1 + src/fldeff_softboiled.c | 2 +- src/party_menu.c | 104 ++++++++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 123 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index e5540e171..399a9f215 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,127 +5,6 @@ .text - thumb_func_start sub_81B1660 -sub_81B1660: @ 81B1660 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - movs r1, 0xF - ands r1, r0 - cmp r1, 0x2 - bne _081B1680 - ldr r5, =gText_CancelParticipation - b _081B168A - .pool -_081B1680: - cmp r1, 0x4 - bne _081B168A - bl sub_81B88BC - adds r5, r0, 0 -_081B168A: - cmp r5, 0 - beq _081B16CC - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - ldr r4, =gStringVar4 - adds r0, r4, 0 - adds r1, r5, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B16D4 - str r1, [r0] - movs r0, 0x1 - b _081B16CE - .pool -_081B16CC: - movs r0, 0 -_081B16CE: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81B1660 - - thumb_func_start sub_81B16D4 -sub_81B16D4: @ 81B16D4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B16F8 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1708 - str r0, [r1] -_081B16F8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B16D4 - - thumb_func_start sub_81B1708 -sub_81B1708: @ 81B1708 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B172E - cmp r1, 0 - bgt _081B1728 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B174C - b _081B1758 -_081B1728: - cmp r1, 0x1 - beq _081B1752 - b _081B1758 -_081B172E: - ldr r0, =gUnknown_0203CEE8 - strb r1, [r0] - ldr r1, =gUnknown_0203CEC8 - movs r0, 0x7 - strb r0, [r1, 0x9] - bl sub_81B8558 - adds r0, r4, 0 - bl sub_81B12C0 - b _081B1758 - .pool -_081B174C: - movs r0, 0x5 - bl PlaySE -_081B1752: - adds r0, r4, 0 - bl sub_81B1C1C -_081B1758: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B1708 - thumb_func_start sub_81B1760 sub_81B1760: @ 81B1760 push {r4,lr} diff --git a/include/party_menu.h b/include/party_menu.h index bf0db514b..f2615dac5 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -55,7 +55,7 @@ void sub_81B0FCC(u8 partyIdx, u8 a); void sub_81B1370(u8 taskId); void display_pokemon_menu_message(u32 windowId); void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); -void sub_81B1B5C(void *a, u8 b); +u8 sub_81B1B5C(const u8 *a, u8 b); u8 sub_81B1BD4(void); void sub_81B8448(void); void sub_81B8518(u8 unused); diff --git a/include/strings.h b/include/strings.h index 4ea33635b..31b8f399d 100644 --- a/include/strings.h +++ b/include/strings.h @@ -369,6 +369,7 @@ extern const u8 gText_ThreeDashes[]; // party menu text extern const u8 gText_PkmnHPRestoredByVar2[]; extern const u8 gText_CantBeUsedOnPkmn[]; +extern const u8 gText_CancelParticipation[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/src/fldeff_softboiled.c b/src/fldeff_softboiled.c index d0a40a9a9..3b2d4988f 100644 --- a/src/fldeff_softboiled.c +++ b/src/fldeff_softboiled.c @@ -103,7 +103,7 @@ static void sub_8161784(u8 taskId) static void sub_81617B8(u8 taskId) { PlaySE(SE_SELECT); - sub_81B1B5C(&gText_CantBeUsedOnPkmn, 0); + sub_81B1B5C(gText_CantBeUsedOnPkmn, 0); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_8161784; } diff --git a/src/party_menu.c b/src/party_menu.c index c15f0d59c..07519d648 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -25,6 +25,7 @@ #include "sound.h" #include "sprite.h" #include "string_util.h" +#include "strings.h" #include "task.h" #include "text.h" #include "window.h" @@ -173,6 +174,15 @@ void sub_81B36FC(u8); void sub_81B407C(u8); void sub_81B2210(u8); bool8 sub_81B1660(u8); +const u8* sub_81B88BC(void); +u8 sub_81B1B5C(const u8*, u8); +void sub_81B16D4(u8); +void sub_81B334C(void); +void sub_81B1708(u8); +bool8 sub_81B1BD4(void); +void sub_81B1C1C(u8); +void sub_81B8558(void); +void sub_81B17F8(s8*); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -1082,3 +1092,97 @@ void sub_81B15D0(u8 taskId, s8 *ptr) break; } } + +bool8 sub_81B1660(u8 taskId) +{ + const u8* stringPtr = NULL; + + if (gUnknown_0203CEC8.unk8_0 == 2) + stringPtr = gText_CancelParticipation; + else if (gUnknown_0203CEC8.unk8_0 == 4) + stringPtr = sub_81B88BC(); + + if (stringPtr == NULL) + return FALSE; + + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + StringExpandPlaceholders(gStringVar4, stringPtr); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B16D4; + return TRUE; +} + +void sub_81B16D4(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B1708; + } +} + +void sub_81B1708(u8 taskId) +{ + switch (Menu_ProcessInputNoWrap_()) + { + case 0: + gUnknown_0203CEE8 = 0; + gUnknown_0203CEC8.unk9 = 7; + sub_81B8558(); + sub_81B12C0(taskId); + break; + case -1: + PlaySE(SE_SELECT); + case 1: + sub_81B1C1C(taskId); + break; + } +} + +/* u16 sub_81B1760(s8* ptr) +{ + s8 r1; + + switch (gMain.newAndRepeatedKeys) + { + case DPAD_UP: + r1 = -1; + break; + case DPAD_DOWN: + r1 = 1; + break; + case DPAD_LEFT: + r1 = -2; + break; + case DPAD_RIGHT: + r1 = 2; + break; + default: + switch (sub_812210C()) + { + case 1: + r1 = -1; + break; + case 2: + r1 = 1; + break; + default: + r1 = 0; + break; + } + } + + if (gMain.newKeys & START_BUTTON) + return 8; + + if ((s8)r1) + { + sub_81B17F8(ptr); + return 0; + } + + if ((gMain.newKeys & A_BUTTON) && *ptr == 7) + return 2; + + return gMain.newKeys & (A_BUTTON | B_BUTTON); +} */