diff --git a/.gitignore b/.gitignore index dc782899dd..1b72e0c77e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ Thumbs.db build/ .DS_Store *.ddump +.idea/ diff --git a/asm/dodrio_berry_picking.s b/asm/dodrio_berry_picking.s index 296f8b0062..e833b16401 100755 --- a/asm/dodrio_berry_picking.s +++ b/asm/dodrio_berry_picking.s @@ -5,393 +5,6 @@ .text - thumb_func_start sub_8026324 -sub_8026324: @ 8026324 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x44 - ldrb r0, [r0] - str r0, [sp] - adds r0, r1, 0 - adds r0, 0x48 - ldrb r0, [r0] - str r0, [sp, 0x4] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - str r0, [sp, 0x8] - adds r0, r1, 0 - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bls _08026358 - b _08026614 -_08026358: - movs r6, 0 - ldr r0, [sp, 0x8] - cmp r6, r0 - bcs _08026440 -_08026360: - ldr r3, =gUnknown_02022C98 - lsls r0, r6, 4 - subs r1, r0, r6 - lsls r1, 2 - ldr r2, [r3] - adds r1, r2 - ldr r4, =0x000031cc - adds r4, r1 - mov r8, r4 - ldrb r1, [r4] - mov r9, r0 - adds r0, r6, 0x1 - str r0, [sp, 0xC] - cmp r1, 0 - beq _08026434 - adds r0, r2, 0 - adds r0, 0xA8 - adds r0, r6 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08026434 - ldr r1, [sp] - mov r10, r1 - ldr r2, [sp, 0x4] - cmp r10, r2 - bcs _08026434 - adds r7, r3, 0 -_08026396: - ldr r0, =gUnknown_082F449C - add r0, r10 - ldrb r5, [r0] - ldr r1, [r7] - lsls r4, r5, 1 - adds r0, r1, 0 - adds r0, 0xF4 - adds r0, r4 - ldrb r0, [r0] - cmp r0, r6 - beq _08026434 - adds r0, r1, 0 - adds r0, 0xF5 - adds r0, r4 - ldrb r0, [r0] - cmp r0, r6 - beq _08026434 - mov r0, r8 - ldrb r1, [r0] - adds r0, r6, 0 - adds r2, r5, 0 - bl sub_8026634 - cmp r0, 0x1 - bne _08026410 - movs r2, 0 - ldr r3, =gUnknown_02022C98 - mov r8, r4 -_080263CE: - ldr r0, [r3] - mov r4, r8 - adds r1, r2, r4 - adds r0, 0xF4 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0xFF - bne _08026404 - strb r6, [r1] - ldr r0, [r3] - adds r0, 0xA8 - adds r0, r6 - movs r1, 0x2 - strb r1, [r0] - ldr r0, [r3] - adds r0, 0xC4 - adds r0, r5 - movs r1, 0x1 - strb r1, [r0] - b _08026434 - .pool -_08026404: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1 - bls _080263CE - b _08026434 -_08026410: - ldr r0, [r7] - mov r2, r9 - subs r1, r2, r6 - lsls r1, 2 - adds r0, r1 - ldr r4, =0x000031d4 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08026434 - mov r0, r10 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, [sp, 0x4] - cmp r10, r0 - bcc _08026396 -_08026434: - ldr r1, [sp, 0xC] - lsls r0, r1, 24 - lsrs r6, r0, 24 - ldr r2, [sp, 0x8] - cmp r6, r2 - bcc _08026360 -_08026440: - ldr r4, [sp] - mov r10, r4 - ldr r0, [sp, 0x4] - cmp r10, r0 - bcc _0802644C - b _08026614 -_0802644C: - ldr r1, =gUnknown_02022C98 - mov r9, r1 -_08026450: - movs r6, 0xFF - ldr r0, =gUnknown_082F449C - add r0, r10 - ldrb r5, [r0] - mov r2, r9 - ldr r0, [r2] - adds r0, 0xC4 - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08026468 - b _08026602 -_08026468: - adds r0, r5, 0 - bl sub_8026D8C - mov r1, r9 - ldr r4, [r1] - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - adds r1, 0x90 - adds r1, r0 - ldrb r0, [r1] - movs r1, 0x7 - bl __udivsi3 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _0802648E - movs r3, 0x2 -_0802648E: - ldr r2, =gUnknown_082F7A88 - ldr r0, =0x000031b4 - adds r1, r4, r0 - adds r1, r5 - lsls r0, r3, 1 - adds r0, r3 - ldrb r1, [r1] - adds r0, r1 - adds r0, r2 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0xD0 - adds r0, r5 - ldrb r0, [r0] - subs r2, r1, r0 - cmp r2, 0x5 - bgt _080264BC - adds r1, r4, 0 - adds r1, 0x9C - adds r1, r5 - ldrb r0, [r1] - adds r0, r2 - strb r0, [r1] -_080264BC: - mov r2, r9 - ldr r1, [r2] - adds r1, 0x9C - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - movs r4, 0xFF - ands r0, r4 - cmp r0, 0x5 - bhi _080264D6 - b _08026602 -_080264D6: - mov r1, r9 - ldr r0, [r1] - adds r0, 0x9C - adds r0, r5 - strb r2, [r0] - ldr r3, [r1] - lsls r1, r5, 1 - adds r0, r3, 0 - adds r0, 0xF4 - adds r2, r0, r1 - ldrb r0, [r2] - mov r8, r1 - cmp r0, 0xFF - bne _08026518 - adds r0, r3, 0 - adds r0, 0xF5 - add r0, r8 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08026500 - b _08026602 -_08026500: - b _08026528 - .pool -_08026518: - adds r0, r3, 0 - adds r0, 0xF5 - add r0, r8 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08026528 - ldrb r4, [r2] - b _0802654E -_08026528: - mov r2, r9 - ldr r1, [r2] - adds r0, r1, 0 - adds r0, 0xF4 - add r0, r8 - ldrb r7, [r0] - adds r1, 0xF5 - add r1, r8 - ldrb r6, [r1] - bl Random - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - bne _0802654A - adds r4, r7, 0 - b _0802654E -_0802654A: - adds r4, r6, 0 - adds r6, r7, 0 -_0802654E: - mov r1, r9 - ldr r0, [r1] - ldr r2, =0x000032eb - adds r0, r2 - adds r0, r5 - movs r1, 0x7 - strb r1, [r0] - mov r1, r9 - ldr r0, [r1] - adds r0, 0xC4 - adds r0, r5 - movs r1, 0x2 - strb r1, [r0] - mov r2, r9 - ldr r0, [r2] - adds r0, 0xA8 - adds r0, r4 - movs r1, 0x3 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0xB8 - adds r0, r5 - strb r4, [r0] - ldr r1, [r2] - lsls r0, r4, 4 - subs r0, r4 - lsls r0, 2 - adds r1, r0 - ldr r2, =0x000031d0 - adds r1, r2 - movs r0, 0x1 - strb r0, [r1] - mov r2, r9 - ldr r1, [r2] - lsls r0, r6, 4 - subs r0, r6 - lsls r0, 2 - adds r1, r0 - ldr r0, =0x000031d4 - adds r1, r0 - movs r2, 0x1 - strb r2, [r1] - mov r0, r9 - ldr r1, [r0] - lsls r0, r4, 1 - adds r1, 0x86 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_8026F1C - movs r0, 0x1 - bl sub_8027234 - adds r0, r4, 0 - bl sub_8026D1C - mov r1, r9 - ldr r0, [r1] - adds r1, r0, 0 - adds r1, 0xE8 - adds r1, r5 - ldr r2, =0x000032e0 - adds r0, r2 - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - mov r4, r9 - ldr r0, [r4] - adds r0, r2 - adds r0, r5 - movs r1, 0x3 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0xF4 - add r1, r8 - ldrb r0, [r1] - movs r2, 0xFF - orrs r0, r2 - strb r0, [r1] - ldr r1, [r4] - adds r1, 0xF5 - add r1, r8 - ldrb r0, [r1] - orrs r0, r2 - strb r0, [r1] -_08026602: - mov r0, r10 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r4, [sp, 0x4] - cmp r10, r4 - bcs _08026614 - b _08026450 -_08026614: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026324 - thumb_func_start sub_8026634 sub_8026634: @ 8026634 push {r4-r7,lr} diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 1e698fefbb..1531eb4d87 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -4,6 +4,7 @@ #include "window.h" #include "bg.h" #include "gpu_regs.h" +#include "random.h" #include "link.h" #include "link_rfu.h" #include "task.h" @@ -85,19 +86,25 @@ struct DodrioBerryPickingStruct /*0x0048*/ u8 unk_0048; // align 1 /*0x004A*/ u16 unk_004A[5][6]; - /*0x0086*/ u8 filler_0086[18]; + /*0x0086*/ u16 unk_0086[5]; + /*0x0090*/ u8 unk_0090[5]; + /*0x0095*/ u8 filler_0095[3]; /*0x0098*/ u8 unk_0098[4]; - /*0x009C*/ u8 filler_009C[12]; + /*0x009C*/ u8 unk_009C[12]; /*0x00A8*/ u8 unk_00A8[5]; /*0x00AD*/ u8 filler_00AD[3]; /*0x00B0*/ u8 unk_00B0[5]; - /*0x00B5*/ u8 filler_00B5[0xC4 - 0xB5]; + /*0x00B5*/ u8 filler_00B5[3]; + /*0x00B8*/ u8 unk_00B8[5]; + /*0x00BD*/ u8 filler_00BD[7]; /*0x00C4*/ u8 unk_00C4[11]; /*0x00CF*/ u8 filler_00CF[1]; /*0x00D0*/ u8 unk_00D0[11]; /*0x00DB*/ u8 filler_00DB[1]; /*0x00DC*/ u8 unk_00DC[11]; - /*0x00E7*/ u8 filler_0xE7[0xF4 - 0xE7]; + /*0x00E7*/ u8 filler_0xE7[1]; + /*0x00E8*/ u8 unk_00E8[5]; + /*0x00ED*/ u8 filler_00ED[7]; /*0x00F4*/ u8 unk_00F4[11][2]; /*0x010A*/ u8 filler_010A[2]; /*0x010C*/ u8 unk_010C[5]; @@ -170,6 +177,7 @@ void sub_802621C(TaskFunc); void sub_8026240(u8); bool32 sub_8026264(void); void sub_80262C0(void); +u32 sub_8026634(u8, u8, u8); void sub_802671C(void); void sub_8026AF4(void); void sub_8026B28(void); @@ -178,8 +186,12 @@ u32 sub_8026BB8(void); void sub_8026C28(void); bool32 sub_8026C50(void); bool32 sub_8026C90(void); -void sub_80272E8(void); +void sub_8026D1C(u8); +u8 sub_8026D8C(u8); +void sub_8026F1C(u8, u8, u8); +void sub_8027234(u8); void sub_80272A4(void); +void sub_80272E8(void); void sub_80273F0(void); void sub_802749C(void); u8 sub_8027518(u8); @@ -219,11 +231,12 @@ void sub_80292E0(u8); bool32 sub_802A770(void); u8 sub_802A794(void); +extern const u8 gUnknown_082F7A88[][3]; +extern const u8 gUnknown_082F449C[]; +extern const u8 gUnknown_082F7A94[]; extern void (*const gUnknown_082F7AC4[])(void); extern void (*const gUnknown_082F7AF4[])(void); -extern const u8 gUnknown_082F7A94[]; - void sub_802493C(u16 a0, void (*a1)(void)) { gUnknown_03000DB0 = FALSE; @@ -1396,3 +1409,508 @@ void sub_80262C0(void) r4[i] = 0; } } + +#ifdef NONMATCHING +void sub_8026324(void) +{ + u8 sp0 = gUnknown_02022C98->unk_0044; + u8 sp4 = gUnknown_02022C98->unk_0048; + u8 sp8 = gUnknown_02022C98->unk_0024; + u8 r6; + u8 r10; + u8 r2; + u8 r5; + u8 r3; + s32 r2_2; + u8 r4; + u8 r7, r7_2; + + if (gUnknown_02022C98->unk_0040 < 10) + { + for (r6 = 0; r6 < sp8; r6++) + { + if ( gUnknown_02022C98->unk_31A0[r6].unk_2C != 0 + && gUnknown_02022C98->unk_00A8[r6] == 1) + { + for (r10 = sp0; r10 < sp4; r10++) + { + r5 = gUnknown_082F449C[r10]; + if (gUnknown_02022C98->unk_00F4[r5][0] == r6) + { + break; + } + if (gUnknown_02022C98->unk_00F4[r5][1] == r6) + { + break; + } + if (sub_8026634(gUnknown_02022C98->unk_31A0[r6].unk_2C, r6, gUnknown_082F449C[r10]) == 1) + { + for (r2 = 0; r2 < 2; r2++) + { + if (gUnknown_02022C98->unk_00F4[r5][r2] == 0xFF) + { + gUnknown_02022C98->unk_00F4[r5][r2] = r6; + gUnknown_02022C98->unk_00A8[r6] = 2; + gUnknown_02022C98->unk_00C4[r5] = 1; + break; + } + } + break; + } + if (gUnknown_02022C98->unk_31A0[r6].unk_34 == 1) + { + break; + } + } + } + } + for (r10 = sp0; r10 < sp4; r10++) + { + r6 = 0xFF; + r5 = gUnknown_082F449C[r10]; + if (gUnknown_02022C98->unk_00C4[r5] == 1) + { + r3 = gUnknown_02022C98->unk_0090[sub_8026D8C(r5)] / 7; + if (r3 < 2) + { + r3 = 2; + } + r2 = gUnknown_082F7A88[r3][gUnknown_02022C98->unk_31A0[0].unk_14[r5]] - gUnknown_02022C98->unk_00D0[r5]; + if (r2 < 6) + { + gUnknown_02022C98->unk_009C[r5] += r2; + } + if (++gUnknown_02022C98->unk_009C[r5] < 6) + { + gUnknown_02022C98->unk_009C[r5] = 0; + if (gUnknown_02022C98->unk_00F4[r5][0] != 0xFF && gUnknown_02022C98->unk_00F4[r5][1] == 0xFF) + { + r4 = gUnknown_02022C98->unk_00F4[r5][0]; + } + else if (gUnknown_02022C98->unk_00F4[r5][0] == 0xFF && gUnknown_02022C98->unk_00F4[r5][1] == 0xFF) + { + continue; + } + else + { + r7 = gUnknown_02022C98->unk_00F4[r5][0]; + r7_2 = gUnknown_02022C98->unk_00F4[r5][1]; + if ((Random() & 1)) + { + r4 = r7_2; + r6 = r7; + } + else + { + r4 = r7; + r6 = r7_2; + } + } + gUnknown_02022C98->unk_32CC.unk_1F[r5] = 7; + gUnknown_02022C98->unk_00C4[r5] = 2; + gUnknown_02022C98->unk_00A8[r4] = 3; + gUnknown_02022C98->unk_00B8[r5] = r4; + gUnknown_02022C98->unk_31A0[r4].unk_30 = 1; + gUnknown_02022C98->unk_31A0[r6].unk_34 = 1; + gUnknown_02022C98->unk_0086[r4]++; + sub_8026F1C(0, r5, r4); + sub_8027234(1); + sub_8026D1C(r4); + gUnknown_02022C98->unk_00E8[r5] = gUnknown_02022C98->unk_32CC.unk_14[r5]; + gUnknown_02022C98->unk_32CC.unk_14[r5] = 3; + gUnknown_02022C98->unk_00F4[r5][0] = 0xFF; + gUnknown_02022C98->unk_00F4[r5][1] = 0xFF; + } + } + } + } +} +#else +NAKED +void sub_8026324(void) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tsub sp, 0x10\n" + "\tldr r0, =gUnknown_02022C98\n" + "\tldr r1, [r0]\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0x44\n" + "\tldrb r0, [r0]\n" + "\tstr r0, [sp]\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0x48\n" + "\tldrb r0, [r0]\n" + "\tstr r0, [sp, 0x4]\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0x24\n" + "\tldrb r0, [r0]\n" + "\tstr r0, [sp, 0x8]\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0x40\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0x9\n" + "\tbls _08026358\n" + "\tb _08026614\n" + "_08026358:\n" + "\tmovs r6, 0\n" + "\tldr r0, [sp, 0x8]\n" + "\tcmp r6, r0\n" + "\tbcs _08026440\n" + "_08026360:\n" + "\tldr r3, =gUnknown_02022C98\n" + "\tlsls r0, r6, 4\n" + "\tsubs r1, r0, r6\n" + "\tlsls r1, 2\n" + "\tldr r2, [r3]\n" + "\tadds r1, r2\n" + "\tldr r4, =0x000031cc\n" + "\tadds r4, r1\n" + "\tmov r8, r4\n" + "\tldrb r1, [r4]\n" + "\tmov r9, r0\n" + "\tadds r0, r6, 0x1\n" + "\tstr r0, [sp, 0xC]\n" + "\tcmp r1, 0\n" + "\tbeq _08026434\n" + "\tadds r0, r2, 0\n" + "\tadds r0, 0xA8\n" + "\tadds r0, r6\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0x1\n" + "\tbne _08026434\n" + "\tldr r1, [sp]\n" + "\tmov r10, r1\n" + "\tldr r2, [sp, 0x4]\n" + "\tcmp r10, r2\n" + "\tbcs _08026434\n" + "\tadds r7, r3, 0\n" + "_08026396:\n" + "\tldr r0, =gUnknown_082F449C\n" + "\tadd r0, r10\n" + "\tldrb r5, [r0]\n" + "\tldr r1, [r7]\n" + "\tlsls r4, r5, 1\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0xF4\n" + "\tadds r0, r4\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, r6\n" + "\tbeq _08026434\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0xF5\n" + "\tadds r0, r4\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, r6\n" + "\tbeq _08026434\n" + "\tmov r0, r8\n" + "\tldrb r1, [r0]\n" + "\tadds r0, r6, 0\n" + "\tadds r2, r5, 0\n" + "\tbl sub_8026634\n" + "\tcmp r0, 0x1\n" + "\tbne _08026410\n" + "\tmovs r2, 0\n" + "\tldr r3, =gUnknown_02022C98\n" + "\tmov r8, r4\n" + "_080263CE:\n" + "\tldr r0, [r3]\n" + "\tmov r4, r8\n" + "\tadds r1, r2, r4\n" + "\tadds r0, 0xF4\n" + "\tadds r1, r0, r1\n" + "\tldrb r0, [r1]\n" + "\tcmp r0, 0xFF\n" + "\tbne _08026404\n" + "\tstrb r6, [r1]\n" + "\tldr r0, [r3]\n" + "\tadds r0, 0xA8\n" + "\tadds r0, r6\n" + "\tmovs r1, 0x2\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r3]\n" + "\tadds r0, 0xC4\n" + "\tadds r0, r5\n" + "\tmovs r1, 0x1\n" + "\tstrb r1, [r0]\n" + "\tb _08026434\n" + "\t.pool\n" + "_08026404:\n" + "\tadds r0, r2, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r2, r0, 24\n" + "\tcmp r2, 0x1\n" + "\tbls _080263CE\n" + "\tb _08026434\n" + "_08026410:\n" + "\tldr r0, [r7]\n" + "\tmov r2, r9\n" + "\tsubs r1, r2, r6\n" + "\tlsls r1, 2\n" + "\tadds r0, r1\n" + "\tldr r4, =0x000031d4\n" + "\tadds r0, r4\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0x1\n" + "\tbeq _08026434\n" + "\tmov r0, r10\n" + "\tadds r0, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r0, 24\n" + "\tmov r10, r0\n" + "\tldr r0, [sp, 0x4]\n" + "\tcmp r10, r0\n" + "\tbcc _08026396\n" + "_08026434:\n" + "\tldr r1, [sp, 0xC]\n" + "\tlsls r0, r1, 24\n" + "\tlsrs r6, r0, 24\n" + "\tldr r2, [sp, 0x8]\n" + "\tcmp r6, r2\n" + "\tbcc _08026360\n" + "_08026440:\n" + "\tldr r4, [sp]\n" + "\tmov r10, r4\n" + "\tldr r0, [sp, 0x4]\n" + "\tcmp r10, r0\n" + "\tbcc _0802644C\n" + "\tb _08026614\n" + "_0802644C:\n" + "\tldr r1, =gUnknown_02022C98\n" + "\tmov r9, r1\n" + "_08026450:\n" + "\tmovs r6, 0xFF\n" + "\tldr r0, =gUnknown_082F449C\n" + "\tadd r0, r10\n" + "\tldrb r5, [r0]\n" + "\tmov r2, r9\n" + "\tldr r0, [r2]\n" + "\tadds r0, 0xC4\n" + "\tadds r0, r5\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0x1\n" + "\tbeq _08026468\n" + "\tb _08026602\n" + "_08026468:\n" + "\tadds r0, r5, 0\n" + "\tbl sub_8026D8C\n" + "\tmov r1, r9\n" + "\tldr r4, [r1]\n" + "\tlsls r0, 24\n" + "\tlsrs r0, 24\n" + "\tadds r1, r4, 0\n" + "\tadds r1, 0x90\n" + "\tadds r1, r0\n" + "\tldrb r0, [r1]\n" + "\tmovs r1, 0x7\n" + "\tbl __udivsi3\n" + "\tlsls r0, 24\n" + "\tlsrs r3, r0, 24\n" + "\tcmp r3, 0x1\n" + "\tbls _0802648E\n" + "\tmovs r3, 0x2\n" + "_0802648E:\n" + "\tldr r2, =gUnknown_082F7A88\n" + "\tldr r0, =0x000031b4\n" + "\tadds r1, r4, r0\n" + "\tadds r1, r5\n" + "\tlsls r0, r3, 1\n" + "\tadds r0, r3\n" + "\tldrb r1, [r1]\n" + "\tadds r0, r1\n" + "\tadds r0, r2\n" + "\tldrb r1, [r0]\n" + "\tadds r0, r4, 0\n" + "\tadds r0, 0xD0\n" + "\tadds r0, r5\n" + "\tldrb r0, [r0]\n" + "\tsubs r2, r1, r0\n" + "\tcmp r2, 0x5\n" + "\tbgt _080264BC\n" + "\tadds r1, r4, 0\n" + "\tadds r1, 0x9C\n" + "\tadds r1, r5\n" + "\tldrb r0, [r1]\n" + "\tadds r0, r2\n" + "\tstrb r0, [r1]\n" + "_080264BC:\n" + "\tmov r2, r9\n" + "\tldr r1, [r2]\n" + "\tadds r1, 0x9C\n" + "\tadds r1, r5\n" + "\tldrb r0, [r1]\n" + "\tadds r0, 0x1\n" + "\tmovs r2, 0\n" + "\tstrb r0, [r1]\n" + "\tmovs r4, 0xFF\n" + "\tands r0, r4\n" + "\tcmp r0, 0x5\n" + "\tbhi _080264D6\n" + "\tb _08026602\n" + "_080264D6:\n" + "\tmov r1, r9\n" + "\tldr r0, [r1]\n" + "\tadds r0, 0x9C\n" + "\tadds r0, r5\n" + "\tstrb r2, [r0]\n" + "\tldr r3, [r1]\n" + "\tlsls r1, r5, 1\n" + "\tadds r0, r3, 0\n" + "\tadds r0, 0xF4\n" + "\tadds r2, r0, r1\n" + "\tldrb r0, [r2]\n" + "\tmov r8, r1\n" + "\tcmp r0, 0xFF\n" + "\tbne _08026518\n" + "\tadds r0, r3, 0\n" + "\tadds r0, 0xF5\n" + "\tadd r0, r8\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0xFF\n" + "\tbne _08026500\n" + "\tb _08026602\n" + "_08026500:\n" + "\tb _08026528\n" + "\t.pool\n" + "_08026518:\n" + "\tadds r0, r3, 0\n" + "\tadds r0, 0xF5\n" + "\tadd r0, r8\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0xFF\n" + "\tbne _08026528\n" + "\tldrb r4, [r2]\n" + "\tb _0802654E\n" + "_08026528:\n" + "\tmov r2, r9\n" + "\tldr r1, [r2]\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0xF4\n" + "\tadd r0, r8\n" + "\tldrb r7, [r0]\n" + "\tadds r1, 0xF5\n" + "\tadd r1, r8\n" + "\tldrb r6, [r1]\n" + "\tbl Random\n" + "\tmovs r1, 0x1\n" + "\tands r1, r0\n" + "\tcmp r1, 0\n" + "\tbne _0802654A\n" + "\tadds r4, r7, 0\n" + "\tb _0802654E\n" + "_0802654A:\n" + "\tadds r4, r6, 0\n" + "\tadds r6, r7, 0\n" + "_0802654E:\n" + "\tmov r1, r9\n" + "\tldr r0, [r1]\n" + "\tldr r2, =0x000032eb\n" + "\tadds r0, r2\n" + "\tadds r0, r5\n" + "\tmovs r1, 0x7\n" + "\tstrb r1, [r0]\n" + "\tmov r1, r9\n" + "\tldr r0, [r1]\n" + "\tadds r0, 0xC4\n" + "\tadds r0, r5\n" + "\tmovs r1, 0x2\n" + "\tstrb r1, [r0]\n" + "\tmov r2, r9\n" + "\tldr r0, [r2]\n" + "\tadds r0, 0xA8\n" + "\tadds r0, r4\n" + "\tmovs r1, 0x3\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r2]\n" + "\tadds r0, 0xB8\n" + "\tadds r0, r5\n" + "\tstrb r4, [r0]\n" + "\tldr r1, [r2]\n" + "\tlsls r0, r4, 4\n" + "\tsubs r0, r4\n" + "\tlsls r0, 2\n" + "\tadds r1, r0\n" + "\tldr r2, =0x000031d0\n" + "\tadds r1, r2\n" + "\tmovs r0, 0x1\n" + "\tstrb r0, [r1]\n" + "\tmov r2, r9\n" + "\tldr r1, [r2]\n" + "\tlsls r0, r6, 4\n" + "\tsubs r0, r6\n" + "\tlsls r0, 2\n" + "\tadds r1, r0\n" + "\tldr r0, =0x000031d4\n" + "\tadds r1, r0\n" + "\tmovs r2, 0x1\n" + "\tstrb r2, [r1]\n" + "\tmov r0, r9\n" + "\tldr r1, [r0]\n" + "\tlsls r0, r4, 1\n" + "\tadds r1, 0x86\n" + "\tadds r1, r0\n" + "\tldrh r0, [r1]\n" + "\tadds r0, 0x1\n" + "\tstrh r0, [r1]\n" + "\tmovs r0, 0\n" + "\tadds r1, r5, 0\n" + "\tadds r2, r4, 0\n" + "\tbl sub_8026F1C\n" + "\tmovs r0, 0x1\n" + "\tbl sub_8027234\n" + "\tadds r0, r4, 0\n" + "\tbl sub_8026D1C\n" + "\tmov r1, r9\n" + "\tldr r0, [r1]\n" + "\tadds r1, r0, 0\n" + "\tadds r1, 0xE8\n" + "\tadds r1, r5\n" + "\tldr r2, =0x000032e0\n" + "\tadds r0, r2\n" + "\tadds r0, r5\n" + "\tldrb r0, [r0]\n" + "\tstrb r0, [r1]\n" + "\tmov r4, r9\n" + "\tldr r0, [r4]\n" + "\tadds r0, r2\n" + "\tadds r0, r5\n" + "\tmovs r1, 0x3\n" + "\tstrb r1, [r0]\n" + "\tldr r1, [r4]\n" + "\tadds r1, 0xF4\n" + "\tadd r1, r8\n" + "\tldrb r0, [r1]\n" + "\tmovs r2, 0xFF\n" + "\torrs r0, r2\n" + "\tstrb r0, [r1]\n" + "\tldr r1, [r4]\n" + "\tadds r1, 0xF5\n" + "\tadd r1, r8\n" + "\tldrb r0, [r1]\n" + "\torrs r0, r2\n" + "\tstrb r0, [r1]\n" + "_08026602:\n" + "\tmov r0, r10\n" + "\tadds r0, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r0, 24\n" + "\tmov r10, r0\n" + "\tldr r4, [sp, 0x4]\n" + "\tcmp r10, r4\n" + "\tbcs _08026614\n" + "\tb _08026450\n" + "_08026614:\n" + "\tadd sp, 0x10\n" + "\tpop {r3-r5}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tmov r10, r5\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.pool"); +} +#endif // NONMATCHING