From fce326fbd47c48393b557487dd5dffa6a75f7022 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 7 Nov 2017 20:25:24 -0500 Subject: [PATCH 001/123] through sub_8009414 --- asm/link.s | 135 ------------------------------------------- common_syms/link.txt | 1 + data/link.s | 16 ----- include/gba/io_reg.h | 17 ++++++ include/librfu.h | 2 + include/link.h | 4 ++ include/main.h | 1 + ld_script.txt | 2 + src/link.c | 69 ++++++++++++++++++++-- 9 files changed, 91 insertions(+), 156 deletions(-) create mode 100644 common_syms/link.txt diff --git a/asm/link.s b/asm/link.s index 291f71a57..d4b76a96e 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,141 +5,6 @@ .text - thumb_func_start sub_80093CC -sub_80093CC: @ 80093CC - push {lr} - bl sub_800B488 - bl sub_800E700 - bl sub_800BEC0 - ldr r1, =0x00008001 - cmp r0, r1 - beq _080093F4 - bl sub_800B4A4 - bl sub_80097E8 - bl RestoreSerialTimer3IntrHandlers - movs r0, 0 - b _080093FE - .pool -_080093F4: - bl rfu_REQ_stopMode - bl rfu_waitREQComplete - movs r0, 0x1 -_080093FE: - pop {r1} - bx r1 - thumb_func_end sub_80093CC - - thumb_func_start sub_8009404 -sub_8009404: @ 8009404 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - pop {r0} - bx r0 - thumb_func_end sub_8009404 - - thumb_func_start sub_8009414 -sub_8009414: @ 8009414 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - ldr r4, [sp, 0x18] - lsls r5, 24 - lsrs r5, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r2, 24 - lsrs r6, r2, 24 - lsls r3, 24 - lsrs r7, r3, 24 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =gLinkTestDigitsPal - lsls r1, r5, 4 - movs r2, 0x20 - bl LoadPalette - ldr r3, =0x040000d4 - ldr r0, =gLinkTestDigitsGfx - str r0, [r3] - lsls r2, r7, 14 - lsls r0, r4, 5 - movs r1, 0xC0 - lsls r1, 19 - adds r0, r1 - adds r2, r0 - str r2, [r3, 0x4] - ldr r0, =0x80000110 - str r0, [r3, 0x8] - ldr r0, [r3, 0x8] - ldr r0, =gUnknown_03003130 - str r6, [r0] - str r5, [r0, 0x4] - str r4, [r0, 0x8] - mov r0, r8 - cmp r0, 0x2 - beq _0800949E - cmp r0, 0x2 - bgt _08009484 - cmp r0, 0x1 - beq _0800948C - b _080094C0 - .pool -_08009484: - mov r0, r8 - cmp r0, 0x3 - beq _080094B0 - b _080094C0 -_0800948C: - lsls r1, r6, 8 - movs r0, 0x1 - orrs r1, r0 - lsls r0, r7, 2 - orrs r1, r0 - movs r0, 0xA - bl SetGpuReg - b _080094C0 -_0800949E: - lsls r1, r6, 8 - movs r0, 0x1 - orrs r1, r0 - lsls r0, r7, 2 - orrs r1, r0 - movs r0, 0xC - bl SetGpuReg - b _080094C0 -_080094B0: - lsls r1, r6, 8 - movs r0, 0x1 - orrs r1, r0 - lsls r0, r7, 2 - orrs r1, r0 - movs r0, 0xE - bl SetGpuReg -_080094C0: - mov r0, r8 - lsls r4, r0, 2 - adds r0, r4, 0 - adds r0, 0x10 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl SetGpuReg - adds r4, 0x12 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0 - bl SetGpuReg - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8009414 - thumb_func_start sub_80094EC sub_80094EC: @ 80094EC push {r4-r6,lr} diff --git a/common_syms/link.txt b/common_syms/link.txt new file mode 100644 index 000000000..22e3081ee --- /dev/null +++ b/common_syms/link.txt @@ -0,0 +1 @@ +gUnknown_03003130 diff --git a/data/link.s b/data/link.s index d9cf886c5..578ae0256 100644 --- a/data/link.s +++ b/data/link.s @@ -5,22 +5,6 @@ .section .rodata - .align 2 -gWirelessLinkDisplayPal:: @ 82EC86C - .incbin "graphics/interface/wireless_link_display.gbapal" - -gWirelessLinkDisplayGfx:: @ 82EC88C - .incbin "graphics/interface/wireless_link_display.4bpp.lz" - -gWirelessLinkDisplayTilemap:: @ 82ECD34 - .incbin "graphics/interface/wireless_link_display.bin.lz" - -gLinkTestDigitsPal:: @ 82ECF20 - .incbin "graphics/interface/link_test_digits.gbapal" - -gLinkTestDigitsGfx:: @ 82ECF40 - .incbin "graphics/interface/link_test_digits.4bpp" - .string "{HIGHLIGHT TRANSPARENT}{COLOR WHITE}$" .align 2 diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index f86f2434c..998e68e16 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -584,6 +584,23 @@ #define TIMER_INTR_ENABLE 0x40 #define TIMER_ENABLE 0x80 +// BGCNT +#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs. +#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data. +#define BGCNT_MOSAIC 0x0040 +#define BGCNT_16COLOR 0x0000 // 4 bits per pixel +#define BGCNT_256COLOR 0x0080 // 8 bits per pixel +#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for tile map. +#define BGCNT_WRAP 0x2000 // Only affects affine BGs. Text BGs wrap by default. +#define BGCNT_TXT256x256 0x0000 // Internal screen size size of text mode BG in pixels. +#define BGCNT_TXT512x256 0x4000 +#define BGCNT_TXT256x512 0x8000 +#define BGCNT_TXT512x512 0xC000 +#define BGCNT_AFF128x128 0x0000 // Internal screen size size of affine mode BG in pixels. +#define BGCNT_AFF256x256 0x4000 +#define BGCNT_AFF512x512 0x8000 +#define BGCNT_AFF1024x1024 0xC000 + // serial #define SIO_ID 0x0030 // Communication ID diff --git a/include/librfu.h b/include/librfu.h index dbc8a41a6..0cf781d73 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -106,3 +106,5 @@ struct RfuIntrStruct extern struct RfuStruct *gRfuState; void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam); +void rfu_REQ_stopMode(void); +void rfu_waitREQComplete(void); diff --git a/include/link.h b/include/link.h index 7a6563144..64bb8ff47 100644 --- a/include/link.h +++ b/include/link.h @@ -193,4 +193,8 @@ u8 sub_800ABAC(void); u8 sub_800ABBC(void); void sub_800AC34(void); +void sub_80097E8(void); + +extern IWRAM_DATA u32 gUnknown_03003130[3]; // common + #endif // GUARD_LINK_H diff --git a/include/main.h b/include/main.h index e283d1754..46c8fd681 100644 --- a/include/main.h +++ b/include/main.h @@ -60,5 +60,6 @@ void SetSerialCallback(IntrCallback callback); void InitFlashTimer(void); void DoSoftReset(void); void ClearPokemonCrySongs(void); +void RestoreSerialTimer3IntrHandlers(void); #endif // GUARD_MAIN_H diff --git a/ld_script.txt b/ld_script.txt index c8d31c846..34b9a7722 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -51,6 +51,7 @@ SECTIONS { src/text.o(.text); src/sprite.o(.text); src/string_util.o(.text); + src/link.o(.text); asm/link.o(.text); src/rtc.o(.text); asm/main_menu.o(.text); @@ -327,6 +328,7 @@ SECTIONS { src/sprite.o(.rodata); data/io_reg.o(.rodata); src/string_util.o(.rodata); + src/link.o(.rodata); data/link.o(.rodata); src/rtc.o(.rodata); data/main_menu.o(.rodata); diff --git a/src/link.c b/src/link.c index ae2cd1992..0b7002124 100644 --- a/src/link.c +++ b/src/link.c @@ -1,6 +1,11 @@ // Includes #include "global.h" +#include "librfu.h" +#include "gpu_regs.h" +#include "palette.h" +#include "task.h" +#include "link.h" // Static type declarations @@ -31,17 +36,17 @@ IWRAM_DATA u32 gUnknown_03000D54; IWRAM_DATA u8 gUnknown_03000D58; IWRAM_DATA u32 gUnknown_03000D5C; IWRAM_DATA u32 gUnknown_03000D60; -IWRAM_DATA u8 gUnknown_03000D64[4]; // not really, but won't match otherwise -IWRAM_DATA u8 gUnknown_03000D68[4]; +IWRAM_DATA u8 gUnknown_03000D64; +ALIGNED() IWRAM_DATA u8 gUnknown_03000D68[4]; IWRAM_DATA u8 gUnknown_03000D6C; IWRAM_DATA bool8 gUnknown_03000D6D; IWRAM_DATA u16 gUnknown_03000D6E; IWRAM_DATA u16 gUnknown_03000D70; IWRAM_DATA u8 gUnknown_03000D72; IWRAM_DATA u8 gUnknown_03000D73; -IWRAM_DATA u8 gUnknown_03000D74[4]; // not really, but won't match otherwise -IWRAM_DATA u8 gUnknown_03000D78[8]; // not really, but won't match otherwise -IWRAM_DATA u8 gUnknown_03000D80[16]; +IWRAM_DATA u8 gUnknown_03000D74; +ALIGNED() IWRAM_DATA u8 gUnknown_03000D78; +ALIGNED(8) IWRAM_DATA u8 gUnknown_03000D80[16]; IWRAM_DATA u16 gUnknown_03000D90[8]; IWRAM_DATA u32 gUnknown_03000DA0; IWRAM_DATA u32 gUnknown_03000DA4; @@ -51,6 +56,60 @@ IWRAM_DATA bool32 gUnknown_03000DB0; // Static ROM declarations +void sub_800E700(void); +u32 sub_800BEC0(void); +void sub_800B4A4(void); + // .rodata +ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal"); +const u8 gWirelessLinkDisplayGfx[] = INCBIN_U8("graphics/interface/wireless_link_display.4bpp.lz"); +const u8 gWirelessLinkDisplayTilemap[] = INCBIN_U8("graphics/interface/wireless_link_display.bin.lz"); +const u16 gLinkTestDigitsPal[] = INCBIN_U16("graphics/interface/link_test_digits.gbapal"); +const u16 gLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits.4bpp"); + // .text + +bool8 sub_80093CC(void) +{ + sub_800B488(); + sub_800E700(); + if (sub_800BEC0() == 0x8001) + { + rfu_REQ_stopMode(); + rfu_waitREQComplete(); + return TRUE; + } + sub_800B4A4(); + sub_80097E8(); + RestoreSerialTimer3IntrHandlers(); + return FALSE; +} + +void sub_8009404(u8 taskId) +{ + DestroyTask(taskId); +} + +void sub_8009414(u8 a0, u8 a1, u8 a2, u8 a3, u16 a4) +{ + LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20); + DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3) + (16 * a4), sizeof gLinkTestDigitsGfx); + gUnknown_03003130[0] = a2; + gUnknown_03003130[1] = a0; + gUnknown_03003130[2] = a4; + switch (a1) + { + case 1: + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_SCREENBASE(a2) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(a3)); + break; + case 2: + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_SCREENBASE(a2) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(a3)); + break; + case 3: + SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_SCREENBASE(a2) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(a3)); + break; + } + SetGpuReg(REG_OFFSET_BG0HOFS + a1 * 4, 0); + SetGpuReg(REG_OFFSET_BG0VOFS + a1 * 4, 0); +} From 59eb766f47ca0f144447b13aabf7c4b9135fc0f3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 7 Nov 2017 21:45:44 -0500 Subject: [PATCH 002/123] sub_80094EC --- asm/link.s | 56 -------------------------------------------------- data/link.s | 19 ----------------- include/link.h | 1 + src/link.c | 28 +++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 75 deletions(-) diff --git a/asm/link.s b/asm/link.s index d4b76a96e..6926c065c 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,62 +5,6 @@ .text - thumb_func_start sub_80094EC -sub_80094EC: @ 80094EC - push {r4-r6,lr} - mov r6, r8 - push {r6} - mov r8, r0 - adds r6, r1, 0 - adds r4, r2, 0 - adds r5, r3, 0 - 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 - ldr r0, =gLinkTestDigitsPal - mov r2, r8 - lsls r1, r2, 4 - movs r2, 0x20 - bl LoadPalette - ldr r2, =0x040000d4 - ldr r0, =gLinkTestDigitsGfx - str r0, [r2] - lsls r0, r5, 14 - movs r1, 0xC0 - lsls r1, 19 - adds r0, r1 - str r0, [r2, 0x4] - ldr r0, =0x80000110 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - ldr r0, =gUnknown_03003130 - str r4, [r0] - mov r1, r8 - str r1, [r0, 0x4] - movs r1, 0 - str r1, [r0, 0x8] - ldr r0, =gUnknown_082ED1D0 - adds r6, r0 - ldrb r0, [r6] - lsls r4, 8 - lsls r5, 2 - orrs r4, r5 - adds r1, r4, 0 - bl SetGpuReg - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80094EC - thumb_func_start sub_8009570 sub_8009570: @ 8009570 push {r4,lr} diff --git a/data/link.s b/data/link.s index 578ae0256..51e9d0c70 100644 --- a/data/link.s +++ b/data/link.s @@ -5,26 +5,7 @@ .section .rodata - .string "{HIGHLIGHT TRANSPARENT}{COLOR WHITE}$" - .align 2 -g2BlankTilesGfx:: @ 82ED168 - .incbin "graphics/interface/blank_1x2.4bpp" - -gUnknown_082ED1A8:: @ 82ED1A8 - .4byte gUnknown_020228C4 - .4byte 0x000000C8 - .4byte gUnknown_020228C4 - .4byte 0x000000C8 - .4byte gUnknown_020228C4 - .4byte 0x00000064 - .4byte gUnknown_020228C4 - .4byte 0x000000DC - .4byte gUnknown_020228C4 - .4byte 0x00000028 - -gUnknown_082ED1D0:: @ 82ED1D0 - .byte 0x8, 0xA, 0xC, 0xE gASCIIGameFreakInc:: @ 82ED1D4 .ascii "GameFreak inc." diff --git a/include/link.h b/include/link.h index 64bb8ff47..c8eece572 100644 --- a/include/link.h +++ b/include/link.h @@ -132,6 +132,7 @@ extern const struct BlockRequest sBlockRequestLookupTable[5]; extern struct Link gLink; extern u16 gRecvCmds[CMD_LENGTH][MAX_LINK_PLAYERS]; +extern u8 gUnknown_020228C4[BLOCK_BUFFER_SIZE]; // gBlockSendBuffer extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; extern u16 gLinkType; extern u32 gLinkStatus; diff --git a/src/link.c b/src/link.c index 0b7002124..7955f4427 100644 --- a/src/link.c +++ b/src/link.c @@ -67,6 +67,24 @@ const u8 gWirelessLinkDisplayGfx[] = INCBIN_U8("graphics/interface/wireless_link const u8 gWirelessLinkDisplayTilemap[] = INCBIN_U8("graphics/interface/wireless_link_display.bin.lz"); const u16 gLinkTestDigitsPal[] = INCBIN_U16("graphics/interface/link_test_digits.gbapal"); const u16 gLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits.4bpp"); +const u8 unkstring_82ed160[] = _("{HIGHLIGHT TRANSPARENT}{COLOR WHITE}"); +const u16 g2BlankTilesGfx[] = INCBIN_U16("graphics/interface/blank_1x2.4bpp"); +const struct { + void *data; + u16 size; +} gUnknown_082ED1A8[] = { + {gUnknown_020228C4, 200}, + {gUnknown_020228C4, 200}, + {gUnknown_020228C4, 100}, + {gUnknown_020228C4, 220}, + {gUnknown_020228C4, 40} +}; +const u8 gUnknown_082ED1D0[] = { + REG_OFFSET_BG0CNT, + REG_OFFSET_BG1CNT, + REG_OFFSET_BG2CNT, + REG_OFFSET_BG3CNT +}; // .text @@ -113,3 +131,13 @@ void sub_8009414(u8 a0, u8 a1, u8 a2, u8 a3, u16 a4) SetGpuReg(REG_OFFSET_BG0HOFS + a1 * 4, 0); SetGpuReg(REG_OFFSET_BG0VOFS + a1 * 4, 0); } + +void sub_80094EC(u8 a0, u8 a1, u8 a2, u8 a3) +{ + LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20); + DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3), sizeof gLinkTestDigitsGfx); + gUnknown_03003130[0] = a2; + gUnknown_03003130[1] = a0; + gUnknown_03003130[2] = 0; + SetGpuReg(gUnknown_082ED1D0[a1], BGCNT_SCREENBASE(a2) | BGCNT_CHARBASE(a3)); +} From 0709dc7e4c0201b80a547fb1152ec4a0219dc31a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 7 Nov 2017 22:14:40 -0500 Subject: [PATCH 003/123] sub_8009570 --- asm/link.s | 62 -------------------------------------------------- include/link.h | 2 +- src/link.c | 53 +++++++++++++++++++++++++++++++++++------- 3 files changed, 46 insertions(+), 71 deletions(-) diff --git a/asm/link.s b/asm/link.s index 6926c065c..559bed090 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,68 +5,6 @@ .text - thumb_func_start sub_8009570 -sub_8009570: @ 8009570 - push {r4,lr} - sub sp, 0x4 - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - ldr r0, =sub_80096BC - bl SetVBlankCallback - bl sub_800A2E0 - ldr r1, =gUnknown_020229C6 - ldr r2, =0x00001111 - adds r0, r2, 0 - strh r0, [r1] - bl sub_8009734 - ldr r0, =gMain - ldrh r0, [r0, 0x24] - bl SeedRng - movs r4, 0 -_080095A0: - bl Random - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - adds r1, 0xA - adds r1, r4 - strb r0, [r1] - adds r4, 0x1 - cmp r4, 0x3 - ble _080095A0 - movs r4, 0 - str r4, [sp] - movs r0, 0 - movs r1, 0x2 - movs r2, 0x4 - movs r3, 0 - bl sub_8009414 - movs r1, 0xAA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =sub_8009404 - movs r1, 0 - bl CreateTask - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - ldr r0, =gUnknown_03000D60 - str r4, [r0] - bl sub_8009638 - ldr r0, =task00_link_test - movs r1, 0 - bl CreateTask - ldr r0, =c2_08009A8C - bl SetMainCallback2 - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009570 - thumb_func_start sub_8009628 sub_8009628: @ 8009628 lsls r0, 24 diff --git a/include/link.h b/include/link.h index c8eece572..0653a25e8 100644 --- a/include/link.h +++ b/include/link.h @@ -196,6 +196,6 @@ void sub_800AC34(void); void sub_80097E8(void); -extern IWRAM_DATA u32 gUnknown_03003130[3]; // common +extern IWRAM_DATA struct LinkTestBGInfo gUnknown_03003130; // common #endif // GUARD_LINK_H diff --git a/src/link.c b/src/link.c index 7955f4427..3c1bd13b1 100644 --- a/src/link.c +++ b/src/link.c @@ -2,6 +2,7 @@ // Includes #include "global.h" #include "librfu.h" +#include "rng.h" #include "gpu_regs.h" #include "palette.h" #include "task.h" @@ -54,11 +55,18 @@ IWRAM_DATA void *gUnknown_03000DA8; IWRAM_DATA void *gUnknown_03000DAC; IWRAM_DATA bool32 gUnknown_03000DB0; +u16 gUnknown_020229C6 = 0; + // Static ROM declarations -void sub_800E700(void); -u32 sub_800BEC0(void); +void sub_8009638(void); +void sub_80096BC(void); +void c2_08009A8C(void); +void sub_800A2E0(void); +void task00_link_test(u8 taskId); void sub_800B4A4(void); +u32 sub_800BEC0(void); +void sub_800E700(void); // .rodata @@ -113,9 +121,9 @@ void sub_8009414(u8 a0, u8 a1, u8 a2, u8 a3, u16 a4) { LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20); DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3) + (16 * a4), sizeof gLinkTestDigitsGfx); - gUnknown_03003130[0] = a2; - gUnknown_03003130[1] = a0; - gUnknown_03003130[2] = a4; + gUnknown_03003130.screenBaseBlock = a2; + gUnknown_03003130.paletteNum = a0; + gUnknown_03003130.dummy_8 = a4; switch (a1) { case 1: @@ -136,8 +144,37 @@ void sub_80094EC(u8 a0, u8 a1, u8 a2, u8 a3) { LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20); DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3), sizeof gLinkTestDigitsGfx); - gUnknown_03003130[0] = a2; - gUnknown_03003130[1] = a0; - gUnknown_03003130[2] = 0; + gUnknown_03003130.screenBaseBlock = a2; + gUnknown_03003130.paletteNum = a0; + gUnknown_03003130.dummy_8 = 0; SetGpuReg(gUnknown_082ED1D0[a1], BGCNT_SCREENBASE(a2) | BGCNT_CHARBASE(a3)); } + +void sub_8009570(void) +{ + int i; + + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + SetVBlankCallback(sub_80096BC); + sub_800A2E0(); + gUnknown_020229C6 = 0x1111; + sub_8009734(); + SeedRng(gMain.vblankCounter2); + for (i = 0; i < 4; i ++) + { + gSaveBlock2Ptr->playerTrainerId[i] = Random() % 256; + } + sub_8009414(0, 2, 4, 0, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON); + CreateTask(sub_8009404, 0); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); + gUnknown_03000D60 = 0; + sub_8009638(); + CreateTask(task00_link_test, 0); + SetMainCallback2(c2_08009A8C); +} From f90106ae6ca4132c1ffdddee6580e46af3352f76 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 7 Nov 2017 22:26:00 -0500 Subject: [PATCH 004/123] sub_8009638 --- asm/link.s | 67 ------------------------------------------------- include/flags.h | 2 +- src/link.c | 24 ++++++++++++++++++ 3 files changed, 25 insertions(+), 68 deletions(-) diff --git a/asm/link.s b/asm/link.s index 559bed090..cc3685971 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,73 +5,6 @@ .text - thumb_func_start sub_8009628 -sub_8009628: @ 8009628 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_020229CC - strh r0, [r1, 0x18] - bx lr - .pool - thumb_func_end sub_8009628 - - thumb_func_start sub_8009638 -sub_8009638: @ 8009638 - push {r4,r5,lr} - ldr r5, =gUnknown_020229CC - ldr r4, =gSaveBlock2Ptr - ldr r1, [r4] - ldrb r2, [r1, 0xA] - ldrb r0, [r1, 0xB] - lsls r0, 8 - orrs r2, r0 - ldrb r0, [r1, 0xC] - lsls r0, 16 - orrs r2, r0 - ldrb r0, [r1, 0xD] - lsls r0, 24 - orrs r2, r0 - str r2, [r5, 0x4] - adds r0, r5, 0 - adds r0, 0x8 - bl StringCopy - ldr r0, [r4] - ldrb r0, [r0, 0x8] - strb r0, [r5, 0x13] - ldr r0, =gUnknown_020229C6 - ldrh r0, [r0] - str r0, [r5, 0x14] - ldr r0, =gGameLanguage - ldrb r0, [r0] - strh r0, [r5, 0x1A] - ldr r0, =gGameVersion - ldrb r0, [r0] - movs r2, 0x80 - lsls r2, 7 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r5] - movs r0, 0x80 - lsls r0, 8 - strh r0, [r5, 0x2] - bl IsNationalPokedexEnabled - strb r0, [r5, 0x10] - ldr r0, =0x0000087f - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _0800969E - ldrb r0, [r5, 0x10] - movs r1, 0x10 - orrs r0, r1 - strb r0, [r5, 0x10] -_0800969E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009638 - thumb_func_start sub_80096BC sub_80096BC: @ 80096BC push {lr} diff --git a/include/flags.h b/include/flags.h index 7d825feba..ce93af985 100644 --- a/include/flags.h +++ b/include/flags.h @@ -42,7 +42,7 @@ #define FLAG_VISITED_MOSSDEEP_CITY CODE_FLAGS + 0x1C #define FLAG_VISITED_SOOTOPOLIS_CITY CODE_FLAGS + 0x1D #define FLAG_VISITED_EVER_GRANDE_CITY CODE_FLAGS + 0x1E - +#define SYS_UNKNOWN_87F CODE_FLAGS + 0x1F #define SYS_UNKNOWN_880 CODE_FLAGS + 0x20 #define SYS_USE_FLASH CODE_FLAGS + 0x28 diff --git a/src/link.c b/src/link.c index 3c1bd13b1..f95c1acb7 100644 --- a/src/link.c +++ b/src/link.c @@ -3,6 +3,8 @@ #include "global.h" #include "librfu.h" #include "rng.h" +#include "string_util.h" +#include "event_data.h" #include "gpu_regs.h" #include "palette.h" #include "task.h" @@ -56,6 +58,7 @@ IWRAM_DATA void *gUnknown_03000DAC; IWRAM_DATA bool32 gUnknown_03000DB0; u16 gUnknown_020229C6 = 0; +struct LinkPlayer gUnknown_020229CC = {}; // Static ROM declarations @@ -178,3 +181,24 @@ void sub_8009570(void) CreateTask(task00_link_test, 0); SetMainCallback2(c2_08009A8C); } + +void sub_8009628(u8 a0) +{ + gUnknown_020229CC.lp_field_18 = a0; +} + +void sub_8009638(void) +{ + gUnknown_020229CC.trainerId = gSaveBlock2Ptr->playerTrainerId[0] | (gSaveBlock2Ptr->playerTrainerId[1] << 8) | (gSaveBlock2Ptr->playerTrainerId[2] << 16) | (gSaveBlock2Ptr->playerTrainerId[3] << 24); + StringCopy(gUnknown_020229CC.name, gSaveBlock2Ptr->playerName); + gUnknown_020229CC.gender = gSaveBlock2Ptr->playerGender; + gUnknown_020229CC.linkType = gUnknown_020229C6; + gUnknown_020229CC.language = gGameLanguage; + gUnknown_020229CC.version = gGameVersion + 0x4000; + gUnknown_020229CC.lp_field_2 = 0x8000; + gUnknown_020229CC.name[8] = IsNationalPokedexEnabled(); + if (FlagGet(SYS_UNKNOWN_87F)) + { + gUnknown_020229CC.name[8] |= 0x10; + } +} From 9029fb27c176cd962bb30a12a77e7138ed21f28b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 7 Nov 2017 22:52:10 -0500 Subject: [PATCH 005/123] through sub_8009734 --- asm/link.s | 120 ------------------------------------------------- include/link.h | 12 +++++ include/main.h | 2 + src/link.c | 64 ++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 120 deletions(-) diff --git a/asm/link.s b/asm/link.s index cc3685971..f4fb4b75d 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,126 +5,6 @@ .text - thumb_func_start sub_80096BC -sub_80096BC: @ 80096BC - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_80096BC - - thumb_func_start sub_80096D0 -sub_80096D0: @ 80096D0 - push {lr} - ldr r3, =gUnknown_020229C4 - ldr r1, =gUnknown_03003110 - ldr r2, =0x0000efff - adds r0, r1, 0 - adds r0, 0xE -_080096DC: - strh r2, [r0] - subs r0, 0x2 - cmp r0, r1 - bge _080096DC - movs r0, 0x1 - strb r0, [r3] - bl sub_800B594 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80096D0 - - thumb_func_start task02_080097CC -task02_080097CC: @ 80096FC - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _08009726 - ldr r1, =gUnknown_03003144 - movs r0, 0x1 - strb r0, [r1] - adds r0, r2, 0 - bl DestroyTask -_08009726: - pop {r0} - bx r0 - .pool - thumb_func_end task02_080097CC - - thumb_func_start sub_8009734 -sub_8009734: @ 8009734 - push {r4-r6,lr} - ldr r0, =gLinkVSyncDisabled - ldrb r4, [r0] - cmp r4, 0 - bne _080097A8 - bl sub_800B628 - bl sub_80096D0 - ldr r1, =gUnknown_03003140 - ldr r0, =sub_800A824 - str r0, [r1] - ldr r0, =gUnknown_03002748 - strb r4, [r0] - ldr r0, =gUnknown_0300306C - strb r4, [r0] - ldr r0, =gUnknown_030030F8 - strb r4, [r0] - bl ResetBlockReceivedFlags - bl sub_800A2E0 - ldr r0, =gUnknown_03000D54 - str r4, [r0] - ldr r0, =gUnknown_030030E8 - strb r4, [r0] - ldr r0, =gUnknown_030030E4 - strb r4, [r0] - ldr r0, =gUnknown_030030F4 - strh r4, [r0] - ldr r0, =task02_080097CC - movs r1, 0x2 - bl CreateTask - b _080097AC - .pool -_080097A8: - bl sub_800E700 -_080097AC: - ldr r1, =gReceivedRemoteLinkPlayers - movs r0, 0 - strb r0, [r1] - movs r1, 0 - ldr r6, =gUnknown_03003078 - movs r2, 0 - movs r5, 0x1 - ldr r4, =gUnknown_030030F0 - ldr r3, =gUnknown_030030EC -_080097BE: - adds r0, r1, r6 - strb r5, [r0] - adds r0, r1, r4 - strb r2, [r0] - adds r0, r1, r3 - strb r2, [r0] - adds r1, 0x1 - cmp r1, 0x3 - ble _080097BE - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009734 - thumb_func_start sub_80097E8 sub_80097E8: @ 80097E8 push {r4,lr} diff --git a/include/link.h b/include/link.h index 0653a25e8..fa245cbdf 100644 --- a/include/link.h +++ b/include/link.h @@ -194,8 +194,20 @@ u8 sub_800ABAC(void); u8 sub_800ABBC(void); void sub_800AC34(void); +void sub_800B628(void); void sub_80097E8(void); +extern IWRAM_DATA u8 gUnknown_0300306C; +extern IWRAM_DATA u8 gUnknown_03003078[4]; +extern IWRAM_DATA u8 gUnknown_030030E4; +extern IWRAM_DATA u8 gUnknown_030030E8; +extern IWRAM_DATA u8 gUnknown_030030EC[4]; +extern IWRAM_DATA u8 gUnknown_030030F0[4]; +extern IWRAM_DATA u16 gUnknown_030030F4; +extern IWRAM_DATA u8 gUnknown_030030F8; +extern IWRAM_DATA u16 gUnknown_03003110[8]; extern IWRAM_DATA struct LinkTestBGInfo gUnknown_03003130; // common +extern IWRAM_DATA void (*gUnknown_03003140)(void); +extern IWRAM_DATA bool8 gUnknown_03003144; #endif // GUARD_LINK_H diff --git a/include/main.h b/include/main.h index 46c8fd681..4ce2e9b1a 100644 --- a/include/main.h +++ b/include/main.h @@ -50,6 +50,8 @@ extern bool8 gLinkVSyncDisabled; extern const u8 gGameVersion; extern const u8 gGameLanguage; +extern IWRAM_DATA u8 gUnknown_03002748; + void AgbMain(void); void SetMainCallback2(MainCallback callback); void InitKeys(void); diff --git a/src/link.c b/src/link.c index f95c1acb7..bcad97f53 100644 --- a/src/link.c +++ b/src/link.c @@ -57,6 +57,7 @@ IWRAM_DATA void *gUnknown_03000DA8; IWRAM_DATA void *gUnknown_03000DAC; IWRAM_DATA bool32 gUnknown_03000DB0; +bool8 gUnknown_020229C4 = 0; u16 gUnknown_020229C6 = 0; struct LinkPlayer gUnknown_020229CC = {}; @@ -67,6 +68,8 @@ void sub_80096BC(void); void c2_08009A8C(void); void sub_800A2E0(void); void task00_link_test(u8 taskId); +void sub_800A824(void); +void sub_800B594(void); void sub_800B4A4(void); u32 sub_800BEC0(void); void sub_800E700(void); @@ -202,3 +205,64 @@ void sub_8009638(void) gUnknown_020229CC.name[8] |= 0x10; } } + +void sub_80096BC(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_80096D0(void) +{ + int i; + + for (i = 0; i < 8; i ++) + { + gUnknown_03003110[i] = 0xefff; + } + gUnknown_020229C4 = TRUE; + sub_800B594(); +} + +void task02_080097CC(u8 taskId) +{ + if (++ gTasks[taskId].data[0] == 5) + { + gUnknown_03003144 = TRUE; + DestroyTask(taskId); + } +} + +void sub_8009734(void) +{ + int i; + + if (!gLinkVSyncDisabled) + { + sub_800B628(); + sub_80096D0(); + gUnknown_03003140 = sub_800A824; + gUnknown_03002748 = 0; + gUnknown_0300306C = 0; + gUnknown_030030F8 = 0; + ResetBlockReceivedFlags(); + sub_800A2E0(); + gUnknown_03000D54 = 0; + gUnknown_030030E8 = 0; + gUnknown_030030E4 = 0; + gUnknown_030030F4 = 0; + CreateTask(task02_080097CC, 2); + } + else + { + sub_800E700(); + } + gReceivedRemoteLinkPlayers = 0; + for (i = 0; i < 4; i ++) + { + gUnknown_03003078[i] = 1; + gUnknown_030030F0[i] = 0; + gUnknown_030030EC[i] = 0; + } +} From d5547a3744104140bc8a3e5390f13a9bc903d249 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 7 Nov 2017 23:53:30 -0500 Subject: [PATCH 006/123] main.c common syms --- asm/battle_1.s | 2 +- asm/cable_car_util.s | 8 ++++---- asm/link.s | 2 +- asm/rom4.s | 10 +++++----- asm/start_menu.s | 2 +- common_syms/main.txt | 9 +++++++++ include/main.h | 8 +++++++- src/main.c | 23 +++++++++++------------ sym_common.txt | 41 +---------------------------------------- sym_ewram.txt | 5 +---- 10 files changed, 41 insertions(+), 69 deletions(-) create mode 100644 common_syms/main.txt diff --git a/asm/battle_1.s b/asm/battle_1.s index 9665b0d11..ea69e73c8 100644 --- a/asm/battle_1.s +++ b/asm/battle_1.s @@ -366,7 +366,7 @@ sub_8034EFC: @ 8034EFC movs r0, 0 strh r0, [r1] lsls r1, r5, 3 - ldr r2, =gUnknown_030022F8 + ldr r2, =gMain+0x38 mov r9, r2 add r1, r9 mov r0, r8 diff --git a/asm/cable_car_util.s b/asm/cable_car_util.s index 7f396b635..db434eaf9 100644 --- a/asm/cable_car_util.s +++ b/asm/cable_car_util.s @@ -252,7 +252,7 @@ _0815226C: ldrb r2, [r2] cmp r3, r2 bcs _08152292 - ldr r0, =gUnknown_030024F8 + ldr r0, =gMain+0x238 mov r12, r0 ldr r4, =gDummyOamData adds r2, r5, 0 @@ -350,7 +350,7 @@ _08152322: cmp r0, 0 beq _08152348 lsls r0, r6, 3 - ldr r1, =gUnknown_030024F8 + ldr r1, =gMain+0x238 adds r0, r1 ldr r1, =gDummyOamData ldm r1!, {r2,r3} @@ -412,7 +412,7 @@ _08152348: orrs r0, r1 strh r0, [r2, 0x4] lsls r1, r6, 3 - ldr r2, =gUnknown_030024F8 + ldr r2, =gMain+0x238 ldr r0, [r4, 0x4] adds r1, r2 adds r0, r5, r0 @@ -746,7 +746,7 @@ _081525FC: orrs r0, r2 strb r0, [r1, 0x19] lsls r1, r5, 3 - ldr r0, =gUnknown_030024F8 + ldr r0, =gMain+0x238 adds r1, r0 ldr r0, =gDummyOamData ldm r0!, {r2,r3} diff --git a/asm/link.s b/asm/link.s index f4fb4b75d..55e91d8ce 100644 --- a/asm/link.s +++ b/asm/link.s @@ -3426,7 +3426,7 @@ HandleLinkConnection: @ 800B40C bl sub_800B638 ldr r4, =gUnknown_030030E0 str r0, [r4] - ldr r0, =gUnknown_030022EC + ldr r0, =gMain+0x2c bl sub_80099E0 ldr r0, [r4] movs r1, 0x80 diff --git a/asm/rom4.s b/asm/rom4.s index bf682fc51..fdb8d7a60 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -3180,7 +3180,7 @@ CB2_NewGame: @ 8085EF8 ldr r1, =gUnknown_03005DB0 movs r0, 0 str r0, [r1] - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl do_load_map_stuff_loop bl SetFieldVBlankCallback ldr r0, =c1_overworld @@ -3255,7 +3255,7 @@ c2_load_new_map: @ 8085FCC thumb_func_start c2_load_new_map_2 c2_load_new_map_2: @ 8085FFC push {lr} - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl do_load_map_stuff_loop bl SetFieldVBlankCallback ldr r0, =c1_overworld @@ -3317,7 +3317,7 @@ sub_8086074: @ 8086074 thumb_func_start c2_80567AC c2_80567AC: @ 8086098 push {lr} - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl map_loading_iteration_3 cmp r0, 0 beq _080860B8 @@ -3356,7 +3356,7 @@ _080860EA: thumb_func_start c2_exit_to_overworld_2_local c2_exit_to_overworld_2_local: @ 80860F4 push {lr} - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl sub_8086638 cmp r0, 0 beq _0808610A @@ -3375,7 +3375,7 @@ c2_exit_to_overworld_2_link: @ 8086118 bl sub_8087598 cmp r0, 0 bne _08086132 - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl map_loading_iteration_2_link cmp r0, 0 beq _08086132 diff --git a/asm/start_menu.s b/asm/start_menu.s index 4f8544eea..3c8c4c3cf 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -1615,7 +1615,7 @@ _080A0506: thumb_func_start sub_80A0514 sub_80A0514: @ 80A0514 push {lr} - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl sub_80A03E4 cmp r0, 0 beq _080A052E diff --git a/common_syms/main.txt b/common_syms/main.txt new file mode 100644 index 000000000..8e0b9abf5 --- /dev/null +++ b/common_syms/main.txt @@ -0,0 +1,9 @@ +gKeyRepeatStartDelay +gUnknown_030022B4 +gMain +gKeyRepeatContinueDelay +gSoftResetDisabled +gIntrTable +gUnknown_03002748 +IntrMain_Buffer +gPcmDmaCounter diff --git a/include/main.h b/include/main.h index 4ce2e9b1a..4b95b1919 100644 --- a/include/main.h +++ b/include/main.h @@ -50,7 +50,13 @@ extern bool8 gLinkVSyncDisabled; extern const u8 gGameVersion; extern const u8 gGameLanguage; -extern IWRAM_DATA u8 gUnknown_03002748; +extern u16 gKeyRepeatStartDelay; +extern u8 gUnknown_030022B4; +extern u16 gKeyRepeatContinueDelay; +extern IntrFunc gIntrTable[]; +extern u8 gUnknown_03002748; +extern u32 IntrMain_Buffer[]; +extern u8 gPcmDmaCounter; void AgbMain(void); void SetMainCallback2(MainCallback callback); diff --git a/src/main.c b/src/main.c index 665a4dd84..80993f0d0 100644 --- a/src/main.c +++ b/src/main.c @@ -38,7 +38,6 @@ extern u8 gHeap[]; extern struct SaveBlock2 gSaveblock2; extern struct PokemonStorage gPokemonStorage; extern u32 gBattleTypeFlags; -extern u8 gUnknown_03002748; extern u32 *gUnknown_0203CF5C; void Timer3Intr(void); @@ -79,19 +78,19 @@ const IntrFunc gIntrTableTemplate[] = static u16 gUnknown_03000000; -extern u16 gKeyRepeatStartDelay; -extern u8 gUnknown_030022B4; -extern struct Main gMain; -extern u16 gKeyRepeatContinueDelay; -extern u8 gSoftResetDisabled; -extern IntrFunc gIntrTable[INTR_COUNT]; -extern bool8 gLinkVSyncDisabled; -extern u32 IntrMain_Buffer[0x200]; -extern u8 gPcmDmaCounter; +u16 gKeyRepeatStartDelay; +u8 gUnknown_030022B4; +struct Main gMain; +u16 gKeyRepeatContinueDelay; +bool8 gSoftResetDisabled; +IntrFunc gIntrTable[INTR_COUNT]; +u8 gUnknown_03002748; +u32 IntrMain_Buffer[0x200]; +u8 gPcmDmaCounter; -extern u16 gTrainerId; +static EWRAM_DATA u16 gTrainerId = 0; -EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; +//EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; static void UpdateLinkAndCallCallbacks(void); static void InitMainCallbacks(void); diff --git a/sym_common.txt b/sym_common.txt index 1a199dbb3..929ce0e97 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -1,44 +1,5 @@ .space 0x8 - -gKeyRepeatStartDelay: @ 30022B0 - .space 0x4 - -gUnknown_030022B4: @ 30022B4 - .space 0xC - -gMain: @ 30022C0 - .space 0x2C - -gUnknown_030022EC: @ 30022EC - .space 0xC - -gUnknown_030022F8: @ 30022F8 - .space 0x200 - -gUnknown_030024F8: @ 30024F8 - .space 0x200 - -gUnknown_030026F8: @ 30026F8 - .space 0x4 - -gKeyRepeatContinueDelay: @ 30026FC - .space 0x4 - -gSoftResetDisabled: @ 3002700 - .space 0x10 - -gIntrTable: @ 3002710 - .space 0x38 - -gUnknown_03002748: @ 3002748 - .space 0x8 - -IntrMain_Buffer: @ 3002750 - .space 0x800 - -gPcmDmaCounter: @ 3002F50 - .space 0x4 - + .include "main.o" .include "bg.o" .align 4 diff --git a/sym_ewram.txt b/sym_ewram.txt index 52d24a9ab..a293ce9ec 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,8 +1,5 @@ .include "src/decompress.o" - -gTrainerId: @ 2020000 - .space 0x4 - + .include "src/main.o" .include "src/window.o" .include "src/text.o" .include "src/sprite.o" From e68dbd62765b2784af8ec0f788d049ca5bafad25 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 8 Nov 2017 19:29:37 -0500 Subject: [PATCH 007/123] through sub_8009818 --- asm/link.s | 152 +++++-------------------------------------------- asm/pokenav.s | 2 +- include/link.h | 38 +++++++++---- include/main.h | 7 +-- src/link.c | 84 ++++++++++++++++++++++++++- src/main.c | 1 + sym_common.txt | 13 +---- 7 files changed, 129 insertions(+), 168 deletions(-) diff --git a/asm/link.s b/asm/link.s index 55e91d8ce..28d2ec0c9 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,130 +5,6 @@ .text - thumb_func_start sub_80097E8 -sub_80097E8: @ 80097E8 - push {r4,lr} - ldr r0, =gReceivedRemoteLinkPlayers - movs r4, 0 - strb r4, [r0] - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _080097FC - bl sub_800EDD4 -_080097FC: - ldr r0, =gUnknown_020229C4 - strb r4, [r0] - bl sub_800B53C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80097E8 - - thumb_func_start sub_8009818 -sub_8009818: @ 8009818 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r5, =gUnknown_03000D64 - ldr r4, =gUnknown_03000D10 - ldrb r0, [r5] - ldrh r1, [r4] - cmp r0, r1 - beq _0800983C - ldrh r0, [r4] - movs r1, 0x2 - movs r2, 0x3 - movs r3, 0x2 - bl sub_800A6E8 - ldrh r0, [r4] - strb r0, [r5] -_0800983C: - movs r5, 0 - ldr r7, =gUnknown_03000D20 -_08009840: - ldr r0, =gUnknown_03000D68 - adds r6, r5, r0 - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r4, r0, r7 - ldrb r0, [r6] - ldrh r1, [r4] - cmp r0, r1 - beq _08009868 - ldrh r0, [r4] - adds r2, r5, 0x4 - lsls r2, 24 - lsrs r2, 24 - movs r1, 0x2 - movs r3, 0x2 - bl sub_800A6E8 - ldrh r0, [r4] - strb r0, [r6] -_08009868: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08009840 - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0xF - bne _080098CE - movs r5, 0 - ldr r0, =gUnknown_03000D20 - mov r9, r0 - ldr r1, =0x00000342 - mov r8, r1 -_08009888: - adds r0, r7, 0 - asrs r0, r5 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080098C4 - lsls r0, r5, 8 - ldr r1, =gBlockRecvBuffer - adds r0, r1 - lsls r4, r5, 1 - adds r1, r4, r5 - lsls r1, 2 - add r1, r9 - ldrh r1, [r1, 0x2] - bl sub_800A648 - ldr r1, =gUnknown_03003148 - adds r4, r1 - movs r6, 0 - strh r0, [r4] - adds r0, r5, 0 - bl ResetBlockReceivedFlag - ldrh r0, [r4] - cmp r0, r8 - beq _080098C4 - ldr r0, =gUnknown_020223BC - strb r6, [r0] - ldr r0, =gUnknown_020223BD - strb r6, [r0] -_080098C4: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08009888 -_080098CE: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009818 - thumb_func_start sub_8009900 sub_8009900: @ 8009900 push {r4,r5,lr} @@ -4258,7 +4134,7 @@ _0800BAFC: _0800BB00: adds r0, r2, 0 strh r0, [r1] - ldr r2, =gUnknown_03003174 + ldr r2, =gUnknown_03003170+0x4 ldr r3, =0x04000120 ldr r0, [r3] ldr r1, [r3, 0x4] @@ -12005,12 +11881,12 @@ _0800F920: beq _0800F930 b _0800FC08 _0800F930: - ldr r1, =gUnknown_03003092 + ldr r1, =gUnknown_03003090+0x2 adds r0, r5, r1 ldrh r0, [r0] ldr r2, =gUnknown_03005000 strb r0, [r2, 0xD] - ldr r3, =gUnknown_03003094 + ldr r3, =gUnknown_03003090+0x4 adds r0, r5, r3 bl sub_800F74C ldr r4, =gUnknown_03005CCE @@ -12040,13 +11916,13 @@ _0800F982: adds r0, 0x80 movs r2, 0 strh r4, [r0] - ldr r1, =gUnknown_03003092 + ldr r1, =gUnknown_03003090+0x2 adds r0, r5, r1 ldrh r0, [r0] adds r1, r3, 0 adds r1, 0x82 strh r0, [r1] - ldr r1, =gUnknown_03003094 + ldr r1, =gUnknown_03003090+0x4 adds r0, r5, r1 ldrh r1, [r0] adds r0, r3, 0 @@ -12176,7 +12052,7 @@ _0800FA90: .pool _0800FAAC: ldr r2, =gUnknown_082ED6B8 - ldr r3, =gUnknown_03003092 + ldr r3, =gUnknown_03003090+0x2 adds r0, r5, r3 ldrh r1, [r0] lsls r1, 3 @@ -12200,7 +12076,7 @@ _0800FAE0: movs r4, 0x80 lsls r4, 1 adds r0, r2, r4 - ldr r3, =gUnknown_03003092 + ldr r3, =gUnknown_03003090+0x2 adds r1, r5, r3 ldrh r0, [r0] mov r6, r8 @@ -12228,7 +12104,7 @@ _0800FB10: adds r6, 0x1 cmp r0, 0 beq _0800FC08 - ldr r0, =gUnknown_03003092 + ldr r0, =gUnknown_03003090+0x2 adds r4, r5, r0 ldrh r1, [r4] ldr r0, =gUnknown_03007890 @@ -12239,7 +12115,7 @@ _0800FB10: beq _0800FB48 strb r2, [r3] bl sub_800D630 - ldr r1, =gUnknown_03003094 + ldr r1, =gUnknown_03003090+0x4 adds r0, r5, r1 ldrh r1, [r0] ldr r2, =0x00000ce4 @@ -12260,11 +12136,11 @@ _0800FB78: lsls r0, 8 bl sub_800FD14 ldr r1, =gUnknown_03003110 - ldr r3, =gUnknown_03003092 + ldr r3, =gUnknown_03003090+0x2 adds r0, r5, r3 ldrh r0, [r0] strh r0, [r1, 0x2] - ldr r4, =gUnknown_03003094 + ldr r4, =gUnknown_03003090+0x4 adds r0, r5, r4 ldrh r0, [r0] strh r0, [r1, 0x4] @@ -12284,13 +12160,13 @@ _0800FBB0: bne _0800FC44 ldr r0, =0x00000ce3 adds r2, r4, r0 - ldr r1, =gUnknown_03003092 + ldr r1, =gUnknown_03003090+0x2 adds r3, r5, r1 ldrb r1, [r3] ldrb r0, [r2] orrs r0, r1 strb r0, [r2] - ldr r2, =gUnknown_03003094 + ldr r2, =gUnknown_03003090+0x4 adds r0, r5, r2 ldrh r1, [r0] ldr r2, =0x00000ce4 @@ -12305,7 +12181,7 @@ _0800FBF4: mov r3, r8 lsls r1, r3, 1 adds r1, r0 - ldr r4, =gUnknown_03003092 + ldr r4, =gUnknown_03003090+0x2 adds r0, r5, r4 ldrh r0, [r0] strh r0, [r1] diff --git a/asm/pokenav.s b/asm/pokenav.s index 0c7a80742..86fe8813e 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -28090,7 +28090,7 @@ sub_81D4E60: @ 81D4E60 strh r0, [r1] movs r0, 0 strh r0, [r2] - ldr r0, =gUnknown_03003174 + ldr r0, =gUnknown_03003170+0x4 ldr r1, [r0, 0x4] ldr r0, [r0] str r0, [sp, 0x4] diff --git a/include/link.h b/include/link.h index fa245cbdf..662f8e5cd 100644 --- a/include/link.h +++ b/include/link.h @@ -197,17 +197,31 @@ void sub_800AC34(void); void sub_800B628(void); void sub_80097E8(void); -extern IWRAM_DATA u8 gUnknown_0300306C; -extern IWRAM_DATA u8 gUnknown_03003078[4]; -extern IWRAM_DATA u8 gUnknown_030030E4; -extern IWRAM_DATA u8 gUnknown_030030E8; -extern IWRAM_DATA u8 gUnknown_030030EC[4]; -extern IWRAM_DATA u8 gUnknown_030030F0[4]; -extern IWRAM_DATA u16 gUnknown_030030F4; -extern IWRAM_DATA u8 gUnknown_030030F8; -extern IWRAM_DATA u16 gUnknown_03003110[8]; -extern IWRAM_DATA struct LinkTestBGInfo gUnknown_03003130; // common -extern IWRAM_DATA void (*gUnknown_03003140)(void); -extern IWRAM_DATA bool8 gUnknown_03003144; +extern u16 gUnknown_03003020[6]; +extern u32 gUnknown_0300302C; +extern struct LinkPlayerBlock gUnknown_03003030; +extern bool8 gUnknown_0300306C; +extern u32 gUnknown_03003070; +extern bool8 gUnknown_03003078[4]; +extern u8 gUnknown_0300307C[4]; +extern u16 gUnknown_03003084; +extern u16 gUnknown_03003090[4][8]; +extern u32 gUnknown_030030E0; +extern u8 gUnknown_030030E4; +extern u8 gUnknown_030030E8; +extern u8 gUnknown_030030EC[4]; +extern u8 gUnknown_030030F0[4]; +extern u16 gUnknown_030030F4; +extern u8 gUnknown_030030F8; +extern bool8 gLinkVSyncDisabled; +extern bool8 gUnknown_03003100; +extern u16 gUnknown_03003110[8]; +extern u8 gUnknown_03003120; +extern struct LinkTestBGInfo gUnknown_03003130; +extern void (*gUnknown_03003140)(void); +extern bool8 gUnknown_03003144; +extern u16 gUnknown_03003148[4]; +extern u8 gUnknown_03003150; +extern u8 gUnknown_03003160; #endif // GUARD_LINK_H diff --git a/include/main.h b/include/main.h index 4b95b1919..779adb758 100644 --- a/include/main.h +++ b/include/main.h @@ -42,17 +42,14 @@ struct Main /*0x439*/ u8 field_439_x4:1; }; -extern u8 gUnknown_3001764; -extern struct Main gMain; -extern bool8 gSoftResetDisabled; -extern bool8 gLinkVSyncDisabled; - extern const u8 gGameVersion; extern const u8 gGameLanguage; extern u16 gKeyRepeatStartDelay; extern u8 gUnknown_030022B4; +extern struct Main gMain; extern u16 gKeyRepeatContinueDelay; +extern bool8 gSoftResetDisabled; extern IntrFunc gIntrTable[]; extern u8 gUnknown_03002748; extern u32 IntrMain_Buffer[]; diff --git a/src/link.c b/src/link.c index bcad97f53..823a9a96b 100644 --- a/src/link.c +++ b/src/link.c @@ -57,7 +57,37 @@ IWRAM_DATA void *gUnknown_03000DA8; IWRAM_DATA void *gUnknown_03000DAC; IWRAM_DATA bool32 gUnknown_03000DB0; -bool8 gUnknown_020229C4 = 0; +u16 gUnknown_03003020[6]; +u32 gUnknown_0300302C; +struct LinkPlayerBlock gUnknown_03003030; +bool8 gUnknown_0300306C; +u32 gUnknown_03003070; +bool8 gUnknown_03003078[4]; +u8 gUnknown_0300307C[4]; +u16 gUnknown_03003084; +u16 gUnknown_03003090[4][8]; +u32 gUnknown_030030E0; +u8 gUnknown_030030E4; +bool8 gUnknown_030030E8; +u8 gUnknown_030030EC[4]; +u8 gUnknown_030030F0[4]; +u16 gUnknown_030030F4; +u8 gUnknown_030030F8; +bool8 gLinkVSyncDisabled; +bool8 gUnknown_03003100; +u16 gUnknown_03003110[8]; +u8 gUnknown_03003120; +bool8 gReceivedRemoteLinkPlayers; +struct LinkTestBGInfo gUnknown_03003130; +void (*gUnknown_03003140)(void); +bool8 gUnknown_03003144; +u16 gUnknown_03003148[4]; +u8 gUnknown_03003150; +u8 gUnknown_03003160; + +u8 gUnknown_020223BC = 0; +u8 gUnknown_020223BD = 0; +bool8 gUnknown_020229C4 = FALSE; u16 gUnknown_020229C6 = 0; struct LinkPlayer gUnknown_020229CC = {}; @@ -68,11 +98,15 @@ void sub_80096BC(void); void c2_08009A8C(void); void sub_800A2E0(void); void task00_link_test(u8 taskId); +u16 sub_800A648(u16 *src, u16 size); +void sub_800A6E8(u32 pos, u8 a0, u8 a1, u8 a2); void sub_800A824(void); void sub_800B594(void); void sub_800B4A4(void); +void sub_800B53C(void); u32 sub_800BEC0(void); void sub_800E700(void); +void sub_800EDD4(void); // .rodata @@ -266,3 +300,51 @@ void sub_8009734(void) gUnknown_030030EC[i] = 0; } } + +void sub_80097E8(void) +{ + gReceivedRemoteLinkPlayers = FALSE; + if (gLinkVSyncDisabled) + { + sub_800EDD4(); + } + gUnknown_020229C4 = FALSE; + sub_800B53C(); +} + +void sub_8009818(void) +{ + u8 i; + u8 status; + + if (gUnknown_03000D64 != gUnknown_03000D10.pos) + { + sub_800A6E8(gUnknown_03000D10.pos, 2, 3, 2); + gUnknown_03000D64 = gUnknown_03000D10.pos; + } + for (i = 0; i < 4; i ++) + { + if (gUnknown_03000D68[i] != gUnknown_03000D20[i].pos) + { + sub_800A6E8(gUnknown_03000D20[i].pos, 2, i + 4, 2); + gUnknown_03000D68[i] = gUnknown_03000D20[i].pos; + } + } + status = GetBlockReceivedStatus(); + if (status == 0xF) // 0b1111 + { + for (i = 0; i < 4; i ++) + { + if ((status >> i) & 1) + { + gUnknown_03003148[i] = sub_800A648(gBlockRecvBuffer[i], gUnknown_03000D20[i].size); + ResetBlockReceivedFlag(i); + if (gUnknown_03003148[i] != 0x0342) + { + gUnknown_020223BC = 0; + gUnknown_020223BD = 0; + } + } + } + } +} diff --git a/src/main.c b/src/main.c index 80993f0d0..b7758f1f9 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include "global.h" #include "main.h" +#include "link.h" #include "m4a.h" #include "rtc.h" #include "rng.h" diff --git a/sym_common.txt b/sym_common.txt index 929ce0e97..7a35ae5bd 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -37,13 +37,7 @@ gUnknown_03003084: @ 3003084 .space 0xC gUnknown_03003090: @ 3003090 - .space 0x2 - -gUnknown_03003092: @ 3003092 - .space 0x2 - -gUnknown_03003094: @ 3003094 - .space 0x4C + .space 0x50 gUnknown_030030E0: @ 30030E0 .space 0x4 @@ -100,10 +94,7 @@ gUnknown_03003160: @ 3003160 .space 0x10 gUnknown_03003170: @ 3003170 - .space 0x4 - -gUnknown_03003174: @ 3003174 - .space 0xFBC + .space 0xFC0 gUnknown_03004130: @ 3004130 .space 0x4 From 9a9f6012441a4ed0f7ba1566a3f693801957ef12 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 8 Nov 2017 19:58:59 -0500 Subject: [PATCH 008/123] sub_8009900 --- asm/link.s | 86 -------------------------------------------------- include/link.h | 1 + include/save.h | 2 +- src/link.c | 38 +++++++++++++++++++++- 4 files changed, 39 insertions(+), 88 deletions(-) diff --git a/asm/link.s b/asm/link.s index 28d2ec0c9..345a68899 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,92 +5,6 @@ .text - thumb_func_start sub_8009900 -sub_8009900: @ 8009900 - push {r4,r5,lr} - sub sp, 0x4 - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08009916 - ldr r1, =gUnknown_03003144 - movs r0, 0x1 - strb r0, [r1] -_08009916: - ldrh r1, [r4, 0x2C] - movs r5, 0x2 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _0800992A - ldr r0, =0x02004000 - ldr r1, =0x00002004 - bl sub_800A2F4 -_0800992A: - ldrh r1, [r4, 0x2E] - movs r0, 0x80 - lsls r0, 2 - ands r0, r1 - cmp r0, 0 - beq _08009946 - movs r0, 0x1 - negs r0, r0 - str r5, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_08009946: - ldrh r1, [r4, 0x2E] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _08009956 - movs r0, 0x1 - bl sub_800B330 -_08009956: - ldrh r1, [r4, 0x2E] - movs r0, 0x80 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _08009968 - movs r0, 0x1 - bl TrySavingData -_08009968: - ldrh r1, [r4, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08009976 - bl sub_800AC34 -_08009976: - ldr r0, =gUnknown_020223BC - ldrb r0, [r0] - cmp r0, 0 - beq _08009996 - ldr r2, [r4, 0x24] - ldr r0, =gUnknown_03002748 - ldrb r1, [r0] - ldr r0, =gUnknown_03003140 - ldr r0, [r0] - cmp r0, 0 - bne _08009990 - movs r0, 0x10 - orrs r1, r0 -_08009990: - adds r0, r2, 0 - bl sub_800A994 -_08009996: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009900 - thumb_func_start c2_08009A8C c2_08009A8C: @ 80099BC push {lr} diff --git a/include/link.h b/include/link.h index 662f8e5cd..5d9471826 100644 --- a/include/link.h +++ b/include/link.h @@ -196,6 +196,7 @@ void sub_800AC34(void); void sub_800B628(void); void sub_80097E8(void); +void sub_800A994(u32 seed, u8 flags); extern u16 gUnknown_03003020[6]; extern u32 gUnknown_0300302C; diff --git a/include/save.h b/include/save.h index 6c1238cd2..f010b3415 100644 --- a/include/save.h +++ b/include/save.h @@ -77,7 +77,7 @@ u8 GetSaveValidStatus(const struct SaveSectionLocation *location); u8 DoReadFlashWholeSection(u8, struct SaveSection *); u16 CalculateChecksum(void *, u16); u8 HandleSavingData(u8 saveType); -//u8 TrySavingData(u8 saveType); +u8 TrySavingData(u8 saveType); //u8 sub_8125D80(void); //bool8 sub_8125DA8(void); //u8 sub_8125DDC(void); diff --git a/src/link.c b/src/link.c index 823a9a96b..327a170d0 100644 --- a/src/link.c +++ b/src/link.c @@ -1,6 +1,8 @@ // Includes #include "global.h" +#include "malloc.h" +#include "save.h" #include "librfu.h" #include "rng.h" #include "string_util.h" @@ -97,13 +99,15 @@ void sub_8009638(void); void sub_80096BC(void); void c2_08009A8C(void); void sub_800A2E0(void); +void sub_800A2F4(void *heapptr, size_t src); void task00_link_test(u8 taskId); u16 sub_800A648(u16 *src, u16 size); void sub_800A6E8(u32 pos, u8 a0, u8 a1, u8 a2); void sub_800A824(void); -void sub_800B594(void); +void sub_800B330(bool8 flag); void sub_800B4A4(void); void sub_800B53C(void); +void sub_800B594(void); u32 sub_800BEC0(void); void sub_800E700(void); void sub_800EDD4(void); @@ -348,3 +352,35 @@ void sub_8009818(void) } } } + +void sub_8009900(void) +{ + if (gMain.newKeys & A_BUTTON) + { + gUnknown_03003144 = TRUE; + } + if (gMain.heldKeys & B_BUTTON) + { + sub_800A2F4(gHeap + 0x4000, 0x00002004); + } + if (gMain.newKeys & L_BUTTON) + { + BeginNormalPaletteFade(-1, 0, 16, 0, 2); + } + if (gMain.newKeys & START_BUTTON) + { + sub_800B330(1); + } + if (gMain.newKeys & R_BUTTON) + { + TrySavingData(1); + } + if (gMain.newKeys & SELECT_BUTTON) + { + sub_800AC34(); + } + if (gUnknown_020223BC) + { + sub_800A994(gMain.vblankCounter2, gUnknown_03003140 ? gUnknown_03002748 : gUnknown_03002748 | 0x10); + } +} From d51f87226f029143dfb027f5e7bc36c64c5959eb Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 8 Nov 2017 20:11:29 -0500 Subject: [PATCH 009/123] sub_80099E0 --- asm/link.s | 71 ------------------------------------------------------ src/link.c | 46 ++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 72 deletions(-) diff --git a/asm/link.s b/asm/link.s index 345a68899..cedc3077f 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,77 +5,6 @@ .text - thumb_func_start c2_08009A8C -c2_08009A8C: @ 80099BC - push {lr} - bl sub_8009900 - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - bl sub_8009818 - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end c2_08009A8C - - thumb_func_start sub_80099E0 -sub_80099E0: @ 80099E0 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_020229C4 - ldrb r0, [r0] - cmp r0, 0 - bne _080099F4 - movs r0, 0 - b _08009A3C - .pool -_080099F4: - movs r1, 0 - ldr r5, =gUnknown_03003084 - ldr r3, =gUnknown_03003110 - movs r2, 0 -_080099FC: - lsls r0, r1, 1 - adds r0, r3 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x7 - bls _080099FC - ldrh r0, [r4] - strh r0, [r5] - ldr r0, =gUnknown_030030E0 - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08009A38 - ldr r0, =0x04000128 - ldr r0, [r0] - lsls r0, 26 - lsrs r0, 30 - bl sub_8009AA0 - ldr r0, =gUnknown_03003140 - ldr r0, [r0] - cmp r0, 0 - beq _08009A34 - bl _call_via_r0 -_08009A34: - bl sub_800AEB4 -_08009A38: - ldr r0, =gUnknown_030030E0 - ldrh r0, [r0] -_08009A3C: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80099E0 - thumb_func_start sub_8009A58 sub_8009A58: @ 8009A58 push {r4-r6,lr} diff --git a/src/link.c b/src/link.c index 327a170d0..c07a6d701 100644 --- a/src/link.c +++ b/src/link.c @@ -31,6 +31,13 @@ struct LinkTestBGInfo u32 dummy_C; }; +struct SIOCnt { + u32 cnt0_0:4; + u32 cnt0_2:2; +}; + +#define REG_SIOCNT_STRUCT (*(volatile struct SIOCnt *)REG_ADDR_SIOCNT) + // Static RAM declarations IWRAM_DATA struct BlockTransfer gUnknown_03000D10; @@ -98,12 +105,14 @@ struct LinkPlayer gUnknown_020229CC = {}; void sub_8009638(void); void sub_80096BC(void); void c2_08009A8C(void); +void sub_8009AA0(u8 unused); void sub_800A2E0(void); void sub_800A2F4(void *heapptr, size_t src); void task00_link_test(u8 taskId); u16 sub_800A648(u16 *src, u16 size); void sub_800A6E8(u32 pos, u8 a0, u8 a1, u8 a2); void sub_800A824(void); +void sub_800AEB4(void); void sub_800B330(bool8 flag); void sub_800B4A4(void); void sub_800B53C(void); @@ -316,7 +325,7 @@ void sub_80097E8(void) sub_800B53C(); } -void sub_8009818(void) +static void sub_8009818(u8 nothing, u8 is, u8 used) { u8 i; u8 status; @@ -384,3 +393,38 @@ void sub_8009900(void) sub_800A994(gMain.vblankCounter2, gUnknown_03003140 ? gUnknown_03002748 : gUnknown_03002748 | 0x10); } } + +void c2_08009A8C(void) +{ + sub_8009900(); + sub_8009818(1, 1, 0); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +u16 sub_80099E0(const u16 *src) +{ + u8 i; + + if (!gUnknown_020229C4) + { + return 0; + } + for (i = 0; i < 8; i ++) + { + gUnknown_03003110[i] = 0; + } + gUnknown_03003084 = *src; + if (gUnknown_030030E0 & 0x40) + { + sub_8009AA0(REG_SIOCNT_STRUCT.cnt0_2); + if (gUnknown_03003140 != NULL) + { + gUnknown_03003140(); + } + sub_800AEB4(); + } + return gUnknown_030030E0; +} From 6192cb2eea52a4e060bd7d8db884e9133d8b882f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 8 Nov 2017 20:48:26 -0500 Subject: [PATCH 010/123] sub_8009A58 --- asm/link.s | 39 --------------------------------------- src/link.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/asm/link.s b/asm/link.s index cedc3077f..20eba107b 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,45 +5,6 @@ .text - thumb_func_start sub_8009A58 -sub_8009A58: @ 8009A58 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - ldr r1, =gUnknown_03003078 - adds r0, r1 - strb r5, [r0] - movs r4, 0 - adds r6, r1, 0 - b _08009A78 - .pool -_08009A70: - adds r0, r4, r6 - ldrb r0, [r0] - adds r5, r0 - adds r4, 0x1 -_08009A78: - bl sub_800ABAC - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _08009A70 - cmp r5, 0 - bne _08009A94 - ldr r1, =gReceivedRemoteLinkPlayers - ldrb r0, [r1] - cmp r0, 0 - bne _08009A94 - movs r0, 0x1 - strb r0, [r1] -_08009A94: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009A58 - thumb_func_start sub_8009AA0 sub_8009AA0: @ 8009AA0 push {r4-r7,lr} diff --git a/src/link.c b/src/link.c index c07a6d701..e99f6764f 100644 --- a/src/link.c +++ b/src/link.c @@ -428,3 +428,20 @@ u16 sub_80099E0(const u16 *src) } return gUnknown_030030E0; } + +void sub_8009A58(u8 who) +{ + int i; + int count; + + count = 0; + gUnknown_03003078[who] = FALSE; + for (i = 0; i < sub_800ABAC(); i ++) + { + count += gUnknown_03003078[i]; + } + if (count == 0 && gReceivedRemoteLinkPlayers == 0) + { + gReceivedRemoteLinkPlayers = 1; + } +} From d94f74d2617f257c0cdcc19cfb08dc76ea0ec4ad Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 9 Nov 2017 21:14:43 -0500 Subject: [PATCH 011/123] sub_8009AA0 --- asm/link.s | 343 ------------------------------------------- data/link.s | 7 - include/decompress.h | 2 + src/link.c | 165 ++++++++++++++++++--- 4 files changed, 148 insertions(+), 369 deletions(-) diff --git a/asm/link.s b/asm/link.s index 20eba107b..c731430e5 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,349 +5,6 @@ .text - thumb_func_start sub_8009AA0 -sub_8009AA0: @ 8009AA0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r6, 0 -_08009AAE: - ldr r0, =gUnknown_03003020 - lsls r1, r6, 1 - adds r3, r1, r0 - movs r0, 0 - strh r0, [r3] - lsls r4, r6, 4 - ldr r5, =gUnknown_03003090 - adds r2, r4, r5 - ldrh r0, [r2] - mov r12, r1 - adds r7, r6, 0x1 - str r7, [sp] - cmp r0, 0 - bne _08009ACC - b _08009D6E -_08009ACC: - ldrh r1, [r2] - ldr r0, =0x00005fff - cmp r1, r0 - bne _08009AD6 - b _08009D20 -_08009AD6: - cmp r1, r0 - bgt _08009B24 - ldr r0, =0x00004444 - cmp r1, r0 - bne _08009AE2 - b _08009D64 -_08009AE2: - cmp r1, r0 - bgt _08009B10 - ldr r0, =0x00002222 - cmp r1, r0 - beq _08009B68 - ldr r0, =0x00002ffe - cmp r1, r0 - bne _08009AF4 - b _08009D28 -_08009AF4: - b _08009D6E - .pool -_08009B10: - ldr r0, =0x00005555 - cmp r1, r0 - beq _08009BB8 - adds r0, 0x11 - cmp r1, r0 - beq _08009BB8 - b _08009D6E - .pool -_08009B24: - ldr r0, =0x0000bbbb - cmp r1, r0 - beq _08009BC4 - cmp r1, r0 - bgt _08009B4C - ldr r0, =0x00008888 - cmp r1, r0 - beq _08009BF0 - ldr r0, =0x0000aaaa - cmp r1, r0 - bne _08009B3C - b _08009D38 -_08009B3C: - b _08009D6E - .pool -_08009B4C: - ldr r0, =0x0000cafe - cmp r1, r0 - bne _08009B54 - b _08009D64 -_08009B54: - ldr r0, =0x0000cccc - cmp r1, r0 - bne _08009B5C - b _08009D3E -_08009B5C: - b _08009D6E - .pool -_08009B68: - bl sub_8009638 - ldr r0, =gUnknown_03003030 - adds r2, r0, 0 - adds r2, 0x10 - ldr r1, =gUnknown_020229CC - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3,r6,r7} - stm r2!, {r3,r6,r7} - ldr r1, [r1] - str r1, [r2] - ldr r4, =gASCIIGameFreakInc - adds r2, r0, 0 - adds r1, r4, 0 - ldm r1!, {r5-r7} - stm r2!, {r5-r7} - ldrh r3, [r1] - strh r3, [r2] - ldrb r1, [r1, 0x2] - strb r1, [r2, 0x2] - adds r1, r0, 0 - adds r1, 0x2C - ldm r4!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldrh r2, [r4] - strh r2, [r1] - ldrb r2, [r4, 0x2] - strb r2, [r1, 0x2] - movs r1, 0x3C - bl sub_800A2F4 - b _08009D6E - .pool -_08009BB8: - ldr r1, =gUnknown_030030E8 - movs r0, 0x1 - strb r0, [r1] - b _08009D6E - .pool -_08009BC4: - mov r7, r12 - adds r1, r7, r6 - lsls r1, 2 - ldr r0, =gUnknown_03000D20 - adds r1, r0 - movs r2, 0 - strh r2, [r1] - ldr r0, =gUnknown_03003090 - adds r0, 0x2 - adds r0, r4, r0 - ldrh r0, [r0] - strh r0, [r1, 0x2] - ldr r0, =gUnknown_03003090 - adds r0, 0x4 - adds r0, r4, r0 - ldrh r0, [r0] - strb r0, [r1, 0x9] - b _08009D6E - .pool -_08009BF0: - mov r3, r12 - adds r0, r3, r6 - lsls r0, 2 - ldr r5, =gUnknown_03000D20 - adds r3, r0, r5 - ldrh r1, [r3, 0x2] - movs r0, 0x80 - lsls r0, 1 - adds r7, r5, 0 - mov r10, r7 - cmp r1, r0 - bls _08009C40 - ldr r0, =0x0201c000 - mov r8, r0 - movs r2, 0 - adds r5, r3, 0 - ldr r7, =gUnknown_03003090 - adds r3, r4, 0 -_08009C14: - ldrh r1, [r5] - lsrs r1, 1 - adds r1, r2 - lsls r1, 1 - add r1, r8 - adds r2, 0x1 - lsls r0, r2, 1 - adds r0, r3 - adds r0, r7 - ldrh r0, [r0] - strh r0, [r1] - lsls r2, 16 - lsrs r2, 16 - cmp r2, 0x6 - bls _08009C14 - b _08009C70 - .pool -_08009C40: - movs r2, 0 - ldr r1, =gBlockRecvBuffer - mov r9, r1 - adds r7, r3, 0 - ldr r3, =gUnknown_03003090 - mov r8, r3 - lsls r5, r6, 8 - adds r3, r4, 0 -_08009C50: - ldrh r1, [r7] - lsrs r1, 1 - adds r1, r2 - lsls r1, 1 - adds r1, r5 - add r1, r9 - adds r2, 0x1 - lsls r0, r2, 1 - adds r0, r3 - add r0, r8 - ldrh r0, [r0] - strh r0, [r1] - lsls r2, 16 - lsrs r2, 16 - cmp r2, 0x6 - bls _08009C50 -_08009C70: - mov r4, r12 - adds r1, r4, r6 - lsls r1, 2 - add r1, r10 - ldrh r0, [r1] - adds r0, 0xE - movs r3, 0 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r1, 0x2] - cmp r0, r1 - bcc _08009D6E - ldr r0, =gUnknown_03003078 - adds r0, r6, r0 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08009D16 - lsls r1, r6, 8 - ldr r0, =gBlockRecvBuffer - adds r1, r0 - mov r8, r1 - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - ldr r1, =gLinkPlayers - adds r2, r0, r1 - adds r1, r2, 0 - mov r0, r8 - adds r0, 0x10 - ldm r0!, {r4,r5,r7} - stm r1!, {r4,r5,r7} - ldm r0!, {r4,r5,r7} - stm r1!, {r4,r5,r7} - ldr r0, [r0] - str r0, [r1] - ldrb r0, [r2] - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bhi _08009CCA - strb r3, [r2, 0x12] - strb r3, [r2, 0x11] - strb r3, [r2, 0x10] -_08009CCA: - adds r0, r2, 0 - bl sub_800B524 - ldr r5, =gASCIIGameFreakInc - mov r0, r8 - adds r1, r5, 0 - bl strcmp - cmp r0, 0 - bne _08009CEC - mov r0, r8 - adds r0, 0x2C - adds r1, r5, 0 - bl strcmp - cmp r0, 0 - beq _08009D0C -_08009CEC: - ldr r0, =c2_800ACD4 - bl SetMainCallback2 - b _08009D6E - .pool -_08009D0C: - lsls r0, r6, 24 - lsrs r0, 24 - bl sub_8009A58 - b _08009D6E -_08009D16: - lsls r0, r6, 24 - lsrs r0, 24 - bl sub_800A588 - b _08009D6E -_08009D20: - ldr r0, =gUnknown_030030F0 - b _08009D2A - .pool -_08009D28: - ldr r0, =gUnknown_030030EC -_08009D2A: - adds r0, r6, r0 - movs r1, 0x1 - strb r1, [r0] - b _08009D6E - .pool -_08009D38: - bl sub_800A418 - b _08009D6E -_08009D3E: - ldr r3, =gUnknown_082ED1A8 - ldr r0, =gUnknown_03003090 - adds r0, 0x2 - adds r0, r4, r0 - ldrh r2, [r0] - lsls r2, 3 - adds r0, r2, r3 - ldr r1, [r0] - adds r3, 0x4 - adds r2, r3 - ldrh r2, [r2] - movs r0, 0 - bl SendBlock - b _08009D6E - .pool -_08009D64: - ldr r0, =gUnknown_03003090 - adds r0, 0x2 - adds r0, r4, r0 - ldrh r0, [r0] - strh r0, [r3] -_08009D6E: - ldr r5, [sp] - lsls r0, r5, 16 - lsrs r6, r0, 16 - cmp r6, 0x3 - bhi _08009D7A - b _08009AAE -_08009D7A: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009AA0 - thumb_func_start sub_8009D90 sub_8009D90: @ 8009D90 push {lr} diff --git a/data/link.s b/data/link.s index 51e9d0c70..f679e4b14 100644 --- a/data/link.s +++ b/data/link.s @@ -7,13 +7,6 @@ .align 2 -gASCIIGameFreakInc:: @ 82ED1D4 - .ascii "GameFreak inc." - - .align 2 -gASCIITestPrint:: @ 82ED1E4 - .ascii "TEST PRINT\nP0\nP1\nP2\nP3" - .align 2 gUnknown_082ED1FC:: @ 82ED1FC BgTemplate .4byte 0x000001F8 diff --git a/include/decompress.h b/include/decompress.h index c3a771893..92292e9ce 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -26,4 +26,6 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic); void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic); +extern u8 gDecompressionBuffer[]; + #endif // GUARD_DECOMPRESS_H diff --git a/src/link.c b/src/link.c index e99f6764f..4279c6efc 100644 --- a/src/link.c +++ b/src/link.c @@ -5,6 +5,7 @@ #include "save.h" #include "librfu.h" #include "rng.h" +#include "decompress.h" #include "string_util.h" #include "event_data.h" #include "gpu_regs.h" @@ -42,14 +43,14 @@ struct SIOCnt { IWRAM_DATA struct BlockTransfer gUnknown_03000D10; IWRAM_DATA u32 link_c_unused_03000d1c; -IWRAM_DATA struct BlockTransfer gUnknown_03000D20[4]; +IWRAM_DATA struct BlockTransfer gUnknown_03000D20[MAX_LINK_PLAYERS]; IWRAM_DATA u32 gUnknown_03000D50; IWRAM_DATA u32 gUnknown_03000D54; IWRAM_DATA u8 gUnknown_03000D58; IWRAM_DATA u32 gUnknown_03000D5C; IWRAM_DATA u32 gUnknown_03000D60; IWRAM_DATA u8 gUnknown_03000D64; -ALIGNED() IWRAM_DATA u8 gUnknown_03000D68[4]; +ALIGNED() IWRAM_DATA u8 gUnknown_03000D68[MAX_LINK_PLAYERS]; IWRAM_DATA u8 gUnknown_03000D6C; IWRAM_DATA bool8 gUnknown_03000D6D; IWRAM_DATA u16 gUnknown_03000D6E; @@ -71,15 +72,15 @@ u32 gUnknown_0300302C; struct LinkPlayerBlock gUnknown_03003030; bool8 gUnknown_0300306C; u32 gUnknown_03003070; -bool8 gUnknown_03003078[4]; -u8 gUnknown_0300307C[4]; +bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; +u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; u16 gUnknown_03003084; -u16 gUnknown_03003090[4][8]; +u16 gUnknown_03003090[MAX_LINK_PLAYERS][8]; u32 gUnknown_030030E0; u8 gUnknown_030030E4; bool8 gUnknown_030030E8; -u8 gUnknown_030030EC[4]; -u8 gUnknown_030030F0[4]; +u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; +u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; u16 gUnknown_030030F4; u8 gUnknown_030030F8; bool8 gLinkVSyncDisabled; @@ -90,7 +91,7 @@ bool8 gReceivedRemoteLinkPlayers; struct LinkTestBGInfo gUnknown_03003130; void (*gUnknown_03003140)(void); bool8 gUnknown_03003144; -u16 gUnknown_03003148[4]; +u16 gUnknown_03003148[MAX_LINK_PLAYERS]; u8 gUnknown_03003150; u8 gUnknown_03003160; @@ -104,17 +105,21 @@ struct LinkPlayer gUnknown_020229CC = {}; void sub_8009638(void); void sub_80096BC(void); -void c2_08009A8C(void); -void sub_8009AA0(u8 unused); +static void c2_08009A8C(void); +static void sub_8009AA0(u8 unused); void sub_800A2E0(void); void sub_800A2F4(void *heapptr, size_t src); +void sub_800A418(void); void task00_link_test(u8 taskId); +void sub_800A588(u8 who); u16 sub_800A648(u16 *src, u16 size); void sub_800A6E8(u32 pos, u8 a0, u8 a1, u8 a2); void sub_800A824(void); +void c2_800ACD4(void); void sub_800AEB4(void); void sub_800B330(bool8 flag); void sub_800B4A4(void); +void sub_800B524(struct LinkPlayer *linkPlayer); void sub_800B53C(void); void sub_800B594(void); u32 sub_800BEC0(void); @@ -130,10 +135,7 @@ const u16 gLinkTestDigitsPal[] = INCBIN_U16("graphics/interface/link_test_digits const u16 gLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits.4bpp"); const u8 unkstring_82ed160[] = _("{HIGHLIGHT TRANSPARENT}{COLOR WHITE}"); const u16 g2BlankTilesGfx[] = INCBIN_U16("graphics/interface/blank_1x2.4bpp"); -const struct { - void *data; - u16 size; -} gUnknown_082ED1A8[] = { +const struct BlockRequest gUnknown_082ED1A8[] = { {gUnknown_020228C4, 200}, {gUnknown_020228C4, 200}, {gUnknown_020228C4, 100}, @@ -146,6 +148,9 @@ const u8 gUnknown_082ED1D0[] = { REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT }; +const char gASCIIGameFreakInc[] = "GameFreak inc."; +const char gASCIITestPrint[] = "TEST PRINT\nP0\nP1\nP2\nP3"; + // .text @@ -215,7 +220,7 @@ void sub_8009570(void) gUnknown_020229C6 = 0x1111; sub_8009734(); SeedRng(gMain.vblankCounter2); - for (i = 0; i < 4; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i ++) { gSaveBlock2Ptr->playerTrainerId[i] = Random() % 256; } @@ -306,7 +311,7 @@ void sub_8009734(void) sub_800E700(); } gReceivedRemoteLinkPlayers = 0; - for (i = 0; i < 4; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i ++) { gUnknown_03003078[i] = 1; gUnknown_030030F0[i] = 0; @@ -335,7 +340,7 @@ static void sub_8009818(u8 nothing, u8 is, u8 used) sub_800A6E8(gUnknown_03000D10.pos, 2, 3, 2); gUnknown_03000D64 = gUnknown_03000D10.pos; } - for (i = 0; i < 4; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i ++) { if (gUnknown_03000D68[i] != gUnknown_03000D20[i].pos) { @@ -346,7 +351,7 @@ static void sub_8009818(u8 nothing, u8 is, u8 used) status = GetBlockReceivedStatus(); if (status == 0xF) // 0b1111 { - for (i = 0; i < 4; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i ++) { if ((status >> i) & 1) { @@ -394,7 +399,7 @@ void sub_8009900(void) } } -void c2_08009A8C(void) +static void c2_08009A8C(void) { sub_8009900(); sub_8009818(1, 1, 0); @@ -445,3 +450,125 @@ void sub_8009A58(u8 who) gReceivedRemoteLinkPlayers = 1; } } + +static void sub_8009AA0(u8 unused) +{ + u16 i; + + for (i = 0; i < MAX_LINK_PLAYERS; i ++) + { + gUnknown_03003020[i] = 0; + if (gUnknown_03003090[i][0] == 0) + { + continue; + } + switch (gUnknown_03003090[i][0]) + { + case 0x2222: + { + struct LinkPlayerBlock *block; + + sub_8009638(); + block = &gUnknown_03003030; + block->linkPlayer = gUnknown_020229CC; + memcpy(block->magic1, gASCIIGameFreakInc, sizeof(block->magic1) - 1); + memcpy(block->magic2, gASCIIGameFreakInc, sizeof(block->magic2) - 1); + sub_800A2F4(block, sizeof(*block)); + break; + } + case 0x4444: + gUnknown_03003020[i] = gUnknown_03003090[i][1]; + break; + case 0x5555: + gUnknown_030030E8 = 1; + break; + case 0x5566: + gUnknown_030030E8 = 1; + break; + case 0xBBBB: + { + struct BlockTransfer *blockRecv; + + blockRecv = &gUnknown_03000D20[i]; + blockRecv->pos = 0; + blockRecv->size = gUnknown_03003090[i][1]; + blockRecv->multiplayerId = gUnknown_03003090[i][2]; + break; + } + case 0x8888: + { + if (gUnknown_03000D20[i].size > BLOCK_BUFFER_SIZE) + { + u16 *buffer; + u16 j; + + buffer = (u16 *)gDecompressionBuffer; + for (j = 0; j < CMD_LENGTH - 1; j ++) + { + buffer[(gUnknown_03000D20[i].pos / 2) + j] = gUnknown_03003090[i][j + 1]; + } + } + else + { + u16 j; + + for (j = 0; j < CMD_LENGTH - 1; j ++) + { + gBlockRecvBuffer[i][(gUnknown_03000D20[i].pos / 2) + j] = gUnknown_03003090[i][j + 1]; + } + } + + gUnknown_03000D20[i].pos += (CMD_LENGTH - 1) * 2; + + if (gUnknown_03000D20[i].pos >= gUnknown_03000D20[i].size) + { + if (gUnknown_03003078[i] == TRUE) + { + struct LinkPlayerBlock *block; + struct LinkPlayer *linkPlayer; + + block = (struct LinkPlayerBlock *)&gBlockRecvBuffer[i]; + linkPlayer = &gLinkPlayers[i]; + *linkPlayer = block->linkPlayer; + if ((linkPlayer->version & 0xFF) == VERSION_RUBY || (linkPlayer->version & 0xFF) == VERSION_SAPPHIRE) + { + linkPlayer->name[10] = 0; + linkPlayer->name[9] = 0; + linkPlayer->name[8] = 0; + } + sub_800B524(linkPlayer); + if (strcmp(block->magic1, gASCIIGameFreakInc) != 0 + || strcmp(block->magic2, gASCIIGameFreakInc) != 0) + { + SetMainCallback2(c2_800ACD4); + } + else + { + sub_8009A58(i); + } + } + else + { + sub_800A588(i); + } + } + } + break; + case 0x5FFF: + gUnknown_030030F0[i] = 1; + break; + case 0x2FFE: + gUnknown_030030EC[i] = 1; + break; + case 0xAAAA: + sub_800A418(); + break; + case 0xCCCC: + SendBlock(0, gUnknown_082ED1A8[gUnknown_03003090[i][1]].address, gUnknown_082ED1A8[gUnknown_03003090[i][1]].size); + break; + case 0xCAFE: + gUnknown_03003020[i] = gUnknown_03003090[i][1]; + break; + } + } +} From 1523d5c01e1745ad2f7c627c5701ab65de375f12 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 9 Nov 2017 21:48:27 -0500 Subject: [PATCH 012/123] sub_8009D90 --- asm/link.s | 167 -------------------------------------------- include/item_menu.h | 2 + include/main.h | 2 +- include/overworld.h | 1 + src/link.c | 69 ++++++++++++++++++ src/main.c | 14 ++-- 6 files changed, 80 insertions(+), 175 deletions(-) diff --git a/asm/link.s b/asm/link.s index c731430e5..0989f7d0c 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,173 +5,6 @@ .text - thumb_func_start sub_8009D90 -sub_8009D90: @ 8009D90 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =0x00006666 - cmp r2, r0 - beq _08009E60 - cmp r2, r0 - bgt _08009DF0 - ldr r0, =0x00004444 - cmp r2, r0 - beq _08009E4C - cmp r2, r0 - bgt _08009DCC - ldr r0, =0x00002222 - cmp r2, r0 - beq _08009E38 - ldr r0, =0x00002ffe -_08009DB2: - cmp r2, r0 - bne _08009DB8 - b _08009EE4 -_08009DB8: - b _08009F06 - .pool -_08009DCC: - ldr r0, =0x00005566 - cmp r2, r0 - bne _08009DD4 - b _08009EE4 -_08009DD4: - cmp r2, r0 - bgt _08009DE0 - subs r0, 0x11 - b _08009DB2 - .pool -_08009DE0: - ldr r0, =0x00005fff - cmp r2, r0 - bne _08009DE8 - b _08009ED0 -_08009DE8: - b _08009F06 - .pool -_08009DF0: - ldr r0, =0x0000aaab - cmp r2, r0 - beq _08009EA8 - cmp r2, r0 - bgt _08009E10 - ldr r0, =0x00007777 - cmp r2, r0 - beq _08009E6C - ldr r0, =0x0000aaaa - b _08009DB2 - .pool -_08009E10: - ldr r0, =0x0000cafe - cmp r2, r0 - beq _08009EF0 - cmp r2, r0 - bgt _08009E2C - ldr r0, =0x0000bbbb - cmp r2, r0 - beq _08009E8C - b _08009F06 - .pool -_08009E2C: - ldr r0, =0x0000cccc - cmp r2, r0 - beq _08009EBC - b _08009F06 - .pool -_08009E38: - ldr r0, =gUnknown_03003110 - strh r2, [r0] - ldr r1, =gUnknown_020229C6 - ldrh r1, [r1] - b _08009F04 - .pool -_08009E4C: - ldr r0, =gUnknown_03003110 - strh r2, [r0] - ldr r1, =gMain - ldrh r1, [r1, 0x2C] - b _08009F04 - .pool -_08009E60: - ldr r0, =gUnknown_03003110 - movs r1, 0 - b _08009F02 - .pool -_08009E6C: - ldr r0, =gUnknown_03003110 - strh r2, [r0] - movs r1, 0 - adds r3, r0, 0 - movs r2, 0xEE -_08009E76: - adds r1, 0x1 - lsls r0, r1, 1 - adds r0, r3 - strh r2, [r0] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x4 - bls _08009E76 - b _08009F06 - .pool -_08009E8C: - ldr r1, =gUnknown_03003110 - strh r2, [r1] - ldr r2, =gUnknown_03000D10 - ldrh r0, [r2, 0x2] - strh r0, [r1, 0x2] - ldrb r0, [r2, 0x9] - adds r0, 0x80 - strh r0, [r1, 0x4] - b _08009F06 - .pool -_08009EA8: - ldr r0, =gUnknown_03003110 - strh r2, [r0] - ldr r1, =gScriptItemId - ldrh r1, [r1] - b _08009F04 - .pool -_08009EBC: - ldr r0, =gUnknown_03003110 - strh r2, [r0] - ldr r1, =gUnknown_03003150 - ldrb r1, [r1] - b _08009F04 - .pool -_08009ED0: - ldr r0, =gUnknown_03003110 - strh r2, [r0] - ldr r1, =gUnknown_030030F4 - ldrh r1, [r1] - b _08009F04 - .pool -_08009EE4: - ldr r0, =gUnknown_03003110 - strh r2, [r0] - b _08009F06 - .pool -_08009EF0: - ldr r0, =gUnknown_03005DA8 - ldrh r1, [r0] - cmp r1, 0 - beq _08009F06 - ldr r0, =gUnknown_030022B4 - ldrb r0, [r0] - cmp r0, 0 - bne _08009F06 - ldr r0, =gUnknown_03003110 -_08009F02: - strh r2, [r0] -_08009F04: - strh r1, [r0, 0x2] -_08009F06: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009D90 - thumb_func_start sub_8009F18 sub_8009F18: @ 8009F18 push {lr} diff --git a/include/item_menu.h b/include/item_menu.h index 85655e9d5..17229ec29 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -5,6 +5,8 @@ // Exported RAM declarations +extern u16 gScriptItemId; + // Exported ROM declarations void sub_81AAC50(void); void sub_81AAC70(void); diff --git a/include/main.h b/include/main.h index 779adb758..26a81e60a 100644 --- a/include/main.h +++ b/include/main.h @@ -46,7 +46,7 @@ extern const u8 gGameVersion; extern const u8 gGameLanguage; extern u16 gKeyRepeatStartDelay; -extern u8 gUnknown_030022B4; +extern bool8 gUnknown_030022B4; extern struct Main gMain; extern u16 gKeyRepeatContinueDelay; extern bool8 gSoftResetDisabled; diff --git a/include/overworld.h b/include/overworld.h index 19bcaaf01..45723c3e9 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -51,6 +51,7 @@ void Overworld_ChangeMusicToDefault(void); void Overworld_ChangeMusicTo(u16); bool32 is_c1_link_related_active(void); +extern u16 gUnknown_03005DA8; void strange_npc_table_clear(void); const struct MapHeader *get_mapheader_by_bank_and_number(u8, u8); diff --git a/src/link.c b/src/link.c index 4279c6efc..c2f033e1d 100644 --- a/src/link.c +++ b/src/link.c @@ -8,6 +8,8 @@ #include "decompress.h" #include "string_util.h" #include "event_data.h" +#include "item_menu.h" +#include "overworld.h" #include "gpu_regs.h" #include "palette.h" #include "task.h" @@ -572,3 +574,70 @@ static void sub_8009AA0(u8 unused) } } } + +void sub_8009D90(u16 command) +{ + switch (command) + { + case 0x2222: + gUnknown_03003110[0] = 0x2222; + gUnknown_03003110[1] = gUnknown_020229C6; + break; + case 0x2ffe: + gUnknown_03003110[0] = 0x2ffe; + break; + case 0x4444: + gUnknown_03003110[0] = 0x4444; + gUnknown_03003110[1] = gMain.heldKeys; + break; + case 0x5555: + gUnknown_03003110[0] = 0x5555; + break; + case 0x6666: + gUnknown_03003110[0] = 0x6666; + gUnknown_03003110[1] = 0; + break; + case 0x7777: + { + u8 i; + + gUnknown_03003110[0] = 0x7777; + for (i = 0; i < 5; i ++) + { + gUnknown_03003110[i + 1] = 0xEE; + } + break; + } + case 0xbbbb: + gUnknown_03003110[0] = 0xbbbb; + gUnknown_03003110[1] = gUnknown_03000D10.size; + gUnknown_03003110[2] = gUnknown_03000D10.multiplayerId + 0x80; + break; + case 0xaaaa: + gUnknown_03003110[0] = 0xaaaa; + break; + case 0xaaab: + gUnknown_03003110[0] = 0xaaab; + gUnknown_03003110[1] = gScriptItemId; + break; + case 0xcccc: + gUnknown_03003110[0] = 0xcccc; + gUnknown_03003110[1] = gUnknown_03003150; + break; + case 0x5fff: + gUnknown_03003110[0] = 0x5fff; + gUnknown_03003110[1] = gUnknown_030030F4; + break; + case 0x5566: + gUnknown_03003110[0] = 0x5566; + break; + case 0xcafe: + if (gUnknown_03005DA8 == 0 || gUnknown_030022B4) + { + break; + } + gUnknown_03003110[0] = 0xcafe; + gUnknown_03003110[1] = gUnknown_03005DA8; + break; + } +} diff --git a/src/main.c b/src/main.c index b7758f1f9..b90dc3837 100644 --- a/src/main.c +++ b/src/main.c @@ -80,7 +80,7 @@ const IntrFunc gIntrTableTemplate[] = static u16 gUnknown_03000000; u16 gKeyRepeatStartDelay; -u8 gUnknown_030022B4; +bool8 gUnknown_030022B4; struct Main gMain; u16 gKeyRepeatContinueDelay; bool8 gSoftResetDisabled; @@ -129,7 +129,7 @@ void AgbMain() if (gFlashMemoryPresent != TRUE) SetMainCallback2(NULL); - gUnknown_030022B4 = 0; + gUnknown_030022B4 = FALSE; gUnknown_03000000 = 0xFC0; for (;;) @@ -147,22 +147,22 @@ void AgbMain() if (sub_8087634() == 1) { - gUnknown_030022B4 = 1; + gUnknown_030022B4 = TRUE; UpdateLinkAndCallCallbacks(); - gUnknown_030022B4 = 0; + gUnknown_030022B4 = FALSE; } else { - gUnknown_030022B4 = 0; + gUnknown_030022B4 = FALSE; UpdateLinkAndCallCallbacks(); if (sub_80875C8() == 1) { gMain.newKeys = 0; ClearSpriteCopyRequests(); - gUnknown_030022B4 = 1; + gUnknown_030022B4 = TRUE; UpdateLinkAndCallCallbacks(); - gUnknown_030022B4 = 0; + gUnknown_030022B4 = FALSE; } } From c9da45b254d2400277027da3a6b2cc49d69ce2ff Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 9 Nov 2017 21:56:47 -0500 Subject: [PATCH 013/123] through sub_8009FAC --- asm/link.s | 96 ------------------------------------------------------ src/link.c | 58 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 96 deletions(-) diff --git a/asm/link.s b/asm/link.s index 0989f7d0c..39f12333a 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,102 +5,6 @@ .text - thumb_func_start sub_8009F18 -sub_8009F18: @ 8009F18 - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _08009F26 - bl sub_800F804 -_08009F26: - ldr r1, =gUnknown_03003140 - ldr r0, =sub_8009F70 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009F18 - - thumb_func_start sub_8009F3C -sub_8009F3C: @ 8009F3C - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _08009F50 - bl sub_800F7E4 - b _08009F6A - .pool -_08009F50: - ldr r0, =gUnknown_03003140 - ldr r1, [r0] - ldr r0, =sub_8009F70 - cmp r1, r0 - beq _08009F68 - movs r0, 0 - b _08009F6A - .pool -_08009F68: - movs r0, 0x1 -_08009F6A: - pop {r1} - bx r1 - thumb_func_end sub_8009F3C - - thumb_func_start sub_8009F70 -sub_8009F70: @ 8009F70 - push {lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - bne _08009F80 - ldr r0, =0x0000cafe - bl sub_8009D90 -_08009F80: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009F70 - - thumb_func_start sub_8009F8C -sub_8009F8C: @ 8009F8C - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r1, [r0] - cmp r1, 0 - beq _08009FA0 - bl Rfu_set_zero - b _08009FA4 - .pool -_08009FA0: - ldr r0, =gUnknown_03003140 - str r1, [r0] -_08009FA4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009F8C - - thumb_func_start sub_8009FAC -sub_8009FAC: @ 8009FAC - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r1, [r0] - cmp r1, 0 - beq _08009FC0 - bl Rfu_set_zero - b _08009FC4 - .pool -_08009FC0: - ldr r0, =gUnknown_03003140 - str r1, [r0] -_08009FC4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8009FAC - thumb_func_start GetLinkPlayerCount GetLinkPlayerCount: @ 8009FCC push {lr} diff --git a/src/link.c b/src/link.c index c2f033e1d..2c8fd5397 100644 --- a/src/link.c +++ b/src/link.c @@ -109,6 +109,7 @@ void sub_8009638(void); void sub_80096BC(void); static void c2_08009A8C(void); static void sub_8009AA0(u8 unused); +void sub_8009F70(void); void sub_800A2E0(void); void sub_800A2F4(void *heapptr, size_t src); void sub_800A418(void); @@ -127,6 +128,9 @@ void sub_800B594(void); u32 sub_800BEC0(void); void sub_800E700(void); void sub_800EDD4(void); +bool32 sub_800F7E4(void); +void sub_800F804(void); +void Rfu_set_zero(void); // .rodata @@ -641,3 +645,57 @@ void sub_8009D90(u16 command) break; } } + +void sub_8009F18(void) +{ + if (gLinkVSyncDisabled) + { + sub_800F804(); + } + gUnknown_03003140 = sub_8009F70; +} + +bool32 sub_8009F3C(void) +{ + if (gLinkVSyncDisabled) + { + return sub_800F7E4(); + } + if (gUnknown_03003140 == sub_8009F70) + { + return TRUE; + } + return FALSE; +} + +void sub_8009F70(void) +{ + if (gReceivedRemoteLinkPlayers == TRUE) + { + sub_8009D90(0xcafe); + } +} + +void sub_8009F8C(void) +{ + if (gLinkVSyncDisabled) + { + Rfu_set_zero(); + } + else + { + gUnknown_03003140 = NULL; + } +} + +void sub_8009FAC(void) +{ + if (gLinkVSyncDisabled) + { + Rfu_set_zero(); + } + else + { + gUnknown_03003140 = NULL; + } +} From d76901ff6412c319a1044db36e6ab0b98f530d25 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 08:37:50 -0500 Subject: [PATCH 014/123] through sub_800A0AC --- asm/link.s | 149 ----------------------------------------------- include/global.h | 1 + src/link.c | 69 ++++++++++++++++++++++ 3 files changed, 70 insertions(+), 149 deletions(-) diff --git a/asm/link.s b/asm/link.s index 39f12333a..2142d593e 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,155 +5,6 @@ .text - thumb_func_start GetLinkPlayerCount -GetLinkPlayerCount: @ 8009FCC - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _08009FEC - ldr r0, =gUnknown_030030E0 - ldr r0, [r0] - movs r1, 0x1C - ands r0, r1 - lsrs r0, 2 - b _08009FF4 - .pool -_08009FEC: - bl sub_80104F4 - lsls r0, 24 - lsrs r0, 24 -_08009FF4: - pop {r1} - bx r1 - thumb_func_end GetLinkPlayerCount - - thumb_func_start sub_8009FF8 -sub_8009FF8: @ 8009FF8 - push {r4-r7,lr} - adds r6, r0, 0 - adds r5, r1, 0 - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r4, r0, 24 - movs r2, 0 - cmp r2, r4 - bge _0800A030 - movs r7, 0xFF - ldr r3, =gLinkPlayers -_0800A010: - ldrh r0, [r3] - adds r1, r7, 0 - ands r1, r0 - cmp r1, r6 - beq _0800A01E - cmp r1, r5 - bne _0800A028 -_0800A01E: - movs r0, 0x1 - b _0800A034 - .pool -_0800A028: - adds r3, 0x1C - adds r2, 0x1 - cmp r2, r4 - blt _0800A010 -_0800A030: - movs r0, 0x1 - negs r0, r0 -_0800A034: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8009FF8 - - thumb_func_start sub_800A03C -sub_800A03C: @ 800A03C - movs r0, 0x2 - bx lr - thumb_func_end sub_800A03C - - thumb_func_start sub_800A040 -sub_800A040: @ 800A040 - push {lr} - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bne _0800A05A - movs r0, 0x2 - movs r1, 0x1 - bl sub_8009FF8 - cmp r0, 0 - bge _0800A05E -_0800A05A: - movs r0, 0 - b _0800A060 -_0800A05E: - movs r0, 0x1 -_0800A060: - pop {r1} - bx r1 - thumb_func_end sub_800A040 - - thumb_func_start sub_800A064 -sub_800A064: @ 800A064 - push {lr} - movs r0, 0x2 - movs r1, 0x1 - bl sub_8009FF8 - cmp r0, 0 - bge _0800A076 - movs r0, 0 - b _0800A078 -_0800A076: - movs r0, 0x1 -_0800A078: - pop {r1} - bx r1 - thumb_func_end sub_800A064 - - thumb_func_start sub_800A07C -sub_800A07C: @ 800A07C - push {lr} - movs r0, 0x4 - movs r1, 0x5 - bl sub_8009FF8 - adds r2, r0, 0 - cmp r2, 0 - blt _0800A0A4 - ldr r0, =gLinkPlayers - lsls r1, r2, 3 - subs r1, r2 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x1A] - cmp r0, 0x1 - bne _0800A0A4 - movs r0, 0x1 - b _0800A0A6 - .pool -_0800A0A4: - movs r0, 0 -_0800A0A6: - pop {r1} - bx r1 - thumb_func_end sub_800A07C - - thumb_func_start sub_800A0AC -sub_800A0AC: @ 800A0AC - push {lr} - ldr r0, =gUnknown_03000D5C - movs r1, 0 - str r1, [r0] - ldr r0, =gUnknown_020229C8 - strh r1, [r0] - bl sub_8009734 - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A0AC - thumb_func_start sub_800A0C8 sub_800A0C8: @ 800A0C8 push {r4-r7,lr} diff --git a/include/global.h b/include/global.h index 3421517d7..8cfbc2289 100644 --- a/include/global.h +++ b/include/global.h @@ -51,6 +51,7 @@ enum LanguageId { LANGUAGE_GERMAN = 5, }; +#define GAME_VERSION (VERSION_EMERALD) #define GAME_LANGUAGE (LANGUAGE_ENGLISH) enum diff --git a/src/link.c b/src/link.c index 2c8fd5397..66c7c5801 100644 --- a/src/link.c +++ b/src/link.c @@ -101,6 +101,7 @@ u8 gUnknown_020223BC = 0; u8 gUnknown_020223BD = 0; bool8 gUnknown_020229C4 = FALSE; u16 gUnknown_020229C6 = 0; +u16 gUnknown_020229C8 = 0; struct LinkPlayer gUnknown_020229CC = {}; // Static ROM declarations @@ -131,6 +132,7 @@ void sub_800EDD4(void); bool32 sub_800F7E4(void); void sub_800F804(void); void Rfu_set_zero(void); +u8 sub_80104F4(void); // .rodata @@ -699,3 +701,70 @@ void sub_8009FAC(void) gUnknown_03003140 = NULL; } } + +u8 GetLinkPlayerCount(void) +{ + if (gLinkVSyncDisabled) + { + return sub_80104F4(); + } + return EXTRACT_PLAYER_COUNT(gUnknown_030030E0); +} + +int sub_8009FF8(u32 version1, u32 version2) +{ + int i; + u8 nPlayers; + + nPlayers = GetLinkPlayerCount(); + for (i = 0; i < nPlayers; i ++) + { + if ((gLinkPlayers[i].version & 0xFF) == version1 || (gLinkPlayers[i].version & 0xFF) == version2) + { + return 1; + } + } + return -1; +} + +u32 sub_800A03C(void) +{ + return 2; +} + +bool32 sub_800A040(void) +{ + if (GetLinkPlayerCount() != 4 || sub_8009FF8(VERSION_RUBY, VERSION_SAPPHIRE) < 0) + { + return FALSE; + } + return TRUE; +} + +bool32 sub_800A064(void) +{ + if (sub_8009FF8(VERSION_RUBY, VERSION_SAPPHIRE) >= 0) + { + return TRUE; + } + return FALSE; +} + +bool32 sub_800A07C(void) +{ + int i; + + i = sub_8009FF8(VERSION_FIRE_RED, VERSION_LEAF_GREEN); + if (i >= 0 && gLinkPlayers[i].language == LANGUAGE_JAPANESE) + { + return TRUE; + } + return FALSE; +} + +void sub_800A0AC(void) +{ + gUnknown_03000D5C = 0; + gUnknown_020229C8 = 0; + sub_8009734(); +} From 27f9dd0a97cf6e0a2528ec3744a34a0732ff97fd Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 19:06:06 -0500 Subject: [PATCH 015/123] sub_800A0C8 --- asm/link.s | 167 ------------------------------------------------ include/trade.h | 12 ++++ src/link.c | 74 +++++++++++++++++++++ 3 files changed, 86 insertions(+), 167 deletions(-) create mode 100644 include/trade.h diff --git a/asm/link.s b/asm/link.s index 2142d593e..e51ee1380 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,173 +5,6 @@ .text - thumb_func_start sub_800A0C8 -sub_800A0C8: @ 800A0C8 - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r7, 0 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r4, [r0] - cmp r4, 0x1 - beq _0800A0DA - b _0800A214 -_0800A0DA: - bl sub_800ABAC - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bgt _0800A0EA - cmp r0, r6 - ble _0800A0FC -_0800A0EA: - ldr r1, =gUnknown_03000D5C - movs r0, 0x6 - str r0, [r1] - b _0800A22E - .pool -_0800A0FC: - bl GetLinkPlayerCount - lsls r0, 24 - cmp r0, 0 - bne _0800A10E - ldr r0, =gUnknown_0300306C - strb r4, [r0] - bl sub_80097E8 -_0800A10E: - movs r6, 0 - ldr r4, =gLinkPlayers - movs r5, 0 - b _0800A134 - .pool -_0800A120: - adds r0, r4, 0 - adds r0, 0x14 - adds r0, r5, r0 - ldr r1, [r0] - ldr r0, [r4, 0x14] - cmp r1, r0 - bne _0800A130 - adds r7, 0x1 -_0800A130: - adds r5, 0x1C - adds r6, 0x1 -_0800A134: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - blt _0800A120 - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r7, r0 - bne _0800A1AC - ldr r0, =gLinkPlayers - ldr r1, [r0, 0x14] - ldr r0, =0x00001133 - cmp r1, r0 - bne _0800A19C - bl sub_807A728 - cmp r0, 0x1 - beq _0800A184 - cmp r0, 0x1 - bgt _0800A178 - cmp r0, 0 - beq _0800A19C - ldr r3, =gUnknown_03000D5C - b _0800A22C - .pool -_0800A178: - cmp r0, 0x2 - beq _0800A190 - ldr r3, =gUnknown_03000D5C - b _0800A22C - .pool -_0800A184: - ldr r1, =gUnknown_03000D5C - movs r0, 0x4 - b _0800A1A0 - .pool -_0800A190: - ldr r1, =gUnknown_03000D5C - movs r0, 0x5 - b _0800A1A0 - .pool -_0800A19C: - ldr r1, =gUnknown_03000D5C - movs r0, 0x1 -_0800A1A0: - str r0, [r1] - adds r3, r1, 0 - b _0800A22C - .pool -_0800A1AC: - ldr r6, =gUnknown_03000D5C - movs r0, 0x3 - str r0, [r6] - ldr r4, =gLinkPlayers - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r4, 0x14 - adds r1, r4 - ldr r5, [r1] - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldr r1, [r1] - ldr r2, =0x00002266 - cmp r5, r2 - bne _0800A1EA - ldr r0, =0x00002277 - cmp r1, r0 - beq _0800A1F6 -_0800A1EA: - ldr r0, =0x00002277 - adds r3, r6, 0 - cmp r5, r0 - bne _0800A22C - cmp r1, r2 - bne _0800A22C -_0800A1F6: - ldr r1, =gSpecialVar_0x8005 - movs r0, 0x3 - strh r0, [r1] - ldr r3, =gUnknown_03000D5C - b _0800A22C - .pool -_0800A214: - ldr r0, =gUnknown_020229C8 - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - lsls r1, 16 - movs r0, 0x96 - lsls r0, 18 - ldr r3, =gUnknown_03000D5C - cmp r1, r0 - bls _0800A22C - movs r0, 0x2 - str r0, [r3] -_0800A22C: - ldrb r0, [r3] -_0800A22E: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800A0C8 - thumb_func_start sub_800A23C sub_800A23C: @ 800A23C push {r4-r6,lr} diff --git a/include/trade.h b/include/trade.h new file mode 100644 index 000000000..15438ff3f --- /dev/null +++ b/include/trade.h @@ -0,0 +1,12 @@ +#ifndef GUARD_TRADE_H +#define GUARD_TRADE_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations + +int sub_807A728(void); + +#endif //GUARD_TRADE_H diff --git a/src/link.c b/src/link.c index 66c7c5801..5d5d22cf5 100644 --- a/src/link.c +++ b/src/link.c @@ -13,6 +13,7 @@ #include "gpu_regs.h" #include "palette.h" #include "task.h" +#include "trade.h" #include "link.h" // Static type declarations @@ -768,3 +769,76 @@ void sub_800A0AC(void) gUnknown_020229C8 = 0; sub_8009734(); } + +u8 sub_800A0C8(int lower, int upper) +{ + int i; + int count; + u32 index; + u8 cmpVal; + u32 linkType1; + u32 linkType2; + + count = 0; + if (gReceivedRemoteLinkPlayers == TRUE) + { + cmpVal = sub_800ABAC(); + if (lower > cmpVal || cmpVal > upper) + { + gUnknown_03000D5C = 6; + return 6; + } + else + { + if (GetLinkPlayerCount() == 0) + { + gUnknown_0300306C = TRUE; + sub_80097E8(); + } + for (i = 0, index = 0; i < GetLinkPlayerCount(); index ++, i ++) + { + if (gLinkPlayers[index].linkType == gLinkPlayers[0].linkType) + { + count ++; + } + } + if (count == GetLinkPlayerCount()) + { + if (gLinkPlayers[0].linkType == 0x1133) + { + switch (sub_807A728()) + { + case 1: + gUnknown_03000D5C = 4; + break; + case 2: + gUnknown_03000D5C = 5; + break; + case 0: + gUnknown_03000D5C = 1; + break; + } + } + else + { + gUnknown_03000D5C = 1; + } + } + else + { + gUnknown_03000D5C = 3; + linkType1 = gLinkPlayers[GetMultiplayerId()].linkType; + linkType2 = gLinkPlayers[GetMultiplayerId() ^ 1].linkType; + if ((linkType1 == 0x2266 && linkType2 == 0x2277) || (linkType1 == 0x2277 && linkType2 == 0x2266)) + { + gSpecialVar_0x8005 = 3; + } + } + } + } + else if (++ gUnknown_020229C8 > 600) + { + gUnknown_03000D5C = 2; + } + return gUnknown_03000D5C; +} From 1ac4d1849c79162719490900efdf4f6836fa9422 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 19:14:35 -0500 Subject: [PATCH 016/123] through sub_800A2BC --- asm/link.s | 90 ------------------------------------------------------ src/link.c | 42 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 90 deletions(-) diff --git a/asm/link.s b/asm/link.s index e51ee1380..ff0bfb3c9 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,96 +5,6 @@ .text - thumb_func_start sub_800A23C -sub_800A23C: @ 800A23C - push {r4-r6,lr} - movs r6, 0 - movs r4, 0 - ldr r5, =gLinkPlayers - b _0800A26C - .pool -_0800A24C: - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x14 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r5, 0x14] - cmp r1, r0 - bne _0800A266 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0800A266: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_0800A26C: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bcc _0800A24C - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - bne _0800A290 - movs r2, 0x1 - ldr r0, =gUnknown_03000D5C - str r2, [r0] - b _0800A298 - .pool -_0800A290: - movs r2, 0 - ldr r1, =gUnknown_03000D5C - movs r0, 0x3 - str r0, [r1] -_0800A298: - adds r0, r2, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800A23C - - thumb_func_start GetLinkPlayerTrainerId -GetLinkPlayerTrainerId: @ 800A2A4 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r2, 0x4 - adds r1, r2 - ldr r0, [r1] - bx lr - .pool - thumb_func_end GetLinkPlayerTrainerId - - thumb_func_start sub_800A2BC -sub_800A2BC: @ 800A2BC - push {r4,r5,lr} - ldr r5, =gLinkPlayers - movs r4, 0x4 -_0800A2C2: - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x1C - bl memset - adds r5, 0x1C - subs r4, 0x1 - cmp r4, 0 - bge _0800A2C2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A2BC - thumb_func_start sub_800A2E0 sub_800A2E0: @ 800A2E0 ldr r1, =gUnknown_03000D10 diff --git a/src/link.c b/src/link.c index 5d5d22cf5..3cb485b49 100644 --- a/src/link.c +++ b/src/link.c @@ -842,3 +842,45 @@ u8 sub_800A0C8(int lower, int upper) } return gUnknown_03000D5C; } + +bool8 sub_800A23C(void) +{ + u8 i; + u8 count; + bool8 retval; + + count = 0; + for (i = 0; i < GetLinkPlayerCount(); i ++) + { + if (gLinkPlayers[i].linkType == gLinkPlayers[0].linkType) + { + count ++; + } + } + if (count == GetLinkPlayerCount()) + { + retval = TRUE; + gUnknown_03000D5C = 1; + } + else + { + retval = FALSE; + gUnknown_03000D5C = 3; + } + return retval; +} + +u32 GetLinkPlayerTrainerId(u8 who) +{ + return gLinkPlayers[who].trainerId; +} + +void sub_800A2BC(void) +{ + int i; + + for (i = 0; i <= MAX_LINK_PLAYERS; i ++) + { + gLinkPlayers[i] = (struct LinkPlayer){}; + } +} From e8ea1867a012b4b0368c4c4f41e4e131e46edac9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 19:25:46 -0500 Subject: [PATCH 017/123] sub_800A2F4 --- asm/link.s | 63 ------------------------------------------------------ src/link.c | 47 +++++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 68 deletions(-) diff --git a/asm/link.s b/asm/link.s index ff0bfb3c9..828e9f8b3 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,69 +5,6 @@ .text - thumb_func_start sub_800A2E0 -sub_800A2E0: @ 800A2E0 - ldr r1, =gUnknown_03000D10 - movs r0, 0 - strb r0, [r1, 0x8] - strh r0, [r1] - strh r0, [r1, 0x2] - str r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_800A2E0 - - thumb_func_start sub_800A2F4 -sub_800A2F4: @ 800A2F4 - push {r4-r7,lr} - adds r7, r0, 0 - adds r6, r1, 0 - ldr r4, =gUnknown_03000D10 - ldrb r5, [r4, 0x8] - cmp r5, 0 - beq _0800A30C - movs r0, 0 - b _0800A34A - .pool -_0800A30C: - bl GetMultiplayerId - strb r0, [r4, 0x9] - movs r0, 0x1 - strb r0, [r4, 0x8] - strh r6, [r4, 0x2] - strh r5, [r4] - adds r0, 0xFF - cmp r6, r0 - bls _0800A324 - str r7, [r4, 0x4] - b _0800A336 -_0800A324: - ldr r5, =gUnknown_020228C4 - cmp r7, r5 - beq _0800A334 - adds r0, r5, 0 - adds r1, r7, 0 - adds r2, r6, 0 - bl memcpy -_0800A334: - str r5, [r4, 0x4] -_0800A336: - ldr r0, =0x0000bbbb - bl sub_8009D90 - ldr r1, =gUnknown_03003140 - ldr r0, =sub_800A364 - str r0, [r1] - ldr r1, =gUnknown_03000D50 - movs r0, 0 - str r0, [r1] - movs r0, 0x1 -_0800A34A: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800A2F4 - thumb_func_start sub_800A364 sub_800A364: @ 800A364 push {lr} diff --git a/src/link.c b/src/link.c index 3cb485b49..9fd243052 100644 --- a/src/link.c +++ b/src/link.c @@ -22,7 +22,7 @@ struct BlockTransfer { u16 pos; u16 size; - void *src; + const void *src; bool8 active; u8 multiplayerId; }; @@ -111,9 +111,10 @@ void sub_8009638(void); void sub_80096BC(void); static void c2_08009A8C(void); static void sub_8009AA0(u8 unused); -void sub_8009F70(void); -void sub_800A2E0(void); -void sub_800A2F4(void *heapptr, size_t src); +static void sub_8009F70(void); +static void sub_800A2E0(void); +bool32 sub_800A2F4(const void *src, size_t size); +void sub_800A364(void); void sub_800A418(void); void task00_link_test(u8 taskId); void sub_800A588(u8 who); @@ -671,7 +672,7 @@ bool32 sub_8009F3C(void) return FALSE; } -void sub_8009F70(void) +static void sub_8009F70(void) { if (gReceivedRemoteLinkPlayers == TRUE) { @@ -884,3 +885,39 @@ void sub_800A2BC(void) gLinkPlayers[i] = (struct LinkPlayer){}; } } + +static void sub_800A2E0(void) +{ + gUnknown_03000D10.active = FALSE; + gUnknown_03000D10.pos = 0; + gUnknown_03000D10.size = 0; + gUnknown_03000D10.src = NULL; +} + +bool32 sub_800A2F4(const void *src, size_t size) +{ + if (gUnknown_03000D10.active) + { + return FALSE; + } + gUnknown_03000D10.multiplayerId = GetMultiplayerId(); + gUnknown_03000D10.active = TRUE; + gUnknown_03000D10.size = size; + gUnknown_03000D10.pos = 0; + if (size > 0x100) + { + gUnknown_03000D10.src = src; + } + else + { + if (src != gUnknown_020228C4) + { + memcpy(gUnknown_020228C4, src, size); + } + gUnknown_03000D10.src = gUnknown_020228C4; + } + sub_8009D90(0xbbbb); + gUnknown_03003140 = sub_800A364; + gUnknown_03000D50 = 0; + return TRUE; +} From 263fbdb2c1500aac078c9b36883bb39eefb77acf Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 19:37:38 -0500 Subject: [PATCH 018/123] through sub_800A388 --- asm/link.s | 64 ------------------------------------------------------ src/link.c | 33 ++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 66 deletions(-) diff --git a/asm/link.s b/asm/link.s index 828e9f8b3..830fa1790 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,70 +5,6 @@ .text - thumb_func_start sub_800A364 -sub_800A364: @ 800A364 - push {lr} - ldr r1, =gUnknown_03000D50 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x2 - bls _0800A378 - ldr r1, =gUnknown_03003140 - ldr r0, =sub_800A388 - str r0, [r1] -_0800A378: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A364 - - thumb_func_start sub_800A388 -sub_800A388: @ 800A388 - push {r4-r6,lr} - ldr r0, =gUnknown_03000D10 - ldr r5, [r0, 0x4] - ldr r2, =gUnknown_03003110 - ldr r1, =0x00008888 - strh r1, [r2] - movs r3, 0 - adds r4, r0, 0 - adds r6, r4, 0 - adds r2, 0x2 -_0800A39C: - lsls r0, r3, 1 - ldrh r1, [r6] - adds r0, r1 - adds r0, r5 - ldrb r1, [r0, 0x1] - lsls r1, 8 - ldrb r0, [r0] - orrs r0, r1 - strh r0, [r2] - adds r2, 0x2 - adds r3, 0x1 - cmp r3, 0x6 - ble _0800A39C - ldrh r0, [r4] - adds r0, 0xE - strh r0, [r4] - ldrh r1, [r4, 0x2] - lsls r0, 16 - lsrs r0, 16 - cmp r1, r0 - bhi _0800A3D0 - movs r0, 0 - strb r0, [r4, 0x8] - ldr r1, =gUnknown_03003140 - ldr r0, =sub_800A3EC - str r0, [r1] -_0800A3D0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A388 - thumb_func_start sub_800A3EC sub_800A3EC: @ 800A3EC ldr r1, =gUnknown_03003140 diff --git a/src/link.c b/src/link.c index 9fd243052..1499b8275 100644 --- a/src/link.c +++ b/src/link.c @@ -22,7 +22,7 @@ struct BlockTransfer { u16 pos; u16 size; - const void *src; + const u8 *src; bool8 active; u8 multiplayerId; }; @@ -114,7 +114,9 @@ static void sub_8009AA0(u8 unused); static void sub_8009F70(void); static void sub_800A2E0(void); bool32 sub_800A2F4(const void *src, size_t size); -void sub_800A364(void); +static void sub_800A364(void); +static void sub_800A388(void); +void sub_800A3EC(void); void sub_800A418(void); void task00_link_test(u8 taskId); void sub_800A588(u8 who); @@ -921,3 +923,30 @@ bool32 sub_800A2F4(const void *src, size_t size) gUnknown_03000D50 = 0; return TRUE; } + +static void sub_800A364(void) +{ + if (++ gUnknown_03000D50 > 2) + { + gUnknown_03003140 = sub_800A388; + } +} + +static void sub_800A388(void) +{ + int i; + const u8 *src; + + src = gUnknown_03000D10.src; + gUnknown_03003110[0] = 0x8888; + for (i = 0; i < 7; i ++) + { + gUnknown_03003110[i + 1] = (src[gUnknown_03000D10.pos + i * 2 + 1] << 8) | src[gUnknown_03000D10.pos + i * 2]; + } + gUnknown_03000D10.pos += 14; + if (gUnknown_03000D10.size <= gUnknown_03000D10.pos) + { + gUnknown_03000D10.active = FALSE; + gUnknown_03003140 = sub_800A3EC; + } +} From 3503444d3ba8e0f987e9f48457e832fa270a02bf Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 20:27:02 -0500 Subject: [PATCH 019/123] Some EWRAM offsets abstracted away --- asm/link.s | 28 +- include/link.h | 2 +- src/battle_controllers.c | 600 +++++++++++++++++++-------------------- src/link.c | 31 +- sym_ewram.txt | 41 +-- 5 files changed, 329 insertions(+), 373 deletions(-) diff --git a/asm/link.s b/asm/link.s index 830fa1790..1b910c485 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,30 +5,6 @@ .text - thumb_func_start sub_800A3EC -sub_800A3EC: @ 800A3EC - ldr r1, =gUnknown_03003140 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_800A3EC - - thumb_func_start sub_800A3F8 -sub_800A3F8: @ 800A3F8 - push {lr} - bl GetMultiplayerId - ldr r0, =0x00004444 - bl sub_8009D90 - ldr r1, =gUnknown_020223C0 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A3F8 - thumb_func_start sub_800A418 sub_800A418: @ 800A418 push {lr} @@ -22370,7 +22346,7 @@ _08016118: movs r0, 0x21 strb r0, [r6, 0x14] ldr r0, =gStringVar1 - ldr r4, =gUnknown_02022A0C + ldr r4, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name adds r1, r4, 0 bl StringCopy adds r0, r4, 0 @@ -29144,7 +29120,7 @@ _08019870: _08019884: bl task_add_05_task_del_08FA224_when_no_RfuFunc ldr r0, =gStringVar1 - ldr r1, =gUnknown_02022A0C + ldr r1, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name bl StringCopy movs r0, 0x22 strb r0, [r5, 0x8] diff --git a/include/link.h b/include/link.h index 5d9471826..b48b248f0 100644 --- a/include/link.h +++ b/include/link.h @@ -136,7 +136,7 @@ extern u8 gUnknown_020228C4[BLOCK_BUFFER_SIZE]; // gBlockSendBuffer extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; extern u16 gLinkType; extern u32 gLinkStatus; -extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS][BLOCK_BUFFER_SIZE / 2]; +extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS + 1][BLOCK_BUFFER_SIZE / 2]; extern u16 gSendCmd[CMD_LENGTH]; extern u8 gShouldAdvanceLinkState; extern struct LinkPlayer gLinkPlayers[]; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 5c874438e..d3653d0b3 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -12,7 +12,6 @@ #include "abilities.h" #include "battle_message.h" -extern u32 gBattleTypeFlags; extern u32 gBattleExecBuffer; extern void (*gBattleMainFunc)(void); extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); @@ -27,7 +26,6 @@ extern u8 gUnknown_0203C7B4; extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; -extern u8 gBattleBuffersTransferData[0x100]; extern u8 gUnknown_02022D08; extern u8 gUnknown_02022D09; extern u8 gUnknown_02022D0A; @@ -39,11 +37,11 @@ extern u16 gBattleWeather; extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; extern u16 gCurrentMove; extern u16 gLastUsedMove; -extern u16 gLastUsedItem; -extern u8 gBattleOutcome; extern u8 gLastUsedAbility; extern u8 gStringBank; +static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {}; + extern const struct BattleMove gBattleMoves[]; extern void task00_08081A90(u8 taskId); // cable_club @@ -941,171 +939,171 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) { - gBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA; - gBattleBuffersTransferData[1] = requestId; - gBattleBuffersTransferData[2] = monToCheck; - gBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA; + sBattleBuffersTransferData[1] = requestId; + sBattleBuffersTransferData[2] = monToCheck; + sBattleBuffersTransferData[3] = 0; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) { - gBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA; - gBattleBuffersTransferData[1] = monId; - gBattleBuffersTransferData[2] = bytes; - gBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA; + sBattleBuffersTransferData[1] = monId; + sBattleBuffersTransferData[2] = bytes; + sBattleBuffersTransferData[3] = 0; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA; - gBattleBuffersTransferData[1] = requestId; - gBattleBuffersTransferData[2] = monToCheck; + sBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA; + sBattleBuffersTransferData[1] = requestId; + sBattleBuffersTransferData[2] = monToCheck; for (i = 0; i < bytes; i++) - gBattleBuffersTransferData[3 + i] = *(u8*)(data++); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 3 + bytes); + sBattleBuffersTransferData[3 + i] = *(u8*)(data++); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 3 + bytes); } void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_SETRAWMONDATA; - gBattleBuffersTransferData[1] = monId; - gBattleBuffersTransferData[2] = bytes; + sBattleBuffersTransferData[0] = CONTROLLER_SETRAWMONDATA; + sBattleBuffersTransferData[1] = monId; + sBattleBuffersTransferData[2] = bytes; for (i = 0; i < bytes; i++) - gBattleBuffersTransferData[3 + i] = *(u8*)(data++); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, bytes + 3); + sBattleBuffersTransferData[3 + i] = *(u8*)(data++); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, bytes + 3); } void EmitLoadMonSprite(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_LOADMONSPRITE; - gBattleBuffersTransferData[1] = CONTROLLER_LOADMONSPRITE; - gBattleBuffersTransferData[2] = CONTROLLER_LOADMONSPRITE; - gBattleBuffersTransferData[3] = CONTROLLER_LOADMONSPRITE; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_LOADMONSPRITE; + sBattleBuffersTransferData[1] = CONTROLLER_LOADMONSPRITE; + sBattleBuffersTransferData[2] = CONTROLLER_LOADMONSPRITE; + sBattleBuffersTransferData[3] = CONTROLLER_LOADMONSPRITE; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit) { - gBattleBuffersTransferData[0] = CONTROLLER_SWITCHINANIM; - gBattleBuffersTransferData[1] = partyId; - gBattleBuffersTransferData[2] = dontClearSubstituteBit; - gBattleBuffersTransferData[3] = 5; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_SWITCHINANIM; + sBattleBuffersTransferData[1] = partyId; + sBattleBuffersTransferData[2] = dontClearSubstituteBit; + sBattleBuffersTransferData[3] = 5; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitReturnMonToBall(u8 bufferId, u8 arg1) { - gBattleBuffersTransferData[0] = CONTROLLER_RETURNMONTOBALL; - gBattleBuffersTransferData[1] = arg1; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); + sBattleBuffersTransferData[0] = CONTROLLER_RETURNMONTOBALL; + sBattleBuffersTransferData[1] = arg1; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } void EmitDrawTrainerPic(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_DRAWTRAINERPIC; - gBattleBuffersTransferData[1] = CONTROLLER_DRAWTRAINERPIC; - gBattleBuffersTransferData[2] = CONTROLLER_DRAWTRAINERPIC; - gBattleBuffersTransferData[3] = CONTROLLER_DRAWTRAINERPIC; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_DRAWTRAINERPIC; + sBattleBuffersTransferData[1] = CONTROLLER_DRAWTRAINERPIC; + sBattleBuffersTransferData[2] = CONTROLLER_DRAWTRAINERPIC; + sBattleBuffersTransferData[3] = CONTROLLER_DRAWTRAINERPIC; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitTrainerSlide(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDE; - gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDE; - gBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDE; - gBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDE; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDE; + sBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDE; + sBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDE; + sBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDE; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitTrainerSlideBack(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDEBACK; - gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDEBACK; - gBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDEBACK; - gBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDEBACK; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDEBACK; + sBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDEBACK; + sBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDEBACK; + sBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDEBACK; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitFaintAnimation(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_FAINTANIMATION; - gBattleBuffersTransferData[1] = CONTROLLER_FAINTANIMATION; - gBattleBuffersTransferData[2] = CONTROLLER_FAINTANIMATION; - gBattleBuffersTransferData[3] = CONTROLLER_FAINTANIMATION; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_FAINTANIMATION; + sBattleBuffersTransferData[1] = CONTROLLER_FAINTANIMATION; + sBattleBuffersTransferData[2] = CONTROLLER_FAINTANIMATION; + sBattleBuffersTransferData[3] = CONTROLLER_FAINTANIMATION; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitPaletteFade(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE; - gBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE; - gBattleBuffersTransferData[2] = CONTROLLER_PALETTEFADE; - gBattleBuffersTransferData[3] = CONTROLLER_PALETTEFADE; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE; + sBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE; + sBattleBuffersTransferData[2] = CONTROLLER_PALETTEFADE; + sBattleBuffersTransferData[3] = CONTROLLER_PALETTEFADE; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitSuccessBallThrowAnim(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM; - gBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM; - gBattleBuffersTransferData[2] = CONTROLLER_SUCCESSBALLTHROWANIM; - gBattleBuffersTransferData[3] = CONTROLLER_SUCCESSBALLTHROWANIM; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM; + sBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM; + sBattleBuffersTransferData[2] = CONTROLLER_SUCCESSBALLTHROWANIM; + sBattleBuffersTransferData[3] = CONTROLLER_SUCCESSBALLTHROWANIM; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitBallThrowAnim(u8 bufferId, u8 caseId) { - gBattleBuffersTransferData[0] = CONTROLLER_BALLTHROWANIM; - gBattleBuffersTransferData[1] = caseId; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); + sBattleBuffersTransferData[0] = CONTROLLER_BALLTHROWANIM; + sBattleBuffersTransferData[1] = caseId; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } void EmitPause(u8 bufferId, u8 toWait, void *data) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_PAUSE; - gBattleBuffersTransferData[1] = toWait; + sBattleBuffersTransferData[0] = CONTROLLER_PAUSE; + sBattleBuffersTransferData[1] = toWait; for (i = 0; i < toWait * 3; i++) - gBattleBuffersTransferData[2 + i] = *(u8*)(data++); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, toWait * 3 + 2); + sBattleBuffersTransferData[2 + i] = *(u8*)(data++); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, toWait * 3 + 2); } void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit) { - gBattleBuffersTransferData[0] = CONTROLLER_MOVEANIMATION; - gBattleBuffersTransferData[1] = move; - gBattleBuffersTransferData[2] = (move & 0xFF00) >> 8; - gBattleBuffersTransferData[3] = turnOfMove; - gBattleBuffersTransferData[4] = movePower; - gBattleBuffersTransferData[5] = (movePower & 0xFF00) >> 8; - gBattleBuffersTransferData[6] = dmg; - gBattleBuffersTransferData[7] = (dmg & 0x0000FF00) >> 8; - gBattleBuffersTransferData[8] = (dmg & 0x00FF0000) >> 16; - gBattleBuffersTransferData[9] = (dmg & 0xFF000000) >> 24; - gBattleBuffersTransferData[10] = friendship; - gBattleBuffersTransferData[11] = multihit; + sBattleBuffersTransferData[0] = CONTROLLER_MOVEANIMATION; + sBattleBuffersTransferData[1] = move; + sBattleBuffersTransferData[2] = (move & 0xFF00) >> 8; + sBattleBuffersTransferData[3] = turnOfMove; + sBattleBuffersTransferData[4] = movePower; + sBattleBuffersTransferData[5] = (movePower & 0xFF00) >> 8; + sBattleBuffersTransferData[6] = dmg; + sBattleBuffersTransferData[7] = (dmg & 0x0000FF00) >> 8; + sBattleBuffersTransferData[8] = (dmg & 0x00FF0000) >> 16; + sBattleBuffersTransferData[9] = (dmg & 0xFF000000) >> 24; + sBattleBuffersTransferData[10] = friendship; + sBattleBuffersTransferData[11] = multihit; if (WEATHER_HAS_EFFECT2) { - gBattleBuffersTransferData[12] = gBattleWeather; - gBattleBuffersTransferData[13] = (gBattleWeather & 0xFF00) >> 8; + sBattleBuffersTransferData[12] = gBattleWeather; + sBattleBuffersTransferData[13] = (gBattleWeather & 0xFF00) >> 8; } else { - gBattleBuffersTransferData[12] = 0; - gBattleBuffersTransferData[13] = 0; + sBattleBuffersTransferData[12] = 0; + sBattleBuffersTransferData[13] = 0; } - gBattleBuffersTransferData[14] = 0; - gBattleBuffersTransferData[15] = 0; - memcpy(&gBattleBuffersTransferData[16], disableStructPtr, sizeof(struct DisableStruct)); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 16 + sizeof(struct DisableStruct)); + sBattleBuffersTransferData[14] = 0; + sBattleBuffersTransferData[15] = 0; + memcpy(&sBattleBuffersTransferData[16], disableStructPtr, sizeof(struct DisableStruct)); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 16 + sizeof(struct DisableStruct)); } void EmitPrintString(u8 bufferId, u16 stringID) @@ -1113,12 +1111,12 @@ void EmitPrintString(u8 bufferId, u16 stringID) s32 i; struct StringInfoBattle* stringInfo; - gBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRING; - gBattleBuffersTransferData[1] = gBattleOutcome; - gBattleBuffersTransferData[2] = stringID; - gBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8; + sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRING; + sBattleBuffersTransferData[1] = gBattleOutcome; + sBattleBuffersTransferData[2] = stringID; + sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8; - stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]); + stringInfo = (struct StringInfoBattle*)(&sBattleBuffersTransferData[4]); stringInfo->currentMove = gCurrentMove; stringInfo->lastMove = gLastUsedMove; stringInfo->lastItem = gLastUsedItem; @@ -1137,7 +1135,7 @@ void EmitPrintString(u8 bufferId, u16 stringID) stringInfo->textBuffs[1][i] = gBattleTextBuff2[i]; stringInfo->textBuffs[2][i] = gBattleTextBuff3[i]; } - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4); } void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringID) @@ -1145,12 +1143,12 @@ void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringID) s32 i; struct StringInfoBattle* stringInfo; - gBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY; - gBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY; - gBattleBuffersTransferData[2] = stringID; - gBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8; + sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY; + sBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY; + sBattleBuffersTransferData[2] = stringID; + sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8; - stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]); + stringInfo = (struct StringInfoBattle*)(&sBattleBuffersTransferData[4]); stringInfo->currentMove = gCurrentMove; stringInfo->lastMove = gLastUsedMove; stringInfo->lastItem = gLastUsedItem; @@ -1166,386 +1164,386 @@ void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringID) stringInfo->textBuffs[1][i] = gBattleTextBuff2[i]; stringInfo->textBuffs[2][i] = gBattleTextBuff3[i]; } - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4); } void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2) { - gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEACTION; - gBattleBuffersTransferData[1] = arg1; - gBattleBuffersTransferData[2] = arg2; - gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEACTION; + sBattleBuffersTransferData[1] = arg1; + sBattleBuffersTransferData[2] = arg2; + sBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitUnknownYesNoBox(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX; - gBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX; - gBattleBuffersTransferData[2] = CONTROLLER_UNKNOWNYESNOBOX; - gBattleBuffersTransferData[3] = CONTROLLER_UNKNOWNYESNOBOX; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX; + sBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX; + sBattleBuffersTransferData[2] = CONTROLLER_UNKNOWNYESNOBOX; + sBattleBuffersTransferData[3] = CONTROLLER_UNKNOWNYESNOBOX; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEMOVE; - gBattleBuffersTransferData[1] = isDoubleBattle; - gBattleBuffersTransferData[2] = NoPpNumber; - gBattleBuffersTransferData[3] = 0; + sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEMOVE; + sBattleBuffersTransferData[1] = isDoubleBattle; + sBattleBuffersTransferData[2] = NoPpNumber; + sBattleBuffersTransferData[3] = 0; for (i = 0; i < sizeof(*movePpData); i++) - gBattleBuffersTransferData[4 + i] = *((u8*)(movePpData) + i); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(*movePpData) + 4); + sBattleBuffersTransferData[4 + i] = *((u8*)(movePpData) + i); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(*movePpData) + 4); } void EmitChooseItem(u8 bufferId, u8 *arg1) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_OPENBAG; + sBattleBuffersTransferData[0] = CONTROLLER_OPENBAG; for (i = 0; i < 3; i++) - gBattleBuffersTransferData[1 + i] = arg1[i]; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[1 + i] = arg1[i]; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEPOKEMON; - gBattleBuffersTransferData[1] = caseId; - gBattleBuffersTransferData[2] = arg2; - gBattleBuffersTransferData[3] = abilityId; + sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEPOKEMON; + sBattleBuffersTransferData[1] = caseId; + sBattleBuffersTransferData[2] = arg2; + sBattleBuffersTransferData[3] = abilityId; for (i = 0; i < 3; i++) - gBattleBuffersTransferData[4 + i] = arg4[i]; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 8); // but only 7 bytes were written + sBattleBuffersTransferData[4 + i] = arg4[i]; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // but only 7 bytes were written } void EmitCmd23(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_23; - gBattleBuffersTransferData[1] = CONTROLLER_23; - gBattleBuffersTransferData[2] = CONTROLLER_23; - gBattleBuffersTransferData[3] = CONTROLLER_23; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_23; + sBattleBuffersTransferData[1] = CONTROLLER_23; + sBattleBuffersTransferData[2] = CONTROLLER_23; + sBattleBuffersTransferData[3] = CONTROLLER_23; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } // why is the argument u16 if it's being cast to s16 anyway? void EmitHealthBarUpdate(u8 bufferId, u16 hpValue) { - gBattleBuffersTransferData[0] = CONTROLLER_HEALTHBARUPDATE; - gBattleBuffersTransferData[1] = 0; - gBattleBuffersTransferData[2] = (s16)hpValue; - gBattleBuffersTransferData[3] = ((s16)hpValue & 0xFF00) >> 8; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_HEALTHBARUPDATE; + sBattleBuffersTransferData[1] = 0; + sBattleBuffersTransferData[2] = (s16)hpValue; + sBattleBuffersTransferData[3] = ((s16)hpValue & 0xFF00) >> 8; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } // why is the argument u16 if it's being cast to s16 anyway? void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints) { - gBattleBuffersTransferData[0] = CONTROLLER_EXPUPDATE; - gBattleBuffersTransferData[1] = partyId; - gBattleBuffersTransferData[2] = (s16)expPoints; - gBattleBuffersTransferData[3] = ((s16)expPoints & 0xFF00) >> 8; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_EXPUPDATE; + sBattleBuffersTransferData[1] = partyId; + sBattleBuffersTransferData[2] = (s16)expPoints; + sBattleBuffersTransferData[3] = ((s16)expPoints & 0xFF00) >> 8; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2) { - gBattleBuffersTransferData[0] = CONTROLLER_STATUSICONUPDATE; - gBattleBuffersTransferData[1] = status1; - gBattleBuffersTransferData[2] = (status1 & 0x0000FF00) >> 8; - gBattleBuffersTransferData[3] = (status1 & 0x00FF0000) >> 16; - gBattleBuffersTransferData[4] = (status1 & 0xFF000000) >> 24; - gBattleBuffersTransferData[5] = status2; - gBattleBuffersTransferData[6] = (status2 & 0x0000FF00) >> 8; - gBattleBuffersTransferData[7] = (status2 & 0x00FF0000) >> 16; - gBattleBuffersTransferData[8] = (status2 & 0xFF000000) >> 24; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 9); + sBattleBuffersTransferData[0] = CONTROLLER_STATUSICONUPDATE; + sBattleBuffersTransferData[1] = status1; + sBattleBuffersTransferData[2] = (status1 & 0x0000FF00) >> 8; + sBattleBuffersTransferData[3] = (status1 & 0x00FF0000) >> 16; + sBattleBuffersTransferData[4] = (status1 & 0xFF000000) >> 24; + sBattleBuffersTransferData[5] = status2; + sBattleBuffersTransferData[6] = (status2 & 0x0000FF00) >> 8; + sBattleBuffersTransferData[7] = (status2 & 0x00FF0000) >> 16; + sBattleBuffersTransferData[8] = (status2 & 0xFF000000) >> 24; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 9); } void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status) { - gBattleBuffersTransferData[0] = CONTROLLER_STATUSANIMATION; - gBattleBuffersTransferData[1] = status2; - gBattleBuffersTransferData[2] = status; - gBattleBuffersTransferData[3] = (status & 0x0000FF00) >> 8; - gBattleBuffersTransferData[4] = (status & 0x00FF0000) >> 16; - gBattleBuffersTransferData[5] = (status & 0xFF000000) >> 24; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 6); + sBattleBuffersTransferData[0] = CONTROLLER_STATUSANIMATION; + sBattleBuffersTransferData[1] = status2; + sBattleBuffersTransferData[2] = status; + sBattleBuffersTransferData[3] = (status & 0x0000FF00) >> 8; + sBattleBuffersTransferData[4] = (status & 0x00FF0000) >> 16; + sBattleBuffersTransferData[5] = (status & 0xFF000000) >> 24; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 6); } void EmitStatusXor(u8 bufferId, u8 b) { - gBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR; - gBattleBuffersTransferData[1] = b; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); + sBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR; + sBattleBuffersTransferData[1] = b; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } void EmitDataTransfer(u8 bufferId, u16 size, void *data) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER; - gBattleBuffersTransferData[1] = CONTROLLER_DATATRANSFER; - gBattleBuffersTransferData[2] = size; - gBattleBuffersTransferData[3] = (size & 0xFF00) >> 8; + sBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER; + sBattleBuffersTransferData[1] = CONTROLLER_DATATRANSFER; + sBattleBuffersTransferData[2] = size; + sBattleBuffersTransferData[3] = (size & 0xFF00) >> 8; for (i = 0; i < size; i++) - gBattleBuffersTransferData[4 + i] = *(u8*)(data++); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 4); + sBattleBuffersTransferData[4 + i] = *(u8*)(data++); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 4); } void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_DMA3TRANSFER; - gBattleBuffersTransferData[1] = (u32)(dst); - gBattleBuffersTransferData[2] = ((u32)(dst) & 0x0000FF00) >> 8; - gBattleBuffersTransferData[3] = ((u32)(dst) & 0x00FF0000) >> 16; - gBattleBuffersTransferData[4] = ((u32)(dst) & 0xFF000000) >> 24; - gBattleBuffersTransferData[5] = size; - gBattleBuffersTransferData[6] = (size & 0xFF00) >> 8; + sBattleBuffersTransferData[0] = CONTROLLER_DMA3TRANSFER; + sBattleBuffersTransferData[1] = (u32)(dst); + sBattleBuffersTransferData[2] = ((u32)(dst) & 0x0000FF00) >> 8; + sBattleBuffersTransferData[3] = ((u32)(dst) & 0x00FF0000) >> 16; + sBattleBuffersTransferData[4] = ((u32)(dst) & 0xFF000000) >> 24; + sBattleBuffersTransferData[5] = size; + sBattleBuffersTransferData[6] = (size & 0xFF00) >> 8; for (i = 0; i < size; i++) - gBattleBuffersTransferData[7 + i] = *(u8*)(data++); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 7); + sBattleBuffersTransferData[7 + i] = *(u8*)(data++); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 7); } void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_31; - gBattleBuffersTransferData[1] = songId; - gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; + sBattleBuffersTransferData[0] = CONTROLLER_31; + sBattleBuffersTransferData[1] = songId; + sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; for (i = 0; i < songId; i++) // ???? - gBattleBuffersTransferData[3 + i] = *(u8*)(unusedDumbDataParameter++); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, songId + 3); + sBattleBuffersTransferData[3 + i] = *(u8*)(unusedDumbDataParameter++); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, songId + 3); } void EmitCmd32(u8 bufferId, u16 size, void *data) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_32; - gBattleBuffersTransferData[1] = size; - gBattleBuffersTransferData[2] = (size & 0xFF00) >> 8; + sBattleBuffersTransferData[0] = CONTROLLER_32; + sBattleBuffersTransferData[1] = size; + sBattleBuffersTransferData[2] = (size & 0xFF00) >> 8; for (i = 0; i < size; i++) - gBattleBuffersTransferData[3 + i] = *(u8*)(data++); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 3); + sBattleBuffersTransferData[3 + i] = *(u8*)(data++); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 3); } void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2) { - gBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES; - gBattleBuffersTransferData[1] = arg1; - gBattleBuffersTransferData[2] = arg2; - gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES; + sBattleBuffersTransferData[1] = arg1; + sBattleBuffersTransferData[2] = arg2; + sBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE; - gBattleBuffersTransferData[1] = b; + sBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE; + sBattleBuffersTransferData[1] = b; for (i = 0; i < 3; i++) - gBattleBuffersTransferData[2 + i] = c[i]; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 5); + sBattleBuffersTransferData[2 + i] = c[i]; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 5); } void EmitOneReturnValue(u8 bufferId, u16 arg1) { - gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE; - gBattleBuffersTransferData[1] = arg1; - gBattleBuffersTransferData[2] = (arg1 & 0xFF00) >> 8; - gBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE; + sBattleBuffersTransferData[1] = arg1; + sBattleBuffersTransferData[2] = (arg1 & 0xFF00) >> 8; + sBattleBuffersTransferData[3] = 0; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b) { - gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; - gBattleBuffersTransferData[1] = b; - gBattleBuffersTransferData[2] = (b & 0xFF00) >> 8; - gBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; + sBattleBuffersTransferData[1] = b; + sBattleBuffersTransferData[2] = (b & 0xFF00) >> 8; + sBattleBuffersTransferData[3] = 0; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitCmd37(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_37; - gBattleBuffersTransferData[1] = CONTROLLER_37; - gBattleBuffersTransferData[2] = CONTROLLER_37; - gBattleBuffersTransferData[3] = CONTROLLER_37; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_37; + sBattleBuffersTransferData[1] = CONTROLLER_37; + sBattleBuffersTransferData[2] = CONTROLLER_37; + sBattleBuffersTransferData[3] = CONTROLLER_37; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitCmd38(u8 bufferId, u8 b) { - gBattleBuffersTransferData[0] = CONTROLLER_38; - gBattleBuffersTransferData[1] = b; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); + sBattleBuffersTransferData[0] = CONTROLLER_38; + sBattleBuffersTransferData[1] = b; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } void EmitCmd39(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_39; - gBattleBuffersTransferData[1] = CONTROLLER_39; - gBattleBuffersTransferData[2] = CONTROLLER_39; - gBattleBuffersTransferData[3] = CONTROLLER_39; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_39; + sBattleBuffersTransferData[1] = CONTROLLER_39; + sBattleBuffersTransferData[2] = CONTROLLER_39; + sBattleBuffersTransferData[3] = CONTROLLER_39; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitCmd40(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_40; - gBattleBuffersTransferData[1] = CONTROLLER_40; - gBattleBuffersTransferData[2] = CONTROLLER_40; - gBattleBuffersTransferData[3] = CONTROLLER_40; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_40; + sBattleBuffersTransferData[1] = CONTROLLER_40; + sBattleBuffersTransferData[2] = CONTROLLER_40; + sBattleBuffersTransferData[3] = CONTROLLER_40; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitHitAnimation(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION; - gBattleBuffersTransferData[1] = CONTROLLER_HITANIMATION; - gBattleBuffersTransferData[2] = CONTROLLER_HITANIMATION; - gBattleBuffersTransferData[3] = CONTROLLER_HITANIMATION; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION; + sBattleBuffersTransferData[1] = CONTROLLER_HITANIMATION; + sBattleBuffersTransferData[2] = CONTROLLER_HITANIMATION; + sBattleBuffersTransferData[3] = CONTROLLER_HITANIMATION; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitCmd42(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_42; - gBattleBuffersTransferData[1] = CONTROLLER_42; - gBattleBuffersTransferData[2] = CONTROLLER_42; - gBattleBuffersTransferData[3] = CONTROLLER_42; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_42; + sBattleBuffersTransferData[1] = CONTROLLER_42; + sBattleBuffersTransferData[2] = CONTROLLER_42; + sBattleBuffersTransferData[3] = CONTROLLER_42; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitEffectivenessSound(u8 bufferId, u16 songId) { - gBattleBuffersTransferData[0] = CONTROLLER_EFFECTIVENESSSOUND; - gBattleBuffersTransferData[1] = songId; - gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; - gBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_EFFECTIVENESSSOUND; + sBattleBuffersTransferData[1] = songId; + sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; + sBattleBuffersTransferData[3] = 0; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM) { - gBattleBuffersTransferData[0] = CONTROLLER_PLAYFANFAREORBGM; - gBattleBuffersTransferData[1] = songId; - gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; - gBattleBuffersTransferData[3] = playBGM; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_PLAYFANFAREORBGM; + sBattleBuffersTransferData[1] = songId; + sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; + sBattleBuffersTransferData[3] = playBGM; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitFaintingCry(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY; - gBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY; - gBattleBuffersTransferData[2] = CONTROLLER_FAINTINGCRY; - gBattleBuffersTransferData[3] = CONTROLLER_FAINTINGCRY; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY; + sBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY; + sBattleBuffersTransferData[2] = CONTROLLER_FAINTINGCRY; + sBattleBuffersTransferData[3] = CONTROLLER_FAINTINGCRY; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitIntroSlide(u8 bufferId, u8 terrainId) { - gBattleBuffersTransferData[0] = CONTROLLER_INTROSLIDE; - gBattleBuffersTransferData[1] = terrainId; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); + sBattleBuffersTransferData[0] = CONTROLLER_INTROSLIDE; + sBattleBuffersTransferData[1] = terrainId; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } void EmitIntroTrainerBallThrow(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW; - gBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW; - gBattleBuffersTransferData[2] = CONTROLLER_INTROTRAINERBALLTHROW; - gBattleBuffersTransferData[3] = CONTROLLER_INTROTRAINERBALLTHROW; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW; + sBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW; + sBattleBuffersTransferData[2] = CONTROLLER_INTROTRAINERBALLTHROW; + sBattleBuffersTransferData[3] = CONTROLLER_INTROTRAINERBALLTHROW; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; - gBattleBuffersTransferData[1] = arg2 & 0x7F; - gBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7; - gBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; + sBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; + sBattleBuffersTransferData[1] = arg2 & 0x7F; + sBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7; + sBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * 6); i++) - gBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus)); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4); + sBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus)); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4); } void EmitCmd49(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_49; - gBattleBuffersTransferData[1] = CONTROLLER_49; - gBattleBuffersTransferData[2] = CONTROLLER_49; - gBattleBuffersTransferData[3] = CONTROLLER_49; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_49; + sBattleBuffersTransferData[1] = CONTROLLER_49; + sBattleBuffersTransferData[2] = CONTROLLER_49; + sBattleBuffersTransferData[3] = CONTROLLER_49; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitCmd50(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_50; - gBattleBuffersTransferData[1] = CONTROLLER_50; - gBattleBuffersTransferData[2] = CONTROLLER_50; - gBattleBuffersTransferData[3] = CONTROLLER_50; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_50; + sBattleBuffersTransferData[1] = CONTROLLER_50; + sBattleBuffersTransferData[2] = CONTROLLER_50; + sBattleBuffersTransferData[3] = CONTROLLER_50; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible) { - gBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY; - gBattleBuffersTransferData[1] = isInvisible; - gBattleBuffersTransferData[2] = CONTROLLER_SPRITEINVISIBILITY; - gBattleBuffersTransferData[3] = CONTROLLER_SPRITEINVISIBILITY; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY; + sBattleBuffersTransferData[1] = isInvisible; + sBattleBuffersTransferData[2] = CONTROLLER_SPRITEINVISIBILITY; + sBattleBuffersTransferData[3] = CONTROLLER_SPRITEINVISIBILITY; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument) { - gBattleBuffersTransferData[0] = CONTROLLER_BATTLEANIMATION; - gBattleBuffersTransferData[1] = animationId; - gBattleBuffersTransferData[2] = argument; - gBattleBuffersTransferData[3] = (argument & 0xFF00) >> 8; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); + sBattleBuffersTransferData[0] = CONTROLLER_BATTLEANIMATION; + sBattleBuffersTransferData[1] = animationId; + sBattleBuffersTransferData[2] = argument; + sBattleBuffersTransferData[3] = (argument & 0xFF00) >> 8; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2) { bool8 arg2_ = arg2; - gBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG; - gBattleBuffersTransferData[1] = arg1; + sBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG; + sBattleBuffersTransferData[1] = arg1; if (arg2_) - gBattleBuffersTransferData[3] = gBattleBuffersTransferData[2] = sub_81850DC(&gBattleBuffersTransferData[4]); + sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = sub_81850DC(&sBattleBuffersTransferData[4]); else - gBattleBuffersTransferData[3] = gBattleBuffersTransferData[2] = 0; + sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = 0; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, gBattleBuffersTransferData[2] + 4); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[2] + 4); } void EmitResetActionMoveSelection(u8 bufferId, u8 caseId) { - gBattleBuffersTransferData[0] = CONTROLLER_RESETACTIONMOVESELECTION; - gBattleBuffersTransferData[1] = caseId; - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); + sBattleBuffersTransferData[0] = CONTROLLER_RESETACTIONMOVESELECTION; + sBattleBuffersTransferData[1] = caseId; + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } void EmitCmd55(u8 bufferId, u8 arg1) { - gBattleBuffersTransferData[0] = CONTROLLER_55; - gBattleBuffersTransferData[1] = arg1; - gBattleBuffersTransferData[2] = gSaveBlock2Ptr->field_CA9_b; - gBattleBuffersTransferData[3] = gSaveBlock2Ptr->field_CA9_b; - gBattleBuffersTransferData[5] = gBattleBuffersTransferData[4] = sub_81850DC(&gBattleBuffersTransferData[6]); - PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, gBattleBuffersTransferData[4] + 6); + sBattleBuffersTransferData[0] = CONTROLLER_55; + sBattleBuffersTransferData[1] = arg1; + sBattleBuffersTransferData[2] = gSaveBlock2Ptr->field_CA9_b; + sBattleBuffersTransferData[3] = gSaveBlock2Ptr->field_CA9_b; + sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = sub_81850DC(&sBattleBuffersTransferData[6]); + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[4] + 6); } diff --git a/src/link.c b/src/link.c index 1499b8275..13efb9504 100644 --- a/src/link.c +++ b/src/link.c @@ -98,12 +98,17 @@ u16 gUnknown_03003148[MAX_LINK_PLAYERS]; u8 gUnknown_03003150; u8 gUnknown_03003160; -u8 gUnknown_020223BC = 0; -u8 gUnknown_020223BD = 0; -bool8 gUnknown_020229C4 = FALSE; -u16 gUnknown_020229C6 = 0; -u16 gUnknown_020229C8 = 0; -struct LinkPlayer gUnknown_020229CC = {}; +EWRAM_DATA u8 gUnknown_020223BC = 0; +EWRAM_DATA u8 gUnknown_020223BD = 0; +EWRAM_DATA u32 gUnknown_020223C0 = 0; +EWRAM_DATA u16 gBlockRecvBuffer[MAX_LINK_PLAYERS + 1][BLOCK_BUFFER_SIZE / 2] = {}; +EWRAM_DATA u8 gUnknown_020228C4[BLOCK_BUFFER_SIZE] = {}; +EWRAM_DATA bool8 gUnknown_020229C4 = FALSE; +EWRAM_DATA u16 gUnknown_020229C6 = 0; +EWRAM_DATA u16 gUnknown_020229C8 = 0; +EWRAM_DATA struct LinkPlayer gUnknown_020229CC = {}; +EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_LINK_PLAYERS + 1] = {}; +EWRAM_DATA struct LinkPlayer gUnknown_02022A74[MAX_LINK_PLAYERS + 1] = {}; // Static ROM declarations @@ -116,7 +121,7 @@ static void sub_800A2E0(void); bool32 sub_800A2F4(const void *src, size_t size); static void sub_800A364(void); static void sub_800A388(void); -void sub_800A3EC(void); +static void sub_800A3EC(void); void sub_800A418(void); void task00_link_test(u8 taskId); void sub_800A588(u8 who); @@ -950,3 +955,15 @@ static void sub_800A388(void) gUnknown_03003140 = sub_800A3EC; } } + +static void sub_800A3EC(void) +{ + gUnknown_03003140 = NULL; +} + +void sub_800A3F8(void) +{ + GetMultiplayerId(); + sub_8009D90(0x4444); + gUnknown_020223C0 ++; +} diff --git a/sym_ewram.txt b/sym_ewram.txt index a293ce9ec..2a1218996 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -18,42 +18,7 @@ gStringVar4: @ 2021FC4 .space 0x3E8 .include "src/string_util.o" - -gUnknown_020223BC: @ 20223BC - .space 0x1 - -gUnknown_020223BD: @ 20223BD - .space 0x3 - -gUnknown_020223C0: @ 20223C0 - .space 0x4 - -gBlockRecvBuffer: @ 20223C4 - .space 0x500 - -gUnknown_020228C4: @ 20228C4 gBlockSendBuffer - .space 0x100 - -gUnknown_020229C4: @ 20229C4 - .space 0x2 - -gUnknown_020229C6: @ 20229C6 - .space 0x2 - -gUnknown_020229C8: @ 20229C8 - .space 0x4 - -gUnknown_020229CC: @ 20229CC - .space 0x1C - -gLinkPlayers: @ 20229E8 - .space 0x24 - -gUnknown_02022A0C: @ 2022A0C - .space 0x68 - -gUnknown_02022A74: @ 2022A74 - .space 0x8C + .include "src/link.o" gUnknown_02022B00: @ 2022B00 .space 0x8 @@ -175,6 +140,7 @@ gUnknown_02022CFC: @ 2022CFC gUnknown_02022D00: @ 2022D00 .space 0x4 +@ src/main_menu.c gUnknown_02022D04: @ 2022D04 .space 0x2 @@ -193,8 +159,7 @@ gUnknown_02022D0A: @ 2022D0A gUnknown_02022D0C: @ 2022D0C .space 0x4 -gBattleBuffersTransferData: @ 2022D10 - .space 0x100 + .include "src/battle_controllers.o" gUnknown_02022E10: @ 2022E10 .space 0x4 From 50c162250732dbe5d90b8e38d66c3dc7ea114f00 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 20:47:24 -0500 Subject: [PATCH 020/123] Split link.s and link_rfu.s --- asm/link.s | 68699 +------------------------------------------ asm/link_rfu.s | 11743 ++++++++ asm/rom_8011DC0.s | 56949 +++++++++++++++++++++++++++++++++++ data/link.s | 4618 --- data/link_rfu.s | 244 + data/rom_8011DC0.s | 4382 +++ include/link.h | 1 + ld_script.txt | 4 + src/link.c | 17 +- 9 files changed, 73340 insertions(+), 73317 deletions(-) create mode 100644 asm/link_rfu.s create mode 100644 asm/rom_8011DC0.s create mode 100644 data/link_rfu.s create mode 100644 data/rom_8011DC0.s diff --git a/asm/link.s b/asm/link.s index 1b910c485..0f1c1cb68 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,29 +5,6 @@ .text - thumb_func_start sub_800A418 -sub_800A418: @ 800A418 - push {lr} - ldr r1, =gUnknown_020223C0 - movs r0, 0 - str r0, [r1] - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0800A438 - bl sub_800F850 - b _0800A43E - .pool -_0800A438: - ldr r1, =gUnknown_03003140 - ldr r0, =sub_800A3F8 - str r0, [r1] -_0800A43E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A418 - thumb_func_start sub_800A44C sub_800A44C: @ 800A44C ldr r0, =gUnknown_020223C0 @@ -3245,68680 +3222,6 @@ _0800BE86: .pool thumb_func_end sub_800BE50 - thumb_func_start sub_800BEC0 -sub_800BEC0: @ 800BEC0 - push {r4,lr} - bl rfu_REQBN_softReset_and_checkID - adds r4, r0, 0 - ldr r0, =0x00008001 - cmp r4, r0 - bne _0800BED4 - ldr r1, =gUnknown_03004140 - movs r0, 0x1 - strb r0, [r1, 0x8] -_0800BED4: - ldr r0, =gUnknown_03004140 - ldrb r2, [r0, 0x4] - adds r1, r0, 0 - cmp r2, 0x17 - beq _0800BEE8 - cmp r2, 0x1 - beq _0800BEE8 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] -_0800BEE8: - movs r0, 0 - strb r0, [r1, 0x7] - strb r0, [r1, 0xD] - strb r0, [r1, 0x1] - strb r0, [r1] - movs r0, 0xFF - strb r0, [r1, 0x6] - bl sub_800D610 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800BEC0 - - thumb_func_start rfu_REQ_sendData_wrapper -rfu_REQ_sendData_wrapper: @ 800BF0C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - bne _0800BF34 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x2] - movs r2, 0 - cmp r0, 0x1 - bne _0800BF3C - movs r2, 0x1 - b _0800BF3C - .pool -_0800BF34: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x3] - movs r1, 0 - strb r1, [r0, 0x3] -_0800BF3C: - adds r0, r2, 0 - bl rfu_REQ_sendData - pop {r0} - bx r0 - .pool - thumb_func_end rfu_REQ_sendData_wrapper - - thumb_func_start sub_800BF4C -sub_800BF4C: @ 800BF4C - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - cmp r5, 0 - beq _0800BF94 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldr r2, =0x01000024 - mov r0, sp - adds r1, r4, 0 - bl CpuSet - movs r0, 0xFF - strb r0, [r4, 0x6] - str r5, [r4, 0x40] - str r6, [r4, 0x44] - ldr r0, =sub_800CEB0 - bl rfu_setMSCCallback - ldr r0, =sub_800C7B4 - bl rfu_setREQCallback - movs r0, 0 - b _0800BF96 - .pool -_0800BF94: - movs r0, 0x4 -_0800BF96: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_800BF4C - - thumb_func_start sub_800BFA0 -sub_800BFA0: @ 800BFA0 - push {r4,lr} - sub sp, 0x4 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldr r2, =0x01000020 - mov r0, sp - adds r1, r4, 0 - bl CpuSet - movs r0, 0xFF - strb r0, [r4, 0x6] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BFA0 - - thumb_func_start sub_800BFCC -sub_800BFCC: @ 800BFCC - push {r4,lr} - adds r4, r0, 0 - bl sub_800C000 - ldr r1, =gUnknown_03004140 - movs r2, 0x1 - strb r2, [r1, 0x4] - movs r0, 0x2 - strb r0, [r1, 0x5] - str r4, [r1, 0x3C] - ldrb r0, [r4, 0x11] - strb r0, [r1, 0x9] - ldrh r0, [r4, 0x12] - strh r0, [r1, 0x32] - ldrh r0, [r4, 0x14] - strh r0, [r1, 0x18] - ldrb r0, [r4, 0x10] - cmp r0, 0 - beq _0800BFF4 - strb r2, [r1, 0xB] -_0800BFF4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BFCC - - thumb_func_start sub_800C000 -sub_800C000: @ 800C000 - push {r4,r5,lr} - ldr r2, =gUnknown_03004140 - movs r0, 0 - strb r0, [r2, 0x5] - strb r0, [r2, 0x4] - movs r1, 0xFF - strb r1, [r2, 0x6] - strb r0, [r2, 0x7] - strb r0, [r2, 0x10] - strb r0, [r2, 0xC] - adds r1, r2, 0 - adds r1, 0x24 - strb r0, [r1] - adds r1, 0xC - strb r0, [r1] - movs r3, 0 - adds r5, r2, 0 - adds r5, 0x28 - movs r4, 0 - adds r2, 0x34 -_0800C028: - lsls r1, r3, 1 - adds r0, r1, r5 - strh r4, [r0] - adds r1, r2 - strh r4, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800C028 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C000 - - thumb_func_start sub_800C048 -sub_800C048: @ 800C048 - ldr r1, =gUnknown_03004140 - movs r0, 0x15 - strb r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_800C048 - - thumb_func_start sub_800C054 -sub_800C054: @ 800C054 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r3, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 16 - lsrs r2, 16 - mov r8, r2 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C090 - cmp r0, 0x8 - bne _0800C07A - cmp r5, 0x1 - beq _0800C090 -_0800C07A: - movs r0, 0x1 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x1 - b _0800C122 - .pool -_0800C090: - bl rfu_getMasterSlave - lsls r0, 24 - cmp r0, 0 - bne _0800C0B0 - ldr r1, =gUnknown_03004140 - movs r0, 0x2 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x2 - b _0800C122 - .pool -_0800C0B0: - movs r2, 0 - ldrh r0, [r6] - ldr r4, =0x0000ffff - adds r1, r6, 0x2 - ldr r3, =gUnknown_03004140 - cmp r0, r4 - beq _0800C0D0 -_0800C0BE: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xF - bhi _0800C0D0 - ldrh r0, [r1] - adds r1, 0x2 - cmp r0, r4 - bne _0800C0BE -_0800C0D0: - cmp r2, 0x10 - bne _0800C0EC - movs r0, 0x4 - strh r0, [r3, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x4 - b _0800C122 - .pool -_0800C0EC: - cmp r5, 0x1 - bls _0800C0FA - movs r0, 0x1 - strb r0, [r3, 0x7] - movs r5, 0x1 - movs r7, 0 - b _0800C0FE -_0800C0FA: - movs r0, 0 - strb r0, [r3, 0x7] -_0800C0FE: - cmp r5, 0 - beq _0800C108 - movs r0, 0x5 - strb r0, [r3, 0x4] - b _0800C116 -_0800C108: - movs r0, 0x9 - strb r0, [r3, 0x4] - ldrb r0, [r3, 0xB] - cmp r0, 0 - beq _0800C116 - movs r0, 0x2 - strb r0, [r3, 0xB] -_0800C116: - strb r5, [r3, 0x6] - strh r7, [r3, 0x1A] - mov r0, r8 - strh r0, [r3, 0x26] - str r6, [r3, 0x20] - movs r0, 0 -_0800C122: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800C054 - - thumb_func_start sub_800C12C -sub_800C12C: @ 800C12C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C164 - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _0800C164 - movs r0, 0x1 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x1 - b _0800C204 - .pool -_0800C164: - bl rfu_getMasterSlave - lsls r0, 24 - cmp r0, 0 - bne _0800C184 - ldr r1, =gUnknown_03004140 - movs r0, 0x2 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x2 - b _0800C204 - .pool -_0800C184: - movs r2, 0 - ldr r0, =gUnknown_03007890 - ldr r1, [r0] - ldrb r3, [r1, 0x8] - ldr r5, =gUnknown_03004140 - adds r7, r0, 0 - cmp r2, r3 - bcs _0800C1B2 - ldrh r0, [r1, 0x14] - cmp r0, r6 - beq _0800C1B2 - adds r4, r1, 0 - adds r1, r3, 0 -_0800C19E: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r1 - bcs _0800C1B2 - lsls r0, r2, 5 - adds r0, r4, r0 - ldrh r0, [r0, 0x14] - cmp r0, r6 - bne _0800C19E -_0800C1B2: - ldr r0, [r7] - ldrb r0, [r0, 0x8] - cmp r0, 0 - beq _0800C1BE - cmp r2, r0 - bne _0800C1D8 -_0800C1BE: - movs r0, 0x3 - strh r0, [r5, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x3 - b _0800C204 - .pool -_0800C1D8: - ldrb r0, [r5, 0x4] - cmp r0, 0 - beq _0800C1E2 - cmp r0, 0x9 - bne _0800C1EA -_0800C1E2: - movs r0, 0xC - strb r0, [r5, 0x4] - movs r0, 0xD - b _0800C1F0 -_0800C1EA: - movs r0, 0xB - strb r0, [r5, 0x4] - movs r0, 0xC -_0800C1F0: - strb r0, [r5, 0x5] - strh r6, [r5, 0x1E] - mov r0, r8 - strh r0, [r5, 0x1A] - ldrb r0, [r5, 0x7] - cmp r0, 0 - beq _0800C202 - movs r0, 0x7 - strb r0, [r5, 0x7] -_0800C202: - movs r0, 0 -_0800C204: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800C12C - - thumb_func_start sub_800C210 -sub_800C210: @ 800C210 - push {r4-r7,lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r6, =gUnknown_03004140 - adds r3, r6, 0 - adds r3, 0x30 - ldrb r2, [r3] - adds r0, r1, 0 - ands r0, r2 - cmp r0, 0 - beq _0800C26C - adds r0, r2, 0 - bics r0, r1 - strb r0, [r3] - movs r4, 0 - ldr r7, =gUnknown_03007890 - movs r5, 0x1 - adds r3, 0x4 - movs r2, 0 -_0800C236: - adds r0, r1, 0 - asrs r0, r4 - ands r0, r5 - cmp r0, 0 - beq _0800C246 - lsls r0, r4, 1 - adds r0, r3 - strh r2, [r0] -_0800C246: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800C236 - ldr r0, [r7] - ldrb r4, [r0, 0x3] - ands r4, r1 - cmp r4, 0 - beq _0800C260 - adds r0, r4, 0 - bl sub_800D334 -_0800C260: - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - adds r1, r4, 0 - bl sub_800D30C -_0800C26C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C210 - - thumb_func_start sub_800C27C -sub_800C27C: @ 800C27C - push {r4,r5,lr} - lsls r0, 24 - movs r2, 0 - ldr r1, =gUnknown_03004140 - strb r2, [r1, 0x7] - adds r5, r1, 0 - cmp r0, 0 - beq _0800C29C - bl sub_800C000 - movs r0, 0x17 - strb r0, [r5, 0x4] - b _0800C366 - .pool -_0800C29C: - ldrb r0, [r5, 0x4] - subs r0, 0x5 - cmp r0, 0xD - bhi _0800C352 - lsls r0, 2 - ldr r1, =_0800C2B4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C2B4: - .4byte _0800C2EC - .4byte _0800C2F8 - .4byte _0800C2F8 - .4byte _0800C358 - .4byte _0800C302 - .4byte _0800C30C - .4byte _0800C30C - .4byte _0800C316 - .4byte _0800C320 - .4byte _0800C320 - .4byte _0800C358 - .4byte _0800C326 - .4byte _0800C34C - .4byte _0800C34C -_0800C2EC: - movs r1, 0 - movs r0, 0x8 - strb r0, [r5, 0x4] - strb r1, [r5, 0x5] - movs r2, 0x13 - b _0800C358 -_0800C2F8: - movs r0, 0x7 - strb r0, [r5, 0x4] - movs r0, 0x8 - strb r0, [r5, 0x5] - b _0800C358 -_0800C302: - movs r0, 0 - strb r0, [r5, 0x5] - strb r0, [r5, 0x4] - movs r2, 0x21 - b _0800C358 -_0800C30C: - movs r1, 0 - movs r0, 0xB - strb r0, [r5, 0x4] - strb r1, [r5, 0x5] - b _0800C358 -_0800C316: - movs r0, 0 - strb r0, [r5, 0x5] - strb r0, [r5, 0x4] - movs r2, 0x23 - b _0800C358 -_0800C320: - movs r0, 0xE - strb r0, [r5, 0x4] - b _0800C358 -_0800C326: - ldrb r0, [r5, 0x11] - strb r0, [r5, 0x4] - ldrb r0, [r5, 0x12] - strb r0, [r5, 0x5] - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - bl sub_800D334 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - strh r0, [r5, 0x14] - movs r0, 0x33 - movs r1, 0x1 - bl sub_800D30C - b _0800C366 - .pool -_0800C34C: - movs r0, 0x12 - strb r0, [r5, 0x4] - b _0800C358 -_0800C352: - strb r2, [r5, 0x5] - strb r2, [r5, 0x4] - movs r2, 0x43 -_0800C358: - ldrb r0, [r5, 0x4] - cmp r0, 0 - bne _0800C366 - adds r0, r2, 0 - movs r1, 0 - bl sub_800D30C -_0800C366: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_800C27C - - thumb_func_start sub_800C36C -sub_800C36C: @ 800C36C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0 - mov r8, r1 - mov r5, sp - adds r5, 0x1 - mov r4, sp - adds r4, 0x2 - mov r1, sp - adds r2, r5, 0 - adds r3, r4, 0 - bl rfu_REQBN_watchLink - mov r0, sp - ldrb r0, [r0] - adds r7, r4, 0 - cmp r0, 0 - beq _0800C43E - ldr r1, =gUnknown_03004140 - mov r0, sp - ldrb r0, [r0] - strh r0, [r1, 0x14] - ldrb r0, [r5] - strh r0, [r1, 0x16] - ldrb r0, [r1, 0x9] - adds r6, r1, 0 - cmp r0, 0 - beq _0800C426 - movs r0, 0x1 - strb r0, [r6, 0xA] - ldrb r0, [r6, 0x6] - cmp r0, 0 - bne _0800C3C2 - ldrb r0, [r5] - cmp r0, 0 - bne _0800C3C2 - movs r0, 0x4 - strb r0, [r6, 0xA] -_0800C3C2: - ldrb r0, [r6, 0xA] - cmp r0, 0x1 - bne _0800C40C - movs r2, 0 - mov r4, sp - movs r5, 0x1 - mov r12, r6 - mov r3, r12 - adds r3, 0x30 - movs r6, 0x34 - add r6, r12 - mov r9, r6 -_0800C3DA: - ldrb r0, [r4] - asrs r0, r2 - ands r0, r5 - cmp r0, 0 - beq _0800C3F8 - adds r0, r5, 0 - lsls r0, r2 - ldrb r1, [r3] - orrs r0, r1 - strb r0, [r3] - lsls r0, r2, 1 - add r0, r9 - mov r6, r12 - ldrh r1, [r6, 0x32] - strh r1, [r0] -_0800C3F8: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C3DA - movs r0, 0x31 - b _0800C41E - .pool -_0800C40C: - movs r0, 0 - strb r0, [r6, 0xA] - mov r0, sp - ldrb r0, [r0] - bl sub_800D334 - movs r0, 0x1 - mov r8, r0 - movs r0, 0x33 -_0800C41E: - movs r1, 0x1 - bl sub_800D30C - b _0800C43A -_0800C426: - mov r0, sp - ldrb r0, [r0] - bl sub_800D334 - movs r1, 0x1 - mov r8, r1 - movs r0, 0x30 - movs r1, 0x2 - bl sub_800D30C -_0800C43A: - bl sub_800D610 -_0800C43E: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800C518 - ldrb r0, [r7] - cmp r0, 0 - beq _0800C49C - movs r2, 0 - ldr r6, =gUnknown_03004140 - movs r3, 0x1 - adds r4, r6, 0 - adds r4, 0x34 - adds r6, 0x30 - adds r5, r7, 0 -_0800C45C: - ldrb r0, [r6] - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - beq _0800C478 - ldrb r0, [r5] - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - beq _0800C478 - lsls r0, r2, 1 - adds r0, r4 - movs r1, 0 - strh r1, [r0] -_0800C478: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C45C - ldr r3, =gUnknown_03004140 - adds r2, r3, 0 - adds r2, 0x30 - ldrb r1, [r7] - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r7] - strh r0, [r3, 0x14] - movs r0, 0x32 - movs r1, 0x1 - bl sub_800D30C -_0800C49C: - ldr r0, =gUnknown_03004140 - adds r3, r0, 0 - adds r3, 0x30 - ldrb r1, [r3] - adds r6, r0, 0 - cmp r1, 0 - beq _0800C514 - movs r4, 0 - movs r2, 0 - movs r5, 0x1 -_0800C4B0: - ldrb r0, [r3] - asrs r0, r2 - ands r0, r5 - cmp r0, 0 - beq _0800C4E2 - lsls r1, r2, 1 - adds r0, r6, 0 - adds r0, 0x34 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _0800C4E2 - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _0800C4E2 - adds r0, r5, 0 - lsls r0, r2 - ldrb r1, [r3] - bics r1, r0 - strb r1, [r3] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0800C4E2: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C4B0 - cmp r4, 0 - beq _0800C506 - adds r0, r4, 0 - bl sub_800D334 - movs r6, 0x1 - mov r8, r6 - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - movs r1, 0x1 - bl sub_800D30C -_0800C506: - ldr r0, =gUnknown_03004140 - adds r1, r0, 0 - adds r1, 0x30 - ldrb r1, [r1] - adds r6, r0, 0 - cmp r1, 0 - bne _0800C518 -_0800C514: - movs r0, 0 - strb r0, [r6, 0xA] -_0800C518: - mov r0, r8 - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800C36C - - thumb_func_start rfu_syncVBlank_ -rfu_syncVBlank_: @ 800C530 - push {lr} - bl rfu_syncVBlank - lsls r0, 16 - cmp r0, 0 - beq _0800C548 - movs r0, 0xF1 - movs r1, 0 - bl sub_800D30C - bl sub_800D610 -_0800C548: - pop {r0} - bx r0 - thumb_func_end rfu_syncVBlank_ - - thumb_func_start sub_800C54C -sub_800C54C: @ 800C54C - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gUnknown_03004140 - ldr r2, [r1, 0x40] - cmp r2, 0 - bne _0800C568 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C568 - strb r2, [r1, 0x4] - b _0800C736 - .pool -_0800C568: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x7] - cmp r0, 0 - beq _0800C576 - adds r0, r3, 0 - bl sub_800C744 -_0800C576: - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x4] - cmp r0, 0 - bne _0800C580 - b _0800C700 -_0800C580: - bl rfu_waitREQComplete - movs r0, 0x1 - strb r0, [r4, 0xE] - ldrb r0, [r4, 0x4] - subs r0, 0x1 - cmp r0, 0x16 - bls _0800C592 - b _0800C6F6 -_0800C592: - lsls r0, 2 - ldr r1, =_0800C5A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C5A4: - .4byte _0800C624 - .4byte _0800C65C - .4byte _0800C662 - .4byte _0800C678 - .4byte _0800C690 - .4byte _0800C696 - .4byte _0800C69C - .4byte _0800C6F6 - .4byte _0800C6A2 - .4byte _0800C6A8 - .4byte _0800C6AE - .4byte _0800C6B4 - .4byte _0800C6C4 - .4byte _0800C6CA - .4byte _0800C6F6 - .4byte _0800C6D0 - .4byte _0800C6E0 - .4byte _0800C6E6 - .4byte _0800C6EC - .4byte _0800C6F6 - .4byte _0800C6F2 - .4byte _0800C6F6 - .4byte _0800C600 -_0800C600: - bl sub_800BEC0 - ldr r1, =0x00008001 - movs r2, 0xFF - cmp r0, r1 - bne _0800C60E - movs r2, 0x44 -_0800C60E: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - adds r0, r2, 0 - b _0800C64E - .pool -_0800C624: - bl sub_800BEC0 - ldr r1, =0x00008001 - cmp r0, r1 - bne _0800C644 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - movs r1, 0x3 - strb r1, [r0, 0x5] - b _0800C6F6 - .pool -_0800C644: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - movs r0, 0xFF -_0800C64E: - movs r1, 0 - bl sub_800D30C - b _0800C6F6 - .pool -_0800C65C: - bl rfu_REQ_reset - b _0800C6F6 -_0800C662: - ldr r0, =gUnknown_03004140 - ldr r2, [r0, 0x3C] - ldrh r0, [r2, 0x2] - ldrb r1, [r2] - ldrb r2, [r2, 0x1] - bl rfu_REQ_configSystem - b _0800C6F6 - .pool -_0800C678: - ldr r0, =gUnknown_03004140 - ldr r3, [r0, 0x3C] - ldrb r0, [r3, 0x4] - ldrh r1, [r3, 0x6] - ldr r2, [r3, 0x8] - ldr r3, [r3, 0xC] - bl rfu_REQ_configGameData - b _0800C6F6 - .pool -_0800C690: - bl rfu_REQ_startSearchChild - b _0800C6F6 -_0800C696: - bl rfu_REQ_pollSearchChild - b _0800C6F6 -_0800C69C: - bl rfu_REQ_endSearchChild - b _0800C6F6 -_0800C6A2: - bl rfu_REQ_startSearchParent - b _0800C6F6 -_0800C6A8: - bl rfu_REQ_pollSearchParent - b _0800C6F6 -_0800C6AE: - bl rfu_REQ_endSearchParent - b _0800C6F6 -_0800C6B4: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x1E] - bl rfu_REQ_startConnectParent - b _0800C6F6 - .pool -_0800C6C4: - bl rfu_REQ_pollConnectParent - b _0800C6F6 -_0800C6CA: - bl rfu_REQ_endConnectParent - b _0800C6F6 -_0800C6D0: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bl rfu_REQ_CHILD_startConnectRecovery - b _0800C6F6 - .pool -_0800C6E0: - bl rfu_REQ_CHILD_pollConnectRecovery - b _0800C6F6 -_0800C6E6: - bl rfu_REQ_CHILD_endConnectRecovery - b _0800C6F6 -_0800C6EC: - bl rfu_REQ_changeMasterSlave - b _0800C6F6 -_0800C6F2: - bl rfu_REQ_stopMode -_0800C6F6: - bl rfu_waitREQComplete - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0xE] -_0800C700: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x4] - subs r0, 0x12 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0800C710 - b _0800C576 -_0800C710: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800C726 - movs r0, 0 - bl sub_800C36C - lsls r0, 24 - cmp r0, 0 - bne _0800C736 -_0800C726: - bl sub_800CF34 - bl sub_800D158 - bl sub_800D268 - bl sub_800D434 -_0800C736: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C54C - - thumb_func_start sub_800C744 -sub_800C744: @ 800C744 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x7] - adds r4, r0, 0 - cmp r1, 0x5 - bne _0800C76E - movs r2, 0x1 - strb r2, [r4, 0x6] - strb r1, [r4, 0x4] - ldrh r0, [r4, 0x1C] - strh r0, [r4, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C76C - movs r0, 0x6 - strb r0, [r4, 0x7] - b _0800C76E - .pool -_0800C76C: - strb r2, [r4, 0x7] -_0800C76E: - ldrb r0, [r4, 0x7] - cmp r0, 0x1 - bne _0800C798 - strb r0, [r4, 0x6] - movs r0, 0x5 - strb r0, [r4, 0x4] - adds r0, r3, 0 - movs r1, 0x8C - bl __umodsi3 - strh r0, [r4, 0x1A] - movs r1, 0x8C - subs r1, r0 - strh r1, [r4, 0x1C] - lsls r0, 16 - cmp r0, 0 - beq _0800C794 - movs r0, 0x2 - b _0800C796 -_0800C794: - movs r0, 0x3 -_0800C796: - strb r0, [r4, 0x7] -_0800C798: - ldrb r0, [r4, 0x7] - cmp r0, 0x3 - bne _0800C7AE - movs r0, 0 - strb r0, [r4, 0x6] - movs r0, 0x28 - strh r0, [r4, 0x1A] - movs r0, 0x4 - strb r0, [r4, 0x7] - movs r0, 0x9 - strb r0, [r4, 0x4] -_0800C7AE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800C744 - - thumb_func_start sub_800C7B4 -sub_800C7B4: @ 800C7B4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r6, r1, 16 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0xE] - adds r7, r0, 0 - cmp r1, 0 - bne _0800C7D2 - b _0800CC98 -_0800C7D2: - movs r0, 0 - strb r0, [r7, 0xE] - mov r0, r8 - subs r0, 0x10 - cmp r0, 0x2D - bls _0800C7E0 - b _0800CC8A -_0800C7E0: - lsls r0, 2 - ldr r1, =_0800C7F4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C7F4: - .4byte _0800C8AC - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800C8D8 - .4byte _0800C8C4 - .4byte _0800CC8A - .4byte _0800C8EC - .4byte _0800C8FC - .4byte _0800C920 - .4byte _0800C940 - .4byte _0800C960 - .4byte _0800C9D0 - .4byte _0800CA02 - .4byte _0800CA18 - .4byte _0800CA60 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CBD8 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CAD0 - .4byte _0800CB1C - .4byte _0800CB64 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC78 -_0800C8AC: - cmp r6, 0 - beq _0800C8B2 - b _0800CC8A -_0800C8B2: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - movs r1, 0x4 - strb r1, [r0, 0x5] - b _0800CC8A - .pool -_0800C8C4: - cmp r6, 0 - beq _0800C8CA - b _0800CC8A -_0800C8CA: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - b _0800CC8A - .pool -_0800C8D8: - cmp r6, 0 - beq _0800C8DE - b _0800CC8A -_0800C8DE: - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0x5] - strb r6, [r0, 0x4] - movs r0, 0 - b _0800CBF6 - .pool -_0800C8EC: - cmp r6, 0 - beq _0800C8F2 - b _0800CC8A -_0800C8F2: - ldr r1, =gUnknown_03004140 - movs r0, 0x6 - b _0800CA0C - .pool -_0800C8FC: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800C906 - b _0800CC8A -_0800C906: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C912 - b _0800CC8A -_0800C912: - movs r0, 0x7 - strb r0, [r1, 0x4] - movs r0, 0x8 - strb r0, [r1, 0x5] - b _0800CC8A - .pool -_0800C920: - cmp r6, 0 - beq _0800C926 - b _0800CC8A -_0800C926: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - ldrb r0, [r0, 0x7] - cmp r0, 0 - beq _0800C936 - b _0800CC8A -_0800C936: - movs r0, 0x13 - b _0800CBF6 - .pool -_0800C940: - cmp r6, 0 - beq _0800C946 - b _0800CC8A -_0800C946: - ldrb r0, [r7, 0xB] - cmp r0, 0x1 - bne _0800C956 - ldrh r0, [r7, 0x1A] - cmp r0, 0x1 - bls _0800C956 - subs r0, 0x1 - strh r0, [r7, 0x1A] -_0800C956: - ldr r1, =gUnknown_03004140 - movs r0, 0xA - b _0800CA0C - .pool -_0800C960: - cmp r6, 0 - bne _0800C9A6 - bl sub_800D294 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - ldr r4, =gUnknown_03004140 - strh r0, [r4, 0x14] - cmp r0, 0 - beq _0800C980 - movs r0, 0x20 - movs r1, 0x1 - bl sub_800D30C -_0800C980: - ldrb r0, [r4, 0xB] - cmp r0, 0 - beq _0800C9A6 - ldrh r0, [r4, 0x1A] - cmp r0, 0x1 - beq _0800C9A6 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0x4 - bne _0800C9A6 - bl rfu_REQ_endSearchParent - bl rfu_waitREQComplete - movs r0, 0x9 - strb r0, [r4, 0x4] - movs r0, 0x1 - strb r0, [r4, 0xB] -_0800C9A6: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800C9B0 - b _0800CC8A -_0800C9B0: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C9BC - b _0800CC8A -_0800C9BC: - movs r0, 0xB - strb r0, [r1, 0x4] - movs r0, 0 - strb r0, [r1, 0x5] - b _0800CC8A - .pool -_0800C9D0: - cmp r6, 0 - beq _0800C9D6 - b _0800CC8A -_0800C9D6: - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x5] - strb r0, [r2, 0x4] - ldrb r1, [r2, 0x7] - cmp r1, 0 - bne _0800C9F4 - lsls r0, 24 - cmp r0, 0 - beq _0800C9EA - b _0800CC8A -_0800C9EA: - movs r0, 0x21 - b _0800CBF6 - .pool -_0800C9F4: - cmp r1, 0x7 - bne _0800C9FA - b _0800CC8A -_0800C9FA: - movs r0, 0x5 - strb r0, [r2, 0x4] - strb r0, [r2, 0x7] - b _0800CC8A -_0800CA02: - cmp r6, 0 - beq _0800CA08 - b _0800CC8A -_0800CA08: - ldr r1, =gUnknown_03004140 - movs r0, 0xD -_0800CA0C: - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - b _0800CC8A - .pool -_0800CA18: - cmp r6, 0 - bne _0800CA3C - ldr r4, =gUnknown_03004150 - mov r0, sp - adds r1, r4, 0 - bl rfu_getConnectParentStatus - lsls r0, 16 - cmp r0, 0 - bne _0800CA3C - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CA3C - adds r1, r4, 0 - subs r1, 0x10 - movs r0, 0xE - strb r0, [r1, 0x4] -_0800CA3C: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800CA46 - b _0800CC8A -_0800CA46: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800CA52 - b _0800CC8A -_0800CA52: - movs r0, 0xE - strb r0, [r1, 0x4] - b _0800CC8A - .pool -_0800CA60: - cmp r6, 0 - beq _0800CA66 - b _0800CC8A -_0800CA66: - ldr r4, =gUnknown_03004150 - mov r0, sp - adds r1, r4, 0 - bl rfu_getConnectParentStatus - lsls r0, 16 - cmp r0, 0 - beq _0800CA78 - b _0800CC8A -_0800CA78: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CA9C - adds r1, r4, 0 - subs r1, 0x10 - movs r0, 0x13 - strb r0, [r1, 0x4] - movs r0, 0xF - strb r0, [r1, 0x5] - movs r0, 0x22 - strh r0, [r1, 0x1E] - ldrb r0, [r1, 0x10] - strh r0, [r1, 0x14] - b _0800CABC - .pool -_0800CA9C: - adds r1, r4, 0 - subs r1, 0x10 - strb r6, [r1, 0x5] - strb r6, [r1, 0x4] - movs r0, 0x23 - strh r0, [r1, 0x1E] - mov r0, sp - ldrb r0, [r0] - strh r0, [r1, 0x14] - ldrb r0, [r1, 0x7] - cmp r0, 0 - beq _0800CABC - movs r0, 0x3 - strb r0, [r1, 0x7] - movs r0, 0x9 - strb r0, [r1, 0x4] -_0800CABC: - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x1E] - movs r1, 0x1 - bl sub_800D30C - movs r0, 0 - strh r0, [r4, 0x1E] - b _0800CC8A - .pool -_0800CAD0: - cmp r6, 0 - beq _0800CAD6 - b _0800CC8A -_0800CAD6: - ldr r2, =gUnknown_03007890 - ldr r3, [r2] - ldrb r0, [r3, 0x3] - movs r1, 0 - strh r0, [r7, 0x14] - movs r0, 0x11 - strb r0, [r7, 0x5] - strb r0, [r7, 0x4] - strb r1, [r7, 0x10] - ldrb r0, [r3, 0x3] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800CAF4 - b _0800CC8A -_0800CAF4: - adds r1, r7, 0 - movs r3, 0x1 -_0800CAF8: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bls _0800CB08 - b _0800CC8A -_0800CB08: - ldr r0, [r2] - ldrb r0, [r0, 0x3] - ldrb r4, [r7, 0x10] - asrs r0, r4 - ands r0, r3 - cmp r0, 0 - beq _0800CAF8 - b _0800CC8A - .pool -_0800CB1C: - cmp r6, 0 - bne _0800CB3A - mov r0, sp - bl rfu_CHILD_getConnectRecoveryStatus - lsls r0, 16 - cmp r0, 0 - bne _0800CB3A - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0800CB3A - ldr r1, =gUnknown_03004140 - movs r0, 0x12 - strb r0, [r1, 0x4] -_0800CB3A: - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x10] - lsls r0, 1 - adds r1, r2, 0 - adds r1, 0x34 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, 0 - bne _0800CB4E - b _0800CC8A -_0800CB4E: - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _0800CB5A - b _0800CC8A -_0800CB5A: - movs r0, 0x12 - strb r0, [r2, 0x4] - b _0800CC8A - .pool -_0800CB64: - cmp r6, 0 - beq _0800CB6A - b _0800CC8A -_0800CB6A: - mov r0, sp - bl rfu_CHILD_getConnectRecoveryStatus - lsls r0, 16 - cmp r0, 0 - beq _0800CB78 - b _0800CC8A -_0800CB78: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CB94 - ldr r1, =gUnknown_03004140 - movs r0, 0x13 - strb r0, [r1, 0x4] - movs r0, 0x16 - strb r0, [r1, 0x5] - movs r0, 0x32 - strh r0, [r1, 0x1E] - b _0800CBA8 - .pool -_0800CB94: - ldr r4, =gUnknown_03004140 - strb r6, [r4, 0x5] - strb r6, [r4, 0x4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bl sub_800D334 - movs r0, 0x33 - strh r0, [r4, 0x1E] -_0800CBA8: - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x34 - adds r0, r1 - movs r1, 0 - movs r4, 0 - strh r4, [r0] - adds r0, r5, 0 - adds r0, 0x30 - strb r1, [r0] - strb r1, [r5, 0xA] - ldrb r0, [r5, 0x1E] - movs r1, 0x1 - bl sub_800D30C - strh r4, [r5, 0x1E] - b _0800CC8A - .pool -_0800CBD8: - cmp r6, 0 - bne _0800CC8A - ldr r5, =gUnknown_03004140 - ldrb r1, [r5, 0x5] - adds r0, r1, 0 - cmp r0, 0x16 - bne _0800CC04 - ldrb r0, [r5, 0x11] - strb r0, [r5, 0x4] - ldrb r0, [r5, 0x12] - strb r0, [r5, 0x5] - ldrb r0, [r5, 0x2] - movs r0, 0x1 - strb r0, [r5, 0x2] - movs r0, 0x41 -_0800CBF6: - movs r1, 0 - bl sub_800D30C - b _0800CC8A - .pool -_0800CC04: - cmp r0, 0xF - bne _0800CC8A - strb r1, [r5, 0x4] - ldrb r0, [r5, 0x2] - movs r4, 0x1 - strb r4, [r5, 0x2] - movs r0, 0x41 - movs r1, 0 - bl sub_800D30C - adds r1, r5, 0 - adds r1, 0x24 - ldrb r0, [r5, 0x10] - lsls r4, r0 - ldrb r0, [r1] - orrs r4, r0 - strb r4, [r1] - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, 0x4 - adds r0, r1 - ldrh r1, [r5, 0x26] - movs r7, 0 - strh r1, [r0] - ldrb r1, [r5, 0x10] - movs r0, 0x4 - bl rfu_clearSlot - mov r4, sp - ldrb r0, [r5, 0x10] - movs r1, 0xE - bl rfu_NI_CHILD_setSendGameName - strb r0, [r4] - lsls r0, 24 - cmp r0, 0 - beq _0800CC8A - strb r7, [r5, 0x5] - strb r7, [r5, 0x4] - bl sub_800D610 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl sub_800D334 - mov r0, sp - ldrb r0, [r0] - strh r0, [r5, 0x14] - movs r0, 0x25 - movs r1, 0x1 - bl sub_800D30C - b _0800CC8A - .pool -_0800CC78: - cmp r6, 0 - bne _0800CC8A - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0x5] - strb r6, [r0, 0x4] - movs r0, 0x42 - movs r1, 0 - bl sub_800D30C -_0800CC8A: - ldr r1, =gUnknown_03004140 - movs r0, 0x1 - strb r0, [r1, 0xE] - b _0800CCE6 - .pool -_0800CC98: - cmp r6, 0x3 - bne _0800CCE6 - ldrb r0, [r7, 0xF] - cmp r0, 0 - beq _0800CCE6 - mov r3, r8 - cmp r3, 0x24 - beq _0800CCB0 - cmp r3, 0x26 - beq _0800CCB0 - cmp r3, 0x27 - bne _0800CCE6 -_0800CCB0: - bl rfu_REQ_RFUStatus - bl rfu_waitREQComplete - mov r0, sp - bl rfu_getRFUStatus - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CCE6 - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - bne _0800CCE6 - bl rfu_getSTWIRecvBuffer - ldr r1, [r4] - ldrb r1, [r1, 0x2] - strb r1, [r0, 0x4] - movs r1, 0x1 - strb r1, [r0, 0x5] - movs r0, 0x29 - bl sub_800C36C - movs r6, 0 -_0800CCE6: - mov r4, r8 - cmp r4, 0x26 - bne _0800CCEE - b _0800CE02 -_0800CCEE: - cmp r4, 0x26 - bgt _0800CD00 - cmp r4, 0x10 - bne _0800CCF8 - b _0800CE20 -_0800CCF8: - b _0800CE3E - .pool -_0800CD00: - mov r0, r8 - cmp r0, 0x30 - beq _0800CD0E - cmp r0, 0x3D - bne _0800CD0C - b _0800CE20 -_0800CD0C: - b _0800CE3E -_0800CD0E: - cmp r6, 0 - beq _0800CD14 - b _0800CE42 -_0800CD14: - bl rfu_getSTWIRecvBuffer - ldr r4, =gUnknown_03004140 - ldrb r0, [r0, 0x8] - strh r0, [r4, 0x14] - bl sub_800D358 - adds r2, r4, 0 - adds r2, 0x30 - ldrb r1, [r2] - cmp r1, 0 - beq _0800CD6A - ldrb r0, [r4, 0x14] - adds r3, r1, 0 - bics r3, r0 - adds r0, r3, 0 - strb r0, [r2] - movs r3, 0 - adds r7, r4, 0 - adds r1, r7, 0 - movs r5, 0x1 - adds r4, r1, 0 - adds r4, 0x34 - movs r2, 0 -_0800CD44: - ldrh r0, [r1, 0x14] - asrs r0, r3 - ands r0, r5 - cmp r0, 0 - beq _0800CD54 - lsls r0, r3, 1 - adds r0, r4 - strh r2, [r0] -_0800CD54: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800CD44 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x6] - cmp r0, 0 - bne _0800CD6A - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] -_0800CD6A: - mov r3, sp - ldr r1, =gUnknown_03004140 - ldrb r2, [r1] - ldrb r0, [r1, 0x14] - ands r0, r2 - strb r0, [r3] - movs r3, 0 - adds r7, r1, 0 - ldr r2, =gUnknown_03007890 - mov r1, sp - movs r5, 0x1 - adds r4, r7, 0 -_0800CD82: - ldrb r0, [r1] - asrs r0, r3 - ands r0, r5 - cmp r0, 0 - beq _0800CD96 - ldrb r0, [r4, 0x1] - cmp r0, 0 - beq _0800CD96 - subs r0, 0x1 - strb r0, [r7, 0x1] -_0800CD96: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800CD82 - ldrb r1, [r7, 0x14] - ldrb r0, [r7] - bics r0, r1 - strb r0, [r7] - ldrb r1, [r7, 0x7] - cmp r1, 0 - beq _0800CDE0 - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0xFF - bne _0800CDF2 - cmp r1, 0x8 - bne _0800CDCC - ldrh r0, [r7, 0x1C] - strh r0, [r7, 0x1A] - movs r0, 0x6 - strb r0, [r7, 0x7] - b _0800CDDE - .pool -_0800CDCC: - ldrb r0, [r7, 0x4] - subs r0, 0x6 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _0800CDE0 - movs r0, 0x1 - strb r0, [r7, 0x7] - movs r0, 0x5 -_0800CDDE: - strb r0, [r7, 0x4] -_0800CDE0: - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0xFF - bne _0800CDF2 - ldrb r0, [r7, 0x4] - cmp r0, 0 - bne _0800CDF2 - movs r0, 0xFF - strb r0, [r7, 0x6] -_0800CDF2: - ldrb r0, [r7, 0xE] - cmp r0, 0 - bne _0800CE3E - movs r0, 0x40 - movs r1, 0x1 - bl sub_800D30C - b _0800CE3E -_0800CE02: - bl sub_800D20C - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0xFF - beq _0800CE3E - movs r0, 0x50 - movs r1, 0 - bl sub_800D30C - b _0800CE3E - .pool -_0800CE20: - cmp r6, 0 - bne _0800CE42 - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0xD] - strb r6, [r0, 0x1] - strb r6, [r0] - movs r1, 0xFF - strb r1, [r0, 0x6] - bl sub_800D610 - mov r4, r8 - cmp r4, 0x3D - bne _0800CE3E - bl sub_800BFA0 -_0800CE3E: - cmp r6, 0 - beq _0800CE92 -_0800CE42: - ldr r7, =gUnknown_03004140 - mov r0, r8 - cmp r0, 0x1C - bne _0800CE74 - cmp r6, 0 - beq _0800CE74 - ldrb r0, [r7, 0x7] - cmp r0, 0x4 - bne _0800CE74 - ldr r2, =gUnknown_03007890 - ldr r1, [r2] - movs r0, 0x1 - strb r0, [r1] - ldr r1, [r2] - movs r0, 0xF - strb r0, [r1, 0x2] - bl sub_800D334 - bl rfu_waitREQComplete - b _0800CEA4 - .pool -_0800CE74: - movs r1, 0 - mov r3, r8 - strh r3, [r7, 0x14] - strh r6, [r7, 0x16] - ldrb r0, [r7, 0xE] - cmp r0, 0 - beq _0800CE86 - strb r1, [r7, 0x5] - strb r1, [r7, 0x4] -_0800CE86: - movs r0, 0xF0 - movs r1, 0x2 - bl sub_800D30C - bl sub_800D610 -_0800CE92: - mov r4, r8 - cmp r4, 0xFF - bne _0800CEA4 - movs r0, 0xF2 - movs r1, 0 - bl sub_800D30C - bl sub_800D610 -_0800CEA4: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800C7B4 - - thumb_func_start sub_800CEB0 -sub_800CEB0: @ 800CEB0 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r4, =gUnknown_03004140 - ldrb r7, [r4, 0xE] - movs r0, 0 - strb r0, [r4, 0xE] - movs r0, 0x1 - strb r0, [r4, 0xF] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r5, [r0] - cmp r5, 0 - bne _0800CEEC - adds r0, r6, 0 - bl sub_800C36C - ldrb r0, [r4, 0x2] - cmp r0, 0x1 - beq _0800CF04 - bl sub_800D610 - strb r5, [r4, 0xF] - strb r7, [r4, 0xE] - b _0800CF28 - .pool -_0800CEEC: - mov r0, sp - bl rfu_UNI_PARENT_getDRAC_ACK - lsls r0, 16 - cmp r0, 0 - bne _0800CF04 - mov r1, sp - ldrb r0, [r4, 0x3] - ldrb r1, [r1] - orrs r0, r1 - ldrb r1, [r4, 0x3] - strb r0, [r4, 0x3] -_0800CF04: - ldr r4, =gUnknown_03004140 - ldr r1, [r4, 0x44] - cmp r1, 0 - beq _0800CF20 - adds r0, r6, 0 - bl _call_via_r1 - bl rfu_waitREQComplete - ldrb r0, [r4, 0x2] - cmp r0, 0x2 - bne _0800CF20 - bl sub_800D610 -_0800CF20: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0xF] - strb r7, [r1, 0xE] -_0800CF28: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800CEB0 - - thumb_func_start sub_800CF34 -sub_800CF34: @ 800CF34 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - subs r0, 0x5 - lsls r0, 24 - lsrs r0, 24 - adds r3, r1, 0 - cmp r0, 0x3 - bls _0800CF52 - b _0800D146 -_0800CF52: - ldr r0, =gUnknown_03007890 - ldr r2, [r0] - ldrb r1, [r2, 0x2] - ldrb r0, [r3, 0xC] - adds r4, r1, 0 - eors r4, r0 - ands r4, r1 - ldrb r0, [r2, 0x7] - bics r4, r0 - mov r8, r4 - strb r1, [r3, 0xC] - cmp r4, 0 - beq _0800CF7A - strh r4, [r3, 0x14] - movs r0, 0x10 - movs r1, 0x1 - str r3, [sp, 0x4] - bl sub_800D30C - ldr r3, [sp, 0x4] -_0800CF7A: - movs r0, 0 - str r0, [sp] - movs r6, 0 - adds r7, r3, 0 - movs r1, 0x24 - adds r1, r3 - mov r9, r1 -_0800CF88: - movs r0, 0x80 - lsls r0, 17 - lsls r0, r6 - lsrs r4, r0, 24 - movs r5, 0 - mov r0, r8 - ands r0, r4 - cmp r0, 0 - beq _0800CFDA - lsls r1, r6, 1 - adds r0, r7, 0 - adds r0, 0x28 - adds r1, r0 - ldrh r0, [r7, 0x26] - strh r0, [r1] - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r2] - adds r6, 0x1 - mov r10, r6 - b _0800D090 - .pool -_0800CFC0: - ldrb r1, [r7] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r7] - ldrb r0, [r7, 0x1] - adds r0, 0x1 - strb r0, [r7, 0x1] - ldr r0, [sp] - orrs r0, r4 - str r0, [sp] - movs r0, 0x1 - orrs r5, r0 - b _0800D024 -_0800CFDA: - mov r1, r9 - ldrb r0, [r1] - ands r0, r4 - adds r2, r6, 0x1 - mov r10, r2 - cmp r0, 0 - beq _0800D090 - ldr r0, =gUnknown_03007880 - lsls r1, r6, 2 - adds r1, r0 - ldr r1, [r1] - ldrh r0, [r1, 0x34] - cmp r0, 0x46 - bne _0800D040 - adds r0, r1, 0 - adds r0, 0x61 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800D058 - movs r5, 0x2 - ldr r3, [r3, 0x20] - ldrh r2, [r3] - ldr r0, =0x0000ffff - cmp r2, r0 - beq _0800D024 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - lsls r1, r6, 5 - adds r0, r1 - ldrh r0, [r0, 0x18] - ldr r1, =0x0000ffff -_0800D018: - cmp r0, r2 - beq _0800CFC0 - adds r3, 0x2 - ldrh r2, [r3] - cmp r2, r1 - bne _0800D018 -_0800D024: - movs r0, 0x1 - ands r0, r5 - cmp r0, 0 - bne _0800D058 - movs r0, 0x4 - orrs r5, r0 - b _0800D058 - .pool -_0800D040: - lsls r1, r6, 1 - adds r0, r3, 0 - adds r0, 0x28 - adds r1, r0 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - ldr r1, =0x0000ffff - ands r0, r1 - cmp r0, 0 - bne _0800D058 - movs r5, 0x6 -_0800D058: - movs r0, 0x2 - ands r0, r5 - cmp r0, 0 - beq _0800D07E - mov r2, r9 - ldrb r0, [r2] - bics r0, r4 - movs r2, 0 - mov r1, r9 - strb r0, [r1] - lsls r0, r6, 1 - adds r1, r7, 0 - adds r1, 0x28 - adds r0, r1 - strh r2, [r0] - movs r0, 0x8 - adds r1, r6, 0 - bl rfu_clearSlot -_0800D07E: - movs r0, 0x4 - ands r5, r0 - ldr r3, =gUnknown_03004140 - cmp r5, 0 - beq _0800D090 - ldrb r1, [r7, 0xD] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r7, 0xD] -_0800D090: - mov r2, r10 - lsls r0, r2, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bhi _0800D09C - b _0800CF88 -_0800D09C: - ldr r4, [sp] - cmp r4, 0 - beq _0800D0AE - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x11 - movs r1, 0x1 - bl sub_800D30C -_0800D0AE: - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0xD] - cmp r0, 0 - beq _0800D0EA - movs r5, 0x1 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0 - beq _0800D0CE - ldrb r0, [r1, 0x3] - ldrb r1, [r1] - ands r0, r1 - cmp r0, r1 - beq _0800D0CE - movs r5, 0 -_0800D0CE: - cmp r5, 0 - beq _0800D0EA - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0xD] - bl sub_800D334 - ldrb r0, [r4, 0xD] - movs r1, 0 - strh r0, [r4, 0x14] - strb r1, [r4, 0xD] - movs r0, 0x12 - movs r1, 0x1 - bl sub_800D30C -_0800D0EA: - ldr r0, =gUnknown_03004140 - adds r1, r0, 0 - adds r1, 0x24 - ldrb r1, [r1] - adds r3, r0, 0 - cmp r1, 0 - bne _0800D146 - ldrb r0, [r3, 0x4] - cmp r0, 0x8 - bne _0800D146 - ldrb r0, [r3, 0x7] - cmp r0, 0 - bne _0800D120 - strb r0, [r3, 0x5] - strb r0, [r3, 0x4] - movs r0, 0x14 - movs r1, 0 - bl sub_800D30C - b _0800D146 - .pool -_0800D120: - cmp r0, 0x2 - bne _0800D12C - movs r0, 0x3 - strb r0, [r3, 0x7] - movs r0, 0x9 - b _0800D132 -_0800D12C: - movs r0, 0x1 - strb r0, [r3, 0x7] - movs r0, 0x5 -_0800D132: - strb r0, [r3, 0x4] - ldrb r0, [r3] - cmp r0, 0 - beq _0800D146 - movs r0, 0 - strh r0, [r3, 0x1A] - movs r0, 0x8 - strb r0, [r3, 0x7] - movs r0, 0x5 - strb r0, [r3, 0x4] -_0800D146: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800CF34 - - thumb_func_start sub_800D158 -sub_800D158: @ 800D158 - push {r4-r6,lr} - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r6, r0, 0 - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x4] - cmp r0, 0xF - bne _0800D1BC - ldrb r1, [r4, 0x10] - lsls r1, 1 - adds r5, r4, 0 - adds r5, 0x28 - adds r1, r5 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _0800D192 - ldr r1, =gUnknown_03007880 - ldrb r0, [r4, 0x10] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x27 - bne _0800D1BC -_0800D192: - bl sub_800D630 - movs r0, 0x18 - strb r0, [r4, 0x4] - ldrb r1, [r4, 0x10] - movs r0, 0x4 - bl rfu_clearSlot - adds r2, r4, 0 - adds r2, 0x24 - movs r1, 0x1 - ldrb r0, [r4, 0x10] - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r4, 0x10] - lsls r0, 1 - adds r0, r5 - movs r1, 0 - strh r1, [r0] -_0800D1BC: - ldr r0, =0x04000208 - strh r6, [r0] - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x4] - cmp r0, 0x18 - bne _0800D1F6 - ldrb r0, [r5, 0x2] - cmp r0, 0x1 - bne _0800D1D2 - bl sub_800D630 -_0800D1D2: - ldrb r0, [r5, 0x2] - adds r4, r0, 0 - cmp r4, 0 - bne _0800D1F6 - strb r4, [r5, 0x5] - strb r4, [r5, 0x4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl sub_800D334 - strh r4, [r5, 0x14] - movs r0, 0x25 - movs r1, 0x1 - bl sub_800D30C -_0800D1F6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D158 - - thumb_func_start sub_800D20C -sub_800D20C: @ 800D20C - push {r4,r5,lr} - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x4] - cmp r0, 0xF - bne _0800D258 - ldr r1, =gUnknown_03007880 - ldrb r2, [r5, 0x10] - lsls r0, r2, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x26 - bne _0800D258 - movs r4, 0 - strb r4, [r5, 0x5] - strb r4, [r5, 0x4] - movs r0, 0x4 - adds r1, r2, 0 - bl rfu_clearSlot - adds r2, r5, 0 - adds r2, 0x24 - movs r1, 0x1 - ldrb r0, [r5, 0x10] - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x28 - adds r0, r1 - strh r4, [r0] - movs r0, 0x24 - movs r1, 0 - bl sub_800D30C -_0800D258: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D20C - - thumb_func_start sub_800D268 -sub_800D268: @ 800D268 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x6] - cmp r0, 0 - bne _0800D28C - ldrb r0, [r1, 0xA] - cmp r0, 0x1 - bne _0800D28C - ldrb r0, [r1, 0x4] - strb r0, [r1, 0x11] - ldrb r0, [r1, 0x5] - strb r0, [r1, 0x12] - movs r0, 0x10 - strb r0, [r1, 0x4] - movs r0, 0x11 - strb r0, [r1, 0x5] - movs r0, 0x2 - strb r0, [r1, 0xA] -_0800D28C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D268 - - thumb_func_start sub_800D294 -sub_800D294: @ 800D294 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r6, 0 - movs r5, 0 - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - cmp r6, r0 - bcs _0800D2F0 - mov r8, r0 - ldr r0, =gUnknown_03004140 - mov r10, r0 - mov r9, r1 -_0800D2B4: - mov r1, r10 - ldr r3, [r1, 0x20] - ldrh r2, [r3] - adds r0, r5, 0x1 - mov r12, r0 - ldr r1, =0x0000ffff - cmp r2, r1 - beq _0800D2E6 - mov r1, r9 - ldr r0, [r1] - lsls r1, r5, 5 - adds r0, r1 - ldrh r4, [r0, 0x18] - ldr r7, =0x0000ffff - movs r1, 0x1 - lsls r1, r5 -_0800D2D4: - cmp r4, r2 - bne _0800D2DE - orrs r6, r1 - lsls r0, r6, 24 - lsrs r6, r0, 24 -_0800D2DE: - adds r3, 0x2 - ldrh r2, [r3] - cmp r2, r7 - bne _0800D2D4 -_0800D2E6: - mov r1, r12 - lsls r0, r1, 24 - lsrs r5, r0, 24 - cmp r5, r8 - bcc _0800D2B4 -_0800D2F0: - adds r0, r6, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D294 - - thumb_func_start sub_800D30C -sub_800D30C: @ 800D30C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r4, =gUnknown_03004140 - ldr r2, [r4, 0x40] - cmp r2, 0 - beq _0800D322 - bl _call_via_r2 -_0800D322: - movs r0, 0 - strh r0, [r4, 0x16] - strh r0, [r4, 0x14] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D30C - - thumb_func_start sub_800D334 -sub_800D334: @ 800D334 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gUnknown_03004140 - ldrb r5, [r4, 0xE] - movs r1, 0x1 - strb r1, [r4, 0xE] - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - strb r5, [r4, 0xE] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D334 - - thumb_func_start sub_800D358 -sub_800D358: @ 800D358 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0800D3A0 - movs r4, 0 -_0800D36A: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D396 - ldrb r1, [r2, 0x1A] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D396 - adds r2, r1, 0 - bics r2, r5 - movs r0, 0x20 - adds r1, r4, 0 - bl rfu_changeSendTarget -_0800D396: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D36A -_0800D3A0: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _0800D3DE - movs r4, 0 -_0800D3AC: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2, 0x34] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D3D4 - adds r0, r2, 0 - adds r0, 0x4E - ldrb r0, [r0] - ands r0, r5 - cmp r0, 0 - beq _0800D3D4 - adds r0, r4, 0 - bl rfu_NI_stopReceivingData -_0800D3D4: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D3AC -_0800D3DE: - ldr r0, =gUnknown_03007890 - ldr r3, [r0] - ldrb r2, [r3, 0x6] - cmp r2, 0 - beq _0800D41C - mvns r1, r5 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3, 0x6] - movs r4, 0 - ldr r7, =gUnknown_03007870 - ldr r6, =0x00008024 -_0800D3F6: - lsls r0, r4, 2 - adds r0, r7 - ldr r2, [r0] - ldrh r0, [r2] - cmp r0, r6 - bne _0800D412 - ldrb r3, [r2, 0x3] - adds r0, r5, 0 - ands r0, r3 - cmp r0, 0 - beq _0800D412 - adds r0, r1, 0 - ands r0, r3 - strb r0, [r2, 0x3] -_0800D412: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D3F6 -_0800D41C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D358 - - thumb_func_start sub_800D434 -sub_800D434: @ 800D434 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x18] - cmp r0, 0 - beq _0800D510 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0800D4D4 - movs r6, 0 -_0800D454: - ldr r3, =gUnknown_03007880 - lsls r2, r6, 2 - adds r0, r2, r3 - ldr r0, [r0] - ldrh r1, [r0] - movs r4, 0x80 - lsls r4, 8 - adds r0, r4, 0 - ands r1, r0 - adds r7, r2, 0 - adds r0, r6, 0x1 - mov r9, r0 - cmp r1, 0 - beq _0800D4CA - movs r5, 0 - movs r4, 0 - movs r1, 0x1 - mov r8, r1 - mov r10, r3 -_0800D47A: - adds r0, r7, r3 - ldr r0, [r0] - ldrb r0, [r0, 0x1A] - asrs r0, r4 - mov r1, r8 - ands r0, r1 - cmp r0, 0 - beq _0800D4A4 - lsls r0, r4, 2 - adds r0, r3 - ldr r0, [r0] - ldr r1, =gUnknown_03004140 - ldrh r0, [r0, 0x2] - ldrh r1, [r1, 0x18] - cmp r0, r1 - bls _0800D4A4 - mov r0, r8 - lsls r0, r4 - orrs r5, r0 - lsls r0, r5, 24 - lsrs r5, r0, 24 -_0800D4A4: - cmp r5, 0 - beq _0800D4C0 - mov r1, r10 - adds r0, r7, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1A] - adds r2, r5, 0 - eors r2, r0 - movs r0, 0x20 - adds r1, r6, 0 - str r3, [sp] - bl rfu_changeSendTarget - ldr r3, [sp] -_0800D4C0: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D47A -_0800D4CA: - mov r3, r9 - lsls r0, r3, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0800D454 -_0800D4D4: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _0800D510 - movs r6, 0 -_0800D4E0: - ldr r1, =gUnknown_03007880 - lsls r0, r6, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2, 0x34] - movs r4, 0x80 - lsls r4, 8 - adds r1, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D506 - ldr r1, =gUnknown_03004140 - ldrh r0, [r2, 0x36] - ldrh r1, [r1, 0x18] - cmp r0, r1 - bls _0800D506 - adds r0, r6, 0 - bl rfu_NI_stopReceivingData -_0800D506: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0800D4E0 -_0800D510: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D434 - - thumb_func_start sub_800D52C -sub_800D52C: @ 800D52C - push {lr} - ldr r1, =gUnknown_03004140 - str r0, [r1, 0x44] - ldr r0, =sub_800CEB0 - bl rfu_setMSCCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D52C - - thumb_func_start sub_800D544 -sub_800D544: @ 800D544 - ldr r1, =gUnknown_03004140 - str r0, [r1, 0x40] - bx lr - .pool - thumb_func_end sub_800D544 - - thumb_func_start sub_800D550 -sub_800D550: @ 800D550 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x9] - adds r3, r0, 0 - cmp r1, 0 - beq _0800D578 - cmp r4, 0 - bne _0800D578 - adds r0, 0x30 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D578 - movs r0, 0x5 - b _0800D588 - .pool -_0800D578: - ldr r2, =0x04000208 - ldrh r1, [r2] - movs r0, 0 - strh r0, [r2] - strb r4, [r3, 0x9] - strh r5, [r3, 0x32] - strh r1, [r2] - movs r0, 0 -_0800D588: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D550 - - thumb_func_start sub_800D594 -sub_800D594: @ 800D594 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x4] - ldrb r0, [r0, 0x5] - orrs r0, r1 - cmp r0, 0 - bne _0800D5B8 - ldr r0, =gUnknown_03004140 - strh r2, [r0, 0x18] - movs r0, 0 - b _0800D5C8 - .pool -_0800D5B8: - ldr r1, =gUnknown_03004140 - movs r0, 0x6 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x6 -_0800D5C8: - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D594 - - thumb_func_start sub_800D5D0 -sub_800D5D0: @ 800D5D0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - adds r3, r2, 0 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0800D5FC - movs r0, 0x7 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x7 - b _0800D60A - .pool -_0800D5FC: - cmp r2, 0 - beq _0800D606 - movs r0, 0x1 - strb r0, [r1, 0xB] - b _0800D608 -_0800D606: - strb r3, [r1, 0xB] -_0800D608: - movs r0, 0 -_0800D60A: - pop {r1} - bx r1 - thumb_func_end sub_800D5D0 - - thumb_func_start sub_800D610 -sub_800D610: @ 800D610 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x2] - cmp r0, 0 - beq _0800D628 - ldrb r0, [r1, 0x2] - movs r0, 0 - strb r0, [r1, 0x2] - movs r0, 0x45 - movs r1, 0 - bl sub_800D30C -_0800D628: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D610 - - thumb_func_start sub_800D630 -sub_800D630: @ 800D630 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x2] - cmp r0, 0 - bne _0800D648 - movs r0, 0x45 - movs r1, 0 - bl sub_800D30C - b _0800D654 - .pool -_0800D648: - ldrb r0, [r1, 0x2] - cmp r0, 0x1 - bne _0800D654 - ldrb r0, [r1, 0x2] - movs r0, 0x2 - strb r0, [r1, 0x2] -_0800D654: - pop {r0} - bx r0 - thumb_func_end sub_800D630 - - thumb_func_start sub_800D658 -sub_800D658: @ 800D658 - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x7] - adds r2, r0, 0 - cmp r1, 0 - beq _0800D6C2 - ldrb r0, [r2, 0x4] - subs r0, 0x5 - cmp r0, 0x6 - bhi _0800D6C2 - lsls r0, 2 - ldr r1, =_0800D680 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800D680: - .4byte _0800D69C - .4byte _0800D6A4 - .4byte _0800D6AE - .4byte _0800D6AE - .4byte _0800D6B4 - .4byte _0800D6B4 - .4byte _0800D6BA -_0800D69C: - movs r0, 0x3 - strb r0, [r2, 0x7] - movs r0, 0x9 - b _0800D6C0 -_0800D6A4: - movs r0, 0x2 - strb r0, [r2, 0x7] - movs r0, 0x1 - strh r0, [r2, 0x1A] - b _0800D6C2 -_0800D6AE: - movs r0, 0x2 - strb r0, [r2, 0x7] - b _0800D6C2 -_0800D6B4: - movs r0, 0x28 - strh r0, [r2, 0x1A] - b _0800D6C2 -_0800D6BA: - movs r0, 0x28 - strh r0, [r2, 0x1A] - movs r0, 0xA -_0800D6C0: - strb r0, [r2, 0x4] -_0800D6C2: - pop {r0} - bx r0 - thumb_func_end sub_800D658 - - thumb_func_start sub_800D6C8 -sub_800D6C8: @ 800D6C8 - push {r4,r5,lr} - adds r3, r0, 0 - movs r0, 0 - movs r4, 0 - movs r5, 0x46 -_0800D6D2: - adds r2, r0, 0x1 - movs r1, 0x45 - muls r0, r5 - adds r0, r3 - adds r0, 0x45 -_0800D6DC: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D6DC - adds r0, r2, 0 - cmp r0, 0x1F - ble _0800D6D2 - movs r1, 0 - ldr r2, =0x000008c1 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x8C - lsls r2, 4 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x000008c2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x000008c3 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D6C8 - - thumb_func_start sub_800D724 -sub_800D724: @ 800D724 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0 - movs r4, 0 -_0800D72C: - lsls r0, r1, 3 - adds r2, r1, 0x1 - subs r0, r1 - movs r1, 0xD - lsls r0, 1 - adds r0, r3 - adds r0, 0xD -_0800D73A: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D73A - adds r1, r2, 0 - cmp r1, 0x27 - ble _0800D72C - movs r1, 0 - ldr r2, =0x00000231 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x8C - lsls r2, 2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000232 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000233 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D724 - - thumb_func_start sub_800D780 -sub_800D780: @ 800D780 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0 - movs r4, 0 -_0800D788: - lsls r0, r1, 8 - adds r2, r1, 0x1 - movs r1, 0xFF - adds r0, r3 - adds r0, 0xFF -_0800D792: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D792 - adds r1, r2, 0 - cmp r1, 0x1 - ble _0800D788 - movs r1, 0 - ldr r2, =0x00000201 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x80 - lsls r2, 2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000202 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000203 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D780 - - thumb_func_start sub_800D7D8 -sub_800D7D8: @ 800D7D8 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x000008c2 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1F - bhi _0800D874 - ldr r0, =0x04000208 - ldrh r1, [r0] - adds r7, r1, 0 - movs r1, 0 - strh r1, [r0] - movs r5, 0 - movs r2, 0 -_0800D7F6: - adds r1, r4, r2 - ldrb r0, [r1] - cmp r0, 0 - bne _0800D80A - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _0800D80A - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0800D80A: - adds r2, 0xE - cmp r2, 0x45 - ble _0800D7F6 - cmp r5, 0x5 - beq _0800D866 - movs r2, 0 - movs r0, 0x8C - lsls r0, 4 - adds r5, r3, r0 - movs r6, 0x46 -_0800D81E: - ldrb r0, [r5] - adds r1, r0, 0 - muls r1, r6 - adds r1, r2, r1 - adds r1, r3, r1 - adds r0, r4, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D81E - movs r0, 0x8C - lsls r0, 4 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x000008c2 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D85E: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D85E -_0800D866: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D87E - .pool -_0800D874: - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D87E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D7D8 - - thumb_func_start sub_800D888 -sub_800D888: @ 800D888 - push {r4-r7,lr} - adds r6, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000232 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0x27 - bhi _0800D920 - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - movs r0, 0 - strh r0, [r1] - movs r2, 0 - ldrb r0, [r5] - cmp r0, 0 - bne _0800D8B8 -_0800D8AA: - adds r2, 0x1 - cmp r2, 0xD - bgt _0800D8B8 - adds r0, r5, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D8AA -_0800D8B8: - cmp r2, 0xE - beq _0800D910 - movs r2, 0 - movs r0, 0x8C - lsls r0, 2 - adds r3, r6, r0 -_0800D8C4: - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r2, r0 - adds r0, r6, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xD - ble _0800D8C4 - movs r1, 0x8C - lsls r1, 2 - adds r4, r6, r1 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r6, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r5, 0 - adds r0, 0xD -_0800D908: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r5 - bge _0800D908 -_0800D910: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D92A - .pool -_0800D920: - ldr r1, =0x00000233 - adds r0, r6, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D92A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D888 - - thumb_func_start sub_800D934 -sub_800D934: @ 800D934 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x04000208 - ldrh r0, [r1] - mov r12, r0 - movs r0, 0 - strh r0, [r1] - movs r1, 0x8C - lsls r1, 4 - adds r0, r3, r1 - ldr r7, =0x000008c1 - adds r5, r3, r7 - ldrb r1, [r0] - ldrb r0, [r5] - cmp r1, r0 - beq _0800D960 - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D984 -_0800D960: - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D966: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D966 - ldr r0, =0x04000208 - mov r7, r12 - strh r7, [r0] - movs r0, 0 - b _0800D9CA - .pool -_0800D984: - movs r2, 0 - movs r6, 0x46 -_0800D988: - adds r1, r4, r2 - ldrb r0, [r5] - adds r7, r0, 0 - muls r7, r6 - adds r0, r7, 0 - adds r0, r2, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D988 - ldr r0, =0x000008c1 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r7, =0x000008c2 - adds r1, r3, r7 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - mov r1, r12 - strh r1, [r0] - movs r0, 0x1 -_0800D9CA: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D934 - - thumb_func_start sub_800D9DC -sub_800D9DC: @ 800D9DC - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r1, 0x8C - lsls r1, 2 - adds r0, r5, r1 - adds r1, 0x1 - adds r4, r5, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DA00 - ldr r1, =0x00000233 - adds r0, r5, r1 - ldrb r0, [r0] - adds r2, r0, 0 - cmp r2, 0 - beq _0800DA08 -_0800DA00: - movs r0, 0 - b _0800DA54 - .pool -_0800DA08: - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - strh r2, [r1] - movs r3, 0 -_0800DA12: - adds r2, r6, r3 - ldrb r1, [r4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r5, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA12 - ldr r0, =0x00000231 - adds r4, r5, r0 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r5, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - strh r7, [r0] - movs r0, 0x1 -_0800DA54: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D9DC - - thumb_func_start sub_800DA68 -sub_800DA68: @ 800DA68 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _0800DA7E - adds r0, r2, 0 - movs r1, 0 - bl sub_800DAC8 - b _0800DAC0 -_0800DA7E: - movs r3, 0 -_0800DA80: - ldrb r1, [r2, 0x1C] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r2, r0 - adds r1, r4, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA80 - ldrb r0, [r2, 0x1C] - adds r0, 0x1 - ldrb r1, [r2, 0x1C] - strb r0, [r2, 0x1C] - ldrb r1, [r2, 0x1C] - movs r0, 0x1 - ands r0, r1 - ldrb r1, [r2, 0x1C] - strb r0, [r2, 0x1C] - ldrb r0, [r2, 0x1E] - cmp r0, 0x1 - bhi _0800DABA - ldrb r0, [r2, 0x1E] - adds r0, 0x1 - ldrb r1, [r2, 0x1E] - strb r0, [r2, 0x1E] - b _0800DAC0 -_0800DABA: - ldrb r0, [r2, 0x1C] - ldrb r1, [r2, 0x1D] - strb r0, [r2, 0x1D] -_0800DAC0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800DA68 - - thumb_func_start sub_800DAC8 -sub_800DAC8: @ 800DAC8 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - ldrb r0, [r3, 0x1E] - cmp r0, 0 - bne _0800DAD8 - movs r0, 0 - b _0800DB12 -_0800DAD8: - cmp r5, 0 - beq _0800DAF6 - movs r4, 0 -_0800DADE: - adds r2, r5, r4 - ldrb r1, [r3, 0x1D] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r4, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r4, 0x1 - cmp r4, 0xD - ble _0800DADE -_0800DAF6: - ldrb r0, [r3, 0x1D] - adds r0, 0x1 - ldrb r1, [r3, 0x1D] - strb r0, [r3, 0x1D] - ldrb r1, [r3, 0x1D] - movs r0, 0x1 - ands r0, r1 - ldrb r1, [r3, 0x1D] - strb r0, [r3, 0x1D] - ldrb r0, [r3, 0x1E] - subs r0, 0x1 - ldrb r1, [r3, 0x1E] - strb r0, [r3, 0x1E] - movs r0, 0x1 -_0800DB12: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_800DAC8 - - thumb_func_start sub_800DB18 -sub_800DB18: @ 800DB18 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000202 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0800DB70 - movs r2, 0 - movs r0, 0x80 - lsls r0, 2 - adds r4, r3, r0 -_0800DB30: - ldrb r0, [r4] - lsls r0, 8 - adds r0, r2, r0 - adds r0, r3, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xFF - ble _0800DB30 - movs r0, 0x80 - lsls r0, 2 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1 - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x00000202 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - b _0800DB7A - .pool -_0800DB70: - ldr r1, =0x00000203 - adds r0, r3, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800DB7A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DB18 - - thumb_func_start sub_800DB84 -sub_800DB84: @ 800DB84 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - movs r1, 0x80 - lsls r1, 2 - adds r0, r3, r1 - adds r1, 0x1 - adds r4, r3, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DBA6 - ldr r1, =0x00000203 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800DBB0 -_0800DBA6: - movs r0, 0 - b _0800DBEA - .pool -_0800DBB0: - movs r2, 0 -_0800DBB2: - adds r0, r5, r2 - ldrb r1, [r4] - lsls r1, 8 - adds r1, r2, r1 - adds r1, r3, r1 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xFF - ble _0800DBB2 - ldr r0, =0x00000201 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1 - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x00000202 - adds r1, r3, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0x1 -_0800DBEA: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800DB84 - - thumb_func_start sub_800DBF8 -sub_800DBF8: @ 800DBF8 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r1, 0 - movs r5, 0 - cmp r1, 0x1 - beq _0800DC36 - cmp r1, 0x1 - bgt _0800DC12 - cmp r1, 0 - beq _0800DC1C - b _0800DCAA -_0800DC12: - cmp r0, 0x2 - beq _0800DC56 - cmp r0, 0x3 - beq _0800DC76 - b _0800DCAA -_0800DC1C: - movs r4, 0 -_0800DC1E: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r1, [r0] - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r1, 0 - cmp r4, 0xC7 - ble _0800DC1E - b _0800DC70 -_0800DC36: - movs r4, 0 - adds r2, r6, 0 - adds r2, 0xC8 -_0800DC3C: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r1, [r0] - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r1, 0 - cmp r4, 0x63 - ble _0800DC3C - strh r5, [r2] - b _0800DCAA -_0800DC56: - movs r4, 0 -_0800DC58: - bl Random - lsls r0, 24 - lsrs r0, 24 - adds r1, r6, r4 - strb r0, [r1] - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, 0x1 - cmp r4, 0xC7 - ble _0800DC58 -_0800DC70: - adds r0, r6, r4 - strh r5, [r0] - b _0800DCAA -_0800DC76: - movs r4, 0 - ldr r3, =gUnknown_03000D74 - ldrb r1, [r3] - ldrb r0, [r3] - adds r7, r0, 0x1 - adds r2, r1, 0x1 - movs r0, 0xFF - mov r12, r0 -_0800DC86: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r2, [r0] - adds r0, r4, r7 - mov r4, r12 - ands r0, r4 - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r2, 0x1 - adds r4, r1, 0 - cmp r1, 0xC7 - ble _0800DC86 - adds r0, r6, r1 - strh r5, [r0] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] -_0800DCAA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DBF8 - - thumb_func_start sub_800DCB4 -sub_800DCB4: @ 800DCB4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r3, 0 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0800DCD8 - ldr r5, =gUnknown_082ED470 - adds r2, r1, 0 -_0800DCC4: - adds r1, r4, r3 - ldrb r0, [r2] - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - adds r3, 0x1 - ldrb r0, [r2] - cmp r0, 0xFF - bne _0800DCC4 -_0800DCD8: - adds r1, r4, r3 - movs r0, 0 - strb r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DCB4 - - thumb_func_start sub_800DCE8 -sub_800DCE8: @ 800DCE8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r3, 0 - ldrb r0, [r1] - cmp r0, 0 - beq _0800DD0C - ldr r5, =gUnknown_082ED370 - adds r2, r1, 0 -_0800DCF8: - adds r1, r4, r3 - ldrb r0, [r2] - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - adds r3, 0x1 - ldrb r0, [r2] - cmp r0, 0 - bne _0800DCF8 -_0800DD0C: - adds r1, r4, r3 - movs r0, 0xFF - strb r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DCE8 - - thumb_func_start sub_800DD1C -sub_800DD1C: @ 800DD1C - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r0, =gUnknown_03007890 - ldr r4, [r0] - ldrb r2, [r4, 0x2] - ldrb r1, [r4] - adds r7, r0, 0 - cmp r1, 0x1 - bne _0800DD72 - movs r3, 0 - ands r1, r2 - cmp r1, 0 - beq _0800DD4E - cmp r5, 0x1 - bne _0800DD48 - ldrb r0, [r4, 0xA] - b _0800DD8C - .pool -_0800DD48: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0800DD4E: - lsrs r2, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bhi _0800DD8A - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _0800DD4E - adds r0, r6, 0x1 - cmp r5, r0 - bne _0800DD48 -_0800DD68: - ldr r0, [r7] - adds r0, 0xA - adds r0, r3 - ldrb r0, [r0] - b _0800DD8C -_0800DD72: - movs r3, 0 - movs r1, 0x1 -_0800DD76: - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0800DD68 - lsrs r2, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800DD76 -_0800DD8A: - movs r0, 0 -_0800DD8C: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800DD1C - - thumb_func_start sub_800DD94 -sub_800DD94: @ 800DD94 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - movs r4, 0 - ldr r0, =gSaveBlock2Ptr - mov r8, r0 - adds r6, r7, 0x2 - ldr r0, [r0] - adds r5, r0, 0 - adds r5, 0xA -_0800DDB2: - adds r0, r6, r4 - adds r1, r5, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x1 - ble _0800DDB2 - movs r4, 0 - lsls r2, 7 - mov r12, r2 - adds r1, r7, 0x4 -_0800DDC8: - adds r0, r1, r4 - strb r3, [r0] - asrs r3, 8 - adds r4, 0x1 - cmp r4, 0x3 - ble _0800DDC8 - mov r1, r8 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - movs r6, 0x1 - movs r1, 0x1 - ands r1, r0 - ldrb r2, [r7, 0xB] - movs r5, 0x2 - negs r5, r5 - adds r0, r5, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r7, 0xB] - movs r4, 0x7F - mov r1, r9 - ands r1, r4 - ldrb r2, [r7, 0xA] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - ands r0, r4 - mov r1, r12 - orrs r0, r1 - strb r0, [r7, 0xA] - ldrb r0, [r7] - movs r1, 0x10 - negs r1, r1 - ands r1, r0 - movs r0, 0x2 - orrs r1, r0 - ldrb r2, [r7, 0x1] - movs r0, 0x3D - negs r0, r0 - ands r0, r2 - movs r2, 0xC - orrs r0, r2 - strb r0, [r7, 0x1] - movs r0, 0x11 - negs r0, r0 - ands r1, r0 - subs r0, 0x10 - ands r1, r0 - subs r0, 0x20 - ands r1, r0 - strb r1, [r7] - ldr r0, =0x0000087f - bl FlagGet - lsls r0, 7 - ldrb r1, [r7] - ands r4, r1 - orrs r4, r0 - strb r4, [r7] - bl IsNationalPokedexEnabled - ands r0, r6 - ldrb r1, [r7, 0x1] - ands r5, r1 - orrs r5, r0 - strb r5, [r7, 0x1] - ldr r0, =0x00000864 - bl FlagGet - ands r6, r0 - lsls r6, 1 - ldrb r1, [r7, 0x1] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - orrs r0, r6 - strb r0, [r7, 0x1] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DD94 - - thumb_func_start sub_800DE7C -sub_800DE7C: @ 800DE7C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - mov r8, r1 - lsls r2, 24 - lsrs r5, r2, 24 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x6] - cmp r0, 0x1 - bne _0800DED8 - movs r0, 0x1 - mov r9, r0 - ldr r6, =gUnknown_03007890 - ldr r0, [r6] - lsls r4, r5, 5 - adds r0, r4 - ldrh r0, [r0, 0x18] - bl sub_8010454 - cmp r0, 0 - beq _0800DEB8 - ldr r1, [r6] - ldrb r0, [r1, 0x7] - asrs r0, r5 - mov r2, r9 - ands r0, r2 - cmp r0, 0 - bne _0800DEF0 -_0800DEB8: - adds r0, r7, 0 - movs r1, 0 - movs r2, 0xD - bl memset - mov r0, r8 - movs r1, 0 - movs r2, 0x8 - bl memset - b _0800DF24 - .pool -_0800DED8: - movs r0, 0 - mov r9, r0 - ldr r6, =gUnknown_03007890 - ldr r0, [r6] - lsls r4, r5, 5 - adds r0, r4 - ldrh r0, [r0, 0x18] - bl sub_8010454 - cmp r0, 0 - beq _0800DF10 - ldr r1, [r6] -_0800DEF0: - adds r1, r4, r1 - adds r1, 0x1A - adds r0, r7, 0 - movs r2, 0xD - bl memcpy - ldr r1, [r6] - adds r1, r4, r1 - adds r1, 0x29 - mov r0, r8 - movs r2, 0x8 - bl memcpy - b _0800DF24 - .pool -_0800DF10: - adds r0, r7, 0 - movs r1, 0 - movs r2, 0xD - bl memset - mov r0, r8 - movs r1, 0 - movs r2, 0x8 - bl memset -_0800DF24: - mov r0, r9 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800DE7C - - thumb_func_start sub_800DF34 -sub_800DF34: @ 800DF34 - push {r4-r7,lr} - adds r3, r0, 0 - adds r5, r1, 0 - lsls r2, 24 - movs r7, 0 - ldr r6, =gUnknown_03007890 - ldr r0, [r6] - lsrs r4, r2, 19 - adds r2, r0, r4 - ldrh r1, [r2, 0x18] - ldr r0, =0x00007f7d - cmp r1, r0 - bne _0800DF74 - adds r1, r2, 0 - adds r1, 0x1A - adds r0, r3, 0 - movs r2, 0xD - bl memcpy - ldr r1, [r6] - adds r1, r4, r1 - adds r1, 0x29 - adds r0, r5, 0 - movs r2, 0x8 - bl memcpy - movs r7, 0x1 - b _0800DF88 - .pool -_0800DF74: - adds r0, r3, 0 - movs r1, 0 - movs r2, 0xD - bl memset - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x8 - bl memset -_0800DF88: - adds r0, r7, 0 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800DF34 - - thumb_func_start sub_800DF90 -sub_800DF90: @ 800DF90 - push {r4,lr} - adds r4, r1, 0 - ldr r1, =gUnknown_02022B14 - movs r2, 0xD - bl memcpy - ldr r1, =gUnknown_02022B22 - adds r0, r4, 0 - movs r2, 0x8 - bl memcpy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DF90 - - thumb_func_start sub_800DFB4 -sub_800DFB4: @ 800DFB4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - cmp r3, 0 - bne _0800DFCA - cmp r2, 0 - bne _0800DFCA - movs r3, 0xE7 - movs r2, 0x8 -_0800DFCA: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800E024 - ldr r0, =gUnknown_082ED5F0 - adds r1, r3, 0 - movs r3, 0 - bl CreateSprite - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gSprites - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - adds r4, r0 - ldr r0, =0x00001234 - strh r0, [r4, 0x3C] - ldr r0, =gUnknown_082ED5E0 - ldrh r0, [r0, 0x6] - bl GetSpriteTileStartByTag - strh r0, [r4, 0x3A] - adds r4, 0x3E - ldrb r0, [r4] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4] - ldr r0, =gUnknown_02022B10 - strb r5, [r0] - b _0800E06A - .pool -_0800E024: - ldr r0, =gUnknown_082ED5F0 - adds r1, r3, 0 - movs r3, 0 - bl CreateSprite - ldr r4, =gUnknown_02022B10 - strb r0, [r4] - ldr r5, =gSprites - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x00001234 - strh r1, [r0, 0x3C] - ldr r0, =gUnknown_082ED5E0 - ldrh r0, [r0, 0x6] - bl GetSpriteTileStartByTag - ldrb r2, [r4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - strh r0, [r1, 0x3A] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_0800E06A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DFB4 - - thumb_func_start sub_800E084 -sub_800E084: @ 800E084 - push {r4,lr} - ldr r4, =gSprites - ldr r3, =gUnknown_02022B10 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r4 - movs r0, 0x3C - ldrsh r1, [r2, r0] - ldr r0, =0x00001234 - cmp r1, r0 - bne _0800E0CA - movs r0, 0 - strh r0, [r2, 0x3C] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r3, =gMain - movs r0, 0x84 - lsls r0, 3 - adds r3, r0 - ldr r0, =gDummyOamData - ldr r1, [r0] - ldr r2, [r0, 0x4] - str r1, [r3] - str r2, [r3, 0x4] - ldr r1, =0x070003e8 - movs r2, 0x4 - bl CpuSet -_0800E0CA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E084 - - thumb_func_start sub_800E0E8 -sub_800E0E8: @ 800E0E8 - push {r4,lr} - ldr r4, =gUnknown_082ED5E0 - ldrh r0, [r4, 0x6] - bl GetSpriteTileStartByTag - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - bne _0800E100 - adds r0, r4, 0 - bl LoadCompressedObjectPic -_0800E100: - ldr r0, =gUnknown_082ED5E8 - bl LoadSpritePalette - ldr r1, =gUnknown_02022B10 - movs r0, 0xFF - strb r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E0E8 - - thumb_func_start sub_800E124 -sub_800E124: @ 800E124 - push {r4,lr} - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r2, [r0, 0x2] - movs r3, 0 - movs r4, 0x1 -_0800E130: - adds r0, r2, 0 - ands r0, r4 - cmp r0, 0 - beq _0800E148 - ldr r0, [r1] - adds r0, 0xA - adds r0, r3 - ldrb r0, [r0] - b _0800E156 - .pool -_0800E148: - lsrs r2, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800E130 - movs r0, 0 -_0800E156: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_800E124 - - thumb_func_start sub_800E15C -sub_800E15C: @ 800E15C - push {lr} - adds r2, r0, 0 - movs r3, 0x32 - ldrsh r0, [r2, r3] - cmp r0, r1 - beq _0800E170 - movs r0, 0 - strh r1, [r2, 0x32] - strh r0, [r2, 0x34] - strh r0, [r2, 0x36] -_0800E170: - pop {r0} - bx r0 - thumb_func_end sub_800E15C - - thumb_func_start sub_800E174 -sub_800E174: @ 800E174 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r1, =gUnknown_02022B10 - ldrb r0, [r1] - cmp r0, 0xFF - bne _0800E184 - b _0800E346 -_0800E184: - ldr r2, =gSprites - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - movs r0, 0x3C - ldrsh r1, [r2, r0] - ldr r0, =0x00001234 - cmp r1, r0 - beq _0800E19C - b _0800E346 -_0800E19C: - adds r6, r2, 0 - movs r5, 0xFF - movs r4, 0 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800E1F6 - adds r7, r6, 0 - adds r7, 0x28 - movs r1, 0x29 - adds r1, r6 - mov r8, r1 - b _0800E1E6 - .pool -_0800E1C8: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_800DD1C - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bcc _0800E1E6 - adds r0, r4, 0 - bl sub_800DD1C - lsls r0, 24 - lsrs r5, r0, 24 -_0800E1E6: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r4, r0 - blt _0800E1C8 - b _0800E208 -_0800E1F6: - bl sub_800E124 - lsls r0, 24 - lsrs r5, r0, 24 - adds r7, r6, 0 - adds r7, 0x28 - movs r2, 0x29 - adds r2, r6 - mov r8, r2 -_0800E208: - bl sub_8012224 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800E218 - movs r0, 0x4 - b _0800E246 -_0800E218: - cmp r5, 0x18 - bhi _0800E220 - movs r0, 0x3 - b _0800E246 -_0800E220: - adds r0, r5, 0 - subs r0, 0x19 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x65 - bhi _0800E230 - movs r0, 0x2 - b _0800E246 -_0800E230: - adds r0, r5, 0 - subs r0, 0x7F - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x65 - bhi _0800E240 - movs r0, 0x1 - b _0800E246 -_0800E240: - cmp r5, 0xE4 - bls _0800E248 - movs r0, 0 -_0800E246: - strh r0, [r6, 0x2E] -_0800E248: - movs r3, 0x2E - ldrsh r1, [r6, r3] - movs r2, 0x30 - ldrsh r0, [r6, r2] - cmp r1, r0 - beq _0800E25E - adds r0, r6, 0 - bl sub_800E15C - ldrh r0, [r6, 0x2E] - strh r0, [r6, 0x30] -_0800E25E: - movs r0, 0x32 - ldrsh r1, [r6, r0] - ldr r2, [r6, 0x8] - lsls r1, 2 - adds r1, r2 - movs r3, 0x36 - ldrsh r0, [r6, r3] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsls r0, 10 - lsrs r0, 26 - movs r3, 0x34 - ldrsh r1, [r6, r3] - cmp r0, r1 - bge _0800E2AC - ldrh r0, [r6, 0x36] - adds r0, 0x1 - movs r3, 0 - strh r0, [r6, 0x36] - strh r3, [r6, 0x34] - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 2 - adds r0, r2 - movs r2, 0x36 - ldrsh r1, [r6, r2] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - movs r0, 0 - ldrsh r1, [r1, r0] - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - bne _0800E2B2 - strh r3, [r6, 0x36] - b _0800E2B2 -_0800E2AC: - ldrh r0, [r6, 0x34] - adds r0, 0x1 - strh r0, [r6, 0x34] -_0800E2B2: - ldr r4, =gMain - movs r1, 0x84 - lsls r1, 3 - adds r0, r4, r1 - ldr r1, =gUnknown_082ED570 - ldr r2, [r1, 0x4] - ldr r1, [r1] - str r1, [r0] - str r2, [r0, 0x4] - movs r3, 0x20 - ldrsh r2, [r6, r3] - movs r1, 0 - ldrsb r1, [r7, r1] - adds r2, r1 - ldr r1, =0x00000422 - adds r5, r4, r1 - ldr r3, =0x000001ff - adds r1, r3, 0 - ands r2, r1 - ldrh r3, [r5] - ldr r1, =0xfffffe00 - ands r1, r3 - orrs r1, r2 - strh r1, [r5] - ldrh r1, [r6, 0x22] - mov r2, r8 - ldrb r2, [r2] - adds r1, r2 - strb r1, [r0] - ldrb r2, [r6, 0x5] - ldr r3, =0x00000425 - adds r5, r4, r3 - lsrs r2, 4 - lsls r2, 4 - ldrb r3, [r5] - movs r1, 0xF - ands r1, r3 - orrs r1, r2 - strb r1, [r5] - movs r1, 0x32 - ldrsh r2, [r6, r1] - ldr r1, [r6, 0x8] - lsls r2, 2 - adds r2, r1 - movs r3, 0x36 - ldrsh r1, [r6, r3] - ldr r2, [r2] - lsls r1, 2 - adds r1, r2 - ldrh r2, [r1] - ldrh r6, [r6, 0x3A] - adds r2, r6 - ldr r1, =0x00000424 - adds r4, r1 - ldr r3, =0x000003ff - adds r1, r3, 0 - ands r2, r1 - ldrh r3, [r4] - ldr r1, =0xfffffc00 - ands r1, r3 - orrs r1, r2 - strh r1, [r4] - ldr r1, =0x070003e8 - movs r2, 0x4 - bl CpuSet - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800E346 - bl sub_800E084 -_0800E346: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E174 - - thumb_func_start sub_800E378 -sub_800E378: @ 800E378 - push {lr} - stm r0!, {r1} - adds r1, r2, 0 - bl StringCopy - pop {r0} - bx r0 - thumb_func_end sub_800E378 - - thumb_func_start sub_800E388 -sub_800E388: @ 800E388 - push {lr} - adds r2, r0, 0 - movs r1, 0 -_0800E38E: - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800E39A - movs r0, 0x1 - b _0800E3A2 -_0800E39A: - adds r1, 0x1 - cmp r1, 0x7 - ble _0800E38E - movs r0, 0 -_0800E3A2: - pop {r1} - bx r1 - thumb_func_end sub_800E388 - - thumb_func_start sub_800E3A8 -sub_800E3A8: @ 800E3A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _0800E3BE - b _0800E520 -_0800E3BE: - movs r0, 0xF0 - bl AllocZeroed - str r0, [sp, 0x14] - movs r4, 0 - b _0800E434 - .pool -_0800E3D0: - lsls r2, r4, 2 - mov r0, sp - adds r1, r0, r2 - movs r0, 0x1 - negs r0, r0 - str r0, [r1] - movs r5, 0 - mov r8, r2 - lsls r0, r4, 3 - adds r1, r4, 0x1 - mov r9, r1 - subs r0, r4 - lsls r0, 2 - str r0, [sp, 0x1C] - ldr r7, =gLinkPlayers + 8 - mov r10, r7 - ldr r6, =0x00003b98 - movs r4, 0 - mov r0, r10 - subs r0, 0x4 - ldr r1, [sp, 0x1C] - adds r3, r1, r0 -_0800E3FC: - ldrh r1, [r3] - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r7, =0x00003b98 - adds r0, r2, r7 - adds r0, r4 - ldr r0, [r0] - cmp r1, r0 - bne _0800E428 - adds r1, r2, r6 - adds r1, 0x4 - ldr r0, [sp, 0x1C] - add r0, r10 - str r3, [sp, 0x18] - bl StringCompare - ldr r3, [sp, 0x18] - cmp r0, 0 - bne _0800E428 - mov r0, sp - add r0, r8 - str r5, [r0] -_0800E428: - adds r6, 0xC - adds r4, 0xC - adds r5, 0x1 - cmp r5, 0x13 - ble _0800E3FC - mov r4, r9 -_0800E434: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _0800E3D0 - movs r0, 0 - mov r8, r0 - movs r4, 0 - mov r7, sp - movs r5, 0 - ldr r6, [sp, 0x14] - b _0800E4AC - .pool -_0800E45C: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - beq _0800E4A6 - ldr r2, =gLinkPlayers - adds r0, r5, r2 - ldrh r0, [r0, 0x1A] - cmp r0, 0x1 - beq _0800E4A6 - adds r0, r2, 0x4 - adds r0, r5, r0 - ldrh r1, [r0] - adds r2, 0x8 - adds r2, r5, r2 - adds r0, r6, 0 - bl sub_800E378 - ldr r2, [r7] - cmp r2, 0 - blt _0800E4A0 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldr r1, =0x00003b9c - adds r0, r1 - movs r1, 0 - movs r2, 0x8 - bl memset -_0800E4A0: - adds r6, 0xC - movs r0, 0x1 - add r8, r0 -_0800E4A6: - adds r7, 0x4 - adds r5, 0x1C - adds r4, 0x1 -_0800E4AC: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _0800E45C - movs r4, 0 - ldr r1, =gSaveBlock1Ptr - mov r9, r1 - ldr r6, =0x00003b98 - movs r7, 0 - mov r1, r8 - lsls r0, r1, 1 - add r0, r8 - lsls r0, 2 - ldr r1, [sp, 0x14] - adds r5, r0, r1 -_0800E4CE: - mov r1, r9 - ldr r0, [r1] - adds r0, r6 - adds r0, 0x4 - bl sub_800E388 - cmp r0, 0 - beq _0800E500 - mov r0, r9 - ldr r2, [r0] - ldr r1, =0x00003b98 - adds r0, r2, r1 - adds r0, r7 - ldr r1, [r0] - adds r2, r6 - adds r2, 0x4 - adds r0, r5, 0 - bl sub_800E378 - adds r5, 0xC - movs r0, 0x1 - add r8, r0 - mov r1, r8 - cmp r1, 0x13 - bgt _0800E50A -_0800E500: - adds r6, 0xC - adds r7, 0xC - adds r4, 0x1 - cmp r4, 0x13 - ble _0800E4CE -_0800E50A: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r7, =0x00003b98 - adds r0, r7 - ldr r1, [sp, 0x14] - movs r2, 0xF0 - bl memcpy - ldr r0, [sp, 0x14] - bl Free -_0800E520: - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E3A8 - - thumb_func_start sub_800E540 -sub_800E540: @ 800E540 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r9, r1 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - movs r7, 0 - ldr r6, =gSaveBlock1Ptr - ldr r4, =0x00003b98 - movs r5, 0 -_0800E558: - ldr r0, [r6] - adds r0, r4 - adds r0, 0x4 - mov r1, r9 - bl StringCompare - cmp r0, 0 - bne _0800E584 - ldr r0, [r6] - ldr r1, =0x00003b98 - adds r0, r1 - adds r0, r5 - ldr r0, [r0] - cmp r0, r8 - bne _0800E584 - movs r0, 0x1 - b _0800E59E - .pool -_0800E584: - ldr r0, [r6] - adds r0, r4 - adds r0, 0x4 - bl sub_800E388 - cmp r0, 0 - beq _0800E59C - adds r4, 0xC - adds r5, 0xC - adds r7, 0x1 - cmp r7, 0x13 - ble _0800E558 -_0800E59C: - movs r0, 0 -_0800E59E: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800E540 - - thumb_func_start sub_800E5AC -sub_800E5AC: @ 800E5AC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - ldr r0, =0x00003b98 - mov r8, r0 - movs r7, 0 - mov r6, r8 - movs r5, 0 - movs r4, 0x13 -_0800E5C0: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - mov r2, r8 - adds r0, r1, r2 - adds r0, r5 - str r7, [r0] - mov r0, sp - strh r7, [r0] - adds r1, r6 - adds r1, 0x4 - ldr r2, =0x01000004 - bl CpuSet - adds r6, 0xC - adds r5, 0xC - subs r4, 0x1 - cmp r4, 0 - bge _0800E5C0 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E5AC - - thumb_func_start nullsub_5 -nullsub_5: @ 800E5FC - bx lr - thumb_func_end nullsub_5 - - thumb_func_start nullsub_13 -nullsub_13: @ 800E600 - bx lr - thumb_func_end nullsub_13 - - thumb_func_start sub_800E604 -sub_800E604: @ 800E604 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - ldr r6, =gUnknown_03005000 - adds r5, r6, 0 - adds r5, 0xEE - ldrb r4, [r5] - mov r0, sp - movs r7, 0 - strh r7, [r0] - ldr r2, =0x0100067a - adds r1, r6, 0 - bl CpuSet - ldrb r0, [r5] - strb r4, [r5] - movs r0, 0xFF - strb r0, [r6, 0xC] - ldrb r0, [r5] - cmp r0, 0x4 - beq _0800E636 - ldrb r0, [r5] - strb r7, [r5] -_0800E636: - mov r7, sp - adds r7, 0x2 - add r0, sp, 0x4 - mov r8, r0 - movs r0, 0x6 - add r0, sp - mov r9, r0 - adds r5, r6, 0 - adds r5, 0x80 - movs r4, 0x4 -_0800E64A: - adds r0, r5, 0 - bl sub_800FCC4 - adds r5, 0x14 - subs r4, 0x1 - cmp r4, 0 - bge _0800E64A - movs r5, 0 - ldr r4, =gUnknown_0300506C - adds r0, r4, 0 - bl sub_800FCC4 - adds r0, r4, 0 - adds r0, 0xB8 - bl sub_800D6C8 - ldr r0, =0x0000097c - adds r4, r0 - adds r0, r4, 0 - bl sub_800D724 - strh r5, [r7] - ldr r1, =gUnknown_03003110 - ldr r2, =0x01000008 - adds r0, r7, 0 - bl CpuSet - mov r0, r8 - strh r5, [r0] - ldr r1, =gUnknown_03003090 - ldr r2, =0x01000028 - bl CpuSet - mov r0, r9 - strh r5, [r0] - ldr r1, =gLinkPlayers - ldr r2, =0x01000046 - bl CpuSet - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E604 - - thumb_func_start sub_800E6D0 -sub_800E6D0: @ 800E6D0 - push {r4-r6,lr} - ldr r4, =gIntrTable - ldr r5, [r4, 0x4] - ldr r6, [r4, 0x8] - bl sub_800E700 - bl rfu_REQ_stopMode - bl rfu_waitREQComplete - ldr r1, =0x04000208 - movs r0, 0 - strh r0, [r1] - str r5, [r4, 0x4] - str r6, [r4, 0x8] - movs r0, 0x1 - strh r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E6D0 - - thumb_func_start sub_800E700 -sub_800E700: @ 800E700 - push {r4,lr} - ldr r0, =gUnknown_03004190 - ldr r1, =0x00000e64 - ldr r4, =gIntrTable + 0x4 - adds r2, r4, 0 - movs r3, 0x1 - bl rfu_initializeAPI - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - bne _0800E732 - ldr r0, =gUnknown_020229C6 - strh r1, [r0] - bl sub_800AAF4 - movs r0, 0 - bl sub_80111B0 - bl sub_800E604 - adds r1, r4, 0x4 - movs r0, 0x3 - bl rfu_setTimerInterrupt -_0800E732: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E700 - - thumb_func_start sub_800E748 -sub_800E748: @ 800E748 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_8010750 - ldr r0, =gUnknown_03005000 - ldrh r0, [r0, 0x4] - cmp r0, 0x12 - bls _0800E75C - b _0800E862 -_0800E75C: - lsls r0, 2 - ldr r1, =_0800E770 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800E770: - .4byte _0800E7BC - .4byte _0800E862 - .4byte _0800E7E4 - .4byte _0800E862 - .4byte _0800E814 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E828 -_0800E7BC: - ldr r0, =gUnknown_02022B2C - bl sub_800BFCC - ldr r0, =gUnknown_03005000 - movs r2, 0x1 - strh r2, [r0, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0xA] - b _0800E862 - .pool -_0800E7E4: - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - ldr r3, =gUnknown_082ED6E0 - movs r1, 0 - movs r2, 0xF0 - bl sub_800C054 - movs r0, 0x3 - strh r0, [r4, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x6 - strh r1, [r0, 0xA] - b _0800E862 - .pool -_0800E814: - movs r0, 0 - bl sub_800C27C - ldr r1, =gUnknown_03005000 - movs r0, 0x5 - strh r0, [r1, 0x4] - b _0800E862 - .pool -_0800E828: - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000cdb - adds r1, r4, r0 - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r0, =sub_800EDBC - bl sub_800D52C - bl sub_800EAB4 - bl sub_800EAFC - movs r0, 0x14 - strh r0, [r4, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - strh r1, [r0, 0xA] - ldr r0, =sub_801084C - movs r1, 0x5 - bl CreateTask - adds r0, r5, 0 - bl DestroyTask -_0800E862: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E748 - - thumb_func_start sub_800E87C -sub_800E87C: @ 800E87C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_082ED6A5 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800E87C - - thumb_func_start sub_800E88C -sub_800E88C: @ 800E88C - push {r4-r7,lr} - adds r2, r0, 0 - adds r5, r1, 0 - movs r4, 0x1 - adds r1, r2, 0 - movs r6, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0800E8CC - movs r3, 0 - movs r5, 0x1 - ldr r1, =gUnknown_03005CDE -_0800E8A6: - adds r0, r2, 0 - ands r0, r5 - cmp r0, 0 - beq _0800E8B8 - adds r0, r3, r1 - strb r4, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_0800E8B8: - asrs r2, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800E8A6 - b _0800E942 - .pool -_0800E8CC: - movs r3, 0 - mvns r0, r1 - mov r12, r0 - movs r7, 0x1 - ldr r4, =gUnknown_03005CDE -_0800E8D6: - adds r2, r1, 0 - ands r2, r7 - cmp r2, 0 - bne _0800E8E2 - adds r0, r3, r4 - strb r2, [r0] -_0800E8E2: - asrs r1, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800E8D6 - movs r4, 0x4 - ldr r0, =gUnknown_03005CDE - ldrb r7, [r0] -_0800E8F4: - movs r3, 0 - subs r1, r4, 0x1 - cmp r7, r4 - beq _0800E910 - ldr r2, =gUnknown_03005CDE -_0800E8FE: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bhi _0800E910 - adds r0, r3, r2 - ldrb r0, [r0] - cmp r0, r4 - bne _0800E8FE -_0800E910: - cmp r3, 0x4 - bne _0800E916 - adds r6, r4, 0 -_0800E916: - lsls r0, r1, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0800E8F4 - mov r0, r12 - ands r5, r0 - movs r3, 0 - movs r2, 0x1 - ldr r1, =gUnknown_03005CDE -_0800E928: - adds r0, r5, 0 - ands r0, r2 - cmp r0, 0 - beq _0800E936 - adds r0, r3, r1 - strb r6, [r0] - adds r6, 0x1 -_0800E936: - asrs r5, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800E928 -_0800E942: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E88C - - thumb_func_start sub_800E94C -sub_800E94C: @ 800E94C - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_03005000 - ldrh r3, [r0, 0x4] - adds r7, r0, 0 - cmp r3, 0xC - bls _0800E95E - b _0800EA9A -_0800E95E: - lsls r0, r3, 2 - ldr r1, =_0800E970 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800E970: - .4byte _0800E9A4 - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800E9BC - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800E9E4 - .4byte _0800EA9A - .4byte _0800E9F8 - .4byte _0800EA3C -_0800E9A4: - ldr r0, =gUnknown_082ED608 - bl sub_800BFCC - ldr r0, =gUnknown_03005000 - movs r2, 0x1 - strh r2, [r0, 0x4] - b _0800E9CC - .pool -_0800E9BC: - ldrb r0, [r7, 0xC] - ldr r3, =gUnknown_082ED6E0 - movs r1, 0 - movs r2, 0xF0 - bl sub_800C054 - movs r2, 0x7 - strh r2, [r7, 0x4] -_0800E9CC: - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0xA] - b _0800EA9A - .pool -_0800E9E4: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r0, 0xA - strh r0, [r1, 0xA] - b _0800EA9A - .pool -_0800E9F8: - bl sub_80107A0 - cmp r0, 0x6 - beq _0800EA1C - cmp r0, 0x6 - bgt _0800EA0A - cmp r0, 0x5 - beq _0800EA10 - b _0800EA9A -_0800EA0A: - cmp r0, 0x9 - beq _0800EA1C - b _0800EA9A -_0800EA10: - ldr r1, =gUnknown_03005000 - movs r0, 0xC - strh r0, [r1, 0x4] - b _0800EA9A - .pool -_0800EA1C: - bl sub_800D630 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000ce4 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - adds r0, r6, 0 - bl DestroyTask - b _0800EA9A - .pool -_0800EA3C: - ldr r0, =0x00000c3e - adds r4, r7, r0 - ldrb r0, [r4] - movs r5, 0x80 - lsls r5, 17 - lsls r5, r0 - lsrs r5, 24 - ldrb r1, [r4] - movs r0, 0xC - bl rfu_clearSlot - ldrb r1, [r4] - ldr r0, =0x00000c3f - adds r2, r7, r0 - movs r0, 0x10 - movs r3, 0x46 - bl rfu_setRecvBuffer - adds r1, r7, 0 - adds r1, 0x4C - adds r0, r5, 0 - movs r2, 0xE - bl rfu_UNI_setSendData - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - strh r1, [r0, 0xA] - adds r0, r6, 0 - bl DestroyTask - ldr r4, =gUnknown_02022B44 - ldrb r0, [r4, 0xF] - cmp r0, 0 - bne _0800EA92 - bl sub_801227C - ldrb r0, [r4, 0xF] - adds r0, 0x1 - strb r0, [r4, 0xF] -_0800EA92: - ldr r0, =sub_801084C - movs r1, 0x5 - bl CreateTask -_0800EA9A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E94C - - thumb_func_start sub_800EAB4 -sub_800EAB4: @ 800EAB4 - push {r4,r5,lr} - ldr r0, =gUnknown_03004140 - ldrb r5, [r0] - movs r4, 0 -_0800EABC: - movs r0, 0x1 - ands r0, r5 - cmp r0, 0 - beq _0800EAE0 - lsls r2, r4, 3 - subs r2, r4 - lsls r2, 1 - ldr r0, =gUnknown_03005014 - adds r2, r0 - movs r0, 0x10 - adds r1, r4, 0 - movs r3, 0xE - bl rfu_setRecvBuffer - movs r0, 0x3 - adds r1, r4, 0 - bl rfu_clearSlot -_0800EAE0: - lsrs r5, 1 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800EABC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EAB4 - - thumb_func_start sub_800EAFC -sub_800EAFC: @ 800EAFC - push {r4-r6,lr} - ldr r0, =gUnknown_03004140 - ldrb r5, [r0] - ldr r4, =gUnknown_03005C87 - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0x46 - bl rfu_UNI_setSendData - adds r0, r5, 0 - bl sub_800E87C - ldr r1, =0xfffff379 - adds r6, r4, r1 - adds r1, r4, 0 - adds r1, 0x53 - strb r0, [r1] - adds r4, 0x5B - strb r5, [r4] - movs r1, 0x1 - negs r1, r1 - adds r0, r5, 0 - bl sub_800E88C - movs r0, 0x1 - strb r0, [r6, 0xC] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EAFC - - thumb_func_start sub_800EB44 -sub_800EB44: @ 800EB44 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x54 - bne _0800EB78 - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bne _0800EB78 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - movs r0, 0 - movs r1, 0 - bl sub_8011A64 -_0800EB78: - ldr r0, =gUnknown_03005000 - ldrh r2, [r0, 0x4] - adds r6, r0, 0 - cmp r2, 0x12 - bls _0800EB84 - b _0800ECF4 -_0800EB84: - lsls r0, r2, 2 - ldr r1, =_0800EB9C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800EB9C: - .4byte _0800EBE8 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800EC38 - .4byte _0800EC98 - .4byte _0800ECF4 - .4byte _0800ECAC - .4byte _0800EC10 - .4byte _0800ECF4 -_0800EBE8: - ldr r0, =gUnknown_02022B2C - bl sub_800BFCC - ldr r0, =gUnknown_03005000 - movs r2, 0x1 - strh r2, [r0, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0xA] - b _0800ECF4 - .pool -_0800EC10: - ldr r3, =gUnknown_082ED6E0 - movs r0, 0x2 - movs r1, 0 - movs r2, 0xF0 - bl sub_800C054 - ldr r0, =sub_800ED34 - bl sub_800D52C - ldr r1, =gUnknown_03005000 - movs r0, 0x12 - strh r0, [r1, 0x4] - b _0800ECF4 - .pool -_0800EC38: - ldr r1, =0x00000c3e - adds r0, r6, r1 - ldrb r1, [r0] - movs r0, 0x80 - lsls r0, 17 - lsls r0, r1 - lsrs r0, 24 - adds r1, r6, 0 - adds r1, 0x4C - movs r2, 0xE - bl rfu_UNI_setSendData - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0800ECF4 - strb r0, [r6, 0xC] - adds r0, r5, 0 - bl DestroyTask - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - movs r2, 0x16 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _0800EC88 - ldr r0, =sub_8010D0C - movs r1, 0x1 - bl CreateTask - b _0800ECF4 - .pool -_0800EC88: - ldr r0, =sub_801084C - movs r1, 0x5 - bl CreateTask - b _0800ECF4 - .pool -_0800EC98: - movs r0, 0 - bl sub_800C27C - ldr r1, =gUnknown_03005000 - movs r0, 0xF - strh r0, [r1, 0x4] - b _0800ECF4 - .pool -_0800ECAC: - ldr r0, =0x00000cdb - adds r1, r6, r0 - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r0, =sub_800EDBC - bl sub_800D52C - movs r0, 0x1 - bl sub_8011068 - bl sub_800EAB4 - bl sub_800EAFC - movs r0, 0x14 - strh r0, [r6, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - strh r1, [r0, 0xA] - movs r4, 0x1 - strb r4, [r6, 0xC] - ldr r0, =sub_801084C - movs r1, 0x5 - bl CreateTask - ldr r1, =0x00000ce8 - adds r0, r6, r1 - strb r4, [r0] - adds r0, r5, 0 - bl DestroyTask -_0800ECF4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EB44 - - thumb_func_start sub_800ED10 -sub_800ED10: @ 800ED10 - push {lr} - ldr r3, =gUnknown_082ED6E0 - movs r0, 0x1 - movs r1, 0 - movs r2, 0xF0 - bl sub_800C054 - pop {r0} - bx r0 - .pool - thumb_func_end sub_800ED10 - - thumb_func_start sub_800ED28 -sub_800ED28: @ 800ED28 - push {lr} - movs r0, 0 - bl sub_800C27C - pop {r0} - bx r0 - thumb_func_end sub_800ED28 - - thumb_func_start sub_800ED34 -sub_800ED34: @ 800ED34 - push {r4,lr} - ldr r0, =gUnknown_03005000 - movs r2, 0 - movs r1, 0xD - adds r0, 0x59 -_0800ED3E: - strb r2, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800ED3E - bl rfu_REQ_recvData - bl rfu_waitREQComplete - ldr r1, =gUnknown_03007870 - ldr r3, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r4, r3, r0 - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x12] - cmp r0, 0 - beq _0800ED9A - movs r2, 0xCD - lsls r2, 4 - adds r1, r3, r2 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0x92 - lsls r1, 1 - adds r0, r3, r1 - ldr r2, =0x00000c3f - adds r1, r3, r2 - bl sub_800D7D8 - ldr r1, =gUnknown_02022B44 - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - bl sub_800F048 - ldrb r0, [r4] - bl rfu_UNI_readySendData - ldrb r0, [r4] - bl rfu_UNI_clearRecvNewDataFlag -_0800ED9A: - movs r0, 0x1 - bl rfu_REQ_sendData_wrapper - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800ED34 - - thumb_func_start sub_800EDBC -sub_800EDBC: @ 800EDBC - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cdb - adds r0, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_800EDBC - - thumb_func_start sub_800EDD4 -sub_800EDD4: @ 800EDD4 - push {r4-r6,lr} - bl sub_800C048 - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - bne _0800EDF0 - ldr r0, =sub_800E748 - b _0800EDF6 - .pool -_0800EDF0: - cmp r0, 0 - bne _0800EE18 - ldr r0, =sub_800E94C -_0800EDF6: - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE38 - adds r0, r4, 0 - adds r0, 0x67 - ldrb r0, [r0] - bl DestroyTask - bl sub_800E604 - b _0800EE38 - .pool -_0800EE18: - cmp r0, 0x2 - bne _0800EE38 - ldr r0, =sub_800EB44 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE38 - adds r0, r4, 0 - adds r0, 0x67 - ldrb r0, [r0] - bl DestroyTask - bl sub_800E604 -_0800EE38: - movs r5, 0 - ldr r6, =gUnknown_082ED7E0 -_0800EE3C: - lsls r0, r5, 2 - adds r0, r6 - ldr r4, [r0] - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE5E - adds r0, r4, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0800EE5E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x2 - bls _0800EE3C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EDD4 - - thumb_func_start sub_800EE78 -sub_800EE78: @ 800EE78 - push {lr} - ldr r0, =sub_800E748 - movs r1, 0x1 - bl CreateTask - ldr r1, =gUnknown_03005000 - adds r1, 0x67 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EE78 - - thumb_func_start sub_800EE94 -sub_800EE94: @ 800EE94 - push {lr} - ldr r1, =gUnknown_03005000 - ldrh r0, [r1, 0x4] - cmp r0, 0x7 - bne _0800EEB4 - ldr r2, =0x00000ccd - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800EEB4 - movs r0, 0x1 - b _0800EEB6 - .pool -_0800EEB4: - movs r0, 0 -_0800EEB6: - pop {r1} - bx r1 - thumb_func_end sub_800EE94 - - thumb_func_start sub_800EEBC -sub_800EEBC: @ 800EEBC - push {r4,lr} - ldr r4, =gUnknown_03005000 - ldrh r0, [r4, 0x4] - cmp r0, 0x7 - bne _0800EEF8 - ldr r0, =gUnknown_03007890 - ldr r1, [r0] - ldr r2, =0x00000c3d - adds r0, r4, r2 - ldrb r0, [r0] - lsls r0, 5 - adds r1, r0 - ldrh r0, [r1, 0x14] - movs r1, 0xF0 - bl sub_800C12C - lsls r0, 24 - cmp r0, 0 - bne _0800EEF8 - movs r0, 0x9 - strh r0, [r4, 0x4] - movs r0, 0x1 - b _0800EEFA - .pool -_0800EEF8: - movs r0, 0 -_0800EEFA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_800EEBC - - thumb_func_start sub_800EF00 -sub_800EF00: @ 800EF00 - push {lr} - ldr r0, =sub_800E94C - movs r1, 0x1 - bl CreateTask - ldr r1, =gUnknown_03005000 - adds r1, 0x67 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EF00 - - thumb_func_start sub_800EF1C -sub_800EF1C: @ 800EF1C - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - cmp r0, 0 - bne _0800EF30 - movs r0, 0 - b _0800EF32 - .pool -_0800EF30: - movs r0, 0x1 -_0800EF32: - pop {r1} - bx r1 - thumb_func_end sub_800EF1C - - thumb_func_start sub_800EF38 -sub_800EF38: @ 800EF38 - ldr r1, =gUnknown_03005000 - movs r0, 0x4 - strh r0, [r1, 0x4] - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - ldr r2, =0x00000ce7 - adds r1, r2 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_800EF38 - - thumb_func_start sub_800EF58 -sub_800EF58: @ 800EF58 - push {lr} - adds r1, r0, 0 - ldr r2, =gUnknown_03005000 - ldrh r0, [r2, 0x4] - cmp r0, 0x11 - beq _0800EF68 - cmp r1, 0 - beq _0800EF74 -_0800EF68: - movs r0, 0x12 - strh r0, [r2, 0x4] - movs r0, 0x1 - b _0800EF76 - .pool -_0800EF74: - movs r0, 0 -_0800EF76: - pop {r1} - bx r1 - thumb_func_end sub_800EF58 - - thumb_func_start sub_800EF7C -sub_800EF7C: @ 800EF7C - ldr r1, =gUnknown_03005000 - movs r0, 0xE - strh r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_800EF7C - - thumb_func_start sub_800EF88 -sub_800EF88: @ 800EF88 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - movs r2, 0 - b _0800EF9A -_0800EF92: - lsrs r1, 1 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_0800EF9A: - cmp r2, 0x3 - bhi _0800EFAC - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800EF92 - adds r0, r2, 0 - bl rfu_UNI_readySendData -_0800EFAC: - pop {r0} - bx r0 - thumb_func_end sub_800EF88 - - thumb_func_start sub_800EFB0 -sub_800EFB0: @ 800EFB0 - push {r4-r7,lr} - sub sp, 0x4 - movs r2, 0 - ldr r7, =gUnknown_03003090 - ldr r0, =gUnknown_03005000 - adds r6, r7, 0 - ldr r1, =0x00000c87 - adds r5, r0, r1 -_0800EFC0: - movs r3, 0 - lsls r0, r2, 3 - lsls r1, r2, 4 - adds r4, r2, 0x1 - subs r0, r2 - lsls r0, 1 - adds r2, r0, r5 - adds r1, r6 -_0800EFD0: - ldrh r0, [r1] - lsrs r0, 8 - strb r0, [r2, 0x1] - ldrh r0, [r1] - strb r0, [r2] - adds r2, 0x2 - adds r1, 0x2 - adds r3, 0x1 - cmp r3, 0x6 - ble _0800EFD0 - adds r2, r4, 0 - cmp r2, 0x4 - ble _0800EFC0 - movs r0, 0 - mov r1, sp - strh r0, [r1] - ldr r2, =0x01000028 - mov r0, sp - adds r1, r7, 0 - bl CpuSet - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EFB0 - - thumb_func_start sub_800F014 -sub_800F014: @ 800F014 - push {lr} - ldr r3, =gUnknown_03003110 - ldr r2, =gUnknown_03003090 - movs r1, 0x6 -_0800F01C: - ldrh r0, [r3] - strh r0, [r2] - adds r3, 0x2 - adds r2, 0x2 - subs r1, 0x1 - cmp r1, 0 - bge _0800F01C - ldr r1, =gUnknown_03003110 - movs r2, 0 - adds r0, r1, 0 - adds r0, 0xC -_0800F032: - strh r2, [r0] - subs r0, 0x2 - cmp r0, r1 - bge _0800F032 - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F014 - - thumb_func_start sub_800F048 -sub_800F048: @ 800F048 - push {r4,r5,lr} - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000c3c - adds r5, r4, r0 - ldrb r0, [r5] - cmp r0, 0 - beq _0800F07A - ldr r1, =0x00000c1c - adds r0, r4, r1 - adds r1, r4, 0 - adds r1, 0x4C - bl sub_800DAC8 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =0x00000c3a - adds r0, r4, r1 - ldrb r0, [r0] - adds r1, r0, 0 - cmp r1, 0 - bne _0800F076 - ldrb r0, [r5] - strb r1, [r5] -_0800F076: - cmp r2, 0 - bne _0800F09E -_0800F07A: - ldr r5, =gUnknown_03005000 - ldr r1, =0x00000c3c - adds r0, r5, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0800F09E - ldr r1, =0x000009e8 - adds r0, r5, r1 - adds r4, r5, 0 - adds r4, 0x4C - adds r1, r4, 0 - bl sub_800D9DC - ldr r1, =0x00000c1c - adds r0, r5, r1 - adds r1, r4, 0 - bl sub_800DA68 -_0800F09E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F048 - - thumb_func_start sub_800F0B8 -sub_800F0B8: @ 800F0B8 - push {r4,lr} - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0 - bne _0800F0CC -_0800F0C4: - movs r0, 0 - b _0800F0EC - .pool -_0800F0CC: - movs r3, 0 - ldr r4, =gUnknown_03003090 -_0800F0D0: - movs r2, 0 - lsls r0, r3, 4 - adds r1, r0, r4 -_0800F0D6: - ldrh r0, [r1] - cmp r0, 0 - bne _0800F0C4 - adds r1, 0x2 - adds r2, 0x1 - cmp r2, 0x6 - ble _0800F0D6 - adds r3, 0x1 - cmp r3, 0x4 - ble _0800F0D0 - movs r0, 0x1 -_0800F0EC: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F0B8 - - thumb_func_start sub_800F0F8 -sub_800F0F8: @ 800F0F8 - push {r4-r6,lr} - ldr r6, =gUnknown_03005000 - ldrh r0, [r6, 0x4] - cmp r0, 0x13 - bhi _0800F118 - bl rfu_REQ_recvData - bl rfu_waitREQComplete - movs r0, 0 - bl rfu_REQ_sendData_wrapper - b _0800F1D2 - .pool -_0800F118: - ldr r0, =0x00000cdb - adds r1, r6, r0 - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r0, =0x00000ce2 - adds r1, r6, r0 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r1] - ldrb r0, [r0, 0x2] - ands r0, r1 - cmp r0, r1 - bne _0800F1D2 - cmp r0, 0 - beq _0800F1D2 - ldr r1, =0x00000cdc - adds r0, r6, r1 - ldrb r0, [r0] - adds r5, r0, 0 - cmp r5, 0 - bne _0800F1C8 - ldr r0, =0x00000ce3 - adds r4, r6, r0 - ldrb r0, [r4] - cmp r0, 0 - beq _0800F1A8 - bl sub_8011D6C - strb r5, [r4] - ldr r1, =0x00000ce4 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800F18C - movs r4, 0x80 - lsls r4, 8 - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 - adds r0, r4, 0 - bl sub_8011170 - b _0800F1D2 - .pool -_0800F18C: - ldr r0, =gUnknown_03004140 - ldrb r4, [r0] - cmp r4, 0 - bne _0800F1A8 - bl sub_800EDD4 - ldr r0, =gReceivedRemoteLinkPlayers - strb r4, [r0] - b _0800F1D2 - .pool -_0800F1A8: - bl sub_800EFB0 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cda - adds r0, r1 - ldrb r0, [r0] - bl rfu_UNI_readySendData - movs r0, 0x1 - bl rfu_REQ_sendData_wrapper - b _0800F1CC - .pool -_0800F1C8: - bl rfu_REQ_PARENT_resumeRetransmitAndChange -_0800F1CC: - ldr r1, =gUnknown_03005000 - movs r0, 0x1 - strb r0, [r1, 0xE] -_0800F1D2: - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F0F8 - - thumb_func_start sub_800F1E0 -sub_800F1E0: @ 800F1E0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r0, =gUnknown_03005000 - ldrh r1, [r0, 0x4] - adds r6, r0, 0 - cmp r1, 0x13 - bhi _0800F1F8 - b _0800F45A -_0800F1F8: - ldrb r0, [r6, 0xE] - cmp r0, 0x1 - beq _0800F200 - b _0800F45A -_0800F200: - bl rfu_waitREQComplete - ldr r0, =0x00000cdb - adds r2, r6, r0 - ldrb r0, [r2] - cmp r0, 0 - bne _0800F220 - adds r1, r6, 0 - adds r1, 0xEE -_0800F212: - ldrb r0, [r1] - cmp r0, 0 - beq _0800F21A - b _0800F480 -_0800F21A: - ldrb r0, [r2] - cmp r0, 0 - beq _0800F212 -_0800F220: - bl rfu_REQ_recvData - bl rfu_waitREQComplete - ldr r2, =gUnknown_03004140 - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ce2 - adds r0, r4, r1 - ldrb r1, [r2, 0x3] - ldrb r0, [r0] - ands r1, r0 - cmp r1, r0 - beq _0800F23C - b _0800F444 -_0800F23C: - ldr r6, =0x00000cdc - adds r1, r4, r6 - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r1, =gUnknown_02022B44 - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - ldrb r7, [r2] - movs r5, 0 -_0800F252: - movs r0, 0x1 - ands r0, r7 - lsrs r1, r7, 1 - str r1, [sp, 0x4] - adds r2, r5, 0x1 - str r2, [sp] - cmp r0, 0 - bne _0800F264 - b _0800F364 -_0800F264: - ldr r1, =gUnknown_03005000 - lsls r2, r5, 3 - subs r0, r2, r5 - lsls r4, r0, 1 - adds r0, r1, 0 - adds r0, 0x15 - adds r0, r4, r0 - ldrb r0, [r0] - adds r6, r1, 0 - adds r3, r2, 0 - lsls r1, r5, 24 - mov r10, r1 - cmp r0, 0 - beq _0800F35C - ldr r2, =0x00000cee - adds r0, r6, r2 - adds r1, r5, r0 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0800F2E0 - adds r0, r6, 0 - adds r0, 0x14 - adds r0, r4, r0 - ldrb r2, [r0] - lsrs r2, 5 - ldrb r0, [r1] - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - cmp r2, r0 - beq _0800F2E0 - ldr r0, =0x00000cea - adds r1, r6, r0 - adds r1, r5, r1 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _0800F35C - movs r0, 0x81 - lsls r0, 8 - bl sub_8011170 - b _0800F35C - .pool -_0800F2E0: - ldr r2, =gUnknown_03005000 - ldr r6, =0x00000cee - adds r1, r2, r6 - adds r1, r5, r1 - subs r3, r5 - lsls r3, 1 - adds r4, r2, 0 - adds r4, 0x14 - adds r2, r3, r4 - ldrb r0, [r2] - lsrs r0, 5 - strb r0, [r1] - ldr r1, =gUnknown_03005000 - subs r6, 0x4 - adds r0, r1, r6 - adds r0, r5, r0 - movs r1, 0 - strb r1, [r0] - ldrb r1, [r2] - movs r0, 0x1F - ands r0, r1 - strb r0, [r2] - ldr r2, =gUnknown_03005CDE - adds r0, r5, r2 - ldrb r0, [r0] - movs r6, 0 - lsls r1, r5, 24 - mov r10, r1 - lsrs r2, r7, 1 - str r2, [sp, 0x4] - adds r5, 0x1 - str r5, [sp] - ldr r1, =gUnknown_03003090 - mov r9, r1 - adds r5, r3, 0 - adds r7, r4, 0 - lsls r0, 4 - mov r8, r0 - adds r2, r5, 0x1 - mov r12, r2 -_0800F330: - lsls r1, r6, 1 - mov r0, r8 - adds r4, r1, r0 - add r4, r9 - mov r2, r12 - adds r3, r1, r2 - adds r3, r7 - ldrb r2, [r3] - lsls r2, 8 - adds r1, r5 - adds r1, r7 - ldrb r0, [r1] - orrs r0, r2 - strh r0, [r4] - movs r0, 0 - strb r0, [r3] - strb r0, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x6 - bls _0800F330 -_0800F35C: - mov r1, r10 - lsrs r0, r1, 24 - bl rfu_UNI_clearRecvNewDataFlag -_0800F364: - ldr r2, [sp, 0x4] - lsls r0, r2, 16 - lsrs r7, r0, 16 - ldr r6, [sp] - lsls r0, r6, 16 - lsrs r5, r0, 16 - cmp r5, 0x3 - bhi _0800F376 - b _0800F252 -_0800F376: - bl sub_800F014 - movs r0, 0 - bl sub_800F86C - bl sub_8010528 - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ce5 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800F452 - ldr r2, =0x00000cd9 - adds r0, r4, r2 - ldrb r2, [r0] - cmp r2, 0 - bne _0800F452 - ldr r0, =gUnknown_02022B44 - ldrb r1, [r0, 0xE] - strb r2, [r0, 0xE] - ldr r6, =0x00000cda - adds r0, r4, r6 - ldrb r1, [r0] - movs r0, 0x3 - bl rfu_clearSlot - movs r5, 0 - adds r7, r4, 0 - adds r7, 0x14 -_0800F3B2: - ldr r0, =0x00000ce5 - adds r6, r4, r0 - ldrb r0, [r6] - asrs r0, r5 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800F3D6 - lsls r1, r5, 24 - lsrs r1, 24 - lsls r2, r5, 3 - subs r2, r5 - lsls r2, 1 - adds r2, r7 - movs r0, 0x10 - movs r3, 0xE - bl rfu_setRecvBuffer -_0800F3D6: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x3 - bls _0800F3B2 - subs r4, r6, 0x3 - ldrb r0, [r4] - ldrb r2, [r6] - adds r1, r0, 0 - orrs r1, r2 - bl sub_800E88C - ldrb r1, [r6] - movs r2, 0 - strb r1, [r6, 0x4] - ldrb r0, [r4] - orrs r0, r1 - strb r0, [r4] - strb r2, [r6] - ldrb r0, [r4] - adds r1, r6, 0 - subs r1, 0x5E - movs r2, 0x46 - bl rfu_UNI_setSendData - ldrb r0, [r4] - bl sub_800E87C - adds r1, r6, 0 - subs r1, 0xB - strb r0, [r1] - ldr r0, =sub_8010AAC - movs r1, 0 - bl CreateTask - b _0800F452 - .pool -_0800F444: - ldr r2, =0x00000cdc - adds r1, r4, r2 - ldrb r0, [r1] - movs r2, 0 - movs r0, 0x1 - strb r0, [r1] - strb r2, [r4, 0xE] -_0800F452: - ldr r1, =gUnknown_03005000 - movs r0, 0 - strb r0, [r1, 0xE] - adds r6, r1, 0 -_0800F45A: - ldr r1, =0x00000cdc - adds r0, r6, r1 - ldrb r0, [r0] - adds r1, r0, 0 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0 - beq _0800F484 - movs r0, 0x1 - ands r0, r1 - b _0800F486 - .pool -_0800F480: - movs r0, 0 - b _0800F486 -_0800F484: - movs r0, 0 -_0800F486: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800F1E0 - - thumb_func_start sub_800F498 -sub_800F498: @ 800F498 - push {r4,r5,lr} - adds r4, r0, 0 - adds r2, r1, 0 - ldrh r1, [r4] - cmp r1, 0 - beq _0800F4DC - ldr r0, =gUnknown_03005000 - movs r5, 0x81 - lsls r5, 1 - adds r3, r0, r5 - ldrb r0, [r3] - lsls r0, 5 - orrs r0, r1 - strh r0, [r4] - ldrb r0, [r3] - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - strb r0, [r3] - adds r3, r4, 0 - movs r4, 0x6 -_0800F4C2: - ldrh r1, [r3] - lsrs r0, r1, 8 - strb r0, [r2, 0x1] - strb r1, [r2] - adds r2, 0x2 - adds r3, 0x2 - subs r4, 0x1 - cmp r4, 0 - bge _0800F4C2 - b _0800F4EA - .pool -_0800F4DC: - movs r1, 0 - adds r0, r2, 0 - adds r0, 0xD -_0800F4E2: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r2 - bge _0800F4E2 -_0800F4EA: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_800F498 - - thumb_func_start sub_800F4F0 -sub_800F4F0: @ 800F4F0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x58 - ldr r0, =gUnknown_03005124 - mov r1, sp - bl sub_800D934 - movs r1, 0 - ldr r0, =gUnknown_03003090 - mov r12, r0 -_0800F506: - movs r4, 0 - lsls r0, r1, 3 - adds r2, r1, 0x1 - mov r8, r2 - lsls r6, r1, 4 - subs r0, r1 - lsls r5, r0, 1 -_0800F514: - lsls r1, r4, 1 - adds r3, r1, r6 - add r3, r12 - adds r1, r5, r1 - adds r0, r1, 0x1 - add r0, sp - ldrb r2, [r0] - lsls r2, 8 - mov r7, sp - adds r0, r7, r1 - ldrb r0, [r0] - orrs r0, r2 - strh r0, [r3] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bls _0800F514 - mov r1, r8 - lsls r0, r1, 24 - lsrs r1, r0, 24 - cmp r1, 0x4 - bls _0800F506 - movs r0, 0 - bl sub_800F86C - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x2] - cmp r0, 0 - bne _0800F5C0 - ldr r0, =gUnknown_03005000 - ldr r2, =0x00000ce4 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800F5C0 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0800F58C - cmp r0, 0x6 - beq _0800F58C - cmp r0, 0x9 - beq _0800F58C - movs r1, 0x90 - lsls r1, 8 - movs r0, 0x2 - bl sub_8011A64 -_0800F58C: - bl rfu_clearAllSlot - ldr r1, =gReceivedRemoteLinkPlayers - movs r0, 0 - strb r0, [r1] - ldr r0, =gUnknown_03005000 - movs r5, 0 - str r5, [r0] - ldr r7, =0x00000ce4 - adds r6, r0, r7 - ldrb r0, [r6] - cmp r0, 0x1 - bne _0800F5B8 - movs r4, 0x90 - lsls r4, 8 - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 - adds r0, r4, 0 - bl sub_8011170 -_0800F5B8: - ldr r0, =gUnknown_03004140 - strb r5, [r0, 0x5] - strb r5, [r0, 0x4] - strb r5, [r6] -_0800F5C0: - ldr r6, =gUnknown_03005000 - movs r0, 0xCD - lsls r0, 4 - adds r2, r6, r0 - ldrb r0, [r2] - cmp r0, 0 - beq _0800F604 - ldrb r0, [r2] - subs r0, 0x1 - ldrb r1, [r2] - strb r0, [r2] - bl sub_8010528 - ldr r5, =gUnknown_03003110 - add r4, sp, 0x48 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_800F498 - ldr r1, =0x000009e8 - adds r0, r6, r1 - adds r1, r4, 0 - bl sub_800D888 - movs r1, 0 - movs r2, 0 -_0800F5F4: - lsls r0, r1, 1 - adds r0, r5 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x6 - bls _0800F5F4 -_0800F604: - bl sub_800F0B8 - add sp, 0x58 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F4F0 - - thumb_func_start sub_800F638 -sub_800F638: @ 800F638 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_03005000 - ldr r2, [r0, 0x70] - mov r10, r2 - movs r5, 0 - adds r2, r0, 0 - adds r2, 0x6E - ldrh r3, [r2] - cmp r5, r3 - bge _0800F6D4 - mov r9, r0 - ldr r0, =gUnknown_03000D90 - mov r8, r0 -_0800F65A: - movs r0, 0x1 - ands r0, r1 - lsrs r7, r1, 1 - adds r6, r5, 0x1 - cmp r0, 0 - bne _0800F6C8 - ldr r1, =0xffff8900 - adds r0, r1, 0 - adds r1, r5, 0 - orrs r1, r0 - mov r2, r8 - strh r1, [r2] - movs r4, 0 - lsls r0, r5, 1 - ldr r3, =gUnknown_03000D80 - mov r12, r3 - adds r0, r5 - lsls r0, 2 - mov r1, r10 - adds r2, r0, r1 - mov r3, r8 - adds r3, 0x2 -_0800F686: - ldrb r1, [r2, 0x1] - lsls r1, 8 - ldrb r0, [r2] - orrs r0, r1 - strh r0, [r3] - adds r2, 0x2 - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x6 - ble _0800F686 - movs r4, 0 - ldr r2, =gUnknown_03000D90 - ldr r1, =gUnknown_03000D80 -_0800F6A0: - ldrh r0, [r2] - lsrs r0, 8 - strb r0, [r1, 0x1] - ldrh r0, [r2] - strb r0, [r1] - adds r2, 0x2 - adds r1, 0x2 - adds r4, 0x1 - cmp r4, 0x6 - ble _0800F6A0 - ldr r0, =gUnknown_030059E8 - mov r1, r12 - bl sub_800D888 - movs r1, 0x1 - lsls r1, r5 - mov r2, r9 - ldr r0, [r2, 0x78] - orrs r0, r1 - str r0, [r2, 0x78] -_0800F6C8: - adds r1, r7, 0 - adds r5, r6, 0 - ldr r3, =gUnknown_0300506E - ldrh r3, [r3] - cmp r5, r3 - blt _0800F65A -_0800F6D4: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F638 - - thumb_func_start sub_800F6FC -sub_800F6FC: @ 800F6FC - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_03005000 - ldrb r2, [r0, 0xC] - cmp r2, 0x1 - bne _0800F71C - cmp r1, 0 - beq _0800F71C - adds r0, 0x61 - adds r0, r1, r0 - strb r2, [r0] - b _0800F724 - .pool -_0800F71C: - adds r0, 0x5C - adds r0, r1, r0 - movs r1, 0x1 - strb r1, [r0] -_0800F724: - pop {r0} - bx r0 - thumb_func_end sub_800F6FC - - thumb_func_start sub_800F728 -sub_800F728: @ 800F728 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gUnknown_03005000 - adds r1, r3, 0 - adds r1, 0x5C - adds r1, r0, r1 - movs r2, 0 - strb r2, [r1] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - adds r1, 0x92 - strb r2, [r1] - bx lr - .pool - thumb_func_end sub_800F728 - - thumb_func_start sub_800F74C -sub_800F74C: @ 800F74C - push {r4,r5,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_03005000 - ldrb r1, [r0, 0xC] - adds r5, r0, 0 - cmp r1, 0x1 - bne _0800F764 - movs r0, 0 - b _0800F786 - .pool -_0800F764: - movs r2, 0 - ldr r0, =0x00000cde - adds r4, r5, r0 -_0800F76A: - adds r1, r2, r4 - adds r0, r3, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800F76A - ldr r1, =0x00000c3e - adds r0, r5, r1 - ldrb r0, [r0] - adds r0, r3 - ldrb r0, [r0] -_0800F786: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F74C - - thumb_func_start rfu_func_080F97B8 -rfu_func_080F97B8: @ 800F794 - push {lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0800F7C6 - ldr r3, =gUnknown_03005DA8 - ldrh r2, [r3] - cmp r2, 0 - beq _0800F7C6 - ldr r0, =gUnknown_030022B4 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0800F7C6 - ldr r1, =gUnknown_03000D78 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldrb r0, [r1] - lsls r0, 8 - orrs r0, r2 - strh r0, [r3] - movs r0, 0xBE - lsls r0, 8 - bl sub_800FD14 -_0800F7C6: - pop {r0} - bx r0 - .pool - thumb_func_end rfu_func_080F97B8 - - thumb_func_start sub_800F7DC -sub_800F7DC: @ 800F7DC - ldr r0, =gUnknown_02022B14 - bx lr - .pool - thumb_func_end sub_800F7DC - - thumb_func_start sub_800F7E4 -sub_800F7E4: @ 800F7E4 - push {lr} - movs r2, 0 - ldr r0, =gUnknown_03005000 - ldr r1, [r0] - ldr r0, =rfu_func_080F97B8 - cmp r1, r0 - bne _0800F7F4 - movs r2, 0x1 -_0800F7F4: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F7E4 - - thumb_func_start sub_800F804 -sub_800F804: @ 800F804 - ldr r1, =gUnknown_03005000 - ldr r0, =rfu_func_080F97B8 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_800F804 - - thumb_func_start Rfu_set_zero -Rfu_set_zero: @ 800F814 - ldr r1, =gUnknown_03005000 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end Rfu_set_zero - - thumb_func_start sub_800F820 -sub_800F820: @ 800F820 - push {lr} - movs r0, 0x88 - lsls r0, 7 - bl sub_800FD14 - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0800F83C - bl sub_8082D18 - ldr r1, =gUnknown_03003110 - strh r0, [r1, 0xC] -_0800F83C: - ldr r1, =gUnknown_020223C0 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F820 - - thumb_func_start sub_800F850 -sub_800F850: @ 800F850 - push {lr} - ldr r1, =gUnknown_03005000 - ldr r0, [r1] - cmp r0, 0 - bne _0800F85E - ldr r0, =sub_800F820 - str r0, [r1] -_0800F85E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F850 - - thumb_func_start sub_800F86C -sub_800F86C: @ 800F86C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r8, r0 -_0800F87A: - mov r1, r8 - lsls r0, r1, 4 - ldr r2, =gUnknown_03003090 - adds r1, r0, r2 - ldrh r7, [r1] - movs r3, 0xFF - lsls r3, 8 - adds r1, r3, 0 - ands r1, r7 - movs r2, 0x88 - lsls r2, 8 - adds r5, r0, 0 - cmp r1, r2 - beq _0800F960 - cmp r1, r2 - bgt _0800F8D6 - movs r0, 0xCC - lsls r0, 7 - cmp r1, r0 - bne _0800F8A4 - b _0800FAE0 -_0800F8A4: - cmp r1, r0 - bgt _0800F8C4 - movs r0, 0x88 - lsls r0, 7 - cmp r1, r0 - bne _0800F8B2 - b _0800FBF4 -_0800F8B2: - movs r0, 0xBE - lsls r0, 7 - cmp r1, r0 - bne _0800F8BC - b _0800FAD0 -_0800F8BC: - b _0800FC04 - .pool -_0800F8C4: - movs r0, 0xEE - lsls r0, 7 - cmp r1, r0 - beq _0800F920 - movs r0, 0xF0 - lsls r0, 7 - cmp r1, r0 - beq _0800F90E - b _0800FC04 -_0800F8D6: - movs r0, 0xBE - lsls r0, 8 - cmp r1, r0 - bne _0800F8E0 - b _0800FBF4 -_0800F8E0: - cmp r1, r0 - bgt _0800F8F8 - movs r0, 0x89 - lsls r0, 8 - cmp r1, r0 - beq _0800F9C8 - movs r0, 0xA1 - lsls r0, 8 - cmp r1, r0 - bne _0800F8F6 - b _0800FAAC -_0800F8F6: - b _0800FC04 -_0800F8F8: - movs r0, 0xED - lsls r0, 8 - cmp r1, r0 - bne _0800F902 - b _0800FB10 -_0800F902: - movs r0, 0xEE - lsls r0, 8 - cmp r1, r0 - bne _0800F90C - b _0800FBB0 -_0800F90C: - b _0800FC04 -_0800F90E: - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0 - bne _0800F920 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0800F920 - b _0800FC50 -_0800F920: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - mov r6, r8 - adds r6, 0x1 - cmp r0, 0 - beq _0800F930 - b _0800FC08 -_0800F930: - ldr r1, =gUnknown_03003090+0x2 - adds r0, r5, r1 - ldrh r0, [r0] - ldr r2, =gUnknown_03005000 - strb r0, [r2, 0xD] - ldr r3, =gUnknown_03003090+0x4 - adds r0, r5, r3 - bl sub_800F74C - ldr r4, =gUnknown_03005CCE - strb r0, [r4] - b _0800FC08 - .pool -_0800F960: - ldr r0, =gUnknown_03005000 - mov r9, r0 - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r7, r0, 2 - mov r2, r9 - adds r3, r7, r2 - movs r4, 0x92 - adds r4, r3 - mov r12, r4 - ldrb r4, [r4] - mov r6, r8 - adds r6, 0x1 - cmp r4, 0 - beq _0800F982 - b _0800FC08 -_0800F982: - adds r0, r3, 0 - adds r0, 0x80 - movs r2, 0 - strh r4, [r0] - ldr r1, =gUnknown_03003090+0x2 - adds r0, r5, r1 - ldrh r0, [r0] - adds r1, r3, 0 - adds r1, 0x82 - strh r0, [r1] - ldr r1, =gUnknown_03003090+0x4 - adds r0, r5, r1 - ldrh r1, [r0] - adds r0, r3, 0 - adds r0, 0x91 - strb r1, [r0] - mov r0, r9 - adds r0, 0x88 - adds r0, r7, r0 - str r4, [r0] - movs r0, 0x1 - mov r3, r12 - strb r0, [r3] - mov r0, r9 - adds r0, 0x5C - add r0, r8 - strb r2, [r0] - b _0800FC08 - .pool -_0800F9C8: - ldr r4, =gUnknown_03005000 - mov r9, r4 - mov r0, r8 - lsls r1, r0, 2 - adds r0, r1, r0 - lsls r4, r0, 2 - mov r3, r9 - adds r2, r4, r3 - adds r0, r2, 0 - adds r0, 0x92 - ldrb r3, [r0] - mov r10, r1 - mov r6, r8 - adds r6, 0x1 - cmp r3, 0x1 - beq _0800F9EA - b _0800FC08 -_0800F9EA: - movs r0, 0xFF - ands r0, r7 - adds r2, 0x80 - strh r0, [r2] - mov r1, r9 - adds r1, 0x88 - adds r1, r4, r1 - lsls r3, r0 - ldr r0, [r1] - orrs r0, r3 - str r0, [r1] - movs r4, 0 - ldr r0, =gBlockRecvBuffer - mov r9, r0 - mov r12, r2 - mov r1, r8 - lsls r7, r1, 8 - adds r3, r5, 0 -_0800FA0E: - mov r2, r12 - ldrh r0, [r2] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 1 - adds r1, r4 - lsls r1, 1 - adds r1, r7 - add r1, r9 - adds r2, r4, 0x1 - lsls r0, r2, 1 - adds r0, r3 - ldr r4, =gUnknown_03003090 - adds r0, r4 - ldrh r0, [r0] - strh r0, [r1] - lsls r2, 16 - lsrs r4, r2, 16 - cmp r4, 0x5 - bls _0800FA0E - ldr r4, =gUnknown_03005000 - mov r0, r10 - add r0, r8 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x88 - adds r1, r0, r1 - adds r2, r0, r4 - adds r0, r2, 0 - adds r0, 0x82 - ldrh r0, [r0] - lsls r0, 2 - ldr r3, =gUnknown_082ED628 - adds r0, r3 - ldr r1, [r1] - ldr r0, [r0] - cmp r1, r0 - beq _0800FA5C - b _0800FC08 -_0800FA5C: - adds r1, r2, 0 - adds r1, 0x92 - movs r0, 0x2 - strb r0, [r1] - mov r1, r8 - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_800F6FC - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - beq _0800FA7E - b _0800FC08 -_0800FA7E: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0800FA88 - b _0800FC08 -_0800FA88: - ldrb r0, [r4, 0xC] - cmp r0, 0 - beq _0800FA90 - b _0800FC08 -_0800FA90: - ldr r0, =gBlockRecvBuffer - bl sub_8010A70 - b _0800FC08 - .pool -_0800FAAC: - ldr r2, =gUnknown_082ED6B8 - ldr r3, =gUnknown_03003090+0x2 - adds r0, r5, r3 - ldrh r1, [r0] - lsls r1, 3 - adds r0, r1, r2 - ldr r0, [r0] - adds r2, 0x4 - adds r1, r2 - ldrh r1, [r1] - bl sub_800FE84 - b _0800FC04 - .pool -_0800FAD0: - ldr r1, =gUnknown_030050E4 - add r1, r8 - movs r0, 0x1 - strb r0, [r1] - b _0800FC04 - .pool -_0800FAE0: - ldr r2, =gUnknown_03005000 - movs r4, 0x80 - lsls r4, 1 - adds r0, r2, r4 - ldr r3, =gUnknown_03003090+0x2 - adds r1, r5, r3 - ldrh r0, [r0] - mov r6, r8 - adds r6, 0x1 - ldrh r1, [r1] - cmp r0, r1 - beq _0800FAFA - b _0800FC08 -_0800FAFA: - adds r0, r2, 0 - adds r0, 0xE9 - add r0, r8 - movs r1, 0x1 - strb r1, [r0] - b _0800FC08 - .pool -_0800FB10: - ldr r7, =gUnknown_03005000 - ldrb r2, [r7, 0xC] - cmp r2, 0 - bne _0800FB78 - ldr r3, =gReceivedRemoteLinkPlayers - ldrb r0, [r3] - mov r6, r8 - adds r6, 0x1 - cmp r0, 0 - beq _0800FC08 - ldr r0, =gUnknown_03003090+0x2 - adds r4, r5, r0 - ldrh r1, [r4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x2] - ands r1, r0 - cmp r1, 0 - beq _0800FB48 - strb r2, [r3] - bl sub_800D630 - ldr r1, =gUnknown_03003090+0x4 - adds r0, r5, r1 - ldrh r1, [r0] - ldr r2, =0x00000ce4 - adds r0, r7, r2 - strb r1, [r0] -_0800FB48: - ldr r0, =gUnknown_03003090 - adds r0, 0x6 - adds r0, r5, r0 - ldrh r0, [r0] - strb r0, [r7, 0xD] - ldrh r0, [r4] - bl sub_80109E8 - b _0800FC08 - .pool -_0800FB78: - movs r0, 0xEE - lsls r0, 8 - bl sub_800FD14 - ldr r1, =gUnknown_03003110 - ldr r3, =gUnknown_03003090+0x2 - adds r0, r5, r3 - ldrh r0, [r0] - strh r0, [r1, 0x2] - ldr r4, =gUnknown_03003090+0x4 - adds r0, r5, r4 - ldrh r0, [r0] - strh r0, [r1, 0x4] - ldr r0, =gUnknown_03003090 - adds r0, 0x6 - adds r0, r5, r0 - ldrh r0, [r0] - strh r0, [r1, 0x6] - b _0800FC04 - .pool -_0800FBB0: - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - mov r6, r8 - adds r6, 0x1 - cmp r0, 0x1 - bne _0800FC44 - ldr r0, =0x00000ce3 - adds r2, r4, r0 - ldr r1, =gUnknown_03003090+0x2 - adds r3, r5, r1 - ldrb r1, [r3] - ldrb r0, [r2] - orrs r0, r1 - strb r0, [r2] - ldr r2, =gUnknown_03003090+0x4 - adds r0, r5, r2 - ldrh r1, [r0] - ldr r2, =0x00000ce4 - adds r0, r4, r2 - strb r1, [r0] - ldrh r0, [r3] - bl sub_80109E8 - b _0800FC08 - .pool -_0800FBF4: - ldr r0, =gUnknown_03003020 - mov r3, r8 - lsls r1, r3, 1 - adds r1, r0 - ldr r4, =gUnknown_03003090+0x2 - adds r0, r5, r4 - ldrh r0, [r0] - strh r0, [r1] -_0800FC04: - mov r6, r8 - adds r6, 0x1 -_0800FC08: - ldr r3, =gUnknown_03005000 - ldrb r4, [r3, 0xC] - cmp r4, 0x1 - bne _0800FC44 - adds r0, r3, 0 - adds r0, 0x61 - mov r1, r8 - adds r2, r1, r0 - ldrb r0, [r2] - adds r1, r0, 0 - cmp r1, 0 - beq _0800FC44 - cmp r1, 0x4 - bne _0800FC40 - adds r0, r3, 0 - adds r0, 0x5C - add r0, r8 - movs r1, 0 - strb r4, [r0] - strb r1, [r2] - b _0800FC44 - .pool -_0800FC40: - adds r0, 0x1 - strb r0, [r2] -_0800FC44: - lsls r0, r6, 16 - lsrs r0, 16 - mov r8, r0 - cmp r0, 0x4 - bhi _0800FC50 - b _0800F87A -_0800FC50: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800F86C - - thumb_func_start sub_800FC60 -sub_800FC60: @ 800FC60 - push {lr} - movs r2, 0 - ldr r0, =gUnknown_03005000 - adds r1, r0, 0 - adds r1, 0x92 -_0800FC6A: - ldrb r0, [r1] - cmp r0, 0 - beq _0800FC78 - movs r0, 0 - b _0800FC82 - .pool -_0800FC78: - adds r1, 0x14 - adds r2, 0x1 - cmp r2, 0x4 - ble _0800FC6A - movs r0, 0x1 -_0800FC82: - pop {r1} - bx r1 - thumb_func_end sub_800FC60 - - thumb_func_start sub_800FC88 -sub_800FC88: @ 800FC88 - push {r4,lr} - movs r1, 0 - ldr r2, =gUnknown_03005000 - ldrb r0, [r2, 0xD] - cmp r1, r0 - bge _0800FCBC - adds r4, r0, 0 - adds r3, r2, 0 - adds r3, 0x92 - adds r2, 0x5C -_0800FC9C: - ldrb r0, [r3] - cmp r0, 0x2 - bne _0800FCAA - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0800FCB4 -_0800FCAA: - movs r0, 0 - b _0800FCBE - .pool -_0800FCB4: - adds r3, 0x14 - adds r1, 0x1 - cmp r1, r4 - blt _0800FC9C -_0800FCBC: - movs r0, 0x1 -_0800FCBE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_800FC88 - - thumb_func_start sub_800FCC4 -sub_800FCC4: @ 800FCC4 - movs r2, 0 - movs r1, 0 - strh r1, [r0] - strh r1, [r0, 0x2] - str r1, [r0, 0x4] - str r1, [r0, 0x8] - strb r2, [r0, 0x10] - strb r2, [r0, 0x11] - strb r2, [r0, 0x12] - bx lr - thumb_func_end sub_800FCC4 - - thumb_func_start sub_800FCD8 -sub_800FCD8: @ 800FCD8 - push {r4,lr} - movs r2, 0 - movs r1, 0 - ldr r0, =gUnknown_03005000 - adds r3, r0, 0 - adds r3, 0x92 - adds r4, r0, 0 - adds r4, 0x5C -_0800FCE8: - ldrb r0, [r3] - cmp r0, 0x2 - bne _0800FCFE - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800FCFE - lsls r0, r1 - orrs r2, r0 - lsls r0, r2, 24 - lsrs r2, r0, 24 -_0800FCFE: - adds r3, 0x14 - adds r1, 0x1 - cmp r1, 0x4 - ble _0800FCE8 - adds r0, r2, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800FCD8 - - thumb_func_start sub_800FD14 -sub_800FD14: @ 800FD14 - push {r4,r5,lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r5, =gUnknown_03003110 - strh r1, [r5] - movs r0, 0xF0 - lsls r0, 7 - adds r4, r5, 0 - cmp r1, r0 - beq _0800FDB0 - cmp r1, r0 - bgt _0800FD62 - movs r0, 0xBE - lsls r0, 7 - cmp r1, r0 - beq _0800FE00 - cmp r1, r0 - bgt _0800FD50 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - beq _0800FE20 - movs r0, 0x88 - lsls r0, 7 - cmp r1, r0 - beq _0800FE14 - b _0800FE46 - .pool -_0800FD50: - movs r0, 0xCC - lsls r0, 7 - cmp r1, r0 - beq _0800FE00 - movs r0, 0xEE - lsls r0, 7 - cmp r1, r0 - beq _0800FDB0 - b _0800FE46 -_0800FD62: - movs r0, 0xBE - lsls r0, 8 - cmp r1, r0 - beq _0800FE40 - cmp r1, r0 - bgt _0800FE46 - movs r0, 0x88 - lsls r0, 8 - cmp r1, r0 - beq _0800FD80 - movs r0, 0xA1 - lsls r0, 8 - cmp r1, r0 - beq _0800FD98 - b _0800FE46 -_0800FD80: - ldr r0, =gUnknown_03005000 - adds r1, r0, 0 - adds r1, 0x6E - ldrh r1, [r1] - strh r1, [r5, 0x2] - adds r0, 0x7D - ldrb r0, [r0] - adds r0, 0x80 - strh r0, [r5, 0x4] - b _0800FE46 - .pool -_0800FD98: - bl sub_800FC60 - lsls r0, 24 - cmp r0, 0 - beq _0800FE46 - ldr r0, =gUnknown_03005000 - adds r0, 0x5A - ldrb r0, [r0] - b _0800FE44 - .pool -_0800FDB0: - ldr r3, =gUnknown_03005000 - ldr r1, =0x00000ce2 - adds r0, r3, r1 - ldr r2, =0x00000ce3 - adds r1, r3, r2 - ldrb r2, [r0] - ldrb r0, [r1] - eors r0, r2 - ldr r1, =gUnknown_082ED695 - adds r0, r1 - ldrb r0, [r0] - adds r0, 0x1 - strb r0, [r3, 0xD] - ldrb r0, [r3, 0xD] - strh r0, [r4, 0x2] - adds r2, r4, 0x4 - movs r4, 0 - ldr r0, =0x00000cde - adds r3, r0 -_0800FDD6: - adds r1, r2, r4 - adds r0, r4, r3 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800FDD6 - b _0800FE46 - .pool -_0800FE00: - ldr r0, =gUnknown_03005000 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r4, 0x2] - b _0800FE46 - .pool -_0800FE14: - strh r1, [r5] - ldr r0, =gMain - ldrh r0, [r0, 0x2C] - b _0800FE44 - .pool -_0800FE20: - movs r4, 0 - ldr r3, =gUnknown_030050F2 -_0800FE24: - adds r2, r4, 0x1 - lsls r1, r2, 1 - adds r1, r5 - lsls r0, r4, 1 - adds r0, r3 - ldrh r0, [r0] - strh r0, [r1] - lsls r2, 24 - lsrs r4, r2, 24 - cmp r4, 0x5 - bls _0800FE24 - b _0800FE46 - .pool -_0800FE40: - ldr r0, =gUnknown_03005DA8 - ldrh r0, [r0] -_0800FE44: - strh r0, [r5, 0x2] -_0800FE46: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800FD14 - - thumb_func_start sub_800FE50 -sub_800FE50: @ 800FE50 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - bne _0800FE76 - bl sub_8011A80 - cmp r0, 0 - bne _0800FE76 - ldr r0, =gUnknown_030050F2 - adds r1, r4, 0 - movs r2, 0xC - bl memcpy - movs r0, 0xBC - lsls r0, 6 - bl sub_800FD14 -_0800FE76: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800FE50 - - thumb_func_start sub_800FE84 -@ bool8 sub_800FE84(u32 a1, u32 size) -sub_800FE84: @ 800FE84 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - adds r6, r1, 0 - ldr r5, =gUnknown_03005000 - ldr r0, [r5] - cmp r0, 0 - bne _0800FEB8 - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - bne _0800FEB8 - movs r0, 0x7C - adds r0, r5 - mov r9, r0 - ldrb r1, [r0] - mov r8, r1 - cmp r1, 0 - beq _0800FEC8 - ldr r1, =gUnknown_02022B44 - adds r1, 0x83 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0800FEB8: - movs r0, 0 - b _0800FF32 - .pool -_0800FEC8: - adds r0, r6, 0 - movs r1, 0xC - bl __umodsi3 - negs r4, r0 - orrs r4, r0 - lsrs r4, 31 - bl GetMultiplayerId - adds r1, r5, 0 - adds r1, 0x7D - strb r0, [r1] - movs r0, 0x1 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - movs r1, 0xC - bl __udivsi3 - adds r0, r4 - adds r1, r5, 0 - adds r1, 0x6E - strh r0, [r1] - adds r0, r5, 0 - adds r0, 0x6C - mov r1, r8 - strh r1, [r0] - movs r0, 0x80 - lsls r0, 1 - cmp r6, r0 - bls _0800FF0A - str r7, [r5, 0x70] - b _0800FF1C -_0800FF0A: - ldr r4, =gUnknown_020228C4 - cmp r7, r4 - beq _0800FF1A - adds r0, r4, 0 - adds r1, r7, 0 - adds r2, r6, 0 - bl memcpy -_0800FF1A: - str r4, [r5, 0x70] -_0800FF1C: - movs r0, 0x88 - lsls r0, 8 - bl sub_800FD14 - ldr r0, =gUnknown_03005000 - ldr r1, =rfufunc_80F9F44 - str r1, [r0] - adds r0, 0x5B - movs r1, 0 - strb r1, [r0] - movs r0, 0x1 -_0800FF32: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800FE84 - - thumb_func_start rfufunc_80F9F44 -rfufunc_80F9F44: @ 800FF4C - push {r4,r5,lr} - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - bne _0800FFA0 - movs r5, 0x88 - lsls r5, 8 - adds r0, r5, 0 - bl sub_800FD14 - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - bne _0800FF84 - adds r1, r4, 0 - adds r1, 0x5B - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _0800FFA0 - b _0800FF9C - .pool -_0800FF84: - bl GetMultiplayerId - ldr r1, =gUnknown_03003090 - lsls r0, 24 - lsrs r0, 20 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - cmp r0, r5 - bne _0800FFA0 -_0800FF9C: - ldr r0, =sub_800FFB0 - str r0, [r4] -_0800FFA0: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end rfufunc_80F9F44 - - thumb_func_start sub_800FFB0 -sub_800FFB0: @ 800FFB0 - push {r4-r6,lr} - ldr r0, =gUnknown_03005000 - mov r12, r0 - ldr r5, [r0, 0x70] - ldr r3, =gUnknown_03003110 - mov r2, r12 - adds r2, 0x6C - ldrh r1, [r2] - movs r4, 0x89 - lsls r4, 8 - adds r0, r4, 0 - orrs r0, r1 - strh r0, [r3] - movs r4, 0 - adds r6, r2, 0 - adds r3, 0x2 -_0800FFD0: - lsls r2, r4, 1 - ldrh r1, [r6] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, r5 - ldrb r1, [r0, 0x1] - lsls r1, 8 - ldrb r0, [r0] - orrs r0, r1 - strh r0, [r3] - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x6 - ble _0800FFD0 - mov r0, r12 - adds r0, 0x6C - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - adds r0, 0x2 - ldrh r0, [r0] - lsls r1, 16 - lsrs r1, 16 - cmp r0, r1 - bhi _08010014 - mov r0, r12 - adds r0, 0x7C - movs r1, 0 - strb r1, [r0] - ldr r0, =rfufunc_80FA020 - mov r1, r12 - str r0, [r1] -_08010014: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800FFB0 - - thumb_func_start rfufunc_80FA020 -rfufunc_80FA020: @ 8010028 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r5, =gUnknown_03005000 - ldr r0, [r5, 0x70] - mov r8, r0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _080100F0 - ldr r3, =gUnknown_03003110 - adds r2, r5, 0 - adds r2, 0x6E - ldrh r0, [r2] - subs r0, 0x1 - ldr r4, =0xffff8900 - adds r1, r4, 0 - orrs r0, r1 - strh r0, [r3] - movs r4, 0 - mov r9, r5 - ldr r0, =gUnknown_03003090 - mov r12, r0 - lsls r5, r6, 4 - adds r7, r2, 0 - adds r3, 0x2 -_08010064: - lsls r2, r4, 1 - ldrh r1, [r7] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - add r0, r8 - adds r1, r0, 0 - subs r1, 0xB - ldrb r1, [r1] - lsls r1, 8 - subs r0, 0xC - ldrb r0, [r0] - orrs r0, r1 - strh r0, [r3] - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x6 - ble _08010064 - mov r1, r12 - adds r0, r5, r1 - ldrb r1, [r0] - mov r3, r9 - adds r0, r3, 0 - adds r0, 0x6E - ldrh r0, [r0] - subs r0, 0x1 - cmp r1, r0 - bne _080100F4 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 2 - adds r1, r3, 0 - adds r1, 0x88 - adds r1, r0, r1 - ldr r2, =gUnknown_082ED628 - adds r0, r3 - adds r0, 0x82 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r2 - ldr r1, [r1] - ldr r0, [r0] - cmp r1, r0 - beq _080100E8 - adds r0, r6, 0 - bl sub_800F638 - ldr r1, =gUnknown_02022B44 - adds r1, 0x64 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _080100F4 - .pool -_080100E8: - movs r0, 0 - mov r4, r9 - str r0, [r4] - b _080100F4 -_080100F0: - movs r0, 0 - str r0, [r5] -_080100F4: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end rfufunc_80FA020 - - thumb_func_start sub_8010100 -sub_8010100: @ 8010100 - push {lr} - ldr r1, =gUnknown_03005000 - adds r1, 0x5A - strb r0, [r1] - movs r0, 0xA1 - lsls r0, 8 - bl sub_800FD14 - movs r0, 0x1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8010100 - - thumb_func_start sub_801011C -sub_801011C: @ 801011C - push {lr} - bl rfu_clearAllSlot - bl sub_800C048 - ldr r1, =gReceivedRemoteLinkPlayers - movs r0, 0 - strb r0, [r1] - ldr r2, =gUnknown_03005000 - adds r3, r2, 0 - adds r3, 0xEF - movs r1, 0 - movs r0, 0x1 - strb r0, [r3] - str r1, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_801011C - - thumb_func_start sub_8010148 -sub_8010148: @ 8010148 - push {lr} - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - bl sub_801011C - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010148 - - thumb_func_start sub_8010168 -sub_8010168: @ 8010168 - push {r4,lr} - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0 - bne _08010188 - bl sub_800D630 - ldr r0, =0x00000ce4 - adds r1, r4, r0 - movs r0, 0x2 - strb r0, [r1] - b _0801018C - .pool -_08010188: - ldr r0, =sub_8010148 - str r0, [r4] -_0801018C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010168 - - thumb_func_start sub_8010198 -sub_8010198: @ 8010198 - push {lr} - bl sub_800D630 - ldr r2, =gUnknown_03005000 - ldr r0, =0x00000ce4 - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =gUnknown_03007890 - ldr r1, [r0] - ldrb r0, [r1, 0x2] - ldrb r1, [r1, 0x3] - orrs r0, r1 - ldr r1, =0x00000ce3 - adds r2, r1 - strb r0, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010198 - - thumb_func_start sub_80101CC -sub_80101CC: @ 80101CC - push {r4,r5,lr} - ldr r0, =gUnknown_03005000 - ldrb r5, [r0, 0xD] - movs r2, 0 - movs r1, 0 - adds r3, r0, 0 - adds r4, r3, 0 - adds r4, 0xE4 -_080101DC: - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _080101E6 - adds r2, 0x1 -_080101E6: - adds r1, 0x1 - cmp r1, 0x4 - ble _080101DC - cmp r2, r5 - bne _08010220 - ldr r2, =gBattleTypeFlags - ldr r0, [r2] - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - str r0, [r2] - ldrb r0, [r3, 0xC] - cmp r0, 0 - bne _0801021C - adds r0, r3, 0 - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0x3 - strb r1, [r0] - bl sub_8010168 - b _08010220 - .pool -_0801021C: - ldr r0, =sub_8010168 - str r0, [r3] -_08010220: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80101CC - - thumb_func_start sub_801022C -sub_801022C: @ 801022C - push {r4,lr} - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - bne _0801024E - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ce8 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0801024E - movs r0, 0xBE - lsls r0, 7 - bl sub_800FD14 - ldr r0, =sub_80101CC - str r0, [r4] -_0801024E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801022C - - thumb_func_start sub_8010264 -sub_8010264: @ 8010264 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r2, =gUnknown_03005000 - ldr r0, [r2] - cmp r0, 0 - bne _08010284 - ldr r1, =0x00000cd9 - adds r0, r2, r1 - movs r1, 0x1 - strb r1, [r0] - ldr r0, =sub_801022C - str r0, [r2] - adds r0, r3, 0 - bl DestroyTask -_08010284: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010264 - - thumb_func_start task_add_05_task_del_08FA224_when_no_RfuFunc -task_add_05_task_del_08FA224_when_no_RfuFunc: @ 8010294 - push {r4,lr} - ldr r4, =sub_8010264 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080102AC - adds r0, r4, 0 - movs r1, 0x5 - bl CreateTask -_080102AC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_add_05_task_del_08FA224_when_no_RfuFunc - - thumb_func_start sub_80102B8 -sub_80102B8: @ 80102B8 - push {r4,r5,lr} - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _080102E6 - ldr r1, =gUnknown_03005000 - ldr r2, =0x000009e6 - adds r0, r1, r2 - ldrb r0, [r0] - adds r4, r0, 0 - cmp r4, 0 - bne _080102E6 - adds r5, r1, 0 - adds r5, 0xFE - ldrh r0, [r5] - cmp r0, 0x3C - bls _080102E6 - movs r0, 0xCC - lsls r0, 7 - bl sub_800FD14 - strh r4, [r5] -_080102E6: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - cmp r1, r2 - bcs _08010312 - ldr r0, =gUnknown_03005000 - adds r3, r0, 0 - adds r3, 0xE9 - ldrb r0, [r3] - cmp r0, 0 - beq _08010312 -_08010300: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r2 - bcs _08010312 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _08010300 -_08010312: - ldr r4, =gUnknown_03005000 - cmp r1, r2 - bne _0801033E - movs r1, 0 - adds r3, r4, 0 - adds r3, 0xE9 - movs r2, 0 -_08010320: - adds r0, r1, r3 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x4 - bls _08010320 - movs r1, 0x80 - lsls r1, 1 - adds r0, r4, r1 - ldrh r1, [r0] - adds r1, 0x1 - movs r2, 0 - strh r1, [r0] - str r2, [r4] -_0801033E: - adds r1, r4, 0 - adds r1, 0xFE - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80102B8 - - thumb_func_start sub_8010358 -sub_8010358: @ 8010358 - push {r4,lr} - ldr r4, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0801037A - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - bne _0801037A - movs r0, 0xCC - lsls r0, 7 - bl sub_800FD14 - ldr r0, =sub_80102B8 - str r0, [r4] -_0801037A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010358 - - thumb_func_start sub_8010390 -sub_8010390: @ 8010390 - push {r4,lr} - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _080103CC - ldr r4, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0801041E - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - bne _0801041E - movs r0, 0xCC - lsls r0, 7 - bl sub_800FD14 - ldr r0, =sub_80102B8 - b _0801041C - .pool -_080103CC: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0x1 - cmp r1, r2 - bcs _080103FA - ldr r3, =gUnknown_03005000 - adds r0, r3, 0 - adds r0, 0xEA - ldrb r0, [r0] - cmp r0, 0 - beq _080103FA - adds r3, 0xE9 -_080103E8: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r2 - bcs _080103FA - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _080103E8 -_080103FA: - cmp r1, r2 - bne _0801041E - ldr r4, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0801041E - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - bne _0801041E - movs r0, 0xCC - lsls r0, 7 - bl sub_800FD14 - ldr r0, =sub_8010358 -_0801041C: - str r0, [r4] -_0801041E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010390 - - thumb_func_start sub_8010434 -sub_8010434: @ 8010434 - push {lr} - ldr r1, =gUnknown_03005000 - ldr r2, [r1] - cmp r2, 0 - bne _08010448 - ldr r0, =sub_8010390 - str r0, [r1] - adds r0, r1, 0 - adds r0, 0xFE - strh r2, [r0] -_08010448: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010434 - - thumb_func_start sub_8010454 -sub_8010454: @ 8010454 - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gUnknown_082ED6E0 - ldrh r0, [r1] - cmp r0, r3 - beq _08010482 - ldr r4, =0x0000ffff - adds r2, r1, 0 -_08010464: - ldrh r0, [r2] - cmp r0, r4 - bne _08010478 - movs r0, 0 - b _08010484 - .pool -_08010478: - adds r1, 0x2 - adds r2, 0x2 - ldrh r0, [r1] - cmp r0, r3 - bne _08010464 -_08010482: - movs r0, 0x1 -_08010484: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8010454 - - thumb_func_start sub_801048C -sub_801048C: @ 801048C - push {lr} - cmp r0, 0 - beq _080104A0 - movs r1, 0x96 - lsls r1, 2 - movs r0, 0x1 - bl sub_800D550 - movs r0, 0 - b _080104AC -_080104A0: - movs r0, 0 - movs r1, 0 - bl sub_800D550 - lsls r0, 24 - lsrs r0, 24 -_080104AC: - pop {r1} - bx r1 - thumb_func_end sub_801048C - - thumb_func_start sub_80104B0 -sub_80104B0: @ 80104B0 - push {lr} - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cd9 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - movs r0, 0 - bl sub_800C27C - pop {r0} - bx r0 - .pool - thumb_func_end sub_80104B0 - - thumb_func_start rfu_get_multiplayer_id -rfu_get_multiplayer_id: @ 80104D0 - push {lr} - ldr r1, =gUnknown_03005000 - ldrb r0, [r1, 0xC] - cmp r0, 0x1 - beq _080104EC - ldr r2, =0x00000cce - adds r0, r1, r2 - ldrb r0, [r0] - b _080104EE - .pool -_080104EC: - movs r0, 0 -_080104EE: - pop {r1} - bx r1 - thumb_func_end rfu_get_multiplayer_id - - thumb_func_start sub_80104F4 -sub_80104F4: @ 80104F4 - ldr r0, =gUnknown_03005000 - ldrb r0, [r0, 0xD] - bx lr - .pool - thumb_func_end sub_80104F4 - - thumb_func_start sub_8010500 -sub_8010500: @ 8010500 - push {lr} - ldr r2, =gUnknown_03005000 - adds r0, r2, 0 - adds r0, 0xF1 - ldrb r0, [r0] - cmp r0, 0x2 - bne _08010518 - movs r0, 0 - b _08010524 - .pool -_08010518: - movs r1, 0 - ldr r0, [r2] - cmp r0, 0 - bne _08010522 - movs r1, 0x1 -_08010522: - adds r0, r1, 0 -_08010524: - pop {r1} - bx r1 - thumb_func_end sub_8010500 - - thumb_func_start sub_8010528 -sub_8010528: @ 8010528 - push {lr} - ldr r0, =gUnknown_03005000 - ldr r0, [r0] - cmp r0, 0 - beq _08010536 - bl _call_via_r0 -_08010536: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010528 - - thumb_func_start sub_8010540 -sub_8010540: @ 8010540 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r7, 0 - movs r5, 0 - ldr r6, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r0, r6 - mov r8, r0 -_08010552: - ldr r1, =0x00000cd1 - adds r0, r6, r1 - adds r4, r5, r0 - ldrb r0, [r4] - subs r0, 0x5 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _080105DA - ldr r1, =gUnknown_03007880 - lsls r0, r5, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x46 - beq _08010576 - cmp r0, 0x48 - bne _080105C0 -_08010576: - ldr r2, =0x00000cd5 - adds r0, r6, r2 - adds r1, r5, r0 - ldrb r0, [r1] - cmp r0, 0x8 - bne _080105DA - movs r0, 0x9 - strb r0, [r4] - movs r0, 0xA - strb r0, [r1] - lsls r1, r5, 24 - lsrs r1, 24 - movs r0, 0x8 - bl rfu_clearSlot - movs r0, 0x80 - lsls r0, 17 - lsls r0, r5 - lsrs r0, 24 - movs r1, 0x8 - adds r2, r4, 0 - movs r3, 0x1 - bl rfu_NI_setSendData - movs r7, 0x1 - b _080105DA - .pool -_080105C0: - mov r2, r8 - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x47 - bne _080105DA - lsls r1, r5, 24 - lsrs r1, 24 - movs r0, 0x8 - bl rfu_clearSlot -_080105DA: - adds r5, 0x1 - cmp r5, 0x3 - ble _08010552 - adds r0, r7, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8010540 - - thumb_func_start sub_80105EC -sub_80105EC: @ 80105EC - push {r4-r6,lr} - movs r3, 0 - movs r1, 0 - ldr r5, =gUnknown_03005CD5 - movs r6, 0x1 - movs r4, 0 -_080105F8: - adds r2, r1, r5 - ldrb r0, [r2] - cmp r0, 0xB - bne _0801060C - adds r0, r6, 0 - lsls r0, r1 - orrs r3, r0 - lsls r0, r3, 24 - lsrs r3, r0, 24 - strb r4, [r2] -_0801060C: - adds r1, 0x1 - cmp r1, 0x3 - ble _080105F8 - cmp r3, 0 - beq _08010620 - adds r0, r3, 0 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete -_08010620: - movs r1, 0 - ldr r2, =gUnknown_03005CD5 -_08010624: - adds r0, r1, r2 - ldrb r0, [r0] - subs r0, 0xA - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0801063C - movs r0, 0x1 - b _08010644 - .pool -_0801063C: - adds r1, 0x1 - cmp r1, 0x3 - ble _08010624 - movs r0, 0 -_08010644: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80105EC - - thumb_func_start sub_801064C -sub_801064C: @ 801064C - push {lr} - adds r2, r0, 0 - adds r0, r1, 0 - lsls r2, 16 - lsrs r2, 16 - adds r1, r2, 0 - bl sub_8011CE4 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - beq _08010680 - ldr r0, =gUnknown_03005000 - ldr r2, =0x00000cd1 - adds r0, r2 - adds r0, r1, r0 - ldrb r0, [r0] - cmp r0, 0x9 - beq _08010680 - movs r0, 0 - b _08010682 - .pool -_08010680: - movs r0, 0x1 -_08010682: - pop {r1} - bx r1 - thumb_func_end sub_801064C - - thumb_func_start sub_8010688 -sub_8010688: @ 8010688 - push {r4-r6,lr} - adds r6, r0, 0 - adds r0, r2, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 16 - lsrs r1, 16 - bl sub_8011CE4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_03005000 - ldr r0, =0x00000cd1 - adds r5, r0 - adds r5, r4, r5 - strb r6, [r5] - movs r0, 0x4 - adds r1, r4, 0 - bl rfu_clearSlot - movs r0, 0x80 - lsls r0, 17 - lsls r0, r4 - lsrs r0, 24 - movs r1, 0x8 - adds r2, r5, 0 - movs r3, 0x1 - bl rfu_NI_setSendData - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010688 - - thumb_func_start sub_80106D4 -sub_80106D4: @ 80106D4 - push {r4,r5,lr} - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000c85 - adds r5, r4, r0 - movs r0, 0x8 - strb r0, [r5] - ldr r0, =0x00000c3e - adds r4, r0 - ldrb r1, [r4] - movs r0, 0x4 - bl rfu_clearSlot - ldrb r1, [r4] - movs r0, 0x80 - lsls r0, 17 - lsls r0, r1 - lsrs r0, 24 - movs r1, 0x8 - adds r2, r5, 0 - movs r3, 0x1 - bl rfu_NI_setSendData - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80106D4 - - thumb_func_start sub_8010714 -sub_8010714: @ 8010714 - push {lr} - adds r2, r0, 0 - adds r0, r1, 0 - lsls r2, 16 - lsrs r2, 16 - adds r1, r2, 0 - bl sub_8011CE4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _08010730 - movs r0, 0x2 - b _0801074A -_08010730: - ldr r1, =gUnknown_03007880 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0 - beq _08010748 - movs r0, 0 - b _0801074A - .pool -_08010748: - movs r0, 0x1 -_0801074A: - pop {r1} - bx r1 - thumb_func_end sub_8010714 - - thumb_func_start sub_8010750 -sub_8010750: @ 8010750 - push {r4,r5,lr} - bl sub_8010540 - movs r4, 0 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cd5 - adds r5, r0, r1 -_0801075E: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - subs r0, 0x26 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bhi _08010788 - adds r1, r4, r5 - ldrb r0, [r1] - cmp r0, 0xA - bne _0801077E - movs r0, 0xB - strb r0, [r1] -_0801077E: - lsls r1, r4, 24 - lsrs r1, 24 - movs r0, 0x4 - bl rfu_clearSlot -_08010788: - adds r4, 0x1 - cmp r4, 0x3 - ble _0801075E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010750 - - thumb_func_start sub_80107A0 -sub_80107A0: @ 80107A0 - push {r4,r5,lr} - movs r4, 0 - ldr r1, =gUnknown_03005000 - ldr r2, =0x00000c85 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x8 - bne _080107DA - ldr r2, =gUnknown_03007880 - ldr r0, =0x00000c3e - adds r1, r0 - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x26 - beq _080107D2 - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x27 - bne _080107DA -_080107D2: - ldrb r1, [r1] - movs r0, 0x4 - bl rfu_clearSlot -_080107DA: - ldr r2, =gUnknown_03007880 - ldr r5, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r1, r5, r0 - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x46 - beq _080107FE - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x48 - bne _0801082C -_080107FE: - ldrb r1, [r1] - movs r0, 0x8 - bl rfu_clearSlot - ldr r2, =0x00000c86 - adds r4, r5, r2 - ldrb r0, [r4] - movs r1, 0 - bl sub_8011A64 - ldrb r4, [r4] - b _08010844 - .pool -_0801082C: - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x47 - bne _08010844 - ldrb r1, [r1] - movs r0, 0x8 - bl rfu_clearSlot - movs r4, 0x6 -_08010844: - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80107A0 - - thumb_func_start sub_801084C -sub_801084C: @ 801084C - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r5, =gUnknown_03005000 - adds r0, r5, 0 - adds r0, 0xF1 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08010872 - ldr r0, =0x00000ce8 - adds r1, r5, r0 - movs r0, 0 - strb r0, [r1] - adds r0, r6, 0 - bl DestroyTask -_08010872: - ldr r2, =gTasks - lsls r1, r6, 2 - adds r0, r1, r6 - lsls r0, 3 - adds r4, r0, r2 - movs r2, 0x8 - ldrsh r0, [r4, r2] - adds r7, r1, 0 - cmp r0, 0x3 - beq _0801091C - cmp r0, 0x3 - bgt _080108A4 - cmp r0, 0x1 - beq _080108CC - cmp r0, 0x1 - bgt _08010918 - cmp r0, 0 - beq _080108B6 - b _080109D2 - .pool -_080108A4: - cmp r0, 0x5 - beq _08010950 - cmp r0, 0x5 - blt _0801093E - cmp r0, 0x6 - beq _08010984 - cmp r0, 0x65 - beq _08010904 - b _080109D2 -_080108B6: - bl sub_800FC60 - lsls r0, 24 - cmp r0, 0 - bne _080108C2 - b _080109D2 -_080108C2: - bl ResetBlockReceivedFlags - bl sub_800B348 - b _08010948 -_080108CC: - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - bne _0801090C - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080108E8 - movs r0, 0xF0 - lsls r0, 7 - bl sub_800FD14 - b _080108F0 - .pool -_080108E8: - movs r0, 0xEE - lsls r0, 7 - bl sub_800FD14 -_080108F0: - ldr r0, =gTasks - adds r1, r7, r6 - lsls r1, 3 - adds r1, r0 - movs r0, 0x65 - strh r0, [r1, 0x8] - b _080109D2 - .pool -_08010904: - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - bne _080109D2 -_0801090C: - movs r0, 0x2 - strh r0, [r4, 0x8] - b _080109D2 - .pool -_08010918: - ldrb r0, [r5, 0xD] - b _08010944 -_0801091C: - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - bne _08010948 - bl sub_800FC60 - lsls r0, 24 - cmp r0, 0 - beq _080109D2 - adds r1, r5, 0 - adds r1, 0x5A - movs r0, 0 - strb r0, [r1] - movs r0, 0xA1 - lsls r0, 8 - bl sub_800FD14 - b _08010948 -_0801093E: - bl sub_800FC88 - lsls r0, 24 -_08010944: - cmp r0, 0 - beq _080109D2 -_08010948: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080109D2 -_08010950: - movs r4, 0 - ldrb r0, [r5, 0xD] - cmp r4, r0 - bge _0801096E -_08010958: - adds r0, r4, 0 - bl sub_800B3A4 - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_800F728 - adds r4, 0x1 - ldrb r2, [r5, 0xD] - cmp r4, r2 - blt _08010958 -_0801096E: - ldr r0, =gTasks - adds r1, r7, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080109D2 - .pool -_08010984: - adds r0, r6, 0 - bl DestroyTask - ldr r1, =gReceivedRemoteLinkPlayers - movs r0, 0x1 - strb r0, [r1] - ldr r0, =0x00000ce8 - adds r1, r5, r0 - movs r0, 0 - strb r0, [r1] - movs r1, 0x96 - lsls r1, 2 - movs r0, 0x1 - bl sub_800D550 - ldr r2, =0x00000ce6 - adds r1, r5, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _080109D2 - movs r4, 0 - adds r2, r1, 0 - movs r3, 0x1 - ldr r0, =0x00000ce5 - adds r5, r0 -_080109B6: - ldrb r0, [r2] - asrs r0, r4 - ands r0, r3 - cmp r0, 0 - beq _080109CC - adds r0, r3, 0 - lsls r0, r4 - strb r0, [r5] - ldrb r1, [r2] - eors r0, r1 - strb r0, [r2] -_080109CC: - adds r4, 0x1 - cmp r4, 0x3 - ble _080109B6 -_080109D2: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801084C - - thumb_func_start sub_80109E8 -sub_80109E8: @ 80109E8 - push {r4,r5,lr} - lsls r0, 16 - lsrs r2, r0, 16 - movs r1, 0 - movs r5, 0x1 - ldr r4, =gUnknown_03005CDE - movs r3, 0 -_080109F6: - adds r0, r2, 0 - asrs r0, r1 - ands r0, r5 - cmp r0, 0 - beq _08010A04 - adds r0, r1, r4 - strb r3, [r0] -_08010A04: - adds r1, 0x1 - cmp r1, 0x3 - ble _080109F6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80109E8 - - thumb_func_start sub_8010A14 -sub_8010A14: @ 8010A14 - push {r4-r7,lr} - adds r2, r0, 0 - ldr r1, =gUnknown_03005000 - ldrb r0, [r2, 0xF] - strb r0, [r1, 0xD] - movs r4, 0 - ldr r0, =0x00000cde - adds r5, r1, r0 - adds r3, r2, 0 - adds r3, 0x10 -_08010A28: - adds r0, r4, r5 - adds r1, r3, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x3 - ble _08010A28 - adds r6, r2, 0 - ldr r5, =gLinkPlayers - movs r4, 0x4 -_08010A3C: - adds r0, r5, 0 - adds r1, r6, 0 - adds r1, 0x14 - ldm r1!, {r2,r3,r7} - stm r0!, {r2,r3,r7} - ldm r1!, {r2,r3,r7} - stm r0!, {r2,r3,r7} - ldr r1, [r1] - str r1, [r0] - adds r0, r5, 0 - bl sub_800B524 - adds r6, 0x1C - adds r5, 0x1C - subs r4, 0x1 - cmp r4, 0 - bge _08010A3C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010A14 - - thumb_func_start sub_8010A70 -sub_8010A70: @ 8010A70 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldr r0, =gUnknown_082ED7EC - adds r1, r4, 0 - bl strcmp - adds r5, r0, 0 - cmp r5, 0 - bne _08010A9C - adds r0, r4, 0 - bl sub_8010A14 - mov r0, sp - strh r5, [r0] - ldr r2, =0x0100007e - adds r1, r4, 0 - bl CpuSet - movs r0, 0 - bl ResetBlockReceivedFlag -_08010A9C: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010A70 - - thumb_func_start sub_8010AAC -sub_8010AAC: @ 8010AAC - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r3, =gUnknown_03005000 - ldr r2, =gUnknown_082ED68C - ldr r1, =0x00000ce9 - adds r0, r3, r1 - ldrb r1, [r0] - adds r1, r2 - ldr r2, =0x00000cde - adds r0, r3, r2 - ldrb r1, [r1] - adds r0, r1 - ldrb r4, [r0] - adds r0, r3, 0 - adds r0, 0xF1 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08010AE8 - ldr r5, =0x00000ce8 - adds r1, r3, r5 - movs r0, 0 - strb r0, [r1] - adds r0, r6, 0 - bl DestroyTask -_08010AE8: - ldr r0, =gTasks - lsls r2, r6, 2 - adds r1, r2, r6 - lsls r1, 3 - adds r1, r0 - movs r3, 0x8 - ldrsh r1, [r1, r3] - adds r3, r0, 0 - adds r7, r2, 0 - cmp r1, 0x5 - bls _08010B00 - b _08010CF0 -_08010B00: - lsls r0, r1, 2 - ldr r1, =_08010B28 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08010B28: - .4byte _08010B40 - .4byte _08010B60 - .4byte _08010B78 - .4byte _08010BC0 - .4byte _08010C0A - .4byte _08010C94 -_08010B40: - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - beq _08010B4A - b _08010CF0 -_08010B4A: - adds r0, r4, 0 - bl ResetBlockReceivedFlag - movs r0, 0xF0 - lsls r0, 7 - bl sub_800FD14 - b _08010C4A - .pool -_08010B60: - ldr r0, =gUnknown_03003110 - ldrh r0, [r0] - cmp r0, 0 - beq _08010B6A - b _08010CF0 -_08010B6A: - adds r1, r7, r6 - lsls r1, 3 - adds r1, r3 - b _08010C52 - .pool -_08010B78: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - asrs r0, r4 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08010B8C - b _08010CF0 -_08010B8C: - adds r0, r4, 0 - bl ResetBlockReceivedFlag - lsls r2, r4, 8 - ldr r0, =gBlockRecvBuffer - adds r2, r0 - ldr r1, =gLinkPlayers - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r0, r1 - adds r1, r0, 0 - adds r2, 0x10 - ldm r2!, {r3-r5} - stm r1!, {r3-r5} - ldm r2!, {r3-r5} - stm r1!, {r3-r5} - ldr r2, [r2] - str r2, [r1] - bl sub_800B524 - b _08010C4A - .pool -_08010BC0: - ldr r5, =gUnknown_020228C4 - adds r1, r5, 0 - ldr r0, =gUnknown_082ED7EC - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldrh r2, [r0] - strh r2, [r1] - ldrb r0, [r0, 0x2] - strb r0, [r1, 0x2] - ldr r1, =gUnknown_03005000 - ldrb r0, [r1, 0xD] - strb r0, [r5, 0xF] - movs r2, 0 - adds r4, r5, 0 - adds r4, 0x10 - ldr r0, =0x00000cde - adds r3, r1, r0 -_08010BE2: - adds r0, r4, r2 - adds r1, r2, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x3 - ble _08010BE2 - ldr r1, =gLinkPlayers - adds r0, r5, 0 - adds r0, 0x14 - movs r2, 0x8C - bl memcpy - ldr r0, =gTasks - adds r1, r7, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_08010C0A: - ldr r5, =gUnknown_020228C4 - ldr r1, =gUnknown_03005000 - ldrb r0, [r1, 0xD] - strb r0, [r5, 0xF] - movs r2, 0 - ldr r3, =gLinkPlayers - mov r12, r3 - adds r4, r5, 0 - adds r4, 0x10 - ldr r0, =0x00000cde - adds r3, r1, r0 -_08010C20: - adds r0, r4, r2 - adds r1, r2, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x3 - ble _08010C20 - adds r0, r5, 0 - adds r0, 0x14 - mov r1, r12 - movs r2, 0x8C - bl memcpy - ldr r1, =gUnknown_020228C4 - movs r0, 0 - movs r2, 0xA0 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _08010CF0 -_08010C4A: - ldr r0, =gTasks - adds r1, r7, r6 - lsls r1, 3 - adds r1, r0 -_08010C52: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _08010CF0 - .pool -_08010C74: - adds r0, r3, 0 - lsls r0, r2 - ldr r2, =0x00000ce5 - adds r1, r5, r2 - strb r0, [r1] - ldrb r1, [r4] - eors r0, r1 - strb r0, [r4] - ldr r4, =0x00000ce8 - adds r0, r5, r4 - strb r3, [r0] - b _08010CEA - .pool -_08010C94: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08010CF0 - bl GetBlockReceivedStatus - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - beq _08010CF0 - mov r0, sp - movs r4, 0 - strh r4, [r0] - ldr r1, =gBlockRecvBuffer - ldr r2, =0x0100007e - bl CpuSet - movs r0, 0 - bl ResetBlockReceivedFlag - ldr r1, =gUnknown_03005000 - ldr r5, =0x00000ce8 - adds r0, r1, r5 - strb r4, [r0] - ldr r0, =0x00000ce6 - adds r3, r1, r0 - ldrb r0, [r3] - cmp r0, 0 - beq _08010CEA - movs r2, 0 - adds r5, r1, 0 - adds r4, r3, 0 - ldrb r1, [r4] - movs r3, 0x1 -_08010CDA: - adds r0, r1, 0 - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - bne _08010C74 - adds r2, 0x1 - cmp r2, 0x3 - ble _08010CDA -_08010CEA: - adds r0, r6, 0 - bl DestroyTask -_08010CF0: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010AAC - - thumb_func_start sub_8010D0C -sub_8010D0C: @ 8010D0C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gUnknown_03005000 - adds r0, r6, 0 - adds r0, 0xF1 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08010D2A - adds r0, r5, 0 - bl DestroyTask -_08010D2A: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08010D70 - cmp r0, 0x1 - bgt _08010D50 - cmp r0, 0 - beq _08010D56 - b _08010DA6 - .pool -_08010D50: - cmp r0, 0x2 - beq _08010D82 - b _08010DA6 -_08010D56: - ldrb r0, [r6, 0xD] - cmp r0, 0 - beq _08010DA6 - bl sub_800B348 - ldr r1, =gUnknown_020228C4 - movs r0, 0 - movs r2, 0x3C - bl SendBlock - b _08010D7A - .pool -_08010D70: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08010DA6 -_08010D7A: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _08010DA6 -_08010D82: - bl GetBlockReceivedStatus - movs r4, 0x1 - adds r1, r4, 0 - ands r1, r0 - cmp r1, 0 - beq _08010DA6 - ldr r0, =gBlockRecvBuffer - bl sub_8010A14 - movs r0, 0 - bl ResetBlockReceivedFlag - ldr r0, =gReceivedRemoteLinkPlayers - strb r4, [r0] - adds r0, r5, 0 - bl DestroyTask -_08010DA6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010D0C - - thumb_func_start sub_8010DB4 -sub_8010DB4: @ 8010DB4 - push {r4-r7,lr} - ldr r0, =gUnknown_03005000 - adds r1, r0, 0 - adds r1, 0xEE - ldrb r1, [r1] - adds r3, r0, 0 - cmp r1, 0x1 - bne _08010E5C - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x2] - cmp r0, 0 - bne _08010E5C - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =sub_8018438 - cmp r1, r0 - beq _08010DDE - ldr r0, [r2, 0x3C] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _08010DE4 -_08010DDE: - ldr r1, =gLinkVSyncDisabled - movs r0, 0x2 - strb r0, [r1] -_08010DE4: - ldr r4, =c2_800ACD4 - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =gMain - str r4, [r0, 0x8] - ldr r5, =gUnknown_03005000 - ldrh r0, [r5, 0xA] - lsls r4, r0, 16 - ldrh r0, [r5, 0x10] - lsls r0, 8 - orrs r4, r0 - ldrh r0, [r5, 0x12] - orrs r4, r0 - ldr r1, =0x000009e6 - adds r0, r5, r1 - ldrb r0, [r0] - adds r7, r0, 0 - ldr r1, =0x00000c1a - adds r0, r5, r1 - ldrb r0, [r0] - adds r6, r0, 0 - bl sub_8011A74 - movs r3, 0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _08010E20 - movs r3, 0x1 -_08010E20: - adds r0, r4, 0 - adds r1, r7, 0 - adds r2, r6, 0 - bl sub_800AF18 - adds r0, r5, 0 - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0x2 - strb r1, [r0] - bl sub_80097E8 - b _08010E8E - .pool -_08010E5C: - ldr r1, =0x00000c1b - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08010E70 - ldr r1, =0x000009e7 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08010E8E -_08010E70: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x2] - cmp r0, 0 - beq _08010E7C - bl sub_800D630 -_08010E7C: - movs r4, 0xE0 - lsls r4, 7 - movs r0, 0x1 - adds r1, r4, 0 - bl sub_8011A64 - adds r0, r4, 0 - bl sub_8011170 -_08010E8E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010DB4 - - thumb_func_start rfu_REQ_recvData_then_sendData -rfu_REQ_recvData_then_sendData: @ 8010EA0 - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x6] - cmp r0, 0x1 - bne _08010EB8 - bl rfu_REQ_recvData - bl rfu_waitREQComplete - movs r0, 0 - bl rfu_REQ_sendData_wrapper -_08010EB8: - pop {r0} - bx r0 - .pool - thumb_func_end rfu_REQ_recvData_then_sendData - - thumb_func_start sub_8010EC0 -sub_8010EC0: @ 8010EC0 - push {r4,r5,lr} - movs r5, 0 - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ccd - adds r0, r4, r1 - strb r5, [r0] - bl Random2 - lsls r0, 16 - lsrs r0, 16 - bl sub_800C54C - adds r0, r4, 0 - adds r0, 0xEF - ldrb r0, [r0] - cmp r0, 0 - bne _08010F14 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - beq _08010F02 - cmp r0, 0x1 - bgt _08010EFC - cmp r0, 0 - beq _08010F08 - b _08010F14 - .pool -_08010EFC: - cmp r0, 0x2 - beq _08010F10 - b _08010F14 -_08010F02: - bl sub_800F0F8 - b _08010F14 -_08010F08: - bl sub_800F4F0 - adds r5, r0, 0 - b _08010F14 -_08010F10: - bl rfu_REQ_recvData_then_sendData -_08010F14: - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8010EC0 - - thumb_func_start sub_8010F1C -sub_8010F1C: @ 8010F1C - push {r4,lr} - movs r4, 0 - ldr r1, =gUnknown_03005000 - adds r0, r1, 0 - adds r0, 0xEF - ldrb r0, [r0] - cmp r0, 0 - bne _08010F3C - ldrb r0, [r1, 0xC] - cmp r0, 0x1 - bne _08010F38 - bl sub_800F1E0 - adds r4, r0, 0 -_08010F38: - bl sub_8010DB4 -_08010F3C: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8010F1C - - thumb_func_start sub_8010F48 -sub_8010F48: @ 8010F48 - push {lr} - ldr r0, =gUnknown_02022B22 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F48 - - thumb_func_start sub_8010F60 -sub_8010F60: @ 8010F60 - push {r4,lr} - ldr r4, =gUnknown_02022B14 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0xD - bl memset - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_800DD94 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F60 - - thumb_func_start sub_8010F84 -sub_8010F84: @ 8010F84 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_02022B14 - adds r1, r4, 0 - bl sub_800DD94 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F84 - - thumb_func_start sub_8010FA0 -sub_8010FA0: @ 8010FA0 - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - movs r4, 0x1 - ands r0, r4 - lsls r0, 4 - ldrb r3, [r5] - movs r2, 0x11 - negs r2, r2 - ands r2, r3 - orrs r2, r0 - ands r1, r4 - lsls r1, 5 - movs r0, 0x21 - negs r0, r0 - ands r2, r0 - orrs r2, r1 - strb r2, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010FA0 - - thumb_func_start sub_8010FCC -sub_8010FCC: @ 8010FCC - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - lsls r0, 2 - ldrb r4, [r5, 0x9] - movs r3, 0x3 - ands r3, r4 - orrs r3, r0 - strb r3, [r5, 0x9] - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r1, r0 - ldrh r3, [r5, 0x8] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r1 - strh r0, [r5, 0x8] - lsls r2, 1 - ldrb r1, [r5, 0xB] - movs r0, 0x1 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0xB] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010FCC - - thumb_func_start sub_801100C -sub_801100C: @ 801100C - push {r4,lr} - movs r4, 0x80 - ldr r3, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r0, r1, r3 - ldrb r2, [r0, 0x13] - lsls r2, 3 - orrs r2, r4 - adds r3, 0x4 - adds r1, r3 - ldr r0, [r1] - movs r1, 0x7 - ands r0, r1 - orrs r0, r2 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801100C - - thumb_func_start sub_801103C -sub_801103C: @ 801103C - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - movs r4, 0x1 - b _08011054 - .pool -_08011048: - adds r0, r4, 0 - bl sub_801100C - adds r1, r5, r4 - strb r0, [r1, 0x3] - adds r4, 0x1 -_08011054: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _08011048 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801103C - - thumb_func_start sub_8011068 -sub_8011068: @ 8011068 - push {lr} - lsls r0, 24 - ldr r2, =gUnknown_02022B14 - lsrs r0, 17 - ldrb r3, [r2, 0xA] - movs r1, 0x7F - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0xA] - ldr r3, =gUnknown_02022B22 - movs r0, 0 - movs r1, 0x2 - bl rfu_REQ_configGameData - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011068 - - thumb_func_start sub_8011090 -sub_8011090: @ 8011090 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0801109E - bl sub_8010F84 -_0801109E: - ldr r2, =gUnknown_02022B14 - ldr r3, =gUnknown_02022B22 - movs r0, 0 - movs r1, 0x2 - bl rfu_REQ_configGameData - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011090 - - thumb_func_start sub_80110B8 -sub_80110B8: @ 80110B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r9, r0 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - bne _0801114C - movs r5, 0 - movs r7, 0 - ldr r3, =gUnknown_03005000 - ldr r1, =0x00000ce2 - adds r0, r3, r1 - ldr r2, =0x00000ce3 - adds r1, r3, r2 - ldrb r2, [r0] - ldrb r0, [r1] - adds r1, r0, 0 - eors r1, r2 - mov r8, r1 - movs r4, 0 - movs r6, 0x1 - ldr r2, =gLinkPlayers - mov r12, r2 - ldr r0, =0x00000cde - adds r0, r3 - mov r10, r0 - mov r3, r12 - adds r3, 0x4 -_080110FC: - mov r0, r8 - asrs r0, r4 - ands r0, r6 - cmp r0, 0 - beq _0801113C - mov r1, r10 - adds r0, r4, r1 - ldrb r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - mov r2, r12 - adds r1, r0, r2 - ldrb r1, [r1, 0x13] - adds r2, r6, 0 - ands r2, r1 - lsls r2, 3 - adds r0, r3 - ldr r1, [r0] - movs r0, 0x7 - ands r1, r0 - movs r0, 0x80 - orrs r1, r0 - orrs r2, r1 - lsls r0, r5, 3 - lsls r2, r0 - orrs r7, r2 - adds r5, 0x1 - mov r0, r9 - subs r0, 0x1 - cmp r5, r0 - beq _08011142 -_0801113C: - adds r4, 0x1 - cmp r4, 0x3 - ble _080110FC -_08011142: - movs r0, 0x45 - adds r1, r7, 0 - movs r2, 0 - bl sub_8011090 -_0801114C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80110B8 - - thumb_func_start sub_8011170 -sub_8011170: @ 8011170 - push {r4,lr} - adds r4, r0, 0 - ldr r2, =gUnknown_03005000 - adds r3, r2, 0 - adds r3, 0xEE - ldrb r0, [r3] - cmp r0, 0 - bne _08011192 - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x14] - strh r0, [r2, 0x10] - ldrh r0, [r1, 0x16] - strh r0, [r2, 0x12] - strh r4, [r2, 0xA] - ldrb r0, [r3] - movs r0, 0x1 - strb r0, [r3] -_08011192: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011170 - - thumb_func_start sub_80111A0 -sub_80111A0: @ 80111A0 - ldr r0, =gUnknown_03005000 - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_80111A0 - - thumb_func_start sub_80111B0 -sub_80111B0: @ 80111B0 - push {lr} - adds r2, r0, 0 - cmp r2, 0 - bne _080111C8 - ldr r0, =gUnknown_03005000 - adds r0, 0xEE - ldrb r1, [r0] - strb r2, [r0] - b _080111D2 - .pool -_080111C8: - ldr r0, =gUnknown_03005000 - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0x4 - strb r1, [r0] -_080111D2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80111B0 - - thumb_func_start sub_80111DC -sub_80111DC: @ 80111DC - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - movs r1, 0x1 - bl sub_8011E94 - ldr r1, =gUnknown_03005000 - movs r0, 0 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80111DC - - thumb_func_start sub_80111FC -sub_80111FC: @ 80111FC - ldr r1, =gUnknown_03005000 - ldr r0, =sub_80111DC - str r0, [r1] - bx lr - .pool - thumb_func_end sub_80111FC - - thumb_func_start sub_801120C -sub_801120C: @ 801120C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r4, r0, 24 - movs r6, 0 - cmp r4, 0x32 - bne _08011222 - b _08011360 -_08011222: - cmp r4, 0x32 - bgt _08011252 - cmp r4, 0x13 - bgt _08011240 - cmp r4, 0x12 - blt _08011230 - b _080113EE -_08011230: - cmp r4, 0x10 - bne _08011236 - b _080113EE -_08011236: - cmp r4, 0x10 - bgt _0801128C - cmp r4, 0 - beq _0801127E - b _080113EE -_08011240: - cmp r4, 0x30 - bne _08011246 - b _0801136C -_08011246: - cmp r4, 0x30 - ble _0801124C - b _08011354 -_0801124C: - cmp r4, 0x14 - beq _08011328 - b _080113EE -_08011252: - cmp r4, 0x44 - bgt _08011264 - cmp r4, 0x42 - blt _0801125C - b _080113EE -_0801125C: - cmp r4, 0x33 - bne _08011262 - b _0801136C -_08011262: - b _080113EE -_08011264: - cmp r4, 0xF3 - bne _0801126A - b _080113BA -_0801126A: - cmp r4, 0xF3 - bgt _08011276 - cmp r4, 0xF0 - bge _08011274 - b _080113EE -_08011274: - b _080113D4 -_08011276: - cmp r4, 0xFF - bne _0801127C - b _080113D4 -_0801127C: - b _080113EE -_0801127E: - ldr r1, =gUnknown_03005000 - movs r0, 0x2 - strh r0, [r1, 0x4] - b _080113EE - .pool -_0801128C: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x14] - bl sub_80115EC - movs r5, 0 - movs r0, 0x1 - mov r8, r0 - ldr r1, =gUnknown_03005000 - mov r9, r1 - ldr r3, =0x00000cd5 - add r3, r9 - mov r10, r3 - movs r7, 0x7F -_080112A6: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x14] - asrs r0, r5 - mov r1, r8 - ands r0, r1 - cmp r0, 0 - beq _0801130E - ldr r0, =gUnknown_03007890 - lsls r1, r5, 5 - adds r1, 0x14 - ldr r0, [r0] - adds r0, r1 - ldrb r0, [r0, 0x10] - adds r4, r7, 0 - ands r4, r0 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - adds r0, r7, 0 - ands r0, r1 - cmp r4, r0 - bne _08011304 - ldr r0, =0x00000cd1 - add r0, r9 - adds r0, r5, r0 - movs r1, 0 - strb r1, [r0] - mov r3, r10 - adds r2, r5, r3 - strb r1, [r2] - movs r0, 0x20 - adds r1, r5, 0 - movs r3, 0x1 - bl rfu_setRecvBuffer - b _0801130E - .pool -_08011304: - mov r0, r8 - lsls r0, r5 - orrs r6, r0 - lsls r0, r6, 24 - lsrs r6, r0, 24 -_0801130E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _080112A6 - cmp r6, 0 - beq _080113EE - adds r0, r6, 0 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - b _080113EE -_08011328: - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ce7 - adds r0, r4, r1 - ldr r1, =gUnknown_03004140 - ldrb r2, [r0] - ldrb r0, [r1] - cmp r2, r0 - beq _08011342 - eors r0, r2 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete -_08011342: - movs r0, 0x11 - strh r0, [r4, 0x4] - b _080113EE - .pool -_08011354: - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - b _080113EA - .pool -_08011360: - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - movs r1, 0x3 - b _080113EC - .pool -_0801136C: - ldr r1, =gUnknown_03005000 - adds r2, r1, 0 - adds r2, 0xF0 - movs r0, 0x4 - strb r0, [r2] - ldr r3, =0x00000ce2 - adds r1, r3 - ldr r0, =gUnknown_03004140 - ldrb r2, [r0, 0x14] - ldrb r0, [r1] - adds r3, r0, 0 - bics r3, r2 - adds r2, r3, 0 - strb r2, [r1] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - bne _080113B0 - cmp r2, 0 - bne _080113AC - adds r0, r4, 0 - bl sub_8011170 - b _080113B0 - .pool -_080113AC: - bl sub_80111FC -_080113B0: - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 - b _080113EE -_080113BA: - movs r0, 0x1 - movs r1, 0xF3 - bl sub_8011A64 - movs r0, 0xF3 - bl sub_8011170 - ldr r0, =gUnknown_03005000 - adds r0, 0xEF - b _080113EA - .pool -_080113D4: - adds r0, r4, 0 - bl sub_8011170 - movs r0, 0x1 - adds r1, r4, 0 - bl sub_8011A64 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cdb - adds r0, r1 - ldrb r1, [r0] -_080113EA: - movs r1, 0x1 -_080113EC: - strb r1, [r0] -_080113EE: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801120C - - thumb_func_start sub_8011404 -sub_8011404: @ 8011404 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x31 - bne _08011410 - b _08011570 -_08011410: - cmp r4, 0x31 - bgt _0801143E - cmp r4, 0x22 - beq _08011494 - cmp r4, 0x22 - bgt _0801142C - cmp r4, 0x20 - beq _0801147C - cmp r4, 0x20 - ble _08011426 - b _080115DE -_08011426: - cmp r4, 0 - beq _0801146E - b _080115DE -_0801142C: - cmp r4, 0x24 - beq _080114BA - cmp r4, 0x24 - blt _080114B0 - cmp r4, 0x25 - beq _08011504 - cmp r4, 0x30 - beq _0801150E - b _080115DE -_0801143E: - cmp r4, 0x44 - bgt _08011454 - cmp r4, 0x42 - blt _08011448 - b _080115DE -_08011448: - cmp r4, 0x33 - beq _08011522 - cmp r4, 0x33 - bge _08011452 - b _0801158C -_08011452: - b _080115DE -_08011454: - cmp r4, 0xF3 - bne _0801145A - b _080115AC -_0801145A: - cmp r4, 0xF3 - bgt _08011466 - cmp r4, 0xF0 - bge _08011464 - b _080115DE -_08011464: - b _080115C4 -_08011466: - cmp r4, 0xFF - bne _0801146C - b _080115C4 -_0801146C: - b _080115DE -_0801146E: - ldr r1, =gUnknown_03005000 - movs r0, 0x6 - strh r0, [r1, 0x4] - b _080115DE - .pool -_0801147C: - ldr r0, =gUnknown_03005000 - ldr r1, =gUnknown_03004140 - ldrh r1, [r1, 0x14] - ldr r2, =0x00000ccd - adds r0, r2 - b _080115DC - .pool -_08011494: - ldr r0, =gUnknown_03005000 - ldr r1, =gUnknown_03004140 - ldrh r1, [r1, 0x14] - ldr r2, =0x00000c3e - adds r0, r2 - ldrb r2, [r0] - b _080115DC - .pool -_080114B0: - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 - b _080115DE -_080114BA: - ldr r4, =gUnknown_03005000 - movs r1, 0 - movs r0, 0xB - strh r0, [r4, 0x4] - ldr r2, =0x00000c85 - adds r0, r4, r2 - strb r1, [r0] - ldr r0, =0x00000c86 - adds r2, r4, r0 - strb r1, [r2] - ldr r1, =0x00000c3e - adds r5, r4, r1 - ldrb r1, [r5] - movs r0, 0x20 - movs r3, 0x1 - bl rfu_setRecvBuffer - ldrb r1, [r5] - ldr r2, =0x00000c3f - adds r4, r2 - movs r0, 0x10 - adds r2, r4, 0 - movs r3, 0x46 - bl rfu_setRecvBuffer - b _080115DE - .pool -_08011504: - movs r0, 0x2 - movs r1, 0x25 - bl sub_8011A64 - b _080115DE -_0801150E: - ldr r0, =gUnknown_03005000 - adds r2, r0, 0 - adds r2, 0xF0 - movs r1, 0x2 - strb r1, [r2] - ldr r1, =0x00000c86 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x6 - beq _080115DE -_08011522: - ldr r2, =gUnknown_03005000 - adds r1, r2, 0 - adds r1, 0xF0 - ldrb r0, [r1] - cmp r0, 0x2 - beq _08011532 - movs r0, 0x4 - strb r0, [r1] -_08011532: - ldr r1, =0x00000c86 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x9 - beq _08011544 - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 -_08011544: - ldr r0, =gUnknown_082ED7FC - movs r1, 0x5 - movs r2, 0x5 - bl nullsub_5 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - bne _080115DE - adds r0, r4, 0 - bl sub_8011170 - b _080115DE - .pool -_08011570: - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - movs r1, 0x1 - strb r1, [r0] - ldr r0, =gUnknown_082ED814 - movs r1, 0x5 - movs r2, 0x5 - bl nullsub_5 - b _080115DE - .pool -_0801158C: - ldr r1, =gUnknown_03005000 - adds r2, r1, 0 - adds r2, 0xF0 - movs r0, 0x3 - strb r0, [r2] - ldr r2, =0x00000c3c - adds r1, r2 - ldrb r0, [r1] - movs r0, 0x1 - strb r0, [r1] - b _080115DE - .pool -_080115AC: - movs r0, 0x1 - movs r1, 0xF3 - bl sub_8011A64 - movs r0, 0xF3 - bl sub_8011170 - ldr r0, =gUnknown_03005000 - adds r0, 0xEF - b _080115DA - .pool -_080115C4: - movs r0, 0x1 - adds r1, r4, 0 - bl sub_8011A64 - adds r0, r4, 0 - bl sub_8011170 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cdb - adds r0, r1 - ldrb r1, [r0] -_080115DA: - movs r1, 0x1 -_080115DC: - strb r1, [r0] -_080115DE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011404 - - thumb_func_start sub_80115EC -sub_80115EC: @ 80115EC - push {r4-r6,lr} - adds r3, r0, 0 - movs r2, 0 - movs r6, 0x1 - ldr r0, =gUnknown_03005000 - ldr r4, =0x00000cea - adds r1, r0, r4 - movs r5, 0 - movs r4, 0xFF -_080115FE: - adds r0, r3, 0 - asrs r0, r2 - ands r0, r6 - cmp r0, 0 - beq _08011610 - strb r5, [r1] - ldrb r0, [r1, 0x4] - orrs r0, r4 - strb r0, [r1, 0x4] -_08011610: - adds r1, 0x1 - adds r2, 0x1 - cmp r2, 0x3 - ble _080115FE - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80115EC - - thumb_func_start sub_8011628 -sub_8011628: @ 8011628 - push {r4-r7,lr} - adds r5, r0, 0 - movs r3, 0 - movs r2, 0 - movs r4, 0x1 - ldr r6, =gUnknown_03007890 - movs r7, 0x7F -_08011636: - adds r0, r5, 0 - asrs r0, r2 - ands r0, r4 - cmp r0, 0 - beq _0801165C - lsls r1, r2, 5 - adds r1, 0x14 - ldr r0, [r6] - adds r0, r1 - ldrb r1, [r0, 0x10] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0x45 - bne _0801165C - adds r0, r4, 0 - lsls r0, r2 - orrs r3, r0 - lsls r0, r3, 24 - lsrs r3, r0, 24 -_0801165C: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _08011636 - adds r0, r3, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8011628 - - thumb_func_start sub_8011674 -sub_8011674: @ 8011674 - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x25 - bne _08011680 - b _080118EC -_08011680: - cmp r4, 0x25 - bgt _080116C2 - cmp r4, 0x14 - bne _0801168A - b _08011804 -_0801168A: - cmp r4, 0x14 - bgt _080116A2 - cmp r4, 0x11 - beq _08011722 - cmp r4, 0x11 - ble _08011698 - b _08011A42 -_08011698: - cmp r4, 0 - beq _0801170C - cmp r4, 0x10 - beq _08011718 - b _08011A42 -_080116A2: - cmp r4, 0x22 - bne _080116A8 - b _08011868 -_080116A8: - cmp r4, 0x22 - bgt _080116B4 - cmp r4, 0x20 - bne _080116B2 - b _08011850 -_080116B2: - b _08011A42 -_080116B4: - cmp r4, 0x23 - bne _080116BA - b _08011884 -_080116BA: - cmp r4, 0x24 - bne _080116C0 - b _080118BA -_080116C0: - b _08011A42 -_080116C2: - cmp r4, 0x44 - bgt _080116F2 - cmp r4, 0x42 - blt _080116CC - b _08011A42 -_080116CC: - cmp r4, 0x32 - bne _080116D2 - b _08011914 -_080116D2: - cmp r4, 0x32 - bgt _080116E4 - cmp r4, 0x30 - bne _080116DC - b _08011940 -_080116DC: - cmp r4, 0x31 - bne _080116E2 - b _080118F6 -_080116E2: - b _08011A42 -_080116E4: - cmp r4, 0x33 - bne _080116EA - b _08011948 -_080116EA: - cmp r4, 0x40 - bne _080116F0 - b _080119FC -_080116F0: - b _08011A42 -_080116F2: - cmp r4, 0xF3 - bne _080116F8 - b _08011A0C -_080116F8: - cmp r4, 0xF3 - bgt _08011704 - cmp r4, 0xF0 - bge _08011702 - b _08011A42 -_08011702: - b _08011A28 -_08011704: - cmp r4, 0xFF - bne _0801170A - b _08011A28 -_0801170A: - b _08011A42 -_0801170C: - ldr r1, =gUnknown_03005000 - movs r0, 0x11 - strh r0, [r1, 0x4] - b _08011A42 - .pool -_08011718: - movs r0, 0x4 - movs r1, 0 - bl sub_8011A64 - b _08011A42 -_08011722: - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - bne _080117DC - ldr r5, =gUnknown_03005000 - ldr r1, =0x00000cd9 - adds r0, r5, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080117DC - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x14] - bl sub_8011628 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _080117A6 - adds r0, r4, 0 - bl sub_800E87C - movs r2, 0x1 - mov r12, r2 - mov r1, r12 - lsls r1, r0 - lsls r1, 24 - lsrs r1, 24 - ldr r7, =0x00000ce6 - adds r6, r5, r7 - ldrb r2, [r6] - cmp r2, 0 - bne _08011798 - ldr r0, =0x00000ce8 - adds r3, r5, r0 - ldrb r0, [r3] - cmp r0, 0 - bne _08011798 - subs r7, 0x1 - adds r0, r5, r7 - strb r1, [r0] - eors r1, r4 - orrs r1, r2 - strb r1, [r6] - mov r0, r12 - strb r0, [r3] - b _080117A6 - .pool -_08011798: - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000ce6 - adds r0, r1 - ldrb r2, [r0] - adds r1, r4, 0 - orrs r1, r2 - strb r1, [r0] -_080117A6: - ldr r0, =gUnknown_03004140 - ldrh r1, [r0, 0x14] - cmp r4, r1 - beq _080117F6 - ldr r2, =gUnknown_03005000 - ldr r7, =0x00000ce3 - adds r3, r2, r7 - adds r0, r4, 0 - eors r0, r1 - ldrb r1, [r3] - orrs r0, r1 - strb r0, [r3] - ldr r0, =0x00000ce4 - adds r2, r0 - movs r0, 0x2 - strb r0, [r2] - b _080117F6 - .pool -_080117DC: - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x54 - bne _080117F6 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - bl rfu_REQ_disconnect - bl rfu_waitREQComplete -_080117F6: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x14] - bl sub_80115EC - b _08011A42 - .pool -_08011804: - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - beq _08011836 - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x1] - cmp r0, 0x1 - bls _08011836 - ldrb r0, [r4, 0x14] - bl sub_800E87C - movs r1, 0x80 - lsls r1, 17 - lsls r1, r0 - lsrs r1, 24 - ldrb r0, [r4] - eors r1, r0 - adds r0, r1, 0 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete -_08011836: - ldr r1, =gUnknown_03005000 - ldrh r0, [r1, 0x4] - cmp r0, 0xF - beq _08011840 - b _08011A42 -_08011840: - movs r0, 0x10 - strh r0, [r1, 0x4] - b _08011A42 - .pool -_08011850: - ldr r0, =gUnknown_03005000 - ldr r1, =gUnknown_03004140 - ldrh r1, [r1, 0x14] - ldr r2, =0x00000ccd - adds r0, r2 - b _08011A40 - .pool -_08011868: - ldr r0, =gUnknown_03005000 - ldr r1, =gUnknown_03004140 - ldrh r1, [r1, 0x14] - ldr r7, =0x00000c3e - adds r0, r7 - ldrb r2, [r0] - b _08011A40 - .pool -_08011884: - ldr r1, =gUnknown_03005000 - movs r0, 0x12 - strh r0, [r1, 0x4] - ldr r0, =0x00000ccf - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x1 - bhi _080118B0 - adds r0, 0x1 - strb r0, [r1] - ldr r0, =sub_801209C - movs r1, 0x2 - bl CreateTask - b _08011A42 - .pool -_080118B0: - movs r0, 0x2 - movs r1, 0x23 - bl sub_8011A64 - b _08011A42 -_080118BA: - ldr r4, =gUnknown_03005000 - movs r0, 0xD - strh r0, [r4, 0x4] - movs r0, 0x3 - movs r1, 0 - bl sub_8011A64 - ldr r1, =0x00000c3e - adds r0, r4, r1 - ldrb r1, [r0] - ldr r2, =0x00000c3f - adds r4, r2 - movs r0, 0x10 - adds r2, r4, 0 - movs r3, 0x46 - bl rfu_setRecvBuffer - b _08011A42 - .pool -_080118EC: - movs r0, 0x2 - movs r1, 0x25 - bl sub_8011A64 - b _08011A42 -_080118F6: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0] - ldrh r0, [r0, 0x14] - ands r1, r0 - cmp r1, 0 - bne _08011904 - b _08011A42 -_08011904: - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - movs r1, 0x1 - b _08011A40 - .pool -_08011914: - ldr r2, =gUnknown_03005000 - adds r1, r2, 0 - adds r1, 0xF0 - movs r0, 0x3 - strb r0, [r1] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - beq _0801192A - b _08011A42 -_0801192A: - ldr r7, =0x00000c3c - adds r0, r2, r7 - ldrb r1, [r0] - movs r1, 0x1 - b _08011A40 - .pool -_08011940: - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - movs r1, 0x2 - strb r1, [r0] -_08011948: - ldr r2, =gUnknown_03005000 - adds r1, r2, 0 - adds r1, 0xF0 - ldrb r0, [r1] - cmp r0, 0x2 - beq _08011958 - movs r0, 0x4 - strb r0, [r1] -_08011958: - ldrb r0, [r2, 0xC] - cmp r0, 0x1 - bne _08011996 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - bne _080119B4 - ldr r0, =0x00000ce2 - adds r2, r0 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x14] - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - cmp r0, 0 - bne _08011990 - adds r0, r4, 0 - bl sub_8011170 - b _080119B4 - .pool -_08011990: - bl sub_80111FC - b _080119B4 -_08011996: - ldr r1, =0x00000ce4 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x2 - beq _080119B4 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - bne _080119B4 - adds r0, r4, 0 - bl sub_8011170 - movs r0, 0 - bl sub_800C27C -_080119B4: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0xFF - bne _080119DA - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x7] - cmp r0, 0 - bne _080119DA - ldr r0, =sub_800EB44 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080119DA - ldr r1, =gUnknown_03005000 - movs r0, 0x11 - strh r0, [r1, 0x4] -_080119DA: - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 - b _08011A42 - .pool -_080119FC: - ldr r0, =gUnknown_03005000 - ldr r2, =0x00000ce3 - adds r0, r2 - b _08011A3E - .pool -_08011A0C: - movs r0, 0x1 - movs r1, 0xF3 - bl sub_8011A64 - movs r0, 0xF3 - bl sub_8011170 - ldr r0, =gUnknown_03005000 - adds r0, 0xEF - movs r1, 0x1 - b _08011A40 - .pool -_08011A28: - adds r0, r4, 0 - bl sub_8011170 - movs r0, 0x1 - adds r1, r4, 0 - bl sub_8011A64 - ldr r0, =gUnknown_03005000 - ldr r7, =0x00000cdb - adds r0, r7 - ldrb r1, [r0] -_08011A3E: - movs r1, 0 -_08011A40: - strb r1, [r0] -_08011A42: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011674 - - thumb_func_start sub_8011A50 -sub_8011A50: @ 8011A50 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000ce4 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_8011A50 - - thumb_func_start sub_8011A64 -sub_8011A64: @ 8011A64 - ldr r2, =gUnknown_03005000 - adds r3, r2, 0 - adds r3, 0xF1 - strb r0, [r3] - strh r1, [r2, 0xA] - bx lr - .pool - thumb_func_end sub_8011A64 - - thumb_func_start sub_8011A74 -sub_8011A74: @ 8011A74 - ldr r0, =gUnknown_03005000 - adds r0, 0xF1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_8011A74 - - thumb_func_start sub_8011A80 -sub_8011A80: @ 8011A80 - push {lr} - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r0, 0x1 - bls _08011A94 - movs r0, 0 - b _08011A96 -_08011A94: - movs r0, 0x1 -_08011A96: - pop {r1} - bx r1 - thumb_func_end sub_8011A80 - - thumb_func_start sub_8011A9C -sub_8011A9C: @ 8011A9C - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000ce8 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_8011A9C - - thumb_func_start sub_8011AB0 -sub_8011AB0: @ 8011AB0 - ldr r0, =gUnknown_03005000 - ldrb r0, [r0, 0xC] - bx lr - .pool - thumb_func_end sub_8011AB0 - - thumb_func_start LinkVSync -LinkVSync: @ 8011ABC - push {lr} - bl rfu_syncVBlank_ - pop {r0} - bx r0 - thumb_func_end LinkVSync - - thumb_func_start sub_8011AC8 -sub_8011AC8: @ 8011AC8 - push {lr} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - ldr r1, =gUnknown_03003090 - ldr r2, =0x05000014 - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011AC8 - - thumb_func_start sub_8011AE8 -sub_8011AE8: @ 8011AE8 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_8011AE8 - - thumb_func_start sub_8011AFC -sub_8011AFC: @ 8011AFC - push {r4,lr} - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - bl ResetPaletteFade - ldr r0, =sub_8011AE8 - bl SetVBlankCallback - bl sub_80093CC - lsls r0, 24 - cmp r0, 0 - beq _08011B70 - ldr r1, =gUnknown_020229C6 - ldr r2, =0x00001111 - adds r0, r2, 0 - strh r0, [r1] - bl sub_800B488 - bl sub_8009734 - ldr r0, =gMain - ldrh r0, [r0, 0x24] - bl SeedRng - movs r4, 0 -_08011B38: - bl Random - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - adds r1, 0xA - adds r1, r4 - strb r0, [r1] - adds r4, 0x1 - cmp r4, 0x3 - ble _08011B38 - movs r1, 0xAA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - bl sub_8011BA4 - ldr r0, =sub_8011BF8 - bl SetMainCallback2 -_08011B70: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011AFC - - thumb_func_start sub_8011B90 -sub_8011B90: @ 8011B90 - push {lr} - ldr r0, =sub_800EB44 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8011B90 - - thumb_func_start sub_8011BA4 -sub_8011BA4: @ 8011BA4 - push {r4,lr} - ldr r4, =nullsub_89 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _08011BC2 - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - ldr r1, =gUnknown_03005000 - adds r1, 0x66 - strb r0, [r1] -_08011BC2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011BA4 - - thumb_func_start sub_8011BD0 -sub_8011BD0: @ 8011BD0 - push {lr} - ldr r0, =nullsub_89 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08011BEA - ldr r0, =gUnknown_03005000 - adds r0, 0x66 - ldrb r0, [r0] - bl DestroyTask -_08011BEA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011BD0 - - thumb_func_start sub_8011BF8 -sub_8011BF8: @ 8011BF8 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_8011BF8 - - thumb_func_start sub_8011C10 -sub_8011C10: @ 8011C10 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r1, =gUnknown_03005000 - movs r0, 0x1 - strb r0, [r1, 0xC] - bl sub_8010F48 - ldr r0, =sub_801120C - movs r1, 0 - bl sub_800BF4C - ldr r2, =gUnknown_02022B2C - adds r1, r2, 0 - ldr r0, =gUnknown_082ED608 - ldm r0!, {r3,r5,r6} - stm r1!, {r3,r5,r6} - ldm r0!, {r3,r5,r6} - stm r1!, {r3,r5,r6} - ldr r0, =gUnknown_082ED620 - subs r4, 0x1 - adds r4, r0 - ldrb r0, [r4] - strh r0, [r2, 0x2] - bl sub_800EE78 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011C10 - - thumb_func_start sub_8011C5C -sub_8011C5C: @ 8011C5C - push {lr} - ldr r1, =gUnknown_03005000 - movs r0, 0 - strb r0, [r1, 0xC] - bl sub_8010F48 - ldr r0, =sub_8011404 - ldr r1, =sub_800ED34 - bl sub_800BF4C - bl sub_800EF00 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011C5C - - thumb_func_start sub_8011C84 -sub_8011C84: @ 8011C84 - push {r4-r7,lr} - ldr r4, =gUnknown_03005000 - movs r5, 0 - movs r0, 0x2 - strb r0, [r4, 0xC] - bl sub_8010F48 - ldr r0, =sub_8011674 - movs r1, 0 - bl sub_800BF4C - ldr r2, =gUnknown_02022B2C - adds r1, r2, 0 - ldr r0, =gUnknown_082ED608 - ldm r0!, {r3,r6,r7} - stm r1!, {r3,r6,r7} - ldm r0!, {r3,r6,r7} - stm r1!, {r3,r6,r7} - strb r5, [r2, 0x11] - movs r0, 0x96 - lsls r0, 2 - strh r0, [r2, 0x12] - ldr r0, =sub_800EB44 - movs r1, 0x1 - bl CreateTask - adds r4, 0x67 - strb r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011C84 - - thumb_func_start sub_8011CD8 -sub_8011CD8: @ 8011CD8 - ldrb r1, [r0, 0x1] - lsls r1, 8 - ldrb r0, [r0] - orrs r0, r1 - bx lr - thumb_func_end sub_8011CD8 - - thumb_func_start sub_8011CE4 -sub_8011CE4: @ 8011CE4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - str r0, [sp] - lsls r1, 16 - lsrs r1, 16 - mov r10, r1 - movs r0, 0xFF - mov r9, r0 - movs r7, 0 - ldr r1, =gUnknown_03007890 - mov r8, r1 -_08011D02: - lsls r4, r7, 5 - adds r5, r4, 0 - adds r5, 0x14 - mov r1, r8 - ldr r0, [r1] - adds r0, r5 - adds r0, 0x8 - bl sub_8011CD8 - lsls r0, 16 - lsrs r6, r0, 16 - mov r1, r8 - ldr r0, [r1] - adds r0, r4 - ldrh r0, [r0, 0x18] - bl sub_8010454 - cmp r0, 0 - beq _08011D4C - mov r0, r8 - ldr r1, [r0] - adds r1, r5 - adds r1, 0x15 - ldr r0, [sp] - bl StringCompare - cmp r0, 0 - bne _08011D4C - cmp r10, r6 - bne _08011D4C - mov r9, r7 - mov r1, r8 - ldr r0, [r1] - adds r0, r4 - ldrb r0, [r0, 0x16] - cmp r0, 0xFF - bne _08011D56 -_08011D4C: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x3 - bls _08011D02 -_08011D56: - mov r0, r9 - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8011CE4 - - thumb_func_start sub_8011D6C -sub_8011D6C: @ 8011D6C - push {r4-r6,lr} - adds r6, r0, 0 - lsls r0, r6, 24 - lsrs r0, 24 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000ce2 - adds r5, r4, r0 - ldrb r0, [r5] - bics r0, r6 - strb r0, [r5] - ldr r1, =0x00000cda - adds r6, r4, r1 - ldrb r1, [r6] - movs r0, 0x1 - bl rfu_clearSlot - ldrb r0, [r5] - ldr r1, =0x00000c87 - adds r4, r1 - adds r1, r4, 0 - movs r2, 0x46 - bl rfu_UNI_setSendData - ldrb r0, [r5] - bl sub_800E87C - strb r0, [r6] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011D6C - - thumb_func_start sub_8011DC0 -sub_8011DC0: @ 8011DC0 - push {lr} - lsls r1, 16 - lsrs r1, 16 - bl sub_8011CE4 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - beq _08011DDA - movs r0, 0x1 - lsls r0, r1 - bl sub_8011D6C -_08011DDA: - pop {r0} - bx r0 - thumb_func_end sub_8011DC0 - - thumb_func_start sub_8011DE0 -sub_8011DE0: @ 8011DE0 - push {r4-r6,lr} - adds r4, r0, 0 - cmp r4, 0 - beq _08011E20 - movs r3, 0 - movs r2, 0 - ldr r5, =gUnknown_03005CDE - adds r6, r5, 0x4 -_08011DF0: - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, r4 - bne _08011E0E - ldrb r0, [r6] - asrs r0, r2 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08011E0E - adds r0, r1, 0 - lsls r0, r2 - orrs r3, r0 - lsls r0, r3, 24 - lsrs r3, r0, 24 -_08011E0E: - adds r2, 0x1 - cmp r2, 0x3 - ble _08011DF0 - cmp r3, 0 - beq _08011E20 - adds r0, r3, 0 - movs r1, 0x2 - bl sub_8011E94 -_08011E20: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011DE0 - - thumb_func_start sub_8011E2C -sub_8011E2C: @ 8011E2C - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r6, =gUnknown_03003110 - ldrh r0, [r6] - cmp r0, 0 - bne _08011E7A - ldr r5, =gUnknown_03005000 - ldr r1, =0x00000ce8 - adds r0, r5, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08011E7A - movs r0, 0xED - lsls r0, 8 - bl sub_800FD14 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - strh r1, [r6, 0x2] - ldrh r1, [r0, 0xA] - strh r1, [r6, 0x4] - ldr r1, =gUnknown_082ED695 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r0, r1 - ldrb r1, [r5, 0xD] - ldrb r0, [r0] - subs r1, r0 - strb r1, [r5, 0xD] - ldrb r0, [r5, 0xD] - strh r0, [r6, 0x6] - adds r0, r4, 0 - bl DestroyTask -_08011E7A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011E2C - - thumb_func_start sub_8011E94 -sub_8011E94: @ 8011E94 - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - ldr r5, =sub_8011E2C - adds r0, r5, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _08011ECC - adds r0, r5, 0 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - b _08011EDC - .pool -_08011ECC: - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - orrs r4, r0 - strh r4, [r1, 0x8] -_08011EDC: - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r6, [r0, 0xA] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011E94 - - thumb_func_start sub_8011EF4 -sub_8011EF4: @ 8011EF4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_800EE94 - lsls r0, 24 - cmp r0, 0 - beq _08011FA4 - adds r0, r4, 0 - adds r0, 0x10 - bl sub_8011CD8 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl sub_8011CE4 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _08011F8C - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - lsls r1, r2, 5 - adds r0, r1 - ldrb r0, [r0, 0x16] - cmp r0, 0xFF - beq _08011F5C - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000c3d - adds r0, r1 - strb r2, [r0] - bl sub_800EEBC - cmp r0, 0 - beq _08011FAA - b _08011F84 - .pool -_08011F5C: - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r5, 0x7F - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0x15 - beq _08011FA4 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0x16 - beq _08011FA4 - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 -_08011F84: - adds r0, r6, 0 - bl DestroyTask - b _08011FAA -_08011F8C: - ldrh r0, [r4, 0x1E] - adds r0, 0x1 - strh r0, [r4, 0x1E] - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000c3d - adds r0, r1 - strb r2, [r0] - b _08011FAA - .pool -_08011FA4: - ldrh r0, [r4, 0x1E] - adds r0, 0x1 - strh r0, [r4, 0x1E] -_08011FAA: - movs r1, 0x1E - ldrsh r0, [r4, r1] - cmp r0, 0xF0 - ble _08011FC2 - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 - adds r0, r6, 0 - bl DestroyTask -_08011FC2: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8011EF4 - - thumb_func_start sub_8011FC8 -sub_8011FC8: @ 8011FC8 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r5, r1, 16 - lsrs r5, 16 - ldr r0, =gUnknown_03005000 - adds r0, 0xF1 - movs r1, 0 - strb r1, [r0] - ldr r0, =sub_8011EF4 - movs r1, 0x3 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - adds r0, r4, 0 - adds r1, r6, 0 - bl StringCopy - strh r5, [r4, 0x10] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011FC8 - - thumb_func_start sub_801200C -sub_801200C: @ 801200C - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 16 - lsrs r5, r0, 16 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r2, 0x7F - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0x45 - bne _08012032 - ldrb r1, [r4, 0xA] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0x45 - beq _08012092 -_0801202E: - movs r0, 0x1 - b _08012094 -_08012032: - ldrb r1, [r4, 0xA] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0x40 - bne _0801202E - cmp r5, 0x44 - bne _08012092 - ldr r5, =gUnknown_0300510A - ldrh r0, [r5, 0x8] - ldr r3, =0x000003ff - adds r2, r3, 0 - ands r2, r0 - movs r0, 0xCE - lsls r0, 1 - cmp r2, r0 - bne _08012068 - ldrh r1, [r4, 0x8] - adds r0, r3, 0 - ands r0, r1 - cmp r0, r2 - beq _08012092 - b _0801202E - .pool -_08012068: - ldrh r1, [r4, 0x8] - adds r0, r3, 0 - ands r0, r1 - cmp r0, r2 - bne _0801202E - ldrb r2, [r4, 0xB] - movs r0, 0xFE - ldrb r3, [r5, 0xB] - adds r1, r0, 0 - ands r1, r2 - ands r0, r3 - cmp r1, r0 - bne _0801202E - ldrb r2, [r4, 0x9] - movs r0, 0xFC - ldrb r3, [r5, 0x9] - adds r1, r0, 0 - ands r1, r2 - ands r0, r3 - cmp r1, r0 - bne _0801202E -_08012092: - movs r0, 0 -_08012094: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801200C - - thumb_func_start sub_801209C -sub_801209C: @ 801209C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - mov r8, r5 - ldr r6, =gUnknown_03005000 - adds r0, r6, 0 - adds r0, 0xF1 - ldrb r0, [r0] - cmp r0, 0x4 - bne _080120BA - adds r0, r5, 0 - bl DestroyTask -_080120BA: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - lsls r0, 16 - movs r1, 0x96 - lsls r1, 17 - cmp r0, r1 - ble _080120E4 - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 - adds r0, r5, 0 - bl DestroyTask -_080120E4: - ldr r1, =0x00000ccd - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0801217C - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x6] - cmp r0, 0 - bne _0801217C - movs r2, 0x86 - lsls r2, 1 - adds r0, r6, r2 - bl sub_8011CD8 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldr r2, =0x00000119 - adds r0, r6, r2 - bl sub_8011CE4 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _0801217C - movs r1, 0xA - ldrsh r0, [r4, r1] - ldr r7, =gUnknown_03007890 - lsls r4, r2, 5 - adds r2, r4, 0 - adds r2, 0x14 - ldr r1, [r7] - adds r1, r2 - adds r1, 0x6 - bl sub_801200C - cmp r0, 0 - bne _0801216C - ldr r0, [r7] - adds r1, r0, r4 - ldrb r0, [r1, 0x16] - cmp r0, 0xFF - beq _0801217C - ldrh r0, [r1, 0x14] - movs r1, 0x5A - bl sub_800C12C - lsls r0, 24 - cmp r0, 0 - bne _0801217C - movs r0, 0xA - strh r0, [r6, 0x4] - adds r0, r5, 0 - bl DestroyTask - b _0801217C - .pool -_0801216C: - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 - mov r0, r8 - bl DestroyTask -_0801217C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801209C - - thumb_func_start sub_8012188 -sub_8012188: @ 8012188 - push {r4-r7,lr} - adds r3, r0, 0 - adds r5, r1, 0 - lsls r4, r2, 24 - lsrs r4, 24 - ldr r6, =gUnknown_03005000 - ldr r1, =0x00000ccf - adds r0, r6, r1 - movs r7, 0 - strb r7, [r0] - adds r0, r6, 0 - adds r0, 0xF1 - strb r7, [r0] - ldr r1, =0x00000119 - adds r0, r6, r1 - adds r1, r3, 0 - bl StringCopy - movs r1, 0x85 - lsls r1, 1 - adds r0, r6, r1 - adds r1, r5, 0 - movs r2, 0xD - bl memcpy - bl sub_800D658 - ldr r0, =sub_801209C - movs r1, 0x2 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - strh r4, [r1, 0xA] - ldr r0, =sub_800EB44 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r1, r0, 24 - adds r2, r1, 0 - cmp r4, 0x45 - bne _08012210 - cmp r1, 0xFF - beq _0801221E - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - movs r1, 0x1 - strh r1, [r0, 0x16] - b _0801221E - .pool -_08012210: - cmp r2, 0xFF - beq _0801221E - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r5 - strh r7, [r0, 0x16] -_0801221E: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8012188 - - thumb_func_start sub_8012224 -sub_8012224: @ 8012224 - push {lr} - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08012238 - movs r0, 0 - b _0801223A - .pool -_08012238: - movs r0, 0x1 -_0801223A: - pop {r1} - bx r1 - thumb_func_end sub_8012224 - - thumb_func_start sub_8012240 -sub_8012240: @ 8012240 - push {r4,lr} - movs r1, 0 - ldr r0, =gUnknown_03004140 - ldrb r2, [r0] - ldr r4, =gUnknown_03005CD1 - movs r3, 0x1 -_0801224C: - adds r0, r2, 0 - asrs r0, r1 - ands r0, r3 - cmp r0, 0 - beq _0801226C - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _0801226C - movs r0, 0 - b _08012274 - .pool -_0801226C: - adds r1, 0x1 - cmp r1, 0x3 - ble _0801224C - movs r0, 0x1 -_08012274: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8012240 - - thumb_func_start sub_801227C -sub_801227C: @ 801227C - push {r4,lr} - movs r4, 0 -_08012280: - lsls r2, r4, 24 - lsrs r2, 24 - ldr r0, =gUnknown_082ED82C - movs r1, 0 - bl nullsub_5 - adds r4, 0x1 - cmp r4, 0x13 - ble _08012280 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801227C - - thumb_func_start sub_801229C -sub_801229C: @ 801229C - push {r4-r7,lr} - mov r7, r8 - push {r7} - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1C - movs r2, 0x13 - movs r3, 0x2 - bl nullsub_13 - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0, 0x2] - movs r1, 0x14 - movs r2, 0x1 - movs r3, 0x1 - bl nullsub_13 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - movs r1, 0x17 - movs r2, 0x1 - movs r3, 0x1 - bl nullsub_13 - ldr r0, =gUnknown_03005000 - ldrb r0, [r0, 0xC] - cmp r0, 0x1 - bne _08012378 - movs r6, 0 - adds r7, r4, 0 - movs r5, 0x14 -_080122E0: - ldr r2, [r7] - ldrb r0, [r2, 0x7] - asrs r0, r6 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801231E - lsls r0, r6, 5 - adds r0, r2, r0 - ldrh r0, [r0, 0x18] - adds r4, r6, 0x3 - lsls r4, 24 - lsrs r4, 24 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - adds r0, r5 - adds r0, 0x6 - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, [r7] - adds r0, r5 - adds r0, 0x15 - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 -_0801231E: - adds r5, 0x20 - adds r6, 0x1 - cmp r6, 0x3 - ble _080122E0 - movs r6, 0 - ldr r0, =gUnknown_03005000 - mov r8, r0 -_0801232C: - movs r5, 0 - adds r7, r6, 0x1 - lsls r0, r6, 3 - adds r2, r6, 0 - adds r2, 0xB - subs r0, r6 - lsls r0, 1 - mov r1, r8 - adds r1, 0x14 - adds r4, r0, r1 - lsls r6, r2, 24 -_08012342: - ldrb r0, [r4] - lsls r1, r5, 25 - lsrs r1, 24 - lsrs r2, r6, 24 - movs r3, 0x2 - bl nullsub_13 - adds r4, 0x1 - adds r5, 0x1 - cmp r5, 0xD - ble _08012342 - adds r6, r7, 0 - cmp r6, 0x3 - ble _0801232C - ldr r0, =gUnknown_082ED868 - movs r1, 0x1 - movs r2, 0xF - bl nullsub_5 - b _080124AA - .pool -_08012378: - ldr r1, [r4] - ldrb r0, [r1, 0x2] - cmp r0, 0 - beq _08012414 - ldrb r0, [r1, 0x7] - cmp r0, 0 - beq _08012414 - movs r6, 0 - movs r5, 0xC0 - lsls r5, 18 -_0801238C: - lsrs r4, r5, 24 - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, =gUnknown_082ED84B - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, =gUnknown_082ED85B - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 - movs r1, 0x80 - lsls r1, 17 - adds r5, r1 - adds r6, 0x1 - cmp r6, 0x3 - ble _0801238C - ldr r5, =gUnknown_03007890 - ldr r1, [r5] - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r4, r0 - ldrb r0, [r4] - lsls r0, 5 - adds r1, r0 - ldrh r0, [r1, 0x18] - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x4 - bl nullsub_13 - ldrb r1, [r4] - lsls r1, 5 - adds r1, 0x14 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x6 - movs r1, 0x6 - movs r2, 0x3 - bl nullsub_5 - ldrb r1, [r4] - lsls r1, 5 - adds r1, 0x14 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x15 - movs r1, 0x16 - movs r2, 0x3 - bl nullsub_5 - b _080124AA - .pool -_08012414: - movs r6, 0 - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - cmp r6, r0 - bge _08012470 - adds r7, r1, 0 - movs r1, 0x14 - mov r8, r1 -_08012426: - ldr r0, [r7] - lsls r5, r6, 5 - adds r1, r0, r5 - ldrb r0, [r1, 0x16] - cmp r0, 0xFF - beq _08012462 - ldrh r0, [r1, 0x18] - adds r4, r6, 0x3 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - adds r0, r5 - ldrh r0, [r0, 0x14] - movs r1, 0x6 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - add r0, r8 - adds r0, 0x15 - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 -_08012462: - movs r0, 0x20 - add r8, r0 - adds r6, 0x1 - ldr r0, [r7] - ldrb r0, [r0, 0x8] - cmp r6, r0 - blt _08012426 -_08012470: - cmp r6, 0x3 - bgt _080124AA - lsls r0, r6, 24 - movs r1, 0xC0 - lsls r1, 18 - adds r5, r0, r1 -_0801247C: - lsrs r4, r5, 24 - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, =gUnknown_082ED84B - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, =gUnknown_082ED85B - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 - movs r0, 0x80 - lsls r0, 17 - adds r5, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0801247C -_080124AA: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801229C - - thumb_func_start sub_80124C0 -sub_80124C0: @ 80124C0 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000c1a - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80124C0 - - thumb_func_start sub_80124D4 -sub_80124D4: @ 80124D4 - ldr r0, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80124D4 - - thumb_func_start nullsub_89 -nullsub_89: @ 80124E8 - bx lr - thumb_func_end nullsub_89 - - thumb_func_start sub_80124EC -sub_80124EC: @ 80124EC - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r1, 0 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r2, 24 - lsrs r5, r2, 24 - adds r0, r6, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - lsls r4, 8 - movs r0, 0x90 - lsls r0, 6 - cmp r4, r0 - beq _08012588 - cmp r4, r0 - bgt _08012526 - movs r0, 0x80 - lsls r0, 2 - cmp r4, r0 - beq _08012538 - movs r0, 0x80 - lsls r0, 3 - cmp r4, r0 - beq _08012544 - b _080125A6 -_08012526: - movs r0, 0x94 - lsls r0, 6 - cmp r4, r0 - beq _08012554 - movs r0, 0xD4 - lsls r0, 6 - cmp r4, r0 - beq _08012564 - b _080125A6 -_08012538: - ldr r1, =gUnknown_082EDB60 - subs r0, r5, 0x1 - lsls r0, 2 - b _0801256C - .pool -_08012544: - ldr r1, =gUnknown_082EDB60 - subs r0, r5, 0x1 - lsls r0, 2 - adds r1, 0x14 - b _0801256C - .pool -_08012554: - ldr r1, =gUnknown_082EDB60 - subs r0, r5, 0x1 - lsls r0, 2 - adds r1, 0x28 - b _0801256C - .pool -_08012564: - ldr r1, =gUnknown_082EDB60 - subs r0, r5, 0x1 - lsls r0, 2 - adds r1, 0x3C -_0801256C: - adds r0, r1 - ldr r2, [r0] - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - movs r3, 0 - bl sub_80173E0 - b _080125A6 - .pool -_08012588: - ldr r1, =gUnknown_082EDB60 - subs r0, r5, 0x1 - lsls r0, 2 - adds r1, 0x50 - adds r0, r1 - ldr r2, [r0] - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - movs r3, 0 - bl sub_80173E0 -_080125A6: - adds r0, r6, 0 - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80124EC - - thumb_func_start sub_80125BC -sub_80125BC: @ 80125BC - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x28 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gSaveBlock2Ptr - ldr r2, [r6] - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - mov r8, r0 - str r0, [sp, 0x4] - adds r0, r4, 0 - movs r1, 0x1 - movs r3, 0 - bl sub_80173E0 - ldr r1, =gText_UnkCtrlCodeF907 - add r0, sp, 0x8 - bl StringCopy - adds r5, r0, 0 - ldr r0, [r6] - adds r0, 0xA - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - movs r0, 0x11 - str r0, [sp] - mov r0, r8 - str r0, [sp, 0x4] - adds r0, r4, 0 - movs r1, 0x1 - add r2, sp, 0x8 - movs r3, 0 - bl sub_80173E0 - add sp, 0x28 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80125BC - - thumb_func_start sub_801262C -sub_801262C: @ 801262C - push {lr} - lsls r1, 24 - lsrs r1, 24 - subs r0, r1, 0x1 - cmp r0, 0x1B - bhi _080126C0 - lsls r0, 2 - ldr r1, =_08012648 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08012648: - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126C0 - .4byte _080126C0 - .4byte _080126C0 - .4byte _080126C0 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126C0 - .4byte _080126C0 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126C0 - .4byte _080126C0 - .4byte _080126C0 - .4byte _080126C0 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 - .4byte _080126B8 -_080126B8: - ldr r0, =gStringVar4 - ldr r1, =gText_AwaitingCommunication - bl StringExpandPlaceholders -_080126C0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801262C - - thumb_func_start sub_80126CC -sub_80126CC: @ 80126CC - push {lr} - subs r0, 0x9 - cmp r0, 0x12 - bhi _08012734 - lsls r0, 2 - ldr r1, =_080126E4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080126E4: - .4byte _08012730 - .4byte _08012730 - .4byte _08012730 - .4byte _08012734 - .4byte _08012734 - .4byte _08012734 - .4byte _08012730 - .4byte _08012730 - .4byte _08012734 - .4byte _08012734 - .4byte _08012734 - .4byte _08012734 - .4byte _08012734 - .4byte _08012734 - .4byte _08012730 - .4byte _08012730 - .4byte _08012730 - .4byte _08012730 - .4byte _08012730 -_08012730: - movs r0, 0x1 - b _08012736 -_08012734: - movs r0, 0 -_08012736: - pop {r1} - bx r1 - thumb_func_end sub_80126CC - - thumb_func_start BerryBlenderLinkBecomeLeader -BerryBlenderLinkBecomeLeader: @ 801273C - push {lr} - ldr r0, =sub_8012780 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_02022C30 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - str r1, [r2] - ldr r0, =gUnknown_03000DA0 - str r1, [r0] - movs r0, 0 - strb r0, [r1, 0xC] - strb r0, [r1, 0xD] - ldr r1, =gScriptResult - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end BerryBlenderLinkBecomeLeader - - thumb_func_start sub_8012780 -sub_8012780: @ 8012780 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_02022C30 - ldr r6, [r0] - ldrb r0, [r6, 0xC] - cmp r0, 0x1E - bls _0801279A - bl _08012F50 -_0801279A: - lsls r0, 2 - ldr r1, =_080127AC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080127AC: - .4byte _08012828 - .4byte _08012F50 - .4byte _08012F50 - .4byte _080128A0 - .4byte _080129C8 - .4byte _08012A50 - .4byte _08012A6C - .4byte _08012B8C - .4byte _08012F50 - .4byte _08012AFC - .4byte _08012B14 - .4byte _08012BA8 - .4byte _08012C5C - .4byte _08012D5A - .4byte _08012D78 - .4byte _08012D8A - .4byte _08012DA8 - .4byte _08012E62 - .4byte _08012E78 - .4byte _08012DF2 - .4byte _08012E10 - .4byte _08012ED0 - .4byte _08012EFC - .4byte _08012ED0 - .4byte _08012EE6 - .4byte _08012F50 - .4byte _08012F14 - .4byte _08012F50 - .4byte _08012F50 - .4byte _08012B54 - .4byte _08012EB6 -_08012828: - ldr r0, =gSpecialVar_0x8004 - ldrh r2, [r0] - adds r3, r0, 0 - cmp r2, 0x14 - bne _08012848 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000ca9 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _08012848 - adds r0, r2, 0x1 - strh r0, [r3] -_08012848: - ldr r2, =gUnknown_02022C2C - ldr r1, =gUnknown_082F00C4 - ldrh r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - strb r0, [r2] - ldr r4, =gUnknown_02022C2D - ldrh r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsrs r0, 8 - strb r0, [r4] - ldrb r0, [r2] - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - bl sub_800B488 - bl sub_8009734 - ldrb r1, [r4] - movs r0, 0xF - ands r0, r1 - bl sub_8011C10 - movs r0, 0x3 - strb r0, [r6, 0xC] - b _08012F50 - .pool -_080128A0: - movs r0, 0x70 - bl AllocZeroed - str r0, [r6, 0x4] - movs r0, 0xA0 - bl AllocZeroed - str r0, [r6] - movs r0, 0xA0 - bl AllocZeroed - str r0, [r6, 0x8] - ldr r0, [r6, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r6] - movs r1, 0x5 - bl sub_8017580 - ldr r0, [r6] - adds r1, r0, 0 - adds r1, 0x10 - bl sub_800DF90 - ldr r1, [r6] - movs r3, 0 - movs r0, 0 - strh r0, [r1, 0x18] - ldr r2, [r6] - ldrb r1, [r2, 0x1A] - subs r0, 0x4 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1A] - ldr r2, [r6] - ldrb r1, [r2, 0x1A] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x1A] - ldr r0, [r6] - strb r3, [r0, 0x1B] - ldr r0, [r6, 0x4] - movs r1, 0xFF - bl sub_8016FC0 - strb r0, [r6, 0x17] - ldr r0, =gUnknown_082F00BC - bl AddWindow - strb r0, [r6, 0x10] - ldr r0, =gUnknown_02022C2D - ldrb r0, [r0] - movs r1, 0xF - ands r1, r0 - cmp r1, 0x2 - blt _08012938 - cmp r1, 0x4 - ble _08012928 - cmp r1, 0x5 - beq _08012930 - b _08012938 - .pool -_08012928: - ldr r0, =gUnknown_082F011C - b _08012932 - .pool -_08012930: - ldr r0, =gUnknown_082F0124 -_08012932: - bl AddWindow - strb r0, [r6, 0xF] -_08012938: - ldr r0, =gUnknown_082F012C - bl AddWindow - strb r0, [r6, 0x11] - ldrb r0, [r6, 0x10] - movs r1, 0x22 - bl FillWindowPixelBuffer - ldrb r0, [r6, 0x10] - ldr r2, =gUnknown_082EDBC4 - movs r3, 0x1 - mov r8, r3 - str r3, [sp] - movs r4, 0x4 - str r4, [sp, 0x4] - movs r1, 0 - movs r3, 0x8 - bl sub_80173E0 - ldrb r0, [r6, 0x10] - bl PutWindowTilemap - ldrb r0, [r6, 0x10] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r6, 0xF] - movs r1, 0 - bl sub_81973FC - ldr r0, =gUnknown_03006310 - adds r2, r0, 0 - ldr r1, =gUnknown_082F015C - ldm r1!, {r3,r5,r7} - stm r2!, {r3,r5,r7} - ldm r1!, {r3,r5,r7} - stm r2!, {r3,r5,r7} - ldrb r1, [r6, 0xF] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0 - bl ListMenuInit - strb r0, [r6, 0x12] - ldrb r0, [r6, 0x11] - movs r1, 0 - bl sub_81973FC - ldrb r0, [r6, 0x11] - bl PutWindowTilemap - ldrb r0, [r6, 0x11] - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl CopyBgTilemapBufferToVram - mov r5, r8 - strb r5, [r6, 0x13] - strb r4, [r6, 0xC] - b _08012F50 - .pool -_080129C8: - ldr r0, =gStringVar1 - ldr r2, =gUnknown_082F0048 - ldr r4, =gUnknown_02022C2C - ldrb r1, [r4] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C2D - ldrb r2, [r0] - lsrs r0, r2, 4 - cmp r0, 0 - beq _08012A2C - ldrb r1, [r6, 0x13] - subs r0, 0x1 - cmp r1, r0 - ble _08012A18 - movs r0, 0xF - ands r0, r2 - cmp r0, 0 - beq _08012A18 - ldr r0, =gStringVar4 - ldr r1, =gText_AwaitingLink - bl StringExpandPlaceholders - b _08012A34 - .pool -_08012A18: - ldr r0, =gStringVar4 - ldr r1, =gText_AwaitingCommunication - bl StringExpandPlaceholders - b _08012A34 - .pool -_08012A2C: - ldr r0, =gStringVar4 - ldrb r1, [r4] - bl sub_801262C -_08012A34: - ldrb r0, [r6, 0x11] - ldr r1, =gUnknown_02022C2D - ldrb r1, [r1] - ldrb r2, [r6, 0x13] - bl sub_80124EC - movs r0, 0x5 - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012A50: - adds r0, r6, 0 - adds r0, 0xD - ldr r1, =gStringVar4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08012A62 - b _08012F50 -_08012A62: - movs r0, 0x6 - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012A6C: - adds r0, r6, 0 - movs r1, 0x7 - movs r2, 0xA - bl sub_801320C - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08012AA8 - ldrb r0, [r6, 0x13] - cmp r0, 0x1 - bne _08012A90 - movs r0, 0x17 - b _08012AA6 - .pool -_08012A90: - ldr r0, =gUnknown_02022C2D - ldrb r1, [r0] - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - beq _08012AA4 - movs r0, 0x1E - b _08012AA6 - .pool -_08012AA4: - movs r0, 0x13 -_08012AA6: - strb r0, [r6, 0xC] -_08012AA8: - ldr r0, =gUnknown_02022C2D - ldrb r2, [r0] - lsrs r0, r2, 4 - cmp r0, 0 - beq _08012ADE - ldrb r1, [r6, 0x13] - subs r0, 0x1 - cmp r1, r0 - ble _08012ADE - movs r4, 0xF - adds r0, r4, 0 - ands r0, r2 - cmp r0, 0 - beq _08012ADE - bl sub_8012240 - cmp r0, 0 - beq _08012ADE - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _08012ADE - strb r4, [r6, 0xC] - bl sub_800EF38 -_08012ADE: - ldrb r0, [r6, 0xC] - cmp r0, 0x6 - beq _08012AE6 - b _08012F50 -_08012AE6: - bl sub_80105EC - cmp r0, 0 - bne _08012AF0 - b _08012F50 -_08012AF0: - b _08012C56 - .pool -_08012AFC: - bl sub_80105EC - cmp r0, 0 - beq _08012B06 - b _08012F50 -_08012B06: - movs r0, 0x6 - strb r0, [r6, 0xC] - ldr r0, [r6] - bl sub_8013398 - strb r0, [r6, 0x13] - b _08012F50 -_08012B14: - movs r3, 0 - ldr r0, =gUnknown_02022C2C - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x2 - bne _08012B24 - movs r3, 0x1 -_08012B24: - adds r0, r6, 0 - adds r0, 0xD - ldr r2, =gUnknown_082EDDC4 - lsls r1, r3, 2 - adds r1, r2 - ldr r1, [r1] - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08012B3C - b _08012F50 -_08012B3C: - ldr r0, [r6] - bl sub_8013398 - strb r0, [r6, 0x13] - ldrb r0, [r6, 0x12] - bl sub_81AE70C - b _08012E5C - .pool -_08012B54: - ldr r0, =gUnknown_02022C2D - ldrb r0, [r0] - movs r1, 0xF - ands r1, r0 - movs r0, 0x2 - eors r1, r0 - negs r0, r1 - orrs r0, r1 - lsrs r3, r0, 31 - adds r0, r6, 0 - adds r0, 0xD - ldr r2, =gUnknown_082EDDC4 - lsls r1, r3, 2 - adds r1, r2 - ldr r1, [r1] - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08012B7E - b _08012F50 -_08012B7E: - movs r0, 0x15 - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012B8C: - adds r0, r6, 0 - adds r0, 0xD - ldr r1, =gStringVar4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08012B9E - b _08012F50 -_08012B9E: - movs r0, 0xB - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012BA8: - adds r4, r6, 0 - adds r4, 0xD - ldrb r1, [r6, 0x13] - lsls r1, 5 - ldr r0, [r6] - adds r0, r1 - adds r0, 0x2 - bl sub_8015658 - lsls r0, 16 - lsrs r0, 16 - ldrb r2, [r6, 0x13] - lsls r2, 5 - ldr r1, [r6] - adds r1, r2 - adds r1, 0x10 - bl sub_801064C - adds r1, r0, 0 - adds r0, r4, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08012C28 - cmp r1, r0 - bgt _08012BEC - subs r0, 0x2 - cmp r1, r0 - beq _08012C56 - b _08012F50 -_08012BEC: - cmp r1, 0 - beq _08012BF6 - cmp r1, 0x1 - beq _08012C28 - b _08012F50 -_08012BF6: - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - movs r0, 0x5 - strb r0, [r6, 0x19] - ldrb r1, [r6, 0x13] - lsls r1, 5 - ldr r0, [r6] - adds r0, r1 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldrb r0, [r6, 0x13] - lsls r0, 5 - ldr r2, [r6] - adds r2, r0 - adds r2, 0x10 - movs r0, 0x5 - b _08012C4C -_08012C28: - movs r0, 0x6 - strb r0, [r6, 0x19] - ldrb r1, [r6, 0x13] - lsls r1, 5 - ldr r0, [r6] - adds r0, r1 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldrb r0, [r6, 0x13] - lsls r0, 5 - ldr r2, [r6] - adds r2, r0 - adds r2, 0x10 - movs r0, 0x6 -_08012C4C: - bl sub_8010688 - movs r0, 0xC - strb r0, [r6, 0xC] - b _08012F50 -_08012C56: - movs r0, 0x9 - strb r0, [r6, 0xC] - b _08012F50 -_08012C5C: - ldrb r1, [r6, 0x13] - lsls r1, 5 - ldr r0, [r6] - adds r0, r1 - adds r0, 0x2 - bl sub_8015658 - lsls r0, 16 - lsrs r0, 16 - ldrb r2, [r6, 0x13] - lsls r2, 5 - ldr r1, [r6] - adds r1, r2 - adds r1, 0x10 - bl sub_8010714 - cmp r0, 0x1 - bne _08012D4A - ldrb r0, [r6, 0x19] - cmp r0, 0x5 - bne _08012D04 - ldr r1, [r6] - ldrb r0, [r6, 0x13] - lsls r0, 5 - adds r1, r0 - movs r0, 0 - strb r0, [r1, 0x1B] - ldrb r0, [r6, 0x12] - bl sub_81AE70C - ldrb r0, [r6, 0x13] - adds r0, 0x1 - strb r0, [r6, 0x13] - ldr r1, =gUnknown_02022C2D - ldrb r1, [r1] - movs r3, 0xF - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r3, 0 - ands r0, r1 - cmp r2, r0 - bne _08012D40 - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - bne _08012CBC - cmp r2, 0x4 - bne _08012CC4 -_08012CBC: - strb r3, [r6, 0xC] - b _08012CE0 - .pool -_08012CC4: - ldr r0, =gStringVar1 - ldrb r2, [r6, 0x13] - lsls r2, 5 - subs r2, 0x20 - ldr r1, [r6] - adds r1, r2 - bl sub_8018404 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EDC9C - bl StringExpandPlaceholders - movs r0, 0xD - strb r0, [r6, 0xC] -_08012CE0: - bl sub_800EF38 - ldrb r0, [r6, 0x11] - ldr r1, =gUnknown_02022C2D - ldrb r1, [r1] - ldrb r2, [r6, 0x13] - bl sub_80124EC - b _08012D44 - .pool -_08012D04: - ldrb r1, [r6, 0x13] - lsls r1, 5 - ldr r0, [r6] - adds r0, r1 - adds r4, r0, 0 - adds r4, 0x10 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl sub_8011DC0 - ldr r1, [r6] - ldrb r0, [r6, 0x13] - lsls r0, 5 - adds r1, r0 - ldrb r2, [r1, 0x1A] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1A] - ldr r0, [r6] - bl sub_8013398 - ldrb r0, [r6, 0x12] - bl sub_81AE70C -_08012D40: - movs r0, 0x4 - strb r0, [r6, 0xC] -_08012D44: - movs r0, 0 - strb r0, [r6, 0x19] - b _08012F50 -_08012D4A: - cmp r0, 0x2 - beq _08012D50 - b _08012F50 -_08012D50: - movs r0, 0 - movs r1, 0 - bl sub_8011A64 - b _08012E5C -_08012D5A: - adds r0, r6, 0 - adds r0, 0xD - ldr r1, =gStringVar4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08012D6C - b _08012F50 -_08012D6C: - movs r0, 0xE - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012D78: - ldrb r0, [r6, 0xE] - adds r0, 0x1 - strb r0, [r6, 0xE] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x78 - bhi _08012D88 - b _08012F50 -_08012D88: - b _08012DCE -_08012D8A: - adds r0, r6, 0 - adds r0, 0xD - ldr r1, =gUnknown_082EDC5C - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08012D9C - b _08012F50 -_08012D9C: - movs r0, 0x10 - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012DA8: - adds r0, r6, 0 - adds r0, 0xD - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _08012DCE - cmp r1, 0 - bgt _08012DC8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08012DD4 - b _08012F50 -_08012DC8: - cmp r1, 0x1 - beq _08012DD4 - b _08012F50 -_08012DCE: - movs r0, 0x11 - strb r0, [r6, 0xC] - b _08012F50 -_08012DD4: - ldr r0, =gUnknown_02022C2D - ldrb r1, [r0] - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - beq _08012DEC - movs r0, 0x1E - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012DEC: - movs r0, 0x13 - strb r0, [r6, 0xC] - b _08012F50 -_08012DF2: - adds r0, r6, 0 - adds r0, 0xD - ldr r1, =gUnknown_082EDC78 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08012E04 - b _08012F50 -_08012E04: - movs r0, 0x14 - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012E10: - adds r0, r6, 0 - adds r0, 0xD - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _08012EC6 - cmp r1, 0 - bgt _08012E30 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08012E36 - b _08012F50 -_08012E30: - cmp r1, 0x1 - beq _08012E36 - b _08012F50 -_08012E36: - ldr r0, =gUnknown_02022C2D - ldrb r2, [r0] - movs r0, 0xF0 - ands r0, r2 - cmp r0, 0 - beq _08012E4C - movs r0, 0xF - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012E4C: - movs r3, 0xF - ldrb r1, [r6, 0x13] - adds r0, r3, 0 - ands r0, r2 - cmp r1, r0 - bne _08012E5C - strb r3, [r6, 0xC] - b _08012F50 -_08012E5C: - movs r0, 0x4 - strb r0, [r6, 0xC] - b _08012F50 -_08012E62: - adds r0, r6, 0 - movs r1, 0x7 - movs r2, 0x1D - bl sub_801320C - lsls r0, 24 - cmp r0, 0 - bne _08012F50 - movs r0, 0x12 - strb r0, [r6, 0xC] - b _08012F50 -_08012E78: - bl sub_800EF1C - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _08012EAE - movs r0, 0 - bl sub_800EF58 - cmp r0, 0 - beq _08012E94 - movs r0, 0x1A - strb r0, [r6, 0xC] - b _08012F50 -_08012E94: - ldrh r0, [r6, 0x1A] - adds r0, 0x1 - strh r0, [r6, 0x1A] - lsls r0, 16 - movs r1, 0x96 - lsls r1, 17 - cmp r0, r1 - bls _08012F50 - movs r0, 0x1D - strb r0, [r6, 0xC] - movs r0, 0 - strb r0, [r6, 0xD] - b _08012F50 -_08012EAE: - movs r0, 0x1D - strb r0, [r6, 0xC] - strb r1, [r6, 0xD] - b _08012F50 -_08012EB6: - adds r0, r6, 0 - adds r0, 0xD - ldr r1, =gUnknown_082EDD58 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - beq _08012F50 -_08012EC6: - movs r0, 0x17 - strb r0, [r6, 0xC] - b _08012F50 - .pool -_08012ED0: - bl sub_800E084 - bl sub_800EDD4 - adds r0, r6, 0 - bl sub_8012F64 - ldrb r0, [r6, 0xC] - adds r0, 0x1 - strb r0, [r6, 0xC] - b _08012F50 -_08012EE6: - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask - ldr r1, =gScriptResult - movs r0, 0x5 - strh r0, [r1] - b _08012F50 - .pool -_08012EFC: - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask - ldr r1, =gScriptResult - movs r0, 0x8 - strh r0, [r1] - b _08012F50 - .pool -_08012F14: - bl sub_8011A80 - cmp r0, 0 - beq _08012F22 - movs r0, 0x1D - strb r0, [r6, 0xC] - b _08012F50 -_08012F22: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08012F50 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - bl sub_80126CC - cmp r0, 0 - beq _08012F3A - bl sub_801103C -_08012F3A: - movs r0, 0x1 - bl sub_8011068 - bl sub_80149C4 - adds r0, r6, 0 - bl sub_8012F64 - adds r0, r4, 0 - bl DestroyTask -_08012F50: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8012780 - - thumb_func_start sub_8012F64 -sub_8012F64: @ 8012F64 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0x11] - bl ClearWindowTilemap - ldrb r0, [r4, 0x11] - movs r1, 0 - bl sub_819746C - ldrb r0, [r4, 0x12] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldrb r0, [r4, 0x10] - bl ClearWindowTilemap - ldrb r0, [r4, 0xF] - movs r1, 0 - bl sub_819746C - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrb r0, [r4, 0x11] - bl RemoveWindow - ldrb r0, [r4, 0xF] - bl RemoveWindow - ldrb r0, [r4, 0x10] - bl RemoveWindow - ldrb r0, [r4, 0x17] - bl DestroyTask - ldr r0, [r4, 0x8] - bl Free - ldr r0, [r4] - bl Free - ldr r0, [r4, 0x4] - bl Free - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8012F64 - - thumb_func_start sub_8012FC4 -sub_8012FC4: @ 8012FC4 - push {lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r1, 24 - subs r0, r1, 0x1 - cmp r0, 0x1B - bhi _08013070 - lsls r0, 2 - ldr r1, =_08012FE0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08012FE0: - .4byte _08013050 - .4byte _08013050 - .4byte _08013068 - .4byte _08013050 - .4byte _08013070 - .4byte _08013070 - .4byte _08013070 - .4byte _08013070 - .4byte _08013068 - .4byte _08013068 - .4byte _08013068 - .4byte _08013070 - .4byte _08013070 - .4byte _08013050 - .4byte _08013068 - .4byte _08013068 - .4byte _08013070 - .4byte _08013070 - .4byte _08013070 - .4byte _08013070 - .4byte _08013058 - .4byte _08013058 - .4byte _08013068 - .4byte _08013068 - .4byte _08013068 - .4byte _08013068 - .4byte _08013068 - .4byte _08013050 -_08013050: - ldr r1, =gUnknown_082EDBE8 - b _0801305A - .pool -_08013058: - ldr r1, =gUnknown_082EDC0C -_0801305A: - adds r0, r2, 0 - bl StringExpandPlaceholders - b _08013070 - .pool -_08013068: - ldr r1, =gUnknown_082EDC34 - adds r0, r2, 0 - bl StringExpandPlaceholders -_08013070: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8012FC4 - - thumb_func_start sub_8013078 -sub_8013078: @ 8013078 - push {lr} - lsls r1, 24 - lsrs r1, 24 - adds r2, r1, 0 - cmp r1, 0x44 - beq _08013098 - cmp r1, 0x44 - bgt _0801308E - cmp r1, 0x41 - beq _08013098 - b _080130AA -_0801308E: - cmp r2, 0x45 - beq _080130A4 - cmp r2, 0x48 - beq _080130A4 - b _080130AA -_08013098: - ldr r1, =gUnknown_082EE560 - bl StringExpandPlaceholders - b _080130AA - .pool -_080130A4: - ldr r1, =gUnknown_082EE57C - bl StringExpandPlaceholders -_080130AA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8013078 - - thumb_func_start sub_80130B4 -sub_80130B4: @ 80130B4 - push {lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r1, 24 - subs r0, r1, 0x1 - cmp r0, 0x1B - bhi _08013158 - lsls r0, 2 - ldr r1, =_080130D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080130D0: - .4byte _08013140 - .4byte _08013140 - .4byte _08013150 - .4byte _08013140 - .4byte _08013158 - .4byte _08013158 - .4byte _08013158 - .4byte _08013158 - .4byte _08013150 - .4byte _08013150 - .4byte _08013150 - .4byte _08013158 - .4byte _08013158 - .4byte _08013140 - .4byte _08013150 - .4byte _08013150 - .4byte _08013158 - .4byte _08013158 - .4byte _08013158 - .4byte _08013158 - .4byte _08013140 - .4byte _08013140 - .4byte _08013150 - .4byte _08013150 - .4byte _08013150 - .4byte _08013150 - .4byte _08013150 - .4byte _08013140 -_08013140: - ldr r1, =gUnknown_082EFC3C - adds r0, r2, 0 - bl StringExpandPlaceholders - b _08013158 - .pool -_08013150: - ldr r1, =gUnknown_082EFC54 - adds r0, r2, 0 - bl StringExpandPlaceholders -_08013158: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80130B4 - - thumb_func_start sub_8013160 -sub_8013160: @ 8013160 - push {lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r1, 24 - subs r0, r1, 0x1 - cmp r0, 0x1B - bhi _08013204 - lsls r0, 2 - ldr r1, =_0801317C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801317C: - .4byte _080131EC - .4byte _080131EC - .4byte _080131FC - .4byte _080131EC - .4byte _08013204 - .4byte _08013204 - .4byte _08013204 - .4byte _08013204 - .4byte _080131FC - .4byte _080131FC - .4byte _080131FC - .4byte _08013204 - .4byte _08013204 - .4byte _080131EC - .4byte _080131FC - .4byte _080131FC - .4byte _08013204 - .4byte _08013204 - .4byte _08013204 - .4byte _08013204 - .4byte _080131EC - .4byte _080131EC - .4byte _080131FC - .4byte _080131FC - .4byte _080131FC - .4byte _080131FC - .4byte _080131FC - .4byte _080131EC -_080131EC: - ldr r1, =gUnknown_082EDDF4 - adds r0, r2, 0 - bl StringExpandPlaceholders - b _08013204 - .pool -_080131FC: - ldr r1, =gUnknown_082EDE0C - adds r0, r2, 0 - bl StringExpandPlaceholders -_08013204: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8013160 - - thumb_func_start sub_801320C -sub_801320C: @ 801320C - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - adds r5, r2, 0 - ldr r0, [r4] - bl sub_80132D4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08013228 - cmp r0, 0x2 - beq _0801325C - b _08013270 -_08013228: - movs r0, 0x2 - bl PlaySE - ldrb r0, [r4, 0x12] - bl sub_81AE70C - ldr r0, =gStringVar2 - ldrb r2, [r4, 0x13] - lsls r2, 5 - ldr r1, [r4] - adds r1, r2 - bl sub_8018404 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_02022C2C - ldrb r1, [r1] - bl sub_8012FC4 - strb r6, [r4, 0xC] - b _08013270 - .pool -_0801325C: - movs r0, 0 - movs r1, 0 - bl sub_8011A64 - ldrb r0, [r4, 0x12] - bl sub_81AE70C - strb r5, [r4, 0xC] - movs r0, 0x1 - b _08013272 -_08013270: - movs r0, 0 -_08013272: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801320C - - thumb_func_start sub_8013278 -sub_8013278: @ 8013278 - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r2, 24 - lsrs r6, r2, 24 - ldr r0, =gUnknown_02022C30 - ldr r3, [r0] - movs r2, 0 - ldr r1, [r3] - lsls r0, r4, 5 - adds r1, r0 - ldrb r0, [r1, 0x1A] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - beq _080132A8 - cmp r0, 0x2 - beq _080132B2 - b _080132B4 - .pool -_080132A8: - ldrb r0, [r1, 0x1B] - cmp r0, 0 - beq _080132B4 - movs r2, 0x2 - b _080132B4 -_080132B2: - movs r2, 0x1 -_080132B4: - lsls r0, r4, 5 - ldr r3, [r3] - adds r3, r0 - str r2, [sp] - lsls r0, r4, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r1, 0 - adds r2, r6, 0 - bl sub_80178A0 - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8013278 - - thumb_func_start sub_80132D4 -sub_80132D4: @ 80132D4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - ldr r0, =gUnknown_02022C30 - ldr r5, [r0] - movs r0, 0 - mov r8, r0 - movs r3, 0x1 -_080132E8: - ldr r0, [r5] - lsls r6, r3, 5 - adds r2, r0, r6 - ldrb r0, [r2, 0x1A] - lsls r0, 30 - lsrs r0, 30 - mov r9, r0 - cmp r0, 0x1 - bne _08013348 - ldr r1, [r5, 0x4] - adds r0, r2, 0 - str r3, [sp] - bl sub_80176E4 - adds r4, r0, 0 - ldr r3, [sp] - cmp r4, 0xFF - beq _08013330 - ldr r1, [r5] - ldr r0, [r5, 0x4] - lsls r2, r4, 3 - subs r2, r4 - lsls r2, 2 - adds r1, r6 - adds r0, r2 - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - ldr r0, [r5] - adds r0, r6 - mov r1, r9 - strh r1, [r0, 0x18] - b _08013348 - .pool -_08013330: - ldr r2, [r5] - adds r2, r6 - ldrb r1, [r2, 0x1A] - movs r4, 0x4 - negs r4, r4 - adds r0, r4, 0 - ands r1, r0 - movs r0, 0x2 - orrs r1, r0 - strb r1, [r2, 0x1A] - movs r7, 0x2 - mov r8, r7 -_08013348: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x4 - bls _080132E8 - movs r6, 0 - movs r4, 0x3 -_08013356: - ldr r0, [r5] - ldr r1, [r5, 0x4] - adds r1, r6 - movs r2, 0x5 - bl sub_8017734 - adds r6, 0x1C - subs r4, 0x1 - ldr r0, [r5] - cmp r4, 0 - bge _08013356 - mov r1, r8 - cmp r1, 0x2 - beq _08013388 - adds r1, r0, 0 - movs r4, 0x4 -_08013376: - ldrb r0, [r1, 0x1B] - cmp r0, 0 - beq _08013380 - movs r2, 0x1 - mov r8, r2 -_08013380: - adds r1, 0x20 - subs r4, 0x1 - cmp r4, 0 - bge _08013376 -_08013388: - mov r0, r8 - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80132D4 - - thumb_func_start sub_8013398 -sub_8013398: @ 8013398 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_02022C30 - ldr r4, [r0] - movs r3, 0 -_080133A8: - ldr r0, [r4, 0x8] - lsls r2, r3, 5 - ldr r1, [r4] - adds r0, r2 - adds r1, r2 - ldm r1!, {r2,r5,r6} - stm r0!, {r2,r5,r6} - ldm r1!, {r2,r5,r7} - stm r0!, {r2,r5,r7} - ldm r1!, {r6,r7} - stm r0!, {r6,r7} - adds r3, 0x1 - ldr r0, [r4, 0x8] - ldr r1, [r4] - cmp r3, 0x4 - ble _080133A8 - movs r5, 0 - mov r8, r1 - mov r9, r0 - movs r3, 0x4 -_080133D0: - mov r1, r9 - ldrb r0, [r1, 0x1A] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _080133F2 - lsls r0, r5, 5 - add r0, r8 - ldm r1!, {r2,r6,r7} - stm r0!, {r2,r6,r7} - ldm r1!, {r2,r6,r7} - stm r0!, {r2,r6,r7} - ldm r1!, {r2,r6} - stm r0!, {r2,r6} - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_080133F2: - movs r7, 0x20 - add r9, r7 - subs r3, 0x1 - cmp r3, 0 - bge _080133D0 - mov r10, r5 - cmp r5, 0x4 - bhi _08013454 - ldr r0, =gUnknown_082F045C - mov r9, r0 - movs r1, 0 - mov r12, r1 - movs r2, 0x4 - negs r2, r2 - mov r8, r2 -_08013410: - ldr r1, [r4] - lsls r3, r5, 5 - adds r1, r3 - mov r0, r9 - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - ldr r0, [r4] - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x18] - ldr r1, [r4] - adds r1, r3 - ldrb r2, [r1, 0x1A] - mov r0, r8 - ands r0, r2 - strb r0, [r1, 0x1A] - ldr r1, [r4] - adds r1, r3 - ldrb r2, [r1, 0x1A] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1A] - ldr r0, [r4] - adds r0, r3 - mov r6, r12 - strb r6, [r0, 0x1B] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _08013410 -_08013454: - movs r3, 0 - ldr r1, [r4] - ldrb r0, [r1, 0x1A] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _08013474 - ldrb r0, [r1, 0x1B] - cmp r0, 0x40 - bne _08013474 - mov r10, r3 - b _08013494 - .pool -_08013474: - adds r3, 0x1 - cmp r3, 0x4 - bgt _08013494 - lsls r0, r3, 5 - adds r2, r1, r0 - ldrb r0, [r2, 0x1A] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _08013474 - ldrb r0, [r2, 0x1B] - cmp r0, 0x40 - bne _08013474 - lsls r0, r3, 24 - lsrs r0, 24 - mov r10, r0 -_08013494: - mov r0, r10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8013398 - - thumb_func_start BerryBlenderLinkJoinGroup -BerryBlenderLinkJoinGroup: @ 80134A4 - push {lr} - ldr r0, =sub_80134E8 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_02022C30 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - str r1, [r2] - ldr r0, =gUnknown_03000DA4 - str r1, [r0] - movs r0, 0 - strb r0, [r1, 0x8] - strb r0, [r1, 0x9] - ldr r1, =gScriptResult - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end BerryBlenderLinkJoinGroup - - thumb_func_start sub_80134E8 -sub_80134E8: @ 80134E8 - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_02022C30 - ldr r6, [r0] - ldrb r0, [r6, 0x8] - cmp r0, 0x17 - bls _080134FC - b _08013B82 -_080134FC: - lsls r0, 2 - ldr r1, =_08013510 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08013510: - .4byte _08013570 - .4byte _080135E0 - .4byte _0801360C - .4byte _080136D8 - .4byte _08013B82 - .4byte _08013788 - .4byte _080137C4 - .4byte _08013A10 - .4byte _08013A2C - .4byte _08013A7A - .4byte _08013A8C - .4byte _08013B14 - .4byte _08013A8C - .4byte _08013AE4 - .4byte _08013A8C - .4byte _08013B24 - .4byte _08013B82 - .4byte _08013B82 - .4byte _08013A8C - .4byte _08013B44 - .4byte _08013A8C - .4byte _08013B78 - .4byte _08013B82 - .4byte _08013B68 -_08013570: - ldr r0, =gSpecialVar_0x8004 - ldrh r2, [r0] - adds r3, r0, 0 - cmp r2, 0x14 - bne _08013590 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000ca9 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _08013590 - adds r0, r2, 0x1 - strh r0, [r3] -_08013590: - ldr r2, =gUnknown_02022C2C - ldr r1, =gUnknown_082F0530 - ldrh r0, [r3] - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldrb r0, [r2] - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - bl sub_800B488 - bl sub_8009734 - bl sub_8011C5C - movs r0, 0x70 - bl AllocZeroed - str r0, [r6, 0x4] - movs r0, 0x80 - lsls r0, 2 - bl AllocZeroed - str r0, [r6] - movs r0, 0x1 - strb r0, [r6, 0x8] - b _08013B82 - .pool -_080135E0: - adds r0, r6, 0 - adds r0, 0x9 - ldr r2, =gUnknown_082EFB70 - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _080135FC - b _08013B82 -_080135FC: - movs r0, 0x2 - strb r0, [r6, 0x8] - b _08013B82 - .pool -_0801360C: - ldr r0, [r6, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r6] - movs r1, 0x10 - bl sub_8017580 - ldr r0, [r6, 0x4] - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - bl sub_8016FC0 - movs r4, 0 - strb r0, [r6, 0x11] - ldr r0, =gUnknown_082F00BC - bl AddWindow - strb r0, [r6, 0xC] - ldr r0, =gUnknown_082F0174 - bl AddWindow - strb r0, [r6, 0xB] - ldr r0, =gUnknown_082F017C - bl AddWindow - strb r0, [r6, 0xD] - ldrb r0, [r6, 0xC] - movs r1, 0x22 - bl FillWindowPixelBuffer - ldrb r0, [r6, 0xC] - ldr r2, =gUnknown_082EF7DC - movs r1, 0x1 - str r1, [sp] - movs r1, 0x4 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x8 - bl sub_80173E0 - ldrb r0, [r6, 0xC] - bl PutWindowTilemap - ldrb r0, [r6, 0xC] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r6, 0xB] - movs r1, 0 - bl sub_81973FC - ldr r0, =gUnknown_03006310 - adds r2, r0, 0 - ldr r1, =gUnknown_082F0204 - ldm r1!, {r3,r5,r7} - stm r2!, {r3,r5,r7} - ldm r1!, {r3,r5,r7} - stm r2!, {r3,r5,r7} - ldrb r1, [r6, 0xB] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0 - bl ListMenuInit - strb r0, [r6, 0xE] - ldrb r0, [r6, 0xD] - movs r1, 0 - bl sub_81973FC - ldrb r0, [r6, 0xD] - bl PutWindowTilemap - ldrb r0, [r6, 0xD] - bl sub_80125BC - ldrb r0, [r6, 0xD] - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl CopyBgTilemapBufferToVram - strb r4, [r6, 0xF] - movs r0, 0x3 - strb r0, [r6, 0x8] - b _08013B82 - .pool -_080136D8: - bl sub_8013E44 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _080136F2 - cmp r4, 0x1 - beq _080136EA - b _08013A72 -_080136EA: - movs r0, 0x2 - bl PlaySE - b _08013A72 -_080136F2: - ldrb r0, [r6, 0xE] - bl ListMenuHandleInput - adds r4, r0, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08013770 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _08013770 - ldr r0, [r6] - lsls r1, r4, 5 - adds r0, r1 - ldrb r1, [r0, 0xA] - ldrb r0, [r0, 0x1A] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _08013768 - lsrs r0, r1, 7 - cmp r0, 0 - bne _08013768 - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_8013B8C - adds r1, r0, 0 - cmp r1, 0 - bne _08013744 - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_8013BD8 - movs r0, 0x5 - b _08013756 - .pool -_08013744: - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EDD50 - subs r1, 0x1 - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - movs r0, 0x12 -_08013756: - strb r0, [r6, 0x8] - movs r0, 0x6E - bl PlaySE - b _08013B82 - .pool -_08013768: - movs r0, 0x7 - bl PlaySE - b _08013B82 -_08013770: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0801377E - b _08013B82 -_0801377E: - movs r0, 0xA - strb r0, [r6, 0x8] - b _08013B82 - .pool -_08013788: - ldr r4, =gStringVar4 - ldr r0, =gUnknown_02022C2C - ldrb r1, [r0] - adds r0, r4, 0 - bl sub_80130B4 - adds r0, r6, 0 - adds r0, 0x9 - adds r1, r4, 0 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _080137A6 - b _08013B82 -_080137A6: - ldr r0, =gStringVar1 - ldrb r2, [r6, 0xF] - lsls r2, 5 - ldr r1, [r6] - adds r1, r2 - bl sub_8018404 - b _08013A86 - .pool -_080137C4: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0801387A - ldr r4, =gUnknown_02022C2C - ldr r1, [r6] - ldrb r0, [r6, 0xF] - lsls r0, 5 - adds r1, r0 - ldrb r0, [r1, 0xA] - lsls r0, 25 - lsrs r0, 25 - strb r0, [r4] - movs r0, 0 - movs r1, 0 - bl sub_8011A64 - ldrb r0, [r4] - subs r0, 0x1 - cmp r0, 0x1B - bhi _0801387A - lsls r0, 2 - ldr r1, =_08013804 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08013804: - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _0801387A - .4byte _0801387A - .4byte _0801387A - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _0801387A - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _0801387A - .4byte _0801387A - .4byte _0801387A - .4byte _0801387A - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 - .4byte _08013874 -_08013874: - movs r0, 0x14 - strb r0, [r6, 0x8] - b _08013B82 -_0801387A: - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r0, 0x8 - bls _0801388A - b _080139EC -_0801388A: - lsls r0, 2 - ldr r1, =_08013898 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08013898: - .4byte _080138BC - .4byte _080138C2 - .4byte _080139EC - .4byte _080139EC - .4byte _080138C8 - .4byte _080138C2 - .4byte _08013934 - .4byte _080139EC - .4byte _080138C2 -_080138BC: - movs r0, 0xC - strb r0, [r6, 0x8] - b _080139EC -_080138C2: - movs r0, 0xE - strb r0, [r6, 0x8] - b _080139EC -_080138C8: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_02022C2C - ldrb r1, [r4] - adds r0, r5, 0 - bl sub_8013160 - adds r0, r6, 0 - adds r0, 0x9 - adds r1, r5, 0 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _080138E6 - b _080139EC -_080138E6: - ldrb r0, [r4] - cmp r0, 0x1C - beq _080138F0 - cmp r0, 0xE - bne _08013904 -_080138F0: - movs r0, 0xC - movs r1, 0 - bl sub_8011A64 - b _080139EC - .pool -_08013904: - movs r0, 0x7 - movs r1, 0 - bl sub_8011A64 - ldr r0, =gStringVar1 - ldr r2, =gUnknown_082F0048 - ldrb r1, [r4] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - ldr r1, =gUnknown_082EDE48 - adds r0, r5, 0 - bl StringExpandPlaceholders - b _080139EC - .pool -_08013934: - ldrb r0, [r6, 0x15] - adds r2, r0, 0 - cmp r2, 0xF0 - bls _0801395C - adds r0, r6, 0 - adds r0, 0x9 - ldr r1, =gStringVar4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - beq _080139EC - movs r0, 0xC - movs r1, 0 - bl sub_8011A64 - movs r0, 0 - b _080139EA - .pool -_0801395C: - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - subs r0, 0x1 - cmp r0, 0x1B - bhi _080139E8 - lsls r0, 2 - ldr r1, =_08013978 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08013978: - .4byte _080139EC - .4byte _080139EC - .4byte _080139E8 - .4byte _080139EC - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139EC - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139E8 - .4byte _080139EC -_080139E8: - adds r0, r2, 0x1 -_080139EA: - strb r0, [r6, 0x15] -_080139EC: - bl sub_8011A74 - lsls r0, 24 - cmp r0, 0 - beq _080139F8 - b _08013B82 -_080139F8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08013A06 - b _08013B82 -_08013A06: - movs r0, 0x7 - strb r0, [r6, 0x8] - b _08013B82 - .pool -_08013A10: - adds r0, r6, 0 - adds r0, 0x9 - ldr r1, =gUnknown_082EDE64 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08013A22 - b _08013B82 -_08013A22: - movs r0, 0x8 - strb r0, [r6, 0x8] - b _08013B82 - .pool -_08013A2C: - adds r4, r6, 0 - adds r4, 0x9 - bl sub_8011A74 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08013A6A - cmp r1, r0 - bgt _08013A58 - subs r0, 0x2 - cmp r1, r0 - beq _08013A6E - b _08013B82 -_08013A58: - cmp r1, 0 - beq _08013A62 - cmp r1, 0x1 - beq _08013A6A - b _08013B82 -_08013A62: - bl sub_80106D4 - movs r0, 0x9 - b _08013A70 -_08013A6A: - movs r0, 0x5 - b _08013A70 -_08013A6E: - movs r0, 0x6 -_08013A70: - strb r0, [r6, 0x8] -_08013A72: - ldrb r0, [r6, 0xE] - bl sub_81AE70C - b _08013B82 -_08013A7A: - bl sub_8011A74 - lsls r0, 24 - cmp r0, 0 - bne _08013A86 - b _08013B82 -_08013A86: - movs r0, 0x6 - strb r0, [r6, 0x8] - b _08013B82 -_08013A8C: - ldrb r0, [r6, 0xD] - bl ClearWindowTilemap - ldrb r0, [r6, 0xD] - movs r1, 0 - bl sub_819746C - ldrb r0, [r6, 0xE] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldrb r0, [r6, 0xC] - bl ClearWindowTilemap - ldrb r0, [r6, 0xB] - movs r1, 0 - bl sub_819746C - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrb r0, [r6, 0xD] - bl RemoveWindow - ldrb r0, [r6, 0xB] - bl RemoveWindow - ldrb r0, [r6, 0xC] - bl RemoveWindow - ldrb r0, [r6, 0x11] - bl DestroyTask - ldr r0, [r6] - bl Free - ldr r0, [r6, 0x4] - bl Free - ldrb r0, [r6, 0x8] - adds r0, 0x1 - strb r0, [r6, 0x8] - b _08013B82 -_08013AE4: - bl sub_800E084 - adds r5, r6, 0 - adds r5, 0x9 - ldr r4, =gUnknown_082EDE9C - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 22 - adds r0, r4 - ldr r1, [r0] - adds r0, r5, 0 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - beq _08013B82 - ldr r0, =gScriptResult - movs r1, 0x6 - b _08013B58 - .pool -_08013B14: - bl sub_800E084 - ldr r0, =gScriptResult - movs r1, 0x5 - b _08013B58 - .pool -_08013B24: - bl sub_800E084 - adds r5, r6, 0 - adds r5, 0x9 - ldr r4, =gUnknown_082EDE9C - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 22 - adds r0, r4 - ldr r1, [r0] - adds r0, r5, 0 - b _08013B4A - .pool -_08013B44: - adds r0, r6, 0 - adds r0, 0x9 - ldr r1, =gStringVar4 -_08013B4A: - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - beq _08013B82 - ldr r0, =gScriptResult - movs r1, 0x8 -_08013B58: - strh r1, [r0] - movs r0, 0x17 - strb r0, [r6, 0x8] - b _08013B82 - .pool -_08013B68: - adds r0, r4, 0 - bl DestroyTask - bl sub_80173D4 - bl sub_800EDD4 - b _08013B82 -_08013B78: - bl sub_80149C4 - adds r0, r4, 0 - bl DestroyTask -_08013B82: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80134E8 - - thumb_func_start sub_8013B8C -sub_8013B8C: @ 8013B8C - push {lr} - lsls r1, 5 - ldr r0, [r0] - adds r3, r0, r1 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x4 - bne _08013BCE - ldrb r1, [r3, 0x1] - movs r0, 0x3C - ands r0, r1 - cmp r0, 0xC - beq _08013BCE - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r1, [r0, 0x9] - movs r2, 0x80 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _08013BC4 - movs r0, 0x1 - b _08013BD4 - .pool -_08013BC4: - ldrb r1, [r3] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08013BD2 -_08013BCE: - movs r0, 0 - b _08013BD4 -_08013BD2: - movs r0, 0x2 -_08013BD4: - pop {r1} - bx r1 - thumb_func_end sub_8013B8C - - thumb_func_start sub_8013BD8 -sub_8013BD8: @ 8013BD8 - push {r4,lr} - adds r4, r0, 0 - strb r1, [r4, 0xF] - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - ldrb r0, [r4, 0xE] - bl sub_81AE70C - ldr r0, =gStringVar1 - ldrb r2, [r4, 0xF] - lsls r2, 5 - ldr r1, [r4] - adds r1, r2 - bl sub_8018404 - ldr r1, =gUnknown_082F0530 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - ldrb r1, [r4, 0xF] - lsls r1, 5 - ldr r0, [r4] - adds r0, r1 - adds r4, r0, 0 - adds r4, 0x10 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl sub_8011FC8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8013BD8 - - thumb_func_start sub_8013C40 -sub_8013C40: @ 8013C40 - push {lr} - ldr r0, =sub_8013C7C - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gUnknown_02022C30 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r2, =gTasks + 0x8 - adds r1, r2 - str r1, [r3] - movs r2, 0 - strb r2, [r1, 0x8] - strb r2, [r1, 0x9] - ldr r2, =gUnknown_03000DA4 - str r1, [r2] - pop {r1} - bx r1 - .pool - thumb_func_end sub_8013C40 - - thumb_func_start sub_8013C7C -sub_8013C7C: @ 8013C7C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_02022C30 - ldr r4, [r0] - ldrb r0, [r4, 0x8] - cmp r0, 0xB - bhi _08013D80 - lsls r0, 2 - ldr r1, =_08013CA0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08013CA0: - .4byte _08013CD0 - .4byte _08013D80 - .4byte _08013D04 - .4byte _08013D28 - .4byte _08013D80 - .4byte _08013D80 - .4byte _08013D80 - .4byte _08013D80 - .4byte _08013D80 - .4byte _08013D80 - .4byte _08013D58 - .4byte _08013D76 -_08013CD0: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - bl sub_800B488 - bl sub_8009734 - bl sub_8011C5C - movs r0, 0x1 - bl sub_80111B0 - movs r0, 0x70 - bl AllocZeroed - str r0, [r4, 0x4] - movs r0, 0x80 - lsls r0, 2 - bl AllocZeroed - str r0, [r4] - movs r0, 0x2 - strb r0, [r4, 0x8] - b _08013D80 -_08013D04: - ldr r0, [r4, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r4] - movs r1, 0x10 - bl sub_8017580 - ldr r0, [r4, 0x4] - movs r1, 0xFF - bl sub_8016FC0 - movs r1, 0 - strb r0, [r4, 0x11] - strb r1, [r4, 0xF] - movs r0, 0x3 - strb r0, [r4, 0x8] - b _08013D80 -_08013D28: - bl sub_8013E44 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08013D3A - movs r0, 0x2 - bl PlaySE -_08013D3A: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - movs r2, 0x26 - ldrsh r0, [r1, r2] - cmp r0, 0xFF - bne _08013D80 - movs r0, 0xA - strb r0, [r4, 0x8] - b _08013D80 - .pool -_08013D58: - ldrb r0, [r4, 0x11] - bl DestroyTask - ldr r0, [r4] - bl Free - ldr r0, [r4, 0x4] - bl Free - bl sub_800EDD4 - ldrb r0, [r4, 0x8] - adds r0, 0x1 - strb r0, [r4, 0x8] - b _08013D80 -_08013D76: - bl sub_800EDD4 - adds r0, r5, 0 - bl DestroyTask -_08013D80: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8013C7C - - thumb_func_start sub_8013D88 -sub_8013D88: @ 8013D88 - push {lr} - adds r2, r0, 0 - cmp r1, 0xFF - bne _08013D94 -_08013D90: - movs r0, 0x1 - b _08013DB8 -_08013D94: - cmp r1, 0x16 - bhi _08013DB6 - ldr r0, =gUnknown_082F04D8 - lsls r1, 2 - adds r1, r0 - ldr r1, [r1] - b _08013DB0 - .pool -_08013DA8: - ldrb r0, [r1] - cmp r0, r2 - beq _08013D90 - adds r1, 0x1 -_08013DB0: - ldrb r0, [r1] - cmp r0, 0xFF - bne _08013DA8 -_08013DB6: - movs r0, 0 -_08013DB8: - pop {r1} - bx r1 - thumb_func_end sub_8013D88 - - thumb_func_start sub_8013DBC -sub_8013DBC: @ 8013DBC - push {lr} - ldr r0, [r0] - lsls r1, 5 - adds r1, r0, r1 - ldrb r2, [r1, 0x1A] - lsls r0, r2, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _08013DEE - ldrb r0, [r1, 0xA] - lsrs r0, 7 - cmp r0, 0 - beq _08013DDA - movs r0, 0x3 - b _08013DF0 -_08013DDA: - lsls r0, r2, 29 - cmp r0, 0 - bge _08013DE4 - movs r0, 0x1 - b _08013DF0 -_08013DE4: - ldrb r0, [r1, 0x1B] - cmp r0, 0 - beq _08013DEE - movs r0, 0x2 - b _08013DF0 -_08013DEE: - movs r0, 0 -_08013DF0: - pop {r1} - bx r1 - thumb_func_end sub_8013DBC - - thumb_func_start sub_8013DF4 -sub_8013DF4: @ 8013DF4 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x8 - adds r5, r0, 0 - adds r4, r1, 0 - adds r6, r2, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gUnknown_02022C30 - ldr r0, [r0] - mov r8, r0 - bl sub_8013DBC - lsls r0, 24 - lsrs r0, 24 - lsls r1, r4, 5 - mov r2, r8 - ldr r3, [r2] - adds r3, r1 - str r0, [sp] - lsls r4, 24 - lsrs r4, 24 - str r4, [sp, 0x4] - adds r0, r5, 0 - movs r1, 0x8 - adds r2, r6, 0 - bl sub_80177B8 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8013DF4 - - thumb_func_start sub_8013E44 -sub_8013E44: @ 8013E44 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - ldr r0, =gUnknown_02022C30 - ldr r6, [r0] - movs r7, 0 - movs r3, 0 -_08013E54: - ldr r0, [r6] - lsls r5, r3, 5 - adds r2, r0, r5 - ldrb r0, [r2, 0x1A] - lsls r0, 30 - mov r8, r5 - cmp r0, 0 - beq _08013F20 - ldr r1, [r6, 0x4] - adds r0, r2, 0 - str r3, [sp] - bl sub_80176E4 - adds r4, r0, 0 - ldr r3, [sp] - cmp r4, 0xFF - beq _08013EEE - ldr r0, [r6] - adds r2, r0, r5 - ldrb r1, [r2, 0x1A] - lsls r0, r1, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _08013ECC - lsls r0, r4, 3 - subs r0, r4 - lsls r4, r0, 2 - ldr r1, [r6, 0x4] - adds r1, r4 - adds r0, r2, 0 - bl sub_8017678 - ldr r3, [sp] - cmp r0, 0 - beq _08013EB0 - ldr r1, [r6] - ldr r0, [r6, 0x4] - adds r1, r5 - adds r0, r4 - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - b _08013EDA - .pool -_08013EB0: - ldr r0, [r6] - adds r1, r0, r5 - ldrb r0, [r1, 0x1B] - cmp r0, 0 - beq _08013EE4 - subs r0, 0x1 - strb r0, [r1, 0x1B] - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0, 0x1B] - cmp r0, 0 - bne _08013EE4 - movs r7, 0x2 - b _08013EE4 -_08013ECC: - movs r4, 0x4 - negs r4, r4 - adds r0, r4, 0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1A] -_08013EDA: - ldr r0, [r6] - adds r0, r5 - movs r1, 0x40 - strb r1, [r0, 0x1B] - movs r7, 0x1 -_08013EE4: - ldr r0, [r6] - add r0, r8 - movs r1, 0 - strh r1, [r0, 0x18] - b _08013F20 -_08013EEE: - ldr r0, [r6] - adds r1, r0, r5 - ldrb r0, [r1, 0x1A] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x2 - beq _08013F20 - ldrh r0, [r1, 0x18] - adds r0, 0x1 - strh r0, [r1, 0x18] - ldr r0, [r6] - adds r2, r0, r5 - ldrh r1, [r2, 0x18] - ldr r0, =0x0000012b - cmp r1, r0 - bls _08013F20 - ldrb r0, [r2, 0x1A] - movs r7, 0x4 - negs r7, r7 - adds r1, r7, 0 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0x1A] - movs r7, 0x2 -_08013F20: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xF - bls _08013E54 - movs r5, 0 - movs r4, 0x3 -_08013F2E: - ldr r0, [r6] - ldr r1, [r6, 0x4] - adds r1, r5 - movs r2, 0x10 - bl sub_8017734 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08013F44 - movs r7, 0x1 -_08013F44: - adds r5, 0x1C - subs r4, 0x1 - cmp r4, 0 - bge _08013F2E - adds r0, r7, 0 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8013E44 - - thumb_func_start sub_8013F60 -sub_8013F60: @ 8013F60 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_80773AC - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8013F60 - - thumb_func_start sub_8013F78 -sub_8013F78: @ 8013F78 - push {lr} - ldr r0, =sub_8013F60 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8013F78 - - thumb_func_start sub_8013F90 -sub_8013F90: @ 8013F90 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_02022C40 - mov r8, r0 - bl GetMultiplayerId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_8018120 - adds r7, r0, 0 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r5, r0, r1 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _08013FFC - cmp r0, 0x1 - bgt _08013FD4 - cmp r0, 0 - beq _08013FDE - b _080140BC - .pool -_08013FD4: - cmp r0, 0x2 - beq _08014038 - cmp r0, 0x3 - beq _08014070 - b _080140BC -_08013FDE: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - movs r0, 0 - movs r2, 0x64 - bl SendBlock - b _080140BC - .pool -_08013FFC: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _080140BC - bl GetMultiplayerId - adds r1, r0, 0 - ldr r0, =gEnemyParty - movs r2, 0x1 - eors r1, r2 - lsls r1, 24 - lsrs r1, 16 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x64 - bl memcpy - movs r0, 0x32 - bl IncrementGameStat - bl ResetBlockReceivedFlags - b _0801405A - .pool -_08014038: - ldr r4, =gUnknown_020228C4 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x00002be0 - adds r1, r0 - adds r0, r4, 0 - movs r2, 0xDC - bl memcpy - movs r0, 0 - adds r1, r4, 0 - movs r2, 0xDC - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _080140BC -_0801405A: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _080140BC - .pool -_08014070: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _080140BC - ldr r4, =gUnknown_020321C0 - bl GetMultiplayerId - adds r1, r0, 0 - movs r0, 0x1 - eors r1, r0 - lsls r1, 24 - lsrs r1, 16 - ldr r0, =gBlockRecvBuffer - adds r1, r0 - adds r0, r4, 0 - movs r2, 0xD8 - bl memcpy - bl ResetBlockReceivedFlags - ldr r1, =gUnknown_02032298 - strb r7, [r1] - movs r0, 0x6 - strb r0, [r1, 0x1] - ldr r1, =gMain - ldr r0, =c2_exit_to_overworld_2_switch - str r0, [r1, 0x8] - ldr r0, =sub_807AE50 - bl SetMainCallback2 - mov r0, r8 - bl sub_801807C - adds r0, r6, 0 - bl DestroyTask -_080140BC: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8013F90 - - thumb_func_start sub_80140E0 -sub_80140E0: @ 80140E0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _08014104 - cmp r0, 0x1 - beq _0801411C - b _0801419E - .pool -_08014104: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _08014114 - movs r0, 0x2 - bl sub_800A4D8 -_08014114: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0801419E -_0801411C: - bl GetBlockReceivedStatus - adds r4, r0, 0 - bl sub_800A9D8 - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - bne _0801419E - movs r4, 0 - ldr r5, =gLinkPlayers - b _08014152 - .pool -_08014138: - lsls r1, r4, 8 - ldr r0, =gBlockRecvBuffer - adds r3, r1, r0 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gUnknown_02039B58 - adds r0, r1 - ldrb r2, [r5] - adds r1, r3, 0 - bl sub_80C3120 - adds r5, 0x1C - adds r4, 0x1 -_08014152: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _08014138 - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _08014190 - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 16 - ldr r1, =gBlockRecvBuffer - adds r3, r0, r1 - adds r0, r3, 0 - adds r0, 0x60 - ldrh r0, [r0] - bl sub_801B94C - b _08014194 - .pool -_08014190: - bl sub_801B940 -_08014194: - bl ResetBlockReceivedFlags - adds r0, r6, 0 - bl DestroyTask -_0801419E: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80140E0 - - thumb_func_start sub_80141A4 -sub_80141A4: @ 80141A4 - push {r4,lr} - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0 - beq _080141C0 - cmp r0, 0x1 - beq _080141D4 - b _080141F2 - .pool -_080141C0: - ldr r0, =sub_80140E0 - movs r1, 0x5 - bl CreateTask - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _080141F2 - .pool -_080141D4: - ldr r0, =sub_80140E0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080141F2 - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =c2_exit_to_overworld_2_switch - bl sub_80C4E74 -_080141F2: - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80141A4 - - thumb_func_start sub_8014210 -sub_8014210: @ 8014210 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r6, 16 - lsrs r6, 16 - bl sp000_heal_pokemon - bl copy_player_party_to_sav1 - bl copy_bags_and_unk_data_from_save_blocks - ldr r5, =gLinkPlayers - ldr r0, =0x00002211 - str r0, [r5, 0x14] - bl GetMultiplayerId - adds r4, r0, 0 - bl GetMultiplayerId - lsls r4, 24 - lsrs r4, 24 - lsls r1, r4, 3 - subs r1, r4 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x18] - bl GetMultiplayerId - adds r4, r0, 0 - bl GetMultiplayerId - movs r2, 0x1 - eors r4, r2 - lsls r4, 24 - lsrs r4, 24 - lsls r1, r4, 3 - subs r1, r4 - lsls r1, 2 - adds r1, r5 - eors r0, r2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x18] - ldr r1, =gMain - ldr r0, =sub_80B360C - str r0, [r1, 0x8] - ldr r0, =gBattleTypeFlags - str r6, [r0] - bl PlayBattleBGM - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8014210 - - thumb_func_start sub_8014290 -sub_8014290: @ 8014290 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x8 - adds r3, r0, 0 - adds r4, r1, 0 - adds r5, r2, 0 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - ldr r0, =0x00004087 - adds r1, r3, 0 - bl VarSet - ldr r6, =gSaveBlock1Ptr - ldr r1, [r6] - movs r0, 0x4 - ldrsb r0, [r1, r0] - ldrb r1, [r1, 0x5] - lsls r1, 24 - asrs r1, 24 - movs r2, 0x1 - negs r2, r2 - mov r8, r2 - lsls r4, 24 - asrs r4, 24 - lsls r5, 24 - asrs r5, 24 - str r5, [sp] - adds r3, r4, 0 - bl Overworld_SetWarpDestination - ldr r0, [r6] - movs r1, 0x4 - ldrsb r1, [r0, r1] - movs r2, 0x5 - ldrsb r2, [r0, r2] - str r4, [sp] - str r5, [sp, 0x4] - movs r0, 0 - mov r3, r8 - bl saved_warp2_set_2 - bl warp_in - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8014290 - - thumb_func_start sub_8014304 -sub_8014304: @ 8014304 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - mov r8, r2 - adds r6, r3, 0 - ldr r1, [sp, 0x18] - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r1, 16 - lsrs r1, 16 - ldr r0, =gSpecialVar_0x8004 - strh r1, [r0] - ldr r0, =0x00004087 - bl VarSet - bl GetLinkPlayerCount - ldr r1, =gUnknown_03005DB8 - strb r0, [r1] - bl GetMultiplayerId - ldr r1, =gUnknown_03005DB4 - strb r0, [r1] - bl sub_809D2BC - lsls r4, 24 - asrs r4, 24 - lsls r5, 24 - asrs r5, 24 - movs r2, 0x1 - negs r2, r2 - mov r0, r8 - lsls r0, 24 - asrs r0, 24 - mov r8, r0 - lsls r6, 24 - asrs r6, 24 - str r6, [sp] - adds r0, r4, 0 - adds r1, r5, 0 - mov r3, r8 - bl Overworld_SetWarpDestination - bl warp_in - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8014304 - - thumb_func_start sub_8014384 -sub_8014384: @ 8014384 - push {r4,lr} - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0 - beq _080143A0 - cmp r0, 0x1 - beq _080143B4 - b _080143C6 - .pool -_080143A0: - ldr r0, =sub_80140E0 - movs r1, 0x5 - bl CreateTask - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _080143C6 - .pool -_080143B4: - ldr r0, =sub_80140E0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080143C6 - ldr r0, =sub_8086074 - bl SetMainCallback2 -_080143C6: - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8014384 - - thumb_func_start sub_80143E4 -sub_80143E4: @ 80143E4 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl sub_80C30A4 - cmp r5, 0 - beq _080143FE - bl sub_801B39C - adds r1, r4, 0 - adds r1, 0x60 - strh r0, [r1] - b _08014404 -_080143FE: - adds r0, r4, 0 - adds r0, 0x60 - strh r5, [r0] -_08014404: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80143E4 - - thumb_func_start sub_801440C -sub_801440C: @ 801440C - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_801B940 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - subs r0, 0x1 - cmp r0, 0xE - bhi _08014474 - lsls r0, 2 - ldr r1, =_08014434 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08014434: - .4byte _08014470 - .4byte _08014470 - .4byte _08014470 - .4byte _08014470 - .4byte _08014474 - .4byte _08014474 - .4byte _08014474 - .4byte _08014474 - .4byte _08014470 - .4byte _08014470 - .4byte _08014470 - .4byte _08014474 - .4byte _08014470 - .4byte _08014474 - .4byte _08014470 -_08014470: - bl sub_800E3A8 -_08014474: - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - subs r0, 0x1 - cmp r0, 0x50 - bls _08014480 - b _08014764 -_08014480: - lsls r0, 2 - ldr r1, =_08014494 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08014494: - .4byte _080145F4 - .4byte _08014620 - .4byte _0801464C - .4byte _08014678 - .4byte _080146D8 - .4byte _08014764 - .4byte _08014764 - .4byte _080146FC - .4byte _08014714 - .4byte _08014734 - .4byte _0801474C - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014698 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _080145D8 - .4byte _08014764 - .4byte _08014764 - .4byte _080146C4 - .4byte _080146D8 - .4byte _08014764 - .4byte _08014764 - .4byte _080146FC - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _08014764 - .4byte _080145D8 -_080145D8: - bl overworld_free_bg_tilemaps - ldr r1, =gMain - ldr r0, =sub_801AC54 - str r0, [r1, 0x8] - movs r0, 0x3 - bl sub_81B8518 - b _08014764 - .pool -_080145F4: - bl overworld_free_bg_tilemaps - ldr r0, =gUnknown_020228C4 - movs r1, 0x1 - bl sub_80143E4 - bl sp000_heal_pokemon - bl copy_player_party_to_sav1 - bl copy_bags_and_unk_data_from_save_blocks - movs r0, 0x1 - str r0, [sp] - movs r0, 0x19 - movs r1, 0x18 - movs r2, 0x6 - movs r3, 0x8 - b _080146B0 - .pool -_08014620: - bl overworld_free_bg_tilemaps - bl sp000_heal_pokemon - bl copy_player_party_to_sav1 - bl copy_bags_and_unk_data_from_save_blocks - ldr r0, =gUnknown_020228C4 - movs r1, 0x1 - bl sub_80143E4 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x19 - movs r1, 0x18 - movs r2, 0x6 - movs r3, 0x8 - b _080146B0 - .pool -_0801464C: - bl overworld_free_bg_tilemaps - bl sp000_heal_pokemon - bl copy_player_party_to_sav1 - bl copy_bags_and_unk_data_from_save_blocks - ldr r0, =gUnknown_020228C4 - movs r1, 0x1 - bl sub_80143E4 - movs r0, 0x5 - str r0, [sp] - movs r0, 0x19 - movs r1, 0x1B - movs r2, 0x5 - movs r3, 0x8 - b _080146B0 - .pool -_08014678: - ldr r0, =gUnknown_020228C4 - movs r1, 0x1 - bl sub_80143E4 - bl overworld_free_bg_tilemaps - movs r0, 0x3 - str r0, [sp] - movs r0, 0x19 - movs r1, 0x19 - movs r2, 0x5 - movs r3, 0x8 - b _080146B0 - .pool -_08014698: - ldr r0, =gUnknown_020228C4 - movs r1, 0x1 - bl sub_80143E4 - bl overworld_free_bg_tilemaps - movs r0, 0x4 - str r0, [sp] - movs r0, 0x19 - movs r1, 0x1A - movs r2, 0x8 - movs r3, 0x9 -_080146B0: - bl sub_8014304 - ldr r0, =sub_8014384 - bl SetMainCallback2 - b _08014764 - .pool -_080146C4: - bl overworld_free_bg_tilemaps - ldr r0, =sub_8013F90 - movs r1, 0 - bl CreateTask - b _08014764 - .pool -_080146D8: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _080146E8 - bl sub_800ED10 - b _080146F6 -_080146E8: - bl sub_800ED28 - movs r0, 0x45 - movs r1, 0 - movs r2, 0x1 - bl sub_8010F84 -_080146F6: - bl sub_801DD98 - b _08014764 -_080146FC: - ldr r0, =gUnknown_020228C4 - movs r1, 0 - bl sub_80143E4 - ldr r0, =sub_80141A4 - bl SetMainCallback2 - b _08014764 - .pool -_08014714: - movs r0, 0x8 - movs r1, 0x5 - movs r2, 0x1 - bl sub_8014290 - bl brm_get_pokemon_selection - lsls r0, 24 - lsrs r0, 24 - ldr r1, =c2_load_new_map - bl sub_802A9A8 - b _08014764 - .pool -_08014734: - movs r0, 0x7 - movs r1, 0x9 - movs r2, 0x1 - bl sub_8014290 - ldr r0, =c2_load_new_map - bl sub_8020C70 - b _08014764 - .pool -_0801474C: - movs r0, 0x8 - movs r1, 0x5 - movs r2, 0x1 - bl sub_8014290 - bl brm_get_pokemon_selection - lsls r0, 24 - lsrs r0, 24 - ldr r1, =c2_load_new_map - bl sub_802493C -_08014764: - adds r0, r4, 0 - bl DestroyTask - ldr r1, =gScriptResult - movs r0, 0x1 - strh r0, [r1] - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x44 - beq _0801477C - bl ScriptContext2_Disable -_0801477C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801440C - - thumb_func_start sub_8014790 -sub_8014790: @ 8014790 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - ldr r0, =gUnknown_020228C4 - mov r9, r0 - movs r1, 0 - ldrsh r0, [r7, r1] - mov r2, r9 - cmp r0, 0x8 - bls _080147B6 - b _080149B2 -_080147B6: - lsls r0, 2 - ldr r1, =_080147CC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080147CC: - .4byte _080147F0 - .4byte _080148CC - .4byte _080148E4 - .4byte _0801491E - .4byte _08014934 - .4byte _0801494A - .4byte _08014986 - .4byte _08014992 - .4byte _0801499C -_080147F0: - ldr r1, =gScriptResult - movs r0, 0x1 - strh r0, [r1] - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - subs r0, 0xE - cmp r0, 0xE - bhi _080148C2 - lsls r0, 2 - ldr r1, =_08014818 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08014818: - .4byte _08014854 - .4byte _080148C2 - .4byte _080148B8 - .4byte _080148C2 - .4byte _080148C2 - .4byte _080148C2 - .4byte _080148C2 - .4byte _080148C2 - .4byte _080148C2 - .4byte _080148B8 - .4byte _080148B8 - .4byte _080148B8 - .4byte _080148B8 - .4byte _080148B8 - .4byte _08014854 -_08014854: - ldr r1, =gLinkPlayers - ldr r0, =0x00002211 - str r0, [r1, 0x14] - movs r2, 0 - mov r8, r2 - mov r0, r8 - strh r0, [r1, 0x18] - movs r0, 0x2 - strh r0, [r1, 0x34] - ldr r6, =gUnknown_0203CEF8 - ldrb r0, [r6] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gBattleScripting + 0x14 - adds r0, r4 - movs r1, 0xB - bl GetMonData - mov r1, r9 - strh r0, [r1] - ldrb r0, [r6, 0x1] - muls r0, r5 - adds r0, r4 - movs r1, 0xB - movs r2, 0 - bl GetMonData - mov r2, r9 - strh r0, [r2, 0x2] - ldr r0, =gMain - mov r1, r8 - str r1, [r0, 0x8] - movs r0, 0x4 - strh r0, [r7] - bl sub_800E3A8 - bl ResetBlockReceivedFlags - b _080149B2 - .pool -_080148B8: - bl sub_800E3A8 - adds r0, r4, 0 - bl DestroyTask -_080148C2: - bl EnableBothScriptContexts - movs r0, 0x1 - strh r0, [r7] - b _080149B2 -_080148CC: - bl ScriptContext1_IsScriptSetUp - lsls r0, 24 - cmp r0, 0 - bne _080149B2 - movs r0, 0x1 - movs r1, 0 - bl fade_screen - movs r0, 0x2 - strh r0, [r7] - b _080149B2 -_080148E4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080149B2 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x1D - bne _08014914 - adds r0, r4, 0 - bl DestroyTask - ldr r0, =sub_80773AC - bl SetMainCallback2 - b _080149B2 - .pool -_08014914: - bl sub_800ADF8 - movs r0, 0x3 - strh r0, [r7] - b _080149B2 -_0801491E: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080149B2 - adds r0, r4, 0 - bl DestroyTask - bl sub_80149D8 - b _080149B2 -_08014934: - movs r0, 0 - adds r1, r2, 0 - movs r2, 0xE - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _080149B2 - movs r0, 0x5 - strh r0, [r7] - b _080149B2 -_0801494A: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _080149B2 - bl ResetBlockReceivedFlags - ldr r0, =gBlockRecvBuffer - movs r2, 0x80 - lsls r2, 1 - adds r1, r0, r2 - bl sub_80B2AF4 - cmp r0, 0 - beq _08014980 - ldr r0, =gScriptResult - movs r1, 0xB - strh r1, [r0] - movs r0, 0x7 - strh r0, [r7] - b _080149B2 - .pool -_08014980: - movs r0, 0x6 - strh r0, [r7] - b _080149B2 -_08014986: - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask - b _080149B2 -_08014992: - bl sub_800AC34 - movs r0, 0x8 - strh r0, [r7] - b _080149B2 -_0801499C: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _080149B2 - bl sub_800E084 - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask -_080149B2: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8014790 - - thumb_func_start sub_80149C4 -sub_80149C4: @ 80149C4 - push {lr} - ldr r0, =sub_8014790 - movs r1, 0 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_80149C4 - - thumb_func_start sub_80149D8 -sub_80149D8: @ 80149D8 - push {lr} - ldr r0, =sub_801440C - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x8] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80149D8 - - thumb_func_start sub_8014A00 -sub_8014A00: @ 8014A00 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =sub_8014A40 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_02022C30 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - str r1, [r2] - movs r2, 0 - strb r2, [r1, 0xC] - strb r2, [r1, 0xD] - strb r4, [r1, 0x18] - ldr r0, =gScriptResult - strh r2, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8014A00 - - thumb_func_start sub_8014A40 -sub_8014A40: @ 8014A40 - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_02022C30 - ldr r5, [r0] - ldrb r0, [r5, 0xC] - cmp r0, 0x11 - bls _08014A54 - b _08014EF2 -_08014A54: - lsls r0, 2 - ldr r1, =_08014A68 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08014A68: - .4byte _08014AB0 - .4byte _08014AEC - .4byte _08014BBC - .4byte _08014BEC - .4byte _08014BFC - .4byte _08014C4C - .4byte _08014C24 - .4byte _08014C52 - .4byte _08014CF2 - .4byte _08014DBC - .4byte _08014DCC - .4byte _08014DE2 - .4byte _08014DFA - .4byte _08014E16 - .4byte _08014E4E - .4byte _08014E74 - .4byte _08014EA8 - .4byte _08014EE2 -_08014AB0: - ldr r1, =gUnknown_02022C2C - ldrb r0, [r5, 0x18] - strb r0, [r1] - ldr r1, =gUnknown_02022C2D - movs r0, 0x2 - strb r0, [r1] - ldrb r0, [r5, 0x18] - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - movs r0, 0 - movs r1, 0 - bl sub_8010FA0 - bl sub_800B488 - bl sub_8009734 - movs r0, 0x2 - bl sub_8011C10 - movs r0, 0x1 - strb r0, [r5, 0xC] - b _08014EF2 - .pool -_08014AEC: - movs r0, 0x70 - bl AllocZeroed - str r0, [r5, 0x4] - movs r0, 0xA0 - bl AllocZeroed - str r0, [r5] - movs r0, 0xA0 - bl AllocZeroed - str r0, [r5, 0x8] - ldr r0, [r5, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r5] - movs r1, 0x5 - bl sub_8017580 - ldr r0, [r5] - adds r1, r0, 0 - adds r1, 0x10 - bl sub_800DF90 - ldr r1, [r5] - movs r3, 0 - movs r0, 0 - strh r0, [r1, 0x18] - ldr r2, [r5] - ldrb r1, [r2, 0x1A] - subs r0, 0x4 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1A] - ldr r2, [r5] - ldrb r1, [r2, 0x1A] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x1A] - ldr r0, [r5] - strb r3, [r0, 0x1B] - ldr r0, [r5, 0x4] - movs r1, 0xFF - bl sub_8016FC0 - strb r0, [r5, 0x17] - ldr r0, =gUnknown_082F011C - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - bl sub_8019930 - lsls r0, 16 - ldr r2, =0x0000ffff - ldr r1, [sp, 0x4] - ands r1, r2 - orrs r1, r0 - ldr r0, =0xffff00ff - ands r1, r0 - movs r0, 0xC0 - lsls r0, 4 - orrs r1, r0 - str r1, [sp, 0x4] - mov r0, sp - bl AddWindow - strb r0, [r5, 0xF] - ldrb r0, [r5, 0xF] - bl sub_8018784 - ldr r0, =gUnknown_03006310 - adds r2, r0, 0 - ldr r1, =gUnknown_082F015C - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldrb r1, [r5, 0xF] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0 - bl ListMenuInit - strb r0, [r5, 0x12] - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - strb r0, [r5, 0x13] - b _08014C42 - .pool -_08014BBC: - ldr r0, =gStringVar1 - ldr r2, =gUnknown_082F0048 - ldr r4, =gUnknown_02022C2C - ldrb r1, [r4] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - ldr r0, =gStringVar4 - ldrb r1, [r4] - bl sub_801262C - movs r0, 0x3 - strb r0, [r5, 0xC] - b _08014EF2 - .pool -_08014BEC: - ldr r0, =gStringVar4 - bl sub_8018884 - movs r0, 0x4 - strb r0, [r5, 0xC] - b _08014EF2 - .pool -_08014BFC: - adds r0, r5, 0 - movs r1, 0x5 - movs r2, 0x6 - bl sub_801320C - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08014C14 - b _08014EF2 -_08014C14: - movs r0, 0xD - strb r0, [r5, 0xC] - bl sub_800E084 - b _08014EF2 - .pool -_08014C24: - adds r0, r5, 0 - adds r0, 0xD - ldr r1, =gUnknown_082EDF40 - bl mevent_0814257C - cmp r0, 0 - bne _08014C34 - b _08014EF2 -_08014C34: - ldr r0, [r5] - bl sub_8013398 - strb r0, [r5, 0x13] - ldrb r0, [r5, 0x12] - bl sub_81AE70C -_08014C42: - movs r0, 0x2 - strb r0, [r5, 0xC] - b _08014EF2 - .pool -_08014C4C: - movs r0, 0x7 - strb r0, [r5, 0xC] - b _08014EF2 -_08014C52: - adds r0, r5, 0 - adds r0, 0xD - adds r1, r5, 0 - adds r1, 0x14 - ldr r3, =gStringVar4 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r4, r0, 24 - cmp r4, 0 - beq _08014C82 - cmp r4, 0 - bgt _08014C7C - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _08014CC4 - b _08014EF2 - .pool -_08014C7C: - cmp r4, 0x1 - beq _08014CC4 - b _08014EF2 -_08014C82: - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - ldr r1, [r5] - ldrb r0, [r5, 0x13] - lsls r0, 5 - adds r1, r0 - strb r4, [r1, 0x1B] - ldrb r0, [r5, 0x12] - bl sub_81AE70C - movs r0, 0x5 - strb r0, [r5, 0x19] - ldrb r1, [r5, 0x13] - lsls r1, 5 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldrb r0, [r5, 0x13] - lsls r0, 5 - ldr r2, [r5] - adds r2, r0 - adds r2, 0x10 - movs r0, 0x5 - b _08014CE8 -_08014CC4: - movs r0, 0x6 - strb r0, [r5, 0x19] - ldrb r1, [r5, 0x13] - lsls r1, 5 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldrb r0, [r5, 0x13] - lsls r0, 5 - ldr r2, [r5] - adds r2, r0 - adds r2, 0x10 - movs r0, 0x6 -_08014CE8: - bl sub_8010688 - movs r0, 0x8 - strb r0, [r5, 0xC] - b _08014EF2 -_08014CF2: - ldrb r1, [r5, 0x13] - lsls r1, 5 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x2 - bl sub_8015658 - lsls r0, 16 - lsrs r0, 16 - ldrb r2, [r5, 0x13] - lsls r2, 5 - ldr r1, [r5] - adds r1, r2 - adds r1, 0x10 - bl sub_8010714 - adds r4, r0, 0 - cmp r4, 0x1 - bne _08014DAA - ldrb r0, [r5, 0x19] - cmp r0, 0x5 - bne _08014D64 - ldr r1, [r5] - ldrb r0, [r5, 0x13] - lsls r0, 5 - adds r1, r0 - movs r0, 0 - strb r0, [r1, 0x1B] - ldrb r0, [r5, 0x12] - bl sub_81AE70C - ldrb r0, [r5, 0x13] - adds r0, 0x1 - strb r0, [r5, 0x13] - ldr r0, =gStringVar1 - ldrb r2, [r5, 0x13] - lsls r2, 5 - subs r2, 0x20 - ldr r1, [r5] - adds r1, r2 - bl sub_8018404 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EDC9C - bl StringExpandPlaceholders - movs r0, 0x9 - strb r0, [r5, 0xC] - bl sub_800EF38 - b _08014DA4 - .pool -_08014D64: - ldrb r1, [r5, 0x13] - lsls r1, 5 - ldr r0, [r5] - adds r0, r1 - adds r4, r0, 0 - adds r4, 0x10 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl sub_8011DC0 - ldr r1, [r5] - ldrb r0, [r5, 0x13] - lsls r0, 5 - adds r1, r0 - ldrb r2, [r1, 0x1A] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1A] - ldr r0, [r5] - bl sub_8013398 - ldrb r0, [r5, 0x12] - bl sub_81AE70C - movs r0, 0x2 - strb r0, [r5, 0xC] -_08014DA4: - movs r0, 0 - strb r0, [r5, 0x19] - b _08014EF2 -_08014DAA: - cmp r4, 0x2 - beq _08014DB0 - b _08014EF2 -_08014DB0: - movs r0, 0 - movs r1, 0 - bl sub_8011A64 - strb r4, [r5, 0xC] - b _08014EF2 -_08014DBC: - ldr r0, =gStringVar4 - bl sub_8018884 - movs r0, 0xA - strb r0, [r5, 0xC] - b _08014EF2 - .pool -_08014DCC: - ldrb r0, [r5, 0xE] - adds r0, 0x1 - strb r0, [r5, 0xE] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x78 - bhi _08014DDC - b _08014EF2 -_08014DDC: - movs r0, 0xB - strb r0, [r5, 0xC] - b _08014EF2 -_08014DE2: - adds r0, r5, 0 - movs r1, 0x5 - movs r2, 0x6 - bl sub_801320C - lsls r0, 24 - cmp r0, 0 - beq _08014DF4 - b _08014EF2 -_08014DF4: - movs r0, 0xC - strb r0, [r5, 0xC] - b _08014EF2 -_08014DFA: - bl sub_800EF1C - lsls r0, 24 - cmp r0, 0 - beq _08014E10 - movs r0, 0 - bl sub_800EF58 - movs r0, 0xF - strb r0, [r5, 0xC] - b _08014EF2 -_08014E10: - movs r0, 0x6 - strb r0, [r5, 0xC] - b _08014EF2 -_08014E16: - bl sub_800E084 - bl sub_800EDD4 - ldrb r0, [r5, 0x12] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrb r0, [r5, 0xF] - bl RemoveWindow - ldrb r0, [r5, 0x17] - bl DestroyTask - ldr r0, [r5, 0x8] - bl Free - ldr r0, [r5] - bl Free - ldr r0, [r5, 0x4] - bl Free - b _08014EDA -_08014E4E: - adds r0, r5, 0 - adds r0, 0xD - ldr r1, =gText_PleaseStartOver - bl mevent_0814257C - cmp r0, 0 - beq _08014EF2 - adds r0, r4, 0 - bl DestroyTask - ldr r1, =gScriptResult - movs r0, 0x5 - strh r0, [r1] - b _08014EF2 - .pool -_08014E74: - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08014E8C - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _08014E92 -_08014E8C: - movs r0, 0xD - strb r0, [r5, 0xC] - b _08014EF2 -_08014E92: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08014EF2 - movs r0, 0x1 - bl sub_8011068 - b _08014EDA - .pool -_08014EA8: - ldrb r0, [r5, 0x12] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrb r0, [r5, 0xF] - bl RemoveWindow - ldrb r0, [r5, 0x17] - bl DestroyTask - ldr r0, [r5, 0x8] - bl Free - ldr r0, [r5] - bl Free - ldr r0, [r5, 0x4] - bl Free - bl sub_800ADF8 -_08014EDA: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] - b _08014EF2 -_08014EE2: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08014EF2 - adds r0, r4, 0 - bl DestroyTask -_08014EF2: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8014A40 - - thumb_func_start sub_8014EFC -sub_8014EFC: @ 8014EFC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =sub_8014F48 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_02022C30 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - str r1, [r2] - ldr r0, =gUnknown_03000DA4 - str r1, [r0] - movs r2, 0 - strb r2, [r1, 0x8] - strb r2, [r1, 0x9] - subs r4, 0x15 - strb r4, [r1, 0x12] - ldr r0, =gScriptResult - strh r2, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8014EFC - - thumb_func_start sub_8014F48 -sub_8014F48: @ 8014F48 - push {r4-r7,lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_02022C30 - ldr r7, [r0] - ldrb r0, [r7, 0x8] - cmp r0, 0xC - bls _08014F5C - b _080152A0 -_08014F5C: - lsls r0, 2 - ldr r1, =_08014F70 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08014F70: - .4byte _08014FA4 - .4byte _08014FD8 - .4byte _08014FE8 - .4byte _080150B8 - .4byte _08015180 - .4byte _080151A4 - .4byte _08015204 - .4byte _08015260 - .4byte _08015204 - .4byte _0801523A - .4byte _08015204 - .4byte _08015284 - .4byte _08015290 -_08014FA4: - ldrb r0, [r7, 0x12] - adds r0, 0x15 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - bl sub_800B488 - bl sub_8009734 - bl sub_8011C5C - movs r0, 0x70 - bl AllocZeroed - str r0, [r7, 0x4] - movs r0, 0x80 - lsls r0, 2 - bl AllocZeroed - str r0, [r7] - movs r0, 0x1 - strb r0, [r7, 0x8] - b _080152A0 -_08014FD8: - ldr r0, =gUnknown_082EF7F8 - bl sub_8018884 - movs r0, 0x2 - strb r0, [r7, 0x8] - b _080152A0 - .pool -_08014FE8: - ldr r0, [r7, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r7] - movs r1, 0x10 - bl sub_8017580 - ldr r0, [r7, 0x4] - ldrb r1, [r7, 0x12] - adds r1, 0x7 - bl sub_8016FC0 - movs r6, 0 - strb r0, [r7, 0x11] - ldr r0, =gUnknown_082F0174 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - bl sub_8019930 - lsls r0, 16 - ldr r2, =0x0000ffff - ldr r1, [sp, 0x4] - ands r1, r2 - orrs r1, r0 - ldr r5, =0xffff00ff - ands r1, r5 - movs r4, 0xC0 - lsls r4, 4 - orrs r1, r4 - str r1, [sp, 0x4] - mov r0, sp - bl AddWindow - strb r0, [r7, 0xB] - ldr r0, =gUnknown_082F017C - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x8] - str r1, [sp, 0xC] - add r0, sp, 0x8 - ldr r1, [r0, 0x4] - ands r1, r5 - orrs r1, r4 - str r1, [r0, 0x4] - bl AddWindow - strb r0, [r7, 0xD] - ldrb r0, [r7, 0xB] - bl sub_8018784 - ldr r0, =gUnknown_03006310 - adds r2, r0, 0 - ldr r1, =gUnknown_082F0204 - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldrb r1, [r7, 0xB] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0 - bl ListMenuInit - strb r0, [r7, 0xE] - ldrb r0, [r7, 0xD] - bl sub_8018784 - ldrb r0, [r7, 0xD] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldrb r0, [r7, 0xD] - bl PutWindowTilemap - ldrb r0, [r7, 0xD] - bl sub_80125BC - ldrb r0, [r7, 0xD] - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl CopyBgTilemapBufferToVram - strb r6, [r7, 0xF] - movs r0, 0x3 - strb r0, [r7, 0x8] - b _080152A0 - .pool -_080150B8: - bl sub_8013E44 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _080150D6 - cmp r2, 0x1 - bne _080150CE - movs r0, 0x2 - bl PlaySE -_080150CE: - ldrb r0, [r7, 0xE] - bl sub_81AE70C - b _080152A0 -_080150D6: - ldrb r0, [r7, 0xE] - bl ListMenuHandleInput - adds r2, r0, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08015168 - movs r0, 0x1 - negs r0, r0 - cmp r2, r0 - beq _08015168 - ldr r0, [r7] - lsls r1, r2, 5 - adds r0, r1 - ldrb r1, [r0, 0xA] - ldrb r0, [r0, 0x1A] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _08015160 - lsrs r0, r1, 7 - cmp r0, 0 - bne _08015160 - strb r2, [r7, 0xF] - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - ldrb r0, [r7, 0xE] - bl sub_81AE70C - ldr r0, =gStringVar1 - ldrb r2, [r7, 0xF] - lsls r2, 5 - ldr r1, [r7] - adds r1, r2 - bl sub_8018404 - ldrb r1, [r7, 0xF] - lsls r1, 5 - ldr r0, [r7] - adds r0, r1 - adds r4, r0, 0 - adds r4, 0x10 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl sub_8011FC8 - movs r0, 0x6E - bl PlaySE - movs r0, 0x4 - strb r0, [r7, 0x8] - b _080152A0 - .pool -_08015160: - movs r0, 0x7 - bl PlaySE - b _080152A0 -_08015168: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08015176 - b _080152A0 -_08015176: - movs r0, 0x6 - strb r0, [r7, 0x8] - b _080152A0 - .pool -_08015180: - ldr r0, =gUnknown_082EFC3C - bl sub_8018884 - ldr r0, =gStringVar1 - ldrb r2, [r7, 0xF] - lsls r2, 5 - ldr r1, [r7] - adds r1, r2 - bl sub_8018404 - movs r0, 0x5 - strb r0, [r7, 0x8] - b _080152A0 - .pool -_080151A4: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080151C2 - ldr r2, =gUnknown_02022C2C - ldr r1, [r7] - ldrb r0, [r7, 0xF] - lsls r0, 5 - adds r1, r0 - ldrb r0, [r1, 0xA] - lsls r0, 25 - lsrs r0, 25 - strb r0, [r2] - movs r0, 0xA - strb r0, [r7, 0x8] -_080151C2: - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - beq _080151EE - cmp r0, 0x5 - bgt _080151E4 - cmp r0, 0x2 - bgt _080152A0 - cmp r0, 0x1 - blt _080152A0 - b _080151E8 - .pool -_080151E4: - cmp r0, 0x6 - bne _080152A0 -_080151E8: - movs r0, 0x8 - strb r0, [r7, 0x8] - b _080152A0 -_080151EE: - ldr r0, =gUnknown_082EDDF4 - bl sub_8018884 - movs r0, 0 - movs r1, 0 - bl sub_8011A64 - b _080152A0 - .pool -_08015204: - ldrb r0, [r7, 0xE] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrb r0, [r7, 0xD] - bl RemoveWindow - ldrb r0, [r7, 0xB] - bl RemoveWindow - ldrb r0, [r7, 0x11] - bl DestroyTask - ldr r0, [r7] - bl Free - ldr r0, [r7, 0x4] - bl Free - ldrb r0, [r7, 0x8] - adds r0, 0x1 - strb r0, [r7, 0x8] - b _080152A0 -_0801523A: - adds r5, r7, 0 - adds r5, 0x9 - ldr r4, =gUnknown_082EDF80 - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 22 - adds r0, r4 - ldr r1, [r0] - adds r0, r5, 0 - bl mevent_0814257C - cmp r0, 0 - beq _080152A0 - bl sub_800E084 - b _0801526A - .pool -_08015260: - bl sub_800E084 - ldr r0, =gText_PleaseStartOver - bl sub_8018884 -_0801526A: - adds r0, r6, 0 - bl DestroyTask - bl sub_800EDD4 - ldr r1, =gScriptResult - movs r0, 0x5 - strh r0, [r1] - b _080152A0 - .pool -_08015284: - ldrb r0, [r7, 0x8] - adds r0, 0x1 - strb r0, [r7, 0x8] - bl sub_800ADF8 - b _080152A0 -_08015290: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080152A0 - adds r0, r6, 0 - bl DestroyTask -_080152A0: - add sp, 0x10 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8014F48 - - thumb_func_start sub_80152A8 -sub_80152A8: @ 80152A8 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =task00_081182DC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_02022C30 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - str r1, [r2] - ldr r0, =gUnknown_03000DA4 - str r1, [r0] - movs r2, 0 - strb r2, [r1, 0x8] - strb r2, [r1, 0x9] - subs r4, 0x15 - strb r4, [r1, 0x12] - ldr r0, =gScriptResult - strh r2, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80152A8 - - thumb_func_start task00_081182DC -task00_081182DC: @ 80152F4 - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_02022C30 - ldr r5, [r0] - ldrb r0, [r5, 0x8] - cmp r0, 0xE - bls _08015308 - b _08015604 -_08015308: - lsls r0, 2 - ldr r1, =_0801531C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801531C: - .4byte _08015358 - .4byte _08015386 - .4byte _08015398 - .4byte _08015420 - .4byte _080154E0 - .4byte _08015504 - .4byte _08015564 - .4byte _080155A8 - .4byte _08015564 - .4byte _0801559A - .4byte _08015564 - .4byte _080155B4 - .4byte _08015564 - .4byte _080155E8 - .4byte _080155F4 -_08015358: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - bl sub_800B488 - bl sub_8009734 - bl sub_8011C5C - movs r0, 0x70 - bl AllocZeroed - str r0, [r5, 0x4] - movs r0, 0x80 - lsls r0, 2 - bl AllocZeroed - str r0, [r5] - movs r0, 0x1 - strb r0, [r5, 0x8] - b _08015604 -_08015386: - ldr r0, =gUnknown_082EFBC8 - bl sub_8018884 - movs r0, 0x2 - strb r0, [r5, 0x8] - b _08015604 - .pool -_08015398: - ldr r0, [r5, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r5] - movs r1, 0x10 - bl sub_8017580 - ldr r0, [r5, 0x4] - ldrb r1, [r5, 0x12] - adds r1, 0x7 - bl sub_8016FF0 - strb r0, [r5, 0x11] - ldrb r0, [r5, 0x13] - cmp r0, 0 - beq _08015404 - ldr r0, =gUnknown_082F0174 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - bl sub_8019930 - lsls r0, 16 - ldr r2, =0x0000ffff - ldr r1, [sp, 0x4] - ands r1, r2 - orrs r1, r0 - str r1, [sp, 0x4] - mov r0, sp - bl AddWindow - strb r0, [r5, 0xB] - ldrb r0, [r5, 0xB] - bl sub_8018784 - ldr r0, =gUnknown_03006310 - adds r2, r0, 0 - ldr r1, =gUnknown_082F0204 - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldrb r1, [r5, 0xB] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0 - bl ListMenuInit - strb r0, [r5, 0xE] - movs r0, 0 - bl CopyBgTilemapBufferToVram -_08015404: - movs r0, 0 - strb r0, [r5, 0xF] - movs r0, 0x3 - strb r0, [r5, 0x8] - b _08015604 - .pool -_08015420: - bl sub_8013E44 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _08015446 - cmp r0, 0x1 - bne _08015436 - movs r0, 0x2 - bl PlaySE -_08015436: - ldrb r0, [r5, 0x13] - cmp r0, 0 - bne _0801543E - b _08015604 -_0801543E: - ldrb r0, [r5, 0xE] - bl sub_81AE70C - b _08015604 -_08015446: - ldrb r0, [r5, 0x13] - cmp r0, 0 - beq _08015452 - ldrb r0, [r5, 0xE] - bl ListMenuHandleInput -_08015452: - ldrb r0, [r5, 0x14] - cmp r0, 0x78 - bls _080154C0 - ldr r2, [r5] - ldrb r1, [r2, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _080154D4 - ldrb r1, [r2, 0xA] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080154D4 - ldrb r1, [r5, 0x12] - adds r1, 0x7 - adds r0, r2, 0 - bl sub_8016F1C - cmp r0, 0 - beq _080154B4 - strb r4, [r5, 0xF] - strb r4, [r5, 0x14] - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - ldr r0, [r5] - adds r4, r0, 0 - adds r4, 0x10 - adds r0, 0x2 - bl sub_8015658 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl sub_8011FC8 - movs r0, 0x6E - bl PlaySE - movs r0, 0x4 - strb r0, [r5, 0x8] - b _080154D4 -_080154B4: - movs r0, 0x16 - bl PlaySE - movs r0, 0xA - strb r0, [r5, 0x8] - b _080154D4 -_080154C0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080154D4 - movs r1, 0 - movs r0, 0x6 - strb r0, [r5, 0x8] - strb r1, [r5, 0x14] -_080154D4: - ldrb r0, [r5, 0x14] - adds r0, 0x1 - strb r0, [r5, 0x14] - b _08015604 - .pool -_080154E0: - ldr r0, =gUnknown_082EFC90 - bl sub_8018884 - ldr r0, =gStringVar1 - ldrb r2, [r5, 0xF] - lsls r2, 5 - ldr r1, [r5] - adds r1, r2 - bl sub_8018404 - movs r0, 0x5 - strb r0, [r5, 0x8] - b _08015604 - .pool -_08015504: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08015522 - ldr r2, =gUnknown_02022C2C - ldr r1, [r5] - ldrb r0, [r5, 0xF] - lsls r0, 5 - adds r1, r0 - ldrb r0, [r1, 0xA] - lsls r0, 25 - lsrs r0, 25 - strb r0, [r2] - movs r0, 0xC - strb r0, [r5, 0x8] -_08015522: - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - beq _0801554E - cmp r0, 0x5 - bgt _08015544 - cmp r0, 0x2 - bgt _08015604 - cmp r0, 0x1 - blt _08015604 - b _08015548 - .pool -_08015544: - cmp r0, 0x6 - bne _08015604 -_08015548: - movs r0, 0x8 - strb r0, [r5, 0x8] - b _08015604 -_0801554E: - ldr r0, =gUnknown_082EDEC4 - bl sub_8018884 - movs r0, 0 - movs r1, 0 - bl sub_8011A64 - b _08015604 - .pool -_08015564: - ldrb r0, [r5, 0x13] - cmp r0, 0 - beq _08015580 - ldrb r0, [r5, 0xE] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrb r0, [r5, 0xB] - bl RemoveWindow -_08015580: - ldrb r0, [r5, 0x11] - bl DestroyTask - ldr r0, [r5] - bl Free - ldr r0, [r5, 0x4] - bl Free - ldrb r0, [r5, 0x8] - adds r0, 0x1 - strb r0, [r5, 0x8] - b _08015604 -_0801559A: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gUnknown_082EDF04 - b _080155C2 - .pool -_080155A8: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_WirelessSearchCanceled - b _080155C2 - .pool -_080155B4: - adds r0, r5, 0 - adds r0, 0x9 - ldr r2, =gUnknown_082EFD58 - ldrb r1, [r5, 0x12] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] -_080155C2: - bl mevent_0814257C - cmp r0, 0 - beq _08015604 - bl sub_800E084 - adds r0, r4, 0 - bl DestroyTask - bl sub_800EDD4 - ldr r1, =gScriptResult - movs r0, 0x5 - strh r0, [r1] - b _08015604 - .pool -_080155E8: - ldrb r0, [r5, 0x8] - adds r0, 0x1 - strb r0, [r5, 0x8] - bl sub_800ADF8 - b _08015604 -_080155F4: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08015604 - adds r0, r4, 0 - bl DestroyTask -_08015604: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end task00_081182DC - - thumb_func_start UnionRoomSpecial -UnionRoomSpecial: @ 801560C - push {r4,lr} - bl sub_8010F60 - ldr r0, =sub_80156E0 - movs r1, 0xA - bl CreateTask - ldr r4, =gUnknown_02022C30 - movs r0, 0x9B - lsls r0, 2 - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_03000DA8 - str r0, [r1] - movs r1, 0 - strb r1, [r0, 0x14] - strb r1, [r0, 0x16] - strh r1, [r0, 0x10] - strh r1, [r0, 0x12] - ldr r0, =gScriptResult - strh r1, [r0] - movs r0, 0xD0 - movs r1, 0x1 - bl sub_819A2BC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end UnionRoomSpecial - - thumb_func_start sub_8015658 -sub_8015658: @ 8015658 - ldrb r1, [r0, 0x1] - lsls r1, 8 - ldrb r0, [r0] - orrs r0, r1 - bx lr - thumb_func_end sub_8015658 - - thumb_func_start sub_8015664 -sub_8015664: @ 8015664 - push {lr} - adds r3, r1, 0 - ldr r1, =gUnknown_02022C30 - ldr r2, [r1] - movs r1, 0x8 - strb r1, [r2, 0x14] - strb r0, [r2, 0x15] - ldr r0, =gStringVar4 - cmp r3, r0 - beq _0801567E - adds r1, r3, 0 - bl StringExpandPlaceholders -_0801567E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8015664 - - thumb_func_start sub_801568C -sub_801568C: @ 801568C - push {lr} - adds r2, r0, 0 - ldr r0, =gUnknown_02022C30 - ldr r1, [r0] - movs r0, 0x1A - strb r0, [r1, 0x14] - ldr r0, =gStringVar4 - cmp r2, r0 - beq _080156A4 - adds r1, r2, 0 - bl StringExpandPlaceholders -_080156A4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801568C - - thumb_func_start sub_80156B0 -sub_80156B0: @ 80156B0 - push {lr} - ldr r3, =0x0201ff00 - ldr r1, [r0] - movs r2, 0x80 - lsls r2, 1 - adds r0, r3, 0 - bl memcpy - pop {r0} - bx r0 - .pool - thumb_func_end sub_80156B0 - - thumb_func_start sub_80156C8 -sub_80156C8: @ 80156C8 - push {lr} - ldr r0, [r0] - ldr r1, =0x0201ff00 - movs r2, 0x80 - lsls r2, 1 - bl memcpy - pop {r0} - bx r0 - .pool - thumb_func_end sub_80156C8 - - thumb_func_start sub_80156E0 -sub_80156E0: @ 80156E0 - push {r4-r7,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - ldr r0, =gUnknown_02022C30 - ldr r6, [r0] - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - ldrb r0, [r6, 0x14] - cmp r0, 0x38 - bls _08015702 - bl _08016878 -_08015702: - lsls r0, 2 - ldr r1, =_08015718 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08015718: - .4byte _080157FC - .4byte _08015854 - .4byte _08015878 - .4byte _080158C8 - .4byte _080159A6 - .4byte _08015E5C - .4byte _08015C54 - .4byte _08015E5C - .4byte _08016864 - .4byte _080161C8 - .4byte _080162D4 - .4byte _080160AC - .4byte _080160C6 - .4byte _08016324 - .4byte _08016348 - .4byte _08016350 - .4byte _08016360 - .4byte _0801638E - .4byte _080163A2 - .4byte _08015F32 - .4byte _08015FB8 - .4byte _08015FD6 - .4byte _0801604A - .4byte _08015ADA - .4byte _08015B00 - .4byte _08015B78 - .4byte _08016838 - .4byte _08015D4C - .4byte _08015D34 - .4byte _08015DD0 - .4byte _08015C2A - .4byte _08015DA6 - .4byte _08015D9C - .4byte _08016158 - .4byte _08016178 - .4byte _080161B8 - .4byte _080162DC - .4byte _08016318 - .4byte _08015BF4 - .4byte _08016104 - .4byte _08015E94 - .4byte _08015EC4 - .4byte _080163CC - .4byte _0801645C - .4byte _080165A8 - .4byte _08016610 - .4byte _0801662C - .4byte _08016478 - .4byte _08016634 - .4byte _08016738 - .4byte _0801676C - .4byte _080167F4 - .4byte _0801652C - .4byte _080164E0 - .4byte _080164F4 - .4byte _0801658C - .4byte _080165DC -_080157FC: - movs r0, 0x70 - bl AllocZeroed - str r0, [r6, 0x4] - movs r0, 0x70 - bl AllocZeroed - str r0, [r6, 0xC] - movs r0, 0x80 - lsls r0, 1 - bl AllocZeroed - str r0, [r6] - movs r0, 0x20 - bl AllocZeroed - str r0, [r6, 0x8] - ldr r0, [r6] - movs r1, 0x8 - bl sub_8017580 - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] - ldr r0, [r6, 0xC] - ldr r1, [r6, 0x4] - movs r2, 0x9 - bl sub_8016DF0 - adds r1, r6, 0 - adds r1, 0x20 - strb r0, [r1] - adds r0, r6, 0 - adds r0, 0xA0 - bl sub_8019BA8 - bl sub_8019F2C - movs r0, 0x1 - bl _08016876 - .pool -_08015854: - adds r0, r6, 0 - adds r0, 0x21 - movs r2, 0 - ldrsh r1, [r7, r2] - bl sub_8019E70 - ldrh r0, [r7] - adds r0, 0x1 - strh r0, [r7] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - beq _08015872 - bl _08016878 -_08015872: - movs r0, 0x2 - bl _08016876 -_08015878: - movs r0, 0x40 - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - ldr r2, =gUnknown_02022C40 - ldrh r0, [r2, 0x2] - ldrh r1, [r2, 0xA] - ldrh r2, [r2, 0xC] - bl sub_8010FCC - bl sub_800B488 - bl sub_8009734 - bl sub_8011C84 - ldr r0, [r6, 0x8] - movs r1, 0x1 - bl sub_8017580 - ldr r0, [r6, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r6, 0xC] - movs r1, 0x4 - bl sub_80175EC - ldr r1, =gScriptResult - movs r0, 0 - strh r0, [r1] - movs r0, 0x3 - bl _08016876 - .pool -_080158C8: - bl sub_81B1360 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x8 - beq _080158E0 - bl sub_81B1360 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x9 - bne _080159A0 -_080158E0: - ldr r4, =gUnknown_02022C40 - ldrh r0, [r4] - cmp r0, 0 - beq _080159A0 - bl brm_get_pokemon_selection - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4] - cmp r0, 0x1 - beq _08015900 - cmp r0, 0x2 - beq _08015950 - b _0801598E - .pool -_08015900: - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - cmp r5, 0x5 - bls _0801592C - adds r0, r4, 0 - bl sub_801807C - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_082EF4FC - bl sub_801568C - b _0801598E - .pool -_0801592C: - bl brm_get_pokemon_selection - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_80180A0 - cmp r0, 0 - bne _0801594C - ldr r1, =gUnknown_082EF47C - movs r0, 0x34 - bl sub_8015664 - b _0801598E - .pool -_0801594C: - movs r0, 0x37 - b _0801598C -_08015950: - adds r0, r6, 0 - bl sub_80156C8 - ldrb r0, [r4, 0x8] - strh r0, [r7, 0x2] - cmp r5, 0x5 - bls _0801596C - ldr r0, =gUnknown_082EF544 - bl sub_801568C - b _0801598E - .pool -_0801596C: - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - ldr r1, =gUnknown_02022C2C - movs r0, 0x44 - strb r0, [r1] - bl brm_get_pokemon_selection - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_80180E8 - movs r0, 0x33 -_0801598C: - strb r0, [r6, 0x14] -_0801598E: - ldr r1, =gUnknown_02022C40 - movs r0, 0 - strh r0, [r1] - bl _08016878 - .pool -_080159A0: - movs r0, 0x4 - bl _08016876 -_080159A6: - ldr r4, =gScriptResult - ldrh r0, [r4] - cmp r0, 0 - beq _08015A0A - cmp r0, 0x9 - bne _080159E0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r0, 0x2 - bl PlaySE - ldr r0, =gStringVar1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - movs r1, 0 - movs r0, 0x2A - b _08015A02 - .pool -_080159E0: - cmp r0, 0xB - bne _080159F4 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r1, 0 - movs r0, 0x17 - b _08015A02 -_080159F4: - movs r0, 0 - strh r0, [r7] - ldrh r0, [r4] - subs r0, 0x1 - strh r0, [r7, 0x2] - movs r1, 0 - movs r0, 0x18 -_08015A02: - strb r0, [r6, 0x14] - strh r1, [r4] - bl _08016878 -_08015A0A: - bl ScriptContext2_IsEnabled - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08015A1A - bl _08016878 -_08015A1A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08015A80 - ldr r0, [r6] - adds r2, r7, 0x2 - adds r3, r6, 0 - adds r3, 0x21 - adds r1, r7, 0 - bl sub_801A2A8 - cmp r0, 0 - beq _08015A4C - movs r0, 0x5 - bl PlaySE - bl sub_80181CC - movs r0, 0x18 - bl _08016876 - .pool -_08015A4C: - bl sub_8017940 - cmp r0, 0 - beq _08015A80 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r0, 0x2 - bl PlaySE - bl sub_80181CC - ldr r0, =gStringVar1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - movs r0, 0x2D - bl _08016876 - .pool -_08015A80: - bl sub_8016B00 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _08015AA2 - cmp r0, 0x2 - bgt _08015A96 - cmp r0, 0x1 - beq _08015A9C - b _08015AD0 -_08015A96: - cmp r0, 0x4 - beq _08015AAA - b _08015AD0 -_08015A9C: - movs r0, 0x2 - bl PlaySE -_08015AA2: - adds r0, r6, 0 - bl sub_801A274 - b _08015AD0 -_08015AAA: - movs r0, 0xB - strb r0, [r6, 0x14] - bl sub_80181CC - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - adds r0, r6, 0 - bl sub_80181DC - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x53 - movs r2, 0 - bl sub_8011090 -_08015AD0: - adds r0, r6, 0 - bl sub_801A284 - bl _08016878 -_08015ADA: - ldr r0, =sub_809FA34 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08015AEA - bl _08016878 -_08015AEA: - movs r0, 0x40 - movs r1, 0 - movs r2, 0 - bl sub_8011090 - movs r0, 0x4 - bl _08016876 - .pool -_08015B00: - bl sub_801704C - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - ldr r0, [r6] - ldrb r1, [r7] - ldrb r2, [r7, 0x2] - adds r3, r4, 0 - bl sub_80179D4 - cmp r0, 0x1 - beq _08015B44 - cmp r0, 0x1 - bgt _08015B36 - cmp r0, 0 - beq _08015B3E - bl _08016878 -_08015B36: - cmp r0, 0x2 - beq _08015B68 - bl _08016878 -_08015B3E: - movs r0, 0x1A - bl _08016876 -_08015B44: - movs r1, 0x2 - ldrsh r0, [r7, r1] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - ldr r2, =gUnknown_02022C2C - ldrb r2, [r2] - bl sub_8012188 - strh r5, [r6, 0x12] - movs r0, 0x19 - bl _08016876 - .pool -_08015B68: - ldr r1, =gStringVar4 - movs r0, 0x13 - bl sub_8015664 - bl _08016878 - .pool -_08015B78: - bl sub_801704C - bl sub_8011A74 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - blt _08015BBE - cmp r4, 0x2 - ble _08015B9A - cmp r4, 0x4 - bne _08015BBE - movs r0, 0x1 - bl sub_801818C - strb r4, [r6, 0x14] - b _08015BBE -_08015B9A: - bl sub_8011B90 - cmp r0, 0x1 - bne _08015BB0 - ldr r0, =gUnknown_082EE6C8 - bl sub_801568C - b _08015BB8 - .pool -_08015BB0: - ldr r1, =gUnknown_082EE6C8 - movs r0, 0x1E - bl sub_8015664 -_08015BB8: - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] -_08015BBE: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015BCA - bl _08016878 -_08015BCA: - ldr r0, =gUnknown_020228C4 - movs r1, 0x1 - bl sub_80143E4 - ldr r0, =sub_80140E0 - movs r1, 0x5 - bl CreateTask - movs r0, 0x26 - bl _08016876 - .pool -_08015BF4: - ldr r0, =sub_80140E0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08015C04 - bl _08016878 -_08015C04: - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x44 - bne _08015C24 - ldr r1, =gUnknown_082EE004 - movs r0, 0x1F - bl sub_8015664 - bl _08016878 - .pool -_08015C24: - movs r0, 0x5 - bl _08016876 -_08015C2A: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08015C36 - bl _08016878 -_08015C36: - movs r0, 0 - bl sub_801818C - movs r2, 0 - ldrsh r0, [r7, r2] - movs r3, 0x2 - ldrsh r1, [r7, r3] - ldr r2, [r6] - bl sub_801A3D0 - movs r0, 0x2 - bl _08016876 - .pool -_08015C54: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1B - adds r2, r6, 0 - adds r2, 0x1C - ldr r3, =gUnknown_082F021C - ldr r4, =gUnknown_082F0244 - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _08015C78 - bl _08016878 -_08015C78: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015C94 - movs r0, 0x1C - bl _08016876 - .pool -_08015C94: - adds r1, r6, 0 - adds r1, 0x98 - movs r0, 0 - strh r0, [r1] - movs r2, 0x2 - ldrsh r0, [r7, r2] - ldr r1, [r6] - bl sub_8017CF8 - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - beq _08015CB2 - cmp r5, 0x40 - bne _08015CE4 -_08015CB2: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x40 - strh r1, [r0] - bl sub_800FE50 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EEB80 - ldr r1, =gLinkPlayers - ldrb r1, [r1, 0x13] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - movs r0, 0x20 - bl _08016876 - .pool -_08015CE4: - ldr r0, =gUnknown_02022C2C - strb r5, [r0] - ldr r1, =gUnknown_02022C2D - lsrs r0, r5, 8 - strb r0, [r1] - lsls r0, r5, 24 - lsrs r0, 24 - cmp r0, 0x41 - bne _08015D18 - bl sub_8018024 - cmp r0, 0 - bne _08015D18 - ldr r1, =gUnknown_082EEBD0 - movs r0, 0x5 - bl sub_8015664 - bl _08016878 - .pool -_08015D18: - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - movs r1, 0x40 - orrs r1, r0 - adds r0, r6, 0 - adds r0, 0x4C - strh r1, [r0] - bl sub_800FE50 - movs r0, 0x1B - bl _08016876 - .pool -_08015D34: - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEB88 - bl StringCopy - movs r0, 0x24 - bl _08016876 - .pool -_08015D4C: - adds r0, r6, 0 - bl sub_8017FD8 - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - adds r0, r6, 0 - adds r0, 0x4C - ldrh r1, [r0] - movs r0, 0x3F - ands r0, r1 - bl sub_8017984 - adds r5, r0, 0 - adds r0, r6, 0 - adds r0, 0x16 - ldr r3, =gUnknown_082EE82C - lsls r1, r5, 2 - lsls r2, r4, 4 - adds r1, r2 - adds r1, r3 - ldr r1, [r1] - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08015D8C - bl _08016878 -_08015D8C: - movs r0, 0 - strh r0, [r7, 0x6] - movs r0, 0x1D - bl _08016876 - .pool -_08015D9C: - bl sub_800AC34 - movs r0, 0x24 - bl _08016876 -_08015DA6: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x44 - strh r1, [r0] - ldr r2, =gUnknown_02022C40 - ldrh r1, [r2, 0xE] - adds r3, r6, 0 - adds r3, 0x4E - strh r1, [r3] - ldrh r2, [r2, 0x10] - adds r1, r6, 0 - adds r1, 0x50 - strh r2, [r1] - bl sub_800FE50 - movs r0, 0x1D - bl _08016876 - .pool -_08015DD0: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015DF4 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEB88 - bl StringCopy - movs r0, 0x1C - bl _08016876 - .pool -_08015DF4: - adds r0, r6, 0 - bl sub_8017FD8 - adds r0, r6, 0 - adds r0, 0x98 - ldrh r0, [r0] - cmp r0, 0x51 - bne _08015E2A - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x8 - bne _08015E24 - ldr r0, =gStringVar4 - adds r1, r6, 0 - movs r2, 0 - bl sub_8018220 - movs r0, 0x28 - bl _08016876 - .pool -_08015E24: - movs r0, 0xD - bl _08016876 -_08015E2A: - cmp r0, 0x52 - beq _08015E32 - bl _08016878 -_08015E32: - movs r5, 0 - movs r0, 0x20 - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r4, =gUnknown_02022C2C - ldrb r2, [r4] - movs r1, 0x40 - orrs r1, r2 - ldr r2, =gLinkPlayers - ldrb r2, [r2, 0x13] - bl sub_8017D9C - strb r5, [r4] - bl _08016878 - .pool -_08015E5C: - movs r0, 0x2 - ldrsh r1, [r7, r0] - lsls r1, 5 - ldr r0, [r6] - adds r0, r1 - bl sub_80179AC - adds r5, r0, 0 - movs r1, 0x2 - ldrsh r0, [r7, r1] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - ldr r2, =gUnknown_082EE24C - lsls r0, r4, 2 - lsls r1, r5, 3 - adds r0, r1 - adds r0, r2 - ldr r1, [r0] - movs r0, 0x6 - bl sub_8015664 - bl _08016878 - .pool -_08015E94: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08015EA8 - bl _08016878 -_08015EA8: - movs r4, 0 - movs r0, 0x29 - strb r0, [r6, 0x14] - bl sub_800ADF8 - adds r0, r6, 0 - adds r0, 0x98 - strh r4, [r0] - adds r0, 0x2 - strh r4, [r0] - bl _08016878 - .pool -_08015EC4: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08015ED2 - bl _08016878 -_08015ED2: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _08015F2C - ldr r5, =gStringVar1 - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r4, =gLinkPlayers + 8 - adds r1, r4 - adds r0, r5, 0 - bl StringCopy - ldrh r0, [r4, 0x18] - adds r4, 0x1C - adds r1, r4, 0 - bl sub_800E540 - adds r5, r0, 0 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EE378 - lsls r1, r5, 2 - adds r1, r2 - ldr r1, [r1] - bl StringExpandPlaceholders - movs r0, 0x21 - bl _08016876 - .pool -_08015F2C: - movs r0, 0x7 - bl _08016876 -_08015F32: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r5, r0, 24 - cmp r5, 0 - beq _08015F5C - cmp r5, 0 - bgt _08015F54 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _08015F98 - bl _08016878 -_08015F54: - cmp r5, 0x1 - beq _08015F98 - bl _08016878 -_08015F5C: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r4, =gUnknown_02022C2C - movs r0, 0x45 - strb r0, [r4] - movs r0, 0x45 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r2, 0x2 - ldrsh r0, [r7, r2] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - ldrb r2, [r4] - bl sub_8012188 - ldrh r0, [r7, 0x2] - strh r0, [r6, 0x12] - movs r0, 0x14 - strb r0, [r6, 0x14] - strh r5, [r7, 0x6] - bl _08016878 - .pool -_08015F98: - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - ldr r1, =gUnknown_082EEC9C - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - bl sub_801568C - bl _08016878 - .pool -_08015FB8: - ldrh r0, [r7, 0x4] - adds r0, 0x1 - strh r0, [r7, 0x4] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - bgt _08015FCA - bl _08016878 -_08015FCA: - movs r1, 0 - movs r0, 0x15 - strb r0, [r6, 0x14] - strh r1, [r7, 0x4] - bl _08016878 -_08015FD6: - bl sub_8011A74 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - beq _0801603C - cmp r4, 0x3 - ble _08015FF4 - cmp r4, 0x4 - bne _08016040 - movs r0, 0x1 - bl sub_801818C - strb r4, [r6, 0x14] - b _08016040 -_08015FF4: - cmp r4, 0x1 - blt _08016040 - movs r1, 0x2 - ldrsh r0, [r7, r1] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - bl sub_8011B90 - cmp r0, 0x1 - bne _08016028 - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_801568C - b _08016040 - .pool -_08016028: - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x1E - bl sub_8015664 - b _08016040 - .pool -_0801603C: - movs r0, 0x16 - strb r0, [r6, 0x14] -_08016040: - ldrh r0, [r7, 0x6] - adds r0, 0x1 - strh r0, [r7, 0x6] - bl _08016878 -_0801604A: - bl sub_8011A80 - cmp r0, 0 - beq _08016092 - movs r2, 0x2 - ldrsh r0, [r7, r2] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - bl sub_8011B90 - cmp r0, 0x1 - bne _08016084 - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_801568C - b _08016092 - .pool -_08016084: - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x1E - bl sub_8015664 -_08016092: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801609E - bl _08016878 -_0801609E: - movs r0, 0x10 - bl _08016876 - .pool -_080160AC: - movs r0, 0x49 - bl PlaySE - bl sub_800EF7C - movs r0, 0 - movs r1, 0xC - strb r1, [r6, 0x14] - adds r1, r6, 0 - adds r1, 0x9A - strh r0, [r1] - bl _08016878 -_080160C6: - bl sub_8011A80 - cmp r0, 0 - beq _080160DA - movs r0, 0 - bl sub_801818C - movs r0, 0x2 - bl _08016876 -_080160DA: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _080160E4 - b _08016878 -_080160E4: - ldr r0, =gUnknown_020228C4 - movs r1, 0x1 - bl sub_80143E4 - ldr r0, =sub_80140E0 - movs r1, 0x5 - bl CreateTask - movs r0, 0x27 - b _08016876 - .pool -_08016104: - adds r0, r6, 0 - bl sub_801689C - ldr r0, =sub_80140E0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08016118 - b _08016878 -_08016118: - movs r0, 0x21 - strb r0, [r6, 0x14] - ldr r0, =gStringVar1 - ldr r4, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name - adds r1, r4, 0 - bl StringCopy - adds r0, r4, 0 - subs r0, 0x24 - ldrh r0, [r0, 0x20] - adds r1, r4, 0 - bl sub_800E540 - adds r5, r0, 0 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EE324 - lsls r1, r5, 2 - adds r1, r2 - ldr r1, [r1] - bl StringExpandPlaceholders - b _08016878 - .pool -_08016158: - adds r0, r6, 0 - bl sub_801689C - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08016170 - b _08016878 -_08016170: - movs r0, 0x22 - b _08016876 - .pool -_08016178: - adds r0, r6, 0 - bl sub_801689C - adds r0, r6, 0 - bl sub_80168DC - cmp r0, 0 - bne _0801618A - b _08016878 -_0801618A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08016198 - b _08016878 -_08016198: - movs r0, 0x1 - bl sub_8011DE0 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EE598 - bl StringCopy - movs r0, 0x24 - b _08016876 - .pool -_080161B8: - ldr r1, =gStringVar4 - movs r0, 0x9 - bl sub_8015664 - b _08016878 - .pool -_080161C8: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080161EE - cmp r1, 0 - bgt _080161E8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080162AE - b _08016878 -_080161E8: - cmp r1, 0x1 - beq _080162AE - b _08016878 -_080161EE: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x51 - strh r1, [r0] - ldr r1, =gUnknown_02022C2C - ldrb r1, [r1] - adds r5, r0, 0 - cmp r1, 0x45 - bne _08016220 - movs r4, 0x40 - orrs r4, r1 - movs r0, 0x1 - bl sub_801100C - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - movs r2, 0 - bl sub_8011090 - b _0801623E - .pool -_08016220: - movs r0, 0x40 - adds r4, r1, 0 - orrs r4, r0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_801100C - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - movs r2, 0x1 - bl sub_8011090 -_0801623E: - ldr r1, [r6, 0x8] - movs r0, 0 - strb r0, [r1, 0x1B] - strh r0, [r7, 0x6] - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x41 - bne _08016286 - bl sub_8018024 - cmp r0, 0 - bne _0801627C - movs r0, 0x52 - strh r0, [r5] - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xA - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEC14 - bl StringCopy - b _08016878 - .pool -_0801627C: - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xD - b _08016876 -_08016286: - cmp r0, 0x48 - bne _080162A4 - adds r0, r5, 0 - bl sub_800FE50 - ldr r0, =gStringVar4 - adds r1, r6, 0 - movs r2, 0x1 - bl sub_8018220 - movs r0, 0x28 - b _08016876 - .pool -_080162A4: - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xD - b _08016876 -_080162AE: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x52 - strh r1, [r0] - bl sub_800FE50 - movs r0, 0xA - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r1, =gUnknown_02022C2C - ldrb r1, [r1] - bl sub_8013078 - b _08016878 - .pool -_080162D4: - bl sub_800AC34 - movs r0, 0x24 - b _08016876 -_080162DC: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r4, [r0] - cmp r4, 0 - beq _080162E6 - b _08016878 -_080162E6: - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] - ldr r1, =gStringVar4 - movs r0, 0x25 - bl sub_8015664 - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0 - movs r2, 0xC - bl memset - adds r0, r6, 0 - adds r0, 0x9A - strh r4, [r0] - subs r0, 0x2 - strh r4, [r0] - b _08016878 - .pool -_08016318: - movs r0, 0x2 - strb r0, [r6, 0x14] - movs r0, 0 - bl sub_801818C - b _08016878 -_08016324: - ldr r4, =gStringVar4 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - movs r1, 0x40 - orrs r1, r0 - adds r0, r4, 0 - bl sub_8017E00 - movs r0, 0xE - adds r1, r4, 0 - bl sub_8015664 - b _08016878 - .pool -_08016348: - bl sub_800ADF8 - movs r0, 0xF - b _08016876 -_08016350: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _0801635C - b _08016878 -_0801635C: - movs r0, 0x10 - b _08016876 -_08016360: - ldr r0, [r6, 0x8] - bl Free - ldr r0, [r6] - bl Free - ldr r0, [r6, 0xC] - bl Free - ldr r0, [r6, 0x4] - bl Free - adds r0, r6, 0 - adds r0, 0x20 - ldrb r0, [r0] - bl DestroyTask - adds r0, r6, 0 - adds r0, 0x21 - bl sub_8019F04 - movs r0, 0x11 - b _08016876 -_0801638E: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x12 - b _08016876 -_080163A2: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _080163AE - b _08016878 -_080163AE: - bl sub_8019E3C - adds r0, r4, 0 - bl DestroyTask - ldr r0, =gUnknown_02022C30 - ldr r0, [r0] - bl Free - bl sub_80149D8 - b _08016878 - .pool -_080163CC: - bl sub_800F7DC - ldrh r1, [r0, 0x8] - ldr r4, =0x000003ff - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _080163E4 - movs r0, 0x2B - b _08016876 - .pool -_080163E4: - bl sub_800F7DC - ldrh r1, [r0, 0x8] - adds r0, r4, 0 - ands r0, r1 - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - bne _08016408 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EF590 - bl StringCopy - b _0801643E - .pool -_08016408: - ldr r4, =gStringVar1 - bl sub_800F7DC - ldrh r0, [r0, 0x8] - lsls r0, 22 - lsrs r0, 22 - movs r1, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - ldr r4, =gStringVar2 - bl sub_800F7DC - ldrb r1, [r0, 0xB] - lsrs r1, 1 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EF564 - bl StringExpandPlaceholders -_0801643E: - ldr r1, =gStringVar4 - movs r0, 0x2C - bl sub_8015664 - b _08016878 - .pool -_0801645C: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF20C - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _0801646E - b _08016878 -_0801646E: - movs r0, 0x2F - b _08016876 - .pool -_08016478: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x1E - ldr r3, =gUnknown_082F025C - ldr r4, =gUnknown_082F027C - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0801649A - b _08016878 -_0801649A: - subs r0, 0x1 - cmp r5, r0 - beq _080164A4 - cmp r5, 0x3 - bne _080164B8 -_080164A4: - movs r0, 0x4 - strb r0, [r6, 0x14] - movs r0, 0x1 - bl sub_801818C - b _08016878 - .pool -_080164B8: - cmp r5, 0x1 - beq _080164C2 - cmp r5, 0x2 - beq _080164D0 - b _08016878 -_080164C2: - ldr r1, =gUnknown_082EF4C4 - movs r0, 0x35 - bl sub_8015664 - b _08016878 - .pool -_080164D0: - ldr r1, =gUnknown_082EF298 - movs r0, 0x2F - bl sub_8015664 - b _08016878 - .pool -_080164E0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x36 - b _08016876 -_080164F4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08016502 - b _08016878 -_08016502: - ldr r1, =gUnknown_02022C40 - movs r0, 0x1 - strh r0, [r1] - ldr r1, =gFieldCallback - ldr r0, =sub_80AF128 - str r0, [r1] - ldr r1, =c2_exit_to_overworld_2_switch - movs r0, 0x8 - bl sub_81B8904 - b _08016878 - .pool -_0801652C: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x1E - ldr r3, =gUnknown_082F0294 - ldr r4, =gUnknown_082F032C - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0801654E - b _08016878 -_0801654E: - subs r0, 0x1 - cmp r5, r0 - beq _08016558 - cmp r5, 0x12 - bne _08016580 -_08016558: - ldr r0, =gUnknown_02022C40 - bl sub_801807C - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_082EF4FC - bl sub_801568C - b _08016878 - .pool -_08016580: - ldr r0, =gUnknown_02022C40 - strh r5, [r0, 0x2] - movs r0, 0x37 - b _08016876 - .pool -_0801658C: - ldr r2, =gUnknown_02022C40 - ldrh r0, [r2, 0x2] - ldrh r1, [r2, 0xA] - ldrh r2, [r2, 0xC] - bl sub_8010FCC - ldr r0, =gUnknown_082EF520 - bl sub_801568C - b _08016878 - .pool -_080165A8: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080165CE - cmp r1, 0 - bgt _080165C8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080165D2 - b _08016878 -_080165C8: - cmp r1, 0x1 - beq _080165D2 - b _08016878 -_080165CE: - movs r0, 0x38 - b _08016876 -_080165D2: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 -_080165DC: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF5B8 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _080165EE - b _08016878 -_080165EE: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_02022C40 - bl sub_801807C - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 - .pool -_08016610: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF1EC - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _08016622 - b _08016878 -_08016622: - movs r0, 0x2E - b _08016876 - .pool -_0801662C: - bl sub_80173B0 - movs r0, 0x30 - b _08016876 -_08016634: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x4A - adds r3, r6, 0 - adds r3, 0x1E - ldr r4, =gUnknown_082F034C - str r4, [sp] - ldr r4, =gUnknown_082F03A4 - str r4, [sp, 0x4] - ldr r4, [r6] - str r4, [sp, 0x8] - bl sub_80172A0 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _08016660 - b _08016878 -_08016660: - subs r0, 0x1 - cmp r5, r0 - beq _0801666A - cmp r5, 0x8 - bne _0801667C -_0801666A: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 - .pool -_0801667C: - bl sub_80173B0 - ldr r1, [r6] - lsls r4, r5, 5 - adds r1, r4 - ldrb r0, [r1, 0x9] - lsrs r0, 2 - ldrh r1, [r1, 0x8] - lsls r1, 22 - lsrs r1, 22 - bl sub_8017D04 - cmp r0, 0x1 - beq _080166C8 - cmp r0, 0x1 - bgt _080166A2 - cmp r0, 0 - beq _080166A8 - b _08016878 -_080166A2: - cmp r0, 0x2 - beq _080166FC - b _08016878 -_080166A8: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r1, =gUnknown_082EF65C - movs r0, 0x31 - bl sub_8015664 - strh r5, [r7, 0x2] - b _08016878 - .pool -_080166C8: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r0, =gStringVar2 - ldr r1, [r6] - adds r1, r4 - ldrb r2, [r1, 0x9] - lsrs r2, 2 - lsls r1, r2, 3 - subs r1, r2 - ldr r2, =gTypeNames - adds r1, r2 - bl StringCopy - ldr r1, =gUnknown_082EF6E4 - b _0801671E - .pool -_080166FC: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r0, =gStringVar2 - ldr r1, [r6] - adds r1, r4 - ldrb r2, [r1, 0x9] - lsrs r2, 2 - lsls r1, r2, 3 - subs r1, r2 - ldr r2, =gTypeNames - adds r1, r2 - bl StringCopy - ldr r1, =gUnknown_082EF718 -_0801671E: - movs r0, 0x2E - bl sub_8015664 - b _08016878 - .pool -_08016738: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801675E - cmp r1, 0 - bgt _08016758 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08016762 - b _08016878 -_08016758: - cmp r1, 0x1 - beq _08016762 - b _08016878 -_0801675E: - movs r0, 0x32 - b _08016876 -_08016762: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 -_0801676C: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF4C4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - bne _0801677E - b _08016878 -_0801677E: - ldr r4, =gUnknown_02022C40 - movs r0, 0x2 - strh r0, [r4] - ldr r2, =gUnknown_02022C38 - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - lsls r0, 5 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - ldr r2, =gUnknown_02022C3E - ldr r1, [r6] - movs r3, 0x2 - ldrsh r0, [r7, r3] - lsls r0, 5 - adds r1, r0 - ldrb r0, [r1, 0x9] - lsrs r0, 2 - strb r0, [r2] - ldr r2, =gUnknown_02022C3C - ldr r1, [r6] - movs r3, 0x2 - ldrsh r0, [r7, r3] - lsls r0, 5 - adds r1, r0 - ldrh r0, [r1, 0x8] - lsls r0, 22 - lsrs r0, 22 - strh r0, [r2] - ldr r1, =gFieldCallback - ldr r0, =sub_80AF128 - str r0, [r1] - ldr r1, =c2_exit_to_overworld_2_switch - movs r0, 0x9 - bl sub_81B8904 - adds r0, r6, 0 - bl sub_80156B0 - ldrh r0, [r7, 0x2] - strb r0, [r4, 0x8] - b _08016878 - .pool -_080167F4: - ldr r1, =gUnknown_02022C2C - movs r0, 0x44 - strb r0, [r1] - movs r1, 0x2 - ldrsh r0, [r7, r1] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - movs r2, 0x44 - bl sub_8012188 - ldr r0, =gStringVar1 - movs r3, 0x2 - ldrsh r2, [r7, r3] - lsls r2, 5 - ldr r1, [r6] - adds r1, r2 - bl sub_8018404 - ldr r0, =gUnknown_082EE17C - ldr r0, [r0, 0x8] - bl sub_8017020 - movs r0, 0x19 - b _08016876 - .pool -_08016838: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - beq _08016878 - movs r0, 0x1 - bl sub_801818C - movs r1, 0 - ldrsh r0, [r7, r1] - movs r2, 0x2 - ldrsh r1, [r7, r2] - ldr r2, [r6] - bl sub_801A3D0 - movs r0, 0x4 - b _08016876 - .pool -_08016864: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl sub_8017064 - lsls r0, 24 - cmp r0, 0 - beq _08016878 - ldrb r0, [r6, 0x15] -_08016876: - strb r0, [r6, 0x14] -_08016878: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80156E0 - - thumb_func_start var_800D_set_xB -var_800D_set_xB: @ 8016884 - push {lr} - bl InUnionRoom - cmp r0, 0x1 - bne _08016894 - ldr r1, =gScriptResult - movs r0, 0xB - strh r0, [r1] -_08016894: - pop {r0} - bx r0 - .pool - thumb_func_end var_800D_set_xB - - thumb_func_start sub_801689C -sub_801689C: @ 801689C - push {r4,r5,lr} - adds r2, r0, 0 - ldr r3, =gUnknown_03003090 - ldrh r5, [r3, 0x12] - adds r4, r5, 0 - cmp r4, 0 - beq _080168D0 - ldrh r0, [r3, 0x10] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _080168D0 - adds r0, r2, 0 - adds r0, 0x9A - strh r5, [r0] - cmp r4, 0x44 - bne _080168D0 - ldrh r1, [r3, 0x14] - adds r0, 0x2 - strh r1, [r0] - ldrh r1, [r3, 0x16] - adds r0, 0x2 - strh r1, [r0] -_080168D0: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801689C - - thumb_func_start sub_80168DC -sub_80168DC: @ 80168DC - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r4, 0 - adds r5, 0x9A - ldrh r0, [r5] - cmp r0, 0 - beq _0801692C - ldr r0, =gStringVar4 - ldr r1, =gLinkPlayers - adds r1, 0x2F - ldrb r1, [r1] - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_8017EA0 - cmp r0, 0 - beq _0801692C - cmp r0, 0x1 - bne _0801691C - movs r0, 0x23 - strb r0, [r4, 0x14] - ldr r1, =gUnknown_02022C2C - ldrh r0, [r5] - strb r0, [r1] - movs r0, 0 - b _0801692E - .pool -_0801691C: - cmp r0, 0x2 - bne _0801692C - movs r0, 0x24 - strb r0, [r4, 0x14] - bl sub_800AC34 - movs r0, 0 - b _0801692E -_0801692C: - movs r0, 0x1 -_0801692E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80168DC - - thumb_func_start sub_8016934 -sub_8016934: @ 8016934 - push {r4,r5,lr} - ldr r5, =gUnknown_02022C20 - movs r0, 0xFF - strb r0, [r5] - ldr r0, =task00_081199FC - movs r1, 0 - bl CreateTask - ldr r4, =gUnknown_02022C30 - movs r0, 0x9B - lsls r0, 2 - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_03000DA8 - str r0, [r1] - movs r1, 0 - strb r1, [r0, 0x14] - strb r1, [r0, 0x16] - strh r1, [r0, 0x10] - strh r1, [r0, 0x12] - movs r0, 0x1 - negs r0, r0 - strb r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8016934 - - thumb_func_start task00_081199FC -task00_081199FC: @ 801697C - push {r4-r6,lr} - sub sp, 0x20 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_02022C30 - ldr r5, [r0] - ldrb r0, [r5, 0x14] - cmp r0, 0x4 - bls _08016990 - b _08016AC8 -_08016990: - lsls r0, 2 - ldr r1, =_080169A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080169A4: - .4byte _080169B8 - .4byte _080169BE - .4byte _080169E0 - .4byte _08016A30 - .4byte _08016A94 -_080169B8: - movs r0, 0x1 - strb r0, [r5, 0x14] - b _08016AC8 -_080169BE: - movs r0, 0xC - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - bl sub_800B488 - bl sub_8009734 - bl sub_8011C84 - movs r0, 0x1 - bl sub_80111B0 - movs r0, 0x2 - strb r0, [r5, 0x14] - b _08016AC8 -_080169E0: - movs r0, 0x70 - bl AllocZeroed - str r0, [r5, 0x4] - movs r1, 0x4 - bl sub_80175EC - movs r0, 0x70 - bl AllocZeroed - str r0, [r5, 0xC] - movs r1, 0x4 - bl sub_80175EC - movs r0, 0x80 - lsls r0, 1 - bl AllocZeroed - str r0, [r5] - movs r1, 0x8 - bl sub_8017580 - movs r0, 0x20 - bl AllocZeroed - str r0, [r5, 0x8] - movs r1, 0x1 - bl sub_8017580 - ldr r0, [r5, 0xC] - ldr r1, [r5, 0x4] - movs r2, 0xA - bl sub_8016DF0 - adds r1, r5, 0 - adds r1, 0x20 - strb r0, [r1] - movs r0, 0x3 - strb r0, [r5, 0x14] - b _08016AC8 -_08016A30: - bl sub_8016B00 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - blt _08016AC8 - cmp r0, 0x2 - bgt _08016AC8 - ldr r0, =gUnknown_02022C20 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08016AC8 - movs r6, 0 -_08016A4A: - ldr r0, [r5] - lsls r4, r6, 5 - adds r1, r0, r4 - ldrb r0, [r1, 0x1A] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _08016A78 - mov r0, sp - bl sub_8018404 - ldr r0, [r5] - adds r0, r4 - adds r0, 0x2 - bl sub_8015658 - lsls r0, 16 - lsrs r0, 16 - mov r1, sp - bl sub_800E540 - cmp r0, 0 - bne _08016A84 -_08016A78: - adds r6, 0x1 - cmp r6, 0x7 - ble _08016A4A - b _08016AC8 - .pool -_08016A84: - ldr r0, =gUnknown_02022C20 - mov r1, sp - bl StringCopy - b _08016AC8 - .pool -_08016A94: - ldr r0, [r5, 0x8] - bl Free - ldr r0, [r5] - bl Free - ldr r0, [r5, 0xC] - bl Free - ldr r0, [r5, 0x4] - bl Free - adds r0, r5, 0 - adds r0, 0x20 - ldrb r0, [r0] - bl DestroyTask - ldr r0, =gUnknown_02022C30 - ldr r0, [r0] - bl Free - bl sub_800EDD4 - adds r0, r4, 0 - bl DestroyTask -_08016AC8: - add sp, 0x20 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task00_081199FC - - thumb_func_start sp182_move_string -sp182_move_string: @ 8016AD4 - push {r4,lr} - ldr r4, =gUnknown_02022C20 - ldrb r0, [r4] - cmp r0, 0xFF - bne _08016AE8 - movs r0, 0 - b _08016AF6 - .pool -_08016AE8: - ldr r0, =gStringVar1 - adds r1, r4, 0 - bl StringCopy - movs r0, 0xFF - strb r0, [r4] - movs r0, 0x1 -_08016AF6: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sp182_move_string - - thumb_func_start sub_8016B00 -sub_8016B00: @ 8016B00 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gUnknown_02022C30 - ldr r4, [r0] - movs r7, 0 - movs r6, 0 - movs r5, 0 -_08016B12: - ldr r0, [r4, 0xC] - adds r0, r5 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bne _08016B5C - ldr r1, [r4, 0xC] - ldr r0, [r4, 0x8] - adds r1, r5 - ldm r1!, {r2,r5,r6} - stm r0!, {r2,r5,r6} - ldm r1!, {r2,r5,r6} - stm r0!, {r2,r5,r6} - ldr r1, [r4, 0x8] - movs r0, 0 - strh r0, [r1, 0x18] - ldr r2, [r4, 0x8] - ldrb r1, [r2, 0x1A] - movs r5, 0x4 - negs r5, r5 - adds r0, r5, 0 - ands r1, r0 - movs r0, 0x1 - orrs r1, r0 - strb r1, [r2, 0x1A] - ldr r0, [r4, 0x8] - strb r3, [r0, 0x1B] - movs r0, 0x4 - b _08016C90 - .pool -_08016B5C: - adds r5, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - ble _08016B12 - movs r6, 0 - mov r9, r6 -_08016B68: - ldr r0, [r4] - mov r1, r9 - lsls r5, r1, 5 - adds r2, r0, r5 - ldrb r0, [r2, 0x1A] - lsls r0, 30 - mov r8, r5 - cmp r0, 0 - beq _08016C5C - ldr r1, [r4, 0x4] - adds r0, r2, 0 - bl sub_80176E4 - adds r6, r0, 0 - cmp r6, 0xFF - beq _08016C02 - ldr r0, [r4] - adds r2, r0, r5 - ldrb r1, [r2, 0x1A] - lsls r0, r1, 30 - lsrs r0, 30 - cmp r0, 0x1 - bne _08016BE0 - lsls r0, r6, 3 - subs r0, r6 - lsls r6, r0, 2 - ldr r1, [r4, 0x4] - adds r1, r6 - adds r0, r2, 0 - bl sub_8017678 - cmp r0, 0 - beq _08016BC6 - ldr r1, [r4] - ldr r0, [r4, 0x4] - adds r1, r5 - adds r0, r6 - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldr r0, [r4] - adds r0, r5 - movs r1, 0x40 - strb r1, [r0, 0x1B] - movs r7, 0x1 - b _08016BF8 -_08016BC6: - ldr r0, [r4] - adds r1, r0, r5 - ldrb r0, [r1, 0x1B] - cmp r0, 0 - beq _08016BF8 - subs r0, 0x1 - strb r0, [r1, 0x1B] - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0, 0x1B] - cmp r0, 0 - bne _08016BF8 - b _08016BF6 -_08016BE0: - movs r3, 0x4 - negs r3, r3 - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1A] - ldr r0, [r4] - adds r0, r5 - movs r1, 0 - strb r1, [r0, 0x1B] -_08016BF6: - movs r7, 0x2 -_08016BF8: - ldr r0, [r4] - add r0, r8 - movs r1, 0 - strh r1, [r0, 0x18] - b _08016C5C -_08016C02: - ldr r0, [r4] - adds r1, r0, r5 - ldrb r0, [r1, 0x1A] - lsls r2, r0, 30 - lsrs r0, r2, 30 - cmp r0, 0x2 - beq _08016C3C - ldrh r0, [r1, 0x18] - adds r0, 0x1 - strh r0, [r1, 0x18] - ldr r0, [r4] - adds r2, r0, r5 - ldrh r1, [r2, 0x18] - ldr r0, =0x00000257 - cmp r1, r0 - bls _08016C5C - ldrb r0, [r2, 0x1A] - movs r5, 0x4 - negs r5, r5 - adds r1, r5, 0 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0x1A] - movs r7, 0x2 - b _08016C5C - .pool -_08016C3C: - lsrs r0, r2, 30 - cmp r0, 0x2 - bne _08016C5C - ldrh r0, [r1, 0x18] - adds r0, 0x1 - strh r0, [r1, 0x18] - ldr r0, [r4] - adds r2, r0, r5 - ldrh r1, [r2, 0x18] - ldr r0, =0x00000383 - cmp r1, r0 - bls _08016C5C - adds r0, r2, 0 - movs r1, 0x1 - bl sub_8017580 -_08016C5C: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - cmp r0, 0x7 - bhi _08016C6C - b _08016B68 -_08016C6C: - movs r5, 0 - movs r6, 0x3 -_08016C70: - ldr r0, [r4] - ldr r1, [r4, 0x4] - adds r1, r5 - movs r2, 0x8 - bl sub_8017734 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08016C86 - movs r7, 0x1 -_08016C86: - adds r5, 0x1C - subs r6, 0x1 - cmp r6, 0 - bge _08016C70 - adds r0, r7, 0 -_08016C90: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8016B00 - - thumb_func_start sub_8016CA0 -sub_8016CA0: @ 8016CA0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r0, 2 - add r0, r10 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - movs r7, 0 - mov r0, sp - adds r0, 0x10 - str r0, [sp, 0x18] -_08016CC4: - lsls r2, r7, 24 - lsrs r2, 24 - mov r0, sp - ldr r1, [sp, 0x18] - bl sub_800DE7C - lsls r0, 24 - lsrs r4, r0, 24 - mov r0, sp - ldrb r0, [r0, 0xA] - lsls r0, 25 - lsrs r0, 25 - mov r2, r10 - lsls r1, r2, 2 - add r1, r10 - lsls r1, 3 - ldr r3, =gTasks - adds r1, r3 - movs r5, 0x10 - ldrsh r1, [r1, r5] - bl sub_8013D88 - cmp r0, 0 - bne _08016D00 - mov r1, sp - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} -_08016D00: - mov r0, sp - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - bne _08016D18 - mov r1, sp - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} -_08016D18: - cmp r4, 0 - bne _08016D9C - lsls r0, r7, 3 - mov r8, r0 - adds r1, r7, 0x1 - mov r9, r1 - cmp r7, 0 - ble _08016D58 - movs r2, 0 - str r2, [sp, 0x1C] - adds r4, r7, 0 -_08016D2E: - ldr r0, [r6, 0x4] - ldr r3, [sp, 0x1C] - adds r0, r3 - mov r1, sp - bl sub_8017630 - lsls r0, 24 - cmp r0, 0 - bne _08016D4C - mov r1, sp - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} -_08016D4C: - ldr r5, [sp, 0x1C] - adds r5, 0x1C - str r5, [sp, 0x1C] - subs r4, 0x1 - cmp r4, 0 - bne _08016D2E -_08016D58: - ldr r1, [r6, 0x4] - mov r0, r8 - subs r4, r0, r7 - lsls r4, 2 - adds r1, r4 - mov r0, sp - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r0, [r6, 0x4] - adds r0, r4 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - ldr r3, [r6, 0x4] - adds r3, r4 - movs r2, 0x1 - ands r2, r0 - ldrb r0, [r3, 0x18] - movs r4, 0x2 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x18] - b _08016DD4 - .pool -_08016D9C: - ldr r1, [r6] - lsls r4, r7, 3 - subs r4, r7 - lsls r4, 2 - adds r1, r4 - mov r0, sp - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r0, [r6] - adds r0, r4 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - ldr r3, [r6] - adds r3, r4 - movs r2, 0x1 - ands r2, r0 - ldrb r0, [r3, 0x18] - movs r4, 0x2 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x18] - adds r7, 0x1 - mov r9, r7 -_08016DD4: - mov r7, r9 - cmp r7, 0x3 - bgt _08016DDC - b _08016CC4 -_08016DDC: - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8016CA0 - - thumb_func_start sub_8016DF0 -sub_8016DF0: @ 8016DF0 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r0, =sub_8016CA0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r2, =gTasks + 0x8 - adds r3, r1, r2 - str r4, [r3] - str r5, [r3, 0x4] - adds r2, r1 - strh r6, [r2, 0x8] - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8016DF0 - - thumb_func_start sub_8016E24 -sub_8016E24: @ 8016E24 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r0, 2 - add r0, r10 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - movs r3, 0 -_08016E42: - lsls r4, r3, 3 - subs r0, r4, r3 - lsls r5, r0, 2 - ldr r0, [r6] - adds r0, r5 - adds r1, r0, 0 - adds r1, 0x10 - lsls r2, r3, 24 - lsrs r2, 24 - str r3, [sp] - bl sub_800DE7C - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0, 0xA] - lsls r0, 25 - lsrs r0, 25 - mov r2, r10 - lsls r1, r2, 2 - add r1, r10 - lsls r1, 3 - ldr r7, =gTasks - adds r1, r7 - movs r2, 0xC - ldrsh r1, [r1, r2] - bl sub_8013D88 - mov r8, r4 - ldr r3, [sp] - cmp r0, 0 - bne _08016E8E - ldr r1, [r6] - adds r1, r5 - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} -_08016E8E: - adds r4, r3, 0x1 - mov r9, r4 - cmp r3, 0 - ble _08016ED2 - str r5, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - adds r4, r3, 0 -_08016E9E: - ldr r1, [r6] - ldr r7, [sp, 0x8] - adds r0, r1, r7 - ldr r2, [sp, 0x4] - adds r1, r2 - str r3, [sp] - bl sub_8017630 - lsls r0, 24 - ldr r3, [sp] - cmp r0, 0 - bne _08016EC6 - ldr r1, [r6] - ldr r5, [sp, 0x4] - adds r1, r5 - ldr r0, =gUnknown_082F045C - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} -_08016EC6: - ldr r7, [sp, 0x8] - adds r7, 0x1C - str r7, [sp, 0x8] - subs r4, 0x1 - cmp r4, 0 - bne _08016E9E -_08016ED2: - mov r0, r8 - subs r4, r0, r3 - lsls r4, 2 - ldr r0, [r6] - adds r0, r4 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - ldr r3, [r6] - adds r3, r4 - movs r2, 0x1 - ands r2, r0 - ldrb r0, [r3, 0x18] - movs r4, 0x2 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x18] - mov r3, r9 - cmp r3, 0x3 - ble _08016E42 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8016E24 - - thumb_func_start sub_8016F1C -sub_8016F1C: @ 8016F1C - push {lr} - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x7 - bne _08016F2C - ldrb r1, [r0] - movs r0, 0x20 - b _08016F34 -_08016F2C: - cmp r1, 0x8 - bne _08016F3E - ldrb r1, [r0] - movs r0, 0x10 -_08016F34: - ands r0, r1 - cmp r0, 0 - beq _08016F3E - movs r0, 0x1 - b _08016F40 -_08016F3E: - movs r0, 0 -_08016F40: - pop {r1} - bx r1 - thumb_func_end sub_8016F1C - - thumb_func_start sub_8016F44 -sub_8016F44: @ 8016F44 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - movs r6, 0 - subs r0, 0x8 - movs r5, 0 - adds r1, r0 - mov r8, r1 -_08016F62: - ldr r0, [r4] - adds r0, r5 - adds r1, r0, 0 - adds r1, 0x10 - lsls r2, r6, 24 - lsrs r2, 24 - bl sub_800DF34 - lsls r0, 24 - cmp r0, 0 - beq _08016F86 - ldr r0, [r4] - adds r0, r5 - mov r2, r8 - movs r3, 0xC - ldrsh r1, [r2, r3] - bl sub_8016F1C -_08016F86: - ldr r0, [r4] - adds r0, r5 - ldr r1, =gUnknown_082F045C - bl sub_8017630 - ldr r3, [r4] - adds r3, r5 - movs r2, 0x1 - ands r2, r0 - ldrb r0, [r3, 0x18] - movs r7, 0x2 - negs r7, r7 - adds r1, r7, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x18] - adds r5, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - ble _08016F62 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8016F44 - - thumb_func_start sub_8016FC0 -sub_8016FC0: @ 8016FC0 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r0, =sub_8016E24 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - ldr r1, =gTasks + 0x8 - adds r3, r2, r1 - str r4, [r3] - adds r1, r2 - strh r5, [r1, 0x4] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8016FC0 - - thumb_func_start sub_8016FF0 -sub_8016FF0: @ 8016FF0 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r0, =sub_8016F44 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - ldr r1, =gTasks + 0x8 - adds r3, r2, r1 - str r4, [r3] - adds r1, r2 - strh r5, [r1, 0x4] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8016FF0 - - thumb_func_start sub_8017020 -sub_8017020: @ 8017020 - push {r4,lr} - adds r4, r0, 0 - bl sub_81973A4 - movs r0, 0 - movs r1, 0x1 - bl sub_81973C4 - ldr r0, =gStringVar4 - adds r1, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterWithCustomSpeedForMessage - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8017020 - - thumb_func_start sub_801704C -sub_801704C: @ 801704C - push {lr} - bl sub_8197224 - lsls r0, 16 - cmp r0, 0 - beq _0801705C - movs r0, 0 - b _0801705E -_0801705C: - movs r0, 0x1 -_0801705E: - pop {r1} - bx r1 - thumb_func_end sub_801704C - - thumb_func_start sub_8017064 -sub_8017064: @ 8017064 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _08017076 - cmp r0, 0x1 - beq _0801709C - b _080170AE -_08017076: - bl sub_81973A4 - movs r0, 0 - movs r1, 0x1 - bl sub_81973C4 - ldr r0, =gStringVar4 - adds r1, r5, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - bl AddTextPrinterForMessage_2 - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _080170AE - .pool -_0801709C: - bl sub_8197224 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080170AE - strb r0, [r4] - movs r0, 0x1 - b _080170B0 -_080170AE: - movs r0, 0 -_080170B0: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8017064 - - thumb_func_start sub_80170B8 -sub_80170B8: @ 80170B8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _080170CA - cmp r0, 0x1 - beq _080170E0 - b _0801710C -_080170CA: - cmp r5, 0 - beq _080170D4 - movs r0, 0x3 - negs r0, r0 - b _08017110 -_080170D4: - bl sub_8197930 - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801710C -_080170E0: - cmp r5, 0 - beq _080170F2 - bl sub_8198C78 - movs r0, 0 - strb r0, [r4] - movs r0, 0x3 - negs r0, r0 - b _08017110 -_080170F2: - bl sub_8198C58 - lsls r0, 24 - asrs r1, r0, 24 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0801710C - strb r5, [r4] - adds r0, r1, 0 - b _08017110 -_0801710C: - movs r0, 0x2 - negs r0, r0 -_08017110: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80170B8 - - thumb_func_start sub_8017118 -sub_8017118: @ 8017118 - push {r4,lr} - sub sp, 0x8 - bl AddWindow - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0 - bl sub_81973FC - adds r0, r4, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - ldr r2, =gUnknown_082EFD94 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x6 - str r0, [sp, 0x4] - adds r0, r4, 0 - movs r1, 0x1 - movs r3, 0x8 - bl sub_80173E0 - adds r0, r4, 0 - movs r1, 0x2 - bl CopyWindowToVram - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8017118 - - thumb_func_start sub_8017168 -sub_8017168: @ 8017168 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl RemoveWindow - pop {r0} - bx r0 - thumb_func_end sub_8017168 - - thumb_func_start sub_8017178 -sub_8017178: @ 8017178 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - adds r7, r0, 0 - adds r5, r1, 0 - mov r9, r2 - ldrb r4, [r7] - cmp r4, 0 - beq _08017194 - cmp r4, 0x1 - beq _08017228 - b _0801728E -_08017194: - ldr r0, [r3] - ldr r1, [r3, 0x4] - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, [sp, 0x24] - bl sub_81DB41C - adds r1, r0, 0 - ldr r2, [sp] - lsrs r0, r2, 24 - cmp r0, r1 - ble _080171B6 - lsls r1, 24 - ldr r0, =0x00ffffff - ands r0, r2 - orrs r0, r1 - str r0, [sp] -_080171B6: - ldr r2, [sp] - lsrs r0, r2, 8 - lsls r0, 24 - lsrs r0, 24 - lsrs r1, r2, 24 - adds r0, r1 - cmp r0, 0x1D - ble _080171DC - movs r0, 0x1D - subs r0, r1 - cmp r0, 0 - bge _080171D0 - movs r0, 0 -_080171D0: - lsls r1, r0, 24 - lsrs r1, 16 - ldr r0, =0xffff00ff - ands r0, r2 - orrs r0, r1 - str r0, [sp] -_080171DC: - mov r0, sp - bl AddWindow - strb r0, [r5] - ldrb r0, [r5] - movs r1, 0 - bl sub_81973FC - ldr r0, =gUnknown_03006310 - adds r2, r0, 0 - ldr r1, [sp, 0x24] - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldm r1!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldrb r1, [r5] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0 - bl ListMenuInit - mov r1, r9 - strb r0, [r1] - ldrb r0, [r5] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r7] - adds r0, 0x1 - strb r0, [r7] - b _0801728E - .pool -_08017228: - mov r3, r9 - ldrb r0, [r3] - bl ListMenuHandleInput - mov r8, r0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - ands r4, r1 - cmp r4, 0 - beq _08017264 - mov r4, r9 - ldrb r0, [r4] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldrb r0, [r5] - movs r1, 0x1 - bl sub_819746C - ldrb r0, [r5] - bl RemoveWindow - movs r0, 0 - strb r0, [r7] - mov r0, r8 - b _08017292 - .pool -_08017264: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0801728E - mov r6, r9 - ldrb r0, [r6] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldrb r0, [r5] - movs r1, 0x1 - bl sub_819746C - ldrb r0, [r5] - bl RemoveWindow - strb r4, [r7] - movs r0, 0x2 - negs r0, r0 - b _08017292 -_0801728E: - movs r0, 0x1 - negs r0, r0 -_08017292: - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8017178 - - thumb_func_start sub_80172A0 -sub_80172A0: @ 80172A0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r5, r0, 0 - adds r6, r1, 0 - mov r10, r2 - mov r9, r3 - ldrb r4, [r5] - cmp r4, 0x1 - beq _0801730C - cmp r4, 0x1 - bgt _080172C2 - cmp r4, 0 - beq _080172C8 - b _0801739C -_080172C2: - cmp r4, 0x2 - beq _0801731C - b _0801739C -_080172C8: - ldr r0, =gUnknown_082F0344 - bl sub_8017118 - mov r1, r9 - strb r0, [r1] - ldr r0, [sp, 0x20] - bl AddWindow - strb r0, [r6] - ldrb r0, [r6] - movs r1, 0 - bl sub_81973FC - ldr r0, =gUnknown_03006310 - adds r2, r0, 0 - ldr r1, [sp, 0x24] - ldm r1!, {r3,r4,r7} - stm r2!, {r3,r4,r7} - ldm r1!, {r3,r4,r7} - stm r2!, {r3,r4,r7} - ldrb r1, [r6] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0x1 - bl ListMenuInit - mov r1, r10 - strb r0, [r1] - b _08017314 - .pool -_0801730C: - ldrb r0, [r6] - movs r1, 0x1 - bl CopyWindowToVram -_08017314: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _0801739C -_0801731C: - mov r3, r10 - ldrb r0, [r3] - bl ListMenuHandleInput - adds r1, r0, 0 - ldr r0, =gMain - ldrh r2, [r0, 0x2E] - movs r0, 0x3 - ands r0, r2 - cmp r0, 0 - beq _0801739C - cmp r1, 0x8 - beq _0801733E - ands r4, r2 - mov r8, r4 - cmp r4, 0 - beq _08017368 -_0801733E: - mov r4, r10 - ldrb r0, [r4] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldrb r0, [r6] - bl RemoveWindow - mov r7, r9 - ldrb r0, [r7] - bl sub_8017168 - movs r0, 0 - strb r0, [r5] - movs r0, 0x2 - negs r0, r0 - b _080173A0 - .pool -_08017368: - ldr r0, [sp, 0x28] - bl sub_8017CB0 - adds r4, r0, 0 - cmp r4, 0 - blt _08017396 - mov r1, r10 - ldrb r0, [r1] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldrb r0, [r6] - bl RemoveWindow - mov r3, r9 - ldrb r0, [r3] - bl sub_8017168 - mov r7, r8 - strb r7, [r5] - adds r0, r4, 0 - b _080173A0 -_08017396: - movs r0, 0x7 - bl PlaySE -_0801739C: - movs r0, 0x1 - negs r0, r0 -_080173A0: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80172A0 - - thumb_func_start sub_80173B0 -sub_80173B0: @ 80173B0 - push {lr} - sub sp, 0xC - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_80173B0 - - thumb_func_start sub_80173D4 -sub_80173D4: @ 80173D4 - push {lr} - bl EnableBothScriptContexts - pop {r0} - bx r0 - thumb_func_end sub_80173D4 - - thumb_func_start sub_80173E0 -sub_80173E0: @ 80173E0 - push {r4,r5,lr} - sub sp, 0x10 - ldr r5, [sp, 0x1C] - ldr r4, [sp, 0x20] - lsls r3, 24 - lsrs r3, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r4, 24 - lsrs r4, 24 - str r2, [sp] - mov r2, sp - strb r0, [r2, 0x4] - mov r0, sp - strb r1, [r0, 0x5] - strb r3, [r0, 0x6] - strb r5, [r0, 0x7] - strb r3, [r0, 0x8] - strb r5, [r0, 0x9] - ldrb r1, [r2, 0xC] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0xC] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - cmp r4, 0x6 - bls _08017422 - b _0801756E -_08017422: - lsls r0, r4, 2 - ldr r1, =_08017434 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08017434: - .4byte _08017450 - .4byte _0801747C - .4byte _080174A8 - .4byte _080174D4 - .4byte _08017500 - .4byte _0801752C - .4byte _08017544 -_08017450: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x20 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_0801747C: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x50 - b _0801756A -_080174A8: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x60 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x70 - b _0801756A -_080174D4: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_08017500: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_0801752C: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r4, 0xF - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x70 - b _0801755A -_08017544: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r4, 0xF - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0xE0 -_0801755A: - orrs r0, r1 - strb r0, [r2, 0xC] - mov r1, sp - ldrb r0, [r1, 0xD] - orrs r0, r4 - strb r0, [r1, 0xD] - ands r0, r3 - movs r1, 0x90 -_0801756A: - orrs r0, r1 - strb r0, [r2, 0xD] -_0801756E: - mov r0, sp - movs r1, 0xFF - movs r2, 0 - bl AddTextPrinter - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80173E0 - - thumb_func_start sub_8017580 -sub_8017580: @ 8017580 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0 - beq _080175D8 - ldr r2, =gUnknown_082F045C - mov r8, r2 - movs r5, 0 - mov r9, r5 - movs r6, 0x4 - negs r6, r6 - mov r12, r6 - adds r2, r0, 0 - adds r2, 0x18 - adds r4, r0, 0 - movs r7, 0xFF - mov r10, r7 - adds r3, r1, 0 -_080175AC: - adds r1, r4, 0 - mov r0, r8 - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - mov r0, r10 - strh r0, [r2] - ldrb r1, [r2, 0x2] - mov r0, r12 - ands r0, r1 - movs r1, 0x5 - negs r1, r1 - ands r0, r1 - strb r0, [r2, 0x2] - mov r5, r9 - strb r5, [r2, 0x3] - adds r2, 0x20 - adds r4, 0x20 - subs r3, 0x1 - cmp r3, 0 - bne _080175AC -_080175D8: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8017580 - - thumb_func_start sub_80175EC -sub_80175EC: @ 80175EC - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r1, =gUnknown_082F045C - mov r12, r1 - movs r5, 0x2 - negs r5, r5 - mov r8, r5 - adds r2, r0, 0 - adds r2, 0x18 - adds r3, r0, 0 - movs r4, 0x3 -_08017604: - adds r1, r3, 0 - mov r0, r12 - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldrb r1, [r2] - mov r0, r8 - ands r0, r1 - strb r0, [r2] - adds r2, 0x1C - adds r3, 0x1C - subs r4, 0x1 - cmp r4, 0 - bge _08017604 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80175EC - - thumb_func_start sub_8017630 -sub_8017630: @ 8017630 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r2, 0 - adds r4, r5, 0x2 - adds r3, r6, 0x2 -_0801763C: - adds r0, r4, r2 - adds r1, r3, r2 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bne _08017664 - adds r2, 0x1 - cmp r2, 0x1 - ble _0801763C - movs r2, 0 - adds r4, r5, 0 - adds r4, 0x10 - adds r3, r6, 0 - adds r3, 0x10 -_08017658: - adds r0, r4, r2 - adds r1, r3, r2 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - beq _08017668 -_08017664: - movs r0, 0x1 - b _08017670 -_08017668: - adds r2, 0x1 - cmp r2, 0x7 - ble _08017658 - movs r0, 0 -_08017670: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8017630 - - thumb_func_start sub_8017678 -sub_8017678: @ 8017678 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldrb r3, [r5, 0xA] - movs r0, 0x7F - ldrb r2, [r6, 0xA] - adds r1, r0, 0 - ands r1, r3 - ands r0, r2 - cmp r1, r0 - bne _080176DC - movs r0, 0x80 - adds r1, r0, 0 - ands r1, r3 - ands r0, r2 - cmp r1, r0 - bne _080176DC - movs r2, 0 - adds r4, r5, 0x4 - adds r3, r6, 0x4 -_080176A0: - adds r0, r4, r2 - adds r1, r3, r2 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bne _080176DC - adds r2, 0x1 - cmp r2, 0x3 - ble _080176A0 - ldrh r2, [r5, 0x8] - ldr r0, =0x000003ff - ldrh r3, [r6, 0x8] - adds r1, r0, 0 - ands r1, r2 - ands r0, r3 - cmp r1, r0 - bne _080176DC - ldrb r2, [r5, 0x9] - movs r0, 0xFC - ldrb r3, [r6, 0x9] - adds r1, r0, 0 - ands r1, r2 - ands r0, r3 - cmp r1, r0 - bne _080176DC - movs r0, 0 - b _080176DE - .pool -_080176DC: - movs r0, 0x1 -_080176DE: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8017678 - - thumb_func_start sub_80176E4 -sub_80176E4: @ 80176E4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r0 - movs r7, 0xFF - movs r6, 0 - adds r4, r1, 0 - adds r4, 0x18 - adds r5, r1, 0 -_080176F6: - ldrb r1, [r4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801771E - mov r0, r8 - adds r1, r5, 0 - bl sub_8017630 - lsls r0, 24 - cmp r0, 0 - bne _0801771E - lsls r0, r6, 24 - lsrs r7, r0, 24 - ldrb r0, [r4] - movs r2, 0x2 - negs r2, r2 - adds r1, r2, 0 - ands r0, r1 - strb r0, [r4] -_0801771E: - adds r4, 0x1C - adds r5, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - ble _080176F6 - adds r0, r7, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80176E4 - - thumb_func_start sub_8017734 -sub_8017734: @ 8017734 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r3, r0, 0 - mov r8, r1 - lsls r2, 24 - lsrs r6, r2, 24 - ldrb r1, [r1, 0x18] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080177A8 - movs r5, 0 - cmp r5, r6 - bge _080177A8 - movs r0, 0x4 - negs r0, r0 - mov r9, r0 - movs r1, 0x2 - negs r1, r1 - mov r12, r1 - adds r2, r3, 0 - adds r2, 0x18 - adds r1, r3, 0 -_08017766: - ldrb r0, [r2, 0x2] - movs r3, 0x3 - ands r3, r0 - cmp r3, 0 - bne _0801779E - mov r0, r8 - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - strh r3, [r2] - ldrb r1, [r2, 0x2] - mov r0, r9 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x2] - movs r0, 0x40 - strb r0, [r2, 0x3] - mov r0, r8 - ldrb r1, [r0, 0x18] - mov r0, r12 - ands r0, r1 - mov r1, r8 - strb r0, [r1, 0x18] - lsls r0, r5, 24 - lsrs r0, 24 - b _080177AA -_0801779E: - adds r2, 0x20 - adds r1, 0x20 - adds r5, 0x1 - cmp r5, r6 - blt _08017766 -_080177A8: - movs r0, 0xFF -_080177AA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8017734 - - thumb_func_start sub_80177B8 -sub_80177B8: @ 80177B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r4, r1, 0 - adds r6, r3, 0 - ldr r3, [sp, 0x2C] - ldr r1, [sp, 0x30] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - lsls r1, 24 - lsrs r1, 24 - ldr r5, =gStringVar4 - adds r1, 0x1 - adds r0, r5, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r1, =gText_Colon - adds r0, r5, 0 - bl StringAppend - str r7, [sp] - movs r0, 0 - str r0, [sp, 0x4] - mov r0, r8 - movs r1, 0x1 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_80173E0 - adds r4, 0x12 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6, 0xA] - lsls r0, 25 - lsrs r2, r0, 25 - ldrb r1, [r6, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _08017884 - movs r0, 0x40 - ands r2, r0 - cmp r2, 0 - bne _08017884 - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_8018404 - str r7, [sp] - mov r0, r9 - str r0, [sp, 0x4] - mov r0, r8 - movs r1, 0x1 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_80173E0 - ldrb r1, [r6, 0x2] - ldrb r0, [r6, 0x3] - lsls r0, 8 - orrs r1, r0 - add r0, sp, 0x8 - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r1, =gText_UnkCtrlCodeF907 - adds r0, r5, 0 - bl StringCopy - adds r0, r5, 0 - add r1, sp, 0x8 - bl StringAppend - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x88 - bl GetStringRightAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - str r7, [sp] - mov r0, r9 - str r0, [sp, 0x4] - mov r0, r8 - movs r1, 0x1 - adds r2, r5, 0 - bl sub_80173E0 -_08017884: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80177B8 - - thumb_func_start sub_80178A0 -sub_80178A0: @ 80178A0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r5, r3, 0 - ldr r3, [sp, 0x2C] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - lsrs r7, r3, 24 - ldrb r1, [r5, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801792A - ldr r4, =gStringVar4 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_8018404 - mov r0, r8 - str r0, [sp] - str r7, [sp, 0x4] - mov r0, r9 - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r6, 0 - bl sub_80173E0 - ldrb r1, [r5, 0x2] - ldrb r0, [r5, 0x3] - lsls r0, 8 - orrs r1, r0 - add r0, sp, 0x8 - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r1, =gText_UnkCtrlCodeF907 - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - add r1, sp, 0x8 - bl StringAppend - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x68 - bl GetStringRightAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - str r0, [sp] - str r7, [sp, 0x4] - mov r0, r9 - movs r1, 0x1 - adds r2, r4, 0 - bl sub_80173E0 -_0801792A: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80178A0 - - thumb_func_start sub_8017940 -sub_8017940: @ 8017940 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x9 - bne _08017978 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0x8 - bne _08017978 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x3] - cmp r0, 0x2 - beq _0801796E - cmp r0, 0 - bne _08017978 -_0801796E: - movs r0, 0x1 - b _0801797A - .pool -_08017978: - movs r0, 0 -_0801797A: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8017940 - - thumb_func_start sub_8017984 -sub_8017984: @ 8017984 - push {lr} - cmp r0, 0x4 - beq _0801799C - cmp r0, 0x4 - ble _080179A4 - cmp r0, 0x5 - beq _08017998 - cmp r0, 0x8 - beq _080179A0 - b _080179A4 -_08017998: - movs r0, 0x1 - b _080179A6 -_0801799C: - movs r0, 0x2 - b _080179A6 -_080179A0: - movs r0, 0x3 - b _080179A6 -_080179A4: - movs r0, 0 -_080179A6: - pop {r1} - bx r1 - thumb_func_end sub_8017984 - - thumb_func_start sub_80179AC -sub_80179AC: @ 80179AC - push {r4,lr} - sub sp, 0x20 - adds r4, r0, 0 - mov r0, sp - adds r1, r4, 0 - bl sub_8018404 - adds r4, 0x2 - adds r0, r4, 0 - bl sub_8015658 - lsls r0, 16 - lsrs r0, 16 - mov r1, sp - bl sub_800E540 - add sp, 0x20 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80179AC - - thumb_func_start sub_80179D4 -sub_80179D4: @ 80179D4 - push {r4-r6,lr} - adds r6, r3, 0 - lsls r1, 24 - lsrs r4, r1, 24 - lsls r2, 24 - lsrs r2, 19 - adds r5, r0, r2 - ldrb r1, [r5, 0xA] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08017A4C - cmp r4, 0 - bne _08017A4C - ldr r4, =gStringVar1 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_8018404 - adds r0, r5, 0x2 - bl sub_8015658 - lsls r0, 16 - lsrs r0, 16 - adds r1, r4, 0 - bl sub_800E540 - adds r2, r0, 0 - ldrb r1, [r5, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - bne _08017A38 - ldr r0, =gStringVar4 - ldr r3, =gUnknown_082EE6B8 - lsls r1, r6, 2 - lsls r2, 3 - adds r1, r2 - adds r1, r3 - ldr r1, [r1] - bl StringExpandPlaceholders - movs r0, 0x2 - b _08017B2A - .pool -_08017A38: - ldr r0, =gUnknown_082EE17C - lsls r1, r2, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_8017020 - movs r0, 0x1 - b _08017B2A - .pool -_08017A4C: - ldr r0, =gStringVar1 - adds r1, r5, 0 - bl sub_8018404 - cmp r4, 0 - beq _08017A62 - adds r0, r5, r4 - ldrb r0, [r0, 0x3] - lsrs r6, r0, 3 - movs r0, 0x1 - ands r6, r0 -_08017A62: - ldrb r0, [r5, 0xA] - lsls r0, 25 - lsrs r0, 25 - movs r1, 0x3F - ands r1, r0 - cmp r1, 0x4 - beq _08017AB0 - cmp r1, 0x4 - bgt _08017A80 - cmp r1, 0x1 - beq _08017A8A - b _08017B20 - .pool -_08017A80: - cmp r1, 0x5 - beq _08017AD0 - cmp r1, 0x8 - beq _08017AF4 - b _08017B20 -_08017A8A: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_082EEEAC - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsrs r1, 14 - lsls r0, r6, 4 - adds r1, r0 - adds r1, r4 - ldr r1, [r1] - b _08017B0E - .pool -_08017AB0: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_082EF1CC - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - lsls r1, r6, 4 - b _08017B08 - .pool -_08017AD0: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_082EF010 - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsrs r1, 14 - lsls r0, r6, 4 - adds r1, r0 - adds r1, r4 - ldr r1, [r1] - b _08017B0E - .pool -_08017AF4: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_082EF100 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - lsls r1, r6, 3 -_08017B08: - adds r0, r1 - adds r0, r4 - ldr r1, [r0] -_08017B0E: - adds r0, r5, 0 - bl StringExpandPlaceholders - b _08017B28 - .pool -_08017B20: - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EE6C8 - bl StringExpandPlaceholders -_08017B28: - movs r0, 0 -_08017B2A: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80179D4 - - thumb_func_start nullsub_14 -nullsub_14: @ 8017B38 - bx lr - thumb_func_end nullsub_14 - - thumb_func_start sub_8017B3C -sub_8017B3C: @ 8017B3C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - ldr r4, [sp, 0x28] - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r4, 24 - lsrs r4, 24 - ldrh r0, [r2, 0x8] - lsls r0, 22 - lsrs r0, 22 - mov r8, r0 - ldrb r0, [r2, 0x9] - lsrs r7, r0, 2 - ldrb r0, [r2, 0xB] - lsrs r0, 1 - mov r9, r0 - str r5, [sp] - str r4, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - adds r2, r3, 0 - movs r3, 0x8 - bl sub_80173E0 - movs r0, 0xCE - lsls r0, 1 - cmp r8, r0 - bne _08017B94 - ldr r2, =gUnknown_082EF7D0 - str r5, [sp] - str r4, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - movs r3, 0x44 - bl sub_80173E0 - b _08017BD4 - .pool -_08017B94: - adds r1, r7, 0x1 - adds r0, r6, 0 - movs r2, 0x44 - adds r3, r5, 0 - bl blit_move_info_icon - movs r0, 0xB - mov r2, r8 - muls r2, r0 - ldr r0, =gSpeciesNames - adds r2, r0 - str r5, [sp] - str r4, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - movs r3, 0x76 - bl sub_80173E0 - add r0, sp, 0x8 - mov r1, r9 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - str r5, [sp] - str r4, [sp, 0x4] - adds r0, r6, 0 - movs r1, 0x1 - add r2, sp, 0x8 - movs r3, 0xC6 - bl sub_80173E0 -_08017BD4: - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8017B3C - - thumb_func_start sub_8017BE8 -sub_8017BE8: @ 8017BE8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r2, 24 - lsrs r7, r2, 24 - ldr r0, =gUnknown_02022C30 - ldr r0, [r0] - mov r8, r0 - movs r0, 0x3 - negs r0, r0 - cmp r4, r0 - bne _08017C6C - ldr r0, =gUnknown_082F03A4 - ldrb r0, [r0, 0x14] - lsls r0, 28 - lsrs r0, 28 - cmp r7, r0 - bne _08017C6C - bl sub_800F7DC - adds r2, r0, 0 - ldrh r1, [r2, 0x8] - ldr r0, =0x000003ff - ands r0, r1 - cmp r0, 0 - beq _08017CA0 - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - movs r0, 0x5 - str r0, [sp] - mov r0, r9 - adds r1, r7, 0 - bl sub_8017B3C - b _08017CA0 - .pool -_08017C4C: - mov r0, r12 - adds r1, r0, r4 - add r0, sp, 0x4 - bl sub_8018404 - mov r0, r8 - ldr r2, [r0] - adds r2, r4 - movs r0, 0x6 - str r0, [sp] - mov r0, r9 - adds r1, r7, 0 - add r3, sp, 0x4 - bl sub_8017B3C - b _08017CA0 -_08017C6C: - movs r5, 0 - movs r1, 0 - mov r2, r8 - ldr r2, [r2] - mov r12, r2 - adds r2, 0x8 - movs r3, 0 - adds r6, r4, 0x1 -_08017C7C: - ldrb r0, [r2, 0x12] - lsls r0, 30 - lsrs r0, 30 - adds r4, r3, 0 - cmp r0, 0x1 - bne _08017C92 - ldrh r0, [r2] - lsls r0, 22 - cmp r0, 0 - beq _08017C92 - adds r5, 0x1 -_08017C92: - cmp r5, r6 - beq _08017C4C - adds r2, 0x20 - adds r3, 0x20 - adds r1, 0x1 - cmp r1, 0x7 - ble _08017C7C -_08017CA0: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8017BE8 - - thumb_func_start sub_8017CB0 -sub_8017CB0: @ 8017CB0 - push {r4-r7,lr} - movs r4, 0 - movs r3, 0 - movs r7, 0x3 - ldr r6, =0x000003ff - adds r2, r0, 0 - adds r2, 0x8 - adds r5, r1, 0x1 -_08017CC0: - ldrb r1, [r2, 0x12] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0x1 - bne _08017CD6 - ldrh r1, [r2] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _08017CD6 - adds r4, 0x1 -_08017CD6: - cmp r4, r5 - bne _08017CE4 - adds r0, r3, 0 - b _08017CF0 - .pool -_08017CE4: - adds r2, 0x20 - adds r3, 0x1 - cmp r3, 0x7 - ble _08017CC0 - movs r0, 0x1 - negs r0, r0 -_08017CF0: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8017CB0 - - thumb_func_start sub_8017CF8 -sub_8017CF8: @ 8017CF8 - lsls r0, 5 - adds r0, r1 - ldrb r0, [r0, 0xB] - lsls r0, 31 - lsrs r0, 31 - bx lr - thumb_func_end sub_8017CF8 - - thumb_func_start sub_8017D04 -sub_8017D04: @ 8017D04 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - bne _08017D44 - movs r4, 0 - b _08017D2E -_08017D14: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x41 - bl GetMonData - adds r1, r0, 0 - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _08017D74 - adds r4, 0x1 -_08017D2E: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - blt _08017D14 - movs r0, 0x2 - b _08017D90 - .pool -_08017D44: - movs r4, 0 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - bge _08017D8E - ldr r6, =gBaseStats -_08017D50: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x41 - bl GetMonData - adds r1, r0, 0 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r1, r0, r6 - ldrb r0, [r1, 0x6] - cmp r0, r5 - beq _08017D74 - ldrb r0, [r1, 0x7] - cmp r0, r5 - bne _08017D84 -_08017D74: - movs r0, 0 - b _08017D90 - .pool -_08017D84: - adds r4, 0x1 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - blt _08017D50 -_08017D8E: - movs r0, 0x1 -_08017D90: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8017D04 - - thumb_func_start sub_8017D9C -sub_8017D9C: @ 8017D9C - push {lr} - adds r3, r0, 0 - cmp r1, 0x44 - beq _08017DD8 - cmp r1, 0x44 - bgt _08017DAE - cmp r1, 0x41 - beq _08017DB8 - b _08017DF6 -_08017DAE: - cmp r1, 0x45 - beq _08017DC8 - cmp r1, 0x48 - beq _08017DE8 - b _08017DF6 -_08017DB8: - ldr r0, =gUnknown_082EEA68 - lsls r1, r2, 2 - adds r1, r0 - ldr r1, [r1] - b _08017DDA - .pool -_08017DC8: - ldr r0, =gUnknown_082EED3C - lsls r1, r2, 2 - adds r1, r0 - ldr r1, [r1] - b _08017DDA - .pool -_08017DD8: - ldr r1, =gUnknown_082EF7B0 -_08017DDA: - adds r0, r3, 0 - bl StringExpandPlaceholders - b _08017DF6 - .pool -_08017DE8: - ldr r0, =gUnknown_082EEB08 - lsls r1, r2, 2 - adds r1, r0 - ldr r1, [r1] - adds r0, r3, 0 - bl StringExpandPlaceholders -_08017DF6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8017D9C - - thumb_func_start sub_8017E00 -sub_8017E00: @ 8017E00 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - adds r6, r4, 0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r3, r0, 24 - ldr r2, =gLinkPlayers - movs r0, 0x1 - adds r1, r3, 0 - eors r1, r0 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x13] - cmp r4, 0x44 - beq _08017E54 - cmp r4, 0x44 - bgt _08017E38 - cmp r4, 0x41 - beq _08017E3E - b _08017E94 - .pool -_08017E38: - cmp r6, 0x45 - beq _08017E78 - b _08017E94 -_08017E3E: - ldr r2, =gUnknown_082EE984 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 3 - adds r1, r0 - b _08017E66 - .pool -_08017E54: - ldr r2, =gUnknown_082EE984 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 3 - adds r1, r0 - adds r2, 0x8 -_08017E66: - adds r1, r2 - ldr r1, [r1] - adds r0, r5, 0 - bl StringCopy - b _08017E94 - .pool -_08017E78: - ldr r2, =gUnknown_082EE984 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 3 - adds r1, r0 - adds r2, 0x4 - adds r1, r2 - ldr r1, [r1] - adds r0, r5, 0 - bl StringCopy -_08017E94: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8017E00 - - thumb_func_start sub_8017EA0 -sub_8017EA0: @ 8017EA0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r0, 0 - adds r5, r2, 0 - adds r6, r3, 0 - movs r2, 0 - mov r8, r2 - ldrh r0, [r5] - subs r0, 0x40 - cmp r0, 0x8 - bls _08017EBA - b _08017FC6 -_08017EBA: - lsls r0, 2 - ldr r1, =_08017EC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08017EC8: - .4byte _08017FBC - .4byte _08017EEC - .4byte _08017FC6 - .4byte _08017FC6 - .4byte _08017EFC - .4byte _08017EF4 - .4byte _08017FC6 - .4byte _08017FC6 - .4byte _08017FAC -_08017EEC: - ldr r1, =gUnknown_082EE3DC - b _08017FAE - .pool -_08017EF4: - ldr r1, =gUnknown_082EE430 - b _08017FAE - .pool -_08017EFC: - adds r0, r6, 0 - adds r0, 0x58 - ldr r4, =gUnknown_02022C40 - ldrh r1, [r4, 0xC] - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r0, r6, 0 - adds r0, 0x68 - ldrh r2, [r4, 0xA] - movs r1, 0xB - muls r1, r2 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - movs r4, 0 - b _08017F2E - .pool -_08017F2C: - adds r4, 0x1 -_08017F2E: - cmp r4, 0x3 - bgt _08017F64 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - lsls r1, r4, 5 - adds r0, r1 - ldrh r0, [r0, 0x18] - cmp r0, 0x2 - bne _08017F2C - ldrh r1, [r5, 0x4] - adds r0, r6, 0 - adds r0, 0x78 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldrh r1, [r5, 0x2] - movs r0, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r6, 0 - adds r0, 0x88 - bl StringCopy - ldrh r5, [r5, 0x2] - mov r8, r5 -_08017F64: - movs r0, 0xCE - lsls r0, 1 - cmp r8, r0 - bne _08017F84 - ldr r1, =gUnknown_082EE4F0 - adds r0, r7, 0 - bl StringCopy - b _08017FB4 - .pool -_08017F84: - movs r4, 0 - adds r5, r6, 0 - adds r5, 0x58 -_08017F8A: - lsls r0, r4, 24 - lsrs r0, 24 - adds r1, r5, 0 - bl sub_81AFC0C - adds r5, 0x10 - adds r4, 0x1 - cmp r4, 0x3 - ble _08017F8A - ldr r1, =gUnknown_082EE47C - adds r0, r7, 0 - bl sub_81AFC28 - b _08017FB4 - .pool -_08017FAC: - ldr r1, =gUnknown_082EE380 -_08017FAE: - adds r0, r7, 0 - bl StringExpandPlaceholders -_08017FB4: - movs r2, 0x1 - b _08017FC6 - .pool -_08017FBC: - ldr r1, =gUnknown_082EE544 - adds r0, r7, 0 - bl StringExpandPlaceholders - movs r2, 0x2 -_08017FC6: - adds r0, r2, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8017EA0 - - thumb_func_start sub_8017FD8 -sub_8017FD8: @ 8017FD8 - push {lr} - adds r2, r0, 0 - ldr r0, =gUnknown_03003090 - ldrh r1, [r0, 0x2] - cmp r1, 0 - beq _08017FFC - cmp r1, 0x51 - beq _08017FEC - cmp r1, 0x52 - bne _08017FFC -_08017FEC: - adds r0, r2, 0 - adds r0, 0x98 - strh r1, [r0] - movs r0, 0x1 - b _08017FFE - .pool -_08017FFC: - movs r0, 0 -_08017FFE: - pop {r1} - bx r1 - thumb_func_end sub_8017FD8 - - thumb_func_start InUnionRoom -InUnionRoom: @ 8018004 - push {lr} - movs r2, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x00003c19 - cmp r1, r0 - bne _08018016 - movs r2, 0x1 -_08018016: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end InUnionRoom - - thumb_func_start sub_8018024 -sub_8018024: @ 8018024 - push {r4-r6,lr} - movs r6, 0 - movs r5, 0 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r6, r0 - bge _08018064 -_08018032: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - cmp r0, 0x1E - bhi _0801805A - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - beq _0801805A - adds r6, 0x1 -_0801805A: - adds r5, 0x1 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r5, r0 - blt _08018032 -_08018064: - cmp r6, 0x1 - bgt _08018074 - movs r0, 0 - b _08018076 - .pool -_08018074: - movs r0, 0x1 -_08018076: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8018024 - - thumb_func_start sub_801807C -sub_801807C: @ 801807C - movs r1, 0 - strh r1, [r0] - strh r1, [r0, 0x2] - str r1, [r0, 0x4] - strh r1, [r0, 0xA] - strh r1, [r0, 0xC] - strh r1, [r0, 0xE] - strh r1, [r0, 0x10] - str r1, [r0, 0x14] - bx lr - thumb_func_end sub_801807C - - thumb_func_start sub_8018090 -sub_8018090: @ 8018090 - push {lr} - ldr r0, =gUnknown_02022C40 - bl sub_801807C - pop {r0} - bx r0 - .pool - thumb_func_end sub_8018090 - - thumb_func_start sub_80180A0 -sub_80180A0: @ 80180A0 - push {r4,r5,lr} - adds r5, r1, 0 - movs r1, 0x64 - adds r4, r0, 0 - muls r4, r1 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - strh r0, [r5, 0xA] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - strh r0, [r5, 0xC] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [r5, 0x4] - ldrh r1, [r5, 0xA] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _080180E0 - movs r0, 0 - b _080180E2 - .pool -_080180E0: - movs r0, 0x1 -_080180E2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80180A0 - - thumb_func_start sub_80180E8 -sub_80180E8: @ 80180E8 - push {r4,r5,lr} - adds r5, r1, 0 - movs r1, 0x64 - adds r4, r0, 0 - muls r4, r1 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - strh r0, [r5, 0xE] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - strh r0, [r5, 0x10] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [r5, 0x14] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80180E8 - - thumb_func_start sub_8018120 -sub_8018120: @ 8018120 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r1, 24 - movs r2, 0 - mov r8, r2 - cmp r1, 0 - bne _0801813E - ldrh r7, [r0, 0xA] - ldr r6, [r0, 0x4] - b _08018142 -_08018136: - lsls r0, r5, 16 - lsrs r0, 16 - mov r8, r0 - b _08018176 -_0801813E: - ldrh r7, [r0, 0xE] - ldr r6, [r0, 0x14] -_08018142: - movs r5, 0 - b _0801816E -_08018146: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - cmp r0, r6 - bne _0801816C - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - cmp r0, r7 - beq _08018136 -_0801816C: - adds r5, 0x1 -_0801816E: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r5, r0 - blt _08018146 -_08018176: - mov r0, r8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8018120 - - thumb_func_start sub_801818C -sub_801818C: @ 801818C - push {r4,lr} - adds r4, r0, 0 - bl sub_80173B0 - bl ScriptContext2_Disable - bl sub_8098524 - ldr r1, =gUnknown_02022C2C - movs r0, 0 - strb r0, [r1] - cmp r4, 0 - beq _080181BC - ldr r2, =gUnknown_02022C40 - ldrh r0, [r2, 0x2] - ldrh r1, [r2, 0xA] - ldrh r2, [r2, 0xC] - bl sub_8010FCC - movs r0, 0x40 - movs r1, 0 - movs r2, 0 - bl sub_8011090 -_080181BC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801818C - - thumb_func_start sub_80181CC -sub_80181CC: @ 80181CC - push {lr} - bl ScriptContext2_Enable - bl ScriptFreezeMapObjects - pop {r0} - bx r0 - thumb_func_end sub_80181CC - - thumb_func_start sub_80181DC -sub_80181DC: @ 80181DC - push {r4,lr} - movs r3, 0x80 - movs r2, 0 - ldr r4, [r0, 0xC] -_080181E4: - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r1, r4, r0 - ldrb r0, [r1, 0x18] - lsls r0, 31 - cmp r0, 0 - beq _0801820C - ldrb r0, [r1, 0xB] - lsls r0, 31 - lsrs r0, 31 - lsls r0, 3 - orrs r3, r0 - ldrb r1, [r1, 0x2] - movs r0, 0x7 - ands r0, r1 - orrs r3, r0 - lsls r0, r3, 24 - lsrs r3, r0, 24 - b _08018216 -_0801820C: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _080181E4 -_08018216: - adds r0, r3, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80181DC - - thumb_func_start sub_8018220 -sub_8018220: @ 8018220 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r9, r1 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp] - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r1, r0 - ldr r0, =gUnknown_02039B58 - adds r1, r0 - mov r8, r1 - bl sub_81AFBF0 - mov r6, r9 - adds r6, 0xC0 - bl sub_8068BB0 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xD - muls r1, r0 - ldr r0, =gTrainerClassNames - adds r1, r0 - adds r0, r6, 0 - bl StringCopy - movs r0, 0 - adds r1, r6, 0 - bl sub_81AFC0C - mov r1, r8 - adds r1, 0x30 - movs r0, 0x1 - bl sub_81AFC0C - movs r4, 0xBA - lsls r4, 1 - add r4, r9 - ldr r1, =gUnknown_082EFF50 - mov r2, r8 - ldrb r0, [r2, 0x1] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringCopy - movs r0, 0x2 - adds r1, r4, 0 - bl sub_81AFC0C - mov r5, r9 - adds r5, 0xDE - mov r0, r8 - ldrh r1, [r0, 0xC] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - movs r0, 0x3 - adds r1, r5, 0 - bl sub_81AFC0C - movs r2, 0xED - add r2, r9 - mov r10, r2 - mov r0, r8 - ldrh r1, [r0, 0x10] - mov r0, r10 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - mov r4, r9 - adds r4, 0xFC - mov r2, r8 - ldrh r1, [r2, 0x12] - adds r0, r4, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - movs r0, 0x4 - mov r1, r10 - bl sub_81AFC0C - movs r0, 0x5 - adds r1, r4, 0 - bl sub_81AFC0C - movs r4, 0xD2 - lsls r4, 1 - add r4, r9 - ldr r1, =gUnknown_082EFF64 - adds r0, r4, 0 - bl sub_81AFC28 - ldr r0, =gStringVar4 - adds r1, r4, 0 - bl StringCopy - mov r0, r8 - ldrh r1, [r0, 0x14] - ldr r4, =0x0000270f - cmp r1, r4 - ble _0801830C - adds r1, r4, 0 -_0801830C: - adds r0, r6, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - movs r0, 0 - adds r1, r6, 0 - bl sub_81AFC0C - mov r2, r8 - ldrh r1, [r2, 0x16] - cmp r1, r4 - ble _08018328 - adds r1, r4, 0 -_08018328: - mov r4, r9 - adds r4, 0xCF - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - movs r0, 0x2 - adds r1, r4, 0 - bl sub_81AFC0C - mov r0, r8 - ldrh r1, [r0, 0x20] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - movs r0, 0x3 - adds r1, r5, 0 - bl sub_81AFC0C - movs r7, 0 - movs r6, 0x80 - lsls r6, 19 - mov r5, r8 - adds r5, 0x28 - mov r4, r10 -_08018360: - ldrh r1, [r5] - adds r0, r4, 0 - bl CopyEasyChatWord - lsrs r0, r6, 24 - adds r1, r4, 0 - bl sub_81AFC0C - movs r2, 0x80 - lsls r2, 17 - adds r6, r2 - adds r5, 0x2 - adds r4, 0xF - adds r7, 0x1 - cmp r7, 0x3 - ble _08018360 - movs r4, 0xD2 - lsls r4, 1 - add r4, r9 - ldr r1, =gUnknown_082EFFA4 - adds r0, r4, 0 - bl sub_81AFC28 - ldr r5, =gStringVar4 - adds r0, r5, 0 - adds r1, r4, 0 - bl StringAppend - ldr r0, [sp] - cmp r0, 0x1 - bne _080183D0 - ldr r1, =gUnknown_082F0020 - adds r0, r4, 0 - bl sub_81AFC28 - adds r0, r5, 0 - adds r1, r4, 0 - bl StringAppend - b _080183F0 - .pool -_080183D0: - ldr r2, [sp] - cmp r2, 0 - bne _080183F0 - ldr r0, =gUnknown_082F0018 - mov r2, r8 - ldrb r1, [r2] - lsls r1, 2 - adds r1, r0 - ldr r1, [r1] - adds r0, r4, 0 - bl sub_81AFC28 - adds r0, r5, 0 - adds r1, r4, 0 - bl StringAppend -_080183F0: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8018220 - - thumb_func_start sub_8018404 -sub_8018404: @ 8018404 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r1, 0x10 - bl StringCopy7 - ldrb r1, [r4] - lsls r1, 28 - lsrs r1, 28 - adds r0, r5, 0 - bl ConvertInternationalString - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8018404 - - thumb_func_start sub_8018424 -sub_8018424: @ 8018424 - push {lr} - bl ProcessSpriteCopyRequests - bl LoadOam - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_8018424 - - thumb_func_start sub_8018438 -sub_8018438: @ 8018438 - push {lr} - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - pop {r0} - bx r0 - thumb_func_end sub_8018438 - - thumb_func_start sub_8018450 -sub_8018450: @ 8018450 - push {r4-r7,lr} - sub sp, 0xC - adds r7, r0, 0 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r6, r0, r1 - ldrb r0, [r6] - cmp r0, 0x1 - bne _08018466 - b _08018574 -_08018466: - cmp r0, 0x1 - bgt _08018474 - cmp r0, 0 - beq _08018482 - b _08018644 - .pool -_08018474: - cmp r0, 0x2 - bne _0801847A - b _080185F8 -_0801847A: - cmp r0, 0x3 - bne _08018480 - b _08018618 -_08018480: - b _08018644 -_08018482: - movs r0, 0 - bl SetVBlankCallback - bl ResetPaletteFade - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - bl remove_some_task - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F0598 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r4, 0x80 - lsls r4, 4 - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x3 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x2 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x1 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0 - bl SetBgTilemapBuffer - movs r0, 0x3 - bl bgid_upload_textbox_1 - ldr r0, =gUnknown_082F05A8 - bl InitWindows - bl DeactivateAllTextPrinters - movs r1, 0xC0 - lsls r1, 7 - movs r0, 0 - bl ClearGpuRegBits - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - b _08018610 - .pool -_08018574: - ldr r0, =gUnkTextboxBorderPal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0x2 - bl stdpal_get - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0xC0 - bl sub_81978B0 - movs r0, 0 - movs r1, 0xA - movs r2, 0xE0 - bl sub_809882C - movs r0, 0 - movs r1, 0x1 - movs r2, 0xF0 - bl box_border_load_tiles_and_pal - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x3 - bl sub_8018798 - lsls r0, r7, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80186EC - b _08018610 - .pool -_080185F8: - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl CopyBgTilemapBufferToVram -_08018610: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _08018644 -_08018618: - movs r0, 0 - bl ShowBg - movs r0, 0x3 - bl ShowBg - ldr r0, =0x0000021d - bl PlayBGM - ldr r0, =sub_8018424 - bl SetVBlankCallback - movs r0, 0xC5 - bl EnableInterrupts - movs r0, 0x1 - b _08018646 - .pool -_08018644: - movs r0, 0 -_08018646: - add sp, 0xC - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8018450 - - thumb_func_start c2_mystery_gift -c2_mystery_gift: @ 8018650 - push {lr} - movs r0, 0 - bl sub_8018450 - cmp r0, 0 - beq _0801866C - ldr r0, =sub_8018438 - bl SetMainCallback2 - ldr r1, =gUnknown_02022C60 - movs r0, 0 - strb r0, [r1] - bl task_add_00_mystery_gift -_0801866C: - bl RunTasks - pop {r0} - bx r0 - .pool - thumb_func_end c2_mystery_gift - - thumb_func_start sub_801867C -sub_801867C: @ 801867C - push {lr} - movs r0, 0x1 - bl sub_8018450 - cmp r0, 0 - beq _08018698 - ldr r0, =sub_8018438 - bl SetMainCallback2 - ldr r1, =gUnknown_02022C60 - movs r0, 0x1 - strb r0, [r1] - bl sub_81D5014 -_08018698: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801867C - - thumb_func_start sub_80186A4 -sub_80186A4: @ 80186A4 - push {lr} - ldr r1, =gUnknown_02022C60 - movs r0, 0 - strb r0, [r1] - bl FreeAllWindowBuffers - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x2 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - ldr r0, =c2_title_screen_1 - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80186A4 - - thumb_func_start sub_80186EC -sub_80186EC: @ 80186EC - push {r4-r7,lr} - sub sp, 0x14 - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - cmp r4, 0 - bne _0801871C - ldr r0, =gText_MysteryGift - ldr r7, =gText_PickOKCancel - cmp r5, 0 - bne _08018720 - ldr r7, =gText_PickOKExit - b _08018720 - .pool -_0801871C: - ldr r0, =gJPText_MysteryGift - ldr r7, =gJPText_DecideStop -_08018720: - movs r4, 0 - str r4, [sp] - str r4, [sp, 0x4] - ldr r6, =gUnknown_082F0720 - str r6, [sp, 0x8] - movs r5, 0x1 - negs r5, r5 - str r5, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x1 - bl AddTextPrinterParametrized2 - movs r0, 0 - adds r1, r7, 0 - movs r2, 0xDE - bl GetStringRightAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - str r4, [sp] - str r4, [sp, 0x4] - str r6, [sp, 0x8] - str r5, [sp, 0xC] - str r7, [sp, 0x10] - movs r0, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParametrized2 - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl PutWindowTilemap - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80186EC - - thumb_func_start sub_8018784 -sub_8018784: @ 8018784 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - pop {r0} - bx r0 - thumb_func_end sub_8018784 - - thumb_func_start sub_8018798 -sub_8018798: @ 8018798 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0 - mov r9, r0 - lsls r4, 24 - lsrs r0, r4, 24 - movs r1, 0x20 - str r1, [sp] - movs r1, 0x2 - str r1, [sp, 0x4] - movs r1, 0x11 - str r1, [sp, 0x8] - movs r1, 0x3 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - mov r8, r4 - movs r4, 0x1 -_080187C8: - movs r7, 0 - mov r0, r9 - adds r0, 0x2 - movs r1, 0x1 - add r1, r9 - mov r10, r1 - lsls r5, r0, 24 - movs r6, 0 -_080187D8: - mov r1, r9 - ands r1, r4 - adds r0, r7, 0 - ands r0, r4 - cmp r1, r0 - beq _080187FC - lsrs r2, r6, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - mov r1, r8 - lsrs r0, r1, 24 - movs r1, 0x1 - lsrs r3, r5, 24 - bl FillBgTilemapBufferRect - b _08018812 -_080187FC: - lsrs r2, r6, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - mov r1, r8 - lsrs r0, r1, 24 - movs r1, 0x2 - lsrs r3, r5, 24 - bl FillBgTilemapBufferRect -_08018812: - movs r0, 0x80 - lsls r0, 17 - adds r6, r0 - adds r7, 0x1 - cmp r7, 0x1F - ble _080187D8 - mov r9, r10 - mov r1, r9 - cmp r1, 0x11 - ble _080187C8 - 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 sub_8018798 - - thumb_func_start sub_8018838 -sub_8018838: @ 8018838 - push {lr} - sub sp, 0xC - cmp r0, 0 - beq _08018846 - cmp r0, 0x1 - beq _0801885E - b _08018876 -_08018846: - 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 - b _08018876 -_0801885E: - movs r0, 0x20 - str r0, [sp] - movs r0, 0x1E - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x2 - bl FillBgTilemapBufferRect -_08018876: - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_8018838 - - thumb_func_start sub_8018884 -sub_8018884: @ 8018884 - push {r4,lr} - sub sp, 0x14 - adds r1, r0, 0 - ldr r4, =gStringVar4 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - ldr r0, =gUnknown_082F0728 - str r0, [sp, 0x8] - str r1, [sp, 0xC] - str r4, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - movs r3, 0x1 - bl AddTextPrinterParametrized2 - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8018884 - - thumb_func_start sub_80188DC -sub_80188DC: @ 80188DC - push {lr} - movs r0, 0x1 - bl rbox_fill_rectangle - movs r0, 0x1 - bl ClearWindowTilemap - movs r0, 0x1 - movs r1, 0x1 - bl CopyWindowToVram - pop {r0} - bx r0 - thumb_func_end sub_80188DC - - thumb_func_start mevent_0814257C -mevent_0814257C: @ 80188F8 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - adds r0, r1, 0 - ldrb r2, [r4] - cmp r2, 0x1 - beq _08018920 - cmp r2, 0x1 - bgt _08018910 - cmp r2, 0 - beq _0801891A - b _08018980 -_08018910: - cmp r2, 0x2 - beq _08018954 - cmp r2, 0xFF - beq _0801897C - b _08018980 -_0801891A: - bl sub_8018884 - b _08018944 -_08018920: - movs r0, 0 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018980 -_08018944: - ldrb r0, [r4] - adds r0, 0x1 - b _0801897E - .pool -_08018954: - movs r0, 0x1 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 - b _08018982 - .pool -_0801897C: - movs r0, 0x2 -_0801897E: - strb r0, [r4] -_08018980: - movs r0, 0 -_08018982: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end mevent_0814257C - - thumb_func_start sub_801898C -sub_801898C: @ 801898C - push {lr} - sub sp, 0xC - movs r0, 0 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_801898C - - thumb_func_start sub_80189B4 -sub_80189B4: @ 80189B4 - push {lr} - sub sp, 0xC - movs r0, 0x1 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_80189B4 - - thumb_func_start sub_80189DC -sub_80189DC: @ 80189DC - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _080189EC - cmp r0, 0x1 - beq _08018A08 - b _08018A14 -_080189EC: - bl sub_801898C - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018A14 - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _08018A14 - .pool -_08018A08: - bl sub_80189B4 - movs r0, 0 - strb r0, [r4] - movs r0, 0x1 - b _08018A16 -_08018A14: - movs r0, 0 -_08018A16: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80189DC - - thumb_func_start sub_8018A1C -sub_8018A1C: @ 8018A1C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - bne _08018A2C - adds r0, r1, 0 - bl sub_8018884 -_08018A2C: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x78 - bhi _08018A3E - movs r0, 0 - b _08018A48 -_08018A3E: - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 -_08018A48: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8018A1C - - thumb_func_start sub_8018A50 -sub_8018A50: @ 8018A50 - push {r4,r5,lr} - sub sp, 0x24 - lsls r2, 24 - add r1, sp, 0x4 - ldr r0, =gUnknown_082F0638 - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldr r0, =gUnknown_082F05E0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x1C] - str r1, [sp, 0x20] - cmp r2, 0 - bne _08018A80 - ldr r0, =gUnknown_082F0608 - b _08018A82 - .pool -_08018A80: - ldr r0, =gUnknown_082F0620 -_08018A82: - str r0, [sp, 0x4] - add r0, sp, 0x4 - bl sub_81DB41C - adds r3, r0, 0 - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _08018A96 - adds r3, 0x1 -_08018A96: - lsls r1, r3, 24 - ldr r0, =0x00ffffff - ldr r2, [sp, 0x1C] - ands r2, r0 - orrs r2, r1 - str r2, [sp, 0x1C] - cmp r3, 0x1D - bgt _08018ACC - movs r0, 0x1E - subs r0, r3 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - lsls r0, 24 - lsrs r0, 16 - ldr r1, =0xffff00ff - ands r1, r2 - orrs r1, r0 - str r1, [sp, 0x1C] - b _08018AD2 - .pool -_08018ACC: - ldr r0, =0xffff00ff - ands r2, r0 - str r2, [sp, 0x1C] -_08018AD2: - add r0, sp, 0x1C - movs r1, 0xE0 - str r1, [sp] - add r1, sp, 0x4 - movs r2, 0x1 - movs r3, 0xA - bl DoMysteryGiftListMenu - adds r4, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _08018AFA - movs r0, 0x2 - bl ClearWindowTilemap - movs r0, 0x2 - movs r1, 0x1 - bl CopyWindowToVram -_08018AFA: - adds r0, r4, 0 - add sp, 0x24 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8018A50 - - thumb_func_start sub_8018B08 -sub_8018B08: @ 8018B08 - push {r4-r6,lr} - sub sp, 0x1C - adds r5, r0, 0 - adds r4, r1, 0 - adds r1, r3, 0 - lsls r2, 24 - lsrs r6, r2, 24 - ldrb r0, [r5] - cmp r0, 0x1 - beq _08018B98 - cmp r0, 0x1 - bgt _08018B26 - cmp r0, 0 - beq _08018B30 - b _08018C3E -_08018B26: - cmp r0, 0x2 - beq _08018BE4 - cmp r0, 0xFF - beq _08018C1A - b _08018C3E -_08018B30: - ldr r0, =gStringVar4 - bl StringExpandPlaceholders - cmp r6, 0 - bne _08018B48 - ldr r0, =gUnknown_082F05C8 - b _08018B4A - .pool -_08018B48: - ldr r0, =gUnknown_082F05D0 -_08018B4A: - bl AddWindow - strh r0, [r4] - ldrb r0, [r4] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldrb r0, [r4] - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - ldr r1, =gUnknown_082F0728 - str r1, [sp, 0x8] - str r2, [sp, 0xC] - ldr r1, =gStringVar4 - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParametrized2 - ldrb r0, [r4] - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - ldrb r0, [r4] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r4] - bl PutWindowTilemap - b _08018BD6 - .pool -_08018B98: - ldr r0, =gUnknown_082F05E8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x14] - str r1, [sp, 0x18] - cmp r6, 0 - bne _08018BBC - ldr r0, =0xff00ffff - ldr r1, [sp, 0x14] - ands r1, r0 - movs r0, 0x90 - lsls r0, 12 - b _08018BC6 - .pool -_08018BBC: - ldr r0, =0xff00ffff - ldr r1, [sp, 0x14] - ands r1, r0 - movs r0, 0xF0 - lsls r0, 12 -_08018BC6: - orrs r1, r0 - str r1, [sp, 0x14] - add r0, sp, 0x14 - movs r1, 0xA - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu -_08018BD6: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08018C3E - .pool -_08018BE4: - bl sub_8198C58 - lsls r0, 24 - asrs r6, r0, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r0, 24 - cmp r0, 0x2 - bhi _08018C3E - movs r0, 0 - strb r0, [r5] - ldrb r0, [r4] - bl rbox_fill_rectangle - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r4] - bl RemoveWindow - adds r0, r6, 0 - b _08018C42 -_08018C1A: - movs r0, 0 - strb r0, [r5] - ldrb r0, [r4] - bl rbox_fill_rectangle - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0x1 - negs r0, r0 - b _08018C42 -_08018C3E: - movs r0, 0x2 - negs r0, r0 -_08018C42: - add sp, 0x1C - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8018B08 - - thumb_func_start sub_8018C4C -sub_8018C4C: @ 8018C4C - push {r4-r6,lr} - sub sp, 0x14 - adds r6, r0, 0 - adds r5, r1, 0 - ldrb r0, [r6] - cmp r0, 0x1 - beq _08018CE8 - cmp r0, 0x1 - bgt _08018C64 - cmp r0, 0 - beq _08018C6C - b _08018D8C -_08018C64: - cmp r0, 0xFF - bne _08018C6A - b _08018D68 -_08018C6A: - b _08018D8C -_08018C6C: - cmp r2, 0 - bne _08018C84 - ldr r0, =gStringVar4 - ldr r1, =gText_WhatToDoWithCards - bl StringExpandPlaceholders - b _08018C8C - .pool -_08018C84: - ldr r0, =gStringVar4 - ldr r1, =gText_WhatToDoWithNews - bl StringExpandPlaceholders -_08018C8C: - ldr r0, =gUnknown_082F05D8 - bl AddWindow - strh r0, [r5] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldrb r0, [r5] - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - ldr r1, =gUnknown_082F0728 - str r1, [sp, 0x8] - str r2, [sp, 0xC] - ldr r1, =gStringVar4 - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParametrized2 - ldrb r0, [r5] - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - ldrb r0, [r5] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r5] - bl PutWindowTilemap - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _08018D8C - .pool -_08018CE8: - cmp r3, 0 - beq _08018D10 - cmp r2, 0 - bne _08018D00 - ldr r0, =gUnknown_082F05F8 - ldr r1, =gUnknown_082F06C8 - b _08018D28 - .pool -_08018D00: - ldr r0, =gUnknown_082F0600 - ldr r1, =gUnknown_082F06F8 - b _08018D28 - .pool -_08018D10: - cmp r2, 0 - bne _08018D24 - ldr r0, =gUnknown_082F05F0 - ldr r1, =gUnknown_082F06B0 - b _08018D28 - .pool -_08018D24: - ldr r0, =gUnknown_082F05F8 - ldr r1, =gUnknown_082F06E0 -_08018D28: - movs r2, 0xE0 - str r2, [sp] - movs r2, 0x1 - movs r3, 0xA - bl DoMysteryGiftListMenu - adds r4, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _08018D8C - movs r0, 0 - strb r0, [r6] - ldrb r0, [r5] - bl rbox_fill_rectangle - ldrb r0, [r5] - bl ClearWindowTilemap - ldrb r0, [r5] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r5] - bl RemoveWindow - adds r0, r4, 0 - b _08018D90 - .pool -_08018D68: - movs r0, 0 - strb r0, [r6] - ldrb r0, [r5] - bl rbox_fill_rectangle - ldrb r0, [r5] - bl ClearWindowTilemap - ldrb r0, [r5] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r5] - bl RemoveWindow - movs r0, 0x2 - negs r0, r0 - b _08018D90 -_08018D8C: - movs r0, 0x1 - negs r0, r0 -_08018D90: - add sp, 0x14 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8018C4C - - thumb_func_start sub_8018D98 -sub_8018D98: @ 8018D98 - push {lr} - cmp r0, 0 - beq _08018DA4 - bl sub_801B0CC - b _08018DA8 -_08018DA4: - bl sub_801B27C -_08018DA8: - pop {r1} - bx r1 - thumb_func_end sub_8018D98 - - thumb_func_start sub_8018DAC -sub_8018DAC: @ 8018DAC - push {r4,r5,lr} - adds r5, r0, 0 - ldrb r0, [r5] - cmp r0, 0 - beq _08018DBC - cmp r0, 0x1 - beq _08018DE4 - b _08018E00 -_08018DBC: - cmp r1, 0 - bne _08018DD4 - bl sav1_get_mevent_buffer_1 - adds r4, r0, 0 - bl sav1_get_mevent_buffer_2 - adds r1, r0, 0 - adds r0, r4, 0 - bl sub_801BAAC - b _08018DDC -_08018DD4: - bl sub_801B00C - bl sub_801C6C8 -_08018DDC: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08018E00 -_08018DE4: - cmp r1, 0 - bne _08018DF2 - bl sub_801BB74 -_08018DEC: - cmp r0, 0 - bne _08018DF8 - b _08018E00 -_08018DF2: - bl sub_801C758 - b _08018DEC -_08018DF8: - movs r0, 0 - strb r0, [r5] - movs r0, 0x1 - b _08018E02 -_08018E00: - movs r0, 0 -_08018E02: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8018DAC - - thumb_func_start sub_8018E08 -sub_8018E08: @ 8018E08 - push {lr} - cmp r0, 0 - bne _08018E14 - bl sub_801B1E8 - b _08018E18 -_08018E14: - bl sub_801B06C -_08018E18: - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_8018E08 - - thumb_func_start sub_8018E20 -sub_8018E20: @ 8018E20 - push {lr} - cmp r0, 0 - bne _08018E36 - adds r0, r1, 0 - bl sub_801BDA4 - cmp r0, 0 - beq _08018E40 - bl sub_801BB48 - b _08018E48 -_08018E36: - adds r0, r1, 0 - bl sub_801CA50 - cmp r0, 0 - bne _08018E44 -_08018E40: - movs r0, 0 - b _08018E4A -_08018E44: - bl sub_801C72C -_08018E48: - movs r0, 0x1 -_08018E4A: - pop {r1} - bx r1 - thumb_func_end sub_8018E20 - - thumb_func_start sub_8018E50 -sub_8018E50: @ 8018E50 - push {lr} - cmp r2, 0 - beq _08018E60 - ldr r3, =gText_OkayToDiscardNews - b _08018E62 - .pool -_08018E60: - ldr r3, =gText_IfThrowAwayCardEventWontHappen -_08018E62: - movs r2, 0x1 - bl sub_8018B08 - lsls r0, 24 - asrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8018E50 - - thumb_func_start mevent_message_was_thrown_away -mevent_message_was_thrown_away: @ 8018E74 - push {lr} - cmp r1, 0 - beq _08018E84 - ldr r1, =gText_WonderNewsThrownAway - b _08018E86 - .pool -_08018E84: - ldr r1, =gText_WonderCardThrownAway -_08018E86: - bl mevent_0814257C - pop {r1} - bx r1 - .pool - thumb_func_end mevent_message_was_thrown_away - - thumb_func_start mevent_save_game -mevent_save_game: @ 8018E94 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0x4 - bhi _08018F04 - lsls r0, 2 - ldr r1, =_08018EAC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08018EAC: - .4byte _08018EC0 - .4byte _08018ECC - .4byte _08018ED4 - .4byte _08018EE0 - .4byte _08018EF8 -_08018EC0: - ldr r0, =gText_DataWillBeSaved - bl sub_8018884 - b _08018EEC - .pool -_08018ECC: - movs r0, 0 - bl TrySavingData - b _08018EEC -_08018ED4: - ldr r0, =gText_SaveCompletedPressA - bl sub_8018884 - b _08018EEC - .pool -_08018EE0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018F04 -_08018EEC: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _08018F04 - .pool -_08018EF8: - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 - b _08018F06 -_08018F04: - movs r0, 0 -_08018F06: - pop {r4} - pop {r1} - bx r1 - thumb_func_end mevent_save_game - - thumb_func_start mevent_message -mevent_message: @ 8018F0C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r5, r2, 24 - movs r2, 0 - str r2, [r4] - cmp r3, 0xE - bls _08018F22 - b _08019034 -_08018F22: - lsls r0, r3, 2 - ldr r1, =_08018F30 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08018F30: - .4byte _08018F6C - .4byte _08018F78 - .4byte _08018F84 - .4byte _08018F9C - .4byte _08018FB4 - .4byte _08018FC0 - .4byte _08018FCC - .4byte _08018FD8 - .4byte _08018FE4 - .4byte _08018FF0 - .4byte _08018FFC - .4byte _08019014 - .4byte _08019020 - .4byte _0801902C - .4byte _08019030 -_08018F6C: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_NothingSentOver - b _08019034 - .pool -_08018F78: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_RecordUploadedViaWireless - b _08019034 - .pool -_08018F84: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_WonderCardReceivedFrom - cmp r5, 0 - bne _08019034 - ldr r2, =gText_WonderCardReceived - b _08019034 - .pool -_08018F9C: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_WonderNewsReceivedFrom - cmp r5, 0 - bne _08019034 - ldr r2, =gText_WonderNewsReceived - b _08019034 - .pool -_08018FB4: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_NewStampReceived - b _08019034 - .pool -_08018FC0: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadCard - b _08019034 - .pool -_08018FCC: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadStamp - b _08019034 - .pool -_08018FD8: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadNews - b _08019034 - .pool -_08018FE4: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_NoMoreRoomForStamps - b _08019034 - .pool -_08018FF0: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CommunicationCanceled - b _08019034 - .pool -_08018FFC: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CantAcceptNewsFromTrainer - cmp r6, 0 - bne _08019034 - ldr r2, =gText_CantAcceptCardFromTrainer - b _08019034 - .pool -_08019014: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CommunicationError - b _08019034 - .pool -_08019020: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_NewTrainerReceived - b _08019034 - .pool -_0801902C: - movs r0, 0x1 - b _08019032 -_08019030: - movs r0, 0 -_08019032: - str r0, [r4] -_08019034: - adds r0, r2, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_message - - thumb_func_start mevent_08142CE8 -mevent_08142CE8: @ 801903C - push {r4-r6,lr} - adds r6, r0, 0 - adds r0, r1, 0 - adds r5, r2, 0 - ldrb r4, [r6] - cmp r4, 0x1 - beq _0801906E - cmp r4, 0x1 - bgt _08019054 - cmp r4, 0 - beq _0801905A - b _0801909A -_08019054: - cmp r4, 0x2 - beq _08019084 - b _0801909A -_0801905A: - cmp r0, 0 - beq _08019062 - bl sub_8018884 -_08019062: - movs r0, 0xB9 - lsls r0, 1 - bl PlayFanfare - strh r4, [r5] - b _0801907C -_0801906E: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xF0 - bls _0801909A -_0801907C: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _0801909A -_08019084: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _0801909A - movs r0, 0 - strb r0, [r6] - bl sub_80188DC - movs r0, 0x1 - b _0801909C -_0801909A: - movs r0, 0 -_0801909C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_08142CE8 - - thumb_func_start mevent_message_stamp_card_etc_send_status -mevent_message_stamp_card_etc_send_status: @ 80190A4 - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gText_CommunicationError - movs r0, 0 - str r0, [r3] - adds r4, r1, 0 - cmp r2, 0xE - bhi _08019166 - lsls r0, r2, 2 - ldr r1, =_080190C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080190C8: - .4byte _08019104 - .4byte _0801910C - .4byte _08019114 - .4byte _0801911C - .4byte _08019128 - .4byte _08019130 - .4byte _08019138 - .4byte _08019140 - .4byte _08019148 - .4byte _08019150 - .4byte _08019164 - .4byte _08019158 - .4byte _0801915C - .4byte _0801915C - .4byte _08019164 -_08019104: - ldr r1, =gText_NothingSentOver - b _08019166 - .pool -_0801910C: - ldr r1, =gText_RecordUploadedViaWireless - b _08019166 - .pool -_08019114: - ldr r1, =gText_WonderCardSentTo - b _0801911E - .pool -_0801911C: - ldr r1, =gText_WonderNewsSentTo -_0801911E: - movs r0, 0x1 - str r0, [r3] - b _08019166 - .pool -_08019128: - ldr r1, =gText_StampSentTo - b _08019166 - .pool -_08019130: - ldr r1, =gText_OtherTrainerHasCard - b _08019166 - .pool -_08019138: - ldr r1, =gText_OtherTrainerHasStamp - b _08019166 - .pool -_08019140: - ldr r1, =gText_OtherTrainerHasNews - b _08019166 - .pool -_08019148: - ldr r1, =gText_NoMoreRoomForStamps - b _08019166 - .pool -_08019150: - ldr r1, =gText_OtherTrainerCanceled - b _08019166 - .pool -_08019158: - adds r1, r4, 0 - b _08019166 -_0801915C: - ldr r1, =gText_GiftSentTo - b _08019166 - .pool -_08019164: - ldr r1, =gText_CantSendGiftToTrainer -_08019166: - adds r0, r1, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end mevent_message_stamp_card_etc_send_status - - thumb_func_start sub_8019174 -sub_8019174: @ 8019174 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - adds r1, r2, 0 - adds r2, r3, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, sp - bl mevent_message_stamp_card_etc_send_status - adds r1, r0, 0 - ldr r0, [sp] - cmp r0, 0 - bne _0801919A - adds r0, r4, 0 - bl mevent_0814257C - b _080191A2 -_0801919A: - adds r0, r4, 0 - adds r2, r5, 0 - bl mevent_08142CE8 -_080191A2: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8019174 - - thumb_func_start task_add_00_mystery_gift -task_add_00_mystery_gift: @ 80191AC - push {r4,lr} - ldr r0, =task00_mystery_gift - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - movs r0, 0 - strb r0, [r4, 0x8] - strb r0, [r4, 0x9] - strb r0, [r4, 0xA] - strb r0, [r4, 0xB] - strb r0, [r4, 0xC] - strb r0, [r4, 0xD] - movs r1, 0 - strh r0, [r4] - strh r0, [r4, 0x2] - strh r0, [r4, 0x4] - strh r0, [r4, 0x6] - strb r1, [r4, 0xE] - movs r0, 0x40 - bl AllocZeroed - str r0, [r4, 0x10] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_add_00_mystery_gift - - thumb_func_start task00_mystery_gift -task00_mystery_gift: @ 80191F4 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldrb r0, [r5, 0x8] - cmp r0, 0x25 - bls _0801920E - b _08019922 -_0801920E: - lsls r0, 2 - ldr r1, =_08019220 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08019220: - .4byte _080192B8 - .4byte _080192BE - .4byte _08019300 - .4byte _08019338 - .4byte _0801935C - .4byte _080193AC - .4byte _0801940C - .4byte _08019444 - .4byte _08019454 - .4byte _080194CC - .4byte _080194F0 - .4byte _08019508 - .4byte _08019538 - .4byte _08019574 - .4byte _0801958C - .4byte _080195BC - .4byte _080198EC - .4byte _0801961A - .4byte _0801962A - .4byte _08019922 - .4byte _0801963C - .4byte _08019688 - .4byte _080196FE - .4byte _0801972E - .4byte _08019764 - .4byte _0801977E - .4byte _08019792 - .4byte _0801979E - .4byte _080197B2 - .4byte _080197C6 - .4byte _080197F8 - .4byte _0801982C - .4byte _08019870 - .4byte _08019884 - .4byte _080198A0 - .4byte _080198B8 - .4byte _080198EC - .4byte _0801990C -_080192B8: - movs r0, 0x1 - strb r0, [r5, 0x8] - b _08019922 -_080192BE: - adds r0, r5, 0 - adds r0, 0x9 - adds r1, r5, 0 - movs r2, 0 - bl sub_8018A50 - adds r1, r0, 0 - cmp r1, 0x1 - beq _080192E8 - cmp r1, 0x1 - bcc _080192DE - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _080192FA - b _08019922 -_080192DE: - movs r0, 0 - strb r0, [r5, 0xC] - bl sub_801B27C - b _080192EE -_080192E8: - strb r1, [r5, 0xC] - bl sub_801B0CC -_080192EE: - cmp r0, 0x1 - bne _080192F4 - b _08019820 -_080192F4: - movs r0, 0x2 - strb r0, [r5, 0x8] - b _08019922 -_080192FA: - movs r0, 0x25 - strb r0, [r5, 0x8] - b _08019922 -_08019300: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019314 - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_DontHaveCardNewOneInput - b _0801931A - .pool -_08019314: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_DontHaveNewsNewOneInput -_0801931A: - bl mevent_0814257C - cmp r0, 0 - bne _08019324 - b _08019922 -_08019324: - movs r0, 0x3 - strb r0, [r5, 0x8] - movs r0, 0 - movs r1, 0x1 - bl sub_80186EC - b _08019922 - .pool -_08019338: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _0801934C - ldr r0, =gText_WhereShouldCardBeAccessed - bl sub_8018884 - b _08019352 - .pool -_0801934C: - ldr r0, =gText_WhereShouldNewsBeAccessed - bl sub_8018884 -_08019352: - movs r0, 0x4 - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801935C: - adds r0, r5, 0 - adds r0, 0x9 - adds r1, r5, 0 - movs r2, 0x1 - bl sub_8018A50 - adds r4, r0, 0 - cmp r4, 0x1 - beq _0801938A - cmp r4, 0x1 - bcc _0801937C - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _08019396 - b _08019922 -_0801937C: - bl sub_80188DC - movs r1, 0 - movs r0, 0x5 - strb r0, [r5, 0x8] - strb r1, [r5, 0xD] - b _08019922 -_0801938A: - bl sub_80188DC - movs r0, 0x5 - strb r0, [r5, 0x8] - strb r4, [r5, 0xD] - b _08019922 -_08019396: - bl sub_80188DC - ldrb r0, [r5, 0xC] - bl sub_8018D98 - cmp r0, 0 - beq _080193A6 - b _08019820 -_080193A6: - strb r0, [r5, 0x8] - movs r0, 0 - b _080198FE -_080193AC: - ldr r0, =gStringVar1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, =gStringVar2 - strb r1, [r0] - ldr r0, =gStringVar3 - strb r1, [r0] - ldrb r0, [r5, 0xC] - cmp r0, 0 - beq _080193D4 - cmp r0, 0x1 - beq _080193EE - b _08019406 - .pool -_080193D4: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080193E2 - movs r0, 0x15 - bl sub_8014EFC - b _08019406 -_080193E2: - cmp r0, 0 - bne _08019406 - movs r0, 0x15 - bl sub_80152A8 - b _08019406 -_080193EE: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080193FC - movs r0, 0x16 - bl sub_8014EFC - b _08019406 -_080193FC: - cmp r0, 0 - bne _08019406 - movs r0, 0x16 - bl sub_80152A8 -_08019406: - movs r0, 0x6 - strb r0, [r5, 0x8] - b _08019922 -_0801940C: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0801942C - movs r0, 0x1 - bl sub_8018838 - movs r0, 0x7 - strb r0, [r5, 0x8] - ldrb r0, [r5, 0xC] - bl sub_801D484 - b _08019922 - .pool -_0801942C: - ldr r0, =gScriptResult - ldrh r0, [r0] - cmp r0, 0x5 - beq _08019436 - b _08019922 -_08019436: - movs r0, 0x1 - bl sub_8018838 - b _080197C0 - .pool -_08019444: - ldr r0, =gText_Communicating - bl sub_8018884 - movs r0, 0x8 - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019454: - adds r0, r5, 0 - bl sub_801D4A8 - subs r0, 0x2 - cmp r0, 0x4 - bls _08019462 - b _08019922 -_08019462: - lsls r0, 2 - ldr r1, =_08019470 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08019470: - .4byte _080194AE - .4byte _080194A8 - .4byte _080194B4 - .4byte _08019492 - .4byte _08019484 -_08019484: - bl task_add_05_task_del_08FA224_when_no_RfuFunc - ldrh r0, [r5] - strb r0, [r5, 0xE] - movs r0, 0xD - strb r0, [r5, 0x8] - b _08019922 -_08019492: - ldr r4, [r5, 0x10] - bl sub_801D4F4 - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0x40 - bl memcpy - bl sub_801D4E4 - b _08019922 -_080194A8: - movs r0, 0xA - strb r0, [r5, 0x8] - b _08019922 -_080194AE: - movs r0, 0x9 - strb r0, [r5, 0x8] - b _08019922 -_080194B4: - movs r0, 0xB - strb r0, [r5, 0x8] - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 8 - bl StringCopy - b _08019922 - .pool -_080194CC: - adds r4, r5, 0 - adds r4, 0x9 - bl sub_801D4F4 - adds r3, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcs _08019552 - movs r0, 0 - b _08019566 -_080194F0: - adds r4, r5, 0 - adds r4, 0x9 - bl sub_801D4F4 - adds r1, r0, 0 - adds r0, r4, 0 - bl mevent_0814257C - cmp r0, 0 - bne _08019506 - b _08019922 -_08019506: - b _0801956A -_08019508: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_ThrowAwayWonderCard - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcs _08019552 - bl sub_801B3F8 - cmp r0, 0x1 - bne _08019534 - movs r0, 0xC - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019534: - movs r0, 0 - b _08019566 -_08019538: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_HaventReceivedCardsGift - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcc _08019560 -_08019552: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08019564 - b _08019922 - .pool -_08019560: - movs r0, 0 - b _08019566 -_08019564: - movs r0, 0x1 -_08019566: - bl sub_801D500 -_0801956A: - bl sub_801D4E4 - movs r0, 0x7 - strb r0, [r5, 0x8] - b _08019922 -_08019574: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0801957E - b _08019922 -_0801957E: - bl sub_800E084 - movs r0, 0xE - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801958C: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_CommunicationCompleted - bl sub_8018A1C - cmp r0, 0 - bne _0801959C - b _08019922 -_0801959C: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080195AA - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 8 - bl StringCopy -_080195AA: - movs r0, 0xF - strb r0, [r5, 0x8] - b _08019922 - .pool -_080195BC: - ldrb r1, [r5, 0xC] - ldrb r2, [r5, 0xD] - ldrb r3, [r5, 0xE] - mov r0, sp - bl mevent_message - adds r1, r0, 0 - cmp r1, 0 - bne _080195D0 - ldr r1, [r5, 0x10] -_080195D0: - ldr r0, [sp] - cmp r0, 0 - beq _080195E2 - adds r0, r5, 0 - adds r0, 0x9 - adds r2, r5, 0 - bl mevent_08142CE8 - b _080195EA -_080195E2: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_0814257C -_080195EA: - adds r1, r0, 0 - cmp r1, 0 - bne _080195F2 - b _08019922 -_080195F2: - ldrb r0, [r5, 0xE] - cmp r0, 0x3 - bne _0801960C - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _08019606 - movs r0, 0x1 - bl sub_801DB68 - b _0801960C -_08019606: - movs r0, 0x2 - bl sub_801DB68 -_0801960C: - ldr r0, [sp] - cmp r0, 0 - beq _08019614 - b _080198DC -_08019614: - strb r0, [r5, 0x8] - movs r0, 0 - b _080198FE -_0801961A: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_save_game - cmp r0, 0 - bne _08019628 - b _08019922 -_08019628: - b _08019820 -_0801962A: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r1, [r5, 0xC] - bl sub_8018DAC - cmp r0, 0 - bne _0801963A - b _08019922 -_0801963A: - b _080196F8 -_0801963C: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019664 - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08019652 - movs r0, 0x15 - strb r0, [r5, 0x8] -_08019652: - ldrh r1, [r2, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0801965E - b _08019922 -_0801965E: - b _08019682 - .pool -_08019664: - ldr r0, =gMain - ldrh r0, [r0, 0x2E] - bl sub_801CCD0 - cmp r0, 0 - beq _0801967C - cmp r0, 0x1 - beq _08019682 - b _08019922 - .pool -_0801967C: - bl sub_801CC38 - b _0801975E -_08019682: - movs r0, 0x1B - strb r0, [r5, 0x8] - b _08019922 -_08019688: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _080196A2 - bl sub_801B308 - cmp r0, 0 - beq _080196B6 - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0 - b _080196C0 -_080196A2: - bl sub_801B128 - cmp r0, 0 - beq _080196B6 - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0 - b _080196C0 -_080196B6: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0x1 -_080196C0: - bl sub_8018C4C - adds r1, r0, 0 - cmp r1, 0x1 - beq _080196E2 - cmp r1, 0x1 - bcc _080196DC - cmp r1, 0x2 - beq _080196E8 - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _080196EE - b _08019922 -_080196DC: - movs r0, 0x1C - strb r0, [r5, 0x8] - b _08019922 -_080196E2: - movs r0, 0x1D - strb r0, [r5, 0x8] - b _08019922 -_080196E8: - movs r0, 0x16 - strb r0, [r5, 0x8] - b _08019922 -_080196EE: - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - bne _080196F8 - bl sub_801CC80 -_080196F8: - movs r0, 0x14 - strb r0, [r5, 0x8] - b _08019922 -_080196FE: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - bl sub_8018E50 - adds r1, r0, 0 - cmp r1, 0 - beq _0801971A - cmp r1, 0 - ble _08019748 - cmp r1, 0x1 - beq _0801975E - b _08019922 -_0801971A: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019758 - bl sub_801B3F8 - cmp r0, 0x1 - bne _08019758 - movs r0, 0x17 - strb r0, [r5, 0x8] - b _08019922 -_0801972E: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_HaventReceivedGiftOkayToDiscard - adds r1, r5, 0 - movs r2, 0x1 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _0801975E - cmp r1, 0x1 - bcc _08019758 -_08019748: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801975E - b _08019922 - .pool -_08019758: - movs r0, 0x18 - strb r0, [r5, 0x8] - b _08019922 -_0801975E: - movs r0, 0x15 - strb r0, [r5, 0x8] - b _08019922 -_08019764: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _08019772 - b _08019922 -_08019772: - ldrb r0, [r5, 0xC] - bl sub_8018E08 - movs r0, 0x19 - strb r0, [r5, 0x8] - b _08019922 -_0801977E: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_save_game - cmp r0, 0 - bne _0801978C - b _08019922 -_0801978C: - movs r0, 0x1A - strb r0, [r5, 0x8] - b _08019922 -_08019792: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r1, [r5, 0xC] - bl mevent_message_was_thrown_away - b _080198F6 -_0801979E: - ldrb r0, [r5, 0xC] - movs r1, 0 - bl sub_8018E20 - cmp r0, 0 - bne _080197AC - b _08019922 -_080197AC: - movs r0, 0 - strb r0, [r5, 0x8] - b _08019922 -_080197B2: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _080197C0 - b _08019922 -_080197C0: - movs r0, 0x3 - strb r0, [r5, 0x8] - b _08019922 -_080197C6: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _080197D4 - b _08019922 -_080197D4: - ldrb r0, [r5, 0xC] - cmp r0, 0 - beq _080197E0 - cmp r0, 0x1 - beq _080197E8 - b _080197EE -_080197E0: - movs r0, 0x15 - bl sub_8014A00 - b _080197EE -_080197E8: - movs r0, 0x16 - bl sub_8014A00 -_080197EE: - movs r0, 0x1 - strb r0, [r5, 0xD] - movs r0, 0x1E - strb r0, [r5, 0x8] - b _08019922 -_080197F8: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08019810 - movs r0, 0x1 - bl sub_8018838 - movs r0, 0x1F - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019810: - ldr r0, =gScriptResult - ldrh r0, [r0] - cmp r0, 0x5 - beq _0801981A - b _08019922 -_0801981A: - movs r0, 0x1 - bl sub_8018838 -_08019820: - movs r0, 0x12 - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801982C: - ldr r0, =gStringVar1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, =gStringVar2 - strb r1, [r0] - ldr r0, =gStringVar3 - strb r1, [r0] - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _0801985C - ldr r0, =gText_SendingWonderCard - bl sub_8018884 - bl mevent_srv_new_wcard - b _08019866 - .pool -_0801985C: - ldr r0, =gText_SendingWonderNews - bl sub_8018884 - bl mevent_srv_init_wnews -_08019866: - movs r0, 0x20 - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019870: - adds r0, r5, 0 - bl sub_801D0C4 - cmp r0, 0x3 - bne _08019922 - ldrh r0, [r5] - strb r0, [r5, 0xE] - movs r0, 0x21 - strb r0, [r5, 0x8] - b _08019922 -_08019884: - bl task_add_05_task_del_08FA224_when_no_RfuFunc - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name - bl StringCopy - movs r0, 0x22 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198A0: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08019922 - bl sub_800E084 - movs r0, 0x23 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198B8: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xD] - ldrb r3, [r5, 0xE] - adds r1, r5, 0 - bl sub_8019174 - cmp r0, 0 - beq _08019922 - ldr r0, [r5, 0xC] - ldr r1, =0x00ffff00 - ands r0, r1 - ldr r1, =0x00030100 - cmp r0, r1 - bne _080198FA - movs r0, 0x3 - bl sub_801DB68 -_080198DC: - movs r0, 0x11 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198EC: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_CommunicationError - bl mevent_0814257C -_080198F6: - cmp r0, 0 - beq _08019922 -_080198FA: - movs r0, 0 - strb r0, [r5, 0x8] -_080198FE: - movs r1, 0 - bl sub_80186EC - b _08019922 - .pool -_0801990C: - bl sub_80097E8 - ldr r0, [r5, 0x10] - bl Free - adds r0, r4, 0 - bl DestroyTask - ldr r0, =sub_80186A4 - bl SetMainCallback2 -_08019922: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task00_mystery_gift - - thumb_func_start sub_8019930 -sub_8019930: @ 8019930 - ldr r0, =0x000001a9 - bx lr - .pool - thumb_func_end sub_8019930 - - thumb_func_start bgid_upload_textbox_1 -bgid_upload_textbox_1: @ 8019938 - push {lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnkTextboxBorderGfx - movs r2, 0x80 - lsls r2, 1 - movs r3, 0 - str r3, [sp] - bl copy_decompressed_tile_data_to_vram_autofree - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end bgid_upload_textbox_1 - - thumb_func_start is_walking_or_running -is_walking_or_running: @ 8019958 - push {lr} - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x3] - cmp r0, 0x2 - beq _08019966 - cmp r0, 0 - bne _08019970 -_08019966: - movs r0, 0x1 - b _08019972 - .pool -_08019970: - movs r0, 0 -_08019972: - pop {r1} - bx r1 - thumb_func_end is_walking_or_running - - thumb_func_start sub_8019978 -sub_8019978: @ 8019978 - ldr r3, =gUnknown_082F072C - movs r2, 0x7 - ands r2, r1 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 1 - adds r2, r1 - adds r2, r3 - ldrb r0, [r2] - bx lr - .pool - thumb_func_end sub_8019978 - - thumb_func_start sub_8019990 -sub_8019990: @ 8019990 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r4, =gUnknown_082F0740 - mov r8, r4 - lsls r0, 2 - adds r4, r0, r4 - movs r6, 0 - ldrsh r5, [r4, r6] - ldr r6, =gUnknown_082F0760 - lsls r1, 1 - adds r4, r1, r6 - ldrb r4, [r4] - lsls r4, 24 - asrs r4, 24 - adds r5, r4 - adds r5, 0x7 - str r5, [r2] - movs r2, 0x2 - add r8, r2 - add r0, r8 - movs r4, 0 - ldrsh r0, [r0, r4] - adds r6, 0x1 - adds r1, r6 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - adds r0, r1 - adds r0, 0x7 - str r0, [r3] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019990 - - thumb_func_start sub_80199E0 -sub_80199E0: @ 80199E0 - push {r4-r7,lr} - mov r12, r3 - ldr r7, =gUnknown_082F0740 - lsls r5, r0, 2 - adds r0, r5, r7 - movs r4, 0 - ldrsh r3, [r0, r4] - ldr r6, =gUnknown_082F0760 - lsls r4, r1, 1 - adds r0, r4, r6 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r3, r0 - adds r3, 0x7 - cmp r3, r2 - bne _08019A28 - adds r0, r7, 0x2 - adds r0, r5, r0 - movs r2, 0 - ldrsh r1, [r0, r2] - adds r0, r6, 0x1 - adds r0, r4, r0 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r1, r0 - adds r1, 0x7 - cmp r1, r12 - bne _08019A28 - movs r0, 0x1 - b _08019A2A - .pool -_08019A28: - movs r0, 0 -_08019A2A: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80199E0 - - thumb_func_start sub_8019A30 -sub_8019A30: @ 8019A30 - push {lr} - ldr r1, =0x000002bf - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8019A30 - - thumb_func_start flag_set_x63 -flag_set_x63: @ 8019A4C - push {lr} - ldr r1, =0x000002bf - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagSet - pop {r0} - bx r0 - .pool - thumb_func_end flag_set_x63 - - thumb_func_start flag_clear_x63 -flag_clear_x63: @ 8019A64 - push {lr} - ldr r1, =0x000002bf - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagClear - pop {r0} - bx r0 - .pool - thumb_func_end flag_clear_x63 - - thumb_func_start sub_8019A7C -sub_8019A7C: @ 8019A7C - push {lr} - ldr r2, =0x00004010 - adds r0, r2 - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - bl VarSet - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019A7C - - thumb_func_start sub_8019A98 -sub_8019A98: @ 8019A98 - push {lr} - ldr r1, =gUnknown_082F0774 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - bl show_sprite - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019A98 - - thumb_func_start sub_8019AB8 -sub_8019AB8: @ 8019AB8 - push {lr} - ldr r1, =gUnknown_082F0774 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - bl RemoveFieldObjectByLocalIdAndMap - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019AB8 - - thumb_func_start sub_8019AD8 -sub_8019AD8: @ 8019AD8 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r1, 0 - ldr r1, =gUnknown_082F0774 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - mov r3, sp - bl TryGetFieldObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _08019B30 - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gMapObjects - adds r4, r0, r1 - adds r0, r4, 0 - bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive - lsls r0, 24 - cmp r0, 0 - bne _08019B30 - ldrb r1, [r5] - adds r0, r4, 0 - bl FieldObjectSetSpecialAnim - lsls r0, 24 - cmp r0, 0 - bne _08019B30 - movs r0, 0x1 - b _08019B32 - .pool -_08019B30: - movs r0, 0 -_08019B32: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8019AD8 - - thumb_func_start sub_8019B3C -sub_8019B3C: @ 8019B3C - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_082F0774 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - mov r3, sp - bl TryGetFieldObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _08019B9C - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gMapObjects - adds r4, r0, r1 - adds r0, r4, 0 - bl FieldObjectClearAnimIfSpecialAnimFinished - lsls r0, 24 - cmp r0, 0 - bne _08019B84 - movs r0, 0 - b _08019B9E - .pool -_08019B84: - bl ScriptContext2_IsEnabled - lsls r0, 24 - cmp r0, 0 - bne _08019B96 - adds r0, r4, 0 - bl npc_sync_anim_pause_bits - b _08019B9C -_08019B96: - adds r0, r4, 0 - bl sub_8097404 -_08019B9C: - movs r0, 0x1 -_08019B9E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8019B3C - - thumb_func_start sub_8019BA8 -sub_8019BA8: @ 8019BA8 - push {lr} - ldr r2, =gUnknown_02022C68 - movs r1, 0 - str r1, [r2] - ldr r1, =gUnknown_02022C64 - str r0, [r1] - movs r1, 0 - movs r2, 0x7 -_08019BB8: - strb r1, [r0] - strb r1, [r0, 0x1] - strb r1, [r0, 0x2] - strb r1, [r0, 0x3] - adds r0, 0x4 - subs r2, 0x1 - cmp r2, 0 - bge _08019BB8 - bl sub_8019DF4 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8019BA8 - - thumb_func_start sub_8019BDC -sub_8019BDC: @ 8019BDC - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0 - beq _08019BF0 - cmp r0, 0x1 - beq _08019C10 - b _08019C2E -_08019BF0: - ldr r1, =gUnknown_082F078C - adds r0, r4, 0 - bl sub_8019AD8 - cmp r0, 0x1 - bne _08019C2E - adds r0, r4, 0 - bl flag_set_x63 - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08019C2E - .pool -_08019C10: - adds r0, r4, 0 - bl sub_8019B3C - cmp r0, 0 - beq _08019C2E - adds r0, r4, 0 - bl sub_8019AB8 - adds r0, r4, 0 - bl flag_set_x63 - movs r0, 0 - strb r0, [r5] - movs r0, 0x1 - b _08019C30 -_08019C2E: - movs r0, 0 -_08019C30: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8019BDC - - thumb_func_start sub_8019C38 -sub_8019C38: @ 8019C38 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - adds r5, r1, 0 - adds r7, r2, 0 - movs r0, 0 - ldrsb r0, [r6, r0] - cmp r0, 0x2 - beq _08019CD4 - cmp r0, 0x2 - bgt _08019C54 - cmp r0, 0 - beq _08019C5A - b _08019CE6 -_08019C54: - cmp r0, 0x3 - beq _08019CBC - b _08019CE6 -_08019C5A: - bl is_walking_or_running - cmp r0, 0 - beq _08019CE6 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - mov r0, sp - movs r1, 0 - ldrsh r2, [r0, r1] - movs r0, 0 - ldrsh r3, [r4, r0] - adds r0, r5, 0 - movs r1, 0 - bl sub_80199E0 - cmp r0, 0x1 - beq _08019CE6 - mov r0, sp - adds r1, r4, 0 - bl plaer_get_pos_including_state_based_drift - mov r0, sp - movs r1, 0 - ldrsh r2, [r0, r1] - movs r0, 0 - ldrsh r3, [r4, r0] - adds r0, r5, 0 - movs r1, 0 - bl sub_80199E0 - cmp r0, 0x1 - beq _08019CE6 - ldrb r1, [r7, 0x1] - adds r0, r5, 0 - bl sub_8019A7C - adds r0, r5, 0 - bl sub_8019A98 - adds r0, r5, 0 - bl flag_clear_x63 - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_08019CBC: - ldr r1, =gUnknown_082F078E - adds r0, r5, 0 - bl sub_8019AD8 - cmp r0, 0x1 - bne _08019CE6 - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _08019CE6 - .pool -_08019CD4: - adds r0, r5, 0 - bl sub_8019B3C - cmp r0, 0 - beq _08019CE6 - movs r0, 0 - strb r0, [r6] - movs r0, 0x1 - b _08019CE8 -_08019CE6: - movs r0, 0 -_08019CE8: - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8019C38 - - thumb_func_start sub_8019CF0 -sub_8019CF0: @ 8019CF0 - push {r4,lr} - ldr r3, =gUnknown_02022C64 - lsls r0, 2 - ldr r4, [r3] - adds r4, r0 - movs r0, 0x1 - strb r0, [r4, 0x3] - adds r0, r1, 0 - adds r1, r2, 0 - bl sub_8019978 - strb r0, [r4, 0x1] - ldrb r0, [r4] - cmp r0, 0 - beq _08019D18 - movs r0, 0 - b _08019D1A - .pool -_08019D18: - movs r0, 0x1 -_08019D1A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8019CF0 - - thumb_func_start AGBAssert -AGBAssert: @ 8019D20 - push {lr} - ldr r1, =gUnknown_02022C64 - lsls r0, 2 - ldr r1, [r1] - adds r1, r0 - movs r0, 0x2 - strb r0, [r1, 0x3] - ldrb r0, [r1] - cmp r0, 0x1 - beq _08019D3C - movs r0, 0 - b _08019D3E - .pool -_08019D3C: - movs r0, 0x1 -_08019D3E: - pop {r1} - bx r1 - thumb_func_end AGBAssert - - thumb_func_start sub_8019D44 -sub_8019D44: @ 8019D44 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - ldrb r1, [r4] - cmp r1, 0x1 - beq _08019DA6 - cmp r1, 0x1 - bgt _08019D5A - cmp r1, 0 - beq _08019D64 - b _08019DC6 -_08019D5A: - cmp r1, 0x2 - beq _08019D70 - cmp r1, 0x3 - beq _08019DB4 - b _08019DC6 -_08019D64: - ldrb r0, [r4, 0x3] - cmp r0, 0x1 - bne _08019DC6 - movs r0, 0x2 - strb r0, [r4] - strb r1, [r4, 0x2] -_08019D70: - adds r0, r5, 0 - movs r1, 0 - bl sub_8019F8C - adds r1, r0, 0 - cmp r1, 0 - bne _08019D96 - ldrb r0, [r4, 0x3] - cmp r0, 0x2 - bne _08019D96 - strb r1, [r4] - strb r1, [r4, 0x2] - adds r0, r5, 0 - bl sub_8019AB8 - adds r0, r5, 0 - bl flag_set_x63 - b _08019DC6 -_08019D96: - adds r0, r4, 0x2 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_8019C38 - cmp r0, 0x1 - bne _08019DC6 - b _08019DC4 -_08019DA6: - ldrb r0, [r4, 0x3] - cmp r0, 0x2 - bne _08019DC6 - movs r1, 0 - movs r0, 0x3 - strb r0, [r4] - strb r1, [r4, 0x2] -_08019DB4: - adds r0, r4, 0x2 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_8019BDC - cmp r0, 0x1 - bne _08019DC6 - movs r0, 0 -_08019DC4: - strb r0, [r4] -_08019DC6: - movs r0, 0 - strb r0, [r4, 0x3] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8019D44 - - thumb_func_start sub_8019DD0 -sub_8019DD0: @ 8019DD0 - push {r4,r5,lr} - movs r4, 0 - ldr r5, =gUnknown_02022C64 -_08019DD6: - lsls r0, r4, 2 - ldr r1, [r5] - adds r1, r0 - adds r0, r4, 0 - bl sub_8019D44 - adds r4, 0x1 - cmp r4, 0x7 - ble _08019DD6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019DD0 - - thumb_func_start sub_8019DF4 -sub_8019DF4: @ 8019DF4 - push {r4,lr} - ldr r4, =sub_8019DD0 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08019E18 - adds r0, r4, 0 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - b _08019E1A - .pool -_08019E18: - movs r0, 0x10 -_08019E1A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8019DF4 - - thumb_func_start sub_8019E20 -sub_8019E20: @ 8019E20 - push {lr} - ldr r0, =sub_8019DD0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xF - bhi _08019E34 - bl DestroyTask -_08019E34: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019E20 - - thumb_func_start sub_8019E3C -sub_8019E3C: @ 8019E3C - push {r4,lr} - movs r4, 0 -_08019E40: - adds r0, r4, 0 - bl sub_8019A30 - cmp r0, 0 - bne _08019E56 - adds r0, r4, 0 - bl sub_8019AB8 - adds r0, r4, 0 - bl flag_set_x63 -_08019E56: - adds r4, 0x1 - cmp r4, 0x7 - ble _08019E40 - ldr r1, =gUnknown_02022C64 - movs r0, 0 - str r0, [r1] - bl sub_8019E20 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019E3C - - thumb_func_start sub_8019E70 -sub_8019E70: @ 8019E70 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - str r0, [sp, 0x8] - mov r9, r1 - movs r7, 0 - mov r0, r9 - lsls r0, 2 - mov r8, r0 - ldr r0, =gUnknown_082F0740 - mov r2, r8 - adds r1, r2, r0 - ldrh r1, [r1] - mov r2, sp - strh r1, [r2, 0xC] - adds r0, 0x2 - add r0, r8 - ldrh r0, [r0] - mov r10, r0 - ldr r6, =gUnknown_082F0760 -_08019E9E: - mov r5, r8 - add r5, r9 - adds r5, r7 - adds r4, r5, 0 - subs r4, 0x38 - lsls r4, 24 - lsrs r4, 24 - movs r2, 0 - ldrsb r2, [r6, r2] - mov r0, sp - ldrh r0, [r0, 0xC] - adds r2, r0, r2 - lsls r2, 16 - asrs r2, 16 - movs r3, 0x1 - ldrsb r3, [r6, r3] - add r3, r10 - lsls r3, 16 - asrs r3, 16 - movs r0, 0x3 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x41 - adds r1, r4, 0 - bl sprite_new - ldr r1, [sp, 0x8] - adds r5, r1, r5 - strb r0, [r5] - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8097C44 - adds r6, 0x2 - adds r7, 0x1 - cmp r7, 0x4 - ble _08019E9E - 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_8019E70 - - thumb_func_start sub_8019F04 -sub_8019F04: @ 8019F04 - push {r4-r6,lr} - adds r5, r0, 0 - movs r4, 0 - ldr r6, =gSprites -_08019F0C: - adds r0, r5, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - adds r4, 0x1 - cmp r4, 0x27 - ble _08019F0C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019F04 - - thumb_func_start sub_8019F2C -sub_8019F2C: @ 8019F2C - push {r4-r7,lr} - sub sp, 0x8 - movs r5, 0 - add r7, sp, 0x4 -_08019F34: - movs r4, 0 - adds r6, r5, 0x1 -_08019F38: - adds r0, r5, 0 - adds r1, r4, 0 - mov r2, sp - adds r3, r7, 0 - bl sub_8019990 - ldr r0, [sp] - ldr r1, [sp, 0x4] - movs r2, 0 - bl sub_8088B94 - adds r4, 0x1 - cmp r4, 0x4 - ble _08019F38 - adds r5, r6, 0 - cmp r5, 0x7 - ble _08019F34 - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8019F2C - - thumb_func_start sub_8019F64 -sub_8019F64: @ 8019F64 - push {lr} - adds r1, r0, 0 - cmp r1, 0 - beq _08019F78 - ldr r0, =gUnknown_082F076F - adds r0, r1, r0 - ldrb r0, [r0] - b _08019F88 - .pool -_08019F78: - ldrb r1, [r2, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - beq _08019F86 - movs r0, 0x4 - b _08019F88 -_08019F86: - movs r0, 0x1 -_08019F88: - pop {r1} - bx r1 - thumb_func_end sub_8019F64 - - thumb_func_start sub_8019F8C -sub_8019F8C: @ 8019F8C - push {lr} - adds r2, r0, 0 - lsls r0, r2, 2 - adds r0, r2 - adds r0, r1 - subs r0, 0x38 - lsls r0, 24 - lsrs r0, 24 - bl sub_8097C8C - pop {r1} - bx r1 - thumb_func_end sub_8019F8C - - thumb_func_start sub_8019FA4 -sub_8019FA4: @ 8019FA4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - adds r5, r0, 0 - adds r6, r1, 0 - mov r9, r3 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r0, r5, 2 - adds r0, r5 - adds r7, r0, r6 - adds r0, r5, 0 - bl sub_8019F8C - cmp r0, 0x1 - bne _08019FE2 - adds r4, r7, 0 - subs r4, 0x38 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0 - bl sub_8097C44 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8097CC4 -_08019FE2: - adds r0, r7, 0 - subs r0, 0x38 - lsls r0, 24 - lsrs r0, 24 - mov r1, r8 - bl sub_8097BB4 - adds r0, r6, 0 - adds r1, r5, 0 - mov r2, r9 - bl sub_8019F64 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_801A3B0 - add r3, sp, 0x4 - adds r0, r5, 0 - adds r1, r6, 0 - mov r2, sp - bl sub_8019990 - ldr r0, [sp] - ldr r1, [sp, 0x4] - movs r2, 0x1 - bl sub_8088B94 - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8019FA4 - - thumb_func_start sub_801A02C -sub_801A02C: @ 801A02C - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - adds r5, r1, 0 - lsls r0, r4, 2 - adds r0, r4 - adds r0, r5 - subs r0, 0x38 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl sub_8097CC4 - add r3, sp, 0x4 - adds r0, r4, 0 - adds r1, r5, 0 - mov r2, sp - bl sub_8019990 - ldr r0, [sp] - ldr r1, [sp, 0x4] - movs r2, 0 - bl sub_8088B94 - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A02C - - thumb_func_start sub_801A064 -sub_801A064: @ 801A064 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r7, r0, 0 - mov r8, r1 - mov r6, sp - adds r6, 0x2 - mov r0, sp - adds r1, r6, 0 - bl PlayerGetDestCoords - add r4, sp, 0x4 - mov r5, sp - adds r5, 0x6 - adds r0, r4, 0 - adds r1, r5, 0 - bl plaer_get_pos_including_state_based_drift - lsls r0, r7, 2 - adds r0, r7 - subs r0, 0x38 - lsls r0, 24 - lsrs r0, 24 - bl sub_8097C8C - mov r10, r6 - mov r9, r4 - adds r6, r5, 0 - cmp r0, 0x1 - bne _0801A0F0 - mov r0, sp - movs r1, 0 - ldrsh r2, [r0, r1] - mov r0, r10 - movs r1, 0 - ldrsh r3, [r0, r1] - adds r0, r7, 0 - movs r1, 0 - bl sub_80199E0 - cmp r0, 0x1 - beq _0801A15C - movs r0, 0 - ldrsh r2, [r4, r0] - movs r1, 0 - ldrsh r3, [r6, r1] - adds r0, r7, 0 - movs r1, 0 - bl sub_80199E0 - cmp r0, 0x1 - beq _0801A15C - mov r2, r8 - ldrb r0, [r2, 0xB] - lsls r0, 31 - lsrs r0, 31 - ldrb r1, [r2, 0x2] - bl sub_8019978 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r7, 0 - movs r1, 0 - mov r3, r8 - bl sub_8019FA4 -_0801A0F0: - movs r5, 0x1 - mov r4, r8 - adds r4, 0x4 -_0801A0F6: - ldrb r0, [r4] - cmp r0, 0 - bne _0801A106 - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_801A02C - b _0801A154 -_0801A106: - mov r0, sp - movs r1, 0 - ldrsh r2, [r0, r1] - mov r0, r10 - movs r1, 0 - ldrsh r3, [r0, r1] - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_80199E0 - cmp r0, 0 - bne _0801A154 - mov r0, r9 - movs r1, 0 - ldrsh r2, [r0, r1] - movs r0, 0 - ldrsh r3, [r6, r0] - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_80199E0 - cmp r0, 0 - bne _0801A154 - ldrb r2, [r4] - lsrs r0, r2, 3 - movs r1, 0x1 - ands r0, r1 - movs r1, 0x7 - ands r1, r2 - bl sub_8019978 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r7, 0 - adds r1, r5, 0 - mov r3, r8 - bl sub_8019FA4 -_0801A154: - adds r4, 0x1 - adds r5, 0x1 - cmp r5, 0x4 - ble _0801A0F6 -_0801A15C: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801A064 - - thumb_func_start sub_801A16C -sub_801A16C: @ 801A16C - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - ldrb r0, [r4, 0xA] - lsls r0, 25 - lsrs r0, 25 - subs r0, 0x40 - cmp r0, 0x14 - bhi _0801A20E - lsls r0, 2 - ldr r1, =_0801A18C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801A18C: - .4byte _0801A1E0 - .4byte _0801A200 - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A200 - .4byte _0801A200 - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A200 - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A200 - .4byte _0801A200 - .4byte _0801A200 - .4byte _0801A1E0 -_0801A1E0: - ldrb r1, [r4, 0xB] - lsls r1, 31 - lsrs r1, 31 - ldrb r2, [r4, 0x2] - adds r0, r5, 0 - bl sub_8019CF0 - movs r4, 0 -_0801A1F0: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A02C - adds r4, 0x1 - cmp r4, 0x4 - bls _0801A1F0 - b _0801A20E -_0801A200: - adds r0, r5, 0 - bl AGBAssert - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A064 -_0801A20E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A16C - - thumb_func_start sub_801A214 -sub_801A214: @ 801A214 - push {r4,r5,lr} - adds r5, r0, 0 - bl AGBAssert - movs r4, 0 -_0801A21E: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A02C - adds r4, 0x1 - cmp r4, 0x4 - ble _0801A21E - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A214 - - thumb_func_start sub_801A234 -sub_801A234: @ 801A234 - push {r4,r5,lr} - ldr r2, =gUnknown_02022C68 - movs r1, 0 - str r1, [r2] - movs r5, 0 - ldr r4, [r0] -_0801A240: - ldrb r0, [r4, 0x1A] - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x1 - bne _0801A258 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A16C - b _0801A264 - .pool -_0801A258: - cmp r1, 0x2 - bne _0801A264 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A214 -_0801A264: - adds r4, 0x20 - adds r5, 0x1 - cmp r5, 0x7 - ble _0801A240 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A234 - - thumb_func_start sub_801A274 -sub_801A274: @ 801A274 - ldr r1, =gUnknown_02022C68 - movs r0, 0x96 - lsls r0, 1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_801A274 - - thumb_func_start sub_801A284 -sub_801A284: @ 801A284 - push {lr} - adds r2, r0, 0 - ldr r0, =gUnknown_02022C68 - ldr r1, [r0] - adds r1, 0x1 - str r1, [r0] - movs r0, 0x96 - lsls r0, 1 - cmp r1, r0 - bls _0801A29E - adds r0, r2, 0 - bl sub_801A234 -_0801A29E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A284 - - thumb_func_start sub_801A2A8 -sub_801A2A8: @ 801A2A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r5, r0, 0 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - bl is_walking_or_running - cmp r0, 0 - bne _0801A2F0 - b _0801A396 -_0801A2C4: - ldr r4, =gUnknown_082F076A - bl player_get_direction_lower_nybble - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r2, [r0] - adds r0, r6, 0 - ldr r1, [sp, 0xC] - bl sub_801A3B0 - ldr r0, [sp, 0x4] - strh r6, [r0] - mov r1, sp - ldrh r2, [r1, 0xC] - ldr r1, [sp, 0x8] - strh r2, [r1] - movs r0, 0x1 - b _0801A398 - .pool -_0801A2F0: - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - movs r0, 0 - str r0, [sp, 0xC] - ldr r0, =gUnknown_082F0740 - adds r7, r5, 0 - movs r1, 0 - mov r10, r1 - adds r2, r0, 0x2 - str r2, [sp, 0x10] - str r0, [sp, 0x14] -_0801A30E: - movs r6, 0 - ldr r4, [sp, 0x14] - movs r0, 0 - ldrsh r4, [r4, r0] - mov r9, r4 - ldr r1, [sp, 0x10] - mov r8, r1 - ldr r5, =gUnknown_082F0760 -_0801A31E: - mov r2, r10 - adds r3, r2, r6 - mov r0, sp - movs r4, 0 - ldrsh r1, [r0, r4] - movs r0, 0 - ldrsb r0, [r5, r0] - add r0, r9 - adds r0, 0x7 - cmp r1, r0 - bne _0801A372 - mov r1, sp - movs r2, 0x2 - ldrsh r0, [r1, r2] - mov r4, r8 - movs r2, 0 - ldrsh r1, [r4, r2] - movs r2, 0x1 - ldrsb r2, [r5, r2] - adds r1, r2 - adds r1, 0x7 - cmp r0, r1 - bne _0801A372 - adds r0, r3, 0 - subs r0, 0x38 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_8097C8C - cmp r0, 0 - bne _0801A372 - adds r0, r4, 0 - bl sub_8097D9C - cmp r0, 0 - bne _0801A372 - ldrb r1, [r7, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - beq _0801A2C4 -_0801A372: - adds r5, 0x2 - adds r6, 0x1 - cmp r6, 0x4 - ble _0801A31E - adds r7, 0x20 - movs r4, 0x5 - add r10, r4 - ldr r0, [sp, 0x10] - adds r0, 0x4 - str r0, [sp, 0x10] - ldr r1, [sp, 0x14] - adds r1, 0x4 - str r1, [sp, 0x14] - ldr r2, [sp, 0xC] - adds r2, 0x1 - str r2, [sp, 0xC] - cmp r2, 0x7 - ble _0801A30E -_0801A396: - movs r0, 0 -_0801A398: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801A2A8 - - thumb_func_start sub_801A3B0 -sub_801A3B0: @ 801A3B0 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - lsls r1, r2, 24 - lsrs r1, 24 - lsls r0, r3, 2 - adds r0, r3 - subs r0, 0x38 - adds r0, r4 - lsls r0, 24 - lsrs r0, 24 - bl sub_8097B78 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801A3B0 - - thumb_func_start sub_801A3D0 -sub_801A3D0: @ 801A3D0 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - lsls r3, r4, 5 - adds r3, r2 - adds r2, r3, 0 - bl sub_8019F64 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A3B0 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A3D0 - - thumb_func_start sub_801A3F4 -sub_801A3F4: @ 801A3F4 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801A414 - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade -_0801A414: - pop {r0} - bx r0 - thumb_func_end sub_801A3F4 - - thumb_func_start sub_801A418 -sub_801A418: @ 801A418 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_801A418 - - thumb_func_start sub_801A42C -sub_801A42C: @ 801A42C - push {lr} - ldr r0, =sub_801A43C - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A42C - - thumb_func_start sub_801A43C -sub_801A43C: @ 801A43C - push {r4,r5,lr} - sub sp, 0xC - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r5, =gUnknown_03000DAC - movs r0, 0x6C - bl AllocZeroed - str r0, [r5] - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F0D34 - movs r0, 0 - movs r2, 0x2 - bl InitBgsFromTemplates - movs r4, 0x80 - lsls r4, 4 - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x1 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, =gWirelessInfoScreenGfx - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl copy_decompressed_tile_data_to_vram_autofree - ldr r1, =gWirelessInfoScreenTilemap - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r0, =gUnknown_082F0D3C - bl InitWindows - bl DeactivateAllTextPrinters - bl ResetPaletteFade - bl ResetSpriteData - bl ResetTasks - bl remove_some_task - bl m4aSoundVSyncOn - ldr r0, =sub_801A418 - bl SetVBlankCallback - ldr r0, =sub_801A6C0 - movs r1, 0 - bl CreateTask - ldr r1, [r5] - adds r1, 0x60 - strb r0, [r1] - bl sub_8013C40 - ldr r1, [r5] - adds r1, 0x61 - strb r0, [r1] - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1, 0x1C] - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - ldr r0, =gWirelessInfoScreenPal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0xF0 - bl sub_81978B0 - bl sub_81AFBF0 - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - ldr r0, =sub_801A3F4 - bl SetMainCallback2 - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A43C - - thumb_func_start sub_801A584 -sub_801A584: @ 801A584 - push {r4,lr} - bl FreeAllWindowBuffers - movs r4, 0 -_0801A58C: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBgTilemapBuffer - bl Free - adds r4, 0x1 - cmp r4, 0x1 - ble _0801A58C - ldr r0, =gUnknown_03000DAC - ldr r0, [r0] - bl Free - ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music - bl SetMainCallback2 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A584 - - thumb_func_start sub_801A5BC -sub_801A5BC: @ 801A5BC - push {lr} - adds r2, r0, 0 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _0801A5E4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xE - bne _0801A5E0 - movs r0, 0 - strh r0, [r1] -_0801A5E0: - movs r0, 0 - strh r0, [r2] -_0801A5E4: - movs r2, 0 - ldrsh r0, [r1, r2] - adds r0, 0x2 - lsls r0, 5 - ldr r1, =gWirelessInfoScreenPal - adds r0, r1 - movs r1, 0 - movs r2, 0x10 - bl LoadPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A5BC - - thumb_func_start sub_801A600 -sub_801A600: @ 801A600 - push {r4,r5,lr} - sub sp, 0x8 - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r5, =gUnknown_082F0D5C - ldr r4, [r5] - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0xC0 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x6 - str r0, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl sub_801A8B0 - movs r1, 0 -_0801A644: - adds r4, r1, 0x1 - lsls r0, r4, 2 - adds r0, r5 - ldr r2, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 25 - movs r1, 0x80 - lsls r1, 20 - adds r0, r1 - lsrs r0, 24 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r1, 0x1 - movs r3, 0 - bl sub_801A8B0 - adds r1, r4, 0 - cmp r4, 0x2 - ble _0801A644 - ldr r1, =gUnknown_082F0D5C - adds r0, r4, 0x1 - lsls r0, 2 - adds r0, r1 - ldr r2, [r0] - lsls r0, r4, 4 - subs r0, r4 - lsls r0, 25 - movs r1, 0x80 - lsls r1, 20 - adds r0, r1 - lsrs r0, 24 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0 - bl sub_801A8B0 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A600 - - thumb_func_start sub_801A6C0 -sub_801A6C0: @ 801A6C0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r2, r1, 0 - cmp r0, 0x5 - bls _0801A6E2 - b _0801A89C -_0801A6E2: - lsls r0, 2 - ldr r1, =_0801A6F4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801A6F4: - .4byte _0801A70C - .4byte _0801A728 - .4byte _0801A74C - .4byte _0801A768 - .4byte _0801A85C - .4byte _0801A884 -_0801A70C: - bl sub_801A600 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0801A89C - .pool -_0801A728: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0x1 - bl ShowBg - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl ShowBg - b _0801A86C -_0801A74C: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0801A75A - b _0801A89C -_0801A75A: - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r2 - b _0801A876 - .pool -_0801A768: - ldr r0, =gUnknown_03000DAC - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x10 - adds r2, r0, 0 - adds r2, 0x20 - adds r3, r0, 0 - adds r3, 0x61 - ldrb r3, [r3] - bl sub_801AA30 - lsls r1, r5, 2 - mov r8, r1 - cmp r0, 0 - beq _0801A7F8 - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - movs r4, 0 - ldr r6, =gStringVar4 - movs r7, 0x80 - lsls r7, 20 -_0801A796: - ldr r0, =gUnknown_03000DAC - ldr r0, [r0] - lsls r1, r4, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - cmp r4, 0x3 - beq _0801A7CC - lsrs r0, r7, 24 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x2 - movs r1, 0x1 - adds r2, r6, 0 - movs r3, 0xC - bl sub_801A8B0 - b _0801A7DE - .pool -_0801A7CC: - movs r0, 0x62 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r1, 0x1 - adds r2, r6, 0 - movs r3, 0xC - bl sub_801A8B0 -_0801A7DE: - movs r2, 0xF0 - lsls r2, 21 - adds r7, r2 - adds r4, 0x1 - cmp r4, 0x3 - ble _0801A796 - movs r0, 0x2 - bl PutWindowTilemap - movs r0, 0x2 - movs r1, 0x3 - bl CopyWindowToVram -_0801A7F8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801A80C - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0801A836 -_0801A80C: - movs r0, 0x5 - bl PlaySE - ldr r2, =gTasks - ldr r0, =gUnknown_03000DAC - ldr r0, [r0] - adds r0, 0x61 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0xFF - strh r1, [r0, 0x26] - mov r0, r8 - adds r1, r0, r5 - lsls r1, 3 - adds r1, r2 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0801A836: - mov r2, r8 - adds r1, r2, r5 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - adds r0, r1, 0 - adds r0, 0xE - adds r1, 0x10 - bl sub_801A5BC - b _0801A89C - .pool -_0801A85C: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0801A86C: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 -_0801A876: - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _0801A89C - .pool -_0801A884: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0801A89C - ldr r0, =sub_801A584 - bl SetMainCallback2 - adds r0, r5, 0 - bl DestroyTask -_0801A89C: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A6C0 - - thumb_func_start sub_801A8B0 -sub_801A8B0: @ 801A8B0 - push {r4-r7,lr} - sub sp, 0x18 - mov r12, r2 - ldr r2, [sp, 0x2C] - ldr r4, [sp, 0x30] - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r3, 24 - lsrs r5, r3, 24 - lsls r2, 24 - lsrs r3, r2, 24 - lsls r4, 24 - lsrs r0, r4, 24 - cmp r0, 0x4 - bhi _0801A93A - lsls r0, 2 - ldr r1, =_0801A8E0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801A8E0: - .4byte _0801A8F4 - .4byte _0801A902 - .4byte _0801A910 - .4byte _0801A91E - .4byte _0801A92C -_0801A8F4: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - movs r0, 0x3 - b _0801A938 -_0801A902: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0x3 - b _0801A938 -_0801A910: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x4 - strb r0, [r1, 0x1] - movs r0, 0x5 - b _0801A938 -_0801A91E: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x7 - strb r0, [r1, 0x1] - movs r0, 0x6 - b _0801A938 -_0801A92C: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0x2 -_0801A938: - strb r0, [r1, 0x2] -_0801A93A: - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - add r0, sp, 0x14 - str r0, [sp, 0x8] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0xC] - mov r0, r12 - str r0, [sp, 0x10] - adds r0, r7, 0 - adds r1, r6, 0 - adds r2, r5, 0 - bl AddTextPrinterParametrized2 - add sp, 0x18 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801A8B0 - - thumb_func_start sub_801A960 -sub_801A960: @ 801A960 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r12, r0 - adds r7, r1, 0 - ldrb r0, [r0, 0xA] - lsls r0, 25 - lsrs r0, 25 - mov r8, r0 - movs r4, 0 - ldr r0, =gUnknown_082F0D70 - mov r9, r0 - movs r1, 0x1 - add r1, r9 - mov r10, r1 - mov r3, r12 - adds r3, 0x4 - str r3, [sp] -_0801A98A: - lsls r0, r4, 1 - adds r2, r0, r4 - mov r3, r9 - adds r1, r2, r3 - adds r5, r0, 0 - adds r6, r4, 0x1 - ldrb r1, [r1] - cmp r8, r1 - bne _0801A9EE - mov r0, r12 - ldrb r1, [r0, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801A9EE - mov r0, r9 - adds r0, 0x2 - adds r3, r2, r0 - ldrb r0, [r3] - cmp r0, 0 - bne _0801A9DC - movs r2, 0 - movs r1, 0 - ldr r3, [sp] -_0801A9BA: - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0801A9C4 - adds r2, 0x1 -_0801A9C4: - adds r1, 0x1 - cmp r1, 0x3 - ble _0801A9BA - adds r2, 0x1 - adds r0, r5, r4 - add r0, r10 - ldrb r1, [r0] - lsls r1, 2 - adds r1, r7 - b _0801A9E8 - .pool -_0801A9DC: - mov r1, r10 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r1, 2 - adds r1, r7 - ldrb r2, [r3] -_0801A9E8: - ldr r0, [r1] - adds r0, r2 - str r0, [r1] -_0801A9EE: - adds r4, r6, 0 - cmp r4, 0x1E - bls _0801A98A - mov r0, r8 - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_801A960 - - thumb_func_start sub_801AA08 -sub_801AA08: @ 801AA08 - push {r4,lr} - movs r4, 0 - adds r3, r1, 0 - adds r2, r0, 0 -_0801AA10: - ldr r1, [r2] - ldr r0, [r3] - cmp r1, r0 - beq _0801AA1C - movs r0, 0x1 - b _0801AA28 -_0801AA1C: - adds r3, 0x4 - adds r2, 0x4 - adds r4, 0x1 - cmp r4, 0x3 - ble _0801AA10 - movs r0, 0 -_0801AA28: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801AA08 - - thumb_func_start sub_801AA30 -sub_801AA30: @ 801AA30 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r6, r0, 0 - mov r9, r1 - adds r5, r2, 0 - lsls r4, r3, 24 - lsrs r4, 24 - movs r0, 0 - mov r8, r0 - mov r0, sp - movs r1, 0 - movs r2, 0x10 - bl memset - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - movs r4, 0 -_0801AA5E: - lsls r1, r4, 5 - ldr r0, [r7] - adds r0, r1 - mov r1, sp - bl sub_801A960 - adds r1, r0, 0 - ldr r0, [r5] - cmp r1, r0 - beq _0801AA78 - str r1, [r5] - movs r2, 0x1 - mov r8, r2 -_0801AA78: - adds r5, 0x4 - adds r4, 0x1 - cmp r4, 0xF - ble _0801AA5E - mov r0, sp - mov r1, r9 - bl sub_801AA08 - cmp r0, 0 - bne _0801AA9C - mov r3, r8 - cmp r3, 0x1 - beq _0801AAC4 - movs r0, 0 - b _0801AAC6 - .pool -_0801AA9C: - adds r1, r6, 0 - mov r0, sp - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r0, [r0] - str r0, [r1] - mov r1, r9 - mov r0, sp - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r0, [r0] - str r0, [r1] - ldr r0, [r6] - ldr r1, [r6, 0x4] - adds r0, r1 - ldr r1, [r6, 0x8] - adds r0, r1 - ldr r1, [r6, 0xC] - adds r0, r1 - str r0, [r6, 0xC] -_0801AAC4: - movs r0, 0x1 -_0801AAC6: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_801AA30 - - thumb_func_start sub_801AAD4 -sub_801AAD4: @ 801AAD4 - push {r4-r7,lr} - movs r0, 0xA - bl sub_8014210 - movs r4, 0 - movs r7, 0x64 - ldr r6, =gPlayerParty - ldr r5, =gEnemyParty -_0801AAE4: - ldr r0, =gUnknown_0203CEF8 - adds r0, r4, r0 - ldrb r0, [r0] - subs r0, 0x1 - adds r1, r0, 0 - muls r1, r7 - adds r1, r6 - adds r0, r5, 0 - movs r2, 0x64 - bl memcpy - adds r5, 0x64 - adds r4, 0x1 - cmp r4, 0x1 - ble _0801AAE4 - ldr r4, =gPlayerParty - movs r0, 0xFA - lsls r0, 1 - adds r5, r4, r0 -_0801AB0A: - adds r0, r4, 0 - bl ZeroMonData - adds r4, 0x64 - cmp r4, r5 - ble _0801AB0A - ldr r4, =gPlayerParty - movs r5, 0 - adds r6, r4, 0 - adds r6, 0x64 -_0801AB1E: - ldr r1, =gEnemyParty - adds r1, r5, r1 - adds r0, r4, 0 - movs r2, 0x64 - bl memcpy - adds r4, 0x64 - adds r5, 0x64 - cmp r4, r6 - ble _0801AB1E - movs r0, 0x32 - bl IncrementGameStat - bl CalculatePlayerPartyCount - ldr r0, =gTrainerBattleOpponent_A - movs r2, 0xC0 - lsls r2, 4 - adds r1, r2, 0 - strh r1, [r0] - ldr r0, =CB2_InitBattle - bl SetMainCallback2 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801AAD4 - - thumb_func_start sub_801AB68 -sub_801AB68: @ 801AB68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r5, r0, 0 - adds r7, r1, 0 - adds r6, r2, 0 - ldr r4, [sp, 0x38] - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - mov r9, r0 - movs r1, 0x1 - mov r10, r1 - ldr r0, =gUnknown_082F0DE4 - mov r8, r0 - ldrb r0, [r0] - lsls r1, r0, 4 - orrs r1, r0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - str r3, [sp, 0x14] - bl FillWindowPixelBuffer - mov r1, r9 - str r1, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - lsls r4, 24 - asrs r4, 24 - str r4, [sp, 0xC] - str r7, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - ldr r3, [sp, 0x14] - bl AddTextPrinterParametrized2 - 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 sub_801AB68 - - thumb_func_start sub_801ABDC -sub_801ABDC: @ 801ABDC - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r6, r1, 0 - adds r5, r2, 0 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0801ABF4 - cmp r0, 0x1 - beq _0801AC22 - b _0801AC36 -_0801ABF4: - movs r0, 0 - movs r1, 0x1 - movs r2, 0xD - bl sub_8098858 - str r5, [sp] - movs r0, 0 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_801AB68 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _0801AC36 -_0801AC22: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0801AC36 - strh r0, [r4] - movs r0, 0x1 - b _0801AC38 -_0801AC36: - movs r0, 0 -_0801AC38: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801ABDC - - thumb_func_start sub_801AC40 -sub_801AC40: @ 801AC40 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_801AC40 - - thumb_func_start sub_801AC54 -sub_801AC54: @ 801AC54 - push {r4,lr} - sub sp, 0xC - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0x33 - bls _0801AC6A - b _0801AFAE -_0801AC6A: - lsls r0, 2 - ldr r1, =_0801AC7C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801AC7C: - .4byte _0801AD4C - .4byte _0801ADFC - .4byte _0801AE24 - .4byte _0801AE48 - .4byte _0801AE98 - .4byte _0801AFAE - .4byte _0801AF7C - .4byte _0801AF58 - .4byte _0801AF7C - .4byte _0801AF98 - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AF24 - .4byte _0801AF40 -_0801AD4C: - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r4, =gUnknown_02022C6C - movs r0, 0x4 - bl AllocZeroed - str r0, [r4] - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F0DD0 - movs r0, 0 - movs r2, 0x1 - bl InitBgsFromTemplates - bl reset_temp_tile_data_buffers - ldr r0, =gUnknown_082F0DD4 - bl InitWindows - lsls r0, 16 - cmp r0, 0 - bne _0801AD8C - b _0801AFC2 -_0801AD8C: - bl DeactivateAllTextPrinters - movs r0, 0 - bl ClearWindowTilemap - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0 - movs r1, 0x1 - movs r2, 0xD0 - bl sub_809882C - movs r0, 0 - movs r1, 0x1 - movs r2, 0xD0 - bl box_border_load_tiles_and_pal - bl sub_819789C - ldr r0, =sub_801AC40 - bl SetVBlankCallback - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _0801AF8A - .pool -_0801ADFC: - ldr r0, =gUnknown_02022C6C - ldr r0, [r0] - ldr r1, =gText_CommStandbyAwaitingOtherPlayer - movs r2, 0 - bl sub_801ABDC - cmp r0, 0 - bne _0801AE0E - b _0801AFAE -_0801AE0E: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0801AF8A - .pool -_0801AE24: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0 - bl ShowBg - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _0801AF8A - .pool -_0801AE48: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0801AE54 - b _0801AFAE -_0801AE54: - ldr r4, =gUnknown_020228C4 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x20 - bl memset - ldr r0, =gUnknown_0203CEF8 - ldrb r1, [r0] - ldrb r0, [r0, 0x1] - cmn r1, r0 - bne _0801AE78 - movs r0, 0x52 - b _0801AE7A - .pool -_0801AE78: - movs r0, 0x51 -_0801AE7A: - strb r0, [r4] - ldr r1, =gUnknown_020228C4 - movs r0, 0 - movs r2, 0x20 - bl SendBlock - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0801AF8A - .pool -_0801AE98: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _0801AEA6 - b _0801AFAE -_0801AEA6: - ldr r1, =gBlockRecvBuffer - ldrh r0, [r1] - cmp r0, 0x51 - bne _0801AEE0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r1, r2 - ldrh r0, [r0] - cmp r0, 0x51 - bne _0801AEE0 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x32 - b _0801AF16 - .pool -_0801AEE0: - bl sub_800AC34 - ldr r4, =gBlockRecvBuffer - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 16 - adds r0, r4 - ldrh r0, [r0] - cmp r0, 0x52 - bne _0801AF0C - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0x6 - b _0801AF16 - .pool -_0801AF0C: - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x8 -_0801AF16: - strb r1, [r0] - bl ResetBlockReceivedFlags - b _0801AFAE - .pool -_0801AF24: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0801AFAE - bl sub_800ADF8 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0801AF8A - .pool -_0801AF40: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801AFAE - ldr r0, =sub_801AAD4 - bl SetMainCallback2 - b _0801AFAE - .pool -_0801AF58: - ldr r0, =gUnknown_02022C6C - ldr r0, [r0] - ldr r1, =gText_RefusedBattle - movs r2, 0x1 - bl sub_801ABDC - cmp r0, 0 - beq _0801AFAE - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 - b _0801AFAE - .pool -_0801AF7C: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801AFAE - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 -_0801AF8A: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0801AFAE - .pool -_0801AF98: - ldr r0, =gUnknown_02022C6C - ldr r0, [r0] - ldr r1, =gText_BattleWasRefused - movs r2, 0x1 - bl sub_801ABDC - cmp r0, 0 - beq _0801AFAE - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 -_0801AFAE: - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade -_0801AFC2: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801AC54 - - thumb_func_start sub_801AFD8 -sub_801AFD8: @ 801AFD8 - push {lr} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x0000322c - adds r1, r0 - ldr r2, =0x050000db - mov r0, sp - bl CpuSet - bl sub_801B180 - bl sub_811F8BC - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_801AFD8 - - thumb_func_start sub_801B00C -sub_801B00C: @ 801B00C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003230 - adds r0, r1 - bx lr - .pool - thumb_func_end sub_801B00C - - thumb_func_start sav1_get_mevent_buffer_1 -sav1_get_mevent_buffer_1: @ 801B020 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x000033f0 - adds r0, r1 - bx lr - .pool - thumb_func_end sav1_get_mevent_buffer_1 - - thumb_func_start sav1_get_mevent_buffer_2 -sav1_get_mevent_buffer_2: @ 801B034 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0xD5 - lsls r1, 6 - adds r0, r1 - bx lr - .pool - thumb_func_end sav1_get_mevent_buffer_2 - - thumb_func_start sub_801B044 -sub_801B044: @ 801B044 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000356c - adds r0, r1 - bx lr - .pool - thumb_func_end sub_801B044 - - thumb_func_start sub_801B058 -sub_801B058: @ 801B058 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003564 - adds r0, r1 - bx lr - .pool - thumb_func_end sub_801B058 - - thumb_func_start sub_801B06C -sub_801B06C: @ 801B06C - push {lr} - bl sub_801B14C - pop {r0} - bx r0 - thumb_func_end sub_801B06C - - thumb_func_start sub_801B078 -sub_801B078: @ 801B078 - push {r4-r7,lr} - adds r7, r0, 0 - bl sub_801B114 - cmp r0, 0 - beq _0801B0C4 - bl sub_801B14C - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r5, =0x00003230 - adds r0, r5 - movs r6, 0xDE - lsls r6, 1 - adds r1, r7, 0 - adds r2, r6, 0 - bl memcpy - ldr r0, [r4] - adds r0, r5 - adds r1, r6, 0 - bl CalcCRC16WithTable - ldr r1, [r4] - ldr r2, =0x0000322c - adds r1, r2 - lsls r0, 16 - lsrs r0, 16 - str r0, [r1] - movs r0, 0x1 - b _0801B0C6 - .pool -_0801B0C4: - movs r0, 0 -_0801B0C6: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_801B078 - - thumb_func_start sub_801B0CC -sub_801B0CC: @ 801B0CC - push {r4,lr} - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r1, =0x00003230 - adds r0, r1 - movs r1, 0xDE - lsls r1, 1 - bl CalcCRC16WithTable - lsls r0, 16 - lsrs r0, 16 - ldr r4, [r4] - ldr r2, =0x0000322c - adds r1, r4, r2 - ldr r1, [r1] - cmp r0, r1 - bne _0801B10C - ldr r1, =0x00003230 - adds r0, r4, r1 - bl sub_801B114 - cmp r0, 0 - beq _0801B10C - movs r0, 0x1 - b _0801B10E - .pool -_0801B10C: - movs r0, 0 -_0801B10E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801B0CC - - thumb_func_start sub_801B114 -sub_801B114: @ 801B114 - push {lr} - ldrh r0, [r0] - cmp r0, 0 - beq _0801B120 - movs r0, 0x1 - b _0801B122 -_0801B120: - movs r0, 0 -_0801B122: - pop {r1} - bx r1 - thumb_func_end sub_801B114 - - thumb_func_start sub_801B128 -sub_801B128: @ 801B128 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003230 - adds r0, r1 - ldrb r0, [r0, 0x2] - cmp r0, 0 - beq _0801B144 - movs r0, 0x1 - b _0801B146 - .pool -_0801B144: - movs r0, 0 -_0801B146: - pop {r1} - bx r1 - thumb_func_end sub_801B128 - - thumb_func_start sub_801B14C -sub_801B14C: @ 801B14C - push {r4,lr} - sub sp, 0x4 - movs r4, 0 - str r4, [sp] - bl sub_801B00C - adds r1, r0, 0 - ldr r2, =0x0500006f - mov r0, sp - bl CpuSet - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000322c - adds r0, r1 - str r4, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B14C - - thumb_func_start sub_801B180 -sub_801B180: @ 801B180 - push {lr} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - bl sub_801B044 - adds r1, r0, 0 - ldr r2, =0x05000001 - mov r0, sp - bl CpuSet - bl sub_801DBC0 - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B180 - - thumb_func_start sub_801B1A4 -sub_801B1A4: @ 801B1A4 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003230 - adds r4, r0, r1 - bl sub_801B0CC - cmp r0, 0 - bne _0801B1C4 -_0801B1B8: - movs r0, 0 - b _0801B1DC - .pool -_0801B1C4: - movs r2, 0 - ldr r3, =0x000001bb -_0801B1C8: - adds r0, r4, r2 - adds r1, r5, r2 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bne _0801B1B8 - adds r2, 0x1 - cmp r2, r3 - bls _0801B1C8 - movs r0, 0x1 -_0801B1DC: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801B1A4 - - thumb_func_start sub_801B1E8 -sub_801B1E8: @ 801B1E8 - push {lr} - bl sub_801B330 - bl sub_801B368 - bl sub_801B9F8 - bl ClearRamScript - bl sub_809D4D8 - bl sub_809D570 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000bec - adds r0, r1 - bl sub_816534C - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B1E8 - - thumb_func_start sub_801B21C -sub_801B21C: @ 801B21C - push {r4-r7,lr} - adds r7, r0, 0 - bl sub_801B2CC - cmp r0, 0 - beq _0801B274 - bl sub_801B1E8 - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r5, =0x000033f0 - adds r0, r5 - movs r6, 0xA6 - lsls r6, 1 - adds r1, r7, 0 - adds r2, r6, 0 - bl memcpy - ldr r0, [r4] - adds r0, r5 - adds r1, r6, 0 - bl CalcCRC16WithTable - ldr r1, [r4] - ldr r3, =0x000033ec - adds r2, r1, r3 - lsls r0, 16 - lsrs r0, 16 - str r0, [r2] - movs r0, 0xD5 - lsls r0, 6 - adds r2, r1, r0 - adds r1, r5 - ldrh r0, [r1, 0x2] - strh r0, [r2, 0x6] - movs r0, 0x1 - b _0801B276 - .pool -_0801B274: - movs r0, 0 -_0801B276: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_801B21C - - thumb_func_start sub_801B27C -sub_801B27C: @ 801B27C - push {r4,r5,lr} - ldr r5, =gSaveBlock1Ptr - ldr r0, [r5] - ldr r1, =0x000033ec - adds r4, r0, r1 - adds r1, 0x4 - adds r0, r1 - movs r1, 0xA6 - lsls r1, 1 - bl CalcCRC16WithTable - lsls r0, 16 - lsrs r0, 16 - ldr r1, [r4] - cmp r1, r0 - bne _0801B2C4 - ldr r0, [r5] - ldr r1, =0x000033f0 - adds r0, r1 - bl sub_801B2CC - cmp r0, 0 - beq _0801B2C4 - bl sub_80991F8 - cmp r0, 0 - beq _0801B2C4 - movs r0, 0x1 - b _0801B2C6 - .pool -_0801B2C4: - movs r0, 0 -_0801B2C6: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801B27C - - thumb_func_start sub_801B2CC -sub_801B2CC: @ 801B2CC - push {lr} - adds r2, r0, 0 - ldrh r0, [r2] - cmp r0, 0 - beq _0801B302 - ldrb r1, [r2, 0x8] - lsls r0, r1, 30 - lsrs r0, 30 - cmp r0, 0x2 - bhi _0801B302 - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0 - beq _0801B2F0 - cmp r0, 0x40 - beq _0801B2F0 - cmp r0, 0x80 - bne _0801B302 -_0801B2F0: - lsls r0, r1, 26 - lsrs r0, 28 - cmp r0, 0x7 - bhi _0801B302 - ldrb r0, [r2, 0x9] - cmp r0, 0x7 - bhi _0801B302 - movs r0, 0x1 - b _0801B304 -_0801B302: - movs r0, 0 -_0801B304: - pop {r1} - bx r1 - thumb_func_end sub_801B2CC - - thumb_func_start sub_801B308 -sub_801B308: @ 801B308 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x000033f0 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0 - beq _0801B328 - movs r0, 0x1 - b _0801B32A - .pool -_0801B328: - movs r0, 0 -_0801B32A: - pop {r1} - bx r1 - thumb_func_end sub_801B308 - - thumb_func_start sub_801B330 -sub_801B330: @ 801B330 - push {r4,r5,lr} - sub sp, 0x4 - movs r5, 0 - str r5, [sp] - ldr r4, =gSaveBlock1Ptr - ldr r1, [r4] - ldr r0, =0x000033f0 - adds r1, r0 - ldr r2, =0x05000053 - mov r0, sp - bl CpuSet - ldr r0, [r4] - ldr r1, =0x000033ec - adds r0, r1 - str r5, [r0] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B330 - - thumb_func_start sub_801B368 -sub_801B368: @ 801B368 - push {r4,lr} - sub sp, 0x4 - movs r4, 0 - str r4, [sp] - bl sav1_get_mevent_buffer_2 - adds r1, r0, 0 - ldr r2, =0x05000009 - mov r0, sp - bl CpuSet - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000353c - adds r0, r1 - str r4, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B368 - - thumb_func_start sub_801B39C -sub_801B39C: @ 801B39C - push {lr} - bl sub_801B27C - cmp r0, 0 - bne _0801B3AA - movs r0, 0 - b _0801B3B4 -_0801B3AA: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x000033f0 - adds r0, r1 - ldrh r0, [r0] -_0801B3B4: - pop {r1} - bx r1 - .pool - thumb_func_end sub_801B39C - - thumb_func_start sub_801B3C0 -sub_801B3C0: @ 801B3C0 - push {lr} - adds r2, r0, 0 - ldrb r1, [r2, 0x8] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x40 - bne _0801B3D4 - movs r0, 0x3F - ands r0, r1 - strb r0, [r2, 0x8] -_0801B3D4: - pop {r0} - bx r0 - thumb_func_end sub_801B3C0 - - thumb_func_start sub_801B3D8 -sub_801B3D8: @ 801B3D8 - push {lr} - lsls r0, 16 - ldr r1, =0xfc180000 - adds r0, r1 - lsrs r0, 16 - cmp r0, 0x13 - bls _0801B3F0 - movs r0, 0 - b _0801B3F2 - .pool -_0801B3F0: - movs r0, 0x1 -_0801B3F2: - pop {r1} - bx r1 - thumb_func_end sub_801B3D8 - - thumb_func_start sub_801B3F8 -sub_801B3F8: @ 801B3F8 - push {r4,lr} - bl sub_801B39C - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl sub_801B3D8 - cmp r0, 0 - beq _0801B430 - ldr r1, =gUnknown_082F0DE8 - ldr r2, =0xfffffc18 - adds r0, r4, r2 - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0801B430 - movs r0, 0x1 - b _0801B432 - .pool -_0801B430: - movs r0, 0 -_0801B432: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801B3F8 - - thumb_func_start sub_801B438 -sub_801B438: @ 801B438 - push {lr} - movs r3, 0 - cmp r3, r1 - bge _0801B45A - adds r2, r0, 0 - adds r2, 0x8 -_0801B444: - ldrh r0, [r2, 0xE] - cmp r0, 0 - beq _0801B452 - ldrh r0, [r2] - cmp r0, 0 - beq _0801B452 - adds r3, 0x1 -_0801B452: - adds r2, 0x2 - subs r1, 0x1 - cmp r1, 0 - bne _0801B444 -_0801B45A: - adds r0, r3, 0 - pop {r1} - bx r1 - thumb_func_end sub_801B438 - - thumb_func_start sub_801B460 -sub_801B460: @ 801B460 - push {r4-r7,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r1, 0 - cmp r1, r2 - bge _0801B49A - ldrh r6, [r4, 0x2] - movs r0, 0x16 - adds r0, r5 - mov r12, r0 -_0801B474: - lsls r3, r1, 1 - mov r7, r12 - ldrh r0, [r7] - cmp r0, r6 - beq _0801B48C - adds r0, r5, 0 - adds r0, 0x8 - adds r0, r3 - ldrh r0, [r0] - ldrh r3, [r4] - cmp r0, r3 - bne _0801B490 -_0801B48C: - movs r0, 0x1 - b _0801B49C -_0801B490: - movs r7, 0x2 - add r12, r7 - adds r1, 0x1 - cmp r1, r2 - blt _0801B474 -_0801B49A: - movs r0, 0 -_0801B49C: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_801B460 - - thumb_func_start sub_801B4A4 -sub_801B4A4: @ 801B4A4 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x2] - cmp r0, 0 - beq _0801B4C4 - ldrh r1, [r1] - cmp r1, 0 - beq _0801B4C4 - ldr r0, =0x0000019b - cmp r1, r0 - bhi _0801B4C4 - movs r0, 0x1 - b _0801B4C6 - .pool -_0801B4C4: - movs r0, 0 -_0801B4C6: - pop {r1} - bx r1 - thumb_func_end sub_801B4A4 - - thumb_func_start sub_801B4CC -sub_801B4CC: @ 801B4CC - push {lr} - bl sub_801B27C - cmp r0, 0 - beq _0801B500 - ldr r0, =gSaveBlock1Ptr - ldr r3, [r0] - ldr r0, =0x000033f0 - adds r2, r3, r0 - ldrb r1, [r2, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801B500 - movs r1, 0xD5 - lsls r1, 6 - adds r0, r3, r1 - ldrb r1, [r2, 0x9] - bl sub_801B438 - b _0801B502 - .pool -_0801B500: - movs r0, 0 -_0801B502: - pop {r1} - bx r1 - thumb_func_end sub_801B4CC - - thumb_func_start sub_801B508 -sub_801B508: @ 801B508 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r6, =gSaveBlock1Ptr - ldr r0, [r6] - ldr r1, =0x000033f0 - adds r0, r1 - ldrb r4, [r0, 0x9] - adds r0, r5, 0 - bl sub_801B4A4 - cmp r0, 0 - beq _0801B572 - ldr r0, [r6] - movs r1, 0xD5 - lsls r1, 6 - adds r0, r1 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_801B460 - cmp r0, 0 - beq _0801B54C - b _0801B572 - .pool -_0801B540: - ldrh r0, [r5, 0x2] - strh r0, [r1] - ldrh r0, [r5] - strh r0, [r2] - movs r0, 0x1 - b _0801B574 -_0801B54C: - movs r3, 0 - cmp r3, r4 - bge _0801B572 - ldr r0, [r6] - ldr r6, =0x00003548 - adds r2, r0, r6 - adds r6, 0xE - adds r1, r0, r6 -_0801B55C: - ldrh r0, [r2, 0xE] - cmp r0, 0 - bne _0801B568 - ldrh r0, [r2] - cmp r0, 0 - beq _0801B540 -_0801B568: - adds r2, 0x2 - adds r1, 0x2 - adds r3, 0x1 - cmp r3, r4 - blt _0801B55C -_0801B572: - movs r0, 0 -_0801B574: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801B508 - - thumb_func_start sub_801B580 -sub_801B580: @ 801B580 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r5, r0, 0 - adds r4, r1, 0 - movs r0, 0 - str r0, [sp] - ldr r2, =0x05000019 - mov r0, sp - adds r1, r5, 0 - bl CpuSet - ldr r0, =0x00000101 - str r0, [r5] - movs r0, 0x1 - strh r0, [r5, 0x4] - str r0, [r5, 0x8] - cmp r4, 0 - beq _0801B5C0 - movs r0, 0x5 - strh r0, [r5, 0xC] - ldr r0, =0x00000201 - b _0801B5C8 - .pool -_0801B5C0: - movs r0, 0x4 - strh r0, [r5, 0xC] - movs r0, 0x80 - lsls r0, 2 -_0801B5C8: - str r0, [r5, 0x10] - bl sub_801B27C - cmp r0, 0 - beq _0801B5FC - bl sav1_get_mevent_buffer_1 - ldrh r0, [r0] - strh r0, [r5, 0x14] - bl sav1_get_mevent_buffer_2 - adds r1, r5, 0 - adds r1, 0x20 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - bl sav1_get_mevent_buffer_1 - ldrb r1, [r0, 0x9] - adds r0, r5, 0 - adds r0, 0x44 - strb r1, [r0] - b _0801B5FE -_0801B5FC: - strh r0, [r5, 0x14] -_0801B5FE: - adds r4, r5, 0 - adds r4, 0x4C - ldr r0, =gSaveBlock2Ptr - mov r8, r0 - adds r6, r5, 0 - adds r6, 0x45 - adds r7, r5, 0 - adds r7, 0x50 - movs r1, 0x5C - adds r1, r5 - mov r9, r1 - movs r2, 0x60 - adds r2, r5 - mov r10, r2 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r3, =0x00003564 - adds r2, r0, r3 - adds r1, r5, 0 - adds r1, 0x16 - movs r3, 0x3 -_0801B628: - ldrh r0, [r2] - strh r0, [r1] - adds r2, 0x2 - adds r1, 0x2 - subs r3, 0x1 - cmp r3, 0 - bge _0801B628 - mov r0, r8 - ldr r1, [r0] - adds r1, 0xA - adds r0, r4, 0 - bl CopyUnalignedWord - mov r2, r8 - ldr r1, [r2] - adds r0, r6, 0 - bl StringCopy - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r3, =0x00002bb0 - adds r2, r0, r3 - adds r1, r7, 0 - movs r3, 0x5 -_0801B658: - ldrh r0, [r2] - strh r0, [r1] - adds r2, 0x2 - adds r1, 0x2 - subs r3, 0x1 - cmp r3, 0 - bge _0801B658 - ldr r1, =RomHeaderGameCode - mov r0, r9 - movs r2, 0x4 - bl memcpy - ldr r0, =RomHeaderSoftwareVersion - ldrb r0, [r0] - mov r4, r10 - strb r0, [r4] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B580 - - thumb_func_start sub_801B6A0 -sub_801B6A0: @ 801B6A0 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldr r1, [r2] - ldr r0, =0x00000101 - cmp r1, r0 - bne _0801B6DC - ldrh r1, [r2, 0x4] - movs r3, 0x1 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0801B6DC - ldr r0, [r2, 0x8] - ands r0, r3 - cmp r0, 0 - beq _0801B6DC - cmp r4, 0 - bne _0801B6E4 - ldrh r1, [r2, 0xC] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0801B6DC - ldr r0, [r2, 0x10] - movs r1, 0xE0 - lsls r1, 2 - ands r0, r1 - cmp r0, 0 - bne _0801B6E4 -_0801B6DC: - movs r0, 0 - b _0801B6E6 - .pool -_0801B6E4: - movs r0, 0x1 -_0801B6E6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801B6A0 - - thumb_func_start sub_801B6EC -sub_801B6EC: @ 801B6EC - push {lr} - ldrh r1, [r1, 0x14] - cmp r1, 0 - bne _0801B6F8 - movs r0, 0 - b _0801B704 -_0801B6F8: - ldrh r0, [r0] - cmp r0, r1 - beq _0801B702 - movs r0, 0x2 - b _0801B704 -_0801B702: - movs r0, 0x1 -_0801B704: - pop {r1} - bx r1 - thumb_func_end sub_801B6EC - - thumb_func_start sub_801B708 -sub_801B708: @ 801B708 - push {r4-r6,lr} - adds r6, r0, 0 - adds r4, r1, 0 - adds r5, r4, 0 - adds r5, 0x20 - adds r4, 0x44 - ldrb r1, [r4] - adds r0, r5, 0 - bl sub_801B438 - ldrb r2, [r4] - subs r4, r2, r0 - cmp r4, 0 - bne _0801B728 - movs r0, 0x1 - b _0801B742 -_0801B728: - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_801B460 - cmp r0, 0 - beq _0801B738 - movs r0, 0x3 - b _0801B742 -_0801B738: - cmp r4, 0x1 - beq _0801B740 - movs r0, 0x2 - b _0801B742 -_0801B740: - movs r0, 0x4 -_0801B742: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801B708 - - thumb_func_start sub_801B748 -sub_801B748: @ 801B748 - push {r4,lr} - movs r3, 0 - adds r2, r0, 0 - adds r2, 0x16 -_0801B750: - ldrh r0, [r2] - ldrh r4, [r1] - cmp r0, r4 - beq _0801B75C - movs r0, 0 - b _0801B768 -_0801B75C: - adds r1, 0x2 - adds r2, 0x2 - adds r3, 0x1 - cmp r3, 0x3 - ble _0801B750 - movs r0, 0x1 -_0801B768: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801B748 - - thumb_func_start sub_801B770 -sub_801B770: @ 801B770 - push {lr} - adds r2, r0, 0 - adds r2, 0x20 - adds r0, 0x44 - ldrb r1, [r0] - adds r0, r2, 0 - bl sub_801B438 - pop {r1} - bx r1 - thumb_func_end sub_801B770 - - thumb_func_start sub_801B784 -sub_801B784: @ 801B784 - push {lr} - adds r2, r0, 0 - cmp r1, 0x4 - bhi _0801B7D0 - lsls r0, r1, 2 - ldr r1, =_0801B79C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801B79C: - .4byte _0801B7B0 - .4byte _0801B7B4 - .4byte _0801B7B8 - .4byte _0801B7BC - .4byte _0801B7C8 -_0801B7B0: - ldrh r0, [r2, 0x20] - b _0801B7D2 -_0801B7B4: - ldrh r0, [r2, 0x22] - b _0801B7D2 -_0801B7B8: - ldrh r0, [r2, 0x24] - b _0801B7D2 -_0801B7BC: - adds r0, r2, 0 - bl sub_801B770 - lsls r0, 16 - lsrs r0, 16 - b _0801B7D2 -_0801B7C8: - adds r0, r2, 0 - adds r0, 0x44 - ldrb r0, [r0] - b _0801B7D2 -_0801B7D0: - movs r0, 0 -_0801B7D2: - pop {r1} - bx r1 - thumb_func_end sub_801B784 - - thumb_func_start sub_801B7D8 -sub_801B7D8: @ 801B7D8 - push {r4,lr} - adds r4, r0, 0 - ldr r2, =gSaveBlock1Ptr - ldr r0, [r2] - ldr r1, =0x000033f0 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x3 - ands r0, r1 - adds r3, r2, 0 - cmp r0, 0x2 - bne _0801B850 - movs r2, 0 - cmp r4, 0x4 - bhi _0801B83A - lsls r0, r4, 2 - ldr r1, =_0801B80C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801B80C: - .4byte _0801B820 - .4byte _0801B828 - .4byte _0801B834 - .4byte _0801B83A - .4byte _0801B83A -_0801B820: - ldr r0, [r3] - movs r1, 0xD5 - lsls r1, 6 - b _0801B838 -_0801B828: - ldr r0, [r3] - ldr r1, =0x00003542 - b _0801B838 - .pool -_0801B834: - ldr r0, [r3] - ldr r1, =0x00003544 -_0801B838: - adds r2, r0, r1 -_0801B83A: - cmp r2, 0 - beq _0801B850 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - ldr r1, =0x000003e7 - cmp r0, r1 - bls _0801B850 - strh r1, [r2] -_0801B850: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B7D8 - - thumb_func_start mevent_081445C0 -mevent_081445C0: @ 801B860 - push {lr} - cmp r0, 0x4 - bhi _0801B938 - lsls r0, 2 - ldr r1, =_0801B874 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801B874: - .4byte _0801B888 - .4byte _0801B8AC - .4byte _0801B8D0 - .4byte _0801B8F4 - .4byte _0801B918 -_0801B888: - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r1, =0x000033f0 - adds r0, r2, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x2 - bne _0801B938 - movs r1, 0xD5 - lsls r1, 6 - adds r0, r2, r1 - ldrh r0, [r0] - b _0801B93A - .pool -_0801B8AC: - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r1, =0x000033f0 - adds r0, r2, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x2 - bne _0801B938 - movs r1, 0xD5 - lsls r1, 6 - adds r0, r2, r1 - ldrh r0, [r0, 0x2] - b _0801B93A - .pool -_0801B8D0: - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r1, =0x000033f0 - adds r0, r2, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x2 - bne _0801B938 - movs r1, 0xD5 - lsls r1, 6 - adds r0, r2, r1 - ldrh r0, [r0, 0x4] - b _0801B93A - .pool -_0801B8F4: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x000033f0 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801B938 - bl sub_801B4CC - lsls r0, 16 - lsrs r0, 16 - b _0801B93A - .pool -_0801B918: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x000033f0 - adds r2, r0, r1 - ldrb r1, [r2, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801B938 - ldrb r0, [r2, 0x9] - b _0801B93A - .pool -_0801B938: - movs r0, 0 -_0801B93A: - pop {r1} - bx r1 - thumb_func_end mevent_081445C0 - - thumb_func_start sub_801B940 -sub_801B940: @ 801B940 - ldr r1, =gUnknown_02022C70 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_801B940 - - thumb_func_start sub_801B94C -sub_801B94C: @ 801B94C - push {r4,r5,lr} - lsls r0, 16 - lsrs r0, 16 - adds r4, r0, 0 - ldr r5, =gUnknown_02022C70 - movs r0, 0 - str r0, [r5] - cmp r4, 0 - beq _0801B98A - bl sub_801B27C - cmp r0, 0 - beq _0801B988 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x000033f0 - adds r0, r1 - ldrh r0, [r0] - cmp r0, r4 - bne _0801B988 - movs r0, 0x1 - str r0, [r5] - b _0801B98A - .pool -_0801B988: - movs r0, 0 -_0801B98A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801B94C - - thumb_func_start sub_801B990 -sub_801B990: @ 801B990 - push {lr} - adds r2, r0, 0 - ldr r0, =gUnknown_02022C70 - ldr r0, [r0] - cmp r0, 0 - beq _0801B9EC - cmp r2, 0x1 - beq _0801B9DC - cmp r2, 0x1 - bcc _0801B9C0 - cmp r2, 0x2 - bne _0801B9EC - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r0, =0x00003584 - adds r2, r0 - movs r0, 0x2 - b _0801B9CA - .pool -_0801B9C0: - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r0, =0x00003570 - adds r2, r0 - movs r0, 0 -_0801B9CA: - movs r3, 0x5 - bl sub_801BA8C - b _0801B9EC - .pool -_0801B9DC: - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r0, =0x00003570 - adds r2, r0 - movs r0, 0x1 - movs r3, 0x5 - bl sub_801BA8C -_0801B9EC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B990 - - thumb_func_start sub_801B9F8 -sub_801B9F8: @ 801B9F8 - push {lr} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x00003570 - adds r1, r0 - ldr r2, =0x0500000a - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_801B9F8 - - thumb_func_start sub_801BA24 -sub_801BA24: @ 801BA24 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r1, 0 - cmp r1, r2 - bge _0801BA46 - ldr r0, [r4] - cmp r0, r5 - beq _0801BA46 - adds r3, r4, 0 -_0801BA38: - adds r3, 0x4 - adds r1, 0x1 - cmp r1, r2 - bge _0801BA46 - ldr r0, [r3] - cmp r0, r5 - bne _0801BA38 -_0801BA46: - cmp r1, r2 - bne _0801BA68 - subs r3, r1, 0x1 - cmp r3, 0 - ble _0801BA62 - lsls r0, r3, 2 - subs r0, 0x4 - adds r2, r0, r4 -_0801BA56: - ldr r0, [r2] - str r0, [r2, 0x4] - subs r2, 0x4 - subs r3, 0x1 - cmp r3, 0 - bgt _0801BA56 -_0801BA62: - str r5, [r4] - movs r0, 0x1 - b _0801BA84 -_0801BA68: - adds r3, r1, 0 - cmp r3, 0 - ble _0801BA80 - lsls r0, r3, 2 - subs r0, 0x4 - adds r2, r0, r4 -_0801BA74: - ldr r0, [r2] - str r0, [r2, 0x4] - subs r2, 0x4 - subs r3, 0x1 - cmp r3, 0 - bgt _0801BA74 -_0801BA80: - str r5, [r4] - movs r0, 0 -_0801BA84: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801BA24 - - thumb_func_start sub_801BA8C -sub_801BA8C: @ 801BA8C - push {r4,lr} - adds r4, r0, 0 - adds r0, r1, 0 - adds r1, r2, 0 - adds r2, r3, 0 - bl sub_801BA24 - cmp r0, 0 - beq _0801BAA4 - adds r0, r4, 0 - bl sub_801B7D8 -_0801BAA4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801BA8C - - thumb_func_start sub_801BAAC -sub_801BAAC: @ 801BAAC - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - cmp r5, 0 - beq _0801BAC8 - cmp r6, 0 - beq _0801BAC8 - ldr r7, =gUnknown_02022C74 - ldr r0, =0x0000145c - bl AllocZeroed - str r0, [r7] - cmp r0, 0 - bne _0801BAD4 -_0801BAC8: - movs r0, 0 - b _0801BB3E - .pool -_0801BAD4: - movs r4, 0xA6 - lsls r4, 1 - adds r1, r5, 0 - adds r2, r4, 0 - bl memcpy - ldr r1, [r7] - adds r1, r4 - adds r0, r6, 0 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r2, [r7] - ldrb r1, [r2, 0x8] - lsls r0, r1, 26 - lsrs r0, 28 - cmp r0, 0x7 - bls _0801BB06 - movs r0, 0x3D - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x8] -_0801BB06: - ldr r2, [r7] - ldrb r1, [r2, 0x8] - lsls r0, r1, 30 - lsrs r0, 30 - cmp r0, 0x2 - bls _0801BB1A - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x8] -_0801BB1A: - ldr r1, [r7] - ldrb r0, [r1, 0x9] - cmp r0, 0x7 - bls _0801BB26 - movs r0, 0 - strb r0, [r1, 0x9] -_0801BB26: - ldr r0, [r7] - movs r1, 0xB8 - lsls r1, 1 - adds r2, r0, r1 - ldrb r0, [r0, 0x8] - lsls r0, 26 - lsrs r0, 28 - lsls r0, 4 - ldr r1, =gUnknown_082F1D60 - adds r0, r1 - str r0, [r2] - movs r0, 0x1 -_0801BB3E: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801BAAC - - thumb_func_start sub_801BB48 -sub_801BB48: @ 801BB48 - push {r4,lr} - ldr r4, =gUnknown_02022C74 - ldr r0, [r4] - cmp r0, 0 - beq _0801BB64 - ldr r2, =0x0000145c - movs r1, 0 - bl memset - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801BB64: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801BB48 - - thumb_func_start sub_801BB74 -sub_801BB74: @ 801BB74 - push {r4-r6,lr} - sub sp, 0x24 - ldr r5, =gUnknown_02022C74 - ldr r0, [r5] - cmp r0, 0 - bne _0801BB8C - movs r0, 0x1 - negs r0, r0 - b _0801BD98 - .pool -_0801BB8C: - movs r4, 0xBA - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x7 - bls _0801BB9A - b _0801BD70 -_0801BB9A: - lsls r0, 2 - ldr r1, =_0801BBA8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801BBA8: - .4byte _0801BBC8 - .4byte _0801BBDA - .4byte _0801BBE8 - .4byte _0801BC8C - .4byte _0801BD14 - .4byte _0801BD1A - .4byte _0801BD34 - .4byte _0801BD3A -_0801BBC8: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0801BD86 -_0801BBDA: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0801BBE6 - b _0801BD86 -_0801BBE6: - b _0801BD96 -_0801BBE8: - movs r5, 0x1E - str r5, [sp] - movs r4, 0x14 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - ldr r5, =gUnknown_02022C74 - ldr r0, [r5] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0, 0x4] - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0x8 - bl decompress_and_copy_tile_data_to_vram - ldr r4, =gUnknown_082F0E1C - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - movs r2, 0xBB - lsls r2, 1 - adds r1, r2 - strh r0, [r1] - adds r0, r4, 0 - adds r0, 0x8 - bl AddWindow - ldr r1, [r5] - movs r2, 0xBC - lsls r2, 1 - adds r1, r2 - strh r0, [r1] - adds r4, 0x10 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - movs r2, 0xBD - lsls r2, 1 - adds r1, r2 - strh r0, [r1] - b _0801BD86 - .pool -_0801BC8C: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _0801BC9A - b _0801BD96 -_0801BC9A: - movs r0, 0x1 - bl stdpal_get - movs r1, 0x20 - movs r2, 0x20 - bl LoadPalette - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r5, =gUnknown_02022C74 - ldr r0, [r5] - movs r4, 0xB8 - lsls r4, 1 - adds r0, r4 - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - ldr r1, [r5] - adds r4, r1, r4 - ldr r0, [r4] - ldr r0, [r0, 0x8] - ldr r4, =0x0000045c - adds r1, r4 - bl LZ77UnCompWram - ldr r1, [r5] - adds r1, r4 - movs r2, 0x1E - str r2, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - str r6, [sp, 0x8] - str r6, [sp, 0xC] - str r2, [sp, 0x10] - str r0, [sp, 0x14] - movs r0, 0x1 - str r0, [sp, 0x18] - movs r0, 0x8 - str r0, [sp, 0x1C] - str r6, [sp, 0x20] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _0801BD86 - .pool -_0801BD14: - bl sub_801BEF8 - b _0801BD86 -_0801BD1A: - movs r0, 0 - bl sub_801C178 - movs r0, 0x1 - bl sub_801C178 - movs r0, 0x2 - bl sub_801C178 - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - b _0801BD86 -_0801BD34: - bl sub_80D2F04 - b _0801BD86 -_0801BD3A: - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - bl sub_801C4C0 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - bl UpdatePaletteFade - b _0801BD86 - .pool -_0801BD70: - bl UpdatePaletteFade - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0801BD96 - ldr r0, [r5] - adds r0, r4 - strb r1, [r0] - movs r0, 0x1 - b _0801BD98 -_0801BD86: - ldr r0, =gUnknown_02022C74 - ldr r1, [r0] - movs r0, 0xBA - lsls r0, 1 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0801BD96: - movs r0, 0 -_0801BD98: - add sp, 0x24 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801BB74 - - thumb_func_start sub_801BDA4 -sub_801BDA4: @ 801BDA4 - push {r4,r5,lr} - sub sp, 0x8 - adds r2, r0, 0 - ldr r5, =gUnknown_02022C74 - ldr r0, [r5] - cmp r0, 0 - bne _0801BDBC - movs r0, 0x1 - negs r0, r0 - b _0801BEEC - .pool -_0801BDBC: - movs r4, 0xBA - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x5 - bls _0801BDCA - b _0801BEC4 -_0801BDCA: - lsls r0, 2 - ldr r1, =_0801BDD8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801BDD8: - .4byte _0801BDF0 - .4byte _0801BE02 - .4byte _0801BE0E - .4byte _0801BE56 - .4byte _0801BE94 - .4byte _0801BE9E -_0801BDF0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0801BEDA -_0801BE02: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0801BEDA - b _0801BEEA -_0801BE0E: - movs r5, 0x1E - str r5, [sp] - movs r4, 0x14 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _0801BEDA -_0801BE56: - movs r0, 0x1 - bl HideBg - movs r0, 0x2 - bl HideBg - ldr r4, =gUnknown_02022C74 - ldr r0, [r4] - movs r1, 0xBD - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r4] - movs r1, 0xBC - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r4] - movs r1, 0xBB - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - b _0801BEDA - .pool -_0801BE94: - bl sub_801C61C - bl sub_80D2F9C - b _0801BEDA -_0801BE9E: - ldr r0, =gUnknown_02022C60 - ldrb r0, [r0] - adds r1, r2, 0 - bl sub_80186EC - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _0801BEDA - .pool -_0801BEC4: - bl UpdatePaletteFade - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0801BEEA - ldr r0, [r5] - adds r0, r4 - strb r1, [r0] - movs r0, 0x1 - b _0801BEEC -_0801BEDA: - ldr r0, =gUnknown_02022C74 - ldr r1, [r0] - movs r0, 0xBA - lsls r0, 1 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0801BEEA: - movs r0, 0 -_0801BEEC: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801BDA4 - - thumb_func_start sub_801BEF8 -sub_801BEF8: @ 801BEF8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - movs r5, 0 - mov r0, sp - movs r1, 0 - movs r2, 0x6 - bl memset - ldr r4, =gUnknown_02022C74 - ldr r1, [r4] - ldr r2, =0x0000018b - adds r0, r1, r2 - adds r1, 0xA - movs r2, 0x28 - bl memcpy - ldr r0, [r4] - ldr r3, =0x000001b3 - adds r1, r0, r3 - movs r0, 0xFF - strb r0, [r1] - ldr r1, [r4] - movs r2, 0xDA - lsls r2, 1 - adds r0, r1, r2 - adds r1, 0x32 - movs r2, 0x28 - bl memcpy - ldr r0, [r4] - movs r3, 0xEE - lsls r3, 1 - adds r0, r3 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - ldr r1, [r4] - ldr r0, [r1, 0x4] - ldr r2, =0x000f423f - cmp r0, r2 - bls _0801BF54 - str r2, [r1, 0x4] -_0801BF54: - ldr r1, [r4] - ldr r2, =0x000001dd - adds r0, r1, r2 - ldr r1, [r1, 0x4] - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - adds r6, r4, 0 -_0801BF66: - ldr r2, [r6] - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r4, r1, r5 - adds r0, r4, r2 - movs r3, 0xF2 - lsls r3, 1 - adds r0, r3 - adds r1, r2 - adds r1, 0x5A - movs r2, 0x28 - bl memcpy - ldr r1, [r6] - movs r0, 0x83 - lsls r0, 2 - adds r1, r0 - adds r1, r4 - movs r2, 0x1 - negs r2, r2 - adds r7, r2, 0 - movs r0, 0xFF - strb r0, [r1] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x3 - bls _0801BF66 - ldr r6, =gUnknown_02022C74 - ldr r1, [r6] - movs r3, 0xA2 - lsls r3, 2 - adds r0, r1, r3 - adds r1, 0xFA - movs r2, 0x28 - bl memcpy - ldr r0, [r6] - movs r4, 0xAC - lsls r4, 2 - adds r0, r4 - movs r1, 0x1 - negs r1, r1 - adds r4, r1, 0 - movs r1, 0xFF - strb r1, [r0] - ldr r1, [r6] - ldrb r0, [r1, 0x8] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - beq _0801C018 - cmp r0, 0x1 - bgt _0801BFF0 - cmp r0, 0 - beq _0801BFF6 - b _0801C168 - .pool -_0801BFF0: - cmp r0, 0x2 - beq _0801C028 - b _0801C168 -_0801BFF6: - ldr r2, =0x000002b1 - adds r0, r1, r2 - movs r3, 0x91 - lsls r3, 1 - adds r1, r3 - movs r2, 0x28 - bl memcpy - ldr r1, [r6] - ldr r0, =0x000002d9 - adds r1, r0 - b _0801C01C - .pool -_0801C018: - ldr r2, =0x000002b1 - adds r1, r2 -_0801C01C: - ldrb r0, [r1] - orrs r0, r4 - strb r0, [r1] - b _0801C168 - .pool -_0801C028: - ldr r3, =0x000002b1 - adds r0, r1, r3 - ldrb r1, [r0] - orrs r1, r7 - strb r1, [r0] - mov r3, sp - ldr r1, [r6] - movs r4, 0xA6 - lsls r4, 1 - adds r0, r1, r4 - ldrh r0, [r0] - ldr r2, =0x000003e7 - cmp r0, r2 - bls _0801C046 - adds r0, r2, 0 -_0801C046: - strh r0, [r3] - mov r3, sp - movs r4, 0xA7 - lsls r4, 1 - adds r0, r1, r4 - ldrh r0, [r0] - cmp r0, r2 - bls _0801C058 - adds r0, r2, 0 -_0801C058: - strh r0, [r3, 0x2] - mov r3, sp - movs r4, 0xA8 - lsls r4, 1 - adds r0, r1, r4 - ldrh r0, [r0] - cmp r0, r2 - bls _0801C06A - adds r0, r2, 0 -_0801C06A: - strh r0, [r3, 0x4] - movs r5, 0 -_0801C06E: - lsls r4, r5, 1 - adds r4, r5 - lsls r4, 4 - movs r0, 0xB7 - lsls r0, 2 - adds r4, r0 - ldr r0, [r6] - adds r0, r4 - adds r0, 0x2A - movs r1, 0xFF - movs r2, 0x4 - bl memset - ldr r0, [r6] - adds r0, r4 - adds r0, 0x1 - movs r1, 0xFF - movs r2, 0x29 - bl memset - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x7 - bls _0801C06E - movs r5, 0 - movs r6, 0 - ldr r1, =gUnknown_02022C74 - mov r8, r1 - movs r2, 0x91 - lsls r2, 1 - mov r10, r2 - ldr r7, =0x00000175 - movs r3, 0xB7 - lsls r3, 2 - mov r9, r3 -_0801C0B6: - mov r4, r8 - ldr r2, [r4] - mov r0, r10 - adds r1, r2, r0 - adds r0, r1, r5 - ldrb r3, [r0] - cmp r3, 0xF7 - beq _0801C0F8 - ldr r1, =0x00000175 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 4 - adds r0, r6, r0 - ldr r4, =0x000002dd - adds r1, r2, r4 - adds r1, r0 - strb r3, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - b _0801C15E - .pool -_0801C0F8: - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - cmp r3, 0x2 - bls _0801C108 - adds r0, r5, 0x2 - lsls r0, 16 - b _0801C15C -_0801C108: - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 4 - add r0, r9 - adds r0, r2, r0 - adds r0, 0x2A - lsls r1, r3, 1 - add r1, sp - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - mov r0, r8 - ldr r1, [r0] - adds r0, r1, r7 - ldrb r2, [r0] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 4 - adds r0, r1, r0 - adds r4, r5, 0x2 - add r1, r10 - adds r1, r4 - ldrb r1, [r1] - add r0, r9 - strb r1, [r0] - mov r2, r8 - ldr r1, [r2] - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r2] - adds r0, r7 - ldrb r0, [r0] - cmp r0, 0x7 - bhi _0801C168 - movs r6, 0 - lsls r0, r4, 16 -_0801C15C: - lsrs r5, r0, 16 -_0801C15E: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x27 - bls _0801C0B6 -_0801C168: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801BEF8 - - thumb_func_start sub_801C178 -sub_801C178: @ 801C178 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r4, r0, 24 - mov r8, r4 - movs r0, 0 - str r0, [sp, 0xC] - ldr r7, =gUnknown_02022C74 - ldr r0, [r7] - lsls r1, r4, 1 - movs r2, 0xBB - lsls r2, 1 - adds r0, r2 - adds r0, r1 - ldrh r0, [r0] - lsls r6, r0, 24 - lsrs r5, r6, 24 - adds r0, r5, 0 - bl PutWindowTilemap - adds r0, r5, 0 - movs r1, 0 - bl FillWindowPixelBuffer - cmp r4, 0x1 - beq _0801C2A0 - cmp r4, 0x1 - bgt _0801C1C4 - cmp r4, 0 - beq _0801C1D0 - mov r9, r6 - b _0801C498 - .pool -_0801C1C4: - mov r0, r8 - cmp r0, 0x2 - bne _0801C1CC - b _0801C304 -_0801C1CC: - mov r9, r6 - b _0801C498 -_0801C1D0: - ldr r2, [r7] - movs r1, 0xB8 - lsls r1, 1 - mov r10, r1 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 28 - lsrs r0, 28 - lsls r1, r0, 1 - adds r1, r0 - ldr r0, =gUnknown_082F0E10 - mov r8, r0 - add r1, r8 - str r1, [sp] - ldr r1, [sp, 0xC] - str r1, [sp, 0x4] - ldr r0, =0x0000018b - adds r2, r0 - str r2, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x3 - movs r2, 0 - movs r3, 0x1 - bl box_print - ldr r4, [r7] - movs r1, 0xDA - lsls r1, 1 - mov r9, r1 - add r4, r9 - movs r0, 0x3 - movs r1, 0x2 - bl GetFontAttribute - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x3 - adds r1, r4, 0 - bl GetStringWidth - movs r1, 0xA0 - subs r1, r0 - cmp r1, 0 - bge _0801C22E - movs r1, 0 -_0801C22E: - lsls r2, r1, 24 - lsrs r2, 24 - ldr r3, [r7] - mov r1, r10 - adds r0, r3, r1 - ldr r0, [r0] - ldrb r1, [r0] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - add r0, r8 - str r0, [sp] - ldr r0, [sp, 0xC] - str r0, [sp, 0x4] - add r3, r9 - str r3, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x3 - movs r3, 0x11 - bl box_print - ldr r2, [r7] - ldr r0, [r2, 0x4] - mov r9, r6 - cmp r0, 0 - bne _0801C266 - b _0801C498 -_0801C266: - mov r1, r10 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r1, [r0] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - add r0, r8 - str r0, [sp] - ldr r0, [sp, 0xC] - str r0, [sp, 0x4] - ldr r1, =0x000001dd - adds r0, r2, r1 - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x1 - movs r2, 0xA6 - movs r3, 0x11 - bl box_print - b _0801C498 - .pool -_0801C2A0: - mov r9, r6 -_0801C2A2: - ldr r2, [sp, 0xC] - lsls r4, r2, 24 - asrs r4, 24 - lsls r3, r4, 4 - adds r3, 0x2 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gUnknown_02022C74 - ldr r2, [r0] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r0, [r0] - lsrs r0, 4 - lsls r1, r0, 1 - adds r1, r0 - ldr r0, =gUnknown_082F0E10 - adds r1, r0 - str r1, [sp] - movs r0, 0 - str r0, [sp, 0x4] - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r4 - movs r1, 0xF2 - lsls r1, 1 - adds r0, r1 - adds r2, r0 - str r2, [sp, 0x8] - mov r2, r9 - lsrs r0, r2, 24 - movs r1, 0x3 - movs r2, 0 - bl box_print - adds r4, 0x1 - lsls r4, 24 - lsrs r0, r4, 24 - str r0, [sp, 0xC] - asrs r4, 24 - cmp r4, 0x3 - ble _0801C2A2 - b _0801C498 - .pool -_0801C304: - ldr r4, =gUnknown_082F0E18 - ldr r2, [r7] - ldrb r0, [r2, 0x8] - lsls r0, 30 - lsrs r0, 30 - adds r0, r4 - ldrb r3, [r0] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - lsls r0, 28 - lsrs r0, 28 - lsls r1, r0, 1 - adds r1, r0 - ldr r0, =gUnknown_082F0E10 - mov r10, r0 - add r1, r10 - str r1, [sp] - ldr r1, [sp, 0xC] - str r1, [sp, 0x4] - movs r1, 0xA2 - lsls r1, 2 - adds r0, r2, r1 - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x3 - movs r2, 0 - bl box_print - ldr r2, [r7] - ldrb r1, [r2, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x2 - beq _0801C398 - lsls r0, r1, 30 - lsrs r0, 30 - adds r0, r4 - ldrb r3, [r0] - adds r3, 0x10 - lsls r3, 24 - lsrs r3, 24 - movs r1, 0xB8 - lsls r1, 1 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - add r0, r10 - str r0, [sp] - ldr r0, [sp, 0xC] - str r0, [sp, 0x4] - ldr r1, =0x000002b1 - adds r0, r2, r1 - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x3 - movs r2, 0 - bl box_print - mov r9, r6 - b _0801C498 - .pool -_0801C398: - movs r2, 0 - mov r8, r2 - lsls r0, r1, 30 - lsrs r0, 30 - adds r0, r4 - ldrb r0, [r0] - adds r4, r0, 0 - adds r4, 0x10 - movs r0, 0x3 - movs r1, 0x2 - bl GetFontAttribute - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, [r7] - ldr r1, =0x00000175 - adds r0, r1 - mov r9, r6 - ldr r1, [sp, 0xC] - ldrb r0, [r0] - cmp r1, r0 - bge _0801C498 - str r5, [sp, 0x10] - lsls r0, r4, 24 - lsrs r0, 24 - str r0, [sp, 0x14] - mov r10, r2 -_0801C3CE: - mov r0, r8 - lsls r2, r0, 24 - lsrs r2, 24 - ldr r3, [r7] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r3, r1 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - ldr r1, =gUnknown_082F0E10 - adds r0, r1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - ldr r1, [sp, 0xC] - lsls r0, r1, 24 - asrs r6, r0, 24 - lsls r0, r6, 1 - adds r0, r6 - lsls r5, r0, 4 - movs r0, 0xB7 - lsls r0, 2 - adds r4, r5, r0 - adds r3, r4 - adds r3, 0x1 - str r3, [sp, 0x8] - ldr r0, [sp, 0x10] - movs r1, 0x3 - ldr r3, [sp, 0x14] - bl box_print - ldr r1, [r7] - adds r0, r1, r5 - ldr r2, =0x00000306 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0xFF - beq _0801C482 - adds r1, r4 - adds r1, 0x1 - movs r0, 0x3 - mov r2, r10 - bl GetStringWidth - add r8, r0 - mov r0, r8 - lsls r2, r0, 24 - lsrs r2, 24 - ldr r3, [r7] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r3, r1 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - ldr r1, =gUnknown_082F0E10 - adds r0, r1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - adds r3, r4 - adds r3, 0x2A - str r3, [sp, 0x8] - ldr r0, [sp, 0x10] - movs r1, 0x3 - ldr r3, [sp, 0x14] - bl box_print - ldr r1, [r7] - adds r1, r4 - adds r1, 0x2A - movs r0, 0x3 - mov r2, r10 - bl GetStringWidth - ldr r1, [r7] - adds r1, r5 - movs r2, 0xB7 - lsls r2, 2 - adds r1, r2 - ldrb r1, [r1] - adds r0, r1 - add r8, r0 -_0801C482: - adds r1, r6, 0x1 - lsls r1, 24 - lsrs r0, r1, 24 - str r0, [sp, 0xC] - asrs r1, 24 - ldr r0, [r7] - ldr r2, =0x00000175 - adds r0, r2 - ldrb r0, [r0] - cmp r1, r0 - blt _0801C3CE -_0801C498: - mov r1, r9 - lsrs r0, r1, 24 - movs r1, 0x3 - bl CopyWindowToVram - 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 sub_801C178 - - thumb_func_start sub_801C4C0 -sub_801C4C0: @ 801C4C0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - movs r7, 0 - ldr r4, =gUnknown_02022C74 - ldr r0, [r4] - movs r1, 0xBE - lsls r1, 1 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r4] - movs r2, 0xA9 - lsls r2, 1 - adds r1, r0, r2 - ldrh r0, [r1] - cmp r0, 0 - beq _0801C52C - bl sub_80D2E84 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =SpriteCallbackDummy - str r7, [sp] - str r7, [sp, 0x4] - movs r2, 0xDC - movs r3, 0x14 - bl sub_80D2D78 - ldr r1, [r4] - movs r2, 0xBE - lsls r2, 1 - adds r1, r2 - strb r0, [r1] - ldr r2, =gSprites - ldr r0, [r4] - movs r1, 0xBE - lsls r1, 1 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r2, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - movs r2, 0x8 - orrs r1, r2 - strb r1, [r0, 0x5] -_0801C52C: - ldr r1, [r4] - ldrb r0, [r1, 0x9] - cmp r0, 0 - beq _0801C5EE - ldrb r1, [r1, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801C5EE - ldr r0, =gUnknown_082F1D00 - bl LoadCompressedObjectPicUsingHeap - ldr r0, [r4] - movs r2, 0xB8 - lsls r2, 1 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - lsrs r0, 4 - lsls r0, 3 - ldr r1, =gUnknown_082F1D08 - adds r0, r1 - bl LoadSpritePalette - ldr r0, [r4] - ldrb r0, [r0, 0x9] - cmp r7, r0 - bcs _0801C5EE - adds r6, r4, 0 - ldr r0, =0x0000017d - mov r10, r0 - movs r1, 0 - mov r9, r1 - movs r2, 0xFF - mov r8, r2 -_0801C572: - ldr r1, [r6] - lsls r4, r7, 1 - add r1, r10 - adds r1, r4 - ldrb r0, [r1] - mov r2, r8 - orrs r0, r2 - strb r0, [r1] - ldr r1, [r6] - movs r0, 0xBF - lsls r0, 1 - adds r1, r0 - adds r1, r4 - ldrb r0, [r1] - orrs r0, r2 - strb r0, [r1] - lsls r1, r7, 5 - movs r0, 0xD8 - subs r5, r0, r1 - ldr r0, =gUnknown_082F1D48 - adds r1, r5, 0 - movs r2, 0x90 - movs r3, 0x8 - bl CreateSprite - ldr r1, [r6] - add r1, r10 - adds r1, r4 - strb r0, [r1] - ldr r0, [r6] - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - adds r1, r0, r4 - ldrh r0, [r1] - cmp r0, 0 - beq _0801C5E0 - bl sub_80D2E84 - lsls r0, 16 - lsrs r0, 16 - mov r2, r9 - str r2, [sp] - str r2, [sp, 0x4] - ldr r1, =SpriteCallbackDummy - adds r2, r5, 0 - movs r3, 0x88 - bl sub_80D2D78 - ldr r1, [r6] - movs r2, 0xBF - lsls r2, 1 - adds r1, r2 - adds r1, r4 - strb r0, [r1] -_0801C5E0: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, [r6] - ldrb r0, [r0, 0x9] - cmp r7, r0 - bcc _0801C572 -_0801C5EE: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801C4C0 - - thumb_func_start sub_801C61C -sub_801C61C: @ 801C61C - push {r4-r7,lr} - movs r5, 0 - ldr r4, =gUnknown_02022C74 - ldr r0, [r4] - movs r2, 0xBE - lsls r2, 1 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801C640 - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl sub_80D2EF8 -_0801C640: - ldr r0, [r4] - ldrb r2, [r0, 0x9] - cmp r2, 0 - beq _0801C6B4 - ldrb r1, [r0, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801C6B4 - cmp r5, r2 - bcs _0801C6A4 - adds r6, r4, 0 - ldr r7, =gSprites -_0801C65A: - ldr r0, [r6] - lsls r4, r5, 1 - ldr r1, =0x0000017d - adds r0, r1 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801C678 - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - bl DestroySprite -_0801C678: - ldr r0, [r6] - movs r2, 0xBF - lsls r2, 1 - adds r0, r2 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801C696 - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - bl sub_80D2EF8 -_0801C696: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, [r6] - ldrb r0, [r0, 0x9] - cmp r5, r0 - bcc _0801C65A -_0801C6A4: - movs r4, 0x80 - lsls r4, 8 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag -_0801C6B4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801C61C - - thumb_func_start sub_801C6C8 -sub_801C6C8: @ 801C6C8 - push {r4-r6,lr} - adds r4, r0, 0 - cmp r4, 0 - beq _0801C6DE - ldr r5, =gUnknown_02022C78 - ldr r0, =0x000013a4 - bl AllocZeroed - str r0, [r5] - cmp r0, 0 - bne _0801C6EC -_0801C6DE: - movs r0, 0 - b _0801C71C - .pool -_0801C6EC: - movs r6, 0xDE - lsls r6, 1 - adds r1, r4, 0 - adds r2, r6, 0 - bl memcpy - ldr r1, [r5] - ldrb r0, [r1, 0x3] - cmp r0, 0x7 - bls _0801C704 - movs r0, 0 - strb r0, [r1, 0x3] -_0801C704: - ldr r2, [r5] - adds r3, r2, r6 - ldrb r0, [r2, 0x3] - lsls r0, 4 - ldr r1, =gUnknown_082F24C8 - adds r0, r1 - str r0, [r3] - ldr r0, =0x000001c1 - adds r1, r2, r0 - movs r0, 0xFF - strb r0, [r1] - movs r0, 0x1 -_0801C71C: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801C6C8 - - thumb_func_start sub_801C72C -sub_801C72C: @ 801C72C - push {r4,lr} - ldr r4, =gUnknown_02022C78 - ldr r0, [r4] - cmp r0, 0 - beq _0801C748 - ldr r2, =0x000013a4 - movs r1, 0 - bl memset - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801C748: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801C72C - - thumb_func_start sub_801C758 -sub_801C758: @ 801C758 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - ldr r5, =gUnknown_02022C78 - ldr r0, [r5] - cmp r0, 0 - bne _0801C778 - movs r0, 0x1 - negs r0, r0 - b _0801CA3A - .pool -_0801C778: - movs r4, 0xE0 - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - lsrs r0, 1 - cmp r0, 0x6 - bls _0801C788 - b _0801CA04 -_0801C788: - lsls r0, 2 - ldr r1, =_0801C798 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801C798: - .4byte _0801C7B4 - .4byte _0801C7C6 - .4byte _0801C82C - .4byte _0801C8D4 - .4byte _0801C990 - .4byte _0801C996 - .4byte _0801C9A8 -_0801C7B4: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0801CA1E -_0801C7C6: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0801C7D2 - b _0801CA38 -_0801C7D2: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x40 - movs r1, 0xF0 - bl SetGpuReg - ldr r1, =0x00001a98 - movs r0, 0x44 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x1F - bl SetGpuReg - movs r0, 0x4A - movs r1, 0x1B - bl SetGpuReg - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl SetGpuRegBits - b _0801CA1E - .pool -_0801C82C: - movs r5, 0x1E - str r5, [sp] - movs r4, 0x14 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r5, =gUnknown_02022C78 - ldr r0, [r5] - movs r1, 0xDE - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0, 0x4] - movs r0, 0 - str r0, [sp] - movs r0, 0x3 - movs r2, 0 - movs r3, 0x8 - bl decompress_and_copy_tile_data_to_vram - ldr r4, =gUnknown_082F1DE8 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - movs r2, 0xE4 - lsls r2, 1 - adds r1, r2 - strh r0, [r1] - adds r4, 0x8 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - movs r3, 0xE5 - lsls r3, 1 - adds r1, r3 - strh r0, [r1] - b _0801CA1E - .pool -_0801C8D4: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0 - beq _0801C8E2 - b _0801CA38 -_0801C8E2: - movs r0, 0x1 - bl stdpal_get - movs r1, 0x20 - movs r2, 0x20 - bl LoadPalette - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r0, =gUnknown_02022C78 - mov r8, r0 - ldr r0, [r0] - movs r4, 0xDE - lsls r4, 1 - adds r0, r4 - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - mov r2, r8 - ldr r1, [r2] - adds r4, r1, r4 - ldr r0, [r4] - ldr r0, [r0, 0x8] - movs r6, 0xE9 - lsls r6, 2 - adds r1, r6 - bl LZ77UnCompWram - mov r3, r8 - ldr r1, [r3] - adds r1, r6 - movs r4, 0x1E - str r4, [sp] - movs r5, 0x3 - str r5, [sp, 0x4] - str r7, [sp, 0x8] - str r7, [sp, 0xC] - str r4, [sp, 0x10] - str r5, [sp, 0x14] - movs r0, 0x1 - mov r10, r0 - str r0, [sp, 0x18] - movs r2, 0x8 - mov r9, r2 - str r2, [sp, 0x1C] - str r7, [sp, 0x20] - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - mov r3, r8 - ldr r1, [r3] - adds r1, r6 - str r4, [sp] - movs r0, 0x17 - str r0, [sp, 0x4] - str r7, [sp, 0x8] - str r5, [sp, 0xC] - str r4, [sp, 0x10] - str r0, [sp, 0x14] - mov r0, r10 - str r0, [sp, 0x18] - mov r2, r9 - str r2, [sp, 0x1C] - str r7, [sp, 0x20] - movs r0, 0x3 - movs r2, 0 - movs r3, 0x3 - bl CopyRectToBgTilemapBufferRect - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _0801CA1E - .pool -_0801C990: - bl sub_801CDCC - b _0801CA1E -_0801C996: - bl sub_801CE7C - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _0801CA1E -_0801C9A8: - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - ldr r4, =gUnknown_02022C78 - ldr r1, [r4] - movs r3, 0xE5 - lsls r3, 2 - adds r0, r1, r3 - movs r2, 0xE3 - lsls r2, 1 - adds r1, r2 - bl AddScrollIndicatorArrowPair - ldr r1, [r4] - ldr r3, =0x000001c1 - adds r2, r1, r3 - movs r1, 0 - strb r0, [r2] - movs r0, 0x1 - negs r0, r0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - bl UpdatePaletteFade - b _0801CA1E - .pool -_0801CA04: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0801CA38 - ldr r0, [r5] - adds r0, r4 - ldrb r2, [r0] - movs r1, 0x1 - ands r1, r2 - strb r1, [r0] - movs r0, 0x1 - b _0801CA3A -_0801CA1E: - ldr r0, =gUnknown_02022C78 - ldr r2, [r0] - movs r0, 0xE0 - lsls r0, 1 - adds r2, r0 - ldrb r3, [r2] - lsrs r1, r3, 1 - adds r1, 0x1 - lsls r1, 1 - movs r0, 0x1 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] -_0801CA38: - movs r0, 0 -_0801CA3A: - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801C758 - - thumb_func_start sub_801CA50 -sub_801CA50: @ 801CA50 - push {r4,r5,lr} - sub sp, 0x8 - adds r2, r0, 0 - ldr r5, =gUnknown_02022C78 - ldr r0, [r5] - cmp r0, 0 - bne _0801CA68 - movs r0, 0x1 - negs r0, r0 - b _0801CC2A - .pool -_0801CA68: - movs r4, 0xE0 - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - lsrs r0, 1 - cmp r0, 0x5 - bls _0801CA78 - b _0801CBF4 -_0801CA78: - lsls r0, 2 - ldr r1, =_0801CA88 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801CA88: - .4byte _0801CAA0 - .4byte _0801CAB2 - .4byte _0801CAF4 - .4byte _0801CB54 - .4byte _0801CB84 - .4byte _0801CBC0 -_0801CAA0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0801CC0E -_0801CAB2: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0801CABE - b _0801CC28 -_0801CABE: - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl ClearGpuRegBits - b _0801CC0E -_0801CAF4: - movs r4, 0x1E - str r4, [sp] - movs r5, 0x14 - str r5, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r5, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - movs r5, 0x18 - str r5, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r5, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _0801CC0E -_0801CB54: - movs r0, 0x1 - bl HideBg - movs r0, 0x2 - bl HideBg - ldr r4, =gUnknown_02022C78 - ldr r0, [r4] - movs r1, 0xE5 - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r4] - movs r2, 0xE4 - lsls r2, 1 - adds r0, r2 - ldrb r0, [r0] - bl RemoveWindow - b _0801CC0E - .pool -_0801CB84: - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - ldr r4, =gUnknown_02022C78 - ldr r0, [r4] - ldr r2, =0x000001c1 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801CC0E - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r2, =0x000001c1 - adds r1, r0, r2 - movs r0, 0xFF - strb r0, [r1] - b _0801CC0E - .pool -_0801CBC0: - ldr r0, =gUnknown_02022C60 - ldrb r0, [r0] - adds r1, r2, 0 - bl sub_80186EC - movs r0, 0x3 - bl sub_8018798 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _0801CC0E - .pool -_0801CBF4: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0801CC28 - ldr r0, [r5] - adds r0, r4 - ldrb r2, [r0] - movs r1, 0x1 - ands r1, r2 - strb r1, [r0] - movs r0, 0x1 - b _0801CC2A -_0801CC0E: - ldr r0, =gUnknown_02022C78 - ldr r2, [r0] - movs r0, 0xE0 - lsls r0, 1 - adds r2, r0 - ldrb r3, [r2] - lsrs r1, r3, 1 - adds r1, 0x1 - lsls r1, 1 - movs r0, 0x1 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] -_0801CC28: - movs r0, 0 -_0801CC2A: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801CA50 - - thumb_func_start sub_801CC38 -sub_801CC38: @ 801CC38 - push {r4,r5,lr} - ldr r4, =gUnknown_02022C78 - ldr r2, [r4] - movs r5, 0xE0 - lsls r5, 1 - adds r0, r2, r5 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801CC72 - ldr r0, =0x000001c1 - adds r1, r2, r0 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801CC72 - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r2, =0x000001c1 - adds r1, r0, r2 - movs r0, 0xFF - strb r0, [r1] - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - orrs r0, r2 - strb r0, [r1] -_0801CC72: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CC38 - - thumb_func_start sub_801CC80 -sub_801CC80: @ 801CC80 - push {r4,lr} - ldr r4, =gUnknown_02022C78 - ldr r2, [r4] - movs r1, 0xE0 - lsls r1, 1 - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801CCC0 - movs r3, 0xE5 - lsls r3, 2 - adds r0, r2, r3 - movs r3, 0xE3 - lsls r3, 1 - adds r1, r2, r3 - bl AddScrollIndicatorArrowPair - ldr r1, [r4] - ldr r2, =0x000001c1 - adds r1, r2 - strb r0, [r1] - ldr r1, [r4] - movs r3, 0xE0 - lsls r3, 1 - adds r1, r3 - ldrb r2, [r1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0801CCC0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CC80 - - thumb_func_start sub_801CCD0 -sub_801CCD0: @ 801CCD0 - push {r4-r6,lr} - lsls r0, 16 - lsrs r4, r0, 16 - adds r3, r4, 0 - ldr r2, =gUnknown_02022C78 - ldr r0, [r2] - mov r12, r0 - movs r0, 0xE1 - lsls r0, 1 - add r0, r12 - ldrb r1, [r0] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - adds r6, r2, 0 - cmp r0, 0 - beq _0801CD00 - bl sub_801CFA4 -_0801CCF6: - movs r0, 0xFF - b _0801CDC6 - .pool -_0801CD00: - cmp r4, 0x2 - beq _0801CD1C - cmp r4, 0x2 - bgt _0801CD0E - cmp r4, 0x1 - beq _0801CD18 - b _0801CCF6 -_0801CD0E: - cmp r3, 0x40 - beq _0801CD20 - cmp r3, 0x80 - beq _0801CD50 - b _0801CCF6 -_0801CD18: - movs r0, 0 - b _0801CDC6 -_0801CD1C: - movs r0, 0x1 - b _0801CDC6 -_0801CD20: - movs r0, 0xE3 - lsls r0, 1 - add r0, r12 - ldrh r0, [r0] - cmp r0, 0 - beq _0801CCF6 - movs r0, 0xE0 - lsls r0, 1 - add r0, r12 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _0801CCF6 - ldr r2, =0x000001c3 - add r2, r12 - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - b _0801CD7E - .pool -_0801CD50: - movs r0, 0xE3 - lsls r0, 1 - add r0, r12 - movs r1, 0xE2 - lsls r1, 1 - add r1, r12 - ldrh r0, [r0] - ldrh r1, [r1] - cmp r0, r1 - beq _0801CCF6 - movs r0, 0xE0 - lsls r0, 1 - add r0, r12 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _0801CCF6 - ldr r2, =0x000001c3 - add r2, r12 - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 -_0801CD7E: - strb r0, [r2] - ldr r2, [r6] - movs r4, 0xE1 - lsls r4, 1 - adds r2, r4 - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - ldr r3, [r6] - adds r3, r4 - ldrb r1, [r3] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - ldr r1, [r6] - adds r4, 0x1 - adds r1, r4 - ldrb r3, [r1] - adds r0, r2, 0 - ands r0, r3 - strb r0, [r1] - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - ands r2, r0 - cmp r2, 0 - beq _0801CDC4 - movs r0, 0x3 - b _0801CDC6 - .pool -_0801CDC4: - movs r0, 0x2 -_0801CDC6: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801CCD0 - - thumb_func_start sub_801CDCC -sub_801CDCC: @ 801CDCC - push {r4-r6,lr} - movs r5, 0 - ldr r4, =gUnknown_02022C78 - ldr r1, [r4] - movs r2, 0xE7 - lsls r2, 1 - adds r0, r1, r2 - adds r1, 0x4 - movs r2, 0x28 - bl memcpy - ldr r0, [r4] - movs r3, 0xFB - lsls r3, 1 - adds r1, r0, r3 - movs r0, 0xFF - strb r0, [r1] - adds r6, r4, 0 -_0801CDF0: - ldr r2, [r6] - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r4, r1, r5 - adds r0, r4, r2 - ldr r3, =0x000001f7 - adds r0, r3 - adds r1, r2 - adds r1, 0x2C - movs r2, 0x28 - bl memcpy - ldr r0, [r6] - ldr r1, =0x0000021f - adds r0, r1 - adds r0, r4 - movs r1, 0xFF - strb r1, [r0] - cmp r5, 0x7 - bls _0801CE34 - ldr r1, [r6] - ldr r2, =0x000001f7 - adds r0, r1, r2 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0xFF - beq _0801CE34 - movs r3, 0xE2 - lsls r3, 1 - adds r1, r3 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0801CE34: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x9 - bls _0801CDF0 - ldr r2, =gUnknown_02022C78 - ldr r1, [r2] - movs r4, 0xE5 - lsls r4, 2 - adds r1, r4 - ldr r0, =gUnknown_082F1DF8 - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldr r0, [r0] - str r0, [r1] - ldr r2, [r2] - movs r5, 0xE2 - lsls r5, 1 - adds r0, r2, r5 - ldrh r1, [r0] - movs r3, 0xE7 - lsls r3, 2 - adds r0, r2, r3 - strh r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CDCC - - thumb_func_start sub_801CE7C -sub_801CE7C: @ 801CE7C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - movs r5, 0 - ldr r6, =gUnknown_02022C78 - ldr r0, [r6] - movs r7, 0xE4 - lsls r7, 1 - adds r0, r7 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r6] - movs r4, 0xE5 - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r6] - adds r0, r7 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - ldr r4, [r6] - movs r0, 0xE7 - lsls r0, 1 - mov r8, r0 - add r4, r8 - movs r0, 0x3 - movs r1, 0x2 - bl GetFontAttribute - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x3 - adds r1, r4, 0 - bl GetStringWidth - movs r1, 0xE0 - subs r1, r0 - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - cmp r1, 0 - bge _0801CEEC - movs r1, 0 -_0801CEEC: - ldr r4, [r6] - adds r0, r4, r7 - ldrb r0, [r0] - lsls r2, r1, 24 - lsrs r2, 24 - movs r3, 0xDE - lsls r3, 1 - adds r1, r4, r3 - ldr r1, [r1] - ldrb r1, [r1] - lsls r1, 28 - lsrs r1, 28 - lsls r3, r1, 1 - adds r3, r1 - ldr r1, =gUnknown_082F1DE0 - adds r3, r1 - str r3, [sp] - str r5, [sp, 0x4] - add r4, r8 - str r4, [sp, 0x8] - movs r1, 0x3 - movs r3, 0x6 - bl box_print -_0801CF1C: - ldr r6, =gUnknown_02022C78 - ldr r4, [r6] - movs r1, 0xE5 - lsls r1, 1 - adds r0, r4, r1 - ldrb r0, [r0] - lsls r3, r5, 4 - adds r3, 0x2 - lsls r3, 24 - lsrs r3, 24 - movs r2, 0xDE - lsls r2, 1 - adds r1, r4, r2 - ldr r1, [r1] - ldrb r1, [r1] - lsrs r1, 4 - lsls r2, r1, 1 - adds r2, r1 - ldr r1, =gUnknown_082F1DE0 - adds r2, r1 - str r2, [sp] - movs r1, 0 - str r1, [sp, 0x4] - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r5 - ldr r2, =0x000001f7 - adds r1, r2 - adds r4, r1 - str r4, [sp, 0x8] - movs r1, 0x3 - movs r2, 0 - bl box_print - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x9 - bls _0801CF1C - ldr r0, [r6] - movs r3, 0xE4 - lsls r3, 1 - adds r0, r3 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, [r6] - movs r1, 0xE5 - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CE7C - - thumb_func_start sub_801CFA4 -sub_801CFA4: @ 801CFA4 - push {r4-r6,lr} - ldr r0, =gUnknown_02022C78 - ldr r1, [r0] - movs r2, 0xE1 - lsls r2, 1 - adds r0, r1, r2 - ldrb r0, [r0] - lsrs r4, r0, 1 - lsls r4, 8 - ldr r6, =0x000001c3 - adds r0, r1, r6 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801CFE4 - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x1 - bl ChangeBgY - movs r0, 0x3 - adds r1, r4, 0 - movs r2, 0x1 - bl ChangeBgY - b _0801CFF8 - .pool -_0801CFE4: - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x2 - bl ChangeBgY - movs r0, 0x3 - adds r1, r4, 0 - movs r2, 0x2 - bl ChangeBgY -_0801CFF8: - ldr r3, =gUnknown_02022C78 - ldr r0, [r3] - ldr r2, =0x000001c3 - adds r5, r0, r2 - ldrb r4, [r5] - lsrs r1, r4, 1 - movs r6, 0xE1 - lsls r6, 1 - adds r0, r6 - ldrb r0, [r0] - lsrs r0, 1 - adds r1, r0 - lsls r1, 1 - movs r6, 0x1 - adds r0, r6, 0 - ands r0, r4 - orrs r0, r1 - strb r0, [r5] - ldr r1, [r3] - adds r2, r1, r2 - ldrb r2, [r2] - lsrs r0, r2, 1 - cmp r0, 0xF - bls _0801D070 - adds r0, r6, 0 - ands r0, r2 - cmp r0, 0 - beq _0801D044 - movs r0, 0xE3 - lsls r0, 1 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - b _0801D04E - .pool -_0801D044: - movs r2, 0xE3 - lsls r2, 1 - adds r1, r2 - ldrh r0, [r1] - subs r0, 0x1 -_0801D04E: - strh r0, [r1] - ldr r0, [r3] - movs r6, 0xE1 - lsls r6, 1 - adds r2, r0, r6 - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldr r1, =0x000001c3 - adds r2, r0, r1 - ldrb r1, [r2] - movs r0, 0x1 - ands r0, r1 - strb r0, [r2] -_0801D070: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CFA4 - - thumb_func_start mevent_srv_init_wnews -mevent_srv_init_wnews: @ 801D07C - push {r4,lr} - ldr r4, =gUnknown_02022C7C - movs r0, 0x60 - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_082F298C - movs r2, 0 - movs r3, 0x1 - bl mevent_srv_init_common - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end mevent_srv_init_wnews - - thumb_func_start mevent_srv_new_wcard -mevent_srv_new_wcard: @ 801D0A0 - push {r4,lr} - ldr r4, =gUnknown_02022C7C - movs r0, 0x60 - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_082F29EC - movs r2, 0 - movs r3, 0x1 - bl mevent_srv_init_common - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end mevent_srv_new_wcard - - thumb_func_start sub_801D0C4 -sub_801D0C4: @ 801D0C4 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r4, =gUnknown_02022C7C - ldr r0, [r4] - cmp r0, 0 - bne _0801D0D8 - movs r0, 0x3 - b _0801D0F8 - .pool -_0801D0D8: - bl mevent_dispatch_08145600 - adds r5, r0, 0 - cmp r5, 0x3 - bne _0801D0F6 - ldr r0, [r4] - ldr r1, [r0, 0x4] - strh r1, [r6] - bl mevent_srv_free_resources - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801D0F6: - adds r0, r5, 0 -_0801D0F8: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801D0C4 - - thumb_func_start mevent_srv_init_common -mevent_srv_init_common: @ 801D100 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - adds r4, r0, 0 - adds r6, r1, 0 - mov r8, r2 - mov r9, r3 - movs r5, 0 - str r5, [r4] - str r5, [r4, 0x8] - movs r0, 0xA6 - lsls r0, 1 - bl AllocZeroed - str r0, [r4, 0x18] - movs r0, 0xDE - lsls r0, 1 - bl AllocZeroed - str r0, [r4, 0x1C] - movs r0, 0x80 - lsls r0, 3 - bl AllocZeroed - str r0, [r4, 0x14] - movs r0, 0x64 - bl AllocZeroed - str r0, [r4, 0x20] - str r6, [r4, 0x10] - str r5, [r4, 0xC] - adds r4, 0x38 - adds r0, r4, 0 - mov r1, r8 - mov r2, r9 - bl sub_801D8D8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end mevent_srv_init_common - - thumb_func_start mevent_srv_free_resources -mevent_srv_free_resources: @ 801D158 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x18] - bl Free - ldr r0, [r4, 0x1C] - bl Free - ldr r0, [r4, 0x14] - bl Free - ldr r0, [r4, 0x20] - bl Free - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_free_resources - - thumb_func_start mevent_srv_814501C -mevent_srv_814501C: @ 801D17C - push {lr} - adds r0, 0x38 - bl sub_801D904 - pop {r0} - bx r0 - thumb_func_end mevent_srv_814501C - - thumb_func_start sub_801D188 -sub_801D188: @ 801D188 - push {lr} - cmp r0, 0 - bne _0801D190 - adds r0, r1, 0 -_0801D190: - pop {r1} - bx r1 - thumb_func_end sub_801D188 - - thumb_func_start sub_801D194 -sub_801D194: @ 801D194 - push {lr} - cmp r1, r0 - bcs _0801D19E - movs r0, 0 - b _0801D1A8 -_0801D19E: - cmp r1, r0 - beq _0801D1A6 - movs r0, 0x2 - b _0801D1A8 -_0801D1A6: - movs r0, 0x1 -_0801D1A8: - pop {r1} - bx r1 - thumb_func_end sub_801D194 - - thumb_func_start sub_801D1AC -sub_801D1AC: @ 801D1AC - movs r1, 0x4 - str r1, [r0, 0x8] - movs r0, 0 - bx lr - thumb_func_end sub_801D1AC - - thumb_func_start sub_801D1B4 -sub_801D1B4: @ 801D1B4 - movs r0, 0x3 - bx lr - thumb_func_end sub_801D1B4 - - thumb_func_start sub_801D1B8 -sub_801D1B8: @ 801D1B8 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x38 - bl sub_801D8C0 - cmp r0, 0 - beq _0801D1CA - movs r0, 0x4 - str r0, [r4, 0x8] -_0801D1CA: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D1B8 - - thumb_func_start sub_801D1D4 -sub_801D1D4: @ 801D1D4 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x38 - bl sub_801D8CC - cmp r0, 0 - beq _0801D1E6 - movs r0, 0x4 - str r0, [r4, 0x8] -_0801D1E6: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D1D4 - - thumb_func_start sub_801D1F0 -sub_801D1F0: @ 801D1F0 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, [r5, 0xC] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - ldr r2, [r5, 0x10] - adds r3, r2, r1 - adds r0, 0x1 - str r0, [r5, 0xC] - ldr r0, [r3] - cmp r0, 0x1E - bls _0801D20C - b _0801D464 -_0801D20C: - lsls r0, 2 - ldr r1, =_0801D21C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801D21C: - .4byte _0801D298 - .4byte _0801D2A2 - .4byte _0801D2A8 - .4byte _0801D2E2 - .4byte _0801D2D8 - .4byte _0801D2BA - .4byte _0801D2C6 - .4byte _0801D2EC - .4byte _0801D300 - .4byte _0801D308 - .4byte _0801D31E - .4byte _0801D32E - .4byte _0801D33A - .4byte _0801D360 - .4byte _0801D348 - .4byte _0801D390 - .4byte _0801D378 - .4byte _0801D3DC - .4byte _0801D3A8 - .4byte _0801D3C0 - .4byte _0801D3CE - .4byte _0801D406 - .4byte _0801D3EA - .4byte _0801D3F8 - .4byte _0801D40E - .4byte _0801D418 - .4byte _0801D422 - .4byte _0801D43C - .4byte _0801D450 - .4byte _0801D458 - .4byte _0801D2CC -_0801D298: - movs r0, 0x1 - str r0, [r5, 0x8] - ldr r0, [r3, 0x4] - str r0, [r5, 0x4] - b _0801D464 -_0801D2A2: - movs r0, 0x3 - str r0, [r5, 0x8] - b _0801D464 -_0801D2A8: - adds r0, r5, 0 - adds r0, 0x38 - ldr r1, [r3, 0x4] - ldr r2, [r5, 0x14] - bl sub_801D928 - movs r0, 0x2 - str r0, [r5, 0x8] - b _0801D464 -_0801D2BA: - ldr r0, [r5, 0x20] - ldr r1, [r5, 0x14] - movs r2, 0x64 - bl memcpy - b _0801D464 -_0801D2C6: - ldr r0, [r5, 0x20] - movs r1, 0 - b _0801D2D0 -_0801D2CC: - ldr r0, [r5, 0x20] - movs r1, 0x1 -_0801D2D0: - bl sub_801B6A0 - str r0, [r5, 0x4] - b _0801D464 -_0801D2D8: - ldr r1, [r5, 0x4] - ldr r0, [r3, 0x4] - cmp r1, r0 - beq _0801D2E2 - b _0801D464 -_0801D2E2: - movs r0, 0 - str r0, [r5, 0xC] - ldr r0, [r3, 0x8] - str r0, [r5, 0x10] - b _0801D464 -_0801D2EC: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x18] - bl sub_801D188 - adds r2, r0, 0 - ldr r1, [r5, 0x20] - bl sub_801B6EC - str r0, [r5, 0x4] - b _0801D464 -_0801D300: - ldr r0, [r5, 0x14] - ldr r0, [r0] - str r0, [r5, 0x4] - b _0801D464 -_0801D308: - ldr r0, [r3, 0x8] - adds r1, r5, 0 - adds r1, 0x34 - bl sub_801D188 - adds r2, r0, 0 - ldr r1, [r5, 0x20] - bl sub_801B708 - str r0, [r5, 0x4] - b _0801D464 -_0801D31E: - ldr r0, [r5, 0x20] - ldr r1, [r3, 0x4] - bl sub_801B784 - lsls r0, 16 - lsrs r0, 16 - str r0, [r5, 0x4] - b _0801D464 -_0801D32E: - ldr r0, [r5, 0x20] - ldr r1, [r3, 0x8] - bl sub_801B748 - str r0, [r5, 0x4] - b _0801D464 -_0801D33A: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x14] - ldr r1, [r1] - bl sub_801D194 - str r0, [r5, 0x4] - b _0801D464 -_0801D348: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x1C] - bl sub_801D188 - adds r2, r0, 0 - movs r3, 0xDE - lsls r3, 1 - adds r0, r5, 0 - movs r1, 0x17 - bl mevent_srv_814501C - b _0801D464 -_0801D360: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x18] - bl sub_801D188 - adds r2, r0, 0 - movs r3, 0xA6 - lsls r3, 1 - adds r0, r5, 0 - movs r1, 0x16 - bl mevent_srv_814501C - b _0801D464 -_0801D378: - ldr r0, [r3, 0x8] - adds r1, r5, 0 - adds r1, 0x34 - bl sub_801D188 - adds r2, r0, 0 - adds r0, r5, 0 - movs r1, 0x18 - movs r3, 0x4 - bl mevent_srv_814501C - b _0801D464 -_0801D390: - ldr r2, [r3, 0x8] - cmp r2, 0 - bne _0801D39C - ldr r2, [r5, 0x24] - ldr r3, [r5, 0x28] - b _0801D39E -_0801D39C: - ldr r3, [r3, 0x4] -_0801D39E: - adds r0, r5, 0 - movs r1, 0x19 - bl mevent_srv_814501C - b _0801D464 -_0801D3A8: - ldr r2, [r3, 0x8] - cmp r2, 0 - bne _0801D3B4 - ldr r2, [r5, 0x2C] - ldr r3, [r5, 0x30] - b _0801D3B6 -_0801D3B4: - ldr r3, [r3, 0x4] -_0801D3B6: - adds r0, r5, 0 - movs r1, 0x10 - bl mevent_srv_814501C - b _0801D464 -_0801D3C0: - ldr r2, [r3, 0x8] - adds r0, r5, 0 - movs r1, 0x1A - movs r3, 0xBC - bl mevent_srv_814501C - b _0801D464 -_0801D3CE: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x15 - bl mevent_srv_814501C - b _0801D464 -_0801D3DC: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x1C - bl mevent_srv_814501C - b _0801D464 -_0801D3EA: - ldr r0, [r5, 0x18] - ldr r1, [r3, 0x8] - movs r2, 0xA6 - lsls r2, 1 - bl memcpy - b _0801D464 -_0801D3F8: - ldr r0, [r5, 0x1C] - ldr r1, [r3, 0x8] - movs r2, 0xDE - lsls r2, 1 - bl memcpy - b _0801D464 -_0801D406: - ldr r0, [r3, 0x8] - ldr r0, [r0] - str r0, [r5, 0x34] - b _0801D464 -_0801D40E: - ldr r0, [r3, 0x8] - str r0, [r5, 0x24] - ldr r0, [r3, 0x4] - str r0, [r5, 0x28] - b _0801D464 -_0801D418: - ldr r0, [r3, 0x8] - str r0, [r5, 0x2C] - ldr r0, [r3, 0x4] - str r0, [r5, 0x30] - b _0801D464 -_0801D422: - ldr r4, [r5, 0x18] - bl sav1_get_mevent_buffer_1 - adds r1, r0, 0 - movs r2, 0xA6 - lsls r2, 1 - adds r0, r4, 0 - bl memcpy - ldr r0, [r5, 0x18] - bl sub_801B3C0 - b _0801D464 -_0801D43C: - ldr r4, [r5, 0x1C] - bl sub_801B00C - adds r1, r0, 0 - movs r2, 0xDE - lsls r2, 1 - adds r0, r4, 0 - bl memcpy - b _0801D464 -_0801D450: - bl sub_8099244 - str r0, [r5, 0x24] - b _0801D464 -_0801D458: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x1B - bl mevent_srv_814501C -_0801D464: - movs r0, 0x1 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801D1F0 - - thumb_func_start mevent_dispatch_08145600 -mevent_dispatch_08145600: @ 801D46C - push {lr} - ldr r2, =gUnknown_082F2548 - ldr r1, [r0, 0x8] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {r1} - bx r1 - .pool - thumb_func_end mevent_dispatch_08145600 - - thumb_func_start sub_801D484 -sub_801D484: @ 801D484 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gUnknown_02022C80 - movs r0, 0x50 - bl AllocZeroed - str r0, [r4] - movs r1, 0x1 - movs r2, 0 - bl mevent_srv_ish_init - ldr r0, [r4] - str r5, [r0, 0x4C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801D484 - - thumb_func_start sub_801D4A8 -sub_801D4A8: @ 801D4A8 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r4, =gUnknown_02022C80 - ldr r0, [r4] - cmp r0, 0 - bne _0801D4BC - movs r0, 0x6 - b _0801D4DC - .pool -_0801D4BC: - bl mevent_srv_ish_exec - adds r5, r0, 0 - cmp r5, 0x6 - bne _0801D4DA - ldr r0, [r4] - ldr r1, [r0, 0x4] - strh r1, [r6] - bl sub_801D55C - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801D4DA: - adds r0, r5, 0 -_0801D4DC: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801D4A8 - - thumb_func_start sub_801D4E4 -sub_801D4E4: @ 801D4E4 - ldr r0, =gUnknown_02022C80 - ldr r1, [r0] - ldr r0, [r1, 0xC] - adds r0, 0x1 - str r0, [r1, 0xC] - bx lr - .pool - thumb_func_end sub_801D4E4 - - thumb_func_start sub_801D4F4 -sub_801D4F4: @ 801D4F4 - ldr r0, =gUnknown_02022C80 - ldr r0, [r0] - ldr r0, [r0, 0x20] - bx lr - .pool - thumb_func_end sub_801D4F4 - - thumb_func_start sub_801D500 -sub_801D500: @ 801D500 - ldr r1, =gUnknown_02022C80 - ldr r1, [r1] - str r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_801D500 - - thumb_func_start mevent_srv_ish_init -mevent_srv_ish_init: @ 801D50C - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r4, r0, 0 - adds r6, r1, 0 - mov r8, r2 - movs r0, 0 - str r0, [r4] - str r0, [r4, 0x8] - str r0, [r4, 0xC] - movs r5, 0x80 - lsls r5, 3 - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x14] - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x18] - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x1C] - movs r0, 0x40 - bl AllocZeroed - str r0, [r4, 0x20] - adds r4, 0x24 - adds r0, r4, 0 - adds r1, r6, 0 - mov r2, r8 - bl sub_801D8D8 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end mevent_srv_ish_init - - thumb_func_start sub_801D55C -sub_801D55C: @ 801D55C - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x14] - bl Free - ldr r0, [r4, 0x18] - bl Free - ldr r0, [r4, 0x1C] - bl Free - ldr r0, [r4, 0x20] - bl Free - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801D55C - - thumb_func_start sub_801D580 -sub_801D580: @ 801D580 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x1C] - ldr r1, [r4, 0x18] - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r0, 0 - str r0, [r4, 0x10] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801D580 - - thumb_func_start sub_801D59C -sub_801D59C: @ 801D59C - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r6, r1, 0 - adds r5, r2, 0 - movs r0, 0 - str r0, [sp] - ldr r1, [r4, 0x14] - ldr r2, =0x05000100 - mov r0, sp - bl CpuSet - ldr r2, [r4, 0x14] - str r5, [r2] - adds r4, 0x24 - adds r0, r4, 0 - adds r1, r6, 0 - movs r3, 0x4 - bl sub_801D904 - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801D59C - - thumb_func_start sub_801D5D0 -sub_801D5D0: @ 801D5D0 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x1C] - ldr r1, =gUnknown_082F2598 - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r1, 0 - str r1, [r4, 0x10] - movs r0, 0x4 - str r0, [r4, 0x8] - str r1, [r4, 0xC] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D5D0 - - thumb_func_start sub_801D5F8 -sub_801D5F8: @ 801D5F8 - movs r0, 0x6 - bx lr - thumb_func_end sub_801D5F8 - - thumb_func_start sub_801D5FC -sub_801D5FC: @ 801D5FC - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x24 - bl sub_801D8C0 - cmp r0, 0 - beq _0801D612 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D612: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D5FC - - thumb_func_start sub_801D61C -sub_801D61C: @ 801D61C - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x24 - bl sub_801D8CC - cmp r0, 0 - beq _0801D632 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D632: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D61C - - thumb_func_start sub_801D63C -sub_801D63C: @ 801D63C - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x10] - lsls r2, r0, 3 - ldr r1, [r4, 0x1C] - adds r2, r1, r2 - adds r0, 0x1 - str r0, [r4, 0x10] - ldr r0, [r2] - cmp r0, 0x15 - bls _0801D654 - b _0801D804 -_0801D654: - lsls r0, 2 - ldr r1, =_0801D664 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801D664: - .4byte _0801D804 - .4byte _0801D6BC - .4byte _0801D6C4 - .4byte _0801D6D4 - .4byte _0801D70E - .4byte _0801D716 - .4byte _0801D6FE - .4byte _0801D708 - .4byte _0801D764 - .4byte _0801D790 - .4byte _0801D788 - .4byte _0801D72C - .4byte _0801D742 - .4byte _0801D758 - .4byte _0801D77C - .4byte _0801D7B8 - .4byte _0801D7BC - .4byte _0801D7C4 - .4byte _0801D7D0 - .4byte _0801D6EA - .4byte _0801D6D8 - .4byte _0801D7F0 -_0801D6BC: - ldr r0, [r2, 0x4] - str r0, [r4, 0x4] - movs r0, 0x1 - b _0801D7FE -_0801D6C4: - adds r0, r4, 0 - adds r0, 0x24 - ldr r1, [r2, 0x4] - ldr r2, [r4, 0x18] - bl sub_801D928 - movs r0, 0x2 - b _0801D7FE -_0801D6D4: - movs r0, 0x3 - b _0801D7FE -_0801D6D8: - adds r0, r4, 0 - adds r0, 0x24 - ldr r2, [r4, 0x14] - movs r1, 0x14 - movs r3, 0 - bl sub_801D904 - movs r0, 0x3 - b _0801D7FE -_0801D6EA: - ldrb r0, [r2, 0x4] - bl GetGameStat - adds r2, r0, 0 - adds r0, r4, 0 - movs r1, 0x12 - bl sub_801D59C - movs r0, 0x3 - b _0801D7FE -_0801D6FE: - ldr r0, [r4, 0x4] - cmp r0, 0 - beq _0801D706 - b _0801D804 -_0801D706: - b _0801D70E -_0801D708: - ldr r0, [r4, 0x4] - cmp r0, 0x1 - bne _0801D804 -_0801D70E: - adds r0, r4, 0 - bl sub_801D580 - b _0801D804 -_0801D716: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x2 - b _0801D806 -_0801D72C: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x3 - b _0801D806 -_0801D742: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x5 - b _0801D806 -_0801D758: - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x4 - b _0801D806 -_0801D764: - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x4C] - bl sub_801B580 - adds r0, r4, 0 - adds r0, 0x24 - ldr r2, [r4, 0x14] - movs r1, 0x11 - movs r3, 0x64 - bl sub_801D904 - b _0801D804 -_0801D77C: - ldr r2, [r4, 0x4] - adds r0, r4, 0 - movs r1, 0x13 - bl sub_801D59C - b _0801D804 -_0801D788: - ldr r0, [r4, 0x18] - bl sub_801B21C - b _0801D804 -_0801D790: - ldr r0, [r4, 0x18] - bl sub_801B1A4 - cmp r0, 0 - bne _0801D7AC - ldr r0, [r4, 0x18] - bl sub_801B078 - adds r0, r4, 0 - movs r1, 0x13 - movs r2, 0 - bl sub_801D59C - b _0801D804 -_0801D7AC: - adds r0, r4, 0 - movs r1, 0x13 - movs r2, 0x1 - bl sub_801D59C - b _0801D804 -_0801D7B8: - movs r0, 0x6 - b _0801D7FE -_0801D7BC: - ldr r0, [r4, 0x18] - bl sub_801B508 - b _0801D804 -_0801D7C4: - ldr r0, [r4, 0x18] - movs r1, 0xFA - lsls r1, 2 - bl sub_80992A0 - b _0801D804 -_0801D7D0: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000bec - adds r0, r1 - ldr r1, [r4, 0x18] - movs r2, 0xBC - bl memcpy - bl sub_81652B4 - b _0801D804 - .pool -_0801D7F0: - ldr r0, =0x0201c000 - ldr r1, [r4, 0x18] - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r0, 0x7 -_0801D7FE: - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D804: - movs r0, 0x1 -_0801D806: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D63C - - thumb_func_start sub_801D810 -sub_801D810: @ 801D810 - push {lr} - adds r1, r0, 0 - ldr r0, [r1, 0xC] - cmp r0, 0 - beq _0801D822 - movs r0, 0x4 - str r0, [r1, 0x8] - movs r0, 0 - str r0, [r1, 0xC] -_0801D822: - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_801D810 - - thumb_func_start sub_801D828 -sub_801D828: @ 801D828 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0xC] - cmp r0, 0 - beq _0801D838 - cmp r0, 0x1 - beq _0801D846 - b _0801D858 -_0801D838: - ldr r0, [r4, 0x18] - bl sub_8153870 - ldr r0, [r4, 0xC] - adds r0, 0x1 - str r0, [r4, 0xC] - b _0801D858 -_0801D846: - adds r0, r4, 0x4 - bl sub_8153884 - adds r1, r0, 0 - cmp r1, 0 - bne _0801D858 - movs r0, 0x4 - str r0, [r4, 0x8] - str r1, [r4, 0xC] -_0801D858: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D828 - - thumb_func_start sub_801D860 -sub_801D860: @ 801D860 - push {r4,lr} - adds r4, r0, 0 - ldr r3, =0x0201c000 - adds r0, r4, 0x4 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - ldr r2, =gSaveBlock1Ptr - ldr r2, [r2] - bl _call_via_r3 - cmp r0, 0x1 - bne _0801D880 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D880: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D860 - - thumb_func_start mevent_srv_ish_exec -mevent_srv_ish_exec: @ 801D894 - push {r4,r5,lr} - sub sp, 0x20 - mov r2, sp - ldr r1, =gUnknown_082F255C - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3,r4} - stm r2!, {r3,r4} - ldr r1, [r0, 0x8] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - bl _call_via_r1 - add sp, 0x20 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end mevent_srv_ish_exec - - thumb_func_start sub_801D8C0 -sub_801D8C0: @ 801D8C0 - push {lr} - ldr r1, [r0, 0x20] - bl _call_via_r1 - pop {r1} - bx r1 - thumb_func_end sub_801D8C0 - - thumb_func_start sub_801D8CC -sub_801D8CC: @ 801D8CC - push {lr} - ldr r1, [r0, 0x24] - bl _call_via_r1 - pop {r1} - bx r1 - thumb_func_end sub_801D8CC - - thumb_func_start sub_801D8D8 -sub_801D8D8: @ 801D8D8 - movs r3, 0 - strb r1, [r0, 0x4] - strb r2, [r0, 0x5] - str r3, [r0] - strh r3, [r0, 0x12] - strh r3, [r0, 0x14] - strh r3, [r0, 0x10] - strh r3, [r0, 0xA] - strh r3, [r0, 0xC] - strh r3, [r0, 0x8] - str r3, [r0, 0x1C] - str r3, [r0, 0x18] - ldr r1, =sub_801DA5C - str r1, [r0, 0x24] - ldr r1, =sub_801D988 - str r1, [r0, 0x20] - bx lr - .pool - thumb_func_end sub_801D8D8 - - thumb_func_start sub_801D904 -sub_801D904: @ 801D904 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0 - str r0, [r4] - strh r1, [r4, 0xE] - strh r0, [r4, 0x10] - strh r0, [r4, 0x12] - cmp r3, 0 - beq _0801D91A - strh r3, [r4, 0x14] - b _0801D920 -_0801D91A: - movs r0, 0x80 - lsls r0, 3 - strh r0, [r4, 0x14] -_0801D920: - str r2, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801D904 - - thumb_func_start sub_801D928 -sub_801D928: @ 801D928 - movs r3, 0 - str r3, [r0] - strh r1, [r0, 0x6] - strh r3, [r0, 0x8] - strh r3, [r0, 0xA] - strh r3, [r0, 0xC] - str r2, [r0, 0x18] - bx lr - thumb_func_end sub_801D928 - - thumb_func_start sub_801D938 -sub_801D938: @ 801D938 - push {lr} - adds r3, r0, 0 - adds r0, r1, 0 - lsls r3, 8 - ldr r1, =gBlockRecvBuffer - adds r3, r1 - adds r1, r3, 0 - bl memcpy - pop {r0} - bx r0 - .pool - thumb_func_end sub_801D938 - - thumb_func_start sub_801D954 -sub_801D954: @ 801D954 - push {r4,lr} - adds r4, r0, 0 - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - asrs r0, r4 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801D96E - movs r0, 0 - b _0801D970 -_0801D96E: - movs r0, 0x1 -_0801D970: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D954 - - thumb_func_start sub_801D978 -sub_801D978: @ 801D978 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl ResetBlockReceivedFlag - pop {r0} - bx r0 - thumb_func_end sub_801D978 - - thumb_func_start sub_801D988 -sub_801D988: @ 801D988 - push {r4-r6,lr} - sub sp, 0x8 - adds r5, r0, 0 - ldr r6, [r5] - cmp r6, 0x1 - beq _0801D9EC - cmp r6, 0x1 - bgt _0801D99E - cmp r6, 0 - beq _0801D9A4 - b _0801DA52 -_0801D99E: - cmp r6, 0x2 - beq _0801DA38 - b _0801DA52 -_0801D9A4: - ldrb r0, [r5, 0x5] - bl sub_801D954 - cmp r0, 0 - beq _0801DA52 - ldrb r0, [r5, 0x5] - mov r4, sp - mov r1, sp - movs r2, 0x8 - bl sub_801D938 - ldrh r1, [r4, 0x4] - strh r1, [r5, 0xC] - ldrh r0, [r4, 0x2] - strh r0, [r5, 0xA] - lsls r1, 16 - movs r0, 0x80 - lsls r0, 19 - cmp r1, r0 - bls _0801D9D2 -_0801D9CC: - bl sub_8010198 - b _0801DA52 -_0801D9D2: - mov r1, sp - ldrh r0, [r5, 0x6] - ldrh r1, [r1] - cmp r0, r1 - bne _0801D9CC - strh r6, [r5, 0x8] - ldrb r0, [r5, 0x5] - bl sub_801D978 - ldr r0, [r5] - adds r0, 0x1 - str r0, [r5] - b _0801DA52 -_0801D9EC: - ldrb r0, [r5, 0x5] - bl sub_801D954 - cmp r0, 0 - beq _0801DA52 - ldrh r0, [r5, 0x8] - lsls r1, r0, 6 - subs r1, r0 - lsls r3, r1, 2 - ldrh r0, [r5, 0xC] - subs r2, r0, r3 - cmp r2, 0xFC - bhi _0801DA1E - ldrb r0, [r5, 0x5] - ldr r1, [r5, 0x18] - adds r1, r3 - bl sub_801D938 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - ldr r0, [r5] - adds r0, 0x1 - str r0, [r5] - b _0801DA30 -_0801DA1E: - ldrb r0, [r5, 0x5] - ldr r1, [r5, 0x18] - adds r1, r3 - movs r2, 0xFC - bl sub_801D938 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] -_0801DA30: - ldrb r0, [r5, 0x5] - bl sub_801D978 - b _0801DA52 -_0801DA38: - ldr r0, [r5, 0x18] - ldrh r1, [r5, 0xC] - bl CalcCRC16WithTable - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r5, 0xA] - cmp r0, r1 - bne _0801D9CC - movs r0, 0 - str r0, [r5] - movs r0, 0x1 - b _0801DA54 -_0801DA52: - movs r0, 0 -_0801DA54: - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801D988 - - thumb_func_start sub_801DA5C -sub_801DA5C: @ 801DA5C - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r5, [r4] - cmp r5, 0x1 - beq _0801DAC8 - cmp r5, 0x1 - bgt _0801DA72 - cmp r5, 0 - beq _0801DA7C - b _0801DB5E -_0801DA72: - cmp r5, 0x2 - beq _0801DB1C - cmp r5, 0x3 - beq _0801DB46 - b _0801DB5E -_0801DA7C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldrh r1, [r4, 0xE] - ldr r2, =0xffff0000 - ldr r0, [sp] - ands r0, r2 - orrs r0, r1 - str r0, [sp] - ldrh r1, [r4, 0x14] - ldr r0, [sp, 0x4] - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x4] - ldr r0, [r4, 0x1C] - bl CalcCRC16WithTable - lsls r0, 16 - ldr r2, =0x0000ffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - lsrs r1, 16 - strh r1, [r4, 0x12] - strh r5, [r4, 0x10] - movs r0, 0 - mov r1, sp - movs r2, 0x8 - bl SendBlock - b _0801DB3E - .pool -_0801DAC8: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D954 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D978 - ldrh r1, [r4, 0x10] - lsls r0, r1, 6 - subs r0, r1 - lsls r3, r0, 2 - ldrh r0, [r4, 0x14] - subs r0, r3 - cmp r0, 0xFC - bhi _0801DB08 - ldr r1, [r4, 0x1C] - adds r1, r3 - lsls r2, r0, 16 - lsrs r2, 16 - movs r0, 0 - bl SendBlock - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - b _0801DB3E -_0801DB08: - ldr r1, [r4, 0x1C] - adds r1, r3 - movs r0, 0 - movs r2, 0xFC - bl SendBlock - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - b _0801DB5E -_0801DB1C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldr r0, [r4, 0x1C] - ldrh r1, [r4, 0x14] - bl CalcCRC16WithTable - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r4, 0x12] - cmp r0, r1 - beq _0801DB3E - bl sub_8010198 - b _0801DB5E -_0801DB3E: - ldr r0, [r4] - adds r0, 0x1 - str r0, [r4] - b _0801DB5E -_0801DB46: - ldrb r0, [r4, 0x4] - bl sub_801D954 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D978 - movs r0, 0 - str r0, [r4] - movs r0, 0x1 - b _0801DB60 -_0801DB5E: - movs r0, 0 -_0801DB60: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801DA5C - - thumb_func_start sub_801DB68 -sub_801DB68: @ 801DB68 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_801B044 - adds r5, r0, 0 - movs r0, 0x3 - adds r1, r4, 0 - ands r1, r0 - ldrb r2, [r5] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5] - cmp r4, 0x2 - bhi _0801DB8E - cmp r4, 0x1 - bcs _0801DB94 - b _0801DBB8 -_0801DB8E: - cmp r4, 0x3 - beq _0801DBA6 - b _0801DBB8 -_0801DB94: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xF - bl __umodsi3 - adds r0, 0x10 - b _0801DBB6 -_0801DBA6: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xF - bl __umodsi3 - adds r0, 0x1 -_0801DBB6: - strb r0, [r5, 0x1] -_0801DBB8: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801DB68 - - thumb_func_start sub_801DBC0 -sub_801DBC0: @ 801DBC0 - push {lr} - bl sub_801B044 - movs r1, 0 - strb r1, [r0] - strb r1, [r0, 0x1] - ldr r0, =0x0000402e - bl VarSet - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DBC0 - - thumb_func_start sub_801DBDC -sub_801DBDC: @ 801DBDC - push {r4,lr} - ldr r0, =0x0000402e - bl GetVarPointer - adds r4, r0, 0 - bl sub_801B044 - adds r2, r0, 0 - ldr r0, [r2] - lsls r0, 24 - lsrs r0, 29 - cmp r0, 0x4 - bls _0801DC10 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - lsls r0, 16 - ldr r1, =0x01f30000 - cmp r0, r1 - bls _0801DC10 - ldrb r0, [r2] - movs r1, 0x1F - ands r1, r0 - strb r1, [r2] - movs r0, 0 - strh r0, [r4] -_0801DC10: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DBDC - - thumb_func_start sub_801DC20 -sub_801DC20: @ 801DC20 - push {r4-r6,lr} - ldr r6, =gScriptResult - bl sub_801B044 - adds r4, r0, 0 - bl IsMysteryEventEnabled - cmp r0, 0 - beq _0801DC3A - bl sub_801B0CC - cmp r0, 0 - bne _0801DC44 -_0801DC3A: - movs r0, 0 - b _0801DCA6 - .pool -_0801DC44: - adds r0, r4, 0 - bl sub_801DD44 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x6 - bhi _0801DCA4 - lsls r0, r5, 2 - ldr r1, =_0801DC60 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801DC60: - .4byte _0801DCA4 - .4byte _0801DC7C - .4byte _0801DC7C - .4byte _0801DCA4 - .4byte _0801DC86 - .4byte _0801DC96 - .4byte _0801DCA4 -_0801DC7C: - adds r0, r4, 0 - bl sub_801DCAC - strh r0, [r6] - b _0801DCA4 -_0801DC86: - adds r0, r4, 0 - bl sub_801DCAC - strh r0, [r6] - adds r0, r4, 0 - bl sub_801DCD8 - b _0801DCA4 -_0801DC96: - adds r0, r4, 0 - bl sub_801DCAC - strh r0, [r6] - adds r0, r4, 0 - bl sub_801DCCC -_0801DCA4: - adds r0, r5, 0 -_0801DCA6: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801DC20 - - thumb_func_start sub_801DCAC -sub_801DCAC: @ 801DCAC - push {r4,lr} - ldrb r2, [r0] - movs r1, 0x4 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrb r4, [r0, 0x1] - adds r4, 0x84 - movs r1, 0 - strb r1, [r0, 0x1] - bl sub_801DD10 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801DCAC - - thumb_func_start sub_801DCCC -sub_801DCCC: @ 801DCCC - ldrb r2, [r0] - movs r1, 0x1D - negs r1, r1 - ands r1, r2 - strb r1, [r0] - bx lr - thumb_func_end sub_801DCCC - - thumb_func_start sub_801DCD8 -sub_801DCD8: @ 801DCD8 - push {r4,lr} - adds r3, r0, 0 - ldr r0, [r3] - lsls r0, 27 - lsrs r0, 29 - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - lsls r0, 2 - ldrb r1, [r3] - movs r4, 0x1D - negs r4, r4 - adds r2, r4, 0 - ands r2, r1 - orrs r2, r0 - strb r2, [r3] - ldr r0, [r3] - lsls r0, 27 - lsrs r0, 29 - cmp r0, 0x4 - bls _0801DD0A - ands r2, r4 - movs r0, 0x10 - orrs r2, r0 - strb r2, [r3] -_0801DD0A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801DCD8 - - thumb_func_start sub_801DD10 -sub_801DD10: @ 801DD10 - push {r4,lr} - adds r3, r0, 0 - ldr r0, [r3] - lsls r0, 24 - lsrs r0, 29 - adds r0, 0x1 - lsls r0, 5 - ldrb r1, [r3] - movs r4, 0x1F - adds r2, r4, 0 - ands r2, r1 - orrs r2, r0 - strb r2, [r3] - ldr r0, [r3] - lsls r0, 24 - lsrs r0, 29 - cmp r0, 0x5 - bls _0801DD3C - ands r2, r4 - movs r0, 0xA0 - orrs r2, r0 - strb r2, [r3] -_0801DD3C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801DD10 - - thumb_func_start sub_801DD44 -sub_801DD44: @ 801DD44 - push {lr} - adds r2, r0, 0 - ldrb r1, [r2] - movs r0, 0xE0 - ands r0, r1 - cmp r0, 0xA0 - bne _0801DD56 - movs r0, 0x6 - b _0801DD92 -_0801DD56: - ldr r1, [r2] - lsls r0, r1, 30 - lsrs r0, 30 - cmp r0, 0x1 - beq _0801DD78 - cmp r0, 0x1 - bgt _0801DD6A - cmp r0, 0 - beq _0801DD74 - b _0801DD90 -_0801DD6A: - cmp r0, 0x2 - beq _0801DD7C - cmp r0, 0x3 - beq _0801DD80 - b _0801DD90 -_0801DD74: - movs r0, 0x3 - b _0801DD92 -_0801DD78: - movs r0, 0x1 - b _0801DD92 -_0801DD7C: - movs r0, 0x2 - b _0801DD92 -_0801DD80: - lsls r0, r1, 27 - lsrs r0, 29 - cmp r0, 0x2 - bhi _0801DD8C - movs r0, 0x4 - b _0801DD92 -_0801DD8C: - movs r0, 0x5 - b _0801DD92 -_0801DD90: - movs r0, 0 -_0801DD92: - pop {r1} - bx r1 - thumb_func_end sub_801DD44 - - thumb_func_start sub_801DD98 -sub_801DD98: @ 801DD98 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - movs r0, 0xDE - lsls r0, 1 - bl Alloc - str r0, [r4] - bl sub_801DDD0 - ldr r1, =gKeyRepeatStartDelay - movs r0, 0x14 - strh r0, [r1] - movs r0, 0 - bl SetVBlankCallback - ldr r0, =c2_081284E0 - bl SetMainCallback2 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DD98 - - thumb_func_start sub_801DDD0 -sub_801DDD0: @ 801DDD0 - push {r4-r7,lr} - adds r4, r0, 0 - movs r5, 0 - movs r0, 0 - strh r0, [r4, 0x4] - strh r0, [r4, 0x6] - strb r5, [r4, 0x10] - strb r5, [r4, 0x11] - strb r5, [r4, 0x12] - strb r5, [r4, 0x14] - strb r5, [r4, 0x15] - strb r5, [r4, 0x16] - movs r0, 0xFF - strb r0, [r4, 0x1A] - bl GetLinkPlayerCount - strb r0, [r4, 0xD] - bl GetMultiplayerId - strb r0, [r4, 0x13] - strb r5, [r4, 0x17] - strb r5, [r4, 0x18] - movs r1, 0xC8 - lsls r1, 1 - adds r0, r4, r1 - bl sub_801EF1C - ldr r7, =gSaveBlock1Ptr - ldr r6, =0x00003c88 - adds r4, 0xB9 - movs r5, 0x9 -_0801DE0E: - ldr r1, [r7] - adds r1, r6 - adds r0, r4, 0 - bl StringCopy - adds r6, 0x15 - adds r4, 0x15 - subs r5, 0x1 - cmp r5, 0 - bge _0801DE0E - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DDD0 - - thumb_func_start sub_801DE30 -sub_801DE30: @ 801DE30 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r0, [r0, 0xE] - bl DestroyTask - ldr r0, [r4] - ldrb r0, [r0, 0xF] - bl DestroyTask - ldr r0, [r4] - bl Free - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DE30 - - thumb_func_start c2_081284E0 -c2_081284E0: @ 801DE54 - push {r4-r6,lr} - sub sp, 0x4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r6, r0, r1 - ldrb r0, [r6] - cmp r0, 0x1 - beq _0801DE8C - cmp r0, 0x1 - bgt _0801DE74 - cmp r0, 0 - beq _0801DE7A - b _0801DF04 - .pool -_0801DE74: - cmp r0, 0x2 - beq _0801DEC8 - b _0801DF04 -_0801DE7A: - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - bl sub_801F4D0 - b _0801DEBC -_0801DE8C: - bl sub_801F5B8 - bl sub_801F534 - adds r5, r0, 0 - cmp r5, 0 - bne _0801DF04 - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - str r5, [sp] - adds r0, r4, 0 - adds r1, r4, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_801DF20 - bl SetVBlankCallback -_0801DEBC: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _0801DF04 - .pool -_0801DEC8: - bl UpdatePaletteFade - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0801DF04 - ldr r0, =sub_801DF38 - bl SetMainCallback2 - ldr r0, =sub_801DF54 - movs r1, 0x8 - bl CreateTask - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - strb r0, [r1, 0xE] - ldr r0, =sub_801F2B4 - movs r1, 0x7 - bl CreateTask - ldr r1, [r4] - strb r0, [r1, 0xF] - bl sub_800E0E8 - movs r0, 0xE8 - movs r1, 0x96 - bl sub_800DFB4 -_0801DF04: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end c2_081284E0 - - thumb_func_start sub_801DF20 -sub_801DF20: @ 801DF20 - push {lr} - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - bl sub_80BA0A8 - pop {r0} - bx r0 - thumb_func_end sub_801DF20 - - thumb_func_start sub_801DF38 -sub_801DF38: @ 801DF38 - push {lr} - bl RunTasks - bl sub_801F5B8 - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_801DF38 - - thumb_func_start sub_801DF54 -sub_801DF54: @ 801DF54 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r0, [r0, 0x17] - cmp r0, 0x2 - beq _0801DF7A - cmp r0, 0x2 - bgt _0801DF70 - cmp r0, 0x1 - beq _0801DF76 - b _0801DF8A - .pool -_0801DF70: - cmp r0, 0x3 - beq _0801DF7E - b _0801DF8A -_0801DF76: - movs r0, 0x6 - b _0801DF80 -_0801DF7A: - movs r0, 0x7 - b _0801DF80 -_0801DF7E: - movs r0, 0x8 -_0801DF80: - bl sub_801EBD4 - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0x17] -_0801DF8A: - ldr r1, =gUnknown_082F2A7C - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrh r0, [r0, 0x4] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DF54 - - thumb_func_start sub_801DFAC -sub_801DFAC: @ 801DFAC - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrh r1, [r0, 0x6] - cmp r1, 0x1 - beq _0801DFE0 - cmp r1, 0x1 - bgt _0801DFC8 - cmp r1, 0 - beq _0801DFCE - b _0801E028 - .pool -_0801DFC8: - cmp r1, 0x2 - beq _0801E018 - b _0801E028 -_0801DFCE: - movs r1, 0xC8 - lsls r1, 1 - adds r0, r1 - bl sub_801EF24 - ldr r1, [r4] - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] -_0801DFE0: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801E028 - bl sub_8011A9C - cmp r0, 0 - bne _0801E028 - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - movs r0, 0xC8 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0801E028 - ldr r1, [r4] - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E028 - .pool -_0801E018: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801E028 - movs r0, 0x1 - bl sub_801EBD4 -_0801E028: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801DFAC - - thumb_func_start sub_801E030 -sub_801E030: @ 801E030 - push {r4,r5,lr} - ldr r5, =gUnknown_02022C84 - ldr r3, [r5] - ldrh r0, [r3, 0x6] - cmp r0, 0 - beq _0801E048 - cmp r0, 0x1 - beq _0801E0F6 - b _0801E118 - .pool -_0801E048: - ldr r1, =gMain - ldrh r2, [r1, 0x2E] - movs r0, 0x8 - ands r0, r2 - cmp r0, 0 - beq _0801E068 - ldrb r0, [r3, 0x15] - cmp r0, 0 - beq _0801E118 - movs r0, 0x4 - bl sub_801EBD4 - b _0801E118 - .pool -_0801E068: - movs r0, 0x4 - ands r0, r2 - cmp r0, 0 - beq _0801E078 - movs r0, 0x2 - bl sub_801EBD4 - b _0801E118 -_0801E078: - ldrh r1, [r1, 0x30] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0801E0A4 - ldrb r0, [r3, 0x15] - cmp r0, 0 - beq _0801E09C - bl sub_801ED68 - movs r0, 0x8 - movs r1, 0 - bl sub_801F5EC - ldr r1, [r5] - movs r0, 0x1 - strh r0, [r1, 0x6] - b _0801E118 -_0801E09C: - movs r0, 0x3 - bl sub_801EBD4 - b _0801E118 -_0801E0A4: - movs r4, 0x1 - adds r0, r4, 0 - ands r0, r2 - cmp r0, 0 - beq _0801E0C0 - bl sub_801EC94 - movs r0, 0x8 - movs r1, 0 - bl sub_801F5EC - movs r0, 0x2 - movs r1, 0x1 - b _0801E0EC -_0801E0C0: - movs r0, 0x80 - lsls r0, 1 - ands r0, r2 - cmp r0, 0 - beq _0801E0E0 - ldrb r0, [r3, 0x10] - cmp r0, 0x3 - beq _0801E0D8 - bl sub_801ED94 - movs r0, 0x8 - b _0801E0EA -_0801E0D8: - movs r0, 0x5 - bl sub_801EBD4 - b _0801E118 -_0801E0E0: - bl sub_801EBE4 - cmp r0, 0 - beq _0801E118 - movs r0, 0x1 -_0801E0EA: - movs r1, 0 -_0801E0EC: - bl sub_801F5EC - ldr r0, [r5] - strh r4, [r0, 0x6] - b _0801E118 -_0801E0F6: - movs r0, 0 - bl sub_801F644 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_801F644 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r4, 0 - bne _0801E118 - cmp r1, 0 - bne _0801E118 - ldr r0, [r5] - strh r1, [r0, 0x6] -_0801E118: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801E030 - - thumb_func_start sub_801E120 -sub_801E120: @ 801E120 - push {r4-r6,lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrh r0, [r0, 0x6] - cmp r0, 0x4 - bls _0801E12E - b _0801E23A -_0801E12E: - lsls r0, 2 - ldr r1, =_0801E140 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E140: - .4byte _0801E154 - .4byte _0801E15E - .4byte _0801E17C - .4byte _0801E208 - .4byte _0801E21C -_0801E154: - movs r0, 0x3 - movs r1, 0 - bl sub_801F5EC - b _0801E16A -_0801E15E: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E23A -_0801E16A: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E23A - .pool -_0801E17C: - bl ProcessMenuInput - lsls r0, 24 - asrs r0, 8 - lsrs r6, r0, 16 - asrs r4, r0, 16 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _0801E1B4 - adds r0, 0x1 - cmp r4, r0 - beq _0801E1D4 - movs r0, 0x4 - movs r1, 0 - bl sub_801F5EC - ldr r5, =gUnknown_02022C84 - ldr r2, [r5] - ldrb r0, [r2, 0x10] - cmp r0, r4 - beq _0801E1DC - cmp r4, 0x3 - ble _0801E1EC - b _0801E1DC - .pool -_0801E1B4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0801E23A - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - bl MoveMenuCursor - b _0801E23A - .pool -_0801E1D4: - movs r0, 0x4 - movs r1, 0 - bl sub_801F5EC -_0801E1DC: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 - strh r0, [r1, 0x6] - b _0801E23A - .pool -_0801E1EC: - movs r1, 0 - strb r1, [r2, 0x11] - ldr r0, [r5] - strb r1, [r0, 0x12] - movs r0, 0x5 - movs r1, 0x1 - bl sub_801F5EC - ldr r0, [r5] - strb r6, [r0, 0x10] - ldr r1, [r5] - movs r0, 0x4 - strh r0, [r1, 0x6] - b _0801E23A -_0801E208: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E23A - movs r0, 0x1 - bl sub_801EBD4 - b _0801E23A -_0801E21C: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E23A - movs r0, 0x1 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E23A - movs r0, 0x1 - bl sub_801EBD4 -_0801E23A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_801E120 - - thumb_func_start sub_801E240 -sub_801E240: @ 801E240 - push {r4,r5,lr} - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r2, r1, 0 - cmp r0, 0xA - bls _0801E250 - b _0801E458 -_0801E250: - lsls r0, 2 - ldr r1, =_0801E264 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E264: - .4byte _0801E290 - .4byte _0801E2A8 - .4byte _0801E2C4 - .4byte _0801E322 - .4byte _0801E3D4 - .4byte _0801E424 - .4byte _0801E458 - .4byte _0801E458 - .4byte _0801E378 - .4byte _0801E338 - .4byte _0801E35C -_0801E290: - movs r0, 0x6 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x1 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E2A8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E2B6 - b _0801E458 -_0801E2B6: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x2 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E2C4: - bl sub_801FF08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801E2E6 - cmp r1, 0 - bgt _0801E2DE - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801E396 - b _0801E458 -_0801E2DE: - cmp r1, 0x1 - beq _0801E2E4 - b _0801E458 -_0801E2E4: - b _0801E396 -_0801E2E6: - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _0801E310 - movs r2, 0xC8 - lsls r2, 1 - adds r0, r1, r2 - bl sub_801EFD0 - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r1, [r4] - movs r0, 0x9 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E310: - movs r2, 0xC8 - lsls r2, 1 - adds r0, r1, r2 - bl sub_801EF7C - ldr r1, [r4] - movs r0, 0x4 - strh r0, [r1, 0x6] - b _0801E458 -_0801E322: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E330 - b _0801E458 -_0801E330: - movs r0, 0x1 - bl sub_801EBD4 - b _0801E458 -_0801E338: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E346 - b _0801E458 -_0801E346: - movs r0, 0x14 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0xA - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E35C: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E36A - b _0801E458 -_0801E36A: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x8 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E378: - bl sub_801FF08 - lsls r0, 24 - asrs r5, r0, 24 - cmp r5, 0 - beq _0801E3AC - cmp r5, 0 - bgt _0801E392 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _0801E396 - b _0801E458 -_0801E392: - cmp r5, 0x1 - bne _0801E458 -_0801E396: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E3AC: - bl sub_80104B0 - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - movs r1, 0xC8 - lsls r1, 1 - adds r0, r1 - bl sub_801EFD0 - ldr r0, [r4] - movs r1, 0x4 - strh r1, [r0, 0x6] - movs r2, 0xDC - lsls r2, 1 - adds r0, r2 - strh r5, [r0] - b _0801E458 - .pool -_0801E3D4: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801E414 - bl sub_8011A9C - cmp r0, 0 - bne _0801E414 - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - movs r0, 0xC8 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0801E414 - ldr r1, [r4] - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _0801E410 - movs r0, 0x6 - b _0801E412 - .pool -_0801E410: - movs r0, 0x5 -_0801E412: - strh r0, [r1, 0x6] -_0801E414: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E458 - b _0801E42C - .pool -_0801E424: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E438 -_0801E42C: - movs r0, 0x9 - bl sub_801EBD4 - b _0801E458 - .pool -_0801E438: - ldr r3, [r2] - movs r1, 0xDC - lsls r1, 1 - adds r2, r3, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - movs r1, 0x96 - lsls r1, 17 - cmp r0, r1 - bls _0801E458 - movs r0, 0 - strh r0, [r2] - movs r0, 0x4 - strh r0, [r3, 0x6] -_0801E458: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801E240 - - thumb_func_start sub_801E460 -sub_801E460: @ 801E460 - push {r4,lr} - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r2, r1, 0 - cmp r0, 0x7 - bls _0801E470 - b _0801E5BC -_0801E470: - lsls r0, 2 - ldr r1, =_0801E484 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E484: - .4byte _0801E4A4 - .4byte _0801E4C8 - .4byte _0801E4E8 - .4byte _0801E50C - .4byte _0801E540 - .4byte _0801E560 - .4byte _0801E584 - .4byte _0801E5A8 -_0801E4A4: - ldr r0, =sub_801F2B4 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _0801E4B2 - b _0801E5BC -_0801E4B2: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801E59A - .pool -_0801E4C8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E5BC - movs r0, 0x12 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801E59A - .pool -_0801E4E8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E5BC - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - movs r1, 0xC8 - lsls r1, 1 - adds r0, r1 - bl sub_801EFA8 - ldr r1, [r4] - b _0801E59A - .pool -_0801E50C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801E5BC - bl sub_8011A9C - cmp r0, 0 - bne _0801E5BC - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - movs r0, 0xC8 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0801E5BC - ldr r1, [r4] - b _0801E59A - .pool -_0801E540: - bl GetBlockReceivedStatus - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - beq _0801E5BC - bl sub_8011A9C - cmp r0, 0 - bne _0801E5BC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801E59A - .pool -_0801E560: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801E5BC - bl sub_8011A9C - adds r4, r0, 0 - cmp r4, 0 - bne _0801E5BC - bl sub_800AC34 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - strh r4, [r1, 0xA] - b _0801E59A - .pool -_0801E584: - ldr r1, [r2] - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bhi _0801E590 - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E590: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E5BC - ldr r1, [r2] -_0801E59A: - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E5BC - .pool -_0801E5A8: - ldr r1, [r2] - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bls _0801E5B8 - movs r0, 0x9 - bl sub_801EBD4 - b _0801E5BC -_0801E5B8: - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E5BC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801E460 - - thumb_func_start sub_801E5C4 -sub_801E5C4: @ 801E5C4 - push {r4,r5,lr} - ldr r5, =gUnknown_02022C84 - ldr r1, [r5] - ldrh r0, [r1, 0x6] - cmp r0, 0x1 - beq _0801E604 - cmp r0, 0x1 - bgt _0801E5E0 - cmp r0, 0 - beq _0801E5EA - b _0801E662 - .pool -_0801E5E0: - cmp r0, 0x2 - beq _0801E62E - cmp r0, 0x3 - beq _0801E650 - b _0801E662 -_0801E5EA: - ldr r0, =sub_801F2B4 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0801E662 - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - b _0801E640 - .pool -_0801E604: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E662 - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801E662 - bl sub_8011A9C - adds r4, r0, 0 - cmp r4, 0 - bne _0801E662 - bl sub_800AC34 - ldr r1, [r5] - strh r4, [r1, 0xA] - b _0801E642 -_0801E62E: - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bhi _0801E638 - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E638: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E662 -_0801E640: - ldr r1, [r5] -_0801E642: - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E662 - .pool -_0801E650: - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bls _0801E65E - movs r0, 0x9 - bl sub_801EBD4 - b _0801E662 -_0801E65E: - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E662: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801E5C4 - - thumb_func_start sub_801E668 -sub_801E668: @ 801E668 - push {r4,lr} - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r2, r1, 0 - cmp r0, 0x4 - bhi _0801E75C - lsls r0, 2 - ldr r1, =_0801E688 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E688: - .4byte _0801E69C - .4byte _0801E6C8 - .4byte _0801E6F0 - .4byte _0801E724 - .4byte _0801E748 -_0801E69C: - ldr r0, =sub_801F2B4 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0801E75C - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r0, [r0, 0x13] - cmp r0, 0 - beq _0801E6BA - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC -_0801E6BA: - ldr r1, [r4] - b _0801E73A - .pool -_0801E6C8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E75C - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r0, [r0, 0x13] - cmp r0, 0 - beq _0801E6E6 - movs r0, 0x13 - movs r1, 0 - bl sub_801F5EC -_0801E6E6: - ldr r1, [r4] - b _0801E73A - .pool -_0801E6F0: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0801E75C - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801E75C - bl sub_8011A9C - adds r4, r0, 0 - cmp r4, 0 - bne _0801E75C - bl sub_800AC34 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - strh r4, [r1, 0xA] - b _0801E73A - .pool -_0801E724: - ldr r1, [r2] - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bhi _0801E730 - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E730: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E75C - ldr r1, [r2] -_0801E73A: - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E75C - .pool -_0801E748: - ldr r1, [r2] - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bls _0801E758 - movs r0, 0x9 - bl sub_801EBD4 - b _0801E75C -_0801E758: - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E75C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801E668 - - thumb_func_start sub_801E764 -sub_801E764: @ 801E764 - push {r4,lr} - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r4, r1, 0 - cmp r0, 0x4 - bhi _0801E830 - lsls r0, 2 - ldr r1, =_0801E784 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E784: - .4byte _0801E798 - .4byte _0801E7C0 - .4byte _0801E7F4 - .4byte _0801E802 - .4byte _0801E820 -_0801E798: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E7AC - movs r0, 0x1 - bl sub_801EBD4 - b _0801E830 - .pool -_0801E7AC: - ldr r0, [r4] - movs r1, 0xC8 - lsls r1, 1 - adds r0, r1 - bl sub_801EF4C - ldr r1, [r4] - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] -_0801E7C0: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0801E830 - bl sub_8011A9C - cmp r0, 0 - bne _0801E830 - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - movs r0, 0xC8 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0801E830 - ldr r1, [r4] - b _0801E812 - .pool -_0801E7F4: - bl sub_801EE10 - movs r0, 0x8 - movs r1, 0 - bl sub_801F5EC - b _0801E80E -_0801E802: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E830 -_0801E80E: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] -_0801E812: - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E830 - .pool -_0801E820: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0801E830 - movs r0, 0x1 - bl sub_801EBD4 -_0801E830: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801E764 - - thumb_func_start sub_801E838 -sub_801E838: @ 801E838 - push {r4,lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrh r0, [r0, 0x6] - cmp r0, 0x6 - bls _0801E846 - b _0801E968 -_0801E846: - lsls r0, 2 - ldr r1, =_0801E858 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E858: - .4byte _0801E874 - .4byte _0801E8A4 - .4byte _0801E8F8 - .4byte _0801E910 - .4byte _0801E920 - .4byte _0801E934 - .4byte _0801E94C -_0801E874: - bl sub_801EDC4 - cmp r0, 0 - beq _0801E890 - movs r0, 0x9 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x2 - b _0801E966 - .pool -_0801E890: - movs r0, 0xD - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x5 - b _0801E966 - .pool -_0801E8A4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801E8CC - bl sub_801EDE0 - movs r0, 0xB - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 - b _0801E966 - .pool -_0801E8CC: - movs r4, 0x2 - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _0801E8DA - movs r0, 0xA - b _0801E95A -_0801E8DA: - bl sub_801EBE4 - cmp r0, 0 - beq _0801E968 - movs r0, 0x1 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - strh r4, [r0, 0x6] - b _0801E968 - .pool -_0801E8F8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E968 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x1 - b _0801E966 - .pool -_0801E910: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E968 - movs r0, 0xA - b _0801E95A -_0801E920: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E968 - movs r0, 0x1 - bl sub_801EBD4 - b _0801E968 -_0801E934: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E968 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x6 - b _0801E966 - .pool -_0801E94C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0801E968 - movs r0, 0x7 -_0801E95A: - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x4 -_0801E966: - strh r0, [r1, 0x6] -_0801E968: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801E838 - - thumb_func_start sub_801E978 -sub_801E978: @ 801E978 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r4, r1, 0 - cmp r0, 0xD - bls _0801E98A - b _0801EBC2 -_0801E98A: - lsls r0, 2 - ldr r1, =_0801E99C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E99C: - .4byte _0801E9D4 - .4byte _0801E9EE - .4byte _0801EA14 - .4byte _0801EA58 - .4byte _0801EA7C - .4byte _0801EA98 - .4byte _0801EADC - .4byte _0801EB04 - .4byte _0801EB28 - .4byte _0801EB40 - .4byte _0801EB64 - .4byte _0801EB72 - .4byte _0801EB88 - .4byte _0801EBA8 -_0801E9D4: - ldr r1, [r4] - ldrb r0, [r1, 0x18] - cmp r0, 0 - bne _0801E9DE - b _0801EB82 -_0801E9DE: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r1, [r4] - movs r0, 0x1 - strh r0, [r1, 0x6] - b _0801EBC2 -_0801E9EE: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E9FC - b _0801EBC2 -_0801E9FC: - movs r0, 0xE - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x2 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EA14: - bl sub_801FF08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801EA40 - cmp r1, 0 - bgt _0801EA2E - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801EA34 - b _0801EBC2 -_0801EA2E: - cmp r1, 0x1 - beq _0801EA34 - b _0801EBC2 -_0801EA34: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801EB82 - .pool -_0801EA40: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EA58: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801EA66 - b _0801EBC2 -_0801EA66: - movs r0, 0xF - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x4 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EA7C: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801EA8A - b _0801EBC2 -_0801EA8A: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x5 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EA98: - bl sub_801FF08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801EAC4 - cmp r1, 0 - bgt _0801EAB2 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801EAB8 - b _0801EBC2 -_0801EAB2: - cmp r1, 0x1 - beq _0801EAB8 - b _0801EBC2 -_0801EAB8: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801EB82 - .pool -_0801EAC4: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x6 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EADC: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801EBC2 - movs r0, 0x10 - movs r1, 0 - bl sub_801F5EC - bl sub_801EE2C - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x7 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EB04: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801EBC2 - bl sub_8076D5C - movs r0, 0 - bl TrySavingData - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x8 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EB28: - movs r0, 0x11 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x9 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EB40: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801EBC2 - movs r0, 0x37 - bl PlaySE - bl sav2_gender2_inplace_and_xFE - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0xA - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EB64: - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0x19] - ldr r1, [r4] - movs r0, 0xB - strh r0, [r1, 0x6] - b _0801EBC2 -_0801EB72: - ldr r0, [r4] - ldrb r1, [r0, 0x19] - adds r1, 0x1 - strb r1, [r0, 0x19] - ldr r1, [r4] - ldrb r0, [r1, 0x19] - cmp r0, 0x78 - bls _0801EBC2 -_0801EB82: - movs r0, 0xC - strh r0, [r1, 0x6] - b _0801EBC2 -_0801EB88: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0xD - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EBA8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0801EBC2 - bl sub_801F544 - bl sub_801DE30 - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 -_0801EBC2: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801E978 - - thumb_func_start sub_801EBD4 -sub_801EBD4: @ 801EBD4 - ldr r1, =gUnknown_02022C84 - ldr r1, [r1] - movs r2, 0 - strh r0, [r1, 0x4] - strh r2, [r1, 0x6] - bx lr - .pool - thumb_func_end sub_801EBD4 - - thumb_func_start sub_801EBE4 -sub_801EBE4: @ 801EBE4 - push {lr} - ldr r0, =gMain - ldrh r2, [r0, 0x30] - movs r0, 0x40 - ands r0, r2 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0 - bne _0801EC6E - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _0801EC24 - ldr r0, =gUnknown_02022C84 - ldr r2, [r0] - ldr r1, =gUnknown_082F2AA4 - ldrb r0, [r2, 0x10] - adds r0, r1 - ldrb r1, [r2, 0x12] - ldrb r0, [r0] - cmp r1, r0 - bcs _0801EC20 - adds r0, r1, 0x1 - b _0801EC88 - .pool -_0801EC20: - strb r3, [r2, 0x12] - b _0801EC8A -_0801EC24: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrb r0, [r1, 0x10] - cmp r0, 0x3 - beq _0801EC6A - movs r0, 0x20 - ands r0, r2 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0 - beq _0801EC52 - ldrb r0, [r1, 0x11] - cmp r0, 0 - beq _0801EC4C - subs r0, 0x1 - strb r0, [r1, 0x11] - b _0801EC8A - .pool -_0801EC4C: - movs r0, 0x4 - strb r0, [r1, 0x11] - b _0801EC8A -_0801EC52: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _0801EC6A - ldrb r0, [r1, 0x11] - cmp r0, 0x3 - bhi _0801EC66 - adds r0, 0x1 - strb r0, [r1, 0x11] - b _0801EC8A -_0801EC66: - strb r3, [r1, 0x11] - b _0801EC8A -_0801EC6A: - movs r0, 0 - b _0801EC8C -_0801EC6E: - ldr r0, =gUnknown_02022C84 - ldr r2, [r0] - ldrb r0, [r2, 0x12] - cmp r0, 0 - beq _0801EC80 - subs r0, 0x1 - b _0801EC88 - .pool -_0801EC80: - ldr r0, =gUnknown_082F2AA4 - ldrb r1, [r2, 0x10] - adds r1, r0 - ldrb r0, [r1] -_0801EC88: - strb r0, [r2, 0x12] -_0801EC8A: - movs r0, 0x1 -_0801EC8C: - pop {r1} - bx r1 - .pool - thumb_func_end sub_801EBE4 - - thumb_func_start sub_801EC94 -sub_801EC94: @ 801EC94 - push {r4-r6,lr} - sub sp, 0x18 - ldr r0, =gUnknown_02022C84 - ldr r5, [r0] - ldrb r0, [r5, 0x10] - cmp r0, 0x3 - beq _0801ECDC - ldr r3, =gUnknown_082F2BA8 - ldrb r1, [r5, 0x12] - lsls r1, 2 - adds r2, r0, 0 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0 - adds r1, r3 - ldr r4, [r1] - ldrb r0, [r5, 0x11] - cmp r0, 0 - beq _0801ECCE - adds r1, r0, 0 -_0801ECBE: - ldrb r0, [r4] - cmp r0, 0xF9 - bne _0801ECC6 - adds r4, 0x1 -_0801ECC6: - adds r4, 0x1 - subs r1, 0x1 - cmp r1, 0 - bne _0801ECBE -_0801ECCE: - movs r5, 0x1 - b _0801ED02 - .pool -_0801ECDC: - ldrb r0, [r5, 0x12] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, r0 - adds r1, 0xB9 - adds r1, r5, r1 - mov r0, sp - bl StringCopy - movs r1, 0 - strb r1, [r0] - movs r1, 0xFF - strb r1, [r0, 0x1] - mov r4, sp - mov r0, sp - bl StringLength_Multibyte - adds r5, r0, 0 -_0801ED02: - ldr r6, =gUnknown_02022C84 - ldr r1, [r6] - ldrb r0, [r1, 0x15] - strb r0, [r1, 0x14] - cmp r4, 0 - beq _0801ED5A - bl sub_801EE84 - adds r2, r0, 0 - subs r5, 0x1 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _0801ED56 - ldr r0, [r6] - ldrb r0, [r0, 0x15] - cmp r0, 0xE - bhi _0801ED56 - adds r3, r6, 0 -_0801ED28: - ldrb r0, [r4] - cmp r0, 0xF9 - bne _0801ED34 - strb r0, [r2] - adds r4, 0x1 - adds r2, 0x1 -_0801ED34: - ldrb r0, [r4] - strb r0, [r2] - adds r4, 0x1 - adds r2, 0x1 - ldr r1, [r3] - ldrb r0, [r1, 0x15] - adds r0, 0x1 - strb r0, [r1, 0x15] - subs r5, 0x1 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _0801ED56 - ldr r0, [r3] - ldrb r0, [r0, 0x15] - cmp r0, 0xE - bls _0801ED28 -_0801ED56: - movs r0, 0xFF - strb r0, [r2] -_0801ED5A: - add sp, 0x18 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EC94 - - thumb_func_start sub_801ED68 -sub_801ED68: @ 801ED68 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - ldrb r0, [r1, 0x15] - strb r0, [r1, 0x14] - ldr r0, [r4] - ldrb r0, [r0, 0x15] - cmp r0, 0 - beq _0801ED8A - bl sub_801EEA8 - movs r1, 0xFF - strb r1, [r0] - ldr r1, [r4] - ldrb r0, [r1, 0x15] - subs r0, 0x1 - strb r0, [r1, 0x15] -_0801ED8A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801ED68 - - thumb_func_start sub_801ED94 -sub_801ED94: @ 801ED94 - push {lr} - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrb r0, [r1, 0x15] - subs r0, 0x1 - strb r0, [r1, 0x14] - bl sub_801EEA8 - adds r2, r0, 0 - ldrb r0, [r2] - cmp r0, 0xF9 - beq _0801EDB8 - ldr r1, =gUnknown_082F2AA8 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0801EDB8 - strb r0, [r2] -_0801EDB8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801ED94 - - thumb_func_start sub_801EDC4 -sub_801EDC4: @ 801EDC4 - push {lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x15] - cmp r0, 0 - bne _0801EDD8 - movs r0, 0 - b _0801EDDA - .pool -_0801EDD8: - movs r0, 0x1 -_0801EDDA: - pop {r1} - bx r1 - thumb_func_end sub_801EDC4 - - thumb_func_start sub_801EDE0 -sub_801EDE0: @ 801EDE0 - push {r4,lr} - bl sub_801F114 - adds r1, r0, 0 - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r3, [r0, 0x12] - lsls r2, r3, 2 - adds r2, r3 - lsls r2, 2 - adds r2, r3 - adds r2, 0xB9 - adds r0, r2 - bl StringCopy - ldr r1, [r4] - movs r0, 0x1 - strb r0, [r1, 0x18] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EDE0 - - thumb_func_start sub_801EE10 -sub_801EE10: @ 801EE10 - ldr r1, =gUnknown_02022C84 - ldr r2, [r1] - movs r0, 0xFF - strb r0, [r2, 0x1A] - ldr r2, [r1] - movs r3, 0 - movs r0, 0xF - strb r0, [r2, 0x14] - ldr r0, [r1] - strb r3, [r0, 0x15] - bx lr - .pool - thumb_func_end sub_801EE10 - - thumb_func_start sub_801EE2C -sub_801EE2C: @ 801EE2C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gSaveBlock1Ptr - mov r8, r0 - ldr r7, =gUnknown_02022C84 - movs r6, 0xB9 - ldr r5, =0x00003c88 - movs r4, 0x9 -_0801EE3E: - mov r1, r8 - ldr r0, [r1] - adds r0, r5 - ldr r1, [r7] - adds r1, r6 - bl StringCopy - adds r6, 0x15 - adds r5, 0x15 - subs r4, 0x1 - cmp r4, 0 - bge _0801EE3E - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EE2C - - thumb_func_start sub_801EE6C -sub_801EE6C: @ 801EE6C - ldr r2, =gUnknown_02022C84 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, r0 - adds r1, 0xB9 - ldr r0, [r2] - adds r0, r1 - bx lr - .pool - thumb_func_end sub_801EE6C - - thumb_func_start sub_801EE84 -sub_801EE84: @ 801EE84 - push {lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x1A - ldrb r0, [r0, 0x1A] - cmp r0, 0xFF - beq _0801EE9C -_0801EE94: - adds r1, 0x1 - ldrb r0, [r1] - cmp r0, 0xFF - bne _0801EE94 -_0801EE9C: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_801EE84 - - thumb_func_start sub_801EEA8 -sub_801EEA8: @ 801EEA8 - push {lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r2, r0, 0 - adds r2, 0x1A - adds r1, r2, 0 - ldrb r0, [r0, 0x1A] - cmp r0, 0xFF - beq _0801EECC -_0801EEBA: - adds r2, r1, 0 - ldrb r0, [r2] - cmp r0, 0xF9 - bne _0801EEC4 - adds r1, r2, 0x1 -_0801EEC4: - adds r1, 0x1 - ldrb r0, [r1] - cmp r0, 0xFF - bne _0801EEBA -_0801EECC: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_801EEA8 - - thumb_func_start sub_801EED8 -sub_801EED8: @ 801EED8 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - adds r0, 0x1A - bl StringLength_Multibyte - adds r2, r0, 0 - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0x1A - movs r4, 0 - cmp r2, 0xA - bls _0801EF0C - subs r2, 0xA - movs r3, 0 - cmp r4, r2 - bcs _0801EF0C -_0801EEFA: - ldrb r0, [r1] - cmp r0, 0xF9 - bne _0801EF02 - adds r1, 0x1 -_0801EF02: - adds r1, 0x1 - adds r4, 0x1 - adds r3, 0x1 - cmp r3, r2 - bcc _0801EEFA -_0801EF0C: - lsls r0, r4, 16 - lsrs r0, 16 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801EED8 - - thumb_func_start sub_801EF1C -sub_801EF1C: @ 801EF1C - movs r1, 0 - strb r1, [r0] - bx lr - thumb_func_end sub_801EF1C - - thumb_func_start sub_801EF24 -sub_801EF24: @ 801EF24 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - strb r0, [r4, 0x9] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EF24 - - thumb_func_start sub_801EF4C -sub_801EF4C: @ 801EF4C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - adds r4, 0x9 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - adds r1, 0x1A - adds r0, r4, 0 - bl StringCopy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EF4C - - thumb_func_start sub_801EF7C -sub_801EF7C: @ 801EF7C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - strb r0, [r4, 0x9] - bl sub_8011A50 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EF7C - - thumb_func_start sub_801EFA8 -sub_801EFA8: @ 801EFA8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x4 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - strb r0, [r4, 0x9] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EFA8 - - thumb_func_start sub_801EFD0 -sub_801EFD0: @ 801EFD0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x5 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - strb r0, [r4, 0x9] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EFD0 - - thumb_func_start sub_801EFF8 -sub_801EFF8: @ 801EFF8 - push {r4-r6,lr} - adds r6, r0, 0 - adds r5, r1, 0 - ldrb r0, [r5] - adds r1, r0, 0 - adds r4, r5, 0x1 - adds r5, r4, 0 - adds r5, 0x8 - cmp r0, 0x2 - beq _0801F020 - cmp r0, 0x2 - bgt _0801F016 - cmp r0, 0x1 - beq _0801F044 - b _0801F0A8 -_0801F016: - cmp r1, 0x3 - beq _0801F07A - cmp r1, 0x5 - beq _0801F06E - b _0801F0A8 -_0801F020: - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - ldrb r1, [r4, 0x8] - cmp r0, r1 - beq _0801F0A8 - bl sub_81AFBF0 - movs r0, 0 - adds r1, r4, 0 - bl sub_81AFC0C - ldr r1, =gText_F700JoinedChat - b _0801F094 - .pool -_0801F044: - adds r0, r6, 0 - adds r1, r4, 0 - bl StringCopy - movs r1, 0xFC - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x13 - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x2A - strb r1, [r0] - adds r0, 0x1 - movs r1, 0xF0 - strb r1, [r0] - adds r0, 0x1 - adds r1, r5, 0 - bl StringCopy - movs r0, 0x1 - b _0801F0AA -_0801F06E: - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r0, 0x79 - adds r1, r4, 0 - bl StringCopy -_0801F07A: - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - ldrb r5, [r5] - cmp r0, r5 - beq _0801F0A8 - bl sub_81AFBF0 - movs r0, 0 - adds r1, r4, 0 - bl sub_81AFC0C - ldr r1, =gText_F700LeftChat -_0801F094: - adds r0, r6, 0 - bl sub_81AFC28 - movs r0, 0x1 - b _0801F0AA - .pool -_0801F0A8: - movs r0, 0 -_0801F0AA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801EFF8 - - thumb_func_start sub_801F0B0 -sub_801F0B0: @ 801F0B0 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x10] - bx lr - .pool - thumb_func_end sub_801F0B0 - - thumb_func_start sub_801F0BC -sub_801F0BC: @ 801F0BC - ldr r2, =gUnknown_02022C84 - ldr r3, [r2] - ldrb r2, [r3, 0x11] - strb r2, [r0] - ldrb r0, [r3, 0x12] - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_801F0BC - - thumb_func_start sub_801F0D0 -sub_801F0D0: @ 801F0D0 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r0, 0x1A - bx lr - .pool - thumb_func_end sub_801F0D0 - - thumb_func_start sub_801F0DC -sub_801F0DC: @ 801F0DC - push {lr} - bl sub_801F0D0 - bl StringLength_Multibyte - pop {r1} - bx r1 - thumb_func_end sub_801F0DC - - thumb_func_start sub_801F0EC -sub_801F0EC: @ 801F0EC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r3, [r0, 0x15] - ldrb r2, [r0, 0x14] - subs r0, r3, r2 - cmp r0, 0 - bge _0801F108 - negs r0, r0 - str r3, [r4] - b _0801F10A - .pool -_0801F108: - str r2, [r4] -_0801F10A: - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801F0EC - - thumb_func_start sub_801F114 -sub_801F114: @ 801F114 - push {lr} - bl sub_801EED8 - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x1A - cmp r2, 0 - beq _0801F13A -_0801F12A: - ldrb r0, [r1] - cmp r0, 0xF9 - bne _0801F132 - adds r1, 0x1 -_0801F132: - adds r1, 0x1 - subs r2, 0x1 - cmp r2, 0 - bne _0801F12A -_0801F13A: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_801F114 - - thumb_func_start sub_801F144 -sub_801F144: @ 801F144 - push {r4,lr} - bl sub_801EED8 - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x1A - movs r2, 0 - movs r3, 0 - cmp r2, r4 - bcs _0801F174 -_0801F15E: - ldrb r0, [r1] - cmp r0, 0xF9 - bne _0801F166 - adds r1, 0x1 -_0801F166: - adds r1, 0x1 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - adds r3, 0x1 - cmp r3, r4 - bcc _0801F15E -_0801F174: - adds r0, r2, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801F144 - - thumb_func_start sub_801F180 -sub_801F180: @ 801F180 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r0, 0x39 - bx lr - .pool - thumb_func_end sub_801F180 - - thumb_func_start sub_801F18C -sub_801F18C: @ 801F18C - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x16] - bx lr - .pool - thumb_func_end sub_801F18C - - thumb_func_start sub_801F198 -sub_801F198: @ 801F198 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x15] - bx lr - .pool - thumb_func_end sub_801F198 - - thumb_func_start sub_801F1A4 -sub_801F1A4: @ 801F1A4 - push {lr} - bl sub_801EEA8 - ldrb r1, [r0] - cmp r1, 0xFF - bhi _0801F1BE - ldr r0, =gUnknown_082F2AA8 - adds r0, r1, r0 - ldrb r0, [r0] - cmp r0, r1 - beq _0801F1BE - cmp r0, 0 - bne _0801F1C8 -_0801F1BE: - movs r0, 0x3 - b _0801F1CA - .pool -_0801F1C8: - movs r0, 0 -_0801F1CA: - pop {r1} - bx r1 - thumb_func_end sub_801F1A4 - - thumb_func_start sub_801F1D0 -sub_801F1D0: @ 801F1D0 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r0, 0x79 - bx lr - .pool - thumb_func_end sub_801F1D0 - - thumb_func_start copy_strings_to_sav1 -copy_strings_to_sav1: @ 801F1DC - push {r4,lr} - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r1, =0x00003c88 - adds r0, r1 - ldr r1, =gText_Hello - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003c9d - adds r0, r1 - ldr r1, =gText_Pokemon2 - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003cb2 - adds r0, r1 - ldr r1, =gText_Trade - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003cc7 - adds r0, r1 - ldr r1, =gText_Battle - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003cdc - adds r0, r1 - ldr r1, =gText_Lets - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003cf1 - adds r0, r1 - ldr r1, =gText_Ok - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003d06 - adds r0, r1 - ldr r1, =gText_Sorry - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003d1b - adds r0, r1 - ldr r1, =gText_YayUnkF9F9 - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003d30 - adds r0, r1 - ldr r1, =gText_ThankYou - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003d45 - adds r0, r1 - ldr r1, =gText_ByeBye - bl StringCopy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end copy_strings_to_sav1 - - thumb_func_start sub_801F2B4 -sub_801F2B4: @ 801F2B4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0x7 - bls _0801F2CE - b _0801F4C4 -_0801F2CE: - lsls r0, 2 - ldr r1, =_0801F2E0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801F2E0: - .4byte _0801F300 - .4byte _0801F30E - .4byte _0801F4A8 - .4byte _0801F35C - .4byte _0801F448 - .4byte _0801F480 - .4byte _0801F494 - .4byte _0801F438 -_0801F300: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801F30A - b _0801F49C -_0801F30A: - movs r0, 0x1 - strh r0, [r4] -_0801F30E: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - strh r0, [r4, 0x8] - ldr r3, =gUnknown_02022C84 - ldr r0, [r3] - ldrb r1, [r0, 0xD] - movs r5, 0x8 - ldrsh r0, [r4, r5] - cmp r1, r0 - beq _0801F33C - movs r0, 0x2 - strh r0, [r4] - ldr r0, [r3] - strb r2, [r0, 0xD] - b _0801F4C4 - .pool -_0801F33C: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x6] - cmp r0, 0 - bne _0801F354 - bl sub_8011A9C - cmp r0, 0 - beq _0801F354 - b _0801F4C4 -_0801F354: - movs r0, 0 - strh r0, [r4, 0x2] - movs r0, 0x3 - strh r0, [r4] -_0801F35C: - movs r1, 0x2 - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bgt _0801F396 - movs r2, 0x6 - ldrsh r0, [r4, r2] - movs r3, 0x2 - ldrsh r1, [r4, r3] - asrs r0, r1 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801F396 - movs r2, 0x1 -_0801F378: - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - bgt _0801F396 - movs r5, 0x6 - ldrsh r0, [r4, r5] - movs r3, 0x2 - ldrsh r1, [r4, r3] - asrs r0, r1 - ands r0, r2 - cmp r0, 0 - beq _0801F378 -_0801F396: - ldrh r1, [r4, 0x2] - movs r5, 0x2 - ldrsh r0, [r4, r5] - cmp r0, 0x5 - bne _0801F3A2 - b _0801F4C0 -_0801F3A2: - strh r1, [r4, 0x4] - lsls r0, r1, 24 - lsrs r0, 24 - bl ResetBlockReceivedFlag - movs r1, 0x2 - ldrsh r0, [r4, r1] - lsls r0, 8 - ldr r1, =gBlockRecvBuffer - adds r0, r1 - ldrb r0, [r0] - subs r0, 0x1 - cmp r0, 0x4 - bhi _0801F3E4 - lsls r0, 2 - ldr r1, =_0801F3D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801F3D0: - .4byte _0801F3E4 - .4byte _0801F3E8 - .4byte _0801F3EC - .4byte _0801F3F0 - .4byte _0801F3F4 -_0801F3E4: - movs r0, 0x3 - b _0801F3F6 -_0801F3E8: - movs r0, 0x3 - b _0801F3F6 -_0801F3EC: - movs r0, 0x4 - b _0801F3F6 -_0801F3F0: - movs r0, 0x5 - b _0801F3F6 -_0801F3F4: - movs r0, 0x6 -_0801F3F6: - strh r0, [r4, 0xA] - ldr r5, =gUnknown_02022C84 - ldr r0, [r5] - adds r0, 0x39 - movs r2, 0x2 - ldrsh r1, [r4, r2] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - bl sub_801EFF8 - cmp r0, 0 - beq _0801F42C - ldr r0, [r5] - ldrh r1, [r4, 0x2] - strb r1, [r0, 0x16] - movs r0, 0xC - movs r1, 0x2 - bl sub_801F5EC - movs r0, 0x7 - b _0801F42E - .pool -_0801F42C: - ldrh r0, [r4, 0xA] -_0801F42E: - strh r0, [r4] - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - b _0801F4C4 -_0801F438: - movs r0, 0x2 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801F4C4 - ldrh r0, [r4, 0xA] - b _0801F4C2 -_0801F448: - ldr r6, =gUnknown_02022C84 - ldr r0, [r6] - ldrb r0, [r0, 0x13] - cmp r0, 0 - bne _0801F47C - movs r3, 0x4 - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _0801F47C - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _0801F474 - bl sub_80104B0 - ldr r1, [r6] - movs r0, 0x1 - b _0801F49A - .pool -_0801F474: - movs r5, 0x4 - ldrsh r0, [r4, r5] - bl sub_8011DE0 -_0801F47C: - movs r0, 0x3 - b _0801F4C2 -_0801F480: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrb r0, [r1, 0x13] - cmp r0, 0 - beq _0801F49C - movs r0, 0x2 - b _0801F49A - .pool -_0801F494: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 -_0801F49A: - strb r0, [r1, 0x17] -_0801F49C: - adds r0, r5, 0 - bl DestroyTask - b _0801F4C4 - .pool -_0801F4A8: - bl sub_8011A9C - cmp r0, 0 - bne _0801F4C4 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _0801F4C0 - ldrb r0, [r1, 0xD] - bl sub_80110B8 -_0801F4C0: - movs r0, 0x1 -_0801F4C2: - strh r0, [r4] -_0801F4C4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801F2B4 - - thumb_func_start sub_801F4D0 -sub_801F4D0: @ 801F4D0 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, =0x00002168 - bl Alloc - str r0, [r4] - cmp r0, 0 - beq _0801F52C - bl sub_8020890 - cmp r0, 0 - beq _0801F52C - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F2C60 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r0, =gUnknown_082F2C70 - bl InitWindows - bl reset_temp_tile_data_buffers - bl sub_8020770 - ldr r0, [r4] - bl sub_801F574 - bl sub_801F580 - movs r0, 0 - movs r1, 0 - bl sub_801F5EC - movs r0, 0x1 - b _0801F52E - .pool -_0801F52C: - movs r0, 0 -_0801F52E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F4D0 - - thumb_func_start sub_801F534 -sub_801F534: @ 801F534 - push {lr} - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_801F534 - - thumb_func_start sub_801F544 -sub_801F544: @ 801F544 - push {r4,lr} - bl sub_80208D0 - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - cmp r0, 0 - beq _0801F55A - bl Free - movs r0, 0 - str r0, [r4] -_0801F55A: - bl FreeAllWindowBuffers - ldr r1, =gUnknown_02039B28 - movs r0, 0x3 - strb r0, [r1, 0x15] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801F544 - - thumb_func_start sub_801F574 -sub_801F574: @ 801F574 - movs r2, 0 - movs r1, 0xFF - strh r1, [r0, 0x18] - strh r1, [r0, 0x1E] - strh r2, [r0, 0x1A] - bx lr - thumb_func_end sub_801F574 - - thumb_func_start sub_801F580 -sub_801F580: @ 801F580 - push {r4,r5,lr} - ldr r1, =gUnknown_02022C88 - ldr r0, [r1] - cmp r0, 0 - beq _0801F5A8 - movs r2, 0 - adds r4, r1, 0 - ldr r5, =sub_801FDD8 - movs r3, 0 -_0801F592: - ldr r0, [r4] - lsls r1, r2, 3 - adds r0, r1 - str r5, [r0] - strb r3, [r0, 0x4] - ldr r0, [r4] - adds r0, r1 - strb r3, [r0, 0x5] - adds r2, 0x1 - cmp r2, 0x2 - ble _0801F592 -_0801F5A8: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801F580 - - thumb_func_start sub_801F5B8 -sub_801F5B8: @ 801F5B8 - push {r4-r6,lr} - ldr r1, =gUnknown_02022C88 - ldr r0, [r1] - cmp r0, 0 - beq _0801F5E0 - movs r5, 0 - adds r6, r1, 0 -_0801F5C6: - ldr r1, [r6] - lsls r4, r5, 3 - adds r1, r4 - adds r0, r1, 0x5 - ldr r1, [r1] - bl _call_via_r1 - ldr r1, [r6] - adds r1, r4 - strb r0, [r1, 0x4] - adds r5, 0x1 - cmp r5, 0x2 - ble _0801F5C6 -_0801F5E0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801F5B8 - - thumb_func_start sub_801F5EC -sub_801F5EC: @ 801F5EC - push {r4-r7,lr} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 24 - ldr r3, =gUnknown_02022C88 - ldr r0, [r3] - lsrs r1, 21 - adds r0, r1 - ldr r2, =sub_801FDD8 - str r2, [r0] - movs r4, 0 - adds r5, r3, 0 - adds r3, r1, 0 - mov r12, r4 - ldr r1, =gUnknown_082F2C98 - movs r7, 0x1 - adds r2, r1, 0x4 -_0801F60E: - ldrh r0, [r1] - cmp r0, r6 - bne _0801F634 - ldr r1, [r5] - adds r1, r3 - ldr r0, [r2] - str r0, [r1] - strb r7, [r1, 0x4] - ldr r0, [r5] - adds r0, r3 - mov r1, r12 - strb r1, [r0, 0x5] - b _0801F63E - .pool -_0801F634: - adds r1, 0x8 - adds r2, 0x8 - adds r4, 0x1 - cmp r4, 0x14 - bls _0801F60E -_0801F63E: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801F5EC - - thumb_func_start sub_801F644 -sub_801F644: @ 801F644 - lsls r0, 24 - ldr r1, =gUnknown_02022C88 - ldr r1, [r1] - lsrs r0, 21 - adds r1, r0 - ldrb r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_801F644 - - thumb_func_start sub_801F658 -sub_801F658: @ 801F658 - push {r4,lr} - adds r4, r0, 0 - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0801F6EE - ldrb r0, [r4] - cmp r0, 0x6 - bhi _0801F6E4 - lsls r0, 2 - ldr r1, =_0801F67C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801F67C: - .4byte _0801F698 - .4byte _0801F6A2 - .4byte _0801F6A8 - .4byte _0801F6AE - .4byte _0801F6B4 - .4byte _0801F6BA - .4byte _0801F6CC -_0801F698: - bl sub_8020480 - bl sub_8020538 - b _0801F6E8 -_0801F6A2: - bl sub_8020584 - b _0801F6E8 -_0801F6A8: - bl sub_80205B4 - b _0801F6E8 -_0801F6AE: - bl task_tutorial_story_unknown - b _0801F6E8 -_0801F6B4: - bl sub_8020680 - b _0801F6E8 -_0801F6BA: - bl sub_80206A4 - bl sub_80206D0 - bl sub_8020740 - bl sub_80206E8 - b _0801F6E8 -_0801F6CC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F6E8 - bl sub_80208E8 - bl sub_8020A68 - bl sub_8020B20 - b _0801F6E8 -_0801F6E4: - movs r0, 0 - b _0801F6F0 -_0801F6E8: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_0801F6EE: - movs r0, 0x1 -_0801F6F0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F658 - - thumb_func_start sub_801F6F8 -sub_801F6F8: @ 801F6F8 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F708 - cmp r0, 0x1 - beq _0801F716 - b _0801F720 -_0801F708: - bl sub_80203B0 - movs r0, 0x3 - movs r1, 0x3 - bl CopyWindowToVram - b _0801F720 -_0801F716: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801F728 -_0801F720: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - movs r0, 0x1 -_0801F728: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F6F8 - - thumb_func_start sub_801F730 -sub_801F730: @ 801F730 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F740 - cmp r0, 0x1 - beq _0801F74E - b _0801F758 -_0801F740: - bl sub_802040C - movs r0, 0x3 - movs r1, 0x3 - bl CopyWindowToVram - b _0801F758 -_0801F74E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801F760 -_0801F758: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - movs r0, 0x1 -_0801F760: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F730 - - thumb_func_start sub_801F768 -sub_801F768: @ 801F768 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0x1 - beq _0801F79E - cmp r0, 0x1 - bgt _0801F77C - cmp r0, 0 - beq _0801F782 - b _0801F7C4 -_0801F77C: - cmp r0, 0x2 - beq _0801F7AA - b _0801F7C4 -_0801F782: - movs r0, 0x1 - bl sub_802091C - bl sub_8020320 - cmp r0, 0 - bne _0801F7CA - bl sub_80201A4 - movs r0, 0x2 - movs r1, 0x2 - bl CopyWindowToVram - b _0801F7C4 -_0801F79E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - beq _0801F7C4 - b _0801F7CA -_0801F7AA: - bl sub_8020368 - cmp r0, 0 - bne _0801F7CA - bl sub_802093C - movs r0, 0 - bl sub_802091C - bl sub_8020B80 - movs r0, 0 - b _0801F7CC -_0801F7C4: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_0801F7CA: - movs r0, 0x1 -_0801F7CC: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F768 - - thumb_func_start sub_801F7D4 -sub_801F7D4: @ 801F7D4 - push {lr} - bl sub_802093C - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_801F7D4 - - thumb_func_start sub_801F7E0 -sub_801F7E0: @ 801F7E0 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F7F0 - cmp r0, 0x1 - beq _0801F814 - b _0801F81E -_0801F7F0: - movs r0, 0 - movs r1, 0 - bl sub_801FF18 - movs r0, 0x17 - movs r1, 0xB - movs r2, 0x1 - bl sub_801FDDC - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - b _0801F81E - .pool -_0801F814: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801F826 -_0801F81E: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - movs r0, 0x1 -_0801F826: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F7E0 - - thumb_func_start sub_801F82C -sub_801F82C: @ 801F82C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F83C - cmp r0, 0x1 - beq _0801F84C - b _0801F862 -_0801F83C: - bl sub_8020094 - bl sub_801FEBC - movs r0, 0 - bl CopyBgTilemapBufferToVram - b _0801F862 -_0801F84C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F868 - bl sub_80200C8 - bl sub_801FEE4 - movs r0, 0 - b _0801F86A -_0801F862: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_0801F868: - movs r0, 0x1 -_0801F86A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F82C - - thumb_func_start sub_801F870 -sub_801F870: @ 801F870 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F882 - cmp r0, 0x1 - beq _0801F8BA - b _0801F8CC -_0801F882: - add r1, sp, 0x8 - add r0, sp, 0x4 - bl sub_801F0EC - ldr r0, [sp, 0x4] - lsls r0, 16 - lsrs r0, 16 - ldr r1, [sp, 0x8] - lsls r1, 16 - lsrs r1, 16 - movs r2, 0 - bl sub_80200EC - bl sub_801F0D0 - adds r1, r0, 0 - movs r0, 0x2 - str r0, [sp] - movs r0, 0 - movs r2, 0x3 - movs r3, 0x1 - bl sub_8020118 - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - b _0801F8CC -_0801F8BA: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F8D2 - bl sub_8020B80 - movs r0, 0 - b _0801F8D4 -_0801F8CC: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_0801F8D2: - movs r0, 0x1 -_0801F8D4: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F870 - - thumb_func_start sub_801F8DC -sub_801F8DC: @ 801F8DC - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldrb r0, [r6] - cmp r0, 0x1 - beq _0801F938 - cmp r0, 0x1 - bgt _0801F8F2 - cmp r0, 0 - beq _0801F8FC - b _0801F972 -_0801F8F2: - cmp r0, 0x2 - beq _0801F95C - cmp r0, 0x3 - beq _0801F96E - b _0801F972 -_0801F8FC: - bl sub_801F144 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_801F114 - adds r5, r0, 0 - bl StringLength_Multibyte - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0x66 - bl sub_80200EC - movs r0, 0x5 - str r0, [sp] - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - movs r3, 0x4 - bl sub_8020118 - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - b _0801F972 -_0801F938: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F978 - movs r0, 0x1 - movs r1, 0x10 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - b _0801F972 - .pool -_0801F95C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F978 - movs r0, 0x1 - bl sub_80209AC - b _0801F972 -_0801F96E: - movs r0, 0 - b _0801F97A -_0801F972: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_0801F978: - movs r0, 0x1 -_0801F97A: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801F8DC - - thumb_func_start sub_801F984 -sub_801F984: @ 801F984 - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldrb r0, [r6] - cmp r0, 0x1 - beq _0801F9E0 - cmp r0, 0x1 - bgt _0801F99A - cmp r0, 0 - beq _0801F9A4 - b _0801FA1A -_0801F99A: - cmp r0, 0x2 - beq _0801FA00 - cmp r0, 0x3 - beq _0801FA16 - b _0801FA1A -_0801F9A4: - bl sub_801F144 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_801F114 - adds r5, r0, 0 - bl StringLength_Multibyte - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0 - bl sub_80200EC - movs r0, 0x2 - str r0, [sp] - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0x3 - movs r3, 0x1 - bl sub_8020118 - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - b _0801FA1A -_0801F9E0: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801FA20 - bl sub_8020094 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - b _0801FA1A - .pool -_0801FA00: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801FA20 - movs r0, 0 - bl sub_80209AC - bl sub_80200C8 - b _0801FA1A -_0801FA16: - movs r0, 0 - b _0801FA22 -_0801FA1A: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_0801FA20: - movs r0, 0x1 -_0801FA22: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801F984 - - thumb_func_start sub_801FA2C -sub_801FA2C: @ 801FA2C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FA3C - cmp r0, 0x1 - beq _0801FA50 - b _0801FA5E -_0801FA3C: - bl sub_80201A4 - movs r0, 0x2 - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FA5E -_0801FA50: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801FA5E - movs r0, 0 - b _0801FA60 -_0801FA5E: - movs r0, 0x1 -_0801FA60: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FA2C - - thumb_func_start sub_801FA68 -sub_801FA68: @ 801FA68 - push {r4-r6,lr} - adds r6, r0, 0 - ldrb r0, [r6] - cmp r0, 0x4 - bhi _0801FB3A - lsls r0, 2 - ldr r1, =_0801FA80 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801FA80: - .4byte _0801FA94 - .4byte _0801FAC0 - .4byte _0801FAF0 - .4byte _0801FB14 - .4byte _0801FADE -_0801FA94: - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrh r5, [r0, 0x1A] - bl sub_801F180 - adds r4, r0, 0 - bl sub_801F18C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8020420 - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - b _0801FB34 - .pool -_0801FAC0: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _0801FB3A - ldr r0, =gUnknown_02022C88 - ldr r1, [r0] - ldrh r0, [r1, 0x1A] - cmp r0, 0x8 - bhi _0801FAE8 - adds r0, 0x1 - strh r0, [r1, 0x1A] - movs r0, 0x4 - strb r0, [r6] -_0801FADE: - movs r0, 0 - b _0801FB3C - .pool -_0801FAE8: - strh r2, [r1, 0x1C] - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_0801FAF0: - movs r0, 0 - movs r1, 0 - movs r2, 0x5 - movs r3, 0x11 - bl ScrollWindow - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, =gUnknown_02022C88 - ldr r1, [r0] - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_0801FB14: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801FB3A - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrh r0, [r0, 0x1C] - cmp r0, 0x2 - bhi _0801FB34 - ldrb r0, [r6] - subs r0, 0x1 - b _0801FB38 - .pool -_0801FB34: - ldrb r0, [r6] - adds r0, 0x1 -_0801FB38: - strb r0, [r6] -_0801FB3A: - movs r0, 0x1 -_0801FB3C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801FA68 - - thumb_func_start sub_801FB44 -sub_801FB44: @ 801FB44 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FB54 - cmp r0, 0x1 - beq _0801FB60 - b _0801FB66 -_0801FB54: - bl sub_80209E0 - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FB66 -_0801FB60: - bl sub_8020A1C - b _0801FB68 -_0801FB66: - movs r0, 0x1 -_0801FB68: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FB44 - - thumb_func_start sub_801FB70 -sub_801FB70: @ 801FB70 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FB80 - cmp r0, 0x1 - beq _0801FBA0 - b _0801FBAA -_0801FB80: - movs r0, 0x3 - movs r1, 0x10 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FBAA - .pool -_0801FBA0: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FBAC -_0801FBAA: - movs r0, 0x1 -_0801FBAC: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FB70 - - thumb_func_start sub_801FBB4 -sub_801FBB4: @ 801FBB4 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FBC4 - cmp r0, 0x1 - beq _0801FBE4 - b _0801FBEE -_0801FBC4: - movs r0, 0x4 - movs r1, 0 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FBEE - .pool -_0801FBE4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FBF0 -_0801FBEE: - movs r0, 0x1 -_0801FBF0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FBB4 - - thumb_func_start sub_801FBF8 -sub_801FBF8: @ 801FBF8 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FC08 - cmp r0, 0x1 - beq _0801FC38 - b _0801FC42 -_0801FC08: - bl sub_81AFBF0 - bl sub_801F1D0 - adds r1, r0, 0 - movs r0, 0 - bl sub_81AFC0C - movs r0, 0x5 - movs r1, 0 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FC42 - .pool -_0801FC38: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FC44 -_0801FC42: - movs r0, 0x1 -_0801FC44: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FBF8 - - thumb_func_start sub_801FC4C -sub_801FC4C: @ 801FC4C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FC5C - cmp r0, 0x1 - beq _0801FC88 - b _0801FC92 -_0801FC5C: - movs r0, 0x6 - movs r1, 0 - bl sub_801FF18 - movs r0, 0x17 - movs r1, 0xA - movs r2, 0x1 - bl sub_801FDDC - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FC92 - .pool -_0801FC88: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FC94 -_0801FC92: - movs r0, 0x1 -_0801FC94: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FC4C - - thumb_func_start sub_801FC9C -sub_801FC9C: @ 801FC9C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FCAC - cmp r0, 0x1 - beq _0801FCD8 - b _0801FCE2 -_0801FCAC: - movs r0, 0x7 - movs r1, 0 - bl sub_801FF18 - movs r0, 0x17 - movs r1, 0xA - movs r2, 0x1 - bl sub_801FDDC - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FCE2 - .pool -_0801FCD8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FCE4 -_0801FCE2: - movs r0, 0x1 -_0801FCE4: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FC9C - - thumb_func_start sub_801FCEC -sub_801FCEC: @ 801FCEC - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FCFC - cmp r0, 0x1 - beq _0801FD1C - b _0801FD26 -_0801FCFC: - movs r0, 0x8 - movs r1, 0 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FD26 - .pool -_0801FD1C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FD28 -_0801FD26: - movs r0, 0x1 -_0801FD28: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FCEC - - thumb_func_start sub_801FD30 -sub_801FD30: @ 801FD30 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FD40 - cmp r0, 0x1 - beq _0801FD74 - b _0801FD7E -_0801FD40: - bl sub_81AFBF0 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - movs r0, 0 - bl sub_81AFC0C - movs r0, 0x9 - movs r1, 0 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FD7E - .pool -_0801FD74: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FD80 -_0801FD7E: - movs r0, 0x1 -_0801FD80: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FD30 - - thumb_func_start sub_801FD88 -sub_801FD88: @ 801FD88 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FD98 - cmp r0, 0x1 - beq _0801FDC4 - b _0801FDCE -_0801FD98: - movs r0, 0xA - movs r1, 0 - bl sub_801FF18 - movs r0, 0x17 - movs r1, 0xA - movs r2, 0x1 - bl sub_801FDDC - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FDCE - .pool -_0801FDC4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FDD0 -_0801FDCE: - movs r0, 0x1 -_0801FDD0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FD88 - - thumb_func_start sub_801FDD8 -sub_801FDD8: @ 801FDD8 - movs r0, 0 - bx lr - thumb_func_end sub_801FDD8 - - thumb_func_start sub_801FDDC -sub_801FDDC: @ 801FDDC - push {r4-r7,lr} - sub sp, 0x14 - lsls r0, 24 - lsls r1, 24 - lsls r2, 24 - lsrs r7, r2, 24 - ldr r4, =0xffffff00 - ldr r2, [sp, 0xC] - ands r2, r4 - lsrs r0, 16 - ldr r3, =0xffff00ff - ands r2, r3 - orrs r2, r0 - lsrs r1, 8 - ldr r0, =0xff00ffff - ands r2, r0 - orrs r2, r1 - ldr r0, =0x00ffffff - ands r2, r0 - movs r0, 0xC0 - lsls r0, 19 - orrs r2, r0 - str r2, [sp, 0xC] - ldr r0, [sp, 0x10] - ands r0, r4 - movs r1, 0x4 - orrs r0, r1 - ands r0, r3 - movs r1, 0xE0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xA4 - lsls r1, 15 - orrs r0, r1 - str r0, [sp, 0x10] - add r0, sp, 0xC - bl AddWindow - adds r1, r0, 0 - ldr r5, =gUnknown_02022C88 - ldr r0, [r5] - movs r6, 0 - strh r1, [r0, 0x18] - lsls r0, r1, 16 - lsrs r0, 16 - cmp r0, 0xFF - beq _0801FE94 - lsls r0, r1, 24 - lsrs r0, 24 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r5] - ldrb r0, [r0, 0x18] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x18] - ldr r2, =gText_Yes - movs r1, 0x1 - str r1, [sp] - movs r4, 0xFF - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r5] - ldrb r0, [r0, 0x18] - ldr r2, =gText_No - movs r1, 0x11 - str r1, [sp] - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r5] - ldrb r0, [r0, 0x18] - movs r1, 0x1 - movs r2, 0xD - bl sub_8098858 - ldr r0, [r5] - ldrb r0, [r0, 0x18] - movs r1, 0x2 - adds r2, r7, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed -_0801FE94: - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801FDDC - - thumb_func_start sub_801FEBC -sub_801FEBC: @ 801FEBC - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - ldrh r0, [r0, 0x18] - cmp r0, 0xFF - beq _0801FEDA - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_8198070 - ldr r0, [r4] - ldrb r0, [r0, 0x18] - bl ClearWindowTilemap -_0801FEDA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801FEBC - - thumb_func_start sub_801FEE4 -sub_801FEE4: @ 801FEE4 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - ldrh r0, [r0, 0x18] - cmp r0, 0xFF - beq _0801FEFE - lsls r0, 24 - lsrs r0, 24 - bl RemoveWindow - ldr r1, [r4] - movs r0, 0xFF - strh r0, [r1, 0x18] -_0801FEFE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801FEE4 - - thumb_func_start sub_801FF08 -sub_801FF08: @ 801FF08 - push {lr} - bl ProcessMenuInput - lsls r0, 24 - asrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_801FF08 - - thumb_func_start sub_801FF18 -sub_801FF18: @ 801FF18 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x1C - adds r7, r0, 0 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - ldr r1, =0xffffff00 - ldr r3, [sp, 0x14] - ands r3, r1 - ldr r2, =0xffff00ff - ands r3, r2 - movs r0, 0x80 - lsls r0, 4 - orrs r3, r0 - ldr r0, =0xff00ffff - ands r3, r0 - movs r0, 0x80 - lsls r0, 13 - orrs r3, r0 - ldr r5, =0x00ffffff - ands r3, r5 - movs r0, 0xA8 - lsls r0, 21 - orrs r3, r0 - str r3, [sp, 0x14] - ldr r0, [sp, 0x18] - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - ands r0, r2 - movs r1, 0xE0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xD4 - lsls r1, 15 - orrs r0, r1 - str r0, [sp, 0x18] - ldr r1, =gUnknown_082F2D40 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r4, r0, r1 - ldrb r0, [r4, 0xA] - cmp r0, 0 - beq _0801FF98 - lsls r0, r3, 16 - movs r1, 0xF9 - lsls r1, 24 - adds r0, r1 - lsrs r0, 16 - ands r2, r3 - orrs r2, r0 - lsrs r1, r2, 24 - adds r1, 0x7 - lsls r1, 24 - adds r0, r5, 0 - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] -_0801FF98: - add r0, sp, 0x14 - bl AddWindow - ldr r5, =gUnknown_02022C88 - ldr r1, [r5] - strh r0, [r1, 0x1E] - ldrh r0, [r1, 0x1E] - mov r8, r0 - cmp r0, 0xFF - beq _08020082 - ldrb r0, [r4, 0x9] - cmp r0, 0 - beq _0801FFE0 - adds r0, r1, 0 - adds r0, 0x22 - ldr r1, [r4] - bl sub_81AFC28 - ldr r0, [r5] - adds r6, r0, 0 - adds r6, 0x22 - b _0801FFE2 - .pool -_0801FFE0: - ldr r6, [r4] -_0801FFE2: - mov r0, r9 - lsls r1, r0, 8 - movs r0, 0 - movs r2, 0 - bl ChangeBgY - mov r1, r8 - lsls r0, r1, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl PutWindowTilemap - ldr r1, =gUnknown_082F2D40 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r4, r0, r1 - ldrb r0, [r4, 0x4] - cmp r0, 0x1 - bne _08020050 - adds r0, r5, 0 - movs r1, 0xA - movs r2, 0x2 - bl sub_80989E0 - ldrb r3, [r4, 0x5] - adds r3, 0x8 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x6] - adds r0, 0x8 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - ldrb r0, [r4, 0x7] - str r0, [sp, 0xC] - ldrb r0, [r4, 0x8] - str r0, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - bl sub_8199F74 - b _0802007A - .pool -_08020050: - adds r0, r5, 0 - movs r1, 0xA - movs r2, 0x2 - bl sub_8098858 - ldrb r3, [r4, 0x5] - ldrb r0, [r4, 0x6] - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - ldrb r0, [r4, 0x7] - str r0, [sp, 0xC] - ldrb r0, [r4, 0x8] - str r0, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - bl sub_8199F74 -_0802007A: - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - mov r1, r8 - strh r1, [r0, 0x1E] -_08020082: - add sp, 0x1C - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801FF18 - - thumb_func_start sub_8020094 -sub_8020094: @ 8020094 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - ldrh r0, [r0, 0x1E] - cmp r0, 0xFF - beq _080200B2 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_8198070 - ldr r0, [r4] - ldrb r0, [r0, 0x1E] - bl ClearWindowTilemap -_080200B2: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020094 - - thumb_func_start sub_80200C8 -sub_80200C8: @ 80200C8 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - ldrh r0, [r0, 0x1E] - cmp r0, 0xFF - beq _080200E2 - lsls r0, 24 - lsrs r0, 24 - bl RemoveWindow - ldr r1, [r4] - movs r0, 0xFF - strh r0, [r1, 0x1E] -_080200E2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80200C8 - - thumb_func_start sub_80200EC -sub_80200EC: @ 80200EC - push {lr} - sub sp, 0x8 - adds r3, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 19 - lsrs r3, 16 - lsls r1, 19 - lsrs r1, 16 - str r1, [sp] - movs r0, 0xE - str r0, [sp, 0x4] - movs r0, 0x1 - adds r1, r2, 0 - adds r2, r3, 0 - movs r3, 0x1 - bl FillWindowPixelRect - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_80200EC - - thumb_func_start sub_8020118 -sub_8020118: @ 8020118 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - mov r10, r1 - ldr r1, [sp, 0x54] - lsls r0, 16 - lsrs r5, r0, 16 - mov r9, r5 - lsls r2, 24 - lsrs r4, r2, 24 - mov r8, r4 - lsls r3, 24 - lsrs r7, r3, 24 - lsls r1, 24 - lsrs r6, r1, 24 - cmp r4, 0 - beq _08020154 - bl sub_801F198 - adds r1, r0, 0 - subs r1, r5 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - adds r2, r4, 0 - bl sub_80200EC -_08020154: - add r0, sp, 0xC - mov r1, r8 - strb r1, [r0] - strb r7, [r0, 0x1] - strb r6, [r0, 0x2] - add r4, sp, 0x10 - movs r0, 0xFC - strb r0, [r4] - movs r0, 0x14 - strb r0, [r4, 0x1] - movs r0, 0x8 - strb r0, [r4, 0x2] - mov r0, sp - adds r0, 0x13 - mov r1, r10 - bl StringCopy - mov r0, r9 - lsls r2, r0, 27 - lsrs r2, 24 - add r1, sp, 0xC - str r1, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x2 - movs r3, 0x1 - bl box_print - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8020118 - - thumb_func_start sub_80201A4 -sub_80201A4: @ 80201A4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4C - movs r0, 0x2 - movs r1, 0xFF - bl FillWindowPixelBuffer - bl sub_801F0B0 - lsls r0, 24 - lsrs r2, r0, 24 - add r1, sp, 0xC - movs r0, 0 - strb r0, [r1] - movs r0, 0xE - strb r0, [r1, 0x1] - movs r0, 0xD - strb r0, [r1, 0x2] - cmp r2, 0x3 - beq _08020240 - add r1, sp, 0x10 - movs r0, 0xFC - strb r0, [r1] - movs r0, 0x14 - strb r0, [r1, 0x1] - movs r0, 0x8 - strb r0, [r1, 0x2] - str r0, [sp, 0x40] - str r1, [sp, 0x44] - cmp r2, 0x2 - bne _080201EC - movs r1, 0x6 - str r1, [sp, 0x40] -_080201EC: - movs r7, 0 - movs r6, 0 - lsls r0, r2, 2 - ldr r1, =gUnknown_082F2BA8 - adds r0, r2 - lsls r0, 3 - adds r4, r0, r1 - ldr r0, [sp, 0x40] - lsls r5, r0, 24 -_080201FE: - ldr r1, [r4] - cmp r1, 0 - bne _08020206 - b _0802030C -_08020206: - mov r0, sp - adds r0, 0x13 - bl StringCopy - lsls r3, r6, 24 - lsrs r3, 24 - add r1, sp, 0xC - str r1, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, [sp, 0x44] - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - lsrs r2, r5, 24 - bl box_print - adds r4, 0x4 - adds r7, 0x1 - adds r0, r6, 0 - adds r0, 0xC - lsls r0, 16 - lsrs r6, r0, 16 - cmp r7, 0x9 - ble _080201FE - b _0802030C - .pool -_08020240: - movs r1, 0x4 - str r1, [sp, 0x40] - movs r7, 0 - movs r6, 0 -_08020248: - adds r0, r7, 0 - bl sub_801EE6C - adds r5, r0, 0 - movs r0, 0 - adds r1, r5, 0 - movs r2, 0 - bl GetStringWidth - cmp r0, 0x28 - bgt _08020286 - lsls r3, r6, 24 - lsrs r3, 24 - add r4, sp, 0xC - str r4, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r4, 0x80 - lsls r4, 19 - lsrs r2, r4, 24 - bl box_print - adds r0, r7, 0x1 - str r0, [sp, 0x48] - adds r6, 0xC - mov r10, r6 - b _08020300 -_08020286: - adds r0, r5, 0 - bl StringLength_Multibyte - adds r4, r0, 0 - mov r1, sp - adds r1, 0x10 - str r1, [sp, 0x44] - ldr r0, [sp, 0x40] - lsls r0, 24 - mov r8, r0 - lsls r1, r6, 24 - mov r9, r1 - adds r0, r7, 0x1 - str r0, [sp, 0x48] - adds r6, 0xC - mov r10, r6 - ldr r7, [sp, 0x40] - adds r7, 0x23 - ldr r6, [sp, 0x44] -_080202AC: - subs r4, 0x1 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r4, 0 - bl StringCopyN_Multibyte - movs r0, 0 - adds r1, r6, 0 - movs r2, 0 - bl GetStringWidth - cmp r0, 0x23 - bgt _080202AC - mov r1, r8 - lsrs r2, r1, 24 - mov r0, r9 - lsrs r4, r0, 24 - add r1, sp, 0xC - str r1, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r1, [sp, 0x44] - str r1, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - adds r3, r4, 0 - bl box_print - adds r2, r7, 0 - add r0, sp, 0xC - str r0, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - ldr r0, =gText_Ellipsis - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - adds r3, r4, 0 - bl box_print -_08020300: - ldr r7, [sp, 0x48] - mov r4, r10 - lsls r0, r4, 16 - lsrs r6, r0, 16 - cmp r7, 0x9 - ble _08020248 -_0802030C: - add sp, 0x4C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80201A4 - - thumb_func_start sub_8020320 -sub_8020320: @ 8020320 - push {r4,lr} - ldr r1, =gUnknown_02022C88 - ldr r2, [r1] - ldrh r3, [r2, 0x20] - movs r4, 0x20 - ldrsh r0, [r2, r4] - cmp r0, 0x37 - bgt _08020354 - adds r0, r3, 0 - adds r0, 0xC - strh r0, [r2, 0x20] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x37 - ble _08020348 - movs r0, 0x38 - strh r0, [r2, 0x20] - b _08020354 - .pool -_08020348: - movs r1, 0x20 - ldrsh r0, [r2, r1] - bl sub_80207C0 - movs r0, 0x1 - b _08020360 -_08020354: - ldr r0, [r1] - movs r4, 0x20 - ldrsh r0, [r0, r4] - bl sub_8020818 - movs r0, 0 -_08020360: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8020320 - - thumb_func_start sub_8020368 -sub_8020368: @ 8020368 - push {r4,lr} - ldr r1, =gUnknown_02022C88 - ldr r2, [r1] - ldrh r3, [r2, 0x20] - movs r4, 0x20 - ldrsh r0, [r2, r4] - cmp r0, 0 - ble _0802039C - adds r0, r3, 0 - subs r0, 0xC - strh r0, [r2, 0x20] - lsls r0, 16 - cmp r0, 0 - bgt _08020390 - movs r0, 0 - strh r0, [r2, 0x20] - b _0802039C - .pool -_08020390: - movs r1, 0x20 - ldrsh r0, [r2, r1] - bl sub_80207C0 - movs r0, 0x1 - b _080203A8 -_0802039C: - ldr r0, [r1] - movs r4, 0x20 - ldrsh r0, [r0, r4] - bl sub_8020818 - movs r0, 0 -_080203A8: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8020368 - - thumb_func_start sub_80203B0 -sub_80203B0: @ 80203B0 - push {r4,r5,lr} - sub sp, 0xC - movs r0, 0x3 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0xD - bl sub_8098858 - movs r5, 0xE - str r5, [sp] - movs r4, 0x5 - str r4, [sp, 0x4] - ldr r0, =gUnknown_082F2DC8 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x2 - movs r2, 0x8 - movs r3, 0x1 - bl PrintTextArray - bl sub_801F0B0 - lsls r0, 24 - lsrs r0, 24 - str r5, [sp] - str r4, [sp, 0x4] - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x2 - movs r2, 0 - movs r3, 0x1 - bl sub_81983AC - movs r0, 0x3 - bl PutWindowTilemap - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80203B0 - - thumb_func_start sub_802040C -sub_802040C: @ 802040C - push {lr} - movs r0, 0x3 - movs r1, 0 - bl sub_8198070 - movs r0, 0x3 - bl ClearWindowTilemap - pop {r0} - bx r0 - thumb_func_end sub_802040C - - thumb_func_start sub_8020420 -sub_8020420: @ 8020420 - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r1, 0 - lsls r0, 16 - lsrs r0, 16 - lsls r2, 24 - add r3, sp, 0xC - movs r1, 0x1 - strb r1, [r3] - lsrs r2, 23 - adds r1, r2, 0x2 - strb r1, [r3, 0x1] - adds r1, r3, 0 - adds r2, 0x3 - strb r2, [r1, 0x2] - lsls r4, r0, 4 - subs r4, r0 - lsls r3, r4, 16 - lsrs r3, 16 - movs r0, 0xA8 - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0x11 - movs r2, 0 - bl FillWindowPixelRect - adds r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - add r0, sp, 0xC - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0x2 - movs r2, 0 - adds r3, r4, 0 - bl box_print - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8020420 - - thumb_func_start sub_8020480 -sub_8020480: @ 8020480 - push {lr} - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuRegBits - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r1, 0xE0 - lsls r1, 8 - movs r0, 0 - bl ClearGpuRegBits - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl SetGpuRegBits - ldr r1, =0x000040f0 - movs r0, 0x40 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0x90 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x3D - bl SetGpuReg - movs r0, 0x4A - movs r1, 0x3F - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020480 - - thumb_func_start sub_8020538 -sub_8020538: @ 8020538 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r1, [r4] - movs r0, 0x94 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00000928 - adds r1, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00001128 - adds r1, r0 - movs r0, 0x3 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00001928 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020538 - - thumb_func_start sub_8020584 -sub_8020584: @ 8020584 - push {lr} - sub sp, 0x8 - movs r1, 0xC0 - lsls r1, 19 - movs r0, 0 - movs r2, 0x20 - movs r3, 0x1 - bl RequestDma3Fill - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_8020584 - - thumb_func_start sub_80205B4 -sub_80205B4: @ 80205B4 - push {lr} - sub sp, 0x4 - ldr r0, =gUnknown_08DD4BD0 - movs r1, 0x70 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_08DD4BB0 - movs r1, 0xC0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_08DD4BF0 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gUnknown_08DD4C4C - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80205B4 - - thumb_func_start task_tutorial_story_unknown -task_tutorial_story_unknown: @ 8020604 - push {r4,r5,lr} - sub sp, 0x4 - ldr r0, =gUnknown_08DD4860 - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_08DD4880 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - adds r5, r0, 0 - cmp r5, 0 - beq _0802064E - movs r1, 0x88 - lsls r1, 2 - adds r0, r5, r1 - ldr r4, =gUnknown_02022C88 - ldr r1, [r4] - ldr r2, =0x00002128 - adds r1, r2 - movs r2, 0x8 - bl CpuFastSet - movs r1, 0x84 - lsls r1, 3 - adds r0, r5, r1 - ldr r1, [r4] - ldr r2, =0x00002148 - adds r1, r2 - movs r2, 0x8 - bl CpuFastSet -_0802064E: - ldr r1, =gUnknown_08DD4AB8 - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_tutorial_story_unknown - - thumb_func_start sub_8020680 -sub_8020680: @ 8020680 - push {lr} - ldr r0, =gUnknown_082F2C20 - movs r1, 0x80 - movs r2, 0x20 - bl LoadPalette - ldr r1, =0x06004020 - movs r0, 0 - movs r2, 0x20 - movs r3, 0x1 - bl RequestDma3Fill - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020680 - - thumb_func_start sub_80206A4 -sub_80206A4: @ 80206A4 - push {lr} - ldr r0, =gUnknown_082F2C40 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - pop {r0} - bx r0 - .pool - thumb_func_end sub_80206A4 - - thumb_func_start sub_80206D0 -sub_80206D0: @ 80206D0 - push {lr} - movs r0, 0x2 - bl PutWindowTilemap - bl sub_80201A4 - movs r0, 0x2 - movs r1, 0x3 - bl CopyWindowToVram - pop {r0} - bx r0 - thumb_func_end sub_80206D0 - - thumb_func_start sub_80206E8 -sub_80206E8: @ 80206E8 - push {r4,lr} - sub sp, 0xC - add r1, sp, 0x8 - movs r0, 0 - strb r0, [r1] - movs r0, 0xFF - strb r0, [r1, 0x1] - movs r4, 0 -_080206F8: - ldr r0, =gUnknown_02022C88 - ldr r1, [r0] - ldr r0, =0x00002128 - adds r1, r0 - lsls r2, r4, 19 - lsrs r2, 16 - movs r0, 0x8 - str r0, [sp] - movs r0, 0x10 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r3, 0 - bl BlitBitmapToWindow - adds r4, 0x1 - cmp r4, 0xE - ble _080206F8 - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80206E8 - - thumb_func_start sub_8020740 -sub_8020740: @ 8020740 - push {lr} - movs r0, 0x3 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0xD0 - bl sub_809882C - movs r0, 0x3 - movs r1, 0xA - movs r2, 0x20 - bl box_border_load_tiles_and_pal - ldr r0, =gUnknown_0860F074 - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020740 - - thumb_func_start sub_8020770 -sub_8020770: @ 8020770 - push {lr} - sub sp, 0x10 - ldr r0, =0xa2600001 - str r0, [sp, 0x4] - ldr r0, =0x04000014 - str r0, [sp] - mov r2, sp - movs r1, 0 - movs r0, 0x1 - strb r0, [r2, 0x8] - mov r0, sp - strb r1, [r0, 0x9] - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - strh r1, [r0, 0x20] - str r1, [sp, 0xC] - add r0, sp, 0xC - ldr r1, =gUnknown_02038C28 - ldr r2, =0x010003c0 - bl CpuFastSet - ldr r0, [sp] - ldr r1, [sp, 0x4] - ldr r2, [sp, 0x8] - bl sub_80BA038 - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020770 - - thumb_func_start sub_80207C0 -sub_80207C0: @ 80207C0 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - mov r1, sp - strh r0, [r1] - ldr r5, =gUnknown_02039B28 - ldrb r0, [r5, 0x14] - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 7 - ldr r4, =gUnknown_02038C28 - adds r1, r4 - ldr r2, =0x01000090 - mov r0, sp - bl CpuSet - mov r0, sp - adds r0, 0x2 - movs r1, 0 - strh r1, [r0] - ldrb r2, [r5, 0x14] - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 7 - movs r2, 0x90 - lsls r2, 1 - adds r4, r2 - adds r1, r4 - ldr r2, =0x01000010 - bl CpuSet - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80207C0 - - thumb_func_start sub_8020818 -sub_8020818: @ 8020818 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x8 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, sp - strh r4, [r0] - ldr r5, =gUnknown_02038C28 - ldr r0, =0x01000090 - mov r9, r0 - mov r0, sp - adds r1, r5, 0 - mov r2, r9 - bl CpuSet - mov r0, sp - adds r0, 0x2 - movs r6, 0 - strh r6, [r0] - movs r2, 0x90 - lsls r2, 1 - adds r1, r5, r2 - ldr r2, =0x01000010 - mov r8, r2 - bl CpuSet - add r0, sp, 0x4 - strh r4, [r0] - movs r2, 0xF0 - lsls r2, 3 - adds r1, r5, r2 - mov r2, r9 - bl CpuSet - mov r0, sp - adds r0, 0x6 - strh r6, [r0] - movs r1, 0x8A - lsls r1, 4 - adds r5, r1 - adds r1, r5, 0 - mov r2, r8 - bl CpuSet - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020818 - - thumb_func_start sub_8020890 -sub_8020890: @ 8020890 - push {r4,r5,lr} - movs r5, 0 - ldr r4, =gUnknown_082F3134 -_08020896: - adds r0, r4, 0 - bl LoadCompressedObjectPic - adds r4, 0x8 - adds r5, 0x1 - cmp r5, 0x4 - bls _08020896 - ldr r0, =gUnknown_082F315C - bl LoadSpritePalette - ldr r4, =gUnknown_02022C8C - movs r0, 0x18 - bl Alloc - str r0, [r4] - cmp r0, 0 - beq _080208C8 - movs r0, 0x1 - b _080208CA - .pool -_080208C8: - movs r0, 0 -_080208CA: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8020890 - - thumb_func_start sub_80208D0 -sub_80208D0: @ 80208D0 - push {lr} - ldr r0, =gUnknown_02022C8C - ldr r0, [r0] - cmp r0, 0 - beq _080208DE - bl Free -_080208DE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80208D0 - - thumb_func_start sub_80208E8 -sub_80208E8: @ 80208E8 - push {lr} - ldr r0, =gUnknown_082F319C - movs r1, 0xA - movs r2, 0x18 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02022C8C - ldr r2, [r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80208E8 - - thumb_func_start sub_802091C -sub_802091C: @ 802091C - ldr r1, =gUnknown_02022C8C - ldr r1, [r1] - ldr r2, [r1] - adds r2, 0x3E - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - ldrb r3, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r3 - orrs r1, r0 - strb r1, [r2] - bx lr - .pool - thumb_func_end sub_802091C - - thumb_func_start sub_802093C -sub_802093C: @ 802093C - push {r4,r5,lr} - sub sp, 0x4 - bl sub_801F0B0 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - mov r5, sp - adds r5, 0x1 - mov r0, sp - adds r1, r5, 0 - bl sub_801F0BC - cmp r4, 0x3 - beq _0802097C - ldr r4, =gUnknown_02022C8C - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - ldr r1, [r4] - ldr r2, [r1] - mov r0, sp - ldrb r0, [r0] - lsls r0, 3 - adds r0, 0xA - strh r0, [r2, 0x20] - ldr r2, [r1] - b _08020992 - .pool -_0802097C: - ldr r4, =gUnknown_02022C8C - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - ldr r2, [r4] - ldr r1, [r2] - movs r0, 0x18 - strh r0, [r1, 0x20] - ldr r2, [r2] -_08020992: - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, 0x18 - strh r0, [r2, 0x22] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802093C - - thumb_func_start sub_80209AC -sub_80209AC: @ 80209AC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 2 - ldr r0, =gUnknown_082F2DF0+2 - adds r4, r0 - movs r0, 0 - bl IndexOfSpritePaletteTag - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 4 - ldr r0, =0x01010000 - adds r1, r0 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0x4 - bl LoadPalette - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80209AC - - thumb_func_start sub_80209E0 -sub_80209E0: @ 80209E0 - push {lr} - bl sub_801F0B0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _08020A00 - ldr r0, =gUnknown_02022C8C - ldr r0, [r0] - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim - b _08020A0C - .pool -_08020A00: - ldr r0, =gUnknown_02022C8C - ldr r0, [r0] - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim -_08020A0C: - ldr r0, =gUnknown_02022C8C - ldr r1, [r0] - movs r0, 0 - strh r0, [r1, 0x14] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80209E0 - - thumb_func_start sub_8020A1C -sub_8020A1C: @ 8020A1C - push {r4,lr} - ldr r4, =gUnknown_02022C8C - ldr r1, [r4] - ldrh r0, [r1, 0x14] - cmp r0, 0x3 - bls _08020A30 -_08020A28: - movs r0, 0 - b _08020A62 - .pool -_08020A30: - adds r0, 0x1 - strh r0, [r1, 0x14] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3 - bls _08020A60 - bl sub_801F0B0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _08020A54 - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - b _08020A28 -_08020A54: - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - b _08020A28 -_08020A60: - movs r0, 0x1 -_08020A62: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8020A1C - - thumb_func_start sub_8020A68 -sub_8020A68: @ 8020A68 - push {r4,r5,lr} - ldr r0, =gUnknown_082F31BC - movs r1, 0x4C - movs r2, 0x98 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_02022C8C - ldr r2, [r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r4, =gSprites - adds r1, r4 - str r1, [r2, 0x8] - ldr r0, =gUnknown_082F31D4 - movs r1, 0x40 - movs r2, 0x98 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, [r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - str r1, [r2, 0x4] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020A68 - - thumb_func_start sub_8020ABC -sub_8020ABC: @ 8020ABC - push {r4,lr} - adds r4, r0, 0 - bl sub_801F198 - adds r3, r0, 0 - cmp r3, 0xF - bne _08020AD8 - adds r0, r4, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - b _08020AEC -_08020AD8: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r0 - strb r1, [r2] - lsls r0, r3, 3 - adds r0, 0x4C - strh r0, [r4, 0x20] -_08020AEC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8020ABC - - thumb_func_start sub_8020AF4 -sub_8020AF4: @ 8020AF4 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x2E] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _08020B1A - strh r2, [r1, 0x2E] - ldrh r0, [r1, 0x24] - adds r0, 0x1 - strh r0, [r1, 0x24] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _08020B1A - strh r2, [r1, 0x24] -_08020B1A: - pop {r0} - bx r0 - thumb_func_end sub_8020AF4 - - thumb_func_start sub_8020B20 -sub_8020B20: @ 8020B20 - push {r4,r5,lr} - ldr r0, =gUnknown_082F322C - movs r1, 0x8 - movs r2, 0x98 - movs r3, 0x3 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_02022C8C - ldr r2, [r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r4, =gSprites - adds r1, r4 - str r1, [r2, 0xC] - ldr r0, =gUnknown_082F3244 - movs r1, 0x20 - movs r2, 0x98 - movs r3, 0x4 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, [r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - str r1, [r2, 0x10] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020B20 - - thumb_func_start sub_8020B80 -sub_8020B80: @ 8020B80 - push {r4,lr} - bl sub_801F0B0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _08020BB8 - bl sub_801F0DC - cmp r0, 0 - beq _08020BC2 - ldr r3, =gUnknown_02022C8C - ldr r0, [r3] - ldr r1, [r0, 0x10] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r0, [r3] - ldr r0, [r0, 0x10] - movs r1, 0x3 - bl StartSpriteAnim - b _08020BF6 - .pool -_08020BB8: - bl sub_801F1A4 - adds r4, r0, 0 - cmp r4, 0x3 - bne _08020BD8 -_08020BC2: - ldr r0, =gUnknown_02022C8C - ldr r0, [r0] - ldr r1, [r0, 0x10] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - b _08020BF6 - .pool -_08020BD8: - ldr r3, =gUnknown_02022C8C - ldr r0, [r3] - ldr r1, [r0, 0x10] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r0, [r3] - ldr r0, [r0, 0x10] - lsls r1, r4, 24 - lsrs r1, 24 - bl StartSpriteAnim -_08020BF6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020B80 - - thumb_func_start sub_8020C00 -sub_8020C00: @ 8020C00 - ldr r0, =gUnknown_02022C90 - ldr r0, [r0] - bx lr - .pool - thumb_func_end sub_8020C00 - - thumb_func_start sub_8020C0C -sub_8020C0C: @ 8020C0C - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_02022C90 - ldr r0, [r5] - cmp r0, 0 - bne _08020C20 - movs r0, 0x2 - b _08020C5C - .pool -_08020C20: - cmp r4, 0 - bne _08020C26 - ldr r4, [r0] -_08020C26: - ldrb r0, [r0, 0xA] - bl DestroyTask - ldr r0, [r5] - bl Free - movs r0, 0 - str r0, [r5] - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =c2_exit_to_overworld_2_switch - cmp r4, r0 - bne _08020C5A - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r0, 0xC8 - lsls r0, 1 - bl PlayNewMapMusic - ldr r0, =c1_overworld - bl set_callback1 -_08020C5A: - movs r0, 0 -_08020C5C: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8020C0C - - thumb_func_start sub_8020C70 -sub_8020C70: @ 8020C70 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0 - mov r8, r0 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08020C8E - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _08020CAC -_08020C8E: - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =gUnknown_03005000 - mov r1, r8 - strh r1, [r0, 0x10] - strh r1, [r0, 0x12] - b _08020CF8 - .pool -_08020CAC: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r7, r0, 24 - mov r0, r8 - cmp r0, 0x1 - bls _08020CC8 - cmp r7, r8 - bcc _08020CDC -_08020CC8: - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =gUnknown_03005000 - movs r1, 0 - strh r1, [r0, 0x10] - strh r1, [r0, 0x12] - b _08020CF8 - .pool -_08020CDC: - ldr r6, =gUnknown_02022C90 - ldr r0, =0x000041c0 - bl AllocZeroed - adds r5, r0, 0 - str r5, [r6] - cmp r5, 0 - bne _08020D10 - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =gUnknown_03005000 - strh r5, [r0, 0x10] - strh r5, [r0, 0x12] -_08020CF8: - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] - b _08020D74 - .pool -_08020D10: - str r4, [r5] - movs r4, 0 - strb r7, [r5, 0x8] - ldr r0, [r6] - mov r1, r8 - strb r1, [r0, 0x9] - ldr r0, [r6] - bl sub_8020FC4 - ldr r1, [r6] - movs r2, 0x1 - movs r0, 0x1 - strh r0, [r1, 0x12] - strb r2, [r1, 0xE] - ldr r1, [r6] - movs r0, 0x6 - strb r0, [r1, 0xF] - ldr r0, [r6] - adds r0, 0x36 - movs r2, 0x1 - negs r2, r2 - movs r1, 0x10 - str r1, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl sub_8024604 - ldr r2, [r6] - adds r2, 0x36 - movs r0, 0x4 - movs r1, 0x1 - bl sub_8022BEC - ldr r0, =sub_8020F88 - bl SetMainCallback2 - ldr r0, =sub_8020FA0 - movs r1, 0x8 - bl CreateTask - ldr r1, [r6] - strb r0, [r1, 0xA] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_08020D74: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020C70 - - thumb_func_start sub_8020D8C -sub_8020D8C: @ 8020D8C - push {r4,lr} - sub sp, 0xC - ldr r1, =gScriptItemId - ldrh r0, [r1] - subs r0, 0x85 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2B - bls _08020DA8 - movs r0, 0x85 - strh r0, [r1] - b _08020DB0 - .pool -_08020DA8: - ldrh r0, [r1] - movs r1, 0x1 - bl RemoveBagItem -_08020DB0: - ldr r4, =gUnknown_02022C90 - ldr r2, [r4] - ldrb r0, [r2, 0x8] - lsls r0, 5 - adds r0, r2, r0 - ldr r1, =gScriptItemId - ldrh r1, [r1] - subs r1, 0x85 - adds r0, 0xA4 - movs r3, 0 - strh r1, [r0] - movs r0, 0x1 - strb r0, [r2, 0xE] - ldr r1, [r4] - movs r0, 0x9 - strb r0, [r1, 0xF] - ldr r0, [r4] - adds r0, 0x36 - movs r2, 0x1 - negs r2, r2 - movs r1, 0x10 - str r1, [sp] - str r3, [sp, 0x4] - str r3, [sp, 0x8] - movs r1, 0 - bl sub_8024604 - ldr r2, [r4] - adds r2, 0x36 - movs r0, 0x4 - movs r1, 0x1 - bl sub_8022BEC - ldr r0, =sub_8020FA0 - movs r1, 0x8 - bl CreateTask - ldr r1, [r4] - strb r0, [r1, 0xA] - ldr r0, =sub_8020F88 - bl SetMainCallback2 - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020D8C - - thumb_func_start sub_8020E1C -sub_8020E1C: @ 8020E1C - push {lr} - ldr r0, =gUnknown_02022C90 - ldr r0, [r0] - ldrb r0, [r0, 0xA] - bl DestroyTask - ldr r0, =sub_8020D8C - bl sub_81AABF0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020E1C - - thumb_func_start sub_8020E3C -sub_8020E3C: @ 8020E3C - push {lr} - ldr r0, =sub_8020F74 - bl SetVBlankCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020E3C - - thumb_func_start sub_8020E4C -sub_8020E4C: @ 8020E4C - push {lr} - movs r0, 0 - bl SetVBlankCallback - pop {r0} - bx r0 - thumb_func_end sub_8020E4C - - thumb_func_start sub_8020E58 -sub_8020E58: @ 8020E58 - push {r4-r6,lr} - ldr r4, =gUnknown_02022C90 - ldr r0, [r4] - adds r0, 0x6C - ldrh r2, [r0] - lsls r2, 8 - movs r1, 0xF0 - lsls r1, 6 - adds r0, r2, 0 - bl sub_81515FC - adds r2, r0, 0 - ldr r0, [r4] - adds r0, 0x72 - ldrh r3, [r0] - lsls r3, 8 - adds r0, r3, 0 - adds r1, r2, 0 - bl sub_81515FC - adds r3, r0, 0 - ldr r0, =0x0000ffff - ands r3, r0 - ldr r2, [r4] - strh r3, [r2, 0x16] - ldrb r0, [r2, 0x9] - cmp r0, 0x3 - beq _08020EDC - cmp r0, 0x3 - bgt _08020EA4 - cmp r0, 0x2 - beq _08020EAE - b _08020F48 - .pool -_08020EA4: - cmp r0, 0x4 - beq _08020EEC - cmp r0, 0x5 - beq _08020F20 - b _08020F48 -_08020EAE: - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - movs r0, 0xF6 - lsls r0, 1 - adds r1, r0 - lsls r0, r3, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bls _08020F48 - adds r2, 0x25 - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r0, [r5] - ldr r1, [r4] - ldrh r1, [r1, 0x16] - movs r2, 0xF6 - lsls r2, 1 - b _08020F14 - .pool -_08020EDC: - ldr r5, =gSaveBlock2Ptr - ldr r0, [r5] - movs r6, 0xF7 - lsls r6, 1 - b _08020F28 - .pool -_08020EEC: - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - movs r0, 0xF8 - lsls r0, 1 - adds r1, r0 - lsls r0, r3, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bls _08020F48 - adds r2, 0x25 - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r0, [r5] - ldr r1, [r4] - ldrh r1, [r1, 0x16] - movs r2, 0xF8 - lsls r2, 1 -_08020F14: - adds r0, r2 - strh r1, [r0] - b _08020F48 - .pool -_08020F20: - ldr r5, =gSaveBlock2Ptr - ldr r0, [r5] - movs r6, 0xF9 - lsls r6, 1 -_08020F28: - adds r1, r0, r6 - lsls r0, r3, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bls _08020F48 - adds r2, 0x25 - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r1, [r5] - ldr r0, [r4] - ldrh r0, [r0, 0x16] - adds r1, r6 - strh r0, [r1] -_08020F48: - ldr r4, =gUnknown_02022C90 - ldr r1, [r4] - ldr r0, [r1, 0x68] - str r0, [r1, 0x1C] - bl sub_8024700 - lsls r0, 24 - cmp r0, 0 - bne _08020F66 - ldr r0, [r4] - adds r0, 0x25 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] -_08020F66: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020E58 - - thumb_func_start sub_8020F74 -sub_8020F74: @ 8020F74 - push {lr} - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - pop {r0} - bx r0 - thumb_func_end sub_8020F74 - - thumb_func_start sub_8020F88 -sub_8020F88: @ 8020F88 - push {lr} - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - pop {r0} - bx r0 - thumb_func_end sub_8020F88 - - thumb_func_start sub_8020FA0 -sub_8020FA0: @ 8020FA0 - push {r4,lr} - ldr r4, =gUnknown_02022C90 - ldr r0, [r4] - ldr r2, [r0, 0x4] - cmp r2, 0 - beq _08020FB4 - adds r1, r0, 0 - adds r1, 0x36 - bl _call_via_r2 -_08020FB4: - ldr r0, [r4] - bl sub_8021450 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020FA0 - - thumb_func_start sub_8020FC4 -sub_8020FC4: @ 8020FC4 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - b _08020FE6 -_08020FCC: - lsls r0, r5, 5 - adds r0, 0x98 - adds r0, r6, r0 - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - ldr r2, =gLinkPlayers + 8 - adds r1, r2 - bl StringCopy - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_08020FE6: - ldrb r0, [r6, 0x9] - cmp r5, r0 - bcc _08020FCC - cmp r5, 0x4 - bhi _08021012 -_08020FF0: - lsls r4, r5, 5 - adds r0, r4, 0 - adds r0, 0x98 - adds r0, r6, r0 - movs r1, 0x1 - movs r2, 0x7 - bl memset - adds r4, r6, r4 - adds r4, 0x9F - movs r0, 0xFF - strb r0, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _08020FF0 -_08021012: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x14] - lsls r0, 29 - lsrs r0, 29 - cmp r0, 0x1 - beq _0802103E - cmp r0, 0x1 - bgt _08021034 - cmp r0, 0 - beq _0802103A - b _08021046 - .pool -_08021034: - cmp r0, 0x2 - beq _08021042 - b _08021046 -_0802103A: - movs r0, 0x8 - b _08021044 -_0802103E: - movs r0, 0x4 - b _08021044 -_08021042: - movs r0, 0x1 -_08021044: - strb r0, [r6, 0xB] -_08021046: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8020FC4 - - thumb_func_start sub_802104C -sub_802104C: @ 802104C - push {r4,r5,lr} - sub sp, 0xC - bl sub_8020C00 - adds r5, r0, 0 - cmp r5, 0 - bne _08021060 - movs r0, 0x1 - negs r0, r0 - b _08021304 -_08021060: - ldrb r0, [r5, 0xC] - cmp r0, 0x9 - bls _08021068 - b _080212FC -_08021068: - lsls r0, 2 - ldr r1, =_08021078 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08021078: - .4byte _080210A0 - .4byte _080210BE - .4byte _080210E4 - .4byte _080210F2 - .4byte _08021178 - .4byte _080211BE - .4byte _080211EC - .4byte _0802121C - .4byte _08021278 - .4byte _080212B4 -_080210A0: - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - movs r1, 0 - bl SetGpuReg - bl remove_some_task - bl reset_temp_tile_data_buffers - b _080212FC -_080210BE: - add r0, sp, 0x8 - movs r4, 0 - strh r4, [r0] - movs r1, 0xE0 - lsls r1, 19 - ldr r2, =0x01000200 - bl CpuSet - ldr r0, =gReservedSpritePaletteCount - strb r4, [r0] - movs r0, 0x3 - bl sub_8034C54 - b _080212FC - .pool -_080210E4: - bl ResetPaletteFade - bl ResetSpriteData - bl FreeAllSpritePalettes - b _080212FC -_080210F2: - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F32C8 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0xE0 - lsls r0, 1 - adds r1, r5, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - movs r0, 0x87 - lsls r0, 6 - adds r1, r5, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - movs r0, 0xC7 - lsls r0, 6 - adds r1, r5, r0 - movs r0, 0x3 - bl SetBgTilemapBuffer - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - b _080212FC - .pool -_08021178: - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - movs r0, 0x40 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - b _080212FC -_080211BE: - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r1, =gUnknown_08DE34B8 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _080212FC - .pool -_080211EC: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _080211F8 - b _08021302 -_080211F8: - bl sub_81971D0 - bl sub_8197200 - adds r0, r5, 0 - bl sub_8022588 - adds r0, r5, 0 - bl sub_8022600 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x8] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x8] - b _080212FC - .pool -_0802121C: - ldr r0, =gUnknown_08DE3398 - movs r2, 0xC0 - lsls r2, 1 - movs r1, 0 - bl LoadPalette - ldr r1, =gBerryCrushGrinderTopTilemap - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gBerryCrushContainerCapTilemap - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gBerryCrushBackgroundTilemap - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - adds r0, r5, 0 - bl sub_80226D0 - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _080212FC - .pool -_08021278: - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - adds r0, r5, 0 - bl sub_8022730 - ldr r0, =gSpriteCoordOffsetY - ldrh r1, [r0] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x16 - bl SetGpuReg - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - b _080212FC - .pool -_080212B4: - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuRegBits - bl sub_8020E3C - movs r0, 0 - strb r0, [r5, 0xC] - movs r0, 0x1 - b _08021304 - .pool -_080212FC: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_08021302: - movs r0, 0 -_08021304: - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802104C - - thumb_func_start sub_802130C -sub_802130C: @ 802130C - push {r4,r5,lr} - sub sp, 0x8 - bl sub_8020C00 - adds r5, r0, 0 - cmp r5, 0 - bne _08021320 - movs r0, 0x1 - negs r0, r0 - b _08021446 -_08021320: - ldrb r0, [r5, 0xC] - cmp r0, 0x7 - bls _08021328 - b _0802143E -_08021328: - lsls r0, 2 - ldr r1, =_08021338 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08021338: - .4byte _08021358 - .4byte _0802135E - .4byte _08021368 - .4byte _0802137E - .4byte _0802138A - .4byte _080213E6 - .4byte _08021426 - .4byte _08021436 -_08021358: - bl sub_8010434 - b _0802143E -_0802135E: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08021444 -_08021368: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl UpdatePaletteFade - b _0802143E -_0802137E: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0802143E - b _08021444 -_0802138A: - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _0802143E -_080213E6: - bl FreeAllWindowBuffers - movs r0, 0 - bl HideBg - movs r0, 0 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl HideBg - movs r0, 0x1 - bl UnsetBgTilemapBuffer - movs r0, 0x2 - bl HideBg - movs r0, 0x2 - bl UnsetBgTilemapBuffer - movs r0, 0x3 - bl HideBg - movs r0, 0x3 - bl UnsetBgTilemapBuffer - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl ClearGpuRegBits - b _0802143E -_08021426: - bl sub_800E084 - adds r0, r5, 0 - bl sub_8022960 - bl sub_8034CC8 - b _0802143E -_08021436: - movs r0, 0 - strb r0, [r5, 0xC] - movs r0, 0x1 - b _08021446 -_0802143E: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_08021444: - movs r0, 0 -_08021446: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802130C - - thumb_func_start sub_8021450 -sub_8021450: @ 8021450 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gSpriteCoordOffsetY - ldrh r1, [r4, 0x2C] - ldrh r2, [r4, 0x2A] - adds r1, r2 - strh r1, [r0] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x16 - bl SetGpuReg - ldrh r0, [r4, 0x12] - cmp r0, 0x7 - bne _0802147C - movs r1, 0x9C - lsls r1, 1 - adds r0, r4, r1 - ldrh r1, [r4, 0x28] - bl sub_8022524 -_0802147C: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8021450 - - thumb_func_start sub_8021488 -sub_8021488: @ 8021488 - movs r1, 0 - ldr r2, =0x0000ff98 - strh r2, [r0, 0x2A] - strh r1, [r0, 0x2C] - ldr r0, =gSpriteCoordOffsetX - strh r1, [r0] - ldr r0, =gSpriteCoordOffsetY - strh r2, [r0] - bx lr - .pool - thumb_func_end sub_8021488 - - thumb_func_start sub_80214A8 -sub_80214A8: @ 80214A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r10, r0 - str r1, [sp] - movs r0, 0 - mov r9, r0 - mov r1, r10 - ldrb r1, [r1, 0x9] - cmp r9, r1 - bcc _080214C6 - b _080215E4 -_080214C6: - ldr r1, =gUnknown_082F41E8 - mov r2, r9 - lsls r0, r2, 1 - adds r0, r1 - ldrh r2, [r0] - mov r1, r9 - lsls r0, r1, 5 - add r0, r10 - adds r0, 0xA4 - ldrh r3, [r0] - adds r3, 0x85 - lsls r3, 16 - lsrs r3, 16 - ldr r0, =gUnknown_082F436C - adds r1, r2, 0 - bl AddItemIconObjectWithCustomObjectTemplate - lsls r0, 24 - lsrs r0, 24 - mov r2, r9 - lsls r3, r2, 2 - ldr r1, [sp] - adds r1, 0x38 - adds r6, r1, r3 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r6] - ldrb r0, [r1, 0x5] - movs r2, 0xC - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r2, [r6] - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - ldr r1, [r6] - ldr r0, [sp] - adds r0, 0xC - adds r0, r3 - mov r8, r0 - ldr r0, [r0] - ldrh r0, [r0, 0x8] - adds r0, 0x78 - strh r0, [r1, 0x20] - ldr r1, [r6] - ldr r0, =0x0000fff0 - strh r0, [r1, 0x22] - ldr r3, [r6] - adds r5, r3, 0 - adds r5, 0x2E - movs r0, 0x80 - lsls r0, 2 - strh r0, [r5, 0x2] - movs r0, 0x20 - strh r0, [r5, 0x4] - movs r0, 0x70 - strh r0, [r5, 0xE] - mov r2, r8 - ldr r1, [r2] - ldrh r0, [r1, 0xA] - ldrh r1, [r1, 0x8] - subs r0, r1 - lsls r0, 16 - asrs r1, r0, 16 - adds r0, r1, 0 - cmp r1, 0 - bge _08021558 - adds r0, r1, 0x3 -_08021558: - asrs r0, 2 - strh r0, [r5, 0xC] - lsls r0, r1, 23 - lsrs r7, r0, 16 - movs r2, 0x80 - lsls r2, 2 - adds r2, 0x20 - lsrs r2, 1 - movs r0, 0x7 - movs r1, 0xFE - lsls r1, 6 - str r3, [sp, 0x4] - bl sub_81515D4 - adds r4, r0, 0 - ldr r0, [r6] - ldrh r0, [r0, 0x20] - lsls r0, 7 - ldr r3, [sp, 0x4] - strh r0, [r3, 0x2E] - lsls r1, r7, 16 - asrs r1, 16 - lsls r4, 16 - asrs r4, 16 - movs r0, 0x7 - adds r2, r4, 0 - bl sub_81515D4 - strh r0, [r5, 0x6] - movs r0, 0x7 - adds r1, r4, 0 - movs r2, 0x55 - bl sub_8151550 - adds r2, r0, 0 - movs r0, 0 - strh r0, [r5, 0x8] - lsls r2, 16 - asrs r2, 16 - movs r0, 0x7 - movs r1, 0xFE - lsls r1, 6 - bl sub_81515D4 - strh r0, [r5, 0xA] - ldrh r0, [r5, 0xE] - ldr r2, =0xffff8000 - adds r1, r2, 0 - orrs r0, r1 - strh r0, [r5, 0xE] - mov r1, r8 - ldr r0, [r1] - movs r2, 0x8 - ldrsh r0, [r0, r2] - cmp r0, 0 - bge _080215D0 - ldr r0, [r6] - movs r1, 0x1 - bl StartSpriteAffineAnim -_080215D0: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - mov r0, r10 - ldrb r0, [r0, 0x9] - cmp r9, r0 - bcs _080215E4 - b _080214C6 -_080215E4: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80214A8 - - thumb_func_start sub_8021608 -sub_8021608: @ 8021608 - push {r4-r6,lr} - adds r5, r0, 0 - adds r4, r5, 0 - adds r4, 0x2E - ldrh r0, [r4, 0x4] - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 24 - ldrh r2, [r5, 0x26] - adds r0, r2 - strh r0, [r5, 0x26] - movs r1, 0xE - ldrsh r0, [r4, r1] - movs r6, 0x80 - lsls r6, 8 - ands r0, r6 - cmp r0, 0 - beq _0802166E - ldrh r0, [r4, 0x6] - ldrh r2, [r5, 0x2E] - adds r0, r2 - strh r0, [r5, 0x2E] - ldrh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - adds r0, r1 - strh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 23 - movs r2, 0xC - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r5, 0x24] - movs r1, 0xE - ldrsh r0, [r4, r1] - ands r0, r6 - cmp r0, 0 - beq _0802166E - ldrh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 23 - cmp r0, 0x7E - ble _0802166E - movs r0, 0 - strh r0, [r5, 0x24] - ldrh r1, [r4, 0xE] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xE] -_0802166E: - ldrh r0, [r4] - lsls r0, 16 - asrs r0, 23 - strh r0, [r5, 0x20] - movs r2, 0x22 - ldrsh r1, [r5, r2] - movs r2, 0x26 - ldrsh r0, [r5, r2] - adds r1, r0 - ldrh r2, [r4, 0xE] - ldr r0, =0x00007fff - ands r0, r2 - cmp r1, r0 - blt _0802169A - ldr r0, =SpriteCallbackDummy - str r0, [r5, 0x1C] - adds r0, r5, 0 - bl FreeSpriteOamMatrix - adds r0, r5, 0 - bl DestroySprite -_0802169A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8021608 - - thumb_func_start sub_80216A8 -sub_80216A8: @ 80216A8 - push {r4-r7,lr} - adds r6, r0, 0 - movs r5, 0 - ldrb r0, [r6, 0x9] - cmp r5, r0 - bcs _080216D4 - ldr r7, =gUnknown_082F41E8 -_080216B6: - lsls r0, r5, 1 - adds r0, r7 - ldrh r4, [r0] - adds r0, r4, 0 - bl FreeSpritePaletteByTag - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r0, [r6, 0x9] - cmp r5, r0 - bcc _080216B6 -_080216D4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80216A8 - - thumb_func_start sub_80216E0 -sub_80216E0: @ 80216E0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - adds r6, r0, 0 - str r1, [sp] - movs r0, 0 - str r0, [sp, 0x4] - movs r1, 0x4E - adds r1, r6 - mov r10, r1 - mov r9, r0 - ldrb r2, [r6, 0x9] - cmp r0, r2 - bcs _080217AE - ldr r7, =gUnknown_082F41CC -_08021704: - mov r3, r10 - ldrh r0, [r3, 0xA] - mov r4, r9 - lsls r1, r4, 1 - add r1, r9 - asrs r0, r1 - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - lsrs r1, 16 - mov r8, r1 - cmp r1, 0 - beq _0802179E - ldr r0, [sp, 0x4] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08021748 - lsls r4, 2 - ldr r5, [sp] - adds r5, 0x24 - adds r0, r5, r4 - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim - b _0802175A - .pool -_08021748: - mov r0, r9 - lsls r4, r0, 2 - ldr r5, [sp] - adds r5, 0x24 - adds r0, r5, r4 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim -_0802175A: - adds r3, r5, r4 - ldr r2, [r3] - adds r2, 0x3E - ldrb r0, [r2] - movs r4, 0x5 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - strb r0, [r2] - ldr r2, [r3] - adds r2, 0x2C - ldrb r0, [r2] - subs r4, 0x3C - adds r1, r4, 0 - ands r0, r1 - strb r0, [r2] - ldr r2, [r3] - movs r0, 0x3 - mov r1, r8 - ands r1, r0 - mov r8, r1 - subs r1, 0x1 - lsls r1, 1 - adds r0, r1, r7 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - strh r0, [r2, 0x24] - ldr r2, [r3] - ldr r3, =gUnknown_082F41CC+1 - adds r1, r3 - movs r0, 0 - ldrsb r0, [r1, r0] - strh r0, [r2, 0x26] -_0802179E: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldrb r4, [r6, 0x9] - cmp r9, r4 - bcc _08021704 -_080217AE: - ldr r0, [sp, 0x4] - cmp r0, 0 - bne _080217C0 - adds r2, r6, 0 - adds r2, 0x25 - ldrb r1, [r2] - b _0802189C - .pool -_080217C0: - ldrh r0, [r6, 0x28] - movs r1, 0x3 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r1, r8 - str r1, [sp, 0x8] - movs r2, 0 - mov r9, r2 - mov r3, r10 - ldrh r1, [r3, 0xC] - lsls r0, r1, 1 - adds r0, 0x3 - adds r6, 0x25 - str r6, [sp, 0xC] - adds r3, r1, 0 - cmp r9, r0 - bge _08021890 -_080217E8: - mov r4, r9 - lsls r1, r4, 2 - ldr r0, [sp] - adds r0, 0x4C - adds r7, r0, r1 - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0802187E - ldr r0, =sub_8022B28 - str r0, [r2, 0x1C] - lsls r1, r4, 1 - ldr r3, =gUnknown_082F41CC+6 - adds r0, r1, r3 - movs r4, 0 - ldrsb r4, [r0, r4] - adds r0, r4, 0 - adds r0, 0x78 - strh r0, [r2, 0x20] - ldr r2, [r7] - ldr r0, =gUnknown_082F41CC+7 - adds r1, r0 - movs r6, 0 - ldrsb r6, [r1, r6] - mov r1, r8 - lsls r0, r1, 2 - subs r0, 0x88 - subs r0, r6, r0 - strh r0, [r2, 0x22] - ldr r5, [r7] - ldr r2, [sp, 0x8] - lsls r1, r2, 2 - adds r0, r4, 0 - bl __divsi3 - adds r4, r0 - strh r4, [r5, 0x24] - ldr r0, [r7] - strh r6, [r0, 0x26] - mov r3, r10 - ldrb r1, [r3, 0x4] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08021860 - ldr r0, [r7] - movs r1, 0x1 - bl StartSpriteAnim - b _08021868 - .pool -_08021860: - ldr r0, [r7] - movs r1, 0 - bl StartSpriteAnim -_08021868: - mov r0, r8 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - mov r4, r10 - ldrh r3, [r4, 0xC] - cmp r0, 0x3 - bls _0802187E - movs r0, 0 - mov r8, r0 -_0802187E: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r0, r3, 1 - adds r0, 0x3 - cmp r9, r0 - blt _080217E8 -_08021890: - ldr r2, [sp, 0xC] - ldrb r1, [r2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080218A6 -_0802189C: - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - b _080218C4 -_080218A6: - ldr r3, [sp, 0x4] - cmp r3, 0x1 - bne _080218B4 - movs r0, 0x4E - bl PlaySE - b _080218BA -_080218B4: - movs r0, 0x4D - bl PlaySE -_080218BA: - ldr r4, [sp, 0xC] - ldrb r0, [r4] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4] -_080218C4: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80216E0 - - thumb_func_start sub_80218D4 -sub_80218D4: @ 80218D4 - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r2, 0 - ldrb r0, [r5, 0x9] - cmp r2, r0 - bcs _08021906 - adds r4, r6, 0 - adds r4, 0x24 - movs r7, 0x4 - adds r3, r0, 0 -_080218EA: - lsls r0, r2, 2 - adds r0, r4, r0 - ldr r0, [r0] - adds r0, 0x3E - ldrb r1, [r0] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _08021920 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r3 - bcc _080218EA -_08021906: - movs r2, 0 - adds r3, r6, 0 - adds r3, 0x4C - movs r4, 0x4 -_0802190E: - lsls r0, r2, 2 - adds r0, r3, r0 - ldr r0, [r0] - adds r0, 0x3E - ldrb r1, [r0] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _08021924 -_08021920: - movs r0, 0 - b _0802193C -_08021924: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xA - bls _0802190E - movs r1, 0x2C - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _0802193A - movs r0, 0 - strh r0, [r5, 0x2C] -_0802193A: - movs r0, 0x1 -_0802193C: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80218D4 - - thumb_func_start sub_8021944 -sub_8021944: @ 8021944 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r4, r1, 16 - lsrs r4, 16 - movs r7, 0 - movs r5, 0xE1 - lsls r5, 4 - adds r0, r4, 0 - adds r1, r5, 0 - bl __udivsi3 - strh r0, [r6, 0x4] - adds r0, r4, 0 - adds r1, r5, 0 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3C - bl __udivsi3 - strh r0, [r6, 0x6] - adds r0, r4, 0 - movs r1, 0x3C - bl __umodsi3 - lsls r0, 24 - asrs r0, 16 - movs r1, 0x4 - bl sub_8151534 - adds r2, r7, 0 - lsls r0, 16 - asrs r3, r0, 16 - movs r0, 0x7 - mov r12, r0 - ldr r5, =gUnknown_082F334C - movs r4, 0x1 -_08021990: - mov r0, r12 - subs r1, r0, r2 - adds r0, r3, 0 - asrs r0, r1 - ands r0, r4 - cmp r0, 0 - beq _080219A6 - lsls r0, r2, 2 - adds r0, r5 - ldr r0, [r0] - adds r7, r0 -_080219A6: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _08021990 - ldr r1, =0x000f4240 - adds r0, r7, 0 - bl __udivsi3 - strh r0, [r6, 0x8] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8021944 - - thumb_func_start sub_80219C8 -sub_80219C8: @ 80219C8 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - adds r6, r0, 0 - adds r4, r1, 0 - adds r5, r2, 0 - mov r8, r3 - lsls r6, 24 - lsrs r6, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - movs r2, 0x1 - negs r2, r2 - movs r0, 0x2 - mov r1, r8 - bl GetStringWidth - lsls r4, 2 - lsrs r0, 1 - subs r4, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r0, r5, 1 - adds r0, r5 - ldr r1, =gUnknown_082F32D8 - adds r0, r1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - adds r0, r6, 0 - movs r1, 0x2 - adds r2, r4, 0 - movs r3, 0 - bl box_print - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80219C8 - - thumb_func_start sub_8021A28 -sub_8021A28: @ 8021A28 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - str r0, [sp, 0xC] - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x10] - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x14] - lsls r3, 24 - movs r0, 0 - str r0, [sp, 0x18] - movs r1, 0 - str r1, [sp, 0x1C] - ldr r2, [sp, 0xC] - adds r2, 0x68 - str r2, [sp, 0x20] - movs r4, 0xF0 - lsls r4, 24 - adds r3, r4 - lsrs r3, 24 - ldr r0, [sp, 0x10] - cmp r0, 0x2 - bne _08021A68 - adds r0, r3, 0 - subs r0, 0x2A - lsls r0, 24 - lsrs r3, r0, 24 -_08021A68: - ldr r2, [sp, 0xC] - ldrb r1, [r2, 0x9] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - subs r6, r3, r0 - cmp r6, 0 - ble _08021A84 - lsrs r0, r6, 31 - adds r0, r6, r0 - asrs r0, 1 - adds r6, r0, 0 - adds r6, 0x10 - b _08021A86 -_08021A84: - movs r6, 0x10 -_08021A86: - movs r5, 0 - ldr r3, [sp, 0xC] - ldrb r3, [r3, 0x9] - cmp r5, r3 - bcc _08021A92 - b _08021D14 -_08021A92: - ldr r4, [sp, 0x10] - lsls r4, 2 - str r4, [sp, 0x24] -_08021A98: - bl sub_81AFBF0 - ldr r0, [sp, 0x10] - cmp r0, 0x1 - beq _08021B48 - cmp r0, 0x1 - bgt _08021AC0 - cmp r0, 0 - beq _08021ADE - ldr r4, [sp, 0x14] - subs r4, 0x4 - lsls r1, r6, 24 - mov r10, r1 - ldr r2, [sp, 0x1C] - adds r2, 0xA2 - mov r9, r2 - ldr r3, [sp, 0x18] - lsls r3, 5 - mov r8, r3 - b _08021C5A -_08021AC0: - ldr r4, [sp, 0x10] - cmp r4, 0x2 - bne _08021AC8 - b _08021C1C -_08021AC8: - ldr r4, [sp, 0x14] - subs r4, 0x4 - lsls r0, r6, 24 - mov r10, r0 - ldr r1, [sp, 0x1C] - adds r1, 0xA2 - mov r9, r1 - ldr r2, [sp, 0x18] - lsls r2, 5 - mov r8, r2 - b _08021C5A -_08021ADE: - ldr r0, [sp, 0x20] - adds r0, 0x20 - adds r0, r5 - ldrb r0, [r0] - str r0, [sp, 0x18] - lsls r3, r5, 1 - ldr r2, [sp, 0x20] - adds r2, 0xC - cmp r5, 0 - beq _08021B04 - adds r0, r2, r3 - subs r1, r5, 0x1 - lsls r1, 1 - adds r1, r2, r1 - ldrh r0, [r0] - ldrh r1, [r1] - cmp r0, r1 - beq _08021B04 - str r5, [sp, 0x1C] -_08021B04: - ldr r4, [sp, 0x24] - ldr r1, [sp, 0x10] - adds r0, r4, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r2, r0 - ldrh r1, [r0] - ldr r0, =gStringVar4 - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_082F43B4 - adds r0, r4, r0 - ldr r1, [r0] - ldr r0, =gStringVar4 - bl StringAppend - ldr r4, [sp, 0x14] - subs r4, 0x4 - lsls r2, r6, 24 - mov r10, r2 - ldr r3, [sp, 0x1C] - adds r3, 0xA2 - mov r9, r3 - ldr r0, [sp, 0x18] - lsls r0, 5 - mov r8, r0 - b _08021C5A - .pool -_08021B48: - ldr r1, [sp, 0x20] - adds r0, r1, r5 - adds r0, 0x28 - ldrb r0, [r0] - str r0, [sp, 0x18] - lsls r3, r5, 1 - adds r2, r1, 0 - adds r2, 0xC - cmp r5, 0 - beq _08021B72 - adds r0, r3, 0 - adds r0, 0xA - adds r0, r2, r0 - adds r1, r3, 0 - adds r1, 0x8 - adds r1, r2, r1 - ldrh r0, [r0] - ldrh r1, [r1] - cmp r0, r1 - beq _08021B72 - str r5, [sp, 0x1C] -_08021B72: - ldr r0, [sp, 0x24] - ldr r1, [sp, 0x10] - adds r4, r0, r1 - lsls r4, 1 - adds r4, r3, r4 - adds r4, r2, r4 - ldrh r1, [r4] - lsrs r1, 4 - ldr r0, =gStringVar1 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - movs r7, 0 - ldrb r0, [r4] - movs r3, 0xF - ands r3, r0 - movs r2, 0 - ldr r4, [sp, 0x10] - lsls r4, 2 - str r4, [sp, 0x28] - ldr r4, [sp, 0x14] - subs r4, 0x4 - lsls r0, r6, 24 - mov r10, r0 - ldr r1, [sp, 0x1C] - adds r1, 0xA2 - mov r9, r1 - ldr r0, [sp, 0x18] - lsls r0, 5 - mov r8, r0 - adds r6, 0xE - adds r5, 0x1 - ldr r1, =gUnknown_082F334C - mov r12, r1 -_08021BB8: - movs r0, 0x3 - subs r1, r0, r2 - adds r0, r3, 0 - asrs r0, r1 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08021BD0 - lsls r0, r2, 2 - add r0, r12 - ldr r0, [r0] - adds r7, r0 -_08021BD0: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _08021BB8 - adds r0, r7, 0 - ldr r1, =0x000f4240 - bl __udivsi3 - lsls r0, 24 - lsrs r3, r0, 24 - ldr r0, =gStringVar2 - adds r1, r3, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_082F43B4 - ldr r2, [sp, 0x28] - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =gStringVar4 - bl StringExpandPlaceholders - b _08021C5E - .pool -_08021C1C: - str r5, [sp, 0x18] - str r5, [sp, 0x1C] - lsls r7, r5, 5 - ldr r3, [sp, 0xC] - adds r0, r3, r7 - adds r0, 0xA4 - ldrb r2, [r0] - cmp r2, 0x2B - bls _08021C30 - movs r2, 0 -_08021C30: - lsls r1, r2, 3 - subs r1, r2 - lsls r1, 2 - ldr r0, =gBerries - adds r1, r0 - ldr r0, =gStringVar1 - bl StringCopy - ldr r0, =gUnknown_082F43B4 - ldr r1, [r0, 0x8] - ldr r0, =gStringVar4 - bl StringExpandPlaceholders - ldr r4, [sp, 0x14] - subs r4, 0x4 - lsls r0, r6, 24 - mov r10, r0 - movs r1, 0xA2 - adds r1, r5 - mov r9, r1 - mov r8, r7 -_08021C5A: - adds r6, 0xE - adds r5, 0x1 -_08021C5E: - movs r0, 0x2 - ldr r1, =gStringVar4 - adds r2, r4, 0 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - ldr r3, [sp, 0xC] - movs r4, 0xDD - lsls r4, 1 - adds r0, r3, r4 - ldrb r0, [r0] - lsls r2, 24 - lsrs r2, 24 - mov r1, r10 - lsrs r3, r1, 24 - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r1, =gStringVar4 - str r1, [sp, 0x8] - movs r1, 0x2 - bl box_print - ldr r3, [sp, 0x18] - ldr r2, [sp, 0xC] - ldrb r2, [r2, 0x8] - cmp r3, r2 - bne _08021CC0 - ldr r0, =gStringVar3 - ldr r1, =gText_1DotBlueF700 - bl StringCopy - b _08021CC8 - .pool -_08021CC0: - ldr r0, =gStringVar3 - ldr r1, =gText_1DotF700 - bl StringCopy -_08021CC8: - ldr r4, =gStringVar3 - mov r3, r9 - strb r3, [r4] - mov r1, r8 - adds r1, 0x98 - ldr r0, [sp, 0xC] - adds r1, r0, r1 - movs r0, 0 - bl sub_81AFC0C - ldr r0, =gStringVar4 - adds r1, r4, 0 - bl sub_81AFC28 - ldr r1, [sp, 0xC] - movs r2, 0xDD - lsls r2, 1 - adds r0, r1, r2 - ldrb r0, [r0] - mov r4, r10 - lsrs r3, r4, 24 - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r2, =gStringVar4 - str r2, [sp, 0x8] - movs r1, 0x2 - movs r2, 0x4 - bl box_print - lsls r0, r5, 24 - lsrs r5, r0, 24 - ldr r3, [sp, 0xC] - ldrb r3, [r3, 0x9] - cmp r5, r3 - bcs _08021D14 - b _08021A98 -_08021D14: - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8021A28 - - thumb_func_start sub_8021D34 -sub_8021D34: @ 8021D34 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - mov r8, r0 - movs r0, 0 - mov r10, r0 - movs r6, 0 - movs r1, 0 - str r1, [sp, 0xC] - mov r2, r8 - adds r2, 0x68 - str r2, [sp, 0x10] - movs r4, 0xDD - lsls r4, 1 - add r4, r8 - mov r9, r4 - ldrb r0, [r4] - movs r1, 0x4 - bl GetWindowAttribute - lsls r0, 27 - movs r1, 0xD6 - lsls r1, 24 - adds r0, r1 - lsrs r7, r0, 24 - movs r0, 0x9C - lsls r0, 1 - add r0, r8 - ldr r2, [sp, 0x10] - ldrh r1, [r2, 0x4] - bl sub_8021944 - ldrb r0, [r4] - ldr r4, =gUnknown_082F32D8 - str r4, [sp] - str r6, [sp, 0x4] - ldr r1, =gText_TimeColon - str r1, [sp, 0x8] - movs r1, 0x2 - movs r2, 0 - adds r3, r7, 0 - bl box_print - ldr r4, =gText_SpaceSec - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - movs r1, 0xB0 - subs r0, r1, r0 - lsls r0, 24 - lsrs r6, r0, 24 - mov r2, r9 - ldrb r0, [r2] - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - mov r2, r10 - str r2, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x2 - adds r2, r6, 0 - adds r3, r7, 0 - bl box_print - movs r0, 0x9F - lsls r0, 1 - add r0, r8 - movs r4, 0 - ldrsh r1, [r0, r4] - ldr r0, =gStringVar1 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar2 - movs r1, 0xA0 - lsls r1, 1 - add r1, r8 - movs r2, 0 - ldrsh r1, [r1, r2] - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r5, =gStringVar4 - ldr r1, =gText_XDotY2 - adds r0, r5, 0 - bl StringExpandPlaceholders - movs r0, 0x2 - adds r1, r5, 0 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - subs r0, r6, r0 - lsls r0, 24 - lsrs r6, r0, 24 - mov r4, r9 - ldrb r0, [r4] - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - mov r2, r10 - str r2, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x2 - adds r2, r6, 0 - adds r3, r7, 0 - bl box_print - ldr r4, =gText_SpaceMin - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - subs r0, r6, r0 - lsls r0, 24 - lsrs r6, r0, 24 - mov r1, r9 - ldrb r0, [r1] - ldr r2, =gUnknown_082F32D8 - str r2, [sp] - mov r1, r10 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x2 - adds r2, r6, 0 - adds r3, r7, 0 - bl box_print - movs r0, 0x9E - lsls r0, 1 - add r0, r8 - movs r2, 0 - ldrsh r1, [r0, r2] - ldr r0, =gStringVar1 - movs r2, 0x2 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r1, =gText_StrVar1 - adds r0, r5, 0 - bl StringExpandPlaceholders - movs r0, 0x2 - adds r1, r5, 0 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - subs r0, r6, r0 - lsls r0, 24 - lsrs r6, r0, 24 - mov r4, r9 - ldrb r0, [r4] - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - mov r2, r10 - str r2, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x2 - adds r2, r6, 0 - adds r3, r7, 0 - bl box_print - adds r0, r7, 0 - adds r0, 0xE - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r4] - ldr r4, =gUnknown_082F32D8 - str r4, [sp] - mov r1, r10 - str r1, [sp, 0x4] - ldr r1, =gText_PressingSpeed - str r1, [sp, 0x8] - movs r1, 0x2 - movs r2, 0 - adds r3, r7, 0 - bl box_print - ldr r4, =gText_TimesPerSec - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - movs r2, 0xB0 - subs r0, r2, r0 - lsls r0, 24 - str r0, [sp, 0x18] - lsrs r6, r0, 24 - mov r1, r9 - ldrb r0, [r1] - ldr r2, =gUnknown_082F32D8 - str r2, [sp] - mov r1, r10 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x2 - adds r2, r6, 0 - adds r3, r7, 0 - bl box_print - mov r4, r8 - ldrb r2, [r4, 0x16] - ldrh r0, [r4, 0x16] - mov r12, r0 - movs r1, 0x7 - mov r9, r1 - movs r5, 0x1 - ldr r3, =gUnknown_082F334C -_08021EEC: - mov r4, r9 - mov r0, r10 - subs r1, r4, r0 - adds r0, r2, 0 - asrs r0, r1 - ands r0, r5 - cmp r0, 0 - beq _08021F0A - mov r1, r10 - lsls r0, r1, 2 - adds r0, r3 - ldr r0, [r0] - ldr r4, [sp, 0xC] - adds r4, r0 - str r4, [sp, 0xC] -_08021F0A: - mov r0, r10 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - cmp r0, 0x7 - bls _08021EEC - ldr r0, =gStringVar1 - mov r2, r12 - lsrs r1, r2, 8 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar2 - ldr r1, =0x000f4240 - ldr r0, [sp, 0xC] - bl __udivsi3 - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_XDotY3 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r2, 0x1 - negs r2, r2 - movs r0, 0x2 - adds r1, r4, 0 - bl GetStringWidth - subs r0, r6, r0 - lsls r0, 24 - lsrs r6, r0, 24 - mov r0, r8 - adds r0, 0x25 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _08021FC4 - movs r0, 0xDD - lsls r0, 1 - add r0, r8 - ldrb r0, [r0] - ldr r1, =gUnknown_082F32E7 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x2 - adds r2, r6, 0 - adds r3, r7, 0 - bl box_print - b _08021FDE - .pool -_08021FC4: - movs r0, 0xDD - lsls r0, 1 - add r0, r8 - ldrb r0, [r0] - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - str r2, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x2 - adds r2, r6, 0 - adds r3, r7, 0 - bl box_print -_08021FDE: - adds r0, r7, 0 - adds r0, 0xE - lsls r0, 24 - lsrs r7, r0, 24 - movs r4, 0xDD - lsls r4, 1 - add r8, r4 - mov r1, r8 - ldrb r0, [r1] - ldr r2, =gUnknown_082F32D8 - mov r9, r2 - str r2, [sp] - movs r5, 0 - str r5, [sp, 0x4] - ldr r1, =gText_Silkiness - str r1, [sp, 0x8] - movs r1, 0x2 - movs r2, 0 - adds r3, r7, 0 - bl box_print - ldr r0, =gStringVar1 - ldr r4, [sp, 0x10] - ldrh r1, [r4, 0x8] - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_Var1Percent - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r2, 0x1 - negs r2, r2 - movs r0, 0x2 - adds r1, r4, 0 - bl GetStringWidth - movs r1, 0xB0 - subs r1, r0 - lsls r1, 24 - lsrs r6, r1, 24 - mov r1, r8 - ldrb r0, [r1] - mov r2, r9 - str r2, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x2 - adds r2, r6, 0 - adds r3, r7, 0 - bl box_print - 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_8021D34 - - thumb_func_start sub_8022070 -sub_8022070: @ 8022070 - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r0, 0 - adds r6, r1, 0 - adds r0, r6, 0 - adds r0, 0x80 - ldrb r0, [r0] - cmp r0, 0x5 - bls _08022084 - b _08022218 -_08022084: - lsls r0, 2 - ldr r1, =_08022094 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08022094: - .4byte _080220AC - .4byte _080220F8 - .4byte _0802210C - .4byte _08022130 - .4byte _080221F8 - .4byte _08022200 -_080220AC: - ldrb r0, [r4, 0x9] - subs r0, 0x2 - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r6, 0 - bl sub_8022554 - ldrh r0, [r4, 0x12] - lsls r0, 3 - ldr r2, =gUnknown_082F32CC - mov r1, sp - adds r0, r2 - ldm r0!, {r2,r3} - stm r1!, {r2,r3} - ldrh r0, [r4, 0x12] - cmp r0, 0xD - bne _080220DC - ldr r0, =gUnknown_082F3344 - adds r0, 0x4 - b _080220DE - .pool -_080220DC: - ldr r0, =gUnknown_082F3344 -_080220DE: - adds r0, r5, r0 - ldrb r1, [r0] - mov r0, sp - strb r1, [r0, 0x4] - mov r0, sp - bl AddWindow - adds r1, r6, 0 - adds r1, 0x82 - strb r0, [r1] - b _08022218 - .pool -_080220F8: - adds r4, r6, 0 - adds r4, 0x82 - ldrb r0, [r4] - bl PutWindowTilemap - ldrb r0, [r4] - movs r1, 0 - bl FillWindowPixelBuffer - b _08022218 -_0802210C: - adds r5, r6, 0 - adds r5, 0x82 - ldrb r0, [r5] - ldr r4, =0x0000021d - adds r1, r4, 0 - movs r2, 0xD0 - bl box_border_load_tiles_and_pal - ldrb r0, [r5] - movs r1, 0 - adds r2, r4, 0 - movs r3, 0xD - bl SetWindowBorderStyle - b _08022218 - .pool -_08022130: - ldrb r0, [r4, 0x9] - subs r0, 0x2 - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4, 0x12] - cmp r0, 0xC - beq _08022184 - cmp r0, 0xC - bgt _08022148 - cmp r0, 0xB - beq _0802214E - b _08022218 -_08022148: - cmp r0, 0xD - beq _080221C8 - b _08022218 -_0802214E: - adds r0, r6, 0 - adds r0, 0x82 - ldrb r0, [r0] - ldr r3, =gText_PressesRankings - movs r1, 0x14 - movs r2, 0x3 - bl sub_80219C8 - ldr r0, =gUnknown_082F3344 - adds r0, r5, r0 - ldrb r3, [r0] - lsls r3, 27 - lsrs r3, 24 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0xA0 - bl sub_8021A28 - adds r1, r6, 0 - adds r1, 0x80 - movs r0, 0x5 - b _08022220 - .pool -_08022184: - adds r0, r6, 0 - adds r0, 0x82 - ldrb r0, [r0] - ldr r2, =gUnknown_082F43B4 - adds r1, r4, 0 - adds r1, 0x8F - ldrb r1, [r1] - adds r1, 0x3 - lsls r1, 2 - adds r1, r2 - ldr r3, [r1] - movs r1, 0x14 - movs r2, 0x4 - bl sub_80219C8 - ldr r0, =gUnknown_082F3344 - adds r0, r5, r0 - ldrb r3, [r0] - lsls r3, 27 - lsrs r3, 24 - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0xA0 - bl sub_8021A28 - adds r1, r6, 0 - adds r1, 0x80 - movs r0, 0x5 - b _08022220 - .pool -_080221C8: - adds r0, r6, 0 - adds r0, 0x82 - ldrb r0, [r0] - ldr r3, =gText_CrushingResults - movs r1, 0x16 - movs r2, 0x3 - bl sub_80219C8 - ldr r0, =gUnknown_082F3344 - adds r0, 0x4 - adds r0, r5, r0 - ldrb r3, [r0] - lsls r3, 27 - lsrs r3, 24 - adds r0, r4, 0 - movs r1, 0x2 - movs r2, 0xB0 - bl sub_8021A28 - b _08022218 - .pool -_080221F8: - adds r0, r4, 0 - bl sub_8021D34 - b _08022218 -_08022200: - adds r0, r6, 0 - adds r0, 0x82 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - adds r1, r6, 0 - adds r1, 0x80 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _08022224 -_08022218: - adds r1, r6, 0 - adds r1, 0x80 - ldrb r0, [r1] - adds r0, 0x1 -_08022220: - strb r0, [r1] - movs r0, 0 -_08022224: - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8022070 - - thumb_func_start sub_802222C -sub_802222C: @ 802222C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xDD - lsls r0, 1 - adds r5, r4, r0 - ldrb r0, [r5] - movs r1, 0x1 - bl sub_8198070 - ldrb r0, [r5] - bl RemoveWindow - adds r0, r4, 0 - bl sub_8022600 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802222C - - thumb_func_start sub_8022250 -sub_8022250: @ 8022250 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0 - mov r9, r0 - movs r1, 0 - str r1, [sp, 0xC] - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0x1 - beq _080222D0 - cmp r0, 0x1 - bgt _08022288 - cmp r0, 0 - beq _08022296 - b _080224BA - .pool -_08022288: - cmp r0, 0x2 - bne _0802228E - b _08022480 -_0802228E: - cmp r0, 0x3 - bne _08022294 - b _08022494 -_08022294: - b _080224BA -_08022296: - ldr r0, =gUnknown_082F32EC - bl AddWindow - strh r0, [r6, 0x2] - lsls r0, 24 - lsrs r0, 24 - bl PutWindowTilemap - ldrb r0, [r6, 0x2] - movs r1, 0 - bl FillWindowPixelBuffer - ldrb r0, [r6, 0x2] - ldr r4, =0x0000021d - adds r1, r4, 0 - movs r2, 0xD0 - bl box_border_load_tiles_and_pal - ldrb r0, [r6, 0x2] - movs r1, 0 - adds r2, r4, 0 - movs r3, 0xD - bl SetWindowBorderStyle - b _080224BA - .pool -_080222D0: - ldr r0, =gText_BerryCrush2 - mov r10, r0 - movs r1, 0x1 - negs r1, r1 - mov r8, r1 - movs r0, 0x1 - mov r1, r10 - mov r2, r8 - bl GetStringWidth - lsrs r0, 1 - movs r4, 0x60 - subs r0, r4, r0 - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r6, 0x2] - ldr r5, =gUnknown_082F32E1 - str r5, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r7, 0 - movs r3, 0x1 - bl box_print - ldr r0, =gText_PressingSpeedRankings - mov r10, r0 - movs r0, 0x1 - mov r1, r10 - mov r2, r8 - bl GetStringWidth - lsrs r0, 1 - subs r4, r0 - lsls r4, 24 - lsrs r7, r4, 24 - ldrb r0, [r6, 0x2] - str r5, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r7, 0 - movs r3, 0x11 - bl box_print - movs r0, 0x29 - mov r10, r0 -_08022336: - mov r1, r9 - adds r1, 0x2 - ldr r0, =gStringVar1 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar4 - ldr r1, =gText_Var1Players - bl StringExpandPlaceholders - ldrb r0, [r6, 0x2] - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r1, =gStringVar4 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r2, 0 - mov r3, r10 - bl box_print - movs r0, 0x1 - ldr r1, =gText_TimesPerSec - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - movs r1, 0xC0 - subs r1, r0 - lsls r1, 24 - lsrs r7, r1, 24 - ldrb r0, [r6, 0x2] - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r1, =gText_TimesPerSec - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r7, 0 - mov r3, r10 - bl box_print - movs r2, 0 - mov r0, r9 - lsls r4, r0, 1 - mov r1, r10 - adds r1, 0x10 - str r1, [sp, 0x10] - movs r0, 0x1 - add r9, r0 - adds r0, r4, r6 - ldrb r3, [r0, 0x4] - movs r1, 0x7 - mov r12, r1 - movs r0, 0x1 - mov r8, r0 - ldr r5, =gUnknown_082F334C -_080223AE: - mov r0, r12 - subs r1, r0, r2 - adds r0, r3, 0 - asrs r0, r1 - mov r1, r8 - ands r0, r1 - cmp r0, 0 - beq _080223CA - lsls r0, r2, 2 - adds r0, r5 - ldr r0, [r0] - ldr r1, [sp, 0xC] - adds r1, r0 - str r1, [sp, 0xC] -_080223CA: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _080223AE - adds r0, r4, r6 - ldrh r1, [r0, 0x4] - lsrs r1, 8 - ldr r0, =gStringVar1 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, [sp, 0xC] - ldr r1, =0x000f4240 - bl __udivsi3 - adds r1, r0, 0 - ldr r0, =gStringVar2 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar4 - ldr r1, =gText_XDotY3 - bl StringExpandPlaceholders - movs r0, 0x1 - ldr r1, =gStringVar4 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - subs r0, r7, r0 - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r6, 0x2] - ldr r1, =gUnknown_082F32D8 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r1, =gStringVar4 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r7, 0 - mov r3, r10 - bl box_print - ldr r1, [sp, 0x10] - lsls r0, r1, 24 - lsrs r0, 24 - mov r10, r0 - movs r0, 0 - str r0, [sp, 0xC] - mov r1, r9 - lsls r0, r1, 24 - lsrs r0, 24 - mov r9, r0 - cmp r0, 0x3 - bhi _08022444 - b _08022336 -_08022444: - ldrb r0, [r6, 0x2] - movs r1, 0x3 - bl CopyWindowToVram - b _080224BA - .pool -_08022480: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _080224BA - b _080224C0 - .pool -_08022494: - ldrb r0, [r6, 0x2] - movs r1, 0x1 - bl sub_8198070 - ldrb r0, [r6, 0x2] - bl ClearWindowTilemap - ldrb r0, [r6, 0x2] - bl RemoveWindow - adds r0, r4, 0 - bl DestroyTask - bl EnableBothScriptContexts - bl ScriptContext2_Disable - mov r0, r9 - b _080224BE -_080224BA: - ldrh r0, [r6] - adds r0, 0x1 -_080224BE: - strh r0, [r6] -_080224C0: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8022250 - - thumb_func_start sub_80224D0 -sub_80224D0: @ 80224D0 - push {lr} - bl ScriptContext2_Enable - ldr r0, =sub_8022250 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =gSaveBlock2Ptr - ldr r2, [r0] - movs r3, 0xF6 - lsls r3, 1 - adds r0, r2, r3 - ldrh r0, [r0] - strh r0, [r1, 0xC] - adds r3, 0x2 - adds r0, r2, r3 - ldrh r0, [r0] - strh r0, [r1, 0xE] - adds r3, 0x2 - adds r0, r2, r3 - ldrh r0, [r0] - strh r0, [r1, 0x10] - adds r3, 0x2 - adds r0, r2, r3 - ldrh r0, [r0] - strh r0, [r1, 0x12] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80224D0 - - thumb_func_start sub_8022524 -sub_8022524: @ 8022524 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 16 - lsrs r1, 16 - bl sub_8021944 - movs r0, 0x4 - ldrsh r1, [r4, r0] - movs r0, 0 - bl sub_8035044 - movs r0, 0x6 - ldrsh r1, [r4, r0] - movs r0, 0x1 - bl sub_8035044 - movs r0, 0x8 - ldrsh r1, [r4, r0] - movs r0, 0x2 - bl sub_8035044 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8022524 - - thumb_func_start sub_8022554 -sub_8022554: @ 8022554 - push {lr} - ldr r2, [r0, 0x78] - adds r2, 0x3E - ldrb r1, [r2] - movs r3, 0x4 - orrs r1, r3 - strb r1, [r2] - ldr r1, [r0, 0x7C] - adds r1, 0x3E - ldrb r0, [r1] - orrs r0, r3 - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x1 - bl sub_803547C - movs r0, 0x1 - movs r1, 0x1 - bl sub_803547C - movs r0, 0 - movs r1, 0x1 - bl sub_803547C - pop {r0} - bx r0 - thumb_func_end sub_8022554 - - thumb_func_start sub_8022588 -sub_8022588: @ 8022588 - push {r4-r7,lr} - adds r5, r0, 0 - movs r6, 0 - ldrb r0, [r5, 0x9] - cmp r6, r0 - bcs _080225E8 - ldr r7, =gUnknown_082F417C -_08022596: - lsls r0, r6, 2 - movs r1, 0xA2 - lsls r1, 1 - adds r2, r5, r1 - adds r2, r0 - ldrb r1, [r5, 0x9] - subs r1, 0x2 - lsls r0, r1, 2 - adds r0, r1 - adds r0, r6, r0 - adds r0, r7 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r1, =gUnknown_082F4190 - adds r0, r1 - str r0, [r2] - ldrb r0, [r0] - lsls r0, 3 - ldr r1, =gUnknown_082F32F4 - adds r0, r1 - bl AddWindow - ldr r1, =0x000001bb - adds r4, r5, r1 - adds r4, r6 - strb r0, [r4] - ldrb r0, [r4] - bl PutWindowTilemap - ldrb r0, [r4] - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r5, 0x9] - cmp r6, r0 - bcc _08022596 -_080225E8: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8022588 - - thumb_func_start sub_8022600 -sub_8022600: @ 8022600 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x14 - adds r6, r0, 0 - movs r7, 0 - ldrb r0, [r6, 0x9] - cmp r7, r0 - bcs _080226B6 - movs r1, 0 - mov r8, r1 -_08022616: - ldr r1, =0x000001bb - adds r0, r6, r1 - adds r5, r0, r7 - ldrb r0, [r5] - bl PutWindowTilemap - ldrb r0, [r6, 0x8] - cmp r7, r0 - bne _08022668 - lsls r4, r7, 5 - adds r4, 0x98 - adds r4, r6, r4 - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - lsrs r0, 1 - movs r2, 0x24 - subs r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r0, [r5] - mov r1, r8 - str r1, [sp] - str r1, [sp, 0x4] - ldr r1, =gUnknown_082F32DB - str r1, [sp, 0x8] - mov r1, r8 - str r1, [sp, 0xC] - str r4, [sp, 0x10] - movs r1, 0x2 - movs r3, 0x1 - bl AddTextPrinterParametrized2 - b _0802269C - .pool -_08022668: - lsls r4, r7, 5 - adds r4, 0x98 - adds r4, r6, r4 - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - lsrs r0, 1 - movs r2, 0x24 - subs r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r0, [r5] - mov r1, r8 - str r1, [sp] - str r1, [sp, 0x4] - ldr r1, =gUnknown_082F32DE - str r1, [sp, 0x8] - mov r1, r8 - str r1, [sp, 0xC] - str r4, [sp, 0x10] - movs r1, 0x2 - movs r3, 0x1 - bl AddTextPrinterParametrized2 -_0802269C: - ldr r1, =0x000001bb - adds r0, r6, r1 - adds r0, r7 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r6, 0x9] - cmp r7, r0 - bcc _08022616 -_080226B6: - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8022600 - - thumb_func_start sub_80226D0 -sub_80226D0: @ 80226D0 - push {r4-r6,lr} - sub sp, 0x8 - adds r6, r0, 0 - movs r5, 0 - ldr r0, =gUnknown_08DE3FD4 - ldr r4, =0x0201c000 - adds r1, r4, 0 - bl LZ77UnCompWram - b _0802271A - .pool -_080226EC: - lsls r1, r5, 2 - movs r2, 0xA2 - lsls r2, 1 - adds r0, r6, r2 - adds r0, r1 - ldr r3, [r0] - ldrb r0, [r3] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4, r1 - ldrb r2, [r3, 0x1] - ldrb r3, [r3, 0x2] - movs r0, 0xA - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x3 - bl CopyToBgTilemapBufferRect - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0802271A: - ldrb r0, [r6, 0x9] - cmp r5, r0 - bcc _080226EC - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80226D0 - - thumb_func_start sub_8022730 -sub_8022730: @ 8022730 - push {r4-r7,lr} - adds r6, r0, 0 - movs r5, 0 - ldr r0, =0x0000ff98 - strh r0, [r6, 0x2A] - strh r5, [r6, 0x2C] - ldr r1, =gSpriteCoordOffsetX - strh r5, [r1] - ldr r1, =gSpriteCoordOffsetY - strh r0, [r1] - ldr r4, =gUnknown_082F41F4 -_08022746: - lsls r0, r5, 3 - adds r0, r4 - bl LoadCompressedObjectPic - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08022746 - ldr r0, =gUnknown_082F421C - bl LoadSpritePalettes - ldr r0, =gUnknown_082F430C - movs r1, 0x78 - movs r2, 0x58 - movs r3, 0x5 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - movs r0, 0xAC - lsls r0, 1 - adds r3, r6, r0 - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r3] - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - ldr r1, [r3] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r1] - ldr r1, [r3] - adds r1, 0x2C - ldrb r0, [r1] - movs r2, 0x40 - orrs r0, r2 - strb r0, [r1] - movs r5, 0 - ldrb r1, [r6, 0x9] - cmp r5, r1 - bcs _08022822 - movs r7, 0x4 -_080227AA: - lsls r4, r5, 2 - movs r3, 0xA2 - lsls r3, 1 - adds r0, r6, r3 - adds r0, r4 - ldr r0, [r0] - ldrh r1, [r0, 0x4] - adds r1, 0x78 - lsls r1, 16 - asrs r1, 16 - ldrh r2, [r0, 0x6] - adds r2, 0x20 - lsls r2, 16 - asrs r2, 16 - ldr r0, =gUnknown_082F4324 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - movs r0, 0xAE - lsls r0, 1 - adds r3, r6, r0 - adds r3, r4 - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r3] - ldrb r0, [r1, 0x5] - movs r4, 0xD - negs r4, r4 - adds r2, r4, 0 - ands r0, r2 - orrs r0, r7 - strb r0, [r1, 0x5] - ldr r1, [r3] - adds r1, 0x3E - ldrb r0, [r1] - orrs r0, r7 - strb r0, [r1] - ldr r2, [r3] - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r2, [r3] - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r0, [r6, 0x9] - cmp r5, r0 - bcc _080227AA -_08022822: - movs r5, 0 - ldr r4, =gUnknown_082F41CC+6 - adds r7, r4, 0x1 -_08022828: - lsls r2, r5, 1 - adds r0, r2, r4 - movs r1, 0 - ldrsb r1, [r0, r1] - adds r1, 0x78 - adds r2, r7 - ldrb r2, [r2] - lsls r2, 24 - asrs r2, 24 - adds r2, 0x88 - ldr r0, =gUnknown_082F433C - movs r3, 0x6 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r5, 2 - movs r1, 0xC2 - lsls r1, 1 - adds r3, r6, r1 - adds r3, r0 - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r3] - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - ldr r2, [r3] - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r2, [r3] - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] - ldr r0, [r3] - strh r5, [r0, 0x2E] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xA - bls _08022828 - movs r5, 0 -_0802288E: - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 19 - movs r3, 0xB0 - lsls r3, 16 - adds r1, r3 - asrs r1, 16 - ldr r0, =gUnknown_082F4354 - movs r2, 0x8 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r5, 2 - movs r4, 0xD8 - lsls r4, 1 - adds r3, r6, r4 - adds r3, r0 - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r3] - ldrb r1, [r0, 0x5] - movs r4, 0xD - negs r4, r4 - adds r2, r4, 0 - ands r1, r2 - strb r1, [r0, 0x5] - ldr r2, [r3] - adds r2, 0x3E - ldrb r0, [r2] - adds r4, 0x8 - adds r1, r4, 0 - ands r0, r1 - strb r0, [r2] - ldr r2, [r3] - adds r2, 0x2C - ldrb r0, [r2] - movs r3, 0x41 - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - strb r0, [r2] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x1 - bls _0802288E - ldr r4, =gUnknown_082F4384 - movs r0, 0 - movs r1, 0 - adds r2, r4, 0 - bl sub_8034D14 - adds r2, r4, 0 - adds r2, 0x10 - movs r0, 0x1 - movs r1, 0 - bl sub_8034D14 - adds r4, 0x20 - movs r0, 0x2 - movs r1, 0 - adds r2, r4, 0 - bl sub_8034D14 - ldrh r0, [r6, 0x12] - cmp r0, 0x1 - bne _08022928 - movs r4, 0x9C - lsls r4, 1 - adds r0, r6, r4 - bl sub_8022554 -_08022928: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8022730 - - thumb_func_start sub_8022960 -sub_8022960: @ 8022960 - push {r4-r6,lr} - adds r5, r0, 0 - movs r4, 0 - movs r0, 0x4 - bl FreeSpriteTilesByTag - movs r0, 0x3 - bl FreeSpriteTilesByTag - movs r0, 0x2 - bl FreeSpriteTilesByTag - movs r0, 0x1 - bl FreeSpriteTilesByTag - movs r0, 0x4 - bl FreeSpritePaletteByTag - movs r0, 0x2 - bl FreeSpritePaletteByTag - movs r0, 0x1 - bl FreeSpritePaletteByTag - movs r0, 0xD8 - lsls r0, 1 - adds r6, r5, r0 -_08022996: - lsls r0, r4, 2 - adds r0, r6, r0 - ldr r0, [r0] - bl DestroySprite - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - bls _08022996 - movs r0, 0x2 - bl sub_80353DC - movs r0, 0x1 - bl sub_80353DC - movs r0, 0 - bl sub_80353DC - movs r4, 0 - movs r1, 0xC2 - lsls r1, 1 - adds r6, r5, r1 -_080229C4: - lsls r0, r4, 2 - adds r0, r6, r0 - ldr r0, [r0] - bl DestroySprite - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xA - bls _080229C4 - movs r4, 0 - ldrb r2, [r5, 0x9] - cmp r4, r2 - bcs _080229FC -_080229E0: - lsls r1, r4, 2 - movs r2, 0xAE - lsls r2, 1 - adds r0, r5, r2 - adds r0, r1 - ldr r0, [r0] - bl DestroySprite - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldrb r0, [r5, 0x9] - cmp r4, r0 - bcc _080229E0 -_080229FC: - movs r1, 0xAC - lsls r1, 1 - adds r0, r5, r1 - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08022A18 - adds r0, r2, 0 - bl DestroySprite -_08022A18: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8022960 - - thumb_func_start sub_8022A20 -sub_8022A20: @ 8022A20 - push {lr} - adds r3, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08022A46 - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - subs r2, 0x12 - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] -_08022A46: - pop {r0} - bx r0 - thumb_func_end sub_8022A20 - - thumb_func_start sub_8022A4C -sub_8022A4C: @ 8022A4C - push {r4,r5,lr} - adds r3, r0, 0 - movs r1, 0 - ldr r5, =SpriteCallbackDummy - adds r2, r3, 0 - adds r2, 0x2E - movs r4, 0 -_08022A5A: - lsls r0, r1, 1 - adds r0, r2, r0 - strh r4, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x7 - bls _08022A5A - movs r0, 0 - strh r0, [r3, 0x24] - strh r0, [r3, 0x26] - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - subs r2, 0x12 - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] - str r5, [r3, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8022A4C - - thumb_func_start sub_8022A94 -sub_8022A94: @ 8022A94 - push {r4-r6,lr} - adds r5, r0, 0 - adds r4, r5, 0 - adds r4, 0x2E - ldrh r0, [r4, 0x4] - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 24 - ldrh r2, [r5, 0x26] - adds r0, r2 - strh r0, [r5, 0x26] - movs r1, 0xE - ldrsh r0, [r4, r1] - movs r6, 0x80 - lsls r6, 8 - ands r0, r6 - cmp r0, 0 - beq _08022AFA - ldrh r0, [r4, 0x6] - ldrh r2, [r5, 0x2E] - adds r0, r2 - strh r0, [r5, 0x2E] - ldrh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - adds r0, r1 - strh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 23 - movs r2, 0xC - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r5, 0x24] - movs r1, 0xE - ldrsh r0, [r4, r1] - ands r0, r6 - cmp r0, 0 - beq _08022AFA - ldrh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 23 - cmp r0, 0x7E - ble _08022AFA - movs r0, 0 - strh r0, [r5, 0x24] - ldrh r1, [r4, 0xE] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xE] -_08022AFA: - ldrh r0, [r4] - lsls r0, 16 - asrs r0, 23 - strh r0, [r5, 0x20] - movs r2, 0x22 - ldrsh r1, [r5, r2] - movs r2, 0x26 - ldrsh r0, [r5, r2] - adds r1, r0 - ldrh r2, [r4, 0xE] - ldr r0, =0x00007fff - ands r0, r2 - cmp r1, r0 - ble _08022B1A - ldr r0, =sub_8022A4C - str r0, [r5, 0x1C] -_08022B1A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8022A94 - - thumb_func_start sub_8022B28 -sub_8022B28: @ 8022B28 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - adds r7, r6, 0 - adds r7, 0x2E - movs r0, 0 - mov r8, r0 - movs r2, 0xA0 - lsls r2, 2 - strh r2, [r7, 0x2] - movs r0, 0x20 - strh r0, [r7, 0x4] - movs r1, 0xA8 - strh r1, [r7, 0xE] - movs r0, 0x24 - ldrsh r4, [r6, r0] - lsls r4, 23 - lsrs r4, 16 - ldrh r0, [r6, 0x22] - subs r1, r0 - lsls r1, 23 - asrs r1, 16 - adds r2, 0x20 - asrs r2, 1 - movs r0, 0x7 - bl sub_81515D4 - adds r5, r0, 0 - ldrh r0, [r6, 0x20] - lsls r0, 7 - strh r0, [r6, 0x2E] - lsls r4, 16 - asrs r4, 16 - lsls r5, 16 - asrs r5, 16 - movs r0, 0x7 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_81515D4 - strh r0, [r7, 0x6] - movs r0, 0x7 - adds r1, r5, 0 - movs r2, 0x55 - bl sub_8151550 - adds r2, r0, 0 - mov r1, r8 - strh r1, [r7, 0x8] - movs r1, 0xFE - lsls r1, 6 - lsls r2, 16 - asrs r2, 16 - movs r0, 0x7 - bl sub_81515D4 - strh r0, [r7, 0xA] - movs r2, 0x24 - ldrsh r0, [r6, r2] - cmp r0, 0 - bge _08022BA6 - adds r0, 0x3 -_08022BA6: - asrs r0, 2 - strh r0, [r7, 0xC] - ldrh r0, [r7, 0xE] - ldr r2, =0xffff8000 - adds r1, r2, 0 - orrs r0, r1 - strh r0, [r7, 0xE] - mov r0, r8 - strh r0, [r6, 0x26] - strh r0, [r6, 0x24] - ldr r0, =sub_8022A94 - str r0, [r6, 0x1C] - adds r2, r6, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - adds r2, 0x12 - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8022B28 - - thumb_func_start sub_8022BEC -sub_8022BEC: @ 8022BEC - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r2, 0 - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 24 - lsrs r4, r1, 24 - mov r8, r4 - bl sub_8020C00 - adds r6, r0, 0 - cmp r5, 0x19 - bls _08022C0A - movs r5, 0 -_08022C0A: - cmp r4, 0 - beq _08022C14 - cmp r4, 0x1 - beq _08022C40 - b _08022C4A -_08022C14: - cmp r5, 0 - beq _08022C28 - ldr r0, =gUnknown_082F43CC - lsls r1, r5, 2 - adds r1, r0 - ldr r2, [r1] - adds r0, r6, 0 - adds r1, r7, 0 - bl _call_via_r2 -_08022C28: - ldrb r0, [r6, 0xE] - cmp r0, 0x19 - bls _08022C32 - mov r0, r8 - strb r0, [r6, 0xE] -_08022C32: - ldr r0, =gUnknown_082F43CC - ldrb r1, [r6, 0xE] - lsls r1, 2 - b _08022C44 - .pool -_08022C40: - ldr r0, =gUnknown_082F43CC - lsls r1, r5, 2 -_08022C44: - adds r1, r0 - ldr r0, [r1] - str r0, [r6, 0x4] -_08022C4A: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8022BEC - - thumb_func_start sub_8022C58 -sub_8022C58: @ 8022C58 - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldrb r2, [r1] - ldrb r3, [r1, 0x1] - lsls r3, 8 - orrs r2, r3 - ldrb r3, [r1, 0x2] - lsls r3, 16 - orrs r2, r3 - ldrb r3, [r1, 0x3] - lsls r3, 24 - adds r0, r2, 0 - orrs r0, r3 - ldrb r2, [r1, 0x9] - strb r2, [r1] - ldrb r4, [r1, 0x8] - lsls r4, 8 - ldrb r2, [r1, 0x7] - orrs r4, r2 - ldr r5, =gPaletteFade - ldrb r3, [r5, 0x8] - movs r2, 0x7F - ands r2, r3 - strb r2, [r5, 0x8] - movs r5, 0x4 - ldrsb r5, [r1, r5] - ldrb r2, [r1, 0x5] - ldrb r3, [r1, 0x6] - str r4, [sp] - adds r1, r5, 0 - bl BeginNormalPaletteFade - bl UpdatePaletteFade - movs r0, 0x2 - strb r0, [r6, 0xE] - movs r0, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8022C58 - - thumb_func_start sub_8022CB0 -sub_8022CB0: @ 8022CB0 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - beq _08022CE4 - cmp r0, 0x1 - bgt _08022CC6 - cmp r0, 0 - beq _08022CD0 - b _08022D06 -_08022CC6: - cmp r0, 0x2 - beq _08022CEA - cmp r0, 0x3 - beq _08022CF6 - b _08022D06 -_08022CD0: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _08022D0C - ldrb r0, [r5] - cmp r0, 0 - bne _08022D06 - movs r0, 0x3 - b _08022D0A -_08022CE4: - bl sub_8010434 - b _08022D06 -_08022CEA: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08022D06 - b _08022D0C -_08022CF6: - ldrb r0, [r4, 0xF] - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r0, 0 - strb r0, [r4, 0xC] - b _08022D0E -_08022D06: - ldrb r0, [r4, 0xC] - adds r0, 0x1 -_08022D0A: - strb r0, [r4, 0xC] -_08022D0C: - movs r0, 0 -_08022D0E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8022CB0 - - thumb_func_start sub_8022D14 -sub_8022D14: @ 8022D14 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - adds r7, r0, 0 - adds r5, r1, 0 - ldrb r4, [r5, 0x3] - lsls r4, 8 - ldrb r0, [r5, 0x2] - orrs r4, r0 - ldrb r6, [r7, 0xC] - cmp r6, 0x1 - beq _08022DC0 - cmp r6, 0x1 - bgt _08022D38 - cmp r6, 0 - beq _08022D42 - b _08022E08 -_08022D38: - cmp r6, 0x2 - beq _08022DD8 - cmp r6, 0x3 - beq _08022DE8 - b _08022E08 -_08022D42: - movs r0, 0 - movs r1, 0 - bl sub_81973C4 - ldrb r1, [r5, 0x1] - movs r0, 0x2 - mov r8, r0 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _08022D90 - ldr r4, =gStringVar4 - ldr r1, =gUnknown_082F32A4 - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringExpandPlaceholders - ldrb r3, [r7, 0xB] - str r6, [sp] - mov r0, r8 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl AddTextPrinterParametrized - b _08022DB2 - .pool -_08022D90: - ldr r1, =gUnknown_082F32A4 - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r2, [r0] - ldrb r3, [r7, 0xB] - str r4, [sp] - mov r0, r8 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParametrized -_08022DB2: - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - b _08022E08 - .pool -_08022DC0: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _08022E0E - cmp r4, 0 - bne _08022E08 - ldrb r0, [r7, 0xC] - adds r0, 0x1 - strb r0, [r7, 0xC] - b _08022E08 -_08022DD8: - ldr r0, =gMain - ldrh r0, [r0, 0x2E] - ands r4, r0 - cmp r4, 0 - bne _08022E08 - b _08022E0E - .pool -_08022DE8: - ldrb r1, [r5, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08022DFA - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 -_08022DFA: - ldrb r0, [r7, 0xE] - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - ldrb r0, [r5, 0x4] - b _08022E0C -_08022E08: - ldrb r0, [r7, 0xC] - adds r0, 0x1 -_08022E0C: - strb r0, [r7, 0xC] -_08022E0E: - movs r0, 0 - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8022D14 - - thumb_func_start sub_8022E1C -sub_8022E1C: @ 8022E1C - push {r4,lr} - adds r4, r0, 0 - bl sub_802104C - cmp r0, 0 - beq _08022E34 - ldrb r0, [r4, 0xE] - adds r2, r4, 0 - adds r2, 0x36 - movs r1, 0 - bl sub_8022BEC -_08022E34: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8022E1C - - thumb_func_start sub_8022E3C -sub_8022E3C: @ 8022E3C - push {r4,lr} - adds r4, r0, 0 - bl sub_802130C - cmp r0, 0 - beq _08022E54 - ldrb r0, [r4, 0xE] - adds r2, r4, 0 - adds r2, 0x36 - movs r1, 0 - bl sub_8022BEC -_08022E54: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8022E3C - - thumb_func_start sub_8022E5C -sub_8022E5C: @ 8022E5C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0xC] - cmp r0, 0 - beq _08022E6C - cmp r0, 0x1 - beq _08022E72 - b _08022E9C -_08022E6C: - bl sub_8010434 - b _08022E9C -_08022E72: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08022EA2 - ldr r0, =0x000001e5 - bl PlayNewMapMusic - movs r0, 0x7 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r1, 0 - movs r0, 0x3 - strh r0, [r4, 0x12] - strb r1, [r4, 0xC] - b _08022EA2 - .pool -_08022E9C: - ldrb r0, [r4, 0xC] - adds r0, 0x1 - strb r0, [r4, 0xC] -_08022EA2: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8022E5C - - thumb_func_start sub_8022EAC -sub_8022EAC: @ 8022EAC - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r0, [r4, 0xC] - cmp r0, 0 - beq _08022EC2 - cmp r0, 0x1 - beq _08022EE8 - adds r0, 0x1 - b _08022EF8 -_08022EC2: - adds r0, r4, 0 - bl sub_8024578 - movs r0, 0x1 - str r0, [sp] - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x1 - movs r3, 0 - bl sub_8024644 - movs r0, 0x7 - strb r0, [r4, 0xE] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - b _08022EFA -_08022EE8: - movs r0, 0x8 - strb r0, [r4, 0xE] - movs r0, 0x5 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r0, 0x2 -_08022EF8: - strb r0, [r4, 0xC] -_08022EFA: - movs r0, 0 - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8022EAC - - thumb_func_start sub_8022F04 -sub_8022F04: @ 8022F04 - push {lr} - movs r1, 0 - str r1, [r0, 0x4] - ldr r0, =sub_8020E1C - bl SetMainCallback2 - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8022F04 - - thumb_func_start sub_8022F1C -sub_8022F1C: @ 8022F1C - push {r4-r7,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r2, r1, 0 - ldrb r0, [r5, 0xC] - cmp r0, 0x5 - bls _08022F2C - b _08023060 -_08022F2C: - lsls r0, 2 - ldr r1, =_08022F3C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08022F3C: - .4byte _08022F54 - .4byte _08022F74 - .4byte _08022F7A - .4byte _08022FAA - .4byte _08022FBA - .4byte _08023044 -_08022F54: - movs r0, 0x1 - str r0, [sp] - adds r0, r2, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0 - bl sub_8024644 - movs r0, 0x9 - strb r0, [r5, 0xE] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - b _08023066 -_08022F74: - bl sub_8010434 - b _08023060 -_08022F7A: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08023066 - adds r4, r5, 0 - adds r4, 0x42 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0xC - bl memset - ldrb r0, [r5, 0x8] - lsls r0, 5 - adds r0, r5, r0 - adds r0, 0xA4 - ldrh r0, [r0] - strh r0, [r4] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x2 - bl SendBlock - b _08023060 -_08022FAA: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08023066 - movs r0, 0 - strh r0, [r5, 0x10] - b _08023060 -_08022FBA: - bl GetBlockReceivedStatus - ldr r2, =gUnknown_082F4448 - ldrb r4, [r5, 0x9] - subs r1, r4, 0x2 - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - bne _08023066 - movs r3, 0 - cmp r3, r4 - bcs _0802301E - ldr r7, =gBlockRecvBuffer - movs r6, 0 - ldr r4, =gUnknown_0858AB24 -_08022FDC: - lsls r0, r3, 5 - adds r0, r5, r0 - lsls r1, r3, 8 - adds r1, r7 - ldrh r1, [r1] - adds r2, r0, 0 - adds r2, 0xA4 - strh r1, [r2] - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0xB0 - bls _08022FF6 - strh r6, [r2] -_08022FF6: - ldrh r1, [r2] - lsls r1, 2 - adds r1, r4 - ldrh r0, [r5, 0x18] - ldrb r1, [r1] - adds r0, r1 - strh r0, [r5, 0x18] - ldrh r0, [r2] - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x2] - ldr r0, [r5, 0x1C] - adds r0, r1 - str r0, [r5, 0x1C] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r5, 0x9] - cmp r3, r0 - bcc _08022FDC -_0802301E: - movs r0, 0 - strh r0, [r5, 0x10] - bl ResetBlockReceivedFlags - movs r1, 0x18 - ldrsh r0, [r5, r1] - lsls r0, 8 - movs r1, 0x80 - lsls r1, 6 - bl sub_81515FC - str r0, [r5, 0x20] - b _08023060 - .pool -_08023044: - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - movs r0, 0xA - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r1, 0 - movs r0, 0x4 - strh r0, [r5, 0x12] - strb r1, [r5, 0xC] - b _08023066 -_08023060: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_08023066: - movs r0, 0 - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8022F1C - - thumb_func_start sub_8023070 -sub_8023070: @ 8023070 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0xC] - cmp r0, 0x6 - bls _0802307C - b _080231A8 -_0802307C: - lsls r0, 2 - ldr r1, =_0802308C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802308C: - .4byte _080230A8 - .4byte _080230BA - .4byte _080230E8 - .4byte _08023120 - .4byte _08023150 - .4byte _08023172 - .4byte _08023184 -_080230A8: - movs r0, 0x9C - lsls r0, 1 - adds r1, r4, r0 - adds r0, r4, 0 - bl sub_80214A8 - bl sub_8010434 - b _080231A8 -_080230BA: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080231AE - movs r2, 0x9C - lsls r2, 1 - adds r1, r4, r2 - movs r0, 0 - strb r0, [r1] - ldr r3, =0x00000139 - adds r1, r4, r3 - strb r0, [r1] - adds r2, 0x2 - adds r1, r4, r2 - strb r0, [r1] - adds r3, 0x2 - adds r1, r4, r3 - strb r0, [r1] - b _080231A8 - .pool -_080230E8: - movs r0, 0x9C - lsls r0, 1 - adds r3, r4, r0 - ldrb r0, [r3] - lsls r0, 2 - movs r2, 0xB8 - lsls r2, 1 - adds r1, r4, r2 - adds r0, r1, r0 - ldr r2, [r0] - ldr r0, =sub_8021608 - str r0, [r2, 0x1C] - ldrb r0, [r3] - lsls r0, 2 - adds r1, r0 - ldr r1, [r1] - adds r1, 0x2C - ldrb r2, [r1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1] - movs r0, 0x3D - bl PlaySE - b _080231A8 - .pool -_08023120: - movs r3, 0x9C - lsls r3, 1 - adds r2, r4, r3 - ldrb r0, [r2] - lsls r0, 2 - adds r3, 0x38 - adds r1, r4, r3 - adds r3, r1, r0 - ldr r0, [r3] - ldr r1, [r0, 0x1C] - ldr r0, =sub_8021608 - cmp r1, r0 - beq _080231AE - movs r0, 0 - str r0, [r3] - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - bl sub_8010434 - b _080231A8 - .pool -_08023150: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080231AE - movs r0, 0x9C - lsls r0, 1 - adds r1, r4, r0 - ldrb r0, [r1] - ldrb r2, [r4, 0x9] - cmp r0, r2 - bcs _0802316C - movs r0, 0x2 - b _080231AC -_0802316C: - movs r0, 0 - strb r0, [r1] - b _080231A8 -_08023172: - movs r3, 0x9C - lsls r3, 1 - adds r1, r4, r3 - adds r0, r4, 0 - bl sub_80216A8 - bl sub_8010434 - b _080231A8 -_08023184: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080231AE - movs r0, 0x2B - bl PlaySE - movs r0, 0xB - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r1, 0 - movs r0, 0x5 - strh r0, [r4, 0x12] - strb r1, [r4, 0xC] - b _080231AE -_080231A8: - ldrb r0, [r4, 0xC] - adds r0, 0x1 -_080231AC: - strb r0, [r4, 0xC] -_080231AE: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8023070 - - thumb_func_start sub_80231B8 -sub_80231B8: @ 80231B8 - push {r4-r7,lr} - adds r4, r0, 0 - ldrb r1, [r4, 0xC] - cmp r1, 0x1 - beq _0802321C - cmp r1, 0x1 - bgt _080231CC - cmp r1, 0 - beq _080231D6 - b _080232DC -_080231CC: - cmp r1, 0x2 - beq _0802329C - cmp r1, 0x3 - beq _080232BE - b _080232DC -_080231D6: - ldrh r0, [r4, 0x2A] - adds r0, 0x4 - strh r0, [r4, 0x2A] - lsls r0, 16 - cmp r0, 0 - bge _080231E4 - b _080232E2 -_080231E4: - strh r1, [r4, 0x2A] - ldr r0, =0x00000139 - adds r3, r4, r0 - movs r0, 0x4 - strb r0, [r3] - movs r2, 0x9C - lsls r2, 1 - adds r1, r4, r2 - movs r0, 0 - strb r0, [r1] - ldr r2, =gUnknown_082F326C - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - adds r0, r2 - ldrb r0, [r0] - movs r2, 0x9D - lsls r2, 1 - adds r1, r4, r2 - strb r0, [r1] - movs r0, 0xD6 - bl PlaySE - b _080232DC - .pool -_0802321C: - ldr r7, =gUnknown_082F326C - movs r0, 0x9C - lsls r0, 1 - adds r6, r4, r0 - ldr r1, =0x00000139 - adds r5, r4, r1 - ldrb r1, [r5] - lsls r0, r1, 3 - subs r0, r1 - ldrb r2, [r6] - adds r0, r2 - adds r0, r7 - movs r1, 0 - ldrsb r1, [r0, r1] - strh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x12 - bl SetGpuReg - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1A - bl SetGpuReg - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1E - bl SetGpuReg - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - movs r1, 0x9D - lsls r1, 1 - adds r2, r4, r1 - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r2] - cmp r0, r1 - bcc _080232E2 - ldrb r0, [r5] - cmp r0, 0 - beq _080232DC - subs r0, 0x1 - strb r0, [r5] - ldrb r1, [r5] - lsls r0, r1, 3 - subs r0, r1 - adds r0, r7 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0 - strb r0, [r6] - b _080232E2 - .pool -_0802329C: - movs r0, 0 - strh r0, [r4, 0x2C] - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - movs r0, 0x1E - movs r1, 0 - bl SetGpuReg - bl sub_8010434 - b _080232DC -_080232BE: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080232E2 - movs r0, 0xC - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r1, 0 - movs r0, 0x6 - strh r0, [r4, 0x12] - strb r1, [r4, 0xC] - b _080232E2 -_080232DC: - ldrb r0, [r4, 0xC] - adds r0, 0x1 - strb r0, [r4, 0xC] -_080232E2: - movs r0, 0 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80231B8 - - thumb_func_start sub_80232EC -sub_80232EC: @ 80232EC - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - beq _0802330C - cmp r0, 0x1 - bgt _08023302 - cmp r0, 0 - beq _08023332 - b _0802338C -_08023302: - cmp r0, 0x2 - beq _0802332A - cmp r0, 0x3 - beq _08023338 - b _0802338C -_0802330C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08023392 - movs r1, 0x80 - lsls r1, 5 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x78 - movs r3, 0x50 - bl sub_802EB24 - b _0802338C -_0802332A: - bl sub_802EB84 - cmp r0, 0 - bne _08023392 -_08023332: - bl sub_8010434 - b _0802338C -_08023338: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08023392 - movs r0, 0x9C - lsls r0, 1 - adds r1, r4, r0 - movs r0, 0 - strb r0, [r1] - ldr r2, =0x00000139 - adds r1, r4, r2 - strb r0, [r1] - adds r2, 0x1 - adds r1, r4, r2 - strb r0, [r1] - adds r2, 0x1 - adds r1, r4, r2 - strb r0, [r1] - strh r0, [r4, 0x10] - ldrb r0, [r4, 0x8] - cmp r0, 0 - bne _08023378 - movs r0, 0xD - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - b _08023382 - .pool -_08023378: - movs r0, 0xE - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC -_08023382: - movs r1, 0 - movs r0, 0x7 - strh r0, [r4, 0x12] - strb r1, [r4, 0xC] - b _08023392 -_0802338C: - ldrb r0, [r4, 0xC] - adds r0, 0x1 - strb r0, [r4, 0xC] -_08023392: - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80232EC - - thumb_func_start sub_802339C -sub_802339C: @ 802339C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r4, r0, 0 - movs r0, 0 - mov r8, r0 - movs r2, 0 - adds r7, r2, 0 - ldrb r1, [r4, 0x9] - cmp r7, r1 - bcs _080234AA - movs r2, 0x5E - adds r2, r4 - mov r9, r2 - ldr r3, =gUnknown_082F325C - mov r10, r3 -_080233C0: - lsls r0, r7, 4 - ldr r1, =gUnknown_03003090 - adds r2, r0, r1 - ldrh r1, [r2] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - movs r3, 0xBC - lsls r3, 6 - cmp r0, r3 - bne _0802349E - ldrh r0, [r2, 0x2] - cmp r0, 0x2 - bne _0802349E - ldrb r1, [r2, 0x4] - movs r0, 0x4 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _08023496 - mov r0, r9 - ldrb r2, [r0] - lsrs r1, r2, 3 - mov r3, r10 - adds r0, r7, r3 - ldrb r0, [r0] - orrs r1, r0 - lsls r1, 3 - movs r0, 0x7 - ands r0, r2 - orrs r0, r1 - mov r1, r9 - strb r0, [r1] - lsls r2, r7, 5 - adds r3, r4, r2 - mov r12, r3 - mov r1, r12 - adds r1, 0xB5 - movs r0, 0x1 - strb r0, [r1] - subs r1, 0x7 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - mov r0, r8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - subs r1, 0x8 - ldrh r0, [r4, 0x28] - ldrh r1, [r1] - subs r0, r1 - lsls r0, 16 - lsrs r3, r0, 16 - mov r5, r12 - adds r5, 0xAA - ldrh r1, [r5] - subs r0, r1, 0x1 - adds r6, r2, 0 - cmp r3, r0 - blt _08023468 - adds r0, r1, 0x1 - cmp r3, r0 - bgt _08023468 - mov r1, r12 - adds r1, 0xA8 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - strh r3, [r5] - mov r0, r12 - adds r0, 0xAC - ldrh r1, [r1] - ldrh r2, [r0] - cmp r1, r2 - bls _08023476 - strh r1, [r0] - b _08023476 - .pool -_08023468: - adds r0, r4, r6 - adds r2, r0, 0 - adds r2, 0xA8 - movs r1, 0 - strh r1, [r2] - adds r0, 0xAA - strh r3, [r0] -_08023476: - adds r1, r4, r6 - ldrh r0, [r4, 0x28] - adds r3, r1, 0 - adds r3, 0xA6 - movs r2, 0 - strh r0, [r3] - adds r1, 0xB4 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _0802349E - strb r2, [r1] - b _0802349E -_08023496: - lsls r0, r7, 5 - adds r0, r4, r0 - adds r0, 0xB5 - strb r1, [r0] -_0802349E: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r3, [r4, 0x9] - cmp r7, r3 - bcc _080233C0 -_080234AA: - mov r0, r8 - cmp r0, 0x1 - bls _080234E0 - movs r7, 0 - ldrb r1, [r4, 0x9] - cmp r7, r1 - bcs _080234E0 - movs r3, 0x2 -_080234BA: - lsls r0, r7, 5 - adds r1, r4, r0 - adds r2, r1, 0 - adds r2, 0xB5 - ldrb r0, [r2] - cmp r0, 0 - beq _080234D4 - orrs r0, r3 - strb r0, [r2] - adds r1, 0xB0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_080234D4: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r2, [r4, 0x9] - cmp r7, r2 - bcc _080234BA -_080234E0: - mov r3, r8 - cmp r3, 0 - beq _08023548 - ldrh r0, [r4, 0x2E] - add r0, r8 - strh r0, [r4, 0x2E] - ldr r1, =gUnknown_082F3264 - mov r0, r8 - subs r0, 0x1 - adds r0, r1 - ldrb r0, [r0] - add r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrh r0, [r4, 0x34] - add r0, r8 - strh r0, [r4, 0x34] - ldrh r0, [r4, 0x1A] - add r0, r8 - strh r0, [r4, 0x1A] - movs r1, 0x18 - ldrsh r0, [r4, r1] - movs r3, 0x1A - ldrsh r2, [r4, r3] - subs r0, r2 - cmp r0, 0 - ble _08023534 - lsls r2, 8 - ldr r1, [r4, 0x20] - adds r0, r2, 0 - bl sub_81515FC - adds r2, r0, 0 - asrs r2, 8 - adds r0, r4, 0 - adds r0, 0x24 - strb r2, [r0] - b _08023548 - .pool -_08023534: - adds r1, r4, 0 - adds r1, 0x24 - movs r0, 0x20 - strb r0, [r1] - adds r2, r4, 0 - adds r2, 0x5E - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] -_08023548: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_802339C - - thumb_func_start sub_8023558 -sub_8023558: @ 8023558 - push {r4-r6,lr} - adds r3, r0, 0 - movs r6, 0 - movs r1, 0 - adds r4, r1, 0 - ldrb r0, [r3, 0x9] - cmp r4, r0 - bcs _080235B0 - adds r5, r3, 0 - adds r5, 0x64 -_0802356C: - lsls r0, r4, 5 - adds r1, r3, r0 - adds r0, r1, 0 - adds r0, 0xB5 - ldrb r2, [r0] - cmp r2, 0 - beq _080235A4 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r1, 0 - adds r0, 0xB4 - ldrb r0, [r0] - adds r1, r0, 0x1 - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - beq _08023594 - movs r0, 0x4 - orrs r1, r0 -_08023594: - lsls r0, r4, 1 - adds r0, r4 - lsls r1, r0 - lsls r0, r1, 16 - lsrs r1, r0, 16 - ldrh r0, [r5] - orrs r1, r0 - strh r1, [r5] -_080235A4: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldrb r1, [r3, 0x9] - cmp r4, r1 - bcc _0802356C -_080235B0: - adds r0, r3, 0 - adds r0, 0x24 - ldrb r1, [r0] - adds r0, 0x3C - strh r1, [r0] - cmp r6, 0 - bne _080235D4 - ldr r2, =0x0000013b - adds r0, r3, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080236A0 - movs r4, 0x9C - lsls r4, 1 - adds r1, r3, r4 - b _08023612 - .pool -_080235D4: - ldr r5, =0x0000013b - adds r2, r3, r5 - ldrb r0, [r2] - cmp r0, 0 - beq _0802361A - ldr r0, =0x00000139 - adds r1, r3, r0 - ldrb r2, [r1] - cmp r6, r2 - beq _0802360C - subs r0, r6, 0x1 - strb r0, [r1] - ldr r1, =gUnknown_082F3290 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0] - movs r4, 0x9D - lsls r4, 1 - adds r1, r3, r4 - strb r0, [r1] - b _08023640 - .pool -_0802360C: - movs r5, 0x9C - lsls r5, 1 - adds r1, r3, r5 -_08023612: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08023640 -_0802361A: - movs r0, 0x9C - lsls r0, 1 - adds r1, r3, r0 - movs r0, 0 - strb r0, [r1] - subs r0, r6, 0x1 - ldr r4, =0x00000139 - adds r1, r3, r4 - strb r0, [r1] - ldr r1, =gUnknown_082F3290 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0] - movs r5, 0x9D - lsls r5, 1 - adds r1, r3, r5 - strb r0, [r1] - movs r0, 0x1 - strb r0, [r2] -_08023640: - ldr r0, =0x0000013b - adds r4, r3, r0 - ldrb r0, [r4] - cmp r0, 0 - beq _080236A0 - movs r2, 0x9C - lsls r2, 1 - adds r1, r3, r2 - movs r5, 0x9D - lsls r5, 1 - adds r2, r3, r5 - ldrb r0, [r1] - ldrb r5, [r2] - cmp r0, r5 - bcc _0802367C - movs r0, 0 - strb r0, [r1] - ldr r5, =0x00000139 - adds r1, r3, r5 - strb r0, [r1] - strb r0, [r2] - strb r0, [r4] - movs r1, 0 - b _08023690 - .pool -_0802367C: - ldr r2, =gUnknown_082F3290 - ldrb r1, [r1] - ldr r4, =0x00000139 - adds r0, r3, r4 - ldrb r0, [r0] - lsls r0, 2 - adds r0, 0x1 - adds r1, r0 - adds r1, r2 - ldrb r1, [r1] -_08023690: - adds r0, r3, 0 - adds r0, 0x5F - strb r1, [r0] - b _080236A8 - .pool -_080236A0: - adds r1, r3, 0 - adds r1, 0x5F - movs r0, 0 - strb r0, [r1] -_080236A8: - ldrh r1, [r3, 0x26] - adds r0, r3, 0 - adds r0, 0x62 - strh r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8023558 - - thumb_func_start sub_80236B8 -sub_80236B8: @ 80236B8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - ldr r3, =gMain - ldrh r1, [r3, 0x2E] - movs r4, 0x1 - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _080236DA - adds r2, r5, 0 - adds r2, 0x5E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_080236DA: - ldrh r1, [r3, 0x2C] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _080236FA - ldrb r0, [r5, 0x8] - lsls r0, 5 - adds r0, r5, r0 - adds r1, r0, 0 - adds r1, 0xB2 - ldrh r0, [r1] - ldrh r2, [r5, 0x28] - cmp r0, r2 - bcs _080236FA - adds r0, 0x1 - strh r0, [r1] -_080236FA: - ldrb r0, [r5, 0x8] - adds r7, r5, 0 - adds r7, 0x5E - cmp r0, 0 - beq _08023710 - ldrb r1, [r7] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _08023710 - b _0802384C -_08023710: - adds r4, r5, 0 - adds r4, 0x5C - movs r0, 0x2 - strh r0, [r4] - ldrh r0, [r5, 0x28] - movs r1, 0x1E - bl __umodsi3 - lsls r0, 16 - mov r8, r4 - adds r6, r5, 0 - adds r6, 0x25 - cmp r0, 0 - bne _08023768 - movs r0, 0x2E - ldrsh r2, [r5, r0] - ldr r1, =gUnknown_082F4444 - ldrb r0, [r5, 0x9] - subs r0, 0x2 - adds r0, r1 - ldrb r0, [r0] - cmp r2, r0 - ble _08023754 - ldrh r0, [r5, 0x30] - adds r0, 0x1 - strh r0, [r5, 0x30] - ldrb r0, [r6] - movs r1, 0x10 - orrs r0, r1 - b _0802375C - .pool -_08023754: - ldrb r1, [r6] - movs r0, 0x11 - negs r0, r0 - ands r0, r1 -_0802375C: - strb r0, [r6] - movs r0, 0 - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] -_08023768: - ldrh r0, [r5, 0x28] - movs r1, 0xF - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - bne _080237DE - movs r0, 0x34 - ldrsh r2, [r5, r0] - ldr r3, =gUnknown_082F4434 - ldrb r0, [r5, 0x9] - subs r0, 0x2 - lsls r1, r0, 2 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r2, r0 - bge _08023798 - ldrb r1, [r6] - movs r0, 0x1F - ands r0, r1 - strb r0, [r6] - b _080237D8 - .pool -_08023798: - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - cmp r2, r0 - bge _080237AC - ldrb r0, [r6] - movs r1, 0x1F - ands r1, r0 - movs r0, 0x20 - b _080237D4 -_080237AC: - adds r0, r3, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - cmp r2, r0 - bge _080237BC - movs r0, 0x2 - strh r0, [r5, 0x34] - b _080237D8 -_080237BC: - adds r0, r3, 0x3 - adds r0, r1, r0 - ldrb r0, [r0] - cmp r2, r0 - bge _080237CC - movs r0, 0x3 - strh r0, [r5, 0x34] - b _080237D8 -_080237CC: - ldrb r0, [r6] - movs r1, 0x1F - ands r1, r0 - movs r0, 0x80 -_080237D4: - orrs r1, r0 - strb r1, [r6] -_080237D8: - movs r0, 0 - strh r0, [r5, 0x34] - b _0802380A -_080237DE: - ldrh r0, [r5, 0x10] - adds r0, 0x1 - strh r0, [r5, 0x10] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3C - bls _0802380A - cmp r0, 0x46 - bls _080237FA - bl sub_8011AC8 - movs r0, 0 - strh r0, [r5, 0x10] - b _0802380A -_080237FA: - ldrb r0, [r7] - movs r4, 0xF8 - ands r4, r0 - cmp r4, 0 - bne _0802380A - bl sub_8011AC8 - strh r4, [r5, 0x10] -_0802380A: - ldrh r1, [r5, 0x28] - ldr r0, =0x00008c9f - cmp r1, r0 - bls _0802381A - ldrb r0, [r7] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r7] -_0802381A: - ldrb r1, [r6] - lsls r1, 27 - lsrs r1, 31 - lsls r1, 1 - ldrb r2, [r7] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r7] - ldrb r0, [r6] - lsrs r0, 5 - adds r2, r5, 0 - adds r2, 0x66 - strh r0, [r2] - adds r4, r5, 0 - adds r4, 0x42 - adds r0, r4, 0 - mov r1, r8 - movs r2, 0xC - bl memcpy - adds r0, r4, 0 - bl sub_800FE50 -_0802384C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80236B8 - - thumb_func_start sub_802385C -sub_802385C: @ 802385C - push {r4,r5,lr} - adds r5, r0, 0 - movs r4, 0 - ldr r3, =gUnknown_03003090 - ldrb r0, [r5, 0x9] - cmp r4, r0 - bcs _08023880 - movs r1, 0 -_0802386C: - lsls r0, r4, 5 - adds r0, r5, r0 - adds r0, 0xB5 - strb r1, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldrb r0, [r5, 0x9] - cmp r4, r0 - bcc _0802386C -_08023880: - adds r2, r3, 0 - ldrh r0, [r2] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _08023898 - ldrh r0, [r2, 0x2] - cmp r0, 0x2 - beq _080238AC -_08023898: - adds r2, r5, 0 - adds r2, 0x25 - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - b _080238EA - .pool -_080238AC: - adds r4, r5, 0 - adds r4, 0x4E - adds r0, r4, 0 - adds r1, r3, 0 - movs r2, 0xE - bl memcpy - ldrh r0, [r4, 0x6] - strh r0, [r5, 0x2A] - movs r0, 0x5 - ldrsb r0, [r4, r0] - strh r0, [r5, 0x2C] - ldrh r0, [r4, 0x8] - strh r0, [r5, 0x28] - movs r0, 0x9C - lsls r0, 1 - adds r1, r5, r0 - adds r0, r5, 0 - bl sub_80216E0 - ldrb r1, [r4, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080238EA - adds r0, r5, 0 - adds r0, 0x25 - ldrb r1, [r0] - movs r2, 0x8 - orrs r1, r2 - strb r1, [r0] -_080238EA: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802385C - - thumb_func_start sub_80238F0 -sub_80238F0: @ 80238F0 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x5C - movs r1, 0 - movs r2, 0xC - bl memset - adds r0, r4, 0 - adds r0, 0x4E - movs r1, 0 - movs r2, 0xE - bl memset - adds r0, r4, 0 - bl sub_802385C - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x12 - bl SetGpuReg - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1A - bl SetGpuReg - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1E - bl SetGpuReg - adds r0, r4, 0 - adds r0, 0x25 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _08023978 - ldrh r1, [r4, 0x28] - ldr r0, =0x00008c9f - cmp r1, r0 - bls _08023964 - adds r0, 0x1 - strh r0, [r4, 0x28] - movs r0, 0x10 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - b _0802396E - .pool -_08023964: - movs r0, 0xF - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC -_0802396E: - movs r1, 0 - movs r0, 0 - strh r0, [r4, 0x10] - strb r1, [r4, 0xC] - b _08023992 -_08023978: - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - adds r0, r4, 0 - bl sub_802339C - adds r0, r4, 0 - bl sub_8023558 - adds r0, r4, 0 - bl sub_80236B8 - movs r0, 0 -_08023992: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80238F0 - - thumb_func_start sub_8023998 -sub_8023998: @ 8023998 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x5C - movs r1, 0 - movs r2, 0xC - bl memset - adds r0, r4, 0 - adds r0, 0x4E - movs r1, 0 - movs r2, 0xE - bl memset - adds r0, r4, 0 - bl sub_802385C - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x12 - bl SetGpuReg - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1A - bl SetGpuReg - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1E - bl SetGpuReg - adds r0, r4, 0 - adds r0, 0x25 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _08023A20 - ldrh r1, [r4, 0x28] - ldr r0, =0x00008c9f - cmp r1, r0 - bls _08023A0C - adds r0, 0x1 - strh r0, [r4, 0x28] - movs r0, 0x10 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - b _08023A16 - .pool -_08023A0C: - movs r0, 0xF - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC -_08023A16: - movs r1, 0 - movs r0, 0 - strh r0, [r4, 0x10] - strb r1, [r4, 0xC] - b _08023A28 -_08023A20: - adds r0, r4, 0 - bl sub_80236B8 - movs r0, 0 -_08023A28: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8023998 - - thumb_func_start sub_8023A30 -sub_8023A30: @ 8023A30 - push {r4-r7,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0xC] - cmp r0, 0x5 - bls _08023A3C - b _08023BB2 -_08023A3C: - lsls r0, 2 - ldr r1, =_08023A4C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08023A4C: - .4byte _08023A64 - .4byte _08023A8C - .4byte _08023ADC - .4byte _08023B5C - .4byte _08023B7A - .4byte _08023B94 -_08023A64: - movs r0, 0x8 - strh r0, [r4, 0x12] - movs r0, 0xD6 - bl PlaySE - movs r0, 0x1 - negs r0, r0 - ldr r2, =0x000003ff - movs r1, 0x8 - bl BlendPalettes - movs r0, 0x9C - lsls r0, 1 - adds r1, r4, r0 - movs r0, 0x2 - strb r0, [r1] - b _08023BB2 - .pool -_08023A8C: - movs r1, 0x9C - lsls r1, 1 - adds r5, r4, r1 - ldrb r0, [r5] - subs r0, 0x1 - strb r0, [r5] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08023AA2 - b _08023BB8 -_08023AA2: - movs r0, 0x1 - negs r0, r0 - ldr r2, =0x000003ff - movs r1, 0 - bl BlendPalettes - ldr r2, =0x00000139 - adds r1, r4, r2 - movs r0, 0x4 - strb r0, [r1] - movs r0, 0 - strb r0, [r5] - ldr r2, =gUnknown_082F326C - ldrb r1, [r1] - lsls r0, r1, 3 - subs r0, r1 - adds r0, r2 - ldrb r0, [r0] - movs r2, 0x9D - lsls r2, 1 - adds r1, r4, r2 - strb r0, [r1] - b _08023BB2 - .pool -_08023ADC: - ldr r7, =gUnknown_082F326C - movs r0, 0x9C - lsls r0, 1 - adds r6, r4, r0 - ldr r1, =0x00000139 - adds r5, r4, r1 - ldrb r1, [r5] - lsls r0, r1, 3 - subs r0, r1 - ldrb r2, [r6] - adds r0, r2 - adds r0, r7 - movs r1, 0 - ldrsb r1, [r0, r1] - strh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x12 - bl SetGpuReg - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1A - bl SetGpuReg - ldrh r1, [r4, 0x2C] - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1E - bl SetGpuReg - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - movs r1, 0x9D - lsls r1, 1 - adds r2, r4, r1 - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r2] - cmp r0, r1 - bcc _08023BB8 - ldrb r0, [r5] - cmp r0, 0 - beq _08023BB2 - subs r0, 0x1 - strb r0, [r5] - ldrb r1, [r5] - lsls r0, r1, 3 - subs r0, r1 - adds r0, r7 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0 - strb r0, [r6] - b _08023BB8 - .pool -_08023B5C: - movs r0, 0 - strh r0, [r4, 0x2C] - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - movs r0, 0x1E - movs r1, 0 - bl SetGpuReg - b _08023BB2 -_08023B7A: - movs r2, 0x9C - lsls r2, 1 - adds r1, r4, r2 - adds r0, r4, 0 - bl sub_80218D4 - cmp r0, 0 - beq _08023BB8 - bl sub_8010434 - movs r0, 0 - strh r0, [r4, 0x10] - b _08023BB2 -_08023B94: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08023BB8 - movs r0, 0x11 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r1, 0 - movs r0, 0 - strh r0, [r4, 0x10] - strb r1, [r4, 0xC] - b _08023BBA -_08023BB2: - ldrb r0, [r4, 0xC] - adds r0, 0x1 - strb r0, [r4, 0xC] -_08023BB8: - movs r0, 0 -_08023BBA: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8023A30 - - thumb_func_start sub_8023BC0 -sub_8023BC0: @ 8023BC0 - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - beq _08023C04 - cmp r0, 0x1 - bgt _08023BD8 - cmp r0, 0 - beq _08023BE2 - b _08023C9C -_08023BD8: - cmp r0, 0x2 - beq _08023C2A - cmp r0, 0x3 - beq _08023C5C - b _08023C9C -_08023BE2: - movs r0, 0x9 - strh r0, [r5, 0x12] - movs r0, 0x20 - bl PlaySE - movs r0, 0x1 - negs r0, r0 - movs r1, 0x8 - movs r2, 0x1F - bl BlendPalettes - movs r0, 0x9C - lsls r0, 1 - adds r1, r5, r0 - movs r0, 0x4 - strb r0, [r1] - b _08023C9C -_08023C04: - movs r0, 0x9C - lsls r0, 1 - adds r4, r5, r0 - ldrb r0, [r4] - subs r0, 0x1 - strb r0, [r4] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _08023CA2 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - movs r2, 0x1F - bl BlendPalettes - movs r0, 0 - strb r0, [r4] - b _08023C9C -_08023C2A: - movs r0, 0x9C - lsls r0, 1 - adds r1, r5, r0 - adds r0, r5, 0 - bl sub_80218D4 - cmp r0, 0 - beq _08023CA2 - bl sub_8010434 - movs r0, 0 - strh r0, [r5, 0x10] - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - movs r0, 0x1E - movs r1, 0 - bl SetGpuReg - b _08023C9C -_08023C5C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08023CA2 - ldr r0, =gStringVar1 - ldr r1, [r5, 0x1C] - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - movs r4, 0 - str r4, [sp] - adds r0, r6, 0 - movs r1, 0x7 - movs r2, 0x1 - movs r3, 0 - bl sub_8024644 - movs r0, 0x13 - strb r0, [r5, 0xE] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r0, 0 - strh r4, [r5, 0x10] - b _08023CA0 - .pool -_08023C9C: - ldrb r0, [r5, 0xC] - adds r0, 0x1 -_08023CA0: - strb r0, [r5, 0xC] -_08023CA2: - movs r0, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8023BC0 - - thumb_func_start sub_8023CAC -sub_8023CAC: @ 8023CAC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - adds r7, r0, 0 - ldrb r0, [r7, 0xC] - cmp r0, 0x7 - bls _08023CC2 - b _0802402E -_08023CC2: - lsls r0, 2 - ldr r1, =_08023CD0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08023CD0: - .4byte _08023CF0 - .4byte _08023D2A - .4byte _08023D38 - .4byte _08023DA0 - .4byte _08023F20 - .4byte _08023FD0 - .4byte _08023FDC - .4byte _08024010 -_08023CF0: - adds r4, r7, 0 - adds r4, 0x42 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x4 - bl memset - ldrb r0, [r7, 0x8] - lsls r0, 5 - adds r0, r7, r0 - adds r2, r0, 0 - adds r2, 0xB2 - ldrh r1, [r7, 0x28] - ldrh r0, [r2] - cmp r0, r1 - bls _08023D12 - strh r1, [r2] -_08023D12: - ldrb r0, [r7, 0x8] - lsls r0, 5 - adds r0, r7, r0 - adds r0, 0xB2 - ldrh r0, [r0] - strh r0, [r4] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x2 - bl SendBlock - b _0802402E -_08023D2A: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08023D36 - b _08024034 -_08023D36: - b _08024004 -_08023D38: - bl GetBlockReceivedStatus - ldr r2, =gUnknown_082F4448 - ldrb r3, [r7, 0x9] - subs r1, r3, 0x2 - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - beq _08023D50 - b _08024034 -_08023D50: - movs r0, 0 - mov r8, r0 - adds r4, r7, 0 - adds r4, 0x42 - cmp r8, r3 - bcs _08023D7E - ldr r2, =gBlockRecvBuffer -_08023D5E: - mov r3, r8 - lsls r1, r3, 5 - adds r1, r7, r1 - lsls r0, r3, 8 - adds r0, r2 - ldrh r0, [r0] - adds r1, 0xB2 - strh r0, [r1] - mov r0, r8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrb r6, [r7, 0x9] - cmp r8, r6 - bcc _08023D5E -_08023D7E: - movs r0, 0 - strh r0, [r7, 0x10] - strh r0, [r4] - bl ResetBlockReceivedFlags - ldrb r0, [r7, 0x8] - cmp r0, 0 - bne _08023D9C - movs r0, 0x3 - b _08024032 - .pool -_08023D9C: - movs r0, 0x6 - b _08024032 -_08023DA0: - adds r0, r7, 0 - adds r0, 0x68 - movs r1, 0 - movs r2, 0x30 - bl memset - ldrh r1, [r7, 0x28] - adds r0, r7, 0 - adds r0, 0x6C - strh r1, [r0] - movs r0, 0x18 - ldrsh r4, [r7, r0] - ldrh r0, [r7, 0x28] - movs r1, 0x3C - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl __divsi3 - adds r1, r7, 0 - adds r1, 0x6E - strh r0, [r1] - movs r1, 0x30 - ldrsh r0, [r7, r1] - lsls r0, 8 - movs r4, 0xC8 - lsls r4, 6 - adds r1, r4, 0 - bl sub_8151574 - adds r2, r0, 0 - movs r3, 0x32 - ldrsh r1, [r7, r3] - lsls r1, 8 - bl sub_81515FC - adds r2, r0, r4 - asrs r2, 8 - movs r1, 0x7F - adds r0, r2, 0 - ands r0, r1 - adds r1, r7, 0 - adds r1, 0x70 - strh r0, [r1] - lsls r2, 8 - movs r1, 0xC8 - lsls r1, 7 - adds r0, r2, 0 - bl sub_81515FC - adds r2, r0, 0 - ldrb r1, [r7, 0x9] - ldr r0, [r7, 0x1C] - muls r0, r1 - lsls r4, r0, 8 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_8151574 - adds r4, r0, 0 - asrs r0, r4, 8 - str r0, [r7, 0x68] - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - adds r1, r7, 0 - adds r1, 0x8F - strb r0, [r1] - movs r6, 0 - mov r8, r6 - mov r9, r1 - ldrb r0, [r7, 0x9] - cmp r8, r0 - bcc _08023E44 - b _0802402E -_08023E44: - adds r0, r7, 0 - adds r0, 0x88 - add r0, r8 - mov r1, r8 - strb r1, [r0] - adds r0, r7, 0 - adds r0, 0x90 - add r0, r8 - strb r1, [r0] - mov r3, r8 - lsls r2, r3, 1 - adds r1, r7, 0 - adds r1, 0x74 - adds r1, r2 - lsls r0, r3, 5 - adds r3, r7, r0 - adds r5, r3, 0 - adds r5, 0xAE - ldrh r0, [r5] - strh r0, [r1] - adds r1, r7, 0 - adds r1, 0x72 - ldrh r6, [r1] - adds r0, r6 - strh r0, [r1] - mov r1, r9 - ldrb r0, [r1] - adds r6, r2, 0 - cmp r0, 0x1 - beq _08023EAE - cmp r0, 0x1 - bgt _08023E8A - cmp r0, 0 - beq _08023E90 - b _08023F04 -_08023E8A: - cmp r0, 0x2 - beq _08023ECC - b _08023F04 -_08023E90: - ldrh r0, [r5] - cmp r0, 0 - beq _08023ED2 - adds r0, r3, 0 - adds r0, 0xAC - ldrh r2, [r0] - lsls r2, 8 - adds r0, r2, 0 - movs r1, 0xC8 - lsls r1, 7 - bl sub_8151574 - adds r2, r0, 0 - ldrh r4, [r5] - b _08023EFA -_08023EAE: - ldrh r0, [r5] - cmp r0, 0 - beq _08023ED2 - adds r0, r3, 0 - adds r0, 0xB0 - ldrh r2, [r0] - lsls r2, 8 - adds r0, r2, 0 - movs r1, 0xC8 - lsls r1, 7 - bl sub_8151574 - adds r2, r0, 0 - ldrh r4, [r5] - b _08023EFA -_08023ECC: - ldrh r0, [r5] - cmp r0, 0 - bne _08023ED6 -_08023ED2: - movs r4, 0 - b _08023F04 -_08023ED6: - adds r1, r3, 0 - adds r1, 0xB2 - ldrh r0, [r1] - ldrh r2, [r7, 0x28] - cmp r0, r2 - bcc _08023EE8 - movs r4, 0xC8 - lsls r4, 7 - b _08023F04 -_08023EE8: - ldrh r2, [r1] - lsls r2, 8 - adds r0, r2, 0 - movs r1, 0xC8 - lsls r1, 7 - bl sub_8151574 - adds r2, r0, 0 - ldrh r4, [r7, 0x28] -_08023EFA: - lsls r4, 8 - adds r1, r4, 0 - bl sub_81515FC - adds r4, r0, 0 -_08023F04: - asrs r4, 4 - adds r0, r7, 0 - adds r0, 0x7E - adds r0, r6 - strh r4, [r0] - mov r0, r8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrb r3, [r7, 0x9] - cmp r8, r3 - bcc _08023E44 - b _0802402E -_08023F20: - movs r6, 0 - mov r8, r6 - ldrb r0, [r7, 0x9] - subs r0, 0x1 - adds r1, r7, 0 - adds r1, 0x68 - str r1, [sp, 0xC] - cmp r8, r0 - bge _08023FC4 -_08023F32: - ldrb r0, [r7, 0x9] - subs r0, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - mov r2, r8 - adds r2, 0x1 - str r2, [sp, 0x8] - cmp r4, r8 - bls _08023FB4 - adds r3, r7, 0 - adds r3, 0x74 - str r3, [sp] - adds r6, r7, 0 - adds r6, 0x88 - str r6, [sp, 0x4] - movs r0, 0x90 - adds r0, r7 - mov r10, r0 - movs r1, 0x7E - adds r1, r7 - mov r9, r1 -_08023F5C: - subs r2, r4, 0x1 - mov r12, r2 - lsls r6, r2, 1 - ldr r0, [sp] - adds r3, r0, r6 - lsls r5, r4, 1 - adds r1, r0, r5 - ldrh r2, [r3] - ldrh r0, [r1] - cmp r2, r0 - bcs _08023F86 - ldrh r0, [r1] - strh r2, [r1] - strh r0, [r3] - ldr r1, [sp, 0x4] - adds r2, r1, r4 - ldrb r3, [r2] - add r1, r12 - ldrb r0, [r1] - strb r0, [r2] - strb r3, [r1] -_08023F86: - mov r2, r9 - adds r3, r2, r6 - adds r1, r2, r5 - ldrh r2, [r3] - ldrh r6, [r1] - cmp r2, r6 - bcs _08023FAA - ldrh r0, [r1] - strh r2, [r1] - strh r0, [r3] - mov r0, r10 - adds r2, r0, r4 - ldrb r3, [r2] - mov r1, r10 - add r1, r12 - ldrb r0, [r1] - strb r0, [r2] - strb r3, [r1] -_08023FAA: - mov r1, r12 - lsls r0, r1, 24 - lsrs r4, r0, 24 - cmp r4, r8 - bhi _08023F5C -_08023FB4: - ldr r2, [sp, 0x8] - lsls r0, r2, 24 - lsrs r0, 24 - mov r8, r0 - ldrb r0, [r7, 0x9] - subs r0, 0x1 - cmp r8, r0 - blt _08023F32 -_08023FC4: - movs r0, 0 - ldr r1, [sp, 0xC] - movs r2, 0x30 - bl SendBlock - b _0802402E -_08023FD0: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08024034 - b _08024004 -_08023FDC: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08024034 - adds r4, r7, 0 - adds r4, 0x68 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x30 - bl memset - ldr r1, =gBlockRecvBuffer - adds r0, r4, 0 - movs r2, 0x30 - bl memcpy - bl ResetBlockReceivedFlags -_08024004: - movs r0, 0 - strh r0, [r7, 0x10] - b _0802402E - .pool -_08024010: - bl sub_8020E58 - movs r0, 0x12 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r0, 0 - movs r1, 0xB - strh r1, [r7, 0x12] - strb r0, [r7, 0xC] - adds r1, r7, 0 - adds r1, 0x24 - strb r0, [r1] - b _08024034 -_0802402E: - ldrb r0, [r7, 0xC] - adds r0, 0x1 -_08024032: - strb r0, [r7, 0xC] -_08024034: - movs r0, 0 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8023CAC - - thumb_func_start sub_8024048 -sub_8024048: @ 8024048 - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - ldrb r0, [r5, 0xC] - cmp r0, 0x4 - bhi _08024124 - lsls r0, 2 - ldr r1, =_08024064 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08024064: - .4byte _08024078 - .4byte _0802408A - .4byte _0802409C - .4byte _080240CC - .4byte _080240DC -_08024078: - movs r0, 0x9C - lsls r0, 1 - adds r1, r5, r0 - adds r0, r5, 0 - bl sub_8022070 - cmp r0, 0 - bne _08024124 - b _0802412A -_0802408A: - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x9C - lsls r0, 1 - adds r1, r5, r0 - movs r0, 0x1E - strb r0, [r1] - b _08024124 -_0802409C: - movs r0, 0x9C - lsls r0, 1 - adds r1, r5, r0 - ldrb r0, [r1] - cmp r0, 0 - beq _080240AE - subs r0, 0x1 - strb r0, [r1] - b _0802412A -_080240AE: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0802412A - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_802222C - b _08024124 - .pool -_080240CC: - ldrh r0, [r5, 0x12] - cmp r0, 0xC - bhi _08024124 - adds r0, 0x1 - movs r1, 0 - strh r0, [r5, 0x12] - strb r1, [r5, 0xC] - b _0802412A -_080240DC: - ldr r0, =gStringVar1 - ldr r1, [r5, 0x1C] - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar2 - bl sub_80247BC - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - movs r4, 0 - str r4, [sp] - adds r0, r6, 0 - movs r1, 0x2 - movs r2, 0x3 - movs r3, 0 - bl sub_8024644 - movs r0, 0x13 - strb r0, [r5, 0xE] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - strb r4, [r5, 0xC] - b _0802412A - .pool -_08024124: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_0802412A: - movs r0, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8024048 - - thumb_func_start sub_8024134 -sub_8024134: @ 8024134 - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r0, 0 - adds r4, r1, 0 - ldrb r0, [r5, 0xC] - cmp r0, 0x4 - bhi _08024218 - lsls r0, 2 - ldr r1, =_08024150 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08024150: - .4byte _08024164 - .4byte _080241A0 - .4byte _080241A6 - .4byte _080241F0 - .4byte _08024204 -_08024164: - ldrh r1, [r5, 0x28] - ldr r0, =0x00008c9f - cmp r1, r0 - bls _08024176 - movs r1, 0x9C - lsls r1, 1 - adds r0, r5, r1 - bl sub_8022554 -_08024176: - movs r0, 0x1 - str r0, [sp] - adds r0, r4, 0 - movs r1, 0x8 - movs r2, 0 - movs r3, 0 - bl sub_8024644 - movs r4, 0 - movs r0, 0x13 - strb r0, [r5, 0xE] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - strb r4, [r5, 0xC] - b _0802421E - .pool -_080241A0: - bl sub_8010434 - b _08024218 -_080241A6: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0802421E - movs r0, 0 - movs r1, 0 - bl sub_81973C4 - ldr r2, =gUnknown_082C8959 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParametrized - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =sub_8153688 - movs r1, 0 - bl CreateTask - b _08024218 - .pool -_080241F0: - ldr r0, =sub_8153688 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08024218 - b _0802421E - .pool -_08024204: - movs r0, 0x14 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r1, 0 - movs r0, 0xF - strh r0, [r5, 0x12] - strb r1, [r5, 0xC] - b _0802421E -_08024218: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_0802421E: - movs r0, 0 - add sp, 0x10 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8024134 - - thumb_func_start sub_8024228 -sub_8024228: @ 8024228 - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - beq _0802426A - cmp r0, 0x1 - bgt _08024240 - cmp r0, 0 - beq _08024246 - b _080242D0 -_08024240: - cmp r0, 0x2 - beq _08024270 - b _080242D0 -_08024246: - movs r0, 0x1 - str r0, [sp] - adds r0, r6, 0 - movs r1, 0x4 - movs r2, 0 - movs r3, 0 - bl sub_8024644 - movs r0, 0x14 - strb r0, [r5, 0xE] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r0, 0 - strb r0, [r5, 0xC] - b _080242D8 -_0802426A: - bl sub_8197930 - b _080242D0 -_08024270: - bl sub_8198C58 - lsls r0, 24 - asrs r4, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _080242D6 - adds r0, r5, 0 - adds r0, 0x42 - movs r1, 0 - movs r2, 0xC - bl memset - cmp r4, 0 - bne _080242A2 - bl HasAtLeastOneBerry - lsls r0, 24 - cmp r0, 0 - beq _0802429E - strh r4, [r5, 0x14] - b _080242A6 -_0802429E: - movs r0, 0x3 - b _080242A4 -_080242A2: - movs r0, 0x1 -_080242A4: - strh r0, [r5, 0x14] -_080242A6: - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - movs r4, 0 - str r4, [sp] - adds r0, r6, 0 - movs r1, 0x8 - movs r2, 0 - movs r3, 0 - bl sub_8024644 - movs r0, 0x15 - strb r0, [r5, 0xE] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - strb r4, [r5, 0xC] - b _080242D6 -_080242D0: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_080242D6: - movs r0, 0 -_080242D8: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8024228 - - thumb_func_start sub_80242E0 -sub_80242E0: @ 80242E0 - push {r4-r7,lr} - adds r4, r0, 0 - movs r5, 0 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - beq _08024306 - cmp r0, 0x1 - bgt _080242F6 - cmp r0, 0 - beq _08024300 - b _080243AC -_080242F6: - cmp r0, 0x2 - beq _08024328 - cmp r0, 0x3 - beq _08024336 - b _080243AC -_08024300: - bl sub_8010434 - b _080243AC -_08024306: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080243B2 - ldrh r0, [r4, 0x14] - adds r1, r4, 0 - adds r1, 0x42 - strh r0, [r1] - adds r0, r4, 0 - adds r0, 0x4E - strh r5, [r0] - movs r0, 0 - movs r2, 0x2 - bl SendBlock - b _080243AC -_08024328: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080243B2 - strh r5, [r4, 0x10] - b _080243AC -_08024336: - bl GetBlockReceivedStatus - ldr r2, =gUnknown_082F4448 - ldrb r3, [r4, 0x9] - subs r1, r3, 0x2 - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - bne _080243B2 - adds r7, r4, 0 - adds r7, 0x42 - adds r6, r4, 0 - adds r6, 0x4E - cmp r5, r3 - bcs _08024374 - adds r1, r6, 0 - ldr r2, =gBlockRecvBuffer -_0802435C: - lsls r0, r5, 8 - adds r0, r2 - ldrh r0, [r0] - ldrh r3, [r1] - adds r0, r3 - strh r0, [r1] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r0, [r4, 0x9] - cmp r5, r0 - bcc _0802435C -_08024374: - ldrh r0, [r6] - cmp r0, 0 - beq _08024390 - movs r0, 0x17 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - b _0802439A - .pool -_08024390: - movs r0, 0x16 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC -_0802439A: - bl ResetBlockReceivedFlags - movs r1, 0 - movs r0, 0 - strh r0, [r7] - strh r0, [r6] - strh r0, [r4, 0x10] - strb r1, [r4, 0xC] - b _080243B4 -_080243AC: - ldrb r0, [r4, 0xC] - adds r0, 0x1 - strb r0, [r4, 0xC] -_080243B2: - movs r0, 0 -_080243B4: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80242E0 - - thumb_func_start sub_80243BC -sub_80243BC: @ 80243BC - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - ldrb r4, [r5, 0xC] - cmp r4, 0x1 - beq _080243EA - cmp r4, 0x1 - bgt _080243D2 - cmp r4, 0 - beq _080243DC - b _08024434 -_080243D2: - cmp r4, 0x2 - beq _080243F6 - cmp r4, 0x3 - beq _0802441A - b _08024434 -_080243DC: - movs r0, 0x1 - negs r0, r0 - str r4, [sp] - movs r1, 0x1 - movs r2, 0 - movs r3, 0x10 - b _08024410 -_080243EA: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _08024434 - b _0802443A -_080243F6: - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - adds r0, r5, 0 - bl sub_8021488 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 -_08024410: - bl BeginNormalPaletteFade - bl UpdatePaletteFade - b _08024434 -_0802441A: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0802443A - movs r0, 0x7 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - movs r0, 0 - strh r4, [r5, 0x12] - b _08024438 -_08024434: - ldrb r0, [r5, 0xC] - adds r0, 0x1 -_08024438: - strb r0, [r5, 0xC] -_0802443A: - movs r0, 0 - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80243BC - - thumb_func_start sub_8024444 -sub_8024444: @ 8024444 - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r0, 0 - ldrb r4, [r5, 0xC] - cmp r4, 0x1 - beq _080244BC - cmp r4, 0x1 - bgt _0802445A - cmp r4, 0 - beq _08024460 - b _080244F6 -_0802445A: - cmp r4, 0x2 - beq _080244D4 - b _080244F6 -_08024460: - movs r0, 0 - movs r1, 0 - bl sub_81973C4 - ldrh r1, [r5, 0x14] - cmp r1, 0x3 - bne _08024490 - ldr r0, =gUnknown_082F32A4 - ldr r2, [r0, 0x14] - ldrb r3, [r5, 0xB] - str r4, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - str r1, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParametrized - b _080244AC - .pool -_08024490: - ldr r0, =gUnknown_082F32A4 - ldr r2, [r0, 0x18] - ldrb r3, [r5, 0xB] - str r4, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParametrized -_080244AC: - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - b _080244F6 - .pool -_080244BC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080244FC - movs r0, 0x9C - lsls r0, 1 - adds r1, r5, r0 - movs r0, 0x78 - strb r0, [r1] - b _080244F6 -_080244D4: - movs r0, 0x9C - lsls r0, 1 - adds r1, r5, r0 - ldrb r0, [r1] - adds r4, r0, 0 - cmp r4, 0 - beq _080244E8 - subs r0, 0x1 - strb r0, [r1] - b _080244FC -_080244E8: - movs r0, 0x18 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - strb r4, [r5, 0xC] - b _080244FC -_080244F6: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_080244FC: - movs r0, 0 - add sp, 0x10 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8024444 - - thumb_func_start sub_8024508 -sub_8024508: @ 8024508 - push {r4,r5,lr} - adds r5, r0, 0 - ldrb r4, [r5, 0xC] - cmp r4, 0x1 - beq _08024528 - cmp r4, 0x1 - bgt _0802451C - cmp r4, 0 - beq _08024522 - b _08024558 -_0802451C: - cmp r4, 0x2 - beq _08024538 - b _08024558 -_08024522: - bl sub_8010434 - b _08024558 -_08024528: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0802455E - bl sub_800AC34 - b _08024558 -_08024538: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0802455E - movs r0, 0x19 - strb r0, [r5, 0xE] - movs r0, 0x5 - movs r1, 0x1 - movs r2, 0 - bl sub_8022BEC - strb r4, [r5, 0xC] - b _0802455E - .pool -_08024558: - ldrb r0, [r5, 0xC] - adds r0, 0x1 - strb r0, [r5, 0xC] -_0802455E: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8024508 - - thumb_func_start sub_8024568 -sub_8024568: @ 8024568 - push {lr} - movs r0, 0 - bl sub_8020C0C - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_8024568 - - thumb_func_start sub_8024578 -sub_8024578: @ 8024578 - push {r4-r6,lr} - adds r4, r0, 0 - movs r5, 0 - movs r0, 0x33 - bl IncrementGameStat - strb r5, [r4, 0xD] - movs r1, 0 - strh r5, [r4, 0x10] - movs r0, 0x2 - strh r0, [r4, 0x12] - strh r5, [r4, 0x14] - str r5, [r4, 0x1C] - strh r5, [r4, 0x18] - strh r5, [r4, 0x1A] - str r5, [r4, 0x20] - adds r0, r4, 0 - adds r0, 0x24 - strb r1, [r0] - adds r1, r4, 0 - adds r1, 0x25 - movs r0, 0 - strb r0, [r1] - strh r5, [r4, 0x26] - strh r5, [r4, 0x28] - strh r5, [r4, 0x2E] - ldr r0, =0x0000ffff - strh r0, [r4, 0x32] - strh r5, [r4, 0x30] - strh r5, [r4, 0x34] - movs r6, 0 - movs r3, 0 -_080245B8: - lsls r0, r5, 5 - adds r2, r4, r0 - adds r1, r2, 0 - adds r1, 0xA4 - ldr r0, =0x0000ffff - strh r0, [r1] - adds r0, r2, 0 - adds r0, 0xA6 - strh r3, [r0] - adds r0, 0x2 - strh r3, [r0] - adds r1, 0x6 - movs r0, 0x1 - strh r0, [r1] - adds r0, r2, 0 - adds r0, 0xAC - strh r3, [r0] - adds r0, 0x2 - strh r3, [r0] - adds r0, 0x2 - strh r3, [r0] - adds r0, 0x2 - strh r3, [r0] - adds r0, 0x2 - strb r6, [r0] - adds r0, 0x1 - strb r6, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _080245B8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8024578 - - thumb_func_start sub_8024604 -sub_8024604: @ 8024604 - push {r4-r6,lr} - sub sp, 0x8 - str r2, [sp, 0x4] - ldr r5, [sp, 0x18] - ldr r6, [sp, 0x1C] - ldr r4, [sp, 0x20] - mov r2, sp - strh r4, [r2] - add r4, sp, 0x4 - ldrb r2, [r4] - strb r2, [r0] - ldrb r2, [r4, 0x1] - strb r2, [r0, 0x1] - ldrb r2, [r4, 0x2] - strb r2, [r0, 0x2] - ldrb r2, [r4, 0x3] - strb r2, [r0, 0x3] - strb r3, [r0, 0x4] - strb r5, [r0, 0x5] - strb r6, [r0, 0x6] - mov r2, sp - ldrb r2, [r2] - strb r2, [r0, 0x7] - mov r2, sp - ldrb r2, [r2, 0x1] - strb r2, [r0, 0x8] - strb r1, [r0, 0x9] - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8024604 - - thumb_func_start sub_8024644 -sub_8024644: @ 8024644 - push {r4,r5,lr} - sub sp, 0x4 - ldr r5, [sp, 0x10] - mov r4, sp - strh r3, [r4] - strb r1, [r0] - strb r2, [r0, 0x1] - mov r1, sp - ldrb r1, [r1] - strb r1, [r0, 0x2] - mov r1, sp - ldrb r1, [r1, 0x1] - strb r1, [r0, 0x3] - strb r5, [r0, 0x4] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8024644 - - thumb_func_start sub_8024668 -sub_8024668: @ 8024668 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - adds r1, 0xAC - ldr r0, [r0] - ldr r1, [r1] - eors r0, r1 - bx lr - .pool - thumb_func_end sub_8024668 - - thumb_func_start SetBerryPowder -SetBerryPowder: @ 802467C - ldr r2, =gSaveBlock2Ptr - ldr r2, [r2] - adds r2, 0xAC - ldr r2, [r2] - eors r2, r1 - str r2, [r0] - bx lr - .pool - thumb_func_end SetBerryPowder - - thumb_func_start ApplyNewEncyprtionKeyToBerryPowder -ApplyNewEncyprtionKeyToBerryPowder: @ 8024690 - push {lr} - adds r1, r0, 0 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r2, 0xFA - lsls r2, 1 - adds r0, r2 - bl ApplyNewEncyprtionKeyToWord - pop {r0} - bx r0 - .pool - thumb_func_end ApplyNewEncyprtionKeyToBerryPowder - - thumb_func_start sub_80246AC -sub_80246AC: @ 80246AC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xFA - lsls r1, 1 - adds r0, r1 - bl sub_8024668 - cmp r0, r4 - bcc _080246CC - movs r0, 0x1 - b _080246CE - .pool -_080246CC: - movs r0, 0 -_080246CE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80246AC - - thumb_func_start sub_80246D4 -sub_80246D4: @ 80246D4 - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xFA - lsls r1, 1 - adds r0, r1 - bl sub_8024668 - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - cmp r0, r1 - bcc _080246F8 - movs r0, 0x1 - b _080246FA - .pool -_080246F8: - movs r0, 0 -_080246FA: - pop {r1} - bx r1 - thumb_func_end sub_80246D4 - - thumb_func_start sub_8024700 -sub_8024700: @ 8024700 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xFA - lsls r1, 1 - adds r5, r0, r1 - adds r0, r5, 0 - bl sub_8024668 - adds r1, r0, r4 - ldr r2, =0x0001869f - cmp r1, r2 - bhi _08024730 - adds r0, r5, 0 - bl SetBerryPowder - movs r0, 0x1 - b _0802473A - .pool -_08024730: - adds r0, r5, 0 - adds r1, r2, 0 - bl SetBerryPowder - movs r0, 0 -_0802473A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8024700 - - thumb_func_start sub_8024740 -sub_8024740: @ 8024740 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xFA - lsls r1, 1 - adds r4, r0, r1 - adds r0, r5, 0 - bl sub_80246AC - lsls r0, 24 - cmp r0, 0 - beq _08024774 - adds r0, r4, 0 - bl sub_8024668 - adds r1, r0, 0 - subs r1, r5 - adds r0, r4, 0 - bl SetBerryPowder - movs r0, 0x1 - b _08024776 - .pool -_08024774: - movs r0, 0 -_08024776: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8024740 - - thumb_func_start sub_802477C -sub_802477C: @ 802477C - push {r4,r5,lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xFA - lsls r1, 1 - adds r4, r0, r1 - ldr r5, =gSpecialVar_0x8004 - ldrh r0, [r5] - bl sub_80246AC - lsls r0, 24 - cmp r0, 0 - beq _080247B4 - adds r0, r4, 0 - bl sub_8024668 - adds r1, r0, 0 - ldrh r0, [r5] - subs r1, r0 - adds r0, r4, 0 - bl SetBerryPowder - movs r0, 0x1 - b _080247B6 - .pool -_080247B4: - movs r0, 0 -_080247B6: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802477C - - thumb_func_start sub_80247BC -sub_80247BC: @ 80247BC - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xFA - lsls r1, 1 - adds r0, r1 - bl sub_8024668 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80247BC - - thumb_func_start sub_80247D4 -sub_80247D4: @ 80247D4 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0xC - adds r6, r0, 0 - mov r8, r2 - adds r4, r3, 0 - ldr r5, [sp, 0x24] - lsls r6, 24 - lsrs r6, 24 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gStringVar1 - mov r9, r0 - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - str r4, [sp] - str r5, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r6, 0 - movs r1, 0x1 - mov r2, r9 - mov r3, r8 - 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 sub_80247D4 - - thumb_func_start sub_802482C -sub_802482C: @ 802482C - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - adds r6, r0, 0 - adds r4, r1, 0 - adds r5, r2, 0 - mov r8, r3 - lsls r6, 24 - lsrs r6, 24 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - movs r1, 0 - adds r2, r4, 0 - adds r3, r5, 0 - bl SetWindowBorderStyle - ldr r2, =gText_Powder - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r4, 0 - str r4, [sp, 0x8] - adds r0, r6, 0 - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - str r4, [sp] - adds r0, r6, 0 - mov r1, r8 - movs r2, 0x1A - movs r3, 0x11 - bl sub_80247D4 - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802482C - - thumb_func_start sub_802488C -sub_802488C: @ 802488C - push {lr} - sub sp, 0x4 - bl sub_80247BC - adds r1, r0, 0 - ldr r0, =gUnknown_02022C94 - ldrb r0, [r0] - movs r2, 0 - str r2, [sp] - movs r2, 0x1A - movs r3, 0x11 - bl sub_80247D4 - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802488C - - thumb_func_start sub_80248B0 -sub_80248B0: @ 80248B0 - push {r4,r5,lr} - sub sp, 0x18 - movs r0, 0x7 - str r0, [sp] - movs r0, 0x4 - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0x1C - str r0, [sp, 0xC] - add r0, sp, 0x10 - movs r1, 0 - movs r2, 0x1 - movs r3, 0x1 - bl SetWindowTemplateFields - ldr r4, =gUnknown_02022C94 - add r0, sp, 0x10 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl FillWindowPixelBuffer - ldrb r0, [r4] - bl PutWindowTilemap - ldrb r0, [r4] - ldr r5, =0x0000021d - adds r1, r5, 0 - movs r2, 0xD0 - bl box_border_load_tiles_and_pal - ldrb r4, [r4] - bl sub_80247BC - adds r3, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0xD - bl sub_802482C - add sp, 0x18 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80248B0 - - thumb_func_start sub_8024918 -sub_8024918: @ 8024918 - push {r4,lr} - ldr r4, =gUnknown_02022C94 - ldrb r0, [r4] - bl ClearWindowTilemap - 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_8024918 - - thumb_func_start sub_802493C -sub_802493C: @ 802493C - push {r4-r6,lr} - adds r5, r1, 0 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r1, =gUnknown_03000DB0 - movs r0, 0 - str r0, [r1] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08024A10 - ldr r4, =gUnknown_02022C98 - ldr r0, =0x00003330 - bl AllocZeroed - str r0, [r4] - cmp r0, 0 - beq _08024A10 - bl sub_8024A1C - ldr r0, [r4] - bl sub_8024A30 - ldr r0, [r4] - str r5, [r0] - bl GetMultiplayerId - ldr r1, [r4] - adds r1, 0x28 - strb r0, [r1] - ldr r1, [r4] - ldr r2, =0x000032cc - adds r0, r1, r2 - adds r2, r1, 0 - adds r2, 0x28 - ldrb r3, [r2] - lsls r2, r3, 4 - subs r2, r3 - lsls r2, 2 - adds r1, r2 - ldr r2, =0x000031a0 - adds r1, r2 - movs r2, 0x3C - bl memcpy - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0x28 - ldrb r1, [r1] - lsls r1, 2 - ldr r2, =0x0000318c - adds r1, r2 - adds r0, r1 - movs r1, 0x64 - muls r1, r6 - ldr r2, =gPlayerParty - adds r1, r2 - bl sub_80261F8 - ldr r0, =sub_8024BC8 - movs r1, 0x1 - bl CreateTask - ldr r0, =sub_80261CC - bl SetMainCallback2 - bl sub_80273F0 - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x24 - ldrb r0, [r0] - adds r1, r2, 0 - adds r1, 0x44 - adds r2, 0x48 - bl sub_8026B5C - bl StopMapMusic - ldr r0, =0x0000021e - bl PlayNewMapMusic - b _08024A16 - .pool -_08024A10: - adds r0, r5, 0 - bl SetMainCallback2 -_08024A16: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802493C - - thumb_func_start sub_8024A1C -sub_8024A1C: @ 8024A1C - push {lr} - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - pop {r0} - bx r0 - thumb_func_end sub_8024A1C - - thumb_func_start sub_8024A30 -sub_8024A30: @ 8024A30 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - adds r2, r0, 0 - movs r0, 0 - strb r0, [r2, 0xC] - strb r0, [r2, 0x10] - strb r0, [r2, 0x14] - strb r0, [r2, 0x18] - strb r0, [r2, 0x1C] - movs r3, 0x8E - lsls r3, 1 - adds r1, r2, r3 - str r0, [r1] - movs r7, 0x90 - lsls r7, 1 - adds r1, r2, r7 - str r0, [r1] - adds r1, r2, 0 - adds r1, 0x30 - strb r0, [r1] - adds r1, 0x10 - strb r0, [r1] - subs r1, 0x4 - strb r0, [r1] - adds r3, 0x10 - adds r1, r2, r3 - str r0, [r1] - movs r5, 0 - adds r1, r2, 0 - adds r1, 0x98 - movs r3, 0 -_08024A76: - adds r0, r1, r5 - strb r3, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08024A76 - movs r5, 0 - adds r7, r2, 0 - adds r7, 0xA8 - str r7, [sp] - adds r0, r2, 0 - adds r0, 0xB0 - str r0, [sp, 0xC] - movs r1, 0x4A - adds r1, r2 - mov r10, r1 - movs r3, 0x4C - adds r3, r2 - mov r9, r3 - movs r7, 0x4E - adds r7, r2 - mov r12, r7 - subs r0, 0x60 - str r0, [sp, 0x24] - adds r6, r2, 0 - adds r6, 0x54 - adds r1, r2, 0 - adds r1, 0xD0 - str r1, [sp, 0x1C] - adds r3, r2, 0 - adds r3, 0xDC - str r3, [sp, 0x20] - adds r7, r2, 0 - adds r7, 0xC4 - str r7, [sp, 0x14] - adds r0, 0xA4 - str r0, [sp, 0x4] - adds r1, 0x25 - str r1, [sp, 0x8] - subs r3, 0xBC - str r3, [sp, 0x10] - movs r7, 0x24 - adds r7, r2 - mov r8, r7 - subs r0, 0xC0 - str r0, [sp, 0x18] - movs r3, 0 - movs r1, 0x86 - lsls r1, 1 - adds r4, r2, r1 - movs r7, 0x98 - lsls r7, 1 - adds r2, r7 -_08024AE2: - ldr r1, [sp] - adds r0, r1, r5 - strb r3, [r0] - ldr r7, [sp, 0xC] - adds r0, r7, r5 - strb r3, [r0] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - mov r7, r10 - adds r1, r7, r0 - strh r3, [r1] - mov r7, r9 - adds r1, r7, r0 - strh r3, [r1] - mov r7, r12 - adds r1, r7, r0 - strh r3, [r1] - ldr r7, [sp, 0x24] - adds r1, r7, r0 - strh r3, [r1] - adds r0, r6, r0 - strh r3, [r0] - adds r0, r4, r5 - strb r3, [r0] - lsls r0, r5, 2 - adds r0, r2, r0 - str r3, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _08024AE2 - movs r5, 0 - movs r3, 0 - movs r4, 0xFF - ldr r6, [sp, 0x1C] -_08024B2C: - adds r0, r6, r5 - strb r3, [r0] - ldr r1, [sp, 0x20] - adds r0, r1, r5 - strb r3, [r0] - ldr r7, [sp, 0x14] - adds r0, r7, r5 - strb r3, [r0] - lsls r1, r5, 1 - ldr r0, [sp, 0x4] - adds r2, r0, r1 - ldrb r0, [r2] - orrs r0, r4 - strb r0, [r2] - ldr r7, [sp, 0x8] - adds r1, r7, r1 - ldrb r0, [r1] - orrs r0, r4 - strb r0, [r1] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xA - bls _08024B2C - bl GetMultiplayerId - movs r1, 0 - lsls r0, 24 - cmp r0, 0 - bne _08024B6A - movs r1, 0x1 -_08024B6A: - ldr r0, [sp, 0x10] - strb r1, [r0] - bl GetLinkPlayerCount - mov r1, r8 - strb r0, [r1] - bl GetMultiplayerId - ldr r3, [sp, 0x18] - strb r0, [r3] - movs r5, 0x1 - mov r7, r8 - ldrb r7, [r7] - cmp r5, r7 - bcs _08024BB6 - ldr r7, [sp, 0x18] - mov r6, r8 -_08024B8C: - adds r4, r7, r5 - subs r0, r5, 0x1 - adds r0, r7, r0 - ldrb r0, [r0] - adds r0, 0x1 - strb r0, [r4] - ldrb r2, [r4] - ldrb r1, [r6] - subs r0, r1, 0x1 - cmp r2, r0 - ble _08024BAA - adds r0, r2, 0 - bl __umodsi3 - strb r0, [r4] -_08024BAA: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r0, [r6] - cmp r5, r0 - bcc _08024B8C -_08024BB6: - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8024A30 - - thumb_func_start sub_8024BC8 -sub_8024BC8: @ 8024BC8 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - ldrb r0, [r0, 0xC] - cmp r0, 0x7 - bls _08024BDC - b _08024D34 -_08024BDC: - lsls r0, 2 - ldr r1, =_08024BF0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08024BF0: - .4byte _08024C10 - .4byte _08024C24 - .4byte _08024C4C - .4byte _08024C5A - .4byte _08024C80 - .4byte _08024CD4 - .4byte _08024CE6 - .4byte _08024D10 -_08024C10: - movs r0, 0 - bl SetVBlankCallback - ldr r0, =sub_8025910 - movs r1, 0x4 - bl sub_802620C - b _08024D20 - .pool -_08024C24: - ldr r0, =sub_8025910 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08024C32 - b _08024D40 -_08024C32: - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - movs r1, 0xB0 - lsls r1, 1 - adds r0, r1 - bl sub_8029274 - ldr r1, [r4] - b _08024D24 - .pool -_08024C4C: - bl sub_802A770 - cmp r0, 0 - bne _08024D40 - bl sub_8010434 - b _08024D20 -_08024C5A: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08024D40 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08024D20 - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - b _08024D20 - .pool -_08024C80: - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r5, [r0] - bl sub_80283A8 - movs r4, 0 - cmp r4, r5 - bcs _08024CBA -_08024C92: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x34 - adds r0, r4 - ldrb r2, [r0] - lsls r0, r2, 2 - ldr r3, =0x0000318c - adds r0, r3 - adds r0, r1, r0 - adds r1, 0x24 - ldrb r3, [r1] - adds r1, r4, 0 - bl sub_8028408 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08024C92 -_08024CBA: - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - adds r0, 0x24 - ldrb r1, [r0] - movs r0, 0 - bl sub_802868C - ldr r1, [r4] - b _08024D24 - .pool -_08024CD4: - bl sub_8028A34 - bl sub_8028A88 - bl sub_8028D44 - bl sub_8028734 - b _08024D20 -_08024CE6: - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - str r0, [sp] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_80261E4 - bl SetVBlankCallback - b _08024D20 - .pool -_08024D10: - bl UpdatePaletteFade - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08024D40 -_08024D20: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] -_08024D24: - ldrb r0, [r1, 0xC] - adds r0, 0x1 - strb r0, [r1, 0xC] - b _08024D40 - .pool -_08024D34: - adds r0, r1, 0 - bl DestroyTask - ldr r0, =sub_802589C - bl sub_802621C -_08024D40: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8024BC8 - - thumb_func_start sub_8024D4C -sub_8024D4C: @ 8024D4C - push {lr} - bl sub_8025D04 - ldr r1, =gUnknown_082F7AC4 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - ldrb r0, [r0, 0x18] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gUnknown_03000DB0 - ldr r0, [r0] - cmp r0, 0 - bne _08024D70 - bl sub_8026AF4 -_08024D70: - bl sub_8025D50 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8024D4C - - thumb_func_start sub_8024D84 -sub_8024D84: @ 8024D84 - push {lr} - bl sub_8025E0C - ldr r1, =gUnknown_082F7AF4 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - ldrb r0, [r0, 0x18] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gUnknown_03000DB0 - ldr r0, [r0] - cmp r0, 0 - bne _08024DA8 - bl sub_8026B28 -_08024DA8: - bl sub_8025ED8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8024D84 - - thumb_func_start sub_8024DBC -sub_8024DBC: @ 8024DBC - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - ldrb r0, [r0, 0x10] - cmp r0, 0 - beq _08024DD4 - cmp r0, 0x1 - beq _08024DEA - b _08024DF8 - .pool -_08024DD4: - movs r0, 0x1 - bl sub_8028504 - movs r0, 0x1 - bl sub_80292E0 - ldr r1, [r4] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08024DF8 -_08024DEA: - bl sub_802A770 - cmp r0, 0 - bne _08024DF8 - movs r0, 0x1 - bl sub_8026240 -_08024DF8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8024DBC - - thumb_func_start sub_8024E00 -sub_8024E00: @ 8024E00 - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r1, [r4] - ldrb r0, [r1, 0x10] - cmp r0, 0 - bne _08024E20 - bl sub_80262C0 - ldr r1, [r4] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08024E30 - .pool -_08024E20: - movs r0, 0x8C - lsls r0, 1 - adds r1, r0 - movs r0, 0x1 - str r0, [r1] - movs r0, 0x2 - bl sub_8026240 -_08024E30: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8024E00 - - thumb_func_start sub_8024E38 -sub_8024E38: @ 8024E38 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - ldrb r0, [r0, 0x10] - adds r4, r1, 0 - cmp r0, 0x5 - bhi _08024F08 - lsls r0, 2 - ldr r1, =_08024E5C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08024E5C: - .4byte _08024E74 - .4byte _08024E90 - .4byte _08024EA0 - .4byte _08024EC4 - .4byte _08024ED8 - .4byte _08024EF8 -_08024E74: - movs r0, 0 - str r0, [sp] - movs r0, 0x7 - movs r1, 0x8 - movs r2, 0x78 - movs r3, 0x50 - bl sub_802EB24 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08024EF0 - .pool -_08024E90: - bl sub_8010434 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08024EF0 - .pool -_08024EA0: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08024F08 - ldr r2, =gUnknown_02022C98 - ldr r1, [r2] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - movs r3, 0 - strb r0, [r1, 0x10] - ldr r0, [r2] - adds r0, 0x30 - strb r3, [r0] - b _08024F08 - .pool -_08024EC4: - bl sub_802EB84 - cmp r0, 0 - bne _08024F08 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08024EF0 - .pool -_08024ED8: - ldr r1, [r4] - adds r1, 0x30 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bls _08024F08 - bl sub_8010434 - ldr r1, [r4] -_08024EF0: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08024F08 -_08024EF8: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08024F08 - movs r0, 0x3 - bl sub_8026240 -_08024F08: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8024E38 - - thumb_func_start sub_8024F10 -sub_8024F10: @ 8024F10 - push {lr} - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - ldrb r0, [r1, 0x10] - cmp r0, 0 - bne _08024F2E - movs r2, 0x8E - lsls r2, 1 - adds r0, r1, r2 - ldr r0, [r0] - cmp r0, 0 - beq _08024F2E - movs r0, 0x4 - bl sub_8026240 -_08024F2E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8024F10 - - thumb_func_start sub_8024F38 -sub_8024F38: @ 8024F38 - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r2, [r4] - ldrb r0, [r2, 0x10] - cmp r0, 0 - bne _08024FF6 - adds r0, r2, 0 - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bhi _08024FE8 - adds r0, r2, 0 - adds r0, 0xA8 - ldrb r0, [r0] - cmp r0, 0 - bne _08024FEE - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08024F88 - ldr r1, =0x000031cc - adds r0, r2, r1 - ldrb r1, [r0] - cmp r1, 0 - bne _08024FEE - ldr r3, =0x000031d0 - adds r0, r2, r3 - strb r1, [r0] - movs r0, 0x2 - b _08024FC2 - .pool -_08024F88: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08024FA8 - ldr r3, =0x000031cc - adds r0, r2, r3 - ldrb r1, [r0] - cmp r1, 0 - bne _08024FEE - adds r3, 0x4 - adds r0, r2, r3 - strb r1, [r0] - movs r0, 0x1 - b _08024FC2 - .pool -_08024FA8: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08024FD4 - ldr r3, =0x000031cc - adds r0, r2, r3 - ldrb r1, [r0] - cmp r1, 0 - bne _08024FEE - adds r3, 0x4 - adds r0, r2, r3 - strb r1, [r0] - movs r0, 0x3 -_08024FC2: - bl sub_8027518 - ldr r1, [r4] - ldr r2, =0x000031cc - adds r1, r2 - strb r0, [r1] - b _08024FEE - .pool -_08024FD4: - movs r0, 0 - bl sub_8027518 - ldr r1, [r4] - ldr r3, =0x000031cc - adds r1, r3 - strb r0, [r1] - b _08024FEE - .pool -_08024FE8: - movs r0, 0xB - bl sub_8026240 -_08024FEE: - bl sub_802671C - bl sub_8025F48 -_08024FF6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8024F38 - - thumb_func_start sub_8024FFC -sub_8024FFC: @ 8024FFC - push {lr} - ldr r0, =gUnknown_02022C98 - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bhi _080250C4 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0802504C - adds r0, r2, 0 - adds r0, 0x28 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r2, r0 - ldr r1, =0x000031cc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080250CA - ldr r3, =0x000032f8 - adds r1, r2, r3 - movs r0, 0x2 - strb r0, [r1] - b _080250CA - .pool -_0802504C: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08025080 - adds r0, r2, 0 - adds r0, 0x28 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r2, r0 - ldr r1, =0x000031cc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080250CA - ldr r3, =0x000032f8 - adds r1, r2, r3 - movs r0, 0x1 - strb r0, [r1] - b _080250CA - .pool -_08025080: - movs r0, 0x20 - ands r0, r1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - beq _080250B8 - adds r0, r2, 0 - adds r0, 0x28 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r2, r0 - ldr r1, =0x000031cc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080250CA - ldr r3, =0x000032f8 - adds r1, r2, r3 - movs r0, 0x3 - strb r0, [r1] - b _080250CA - .pool -_080250B8: - ldr r3, =0x000032f8 - adds r0, r2, r3 - strb r1, [r0] - b _080250CA - .pool -_080250C4: - movs r0, 0xB - bl sub_8026240 -_080250CA: - bl sub_8026044 - pop {r0} - bx r0 - thumb_func_end sub_8024FFC - - thumb_func_start sub_80250D4 -sub_80250D4: @ 80250D4 - push {r4,r5,lr} - bl sub_802671C - bl sub_8025F48 - bl sub_8026C50 - cmp r0, 0x1 - bne _080250F2 - bl sub_80272A4 - movs r0, 0x5 - bl sub_8026240 - b _08025150 -_080250F2: - ldr r0, =gUnknown_02022C98 - ldr r2, [r0] - movs r1, 0x96 - lsls r1, 1 - adds r4, r2, r1 - movs r1, 0x1 - str r1, [r4] - movs r3, 0x1 - adds r1, r2, 0 - adds r1, 0x24 - adds r5, r0, 0 - ldrb r1, [r1] - cmp r3, r1 - bcs _08025150 - movs r1, 0x9A - lsls r1, 1 - adds r0, r2, r1 - ldr r0, [r0] - cmp r0, 0x1 - beq _08025124 - movs r0, 0 - str r0, [r4] - b _08025150 - .pool -_08025124: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldr r2, [r5] - adds r0, r2, 0 - adds r0, 0x24 - ldrb r0, [r0] - cmp r3, r0 - bcs _08025150 - lsls r0, r3, 2 - movs r4, 0x98 - lsls r4, 1 - adds r1, r2, r4 - adds r1, r0 - ldr r0, [r1] - cmp r0, 0x1 - beq _08025124 - movs r0, 0x96 - lsls r0, 1 - adds r1, r2, r0 - movs r0, 0 - str r0, [r1] -_08025150: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80250D4 - - thumb_func_start sub_8025158 -sub_8025158: @ 8025158 - push {lr} - bl sub_8026044 - bl sub_8026C90 - cmp r0, 0x1 - bne _0802516C - movs r0, 0x5 - bl sub_8026240 -_0802516C: - pop {r0} - bx r0 - thumb_func_end sub_8025158 - - thumb_func_start sub_8025170 -sub_8025170: @ 8025170 - push {r4,lr} - bl GetBlockReceivedStatus - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_800A9D8 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - beq _0802518C - movs r0, 0 - b _08025192 -_0802518C: - bl ResetBlockReceivedFlags - movs r0, 0x1 -_08025192: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8025170 - - thumb_func_start sub_8025198 -sub_8025198: @ 8025198 - push {r4,r5,lr} - ldr r5, =gUnknown_02022C98 - ldr r1, [r5] - ldrb r4, [r1, 0x10] - cmp r4, 0x1 - beq _080251D0 - cmp r4, 0x1 - bgt _080251B4 - cmp r4, 0 - beq _080251BA - b _0802520C - .pool -_080251B4: - cmp r4, 0x2 - beq _080251DC - b _0802520C -_080251BA: - adds r1, 0x4A - movs r0, 0 - movs r2, 0x3C - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _08025226 - ldr r0, [r5] - strb r4, [r0, 0x8] - b _08025202 -_080251D0: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08025226 - b _08025202 -_080251DC: - bl sub_8025170 - cmp r0, 0 - beq _080251EE - ldr r0, [r5] - adds r1, r0, 0 - adds r1, 0x24 - ldrb r1, [r1] - strb r1, [r0, 0x8] -_080251EE: - ldr r2, [r5] - adds r1, r2, 0 - adds r1, 0x24 - ldrb r0, [r2, 0x8] - ldrb r1, [r1] - cmp r0, r1 - bcc _08025226 - ldrb r0, [r2, 0x14] - adds r0, 0x1 - strb r0, [r2, 0x14] -_08025202: - ldr r1, [r5] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08025226 -_0802520C: - movs r0, 0x1 - bl WaitFanfare - lsls r0, 24 - cmp r0, 0 - beq _08025226 - movs r0, 0x6 - bl sub_8026240 - ldr r0, =0x0000020b - movs r1, 0x4 - bl FadeOutAndPlayNewMapMusic -_08025226: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8025198 - - thumb_func_start sub_8025230 -sub_8025230: @ 8025230 - push {r4,r5,lr} - ldr r5, =gUnknown_02022C98 - ldr r2, [r5] - ldrb r4, [r2, 0x10] - cmp r4, 0x1 - beq _08025274 - cmp r4, 0x1 - bgt _0802524C - cmp r4, 0 - beq _08025252 - b _080252DC - .pool -_0802524C: - cmp r4, 0x2 - beq _08025282 - b _080252DC -_08025252: - ldrb r0, [r2, 0x14] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, 0x4A - adds r1, r2, r1 - movs r0, 0 - movs r2, 0x3C - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _08025316 - ldr r0, [r5] - strb r4, [r0, 0x8] - ldr r1, [r5] - b _080252CC -_08025274: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08025316 - ldr r1, [r5] - b _080252CC -_08025282: - bl sub_8025170 - cmp r0, 0 - beq _080252B4 - movs r4, 0 - b _080252AA -_0802528E: - ldr r0, [r5] - adds r0, 0x4A - ldr r1, =gBlockRecvBuffer - movs r2, 0x3C - bl memcpy - ldr r1, [r5] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - strb r0, [r1, 0x8] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_080252AA: - ldr r0, [r5] - adds r0, 0x24 - ldrb r0, [r0] - cmp r4, r0 - bcc _0802528E -_080252B4: - ldr r3, =gUnknown_02022C98 - ldr r2, [r3] - adds r1, r2, 0 - adds r1, 0x24 - ldrb r0, [r2, 0x8] - ldrb r1, [r1] - cmp r0, r1 - bcc _08025316 - ldrb r0, [r2, 0x14] - adds r0, 0x1 - strb r0, [r2, 0x14] - ldr r1, [r3] -_080252CC: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08025316 - .pool -_080252DC: - movs r0, 0x1 - bl WaitFanfare - lsls r0, 24 - cmp r0, 0 - beq _08025316 - ldr r0, =gUnknown_02022C98 - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x54 - adds r0, r1 - ldrh r1, [r0] - movs r3, 0x8A - lsls r3, 1 - adds r0, r2, r3 - strh r1, [r0] - movs r0, 0x6 - bl sub_8026240 - ldr r0, =0x0000020b - movs r1, 0x4 - bl FadeOutAndPlayNewMapMusic -_08025316: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8025230 - - thumb_func_start sub_8025324 -sub_8025324: @ 8025324 - push {r4,r5,lr} - sub sp, 0x4 - movs r1, 0x1 - mov r0, sp - strb r1, [r0] - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - ldrb r0, [r0, 0x10] - cmp r0, 0x4 - bls _0802533A - b _08025458 -_0802533A: - lsls r0, 2 - ldr r1, =_0802534C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802534C: - .4byte _08025360 - .4byte _08025384 - .4byte _0802539C - .4byte _080253BC - .4byte _080253DC -_08025360: - bl sub_802749C - movs r0, 0x1 - bl sub_80289E8 - bl sub_8028DFC - movs r0, 0x1 - bl sub_8028EC8 - movs r0, 0x2 - bl sub_80292E0 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08025448 - .pool -_08025384: - bl sub_802A770 - cmp r0, 0 - bne _08025466 - movs r0, 0x5 - bl sub_80292E0 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08025448 - .pool -_0802539C: - bl sub_802A794 - mov r1, sp - strb r0, [r1] - movs r0, 0 - movs r2, 0x1 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _08025466 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08025448 - .pool -_080253BC: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08025466 - ldr r3, =gUnknown_02022C98 - ldr r1, [r3] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1, 0x10] - ldr r0, [r3] - strb r2, [r0, 0x8] - b _08025466 - .pool -_080253DC: - bl sub_8025170 - cmp r0, 0 - beq _08025422 - movs r2, 0 - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x24 - ldrb r0, [r0] - cmp r2, r0 - bcs _08025422 - adds r3, r1, 0 - movs r5, 0x86 - lsls r5, 1 - ldr r4, =gBlockRecvBuffer -_080253FA: - ldr r1, [r3] - adds r1, r2, r1 - adds r1, r5 - lsls r0, r2, 8 - adds r0, r4 - ldrb r0, [r0] - strb r0, [r1] - ldr r1, [r3] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - strb r0, [r1, 0x8] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, [r3] - adds r0, 0x24 - ldrb r0, [r0] - cmp r2, r0 - bcc _080253FA -_08025422: - ldr r4, =gUnknown_02022C98 - ldr r2, [r4] - adds r1, r2, 0 - adds r1, 0x24 - ldrb r0, [r2, 0x8] - ldrb r1, [r1] - cmp r0, r1 - bcc _08025466 - ldrb r0, [r2, 0x14] - adds r0, 0x1 - strb r0, [r2, 0x14] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x77 - bls _08025466 - movs r0, 0x6 - bl sub_80292E0 - ldr r1, [r4] -_08025448: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08025466 - .pool -_08025458: - bl sub_802A770 - cmp r0, 0 - bne _08025466 - movs r0, 0x7 - bl sub_8026240 -_08025466: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8025324 - - thumb_func_start sub_8025470 -sub_8025470: @ 8025470 - push {r4,r5,lr} - sub sp, 0x4 - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - ldrb r0, [r0, 0x10] - cmp r0, 0x7 - bls _08025480 - b _08025606 -_08025480: - lsls r0, 2 - ldr r1, =_08025494 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08025494: - .4byte _080254B4 - .4byte _080254D4 - .4byte _080254F0 - .4byte _08025504 - .4byte _08025520 - .4byte _0802553C - .4byte _08025564 - .4byte _08025578 -_080254B4: - bl sub_8027748 - ldr r1, =0x00000bb7 - cmp r0, r1 - bls _080254C4 - movs r0, 0x4 - bl sub_80292E0 -_080254C4: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _080255E8 - .pool -_080254D4: - bl sub_802A770 - cmp r0, 0 - beq _080254DE - b _0802563C -_080254DE: - movs r0, 0x3 - bl sub_80292E0 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _080255E8 - .pool -_080254F0: - bl sub_8028FCC - bl sub_80272E8 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _080255E8 - .pool -_08025504: - bl sub_802A794 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - cmp r0, 0 - bne _08025516 - b _0802563C -_08025516: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _080255E8 - .pool -_08025520: - bl sub_802A770 - cmp r0, 0 - beq _0802552A - b _0802563C -_0802552A: - movs r0, 0x5 - bl sub_80292E0 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _080255E8 - .pool -_0802553C: - bl sub_802A794 - mov r1, sp - strb r0, [r1] - movs r0, 0 - movs r2, 0x1 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0802563C - ldr r2, =gUnknown_02022C98 - ldr r1, [r2] - movs r0, 0 - strb r0, [r1, 0x8] - ldr r1, [r2] - b _080255E8 - .pool -_08025564: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0802563C - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _080255E8 - .pool -_08025578: - bl sub_8025170 - cmp r0, 0 - beq _080255BE - movs r2, 0 - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x24 - ldrb r0, [r0] - cmp r2, r0 - bcs _080255BE - adds r3, r1, 0 - movs r5, 0x86 - lsls r5, 1 - ldr r4, =gBlockRecvBuffer -_08025596: - ldr r1, [r3] - adds r1, r2, r1 - adds r1, r5 - lsls r0, r2, 8 - adds r0, r4 - ldrb r0, [r0] - strb r0, [r1] - ldr r1, [r3] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - strb r0, [r1, 0x8] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, [r3] - adds r0, 0x24 - ldrb r0, [r0] - cmp r2, r0 - bcc _08025596 -_080255BE: - ldr r4, =gUnknown_02022C98 - ldr r2, [r4] - adds r1, r2, 0 - adds r1, 0x24 - ldrb r0, [r2, 0x8] - ldrb r1, [r1] - cmp r0, r1 - bcc _080255F8 - ldrb r0, [r2, 0x14] - adds r0, 0x1 - strb r0, [r2, 0x14] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x77 - bls _0802563C - bl sub_8027608 - movs r0, 0x6 - bl sub_80292E0 - ldr r1, [r4] -_080255E8: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _0802563C - .pool -_080255F8: - bl sub_8027554 - b _0802563C -_080255FE: - movs r0, 0x8 - bl sub_8026240 - b _0802563C -_08025606: - bl sub_802A770 - cmp r0, 0 - bne _0802563C - movs r2, 0 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - cmp r2, r0 - bcs _08025636 - movs r4, 0x86 - lsls r4, 1 - adds r3, r1, r4 - adds r1, r0, 0 -_08025624: - adds r0, r3, r2 - ldrb r0, [r0] - cmp r0, 0x2 - beq _080255FE - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r1 - bcc _08025624 -_08025636: - movs r0, 0xA - bl sub_8026240 -_0802563C: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8025470 - - thumb_func_start sub_8025644 -sub_8025644: @ 8025644 - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - ldrb r0, [r0, 0x10] - cmp r0, 0x1 - beq _08025672 - cmp r0, 0x1 - bgt _08025660 - cmp r0, 0 - beq _08025666 - b _08025692 - .pool -_08025660: - cmp r0, 0x2 - beq _0802567C - b _08025692 -_08025666: - bl sub_800AC34 - movs r0, 0x7 - bl sub_80292E0 - b _08025688 -_08025672: - bl sub_802A770 - cmp r0, 0 - bne _080256A0 - b _08025688 -_0802567C: - bl sub_802A794 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bne _080256A0 -_08025688: - ldr r1, [r4] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _080256A0 -_08025692: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _080256A0 - movs r0, 0x9 - bl sub_8026240 -_080256A0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8025644 - - thumb_func_start sub_80256AC -sub_80256AC: @ 80256AC - push {r4,lr} - sub sp, 0x4 - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - ldrb r1, [r0, 0x10] - cmp r1, 0x1 - beq _080256E0 - cmp r1, 0x1 - bgt _080256C8 - cmp r1, 0 - beq _080256CE - b _08025728 - .pool -_080256C8: - cmp r1, 0x2 - beq _080256F8 - b _08025728 -_080256CE: - movs r0, 0x1 - negs r0, r0 - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0802571A -_080256E0: - bl UpdatePaletteFade - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0802574C - b _0802571A - .pool -_080256F8: - bl sub_8028B80 - bl sub_80287E4 - ldr r0, [r4] - adds r0, 0x24 - ldrb r0, [r0] - bl sub_8028614 - bl sub_8028E84 - ldr r1, =gUnknown_03000DB0 - movs r0, 0x1 - str r0, [r1] - movs r0, 0x8 - bl sub_80292E0 -_0802571A: - ldr r1, [r4] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _0802574C - .pool -_08025728: - bl sub_802A770 - cmp r0, 0 - bne _0802574C - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - ldr r0, [r0] - bl SetMainCallback2 - ldr r0, [r4] - ldrb r0, [r0, 0x4] - bl DestroyTask - ldr r0, [r4] - bl Free - bl FreeAllWindowBuffers -_0802574C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80256AC - - thumb_func_start sub_8025758 -sub_8025758: @ 8025758 - push {r4,lr} - sub sp, 0x4 - ldr r4, =gUnknown_02022C98 - ldr r1, [r4] - ldrb r0, [r1, 0x10] - cmp r0, 0x6 - bls _08025768 - b _0802585C -_08025768: - lsls r0, 2 - ldr r1, =_0802577C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802577C: - .4byte _08025798 - .4byte _08025838 - .4byte _080257B0 - .4byte _08025802 - .4byte _08025808 - .4byte _08025818 - .4byte _08025838 -_08025798: - movs r0, 0x9 - bl sub_80292E0 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _08025848 -_080257B0: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - b _08025848 -_08025802: - bl StopMapMusic - b _08025848 -_08025808: - ldr r0, =0x0000021e - bl PlayNewMapMusic - bl sub_8028E4C - b _08025848 - .pool -_08025818: - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - str r0, [sp] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _08025848 -_08025838: - bl UpdatePaletteFade - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0802588C -_08025848: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _0802588C - .pool -_0802585C: - ldrb r0, [r1, 0x4] - bl DestroyTask - ldr r0, =sub_802589C - bl sub_802621C - bl sub_802903C - ldr r0, [r4] - bl sub_8024A30 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08025882 - ldr r0, [r4] - adds r0, 0x24 - movs r1, 0x1 - strb r1, [r0] -_08025882: - bl sub_80273F0 - movs r0, 0 - bl sub_8028EC8 -_0802588C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8025758 - - thumb_func_start sub_802589C -sub_802589C: @ 802589C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - ldrb r0, [r0, 0x10] - adds r4, r1, 0 - cmp r0, 0x1 - beq _080258C8 - cmp r0, 0x1 - bgt _080258BC - cmp r0, 0 - beq _080258C2 - b _080258E0 - .pool -_080258BC: - cmp r0, 0x2 - beq _080258CE - b _080258E0 -_080258C2: - bl sub_8026264 - b _080258D2 -_080258C8: - bl sub_80286E4 - b _080258D6 -_080258CE: - bl sub_8028828 -_080258D2: - cmp r0, 0x1 - bne _08025904 -_080258D6: - ldr r1, [r4] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - b _08025904 -_080258E0: - ldr r0, [r4] - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0 - beq _080258F8 - ldr r0, =sub_8024D4C - bl sub_802621C - b _080258FE - .pool -_080258F8: - ldr r0, =sub_8024D84 - bl sub_802621C -_080258FE: - adds r0, r5, 0 - bl DestroyTask -_08025904: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802589C - - thumb_func_start sub_8025910 -sub_8025910: @ 8025910 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r0, 0 - ldrsh r4, [r5, r0] - cmp r4, 0x1 - beq _0802596C - cmp r4, 0x1 - bgt _08025938 - cmp r4, 0 - beq _0802593E - b _080259E8 - .pool -_08025938: - cmp r4, 0x2 - beq _0802597E - b _080259E8 -_0802593E: - ldr r6, =gUnknown_02022C98 - ldr r1, [r6] - adds r0, r1, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 2 - ldr r2, =0x0000318c - adds r0, r2 - adds r1, r0 - movs r0, 0 - movs r2, 0x1 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _080259E8 - ldr r0, [r6] - strb r4, [r0, 0x8] - b _08025976 - .pool -_0802596C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080259E8 -_08025976: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - b _080259E8 -_0802597E: - bl sub_8025170 - cmp r0, 0 - beq _080259C4 - movs r2, 0 - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x24 - ldrb r0, [r0] - cmp r2, r0 - bcs _080259C4 - adds r3, r1, 0 - ldr r5, =gBlockRecvBuffer - ldr r4, =0x0000318c -_0802599A: - ldr r0, [r3] - lsls r1, r2, 2 - adds r1, r0 - adds r1, r4 - lsls r0, r2, 8 - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - ldr r1, [r3] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - strb r0, [r1, 0x8] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, [r3] - adds r0, 0x24 - ldrb r0, [r0] - cmp r2, r0 - bcc _0802599A -_080259C4: - ldr r4, =gUnknown_02022C98 - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0x24 - ldrb r0, [r0, 0x8] - ldrb r1, [r1] - cmp r0, r1 - bcc _080259E8 - adds r0, r6, 0 - bl DestroyTask - movs r0, 0x6 - bl sub_80292E0 - ldr r1, [r4] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] -_080259E8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8025910 - - thumb_func_start sub_80259FC -sub_80259FC: @ 80259FC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - ldr r6, =gUnknown_02022C98 - ldr r0, [r6] - adds r1, r0, 0 - adds r1, 0x24 - ldrb r7, [r1] - ldr r2, =0x000031a0 - adds r1, r0, r2 - ldr r3, =0x000031cc - adds r2, r0, r3 - ldr r4, =0x00003208 - adds r3, r0, r4 - ldr r5, =0x00003244 - adds r4, r0, r5 - str r4, [sp] - adds r5, 0x3C - adds r4, r0, r5 - str r4, [sp, 0x4] - adds r5, 0x3C - adds r4, r0, r5 - str r4, [sp, 0x8] - adds r4, r0, 0 - adds r4, 0x40 - str r4, [sp, 0xC] - movs r5, 0x90 - lsls r5, 1 - adds r4, r0, r5 - str r4, [sp, 0x10] - movs r4, 0x96 - lsls r4, 1 - adds r0, r4 - str r0, [sp, 0x14] - movs r0, 0 - bl sub_8028164 - ldr r1, [r6] - ldr r5, =0x000031b0 - adds r2, r1, r5 - str r0, [r2] - movs r0, 0x94 - lsls r0, 1 - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] - movs r5, 0x1 - cmp r5, r7 - bcs _08025AA4 -_08025A60: - ldr r1, [r6] - adds r0, r1, 0 - adds r0, 0xA8 - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0 - bne _08025A9A - lsls r0, r5, 4 - subs r0, r5 - lsls r4, r0, 2 - adds r1, r4, r1 - ldr r2, =0x000031cc - adds r1, r2 - adds r0, r5, 0 - bl sub_8028318 - adds r1, r0, 0 - cmp r1, 0 - bne _08025A9A - ldr r0, [r6] - adds r0, r4 - ldr r3, =0x000031cc - adds r0, r3 - strb r1, [r0] - ldr r0, [r6] - movs r4, 0x94 - lsls r4, 1 - adds r0, r4 - strb r1, [r0] -_08025A9A: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _08025A60 -_08025AA4: - ldr r5, =gUnknown_02022C98 - ldr r1, [r5] - movs r6, 0x92 - lsls r6, 1 - adds r1, r6 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3B - bls _08025B02 - ldr r1, [r5] - movs r2, 0x94 - lsls r2, 1 - adds r0, r1, r2 - ldrb r4, [r0] - cmp r4, 0 - beq _08025AF0 - bl sub_8011AC8 - ldr r0, [r5] - adds r0, r6 - movs r1, 0 - strb r1, [r0] - b _08025B02 - .pool -_08025AF0: - adds r0, r1, r6 - ldrb r0, [r0] - cmp r0, 0x46 - bls _08025B02 - bl sub_8011AC8 - ldr r0, [r5] - adds r0, r6 - strb r4, [r0] -_08025B02: - movs r5, 0 - cmp r5, r7 - bcs _08025BF6 - ldr r3, =0x000031cc - mov r12, r3 - ldr r4, =gUnknown_02022C98 - mov r8, r4 -_08025B10: - mov r6, r8 - ldr r2, [r6] - lsls r0, r5, 4 - subs r1, r0, r5 - lsls r1, 2 - adds r1, r2, r1 - add r1, r12 - ldrb r1, [r1] - adds r6, r0, 0 - cmp r1, 0 - beq _08025B36 - adds r0, r2, 0 - adds r0, 0xA8 - adds r1, r0, r5 - ldrb r0, [r1] - cmp r0, 0 - bne _08025B36 - movs r0, 0x1 - strb r0, [r1] -_08025B36: - adds r3, r4, 0 - ldr r1, [r3] - adds r0, r1, 0 - adds r0, 0xA8 - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0x3 - bgt _08025B54 - cmp r0, 0x1 - bge _08025B5A - b _08025BEC - .pool -_08025B54: - cmp r0, 0x4 - beq _08025BA8 - b _08025BEC -_08025B5A: - adds r1, 0xB0 - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bls _08025BEC - ldr r0, [r3] - adds r0, 0xB0 - adds r0, r5 - strb r2, [r0] - ldr r0, [r3] - adds r0, 0xA8 - adds r0, r5 - strb r2, [r0] - ldr r0, [r3] - subs r1, r6, r5 - lsls r1, 2 - adds r0, r1 - add r0, r12 - strb r2, [r0] - ldr r0, [r3] - adds r0, r1 - ldr r6, =0x000031d0 - adds r0, r6 - strb r2, [r0] - ldr r0, [r3] - adds r0, r1 - ldr r1, =0x000031d4 - adds r0, r1 - b _08025BEA - .pool -_08025BA8: - adds r1, 0xB0 - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x27 - bls _08025BEC - ldr r0, [r4] - adds r0, 0xB0 - adds r0, r5 - strb r2, [r0] - ldr r0, [r4] - adds r0, 0xA8 - adds r0, r5 - strb r2, [r0] - ldr r0, [r4] - subs r1, r6, r5 - lsls r1, 2 - adds r0, r1 - add r0, r12 - strb r2, [r0] - ldr r0, [r4] - adds r0, r1 - ldr r3, =0x000031d0 - adds r0, r3 - strb r2, [r0] - ldr r0, [r4] - adds r0, r1 - ldr r6, =0x000031d4 - adds r0, r6 -_08025BEA: - strb r2, [r0] -_08025BEC: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _08025B10 -_08025BF6: - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80259FC - - thumb_func_start sub_8025C0C -sub_8025C0C: @ 8025C0C - push {r4-r7,lr} - sub sp, 0x18 - ldr r5, =gUnknown_02022C98 - ldr r0, [r5] - adds r1, r0, 0 - adds r1, 0x24 - ldrb r6, [r1] - ldr r2, =0x000031a0 - adds r1, r0, r2 - ldr r3, =0x000031cc - adds r2, r0, r3 - ldr r4, =0x00003208 - adds r3, r0, r4 - ldr r7, =0x00003244 - adds r4, r0, r7 - str r4, [sp] - adds r7, 0x3C - adds r4, r0, r7 - str r4, [sp, 0x4] - adds r7, 0x3C - adds r4, r0, r7 - str r4, [sp, 0x8] - adds r4, r0, 0 - adds r4, 0x40 - str r4, [sp, 0xC] - movs r7, 0x90 - lsls r7, 1 - adds r4, r0, r7 - str r4, [sp, 0x10] - movs r4, 0x96 - lsls r4, 1 - adds r0, r4 - str r0, [sp, 0x14] - movs r0, 0 - bl sub_8028164 - ldr r1, [r5] - ldr r7, =0x000031b0 - adds r2, r1, r7 - str r0, [r2] - movs r0, 0x94 - lsls r0, 1 - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] - movs r4, 0x1 - cmp r4, r6 - bcs _08025C9C -_08025C6C: - adds r0, r4, 0 - bl sub_8028374 - cmp r0, 0 - beq _08025C92 - ldr r0, =gUnknown_02022C98 - ldr r2, [r0] - lsls r1, r4, 2 - movs r3, 0x98 - lsls r3, 1 - adds r0, r2, r3 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] - movs r7, 0x94 - lsls r7, 1 - adds r1, r2, r7 - movs r0, 0 - strb r0, [r1] -_08025C92: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _08025C6C -_08025C9C: - ldr r5, =gUnknown_02022C98 - ldr r1, [r5] - movs r6, 0x92 - lsls r6, 1 - adds r1, r6 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3B - bls _08025CFA - ldr r1, [r5] - movs r2, 0x94 - lsls r2, 1 - adds r0, r1, r2 - ldrb r4, [r0] - cmp r4, 0 - beq _08025CE8 - bl sub_8011AC8 - ldr r0, [r5] - adds r0, r6 - movs r1, 0 - strb r1, [r0] - b _08025CFA - .pool -_08025CE8: - adds r0, r1, r6 - ldrb r0, [r0] - cmp r0, 0x46 - bls _08025CFA - bl sub_8011AC8 - ldr r0, [r5] - adds r0, r6 - strb r4, [r0] -_08025CFA: - add sp, 0x18 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8025C0C - - thumb_func_start sub_8025D04 -sub_8025D04: @ 8025D04 - push {r4,r5,lr} - ldr r5, =gUnknown_02022C98 - ldr r0, [r5] - ldrb r0, [r0, 0x18] - cmp r0, 0x4 - beq _08025D40 - cmp r0, 0x4 - bgt _08025D20 - cmp r0, 0x3 - beq _08025D26 - b _08025D4A - .pool -_08025D20: - cmp r0, 0xB - beq _08025D46 - b _08025D4A -_08025D26: - bl sub_8026BB8 - adds r4, r0, 0 - cmp r4, 0x1 - bne _08025D4A - bl sub_8026C28 - ldr r0, [r5] - movs r1, 0x8E - lsls r1, 1 - adds r0, r1 - str r4, [r0] - b _08025D4A -_08025D40: - bl sub_80259FC - b _08025D4A -_08025D46: - bl sub_8025C0C -_08025D4A: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8025D04 - - thumb_func_start sub_8025D50 -sub_8025D50: @ 8025D50 - push {r4-r6,lr} - sub sp, 0x14 - ldr r0, =gUnknown_02022C98 - ldr r5, [r0] - ldrb r0, [r5, 0x18] - cmp r0, 0x4 - beq _08025D68 - cmp r0, 0xB - beq _08025DB8 - b _08025DF4 - .pool -_08025D68: - ldr r1, =0x000032cc - adds r0, r5, r1 - ldr r2, =0x000031cc - adds r1, r5, r2 - ldr r3, =0x00003208 - adds r2, r5, r3 - ldr r4, =0x00003244 - adds r3, r5, r4 - movs r6, 0xCA - lsls r6, 6 - adds r4, r5, r6 - str r4, [sp] - adds r6, 0x3C - adds r4, r5, r6 - str r4, [sp, 0x4] - adds r4, r5, 0 - adds r4, 0x40 - ldrb r4, [r4] - str r4, [sp, 0x8] - movs r6, 0x90 - lsls r6, 1 - adds r4, r5, r6 - ldr r4, [r4] - str r4, [sp, 0xC] - adds r6, 0xC - adds r4, r5, r6 - ldr r4, [r4] - str r4, [sp, 0x10] - bl sub_8027E30 - b _08025DF4 - .pool -_08025DB8: - ldr r1, =0x000032cc - adds r0, r5, r1 - ldr r2, =0x000031cc - adds r1, r5, r2 - ldr r3, =0x00003208 - adds r2, r5, r3 - ldr r4, =0x00003244 - adds r3, r5, r4 - movs r6, 0xCA - lsls r6, 6 - adds r4, r5, r6 - str r4, [sp] - adds r6, 0x3C - adds r4, r5, r6 - str r4, [sp, 0x4] - adds r4, r5, 0 - adds r4, 0x40 - ldrb r4, [r4] - str r4, [sp, 0x8] - movs r6, 0x90 - lsls r6, 1 - adds r4, r5, r6 - ldr r4, [r4] - str r4, [sp, 0xC] - adds r6, 0xC - adds r4, r5, r6 - ldr r4, [r4] - str r4, [sp, 0x10] - bl sub_8027E30 -_08025DF4: - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8025D50 - - thumb_func_start sub_8025E0C -sub_8025E0C: @ 8025E0C - push {r4-r6,lr} - sub sp, 0x18 - ldr r0, =gUnknown_02022C98 - ldr r5, [r0] - ldrb r0, [r5, 0x18] - cmp r0, 0x4 - beq _08025E24 - cmp r0, 0xB - beq _08025E7C - b _08025EC0 - .pool -_08025E24: - adds r0, r5, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 2 - ldr r2, =0x000031a0 - adds r1, r2 - adds r1, r5, r1 - ldr r3, =0x000031cc - adds r2, r5, r3 - ldr r4, =0x00003208 - adds r3, r5, r4 - ldr r6, =0x00003244 - adds r4, r5, r6 - str r4, [sp] - adds r6, 0x3C - adds r4, r5, r6 - str r4, [sp, 0x4] - adds r6, 0x3C - adds r4, r5, r6 - str r4, [sp, 0x8] - adds r4, r5, 0 - adds r4, 0x40 - str r4, [sp, 0xC] - movs r6, 0x90 - lsls r6, 1 - adds r4, r5, r6 - str r4, [sp, 0x10] - adds r6, 0xC - adds r4, r5, r6 - str r4, [sp, 0x14] - bl sub_8028164 - b _08025EC0 - .pool -_08025E7C: - adds r0, r5, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 2 - ldr r2, =0x000031a0 - adds r1, r2 - adds r1, r5, r1 - ldr r3, =0x000031cc - adds r2, r5, r3 - ldr r4, =0x00003208 - adds r3, r5, r4 - ldr r6, =0x00003244 - adds r4, r5, r6 - str r4, [sp] - adds r6, 0x3C - adds r4, r5, r6 - str r4, [sp, 0x4] - adds r6, 0x3C - adds r4, r5, r6 - str r4, [sp, 0x8] - adds r4, r5, 0 - adds r4, 0x40 - str r4, [sp, 0xC] - movs r6, 0x90 - lsls r6, 1 - adds r4, r5, r6 - str r4, [sp, 0x10] - adds r6, 0xC - adds r4, r5, r6 - str r4, [sp, 0x14] - bl sub_8028164 -_08025EC0: - add sp, 0x18 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8025E0C - - thumb_func_start sub_8025ED8 -sub_8025ED8: @ 8025ED8 - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r1, [r4] - ldrb r0, [r1, 0x18] - cmp r0, 0x4 - beq _08025F0E - cmp r0, 0x4 - bgt _08025EF4 - cmp r0, 0x3 - beq _08025EFA - b _08025F40 - .pool -_08025EF4: - cmp r0, 0xB - beq _08025F24 - b _08025F40 -_08025EFA: - movs r0, 0x1 - bl sub_8027DD0 - ldr r0, [r4] - movs r1, 0x8E - lsls r1, 1 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] - b _08025F40 -_08025F0E: - ldr r2, =0x000032f8 - adds r1, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _08025F40 - bl sub_80282EC - b _08025F40 - .pool -_08025F24: - movs r2, 0x90 - lsls r2, 1 - adds r0, r1, r2 - ldr r0, [r0] - cmp r0, 0 - bne _08025F40 - adds r2, 0xC - adds r0, r1, r2 - ldr r0, [r0] - cmp r0, 0 - bne _08025F40 - movs r0, 0x1 - bl sub_8028350 -_08025F40: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8025ED8 - - thumb_func_start sub_8025F48 -sub_8025F48: @ 8025F48 - push {r4-r6,lr} - ldr r6, =gUnknown_02022C98 - ldr r2, [r6] - adds r0, r2, 0 - adds r0, 0x28 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r1, r2, r0 - ldr r3, =0x000031cc - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _08025F88 - bl IsSEPlaying - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _08025FEA - ldr r0, [r6] - movs r2, 0xA2 - lsls r2, 1 - adds r0, r2 - strb r1, [r0] - b _08025FEA - .pool -_08025F88: - ldr r3, =0x000031d0 - adds r0, r1, r3 - ldrb r4, [r0] - cmp r4, 0x1 - bne _08025FB8 - movs r1, 0xA2 - lsls r1, 1 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08025FEA - movs r0, 0x1F - bl m4aSongNumStop - movs r0, 0x1F - bl PlaySE - ldr r0, [r6] - movs r2, 0xA2 - lsls r2, 1 - adds r0, r2 - b _08025FE8 - .pool -_08025FB8: - ldr r3, =0x000031d4 - adds r0, r1, r3 - ldrb r4, [r0] - cmp r4, 0x1 - bne _08025FEA - movs r5, 0xA2 - lsls r5, 1 - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, 0 - bne _08025FEA - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _08025FEA - movs r0, 0x16 - bl PlaySE - movs r0, 0x1 - bl sub_80284CC - ldr r0, [r6] - adds r0, r5 -_08025FE8: - strb r4, [r0] -_08025FEA: - ldr r0, =gUnknown_02022C98 - ldr r2, [r0] - movs r5, 0xAA - lsls r5, 1 - adds r1, r2, r5 - ldrb r1, [r1] - adds r4, r0, 0 - cmp r1, 0 - bne _0802601C - adds r0, r2, 0 - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bls _0802601C - bl StopMapMusic - ldr r0, [r4] - adds r0, r5 - movs r1, 0x1 - b _0802603A - .pool -_0802601C: - ldr r0, [r4] - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0802603C - movs r0, 0xB - bl PlayFanfareByFanfareNum - ldr r0, [r4] - movs r2, 0xAA - lsls r2, 1 - adds r0, r2 - movs r1, 0x2 -_0802603A: - strb r1, [r0] -_0802603C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8025F48 - - thumb_func_start sub_8026044 -sub_8026044: @ 8026044 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r6, =gUnknown_02022C98 - ldr r2, [r6] - adds r0, r2, 0 - adds r0, 0x44 - ldrb r0, [r0] - mov r8, r0 - adds r0, r2, 0 - adds r0, 0x48 - ldrb r7, [r0] - subs r0, 0x20 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r1, r2, r0 - ldr r3, =0x000031cc - adds r0, r1, r3 - ldrb r3, [r0] - cmp r3, 0 - bne _0802609C - ldr r4, =0x000031d0 - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080260FE - adds r4, 0x4 - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080260FE - movs r1, 0xA2 - lsls r1, 1 - adds r0, r2, r1 - strb r3, [r0] - b _080260FE - .pool -_0802609C: - ldr r3, =0x000031d0 - adds r0, r1, r3 - ldrb r4, [r0] - cmp r4, 0x1 - bne _080260CC - movs r1, 0xA2 - lsls r1, 1 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080260FE - movs r0, 0x1F - bl m4aSongNumStop - movs r0, 0x1F - bl PlaySE - ldr r0, [r6] - movs r3, 0xA2 - lsls r3, 1 - adds r0, r3 - b _080260FC - .pool -_080260CC: - ldr r4, =0x000031d4 - adds r0, r1, r4 - ldrb r4, [r0] - cmp r4, 0x1 - bne _080260FE - movs r5, 0xA2 - lsls r5, 1 - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, 0 - bne _080260FE - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _080260FE - movs r0, 0x16 - bl PlaySE - movs r0, 0x1 - bl sub_80284CC - ldr r0, [r6] - adds r0, r5 -_080260FC: - strb r4, [r0] -_080260FE: - mov r4, r8 - cmp r4, r7 - bcs _08026172 - ldr r5, =gUnknown_02022C98 -_08026106: - ldr r2, [r5] - adds r0, r2, 0 - adds r0, 0x28 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - ldr r1, =0x000031a0 - adds r0, r1 - adds r0, r2, r0 - adds r1, r0, 0 - adds r1, 0x14 - adds r0, 0x1F - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x9 - bls _0802615C - movs r3, 0xA4 - lsls r3, 1 - adds r0, r2, r3 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _08026168 - adds r0, r1, r4 - ldrb r0, [r0] - adds r0, 0x4A - bl PlaySE - ldr r0, [r5] - movs r1, 0xA4 - lsls r1, 1 - adds r0, r1 - adds r0, r4 - movs r1, 0x1 - b _08026166 - .pool -_0802615C: - movs r3, 0xA4 - lsls r3, 1 - adds r0, r2, r3 - adds r0, r4 - movs r1, 0 -_08026166: - strb r1, [r0] -_08026168: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r7 - bcc _08026106 -_08026172: - ldr r0, =gUnknown_02022C98 - ldr r2, [r0] - movs r5, 0xAA - lsls r5, 1 - adds r1, r2, r5 - ldrb r1, [r1] - adds r4, r0, 0 - cmp r1, 0 - bne _080261A0 - adds r0, r2, 0 - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bls _080261A0 - bl StopMapMusic - ldr r0, [r4] - adds r0, r5 - movs r1, 0x1 - b _080261BE - .pool -_080261A0: - ldr r0, [r4] - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _080261C0 - movs r0, 0xB - bl PlayFanfareByFanfareNum - ldr r0, [r4] - movs r3, 0xAA - lsls r3, 1 - adds r0, r3 - movs r1, 0x2 -_080261BE: - strb r1, [r0] -_080261C0: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8026044 - - thumb_func_start sub_80261CC -sub_80261CC: @ 80261CC - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_80261CC - - thumb_func_start sub_80261E4 -sub_80261E4: @ 80261E4 - push {lr} - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - pop {r0} - bx r0 - thumb_func_end sub_80261E4 - - thumb_func_start sub_80261F8 -sub_80261F8: @ 80261F8 - push {r4,lr} - adds r4, r0, 0 - adds r0, r1, 0 - bl IsMonShiny - strb r0, [r4] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80261F8 - - thumb_func_start sub_802620C -sub_802620C: @ 802620C - push {lr} - lsls r1, 24 - lsrs r1, 24 - bl CreateTask - pop {r0} - bx r0 - thumb_func_end sub_802620C - - thumb_func_start sub_802621C -sub_802621C: @ 802621C - push {lr} - movs r1, 0x1 - bl CreateTask - ldr r1, =gUnknown_02022C98 - ldr r3, [r1] - movs r2, 0 - strb r0, [r3, 0x4] - ldr r0, [r1] - strb r2, [r0, 0x10] - ldr r0, [r1] - strb r2, [r0, 0xC] - ldr r0, [r1] - strb r2, [r0, 0x14] - pop {r0} - bx r0 - .pool - thumb_func_end sub_802621C - - thumb_func_start sub_8026240 -sub_8026240: @ 8026240 - push {r4,lr} - ldr r2, =gUnknown_02022C98 - ldr r1, [r2] - ldrb r3, [r1, 0x18] - movs r4, 0 - strb r3, [r1, 0x1C] - ldr r1, [r2] - strb r0, [r1, 0x18] - ldr r0, [r2] - strb r4, [r0, 0x10] - ldr r0, [r2] - strb r4, [r0, 0x14] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026240 - - thumb_func_start sub_8026264 -sub_8026264: @ 8026264 - push {r4,lr} - ldr r3, =gUnknown_02022C98 - ldr r1, [r3] - ldrb r0, [r1, 0x14] - lsrs r2, r0, 2 - adds r0, 0x1 - strb r0, [r1, 0x14] - cmp r2, 0 - beq _080262B8 - ldr r3, [r3] - ldrb r0, [r3, 0x14] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _080262B8 - ldr r1, =gUnknown_082F7A94 - adds r0, r3, 0 - adds r0, 0x24 - ldrb r0, [r0] - subs r0, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r2, r0 - bcc _080262A0 - movs r0, 0x1 - b _080262BA - .pool -_080262A0: - lsls r4, r2, 3 - adds r1, r4, 0 - movs r0, 0x14 - bl SetGpuReg - negs r4, r4 - lsls r4, 16 - lsrs r4, 16 - movs r0, 0x18 - adds r1, r4, 0 - bl SetGpuReg -_080262B8: - movs r0, 0 -_080262BA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8026264 - - thumb_func_start sub_80262C0 -sub_80262C0: @ 80262C0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r2, =gUnknown_02022C98 - ldr r0, [r2] - adds r1, r0, 0 - adds r1, 0x44 - adds r0, 0x48 - ldrb r5, [r0] - ldrb r1, [r1] - cmp r1, r5 - bcs _0802630C - mov r8, r2 - ldr r0, =0x000032e0 - mov r12, r0 - movs r7, 0 - movs r6, 0x1 -_080262E2: - mov r2, r8 - ldr r0, [r2] - mov r2, r12 - adds r4, r0, r2 - ldr r2, =0x000032eb - adds r0, r2 - adds r2, r0, r1 - movs r3, 0 - adds r0, r1, 0 - ands r0, r6 - cmp r0, 0 - bne _080262FC - movs r3, 0x1 -_080262FC: - strb r3, [r2] - adds r0, r4, r1 - strb r7, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r5 - bcc _080262E2 -_0802630C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80262C0 - - 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} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r3, r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - movs r7, 0 - ldr r2, =gUnknown_02022C98 - ldr r1, [r2] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =0x000032e0 - adds r1, r0 - mov r12, r2 - cmp r3, 0x2 - beq _08026670 - cmp r3, 0x2 - bgt _08026676 - cmp r3, 0x1 - beq _08026674 - b _08026676 - .pool -_08026670: - movs r7, 0x1 - b _08026676 -_08026674: - movs r7, 0x2 -_08026676: - adds r0, r1, 0 - adds r0, 0xB - adds r0, r6 - ldrb r0, [r0] - subs r0, 0x6 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _080266D4 - ldr r0, =gUnknown_082F449C+0x113 - lsls r1, r4, 1 - adds r1, r4 - adds r1, r7, r1 - lsls r2, r5, 4 - subs r2, r5 - adds r1, r2 - adds r1, r0 - ldrb r1, [r1] - cmp r6, r1 - bne _0802670A - mov r0, r12 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xC4 - adds r0, r6 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _080266D0 - lsls r0, r4, 4 - subs r0, r4 - lsls r0, 2 - adds r0, r1, r0 - ldr r1, =0x000031d4 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - b _0802670A - .pool -_080266D0: - movs r0, 0x1 - b _0802670C -_080266D4: - ldr r0, =gUnknown_082F449C+0x113 - lsls r1, r4, 1 - adds r1, r4 - adds r1, r7, r1 - lsls r2, r5, 4 - subs r2, r5 - adds r1, r2 - adds r1, r0 - ldrb r1, [r1] - cmp r6, r1 - bne _0802670A - mov r1, r12 - ldr r0, [r1] - adds r0, 0xA8 - adds r0, r4 - movs r1, 0x4 - strb r1, [r0] - mov r0, r12 - ldr r1, [r0] - lsls r0, r4, 4 - subs r0, r4 - lsls r0, 2 - adds r1, r0 - ldr r0, =0x000031d4 - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] -_0802670A: - movs r0, 0 -_0802670C: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8026634 - - thumb_func_start sub_802671C -sub_802671C: @ 802671C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gUnknown_02022C98 - ldr r4, [r2] - adds r0, r4, 0 - adds r0, 0x44 - ldrb r1, [r0] - adds r0, 0x4 - ldrb r0, [r0] - mov r9, r0 - movs r3, 0 - mov r10, r3 - movs r5, 0x90 - lsls r5, 1 - adds r0, r4, r5 - str r3, [r0] - adds r5, r1, 0 - mov r0, r9 - subs r0, 0x1 - cmp r5, r0 - blt _0802674E - b _08026974 -_0802674E: - mov r8, r2 -_08026750: - mov r0, r8 - ldr r4, [r0] - adds r0, r4, 0 - adds r0, 0xC4 - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0x1 - bls _08026762 - b _0802686C -_08026762: - movs r1, 0x90 - lsls r1, 1 - adds r0, r4, r1 - movs r2, 0x1 - str r2, [r0] - ldr r1, =0x000032eb - adds r0, r4, r1 - adds r6, r0, r5 - ldrb r0, [r6] - cmp r0, 0x9 - bls _080267FC - movs r7, 0 - movs r0, 0xA - strb r0, [r6] - mov r1, r8 - ldr r0, [r1] - adds r0, 0xC4 - adds r0, r5 - movs r1, 0x3 - strb r1, [r0] - mov r1, r8 - ldr r0, [r1] - movs r6, 0xA4 - lsls r6, 1 - adds r0, r6 - adds r1, r0, r5 - ldrb r0, [r1] - cmp r0, 0 - bne _080267AC - strb r2, [r1] - ldr r2, =0x000032e0 - adds r0, r4, r2 - adds r0, r5 - ldrb r0, [r0] - adds r0, 0x4A - bl PlaySE -_080267AC: - mov r0, r8 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bls _080267C2 - mov r2, r10 - cmp r2, 0x1 - beq _080267C2 - b _08026964 -_080267C2: - movs r0, 0x1 - mov r10, r0 - adds r0, r1, r6 - adds r0, r5 - strb r7, [r0] - mov r1, r8 - ldr r0, [r1] - adds r1, r0, 0 - adds r1, 0x40 - ldrb r0, [r1] - cmp r0, 0x9 - bhi _080267DE - adds r0, 0x1 - strb r0, [r1] -_080267DE: - movs r0, 0x3 - adds r1, r5, 0 - movs r2, 0 - bl sub_8026F1C - movs r0, 0 - bl sub_8027234 - b _08026964 - .pool -_080267FC: - adds r0, r5, 0 - bl sub_8026D8C - mov r2, r8 - ldr r7, [r2] - lsls r0, 24 - lsrs r0, 24 - adds r1, r7, 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 _08026822 - movs r3, 0x2 -_08026822: - ldr r2, =gUnknown_082F7A88 - ldr r0, =0x000032e0 - adds r1, r4, r0 - adds r1, r5 - lsls r0, r3, 1 - adds r0, r3 - ldrb r1, [r1] - adds r0, r1 - adds r0, r2 - ldrb r2, [r0] - adds r1, r7, 0 - adds r1, 0xD0 - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - movs r3, 0 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, r2 - bcc _0802685C - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - mov r1, r8 - ldr r0, [r1] - adds r0, 0xD0 - adds r0, r5 - strb r3, [r0] -_0802685C: - bl sub_8026324 - b _08026964 - .pool -_0802686C: - cmp r0, 0x2 - bne _080268F4 - movs r2, 0x90 - lsls r2, 1 - adds r0, r4, r2 - movs r6, 0x1 - str r6, [r0] - adds r1, r4, 0 - adds r1, 0xDC - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - movs r3, 0 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x13 - bls _08026964 - mov r0, r8 - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0xB8 - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r2, r0 - ldr r1, =0x000031d0 - adds r2, r1 - strb r3, [r2] - mov r2, r8 - ldr r0, [r2] - adds r0, 0xDC - adds r0, r5 - strb r3, [r0] - ldr r0, [r2] - adds r0, 0xD0 - adds r0, r5 - strb r3, [r0] - ldr r0, [r2] - adds r0, 0xC4 - adds r0, r5 - strb r3, [r0] - ldr r1, =0x000032eb - adds r0, r4, r1 - adds r0, r5 - strb r6, [r0] - adds r0, r5, 0 - bl sub_8026D8C - lsls r0, 24 - lsrs r0, 24 - adds r1, r5, 0 - bl sub_8026DB0 - ldr r2, =0x000032e0 - adds r1, r4, r2 - adds r1, r5 - strb r0, [r1] - b _08026964 - .pool -_080268F4: - cmp r0, 0x3 - bne _08026964 - adds r1, r4, 0 - adds r1, 0xDC - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x13 - bls _08026964 - mov r0, r8 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bhi _08026964 - adds r0, r1, 0 - adds r0, 0xDC - adds r0, r5 - strb r2, [r0] - mov r1, r8 - ldr r0, [r1] - adds r0, 0xD0 - adds r0, r5 - strb r2, [r0] - ldr r0, [r1] - adds r0, 0xC4 - adds r0, r5 - strb r2, [r0] - ldr r2, =0x000032eb - adds r0, r4, r2 - adds r0, r5 - movs r1, 0x1 - strb r1, [r0] - mov r0, r8 - ldr r1, [r0] - adds r1, 0xE8 - adds r1, r5 - subs r2, 0xB - adds r4, r2 - adds r4, r5 - ldrb r0, [r4] - strb r0, [r1] - adds r0, r5, 0 - bl sub_8026D8C - lsls r0, 24 - lsrs r0, 24 - adds r1, r5, 0 - bl sub_8026DB0 - strb r0, [r4] -_08026964: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r9 - subs r0, 0x1 - cmp r5, r0 - bge _08026974 - b _08026750 -_08026974: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802671C - - thumb_func_start sub_8026988 -sub_8026988: @ 8026988 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x44 - adds r0, 0x48 - ldrb r0, [r0] - mov r8, r0 - ldrb r6, [r1] - cmp r6, r8 - bcs _08026A7A - ldr r0, =gUnknown_082F449C - mov r9, r0 -_080269A8: - ldr r0, =gUnknown_02022C98 - ldr r3, [r0] - adds r0, r3, 0 - adds r0, 0x28 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - ldr r2, =0x000031a0 - adds r0, r2 - adds r7, r3, r0 - movs r0, 0xB - adds r2, r1, 0 - muls r2, r0 - adds r2, r6, r2 - adds r3, 0x24 - ldrb r1, [r3] - subs r1, 0x1 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 3 - subs r0, r1 - adds r2, r0 - add r2, r9 - ldrb r4, [r2] - adds r0, r7, 0 - adds r0, 0x1F - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _080269FC - adds r0, r6, 0 - movs r1, 0 - bl sub_8028BF8 - b _08026A04 - .pool -_080269FC: - adds r0, r6, 0 - movs r1, 0x1 - bl sub_8028BF8 -_08026A04: - adds r0, r7, 0 - adds r0, 0x1F - adds r5, r0, r4 - ldrb r0, [r5] - cmp r0, 0x9 - bls _08026A30 - adds r0, r7, 0 - adds r0, 0x14 - adds r0, r4 - ldrb r1, [r0] - adds r1, 0x3 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_8028CA4 - ldrb r1, [r5] - lsls r1, 25 - movs r0, 0xFF - lsls r0, 24 - adds r1, r0 - b _08026A52 -_08026A30: - adds r0, r7, 0 - adds r0, 0x14 - adds r3, r0, r4 - ldrb r0, [r3] - cmp r0, 0x3 - bne _08026A5C - movs r0, 0x7 - strb r0, [r5] - adds r0, r6, 0 - movs r1, 0x6 - bl sub_8028CA4 - ldrb r1, [r5] - lsls r1, 25 - movs r2, 0xFF - lsls r2, 24 - adds r1, r2 -_08026A52: - lsrs r1, 24 - adds r0, r6, 0 - bl sub_8028C7C - b _08026A70 -_08026A5C: - ldrb r1, [r3] - adds r0, r6, 0 - bl sub_8028CA4 - ldrb r1, [r5] - lsls r1, 25 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_8028C7C -_08026A70: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r8 - bcc _080269A8 -_08026A7A: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8026988 - - thumb_func_start sub_8026A88 -sub_8026A88: @ 8026A88 - push {r4-r6,lr} - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x24 - ldrb r5, [r0] - movs r4, 0 - cmp r4, r5 - bcs _08026ABA - adds r6, r1, 0 -_08026A9A: - lsls r0, r4, 4 - subs r0, r4 - lsls r0, 2 - ldr r1, [r6] - adds r0, r1 - ldr r1, =0x000031cc - adds r0, r1 - ldrb r1, [r0] - adds r0, r4, 0 - bl sub_80286B4 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026A9A -_08026ABA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026A88 - - thumb_func_start sub_8026AC8 -sub_8026AC8: @ 8026AC8 - push {r4,r5,lr} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r5, [r0] - movs r4, 0 - cmp r4, r5 - bcs _08026AEA -_08026AD8: - adds r0, r4, 0 - movs r1, 0x4 - bl sub_80286B4 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026AD8 -_08026AEA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026AC8 - - thumb_func_start sub_8026AF4 -sub_8026AF4: @ 8026AF4 - push {lr} - bl sub_8026988 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bls _08026B10 - bl sub_8026AC8 - b _08026B14 - .pool -_08026B10: - bl sub_8026A88 -_08026B14: - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x40 - ldrb r0, [r0] - bl sub_80288D4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026AF4 - - thumb_func_start sub_8026B28 -sub_8026B28: @ 8026B28 - push {lr} - bl sub_8026988 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bls _08026B44 - bl sub_8026AC8 - b _08026B48 - .pool -_08026B44: - bl sub_8026A88 -_08026B48: - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x40 - ldrb r0, [r0] - bl sub_80288D4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026B28 - - thumb_func_start sub_8026B5C -sub_8026B5C: @ 8026B5C - push {lr} - adds r3, r1, 0 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r0, 0x4 - bhi _08026BB4 - lsls r0, 2 - ldr r1, =_08026B78 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08026B78: - .4byte _08026B8C - .4byte _08026B94 - .4byte _08026B9C - .4byte _08026BA4 - .4byte _08026BAC -_08026B8C: - movs r0, 0x4 - strb r0, [r3] - movs r0, 0x7 - b _08026BB2 -_08026B94: - movs r0, 0x3 - strb r0, [r3] - movs r0, 0x8 - b _08026BB2 -_08026B9C: - movs r0, 0x2 - strb r0, [r3] - movs r0, 0x9 - b _08026BB2 -_08026BA4: - movs r0, 0x1 - strb r0, [r3] - movs r0, 0xA - b _08026BB2 -_08026BAC: - movs r0, 0 - strb r0, [r3] - movs r0, 0xB -_08026BB2: - strb r0, [r2] -_08026BB4: - pop {r0} - bx r0 - thumb_func_end sub_8026B5C - - thumb_func_start sub_8026BB8 -sub_8026BB8: @ 8026BB8 - push {r4-r6,lr} - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x24 - ldrb r5, [r0] - movs r4, 0x1 - cmp r4, r5 - bcs _08026C1E - adds r6, r1, 0 -_08026BCA: - ldr r0, [r6] - movs r1, 0xAC - lsls r1, 1 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _08026BEC - adds r0, r4, 0 - bl sub_8027DFC - ldr r1, [r6] - movs r2, 0xAC - lsls r2, 1 - adds r1, r2 - adds r1, r4 - strb r0, [r1] -_08026BEC: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026BCA - cmp r4, r5 - bcs _08026C1E - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - movs r2, 0xAC - lsls r2, 1 - adds r1, r0, r2 -_08026C04: - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _08026C14 - movs r0, 0 - b _08026C20 - .pool -_08026C14: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026C04 -_08026C1E: - movs r0, 0x1 -_08026C20: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8026BB8 - - thumb_func_start sub_8026C28 -sub_8026C28: @ 8026C28 - push {r4,lr} - movs r1, 0 - ldr r4, =gUnknown_02022C98 - movs r3, 0xAC - lsls r3, 1 - movs r2, 0 -_08026C34: - ldr r0, [r4] - adds r0, r3 - adds r0, r1 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x4 - bls _08026C34 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026C28 - - thumb_func_start sub_8026C50 -sub_8026C50: @ 8026C50 - push {r4,lr} - ldr r3, =gUnknown_02022C98 - ldr r1, [r3] - adds r2, r1, 0 - adds r2, 0x40 - ldrb r0, [r2] - cmp r0, 0x9 - bls _08026C88 - movs r4, 0x90 - lsls r4, 1 - adds r0, r1, r4 - ldr r0, [r0] - cmp r0, 0 - bne _08026C88 - movs r0, 0xA - strb r0, [r2] - ldr r0, [r3] - movs r1, 0x96 - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _08026C88 - movs r0, 0x1 - b _08026C8A - .pool -_08026C88: - movs r0, 0 -_08026C8A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8026C50 - - thumb_func_start sub_8026C90 -sub_8026C90: @ 8026C90 - push {r4-r6,lr} - ldr r4, =gUnknown_02022C98 - ldr r1, [r4] - adds r2, r1, 0 - adds r2, 0x40 - ldrb r0, [r2] - cmp r0, 0x9 - bls _08026D14 - adds r0, r1, 0 - adds r0, 0x44 - ldrb r3, [r0] - adds r0, 0x4 - ldrb r5, [r0] - movs r0, 0xA - strb r0, [r2] - ldr r4, [r4] - mov r12, r4 - movs r0, 0x96 - lsls r0, 1 - add r0, r12 - ldr r0, [r0] - cmp r0, 0 - beq _08026D14 - adds r4, r3, 0 - cmp r4, r5 - bcs _08026D04 - mov r0, r12 - adds r0, 0x28 - ldrb r3, [r0] - lsls r1, r3, 4 - subs r1, r3 - lsls r1, 2 - ldr r6, =gUnknown_082F449C - subs r0, 0x4 - ldrb r2, [r0] - subs r2, 0x1 - add r1, r12 - movs r0, 0xB - muls r3, r0 - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 3 - subs r2, r0, r2 - ldr r0, =0x000031bf - adds r1, r0 -_08026CEA: - adds r0, r4, r3 - adds r0, r2 - adds r0, r6 - ldrb r0, [r0] - adds r0, r1, r0 - ldrb r0, [r0] - cmp r0, 0xA - bne _08026D14 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026CEA -_08026D04: - movs r0, 0x1 - b _08026D16 - .pool -_08026D14: - movs r0, 0 -_08026D16: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8026C90 - - thumb_func_start sub_8026D1C -sub_8026D1C: @ 8026D1C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_082F7A9C - mov r8, r0 - ldr r0, =gUnknown_02022C98 - ldr r6, [r0] - adds r0, r6, 0 - adds r0, 0x90 - adds r0, r5 - mov r9, r0 - ldrb r7, [r0] - adds r0, r7, 0 - movs r1, 0x7 - bl __umodsi3 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - add r4, r8 - adds r0, r7, 0 - movs r1, 0x7 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldrb r4, [r4] - adds r0, r4 - lsls r0, 24 - lsls r5, 1 - adds r6, 0x86 - adds r6, r5 - ldrh r1, [r6] - lsrs r0, 24 - cmp r1, r0 - bcc _08026D76 - adds r0, r7, 0x1 - mov r1, r9 - strb r0, [r1] -_08026D76: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026D1C - - thumb_func_start sub_8026D8C -sub_8026D8C: @ 8026D8C - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gUnknown_082F449C+0x1AC - ldr r1, =gUnknown_02022C98 - ldr r1, [r1] - adds r1, 0x24 - ldrb r1, [r1] - subs r1, 0x1 - movs r2, 0xB - muls r1, r2 - adds r0, r1 - adds r0, r3 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_8026D8C - - thumb_func_start sub_8026DB0 -sub_8026DB0: @ 8026DB0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r4, =gUnknown_02022C98 - ldr r1, [r4] - adds r1, 0x24 - ldrb r2, [r1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =gUnknown_082F449C+0x15E - lsls r1, r0, 1 - adds r1, r0 - lsls r0, r2, 4 - subs r0, r2 - adds r1, r0 - adds r0, r1, r3 - ldrb r0, [r0] - mov r12, r0 - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r7, [r0] - adds r3, 0x2 - adds r1, r3 - ldrb r1, [r1] - mov r8, r1 - movs r3, 0 - ldr r1, =gUnknown_082F449C+0x1E3 - lsls r0, r2, 2 - adds r2, r0, r2 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08026E18 - adds r6, r1, 0 -_08026DFE: - adds r0, r3, r2 - adds r0, r6 - ldrb r0, [r0] - cmp r5, r0 - beq _08026E3C - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - adds r0, r3, r2 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08026DFE -_08026E18: - ldr r0, [r4] - adds r0, 0x90 - mov r1, r12 - adds r2, r0, r1 - adds r1, r0, r7 - ldrb r0, [r2] - ldrb r3, [r1] - cmp r0, r3 - bls _08026E46 - adds r1, r0, 0 - b _08026E48 - .pool -_08026E3C: - ldr r0, [r4] - adds r0, 0x90 - adds r0, r7 - ldrb r0, [r0] - b _08026E5A -_08026E46: - ldrb r1, [r1] -_08026E48: - ldr r0, [r4] - adds r0, 0x90 - mov r2, r8 - adds r4, r0, r2 - ldrb r0, [r4] - cmp r0, r1 - bls _08026E58 - adds r1, r0, 0 -_08026E58: - adds r0, r1, 0 -_08026E5A: - adds r1, r5, 0 - bl sub_8026E70 - lsls r0, 24 - lsrs r0, 24 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8026DB0 - - thumb_func_start sub_8026E70 -sub_8026E70: @ 8026E70 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_02022C98 - ldr r2, [r2] - adds r2, 0xE8 - adds r2, r1 - ldrb r4, [r2] - movs r1, 0x7 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x6 - bhi _08026EDE - lsls r0, 2 - ldr r1, =_08026EA4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08026EA4: - .4byte _08026EDE - .4byte _08026ED6 - .4byte _08026EE2 - .4byte _08026EC0 - .4byte _08026EC6 - .4byte _08026ECC - .4byte _08026ED2 -_08026EC0: - cmp r4, 0 - beq _08026ED6 - b _08026EDE -_08026EC6: - cmp r4, 0 - beq _08026EE2 - b _08026EDE -_08026ECC: - cmp r4, 0x2 - beq _08026ED6 - b _08026EE2 -_08026ED2: - cmp r4, 0 - bne _08026EDA -_08026ED6: - movs r0, 0x1 - b _08026EE4 -_08026EDA: - cmp r4, 0x1 - beq _08026EE2 -_08026EDE: - movs r0, 0 - b _08026EE4 -_08026EE2: - movs r0, 0x2 -_08026EE4: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8026E70 - - thumb_func_start sub_8026EEC -sub_8026EEC: @ 8026EEC - push {r4-r6,lr} - movs r6, 0 - movs r5, 0 - adds r4, r0, 0 - b _08026EFE -_08026EF6: - ldrh r0, [r4, 0x6] - adds r6, r0 - adds r4, 0xC - adds r5, 0x1 -_08026EFE: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - blt _08026EF6 - cmp r6, 0xA - bgt _08026F12 - movs r0, 0 - b _08026F14 -_08026F12: - movs r0, 0x1 -_08026F14: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8026EEC - - thumb_func_start sub_8026F1C -sub_8026F1C: @ 8026F1C - push {r4-r6,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r6, =gUnknown_02022C98 - ldr r1, [r6] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r5, [r0] - cmp r3, 0 - bge _08026F3A - b _0802722C -_08026F3A: - cmp r3, 0x2 - ble _08026F48 - cmp r3, 0x3 - beq _08026F78 - b _0802722C - .pool -_08026F48: - ldr r3, =0x000031b4 - adds r0, r1, r3 - adds r0, r4 - ldrb r4, [r0] - lsls r4, 1 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0 - adds r0, r1, 0 - adds r0, 0x4A - adds r0, r4 - ldrh r0, [r0] - ldr r1, =0x00004e20 - bl sub_8027A28 - ldr r1, [r6] - adds r1, 0x4A - adds r1, r4 - b _0802722A - .pool -_08026F78: - adds r0, r1, 0 - adds r0, 0x4A - bl sub_8026EEC - cmp r0, 0 - beq _08026F86 - b _0802722C -_08026F86: - cmp r5, 0x3 - bne _08026F8C - b _08027154 -_08026F8C: - cmp r5, 0x3 - bgt _08026F98 - cmp r5, 0x2 - bne _08026F96 - b _080271E8 -_08026F96: - b _0802722C -_08026F98: - cmp r5, 0x4 - bne _08026F9E - b _08027090 -_08026F9E: - cmp r5, 0x5 - beq _08026FA4 - b _0802722C -_08026FA4: - cmp r4, 0x9 - bls _08026FAA - b _0802722C -_08026FAA: - lsls r0, r4, 2 - ldr r1, =_08026FB8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08026FB8: - .4byte _08026FE0 - .4byte _08026FF8 - .4byte _08027004 - .4byte _0802701C - .4byte _08027028 - .4byte _08027040 - .4byte _0802704C - .4byte _08027060 - .4byte _0802706C - .4byte _08027084 -_08026FE0: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x68 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x74 - b _08027226 - .pool -_08026FF8: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x74 - b _08027226 - .pool -_08027004: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x74 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x80 - b _08027226 - .pool -_0802701C: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x80 - b _08027226 - .pool -_08027028: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x80 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x50 - b _08027226 - .pool -_08027040: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x50 - b _08027226 - .pool -_0802704C: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 - .pool -_08027060: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08027224 - .pool -_0802706C: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x5C - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x68 - b _08027226 - .pool -_08027084: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x68 - b _08027226 - .pool -_08027090: - subs r0, r4, 0x1 - cmp r0, 0x7 - bls _08027098 - b _0802722C -_08027098: - lsls r0, 2 - ldr r1, =_080270A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080270A8: - .4byte _080270C8 - .4byte _080270E0 - .4byte _080270EC - .4byte _08027104 - .4byte _08027110 - .4byte _08027124 - .4byte _08027130 - .4byte _08027148 -_080270C8: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x68 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x74 - b _08027226 - .pool -_080270E0: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x74 - b _08027226 - .pool -_080270EC: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x74 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x50 - b _08027226 - .pool -_08027104: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x50 - b _08027226 - .pool -_08027110: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 - .pool -_08027124: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08027224 - .pool -_08027130: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x5C - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x68 - b _08027226 - .pool -_08027148: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x68 - b _08027226 - .pool -_08027154: - subs r0, r4, 0x2 - cmp r0, 0x5 - bhi _0802722C - lsls r0, 2 - ldr r1, =_08027168 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08027168: - .4byte _08027180 - .4byte _08027198 - .4byte _080271A4 - .4byte _080271BC - .4byte _080271C8 - .4byte _080271DC -_08027180: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x5C - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x68 - b _08027226 - .pool -_08027198: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x68 - b _08027226 - .pool -_080271A4: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x68 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x50 - b _08027226 - .pool -_080271BC: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x50 - b _08027226 - .pool -_080271C8: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 - .pool -_080271DC: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08027224 - .pool -_080271E8: - cmp r4, 0x4 - beq _0802720E - cmp r4, 0x4 - bgt _080271F6 - cmp r4, 0x3 - beq _08027200 - b _0802722C -_080271F6: - cmp r4, 0x5 - beq _08027214 - cmp r4, 0x6 - beq _08027222 - b _0802722C -_08027200: - ldr r1, [r6] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 -_0802720E: - ldr r1, [r6] - adds r1, 0x50 - b _08027226 -_08027214: - ldr r1, [r6] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 -_08027222: - ldr r1, [r6] -_08027224: - adds r1, 0x5C -_08027226: - ldrh r0, [r1] - adds r0, 0x1 -_0802722A: - strh r0, [r1] -_0802722C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8026F1C - - thumb_func_start sub_8027234 -sub_8027234: @ 8027234 - push {r4,r5,lr} - adds r1, r0, 0 - ldr r4, =gUnknown_02022C98 - ldr r3, [r4] - adds r0, r3, 0 - adds r0, 0x24 - ldrb r0, [r0] - cmp r0, 0x5 - bne _0802729E - cmp r1, 0x1 - bne _08027280 - movs r5, 0x89 - lsls r5, 1 - adds r1, r3, r5 - ldrh r0, [r1] - adds r2, r0, 0x1 - strh r2, [r1] - movs r0, 0x8A - lsls r0, 1 - adds r1, r3, r0 - lsls r0, r2, 16 - lsrs r0, 16 - ldrh r3, [r1] - cmp r0, r3 - bls _08027268 - strh r2, [r1] -_08027268: - ldr r0, [r4] - adds r2, r0, r5 - ldrh r0, [r2] - ldr r1, =0x0000270f - cmp r0, r1 - bls _0802729E - strh r1, [r2] - b _0802729E - .pool -_08027280: - movs r2, 0x89 - lsls r2, 1 - adds r0, r3, r2 - movs r5, 0x8A - lsls r5, 1 - adds r1, r3, r5 - ldrh r0, [r0] - ldrh r3, [r1] - cmp r0, r3 - bls _08027296 - strh r0, [r1] -_08027296: - ldr r0, [r4] - adds r0, r2 - movs r1, 0 - strh r1, [r0] -_0802729E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8027234 - - thumb_func_start sub_80272A4 -sub_80272A4: @ 80272A4 - push {r4,r5,lr} - movs r3, 0 - ldr r2, =gUnknown_02022C98 - ldr r0, [r2] - adds r0, 0x24 - ldrb r0, [r0] - cmp r3, r0 - bcs _080272DC - adds r5, r2, 0 - movs r4, 0x8A - lsls r4, 1 -_080272BA: - ldr r2, [r5] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r1, r2, 0 - adds r1, 0x54 - adds r1, r0 - adds r0, r2, r4 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - adds r2, 0x24 - ldrb r2, [r2] - cmp r3, r2 - bcc _080272BA -_080272DC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80272A4 - - thumb_func_start sub_80272E8 -sub_80272E8: @ 80272E8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r5, 0 - ldr r7, =gUnknown_02022C98 - movs r4, 0 - ldr r0, =0x000031bf - mov r10, r0 -_080272FC: - movs r2, 0 - lsls r6, r5, 4 - lsls r1, r5, 1 - mov r8, r1 - lsls r0, r5, 3 - mov r12, r0 - adds r1, r5, 0x1 - mov r9, r1 - subs r0, r6, r5 - lsls r3, r0, 2 -_08027310: - ldr r0, [r7] - adds r1, r2, r3 - add r0, r10 - adds r0, r1 - strb r4, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xA - bls _08027310 - ldr r0, [r7] - subs r1, r6, r5 - lsls r1, 2 - adds r0, r1 - ldr r2, =0x000031cc - adds r0, r2 - strb r4, [r0] - ldr r0, [r7] - adds r0, r1 - ldr r1, =0x000031d0 - adds r0, r1 - strb r4, [r0] - ldr r0, [r7] - adds r0, 0x90 - adds r0, r5 - strb r4, [r0] - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0x86 - add r0, r8 - strh r4, [r0] - add r1, r12 - ldr r2, =0x00003308 - adds r1, r2 - strb r4, [r1] - ldr r2, [r7] - ldr r1, =0x0000330c - adds r0, r2, r1 - add r0, r12 - str r4, [r0] - mov r0, r8 - adds r1, r0, r5 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x4A - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x4E - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x50 - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x52 - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x54 - adds r0, r1 - strh r4, [r0] - mov r1, r9 - lsls r0, r1, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _080272FC - ldr r2, =gUnknown_02022C98 - ldr r0, [r2] - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - movs r2, 0 - strb r2, [r0] - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - movs r1, 0x89 - lsls r1, 1 - adds r3, r0, r1 - movs r1, 0 - strh r2, [r3] - adds r0, 0x40 - strb r1, [r0] - bl sub_8026A88 - bl sub_8026988 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80272E8 - - thumb_func_start sub_80273F0 -sub_80273F0: @ 80273F0 - push {r4,r5,lr} - movs r4, 0 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r0, [r0] - cmp r0, 0x4 - beq _0802740C - cmp r0, 0x5 - beq _08027410 - b _08027412 - .pool -_0802740C: - movs r4, 0x1 - b _08027412 -_08027410: - movs r4, 0x2 -_08027412: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xA - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - lsls r1, r4, 2 - ldr r5, =gUnknown_02022C98 - ldr r2, =gUnknown_082F7AA4 - adds r1, r4 - lsls r1, 1 - adds r0, r1 - adds r0, r2 - ldrb r2, [r0] -_08027436: - ldr r1, [r5] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r1, 0x52 - adds r1, r0 - strh r2, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x4 - bls _08027436 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80273F0 - - thumb_func_start sub_802745C -sub_802745C: @ 802745C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r2, [r1] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x4A - adds r0, r1 - ldrh r3, [r0] - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r1 - ldrh r0, [r0] - adds r2, 0x4E - adds r2, r1 - adds r3, r0 - ldrh r2, [r2] - adds r0, r3, r2 - ldr r1, =0x0000270f - cmp r0, r1 - bls _0802748E - adds r0, r1, 0 -_0802748E: - pop {r1} - bx r1 - .pool - thumb_func_end sub_802745C - - thumb_func_start sub_802749C -sub_802749C: @ 802749C - push {r4-r6,lr} - ldr r5, =gUnknown_02022C98 - ldr r0, [r5] - adds r0, 0x28 - ldrb r0, [r0] - bl sub_802745C - ldr r1, =0x0000270f - bl sub_8027A38 - adds r4, r0, 0 - ldr r0, [r5] - adds r0, 0x28 - ldrb r0, [r0] - bl sub_80276C0 - ldr r1, =0x000f4236 - bl sub_8027A38 - adds r2, r0, 0 - ldr r3, =gSaveBlock2Ptr - ldr r0, [r3] - movs r6, 0x83 - lsls r6, 2 - adds r1, r0, r6 - ldr r0, [r1] - cmp r0, r2 - bcs _080274D6 - str r2, [r1] -_080274D6: - ldr r0, [r3] - movs r2, 0x84 - lsls r2, 2 - adds r1, r0, r2 - ldrh r0, [r1] - cmp r0, r4 - bcs _080274E6 - strh r4, [r1] -_080274E6: - ldr r0, [r3] - ldr r6, =0x00000212 - adds r2, r0, r6 - ldr r0, [r5] - movs r1, 0x8A - lsls r1, 1 - adds r0, r1 - ldrh r1, [r0] - ldrh r0, [r2] - cmp r0, r1 - bcs _080274FE - strh r1, [r2] -_080274FE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802749C - - thumb_func_start sub_8027518 -sub_8027518: @ 8027518 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x9B - ldrb r6, [r0] - movs r3, 0x3 - adds r5, r1, 0 - adds r4, r5, 0 -_0802752C: - ldr r0, [r4] - adds r0, 0x98 - adds r2, r0, r3 - subs r1, r3, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - lsls r1, 24 - lsrs r3, r1, 24 - cmp r3, 0 - bne _0802752C - ldr r0, [r5] - adds r0, 0x98 - strb r7, [r0] - adds r0, r6, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8027518 - - thumb_func_start sub_8027554 -sub_8027554: @ 8027554 - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r3, [r4] - adds r0, r3, 0 - adds r0, 0x28 - ldrb r1, [r0] - adds r0, 0x88 - adds r2, r0, r1 - ldrb r0, [r2] - cmp r0, 0 - bne _080275FC - ldr r0, =gMain - ldrh r2, [r0, 0x2E] - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - beq _08027594 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r3, r0 - ldr r1, =0x000031cc - adds r0, r1 - movs r1, 0x2 - b _080275CA - .pool -_08027594: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _080275B0 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r3, r0 - ldr r1, =0x000031cc - adds r0, r1 - movs r1, 0x3 - b _080275CA - .pool -_080275B0: - movs r0, 0x10 - ands r0, r2 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0 - beq _080275E8 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r3, r0 - ldr r1, =0x000031cc - adds r0, r1 - movs r1, 0x1 -_080275CA: - strb r1, [r0] - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0x28 - adds r0, 0xB0 - ldrb r1, [r1] - adds r0, r1 - movs r1, 0x6 - strb r1, [r0] - movs r0, 0xD4 - bl PlaySE - b _08027600 - .pool -_080275E8: - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r3, r0 - ldr r1, =0x000031cc - adds r0, r1 - strb r2, [r0] - b _08027600 - .pool -_080275FC: - subs r0, 0x1 - strb r0, [r2] -_08027600: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8027554 - - thumb_func_start sub_8027608 -sub_8027608: @ 8027608 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x28 - ldrb r2, [r0] - lsls r0, r2, 4 - subs r0, r2 - lsls r0, 2 - adds r1, r0 - ldr r0, =0x000031cc - adds r1, r0 - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_8027608 - - thumb_func_start sub_802762C -sub_802762C: @ 802762C - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x28 - ldrb r2, [r0] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r1, 0x52 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x85 - lsls r0, 16 - lsrs r0, 16 - bx lr - .pool - thumb_func_end sub_802762C - - thumb_func_start sub_8027650 -sub_8027650: @ 8027650 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_8027650 - - thumb_func_start sub_8027660 -sub_8027660: @ 8027660 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0802768C - ldr r0, =gUnknown_02022C98 - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 2 - ldr r2, =0x000031a0 - adds r1, r2 - ldr r0, [r0] - b _08027694 - .pool -_0802768C: - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - ldr r1, =gLinkPlayers + 8 -_08027694: - adds r0, r1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8027660 - - thumb_func_start sub_80276A0 -sub_80276A0: @ 80276A0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - ldr r2, =gUnknown_02022C98 - ldr r3, [r2] - lsrs r1, 23 - lsls r2, r0, 1 - adds r2, r0 - lsls r2, 2 - adds r1, r2 - adds r3, 0x4A - adds r3, r1 - ldrh r0, [r3] - bx lr - .pool - thumb_func_end sub_80276A0 - - thumb_func_start sub_80276C0 -sub_80276C0: @ 80276C0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - movs r3, 0 - ldr r0, =gUnknown_02022C98 - mov r9, r0 - ldr r2, =gUnknown_082F7B24 - mov r10, r2 - ldr r2, [r0] - lsls r1, r4, 1 - adds r0, r1, r4 - lsls r0, 2 - str r0, [sp] - adds r6, r2, 0 - adds r6, 0x4A - mov r12, r1 - mov r8, r10 -_080276EE: - lsls r1, r3, 1 - ldr r7, [sp] - adds r0, r1, r7 - adds r0, r6, r0 - ldrh r2, [r0] - add r1, r8 - movs r7, 0 - ldrsh r0, [r1, r7] - muls r0, r2 - adds r5, r0 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x2 - bls _080276EE - mov r0, r9 - ldr r1, [r0] - mov r2, r12 - adds r0, r2, r4 - lsls r0, 2 - adds r1, 0x50 - adds r1, r0 - ldrh r1, [r1] - mov r3, r10 - movs r7, 0x6 - ldrsh r0, [r3, r7] - muls r0, r1 - cmp r5, r0 - bls _08027734 - subs r0, r5, r0 - b _08027736 - .pool -_08027734: - movs r0, 0 -_08027736: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80276C0 - - thumb_func_start sub_8027748 -sub_8027748: @ 8027748 - push {r4-r6,lr} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r6, [r0] - movs r0, 0 - bl sub_80276C0 - adds r5, r0, 0 - movs r4, 0x1 - cmp r4, r6 - bcs _08027776 -_08027760: - adds r0, r4, 0 - bl sub_80276C0 - cmp r0, r5 - bls _0802776C - adds r5, r0, 0 -_0802776C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _08027760 -_08027776: - ldr r1, =0x000f4236 - adds r0, r5, 0 - bl sub_8027A38 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8027748 - - thumb_func_start sub_802778C -sub_802778C: @ 802778C - push {r4,r5,lr} - lsls r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r2, [r1] - adds r1, r2, 0 - adds r1, 0x24 - ldrb r5, [r1] - lsrs r4, r0, 23 - adds r2, 0x4A - adds r0, r2, r4 - ldrh r3, [r0] - movs r1, 0 - cmp r1, r5 - bcs _080277C4 -_080277A8: - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4, r0 - adds r0, r2, r0 - ldrh r0, [r0] - cmp r0, r3 - bls _080277BA - adds r3, r0, 0 -_080277BA: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r5 - bcc _080277A8 -_080277C4: - adds r0, r3, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802778C - - thumb_func_start sub_80277D0 -sub_80277D0: @ 80277D0 - push {r4-r7,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r7, r0, 24 - movs r6, 0x1 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r5, [r0] - movs r4, 0 - cmp r4, r5 - bcs _080277FE -_080277E8: - adds r0, r4, 0 - bl sub_80276C0 - lsls r1, r4, 2 - add r1, sp - str r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _080277E8 -_080277FE: - lsls r7, 2 - mov r12, r7 - cmp r6, 0 - beq _08027838 - subs r7, r5, 0x1 -_08027808: - movs r6, 0 - movs r4, 0 - cmp r6, r7 - bge _08027834 - adds r5, r7, 0 -_08027812: - lsls r0, r4, 2 - mov r2, sp - adds r1, r2, r0 - adds r4, 0x1 - lsls r0, r4, 2 - adds r3, r2, r0 - ldr r0, [r1] - ldr r2, [r3] - cmp r0, r2 - bcs _0802782C - str r2, [r1] - str r0, [r3] - movs r6, 0x1 -_0802782C: - lsls r0, r4, 24 - lsrs r4, r0, 24 - cmp r4, r5 - blt _08027812 -_08027834: - cmp r6, 0 - bne _08027808 -_08027838: - mov r0, sp - add r0, r12 - ldr r0, [r0] - add sp, 0x14 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80277D0 - - thumb_func_start sub_802784C -sub_802784C: @ 802784C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - mov r8, r0 - mov r9, r0 - ldr r6, =gUnknown_02022C98 - ldr r0, [r6] - adds r0, 0x24 - ldrb r5, [r0] - bl sub_8027748 - bl sub_8027748 - cmp r0, 0 - bne _080278A0 - movs r4, 0 - cmp r9, r5 - bcs _080278A0 - adds r2, r6, 0 - ldr r1, =0x00003308 - mov r12, r1 - movs r7, 0 - movs r6, 0x4 - ldr r3, =0x0000330c -_08027884: - ldr r0, [r2] - lsls r1, r4, 3 - adds r0, r1 - add r0, r12 - strb r6, [r0] - ldr r0, [r2] - adds r0, r3 - adds r0, r1 - str r7, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08027884 -_080278A0: - movs r4, 0 - cmp r4, r5 - bcs _080278CA -_080278A6: - adds r0, r4, 0 - bl sub_80276C0 - ldr r1, =0x000f4236 - bl sub_8027A38 - ldr r1, =gUnknown_02022C98 - ldr r1, [r1] - lsls r2, r4, 3 - ldr r3, =0x0000330c - adds r1, r3 - adds r1, r2 - str r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _080278A6 -_080278CA: - mov r0, r10 - bl sub_80277D0 - adds r6, r0, 0 - mov r3, r8 - movs r4, 0 - cmp r4, r5 - bcs _08027916 - ldr r7, =gUnknown_02022C98 - mov r10, r7 -_080278DE: - mov r0, r10 - ldr r2, [r0] - lsls r1, r4, 3 - ldr r7, =0x0000330c - adds r0, r2, r7 - adds r0, r1 - ldr r0, [r0] - cmp r6, r0 - bne _0802790C - adds r0, r2, r1 - ldr r1, =0x00003308 - adds r0, r1 - strb r3, [r0] - mov r0, r8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_0802790C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _080278DE -_08027916: - mov r10, r8 - cmp r9, r5 - bcc _080278CA - movs r0, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802784C - - thumb_func_start sub_802793C -sub_802793C: @ 802793C - lsls r1, 24 - ldr r2, =gUnknown_02022C98 - ldr r2, [r2] - lsrs r1, 21 - ldr r3, =0x00003308 - adds r2, r3 - adds r2, r1 - ldr r1, [r2] - ldr r2, [r2, 0x4] - str r1, [r0] - str r2, [r0, 0x4] - bx lr - .pool - thumb_func_end sub_802793C - - thumb_func_start sub_802795C -sub_802795C: @ 802795C - push {r4-r7,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r6, r0, 24 - movs r7, 0 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r5, [r0] - mov r0, sp - movs r1, 0 - movs r2, 0x14 - bl memset - movs r4, 0 - cmp r7, r5 - bcs _08027994 -_0802797E: - adds r0, r4, 0 - bl sub_80276C0 - lsls r1, r4, 2 - add r1, sp - str r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _0802797E -_08027994: - lsls r0, r6, 2 - add r0, sp - ldr r1, [r0] - movs r4, 0 -_0802799C: - cmp r4, r6 - beq _080279B0 - lsls r0, r4, 2 - add r0, sp - ldr r0, [r0] - cmp r1, r0 - bcs _080279B0 - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 -_080279B0: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _0802799C - adds r0, r7, 0 - add sp, 0x14 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802795C - - thumb_func_start sub_80279C8 -sub_80279C8: @ 80279C8 - push {r4-r6,lr} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x28 - ldrb r4, [r0] - bl sub_802762C - lsls r0, 16 - lsrs r5, r0, 16 - adds r6, r5, 0 - adds r0, r4, 0 - bl sub_80276C0 - adds r4, r0, 0 - bl sub_8027748 - cmp r4, r0 - beq _080279F4 - movs r0, 0x3 - b _08027A22 - .pool -_080279F4: - adds r0, r5, 0 - movs r1, 0x1 - bl CheckBagHasSpace - lsls r0, 24 - cmp r0, 0 - bne _08027A06 - movs r0, 0x2 - b _08027A22 -_08027A06: - adds r0, r6, 0 - movs r1, 0x1 - bl AddBagItem - adds r0, r6, 0 - movs r1, 0x1 - bl CheckBagHasSpace - lsls r0, 24 - cmp r0, 0 - beq _08027A20 - movs r0, 0 - b _08027A22 -_08027A20: - movs r0, 0x1 -_08027A22: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80279C8 - - thumb_func_start sub_8027A28 -sub_8027A28: @ 8027A28 - push {lr} - adds r2, r0, 0 - adds r0, r1, 0 - cmp r2, r0 - bcs _08027A34 - adds r0, r2, 0x1 -_08027A34: - pop {r1} - bx r1 - thumb_func_end sub_8027A28 - - thumb_func_start sub_8027A38 -sub_8027A38: @ 8027A38 - push {lr} - adds r2, r0, 0 - adds r0, r1, 0 - cmp r2, r0 - bcs _08027A44 - adds r0, r2, 0 -_08027A44: - pop {r1} - bx r1 - thumb_func_end sub_8027A38 - - thumb_func_start sub_8027A48 -sub_8027A48: @ 8027A48 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r1, [r1] - adds r1, 0x34 - adds r1, r0 - ldrb r0, [r1] - bx lr - .pool - thumb_func_end sub_8027A48 - - thumb_func_start sub_8027A5C -sub_8027A5C: @ 8027A5C - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gScriptResult -_08027A62: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _08027A94 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - cmp r0, 0x55 - bne _08027A94 - movs r0, 0x1 - strh r0, [r6] - b _08027AA0 - .pool -_08027A94: - adds r5, 0x1 - cmp r5, 0x5 - ble _08027A62 - ldr r1, =gScriptResult - movs r0, 0 - strh r0, [r1] -_08027AA0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027A5C - - thumb_func_start sub_8027AAC -sub_8027AAC: @ 8027AAC - push {r4,lr} - ldr r4, =sub_8027ACC - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027AAC - - thumb_func_start sub_8027ACC -sub_8027ACC: @ 8027ACC - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - movs r1, 0 - ldrsh r0, [r7, r1] - cmp r0, 0x1 - beq _08027B94 - cmp r0, 0x1 - bgt _08027AF4 - cmp r0, 0 - beq _08027AFE - b _08027BE2 - .pool -_08027AF4: - cmp r0, 0x2 - beq _08027BA0 - cmp r0, 0x3 - beq _08027BC8 - b _08027BE2 -_08027AFE: - ldr r0, =gUnknown_082F7B2C - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - ldr r1, =gText_BerryPickingRecords - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r4, r0, 0 - movs r6, 0 - ldr r5, =gUnknown_082F7B34 -_08027B18: - ldr r1, [r5] - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r0, 0x32 - cmp r0, r4 - ble _08027B2A - adds r4, r0, 0 -_08027B2A: - adds r5, 0x4 - adds r6, 0x1 - cmp r6, 0x2 - bls _08027B18 - adds r0, r4, 0x7 - cmp r0, 0 - bge _08027B3A - adds r0, 0x7 -_08027B3A: - asrs r4, r0, 3 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08027B46 - adds r4, 0x1 -_08027B46: - movs r1, 0x1E - subs r1, r4 - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - lsls r1, 24 - lsrs r1, 16 - ldr r2, =0xffff00ff - ldr r0, [sp] - ands r0, r2 - orrs r0, r1 - lsls r2, r4, 24 - ldr r1, =0x00ffffff - ands r0, r1 - orrs r0, r2 - str r0, [sp] - mov r0, sp - bl AddWindow - strh r0, [r7, 0x2] - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_8027BEC - ldrb r0, [r7, 0x2] - movs r1, 0x3 - b _08027BB6 - .pool -_08027B94: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08027BE2 - b _08027BBA -_08027BA0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08027BE2 - ldrb r0, [r7, 0x2] - bl rbox_fill_rectangle - ldrb r0, [r7, 0x2] - movs r1, 0x1 -_08027BB6: - bl CopyWindowToVram -_08027BBA: - ldrh r0, [r7] - adds r0, 0x1 - strh r0, [r7] - b _08027BE2 - .pool -_08027BC8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08027BE2 - ldrb r0, [r7, 0x2] - bl RemoveWindow - adds r0, r4, 0 - bl DestroyTask - bl EnableBothScriptContexts -_08027BE2: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8027ACC - - thumb_func_start sub_8027BEC -sub_8027BEC: @ 8027BEC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - str r1, [sp, 0x18] - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - movs r2, 0x84 - lsls r2, 2 - adds r0, r1, r2 - ldrh r0, [r0] - str r0, [sp, 0xC] - subs r2, 0x4 - adds r0, r1, r2 - ldr r0, [r0] - str r0, [sp, 0x10] - ldr r0, =0x00000212 - adds r1, r0 - ldrh r0, [r1] - str r0, [sp, 0x14] - ldr r4, =0x0000021d - adds r0, r7, 0 - adds r1, r4, 0 - movs r2, 0xD0 - bl box_border_load_tiles_and_pal - adds r0, r7, 0 - adds r1, r4, 0 - movs r2, 0xD - bl sub_8098858 - adds r0, r7, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r4, =gText_BerryPickingRecords - ldr r0, [sp, 0x18] - lsls r2, r0, 3 - movs r0, 0x1 - adds r1, r4, 0 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl PrintTextOnWindow - movs r6, 0 - ldr r2, =gStringVar1 - mov r8, r2 - movs r0, 0xFF - mov r10, r0 - mov r9, r6 - mov r2, sp - adds r2, 0xC - str r2, [sp, 0x1C] -_08027C76: - lsls r4, r6, 2 - ldr r0, [sp, 0x1C] - ldm r0!, {r1} - str r0, [sp, 0x1C] - ldr r0, =gUnknown_082F7B40 - adds r0, r6, r0 - ldrb r3, [r0] - mov r0, r8 - movs r2, 0 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - mov r1, r8 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - adds r5, r0, 0 - ldr r0, =gUnknown_082F7B34 - adds r4, r0 - ldr r2, [r4] - ldr r0, =gUnknown_082F7B44 - lsls r4, r6, 1 - adds r0, r4, r0 - ldrb r0, [r0] - str r0, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r2, [sp, 0x18] - lsls r3, r2, 3 - subs r3, r5 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gUnknown_082F7B4A - adds r4, r0 - ldrb r0, [r4] - str r0, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r2, r9 - str r2, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - mov r2, r8 - bl PrintTextOnWindow - adds r6, 0x1 - cmp r6, 0x2 - ble _08027C76 - adds r0, r7, 0 - bl PutWindowTilemap - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027BEC - - thumb_func_start sub_8027D20 -sub_8027D20: @ 8027D20 - push {lr} - bl GetLinkPlayerCount - ldr r1, =gUnknown_02022C98 - ldr r1, [r1] - adds r1, 0x24 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027D20 - - thumb_func_start sub_8027D38 -sub_8027D38: @ 8027D38 - push {r4-r7,lr} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r4, [r0] - cmp r4, 0x4 - bhi _08027D66 - ldr r5, =gUnknown_082F7B90 -_08027D48: - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - ldr r1, =gLinkPlayers + 8 - adds r0, r1 - lsls r1, r4, 2 - adds r1, r5 - ldr r1, [r1] - bl StringCopy - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _08027D48 -_08027D66: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x24 - movs r2, 0x5 - strb r2, [r1] - movs r1, 0 - mov r12, r0 -_08027D74: - movs r4, 0 - mov r2, r12 - ldr r0, [r2] - adds r0, 0x24 - adds r5, r1, 0x1 - ldrb r0, [r0] - cmp r4, r0 - bcs _08027DB2 - ldr r7, =gUnknown_02022C98 - lsls r3, r1, 1 - ldr r6, =gUnknown_082F7B50 -_08027D8A: - ldr r2, [r7] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r3, r0 - adds r1, r2, 0 - adds r1, 0x4A - adds r1, r0 - lsls r0, r4, 3 - adds r0, r3, r0 - adds r0, r6 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r2, 0x24 - ldrb r2, [r2] - cmp r4, r2 - bcc _08027D8A -_08027DB2: - lsls r0, r5, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _08027D74 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027D38 - - thumb_func_start sub_8027DD0 -sub_8027DD0: @ 8027DD0 - push {lr} - sub sp, 0x8 - ldr r3, =0xffffff00 - ldr r1, [sp] - ands r1, r3 - movs r2, 0x1 - orrs r1, r2 - str r1, [sp] - lsls r0, 24 - lsrs r0, 24 - ldr r1, [sp, 0x4] - ands r1, r3 - orrs r1, r0 - str r1, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027DD0 - - thumb_func_start sub_8027DFC -sub_8027DFC: @ 8027DFC - push {lr} - adds r2, r0, 0 - ldr r3, =gUnknown_03003090 - ldrh r0, [r3] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _08027E1E - lsls r0, r2, 4 - adds r1, r3, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0x1 - beq _08027E28 -_08027E1E: - movs r0, 0 - b _08027E2A - .pool -_08027E28: - ldrb r0, [r1, 0x4] -_08027E2A: - pop {r1} - bx r1 - thumb_func_end sub_8027DFC - - thumb_func_start sub_8027E30 -sub_8027E30: @ 8027E30 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r4, [sp, 0x48] - lsls r4, 24 - str r4, [sp, 0x1C] - movs r4, 0x14 - adds r4, r0 - mov r9, r4 - mov r5, sp - movs r4, 0x2 - strb r4, [r5] - mov r10, sp - mov r5, r9 - ldrb r4, [r5, 0xB] - movs r7, 0xF - adds r5, r7, 0 - ands r5, r4 - mov r6, r10 - ldrb r6, [r6, 0x1] - mov r8, r6 - movs r4, 0x10 - negs r4, r4 - mov r6, r8 - ands r4, r6 - orrs r4, r5 - mov r5, r10 - strb r4, [r5, 0x1] - mov r8, sp - mov r6, r9 - ldrb r5, [r6, 0xC] - lsls r5, 4 - ands r4, r7 - orrs r4, r5 - mov r5, r8 - strb r4, [r5, 0x1] - ldrb r5, [r6, 0xD] - movs r6, 0xF - ands r5, r6 - mov r4, r10 - ldrb r4, [r4, 0x2] - mov r8, r4 - movs r4, 0x10 - negs r4, r4 - mov r6, r8 - ands r4, r6 - orrs r4, r5 - mov r5, r10 - strb r4, [r5, 0x2] - mov r8, sp - mov r6, r9 - ldrb r5, [r6, 0xE] - lsls r5, 4 - ands r4, r7 - orrs r4, r5 - mov r5, r8 - strb r4, [r5, 0x2] - ldrb r5, [r6, 0xF] - movs r6, 0xF - ands r5, r6 - mov r4, r10 - ldrb r4, [r4, 0x3] - mov r8, r4 - movs r4, 0x10 - negs r4, r4 - mov r6, r8 - ands r4, r6 - orrs r4, r5 - mov r5, r10 - strb r4, [r5, 0x3] - mov r8, sp - mov r6, r9 - ldrb r5, [r6, 0x10] - lsls r5, 4 - ands r4, r7 - orrs r4, r5 - mov r5, r8 - strb r4, [r5, 0x3] - ldrb r5, [r6, 0x11] - movs r6, 0xF - ands r5, r6 - mov r4, r10 - ldrb r4, [r4, 0x4] - mov r8, r4 - movs r4, 0x10 - negs r4, r4 - mov r6, r8 - ands r4, r6 - orrs r4, r5 - mov r5, r10 - strb r4, [r5, 0x4] - mov r8, sp - mov r6, r9 - ldrb r5, [r6, 0x12] - lsls r5, 4 - ands r4, r7 - orrs r4, r5 - mov r5, r8 - strb r4, [r5, 0x4] - ldrb r4, [r6, 0x13] - movs r6, 0xF - ands r4, r6 - mov r6, r8 - ldrb r5, [r6, 0x5] - movs r6, 0x10 - negs r6, r6 - ands r6, r5 - orrs r6, r4 - str r6, [sp, 0xC] - mov r4, r8 - strb r6, [r4, 0x5] - mov r5, sp - mov r6, r9 - ldrb r4, [r6, 0x14] - lsls r4, 4 - ldr r6, [sp, 0xC] - ands r6, r7 - orrs r6, r4 - strb r6, [r5, 0x5] - mov r7, sp - movs r4, 0x3 - mov r8, r4 - ldrb r0, [r0, 0x14] - mov r5, r8 - ands r0, r5 - ldrb r5, [r7, 0x6] - movs r6, 0x4 - negs r6, r6 - mov r10, r6 - mov r4, r10 - ands r4, r5 - orrs r4, r0 - strb r4, [r7, 0x6] - mov r5, r9 - ldrb r0, [r5, 0x1] - mov r6, r8 - ands r0, r6 - lsls r0, 2 - movs r5, 0xD - negs r5, r5 - ands r5, r4 - orrs r5, r0 - strb r5, [r7, 0x6] - mov r0, r9 - ldrb r4, [r0, 0x2] - ands r4, r6 - lsls r4, 4 - movs r0, 0x31 - negs r0, r0 - ands r0, r5 - orrs r0, r4 - strb r0, [r7, 0x6] - mov r5, sp - mov r6, r9 - ldrb r4, [r6, 0x3] - lsls r4, 6 - movs r6, 0x3F - ands r0, r6 - orrs r0, r4 - strb r0, [r5, 0x6] - mov r4, r9 - ldrb r0, [r4, 0x4] - mov r5, r8 - ands r0, r5 - ldrb r5, [r7, 0x7] - mov r4, r10 - ands r4, r5 - orrs r4, r0 - strb r4, [r7, 0x7] - mov r6, r9 - ldrb r0, [r6, 0x5] - mov r5, r8 - ands r0, r5 - lsls r0, 2 - movs r5, 0xD - negs r5, r5 - ands r5, r4 - orrs r5, r0 - strb r5, [r7, 0x7] - ldrb r4, [r6, 0x6] - mov r6, r8 - ands r4, r6 - lsls r4, 4 - movs r0, 0x31 - negs r0, r0 - ands r0, r5 - orrs r0, r4 - strb r0, [r7, 0x7] - mov r5, sp - mov r6, r9 - ldrb r4, [r6, 0x7] - lsls r4, 6 - movs r6, 0x3F - ands r0, r6 - orrs r0, r4 - strb r0, [r5, 0x7] - mov r8, sp - mov r0, r9 - ldrb r4, [r0, 0x8] - movs r7, 0x3 - adds r0, r7, 0 - ands r0, r4 - mov r4, r8 - ldrb r5, [r4, 0x8] - mov r4, r10 - ands r4, r5 - orrs r4, r0 - mov r5, r8 - strb r4, [r5, 0x8] - mov r6, r9 - ldrb r5, [r6, 0x9] - adds r0, r7, 0 - ands r0, r5 - lsls r0, 2 - movs r5, 0xD - negs r5, r5 - ands r5, r4 - orrs r5, r0 - mov r0, r8 - strb r5, [r0, 0x8] - ldrb r0, [r1] - adds r4, r7, 0 - ands r4, r0 - lsls r4, 4 - movs r0, 0x31 - negs r0, r0 - ands r0, r5 - orrs r0, r4 - mov r4, r8 - strb r0, [r4, 0x8] - mov r5, sp - ldrb r4, [r2] - lsls r4, 6 - movs r6, 0x3F - ands r0, r6 - orrs r0, r4 - strb r0, [r5, 0x8] - ldrb r4, [r3] - adds r0, r7, 0 - ands r0, r4 - ldrb r4, [r5, 0x9] - mov r6, r10 - ands r6, r4 - orrs r6, r0 - mov r10, r6 - strb r6, [r5, 0x9] - ldr r0, [sp, 0x40] - ldrb r4, [r0] - adds r0, r7, 0 - ands r0, r4 - lsls r0, 2 - movs r4, 0xD - negs r4, r4 - ands r6, r4 - orrs r6, r0 - str r6, [sp, 0x10] - strb r6, [r5, 0x9] - mov r4, sp - ldr r5, [sp, 0x44] - ldrb r0, [r5] - adds r6, r7, 0 - ands r6, r0 - lsls r0, r6, 4 - subs r7, 0x34 - ldr r5, [sp, 0x10] - ands r7, r5 - orrs r7, r0 - strb r7, [r4, 0x9] - mov r5, sp - ldrb r0, [r1, 0x4] - movs r6, 0x1 - mov r12, r6 - mov r4, r12 - ands r4, r0 - lsls r4, 6 - movs r0, 0x41 - negs r0, r0 - mov r10, r0 - ands r0, r7 - orrs r0, r4 - strb r0, [r5, 0x9] - ldrb r4, [r2, 0x4] - lsls r4, 7 - movs r5, 0x7F - ands r0, r5 - orrs r0, r4 - mov r4, r8 - strb r0, [r4, 0x9] - ldrb r4, [r3, 0x4] - mov r0, r12 - ands r0, r4 - mov r5, r8 - ldrb r4, [r5, 0xA] - movs r7, 0x2 - negs r7, r7 - adds r5, r7, 0 - ands r5, r4 - orrs r5, r0 - mov r6, r8 - strb r5, [r6, 0xA] - mov r9, sp - ldr r4, [sp, 0x40] - ldrb r0, [r4, 0x4] - mov r4, r12 - ands r4, r0 - lsls r4, 1 - movs r6, 0x3 - negs r6, r6 - mov r8, r6 - mov r0, r8 - ands r0, r5 - orrs r0, r4 - mov r4, r9 - strb r0, [r4, 0xA] - ldr r6, [sp, 0x44] - ldrb r5, [r6, 0x4] - mov r4, r12 - ands r4, r5 - lsls r4, 2 - movs r5, 0x5 - negs r5, r5 - ands r0, r5 - orrs r0, r4 - mov r4, r9 - strb r0, [r4, 0xA] - mov r4, sp - ldrb r1, [r1, 0x8] - mov r0, r12 - ands r0, r1 - lsls r0, 2 - ldrb r1, [r4, 0xB] - ands r5, r1 - orrs r5, r0 - strb r5, [r4, 0xB] - ldrb r1, [r2, 0x8] - mov r0, r12 - ands r0, r1 - lsls r0, 3 - movs r1, 0x9 - negs r1, r1 - ands r1, r5 - orrs r1, r0 - strb r1, [r4, 0xB] - ldrb r2, [r3, 0x8] - mov r0, r12 - ands r0, r2 - lsls r0, 4 - movs r2, 0x11 - negs r2, r2 - ands r2, r1 - orrs r2, r0 - strb r2, [r4, 0xB] - mov r3, sp - ldr r5, [sp, 0x40] - ldrb r0, [r5, 0x8] - mov r1, r12 - ands r1, r0 - lsls r1, 5 - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0xB] - mov r2, sp - ldrb r1, [r6, 0x8] - mov r6, r12 - ands r6, r1 - lsls r1, r6, 6 - mov r3, r10 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0xB] - ldr r4, [sp, 0x1C] - lsrs r3, r4, 21 - ldrb r1, [r2, 0xA] - movs r0, 0x7 - ands r0, r1 - orrs r0, r3 - strb r0, [r2, 0xA] - mov r1, sp - ldr r5, [sp, 0x4C] - movs r6, 0x1 - ands r5, r6 - lsls r2, r5, 1 - ldrb r0, [r1, 0xB] - mov r3, r8 - ands r3, r0 - orrs r3, r2 - mov r8, r3 - strb r3, [r1, 0xB] - mov r0, sp - ldr r4, [sp, 0x50] - ands r4, r6 - mov r5, r8 - ands r5, r7 - orrs r5, r4 - strb r5, [r0, 0xB] - bl sub_800FE50 - 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_8027E30 - - thumb_func_start sub_8028164 -sub_8028164: @ 8028164 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r1, 0 - adds r5, r2, 0 - adds r6, r3, 0 - ldr r0, [sp, 0x1C] - mov r12, r0 - ldr r1, [sp, 0x20] - mov r8, r1 - ldr r0, [sp, 0x24] - mov r9, r0 - adds r2, r7, 0 - adds r2, 0x14 - ldr r4, =gUnknown_03003090 - ldrh r0, [r4] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _0802819C - adds r3, r4, 0x2 - ldrb r0, [r4, 0x2] - cmp r0, 0x2 - beq _080281A4 -_0802819C: - movs r0, 0 - b _080282DE - .pool -_080281A4: - ldrb r0, [r3, 0x1] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0xB] - ldrb r0, [r3, 0x1] - lsrs r0, 4 - strb r0, [r2, 0xC] - ldrb r0, [r3, 0x2] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0xD] - ldrb r0, [r3, 0x2] - lsrs r0, 4 - strb r0, [r2, 0xE] - ldrb r0, [r3, 0x3] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0xF] - ldrb r0, [r3, 0x3] - lsrs r0, 4 - strb r0, [r2, 0x10] - ldrb r0, [r3, 0x4] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0x11] - ldrb r0, [r3, 0x4] - lsrs r0, 4 - strb r0, [r2, 0x12] - ldrb r0, [r3, 0x5] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0x13] - ldrb r0, [r3, 0x5] - lsrs r0, 4 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0x15] - ldrb r0, [r3, 0x6] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r7, 0x14] - ldrb r0, [r3, 0x6] - lsls r0, 28 - lsrs r0, 30 - strb r0, [r2, 0x1] - ldrb r0, [r3, 0x6] - lsls r0, 26 - lsrs r0, 30 - strb r0, [r2, 0x2] - ldrb r0, [r3, 0x6] - lsrs r0, 6 - strb r0, [r2, 0x3] - ldrb r0, [r3, 0x7] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r2, 0x4] - ldrb r0, [r3, 0x7] - lsls r0, 28 - lsrs r0, 30 - strb r0, [r2, 0x5] - ldrb r0, [r3, 0x7] - lsls r0, 26 - lsrs r0, 30 - strb r0, [r2, 0x6] - ldrb r0, [r3, 0x7] - lsrs r0, 6 - strb r0, [r2, 0x7] - ldrb r0, [r3, 0x8] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r2, 0x8] - ldrb r0, [r3, 0x8] - lsls r0, 28 - lsrs r0, 30 - strb r0, [r2, 0x9] - ldrb r0, [r3, 0x6] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r2, 0xA] - ldrb r0, [r3, 0x8] - lsls r0, 26 - lsrs r0, 30 - strb r0, [r5] - ldrb r0, [r3, 0x9] - lsls r0, 25 - lsrs r0, 31 - strb r0, [r5, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 29 - lsrs r0, 31 - strb r0, [r5, 0x8] - ldrb r0, [r3, 0x8] - lsrs r0, 6 - strb r0, [r6] - ldrb r0, [r3, 0x9] - lsrs r0, 7 - strb r0, [r6, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 28 - lsrs r0, 31 - strb r0, [r6, 0x8] - ldrb r0, [r3, 0x9] - lsls r0, 30 - lsrs r0, 30 - mov r1, r12 - strb r0, [r1] - ldrb r0, [r3, 0xA] - lsls r0, 31 - lsrs r0, 31 - strb r0, [r1, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 27 - lsrs r0, 31 - strb r0, [r1, 0x8] - ldrb r0, [r3, 0x9] - lsls r0, 28 - lsrs r0, 30 - mov r1, r8 - strb r0, [r1] - ldrb r0, [r3, 0xA] - lsls r0, 30 - lsrs r0, 31 - strb r0, [r1, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 26 - lsrs r0, 31 - strb r0, [r1, 0x8] - ldrb r0, [r3, 0x9] - lsls r0, 26 - lsrs r0, 30 - mov r1, r9 - strb r0, [r1] - ldrb r0, [r3, 0xA] - lsls r0, 29 - lsrs r0, 31 - strb r0, [r1, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 25 - lsrs r0, 31 - strb r0, [r1, 0x8] - ldrb r0, [r3, 0xA] - lsrs r0, 3 - ldr r1, [sp, 0x28] - strb r0, [r1] - ldrb r0, [r3, 0xB] - lsls r0, 30 - lsrs r0, 31 - ldr r1, [sp, 0x2C] - str r0, [r1] - ldrb r0, [r3, 0xB] - lsls r0, 31 - lsrs r0, 31 - ldr r1, [sp, 0x30] - str r0, [r1] - movs r0, 0x1 -_080282DE: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8028164 - - thumb_func_start sub_80282EC -sub_80282EC: @ 80282EC - push {lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =0xffffff00 - ldr r1, [sp] - ands r1, r3 - movs r2, 0x3 - orrs r1, r2 - str r1, [sp] - ldr r1, [sp, 0x4] - ands r1, r3 - orrs r1, r0 - str r1, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80282EC - - thumb_func_start sub_8028318 -sub_8028318: @ 8028318 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldr r3, =gUnknown_03003090 - ldrh r0, [r3] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _0802833C - lsls r0, r2, 4 - adds r1, r3, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0x3 - beq _08028344 -_0802833C: - movs r0, 0 - b _0802834A - .pool -_08028344: - ldrb r0, [r1, 0x4] - strb r0, [r4] - movs r0, 0x1 -_0802834A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8028318 - - thumb_func_start sub_8028350 -sub_8028350: @ 8028350 - push {lr} - sub sp, 0x8 - ldr r2, =0xffffff00 - ldr r1, [sp] - ands r1, r2 - movs r2, 0x4 - orrs r1, r2 - str r1, [sp] - str r0, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028350 - - thumb_func_start sub_8028374 -sub_8028374: @ 8028374 - push {lr} - adds r2, r0, 0 - ldr r3, =gUnknown_03003090 - ldrh r0, [r3] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _08028396 - lsls r0, r2, 4 - adds r1, r3, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0x4 - beq _080283A0 -_08028396: - movs r0, 0 - b _080283A2 - .pool -_080283A0: - ldr r0, [r1, 0x4] -_080283A2: - pop {r1} - bx r1 - thumb_func_end sub_8028374 - - thumb_func_start sub_80283A8 -sub_80283A8: @ 80283A8 - push {r4,r5,lr} - sub sp, 0x18 - movs r5, 0xC0 - lsls r5, 6 - adds r0, r5, 0 - bl AllocZeroed - adds r4, r0, 0 - ldr r0, =gUnknown_082FB2D8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x8] - str r1, [sp, 0xC] - ldr r0, =gUnknown_082FB2E0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x10] - str r1, [sp, 0x14] - ldr r0, =gDodrioBerryPkmnGfx - adds r1, r4, 0 - bl LZ77UnCompWram - cmp r4, 0 - beq _080283E8 - str r4, [sp] - str r5, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet - adds r0, r4, 0 - bl Free -_080283E8: - add r0, sp, 0x8 - bl LoadSpritePalette - add r0, sp, 0x10 - bl LoadSpritePalette - add sp, 0x18 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80283A8 - - thumb_func_start sub_8028408 -sub_8028408: @ 8028408 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x30 - adds r6, r1, 0 - mov r8, r2 - adds r5, r3, 0 - lsls r6, 24 - lsrs r6, 24 - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r5, 24 - lsrs r5, 24 - add r1, sp, 0x18 - movs r3, 0 - strh r3, [r1] - ldrb r2, [r0] - mov r0, sp - adds r0, 0x1A - strh r2, [r0] - ldr r0, =gUnknown_082FB1E0 - str r0, [sp, 0x1C] - ldr r0, =gUnknown_082FB228 - str r0, [sp, 0x20] - str r3, [sp, 0x24] - ldr r0, =gDummySpriteAffineAnimTable - str r0, [sp, 0x28] - ldr r0, =sub_80284A8 - str r0, [sp, 0x2C] - mov r0, sp - movs r2, 0x18 - bl memcpy - movs r0, 0x4 - bl AllocZeroed - ldr r1, =gUnknown_02022C9C - mov r2, r8 - lsls r4, r2, 2 - adds r4, r1 - str r0, [r4] - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_8028F14 - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - mov r0, sp - movs r2, 0x88 - movs r3, 0x3 - bl CreateSprite - ldr r1, [r4] - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - movs r0, 0x1 - mov r1, r8 - bl sub_8028654 - add sp, 0x30 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028408 - - thumb_func_start sub_80284A8 -sub_80284A8: @ 80284A8 - push {lr} - movs r2, 0x2E - ldrsh r1, [r0, r2] - cmp r1, 0x1 - beq _080284BC - cmp r1, 0x1 - ble _080284C6 - cmp r1, 0x2 - beq _080284C2 - b _080284C6 -_080284BC: - bl sub_802853C - b _080284C6 -_080284C2: - bl sub_80285AC -_080284C6: - pop {r0} - bx r0 - thumb_func_end sub_80284A8 - - thumb_func_start sub_80284CC -sub_80284CC: @ 80284CC - push {lr} - bl GetMultiplayerId - ldr r1, =gUnknown_02022C9C - lsls r0, 24 - lsrs r0, 22 - adds r0, r1 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r2, 0 - movs r1, 0x1 - strh r1, [r0, 0x2E] - strh r2, [r0, 0x30] - strh r2, [r0, 0x32] - strh r2, [r0, 0x34] - strh r2, [r0, 0x36] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80284CC - - thumb_func_start sub_8028504 -sub_8028504: @ 8028504 - push {lr} - bl GetMultiplayerId - ldr r1, =gUnknown_02022C9C - lsls r0, 24 - lsrs r0, 22 - adds r0, r1 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r2, 0 - movs r1, 0x2 - strh r1, [r0, 0x2E] - strh r2, [r0, 0x30] - strh r2, [r0, 0x32] - strh r2, [r0, 0x34] - strh r2, [r0, 0x36] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028504 - - thumb_func_start sub_802853C -sub_802853C: @ 802853C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r2, r0, 16 - lsrs r0, 31 - adds r0, r2, r0 - asrs r1, r0, 1 - adds r0, r1, 0 - cmp r1, 0 - bge _08028558 - adds r0, r1, 0x3 -_08028558: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 24 - lsrs r0, 24 - cmp r2, 0x2 - ble _080285A2 - cmp r0, 0x2 - bgt _0802856E - cmp r0, 0x1 - bge _08028572 -_0802856E: - movs r0, 0x1 - b _08028574 -_08028572: - movs r0, 0xFF -_08028574: - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x27 - ble _080285A2 - movs r0, 0 - strh r0, [r4, 0x2E] - bl sub_8027650 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_8028F14 - strh r0, [r4, 0x20] -_080285A2: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802853C - - thumb_func_start sub_80285AC -sub_80285AC: @ 80285AC - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x30] - adds r0, 0x1 - strh r0, [r5, 0x30] - lsls r0, 16 - asrs r0, 16 - movs r1, 0xD - bl __divsi3 - lsls r0, 16 - asrs r1, r0, 16 - adds r0, r1, 0 - cmp r1, 0 - bge _080285CC - adds r0, r1, 0x3 -_080285CC: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 24 - lsrs r4, r0, 24 - movs r1, 0x30 - ldrsh r0, [r5, r1] - movs r1, 0xD - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _080285F0 - cmp r4, 0 - beq _080285F0 - movs r0, 0xD4 - bl PlaySE -_080285F0: - movs r1, 0x30 - ldrsh r0, [r5, r1] - cmp r0, 0x67 - ble _080285FE - movs r0, 0 - strh r0, [r5, 0x2E] - movs r4, 0 -_080285FE: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_80286B4 - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80285AC - - thumb_func_start sub_8028614 -sub_8028614: @ 8028614 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - cmp r4, r5 - bcs _08028646 - ldr r6, =gUnknown_02022C9C -_08028622: - lsls r0, r4, 2 - adds r0, r6 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _0802863C - bl DestroySpriteAndFreeResources -_0802863C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08028622 -_08028646: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028614 - - thumb_func_start sub_8028654 -sub_8028654: @ 8028654 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - ldr r3, =gSprites - ldr r2, =gUnknown_02022C9C - lsrs r1, 22 - adds r1, r2 - ldr r1, [r1] - ldrh r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - adds r2, 0x3E - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - ldrb r3, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r3 - orrs r1, r0 - strb r1, [r2] - bx lr - .pool - thumb_func_end sub_8028654 - - thumb_func_start sub_802868C -sub_802868C: @ 802868C - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - movs r4, 0 - cmp r4, r5 - bcs _080286AE -_0802869C: - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_8028654 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _0802869C -_080286AE: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802868C - - thumb_func_start sub_80286B4 -sub_80286B4: @ 80286B4 - push {lr} - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_02022C9C - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ldrh r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r2, =gSprites - adds r0, r2 - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_80286B4 - - thumb_func_start nullsub_15 -nullsub_15: @ 80286E0 - bx lr - thumb_func_end nullsub_15 - - thumb_func_start sub_80286E4 -sub_80286E4: @ 80286E4 - push {r4-r7,lr} - movs r4, 0 - ldr r0, =gSprites - mov r12, r0 - movs r6, 0 - ldr r5, =gUnknown_02022CF4 -_080286F0: - ldr r3, [r5] - lsls r1, r4, 1 - adds r0, r3, 0 - adds r0, 0x2A - adds r0, r1 - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r12 - lsls r0, r4, 4 - adds r0, 0x30 - strh r0, [r1, 0x20] - lsls r2, r4, 3 - movs r7, 0x8 - negs r7, r7 - adds r0, r7, 0 - subs r0, r2 - strh r0, [r1, 0x22] - adds r3, 0xC - adds r3, r4 - strb r6, [r3] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _080286F0 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80286E4 - - thumb_func_start sub_8028734 -sub_8028734: @ 8028734 - push {r4-r6,lr} - sub sp, 0x28 - movs r4, 0xC0 - lsls r4, 1 - adds r0, r4, 0 - bl AllocZeroed - adds r6, r0, 0 - ldr r0, =gUnknown_082FB2E8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x20] - str r1, [sp, 0x24] - ldr r0, =gDodrioBerryStatusGfx - adds r1, r6, 0 - bl LZ77UnCompWram - cmp r6, 0 - beq _080287C4 - str r6, [sp, 0x18] - add r5, sp, 0x18 - movs r0, 0x80 - lsls r0, 9 - orrs r0, r4 - str r0, [r5, 0x4] - mov r1, sp - ldr r0, =gUnknown_082FB2F0 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r4, =gUnknown_02022CF4 - movs r0, 0x40 - bl AllocZeroed - str r0, [r4] - adds r0, r5, 0 - bl LoadSpriteSheet - add r0, sp, 0x20 - bl LoadSpritePalette - movs r4, 0 -_0802878A: - lsls r1, r4, 20 - movs r0, 0xC0 - lsls r0, 14 - adds r1, r0 - asrs r1, 16 - lsls r0, r4, 3 - movs r3, 0x8 - negs r3, r3 - adds r2, r3, 0 - subs r2, r0 - lsls r2, 16 - asrs r2, 16 - mov r0, sp - movs r3, 0 - bl CreateSprite - ldr r1, =gUnknown_02022CF4 - ldr r1, [r1] - lsls r2, r4, 1 - adds r1, 0x2A - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _0802878A -_080287C4: - adds r0, r6, 0 - bl Free - add sp, 0x28 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028734 - - thumb_func_start sub_80287E4 -sub_80287E4: @ 80287E4 - push {r4,r5,lr} - movs r4, 0 -_080287E8: - ldr r5, =gUnknown_02022CF4 - ldr r0, [r5] - lsls r1, r4, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _08028806 - bl DestroySpriteAndFreeResources -_08028806: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _080287E8 - ldr r0, [r5] - bl Free - movs r0, 0 - str r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80287E4 - - thumb_func_start sub_8028828 -sub_8028828: @ 8028828 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r3, 0 - movs r6, 0 - ldr r0, =gUnknown_02022CF4 - mov r9, r0 -_0802883A: - mov r7, r9 - ldr r2, [r7] - lsls r5, r6, 1 - adds r0, r2, 0 - adds r0, 0x2A - adds r0, r5 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - adds r0, r2, 0 - adds r0, 0x16 - adds r0, r5 - movs r1, 0x2 - strh r1, [r0] - adds r0, r2, 0 - adds r0, 0xC - adds r2, r0, r6 - ldrb r1, [r2] - cmp r1, 0 - beq _08028870 - movs r7, 0x22 - ldrsh r0, [r4, r7] - cmp r0, 0x8 - beq _080288A6 -_08028870: - movs r3, 0x1 - movs r7, 0x22 - ldrsh r0, [r4, r7] - cmp r0, 0x8 - bne _08028896 - cmp r1, 0 - bne _080288A6 - strb r3, [r2] - mov r1, r9 - ldr r0, [r1] - adds r0, 0x16 - adds r0, r5 - ldr r1, =0x0000fff0 - strh r1, [r0] - movs r0, 0x24 - str r3, [sp] - bl PlaySE - ldr r3, [sp] -_08028896: - mov r7, r9 - ldr r0, [r7] - adds r0, 0x16 - adds r0, r5 - ldrh r0, [r0] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] -_080288A6: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x9 - bls _0802883A - cmp r3, 0 - bne _080288C4 - movs r0, 0x1 - b _080288C6 - .pool -_080288C4: - movs r0, 0 -_080288C6: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8028828 - - thumb_func_start sub_80288D4 -sub_80288D4: @ 80288D4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xA - bls _08028910 - movs r4, 0 -_080288E0: - ldr r0, =gUnknown_02022CF4 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _080288E0 - b _080289DA - .pool -_08028910: - movs r4, 0 - movs r0, 0xA - subs r0, r5 - cmp r4, r0 - bge _080289D6 - ldr r6, =gSprites -_0802891C: - cmp r5, 0x6 - bls _08028984 - ldr r0, =gUnknown_02022CF4 - ldr r2, [r0] - ldr r1, =0x0000fffa - adds r0, r1, 0 - ldrh r1, [r2, 0x3E] - adds r0, r1 - adds r0, r5 - movs r1, 0 - strh r0, [r2, 0x3E] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1E - bls _0802894C - strh r1, [r2, 0x3E] - b _0802899E - .pool -_0802894C: - cmp r0, 0xA - bls _0802896A - lsls r1, r4, 1 - adds r0, r2, 0 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x2 - bl StartSpriteAnim - b _0802899E -_0802896A: - lsls r1, r4, 1 - adds r0, r2, 0 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0 - bl StartSpriteAnim - b _0802899E -_08028984: - ldr r0, =gUnknown_02022CF4 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0 - bl StartSpriteAnim -_0802899E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0xA - subs r0, r5 - cmp r4, r0 - blt _0802891C - b _080289D6 - .pool -_080289B4: - ldr r0, =gUnknown_02022CF4 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_080289D6: - cmp r4, 0x9 - bls _080289B4 -_080289DA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80288D4 - - thumb_func_start sub_80289E8 -sub_80289E8: @ 80289E8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r7, =gSprites - movs r1, 0x1 - ands r0, r1 - lsls r4, r0, 2 - movs r6, 0x5 - negs r6, r6 - ldr r5, =gUnknown_02022CF4 -_080289FE: - ldr r0, [r5] - lsls r1, r3, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r6, 0 - ands r0, r2 - orrs r0, r4 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x9 - bls _080289FE - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80289E8 - - thumb_func_start sub_8028A34 -sub_8028A34: @ 8028A34 - push {r4,r5,lr} - sub sp, 0x10 - movs r5, 0x90 - lsls r5, 3 - adds r0, r5, 0 - bl AllocZeroed - adds r4, r0, 0 - ldr r0, =gUnknown_082FB314 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x8] - str r1, [sp, 0xC] - ldr r0, =gDodrioBerrySpritesGfx - adds r1, r4, 0 - bl LZ77UnCompWram - cmp r4, 0 - beq _08028A6A - str r4, [sp] - movs r0, 0x80 - lsls r0, 10 - orrs r0, r5 - str r0, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet -_08028A6A: - add r0, sp, 0x8 - bl LoadSpritePalette - adds r0, r4, 0 - bl Free - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028A34 - - thumb_func_start sub_8028A88 -sub_8028A88: @ 8028A88 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x30 - mov r1, sp - ldr r0, =gUnknown_082FB324 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - add r2, sp, 0x18 - adds r1, r2, 0 - ldr r0, =gUnknown_082FB33C - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - movs r5, 0 - mov r9, r2 -_08028AB0: - movs r0, 0x4 - bl AllocZeroed - ldr r1, =gUnknown_02022CB8 - lsls r4, r5, 2 - adds r4, r1 - str r0, [r4] - lsls r0, r5, 3 - lsls r1, r5, 4 - adds r1, r0 - mov r0, sp - movs r2, 0x8 - movs r3, 0x1 - bl CreateSprite - ldr r1, [r4] - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r5, 0 - movs r1, 0x1 - bl sub_8028BF8 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xA - bls _08028AB0 - movs r5, 0 - ldr r7, =gUnknown_02022CE4 - ldr r4, =gUnknown_082FB31C - mov r8, r4 -_08028AF0: - movs r0, 0x4 - bl AllocZeroed - lsls r1, r5, 2 - adds r4, r1, r7 - str r0, [r4] - adds r6, r1, 0 - cmp r5, 0x3 - bne _08028B2C - mov r0, r8 - movs r2, 0x6 - ldrsh r1, [r0, r2] - mov r0, r9 - movs r2, 0x31 - movs r3, 0 - bl CreateSprite - ldr r1, [r7, 0xC] - b _08028B40 - .pool -_08028B2C: - lsls r0, r5, 1 - add r0, r8 - movs r3, 0 - ldrsh r1, [r0, r3] - mov r0, r9 - movs r2, 0x34 - movs r3, 0 - bl CreateSprite - ldr r1, [r4] -_08028B40: - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r6, r7 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r1, r5, 0 - bl StartSpriteAnim - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08028AF0 - movs r0, 0x1 - bl sub_8028C30 - add sp, 0x30 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028A88 - - thumb_func_start sub_8028B80 -sub_8028B80: @ 8028B80 - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gUnknown_02022CB8 -_08028B86: - lsls r0, r5, 2 - adds r4, r0, r6 - ldr r0, [r4] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _08028BA0 - bl DestroySprite -_08028BA0: - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xA - bls _08028B86 - movs r5, 0 - ldr r6, =gUnknown_02022CE4 -_08028BB8: - lsls r0, r5, 2 - adds r4, r0, r6 - ldr r0, [r4] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _08028BD2 - bl DestroySprite -_08028BD2: - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08028BB8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028B80 - - thumb_func_start sub_8028BF8 -sub_8028BF8: @ 8028BF8 - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =gSprites - ldr r2, =gUnknown_02022CB8 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - adds r2, 0x3E - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - bx lr - .pool - thumb_func_end sub_8028BF8 - - thumb_func_start sub_8028C30 -sub_8028C30: @ 8028C30 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r7, =gSprites - ldr r6, =gUnknown_02022CE4 - movs r1, 0x1 - ands r0, r1 - lsls r4, r0, 2 - movs r5, 0x5 - negs r5, r5 -_08028C46: - lsls r0, r3, 2 - adds r0, r6 - ldr r0, [r0] - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r5, 0 - ands r0, r2 - orrs r0, r4 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _08028C46 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028C30 - - thumb_func_start sub_8028C7C -sub_8028C7C: @ 8028C7C - lsls r0, 24 - lsls r1, 24 - ldr r3, =gSprites - ldr r2, =gUnknown_02022CB8 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ldrh r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - lsrs r1, 21 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end sub_8028C7C - - thumb_func_start sub_8028CA4 -sub_8028CA4: @ 8028CA4 - push {lr} - lsls r0, 16 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_02022CB8 - lsrs r0, 14 - adds r0, r2 - ldr r0, [r0] - ldrh r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r2, =gSprites - adds r0, r2 - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028CA4 - - thumb_func_start sub_8028CD0 -sub_8028CD0: @ 8028CD0 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r1 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, 0x32 - strh r1, [r2, 0x20] - movs r0, 0x32 - strh r0, [r2, 0x22] - bx lr - .pool - thumb_func_end sub_8028CD0 - - thumb_func_start sub_8028CF4 -sub_8028CF4: @ 8028CF4 - push {r4-r7,lr} - adds r4, r0, 0 - adds r0, 0x42 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - beq _08028D36 - movs r3, 0 - ldr r7, =gUnknown_082FB354 - ldr r6, =gUnknown_02022CB0 - movs r5, 0 -_08028D0A: - lsls r0, r3, 2 - adds r2, r0, r6 - ldr r1, [r2] - ldrh r0, [r1, 0x2] - adds r0, 0x1 - strh r0, [r1, 0x2] - adds r1, r3, r7 - lsls r0, 16 - lsrs r0, 16 - ldrb r1, [r1] - cmp r0, r1 - bls _08028D2C - ldrh r0, [r4, 0x20] - subs r0, 0x1 - strh r0, [r4, 0x20] - ldr r0, [r2] - strh r5, [r0, 0x2] -_08028D2C: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _08028D0A -_08028D36: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028CF4 - - thumb_func_start sub_8028D44 -sub_8028D44: @ 8028D44 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x28 - movs r4, 0x80 - lsls r4, 3 - adds r0, r4, 0 - bl AllocZeroed - adds r6, r0, 0 - ldr r0, =gUnknown_082FB360 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x20] - str r1, [sp, 0x24] - ldr r0, =gDodrioBerryPlatformGfx - adds r1, r6, 0 - bl LZ77UnCompWram - cmp r6, 0 - beq _08028DD2 - str r6, [sp, 0x18] - add r0, sp, 0x18 - movs r1, 0xA0 - lsls r1, 11 - orrs r1, r4 - str r1, [r0, 0x4] - mov r2, sp - ldr r1, =gUnknown_082FB368 - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - bl LoadSpriteSheet - add r0, sp, 0x20 - bl LoadSpritePalette - movs r5, 0 - ldr r7, =gUnknown_082FB356 - adds r0, r7, 0x2 - mov r9, r0 - ldr r1, =gUnknown_02022CB0 - mov r8, r1 -_08028D9E: - movs r0, 0x4 - bl AllocZeroed - lsls r2, r5, 2 - mov r3, r8 - adds r4, r2, r3 - str r0, [r4] - adds r0, r2, r7 - movs r3, 0 - ldrsh r1, [r0, r3] - add r2, r9 - movs r0, 0 - ldrsh r2, [r2, r0] - mov r0, sp - movs r3, 0x4 - bl CreateSprite - ldr r1, [r4] - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x1 - bls _08028D9E -_08028DD2: - adds r0, r6, 0 - bl Free - add sp, 0x28 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028D44 - - thumb_func_start sub_8028DFC -sub_8028DFC: @ 8028DFC - push {r4-r7,lr} - movs r3, 0 - ldr r0, =gUnknown_02022CB0 - mov r12, r0 - ldr r4, =gUnknown_082FB356 - adds r7, r4, 0x2 - ldr r6, =gSprites - movs r5, 0x1 -_08028E0C: - lsls r2, r3, 2 - mov r1, r12 - adds r0, r2, r1 - ldr r0, [r0] - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r0, r1, 0 - adds r0, 0x42 - strh r5, [r0] - adds r0, r2, r4 - ldrh r0, [r0] - strh r0, [r1, 0x20] - adds r2, r7 - ldrh r0, [r2] - strh r0, [r1, 0x22] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _08028E0C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028DFC - - thumb_func_start sub_8028E4C -sub_8028E4C: @ 8028E4C - push {r4,r5,lr} - movs r2, 0 - ldr r5, =gUnknown_02022CB0 - ldr r4, =gSprites - movs r3, 0 -_08028E56: - lsls r0, r2, 2 - adds r0, r5 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x42 - strh r3, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1 - bls _08028E56 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028E4C - - thumb_func_start sub_8028E84 -sub_8028E84: @ 8028E84 - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gUnknown_02022CB0 -_08028E8A: - lsls r0, r5, 2 - adds r4, r0, r6 - ldr r0, [r4] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _08028EA4 - bl DestroySprite -_08028EA4: - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x1 - bls _08028E8A - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028E84 - - thumb_func_start sub_8028EC8 -sub_8028EC8: @ 8028EC8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r7, =gSprites - ldr r6, =gUnknown_02022CB0 - movs r1, 0x1 - ands r0, r1 - lsls r4, r0, 2 - movs r5, 0x5 - negs r5, r5 -_08028EDE: - lsls r0, r3, 2 - adds r0, r6 - ldr r0, [r0] - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r5, 0 - ands r0, r2 - orrs r0, r4 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _08028EDE - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028EC8 - - thumb_func_start sub_8028F14 -sub_8028F14: @ 8028F14 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r3, 0 - subs r0, r1, 0x1 - cmp r0, 0x4 - bhi _08028FC6 - lsls r0, 2 - ldr r1, =_08028F34 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08028F34: - .4byte _08028FB4 - .4byte _08028F48 - .4byte _08028F52 - .4byte _08028F66 - .4byte _08028F8E -_08028F48: - cmp r2, 0 - beq _08028F7E - cmp r2, 0x1 - bne _08028FC6 - b _08028F82 -_08028F52: - cmp r2, 0x1 - beq _08028FB8 - cmp r2, 0x1 - bgt _08028F60 - cmp r2, 0 - beq _08028FB4 - b _08028FC6 -_08028F60: - cmp r2, 0x2 - bne _08028FC6 - b _08028FC4 -_08028F66: - cmp r2, 0x1 - beq _08028F82 - cmp r2, 0x1 - bgt _08028F74 - cmp r2, 0 - beq _08028F7E - b _08028FC6 -_08028F74: - cmp r2, 0x2 - beq _08028F86 - cmp r2, 0x3 - beq _08028F8A - b _08028FC6 -_08028F7E: - movs r3, 0xC - b _08028FC6 -_08028F82: - movs r3, 0x12 - b _08028FC6 -_08028F86: - movs r3, 0x18 - b _08028FC6 -_08028F8A: - movs r3, 0x6 - b _08028FC6 -_08028F8E: - cmp r2, 0x4 - bhi _08028FC6 - lsls r0, r2, 2 - ldr r1, =_08028FA0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08028FA0: - .4byte _08028FB4 - .4byte _08028FB8 - .4byte _08028FBC - .4byte _08028FC0 - .4byte _08028FC4 -_08028FB4: - movs r3, 0xF - b _08028FC6 -_08028FB8: - movs r3, 0x15 - b _08028FC6 -_08028FBC: - movs r3, 0x1B - b _08028FC6 -_08028FC0: - movs r3, 0x3 - b _08028FC6 -_08028FC4: - movs r3, 0x9 -_08028FC6: - lsls r0, r3, 3 - pop {r1} - bx r1 - thumb_func_end sub_8028F14 - - thumb_func_start sub_8028FCC -sub_8028FCC: @ 8028FCC - push {r4,lr} - movs r4, 0 -_08028FD0: - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8028BF8 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8028C7C - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xA - bls _08028FD0 - movs r0, 0 - bl sub_80289E8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8028FCC - - thumb_func_start sub_8028FF8 -sub_8028FF8: @ 8028FF8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_8098758 - ldr r1, [r0] - movs r2, 0x90 - lsls r2, 1 - movs r0, 0 - movs r3, 0x1 - bl LoadBgTiles - adds r0, r4, 0 - bl sub_8098758 - ldr r0, [r0, 0x4] - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8028FF8 - - thumb_func_start sub_802902C -sub_802902C: @ 802902C - push {lr} - movs r0, 0 - movs r1, 0xA - movs r2, 0xB0 - bl box_border_load_tiles_and_pal - pop {r0} - bx r0 - thumb_func_end sub_802902C - - thumb_func_start sub_802903C -sub_802903C: @ 802903C - ldr r3, =gUnknown_02022CF8 - ldr r0, [r3] - movs r2, 0xC0 - lsls r2, 6 - adds r1, r0, r2 - movs r2, 0 - str r2, [r1] - ldr r1, =0x00003014 - adds r0, r1 - strb r2, [r0] - ldr r0, [r3] - adds r1, 0x4 - adds r0, r1 - strb r2, [r0] - ldr r0, [r3] - adds r1, 0x8 - adds r0, r1 - strb r2, [r0] - ldr r0, [r3] - adds r1, 0x4 - adds r0, r1 - strb r2, [r0] - bx lr - .pool - thumb_func_end sub_802903C - - thumb_func_start sub_8029074 -sub_8029074: @ 8029074 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r6, 0xA - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r5, 0x1 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x3] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x2 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x3 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - str r5, [sp] - ldrb r0, [r4, 0x4] - str r0, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x4 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - str r5, [sp] - ldrb r0, [r4, 0x4] - str r0, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x6 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x4] - ldrb r0, [r4, 0x2] - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x7 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - ldrb r3, [r4, 0x4] - ldrb r0, [r4, 0x2] - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x3] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x8 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x4] - ldrb r4, [r4, 0x2] - adds r3, r4 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x9 - bl FillBgTilemapBufferRect - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8029074 - - thumb_func_start sub_8029174 -sub_8029174: @ 8029174 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r6, 0xB - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r5, 0x1 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xA - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x3] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xB - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xC - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - str r5, [sp] - ldrb r0, [r4, 0x4] - str r0, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xD - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - str r5, [sp] - ldrb r0, [r4, 0x4] - str r0, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xF - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x4] - ldrb r0, [r4, 0x2] - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x10 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - ldrb r3, [r4, 0x4] - ldrb r0, [r4, 0x2] - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x3] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x11 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x4] - ldrb r4, [r4, 0x2] - adds r3, r4 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x12 - bl FillBgTilemapBufferRect - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8029174 - - thumb_func_start sub_8029274 -sub_8029274: @ 8029274 - push {r4,lr} - ldr r4, =gUnknown_02022CF8 - str r0, [r4] - movs r2, 0xC0 - lsls r2, 6 - adds r1, r0, r2 - movs r2, 0 - str r2, [r1] - ldr r3, =0x00003014 - adds r1, r0, r3 - strb r2, [r1] - ldr r1, =0x00003018 - adds r0, r1 - strb r2, [r0] - ldr r0, [r4] - adds r3, 0xC - adds r0, r3 - strb r2, [r0] - ldr r0, [r4] - adds r1, 0xC - adds r0, r1 - strb r2, [r0] - ldr r0, =sub_8029314 - movs r1, 0x3 - bl CreateTask - ldr r1, [r4] - ldr r2, =0x00003004 - adds r1, r2 - strb r0, [r1] - ldr r0, =sub_8029338 - bl sub_802A72C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8029274 - - thumb_func_start sub_80292D4 -sub_80292D4: @ 80292D4 - push {lr} - bl FreeAllWindowBuffers - pop {r0} - bx r0 - thumb_func_end sub_80292D4 - - thumb_func_start sub_80292E0 -sub_80292E0: @ 80292E0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r4, 0 - ldr r5, =gUnknown_082FB40C - adds r7, r5, 0x4 -_080292EC: - lsls r1, r4, 3 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, r6 - bne _080292FE - adds r0, r1, r7 - ldr r0, [r0] - bl sub_802A72C -_080292FE: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _080292EC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80292E0 - - thumb_func_start sub_8029314 -sub_8029314: @ 8029314 - push {lr} - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - bne _0802932E - bl sub_802A75C - bl _call_via_r0 -_0802932E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8029314 - - thumb_func_start sub_8029338 -sub_8029338: @ 8029338 - push {lr} - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r2, =0x00003014 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x4 - bhi _08029430 - lsls r0, 2 - ldr r1, =_08029360 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08029360: - .4byte _08029374 - .4byte _0802937A - .4byte _08029394 - .4byte _080293D8 - .4byte _08029404 -_08029374: - bl sub_802A7A8 - b _08029414 -_0802937A: - bl sub_802A8E8 - cmp r0, 0x1 - bne _0802943A - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r2, =0x00003014 - adds r1, r2 - b _0802941C - .pool -_08029394: - ldr r1, =gDodrioBerryBgTilemap1 - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gDodrioBerryBgTilemap2Left - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gDodrioBerryBgTilemap2Right - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _08029414 - .pool -_080293D8: - movs r0, 0 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r2, =0x00003014 - adds r1, r2 - b _0802941C - .pool -_08029404: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x14] - lsrs r0, 3 - bl sub_8028FF8 - bl sub_802902C -_08029414: - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 -_0802941C: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802943A - .pool -_08029430: - movs r2, 0xC0 - lsls r2, 6 - adds r1, r2 - movs r0, 0x1 - str r0, [r1] -_0802943A: - pop {r0} - bx r0 - thumb_func_end sub_8029338 - - thumb_func_start sub_8029440 -sub_8029440: @ 8029440 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r2, =0x00003014 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _08029488 - cmp r0, 0x1 - bne _08029460 - b _080295EC -_08029460: - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xB4 - bhi _0802946E - b _0802968E -_0802946E: - bl sub_8027650 - lsls r0, 24 - lsrs r7, r0, 24 - movs r6, 0 - cmp r6, r7 - bcc _0802947E - b _08029666 -_0802947E: - b _08029640 - .pool -_08029488: - bl sub_8027650 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gUnknown_082FB3C8 - subs r0, r7, 0x1 - lsls r0, 2 - adds r0, r1 - ldr r5, [r0] - ldr r2, =0xffffff00 - ldr r0, [sp, 0xC] - ands r0, r2 - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0xE0 - lsls r1, 19 - orrs r0, r1 - str r0, [sp, 0xC] - ldr r0, [sp, 0x10] - ands r0, r2 - movs r1, 0x2 - orrs r0, r1 - ldr r1, =0xffff00ff - ands r0, r1 - movs r1, 0xD0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0x98 - lsls r1, 13 - orrs r0, r1 - str r0, [sp, 0x10] - movs r6, 0 - cmp r6, r7 - bcs _080295B8 - mov r3, sp - adds r3, 0xC - str r3, [sp, 0x18] - mov r10, r4 - ldr r0, =0x00003008 - mov r9, r0 -_080294DC: - movs r1, 0 - mov r8, r1 - adds r0, r6, 0 - bl sub_8027A48 - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - bl sub_8027660 - adds r1, r0, 0 - movs r0, 0x1 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - movs r1, 0x38 - subs r1, r0 - lsrs r1, 1 - str r1, [sp, 0x14] - ldrb r0, [r5] - lsls r0, 8 - ldr r2, =0xffff00ff - ldr r1, [sp, 0xC] - ands r1, r2 - orrs r1, r0 - str r1, [sp, 0xC] - ldrb r2, [r5, 0x1] - lsls r2, 16 - ldr r0, =0xff00ffff - ands r0, r1 - orrs r0, r2 - str r0, [sp, 0xC] - add r0, sp, 0xC - bl AddWindow - mov r2, r10 - ldr r1, [r2] - add r1, r9 - adds r1, r6 - strb r0, [r1] - ldr r0, [r2] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - bl ClearWindowTilemap - mov r3, r10 - ldr r0, [r3] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _0802955A - movs r0, 0x2 - mov r8, r0 -_0802955A: - adds r0, r4, 0 - bl sub_8027660 - adds r4, r0, 0 - mov r1, r10 - ldr r0, [r1] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - ldr r3, [sp, 0x14] - lsls r2, r3, 24 - lsrs r2, 24 - mov r3, r8 - lsls r1, r3, 1 - add r1, r8 - ldr r3, =gUnknown_082FB380 - adds r1, r3 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x1 - bl box_print - mov r2, r10 - ldr r0, [r2] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r3, [sp, 0x18] - ldrh r0, [r3, 0x6] - adds r0, 0xE - strh r0, [r3, 0x6] - add r0, sp, 0xC - bl sub_8029174 - adds r5, 0x4 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r7 - bcc _080294DC -_080295B8: - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _0802962A - .pool -_080295EC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802968E - bl sub_8027650 - lsls r0, 24 - lsrs r7, r0, 24 - movs r6, 0 - cmp r6, r7 - bcs _0802961C -_08029604: - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - adds r0, r6 - ldrb r0, [r0] - bl PutWindowTilemap - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r7 - bcc _08029604 -_0802961C: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r2, =0x00003014 - adds r1, r2 -_0802962A: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802968E - .pool -_08029640: - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r4, =0x00003008 - adds r0, r4 - adds r0, r6 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r5] - adds r0, r4 - adds r0, r6 - ldrb r0, [r0] - bl RemoveWindow - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r7 - bcc _08029640 -_08029666: - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r3, 0xC0 - lsls r3, 6 - adds r0, r3 - movs r1, 0x1 - str r1, [r0] -_0802968E: - 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_8029440 - - thumb_func_start sub_80296A8 -sub_80296A8: @ 80296A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x6C - lsls r0, 24 - movs r1, 0 - mov r8, r1 - movs r6, 0 - lsrs r7, r0, 24 - add r4, sp, 0x2C - ldr r1, =gUnknown_082FB45C - adds r0, r4, 0 - movs r2, 0x5 - bl memcpy - movs r5, 0 - cmp r5, r7 - bcs _080296F8 - add r4, sp, 0x34 -_080296D2: - mov r0, sp - adds r0, r5 - adds r0, 0x2C - strb r5, [r0] - add r0, sp, 0x5C - adds r1, r5, 0 - bl sub_802793C - lsls r2, r5, 3 - adds r2, r4, r2 - ldr r0, [sp, 0x5C] - ldr r1, [sp, 0x60] - str r0, [r2] - str r1, [r2, 0x4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _080296D2 -_080296F8: - bl sub_8027748 - cmp r0, 0 - beq _0802972E -_08029700: - movs r5, 0 - cmp r5, r7 - bcs _08029728 - add r2, sp, 0x34 - add r1, sp, 0x2C -_0802970A: - lsls r0, r5, 3 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r0, r8 - bne _0802971E - adds r0, r1, r6 - strb r5, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0802971E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _0802970A -_08029728: - mov r8, r6 - cmp r6, r7 - bcc _08029700 -_0802972E: - movs r5, 0 - ldr r4, =gText_SpacePoints - cmp r5, r7 - bcs _08029754 - add r1, sp, 0x34 - add r6, sp, 0x38 - subs r3, r7, 0x1 -_0802973C: - lsls r2, r5, 3 - adds r0, r6, r2 - ldr r0, [r0] - cmp r0, 0 - bne _0802974A - adds r0, r1, r2 - strb r3, [r0] -_0802974A: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _0802973C -_08029754: - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - movs r1, 0xD8 - subs r1, r0 - str r1, [sp, 0x64] - movs r5, 0 - cmp r5, r7 - bcs _08029860 - mov r2, sp - adds r2, 0x34 - str r2, [sp, 0x68] - ldr r3, =0x00003009 - mov r10, r3 -_08029774: - movs r0, 0 - mov r8, r0 - mov r0, sp - adds r0, r5 - adds r0, 0x2C - ldrb r0, [r0] - adds r4, r0, 0 - lsls r1, r4, 3 - add r0, sp, 0x38 - adds r0, r1 - ldr r0, [r0] - mov r9, r0 - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gUnknown_082FB3DC - ldr r3, [sp, 0x68] - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 2 - adds r1, r2 - ldr r2, [r1] - ldr r3, =gUnknown_082FB402 - lsls r1, r5, 1 - adds r1, r3 - ldrb r6, [r1] - str r6, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - mov r3, r8 - str r3, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080297CC - movs r0, 0x2 - mov r8, r0 -_080297CC: - adds r0, r4, 0 - bl sub_8027660 - adds r3, r0, 0 - ldr r1, =gUnknown_02022CF8 - ldr r0, [r1] - add r0, r10 - ldrb r0, [r0] - mov r2, r8 - lsls r1, r2, 1 - add r1, r8 - ldr r2, =gUnknown_082FB380 - adds r1, r2 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - str r3, [sp, 0x8] - movs r1, 0x1 - movs r2, 0x1C - adds r3, r6, 0 - bl box_print - add r0, sp, 0xC - mov r1, r9 - movs r2, 0 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - adds r3, r0, 0 - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r1, [sp, 0x64] - subs r3, r1, r3 - lsls r3, 24 - lsrs r3, 24 - str r6, [sp] - movs r2, 0xFF - str r2, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - bl PrintTextOnWindow - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r1, [sp, 0x64] - lsls r3, r1, 24 - str r6, [sp] - movs r2, 0xFF - str r2, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - ldr r2, =gText_SpacePoints - lsrs r3, 24 - bl PrintTextOnWindow - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _08029774 -_08029860: - add sp, 0x6C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80296A8 - - thumb_func_start sub_802988C -sub_802988C: @ 802988C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - bl sub_8027650 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] - ldr r6, =gUnknown_02022CF8 - ldr r1, [r6] - ldr r2, =0x00003014 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xB - bls _080298B2 - b _08029FA8 -_080298B2: - lsls r0, 2 - ldr r1, =_080298C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080298C8: - .4byte _080298F8 - .4byte _08029914 - .4byte _0802996C - .4byte _08029B6C - .4byte _08029BB8 - .4byte _08029BFC - .4byte _08029C60 - .4byte _08029C9C - .4byte _08029CE0 - .4byte _08029DA0 - .4byte _08029F08 - .4byte _08029F5C -_080298F8: - bl sub_802784C - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x0000301c - adds r2, r1, r0 - movs r0, 0 - strh r0, [r2] - b _08029F8A - .pool -_08029914: - ldr r6, =gUnknown_082F7BBC - adds r0, r6, 0 - bl AddWindow - ldr r4, =gUnknown_02022CF8 - ldr r1, [r4] - ldr r2, =0x00003008 - mov r8, r2 - add r1, r8 - strb r0, [r1] - movs r0, 0x8 - adds r0, r6 - mov r9, r0 - bl AddWindow - ldr r1, [r4] - ldr r5, =0x00003009 - adds r1, r5 - strb r0, [r1] - ldr r0, [r4] - add r0, r8 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r6, 0 - bl sub_8029174 - mov r0, r9 - bl sub_8029174 - b _08029F88 - .pool -_0802996C: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r5, =0x00003008 - adds r0, r5 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - mov r9, r1 - add r0, r9 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gText_BerryPickingResults - mov r8, r2 - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - mov r1, r8 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r6, 0xFF - str r6, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - mov r2, r8 - bl PrintTextOnWindow - ldr r0, [r4] - add r0, r9 - ldrb r0, [r0] - ldr r2, =gText_10P30P50P50P - movs r1, 0x11 - str r1, [sp] - str r6, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x44 - bl PrintTextOnWindow - mov r9, r5 - ldr r0, [sp, 0xC] - cmp r9, r0 - bcc _080299E2 - b _08029B2A -_080299E2: - movs r4, 0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r9, r0 - bne _080299F2 - movs r4, 0x2 -_080299F2: - mov r0, r9 - bl sub_8027660 - adds r6, r0, 0 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - mov r2, r9 - lsls r5, r2, 1 - ldr r2, =gUnknown_082FB3F8 - adds r1, r5, r2 - ldrb r3, [r1] - lsls r1, r4, 1 - adds r1, r4 - ldr r2, =gUnknown_082FB380 - adds r1, r2 - str r1, [sp] - movs r4, 0x1 - negs r4, r4 - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r1, 0x1 - movs r2, 0 - bl box_print - movs r7, 0 - mov r8, r5 - mov r0, r9 - adds r0, 0x1 - str r0, [sp, 0x10] - ldr r1, =gStringVar4 - mov r10, r1 -_08029A36: - mov r0, r9 - adds r1, r7, 0 - bl sub_80276A0 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =0x0000270f - bl sub_8027A38 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r7, 0 - bl sub_802778C - ldr r1, =0x0000270f - bl sub_8027A38 - lsls r0, 16 - lsrs r6, r0, 16 - mov r0, r10 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - mov r1, r10 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - adds r5, r0, 0 - cmp r6, r4 - bne _08029AE0 - cmp r6, 0 - beq _08029AE0 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - lsls r1, r7, 1 - ldr r2, =gUnknown_082FB3F0 - adds r1, r2 - ldrb r2, [r1] - subs r2, r5 - lsls r2, 24 - lsrs r2, 24 - ldr r1, =gUnknown_082FB3F8 - add r1, r8 - ldrb r3, [r1] - ldr r1, =gUnknown_082FB383 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - movs r1, 0x1 - bl box_print - b _08029B10 - .pool -_08029AE0: - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - lsls r1, r7, 1 - ldr r2, =gUnknown_082FB3F0 - adds r1, r2 - ldrb r3, [r1] - subs r3, r5 - lsls r3, 24 - lsrs r3, 24 - ldr r1, =gUnknown_082FB3F8 - add r1, r8 - ldrb r1, [r1] - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - ldr r2, =gStringVar4 - bl PrintTextOnWindow -_08029B10: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x3 - bls _08029A36 - ldr r1, [sp, 0x10] - lsls r0, r1, 24 - lsrs r0, 24 - mov r9, r0 - ldr r2, [sp, 0xC] - cmp r9, r2 - bcs _08029B2A - b _080299E2 -_08029B2A: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029B6C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029B90 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029B90: - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl sub_8028C30 - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029BB8: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bhi _08029BD0 - b _08029FF8 -_08029BD0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08029BDE - b _08029FF8 -_08029BDE: - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - bl sub_8028C30 - b _08029F88 - .pool -_08029BFC: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r5, =0x00003008 - adds r0, r5 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r6, =gText_AnnouncingRankings - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - adds r1, r6, 0 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r6, 0 - bl PrintTextOnWindow - b _08029F88 - .pool -_08029C60: - ldr r0, [sp, 0xC] - bl sub_80296A8 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029C9C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029CC0 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029CC0: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029CE0: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bhi _08029CF8 - b _08029FF8 -_08029CF8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08029D06 - b _08029FF8 -_08029D06: - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE - bl sub_8027748 - ldr r1, =0x00000bb7 - cmp r0, r1 - bhi _08029D3C - ldr r0, [r4] - ldr r2, =0x00003014 - adds r0, r2 - movs r1, 0x7F - strb r1, [r0] - b _08029D4C - .pool -_08029D3C: - bl StopMapMusic - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08029D4C: - movs r0, 0x1E - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x5 - bl FillBgTilemapBufferRect_Palette0 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r4, =0x00003009 - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - ldr r6, =gUnknown_082F7BCC - adds r0, r6, 0 - bl AddWindow - ldr r1, [r5] - adds r1, r4 - strb r0, [r1] - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r6, 0 - bl sub_8029174 - b _08029FF8 - .pool -_08029DA0: - ldr r0, =0x0000016f - bl PlayNewMapMusic - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r6, =0x00003008 - adds r0, r6 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - mov r10, r1 - add r0, r10 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r5, =gText_AnnouncingPrizes - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - adds r1, r5, 0 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r6 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r2, 0x1 - mov r9, r2 - str r2, [sp] - movs r1, 0xFF - mov r8, r1 - str r1, [sp, 0x4] - movs r6, 0 - str r6, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - bl PrintTextOnWindow - bl sub_81AFBF0 - bl sub_802762C - lsls r0, 16 - lsrs r0, 16 - ldr r5, =gStringVar1 - adds r1, r5, 0 - bl CopyItemName - movs r0, 0 - adds r1, r5, 0 - bl sub_81AFC0C - ldr r7, =gStringVar4 - ldr r1, =gText_FirstPlacePrize - adds r0, r7, 0 - bl sub_81AFC28 - ldr r0, [r4] - add r0, r10 - ldrb r0, [r0] - mov r2, r9 - str r2, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - movs r1, 0x1 - adds r2, r7, 0 - movs r3, 0 - bl PrintTextOnWindow - bl sub_80279C8 - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - cmp r4, 0 - beq _08029EC8 - cmp r4, 0x3 - beq _08029EC8 - bl sub_81AFBF0 - bl sub_802762C - lsls r0, 16 - lsrs r0, 16 - adds r1, r5, 0 - bl CopyItemName - movs r0, 0 - adds r1, r5, 0 - bl sub_81AFC0C - cmp r4, 0x2 - bne _08029E9C - ldr r1, =gText_CantHoldAnyMore - adds r0, r7, 0 - bl sub_81AFC28 - b _08029EA8 - .pool -_08029E9C: - cmp r6, 0x1 - bne _08029EA8 - ldr r1, =gText_FilledStorageSpace - adds r0, r7, 0 - bl sub_81AFC28 -_08029EA8: - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - ldr r2, =gStringVar4 - movs r1, 0x29 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow -_08029EC8: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029F08: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029F2C - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029F2C: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =0x0000020b - movs r1, 0x14 - movs r2, 0xA - bl FadeOutAndFadeInNewMapMusic - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029F5C: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bls _08029FF8 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08029FF8 - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE -_08029F88: - ldr r1, [r4] -_08029F8A: - ldr r2, =0x00003014 - adds r1, r2 -_08029F8E: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08029FF8 - .pool -_08029FA8: - ldr r5, =0x00003008 - adds r0, r1, r5 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - ldr r4, =0x00003009 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r6] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_08029FF8: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802988C - - thumb_func_start sub_802A010 -sub_802A010: @ 802A010 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r1, =gUnknown_02022CF8 - ldr r2, [r1] - ldr r3, =0x00003014 - adds r0, r2, r3 - ldrb r6, [r0] - adds r7, r1, 0 - cmp r6, 0x1 - beq _0802A0CC - cmp r6, 0x1 - bgt _0802A040 - cmp r6, 0 - beq _0802A04E - b _0802A2FC - .pool -_0802A040: - cmp r6, 0x2 - bne _0802A046 - b _0802A194 -_0802A046: - cmp r6, 0x3 - bne _0802A04C - b _0802A1D0 -_0802A04C: - b _0802A2FC -_0802A04E: - ldr r0, =gUnknown_082F7BD4 - mov r9, r0 - bl AddWindow - ldr r1, [r7] - ldr r4, =0x00003008 - adds r1, r4 - strb r0, [r1] - movs r1, 0x8 - add r1, r9 - mov r8, r1 - mov r0, r8 - bl AddWindow - ldr r1, [r7] - ldr r2, =0x00003009 - adds r1, r2 - strb r0, [r1] - ldr r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - ldr r3, =0x00003009 - adds r0, r3 - ldrb r0, [r0] - bl ClearWindowTilemap - mov r0, r9 - bl sub_8029174 - mov r0, r8 - bl sub_8029074 - ldr r1, [r7] - ldr r0, =0x00003014 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r7] - ldr r1, =0x00003020 - adds r0, r1 - strb r6, [r0] - ldr r0, [r7] - ldr r2, =0x00003024 - adds r0, r2 - strb r6, [r0] - b _0802A35E - .pool -_0802A0CC: - ldr r3, =0x00003008 - mov r8, r3 - adds r0, r2, r3 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - ldr r1, =0x00003009 - mov r10, r1 - add r0, r10 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_WantToPlayAgain - movs r1, 0x5 - str r1, [sp] - movs r3, 0xFF - mov r9, r3 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_Yes - str r6, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_No - movs r1, 0x11 - str r1, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_SelectorArrow2 - str r6, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r7] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A2EA - .pool -_0802A194: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A1B6 - ldr r0, [r7] - ldr r3, =0x00003008 - adds r0, r3 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r7] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A1B6: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r7] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A2EA - .pool -_0802A1D0: - ldr r3, =0x00003020 - adds r0, r2, r3 - ldrb r5, [r0] - cmp r5, 0 - bne _0802A1DC - movs r5, 0x1 -_0802A1DC: - ldr r0, =0x00003009 - mov r8, r0 - adds r0, r2, r0 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_Yes - movs r1, 0x1 - str r1, [sp] - movs r3, 0xFF - mov r10, r3 - str r3, [sp, 0x4] - movs r1, 0 - mov r9, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_No - movs r1, 0x11 - str r1, [sp] - mov r3, r10 - str r3, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_SelectorArrow2 - subs r1, r5, 0x1 - lsls r1, 4 - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp] - mov r3, r10 - str r3, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r5, 0x1 - movs r2, 0x1 - ands r2, r1 - cmp r2, 0 - beq _0802A294 - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r3, =0x00003020 - adds r1, r0, r3 - ldrb r0, [r1] - cmp r0, 0 - bne _0802A2E4 - strb r5, [r1] - b _0802A2E4 - .pool -_0802A294: - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0 - beq _0802A2CC - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r2, =0x00003020 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0x1 - beq _0802A2C2 - cmp r0, 0x1 - bgt _0802A2BC - cmp r0, 0 - beq _0802A2C2 - b _0802A35E - .pool -_0802A2BC: - cmp r0, 0x2 - beq _0802A2C8 - b _0802A35E -_0802A2C2: - movs r0, 0x2 - strb r0, [r1] - b _0802A35E -_0802A2C8: - strb r5, [r1] - b _0802A35E -_0802A2CC: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0802A35E - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r3, =0x00003020 - adds r0, r3 - movs r1, 0x2 - strb r1, [r0] -_0802A2E4: - ldr r1, [r7] - ldr r0, =0x00003014 - adds r1, r0 -_0802A2EA: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A35E - .pool -_0802A2FC: - ldr r0, [r7] - ldr r2, =0x00003020 - adds r1, r0, r2 - ldrb r1, [r1] - ldr r3, =0x00003024 - adds r0, r3 - strb r1, [r0] - ldr r0, [r7] - ldr r6, =0x00003008 - adds r0, r6 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - adds r0, r6 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r7] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r7] - movs r3, 0xC0 - lsls r3, 6 - adds r0, r3 - movs r1, 0x1 - str r1, [r0] -_0802A35E: - 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_802A010 - - thumb_func_start sub_802A380 -sub_802A380: @ 802A380 - push {r4-r6,lr} - sub sp, 0x10 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r6, =0x00003014 - adds r0, r6 - ldrb r4, [r0] - cmp r4, 0x1 - beq _0802A3D8 - cmp r4, 0x1 - bgt _0802A3A4 - cmp r4, 0 - beq _0802A3AE - b _0802A420 - .pool -_0802A3A4: - cmp r4, 0x2 - beq _0802A3EC - cmp r4, 0x3 - beq _0802A404 - b _0802A420 -_0802A3AE: - movs r0, 0 - movs r1, 0 - bl sub_81973C4 - ldr r2, =gUnknown_082C8959 - str r4, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParametrized - b _0802A410 - .pool -_0802A3D8: - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, [r5] - ldr r0, =0x00003014 - adds r1, r0 - b _0802A414 - .pool -_0802A3EC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A448 - ldr r0, =sub_8153688 - movs r1, 0 - bl CreateTask - b _0802A410 - .pool -_0802A404: - ldr r0, =sub_8153688 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0802A448 -_0802A410: - ldr r1, [r5] - adds r1, r6 -_0802A414: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A448 - .pool -_0802A420: - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_0802A448: - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A380 - - thumb_func_start sub_802A454 -sub_802A454: @ 802A454 - push {r4-r6,lr} - sub sp, 0xC - ldr r1, =gUnknown_02022CF8 - ldr r2, [r1] - ldr r6, =0x00003014 - adds r0, r2, r6 - ldrb r0, [r0] - adds r5, r1, 0 - cmp r0, 0x1 - beq _0802A4AC - cmp r0, 0x1 - bgt _0802A47C - cmp r0, 0 - beq _0802A482 - b _0802A520 - .pool -_0802A47C: - cmp r0, 0x2 - beq _0802A4F4 - b _0802A520 -_0802A482: - ldr r4, =gUnknown_082F7BEC - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - ldr r2, =0x00003008 - adds r1, r2 - strb r0, [r1] - ldr r0, [r5] - adds r0, r2 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r4, 0 - bl sub_8029174 - b _0802A510 - .pool -_0802A4AC: - ldr r4, =0x00003008 - adds r0, r2, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - ldr r2, =gText_CommunicationStandby3 - movs r1, 0x5 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r5] - ldr r0, =0x00003014 - adds r1, r0 - b _0802A514 - .pool -_0802A4F4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A50A - ldr r0, [r5] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A50A: - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802A510: - ldr r1, [r5] - adds r1, r6 -_0802A514: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A52C - .pool -_0802A520: - ldr r0, [r5] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_0802A52C: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802A454 - - thumb_func_start sub_802A534 -sub_802A534: @ 802A534 - push {r4,r5,lr} - sub sp, 0x8 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r4, =0x00003008 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r5] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A534 - - thumb_func_start sub_802A588 -sub_802A588: @ 802A588 - push {r4-r7,lr} - sub sp, 0xC - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r7, =0x00003014 - adds r2, r1, r7 - ldrb r5, [r2] - adds r6, r0, 0 - cmp r5, 0x1 - beq _0802A610 - cmp r5, 0x1 - bgt _0802A5B0 - cmp r5, 0 - beq _0802A5BA - b _0802A6A4 - .pool -_0802A5B0: - cmp r5, 0x2 - beq _0802A658 - cmp r5, 0x3 - beq _0802A684 - b _0802A6A4 -_0802A5BA: - ldr r4, =gUnknown_082F7BE4 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r6] - ldr r2, =0x00003008 - adds r1, r2 - strb r0, [r1] - ldr r0, [r6] - adds r0, r2 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r4, 0 - bl sub_8029174 - ldr r1, [r6] - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r6] - ldr r2, =0x0000301c - adds r1, r0, r2 - movs r2, 0 - strh r5, [r1] - ldr r1, =0x00003020 - adds r0, r1 - strb r2, [r0] - ldr r0, [r6] - adds r1, 0x4 - adds r0, r1 - strb r2, [r0] - b _0802A6EA - .pool -_0802A610: - ldr r4, =0x00003008 - adds r0, r1, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - ldr r2, =gText_SomeoneDroppedOut - movs r1, 0x5 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r6] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A678 - .pool -_0802A658: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A66E - ldr r0, [r6] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A66E: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r6] - adds r1, r7 -_0802A678: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A6EA - .pool -_0802A684: - ldr r0, =0x0000301c - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x77 - bls _0802A6EA - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - b _0802A6EA - .pool -_0802A6A4: - ldr r0, [r6] - ldr r1, =0x00003024 - adds r0, r1 - movs r1, 0x5 - strb r1, [r0] - ldr r0, [r6] - ldr r4, =0x00003008 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r6] - movs r2, 0xC0 - lsls r2, 6 - adds r0, r2 - movs r1, 0x1 - str r1, [r0] -_0802A6EA: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A588 - - thumb_func_start unused_0 -unused_0: @ 802A6FC - push {r4,lr} - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003004 - adds r0, r1 - ldrb r0, [r0] - bl DestroyTask - ldr r0, [r4] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end unused_0 - - thumb_func_start nullsub_16 -nullsub_16: @ 802A728 - bx lr - thumb_func_end nullsub_16 - - thumb_func_start sub_802A72C -sub_802A72C: @ 802A72C - push {r4,lr} - ldr r2, =gUnknown_02022CF8 - ldr r1, [r2] - ldr r3, =0x00003014 - adds r1, r3 - movs r3, 0 - strb r3, [r1] - ldr r1, [r2] - movs r4, 0xC0 - lsls r4, 6 - adds r2, r1, r4 - str r3, [r2] - ldr r2, =0x00003028 - adds r1, r2 - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A72C - - thumb_func_start sub_802A75C -sub_802A75C: @ 802A75C - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003028 - adds r0, r1 - ldr r0, [r0] - bx lr - .pool - thumb_func_end sub_802A75C - - thumb_func_start sub_802A770 -sub_802A770: @ 802A770 - push {lr} - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0x1 - beq _0802A78C - movs r0, 0x1 - b _0802A78E - .pool -_0802A78C: - movs r0, 0 -_0802A78E: - pop {r1} - bx r1 - thumb_func_end sub_802A770 - - thumb_func_start sub_802A794 -sub_802A794: @ 802A794 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003024 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_802A794 - - thumb_func_start sub_802A7A8 -sub_802A7A8: @ 802A7A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - movs r3, 0xC0 - lsls r3, 19 - movs r4, 0xC0 - lsls r4, 9 - add r0, sp, 0x4 - mov r8, r0 - mov r2, sp - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_0802A7CE: - strh r6, [r2] - mov r0, sp - str r0, [r1] - str r3, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r5 - subs r4, r5 - cmp r4, r5 - bhi _0802A7CE - strh r6, [r2] - mov r2, sp - str r2, [r1] - str r3, [r1, 0x4] - lsrs r0, r4, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0xE0 - lsls r0, 19 - movs r3, 0x80 - lsls r3, 3 - movs r4, 0 - str r4, [sp, 0x4] - ldr r2, =0x040000d4 - mov r1, r8 - str r1, [r2] - str r0, [r2, 0x4] - lsrs r0, r3, 2 - movs r1, 0x85 - lsls r1, 24 - orrs r0, r1 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xA0 - lsls r1, 19 - mov r0, sp - strh r4, [r0] - str r0, [r2] - str r1, [r2, 0x4] - lsrs r3, 1 - movs r0, 0x81 - lsls r0, 24 - orrs r3, r0 - str r3, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F7BA4 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - bl sub_81971D0 - bl sub_8197200 - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r4, =gUnknown_02022CF8 - ldr r1, [r4] - movs r0, 0x3 - bl SetBgTilemapBuffer - ldr r1, [r4] - movs r2, 0x80 - lsls r2, 5 - adds r1, r2 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - movs r0, 0x80 - lsls r0, 6 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A7A8 - - thumb_func_start sub_802A8E8 -sub_802A8E8: @ 802A8E8 - push {lr} - sub sp, 0x4 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003018 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0x5 - bhi _0802A982 - lsls r0, 2 - ldr r1, =_0802A910 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802A910: - .4byte _0802A928 - .4byte _0802A938 - .4byte _0802A93E - .4byte _0802A94C - .4byte _0802A964 - .4byte _0802A972 -_0802A928: - ldr r0, =gDodrioBerryBgPal1 - movs r1, 0 - movs r2, 0x40 - bl LoadPalette - b _0802A98A - .pool -_0802A938: - bl reset_temp_tile_data_buffers - b _0802A98A -_0802A93E: - ldr r1, =gDodrioBerryBgGfx1 - movs r0, 0 - str r0, [sp] - movs r0, 0x3 - b _0802A954 - .pool -_0802A94C: - ldr r1, =gDodrioBerryBgGfx2 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 -_0802A954: - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _0802A98A - .pool -_0802A964: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0802A98A - b _0802A998 -_0802A972: - movs r0, 0x3 - bl stdpal_get - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - b _0802A98A -_0802A982: - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _0802A99A -_0802A98A: - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003018 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0802A998: - movs r0, 0 -_0802A99A: - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802A8E8 - - thumb_func_start sub_802A9A8 -sub_802A9A8: @ 802A9A8 - push {r4-r7,lr} - adds r6, r1, 0 - lsls r0, 16 - lsrs r7, r0, 16 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0802AA3C - ldr r5, =gUnknown_02022CFC - ldr r0, =0x000083b0 - bl Alloc - str r0, [r5] - cmp r0, 0 - beq _0802AA3C - bl ResetTasks - ldr r0, =sub_802ACA0 - movs r1, 0x1 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, [r5] - movs r1, 0 - strh r1, [r0, 0x8] - str r6, [r0] - strb r4, [r0, 0x4] - bl GetMultiplayerId - ldr r1, [r5] - strb r0, [r1, 0x6] - ldr r0, [r5] - ldrb r2, [r0, 0x6] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - ldr r2, =0x000082a8 - adds r1, r2 - adds r0, r1 - movs r1, 0x64 - muls r1, r7 - ldr r2, =gPlayerParty - adds r1, r2 - bl sub_802AC2C - ldr r0, [r5] - bl sub_802AA60 - ldr r2, [r5] - adds r0, r4, 0 - movs r1, 0x2 - bl SetWordTaskArg - ldr r0, =sub_802AC6C - bl SetMainCallback2 - b _0802AA42 - .pool -_0802AA3C: - adds r0, r6, 0 - bl SetMainCallback2 -_0802AA42: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_802A9A8 - - thumb_func_start sub_802AA48 -sub_802AA48: @ 802AA48 - push {lr} - bl sub_802D0AC - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end sub_802AA48 - - thumb_func_start sub_802AA60 -sub_802AA60: @ 802AA60 - push {r4,lr} - adds r4, r0, 0 - bl GetLinkPlayerCount - movs r2, 0 - strb r0, [r4, 0x5] - adds r1, r4, 0 - adds r1, 0x70 - movs r0, 0x5 - strb r0, [r1] - adds r0, r4, 0 - adds r0, 0x72 - strh r2, [r0] - bl sub_802AB20 - adds r0, r4, 0 - bl sub_802AA94 - ldrb r0, [r4, 0x5] - cmp r0, 0x5 - bne _0802AA8E - bl sub_802E3A8 -_0802AA8E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802AA60 - - thumb_func_start sub_802AA94 -sub_802AA94: @ 802AA94 - push {r4-r6,lr} - adds r4, r0, 0 - movs r0, 0x6 - str r0, [r4, 0x14] - str r0, [r4, 0x18] - adds r0, r4, 0 - adds r0, 0x4A - movs r6, 0 - movs r5, 0 - strh r5, [r0] - str r5, [r4, 0x1C] - str r5, [r4, 0x5C] - bl GetMultiplayerId - movs r1, 0 - lsls r0, 24 - cmp r0, 0 - bne _0802AABA - movs r1, 0x1 -_0802AABA: - adds r0, r4, 0 - adds r0, 0x47 - strb r1, [r0] - strh r5, [r4, 0x8] - strh r5, [r4, 0xA] - strh r5, [r4, 0xC] - strh r5, [r4, 0xE] - str r5, [r4, 0x58] - strh r5, [r4, 0x3A] - subs r0, 0x3 - strb r6, [r0] - str r5, [r4, 0x54] - adds r0, 0x2 - strb r6, [r0] - adds r0, 0x3 - strb r6, [r0] - subs r0, 0x1 - movs r1, 0x1 - strb r1, [r0] - str r5, [r4, 0x78] - adds r0, 0x29 - strb r6, [r0] - adds r0, 0x3 - strh r5, [r0] - str r1, [r4, 0x60] - subs r0, 0x27 - strb r6, [r0] - str r5, [r4, 0x68] - str r5, [r4, 0x64] - str r5, [r4, 0x2C] - str r5, [r4, 0x30] - bl sub_802AB98 - bl sub_802C0E8 - movs r2, 0 - adds r5, r4, 0 - adds r5, 0x7C - movs r3, 0 - adds r1, r4, 0 - adds r1, 0x9A -_0802AB0C: - adds r0, r5, r2 - strb r3, [r0] - strh r3, [r1] - adds r1, 0x2 - adds r2, 0x1 - cmp r2, 0x4 - ble _0802AB0C - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802AA94 - - thumb_func_start sub_802AB20 -sub_802AB20: @ 802AB20 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r7, =gUnknown_02022CFC - movs r6, 0 - movs r5, 0 - ldr r0, =gPkmnJumpSpecies - mov r8, r0 - movs r4, 0x4 -_0802AB32: - ldr r0, [r7] - adds r0, r5 - ldr r1, =0x000082a8 - adds r0, r1 - ldrh r0, [r0] - bl sub_802AC00 - lsls r0, 16 - ldr r1, [r7] - adds r1, r6 - asrs r0, 14 - add r0, r8 - ldrh r0, [r0, 0x2] - ldr r2, =0x000082f0 - adds r1, r2 - strh r0, [r1] - adds r6, 0x28 - adds r5, 0xC - subs r4, 0x1 - cmp r4, 0 - bge _0802AB32 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - ldr r0, =0x000083ac - adds r3, r1, r0 - ldrb r2, [r1, 0x6] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r2, =0x000082e4 - adds r0, r2 - adds r1, r0 - str r1, [r3] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802AB20 - - thumb_func_start sub_802AB98 -sub_802AB98: @ 802AB98 - push {r4-r7,lr} - movs r5, 0 - ldr r6, =gUnknown_02022CFC - movs r4, 0 - movs r3, 0 -_0802ABA2: - ldr r2, [r6] - adds r1, r2, r3 - ldr r7, =0x000082f2 - adds r0, r1, r7 - strh r4, [r0] - adds r7, 0x2 - adds r0, r1, r7 - strh r4, [r0] - ldr r0, =0x000082f6 - adds r1, r0 - strh r4, [r1] - ldr r1, =0x000082e4 - adds r0, r2, r1 - adds r0, r3 - str r4, [r0] - subs r7, 0xC - adds r0, r2, r7 - adds r0, r3 - ldr r1, =0x7fffffff - str r1, [r0] - ldr r1, =0x000082f8 - adds r0, r2, r1 - adds r0, r3 - str r4, [r0] - adds r2, 0x8B - adds r2, r5 - movs r0, 0x9 - strb r0, [r2] - adds r3, 0x28 - adds r5, 0x1 - cmp r5, 0x4 - ble _0802ABA2 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802AB98 - - thumb_func_start sub_802AC00 -sub_802AC00: @ 802AC00 - push {lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r1, 0 - ldr r2, =gPkmnJumpSpecies -_0802AC0A: - ldrh r0, [r2] - cmp r0, r3 - bne _0802AC1C - lsls r0, r1, 16 - asrs r0, 16 - b _0802AC28 - .pool -_0802AC1C: - adds r2, 0x4 - adds r1, 0x1 - cmp r1, 0x63 - bls _0802AC0A - movs r0, 0x1 - negs r0, r0 -_0802AC28: - pop {r1} - bx r1 - thumb_func_end sub_802AC00 - - thumb_func_start sub_802AC2C -sub_802AC2C: @ 802AC2C - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - strh r0, [r5] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [r5, 0x4] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [r5, 0x8] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802AC2C - - thumb_func_start sub_802AC58 -sub_802AC58: @ 802AC58 - push {lr} - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - pop {r0} - bx r0 - thumb_func_end sub_802AC58 - - thumb_func_start sub_802AC6C -sub_802AC6C: @ 802AC6C - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_802AC6C - - thumb_func_start sub_802AC84 -sub_802AC84: @ 802AC84 - push {lr} - movs r1, 0x1 - bl CreateTask - ldr r2, =gUnknown_02022CFC - ldr r1, [r2] - movs r3, 0 - strb r0, [r1, 0x4] - ldr r0, [r2] - strh r3, [r0, 0x8] - pop {r0} - bx r0 - .pool - thumb_func_end sub_802AC84 - - thumb_func_start sub_802ACA0 -sub_802ACA0: @ 802ACA0 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gUnknown_02022CFC - ldr r0, [r1] - ldrh r0, [r0, 0x8] - adds r2, r1, 0 - cmp r0, 0x5 - bls _0802ACB6 - b _0802AE08 -_0802ACB6: - lsls r0, 2 - ldr r1, =_0802ACC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802ACC8: - .4byte _0802ACE0 - .4byte _0802AD0C - .4byte _0802AD3C - .4byte _0802AD68 - .4byte _0802ADA4 - .4byte _0802ADD0 -_0802ACE0: - movs r0, 0 - bl SetVBlankCallback - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r0, =sub_802BD84 - movs r1, 0x5 - bl sub_802BE60 - movs r0, 0x4 - bl FadeOutMapMusic - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - b _0802ADC0 - .pool -_0802AD0C: - ldr r0, =sub_802BD84 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0802AE08 - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - adds r0, 0xA4 - bl sub_802D074 - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 - ldr r1, [r4] - b _0802ADC0 - .pool -_0802AD3C: - bl sub_802D0F0 - cmp r0, 0 - bne _0802AE08 - bl IsNotWaitingForBGMStop - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0802AE08 - ldr r0, =0x0000021a - movs r1, 0x8 - bl FadeOutAndPlayNewMapMusic - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - b _0802ADC0 - .pool -_0802AD68: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0802AE08 - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - str r0, [sp] - adds r0, r4, 0 - adds r1, r4, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_802AC58 - bl SetVBlankCallback - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - b _0802ADC0 - .pool -_0802ADA4: - bl UpdatePaletteFade - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _0802AE08 - ldr r1, =gUnknown_02022CFC - ldr r0, [r1] - strb r2, [r0, 0x7] - ldr r1, [r1] -_0802ADC0: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802AE08 - .pool -_0802ADD0: - ldr r0, [r2] - ldrb r1, [r0, 0x7] - adds r1, 0x1 - strb r1, [r0, 0x7] - ldr r1, [r2] - ldrb r0, [r1, 0x7] - cmp r0, 0x13 - bls _0802AE08 - adds r0, r1, 0 - adds r0, 0x47 - ldrb r0, [r0] - cmp r0, 0 - beq _0802ADF8 - ldr r0, =sub_802AF80 - bl sub_802AC84 - b _0802ADFE - .pool -_0802ADF8: - ldr r0, =sub_802B194 - bl sub_802AC84 -_0802ADFE: - bl sub_802BE80 - adds r0, r4, 0 - bl DestroyTask -_0802AE08: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802ACA0 - - thumb_func_start sub_802AE14 -sub_802AE14: @ 802AE14 - push {lr} - adds r1, r0, 0 - cmp r1, 0 - bne _0802AE34 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - ldr r0, =0x00001111 - str r0, [r1, 0x30] - movs r0, 0x1 - str r0, [r1, 0x2C] - b _0802AE46 - .pool -_0802AE34: - ldr r0, =gUnknown_02022CFC - ldr r2, [r0] - subs r1, 0x1 - movs r0, 0x1 - lsls r0, r1 - subs r0, 0x1 - str r0, [r2, 0x30] - movs r0, 0 - str r0, [r2, 0x2C] -_0802AE46: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802AE14 - - thumb_func_start sub_802AE50 -sub_802AE50: @ 802AE50 - push {r4-r6,lr} - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - adds r1, 0x70 - movs r2, 0 - strb r0, [r1] - ldr r0, [r4] - movs r3, 0 - strh r2, [r0, 0x8] - strh r2, [r0, 0xA] - adds r0, 0x48 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r4] - adds r0, 0x49 - strb r3, [r0] - movs r3, 0x1 - ldr r0, [r4] - ldrb r0, [r0, 0x5] - cmp r3, r0 - bge _0802AE94 - adds r6, r4, 0 - ldr r5, =0x000082fc - movs r4, 0 - movs r2, 0x28 -_0802AE82: - ldr r1, [r6] - adds r0, r1, r5 - adds r0, r2 - str r4, [r0] - adds r2, 0x28 - adds r3, 0x1 - ldrb r1, [r1, 0x5] - cmp r3, r1 - blt _0802AE82 -_0802AE94: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802AE50 - - thumb_func_start sub_802AEA4 -sub_802AEA4: @ 802AEA4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - movs r4, 0x1 - movs r0, 0 - str r0, [sp, 0x4] - ldr r7, =gUnknown_02022CFC - ldr r0, [r7] - ldrb r0, [r0, 0x5] - cmp r4, r0 - bge _0802AF48 - adds r1, r7, 0 - mov r10, r1 - movs r2, 0x2 - add r2, sp - mov r8, r2 - ldr r3, =0x0000830c - mov r9, r3 - movs r6, 0x28 -_0802AED0: - mov r1, r10 - ldr r0, [r1] - adds r1, r0, r6 - ldr r2, =0x000082f4 - adds r1, r2 - ldrh r5, [r1] - add r0, r9 - adds r1, r4, 0 - mov r2, sp - mov r3, r8 - bl sub_802E264 - cmp r0, 0 - beq _0802AF10 - ldr r2, [r7] - lsls r1, r4, 1 - adds r0, r2, 0 - adds r0, 0x90 - adds r0, r1 - mov r3, r8 - ldrh r1, [r3] - strh r1, [r0] - adds r2, 0x8B - adds r2, r4 - mov r0, sp - ldrb r0, [r0] - strb r0, [r2] - ldr r0, [r7] - adds r0, r6 - ldr r1, =0x000082f6 - adds r0, r1 - strh r5, [r0] -_0802AF10: - mov r2, r10 - ldr r1, [r2] - ldr r3, =0x000082fc - adds r0, r1, r3 - adds r0, r6 - ldr r0, [r0] - cmp r0, 0 - beq _0802AF36 - adds r0, r1, 0 - adds r0, 0x8B - adds r0, r4 - adds r1, 0x70 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bne _0802AF36 - ldr r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x4] -_0802AF36: - movs r1, 0x28 - add r9, r1 - adds r6, 0x28 - adds r4, 0x1 - ldr r7, =gUnknown_02022CFC - ldr r0, [r7] - ldrb r0, [r0, 0x5] - cmp r4, r0 - blt _0802AED0 -_0802AF48: - ldr r2, =gUnknown_02022CFC - ldr r1, [r2] - ldrb r0, [r1, 0x5] - subs r0, 0x1 - ldr r3, [sp, 0x4] - cmp r3, r0 - bne _0802AF5C - adds r1, 0x49 - movs r0, 0x1 - strb r0, [r1] -_0802AF5C: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802AEA4 - - thumb_func_start sub_802AF80 -sub_802AF80: @ 802AF80 - push {r4,r5,lr} - bl sub_802AEA4 - bl sub_802C43C - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x48 - ldrb r0, [r0] - cmp r0, 0 - bne _0802AFB2 - adds r0, r1, 0 - adds r0, 0x49 - ldrb r0, [r0] - cmp r0, 0 - beq _0802AFB2 - adds r0, r1, 0 - adds r0, 0x4C - ldrb r0, [r0] - bl sub_802AE50 - movs r0, 0x3 - bl sub_802AE14 -_0802AFB2: - ldr r4, =gUnknown_02022CFC - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x48 - ldrb r5, [r0] - cmp r5, 0x1 - bne _0802AFEE - ldr r1, =gUnknown_082FB5F4 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - adds r1, r0, 0 - cmp r1, 0 - bne _0802AFEE - ldr r0, [r4] - adds r0, 0x48 - strb r1, [r0] - ldr r1, [r4] - ldrb r2, [r1, 0x6] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r2, =0x000082fc - adds r1, r2 - adds r1, r0 - str r5, [r1] -_0802AFEE: - bl sub_802C1DC - bl sub_802B008 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802AF80 - - thumb_func_start sub_802B008 -sub_802B008: @ 802B008 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - ldr r0, [r1, 0x2C] - cmp r0, 0 - bne _0802B01E - ldr r2, =0x000082e4 - adds r0, r1, r2 - adds r1, 0x70 - bl sub_802E138 -_0802B01E: - ldr r1, [r4] - ldr r2, [r1, 0x30] - ldr r0, =0x00001111 - cmp r2, r0 - beq _0802B030 - ldr r0, [r1, 0x2C] - adds r0, 0x1 - ands r0, r2 - str r0, [r1, 0x2C] -_0802B030: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802B008 - - thumb_func_start sub_802B044 -sub_802B044: @ 802B044 - ldr r2, =gUnknown_02022CFC - ldr r1, [r2] - adds r1, 0x70 - movs r3, 0 - strb r0, [r1] - ldr r0, [r2] - strh r3, [r0, 0x8] - strh r3, [r0, 0xA] - adds r0, 0x48 - movs r1, 0x1 - strb r1, [r0] - ldr r1, [r2] - ldrb r2, [r1, 0x6] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r2, =0x000082fc - adds r1, r2 - adds r1, r0 - str r3, [r1] - bx lr - .pool - thumb_func_end sub_802B044 - - thumb_func_start sub_802B078 -sub_802B078: @ 802B078 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldr r2, =0x000082f4 - adds r1, r0, r2 - ldrh r1, [r1] - mov r8, r1 - ldr r3, =0x000082e4 - adds r0, r3 - mov r1, sp - bl sub_802E1BC - cmp r0, 0 - beq _0802B128 - ldr r2, [r4] - ldrb r0, [r2, 0x6] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r3, =0x000082fc - adds r0, r2, r3 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0x1 - bne _0802B0C6 - mov r0, sp - adds r1, r2, 0 - adds r1, 0x70 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - beq _0802B0C6 - mov r0, sp - ldrb r0, [r0] - bl sub_802B044 -_0802B0C6: - ldr r3, =gUnknown_02022CFC - ldr r2, [r3] - ldr r0, [r2, 0x78] - ldr r1, [sp, 0x8] - cmp r0, r1 - beq _0802B108 - str r1, [r2, 0x78] - movs r4, 0x1 - str r4, [r2, 0x5C] - mov r0, sp - ldrb r1, [r0, 0x1] - adds r0, r2, 0 - adds r0, 0x71 - strb r1, [r0] - ldr r0, [r3] - adds r1, r0, 0 - adds r1, 0x71 - ldrb r1, [r1] - cmp r1, 0 - beq _0802B104 - adds r0, 0x4D - strb r4, [r0] - b _0802B108 - .pool -_0802B104: - adds r0, 0x4D - strb r1, [r0] -_0802B108: - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - mov r0, sp - ldrh r0, [r0, 0x2] - adds r2, r1, 0 - adds r2, 0x72 - strh r0, [r2] - mov r0, sp - ldrh r2, [r0, 0x4] - adds r0, r1, 0 - adds r0, 0x74 - strh r2, [r0] - ldr r0, =0x000082f6 - adds r1, r0 - mov r2, r8 - strh r2, [r1] -_0802B128: - movs r4, 0x1 - ldr r2, =gUnknown_02022CFC - ldr r0, [r2] - ldrb r0, [r0, 0x5] - cmp r4, r0 - bge _0802B176 - adds r7, r2, 0 - ldr r6, =0x0000830c - movs r5, 0x28 -_0802B13A: - ldr r1, [r7] - ldrb r3, [r1, 0x6] - cmp r4, r3 - beq _0802B168 - adds r0, r1, r5 - ldr r3, =0x000082f4 - adds r0, r3 - ldrh r0, [r0] - mov r8, r0 - adds r0, r1, r6 - adds r1, r4, 0 - str r2, [sp, 0xC] - bl sub_802E2D0 - ldr r2, [sp, 0xC] - cmp r0, 0 - beq _0802B168 - ldr r0, [r7] - adds r0, r5 - ldr r1, =0x000082f6 - adds r0, r1 - mov r3, r8 - strh r3, [r0] -_0802B168: - adds r6, 0x28 - adds r5, 0x28 - adds r4, 0x1 - ldr r0, [r2] - ldrb r0, [r0, 0x5] - cmp r4, r0 - blt _0802B13A -_0802B176: - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802B078 - - thumb_func_start sub_802B194 -sub_802B194: @ 802B194 - push {r4,lr} - bl sub_802B078 - ldr r4, =gUnknown_02022CFC - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x48 - ldrb r0, [r0] - cmp r0, 0 - beq _0802B1E0 - ldr r1, =gUnknown_082FB618 - adds r0, r2, 0 - adds r0, 0x70 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - adds r1, r0, 0 - cmp r1, 0 - bne _0802B1E0 - ldr r0, [r4] - adds r0, 0x48 - strb r1, [r0] - ldr r1, [r4] - ldrb r2, [r1, 0x6] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r2, =0x000082fc - adds r1, r2 - adds r1, r0 - movs r0, 0x1 - str r0, [r1] - movs r0, 0x3 - bl sub_802AE14 -_0802B1E0: - bl sub_802C1DC - bl sub_802B1FC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802B194 - - thumb_func_start sub_802B1FC -sub_802B1FC: @ 802B1FC - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r2, [r4] - ldr r0, [r2, 0x2C] - cmp r0, 0 - bne _0802B224 - ldrb r1, [r2, 0x6] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - ldr r1, =0x000082e4 - adds r0, r1 - adds r0, r2, r0 - adds r1, r2, 0 - adds r1, 0x70 - ldrb r1, [r1] - adds r2, 0x42 - ldrh r2, [r2] - bl sub_802E234 -_0802B224: - ldr r1, [r4] - ldr r2, [r1, 0x30] - ldr r0, =0x00001111 - cmp r2, r0 - beq _0802B236 - ldr r0, [r1, 0x2C] - adds r0, 0x1 - ands r0, r2 - str r0, [r1, 0x2C] -_0802B236: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802B1FC - - thumb_func_start sub_802B248 -sub_802B248: @ 802B248 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x8] - cmp r0, 0 - beq _0802B260 - cmp r0, 0x1 - beq _0802B26E - b _0802B294 - .pool -_0802B260: - movs r0, 0x3 - bl sub_802AE14 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B26E: - bl sub_802B7E0 - cmp r0, 0 - bne _0802B294 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x4A - ldrh r0, [r0] - adds r2, r1, 0 - adds r2, 0x72 - strh r0, [r2] - adds r1, 0x4C - movs r0, 0x1 - strb r0, [r1] - movs r0, 0 - b _0802B296 - .pool -_0802B294: - movs r0, 0x1 -_0802B296: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B248 - - thumb_func_start sub_802B29C -sub_802B29C: @ 802B29C - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x8] - cmp r0, 0 - beq _0802B2B4 - cmp r0, 0x1 - beq _0802B2CA - movs r0, 0x1 - b _0802B2CE - .pool -_0802B2B4: - movs r0, 0 - bl sub_802AE14 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x72 - ldrh r0, [r0] - str r0, [r1, 0x24] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B2CA: - bl sub_802B7E0 -_0802B2CE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B29C - - thumb_func_start sub_802B2D4 -sub_802B2D4: @ 802B2D4 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - ldrh r0, [r1, 0x8] - cmp r0, 0 - beq _0802B2EC - cmp r0, 0x1 - beq _0802B300 - b _0802B314 - .pool -_0802B2EC: - bl sub_802C0E8 - movs r0, 0x5 - bl sub_802AE14 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802B314 -_0802B300: - adds r0, r1, 0 - adds r0, 0x49 - ldrb r0, [r0] - cmp r0, 0 - beq _0802B314 - adds r1, 0x4C - movs r0, 0x2 - strb r0, [r1] - movs r0, 0 - b _0802B316 -_0802B314: - movs r0, 0x1 -_0802B316: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B2D4 - - thumb_func_start sub_802B31C -sub_802B31C: @ 802B31C - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x8] - cmp r0, 0 - beq _0802B334 - cmp r0, 0x1 - beq _0802B352 - b _0802B35E - .pool -_0802B334: - bl sub_802C0E8 - movs r0, 0 - bl sub_802AE14 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x72 - ldrh r0, [r0] - adds r2, r1, 0 - adds r2, 0x4A - strh r0, [r2] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B352: - bl sub_802C70C - cmp r0, 0 - beq _0802B35E - movs r0, 0 - b _0802B360 -_0802B35E: - movs r0, 0x1 -_0802B360: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B31C - - thumb_func_start sub_802B368 -sub_802B368: @ 802B368 - push {lr} - bl sub_802B8CC - cmp r0, 0 - bne _0802B390 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x4A - ldrh r0, [r0] - adds r2, r1, 0 - adds r2, 0x72 - strh r0, [r2] - adds r1, 0x4C - movs r0, 0x1 - strb r0, [r1] - b _0802B3AA - .pool -_0802B390: - bl sub_802C538 - cmp r0, 0 - beq _0802B39C - movs r0, 0x1 - b _0802B3AC -_0802B39C: - bl sub_802C0B8 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - adds r0, 0x4C - movs r1, 0x3 - strb r1, [r0] -_0802B3AA: - movs r0, 0 -_0802B3AC: - pop {r1} - bx r1 - .pool - thumb_func_end sub_802B368 - - thumb_func_start sub_802B3B4 -sub_802B3B4: @ 802B3B4 - push {lr} - bl sub_802B8CC - cmp r0, 0 - beq _0802B3CE - bl sub_802C538 - cmp r0, 0 - beq _0802B3CA - movs r0, 0x1 - b _0802B3D0 -_0802B3CA: - bl sub_802C0B8 -_0802B3CE: - movs r0, 0 -_0802B3D0: - pop {r1} - bx r1 - thumb_func_end sub_802B3B4 - - thumb_func_start sub_802B3D4 -sub_802B3D4: @ 802B3D4 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x8] - cmp r0, 0x1 - beq _0802B40C - cmp r0, 0x1 - bgt _0802B3F0 - cmp r0, 0 - beq _0802B3F6 - b _0802B468 - .pool -_0802B3F0: - cmp r0, 0x2 - beq _0802B460 - b _0802B468 -_0802B3F6: - bl sub_802C538 - bl sub_802C5DC - cmp r0, 0 - beq _0802B468 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802B468 -_0802B40C: - bl sub_802B964 - cmp r0, 0 - bne _0802B468 - bl sub_802C7BC - cmp r0, 0 - beq _0802B42E - bl sub_802C7E0 - ldr r1, [r4] - adds r2, r1, 0 - adds r2, 0x72 - strh r0, [r2] - adds r1, 0x4C - movs r0, 0x7 - b _0802B454 -_0802B42E: - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x74 - ldrh r0, [r0] - cmp r0, 0xC7 - bls _0802B448 - ldrh r0, [r1, 0xE] - adds r2, r1, 0 - adds r2, 0x72 - strh r0, [r2] - adds r1, 0x4C - movs r0, 0x8 - b _0802B454 -_0802B448: - ldrh r0, [r1, 0xE] - adds r2, r1, 0 - adds r2, 0x72 - strh r0, [r2] - adds r1, 0x4C - movs r0, 0x4 -_0802B454: - strb r0, [r1] - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B460: - movs r0, 0 - b _0802B46A - .pool -_0802B468: - movs r0, 0x1 -_0802B46A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B3D4 - - thumb_func_start sub_802B470 -sub_802B470: @ 802B470 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x8] - cmp r0, 0x1 - beq _0802B4B0 - cmp r0, 0x1 - bgt _0802B48C - cmp r0, 0 - beq _0802B492 - b _0802B4C4 - .pool -_0802B48C: - cmp r0, 0x2 - beq _0802B4C0 - b _0802B4C4 -_0802B492: - bl sub_802C538 - cmp r0, 0 - bne _0802B49E - bl sub_802C0B8 -_0802B49E: - bl sub_802C5DC - cmp r0, 0 - beq _0802B4C4 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802B4C4 -_0802B4B0: - bl sub_802B964 - cmp r0, 0 - bne _0802B4C4 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B4C0: - movs r0, 0 - b _0802B4C6 -_0802B4C4: - movs r0, 0x1 -_0802B4C6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B470 - - thumb_func_start sub_802B4CC -sub_802B4CC: @ 802B4CC - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r1, [r0, 0x8] - cmp r1, 0x1 - beq _0802B500 - cmp r1, 0x1 - bgt _0802B4E8 - cmp r1, 0 - beq _0802B4F2 - b _0802B560 - .pool -_0802B4E8: - cmp r1, 0x2 - beq _0802B52C - cmp r1, 0x3 - beq _0802B556 - b _0802B560 -_0802B4F2: - movs r0, 0x4 - bl sub_802AE14 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B500: - bl sub_802BB84 - cmp r0, 0 - bne _0802B560 - ldr r4, =gUnknown_02022CFC - ldr r2, [r4] - ldr r0, [r2, 0x78] - adds r1, r2, 0 - adds r1, 0x74 - ldrh r1, [r1] - adds r2, 0x72 - ldrh r2, [r2] - bl sub_802E354 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802B560 - .pool -_0802B52C: - adds r0, 0x49 - ldrb r0, [r0] - cmp r0, 0 - beq _0802B560 - bl sub_802C650 - cmp r0, 0 - beq _0802B544 - ldr r0, [r4] - adds r0, 0x4C - movs r1, 0x5 - b _0802B54A -_0802B544: - ldr r0, [r4] - adds r0, 0x4C - movs r1, 0x6 -_0802B54A: - strb r1, [r0] - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B556: - movs r0, 0 - b _0802B562 - .pool -_0802B560: - movs r0, 0x1 -_0802B562: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B4CC - - thumb_func_start sub_802B568 -sub_802B568: @ 802B568 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x8] - cmp r0, 0 - beq _0802B580 - cmp r0, 0x1 - beq _0802B58E - b _0802B5C0 - .pool -_0802B580: - movs r0, 0 - bl sub_802AE14 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B58E: - bl sub_802BB84 - cmp r0, 0 - bne _0802B5C0 - ldr r4, =gUnknown_02022CFC - ldr r2, [r4] - ldr r0, [r2, 0x78] - adds r1, r2, 0 - adds r1, 0x74 - ldrh r1, [r1] - adds r2, 0x72 - ldrh r2, [r2] - bl sub_802E354 - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0x45 - ldrb r1, [r1] - adds r0, 0x42 - strh r1, [r0] - movs r0, 0 - b _0802B5C2 - .pool -_0802B5C0: - movs r0, 0x1 -_0802B5C2: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B568 - - thumb_func_start sub_802B5C8 -sub_802B5C8: @ 802B5C8 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - ldrh r0, [r1, 0x8] - cmp r0, 0 - beq _0802B5E0 - cmp r0, 0x1 - beq _0802B5F2 - b _0802B61E - .pool -_0802B5E0: - bl sub_802BD30 - cmp r0, 0 - bne _0802B61E - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802B61E -_0802B5F2: - adds r0, r1, 0 - adds r0, 0x49 - ldrb r0, [r0] - cmp r0, 0 - beq _0802B61E - adds r0, r1, 0 - bl sub_802AA94 - bl Random - ldr r1, [r4] - lsls r0, 16 - lsrs r0, 16 - str r0, [r1, 0x24] - adds r3, r1, 0 - adds r3, 0x72 - movs r2, 0 - strh r0, [r3] - adds r1, 0x4C - strb r2, [r1] - movs r0, 0 - b _0802B620 -_0802B61E: - movs r0, 0x1 -_0802B620: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B5C8 - - thumb_func_start sub_802B628 -sub_802B628: @ 802B628 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x8] - cmp r0, 0 - beq _0802B640 - cmp r0, 0x1 - beq _0802B656 - b _0802B65A - .pool -_0802B640: - bl sub_802BD30 - cmp r0, 0 - bne _0802B65A - ldr r0, [r4] - bl sub_802AA94 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0802B656: - movs r0, 0 - b _0802B65C -_0802B65A: - movs r0, 0x1 -_0802B65C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B628 - - thumb_func_start sub_802B664 -sub_802B664: @ 802B664 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - ldrh r0, [r1, 0x8] - cmp r0, 0x1 - beq _0802B68C - cmp r0, 0x1 - bgt _0802B680 - cmp r0, 0 - beq _0802B686 - b _0802B6B0 - .pool -_0802B680: - cmp r0, 0x2 - beq _0802B69C - b _0802B6B0 -_0802B686: - movs r0, 0x1 - strh r0, [r1, 0x8] - b _0802B6B0 -_0802B68C: - movs r0, 0 - bl sub_802AE14 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802B6B0 -_0802B69C: - bl sub_802BC60 - cmp r0, 0 - bne _0802B6B0 - ldr r0, [r4] - ldr r0, [r0] - bl SetMainCallback2 - bl sub_802AA48 -_0802B6B0: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B664 - - thumb_func_start sub_802B6B8 -sub_802B6B8: @ 802B6B8 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x8] - cmp r0, 0 - beq _0802B6D0 - cmp r0, 0x1 - beq _0802B6E0 - b _0802B6FC - .pool -_0802B6D0: - movs r0, 0x4 - bl sub_802AE14 - ldr r1, [r4] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802B6FC -_0802B6E0: - bl sub_802BA58 - cmp r0, 0 - bne _0802B6FC - ldr r0, [r4] - ldrh r1, [r0, 0xE] - adds r2, r0, 0 - adds r2, 0x72 - strh r1, [r2] - adds r0, 0x4C - movs r1, 0x8 - strb r1, [r0] - movs r0, 0 - b _0802B6FE -_0802B6FC: - movs r0, 0x1 -_0802B6FE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B6B8 - - thumb_func_start sub_802B704 -sub_802B704: @ 802B704 - push {lr} - movs r0, 0 - bl sub_802AE14 - bl sub_802BA58 - cmp r0, 0 - beq _0802B718 - movs r0, 0x1 - b _0802B71A -_0802B718: - movs r0, 0 -_0802B71A: - pop {r1} - bx r1 - thumb_func_end sub_802B704 - - thumb_func_start sub_802B720 -sub_802B720: @ 802B720 - push {r4,lr} - ldr r1, =gUnknown_02022CFC - ldr r0, [r1] - ldrh r0, [r0, 0x8] - adds r4, r1, 0 - cmp r0, 0x4 - bhi _0802B7D8 - lsls r0, 2 - ldr r1, =_0802B740 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802B740: - .4byte _0802B754 - .4byte _0802B770 - .4byte _0802B780 - .4byte _0802B798 - .4byte _0802B7BC -_0802B754: - ldr r2, [r4] - ldr r0, [r2, 0x78] - adds r1, r2, 0 - adds r1, 0x74 - ldrh r1, [r1] - adds r2, 0x72 - ldrh r2, [r2] - bl sub_802E354 - movs r0, 0x5 - bl sub_802D0C8 - ldr r1, [r4] - b _0802B7AC -_0802B770: - bl sub_802D0F0 - cmp r0, 0 - bne _0802B7D8 - movs r0, 0 - bl sub_802AE14 - b _0802B7A8 -_0802B780: - bl sub_802C70C - cmp r0, 0 - beq _0802B7D8 - ldr r0, =sub_8153688 - movs r1, 0x6 - bl CreateTask - b _0802B7A8 - .pool -_0802B798: - ldr r0, =sub_8153688 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0802B7D8 - bl sub_802DA14 -_0802B7A8: - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] -_0802B7AC: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0802B7D8 - .pool -_0802B7BC: - bl sub_802DA44 - cmp r0, 0 - bne _0802B7D8 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - adds r0, 0x4C - movs r1, 0x4 - strb r1, [r0] - movs r0, 0 - b _0802B7DA - .pool -_0802B7D8: - movs r0, 0x1 -_0802B7DA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802B720 - - thumb_func_start sub_802B7E0 -sub_802B7E0: @ 802B7E0 - push {r4,r5,lr} - ldr r1, =gUnknown_02022CFC - ldr r0, [r1] - ldrh r0, [r0, 0xA] - adds r4, r1, 0 - cmp r0, 0x7 - bhi _0802B8C4 - lsls r0, 2 - ldr r1, =_0802B800 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802B800: - .4byte _0802B820 - .4byte _0802B82C - .4byte _0802B84C - .4byte _0802B866 - .4byte _0802B878 - .4byte _0802B880 - .4byte _0802B8A0 - .4byte _0802B8BA -_0802B820: - movs r0, 0x2 - bl sub_802D0C8 - bl sub_802DDE0 - b _0802B890 -_0802B82C: - bl sub_802D0F0 - adds r5, r0, 0 - cmp r5, 0 - bne _0802B8C4 - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrb r0, [r0, 0x6] - bl sub_802DDF4 - ldr r1, [r4] - strh r5, [r1, 0x3C] - b _0802B894 - .pool -_0802B84C: - ldr r1, [r4] - ldrh r0, [r1, 0x3C] - adds r0, 0x1 - strh r0, [r1, 0x3C] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x78 - bls _0802B8C4 - movs r0, 0x3 - bl sub_802D0C8 - ldr r1, [r4] - b _0802B894 -_0802B866: - bl sub_802D0F0 - cmp r0, 0x1 - beq _0802B8C4 - bl sub_802DE08 - cmp r0, 0x1 - beq _0802B8C4 - b _0802B890 -_0802B878: - movs r0, 0x9 - bl sub_802D0C8 - b _0802B890 -_0802B880: - bl sub_802D0F0 - cmp r0, 0 - bne _0802B8C4 - bl sub_802C260 - bl sub_802D764 -_0802B890: - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] -_0802B894: - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - b _0802B8C4 - .pool -_0802B8A0: - bl sub_802D788 - cmp r0, 0 - bne _0802B8C4 - bl sub_802C270 - bl sub_802BEA0 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] -_0802B8BA: - movs r0, 0 - b _0802B8C6 - .pool -_0802B8C4: - movs r0, 0x1 -_0802B8C6: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802B7E0 - - thumb_func_start sub_802B8CC -sub_802B8CC: @ 802B8CC - push {r4,r5,lr} - bl sub_802BEE4 - ldr r5, =gUnknown_02022CFC - ldr r1, [r5] - ldrh r4, [r1, 0x36] - cmp r4, 0 - beq _0802B8E8 - movs r0, 0 - strh r0, [r1, 0x36] - b _0802B95C - .pool -_0802B8E8: - ldrh r0, [r1, 0xA] - cmp r0, 0x1 - beq _0802B914 - cmp r0, 0x1 - bgt _0802B8F8 - cmp r0, 0 - beq _0802B902 - b _0802B95A -_0802B8F8: - cmp r0, 0x2 - beq _0802B938 - cmp r0, 0x3 - beq _0802B94C - b _0802B95A -_0802B902: - movs r0, 0 - bl sub_802C130 - cmp r0, 0 - beq _0802B95A - ldr r1, [r5] - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] -_0802B914: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0802B95A - bl sub_802C164 - movs r0, 0x3 - bl sub_802AE14 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - b _0802B944 - .pool -_0802B938: - movs r0, 0x1 - bl sub_802C130 - cmp r0, 0x1 - bne _0802B95A - ldr r1, [r5] -_0802B944: - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - b _0802B95A -_0802B94C: - movs r0, 0 - bl sub_802C130 - cmp r0, 0x1 - bne _0802B95A - ldr r0, [r5] - strh r4, [r0, 0xA] -_0802B95A: - movs r0, 0x1 -_0802B95C: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802B8CC - - thumb_func_start sub_802B964 -sub_802B964: @ 802B964 - push {r4-r6,lr} - ldr r1, =gUnknown_02022CFC - ldr r0, [r1] - ldrh r0, [r0, 0xA] - adds r5, r1, 0 - cmp r0, 0x4 - bhi _0802BA50 - lsls r0, 2 - ldr r1, =_0802B984 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802B984: - .4byte _0802B998 - .4byte _0802B9BC - .4byte _0802BA00 - .4byte _0802BA24 - .4byte _0802BA46 -_0802B998: - movs r4, 0 - ldr r0, [r5] - ldrb r0, [r0, 0x5] - cmp r4, r0 - bge _0802B9B8 - adds r6, r5, 0 -_0802B9A4: - adds r0, r4, 0 - bl sub_802DDB8 - cmp r0, 0x1 - beq _0802BA50 - adds r4, 0x1 - ldr r0, [r6] - ldrb r0, [r0, 0x5] - cmp r4, r0 - blt _0802B9A4 -_0802B9B8: - ldr r1, [r5] - b _0802BA1C -_0802B9BC: - movs r4, 0 - ldr r0, [r5] - ldrb r0, [r0, 0x5] - cmp r4, r0 - bge _0802B9EC - adds r6, r5, 0 - movs r5, 0 -_0802B9CA: - ldr r0, [r6] - adds r0, r5 - ldr r1, =0x000082f4 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0x2 - bne _0802B9E0 - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_802DDA0 -_0802B9E0: - adds r5, 0x28 - adds r4, 0x1 - ldr r0, [r6] - ldrb r0, [r0, 0x5] - cmp r4, r0 - blt _0802B9CA -_0802B9EC: - movs r0, 0x1 - bl sub_802D0C8 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - b _0802BA18 - .pool -_0802BA00: - ldr r1, [r5] - ldrh r0, [r1, 0x3C] - adds r0, 0x1 - strh r0, [r1, 0x3C] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x64 - bls _0802BA50 - movs r0, 0x3 - bl sub_802D0C8 - ldr r1, [r5] -_0802BA18: - movs r0, 0 - strh r0, [r1, 0x3C] -_0802BA1C: - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - b _0802BA50 -_0802BA24: - bl sub_802D0F0 - adds r5, r0, 0 - cmp r5, 0 - bne _0802BA50 - bl sub_802DDCC - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - adds r0, 0x71 - strb r5, [r0] - bl sub_802C114 - ldr r1, [r4] - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] -_0802BA46: - movs r0, 0 - b _0802BA52 - .pool -_0802BA50: - movs r0, 0x1 -_0802BA52: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_802B964 - - thumb_func_start sub_802BA58 -sub_802BA58: @ 802BA58 - push {r4,lr} - ldr r1, =gUnknown_02022CFC - ldr r0, [r1] - ldrh r0, [r0, 0xA] - adds r4, r1, 0 - cmp r0, 0x6 - bls _0802BA68 - b _0802BB7C -_0802BA68: - lsls r0, 2 - ldr r1, =_0802BA7C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802BA7C: - .4byte _0802BA98 - .4byte _0802BAB8 - .4byte _0802BAD0 - .4byte _0802BB00 - .4byte _0802BAB8 - .4byte _0802BAD0 - .4byte _0802BB70 -_0802BA98: - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x72 - ldrh r0, [r0] - adds r1, r2, 0 - adds r1, 0x3E - adds r2, 0x40 - bl sub_802C808 - ldr r1, [r4] - ldrh r0, [r1, 0x3E] - adds r1, 0x40 - ldrh r1, [r1] - bl sub_802D7E8 - b _0802BAF0 -_0802BAB8: - bl sub_802D974 - adds r2, r0, 0 - cmp r2, 0 - bne _0802BB7C - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - strh r2, [r1, 0x3C] - b _0802BAF2 - .pool -_0802BAD0: - ldr r1, [r4] - ldrh r0, [r1, 0x3C] - adds r2, r0, 0x1 - strh r2, [r1, 0x3C] - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0802BAEC - lsls r0, r2, 16 - lsrs r0, 16 - cmp r0, 0xB4 - bls _0802BB7C -_0802BAEC: - bl sub_802DA14 -_0802BAF0: - ldr r1, [r4] -_0802BAF2: - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - b _0802BB7C - .pool -_0802BB00: - bl sub_802DA44 - cmp r0, 0 - bne _0802BB7C - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - ldrh r0, [r1, 0x3E] - adds r1, 0x40 - ldrh r1, [r1] - bl sub_802C880 - ldr r1, [r4] - adds r2, r1, 0 - adds r2, 0x40 - strh r0, [r2] - lsls r0, 16 - cmp r0, 0 - beq _0802BB58 - ldrh r0, [r1, 0x3E] - ldrh r1, [r2] - bl AddBagItem - lsls r0, 24 - cmp r0, 0 - beq _0802BB58 - ldr r0, [r4] - ldrh r0, [r0, 0x3E] - movs r1, 0x1 - bl CheckBagHasSpace - lsls r0, 24 - cmp r0, 0 - bne _0802BB50 - ldr r0, [r4] - ldrh r0, [r0, 0x3E] - bl sub_802D884 - b _0802BB62 - .pool -_0802BB50: - ldr r1, [r4] - movs r0, 0x6 - strh r0, [r1, 0xA] - b _0802BB7C -_0802BB58: - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0x3E] - bl sub_802D8FC -_0802BB62: - ldr r1, [r4] - movs r0, 0x4 - strh r0, [r1, 0xA] - b _0802BB7C - .pool -_0802BB70: - bl sub_802DA44 - cmp r0, 0 - bne _0802BB7C - movs r0, 0 - b _0802BB7E -_0802BB7C: - movs r0, 0x1 -_0802BB7E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802BA58 - - thumb_func_start sub_802BB84 -sub_802BB84: @ 802BB84 - push {r4,lr} - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldrh r0, [r0, 0xA] - cmp r0, 0x6 - bhi _0802BC58 - lsls r0, 2 - ldr r1, =_0802BBA4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802BBA4: - .4byte _0802BBC0 - .4byte _0802BBC4 - .4byte _0802BBCE - .4byte _0802BC1C - .4byte _0802BC26 - .4byte _0802BC3C - .4byte _0802BC4E -_0802BBC0: - movs r0, 0x4 - b _0802BC28 -_0802BBC4: - bl sub_802D0F0 - cmp r0, 0 - bne _0802BC58 - b _0802BC2C -_0802BBCE: - bl sub_802DA8C - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0802BC04 - cmp r1, 0 - bgt _0802BBE8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0802BBEC - b _0802BC58 -_0802BBE8: - cmp r1, 0x1 - bne _0802BC58 -_0802BBEC: - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - adds r0, 0x45 - movs r1, 0x1 - strb r1, [r0] - movs r0, 0x6 - bl sub_802D0C8 - ldr r1, [r4] - b _0802BC30 - .pool -_0802BC04: - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - adds r0, 0x45 - movs r1, 0x2 - strb r1, [r0] - movs r0, 0x6 - bl sub_802D0C8 - ldr r1, [r4] - b _0802BC30 - .pool -_0802BC1C: - bl sub_802D0F0 - cmp r0, 0 - bne _0802BC58 - b _0802BC2C -_0802BC26: - movs r0, 0x8 -_0802BC28: - bl sub_802D0C8 -_0802BC2C: - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] -_0802BC30: - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - b _0802BC58 - .pool -_0802BC3C: - bl sub_802D0F0 - cmp r0, 0 - bne _0802BC58 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] -_0802BC4E: - movs r0, 0 - b _0802BC5A - .pool -_0802BC58: - movs r0, 0x1 -_0802BC5A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802BB84 - - thumb_func_start sub_802BC60 -sub_802BC60: @ 802BC60 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_02022CFC - ldr r0, [r1] - ldrh r0, [r0, 0xA] - adds r4, r1, 0 - cmp r0, 0x5 - bhi _0802BD24 - lsls r0, 2 - ldr r1, =_0802BC84 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802BC84: - .4byte _0802BC9C - .4byte _0802BCA2 - .4byte _0802BCB2 - .4byte _0802BCC8 - .4byte _0802BCEE - .4byte _0802BD14 -_0802BC9C: - bl sub_802DA14 - b _0802BCFE -_0802BCA2: - bl sub_802DA44 - cmp r0, 0 - bne _0802BD24 - movs r0, 0x7 - bl sub_802D0C8 - b _0802BCFE -_0802BCB2: - bl sub_802D0F0 - adds r2, r0, 0 - cmp r2, 0 - bne _0802BD24 - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - strh r2, [r1, 0x3C] - b _0802BD02 - .pool -_0802BCC8: - ldr r1, [r4] - ldrh r0, [r1, 0x3C] - adds r0, 0x1 - strh r0, [r1, 0x3C] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x78 - bls _0802BD24 - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r4] - b _0802BD02 -_0802BCEE: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0802BD24 - bl sub_800AC34 -_0802BCFE: - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] -_0802BD02: - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - b _0802BD24 - .pool -_0802BD14: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0802BD24 - movs r0, 0 - b _0802BD26 - .pool -_0802BD24: - movs r0, 0x1 -_0802BD26: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802BC60 - - thumb_func_start sub_802BD30 -sub_802BD30: @ 802BD30 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldrh r0, [r0, 0xA] - cmp r0, 0x1 - beq _0802BD66 - cmp r0, 0x1 - bgt _0802BD4C - cmp r0, 0 - beq _0802BD52 - b _0802BD7A - .pool -_0802BD4C: - cmp r0, 0x2 - beq _0802BD76 - b _0802BD7A -_0802BD52: - bl sub_802DA14 - movs r0, 0 - bl sub_802DD64 - ldr r1, [r4] - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - b _0802BD7A -_0802BD66: - bl sub_802DA44 - cmp r0, 0 - bne _0802BD7A - ldr r1, [r4] - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] -_0802BD76: - movs r0, 0 - b _0802BD7C -_0802BD7A: - movs r0, 0x1 -_0802BD7C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802BD30 - - thumb_func_start sub_802BD84 -sub_802BD84: @ 802BD84 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r0, 2 - add r0, r10 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - mov r0, r10 - movs r1, 0xE - bl GetWordTaskArg - mov r8, r0 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _0802BDC8 - cmp r0, 0x1 - beq _0802BDDC - b _0802BE48 - .pool -_0802BDBC: - bl sub_802AB20 - mov r0, r10 - bl DestroyTask - b _0802BE48 -_0802BDC8: - movs r1, 0 - adds r0, r6, 0 - adds r0, 0x8 -_0802BDCE: - strh r1, [r0, 0x4] - subs r0, 0x2 - cmp r0, r6 - bge _0802BDCE - ldrh r0, [r6] - adds r0, 0x1 - strh r0, [r6] -_0802BDDC: - mov r3, r8 - ldrb r1, [r3, 0x6] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r4, =0x000082a8 - adds r0, r4 - add r0, r8 - bl sub_802E0AC - movs r2, 0 - adds r5, r6, 0x4 - mov r9, r2 - movs r7, 0x83 - lsls r7, 8 - add r7, r8 - add r4, r8 -_0802BDFE: - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0802BE38 - adds r0, r2, 0 - adds r1, r4, 0 - str r2, [sp] - bl sub_802E0D0 - ldr r2, [sp] - cmp r0, 0 - beq _0802BE38 - ldr r1, =gLinkPlayers + 8 - add r1, r9 - adds r0, r7, 0 - bl StringCopy - movs r0, 0x1 - strh r0, [r5] - ldrh r0, [r6, 0x2] - adds r0, 0x1 - strh r0, [r6, 0x2] - movs r3, 0x2 - ldrsh r0, [r6, r3] - ldr r2, [sp] - mov r1, r8 - ldrb r1, [r1, 0x5] - cmp r0, r1 - beq _0802BDBC -_0802BE38: - adds r5, 0x2 - movs r3, 0x1C - add r9, r3 - adds r7, 0x28 - adds r4, 0xC - adds r2, 0x1 - cmp r2, 0x4 - ble _0802BDFE -_0802BE48: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802BD84 - - thumb_func_start sub_802BE60 -sub_802BE60: @ 802BE60 - push {lr} - lsls r1, 24 - lsrs r1, 24 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02022CFC - ldr r2, [r1] - movs r1, 0xE - bl SetWordTaskArg - pop {r0} - bx r0 - .pool - thumb_func_end sub_802BE60 - - thumb_func_start sub_802BE80 -sub_802BE80: @ 802BE80 - ldr r0, =gUnknown_02022CFC - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x4A - movs r1, 0 - strh r1, [r0] - movs r0, 0x6 - str r0, [r2, 0x14] - strh r1, [r2, 0x34] - str r1, [r2, 0x1C] - strh r1, [r2, 0x36] - str r1, [r2, 0x10] - bx lr - .pool - thumb_func_end sub_802BE80 - - thumb_func_start sub_802BEA0 -sub_802BEA0: @ 802BEA0 - push {r4,lr} - ldr r3, =gUnknown_02022CFC - ldr r0, [r3] - adds r1, r0, 0 - adds r1, 0x4A - movs r4, 0 - movs r2, 0 - strh r2, [r1] - ldr r1, =0x000006ff - strh r1, [r0, 0x34] - movs r1, 0x7 - str r1, [r0, 0x14] - strh r2, [r0, 0x36] - str r2, [r0, 0x10] - adds r0, 0x51 - strb r4, [r0] - ldr r0, [r3] - adds r0, 0x50 - strb r4, [r0] - ldr r0, [r3] - str r2, [r0, 0x20] - adds r1, r0, 0 - adds r1, 0x4E - strh r2, [r1] - str r2, [r0, 0x6C] - bl sub_802BF7C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802BEA0 - - thumb_func_start sub_802BEE4 -sub_802BEE4: @ 802BEE4 - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x46 - ldrb r0, [r0] - cmp r0, 0 - beq _0802BF34 - adds r1, 0x4A - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - bl sub_802BF48 - ldr r3, [r4] - ldrh r1, [r3, 0x34] - adds r2, r1, r0 - strh r2, [r3, 0x34] - lsls r1, r2, 16 - ldr r0, =0x09fe0000 - cmp r1, r0 - bls _0802BF16 - ldr r1, =0xfffff601 - adds r0, r2, r1 - strh r0, [r3, 0x34] -_0802BF16: - ldr r1, [r4] - ldr r2, [r1, 0x14] - str r2, [r1, 0x18] - ldrh r0, [r1, 0x34] - lsrs r0, 8 - str r0, [r1, 0x14] - cmp r0, 0x6 - bls _0802BF34 - cmp r2, 0x6 - bhi _0802BF34 - ldrh r0, [r1, 0x36] - adds r0, 0x1 - strh r0, [r1, 0x36] - bl sub_802BF7C -_0802BF34: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802BEE4 - - thumb_func_start sub_802BF48 -sub_802BF48: @ 802BF48 - push {lr} - ldr r0, =gUnknown_02022CFC - ldr r2, [r0] - ldr r0, [r2, 0x10] - cmp r0, 0 - beq _0802BF5C - movs r0, 0 - b _0802BF72 - .pool -_0802BF5C: - ldr r3, [r2, 0x1C] - ldrh r1, [r2, 0x34] - ldr r0, =0x000005ff - cmp r1, r0 - bhi _0802BF70 - ldr r0, [r2, 0x20] - adds r0, 0x50 - str r0, [r2, 0x20] - lsrs r0, 8 - adds r3, r0 -_0802BF70: - adds r0, r3, 0 -_0802BF72: - pop {r1} - bx r1 - .pool - thumb_func_end sub_802BF48 - - thumb_func_start sub_802BF7C -sub_802BF7C: @ 802BF7C - push {r4,lr} - ldr r4, =gUnknown_02022CFC - ldr r3, [r4] - movs r0, 0 - str r0, [r3, 0x20] - adds r1, r3, 0 - adds r1, 0x4E - ldrh r0, [r1] - cmp r0, 0 - beq _0802BFC0 - subs r0, 0x1 - strh r0, [r1] - ldr r0, [r3, 0x6C] - cmp r0, 0 - beq _0802C08A - bl sub_802C098 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0 - beq _0802BFB0 - ldr r1, [r4] - b _0802C086 - .pool -_0802BFB0: - ldr r1, [r4] - ldr r0, [r1, 0x28] - cmp r0, 0x36 - bls _0802BFBC - movs r0, 0x1E - b _0802C088 -_0802BFBC: - movs r0, 0x52 - b _0802C088 -_0802BFC0: - adds r2, r3, 0 - adds r2, 0x50 - ldrb r1, [r2] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _0802C014 - ldr r0, =gUnknown_082FB63C - ldrb r1, [r2] - lsls r1, 1 - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x51 - ldrb r2, [r0] - lsls r0, r2, 3 - subs r0, r2 - ldrh r1, [r1] - adds r0, r1 - str r0, [r3, 0x28] - bl sub_802C098 - ldr r2, [r4] - ldr r3, =gUnknown_082FB64C - movs r1, 0x3 - ands r1, r0 - lsls r1, 1 - adds r1, r3 - ldrh r0, [r1] - adds r0, 0x2 - adds r1, r2, 0 - adds r1, 0x4E - strh r0, [r1] - adds r2, 0x50 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - b _0802C082 - .pool -_0802C014: - lsls r0, r1, 24 - lsrs r0, 24 - cmp r0, 0x8 - bne _0802C030 - adds r1, r3, 0 - adds r1, 0x51 - ldrb r0, [r1] - cmp r0, 0x2 - bhi _0802C02C - adds r0, 0x1 - strb r0, [r1] - b _0802C030 -_0802C02C: - movs r0, 0x1 - str r0, [r3, 0x6C] -_0802C030: - ldr r2, =gUnknown_082FB63C - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - mov r12, r0 - mov r3, r12 - adds r3, 0x50 - ldrb r0, [r3] - movs r1, 0xF - subs r1, r0 - lsls r1, 1 - adds r1, r2 - mov r0, r12 - adds r0, 0x51 - ldrb r2, [r0] - lsls r0, r2, 3 - subs r0, r2 - ldrh r1, [r1] - adds r0, r1 - mov r1, r12 - str r0, [r1, 0x28] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xF - bls _0802C082 - bl sub_802C098 - movs r1, 0x3 - ands r1, r0 - cmp r1, 0 - bne _0802C07A - ldr r1, [r4] - ldr r0, [r1, 0x28] - subs r0, 0x5 - str r0, [r1, 0x28] -_0802C07A: - ldr r0, [r4] - adds r0, 0x50 - movs r1, 0 - strb r1, [r0] -_0802C082: - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] -_0802C086: - ldr r0, [r1, 0x28] -_0802C088: - str r0, [r1, 0x1C] -_0802C08A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802BF7C - - thumb_func_start sub_802C098 -sub_802C098: @ 802C098 - ldr r0, =gUnknown_02022CFC - ldr r2, [r0] - ldr r1, [r2, 0x24] - ldr r0, =0x41c64e6d - muls r0, r1 - ldr r1, =0x00006073 - adds r0, r1 - str r0, [r2, 0x24] - lsrs r0, 16 - bx lr - .pool - thumb_func_end sub_802C098 - - thumb_func_start sub_802C0B8 -sub_802C0B8: @ 802C0B8 - push {lr} - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - movs r0, 0x1 - str r0, [r1, 0x10] - movs r0, 0x6 - str r0, [r1, 0x14] - ldr r0, =0x000005ff - strh r0, [r1, 0x34] - bl sub_802C270 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C0B8 - - thumb_func_start sub_802C0DC -sub_802C0DC: @ 802C0DC - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldr r0, [r0, 0x10] - bx lr - .pool - thumb_func_end sub_802C0DC - - thumb_func_start sub_802C0E8 -sub_802C0E8: @ 802C0E8 - push {r4,r5,lr} - ldr r5, =gUnknown_02022CFC - ldr r4, =0x000082f8 - movs r3, 0 - movs r2, 0 - movs r1, 0x4 -_0802C0F4: - ldr r0, [r5] - adds r0, r4 - adds r0, r2 - str r3, [r0] - adds r2, 0x28 - subs r1, 0x1 - cmp r1, 0 - bge _0802C0F4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C0E8 - - thumb_func_start sub_802C114 -sub_802C114: @ 802C114 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldr r1, =0x000083ac - adds r0, r1 - ldr r1, [r0] - movs r2, 0 - strh r2, [r1, 0x10] - ldr r0, [r0] - strh r2, [r0, 0x12] - bx lr - .pool - thumb_func_end sub_802C114 - - thumb_func_start sub_802C130 -sub_802C130: @ 802C130 - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gUnknown_02022CFC - ldr r2, [r1] - ldrb r3, [r2, 0x6] - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r2, r1 - ldr r1, =0x000082f4 - adds r2, r1 - ldrh r1, [r2] - cmp r1, r0 - beq _0802C15C - movs r0, 0 - b _0802C15E - .pool -_0802C15C: - movs r0, 0x1 -_0802C15E: - pop {r1} - bx r1 - thumb_func_end sub_802C130 - - thumb_func_start sub_802C164 -sub_802C164: @ 802C164 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldr r1, =0x000083ac - adds r2, r0, r1 - ldr r1, [r2] - adds r0, 0x4A - ldrh r0, [r0] - strh r0, [r1, 0xE] - ldr r1, [r2] - ldrh r0, [r1, 0x10] - strh r0, [r1, 0x12] - ldr r1, [r2] - movs r0, 0x1 - strh r0, [r1, 0x10] - bx lr - .pool - thumb_func_end sub_802C164 - - thumb_func_start sub_802C18C -sub_802C18C: @ 802C18C - push {r4,lr} - ldr r0, =gUnknown_02022CFC - ldr r2, [r0] - ldr r0, =0x000083ac - adds r3, r2, r0 - ldr r1, [r3] - ldrh r0, [r1, 0x10] - strh r0, [r1, 0x12] - ldr r0, [r3] - movs r4, 0x2 - strh r4, [r0, 0x10] - ldr r1, [r3] - adds r2, 0x4A - ldrh r0, [r2] - strh r0, [r1, 0xE] - ldr r0, [r3] - str r4, [r0, 0x14] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C18C - - thumb_func_start sub_802C1BC -sub_802C1BC: @ 802C1BC - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldr r1, =0x000083ac - adds r0, r1 - ldr r1, [r0] - ldrh r2, [r1, 0x10] - movs r3, 0 - strh r2, [r1, 0x12] - ldr r0, [r0] - strh r3, [r0, 0x10] - bx lr - .pool - thumb_func_end sub_802C1BC - - thumb_func_start sub_802C1DC -sub_802C1DC: @ 802C1DC - push {r4,r5,lr} - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - ldr r0, [r1, 0x5C] - cmp r0, 0 - beq _0802C21C - ldr r0, [r1, 0x78] - bl sub_802DD64 - ldr r1, [r4] - movs r5, 0 - str r5, [r1, 0x5C] - adds r0, r1, 0 - adds r0, 0x4D - ldrb r0, [r0] - cmp r0, 0 - beq _0802C21C - adds r0, r1, 0 - adds r0, 0x71 - ldrb r0, [r0] - bl sub_802DCCC - ldr r1, =gUnknown_082FB654 - subs r0, 0x2 - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - bl PlaySE - ldr r0, [r4] - adds r0, 0x4D - strb r5, [r0] -_0802C21C: - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - adds r0, 0x74 - ldrh r0, [r0] - bl sub_802DD74 - bl sub_802C280 - bl sub_802C240 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C1DC - - thumb_func_start sub_802C240 -sub_802C240: @ 802C240 - push {lr} - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x46 - ldrb r0, [r0] - cmp r0, 0 - beq _0802C256 - ldr r0, [r1, 0x14] - bl sub_802DC9C -_0802C256: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C240 - - thumb_func_start sub_802C260 -sub_802C260: @ 802C260 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - adds r0, 0x46 - movs r1, 0 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_802C260 - - thumb_func_start sub_802C270 -sub_802C270: @ 802C270 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - adds r0, 0x46 - movs r1, 0x1 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_802C270 - - thumb_func_start sub_802C280 -sub_802C280: @ 802C280 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r6, 0 - ldr r2, =gUnknown_02022CFC - ldr r0, [r2] - ldrb r0, [r0, 0x5] - mov r9, r0 - movs r5, 0 - cmp r6, r9 - bge _0802C360 - mov r10, r2 - mov r8, r5 - movs r7, 0 -_0802C2A2: - mov r0, r10 - ldr r3, [r0] - adds r1, r3, r7 - ldr r2, =0x000082f4 - adds r0, r1, r2 - ldrh r2, [r0] - cmp r2, 0x1 - beq _0802C2D4 - cmp r2, 0x1 - bgt _0802C2C4 - cmp r2, 0 - beq _0802C2CA - b _0802C354 - .pool -_0802C2C4: - cmp r2, 0x2 - beq _0802C338 - b _0802C354 -_0802C2CA: - adds r0, r5, 0 - movs r1, 0 - bl sub_802DC80 - b _0802C354 -_0802C2D4: - ldr r0, =0x000082f6 - adds r4, r1, r0 - ldrh r0, [r4] - cmp r0, 0x1 - bne _0802C2F6 - ldr r0, =0x000082f2 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0x9A - add r1, r8 - str r1, [sp] - ldrh r1, [r0] - mov r12, r1 - ldr r0, [sp] - ldrh r0, [r0] - cmp r12, r0 - beq _0802C31E -_0802C2F6: - ldrb r3, [r3, 0x6] - cmp r5, r3 - bne _0802C2FE - strh r2, [r4] -_0802C2FE: - orrs r6, r2 - mov r1, r10 - ldr r2, [r1] - ldr r1, =0x000082e8 - adds r0, r2, r1 - adds r0, r7 - ldr r1, =0x7fffffff - str r1, [r0] - adds r1, r2, 0 - adds r1, 0x9A - add r1, r8 - adds r2, r7 - ldr r0, =0x000082f2 - adds r2, r0 - ldrh r0, [r2] - strh r0, [r1] -_0802C31E: - adds r0, r5, 0 - bl sub_802C398 - b _0802C354 - .pool -_0802C338: - ldr r0, =0x000082f6 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0x2 - beq _0802C354 - ldrb r3, [r3, 0x6] - cmp r5, r3 - bne _0802C34A - strh r2, [r1] -_0802C34A: - orrs r6, r2 - lsls r0, r5, 24 - lsrs r0, 24 - bl sub_802DD88 -_0802C354: - movs r1, 0x2 - add r8, r1 - adds r7, 0x28 - adds r5, 0x1 - cmp r5, r9 - blt _0802C2A2 -_0802C360: - movs r0, 0x2 - ands r0, r6 - cmp r0, 0 - beq _0802C378 - movs r0, 0x83 - lsls r0, 1 - bl PlaySE - b _0802C386 - .pool -_0802C378: - movs r0, 0x1 - ands r6, r0 - cmp r6, 0 - beq _0802C386 - movs r0, 0xA - bl PlaySE -_0802C386: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_802C280 - - thumb_func_start sub_802C398 -sub_802C398: @ 802C398 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r0, =gUnknown_02022CFC - ldr r2, [r0] - ldr r0, [r2, 0x68] - cmp r0, 0 - bne _0802C432 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =0x000082e4 - adds r0, r1 - adds r5, r2, r0 - ldr r1, [r5, 0x4] - ldr r0, =0x7fffffff - cmp r1, r0 - beq _0802C3D0 - adds r0, r1, 0x1 - str r0, [r5, 0x4] - adds r3, r0, 0 - b _0802C3E8 - .pool -_0802C3D0: - adds r0, r2, 0 - adds r0, 0x4A - ldrh r1, [r0] - ldrh r0, [r5, 0xE] - subs r3, r1, r0 - ldr r0, =0x0000fde7 - cmp r3, r0 - ble _0802C3E6 - ldr r0, =0xffff0218 - adds r3, r0 - adds r3, r1 -_0802C3E6: - str r3, [r5, 0x4] -_0802C3E8: - cmp r3, 0x3 - ble _0802C432 - subs r3, 0x4 - cmp r3, 0x2F - bgt _0802C414 - ldr r2, =gUnknown_082FB65C - ldrh r1, [r5, 0xC] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 4 - adds r0, r3, r0 - adds r0, r2 - movs r4, 0 - ldrsb r4, [r0, r4] - b _0802C416 - .pool -_0802C414: - movs r4, 0 -_0802C416: - adds r1, r4, 0 - adds r0, r6, 0 - bl sub_802DC80 - cmp r4, 0 - bne _0802C430 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r6, r0 - bne _0802C430 - bl sub_802C1BC -_0802C430: - str r4, [r5] -_0802C432: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C398 - - thumb_func_start sub_802C43C -sub_802C43C: @ 802C43C - push {r4,r5,lr} - ldr r5, =gUnknown_02022CFC - ldr r1, [r5] - ldr r0, [r1, 0x14] - cmp r0, 0x8 - bne _0802C4CE - ldr r0, [r1, 0x18] - cmp r0, 0x7 - bne _0802C4CE - ldr r4, [r1, 0x58] - cmp r4, 0 - bne _0802C46C - bl sub_802C780 - ldr r0, [r5] - str r4, [r0, 0x54] - movs r1, 0x1 - str r1, [r0, 0x58] - adds r0, 0x71 - strb r4, [r0] - b _0802C4CE - .pool -_0802C46C: - ldr r0, [r1, 0x54] - cmp r0, 0x5 - bne _0802C480 - ldrh r0, [r1, 0xC] - adds r0, 0x1 - strh r0, [r1, 0xC] - ldrh r0, [r1, 0xC] - bl sub_802C7A0 - b _0802C484 -_0802C480: - movs r0, 0 - strh r0, [r1, 0xC] -_0802C484: - ldr r4, =gUnknown_02022CFC - ldr r1, [r4] - ldr r0, [r1, 0x54] - cmp r0, 0x1 - ble _0802C49E - movs r0, 0x1 - str r0, [r1, 0x64] - adds r0, r1, 0 - adds r0, 0x86 - adds r1, 0x81 - movs r2, 0x5 - bl memcpy -_0802C49E: - bl sub_802C780 - ldr r0, [r4] - movs r2, 0 - str r2, [r0, 0x54] - movs r1, 0x1 - str r1, [r0, 0x58] - adds r0, 0x71 - strb r2, [r0] - ldr r0, [r4] - adds r2, r0, 0 - adds r2, 0x74 - ldrh r1, [r2] - ldr r0, =0x0000270e - cmp r1, r0 - bhi _0802C4C2 - adds r0, r1, 0x1 - strh r0, [r2] -_0802C4C2: - movs r0, 0xA - bl sub_802C688 - movs r0, 0x3 - bl sub_802AE14 -_0802C4CE: - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldr r0, [r0, 0x64] - cmp r0, 0 - beq _0802C504 - bl sub_802C618 - cmp r0, 0x1 - beq _0802C4E8 - ldr r0, [r4] - ldr r0, [r0, 0x14] - cmp r0, 0 - bne _0802C504 -_0802C4E8: - ldr r0, [r4] - adds r0, 0x86 - bl sub_802C73C - bl sub_802C790 - bl sub_802C688 - movs r0, 0x3 - bl sub_802AE14 - ldr r1, [r4] - movs r0, 0 - str r0, [r1, 0x64] -_0802C504: - ldr r4, =gUnknown_02022CFC - ldr r0, [r4] - ldr r0, [r0, 0x58] - cmp r0, 0 - beq _0802C52A - bl sub_802C6B0 - adds r2, r0, 0 - ldr r1, [r4] - ldr r0, [r1, 0x54] - cmp r2, r0 - ble _0802C52A - str r2, [r1, 0x54] - adds r0, r1, 0 - adds r0, 0x81 - adds r1, 0x7C - movs r2, 0x5 - bl memcpy -_0802C52A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C43C - - thumb_func_start sub_802C538 -sub_802C538: @ 802C538 - push {r4,r5,lr} - ldr r5, =gUnknown_02022CFC - ldr r1, [r5] - ldr r0, [r1, 0x14] - cmp r0, 0x6 - bne _0802C582 - ldr r4, =0x000083ac - adds r0, r1, r4 - ldr r1, [r0] - ldr r0, [r1] - cmp r0, 0 - bne _0802C582 - ldrh r0, [r1, 0x12] - cmp r0, 0x1 - bne _0802C578 - bl sub_802C0DC - adds r1, r0, 0 - cmp r1, 0x1 - bne _0802C578 - ldr r0, [r5] - adds r0, r4 - ldr r0, [r0] - str r1, [r0, 0x14] - b _0802C582 - .pool -_0802C574: - movs r0, 0 - b _0802C5CA -_0802C578: - bl sub_802C18C - movs r0, 0x3 - bl sub_802AE14 -_0802C582: - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - ldr r0, [r1, 0x14] - cmp r0, 0x7 - bne _0802C5A8 - ldr r0, [r1, 0x18] - cmp r0, 0x6 - bne _0802C5A8 - ldr r2, =0x000083ac - adds r0, r1, r2 - ldr r1, [r0] - ldrh r0, [r1, 0x10] - cmp r0, 0x2 - beq _0802C5A8 - movs r0, 0x1 - str r0, [r1, 0x14] - movs r0, 0x3 - bl sub_802AE14 -_0802C5A8: - movs r2, 0 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldrb r1, [r0, 0x5] - cmp r2, r1 - bge _0802C5C8 - adds r3, r1, 0 - ldr r4, =0x000082f4 - adds r1, r0, r4 -_0802C5BA: - ldrh r0, [r1] - cmp r0, 0x2 - beq _0802C574 - adds r1, 0x28 - adds r2, 0x1 - cmp r2, r3 - blt _0802C5BA -_0802C5C8: - movs r0, 0x1 -_0802C5CA: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802C538 - - thumb_func_start sub_802C5DC -sub_802C5DC: @ 802C5DC - push {r4,lr} - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldrb r3, [r0, 0x5] - movs r4, 0 - cmp r4, r3 - bge _0802C600 - ldr r1, =0x000082f8 - adds r2, r0, r1 - adds r1, r3, 0 -_0802C5F0: - ldr r0, [r2] - cmp r0, 0 - beq _0802C5F8 - adds r4, 0x1 -_0802C5F8: - adds r2, 0x28 - subs r1, 0x1 - cmp r1, 0 - bne _0802C5F0 -_0802C600: - movs r0, 0 - cmp r4, r3 - bne _0802C608 - movs r0, 0x1 -_0802C608: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802C5DC - - thumb_func_start sub_802C618 -sub_802C618: @ 802C618 - push {r4,lr} - movs r2, 0 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldrb r1, [r0, 0x5] - cmp r2, r1 - bge _0802C648 - adds r3, r1, 0 - ldr r4, =0x000082f8 - adds r1, r0, r4 -_0802C62C: - ldr r0, [r1] - cmp r0, 0x1 - beq _0802C640 - movs r0, 0 - b _0802C64A - .pool -_0802C640: - adds r1, 0x28 - adds r2, 0x1 - cmp r2, r3 - blt _0802C62C -_0802C648: - movs r0, 0x1 -_0802C64A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802C618 - - thumb_func_start sub_802C650 -sub_802C650: @ 802C650 - push {lr} - ldr r0, =gUnknown_02022CFC - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x45 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0802C668 -_0802C660: - movs r0, 0 - b _0802C684 - .pool -_0802C668: - movs r2, 0x1 - ldrb r0, [r1, 0x5] - cmp r2, r0 - bge _0802C682 - adds r3, r0, 0 - adds r1, 0x92 -_0802C674: - ldrh r0, [r1] - cmp r0, 0x1 - beq _0802C660 - adds r1, 0x2 - adds r2, 0x1 - cmp r2, r3 - blt _0802C674 -_0802C682: - movs r0, 0x1 -_0802C684: - pop {r1} - bx r1 - thumb_func_end sub_802C650 - - thumb_func_start sub_802C688 -sub_802C688: @ 802C688 - push {lr} - ldr r1, =gUnknown_02022CFC - ldr r2, [r1] - ldr r1, [r2, 0x78] - adds r1, r0 - str r1, [r2, 0x78] - movs r0, 0x1 - str r0, [r2, 0x5C] - ldr r0, =0x00018695 - cmp r1, r0 - bls _0802C6A2 - adds r0, 0x1 - str r0, [r2, 0x78] -_0802C6A2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C688 - - thumb_func_start sub_802C6B0 -sub_802C6B0: @ 802C6B0 - push {r4-r7,lr} - movs r5, 0 - ldr r1, =gUnknown_02022CFC - ldr r0, [r1] - ldrb r4, [r0, 0x5] - movs r2, 0 - cmp r5, r4 - bge _0802C702 - mov r12, r1 - movs r3, 0 - ldr r7, =0x000082e4 - movs r6, 0x1E - negs r6, r6 -_0802C6CA: - mov r0, r12 - ldr r1, [r0] - adds r0, r1, r7 - adds r0, r3 - ldr r0, [r0] - cmp r0, r6 - bne _0802C6F0 - adds r0, r1, 0 - adds r0, 0x7C - adds r0, r2 - movs r1, 0x1 - strb r1, [r0] - adds r5, 0x1 - b _0802C6FA - .pool -_0802C6F0: - adds r0, r1, 0 - adds r0, 0x7C - adds r0, r2 - movs r1, 0 - strb r1, [r0] -_0802C6FA: - adds r3, 0x28 - adds r2, 0x1 - cmp r2, r4 - blt _0802C6CA -_0802C702: - adds r0, r5, 0 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_802C6B0 - - thumb_func_start sub_802C70C -sub_802C70C: @ 802C70C - push {lr} - movs r2, 0 - ldr r1, =gUnknown_03005000 - ldr r3, =0x000009e6 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _0802C728 - ldr r3, =0x00000c1a - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _0802C728 - movs r2, 0x1 -_0802C728: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802C70C - - thumb_func_start sub_802C73C -sub_802C73C: @ 802C73C - push {r4-r6,lr} - adds r4, r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - ldr r6, =gUnknown_02022CFC - movs r5, 0x1 -_0802C74A: - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0802C75A - adds r0, r5, 0 - lsls r0, r1 - orrs r2, r0 - adds r3, 0x1 -_0802C75A: - adds r1, 0x1 - cmp r1, 0x4 - ble _0802C74A - ldr r0, [r6] - adds r0, 0x71 - strb r2, [r0] - cmp r2, 0 - beq _0802C772 - ldr r0, [r6] - adds r0, 0x4D - movs r1, 0x1 - strb r1, [r0] -_0802C772: - adds r0, r3, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802C73C - - thumb_func_start sub_802C780 -sub_802C780: @ 802C780 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - adds r0, 0x44 - movs r1, 0 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_802C780 - - thumb_func_start sub_802C790 -sub_802C790: @ 802C790 - ldr r1, =gUnknown_082FB6EC - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bx lr - .pool - thumb_func_end sub_802C790 - - thumb_func_start sub_802C7A0 -sub_802C7A0: @ 802C7A0 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldrh r2, [r0, 0xE] - cmp r1, r2 - bls _0802C7B2 - strh r1, [r0, 0xE] -_0802C7B2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C7A0 - - thumb_func_start sub_802C7BC -sub_802C7BC: @ 802C7BC - push {lr} - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldr r1, =gUnknown_082FB714 - ldr r2, [r0, 0x78] - ldr r0, [r1] - cmp r2, r0 - bcs _0802C7D8 - movs r0, 0 - b _0802C7DA - .pool -_0802C7D8: - movs r0, 0x1 -_0802C7DA: - pop {r1} - bx r1 - thumb_func_end sub_802C7BC - - thumb_func_start sub_802C7E0 -sub_802C7E0: @ 802C7E0 - push {r4,lr} - bl sub_802C818 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_802C838 - lsls r0, 16 - lsrs r0, 4 - ldr r1, =0x00000fff - ands r4, r1 - orrs r0, r4 - lsls r0, 16 - lsrs r0, 16 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802C7E0 - - thumb_func_start sub_802C808 -sub_802C808: @ 802C808 - lsls r0, 16 - lsrs r3, r0, 28 - strh r3, [r2] - lsls r0, 4 - lsrs r0, 20 - strh r0, [r1] - bx lr - thumb_func_end sub_802C808 - - thumb_func_start sub_802C818 -sub_802C818: @ 802C818 - push {lr} - bl Random - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - ldr r0, =gUnknown_082FB704 - lsrs r1, 15 - adds r1, r0 - ldrh r0, [r1] - pop {r1} - bx r1 - .pool - thumb_func_end sub_802C818 - - thumb_func_start sub_802C838 -sub_802C838: @ 802C838 - push {r4-r6,lr} - movs r5, 0 - movs r4, 0 - ldr r3, =gUnknown_02022CFC - ldr r0, [r3] - ldr r2, =gUnknown_082FB714 - ldr r1, [r0, 0x78] - ldr r0, [r2] - cmp r1, r0 - bcc _0802C874 - ldr r5, [r2, 0x4] - adds r6, r3, 0 - adds r3, r2, 0x4 -_0802C852: - adds r3, 0x8 - adds r2, 0x8 - adds r4, 0x1 - cmp r4, 0x4 - bhi _0802C874 - ldr r0, [r6] - ldr r1, [r0, 0x78] - ldr r0, [r2] - cmp r1, r0 - bcc _0802C874 - ldr r5, [r3] - b _0802C852 - .pool -_0802C874: - lsls r0, r5, 16 - lsrs r0, 16 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_802C838 - - thumb_func_start sub_802C880 -sub_802C880: @ 802C880 - push {r4,r5,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 16 - lsrs r4, r1, 16 - b _0802C892 -_0802C88C: - subs r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 -_0802C892: - cmp r4, 0 - beq _0802C8A4 - adds r0, r5, 0 - adds r1, r4, 0 - bl CheckBagHasSpace - lsls r0, 24 - cmp r0, 0 - beq _0802C88C -_0802C8A4: - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802C880 - - thumb_func_start sub_802C8AC -sub_802C8AC: @ 802C8AC - push {lr} - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_802C8AC - - thumb_func_start sub_802C8BC -sub_802C8BC: @ 802C8BC - ldr r0, =gUnknown_02022CFC - ldr r0, [r0] - ldrb r0, [r0, 0x6] - bx lr - .pool - thumb_func_end sub_802C8BC - - thumb_func_start sub_802C8C8 -sub_802C8C8: @ 802C8C8 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_02022CFC - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - ldr r0, =0x000082a8 - adds r1, r0 - ldr r0, [r2] - adds r0, r1 - bx lr - .pool - thumb_func_end sub_802C8C8 - - thumb_func_start sub_802C8E8 -sub_802C8E8: @ 802C8E8 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_02022CFC - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - ldr r1, [r2] - adds r0, r1 - movs r1, 0x83 - lsls r1, 8 - adds r0, r1 - bx lr - .pool - thumb_func_end sub_802C8E8 - - thumb_func_start sub_802C908 -sub_802C908: @ 802C908 - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl sub_802AC00 - lsls r0, 16 - asrs r0, 16 - mvns r0, r0 - lsrs r0, 31 - pop {r1} - bx r1 - thumb_func_end sub_802C908 - - thumb_func_start sub_802C920 -sub_802C920: @ 802C920 - push {r4,r5,lr} - movs r5, 0 -_0802C924: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _0802C95C - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl sub_802C908 - cmp r0, 0 - beq _0802C95C - ldr r1, =gScriptResult - movs r0, 0x1 - b _0802C966 - .pool -_0802C95C: - adds r5, 0x1 - cmp r5, 0x5 - ble _0802C924 - ldr r1, =gScriptResult - movs r0, 0 -_0802C966: - strh r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C920 - - thumb_func_start sub_802C974 -sub_802C974: @ 802C974 - push {r4-r6,lr} - adds r6, r0, 0 - movs r4, 0 - ldr r5, =gUnknown_082FBE08 -_0802C97C: - adds r0, r5, 0 - bl LoadCompressedObjectPic - adds r5, 0x8 - adds r4, 0x1 - cmp r4, 0x4 - bls _0802C97C - movs r4, 0 - ldr r5, =gUnknown_082FBE30 -_0802C98E: - adds r0, r5, 0 - bl LoadSpritePalette - adds r5, 0x8 - adds r4, 0x1 - cmp r4, 0x1 - bls _0802C98E - movs r0, 0x5 - bl IndexOfSpritePaletteTag - strb r0, [r6, 0xE] - movs r0, 0x6 - bl IndexOfSpritePaletteTag - strb r0, [r6, 0xF] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C974 - - thumb_func_start sub_802C9BC -sub_802C9BC: @ 802C9BC - push {lr} - movs r2, 0 - movs r1, 0x7 - adds r0, 0x3C -_0802C9C4: - strh r2, [r0] - subs r0, 0x2 - subs r1, 0x1 - cmp r1, 0 - bge _0802C9C4 - pop {r0} - bx r0 - thumb_func_end sub_802C9BC - - thumb_func_start sub_802C9D4 -sub_802C9D4: @ 802C9D4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - mov r9, r0 - adds r7, r1, 0 - ldr r0, [sp, 0x54] - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x28] - lsls r3, 16 - lsrs r3, 16 - str r3, [sp, 0x2C] - lsls r0, 24 - lsrs r6, r0, 24 - mov r1, sp - ldr r0, =gUnknown_082FBE40 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - movs r0, 0x80 - lsls r0, 6 - bl Alloc - mov r8, r0 - movs r0, 0x80 - lsls r0, 4 - bl Alloc - mov r10, r0 - bl sub_802C8BC - lsls r0, 16 - lsrs r0, 16 - cmp r6, r0 - bne _0802CA2C - movs r0, 0x3 - b _0802CA32 - .pool -_0802CA2C: - adds r0, r6, 0x4 - lsls r0, 24 - lsrs r0, 24 -_0802CA32: - str r0, [sp, 0x30] - mov r1, r8 - cmp r1, 0 - beq _0802CAF4 - mov r2, r10 - cmp r2, 0 - beq _0802CAF4 - ldrh r2, [r7] - lsls r0, r2, 3 - ldr r1, =gMonStillFrontPicTable - adds r0, r1 - ldr r3, [r7, 0x8] - mov r1, r8 - bl HandleLoadSpecialPokePic - mov r3, r8 - str r3, [sp, 0x18] - adds r4, r6, 0 - add r0, sp, 0x18 - ldr r5, =0xffff0000 - lsls r1, r4, 16 - movs r2, 0x80 - lsls r2, 4 - orrs r1, r2 - str r1, [r0, 0x4] - bl LoadSpriteSheet - ldrh r0, [r7] - ldr r1, [r7, 0x4] - ldr r2, [r7, 0x8] - bl species_and_otid_get_pal - str r0, [sp, 0x20] - add r0, sp, 0x20 - ldr r1, [r0, 0x4] - ands r1, r5 - orrs r1, r4 - str r1, [r0, 0x4] - bl LoadCompressedObjectPalette - mov r0, r8 - bl Free - mov r0, r10 - bl Free - mov r1, sp - mov r0, sp - ldrh r0, [r0] - adds r0, r6 - strh r0, [r1] - mov r0, sp - ldrh r0, [r0, 0x2] - adds r0, r6 - strh r0, [r1, 0x2] - ldr r4, [sp, 0x28] - lsls r1, r4, 16 - asrs r1, 16 - ldr r0, [sp, 0x2C] - lsls r2, r0, 16 - asrs r2, 16 - mov r0, sp - ldr r3, [sp, 0x30] - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _0802CAF4 - lsls r0, r6, 2 - ldr r2, =0x000081a8 - add r2, r9 - adds r2, r0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r2] - ldr r0, =0x000081fc - add r0, r9 - adds r0, r6 - add r1, sp, 0x30 - ldrb r1, [r1] - strb r1, [r0] - b _0802CB00 - .pool -_0802CAF4: - lsls r0, r6, 2 - ldr r1, =0x000081a8 - add r1, r9 - adds r1, r0 - movs r0, 0 - str r0, [r1] -_0802CB00: - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802C9D4 - - thumb_func_start sub_802CB14 -sub_802CB14: @ 802CB14 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r6, r1, 2 - ldr r0, =0x000081bc - adds r5, r4, r0 - adds r5, r6 - ldr r0, [r5] - bl sub_802C9BC - ldr r2, [r5] - ldr r0, =0x000081a8 - adds r4, r0 - adds r4, r6 - ldr r1, [r4] - ldr r0, =gSprites - subs r1, r0 - lsls r0, r1, 4 - subs r0, r1 - lsls r1, r0, 8 - adds r0, r1 - lsls r1, r0, 16 - adds r0, r1 - negs r0, r0 - asrs r0, 2 - strh r0, [r2, 0x3C] - ldr r1, [r5] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, [r5] - movs r0, 0x60 - strh r0, [r1, 0x22] - ldr r0, [r5] - ldr r1, =sub_802CB7C - str r1, [r0, 0x1C] - movs r1, 0x1 - bl StartSpriteAnim - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CB14 - - thumb_func_start sub_802CB7C -sub_802CB7C: @ 802CB7C - push {lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0x1 - beq _0802CBA8 - cmp r0, 0x1 - bgt _0802CB92 - cmp r0, 0 - beq _0802CB98 - b _0802CBE6 -_0802CB92: - cmp r0, 0x2 - beq _0802CBC8 - b _0802CBE6 -_0802CB98: - adds r0, r2, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0802CBE6 - b _0802CBD6 -_0802CBA8: - ldrh r1, [r2, 0x22] - subs r1, 0x1 - strh r1, [r2, 0x22] - ldrh r0, [r2, 0x30] - adds r0, 0x1 - strh r0, [r2, 0x30] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x48 - bgt _0802CBE6 - movs r0, 0x48 - strh r0, [r2, 0x22] - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - b _0802CBE6 -_0802CBC8: - ldrh r0, [r2, 0x30] - adds r0, 0x1 - strh r0, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2F - ble _0802CBE6 -_0802CBD6: - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_0802CBE6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CB7C - - thumb_func_start sub_802CBF0 -sub_802CBF0: @ 802CBF0 - push {lr} - lsls r1, 2 - ldr r2, =0x000081a8 - adds r0, r2 - adds r0, r1 - ldr r2, [r0] - ldr r1, =sub_802CC40 - str r1, [r2, 0x1C] - movs r1, 0 - strh r1, [r2, 0x26] - ldr r0, [r0] - bl sub_802C9BC - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CBF0 - - thumb_func_start sub_802CC18 -sub_802CC18: @ 802CC18 - push {lr} - movs r2, 0 - lsls r1, 2 - ldr r3, =0x000081a8 - adds r0, r3 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0, 0x1C] - ldr r0, =sub_802CC40 - cmp r1, r0 - bne _0802CC30 - movs r2, 0x1 -_0802CC30: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802CC18 - - thumb_func_start sub_802CC40 -sub_802CC40: @ 802CC40 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x30] - adds r0, 0x1 - strh r0, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0802CC6C - ldrh r0, [r2, 0x32] - adds r0, 0x1 - strh r0, [r2, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0802CC64 - movs r0, 0x2 - b _0802CC66 -_0802CC64: - ldr r0, =0x0000fffe -_0802CC66: - strh r0, [r2, 0x26] - movs r0, 0 - strh r0, [r2, 0x30] -_0802CC6C: - movs r1, 0x32 - ldrsh r0, [r2, r1] - cmp r0, 0xC - ble _0802CC7C - movs r0, 0 - strh r0, [r2, 0x26] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_0802CC7C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CC40 - - thumb_func_start sub_802CC88 -sub_802CC88: @ 802CC88 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 2 - ldr r0, =0x000081a8 - adds r4, r0 - adds r4, r1 - ldr r0, [r4] - bl sub_802C9BC - ldr r1, [r4] - ldr r0, =sub_802CD08 - str r0, [r1, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CC88 - - thumb_func_start sub_802CCB0 -sub_802CCB0: @ 802CCB0 - push {r4-r7,lr} - adds r4, r0, 0 - bl sub_802C8AC - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - beq _0802CCF4 - movs r1, 0x5 - negs r1, r1 - mov r12, r1 - ldr r1, =0x000081a8 - adds r3, r4, r1 - ldr r7, =sub_802CD08 - ldr r6, =SpriteCallbackDummy - movs r5, 0xA - adds r4, r0, 0 -_0802CCD2: - ldr r2, [r3] - ldr r0, [r2, 0x1C] - cmp r0, r7 - bne _0802CCEC - adds r2, 0x3E - ldrb r1, [r2] - mov r0, r12 - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - str r6, [r0, 0x1C] - adds r0, 0x43 - strb r5, [r0] -_0802CCEC: - adds r3, 0x4 - subs r4, 0x1 - cmp r4, 0 - bne _0802CCD2 -_0802CCF4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CCB0 - - thumb_func_start sub_802CD08 -sub_802CD08: @ 802CD08 - push {lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x2E] - adds r0, 0x1 - strh r0, [r3, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _0802CD36 - movs r0, 0 - strh r0, [r3, 0x2E] - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_0802CD36: - pop {r0} - bx r0 - thumb_func_end sub_802CD08 - - thumb_func_start sub_802CD3C -sub_802CD3C: @ 802CD3C - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_802C8AC - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - cmp r2, r3 - bge _0802CD66 - ldr r0, =0x000081fc - adds r5, r4, r0 - subs r0, 0x54 - adds r4, r0 -_0802CD56: - ldm r4!, {r0} - adds r1, r5, r2 - ldrb r1, [r1] - adds r0, 0x43 - strb r1, [r0] - adds r2, 0x1 - cmp r2, r3 - blt _0802CD56 -_0802CD66: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CD3C - - thumb_func_start sub_802CD70 -sub_802CD70: @ 802CD70 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 2 - ldr r0, =0x000081a8 - adds r4, r0 - adds r4, r1 - ldr r0, [r4] - bl sub_802C9BC - ldr r1, [r4] - ldr r0, =sub_802CDD4 - str r0, [r1, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CD70 - - thumb_func_start sub_802CD98 -sub_802CD98: @ 802CD98 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_802C8AC - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - cmp r2, r3 - bge _0802CDCC - ldr r5, =sub_802CDD4 - ldr r0, =0x000081a8 - adds r1, r4, r0 -_0802CDB0: - ldr r0, [r1] - ldr r0, [r0, 0x1C] - cmp r0, r5 - bne _0802CDC4 - movs r0, 0x1 - b _0802CDCE - .pool -_0802CDC4: - adds r1, 0x4 - adds r2, 0x1 - cmp r2, r3 - blt _0802CDB0 -_0802CDCC: - movs r0, 0 -_0802CDCE: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802CD98 - - thumb_func_start sub_802CDD4 -sub_802CDD4: @ 802CDD4 - push {r4,r5,lr} - adds r5, r0, 0 - movs r0, 0x2E - ldrsh r4, [r5, r0] - cmp r4, 0 - beq _0802CDE6 - cmp r4, 0x1 - beq _0802CDF4 - b _0802CE3C -_0802CDE6: - movs r0, 0x22 - bl PlaySE - strh r4, [r5, 0x30] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] -_0802CDF4: - ldrh r0, [r5, 0x30] - adds r0, 0x4 - strh r0, [r5, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7F - ble _0802CE06 - movs r0, 0 - strh r0, [r5, 0x30] -_0802CE06: - ldr r1, =gSineTable - movs r2, 0x30 - ldrsh r0, [r5, r2] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 16 - asrs r0, 19 - negs r0, r0 - strh r0, [r5, 0x26] - movs r0, 0x30 - ldrsh r1, [r5, r0] - cmp r1, 0 - bne _0802CE3C - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bgt _0802CE38 - strh r1, [r5, 0x2E] - b _0802CE3C - .pool -_0802CE38: - ldr r0, =SpriteCallbackDummy - str r0, [r5, 0x1C] -_0802CE3C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CDD4 - - thumb_func_start sub_802CE48 -sub_802CE48: @ 802CE48 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r3, 24 - lsrs r4, r3, 24 - ldr r0, =gUnknown_082FC00C - lsls r1, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _0802CE88 - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - adds r3, r1, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r3] - lsls r2, r4, 2 - ldr r3, =0x000081bc - adds r0, r5, r3 - adds r0, r2 - str r1, [r0] -_0802CE88: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CE48 - - thumb_func_start sub_802CE9C -sub_802CE9C: @ 802CE9C - push {r4-r7,lr} - adds r7, r0, 0 - movs r5, 0 - movs r4, 0 - ldr r6, =gUnknown_082FBE58 -_0802CEA6: - ldr r1, =gUnknown_082FBEB8 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - ldr r2, =gUnknown_082FBEA8 - lsls r1, r5, 1 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - movs r3, 0 - ldrsh r2, [r6, r3] - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r5, 2 - ldr r3, =0x000081d0 - adds r2, r7, r3 - adds r2, r0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r2] - adds r5, 0x1 - adds r6, 0x14 - adds r4, 0x1 - cmp r4, 0x3 - ble _0802CEA6 - movs r4, 0x3 - movs r6, 0x3C -_0802CEE8: - ldr r1, =gUnknown_082FBEB8 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - ldr r2, =gUnknown_082FBEA8 - lsls r1, r5, 1 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - ldr r2, =gUnknown_082FBE58 - adds r2, r6, r2 - movs r3, 0 - ldrsh r2, [r2, r3] - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r5, 2 - ldr r3, =0x000081d0 - adds r2, r7, r3 - adds r2, r0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r2] - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - adds r5, 0x1 - subs r6, 0x14 - subs r4, 0x1 - cmp r4, 0 - bge _0802CEE8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CE9C - - thumb_func_start sub_802CF50 -sub_802CF50: @ 802CF50 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - str r0, [sp, 0x8] - cmp r1, 0x5 - ble _0802CF70 - movs r0, 0xA - subs r1, r0, r1 - movs r0, 0x3 - str r0, [sp] - ldr r2, [sp, 0x8] - ldrb r0, [r2, 0xF] - b _0802CF78 -_0802CF70: - movs r3, 0x2 - str r3, [sp] - ldr r7, [sp, 0x8] - ldrb r0, [r7, 0xE] -_0802CF78: - movs r6, 0 - lsls r2, r1, 1 - str r2, [sp, 0x4] - lsls r0, 4 - mov r9, r0 - lsls r1, 24 - mov r8, r1 - ldr r0, =gUnknown_082FBE58 - adds r4, r2, r0 - ldr r3, [sp] - lsls r3, 2 - mov r10, r3 - movs r5, 0x3 -_0802CF92: - lsls r0, r6, 2 - ldr r7, [sp, 0x8] - ldr r1, =0x000081d0 - adds r2, r7, r1 - adds r2, r0 - ldr r1, [r2] - ldrh r0, [r4] - strh r0, [r1, 0x22] - ldr r3, [r2] - ldrb r0, [r3, 0x5] - movs r7, 0xD - negs r7, r7 - adds r1, r7, 0 - ands r0, r1 - mov r1, r10 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r3, [r2] - ldrb r1, [r3, 0x5] - movs r0, 0xF - ands r0, r1 - mov r7, r9 - orrs r0, r7 - strb r0, [r3, 0x5] - ldr r0, [r2] - mov r2, r8 - lsrs r1, r2, 24 - bl StartSpriteAnim - adds r6, 0x1 - adds r4, 0x14 - subs r5, 0x1 - cmp r5, 0 - bge _0802CF92 - movs r5, 0x3 - ldr r0, =gUnknown_082FBE58 - ldr r3, [sp, 0x4] - adds r0, r3, r0 - adds r4, r0, 0 - adds r4, 0x3C - ldr r7, [sp] - lsls r7, 2 - mov r10, r7 -_0802CFE8: - lsls r0, r6, 2 - ldr r1, [sp, 0x8] - ldr r3, =0x000081d0 - adds r2, r1, r3 - adds r2, r0 - ldr r1, [r2] - ldrh r0, [r4] - strh r0, [r1, 0x22] - ldr r3, [r2] - ldrb r0, [r3, 0x5] - movs r7, 0xD - negs r7, r7 - adds r1, r7, 0 - ands r0, r1 - mov r1, r10 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r3, [r2] - ldrb r1, [r3, 0x5] - movs r0, 0xF - ands r0, r1 - mov r7, r9 - orrs r0, r7 - strb r0, [r3, 0x5] - ldr r0, [r2] - mov r2, r8 - lsrs r1, r2, 24 - bl StartSpriteAnim - adds r6, 0x1 - subs r4, 0x14 - subs r5, 0x1 - cmp r5, 0 - bge _0802CFE8 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CF50 - - thumb_func_start sub_802D044 -sub_802D044: @ 802D044 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r0, 0 - str r0, [sp] - movs r0, 0x9 - movs r1, 0x7 - movs r2, 0x78 - movs r3, 0x50 - bl sub_802EB24 - adds r0, r4, 0 - bl sub_802CD3C - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802D044 - - thumb_func_start sub_802D068 -sub_802D068: @ 802D068 - push {lr} - bl sub_802EB84 - pop {r1} - bx r1 - thumb_func_end sub_802D068 - - thumb_func_start sub_802D074 -sub_802D074: @ 802D074 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - str r0, [r4] - bl sub_802D0BC - ldr r0, =sub_802D12C - movs r1, 0x3 - bl CreateTask - ldr r1, [r4] - strb r0, [r1, 0x6] - ldr r2, [r4] - ldrb r0, [r2, 0x6] - movs r1, 0x2 - bl SetWordTaskArg - ldr r0, =sub_802D150 - bl sub_802D108 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D074 - - thumb_func_start sub_802D0AC -sub_802D0AC: @ 802D0AC - push {lr} - bl FreeAllWindowBuffers - bl sub_8034CC8 - pop {r0} - bx r0 - thumb_func_end sub_802D0AC - - thumb_func_start sub_802D0BC -sub_802D0BC: @ 802D0BC - movs r1, 0 - strh r1, [r0, 0x4] - str r1, [r0] - movs r1, 0xFF - strh r1, [r0, 0x12] - bx lr - thumb_func_end sub_802D0BC - - thumb_func_start sub_802D0C8 -sub_802D0C8: @ 802D0C8 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - ldr r4, =gUnknown_082FE18C -_0802D0D0: - ldr r0, [r4] - cmp r0, r6 - bne _0802D0DC - ldr r0, [r4, 0x4] - bl sub_802D108 -_0802D0DC: - adds r4, 0x8 - adds r5, 0x1 - cmp r5, 0x9 - bls _0802D0D0 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D0C8 - - thumb_func_start sub_802D0F0 -sub_802D0F0: @ 802D0F0 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - ldr r1, [r0] - movs r0, 0x1 - eors r1, r0 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - bx lr - .pool - thumb_func_end sub_802D0F0 - - thumb_func_start sub_802D108 -sub_802D108: @ 802D108 - push {r4,lr} - adds r2, r0, 0 - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrb r0, [r0, 0x6] - movs r1, 0 - bl SetWordTaskArg - ldr r1, [r4] - movs r0, 0 - strh r0, [r1, 0x4] - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D108 - - thumb_func_start sub_802D12C -sub_802D12C: @ 802D12C - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - bne _0802D148 - adds r0, r1, 0 - movs r1, 0 - bl GetWordTaskArg - bl _call_via_r0 -_0802D148: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D12C - - thumb_func_start sub_802D150 -sub_802D150: @ 802D150 - push {r4-r6,lr} - sub sp, 0x8 - ldr r6, =gUnknown_02022D00 - ldr r1, [r6] - ldrh r5, [r1, 0x4] - cmp r5, 0x1 - bne _0802D160 - b _0802D298 -_0802D160: - cmp r5, 0x1 - bgt _0802D170 - cmp r5, 0 - beq _0802D178 - b _0802D2DA - .pool -_0802D170: - cmp r5, 0x2 - bne _0802D176 - b _0802D2D6 -_0802D176: - b _0802D2DA -_0802D178: - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082FE164 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r0, =gUnknown_082FE174 - bl InitWindows - bl reset_temp_tile_data_buffers - ldr r0, [r6] - bl sub_802C974 - bl sub_802DD08 - ldr r0, =gPkmnJumpBgPal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gPkmnJumpBgGfx - str r5, [sp] - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gPkmnJumpBgTilemap - movs r4, 0x1 - str r4, [sp] - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r0, =gPkmnJumpVenusaurPal - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gPkmnJumpVenusaurGfx - str r5, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gPkmnJumpVenusaurTilemap - str r4, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r0, =gPkmnJumpResultsPal - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gPkmnJumpResultsGfx - str r5, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gPkmnJumpResultsTilemap - str r4, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r0, =gPkmnJumpPal3 - movs r1, 0x20 - movs r2, 0x20 - bl LoadPalette - ldr r1, [r6] - movs r0, 0xD3 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - bl SetBgTilemapBuffer - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - bl sub_802DB8C - movs r0, 0 - bl sub_802DD64 - movs r0, 0 - movs r1, 0x1 - movs r2, 0xE0 - bl sub_8098C6C - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - bl sub_8199D98 - b _0802D2CC - .pool -_0802D298: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - bne _0802D2DA - bl sub_802DBF8 - ldr r0, [r6] - bl sub_802CE9C - ldr r0, [r6] - movs r1, 0x6 - bl sub_802CF50 - movs r0, 0x3 - bl ShowBg - movs r0, 0 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x1 - bl HideBg -_0802D2CC: - ldr r1, [r6] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D2DA -_0802D2D6: - movs r0, 0x1 - str r0, [r1] -_0802D2DA: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802D150 - - thumb_func_start sub_802D2E4 -sub_802D2E4: @ 802D2E4 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrh r0, [r0, 0x4] - cmp r0, 0x1 - beq _0802D310 - cmp r0, 0x1 - bgt _0802D300 - cmp r0, 0 - beq _0802D30A - b _0802D34A - .pool -_0802D300: - cmp r0, 0x2 - beq _0802D322 - cmp r0, 0x3 - beq _0802D33A - b _0802D34A -_0802D30A: - bl sub_802DE1C - b _0802D330 -_0802D310: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D34A - movs r0, 0 - bl sub_802DF70 - b _0802D330 -_0802D322: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D34A - bl sub_802DFD4 -_0802D330: - ldr r1, [r4] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D34A -_0802D33A: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D34A - ldr r1, [r4] - movs r0, 0x1 - str r0, [r1] -_0802D34A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802D2E4 - - thumb_func_start sub_802D350 -sub_802D350: @ 802D350 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrh r0, [r0, 0x4] - cmp r0, 0x1 - beq _0802D37C - cmp r0, 0x1 - bgt _0802D36C - cmp r0, 0 - beq _0802D376 - b _0802D3B6 - .pool -_0802D36C: - cmp r0, 0x2 - beq _0802D38E - cmp r0, 0x3 - beq _0802D3A6 - b _0802D3B6 -_0802D376: - bl sub_802DE1C - b _0802D39C -_0802D37C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D3B6 - movs r0, 0x1 - bl sub_802DF70 - b _0802D39C -_0802D38E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D3B6 - bl sub_802DFD4 -_0802D39C: - ldr r1, [r4] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D3B6 -_0802D3A6: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D3B6 - ldr r1, [r4] - movs r0, 0x1 - str r0, [r1] -_0802D3B6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802D350 - - thumb_func_start sub_802D3BC -sub_802D3BC: @ 802D3BC - push {r4,r5,lr} - bl sub_802C8AC - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - ldrh r0, [r0, 0x4] - cmp r0, 0 - beq _0802D3DC - cmp r0, 0x1 - beq _0802D410 - b _0802D43E - .pool -_0802D3DC: - movs r4, 0 - cmp r4, r5 - bge _0802D3F8 -_0802D3E2: - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x1C - adds r0, r1 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r4, 0x1 - cmp r4, r5 - blt _0802D3E2 -_0802D3F8: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022D00 - ldr r1, [r0] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D43E - .pool -_0802D410: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D43E - movs r4, 0 - cmp r4, r5 - bge _0802D436 -_0802D420: - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x1C - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - adds r4, 0x1 - cmp r4, r5 - blt _0802D420 -_0802D436: - ldr r0, =gUnknown_02022D00 - ldr r1, [r0] - movs r0, 0x1 - str r0, [r1] -_0802D43E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D3BC - - thumb_func_start sub_802D448 -sub_802D448: @ 802D448 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0x1 - beq _0802D4A4 - cmp r4, 0x1 - bgt _0802D464 - cmp r4, 0 - beq _0802D46A - b _0802D4EC - .pool -_0802D464: - cmp r4, 0x2 - beq _0802D4DC - b _0802D4EC -_0802D46A: - movs r0, 0x1 - movs r1, 0x8 - movs r2, 0x14 - movs r3, 0x2 - bl sub_802DA9C - ldr r1, [r5] - strh r0, [r1, 0x12] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_WantToPlayAgain2 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - b _0802D4D2 - .pool -_0802D4A4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D4EC - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl sub_8098858 - movs r0, 0x17 - movs r1, 0x7 - movs r2, 0 - bl sub_802DB18 - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802D4D2: - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D4EC -_0802D4DC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D4EC - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1] -_0802D4EC: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D448 - - thumb_func_start sub_802D4F4 -sub_802D4F4: @ 802D4F4 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0x1 - beq _0802D550 - cmp r4, 0x1 - bgt _0802D510 - cmp r4, 0 - beq _0802D516 - b _0802D58E - .pool -_0802D510: - cmp r4, 0x2 - beq _0802D57E - b _0802D58E -_0802D516: - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x1A - movs r3, 0x4 - bl sub_802DA9C - ldr r1, [r5] - strh r0, [r1, 0x12] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_082C8959 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - b _0802D574 - .pool -_0802D550: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D58E - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl sub_8098858 - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802D574: - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D58E -_0802D57E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D58E - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1] -_0802D58E: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D4F4 - - thumb_func_start sub_802D598 -sub_802D598: @ 802D598 - push {r4,r5,lr} - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0 - beq _0802D5B0 - cmp r4, 0x1 - beq _0802D5C8 - b _0802D5DE - .pool -_0802D5B0: - bl sub_802DA14 - bl sub_8198C78 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D5DE -_0802D5C8: - bl sub_802DA44 - cmp r0, 0 - bne _0802D5DE - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D5DE - ldr r0, [r5] - str r4, [r0] -_0802D5DE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D598 - - thumb_func_start sub_802D5E4 -sub_802D5E4: @ 802D5E4 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0x1 - beq _0802D640 - cmp r4, 0x1 - bgt _0802D600 - cmp r4, 0 - beq _0802D606 - b _0802D67E - .pool -_0802D600: - cmp r4, 0x2 - beq _0802D66E - b _0802D67E -_0802D606: - movs r0, 0x2 - movs r1, 0x8 - movs r2, 0x16 - movs r3, 0x4 - bl sub_802DA9C - ldr r1, [r5] - strh r0, [r1, 0x12] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_SomeoneDroppedOut2 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - b _0802D664 - .pool -_0802D640: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D67E - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl sub_8098858 - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802D664: - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D67E -_0802D66E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D67E - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1] -_0802D67E: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D5E4 - - thumb_func_start sub_802D688 -sub_802D688: @ 802D688 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0x1 - beq _0802D6E4 - cmp r4, 0x1 - bgt _0802D6A4 - cmp r4, 0 - beq _0802D6AA - b _0802D722 - .pool -_0802D6A4: - cmp r4, 0x2 - beq _0802D712 - b _0802D722 -_0802D6AA: - movs r0, 0x7 - movs r1, 0xA - movs r2, 0x10 - movs r3, 0x2 - bl sub_802DA9C - ldr r1, [r5] - strh r0, [r1, 0x12] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_CommunicationStandby4 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - b _0802D708 - .pool -_0802D6E4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D722 - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl sub_8098858 - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802D708: - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D722 -_0802D712: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D722 - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1] -_0802D722: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D688 - - thumb_func_start sub_802D72C -sub_802D72C: @ 802D72C - push {r4,r5,lr} - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0 - beq _0802D744 - cmp r4, 0x1 - beq _0802D752 - b _0802D75E - .pool -_0802D744: - bl sub_802D044 - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D75E -_0802D752: - bl sub_802D068 - cmp r0, 0 - bne _0802D75E - ldr r0, [r5] - str r4, [r0] -_0802D75E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D72C - - thumb_func_start sub_802D764 -sub_802D764: @ 802D764 - push {lr} - ldr r1, =gUnknown_02022D00 - ldr r0, [r1] - movs r2, 0 - strb r2, [r0, 0xA] - ldr r0, [r1] - strb r2, [r0, 0xB] - ldr r2, [r1] - movs r0, 0x6 - strb r0, [r2, 0xC] - ldr r0, [r1] - ldrb r0, [r0, 0xC] - bl sub_802DC9C - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D764 - - thumb_func_start sub_802D788 -sub_802D788: @ 802D788 - push {r4,lr} - ldr r0, =gUnknown_02022D00 - ldr r2, [r0] - ldrb r3, [r2, 0xA] - adds r4, r0, 0 - cmp r3, 0 - beq _0802D7A0 - cmp r3, 0x1 - beq _0802D7DA - b _0802D7DE - .pool -_0802D7A0: - ldrb r0, [r2, 0xB] - adds r0, 0x1 - strb r0, [r2, 0xB] - ldr r1, [r4] - ldrb r0, [r1, 0xB] - cmp r0, 0xA - bls _0802D7CA - strb r3, [r1, 0xB] - ldr r0, [r4] - ldrb r1, [r0, 0xC] - adds r1, 0x1 - strb r1, [r0, 0xC] - ldr r1, [r4] - ldrb r0, [r1, 0xC] - cmp r0, 0x9 - bls _0802D7CA - strb r3, [r1, 0xC] - ldr r1, [r4] - ldrb r0, [r1, 0xA] - adds r0, 0x1 - strb r0, [r1, 0xA] -_0802D7CA: - ldr r0, [r4] - ldrb r0, [r0, 0xC] - bl sub_802DC9C - ldr r0, [r4] - ldrb r0, [r0, 0xC] - cmp r0, 0x7 - bne _0802D7DE -_0802D7DA: - movs r0, 0 - b _0802D7E0 -_0802D7DE: - movs r0, 0x1 -_0802D7E0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802D788 - - thumb_func_start sub_802D7E8 -sub_802D7E8: @ 802D7E8 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r1, 0 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 16 - lsrs r4, 16 - ldr r5, =gUnknown_02022D00 - ldr r1, [r5] - adds r1, 0x26 - adds r2, r4, 0 - bl CopyItemNameHandlePlural - ldr r0, [r5] - adds r0, 0x66 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - bl sub_81AFBF0 - ldr r1, [r5] - adds r1, 0x26 - movs r0, 0 - bl sub_81AFC0C - ldr r1, [r5] - adds r1, 0x66 - movs r0, 0x1 - bl sub_81AFC0C - ldr r0, [r5] - adds r0, 0xA6 - ldr r1, =gText_AwesomeWonF701F700 - bl sub_81AFC28 - movs r0, 0x4 - movs r1, 0x8 - movs r2, 0x16 - movs r3, 0x4 - bl sub_802DA9C - ldr r2, [r5] - movs r4, 0 - movs r3, 0 - strh r0, [r2, 0x12] - lsls r0, 24 - lsrs r0, 24 - adds r2, 0xA6 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r3, [sp, 0x8] - movs r1, 0x1 - bl PrintTextOnWindow - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r5] - ldr r0, =0x0000016f - strh r0, [r1, 0x14] - strb r4, [r1, 0xD] - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D7E8 - - thumb_func_start sub_802D884 -sub_802D884: @ 802D884 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 16 - lsrs r0, 16 - ldr r4, =gUnknown_02022D00 - ldr r1, [r4] - adds r1, 0x26 - bl CopyItemName - bl sub_81AFBF0 - ldr r1, [r4] - adds r1, 0x26 - movs r0, 0 - bl sub_81AFC0C - ldr r0, [r4] - adds r0, 0xA6 - ldr r1, =gText_FilledStorageSpace2 - bl sub_81AFC28 - movs r0, 0x4 - movs r1, 0x8 - movs r2, 0x16 - movs r3, 0x4 - bl sub_802DA9C - ldr r2, [r4] - movs r6, 0 - movs r5, 0 - strh r0, [r2, 0x12] - lsls r0, 24 - lsrs r0, 24 - adds r2, 0xA6 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r4] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - strh r5, [r0, 0x14] - strb r6, [r0, 0xD] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D884 - - thumb_func_start sub_802D8FC -sub_802D8FC: @ 802D8FC - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 16 - lsrs r0, 16 - ldr r4, =gUnknown_02022D00 - ldr r1, [r4] - adds r1, 0x26 - bl CopyItemName - bl sub_81AFBF0 - ldr r1, [r4] - adds r1, 0x26 - movs r0, 0 - bl sub_81AFC0C - ldr r0, [r4] - adds r0, 0xA6 - ldr r1, =gText_CantHoldMore - bl sub_81AFC28 - movs r0, 0x4 - movs r1, 0x9 - movs r2, 0x16 - movs r3, 0x2 - bl sub_802DA9C - ldr r2, [r4] - movs r6, 0 - movs r5, 0 - strh r0, [r2, 0x12] - lsls r0, 24 - lsrs r0, 24 - adds r2, 0xA6 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [r4] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - strh r5, [r0, 0x14] - strb r6, [r0, 0xD] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D8FC - - thumb_func_start sub_802D974 -sub_802D974: @ 802D974 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrb r0, [r0, 0xD] - cmp r0, 0x1 - beq _0802D9C8 - cmp r0, 0x1 - bgt _0802D990 - cmp r0, 0 - beq _0802D99A - b _0802DA0C - .pool -_0802D990: - cmp r0, 0x2 - beq _0802D9EE - cmp r0, 0x3 - beq _0802DA02 - b _0802DA0C -_0802D99A: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802DA0C - ldr r0, [r4] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r4] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl sub_8098858 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r4] - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] - b _0802DA0C -_0802D9C8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802DA0C - ldr r1, [r4] - ldrh r0, [r1, 0x14] - cmp r0, 0 - bne _0802D9E0 - ldrb r0, [r1, 0xD] - adds r0, 0x2 - b _0802DA00 -_0802D9E0: - ldrh r0, [r1, 0x14] - bl PlayFanfare - ldr r1, [r4] - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] -_0802D9EE: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _0802DA0C - ldr r0, =gUnknown_02022D00 - ldr r1, [r0] - ldrb r0, [r1, 0xD] - adds r0, 0x1 -_0802DA00: - strb r0, [r1, 0xD] -_0802DA02: - movs r0, 0 - b _0802DA0E - .pool -_0802DA0C: - movs r0, 0x1 -_0802DA0E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802D974 - - thumb_func_start sub_802DA14 -sub_802DA14: @ 802DA14 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrh r0, [r0, 0x12] - cmp r0, 0xFF - beq _0802DA38 - lsls r0, 24 - lsrs r0, 24 - bl rbox_fill_rectangle - ldr r0, [r4] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - bl CopyWindowToVram - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0xD] -_0802DA38: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DA14 - - thumb_func_start sub_802DA44 -sub_802DA44: @ 802DA44 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r1, [r4] - ldrh r0, [r1, 0x12] - cmp r0, 0xFF - bne _0802DA58 -_0802DA50: - movs r0, 0 - b _0802DA84 - .pool -_0802DA58: - ldrb r0, [r1, 0xD] - cmp r0, 0 - bne _0802DA7E - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802DA82 - ldr r0, [r4] - ldrb r0, [r0, 0x12] - bl RemoveWindow - ldr r1, [r4] - movs r0, 0xFF - strh r0, [r1, 0x12] - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] - b _0802DA50 -_0802DA7E: - cmp r0, 0x1 - beq _0802DA50 -_0802DA82: - movs r0, 0x1 -_0802DA84: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802DA44 - - thumb_func_start sub_802DA8C -sub_802DA8C: @ 802DA8C - push {lr} - bl sub_8198C58 - lsls r0, 24 - asrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_802DA8C - - thumb_func_start sub_802DA9C -sub_802DA9C: @ 802DA9C - push {r4-r6,lr} - sub sp, 0x8 - ldr r6, =0xffffff00 - ldr r4, [sp] - ands r4, r6 - lsls r0, 24 - lsrs r0, 16 - ldr r5, =0xffff00ff - ands r4, r5 - orrs r4, r0 - lsls r1, 24 - lsrs r1, 8 - ldr r0, =0xff00ffff - ands r4, r0 - orrs r4, r1 - lsls r2, 24 - ldr r0, =0x00ffffff - ands r4, r0 - orrs r4, r2 - str r4, [sp] - lsls r3, 24 - lsrs r3, 24 - ldr r0, [sp, 0x4] - ands r0, r6 - orrs r0, r3 - ands r0, r5 - movs r1, 0xF0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0x86 - lsls r1, 15 - orrs r0, r1 - str r0, [sp, 0x4] - mov r0, sp - bl AddWindow - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r0, r4, 24 - lsrs r0, 24 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r4, 0 - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802DA9C - - thumb_func_start sub_802DB18 -sub_802DB18: @ 802DB18 - push {r4,r5,lr} - sub sp, 0x8 - adds r3, r2, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r5, =0xffffff00 - ldr r2, [sp] - ands r2, r5 - lsls r0, 24 - lsrs r0, 16 - ldr r4, =0xffff00ff - ands r2, r4 - orrs r2, r0 - lsls r1, 24 - lsrs r1, 8 - ldr r0, =0xff00ffff - ands r2, r0 - orrs r2, r1 - ldr r0, =0x00ffffff - ands r2, r0 - movs r0, 0xC0 - lsls r0, 19 - orrs r2, r0 - str r2, [sp] - ldr r0, [sp, 0x4] - ands r0, r5 - movs r1, 0x4 - orrs r0, r1 - ands r0, r4 - movs r1, 0x80 - lsls r1, 2 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xAC - lsls r1, 14 - orrs r0, r1 - str r0, [sp, 0x4] - mov r0, sp - movs r1, 0x1 - movs r2, 0xD - bl CreateYesNoMenu - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DB18 - - thumb_func_start sub_802DB8C -sub_802DB8C: @ 802DB8C - push {r4,lr} - sub sp, 0x10 - ldr r1, =gUnknown_082FE1DC - add r0, sp, 0xC - movs r2, 0x3 - bl memcpy - movs r0, 0 - bl PutWindowTilemap - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - add r0, sp, 0xC - str r0, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r0, =gText_SpacePoints2 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x1 - bl box_print - add r0, sp, 0xC - str r0, [sp] - str r4, [sp, 0x4] - ldr r0, =gText_SpaceTimes3 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0x1 - bl box_print - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DB8C - - thumb_func_start sub_802DBF8 -sub_802DBF8: @ 802DBF8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - bl sub_802C8AC - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - ldr r1, =gUnknown_082FE260 - subs r0, 0x2 - lsls r0, 2 - adds r0, r1 - ldr r5, [r0] - movs r6, 0 - cmp r6, r10 - bge _0802DC62 - ldr r0, =gMonFrontPicCoords - mov r9, r0 - ldr r1, =gUnknown_02022D00 - mov r8, r1 -_0802DC26: - lsls r4, r6, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_802C8C8 - adds r1, r0, 0 - ldrh r0, [r1] - lsls r0, 2 - add r0, r9 - ldrb r3, [r0, 0x1] - mov r2, r8 - ldr r0, [r2] - movs r7, 0 - ldrsh r2, [r5, r7] - adds r3, 0x70 - str r4, [sp] - bl sub_802C9D4 - mov r1, r8 - ldr r0, [r1] - movs r2, 0 - ldrsh r1, [r5, r2] - movs r2, 0x70 - adds r3, r4, 0 - bl sub_802CE48 - adds r5, 0x2 - adds r6, 0x1 - cmp r6, r10 - blt _0802DC26 -_0802DC62: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DBF8 - - thumb_func_start sub_802DC80 -sub_802DC80: @ 802DC80 - ldr r2, =gUnknown_02022D00 - ldr r2, [r2] - lsls r0, 2 - ldr r3, =0x000081a8 - adds r2, r3 - adds r2, r0 - ldr r0, [r2] - strh r1, [r0, 0x26] - bx lr - .pool - thumb_func_end sub_802DC80 - - thumb_func_start sub_802DC9C -sub_802DC9C: @ 802DC9C - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - adds r1, r4, 0 - bl sub_802CF50 - ldr r0, =gUnknown_082FE1DF - adds r4, r0 - ldrb r0, [r4] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 13 - movs r0, 0x2 - movs r2, 0 - bl ChangeBgY - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DC9C - - thumb_func_start sub_802DCCC -sub_802DCCC: @ 802DCCC - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - movs r6, 0 -_0802DCD6: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0802DCEA - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - adds r1, r5, 0 - bl sub_802CB14 - adds r6, 0x1 -_0802DCEA: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x4 - ble _0802DCD6 - subs r0, r6, 0x2 - lsls r0, 24 - lsrs r0, 24 - bl sub_802E00C - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802DCCC - - thumb_func_start sub_802DD08 -sub_802DD08: @ 802DD08 - push {r4,lr} - sub sp, 0x10 - mov r1, sp - movs r0, 0x40 - strb r0, [r1] - movs r0, 0x5 - strb r0, [r1, 0x1] - movs r0, 0x8 - strb r0, [r1, 0x2] - movs r0, 0x6C - strh r0, [r1, 0x4] - movs r4, 0x6 - strh r4, [r1, 0x6] - ldr r0, =gUnknown_082FE1EC - str r0, [sp, 0x8] - ldr r0, =gUnknown_082FE1F4 - str r0, [sp, 0xC] - movs r0, 0x2 - bl sub_8034C54 - movs r0, 0 - movs r1, 0 - mov r2, sp - bl sub_8034D14 - mov r1, sp - movs r0, 0x4 - strb r0, [r1, 0x1] - movs r0, 0x1E - strh r0, [r1, 0x4] - mov r0, sp - strh r4, [r0, 0x6] - movs r0, 0x1 - movs r1, 0 - mov r2, sp - bl sub_8034D14 - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DD08 - - thumb_func_start sub_802DD64 -sub_802DD64: @ 802DD64 - push {lr} - adds r1, r0, 0 - movs r0, 0 - bl sub_8035044 - pop {r0} - bx r0 - thumb_func_end sub_802DD64 - - thumb_func_start sub_802DD74 -sub_802DD74: @ 802DD74 - push {lr} - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1 - bl sub_8035044 - pop {r0} - bx r0 - thumb_func_end sub_802DD74 - - thumb_func_start sub_802DD88 -sub_802DD88: @ 802DD88 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CBF0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DD88 - - thumb_func_start sub_802DDA0 -sub_802DDA0: @ 802DDA0 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CC88 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DDA0 - - thumb_func_start sub_802DDB8 -sub_802DDB8: @ 802DDB8 - push {lr} - adds r1, r0, 0 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CC18 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802DDB8 - - thumb_func_start sub_802DDCC -sub_802DDCC: @ 802DDCC - push {lr} - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CCB0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DDCC - - thumb_func_start sub_802DDE0 -sub_802DDE0: @ 802DDE0 - push {lr} - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CD3C - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DDE0 - - thumb_func_start sub_802DDF4 -sub_802DDF4: @ 802DDF4 - push {lr} - adds r1, r0, 0 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CD70 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DDF4 - - thumb_func_start sub_802DE08 -sub_802DE08: @ 802DE08 - push {lr} - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CD98 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802DE08 - - thumb_func_start sub_802DE1C -sub_802DE1C: @ 802DE1C - push {r4-r7,lr} - sub sp, 0x8 - bl sub_802C8AC - lsls r0, 16 - lsrs r7, r0, 16 - ldr r1, =gUnknown_082FE234 - subs r0, r7, 0x2 - lsls r0, 2 - adds r0, r1 - ldr r4, [r0] - ldr r2, =0xffffff00 - ldr r0, [sp] - ands r0, r2 - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 20 - orrs r0, r1 - str r0, [sp] - ldr r0, [sp, 0x4] - ands r0, r2 - movs r1, 0x2 - orrs r0, r1 - ldr r1, =0xffff00ff - ands r0, r1 - movs r1, 0x80 - lsls r1, 2 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xAC - lsls r1, 14 - orrs r0, r1 - str r0, [sp, 0x4] - movs r5, 0 - cmp r5, r7 - bge _0802DEAC - mov r6, sp -_0802DE6A: - ldrb r0, [r4] - lsls r0, 8 - ldr r2, =0xffff00ff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - ldrb r2, [r4, 0x2] - lsls r2, 16 - ldr r0, =0xff00ffff - ands r0, r1 - orrs r0, r2 - str r0, [sp] - mov r0, sp - bl AddWindow - ldr r1, =gUnknown_02022D00 - ldr r1, [r1] - lsls r2, r5, 1 - adds r1, 0x1C - adds r1, r2 - strh r0, [r1] - lsls r0, 24 - lsrs r0, 24 - bl ClearWindowTilemap - ldrh r0, [r6, 0x6] - adds r0, 0x10 - strh r0, [r6, 0x6] - adds r4, 0x4 - adds r5, 0x1 - cmp r5, r7 - blt _0802DE6A -_0802DEAC: - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DE1C - - thumb_func_start sub_802DED8 -sub_802DED8: @ 802DED8 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x10 - adds r5, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - add r0, sp, 0xC - strb r1, [r0] - strb r2, [r0, 0x1] - strb r3, [r0, 0x2] - ldr r6, =gUnknown_02022D00 - ldr r0, [r6] - lsls r1, r5, 1 - mov r8, r1 - adds r0, 0x1C - add r0, r8 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - lsls r5, 24 - lsrs r5, 24 - adds r0, r5, 0 - bl sub_802C8E8 - adds r1, r0, 0 - movs r2, 0x1 - negs r2, r2 - mov r9, r2 - movs r0, 0x1 - bl GetStringWidth - movs r4, 0x40 - subs r4, r0 - lsrs r4, 1 - adds r0, r5, 0 - bl sub_802C8E8 - adds r1, r0, 0 - ldr r0, [r6] - adds r0, 0x1C - add r0, r8 - ldrb r0, [r0] - lsls r4, 24 - lsrs r4, 24 - add r2, sp, 0xC - str r2, [sp] - mov r2, r9 - str r2, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x1 - bl box_print - ldr r0, [r6] - adds r0, 0x1C - add r0, r8 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DED8 - - thumb_func_start sub_802DF70 -sub_802DF70: @ 802DF70 - push {r4-r6,lr} - adds r4, r0, 0 - bl sub_802C8AC - lsls r0, 16 - lsrs r5, r0, 16 - cmp r4, 0 - bne _0802DF9A - movs r4, 0 - cmp r4, r5 - bge _0802DFCC -_0802DF86: - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x2 - movs r3, 0x3 - bl sub_802DED8 - adds r4, 0x1 - cmp r4, r5 - blt _0802DF86 - b _0802DFCC -_0802DF9A: - bl sub_802C8BC - lsls r0, 16 - lsrs r6, r0, 16 - movs r4, 0 - cmp r4, r5 - bge _0802DFCC -_0802DFA8: - cmp r6, r4 - beq _0802DFBA - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x2 - movs r3, 0x3 - bl sub_802DED8 - b _0802DFC6 -_0802DFBA: - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x4 - movs r3, 0x5 - bl sub_802DED8 -_0802DFC6: - adds r4, 0x1 - cmp r4, r5 - blt _0802DFA8 -_0802DFCC: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802DF70 - - thumb_func_start sub_802DFD4 -sub_802DFD4: @ 802DFD4 - push {r4,r5,lr} - bl sub_802C8AC - lsls r0, 16 - lsrs r5, r0, 16 - movs r4, 0 - cmp r4, r5 - bge _0802DFFA -_0802DFE4: - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x1C - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - adds r4, 0x1 - cmp r4, r5 - blt _0802DFE4 -_0802DFFA: - movs r0, 0 - bl CopyBgTilemapBufferToVram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DFD4 - - thumb_func_start sub_802E00C -sub_802E00C: @ 802E00C - push {r4,lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_02022D00 - ldr r2, [r0] - movs r0, 0 - str r0, [r2, 0x18] - lsrs r1, 25 - lsls r1, 16 - movs r0, 0x1 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - ands r4, r0 - lsls r4, 8 - subs r4, 0x28 - lsls r4, 8 - adds r1, r4, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - bl ShowBg - ldr r0, =sub_802E090 - movs r1, 0x4 - bl CreateTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E00C - - thumb_func_start sub_802E058 -sub_802E058: @ 802E058 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldr r0, [r0, 0x18] - cmp r0, 0x1F - bls _0802E06C - movs r0, 0 - b _0802E08A - .pool -_0802E06C: - movs r0, 0x1 - movs r1, 0x80 - movs r2, 0x1 - bl ChangeBgY - ldr r1, [r4] - ldr r0, [r1, 0x18] - adds r0, 0x1 - str r0, [r1, 0x18] - cmp r0, 0x1F - bls _0802E088 - movs r0, 0x1 - bl HideBg -_0802E088: - movs r0, 0x1 -_0802E08A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802E058 - - thumb_func_start sub_802E090 -sub_802E090: @ 802E090 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_802E058 - cmp r0, 0 - bne _0802E0A4 - adds r0, r4, 0 - bl DestroyTask -_0802E0A4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802E090 - - thumb_func_start sub_802E0AC -sub_802E0AC: @ 802E0AC - push {lr} - sub sp, 0xC - mov r2, sp - movs r1, 0x1 - strb r1, [r2] - ldrh r1, [r0] - strh r1, [r2, 0x2] - ldr r1, [r0, 0x4] - str r1, [sp, 0x8] - ldr r0, [r0, 0x8] - str r0, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_802E0AC - - thumb_func_start sub_802E0D0 -sub_802E0D0: @ 802E0D0 - push {r4,lr} - sub sp, 0xC - adds r4, r1, 0 - ldr r3, =gUnknown_03003090 - lsls r2, r0, 4 - adds r0, r2, r3 - ldrh r1, [r0] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - movs r1, 0xBC - lsls r1, 6 - cmp r0, r1 - bne _0802E100 - adds r1, r3, 0x2 - adds r1, r2, r1 - mov r0, sp - movs r2, 0xC - bl memcpy - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x1 - beq _0802E108 -_0802E100: - movs r0, 0 - b _0802E118 - .pool -_0802E108: - mov r0, sp - ldrh r0, [r0, 0x2] - strh r0, [r4] - ldr r0, [sp, 0x8] - str r0, [r4, 0x4] - ldr r0, [sp, 0x4] - str r0, [r4, 0x8] - movs r0, 0x1 -_0802E118: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802E0D0 - - thumb_func_start sub_802E120 -sub_802E120: @ 802E120 - push {lr} - sub sp, 0xC - mov r2, sp - movs r1, 0x2 - strb r1, [r2] - str r0, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_802E120 - - thumb_func_start sub_802E138 -sub_802E138: @ 802E138 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - mov r3, sp - movs r2, 0x3 - strb r2, [r3] - ldr r3, [r1, 0x8] - lsls r3, 15 - ldr r2, [sp, 0x8] - ldr r4, =0x00007fff - mov r8, r4 - ands r2, r4 - orrs r2, r3 - str r2, [sp, 0x8] - mov r6, sp - ldrb r2, [r1, 0x1] - movs r5, 0x1F - adds r3, r5, 0 - ands r3, r2 - ldrb r4, [r6, 0x3] - movs r2, 0x20 - negs r2, r2 - ands r2, r4 - orrs r2, r3 - strb r2, [r6, 0x3] - mov r3, sp - ldrb r2, [r1] - strb r2, [r3, 0x1] - ldrh r2, [r1, 0x2] - strh r2, [r3, 0x6] - mov r4, sp - ldrh r2, [r1, 0x4] - mov r1, r8 - ands r2, r1 - ldrh r3, [r4, 0x8] - ldr r1, =0xffff8000 - ands r1, r3 - orrs r1, r2 - strh r1, [r4, 0x8] - mov r2, sp - ldrh r1, [r0, 0x10] - strb r1, [r2, 0x2] - mov r3, sp - ldr r1, [r0, 0x14] - lsls r1, 5 - ldrb r2, [r3, 0x3] - ands r5, r2 - orrs r5, r1 - strb r5, [r3, 0x3] - mov r1, sp - ldrh r0, [r0, 0xE] - strh r0, [r1, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E138 - - thumb_func_start sub_802E1BC -sub_802E1BC: @ 802E1BC - push {r4,r5,lr} - sub sp, 0xC - adds r5, r0, 0 - adds r4, r1, 0 - ldr r2, =gUnknown_03003090 - ldrh r0, [r2] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _0802E228 - adds r1, r2, 0x2 - mov r0, sp - movs r2, 0xC - bl memcpy - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x3 - bne _0802E228 - ldr r0, [sp, 0x8] - lsrs r0, 15 - str r0, [r4, 0x8] - mov r0, sp - ldrb r1, [r0, 0x3] - lsls r0, r1, 27 - lsrs r0, 27 - strb r0, [r4, 0x1] - mov r0, sp - ldrb r0, [r0, 0x1] - strb r0, [r4] - mov r0, sp - ldrh r0, [r0, 0x6] - strh r0, [r4, 0x2] - mov r0, sp - ldrh r0, [r0, 0x8] - lsls r0, 17 - lsrs r0, 17 - strh r0, [r4, 0x4] - mov r0, sp - ldrb r0, [r0, 0x2] - strh r0, [r5, 0x10] - lsls r1, 24 - lsrs r1, 29 - str r1, [r5, 0x14] - mov r0, sp - ldrh r0, [r0, 0x4] - strh r0, [r5, 0xE] - movs r0, 0x1 - b _0802E22A - .pool -_0802E228: - movs r0, 0 -_0802E22A: - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802E1BC - - thumb_func_start sub_802E234 -sub_802E234: @ 802E234 - push {r4,lr} - sub sp, 0xC - mov r4, sp - movs r3, 0x4 - strb r3, [r4] - ldrh r3, [r0, 0x10] - strb r3, [r4, 0x1] - ldr r3, [r0, 0x14] - strb r3, [r4, 0x2] - ldr r3, [r0, 0x18] - strb r3, [r4, 0x3] - mov r3, sp - ldrh r0, [r0, 0xE] - strh r0, [r3, 0x4] - mov r0, sp - strb r1, [r0, 0x6] - strh r2, [r0, 0x8] - bl sub_800FE50 - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802E234 - - thumb_func_start sub_802E264 -sub_802E264: @ 802E264 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - adds r5, r2, 0 - adds r6, r3, 0 - ldr r3, =gUnknown_03003090 - lsls r2, r1, 4 - adds r0, r2, r3 - ldrh r1, [r0] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - movs r1, 0xBC - lsls r1, 6 - cmp r0, r1 - bne _0802E2C4 - adds r1, r3, 0x2 - adds r1, r2, r1 - mov r0, sp - movs r2, 0xC - bl memcpy - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x4 - bne _0802E2C4 - mov r0, sp - ldrb r0, [r0, 0x1] - strh r0, [r4, 0x10] - mov r0, sp - ldrb r0, [r0, 0x2] - str r0, [r4, 0x14] - mov r0, sp - ldrb r0, [r0, 0x3] - str r0, [r4, 0x18] - mov r0, sp - ldrh r0, [r0, 0x4] - strh r0, [r4, 0xE] - mov r0, sp - ldrb r0, [r0, 0x6] - strb r0, [r5] - mov r0, sp - ldrh r0, [r0, 0x8] - strh r0, [r6] - movs r0, 0x1 - b _0802E2C6 - .pool -_0802E2C4: - movs r0, 0 -_0802E2C6: - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_802E264 - - thumb_func_start sub_802E2D0 -sub_802E2D0: @ 802E2D0 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - ldr r3, =gUnknown_03003090 - lsls r2, r1, 4 - adds r0, r2, r3 - ldrh r1, [r0] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - movs r1, 0xBC - lsls r1, 6 - cmp r0, r1 - bne _0802E320 - adds r1, r3, 0x2 - adds r1, r2, r1 - mov r0, sp - movs r2, 0xC - bl memcpy - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x4 - bne _0802E320 - mov r0, sp - ldrb r0, [r0, 0x1] - strh r0, [r4, 0x10] - mov r0, sp - ldrb r0, [r0, 0x2] - str r0, [r4, 0x14] - mov r0, sp - ldrb r0, [r0, 0x3] - str r0, [r4, 0x18] - mov r0, sp - ldrh r0, [r0, 0x4] - strh r0, [r4, 0xE] - movs r0, 0x1 - b _0802E322 - .pool -_0802E320: - movs r0, 0 -_0802E322: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802E2D0 - - thumb_func_start sub_802E32C -sub_802E32C: @ 802E32C - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xFE - lsls r1, 1 - adds r0, r1 - bx lr - .pool - thumb_func_end sub_802E32C - - thumb_func_start ResetPokeJumpResults -ResetPokeJumpResults: @ 802E33C - push {lr} - bl sub_802E32C - movs r1, 0 - strh r1, [r0] - str r1, [r0, 0xC] - strh r1, [r0, 0x4] - strh r1, [r0, 0x6] - str r1, [r0, 0x8] - strh r1, [r0, 0x2] - pop {r0} - bx r0 - thumb_func_end ResetPokeJumpResults - - thumb_func_start sub_802E354 -sub_802E354: @ 802E354 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - lsls r2, 16 - lsrs r6, r2, 16 - bl sub_802E32C - adds r1, r0, 0 - movs r2, 0 - ldr r0, [r1, 0xC] - cmp r0, r4 - bcs _0802E378 - ldr r0, =0x00018696 - cmp r4, r0 - bhi _0802E378 - str r4, [r1, 0xC] - movs r2, 0x1 -_0802E378: - ldrh r0, [r1] - cmp r0, r5 - bcs _0802E388 - ldr r0, =0x0000270f - cmp r5, r0 - bhi _0802E388 - strh r5, [r1] - movs r2, 0x1 -_0802E388: - ldrh r0, [r1, 0x4] - cmp r0, r6 - bcs _0802E398 - ldr r0, =0x0000270f - cmp r6, r0 - bhi _0802E398 - strh r6, [r1, 0x4] - movs r2, 0x1 -_0802E398: - adds r0, r2, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802E354 - - thumb_func_start sub_802E3A8 -sub_802E3A8: @ 802E3A8 - push {lr} - bl sub_802E32C - adds r2, r0, 0 - ldrh r1, [r2, 0x6] - ldr r0, =0x0000270e - cmp r1, r0 - bhi _0802E3BC - adds r0, r1, 0x1 - strh r0, [r2, 0x6] -_0802E3BC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E3A8 - - thumb_func_start sub_802E3C4 -sub_802E3C4: @ 802E3C4 - push {r4,lr} - ldr r4, =sub_802E3E4 - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E3C4 - - thumb_func_start sub_802E3E4 -sub_802E3E4: @ 802E3E4 - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - movs r1, 0 - ldrsh r0, [r7, r1] - cmp r0, 0x1 - beq _0802E4A8 - cmp r0, 0x1 - bgt _0802E40C - cmp r0, 0 - beq _0802E416 - b _0802E4F6 - .pool -_0802E40C: - cmp r0, 0x2 - beq _0802E4B4 - cmp r0, 0x3 - beq _0802E4DC - b _0802E4F6 -_0802E416: - ldr r0, =gUnknown_082FE270 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - ldr r1, =gText_PkmnJumpRecords - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r4, r0, 0 - movs r6, 0 - ldr r5, =gUnknown_082FE278 -_0802E430: - ldr r1, [r5] - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r0, 0x26 - cmp r0, r4 - ble _0802E442 - adds r4, r0, 0 -_0802E442: - adds r5, 0x4 - adds r6, 0x1 - cmp r6, 0x2 - bls _0802E430 - adds r0, r4, 0x7 - cmp r0, 0 - bge _0802E452 - adds r0, 0x7 -_0802E452: - asrs r4, r0, 3 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0802E45E - adds r4, 0x1 -_0802E45E: - movs r1, 0x1E - subs r1, r4 - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - lsls r1, 24 - lsrs r1, 16 - ldr r2, =0xffff00ff - ldr r0, [sp] - ands r0, r2 - orrs r0, r1 - lsls r2, r4, 24 - ldr r1, =0x00ffffff - ands r0, r1 - orrs r0, r2 - str r0, [sp] - mov r0, sp - bl AddWindow - strh r0, [r7, 0x2] - ldrh r0, [r7, 0x2] - adds r1, r4, 0 - bl sub_802E500 - ldrb r0, [r7, 0x2] - movs r1, 0x3 - b _0802E4CA - .pool -_0802E4A8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802E4F6 - b _0802E4CE -_0802E4B4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0802E4F6 - ldrb r0, [r7, 0x2] - bl rbox_fill_rectangle - ldrb r0, [r7, 0x2] - movs r1, 0x1 -_0802E4CA: - bl CopyWindowToVram -_0802E4CE: - ldrh r0, [r7] - adds r0, 0x1 - strh r0, [r7] - b _0802E4F6 - .pool -_0802E4DC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802E4F6 - ldrb r0, [r7, 0x2] - bl RemoveWindow - adds r0, r4, 0 - bl DestroyTask - bl EnableBothScriptContexts -_0802E4F6: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_802E3E4 - - thumb_func_start sub_802E500 -sub_802E500: @ 802E500 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - str r1, [sp, 0x1C] - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x18] - bl sub_802E32C - ldrh r1, [r0] - str r1, [sp, 0xC] - ldr r1, [r0, 0xC] - str r1, [sp, 0x10] - ldrh r0, [r0, 0x4] - str r0, [sp, 0x14] - ldr r0, [sp, 0x18] - lsls r4, r0, 24 - lsrs r4, 24 - ldr r5, =0x0000021d - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0xD0 - bl box_border_load_tiles_and_pal - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0xD - bl sub_8098858 - adds r0, r4, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r5, =gText_PkmnJumpRecords - ldr r1, [sp, 0x1C] - lsls r2, r1, 3 - movs r0, 0x1 - adds r1, r5, 0 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r4, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl PrintTextOnWindow - movs r6, 0 - adds r7, r4, 0 - movs r0, 0xFF - mov r10, r0 - mov r9, r6 - mov r1, sp - adds r1, 0xC - str r1, [sp, 0x20] - movs r0, 0xC8 - lsls r0, 21 - mov r8, r0 - ldr r5, =gStringVar1 -_0802E58A: - ldr r1, =gUnknown_082FE278 - lsls r0, r6, 2 - adds r0, r1 - ldr r2, [r0] - mov r1, r8 - lsrs r4, r1, 24 - str r4, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldr r0, [sp, 0x20] - ldm r0!, {r1} - str r0, [sp, 0x20] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - adds r0, r5, 0 - bl sub_802E620 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0 - bl GetStringWidth - ldr r1, [sp, 0x1C] - lsls r3, r1, 3 - subs r3, r0 - lsls r3, 24 - lsrs r3, 24 - str r4, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl PrintTextOnWindow - movs r0, 0x80 - lsls r0, 21 - add r8, r0 - adds r6, 0x1 - ldr r1, [sp, 0x18] - lsls r0, r1, 24 - cmp r6, 0x2 - bls _0802E58A - lsrs r0, 24 - bl PutWindowTilemap - 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_802E500 - - thumb_func_start sub_802E620 -sub_802E620: @ 802E620 - push {lr} - adds r1, r0, 0 - b _0802E628 -_0802E626: - adds r1, 0x1 -_0802E628: - ldrb r0, [r1] - cmp r0, 0xFF - beq _0802E636 - cmp r0, 0 - bne _0802E626 - movs r0, 0xFF - strb r0, [r1] -_0802E636: - pop {r0} - bx r0 - thumb_func_end sub_802E620 - - thumb_func_start sub_802E63C -sub_802E63C: @ 802E63C - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =sub_802E6D0 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x8] - strh r5, [r0, 0xA] - ldr r0, =gUnknown_082FE748 - lsls r5, 4 - adds r5, r0 - ldr r1, [r5] - adds r0, r4, 0 - bl _call_via_r1 - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802E63C - - thumb_func_start sub_802E688 -sub_802E688: @ 802E688 - push {lr} - ldr r0, =sub_802E6D0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _0802E6B4 - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - movs r0, 0x2 - strh r0, [r1, 0x8] - movs r0, 0x1 - b _0802E6B6 - .pool -_0802E6B4: - movs r0, 0 -_0802E6B6: - pop {r1} - bx r1 - thumb_func_end sub_802E688 - - thumb_func_start sub_802E6BC -sub_802E6BC: @ 802E6BC - push {lr} - ldr r0, =sub_802E6D0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802E6BC - - thumb_func_start sub_802E6D0 -sub_802E6D0: @ 802E6D0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0x3 - beq _0802E71C - cmp r0, 0x3 - bgt _0802E6F8 - cmp r0, 0x2 - beq _0802E6FE - b _0802E752 - .pool -_0802E6F8: - cmp r0, 0x4 - beq _0802E738 - b _0802E752 -_0802E6FE: - ldr r1, =gUnknown_082FE748 - movs r2, 0x2 - ldrsh r0, [r4, r2] - lsls r0, 4 - adds r1, 0x8 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 - movs r0, 0x3 - strh r0, [r4] - b _0802E752 - .pool -_0802E71C: - ldr r0, =gUnknown_082FE748 - movs r2, 0x2 - ldrsh r1, [r4, r2] - lsls r1, 4 - adds r0, 0xC - adds r1, r0 - ldr r1, [r1] - adds r0, r5, 0 - bl _call_via_r1 - b _0802E752 - .pool -_0802E738: - ldr r0, =gUnknown_082FE748 - movs r2, 0x2 - ldrsh r1, [r4, r2] - lsls r1, 4 - adds r0, 0x4 - adds r1, r0 - ldr r1, [r1] - adds r0, r5, 0 - bl _call_via_r1 - adds r0, r5, 0 - bl DestroyTask -_0802E752: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E6D0 - - thumb_func_start sub_802E75C -sub_802E75C: @ 802E75C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r1, 0x6 - ldrsh r0, [r4, r1] - lsls r0, 3 - ldr r1, =gUnknown_082FE6C8 - adds r0, r1 - bl LoadCompressedObjectPic - movs r2, 0x8 - ldrsh r0, [r4, r2] - lsls r0, 3 - ldr r1, =gUnknown_082FE6D8 - adds r0, r1 - bl LoadSpritePalette - movs r5, 0 - movs r3, 0x10 - ldrsh r0, [r4, r3] - cmp r5, r0 - bge _0802E7C4 -_0802E790: - movs r0, 0x4 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - ldr r1, =gUnknown_082FE730 - adds r0, r1 - movs r2, 0x12 - ldrsh r1, [r4, r2] - movs r3, 0x14 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0xE] - bl CreateSprite - lsls r1, r5, 1 - adds r1, r4 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x1A] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r5, r0 - blt _0802E790 -_0802E7C4: - movs r5, 0 - movs r2, 0x10 - ldrsh r0, [r4, r2] - cmp r5, r0 - bge _0802E820 - movs r7, 0x3 - movs r3, 0xD - negs r3, r3 - mov r12, r3 - ldr r6, =gSprites -_0802E7D8: - lsls r0, r5, 1 - adds r0, r4 - movs r1, 0x1A - ldrsh r0, [r0, r1] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldrb r1, [r4, 0xC] - ands r1, r7 - lsls r1, 2 - ldrb r3, [r2, 0x5] - mov r0, r12 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - ldrh r0, [r4, 0xA] - strh r0, [r2, 0x30] - mov r3, r8 - strh r3, [r2, 0x34] - strh r5, [r2, 0x36] - ldrh r0, [r4, 0x1A] - strh r0, [r2, 0x38] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r5, r0 - blt _0802E7D8 -_0802E820: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E75C - - thumb_func_start sub_802E83C -sub_802E83C: @ 802E83C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r1, =gTasks + 0x8 - adds r4, r1 - movs r5, 0 - strh r5, [r4, 0x4] - strh r5, [r4, 0x6] - strh r5, [r4, 0x8] - movs r1, 0x3C - strh r1, [r4, 0xA] - strh r5, [r4, 0xC] - strh r5, [r4, 0xE] - movs r1, 0x3 - strh r1, [r4, 0x10] - movs r1, 0x78 - strh r1, [r4, 0x12] - movs r1, 0x58 - strh r1, [r4, 0x14] - adds r1, r4, 0 - bl sub_802E75C - movs r0, 0x1C - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - movs r1, 0x4 - bl StartSpriteAnim - movs r0, 0x1C - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffe0 - strh r1, [r0, 0x24] - movs r0, 0x1E - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x5 - bl StartSpriteAnim - movs r0, 0x1E - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x20 - strh r1, [r0, 0x24] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E83C - - thumb_func_start sub_802E8C8 -sub_802E8C8: @ 802E8C8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - b _0802E8FC - .pool -_0802E8E0: - lsls r0, r5, 1 - adds r0, r4 - movs r2, 0x1A - ldrsh r1, [r0, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0802E8FC: - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r5, r0 - blt _0802E8E0 - ldr r1, =gUnknown_082FE6C8 - movs r2, 0x6 - ldrsh r0, [r4, r2] - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x6] - bl FreeSpriteTilesByTag - ldr r1, =gUnknown_082FE6D8 - movs r2, 0x8 - ldrsh r0, [r4, r2] - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl FreeSpritePaletteByTag - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E8C8 - - thumb_func_start sub_802E938 -sub_802E938: @ 802E938 - push {r4-r6,lr} - adds r6, r0, 0 - movs r0, 0x34 - ldrsh r1, [r6, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r1, 0x16 - ldrsh r0, [r5, r1] - movs r2, 0xA - ldrsh r1, [r5, r2] - bl __modsi3 - cmp r0, 0 - bne _0802EA4A - ldrh r2, [r5, 0x16] - movs r3, 0x16 - ldrsh r1, [r5, r3] - movs r3, 0x14 - ldrsh r0, [r5, r3] - cmp r1, r0 - beq _0802EA4A - strh r2, [r5, 0x14] - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x4 - bhi _0802EA44 - lsls r0, 2 - ldr r1, =_0802E984 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802E984: - .4byte _0802E998 - .4byte _0802E9A6 - .4byte _0802E9A6 - .4byte _0802E9BA - .4byte _0802EA04 -_0802E998: - adds r2, r6, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_0802E9A6: - movs r0, 0x38 - bl PlaySE - ldrh r1, [r6, 0x32] - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl StartSpriteAnim - b _0802EA44 -_0802E9BA: - movs r0, 0x15 - bl PlaySE - ldrh r1, [r6, 0x32] - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl StartSpriteAnim - ldr r4, =gSprites - movs r2, 0x1C - ldrsh r0, [r5, r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - strb r0, [r1] - movs r3, 0x1E - ldrsh r1, [r5, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - ands r2, r1 - strb r2, [r0] - b _0802EA44 - .pool -_0802EA04: - adds r1, r6, 0 - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - ldr r3, =gSprites - movs r0, 0x1C - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - movs r0, 0x1E - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - movs r0, 0x4 - strh r0, [r5] - b _0802EA4A - .pool -_0802EA44: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] -_0802EA4A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802E938 - - thumb_func_start sub_802EA50 -sub_802EA50: @ 802EA50 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r5, =gTasks + 0x8 - adds r6, r4, r5 - movs r0, 0x38 - bl PlaySE - ldr r2, =gSprites - movs r0, 0x1A - ldrsh r1, [r6, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r2, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_802E938 - str r1, [r0] - movs r0, 0x1A - ldrsh r1, [r6, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - subs r5, 0x8 - adds r4, r5 - movs r0, 0x3 - strh r0, [r4, 0x8] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EA50 - - thumb_func_start sub_802EAB0 -sub_802EAB0: @ 802EAB0 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0802EB14 - ldr r1, =gUnknown_03003090 - ldrh r0, [r1, 0x2] - ldr r5, =0x00007fff - cmp r0, r5 - bne _0802EAD8 - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x16] -_0802EAD8: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0802EB1A - ldrh r0, [r4, 0x18] - adds r0, 0x1 - strh r0, [r4, 0x18] - mov r0, sp - movs r1, 0 - movs r2, 0xC - bl memset - mov r0, sp - strh r5, [r0] - mov r1, sp - ldrh r0, [r4, 0x18] - strh r0, [r1, 0x2] - mov r0, sp - bl sub_800FE50 - b _0802EB1A - .pool -_0802EB14: - ldrh r0, [r4, 0x16] - adds r0, 0x1 - strh r0, [r4, 0x16] -_0802EB1A: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802EAB0 - - thumb_func_start sub_802EB24 -sub_802EB24: @ 802EB24 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r0, [sp, 0x18] - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =sub_802EB98 - movs r1, 0x50 - str r3, [sp] - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xC] - strh r5, [r1, 0xE] - strh r6, [r1, 0x10] - ldr r3, [sp] - strh r3, [r1, 0x12] - mov r0, r8 - strh r0, [r1, 0x14] - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EB24 - - thumb_func_start sub_802EB84 -sub_802EB84: @ 802EB84 - push {lr} - ldr r0, =sub_802EB98 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802EB84 - - thumb_func_start sub_802EB98 -sub_802EB98: @ 802EB98 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _0802EC08 - cmp r0, 0x1 - bgt _0802EBC0 - cmp r0, 0 - beq _0802EBC6 - b _0802EC8A - .pool -_0802EBC0: - cmp r0, 0x2 - beq _0802EC4C - b _0802EC8A -_0802EBC6: - ldrh r0, [r5, 0x4] - ldrh r1, [r5, 0x6] - bl sub_802EF50 - ldrh r0, [r5, 0x4] - ldrh r1, [r5, 0x6] - movs r3, 0x8 - ldrsh r2, [r5, r3] - movs r4, 0xA - ldrsh r3, [r5, r4] - ldrb r4, [r5, 0xC] - str r4, [sp] - bl sub_802EFA8 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0xE] - ldrh r0, [r5, 0x4] - ldrh r1, [r5, 0x6] - movs r3, 0x8 - ldrsh r2, [r5, r3] - movs r4, 0xA - ldrsh r3, [r5, r4] - ldrb r4, [r5, 0xC] - str r4, [sp] - adds r4, r5, 0 - adds r4, 0x10 - str r4, [sp, 0x4] - adds r4, 0x2 - str r4, [sp, 0x8] - bl sub_802EFFC - b _0802EC3E -_0802EC08: - ldrb r0, [r5, 0xE] - bl sub_802EC98 - cmp r0, 0 - bne _0802EC8A - ldrb r0, [r5, 0xE] - ldrb r1, [r5, 0x10] - ldrb r2, [r5, 0x12] - bl sub_802EDCC - movs r0, 0xE - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - movs r3, 0xE - ldrsh r1, [r5, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite -_0802EC3E: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - b _0802EC8A - .pool -_0802EC4C: - ldrb r0, [r5, 0x10] - bl sub_802EE30 - cmp r0, 0 - bne _0802EC8A - movs r4, 0x10 - ldrsh r1, [r5, r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - movs r0, 0x12 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldrh r0, [r5, 0x4] - bl FreeSpriteTilesByTag - ldrh r0, [r5, 0x6] - bl FreeSpritePaletteByTag - adds r0, r6, 0 - bl DestroyTask -_0802EC8A: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EB98 - - thumb_func_start sub_802EC98 -sub_802EC98: @ 802EC98 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r4, r1, r0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x7 - bls _0802ECB2 - b _0802EDC4 -_0802ECB2: - lsls r0, 2 - ldr r1, =_0802ECC4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802ECC4: - .4byte _0802ECE4 - .4byte _0802ECF6 - .4byte _0802ED1C - .4byte _0802ED2C - .4byte _0802ED4E - .4byte _0802ED86 - .4byte _0802EDAC - .4byte _0802ED82 -_0802ECE4: - movs r1, 0x80 - lsls r1, 4 - adds r0, r4, 0 - movs r2, 0x1A - bl sub_8007E18 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_0802ECF6: - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _0802ED04 - movs r0, 0x39 - bl PlaySE -_0802ED04: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0802EDC4 - movs r0, 0 - strh r0, [r4, 0x32] - adds r0, r4, 0 - movs r1, 0x1 - b _0802EDA2 -_0802ED1C: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0802EDC4 - b _0802EDA6 -_0802ED2C: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _0802EDC4 - movs r0, 0 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAffineAnim - b _0802EDC4 -_0802ED4E: - ldrh r0, [r4, 0x22] - subs r0, 0x4 - strh r0, [r4, 0x22] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _0802EDC4 - ldrh r1, [r4, 0x36] - movs r2, 0x36 - ldrsh r0, [r4, r2] - cmp r0, 0x1 - bgt _0802ED7E - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - movs r0, 0 - strh r0, [r4, 0x32] - b _0802EDA6 -_0802ED7E: - movs r0, 0x7 - strh r0, [r4, 0x2E] -_0802ED82: - movs r0, 0 - b _0802EDC6 -_0802ED86: - ldrh r0, [r4, 0x22] - adds r0, 0x4 - strh r0, [r4, 0x22] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _0802EDC4 - movs r0, 0 - strh r0, [r4, 0x32] - adds r0, r4, 0 - movs r1, 0x3 -_0802EDA2: - bl StartSpriteAffineAnim -_0802EDA6: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - b _0802EDC2 -_0802EDAC: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0802EDC4 - ldrh r0, [r4, 0x36] - adds r0, 0x1 - strh r0, [r4, 0x36] - movs r0, 0x1 -_0802EDC2: - strh r0, [r4, 0x2E] -_0802EDC4: - movs r0, 0x1 -_0802EDC6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802EC98 - - thumb_func_start sub_802EDCC -sub_802EDCC: @ 802EDCC - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gSprites - mov r8, r0 - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - adds r5, r4, r0 - ldr r0, =0x0000ffd8 - strh r0, [r5, 0x26] - lsls r3, r2, 4 - adds r3, r2 - lsls r3, 2 - mov r1, r8 - adds r2, r3, r1 - strh r0, [r2, 0x26] - adds r5, 0x3E - ldrb r6, [r5] - movs r1, 0x5 - negs r1, r1 - adds r0, r1, 0 - ands r0, r6 - strb r0, [r5] - adds r2, 0x3E - ldrb r0, [r2] - ands r1, r0 - strb r1, [r2] - movs r0, 0x1C - add r8, r0 - add r4, r8 - ldr r0, =sub_802EE5C - str r0, [r4] - add r3, r8 - str r0, [r3] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EDCC - - thumb_func_start sub_802EE30 -sub_802EE30: @ 802EE30 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r2, 0x1C - adds r1, r2 - ldr r1, [r1] - ldr r0, =sub_802EE5C - cmp r1, r0 - bne _0802EE4E - movs r3, 0x1 -_0802EE4E: - adds r0, r3, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802EE30 - - thumb_func_start sub_802EE5C -sub_802EE5C: @ 802EE5C - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r5, 0 - adds r4, 0x2E - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0x4 - bhi _0802EF46 - lsls r0, 2 - ldr r1, =_0802EE7C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802EE7C: - .4byte _0802EE90 - .4byte _0802EEA0 - .4byte _0802EEC8 - .4byte _0802EEFC - .4byte _0802EF34 -_0802EE90: - movs r0, 0x40 - strh r0, [r4, 0x8] - ldrh r0, [r5, 0x26] - lsls r0, 4 - strh r0, [r4, 0xA] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_0802EEA0: - ldrh r1, [r4, 0x8] - ldrh r2, [r4, 0xA] - adds r0, r1, r2 - strh r0, [r4, 0xA] - adds r1, 0x1 - strh r1, [r4, 0x8] - lsls r0, 16 - asrs r0, 20 - strh r0, [r5, 0x26] - cmp r0, 0 - blt _0802EF46 - movs r0, 0x39 - bl PlaySE - movs r0, 0 - strh r0, [r5, 0x26] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _0802EF46 -_0802EEC8: - ldrh r0, [r4, 0x2] - adds r0, 0xC - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7F - ble _0802EEE6 - movs r0, 0x39 - bl PlaySE - movs r0, 0 - strh r0, [r4, 0x2] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_0802EEE6: - ldr r0, =gSineTable - movs r2, 0x2 - ldrsh r1, [r4, r2] - lsls r1, 1 - adds r1, r0 - movs r2, 0 - ldrsh r0, [r1, r2] - asrs r0, 4 - b _0802EF2A - .pool -_0802EEFC: - ldrh r0, [r4, 0x2] - adds r0, 0x10 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7F - ble _0802EF1A - movs r0, 0x39 - bl PlaySE - movs r0, 0 - strh r0, [r4, 0x2] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_0802EF1A: - ldr r1, =gSineTable - movs r2, 0x2 - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 16 - asrs r0, 21 -_0802EF2A: - negs r0, r0 - strh r0, [r5, 0x26] - b _0802EF46 - .pool -_0802EF34: - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x28 - ble _0802EF46 - ldr r0, =SpriteCallbackDummy - str r0, [r5, 0x1C] -_0802EF46: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EE5C - - thumb_func_start sub_802EF50 -sub_802EF50: @ 802EF50 - push {r4,lr} - sub sp, 0x10 - lsls r1, 16 - lsrs r1, 16 - ldr r2, =gUnknown_082FEBCC - ldr r3, [r2, 0x4] - ldr r2, [r2] - str r2, [sp] - str r3, [sp, 0x4] - ldr r2, =gUnknown_082FEBD4 - ldr r3, [r2, 0x4] - ldr r2, [r2] - str r2, [sp, 0x8] - str r3, [sp, 0xC] - lsls r0, 16 - ldr r3, =0x0000ffff - ldr r2, [sp, 0x4] - ands r2, r3 - orrs r2, r0 - str r2, [sp, 0x4] - ldr r2, =0xffff0000 - add r4, sp, 0x8 - ldr r0, [r4, 0x4] - ands r0, r2 - orrs r0, r1 - str r0, [r4, 0x4] - mov r0, sp - bl LoadCompressedObjectPic - adds r0, r4, 0 - bl LoadSpritePalette - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EF50 - - thumb_func_start sub_802EFA8 -sub_802EFA8: @ 802EFA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - mov r12, r3 - ldr r3, [sp, 0x30] - lsls r1, 16 - lsrs r1, 16 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - mov r5, sp - ldr r4, =gUnknown_082FEC90 - ldm r4!, {r3,r6,r7} - stm r5!, {r3,r6,r7} - ldm r4!, {r3,r6,r7} - stm r5!, {r3,r6,r7} - mov r4, sp - strh r0, [r4] - mov r0, sp - strh r1, [r0, 0x2] - lsls r2, 16 - asrs r2, 16 - mov r0, r12 - lsls r6, r0, 16 - asrs r6, 16 - mov r0, sp - adds r1, r2, 0 - adds r2, r6, 0 - mov r3, r8 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802EFA8 - - thumb_func_start sub_802EFFC -sub_802EFFC: @ 802EFFC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - mov r12, r3 - ldr r6, [sp, 0x38] - ldr r3, [sp, 0x3C] - mov r9, r3 - ldr r4, [sp, 0x40] - mov r8, r4 - lsls r1, 16 - lsrs r1, 16 - lsls r6, 24 - lsrs r6, 24 - mov r10, r6 - mov r4, sp - ldr r3, =gUnknown_082FECA8 - ldm r3!, {r5-r7} - stm r4!, {r5-r7} - ldm r3!, {r5-r7} - stm r4!, {r5-r7} - mov r3, sp - strh r0, [r3] - mov r0, sp - strh r1, [r0, 0x2] - lsls r2, 16 - asrs r4, r2, 16 - ldr r0, =0xffe00000 - adds r2, r0 - asrs r2, 16 - mov r1, r12 - lsls r5, r1, 16 - asrs r5, 16 - mov r0, sp - adds r1, r2, 0 - adds r2, r5, 0 - mov r3, r10 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r3, r9 - strh r0, [r3] - adds r4, 0x20 - lsls r4, 16 - asrs r4, 16 - mov r0, sp - adds r1, r4, 0 - adds r2, r5, 0 - mov r3, r10 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r4, r8 - strh r0, [r4] - ldr r2, =gSprites - mov r5, r9 - movs r6, 0 - ldrsh r1, [r5, r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r3, 0x4 - orrs r1, r3 - strb r1, [r0] - movs r7, 0 - ldrsh r1, [r4, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r3 - strb r1, [r0] - movs r0, 0 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - bl StartSpriteAnim - 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 sub_802EFFC +@ break .align 2, 0 @ Don't pad with nop. diff --git a/asm/link_rfu.s b/asm/link_rfu.s new file mode 100644 index 000000000..d5d22a8db --- /dev/null +++ b/asm/link_rfu.s @@ -0,0 +1,11743 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .syntax unified + + .text + + thumb_func_start sub_800BEC0 +sub_800BEC0: @ 800BEC0 + push {r4,lr} + bl rfu_REQBN_softReset_and_checkID + adds r4, r0, 0 + ldr r0, =0x00008001 + cmp r4, r0 + bne _0800BED4 + ldr r1, =gUnknown_03004140 + movs r0, 0x1 + strb r0, [r1, 0x8] +_0800BED4: + ldr r0, =gUnknown_03004140 + ldrb r2, [r0, 0x4] + adds r1, r0, 0 + cmp r2, 0x17 + beq _0800BEE8 + cmp r2, 0x1 + beq _0800BEE8 + movs r0, 0 + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] +_0800BEE8: + movs r0, 0 + strb r0, [r1, 0x7] + strb r0, [r1, 0xD] + strb r0, [r1, 0x1] + strb r0, [r1] + movs r0, 0xFF + strb r0, [r1, 0x6] + bl sub_800D610 + adds r0, r4, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800BEC0 + + thumb_func_start rfu_REQ_sendData_wrapper +rfu_REQ_sendData_wrapper: @ 800BF0C + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0 + bne _0800BF34 + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x2] + movs r2, 0 + cmp r0, 0x1 + bne _0800BF3C + movs r2, 0x1 + b _0800BF3C + .pool +_0800BF34: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x3] + movs r1, 0 + strb r1, [r0, 0x3] +_0800BF3C: + adds r0, r2, 0 + bl rfu_REQ_sendData + pop {r0} + bx r0 + .pool + thumb_func_end rfu_REQ_sendData_wrapper + + thumb_func_start sub_800BF4C +sub_800BF4C: @ 800BF4C + push {r4-r6,lr} + sub sp, 0x4 + adds r5, r0, 0 + adds r6, r1, 0 + cmp r5, 0 + beq _0800BF94 + mov r1, sp + movs r0, 0 + strh r0, [r1] + ldr r4, =gUnknown_03004140 + ldr r2, =0x01000024 + mov r0, sp + adds r1, r4, 0 + bl CpuSet + movs r0, 0xFF + strb r0, [r4, 0x6] + str r5, [r4, 0x40] + str r6, [r4, 0x44] + ldr r0, =sub_800CEB0 + bl rfu_setMSCCallback + ldr r0, =sub_800C7B4 + bl rfu_setREQCallback + movs r0, 0 + b _0800BF96 + .pool +_0800BF94: + movs r0, 0x4 +_0800BF96: + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_800BF4C + + thumb_func_start sub_800BFA0 +sub_800BFA0: @ 800BFA0 + push {r4,lr} + sub sp, 0x4 + mov r1, sp + movs r0, 0 + strh r0, [r1] + ldr r4, =gUnknown_03004140 + ldr r2, =0x01000020 + mov r0, sp + adds r1, r4, 0 + bl CpuSet + movs r0, 0xFF + strb r0, [r4, 0x6] + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800BFA0 + + thumb_func_start sub_800BFCC +sub_800BFCC: @ 800BFCC + push {r4,lr} + adds r4, r0, 0 + bl sub_800C000 + ldr r1, =gUnknown_03004140 + movs r2, 0x1 + strb r2, [r1, 0x4] + movs r0, 0x2 + strb r0, [r1, 0x5] + str r4, [r1, 0x3C] + ldrb r0, [r4, 0x11] + strb r0, [r1, 0x9] + ldrh r0, [r4, 0x12] + strh r0, [r1, 0x32] + ldrh r0, [r4, 0x14] + strh r0, [r1, 0x18] + ldrb r0, [r4, 0x10] + cmp r0, 0 + beq _0800BFF4 + strb r2, [r1, 0xB] +_0800BFF4: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800BFCC + + thumb_func_start sub_800C000 +sub_800C000: @ 800C000 + push {r4,r5,lr} + ldr r2, =gUnknown_03004140 + movs r0, 0 + strb r0, [r2, 0x5] + strb r0, [r2, 0x4] + movs r1, 0xFF + strb r1, [r2, 0x6] + strb r0, [r2, 0x7] + strb r0, [r2, 0x10] + strb r0, [r2, 0xC] + adds r1, r2, 0 + adds r1, 0x24 + strb r0, [r1] + adds r1, 0xC + strb r0, [r1] + movs r3, 0 + adds r5, r2, 0 + adds r5, 0x28 + movs r4, 0 + adds r2, 0x34 +_0800C028: + lsls r1, r3, 1 + adds r0, r1, r5 + strh r4, [r0] + adds r1, r2 + strh r4, [r1] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800C028 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800C000 + + thumb_func_start sub_800C048 +sub_800C048: @ 800C048 + ldr r1, =gUnknown_03004140 + movs r0, 0x15 + strb r0, [r1, 0x4] + bx lr + .pool + thumb_func_end sub_800C048 + + thumb_func_start sub_800C054 +sub_800C054: @ 800C054 + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r6, r3, 0 + lsls r0, 24 + lsrs r5, r0, 24 + lsls r1, 16 + lsrs r7, r1, 16 + lsls r2, 16 + lsrs r2, 16 + mov r8, r2 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + cmp r0, 0 + beq _0800C090 + cmp r0, 0x8 + bne _0800C07A + cmp r5, 0x1 + beq _0800C090 +_0800C07A: + movs r0, 0x1 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x1 + b _0800C122 + .pool +_0800C090: + bl rfu_getMasterSlave + lsls r0, 24 + cmp r0, 0 + bne _0800C0B0 + ldr r1, =gUnknown_03004140 + movs r0, 0x2 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x2 + b _0800C122 + .pool +_0800C0B0: + movs r2, 0 + ldrh r0, [r6] + ldr r4, =0x0000ffff + adds r1, r6, 0x2 + ldr r3, =gUnknown_03004140 + cmp r0, r4 + beq _0800C0D0 +_0800C0BE: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xF + bhi _0800C0D0 + ldrh r0, [r1] + adds r1, 0x2 + cmp r0, r4 + bne _0800C0BE +_0800C0D0: + cmp r2, 0x10 + bne _0800C0EC + movs r0, 0x4 + strh r0, [r3, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x4 + b _0800C122 + .pool +_0800C0EC: + cmp r5, 0x1 + bls _0800C0FA + movs r0, 0x1 + strb r0, [r3, 0x7] + movs r5, 0x1 + movs r7, 0 + b _0800C0FE +_0800C0FA: + movs r0, 0 + strb r0, [r3, 0x7] +_0800C0FE: + cmp r5, 0 + beq _0800C108 + movs r0, 0x5 + strb r0, [r3, 0x4] + b _0800C116 +_0800C108: + movs r0, 0x9 + strb r0, [r3, 0x4] + ldrb r0, [r3, 0xB] + cmp r0, 0 + beq _0800C116 + movs r0, 0x2 + strb r0, [r3, 0xB] +_0800C116: + strb r5, [r3, 0x6] + strh r7, [r3, 0x1A] + mov r0, r8 + strh r0, [r3, 0x26] + str r6, [r3, 0x20] + movs r0, 0 +_0800C122: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800C054 + + thumb_func_start sub_800C12C +sub_800C12C: @ 800C12C + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 16 + lsrs r6, r0, 16 + lsls r1, 16 + lsrs r1, 16 + mov r8, r1 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + cmp r0, 0 + beq _0800C164 + subs r0, 0x9 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bls _0800C164 + movs r0, 0x1 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x1 + b _0800C204 + .pool +_0800C164: + bl rfu_getMasterSlave + lsls r0, 24 + cmp r0, 0 + bne _0800C184 + ldr r1, =gUnknown_03004140 + movs r0, 0x2 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x2 + b _0800C204 + .pool +_0800C184: + movs r2, 0 + ldr r0, =gUnknown_03007890 + ldr r1, [r0] + ldrb r3, [r1, 0x8] + ldr r5, =gUnknown_03004140 + adds r7, r0, 0 + cmp r2, r3 + bcs _0800C1B2 + ldrh r0, [r1, 0x14] + cmp r0, r6 + beq _0800C1B2 + adds r4, r1, 0 + adds r1, r3, 0 +_0800C19E: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, r1 + bcs _0800C1B2 + lsls r0, r2, 5 + adds r0, r4, r0 + ldrh r0, [r0, 0x14] + cmp r0, r6 + bne _0800C19E +_0800C1B2: + ldr r0, [r7] + ldrb r0, [r0, 0x8] + cmp r0, 0 + beq _0800C1BE + cmp r2, r0 + bne _0800C1D8 +_0800C1BE: + movs r0, 0x3 + strh r0, [r5, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x3 + b _0800C204 + .pool +_0800C1D8: + ldrb r0, [r5, 0x4] + cmp r0, 0 + beq _0800C1E2 + cmp r0, 0x9 + bne _0800C1EA +_0800C1E2: + movs r0, 0xC + strb r0, [r5, 0x4] + movs r0, 0xD + b _0800C1F0 +_0800C1EA: + movs r0, 0xB + strb r0, [r5, 0x4] + movs r0, 0xC +_0800C1F0: + strb r0, [r5, 0x5] + strh r6, [r5, 0x1E] + mov r0, r8 + strh r0, [r5, 0x1A] + ldrb r0, [r5, 0x7] + cmp r0, 0 + beq _0800C202 + movs r0, 0x7 + strb r0, [r5, 0x7] +_0800C202: + movs r0, 0 +_0800C204: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800C12C + + thumb_func_start sub_800C210 +sub_800C210: @ 800C210 + push {r4-r7,lr} + lsls r0, 24 + lsrs r1, r0, 24 + ldr r6, =gUnknown_03004140 + adds r3, r6, 0 + adds r3, 0x30 + ldrb r2, [r3] + adds r0, r1, 0 + ands r0, r2 + cmp r0, 0 + beq _0800C26C + adds r0, r2, 0 + bics r0, r1 + strb r0, [r3] + movs r4, 0 + ldr r7, =gUnknown_03007890 + movs r5, 0x1 + adds r3, 0x4 + movs r2, 0 +_0800C236: + adds r0, r1, 0 + asrs r0, r4 + ands r0, r5 + cmp r0, 0 + beq _0800C246 + lsls r0, r4, 1 + adds r0, r3 + strh r2, [r0] +_0800C246: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800C236 + ldr r0, [r7] + ldrb r4, [r0, 0x3] + ands r4, r1 + cmp r4, 0 + beq _0800C260 + adds r0, r4, 0 + bl sub_800D334 +_0800C260: + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x33 + adds r1, r4, 0 + bl sub_800D30C +_0800C26C: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800C210 + + thumb_func_start sub_800C27C +sub_800C27C: @ 800C27C + push {r4,r5,lr} + lsls r0, 24 + movs r2, 0 + ldr r1, =gUnknown_03004140 + strb r2, [r1, 0x7] + adds r5, r1, 0 + cmp r0, 0 + beq _0800C29C + bl sub_800C000 + movs r0, 0x17 + strb r0, [r5, 0x4] + b _0800C366 + .pool +_0800C29C: + ldrb r0, [r5, 0x4] + subs r0, 0x5 + cmp r0, 0xD + bhi _0800C352 + lsls r0, 2 + ldr r1, =_0800C2B4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C2B4: + .4byte _0800C2EC + .4byte _0800C2F8 + .4byte _0800C2F8 + .4byte _0800C358 + .4byte _0800C302 + .4byte _0800C30C + .4byte _0800C30C + .4byte _0800C316 + .4byte _0800C320 + .4byte _0800C320 + .4byte _0800C358 + .4byte _0800C326 + .4byte _0800C34C + .4byte _0800C34C +_0800C2EC: + movs r1, 0 + movs r0, 0x8 + strb r0, [r5, 0x4] + strb r1, [r5, 0x5] + movs r2, 0x13 + b _0800C358 +_0800C2F8: + movs r0, 0x7 + strb r0, [r5, 0x4] + movs r0, 0x8 + strb r0, [r5, 0x5] + b _0800C358 +_0800C302: + movs r0, 0 + strb r0, [r5, 0x5] + strb r0, [r5, 0x4] + movs r2, 0x21 + b _0800C358 +_0800C30C: + movs r1, 0 + movs r0, 0xB + strb r0, [r5, 0x4] + strb r1, [r5, 0x5] + b _0800C358 +_0800C316: + movs r0, 0 + strb r0, [r5, 0x5] + strb r0, [r5, 0x4] + movs r2, 0x23 + b _0800C358 +_0800C320: + movs r0, 0xE + strb r0, [r5, 0x4] + b _0800C358 +_0800C326: + ldrb r0, [r5, 0x11] + strb r0, [r5, 0x4] + ldrb r0, [r5, 0x12] + strb r0, [r5, 0x5] + ldr r4, =gUnknown_03007890 + ldr r0, [r4] + ldrb r0, [r0, 0x3] + bl sub_800D334 + ldr r0, [r4] + ldrb r0, [r0, 0x3] + strh r0, [r5, 0x14] + movs r0, 0x33 + movs r1, 0x1 + bl sub_800D30C + b _0800C366 + .pool +_0800C34C: + movs r0, 0x12 + strb r0, [r5, 0x4] + b _0800C358 +_0800C352: + strb r2, [r5, 0x5] + strb r2, [r5, 0x4] + movs r2, 0x43 +_0800C358: + ldrb r0, [r5, 0x4] + cmp r0, 0 + bne _0800C366 + adds r0, r2, 0 + movs r1, 0 + bl sub_800D30C +_0800C366: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_800C27C + + thumb_func_start sub_800C36C +sub_800C36C: @ 800C36C + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x4 + lsls r0, 16 + lsrs r0, 16 + movs r1, 0 + mov r8, r1 + mov r5, sp + adds r5, 0x1 + mov r4, sp + adds r4, 0x2 + mov r1, sp + adds r2, r5, 0 + adds r3, r4, 0 + bl rfu_REQBN_watchLink + mov r0, sp + ldrb r0, [r0] + adds r7, r4, 0 + cmp r0, 0 + beq _0800C43E + ldr r1, =gUnknown_03004140 + mov r0, sp + ldrb r0, [r0] + strh r0, [r1, 0x14] + ldrb r0, [r5] + strh r0, [r1, 0x16] + ldrb r0, [r1, 0x9] + adds r6, r1, 0 + cmp r0, 0 + beq _0800C426 + movs r0, 0x1 + strb r0, [r6, 0xA] + ldrb r0, [r6, 0x6] + cmp r0, 0 + bne _0800C3C2 + ldrb r0, [r5] + cmp r0, 0 + bne _0800C3C2 + movs r0, 0x4 + strb r0, [r6, 0xA] +_0800C3C2: + ldrb r0, [r6, 0xA] + cmp r0, 0x1 + bne _0800C40C + movs r2, 0 + mov r4, sp + movs r5, 0x1 + mov r12, r6 + mov r3, r12 + adds r3, 0x30 + movs r6, 0x34 + add r6, r12 + mov r9, r6 +_0800C3DA: + ldrb r0, [r4] + asrs r0, r2 + ands r0, r5 + cmp r0, 0 + beq _0800C3F8 + adds r0, r5, 0 + lsls r0, r2 + ldrb r1, [r3] + orrs r0, r1 + strb r0, [r3] + lsls r0, r2, 1 + add r0, r9 + mov r6, r12 + ldrh r1, [r6, 0x32] + strh r1, [r0] +_0800C3F8: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C3DA + movs r0, 0x31 + b _0800C41E + .pool +_0800C40C: + movs r0, 0 + strb r0, [r6, 0xA] + mov r0, sp + ldrb r0, [r0] + bl sub_800D334 + movs r0, 0x1 + mov r8, r0 + movs r0, 0x33 +_0800C41E: + movs r1, 0x1 + bl sub_800D30C + b _0800C43A +_0800C426: + mov r0, sp + ldrb r0, [r0] + bl sub_800D334 + movs r1, 0x1 + mov r8, r1 + movs r0, 0x30 + movs r1, 0x2 + bl sub_800D30C +_0800C43A: + bl sub_800D610 +_0800C43E: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800C518 + ldrb r0, [r7] + cmp r0, 0 + beq _0800C49C + movs r2, 0 + ldr r6, =gUnknown_03004140 + movs r3, 0x1 + adds r4, r6, 0 + adds r4, 0x34 + adds r6, 0x30 + adds r5, r7, 0 +_0800C45C: + ldrb r0, [r6] + asrs r0, r2 + ands r0, r3 + cmp r0, 0 + beq _0800C478 + ldrb r0, [r5] + asrs r0, r2 + ands r0, r3 + cmp r0, 0 + beq _0800C478 + lsls r0, r2, 1 + adds r0, r4 + movs r1, 0 + strh r1, [r0] +_0800C478: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C45C + ldr r3, =gUnknown_03004140 + adds r2, r3, 0 + adds r2, 0x30 + ldrb r1, [r7] + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r7] + strh r0, [r3, 0x14] + movs r0, 0x32 + movs r1, 0x1 + bl sub_800D30C +_0800C49C: + ldr r0, =gUnknown_03004140 + adds r3, r0, 0 + adds r3, 0x30 + ldrb r1, [r3] + adds r6, r0, 0 + cmp r1, 0 + beq _0800C514 + movs r4, 0 + movs r2, 0 + movs r5, 0x1 +_0800C4B0: + ldrb r0, [r3] + asrs r0, r2 + ands r0, r5 + cmp r0, 0 + beq _0800C4E2 + lsls r1, r2, 1 + adds r0, r6, 0 + adds r0, 0x34 + adds r1, r0 + ldrh r0, [r1] + cmp r0, 0 + beq _0800C4E2 + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + bne _0800C4E2 + adds r0, r5, 0 + lsls r0, r2 + ldrb r1, [r3] + bics r1, r0 + strb r1, [r3] + orrs r4, r0 + lsls r0, r4, 24 + lsrs r4, r0, 24 +_0800C4E2: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C4B0 + cmp r4, 0 + beq _0800C506 + adds r0, r4, 0 + bl sub_800D334 + movs r6, 0x1 + mov r8, r6 + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x33 + movs r1, 0x1 + bl sub_800D30C +_0800C506: + ldr r0, =gUnknown_03004140 + adds r1, r0, 0 + adds r1, 0x30 + ldrb r1, [r1] + adds r6, r0, 0 + cmp r1, 0 + bne _0800C518 +_0800C514: + movs r0, 0 + strb r0, [r6, 0xA] +_0800C518: + mov r0, r8 + add sp, 0x4 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800C36C + + thumb_func_start rfu_syncVBlank_ +rfu_syncVBlank_: @ 800C530 + push {lr} + bl rfu_syncVBlank + lsls r0, 16 + cmp r0, 0 + beq _0800C548 + movs r0, 0xF1 + movs r1, 0 + bl sub_800D30C + bl sub_800D610 +_0800C548: + pop {r0} + bx r0 + thumb_func_end rfu_syncVBlank_ + + thumb_func_start sub_800C54C +sub_800C54C: @ 800C54C + push {r4,lr} + adds r3, r0, 0 + ldr r1, =gUnknown_03004140 + ldr r2, [r1, 0x40] + cmp r2, 0 + bne _0800C568 + ldrb r0, [r1, 0x4] + cmp r0, 0 + beq _0800C568 + strb r2, [r1, 0x4] + b _0800C736 + .pool +_0800C568: + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x7] + cmp r0, 0 + beq _0800C576 + adds r0, r3, 0 + bl sub_800C744 +_0800C576: + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x4] + cmp r0, 0 + bne _0800C580 + b _0800C700 +_0800C580: + bl rfu_waitREQComplete + movs r0, 0x1 + strb r0, [r4, 0xE] + ldrb r0, [r4, 0x4] + subs r0, 0x1 + cmp r0, 0x16 + bls _0800C592 + b _0800C6F6 +_0800C592: + lsls r0, 2 + ldr r1, =_0800C5A4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C5A4: + .4byte _0800C624 + .4byte _0800C65C + .4byte _0800C662 + .4byte _0800C678 + .4byte _0800C690 + .4byte _0800C696 + .4byte _0800C69C + .4byte _0800C6F6 + .4byte _0800C6A2 + .4byte _0800C6A8 + .4byte _0800C6AE + .4byte _0800C6B4 + .4byte _0800C6C4 + .4byte _0800C6CA + .4byte _0800C6F6 + .4byte _0800C6D0 + .4byte _0800C6E0 + .4byte _0800C6E6 + .4byte _0800C6EC + .4byte _0800C6F6 + .4byte _0800C6F2 + .4byte _0800C6F6 + .4byte _0800C600 +_0800C600: + bl sub_800BEC0 + ldr r1, =0x00008001 + movs r2, 0xFF + cmp r0, r1 + bne _0800C60E + movs r2, 0x44 +_0800C60E: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + adds r0, r2, 0 + b _0800C64E + .pool +_0800C624: + bl sub_800BEC0 + ldr r1, =0x00008001 + cmp r0, r1 + bne _0800C644 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + movs r1, 0x3 + strb r1, [r0, 0x5] + b _0800C6F6 + .pool +_0800C644: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + movs r0, 0xFF +_0800C64E: + movs r1, 0 + bl sub_800D30C + b _0800C6F6 + .pool +_0800C65C: + bl rfu_REQ_reset + b _0800C6F6 +_0800C662: + ldr r0, =gUnknown_03004140 + ldr r2, [r0, 0x3C] + ldrh r0, [r2, 0x2] + ldrb r1, [r2] + ldrb r2, [r2, 0x1] + bl rfu_REQ_configSystem + b _0800C6F6 + .pool +_0800C678: + ldr r0, =gUnknown_03004140 + ldr r3, [r0, 0x3C] + ldrb r0, [r3, 0x4] + ldrh r1, [r3, 0x6] + ldr r2, [r3, 0x8] + ldr r3, [r3, 0xC] + bl rfu_REQ_configGameData + b _0800C6F6 + .pool +_0800C690: + bl rfu_REQ_startSearchChild + b _0800C6F6 +_0800C696: + bl rfu_REQ_pollSearchChild + b _0800C6F6 +_0800C69C: + bl rfu_REQ_endSearchChild + b _0800C6F6 +_0800C6A2: + bl rfu_REQ_startSearchParent + b _0800C6F6 +_0800C6A8: + bl rfu_REQ_pollSearchParent + b _0800C6F6 +_0800C6AE: + bl rfu_REQ_endSearchParent + b _0800C6F6 +_0800C6B4: + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x1E] + bl rfu_REQ_startConnectParent + b _0800C6F6 + .pool +_0800C6C4: + bl rfu_REQ_pollConnectParent + b _0800C6F6 +_0800C6CA: + bl rfu_REQ_endConnectParent + b _0800C6F6 +_0800C6D0: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x3] + bl rfu_REQ_CHILD_startConnectRecovery + b _0800C6F6 + .pool +_0800C6E0: + bl rfu_REQ_CHILD_pollConnectRecovery + b _0800C6F6 +_0800C6E6: + bl rfu_REQ_CHILD_endConnectRecovery + b _0800C6F6 +_0800C6EC: + bl rfu_REQ_changeMasterSlave + b _0800C6F6 +_0800C6F2: + bl rfu_REQ_stopMode +_0800C6F6: + bl rfu_waitREQComplete + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0xE] +_0800C700: + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x4] + subs r0, 0x12 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _0800C710 + b _0800C576 +_0800C710: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800C726 + movs r0, 0 + bl sub_800C36C + lsls r0, 24 + cmp r0, 0 + bne _0800C736 +_0800C726: + bl sub_800CF34 + bl sub_800D158 + bl sub_800D268 + bl sub_800D434 +_0800C736: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800C54C + + thumb_func_start sub_800C744 +sub_800C744: @ 800C744 + push {r4,lr} + adds r3, r0, 0 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x7] + adds r4, r0, 0 + cmp r1, 0x5 + bne _0800C76E + movs r2, 0x1 + strb r2, [r4, 0x6] + strb r1, [r4, 0x4] + ldrh r0, [r4, 0x1C] + strh r0, [r4, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C76C + movs r0, 0x6 + strb r0, [r4, 0x7] + b _0800C76E + .pool +_0800C76C: + strb r2, [r4, 0x7] +_0800C76E: + ldrb r0, [r4, 0x7] + cmp r0, 0x1 + bne _0800C798 + strb r0, [r4, 0x6] + movs r0, 0x5 + strb r0, [r4, 0x4] + adds r0, r3, 0 + movs r1, 0x8C + bl __umodsi3 + strh r0, [r4, 0x1A] + movs r1, 0x8C + subs r1, r0 + strh r1, [r4, 0x1C] + lsls r0, 16 + cmp r0, 0 + beq _0800C794 + movs r0, 0x2 + b _0800C796 +_0800C794: + movs r0, 0x3 +_0800C796: + strb r0, [r4, 0x7] +_0800C798: + ldrb r0, [r4, 0x7] + cmp r0, 0x3 + bne _0800C7AE + movs r0, 0 + strb r0, [r4, 0x6] + movs r0, 0x28 + strh r0, [r4, 0x1A] + movs r0, 0x4 + strb r0, [r4, 0x7] + movs r0, 0x9 + strb r0, [r4, 0x4] +_0800C7AE: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_800C744 + + thumb_func_start sub_800C7B4 +sub_800C7B4: @ 800C7B4 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x4 + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + lsls r1, 16 + lsrs r6, r1, 16 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0xE] + adds r7, r0, 0 + cmp r1, 0 + bne _0800C7D2 + b _0800CC98 +_0800C7D2: + movs r0, 0 + strb r0, [r7, 0xE] + mov r0, r8 + subs r0, 0x10 + cmp r0, 0x2D + bls _0800C7E0 + b _0800CC8A +_0800C7E0: + lsls r0, 2 + ldr r1, =_0800C7F4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C7F4: + .4byte _0800C8AC + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800C8D8 + .4byte _0800C8C4 + .4byte _0800CC8A + .4byte _0800C8EC + .4byte _0800C8FC + .4byte _0800C920 + .4byte _0800C940 + .4byte _0800C960 + .4byte _0800C9D0 + .4byte _0800CA02 + .4byte _0800CA18 + .4byte _0800CA60 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CBD8 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CAD0 + .4byte _0800CB1C + .4byte _0800CB64 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC78 +_0800C8AC: + cmp r6, 0 + beq _0800C8B2 + b _0800CC8A +_0800C8B2: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + movs r1, 0x4 + strb r1, [r0, 0x5] + b _0800CC8A + .pool +_0800C8C4: + cmp r6, 0 + beq _0800C8CA + b _0800CC8A +_0800C8CA: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + strb r6, [r0, 0x5] + b _0800CC8A + .pool +_0800C8D8: + cmp r6, 0 + beq _0800C8DE + b _0800CC8A +_0800C8DE: + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0x5] + strb r6, [r0, 0x4] + movs r0, 0 + b _0800CBF6 + .pool +_0800C8EC: + cmp r6, 0 + beq _0800C8F2 + b _0800CC8A +_0800C8F2: + ldr r1, =gUnknown_03004140 + movs r0, 0x6 + b _0800CA0C + .pool +_0800C8FC: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800C906 + b _0800CC8A +_0800C906: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C912 + b _0800CC8A +_0800C912: + movs r0, 0x7 + strb r0, [r1, 0x4] + movs r0, 0x8 + strb r0, [r1, 0x5] + b _0800CC8A + .pool +_0800C920: + cmp r6, 0 + beq _0800C926 + b _0800CC8A +_0800C926: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + strb r6, [r0, 0x5] + ldrb r0, [r0, 0x7] + cmp r0, 0 + beq _0800C936 + b _0800CC8A +_0800C936: + movs r0, 0x13 + b _0800CBF6 + .pool +_0800C940: + cmp r6, 0 + beq _0800C946 + b _0800CC8A +_0800C946: + ldrb r0, [r7, 0xB] + cmp r0, 0x1 + bne _0800C956 + ldrh r0, [r7, 0x1A] + cmp r0, 0x1 + bls _0800C956 + subs r0, 0x1 + strh r0, [r7, 0x1A] +_0800C956: + ldr r1, =gUnknown_03004140 + movs r0, 0xA + b _0800CA0C + .pool +_0800C960: + cmp r6, 0 + bne _0800C9A6 + bl sub_800D294 + lsls r0, 24 + lsrs r0, 24 + mov r1, sp + strb r0, [r1] + ldr r4, =gUnknown_03004140 + strh r0, [r4, 0x14] + cmp r0, 0 + beq _0800C980 + movs r0, 0x20 + movs r1, 0x1 + bl sub_800D30C +_0800C980: + ldrb r0, [r4, 0xB] + cmp r0, 0 + beq _0800C9A6 + ldrh r0, [r4, 0x1A] + cmp r0, 0x1 + beq _0800C9A6 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0x4 + bne _0800C9A6 + bl rfu_REQ_endSearchParent + bl rfu_waitREQComplete + movs r0, 0x9 + strb r0, [r4, 0x4] + movs r0, 0x1 + strb r0, [r4, 0xB] +_0800C9A6: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800C9B0 + b _0800CC8A +_0800C9B0: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C9BC + b _0800CC8A +_0800C9BC: + movs r0, 0xB + strb r0, [r1, 0x4] + movs r0, 0 + strb r0, [r1, 0x5] + b _0800CC8A + .pool +_0800C9D0: + cmp r6, 0 + beq _0800C9D6 + b _0800CC8A +_0800C9D6: + ldr r2, =gUnknown_03004140 + ldrb r0, [r2, 0x5] + strb r0, [r2, 0x4] + ldrb r1, [r2, 0x7] + cmp r1, 0 + bne _0800C9F4 + lsls r0, 24 + cmp r0, 0 + beq _0800C9EA + b _0800CC8A +_0800C9EA: + movs r0, 0x21 + b _0800CBF6 + .pool +_0800C9F4: + cmp r1, 0x7 + bne _0800C9FA + b _0800CC8A +_0800C9FA: + movs r0, 0x5 + strb r0, [r2, 0x4] + strb r0, [r2, 0x7] + b _0800CC8A +_0800CA02: + cmp r6, 0 + beq _0800CA08 + b _0800CC8A +_0800CA08: + ldr r1, =gUnknown_03004140 + movs r0, 0xD +_0800CA0C: + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + b _0800CC8A + .pool +_0800CA18: + cmp r6, 0 + bne _0800CA3C + ldr r4, =gUnknown_03004150 + mov r0, sp + adds r1, r4, 0 + bl rfu_getConnectParentStatus + lsls r0, 16 + cmp r0, 0 + bne _0800CA3C + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CA3C + adds r1, r4, 0 + subs r1, 0x10 + movs r0, 0xE + strb r0, [r1, 0x4] +_0800CA3C: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800CA46 + b _0800CC8A +_0800CA46: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800CA52 + b _0800CC8A +_0800CA52: + movs r0, 0xE + strb r0, [r1, 0x4] + b _0800CC8A + .pool +_0800CA60: + cmp r6, 0 + beq _0800CA66 + b _0800CC8A +_0800CA66: + ldr r4, =gUnknown_03004150 + mov r0, sp + adds r1, r4, 0 + bl rfu_getConnectParentStatus + lsls r0, 16 + cmp r0, 0 + beq _0800CA78 + b _0800CC8A +_0800CA78: + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CA9C + adds r1, r4, 0 + subs r1, 0x10 + movs r0, 0x13 + strb r0, [r1, 0x4] + movs r0, 0xF + strb r0, [r1, 0x5] + movs r0, 0x22 + strh r0, [r1, 0x1E] + ldrb r0, [r1, 0x10] + strh r0, [r1, 0x14] + b _0800CABC + .pool +_0800CA9C: + adds r1, r4, 0 + subs r1, 0x10 + strb r6, [r1, 0x5] + strb r6, [r1, 0x4] + movs r0, 0x23 + strh r0, [r1, 0x1E] + mov r0, sp + ldrb r0, [r0] + strh r0, [r1, 0x14] + ldrb r0, [r1, 0x7] + cmp r0, 0 + beq _0800CABC + movs r0, 0x3 + strb r0, [r1, 0x7] + movs r0, 0x9 + strb r0, [r1, 0x4] +_0800CABC: + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x1E] + movs r1, 0x1 + bl sub_800D30C + movs r0, 0 + strh r0, [r4, 0x1E] + b _0800CC8A + .pool +_0800CAD0: + cmp r6, 0 + beq _0800CAD6 + b _0800CC8A +_0800CAD6: + ldr r2, =gUnknown_03007890 + ldr r3, [r2] + ldrb r0, [r3, 0x3] + movs r1, 0 + strh r0, [r7, 0x14] + movs r0, 0x11 + strb r0, [r7, 0x5] + strb r0, [r7, 0x4] + strb r1, [r7, 0x10] + ldrb r0, [r3, 0x3] + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0800CAF4 + b _0800CC8A +_0800CAF4: + adds r1, r7, 0 + movs r3, 0x1 +_0800CAF8: + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bls _0800CB08 + b _0800CC8A +_0800CB08: + ldr r0, [r2] + ldrb r0, [r0, 0x3] + ldrb r4, [r7, 0x10] + asrs r0, r4 + ands r0, r3 + cmp r0, 0 + beq _0800CAF8 + b _0800CC8A + .pool +_0800CB1C: + cmp r6, 0 + bne _0800CB3A + mov r0, sp + bl rfu_CHILD_getConnectRecoveryStatus + lsls r0, 16 + cmp r0, 0 + bne _0800CB3A + mov r0, sp + ldrb r0, [r0] + cmp r0, 0x1 + bhi _0800CB3A + ldr r1, =gUnknown_03004140 + movs r0, 0x12 + strb r0, [r1, 0x4] +_0800CB3A: + ldr r2, =gUnknown_03004140 + ldrb r0, [r2, 0x10] + lsls r0, 1 + adds r1, r2, 0 + adds r1, 0x34 + adds r1, r0, r1 + ldrh r0, [r1] + cmp r0, 0 + bne _0800CB4E + b _0800CC8A +_0800CB4E: + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + beq _0800CB5A + b _0800CC8A +_0800CB5A: + movs r0, 0x12 + strb r0, [r2, 0x4] + b _0800CC8A + .pool +_0800CB64: + cmp r6, 0 + beq _0800CB6A + b _0800CC8A +_0800CB6A: + mov r0, sp + bl rfu_CHILD_getConnectRecoveryStatus + lsls r0, 16 + cmp r0, 0 + beq _0800CB78 + b _0800CC8A +_0800CB78: + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CB94 + ldr r1, =gUnknown_03004140 + movs r0, 0x13 + strb r0, [r1, 0x4] + movs r0, 0x16 + strb r0, [r1, 0x5] + movs r0, 0x32 + strh r0, [r1, 0x1E] + b _0800CBA8 + .pool +_0800CB94: + ldr r4, =gUnknown_03004140 + strb r6, [r4, 0x5] + strb r6, [r4, 0x4] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x3] + bl sub_800D334 + movs r0, 0x33 + strh r0, [r4, 0x1E] +_0800CBA8: + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, r5, 0 + adds r1, 0x34 + adds r0, r1 + movs r1, 0 + movs r4, 0 + strh r4, [r0] + adds r0, r5, 0 + adds r0, 0x30 + strb r1, [r0] + strb r1, [r5, 0xA] + ldrb r0, [r5, 0x1E] + movs r1, 0x1 + bl sub_800D30C + strh r4, [r5, 0x1E] + b _0800CC8A + .pool +_0800CBD8: + cmp r6, 0 + bne _0800CC8A + ldr r5, =gUnknown_03004140 + ldrb r1, [r5, 0x5] + adds r0, r1, 0 + cmp r0, 0x16 + bne _0800CC04 + ldrb r0, [r5, 0x11] + strb r0, [r5, 0x4] + ldrb r0, [r5, 0x12] + strb r0, [r5, 0x5] + ldrb r0, [r5, 0x2] + movs r0, 0x1 + strb r0, [r5, 0x2] + movs r0, 0x41 +_0800CBF6: + movs r1, 0 + bl sub_800D30C + b _0800CC8A + .pool +_0800CC04: + cmp r0, 0xF + bne _0800CC8A + strb r1, [r5, 0x4] + ldrb r0, [r5, 0x2] + movs r4, 0x1 + strb r4, [r5, 0x2] + movs r0, 0x41 + movs r1, 0 + bl sub_800D30C + adds r1, r5, 0 + adds r1, 0x24 + ldrb r0, [r5, 0x10] + lsls r4, r0 + ldrb r0, [r1] + orrs r4, r0 + strb r4, [r1] + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, 0x4 + adds r0, r1 + ldrh r1, [r5, 0x26] + movs r7, 0 + strh r1, [r0] + ldrb r1, [r5, 0x10] + movs r0, 0x4 + bl rfu_clearSlot + mov r4, sp + ldrb r0, [r5, 0x10] + movs r1, 0xE + bl rfu_NI_CHILD_setSendGameName + strb r0, [r4] + lsls r0, 24 + cmp r0, 0 + beq _0800CC8A + strb r7, [r5, 0x5] + strb r7, [r5, 0x4] + bl sub_800D610 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x2] + ldrb r0, [r0, 0x3] + orrs r0, r1 + bl sub_800D334 + mov r0, sp + ldrb r0, [r0] + strh r0, [r5, 0x14] + movs r0, 0x25 + movs r1, 0x1 + bl sub_800D30C + b _0800CC8A + .pool +_0800CC78: + cmp r6, 0 + bne _0800CC8A + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0x5] + strb r6, [r0, 0x4] + movs r0, 0x42 + movs r1, 0 + bl sub_800D30C +_0800CC8A: + ldr r1, =gUnknown_03004140 + movs r0, 0x1 + strb r0, [r1, 0xE] + b _0800CCE6 + .pool +_0800CC98: + cmp r6, 0x3 + bne _0800CCE6 + ldrb r0, [r7, 0xF] + cmp r0, 0 + beq _0800CCE6 + mov r3, r8 + cmp r3, 0x24 + beq _0800CCB0 + cmp r3, 0x26 + beq _0800CCB0 + cmp r3, 0x27 + bne _0800CCE6 +_0800CCB0: + bl rfu_REQ_RFUStatus + bl rfu_waitREQComplete + mov r0, sp + bl rfu_getRFUStatus + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CCE6 + ldr r4, =gUnknown_03007890 + ldr r0, [r4] + ldrb r0, [r0] + cmp r0, 0 + bne _0800CCE6 + bl rfu_getSTWIRecvBuffer + ldr r1, [r4] + ldrb r1, [r1, 0x2] + strb r1, [r0, 0x4] + movs r1, 0x1 + strb r1, [r0, 0x5] + movs r0, 0x29 + bl sub_800C36C + movs r6, 0 +_0800CCE6: + mov r4, r8 + cmp r4, 0x26 + bne _0800CCEE + b _0800CE02 +_0800CCEE: + cmp r4, 0x26 + bgt _0800CD00 + cmp r4, 0x10 + bne _0800CCF8 + b _0800CE20 +_0800CCF8: + b _0800CE3E + .pool +_0800CD00: + mov r0, r8 + cmp r0, 0x30 + beq _0800CD0E + cmp r0, 0x3D + bne _0800CD0C + b _0800CE20 +_0800CD0C: + b _0800CE3E +_0800CD0E: + cmp r6, 0 + beq _0800CD14 + b _0800CE42 +_0800CD14: + bl rfu_getSTWIRecvBuffer + ldr r4, =gUnknown_03004140 + ldrb r0, [r0, 0x8] + strh r0, [r4, 0x14] + bl sub_800D358 + adds r2, r4, 0 + adds r2, 0x30 + ldrb r1, [r2] + cmp r1, 0 + beq _0800CD6A + ldrb r0, [r4, 0x14] + adds r3, r1, 0 + bics r3, r0 + adds r0, r3, 0 + strb r0, [r2] + movs r3, 0 + adds r7, r4, 0 + adds r1, r7, 0 + movs r5, 0x1 + adds r4, r1, 0 + adds r4, 0x34 + movs r2, 0 +_0800CD44: + ldrh r0, [r1, 0x14] + asrs r0, r3 + ands r0, r5 + cmp r0, 0 + beq _0800CD54 + lsls r0, r3, 1 + adds r0, r4 + strh r2, [r0] +_0800CD54: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800CD44 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x6] + cmp r0, 0 + bne _0800CD6A + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] +_0800CD6A: + mov r3, sp + ldr r1, =gUnknown_03004140 + ldrb r2, [r1] + ldrb r0, [r1, 0x14] + ands r0, r2 + strb r0, [r3] + movs r3, 0 + adds r7, r1, 0 + ldr r2, =gUnknown_03007890 + mov r1, sp + movs r5, 0x1 + adds r4, r7, 0 +_0800CD82: + ldrb r0, [r1] + asrs r0, r3 + ands r0, r5 + cmp r0, 0 + beq _0800CD96 + ldrb r0, [r4, 0x1] + cmp r0, 0 + beq _0800CD96 + subs r0, 0x1 + strb r0, [r7, 0x1] +_0800CD96: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800CD82 + ldrb r1, [r7, 0x14] + ldrb r0, [r7] + bics r0, r1 + strb r0, [r7] + ldrb r1, [r7, 0x7] + cmp r1, 0 + beq _0800CDE0 + ldr r0, [r2] + ldrb r0, [r0] + cmp r0, 0xFF + bne _0800CDF2 + cmp r1, 0x8 + bne _0800CDCC + ldrh r0, [r7, 0x1C] + strh r0, [r7, 0x1A] + movs r0, 0x6 + strb r0, [r7, 0x7] + b _0800CDDE + .pool +_0800CDCC: + ldrb r0, [r7, 0x4] + subs r0, 0x6 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _0800CDE0 + movs r0, 0x1 + strb r0, [r7, 0x7] + movs r0, 0x5 +_0800CDDE: + strb r0, [r7, 0x4] +_0800CDE0: + ldr r0, [r2] + ldrb r0, [r0] + cmp r0, 0xFF + bne _0800CDF2 + ldrb r0, [r7, 0x4] + cmp r0, 0 + bne _0800CDF2 + movs r0, 0xFF + strb r0, [r7, 0x6] +_0800CDF2: + ldrb r0, [r7, 0xE] + cmp r0, 0 + bne _0800CE3E + movs r0, 0x40 + movs r1, 0x1 + bl sub_800D30C + b _0800CE3E +_0800CE02: + bl sub_800D20C + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0xFF + beq _0800CE3E + movs r0, 0x50 + movs r1, 0 + bl sub_800D30C + b _0800CE3E + .pool +_0800CE20: + cmp r6, 0 + bne _0800CE42 + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0xD] + strb r6, [r0, 0x1] + strb r6, [r0] + movs r1, 0xFF + strb r1, [r0, 0x6] + bl sub_800D610 + mov r4, r8 + cmp r4, 0x3D + bne _0800CE3E + bl sub_800BFA0 +_0800CE3E: + cmp r6, 0 + beq _0800CE92 +_0800CE42: + ldr r7, =gUnknown_03004140 + mov r0, r8 + cmp r0, 0x1C + bne _0800CE74 + cmp r6, 0 + beq _0800CE74 + ldrb r0, [r7, 0x7] + cmp r0, 0x4 + bne _0800CE74 + ldr r2, =gUnknown_03007890 + ldr r1, [r2] + movs r0, 0x1 + strb r0, [r1] + ldr r1, [r2] + movs r0, 0xF + strb r0, [r1, 0x2] + bl sub_800D334 + bl rfu_waitREQComplete + b _0800CEA4 + .pool +_0800CE74: + movs r1, 0 + mov r3, r8 + strh r3, [r7, 0x14] + strh r6, [r7, 0x16] + ldrb r0, [r7, 0xE] + cmp r0, 0 + beq _0800CE86 + strb r1, [r7, 0x5] + strb r1, [r7, 0x4] +_0800CE86: + movs r0, 0xF0 + movs r1, 0x2 + bl sub_800D30C + bl sub_800D610 +_0800CE92: + mov r4, r8 + cmp r4, 0xFF + bne _0800CEA4 + movs r0, 0xF2 + movs r1, 0 + bl sub_800D30C + bl sub_800D610 +_0800CEA4: + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800C7B4 + + thumb_func_start sub_800CEB0 +sub_800CEB0: @ 800CEB0 + push {r4-r7,lr} + sub sp, 0x4 + lsls r0, 16 + lsrs r6, r0, 16 + ldr r4, =gUnknown_03004140 + ldrb r7, [r4, 0xE] + movs r0, 0 + strb r0, [r4, 0xE] + movs r0, 0x1 + strb r0, [r4, 0xF] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r5, [r0] + cmp r5, 0 + bne _0800CEEC + adds r0, r6, 0 + bl sub_800C36C + ldrb r0, [r4, 0x2] + cmp r0, 0x1 + beq _0800CF04 + bl sub_800D610 + strb r5, [r4, 0xF] + strb r7, [r4, 0xE] + b _0800CF28 + .pool +_0800CEEC: + mov r0, sp + bl rfu_UNI_PARENT_getDRAC_ACK + lsls r0, 16 + cmp r0, 0 + bne _0800CF04 + mov r1, sp + ldrb r0, [r4, 0x3] + ldrb r1, [r1] + orrs r0, r1 + ldrb r1, [r4, 0x3] + strb r0, [r4, 0x3] +_0800CF04: + ldr r4, =gUnknown_03004140 + ldr r1, [r4, 0x44] + cmp r1, 0 + beq _0800CF20 + adds r0, r6, 0 + bl _call_via_r1 + bl rfu_waitREQComplete + ldrb r0, [r4, 0x2] + cmp r0, 0x2 + bne _0800CF20 + bl sub_800D610 +_0800CF20: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0xF] + strb r7, [r1, 0xE] +_0800CF28: + add sp, 0x4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800CEB0 + + thumb_func_start sub_800CF34 +sub_800CF34: @ 800CF34 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + subs r0, 0x5 + lsls r0, 24 + lsrs r0, 24 + adds r3, r1, 0 + cmp r0, 0x3 + bls _0800CF52 + b _0800D146 +_0800CF52: + ldr r0, =gUnknown_03007890 + ldr r2, [r0] + ldrb r1, [r2, 0x2] + ldrb r0, [r3, 0xC] + adds r4, r1, 0 + eors r4, r0 + ands r4, r1 + ldrb r0, [r2, 0x7] + bics r4, r0 + mov r8, r4 + strb r1, [r3, 0xC] + cmp r4, 0 + beq _0800CF7A + strh r4, [r3, 0x14] + movs r0, 0x10 + movs r1, 0x1 + str r3, [sp, 0x4] + bl sub_800D30C + ldr r3, [sp, 0x4] +_0800CF7A: + movs r0, 0 + str r0, [sp] + movs r6, 0 + adds r7, r3, 0 + movs r1, 0x24 + adds r1, r3 + mov r9, r1 +_0800CF88: + movs r0, 0x80 + lsls r0, 17 + lsls r0, r6 + lsrs r4, r0, 24 + movs r5, 0 + mov r0, r8 + ands r0, r4 + cmp r0, 0 + beq _0800CFDA + lsls r1, r6, 1 + adds r0, r7, 0 + adds r0, 0x28 + adds r1, r0 + ldrh r0, [r7, 0x26] + strh r0, [r1] + mov r2, r9 + ldrb r1, [r2] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r2] + adds r6, 0x1 + mov r10, r6 + b _0800D090 + .pool +_0800CFC0: + ldrb r1, [r7] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r7] + ldrb r0, [r7, 0x1] + adds r0, 0x1 + strb r0, [r7, 0x1] + ldr r0, [sp] + orrs r0, r4 + str r0, [sp] + movs r0, 0x1 + orrs r5, r0 + b _0800D024 +_0800CFDA: + mov r1, r9 + ldrb r0, [r1] + ands r0, r4 + adds r2, r6, 0x1 + mov r10, r2 + cmp r0, 0 + beq _0800D090 + ldr r0, =gUnknown_03007880 + lsls r1, r6, 2 + adds r1, r0 + ldr r1, [r1] + ldrh r0, [r1, 0x34] + cmp r0, 0x46 + bne _0800D040 + adds r0, r1, 0 + adds r0, 0x61 + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800D058 + movs r5, 0x2 + ldr r3, [r3, 0x20] + ldrh r2, [r3] + ldr r0, =0x0000ffff + cmp r2, r0 + beq _0800D024 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + lsls r1, r6, 5 + adds r0, r1 + ldrh r0, [r0, 0x18] + ldr r1, =0x0000ffff +_0800D018: + cmp r0, r2 + beq _0800CFC0 + adds r3, 0x2 + ldrh r2, [r3] + cmp r2, r1 + bne _0800D018 +_0800D024: + movs r0, 0x1 + ands r0, r5 + cmp r0, 0 + bne _0800D058 + movs r0, 0x4 + orrs r5, r0 + b _0800D058 + .pool +_0800D040: + lsls r1, r6, 1 + adds r0, r3, 0 + adds r0, 0x28 + adds r1, r0 + ldrh r0, [r1] + subs r0, 0x1 + strh r0, [r1] + ldr r1, =0x0000ffff + ands r0, r1 + cmp r0, 0 + bne _0800D058 + movs r5, 0x6 +_0800D058: + movs r0, 0x2 + ands r0, r5 + cmp r0, 0 + beq _0800D07E + mov r2, r9 + ldrb r0, [r2] + bics r0, r4 + movs r2, 0 + mov r1, r9 + strb r0, [r1] + lsls r0, r6, 1 + adds r1, r7, 0 + adds r1, 0x28 + adds r0, r1 + strh r2, [r0] + movs r0, 0x8 + adds r1, r6, 0 + bl rfu_clearSlot +_0800D07E: + movs r0, 0x4 + ands r5, r0 + ldr r3, =gUnknown_03004140 + cmp r5, 0 + beq _0800D090 + ldrb r1, [r7, 0xD] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r7, 0xD] +_0800D090: + mov r2, r10 + lsls r0, r2, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bhi _0800D09C + b _0800CF88 +_0800D09C: + ldr r4, [sp] + cmp r4, 0 + beq _0800D0AE + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x11 + movs r1, 0x1 + bl sub_800D30C +_0800D0AE: + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0xD] + cmp r0, 0 + beq _0800D0EA + movs r5, 0x1 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x6] + cmp r0, 0 + beq _0800D0CE + ldrb r0, [r1, 0x3] + ldrb r1, [r1] + ands r0, r1 + cmp r0, r1 + beq _0800D0CE + movs r5, 0 +_0800D0CE: + cmp r5, 0 + beq _0800D0EA + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0xD] + bl sub_800D334 + ldrb r0, [r4, 0xD] + movs r1, 0 + strh r0, [r4, 0x14] + strb r1, [r4, 0xD] + movs r0, 0x12 + movs r1, 0x1 + bl sub_800D30C +_0800D0EA: + ldr r0, =gUnknown_03004140 + adds r1, r0, 0 + adds r1, 0x24 + ldrb r1, [r1] + adds r3, r0, 0 + cmp r1, 0 + bne _0800D146 + ldrb r0, [r3, 0x4] + cmp r0, 0x8 + bne _0800D146 + ldrb r0, [r3, 0x7] + cmp r0, 0 + bne _0800D120 + strb r0, [r3, 0x5] + strb r0, [r3, 0x4] + movs r0, 0x14 + movs r1, 0 + bl sub_800D30C + b _0800D146 + .pool +_0800D120: + cmp r0, 0x2 + bne _0800D12C + movs r0, 0x3 + strb r0, [r3, 0x7] + movs r0, 0x9 + b _0800D132 +_0800D12C: + movs r0, 0x1 + strb r0, [r3, 0x7] + movs r0, 0x5 +_0800D132: + strb r0, [r3, 0x4] + ldrb r0, [r3] + cmp r0, 0 + beq _0800D146 + movs r0, 0 + strh r0, [r3, 0x1A] + movs r0, 0x8 + strb r0, [r3, 0x7] + movs r0, 0x5 + strb r0, [r3, 0x4] +_0800D146: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800CF34 + + thumb_func_start sub_800D158 +sub_800D158: @ 800D158 + push {r4-r6,lr} + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r6, r0, 0 + movs r0, 0 + strh r0, [r1] + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x4] + cmp r0, 0xF + bne _0800D1BC + ldrb r1, [r4, 0x10] + lsls r1, 1 + adds r5, r4, 0 + adds r5, 0x28 + adds r1, r5 + ldrh r0, [r1] + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + beq _0800D192 + ldr r1, =gUnknown_03007880 + ldrb r0, [r4, 0x10] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0x27 + bne _0800D1BC +_0800D192: + bl sub_800D630 + movs r0, 0x18 + strb r0, [r4, 0x4] + ldrb r1, [r4, 0x10] + movs r0, 0x4 + bl rfu_clearSlot + adds r2, r4, 0 + adds r2, 0x24 + movs r1, 0x1 + ldrb r0, [r4, 0x10] + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r4, 0x10] + lsls r0, 1 + adds r0, r5 + movs r1, 0 + strh r1, [r0] +_0800D1BC: + ldr r0, =0x04000208 + strh r6, [r0] + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x4] + cmp r0, 0x18 + bne _0800D1F6 + ldrb r0, [r5, 0x2] + cmp r0, 0x1 + bne _0800D1D2 + bl sub_800D630 +_0800D1D2: + ldrb r0, [r5, 0x2] + adds r4, r0, 0 + cmp r4, 0 + bne _0800D1F6 + strb r4, [r5, 0x5] + strb r4, [r5, 0x4] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x2] + ldrb r0, [r0, 0x3] + orrs r0, r1 + bl sub_800D334 + strh r4, [r5, 0x14] + movs r0, 0x25 + movs r1, 0x1 + bl sub_800D30C +_0800D1F6: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D158 + + thumb_func_start sub_800D20C +sub_800D20C: @ 800D20C + push {r4,r5,lr} + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x4] + cmp r0, 0xF + bne _0800D258 + ldr r1, =gUnknown_03007880 + ldrb r2, [r5, 0x10] + lsls r0, r2, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0x26 + bne _0800D258 + movs r4, 0 + strb r4, [r5, 0x5] + strb r4, [r5, 0x4] + movs r0, 0x4 + adds r1, r2, 0 + bl rfu_clearSlot + adds r2, r5, 0 + adds r2, 0x24 + movs r1, 0x1 + ldrb r0, [r5, 0x10] + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, r5, 0 + adds r1, 0x28 + adds r0, r1 + strh r4, [r0] + movs r0, 0x24 + movs r1, 0 + bl sub_800D30C +_0800D258: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D20C + + thumb_func_start sub_800D268 +sub_800D268: @ 800D268 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x6] + cmp r0, 0 + bne _0800D28C + ldrb r0, [r1, 0xA] + cmp r0, 0x1 + bne _0800D28C + ldrb r0, [r1, 0x4] + strb r0, [r1, 0x11] + ldrb r0, [r1, 0x5] + strb r0, [r1, 0x12] + movs r0, 0x10 + strb r0, [r1, 0x4] + movs r0, 0x11 + strb r0, [r1, 0x5] + movs r0, 0x2 + strb r0, [r1, 0xA] +_0800D28C: + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D268 + + thumb_func_start sub_800D294 +sub_800D294: @ 800D294 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + movs r6, 0 + movs r5, 0 + ldr r1, =gUnknown_03007890 + ldr r0, [r1] + ldrb r0, [r0, 0x8] + cmp r6, r0 + bcs _0800D2F0 + mov r8, r0 + ldr r0, =gUnknown_03004140 + mov r10, r0 + mov r9, r1 +_0800D2B4: + mov r1, r10 + ldr r3, [r1, 0x20] + ldrh r2, [r3] + adds r0, r5, 0x1 + mov r12, r0 + ldr r1, =0x0000ffff + cmp r2, r1 + beq _0800D2E6 + mov r1, r9 + ldr r0, [r1] + lsls r1, r5, 5 + adds r0, r1 + ldrh r4, [r0, 0x18] + ldr r7, =0x0000ffff + movs r1, 0x1 + lsls r1, r5 +_0800D2D4: + cmp r4, r2 + bne _0800D2DE + orrs r6, r1 + lsls r0, r6, 24 + lsrs r6, r0, 24 +_0800D2DE: + adds r3, 0x2 + ldrh r2, [r3] + cmp r2, r7 + bne _0800D2D4 +_0800D2E6: + mov r1, r12 + lsls r0, r1, 24 + lsrs r5, r0, 24 + cmp r5, r8 + bcc _0800D2B4 +_0800D2F0: + adds r0, r6, 0 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D294 + + thumb_func_start sub_800D30C +sub_800D30C: @ 800D30C + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r4, =gUnknown_03004140 + ldr r2, [r4, 0x40] + cmp r2, 0 + beq _0800D322 + bl _call_via_r2 +_0800D322: + movs r0, 0 + strh r0, [r4, 0x16] + strh r0, [r4, 0x14] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D30C + + thumb_func_start sub_800D334 +sub_800D334: @ 800D334 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r4, =gUnknown_03004140 + ldrb r5, [r4, 0xE] + movs r1, 0x1 + strb r1, [r4, 0xE] + bl rfu_REQ_disconnect + bl rfu_waitREQComplete + strb r5, [r4, 0xE] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D334 + + thumb_func_start sub_800D358 +sub_800D358: @ 800D358 + push {r4-r7,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x4] + cmp r0, 0 + beq _0800D3A0 + movs r4, 0 +_0800D36A: + ldr r1, =gUnknown_03007880 + lsls r0, r4, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2] + movs r3, 0x80 + lsls r3, 8 + adds r1, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D396 + ldrb r1, [r2, 0x1A] + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D396 + adds r2, r1, 0 + bics r2, r5 + movs r0, 0x20 + adds r1, r4, 0 + bl rfu_changeSendTarget +_0800D396: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D36A +_0800D3A0: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x5] + cmp r0, 0 + beq _0800D3DE + movs r4, 0 +_0800D3AC: + ldr r1, =gUnknown_03007880 + lsls r0, r4, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2, 0x34] + movs r3, 0x80 + lsls r3, 8 + adds r1, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D3D4 + adds r0, r2, 0 + adds r0, 0x4E + ldrb r0, [r0] + ands r0, r5 + cmp r0, 0 + beq _0800D3D4 + adds r0, r4, 0 + bl rfu_NI_stopReceivingData +_0800D3D4: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D3AC +_0800D3DE: + ldr r0, =gUnknown_03007890 + ldr r3, [r0] + ldrb r2, [r3, 0x6] + cmp r2, 0 + beq _0800D41C + mvns r1, r5 + adds r0, r1, 0 + ands r0, r2 + strb r0, [r3, 0x6] + movs r4, 0 + ldr r7, =gUnknown_03007870 + ldr r6, =0x00008024 +_0800D3F6: + lsls r0, r4, 2 + adds r0, r7 + ldr r2, [r0] + ldrh r0, [r2] + cmp r0, r6 + bne _0800D412 + ldrb r3, [r2, 0x3] + adds r0, r5, 0 + ands r0, r3 + cmp r0, 0 + beq _0800D412 + adds r0, r1, 0 + ands r0, r3 + strb r0, [r2, 0x3] +_0800D412: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D3F6 +_0800D41C: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D358 + + thumb_func_start sub_800D434 +sub_800D434: @ 800D434 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x18] + cmp r0, 0 + beq _0800D510 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x4] + cmp r0, 0 + beq _0800D4D4 + movs r6, 0 +_0800D454: + ldr r3, =gUnknown_03007880 + lsls r2, r6, 2 + adds r0, r2, r3 + ldr r0, [r0] + ldrh r1, [r0] + movs r4, 0x80 + lsls r4, 8 + adds r0, r4, 0 + ands r1, r0 + adds r7, r2, 0 + adds r0, r6, 0x1 + mov r9, r0 + cmp r1, 0 + beq _0800D4CA + movs r5, 0 + movs r4, 0 + movs r1, 0x1 + mov r8, r1 + mov r10, r3 +_0800D47A: + adds r0, r7, r3 + ldr r0, [r0] + ldrb r0, [r0, 0x1A] + asrs r0, r4 + mov r1, r8 + ands r0, r1 + cmp r0, 0 + beq _0800D4A4 + lsls r0, r4, 2 + adds r0, r3 + ldr r0, [r0] + ldr r1, =gUnknown_03004140 + ldrh r0, [r0, 0x2] + ldrh r1, [r1, 0x18] + cmp r0, r1 + bls _0800D4A4 + mov r0, r8 + lsls r0, r4 + orrs r5, r0 + lsls r0, r5, 24 + lsrs r5, r0, 24 +_0800D4A4: + cmp r5, 0 + beq _0800D4C0 + mov r1, r10 + adds r0, r7, r1 + ldr r0, [r0] + ldrb r0, [r0, 0x1A] + adds r2, r5, 0 + eors r2, r0 + movs r0, 0x20 + adds r1, r6, 0 + str r3, [sp] + bl rfu_changeSendTarget + ldr r3, [sp] +_0800D4C0: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D47A +_0800D4CA: + mov r3, r9 + lsls r0, r3, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bls _0800D454 +_0800D4D4: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x5] + cmp r0, 0 + beq _0800D510 + movs r6, 0 +_0800D4E0: + ldr r1, =gUnknown_03007880 + lsls r0, r6, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2, 0x34] + movs r4, 0x80 + lsls r4, 8 + adds r1, r4, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D506 + ldr r1, =gUnknown_03004140 + ldrh r0, [r2, 0x36] + ldrh r1, [r1, 0x18] + cmp r0, r1 + bls _0800D506 + adds r0, r6, 0 + bl rfu_NI_stopReceivingData +_0800D506: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bls _0800D4E0 +_0800D510: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D434 + + thumb_func_start sub_800D52C +sub_800D52C: @ 800D52C + push {lr} + ldr r1, =gUnknown_03004140 + str r0, [r1, 0x44] + ldr r0, =sub_800CEB0 + bl rfu_setMSCCallback + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D52C + + thumb_func_start sub_800D544 +sub_800D544: @ 800D544 + ldr r1, =gUnknown_03004140 + str r0, [r1, 0x40] + bx lr + .pool + thumb_func_end sub_800D544 + + thumb_func_start sub_800D550 +sub_800D550: @ 800D550 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 16 + lsrs r5, r1, 16 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x9] + adds r3, r0, 0 + cmp r1, 0 + beq _0800D578 + cmp r4, 0 + bne _0800D578 + adds r0, 0x30 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D578 + movs r0, 0x5 + b _0800D588 + .pool +_0800D578: + ldr r2, =0x04000208 + ldrh r1, [r2] + movs r0, 0 + strh r0, [r2] + strb r4, [r3, 0x9] + strh r5, [r3, 0x32] + strh r1, [r2] + movs r0, 0 +_0800D588: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D550 + + thumb_func_start sub_800D594 +sub_800D594: @ 800D594 + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x4] + ldrb r0, [r0, 0x5] + orrs r0, r1 + cmp r0, 0 + bne _0800D5B8 + ldr r0, =gUnknown_03004140 + strh r2, [r0, 0x18] + movs r0, 0 + b _0800D5C8 + .pool +_0800D5B8: + ldr r1, =gUnknown_03004140 + movs r0, 0x6 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x6 +_0800D5C8: + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D594 + + thumb_func_start sub_800D5D0 +sub_800D5D0: @ 800D5D0 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + adds r3, r2, 0 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + subs r0, 0x9 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bhi _0800D5FC + movs r0, 0x7 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x7 + b _0800D60A + .pool +_0800D5FC: + cmp r2, 0 + beq _0800D606 + movs r0, 0x1 + strb r0, [r1, 0xB] + b _0800D608 +_0800D606: + strb r3, [r1, 0xB] +_0800D608: + movs r0, 0 +_0800D60A: + pop {r1} + bx r1 + thumb_func_end sub_800D5D0 + + thumb_func_start sub_800D610 +sub_800D610: @ 800D610 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x2] + cmp r0, 0 + beq _0800D628 + ldrb r0, [r1, 0x2] + movs r0, 0 + strb r0, [r1, 0x2] + movs r0, 0x45 + movs r1, 0 + bl sub_800D30C +_0800D628: + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D610 + + thumb_func_start sub_800D630 +sub_800D630: @ 800D630 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x2] + cmp r0, 0 + bne _0800D648 + movs r0, 0x45 + movs r1, 0 + bl sub_800D30C + b _0800D654 + .pool +_0800D648: + ldrb r0, [r1, 0x2] + cmp r0, 0x1 + bne _0800D654 + ldrb r0, [r1, 0x2] + movs r0, 0x2 + strb r0, [r1, 0x2] +_0800D654: + pop {r0} + bx r0 + thumb_func_end sub_800D630 + + thumb_func_start sub_800D658 +sub_800D658: @ 800D658 + push {lr} + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x7] + adds r2, r0, 0 + cmp r1, 0 + beq _0800D6C2 + ldrb r0, [r2, 0x4] + subs r0, 0x5 + cmp r0, 0x6 + bhi _0800D6C2 + lsls r0, 2 + ldr r1, =_0800D680 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800D680: + .4byte _0800D69C + .4byte _0800D6A4 + .4byte _0800D6AE + .4byte _0800D6AE + .4byte _0800D6B4 + .4byte _0800D6B4 + .4byte _0800D6BA +_0800D69C: + movs r0, 0x3 + strb r0, [r2, 0x7] + movs r0, 0x9 + b _0800D6C0 +_0800D6A4: + movs r0, 0x2 + strb r0, [r2, 0x7] + movs r0, 0x1 + strh r0, [r2, 0x1A] + b _0800D6C2 +_0800D6AE: + movs r0, 0x2 + strb r0, [r2, 0x7] + b _0800D6C2 +_0800D6B4: + movs r0, 0x28 + strh r0, [r2, 0x1A] + b _0800D6C2 +_0800D6BA: + movs r0, 0x28 + strh r0, [r2, 0x1A] + movs r0, 0xA +_0800D6C0: + strb r0, [r2, 0x4] +_0800D6C2: + pop {r0} + bx r0 + thumb_func_end sub_800D658 + + thumb_func_start sub_800D6C8 +sub_800D6C8: @ 800D6C8 + push {r4,r5,lr} + adds r3, r0, 0 + movs r0, 0 + movs r4, 0 + movs r5, 0x46 +_0800D6D2: + adds r2, r0, 0x1 + movs r1, 0x45 + muls r0, r5 + adds r0, r3 + adds r0, 0x45 +_0800D6DC: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D6DC + adds r0, r2, 0 + cmp r0, 0x1F + ble _0800D6D2 + movs r1, 0 + ldr r2, =0x000008c1 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x8C + lsls r2, 4 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x000008c2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x000008c3 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D6C8 + + thumb_func_start sub_800D724 +sub_800D724: @ 800D724 + push {r4,lr} + adds r3, r0, 0 + movs r1, 0 + movs r4, 0 +_0800D72C: + lsls r0, r1, 3 + adds r2, r1, 0x1 + subs r0, r1 + movs r1, 0xD + lsls r0, 1 + adds r0, r3 + adds r0, 0xD +_0800D73A: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D73A + adds r1, r2, 0 + cmp r1, 0x27 + ble _0800D72C + movs r1, 0 + ldr r2, =0x00000231 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x8C + lsls r2, 2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000232 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000233 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D724 + + thumb_func_start sub_800D780 +sub_800D780: @ 800D780 + push {r4,lr} + adds r3, r0, 0 + movs r1, 0 + movs r4, 0 +_0800D788: + lsls r0, r1, 8 + adds r2, r1, 0x1 + movs r1, 0xFF + adds r0, r3 + adds r0, 0xFF +_0800D792: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D792 + adds r1, r2, 0 + cmp r1, 0x1 + ble _0800D788 + movs r1, 0 + ldr r2, =0x00000201 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x80 + lsls r2, 2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000202 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000203 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D780 + + thumb_func_start sub_800D7D8 +sub_800D7D8: @ 800D7D8 + push {r4-r7,lr} + adds r3, r0, 0 + adds r4, r1, 0 + ldr r1, =0x000008c2 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0x1F + bhi _0800D874 + ldr r0, =0x04000208 + ldrh r1, [r0] + adds r7, r1, 0 + movs r1, 0 + strh r1, [r0] + movs r5, 0 + movs r2, 0 +_0800D7F6: + adds r1, r4, r2 + ldrb r0, [r1] + cmp r0, 0 + bne _0800D80A + ldrb r0, [r1, 0x1] + cmp r0, 0 + bne _0800D80A + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_0800D80A: + adds r2, 0xE + cmp r2, 0x45 + ble _0800D7F6 + cmp r5, 0x5 + beq _0800D866 + movs r2, 0 + movs r0, 0x8C + lsls r0, 4 + adds r5, r3, r0 + movs r6, 0x46 +_0800D81E: + ldrb r0, [r5] + adds r1, r0, 0 + muls r1, r6 + adds r1, r2, r1 + adds r1, r3, r1 + adds r0, r4, r2 + ldrb r0, [r0] + strb r0, [r1] + adds r2, 0x1 + cmp r2, 0x45 + ble _0800D81E + movs r0, 0x8C + lsls r0, 4 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1F + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x000008c2 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r1, 0 + adds r0, r4, 0 + adds r0, 0x45 +_0800D85E: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r4 + bge _0800D85E +_0800D866: + ldr r0, =0x04000208 + strh r7, [r0] + b _0800D87E + .pool +_0800D874: + ldr r1, =0x000008c3 + adds r0, r3, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800D87E: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D7D8 + + thumb_func_start sub_800D888 +sub_800D888: @ 800D888 + push {r4-r7,lr} + adds r6, r0, 0 + adds r5, r1, 0 + ldr r1, =0x00000232 + adds r0, r6, r1 + ldrb r0, [r0] + cmp r0, 0x27 + bhi _0800D920 + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r7, r0, 0 + movs r0, 0 + strh r0, [r1] + movs r2, 0 + ldrb r0, [r5] + cmp r0, 0 + bne _0800D8B8 +_0800D8AA: + adds r2, 0x1 + cmp r2, 0xD + bgt _0800D8B8 + adds r0, r5, r2 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D8AA +_0800D8B8: + cmp r2, 0xE + beq _0800D910 + movs r2, 0 + movs r0, 0x8C + lsls r0, 2 + adds r3, r6, r0 +_0800D8C4: + ldrb r1, [r3] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r2, r0 + adds r0, r6, r0 + adds r1, r5, r2 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xD + ble _0800D8C4 + movs r1, 0x8C + lsls r1, 2 + adds r4, r6, r1 + ldrb r0, [r4] + adds r0, 0x1 + ldrb r1, [r4] + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0x28 + bl __umodsi3 + ldrb r1, [r4] + strb r0, [r4] + ldr r0, =0x00000232 + adds r1, r6, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r1, 0 + adds r0, r5, 0 + adds r0, 0xD +_0800D908: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r5 + bge _0800D908 +_0800D910: + ldr r0, =0x04000208 + strh r7, [r0] + b _0800D92A + .pool +_0800D920: + ldr r1, =0x00000233 + adds r0, r6, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800D92A: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D888 + + thumb_func_start sub_800D934 +sub_800D934: @ 800D934 + push {r4-r7,lr} + adds r3, r0, 0 + adds r4, r1, 0 + ldr r1, =0x04000208 + ldrh r0, [r1] + mov r12, r0 + movs r0, 0 + strh r0, [r1] + movs r1, 0x8C + lsls r1, 4 + adds r0, r3, r1 + ldr r7, =0x000008c1 + adds r5, r3, r7 + ldrb r1, [r0] + ldrb r0, [r5] + cmp r1, r0 + beq _0800D960 + ldr r1, =0x000008c3 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D984 +_0800D960: + movs r1, 0 + adds r0, r4, 0 + adds r0, 0x45 +_0800D966: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r4 + bge _0800D966 + ldr r0, =0x04000208 + mov r7, r12 + strh r7, [r0] + movs r0, 0 + b _0800D9CA + .pool +_0800D984: + movs r2, 0 + movs r6, 0x46 +_0800D988: + adds r1, r4, r2 + ldrb r0, [r5] + adds r7, r0, 0 + muls r7, r6 + adds r0, r7, 0 + adds r0, r2, r0 + adds r0, r3, r0 + ldrb r0, [r0] + strb r0, [r1] + adds r2, 0x1 + cmp r2, 0x45 + ble _0800D988 + ldr r0, =0x000008c1 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1F + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r7, =0x000008c2 + adds r1, r3, r7 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x04000208 + mov r1, r12 + strh r1, [r0] + movs r0, 0x1 +_0800D9CA: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D934 + + thumb_func_start sub_800D9DC +sub_800D9DC: @ 800D9DC + push {r4-r7,lr} + adds r5, r0, 0 + adds r6, r1, 0 + movs r1, 0x8C + lsls r1, 2 + adds r0, r5, r1 + adds r1, 0x1 + adds r4, r5, r1 + ldrb r1, [r0] + ldrb r0, [r4] + cmp r1, r0 + beq _0800DA00 + ldr r1, =0x00000233 + adds r0, r5, r1 + ldrb r0, [r0] + adds r2, r0, 0 + cmp r2, 0 + beq _0800DA08 +_0800DA00: + movs r0, 0 + b _0800DA54 + .pool +_0800DA08: + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r7, r0, 0 + strh r2, [r1] + movs r3, 0 +_0800DA12: + adds r2, r6, r3 + ldrb r1, [r4] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r3, r0 + adds r0, r5, r0 + ldrb r0, [r0] + strb r0, [r2] + adds r3, 0x1 + cmp r3, 0xD + ble _0800DA12 + ldr r0, =0x00000231 + adds r4, r5, r0 + ldrb r0, [r4] + adds r0, 0x1 + ldrb r1, [r4] + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0x28 + bl __umodsi3 + ldrb r1, [r4] + strb r0, [r4] + ldr r0, =0x00000232 + adds r1, r5, r0 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x04000208 + strh r7, [r0] + movs r0, 0x1 +_0800DA54: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D9DC + + thumb_func_start sub_800DA68 +sub_800DA68: @ 800DA68 + push {r4,lr} + adds r2, r0, 0 + adds r4, r1, 0 + ldrb r0, [r4, 0x1] + cmp r0, 0 + bne _0800DA7E + adds r0, r2, 0 + movs r1, 0 + bl sub_800DAC8 + b _0800DAC0 +_0800DA7E: + movs r3, 0 +_0800DA80: + ldrb r1, [r2, 0x1C] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r3, r0 + adds r0, r2, r0 + adds r1, r4, r3 + ldrb r1, [r1] + strb r1, [r0] + adds r3, 0x1 + cmp r3, 0xD + ble _0800DA80 + ldrb r0, [r2, 0x1C] + adds r0, 0x1 + ldrb r1, [r2, 0x1C] + strb r0, [r2, 0x1C] + ldrb r1, [r2, 0x1C] + movs r0, 0x1 + ands r0, r1 + ldrb r1, [r2, 0x1C] + strb r0, [r2, 0x1C] + ldrb r0, [r2, 0x1E] + cmp r0, 0x1 + bhi _0800DABA + ldrb r0, [r2, 0x1E] + adds r0, 0x1 + ldrb r1, [r2, 0x1E] + strb r0, [r2, 0x1E] + b _0800DAC0 +_0800DABA: + ldrb r0, [r2, 0x1C] + ldrb r1, [r2, 0x1D] + strb r0, [r2, 0x1D] +_0800DAC0: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_800DA68 + + thumb_func_start sub_800DAC8 +sub_800DAC8: @ 800DAC8 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + ldrb r0, [r3, 0x1E] + cmp r0, 0 + bne _0800DAD8 + movs r0, 0 + b _0800DB12 +_0800DAD8: + cmp r5, 0 + beq _0800DAF6 + movs r4, 0 +_0800DADE: + adds r2, r5, r4 + ldrb r1, [r3, 0x1D] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r4, r0 + adds r0, r3, r0 + ldrb r0, [r0] + strb r0, [r2] + adds r4, 0x1 + cmp r4, 0xD + ble _0800DADE +_0800DAF6: + ldrb r0, [r3, 0x1D] + adds r0, 0x1 + ldrb r1, [r3, 0x1D] + strb r0, [r3, 0x1D] + ldrb r1, [r3, 0x1D] + movs r0, 0x1 + ands r0, r1 + ldrb r1, [r3, 0x1D] + strb r0, [r3, 0x1D] + ldrb r0, [r3, 0x1E] + subs r0, 0x1 + ldrb r1, [r3, 0x1E] + strb r0, [r3, 0x1E] + movs r0, 0x1 +_0800DB12: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_800DAC8 + + thumb_func_start sub_800DB18 +sub_800DB18: @ 800DB18 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + ldr r1, =0x00000202 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0x1 + bhi _0800DB70 + movs r2, 0 + movs r0, 0x80 + lsls r0, 2 + adds r4, r3, r0 +_0800DB30: + ldrb r0, [r4] + lsls r0, 8 + adds r0, r2, r0 + adds r0, r3, r0 + adds r1, r5, r2 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xFF + ble _0800DB30 + movs r0, 0x80 + lsls r0, 2 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1 + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x00000202 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + b _0800DB7A + .pool +_0800DB70: + ldr r1, =0x00000203 + adds r0, r3, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800DB7A: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DB18 + + thumb_func_start sub_800DB84 +sub_800DB84: @ 800DB84 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + movs r1, 0x80 + lsls r1, 2 + adds r0, r3, r1 + adds r1, 0x1 + adds r4, r3, r1 + ldrb r1, [r0] + ldrb r0, [r4] + cmp r1, r0 + beq _0800DBA6 + ldr r1, =0x00000203 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0800DBB0 +_0800DBA6: + movs r0, 0 + b _0800DBEA + .pool +_0800DBB0: + movs r2, 0 +_0800DBB2: + adds r0, r5, r2 + ldrb r1, [r4] + lsls r1, 8 + adds r1, r2, r1 + adds r1, r3, r1 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xFF + ble _0800DBB2 + ldr r0, =0x00000201 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1 + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x00000202 + adds r1, r3, r0 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r0, 0x1 +_0800DBEA: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800DB84 + + thumb_func_start sub_800DBF8 +sub_800DBF8: @ 800DBF8 + push {r4-r7,lr} + adds r6, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r1, 0 + movs r5, 0 + cmp r1, 0x1 + beq _0800DC36 + cmp r1, 0x1 + bgt _0800DC12 + cmp r1, 0 + beq _0800DC1C + b _0800DCAA +_0800DC12: + cmp r0, 0x2 + beq _0800DC56 + cmp r0, 0x3 + beq _0800DC76 + b _0800DCAA +_0800DC1C: + movs r4, 0 +_0800DC1E: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r1, [r0] + lsls r0, r5, 16 + asrs r0, 16 + adds r0, r1 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, r1, 0 + cmp r4, 0xC7 + ble _0800DC1E + b _0800DC70 +_0800DC36: + movs r4, 0 + adds r2, r6, 0 + adds r2, 0xC8 +_0800DC3C: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r1, [r0] + lsls r0, r5, 16 + asrs r0, 16 + adds r0, r1 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, r1, 0 + cmp r4, 0x63 + ble _0800DC3C + strh r5, [r2] + b _0800DCAA +_0800DC56: + movs r4, 0 +_0800DC58: + bl Random + lsls r0, 24 + lsrs r0, 24 + adds r1, r6, r4 + strb r0, [r1] + adds r0, r5, r0 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, 0x1 + cmp r4, 0xC7 + ble _0800DC58 +_0800DC70: + adds r0, r6, r4 + strh r5, [r0] + b _0800DCAA +_0800DC76: + movs r4, 0 + ldr r3, =gUnknown_03000D74 + ldrb r1, [r3] + ldrb r0, [r3] + adds r7, r0, 0x1 + adds r2, r1, 0x1 + movs r0, 0xFF + mov r12, r0 +_0800DC86: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r2, [r0] + adds r0, r4, r7 + mov r4, r12 + ands r0, r4 + adds r0, r5, r0 + lsls r0, 16 + lsrs r5, r0, 16 + adds r2, 0x1 + adds r4, r1, 0 + cmp r1, 0xC7 + ble _0800DC86 + adds r0, r6, r1 + strh r5, [r0] + ldrb r0, [r3] + adds r0, 0x1 + strb r0, [r3] +_0800DCAA: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DBF8 + + thumb_func_start sub_800DCB4 +sub_800DCB4: @ 800DCB4 + push {r4,r5,lr} + adds r4, r0, 0 + movs r3, 0 + ldrb r0, [r1] + cmp r0, 0xFF + beq _0800DCD8 + ldr r5, =gUnknown_082ED470 + adds r2, r1, 0 +_0800DCC4: + adds r1, r4, r3 + ldrb r0, [r2] + adds r0, r5 + ldrb r0, [r0] + strb r0, [r1] + adds r2, 0x1 + adds r3, 0x1 + ldrb r0, [r2] + cmp r0, 0xFF + bne _0800DCC4 +_0800DCD8: + adds r1, r4, r3 + movs r0, 0 + strb r0, [r1] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DCB4 + + thumb_func_start sub_800DCE8 +sub_800DCE8: @ 800DCE8 + push {r4,r5,lr} + adds r4, r0, 0 + movs r3, 0 + ldrb r0, [r1] + cmp r0, 0 + beq _0800DD0C + ldr r5, =gUnknown_082ED370 + adds r2, r1, 0 +_0800DCF8: + adds r1, r4, r3 + ldrb r0, [r2] + adds r0, r5 + ldrb r0, [r0] + strb r0, [r1] + adds r2, 0x1 + adds r3, 0x1 + ldrb r0, [r2] + cmp r0, 0 + bne _0800DCF8 +_0800DD0C: + adds r1, r4, r3 + movs r0, 0xFF + strb r0, [r1] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DCE8 + + thumb_func_start sub_800DD1C +sub_800DD1C: @ 800DD1C + push {r4-r7,lr} + lsls r0, 24 + lsrs r5, r0, 24 + movs r6, 0 + ldr r0, =gUnknown_03007890 + ldr r4, [r0] + ldrb r2, [r4, 0x2] + ldrb r1, [r4] + adds r7, r0, 0 + cmp r1, 0x1 + bne _0800DD72 + movs r3, 0 + ands r1, r2 + cmp r1, 0 + beq _0800DD4E + cmp r5, 0x1 + bne _0800DD48 + ldrb r0, [r4, 0xA] + b _0800DD8C + .pool +_0800DD48: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 +_0800DD4E: + lsrs r2, 1 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bhi _0800DD8A + movs r0, 0x1 + ands r0, r2 + cmp r0, 0 + beq _0800DD4E + adds r0, r6, 0x1 + cmp r5, r0 + bne _0800DD48 +_0800DD68: + ldr r0, [r7] + adds r0, 0xA + adds r0, r3 + ldrb r0, [r0] + b _0800DD8C +_0800DD72: + movs r3, 0 + movs r1, 0x1 +_0800DD76: + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + bne _0800DD68 + lsrs r2, 1 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800DD76 +_0800DD8A: + movs r0, 0 +_0800DD8C: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800DD1C + + thumb_func_start sub_800DD94 +sub_800DD94: @ 800DD94 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r7, r0, 0 + lsls r1, 24 + lsrs r1, 24 + mov r9, r1 + movs r4, 0 + ldr r0, =gSaveBlock2Ptr + mov r8, r0 + adds r6, r7, 0x2 + ldr r0, [r0] + adds r5, r0, 0 + adds r5, 0xA +_0800DDB2: + adds r0, r6, r4 + adds r1, r5, r4 + ldrb r1, [r1] + strb r1, [r0] + adds r4, 0x1 + cmp r4, 0x1 + ble _0800DDB2 + movs r4, 0 + lsls r2, 7 + mov r12, r2 + adds r1, r7, 0x4 +_0800DDC8: + adds r0, r1, r4 + strb r3, [r0] + asrs r3, 8 + adds r4, 0x1 + cmp r4, 0x3 + ble _0800DDC8 + mov r1, r8 + ldr r0, [r1] + ldrb r0, [r0, 0x8] + movs r6, 0x1 + movs r1, 0x1 + ands r1, r0 + ldrb r2, [r7, 0xB] + movs r5, 0x2 + negs r5, r5 + adds r0, r5, 0 + ands r0, r2 + orrs r0, r1 + strb r0, [r7, 0xB] + movs r4, 0x7F + mov r1, r9 + ands r1, r4 + ldrb r2, [r7, 0xA] + movs r0, 0x80 + negs r0, r0 + ands r0, r2 + orrs r0, r1 + ands r0, r4 + mov r1, r12 + orrs r0, r1 + strb r0, [r7, 0xA] + ldrb r0, [r7] + movs r1, 0x10 + negs r1, r1 + ands r1, r0 + movs r0, 0x2 + orrs r1, r0 + ldrb r2, [r7, 0x1] + movs r0, 0x3D + negs r0, r0 + ands r0, r2 + movs r2, 0xC + orrs r0, r2 + strb r0, [r7, 0x1] + movs r0, 0x11 + negs r0, r0 + ands r1, r0 + subs r0, 0x10 + ands r1, r0 + subs r0, 0x20 + ands r1, r0 + strb r1, [r7] + ldr r0, =0x0000087f + bl FlagGet + lsls r0, 7 + ldrb r1, [r7] + ands r4, r1 + orrs r4, r0 + strb r4, [r7] + bl IsNationalPokedexEnabled + ands r0, r6 + ldrb r1, [r7, 0x1] + ands r5, r1 + orrs r5, r0 + strb r5, [r7, 0x1] + ldr r0, =0x00000864 + bl FlagGet + ands r6, r0 + lsls r6, 1 + ldrb r1, [r7, 0x1] + movs r0, 0x3 + negs r0, r0 + ands r0, r1 + orrs r0, r6 + strb r0, [r7, 0x1] + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DD94 + + thumb_func_start sub_800DE7C +sub_800DE7C: @ 800DE7C + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r7, r0, 0 + mov r8, r1 + lsls r2, 24 + lsrs r5, r2, 24 + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x6] + cmp r0, 0x1 + bne _0800DED8 + movs r0, 0x1 + mov r9, r0 + ldr r6, =gUnknown_03007890 + ldr r0, [r6] + lsls r4, r5, 5 + adds r0, r4 + ldrh r0, [r0, 0x18] + bl sub_8010454 + cmp r0, 0 + beq _0800DEB8 + ldr r1, [r6] + ldrb r0, [r1, 0x7] + asrs r0, r5 + mov r2, r9 + ands r0, r2 + cmp r0, 0 + bne _0800DEF0 +_0800DEB8: + adds r0, r7, 0 + movs r1, 0 + movs r2, 0xD + bl memset + mov r0, r8 + movs r1, 0 + movs r2, 0x8 + bl memset + b _0800DF24 + .pool +_0800DED8: + movs r0, 0 + mov r9, r0 + ldr r6, =gUnknown_03007890 + ldr r0, [r6] + lsls r4, r5, 5 + adds r0, r4 + ldrh r0, [r0, 0x18] + bl sub_8010454 + cmp r0, 0 + beq _0800DF10 + ldr r1, [r6] +_0800DEF0: + adds r1, r4, r1 + adds r1, 0x1A + adds r0, r7, 0 + movs r2, 0xD + bl memcpy + ldr r1, [r6] + adds r1, r4, r1 + adds r1, 0x29 + mov r0, r8 + movs r2, 0x8 + bl memcpy + b _0800DF24 + .pool +_0800DF10: + adds r0, r7, 0 + movs r1, 0 + movs r2, 0xD + bl memset + mov r0, r8 + movs r1, 0 + movs r2, 0x8 + bl memset +_0800DF24: + mov r0, r9 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800DE7C + + thumb_func_start sub_800DF34 +sub_800DF34: @ 800DF34 + push {r4-r7,lr} + adds r3, r0, 0 + adds r5, r1, 0 + lsls r2, 24 + movs r7, 0 + ldr r6, =gUnknown_03007890 + ldr r0, [r6] + lsrs r4, r2, 19 + adds r2, r0, r4 + ldrh r1, [r2, 0x18] + ldr r0, =0x00007f7d + cmp r1, r0 + bne _0800DF74 + adds r1, r2, 0 + adds r1, 0x1A + adds r0, r3, 0 + movs r2, 0xD + bl memcpy + ldr r1, [r6] + adds r1, r4, r1 + adds r1, 0x29 + adds r0, r5, 0 + movs r2, 0x8 + bl memcpy + movs r7, 0x1 + b _0800DF88 + .pool +_0800DF74: + adds r0, r3, 0 + movs r1, 0 + movs r2, 0xD + bl memset + adds r0, r5, 0 + movs r1, 0 + movs r2, 0x8 + bl memset +_0800DF88: + adds r0, r7, 0 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800DF34 + + thumb_func_start sub_800DF90 +sub_800DF90: @ 800DF90 + push {r4,lr} + adds r4, r1, 0 + ldr r1, =gUnknown_02022B14 + movs r2, 0xD + bl memcpy + ldr r1, =gUnknown_02022B22 + adds r0, r4, 0 + movs r2, 0x8 + bl memcpy + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DF90 + + thumb_func_start sub_800DFB4 +sub_800DFB4: @ 800DFB4 + push {r4,r5,lr} + lsls r0, 24 + lsrs r3, r0, 24 + lsls r1, 24 + lsrs r2, r1, 24 + cmp r3, 0 + bne _0800DFCA + cmp r2, 0 + bne _0800DFCA + movs r3, 0xE7 + movs r2, 0x8 +_0800DFCA: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800E024 + ldr r0, =gUnknown_082ED5F0 + adds r1, r3, 0 + movs r3, 0 + bl CreateSprite + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + ldr r0, =gSprites + lsls r4, r5, 4 + adds r4, r5 + lsls r4, 2 + adds r4, r0 + ldr r0, =0x00001234 + strh r0, [r4, 0x3C] + ldr r0, =gUnknown_082ED5E0 + ldrh r0, [r0, 0x6] + bl GetSpriteTileStartByTag + strh r0, [r4, 0x3A] + adds r4, 0x3E + ldrb r0, [r4] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r4] + ldr r0, =gUnknown_02022B10 + strb r5, [r0] + b _0800E06A + .pool +_0800E024: + ldr r0, =gUnknown_082ED5F0 + adds r1, r3, 0 + movs r3, 0 + bl CreateSprite + ldr r4, =gUnknown_02022B10 + strb r0, [r4] + ldr r5, =gSprites + ldrb r1, [r4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + ldr r1, =0x00001234 + strh r1, [r0, 0x3C] + ldr r0, =gUnknown_082ED5E0 + ldrh r0, [r0, 0x6] + bl GetSpriteTileStartByTag + ldrb r2, [r4] + lsls r1, r2, 4 + adds r1, r2 + lsls r1, 2 + adds r1, r5 + strh r0, [r1, 0x3A] + ldrb r1, [r4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + adds r0, 0x3E + ldrb r1, [r0] + movs r2, 0x4 + orrs r1, r2 + strb r1, [r0] +_0800E06A: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DFB4 + + thumb_func_start sub_800E084 +sub_800E084: @ 800E084 + push {r4,lr} + ldr r4, =gSprites + ldr r3, =gUnknown_02022B10 + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r2, r0, r4 + movs r0, 0x3C + ldrsh r1, [r2, r0] + ldr r0, =0x00001234 + cmp r1, r0 + bne _0800E0CA + movs r0, 0 + strh r0, [r2, 0x3C] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + bl DestroySprite + ldr r3, =gMain + movs r0, 0x84 + lsls r0, 3 + adds r3, r0 + ldr r0, =gDummyOamData + ldr r1, [r0] + ldr r2, [r0, 0x4] + str r1, [r3] + str r2, [r3, 0x4] + ldr r1, =0x070003e8 + movs r2, 0x4 + bl CpuSet +_0800E0CA: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E084 + + thumb_func_start sub_800E0E8 +sub_800E0E8: @ 800E0E8 + push {r4,lr} + ldr r4, =gUnknown_082ED5E0 + ldrh r0, [r4, 0x6] + bl GetSpriteTileStartByTag + lsls r0, 16 + ldr r1, =0xffff0000 + cmp r0, r1 + bne _0800E100 + adds r0, r4, 0 + bl LoadCompressedObjectPic +_0800E100: + ldr r0, =gUnknown_082ED5E8 + bl LoadSpritePalette + ldr r1, =gUnknown_02022B10 + movs r0, 0xFF + strb r0, [r1] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E0E8 + + thumb_func_start sub_800E124 +sub_800E124: @ 800E124 + push {r4,lr} + ldr r1, =gUnknown_03007890 + ldr r0, [r1] + ldrb r2, [r0, 0x2] + movs r3, 0 + movs r4, 0x1 +_0800E130: + adds r0, r2, 0 + ands r0, r4 + cmp r0, 0 + beq _0800E148 + ldr r0, [r1] + adds r0, 0xA + adds r0, r3 + ldrb r0, [r0] + b _0800E156 + .pool +_0800E148: + lsrs r2, 1 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800E130 + movs r0, 0 +_0800E156: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_800E124 + + thumb_func_start sub_800E15C +sub_800E15C: @ 800E15C + push {lr} + adds r2, r0, 0 + movs r3, 0x32 + ldrsh r0, [r2, r3] + cmp r0, r1 + beq _0800E170 + movs r0, 0 + strh r1, [r2, 0x32] + strh r0, [r2, 0x34] + strh r0, [r2, 0x36] +_0800E170: + pop {r0} + bx r0 + thumb_func_end sub_800E15C + + thumb_func_start sub_800E174 +sub_800E174: @ 800E174 + push {r4-r7,lr} + mov r7, r8 + push {r7} + ldr r1, =gUnknown_02022B10 + ldrb r0, [r1] + cmp r0, 0xFF + bne _0800E184 + b _0800E346 +_0800E184: + ldr r2, =gSprites + adds r1, r0, 0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r2, r0, r2 + movs r0, 0x3C + ldrsh r1, [r2, r0] + ldr r0, =0x00001234 + cmp r1, r0 + beq _0800E19C + b _0800E346 +_0800E19C: + adds r6, r2, 0 + movs r5, 0xFF + movs r4, 0 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800E1F6 + adds r7, r6, 0 + adds r7, 0x28 + movs r1, 0x29 + adds r1, r6 + mov r8, r1 + b _0800E1E6 + .pool +_0800E1C8: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl sub_800DD1C + lsls r0, 24 + lsrs r0, 24 + cmp r5, r0 + bcc _0800E1E6 + adds r0, r4, 0 + bl sub_800DD1C + lsls r0, 24 + lsrs r5, r0, 24 +_0800E1E6: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + subs r0, 0x1 + cmp r4, r0 + blt _0800E1C8 + b _0800E208 +_0800E1F6: + bl sub_800E124 + lsls r0, 24 + lsrs r5, r0, 24 + adds r7, r6, 0 + adds r7, 0x28 + movs r2, 0x29 + adds r2, r6 + mov r8, r2 +_0800E208: + bl sub_8012224 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0800E218 + movs r0, 0x4 + b _0800E246 +_0800E218: + cmp r5, 0x18 + bhi _0800E220 + movs r0, 0x3 + b _0800E246 +_0800E220: + adds r0, r5, 0 + subs r0, 0x19 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x65 + bhi _0800E230 + movs r0, 0x2 + b _0800E246 +_0800E230: + adds r0, r5, 0 + subs r0, 0x7F + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x65 + bhi _0800E240 + movs r0, 0x1 + b _0800E246 +_0800E240: + cmp r5, 0xE4 + bls _0800E248 + movs r0, 0 +_0800E246: + strh r0, [r6, 0x2E] +_0800E248: + movs r3, 0x2E + ldrsh r1, [r6, r3] + movs r2, 0x30 + ldrsh r0, [r6, r2] + cmp r1, r0 + beq _0800E25E + adds r0, r6, 0 + bl sub_800E15C + ldrh r0, [r6, 0x2E] + strh r0, [r6, 0x30] +_0800E25E: + movs r0, 0x32 + ldrsh r1, [r6, r0] + ldr r2, [r6, 0x8] + lsls r1, 2 + adds r1, r2 + movs r3, 0x36 + ldrsh r0, [r6, r3] + ldr r1, [r1] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + lsls r0, 10 + lsrs r0, 26 + movs r3, 0x34 + ldrsh r1, [r6, r3] + cmp r0, r1 + bge _0800E2AC + ldrh r0, [r6, 0x36] + adds r0, 0x1 + movs r3, 0 + strh r0, [r6, 0x36] + strh r3, [r6, 0x34] + movs r1, 0x32 + ldrsh r0, [r6, r1] + lsls r0, 2 + adds r0, r2 + movs r2, 0x36 + ldrsh r1, [r6, r2] + ldr r0, [r0] + lsls r1, 2 + adds r1, r0 + movs r0, 0 + ldrsh r1, [r1, r0] + movs r0, 0x2 + negs r0, r0 + cmp r1, r0 + bne _0800E2B2 + strh r3, [r6, 0x36] + b _0800E2B2 +_0800E2AC: + ldrh r0, [r6, 0x34] + adds r0, 0x1 + strh r0, [r6, 0x34] +_0800E2B2: + ldr r4, =gMain + movs r1, 0x84 + lsls r1, 3 + adds r0, r4, r1 + ldr r1, =gUnknown_082ED570 + ldr r2, [r1, 0x4] + ldr r1, [r1] + str r1, [r0] + str r2, [r0, 0x4] + movs r3, 0x20 + ldrsh r2, [r6, r3] + movs r1, 0 + ldrsb r1, [r7, r1] + adds r2, r1 + ldr r1, =0x00000422 + adds r5, r4, r1 + ldr r3, =0x000001ff + adds r1, r3, 0 + ands r2, r1 + ldrh r3, [r5] + ldr r1, =0xfffffe00 + ands r1, r3 + orrs r1, r2 + strh r1, [r5] + ldrh r1, [r6, 0x22] + mov r2, r8 + ldrb r2, [r2] + adds r1, r2 + strb r1, [r0] + ldrb r2, [r6, 0x5] + ldr r3, =0x00000425 + adds r5, r4, r3 + lsrs r2, 4 + lsls r2, 4 + ldrb r3, [r5] + movs r1, 0xF + ands r1, r3 + orrs r1, r2 + strb r1, [r5] + movs r1, 0x32 + ldrsh r2, [r6, r1] + ldr r1, [r6, 0x8] + lsls r2, 2 + adds r2, r1 + movs r3, 0x36 + ldrsh r1, [r6, r3] + ldr r2, [r2] + lsls r1, 2 + adds r1, r2 + ldrh r2, [r1] + ldrh r6, [r6, 0x3A] + adds r2, r6 + ldr r1, =0x00000424 + adds r4, r1 + ldr r3, =0x000003ff + adds r1, r3, 0 + ands r2, r1 + ldrh r3, [r4] + ldr r1, =0xfffffc00 + ands r1, r3 + orrs r1, r2 + strh r1, [r4] + ldr r1, =0x070003e8 + movs r2, 0x4 + bl CpuSet + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0800E346 + bl sub_800E084 +_0800E346: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E174 + + thumb_func_start sub_800E378 +sub_800E378: @ 800E378 + push {lr} + stm r0!, {r1} + adds r1, r2, 0 + bl StringCopy + pop {r0} + bx r0 + thumb_func_end sub_800E378 + + thumb_func_start sub_800E388 +sub_800E388: @ 800E388 + push {lr} + adds r2, r0, 0 + movs r1, 0 +_0800E38E: + adds r0, r2, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0800E39A + movs r0, 0x1 + b _0800E3A2 +_0800E39A: + adds r1, 0x1 + cmp r1, 0x7 + ble _0800E38E + movs r0, 0 +_0800E3A2: + pop {r1} + bx r1 + thumb_func_end sub_800E388 + + thumb_func_start sub_800E3A8 +sub_800E3A8: @ 800E3A8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x20 + ldr r0, =gLinkVSyncDisabled + ldrb r0, [r0] + cmp r0, 0 + bne _0800E3BE + b _0800E520 +_0800E3BE: + movs r0, 0xF0 + bl AllocZeroed + str r0, [sp, 0x14] + movs r4, 0 + b _0800E434 + .pool +_0800E3D0: + lsls r2, r4, 2 + mov r0, sp + adds r1, r0, r2 + movs r0, 0x1 + negs r0, r0 + str r0, [r1] + movs r5, 0 + mov r8, r2 + lsls r0, r4, 3 + adds r1, r4, 0x1 + mov r9, r1 + subs r0, r4 + lsls r0, 2 + str r0, [sp, 0x1C] + ldr r7, =gLinkPlayers + 8 + mov r10, r7 + ldr r6, =0x00003b98 + movs r4, 0 + mov r0, r10 + subs r0, 0x4 + ldr r1, [sp, 0x1C] + adds r3, r1, r0 +_0800E3FC: + ldrh r1, [r3] + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r7, =0x00003b98 + adds r0, r2, r7 + adds r0, r4 + ldr r0, [r0] + cmp r1, r0 + bne _0800E428 + adds r1, r2, r6 + adds r1, 0x4 + ldr r0, [sp, 0x1C] + add r0, r10 + str r3, [sp, 0x18] + bl StringCompare + ldr r3, [sp, 0x18] + cmp r0, 0 + bne _0800E428 + mov r0, sp + add r0, r8 + str r5, [r0] +_0800E428: + adds r6, 0xC + adds r4, 0xC + adds r5, 0x1 + cmp r5, 0x13 + ble _0800E3FC + mov r4, r9 +_0800E434: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + blt _0800E3D0 + movs r0, 0 + mov r8, r0 + movs r4, 0 + mov r7, sp + movs r5, 0 + ldr r6, [sp, 0x14] + b _0800E4AC + .pool +_0800E45C: + bl GetMultiplayerId + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + beq _0800E4A6 + ldr r2, =gLinkPlayers + adds r0, r5, r2 + ldrh r0, [r0, 0x1A] + cmp r0, 0x1 + beq _0800E4A6 + adds r0, r2, 0x4 + adds r0, r5, r0 + ldrh r1, [r0] + adds r2, 0x8 + adds r2, r5, r2 + adds r0, r6, 0 + bl sub_800E378 + ldr r2, [r7] + cmp r2, 0 + blt _0800E4A0 + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r0, r1 + ldr r1, =0x00003b9c + adds r0, r1 + movs r1, 0 + movs r2, 0x8 + bl memset +_0800E4A0: + adds r6, 0xC + movs r0, 0x1 + add r8, r0 +_0800E4A6: + adds r7, 0x4 + adds r5, 0x1C + adds r4, 0x1 +_0800E4AC: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + blt _0800E45C + movs r4, 0 + ldr r1, =gSaveBlock1Ptr + mov r9, r1 + ldr r6, =0x00003b98 + movs r7, 0 + mov r1, r8 + lsls r0, r1, 1 + add r0, r8 + lsls r0, 2 + ldr r1, [sp, 0x14] + adds r5, r0, r1 +_0800E4CE: + mov r1, r9 + ldr r0, [r1] + adds r0, r6 + adds r0, 0x4 + bl sub_800E388 + cmp r0, 0 + beq _0800E500 + mov r0, r9 + ldr r2, [r0] + ldr r1, =0x00003b98 + adds r0, r2, r1 + adds r0, r7 + ldr r1, [r0] + adds r2, r6 + adds r2, 0x4 + adds r0, r5, 0 + bl sub_800E378 + adds r5, 0xC + movs r0, 0x1 + add r8, r0 + mov r1, r8 + cmp r1, 0x13 + bgt _0800E50A +_0800E500: + adds r6, 0xC + adds r7, 0xC + adds r4, 0x1 + cmp r4, 0x13 + ble _0800E4CE +_0800E50A: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r7, =0x00003b98 + adds r0, r7 + ldr r1, [sp, 0x14] + movs r2, 0xF0 + bl memcpy + ldr r0, [sp, 0x14] + bl Free +_0800E520: + add sp, 0x20 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E3A8 + + thumb_func_start sub_800E540 +sub_800E540: @ 800E540 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + mov r9, r1 + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + movs r7, 0 + ldr r6, =gSaveBlock1Ptr + ldr r4, =0x00003b98 + movs r5, 0 +_0800E558: + ldr r0, [r6] + adds r0, r4 + adds r0, 0x4 + mov r1, r9 + bl StringCompare + cmp r0, 0 + bne _0800E584 + ldr r0, [r6] + ldr r1, =0x00003b98 + adds r0, r1 + adds r0, r5 + ldr r0, [r0] + cmp r0, r8 + bne _0800E584 + movs r0, 0x1 + b _0800E59E + .pool +_0800E584: + ldr r0, [r6] + adds r0, r4 + adds r0, 0x4 + bl sub_800E388 + cmp r0, 0 + beq _0800E59C + adds r4, 0xC + adds r5, 0xC + adds r7, 0x1 + cmp r7, 0x13 + ble _0800E558 +_0800E59C: + movs r0, 0 +_0800E59E: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800E540 + + thumb_func_start sub_800E5AC +sub_800E5AC: @ 800E5AC + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x4 + ldr r0, =0x00003b98 + mov r8, r0 + movs r7, 0 + mov r6, r8 + movs r5, 0 + movs r4, 0x13 +_0800E5C0: + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + mov r2, r8 + adds r0, r1, r2 + adds r0, r5 + str r7, [r0] + mov r0, sp + strh r7, [r0] + adds r1, r6 + adds r1, 0x4 + ldr r2, =0x01000004 + bl CpuSet + adds r6, 0xC + adds r5, 0xC + subs r4, 0x1 + cmp r4, 0 + bge _0800E5C0 + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E5AC + + thumb_func_start nullsub_5 +nullsub_5: @ 800E5FC + bx lr + thumb_func_end nullsub_5 + + thumb_func_start nullsub_13 +nullsub_13: @ 800E600 + bx lr + thumb_func_end nullsub_13 + + thumb_func_start sub_800E604 +sub_800E604: @ 800E604 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x8 + ldr r6, =gUnknown_03005000 + adds r5, r6, 0 + adds r5, 0xEE + ldrb r4, [r5] + mov r0, sp + movs r7, 0 + strh r7, [r0] + ldr r2, =0x0100067a + adds r1, r6, 0 + bl CpuSet + ldrb r0, [r5] + strb r4, [r5] + movs r0, 0xFF + strb r0, [r6, 0xC] + ldrb r0, [r5] + cmp r0, 0x4 + beq _0800E636 + ldrb r0, [r5] + strb r7, [r5] +_0800E636: + mov r7, sp + adds r7, 0x2 + add r0, sp, 0x4 + mov r8, r0 + movs r0, 0x6 + add r0, sp + mov r9, r0 + adds r5, r6, 0 + adds r5, 0x80 + movs r4, 0x4 +_0800E64A: + adds r0, r5, 0 + bl sub_800FCC4 + adds r5, 0x14 + subs r4, 0x1 + cmp r4, 0 + bge _0800E64A + movs r5, 0 + ldr r4, =gUnknown_0300506C + adds r0, r4, 0 + bl sub_800FCC4 + adds r0, r4, 0 + adds r0, 0xB8 + bl sub_800D6C8 + ldr r0, =0x0000097c + adds r4, r0 + adds r0, r4, 0 + bl sub_800D724 + strh r5, [r7] + ldr r1, =gUnknown_03003110 + ldr r2, =0x01000008 + adds r0, r7, 0 + bl CpuSet + mov r0, r8 + strh r5, [r0] + ldr r1, =gUnknown_03003090 + ldr r2, =0x01000028 + bl CpuSet + mov r0, r9 + strh r5, [r0] + ldr r1, =gLinkPlayers + ldr r2, =0x01000046 + bl CpuSet + add sp, 0x8 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E604 + + thumb_func_start sub_800E6D0 +sub_800E6D0: @ 800E6D0 + push {r4-r6,lr} + ldr r4, =gIntrTable + ldr r5, [r4, 0x4] + ldr r6, [r4, 0x8] + bl sub_800E700 + bl rfu_REQ_stopMode + bl rfu_waitREQComplete + ldr r1, =0x04000208 + movs r0, 0 + strh r0, [r1] + str r5, [r4, 0x4] + str r6, [r4, 0x8] + movs r0, 0x1 + strh r0, [r1] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E6D0 + + thumb_func_start sub_800E700 +sub_800E700: @ 800E700 + push {r4,lr} + ldr r0, =gUnknown_03004190 + ldr r1, =0x00000e64 + ldr r4, =gIntrTable + 0x4 + adds r2, r4, 0 + movs r3, 0x1 + bl rfu_initializeAPI + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, 0 + bne _0800E732 + ldr r0, =gUnknown_020229C6 + strh r1, [r0] + bl sub_800AAF4 + movs r0, 0 + bl sub_80111B0 + bl sub_800E604 + adds r1, r4, 0x4 + movs r0, 0x3 + bl rfu_setTimerInterrupt +_0800E732: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E700 + + thumb_func_start sub_800E748 +sub_800E748: @ 800E748 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + bl sub_8010750 + ldr r0, =gUnknown_03005000 + ldrh r0, [r0, 0x4] + cmp r0, 0x12 + bls _0800E75C + b _0800E862 +_0800E75C: + lsls r0, 2 + ldr r1, =_0800E770 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800E770: + .4byte _0800E7BC + .4byte _0800E862 + .4byte _0800E7E4 + .4byte _0800E862 + .4byte _0800E814 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E862 + .4byte _0800E828 +_0800E7BC: + ldr r0, =gUnknown_02022B2C + bl sub_800BFCC + ldr r0, =gUnknown_03005000 + movs r2, 0x1 + strh r2, [r0, 0x4] + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + strh r2, [r0, 0xA] + b _0800E862 + .pool +_0800E7E4: + ldr r4, =gUnknown_03005000 + ldrb r0, [r4, 0xC] + ldr r3, =gUnknown_082ED6E0 + movs r1, 0 + movs r2, 0xF0 + bl sub_800C054 + movs r0, 0x3 + strh r0, [r4, 0x4] + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + movs r1, 0x6 + strh r1, [r0, 0xA] + b _0800E862 + .pool +_0800E814: + movs r0, 0 + bl sub_800C27C + ldr r1, =gUnknown_03005000 + movs r0, 0x5 + strh r0, [r1, 0x4] + b _0800E862 + .pool +_0800E828: + ldr r4, =gUnknown_03005000 + ldr r0, =0x00000cdb + adds r1, r4, r0 + ldrb r0, [r1] + movs r0, 0 + strb r0, [r1] + ldr r0, =sub_800EDBC + bl sub_800D52C + bl sub_800EAB4 + bl sub_800EAFC + movs r0, 0x14 + strh r0, [r4, 0x4] + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + movs r1, 0x8 + strh r1, [r0, 0xA] + ldr r0, =sub_801084C + movs r1, 0x5 + bl CreateTask + adds r0, r5, 0 + bl DestroyTask +_0800E862: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E748 + + thumb_func_start sub_800E87C +sub_800E87C: @ 800E87C + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnknown_082ED6A5 + adds r0, r1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_800E87C + + thumb_func_start sub_800E88C +sub_800E88C: @ 800E88C + push {r4-r7,lr} + adds r2, r0, 0 + adds r5, r1, 0 + movs r4, 0x1 + adds r1, r2, 0 + movs r6, 0 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + bne _0800E8CC + movs r3, 0 + movs r5, 0x1 + ldr r1, =gUnknown_03005CDE +_0800E8A6: + adds r0, r2, 0 + ands r0, r5 + cmp r0, 0 + beq _0800E8B8 + adds r0, r3, r1 + strb r4, [r0] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 +_0800E8B8: + asrs r2, 1 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800E8A6 + b _0800E942 + .pool +_0800E8CC: + movs r3, 0 + mvns r0, r1 + mov r12, r0 + movs r7, 0x1 + ldr r4, =gUnknown_03005CDE +_0800E8D6: + adds r2, r1, 0 + ands r2, r7 + cmp r2, 0 + bne _0800E8E2 + adds r0, r3, r4 + strb r2, [r0] +_0800E8E2: + asrs r1, 1 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800E8D6 + movs r4, 0x4 + ldr r0, =gUnknown_03005CDE + ldrb r7, [r0] +_0800E8F4: + movs r3, 0 + subs r1, r4, 0x1 + cmp r7, r4 + beq _0800E910 + ldr r2, =gUnknown_03005CDE +_0800E8FE: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bhi _0800E910 + adds r0, r3, r2 + ldrb r0, [r0] + cmp r0, r4 + bne _0800E8FE +_0800E910: + cmp r3, 0x4 + bne _0800E916 + adds r6, r4, 0 +_0800E916: + lsls r0, r1, 24 + lsrs r4, r0, 24 + cmp r4, 0 + bne _0800E8F4 + mov r0, r12 + ands r5, r0 + movs r3, 0 + movs r2, 0x1 + ldr r1, =gUnknown_03005CDE +_0800E928: + adds r0, r5, 0 + ands r0, r2 + cmp r0, 0 + beq _0800E936 + adds r0, r3, r1 + strb r6, [r0] + adds r6, 0x1 +_0800E936: + asrs r5, 1 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800E928 +_0800E942: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E88C + + thumb_func_start sub_800E94C +sub_800E94C: @ 800E94C + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + ldr r0, =gUnknown_03005000 + ldrh r3, [r0, 0x4] + adds r7, r0, 0 + cmp r3, 0xC + bls _0800E95E + b _0800EA9A +_0800E95E: + lsls r0, r3, 2 + ldr r1, =_0800E970 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800E970: + .4byte _0800E9A4 + .4byte _0800EA9A + .4byte _0800EA9A + .4byte _0800EA9A + .4byte _0800EA9A + .4byte _0800EA9A + .4byte _0800E9BC + .4byte _0800EA9A + .4byte _0800EA9A + .4byte _0800E9E4 + .4byte _0800EA9A + .4byte _0800E9F8 + .4byte _0800EA3C +_0800E9A4: + ldr r0, =gUnknown_082ED608 + bl sub_800BFCC + ldr r0, =gUnknown_03005000 + movs r2, 0x1 + strh r2, [r0, 0x4] + b _0800E9CC + .pool +_0800E9BC: + ldrb r0, [r7, 0xC] + ldr r3, =gUnknown_082ED6E0 + movs r1, 0 + movs r2, 0xF0 + bl sub_800C054 + movs r2, 0x7 + strh r2, [r7, 0x4] +_0800E9CC: + ldr r1, =gTasks + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + adds r0, r1 + strh r2, [r0, 0xA] + b _0800EA9A + .pool +_0800E9E4: + ldr r0, =gTasks + lsls r1, r6, 2 + adds r1, r6 + lsls r1, 3 + adds r1, r0 + movs r0, 0xA + strh r0, [r1, 0xA] + b _0800EA9A + .pool +_0800E9F8: + bl sub_80107A0 + cmp r0, 0x6 + beq _0800EA1C + cmp r0, 0x6 + bgt _0800EA0A + cmp r0, 0x5 + beq _0800EA10 + b _0800EA9A +_0800EA0A: + cmp r0, 0x9 + beq _0800EA1C + b _0800EA9A +_0800EA10: + ldr r1, =gUnknown_03005000 + movs r0, 0xC + strh r0, [r1, 0x4] + b _0800EA9A + .pool +_0800EA1C: + bl sub_800D630 + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000ce4 + adds r0, r1 + movs r1, 0x2 + strb r1, [r0] + adds r0, r6, 0 + bl DestroyTask + b _0800EA9A + .pool +_0800EA3C: + ldr r0, =0x00000c3e + adds r4, r7, r0 + ldrb r0, [r4] + movs r5, 0x80 + lsls r5, 17 + lsls r5, r0 + lsrs r5, 24 + ldrb r1, [r4] + movs r0, 0xC + bl rfu_clearSlot + ldrb r1, [r4] + ldr r0, =0x00000c3f + adds r2, r7, r0 + movs r0, 0x10 + movs r3, 0x46 + bl rfu_setRecvBuffer + adds r1, r7, 0 + adds r1, 0x4C + adds r0, r5, 0 + movs r2, 0xE + bl rfu_UNI_setSendData + ldr r1, =gTasks + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + adds r0, r1 + movs r1, 0x8 + strh r1, [r0, 0xA] + adds r0, r6, 0 + bl DestroyTask + ldr r4, =gUnknown_02022B44 + ldrb r0, [r4, 0xF] + cmp r0, 0 + bne _0800EA92 + bl sub_801227C + ldrb r0, [r4, 0xF] + adds r0, 0x1 + strb r0, [r4, 0xF] +_0800EA92: + ldr r0, =sub_801084C + movs r1, 0x5 + bl CreateTask +_0800EA9A: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800E94C + + thumb_func_start sub_800EAB4 +sub_800EAB4: @ 800EAB4 + push {r4,r5,lr} + ldr r0, =gUnknown_03004140 + ldrb r5, [r0] + movs r4, 0 +_0800EABC: + movs r0, 0x1 + ands r0, r5 + cmp r0, 0 + beq _0800EAE0 + lsls r2, r4, 3 + subs r2, r4 + lsls r2, 1 + ldr r0, =gUnknown_03005014 + adds r2, r0 + movs r0, 0x10 + adds r1, r4, 0 + movs r3, 0xE + bl rfu_setRecvBuffer + movs r0, 0x3 + adds r1, r4, 0 + bl rfu_clearSlot +_0800EAE0: + lsrs r5, 1 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800EABC + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800EAB4 + + thumb_func_start sub_800EAFC +sub_800EAFC: @ 800EAFC + push {r4-r6,lr} + ldr r0, =gUnknown_03004140 + ldrb r5, [r0] + ldr r4, =gUnknown_03005C87 + adds r0, r5, 0 + adds r1, r4, 0 + movs r2, 0x46 + bl rfu_UNI_setSendData + adds r0, r5, 0 + bl sub_800E87C + ldr r1, =0xfffff379 + adds r6, r4, r1 + adds r1, r4, 0 + adds r1, 0x53 + strb r0, [r1] + adds r4, 0x5B + strb r5, [r4] + movs r1, 0x1 + negs r1, r1 + adds r0, r5, 0 + bl sub_800E88C + movs r0, 0x1 + strb r0, [r6, 0xC] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800EAFC + + thumb_func_start sub_800EB44 +sub_800EB44: @ 800EB44 + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r0, 0x7F + ands r0, r1 + cmp r0, 0x54 + bne _0800EB78 + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x4 + bne _0800EB78 + ldr r0, =gUnknown_03004140 + ldrb r0, [r0] + bl rfu_REQ_disconnect + bl rfu_waitREQComplete + movs r0, 0 + movs r1, 0 + bl sub_8011A64 +_0800EB78: + ldr r0, =gUnknown_03005000 + ldrh r2, [r0, 0x4] + adds r6, r0, 0 + cmp r2, 0x12 + bls _0800EB84 + b _0800ECF4 +_0800EB84: + lsls r0, r2, 2 + ldr r1, =_0800EB9C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800EB9C: + .4byte _0800EBE8 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800ECF4 + .4byte _0800EC38 + .4byte _0800EC98 + .4byte _0800ECF4 + .4byte _0800ECAC + .4byte _0800EC10 + .4byte _0800ECF4 +_0800EBE8: + ldr r0, =gUnknown_02022B2C + bl sub_800BFCC + ldr r0, =gUnknown_03005000 + movs r2, 0x1 + strh r2, [r0, 0x4] + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + strh r2, [r0, 0xA] + b _0800ECF4 + .pool +_0800EC10: + ldr r3, =gUnknown_082ED6E0 + movs r0, 0x2 + movs r1, 0 + movs r2, 0xF0 + bl sub_800C054 + ldr r0, =sub_800ED34 + bl sub_800D52C + ldr r1, =gUnknown_03005000 + movs r0, 0x12 + strh r0, [r1, 0x4] + b _0800ECF4 + .pool +_0800EC38: + ldr r1, =0x00000c3e + adds r0, r6, r1 + ldrb r1, [r0] + movs r0, 0x80 + lsls r0, 17 + lsls r0, r1 + lsrs r0, 24 + adds r1, r6, 0 + adds r1, 0x4C + movs r2, 0xE + bl rfu_UNI_setSendData + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0 + bne _0800ECF4 + strb r0, [r6, 0xC] + adds r0, r5, 0 + bl DestroyTask + ldr r0, =gTasks + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r1, r0 + movs r2, 0x16 + ldrsh r0, [r1, r2] + cmp r0, 0 + beq _0800EC88 + ldr r0, =sub_8010D0C + movs r1, 0x1 + bl CreateTask + b _0800ECF4 + .pool +_0800EC88: + ldr r0, =sub_801084C + movs r1, 0x5 + bl CreateTask + b _0800ECF4 + .pool +_0800EC98: + movs r0, 0 + bl sub_800C27C + ldr r1, =gUnknown_03005000 + movs r0, 0xF + strh r0, [r1, 0x4] + b _0800ECF4 + .pool +_0800ECAC: + ldr r0, =0x00000cdb + adds r1, r6, r0 + ldrb r0, [r1] + movs r0, 0 + strb r0, [r1] + ldr r0, =sub_800EDBC + bl sub_800D52C + movs r0, 0x1 + bl sub_8011068 + bl sub_800EAB4 + bl sub_800EAFC + movs r0, 0x14 + strh r0, [r6, 0x4] + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + movs r1, 0x8 + strh r1, [r0, 0xA] + movs r4, 0x1 + strb r4, [r6, 0xC] + ldr r0, =sub_801084C + movs r1, 0x5 + bl CreateTask + ldr r1, =0x00000ce8 + adds r0, r6, r1 + strb r4, [r0] + adds r0, r5, 0 + bl DestroyTask +_0800ECF4: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800EB44 + + thumb_func_start sub_800ED10 +sub_800ED10: @ 800ED10 + push {lr} + ldr r3, =gUnknown_082ED6E0 + movs r0, 0x1 + movs r1, 0 + movs r2, 0xF0 + bl sub_800C054 + pop {r0} + bx r0 + .pool + thumb_func_end sub_800ED10 + + thumb_func_start sub_800ED28 +sub_800ED28: @ 800ED28 + push {lr} + movs r0, 0 + bl sub_800C27C + pop {r0} + bx r0 + thumb_func_end sub_800ED28 + + thumb_func_start sub_800ED34 +sub_800ED34: @ 800ED34 + push {r4,lr} + ldr r0, =gUnknown_03005000 + movs r2, 0 + movs r1, 0xD + adds r0, 0x59 +_0800ED3E: + strb r2, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800ED3E + bl rfu_REQ_recvData + bl rfu_waitREQComplete + ldr r1, =gUnknown_03007870 + ldr r3, =gUnknown_03005000 + ldr r0, =0x00000c3e + adds r4, r3, r0 + ldrb r0, [r4] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + ldrb r0, [r0, 0x12] + cmp r0, 0 + beq _0800ED9A + movs r2, 0xCD + lsls r2, 4 + adds r1, r3, r2 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r1, 0x92 + lsls r1, 1 + adds r0, r3, r1 + ldr r2, =0x00000c3f + adds r1, r3, r2 + bl sub_800D7D8 + ldr r1, =gUnknown_02022B44 + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] + bl sub_800F048 + ldrb r0, [r4] + bl rfu_UNI_readySendData + ldrb r0, [r4] + bl rfu_UNI_clearRecvNewDataFlag +_0800ED9A: + movs r0, 0x1 + bl rfu_REQ_sendData_wrapper + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800ED34 + + thumb_func_start sub_800EDBC +sub_800EDBC: @ 800EDBC + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000cdb + adds r0, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] + bx lr + .pool + thumb_func_end sub_800EDBC + + thumb_func_start sub_800EDD4 +sub_800EDD4: @ 800EDD4 + push {r4-r6,lr} + bl sub_800C048 + ldr r4, =gUnknown_03005000 + ldrb r0, [r4, 0xC] + cmp r0, 0x1 + bne _0800EDF0 + ldr r0, =sub_800E748 + b _0800EDF6 + .pool +_0800EDF0: + cmp r0, 0 + bne _0800EE18 + ldr r0, =sub_800E94C +_0800EDF6: + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0800EE38 + adds r0, r4, 0 + adds r0, 0x67 + ldrb r0, [r0] + bl DestroyTask + bl sub_800E604 + b _0800EE38 + .pool +_0800EE18: + cmp r0, 0x2 + bne _0800EE38 + ldr r0, =sub_800EB44 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0800EE38 + adds r0, r4, 0 + adds r0, 0x67 + ldrb r0, [r0] + bl DestroyTask + bl sub_800E604 +_0800EE38: + movs r5, 0 + ldr r6, =gUnknown_082ED7E0 +_0800EE3C: + lsls r0, r5, 2 + adds r0, r6 + ldr r4, [r0] + adds r0, r4, 0 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0800EE5E + adds r0, r4, 0 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r0, 24 + bl DestroyTask +_0800EE5E: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x2 + bls _0800EE3C + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800EDD4 + + thumb_func_start sub_800EE78 +sub_800EE78: @ 800EE78 + push {lr} + ldr r0, =sub_800E748 + movs r1, 0x1 + bl CreateTask + ldr r1, =gUnknown_03005000 + adds r1, 0x67 + strb r0, [r1] + pop {r0} + bx r0 + .pool + thumb_func_end sub_800EE78 + + thumb_func_start sub_800EE94 +sub_800EE94: @ 800EE94 + push {lr} + ldr r1, =gUnknown_03005000 + ldrh r0, [r1, 0x4] + cmp r0, 0x7 + bne _0800EEB4 + ldr r2, =0x00000ccd + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0 + beq _0800EEB4 + movs r0, 0x1 + b _0800EEB6 + .pool +_0800EEB4: + movs r0, 0 +_0800EEB6: + pop {r1} + bx r1 + thumb_func_end sub_800EE94 + + thumb_func_start sub_800EEBC +sub_800EEBC: @ 800EEBC + push {r4,lr} + ldr r4, =gUnknown_03005000 + ldrh r0, [r4, 0x4] + cmp r0, 0x7 + bne _0800EEF8 + ldr r0, =gUnknown_03007890 + ldr r1, [r0] + ldr r2, =0x00000c3d + adds r0, r4, r2 + ldrb r0, [r0] + lsls r0, 5 + adds r1, r0 + ldrh r0, [r1, 0x14] + movs r1, 0xF0 + bl sub_800C12C + lsls r0, 24 + cmp r0, 0 + bne _0800EEF8 + movs r0, 0x9 + strh r0, [r4, 0x4] + movs r0, 0x1 + b _0800EEFA + .pool +_0800EEF8: + movs r0, 0 +_0800EEFA: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_800EEBC + + thumb_func_start sub_800EF00 +sub_800EF00: @ 800EF00 + push {lr} + ldr r0, =sub_800E94C + movs r1, 0x1 + bl CreateTask + ldr r1, =gUnknown_03005000 + adds r1, 0x67 + strb r0, [r1] + pop {r0} + bx r0 + .pool + thumb_func_end sub_800EF00 + + thumb_func_start sub_800EF1C +sub_800EF1C: @ 800EF1C + push {lr} + ldr r0, =gUnknown_03004140 + ldrb r0, [r0] + cmp r0, 0 + bne _0800EF30 + movs r0, 0 + b _0800EF32 + .pool +_0800EF30: + movs r0, 0x1 +_0800EF32: + pop {r1} + bx r1 + thumb_func_end sub_800EF1C + + thumb_func_start sub_800EF38 +sub_800EF38: @ 800EF38 + ldr r1, =gUnknown_03005000 + movs r0, 0x4 + strh r0, [r1, 0x4] + ldr r0, =gUnknown_03004140 + ldrb r0, [r0] + ldr r2, =0x00000ce7 + adds r1, r2 + strb r0, [r1] + bx lr + .pool + thumb_func_end sub_800EF38 + + thumb_func_start sub_800EF58 +sub_800EF58: @ 800EF58 + push {lr} + adds r1, r0, 0 + ldr r2, =gUnknown_03005000 + ldrh r0, [r2, 0x4] + cmp r0, 0x11 + beq _0800EF68 + cmp r1, 0 + beq _0800EF74 +_0800EF68: + movs r0, 0x12 + strh r0, [r2, 0x4] + movs r0, 0x1 + b _0800EF76 + .pool +_0800EF74: + movs r0, 0 +_0800EF76: + pop {r1} + bx r1 + thumb_func_end sub_800EF58 + + thumb_func_start sub_800EF7C +sub_800EF7C: @ 800EF7C + ldr r1, =gUnknown_03005000 + movs r0, 0xE + strh r0, [r1, 0x4] + bx lr + .pool + thumb_func_end sub_800EF7C + + thumb_func_start sub_800EF88 +sub_800EF88: @ 800EF88 + push {lr} + lsls r0, 24 + lsrs r1, r0, 24 + movs r2, 0 + b _0800EF9A +_0800EF92: + lsrs r1, 1 + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 +_0800EF9A: + cmp r2, 0x3 + bhi _0800EFAC + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0800EF92 + adds r0, r2, 0 + bl rfu_UNI_readySendData +_0800EFAC: + pop {r0} + bx r0 + thumb_func_end sub_800EF88 + + thumb_func_start sub_800EFB0 +sub_800EFB0: @ 800EFB0 + push {r4-r7,lr} + sub sp, 0x4 + movs r2, 0 + ldr r7, =gUnknown_03003090 + ldr r0, =gUnknown_03005000 + adds r6, r7, 0 + ldr r1, =0x00000c87 + adds r5, r0, r1 +_0800EFC0: + movs r3, 0 + lsls r0, r2, 3 + lsls r1, r2, 4 + adds r4, r2, 0x1 + subs r0, r2 + lsls r0, 1 + adds r2, r0, r5 + adds r1, r6 +_0800EFD0: + ldrh r0, [r1] + lsrs r0, 8 + strb r0, [r2, 0x1] + ldrh r0, [r1] + strb r0, [r2] + adds r2, 0x2 + adds r1, 0x2 + adds r3, 0x1 + cmp r3, 0x6 + ble _0800EFD0 + adds r2, r4, 0 + cmp r2, 0x4 + ble _0800EFC0 + movs r0, 0 + mov r1, sp + strh r0, [r1] + ldr r2, =0x01000028 + mov r0, sp + adds r1, r7, 0 + bl CpuSet + add sp, 0x4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800EFB0 + + thumb_func_start sub_800F014 +sub_800F014: @ 800F014 + push {lr} + ldr r3, =gUnknown_03003110 + ldr r2, =gUnknown_03003090 + movs r1, 0x6 +_0800F01C: + ldrh r0, [r3] + strh r0, [r2] + adds r3, 0x2 + adds r2, 0x2 + subs r1, 0x1 + cmp r1, 0 + bge _0800F01C + ldr r1, =gUnknown_03003110 + movs r2, 0 + adds r0, r1, 0 + adds r0, 0xC +_0800F032: + strh r2, [r0] + subs r0, 0x2 + cmp r0, r1 + bge _0800F032 + pop {r0} + bx r0 + .pool + thumb_func_end sub_800F014 + + thumb_func_start sub_800F048 +sub_800F048: @ 800F048 + push {r4,r5,lr} + ldr r4, =gUnknown_03005000 + ldr r0, =0x00000c3c + adds r5, r4, r0 + ldrb r0, [r5] + cmp r0, 0 + beq _0800F07A + ldr r1, =0x00000c1c + adds r0, r4, r1 + adds r1, r4, 0 + adds r1, 0x4C + bl sub_800DAC8 + lsls r0, 24 + lsrs r2, r0, 24 + ldr r1, =0x00000c3a + adds r0, r4, r1 + ldrb r0, [r0] + adds r1, r0, 0 + cmp r1, 0 + bne _0800F076 + ldrb r0, [r5] + strb r1, [r5] +_0800F076: + cmp r2, 0 + bne _0800F09E +_0800F07A: + ldr r5, =gUnknown_03005000 + ldr r1, =0x00000c3c + adds r0, r5, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _0800F09E + ldr r1, =0x000009e8 + adds r0, r5, r1 + adds r4, r5, 0 + adds r4, 0x4C + adds r1, r4, 0 + bl sub_800D9DC + ldr r1, =0x00000c1c + adds r0, r5, r1 + adds r1, r4, 0 + bl sub_800DA68 +_0800F09E: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800F048 + + thumb_func_start sub_800F0B8 +sub_800F0B8: @ 800F0B8 + push {r4,lr} + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x6] + cmp r0, 0 + bne _0800F0CC +_0800F0C4: + movs r0, 0 + b _0800F0EC + .pool +_0800F0CC: + movs r3, 0 + ldr r4, =gUnknown_03003090 +_0800F0D0: + movs r2, 0 + lsls r0, r3, 4 + adds r1, r0, r4 +_0800F0D6: + ldrh r0, [r1] + cmp r0, 0 + bne _0800F0C4 + adds r1, 0x2 + adds r2, 0x1 + cmp r2, 0x6 + ble _0800F0D6 + adds r3, 0x1 + cmp r3, 0x4 + ble _0800F0D0 + movs r0, 0x1 +_0800F0EC: + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800F0B8 + + thumb_func_start sub_800F0F8 +sub_800F0F8: @ 800F0F8 + push {r4-r6,lr} + ldr r6, =gUnknown_03005000 + ldrh r0, [r6, 0x4] + cmp r0, 0x13 + bhi _0800F118 + bl rfu_REQ_recvData + bl rfu_waitREQComplete + movs r0, 0 + bl rfu_REQ_sendData_wrapper + b _0800F1D2 + .pool +_0800F118: + ldr r0, =0x00000cdb + adds r1, r6, r0 + ldrb r0, [r1] + movs r0, 0 + strb r0, [r1] + ldr r0, =0x00000ce2 + adds r1, r6, r0 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r1] + ldrb r0, [r0, 0x2] + ands r0, r1 + cmp r0, r1 + bne _0800F1D2 + cmp r0, 0 + beq _0800F1D2 + ldr r1, =0x00000cdc + adds r0, r6, r1 + ldrb r0, [r0] + adds r5, r0, 0 + cmp r5, 0 + bne _0800F1C8 + ldr r0, =0x00000ce3 + adds r4, r6, r0 + ldrb r0, [r4] + cmp r0, 0 + beq _0800F1A8 + bl sub_8011D6C + strb r5, [r4] + ldr r1, =0x00000ce4 + adds r0, r6, r1 + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800F18C + movs r4, 0x80 + lsls r4, 8 + movs r0, 0x2 + adds r1, r4, 0 + bl sub_8011A64 + adds r0, r4, 0 + bl sub_8011170 + b _0800F1D2 + .pool +_0800F18C: + ldr r0, =gUnknown_03004140 + ldrb r4, [r0] + cmp r4, 0 + bne _0800F1A8 + bl sub_800EDD4 + ldr r0, =gReceivedRemoteLinkPlayers + strb r4, [r0] + b _0800F1D2 + .pool +_0800F1A8: + bl sub_800EFB0 + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000cda + adds r0, r1 + ldrb r0, [r0] + bl rfu_UNI_readySendData + movs r0, 0x1 + bl rfu_REQ_sendData_wrapper + b _0800F1CC + .pool +_0800F1C8: + bl rfu_REQ_PARENT_resumeRetransmitAndChange +_0800F1CC: + ldr r1, =gUnknown_03005000 + movs r0, 0x1 + strb r0, [r1, 0xE] +_0800F1D2: + movs r0, 0 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800F0F8 + + thumb_func_start sub_800F1E0 +sub_800F1E0: @ 800F1E0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + ldr r0, =gUnknown_03005000 + ldrh r1, [r0, 0x4] + adds r6, r0, 0 + cmp r1, 0x13 + bhi _0800F1F8 + b _0800F45A +_0800F1F8: + ldrb r0, [r6, 0xE] + cmp r0, 0x1 + beq _0800F200 + b _0800F45A +_0800F200: + bl rfu_waitREQComplete + ldr r0, =0x00000cdb + adds r2, r6, r0 + ldrb r0, [r2] + cmp r0, 0 + bne _0800F220 + adds r1, r6, 0 + adds r1, 0xEE +_0800F212: + ldrb r0, [r1] + cmp r0, 0 + beq _0800F21A + b _0800F480 +_0800F21A: + ldrb r0, [r2] + cmp r0, 0 + beq _0800F212 +_0800F220: + bl rfu_REQ_recvData + bl rfu_waitREQComplete + ldr r2, =gUnknown_03004140 + ldr r4, =gUnknown_03005000 + ldr r1, =0x00000ce2 + adds r0, r4, r1 + ldrb r1, [r2, 0x3] + ldrb r0, [r0] + ands r1, r0 + cmp r1, r0 + beq _0800F23C + b _0800F444 +_0800F23C: + ldr r6, =0x00000cdc + adds r1, r4, r6 + ldrb r0, [r1] + movs r0, 0 + strb r0, [r1] + ldr r1, =gUnknown_02022B44 + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] + ldrb r7, [r2] + movs r5, 0 +_0800F252: + movs r0, 0x1 + ands r0, r7 + lsrs r1, r7, 1 + str r1, [sp, 0x4] + adds r2, r5, 0x1 + str r2, [sp] + cmp r0, 0 + bne _0800F264 + b _0800F364 +_0800F264: + ldr r1, =gUnknown_03005000 + lsls r2, r5, 3 + subs r0, r2, r5 + lsls r4, r0, 1 + adds r0, r1, 0 + adds r0, 0x15 + adds r0, r4, r0 + ldrb r0, [r0] + adds r6, r1, 0 + adds r3, r2, 0 + lsls r1, r5, 24 + mov r10, r1 + cmp r0, 0 + beq _0800F35C + ldr r2, =0x00000cee + adds r0, r6, r2 + adds r1, r5, r0 + ldrb r0, [r1] + cmp r0, 0xFF + beq _0800F2E0 + adds r0, r6, 0 + adds r0, 0x14 + adds r0, r4, r0 + ldrb r2, [r0] + lsrs r2, 5 + ldrb r0, [r1] + adds r0, 0x1 + movs r1, 0x7 + ands r0, r1 + cmp r2, r0 + beq _0800F2E0 + ldr r0, =0x00000cea + adds r1, r6, r0 + adds r1, r5, r1 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x4 + bls _0800F35C + movs r0, 0x81 + lsls r0, 8 + bl sub_8011170 + b _0800F35C + .pool +_0800F2E0: + ldr r2, =gUnknown_03005000 + ldr r6, =0x00000cee + adds r1, r2, r6 + adds r1, r5, r1 + subs r3, r5 + lsls r3, 1 + adds r4, r2, 0 + adds r4, 0x14 + adds r2, r3, r4 + ldrb r0, [r2] + lsrs r0, 5 + strb r0, [r1] + ldr r1, =gUnknown_03005000 + subs r6, 0x4 + adds r0, r1, r6 + adds r0, r5, r0 + movs r1, 0 + strb r1, [r0] + ldrb r1, [r2] + movs r0, 0x1F + ands r0, r1 + strb r0, [r2] + ldr r2, =gUnknown_03005CDE + adds r0, r5, r2 + ldrb r0, [r0] + movs r6, 0 + lsls r1, r5, 24 + mov r10, r1 + lsrs r2, r7, 1 + str r2, [sp, 0x4] + adds r5, 0x1 + str r5, [sp] + ldr r1, =gUnknown_03003090 + mov r9, r1 + adds r5, r3, 0 + adds r7, r4, 0 + lsls r0, 4 + mov r8, r0 + adds r2, r5, 0x1 + mov r12, r2 +_0800F330: + lsls r1, r6, 1 + mov r0, r8 + adds r4, r1, r0 + add r4, r9 + mov r2, r12 + adds r3, r1, r2 + adds r3, r7 + ldrb r2, [r3] + lsls r2, 8 + adds r1, r5 + adds r1, r7 + ldrb r0, [r1] + orrs r0, r2 + strh r0, [r4] + movs r0, 0 + strb r0, [r3] + strb r0, [r1] + adds r0, r6, 0x1 + lsls r0, 16 + lsrs r6, r0, 16 + cmp r6, 0x6 + bls _0800F330 +_0800F35C: + mov r1, r10 + lsrs r0, r1, 24 + bl rfu_UNI_clearRecvNewDataFlag +_0800F364: + ldr r2, [sp, 0x4] + lsls r0, r2, 16 + lsrs r7, r0, 16 + ldr r6, [sp] + lsls r0, r6, 16 + lsrs r5, r0, 16 + cmp r5, 0x3 + bhi _0800F376 + b _0800F252 +_0800F376: + bl sub_800F014 + movs r0, 0 + bl sub_800F86C + bl sub_8010528 + ldr r4, =gUnknown_03005000 + ldr r1, =0x00000ce5 + adds r0, r4, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0800F452 + ldr r2, =0x00000cd9 + adds r0, r4, r2 + ldrb r2, [r0] + cmp r2, 0 + bne _0800F452 + ldr r0, =gUnknown_02022B44 + ldrb r1, [r0, 0xE] + strb r2, [r0, 0xE] + ldr r6, =0x00000cda + adds r0, r4, r6 + ldrb r1, [r0] + movs r0, 0x3 + bl rfu_clearSlot + movs r5, 0 + adds r7, r4, 0 + adds r7, 0x14 +_0800F3B2: + ldr r0, =0x00000ce5 + adds r6, r4, r0 + ldrb r0, [r6] + asrs r0, r5 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0800F3D6 + lsls r1, r5, 24 + lsrs r1, 24 + lsls r2, r5, 3 + subs r2, r5 + lsls r2, 1 + adds r2, r7 + movs r0, 0x10 + movs r3, 0xE + bl rfu_setRecvBuffer +_0800F3D6: + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0x3 + bls _0800F3B2 + subs r4, r6, 0x3 + ldrb r0, [r4] + ldrb r2, [r6] + adds r1, r0, 0 + orrs r1, r2 + bl sub_800E88C + ldrb r1, [r6] + movs r2, 0 + strb r1, [r6, 0x4] + ldrb r0, [r4] + orrs r0, r1 + strb r0, [r4] + strb r2, [r6] + ldrb r0, [r4] + adds r1, r6, 0 + subs r1, 0x5E + movs r2, 0x46 + bl rfu_UNI_setSendData + ldrb r0, [r4] + bl sub_800E87C + adds r1, r6, 0 + subs r1, 0xB + strb r0, [r1] + ldr r0, =sub_8010AAC + movs r1, 0 + bl CreateTask + b _0800F452 + .pool +_0800F444: + ldr r2, =0x00000cdc + adds r1, r4, r2 + ldrb r0, [r1] + movs r2, 0 + movs r0, 0x1 + strb r0, [r1] + strb r2, [r4, 0xE] +_0800F452: + ldr r1, =gUnknown_03005000 + movs r0, 0 + strb r0, [r1, 0xE] + adds r6, r1, 0 +_0800F45A: + ldr r1, =0x00000cdc + adds r0, r6, r1 + ldrb r0, [r0] + adds r1, r0, 0 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x6] + cmp r0, 0 + beq _0800F484 + movs r0, 0x1 + ands r0, r1 + b _0800F486 + .pool +_0800F480: + movs r0, 0 + b _0800F486 +_0800F484: + movs r0, 0 +_0800F486: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800F1E0 + + thumb_func_start sub_800F498 +sub_800F498: @ 800F498 + push {r4,r5,lr} + adds r4, r0, 0 + adds r2, r1, 0 + ldrh r1, [r4] + cmp r1, 0 + beq _0800F4DC + ldr r0, =gUnknown_03005000 + movs r5, 0x81 + lsls r5, 1 + adds r3, r0, r5 + ldrb r0, [r3] + lsls r0, 5 + orrs r0, r1 + strh r0, [r4] + ldrb r0, [r3] + adds r0, 0x1 + movs r1, 0x7 + ands r0, r1 + strb r0, [r3] + adds r3, r4, 0 + movs r4, 0x6 +_0800F4C2: + ldrh r1, [r3] + lsrs r0, r1, 8 + strb r0, [r2, 0x1] + strb r1, [r2] + adds r2, 0x2 + adds r3, 0x2 + subs r4, 0x1 + cmp r4, 0 + bge _0800F4C2 + b _0800F4EA + .pool +_0800F4DC: + movs r1, 0 + adds r0, r2, 0 + adds r0, 0xD +_0800F4E2: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r2 + bge _0800F4E2 +_0800F4EA: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_800F498 + + thumb_func_start sub_800F4F0 +sub_800F4F0: @ 800F4F0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x58 + ldr r0, =gUnknown_03005124 + mov r1, sp + bl sub_800D934 + movs r1, 0 + ldr r0, =gUnknown_03003090 + mov r12, r0 +_0800F506: + movs r4, 0 + lsls r0, r1, 3 + adds r2, r1, 0x1 + mov r8, r2 + lsls r6, r1, 4 + subs r0, r1 + lsls r5, r0, 1 +_0800F514: + lsls r1, r4, 1 + adds r3, r1, r6 + add r3, r12 + adds r1, r5, r1 + adds r0, r1, 0x1 + add r0, sp + ldrb r2, [r0] + lsls r2, 8 + mov r7, sp + adds r0, r7, r1 + ldrb r0, [r0] + orrs r0, r2 + strh r0, [r3] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x6 + bls _0800F514 + mov r1, r8 + lsls r0, r1, 24 + lsrs r1, r0, 24 + cmp r1, 0x4 + bls _0800F506 + movs r0, 0 + bl sub_800F86C + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x2] + cmp r0, 0 + bne _0800F5C0 + ldr r0, =gUnknown_03005000 + ldr r2, =0x00000ce4 + adds r0, r2 + ldrb r0, [r0] + cmp r0, 0 + beq _0800F5C0 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x2] + ldrb r0, [r0, 0x3] + orrs r0, r1 + bl rfu_REQ_disconnect + bl rfu_waitREQComplete + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _0800F58C + cmp r0, 0x6 + beq _0800F58C + cmp r0, 0x9 + beq _0800F58C + movs r1, 0x90 + lsls r1, 8 + movs r0, 0x2 + bl sub_8011A64 +_0800F58C: + bl rfu_clearAllSlot + ldr r1, =gReceivedRemoteLinkPlayers + movs r0, 0 + strb r0, [r1] + ldr r0, =gUnknown_03005000 + movs r5, 0 + str r5, [r0] + ldr r7, =0x00000ce4 + adds r6, r0, r7 + ldrb r0, [r6] + cmp r0, 0x1 + bne _0800F5B8 + movs r4, 0x90 + lsls r4, 8 + movs r0, 0x2 + adds r1, r4, 0 + bl sub_8011A64 + adds r0, r4, 0 + bl sub_8011170 +_0800F5B8: + ldr r0, =gUnknown_03004140 + strb r5, [r0, 0x5] + strb r5, [r0, 0x4] + strb r5, [r6] +_0800F5C0: + ldr r6, =gUnknown_03005000 + movs r0, 0xCD + lsls r0, 4 + adds r2, r6, r0 + ldrb r0, [r2] + cmp r0, 0 + beq _0800F604 + ldrb r0, [r2] + subs r0, 0x1 + ldrb r1, [r2] + strb r0, [r2] + bl sub_8010528 + ldr r5, =gUnknown_03003110 + add r4, sp, 0x48 + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_800F498 + ldr r1, =0x000009e8 + adds r0, r6, r1 + adds r1, r4, 0 + bl sub_800D888 + movs r1, 0 + movs r2, 0 +_0800F5F4: + lsls r0, r1, 1 + adds r0, r5 + strh r2, [r0] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x6 + bls _0800F5F4 +_0800F604: + bl sub_800F0B8 + add sp, 0x58 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800F4F0 + + thumb_func_start sub_800F638 +sub_800F638: @ 800F638 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + ldr r0, =gUnknown_03005000 + ldr r2, [r0, 0x70] + mov r10, r2 + movs r5, 0 + adds r2, r0, 0 + adds r2, 0x6E + ldrh r3, [r2] + cmp r5, r3 + bge _0800F6D4 + mov r9, r0 + ldr r0, =gUnknown_03000D90 + mov r8, r0 +_0800F65A: + movs r0, 0x1 + ands r0, r1 + lsrs r7, r1, 1 + adds r6, r5, 0x1 + cmp r0, 0 + bne _0800F6C8 + ldr r1, =0xffff8900 + adds r0, r1, 0 + adds r1, r5, 0 + orrs r1, r0 + mov r2, r8 + strh r1, [r2] + movs r4, 0 + lsls r0, r5, 1 + ldr r3, =gUnknown_03000D80 + mov r12, r3 + adds r0, r5 + lsls r0, 2 + mov r1, r10 + adds r2, r0, r1 + mov r3, r8 + adds r3, 0x2 +_0800F686: + ldrb r1, [r2, 0x1] + lsls r1, 8 + ldrb r0, [r2] + orrs r0, r1 + strh r0, [r3] + adds r2, 0x2 + adds r3, 0x2 + adds r4, 0x1 + cmp r4, 0x6 + ble _0800F686 + movs r4, 0 + ldr r2, =gUnknown_03000D90 + ldr r1, =gUnknown_03000D80 +_0800F6A0: + ldrh r0, [r2] + lsrs r0, 8 + strb r0, [r1, 0x1] + ldrh r0, [r2] + strb r0, [r1] + adds r2, 0x2 + adds r1, 0x2 + adds r4, 0x1 + cmp r4, 0x6 + ble _0800F6A0 + ldr r0, =gUnknown_030059E8 + mov r1, r12 + bl sub_800D888 + movs r1, 0x1 + lsls r1, r5 + mov r2, r9 + ldr r0, [r2, 0x78] + orrs r0, r1 + str r0, [r2, 0x78] +_0800F6C8: + adds r1, r7, 0 + adds r5, r6, 0 + ldr r3, =gUnknown_0300506E + ldrh r3, [r3] + cmp r5, r3 + blt _0800F65A +_0800F6D4: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800F638 + + thumb_func_start sub_800F6FC +sub_800F6FC: @ 800F6FC + push {lr} + lsls r0, 24 + lsrs r1, r0, 24 + ldr r0, =gUnknown_03005000 + ldrb r2, [r0, 0xC] + cmp r2, 0x1 + bne _0800F71C + cmp r1, 0 + beq _0800F71C + adds r0, 0x61 + adds r0, r1, r0 + strb r2, [r0] + b _0800F724 + .pool +_0800F71C: + adds r0, 0x5C + adds r0, r1, r0 + movs r1, 0x1 + strb r1, [r0] +_0800F724: + pop {r0} + bx r0 + thumb_func_end sub_800F6FC + + thumb_func_start sub_800F728 +sub_800F728: @ 800F728 + lsls r0, 24 + lsrs r0, 24 + ldr r3, =gUnknown_03005000 + adds r1, r3, 0 + adds r1, 0x5C + adds r1, r0, r1 + movs r2, 0 + strb r2, [r1] + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 2 + adds r1, r3 + adds r1, 0x92 + strb r2, [r1] + bx lr + .pool + thumb_func_end sub_800F728 + + thumb_func_start sub_800F74C +sub_800F74C: @ 800F74C + push {r4,r5,lr} + adds r3, r0, 0 + ldr r0, =gUnknown_03005000 + ldrb r1, [r0, 0xC] + adds r5, r0, 0 + cmp r1, 0x1 + bne _0800F764 + movs r0, 0 + b _0800F786 + .pool +_0800F764: + movs r2, 0 + ldr r0, =0x00000cde + adds r4, r5, r0 +_0800F76A: + adds r1, r2, r4 + adds r0, r3, r2 + ldrb r0, [r0] + strb r0, [r1] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800F76A + ldr r1, =0x00000c3e + adds r0, r5, r1 + ldrb r0, [r0] + adds r0, r3 + ldrb r0, [r0] +_0800F786: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800F74C + + thumb_func_start rfu_func_080F97B8 +rfu_func_080F97B8: @ 800F794 + push {lr} + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _0800F7C6 + ldr r3, =gUnknown_03005DA8 + ldrh r2, [r3] + cmp r2, 0 + beq _0800F7C6 + ldr r0, =gUnknown_030022B4 + ldrb r0, [r0] + cmp r0, 0x1 + beq _0800F7C6 + ldr r1, =gUnknown_03000D78 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + ldrb r0, [r1] + lsls r0, 8 + orrs r0, r2 + strh r0, [r3] + movs r0, 0xBE + lsls r0, 8 + bl sub_800FD14 +_0800F7C6: + pop {r0} + bx r0 + .pool + thumb_func_end rfu_func_080F97B8 + + thumb_func_start sub_800F7DC +sub_800F7DC: @ 800F7DC + ldr r0, =gUnknown_02022B14 + bx lr + .pool + thumb_func_end sub_800F7DC + + thumb_func_start sub_800F7E4 +sub_800F7E4: @ 800F7E4 + push {lr} + movs r2, 0 + ldr r0, =gUnknown_03005000 + ldr r1, [r0] + ldr r0, =rfu_func_080F97B8 + cmp r1, r0 + bne _0800F7F4 + movs r2, 0x1 +_0800F7F4: + adds r0, r2, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_800F7E4 + + thumb_func_start sub_800F804 +sub_800F804: @ 800F804 + ldr r1, =gUnknown_03005000 + ldr r0, =rfu_func_080F97B8 + str r0, [r1] + bx lr + .pool + thumb_func_end sub_800F804 + + thumb_func_start Rfu_set_zero +Rfu_set_zero: @ 800F814 + ldr r1, =gUnknown_03005000 + movs r0, 0 + str r0, [r1] + bx lr + .pool + thumb_func_end Rfu_set_zero + + thumb_func_start sub_800F820 +sub_800F820: @ 800F820 + push {lr} + movs r0, 0x88 + lsls r0, 7 + bl sub_800FD14 + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + bne _0800F83C + bl sub_8082D18 + ldr r1, =gUnknown_03003110 + strh r0, [r1, 0xC] +_0800F83C: + ldr r1, =gUnknown_020223C0 + ldr r0, [r1] + adds r0, 0x1 + str r0, [r1] + pop {r0} + bx r0 + .pool + thumb_func_end sub_800F820 + + thumb_func_start sub_800F850 +sub_800F850: @ 800F850 + push {lr} + ldr r1, =gUnknown_03005000 + ldr r0, [r1] + cmp r0, 0 + bne _0800F85E + ldr r0, =sub_800F820 + str r0, [r1] +_0800F85E: + pop {r0} + bx r0 + .pool + thumb_func_end sub_800F850 + + thumb_func_start sub_800F86C +sub_800F86C: @ 800F86C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + movs r0, 0 + mov r8, r0 +_0800F87A: + mov r1, r8 + lsls r0, r1, 4 + ldr r2, =gUnknown_03003090 + adds r1, r0, r2 + ldrh r7, [r1] + movs r3, 0xFF + lsls r3, 8 + adds r1, r3, 0 + ands r1, r7 + movs r2, 0x88 + lsls r2, 8 + adds r5, r0, 0 + cmp r1, r2 + beq _0800F960 + cmp r1, r2 + bgt _0800F8D6 + movs r0, 0xCC + lsls r0, 7 + cmp r1, r0 + bne _0800F8A4 + b _0800FAE0 +_0800F8A4: + cmp r1, r0 + bgt _0800F8C4 + movs r0, 0x88 + lsls r0, 7 + cmp r1, r0 + bne _0800F8B2 + b _0800FBF4 +_0800F8B2: + movs r0, 0xBE + lsls r0, 7 + cmp r1, r0 + bne _0800F8BC + b _0800FAD0 +_0800F8BC: + b _0800FC04 + .pool +_0800F8C4: + movs r0, 0xEE + lsls r0, 7 + cmp r1, r0 + beq _0800F920 + movs r0, 0xF0 + lsls r0, 7 + cmp r1, r0 + beq _0800F90E + b _0800FC04 +_0800F8D6: + movs r0, 0xBE + lsls r0, 8 + cmp r1, r0 + bne _0800F8E0 + b _0800FBF4 +_0800F8E0: + cmp r1, r0 + bgt _0800F8F8 + movs r0, 0x89 + lsls r0, 8 + cmp r1, r0 + beq _0800F9C8 + movs r0, 0xA1 + lsls r0, 8 + cmp r1, r0 + bne _0800F8F6 + b _0800FAAC +_0800F8F6: + b _0800FC04 +_0800F8F8: + movs r0, 0xED + lsls r0, 8 + cmp r1, r0 + bne _0800F902 + b _0800FB10 +_0800F902: + movs r0, 0xEE + lsls r0, 8 + cmp r1, r0 + bne _0800F90C + b _0800FBB0 +_0800F90C: + b _0800FC04 +_0800F90E: + ldr r4, =gUnknown_03005000 + ldrb r0, [r4, 0xC] + cmp r0, 0 + bne _0800F920 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _0800F920 + b _0800FC50 +_0800F920: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + mov r6, r8 + adds r6, 0x1 + cmp r0, 0 + beq _0800F930 + b _0800FC08 +_0800F930: + ldr r1, =gUnknown_03003090+0x2 + adds r0, r5, r1 + ldrh r0, [r0] + ldr r2, =gUnknown_03005000 + strb r0, [r2, 0xD] + ldr r3, =gUnknown_03003090+0x4 + adds r0, r5, r3 + bl sub_800F74C + ldr r4, =gUnknown_03005CCE + strb r0, [r4] + b _0800FC08 + .pool +_0800F960: + ldr r0, =gUnknown_03005000 + mov r9, r0 + mov r1, r8 + lsls r0, r1, 2 + add r0, r8 + lsls r7, r0, 2 + mov r2, r9 + adds r3, r7, r2 + movs r4, 0x92 + adds r4, r3 + mov r12, r4 + ldrb r4, [r4] + mov r6, r8 + adds r6, 0x1 + cmp r4, 0 + beq _0800F982 + b _0800FC08 +_0800F982: + adds r0, r3, 0 + adds r0, 0x80 + movs r2, 0 + strh r4, [r0] + ldr r1, =gUnknown_03003090+0x2 + adds r0, r5, r1 + ldrh r0, [r0] + adds r1, r3, 0 + adds r1, 0x82 + strh r0, [r1] + ldr r1, =gUnknown_03003090+0x4 + adds r0, r5, r1 + ldrh r1, [r0] + adds r0, r3, 0 + adds r0, 0x91 + strb r1, [r0] + mov r0, r9 + adds r0, 0x88 + adds r0, r7, r0 + str r4, [r0] + movs r0, 0x1 + mov r3, r12 + strb r0, [r3] + mov r0, r9 + adds r0, 0x5C + add r0, r8 + strb r2, [r0] + b _0800FC08 + .pool +_0800F9C8: + ldr r4, =gUnknown_03005000 + mov r9, r4 + mov r0, r8 + lsls r1, r0, 2 + adds r0, r1, r0 + lsls r4, r0, 2 + mov r3, r9 + adds r2, r4, r3 + adds r0, r2, 0 + adds r0, 0x92 + ldrb r3, [r0] + mov r10, r1 + mov r6, r8 + adds r6, 0x1 + cmp r3, 0x1 + beq _0800F9EA + b _0800FC08 +_0800F9EA: + movs r0, 0xFF + ands r0, r7 + adds r2, 0x80 + strh r0, [r2] + mov r1, r9 + adds r1, 0x88 + adds r1, r4, r1 + lsls r3, r0 + ldr r0, [r1] + orrs r0, r3 + str r0, [r1] + movs r4, 0 + ldr r0, =gBlockRecvBuffer + mov r9, r0 + mov r12, r2 + mov r1, r8 + lsls r7, r1, 8 + adds r3, r5, 0 +_0800FA0E: + mov r2, r12 + ldrh r0, [r2] + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 1 + adds r1, r4 + lsls r1, 1 + adds r1, r7 + add r1, r9 + adds r2, r4, 0x1 + lsls r0, r2, 1 + adds r0, r3 + ldr r4, =gUnknown_03003090 + adds r0, r4 + ldrh r0, [r0] + strh r0, [r1] + lsls r2, 16 + lsrs r4, r2, 16 + cmp r4, 0x5 + bls _0800FA0E + ldr r4, =gUnknown_03005000 + mov r0, r10 + add r0, r8 + lsls r0, 2 + adds r1, r4, 0 + adds r1, 0x88 + adds r1, r0, r1 + adds r2, r0, r4 + adds r0, r2, 0 + adds r0, 0x82 + ldrh r0, [r0] + lsls r0, 2 + ldr r3, =gUnknown_082ED628 + adds r0, r3 + ldr r1, [r1] + ldr r0, [r0] + cmp r1, r0 + beq _0800FA5C + b _0800FC08 +_0800FA5C: + adds r1, r2, 0 + adds r1, 0x92 + movs r0, 0x2 + strb r0, [r1] + mov r1, r8 + lsls r0, r1, 24 + lsrs r0, 24 + bl sub_800F6FC + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r0, 0x7F + ands r0, r1 + cmp r0, 0x45 + beq _0800FA7E + b _0800FC08 +_0800FA7E: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0800FA88 + b _0800FC08 +_0800FA88: + ldrb r0, [r4, 0xC] + cmp r0, 0 + beq _0800FA90 + b _0800FC08 +_0800FA90: + ldr r0, =gBlockRecvBuffer + bl sub_8010A70 + b _0800FC08 + .pool +_0800FAAC: + ldr r2, =gUnknown_082ED6B8 + ldr r3, =gUnknown_03003090+0x2 + adds r0, r5, r3 + ldrh r1, [r0] + lsls r1, 3 + adds r0, r1, r2 + ldr r0, [r0] + adds r2, 0x4 + adds r1, r2 + ldrh r1, [r1] + bl sub_800FE84 + b _0800FC04 + .pool +_0800FAD0: + ldr r1, =gUnknown_030050E4 + add r1, r8 + movs r0, 0x1 + strb r0, [r1] + b _0800FC04 + .pool +_0800FAE0: + ldr r2, =gUnknown_03005000 + movs r4, 0x80 + lsls r4, 1 + adds r0, r2, r4 + ldr r3, =gUnknown_03003090+0x2 + adds r1, r5, r3 + ldrh r0, [r0] + mov r6, r8 + adds r6, 0x1 + ldrh r1, [r1] + cmp r0, r1 + beq _0800FAFA + b _0800FC08 +_0800FAFA: + adds r0, r2, 0 + adds r0, 0xE9 + add r0, r8 + movs r1, 0x1 + strb r1, [r0] + b _0800FC08 + .pool +_0800FB10: + ldr r7, =gUnknown_03005000 + ldrb r2, [r7, 0xC] + cmp r2, 0 + bne _0800FB78 + ldr r3, =gReceivedRemoteLinkPlayers + ldrb r0, [r3] + mov r6, r8 + adds r6, 0x1 + cmp r0, 0 + beq _0800FC08 + ldr r0, =gUnknown_03003090+0x2 + adds r4, r5, r0 + ldrh r1, [r4] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x2] + ands r1, r0 + cmp r1, 0 + beq _0800FB48 + strb r2, [r3] + bl sub_800D630 + ldr r1, =gUnknown_03003090+0x4 + adds r0, r5, r1 + ldrh r1, [r0] + ldr r2, =0x00000ce4 + adds r0, r7, r2 + strb r1, [r0] +_0800FB48: + ldr r0, =gUnknown_03003090 + adds r0, 0x6 + adds r0, r5, r0 + ldrh r0, [r0] + strb r0, [r7, 0xD] + ldrh r0, [r4] + bl sub_80109E8 + b _0800FC08 + .pool +_0800FB78: + movs r0, 0xEE + lsls r0, 8 + bl sub_800FD14 + ldr r1, =gUnknown_03003110 + ldr r3, =gUnknown_03003090+0x2 + adds r0, r5, r3 + ldrh r0, [r0] + strh r0, [r1, 0x2] + ldr r4, =gUnknown_03003090+0x4 + adds r0, r5, r4 + ldrh r0, [r0] + strh r0, [r1, 0x4] + ldr r0, =gUnknown_03003090 + adds r0, 0x6 + adds r0, r5, r0 + ldrh r0, [r0] + strh r0, [r1, 0x6] + b _0800FC04 + .pool +_0800FBB0: + ldr r4, =gUnknown_03005000 + ldrb r0, [r4, 0xC] + mov r6, r8 + adds r6, 0x1 + cmp r0, 0x1 + bne _0800FC44 + ldr r0, =0x00000ce3 + adds r2, r4, r0 + ldr r1, =gUnknown_03003090+0x2 + adds r3, r5, r1 + ldrb r1, [r3] + ldrb r0, [r2] + orrs r0, r1 + strb r0, [r2] + ldr r2, =gUnknown_03003090+0x4 + adds r0, r5, r2 + ldrh r1, [r0] + ldr r2, =0x00000ce4 + adds r0, r4, r2 + strb r1, [r0] + ldrh r0, [r3] + bl sub_80109E8 + b _0800FC08 + .pool +_0800FBF4: + ldr r0, =gUnknown_03003020 + mov r3, r8 + lsls r1, r3, 1 + adds r1, r0 + ldr r4, =gUnknown_03003090+0x2 + adds r0, r5, r4 + ldrh r0, [r0] + strh r0, [r1] +_0800FC04: + mov r6, r8 + adds r6, 0x1 +_0800FC08: + ldr r3, =gUnknown_03005000 + ldrb r4, [r3, 0xC] + cmp r4, 0x1 + bne _0800FC44 + adds r0, r3, 0 + adds r0, 0x61 + mov r1, r8 + adds r2, r1, r0 + ldrb r0, [r2] + adds r1, r0, 0 + cmp r1, 0 + beq _0800FC44 + cmp r1, 0x4 + bne _0800FC40 + adds r0, r3, 0 + adds r0, 0x5C + add r0, r8 + movs r1, 0 + strb r4, [r0] + strb r1, [r2] + b _0800FC44 + .pool +_0800FC40: + adds r0, 0x1 + strb r0, [r2] +_0800FC44: + lsls r0, r6, 16 + lsrs r0, 16 + mov r8, r0 + cmp r0, 0x4 + bhi _0800FC50 + b _0800F87A +_0800FC50: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800F86C + + thumb_func_start sub_800FC60 +sub_800FC60: @ 800FC60 + push {lr} + movs r2, 0 + ldr r0, =gUnknown_03005000 + adds r1, r0, 0 + adds r1, 0x92 +_0800FC6A: + ldrb r0, [r1] + cmp r0, 0 + beq _0800FC78 + movs r0, 0 + b _0800FC82 + .pool +_0800FC78: + adds r1, 0x14 + adds r2, 0x1 + cmp r2, 0x4 + ble _0800FC6A + movs r0, 0x1 +_0800FC82: + pop {r1} + bx r1 + thumb_func_end sub_800FC60 + + thumb_func_start sub_800FC88 +sub_800FC88: @ 800FC88 + push {r4,lr} + movs r1, 0 + ldr r2, =gUnknown_03005000 + ldrb r0, [r2, 0xD] + cmp r1, r0 + bge _0800FCBC + adds r4, r0, 0 + adds r3, r2, 0 + adds r3, 0x92 + adds r2, 0x5C +_0800FC9C: + ldrb r0, [r3] + cmp r0, 0x2 + bne _0800FCAA + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x1 + beq _0800FCB4 +_0800FCAA: + movs r0, 0 + b _0800FCBE + .pool +_0800FCB4: + adds r3, 0x14 + adds r1, 0x1 + cmp r1, r4 + blt _0800FC9C +_0800FCBC: + movs r0, 0x1 +_0800FCBE: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_800FC88 + + thumb_func_start sub_800FCC4 +sub_800FCC4: @ 800FCC4 + movs r2, 0 + movs r1, 0 + strh r1, [r0] + strh r1, [r0, 0x2] + str r1, [r0, 0x4] + str r1, [r0, 0x8] + strb r2, [r0, 0x10] + strb r2, [r0, 0x11] + strb r2, [r0, 0x12] + bx lr + thumb_func_end sub_800FCC4 + + thumb_func_start sub_800FCD8 +sub_800FCD8: @ 800FCD8 + push {r4,lr} + movs r2, 0 + movs r1, 0 + ldr r0, =gUnknown_03005000 + adds r3, r0, 0 + adds r3, 0x92 + adds r4, r0, 0 + adds r4, 0x5C +_0800FCE8: + ldrb r0, [r3] + cmp r0, 0x2 + bne _0800FCFE + adds r0, r1, r4 + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800FCFE + lsls r0, r1 + orrs r2, r0 + lsls r0, r2, 24 + lsrs r2, r0, 24 +_0800FCFE: + adds r3, 0x14 + adds r1, 0x1 + cmp r1, 0x4 + ble _0800FCE8 + adds r0, r2, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800FCD8 + + thumb_func_start sub_800FD14 +sub_800FD14: @ 800FD14 + push {r4,r5,lr} + lsls r0, 16 + lsrs r1, r0, 16 + ldr r5, =gUnknown_03003110 + strh r1, [r5] + movs r0, 0xF0 + lsls r0, 7 + adds r4, r5, 0 + cmp r1, r0 + beq _0800FDB0 + cmp r1, r0 + bgt _0800FD62 + movs r0, 0xBE + lsls r0, 7 + cmp r1, r0 + beq _0800FE00 + cmp r1, r0 + bgt _0800FD50 + movs r0, 0xBC + lsls r0, 6 + cmp r1, r0 + beq _0800FE20 + movs r0, 0x88 + lsls r0, 7 + cmp r1, r0 + beq _0800FE14 + b _0800FE46 + .pool +_0800FD50: + movs r0, 0xCC + lsls r0, 7 + cmp r1, r0 + beq _0800FE00 + movs r0, 0xEE + lsls r0, 7 + cmp r1, r0 + beq _0800FDB0 + b _0800FE46 +_0800FD62: + movs r0, 0xBE + lsls r0, 8 + cmp r1, r0 + beq _0800FE40 + cmp r1, r0 + bgt _0800FE46 + movs r0, 0x88 + lsls r0, 8 + cmp r1, r0 + beq _0800FD80 + movs r0, 0xA1 + lsls r0, 8 + cmp r1, r0 + beq _0800FD98 + b _0800FE46 +_0800FD80: + ldr r0, =gUnknown_03005000 + adds r1, r0, 0 + adds r1, 0x6E + ldrh r1, [r1] + strh r1, [r5, 0x2] + adds r0, 0x7D + ldrb r0, [r0] + adds r0, 0x80 + strh r0, [r5, 0x4] + b _0800FE46 + .pool +_0800FD98: + bl sub_800FC60 + lsls r0, 24 + cmp r0, 0 + beq _0800FE46 + ldr r0, =gUnknown_03005000 + adds r0, 0x5A + ldrb r0, [r0] + b _0800FE44 + .pool +_0800FDB0: + ldr r3, =gUnknown_03005000 + ldr r1, =0x00000ce2 + adds r0, r3, r1 + ldr r2, =0x00000ce3 + adds r1, r3, r2 + ldrb r2, [r0] + ldrb r0, [r1] + eors r0, r2 + ldr r1, =gUnknown_082ED695 + adds r0, r1 + ldrb r0, [r0] + adds r0, 0x1 + strb r0, [r3, 0xD] + ldrb r0, [r3, 0xD] + strh r0, [r4, 0x2] + adds r2, r4, 0x4 + movs r4, 0 + ldr r0, =0x00000cde + adds r3, r0 +_0800FDD6: + adds r1, r2, r4 + adds r0, r4, r3 + ldrb r0, [r0] + strb r0, [r1] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800FDD6 + b _0800FE46 + .pool +_0800FE00: + ldr r0, =gUnknown_03005000 + movs r1, 0x80 + lsls r1, 1 + adds r0, r1 + ldrh r0, [r0] + strh r0, [r4, 0x2] + b _0800FE46 + .pool +_0800FE14: + strh r1, [r5] + ldr r0, =gMain + ldrh r0, [r0, 0x2C] + b _0800FE44 + .pool +_0800FE20: + movs r4, 0 + ldr r3, =gUnknown_030050F2 +_0800FE24: + adds r2, r4, 0x1 + lsls r1, r2, 1 + adds r1, r5 + lsls r0, r4, 1 + adds r0, r3 + ldrh r0, [r0] + strh r0, [r1] + lsls r2, 24 + lsrs r4, r2, 24 + cmp r4, 0x5 + bls _0800FE24 + b _0800FE46 + .pool +_0800FE40: + ldr r0, =gUnknown_03005DA8 + ldrh r0, [r0] +_0800FE44: + strh r0, [r5, 0x2] +_0800FE46: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800FD14 + + thumb_func_start sub_800FE50 +sub_800FE50: @ 800FE50 + push {r4,lr} + adds r4, r0, 0 + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + bne _0800FE76 + bl sub_8011A80 + cmp r0, 0 + bne _0800FE76 + ldr r0, =gUnknown_030050F2 + adds r1, r4, 0 + movs r2, 0xC + bl memcpy + movs r0, 0xBC + lsls r0, 6 + bl sub_800FD14 +_0800FE76: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800FE50 + + thumb_func_start sub_800FE84 +@ bool8 sub_800FE84(u32 a1, u32 size) +sub_800FE84: @ 800FE84 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r7, r0, 0 + adds r6, r1, 0 + ldr r5, =gUnknown_03005000 + ldr r0, [r5] + cmp r0, 0 + bne _0800FEB8 + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + bne _0800FEB8 + movs r0, 0x7C + adds r0, r5 + mov r9, r0 + ldrb r1, [r0] + mov r8, r1 + cmp r1, 0 + beq _0800FEC8 + ldr r1, =gUnknown_02022B44 + adds r1, 0x83 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] +_0800FEB8: + movs r0, 0 + b _0800FF32 + .pool +_0800FEC8: + adds r0, r6, 0 + movs r1, 0xC + bl __umodsi3 + negs r4, r0 + orrs r4, r0 + lsrs r4, 31 + bl GetMultiplayerId + adds r1, r5, 0 + adds r1, 0x7D + strb r0, [r1] + movs r0, 0x1 + mov r1, r9 + strb r0, [r1] + adds r0, r6, 0 + movs r1, 0xC + bl __udivsi3 + adds r0, r4 + adds r1, r5, 0 + adds r1, 0x6E + strh r0, [r1] + adds r0, r5, 0 + adds r0, 0x6C + mov r1, r8 + strh r1, [r0] + movs r0, 0x80 + lsls r0, 1 + cmp r6, r0 + bls _0800FF0A + str r7, [r5, 0x70] + b _0800FF1C +_0800FF0A: + ldr r4, =gUnknown_020228C4 + cmp r7, r4 + beq _0800FF1A + adds r0, r4, 0 + adds r1, r7, 0 + adds r2, r6, 0 + bl memcpy +_0800FF1A: + str r4, [r5, 0x70] +_0800FF1C: + movs r0, 0x88 + lsls r0, 8 + bl sub_800FD14 + ldr r0, =gUnknown_03005000 + ldr r1, =rfufunc_80F9F44 + str r1, [r0] + adds r0, 0x5B + movs r1, 0 + strb r1, [r0] + movs r0, 0x1 +_0800FF32: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800FE84 + + thumb_func_start rfufunc_80F9F44 +rfufunc_80F9F44: @ 800FF4C + push {r4,r5,lr} + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + bne _0800FFA0 + movs r5, 0x88 + lsls r5, 8 + adds r0, r5, 0 + bl sub_800FD14 + ldr r4, =gUnknown_03005000 + ldrb r0, [r4, 0xC] + cmp r0, 0x1 + bne _0800FF84 + adds r1, r4, 0 + adds r1, 0x5B + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bls _0800FFA0 + b _0800FF9C + .pool +_0800FF84: + bl GetMultiplayerId + ldr r1, =gUnknown_03003090 + lsls r0, 24 + lsrs r0, 20 + adds r0, r1 + ldrh r1, [r0] + movs r0, 0xFF + lsls r0, 8 + ands r0, r1 + cmp r0, r5 + bne _0800FFA0 +_0800FF9C: + ldr r0, =sub_800FFB0 + str r0, [r4] +_0800FFA0: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end rfufunc_80F9F44 + + thumb_func_start sub_800FFB0 +sub_800FFB0: @ 800FFB0 + push {r4-r6,lr} + ldr r0, =gUnknown_03005000 + mov r12, r0 + ldr r5, [r0, 0x70] + ldr r3, =gUnknown_03003110 + mov r2, r12 + adds r2, 0x6C + ldrh r1, [r2] + movs r4, 0x89 + lsls r4, 8 + adds r0, r4, 0 + orrs r0, r1 + strh r0, [r3] + movs r4, 0 + adds r6, r2, 0 + adds r3, 0x2 +_0800FFD0: + lsls r2, r4, 1 + ldrh r1, [r6] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, r5 + ldrb r1, [r0, 0x1] + lsls r1, 8 + ldrb r0, [r0] + orrs r0, r1 + strh r0, [r3] + adds r3, 0x2 + adds r4, 0x1 + cmp r4, 0x6 + ble _0800FFD0 + mov r0, r12 + adds r0, 0x6C + ldrh r1, [r0] + adds r1, 0x1 + strh r1, [r0] + adds r0, 0x2 + ldrh r0, [r0] + lsls r1, 16 + lsrs r1, 16 + cmp r0, r1 + bhi _08010014 + mov r0, r12 + adds r0, 0x7C + movs r1, 0 + strb r1, [r0] + ldr r0, =rfufunc_80FA020 + mov r1, r12 + str r0, [r1] +_08010014: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800FFB0 + + thumb_func_start rfufunc_80FA020 +rfufunc_80FA020: @ 8010028 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + ldr r5, =gUnknown_03005000 + ldr r0, [r5, 0x70] + mov r8, r0 + bl GetMultiplayerId + lsls r0, 24 + lsrs r6, r0, 24 + ldrb r0, [r5, 0xC] + cmp r0, 0 + bne _080100F0 + ldr r3, =gUnknown_03003110 + adds r2, r5, 0 + adds r2, 0x6E + ldrh r0, [r2] + subs r0, 0x1 + ldr r4, =0xffff8900 + adds r1, r4, 0 + orrs r0, r1 + strh r0, [r3] + movs r4, 0 + mov r9, r5 + ldr r0, =gUnknown_03003090 + mov r12, r0 + lsls r5, r6, 4 + adds r7, r2, 0 + adds r3, 0x2 +_08010064: + lsls r2, r4, 1 + ldrh r1, [r7] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + add r0, r8 + adds r1, r0, 0 + subs r1, 0xB + ldrb r1, [r1] + lsls r1, 8 + subs r0, 0xC + ldrb r0, [r0] + orrs r0, r1 + strh r0, [r3] + adds r3, 0x2 + adds r4, 0x1 + cmp r4, 0x6 + ble _08010064 + mov r1, r12 + adds r0, r5, r1 + ldrb r1, [r0] + mov r3, r9 + adds r0, r3, 0 + adds r0, 0x6E + ldrh r0, [r0] + subs r0, 0x1 + cmp r1, r0 + bne _080100F4 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 2 + adds r1, r3, 0 + adds r1, 0x88 + adds r1, r0, r1 + ldr r2, =gUnknown_082ED628 + adds r0, r3 + adds r0, 0x82 + ldrh r0, [r0] + lsls r0, 2 + adds r0, r2 + ldr r1, [r1] + ldr r0, [r0] + cmp r1, r0 + beq _080100E8 + adds r0, r6, 0 + bl sub_800F638 + ldr r1, =gUnknown_02022B44 + adds r1, 0x64 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + b _080100F4 + .pool +_080100E8: + movs r0, 0 + mov r4, r9 + str r0, [r4] + b _080100F4 +_080100F0: + movs r0, 0 + str r0, [r5] +_080100F4: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end rfufunc_80FA020 + + thumb_func_start sub_8010100 +sub_8010100: @ 8010100 + push {lr} + ldr r1, =gUnknown_03005000 + adds r1, 0x5A + strb r0, [r1] + movs r0, 0xA1 + lsls r0, 8 + bl sub_800FD14 + movs r0, 0x1 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8010100 + + thumb_func_start sub_801011C +sub_801011C: @ 801011C + push {lr} + bl rfu_clearAllSlot + bl sub_800C048 + ldr r1, =gReceivedRemoteLinkPlayers + movs r0, 0 + strb r0, [r1] + ldr r2, =gUnknown_03005000 + adds r3, r2, 0 + adds r3, 0xEF + movs r1, 0 + movs r0, 0x1 + strb r0, [r3] + str r1, [r2] + pop {r0} + bx r0 + .pool + thumb_func_end sub_801011C + + thumb_func_start sub_8010148 +sub_8010148: @ 8010148 + push {lr} + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x2] + ldrb r0, [r0, 0x3] + orrs r0, r1 + bl rfu_REQ_disconnect + bl rfu_waitREQComplete + bl sub_801011C + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010148 + + thumb_func_start sub_8010168 +sub_8010168: @ 8010168 + push {r4,lr} + ldr r4, =gUnknown_03005000 + ldrb r0, [r4, 0xC] + cmp r0, 0 + bne _08010188 + bl sub_800D630 + ldr r0, =0x00000ce4 + adds r1, r4, r0 + movs r0, 0x2 + strb r0, [r1] + b _0801018C + .pool +_08010188: + ldr r0, =sub_8010148 + str r0, [r4] +_0801018C: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010168 + + thumb_func_start sub_8010198 +sub_8010198: @ 8010198 + push {lr} + bl sub_800D630 + ldr r2, =gUnknown_03005000 + ldr r0, =0x00000ce4 + adds r1, r2, r0 + movs r0, 0x1 + strb r0, [r1] + ldr r0, =gUnknown_03007890 + ldr r1, [r0] + ldrb r0, [r1, 0x2] + ldrb r1, [r1, 0x3] + orrs r0, r1 + ldr r1, =0x00000ce3 + adds r2, r1 + strb r0, [r2] + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010198 + + thumb_func_start sub_80101CC +sub_80101CC: @ 80101CC + push {r4,r5,lr} + ldr r0, =gUnknown_03005000 + ldrb r5, [r0, 0xD] + movs r2, 0 + movs r1, 0 + adds r3, r0, 0 + adds r4, r3, 0 + adds r4, 0xE4 +_080101DC: + adds r0, r1, r4 + ldrb r0, [r0] + cmp r0, 0 + beq _080101E6 + adds r2, 0x1 +_080101E6: + adds r1, 0x1 + cmp r1, 0x4 + ble _080101DC + cmp r2, r5 + bne _08010220 + ldr r2, =gBattleTypeFlags + ldr r0, [r2] + movs r1, 0x21 + negs r1, r1 + ands r0, r1 + str r0, [r2] + ldrb r0, [r3, 0xC] + cmp r0, 0 + bne _0801021C + adds r0, r3, 0 + adds r0, 0xEE + ldrb r1, [r0] + movs r1, 0x3 + strb r1, [r0] + bl sub_8010168 + b _08010220 + .pool +_0801021C: + ldr r0, =sub_8010168 + str r0, [r3] +_08010220: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80101CC + + thumb_func_start sub_801022C +sub_801022C: @ 801022C + push {r4,lr} + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + bne _0801024E + ldr r4, =gUnknown_03005000 + ldr r1, =0x00000ce8 + adds r0, r4, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _0801024E + movs r0, 0xBE + lsls r0, 7 + bl sub_800FD14 + ldr r0, =sub_80101CC + str r0, [r4] +_0801024E: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801022C + + thumb_func_start sub_8010264 +sub_8010264: @ 8010264 + push {lr} + lsls r0, 24 + lsrs r3, r0, 24 + ldr r2, =gUnknown_03005000 + ldr r0, [r2] + cmp r0, 0 + bne _08010284 + ldr r1, =0x00000cd9 + adds r0, r2, r1 + movs r1, 0x1 + strb r1, [r0] + ldr r0, =sub_801022C + str r0, [r2] + adds r0, r3, 0 + bl DestroyTask +_08010284: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010264 + + thumb_func_start task_add_05_task_del_08FA224_when_no_RfuFunc +task_add_05_task_del_08FA224_when_no_RfuFunc: @ 8010294 + push {r4,lr} + ldr r4, =sub_8010264 + adds r0, r4, 0 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _080102AC + adds r0, r4, 0 + movs r1, 0x5 + bl CreateTask +_080102AC: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end task_add_05_task_del_08FA224_when_no_RfuFunc + + thumb_func_start sub_80102B8 +sub_80102B8: @ 80102B8 + push {r4,r5,lr} + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + beq _080102E6 + ldr r1, =gUnknown_03005000 + ldr r2, =0x000009e6 + adds r0, r1, r2 + ldrb r0, [r0] + adds r4, r0, 0 + cmp r4, 0 + bne _080102E6 + adds r5, r1, 0 + adds r5, 0xFE + ldrh r0, [r5] + cmp r0, 0x3C + bls _080102E6 + movs r0, 0xCC + lsls r0, 7 + bl sub_800FD14 + strh r4, [r5] +_080102E6: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r2, r0, 24 + movs r1, 0 + cmp r1, r2 + bcs _08010312 + ldr r0, =gUnknown_03005000 + adds r3, r0, 0 + adds r3, 0xE9 + ldrb r0, [r3] + cmp r0, 0 + beq _08010312 +_08010300: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, r2 + bcs _08010312 + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, 0 + bne _08010300 +_08010312: + ldr r4, =gUnknown_03005000 + cmp r1, r2 + bne _0801033E + movs r1, 0 + adds r3, r4, 0 + adds r3, 0xE9 + movs r2, 0 +_08010320: + adds r0, r1, r3 + strb r2, [r0] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x4 + bls _08010320 + movs r1, 0x80 + lsls r1, 1 + adds r0, r4, r1 + ldrh r1, [r0] + adds r1, 0x1 + movs r2, 0 + strh r1, [r0] + str r2, [r4] +_0801033E: + adds r1, r4, 0 + adds r1, 0xFE + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80102B8 + + thumb_func_start sub_8010358 +sub_8010358: @ 8010358 + push {r4,lr} + ldr r4, =gUnknown_03005000 + ldr r1, =0x000009e6 + adds r0, r4, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _0801037A + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + bne _0801037A + movs r0, 0xCC + lsls r0, 7 + bl sub_800FD14 + ldr r0, =sub_80102B8 + str r0, [r4] +_0801037A: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010358 + + thumb_func_start sub_8010390 +sub_8010390: @ 8010390 + push {r4,lr} + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + beq _080103CC + ldr r4, =gUnknown_03005000 + ldr r1, =0x000009e6 + adds r0, r4, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _0801041E + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + bne _0801041E + movs r0, 0xCC + lsls r0, 7 + bl sub_800FD14 + ldr r0, =sub_80102B8 + b _0801041C + .pool +_080103CC: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r2, r0, 24 + movs r1, 0x1 + cmp r1, r2 + bcs _080103FA + ldr r3, =gUnknown_03005000 + adds r0, r3, 0 + adds r0, 0xEA + ldrb r0, [r0] + cmp r0, 0 + beq _080103FA + adds r3, 0xE9 +_080103E8: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, r2 + bcs _080103FA + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, 0 + bne _080103E8 +_080103FA: + cmp r1, r2 + bne _0801041E + ldr r4, =gUnknown_03005000 + ldr r1, =0x000009e6 + adds r0, r4, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _0801041E + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + bne _0801041E + movs r0, 0xCC + lsls r0, 7 + bl sub_800FD14 + ldr r0, =sub_8010358 +_0801041C: + str r0, [r4] +_0801041E: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010390 + + thumb_func_start sub_8010434 +sub_8010434: @ 8010434 + push {lr} + ldr r1, =gUnknown_03005000 + ldr r2, [r1] + cmp r2, 0 + bne _08010448 + ldr r0, =sub_8010390 + str r0, [r1] + adds r0, r1, 0 + adds r0, 0xFE + strh r2, [r0] +_08010448: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010434 + + thumb_func_start sub_8010454 +sub_8010454: @ 8010454 + push {r4,lr} + adds r3, r0, 0 + ldr r1, =gUnknown_082ED6E0 + ldrh r0, [r1] + cmp r0, r3 + beq _08010482 + ldr r4, =0x0000ffff + adds r2, r1, 0 +_08010464: + ldrh r0, [r2] + cmp r0, r4 + bne _08010478 + movs r0, 0 + b _08010484 + .pool +_08010478: + adds r1, 0x2 + adds r2, 0x2 + ldrh r0, [r1] + cmp r0, r3 + bne _08010464 +_08010482: + movs r0, 0x1 +_08010484: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8010454 + + thumb_func_start sub_801048C +sub_801048C: @ 801048C + push {lr} + cmp r0, 0 + beq _080104A0 + movs r1, 0x96 + lsls r1, 2 + movs r0, 0x1 + bl sub_800D550 + movs r0, 0 + b _080104AC +_080104A0: + movs r0, 0 + movs r1, 0 + bl sub_800D550 + lsls r0, 24 + lsrs r0, 24 +_080104AC: + pop {r1} + bx r1 + thumb_func_end sub_801048C + + thumb_func_start sub_80104B0 +sub_80104B0: @ 80104B0 + push {lr} + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000cd9 + adds r0, r1 + movs r1, 0x1 + strb r1, [r0] + movs r0, 0 + bl sub_800C27C + pop {r0} + bx r0 + .pool + thumb_func_end sub_80104B0 + + thumb_func_start rfu_get_multiplayer_id +rfu_get_multiplayer_id: @ 80104D0 + push {lr} + ldr r1, =gUnknown_03005000 + ldrb r0, [r1, 0xC] + cmp r0, 0x1 + beq _080104EC + ldr r2, =0x00000cce + adds r0, r1, r2 + ldrb r0, [r0] + b _080104EE + .pool +_080104EC: + movs r0, 0 +_080104EE: + pop {r1} + bx r1 + thumb_func_end rfu_get_multiplayer_id + + thumb_func_start sub_80104F4 +sub_80104F4: @ 80104F4 + ldr r0, =gUnknown_03005000 + ldrb r0, [r0, 0xD] + bx lr + .pool + thumb_func_end sub_80104F4 + + thumb_func_start sub_8010500 +sub_8010500: @ 8010500 + push {lr} + ldr r2, =gUnknown_03005000 + adds r0, r2, 0 + adds r0, 0xF1 + ldrb r0, [r0] + cmp r0, 0x2 + bne _08010518 + movs r0, 0 + b _08010524 + .pool +_08010518: + movs r1, 0 + ldr r0, [r2] + cmp r0, 0 + bne _08010522 + movs r1, 0x1 +_08010522: + adds r0, r1, 0 +_08010524: + pop {r1} + bx r1 + thumb_func_end sub_8010500 + + thumb_func_start sub_8010528 +sub_8010528: @ 8010528 + push {lr} + ldr r0, =gUnknown_03005000 + ldr r0, [r0] + cmp r0, 0 + beq _08010536 + bl _call_via_r0 +_08010536: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010528 + + thumb_func_start sub_8010540 +sub_8010540: @ 8010540 + push {r4-r7,lr} + mov r7, r8 + push {r7} + movs r7, 0 + movs r5, 0 + ldr r6, =gUnknown_03005000 + ldr r0, =0x00000c3e + adds r0, r6 + mov r8, r0 +_08010552: + ldr r1, =0x00000cd1 + adds r0, r6, r1 + adds r4, r5, r0 + ldrb r0, [r4] + subs r0, 0x5 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _080105DA + ldr r1, =gUnknown_03007880 + lsls r0, r5, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0, 0x34] + cmp r0, 0x46 + beq _08010576 + cmp r0, 0x48 + bne _080105C0 +_08010576: + ldr r2, =0x00000cd5 + adds r0, r6, r2 + adds r1, r5, r0 + ldrb r0, [r1] + cmp r0, 0x8 + bne _080105DA + movs r0, 0x9 + strb r0, [r4] + movs r0, 0xA + strb r0, [r1] + lsls r1, r5, 24 + lsrs r1, 24 + movs r0, 0x8 + bl rfu_clearSlot + movs r0, 0x80 + lsls r0, 17 + lsls r0, r5 + lsrs r0, 24 + movs r1, 0x8 + adds r2, r4, 0 + movs r3, 0x1 + bl rfu_NI_setSendData + movs r7, 0x1 + b _080105DA + .pool +_080105C0: + mov r2, r8 + ldrb r0, [r2] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0, 0x34] + cmp r0, 0x47 + bne _080105DA + lsls r1, r5, 24 + lsrs r1, 24 + movs r0, 0x8 + bl rfu_clearSlot +_080105DA: + adds r5, 0x1 + cmp r5, 0x3 + ble _08010552 + adds r0, r7, 0 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8010540 + + thumb_func_start sub_80105EC +sub_80105EC: @ 80105EC + push {r4-r6,lr} + movs r3, 0 + movs r1, 0 + ldr r5, =gUnknown_03005CD5 + movs r6, 0x1 + movs r4, 0 +_080105F8: + adds r2, r1, r5 + ldrb r0, [r2] + cmp r0, 0xB + bne _0801060C + adds r0, r6, 0 + lsls r0, r1 + orrs r3, r0 + lsls r0, r3, 24 + lsrs r3, r0, 24 + strb r4, [r2] +_0801060C: + adds r1, 0x1 + cmp r1, 0x3 + ble _080105F8 + cmp r3, 0 + beq _08010620 + adds r0, r3, 0 + bl rfu_REQ_disconnect + bl rfu_waitREQComplete +_08010620: + movs r1, 0 + ldr r2, =gUnknown_03005CD5 +_08010624: + adds r0, r1, r2 + ldrb r0, [r0] + subs r0, 0xA + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _0801063C + movs r0, 0x1 + b _08010644 + .pool +_0801063C: + adds r1, 0x1 + cmp r1, 0x3 + ble _08010624 + movs r0, 0 +_08010644: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_80105EC + + thumb_func_start sub_801064C +sub_801064C: @ 801064C + push {lr} + adds r2, r0, 0 + adds r0, r1, 0 + lsls r2, 16 + lsrs r2, 16 + adds r1, r2, 0 + bl sub_8011CE4 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xFF + beq _08010680 + ldr r0, =gUnknown_03005000 + ldr r2, =0x00000cd1 + adds r0, r2 + adds r0, r1, r0 + ldrb r0, [r0] + cmp r0, 0x9 + beq _08010680 + movs r0, 0 + b _08010682 + .pool +_08010680: + movs r0, 0x1 +_08010682: + pop {r1} + bx r1 + thumb_func_end sub_801064C + + thumb_func_start sub_8010688 +sub_8010688: @ 8010688 + push {r4-r6,lr} + adds r6, r0, 0 + adds r0, r2, 0 + lsls r6, 24 + lsrs r6, 24 + lsls r1, 16 + lsrs r1, 16 + bl sub_8011CE4 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r5, =gUnknown_03005000 + ldr r0, =0x00000cd1 + adds r5, r0 + adds r5, r4, r5 + strb r6, [r5] + movs r0, 0x4 + adds r1, r4, 0 + bl rfu_clearSlot + movs r0, 0x80 + lsls r0, 17 + lsls r0, r4 + lsrs r0, 24 + movs r1, 0x8 + adds r2, r5, 0 + movs r3, 0x1 + bl rfu_NI_setSendData + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010688 + + thumb_func_start sub_80106D4 +sub_80106D4: @ 80106D4 + push {r4,r5,lr} + ldr r4, =gUnknown_03005000 + ldr r0, =0x00000c85 + adds r5, r4, r0 + movs r0, 0x8 + strb r0, [r5] + ldr r0, =0x00000c3e + adds r4, r0 + ldrb r1, [r4] + movs r0, 0x4 + bl rfu_clearSlot + ldrb r1, [r4] + movs r0, 0x80 + lsls r0, 17 + lsls r0, r1 + lsrs r0, 24 + movs r1, 0x8 + adds r2, r5, 0 + movs r3, 0x1 + bl rfu_NI_setSendData + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80106D4 + + thumb_func_start sub_8010714 +sub_8010714: @ 8010714 + push {lr} + adds r2, r0, 0 + adds r0, r1, 0 + lsls r2, 16 + lsrs r2, 16 + adds r1, r2, 0 + bl sub_8011CE4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xFF + bne _08010730 + movs r0, 0x2 + b _0801074A +_08010730: + ldr r1, =gUnknown_03007880 + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0 + beq _08010748 + movs r0, 0 + b _0801074A + .pool +_08010748: + movs r0, 0x1 +_0801074A: + pop {r1} + bx r1 + thumb_func_end sub_8010714 + + thumb_func_start sub_8010750 +sub_8010750: @ 8010750 + push {r4,r5,lr} + bl sub_8010540 + movs r4, 0 + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000cd5 + adds r5, r0, r1 +_0801075E: + ldr r1, =gUnknown_03007880 + lsls r0, r4, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0] + subs r0, 0x26 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1 + bhi _08010788 + adds r1, r4, r5 + ldrb r0, [r1] + cmp r0, 0xA + bne _0801077E + movs r0, 0xB + strb r0, [r1] +_0801077E: + lsls r1, r4, 24 + lsrs r1, 24 + movs r0, 0x4 + bl rfu_clearSlot +_08010788: + adds r4, 0x1 + cmp r4, 0x3 + ble _0801075E + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010750 + + thumb_func_start sub_80107A0 +sub_80107A0: @ 80107A0 + push {r4,r5,lr} + movs r4, 0 + ldr r1, =gUnknown_03005000 + ldr r2, =0x00000c85 + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x8 + bne _080107DA + ldr r2, =gUnknown_03007880 + ldr r0, =0x00000c3e + adds r1, r0 + ldrb r0, [r1] + lsls r0, 2 + adds r0, r2 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0x26 + beq _080107D2 + ldrb r0, [r1] + lsls r0, 2 + adds r0, r2 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0x27 + bne _080107DA +_080107D2: + ldrb r1, [r1] + movs r0, 0x4 + bl rfu_clearSlot +_080107DA: + ldr r2, =gUnknown_03007880 + ldr r5, =gUnknown_03005000 + ldr r0, =0x00000c3e + adds r1, r5, r0 + ldrb r0, [r1] + lsls r0, 2 + adds r0, r2 + ldr r0, [r0] + ldrh r0, [r0, 0x34] + cmp r0, 0x46 + beq _080107FE + ldrb r0, [r1] + lsls r0, 2 + adds r0, r2 + ldr r0, [r0] + ldrh r0, [r0, 0x34] + cmp r0, 0x48 + bne _0801082C +_080107FE: + ldrb r1, [r1] + movs r0, 0x8 + bl rfu_clearSlot + ldr r2, =0x00000c86 + adds r4, r5, r2 + ldrb r0, [r4] + movs r1, 0 + bl sub_8011A64 + ldrb r4, [r4] + b _08010844 + .pool +_0801082C: + ldrb r0, [r1] + lsls r0, 2 + adds r0, r2 + ldr r0, [r0] + ldrh r0, [r0, 0x34] + cmp r0, 0x47 + bne _08010844 + ldrb r1, [r1] + movs r0, 0x8 + bl rfu_clearSlot + movs r4, 0x6 +_08010844: + adds r0, r4, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_80107A0 + + thumb_func_start sub_801084C +sub_801084C: @ 801084C + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + ldr r5, =gUnknown_03005000 + adds r0, r5, 0 + adds r0, 0xF1 + ldrb r0, [r0] + subs r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _08010872 + ldr r0, =0x00000ce8 + adds r1, r5, r0 + movs r0, 0 + strb r0, [r1] + adds r0, r6, 0 + bl DestroyTask +_08010872: + ldr r2, =gTasks + lsls r1, r6, 2 + adds r0, r1, r6 + lsls r0, 3 + adds r4, r0, r2 + movs r2, 0x8 + ldrsh r0, [r4, r2] + adds r7, r1, 0 + cmp r0, 0x3 + beq _0801091C + cmp r0, 0x3 + bgt _080108A4 + cmp r0, 0x1 + beq _080108CC + cmp r0, 0x1 + bgt _08010918 + cmp r0, 0 + beq _080108B6 + b _080109D2 + .pool +_080108A4: + cmp r0, 0x5 + beq _08010950 + cmp r0, 0x5 + blt _0801093E + cmp r0, 0x6 + beq _08010984 + cmp r0, 0x65 + beq _08010904 + b _080109D2 +_080108B6: + bl sub_800FC60 + lsls r0, 24 + cmp r0, 0 + bne _080108C2 + b _080109D2 +_080108C2: + bl ResetBlockReceivedFlags + bl sub_800B348 + b _08010948 +_080108CC: + ldrb r0, [r5, 0xC] + cmp r0, 0x1 + bne _0801090C + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _080108E8 + movs r0, 0xF0 + lsls r0, 7 + bl sub_800FD14 + b _080108F0 + .pool +_080108E8: + movs r0, 0xEE + lsls r0, 7 + bl sub_800FD14 +_080108F0: + ldr r0, =gTasks + adds r1, r7, r6 + lsls r1, 3 + adds r1, r0 + movs r0, 0x65 + strh r0, [r1, 0x8] + b _080109D2 + .pool +_08010904: + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + bne _080109D2 +_0801090C: + movs r0, 0x2 + strh r0, [r4, 0x8] + b _080109D2 + .pool +_08010918: + ldrb r0, [r5, 0xD] + b _08010944 +_0801091C: + ldrb r0, [r5, 0xC] + cmp r0, 0x1 + bne _08010948 + bl sub_800FC60 + lsls r0, 24 + cmp r0, 0 + beq _080109D2 + adds r1, r5, 0 + adds r1, 0x5A + movs r0, 0 + strb r0, [r1] + movs r0, 0xA1 + lsls r0, 8 + bl sub_800FD14 + b _08010948 +_0801093E: + bl sub_800FC88 + lsls r0, 24 +_08010944: + cmp r0, 0 + beq _080109D2 +_08010948: + ldrh r0, [r4, 0x8] + adds r0, 0x1 + strh r0, [r4, 0x8] + b _080109D2 +_08010950: + movs r4, 0 + ldrb r0, [r5, 0xD] + cmp r4, r0 + bge _0801096E +_08010958: + adds r0, r4, 0 + bl sub_800B3A4 + lsls r0, r4, 24 + lsrs r0, 24 + bl sub_800F728 + adds r4, 0x1 + ldrb r2, [r5, 0xD] + cmp r4, r2 + blt _08010958 +_0801096E: + ldr r0, =gTasks + adds r1, r7, r6 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _080109D2 + .pool +_08010984: + adds r0, r6, 0 + bl DestroyTask + ldr r1, =gReceivedRemoteLinkPlayers + movs r0, 0x1 + strb r0, [r1] + ldr r0, =0x00000ce8 + adds r1, r5, r0 + movs r0, 0 + strb r0, [r1] + movs r1, 0x96 + lsls r1, 2 + movs r0, 0x1 + bl sub_800D550 + ldr r2, =0x00000ce6 + adds r1, r5, r2 + ldrb r0, [r1] + cmp r0, 0 + beq _080109D2 + movs r4, 0 + adds r2, r1, 0 + movs r3, 0x1 + ldr r0, =0x00000ce5 + adds r5, r0 +_080109B6: + ldrb r0, [r2] + asrs r0, r4 + ands r0, r3 + cmp r0, 0 + beq _080109CC + adds r0, r3, 0 + lsls r0, r4 + strb r0, [r5] + ldrb r1, [r2] + eors r0, r1 + strb r0, [r2] +_080109CC: + adds r4, 0x1 + cmp r4, 0x3 + ble _080109B6 +_080109D2: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801084C + + thumb_func_start sub_80109E8 +sub_80109E8: @ 80109E8 + push {r4,r5,lr} + lsls r0, 16 + lsrs r2, r0, 16 + movs r1, 0 + movs r5, 0x1 + ldr r4, =gUnknown_03005CDE + movs r3, 0 +_080109F6: + adds r0, r2, 0 + asrs r0, r1 + ands r0, r5 + cmp r0, 0 + beq _08010A04 + adds r0, r1, r4 + strb r3, [r0] +_08010A04: + adds r1, 0x1 + cmp r1, 0x3 + ble _080109F6 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80109E8 + + thumb_func_start sub_8010A14 +sub_8010A14: @ 8010A14 + push {r4-r7,lr} + adds r2, r0, 0 + ldr r1, =gUnknown_03005000 + ldrb r0, [r2, 0xF] + strb r0, [r1, 0xD] + movs r4, 0 + ldr r0, =0x00000cde + adds r5, r1, r0 + adds r3, r2, 0 + adds r3, 0x10 +_08010A28: + adds r0, r4, r5 + adds r1, r3, r4 + ldrb r1, [r1] + strb r1, [r0] + adds r4, 0x1 + cmp r4, 0x3 + ble _08010A28 + adds r6, r2, 0 + ldr r5, =gLinkPlayers + movs r4, 0x4 +_08010A3C: + adds r0, r5, 0 + adds r1, r6, 0 + adds r1, 0x14 + ldm r1!, {r2,r3,r7} + stm r0!, {r2,r3,r7} + ldm r1!, {r2,r3,r7} + stm r0!, {r2,r3,r7} + ldr r1, [r1] + str r1, [r0] + adds r0, r5, 0 + bl sub_800B524 + adds r6, 0x1C + adds r5, 0x1C + subs r4, 0x1 + cmp r4, 0 + bge _08010A3C + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010A14 + + thumb_func_start sub_8010A70 +sub_8010A70: @ 8010A70 + push {r4,r5,lr} + sub sp, 0x4 + adds r4, r0, 0 + ldr r0, =gUnknown_082ED7EC + adds r1, r4, 0 + bl strcmp + adds r5, r0, 0 + cmp r5, 0 + bne _08010A9C + adds r0, r4, 0 + bl sub_8010A14 + mov r0, sp + strh r5, [r0] + ldr r2, =0x0100007e + adds r1, r4, 0 + bl CpuSet + movs r0, 0 + bl ResetBlockReceivedFlag +_08010A9C: + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010A70 + + thumb_func_start sub_8010AAC +sub_8010AAC: @ 8010AAC + push {r4-r7,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r6, r0, 24 + ldr r3, =gUnknown_03005000 + ldr r2, =gUnknown_082ED68C + ldr r1, =0x00000ce9 + adds r0, r3, r1 + ldrb r1, [r0] + adds r1, r2 + ldr r2, =0x00000cde + adds r0, r3, r2 + ldrb r1, [r1] + adds r0, r1 + ldrb r4, [r0] + adds r0, r3, 0 + adds r0, 0xF1 + ldrb r0, [r0] + subs r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _08010AE8 + ldr r5, =0x00000ce8 + adds r1, r3, r5 + movs r0, 0 + strb r0, [r1] + adds r0, r6, 0 + bl DestroyTask +_08010AE8: + ldr r0, =gTasks + lsls r2, r6, 2 + adds r1, r2, r6 + lsls r1, 3 + adds r1, r0 + movs r3, 0x8 + ldrsh r1, [r1, r3] + adds r3, r0, 0 + adds r7, r2, 0 + cmp r1, 0x5 + bls _08010B00 + b _08010CF0 +_08010B00: + lsls r0, r1, 2 + ldr r1, =_08010B28 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08010B28: + .4byte _08010B40 + .4byte _08010B60 + .4byte _08010B78 + .4byte _08010BC0 + .4byte _08010C0A + .4byte _08010C94 +_08010B40: + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + beq _08010B4A + b _08010CF0 +_08010B4A: + adds r0, r4, 0 + bl ResetBlockReceivedFlag + movs r0, 0xF0 + lsls r0, 7 + bl sub_800FD14 + b _08010C4A + .pool +_08010B60: + ldr r0, =gUnknown_03003110 + ldrh r0, [r0] + cmp r0, 0 + beq _08010B6A + b _08010CF0 +_08010B6A: + adds r1, r7, r6 + lsls r1, 3 + adds r1, r3 + b _08010C52 + .pool +_08010B78: + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + asrs r0, r4 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + bne _08010B8C + b _08010CF0 +_08010B8C: + adds r0, r4, 0 + bl ResetBlockReceivedFlag + lsls r2, r4, 8 + ldr r0, =gBlockRecvBuffer + adds r2, r0 + ldr r1, =gLinkPlayers + lsls r0, r4, 3 + subs r0, r4 + lsls r0, 2 + adds r0, r1 + adds r1, r0, 0 + adds r2, 0x10 + ldm r2!, {r3-r5} + stm r1!, {r3-r5} + ldm r2!, {r3-r5} + stm r1!, {r3-r5} + ldr r2, [r2] + str r2, [r1] + bl sub_800B524 + b _08010C4A + .pool +_08010BC0: + ldr r5, =gUnknown_020228C4 + adds r1, r5, 0 + ldr r0, =gUnknown_082ED7EC + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldrh r2, [r0] + strh r2, [r1] + ldrb r0, [r0, 0x2] + strb r0, [r1, 0x2] + ldr r1, =gUnknown_03005000 + ldrb r0, [r1, 0xD] + strb r0, [r5, 0xF] + movs r2, 0 + adds r4, r5, 0 + adds r4, 0x10 + ldr r0, =0x00000cde + adds r3, r1, r0 +_08010BE2: + adds r0, r4, r2 + adds r1, r2, r3 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0x3 + ble _08010BE2 + ldr r1, =gLinkPlayers + adds r0, r5, 0 + adds r0, 0x14 + movs r2, 0x8C + bl memcpy + ldr r0, =gTasks + adds r1, r7, r6 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_08010C0A: + ldr r5, =gUnknown_020228C4 + ldr r1, =gUnknown_03005000 + ldrb r0, [r1, 0xD] + strb r0, [r5, 0xF] + movs r2, 0 + ldr r3, =gLinkPlayers + mov r12, r3 + adds r4, r5, 0 + adds r4, 0x10 + ldr r0, =0x00000cde + adds r3, r1, r0 +_08010C20: + adds r0, r4, r2 + adds r1, r2, r3 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0x3 + ble _08010C20 + adds r0, r5, 0 + adds r0, 0x14 + mov r1, r12 + movs r2, 0x8C + bl memcpy + ldr r1, =gUnknown_020228C4 + movs r0, 0 + movs r2, 0xA0 + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _08010CF0 +_08010C4A: + ldr r0, =gTasks + adds r1, r7, r6 + lsls r1, 3 + adds r1, r0 +_08010C52: + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _08010CF0 + .pool +_08010C74: + adds r0, r3, 0 + lsls r0, r2 + ldr r2, =0x00000ce5 + adds r1, r5, r2 + strb r0, [r1] + ldrb r1, [r4] + eors r0, r1 + strb r0, [r4] + ldr r4, =0x00000ce8 + adds r0, r5, r4 + strb r3, [r0] + b _08010CEA + .pool +_08010C94: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08010CF0 + bl GetBlockReceivedStatus + movs r1, 0x1 + ands r1, r0 + cmp r1, 0 + beq _08010CF0 + mov r0, sp + movs r4, 0 + strh r4, [r0] + ldr r1, =gBlockRecvBuffer + ldr r2, =0x0100007e + bl CpuSet + movs r0, 0 + bl ResetBlockReceivedFlag + ldr r1, =gUnknown_03005000 + ldr r5, =0x00000ce8 + adds r0, r1, r5 + strb r4, [r0] + ldr r0, =0x00000ce6 + adds r3, r1, r0 + ldrb r0, [r3] + cmp r0, 0 + beq _08010CEA + movs r2, 0 + adds r5, r1, 0 + adds r4, r3, 0 + ldrb r1, [r4] + movs r3, 0x1 +_08010CDA: + adds r0, r1, 0 + asrs r0, r2 + ands r0, r3 + cmp r0, 0 + bne _08010C74 + adds r2, 0x1 + cmp r2, 0x3 + ble _08010CDA +_08010CEA: + adds r0, r6, 0 + bl DestroyTask +_08010CF0: + add sp, 0x4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010AAC + + thumb_func_start sub_8010D0C +sub_8010D0C: @ 8010D0C + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r6, =gUnknown_03005000 + adds r0, r6, 0 + adds r0, 0xF1 + ldrb r0, [r0] + subs r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _08010D2A + adds r0, r5, 0 + bl DestroyTask +_08010D2A: + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r4, r0, r1 + movs r1, 0x8 + ldrsh r0, [r4, r1] + cmp r0, 0x1 + beq _08010D70 + cmp r0, 0x1 + bgt _08010D50 + cmp r0, 0 + beq _08010D56 + b _08010DA6 + .pool +_08010D50: + cmp r0, 0x2 + beq _08010D82 + b _08010DA6 +_08010D56: + ldrb r0, [r6, 0xD] + cmp r0, 0 + beq _08010DA6 + bl sub_800B348 + ldr r1, =gUnknown_020228C4 + movs r0, 0 + movs r2, 0x3C + bl SendBlock + b _08010D7A + .pool +_08010D70: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08010DA6 +_08010D7A: + ldrh r0, [r4, 0x8] + adds r0, 0x1 + strh r0, [r4, 0x8] + b _08010DA6 +_08010D82: + bl GetBlockReceivedStatus + movs r4, 0x1 + adds r1, r4, 0 + ands r1, r0 + cmp r1, 0 + beq _08010DA6 + ldr r0, =gBlockRecvBuffer + bl sub_8010A14 + movs r0, 0 + bl ResetBlockReceivedFlag + ldr r0, =gReceivedRemoteLinkPlayers + strb r4, [r0] + adds r0, r5, 0 + bl DestroyTask +_08010DA6: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010D0C + + thumb_func_start sub_8010DB4 +sub_8010DB4: @ 8010DB4 + push {r4-r7,lr} + ldr r0, =gUnknown_03005000 + adds r1, r0, 0 + adds r1, 0xEE + ldrb r1, [r1] + adds r3, r0, 0 + cmp r1, 0x1 + bne _08010E5C + ldr r2, =gUnknown_03004140 + ldrb r0, [r2, 0x2] + cmp r0, 0 + bne _08010E5C + ldr r0, =gMain + ldr r1, [r0, 0x4] + ldr r0, =sub_8018438 + cmp r1, r0 + beq _08010DDE + ldr r0, [r2, 0x3C] + ldrb r0, [r0, 0x4] + cmp r0, 0 + beq _08010DE4 +_08010DDE: + ldr r1, =gLinkVSyncDisabled + movs r0, 0x2 + strb r0, [r1] +_08010DE4: + ldr r4, =c2_800ACD4 + adds r0, r4, 0 + bl SetMainCallback2 + ldr r0, =gMain + str r4, [r0, 0x8] + ldr r5, =gUnknown_03005000 + ldrh r0, [r5, 0xA] + lsls r4, r0, 16 + ldrh r0, [r5, 0x10] + lsls r0, 8 + orrs r4, r0 + ldrh r0, [r5, 0x12] + orrs r4, r0 + ldr r1, =0x000009e6 + adds r0, r5, r1 + ldrb r0, [r0] + adds r7, r0, 0 + ldr r1, =0x00000c1a + adds r0, r5, r1 + ldrb r0, [r0] + adds r6, r0, 0 + bl sub_8011A74 + movs r3, 0 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _08010E20 + movs r3, 0x1 +_08010E20: + adds r0, r4, 0 + adds r1, r7, 0 + adds r2, r6, 0 + bl sub_800AF18 + adds r0, r5, 0 + adds r0, 0xEE + ldrb r1, [r0] + movs r1, 0x2 + strb r1, [r0] + bl sub_80097E8 + b _08010E8E + .pool +_08010E5C: + ldr r1, =0x00000c1b + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0x1 + beq _08010E70 + ldr r1, =0x000009e7 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0x1 + bne _08010E8E +_08010E70: + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x2] + cmp r0, 0 + beq _08010E7C + bl sub_800D630 +_08010E7C: + movs r4, 0xE0 + lsls r4, 7 + movs r0, 0x1 + adds r1, r4, 0 + bl sub_8011A64 + adds r0, r4, 0 + bl sub_8011170 +_08010E8E: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010DB4 + + thumb_func_start rfu_REQ_recvData_then_sendData +rfu_REQ_recvData_then_sendData: @ 8010EA0 + push {lr} + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x6] + cmp r0, 0x1 + bne _08010EB8 + bl rfu_REQ_recvData + bl rfu_waitREQComplete + movs r0, 0 + bl rfu_REQ_sendData_wrapper +_08010EB8: + pop {r0} + bx r0 + .pool + thumb_func_end rfu_REQ_recvData_then_sendData + + thumb_func_start sub_8010EC0 +sub_8010EC0: @ 8010EC0 + push {r4,r5,lr} + movs r5, 0 + ldr r4, =gUnknown_03005000 + ldr r1, =0x00000ccd + adds r0, r4, r1 + strb r5, [r0] + bl Random2 + lsls r0, 16 + lsrs r0, 16 + bl sub_800C54C + adds r0, r4, 0 + adds r0, 0xEF + ldrb r0, [r0] + cmp r0, 0 + bne _08010F14 + ldrb r0, [r4, 0xC] + cmp r0, 0x1 + beq _08010F02 + cmp r0, 0x1 + bgt _08010EFC + cmp r0, 0 + beq _08010F08 + b _08010F14 + .pool +_08010EFC: + cmp r0, 0x2 + beq _08010F10 + b _08010F14 +_08010F02: + bl sub_800F0F8 + b _08010F14 +_08010F08: + bl sub_800F4F0 + adds r5, r0, 0 + b _08010F14 +_08010F10: + bl rfu_REQ_recvData_then_sendData +_08010F14: + adds r0, r5, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8010EC0 + + thumb_func_start sub_8010F1C +sub_8010F1C: @ 8010F1C + push {r4,lr} + movs r4, 0 + ldr r1, =gUnknown_03005000 + adds r0, r1, 0 + adds r0, 0xEF + ldrb r0, [r0] + cmp r0, 0 + bne _08010F3C + ldrb r0, [r1, 0xC] + cmp r0, 0x1 + bne _08010F38 + bl sub_800F1E0 + adds r4, r0, 0 +_08010F38: + bl sub_8010DB4 +_08010F3C: + adds r0, r4, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8010F1C + + thumb_func_start sub_8010F48 +sub_8010F48: @ 8010F48 + push {lr} + ldr r0, =gUnknown_02022B22 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + bl StringCopy + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010F48 + + thumb_func_start sub_8010F60 +sub_8010F60: @ 8010F60 + push {r4,lr} + ldr r4, =gUnknown_02022B14 + adds r0, r4, 0 + movs r1, 0 + movs r2, 0xD + bl memset + adds r0, r4, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl sub_800DD94 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010F60 + + thumb_func_start sub_8010F84 +sub_8010F84: @ 8010F84 + push {r4,lr} + adds r4, r0, 0 + adds r3, r1, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_02022B14 + adds r1, r4, 0 + bl sub_800DD94 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010F84 + + thumb_func_start sub_8010FA0 +sub_8010FA0: @ 8010FA0 + push {r4,r5,lr} + ldr r5, =gUnknown_02022B14 + movs r4, 0x1 + ands r0, r4 + lsls r0, 4 + ldrb r3, [r5] + movs r2, 0x11 + negs r2, r2 + ands r2, r3 + orrs r2, r0 + ands r1, r4 + lsls r1, 5 + movs r0, 0x21 + negs r0, r0 + ands r2, r0 + orrs r2, r1 + strb r2, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010FA0 + + thumb_func_start sub_8010FCC +sub_8010FCC: @ 8010FCC + push {r4,r5,lr} + ldr r5, =gUnknown_02022B14 + lsls r0, 2 + ldrb r4, [r5, 0x9] + movs r3, 0x3 + ands r3, r4 + orrs r3, r0 + strb r3, [r5, 0x9] + ldr r3, =0x000003ff + adds r0, r3, 0 + ands r1, r0 + ldrh r3, [r5, 0x8] + ldr r0, =0xfffffc00 + ands r0, r3 + orrs r0, r1 + strh r0, [r5, 0x8] + lsls r2, 1 + ldrb r1, [r5, 0xB] + movs r0, 0x1 + ands r0, r1 + orrs r0, r2 + strb r0, [r5, 0xB] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8010FCC + + thumb_func_start sub_801100C +sub_801100C: @ 801100C + push {r4,lr} + movs r4, 0x80 + ldr r3, =gLinkPlayers + lsls r1, r0, 3 + subs r1, r0 + lsls r1, 2 + adds r0, r1, r3 + ldrb r2, [r0, 0x13] + lsls r2, 3 + orrs r2, r4 + adds r3, 0x4 + adds r1, r3 + ldr r0, [r1] + movs r1, 0x7 + ands r0, r1 + orrs r0, r2 + lsls r0, 24 + lsrs r0, 24 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801100C + + thumb_func_start sub_801103C +sub_801103C: @ 801103C + push {r4,r5,lr} + ldr r5, =gUnknown_02022B14 + movs r4, 0x1 + b _08011054 + .pool +_08011048: + adds r0, r4, 0 + bl sub_801100C + adds r1, r5, r4 + strb r0, [r1, 0x3] + adds r4, 0x1 +_08011054: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + blt _08011048 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801103C + + thumb_func_start sub_8011068 +sub_8011068: @ 8011068 + push {lr} + lsls r0, 24 + ldr r2, =gUnknown_02022B14 + lsrs r0, 17 + ldrb r3, [r2, 0xA] + movs r1, 0x7F + ands r1, r3 + orrs r1, r0 + strb r1, [r2, 0xA] + ldr r3, =gUnknown_02022B22 + movs r0, 0 + movs r1, 0x2 + bl rfu_REQ_configGameData + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011068 + + thumb_func_start sub_8011090 +sub_8011090: @ 8011090 + push {lr} + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0 + beq _0801109E + bl sub_8010F84 +_0801109E: + ldr r2, =gUnknown_02022B14 + ldr r3, =gUnknown_02022B22 + movs r0, 0 + movs r1, 0x2 + bl rfu_REQ_configGameData + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011090 + + thumb_func_start sub_80110B8 +sub_80110B8: @ 80110B8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + mov r9, r0 + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r0, 0x7F + ands r0, r1 + cmp r0, 0x45 + bne _0801114C + movs r5, 0 + movs r7, 0 + ldr r3, =gUnknown_03005000 + ldr r1, =0x00000ce2 + adds r0, r3, r1 + ldr r2, =0x00000ce3 + adds r1, r3, r2 + ldrb r2, [r0] + ldrb r0, [r1] + adds r1, r0, 0 + eors r1, r2 + mov r8, r1 + movs r4, 0 + movs r6, 0x1 + ldr r2, =gLinkPlayers + mov r12, r2 + ldr r0, =0x00000cde + adds r0, r3 + mov r10, r0 + mov r3, r12 + adds r3, 0x4 +_080110FC: + mov r0, r8 + asrs r0, r4 + ands r0, r6 + cmp r0, 0 + beq _0801113C + mov r1, r10 + adds r0, r4, r1 + ldrb r1, [r0] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 2 + mov r2, r12 + adds r1, r0, r2 + ldrb r1, [r1, 0x13] + adds r2, r6, 0 + ands r2, r1 + lsls r2, 3 + adds r0, r3 + ldr r1, [r0] + movs r0, 0x7 + ands r1, r0 + movs r0, 0x80 + orrs r1, r0 + orrs r2, r1 + lsls r0, r5, 3 + lsls r2, r0 + orrs r7, r2 + adds r5, 0x1 + mov r0, r9 + subs r0, 0x1 + cmp r5, r0 + beq _08011142 +_0801113C: + adds r4, 0x1 + cmp r4, 0x3 + ble _080110FC +_08011142: + movs r0, 0x45 + adds r1, r7, 0 + movs r2, 0 + bl sub_8011090 +_0801114C: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80110B8 + + thumb_func_start sub_8011170 +sub_8011170: @ 8011170 + push {r4,lr} + adds r4, r0, 0 + ldr r2, =gUnknown_03005000 + adds r3, r2, 0 + adds r3, 0xEE + ldrb r0, [r3] + cmp r0, 0 + bne _08011192 + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x14] + strh r0, [r2, 0x10] + ldrh r0, [r1, 0x16] + strh r0, [r2, 0x12] + strh r4, [r2, 0xA] + ldrb r0, [r3] + movs r0, 0x1 + strb r0, [r3] +_08011192: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011170 + + thumb_func_start sub_80111A0 +sub_80111A0: @ 80111A0 + ldr r0, =gUnknown_03005000 + adds r0, 0xEE + ldrb r1, [r0] + movs r1, 0 + strb r1, [r0] + bx lr + .pool + thumb_func_end sub_80111A0 + + thumb_func_start sub_80111B0 +sub_80111B0: @ 80111B0 + push {lr} + adds r2, r0, 0 + cmp r2, 0 + bne _080111C8 + ldr r0, =gUnknown_03005000 + adds r0, 0xEE + ldrb r1, [r0] + strb r2, [r0] + b _080111D2 + .pool +_080111C8: + ldr r0, =gUnknown_03005000 + adds r0, 0xEE + ldrb r1, [r0] + movs r1, 0x4 + strb r1, [r0] +_080111D2: + pop {r0} + bx r0 + .pool + thumb_func_end sub_80111B0 + + thumb_func_start sub_80111DC +sub_80111DC: @ 80111DC + push {lr} + ldr r0, =gUnknown_03004140 + ldrb r0, [r0] + movs r1, 0x1 + bl sub_8011E94 + ldr r1, =gUnknown_03005000 + movs r0, 0 + str r0, [r1] + pop {r0} + bx r0 + .pool + thumb_func_end sub_80111DC + + thumb_func_start sub_80111FC +sub_80111FC: @ 80111FC + ldr r1, =gUnknown_03005000 + ldr r0, =sub_80111DC + str r0, [r1] + bx lr + .pool + thumb_func_end sub_80111FC + + thumb_func_start sub_801120C +sub_801120C: @ 801120C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + lsls r0, 24 + lsrs r4, r0, 24 + movs r6, 0 + cmp r4, 0x32 + bne _08011222 + b _08011360 +_08011222: + cmp r4, 0x32 + bgt _08011252 + cmp r4, 0x13 + bgt _08011240 + cmp r4, 0x12 + blt _08011230 + b _080113EE +_08011230: + cmp r4, 0x10 + bne _08011236 + b _080113EE +_08011236: + cmp r4, 0x10 + bgt _0801128C + cmp r4, 0 + beq _0801127E + b _080113EE +_08011240: + cmp r4, 0x30 + bne _08011246 + b _0801136C +_08011246: + cmp r4, 0x30 + ble _0801124C + b _08011354 +_0801124C: + cmp r4, 0x14 + beq _08011328 + b _080113EE +_08011252: + cmp r4, 0x44 + bgt _08011264 + cmp r4, 0x42 + blt _0801125C + b _080113EE +_0801125C: + cmp r4, 0x33 + bne _08011262 + b _0801136C +_08011262: + b _080113EE +_08011264: + cmp r4, 0xF3 + bne _0801126A + b _080113BA +_0801126A: + cmp r4, 0xF3 + bgt _08011276 + cmp r4, 0xF0 + bge _08011274 + b _080113EE +_08011274: + b _080113D4 +_08011276: + cmp r4, 0xFF + bne _0801127C + b _080113D4 +_0801127C: + b _080113EE +_0801127E: + ldr r1, =gUnknown_03005000 + movs r0, 0x2 + strh r0, [r1, 0x4] + b _080113EE + .pool +_0801128C: + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x14] + bl sub_80115EC + movs r5, 0 + movs r0, 0x1 + mov r8, r0 + ldr r1, =gUnknown_03005000 + mov r9, r1 + ldr r3, =0x00000cd5 + add r3, r9 + mov r10, r3 + movs r7, 0x7F +_080112A6: + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x14] + asrs r0, r5 + mov r1, r8 + ands r0, r1 + cmp r0, 0 + beq _0801130E + ldr r0, =gUnknown_03007890 + lsls r1, r5, 5 + adds r1, 0x14 + ldr r0, [r0] + adds r0, r1 + ldrb r0, [r0, 0x10] + adds r4, r7, 0 + ands r4, r0 + bl sub_800F7DC + ldrb r1, [r0, 0xA] + adds r0, r7, 0 + ands r0, r1 + cmp r4, r0 + bne _08011304 + ldr r0, =0x00000cd1 + add r0, r9 + adds r0, r5, r0 + movs r1, 0 + strb r1, [r0] + mov r3, r10 + adds r2, r5, r3 + strb r1, [r2] + movs r0, 0x20 + adds r1, r5, 0 + movs r3, 0x1 + bl rfu_setRecvBuffer + b _0801130E + .pool +_08011304: + mov r0, r8 + lsls r0, r5 + orrs r6, r0 + lsls r0, r6, 24 + lsrs r6, r0, 24 +_0801130E: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x3 + bls _080112A6 + cmp r6, 0 + beq _080113EE + adds r0, r6, 0 + bl rfu_REQ_disconnect + bl rfu_waitREQComplete + b _080113EE +_08011328: + ldr r4, =gUnknown_03005000 + ldr r1, =0x00000ce7 + adds r0, r4, r1 + ldr r1, =gUnknown_03004140 + ldrb r2, [r0] + ldrb r0, [r1] + cmp r2, r0 + beq _08011342 + eors r0, r2 + bl rfu_REQ_disconnect + bl rfu_waitREQComplete +_08011342: + movs r0, 0x11 + strh r0, [r4, 0x4] + b _080113EE + .pool +_08011354: + ldr r0, =gUnknown_03005000 + adds r0, 0xF0 + b _080113EA + .pool +_08011360: + ldr r0, =gUnknown_03005000 + adds r0, 0xF0 + movs r1, 0x3 + b _080113EC + .pool +_0801136C: + ldr r1, =gUnknown_03005000 + adds r2, r1, 0 + adds r2, 0xF0 + movs r0, 0x4 + strb r0, [r2] + ldr r3, =0x00000ce2 + adds r1, r3 + ldr r0, =gUnknown_03004140 + ldrb r2, [r0, 0x14] + ldrb r0, [r1] + adds r3, r0, 0 + bics r3, r2 + adds r2, r3, 0 + strb r2, [r1] + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0x1 + bne _080113B0 + cmp r2, 0 + bne _080113AC + adds r0, r4, 0 + bl sub_8011170 + b _080113B0 + .pool +_080113AC: + bl sub_80111FC +_080113B0: + movs r0, 0x2 + adds r1, r4, 0 + bl sub_8011A64 + b _080113EE +_080113BA: + movs r0, 0x1 + movs r1, 0xF3 + bl sub_8011A64 + movs r0, 0xF3 + bl sub_8011170 + ldr r0, =gUnknown_03005000 + adds r0, 0xEF + b _080113EA + .pool +_080113D4: + adds r0, r4, 0 + bl sub_8011170 + movs r0, 0x1 + adds r1, r4, 0 + bl sub_8011A64 + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000cdb + adds r0, r1 + ldrb r1, [r0] +_080113EA: + movs r1, 0x1 +_080113EC: + strb r1, [r0] +_080113EE: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801120C + + thumb_func_start sub_8011404 +sub_8011404: @ 8011404 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x31 + bne _08011410 + b _08011570 +_08011410: + cmp r4, 0x31 + bgt _0801143E + cmp r4, 0x22 + beq _08011494 + cmp r4, 0x22 + bgt _0801142C + cmp r4, 0x20 + beq _0801147C + cmp r4, 0x20 + ble _08011426 + b _080115DE +_08011426: + cmp r4, 0 + beq _0801146E + b _080115DE +_0801142C: + cmp r4, 0x24 + beq _080114BA + cmp r4, 0x24 + blt _080114B0 + cmp r4, 0x25 + beq _08011504 + cmp r4, 0x30 + beq _0801150E + b _080115DE +_0801143E: + cmp r4, 0x44 + bgt _08011454 + cmp r4, 0x42 + blt _08011448 + b _080115DE +_08011448: + cmp r4, 0x33 + beq _08011522 + cmp r4, 0x33 + bge _08011452 + b _0801158C +_08011452: + b _080115DE +_08011454: + cmp r4, 0xF3 + bne _0801145A + b _080115AC +_0801145A: + cmp r4, 0xF3 + bgt _08011466 + cmp r4, 0xF0 + bge _08011464 + b _080115DE +_08011464: + b _080115C4 +_08011466: + cmp r4, 0xFF + bne _0801146C + b _080115C4 +_0801146C: + b _080115DE +_0801146E: + ldr r1, =gUnknown_03005000 + movs r0, 0x6 + strh r0, [r1, 0x4] + b _080115DE + .pool +_0801147C: + ldr r0, =gUnknown_03005000 + ldr r1, =gUnknown_03004140 + ldrh r1, [r1, 0x14] + ldr r2, =0x00000ccd + adds r0, r2 + b _080115DC + .pool +_08011494: + ldr r0, =gUnknown_03005000 + ldr r1, =gUnknown_03004140 + ldrh r1, [r1, 0x14] + ldr r2, =0x00000c3e + adds r0, r2 + ldrb r2, [r0] + b _080115DC + .pool +_080114B0: + movs r0, 0x2 + adds r1, r4, 0 + bl sub_8011A64 + b _080115DE +_080114BA: + ldr r4, =gUnknown_03005000 + movs r1, 0 + movs r0, 0xB + strh r0, [r4, 0x4] + ldr r2, =0x00000c85 + adds r0, r4, r2 + strb r1, [r0] + ldr r0, =0x00000c86 + adds r2, r4, r0 + strb r1, [r2] + ldr r1, =0x00000c3e + adds r5, r4, r1 + ldrb r1, [r5] + movs r0, 0x20 + movs r3, 0x1 + bl rfu_setRecvBuffer + ldrb r1, [r5] + ldr r2, =0x00000c3f + adds r4, r2 + movs r0, 0x10 + adds r2, r4, 0 + movs r3, 0x46 + bl rfu_setRecvBuffer + b _080115DE + .pool +_08011504: + movs r0, 0x2 + movs r1, 0x25 + bl sub_8011A64 + b _080115DE +_0801150E: + ldr r0, =gUnknown_03005000 + adds r2, r0, 0 + adds r2, 0xF0 + movs r1, 0x2 + strb r1, [r2] + ldr r1, =0x00000c86 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x6 + beq _080115DE +_08011522: + ldr r2, =gUnknown_03005000 + adds r1, r2, 0 + adds r1, 0xF0 + ldrb r0, [r1] + cmp r0, 0x2 + beq _08011532 + movs r0, 0x4 + strb r0, [r1] +_08011532: + ldr r1, =0x00000c86 + adds r0, r2, r1 + ldrb r0, [r0] + cmp r0, 0x9 + beq _08011544 + movs r0, 0x2 + adds r1, r4, 0 + bl sub_8011A64 +_08011544: + ldr r0, =gUnknown_082ED7FC + movs r1, 0x5 + movs r2, 0x5 + bl nullsub_5 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0x1 + bne _080115DE + adds r0, r4, 0 + bl sub_8011170 + b _080115DE + .pool +_08011570: + ldr r0, =gUnknown_03005000 + adds r0, 0xF0 + movs r1, 0x1 + strb r1, [r0] + ldr r0, =gUnknown_082ED814 + movs r1, 0x5 + movs r2, 0x5 + bl nullsub_5 + b _080115DE + .pool +_0801158C: + ldr r1, =gUnknown_03005000 + adds r2, r1, 0 + adds r2, 0xF0 + movs r0, 0x3 + strb r0, [r2] + ldr r2, =0x00000c3c + adds r1, r2 + ldrb r0, [r1] + movs r0, 0x1 + strb r0, [r1] + b _080115DE + .pool +_080115AC: + movs r0, 0x1 + movs r1, 0xF3 + bl sub_8011A64 + movs r0, 0xF3 + bl sub_8011170 + ldr r0, =gUnknown_03005000 + adds r0, 0xEF + b _080115DA + .pool +_080115C4: + movs r0, 0x1 + adds r1, r4, 0 + bl sub_8011A64 + adds r0, r4, 0 + bl sub_8011170 + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000cdb + adds r0, r1 + ldrb r1, [r0] +_080115DA: + movs r1, 0x1 +_080115DC: + strb r1, [r0] +_080115DE: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011404 + + thumb_func_start sub_80115EC +sub_80115EC: @ 80115EC + push {r4-r6,lr} + adds r3, r0, 0 + movs r2, 0 + movs r6, 0x1 + ldr r0, =gUnknown_03005000 + ldr r4, =0x00000cea + adds r1, r0, r4 + movs r5, 0 + movs r4, 0xFF +_080115FE: + adds r0, r3, 0 + asrs r0, r2 + ands r0, r6 + cmp r0, 0 + beq _08011610 + strb r5, [r1] + ldrb r0, [r1, 0x4] + orrs r0, r4 + strb r0, [r1, 0x4] +_08011610: + adds r1, 0x1 + adds r2, 0x1 + cmp r2, 0x3 + ble _080115FE + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80115EC + + thumb_func_start sub_8011628 +sub_8011628: @ 8011628 + push {r4-r7,lr} + adds r5, r0, 0 + movs r3, 0 + movs r2, 0 + movs r4, 0x1 + ldr r6, =gUnknown_03007890 + movs r7, 0x7F +_08011636: + adds r0, r5, 0 + asrs r0, r2 + ands r0, r4 + cmp r0, 0 + beq _0801165C + lsls r1, r2, 5 + adds r1, 0x14 + ldr r0, [r6] + adds r0, r1 + ldrb r1, [r0, 0x10] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0x45 + bne _0801165C + adds r0, r4, 0 + lsls r0, r2 + orrs r3, r0 + lsls r0, r3, 24 + lsrs r3, r0, 24 +_0801165C: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _08011636 + adds r0, r3, 0 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8011628 + + thumb_func_start sub_8011674 +sub_8011674: @ 8011674 + push {r4-r7,lr} + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x25 + bne _08011680 + b _080118EC +_08011680: + cmp r4, 0x25 + bgt _080116C2 + cmp r4, 0x14 + bne _0801168A + b _08011804 +_0801168A: + cmp r4, 0x14 + bgt _080116A2 + cmp r4, 0x11 + beq _08011722 + cmp r4, 0x11 + ble _08011698 + b _08011A42 +_08011698: + cmp r4, 0 + beq _0801170C + cmp r4, 0x10 + beq _08011718 + b _08011A42 +_080116A2: + cmp r4, 0x22 + bne _080116A8 + b _08011868 +_080116A8: + cmp r4, 0x22 + bgt _080116B4 + cmp r4, 0x20 + bne _080116B2 + b _08011850 +_080116B2: + b _08011A42 +_080116B4: + cmp r4, 0x23 + bne _080116BA + b _08011884 +_080116BA: + cmp r4, 0x24 + bne _080116C0 + b _080118BA +_080116C0: + b _08011A42 +_080116C2: + cmp r4, 0x44 + bgt _080116F2 + cmp r4, 0x42 + blt _080116CC + b _08011A42 +_080116CC: + cmp r4, 0x32 + bne _080116D2 + b _08011914 +_080116D2: + cmp r4, 0x32 + bgt _080116E4 + cmp r4, 0x30 + bne _080116DC + b _08011940 +_080116DC: + cmp r4, 0x31 + bne _080116E2 + b _080118F6 +_080116E2: + b _08011A42 +_080116E4: + cmp r4, 0x33 + bne _080116EA + b _08011948 +_080116EA: + cmp r4, 0x40 + bne _080116F0 + b _080119FC +_080116F0: + b _08011A42 +_080116F2: + cmp r4, 0xF3 + bne _080116F8 + b _08011A0C +_080116F8: + cmp r4, 0xF3 + bgt _08011704 + cmp r4, 0xF0 + bge _08011702 + b _08011A42 +_08011702: + b _08011A28 +_08011704: + cmp r4, 0xFF + bne _0801170A + b _08011A28 +_0801170A: + b _08011A42 +_0801170C: + ldr r1, =gUnknown_03005000 + movs r0, 0x11 + strh r0, [r1, 0x4] + b _08011A42 + .pool +_08011718: + movs r0, 0x4 + movs r1, 0 + bl sub_8011A64 + b _08011A42 +_08011722: + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r0, 0x7F + ands r0, r1 + cmp r0, 0x45 + bne _080117DC + ldr r5, =gUnknown_03005000 + ldr r1, =0x00000cd9 + adds r0, r5, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _080117DC + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x14] + bl sub_8011628 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _080117A6 + adds r0, r4, 0 + bl sub_800E87C + movs r2, 0x1 + mov r12, r2 + mov r1, r12 + lsls r1, r0 + lsls r1, 24 + lsrs r1, 24 + ldr r7, =0x00000ce6 + adds r6, r5, r7 + ldrb r2, [r6] + cmp r2, 0 + bne _08011798 + ldr r0, =0x00000ce8 + adds r3, r5, r0 + ldrb r0, [r3] + cmp r0, 0 + bne _08011798 + subs r7, 0x1 + adds r0, r5, r7 + strb r1, [r0] + eors r1, r4 + orrs r1, r2 + strb r1, [r6] + mov r0, r12 + strb r0, [r3] + b _080117A6 + .pool +_08011798: + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000ce6 + adds r0, r1 + ldrb r2, [r0] + adds r1, r4, 0 + orrs r1, r2 + strb r1, [r0] +_080117A6: + ldr r0, =gUnknown_03004140 + ldrh r1, [r0, 0x14] + cmp r4, r1 + beq _080117F6 + ldr r2, =gUnknown_03005000 + ldr r7, =0x00000ce3 + adds r3, r2, r7 + adds r0, r4, 0 + eors r0, r1 + ldrb r1, [r3] + orrs r0, r1 + strb r0, [r3] + ldr r0, =0x00000ce4 + adds r2, r0 + movs r0, 0x2 + strb r0, [r2] + b _080117F6 + .pool +_080117DC: + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r0, 0x7F + ands r0, r1 + cmp r0, 0x54 + bne _080117F6 + ldr r0, =gUnknown_03004140 + ldrb r0, [r0] + bl rfu_REQ_disconnect + bl rfu_waitREQComplete +_080117F6: + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x14] + bl sub_80115EC + b _08011A42 + .pool +_08011804: + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r0, 0x7F + ands r0, r1 + cmp r0, 0x45 + beq _08011836 + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x1] + cmp r0, 0x1 + bls _08011836 + ldrb r0, [r4, 0x14] + bl sub_800E87C + movs r1, 0x80 + lsls r1, 17 + lsls r1, r0 + lsrs r1, 24 + ldrb r0, [r4] + eors r1, r0 + adds r0, r1, 0 + bl rfu_REQ_disconnect + bl rfu_waitREQComplete +_08011836: + ldr r1, =gUnknown_03005000 + ldrh r0, [r1, 0x4] + cmp r0, 0xF + beq _08011840 + b _08011A42 +_08011840: + movs r0, 0x10 + strh r0, [r1, 0x4] + b _08011A42 + .pool +_08011850: + ldr r0, =gUnknown_03005000 + ldr r1, =gUnknown_03004140 + ldrh r1, [r1, 0x14] + ldr r2, =0x00000ccd + adds r0, r2 + b _08011A40 + .pool +_08011868: + ldr r0, =gUnknown_03005000 + ldr r1, =gUnknown_03004140 + ldrh r1, [r1, 0x14] + ldr r7, =0x00000c3e + adds r0, r7 + ldrb r2, [r0] + b _08011A40 + .pool +_08011884: + ldr r1, =gUnknown_03005000 + movs r0, 0x12 + strh r0, [r1, 0x4] + ldr r0, =0x00000ccf + adds r1, r0 + ldrb r0, [r1] + cmp r0, 0x1 + bhi _080118B0 + adds r0, 0x1 + strb r0, [r1] + ldr r0, =sub_801209C + movs r1, 0x2 + bl CreateTask + b _08011A42 + .pool +_080118B0: + movs r0, 0x2 + movs r1, 0x23 + bl sub_8011A64 + b _08011A42 +_080118BA: + ldr r4, =gUnknown_03005000 + movs r0, 0xD + strh r0, [r4, 0x4] + movs r0, 0x3 + movs r1, 0 + bl sub_8011A64 + ldr r1, =0x00000c3e + adds r0, r4, r1 + ldrb r1, [r0] + ldr r2, =0x00000c3f + adds r4, r2 + movs r0, 0x10 + adds r2, r4, 0 + movs r3, 0x46 + bl rfu_setRecvBuffer + b _08011A42 + .pool +_080118EC: + movs r0, 0x2 + movs r1, 0x25 + bl sub_8011A64 + b _08011A42 +_080118F6: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0] + ldrh r0, [r0, 0x14] + ands r1, r0 + cmp r1, 0 + bne _08011904 + b _08011A42 +_08011904: + ldr r0, =gUnknown_03005000 + adds r0, 0xF0 + movs r1, 0x1 + b _08011A40 + .pool +_08011914: + ldr r2, =gUnknown_03005000 + adds r1, r2, 0 + adds r1, 0xF0 + movs r0, 0x3 + strb r0, [r1] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0 + beq _0801192A + b _08011A42 +_0801192A: + ldr r7, =0x00000c3c + adds r0, r2, r7 + ldrb r1, [r0] + movs r1, 0x1 + b _08011A40 + .pool +_08011940: + ldr r0, =gUnknown_03005000 + adds r0, 0xF0 + movs r1, 0x2 + strb r1, [r0] +_08011948: + ldr r2, =gUnknown_03005000 + adds r1, r2, 0 + adds r1, 0xF0 + ldrb r0, [r1] + cmp r0, 0x2 + beq _08011958 + movs r0, 0x4 + strb r0, [r1] +_08011958: + ldrb r0, [r2, 0xC] + cmp r0, 0x1 + bne _08011996 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0x1 + bne _080119B4 + ldr r0, =0x00000ce2 + adds r2, r0 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x14] + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + cmp r0, 0 + bne _08011990 + adds r0, r4, 0 + bl sub_8011170 + b _080119B4 + .pool +_08011990: + bl sub_80111FC + b _080119B4 +_08011996: + ldr r1, =0x00000ce4 + adds r0, r2, r1 + ldrb r0, [r0] + cmp r0, 0x2 + beq _080119B4 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0x1 + bne _080119B4 + adds r0, r4, 0 + bl sub_8011170 + movs r0, 0 + bl sub_800C27C +_080119B4: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0xFF + bne _080119DA + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x7] + cmp r0, 0 + bne _080119DA + ldr r0, =sub_800EB44 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _080119DA + ldr r1, =gUnknown_03005000 + movs r0, 0x11 + strh r0, [r1, 0x4] +_080119DA: + movs r0, 0x2 + adds r1, r4, 0 + bl sub_8011A64 + b _08011A42 + .pool +_080119FC: + ldr r0, =gUnknown_03005000 + ldr r2, =0x00000ce3 + adds r0, r2 + b _08011A3E + .pool +_08011A0C: + movs r0, 0x1 + movs r1, 0xF3 + bl sub_8011A64 + movs r0, 0xF3 + bl sub_8011170 + ldr r0, =gUnknown_03005000 + adds r0, 0xEF + movs r1, 0x1 + b _08011A40 + .pool +_08011A28: + adds r0, r4, 0 + bl sub_8011170 + movs r0, 0x1 + adds r1, r4, 0 + bl sub_8011A64 + ldr r0, =gUnknown_03005000 + ldr r7, =0x00000cdb + adds r0, r7 + ldrb r1, [r0] +_08011A3E: + movs r1, 0 +_08011A40: + strb r1, [r0] +_08011A42: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011674 + + thumb_func_start sub_8011A50 +sub_8011A50: @ 8011A50 + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000ce4 + adds r0, r1 + movs r1, 0x2 + strb r1, [r0] + bx lr + .pool + thumb_func_end sub_8011A50 + + thumb_func_start sub_8011A64 +sub_8011A64: @ 8011A64 + ldr r2, =gUnknown_03005000 + adds r3, r2, 0 + adds r3, 0xF1 + strb r0, [r3] + strh r1, [r2, 0xA] + bx lr + .pool + thumb_func_end sub_8011A64 + + thumb_func_start sub_8011A74 +sub_8011A74: @ 8011A74 + ldr r0, =gUnknown_03005000 + adds r0, 0xF1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_8011A74 + + thumb_func_start sub_8011A80 +sub_8011A80: @ 8011A80 + push {lr} + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + subs r0, 0x1 + cmp r0, 0x1 + bls _08011A94 + movs r0, 0 + b _08011A96 +_08011A94: + movs r0, 0x1 +_08011A96: + pop {r1} + bx r1 + thumb_func_end sub_8011A80 + + thumb_func_start sub_8011A9C +sub_8011A9C: @ 8011A9C + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000ce8 + adds r0, r1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_8011A9C + + thumb_func_start sub_8011AB0 +sub_8011AB0: @ 8011AB0 + ldr r0, =gUnknown_03005000 + ldrb r0, [r0, 0xC] + bx lr + .pool + thumb_func_end sub_8011AB0 + + thumb_func_start LinkVSync +LinkVSync: @ 8011ABC + push {lr} + bl rfu_syncVBlank_ + pop {r0} + bx r0 + thumb_func_end LinkVSync + + thumb_func_start sub_8011AC8 +sub_8011AC8: @ 8011AC8 + push {lr} + sub sp, 0x4 + movs r0, 0 + str r0, [sp] + ldr r1, =gUnknown_03003090 + ldr r2, =0x05000014 + mov r0, sp + bl CpuSet + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011AC8 + + thumb_func_start sub_8011AE8 +sub_8011AE8: @ 8011AE8 + push {lr} + bl LoadOam + bl ProcessSpriteCopyRequests + bl TransferPlttBuffer + pop {r0} + bx r0 + thumb_func_end sub_8011AE8 + + thumb_func_start sub_8011AFC +sub_8011AFC: @ 8011AFC + push {r4,lr} + bl ResetSpriteData + bl FreeAllSpritePalettes + bl ResetTasks + bl ResetPaletteFade + ldr r0, =sub_8011AE8 + bl SetVBlankCallback + bl sub_80093CC + lsls r0, 24 + cmp r0, 0 + beq _08011B70 + ldr r1, =gUnknown_020229C6 + ldr r2, =0x00001111 + adds r0, r2, 0 + strh r0, [r1] + bl sub_800B488 + bl sub_8009734 + ldr r0, =gMain + ldrh r0, [r0, 0x24] + bl SeedRng + movs r4, 0 +_08011B38: + bl Random + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + adds r1, 0xA + adds r1, r4 + strb r0, [r1] + adds r4, 0x1 + cmp r4, 0x3 + ble _08011B38 + movs r1, 0xAA + lsls r1, 5 + movs r0, 0 + bl SetGpuReg + bl RunTasks + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade + bl sub_8011BA4 + ldr r0, =sub_8011BF8 + bl SetMainCallback2 +_08011B70: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011AFC + + thumb_func_start sub_8011B90 +sub_8011B90: @ 8011B90 + push {lr} + ldr r0, =sub_800EB44 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8011B90 + + thumb_func_start sub_8011BA4 +sub_8011BA4: @ 8011BA4 + push {r4,lr} + ldr r4, =nullsub_89 + adds r0, r4, 0 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _08011BC2 + adds r0, r4, 0 + movs r1, 0 + bl CreateTask + ldr r1, =gUnknown_03005000 + adds r1, 0x66 + strb r0, [r1] +_08011BC2: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011BA4 + + thumb_func_start sub_8011BD0 +sub_8011BD0: @ 8011BD0 + push {lr} + ldr r0, =nullsub_89 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08011BEA + ldr r0, =gUnknown_03005000 + adds r0, 0x66 + ldrb r0, [r0] + bl DestroyTask +_08011BEA: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011BD0 + + thumb_func_start sub_8011BF8 +sub_8011BF8: @ 8011BF8 + push {lr} + bl RunTasks + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade + pop {r0} + bx r0 + thumb_func_end sub_8011BF8 + + thumb_func_start sub_8011C10 +sub_8011C10: @ 8011C10 + push {r4-r6,lr} + adds r4, r0, 0 + ldr r1, =gUnknown_03005000 + movs r0, 0x1 + strb r0, [r1, 0xC] + bl sub_8010F48 + ldr r0, =sub_801120C + movs r1, 0 + bl sub_800BF4C + ldr r2, =gUnknown_02022B2C + adds r1, r2, 0 + ldr r0, =gUnknown_082ED608 + ldm r0!, {r3,r5,r6} + stm r1!, {r3,r5,r6} + ldm r0!, {r3,r5,r6} + stm r1!, {r3,r5,r6} + ldr r0, =gUnknown_082ED620 + subs r4, 0x1 + adds r4, r0 + ldrb r0, [r4] + strh r0, [r2, 0x2] + bl sub_800EE78 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011C10 + + thumb_func_start sub_8011C5C +sub_8011C5C: @ 8011C5C + push {lr} + ldr r1, =gUnknown_03005000 + movs r0, 0 + strb r0, [r1, 0xC] + bl sub_8010F48 + ldr r0, =sub_8011404 + ldr r1, =sub_800ED34 + bl sub_800BF4C + bl sub_800EF00 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011C5C + + thumb_func_start sub_8011C84 +sub_8011C84: @ 8011C84 + push {r4-r7,lr} + ldr r4, =gUnknown_03005000 + movs r5, 0 + movs r0, 0x2 + strb r0, [r4, 0xC] + bl sub_8010F48 + ldr r0, =sub_8011674 + movs r1, 0 + bl sub_800BF4C + ldr r2, =gUnknown_02022B2C + adds r1, r2, 0 + ldr r0, =gUnknown_082ED608 + ldm r0!, {r3,r6,r7} + stm r1!, {r3,r6,r7} + ldm r0!, {r3,r6,r7} + stm r1!, {r3,r6,r7} + strb r5, [r2, 0x11] + movs r0, 0x96 + lsls r0, 2 + strh r0, [r2, 0x12] + ldr r0, =sub_800EB44 + movs r1, 0x1 + bl CreateTask + adds r4, 0x67 + strb r0, [r4] + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011C84 + + thumb_func_start sub_8011CD8 +sub_8011CD8: @ 8011CD8 + ldrb r1, [r0, 0x1] + lsls r1, 8 + ldrb r0, [r0] + orrs r0, r1 + bx lr + thumb_func_end sub_8011CD8 + + thumb_func_start sub_8011CE4 +sub_8011CE4: @ 8011CE4 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + str r0, [sp] + lsls r1, 16 + lsrs r1, 16 + mov r10, r1 + movs r0, 0xFF + mov r9, r0 + movs r7, 0 + ldr r1, =gUnknown_03007890 + mov r8, r1 +_08011D02: + lsls r4, r7, 5 + adds r5, r4, 0 + adds r5, 0x14 + mov r1, r8 + ldr r0, [r1] + adds r0, r5 + adds r0, 0x8 + bl sub_8011CD8 + lsls r0, 16 + lsrs r6, r0, 16 + mov r1, r8 + ldr r0, [r1] + adds r0, r4 + ldrh r0, [r0, 0x18] + bl sub_8010454 + cmp r0, 0 + beq _08011D4C + mov r0, r8 + ldr r1, [r0] + adds r1, r5 + adds r1, 0x15 + ldr r0, [sp] + bl StringCompare + cmp r0, 0 + bne _08011D4C + cmp r10, r6 + bne _08011D4C + mov r9, r7 + mov r1, r8 + ldr r0, [r1] + adds r0, r4 + ldrb r0, [r0, 0x16] + cmp r0, 0xFF + bne _08011D56 +_08011D4C: + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + cmp r7, 0x3 + bls _08011D02 +_08011D56: + mov r0, r9 + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8011CE4 + + thumb_func_start sub_8011D6C +sub_8011D6C: @ 8011D6C + push {r4-r6,lr} + adds r6, r0, 0 + lsls r0, r6, 24 + lsrs r0, 24 + bl rfu_REQ_disconnect + bl rfu_waitREQComplete + ldr r4, =gUnknown_03005000 + ldr r0, =0x00000ce2 + adds r5, r4, r0 + ldrb r0, [r5] + bics r0, r6 + strb r0, [r5] + ldr r1, =0x00000cda + adds r6, r4, r1 + ldrb r1, [r6] + movs r0, 0x1 + bl rfu_clearSlot + ldrb r0, [r5] + ldr r1, =0x00000c87 + adds r4, r1 + adds r1, r4, 0 + movs r2, 0x46 + bl rfu_UNI_setSendData + ldrb r0, [r5] + bl sub_800E87C + strb r0, [r6] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011D6C + + .align 2, 0 @ don't pad with nop diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s new file mode 100644 index 000000000..8185238bd --- /dev/null +++ b/asm/rom_8011DC0.s @@ -0,0 +1,56949 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .syntax unified + + .text + + thumb_func_start sub_8011DC0 +sub_8011DC0: @ 8011DC0 + push {lr} + lsls r1, 16 + lsrs r1, 16 + bl sub_8011CE4 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xFF + beq _08011DDA + movs r0, 0x1 + lsls r0, r1 + bl sub_8011D6C +_08011DDA: + pop {r0} + bx r0 + thumb_func_end sub_8011DC0 + + thumb_func_start sub_8011DE0 +sub_8011DE0: @ 8011DE0 + push {r4-r6,lr} + adds r4, r0, 0 + cmp r4, 0 + beq _08011E20 + movs r3, 0 + movs r2, 0 + ldr r5, =gUnknown_03005CDE + adds r6, r5, 0x4 +_08011DF0: + adds r0, r2, r5 + ldrb r0, [r0] + cmp r0, r4 + bne _08011E0E + ldrb r0, [r6] + asrs r0, r2 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08011E0E + adds r0, r1, 0 + lsls r0, r2 + orrs r3, r0 + lsls r0, r3, 24 + lsrs r3, r0, 24 +_08011E0E: + adds r2, 0x1 + cmp r2, 0x3 + ble _08011DF0 + cmp r3, 0 + beq _08011E20 + adds r0, r3, 0 + movs r1, 0x2 + bl sub_8011E94 +_08011E20: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011DE0 + + thumb_func_start sub_8011E2C +sub_8011E2C: @ 8011E2C + push {r4-r6,lr} + lsls r0, 24 + lsrs r4, r0, 24 + ldr r6, =gUnknown_03003110 + ldrh r0, [r6] + cmp r0, 0 + bne _08011E7A + ldr r5, =gUnknown_03005000 + ldr r1, =0x00000ce8 + adds r0, r5, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _08011E7A + movs r0, 0xED + lsls r0, 8 + bl sub_800FD14 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldrh r1, [r0, 0x8] + strh r1, [r6, 0x2] + ldrh r1, [r0, 0xA] + strh r1, [r6, 0x4] + ldr r1, =gUnknown_082ED695 + movs r2, 0x8 + ldrsh r0, [r0, r2] + adds r0, r1 + ldrb r1, [r5, 0xD] + ldrb r0, [r0] + subs r1, r0 + strb r1, [r5, 0xD] + ldrb r0, [r5, 0xD] + strh r0, [r6, 0x6] + adds r0, r4, 0 + bl DestroyTask +_08011E7A: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011E2C + + thumb_func_start sub_8011E94 +sub_8011E94: @ 8011E94 + push {r4-r6,lr} + adds r4, r0, 0 + adds r6, r1, 0 + ldr r5, =sub_8011E2C + adds r0, r5, 0 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + bne _08011ECC + adds r0, r5, 0 + movs r1, 0x5 + bl CreateTask + lsls r0, 24 + lsrs r2, r0, 24 + ldr r1, =gTasks + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r1 + strh r4, [r0, 0x8] + b _08011EDC + .pool +_08011ECC: + ldr r0, =gTasks + lsls r1, r2, 2 + adds r1, r2 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x8] + orrs r4, r0 + strh r4, [r1, 0x8] +_08011EDC: + ldr r1, =gTasks + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r1 + strh r6, [r0, 0xA] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011E94 + + thumb_func_start sub_8011EF4 +sub_8011EF4: @ 8011EF4 + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + bl sub_800EE94 + lsls r0, 24 + cmp r0, 0 + beq _08011FA4 + adds r0, r4, 0 + adds r0, 0x10 + bl sub_8011CD8 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + bl sub_8011CE4 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + beq _08011F8C + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + lsls r1, r2, 5 + adds r0, r1 + ldrb r0, [r0, 0x16] + cmp r0, 0xFF + beq _08011F5C + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000c3d + adds r0, r1 + strb r2, [r0] + bl sub_800EEBC + cmp r0, 0 + beq _08011FAA + b _08011F84 + .pool +_08011F5C: + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r5, 0x7F + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0x15 + beq _08011FA4 + bl sub_800F7DC + ldrb r1, [r0, 0xA] + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0x16 + beq _08011FA4 + movs r1, 0xE0 + lsls r1, 7 + movs r0, 0x2 + bl sub_8011A64 +_08011F84: + adds r0, r6, 0 + bl DestroyTask + b _08011FAA +_08011F8C: + ldrh r0, [r4, 0x1E] + adds r0, 0x1 + strh r0, [r4, 0x1E] + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000c3d + adds r0, r1 + strb r2, [r0] + b _08011FAA + .pool +_08011FA4: + ldrh r0, [r4, 0x1E] + adds r0, 0x1 + strh r0, [r4, 0x1E] +_08011FAA: + movs r1, 0x1E + ldrsh r0, [r4, r1] + cmp r0, 0xF0 + ble _08011FC2 + movs r1, 0xE0 + lsls r1, 7 + movs r0, 0x2 + bl sub_8011A64 + adds r0, r6, 0 + bl DestroyTask +_08011FC2: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8011EF4 + + thumb_func_start sub_8011FC8 +sub_8011FC8: @ 8011FC8 + push {r4-r6,lr} + adds r6, r0, 0 + lsls r5, r1, 16 + lsrs r5, 16 + ldr r0, =gUnknown_03005000 + adds r0, 0xF1 + movs r1, 0 + strb r1, [r0] + ldr r0, =sub_8011EF4 + movs r1, 0x3 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + lsls r4, r0, 2 + adds r4, r0 + lsls r4, 3 + ldr r0, =gTasks + 0x8 + adds r4, r0 + adds r0, r4, 0 + adds r1, r6, 0 + bl StringCopy + strh r5, [r4, 0x10] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011FC8 + + thumb_func_start sub_801200C +sub_801200C: @ 801200C + push {r4,r5,lr} + adds r4, r1, 0 + lsls r0, 16 + lsrs r5, r0, 16 + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r2, 0x7F + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0x45 + bne _08012032 + ldrb r1, [r4, 0xA] + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0x45 + beq _08012092 +_0801202E: + movs r0, 0x1 + b _08012094 +_08012032: + ldrb r1, [r4, 0xA] + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0x40 + bne _0801202E + cmp r5, 0x44 + bne _08012092 + ldr r5, =gUnknown_0300510A + ldrh r0, [r5, 0x8] + ldr r3, =0x000003ff + adds r2, r3, 0 + ands r2, r0 + movs r0, 0xCE + lsls r0, 1 + cmp r2, r0 + bne _08012068 + ldrh r1, [r4, 0x8] + adds r0, r3, 0 + ands r0, r1 + cmp r0, r2 + beq _08012092 + b _0801202E + .pool +_08012068: + ldrh r1, [r4, 0x8] + adds r0, r3, 0 + ands r0, r1 + cmp r0, r2 + bne _0801202E + ldrb r2, [r4, 0xB] + movs r0, 0xFE + ldrb r3, [r5, 0xB] + adds r1, r0, 0 + ands r1, r2 + ands r0, r3 + cmp r1, r0 + bne _0801202E + ldrb r2, [r4, 0x9] + movs r0, 0xFC + ldrb r3, [r5, 0x9] + adds r1, r0, 0 + ands r1, r2 + ands r0, r3 + cmp r1, r0 + bne _0801202E +_08012092: + movs r0, 0 +_08012094: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_801200C + + thumb_func_start sub_801209C +sub_801209C: @ 801209C + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r5, r0, 24 + mov r8, r5 + ldr r6, =gUnknown_03005000 + adds r0, r6, 0 + adds r0, 0xF1 + ldrb r0, [r0] + cmp r0, 0x4 + bne _080120BA + adds r0, r5, 0 + bl DestroyTask +_080120BA: + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r4, r0, r1 + ldrh r0, [r4, 0x8] + adds r0, 0x1 + strh r0, [r4, 0x8] + lsls r0, 16 + movs r1, 0x96 + lsls r1, 17 + cmp r0, r1 + ble _080120E4 + movs r1, 0xE0 + lsls r1, 7 + movs r0, 0x2 + bl sub_8011A64 + adds r0, r5, 0 + bl DestroyTask +_080120E4: + ldr r1, =0x00000ccd + adds r0, r6, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0801217C + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x6] + cmp r0, 0 + bne _0801217C + movs r2, 0x86 + lsls r2, 1 + adds r0, r6, r2 + bl sub_8011CD8 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + ldr r2, =0x00000119 + adds r0, r6, r2 + bl sub_8011CE4 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + beq _0801217C + movs r1, 0xA + ldrsh r0, [r4, r1] + ldr r7, =gUnknown_03007890 + lsls r4, r2, 5 + adds r2, r4, 0 + adds r2, 0x14 + ldr r1, [r7] + adds r1, r2 + adds r1, 0x6 + bl sub_801200C + cmp r0, 0 + bne _0801216C + ldr r0, [r7] + adds r1, r0, r4 + ldrb r0, [r1, 0x16] + cmp r0, 0xFF + beq _0801217C + ldrh r0, [r1, 0x14] + movs r1, 0x5A + bl sub_800C12C + lsls r0, 24 + cmp r0, 0 + bne _0801217C + movs r0, 0xA + strh r0, [r6, 0x4] + adds r0, r5, 0 + bl DestroyTask + b _0801217C + .pool +_0801216C: + movs r1, 0xE0 + lsls r1, 7 + movs r0, 0x2 + bl sub_8011A64 + mov r0, r8 + bl DestroyTask +_0801217C: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_801209C + + thumb_func_start sub_8012188 +sub_8012188: @ 8012188 + push {r4-r7,lr} + adds r3, r0, 0 + adds r5, r1, 0 + lsls r4, r2, 24 + lsrs r4, 24 + ldr r6, =gUnknown_03005000 + ldr r1, =0x00000ccf + adds r0, r6, r1 + movs r7, 0 + strb r7, [r0] + adds r0, r6, 0 + adds r0, 0xF1 + strb r7, [r0] + ldr r1, =0x00000119 + adds r0, r6, r1 + adds r1, r3, 0 + bl StringCopy + movs r1, 0x85 + lsls r1, 1 + adds r0, r6, r1 + adds r1, r5, 0 + movs r2, 0xD + bl memcpy + bl sub_800D658 + ldr r0, =sub_801209C + movs r1, 0x2 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r5, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r5 + strh r4, [r1, 0xA] + ldr r0, =sub_800EB44 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r1, r0, 24 + adds r2, r1, 0 + cmp r4, 0x45 + bne _08012210 + cmp r1, 0xFF + beq _0801221E + lsls r0, r1, 2 + adds r0, r1 + lsls r0, 3 + adds r0, r5 + movs r1, 0x1 + strh r1, [r0, 0x16] + b _0801221E + .pool +_08012210: + cmp r2, 0xFF + beq _0801221E + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r5 + strh r7, [r0, 0x16] +_0801221E: + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8012188 + + thumb_func_start sub_8012224 +sub_8012224: @ 8012224 + push {lr} + ldr r0, =gUnknown_03005000 + adds r0, 0xF0 + ldrb r0, [r0] + cmp r0, 0x1 + beq _08012238 + movs r0, 0 + b _0801223A + .pool +_08012238: + movs r0, 0x1 +_0801223A: + pop {r1} + bx r1 + thumb_func_end sub_8012224 + + thumb_func_start sub_8012240 +sub_8012240: @ 8012240 + push {r4,lr} + movs r1, 0 + ldr r0, =gUnknown_03004140 + ldrb r2, [r0] + ldr r4, =gUnknown_03005CD1 + movs r3, 0x1 +_0801224C: + adds r0, r2, 0 + asrs r0, r1 + ands r0, r3 + cmp r0, 0 + beq _0801226C + adds r0, r1, r4 + ldrb r0, [r0] + cmp r0, 0 + bne _0801226C + movs r0, 0 + b _08012274 + .pool +_0801226C: + adds r1, 0x1 + cmp r1, 0x3 + ble _0801224C + movs r0, 0x1 +_08012274: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8012240 + + thumb_func_start sub_801227C +sub_801227C: @ 801227C + push {r4,lr} + movs r4, 0 +_08012280: + lsls r2, r4, 24 + lsrs r2, 24 + ldr r0, =gUnknown_082ED82C + movs r1, 0 + bl nullsub_5 + adds r4, 0x1 + cmp r4, 0x13 + ble _08012280 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801227C + + thumb_func_start sub_801229C +sub_801229C: @ 801229C + push {r4-r7,lr} + mov r7, r8 + push {r7} + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x1C + movs r2, 0x13 + movs r3, 0x2 + bl nullsub_13 + ldr r4, =gUnknown_03007890 + ldr r0, [r4] + ldrb r0, [r0, 0x2] + movs r1, 0x14 + movs r2, 0x1 + movs r3, 0x1 + bl nullsub_13 + ldr r0, [r4] + ldrb r0, [r0, 0x3] + movs r1, 0x17 + movs r2, 0x1 + movs r3, 0x1 + bl nullsub_13 + ldr r0, =gUnknown_03005000 + ldrb r0, [r0, 0xC] + cmp r0, 0x1 + bne _08012378 + movs r6, 0 + adds r7, r4, 0 + movs r5, 0x14 +_080122E0: + ldr r2, [r7] + ldrb r0, [r2, 0x7] + asrs r0, r6 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0801231E + lsls r0, r6, 5 + adds r0, r2, r0 + ldrh r0, [r0, 0x18] + adds r4, r6, 0x3 + lsls r4, 24 + lsrs r4, 24 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, [r7] + adds r0, r5 + adds r0, 0x6 + movs r1, 0x6 + adds r2, r4, 0 + bl nullsub_5 + ldr r0, [r7] + adds r0, r5 + adds r0, 0x15 + movs r1, 0x16 + adds r2, r4, 0 + bl nullsub_5 +_0801231E: + adds r5, 0x20 + adds r6, 0x1 + cmp r6, 0x3 + ble _080122E0 + movs r6, 0 + ldr r0, =gUnknown_03005000 + mov r8, r0 +_0801232C: + movs r5, 0 + adds r7, r6, 0x1 + lsls r0, r6, 3 + adds r2, r6, 0 + adds r2, 0xB + subs r0, r6 + lsls r0, 1 + mov r1, r8 + adds r1, 0x14 + adds r4, r0, r1 + lsls r6, r2, 24 +_08012342: + ldrb r0, [r4] + lsls r1, r5, 25 + lsrs r1, 24 + lsrs r2, r6, 24 + movs r3, 0x2 + bl nullsub_13 + adds r4, 0x1 + adds r5, 0x1 + cmp r5, 0xD + ble _08012342 + adds r6, r7, 0 + cmp r6, 0x3 + ble _0801232C + ldr r0, =gUnknown_082ED868 + movs r1, 0x1 + movs r2, 0xF + bl nullsub_5 + b _080124AA + .pool +_08012378: + ldr r1, [r4] + ldrb r0, [r1, 0x2] + cmp r0, 0 + beq _08012414 + ldrb r0, [r1, 0x7] + cmp r0, 0 + beq _08012414 + movs r6, 0 + movs r5, 0xC0 + lsls r5, 18 +_0801238C: + lsrs r4, r5, 24 + movs r0, 0 + movs r1, 0x1 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, =gUnknown_082ED84B + movs r1, 0x6 + adds r2, r4, 0 + bl nullsub_5 + ldr r0, =gUnknown_082ED85B + movs r1, 0x16 + adds r2, r4, 0 + bl nullsub_5 + movs r1, 0x80 + lsls r1, 17 + adds r5, r1 + adds r6, 0x1 + cmp r6, 0x3 + ble _0801238C + ldr r5, =gUnknown_03007890 + ldr r1, [r5] + ldr r4, =gUnknown_03005000 + ldr r0, =0x00000c3e + adds r4, r0 + ldrb r0, [r4] + lsls r0, 5 + adds r1, r0 + ldrh r0, [r1, 0x18] + movs r1, 0x1 + movs r2, 0x3 + movs r3, 0x4 + bl nullsub_13 + ldrb r1, [r4] + lsls r1, 5 + adds r1, 0x14 + ldr r0, [r5] + adds r0, r1 + adds r0, 0x6 + movs r1, 0x6 + movs r2, 0x3 + bl nullsub_5 + ldrb r1, [r4] + lsls r1, 5 + adds r1, 0x14 + ldr r0, [r5] + adds r0, r1 + adds r0, 0x15 + movs r1, 0x16 + movs r2, 0x3 + bl nullsub_5 + b _080124AA + .pool +_08012414: + movs r6, 0 + ldr r1, =gUnknown_03007890 + ldr r0, [r1] + ldrb r0, [r0, 0x8] + cmp r6, r0 + bge _08012470 + adds r7, r1, 0 + movs r1, 0x14 + mov r8, r1 +_08012426: + ldr r0, [r7] + lsls r5, r6, 5 + adds r1, r0, r5 + ldrb r0, [r1, 0x16] + cmp r0, 0xFF + beq _08012462 + ldrh r0, [r1, 0x18] + adds r4, r6, 0x3 + lsls r4, 24 + lsrs r4, 24 + movs r1, 0x1 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, [r7] + adds r0, r5 + ldrh r0, [r0, 0x14] + movs r1, 0x6 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, [r7] + add r0, r8 + adds r0, 0x15 + movs r1, 0x16 + adds r2, r4, 0 + bl nullsub_5 +_08012462: + movs r0, 0x20 + add r8, r0 + adds r6, 0x1 + ldr r0, [r7] + ldrb r0, [r0, 0x8] + cmp r6, r0 + blt _08012426 +_08012470: + cmp r6, 0x3 + bgt _080124AA + lsls r0, r6, 24 + movs r1, 0xC0 + lsls r1, 18 + adds r5, r0, r1 +_0801247C: + lsrs r4, r5, 24 + movs r0, 0 + movs r1, 0x1 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, =gUnknown_082ED84B + movs r1, 0x6 + adds r2, r4, 0 + bl nullsub_5 + ldr r0, =gUnknown_082ED85B + movs r1, 0x16 + adds r2, r4, 0 + bl nullsub_5 + movs r0, 0x80 + lsls r0, 17 + adds r5, r0 + adds r6, 0x1 + cmp r6, 0x3 + ble _0801247C +_080124AA: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801229C + + thumb_func_start sub_80124C0 +sub_80124C0: @ 80124C0 + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000c1a + adds r0, r1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_80124C0 + + thumb_func_start sub_80124D4 +sub_80124D4: @ 80124D4 + ldr r0, =gUnknown_03005000 + ldr r1, =0x000009e6 + adds r0, r1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_80124D4 + + thumb_func_start nullsub_89 +nullsub_89: @ 80124E8 + bx lr + thumb_func_end nullsub_89 + + thumb_func_start sub_80124EC +sub_80124EC: @ 80124EC + push {r4-r6,lr} + sub sp, 0x8 + adds r4, r1, 0 + lsls r0, 24 + lsrs r6, r0, 24 + lsls r4, 24 + lsrs r4, 24 + lsls r2, 24 + lsrs r5, r2, 24 + adds r0, r6, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + lsls r4, 8 + movs r0, 0x90 + lsls r0, 6 + cmp r4, r0 + beq _08012588 + cmp r4, r0 + bgt _08012526 + movs r0, 0x80 + lsls r0, 2 + cmp r4, r0 + beq _08012538 + movs r0, 0x80 + lsls r0, 3 + cmp r4, r0 + beq _08012544 + b _080125A6 +_08012526: + movs r0, 0x94 + lsls r0, 6 + cmp r4, r0 + beq _08012554 + movs r0, 0xD4 + lsls r0, 6 + cmp r4, r0 + beq _08012564 + b _080125A6 +_08012538: + ldr r1, =gUnknown_082EDB60 + subs r0, r5, 0x1 + lsls r0, 2 + b _0801256C + .pool +_08012544: + ldr r1, =gUnknown_082EDB60 + subs r0, r5, 0x1 + lsls r0, 2 + adds r1, 0x14 + b _0801256C + .pool +_08012554: + ldr r1, =gUnknown_082EDB60 + subs r0, r5, 0x1 + lsls r0, 2 + adds r1, 0x28 + b _0801256C + .pool +_08012564: + ldr r1, =gUnknown_082EDB60 + subs r0, r5, 0x1 + lsls r0, 2 + adds r1, 0x3C +_0801256C: + adds r0, r1 + ldr r2, [r0] + movs r0, 0x1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + adds r0, r6, 0 + movs r1, 0x1 + movs r3, 0 + bl sub_80173E0 + b _080125A6 + .pool +_08012588: + ldr r1, =gUnknown_082EDB60 + subs r0, r5, 0x1 + lsls r0, 2 + adds r1, 0x50 + adds r0, r1 + ldr r2, [r0] + movs r0, 0x1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + adds r0, r6, 0 + movs r1, 0x1 + movs r3, 0 + bl sub_80173E0 +_080125A6: + adds r0, r6, 0 + movs r1, 0x2 + bl CopyWindowToVram + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80124EC + + thumb_func_start sub_80125BC +sub_80125BC: @ 80125BC + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x28 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r6, =gSaveBlock2Ptr + ldr r2, [r6] + movs r0, 0x1 + str r0, [sp] + movs r0, 0 + mov r8, r0 + str r0, [sp, 0x4] + adds r0, r4, 0 + movs r1, 0x1 + movs r3, 0 + bl sub_80173E0 + ldr r1, =gText_UnkCtrlCodeF907 + add r0, sp, 0x8 + bl StringCopy + adds r5, r0, 0 + ldr r0, [r6] + adds r0, 0xA + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r5, 0 + movs r2, 0x2 + movs r3, 0x5 + bl ConvertIntToDecimalStringN + movs r0, 0x11 + str r0, [sp] + mov r0, r8 + str r0, [sp, 0x4] + adds r0, r4, 0 + movs r1, 0x1 + add r2, sp, 0x8 + movs r3, 0 + bl sub_80173E0 + add sp, 0x28 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80125BC + + thumb_func_start sub_801262C +sub_801262C: @ 801262C + push {lr} + lsls r1, 24 + lsrs r1, 24 + subs r0, r1, 0x1 + cmp r0, 0x1B + bhi _080126C0 + lsls r0, 2 + ldr r1, =_08012648 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08012648: + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126C0 + .4byte _080126C0 + .4byte _080126C0 + .4byte _080126C0 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126C0 + .4byte _080126C0 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126C0 + .4byte _080126C0 + .4byte _080126C0 + .4byte _080126C0 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 + .4byte _080126B8 +_080126B8: + ldr r0, =gStringVar4 + ldr r1, =gText_AwaitingCommunication + bl StringExpandPlaceholders +_080126C0: + pop {r0} + bx r0 + .pool + thumb_func_end sub_801262C + + thumb_func_start sub_80126CC +sub_80126CC: @ 80126CC + push {lr} + subs r0, 0x9 + cmp r0, 0x12 + bhi _08012734 + lsls r0, 2 + ldr r1, =_080126E4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080126E4: + .4byte _08012730 + .4byte _08012730 + .4byte _08012730 + .4byte _08012734 + .4byte _08012734 + .4byte _08012734 + .4byte _08012730 + .4byte _08012730 + .4byte _08012734 + .4byte _08012734 + .4byte _08012734 + .4byte _08012734 + .4byte _08012734 + .4byte _08012734 + .4byte _08012730 + .4byte _08012730 + .4byte _08012730 + .4byte _08012730 + .4byte _08012730 +_08012730: + movs r0, 0x1 + b _08012736 +_08012734: + movs r0, 0 +_08012736: + pop {r1} + bx r1 + thumb_func_end sub_80126CC + + thumb_func_start BerryBlenderLinkBecomeLeader +BerryBlenderLinkBecomeLeader: @ 801273C + push {lr} + ldr r0, =sub_8012780 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gUnknown_02022C30 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r1, r0 + str r1, [r2] + ldr r0, =gUnknown_03000DA0 + str r1, [r0] + movs r0, 0 + strb r0, [r1, 0xC] + strb r0, [r1, 0xD] + ldr r1, =gScriptResult + strh r0, [r1] + pop {r0} + bx r0 + .pool + thumb_func_end BerryBlenderLinkBecomeLeader + + thumb_func_start sub_8012780 +sub_8012780: @ 8012780 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x8 + lsls r0, 24 + lsrs r4, r0, 24 + ldr r0, =gUnknown_02022C30 + ldr r6, [r0] + ldrb r0, [r6, 0xC] + cmp r0, 0x1E + bls _0801279A + bl _08012F50 +_0801279A: + lsls r0, 2 + ldr r1, =_080127AC + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080127AC: + .4byte _08012828 + .4byte _08012F50 + .4byte _08012F50 + .4byte _080128A0 + .4byte _080129C8 + .4byte _08012A50 + .4byte _08012A6C + .4byte _08012B8C + .4byte _08012F50 + .4byte _08012AFC + .4byte _08012B14 + .4byte _08012BA8 + .4byte _08012C5C + .4byte _08012D5A + .4byte _08012D78 + .4byte _08012D8A + .4byte _08012DA8 + .4byte _08012E62 + .4byte _08012E78 + .4byte _08012DF2 + .4byte _08012E10 + .4byte _08012ED0 + .4byte _08012EFC + .4byte _08012ED0 + .4byte _08012EE6 + .4byte _08012F50 + .4byte _08012F14 + .4byte _08012F50 + .4byte _08012F50 + .4byte _08012B54 + .4byte _08012EB6 +_08012828: + ldr r0, =gSpecialVar_0x8004 + ldrh r2, [r0] + adds r3, r0, 0 + cmp r2, 0x14 + bne _08012848 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000ca9 + adds r0, r1 + ldrb r1, [r0] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _08012848 + adds r0, r2, 0x1 + strh r0, [r3] +_08012848: + ldr r2, =gUnknown_02022C2C + ldr r1, =gUnknown_082F00C4 + ldrh r0, [r3] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + strb r0, [r2] + ldr r4, =gUnknown_02022C2D + ldrh r0, [r3] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + lsrs r0, 8 + strb r0, [r4] + ldrb r0, [r2] + movs r1, 0 + movs r2, 0 + bl sub_8010F84 + bl sub_800B488 + bl sub_8009734 + ldrb r1, [r4] + movs r0, 0xF + ands r0, r1 + bl sub_8011C10 + movs r0, 0x3 + strb r0, [r6, 0xC] + b _08012F50 + .pool +_080128A0: + movs r0, 0x70 + bl AllocZeroed + str r0, [r6, 0x4] + movs r0, 0xA0 + bl AllocZeroed + str r0, [r6] + movs r0, 0xA0 + bl AllocZeroed + str r0, [r6, 0x8] + ldr r0, [r6, 0x4] + movs r1, 0x4 + bl sub_80175EC + ldr r0, [r6] + movs r1, 0x5 + bl sub_8017580 + ldr r0, [r6] + adds r1, r0, 0 + adds r1, 0x10 + bl sub_800DF90 + ldr r1, [r6] + movs r3, 0 + movs r0, 0 + strh r0, [r1, 0x18] + ldr r2, [r6] + ldrb r1, [r2, 0x1A] + subs r0, 0x4 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0x1A] + ldr r2, [r6] + ldrb r1, [r2, 0x1A] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0x1A] + ldr r0, [r6] + strb r3, [r0, 0x1B] + ldr r0, [r6, 0x4] + movs r1, 0xFF + bl sub_8016FC0 + strb r0, [r6, 0x17] + ldr r0, =gUnknown_082F00BC + bl AddWindow + strb r0, [r6, 0x10] + ldr r0, =gUnknown_02022C2D + ldrb r0, [r0] + movs r1, 0xF + ands r1, r0 + cmp r1, 0x2 + blt _08012938 + cmp r1, 0x4 + ble _08012928 + cmp r1, 0x5 + beq _08012930 + b _08012938 + .pool +_08012928: + ldr r0, =gUnknown_082F011C + b _08012932 + .pool +_08012930: + ldr r0, =gUnknown_082F0124 +_08012932: + bl AddWindow + strb r0, [r6, 0xF] +_08012938: + ldr r0, =gUnknown_082F012C + bl AddWindow + strb r0, [r6, 0x11] + ldrb r0, [r6, 0x10] + movs r1, 0x22 + bl FillWindowPixelBuffer + ldrb r0, [r6, 0x10] + ldr r2, =gUnknown_082EDBC4 + movs r3, 0x1 + mov r8, r3 + str r3, [sp] + movs r4, 0x4 + str r4, [sp, 0x4] + movs r1, 0 + movs r3, 0x8 + bl sub_80173E0 + ldrb r0, [r6, 0x10] + bl PutWindowTilemap + ldrb r0, [r6, 0x10] + movs r1, 0x2 + bl CopyWindowToVram + ldrb r0, [r6, 0xF] + movs r1, 0 + bl sub_81973FC + ldr r0, =gUnknown_03006310 + adds r2, r0, 0 + ldr r1, =gUnknown_082F015C + ldm r1!, {r3,r5,r7} + stm r2!, {r3,r5,r7} + ldm r1!, {r3,r5,r7} + stm r2!, {r3,r5,r7} + ldrb r1, [r6, 0xF] + strb r1, [r0, 0x10] + movs r1, 0 + movs r2, 0 + bl ListMenuInit + strb r0, [r6, 0x12] + ldrb r0, [r6, 0x11] + movs r1, 0 + bl sub_81973FC + ldrb r0, [r6, 0x11] + bl PutWindowTilemap + ldrb r0, [r6, 0x11] + movs r1, 0x2 + bl CopyWindowToVram + movs r0, 0 + bl CopyBgTilemapBufferToVram + mov r5, r8 + strb r5, [r6, 0x13] + strb r4, [r6, 0xC] + b _08012F50 + .pool +_080129C8: + ldr r0, =gStringVar1 + ldr r2, =gUnknown_082F0048 + ldr r4, =gUnknown_02022C2C + ldrb r1, [r4] + lsls r1, 2 + adds r1, r2 + ldr r1, [r1] + bl StringCopy + ldr r0, =gUnknown_02022C2D + ldrb r2, [r0] + lsrs r0, r2, 4 + cmp r0, 0 + beq _08012A2C + ldrb r1, [r6, 0x13] + subs r0, 0x1 + cmp r1, r0 + ble _08012A18 + movs r0, 0xF + ands r0, r2 + cmp r0, 0 + beq _08012A18 + ldr r0, =gStringVar4 + ldr r1, =gText_AwaitingLink + bl StringExpandPlaceholders + b _08012A34 + .pool +_08012A18: + ldr r0, =gStringVar4 + ldr r1, =gText_AwaitingCommunication + bl StringExpandPlaceholders + b _08012A34 + .pool +_08012A2C: + ldr r0, =gStringVar4 + ldrb r1, [r4] + bl sub_801262C +_08012A34: + ldrb r0, [r6, 0x11] + ldr r1, =gUnknown_02022C2D + ldrb r1, [r1] + ldrb r2, [r6, 0x13] + bl sub_80124EC + movs r0, 0x5 + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012A50: + adds r0, r6, 0 + adds r0, 0xD + ldr r1, =gStringVar4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08012A62 + b _08012F50 +_08012A62: + movs r0, 0x6 + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012A6C: + adds r0, r6, 0 + movs r1, 0x7 + movs r2, 0xA + bl sub_801320C + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _08012AA8 + ldrb r0, [r6, 0x13] + cmp r0, 0x1 + bne _08012A90 + movs r0, 0x17 + b _08012AA6 + .pool +_08012A90: + ldr r0, =gUnknown_02022C2D + ldrb r1, [r0] + movs r0, 0xF0 + ands r0, r1 + cmp r0, 0 + beq _08012AA4 + movs r0, 0x1E + b _08012AA6 + .pool +_08012AA4: + movs r0, 0x13 +_08012AA6: + strb r0, [r6, 0xC] +_08012AA8: + ldr r0, =gUnknown_02022C2D + ldrb r2, [r0] + lsrs r0, r2, 4 + cmp r0, 0 + beq _08012ADE + ldrb r1, [r6, 0x13] + subs r0, 0x1 + cmp r1, r0 + ble _08012ADE + movs r4, 0xF + adds r0, r4, 0 + ands r0, r2 + cmp r0, 0 + beq _08012ADE + bl sub_8012240 + cmp r0, 0 + beq _08012ADE + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x8 + ands r0, r1 + cmp r0, 0 + beq _08012ADE + strb r4, [r6, 0xC] + bl sub_800EF38 +_08012ADE: + ldrb r0, [r6, 0xC] + cmp r0, 0x6 + beq _08012AE6 + b _08012F50 +_08012AE6: + bl sub_80105EC + cmp r0, 0 + bne _08012AF0 + b _08012F50 +_08012AF0: + b _08012C56 + .pool +_08012AFC: + bl sub_80105EC + cmp r0, 0 + beq _08012B06 + b _08012F50 +_08012B06: + movs r0, 0x6 + strb r0, [r6, 0xC] + ldr r0, [r6] + bl sub_8013398 + strb r0, [r6, 0x13] + b _08012F50 +_08012B14: + movs r3, 0 + ldr r0, =gUnknown_02022C2C + ldrb r1, [r0] + movs r0, 0xF + ands r0, r1 + cmp r0, 0x2 + bne _08012B24 + movs r3, 0x1 +_08012B24: + adds r0, r6, 0 + adds r0, 0xD + ldr r2, =gUnknown_082EDDC4 + lsls r1, r3, 2 + adds r1, r2 + ldr r1, [r1] + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08012B3C + b _08012F50 +_08012B3C: + ldr r0, [r6] + bl sub_8013398 + strb r0, [r6, 0x13] + ldrb r0, [r6, 0x12] + bl sub_81AE70C + b _08012E5C + .pool +_08012B54: + ldr r0, =gUnknown_02022C2D + ldrb r0, [r0] + movs r1, 0xF + ands r1, r0 + movs r0, 0x2 + eors r1, r0 + negs r0, r1 + orrs r0, r1 + lsrs r3, r0, 31 + adds r0, r6, 0 + adds r0, 0xD + ldr r2, =gUnknown_082EDDC4 + lsls r1, r3, 2 + adds r1, r2 + ldr r1, [r1] + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08012B7E + b _08012F50 +_08012B7E: + movs r0, 0x15 + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012B8C: + adds r0, r6, 0 + adds r0, 0xD + ldr r1, =gStringVar4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08012B9E + b _08012F50 +_08012B9E: + movs r0, 0xB + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012BA8: + adds r4, r6, 0 + adds r4, 0xD + ldrb r1, [r6, 0x13] + lsls r1, 5 + ldr r0, [r6] + adds r0, r1 + adds r0, 0x2 + bl sub_8015658 + lsls r0, 16 + lsrs r0, 16 + ldrb r2, [r6, 0x13] + lsls r2, 5 + ldr r1, [r6] + adds r1, r2 + adds r1, 0x10 + bl sub_801064C + adds r1, r0, 0 + adds r0, r4, 0 + bl sub_80170B8 + lsls r0, 24 + asrs r1, r0, 24 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _08012C28 + cmp r1, r0 + bgt _08012BEC + subs r0, 0x2 + cmp r1, r0 + beq _08012C56 + b _08012F50 +_08012BEC: + cmp r1, 0 + beq _08012BF6 + cmp r1, 0x1 + beq _08012C28 + b _08012F50 +_08012BF6: + bl sub_800E0E8 + movs r0, 0 + movs r1, 0 + bl sub_800DFB4 + movs r0, 0x5 + strb r0, [r6, 0x19] + ldrb r1, [r6, 0x13] + lsls r1, 5 + ldr r0, [r6] + adds r0, r1 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + ldrb r0, [r6, 0x13] + lsls r0, 5 + ldr r2, [r6] + adds r2, r0 + adds r2, 0x10 + movs r0, 0x5 + b _08012C4C +_08012C28: + movs r0, 0x6 + strb r0, [r6, 0x19] + ldrb r1, [r6, 0x13] + lsls r1, 5 + ldr r0, [r6] + adds r0, r1 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + ldrb r0, [r6, 0x13] + lsls r0, 5 + ldr r2, [r6] + adds r2, r0 + adds r2, 0x10 + movs r0, 0x6 +_08012C4C: + bl sub_8010688 + movs r0, 0xC + strb r0, [r6, 0xC] + b _08012F50 +_08012C56: + movs r0, 0x9 + strb r0, [r6, 0xC] + b _08012F50 +_08012C5C: + ldrb r1, [r6, 0x13] + lsls r1, 5 + ldr r0, [r6] + adds r0, r1 + adds r0, 0x2 + bl sub_8015658 + lsls r0, 16 + lsrs r0, 16 + ldrb r2, [r6, 0x13] + lsls r2, 5 + ldr r1, [r6] + adds r1, r2 + adds r1, 0x10 + bl sub_8010714 + cmp r0, 0x1 + bne _08012D4A + ldrb r0, [r6, 0x19] + cmp r0, 0x5 + bne _08012D04 + ldr r1, [r6] + ldrb r0, [r6, 0x13] + lsls r0, 5 + adds r1, r0 + movs r0, 0 + strb r0, [r1, 0x1B] + ldrb r0, [r6, 0x12] + bl sub_81AE70C + ldrb r0, [r6, 0x13] + adds r0, 0x1 + strb r0, [r6, 0x13] + ldr r1, =gUnknown_02022C2D + ldrb r1, [r1] + movs r3, 0xF + lsls r0, 24 + lsrs r2, r0, 24 + adds r0, r3, 0 + ands r0, r1 + cmp r2, r0 + bne _08012D40 + movs r0, 0xF0 + ands r0, r1 + cmp r0, 0 + bne _08012CBC + cmp r2, 0x4 + bne _08012CC4 +_08012CBC: + strb r3, [r6, 0xC] + b _08012CE0 + .pool +_08012CC4: + ldr r0, =gStringVar1 + ldrb r2, [r6, 0x13] + lsls r2, 5 + subs r2, 0x20 + ldr r1, [r6] + adds r1, r2 + bl sub_8018404 + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EDC9C + bl StringExpandPlaceholders + movs r0, 0xD + strb r0, [r6, 0xC] +_08012CE0: + bl sub_800EF38 + ldrb r0, [r6, 0x11] + ldr r1, =gUnknown_02022C2D + ldrb r1, [r1] + ldrb r2, [r6, 0x13] + bl sub_80124EC + b _08012D44 + .pool +_08012D04: + ldrb r1, [r6, 0x13] + lsls r1, 5 + ldr r0, [r6] + adds r0, r1 + adds r4, r0, 0 + adds r4, 0x10 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + bl sub_8011DC0 + ldr r1, [r6] + ldrb r0, [r6, 0x13] + lsls r0, 5 + adds r1, r0 + ldrb r2, [r1, 0x1A] + movs r0, 0x4 + negs r0, r0 + ands r0, r2 + strb r0, [r1, 0x1A] + ldr r0, [r6] + bl sub_8013398 + ldrb r0, [r6, 0x12] + bl sub_81AE70C +_08012D40: + movs r0, 0x4 + strb r0, [r6, 0xC] +_08012D44: + movs r0, 0 + strb r0, [r6, 0x19] + b _08012F50 +_08012D4A: + cmp r0, 0x2 + beq _08012D50 + b _08012F50 +_08012D50: + movs r0, 0 + movs r1, 0 + bl sub_8011A64 + b _08012E5C +_08012D5A: + adds r0, r6, 0 + adds r0, 0xD + ldr r1, =gStringVar4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08012D6C + b _08012F50 +_08012D6C: + movs r0, 0xE + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012D78: + ldrb r0, [r6, 0xE] + adds r0, 0x1 + strb r0, [r6, 0xE] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x78 + bhi _08012D88 + b _08012F50 +_08012D88: + b _08012DCE +_08012D8A: + adds r0, r6, 0 + adds r0, 0xD + ldr r1, =gUnknown_082EDC5C + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08012D9C + b _08012F50 +_08012D9C: + movs r0, 0x10 + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012DA8: + adds r0, r6, 0 + adds r0, 0xD + movs r1, 0 + bl sub_80170B8 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _08012DCE + cmp r1, 0 + bgt _08012DC8 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _08012DD4 + b _08012F50 +_08012DC8: + cmp r1, 0x1 + beq _08012DD4 + b _08012F50 +_08012DCE: + movs r0, 0x11 + strb r0, [r6, 0xC] + b _08012F50 +_08012DD4: + ldr r0, =gUnknown_02022C2D + ldrb r1, [r0] + movs r0, 0xF0 + ands r0, r1 + cmp r0, 0 + beq _08012DEC + movs r0, 0x1E + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012DEC: + movs r0, 0x13 + strb r0, [r6, 0xC] + b _08012F50 +_08012DF2: + adds r0, r6, 0 + adds r0, 0xD + ldr r1, =gUnknown_082EDC78 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08012E04 + b _08012F50 +_08012E04: + movs r0, 0x14 + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012E10: + adds r0, r6, 0 + adds r0, 0xD + movs r1, 0 + bl sub_80170B8 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _08012EC6 + cmp r1, 0 + bgt _08012E30 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _08012E36 + b _08012F50 +_08012E30: + cmp r1, 0x1 + beq _08012E36 + b _08012F50 +_08012E36: + ldr r0, =gUnknown_02022C2D + ldrb r2, [r0] + movs r0, 0xF0 + ands r0, r2 + cmp r0, 0 + beq _08012E4C + movs r0, 0xF + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012E4C: + movs r3, 0xF + ldrb r1, [r6, 0x13] + adds r0, r3, 0 + ands r0, r2 + cmp r1, r0 + bne _08012E5C + strb r3, [r6, 0xC] + b _08012F50 +_08012E5C: + movs r0, 0x4 + strb r0, [r6, 0xC] + b _08012F50 +_08012E62: + adds r0, r6, 0 + movs r1, 0x7 + movs r2, 0x1D + bl sub_801320C + lsls r0, 24 + cmp r0, 0 + bne _08012F50 + movs r0, 0x12 + strb r0, [r6, 0xC] + b _08012F50 +_08012E78: + bl sub_800EF1C + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + beq _08012EAE + movs r0, 0 + bl sub_800EF58 + cmp r0, 0 + beq _08012E94 + movs r0, 0x1A + strb r0, [r6, 0xC] + b _08012F50 +_08012E94: + ldrh r0, [r6, 0x1A] + adds r0, 0x1 + strh r0, [r6, 0x1A] + lsls r0, 16 + movs r1, 0x96 + lsls r1, 17 + cmp r0, r1 + bls _08012F50 + movs r0, 0x1D + strb r0, [r6, 0xC] + movs r0, 0 + strb r0, [r6, 0xD] + b _08012F50 +_08012EAE: + movs r0, 0x1D + strb r0, [r6, 0xC] + strb r1, [r6, 0xD] + b _08012F50 +_08012EB6: + adds r0, r6, 0 + adds r0, 0xD + ldr r1, =gUnknown_082EDD58 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + beq _08012F50 +_08012EC6: + movs r0, 0x17 + strb r0, [r6, 0xC] + b _08012F50 + .pool +_08012ED0: + bl sub_800E084 + bl sub_800EDD4 + adds r0, r6, 0 + bl sub_8012F64 + ldrb r0, [r6, 0xC] + adds r0, 0x1 + strb r0, [r6, 0xC] + b _08012F50 +_08012EE6: + bl EnableBothScriptContexts + adds r0, r4, 0 + bl DestroyTask + ldr r1, =gScriptResult + movs r0, 0x5 + strh r0, [r1] + b _08012F50 + .pool +_08012EFC: + bl EnableBothScriptContexts + adds r0, r4, 0 + bl DestroyTask + ldr r1, =gScriptResult + movs r0, 0x8 + strh r0, [r1] + b _08012F50 + .pool +_08012F14: + bl sub_8011A80 + cmp r0, 0 + beq _08012F22 + movs r0, 0x1D + strb r0, [r6, 0xC] + b _08012F50 +_08012F22: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _08012F50 + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + bl sub_80126CC + cmp r0, 0 + beq _08012F3A + bl sub_801103C +_08012F3A: + movs r0, 0x1 + bl sub_8011068 + bl sub_80149C4 + adds r0, r6, 0 + bl sub_8012F64 + adds r0, r4, 0 + bl DestroyTask +_08012F50: + add sp, 0x8 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8012780 + + thumb_func_start sub_8012F64 +sub_8012F64: @ 8012F64 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4, 0x11] + bl ClearWindowTilemap + ldrb r0, [r4, 0x11] + movs r1, 0 + bl sub_819746C + ldrb r0, [r4, 0x12] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldrb r0, [r4, 0x10] + bl ClearWindowTilemap + ldrb r0, [r4, 0xF] + movs r1, 0 + bl sub_819746C + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldrb r0, [r4, 0x11] + bl RemoveWindow + ldrb r0, [r4, 0xF] + bl RemoveWindow + ldrb r0, [r4, 0x10] + bl RemoveWindow + ldrb r0, [r4, 0x17] + bl DestroyTask + ldr r0, [r4, 0x8] + bl Free + ldr r0, [r4] + bl Free + ldr r0, [r4, 0x4] + bl Free + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8012F64 + + thumb_func_start sub_8012FC4 +sub_8012FC4: @ 8012FC4 + push {lr} + adds r2, r0, 0 + lsls r1, 24 + lsrs r1, 24 + subs r0, r1, 0x1 + cmp r0, 0x1B + bhi _08013070 + lsls r0, 2 + ldr r1, =_08012FE0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08012FE0: + .4byte _08013050 + .4byte _08013050 + .4byte _08013068 + .4byte _08013050 + .4byte _08013070 + .4byte _08013070 + .4byte _08013070 + .4byte _08013070 + .4byte _08013068 + .4byte _08013068 + .4byte _08013068 + .4byte _08013070 + .4byte _08013070 + .4byte _08013050 + .4byte _08013068 + .4byte _08013068 + .4byte _08013070 + .4byte _08013070 + .4byte _08013070 + .4byte _08013070 + .4byte _08013058 + .4byte _08013058 + .4byte _08013068 + .4byte _08013068 + .4byte _08013068 + .4byte _08013068 + .4byte _08013068 + .4byte _08013050 +_08013050: + ldr r1, =gUnknown_082EDBE8 + b _0801305A + .pool +_08013058: + ldr r1, =gUnknown_082EDC0C +_0801305A: + adds r0, r2, 0 + bl StringExpandPlaceholders + b _08013070 + .pool +_08013068: + ldr r1, =gUnknown_082EDC34 + adds r0, r2, 0 + bl StringExpandPlaceholders +_08013070: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8012FC4 + + thumb_func_start sub_8013078 +sub_8013078: @ 8013078 + push {lr} + lsls r1, 24 + lsrs r1, 24 + adds r2, r1, 0 + cmp r1, 0x44 + beq _08013098 + cmp r1, 0x44 + bgt _0801308E + cmp r1, 0x41 + beq _08013098 + b _080130AA +_0801308E: + cmp r2, 0x45 + beq _080130A4 + cmp r2, 0x48 + beq _080130A4 + b _080130AA +_08013098: + ldr r1, =gUnknown_082EE560 + bl StringExpandPlaceholders + b _080130AA + .pool +_080130A4: + ldr r1, =gUnknown_082EE57C + bl StringExpandPlaceholders +_080130AA: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8013078 + + thumb_func_start sub_80130B4 +sub_80130B4: @ 80130B4 + push {lr} + adds r2, r0, 0 + lsls r1, 24 + lsrs r1, 24 + subs r0, r1, 0x1 + cmp r0, 0x1B + bhi _08013158 + lsls r0, 2 + ldr r1, =_080130D0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080130D0: + .4byte _08013140 + .4byte _08013140 + .4byte _08013150 + .4byte _08013140 + .4byte _08013158 + .4byte _08013158 + .4byte _08013158 + .4byte _08013158 + .4byte _08013150 + .4byte _08013150 + .4byte _08013150 + .4byte _08013158 + .4byte _08013158 + .4byte _08013140 + .4byte _08013150 + .4byte _08013150 + .4byte _08013158 + .4byte _08013158 + .4byte _08013158 + .4byte _08013158 + .4byte _08013140 + .4byte _08013140 + .4byte _08013150 + .4byte _08013150 + .4byte _08013150 + .4byte _08013150 + .4byte _08013150 + .4byte _08013140 +_08013140: + ldr r1, =gUnknown_082EFC3C + adds r0, r2, 0 + bl StringExpandPlaceholders + b _08013158 + .pool +_08013150: + ldr r1, =gUnknown_082EFC54 + adds r0, r2, 0 + bl StringExpandPlaceholders +_08013158: + pop {r0} + bx r0 + .pool + thumb_func_end sub_80130B4 + + thumb_func_start sub_8013160 +sub_8013160: @ 8013160 + push {lr} + adds r2, r0, 0 + lsls r1, 24 + lsrs r1, 24 + subs r0, r1, 0x1 + cmp r0, 0x1B + bhi _08013204 + lsls r0, 2 + ldr r1, =_0801317C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801317C: + .4byte _080131EC + .4byte _080131EC + .4byte _080131FC + .4byte _080131EC + .4byte _08013204 + .4byte _08013204 + .4byte _08013204 + .4byte _08013204 + .4byte _080131FC + .4byte _080131FC + .4byte _080131FC + .4byte _08013204 + .4byte _08013204 + .4byte _080131EC + .4byte _080131FC + .4byte _080131FC + .4byte _08013204 + .4byte _08013204 + .4byte _08013204 + .4byte _08013204 + .4byte _080131EC + .4byte _080131EC + .4byte _080131FC + .4byte _080131FC + .4byte _080131FC + .4byte _080131FC + .4byte _080131FC + .4byte _080131EC +_080131EC: + ldr r1, =gUnknown_082EDDF4 + adds r0, r2, 0 + bl StringExpandPlaceholders + b _08013204 + .pool +_080131FC: + ldr r1, =gUnknown_082EDE0C + adds r0, r2, 0 + bl StringExpandPlaceholders +_08013204: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8013160 + + thumb_func_start sub_801320C +sub_801320C: @ 801320C + push {r4-r6,lr} + adds r4, r0, 0 + adds r6, r1, 0 + adds r5, r2, 0 + ldr r0, [r4] + bl sub_80132D4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08013228 + cmp r0, 0x2 + beq _0801325C + b _08013270 +_08013228: + movs r0, 0x2 + bl PlaySE + ldrb r0, [r4, 0x12] + bl sub_81AE70C + ldr r0, =gStringVar2 + ldrb r2, [r4, 0x13] + lsls r2, 5 + ldr r1, [r4] + adds r1, r2 + bl sub_8018404 + ldr r0, =gStringVar4 + ldr r1, =gUnknown_02022C2C + ldrb r1, [r1] + bl sub_8012FC4 + strb r6, [r4, 0xC] + b _08013270 + .pool +_0801325C: + movs r0, 0 + movs r1, 0 + bl sub_8011A64 + ldrb r0, [r4, 0x12] + bl sub_81AE70C + strb r5, [r4, 0xC] + movs r0, 0x1 + b _08013272 +_08013270: + movs r0, 0 +_08013272: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801320C + + thumb_func_start sub_8013278 +sub_8013278: @ 8013278 + push {r4-r6,lr} + sub sp, 0x8 + adds r4, r1, 0 + lsls r0, 24 + lsrs r5, r0, 24 + lsls r2, 24 + lsrs r6, r2, 24 + ldr r0, =gUnknown_02022C30 + ldr r3, [r0] + movs r2, 0 + ldr r1, [r3] + lsls r0, r4, 5 + adds r1, r0 + ldrb r0, [r1, 0x1A] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x1 + beq _080132A8 + cmp r0, 0x2 + beq _080132B2 + b _080132B4 + .pool +_080132A8: + ldrb r0, [r1, 0x1B] + cmp r0, 0 + beq _080132B4 + movs r2, 0x2 + b _080132B4 +_080132B2: + movs r2, 0x1 +_080132B4: + lsls r0, r4, 5 + ldr r3, [r3] + adds r3, r0 + str r2, [sp] + lsls r0, r4, 24 + lsrs r0, 24 + str r0, [sp, 0x4] + adds r0, r5, 0 + movs r1, 0 + adds r2, r6, 0 + bl sub_80178A0 + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8013278 + + thumb_func_start sub_80132D4 +sub_80132D4: @ 80132D4 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x4 + ldr r0, =gUnknown_02022C30 + ldr r5, [r0] + movs r0, 0 + mov r8, r0 + movs r3, 0x1 +_080132E8: + ldr r0, [r5] + lsls r6, r3, 5 + adds r2, r0, r6 + ldrb r0, [r2, 0x1A] + lsls r0, 30 + lsrs r0, 30 + mov r9, r0 + cmp r0, 0x1 + bne _08013348 + ldr r1, [r5, 0x4] + adds r0, r2, 0 + str r3, [sp] + bl sub_80176E4 + adds r4, r0, 0 + ldr r3, [sp] + cmp r4, 0xFF + beq _08013330 + ldr r1, [r5] + ldr r0, [r5, 0x4] + lsls r2, r4, 3 + subs r2, r4 + lsls r2, 2 + adds r1, r6 + adds r0, r2 + ldm r0!, {r2,r4,r7} + stm r1!, {r2,r4,r7} + ldm r0!, {r2,r4,r7} + stm r1!, {r2,r4,r7} + ldr r0, [r5] + adds r0, r6 + mov r1, r9 + strh r1, [r0, 0x18] + b _08013348 + .pool +_08013330: + ldr r2, [r5] + adds r2, r6 + ldrb r1, [r2, 0x1A] + movs r4, 0x4 + negs r4, r4 + adds r0, r4, 0 + ands r1, r0 + movs r0, 0x2 + orrs r1, r0 + strb r1, [r2, 0x1A] + movs r7, 0x2 + mov r8, r7 +_08013348: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x4 + bls _080132E8 + movs r6, 0 + movs r4, 0x3 +_08013356: + ldr r0, [r5] + ldr r1, [r5, 0x4] + adds r1, r6 + movs r2, 0x5 + bl sub_8017734 + adds r6, 0x1C + subs r4, 0x1 + ldr r0, [r5] + cmp r4, 0 + bge _08013356 + mov r1, r8 + cmp r1, 0x2 + beq _08013388 + adds r1, r0, 0 + movs r4, 0x4 +_08013376: + ldrb r0, [r1, 0x1B] + cmp r0, 0 + beq _08013380 + movs r2, 0x1 + mov r8, r2 +_08013380: + adds r1, 0x20 + subs r4, 0x1 + cmp r4, 0 + bge _08013376 +_08013388: + mov r0, r8 + add sp, 0x4 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80132D4 + + thumb_func_start sub_8013398 +sub_8013398: @ 8013398 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + ldr r0, =gUnknown_02022C30 + ldr r4, [r0] + movs r3, 0 +_080133A8: + ldr r0, [r4, 0x8] + lsls r2, r3, 5 + ldr r1, [r4] + adds r0, r2 + adds r1, r2 + ldm r1!, {r2,r5,r6} + stm r0!, {r2,r5,r6} + ldm r1!, {r2,r5,r7} + stm r0!, {r2,r5,r7} + ldm r1!, {r6,r7} + stm r0!, {r6,r7} + adds r3, 0x1 + ldr r0, [r4, 0x8] + ldr r1, [r4] + cmp r3, 0x4 + ble _080133A8 + movs r5, 0 + mov r8, r1 + mov r9, r0 + movs r3, 0x4 +_080133D0: + mov r1, r9 + ldrb r0, [r1, 0x1A] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _080133F2 + lsls r0, r5, 5 + add r0, r8 + ldm r1!, {r2,r6,r7} + stm r0!, {r2,r6,r7} + ldm r1!, {r2,r6,r7} + stm r0!, {r2,r6,r7} + ldm r1!, {r2,r6} + stm r0!, {r2,r6} + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_080133F2: + movs r7, 0x20 + add r9, r7 + subs r3, 0x1 + cmp r3, 0 + bge _080133D0 + mov r10, r5 + cmp r5, 0x4 + bhi _08013454 + ldr r0, =gUnknown_082F045C + mov r9, r0 + movs r1, 0 + mov r12, r1 + movs r2, 0x4 + negs r2, r2 + mov r8, r2 +_08013410: + ldr r1, [r4] + lsls r3, r5, 5 + adds r1, r3 + mov r0, r9 + ldm r0!, {r2,r6,r7} + stm r1!, {r2,r6,r7} + ldm r0!, {r2,r6,r7} + stm r1!, {r2,r6,r7} + ldr r0, [r4] + adds r0, r3 + movs r1, 0 + strh r1, [r0, 0x18] + ldr r1, [r4] + adds r1, r3 + ldrb r2, [r1, 0x1A] + mov r0, r8 + ands r0, r2 + strb r0, [r1, 0x1A] + ldr r1, [r4] + adds r1, r3 + ldrb r2, [r1, 0x1A] + movs r0, 0x5 + negs r0, r0 + ands r0, r2 + strb r0, [r1, 0x1A] + ldr r0, [r4] + adds r0, r3 + mov r6, r12 + strb r6, [r0, 0x1B] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x4 + bls _08013410 +_08013454: + movs r3, 0 + ldr r1, [r4] + ldrb r0, [r1, 0x1A] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _08013474 + ldrb r0, [r1, 0x1B] + cmp r0, 0x40 + bne _08013474 + mov r10, r3 + b _08013494 + .pool +_08013474: + adds r3, 0x1 + cmp r3, 0x4 + bgt _08013494 + lsls r0, r3, 5 + adds r2, r1, r0 + ldrb r0, [r2, 0x1A] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _08013474 + ldrb r0, [r2, 0x1B] + cmp r0, 0x40 + bne _08013474 + lsls r0, r3, 24 + lsrs r0, 24 + mov r10, r0 +_08013494: + mov r0, r10 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8013398 + + thumb_func_start BerryBlenderLinkJoinGroup +BerryBlenderLinkJoinGroup: @ 80134A4 + push {lr} + ldr r0, =sub_80134E8 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gUnknown_02022C30 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r1, r0 + str r1, [r2] + ldr r0, =gUnknown_03000DA4 + str r1, [r0] + movs r0, 0 + strb r0, [r1, 0x8] + strb r0, [r1, 0x9] + ldr r1, =gScriptResult + strh r0, [r1] + pop {r0} + bx r0 + .pool + thumb_func_end BerryBlenderLinkJoinGroup + + thumb_func_start sub_80134E8 +sub_80134E8: @ 80134E8 + push {r4-r7,lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r4, r0, 24 + ldr r0, =gUnknown_02022C30 + ldr r6, [r0] + ldrb r0, [r6, 0x8] + cmp r0, 0x17 + bls _080134FC + b _08013B82 +_080134FC: + lsls r0, 2 + ldr r1, =_08013510 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08013510: + .4byte _08013570 + .4byte _080135E0 + .4byte _0801360C + .4byte _080136D8 + .4byte _08013B82 + .4byte _08013788 + .4byte _080137C4 + .4byte _08013A10 + .4byte _08013A2C + .4byte _08013A7A + .4byte _08013A8C + .4byte _08013B14 + .4byte _08013A8C + .4byte _08013AE4 + .4byte _08013A8C + .4byte _08013B24 + .4byte _08013B82 + .4byte _08013B82 + .4byte _08013A8C + .4byte _08013B44 + .4byte _08013A8C + .4byte _08013B78 + .4byte _08013B82 + .4byte _08013B68 +_08013570: + ldr r0, =gSpecialVar_0x8004 + ldrh r2, [r0] + adds r3, r0, 0 + cmp r2, 0x14 + bne _08013590 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000ca9 + adds r0, r1 + ldrb r1, [r0] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _08013590 + adds r0, r2, 0x1 + strh r0, [r3] +_08013590: + ldr r2, =gUnknown_02022C2C + ldr r1, =gUnknown_082F0530 + ldrh r0, [r3] + adds r0, r1 + ldrb r0, [r0] + strb r0, [r2] + ldrb r0, [r2] + movs r1, 0 + movs r2, 0 + bl sub_8010F84 + bl sub_800B488 + bl sub_8009734 + bl sub_8011C5C + movs r0, 0x70 + bl AllocZeroed + str r0, [r6, 0x4] + movs r0, 0x80 + lsls r0, 2 + bl AllocZeroed + str r0, [r6] + movs r0, 0x1 + strb r0, [r6, 0x8] + b _08013B82 + .pool +_080135E0: + adds r0, r6, 0 + adds r0, 0x9 + ldr r2, =gUnknown_082EFB70 + ldr r1, =gSpecialVar_0x8004 + ldrh r1, [r1] + lsls r1, 2 + adds r1, r2 + ldr r1, [r1] + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _080135FC + b _08013B82 +_080135FC: + movs r0, 0x2 + strb r0, [r6, 0x8] + b _08013B82 + .pool +_0801360C: + ldr r0, [r6, 0x4] + movs r1, 0x4 + bl sub_80175EC + ldr r0, [r6] + movs r1, 0x10 + bl sub_8017580 + ldr r0, [r6, 0x4] + ldr r1, =gSpecialVar_0x8004 + ldrh r1, [r1] + bl sub_8016FC0 + movs r4, 0 + strb r0, [r6, 0x11] + ldr r0, =gUnknown_082F00BC + bl AddWindow + strb r0, [r6, 0xC] + ldr r0, =gUnknown_082F0174 + bl AddWindow + strb r0, [r6, 0xB] + ldr r0, =gUnknown_082F017C + bl AddWindow + strb r0, [r6, 0xD] + ldrb r0, [r6, 0xC] + movs r1, 0x22 + bl FillWindowPixelBuffer + ldrb r0, [r6, 0xC] + ldr r2, =gUnknown_082EF7DC + movs r1, 0x1 + str r1, [sp] + movs r1, 0x4 + str r1, [sp, 0x4] + movs r1, 0 + movs r3, 0x8 + bl sub_80173E0 + ldrb r0, [r6, 0xC] + bl PutWindowTilemap + ldrb r0, [r6, 0xC] + movs r1, 0x2 + bl CopyWindowToVram + ldrb r0, [r6, 0xB] + movs r1, 0 + bl sub_81973FC + ldr r0, =gUnknown_03006310 + adds r2, r0, 0 + ldr r1, =gUnknown_082F0204 + ldm r1!, {r3,r5,r7} + stm r2!, {r3,r5,r7} + ldm r1!, {r3,r5,r7} + stm r2!, {r3,r5,r7} + ldrb r1, [r6, 0xB] + strb r1, [r0, 0x10] + movs r1, 0 + movs r2, 0 + bl ListMenuInit + strb r0, [r6, 0xE] + ldrb r0, [r6, 0xD] + movs r1, 0 + bl sub_81973FC + ldrb r0, [r6, 0xD] + bl PutWindowTilemap + ldrb r0, [r6, 0xD] + bl sub_80125BC + ldrb r0, [r6, 0xD] + movs r1, 0x2 + bl CopyWindowToVram + movs r0, 0 + bl CopyBgTilemapBufferToVram + strb r4, [r6, 0xF] + movs r0, 0x3 + strb r0, [r6, 0x8] + b _08013B82 + .pool +_080136D8: + bl sub_8013E44 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _080136F2 + cmp r4, 0x1 + beq _080136EA + b _08013A72 +_080136EA: + movs r0, 0x2 + bl PlaySE + b _08013A72 +_080136F2: + ldrb r0, [r6, 0xE] + bl ListMenuHandleInput + adds r4, r0, 0 + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08013770 + movs r0, 0x1 + negs r0, r0 + cmp r4, r0 + beq _08013770 + ldr r0, [r6] + lsls r1, r4, 5 + adds r0, r1 + ldrb r1, [r0, 0xA] + ldrb r0, [r0, 0x1A] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _08013768 + lsrs r0, r1, 7 + cmp r0, 0 + bne _08013768 + adds r0, r6, 0 + adds r1, r4, 0 + bl sub_8013B8C + adds r1, r0, 0 + cmp r1, 0 + bne _08013744 + adds r0, r6, 0 + adds r1, r4, 0 + bl sub_8013BD8 + movs r0, 0x5 + b _08013756 + .pool +_08013744: + ldr r0, =gStringVar4 + ldr r2, =gUnknown_082EDD50 + subs r1, 0x1 + lsls r1, 2 + adds r1, r2 + ldr r1, [r1] + bl StringCopy + movs r0, 0x12 +_08013756: + strb r0, [r6, 0x8] + movs r0, 0x6E + bl PlaySE + b _08013B82 + .pool +_08013768: + movs r0, 0x7 + bl PlaySE + b _08013B82 +_08013770: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + bne _0801377E + b _08013B82 +_0801377E: + movs r0, 0xA + strb r0, [r6, 0x8] + b _08013B82 + .pool +_08013788: + ldr r4, =gStringVar4 + ldr r0, =gUnknown_02022C2C + ldrb r1, [r0] + adds r0, r4, 0 + bl sub_80130B4 + adds r0, r6, 0 + adds r0, 0x9 + adds r1, r4, 0 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _080137A6 + b _08013B82 +_080137A6: + ldr r0, =gStringVar1 + ldrb r2, [r6, 0xF] + lsls r2, 5 + ldr r1, [r6] + adds r1, r2 + bl sub_8018404 + b _08013A86 + .pool +_080137C4: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _0801387A + ldr r4, =gUnknown_02022C2C + ldr r1, [r6] + ldrb r0, [r6, 0xF] + lsls r0, 5 + adds r1, r0 + ldrb r0, [r1, 0xA] + lsls r0, 25 + lsrs r0, 25 + strb r0, [r4] + movs r0, 0 + movs r1, 0 + bl sub_8011A64 + ldrb r0, [r4] + subs r0, 0x1 + cmp r0, 0x1B + bhi _0801387A + lsls r0, 2 + ldr r1, =_08013804 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08013804: + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _0801387A + .4byte _0801387A + .4byte _0801387A + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _0801387A + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _0801387A + .4byte _0801387A + .4byte _0801387A + .4byte _0801387A + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 + .4byte _08013874 +_08013874: + movs r0, 0x14 + strb r0, [r6, 0x8] + b _08013B82 +_0801387A: + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + subs r0, 0x1 + cmp r0, 0x8 + bls _0801388A + b _080139EC +_0801388A: + lsls r0, 2 + ldr r1, =_08013898 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08013898: + .4byte _080138BC + .4byte _080138C2 + .4byte _080139EC + .4byte _080139EC + .4byte _080138C8 + .4byte _080138C2 + .4byte _08013934 + .4byte _080139EC + .4byte _080138C2 +_080138BC: + movs r0, 0xC + strb r0, [r6, 0x8] + b _080139EC +_080138C2: + movs r0, 0xE + strb r0, [r6, 0x8] + b _080139EC +_080138C8: + ldr r5, =gStringVar4 + ldr r4, =gUnknown_02022C2C + ldrb r1, [r4] + adds r0, r5, 0 + bl sub_8013160 + adds r0, r6, 0 + adds r0, 0x9 + adds r1, r5, 0 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _080138E6 + b _080139EC +_080138E6: + ldrb r0, [r4] + cmp r0, 0x1C + beq _080138F0 + cmp r0, 0xE + bne _08013904 +_080138F0: + movs r0, 0xC + movs r1, 0 + bl sub_8011A64 + b _080139EC + .pool +_08013904: + movs r0, 0x7 + movs r1, 0 + bl sub_8011A64 + ldr r0, =gStringVar1 + ldr r2, =gUnknown_082F0048 + ldrb r1, [r4] + lsls r1, 2 + adds r1, r2 + ldr r1, [r1] + bl StringCopy + ldr r1, =gUnknown_082EDE48 + adds r0, r5, 0 + bl StringExpandPlaceholders + b _080139EC + .pool +_08013934: + ldrb r0, [r6, 0x15] + adds r2, r0, 0 + cmp r2, 0xF0 + bls _0801395C + adds r0, r6, 0 + adds r0, 0x9 + ldr r1, =gStringVar4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + beq _080139EC + movs r0, 0xC + movs r1, 0 + bl sub_8011A64 + movs r0, 0 + b _080139EA + .pool +_0801395C: + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + subs r0, 0x1 + cmp r0, 0x1B + bhi _080139E8 + lsls r0, 2 + ldr r1, =_08013978 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08013978: + .4byte _080139EC + .4byte _080139EC + .4byte _080139E8 + .4byte _080139EC + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139EC + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139E8 + .4byte _080139EC +_080139E8: + adds r0, r2, 0x1 +_080139EA: + strb r0, [r6, 0x15] +_080139EC: + bl sub_8011A74 + lsls r0, 24 + cmp r0, 0 + beq _080139F8 + b _08013B82 +_080139F8: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + bne _08013A06 + b _08013B82 +_08013A06: + movs r0, 0x7 + strb r0, [r6, 0x8] + b _08013B82 + .pool +_08013A10: + adds r0, r6, 0 + adds r0, 0x9 + ldr r1, =gUnknown_082EDE64 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08013A22 + b _08013B82 +_08013A22: + movs r0, 0x8 + strb r0, [r6, 0x8] + b _08013B82 + .pool +_08013A2C: + adds r4, r6, 0 + adds r4, 0x9 + bl sub_8011A74 + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + bl sub_80170B8 + lsls r0, 24 + asrs r1, r0, 24 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _08013A6A + cmp r1, r0 + bgt _08013A58 + subs r0, 0x2 + cmp r1, r0 + beq _08013A6E + b _08013B82 +_08013A58: + cmp r1, 0 + beq _08013A62 + cmp r1, 0x1 + beq _08013A6A + b _08013B82 +_08013A62: + bl sub_80106D4 + movs r0, 0x9 + b _08013A70 +_08013A6A: + movs r0, 0x5 + b _08013A70 +_08013A6E: + movs r0, 0x6 +_08013A70: + strb r0, [r6, 0x8] +_08013A72: + ldrb r0, [r6, 0xE] + bl sub_81AE70C + b _08013B82 +_08013A7A: + bl sub_8011A74 + lsls r0, 24 + cmp r0, 0 + bne _08013A86 + b _08013B82 +_08013A86: + movs r0, 0x6 + strb r0, [r6, 0x8] + b _08013B82 +_08013A8C: + ldrb r0, [r6, 0xD] + bl ClearWindowTilemap + ldrb r0, [r6, 0xD] + movs r1, 0 + bl sub_819746C + ldrb r0, [r6, 0xE] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldrb r0, [r6, 0xC] + bl ClearWindowTilemap + ldrb r0, [r6, 0xB] + movs r1, 0 + bl sub_819746C + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldrb r0, [r6, 0xD] + bl RemoveWindow + ldrb r0, [r6, 0xB] + bl RemoveWindow + ldrb r0, [r6, 0xC] + bl RemoveWindow + ldrb r0, [r6, 0x11] + bl DestroyTask + ldr r0, [r6] + bl Free + ldr r0, [r6, 0x4] + bl Free + ldrb r0, [r6, 0x8] + adds r0, 0x1 + strb r0, [r6, 0x8] + b _08013B82 +_08013AE4: + bl sub_800E084 + adds r5, r6, 0 + adds r5, 0x9 + ldr r4, =gUnknown_082EDE9C + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 22 + adds r0, r4 + ldr r1, [r0] + adds r0, r5, 0 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + beq _08013B82 + ldr r0, =gScriptResult + movs r1, 0x6 + b _08013B58 + .pool +_08013B14: + bl sub_800E084 + ldr r0, =gScriptResult + movs r1, 0x5 + b _08013B58 + .pool +_08013B24: + bl sub_800E084 + adds r5, r6, 0 + adds r5, 0x9 + ldr r4, =gUnknown_082EDE9C + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 22 + adds r0, r4 + ldr r1, [r0] + adds r0, r5, 0 + b _08013B4A + .pool +_08013B44: + adds r0, r6, 0 + adds r0, 0x9 + ldr r1, =gStringVar4 +_08013B4A: + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + beq _08013B82 + ldr r0, =gScriptResult + movs r1, 0x8 +_08013B58: + strh r1, [r0] + movs r0, 0x17 + strb r0, [r6, 0x8] + b _08013B82 + .pool +_08013B68: + adds r0, r4, 0 + bl DestroyTask + bl sub_80173D4 + bl sub_800EDD4 + b _08013B82 +_08013B78: + bl sub_80149C4 + adds r0, r4, 0 + bl DestroyTask +_08013B82: + add sp, 0x8 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_80134E8 + + thumb_func_start sub_8013B8C +sub_8013B8C: @ 8013B8C + push {lr} + lsls r1, 5 + ldr r0, [r0] + adds r3, r0, r1 + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + cmp r0, 0x4 + bne _08013BCE + ldrb r1, [r3, 0x1] + movs r0, 0x3C + ands r0, r1 + cmp r0, 0xC + beq _08013BCE + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r1, [r0, 0x9] + movs r2, 0x80 + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + bne _08013BC4 + movs r0, 0x1 + b _08013BD4 + .pool +_08013BC4: + ldrb r1, [r3] + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + beq _08013BD2 +_08013BCE: + movs r0, 0 + b _08013BD4 +_08013BD2: + movs r0, 0x2 +_08013BD4: + pop {r1} + bx r1 + thumb_func_end sub_8013B8C + + thumb_func_start sub_8013BD8 +sub_8013BD8: @ 8013BD8 + push {r4,lr} + adds r4, r0, 0 + strb r1, [r4, 0xF] + bl sub_800E0E8 + movs r0, 0 + movs r1, 0 + bl sub_800DFB4 + ldrb r0, [r4, 0xE] + bl sub_81AE70C + ldr r0, =gStringVar1 + ldrb r2, [r4, 0xF] + lsls r2, 5 + ldr r1, [r4] + adds r1, r2 + bl sub_8018404 + ldr r1, =gUnknown_082F0530 + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + adds r0, r1 + ldrb r0, [r0] + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + ldrb r1, [r4, 0xF] + lsls r1, 5 + ldr r0, [r4] + adds r0, r1 + adds r4, r0, 0 + adds r4, 0x10 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + bl sub_8011FC8 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8013BD8 + + thumb_func_start sub_8013C40 +sub_8013C40: @ 8013C40 + push {lr} + ldr r0, =sub_8013C7C + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r3, =gUnknown_02022C30 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r2, =gTasks + 0x8 + adds r1, r2 + str r1, [r3] + movs r2, 0 + strb r2, [r1, 0x8] + strb r2, [r1, 0x9] + ldr r2, =gUnknown_03000DA4 + str r1, [r2] + pop {r1} + bx r1 + .pool + thumb_func_end sub_8013C40 + + thumb_func_start sub_8013C7C +sub_8013C7C: @ 8013C7C + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gUnknown_02022C30 + ldr r4, [r0] + ldrb r0, [r4, 0x8] + cmp r0, 0xB + bhi _08013D80 + lsls r0, 2 + ldr r1, =_08013CA0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08013CA0: + .4byte _08013CD0 + .4byte _08013D80 + .4byte _08013D04 + .4byte _08013D28 + .4byte _08013D80 + .4byte _08013D80 + .4byte _08013D80 + .4byte _08013D80 + .4byte _08013D80 + .4byte _08013D80 + .4byte _08013D58 + .4byte _08013D76 +_08013CD0: + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl sub_8010F84 + bl sub_800B488 + bl sub_8009734 + bl sub_8011C5C + movs r0, 0x1 + bl sub_80111B0 + movs r0, 0x70 + bl AllocZeroed + str r0, [r4, 0x4] + movs r0, 0x80 + lsls r0, 2 + bl AllocZeroed + str r0, [r4] + movs r0, 0x2 + strb r0, [r4, 0x8] + b _08013D80 +_08013D04: + ldr r0, [r4, 0x4] + movs r1, 0x4 + bl sub_80175EC + ldr r0, [r4] + movs r1, 0x10 + bl sub_8017580 + ldr r0, [r4, 0x4] + movs r1, 0xFF + bl sub_8016FC0 + movs r1, 0 + strb r0, [r4, 0x11] + strb r1, [r4, 0xF] + movs r0, 0x3 + strb r0, [r4, 0x8] + b _08013D80 +_08013D28: + bl sub_8013E44 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08013D3A + movs r0, 0x2 + bl PlaySE +_08013D3A: + ldr r0, =gTasks + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r1, r0 + movs r2, 0x26 + ldrsh r0, [r1, r2] + cmp r0, 0xFF + bne _08013D80 + movs r0, 0xA + strb r0, [r4, 0x8] + b _08013D80 + .pool +_08013D58: + ldrb r0, [r4, 0x11] + bl DestroyTask + ldr r0, [r4] + bl Free + ldr r0, [r4, 0x4] + bl Free + bl sub_800EDD4 + ldrb r0, [r4, 0x8] + adds r0, 0x1 + strb r0, [r4, 0x8] + b _08013D80 +_08013D76: + bl sub_800EDD4 + adds r0, r5, 0 + bl DestroyTask +_08013D80: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8013C7C + + thumb_func_start sub_8013D88 +sub_8013D88: @ 8013D88 + push {lr} + adds r2, r0, 0 + cmp r1, 0xFF + bne _08013D94 +_08013D90: + movs r0, 0x1 + b _08013DB8 +_08013D94: + cmp r1, 0x16 + bhi _08013DB6 + ldr r0, =gUnknown_082F04D8 + lsls r1, 2 + adds r1, r0 + ldr r1, [r1] + b _08013DB0 + .pool +_08013DA8: + ldrb r0, [r1] + cmp r0, r2 + beq _08013D90 + adds r1, 0x1 +_08013DB0: + ldrb r0, [r1] + cmp r0, 0xFF + bne _08013DA8 +_08013DB6: + movs r0, 0 +_08013DB8: + pop {r1} + bx r1 + thumb_func_end sub_8013D88 + + thumb_func_start sub_8013DBC +sub_8013DBC: @ 8013DBC + push {lr} + ldr r0, [r0] + lsls r1, 5 + adds r1, r0, r1 + ldrb r2, [r1, 0x1A] + lsls r0, r2, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _08013DEE + ldrb r0, [r1, 0xA] + lsrs r0, 7 + cmp r0, 0 + beq _08013DDA + movs r0, 0x3 + b _08013DF0 +_08013DDA: + lsls r0, r2, 29 + cmp r0, 0 + bge _08013DE4 + movs r0, 0x1 + b _08013DF0 +_08013DE4: + ldrb r0, [r1, 0x1B] + cmp r0, 0 + beq _08013DEE + movs r0, 0x2 + b _08013DF0 +_08013DEE: + movs r0, 0 +_08013DF0: + pop {r1} + bx r1 + thumb_func_end sub_8013DBC + + thumb_func_start sub_8013DF4 +sub_8013DF4: @ 8013DF4 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x8 + adds r5, r0, 0 + adds r4, r1, 0 + adds r6, r2, 0 + lsls r5, 24 + lsrs r5, 24 + lsls r6, 24 + lsrs r6, 24 + ldr r0, =gUnknown_02022C30 + ldr r0, [r0] + mov r8, r0 + bl sub_8013DBC + lsls r0, 24 + lsrs r0, 24 + lsls r1, r4, 5 + mov r2, r8 + ldr r3, [r2] + adds r3, r1 + str r0, [sp] + lsls r4, 24 + lsrs r4, 24 + str r4, [sp, 0x4] + adds r0, r5, 0 + movs r1, 0x8 + adds r2, r6, 0 + bl sub_80177B8 + add sp, 0x8 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8013DF4 + + thumb_func_start sub_8013E44 +sub_8013E44: @ 8013E44 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x4 + ldr r0, =gUnknown_02022C30 + ldr r6, [r0] + movs r7, 0 + movs r3, 0 +_08013E54: + ldr r0, [r6] + lsls r5, r3, 5 + adds r2, r0, r5 + ldrb r0, [r2, 0x1A] + lsls r0, 30 + mov r8, r5 + cmp r0, 0 + beq _08013F20 + ldr r1, [r6, 0x4] + adds r0, r2, 0 + str r3, [sp] + bl sub_80176E4 + adds r4, r0, 0 + ldr r3, [sp] + cmp r4, 0xFF + beq _08013EEE + ldr r0, [r6] + adds r2, r0, r5 + ldrb r1, [r2, 0x1A] + lsls r0, r1, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _08013ECC + lsls r0, r4, 3 + subs r0, r4 + lsls r4, r0, 2 + ldr r1, [r6, 0x4] + adds r1, r4 + adds r0, r2, 0 + bl sub_8017678 + ldr r3, [sp] + cmp r0, 0 + beq _08013EB0 + ldr r1, [r6] + ldr r0, [r6, 0x4] + adds r1, r5 + adds r0, r4 + ldm r0!, {r2,r4,r7} + stm r1!, {r2,r4,r7} + ldm r0!, {r2,r4,r7} + stm r1!, {r2,r4,r7} + b _08013EDA + .pool +_08013EB0: + ldr r0, [r6] + adds r1, r0, r5 + ldrb r0, [r1, 0x1B] + cmp r0, 0 + beq _08013EE4 + subs r0, 0x1 + strb r0, [r1, 0x1B] + ldr r0, [r6] + adds r0, r5 + ldrb r0, [r0, 0x1B] + cmp r0, 0 + bne _08013EE4 + movs r7, 0x2 + b _08013EE4 +_08013ECC: + movs r4, 0x4 + negs r4, r4 + adds r0, r4, 0 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0x1A] +_08013EDA: + ldr r0, [r6] + adds r0, r5 + movs r1, 0x40 + strb r1, [r0, 0x1B] + movs r7, 0x1 +_08013EE4: + ldr r0, [r6] + add r0, r8 + movs r1, 0 + strh r1, [r0, 0x18] + b _08013F20 +_08013EEE: + ldr r0, [r6] + adds r1, r0, r5 + ldrb r0, [r1, 0x1A] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x2 + beq _08013F20 + ldrh r0, [r1, 0x18] + adds r0, 0x1 + strh r0, [r1, 0x18] + ldr r0, [r6] + adds r2, r0, r5 + ldrh r1, [r2, 0x18] + ldr r0, =0x0000012b + cmp r1, r0 + bls _08013F20 + ldrb r0, [r2, 0x1A] + movs r7, 0x4 + negs r7, r7 + adds r1, r7, 0 + ands r0, r1 + movs r1, 0x2 + orrs r0, r1 + strb r0, [r2, 0x1A] + movs r7, 0x2 +_08013F20: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0xF + bls _08013E54 + movs r5, 0 + movs r4, 0x3 +_08013F2E: + ldr r0, [r6] + ldr r1, [r6, 0x4] + adds r1, r5 + movs r2, 0x10 + bl sub_8017734 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xFF + beq _08013F44 + movs r7, 0x1 +_08013F44: + adds r5, 0x1C + subs r4, 0x1 + cmp r4, 0 + bge _08013F2E + adds r0, r7, 0 + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8013E44 + + thumb_func_start sub_8013F60 +sub_8013F60: @ 8013F60 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_80773AC + adds r0, r4, 0 + bl DestroyTask + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8013F60 + + thumb_func_start sub_8013F78 +sub_8013F78: @ 8013F78 + push {lr} + ldr r0, =sub_8013F60 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8013F78 + + thumb_func_start sub_8013F90 +sub_8013F90: @ 8013F90 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r6, r0, 24 + ldr r0, =gUnknown_02022C40 + mov r8, r0 + bl GetMultiplayerId + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + mov r0, r8 + bl sub_8018120 + adds r7, r0, 0 + ldr r1, =gTasks + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + adds r5, r0, r1 + movs r1, 0x8 + ldrsh r0, [r5, r1] + cmp r0, 0x1 + beq _08013FFC + cmp r0, 0x1 + bgt _08013FD4 + cmp r0, 0 + beq _08013FDE + b _080140BC + .pool +_08013FD4: + cmp r0, 0x2 + beq _08014038 + cmp r0, 0x3 + beq _08014070 + b _080140BC +_08013FDE: + ldrh r0, [r5, 0x8] + adds r0, 0x1 + strh r0, [r5, 0x8] + movs r0, 0x64 + adds r1, r7, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r1, r0 + movs r0, 0 + movs r2, 0x64 + bl SendBlock + b _080140BC + .pool +_08013FFC: + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bne _080140BC + bl GetMultiplayerId + adds r1, r0, 0 + ldr r0, =gEnemyParty + movs r2, 0x1 + eors r1, r2 + lsls r1, 24 + lsrs r1, 16 + ldr r2, =gBlockRecvBuffer + adds r1, r2 + movs r2, 0x64 + bl memcpy + movs r0, 0x32 + bl IncrementGameStat + bl ResetBlockReceivedFlags + b _0801405A + .pool +_08014038: + ldr r4, =gUnknown_020228C4 + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldr r0, =0x00002be0 + adds r1, r0 + adds r0, r4, 0 + movs r2, 0xDC + bl memcpy + movs r0, 0 + adds r1, r4, 0 + movs r2, 0xDC + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _080140BC +_0801405A: + ldrh r0, [r5, 0x8] + adds r0, 0x1 + strh r0, [r5, 0x8] + b _080140BC + .pool +_08014070: + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bne _080140BC + ldr r4, =gUnknown_020321C0 + bl GetMultiplayerId + adds r1, r0, 0 + movs r0, 0x1 + eors r1, r0 + lsls r1, 24 + lsrs r1, 16 + ldr r0, =gBlockRecvBuffer + adds r1, r0 + adds r0, r4, 0 + movs r2, 0xD8 + bl memcpy + bl ResetBlockReceivedFlags + ldr r1, =gUnknown_02032298 + strb r7, [r1] + movs r0, 0x6 + strb r0, [r1, 0x1] + ldr r1, =gMain + ldr r0, =c2_exit_to_overworld_2_switch + str r0, [r1, 0x8] + ldr r0, =sub_807AE50 + bl SetMainCallback2 + mov r0, r8 + bl sub_801807C + adds r0, r6, 0 + bl DestroyTask +_080140BC: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8013F90 + + thumb_func_start sub_80140E0 +sub_80140E0: @ 80140E0 + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + ldr r1, =gTasks + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + adds r4, r0, r1 + movs r1, 0x8 + ldrsh r0, [r4, r1] + cmp r0, 0 + beq _08014104 + cmp r0, 0x1 + beq _0801411C + b _0801419E + .pool +_08014104: + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + bne _08014114 + movs r0, 0x2 + bl sub_800A4D8 +_08014114: + ldrh r0, [r4, 0x8] + adds r0, 0x1 + strh r0, [r4, 0x8] + b _0801419E +_0801411C: + bl GetBlockReceivedStatus + adds r4, r0, 0 + bl sub_800A9D8 + lsls r4, 24 + lsls r0, 24 + cmp r4, r0 + bne _0801419E + movs r4, 0 + ldr r5, =gLinkPlayers + b _08014152 + .pool +_08014138: + lsls r1, r4, 8 + ldr r0, =gBlockRecvBuffer + adds r3, r1, r0 + movs r0, 0x64 + muls r0, r4 + ldr r1, =gUnknown_02039B58 + adds r0, r1 + ldrb r2, [r5] + adds r1, r3, 0 + bl sub_80C3120 + adds r5, 0x1C + adds r4, 0x1 +_08014152: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + blt _08014138 + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _08014190 + bl GetMultiplayerId + movs r1, 0x1 + eors r0, r1 + lsls r0, 24 + lsrs r0, 16 + ldr r1, =gBlockRecvBuffer + adds r3, r0, r1 + adds r0, r3, 0 + adds r0, 0x60 + ldrh r0, [r0] + bl sub_801B94C + b _08014194 + .pool +_08014190: + bl sub_801B940 +_08014194: + bl ResetBlockReceivedFlags + adds r0, r6, 0 + bl DestroyTask +_0801419E: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_80140E0 + + thumb_func_start sub_80141A4 +sub_80141A4: @ 80141A4 + push {r4,lr} + ldr r0, =gMain + movs r1, 0x87 + lsls r1, 3 + adds r4, r0, r1 + ldrb r0, [r4] + cmp r0, 0 + beq _080141C0 + cmp r0, 0x1 + beq _080141D4 + b _080141F2 + .pool +_080141C0: + ldr r0, =sub_80140E0 + movs r1, 0x5 + bl CreateTask + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _080141F2 + .pool +_080141D4: + ldr r0, =sub_80140E0 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _080141F2 + bl GetMultiplayerId + movs r1, 0x1 + eors r0, r1 + lsls r0, 24 + lsrs r0, 24 + ldr r1, =c2_exit_to_overworld_2_switch + bl sub_80C4E74 +_080141F2: + bl RunTasks + bl RunTextPrinters + bl AnimateSprites + bl BuildOamBuffer + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80141A4 + + thumb_func_start sub_8014210 +sub_8014210: @ 8014210 + push {r4-r6,lr} + adds r6, r0, 0 + lsls r6, 16 + lsrs r6, 16 + bl sp000_heal_pokemon + bl copy_player_party_to_sav1 + bl copy_bags_and_unk_data_from_save_blocks + ldr r5, =gLinkPlayers + ldr r0, =0x00002211 + str r0, [r5, 0x14] + bl GetMultiplayerId + adds r4, r0, 0 + bl GetMultiplayerId + lsls r4, 24 + lsrs r4, 24 + lsls r1, r4, 3 + subs r1, r4 + lsls r1, 2 + adds r1, r5 + lsls r0, 24 + lsrs r0, 24 + strh r0, [r1, 0x18] + bl GetMultiplayerId + adds r4, r0, 0 + bl GetMultiplayerId + movs r2, 0x1 + eors r4, r2 + lsls r4, 24 + lsrs r4, 24 + lsls r1, r4, 3 + subs r1, r4 + lsls r1, 2 + adds r1, r5 + eors r0, r2 + lsls r0, 24 + lsrs r0, 24 + strh r0, [r1, 0x18] + ldr r1, =gMain + ldr r0, =sub_80B360C + str r0, [r1, 0x8] + ldr r0, =gBattleTypeFlags + str r6, [r0] + bl PlayBattleBGM + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8014210 + + thumb_func_start sub_8014290 +sub_8014290: @ 8014290 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x8 + adds r3, r0, 0 + adds r4, r1, 0 + adds r5, r2, 0 + lsls r3, 16 + lsrs r3, 16 + lsls r4, 16 + lsrs r4, 16 + lsls r5, 16 + lsrs r5, 16 + ldr r0, =0x00004087 + adds r1, r3, 0 + bl VarSet + ldr r6, =gSaveBlock1Ptr + ldr r1, [r6] + movs r0, 0x4 + ldrsb r0, [r1, r0] + ldrb r1, [r1, 0x5] + lsls r1, 24 + asrs r1, 24 + movs r2, 0x1 + negs r2, r2 + mov r8, r2 + lsls r4, 24 + asrs r4, 24 + lsls r5, 24 + asrs r5, 24 + str r5, [sp] + adds r3, r4, 0 + bl Overworld_SetWarpDestination + ldr r0, [r6] + movs r1, 0x4 + ldrsb r1, [r0, r1] + movs r2, 0x5 + ldrsb r2, [r0, r2] + str r4, [sp] + str r5, [sp, 0x4] + movs r0, 0 + mov r3, r8 + bl saved_warp2_set_2 + bl warp_in + add sp, 0x8 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8014290 + + thumb_func_start sub_8014304 +sub_8014304: @ 8014304 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x4 + adds r4, r0, 0 + adds r5, r1, 0 + mov r8, r2 + adds r6, r3, 0 + ldr r1, [sp, 0x18] + lsls r4, 24 + lsrs r4, 24 + lsls r5, 24 + lsrs r5, 24 + lsls r1, 16 + lsrs r1, 16 + ldr r0, =gSpecialVar_0x8004 + strh r1, [r0] + ldr r0, =0x00004087 + bl VarSet + bl GetLinkPlayerCount + ldr r1, =gUnknown_03005DB8 + strb r0, [r1] + bl GetMultiplayerId + ldr r1, =gUnknown_03005DB4 + strb r0, [r1] + bl sub_809D2BC + lsls r4, 24 + asrs r4, 24 + lsls r5, 24 + asrs r5, 24 + movs r2, 0x1 + negs r2, r2 + mov r0, r8 + lsls r0, 24 + asrs r0, 24 + mov r8, r0 + lsls r6, 24 + asrs r6, 24 + str r6, [sp] + adds r0, r4, 0 + adds r1, r5, 0 + mov r3, r8 + bl Overworld_SetWarpDestination + bl warp_in + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8014304 + + thumb_func_start sub_8014384 +sub_8014384: @ 8014384 + push {r4,lr} + ldr r0, =gMain + movs r1, 0x87 + lsls r1, 3 + adds r4, r0, r1 + ldrb r0, [r4] + cmp r0, 0 + beq _080143A0 + cmp r0, 0x1 + beq _080143B4 + b _080143C6 + .pool +_080143A0: + ldr r0, =sub_80140E0 + movs r1, 0x5 + bl CreateTask + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _080143C6 + .pool +_080143B4: + ldr r0, =sub_80140E0 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _080143C6 + ldr r0, =sub_8086074 + bl SetMainCallback2 +_080143C6: + bl RunTasks + bl RunTextPrinters + bl AnimateSprites + bl BuildOamBuffer + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8014384 + + thumb_func_start sub_80143E4 +sub_80143E4: @ 80143E4 + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + bl sub_80C30A4 + cmp r5, 0 + beq _080143FE + bl sub_801B39C + adds r1, r4, 0 + adds r1, 0x60 + strh r0, [r1] + b _08014404 +_080143FE: + adds r0, r4, 0 + adds r0, 0x60 + strh r5, [r0] +_08014404: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_80143E4 + + thumb_func_start sub_801440C +sub_801440C: @ 801440C + push {r4,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r4, r0, 24 + bl sub_801B940 + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + subs r0, 0x1 + cmp r0, 0xE + bhi _08014474 + lsls r0, 2 + ldr r1, =_08014434 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08014434: + .4byte _08014470 + .4byte _08014470 + .4byte _08014470 + .4byte _08014470 + .4byte _08014474 + .4byte _08014474 + .4byte _08014474 + .4byte _08014474 + .4byte _08014470 + .4byte _08014470 + .4byte _08014470 + .4byte _08014474 + .4byte _08014470 + .4byte _08014474 + .4byte _08014470 +_08014470: + bl sub_800E3A8 +_08014474: + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + subs r0, 0x1 + cmp r0, 0x50 + bls _08014480 + b _08014764 +_08014480: + lsls r0, 2 + ldr r1, =_08014494 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08014494: + .4byte _080145F4 + .4byte _08014620 + .4byte _0801464C + .4byte _08014678 + .4byte _080146D8 + .4byte _08014764 + .4byte _08014764 + .4byte _080146FC + .4byte _08014714 + .4byte _08014734 + .4byte _0801474C + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014698 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _080145D8 + .4byte _08014764 + .4byte _08014764 + .4byte _080146C4 + .4byte _080146D8 + .4byte _08014764 + .4byte _08014764 + .4byte _080146FC + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _08014764 + .4byte _080145D8 +_080145D8: + bl overworld_free_bg_tilemaps + ldr r1, =gMain + ldr r0, =sub_801AC54 + str r0, [r1, 0x8] + movs r0, 0x3 + bl sub_81B8518 + b _08014764 + .pool +_080145F4: + bl overworld_free_bg_tilemaps + ldr r0, =gUnknown_020228C4 + movs r1, 0x1 + bl sub_80143E4 + bl sp000_heal_pokemon + bl copy_player_party_to_sav1 + bl copy_bags_and_unk_data_from_save_blocks + movs r0, 0x1 + str r0, [sp] + movs r0, 0x19 + movs r1, 0x18 + movs r2, 0x6 + movs r3, 0x8 + b _080146B0 + .pool +_08014620: + bl overworld_free_bg_tilemaps + bl sp000_heal_pokemon + bl copy_player_party_to_sav1 + bl copy_bags_and_unk_data_from_save_blocks + ldr r0, =gUnknown_020228C4 + movs r1, 0x1 + bl sub_80143E4 + movs r0, 0x2 + str r0, [sp] + movs r0, 0x19 + movs r1, 0x18 + movs r2, 0x6 + movs r3, 0x8 + b _080146B0 + .pool +_0801464C: + bl overworld_free_bg_tilemaps + bl sp000_heal_pokemon + bl copy_player_party_to_sav1 + bl copy_bags_and_unk_data_from_save_blocks + ldr r0, =gUnknown_020228C4 + movs r1, 0x1 + bl sub_80143E4 + movs r0, 0x5 + str r0, [sp] + movs r0, 0x19 + movs r1, 0x1B + movs r2, 0x5 + movs r3, 0x8 + b _080146B0 + .pool +_08014678: + ldr r0, =gUnknown_020228C4 + movs r1, 0x1 + bl sub_80143E4 + bl overworld_free_bg_tilemaps + movs r0, 0x3 + str r0, [sp] + movs r0, 0x19 + movs r1, 0x19 + movs r2, 0x5 + movs r3, 0x8 + b _080146B0 + .pool +_08014698: + ldr r0, =gUnknown_020228C4 + movs r1, 0x1 + bl sub_80143E4 + bl overworld_free_bg_tilemaps + movs r0, 0x4 + str r0, [sp] + movs r0, 0x19 + movs r1, 0x1A + movs r2, 0x8 + movs r3, 0x9 +_080146B0: + bl sub_8014304 + ldr r0, =sub_8014384 + bl SetMainCallback2 + b _08014764 + .pool +_080146C4: + bl overworld_free_bg_tilemaps + ldr r0, =sub_8013F90 + movs r1, 0 + bl CreateTask + b _08014764 + .pool +_080146D8: + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + bne _080146E8 + bl sub_800ED10 + b _080146F6 +_080146E8: + bl sub_800ED28 + movs r0, 0x45 + movs r1, 0 + movs r2, 0x1 + bl sub_8010F84 +_080146F6: + bl sub_801DD98 + b _08014764 +_080146FC: + ldr r0, =gUnknown_020228C4 + movs r1, 0 + bl sub_80143E4 + ldr r0, =sub_80141A4 + bl SetMainCallback2 + b _08014764 + .pool +_08014714: + movs r0, 0x8 + movs r1, 0x5 + movs r2, 0x1 + bl sub_8014290 + bl brm_get_pokemon_selection + lsls r0, 24 + lsrs r0, 24 + ldr r1, =c2_load_new_map + bl sub_802A9A8 + b _08014764 + .pool +_08014734: + movs r0, 0x7 + movs r1, 0x9 + movs r2, 0x1 + bl sub_8014290 + ldr r0, =c2_load_new_map + bl sub_8020C70 + b _08014764 + .pool +_0801474C: + movs r0, 0x8 + movs r1, 0x5 + movs r2, 0x1 + bl sub_8014290 + bl brm_get_pokemon_selection + lsls r0, 24 + lsrs r0, 24 + ldr r1, =c2_load_new_map + bl sub_802493C +_08014764: + adds r0, r4, 0 + bl DestroyTask + ldr r1, =gScriptResult + movs r0, 0x1 + strh r0, [r1] + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + cmp r0, 0x44 + beq _0801477C + bl ScriptContext2_Disable +_0801477C: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801440C + + thumb_func_start sub_8014790 +sub_8014790: @ 8014790 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r7, r0, r1 + ldr r0, =gUnknown_020228C4 + mov r9, r0 + movs r1, 0 + ldrsh r0, [r7, r1] + mov r2, r9 + cmp r0, 0x8 + bls _080147B6 + b _080149B2 +_080147B6: + lsls r0, 2 + ldr r1, =_080147CC + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080147CC: + .4byte _080147F0 + .4byte _080148CC + .4byte _080148E4 + .4byte _0801491E + .4byte _08014934 + .4byte _0801494A + .4byte _08014986 + .4byte _08014992 + .4byte _0801499C +_080147F0: + ldr r1, =gScriptResult + movs r0, 0x1 + strh r0, [r1] + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + subs r0, 0xE + cmp r0, 0xE + bhi _080148C2 + lsls r0, 2 + ldr r1, =_08014818 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08014818: + .4byte _08014854 + .4byte _080148C2 + .4byte _080148B8 + .4byte _080148C2 + .4byte _080148C2 + .4byte _080148C2 + .4byte _080148C2 + .4byte _080148C2 + .4byte _080148C2 + .4byte _080148B8 + .4byte _080148B8 + .4byte _080148B8 + .4byte _080148B8 + .4byte _080148B8 + .4byte _08014854 +_08014854: + ldr r1, =gLinkPlayers + ldr r0, =0x00002211 + str r0, [r1, 0x14] + movs r2, 0 + mov r8, r2 + mov r0, r8 + strh r0, [r1, 0x18] + movs r0, 0x2 + strh r0, [r1, 0x34] + ldr r6, =gUnknown_0203CEF8 + ldrb r0, [r6] + movs r5, 0x64 + muls r0, r5 + ldr r4, =gBattleScripting + 0x14 + adds r0, r4 + movs r1, 0xB + bl GetMonData + mov r1, r9 + strh r0, [r1] + ldrb r0, [r6, 0x1] + muls r0, r5 + adds r0, r4 + movs r1, 0xB + movs r2, 0 + bl GetMonData + mov r2, r9 + strh r0, [r2, 0x2] + ldr r0, =gMain + mov r1, r8 + str r1, [r0, 0x8] + movs r0, 0x4 + strh r0, [r7] + bl sub_800E3A8 + bl ResetBlockReceivedFlags + b _080149B2 + .pool +_080148B8: + bl sub_800E3A8 + adds r0, r4, 0 + bl DestroyTask +_080148C2: + bl EnableBothScriptContexts + movs r0, 0x1 + strh r0, [r7] + b _080149B2 +_080148CC: + bl ScriptContext1_IsScriptSetUp + lsls r0, 24 + cmp r0, 0 + bne _080149B2 + movs r0, 0x1 + movs r1, 0 + bl fade_screen + movs r0, 0x2 + strh r0, [r7] + b _080149B2 +_080148E4: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _080149B2 + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + cmp r0, 0x1D + bne _08014914 + adds r0, r4, 0 + bl DestroyTask + ldr r0, =sub_80773AC + bl SetMainCallback2 + b _080149B2 + .pool +_08014914: + bl sub_800ADF8 + movs r0, 0x3 + strh r0, [r7] + b _080149B2 +_0801491E: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080149B2 + adds r0, r4, 0 + bl DestroyTask + bl sub_80149D8 + b _080149B2 +_08014934: + movs r0, 0 + adds r1, r2, 0 + movs r2, 0xE + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _080149B2 + movs r0, 0x5 + strh r0, [r7] + b _080149B2 +_0801494A: + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bne _080149B2 + bl ResetBlockReceivedFlags + ldr r0, =gBlockRecvBuffer + movs r2, 0x80 + lsls r2, 1 + adds r1, r0, r2 + bl sub_80B2AF4 + cmp r0, 0 + beq _08014980 + ldr r0, =gScriptResult + movs r1, 0xB + strh r1, [r0] + movs r0, 0x7 + strh r0, [r7] + b _080149B2 + .pool +_08014980: + movs r0, 0x6 + strh r0, [r7] + b _080149B2 +_08014986: + bl EnableBothScriptContexts + adds r0, r4, 0 + bl DestroyTask + b _080149B2 +_08014992: + bl sub_800AC34 + movs r0, 0x8 + strh r0, [r7] + b _080149B2 +_0801499C: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _080149B2 + bl sub_800E084 + bl EnableBothScriptContexts + adds r0, r4, 0 + bl DestroyTask +_080149B2: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8014790 + + thumb_func_start sub_80149C4 +sub_80149C4: @ 80149C4 + push {lr} + ldr r0, =sub_8014790 + movs r1, 0 + bl CreateTask + pop {r0} + bx r0 + .pool + thumb_func_end sub_80149C4 + + thumb_func_start sub_80149D8 +sub_80149D8: @ 80149D8 + push {lr} + ldr r0, =sub_801440C + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + movs r0, 0 + strh r0, [r1, 0x8] + pop {r0} + bx r0 + .pool + thumb_func_end sub_80149D8 + + thumb_func_start sub_8014A00 +sub_8014A00: @ 8014A00 + push {r4,lr} + adds r4, r0, 0 + ldr r0, =sub_8014A40 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gUnknown_02022C30 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r1, r0 + str r1, [r2] + movs r2, 0 + strb r2, [r1, 0xC] + strb r2, [r1, 0xD] + strb r4, [r1, 0x18] + ldr r0, =gScriptResult + strh r2, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8014A00 + + thumb_func_start sub_8014A40 +sub_8014A40: @ 8014A40 + push {r4-r6,lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r4, r0, 24 + ldr r0, =gUnknown_02022C30 + ldr r5, [r0] + ldrb r0, [r5, 0xC] + cmp r0, 0x11 + bls _08014A54 + b _08014EF2 +_08014A54: + lsls r0, 2 + ldr r1, =_08014A68 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08014A68: + .4byte _08014AB0 + .4byte _08014AEC + .4byte _08014BBC + .4byte _08014BEC + .4byte _08014BFC + .4byte _08014C4C + .4byte _08014C24 + .4byte _08014C52 + .4byte _08014CF2 + .4byte _08014DBC + .4byte _08014DCC + .4byte _08014DE2 + .4byte _08014DFA + .4byte _08014E16 + .4byte _08014E4E + .4byte _08014E74 + .4byte _08014EA8 + .4byte _08014EE2 +_08014AB0: + ldr r1, =gUnknown_02022C2C + ldrb r0, [r5, 0x18] + strb r0, [r1] + ldr r1, =gUnknown_02022C2D + movs r0, 0x2 + strb r0, [r1] + ldrb r0, [r5, 0x18] + movs r1, 0 + movs r2, 0 + bl sub_8010F84 + movs r0, 0 + movs r1, 0 + bl sub_8010FA0 + bl sub_800B488 + bl sub_8009734 + movs r0, 0x2 + bl sub_8011C10 + movs r0, 0x1 + strb r0, [r5, 0xC] + b _08014EF2 + .pool +_08014AEC: + movs r0, 0x70 + bl AllocZeroed + str r0, [r5, 0x4] + movs r0, 0xA0 + bl AllocZeroed + str r0, [r5] + movs r0, 0xA0 + bl AllocZeroed + str r0, [r5, 0x8] + ldr r0, [r5, 0x4] + movs r1, 0x4 + bl sub_80175EC + ldr r0, [r5] + movs r1, 0x5 + bl sub_8017580 + ldr r0, [r5] + adds r1, r0, 0 + adds r1, 0x10 + bl sub_800DF90 + ldr r1, [r5] + movs r3, 0 + movs r0, 0 + strh r0, [r1, 0x18] + ldr r2, [r5] + ldrb r1, [r2, 0x1A] + subs r0, 0x4 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0x1A] + ldr r2, [r5] + ldrb r1, [r2, 0x1A] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0x1A] + ldr r0, [r5] + strb r3, [r0, 0x1B] + ldr r0, [r5, 0x4] + movs r1, 0xFF + bl sub_8016FC0 + strb r0, [r5, 0x17] + ldr r0, =gUnknown_082F011C + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp] + str r1, [sp, 0x4] + bl sub_8019930 + lsls r0, 16 + ldr r2, =0x0000ffff + ldr r1, [sp, 0x4] + ands r1, r2 + orrs r1, r0 + ldr r0, =0xffff00ff + ands r1, r0 + movs r0, 0xC0 + lsls r0, 4 + orrs r1, r0 + str r1, [sp, 0x4] + mov r0, sp + bl AddWindow + strb r0, [r5, 0xF] + ldrb r0, [r5, 0xF] + bl sub_8018784 + ldr r0, =gUnknown_03006310 + adds r2, r0, 0 + ldr r1, =gUnknown_082F015C + ldm r1!, {r3,r4,r6} + stm r2!, {r3,r4,r6} + ldm r1!, {r3,r4,r6} + stm r2!, {r3,r4,r6} + ldrb r1, [r5, 0xF] + strb r1, [r0, 0x10] + movs r1, 0 + movs r2, 0 + bl ListMenuInit + strb r0, [r5, 0x12] + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + strb r0, [r5, 0x13] + b _08014C42 + .pool +_08014BBC: + ldr r0, =gStringVar1 + ldr r2, =gUnknown_082F0048 + ldr r4, =gUnknown_02022C2C + ldrb r1, [r4] + lsls r1, 2 + adds r1, r2 + ldr r1, [r1] + bl StringCopy + ldr r0, =gStringVar4 + ldrb r1, [r4] + bl sub_801262C + movs r0, 0x3 + strb r0, [r5, 0xC] + b _08014EF2 + .pool +_08014BEC: + ldr r0, =gStringVar4 + bl sub_8018884 + movs r0, 0x4 + strb r0, [r5, 0xC] + b _08014EF2 + .pool +_08014BFC: + adds r0, r5, 0 + movs r1, 0x5 + movs r2, 0x6 + bl sub_801320C + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + bne _08014C14 + b _08014EF2 +_08014C14: + movs r0, 0xD + strb r0, [r5, 0xC] + bl sub_800E084 + b _08014EF2 + .pool +_08014C24: + adds r0, r5, 0 + adds r0, 0xD + ldr r1, =gUnknown_082EDF40 + bl mevent_0814257C + cmp r0, 0 + bne _08014C34 + b _08014EF2 +_08014C34: + ldr r0, [r5] + bl sub_8013398 + strb r0, [r5, 0x13] + ldrb r0, [r5, 0x12] + bl sub_81AE70C +_08014C42: + movs r0, 0x2 + strb r0, [r5, 0xC] + b _08014EF2 + .pool +_08014C4C: + movs r0, 0x7 + strb r0, [r5, 0xC] + b _08014EF2 +_08014C52: + adds r0, r5, 0 + adds r0, 0xD + adds r1, r5, 0 + adds r1, 0x14 + ldr r3, =gStringVar4 + movs r2, 0 + bl sub_8018B08 + lsls r0, 24 + asrs r4, r0, 24 + cmp r4, 0 + beq _08014C82 + cmp r4, 0 + bgt _08014C7C + movs r0, 0x1 + negs r0, r0 + cmp r4, r0 + beq _08014CC4 + b _08014EF2 + .pool +_08014C7C: + cmp r4, 0x1 + beq _08014CC4 + b _08014EF2 +_08014C82: + bl sub_800E0E8 + movs r0, 0 + movs r1, 0 + bl sub_800DFB4 + ldr r1, [r5] + ldrb r0, [r5, 0x13] + lsls r0, 5 + adds r1, r0 + strb r4, [r1, 0x1B] + ldrb r0, [r5, 0x12] + bl sub_81AE70C + movs r0, 0x5 + strb r0, [r5, 0x19] + ldrb r1, [r5, 0x13] + lsls r1, 5 + ldr r0, [r5] + adds r0, r1 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + ldrb r0, [r5, 0x13] + lsls r0, 5 + ldr r2, [r5] + adds r2, r0 + adds r2, 0x10 + movs r0, 0x5 + b _08014CE8 +_08014CC4: + movs r0, 0x6 + strb r0, [r5, 0x19] + ldrb r1, [r5, 0x13] + lsls r1, 5 + ldr r0, [r5] + adds r0, r1 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + ldrb r0, [r5, 0x13] + lsls r0, 5 + ldr r2, [r5] + adds r2, r0 + adds r2, 0x10 + movs r0, 0x6 +_08014CE8: + bl sub_8010688 + movs r0, 0x8 + strb r0, [r5, 0xC] + b _08014EF2 +_08014CF2: + ldrb r1, [r5, 0x13] + lsls r1, 5 + ldr r0, [r5] + adds r0, r1 + adds r0, 0x2 + bl sub_8015658 + lsls r0, 16 + lsrs r0, 16 + ldrb r2, [r5, 0x13] + lsls r2, 5 + ldr r1, [r5] + adds r1, r2 + adds r1, 0x10 + bl sub_8010714 + adds r4, r0, 0 + cmp r4, 0x1 + bne _08014DAA + ldrb r0, [r5, 0x19] + cmp r0, 0x5 + bne _08014D64 + ldr r1, [r5] + ldrb r0, [r5, 0x13] + lsls r0, 5 + adds r1, r0 + movs r0, 0 + strb r0, [r1, 0x1B] + ldrb r0, [r5, 0x12] + bl sub_81AE70C + ldrb r0, [r5, 0x13] + adds r0, 0x1 + strb r0, [r5, 0x13] + ldr r0, =gStringVar1 + ldrb r2, [r5, 0x13] + lsls r2, 5 + subs r2, 0x20 + ldr r1, [r5] + adds r1, r2 + bl sub_8018404 + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EDC9C + bl StringExpandPlaceholders + movs r0, 0x9 + strb r0, [r5, 0xC] + bl sub_800EF38 + b _08014DA4 + .pool +_08014D64: + ldrb r1, [r5, 0x13] + lsls r1, 5 + ldr r0, [r5] + adds r0, r1 + adds r4, r0, 0 + adds r4, 0x10 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + bl sub_8011DC0 + ldr r1, [r5] + ldrb r0, [r5, 0x13] + lsls r0, 5 + adds r1, r0 + ldrb r2, [r1, 0x1A] + movs r0, 0x4 + negs r0, r0 + ands r0, r2 + strb r0, [r1, 0x1A] + ldr r0, [r5] + bl sub_8013398 + ldrb r0, [r5, 0x12] + bl sub_81AE70C + movs r0, 0x2 + strb r0, [r5, 0xC] +_08014DA4: + movs r0, 0 + strb r0, [r5, 0x19] + b _08014EF2 +_08014DAA: + cmp r4, 0x2 + beq _08014DB0 + b _08014EF2 +_08014DB0: + movs r0, 0 + movs r1, 0 + bl sub_8011A64 + strb r4, [r5, 0xC] + b _08014EF2 +_08014DBC: + ldr r0, =gStringVar4 + bl sub_8018884 + movs r0, 0xA + strb r0, [r5, 0xC] + b _08014EF2 + .pool +_08014DCC: + ldrb r0, [r5, 0xE] + adds r0, 0x1 + strb r0, [r5, 0xE] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x78 + bhi _08014DDC + b _08014EF2 +_08014DDC: + movs r0, 0xB + strb r0, [r5, 0xC] + b _08014EF2 +_08014DE2: + adds r0, r5, 0 + movs r1, 0x5 + movs r2, 0x6 + bl sub_801320C + lsls r0, 24 + cmp r0, 0 + beq _08014DF4 + b _08014EF2 +_08014DF4: + movs r0, 0xC + strb r0, [r5, 0xC] + b _08014EF2 +_08014DFA: + bl sub_800EF1C + lsls r0, 24 + cmp r0, 0 + beq _08014E10 + movs r0, 0 + bl sub_800EF58 + movs r0, 0xF + strb r0, [r5, 0xC] + b _08014EF2 +_08014E10: + movs r0, 0x6 + strb r0, [r5, 0xC] + b _08014EF2 +_08014E16: + bl sub_800E084 + bl sub_800EDD4 + ldrb r0, [r5, 0x12] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldrb r0, [r5, 0xF] + bl RemoveWindow + ldrb r0, [r5, 0x17] + bl DestroyTask + ldr r0, [r5, 0x8] + bl Free + ldr r0, [r5] + bl Free + ldr r0, [r5, 0x4] + bl Free + b _08014EDA +_08014E4E: + adds r0, r5, 0 + adds r0, 0xD + ldr r1, =gText_PleaseStartOver + bl mevent_0814257C + cmp r0, 0 + beq _08014EF2 + adds r0, r4, 0 + bl DestroyTask + ldr r1, =gScriptResult + movs r0, 0x5 + strh r0, [r1] + b _08014EF2 + .pool +_08014E74: + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08014E8C + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _08014E92 +_08014E8C: + movs r0, 0xD + strb r0, [r5, 0xC] + b _08014EF2 +_08014E92: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _08014EF2 + movs r0, 0x1 + bl sub_8011068 + b _08014EDA + .pool +_08014EA8: + ldrb r0, [r5, 0x12] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldrb r0, [r5, 0xF] + bl RemoveWindow + ldrb r0, [r5, 0x17] + bl DestroyTask + ldr r0, [r5, 0x8] + bl Free + ldr r0, [r5] + bl Free + ldr r0, [r5, 0x4] + bl Free + bl sub_800ADF8 +_08014EDA: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] + b _08014EF2 +_08014EE2: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08014EF2 + adds r0, r4, 0 + bl DestroyTask +_08014EF2: + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8014A40 + + thumb_func_start sub_8014EFC +sub_8014EFC: @ 8014EFC + push {r4,lr} + adds r4, r0, 0 + ldr r0, =sub_8014F48 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gUnknown_02022C30 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r1, r0 + str r1, [r2] + ldr r0, =gUnknown_03000DA4 + str r1, [r0] + movs r2, 0 + strb r2, [r1, 0x8] + strb r2, [r1, 0x9] + subs r4, 0x15 + strb r4, [r1, 0x12] + ldr r0, =gScriptResult + strh r2, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8014EFC + + thumb_func_start sub_8014F48 +sub_8014F48: @ 8014F48 + push {r4-r7,lr} + sub sp, 0x10 + lsls r0, 24 + lsrs r6, r0, 24 + ldr r0, =gUnknown_02022C30 + ldr r7, [r0] + ldrb r0, [r7, 0x8] + cmp r0, 0xC + bls _08014F5C + b _080152A0 +_08014F5C: + lsls r0, 2 + ldr r1, =_08014F70 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08014F70: + .4byte _08014FA4 + .4byte _08014FD8 + .4byte _08014FE8 + .4byte _080150B8 + .4byte _08015180 + .4byte _080151A4 + .4byte _08015204 + .4byte _08015260 + .4byte _08015204 + .4byte _0801523A + .4byte _08015204 + .4byte _08015284 + .4byte _08015290 +_08014FA4: + ldrb r0, [r7, 0x12] + adds r0, 0x15 + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + movs r2, 0 + bl sub_8010F84 + bl sub_800B488 + bl sub_8009734 + bl sub_8011C5C + movs r0, 0x70 + bl AllocZeroed + str r0, [r7, 0x4] + movs r0, 0x80 + lsls r0, 2 + bl AllocZeroed + str r0, [r7] + movs r0, 0x1 + strb r0, [r7, 0x8] + b _080152A0 +_08014FD8: + ldr r0, =gUnknown_082EF7F8 + bl sub_8018884 + movs r0, 0x2 + strb r0, [r7, 0x8] + b _080152A0 + .pool +_08014FE8: + ldr r0, [r7, 0x4] + movs r1, 0x4 + bl sub_80175EC + ldr r0, [r7] + movs r1, 0x10 + bl sub_8017580 + ldr r0, [r7, 0x4] + ldrb r1, [r7, 0x12] + adds r1, 0x7 + bl sub_8016FC0 + movs r6, 0 + strb r0, [r7, 0x11] + ldr r0, =gUnknown_082F0174 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp] + str r1, [sp, 0x4] + bl sub_8019930 + lsls r0, 16 + ldr r2, =0x0000ffff + ldr r1, [sp, 0x4] + ands r1, r2 + orrs r1, r0 + ldr r5, =0xffff00ff + ands r1, r5 + movs r4, 0xC0 + lsls r4, 4 + orrs r1, r4 + str r1, [sp, 0x4] + mov r0, sp + bl AddWindow + strb r0, [r7, 0xB] + ldr r0, =gUnknown_082F017C + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x8] + str r1, [sp, 0xC] + add r0, sp, 0x8 + ldr r1, [r0, 0x4] + ands r1, r5 + orrs r1, r4 + str r1, [r0, 0x4] + bl AddWindow + strb r0, [r7, 0xD] + ldrb r0, [r7, 0xB] + bl sub_8018784 + ldr r0, =gUnknown_03006310 + adds r2, r0, 0 + ldr r1, =gUnknown_082F0204 + ldm r1!, {r3-r5} + stm r2!, {r3-r5} + ldm r1!, {r3-r5} + stm r2!, {r3-r5} + ldrb r1, [r7, 0xB] + strb r1, [r0, 0x10] + movs r1, 0 + movs r2, 0 + bl ListMenuInit + strb r0, [r7, 0xE] + ldrb r0, [r7, 0xD] + bl sub_8018784 + ldrb r0, [r7, 0xD] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldrb r0, [r7, 0xD] + bl PutWindowTilemap + ldrb r0, [r7, 0xD] + bl sub_80125BC + ldrb r0, [r7, 0xD] + movs r1, 0x2 + bl CopyWindowToVram + movs r0, 0 + bl CopyBgTilemapBufferToVram + strb r6, [r7, 0xF] + movs r0, 0x3 + strb r0, [r7, 0x8] + b _080152A0 + .pool +_080150B8: + bl sub_8013E44 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0 + beq _080150D6 + cmp r2, 0x1 + bne _080150CE + movs r0, 0x2 + bl PlaySE +_080150CE: + ldrb r0, [r7, 0xE] + bl sub_81AE70C + b _080152A0 +_080150D6: + ldrb r0, [r7, 0xE] + bl ListMenuHandleInput + adds r2, r0, 0 + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08015168 + movs r0, 0x1 + negs r0, r0 + cmp r2, r0 + beq _08015168 + ldr r0, [r7] + lsls r1, r2, 5 + adds r0, r1 + ldrb r1, [r0, 0xA] + ldrb r0, [r0, 0x1A] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _08015160 + lsrs r0, r1, 7 + cmp r0, 0 + bne _08015160 + strb r2, [r7, 0xF] + bl sub_800E0E8 + movs r0, 0 + movs r1, 0 + bl sub_800DFB4 + ldrb r0, [r7, 0xE] + bl sub_81AE70C + ldr r0, =gStringVar1 + ldrb r2, [r7, 0xF] + lsls r2, 5 + ldr r1, [r7] + adds r1, r2 + bl sub_8018404 + ldrb r1, [r7, 0xF] + lsls r1, 5 + ldr r0, [r7] + adds r0, r1 + adds r4, r0, 0 + adds r4, 0x10 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + bl sub_8011FC8 + movs r0, 0x6E + bl PlaySE + movs r0, 0x4 + strb r0, [r7, 0x8] + b _080152A0 + .pool +_08015160: + movs r0, 0x7 + bl PlaySE + b _080152A0 +_08015168: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + bne _08015176 + b _080152A0 +_08015176: + movs r0, 0x6 + strb r0, [r7, 0x8] + b _080152A0 + .pool +_08015180: + ldr r0, =gUnknown_082EFC3C + bl sub_8018884 + ldr r0, =gStringVar1 + ldrb r2, [r7, 0xF] + lsls r2, 5 + ldr r1, [r7] + adds r1, r2 + bl sub_8018404 + movs r0, 0x5 + strb r0, [r7, 0x8] + b _080152A0 + .pool +_080151A4: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _080151C2 + ldr r2, =gUnknown_02022C2C + ldr r1, [r7] + ldrb r0, [r7, 0xF] + lsls r0, 5 + adds r1, r0 + ldrb r0, [r1, 0xA] + lsls r0, 25 + lsrs r0, 25 + strb r0, [r2] + movs r0, 0xA + strb r0, [r7, 0x8] +_080151C2: + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x5 + beq _080151EE + cmp r0, 0x5 + bgt _080151E4 + cmp r0, 0x2 + bgt _080152A0 + cmp r0, 0x1 + blt _080152A0 + b _080151E8 + .pool +_080151E4: + cmp r0, 0x6 + bne _080152A0 +_080151E8: + movs r0, 0x8 + strb r0, [r7, 0x8] + b _080152A0 +_080151EE: + ldr r0, =gUnknown_082EDDF4 + bl sub_8018884 + movs r0, 0 + movs r1, 0 + bl sub_8011A64 + b _080152A0 + .pool +_08015204: + ldrb r0, [r7, 0xE] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldrb r0, [r7, 0xD] + bl RemoveWindow + ldrb r0, [r7, 0xB] + bl RemoveWindow + ldrb r0, [r7, 0x11] + bl DestroyTask + ldr r0, [r7] + bl Free + ldr r0, [r7, 0x4] + bl Free + ldrb r0, [r7, 0x8] + adds r0, 0x1 + strb r0, [r7, 0x8] + b _080152A0 +_0801523A: + adds r5, r7, 0 + adds r5, 0x9 + ldr r4, =gUnknown_082EDF80 + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 22 + adds r0, r4 + ldr r1, [r0] + adds r0, r5, 0 + bl mevent_0814257C + cmp r0, 0 + beq _080152A0 + bl sub_800E084 + b _0801526A + .pool +_08015260: + bl sub_800E084 + ldr r0, =gText_PleaseStartOver + bl sub_8018884 +_0801526A: + adds r0, r6, 0 + bl DestroyTask + bl sub_800EDD4 + ldr r1, =gScriptResult + movs r0, 0x5 + strh r0, [r1] + b _080152A0 + .pool +_08015284: + ldrb r0, [r7, 0x8] + adds r0, 0x1 + strb r0, [r7, 0x8] + bl sub_800ADF8 + b _080152A0 +_08015290: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080152A0 + adds r0, r6, 0 + bl DestroyTask +_080152A0: + add sp, 0x10 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8014F48 + + thumb_func_start sub_80152A8 +sub_80152A8: @ 80152A8 + push {r4,lr} + adds r4, r0, 0 + ldr r0, =task00_081182DC + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gUnknown_02022C30 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r1, r0 + str r1, [r2] + ldr r0, =gUnknown_03000DA4 + str r1, [r0] + movs r2, 0 + strb r2, [r1, 0x8] + strb r2, [r1, 0x9] + subs r4, 0x15 + strb r4, [r1, 0x12] + ldr r0, =gScriptResult + strh r2, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80152A8 + + thumb_func_start task00_081182DC +task00_081182DC: @ 80152F4 + push {r4-r6,lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r4, r0, 24 + ldr r0, =gUnknown_02022C30 + ldr r5, [r0] + ldrb r0, [r5, 0x8] + cmp r0, 0xE + bls _08015308 + b _08015604 +_08015308: + lsls r0, 2 + ldr r1, =_0801531C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801531C: + .4byte _08015358 + .4byte _08015386 + .4byte _08015398 + .4byte _08015420 + .4byte _080154E0 + .4byte _08015504 + .4byte _08015564 + .4byte _080155A8 + .4byte _08015564 + .4byte _0801559A + .4byte _08015564 + .4byte _080155B4 + .4byte _08015564 + .4byte _080155E8 + .4byte _080155F4 +_08015358: + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl sub_8010F84 + bl sub_800B488 + bl sub_8009734 + bl sub_8011C5C + movs r0, 0x70 + bl AllocZeroed + str r0, [r5, 0x4] + movs r0, 0x80 + lsls r0, 2 + bl AllocZeroed + str r0, [r5] + movs r0, 0x1 + strb r0, [r5, 0x8] + b _08015604 +_08015386: + ldr r0, =gUnknown_082EFBC8 + bl sub_8018884 + movs r0, 0x2 + strb r0, [r5, 0x8] + b _08015604 + .pool +_08015398: + ldr r0, [r5, 0x4] + movs r1, 0x4 + bl sub_80175EC + ldr r0, [r5] + movs r1, 0x10 + bl sub_8017580 + ldr r0, [r5, 0x4] + ldrb r1, [r5, 0x12] + adds r1, 0x7 + bl sub_8016FF0 + strb r0, [r5, 0x11] + ldrb r0, [r5, 0x13] + cmp r0, 0 + beq _08015404 + ldr r0, =gUnknown_082F0174 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp] + str r1, [sp, 0x4] + bl sub_8019930 + lsls r0, 16 + ldr r2, =0x0000ffff + ldr r1, [sp, 0x4] + ands r1, r2 + orrs r1, r0 + str r1, [sp, 0x4] + mov r0, sp + bl AddWindow + strb r0, [r5, 0xB] + ldrb r0, [r5, 0xB] + bl sub_8018784 + ldr r0, =gUnknown_03006310 + adds r2, r0, 0 + ldr r1, =gUnknown_082F0204 + ldm r1!, {r3,r4,r6} + stm r2!, {r3,r4,r6} + ldm r1!, {r3,r4,r6} + stm r2!, {r3,r4,r6} + ldrb r1, [r5, 0xB] + strb r1, [r0, 0x10] + movs r1, 0 + movs r2, 0 + bl ListMenuInit + strb r0, [r5, 0xE] + movs r0, 0 + bl CopyBgTilemapBufferToVram +_08015404: + movs r0, 0 + strb r0, [r5, 0xF] + movs r0, 0x3 + strb r0, [r5, 0x8] + b _08015604 + .pool +_08015420: + bl sub_8013E44 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0 + beq _08015446 + cmp r0, 0x1 + bne _08015436 + movs r0, 0x2 + bl PlaySE +_08015436: + ldrb r0, [r5, 0x13] + cmp r0, 0 + bne _0801543E + b _08015604 +_0801543E: + ldrb r0, [r5, 0xE] + bl sub_81AE70C + b _08015604 +_08015446: + ldrb r0, [r5, 0x13] + cmp r0, 0 + beq _08015452 + ldrb r0, [r5, 0xE] + bl ListMenuHandleInput +_08015452: + ldrb r0, [r5, 0x14] + cmp r0, 0x78 + bls _080154C0 + ldr r2, [r5] + ldrb r1, [r2, 0x1A] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _080154D4 + ldrb r1, [r2, 0xA] + movs r0, 0x80 + ands r0, r1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + bne _080154D4 + ldrb r1, [r5, 0x12] + adds r1, 0x7 + adds r0, r2, 0 + bl sub_8016F1C + cmp r0, 0 + beq _080154B4 + strb r4, [r5, 0xF] + strb r4, [r5, 0x14] + bl sub_800E0E8 + movs r0, 0 + movs r1, 0 + bl sub_800DFB4 + ldr r0, [r5] + adds r4, r0, 0 + adds r4, 0x10 + adds r0, 0x2 + bl sub_8015658 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + bl sub_8011FC8 + movs r0, 0x6E + bl PlaySE + movs r0, 0x4 + strb r0, [r5, 0x8] + b _080154D4 +_080154B4: + movs r0, 0x16 + bl PlaySE + movs r0, 0xA + strb r0, [r5, 0x8] + b _080154D4 +_080154C0: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _080154D4 + movs r1, 0 + movs r0, 0x6 + strb r0, [r5, 0x8] + strb r1, [r5, 0x14] +_080154D4: + ldrb r0, [r5, 0x14] + adds r0, 0x1 + strb r0, [r5, 0x14] + b _08015604 + .pool +_080154E0: + ldr r0, =gUnknown_082EFC90 + bl sub_8018884 + ldr r0, =gStringVar1 + ldrb r2, [r5, 0xF] + lsls r2, 5 + ldr r1, [r5] + adds r1, r2 + bl sub_8018404 + movs r0, 0x5 + strb r0, [r5, 0x8] + b _08015604 + .pool +_08015504: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _08015522 + ldr r2, =gUnknown_02022C2C + ldr r1, [r5] + ldrb r0, [r5, 0xF] + lsls r0, 5 + adds r1, r0 + ldrb r0, [r1, 0xA] + lsls r0, 25 + lsrs r0, 25 + strb r0, [r2] + movs r0, 0xC + strb r0, [r5, 0x8] +_08015522: + bl sub_8011A74 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x5 + beq _0801554E + cmp r0, 0x5 + bgt _08015544 + cmp r0, 0x2 + bgt _08015604 + cmp r0, 0x1 + blt _08015604 + b _08015548 + .pool +_08015544: + cmp r0, 0x6 + bne _08015604 +_08015548: + movs r0, 0x8 + strb r0, [r5, 0x8] + b _08015604 +_0801554E: + ldr r0, =gUnknown_082EDEC4 + bl sub_8018884 + movs r0, 0 + movs r1, 0 + bl sub_8011A64 + b _08015604 + .pool +_08015564: + ldrb r0, [r5, 0x13] + cmp r0, 0 + beq _08015580 + ldrb r0, [r5, 0xE] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldrb r0, [r5, 0xB] + bl RemoveWindow +_08015580: + ldrb r0, [r5, 0x11] + bl DestroyTask + ldr r0, [r5] + bl Free + ldr r0, [r5, 0x4] + bl Free + ldrb r0, [r5, 0x8] + adds r0, 0x1 + strb r0, [r5, 0x8] + b _08015604 +_0801559A: + adds r0, r5, 0 + adds r0, 0x9 + ldr r1, =gUnknown_082EDF04 + b _080155C2 + .pool +_080155A8: + adds r0, r5, 0 + adds r0, 0x9 + ldr r1, =gText_WirelessSearchCanceled + b _080155C2 + .pool +_080155B4: + adds r0, r5, 0 + adds r0, 0x9 + ldr r2, =gUnknown_082EFD58 + ldrb r1, [r5, 0x12] + lsls r1, 2 + adds r1, r2 + ldr r1, [r1] +_080155C2: + bl mevent_0814257C + cmp r0, 0 + beq _08015604 + bl sub_800E084 + adds r0, r4, 0 + bl DestroyTask + bl sub_800EDD4 + ldr r1, =gScriptResult + movs r0, 0x5 + strh r0, [r1] + b _08015604 + .pool +_080155E8: + ldrb r0, [r5, 0x8] + adds r0, 0x1 + strb r0, [r5, 0x8] + bl sub_800ADF8 + b _08015604 +_080155F4: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08015604 + adds r0, r4, 0 + bl DestroyTask +_08015604: + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end task00_081182DC + + thumb_func_start UnionRoomSpecial +UnionRoomSpecial: @ 801560C + push {r4,lr} + bl sub_8010F60 + ldr r0, =sub_80156E0 + movs r1, 0xA + bl CreateTask + ldr r4, =gUnknown_02022C30 + movs r0, 0x9B + lsls r0, 2 + bl AllocZeroed + str r0, [r4] + ldr r1, =gUnknown_03000DA8 + str r0, [r1] + movs r1, 0 + strb r1, [r0, 0x14] + strb r1, [r0, 0x16] + strh r1, [r0, 0x10] + strh r1, [r0, 0x12] + ldr r0, =gScriptResult + strh r1, [r0] + movs r0, 0xD0 + movs r1, 0x1 + bl sub_819A2BC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end UnionRoomSpecial + + thumb_func_start sub_8015658 +sub_8015658: @ 8015658 + ldrb r1, [r0, 0x1] + lsls r1, 8 + ldrb r0, [r0] + orrs r0, r1 + bx lr + thumb_func_end sub_8015658 + + thumb_func_start sub_8015664 +sub_8015664: @ 8015664 + push {lr} + adds r3, r1, 0 + ldr r1, =gUnknown_02022C30 + ldr r2, [r1] + movs r1, 0x8 + strb r1, [r2, 0x14] + strb r0, [r2, 0x15] + ldr r0, =gStringVar4 + cmp r3, r0 + beq _0801567E + adds r1, r3, 0 + bl StringExpandPlaceholders +_0801567E: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8015664 + + thumb_func_start sub_801568C +sub_801568C: @ 801568C + push {lr} + adds r2, r0, 0 + ldr r0, =gUnknown_02022C30 + ldr r1, [r0] + movs r0, 0x1A + strb r0, [r1, 0x14] + ldr r0, =gStringVar4 + cmp r2, r0 + beq _080156A4 + adds r1, r2, 0 + bl StringExpandPlaceholders +_080156A4: + pop {r0} + bx r0 + .pool + thumb_func_end sub_801568C + + thumb_func_start sub_80156B0 +sub_80156B0: @ 80156B0 + push {lr} + ldr r3, =0x0201ff00 + ldr r1, [r0] + movs r2, 0x80 + lsls r2, 1 + adds r0, r3, 0 + bl memcpy + pop {r0} + bx r0 + .pool + thumb_func_end sub_80156B0 + + thumb_func_start sub_80156C8 +sub_80156C8: @ 80156C8 + push {lr} + ldr r0, [r0] + ldr r1, =0x0201ff00 + movs r2, 0x80 + lsls r2, 1 + bl memcpy + pop {r0} + bx r0 + .pool + thumb_func_end sub_80156C8 + + thumb_func_start sub_80156E0 +sub_80156E0: @ 80156E0 + push {r4-r7,lr} + sub sp, 0xC + lsls r0, 24 + lsrs r4, r0, 24 + movs r5, 0 + ldr r0, =gUnknown_02022C30 + ldr r6, [r0] + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r7, r0, r1 + ldrb r0, [r6, 0x14] + cmp r0, 0x38 + bls _08015702 + bl _08016878 +_08015702: + lsls r0, 2 + ldr r1, =_08015718 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08015718: + .4byte _080157FC + .4byte _08015854 + .4byte _08015878 + .4byte _080158C8 + .4byte _080159A6 + .4byte _08015E5C + .4byte _08015C54 + .4byte _08015E5C + .4byte _08016864 + .4byte _080161C8 + .4byte _080162D4 + .4byte _080160AC + .4byte _080160C6 + .4byte _08016324 + .4byte _08016348 + .4byte _08016350 + .4byte _08016360 + .4byte _0801638E + .4byte _080163A2 + .4byte _08015F32 + .4byte _08015FB8 + .4byte _08015FD6 + .4byte _0801604A + .4byte _08015ADA + .4byte _08015B00 + .4byte _08015B78 + .4byte _08016838 + .4byte _08015D4C + .4byte _08015D34 + .4byte _08015DD0 + .4byte _08015C2A + .4byte _08015DA6 + .4byte _08015D9C + .4byte _08016158 + .4byte _08016178 + .4byte _080161B8 + .4byte _080162DC + .4byte _08016318 + .4byte _08015BF4 + .4byte _08016104 + .4byte _08015E94 + .4byte _08015EC4 + .4byte _080163CC + .4byte _0801645C + .4byte _080165A8 + .4byte _08016610 + .4byte _0801662C + .4byte _08016478 + .4byte _08016634 + .4byte _08016738 + .4byte _0801676C + .4byte _080167F4 + .4byte _0801652C + .4byte _080164E0 + .4byte _080164F4 + .4byte _0801658C + .4byte _080165DC +_080157FC: + movs r0, 0x70 + bl AllocZeroed + str r0, [r6, 0x4] + movs r0, 0x70 + bl AllocZeroed + str r0, [r6, 0xC] + movs r0, 0x80 + lsls r0, 1 + bl AllocZeroed + str r0, [r6] + movs r0, 0x20 + bl AllocZeroed + str r0, [r6, 0x8] + ldr r0, [r6] + movs r1, 0x8 + bl sub_8017580 + ldr r1, =gUnknown_02022C2C + movs r0, 0x40 + strb r0, [r1] + ldr r0, [r6, 0xC] + ldr r1, [r6, 0x4] + movs r2, 0x9 + bl sub_8016DF0 + adds r1, r6, 0 + adds r1, 0x20 + strb r0, [r1] + adds r0, r6, 0 + adds r0, 0xA0 + bl sub_8019BA8 + bl sub_8019F2C + movs r0, 0x1 + bl _08016876 + .pool +_08015854: + adds r0, r6, 0 + adds r0, 0x21 + movs r2, 0 + ldrsh r1, [r7, r2] + bl sub_8019E70 + ldrh r0, [r7] + adds r0, 0x1 + strh r0, [r7] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x8 + beq _08015872 + bl _08016878 +_08015872: + movs r0, 0x2 + bl _08016876 +_08015878: + movs r0, 0x40 + movs r1, 0 + movs r2, 0 + bl sub_8010F84 + ldr r2, =gUnknown_02022C40 + ldrh r0, [r2, 0x2] + ldrh r1, [r2, 0xA] + ldrh r2, [r2, 0xC] + bl sub_8010FCC + bl sub_800B488 + bl sub_8009734 + bl sub_8011C84 + ldr r0, [r6, 0x8] + movs r1, 0x1 + bl sub_8017580 + ldr r0, [r6, 0x4] + movs r1, 0x4 + bl sub_80175EC + ldr r0, [r6, 0xC] + movs r1, 0x4 + bl sub_80175EC + ldr r1, =gScriptResult + movs r0, 0 + strh r0, [r1] + movs r0, 0x3 + bl _08016876 + .pool +_080158C8: + bl sub_81B1360 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x8 + beq _080158E0 + bl sub_81B1360 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x9 + bne _080159A0 +_080158E0: + ldr r4, =gUnknown_02022C40 + ldrh r0, [r4] + cmp r0, 0 + beq _080159A0 + bl brm_get_pokemon_selection + lsls r0, 24 + lsrs r5, r0, 24 + ldrh r0, [r4] + cmp r0, 0x1 + beq _08015900 + cmp r0, 0x2 + beq _08015950 + b _0801598E + .pool +_08015900: + movs r0, 0x54 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + cmp r5, 0x5 + bls _0801592C + adds r0, r4, 0 + bl sub_801807C + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl sub_8010FCC + ldr r0, =gUnknown_082EF4FC + bl sub_801568C + b _0801598E + .pool +_0801592C: + bl brm_get_pokemon_selection + lsls r0, 24 + lsrs r0, 24 + adds r1, r4, 0 + bl sub_80180A0 + cmp r0, 0 + bne _0801594C + ldr r1, =gUnknown_082EF47C + movs r0, 0x34 + bl sub_8015664 + b _0801598E + .pool +_0801594C: + movs r0, 0x37 + b _0801598C +_08015950: + adds r0, r6, 0 + bl sub_80156C8 + ldrb r0, [r4, 0x8] + strh r0, [r7, 0x2] + cmp r5, 0x5 + bls _0801596C + ldr r0, =gUnknown_082EF544 + bl sub_801568C + b _0801598E + .pool +_0801596C: + movs r0, 0x54 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + ldr r1, =gUnknown_02022C2C + movs r0, 0x44 + strb r0, [r1] + bl brm_get_pokemon_selection + lsls r0, 24 + lsrs r0, 24 + adds r1, r4, 0 + bl sub_80180E8 + movs r0, 0x33 +_0801598C: + strb r0, [r6, 0x14] +_0801598E: + ldr r1, =gUnknown_02022C40 + movs r0, 0 + strh r0, [r1] + bl _08016878 + .pool +_080159A0: + movs r0, 0x4 + bl _08016876 +_080159A6: + ldr r4, =gScriptResult + ldrh r0, [r4] + cmp r0, 0 + beq _08015A0A + cmp r0, 0x9 + bne _080159E0 + movs r0, 0x54 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + movs r0, 0x2 + bl PlaySE + ldr r0, =gStringVar1 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + bl StringCopy + movs r1, 0 + movs r0, 0x2A + b _08015A02 + .pool +_080159E0: + cmp r0, 0xB + bne _080159F4 + movs r0, 0x54 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + movs r1, 0 + movs r0, 0x17 + b _08015A02 +_080159F4: + movs r0, 0 + strh r0, [r7] + ldrh r0, [r4] + subs r0, 0x1 + strh r0, [r7, 0x2] + movs r1, 0 + movs r0, 0x18 +_08015A02: + strb r0, [r6, 0x14] + strh r1, [r4] + bl _08016878 +_08015A0A: + bl ScriptContext2_IsEnabled + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08015A1A + bl _08016878 +_08015A1A: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08015A80 + ldr r0, [r6] + adds r2, r7, 0x2 + adds r3, r6, 0 + adds r3, 0x21 + adds r1, r7, 0 + bl sub_801A2A8 + cmp r0, 0 + beq _08015A4C + movs r0, 0x5 + bl PlaySE + bl sub_80181CC + movs r0, 0x18 + bl _08016876 + .pool +_08015A4C: + bl sub_8017940 + cmp r0, 0 + beq _08015A80 + movs r0, 0x54 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + movs r0, 0x2 + bl PlaySE + bl sub_80181CC + ldr r0, =gStringVar1 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + bl StringCopy + movs r0, 0x2D + bl _08016876 + .pool +_08015A80: + bl sub_8016B00 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + beq _08015AA2 + cmp r0, 0x2 + bgt _08015A96 + cmp r0, 0x1 + beq _08015A9C + b _08015AD0 +_08015A96: + cmp r0, 0x4 + beq _08015AAA + b _08015AD0 +_08015A9C: + movs r0, 0x2 + bl PlaySE +_08015AA2: + adds r0, r6, 0 + bl sub_801A274 + b _08015AD0 +_08015AAA: + movs r0, 0xB + strb r0, [r6, 0x14] + bl sub_80181CC + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl sub_8010FCC + adds r0, r6, 0 + bl sub_80181DC + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + movs r0, 0x53 + movs r2, 0 + bl sub_8011090 +_08015AD0: + adds r0, r6, 0 + bl sub_801A284 + bl _08016878 +_08015ADA: + ldr r0, =sub_809FA34 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + beq _08015AEA + bl _08016878 +_08015AEA: + movs r0, 0x40 + movs r1, 0 + movs r2, 0 + bl sub_8011090 + movs r0, 0x4 + bl _08016876 + .pool +_08015B00: + bl sub_801704C + movs r3, 0x2 + ldrsh r0, [r7, r3] + ldr r1, [r6] + bl sub_8017CF8 + adds r4, r0, 0 + movs r0, 0x54 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + ldr r0, [r6] + ldrb r1, [r7] + ldrb r2, [r7, 0x2] + adds r3, r4, 0 + bl sub_80179D4 + cmp r0, 0x1 + beq _08015B44 + cmp r0, 0x1 + bgt _08015B36 + cmp r0, 0 + beq _08015B3E + bl _08016878 +_08015B36: + cmp r0, 0x2 + beq _08015B68 + bl _08016878 +_08015B3E: + movs r0, 0x1A + bl _08016876 +_08015B44: + movs r1, 0x2 + ldrsh r0, [r7, r1] + lsls r0, 5 + ldr r1, [r6] + adds r1, r0 + adds r0, r1, 0 + adds r0, 0x10 + ldr r2, =gUnknown_02022C2C + ldrb r2, [r2] + bl sub_8012188 + strh r5, [r6, 0x12] + movs r0, 0x19 + bl _08016876 + .pool +_08015B68: + ldr r1, =gStringVar4 + movs r0, 0x13 + bl sub_8015664 + bl _08016878 + .pool +_08015B78: + bl sub_801704C + bl sub_8011A74 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x1 + blt _08015BBE + cmp r4, 0x2 + ble _08015B9A + cmp r4, 0x4 + bne _08015BBE + movs r0, 0x1 + bl sub_801818C + strb r4, [r6, 0x14] + b _08015BBE +_08015B9A: + bl sub_8011B90 + cmp r0, 0x1 + bne _08015BB0 + ldr r0, =gUnknown_082EE6C8 + bl sub_801568C + b _08015BB8 + .pool +_08015BB0: + ldr r1, =gUnknown_082EE6C8 + movs r0, 0x1E + bl sub_8015664 +_08015BB8: + ldr r1, =gUnknown_02022C2C + movs r0, 0x40 + strb r0, [r1] +_08015BBE: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _08015BCA + bl _08016878 +_08015BCA: + ldr r0, =gUnknown_020228C4 + movs r1, 0x1 + bl sub_80143E4 + ldr r0, =sub_80140E0 + movs r1, 0x5 + bl CreateTask + movs r0, 0x26 + bl _08016876 + .pool +_08015BF4: + ldr r0, =sub_80140E0 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + beq _08015C04 + bl _08016878 +_08015C04: + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + cmp r0, 0x44 + bne _08015C24 + ldr r1, =gUnknown_082EE004 + movs r0, 0x1F + bl sub_8015664 + bl _08016878 + .pool +_08015C24: + movs r0, 0x5 + bl _08016876 +_08015C2A: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _08015C36 + bl _08016878 +_08015C36: + movs r0, 0 + bl sub_801818C + movs r2, 0 + ldrsh r0, [r7, r2] + movs r3, 0x2 + ldrsh r1, [r7, r3] + ldr r2, [r6] + bl sub_801A3D0 + movs r0, 0x2 + bl _08016876 + .pool +_08015C54: + adds r0, r6, 0 + adds r0, 0x16 + adds r1, r6, 0 + adds r1, 0x1B + adds r2, r6, 0 + adds r2, 0x1C + ldr r3, =gUnknown_082F021C + ldr r4, =gUnknown_082F0244 + str r4, [sp] + bl sub_8017178 + adds r5, r0, 0 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + bne _08015C78 + bl _08016878 +_08015C78: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _08015C94 + movs r0, 0x1C + bl _08016876 + .pool +_08015C94: + adds r1, r6, 0 + adds r1, 0x98 + movs r0, 0 + strh r0, [r1] + movs r2, 0x2 + ldrsh r0, [r7, r2] + ldr r1, [r6] + bl sub_8017CF8 + movs r0, 0x2 + negs r0, r0 + cmp r5, r0 + beq _08015CB2 + cmp r5, 0x40 + bne _08015CE4 +_08015CB2: + adds r0, r6, 0 + adds r0, 0x4C + movs r1, 0x40 + strh r1, [r0] + bl sub_800FE50 + ldr r0, =gStringVar4 + ldr r2, =gUnknown_082EEB80 + ldr r1, =gLinkPlayers + ldrb r1, [r1, 0x13] + lsls r1, 2 + adds r1, r2 + ldr r1, [r1] + bl StringCopy + movs r0, 0x20 + bl _08016876 + .pool +_08015CE4: + ldr r0, =gUnknown_02022C2C + strb r5, [r0] + ldr r1, =gUnknown_02022C2D + lsrs r0, r5, 8 + strb r0, [r1] + lsls r0, r5, 24 + lsrs r0, 24 + cmp r0, 0x41 + bne _08015D18 + bl sub_8018024 + cmp r0, 0 + bne _08015D18 + ldr r1, =gUnknown_082EEBD0 + movs r0, 0x5 + bl sub_8015664 + bl _08016878 + .pool +_08015D18: + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + movs r1, 0x40 + orrs r1, r0 + adds r0, r6, 0 + adds r0, 0x4C + strh r1, [r0] + bl sub_800FE50 + movs r0, 0x1B + bl _08016876 + .pool +_08015D34: + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EEB88 + bl StringCopy + movs r0, 0x24 + bl _08016876 + .pool +_08015D4C: + adds r0, r6, 0 + bl sub_8017FD8 + movs r3, 0x2 + ldrsh r0, [r7, r3] + ldr r1, [r6] + bl sub_8017CF8 + adds r4, r0, 0 + adds r0, r6, 0 + adds r0, 0x4C + ldrh r1, [r0] + movs r0, 0x3F + ands r0, r1 + bl sub_8017984 + adds r5, r0, 0 + adds r0, r6, 0 + adds r0, 0x16 + ldr r3, =gUnknown_082EE82C + lsls r1, r5, 2 + lsls r2, r4, 4 + adds r1, r2 + adds r1, r3 + ldr r1, [r1] + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08015D8C + bl _08016878 +_08015D8C: + movs r0, 0 + strh r0, [r7, 0x6] + movs r0, 0x1D + bl _08016876 + .pool +_08015D9C: + bl sub_800AC34 + movs r0, 0x24 + bl _08016876 +_08015DA6: + adds r0, r6, 0 + adds r0, 0x4C + movs r1, 0x44 + strh r1, [r0] + ldr r2, =gUnknown_02022C40 + ldrh r1, [r2, 0xE] + adds r3, r6, 0 + adds r3, 0x4E + strh r1, [r3] + ldrh r2, [r2, 0x10] + adds r1, r6, 0 + adds r1, 0x50 + strh r2, [r1] + bl sub_800FE50 + movs r0, 0x1D + bl _08016876 + .pool +_08015DD0: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _08015DF4 + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EEB88 + bl StringCopy + movs r0, 0x1C + bl _08016876 + .pool +_08015DF4: + adds r0, r6, 0 + bl sub_8017FD8 + adds r0, r6, 0 + adds r0, 0x98 + ldrh r0, [r0] + cmp r0, 0x51 + bne _08015E2A + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + cmp r0, 0x8 + bne _08015E24 + ldr r0, =gStringVar4 + adds r1, r6, 0 + movs r2, 0 + bl sub_8018220 + movs r0, 0x28 + bl _08016876 + .pool +_08015E24: + movs r0, 0xD + bl _08016876 +_08015E2A: + cmp r0, 0x52 + beq _08015E32 + bl _08016878 +_08015E32: + movs r5, 0 + movs r0, 0x20 + strb r0, [r6, 0x14] + ldr r0, =gStringVar4 + ldr r4, =gUnknown_02022C2C + ldrb r2, [r4] + movs r1, 0x40 + orrs r1, r2 + ldr r2, =gLinkPlayers + ldrb r2, [r2, 0x13] + bl sub_8017D9C + strb r5, [r4] + bl _08016878 + .pool +_08015E5C: + movs r0, 0x2 + ldrsh r1, [r7, r0] + lsls r1, 5 + ldr r0, [r6] + adds r0, r1 + bl sub_80179AC + adds r5, r0, 0 + movs r1, 0x2 + ldrsh r0, [r7, r1] + ldr r1, [r6] + bl sub_8017CF8 + adds r4, r0, 0 + ldr r2, =gUnknown_082EE24C + lsls r0, r4, 2 + lsls r1, r5, 3 + adds r0, r1 + adds r0, r2 + ldr r1, [r0] + movs r0, 0x6 + bl sub_8015664 + bl _08016878 + .pool +_08015E94: + adds r0, r6, 0 + adds r0, 0x16 + ldr r1, =gStringVar4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08015EA8 + bl _08016878 +_08015EA8: + movs r4, 0 + movs r0, 0x29 + strb r0, [r6, 0x14] + bl sub_800ADF8 + adds r0, r6, 0 + adds r0, 0x98 + strh r4, [r0] + adds r0, 0x2 + strh r4, [r0] + bl _08016878 + .pool +_08015EC4: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + bne _08015ED2 + bl _08016878 +_08015ED2: + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + bne _08015F2C + ldr r5, =gStringVar1 + bl GetMultiplayerId + movs r1, 0x1 + eors r0, r1 + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 3 + subs r1, r0 + lsls r1, 2 + ldr r4, =gLinkPlayers + 8 + adds r1, r4 + adds r0, r5, 0 + bl StringCopy + ldrh r0, [r4, 0x18] + adds r4, 0x1C + adds r1, r4, 0 + bl sub_800E540 + adds r5, r0, 0 + ldr r0, =gStringVar4 + ldr r2, =gUnknown_082EE378 + lsls r1, r5, 2 + adds r1, r2 + ldr r1, [r1] + bl StringExpandPlaceholders + movs r0, 0x21 + bl _08016876 + .pool +_08015F2C: + movs r0, 0x7 + bl _08016876 +_08015F32: + adds r0, r6, 0 + adds r0, 0x16 + movs r1, 0 + bl sub_80170B8 + lsls r0, 24 + asrs r5, r0, 24 + cmp r5, 0 + beq _08015F5C + cmp r5, 0 + bgt _08015F54 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + beq _08015F98 + bl _08016878 +_08015F54: + cmp r5, 0x1 + beq _08015F98 + bl _08016878 +_08015F5C: + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r4, =gUnknown_02022C2C + movs r0, 0x45 + strb r0, [r4] + movs r0, 0x45 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + movs r2, 0x2 + ldrsh r0, [r7, r2] + lsls r0, 5 + ldr r1, [r6] + adds r1, r0 + adds r0, r1, 0 + adds r0, 0x10 + ldrb r2, [r4] + bl sub_8012188 + ldrh r0, [r7, 0x2] + strh r0, [r6, 0x12] + movs r0, 0x14 + strb r0, [r6, 0x14] + strh r5, [r7, 0x6] + bl _08016878 + .pool +_08015F98: + movs r3, 0x2 + ldrsh r0, [r7, r3] + ldr r1, [r6] + bl sub_8017CF8 + adds r4, r0, 0 + ldr r1, =gUnknown_082EEC9C + lsls r0, r4, 2 + adds r0, r1 + ldr r0, [r0] + bl sub_801568C + bl _08016878 + .pool +_08015FB8: + ldrh r0, [r7, 0x4] + adds r0, 0x1 + strh r0, [r7, 0x4] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x3C + bgt _08015FCA + bl _08016878 +_08015FCA: + movs r1, 0 + movs r0, 0x15 + strb r0, [r6, 0x14] + strh r1, [r7, 0x4] + bl _08016878 +_08015FD6: + bl sub_8011A74 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + beq _0801603C + cmp r4, 0x3 + ble _08015FF4 + cmp r4, 0x4 + bne _08016040 + movs r0, 0x1 + bl sub_801818C + strb r4, [r6, 0x14] + b _08016040 +_08015FF4: + cmp r4, 0x1 + blt _08016040 + movs r1, 0x2 + ldrsh r0, [r7, r1] + ldr r1, [r6] + bl sub_8017CF8 + adds r4, r0, 0 + movs r0, 0x54 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + bl sub_8011B90 + cmp r0, 0x1 + bne _08016028 + ldr r0, =gUnknown_082EED3C + lsls r1, r4, 2 + adds r1, r0 + ldr r0, [r1] + bl sub_801568C + b _08016040 + .pool +_08016028: + ldr r0, =gUnknown_082EED3C + lsls r1, r4, 2 + adds r1, r0 + ldr r1, [r1] + movs r0, 0x1E + bl sub_8015664 + b _08016040 + .pool +_0801603C: + movs r0, 0x16 + strb r0, [r6, 0x14] +_08016040: + ldrh r0, [r7, 0x6] + adds r0, 0x1 + strh r0, [r7, 0x6] + bl _08016878 +_0801604A: + bl sub_8011A80 + cmp r0, 0 + beq _08016092 + movs r2, 0x2 + ldrsh r0, [r7, r2] + ldr r1, [r6] + bl sub_8017CF8 + adds r4, r0, 0 + movs r0, 0x54 + movs r1, 0 + movs r2, 0x1 + bl sub_8011090 + bl sub_8011B90 + cmp r0, 0x1 + bne _08016084 + ldr r0, =gUnknown_082EED3C + lsls r1, r4, 2 + adds r1, r0 + ldr r0, [r1] + bl sub_801568C + b _08016092 + .pool +_08016084: + ldr r0, =gUnknown_082EED3C + lsls r1, r4, 2 + adds r1, r0 + ldr r1, [r1] + movs r0, 0x1E + bl sub_8015664 +_08016092: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801609E + bl _08016878 +_0801609E: + movs r0, 0x10 + bl _08016876 + .pool +_080160AC: + movs r0, 0x49 + bl PlaySE + bl sub_800EF7C + movs r0, 0 + movs r1, 0xC + strb r1, [r6, 0x14] + adds r1, r6, 0 + adds r1, 0x9A + strh r0, [r1] + bl _08016878 +_080160C6: + bl sub_8011A80 + cmp r0, 0 + beq _080160DA + movs r0, 0 + bl sub_801818C + movs r0, 0x2 + bl _08016876 +_080160DA: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _080160E4 + b _08016878 +_080160E4: + ldr r0, =gUnknown_020228C4 + movs r1, 0x1 + bl sub_80143E4 + ldr r0, =sub_80140E0 + movs r1, 0x5 + bl CreateTask + movs r0, 0x27 + b _08016876 + .pool +_08016104: + adds r0, r6, 0 + bl sub_801689C + ldr r0, =sub_80140E0 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + beq _08016118 + b _08016878 +_08016118: + movs r0, 0x21 + strb r0, [r6, 0x14] + ldr r0, =gStringVar1 + ldr r4, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name + adds r1, r4, 0 + bl StringCopy + adds r0, r4, 0 + subs r0, 0x24 + ldrh r0, [r0, 0x20] + adds r1, r4, 0 + bl sub_800E540 + adds r5, r0, 0 + ldr r0, =gStringVar4 + ldr r2, =gUnknown_082EE324 + lsls r1, r5, 2 + adds r1, r2 + ldr r1, [r1] + bl StringExpandPlaceholders + b _08016878 + .pool +_08016158: + adds r0, r6, 0 + bl sub_801689C + adds r0, r6, 0 + adds r0, 0x16 + ldr r1, =gStringVar4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08016170 + b _08016878 +_08016170: + movs r0, 0x22 + b _08016876 + .pool +_08016178: + adds r0, r6, 0 + bl sub_801689C + adds r0, r6, 0 + bl sub_80168DC + cmp r0, 0 + bne _0801618A + b _08016878 +_0801618A: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + bne _08016198 + b _08016878 +_08016198: + movs r0, 0x1 + bl sub_8011DE0 + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EE598 + bl StringCopy + movs r0, 0x24 + b _08016876 + .pool +_080161B8: + ldr r1, =gStringVar4 + movs r0, 0x9 + bl sub_8015664 + b _08016878 + .pool +_080161C8: + adds r0, r6, 0 + adds r0, 0x16 + movs r1, 0 + bl sub_80170B8 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _080161EE + cmp r1, 0 + bgt _080161E8 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _080162AE + b _08016878 +_080161E8: + cmp r1, 0x1 + beq _080162AE + b _08016878 +_080161EE: + adds r0, r6, 0 + adds r0, 0x4C + movs r1, 0x51 + strh r1, [r0] + ldr r1, =gUnknown_02022C2C + ldrb r1, [r1] + adds r5, r0, 0 + cmp r1, 0x45 + bne _08016220 + movs r4, 0x40 + orrs r4, r1 + movs r0, 0x1 + bl sub_801100C + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + movs r2, 0 + bl sub_8011090 + b _0801623E + .pool +_08016220: + movs r0, 0x40 + adds r4, r1, 0 + orrs r4, r0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + bl sub_801100C + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + movs r2, 0x1 + bl sub_8011090 +_0801623E: + ldr r1, [r6, 0x8] + movs r0, 0 + strb r0, [r1, 0x1B] + strh r0, [r7, 0x6] + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + cmp r0, 0x41 + bne _08016286 + bl sub_8018024 + cmp r0, 0 + bne _0801627C + movs r0, 0x52 + strh r0, [r5] + adds r0, r5, 0 + bl sub_800FE50 + movs r0, 0xA + strb r0, [r6, 0x14] + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EEC14 + bl StringCopy + b _08016878 + .pool +_0801627C: + adds r0, r5, 0 + bl sub_800FE50 + movs r0, 0xD + b _08016876 +_08016286: + cmp r0, 0x48 + bne _080162A4 + adds r0, r5, 0 + bl sub_800FE50 + ldr r0, =gStringVar4 + adds r1, r6, 0 + movs r2, 0x1 + bl sub_8018220 + movs r0, 0x28 + b _08016876 + .pool +_080162A4: + adds r0, r5, 0 + bl sub_800FE50 + movs r0, 0xD + b _08016876 +_080162AE: + adds r0, r6, 0 + adds r0, 0x4C + movs r1, 0x52 + strh r1, [r0] + bl sub_800FE50 + movs r0, 0xA + strb r0, [r6, 0x14] + ldr r0, =gStringVar4 + ldr r1, =gUnknown_02022C2C + ldrb r1, [r1] + bl sub_8013078 + b _08016878 + .pool +_080162D4: + bl sub_800AC34 + movs r0, 0x24 + b _08016876 +_080162DC: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r4, [r0] + cmp r4, 0 + beq _080162E6 + b _08016878 +_080162E6: + ldr r1, =gUnknown_02022C2C + movs r0, 0x40 + strb r0, [r1] + ldr r1, =gStringVar4 + movs r0, 0x25 + bl sub_8015664 + adds r0, r6, 0 + adds r0, 0x4C + movs r1, 0 + movs r2, 0xC + bl memset + adds r0, r6, 0 + adds r0, 0x9A + strh r4, [r0] + subs r0, 0x2 + strh r4, [r0] + b _08016878 + .pool +_08016318: + movs r0, 0x2 + strb r0, [r6, 0x14] + movs r0, 0 + bl sub_801818C + b _08016878 +_08016324: + ldr r4, =gStringVar4 + ldr r0, =gUnknown_02022C2C + ldrb r0, [r0] + movs r1, 0x40 + orrs r1, r0 + adds r0, r4, 0 + bl sub_8017E00 + movs r0, 0xE + adds r1, r4, 0 + bl sub_8015664 + b _08016878 + .pool +_08016348: + bl sub_800ADF8 + movs r0, 0xF + b _08016876 +_08016350: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + bne _0801635C + b _08016878 +_0801635C: + movs r0, 0x10 + b _08016876 +_08016360: + ldr r0, [r6, 0x8] + bl Free + ldr r0, [r6] + bl Free + ldr r0, [r6, 0xC] + bl Free + ldr r0, [r6, 0x4] + bl Free + adds r0, r6, 0 + adds r0, 0x20 + ldrb r0, [r0] + bl DestroyTask + adds r0, r6, 0 + adds r0, 0x21 + bl sub_8019F04 + movs r0, 0x11 + b _08016876 +_0801638E: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + movs r0, 0x12 + b _08016876 +_080163A2: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + beq _080163AE + b _08016878 +_080163AE: + bl sub_8019E3C + adds r0, r4, 0 + bl DestroyTask + ldr r0, =gUnknown_02022C30 + ldr r0, [r0] + bl Free + bl sub_80149D8 + b _08016878 + .pool +_080163CC: + bl sub_800F7DC + ldrh r1, [r0, 0x8] + ldr r4, =0x000003ff + adds r0, r4, 0 + ands r0, r1 + cmp r0, 0 + bne _080163E4 + movs r0, 0x2B + b _08016876 + .pool +_080163E4: + bl sub_800F7DC + ldrh r1, [r0, 0x8] + adds r0, r4, 0 + ands r0, r1 + movs r1, 0xCE + lsls r1, 1 + cmp r0, r1 + bne _08016408 + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EF590 + bl StringCopy + b _0801643E + .pool +_08016408: + ldr r4, =gStringVar1 + bl sub_800F7DC + ldrh r0, [r0, 0x8] + lsls r0, 22 + lsrs r0, 22 + movs r1, 0xB + muls r1, r0 + ldr r0, =gSpeciesNames + adds r1, r0 + adds r0, r4, 0 + bl StringCopy + ldr r4, =gStringVar2 + bl sub_800F7DC + ldrb r1, [r0, 0xB] + lsrs r1, 1 + adds r0, r4, 0 + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EF564 + bl StringExpandPlaceholders +_0801643E: + ldr r1, =gStringVar4 + movs r0, 0x2C + bl sub_8015664 + b _08016878 + .pool +_0801645C: + adds r0, r6, 0 + adds r0, 0x16 + ldr r1, =gUnknown_082EF20C + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _0801646E + b _08016878 +_0801646E: + movs r0, 0x2F + b _08016876 + .pool +_08016478: + adds r0, r6, 0 + adds r0, 0x16 + adds r1, r6, 0 + adds r1, 0x1D + adds r2, r6, 0 + adds r2, 0x1E + ldr r3, =gUnknown_082F025C + ldr r4, =gUnknown_082F027C + str r4, [sp] + bl sub_8017178 + adds r5, r0, 0 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + bne _0801649A + b _08016878 +_0801649A: + subs r0, 0x1 + cmp r5, r0 + beq _080164A4 + cmp r5, 0x3 + bne _080164B8 +_080164A4: + movs r0, 0x4 + strb r0, [r6, 0x14] + movs r0, 0x1 + bl sub_801818C + b _08016878 + .pool +_080164B8: + cmp r5, 0x1 + beq _080164C2 + cmp r5, 0x2 + beq _080164D0 + b _08016878 +_080164C2: + ldr r1, =gUnknown_082EF4C4 + movs r0, 0x35 + bl sub_8015664 + b _08016878 + .pool +_080164D0: + ldr r1, =gUnknown_082EF298 + movs r0, 0x2F + bl sub_8015664 + b _08016878 + .pool +_080164E0: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + movs r0, 0x36 + b _08016876 +_080164F4: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _08016502 + b _08016878 +_08016502: + ldr r1, =gUnknown_02022C40 + movs r0, 0x1 + strh r0, [r1] + ldr r1, =gFieldCallback + ldr r0, =sub_80AF128 + str r0, [r1] + ldr r1, =c2_exit_to_overworld_2_switch + movs r0, 0x8 + bl sub_81B8904 + b _08016878 + .pool +_0801652C: + adds r0, r6, 0 + adds r0, 0x16 + adds r1, r6, 0 + adds r1, 0x1D + adds r2, r6, 0 + adds r2, 0x1E + ldr r3, =gUnknown_082F0294 + ldr r4, =gUnknown_082F032C + str r4, [sp] + bl sub_8017178 + adds r5, r0, 0 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + bne _0801654E + b _08016878 +_0801654E: + subs r0, 0x1 + cmp r5, r0 + beq _08016558 + cmp r5, 0x12 + bne _08016580 +_08016558: + ldr r0, =gUnknown_02022C40 + bl sub_801807C + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl sub_8010FCC + ldr r0, =gUnknown_082EF4FC + bl sub_801568C + b _08016878 + .pool +_08016580: + ldr r0, =gUnknown_02022C40 + strh r5, [r0, 0x2] + movs r0, 0x37 + b _08016876 + .pool +_0801658C: + ldr r2, =gUnknown_02022C40 + ldrh r0, [r2, 0x2] + ldrh r1, [r2, 0xA] + ldrh r2, [r2, 0xC] + bl sub_8010FCC + ldr r0, =gUnknown_082EF520 + bl sub_801568C + b _08016878 + .pool +_080165A8: + adds r0, r6, 0 + adds r0, 0x16 + movs r1, 0 + bl sub_80170B8 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _080165CE + cmp r1, 0 + bgt _080165C8 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _080165D2 + b _08016878 +_080165C8: + cmp r1, 0x1 + beq _080165D2 + b _08016878 +_080165CE: + movs r0, 0x38 + b _08016876 +_080165D2: + movs r0, 0x1 + bl sub_801818C + movs r0, 0x4 + b _08016876 +_080165DC: + adds r0, r6, 0 + adds r0, 0x16 + ldr r1, =gUnknown_082EF5B8 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _080165EE + b _08016878 +_080165EE: + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl sub_8010FCC + ldr r0, =gUnknown_02022C40 + bl sub_801807C + movs r0, 0x1 + bl sub_801818C + movs r0, 0x4 + b _08016876 + .pool +_08016610: + adds r0, r6, 0 + adds r0, 0x16 + ldr r1, =gUnknown_082EF1EC + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _08016622 + b _08016878 +_08016622: + movs r0, 0x2E + b _08016876 + .pool +_0801662C: + bl sub_80173B0 + movs r0, 0x30 + b _08016876 +_08016634: + adds r0, r6, 0 + adds r0, 0x16 + adds r1, r6, 0 + adds r1, 0x1D + adds r2, r6, 0 + adds r2, 0x4A + adds r3, r6, 0 + adds r3, 0x1E + ldr r4, =gUnknown_082F034C + str r4, [sp] + ldr r4, =gUnknown_082F03A4 + str r4, [sp, 0x4] + ldr r4, [r6] + str r4, [sp, 0x8] + bl sub_80172A0 + adds r5, r0, 0 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + bne _08016660 + b _08016878 +_08016660: + subs r0, 0x1 + cmp r5, r0 + beq _0801666A + cmp r5, 0x8 + bne _0801667C +_0801666A: + movs r0, 0x1 + bl sub_801818C + movs r0, 0x4 + b _08016876 + .pool +_0801667C: + bl sub_80173B0 + ldr r1, [r6] + lsls r4, r5, 5 + adds r1, r4 + ldrb r0, [r1, 0x9] + lsrs r0, 2 + ldrh r1, [r1, 0x8] + lsls r1, 22 + lsrs r1, 22 + bl sub_8017D04 + cmp r0, 0x1 + beq _080166C8 + cmp r0, 0x1 + bgt _080166A2 + cmp r0, 0 + beq _080166A8 + b _08016878 +_080166A2: + cmp r0, 0x2 + beq _080166FC + b _08016878 +_080166A8: + ldr r0, =gStringVar1 + ldr r1, [r6] + adds r1, r4 + bl sub_8018404 + ldr r1, =gUnknown_082EF65C + movs r0, 0x31 + bl sub_8015664 + strh r5, [r7, 0x2] + b _08016878 + .pool +_080166C8: + ldr r0, =gStringVar1 + ldr r1, [r6] + adds r1, r4 + bl sub_8018404 + ldr r0, =gStringVar2 + ldr r1, [r6] + adds r1, r4 + ldrb r2, [r1, 0x9] + lsrs r2, 2 + lsls r1, r2, 3 + subs r1, r2 + ldr r2, =gTypeNames + adds r1, r2 + bl StringCopy + ldr r1, =gUnknown_082EF6E4 + b _0801671E + .pool +_080166FC: + ldr r0, =gStringVar1 + ldr r1, [r6] + adds r1, r4 + bl sub_8018404 + ldr r0, =gStringVar2 + ldr r1, [r6] + adds r1, r4 + ldrb r2, [r1, 0x9] + lsrs r2, 2 + lsls r1, r2, 3 + subs r1, r2 + ldr r2, =gTypeNames + adds r1, r2 + bl StringCopy + ldr r1, =gUnknown_082EF718 +_0801671E: + movs r0, 0x2E + bl sub_8015664 + b _08016878 + .pool +_08016738: + adds r0, r6, 0 + adds r0, 0x16 + movs r1, 0 + bl sub_80170B8 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _0801675E + cmp r1, 0 + bgt _08016758 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _08016762 + b _08016878 +_08016758: + cmp r1, 0x1 + beq _08016762 + b _08016878 +_0801675E: + movs r0, 0x32 + b _08016876 +_08016762: + movs r0, 0x1 + bl sub_801818C + movs r0, 0x4 + b _08016876 +_0801676C: + adds r0, r6, 0 + adds r0, 0x16 + ldr r1, =gUnknown_082EF4C4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + bne _0801677E + b _08016878 +_0801677E: + ldr r4, =gUnknown_02022C40 + movs r0, 0x2 + strh r0, [r4] + ldr r2, =gUnknown_02022C38 + movs r3, 0x2 + ldrsh r0, [r7, r3] + ldr r1, [r6] + lsls r0, 5 + adds r0, r1 + ldr r0, [r0] + str r0, [r2] + ldr r2, =gUnknown_02022C3E + ldr r1, [r6] + movs r3, 0x2 + ldrsh r0, [r7, r3] + lsls r0, 5 + adds r1, r0 + ldrb r0, [r1, 0x9] + lsrs r0, 2 + strb r0, [r2] + ldr r2, =gUnknown_02022C3C + ldr r1, [r6] + movs r3, 0x2 + ldrsh r0, [r7, r3] + lsls r0, 5 + adds r1, r0 + ldrh r0, [r1, 0x8] + lsls r0, 22 + lsrs r0, 22 + strh r0, [r2] + ldr r1, =gFieldCallback + ldr r0, =sub_80AF128 + str r0, [r1] + ldr r1, =c2_exit_to_overworld_2_switch + movs r0, 0x9 + bl sub_81B8904 + adds r0, r6, 0 + bl sub_80156B0 + ldrh r0, [r7, 0x2] + strb r0, [r4, 0x8] + b _08016878 + .pool +_080167F4: + ldr r1, =gUnknown_02022C2C + movs r0, 0x44 + strb r0, [r1] + movs r1, 0x2 + ldrsh r0, [r7, r1] + lsls r0, 5 + ldr r1, [r6] + adds r1, r0 + adds r0, r1, 0 + adds r0, 0x10 + movs r2, 0x44 + bl sub_8012188 + ldr r0, =gStringVar1 + movs r3, 0x2 + ldrsh r2, [r7, r3] + lsls r2, 5 + ldr r1, [r6] + adds r1, r2 + bl sub_8018404 + ldr r0, =gUnknown_082EE17C + ldr r0, [r0, 0x8] + bl sub_8017020 + movs r0, 0x19 + b _08016876 + .pool +_08016838: + adds r0, r6, 0 + adds r0, 0x16 + ldr r1, =gStringVar4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + beq _08016878 + movs r0, 0x1 + bl sub_801818C + movs r1, 0 + ldrsh r0, [r7, r1] + movs r2, 0x2 + ldrsh r1, [r7, r2] + ldr r2, [r6] + bl sub_801A3D0 + movs r0, 0x4 + b _08016876 + .pool +_08016864: + adds r0, r6, 0 + adds r0, 0x16 + ldr r1, =gStringVar4 + bl sub_8017064 + lsls r0, 24 + cmp r0, 0 + beq _08016878 + ldrb r0, [r6, 0x15] +_08016876: + strb r0, [r6, 0x14] +_08016878: + add sp, 0xC + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80156E0 + + thumb_func_start var_800D_set_xB +var_800D_set_xB: @ 8016884 + push {lr} + bl InUnionRoom + cmp r0, 0x1 + bne _08016894 + ldr r1, =gScriptResult + movs r0, 0xB + strh r0, [r1] +_08016894: + pop {r0} + bx r0 + .pool + thumb_func_end var_800D_set_xB + + thumb_func_start sub_801689C +sub_801689C: @ 801689C + push {r4,r5,lr} + adds r2, r0, 0 + ldr r3, =gUnknown_03003090 + ldrh r5, [r3, 0x12] + adds r4, r5, 0 + cmp r4, 0 + beq _080168D0 + ldrh r0, [r3, 0x10] + movs r1, 0xFF + lsls r1, 8 + ands r1, r0 + movs r0, 0xBC + lsls r0, 6 + cmp r1, r0 + bne _080168D0 + adds r0, r2, 0 + adds r0, 0x9A + strh r5, [r0] + cmp r4, 0x44 + bne _080168D0 + ldrh r1, [r3, 0x14] + adds r0, 0x2 + strh r1, [r0] + ldrh r1, [r3, 0x16] + adds r0, 0x2 + strh r1, [r0] +_080168D0: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801689C + + thumb_func_start sub_80168DC +sub_80168DC: @ 80168DC + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r4, 0 + adds r5, 0x9A + ldrh r0, [r5] + cmp r0, 0 + beq _0801692C + ldr r0, =gStringVar4 + ldr r1, =gLinkPlayers + adds r1, 0x2F + ldrb r1, [r1] + adds r2, r5, 0 + adds r3, r4, 0 + bl sub_8017EA0 + cmp r0, 0 + beq _0801692C + cmp r0, 0x1 + bne _0801691C + movs r0, 0x23 + strb r0, [r4, 0x14] + ldr r1, =gUnknown_02022C2C + ldrh r0, [r5] + strb r0, [r1] + movs r0, 0 + b _0801692E + .pool +_0801691C: + cmp r0, 0x2 + bne _0801692C + movs r0, 0x24 + strb r0, [r4, 0x14] + bl sub_800AC34 + movs r0, 0 + b _0801692E +_0801692C: + movs r0, 0x1 +_0801692E: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_80168DC + + thumb_func_start sub_8016934 +sub_8016934: @ 8016934 + push {r4,r5,lr} + ldr r5, =gUnknown_02022C20 + movs r0, 0xFF + strb r0, [r5] + ldr r0, =task00_081199FC + movs r1, 0 + bl CreateTask + ldr r4, =gUnknown_02022C30 + movs r0, 0x9B + lsls r0, 2 + bl AllocZeroed + str r0, [r4] + ldr r1, =gUnknown_03000DA8 + str r0, [r1] + movs r1, 0 + strb r1, [r0, 0x14] + strb r1, [r0, 0x16] + strh r1, [r0, 0x10] + strh r1, [r0, 0x12] + movs r0, 0x1 + negs r0, r0 + strb r0, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8016934 + + thumb_func_start task00_081199FC +task00_081199FC: @ 801697C + push {r4-r6,lr} + sub sp, 0x20 + lsls r0, 24 + lsrs r4, r0, 24 + ldr r0, =gUnknown_02022C30 + ldr r5, [r0] + ldrb r0, [r5, 0x14] + cmp r0, 0x4 + bls _08016990 + b _08016AC8 +_08016990: + lsls r0, 2 + ldr r1, =_080169A4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080169A4: + .4byte _080169B8 + .4byte _080169BE + .4byte _080169E0 + .4byte _08016A30 + .4byte _08016A94 +_080169B8: + movs r0, 0x1 + strb r0, [r5, 0x14] + b _08016AC8 +_080169BE: + movs r0, 0xC + movs r1, 0 + movs r2, 0 + bl sub_8010F84 + bl sub_800B488 + bl sub_8009734 + bl sub_8011C84 + movs r0, 0x1 + bl sub_80111B0 + movs r0, 0x2 + strb r0, [r5, 0x14] + b _08016AC8 +_080169E0: + movs r0, 0x70 + bl AllocZeroed + str r0, [r5, 0x4] + movs r1, 0x4 + bl sub_80175EC + movs r0, 0x70 + bl AllocZeroed + str r0, [r5, 0xC] + movs r1, 0x4 + bl sub_80175EC + movs r0, 0x80 + lsls r0, 1 + bl AllocZeroed + str r0, [r5] + movs r1, 0x8 + bl sub_8017580 + movs r0, 0x20 + bl AllocZeroed + str r0, [r5, 0x8] + movs r1, 0x1 + bl sub_8017580 + ldr r0, [r5, 0xC] + ldr r1, [r5, 0x4] + movs r2, 0xA + bl sub_8016DF0 + adds r1, r5, 0 + adds r1, 0x20 + strb r0, [r1] + movs r0, 0x3 + strb r0, [r5, 0x14] + b _08016AC8 +_08016A30: + bl sub_8016B00 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + blt _08016AC8 + cmp r0, 0x2 + bgt _08016AC8 + ldr r0, =gUnknown_02022C20 + ldrb r0, [r0] + cmp r0, 0xFF + bne _08016AC8 + movs r6, 0 +_08016A4A: + ldr r0, [r5] + lsls r4, r6, 5 + adds r1, r0, r4 + ldrb r0, [r1, 0x1A] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _08016A78 + mov r0, sp + bl sub_8018404 + ldr r0, [r5] + adds r0, r4 + adds r0, 0x2 + bl sub_8015658 + lsls r0, 16 + lsrs r0, 16 + mov r1, sp + bl sub_800E540 + cmp r0, 0 + bne _08016A84 +_08016A78: + adds r6, 0x1 + cmp r6, 0x7 + ble _08016A4A + b _08016AC8 + .pool +_08016A84: + ldr r0, =gUnknown_02022C20 + mov r1, sp + bl StringCopy + b _08016AC8 + .pool +_08016A94: + ldr r0, [r5, 0x8] + bl Free + ldr r0, [r5] + bl Free + ldr r0, [r5, 0xC] + bl Free + ldr r0, [r5, 0x4] + bl Free + adds r0, r5, 0 + adds r0, 0x20 + ldrb r0, [r0] + bl DestroyTask + ldr r0, =gUnknown_02022C30 + ldr r0, [r0] + bl Free + bl sub_800EDD4 + adds r0, r4, 0 + bl DestroyTask +_08016AC8: + add sp, 0x20 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end task00_081199FC + + thumb_func_start sp182_move_string +sp182_move_string: @ 8016AD4 + push {r4,lr} + ldr r4, =gUnknown_02022C20 + ldrb r0, [r4] + cmp r0, 0xFF + bne _08016AE8 + movs r0, 0 + b _08016AF6 + .pool +_08016AE8: + ldr r0, =gStringVar1 + adds r1, r4, 0 + bl StringCopy + movs r0, 0xFF + strb r0, [r4] + movs r0, 0x1 +_08016AF6: + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sp182_move_string + + thumb_func_start sub_8016B00 +sub_8016B00: @ 8016B00 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + ldr r0, =gUnknown_02022C30 + ldr r4, [r0] + movs r7, 0 + movs r6, 0 + movs r5, 0 +_08016B12: + ldr r0, [r4, 0xC] + adds r0, r5 + ldr r1, =gUnknown_082F045C + bl sub_8017630 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x1 + bne _08016B5C + ldr r1, [r4, 0xC] + ldr r0, [r4, 0x8] + adds r1, r5 + ldm r1!, {r2,r5,r6} + stm r0!, {r2,r5,r6} + ldm r1!, {r2,r5,r6} + stm r0!, {r2,r5,r6} + ldr r1, [r4, 0x8] + movs r0, 0 + strh r0, [r1, 0x18] + ldr r2, [r4, 0x8] + ldrb r1, [r2, 0x1A] + movs r5, 0x4 + negs r5, r5 + adds r0, r5, 0 + ands r1, r0 + movs r0, 0x1 + orrs r1, r0 + strb r1, [r2, 0x1A] + ldr r0, [r4, 0x8] + strb r3, [r0, 0x1B] + movs r0, 0x4 + b _08016C90 + .pool +_08016B5C: + adds r5, 0x1C + adds r6, 0x1 + cmp r6, 0x3 + ble _08016B12 + movs r6, 0 + mov r9, r6 +_08016B68: + ldr r0, [r4] + mov r1, r9 + lsls r5, r1, 5 + adds r2, r0, r5 + ldrb r0, [r2, 0x1A] + lsls r0, 30 + mov r8, r5 + cmp r0, 0 + beq _08016C5C + ldr r1, [r4, 0x4] + adds r0, r2, 0 + bl sub_80176E4 + adds r6, r0, 0 + cmp r6, 0xFF + beq _08016C02 + ldr r0, [r4] + adds r2, r0, r5 + ldrb r1, [r2, 0x1A] + lsls r0, r1, 30 + lsrs r0, 30 + cmp r0, 0x1 + bne _08016BE0 + lsls r0, r6, 3 + subs r0, r6 + lsls r6, r0, 2 + ldr r1, [r4, 0x4] + adds r1, r6 + adds r0, r2, 0 + bl sub_8017678 + cmp r0, 0 + beq _08016BC6 + ldr r1, [r4] + ldr r0, [r4, 0x4] + adds r1, r5 + adds r0, r6 + ldm r0!, {r2,r3,r6} + stm r1!, {r2,r3,r6} + ldm r0!, {r2,r3,r6} + stm r1!, {r2,r3,r6} + ldr r0, [r4] + adds r0, r5 + movs r1, 0x40 + strb r1, [r0, 0x1B] + movs r7, 0x1 + b _08016BF8 +_08016BC6: + ldr r0, [r4] + adds r1, r0, r5 + ldrb r0, [r1, 0x1B] + cmp r0, 0 + beq _08016BF8 + subs r0, 0x1 + strb r0, [r1, 0x1B] + ldr r0, [r4] + adds r0, r5 + ldrb r0, [r0, 0x1B] + cmp r0, 0 + bne _08016BF8 + b _08016BF6 +_08016BE0: + movs r3, 0x4 + negs r3, r3 + adds r0, r3, 0 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0x1A] + ldr r0, [r4] + adds r0, r5 + movs r1, 0 + strb r1, [r0, 0x1B] +_08016BF6: + movs r7, 0x2 +_08016BF8: + ldr r0, [r4] + add r0, r8 + movs r1, 0 + strh r1, [r0, 0x18] + b _08016C5C +_08016C02: + ldr r0, [r4] + adds r1, r0, r5 + ldrb r0, [r1, 0x1A] + lsls r2, r0, 30 + lsrs r0, r2, 30 + cmp r0, 0x2 + beq _08016C3C + ldrh r0, [r1, 0x18] + adds r0, 0x1 + strh r0, [r1, 0x18] + ldr r0, [r4] + adds r2, r0, r5 + ldrh r1, [r2, 0x18] + ldr r0, =0x00000257 + cmp r1, r0 + bls _08016C5C + ldrb r0, [r2, 0x1A] + movs r5, 0x4 + negs r5, r5 + adds r1, r5, 0 + ands r0, r1 + movs r1, 0x2 + orrs r0, r1 + strb r0, [r2, 0x1A] + movs r7, 0x2 + b _08016C5C + .pool +_08016C3C: + lsrs r0, r2, 30 + cmp r0, 0x2 + bne _08016C5C + ldrh r0, [r1, 0x18] + adds r0, 0x1 + strh r0, [r1, 0x18] + ldr r0, [r4] + adds r2, r0, r5 + ldrh r1, [r2, 0x18] + ldr r0, =0x00000383 + cmp r1, r0 + bls _08016C5C + adds r0, r2, 0 + movs r1, 0x1 + bl sub_8017580 +_08016C5C: + mov r0, r9 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + cmp r0, 0x7 + bhi _08016C6C + b _08016B68 +_08016C6C: + movs r5, 0 + movs r6, 0x3 +_08016C70: + ldr r0, [r4] + ldr r1, [r4, 0x4] + adds r1, r5 + movs r2, 0x8 + bl sub_8017734 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xFF + beq _08016C86 + movs r7, 0x1 +_08016C86: + adds r5, 0x1C + subs r6, 0x1 + cmp r6, 0 + bge _08016C70 + adds r0, r7, 0 +_08016C90: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8016B00 + + thumb_func_start sub_8016CA0 +sub_8016CA0: @ 8016CA0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x20 + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + lsls r0, 2 + add r0, r10 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r6, r0, r1 + movs r7, 0 + mov r0, sp + adds r0, 0x10 + str r0, [sp, 0x18] +_08016CC4: + lsls r2, r7, 24 + lsrs r2, 24 + mov r0, sp + ldr r1, [sp, 0x18] + bl sub_800DE7C + lsls r0, 24 + lsrs r4, r0, 24 + mov r0, sp + ldrb r0, [r0, 0xA] + lsls r0, 25 + lsrs r0, 25 + mov r2, r10 + lsls r1, r2, 2 + add r1, r10 + lsls r1, 3 + ldr r3, =gTasks + adds r1, r3 + movs r5, 0x10 + ldrsh r1, [r1, r5] + bl sub_8013D88 + cmp r0, 0 + bne _08016D00 + mov r1, sp + ldr r0, =gUnknown_082F045C + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} +_08016D00: + mov r0, sp + ldrb r1, [r0] + movs r0, 0xF + ands r0, r1 + cmp r0, 0x1 + bne _08016D18 + mov r1, sp + ldr r0, =gUnknown_082F045C + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} +_08016D18: + cmp r4, 0 + bne _08016D9C + lsls r0, r7, 3 + mov r8, r0 + adds r1, r7, 0x1 + mov r9, r1 + cmp r7, 0 + ble _08016D58 + movs r2, 0 + str r2, [sp, 0x1C] + adds r4, r7, 0 +_08016D2E: + ldr r0, [r6, 0x4] + ldr r3, [sp, 0x1C] + adds r0, r3 + mov r1, sp + bl sub_8017630 + lsls r0, 24 + cmp r0, 0 + bne _08016D4C + mov r1, sp + ldr r0, =gUnknown_082F045C + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} +_08016D4C: + ldr r5, [sp, 0x1C] + adds r5, 0x1C + str r5, [sp, 0x1C] + subs r4, 0x1 + cmp r4, 0 + bne _08016D2E +_08016D58: + ldr r1, [r6, 0x4] + mov r0, r8 + subs r4, r0, r7 + lsls r4, 2 + adds r1, r4 + mov r0, sp + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldr r0, [r6, 0x4] + adds r0, r4 + ldr r1, =gUnknown_082F045C + bl sub_8017630 + ldr r3, [r6, 0x4] + adds r3, r4 + movs r2, 0x1 + ands r2, r0 + ldrb r0, [r3, 0x18] + movs r4, 0x2 + negs r4, r4 + adds r1, r4, 0 + ands r0, r1 + orrs r0, r2 + strb r0, [r3, 0x18] + b _08016DD4 + .pool +_08016D9C: + ldr r1, [r6] + lsls r4, r7, 3 + subs r4, r7 + lsls r4, 2 + adds r1, r4 + mov r0, sp + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldr r0, [r6] + adds r0, r4 + ldr r1, =gUnknown_082F045C + bl sub_8017630 + ldr r3, [r6] + adds r3, r4 + movs r2, 0x1 + ands r2, r0 + ldrb r0, [r3, 0x18] + movs r4, 0x2 + negs r4, r4 + adds r1, r4, 0 + ands r0, r1 + orrs r0, r2 + strb r0, [r3, 0x18] + adds r7, 0x1 + mov r9, r7 +_08016DD4: + mov r7, r9 + cmp r7, 0x3 + bgt _08016DDC + b _08016CC4 +_08016DDC: + add sp, 0x20 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8016CA0 + + thumb_func_start sub_8016DF0 +sub_8016DF0: @ 8016DF0 + push {r4-r6,lr} + adds r4, r0, 0 + adds r5, r1, 0 + adds r6, r2, 0 + ldr r0, =sub_8016CA0 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r2, =gTasks + 0x8 + adds r3, r1, r2 + str r4, [r3] + str r5, [r3, 0x4] + adds r2, r1 + strh r6, [r2, 0x8] + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8016DF0 + + thumb_func_start sub_8016E24 +sub_8016E24: @ 8016E24 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0xC + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + lsls r0, 2 + add r0, r10 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r6, r0, r1 + movs r3, 0 +_08016E42: + lsls r4, r3, 3 + subs r0, r4, r3 + lsls r5, r0, 2 + ldr r0, [r6] + adds r0, r5 + adds r1, r0, 0 + adds r1, 0x10 + lsls r2, r3, 24 + lsrs r2, 24 + str r3, [sp] + bl sub_800DE7C + ldr r0, [r6] + adds r0, r5 + ldrb r0, [r0, 0xA] + lsls r0, 25 + lsrs r0, 25 + mov r2, r10 + lsls r1, r2, 2 + add r1, r10 + lsls r1, 3 + ldr r7, =gTasks + adds r1, r7 + movs r2, 0xC + ldrsh r1, [r1, r2] + bl sub_8013D88 + mov r8, r4 + ldr r3, [sp] + cmp r0, 0 + bne _08016E8E + ldr r1, [r6] + adds r1, r5 + ldr r0, =gUnknown_082F045C + ldm r0!, {r2,r4,r7} + stm r1!, {r2,r4,r7} + ldm r0!, {r2,r4,r7} + stm r1!, {r2,r4,r7} +_08016E8E: + adds r4, r3, 0x1 + mov r9, r4 + cmp r3, 0 + ble _08016ED2 + str r5, [sp, 0x4] + movs r5, 0 + str r5, [sp, 0x8] + adds r4, r3, 0 +_08016E9E: + ldr r1, [r6] + ldr r7, [sp, 0x8] + adds r0, r1, r7 + ldr r2, [sp, 0x4] + adds r1, r2 + str r3, [sp] + bl sub_8017630 + lsls r0, 24 + ldr r3, [sp] + cmp r0, 0 + bne _08016EC6 + ldr r1, [r6] + ldr r5, [sp, 0x4] + adds r1, r5 + ldr r0, =gUnknown_082F045C + ldm r0!, {r2,r5,r7} + stm r1!, {r2,r5,r7} + ldm r0!, {r2,r5,r7} + stm r1!, {r2,r5,r7} +_08016EC6: + ldr r7, [sp, 0x8] + adds r7, 0x1C + str r7, [sp, 0x8] + subs r4, 0x1 + cmp r4, 0 + bne _08016E9E +_08016ED2: + mov r0, r8 + subs r4, r0, r3 + lsls r4, 2 + ldr r0, [r6] + adds r0, r4 + ldr r1, =gUnknown_082F045C + bl sub_8017630 + ldr r3, [r6] + adds r3, r4 + movs r2, 0x1 + ands r2, r0 + ldrb r0, [r3, 0x18] + movs r4, 0x2 + negs r4, r4 + adds r1, r4, 0 + ands r0, r1 + orrs r0, r2 + strb r0, [r3, 0x18] + mov r3, r9 + cmp r3, 0x3 + ble _08016E42 + add sp, 0xC + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8016E24 + + thumb_func_start sub_8016F1C +sub_8016F1C: @ 8016F1C + push {lr} + lsls r1, 16 + asrs r1, 16 + cmp r1, 0x7 + bne _08016F2C + ldrb r1, [r0] + movs r0, 0x20 + b _08016F34 +_08016F2C: + cmp r1, 0x8 + bne _08016F3E + ldrb r1, [r0] + movs r0, 0x10 +_08016F34: + ands r0, r1 + cmp r0, 0 + beq _08016F3E + movs r0, 0x1 + b _08016F40 +_08016F3E: + movs r0, 0 +_08016F40: + pop {r1} + bx r1 + thumb_func_end sub_8016F1C + + thumb_func_start sub_8016F44 +sub_8016F44: @ 8016F44 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r4, r1, r0 + movs r6, 0 + subs r0, 0x8 + movs r5, 0 + adds r1, r0 + mov r8, r1 +_08016F62: + ldr r0, [r4] + adds r0, r5 + adds r1, r0, 0 + adds r1, 0x10 + lsls r2, r6, 24 + lsrs r2, 24 + bl sub_800DF34 + lsls r0, 24 + cmp r0, 0 + beq _08016F86 + ldr r0, [r4] + adds r0, r5 + mov r2, r8 + movs r3, 0xC + ldrsh r1, [r2, r3] + bl sub_8016F1C +_08016F86: + ldr r0, [r4] + adds r0, r5 + ldr r1, =gUnknown_082F045C + bl sub_8017630 + ldr r3, [r4] + adds r3, r5 + movs r2, 0x1 + ands r2, r0 + ldrb r0, [r3, 0x18] + movs r7, 0x2 + negs r7, r7 + adds r1, r7, 0 + ands r0, r1 + orrs r0, r2 + strb r0, [r3, 0x18] + adds r5, 0x1C + adds r6, 0x1 + cmp r6, 0x3 + ble _08016F62 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8016F44 + + thumb_func_start sub_8016FC0 +sub_8016FC0: @ 8016FC0 + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + ldr r0, =sub_8016E24 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + lsls r2, r0, 2 + adds r2, r0 + lsls r2, 3 + ldr r1, =gTasks + 0x8 + adds r3, r2, r1 + str r4, [r3] + adds r1, r2 + strh r5, [r1, 0x4] + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8016FC0 + + thumb_func_start sub_8016FF0 +sub_8016FF0: @ 8016FF0 + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + ldr r0, =sub_8016F44 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + lsls r2, r0, 2 + adds r2, r0 + lsls r2, 3 + ldr r1, =gTasks + 0x8 + adds r3, r2, r1 + str r4, [r3] + adds r1, r2 + strh r5, [r1, 0x4] + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8016FF0 + + thumb_func_start sub_8017020 +sub_8017020: @ 8017020 + push {r4,lr} + adds r4, r0, 0 + bl sub_81973A4 + movs r0, 0 + movs r1, 0x1 + bl sub_81973C4 + ldr r0, =gStringVar4 + adds r1, r4, 0 + bl StringExpandPlaceholders + movs r0, 0 + movs r1, 0x1 + bl AddTextPrinterWithCustomSpeedForMessage + movs r0, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8017020 + + thumb_func_start sub_801704C +sub_801704C: @ 801704C + push {lr} + bl sub_8197224 + lsls r0, 16 + cmp r0, 0 + beq _0801705C + movs r0, 0 + b _0801705E +_0801705C: + movs r0, 0x1 +_0801705E: + pop {r1} + bx r1 + thumb_func_end sub_801704C + + thumb_func_start sub_8017064 +sub_8017064: @ 8017064 + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _08017076 + cmp r0, 0x1 + beq _0801709C + b _080170AE +_08017076: + bl sub_81973A4 + movs r0, 0 + movs r1, 0x1 + bl sub_81973C4 + ldr r0, =gStringVar4 + adds r1, r5, 0 + bl StringExpandPlaceholders + movs r0, 0x1 + bl AddTextPrinterForMessage_2 + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _080170AE + .pool +_0801709C: + bl sub_8197224 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0 + bne _080170AE + strb r0, [r4] + movs r0, 0x1 + b _080170B0 +_080170AE: + movs r0, 0 +_080170B0: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8017064 + + thumb_func_start sub_80170B8 +sub_80170B8: @ 80170B8 + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _080170CA + cmp r0, 0x1 + beq _080170E0 + b _0801710C +_080170CA: + cmp r5, 0 + beq _080170D4 + movs r0, 0x3 + negs r0, r0 + b _08017110 +_080170D4: + bl sub_8197930 + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801710C +_080170E0: + cmp r5, 0 + beq _080170F2 + bl sub_8198C78 + movs r0, 0 + strb r0, [r4] + movs r0, 0x3 + negs r0, r0 + b _08017110 +_080170F2: + bl sub_8198C58 + lsls r0, 24 + asrs r1, r0, 24 + movs r2, 0x80 + lsls r2, 17 + adds r0, r2 + lsrs r0, 24 + cmp r0, 0x2 + bhi _0801710C + strb r5, [r4] + adds r0, r1, 0 + b _08017110 +_0801710C: + movs r0, 0x2 + negs r0, r0 +_08017110: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_80170B8 + + thumb_func_start sub_8017118 +sub_8017118: @ 8017118 + push {r4,lr} + sub sp, 0x8 + bl AddWindow + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + adds r0, r4, 0 + movs r1, 0 + bl sub_81973FC + adds r0, r4, 0 + movs r1, 0xFF + bl FillWindowPixelBuffer + ldr r2, =gUnknown_082EFD94 + movs r0, 0x1 + str r0, [sp] + movs r0, 0x6 + str r0, [sp, 0x4] + adds r0, r4, 0 + movs r1, 0x1 + movs r3, 0x8 + bl sub_80173E0 + adds r0, r4, 0 + movs r1, 0x2 + bl CopyWindowToVram + adds r0, r4, 0 + bl PutWindowTilemap + adds r0, r4, 0 + add sp, 0x8 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8017118 + + thumb_func_start sub_8017168 +sub_8017168: @ 8017168 + push {lr} + lsls r0, 24 + lsrs r0, 24 + bl RemoveWindow + pop {r0} + bx r0 + thumb_func_end sub_8017168 + + thumb_func_start sub_8017178 +sub_8017178: @ 8017178 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x8 + adds r7, r0, 0 + adds r5, r1, 0 + mov r9, r2 + ldrb r4, [r7] + cmp r4, 0 + beq _08017194 + cmp r4, 0x1 + beq _08017228 + b _0801728E +_08017194: + ldr r0, [r3] + ldr r1, [r3, 0x4] + str r0, [sp] + str r1, [sp, 0x4] + ldr r0, [sp, 0x24] + bl sub_81DB41C + adds r1, r0, 0 + ldr r2, [sp] + lsrs r0, r2, 24 + cmp r0, r1 + ble _080171B6 + lsls r1, 24 + ldr r0, =0x00ffffff + ands r0, r2 + orrs r0, r1 + str r0, [sp] +_080171B6: + ldr r2, [sp] + lsrs r0, r2, 8 + lsls r0, 24 + lsrs r0, 24 + lsrs r1, r2, 24 + adds r0, r1 + cmp r0, 0x1D + ble _080171DC + movs r0, 0x1D + subs r0, r1 + cmp r0, 0 + bge _080171D0 + movs r0, 0 +_080171D0: + lsls r1, r0, 24 + lsrs r1, 16 + ldr r0, =0xffff00ff + ands r0, r2 + orrs r0, r1 + str r0, [sp] +_080171DC: + mov r0, sp + bl AddWindow + strb r0, [r5] + ldrb r0, [r5] + movs r1, 0 + bl sub_81973FC + ldr r0, =gUnknown_03006310 + adds r2, r0, 0 + ldr r1, [sp, 0x24] + ldm r1!, {r3,r4,r6} + stm r2!, {r3,r4,r6} + ldm r1!, {r3,r4,r6} + stm r2!, {r3,r4,r6} + ldrb r1, [r5] + strb r1, [r0, 0x10] + movs r1, 0 + movs r2, 0 + bl ListMenuInit + mov r1, r9 + strb r0, [r1] + ldrb r0, [r5] + movs r1, 0x1 + bl CopyWindowToVram + ldrb r0, [r7] + adds r0, 0x1 + strb r0, [r7] + b _0801728E + .pool +_08017228: + mov r3, r9 + ldrb r0, [r3] + bl ListMenuHandleInput + mov r8, r0 + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + ands r4, r1 + cmp r4, 0 + beq _08017264 + mov r4, r9 + ldrb r0, [r4] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldrb r0, [r5] + movs r1, 0x1 + bl sub_819746C + ldrb r0, [r5] + bl RemoveWindow + movs r0, 0 + strb r0, [r7] + mov r0, r8 + b _08017292 + .pool +_08017264: + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0801728E + mov r6, r9 + ldrb r0, [r6] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldrb r0, [r5] + movs r1, 0x1 + bl sub_819746C + ldrb r0, [r5] + bl RemoveWindow + strb r4, [r7] + movs r0, 0x2 + negs r0, r0 + b _08017292 +_0801728E: + movs r0, 0x1 + negs r0, r0 +_08017292: + add sp, 0x8 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8017178 + + thumb_func_start sub_80172A0 +sub_80172A0: @ 80172A0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + adds r5, r0, 0 + adds r6, r1, 0 + mov r10, r2 + mov r9, r3 + ldrb r4, [r5] + cmp r4, 0x1 + beq _0801730C + cmp r4, 0x1 + bgt _080172C2 + cmp r4, 0 + beq _080172C8 + b _0801739C +_080172C2: + cmp r4, 0x2 + beq _0801731C + b _0801739C +_080172C8: + ldr r0, =gUnknown_082F0344 + bl sub_8017118 + mov r1, r9 + strb r0, [r1] + ldr r0, [sp, 0x20] + bl AddWindow + strb r0, [r6] + ldrb r0, [r6] + movs r1, 0 + bl sub_81973FC + ldr r0, =gUnknown_03006310 + adds r2, r0, 0 + ldr r1, [sp, 0x24] + ldm r1!, {r3,r4,r7} + stm r2!, {r3,r4,r7} + ldm r1!, {r3,r4,r7} + stm r2!, {r3,r4,r7} + ldrb r1, [r6] + strb r1, [r0, 0x10] + movs r1, 0 + movs r2, 0x1 + bl ListMenuInit + mov r1, r10 + strb r0, [r1] + b _08017314 + .pool +_0801730C: + ldrb r0, [r6] + movs r1, 0x1 + bl CopyWindowToVram +_08017314: + ldrb r0, [r5] + adds r0, 0x1 + strb r0, [r5] + b _0801739C +_0801731C: + mov r3, r10 + ldrb r0, [r3] + bl ListMenuHandleInput + adds r1, r0, 0 + ldr r0, =gMain + ldrh r2, [r0, 0x2E] + movs r0, 0x3 + ands r0, r2 + cmp r0, 0 + beq _0801739C + cmp r1, 0x8 + beq _0801733E + ands r4, r2 + mov r8, r4 + cmp r4, 0 + beq _08017368 +_0801733E: + mov r4, r10 + ldrb r0, [r4] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldrb r0, [r6] + bl RemoveWindow + mov r7, r9 + ldrb r0, [r7] + bl sub_8017168 + movs r0, 0 + strb r0, [r5] + movs r0, 0x2 + negs r0, r0 + b _080173A0 + .pool +_08017368: + ldr r0, [sp, 0x28] + bl sub_8017CB0 + adds r4, r0, 0 + cmp r4, 0 + blt _08017396 + mov r1, r10 + ldrb r0, [r1] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldrb r0, [r6] + bl RemoveWindow + mov r3, r9 + ldrb r0, [r3] + bl sub_8017168 + mov r7, r8 + strb r7, [r5] + adds r0, r4, 0 + b _080173A0 +_08017396: + movs r0, 0x7 + bl PlaySE +_0801739C: + movs r0, 0x1 + negs r0, r0 +_080173A0: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80172A0 + + thumb_func_start sub_80173B0 +sub_80173B0: @ 80173B0 + push {lr} + sub sp, 0xC + movs r0, 0x20 + str r0, [sp] + str r0, [sp, 0x4] + movs r0, 0 + str r0, [sp, 0x8] + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect + movs r0, 0 + bl CopyBgTilemapBufferToVram + add sp, 0xC + pop {r0} + bx r0 + thumb_func_end sub_80173B0 + + thumb_func_start sub_80173D4 +sub_80173D4: @ 80173D4 + push {lr} + bl EnableBothScriptContexts + pop {r0} + bx r0 + thumb_func_end sub_80173D4 + + thumb_func_start sub_80173E0 +sub_80173E0: @ 80173E0 + push {r4,r5,lr} + sub sp, 0x10 + ldr r5, [sp, 0x1C] + ldr r4, [sp, 0x20] + lsls r3, 24 + lsrs r3, 24 + lsls r5, 24 + lsrs r5, 24 + lsls r4, 24 + lsrs r4, 24 + str r2, [sp] + mov r2, sp + strb r0, [r2, 0x4] + mov r0, sp + strb r1, [r0, 0x5] + strb r3, [r0, 0x6] + strb r5, [r0, 0x7] + strb r3, [r0, 0x8] + strb r5, [r0, 0x9] + ldrb r1, [r2, 0xC] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0xC] + ldr r2, =gTextFlags + ldrb r1, [r2] + movs r0, 0x3 + negs r0, r0 + ands r0, r1 + strb r0, [r2] + cmp r4, 0x6 + bls _08017422 + b _0801756E +_08017422: + lsls r0, r4, 2 + ldr r1, =_08017434 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08017434: + .4byte _08017450 + .4byte _0801747C + .4byte _080174A8 + .4byte _080174D4 + .4byte _08017500 + .4byte _0801752C + .4byte _08017544 +_08017450: + mov r0, sp + movs r1, 0 + strb r1, [r0, 0xA] + strb r1, [r0, 0xB] + mov r2, sp + ldrb r1, [r2, 0xC] + movs r3, 0xF + adds r0, r3, 0 + ands r0, r1 + movs r1, 0x20 + orrs r0, r1 + strb r0, [r2, 0xC] + ldrb r1, [r2, 0xD] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0xD] + ands r0, r3 + movs r1, 0x30 + b _0801756A +_0801747C: + mov r0, sp + movs r1, 0 + strb r1, [r0, 0xA] + strb r1, [r0, 0xB] + mov r2, sp + ldrb r1, [r2, 0xC] + movs r3, 0xF + adds r0, r3, 0 + ands r0, r1 + movs r1, 0x40 + orrs r0, r1 + strb r0, [r2, 0xC] + ldrb r1, [r2, 0xD] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0xD] + ands r0, r3 + movs r1, 0x50 + b _0801756A +_080174A8: + mov r0, sp + movs r1, 0 + strb r1, [r0, 0xA] + strb r1, [r0, 0xB] + mov r2, sp + ldrb r1, [r2, 0xC] + movs r3, 0xF + adds r0, r3, 0 + ands r0, r1 + movs r1, 0x60 + orrs r0, r1 + strb r0, [r2, 0xC] + ldrb r1, [r2, 0xD] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0xD] + ands r0, r3 + movs r1, 0x70 + b _0801756A +_080174D4: + mov r0, sp + movs r1, 0 + strb r1, [r0, 0xA] + strb r1, [r0, 0xB] + mov r2, sp + ldrb r1, [r2, 0xC] + movs r3, 0xF + adds r0, r3, 0 + ands r0, r1 + movs r1, 0x10 + orrs r0, r1 + strb r0, [r2, 0xC] + ldrb r1, [r2, 0xD] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0xD] + ands r0, r3 + movs r1, 0x30 + b _0801756A +_08017500: + mov r0, sp + movs r1, 0 + strb r1, [r0, 0xA] + strb r1, [r0, 0xB] + mov r2, sp + ldrb r1, [r2, 0xC] + movs r3, 0xF + adds r0, r3, 0 + ands r0, r1 + movs r1, 0x10 + orrs r0, r1 + strb r0, [r2, 0xC] + ldrb r1, [r2, 0xD] + movs r0, 0x10 + negs r0, r0 + ands r0, r1 + movs r1, 0x2 + orrs r0, r1 + strb r0, [r2, 0xD] + ands r0, r3 + movs r1, 0x30 + b _0801756A +_0801752C: + mov r0, sp + movs r1, 0 + strb r1, [r0, 0xA] + strb r1, [r0, 0xB] + mov r2, sp + ldrb r1, [r2, 0xC] + movs r4, 0xF + movs r3, 0xF + adds r0, r3, 0 + ands r0, r1 + movs r1, 0x70 + b _0801755A +_08017544: + mov r0, sp + movs r1, 0 + strb r1, [r0, 0xA] + strb r1, [r0, 0xB] + mov r2, sp + ldrb r1, [r2, 0xC] + movs r4, 0xF + movs r3, 0xF + adds r0, r3, 0 + ands r0, r1 + movs r1, 0xE0 +_0801755A: + orrs r0, r1 + strb r0, [r2, 0xC] + mov r1, sp + ldrb r0, [r1, 0xD] + orrs r0, r4 + strb r0, [r1, 0xD] + ands r0, r3 + movs r1, 0x90 +_0801756A: + orrs r0, r1 + strb r0, [r2, 0xD] +_0801756E: + mov r0, sp + movs r1, 0xFF + movs r2, 0 + bl AddTextPrinter + add sp, 0x10 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_80173E0 + + thumb_func_start sub_8017580 +sub_8017580: @ 8017580 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + lsls r1, 24 + lsrs r1, 24 + cmp r1, 0 + beq _080175D8 + ldr r2, =gUnknown_082F045C + mov r8, r2 + movs r5, 0 + mov r9, r5 + movs r6, 0x4 + negs r6, r6 + mov r12, r6 + adds r2, r0, 0 + adds r2, 0x18 + adds r4, r0, 0 + movs r7, 0xFF + mov r10, r7 + adds r3, r1, 0 +_080175AC: + adds r1, r4, 0 + mov r0, r8 + ldm r0!, {r5-r7} + stm r1!, {r5-r7} + ldm r0!, {r5-r7} + stm r1!, {r5-r7} + mov r0, r10 + strh r0, [r2] + ldrb r1, [r2, 0x2] + mov r0, r12 + ands r0, r1 + movs r1, 0x5 + negs r1, r1 + ands r0, r1 + strb r0, [r2, 0x2] + mov r5, r9 + strb r5, [r2, 0x3] + adds r2, 0x20 + adds r4, 0x20 + subs r3, 0x1 + cmp r3, 0 + bne _080175AC +_080175D8: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8017580 + + thumb_func_start sub_80175EC +sub_80175EC: @ 80175EC + push {r4-r7,lr} + mov r7, r8 + push {r7} + ldr r1, =gUnknown_082F045C + mov r12, r1 + movs r5, 0x2 + negs r5, r5 + mov r8, r5 + adds r2, r0, 0 + adds r2, 0x18 + adds r3, r0, 0 + movs r4, 0x3 +_08017604: + adds r1, r3, 0 + mov r0, r12 + ldm r0!, {r5-r7} + stm r1!, {r5-r7} + ldm r0!, {r5-r7} + stm r1!, {r5-r7} + ldrb r1, [r2] + mov r0, r8 + ands r0, r1 + strb r0, [r2] + adds r2, 0x1C + adds r3, 0x1C + subs r4, 0x1 + cmp r4, 0 + bge _08017604 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80175EC + + thumb_func_start sub_8017630 +sub_8017630: @ 8017630 + push {r4-r6,lr} + adds r5, r0, 0 + adds r6, r1, 0 + movs r2, 0 + adds r4, r5, 0x2 + adds r3, r6, 0x2 +_0801763C: + adds r0, r4, r2 + adds r1, r3, r2 + ldrb r0, [r0] + ldrb r1, [r1] + cmp r0, r1 + bne _08017664 + adds r2, 0x1 + cmp r2, 0x1 + ble _0801763C + movs r2, 0 + adds r4, r5, 0 + adds r4, 0x10 + adds r3, r6, 0 + adds r3, 0x10 +_08017658: + adds r0, r4, r2 + adds r1, r3, r2 + ldrb r0, [r0] + ldrb r1, [r1] + cmp r0, r1 + beq _08017668 +_08017664: + movs r0, 0x1 + b _08017670 +_08017668: + adds r2, 0x1 + cmp r2, 0x7 + ble _08017658 + movs r0, 0 +_08017670: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8017630 + + thumb_func_start sub_8017678 +sub_8017678: @ 8017678 + push {r4-r6,lr} + adds r5, r0, 0 + adds r6, r1, 0 + ldrb r3, [r5, 0xA] + movs r0, 0x7F + ldrb r2, [r6, 0xA] + adds r1, r0, 0 + ands r1, r3 + ands r0, r2 + cmp r1, r0 + bne _080176DC + movs r0, 0x80 + adds r1, r0, 0 + ands r1, r3 + ands r0, r2 + cmp r1, r0 + bne _080176DC + movs r2, 0 + adds r4, r5, 0x4 + adds r3, r6, 0x4 +_080176A0: + adds r0, r4, r2 + adds r1, r3, r2 + ldrb r0, [r0] + ldrb r1, [r1] + cmp r0, r1 + bne _080176DC + adds r2, 0x1 + cmp r2, 0x3 + ble _080176A0 + ldrh r2, [r5, 0x8] + ldr r0, =0x000003ff + ldrh r3, [r6, 0x8] + adds r1, r0, 0 + ands r1, r2 + ands r0, r3 + cmp r1, r0 + bne _080176DC + ldrb r2, [r5, 0x9] + movs r0, 0xFC + ldrb r3, [r6, 0x9] + adds r1, r0, 0 + ands r1, r2 + ands r0, r3 + cmp r1, r0 + bne _080176DC + movs r0, 0 + b _080176DE + .pool +_080176DC: + movs r0, 0x1 +_080176DE: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8017678 + + thumb_func_start sub_80176E4 +sub_80176E4: @ 80176E4 + push {r4-r7,lr} + mov r7, r8 + push {r7} + mov r8, r0 + movs r7, 0xFF + movs r6, 0 + adds r4, r1, 0 + adds r4, 0x18 + adds r5, r1, 0 +_080176F6: + ldrb r1, [r4] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0801771E + mov r0, r8 + adds r1, r5, 0 + bl sub_8017630 + lsls r0, 24 + cmp r0, 0 + bne _0801771E + lsls r0, r6, 24 + lsrs r7, r0, 24 + ldrb r0, [r4] + movs r2, 0x2 + negs r2, r2 + adds r1, r2, 0 + ands r0, r1 + strb r0, [r4] +_0801771E: + adds r4, 0x1C + adds r5, 0x1C + adds r6, 0x1 + cmp r6, 0x3 + ble _080176F6 + adds r0, r7, 0 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80176E4 + + thumb_func_start sub_8017734 +sub_8017734: @ 8017734 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r3, r0, 0 + mov r8, r1 + lsls r2, 24 + lsrs r6, r2, 24 + ldrb r1, [r1, 0x18] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _080177A8 + movs r5, 0 + cmp r5, r6 + bge _080177A8 + movs r0, 0x4 + negs r0, r0 + mov r9, r0 + movs r1, 0x2 + negs r1, r1 + mov r12, r1 + adds r2, r3, 0 + adds r2, 0x18 + adds r1, r3, 0 +_08017766: + ldrb r0, [r2, 0x2] + movs r3, 0x3 + ands r3, r0 + cmp r3, 0 + bne _0801779E + mov r0, r8 + ldm r0!, {r4,r6,r7} + stm r1!, {r4,r6,r7} + ldm r0!, {r4,r6,r7} + stm r1!, {r4,r6,r7} + strh r3, [r2] + ldrb r1, [r2, 0x2] + mov r0, r9 + ands r0, r1 + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2, 0x2] + movs r0, 0x40 + strb r0, [r2, 0x3] + mov r0, r8 + ldrb r1, [r0, 0x18] + mov r0, r12 + ands r0, r1 + mov r1, r8 + strb r0, [r1, 0x18] + lsls r0, r5, 24 + lsrs r0, 24 + b _080177AA +_0801779E: + adds r2, 0x20 + adds r1, 0x20 + adds r5, 0x1 + cmp r5, r6 + blt _08017766 +_080177A8: + movs r0, 0xFF +_080177AA: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8017734 + + thumb_func_start sub_80177B8 +sub_80177B8: @ 80177B8 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x10 + adds r4, r1, 0 + adds r6, r3, 0 + ldr r3, [sp, 0x2C] + ldr r1, [sp, 0x30] + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + lsls r4, 24 + lsrs r4, 24 + lsls r2, 24 + lsrs r7, r2, 24 + lsls r3, 24 + lsrs r3, 24 + mov r9, r3 + lsls r1, 24 + lsrs r1, 24 + ldr r5, =gStringVar4 + adds r1, 0x1 + adds r0, r5, 0 + movs r2, 0x2 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r1, =gText_Colon + adds r0, r5, 0 + bl StringAppend + str r7, [sp] + movs r0, 0 + str r0, [sp, 0x4] + mov r0, r8 + movs r1, 0x1 + adds r2, r5, 0 + adds r3, r4, 0 + bl sub_80173E0 + adds r4, 0x12 + lsls r4, 24 + lsrs r4, 24 + ldrb r0, [r6, 0xA] + lsls r0, 25 + lsrs r2, r0, 25 + ldrb r1, [r6, 0x1A] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _08017884 + movs r0, 0x40 + ands r2, r0 + cmp r2, 0 + bne _08017884 + adds r0, r5, 0 + adds r1, r6, 0 + bl sub_8018404 + str r7, [sp] + mov r0, r9 + str r0, [sp, 0x4] + mov r0, r8 + movs r1, 0x1 + adds r2, r5, 0 + adds r3, r4, 0 + bl sub_80173E0 + ldrb r1, [r6, 0x2] + ldrb r0, [r6, 0x3] + lsls r0, 8 + orrs r1, r0 + add r0, sp, 0x8 + movs r2, 0x2 + movs r3, 0x5 + bl ConvertIntToDecimalStringN + ldr r1, =gText_UnkCtrlCodeF907 + adds r0, r5, 0 + bl StringCopy + adds r0, r5, 0 + add r1, sp, 0x8 + bl StringAppend + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x88 + bl GetStringRightAlignXOffset + adds r3, r0, 0 + lsls r3, 24 + lsrs r3, 24 + str r7, [sp] + mov r0, r9 + str r0, [sp, 0x4] + mov r0, r8 + movs r1, 0x1 + adds r2, r5, 0 + bl sub_80173E0 +_08017884: + add sp, 0x10 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80177B8 + + thumb_func_start sub_80178A0 +sub_80178A0: @ 80178A0 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x10 + adds r5, r3, 0 + ldr r3, [sp, 0x2C] + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + lsls r1, 24 + lsrs r6, r1, 24 + lsls r2, 24 + lsrs r2, 24 + mov r8, r2 + lsls r3, 24 + lsrs r7, r3, 24 + ldrb r1, [r5, 0x1A] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _0801792A + ldr r4, =gStringVar4 + adds r0, r4, 0 + adds r1, r5, 0 + bl sub_8018404 + mov r0, r8 + str r0, [sp] + str r7, [sp, 0x4] + mov r0, r9 + movs r1, 0x1 + adds r2, r4, 0 + adds r3, r6, 0 + bl sub_80173E0 + ldrb r1, [r5, 0x2] + ldrb r0, [r5, 0x3] + lsls r0, 8 + orrs r1, r0 + add r0, sp, 0x8 + movs r2, 0x2 + movs r3, 0x5 + bl ConvertIntToDecimalStringN + ldr r1, =gText_UnkCtrlCodeF907 + adds r0, r4, 0 + bl StringCopy + adds r0, r4, 0 + add r1, sp, 0x8 + bl StringAppend + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x68 + bl GetStringRightAlignXOffset + adds r3, r0, 0 + lsls r3, 24 + lsrs r3, 24 + mov r0, r8 + str r0, [sp] + str r7, [sp, 0x4] + mov r0, r9 + movs r1, 0x1 + adds r2, r4, 0 + bl sub_80173E0 +_0801792A: + add sp, 0x10 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80178A0 + + thumb_func_start sub_8017940 +sub_8017940: @ 8017940 + push {r4,lr} + sub sp, 0x4 + mov r4, sp + adds r4, 0x2 + mov r0, sp + adds r1, r4, 0 + bl GetXYCoordsOneStepInFrontOfPlayer + mov r0, sp + movs r1, 0 + ldrsh r0, [r0, r1] + cmp r0, 0x9 + bne _08017978 + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0x8 + bne _08017978 + ldr r0, =gPlayerAvatar + ldrb r0, [r0, 0x3] + cmp r0, 0x2 + beq _0801796E + cmp r0, 0 + bne _08017978 +_0801796E: + movs r0, 0x1 + b _0801797A + .pool +_08017978: + movs r0, 0 +_0801797A: + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8017940 + + thumb_func_start sub_8017984 +sub_8017984: @ 8017984 + push {lr} + cmp r0, 0x4 + beq _0801799C + cmp r0, 0x4 + ble _080179A4 + cmp r0, 0x5 + beq _08017998 + cmp r0, 0x8 + beq _080179A0 + b _080179A4 +_08017998: + movs r0, 0x1 + b _080179A6 +_0801799C: + movs r0, 0x2 + b _080179A6 +_080179A0: + movs r0, 0x3 + b _080179A6 +_080179A4: + movs r0, 0 +_080179A6: + pop {r1} + bx r1 + thumb_func_end sub_8017984 + + thumb_func_start sub_80179AC +sub_80179AC: @ 80179AC + push {r4,lr} + sub sp, 0x20 + adds r4, r0, 0 + mov r0, sp + adds r1, r4, 0 + bl sub_8018404 + adds r4, 0x2 + adds r0, r4, 0 + bl sub_8015658 + lsls r0, 16 + lsrs r0, 16 + mov r1, sp + bl sub_800E540 + add sp, 0x20 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_80179AC + + thumb_func_start sub_80179D4 +sub_80179D4: @ 80179D4 + push {r4-r6,lr} + adds r6, r3, 0 + lsls r1, 24 + lsrs r4, r1, 24 + lsls r2, 24 + lsrs r2, 19 + adds r5, r0, r2 + ldrb r1, [r5, 0xA] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08017A4C + cmp r4, 0 + bne _08017A4C + ldr r4, =gStringVar1 + adds r0, r4, 0 + adds r1, r5, 0 + bl sub_8018404 + adds r0, r5, 0x2 + bl sub_8015658 + lsls r0, 16 + lsrs r0, 16 + adds r1, r4, 0 + bl sub_800E540 + adds r2, r0, 0 + ldrb r1, [r5, 0xA] + movs r0, 0x7F + ands r0, r1 + cmp r0, 0x45 + bne _08017A38 + ldr r0, =gStringVar4 + ldr r3, =gUnknown_082EE6B8 + lsls r1, r6, 2 + lsls r2, 3 + adds r1, r2 + adds r1, r3 + ldr r1, [r1] + bl StringExpandPlaceholders + movs r0, 0x2 + b _08017B2A + .pool +_08017A38: + ldr r0, =gUnknown_082EE17C + lsls r1, r2, 2 + adds r1, r0 + ldr r0, [r1] + bl sub_8017020 + movs r0, 0x1 + b _08017B2A + .pool +_08017A4C: + ldr r0, =gStringVar1 + adds r1, r5, 0 + bl sub_8018404 + cmp r4, 0 + beq _08017A62 + adds r0, r5, r4 + ldrb r0, [r0, 0x3] + lsrs r6, r0, 3 + movs r0, 0x1 + ands r6, r0 +_08017A62: + ldrb r0, [r5, 0xA] + lsls r0, 25 + lsrs r0, 25 + movs r1, 0x3F + ands r1, r0 + cmp r1, 0x4 + beq _08017AB0 + cmp r1, 0x4 + bgt _08017A80 + cmp r1, 0x1 + beq _08017A8A + b _08017B20 + .pool +_08017A80: + cmp r1, 0x5 + beq _08017AD0 + cmp r1, 0x8 + beq _08017AF4 + b _08017B20 +_08017A8A: + ldr r5, =gStringVar4 + ldr r4, =gUnknown_082EEEAC + bl Random + lsls r0, 16 + movs r1, 0xC0 + lsls r1, 10 + ands r1, r0 + lsrs r1, 14 + lsls r0, r6, 4 + adds r1, r0 + adds r1, r4 + ldr r1, [r1] + b _08017B0E + .pool +_08017AB0: + ldr r5, =gStringVar4 + ldr r4, =gUnknown_082EF1CC + bl Random + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x1 + ands r0, r1 + lsls r0, 2 + lsls r1, r6, 4 + b _08017B08 + .pool +_08017AD0: + ldr r5, =gStringVar4 + ldr r4, =gUnknown_082EF010 + bl Random + lsls r0, 16 + movs r1, 0xC0 + lsls r1, 10 + ands r1, r0 + lsrs r1, 14 + lsls r0, r6, 4 + adds r1, r0 + adds r1, r4 + ldr r1, [r1] + b _08017B0E + .pool +_08017AF4: + ldr r5, =gStringVar4 + ldr r4, =gUnknown_082EF100 + bl Random + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x1 + ands r0, r1 + lsls r0, 2 + lsls r1, r6, 3 +_08017B08: + adds r0, r1 + adds r0, r4 + ldr r1, [r0] +_08017B0E: + adds r0, r5, 0 + bl StringExpandPlaceholders + b _08017B28 + .pool +_08017B20: + ldr r0, =gStringVar4 + ldr r1, =gUnknown_082EE6C8 + bl StringExpandPlaceholders +_08017B28: + movs r0, 0 +_08017B2A: + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_80179D4 + + thumb_func_start nullsub_14 +nullsub_14: @ 8017B38 + bx lr + thumb_func_end nullsub_14 + + thumb_func_start sub_8017B3C +sub_8017B3C: @ 8017B3C + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0xC + ldr r4, [sp, 0x28] + lsls r0, 24 + lsrs r6, r0, 24 + lsls r1, 24 + lsrs r5, r1, 24 + lsls r4, 24 + lsrs r4, 24 + ldrh r0, [r2, 0x8] + lsls r0, 22 + lsrs r0, 22 + mov r8, r0 + ldrb r0, [r2, 0x9] + lsrs r7, r0, 2 + ldrb r0, [r2, 0xB] + lsrs r0, 1 + mov r9, r0 + str r5, [sp] + str r4, [sp, 0x4] + adds r0, r6, 0 + movs r1, 0x1 + adds r2, r3, 0 + movs r3, 0x8 + bl sub_80173E0 + movs r0, 0xCE + lsls r0, 1 + cmp r8, r0 + bne _08017B94 + ldr r2, =gUnknown_082EF7D0 + str r5, [sp] + str r4, [sp, 0x4] + adds r0, r6, 0 + movs r1, 0x1 + movs r3, 0x44 + bl sub_80173E0 + b _08017BD4 + .pool +_08017B94: + adds r1, r7, 0x1 + adds r0, r6, 0 + movs r2, 0x44 + adds r3, r5, 0 + bl blit_move_info_icon + movs r0, 0xB + mov r2, r8 + muls r2, r0 + ldr r0, =gSpeciesNames + adds r2, r0 + str r5, [sp] + str r4, [sp, 0x4] + adds r0, r6, 0 + movs r1, 0x1 + movs r3, 0x76 + bl sub_80173E0 + add r0, sp, 0x8 + mov r1, r9 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + str r5, [sp] + str r4, [sp, 0x4] + adds r0, r6, 0 + movs r1, 0x1 + add r2, sp, 0x8 + movs r3, 0xC6 + bl sub_80173E0 +_08017BD4: + add sp, 0xC + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8017B3C + + thumb_func_start sub_8017BE8 +sub_8017BE8: @ 8017BE8 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x10 + adds r4, r1, 0 + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + lsls r2, 24 + lsrs r7, r2, 24 + ldr r0, =gUnknown_02022C30 + ldr r0, [r0] + mov r8, r0 + movs r0, 0x3 + negs r0, r0 + cmp r4, r0 + bne _08017C6C + ldr r0, =gUnknown_082F03A4 + ldrb r0, [r0, 0x14] + lsls r0, 28 + lsrs r0, 28 + cmp r7, r0 + bne _08017C6C + bl sub_800F7DC + adds r2, r0, 0 + ldrh r1, [r2, 0x8] + ldr r0, =0x000003ff + ands r0, r1 + cmp r0, 0 + beq _08017CA0 + ldr r0, =gSaveBlock2Ptr + ldr r3, [r0] + movs r0, 0x5 + str r0, [sp] + mov r0, r9 + adds r1, r7, 0 + bl sub_8017B3C + b _08017CA0 + .pool +_08017C4C: + mov r0, r12 + adds r1, r0, r4 + add r0, sp, 0x4 + bl sub_8018404 + mov r0, r8 + ldr r2, [r0] + adds r2, r4 + movs r0, 0x6 + str r0, [sp] + mov r0, r9 + adds r1, r7, 0 + add r3, sp, 0x4 + bl sub_8017B3C + b _08017CA0 +_08017C6C: + movs r5, 0 + movs r1, 0 + mov r2, r8 + ldr r2, [r2] + mov r12, r2 + adds r2, 0x8 + movs r3, 0 + adds r6, r4, 0x1 +_08017C7C: + ldrb r0, [r2, 0x12] + lsls r0, 30 + lsrs r0, 30 + adds r4, r3, 0 + cmp r0, 0x1 + bne _08017C92 + ldrh r0, [r2] + lsls r0, 22 + cmp r0, 0 + beq _08017C92 + adds r5, 0x1 +_08017C92: + cmp r5, r6 + beq _08017C4C + adds r2, 0x20 + adds r3, 0x20 + adds r1, 0x1 + cmp r1, 0x7 + ble _08017C7C +_08017CA0: + add sp, 0x10 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8017BE8 + + thumb_func_start sub_8017CB0 +sub_8017CB0: @ 8017CB0 + push {r4-r7,lr} + movs r4, 0 + movs r3, 0 + movs r7, 0x3 + ldr r6, =0x000003ff + adds r2, r0, 0 + adds r2, 0x8 + adds r5, r1, 0x1 +_08017CC0: + ldrb r1, [r2, 0x12] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0x1 + bne _08017CD6 + ldrh r1, [r2] + adds r0, r6, 0 + ands r0, r1 + cmp r0, 0 + beq _08017CD6 + adds r4, 0x1 +_08017CD6: + cmp r4, r5 + bne _08017CE4 + adds r0, r3, 0 + b _08017CF0 + .pool +_08017CE4: + adds r2, 0x20 + adds r3, 0x1 + cmp r3, 0x7 + ble _08017CC0 + movs r0, 0x1 + negs r0, r0 +_08017CF0: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8017CB0 + + thumb_func_start sub_8017CF8 +sub_8017CF8: @ 8017CF8 + lsls r0, 5 + adds r0, r1 + ldrb r0, [r0, 0xB] + lsls r0, 31 + lsrs r0, 31 + bx lr + thumb_func_end sub_8017CF8 + + thumb_func_start sub_8017D04 +sub_8017D04: @ 8017D04 + push {r4-r6,lr} + adds r5, r0, 0 + movs r0, 0xCE + lsls r0, 1 + cmp r1, r0 + bne _08017D44 + movs r4, 0 + b _08017D2E +_08017D14: + movs r0, 0x64 + muls r0, r4 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x41 + bl GetMonData + adds r1, r0, 0 + movs r0, 0xCE + lsls r0, 1 + cmp r1, r0 + beq _08017D74 + adds r4, 0x1 +_08017D2E: + ldr r0, =gPlayerPartyCount + ldrb r0, [r0] + cmp r4, r0 + blt _08017D14 + movs r0, 0x2 + b _08017D90 + .pool +_08017D44: + movs r4, 0 + ldr r0, =gPlayerPartyCount + ldrb r0, [r0] + cmp r4, r0 + bge _08017D8E + ldr r6, =gBaseStats +_08017D50: + movs r0, 0x64 + muls r0, r4 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x41 + bl GetMonData + adds r1, r0, 0 + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 2 + adds r1, r0, r6 + ldrb r0, [r1, 0x6] + cmp r0, r5 + beq _08017D74 + ldrb r0, [r1, 0x7] + cmp r0, r5 + bne _08017D84 +_08017D74: + movs r0, 0 + b _08017D90 + .pool +_08017D84: + adds r4, 0x1 + ldr r0, =gPlayerPartyCount + ldrb r0, [r0] + cmp r4, r0 + blt _08017D50 +_08017D8E: + movs r0, 0x1 +_08017D90: + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8017D04 + + thumb_func_start sub_8017D9C +sub_8017D9C: @ 8017D9C + push {lr} + adds r3, r0, 0 + cmp r1, 0x44 + beq _08017DD8 + cmp r1, 0x44 + bgt _08017DAE + cmp r1, 0x41 + beq _08017DB8 + b _08017DF6 +_08017DAE: + cmp r1, 0x45 + beq _08017DC8 + cmp r1, 0x48 + beq _08017DE8 + b _08017DF6 +_08017DB8: + ldr r0, =gUnknown_082EEA68 + lsls r1, r2, 2 + adds r1, r0 + ldr r1, [r1] + b _08017DDA + .pool +_08017DC8: + ldr r0, =gUnknown_082EED3C + lsls r1, r2, 2 + adds r1, r0 + ldr r1, [r1] + b _08017DDA + .pool +_08017DD8: + ldr r1, =gUnknown_082EF7B0 +_08017DDA: + adds r0, r3, 0 + bl StringExpandPlaceholders + b _08017DF6 + .pool +_08017DE8: + ldr r0, =gUnknown_082EEB08 + lsls r1, r2, 2 + adds r1, r0 + ldr r1, [r1] + adds r0, r3, 0 + bl StringExpandPlaceholders +_08017DF6: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8017D9C + + thumb_func_start sub_8017E00 +sub_8017E00: @ 8017E00 + push {r4-r6,lr} + adds r5, r0, 0 + lsls r1, 24 + lsrs r4, r1, 24 + adds r6, r4, 0 + bl GetMultiplayerId + lsls r0, 24 + lsrs r3, r0, 24 + ldr r2, =gLinkPlayers + movs r0, 0x1 + adds r1, r3, 0 + eors r1, r0 + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 2 + adds r0, r2 + ldrb r0, [r0, 0x13] + cmp r4, 0x44 + beq _08017E54 + cmp r4, 0x44 + bgt _08017E38 + cmp r4, 0x41 + beq _08017E3E + b _08017E94 + .pool +_08017E38: + cmp r6, 0x45 + beq _08017E78 + b _08017E94 +_08017E3E: + ldr r2, =gUnknown_082EE984 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 3 + adds r1, r0 + b _08017E66 + .pool +_08017E54: + ldr r2, =gUnknown_082EE984 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 3 + adds r1, r0 + adds r2, 0x8 +_08017E66: + adds r1, r2 + ldr r1, [r1] + adds r0, r5, 0 + bl StringCopy + b _08017E94 + .pool +_08017E78: + ldr r2, =gUnknown_082EE984 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 3 + adds r1, r0 + adds r2, 0x4 + adds r1, r2 + ldr r1, [r1] + adds r0, r5, 0 + bl StringCopy +_08017E94: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8017E00 + + thumb_func_start sub_8017EA0 +sub_8017EA0: @ 8017EA0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r7, r0, 0 + adds r5, r2, 0 + adds r6, r3, 0 + movs r2, 0 + mov r8, r2 + ldrh r0, [r5] + subs r0, 0x40 + cmp r0, 0x8 + bls _08017EBA + b _08017FC6 +_08017EBA: + lsls r0, 2 + ldr r1, =_08017EC8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08017EC8: + .4byte _08017FBC + .4byte _08017EEC + .4byte _08017FC6 + .4byte _08017FC6 + .4byte _08017EFC + .4byte _08017EF4 + .4byte _08017FC6 + .4byte _08017FC6 + .4byte _08017FAC +_08017EEC: + ldr r1, =gUnknown_082EE3DC + b _08017FAE + .pool +_08017EF4: + ldr r1, =gUnknown_082EE430 + b _08017FAE + .pool +_08017EFC: + adds r0, r6, 0 + adds r0, 0x58 + ldr r4, =gUnknown_02022C40 + ldrh r1, [r4, 0xC] + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + adds r0, r6, 0 + adds r0, 0x68 + ldrh r2, [r4, 0xA] + movs r1, 0xB + muls r1, r2 + ldr r2, =gSpeciesNames + adds r1, r2 + bl StringCopy + movs r4, 0 + b _08017F2E + .pool +_08017F2C: + adds r4, 0x1 +_08017F2E: + cmp r4, 0x3 + bgt _08017F64 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + lsls r1, r4, 5 + adds r0, r1 + ldrh r0, [r0, 0x18] + cmp r0, 0x2 + bne _08017F2C + ldrh r1, [r5, 0x4] + adds r0, r6, 0 + adds r0, 0x78 + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldrh r1, [r5, 0x2] + movs r0, 0xB + muls r1, r0 + ldr r0, =gSpeciesNames + adds r1, r0 + adds r0, r6, 0 + adds r0, 0x88 + bl StringCopy + ldrh r5, [r5, 0x2] + mov r8, r5 +_08017F64: + movs r0, 0xCE + lsls r0, 1 + cmp r8, r0 + bne _08017F84 + ldr r1, =gUnknown_082EE4F0 + adds r0, r7, 0 + bl StringCopy + b _08017FB4 + .pool +_08017F84: + movs r4, 0 + adds r5, r6, 0 + adds r5, 0x58 +_08017F8A: + lsls r0, r4, 24 + lsrs r0, 24 + adds r1, r5, 0 + bl sub_81AFC0C + adds r5, 0x10 + adds r4, 0x1 + cmp r4, 0x3 + ble _08017F8A + ldr r1, =gUnknown_082EE47C + adds r0, r7, 0 + bl sub_81AFC28 + b _08017FB4 + .pool +_08017FAC: + ldr r1, =gUnknown_082EE380 +_08017FAE: + adds r0, r7, 0 + bl StringExpandPlaceholders +_08017FB4: + movs r2, 0x1 + b _08017FC6 + .pool +_08017FBC: + ldr r1, =gUnknown_082EE544 + adds r0, r7, 0 + bl StringExpandPlaceholders + movs r2, 0x2 +_08017FC6: + adds r0, r2, 0 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8017EA0 + + thumb_func_start sub_8017FD8 +sub_8017FD8: @ 8017FD8 + push {lr} + adds r2, r0, 0 + ldr r0, =gUnknown_03003090 + ldrh r1, [r0, 0x2] + cmp r1, 0 + beq _08017FFC + cmp r1, 0x51 + beq _08017FEC + cmp r1, 0x52 + bne _08017FFC +_08017FEC: + adds r0, r2, 0 + adds r0, 0x98 + strh r1, [r0] + movs r0, 0x1 + b _08017FFE + .pool +_08017FFC: + movs r0, 0 +_08017FFE: + pop {r1} + bx r1 + thumb_func_end sub_8017FD8 + + thumb_func_start InUnionRoom +InUnionRoom: @ 8018004 + push {lr} + movs r2, 0 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x4] + ldr r0, =0x00003c19 + cmp r1, r0 + bne _08018016 + movs r2, 0x1 +_08018016: + adds r0, r2, 0 + pop {r1} + bx r1 + .pool + thumb_func_end InUnionRoom + + thumb_func_start sub_8018024 +sub_8018024: @ 8018024 + push {r4-r6,lr} + movs r6, 0 + movs r5, 0 + ldr r0, =gPlayerPartyCount + ldrb r0, [r0] + cmp r6, r0 + bge _08018064 +_08018032: + movs r0, 0x64 + adds r1, r5, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0x38 + bl GetMonData + cmp r0, 0x1E + bhi _0801805A + adds r0, r4, 0 + movs r1, 0x41 + bl GetMonData + movs r1, 0xCE + lsls r1, 1 + cmp r0, r1 + beq _0801805A + adds r6, 0x1 +_0801805A: + adds r5, 0x1 + ldr r0, =gPlayerPartyCount + ldrb r0, [r0] + cmp r5, r0 + blt _08018032 +_08018064: + cmp r6, 0x1 + bgt _08018074 + movs r0, 0 + b _08018076 + .pool +_08018074: + movs r0, 0x1 +_08018076: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8018024 + + thumb_func_start sub_801807C +sub_801807C: @ 801807C + movs r1, 0 + strh r1, [r0] + strh r1, [r0, 0x2] + str r1, [r0, 0x4] + strh r1, [r0, 0xA] + strh r1, [r0, 0xC] + strh r1, [r0, 0xE] + strh r1, [r0, 0x10] + str r1, [r0, 0x14] + bx lr + thumb_func_end sub_801807C + + thumb_func_start sub_8018090 +sub_8018090: @ 8018090 + push {lr} + ldr r0, =gUnknown_02022C40 + bl sub_801807C + pop {r0} + bx r0 + .pool + thumb_func_end sub_8018090 + + thumb_func_start sub_80180A0 +sub_80180A0: @ 80180A0 + push {r4,r5,lr} + adds r5, r1, 0 + movs r1, 0x64 + adds r4, r0, 0 + muls r4, r1 + ldr r0, =gPlayerParty + adds r4, r0 + adds r0, r4, 0 + movs r1, 0x41 + bl GetMonData + strh r0, [r5, 0xA] + adds r0, r4, 0 + movs r1, 0x38 + bl GetMonData + strh r0, [r5, 0xC] + adds r0, r4, 0 + movs r1, 0 + bl GetMonData + str r0, [r5, 0x4] + ldrh r1, [r5, 0xA] + movs r0, 0xCE + lsls r0, 1 + cmp r1, r0 + beq _080180E0 + movs r0, 0 + b _080180E2 + .pool +_080180E0: + movs r0, 0x1 +_080180E2: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_80180A0 + + thumb_func_start sub_80180E8 +sub_80180E8: @ 80180E8 + push {r4,r5,lr} + adds r5, r1, 0 + movs r1, 0x64 + adds r4, r0, 0 + muls r4, r1 + ldr r0, =gPlayerParty + adds r4, r0 + adds r0, r4, 0 + movs r1, 0x41 + bl GetMonData + strh r0, [r5, 0xE] + adds r0, r4, 0 + movs r1, 0x38 + bl GetMonData + strh r0, [r5, 0x10] + adds r0, r4, 0 + movs r1, 0 + bl GetMonData + str r0, [r5, 0x14] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80180E8 + + thumb_func_start sub_8018120 +sub_8018120: @ 8018120 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r1, 24 + movs r2, 0 + mov r8, r2 + cmp r1, 0 + bne _0801813E + ldrh r7, [r0, 0xA] + ldr r6, [r0, 0x4] + b _08018142 +_08018136: + lsls r0, r5, 16 + lsrs r0, 16 + mov r8, r0 + b _08018176 +_0801813E: + ldrh r7, [r0, 0xE] + ldr r6, [r0, 0x14] +_08018142: + movs r5, 0 + b _0801816E +_08018146: + movs r0, 0x64 + adds r1, r5, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0 + bl GetMonData + cmp r0, r6 + bne _0801816C + adds r0, r4, 0 + movs r1, 0x41 + bl GetMonData + lsls r0, 16 + lsrs r0, 16 + cmp r0, r7 + beq _08018136 +_0801816C: + adds r5, 0x1 +_0801816E: + ldr r0, =gPlayerPartyCount + ldrb r0, [r0] + cmp r5, r0 + blt _08018146 +_08018176: + mov r0, r8 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8018120 + + thumb_func_start sub_801818C +sub_801818C: @ 801818C + push {r4,lr} + adds r4, r0, 0 + bl sub_80173B0 + bl ScriptContext2_Disable + bl sub_8098524 + ldr r1, =gUnknown_02022C2C + movs r0, 0 + strb r0, [r1] + cmp r4, 0 + beq _080181BC + ldr r2, =gUnknown_02022C40 + ldrh r0, [r2, 0x2] + ldrh r1, [r2, 0xA] + ldrh r2, [r2, 0xC] + bl sub_8010FCC + movs r0, 0x40 + movs r1, 0 + movs r2, 0 + bl sub_8011090 +_080181BC: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801818C + + thumb_func_start sub_80181CC +sub_80181CC: @ 80181CC + push {lr} + bl ScriptContext2_Enable + bl ScriptFreezeMapObjects + pop {r0} + bx r0 + thumb_func_end sub_80181CC + + thumb_func_start sub_80181DC +sub_80181DC: @ 80181DC + push {r4,lr} + movs r3, 0x80 + movs r2, 0 + ldr r4, [r0, 0xC] +_080181E4: + lsls r0, r2, 3 + subs r0, r2 + lsls r0, 2 + adds r1, r4, r0 + ldrb r0, [r1, 0x18] + lsls r0, 31 + cmp r0, 0 + beq _0801820C + ldrb r0, [r1, 0xB] + lsls r0, 31 + lsrs r0, 31 + lsls r0, 3 + orrs r3, r0 + ldrb r1, [r1, 0x2] + movs r0, 0x7 + ands r0, r1 + orrs r3, r0 + lsls r0, r3, 24 + lsrs r3, r0, 24 + b _08018216 +_0801820C: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _080181E4 +_08018216: + adds r0, r3, 0 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_80181DC + + thumb_func_start sub_8018220 +sub_8018220: @ 8018220 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + mov r9, r1 + lsls r2, 24 + lsrs r2, 24 + str r2, [sp] + bl GetMultiplayerId + movs r1, 0x1 + eors r0, r1 + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r1, r0 + ldr r0, =gUnknown_02039B58 + adds r1, r0 + mov r8, r1 + bl sub_81AFBF0 + mov r6, r9 + adds r6, 0xC0 + bl sub_8068BB0 + lsls r0, 16 + lsrs r0, 16 + movs r1, 0xD + muls r1, r0 + ldr r0, =gTrainerClassNames + adds r1, r0 + adds r0, r6, 0 + bl StringCopy + movs r0, 0 + adds r1, r6, 0 + bl sub_81AFC0C + mov r1, r8 + adds r1, 0x30 + movs r0, 0x1 + bl sub_81AFC0C + movs r4, 0xBA + lsls r4, 1 + add r4, r9 + ldr r1, =gUnknown_082EFF50 + mov r2, r8 + ldrb r0, [r2, 0x1] + lsls r0, 2 + adds r0, r1 + ldr r1, [r0] + adds r0, r4, 0 + bl StringCopy + movs r0, 0x2 + adds r1, r4, 0 + bl sub_81AFC0C + mov r5, r9 + adds r5, 0xDE + mov r0, r8 + ldrh r1, [r0, 0xC] + adds r0, r5, 0 + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + movs r0, 0x3 + adds r1, r5, 0 + bl sub_81AFC0C + movs r2, 0xED + add r2, r9 + mov r10, r2 + mov r0, r8 + ldrh r1, [r0, 0x10] + mov r0, r10 + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + mov r4, r9 + adds r4, 0xFC + mov r2, r8 + ldrh r1, [r2, 0x12] + adds r0, r4, 0 + movs r2, 0x2 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + movs r0, 0x4 + mov r1, r10 + bl sub_81AFC0C + movs r0, 0x5 + adds r1, r4, 0 + bl sub_81AFC0C + movs r4, 0xD2 + lsls r4, 1 + add r4, r9 + ldr r1, =gUnknown_082EFF64 + adds r0, r4, 0 + bl sub_81AFC28 + ldr r0, =gStringVar4 + adds r1, r4, 0 + bl StringCopy + mov r0, r8 + ldrh r1, [r0, 0x14] + ldr r4, =0x0000270f + cmp r1, r4 + ble _0801830C + adds r1, r4, 0 +_0801830C: + adds r0, r6, 0 + movs r2, 0 + movs r3, 0x4 + bl ConvertIntToDecimalStringN + movs r0, 0 + adds r1, r6, 0 + bl sub_81AFC0C + mov r2, r8 + ldrh r1, [r2, 0x16] + cmp r1, r4 + ble _08018328 + adds r1, r4, 0 +_08018328: + mov r4, r9 + adds r4, 0xCF + adds r0, r4, 0 + movs r2, 0 + movs r3, 0x4 + bl ConvertIntToDecimalStringN + movs r0, 0x2 + adds r1, r4, 0 + bl sub_81AFC0C + mov r0, r8 + ldrh r1, [r0, 0x20] + adds r0, r5, 0 + movs r2, 0 + movs r3, 0x5 + bl ConvertIntToDecimalStringN + movs r0, 0x3 + adds r1, r5, 0 + bl sub_81AFC0C + movs r7, 0 + movs r6, 0x80 + lsls r6, 19 + mov r5, r8 + adds r5, 0x28 + mov r4, r10 +_08018360: + ldrh r1, [r5] + adds r0, r4, 0 + bl CopyEasyChatWord + lsrs r0, r6, 24 + adds r1, r4, 0 + bl sub_81AFC0C + movs r2, 0x80 + lsls r2, 17 + adds r6, r2 + adds r5, 0x2 + adds r4, 0xF + adds r7, 0x1 + cmp r7, 0x3 + ble _08018360 + movs r4, 0xD2 + lsls r4, 1 + add r4, r9 + ldr r1, =gUnknown_082EFFA4 + adds r0, r4, 0 + bl sub_81AFC28 + ldr r5, =gStringVar4 + adds r0, r5, 0 + adds r1, r4, 0 + bl StringAppend + ldr r0, [sp] + cmp r0, 0x1 + bne _080183D0 + ldr r1, =gUnknown_082F0020 + adds r0, r4, 0 + bl sub_81AFC28 + adds r0, r5, 0 + adds r1, r4, 0 + bl StringAppend + b _080183F0 + .pool +_080183D0: + ldr r2, [sp] + cmp r2, 0 + bne _080183F0 + ldr r0, =gUnknown_082F0018 + mov r2, r8 + ldrb r1, [r2] + lsls r1, 2 + adds r1, r0 + ldr r1, [r1] + adds r0, r4, 0 + bl sub_81AFC28 + adds r0, r5, 0 + adds r1, r4, 0 + bl StringAppend +_080183F0: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8018220 + + thumb_func_start sub_8018404 +sub_8018404: @ 8018404 + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r1, 0 + adds r1, 0x10 + bl StringCopy7 + ldrb r1, [r4] + lsls r1, 28 + lsrs r1, 28 + adds r0, r5, 0 + bl ConvertInternationalString + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8018404 + + thumb_func_start sub_8018424 +sub_8018424: @ 8018424 + push {lr} + bl ProcessSpriteCopyRequests + bl LoadOam + bl TransferPlttBuffer + pop {r0} + bx r0 + thumb_func_end sub_8018424 + + thumb_func_start sub_8018438 +sub_8018438: @ 8018438 + push {lr} + bl RunTasks + bl RunTextPrinters + bl AnimateSprites + bl BuildOamBuffer + pop {r0} + bx r0 + thumb_func_end sub_8018438 + + thumb_func_start sub_8018450 +sub_8018450: @ 8018450 + push {r4-r7,lr} + sub sp, 0xC + adds r7, r0, 0 + ldr r0, =gMain + movs r1, 0x87 + lsls r1, 3 + adds r6, r0, r1 + ldrb r0, [r6] + cmp r0, 0x1 + bne _08018466 + b _08018574 +_08018466: + cmp r0, 0x1 + bgt _08018474 + cmp r0, 0 + beq _08018482 + b _08018644 + .pool +_08018474: + cmp r0, 0x2 + bne _0801847A + b _080185F8 +_0801847A: + cmp r0, 0x3 + bne _08018480 + b _08018618 +_08018480: + b _08018644 +_08018482: + movs r0, 0 + bl SetVBlankCallback + bl ResetPaletteFade + bl ResetSpriteData + bl FreeAllSpritePalettes + bl ResetTasks + bl remove_some_task + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_082F0598 + movs r0, 0 + movs r2, 0x4 + bl InitBgsFromTemplates + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r4, 0x80 + lsls r4, 4 + adds r0, r4, 0 + bl Alloc + adds r1, r0, 0 + movs r0, 0x3 + bl SetBgTilemapBuffer + adds r0, r4, 0 + bl Alloc + adds r1, r0, 0 + movs r0, 0x2 + bl SetBgTilemapBuffer + adds r0, r4, 0 + bl Alloc + adds r1, r0, 0 + movs r0, 0x1 + bl SetBgTilemapBuffer + adds r0, r4, 0 + bl Alloc + adds r1, r0, 0 + movs r0, 0 + bl SetBgTilemapBuffer + movs r0, 0x3 + bl bgid_upload_textbox_1 + ldr r0, =gUnknown_082F05A8 + bl InitWindows + bl DeactivateAllTextPrinters + movs r1, 0xC0 + lsls r1, 7 + movs r0, 0 + bl ClearGpuRegBits + movs r0, 0x50 + movs r1, 0 + bl SetGpuReg + movs r0, 0x52 + movs r1, 0 + bl SetGpuReg + movs r0, 0x54 + movs r1, 0 + bl SetGpuReg + b _08018610 + .pool +_08018574: + ldr r0, =gUnkTextboxBorderPal + movs r1, 0 + movs r2, 0x20 + bl LoadPalette + movs r0, 0x2 + bl stdpal_get + movs r1, 0xD0 + movs r2, 0x20 + bl LoadPalette + movs r0, 0xC0 + bl sub_81978B0 + movs r0, 0 + movs r1, 0xA + movs r2, 0xE0 + bl sub_809882C + movs r0, 0 + movs r1, 0x1 + movs r2, 0xF0 + bl box_border_load_tiles_and_pal + movs r4, 0x20 + str r4, [sp] + str r4, [sp, 0x4] + movs r5, 0x11 + str r5, [sp, 0x8] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect + str r4, [sp] + str r4, [sp, 0x4] + str r5, [sp, 0x8] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect + str r4, [sp] + str r4, [sp, 0x4] + str r5, [sp, 0x8] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect + movs r0, 0x3 + bl sub_8018798 + lsls r0, r7, 24 + lsrs r0, 24 + movs r1, 0 + bl sub_80186EC + b _08018610 + .pool +_080185F8: + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0 + bl CopyBgTilemapBufferToVram +_08018610: + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] + b _08018644 +_08018618: + movs r0, 0 + bl ShowBg + movs r0, 0x3 + bl ShowBg + ldr r0, =0x0000021d + bl PlayBGM + ldr r0, =sub_8018424 + bl SetVBlankCallback + movs r0, 0xC5 + bl EnableInterrupts + movs r0, 0x1 + b _08018646 + .pool +_08018644: + movs r0, 0 +_08018646: + add sp, 0xC + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8018450 + + thumb_func_start c2_mystery_gift +c2_mystery_gift: @ 8018650 + push {lr} + movs r0, 0 + bl sub_8018450 + cmp r0, 0 + beq _0801866C + ldr r0, =sub_8018438 + bl SetMainCallback2 + ldr r1, =gUnknown_02022C60 + movs r0, 0 + strb r0, [r1] + bl task_add_00_mystery_gift +_0801866C: + bl RunTasks + pop {r0} + bx r0 + .pool + thumb_func_end c2_mystery_gift + + thumb_func_start sub_801867C +sub_801867C: @ 801867C + push {lr} + movs r0, 0x1 + bl sub_8018450 + cmp r0, 0 + beq _08018698 + ldr r0, =sub_8018438 + bl SetMainCallback2 + ldr r1, =gUnknown_02022C60 + movs r0, 0x1 + strb r0, [r1] + bl sub_81D5014 +_08018698: + pop {r0} + bx r0 + .pool + thumb_func_end sub_801867C + + thumb_func_start sub_80186A4 +sub_80186A4: @ 80186A4 + push {lr} + ldr r1, =gUnknown_02022C60 + movs r0, 0 + strb r0, [r1] + bl FreeAllWindowBuffers + movs r0, 0 + bl GetBgTilemapBuffer + bl Free + movs r0, 0x1 + bl GetBgTilemapBuffer + bl Free + movs r0, 0x2 + bl GetBgTilemapBuffer + bl Free + movs r0, 0x3 + bl GetBgTilemapBuffer + bl Free + ldr r0, =c2_title_screen_1 + bl SetMainCallback2 + pop {r0} + bx r0 + .pool + thumb_func_end sub_80186A4 + + thumb_func_start sub_80186EC +sub_80186EC: @ 80186EC + push {r4-r7,lr} + sub sp, 0x14 + adds r4, r0, 0 + adds r5, r1, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0 + movs r1, 0 + bl FillWindowPixelBuffer + cmp r4, 0 + bne _0801871C + ldr r0, =gText_MysteryGift + ldr r7, =gText_PickOKCancel + cmp r5, 0 + bne _08018720 + ldr r7, =gText_PickOKExit + b _08018720 + .pool +_0801871C: + ldr r0, =gJPText_MysteryGift + ldr r7, =gJPText_DecideStop +_08018720: + movs r4, 0 + str r4, [sp] + str r4, [sp, 0x4] + ldr r6, =gUnknown_082F0720 + str r6, [sp, 0x8] + movs r5, 0x1 + negs r5, r5 + str r5, [sp, 0xC] + str r0, [sp, 0x10] + movs r0, 0 + movs r1, 0x1 + movs r2, 0x4 + movs r3, 0x1 + bl AddTextPrinterParametrized2 + movs r0, 0 + adds r1, r7, 0 + movs r2, 0xDE + bl GetStringRightAlignXOffset + adds r2, r0, 0 + lsls r2, 24 + lsrs r2, 24 + str r4, [sp] + str r4, [sp, 0x4] + str r6, [sp, 0x8] + str r5, [sp, 0xC] + str r7, [sp, 0x10] + movs r0, 0 + movs r1, 0 + movs r3, 0x1 + bl AddTextPrinterParametrized2 + movs r0, 0 + movs r1, 0x2 + bl CopyWindowToVram + movs r0, 0 + bl PutWindowTilemap + add sp, 0x14 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80186EC + + thumb_func_start sub_8018784 +sub_8018784: @ 8018784 + push {lr} + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x1 + movs r2, 0xF + bl sub_8098858 + pop {r0} + bx r0 + thumb_func_end sub_8018784 + + thumb_func_start sub_8018798 +sub_8018798: @ 8018798 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0xC + adds r4, r0, 0 + movs r0, 0 + mov r9, r0 + lsls r4, 24 + lsrs r0, r4, 24 + movs r1, 0x20 + str r1, [sp] + movs r1, 0x2 + str r1, [sp, 0x4] + movs r1, 0x11 + str r1, [sp, 0x8] + movs r1, 0x3 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect + mov r8, r4 + movs r4, 0x1 +_080187C8: + movs r7, 0 + mov r0, r9 + adds r0, 0x2 + movs r1, 0x1 + add r1, r9 + mov r10, r1 + lsls r5, r0, 24 + movs r6, 0 +_080187D8: + mov r1, r9 + ands r1, r4 + adds r0, r7, 0 + ands r0, r4 + cmp r1, r0 + beq _080187FC + lsrs r2, r6, 24 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + mov r1, r8 + lsrs r0, r1, 24 + movs r1, 0x1 + lsrs r3, r5, 24 + bl FillBgTilemapBufferRect + b _08018812 +_080187FC: + lsrs r2, r6, 24 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + mov r1, r8 + lsrs r0, r1, 24 + movs r1, 0x2 + lsrs r3, r5, 24 + bl FillBgTilemapBufferRect +_08018812: + movs r0, 0x80 + lsls r0, 17 + adds r6, r0 + adds r7, 0x1 + cmp r7, 0x1F + ble _080187D8 + mov r9, r10 + mov r1, r9 + cmp r1, 0x11 + ble _080187C8 + 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 sub_8018798 + + thumb_func_start sub_8018838 +sub_8018838: @ 8018838 + push {lr} + sub sp, 0xC + cmp r0, 0 + beq _08018846 + cmp r0, 0x1 + beq _0801885E + b _08018876 +_08018846: + 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 + b _08018876 +_0801885E: + movs r0, 0x20 + str r0, [sp] + movs r0, 0x1E + str r0, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0x2 + bl FillBgTilemapBufferRect +_08018876: + movs r0, 0 + bl CopyBgTilemapBufferToVram + add sp, 0xC + pop {r0} + bx r0 + thumb_func_end sub_8018838 + + thumb_func_start sub_8018884 +sub_8018884: @ 8018884 + push {r4,lr} + sub sp, 0x14 + adds r1, r0, 0 + ldr r4, =gStringVar4 + adds r0, r4, 0 + bl StringExpandPlaceholders + movs r0, 0x1 + movs r1, 0x11 + bl FillWindowPixelBuffer + movs r1, 0 + str r1, [sp] + str r1, [sp, 0x4] + ldr r0, =gUnknown_082F0728 + str r0, [sp, 0x8] + str r1, [sp, 0xC] + str r4, [sp, 0x10] + movs r0, 0x1 + movs r1, 0x1 + movs r2, 0 + movs r3, 0x1 + bl AddTextPrinterParametrized2 + movs r0, 0x1 + movs r1, 0x1 + movs r2, 0xF + bl sub_8098858 + movs r0, 0x1 + bl PutWindowTilemap + movs r0, 0x1 + movs r1, 0x3 + bl CopyWindowToVram + add sp, 0x14 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8018884 + + thumb_func_start sub_80188DC +sub_80188DC: @ 80188DC + push {lr} + movs r0, 0x1 + bl rbox_fill_rectangle + movs r0, 0x1 + bl ClearWindowTilemap + movs r0, 0x1 + movs r1, 0x1 + bl CopyWindowToVram + pop {r0} + bx r0 + thumb_func_end sub_80188DC + + thumb_func_start mevent_0814257C +mevent_0814257C: @ 80188F8 + push {r4,lr} + sub sp, 0xC + adds r4, r0, 0 + adds r0, r1, 0 + ldrb r2, [r4] + cmp r2, 0x1 + beq _08018920 + cmp r2, 0x1 + bgt _08018910 + cmp r2, 0 + beq _0801891A + b _08018980 +_08018910: + cmp r2, 0x2 + beq _08018954 + cmp r2, 0xFF + beq _0801897C + b _08018980 +_0801891A: + bl sub_8018884 + b _08018944 +_08018920: + movs r0, 0 + str r0, [sp] + ldr r0, =gUnknown_02022C58 + str r0, [sp, 0x4] + adds r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0xD0 + movs r2, 0x14 + movs r3, 0x1 + bl DrawDownArrow + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _08018980 +_08018944: + ldrb r0, [r4] + adds r0, 0x1 + b _0801897E + .pool +_08018954: + movs r0, 0x1 + str r0, [sp] + ldr r0, =gUnknown_02022C58 + str r0, [sp, 0x4] + adds r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0xD0 + movs r2, 0x14 + movs r3, 0x1 + bl DrawDownArrow + movs r0, 0 + strb r0, [r4] + bl sub_80188DC + movs r0, 0x1 + b _08018982 + .pool +_0801897C: + movs r0, 0x2 +_0801897E: + strb r0, [r4] +_08018980: + movs r0, 0 +_08018982: + add sp, 0xC + pop {r4} + pop {r1} + bx r1 + thumb_func_end mevent_0814257C + + thumb_func_start sub_801898C +sub_801898C: @ 801898C + push {lr} + sub sp, 0xC + movs r0, 0 + str r0, [sp] + ldr r0, =gUnknown_02022C58 + str r0, [sp, 0x4] + adds r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0xD0 + movs r2, 0x14 + movs r3, 0x1 + bl DrawDownArrow + add sp, 0xC + pop {r0} + bx r0 + .pool + thumb_func_end sub_801898C + + thumb_func_start sub_80189B4 +sub_80189B4: @ 80189B4 + push {lr} + sub sp, 0xC + movs r0, 0x1 + str r0, [sp] + ldr r0, =gUnknown_02022C58 + str r0, [sp, 0x4] + adds r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0xD0 + movs r2, 0x14 + movs r3, 0x1 + bl DrawDownArrow + add sp, 0xC + pop {r0} + bx r0 + .pool + thumb_func_end sub_80189B4 + + thumb_func_start sub_80189DC +sub_80189DC: @ 80189DC + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _080189EC + cmp r0, 0x1 + beq _08018A08 + b _08018A14 +_080189EC: + bl sub_801898C + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _08018A14 + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _08018A14 + .pool +_08018A08: + bl sub_80189B4 + movs r0, 0 + strb r0, [r4] + movs r0, 0x1 + b _08018A16 +_08018A14: + movs r0, 0 +_08018A16: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_80189DC + + thumb_func_start sub_8018A1C +sub_8018A1C: @ 8018A1C + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + bne _08018A2C + adds r0, r1, 0 + bl sub_8018884 +_08018A2C: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x78 + bhi _08018A3E + movs r0, 0 + b _08018A48 +_08018A3E: + movs r0, 0 + strb r0, [r4] + bl sub_80188DC + movs r0, 0x1 +_08018A48: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8018A1C + + thumb_func_start sub_8018A50 +sub_8018A50: @ 8018A50 + push {r4,r5,lr} + sub sp, 0x24 + lsls r2, 24 + add r1, sp, 0x4 + ldr r0, =gUnknown_082F0638 + ldm r0!, {r3-r5} + stm r1!, {r3-r5} + ldm r0!, {r3-r5} + stm r1!, {r3-r5} + ldr r0, =gUnknown_082F05E0 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x1C] + str r1, [sp, 0x20] + cmp r2, 0 + bne _08018A80 + ldr r0, =gUnknown_082F0608 + b _08018A82 + .pool +_08018A80: + ldr r0, =gUnknown_082F0620 +_08018A82: + str r0, [sp, 0x4] + add r0, sp, 0x4 + bl sub_81DB41C + adds r3, r0, 0 + movs r0, 0x1 + ands r0, r3 + cmp r0, 0 + beq _08018A96 + adds r3, 0x1 +_08018A96: + lsls r1, r3, 24 + ldr r0, =0x00ffffff + ldr r2, [sp, 0x1C] + ands r2, r0 + orrs r2, r1 + str r2, [sp, 0x1C] + cmp r3, 0x1D + bgt _08018ACC + movs r0, 0x1E + subs r0, r3 + lsrs r1, r0, 31 + adds r0, r1 + asrs r0, 1 + lsls r0, 24 + lsrs r0, 16 + ldr r1, =0xffff00ff + ands r1, r2 + orrs r1, r0 + str r1, [sp, 0x1C] + b _08018AD2 + .pool +_08018ACC: + ldr r0, =0xffff00ff + ands r2, r0 + str r2, [sp, 0x1C] +_08018AD2: + add r0, sp, 0x1C + movs r1, 0xE0 + str r1, [sp] + add r1, sp, 0x4 + movs r2, 0x1 + movs r3, 0xA + bl DoMysteryGiftListMenu + adds r4, r0, 0 + movs r0, 0x1 + negs r0, r0 + cmp r4, r0 + beq _08018AFA + movs r0, 0x2 + bl ClearWindowTilemap + movs r0, 0x2 + movs r1, 0x1 + bl CopyWindowToVram +_08018AFA: + adds r0, r4, 0 + add sp, 0x24 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8018A50 + + thumb_func_start sub_8018B08 +sub_8018B08: @ 8018B08 + push {r4-r6,lr} + sub sp, 0x1C + adds r5, r0, 0 + adds r4, r1, 0 + adds r1, r3, 0 + lsls r2, 24 + lsrs r6, r2, 24 + ldrb r0, [r5] + cmp r0, 0x1 + beq _08018B98 + cmp r0, 0x1 + bgt _08018B26 + cmp r0, 0 + beq _08018B30 + b _08018C3E +_08018B26: + cmp r0, 0x2 + beq _08018BE4 + cmp r0, 0xFF + beq _08018C1A + b _08018C3E +_08018B30: + ldr r0, =gStringVar4 + bl StringExpandPlaceholders + cmp r6, 0 + bne _08018B48 + ldr r0, =gUnknown_082F05C8 + b _08018B4A + .pool +_08018B48: + ldr r0, =gUnknown_082F05D0 +_08018B4A: + bl AddWindow + strh r0, [r4] + ldrb r0, [r4] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldrb r0, [r4] + movs r2, 0 + str r2, [sp] + str r2, [sp, 0x4] + ldr r1, =gUnknown_082F0728 + str r1, [sp, 0x8] + str r2, [sp, 0xC] + ldr r1, =gStringVar4 + str r1, [sp, 0x10] + movs r1, 0x1 + movs r3, 0x1 + bl AddTextPrinterParametrized2 + ldrb r0, [r4] + movs r1, 0x1 + movs r2, 0xF + bl sub_8098858 + ldrb r0, [r4] + movs r1, 0x2 + bl CopyWindowToVram + ldrb r0, [r4] + bl PutWindowTilemap + b _08018BD6 + .pool +_08018B98: + ldr r0, =gUnknown_082F05E8 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x14] + str r1, [sp, 0x18] + cmp r6, 0 + bne _08018BBC + ldr r0, =0xff00ffff + ldr r1, [sp, 0x14] + ands r1, r0 + movs r0, 0x90 + lsls r0, 12 + b _08018BC6 + .pool +_08018BBC: + ldr r0, =0xff00ffff + ldr r1, [sp, 0x14] + ands r1, r0 + movs r0, 0xF0 + lsls r0, 12 +_08018BC6: + orrs r1, r0 + str r1, [sp, 0x14] + add r0, sp, 0x14 + movs r1, 0xA + movs r2, 0xE + movs r3, 0 + bl CreateYesNoMenu +_08018BD6: + ldrb r0, [r5] + adds r0, 0x1 + strb r0, [r5] + b _08018C3E + .pool +_08018BE4: + bl sub_8198C58 + lsls r0, 24 + asrs r6, r0, 24 + movs r1, 0x80 + lsls r1, 17 + adds r0, r1 + lsrs r0, 24 + cmp r0, 0x2 + bhi _08018C3E + movs r0, 0 + strb r0, [r5] + ldrb r0, [r4] + bl rbox_fill_rectangle + ldrb r0, [r4] + bl ClearWindowTilemap + ldrb r0, [r4] + movs r1, 0x1 + bl CopyWindowToVram + ldrb r0, [r4] + bl RemoveWindow + adds r0, r6, 0 + b _08018C42 +_08018C1A: + movs r0, 0 + strb r0, [r5] + ldrb r0, [r4] + bl rbox_fill_rectangle + ldrb r0, [r4] + bl ClearWindowTilemap + ldrb r0, [r4] + movs r1, 0x1 + bl CopyWindowToVram + ldrb r0, [r4] + bl RemoveWindow + movs r0, 0x1 + negs r0, r0 + b _08018C42 +_08018C3E: + movs r0, 0x2 + negs r0, r0 +_08018C42: + add sp, 0x1C + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8018B08 + + thumb_func_start sub_8018C4C +sub_8018C4C: @ 8018C4C + push {r4-r6,lr} + sub sp, 0x14 + adds r6, r0, 0 + adds r5, r1, 0 + ldrb r0, [r6] + cmp r0, 0x1 + beq _08018CE8 + cmp r0, 0x1 + bgt _08018C64 + cmp r0, 0 + beq _08018C6C + b _08018D8C +_08018C64: + cmp r0, 0xFF + bne _08018C6A + b _08018D68 +_08018C6A: + b _08018D8C +_08018C6C: + cmp r2, 0 + bne _08018C84 + ldr r0, =gStringVar4 + ldr r1, =gText_WhatToDoWithCards + bl StringExpandPlaceholders + b _08018C8C + .pool +_08018C84: + ldr r0, =gStringVar4 + ldr r1, =gText_WhatToDoWithNews + bl StringExpandPlaceholders +_08018C8C: + ldr r0, =gUnknown_082F05D8 + bl AddWindow + strh r0, [r5] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldrb r0, [r5] + movs r2, 0 + str r2, [sp] + str r2, [sp, 0x4] + ldr r1, =gUnknown_082F0728 + str r1, [sp, 0x8] + str r2, [sp, 0xC] + ldr r1, =gStringVar4 + str r1, [sp, 0x10] + movs r1, 0x1 + movs r3, 0x1 + bl AddTextPrinterParametrized2 + ldrb r0, [r5] + movs r1, 0x1 + movs r2, 0xF + bl sub_8098858 + ldrb r0, [r5] + movs r1, 0x2 + bl CopyWindowToVram + ldrb r0, [r5] + bl PutWindowTilemap + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] + b _08018D8C + .pool +_08018CE8: + cmp r3, 0 + beq _08018D10 + cmp r2, 0 + bne _08018D00 + ldr r0, =gUnknown_082F05F8 + ldr r1, =gUnknown_082F06C8 + b _08018D28 + .pool +_08018D00: + ldr r0, =gUnknown_082F0600 + ldr r1, =gUnknown_082F06F8 + b _08018D28 + .pool +_08018D10: + cmp r2, 0 + bne _08018D24 + ldr r0, =gUnknown_082F05F0 + ldr r1, =gUnknown_082F06B0 + b _08018D28 + .pool +_08018D24: + ldr r0, =gUnknown_082F05F8 + ldr r1, =gUnknown_082F06E0 +_08018D28: + movs r2, 0xE0 + str r2, [sp] + movs r2, 0x1 + movs r3, 0xA + bl DoMysteryGiftListMenu + adds r4, r0, 0 + movs r0, 0x1 + negs r0, r0 + cmp r4, r0 + beq _08018D8C + movs r0, 0 + strb r0, [r6] + ldrb r0, [r5] + bl rbox_fill_rectangle + ldrb r0, [r5] + bl ClearWindowTilemap + ldrb r0, [r5] + movs r1, 0x1 + bl CopyWindowToVram + ldrb r0, [r5] + bl RemoveWindow + adds r0, r4, 0 + b _08018D90 + .pool +_08018D68: + movs r0, 0 + strb r0, [r6] + ldrb r0, [r5] + bl rbox_fill_rectangle + ldrb r0, [r5] + bl ClearWindowTilemap + ldrb r0, [r5] + movs r1, 0x1 + bl CopyWindowToVram + ldrb r0, [r5] + bl RemoveWindow + movs r0, 0x2 + negs r0, r0 + b _08018D90 +_08018D8C: + movs r0, 0x1 + negs r0, r0 +_08018D90: + add sp, 0x14 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8018C4C + + thumb_func_start sub_8018D98 +sub_8018D98: @ 8018D98 + push {lr} + cmp r0, 0 + beq _08018DA4 + bl sub_801B0CC + b _08018DA8 +_08018DA4: + bl sub_801B27C +_08018DA8: + pop {r1} + bx r1 + thumb_func_end sub_8018D98 + + thumb_func_start sub_8018DAC +sub_8018DAC: @ 8018DAC + push {r4,r5,lr} + adds r5, r0, 0 + ldrb r0, [r5] + cmp r0, 0 + beq _08018DBC + cmp r0, 0x1 + beq _08018DE4 + b _08018E00 +_08018DBC: + cmp r1, 0 + bne _08018DD4 + bl sav1_get_mevent_buffer_1 + adds r4, r0, 0 + bl sav1_get_mevent_buffer_2 + adds r1, r0, 0 + adds r0, r4, 0 + bl sub_801BAAC + b _08018DDC +_08018DD4: + bl sub_801B00C + bl sub_801C6C8 +_08018DDC: + ldrb r0, [r5] + adds r0, 0x1 + strb r0, [r5] + b _08018E00 +_08018DE4: + cmp r1, 0 + bne _08018DF2 + bl sub_801BB74 +_08018DEC: + cmp r0, 0 + bne _08018DF8 + b _08018E00 +_08018DF2: + bl sub_801C758 + b _08018DEC +_08018DF8: + movs r0, 0 + strb r0, [r5] + movs r0, 0x1 + b _08018E02 +_08018E00: + movs r0, 0 +_08018E02: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8018DAC + + thumb_func_start sub_8018E08 +sub_8018E08: @ 8018E08 + push {lr} + cmp r0, 0 + bne _08018E14 + bl sub_801B1E8 + b _08018E18 +_08018E14: + bl sub_801B06C +_08018E18: + movs r0, 0x1 + pop {r1} + bx r1 + thumb_func_end sub_8018E08 + + thumb_func_start sub_8018E20 +sub_8018E20: @ 8018E20 + push {lr} + cmp r0, 0 + bne _08018E36 + adds r0, r1, 0 + bl sub_801BDA4 + cmp r0, 0 + beq _08018E40 + bl sub_801BB48 + b _08018E48 +_08018E36: + adds r0, r1, 0 + bl sub_801CA50 + cmp r0, 0 + bne _08018E44 +_08018E40: + movs r0, 0 + b _08018E4A +_08018E44: + bl sub_801C72C +_08018E48: + movs r0, 0x1 +_08018E4A: + pop {r1} + bx r1 + thumb_func_end sub_8018E20 + + thumb_func_start sub_8018E50 +sub_8018E50: @ 8018E50 + push {lr} + cmp r2, 0 + beq _08018E60 + ldr r3, =gText_OkayToDiscardNews + b _08018E62 + .pool +_08018E60: + ldr r3, =gText_IfThrowAwayCardEventWontHappen +_08018E62: + movs r2, 0x1 + bl sub_8018B08 + lsls r0, 24 + asrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8018E50 + + thumb_func_start mevent_message_was_thrown_away +mevent_message_was_thrown_away: @ 8018E74 + push {lr} + cmp r1, 0 + beq _08018E84 + ldr r1, =gText_WonderNewsThrownAway + b _08018E86 + .pool +_08018E84: + ldr r1, =gText_WonderCardThrownAway +_08018E86: + bl mevent_0814257C + pop {r1} + bx r1 + .pool + thumb_func_end mevent_message_was_thrown_away + + thumb_func_start mevent_save_game +mevent_save_game: @ 8018E94 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0x4 + bhi _08018F04 + lsls r0, 2 + ldr r1, =_08018EAC + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08018EAC: + .4byte _08018EC0 + .4byte _08018ECC + .4byte _08018ED4 + .4byte _08018EE0 + .4byte _08018EF8 +_08018EC0: + ldr r0, =gText_DataWillBeSaved + bl sub_8018884 + b _08018EEC + .pool +_08018ECC: + movs r0, 0 + bl TrySavingData + b _08018EEC +_08018ED4: + ldr r0, =gText_SaveCompletedPressA + bl sub_8018884 + b _08018EEC + .pool +_08018EE0: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _08018F04 +_08018EEC: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _08018F04 + .pool +_08018EF8: + movs r0, 0 + strb r0, [r4] + bl sub_80188DC + movs r0, 0x1 + b _08018F06 +_08018F04: + movs r0, 0 +_08018F06: + pop {r4} + pop {r1} + bx r1 + thumb_func_end mevent_save_game + + thumb_func_start mevent_message +mevent_message: @ 8018F0C + push {r4-r6,lr} + adds r4, r0, 0 + lsls r1, 24 + lsrs r6, r1, 24 + lsls r2, 24 + lsrs r5, r2, 24 + movs r2, 0 + str r2, [r4] + cmp r3, 0xE + bls _08018F22 + b _08019034 +_08018F22: + lsls r0, r3, 2 + ldr r1, =_08018F30 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08018F30: + .4byte _08018F6C + .4byte _08018F78 + .4byte _08018F84 + .4byte _08018F9C + .4byte _08018FB4 + .4byte _08018FC0 + .4byte _08018FCC + .4byte _08018FD8 + .4byte _08018FE4 + .4byte _08018FF0 + .4byte _08018FFC + .4byte _08019014 + .4byte _08019020 + .4byte _0801902C + .4byte _08019030 +_08018F6C: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_NothingSentOver + b _08019034 + .pool +_08018F78: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_RecordUploadedViaWireless + b _08019034 + .pool +_08018F84: + movs r0, 0x1 + str r0, [r4] + ldr r2, =gText_WonderCardReceivedFrom + cmp r5, 0 + bne _08019034 + ldr r2, =gText_WonderCardReceived + b _08019034 + .pool +_08018F9C: + movs r0, 0x1 + str r0, [r4] + ldr r2, =gText_WonderNewsReceivedFrom + cmp r5, 0 + bne _08019034 + ldr r2, =gText_WonderNewsReceived + b _08019034 + .pool +_08018FB4: + movs r0, 0x1 + str r0, [r4] + ldr r2, =gText_NewStampReceived + b _08019034 + .pool +_08018FC0: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_AlreadyHadCard + b _08019034 + .pool +_08018FCC: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_AlreadyHadStamp + b _08019034 + .pool +_08018FD8: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_AlreadyHadNews + b _08019034 + .pool +_08018FE4: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_NoMoreRoomForStamps + b _08019034 + .pool +_08018FF0: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_CommunicationCanceled + b _08019034 + .pool +_08018FFC: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_CantAcceptNewsFromTrainer + cmp r6, 0 + bne _08019034 + ldr r2, =gText_CantAcceptCardFromTrainer + b _08019034 + .pool +_08019014: + movs r0, 0 + str r0, [r4] + ldr r2, =gText_CommunicationError + b _08019034 + .pool +_08019020: + movs r0, 0x1 + str r0, [r4] + ldr r2, =gText_NewTrainerReceived + b _08019034 + .pool +_0801902C: + movs r0, 0x1 + b _08019032 +_08019030: + movs r0, 0 +_08019032: + str r0, [r4] +_08019034: + adds r0, r2, 0 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end mevent_message + + thumb_func_start mevent_08142CE8 +mevent_08142CE8: @ 801903C + push {r4-r6,lr} + adds r6, r0, 0 + adds r0, r1, 0 + adds r5, r2, 0 + ldrb r4, [r6] + cmp r4, 0x1 + beq _0801906E + cmp r4, 0x1 + bgt _08019054 + cmp r4, 0 + beq _0801905A + b _0801909A +_08019054: + cmp r4, 0x2 + beq _08019084 + b _0801909A +_0801905A: + cmp r0, 0 + beq _08019062 + bl sub_8018884 +_08019062: + movs r0, 0xB9 + lsls r0, 1 + bl PlayFanfare + strh r4, [r5] + b _0801907C +_0801906E: + ldrh r0, [r5] + adds r0, 0x1 + strh r0, [r5] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0xF0 + bls _0801909A +_0801907C: + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] + b _0801909A +_08019084: + bl IsFanfareTaskInactive + lsls r0, 24 + cmp r0, 0 + beq _0801909A + movs r0, 0 + strb r0, [r6] + bl sub_80188DC + movs r0, 0x1 + b _0801909C +_0801909A: + movs r0, 0 +_0801909C: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end mevent_08142CE8 + + thumb_func_start mevent_message_stamp_card_etc_send_status +mevent_message_stamp_card_etc_send_status: @ 80190A4 + push {r4,lr} + adds r3, r0, 0 + ldr r1, =gText_CommunicationError + movs r0, 0 + str r0, [r3] + adds r4, r1, 0 + cmp r2, 0xE + bhi _08019166 + lsls r0, r2, 2 + ldr r1, =_080190C8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080190C8: + .4byte _08019104 + .4byte _0801910C + .4byte _08019114 + .4byte _0801911C + .4byte _08019128 + .4byte _08019130 + .4byte _08019138 + .4byte _08019140 + .4byte _08019148 + .4byte _08019150 + .4byte _08019164 + .4byte _08019158 + .4byte _0801915C + .4byte _0801915C + .4byte _08019164 +_08019104: + ldr r1, =gText_NothingSentOver + b _08019166 + .pool +_0801910C: + ldr r1, =gText_RecordUploadedViaWireless + b _08019166 + .pool +_08019114: + ldr r1, =gText_WonderCardSentTo + b _0801911E + .pool +_0801911C: + ldr r1, =gText_WonderNewsSentTo +_0801911E: + movs r0, 0x1 + str r0, [r3] + b _08019166 + .pool +_08019128: + ldr r1, =gText_StampSentTo + b _08019166 + .pool +_08019130: + ldr r1, =gText_OtherTrainerHasCard + b _08019166 + .pool +_08019138: + ldr r1, =gText_OtherTrainerHasStamp + b _08019166 + .pool +_08019140: + ldr r1, =gText_OtherTrainerHasNews + b _08019166 + .pool +_08019148: + ldr r1, =gText_NoMoreRoomForStamps + b _08019166 + .pool +_08019150: + ldr r1, =gText_OtherTrainerCanceled + b _08019166 + .pool +_08019158: + adds r1, r4, 0 + b _08019166 +_0801915C: + ldr r1, =gText_GiftSentTo + b _08019166 + .pool +_08019164: + ldr r1, =gText_CantSendGiftToTrainer +_08019166: + adds r0, r1, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end mevent_message_stamp_card_etc_send_status + + thumb_func_start sub_8019174 +sub_8019174: @ 8019174 + push {r4,r5,lr} + sub sp, 0x4 + adds r4, r0, 0 + adds r5, r1, 0 + adds r1, r2, 0 + adds r2, r3, 0 + lsls r1, 24 + lsrs r1, 24 + mov r0, sp + bl mevent_message_stamp_card_etc_send_status + adds r1, r0, 0 + ldr r0, [sp] + cmp r0, 0 + bne _0801919A + adds r0, r4, 0 + bl mevent_0814257C + b _080191A2 +_0801919A: + adds r0, r4, 0 + adds r2, r5, 0 + bl mevent_08142CE8 +_080191A2: + add sp, 0x4 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8019174 + + thumb_func_start task_add_00_mystery_gift +task_add_00_mystery_gift: @ 80191AC + push {r4,lr} + ldr r0, =task00_mystery_gift + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + lsls r4, r0, 2 + adds r4, r0 + lsls r4, 3 + ldr r0, =gTasks + 0x8 + adds r4, r0 + movs r0, 0 + strb r0, [r4, 0x8] + strb r0, [r4, 0x9] + strb r0, [r4, 0xA] + strb r0, [r4, 0xB] + strb r0, [r4, 0xC] + strb r0, [r4, 0xD] + movs r1, 0 + strh r0, [r4] + strh r0, [r4, 0x2] + strh r0, [r4, 0x4] + strh r0, [r4, 0x6] + strb r1, [r4, 0xE] + movs r0, 0x40 + bl AllocZeroed + str r0, [r4, 0x10] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end task_add_00_mystery_gift + + thumb_func_start task00_mystery_gift +task00_mystery_gift: @ 80191F4 + push {r4,r5,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r5, r0, r1 + ldrb r0, [r5, 0x8] + cmp r0, 0x25 + bls _0801920E + b _08019922 +_0801920E: + lsls r0, 2 + ldr r1, =_08019220 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08019220: + .4byte _080192B8 + .4byte _080192BE + .4byte _08019300 + .4byte _08019338 + .4byte _0801935C + .4byte _080193AC + .4byte _0801940C + .4byte _08019444 + .4byte _08019454 + .4byte _080194CC + .4byte _080194F0 + .4byte _08019508 + .4byte _08019538 + .4byte _08019574 + .4byte _0801958C + .4byte _080195BC + .4byte _080198EC + .4byte _0801961A + .4byte _0801962A + .4byte _08019922 + .4byte _0801963C + .4byte _08019688 + .4byte _080196FE + .4byte _0801972E + .4byte _08019764 + .4byte _0801977E + .4byte _08019792 + .4byte _0801979E + .4byte _080197B2 + .4byte _080197C6 + .4byte _080197F8 + .4byte _0801982C + .4byte _08019870 + .4byte _08019884 + .4byte _080198A0 + .4byte _080198B8 + .4byte _080198EC + .4byte _0801990C +_080192B8: + movs r0, 0x1 + strb r0, [r5, 0x8] + b _08019922 +_080192BE: + adds r0, r5, 0 + adds r0, 0x9 + adds r1, r5, 0 + movs r2, 0 + bl sub_8018A50 + adds r1, r0, 0 + cmp r1, 0x1 + beq _080192E8 + cmp r1, 0x1 + bcc _080192DE + movs r0, 0x2 + negs r0, r0 + cmp r1, r0 + beq _080192FA + b _08019922 +_080192DE: + movs r0, 0 + strb r0, [r5, 0xC] + bl sub_801B27C + b _080192EE +_080192E8: + strb r1, [r5, 0xC] + bl sub_801B0CC +_080192EE: + cmp r0, 0x1 + bne _080192F4 + b _08019820 +_080192F4: + movs r0, 0x2 + strb r0, [r5, 0x8] + b _08019922 +_080192FA: + movs r0, 0x25 + strb r0, [r5, 0x8] + b _08019922 +_08019300: + ldrb r0, [r5, 0xC] + cmp r0, 0 + bne _08019314 + adds r0, r5, 0 + adds r0, 0x9 + ldr r1, =gText_DontHaveCardNewOneInput + b _0801931A + .pool +_08019314: + adds r0, r5, 0 + adds r0, 0x9 + ldr r1, =gText_DontHaveNewsNewOneInput +_0801931A: + bl mevent_0814257C + cmp r0, 0 + bne _08019324 + b _08019922 +_08019324: + movs r0, 0x3 + strb r0, [r5, 0x8] + movs r0, 0 + movs r1, 0x1 + bl sub_80186EC + b _08019922 + .pool +_08019338: + ldrb r0, [r5, 0xC] + cmp r0, 0 + bne _0801934C + ldr r0, =gText_WhereShouldCardBeAccessed + bl sub_8018884 + b _08019352 + .pool +_0801934C: + ldr r0, =gText_WhereShouldNewsBeAccessed + bl sub_8018884 +_08019352: + movs r0, 0x4 + strb r0, [r5, 0x8] + b _08019922 + .pool +_0801935C: + adds r0, r5, 0 + adds r0, 0x9 + adds r1, r5, 0 + movs r2, 0x1 + bl sub_8018A50 + adds r4, r0, 0 + cmp r4, 0x1 + beq _0801938A + cmp r4, 0x1 + bcc _0801937C + movs r0, 0x2 + negs r0, r0 + cmp r4, r0 + beq _08019396 + b _08019922 +_0801937C: + bl sub_80188DC + movs r1, 0 + movs r0, 0x5 + strb r0, [r5, 0x8] + strb r1, [r5, 0xD] + b _08019922 +_0801938A: + bl sub_80188DC + movs r0, 0x5 + strb r0, [r5, 0x8] + strb r4, [r5, 0xD] + b _08019922 +_08019396: + bl sub_80188DC + ldrb r0, [r5, 0xC] + bl sub_8018D98 + cmp r0, 0 + beq _080193A6 + b _08019820 +_080193A6: + strb r0, [r5, 0x8] + movs r0, 0 + b _080198FE +_080193AC: + ldr r0, =gStringVar1 + movs r1, 0xFF + strb r1, [r0] + ldr r0, =gStringVar2 + strb r1, [r0] + ldr r0, =gStringVar3 + strb r1, [r0] + ldrb r0, [r5, 0xC] + cmp r0, 0 + beq _080193D4 + cmp r0, 0x1 + beq _080193EE + b _08019406 + .pool +_080193D4: + ldrb r0, [r5, 0xD] + cmp r0, 0x1 + bne _080193E2 + movs r0, 0x15 + bl sub_8014EFC + b _08019406 +_080193E2: + cmp r0, 0 + bne _08019406 + movs r0, 0x15 + bl sub_80152A8 + b _08019406 +_080193EE: + ldrb r0, [r5, 0xD] + cmp r0, 0x1 + bne _080193FC + movs r0, 0x16 + bl sub_8014EFC + b _08019406 +_080193FC: + cmp r0, 0 + bne _08019406 + movs r0, 0x16 + bl sub_80152A8 +_08019406: + movs r0, 0x6 + strb r0, [r5, 0x8] + b _08019922 +_0801940C: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _0801942C + movs r0, 0x1 + bl sub_8018838 + movs r0, 0x7 + strb r0, [r5, 0x8] + ldrb r0, [r5, 0xC] + bl sub_801D484 + b _08019922 + .pool +_0801942C: + ldr r0, =gScriptResult + ldrh r0, [r0] + cmp r0, 0x5 + beq _08019436 + b _08019922 +_08019436: + movs r0, 0x1 + bl sub_8018838 + b _080197C0 + .pool +_08019444: + ldr r0, =gText_Communicating + bl sub_8018884 + movs r0, 0x8 + strb r0, [r5, 0x8] + b _08019922 + .pool +_08019454: + adds r0, r5, 0 + bl sub_801D4A8 + subs r0, 0x2 + cmp r0, 0x4 + bls _08019462 + b _08019922 +_08019462: + lsls r0, 2 + ldr r1, =_08019470 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08019470: + .4byte _080194AE + .4byte _080194A8 + .4byte _080194B4 + .4byte _08019492 + .4byte _08019484 +_08019484: + bl task_add_05_task_del_08FA224_when_no_RfuFunc + ldrh r0, [r5] + strb r0, [r5, 0xE] + movs r0, 0xD + strb r0, [r5, 0x8] + b _08019922 +_08019492: + ldr r4, [r5, 0x10] + bl sub_801D4F4 + adds r1, r0, 0 + adds r0, r4, 0 + movs r2, 0x40 + bl memcpy + bl sub_801D4E4 + b _08019922 +_080194A8: + movs r0, 0xA + strb r0, [r5, 0x8] + b _08019922 +_080194AE: + movs r0, 0x9 + strb r0, [r5, 0x8] + b _08019922 +_080194B4: + movs r0, 0xB + strb r0, [r5, 0x8] + ldr r0, =gStringVar1 + ldr r1, =gLinkPlayers + 8 + bl StringCopy + b _08019922 + .pool +_080194CC: + adds r4, r5, 0 + adds r4, 0x9 + bl sub_801D4F4 + adds r3, r0, 0 + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0 + bl sub_8018B08 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0x1 + beq _08019564 + cmp r1, 0x1 + bcs _08019552 + movs r0, 0 + b _08019566 +_080194F0: + adds r4, r5, 0 + adds r4, 0x9 + bl sub_801D4F4 + adds r1, r0, 0 + adds r0, r4, 0 + bl mevent_0814257C + cmp r0, 0 + bne _08019506 + b _08019922 +_08019506: + b _0801956A +_08019508: + adds r0, r5, 0 + adds r0, 0x9 + ldr r3, =gText_ThrowAwayWonderCard + adds r1, r5, 0 + movs r2, 0 + bl sub_8018B08 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0x1 + beq _08019564 + cmp r1, 0x1 + bcs _08019552 + bl sub_801B3F8 + cmp r0, 0x1 + bne _08019534 + movs r0, 0xC + strb r0, [r5, 0x8] + b _08019922 + .pool +_08019534: + movs r0, 0 + b _08019566 +_08019538: + adds r0, r5, 0 + adds r0, 0x9 + ldr r3, =gText_HaventReceivedCardsGift + adds r1, r5, 0 + movs r2, 0 + bl sub_8018B08 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0x1 + beq _08019564 + cmp r1, 0x1 + bcc _08019560 +_08019552: + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _08019564 + b _08019922 + .pool +_08019560: + movs r0, 0 + b _08019566 +_08019564: + movs r0, 0x1 +_08019566: + bl sub_801D500 +_0801956A: + bl sub_801D4E4 + movs r0, 0x7 + strb r0, [r5, 0x8] + b _08019922 +_08019574: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _0801957E + b _08019922 +_0801957E: + bl sub_800E084 + movs r0, 0xE + strb r0, [r5, 0x8] + b _08019922 + .pool +_0801958C: + adds r0, r5, 0 + adds r0, 0x9 + ldr r1, =gText_CommunicationCompleted + bl sub_8018A1C + cmp r0, 0 + bne _0801959C + b _08019922 +_0801959C: + ldrb r0, [r5, 0xD] + cmp r0, 0x1 + bne _080195AA + ldr r0, =gStringVar1 + ldr r1, =gLinkPlayers + 8 + bl StringCopy +_080195AA: + movs r0, 0xF + strb r0, [r5, 0x8] + b _08019922 + .pool +_080195BC: + ldrb r1, [r5, 0xC] + ldrb r2, [r5, 0xD] + ldrb r3, [r5, 0xE] + mov r0, sp + bl mevent_message + adds r1, r0, 0 + cmp r1, 0 + bne _080195D0 + ldr r1, [r5, 0x10] +_080195D0: + ldr r0, [sp] + cmp r0, 0 + beq _080195E2 + adds r0, r5, 0 + adds r0, 0x9 + adds r2, r5, 0 + bl mevent_08142CE8 + b _080195EA +_080195E2: + adds r0, r5, 0 + adds r0, 0x9 + bl mevent_0814257C +_080195EA: + adds r1, r0, 0 + cmp r1, 0 + bne _080195F2 + b _08019922 +_080195F2: + ldrb r0, [r5, 0xE] + cmp r0, 0x3 + bne _0801960C + ldrb r0, [r5, 0xD] + cmp r0, 0x1 + bne _08019606 + movs r0, 0x1 + bl sub_801DB68 + b _0801960C +_08019606: + movs r0, 0x2 + bl sub_801DB68 +_0801960C: + ldr r0, [sp] + cmp r0, 0 + beq _08019614 + b _080198DC +_08019614: + strb r0, [r5, 0x8] + movs r0, 0 + b _080198FE +_0801961A: + adds r0, r5, 0 + adds r0, 0x9 + bl mevent_save_game + cmp r0, 0 + bne _08019628 + b _08019922 +_08019628: + b _08019820 +_0801962A: + adds r0, r5, 0 + adds r0, 0x9 + ldrb r1, [r5, 0xC] + bl sub_8018DAC + cmp r0, 0 + bne _0801963A + b _08019922 +_0801963A: + b _080196F8 +_0801963C: + ldrb r0, [r5, 0xC] + cmp r0, 0 + bne _08019664 + ldr r2, =gMain + ldrh r1, [r2, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08019652 + movs r0, 0x15 + strb r0, [r5, 0x8] +_08019652: + ldrh r1, [r2, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + bne _0801965E + b _08019922 +_0801965E: + b _08019682 + .pool +_08019664: + ldr r0, =gMain + ldrh r0, [r0, 0x2E] + bl sub_801CCD0 + cmp r0, 0 + beq _0801967C + cmp r0, 0x1 + beq _08019682 + b _08019922 + .pool +_0801967C: + bl sub_801CC38 + b _0801975E +_08019682: + movs r0, 0x1B + strb r0, [r5, 0x8] + b _08019922 +_08019688: + ldrb r0, [r5, 0xC] + cmp r0, 0 + bne _080196A2 + bl sub_801B308 + cmp r0, 0 + beq _080196B6 + adds r0, r5, 0 + adds r0, 0x9 + ldrb r2, [r5, 0xC] + adds r1, r5, 0 + movs r3, 0 + b _080196C0 +_080196A2: + bl sub_801B128 + cmp r0, 0 + beq _080196B6 + adds r0, r5, 0 + adds r0, 0x9 + ldrb r2, [r5, 0xC] + adds r1, r5, 0 + movs r3, 0 + b _080196C0 +_080196B6: + adds r0, r5, 0 + adds r0, 0x9 + ldrb r2, [r5, 0xC] + adds r1, r5, 0 + movs r3, 0x1 +_080196C0: + bl sub_8018C4C + adds r1, r0, 0 + cmp r1, 0x1 + beq _080196E2 + cmp r1, 0x1 + bcc _080196DC + cmp r1, 0x2 + beq _080196E8 + movs r0, 0x2 + negs r0, r0 + cmp r1, r0 + beq _080196EE + b _08019922 +_080196DC: + movs r0, 0x1C + strb r0, [r5, 0x8] + b _08019922 +_080196E2: + movs r0, 0x1D + strb r0, [r5, 0x8] + b _08019922 +_080196E8: + movs r0, 0x16 + strb r0, [r5, 0x8] + b _08019922 +_080196EE: + ldrb r0, [r5, 0xC] + cmp r0, 0x1 + bne _080196F8 + bl sub_801CC80 +_080196F8: + movs r0, 0x14 + strb r0, [r5, 0x8] + b _08019922 +_080196FE: + adds r0, r5, 0 + adds r0, 0x9 + ldrb r2, [r5, 0xC] + adds r1, r5, 0 + bl sub_8018E50 + adds r1, r0, 0 + cmp r1, 0 + beq _0801971A + cmp r1, 0 + ble _08019748 + cmp r1, 0x1 + beq _0801975E + b _08019922 +_0801971A: + ldrb r0, [r5, 0xC] + cmp r0, 0 + bne _08019758 + bl sub_801B3F8 + cmp r0, 0x1 + bne _08019758 + movs r0, 0x17 + strb r0, [r5, 0x8] + b _08019922 +_0801972E: + adds r0, r5, 0 + adds r0, 0x9 + ldr r3, =gText_HaventReceivedGiftOkayToDiscard + adds r1, r5, 0 + movs r2, 0x1 + bl sub_8018B08 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0x1 + beq _0801975E + cmp r1, 0x1 + bcc _08019758 +_08019748: + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _0801975E + b _08019922 + .pool +_08019758: + movs r0, 0x18 + strb r0, [r5, 0x8] + b _08019922 +_0801975E: + movs r0, 0x15 + strb r0, [r5, 0x8] + b _08019922 +_08019764: + ldrb r0, [r5, 0xC] + movs r1, 0x1 + bl sub_8018E20 + cmp r0, 0 + bne _08019772 + b _08019922 +_08019772: + ldrb r0, [r5, 0xC] + bl sub_8018E08 + movs r0, 0x19 + strb r0, [r5, 0x8] + b _08019922 +_0801977E: + adds r0, r5, 0 + adds r0, 0x9 + bl mevent_save_game + cmp r0, 0 + bne _0801978C + b _08019922 +_0801978C: + movs r0, 0x1A + strb r0, [r5, 0x8] + b _08019922 +_08019792: + adds r0, r5, 0 + adds r0, 0x9 + ldrb r1, [r5, 0xC] + bl mevent_message_was_thrown_away + b _080198F6 +_0801979E: + ldrb r0, [r5, 0xC] + movs r1, 0 + bl sub_8018E20 + cmp r0, 0 + bne _080197AC + b _08019922 +_080197AC: + movs r0, 0 + strb r0, [r5, 0x8] + b _08019922 +_080197B2: + ldrb r0, [r5, 0xC] + movs r1, 0x1 + bl sub_8018E20 + cmp r0, 0 + bne _080197C0 + b _08019922 +_080197C0: + movs r0, 0x3 + strb r0, [r5, 0x8] + b _08019922 +_080197C6: + ldrb r0, [r5, 0xC] + movs r1, 0x1 + bl sub_8018E20 + cmp r0, 0 + bne _080197D4 + b _08019922 +_080197D4: + ldrb r0, [r5, 0xC] + cmp r0, 0 + beq _080197E0 + cmp r0, 0x1 + beq _080197E8 + b _080197EE +_080197E0: + movs r0, 0x15 + bl sub_8014A00 + b _080197EE +_080197E8: + movs r0, 0x16 + bl sub_8014A00 +_080197EE: + movs r0, 0x1 + strb r0, [r5, 0xD] + movs r0, 0x1E + strb r0, [r5, 0x8] + b _08019922 +_080197F8: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _08019810 + movs r0, 0x1 + bl sub_8018838 + movs r0, 0x1F + strb r0, [r5, 0x8] + b _08019922 + .pool +_08019810: + ldr r0, =gScriptResult + ldrh r0, [r0] + cmp r0, 0x5 + beq _0801981A + b _08019922 +_0801981A: + movs r0, 0x1 + bl sub_8018838 +_08019820: + movs r0, 0x12 + strb r0, [r5, 0x8] + b _08019922 + .pool +_0801982C: + ldr r0, =gStringVar1 + movs r1, 0xFF + strb r1, [r0] + ldr r0, =gStringVar2 + strb r1, [r0] + ldr r0, =gStringVar3 + strb r1, [r0] + ldrb r0, [r5, 0xC] + cmp r0, 0 + bne _0801985C + ldr r0, =gText_SendingWonderCard + bl sub_8018884 + bl mevent_srv_new_wcard + b _08019866 + .pool +_0801985C: + ldr r0, =gText_SendingWonderNews + bl sub_8018884 + bl mevent_srv_init_wnews +_08019866: + movs r0, 0x20 + strb r0, [r5, 0x8] + b _08019922 + .pool +_08019870: + adds r0, r5, 0 + bl sub_801D0C4 + cmp r0, 0x3 + bne _08019922 + ldrh r0, [r5] + strb r0, [r5, 0xE] + movs r0, 0x21 + strb r0, [r5, 0x8] + b _08019922 +_08019884: + bl task_add_05_task_del_08FA224_when_no_RfuFunc + ldr r0, =gStringVar1 + ldr r1, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name + bl StringCopy + movs r0, 0x22 + strb r0, [r5, 0x8] + b _08019922 + .pool +_080198A0: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _08019922 + bl sub_800E084 + movs r0, 0x23 + strb r0, [r5, 0x8] + b _08019922 + .pool +_080198B8: + adds r0, r5, 0 + adds r0, 0x9 + ldrb r2, [r5, 0xD] + ldrb r3, [r5, 0xE] + adds r1, r5, 0 + bl sub_8019174 + cmp r0, 0 + beq _08019922 + ldr r0, [r5, 0xC] + ldr r1, =0x00ffff00 + ands r0, r1 + ldr r1, =0x00030100 + cmp r0, r1 + bne _080198FA + movs r0, 0x3 + bl sub_801DB68 +_080198DC: + movs r0, 0x11 + strb r0, [r5, 0x8] + b _08019922 + .pool +_080198EC: + adds r0, r5, 0 + adds r0, 0x9 + ldr r1, =gText_CommunicationError + bl mevent_0814257C +_080198F6: + cmp r0, 0 + beq _08019922 +_080198FA: + movs r0, 0 + strb r0, [r5, 0x8] +_080198FE: + movs r1, 0 + bl sub_80186EC + b _08019922 + .pool +_0801990C: + bl sub_80097E8 + ldr r0, [r5, 0x10] + bl Free + adds r0, r4, 0 + bl DestroyTask + ldr r0, =sub_80186A4 + bl SetMainCallback2 +_08019922: + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end task00_mystery_gift + + thumb_func_start sub_8019930 +sub_8019930: @ 8019930 + ldr r0, =0x000001a9 + bx lr + .pool + thumb_func_end sub_8019930 + + thumb_func_start bgid_upload_textbox_1 +bgid_upload_textbox_1: @ 8019938 + push {lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnkTextboxBorderGfx + movs r2, 0x80 + lsls r2, 1 + movs r3, 0 + str r3, [sp] + bl copy_decompressed_tile_data_to_vram_autofree + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end bgid_upload_textbox_1 + + thumb_func_start is_walking_or_running +is_walking_or_running: @ 8019958 + push {lr} + ldr r0, =gPlayerAvatar + ldrb r0, [r0, 0x3] + cmp r0, 0x2 + beq _08019966 + cmp r0, 0 + bne _08019970 +_08019966: + movs r0, 0x1 + b _08019972 + .pool +_08019970: + movs r0, 0 +_08019972: + pop {r1} + bx r1 + thumb_func_end is_walking_or_running + + thumb_func_start sub_8019978 +sub_8019978: @ 8019978 + ldr r3, =gUnknown_082F072C + movs r2, 0x7 + ands r2, r1 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 1 + adds r2, r1 + adds r2, r3 + ldrb r0, [r2] + bx lr + .pool + thumb_func_end sub_8019978 + + thumb_func_start sub_8019990 +sub_8019990: @ 8019990 + push {r4-r6,lr} + mov r6, r8 + push {r6} + ldr r4, =gUnknown_082F0740 + mov r8, r4 + lsls r0, 2 + adds r4, r0, r4 + movs r6, 0 + ldrsh r5, [r4, r6] + ldr r6, =gUnknown_082F0760 + lsls r1, 1 + adds r4, r1, r6 + ldrb r4, [r4] + lsls r4, 24 + asrs r4, 24 + adds r5, r4 + adds r5, 0x7 + str r5, [r2] + movs r2, 0x2 + add r8, r2 + add r0, r8 + movs r4, 0 + ldrsh r0, [r0, r4] + adds r6, 0x1 + adds r1, r6 + ldrb r1, [r1] + lsls r1, 24 + asrs r1, 24 + adds r0, r1 + adds r0, 0x7 + str r0, [r3] + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8019990 + + thumb_func_start sub_80199E0 +sub_80199E0: @ 80199E0 + push {r4-r7,lr} + mov r12, r3 + ldr r7, =gUnknown_082F0740 + lsls r5, r0, 2 + adds r0, r5, r7 + movs r4, 0 + ldrsh r3, [r0, r4] + ldr r6, =gUnknown_082F0760 + lsls r4, r1, 1 + adds r0, r4, r6 + ldrb r0, [r0] + lsls r0, 24 + asrs r0, 24 + adds r3, r0 + adds r3, 0x7 + cmp r3, r2 + bne _08019A28 + adds r0, r7, 0x2 + adds r0, r5, r0 + movs r2, 0 + ldrsh r1, [r0, r2] + adds r0, r6, 0x1 + adds r0, r4, r0 + ldrb r0, [r0] + lsls r0, 24 + asrs r0, 24 + adds r1, r0 + adds r1, 0x7 + cmp r1, r12 + bne _08019A28 + movs r0, 0x1 + b _08019A2A + .pool +_08019A28: + movs r0, 0 +_08019A2A: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80199E0 + + thumb_func_start sub_8019A30 +sub_8019A30: @ 8019A30 + push {lr} + ldr r1, =0x000002bf + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8019A30 + + thumb_func_start flag_set_x63 +flag_set_x63: @ 8019A4C + push {lr} + ldr r1, =0x000002bf + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl FlagSet + pop {r0} + bx r0 + .pool + thumb_func_end flag_set_x63 + + thumb_func_start flag_clear_x63 +flag_clear_x63: @ 8019A64 + push {lr} + ldr r1, =0x000002bf + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl FlagClear + pop {r0} + bx r0 + .pool + thumb_func_end flag_clear_x63 + + thumb_func_start sub_8019A7C +sub_8019A7C: @ 8019A7C + push {lr} + ldr r2, =0x00004010 + adds r0, r2 + lsls r0, 16 + lsrs r0, 16 + lsls r1, 16 + lsrs r1, 16 + bl VarSet + pop {r0} + bx r0 + .pool + thumb_func_end sub_8019A7C + + thumb_func_start sub_8019A98 +sub_8019A98: @ 8019A98 + push {lr} + ldr r1, =gUnknown_082F0774 + adds r0, r1 + ldrb r0, [r0] + ldr r1, =gSaveBlock1Ptr + ldr r2, [r1] + ldrb r1, [r2, 0x5] + ldrb r2, [r2, 0x4] + bl show_sprite + pop {r0} + bx r0 + .pool + thumb_func_end sub_8019A98 + + thumb_func_start sub_8019AB8 +sub_8019AB8: @ 8019AB8 + push {lr} + ldr r1, =gUnknown_082F0774 + adds r0, r1 + ldrb r0, [r0] + ldr r1, =gSaveBlock1Ptr + ldr r2, [r1] + ldrb r1, [r2, 0x5] + ldrb r2, [r2, 0x4] + bl RemoveFieldObjectByLocalIdAndMap + pop {r0} + bx r0 + .pool + thumb_func_end sub_8019AB8 + + thumb_func_start sub_8019AD8 +sub_8019AD8: @ 8019AD8 + push {r4,r5,lr} + sub sp, 0x4 + adds r5, r1, 0 + ldr r1, =gUnknown_082F0774 + adds r0, r1 + ldrb r0, [r0] + ldr r1, =gSaveBlock1Ptr + ldr r2, [r1] + ldrb r1, [r2, 0x5] + ldrb r2, [r2, 0x4] + mov r3, sp + bl TryGetFieldObjectIdByLocalIdAndMap + lsls r0, 24 + cmp r0, 0 + bne _08019B30 + mov r0, sp + ldrb r1, [r0] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + ldr r1, =gMapObjects + adds r4, r0, r1 + adds r0, r4, 0 + bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive + lsls r0, 24 + cmp r0, 0 + bne _08019B30 + ldrb r1, [r5] + adds r0, r4, 0 + bl FieldObjectSetSpecialAnim + lsls r0, 24 + cmp r0, 0 + bne _08019B30 + movs r0, 0x1 + b _08019B32 + .pool +_08019B30: + movs r0, 0 +_08019B32: + add sp, 0x4 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8019AD8 + + thumb_func_start sub_8019B3C +sub_8019B3C: @ 8019B3C + push {r4,lr} + sub sp, 0x4 + ldr r1, =gUnknown_082F0774 + adds r0, r1 + ldrb r0, [r0] + ldr r1, =gSaveBlock1Ptr + ldr r2, [r1] + ldrb r1, [r2, 0x5] + ldrb r2, [r2, 0x4] + mov r3, sp + bl TryGetFieldObjectIdByLocalIdAndMap + lsls r0, 24 + cmp r0, 0 + bne _08019B9C + mov r0, sp + ldrb r1, [r0] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + ldr r1, =gMapObjects + adds r4, r0, r1 + adds r0, r4, 0 + bl FieldObjectClearAnimIfSpecialAnimFinished + lsls r0, 24 + cmp r0, 0 + bne _08019B84 + movs r0, 0 + b _08019B9E + .pool +_08019B84: + bl ScriptContext2_IsEnabled + lsls r0, 24 + cmp r0, 0 + bne _08019B96 + adds r0, r4, 0 + bl npc_sync_anim_pause_bits + b _08019B9C +_08019B96: + adds r0, r4, 0 + bl sub_8097404 +_08019B9C: + movs r0, 0x1 +_08019B9E: + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8019B3C + + thumb_func_start sub_8019BA8 +sub_8019BA8: @ 8019BA8 + push {lr} + ldr r2, =gUnknown_02022C68 + movs r1, 0 + str r1, [r2] + ldr r1, =gUnknown_02022C64 + str r0, [r1] + movs r1, 0 + movs r2, 0x7 +_08019BB8: + strb r1, [r0] + strb r1, [r0, 0x1] + strb r1, [r0, 0x2] + strb r1, [r0, 0x3] + adds r0, 0x4 + subs r2, 0x1 + cmp r2, 0 + bge _08019BB8 + bl sub_8019DF4 + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8019BA8 + + thumb_func_start sub_8019BDC +sub_8019BDC: @ 8019BDC + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r1, 0 + movs r0, 0 + ldrsb r0, [r5, r0] + cmp r0, 0 + beq _08019BF0 + cmp r0, 0x1 + beq _08019C10 + b _08019C2E +_08019BF0: + ldr r1, =gUnknown_082F078C + adds r0, r4, 0 + bl sub_8019AD8 + cmp r0, 0x1 + bne _08019C2E + adds r0, r4, 0 + bl flag_set_x63 + ldrb r0, [r5] + adds r0, 0x1 + strb r0, [r5] + b _08019C2E + .pool +_08019C10: + adds r0, r4, 0 + bl sub_8019B3C + cmp r0, 0 + beq _08019C2E + adds r0, r4, 0 + bl sub_8019AB8 + adds r0, r4, 0 + bl flag_set_x63 + movs r0, 0 + strb r0, [r5] + movs r0, 0x1 + b _08019C30 +_08019C2E: + movs r0, 0 +_08019C30: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8019BDC + + thumb_func_start sub_8019C38 +sub_8019C38: @ 8019C38 + push {r4-r7,lr} + sub sp, 0x4 + adds r6, r0, 0 + adds r5, r1, 0 + adds r7, r2, 0 + movs r0, 0 + ldrsb r0, [r6, r0] + cmp r0, 0x2 + beq _08019CD4 + cmp r0, 0x2 + bgt _08019C54 + cmp r0, 0 + beq _08019C5A + b _08019CE6 +_08019C54: + cmp r0, 0x3 + beq _08019CBC + b _08019CE6 +_08019C5A: + bl is_walking_or_running + cmp r0, 0 + beq _08019CE6 + mov r4, sp + adds r4, 0x2 + mov r0, sp + adds r1, r4, 0 + bl PlayerGetDestCoords + mov r0, sp + movs r1, 0 + ldrsh r2, [r0, r1] + movs r0, 0 + ldrsh r3, [r4, r0] + adds r0, r5, 0 + movs r1, 0 + bl sub_80199E0 + cmp r0, 0x1 + beq _08019CE6 + mov r0, sp + adds r1, r4, 0 + bl plaer_get_pos_including_state_based_drift + mov r0, sp + movs r1, 0 + ldrsh r2, [r0, r1] + movs r0, 0 + ldrsh r3, [r4, r0] + adds r0, r5, 0 + movs r1, 0 + bl sub_80199E0 + cmp r0, 0x1 + beq _08019CE6 + ldrb r1, [r7, 0x1] + adds r0, r5, 0 + bl sub_8019A7C + adds r0, r5, 0 + bl sub_8019A98 + adds r0, r5, 0 + bl flag_clear_x63 + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] +_08019CBC: + ldr r1, =gUnknown_082F078E + adds r0, r5, 0 + bl sub_8019AD8 + cmp r0, 0x1 + bne _08019CE6 + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] + b _08019CE6 + .pool +_08019CD4: + adds r0, r5, 0 + bl sub_8019B3C + cmp r0, 0 + beq _08019CE6 + movs r0, 0 + strb r0, [r6] + movs r0, 0x1 + b _08019CE8 +_08019CE6: + movs r0, 0 +_08019CE8: + add sp, 0x4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8019C38 + + thumb_func_start sub_8019CF0 +sub_8019CF0: @ 8019CF0 + push {r4,lr} + ldr r3, =gUnknown_02022C64 + lsls r0, 2 + ldr r4, [r3] + adds r4, r0 + movs r0, 0x1 + strb r0, [r4, 0x3] + adds r0, r1, 0 + adds r1, r2, 0 + bl sub_8019978 + strb r0, [r4, 0x1] + ldrb r0, [r4] + cmp r0, 0 + beq _08019D18 + movs r0, 0 + b _08019D1A + .pool +_08019D18: + movs r0, 0x1 +_08019D1A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8019CF0 + + thumb_func_start AGBAssert +AGBAssert: @ 8019D20 + push {lr} + ldr r1, =gUnknown_02022C64 + lsls r0, 2 + ldr r1, [r1] + adds r1, r0 + movs r0, 0x2 + strb r0, [r1, 0x3] + ldrb r0, [r1] + cmp r0, 0x1 + beq _08019D3C + movs r0, 0 + b _08019D3E + .pool +_08019D3C: + movs r0, 0x1 +_08019D3E: + pop {r1} + bx r1 + thumb_func_end AGBAssert + + thumb_func_start sub_8019D44 +sub_8019D44: @ 8019D44 + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r1, 0 + ldrb r1, [r4] + cmp r1, 0x1 + beq _08019DA6 + cmp r1, 0x1 + bgt _08019D5A + cmp r1, 0 + beq _08019D64 + b _08019DC6 +_08019D5A: + cmp r1, 0x2 + beq _08019D70 + cmp r1, 0x3 + beq _08019DB4 + b _08019DC6 +_08019D64: + ldrb r0, [r4, 0x3] + cmp r0, 0x1 + bne _08019DC6 + movs r0, 0x2 + strb r0, [r4] + strb r1, [r4, 0x2] +_08019D70: + adds r0, r5, 0 + movs r1, 0 + bl sub_8019F8C + adds r1, r0, 0 + cmp r1, 0 + bne _08019D96 + ldrb r0, [r4, 0x3] + cmp r0, 0x2 + bne _08019D96 + strb r1, [r4] + strb r1, [r4, 0x2] + adds r0, r5, 0 + bl sub_8019AB8 + adds r0, r5, 0 + bl flag_set_x63 + b _08019DC6 +_08019D96: + adds r0, r4, 0x2 + adds r1, r5, 0 + adds r2, r4, 0 + bl sub_8019C38 + cmp r0, 0x1 + bne _08019DC6 + b _08019DC4 +_08019DA6: + ldrb r0, [r4, 0x3] + cmp r0, 0x2 + bne _08019DC6 + movs r1, 0 + movs r0, 0x3 + strb r0, [r4] + strb r1, [r4, 0x2] +_08019DB4: + adds r0, r4, 0x2 + adds r1, r5, 0 + adds r2, r4, 0 + bl sub_8019BDC + cmp r0, 0x1 + bne _08019DC6 + movs r0, 0 +_08019DC4: + strb r0, [r4] +_08019DC6: + movs r0, 0 + strb r0, [r4, 0x3] + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8019D44 + + thumb_func_start sub_8019DD0 +sub_8019DD0: @ 8019DD0 + push {r4,r5,lr} + movs r4, 0 + ldr r5, =gUnknown_02022C64 +_08019DD6: + lsls r0, r4, 2 + ldr r1, [r5] + adds r1, r0 + adds r0, r4, 0 + bl sub_8019D44 + adds r4, 0x1 + cmp r4, 0x7 + ble _08019DD6 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8019DD0 + + thumb_func_start sub_8019DF4 +sub_8019DF4: @ 8019DF4 + push {r4,lr} + ldr r4, =sub_8019DD0 + adds r0, r4, 0 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08019E18 + adds r0, r4, 0 + movs r1, 0x5 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + b _08019E1A + .pool +_08019E18: + movs r0, 0x10 +_08019E1A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8019DF4 + + thumb_func_start sub_8019E20 +sub_8019E20: @ 8019E20 + push {lr} + ldr r0, =sub_8019DD0 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xF + bhi _08019E34 + bl DestroyTask +_08019E34: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8019E20 + + thumb_func_start sub_8019E3C +sub_8019E3C: @ 8019E3C + push {r4,lr} + movs r4, 0 +_08019E40: + adds r0, r4, 0 + bl sub_8019A30 + cmp r0, 0 + bne _08019E56 + adds r0, r4, 0 + bl sub_8019AB8 + adds r0, r4, 0 + bl flag_set_x63 +_08019E56: + adds r4, 0x1 + cmp r4, 0x7 + ble _08019E40 + ldr r1, =gUnknown_02022C64 + movs r0, 0 + str r0, [r1] + bl sub_8019E20 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8019E3C + + thumb_func_start sub_8019E70 +sub_8019E70: @ 8019E70 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x10 + str r0, [sp, 0x8] + mov r9, r1 + movs r7, 0 + mov r0, r9 + lsls r0, 2 + mov r8, r0 + ldr r0, =gUnknown_082F0740 + mov r2, r8 + adds r1, r2, r0 + ldrh r1, [r1] + mov r2, sp + strh r1, [r2, 0xC] + adds r0, 0x2 + add r0, r8 + ldrh r0, [r0] + mov r10, r0 + ldr r6, =gUnknown_082F0760 +_08019E9E: + mov r5, r8 + add r5, r9 + adds r5, r7 + adds r4, r5, 0 + subs r4, 0x38 + lsls r4, 24 + lsrs r4, 24 + movs r2, 0 + ldrsb r2, [r6, r2] + mov r0, sp + ldrh r0, [r0, 0xC] + adds r2, r0, r2 + lsls r2, 16 + asrs r2, 16 + movs r3, 0x1 + ldrsb r3, [r6, r3] + add r3, r10 + lsls r3, 16 + asrs r3, 16 + movs r0, 0x3 + str r0, [sp] + movs r0, 0x1 + str r0, [sp, 0x4] + movs r0, 0x41 + adds r1, r4, 0 + bl sprite_new + ldr r1, [sp, 0x8] + adds r5, r1, r5 + strb r0, [r5] + adds r0, r4, 0 + movs r1, 0x1 + bl sub_8097C44 + adds r6, 0x2 + adds r7, 0x1 + cmp r7, 0x4 + ble _08019E9E + 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_8019E70 + + thumb_func_start sub_8019F04 +sub_8019F04: @ 8019F04 + push {r4-r6,lr} + adds r5, r0, 0 + movs r4, 0 + ldr r6, =gSprites +_08019F0C: + adds r0, r5, r4 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r6 + bl DestroySprite + adds r4, 0x1 + cmp r4, 0x27 + ble _08019F0C + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8019F04 + + thumb_func_start sub_8019F2C +sub_8019F2C: @ 8019F2C + push {r4-r7,lr} + sub sp, 0x8 + movs r5, 0 + add r7, sp, 0x4 +_08019F34: + movs r4, 0 + adds r6, r5, 0x1 +_08019F38: + adds r0, r5, 0 + adds r1, r4, 0 + mov r2, sp + adds r3, r7, 0 + bl sub_8019990 + ldr r0, [sp] + ldr r1, [sp, 0x4] + movs r2, 0 + bl sub_8088B94 + adds r4, 0x1 + cmp r4, 0x4 + ble _08019F38 + adds r5, r6, 0 + cmp r5, 0x7 + ble _08019F34 + add sp, 0x8 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8019F2C + + thumb_func_start sub_8019F64 +sub_8019F64: @ 8019F64 + push {lr} + adds r1, r0, 0 + cmp r1, 0 + beq _08019F78 + ldr r0, =gUnknown_082F076F + adds r0, r1, r0 + ldrb r0, [r0] + b _08019F88 + .pool +_08019F78: + ldrb r1, [r2, 0xA] + movs r0, 0x7F + ands r0, r1 + cmp r0, 0x45 + beq _08019F86 + movs r0, 0x4 + b _08019F88 +_08019F86: + movs r0, 0x1 +_08019F88: + pop {r1} + bx r1 + thumb_func_end sub_8019F64 + + thumb_func_start sub_8019F8C +sub_8019F8C: @ 8019F8C + push {lr} + adds r2, r0, 0 + lsls r0, r2, 2 + adds r0, r2 + adds r0, r1 + subs r0, 0x38 + lsls r0, 24 + lsrs r0, 24 + bl sub_8097C8C + pop {r1} + bx r1 + thumb_func_end sub_8019F8C + + thumb_func_start sub_8019FA4 +sub_8019FA4: @ 8019FA4 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x8 + adds r5, r0, 0 + adds r6, r1, 0 + mov r9, r3 + lsls r2, 24 + lsrs r2, 24 + mov r8, r2 + lsls r0, r5, 2 + adds r0, r5 + adds r7, r0, r6 + adds r0, r5, 0 + bl sub_8019F8C + cmp r0, 0x1 + bne _08019FE2 + adds r4, r7, 0 + subs r4, 0x38 + lsls r4, 24 + lsrs r4, 24 + adds r0, r4, 0 + movs r1, 0 + bl sub_8097C44 + adds r0, r4, 0 + movs r1, 0x1 + bl sub_8097CC4 +_08019FE2: + adds r0, r7, 0 + subs r0, 0x38 + lsls r0, 24 + lsrs r0, 24 + mov r1, r8 + bl sub_8097BB4 + adds r0, r6, 0 + adds r1, r5, 0 + mov r2, r9 + bl sub_8019F64 + adds r2, r0, 0 + lsls r2, 24 + lsrs r2, 24 + adds r0, r6, 0 + adds r1, r5, 0 + bl sub_801A3B0 + add r3, sp, 0x4 + adds r0, r5, 0 + adds r1, r6, 0 + mov r2, sp + bl sub_8019990 + ldr r0, [sp] + ldr r1, [sp, 0x4] + movs r2, 0x1 + bl sub_8088B94 + add sp, 0x8 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8019FA4 + + thumb_func_start sub_801A02C +sub_801A02C: @ 801A02C + push {r4,r5,lr} + sub sp, 0x8 + adds r4, r0, 0 + adds r5, r1, 0 + lsls r0, r4, 2 + adds r0, r4 + adds r0, r5 + subs r0, 0x38 + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x2 + bl sub_8097CC4 + add r3, sp, 0x4 + adds r0, r4, 0 + adds r1, r5, 0 + mov r2, sp + bl sub_8019990 + ldr r0, [sp] + ldr r1, [sp, 0x4] + movs r2, 0 + bl sub_8088B94 + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801A02C + + thumb_func_start sub_801A064 +sub_801A064: @ 801A064 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + adds r7, r0, 0 + mov r8, r1 + mov r6, sp + adds r6, 0x2 + mov r0, sp + adds r1, r6, 0 + bl PlayerGetDestCoords + add r4, sp, 0x4 + mov r5, sp + adds r5, 0x6 + adds r0, r4, 0 + adds r1, r5, 0 + bl plaer_get_pos_including_state_based_drift + lsls r0, r7, 2 + adds r0, r7 + subs r0, 0x38 + lsls r0, 24 + lsrs r0, 24 + bl sub_8097C8C + mov r10, r6 + mov r9, r4 + adds r6, r5, 0 + cmp r0, 0x1 + bne _0801A0F0 + mov r0, sp + movs r1, 0 + ldrsh r2, [r0, r1] + mov r0, r10 + movs r1, 0 + ldrsh r3, [r0, r1] + adds r0, r7, 0 + movs r1, 0 + bl sub_80199E0 + cmp r0, 0x1 + beq _0801A15C + movs r0, 0 + ldrsh r2, [r4, r0] + movs r1, 0 + ldrsh r3, [r6, r1] + adds r0, r7, 0 + movs r1, 0 + bl sub_80199E0 + cmp r0, 0x1 + beq _0801A15C + mov r2, r8 + ldrb r0, [r2, 0xB] + lsls r0, 31 + lsrs r0, 31 + ldrb r1, [r2, 0x2] + bl sub_8019978 + adds r2, r0, 0 + lsls r2, 24 + lsrs r2, 24 + adds r0, r7, 0 + movs r1, 0 + mov r3, r8 + bl sub_8019FA4 +_0801A0F0: + movs r5, 0x1 + mov r4, r8 + adds r4, 0x4 +_0801A0F6: + ldrb r0, [r4] + cmp r0, 0 + bne _0801A106 + adds r0, r7, 0 + adds r1, r5, 0 + bl sub_801A02C + b _0801A154 +_0801A106: + mov r0, sp + movs r1, 0 + ldrsh r2, [r0, r1] + mov r0, r10 + movs r1, 0 + ldrsh r3, [r0, r1] + adds r0, r7, 0 + adds r1, r5, 0 + bl sub_80199E0 + cmp r0, 0 + bne _0801A154 + mov r0, r9 + movs r1, 0 + ldrsh r2, [r0, r1] + movs r0, 0 + ldrsh r3, [r6, r0] + adds r0, r7, 0 + adds r1, r5, 0 + bl sub_80199E0 + cmp r0, 0 + bne _0801A154 + ldrb r2, [r4] + lsrs r0, r2, 3 + movs r1, 0x1 + ands r0, r1 + movs r1, 0x7 + ands r1, r2 + bl sub_8019978 + adds r2, r0, 0 + lsls r2, 24 + lsrs r2, 24 + adds r0, r7, 0 + adds r1, r5, 0 + mov r3, r8 + bl sub_8019FA4 +_0801A154: + adds r4, 0x1 + adds r5, 0x1 + cmp r5, 0x4 + ble _0801A0F6 +_0801A15C: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_801A064 + + thumb_func_start sub_801A16C +sub_801A16C: @ 801A16C + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r1, 0 + ldrb r0, [r4, 0xA] + lsls r0, 25 + lsrs r0, 25 + subs r0, 0x40 + cmp r0, 0x14 + bhi _0801A20E + lsls r0, 2 + ldr r1, =_0801A18C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801A18C: + .4byte _0801A1E0 + .4byte _0801A200 + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A200 + .4byte _0801A200 + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A200 + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A20E + .4byte _0801A200 + .4byte _0801A200 + .4byte _0801A200 + .4byte _0801A1E0 +_0801A1E0: + ldrb r1, [r4, 0xB] + lsls r1, 31 + lsrs r1, 31 + ldrb r2, [r4, 0x2] + adds r0, r5, 0 + bl sub_8019CF0 + movs r4, 0 +_0801A1F0: + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_801A02C + adds r4, 0x1 + cmp r4, 0x4 + bls _0801A1F0 + b _0801A20E +_0801A200: + adds r0, r5, 0 + bl AGBAssert + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_801A064 +_0801A20E: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801A16C + + thumb_func_start sub_801A214 +sub_801A214: @ 801A214 + push {r4,r5,lr} + adds r5, r0, 0 + bl AGBAssert + movs r4, 0 +_0801A21E: + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_801A02C + adds r4, 0x1 + cmp r4, 0x4 + ble _0801A21E + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801A214 + + thumb_func_start sub_801A234 +sub_801A234: @ 801A234 + push {r4,r5,lr} + ldr r2, =gUnknown_02022C68 + movs r1, 0 + str r1, [r2] + movs r5, 0 + ldr r4, [r0] +_0801A240: + ldrb r0, [r4, 0x1A] + movs r1, 0x3 + ands r1, r0 + cmp r1, 0x1 + bne _0801A258 + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_801A16C + b _0801A264 + .pool +_0801A258: + cmp r1, 0x2 + bne _0801A264 + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_801A214 +_0801A264: + adds r4, 0x20 + adds r5, 0x1 + cmp r5, 0x7 + ble _0801A240 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801A234 + + thumb_func_start sub_801A274 +sub_801A274: @ 801A274 + ldr r1, =gUnknown_02022C68 + movs r0, 0x96 + lsls r0, 1 + str r0, [r1] + bx lr + .pool + thumb_func_end sub_801A274 + + thumb_func_start sub_801A284 +sub_801A284: @ 801A284 + push {lr} + adds r2, r0, 0 + ldr r0, =gUnknown_02022C68 + ldr r1, [r0] + adds r1, 0x1 + str r1, [r0] + movs r0, 0x96 + lsls r0, 1 + cmp r1, r0 + bls _0801A29E + adds r0, r2, 0 + bl sub_801A234 +_0801A29E: + pop {r0} + bx r0 + .pool + thumb_func_end sub_801A284 + + thumb_func_start sub_801A2A8 +sub_801A2A8: @ 801A2A8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + adds r5, r0, 0 + str r1, [sp, 0x4] + str r2, [sp, 0x8] + bl is_walking_or_running + cmp r0, 0 + bne _0801A2F0 + b _0801A396 +_0801A2C4: + ldr r4, =gUnknown_082F076A + bl player_get_direction_lower_nybble + lsls r0, 24 + lsrs r0, 24 + adds r0, r4 + ldrb r2, [r0] + adds r0, r6, 0 + ldr r1, [sp, 0xC] + bl sub_801A3B0 + ldr r0, [sp, 0x4] + strh r6, [r0] + mov r1, sp + ldrh r2, [r1, 0xC] + ldr r1, [sp, 0x8] + strh r2, [r1] + movs r0, 0x1 + b _0801A398 + .pool +_0801A2F0: + mov r4, sp + adds r4, 0x2 + mov r0, sp + adds r1, r4, 0 + bl GetXYCoordsOneStepInFrontOfPlayer + movs r0, 0 + str r0, [sp, 0xC] + ldr r0, =gUnknown_082F0740 + adds r7, r5, 0 + movs r1, 0 + mov r10, r1 + adds r2, r0, 0x2 + str r2, [sp, 0x10] + str r0, [sp, 0x14] +_0801A30E: + movs r6, 0 + ldr r4, [sp, 0x14] + movs r0, 0 + ldrsh r4, [r4, r0] + mov r9, r4 + ldr r1, [sp, 0x10] + mov r8, r1 + ldr r5, =gUnknown_082F0760 +_0801A31E: + mov r2, r10 + adds r3, r2, r6 + mov r0, sp + movs r4, 0 + ldrsh r1, [r0, r4] + movs r0, 0 + ldrsb r0, [r5, r0] + add r0, r9 + adds r0, 0x7 + cmp r1, r0 + bne _0801A372 + mov r1, sp + movs r2, 0x2 + ldrsh r0, [r1, r2] + mov r4, r8 + movs r2, 0 + ldrsh r1, [r4, r2] + movs r2, 0x1 + ldrsb r2, [r5, r2] + adds r1, r2 + adds r1, 0x7 + cmp r0, r1 + bne _0801A372 + adds r0, r3, 0 + subs r0, 0x38 + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl sub_8097C8C + cmp r0, 0 + bne _0801A372 + adds r0, r4, 0 + bl sub_8097D9C + cmp r0, 0 + bne _0801A372 + ldrb r1, [r7, 0x1A] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + beq _0801A2C4 +_0801A372: + adds r5, 0x2 + adds r6, 0x1 + cmp r6, 0x4 + ble _0801A31E + adds r7, 0x20 + movs r4, 0x5 + add r10, r4 + ldr r0, [sp, 0x10] + adds r0, 0x4 + str r0, [sp, 0x10] + ldr r1, [sp, 0x14] + adds r1, 0x4 + str r1, [sp, 0x14] + ldr r2, [sp, 0xC] + adds r2, 0x1 + str r2, [sp, 0xC] + cmp r2, 0x7 + ble _0801A30E +_0801A396: + movs r0, 0 +_0801A398: + add sp, 0x18 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801A2A8 + + thumb_func_start sub_801A3B0 +sub_801A3B0: @ 801A3B0 + push {r4,lr} + adds r4, r0, 0 + adds r3, r1, 0 + lsls r1, r2, 24 + lsrs r1, 24 + lsls r0, r3, 2 + adds r0, r3 + subs r0, 0x38 + adds r0, r4 + lsls r0, 24 + lsrs r0, 24 + bl sub_8097B78 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801A3B0 + + thumb_func_start sub_801A3D0 +sub_801A3D0: @ 801A3D0 + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r1, 0 + lsls r3, r4, 5 + adds r3, r2 + adds r2, r3, 0 + bl sub_8019F64 + adds r2, r0, 0 + lsls r2, 24 + lsrs r2, 24 + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_801A3B0 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801A3D0 + + thumb_func_start sub_801A3F4 +sub_801A3F4: @ 801A3F4 + push {lr} + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801A414 + bl RunTasks + bl RunTextPrinters + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade +_0801A414: + pop {r0} + bx r0 + thumb_func_end sub_801A3F4 + + thumb_func_start sub_801A418 +sub_801A418: @ 801A418 + push {lr} + bl LoadOam + bl ProcessSpriteCopyRequests + bl TransferPlttBuffer + pop {r0} + bx r0 + thumb_func_end sub_801A418 + + thumb_func_start sub_801A42C +sub_801A42C: @ 801A42C + push {lr} + ldr r0, =sub_801A43C + bl SetMainCallback2 + pop {r0} + bx r0 + .pool + thumb_func_end sub_801A42C + + thumb_func_start sub_801A43C +sub_801A43C: @ 801A43C + push {r4,r5,lr} + sub sp, 0xC + movs r0, 0 + movs r1, 0 + bl SetGpuReg + ldr r5, =gUnknown_03000DAC + movs r0, 0x6C + bl AllocZeroed + str r0, [r5] + movs r0, 0 + bl SetVBlankCallback + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_082F0D34 + movs r0, 0 + movs r2, 0x2 + bl InitBgsFromTemplates + movs r4, 0x80 + lsls r4, 4 + adds r0, r4, 0 + bl Alloc + adds r1, r0, 0 + movs r0, 0x1 + bl SetBgTilemapBuffer + adds r0, r4, 0 + bl Alloc + adds r1, r0, 0 + movs r0, 0 + bl SetBgTilemapBuffer + ldr r1, =gWirelessInfoScreenGfx + movs r0, 0 + str r0, [sp] + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl copy_decompressed_tile_data_to_vram_autofree + ldr r1, =gWirelessInfoScreenTilemap + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + ldr r0, =gUnknown_082F0D3C + bl InitWindows + bl DeactivateAllTextPrinters + bl ResetPaletteFade + bl ResetSpriteData + bl ResetTasks + bl remove_some_task + bl m4aSoundVSyncOn + ldr r0, =sub_801A418 + bl SetVBlankCallback + ldr r0, =sub_801A6C0 + movs r1, 0 + bl CreateTask + ldr r1, [r5] + adds r1, 0x60 + strb r0, [r1] + bl sub_8013C40 + ldr r1, [r5] + adds r1, 0x61 + strb r0, [r1] + ldr r1, [r5] + movs r0, 0x1 + str r0, [r1, 0x1C] + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + ldr r0, =gWirelessInfoScreenPal + movs r1, 0 + movs r2, 0x20 + bl LoadPalette + movs r0, 0xF0 + bl sub_81978B0 + bl sub_81AFBF0 + movs r0, 0x20 + str r0, [sp] + str r0, [sp, 0x4] + movs r0, 0xF + str r0, [sp, 0x8] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + ldr r0, =sub_801A3F4 + bl SetMainCallback2 + bl RunTasks + bl RunTextPrinters + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801A43C + + thumb_func_start sub_801A584 +sub_801A584: @ 801A584 + push {r4,lr} + bl FreeAllWindowBuffers + movs r4, 0 +_0801A58C: + lsls r0, r4, 24 + lsrs r0, 24 + bl GetBgTilemapBuffer + bl Free + adds r4, 0x1 + cmp r4, 0x1 + ble _0801A58C + ldr r0, =gUnknown_03000DAC + ldr r0, [r0] + bl Free + ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music + bl SetMainCallback2 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801A584 + + thumb_func_start sub_801A5BC +sub_801A5BC: @ 801A5BC + push {lr} + adds r2, r0, 0 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x5 + ble _0801A5E4 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0xE + bne _0801A5E0 + movs r0, 0 + strh r0, [r1] +_0801A5E0: + movs r0, 0 + strh r0, [r2] +_0801A5E4: + movs r2, 0 + ldrsh r0, [r1, r2] + adds r0, 0x2 + lsls r0, 5 + ldr r1, =gWirelessInfoScreenPal + adds r0, r1 + movs r1, 0 + movs r2, 0x10 + bl LoadPalette + pop {r0} + bx r0 + .pool + thumb_func_end sub_801A5BC + + thumb_func_start sub_801A600 +sub_801A600: @ 801A600 + push {r4,r5,lr} + sub sp, 0x8 + movs r0, 0 + movs r1, 0 + bl FillWindowPixelBuffer + movs r0, 0x1 + movs r1, 0 + bl FillWindowPixelBuffer + movs r0, 0x2 + movs r1, 0 + bl FillWindowPixelBuffer + ldr r5, =gUnknown_082F0D5C + ldr r4, [r5] + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0xC0 + bl GetStringCenterAlignXOffset + adds r3, r0, 0 + lsls r3, 24 + lsrs r3, 24 + movs r0, 0x6 + str r0, [sp] + movs r0, 0x3 + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0x1 + adds r2, r4, 0 + bl sub_801A8B0 + movs r1, 0 +_0801A644: + adds r4, r1, 0x1 + lsls r0, r4, 2 + adds r0, r5 + ldr r2, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 25 + movs r1, 0x80 + lsls r1, 20 + adds r0, r1 + lsrs r0, 24 + str r0, [sp] + movs r0, 0x1 + str r0, [sp, 0x4] + movs r1, 0x1 + movs r3, 0 + bl sub_801A8B0 + adds r1, r4, 0 + cmp r4, 0x2 + ble _0801A644 + ldr r1, =gUnknown_082F0D5C + adds r0, r4, 0x1 + lsls r0, 2 + adds r0, r1 + ldr r2, [r0] + lsls r0, r4, 4 + subs r0, r4 + lsls r0, 25 + movs r1, 0x80 + lsls r1, 20 + adds r0, r1 + lsrs r0, 24 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + movs r1, 0x1 + movs r3, 0 + bl sub_801A8B0 + movs r0, 0 + bl PutWindowTilemap + movs r0, 0 + movs r1, 0x2 + bl CopyWindowToVram + movs r0, 0x1 + bl PutWindowTilemap + movs r0, 0x1 + movs r1, 0x2 + bl CopyWindowToVram + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801A600 + + thumb_func_start sub_801A6C0 +sub_801A6C0: @ 801A6C0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x8 + lsls r0, 24 + lsrs r5, r0, 24 + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + movs r2, 0x8 + ldrsh r0, [r0, r2] + adds r2, r1, 0 + cmp r0, 0x5 + bls _0801A6E2 + b _0801A89C +_0801A6E2: + lsls r0, 2 + ldr r1, =_0801A6F4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801A6F4: + .4byte _0801A70C + .4byte _0801A728 + .4byte _0801A74C + .4byte _0801A768 + .4byte _0801A85C + .4byte _0801A884 +_0801A70C: + bl sub_801A600 + ldr r0, =gTasks + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0801A89C + .pool +_0801A728: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + movs r0, 0x1 + bl ShowBg + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0 + bl ShowBg + b _0801A86C +_0801A74C: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _0801A75A + b _0801A89C +_0801A75A: + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r2 + b _0801A876 + .pool +_0801A768: + ldr r0, =gUnknown_03000DAC + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x10 + adds r2, r0, 0 + adds r2, 0x20 + adds r3, r0, 0 + adds r3, 0x61 + ldrb r3, [r3] + bl sub_801AA30 + lsls r1, r5, 2 + mov r8, r1 + cmp r0, 0 + beq _0801A7F8 + movs r0, 0x2 + movs r1, 0 + bl FillWindowPixelBuffer + movs r4, 0 + ldr r6, =gStringVar4 + movs r7, 0x80 + lsls r7, 20 +_0801A796: + ldr r0, =gUnknown_03000DAC + ldr r0, [r0] + lsls r1, r4, 2 + adds r0, r1 + ldr r1, [r0] + adds r0, r6, 0 + movs r2, 0x1 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + cmp r4, 0x3 + beq _0801A7CC + lsrs r0, r7, 24 + str r0, [sp] + movs r0, 0x1 + str r0, [sp, 0x4] + movs r0, 0x2 + movs r1, 0x1 + adds r2, r6, 0 + movs r3, 0xC + bl sub_801A8B0 + b _0801A7DE + .pool +_0801A7CC: + movs r0, 0x62 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r1, 0x1 + adds r2, r6, 0 + movs r3, 0xC + bl sub_801A8B0 +_0801A7DE: + movs r2, 0xF0 + lsls r2, 21 + adds r7, r2 + adds r4, 0x1 + cmp r4, 0x3 + ble _0801A796 + movs r0, 0x2 + bl PutWindowTilemap + movs r0, 0x2 + movs r1, 0x3 + bl CopyWindowToVram +_0801A7F8: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0801A80C + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0801A836 +_0801A80C: + movs r0, 0x5 + bl PlaySE + ldr r2, =gTasks + ldr r0, =gUnknown_03000DAC + ldr r0, [r0] + adds r0, 0x61 + ldrb r1, [r0] + lsls r0, r1, 2 + adds r0, r1 + lsls r0, 3 + adds r0, r2 + movs r1, 0xFF + strh r1, [r0, 0x26] + mov r0, r8 + adds r1, r0, r5 + lsls r1, 3 + adds r1, r2 + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0801A836: + mov r2, r8 + adds r1, r2, r5 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r1, r0 + adds r0, r1, 0 + adds r0, 0xE + adds r1, 0x10 + bl sub_801A5BC + b _0801A89C + .pool +_0801A85C: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade +_0801A86C: + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 +_0801A876: + ldrh r1, [r0, 0x8] + adds r1, 0x1 + strh r1, [r0, 0x8] + b _0801A89C + .pool +_0801A884: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _0801A89C + ldr r0, =sub_801A584 + bl SetMainCallback2 + adds r0, r5, 0 + bl DestroyTask +_0801A89C: + add sp, 0x8 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801A6C0 + + thumb_func_start sub_801A8B0 +sub_801A8B0: @ 801A8B0 + push {r4-r7,lr} + sub sp, 0x18 + mov r12, r2 + ldr r2, [sp, 0x2C] + ldr r4, [sp, 0x30] + lsls r0, 24 + lsrs r7, r0, 24 + lsls r1, 24 + lsrs r6, r1, 24 + lsls r3, 24 + lsrs r5, r3, 24 + lsls r2, 24 + lsrs r3, r2, 24 + lsls r4, 24 + lsrs r0, r4, 24 + cmp r0, 0x4 + bhi _0801A93A + lsls r0, 2 + ldr r1, =_0801A8E0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801A8E0: + .4byte _0801A8F4 + .4byte _0801A902 + .4byte _0801A910 + .4byte _0801A91E + .4byte _0801A92C +_0801A8F4: + add r1, sp, 0x14 + movs r0, 0 + strb r0, [r1] + movs r0, 0x2 + strb r0, [r1, 0x1] + movs r0, 0x3 + b _0801A938 +_0801A902: + add r1, sp, 0x14 + movs r0, 0 + strb r0, [r1] + movs r0, 0x1 + strb r0, [r1, 0x1] + movs r0, 0x3 + b _0801A938 +_0801A910: + add r1, sp, 0x14 + movs r0, 0 + strb r0, [r1] + movs r0, 0x4 + strb r0, [r1, 0x1] + movs r0, 0x5 + b _0801A938 +_0801A91E: + add r1, sp, 0x14 + movs r0, 0 + strb r0, [r1] + movs r0, 0x7 + strb r0, [r1, 0x1] + movs r0, 0x6 + b _0801A938 +_0801A92C: + add r1, sp, 0x14 + movs r0, 0 + strb r0, [r1] + movs r0, 0x1 + strb r0, [r1, 0x1] + movs r0, 0x2 +_0801A938: + strb r0, [r1, 0x2] +_0801A93A: + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + add r0, sp, 0x14 + str r0, [sp, 0x8] + movs r0, 0x1 + negs r0, r0 + str r0, [sp, 0xC] + mov r0, r12 + str r0, [sp, 0x10] + adds r0, r7, 0 + adds r1, r6, 0 + adds r2, r5, 0 + bl AddTextPrinterParametrized2 + add sp, 0x18 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_801A8B0 + + thumb_func_start sub_801A960 +sub_801A960: @ 801A960 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + mov r12, r0 + adds r7, r1, 0 + ldrb r0, [r0, 0xA] + lsls r0, 25 + lsrs r0, 25 + mov r8, r0 + movs r4, 0 + ldr r0, =gUnknown_082F0D70 + mov r9, r0 + movs r1, 0x1 + add r1, r9 + mov r10, r1 + mov r3, r12 + adds r3, 0x4 + str r3, [sp] +_0801A98A: + lsls r0, r4, 1 + adds r2, r0, r4 + mov r3, r9 + adds r1, r2, r3 + adds r5, r0, 0 + adds r6, r4, 0x1 + ldrb r1, [r1] + cmp r8, r1 + bne _0801A9EE + mov r0, r12 + ldrb r1, [r0, 0x1A] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _0801A9EE + mov r0, r9 + adds r0, 0x2 + adds r3, r2, r0 + ldrb r0, [r3] + cmp r0, 0 + bne _0801A9DC + movs r2, 0 + movs r1, 0 + ldr r3, [sp] +_0801A9BA: + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0801A9C4 + adds r2, 0x1 +_0801A9C4: + adds r1, 0x1 + cmp r1, 0x3 + ble _0801A9BA + adds r2, 0x1 + adds r0, r5, r4 + add r0, r10 + ldrb r1, [r0] + lsls r1, 2 + adds r1, r7 + b _0801A9E8 + .pool +_0801A9DC: + mov r1, r10 + adds r0, r2, r1 + ldrb r1, [r0] + lsls r1, 2 + adds r1, r7 + ldrb r2, [r3] +_0801A9E8: + ldr r0, [r1] + adds r0, r2 + str r0, [r1] +_0801A9EE: + adds r4, r6, 0 + cmp r4, 0x1E + bls _0801A98A + mov r0, r8 + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_801A960 + + thumb_func_start sub_801AA08 +sub_801AA08: @ 801AA08 + push {r4,lr} + movs r4, 0 + adds r3, r1, 0 + adds r2, r0, 0 +_0801AA10: + ldr r1, [r2] + ldr r0, [r3] + cmp r1, r0 + beq _0801AA1C + movs r0, 0x1 + b _0801AA28 +_0801AA1C: + adds r3, 0x4 + adds r2, 0x4 + adds r4, 0x1 + cmp r4, 0x3 + ble _0801AA10 + movs r0, 0 +_0801AA28: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801AA08 + + thumb_func_start sub_801AA30 +sub_801AA30: @ 801AA30 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x10 + adds r6, r0, 0 + mov r9, r1 + adds r5, r2, 0 + lsls r4, r3, 24 + lsrs r4, 24 + movs r0, 0 + mov r8, r0 + mov r0, sp + movs r1, 0 + movs r2, 0x10 + bl memset + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r7, r0, r1 + movs r4, 0 +_0801AA5E: + lsls r1, r4, 5 + ldr r0, [r7] + adds r0, r1 + mov r1, sp + bl sub_801A960 + adds r1, r0, 0 + ldr r0, [r5] + cmp r1, r0 + beq _0801AA78 + str r1, [r5] + movs r2, 0x1 + mov r8, r2 +_0801AA78: + adds r5, 0x4 + adds r4, 0x1 + cmp r4, 0xF + ble _0801AA5E + mov r0, sp + mov r1, r9 + bl sub_801AA08 + cmp r0, 0 + bne _0801AA9C + mov r3, r8 + cmp r3, 0x1 + beq _0801AAC4 + movs r0, 0 + b _0801AAC6 + .pool +_0801AA9C: + adds r1, r6, 0 + mov r0, sp + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldr r0, [r0] + str r0, [r1] + mov r1, r9 + mov r0, sp + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldr r0, [r0] + str r0, [r1] + ldr r0, [r6] + ldr r1, [r6, 0x4] + adds r0, r1 + ldr r1, [r6, 0x8] + adds r0, r1 + ldr r1, [r6, 0xC] + adds r0, r1 + str r0, [r6, 0xC] +_0801AAC4: + movs r0, 0x1 +_0801AAC6: + add sp, 0x10 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_801AA30 + + thumb_func_start sub_801AAD4 +sub_801AAD4: @ 801AAD4 + push {r4-r7,lr} + movs r0, 0xA + bl sub_8014210 + movs r4, 0 + movs r7, 0x64 + ldr r6, =gPlayerParty + ldr r5, =gEnemyParty +_0801AAE4: + ldr r0, =gUnknown_0203CEF8 + adds r0, r4, r0 + ldrb r0, [r0] + subs r0, 0x1 + adds r1, r0, 0 + muls r1, r7 + adds r1, r6 + adds r0, r5, 0 + movs r2, 0x64 + bl memcpy + adds r5, 0x64 + adds r4, 0x1 + cmp r4, 0x1 + ble _0801AAE4 + ldr r4, =gPlayerParty + movs r0, 0xFA + lsls r0, 1 + adds r5, r4, r0 +_0801AB0A: + adds r0, r4, 0 + bl ZeroMonData + adds r4, 0x64 + cmp r4, r5 + ble _0801AB0A + ldr r4, =gPlayerParty + movs r5, 0 + adds r6, r4, 0 + adds r6, 0x64 +_0801AB1E: + ldr r1, =gEnemyParty + adds r1, r5, r1 + adds r0, r4, 0 + movs r2, 0x64 + bl memcpy + adds r4, 0x64 + adds r5, 0x64 + cmp r4, r6 + ble _0801AB1E + movs r0, 0x32 + bl IncrementGameStat + bl CalculatePlayerPartyCount + ldr r0, =gTrainerBattleOpponent_A + movs r2, 0xC0 + lsls r2, 4 + adds r1, r2, 0 + strh r1, [r0] + ldr r0, =CB2_InitBattle + bl SetMainCallback2 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801AAD4 + + thumb_func_start sub_801AB68 +sub_801AB68: @ 801AB68 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + adds r5, r0, 0 + adds r7, r1, 0 + adds r6, r2, 0 + ldr r4, [sp, 0x38] + lsls r5, 24 + lsrs r5, 24 + lsls r6, 24 + lsrs r6, 24 + lsls r3, 24 + lsrs r3, 24 + movs r0, 0 + mov r9, r0 + movs r1, 0x1 + mov r10, r1 + ldr r0, =gUnknown_082F0DE4 + mov r8, r0 + ldrb r0, [r0] + lsls r1, r0, 4 + orrs r1, r0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r5, 0 + str r3, [sp, 0x14] + bl FillWindowPixelBuffer + mov r1, r9 + str r1, [sp] + mov r0, r10 + str r0, [sp, 0x4] + mov r1, r8 + str r1, [sp, 0x8] + lsls r4, 24 + asrs r4, 24 + str r4, [sp, 0xC] + str r7, [sp, 0x10] + adds r0, r5, 0 + movs r1, 0x1 + adds r2, r6, 0 + ldr r3, [sp, 0x14] + bl AddTextPrinterParametrized2 + 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 sub_801AB68 + + thumb_func_start sub_801ABDC +sub_801ABDC: @ 801ABDC + push {r4-r6,lr} + sub sp, 0x4 + adds r4, r0, 0 + adds r6, r1, 0 + adds r5, r2, 0 + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0 + beq _0801ABF4 + cmp r0, 0x1 + beq _0801AC22 + b _0801AC36 +_0801ABF4: + movs r0, 0 + movs r1, 0x1 + movs r2, 0xD + bl sub_8098858 + str r5, [sp] + movs r0, 0 + adds r1, r6, 0 + movs r2, 0 + movs r3, 0x1 + bl sub_801AB68 + movs r0, 0 + bl PutWindowTilemap + movs r0, 0 + movs r1, 0x3 + bl CopyWindowToVram + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] + b _0801AC36 +_0801AC22: + movs r0, 0 + bl IsTextPrinterActive + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0 + bne _0801AC36 + strh r0, [r4] + movs r0, 0x1 + b _0801AC38 +_0801AC36: + movs r0, 0 +_0801AC38: + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801ABDC + + thumb_func_start sub_801AC40 +sub_801AC40: @ 801AC40 + push {lr} + bl LoadOam + bl ProcessSpriteCopyRequests + bl TransferPlttBuffer + pop {r0} + bx r0 + thumb_func_end sub_801AC40 + + thumb_func_start sub_801AC54 +sub_801AC54: @ 801AC54 + push {r4,lr} + sub sp, 0xC + ldr r1, =gMain + movs r2, 0x87 + lsls r2, 3 + adds r0, r1, r2 + ldrb r0, [r0] + adds r2, r1, 0 + cmp r0, 0x33 + bls _0801AC6A + b _0801AFAE +_0801AC6A: + lsls r0, 2 + ldr r1, =_0801AC7C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801AC7C: + .4byte _0801AD4C + .4byte _0801ADFC + .4byte _0801AE24 + .4byte _0801AE48 + .4byte _0801AE98 + .4byte _0801AFAE + .4byte _0801AF7C + .4byte _0801AF58 + .4byte _0801AF7C + .4byte _0801AF98 + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AFAE + .4byte _0801AF24 + .4byte _0801AF40 +_0801AD4C: + movs r0, 0 + movs r1, 0 + bl SetGpuReg + ldr r4, =gUnknown_02022C6C + movs r0, 0x4 + bl AllocZeroed + str r0, [r4] + bl ResetSpriteData + bl FreeAllSpritePalettes + bl ResetTasks + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_082F0DD0 + movs r0, 0 + movs r2, 0x1 + bl InitBgsFromTemplates + bl reset_temp_tile_data_buffers + ldr r0, =gUnknown_082F0DD4 + bl InitWindows + lsls r0, 16 + cmp r0, 0 + bne _0801AD8C + b _0801AFC2 +_0801AD8C: + bl DeactivateAllTextPrinters + movs r0, 0 + bl ClearWindowTilemap + movs r0, 0 + movs r1, 0 + bl FillWindowPixelBuffer + movs r0, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + movs r0, 0x1E + str r0, [sp] + movs r0, 0x14 + str r0, [sp, 0x4] + movs r0, 0xF + str r0, [sp, 0x8] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect + movs r0, 0 + movs r1, 0x1 + movs r2, 0xD0 + bl sub_809882C + movs r0, 0 + movs r1, 0x1 + movs r2, 0xD0 + bl box_border_load_tiles_and_pal + bl sub_819789C + ldr r0, =sub_801AC40 + bl SetVBlankCallback + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _0801AF8A + .pool +_0801ADFC: + ldr r0, =gUnknown_02022C6C + ldr r0, [r0] + ldr r1, =gText_CommStandbyAwaitingOtherPlayer + movs r2, 0 + bl sub_801ABDC + cmp r0, 0 + bne _0801AE0E + b _0801AFAE +_0801AE0E: + ldr r1, =gMain + movs r2, 0x87 + lsls r2, 3 + adds r1, r2 + b _0801AF8A + .pool +_0801AE24: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + movs r0, 0 + bl ShowBg + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _0801AF8A + .pool +_0801AE48: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + beq _0801AE54 + b _0801AFAE +_0801AE54: + ldr r4, =gUnknown_020228C4 + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x20 + bl memset + ldr r0, =gUnknown_0203CEF8 + ldrb r1, [r0] + ldrb r0, [r0, 0x1] + cmn r1, r0 + bne _0801AE78 + movs r0, 0x52 + b _0801AE7A + .pool +_0801AE78: + movs r0, 0x51 +_0801AE7A: + strb r0, [r4] + ldr r1, =gUnknown_020228C4 + movs r0, 0 + movs r2, 0x20 + bl SendBlock + ldr r1, =gMain + movs r2, 0x87 + lsls r2, 3 + adds r1, r2 + b _0801AF8A + .pool +_0801AE98: + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + beq _0801AEA6 + b _0801AFAE +_0801AEA6: + ldr r1, =gBlockRecvBuffer + ldrh r0, [r1] + cmp r0, 0x51 + bne _0801AEE0 + movs r2, 0x80 + lsls r2, 1 + adds r0, r1, r2 + ldrh r0, [r0] + cmp r0, 0x51 + bne _0801AEE0 + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + ldr r0, =gMain + movs r1, 0x87 + lsls r1, 3 + adds r0, r1 + movs r1, 0x32 + b _0801AF16 + .pool +_0801AEE0: + bl sub_800AC34 + ldr r4, =gBlockRecvBuffer + bl GetMultiplayerId + lsls r0, 24 + lsrs r0, 16 + adds r0, r4 + ldrh r0, [r0] + cmp r0, 0x52 + bne _0801AF0C + ldr r0, =gMain + movs r2, 0x87 + lsls r2, 3 + adds r0, r2 + movs r1, 0x6 + b _0801AF16 + .pool +_0801AF0C: + ldr r0, =gMain + movs r1, 0x87 + lsls r1, 3 + adds r0, r1 + movs r1, 0x8 +_0801AF16: + strb r1, [r0] + bl ResetBlockReceivedFlags + b _0801AFAE + .pool +_0801AF24: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + bne _0801AFAE + bl sub_800ADF8 + ldr r1, =gMain + movs r2, 0x87 + lsls r2, 3 + adds r1, r2 + b _0801AF8A + .pool +_0801AF40: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801AFAE + ldr r0, =sub_801AAD4 + bl SetMainCallback2 + b _0801AFAE + .pool +_0801AF58: + ldr r0, =gUnknown_02022C6C + ldr r0, [r0] + ldr r1, =gText_RefusedBattle + movs r2, 0x1 + bl sub_801ABDC + cmp r0, 0 + beq _0801AFAE + ldr r0, =c2_exit_to_overworld_2_switch + bl SetMainCallback2 + b _0801AFAE + .pool +_0801AF7C: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801AFAE + movs r0, 0x87 + lsls r0, 3 + adds r1, r2, r0 +_0801AF8A: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _0801AFAE + .pool +_0801AF98: + ldr r0, =gUnknown_02022C6C + ldr r0, [r0] + ldr r1, =gText_BattleWasRefused + movs r2, 0x1 + bl sub_801ABDC + cmp r0, 0 + beq _0801AFAE + ldr r0, =c2_exit_to_overworld_2_switch + bl SetMainCallback2 +_0801AFAE: + bl RunTasks + bl RunTextPrinters + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade +_0801AFC2: + add sp, 0xC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801AC54 + + thumb_func_start sub_801AFD8 +sub_801AFD8: @ 801AFD8 + push {lr} + sub sp, 0x4 + movs r0, 0 + str r0, [sp] + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldr r0, =0x0000322c + adds r1, r0 + ldr r2, =0x050000db + mov r0, sp + bl CpuSet + bl sub_801B180 + bl sub_811F8BC + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_801AFD8 + + thumb_func_start sub_801B00C +sub_801B00C: @ 801B00C + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x00003230 + adds r0, r1 + bx lr + .pool + thumb_func_end sub_801B00C + + thumb_func_start sav1_get_mevent_buffer_1 +sav1_get_mevent_buffer_1: @ 801B020 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x000033f0 + adds r0, r1 + bx lr + .pool + thumb_func_end sav1_get_mevent_buffer_1 + + thumb_func_start sav1_get_mevent_buffer_2 +sav1_get_mevent_buffer_2: @ 801B034 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + movs r1, 0xD5 + lsls r1, 6 + adds r0, r1 + bx lr + .pool + thumb_func_end sav1_get_mevent_buffer_2 + + thumb_func_start sub_801B044 +sub_801B044: @ 801B044 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x0000356c + adds r0, r1 + bx lr + .pool + thumb_func_end sub_801B044 + + thumb_func_start sub_801B058 +sub_801B058: @ 801B058 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x00003564 + adds r0, r1 + bx lr + .pool + thumb_func_end sub_801B058 + + thumb_func_start sub_801B06C +sub_801B06C: @ 801B06C + push {lr} + bl sub_801B14C + pop {r0} + bx r0 + thumb_func_end sub_801B06C + + thumb_func_start sub_801B078 +sub_801B078: @ 801B078 + push {r4-r7,lr} + adds r7, r0, 0 + bl sub_801B114 + cmp r0, 0 + beq _0801B0C4 + bl sub_801B14C + ldr r4, =gSaveBlock1Ptr + ldr r0, [r4] + ldr r5, =0x00003230 + adds r0, r5 + movs r6, 0xDE + lsls r6, 1 + adds r1, r7, 0 + adds r2, r6, 0 + bl memcpy + ldr r0, [r4] + adds r0, r5 + adds r1, r6, 0 + bl CalcCRC16WithTable + ldr r1, [r4] + ldr r2, =0x0000322c + adds r1, r2 + lsls r0, 16 + lsrs r0, 16 + str r0, [r1] + movs r0, 0x1 + b _0801B0C6 + .pool +_0801B0C4: + movs r0, 0 +_0801B0C6: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_801B078 + + thumb_func_start sub_801B0CC +sub_801B0CC: @ 801B0CC + push {r4,lr} + ldr r4, =gSaveBlock1Ptr + ldr r0, [r4] + ldr r1, =0x00003230 + adds r0, r1 + movs r1, 0xDE + lsls r1, 1 + bl CalcCRC16WithTable + lsls r0, 16 + lsrs r0, 16 + ldr r4, [r4] + ldr r2, =0x0000322c + adds r1, r4, r2 + ldr r1, [r1] + cmp r0, r1 + bne _0801B10C + ldr r1, =0x00003230 + adds r0, r4, r1 + bl sub_801B114 + cmp r0, 0 + beq _0801B10C + movs r0, 0x1 + b _0801B10E + .pool +_0801B10C: + movs r0, 0 +_0801B10E: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801B0CC + + thumb_func_start sub_801B114 +sub_801B114: @ 801B114 + push {lr} + ldrh r0, [r0] + cmp r0, 0 + beq _0801B120 + movs r0, 0x1 + b _0801B122 +_0801B120: + movs r0, 0 +_0801B122: + pop {r1} + bx r1 + thumb_func_end sub_801B114 + + thumb_func_start sub_801B128 +sub_801B128: @ 801B128 + push {lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x00003230 + adds r0, r1 + ldrb r0, [r0, 0x2] + cmp r0, 0 + beq _0801B144 + movs r0, 0x1 + b _0801B146 + .pool +_0801B144: + movs r0, 0 +_0801B146: + pop {r1} + bx r1 + thumb_func_end sub_801B128 + + thumb_func_start sub_801B14C +sub_801B14C: @ 801B14C + push {r4,lr} + sub sp, 0x4 + movs r4, 0 + str r4, [sp] + bl sub_801B00C + adds r1, r0, 0 + ldr r2, =0x0500006f + mov r0, sp + bl CpuSet + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x0000322c + adds r0, r1 + str r4, [r0] + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B14C + + thumb_func_start sub_801B180 +sub_801B180: @ 801B180 + push {lr} + sub sp, 0x4 + movs r0, 0 + str r0, [sp] + bl sub_801B044 + adds r1, r0, 0 + ldr r2, =0x05000001 + mov r0, sp + bl CpuSet + bl sub_801DBC0 + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B180 + + thumb_func_start sub_801B1A4 +sub_801B1A4: @ 801B1A4 + push {r4,r5,lr} + adds r5, r0, 0 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x00003230 + adds r4, r0, r1 + bl sub_801B0CC + cmp r0, 0 + bne _0801B1C4 +_0801B1B8: + movs r0, 0 + b _0801B1DC + .pool +_0801B1C4: + movs r2, 0 + ldr r3, =0x000001bb +_0801B1C8: + adds r0, r4, r2 + adds r1, r5, r2 + ldrb r0, [r0] + ldrb r1, [r1] + cmp r0, r1 + bne _0801B1B8 + adds r2, 0x1 + cmp r2, r3 + bls _0801B1C8 + movs r0, 0x1 +_0801B1DC: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801B1A4 + + thumb_func_start sub_801B1E8 +sub_801B1E8: @ 801B1E8 + push {lr} + bl sub_801B330 + bl sub_801B368 + bl sub_801B9F8 + bl ClearRamScript + bl sub_809D4D8 + bl sub_809D570 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000bec + adds r0, r1 + bl sub_816534C + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B1E8 + + thumb_func_start sub_801B21C +sub_801B21C: @ 801B21C + push {r4-r7,lr} + adds r7, r0, 0 + bl sub_801B2CC + cmp r0, 0 + beq _0801B274 + bl sub_801B1E8 + ldr r4, =gSaveBlock1Ptr + ldr r0, [r4] + ldr r5, =0x000033f0 + adds r0, r5 + movs r6, 0xA6 + lsls r6, 1 + adds r1, r7, 0 + adds r2, r6, 0 + bl memcpy + ldr r0, [r4] + adds r0, r5 + adds r1, r6, 0 + bl CalcCRC16WithTable + ldr r1, [r4] + ldr r3, =0x000033ec + adds r2, r1, r3 + lsls r0, 16 + lsrs r0, 16 + str r0, [r2] + movs r0, 0xD5 + lsls r0, 6 + adds r2, r1, r0 + adds r1, r5 + ldrh r0, [r1, 0x2] + strh r0, [r2, 0x6] + movs r0, 0x1 + b _0801B276 + .pool +_0801B274: + movs r0, 0 +_0801B276: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_801B21C + + thumb_func_start sub_801B27C +sub_801B27C: @ 801B27C + push {r4,r5,lr} + ldr r5, =gSaveBlock1Ptr + ldr r0, [r5] + ldr r1, =0x000033ec + adds r4, r0, r1 + adds r1, 0x4 + adds r0, r1 + movs r1, 0xA6 + lsls r1, 1 + bl CalcCRC16WithTable + lsls r0, 16 + lsrs r0, 16 + ldr r1, [r4] + cmp r1, r0 + bne _0801B2C4 + ldr r0, [r5] + ldr r1, =0x000033f0 + adds r0, r1 + bl sub_801B2CC + cmp r0, 0 + beq _0801B2C4 + bl sub_80991F8 + cmp r0, 0 + beq _0801B2C4 + movs r0, 0x1 + b _0801B2C6 + .pool +_0801B2C4: + movs r0, 0 +_0801B2C6: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_801B27C + + thumb_func_start sub_801B2CC +sub_801B2CC: @ 801B2CC + push {lr} + adds r2, r0, 0 + ldrh r0, [r2] + cmp r0, 0 + beq _0801B302 + ldrb r1, [r2, 0x8] + lsls r0, r1, 30 + lsrs r0, 30 + cmp r0, 0x2 + bhi _0801B302 + movs r0, 0xC0 + ands r0, r1 + cmp r0, 0 + beq _0801B2F0 + cmp r0, 0x40 + beq _0801B2F0 + cmp r0, 0x80 + bne _0801B302 +_0801B2F0: + lsls r0, r1, 26 + lsrs r0, 28 + cmp r0, 0x7 + bhi _0801B302 + ldrb r0, [r2, 0x9] + cmp r0, 0x7 + bhi _0801B302 + movs r0, 0x1 + b _0801B304 +_0801B302: + movs r0, 0 +_0801B304: + pop {r1} + bx r1 + thumb_func_end sub_801B2CC + + thumb_func_start sub_801B308 +sub_801B308: @ 801B308 + push {lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x000033f0 + adds r0, r1 + ldrb r1, [r0, 0x8] + movs r0, 0xC0 + ands r0, r1 + cmp r0, 0 + beq _0801B328 + movs r0, 0x1 + b _0801B32A + .pool +_0801B328: + movs r0, 0 +_0801B32A: + pop {r1} + bx r1 + thumb_func_end sub_801B308 + + thumb_func_start sub_801B330 +sub_801B330: @ 801B330 + push {r4,r5,lr} + sub sp, 0x4 + movs r5, 0 + str r5, [sp] + ldr r4, =gSaveBlock1Ptr + ldr r1, [r4] + ldr r0, =0x000033f0 + adds r1, r0 + ldr r2, =0x05000053 + mov r0, sp + bl CpuSet + ldr r0, [r4] + ldr r1, =0x000033ec + adds r0, r1 + str r5, [r0] + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B330 + + thumb_func_start sub_801B368 +sub_801B368: @ 801B368 + push {r4,lr} + sub sp, 0x4 + movs r4, 0 + str r4, [sp] + bl sav1_get_mevent_buffer_2 + adds r1, r0, 0 + ldr r2, =0x05000009 + mov r0, sp + bl CpuSet + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x0000353c + adds r0, r1 + str r4, [r0] + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B368 + + thumb_func_start sub_801B39C +sub_801B39C: @ 801B39C + push {lr} + bl sub_801B27C + cmp r0, 0 + bne _0801B3AA + movs r0, 0 + b _0801B3B4 +_0801B3AA: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x000033f0 + adds r0, r1 + ldrh r0, [r0] +_0801B3B4: + pop {r1} + bx r1 + .pool + thumb_func_end sub_801B39C + + thumb_func_start sub_801B3C0 +sub_801B3C0: @ 801B3C0 + push {lr} + adds r2, r0, 0 + ldrb r1, [r2, 0x8] + movs r0, 0xC0 + ands r0, r1 + cmp r0, 0x40 + bne _0801B3D4 + movs r0, 0x3F + ands r0, r1 + strb r0, [r2, 0x8] +_0801B3D4: + pop {r0} + bx r0 + thumb_func_end sub_801B3C0 + + thumb_func_start sub_801B3D8 +sub_801B3D8: @ 801B3D8 + push {lr} + lsls r0, 16 + ldr r1, =0xfc180000 + adds r0, r1 + lsrs r0, 16 + cmp r0, 0x13 + bls _0801B3F0 + movs r0, 0 + b _0801B3F2 + .pool +_0801B3F0: + movs r0, 0x1 +_0801B3F2: + pop {r1} + bx r1 + thumb_func_end sub_801B3D8 + + thumb_func_start sub_801B3F8 +sub_801B3F8: @ 801B3F8 + push {r4,lr} + bl sub_801B39C + lsls r0, 16 + lsrs r4, r0, 16 + adds r0, r4, 0 + bl sub_801B3D8 + cmp r0, 0 + beq _0801B430 + ldr r1, =gUnknown_082F0DE8 + ldr r2, =0xfffffc18 + adds r0, r4, r2 + lsls r0, 1 + adds r0, r1 + ldrh r0, [r0] + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _0801B430 + movs r0, 0x1 + b _0801B432 + .pool +_0801B430: + movs r0, 0 +_0801B432: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801B3F8 + + thumb_func_start sub_801B438 +sub_801B438: @ 801B438 + push {lr} + movs r3, 0 + cmp r3, r1 + bge _0801B45A + adds r2, r0, 0 + adds r2, 0x8 +_0801B444: + ldrh r0, [r2, 0xE] + cmp r0, 0 + beq _0801B452 + ldrh r0, [r2] + cmp r0, 0 + beq _0801B452 + adds r3, 0x1 +_0801B452: + adds r2, 0x2 + subs r1, 0x1 + cmp r1, 0 + bne _0801B444 +_0801B45A: + adds r0, r3, 0 + pop {r1} + bx r1 + thumb_func_end sub_801B438 + + thumb_func_start sub_801B460 +sub_801B460: @ 801B460 + push {r4-r7,lr} + adds r5, r0, 0 + adds r4, r1, 0 + movs r1, 0 + cmp r1, r2 + bge _0801B49A + ldrh r6, [r4, 0x2] + movs r0, 0x16 + adds r0, r5 + mov r12, r0 +_0801B474: + lsls r3, r1, 1 + mov r7, r12 + ldrh r0, [r7] + cmp r0, r6 + beq _0801B48C + adds r0, r5, 0 + adds r0, 0x8 + adds r0, r3 + ldrh r0, [r0] + ldrh r3, [r4] + cmp r0, r3 + bne _0801B490 +_0801B48C: + movs r0, 0x1 + b _0801B49C +_0801B490: + movs r7, 0x2 + add r12, r7 + adds r1, 0x1 + cmp r1, r2 + blt _0801B474 +_0801B49A: + movs r0, 0 +_0801B49C: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_801B460 + + thumb_func_start sub_801B4A4 +sub_801B4A4: @ 801B4A4 + push {lr} + adds r1, r0, 0 + ldrh r0, [r1, 0x2] + cmp r0, 0 + beq _0801B4C4 + ldrh r1, [r1] + cmp r1, 0 + beq _0801B4C4 + ldr r0, =0x0000019b + cmp r1, r0 + bhi _0801B4C4 + movs r0, 0x1 + b _0801B4C6 + .pool +_0801B4C4: + movs r0, 0 +_0801B4C6: + pop {r1} + bx r1 + thumb_func_end sub_801B4A4 + + thumb_func_start sub_801B4CC +sub_801B4CC: @ 801B4CC + push {lr} + bl sub_801B27C + cmp r0, 0 + beq _0801B500 + ldr r0, =gSaveBlock1Ptr + ldr r3, [r0] + ldr r0, =0x000033f0 + adds r2, r3, r0 + ldrb r1, [r2, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _0801B500 + movs r1, 0xD5 + lsls r1, 6 + adds r0, r3, r1 + ldrb r1, [r2, 0x9] + bl sub_801B438 + b _0801B502 + .pool +_0801B500: + movs r0, 0 +_0801B502: + pop {r1} + bx r1 + thumb_func_end sub_801B4CC + + thumb_func_start sub_801B508 +sub_801B508: @ 801B508 + push {r4-r6,lr} + adds r5, r0, 0 + ldr r6, =gSaveBlock1Ptr + ldr r0, [r6] + ldr r1, =0x000033f0 + adds r0, r1 + ldrb r4, [r0, 0x9] + adds r0, r5, 0 + bl sub_801B4A4 + cmp r0, 0 + beq _0801B572 + ldr r0, [r6] + movs r1, 0xD5 + lsls r1, 6 + adds r0, r1 + adds r1, r5, 0 + adds r2, r4, 0 + bl sub_801B460 + cmp r0, 0 + beq _0801B54C + b _0801B572 + .pool +_0801B540: + ldrh r0, [r5, 0x2] + strh r0, [r1] + ldrh r0, [r5] + strh r0, [r2] + movs r0, 0x1 + b _0801B574 +_0801B54C: + movs r3, 0 + cmp r3, r4 + bge _0801B572 + ldr r0, [r6] + ldr r6, =0x00003548 + adds r2, r0, r6 + adds r6, 0xE + adds r1, r0, r6 +_0801B55C: + ldrh r0, [r2, 0xE] + cmp r0, 0 + bne _0801B568 + ldrh r0, [r2] + cmp r0, 0 + beq _0801B540 +_0801B568: + adds r2, 0x2 + adds r1, 0x2 + adds r3, 0x1 + cmp r3, r4 + blt _0801B55C +_0801B572: + movs r0, 0 +_0801B574: + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801B508 + + thumb_func_start sub_801B580 +sub_801B580: @ 801B580 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + adds r5, r0, 0 + adds r4, r1, 0 + movs r0, 0 + str r0, [sp] + ldr r2, =0x05000019 + mov r0, sp + adds r1, r5, 0 + bl CpuSet + ldr r0, =0x00000101 + str r0, [r5] + movs r0, 0x1 + strh r0, [r5, 0x4] + str r0, [r5, 0x8] + cmp r4, 0 + beq _0801B5C0 + movs r0, 0x5 + strh r0, [r5, 0xC] + ldr r0, =0x00000201 + b _0801B5C8 + .pool +_0801B5C0: + movs r0, 0x4 + strh r0, [r5, 0xC] + movs r0, 0x80 + lsls r0, 2 +_0801B5C8: + str r0, [r5, 0x10] + bl sub_801B27C + cmp r0, 0 + beq _0801B5FC + bl sav1_get_mevent_buffer_1 + ldrh r0, [r0] + strh r0, [r5, 0x14] + bl sav1_get_mevent_buffer_2 + adds r1, r5, 0 + adds r1, 0x20 + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + bl sav1_get_mevent_buffer_1 + ldrb r1, [r0, 0x9] + adds r0, r5, 0 + adds r0, 0x44 + strb r1, [r0] + b _0801B5FE +_0801B5FC: + strh r0, [r5, 0x14] +_0801B5FE: + adds r4, r5, 0 + adds r4, 0x4C + ldr r0, =gSaveBlock2Ptr + mov r8, r0 + adds r6, r5, 0 + adds r6, 0x45 + adds r7, r5, 0 + adds r7, 0x50 + movs r1, 0x5C + adds r1, r5 + mov r9, r1 + movs r2, 0x60 + adds r2, r5 + mov r10, r2 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r3, =0x00003564 + adds r2, r0, r3 + adds r1, r5, 0 + adds r1, 0x16 + movs r3, 0x3 +_0801B628: + ldrh r0, [r2] + strh r0, [r1] + adds r2, 0x2 + adds r1, 0x2 + subs r3, 0x1 + cmp r3, 0 + bge _0801B628 + mov r0, r8 + ldr r1, [r0] + adds r1, 0xA + adds r0, r4, 0 + bl CopyUnalignedWord + mov r2, r8 + ldr r1, [r2] + adds r0, r6, 0 + bl StringCopy + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r3, =0x00002bb0 + adds r2, r0, r3 + adds r1, r7, 0 + movs r3, 0x5 +_0801B658: + ldrh r0, [r2] + strh r0, [r1] + adds r2, 0x2 + adds r1, 0x2 + subs r3, 0x1 + cmp r3, 0 + bge _0801B658 + ldr r1, =RomHeaderGameCode + mov r0, r9 + movs r2, 0x4 + bl memcpy + ldr r0, =RomHeaderSoftwareVersion + ldrb r0, [r0] + mov r4, r10 + strb r0, [r4] + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B580 + + thumb_func_start sub_801B6A0 +sub_801B6A0: @ 801B6A0 + push {r4,lr} + adds r2, r0, 0 + adds r4, r1, 0 + ldr r1, [r2] + ldr r0, =0x00000101 + cmp r1, r0 + bne _0801B6DC + ldrh r1, [r2, 0x4] + movs r3, 0x1 + adds r0, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _0801B6DC + ldr r0, [r2, 0x8] + ands r0, r3 + cmp r0, 0 + beq _0801B6DC + cmp r4, 0 + bne _0801B6E4 + ldrh r1, [r2, 0xC] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _0801B6DC + ldr r0, [r2, 0x10] + movs r1, 0xE0 + lsls r1, 2 + ands r0, r1 + cmp r0, 0 + bne _0801B6E4 +_0801B6DC: + movs r0, 0 + b _0801B6E6 + .pool +_0801B6E4: + movs r0, 0x1 +_0801B6E6: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801B6A0 + + thumb_func_start sub_801B6EC +sub_801B6EC: @ 801B6EC + push {lr} + ldrh r1, [r1, 0x14] + cmp r1, 0 + bne _0801B6F8 + movs r0, 0 + b _0801B704 +_0801B6F8: + ldrh r0, [r0] + cmp r0, r1 + beq _0801B702 + movs r0, 0x2 + b _0801B704 +_0801B702: + movs r0, 0x1 +_0801B704: + pop {r1} + bx r1 + thumb_func_end sub_801B6EC + + thumb_func_start sub_801B708 +sub_801B708: @ 801B708 + push {r4-r6,lr} + adds r6, r0, 0 + adds r4, r1, 0 + adds r5, r4, 0 + adds r5, 0x20 + adds r4, 0x44 + ldrb r1, [r4] + adds r0, r5, 0 + bl sub_801B438 + ldrb r2, [r4] + subs r4, r2, r0 + cmp r4, 0 + bne _0801B728 + movs r0, 0x1 + b _0801B742 +_0801B728: + adds r0, r5, 0 + adds r1, r6, 0 + bl sub_801B460 + cmp r0, 0 + beq _0801B738 + movs r0, 0x3 + b _0801B742 +_0801B738: + cmp r4, 0x1 + beq _0801B740 + movs r0, 0x2 + b _0801B742 +_0801B740: + movs r0, 0x4 +_0801B742: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801B708 + + thumb_func_start sub_801B748 +sub_801B748: @ 801B748 + push {r4,lr} + movs r3, 0 + adds r2, r0, 0 + adds r2, 0x16 +_0801B750: + ldrh r0, [r2] + ldrh r4, [r1] + cmp r0, r4 + beq _0801B75C + movs r0, 0 + b _0801B768 +_0801B75C: + adds r1, 0x2 + adds r2, 0x2 + adds r3, 0x1 + cmp r3, 0x3 + ble _0801B750 + movs r0, 0x1 +_0801B768: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801B748 + + thumb_func_start sub_801B770 +sub_801B770: @ 801B770 + push {lr} + adds r2, r0, 0 + adds r2, 0x20 + adds r0, 0x44 + ldrb r1, [r0] + adds r0, r2, 0 + bl sub_801B438 + pop {r1} + bx r1 + thumb_func_end sub_801B770 + + thumb_func_start sub_801B784 +sub_801B784: @ 801B784 + push {lr} + adds r2, r0, 0 + cmp r1, 0x4 + bhi _0801B7D0 + lsls r0, r1, 2 + ldr r1, =_0801B79C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801B79C: + .4byte _0801B7B0 + .4byte _0801B7B4 + .4byte _0801B7B8 + .4byte _0801B7BC + .4byte _0801B7C8 +_0801B7B0: + ldrh r0, [r2, 0x20] + b _0801B7D2 +_0801B7B4: + ldrh r0, [r2, 0x22] + b _0801B7D2 +_0801B7B8: + ldrh r0, [r2, 0x24] + b _0801B7D2 +_0801B7BC: + adds r0, r2, 0 + bl sub_801B770 + lsls r0, 16 + lsrs r0, 16 + b _0801B7D2 +_0801B7C8: + adds r0, r2, 0 + adds r0, 0x44 + ldrb r0, [r0] + b _0801B7D2 +_0801B7D0: + movs r0, 0 +_0801B7D2: + pop {r1} + bx r1 + thumb_func_end sub_801B784 + + thumb_func_start sub_801B7D8 +sub_801B7D8: @ 801B7D8 + push {r4,lr} + adds r4, r0, 0 + ldr r2, =gSaveBlock1Ptr + ldr r0, [r2] + ldr r1, =0x000033f0 + adds r0, r1 + ldrb r1, [r0, 0x8] + movs r0, 0x3 + ands r0, r1 + adds r3, r2, 0 + cmp r0, 0x2 + bne _0801B850 + movs r2, 0 + cmp r4, 0x4 + bhi _0801B83A + lsls r0, r4, 2 + ldr r1, =_0801B80C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801B80C: + .4byte _0801B820 + .4byte _0801B828 + .4byte _0801B834 + .4byte _0801B83A + .4byte _0801B83A +_0801B820: + ldr r0, [r3] + movs r1, 0xD5 + lsls r1, 6 + b _0801B838 +_0801B828: + ldr r0, [r3] + ldr r1, =0x00003542 + b _0801B838 + .pool +_0801B834: + ldr r0, [r3] + ldr r1, =0x00003544 +_0801B838: + adds r2, r0, r1 +_0801B83A: + cmp r2, 0 + beq _0801B850 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + lsls r0, 16 + lsrs r0, 16 + ldr r1, =0x000003e7 + cmp r0, r1 + bls _0801B850 + strh r1, [r2] +_0801B850: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B7D8 + + thumb_func_start mevent_081445C0 +mevent_081445C0: @ 801B860 + push {lr} + cmp r0, 0x4 + bhi _0801B938 + lsls r0, 2 + ldr r1, =_0801B874 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801B874: + .4byte _0801B888 + .4byte _0801B8AC + .4byte _0801B8D0 + .4byte _0801B8F4 + .4byte _0801B918 +_0801B888: + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r1, =0x000033f0 + adds r0, r2, r1 + ldrb r1, [r0, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x2 + bne _0801B938 + movs r1, 0xD5 + lsls r1, 6 + adds r0, r2, r1 + ldrh r0, [r0] + b _0801B93A + .pool +_0801B8AC: + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r1, =0x000033f0 + adds r0, r2, r1 + ldrb r1, [r0, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x2 + bne _0801B938 + movs r1, 0xD5 + lsls r1, 6 + adds r0, r2, r1 + ldrh r0, [r0, 0x2] + b _0801B93A + .pool +_0801B8D0: + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r1, =0x000033f0 + adds r0, r2, r1 + ldrb r1, [r0, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x2 + bne _0801B938 + movs r1, 0xD5 + lsls r1, 6 + adds r0, r2, r1 + ldrh r0, [r0, 0x4] + b _0801B93A + .pool +_0801B8F4: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x000033f0 + adds r0, r1 + ldrb r1, [r0, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _0801B938 + bl sub_801B4CC + lsls r0, 16 + lsrs r0, 16 + b _0801B93A + .pool +_0801B918: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x000033f0 + adds r2, r0, r1 + ldrb r1, [r2, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _0801B938 + ldrb r0, [r2, 0x9] + b _0801B93A + .pool +_0801B938: + movs r0, 0 +_0801B93A: + pop {r1} + bx r1 + thumb_func_end mevent_081445C0 + + thumb_func_start sub_801B940 +sub_801B940: @ 801B940 + ldr r1, =gUnknown_02022C70 + movs r0, 0 + str r0, [r1] + bx lr + .pool + thumb_func_end sub_801B940 + + thumb_func_start sub_801B94C +sub_801B94C: @ 801B94C + push {r4,r5,lr} + lsls r0, 16 + lsrs r0, 16 + adds r4, r0, 0 + ldr r5, =gUnknown_02022C70 + movs r0, 0 + str r0, [r5] + cmp r4, 0 + beq _0801B98A + bl sub_801B27C + cmp r0, 0 + beq _0801B988 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x000033f0 + adds r0, r1 + ldrh r0, [r0] + cmp r0, r4 + bne _0801B988 + movs r0, 0x1 + str r0, [r5] + b _0801B98A + .pool +_0801B988: + movs r0, 0 +_0801B98A: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_801B94C + + thumb_func_start sub_801B990 +sub_801B990: @ 801B990 + push {lr} + adds r2, r0, 0 + ldr r0, =gUnknown_02022C70 + ldr r0, [r0] + cmp r0, 0 + beq _0801B9EC + cmp r2, 0x1 + beq _0801B9DC + cmp r2, 0x1 + bcc _0801B9C0 + cmp r2, 0x2 + bne _0801B9EC + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r0, =0x00003584 + adds r2, r0 + movs r0, 0x2 + b _0801B9CA + .pool +_0801B9C0: + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r0, =0x00003570 + adds r2, r0 + movs r0, 0 +_0801B9CA: + movs r3, 0x5 + bl sub_801BA8C + b _0801B9EC + .pool +_0801B9DC: + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r0, =0x00003570 + adds r2, r0 + movs r0, 0x1 + movs r3, 0x5 + bl sub_801BA8C +_0801B9EC: + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B990 + + thumb_func_start sub_801B9F8 +sub_801B9F8: @ 801B9F8 + push {lr} + sub sp, 0x4 + movs r0, 0 + str r0, [sp] + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldr r0, =0x00003570 + adds r1, r0 + ldr r2, =0x0500000a + mov r0, sp + bl CpuSet + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_801B9F8 + + thumb_func_start sub_801BA24 +sub_801BA24: @ 801BA24 + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r1, 0 + movs r1, 0 + cmp r1, r2 + bge _0801BA46 + ldr r0, [r4] + cmp r0, r5 + beq _0801BA46 + adds r3, r4, 0 +_0801BA38: + adds r3, 0x4 + adds r1, 0x1 + cmp r1, r2 + bge _0801BA46 + ldr r0, [r3] + cmp r0, r5 + bne _0801BA38 +_0801BA46: + cmp r1, r2 + bne _0801BA68 + subs r3, r1, 0x1 + cmp r3, 0 + ble _0801BA62 + lsls r0, r3, 2 + subs r0, 0x4 + adds r2, r0, r4 +_0801BA56: + ldr r0, [r2] + str r0, [r2, 0x4] + subs r2, 0x4 + subs r3, 0x1 + cmp r3, 0 + bgt _0801BA56 +_0801BA62: + str r5, [r4] + movs r0, 0x1 + b _0801BA84 +_0801BA68: + adds r3, r1, 0 + cmp r3, 0 + ble _0801BA80 + lsls r0, r3, 2 + subs r0, 0x4 + adds r2, r0, r4 +_0801BA74: + ldr r0, [r2] + str r0, [r2, 0x4] + subs r2, 0x4 + subs r3, 0x1 + cmp r3, 0 + bgt _0801BA74 +_0801BA80: + str r5, [r4] + movs r0, 0 +_0801BA84: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_801BA24 + + thumb_func_start sub_801BA8C +sub_801BA8C: @ 801BA8C + push {r4,lr} + adds r4, r0, 0 + adds r0, r1, 0 + adds r1, r2, 0 + adds r2, r3, 0 + bl sub_801BA24 + cmp r0, 0 + beq _0801BAA4 + adds r0, r4, 0 + bl sub_801B7D8 +_0801BAA4: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801BA8C + + thumb_func_start sub_801BAAC +sub_801BAAC: @ 801BAAC + push {r4-r7,lr} + adds r5, r0, 0 + adds r6, r1, 0 + cmp r5, 0 + beq _0801BAC8 + cmp r6, 0 + beq _0801BAC8 + ldr r7, =gUnknown_02022C74 + ldr r0, =0x0000145c + bl AllocZeroed + str r0, [r7] + cmp r0, 0 + bne _0801BAD4 +_0801BAC8: + movs r0, 0 + b _0801BB3E + .pool +_0801BAD4: + movs r4, 0xA6 + lsls r4, 1 + adds r1, r5, 0 + adds r2, r4, 0 + bl memcpy + ldr r1, [r7] + adds r1, r4 + adds r0, r6, 0 + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldr r2, [r7] + ldrb r1, [r2, 0x8] + lsls r0, r1, 26 + lsrs r0, 28 + cmp r0, 0x7 + bls _0801BB06 + movs r0, 0x3D + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0x8] +_0801BB06: + ldr r2, [r7] + ldrb r1, [r2, 0x8] + lsls r0, r1, 30 + lsrs r0, 30 + cmp r0, 0x2 + bls _0801BB1A + movs r0, 0x4 + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0x8] +_0801BB1A: + ldr r1, [r7] + ldrb r0, [r1, 0x9] + cmp r0, 0x7 + bls _0801BB26 + movs r0, 0 + strb r0, [r1, 0x9] +_0801BB26: + ldr r0, [r7] + movs r1, 0xB8 + lsls r1, 1 + adds r2, r0, r1 + ldrb r0, [r0, 0x8] + lsls r0, 26 + lsrs r0, 28 + lsls r0, 4 + ldr r1, =gUnknown_082F1D60 + adds r0, r1 + str r0, [r2] + movs r0, 0x1 +_0801BB3E: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801BAAC + + thumb_func_start sub_801BB48 +sub_801BB48: @ 801BB48 + push {r4,lr} + ldr r4, =gUnknown_02022C74 + ldr r0, [r4] + cmp r0, 0 + beq _0801BB64 + ldr r2, =0x0000145c + movs r1, 0 + bl memset + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] +_0801BB64: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801BB48 + + thumb_func_start sub_801BB74 +sub_801BB74: @ 801BB74 + push {r4-r6,lr} + sub sp, 0x24 + ldr r5, =gUnknown_02022C74 + ldr r0, [r5] + cmp r0, 0 + bne _0801BB8C + movs r0, 0x1 + negs r0, r0 + b _0801BD98 + .pool +_0801BB8C: + movs r4, 0xBA + lsls r4, 1 + adds r0, r4 + ldrb r0, [r0] + cmp r0, 0x7 + bls _0801BB9A + b _0801BD70 +_0801BB9A: + lsls r0, 2 + ldr r1, =_0801BBA8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801BBA8: + .4byte _0801BBC8 + .4byte _0801BBDA + .4byte _0801BBE8 + .4byte _0801BC8C + .4byte _0801BD14 + .4byte _0801BD1A + .4byte _0801BD34 + .4byte _0801BD3A +_0801BBC8: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _0801BD86 +_0801BBDA: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + bne _0801BBE6 + b _0801BD86 +_0801BBE6: + b _0801BD96 +_0801BBE8: + movs r5, 0x1E + str r5, [sp] + movs r4, 0x14 + str r4, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + ldr r5, =gUnknown_02022C74 + ldr r0, [r5] + movs r1, 0xB8 + lsls r1, 1 + adds r0, r1 + ldr r0, [r0] + ldr r1, [r0, 0x4] + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + movs r2, 0 + movs r3, 0x8 + bl decompress_and_copy_tile_data_to_vram + ldr r4, =gUnknown_082F0E1C + adds r0, r4, 0 + bl AddWindow + ldr r1, [r5] + movs r2, 0xBB + lsls r2, 1 + adds r1, r2 + strh r0, [r1] + adds r0, r4, 0 + adds r0, 0x8 + bl AddWindow + ldr r1, [r5] + movs r2, 0xBC + lsls r2, 1 + adds r1, r2 + strh r0, [r1] + adds r4, 0x10 + adds r0, r4, 0 + bl AddWindow + ldr r1, [r5] + movs r2, 0xBD + lsls r2, 1 + adds r1, r2 + strh r0, [r1] + b _0801BD86 + .pool +_0801BC8C: + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, 0 + beq _0801BC9A + b _0801BD96 +_0801BC9A: + movs r0, 0x1 + bl stdpal_get + movs r1, 0x20 + movs r2, 0x20 + bl LoadPalette + ldr r2, =gPaletteFade + ldrb r0, [r2, 0x8] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r2, 0x8] + ldr r5, =gUnknown_02022C74 + ldr r0, [r5] + movs r4, 0xB8 + lsls r4, 1 + adds r0, r4 + ldr r0, [r0] + ldr r0, [r0, 0xC] + movs r1, 0x10 + movs r2, 0x20 + bl LoadPalette + ldr r1, [r5] + adds r4, r1, r4 + ldr r0, [r4] + ldr r0, [r0, 0x8] + ldr r4, =0x0000045c + adds r1, r4 + bl LZ77UnCompWram + ldr r1, [r5] + adds r1, r4 + movs r2, 0x1E + str r2, [sp] + movs r0, 0x14 + str r0, [sp, 0x4] + str r6, [sp, 0x8] + str r6, [sp, 0xC] + str r2, [sp, 0x10] + str r0, [sp, 0x14] + movs r0, 0x1 + str r0, [sp, 0x18] + movs r0, 0x8 + str r0, [sp, 0x1C] + str r6, [sp, 0x20] + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl CopyRectToBgTilemapBufferRect + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + b _0801BD86 + .pool +_0801BD14: + bl sub_801BEF8 + b _0801BD86 +_0801BD1A: + movs r0, 0 + bl sub_801C178 + movs r0, 0x1 + bl sub_801C178 + movs r0, 0x2 + bl sub_801C178 + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + b _0801BD86 +_0801BD34: + bl sub_80D2F04 + b _0801BD86 +_0801BD3A: + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + ldr r2, =gPaletteFade + ldrb r1, [r2, 0x8] + movs r0, 0x7F + ands r0, r1 + strb r0, [r2, 0x8] + bl sub_801C4C0 + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + bl UpdatePaletteFade + b _0801BD86 + .pool +_0801BD70: + bl UpdatePaletteFade + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + bne _0801BD96 + ldr r0, [r5] + adds r0, r4 + strb r1, [r0] + movs r0, 0x1 + b _0801BD98 +_0801BD86: + ldr r0, =gUnknown_02022C74 + ldr r1, [r0] + movs r0, 0xBA + lsls r0, 1 + adds r1, r0 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] +_0801BD96: + movs r0, 0 +_0801BD98: + add sp, 0x24 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801BB74 + + thumb_func_start sub_801BDA4 +sub_801BDA4: @ 801BDA4 + push {r4,r5,lr} + sub sp, 0x8 + adds r2, r0, 0 + ldr r5, =gUnknown_02022C74 + ldr r0, [r5] + cmp r0, 0 + bne _0801BDBC + movs r0, 0x1 + negs r0, r0 + b _0801BEEC + .pool +_0801BDBC: + movs r4, 0xBA + lsls r4, 1 + adds r0, r4 + ldrb r0, [r0] + cmp r0, 0x5 + bls _0801BDCA + b _0801BEC4 +_0801BDCA: + lsls r0, 2 + ldr r1, =_0801BDD8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801BDD8: + .4byte _0801BDF0 + .4byte _0801BE02 + .4byte _0801BE0E + .4byte _0801BE56 + .4byte _0801BE94 + .4byte _0801BE9E +_0801BDF0: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _0801BEDA +_0801BE02: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + beq _0801BEDA + b _0801BEEA +_0801BE0E: + movs r5, 0x1E + str r5, [sp] + movs r4, 0x14 + str r4, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + b _0801BEDA +_0801BE56: + movs r0, 0x1 + bl HideBg + movs r0, 0x2 + bl HideBg + ldr r4, =gUnknown_02022C74 + ldr r0, [r4] + movs r1, 0xBD + lsls r1, 1 + adds r0, r1 + ldrb r0, [r0] + bl RemoveWindow + ldr r0, [r4] + movs r1, 0xBC + lsls r1, 1 + adds r0, r1 + ldrb r0, [r0] + bl RemoveWindow + ldr r0, [r4] + movs r1, 0xBB + lsls r1, 1 + adds r0, r1 + ldrb r0, [r0] + bl RemoveWindow + b _0801BEDA + .pool +_0801BE94: + bl sub_801C61C + bl sub_80D2F9C + b _0801BEDA +_0801BE9E: + ldr r0, =gUnknown_02022C60 + ldrb r0, [r0] + adds r1, r2, 0 + bl sub_80186EC + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + b _0801BEDA + .pool +_0801BEC4: + bl UpdatePaletteFade + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + bne _0801BEEA + ldr r0, [r5] + adds r0, r4 + strb r1, [r0] + movs r0, 0x1 + b _0801BEEC +_0801BEDA: + ldr r0, =gUnknown_02022C74 + ldr r1, [r0] + movs r0, 0xBA + lsls r0, 1 + adds r1, r0 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] +_0801BEEA: + movs r0, 0 +_0801BEEC: + add sp, 0x8 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801BDA4 + + thumb_func_start sub_801BEF8 +sub_801BEF8: @ 801BEF8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + movs r5, 0 + mov r0, sp + movs r1, 0 + movs r2, 0x6 + bl memset + ldr r4, =gUnknown_02022C74 + ldr r1, [r4] + ldr r2, =0x0000018b + adds r0, r1, r2 + adds r1, 0xA + movs r2, 0x28 + bl memcpy + ldr r0, [r4] + ldr r3, =0x000001b3 + adds r1, r0, r3 + movs r0, 0xFF + strb r0, [r1] + ldr r1, [r4] + movs r2, 0xDA + lsls r2, 1 + adds r0, r1, r2 + adds r1, 0x32 + movs r2, 0x28 + bl memcpy + ldr r0, [r4] + movs r3, 0xEE + lsls r3, 1 + adds r0, r3 + movs r1, 0x1 + negs r1, r1 + strb r1, [r0] + ldr r1, [r4] + ldr r0, [r1, 0x4] + ldr r2, =0x000f423f + cmp r0, r2 + bls _0801BF54 + str r2, [r1, 0x4] +_0801BF54: + ldr r1, [r4] + ldr r2, =0x000001dd + adds r0, r1, r2 + ldr r1, [r1, 0x4] + movs r2, 0 + movs r3, 0x6 + bl ConvertIntToDecimalStringN + adds r6, r4, 0 +_0801BF66: + ldr r2, [r6] + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r4, r1, r5 + adds r0, r4, r2 + movs r3, 0xF2 + lsls r3, 1 + adds r0, r3 + adds r1, r2 + adds r1, 0x5A + movs r2, 0x28 + bl memcpy + ldr r1, [r6] + movs r0, 0x83 + lsls r0, 2 + adds r1, r0 + adds r1, r4 + movs r2, 0x1 + negs r2, r2 + adds r7, r2, 0 + movs r0, 0xFF + strb r0, [r1] + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0x3 + bls _0801BF66 + ldr r6, =gUnknown_02022C74 + ldr r1, [r6] + movs r3, 0xA2 + lsls r3, 2 + adds r0, r1, r3 + adds r1, 0xFA + movs r2, 0x28 + bl memcpy + ldr r0, [r6] + movs r4, 0xAC + lsls r4, 2 + adds r0, r4 + movs r1, 0x1 + negs r1, r1 + adds r4, r1, 0 + movs r1, 0xFF + strb r1, [r0] + ldr r1, [r6] + ldrb r0, [r1, 0x8] + lsls r0, 30 + lsrs r0, 30 + cmp r0, 0x1 + beq _0801C018 + cmp r0, 0x1 + bgt _0801BFF0 + cmp r0, 0 + beq _0801BFF6 + b _0801C168 + .pool +_0801BFF0: + cmp r0, 0x2 + beq _0801C028 + b _0801C168 +_0801BFF6: + ldr r2, =0x000002b1 + adds r0, r1, r2 + movs r3, 0x91 + lsls r3, 1 + adds r1, r3 + movs r2, 0x28 + bl memcpy + ldr r1, [r6] + ldr r0, =0x000002d9 + adds r1, r0 + b _0801C01C + .pool +_0801C018: + ldr r2, =0x000002b1 + adds r1, r2 +_0801C01C: + ldrb r0, [r1] + orrs r0, r4 + strb r0, [r1] + b _0801C168 + .pool +_0801C028: + ldr r3, =0x000002b1 + adds r0, r1, r3 + ldrb r1, [r0] + orrs r1, r7 + strb r1, [r0] + mov r3, sp + ldr r1, [r6] + movs r4, 0xA6 + lsls r4, 1 + adds r0, r1, r4 + ldrh r0, [r0] + ldr r2, =0x000003e7 + cmp r0, r2 + bls _0801C046 + adds r0, r2, 0 +_0801C046: + strh r0, [r3] + mov r3, sp + movs r4, 0xA7 + lsls r4, 1 + adds r0, r1, r4 + ldrh r0, [r0] + cmp r0, r2 + bls _0801C058 + adds r0, r2, 0 +_0801C058: + strh r0, [r3, 0x2] + mov r3, sp + movs r4, 0xA8 + lsls r4, 1 + adds r0, r1, r4 + ldrh r0, [r0] + cmp r0, r2 + bls _0801C06A + adds r0, r2, 0 +_0801C06A: + strh r0, [r3, 0x4] + movs r5, 0 +_0801C06E: + lsls r4, r5, 1 + adds r4, r5 + lsls r4, 4 + movs r0, 0xB7 + lsls r0, 2 + adds r4, r0 + ldr r0, [r6] + adds r0, r4 + adds r0, 0x2A + movs r1, 0xFF + movs r2, 0x4 + bl memset + ldr r0, [r6] + adds r0, r4 + adds r0, 0x1 + movs r1, 0xFF + movs r2, 0x29 + bl memset + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0x7 + bls _0801C06E + movs r5, 0 + movs r6, 0 + ldr r1, =gUnknown_02022C74 + mov r8, r1 + movs r2, 0x91 + lsls r2, 1 + mov r10, r2 + ldr r7, =0x00000175 + movs r3, 0xB7 + lsls r3, 2 + mov r9, r3 +_0801C0B6: + mov r4, r8 + ldr r2, [r4] + mov r0, r10 + adds r1, r2, r0 + adds r0, r1, r5 + ldrb r3, [r0] + cmp r3, 0xF7 + beq _0801C0F8 + ldr r1, =0x00000175 + adds r0, r2, r1 + ldrb r1, [r0] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 4 + adds r0, r6, r0 + ldr r4, =0x000002dd + adds r1, r2, r4 + adds r1, r0 + strb r3, [r1] + adds r0, r6, 0x1 + lsls r0, 16 + lsrs r6, r0, 16 + b _0801C15E + .pool +_0801C0F8: + adds r0, r5, 0x1 + adds r0, r1, r0 + ldrb r3, [r0] + cmp r3, 0x2 + bls _0801C108 + adds r0, r5, 0x2 + lsls r0, 16 + b _0801C15C +_0801C108: + adds r0, r2, r7 + ldrb r1, [r0] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 4 + add r0, r9 + adds r0, r2, r0 + adds r0, 0x2A + lsls r1, r3, 1 + add r1, sp + ldrh r1, [r1] + movs r2, 0x2 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + mov r0, r8 + ldr r1, [r0] + adds r0, r1, r7 + ldrb r2, [r0] + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 4 + adds r0, r1, r0 + adds r4, r5, 0x2 + add r1, r10 + adds r1, r4 + ldrb r1, [r1] + add r0, r9 + strb r1, [r0] + mov r2, r8 + ldr r1, [r2] + adds r1, r7 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + ldr r0, [r2] + adds r0, r7 + ldrb r0, [r0] + cmp r0, 0x7 + bhi _0801C168 + movs r6, 0 + lsls r0, r4, 16 +_0801C15C: + lsrs r5, r0, 16 +_0801C15E: + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0x27 + bls _0801C0B6 +_0801C168: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_801BEF8 + + thumb_func_start sub_801C178 +sub_801C178: @ 801C178 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + lsls r0, 24 + lsrs r4, r0, 24 + mov r8, r4 + movs r0, 0 + str r0, [sp, 0xC] + ldr r7, =gUnknown_02022C74 + ldr r0, [r7] + lsls r1, r4, 1 + movs r2, 0xBB + lsls r2, 1 + adds r0, r2 + adds r0, r1 + ldrh r0, [r0] + lsls r6, r0, 24 + lsrs r5, r6, 24 + adds r0, r5, 0 + bl PutWindowTilemap + adds r0, r5, 0 + movs r1, 0 + bl FillWindowPixelBuffer + cmp r4, 0x1 + beq _0801C2A0 + cmp r4, 0x1 + bgt _0801C1C4 + cmp r4, 0 + beq _0801C1D0 + mov r9, r6 + b _0801C498 + .pool +_0801C1C4: + mov r0, r8 + cmp r0, 0x2 + bne _0801C1CC + b _0801C304 +_0801C1CC: + mov r9, r6 + b _0801C498 +_0801C1D0: + ldr r2, [r7] + movs r1, 0xB8 + lsls r1, 1 + mov r10, r1 + adds r0, r2, r1 + ldr r0, [r0] + ldrb r0, [r0] + lsls r0, 28 + lsrs r0, 28 + lsls r1, r0, 1 + adds r1, r0 + ldr r0, =gUnknown_082F0E10 + mov r8, r0 + add r1, r8 + str r1, [sp] + ldr r1, [sp, 0xC] + str r1, [sp, 0x4] + ldr r0, =0x0000018b + adds r2, r0 + str r2, [sp, 0x8] + adds r0, r5, 0 + movs r1, 0x3 + movs r2, 0 + movs r3, 0x1 + bl box_print + ldr r4, [r7] + movs r1, 0xDA + lsls r1, 1 + mov r9, r1 + add r4, r9 + movs r0, 0x3 + movs r1, 0x2 + bl GetFontAttribute + adds r2, r0, 0 + lsls r2, 24 + lsrs r2, 24 + movs r0, 0x3 + adds r1, r4, 0 + bl GetStringWidth + movs r1, 0xA0 + subs r1, r0 + cmp r1, 0 + bge _0801C22E + movs r1, 0 +_0801C22E: + lsls r2, r1, 24 + lsrs r2, 24 + ldr r3, [r7] + mov r1, r10 + adds r0, r3, r1 + ldr r0, [r0] + ldrb r1, [r0] + lsls r1, 28 + lsrs r1, 28 + lsls r0, r1, 1 + adds r0, r1 + add r0, r8 + str r0, [sp] + ldr r0, [sp, 0xC] + str r0, [sp, 0x4] + add r3, r9 + str r3, [sp, 0x8] + adds r0, r5, 0 + movs r1, 0x3 + movs r3, 0x11 + bl box_print + ldr r2, [r7] + ldr r0, [r2, 0x4] + mov r9, r6 + cmp r0, 0 + bne _0801C266 + b _0801C498 +_0801C266: + mov r1, r10 + adds r0, r2, r1 + ldr r0, [r0] + ldrb r1, [r0] + lsls r1, 28 + lsrs r1, 28 + lsls r0, r1, 1 + adds r0, r1 + add r0, r8 + str r0, [sp] + ldr r0, [sp, 0xC] + str r0, [sp, 0x4] + ldr r1, =0x000001dd + adds r0, r2, r1 + str r0, [sp, 0x8] + adds r0, r5, 0 + movs r1, 0x1 + movs r2, 0xA6 + movs r3, 0x11 + bl box_print + b _0801C498 + .pool +_0801C2A0: + mov r9, r6 +_0801C2A2: + ldr r2, [sp, 0xC] + lsls r4, r2, 24 + asrs r4, 24 + lsls r3, r4, 4 + adds r3, 0x2 + lsls r3, 24 + lsrs r3, 24 + ldr r0, =gUnknown_02022C74 + ldr r2, [r0] + movs r1, 0xB8 + lsls r1, 1 + adds r0, r2, r1 + ldr r0, [r0] + ldrb r0, [r0] + lsrs r0, 4 + lsls r1, r0, 1 + adds r1, r0 + ldr r0, =gUnknown_082F0E10 + adds r1, r0 + str r1, [sp] + movs r0, 0 + str r0, [sp, 0x4] + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r4 + movs r1, 0xF2 + lsls r1, 1 + adds r0, r1 + adds r2, r0 + str r2, [sp, 0x8] + mov r2, r9 + lsrs r0, r2, 24 + movs r1, 0x3 + movs r2, 0 + bl box_print + adds r4, 0x1 + lsls r4, 24 + lsrs r0, r4, 24 + str r0, [sp, 0xC] + asrs r4, 24 + cmp r4, 0x3 + ble _0801C2A2 + b _0801C498 + .pool +_0801C304: + ldr r4, =gUnknown_082F0E18 + ldr r2, [r7] + ldrb r0, [r2, 0x8] + lsls r0, 30 + lsrs r0, 30 + adds r0, r4 + ldrb r3, [r0] + movs r1, 0xB8 + lsls r1, 1 + adds r0, r2, r1 + ldr r0, [r0] + ldrb r0, [r0, 0x1] + lsls r0, 28 + lsrs r0, 28 + lsls r1, r0, 1 + adds r1, r0 + ldr r0, =gUnknown_082F0E10 + mov r10, r0 + add r1, r10 + str r1, [sp] + ldr r1, [sp, 0xC] + str r1, [sp, 0x4] + movs r1, 0xA2 + lsls r1, 2 + adds r0, r2, r1 + str r0, [sp, 0x8] + adds r0, r5, 0 + movs r1, 0x3 + movs r2, 0 + bl box_print + ldr r2, [r7] + ldrb r1, [r2, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x2 + beq _0801C398 + lsls r0, r1, 30 + lsrs r0, 30 + adds r0, r4 + ldrb r3, [r0] + adds r3, 0x10 + lsls r3, 24 + lsrs r3, 24 + movs r1, 0xB8 + lsls r1, 1 + adds r0, r2, r1 + ldr r0, [r0] + ldrb r1, [r0, 0x1] + lsls r1, 28 + lsrs r1, 28 + lsls r0, r1, 1 + adds r0, r1 + add r0, r10 + str r0, [sp] + ldr r0, [sp, 0xC] + str r0, [sp, 0x4] + ldr r1, =0x000002b1 + adds r0, r2, r1 + str r0, [sp, 0x8] + adds r0, r5, 0 + movs r1, 0x3 + movs r2, 0 + bl box_print + mov r9, r6 + b _0801C498 + .pool +_0801C398: + movs r2, 0 + mov r8, r2 + lsls r0, r1, 30 + lsrs r0, 30 + adds r0, r4 + ldrb r0, [r0] + adds r4, r0, 0 + adds r4, 0x10 + movs r0, 0x3 + movs r1, 0x2 + bl GetFontAttribute + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, [r7] + ldr r1, =0x00000175 + adds r0, r1 + mov r9, r6 + ldr r1, [sp, 0xC] + ldrb r0, [r0] + cmp r1, r0 + bge _0801C498 + str r5, [sp, 0x10] + lsls r0, r4, 24 + lsrs r0, 24 + str r0, [sp, 0x14] + mov r10, r2 +_0801C3CE: + mov r0, r8 + lsls r2, r0, 24 + lsrs r2, 24 + ldr r3, [r7] + movs r1, 0xB8 + lsls r1, 1 + adds r0, r3, r1 + ldr r0, [r0] + ldrb r1, [r0, 0x1] + lsls r1, 28 + lsrs r1, 28 + lsls r0, r1, 1 + adds r0, r1 + ldr r1, =gUnknown_082F0E10 + adds r0, r1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + ldr r1, [sp, 0xC] + lsls r0, r1, 24 + asrs r6, r0, 24 + lsls r0, r6, 1 + adds r0, r6 + lsls r5, r0, 4 + movs r0, 0xB7 + lsls r0, 2 + adds r4, r5, r0 + adds r3, r4 + adds r3, 0x1 + str r3, [sp, 0x8] + ldr r0, [sp, 0x10] + movs r1, 0x3 + ldr r3, [sp, 0x14] + bl box_print + ldr r1, [r7] + adds r0, r1, r5 + ldr r2, =0x00000306 + adds r0, r2 + ldrb r0, [r0] + cmp r0, 0xFF + beq _0801C482 + adds r1, r4 + adds r1, 0x1 + movs r0, 0x3 + mov r2, r10 + bl GetStringWidth + add r8, r0 + mov r0, r8 + lsls r2, r0, 24 + lsrs r2, 24 + ldr r3, [r7] + movs r1, 0xB8 + lsls r1, 1 + adds r0, r3, r1 + ldr r0, [r0] + ldrb r1, [r0, 0x1] + lsls r1, 28 + lsrs r1, 28 + lsls r0, r1, 1 + adds r0, r1 + ldr r1, =gUnknown_082F0E10 + adds r0, r1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + adds r3, r4 + adds r3, 0x2A + str r3, [sp, 0x8] + ldr r0, [sp, 0x10] + movs r1, 0x3 + ldr r3, [sp, 0x14] + bl box_print + ldr r1, [r7] + adds r1, r4 + adds r1, 0x2A + movs r0, 0x3 + mov r2, r10 + bl GetStringWidth + ldr r1, [r7] + adds r1, r5 + movs r2, 0xB7 + lsls r2, 2 + adds r1, r2 + ldrb r1, [r1] + adds r0, r1 + add r8, r0 +_0801C482: + adds r1, r6, 0x1 + lsls r1, 24 + lsrs r0, r1, 24 + str r0, [sp, 0xC] + asrs r1, 24 + ldr r0, [r7] + ldr r2, =0x00000175 + adds r0, r2 + ldrb r0, [r0] + cmp r1, r0 + blt _0801C3CE +_0801C498: + mov r1, r9 + lsrs r0, r1, 24 + movs r1, 0x3 + bl CopyWindowToVram + 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 sub_801C178 + + thumb_func_start sub_801C4C0 +sub_801C4C0: @ 801C4C0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + movs r7, 0 + ldr r4, =gUnknown_02022C74 + ldr r0, [r4] + movs r1, 0xBE + lsls r1, 1 + adds r0, r1 + movs r1, 0xFF + strb r1, [r0] + ldr r0, [r4] + movs r2, 0xA9 + lsls r2, 1 + adds r1, r0, r2 + ldrh r0, [r1] + cmp r0, 0 + beq _0801C52C + bl sub_80D2E84 + lsls r0, 16 + lsrs r0, 16 + ldr r1, =SpriteCallbackDummy + str r7, [sp] + str r7, [sp, 0x4] + movs r2, 0xDC + movs r3, 0x14 + bl sub_80D2D78 + ldr r1, [r4] + movs r2, 0xBE + lsls r2, 1 + adds r1, r2 + strb r0, [r1] + ldr r2, =gSprites + ldr r0, [r4] + movs r1, 0xBE + lsls r1, 1 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + ldrb r2, [r0, 0x5] + movs r1, 0xD + negs r1, r1 + ands r1, r2 + movs r2, 0x8 + orrs r1, r2 + strb r1, [r0, 0x5] +_0801C52C: + ldr r1, [r4] + ldrb r0, [r1, 0x9] + cmp r0, 0 + beq _0801C5EE + ldrb r1, [r1, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _0801C5EE + ldr r0, =gUnknown_082F1D00 + bl LoadCompressedObjectPicUsingHeap + ldr r0, [r4] + movs r2, 0xB8 + lsls r2, 1 + adds r0, r2 + ldr r0, [r0] + ldrb r0, [r0, 0x1] + lsrs r0, 4 + lsls r0, 3 + ldr r1, =gUnknown_082F1D08 + adds r0, r1 + bl LoadSpritePalette + ldr r0, [r4] + ldrb r0, [r0, 0x9] + cmp r7, r0 + bcs _0801C5EE + adds r6, r4, 0 + ldr r0, =0x0000017d + mov r10, r0 + movs r1, 0 + mov r9, r1 + movs r2, 0xFF + mov r8, r2 +_0801C572: + ldr r1, [r6] + lsls r4, r7, 1 + add r1, r10 + adds r1, r4 + ldrb r0, [r1] + mov r2, r8 + orrs r0, r2 + strb r0, [r1] + ldr r1, [r6] + movs r0, 0xBF + lsls r0, 1 + adds r1, r0 + adds r1, r4 + ldrb r0, [r1] + orrs r0, r2 + strb r0, [r1] + lsls r1, r7, 5 + movs r0, 0xD8 + subs r5, r0, r1 + ldr r0, =gUnknown_082F1D48 + adds r1, r5, 0 + movs r2, 0x90 + movs r3, 0x8 + bl CreateSprite + ldr r1, [r6] + add r1, r10 + adds r1, r4 + strb r0, [r1] + ldr r0, [r6] + movs r1, 0xAA + lsls r1, 1 + adds r0, r1 + adds r1, r0, r4 + ldrh r0, [r1] + cmp r0, 0 + beq _0801C5E0 + bl sub_80D2E84 + lsls r0, 16 + lsrs r0, 16 + mov r2, r9 + str r2, [sp] + str r2, [sp, 0x4] + ldr r1, =SpriteCallbackDummy + adds r2, r5, 0 + movs r3, 0x88 + bl sub_80D2D78 + ldr r1, [r6] + movs r2, 0xBF + lsls r2, 1 + adds r1, r2 + adds r1, r4 + strb r0, [r1] +_0801C5E0: + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldr r0, [r6] + ldrb r0, [r0, 0x9] + cmp r7, r0 + bcc _0801C572 +_0801C5EE: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801C4C0 + + thumb_func_start sub_801C61C +sub_801C61C: @ 801C61C + push {r4-r7,lr} + movs r5, 0 + ldr r4, =gUnknown_02022C74 + ldr r0, [r4] + movs r2, 0xBE + lsls r2, 1 + adds r1, r0, r2 + ldrb r0, [r1] + cmp r0, 0xFF + beq _0801C640 + adds r1, r0, 0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + bl sub_80D2EF8 +_0801C640: + ldr r0, [r4] + ldrb r2, [r0, 0x9] + cmp r2, 0 + beq _0801C6B4 + ldrb r1, [r0, 0x8] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0x1 + bne _0801C6B4 + cmp r5, r2 + bcs _0801C6A4 + adds r6, r4, 0 + ldr r7, =gSprites +_0801C65A: + ldr r0, [r6] + lsls r4, r5, 1 + ldr r1, =0x0000017d + adds r0, r1 + adds r1, r0, r4 + ldrb r0, [r1] + cmp r0, 0xFF + beq _0801C678 + adds r1, r0, 0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r7 + bl DestroySprite +_0801C678: + ldr r0, [r6] + movs r2, 0xBF + lsls r2, 1 + adds r0, r2 + adds r1, r0, r4 + ldrb r0, [r1] + cmp r0, 0xFF + beq _0801C696 + adds r1, r0, 0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r7 + bl sub_80D2EF8 +_0801C696: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, [r6] + ldrb r0, [r0, 0x9] + cmp r5, r0 + bcc _0801C65A +_0801C6A4: + movs r4, 0x80 + lsls r4, 8 + adds r0, r4, 0 + bl FreeSpriteTilesByTag + adds r0, r4, 0 + bl FreeSpritePaletteByTag +_0801C6B4: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801C61C + + thumb_func_start sub_801C6C8 +sub_801C6C8: @ 801C6C8 + push {r4-r6,lr} + adds r4, r0, 0 + cmp r4, 0 + beq _0801C6DE + ldr r5, =gUnknown_02022C78 + ldr r0, =0x000013a4 + bl AllocZeroed + str r0, [r5] + cmp r0, 0 + bne _0801C6EC +_0801C6DE: + movs r0, 0 + b _0801C71C + .pool +_0801C6EC: + movs r6, 0xDE + lsls r6, 1 + adds r1, r4, 0 + adds r2, r6, 0 + bl memcpy + ldr r1, [r5] + ldrb r0, [r1, 0x3] + cmp r0, 0x7 + bls _0801C704 + movs r0, 0 + strb r0, [r1, 0x3] +_0801C704: + ldr r2, [r5] + adds r3, r2, r6 + ldrb r0, [r2, 0x3] + lsls r0, 4 + ldr r1, =gUnknown_082F24C8 + adds r0, r1 + str r0, [r3] + ldr r0, =0x000001c1 + adds r1, r2, r0 + movs r0, 0xFF + strb r0, [r1] + movs r0, 0x1 +_0801C71C: + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801C6C8 + + thumb_func_start sub_801C72C +sub_801C72C: @ 801C72C + push {r4,lr} + ldr r4, =gUnknown_02022C78 + ldr r0, [r4] + cmp r0, 0 + beq _0801C748 + ldr r2, =0x000013a4 + movs r1, 0 + bl memset + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] +_0801C748: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801C72C + + thumb_func_start sub_801C758 +sub_801C758: @ 801C758 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x24 + ldr r5, =gUnknown_02022C78 + ldr r0, [r5] + cmp r0, 0 + bne _0801C778 + movs r0, 0x1 + negs r0, r0 + b _0801CA3A + .pool +_0801C778: + movs r4, 0xE0 + lsls r4, 1 + adds r0, r4 + ldrb r0, [r0] + lsrs r0, 1 + cmp r0, 0x6 + bls _0801C788 + b _0801CA04 +_0801C788: + lsls r0, 2 + ldr r1, =_0801C798 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801C798: + .4byte _0801C7B4 + .4byte _0801C7C6 + .4byte _0801C82C + .4byte _0801C8D4 + .4byte _0801C990 + .4byte _0801C996 + .4byte _0801C9A8 +_0801C7B4: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _0801CA1E +_0801C7C6: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + beq _0801C7D2 + b _0801CA38 +_0801C7D2: + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x40 + movs r1, 0xF0 + bl SetGpuReg + ldr r1, =0x00001a98 + movs r0, 0x44 + bl SetGpuReg + movs r0, 0x48 + movs r1, 0x1F + bl SetGpuReg + movs r0, 0x4A + movs r1, 0x1B + bl SetGpuReg + movs r1, 0x80 + lsls r1, 6 + movs r0, 0 + bl SetGpuRegBits + b _0801CA1E + .pool +_0801C82C: + movs r5, 0x1E + str r5, [sp] + movs r4, 0x14 + str r4, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + ldr r5, =gUnknown_02022C78 + ldr r0, [r5] + movs r1, 0xDE + lsls r1, 1 + adds r0, r1 + ldr r0, [r0] + ldr r1, [r0, 0x4] + movs r0, 0 + str r0, [sp] + movs r0, 0x3 + movs r2, 0 + movs r3, 0x8 + bl decompress_and_copy_tile_data_to_vram + ldr r4, =gUnknown_082F1DE8 + adds r0, r4, 0 + bl AddWindow + ldr r1, [r5] + movs r2, 0xE4 + lsls r2, 1 + adds r1, r2 + strh r0, [r1] + adds r4, 0x8 + adds r0, r4, 0 + bl AddWindow + ldr r1, [r5] + movs r3, 0xE5 + lsls r3, 1 + adds r1, r3 + strh r0, [r1] + b _0801CA1E + .pool +_0801C8D4: + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + lsrs r7, r0, 24 + cmp r7, 0 + beq _0801C8E2 + b _0801CA38 +_0801C8E2: + movs r0, 0x1 + bl stdpal_get + movs r1, 0x20 + movs r2, 0x20 + bl LoadPalette + ldr r2, =gPaletteFade + ldrb r0, [r2, 0x8] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r2, 0x8] + ldr r0, =gUnknown_02022C78 + mov r8, r0 + ldr r0, [r0] + movs r4, 0xDE + lsls r4, 1 + adds r0, r4 + ldr r0, [r0] + ldr r0, [r0, 0xC] + movs r1, 0x10 + movs r2, 0x20 + bl LoadPalette + mov r2, r8 + ldr r1, [r2] + adds r4, r1, r4 + ldr r0, [r4] + ldr r0, [r0, 0x8] + movs r6, 0xE9 + lsls r6, 2 + adds r1, r6 + bl LZ77UnCompWram + mov r3, r8 + ldr r1, [r3] + adds r1, r6 + movs r4, 0x1E + str r4, [sp] + movs r5, 0x3 + str r5, [sp, 0x4] + str r7, [sp, 0x8] + str r7, [sp, 0xC] + str r4, [sp, 0x10] + str r5, [sp, 0x14] + movs r0, 0x1 + mov r10, r0 + str r0, [sp, 0x18] + movs r2, 0x8 + mov r9, r2 + str r2, [sp, 0x1C] + str r7, [sp, 0x20] + movs r2, 0 + movs r3, 0 + bl CopyRectToBgTilemapBufferRect + mov r3, r8 + ldr r1, [r3] + adds r1, r6 + str r4, [sp] + movs r0, 0x17 + str r0, [sp, 0x4] + str r7, [sp, 0x8] + str r5, [sp, 0xC] + str r4, [sp, 0x10] + str r0, [sp, 0x14] + mov r0, r10 + str r0, [sp, 0x18] + mov r2, r9 + str r2, [sp, 0x1C] + str r7, [sp, 0x20] + movs r0, 0x3 + movs r2, 0 + movs r3, 0x3 + bl CopyRectToBgTilemapBufferRect + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + b _0801CA1E + .pool +_0801C990: + bl sub_801CDCC + b _0801CA1E +_0801C996: + bl sub_801CE7C + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + b _0801CA1E +_0801C9A8: + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + movs r0, 0x3 + bl ShowBg + ldr r2, =gPaletteFade + ldrb r1, [r2, 0x8] + movs r0, 0x7F + ands r0, r1 + strb r0, [r2, 0x8] + ldr r4, =gUnknown_02022C78 + ldr r1, [r4] + movs r3, 0xE5 + lsls r3, 2 + adds r0, r1, r3 + movs r2, 0xE3 + lsls r2, 1 + adds r1, r2 + bl AddScrollIndicatorArrowPair + ldr r1, [r4] + ldr r3, =0x000001c1 + adds r2, r1, r3 + movs r1, 0 + strb r0, [r2] + movs r0, 0x1 + negs r0, r0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + bl UpdatePaletteFade + b _0801CA1E + .pool +_0801CA04: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + bne _0801CA38 + ldr r0, [r5] + adds r0, r4 + ldrb r2, [r0] + movs r1, 0x1 + ands r1, r2 + strb r1, [r0] + movs r0, 0x1 + b _0801CA3A +_0801CA1E: + ldr r0, =gUnknown_02022C78 + ldr r2, [r0] + movs r0, 0xE0 + lsls r0, 1 + adds r2, r0 + ldrb r3, [r2] + lsrs r1, r3, 1 + adds r1, 0x1 + lsls r1, 1 + movs r0, 0x1 + ands r0, r3 + orrs r0, r1 + strb r0, [r2] +_0801CA38: + movs r0, 0 +_0801CA3A: + add sp, 0x24 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801C758 + + thumb_func_start sub_801CA50 +sub_801CA50: @ 801CA50 + push {r4,r5,lr} + sub sp, 0x8 + adds r2, r0, 0 + ldr r5, =gUnknown_02022C78 + ldr r0, [r5] + cmp r0, 0 + bne _0801CA68 + movs r0, 0x1 + negs r0, r0 + b _0801CC2A + .pool +_0801CA68: + movs r4, 0xE0 + lsls r4, 1 + adds r0, r4 + ldrb r0, [r0] + lsrs r0, 1 + cmp r0, 0x5 + bls _0801CA78 + b _0801CBF4 +_0801CA78: + lsls r0, 2 + ldr r1, =_0801CA88 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801CA88: + .4byte _0801CAA0 + .4byte _0801CAB2 + .4byte _0801CAF4 + .4byte _0801CB54 + .4byte _0801CB84 + .4byte _0801CBC0 +_0801CAA0: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _0801CC0E +_0801CAB2: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + beq _0801CABE + b _0801CC28 +_0801CABE: + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x40 + movs r1, 0 + bl SetGpuReg + movs r0, 0x44 + movs r1, 0 + bl SetGpuReg + movs r0, 0x48 + movs r1, 0 + bl SetGpuReg + movs r0, 0x4A + movs r1, 0 + bl SetGpuReg + movs r1, 0x80 + lsls r1, 6 + movs r0, 0 + bl ClearGpuRegBits + b _0801CC0E +_0801CAF4: + movs r4, 0x1E + str r4, [sp] + movs r5, 0x14 + str r5, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + str r5, [sp, 0x4] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + movs r5, 0x18 + str r5, [sp, 0x4] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + str r5, [sp, 0x4] + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + b _0801CC0E +_0801CB54: + movs r0, 0x1 + bl HideBg + movs r0, 0x2 + bl HideBg + ldr r4, =gUnknown_02022C78 + ldr r0, [r4] + movs r1, 0xE5 + lsls r1, 1 + adds r0, r1 + ldrb r0, [r0] + bl RemoveWindow + ldr r0, [r4] + movs r2, 0xE4 + lsls r2, 1 + adds r0, r2 + ldrb r0, [r0] + bl RemoveWindow + b _0801CC0E + .pool +_0801CB84: + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + ldr r4, =gUnknown_02022C78 + ldr r0, [r4] + ldr r2, =0x000001c1 + adds r1, r0, r2 + ldrb r0, [r1] + cmp r0, 0xFF + beq _0801CC0E + bl RemoveScrollIndicatorArrowPair + ldr r0, [r4] + ldr r2, =0x000001c1 + adds r1, r0, r2 + movs r0, 0xFF + strb r0, [r1] + b _0801CC0E + .pool +_0801CBC0: + ldr r0, =gUnknown_02022C60 + ldrb r0, [r0] + adds r1, r2, 0 + bl sub_80186EC + movs r0, 0x3 + bl sub_8018798 + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + b _0801CC0E + .pool +_0801CBF4: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + bne _0801CC28 + ldr r0, [r5] + adds r0, r4 + ldrb r2, [r0] + movs r1, 0x1 + ands r1, r2 + strb r1, [r0] + movs r0, 0x1 + b _0801CC2A +_0801CC0E: + ldr r0, =gUnknown_02022C78 + ldr r2, [r0] + movs r0, 0xE0 + lsls r0, 1 + adds r2, r0 + ldrb r3, [r2] + lsrs r1, r3, 1 + adds r1, 0x1 + lsls r1, 1 + movs r0, 0x1 + ands r0, r3 + orrs r0, r1 + strb r0, [r2] +_0801CC28: + movs r0, 0 +_0801CC2A: + add sp, 0x8 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801CA50 + + thumb_func_start sub_801CC38 +sub_801CC38: @ 801CC38 + push {r4,r5,lr} + ldr r4, =gUnknown_02022C78 + ldr r2, [r4] + movs r5, 0xE0 + lsls r5, 1 + adds r0, r2, r5 + ldrb r1, [r0] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0801CC72 + ldr r0, =0x000001c1 + adds r1, r2, r0 + ldrb r0, [r1] + cmp r0, 0xFF + beq _0801CC72 + bl RemoveScrollIndicatorArrowPair + ldr r0, [r4] + ldr r2, =0x000001c1 + adds r1, r0, r2 + movs r0, 0xFF + strb r0, [r1] + ldr r1, [r4] + adds r1, r5 + ldrb r0, [r1] + movs r2, 0x1 + orrs r0, r2 + strb r0, [r1] +_0801CC72: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801CC38 + + thumb_func_start sub_801CC80 +sub_801CC80: @ 801CC80 + push {r4,lr} + ldr r4, =gUnknown_02022C78 + ldr r2, [r4] + movs r1, 0xE0 + lsls r1, 1 + adds r0, r2, r1 + ldrb r1, [r0] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0801CCC0 + movs r3, 0xE5 + lsls r3, 2 + adds r0, r2, r3 + movs r3, 0xE3 + lsls r3, 1 + adds r1, r2, r3 + bl AddScrollIndicatorArrowPair + ldr r1, [r4] + ldr r2, =0x000001c1 + adds r1, r2 + strb r0, [r1] + ldr r1, [r4] + movs r3, 0xE0 + lsls r3, 1 + adds r1, r3 + ldrb r2, [r1] + movs r0, 0x2 + negs r0, r0 + ands r0, r2 + strb r0, [r1] +_0801CCC0: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801CC80 + + thumb_func_start sub_801CCD0 +sub_801CCD0: @ 801CCD0 + push {r4-r6,lr} + lsls r0, 16 + lsrs r4, r0, 16 + adds r3, r4, 0 + ldr r2, =gUnknown_02022C78 + ldr r0, [r2] + mov r12, r0 + movs r0, 0xE1 + lsls r0, 1 + add r0, r12 + ldrb r1, [r0] + movs r5, 0x1 + adds r0, r5, 0 + ands r0, r1 + adds r6, r2, 0 + cmp r0, 0 + beq _0801CD00 + bl sub_801CFA4 +_0801CCF6: + movs r0, 0xFF + b _0801CDC6 + .pool +_0801CD00: + cmp r4, 0x2 + beq _0801CD1C + cmp r4, 0x2 + bgt _0801CD0E + cmp r4, 0x1 + beq _0801CD18 + b _0801CCF6 +_0801CD0E: + cmp r3, 0x40 + beq _0801CD20 + cmp r3, 0x80 + beq _0801CD50 + b _0801CCF6 +_0801CD18: + movs r0, 0 + b _0801CDC6 +_0801CD1C: + movs r0, 0x1 + b _0801CDC6 +_0801CD20: + movs r0, 0xE3 + lsls r0, 1 + add r0, r12 + ldrh r0, [r0] + cmp r0, 0 + beq _0801CCF6 + movs r0, 0xE0 + lsls r0, 1 + add r0, r12 + ldrb r1, [r0] + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0 + bne _0801CCF6 + ldr r2, =0x000001c3 + add r2, r12 + ldrb r1, [r2] + movs r0, 0x2 + negs r0, r0 + ands r0, r1 + b _0801CD7E + .pool +_0801CD50: + movs r0, 0xE3 + lsls r0, 1 + add r0, r12 + movs r1, 0xE2 + lsls r1, 1 + add r1, r12 + ldrh r0, [r0] + ldrh r1, [r1] + cmp r0, r1 + beq _0801CCF6 + movs r0, 0xE0 + lsls r0, 1 + add r0, r12 + ldrb r1, [r0] + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0 + bne _0801CCF6 + ldr r2, =0x000001c3 + add r2, r12 + ldrb r0, [r2] + movs r1, 0x1 + orrs r0, r1 +_0801CD7E: + strb r0, [r2] + ldr r2, [r6] + movs r4, 0xE1 + lsls r4, 1 + adds r2, r4 + ldrb r0, [r2] + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2] + ldr r3, [r6] + adds r3, r4 + ldrb r1, [r3] + movs r2, 0x1 + adds r0, r2, 0 + ands r0, r1 + movs r1, 0x4 + orrs r0, r1 + strb r0, [r3] + ldr r1, [r6] + adds r4, 0x1 + adds r1, r4 + ldrb r3, [r1] + adds r0, r2, 0 + ands r0, r3 + strb r0, [r1] + ldr r0, [r6] + adds r0, r4 + ldrb r0, [r0] + ands r2, r0 + cmp r2, 0 + beq _0801CDC4 + movs r0, 0x3 + b _0801CDC6 + .pool +_0801CDC4: + movs r0, 0x2 +_0801CDC6: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801CCD0 + + thumb_func_start sub_801CDCC +sub_801CDCC: @ 801CDCC + push {r4-r6,lr} + movs r5, 0 + ldr r4, =gUnknown_02022C78 + ldr r1, [r4] + movs r2, 0xE7 + lsls r2, 1 + adds r0, r1, r2 + adds r1, 0x4 + movs r2, 0x28 + bl memcpy + ldr r0, [r4] + movs r3, 0xFB + lsls r3, 1 + adds r1, r0, r3 + movs r0, 0xFF + strb r0, [r1] + adds r6, r4, 0 +_0801CDF0: + ldr r2, [r6] + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r4, r1, r5 + adds r0, r4, r2 + ldr r3, =0x000001f7 + adds r0, r3 + adds r1, r2 + adds r1, 0x2C + movs r2, 0x28 + bl memcpy + ldr r0, [r6] + ldr r1, =0x0000021f + adds r0, r1 + adds r0, r4 + movs r1, 0xFF + strb r1, [r0] + cmp r5, 0x7 + bls _0801CE34 + ldr r1, [r6] + ldr r2, =0x000001f7 + adds r0, r1, r2 + adds r0, r4 + ldrb r0, [r0] + cmp r0, 0xFF + beq _0801CE34 + movs r3, 0xE2 + lsls r3, 1 + adds r1, r3 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] +_0801CE34: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x9 + bls _0801CDF0 + ldr r2, =gUnknown_02022C78 + ldr r1, [r2] + movs r4, 0xE5 + lsls r4, 2 + adds r1, r4 + ldr r0, =gUnknown_082F1DF8 + ldm r0!, {r3-r5} + stm r1!, {r3-r5} + ldr r0, [r0] + str r0, [r1] + ldr r2, [r2] + movs r5, 0xE2 + lsls r5, 1 + adds r0, r2, r5 + ldrh r1, [r0] + movs r3, 0xE7 + lsls r3, 2 + adds r0, r2, r3 + strh r1, [r0] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801CDCC + + thumb_func_start sub_801CE7C +sub_801CE7C: @ 801CE7C + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0xC + movs r5, 0 + ldr r6, =gUnknown_02022C78 + ldr r0, [r6] + movs r7, 0xE4 + lsls r7, 1 + adds r0, r7 + ldrb r0, [r0] + bl PutWindowTilemap + ldr r0, [r6] + movs r4, 0xE5 + lsls r4, 1 + adds r0, r4 + ldrb r0, [r0] + bl PutWindowTilemap + ldr r0, [r6] + adds r0, r7 + ldrb r0, [r0] + movs r1, 0 + bl FillWindowPixelBuffer + ldr r0, [r6] + adds r0, r4 + ldrb r0, [r0] + movs r1, 0 + bl FillWindowPixelBuffer + ldr r4, [r6] + movs r0, 0xE7 + lsls r0, 1 + mov r8, r0 + add r4, r8 + movs r0, 0x3 + movs r1, 0x2 + bl GetFontAttribute + adds r2, r0, 0 + lsls r2, 24 + lsrs r2, 24 + movs r0, 0x3 + adds r1, r4, 0 + bl GetStringWidth + movs r1, 0xE0 + subs r1, r0 + lsrs r0, r1, 31 + adds r1, r0 + asrs r1, 1 + cmp r1, 0 + bge _0801CEEC + movs r1, 0 +_0801CEEC: + ldr r4, [r6] + adds r0, r4, r7 + ldrb r0, [r0] + lsls r2, r1, 24 + lsrs r2, 24 + movs r3, 0xDE + lsls r3, 1 + adds r1, r4, r3 + ldr r1, [r1] + ldrb r1, [r1] + lsls r1, 28 + lsrs r1, 28 + lsls r3, r1, 1 + adds r3, r1 + ldr r1, =gUnknown_082F1DE0 + adds r3, r1 + str r3, [sp] + str r5, [sp, 0x4] + add r4, r8 + str r4, [sp, 0x8] + movs r1, 0x3 + movs r3, 0x6 + bl box_print +_0801CF1C: + ldr r6, =gUnknown_02022C78 + ldr r4, [r6] + movs r1, 0xE5 + lsls r1, 1 + adds r0, r4, r1 + ldrb r0, [r0] + lsls r3, r5, 4 + adds r3, 0x2 + lsls r3, 24 + lsrs r3, 24 + movs r2, 0xDE + lsls r2, 1 + adds r1, r4, r2 + ldr r1, [r1] + ldrb r1, [r1] + lsrs r1, 4 + lsls r2, r1, 1 + adds r2, r1 + ldr r1, =gUnknown_082F1DE0 + adds r2, r1 + str r2, [sp] + movs r1, 0 + str r1, [sp, 0x4] + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r1, r5 + ldr r2, =0x000001f7 + adds r1, r2 + adds r4, r1 + str r4, [sp, 0x8] + movs r1, 0x3 + movs r2, 0 + bl box_print + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x9 + bls _0801CF1C + ldr r0, [r6] + movs r3, 0xE4 + lsls r3, 1 + adds r0, r3 + ldrb r0, [r0] + movs r1, 0x3 + bl CopyWindowToVram + ldr r0, [r6] + movs r1, 0xE5 + lsls r1, 1 + adds r0, r1 + ldrb r0, [r0] + movs r1, 0x3 + bl CopyWindowToVram + add sp, 0xC + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801CE7C + + thumb_func_start sub_801CFA4 +sub_801CFA4: @ 801CFA4 + push {r4-r6,lr} + ldr r0, =gUnknown_02022C78 + ldr r1, [r0] + movs r2, 0xE1 + lsls r2, 1 + adds r0, r1, r2 + ldrb r0, [r0] + lsrs r4, r0, 1 + lsls r4, 8 + ldr r6, =0x000001c3 + adds r0, r1, r6 + ldrb r1, [r0] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0801CFE4 + movs r0, 0x2 + adds r1, r4, 0 + movs r2, 0x1 + bl ChangeBgY + movs r0, 0x3 + adds r1, r4, 0 + movs r2, 0x1 + bl ChangeBgY + b _0801CFF8 + .pool +_0801CFE4: + movs r0, 0x2 + adds r1, r4, 0 + movs r2, 0x2 + bl ChangeBgY + movs r0, 0x3 + adds r1, r4, 0 + movs r2, 0x2 + bl ChangeBgY +_0801CFF8: + ldr r3, =gUnknown_02022C78 + ldr r0, [r3] + ldr r2, =0x000001c3 + adds r5, r0, r2 + ldrb r4, [r5] + lsrs r1, r4, 1 + movs r6, 0xE1 + lsls r6, 1 + adds r0, r6 + ldrb r0, [r0] + lsrs r0, 1 + adds r1, r0 + lsls r1, 1 + movs r6, 0x1 + adds r0, r6, 0 + ands r0, r4 + orrs r0, r1 + strb r0, [r5] + ldr r1, [r3] + adds r2, r1, r2 + ldrb r2, [r2] + lsrs r0, r2, 1 + cmp r0, 0xF + bls _0801D070 + adds r0, r6, 0 + ands r0, r2 + cmp r0, 0 + beq _0801D044 + movs r0, 0xE3 + lsls r0, 1 + adds r1, r0 + ldrh r0, [r1] + adds r0, 0x1 + b _0801D04E + .pool +_0801D044: + movs r2, 0xE3 + lsls r2, 1 + adds r1, r2 + ldrh r0, [r1] + subs r0, 0x1 +_0801D04E: + strh r0, [r1] + ldr r0, [r3] + movs r6, 0xE1 + lsls r6, 1 + adds r2, r0, r6 + ldrb r1, [r2] + movs r0, 0x2 + negs r0, r0 + ands r0, r1 + strb r0, [r2] + ldr r0, [r3] + ldr r1, =0x000001c3 + adds r2, r0, r1 + ldrb r1, [r2] + movs r0, 0x1 + ands r0, r1 + strb r0, [r2] +_0801D070: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801CFA4 + + thumb_func_start mevent_srv_init_wnews +mevent_srv_init_wnews: @ 801D07C + push {r4,lr} + ldr r4, =gUnknown_02022C7C + movs r0, 0x60 + bl AllocZeroed + str r0, [r4] + ldr r1, =gUnknown_082F298C + movs r2, 0 + movs r3, 0x1 + bl mevent_srv_init_common + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end mevent_srv_init_wnews + + thumb_func_start mevent_srv_new_wcard +mevent_srv_new_wcard: @ 801D0A0 + push {r4,lr} + ldr r4, =gUnknown_02022C7C + movs r0, 0x60 + bl AllocZeroed + str r0, [r4] + ldr r1, =gUnknown_082F29EC + movs r2, 0 + movs r3, 0x1 + bl mevent_srv_init_common + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end mevent_srv_new_wcard + + thumb_func_start sub_801D0C4 +sub_801D0C4: @ 801D0C4 + push {r4-r6,lr} + adds r6, r0, 0 + ldr r4, =gUnknown_02022C7C + ldr r0, [r4] + cmp r0, 0 + bne _0801D0D8 + movs r0, 0x3 + b _0801D0F8 + .pool +_0801D0D8: + bl mevent_dispatch_08145600 + adds r5, r0, 0 + cmp r5, 0x3 + bne _0801D0F6 + ldr r0, [r4] + ldr r1, [r0, 0x4] + strh r1, [r6] + bl mevent_srv_free_resources + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] +_0801D0F6: + adds r0, r5, 0 +_0801D0F8: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801D0C4 + + thumb_func_start mevent_srv_init_common +mevent_srv_init_common: @ 801D100 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + adds r4, r0, 0 + adds r6, r1, 0 + mov r8, r2 + mov r9, r3 + movs r5, 0 + str r5, [r4] + str r5, [r4, 0x8] + movs r0, 0xA6 + lsls r0, 1 + bl AllocZeroed + str r0, [r4, 0x18] + movs r0, 0xDE + lsls r0, 1 + bl AllocZeroed + str r0, [r4, 0x1C] + movs r0, 0x80 + lsls r0, 3 + bl AllocZeroed + str r0, [r4, 0x14] + movs r0, 0x64 + bl AllocZeroed + str r0, [r4, 0x20] + str r6, [r4, 0x10] + str r5, [r4, 0xC] + adds r4, 0x38 + adds r0, r4, 0 + mov r1, r8 + mov r2, r9 + bl sub_801D8D8 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end mevent_srv_init_common + + thumb_func_start mevent_srv_free_resources +mevent_srv_free_resources: @ 801D158 + push {r4,lr} + adds r4, r0, 0 + ldr r0, [r4, 0x18] + bl Free + ldr r0, [r4, 0x1C] + bl Free + ldr r0, [r4, 0x14] + bl Free + ldr r0, [r4, 0x20] + bl Free + pop {r4} + pop {r0} + bx r0 + thumb_func_end mevent_srv_free_resources + + thumb_func_start mevent_srv_814501C +mevent_srv_814501C: @ 801D17C + push {lr} + adds r0, 0x38 + bl sub_801D904 + pop {r0} + bx r0 + thumb_func_end mevent_srv_814501C + + thumb_func_start sub_801D188 +sub_801D188: @ 801D188 + push {lr} + cmp r0, 0 + bne _0801D190 + adds r0, r1, 0 +_0801D190: + pop {r1} + bx r1 + thumb_func_end sub_801D188 + + thumb_func_start sub_801D194 +sub_801D194: @ 801D194 + push {lr} + cmp r1, r0 + bcs _0801D19E + movs r0, 0 + b _0801D1A8 +_0801D19E: + cmp r1, r0 + beq _0801D1A6 + movs r0, 0x2 + b _0801D1A8 +_0801D1A6: + movs r0, 0x1 +_0801D1A8: + pop {r1} + bx r1 + thumb_func_end sub_801D194 + + thumb_func_start sub_801D1AC +sub_801D1AC: @ 801D1AC + movs r1, 0x4 + str r1, [r0, 0x8] + movs r0, 0 + bx lr + thumb_func_end sub_801D1AC + + thumb_func_start sub_801D1B4 +sub_801D1B4: @ 801D1B4 + movs r0, 0x3 + bx lr + thumb_func_end sub_801D1B4 + + thumb_func_start sub_801D1B8 +sub_801D1B8: @ 801D1B8 + push {r4,lr} + adds r4, r0, 0 + adds r0, 0x38 + bl sub_801D8C0 + cmp r0, 0 + beq _0801D1CA + movs r0, 0x4 + str r0, [r4, 0x8] +_0801D1CA: + movs r0, 0x1 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801D1B8 + + thumb_func_start sub_801D1D4 +sub_801D1D4: @ 801D1D4 + push {r4,lr} + adds r4, r0, 0 + adds r0, 0x38 + bl sub_801D8CC + cmp r0, 0 + beq _0801D1E6 + movs r0, 0x4 + str r0, [r4, 0x8] +_0801D1E6: + movs r0, 0x1 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801D1D4 + + thumb_func_start sub_801D1F0 +sub_801D1F0: @ 801D1F0 + push {r4,r5,lr} + adds r5, r0, 0 + ldr r0, [r5, 0xC] + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + ldr r2, [r5, 0x10] + adds r3, r2, r1 + adds r0, 0x1 + str r0, [r5, 0xC] + ldr r0, [r3] + cmp r0, 0x1E + bls _0801D20C + b _0801D464 +_0801D20C: + lsls r0, 2 + ldr r1, =_0801D21C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801D21C: + .4byte _0801D298 + .4byte _0801D2A2 + .4byte _0801D2A8 + .4byte _0801D2E2 + .4byte _0801D2D8 + .4byte _0801D2BA + .4byte _0801D2C6 + .4byte _0801D2EC + .4byte _0801D300 + .4byte _0801D308 + .4byte _0801D31E + .4byte _0801D32E + .4byte _0801D33A + .4byte _0801D360 + .4byte _0801D348 + .4byte _0801D390 + .4byte _0801D378 + .4byte _0801D3DC + .4byte _0801D3A8 + .4byte _0801D3C0 + .4byte _0801D3CE + .4byte _0801D406 + .4byte _0801D3EA + .4byte _0801D3F8 + .4byte _0801D40E + .4byte _0801D418 + .4byte _0801D422 + .4byte _0801D43C + .4byte _0801D450 + .4byte _0801D458 + .4byte _0801D2CC +_0801D298: + movs r0, 0x1 + str r0, [r5, 0x8] + ldr r0, [r3, 0x4] + str r0, [r5, 0x4] + b _0801D464 +_0801D2A2: + movs r0, 0x3 + str r0, [r5, 0x8] + b _0801D464 +_0801D2A8: + adds r0, r5, 0 + adds r0, 0x38 + ldr r1, [r3, 0x4] + ldr r2, [r5, 0x14] + bl sub_801D928 + movs r0, 0x2 + str r0, [r5, 0x8] + b _0801D464 +_0801D2BA: + ldr r0, [r5, 0x20] + ldr r1, [r5, 0x14] + movs r2, 0x64 + bl memcpy + b _0801D464 +_0801D2C6: + ldr r0, [r5, 0x20] + movs r1, 0 + b _0801D2D0 +_0801D2CC: + ldr r0, [r5, 0x20] + movs r1, 0x1 +_0801D2D0: + bl sub_801B6A0 + str r0, [r5, 0x4] + b _0801D464 +_0801D2D8: + ldr r1, [r5, 0x4] + ldr r0, [r3, 0x4] + cmp r1, r0 + beq _0801D2E2 + b _0801D464 +_0801D2E2: + movs r0, 0 + str r0, [r5, 0xC] + ldr r0, [r3, 0x8] + str r0, [r5, 0x10] + b _0801D464 +_0801D2EC: + ldr r0, [r3, 0x8] + ldr r1, [r5, 0x18] + bl sub_801D188 + adds r2, r0, 0 + ldr r1, [r5, 0x20] + bl sub_801B6EC + str r0, [r5, 0x4] + b _0801D464 +_0801D300: + ldr r0, [r5, 0x14] + ldr r0, [r0] + str r0, [r5, 0x4] + b _0801D464 +_0801D308: + ldr r0, [r3, 0x8] + adds r1, r5, 0 + adds r1, 0x34 + bl sub_801D188 + adds r2, r0, 0 + ldr r1, [r5, 0x20] + bl sub_801B708 + str r0, [r5, 0x4] + b _0801D464 +_0801D31E: + ldr r0, [r5, 0x20] + ldr r1, [r3, 0x4] + bl sub_801B784 + lsls r0, 16 + lsrs r0, 16 + str r0, [r5, 0x4] + b _0801D464 +_0801D32E: + ldr r0, [r5, 0x20] + ldr r1, [r3, 0x8] + bl sub_801B748 + str r0, [r5, 0x4] + b _0801D464 +_0801D33A: + ldr r0, [r3, 0x8] + ldr r1, [r5, 0x14] + ldr r1, [r1] + bl sub_801D194 + str r0, [r5, 0x4] + b _0801D464 +_0801D348: + ldr r0, [r3, 0x8] + ldr r1, [r5, 0x1C] + bl sub_801D188 + adds r2, r0, 0 + movs r3, 0xDE + lsls r3, 1 + adds r0, r5, 0 + movs r1, 0x17 + bl mevent_srv_814501C + b _0801D464 +_0801D360: + ldr r0, [r3, 0x8] + ldr r1, [r5, 0x18] + bl sub_801D188 + adds r2, r0, 0 + movs r3, 0xA6 + lsls r3, 1 + adds r0, r5, 0 + movs r1, 0x16 + bl mevent_srv_814501C + b _0801D464 +_0801D378: + ldr r0, [r3, 0x8] + adds r1, r5, 0 + adds r1, 0x34 + bl sub_801D188 + adds r2, r0, 0 + adds r0, r5, 0 + movs r1, 0x18 + movs r3, 0x4 + bl mevent_srv_814501C + b _0801D464 +_0801D390: + ldr r2, [r3, 0x8] + cmp r2, 0 + bne _0801D39C + ldr r2, [r5, 0x24] + ldr r3, [r5, 0x28] + b _0801D39E +_0801D39C: + ldr r3, [r3, 0x4] +_0801D39E: + adds r0, r5, 0 + movs r1, 0x19 + bl mevent_srv_814501C + b _0801D464 +_0801D3A8: + ldr r2, [r3, 0x8] + cmp r2, 0 + bne _0801D3B4 + ldr r2, [r5, 0x2C] + ldr r3, [r5, 0x30] + b _0801D3B6 +_0801D3B4: + ldr r3, [r3, 0x4] +_0801D3B6: + adds r0, r5, 0 + movs r1, 0x10 + bl mevent_srv_814501C + b _0801D464 +_0801D3C0: + ldr r2, [r3, 0x8] + adds r0, r5, 0 + movs r1, 0x1A + movs r3, 0xBC + bl mevent_srv_814501C + b _0801D464 +_0801D3CE: + ldr r2, [r3, 0x8] + ldr r3, [r3, 0x4] + adds r0, r5, 0 + movs r1, 0x15 + bl mevent_srv_814501C + b _0801D464 +_0801D3DC: + ldr r2, [r3, 0x8] + ldr r3, [r3, 0x4] + adds r0, r5, 0 + movs r1, 0x1C + bl mevent_srv_814501C + b _0801D464 +_0801D3EA: + ldr r0, [r5, 0x18] + ldr r1, [r3, 0x8] + movs r2, 0xA6 + lsls r2, 1 + bl memcpy + b _0801D464 +_0801D3F8: + ldr r0, [r5, 0x1C] + ldr r1, [r3, 0x8] + movs r2, 0xDE + lsls r2, 1 + bl memcpy + b _0801D464 +_0801D406: + ldr r0, [r3, 0x8] + ldr r0, [r0] + str r0, [r5, 0x34] + b _0801D464 +_0801D40E: + ldr r0, [r3, 0x8] + str r0, [r5, 0x24] + ldr r0, [r3, 0x4] + str r0, [r5, 0x28] + b _0801D464 +_0801D418: + ldr r0, [r3, 0x8] + str r0, [r5, 0x2C] + ldr r0, [r3, 0x4] + str r0, [r5, 0x30] + b _0801D464 +_0801D422: + ldr r4, [r5, 0x18] + bl sav1_get_mevent_buffer_1 + adds r1, r0, 0 + movs r2, 0xA6 + lsls r2, 1 + adds r0, r4, 0 + bl memcpy + ldr r0, [r5, 0x18] + bl sub_801B3C0 + b _0801D464 +_0801D43C: + ldr r4, [r5, 0x1C] + bl sub_801B00C + adds r1, r0, 0 + movs r2, 0xDE + lsls r2, 1 + adds r0, r4, 0 + bl memcpy + b _0801D464 +_0801D450: + bl sub_8099244 + str r0, [r5, 0x24] + b _0801D464 +_0801D458: + ldr r2, [r3, 0x8] + ldr r3, [r3, 0x4] + adds r0, r5, 0 + movs r1, 0x1B + bl mevent_srv_814501C +_0801D464: + movs r0, 0x1 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_801D1F0 + + thumb_func_start mevent_dispatch_08145600 +mevent_dispatch_08145600: @ 801D46C + push {lr} + ldr r2, =gUnknown_082F2548 + ldr r1, [r0, 0x8] + lsls r1, 2 + adds r1, r2 + ldr r1, [r1] + bl _call_via_r1 + pop {r1} + bx r1 + .pool + thumb_func_end mevent_dispatch_08145600 + + thumb_func_start sub_801D484 +sub_801D484: @ 801D484 + push {r4,r5,lr} + adds r5, r0, 0 + ldr r4, =gUnknown_02022C80 + movs r0, 0x50 + bl AllocZeroed + str r0, [r4] + movs r1, 0x1 + movs r2, 0 + bl mevent_srv_ish_init + ldr r0, [r4] + str r5, [r0, 0x4C] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801D484 + + thumb_func_start sub_801D4A8 +sub_801D4A8: @ 801D4A8 + push {r4-r6,lr} + adds r6, r0, 0 + ldr r4, =gUnknown_02022C80 + ldr r0, [r4] + cmp r0, 0 + bne _0801D4BC + movs r0, 0x6 + b _0801D4DC + .pool +_0801D4BC: + bl mevent_srv_ish_exec + adds r5, r0, 0 + cmp r5, 0x6 + bne _0801D4DA + ldr r0, [r4] + ldr r1, [r0, 0x4] + strh r1, [r6] + bl sub_801D55C + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] +_0801D4DA: + adds r0, r5, 0 +_0801D4DC: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801D4A8 + + thumb_func_start sub_801D4E4 +sub_801D4E4: @ 801D4E4 + ldr r0, =gUnknown_02022C80 + ldr r1, [r0] + ldr r0, [r1, 0xC] + adds r0, 0x1 + str r0, [r1, 0xC] + bx lr + .pool + thumb_func_end sub_801D4E4 + + thumb_func_start sub_801D4F4 +sub_801D4F4: @ 801D4F4 + ldr r0, =gUnknown_02022C80 + ldr r0, [r0] + ldr r0, [r0, 0x20] + bx lr + .pool + thumb_func_end sub_801D4F4 + + thumb_func_start sub_801D500 +sub_801D500: @ 801D500 + ldr r1, =gUnknown_02022C80 + ldr r1, [r1] + str r0, [r1, 0x4] + bx lr + .pool + thumb_func_end sub_801D500 + + thumb_func_start mevent_srv_ish_init +mevent_srv_ish_init: @ 801D50C + push {r4-r6,lr} + mov r6, r8 + push {r6} + adds r4, r0, 0 + adds r6, r1, 0 + mov r8, r2 + movs r0, 0 + str r0, [r4] + str r0, [r4, 0x8] + str r0, [r4, 0xC] + movs r5, 0x80 + lsls r5, 3 + adds r0, r5, 0 + bl AllocZeroed + str r0, [r4, 0x14] + adds r0, r5, 0 + bl AllocZeroed + str r0, [r4, 0x18] + adds r0, r5, 0 + bl AllocZeroed + str r0, [r4, 0x1C] + movs r0, 0x40 + bl AllocZeroed + str r0, [r4, 0x20] + adds r4, 0x24 + adds r0, r4, 0 + adds r1, r6, 0 + mov r2, r8 + bl sub_801D8D8 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end mevent_srv_ish_init + + thumb_func_start sub_801D55C +sub_801D55C: @ 801D55C + push {r4,lr} + adds r4, r0, 0 + ldr r0, [r4, 0x14] + bl Free + ldr r0, [r4, 0x18] + bl Free + ldr r0, [r4, 0x1C] + bl Free + ldr r0, [r4, 0x20] + bl Free + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801D55C + + thumb_func_start sub_801D580 +sub_801D580: @ 801D580 + push {r4,lr} + adds r4, r0, 0 + ldr r0, [r4, 0x1C] + ldr r1, [r4, 0x18] + movs r2, 0x80 + lsls r2, 3 + bl memcpy + movs r0, 0 + str r0, [r4, 0x10] + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801D580 + + thumb_func_start sub_801D59C +sub_801D59C: @ 801D59C + push {r4-r6,lr} + sub sp, 0x4 + adds r4, r0, 0 + adds r6, r1, 0 + adds r5, r2, 0 + movs r0, 0 + str r0, [sp] + ldr r1, [r4, 0x14] + ldr r2, =0x05000100 + mov r0, sp + bl CpuSet + ldr r2, [r4, 0x14] + str r5, [r2] + adds r4, 0x24 + adds r0, r4, 0 + adds r1, r6, 0 + movs r3, 0x4 + bl sub_801D904 + add sp, 0x4 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801D59C + + thumb_func_start sub_801D5D0 +sub_801D5D0: @ 801D5D0 + push {r4,lr} + adds r4, r0, 0 + ldr r0, [r4, 0x1C] + ldr r1, =gUnknown_082F2598 + movs r2, 0x80 + lsls r2, 3 + bl memcpy + movs r1, 0 + str r1, [r4, 0x10] + movs r0, 0x4 + str r0, [r4, 0x8] + str r1, [r4, 0xC] + movs r0, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801D5D0 + + thumb_func_start sub_801D5F8 +sub_801D5F8: @ 801D5F8 + movs r0, 0x6 + bx lr + thumb_func_end sub_801D5F8 + + thumb_func_start sub_801D5FC +sub_801D5FC: @ 801D5FC + push {r4,lr} + adds r4, r0, 0 + adds r0, 0x24 + bl sub_801D8C0 + cmp r0, 0 + beq _0801D612 + movs r0, 0x4 + str r0, [r4, 0x8] + movs r0, 0 + str r0, [r4, 0xC] +_0801D612: + movs r0, 0x1 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801D5FC + + thumb_func_start sub_801D61C +sub_801D61C: @ 801D61C + push {r4,lr} + adds r4, r0, 0 + adds r0, 0x24 + bl sub_801D8CC + cmp r0, 0 + beq _0801D632 + movs r0, 0x4 + str r0, [r4, 0x8] + movs r0, 0 + str r0, [r4, 0xC] +_0801D632: + movs r0, 0x1 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801D61C + + thumb_func_start sub_801D63C +sub_801D63C: @ 801D63C + push {r4,lr} + adds r4, r0, 0 + ldr r0, [r4, 0x10] + lsls r2, r0, 3 + ldr r1, [r4, 0x1C] + adds r2, r1, r2 + adds r0, 0x1 + str r0, [r4, 0x10] + ldr r0, [r2] + cmp r0, 0x15 + bls _0801D654 + b _0801D804 +_0801D654: + lsls r0, 2 + ldr r1, =_0801D664 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801D664: + .4byte _0801D804 + .4byte _0801D6BC + .4byte _0801D6C4 + .4byte _0801D6D4 + .4byte _0801D70E + .4byte _0801D716 + .4byte _0801D6FE + .4byte _0801D708 + .4byte _0801D764 + .4byte _0801D790 + .4byte _0801D788 + .4byte _0801D72C + .4byte _0801D742 + .4byte _0801D758 + .4byte _0801D77C + .4byte _0801D7B8 + .4byte _0801D7BC + .4byte _0801D7C4 + .4byte _0801D7D0 + .4byte _0801D6EA + .4byte _0801D6D8 + .4byte _0801D7F0 +_0801D6BC: + ldr r0, [r2, 0x4] + str r0, [r4, 0x4] + movs r0, 0x1 + b _0801D7FE +_0801D6C4: + adds r0, r4, 0 + adds r0, 0x24 + ldr r1, [r2, 0x4] + ldr r2, [r4, 0x18] + bl sub_801D928 + movs r0, 0x2 + b _0801D7FE +_0801D6D4: + movs r0, 0x3 + b _0801D7FE +_0801D6D8: + adds r0, r4, 0 + adds r0, 0x24 + ldr r2, [r4, 0x14] + movs r1, 0x14 + movs r3, 0 + bl sub_801D904 + movs r0, 0x3 + b _0801D7FE +_0801D6EA: + ldrb r0, [r2, 0x4] + bl GetGameStat + adds r2, r0, 0 + adds r0, r4, 0 + movs r1, 0x12 + bl sub_801D59C + movs r0, 0x3 + b _0801D7FE +_0801D6FE: + ldr r0, [r4, 0x4] + cmp r0, 0 + beq _0801D706 + b _0801D804 +_0801D706: + b _0801D70E +_0801D708: + ldr r0, [r4, 0x4] + cmp r0, 0x1 + bne _0801D804 +_0801D70E: + adds r0, r4, 0 + bl sub_801D580 + b _0801D804 +_0801D716: + ldr r0, [r4, 0x20] + ldr r1, [r4, 0x18] + movs r2, 0x40 + bl memcpy + movs r0, 0x5 + str r0, [r4, 0x8] + movs r0, 0 + str r0, [r4, 0xC] + movs r0, 0x2 + b _0801D806 +_0801D72C: + ldr r0, [r4, 0x20] + ldr r1, [r4, 0x18] + movs r2, 0x40 + bl memcpy + movs r0, 0x5 + str r0, [r4, 0x8] + movs r0, 0 + str r0, [r4, 0xC] + movs r0, 0x3 + b _0801D806 +_0801D742: + ldr r0, [r4, 0x20] + ldr r1, [r4, 0x18] + movs r2, 0x40 + bl memcpy + movs r0, 0x5 + str r0, [r4, 0x8] + movs r0, 0 + str r0, [r4, 0xC] + movs r0, 0x5 + b _0801D806 +_0801D758: + movs r0, 0x5 + str r0, [r4, 0x8] + movs r0, 0 + str r0, [r4, 0xC] + movs r0, 0x4 + b _0801D806 +_0801D764: + ldr r0, [r4, 0x14] + ldr r1, [r4, 0x4C] + bl sub_801B580 + adds r0, r4, 0 + adds r0, 0x24 + ldr r2, [r4, 0x14] + movs r1, 0x11 + movs r3, 0x64 + bl sub_801D904 + b _0801D804 +_0801D77C: + ldr r2, [r4, 0x4] + adds r0, r4, 0 + movs r1, 0x13 + bl sub_801D59C + b _0801D804 +_0801D788: + ldr r0, [r4, 0x18] + bl sub_801B21C + b _0801D804 +_0801D790: + ldr r0, [r4, 0x18] + bl sub_801B1A4 + cmp r0, 0 + bne _0801D7AC + ldr r0, [r4, 0x18] + bl sub_801B078 + adds r0, r4, 0 + movs r1, 0x13 + movs r2, 0 + bl sub_801D59C + b _0801D804 +_0801D7AC: + adds r0, r4, 0 + movs r1, 0x13 + movs r2, 0x1 + bl sub_801D59C + b _0801D804 +_0801D7B8: + movs r0, 0x6 + b _0801D7FE +_0801D7BC: + ldr r0, [r4, 0x18] + bl sub_801B508 + b _0801D804 +_0801D7C4: + ldr r0, [r4, 0x18] + movs r1, 0xFA + lsls r1, 2 + bl sub_80992A0 + b _0801D804 +_0801D7D0: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000bec + adds r0, r1 + ldr r1, [r4, 0x18] + movs r2, 0xBC + bl memcpy + bl sub_81652B4 + b _0801D804 + .pool +_0801D7F0: + ldr r0, =0x0201c000 + ldr r1, [r4, 0x18] + movs r2, 0x80 + lsls r2, 3 + bl memcpy + movs r0, 0x7 +_0801D7FE: + str r0, [r4, 0x8] + movs r0, 0 + str r0, [r4, 0xC] +_0801D804: + movs r0, 0x1 +_0801D806: + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801D63C + + thumb_func_start sub_801D810 +sub_801D810: @ 801D810 + push {lr} + adds r1, r0, 0 + ldr r0, [r1, 0xC] + cmp r0, 0 + beq _0801D822 + movs r0, 0x4 + str r0, [r1, 0x8] + movs r0, 0 + str r0, [r1, 0xC] +_0801D822: + movs r0, 0x1 + pop {r1} + bx r1 + thumb_func_end sub_801D810 + + thumb_func_start sub_801D828 +sub_801D828: @ 801D828 + push {r4,lr} + adds r4, r0, 0 + ldr r0, [r4, 0xC] + cmp r0, 0 + beq _0801D838 + cmp r0, 0x1 + beq _0801D846 + b _0801D858 +_0801D838: + ldr r0, [r4, 0x18] + bl sub_8153870 + ldr r0, [r4, 0xC] + adds r0, 0x1 + str r0, [r4, 0xC] + b _0801D858 +_0801D846: + adds r0, r4, 0x4 + bl sub_8153884 + adds r1, r0, 0 + cmp r1, 0 + bne _0801D858 + movs r0, 0x4 + str r0, [r4, 0x8] + str r1, [r4, 0xC] +_0801D858: + movs r0, 0x1 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801D828 + + thumb_func_start sub_801D860 +sub_801D860: @ 801D860 + push {r4,lr} + adds r4, r0, 0 + ldr r3, =0x0201c000 + adds r0, r4, 0x4 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + ldr r2, =gSaveBlock1Ptr + ldr r2, [r2] + bl _call_via_r3 + cmp r0, 0x1 + bne _0801D880 + movs r0, 0x4 + str r0, [r4, 0x8] + movs r0, 0 + str r0, [r4, 0xC] +_0801D880: + movs r0, 0x1 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801D860 + + thumb_func_start mevent_srv_ish_exec +mevent_srv_ish_exec: @ 801D894 + push {r4,r5,lr} + sub sp, 0x20 + mov r2, sp + ldr r1, =gUnknown_082F255C + ldm r1!, {r3-r5} + stm r2!, {r3-r5} + ldm r1!, {r3-r5} + stm r2!, {r3-r5} + ldm r1!, {r3,r4} + stm r2!, {r3,r4} + ldr r1, [r0, 0x8] + lsls r1, 2 + add r1, sp + ldr r1, [r1] + bl _call_via_r1 + add sp, 0x20 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end mevent_srv_ish_exec + + thumb_func_start sub_801D8C0 +sub_801D8C0: @ 801D8C0 + push {lr} + ldr r1, [r0, 0x20] + bl _call_via_r1 + pop {r1} + bx r1 + thumb_func_end sub_801D8C0 + + thumb_func_start sub_801D8CC +sub_801D8CC: @ 801D8CC + push {lr} + ldr r1, [r0, 0x24] + bl _call_via_r1 + pop {r1} + bx r1 + thumb_func_end sub_801D8CC + + thumb_func_start sub_801D8D8 +sub_801D8D8: @ 801D8D8 + movs r3, 0 + strb r1, [r0, 0x4] + strb r2, [r0, 0x5] + str r3, [r0] + strh r3, [r0, 0x12] + strh r3, [r0, 0x14] + strh r3, [r0, 0x10] + strh r3, [r0, 0xA] + strh r3, [r0, 0xC] + strh r3, [r0, 0x8] + str r3, [r0, 0x1C] + str r3, [r0, 0x18] + ldr r1, =sub_801DA5C + str r1, [r0, 0x24] + ldr r1, =sub_801D988 + str r1, [r0, 0x20] + bx lr + .pool + thumb_func_end sub_801D8D8 + + thumb_func_start sub_801D904 +sub_801D904: @ 801D904 + push {r4,lr} + adds r4, r0, 0 + movs r0, 0 + str r0, [r4] + strh r1, [r4, 0xE] + strh r0, [r4, 0x10] + strh r0, [r4, 0x12] + cmp r3, 0 + beq _0801D91A + strh r3, [r4, 0x14] + b _0801D920 +_0801D91A: + movs r0, 0x80 + lsls r0, 3 + strh r0, [r4, 0x14] +_0801D920: + str r2, [r4, 0x1C] + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801D904 + + thumb_func_start sub_801D928 +sub_801D928: @ 801D928 + movs r3, 0 + str r3, [r0] + strh r1, [r0, 0x6] + strh r3, [r0, 0x8] + strh r3, [r0, 0xA] + strh r3, [r0, 0xC] + str r2, [r0, 0x18] + bx lr + thumb_func_end sub_801D928 + + thumb_func_start sub_801D938 +sub_801D938: @ 801D938 + push {lr} + adds r3, r0, 0 + adds r0, r1, 0 + lsls r3, 8 + ldr r1, =gBlockRecvBuffer + adds r3, r1 + adds r1, r3, 0 + bl memcpy + pop {r0} + bx r0 + .pool + thumb_func_end sub_801D938 + + thumb_func_start sub_801D954 +sub_801D954: @ 801D954 + push {r4,lr} + adds r4, r0, 0 + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + asrs r0, r4 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0801D96E + movs r0, 0 + b _0801D970 +_0801D96E: + movs r0, 0x1 +_0801D970: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801D954 + + thumb_func_start sub_801D978 +sub_801D978: @ 801D978 + push {lr} + lsls r0, 24 + lsrs r0, 24 + bl ResetBlockReceivedFlag + pop {r0} + bx r0 + thumb_func_end sub_801D978 + + thumb_func_start sub_801D988 +sub_801D988: @ 801D988 + push {r4-r6,lr} + sub sp, 0x8 + adds r5, r0, 0 + ldr r6, [r5] + cmp r6, 0x1 + beq _0801D9EC + cmp r6, 0x1 + bgt _0801D99E + cmp r6, 0 + beq _0801D9A4 + b _0801DA52 +_0801D99E: + cmp r6, 0x2 + beq _0801DA38 + b _0801DA52 +_0801D9A4: + ldrb r0, [r5, 0x5] + bl sub_801D954 + cmp r0, 0 + beq _0801DA52 + ldrb r0, [r5, 0x5] + mov r4, sp + mov r1, sp + movs r2, 0x8 + bl sub_801D938 + ldrh r1, [r4, 0x4] + strh r1, [r5, 0xC] + ldrh r0, [r4, 0x2] + strh r0, [r5, 0xA] + lsls r1, 16 + movs r0, 0x80 + lsls r0, 19 + cmp r1, r0 + bls _0801D9D2 +_0801D9CC: + bl sub_8010198 + b _0801DA52 +_0801D9D2: + mov r1, sp + ldrh r0, [r5, 0x6] + ldrh r1, [r1] + cmp r0, r1 + bne _0801D9CC + strh r6, [r5, 0x8] + ldrb r0, [r5, 0x5] + bl sub_801D978 + ldr r0, [r5] + adds r0, 0x1 + str r0, [r5] + b _0801DA52 +_0801D9EC: + ldrb r0, [r5, 0x5] + bl sub_801D954 + cmp r0, 0 + beq _0801DA52 + ldrh r0, [r5, 0x8] + lsls r1, r0, 6 + subs r1, r0 + lsls r3, r1, 2 + ldrh r0, [r5, 0xC] + subs r2, r0, r3 + cmp r2, 0xFC + bhi _0801DA1E + ldrb r0, [r5, 0x5] + ldr r1, [r5, 0x18] + adds r1, r3 + bl sub_801D938 + ldrh r0, [r5, 0x8] + adds r0, 0x1 + strh r0, [r5, 0x8] + ldr r0, [r5] + adds r0, 0x1 + str r0, [r5] + b _0801DA30 +_0801DA1E: + ldrb r0, [r5, 0x5] + ldr r1, [r5, 0x18] + adds r1, r3 + movs r2, 0xFC + bl sub_801D938 + ldrh r0, [r5, 0x8] + adds r0, 0x1 + strh r0, [r5, 0x8] +_0801DA30: + ldrb r0, [r5, 0x5] + bl sub_801D978 + b _0801DA52 +_0801DA38: + ldr r0, [r5, 0x18] + ldrh r1, [r5, 0xC] + bl CalcCRC16WithTable + lsls r0, 16 + lsrs r0, 16 + ldrh r1, [r5, 0xA] + cmp r0, r1 + bne _0801D9CC + movs r0, 0 + str r0, [r5] + movs r0, 0x1 + b _0801DA54 +_0801DA52: + movs r0, 0 +_0801DA54: + add sp, 0x8 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801D988 + + thumb_func_start sub_801DA5C +sub_801DA5C: @ 801DA5C + push {r4,r5,lr} + sub sp, 0x8 + adds r4, r0, 0 + ldr r5, [r4] + cmp r5, 0x1 + beq _0801DAC8 + cmp r5, 0x1 + bgt _0801DA72 + cmp r5, 0 + beq _0801DA7C + b _0801DB5E +_0801DA72: + cmp r5, 0x2 + beq _0801DB1C + cmp r5, 0x3 + beq _0801DB46 + b _0801DB5E +_0801DA7C: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801DB5E + ldrh r1, [r4, 0xE] + ldr r2, =0xffff0000 + ldr r0, [sp] + ands r0, r2 + orrs r0, r1 + str r0, [sp] + ldrh r1, [r4, 0x14] + ldr r0, [sp, 0x4] + ands r0, r2 + orrs r0, r1 + str r0, [sp, 0x4] + ldr r0, [r4, 0x1C] + bl CalcCRC16WithTable + lsls r0, 16 + ldr r2, =0x0000ffff + ldr r1, [sp] + ands r1, r2 + orrs r1, r0 + str r1, [sp] + lsrs r1, 16 + strh r1, [r4, 0x12] + strh r5, [r4, 0x10] + movs r0, 0 + mov r1, sp + movs r2, 0x8 + bl SendBlock + b _0801DB3E + .pool +_0801DAC8: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801DB5E + ldrb r0, [r4, 0x4] + bl sub_801D954 + cmp r0, 0 + beq _0801DB5E + ldrb r0, [r4, 0x4] + bl sub_801D978 + ldrh r1, [r4, 0x10] + lsls r0, r1, 6 + subs r0, r1 + lsls r3, r0, 2 + ldrh r0, [r4, 0x14] + subs r0, r3 + cmp r0, 0xFC + bhi _0801DB08 + ldr r1, [r4, 0x1C] + adds r1, r3 + lsls r2, r0, 16 + lsrs r2, 16 + movs r0, 0 + bl SendBlock + ldrh r0, [r4, 0x10] + adds r0, 0x1 + strh r0, [r4, 0x10] + b _0801DB3E +_0801DB08: + ldr r1, [r4, 0x1C] + adds r1, r3 + movs r0, 0 + movs r2, 0xFC + bl SendBlock + ldrh r0, [r4, 0x10] + adds r0, 0x1 + strh r0, [r4, 0x10] + b _0801DB5E +_0801DB1C: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801DB5E + ldr r0, [r4, 0x1C] + ldrh r1, [r4, 0x14] + bl CalcCRC16WithTable + lsls r0, 16 + lsrs r0, 16 + ldrh r1, [r4, 0x12] + cmp r0, r1 + beq _0801DB3E + bl sub_8010198 + b _0801DB5E +_0801DB3E: + ldr r0, [r4] + adds r0, 0x1 + str r0, [r4] + b _0801DB5E +_0801DB46: + ldrb r0, [r4, 0x4] + bl sub_801D954 + cmp r0, 0 + beq _0801DB5E + ldrb r0, [r4, 0x4] + bl sub_801D978 + movs r0, 0 + str r0, [r4] + movs r0, 0x1 + b _0801DB60 +_0801DB5E: + movs r0, 0 +_0801DB60: + add sp, 0x8 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_801DA5C + + thumb_func_start sub_801DB68 +sub_801DB68: @ 801DB68 + push {r4,r5,lr} + adds r4, r0, 0 + bl sub_801B044 + adds r5, r0, 0 + movs r0, 0x3 + adds r1, r4, 0 + ands r1, r0 + ldrb r2, [r5] + movs r0, 0x4 + negs r0, r0 + ands r0, r2 + orrs r0, r1 + strb r0, [r5] + cmp r4, 0x2 + bhi _0801DB8E + cmp r4, 0x1 + bcs _0801DB94 + b _0801DBB8 +_0801DB8E: + cmp r4, 0x3 + beq _0801DBA6 + b _0801DBB8 +_0801DB94: + bl Random + lsls r0, 16 + lsrs r0, 16 + movs r1, 0xF + bl __umodsi3 + adds r0, 0x10 + b _0801DBB6 +_0801DBA6: + bl Random + lsls r0, 16 + lsrs r0, 16 + movs r1, 0xF + bl __umodsi3 + adds r0, 0x1 +_0801DBB6: + strb r0, [r5, 0x1] +_0801DBB8: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801DB68 + + thumb_func_start sub_801DBC0 +sub_801DBC0: @ 801DBC0 + push {lr} + bl sub_801B044 + movs r1, 0 + strb r1, [r0] + strb r1, [r0, 0x1] + ldr r0, =0x0000402e + bl VarSet + pop {r0} + bx r0 + .pool + thumb_func_end sub_801DBC0 + + thumb_func_start sub_801DBDC +sub_801DBDC: @ 801DBDC + push {r4,lr} + ldr r0, =0x0000402e + bl GetVarPointer + adds r4, r0, 0 + bl sub_801B044 + adds r2, r0, 0 + ldr r0, [r2] + lsls r0, 24 + lsrs r0, 29 + cmp r0, 0x4 + bls _0801DC10 + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] + lsls r0, 16 + ldr r1, =0x01f30000 + cmp r0, r1 + bls _0801DC10 + ldrb r0, [r2] + movs r1, 0x1F + ands r1, r0 + strb r1, [r2] + movs r0, 0 + strh r0, [r4] +_0801DC10: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801DBDC + + thumb_func_start sub_801DC20 +sub_801DC20: @ 801DC20 + push {r4-r6,lr} + ldr r6, =gScriptResult + bl sub_801B044 + adds r4, r0, 0 + bl IsMysteryEventEnabled + cmp r0, 0 + beq _0801DC3A + bl sub_801B0CC + cmp r0, 0 + bne _0801DC44 +_0801DC3A: + movs r0, 0 + b _0801DCA6 + .pool +_0801DC44: + adds r0, r4, 0 + bl sub_801DD44 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0x6 + bhi _0801DCA4 + lsls r0, r5, 2 + ldr r1, =_0801DC60 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801DC60: + .4byte _0801DCA4 + .4byte _0801DC7C + .4byte _0801DC7C + .4byte _0801DCA4 + .4byte _0801DC86 + .4byte _0801DC96 + .4byte _0801DCA4 +_0801DC7C: + adds r0, r4, 0 + bl sub_801DCAC + strh r0, [r6] + b _0801DCA4 +_0801DC86: + adds r0, r4, 0 + bl sub_801DCAC + strh r0, [r6] + adds r0, r4, 0 + bl sub_801DCD8 + b _0801DCA4 +_0801DC96: + adds r0, r4, 0 + bl sub_801DCAC + strh r0, [r6] + adds r0, r4, 0 + bl sub_801DCCC +_0801DCA4: + adds r0, r5, 0 +_0801DCA6: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801DC20 + + thumb_func_start sub_801DCAC +sub_801DCAC: @ 801DCAC + push {r4,lr} + ldrb r2, [r0] + movs r1, 0x4 + negs r1, r1 + ands r1, r2 + strb r1, [r0] + ldrb r4, [r0, 0x1] + adds r4, 0x84 + movs r1, 0 + strb r1, [r0, 0x1] + bl sub_801DD10 + adds r0, r4, 0 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801DCAC + + thumb_func_start sub_801DCCC +sub_801DCCC: @ 801DCCC + ldrb r2, [r0] + movs r1, 0x1D + negs r1, r1 + ands r1, r2 + strb r1, [r0] + bx lr + thumb_func_end sub_801DCCC + + thumb_func_start sub_801DCD8 +sub_801DCD8: @ 801DCD8 + push {r4,lr} + adds r3, r0, 0 + ldr r0, [r3] + lsls r0, 27 + lsrs r0, 29 + adds r0, 0x1 + movs r1, 0x7 + ands r0, r1 + lsls r0, 2 + ldrb r1, [r3] + movs r4, 0x1D + negs r4, r4 + adds r2, r4, 0 + ands r2, r1 + orrs r2, r0 + strb r2, [r3] + ldr r0, [r3] + lsls r0, 27 + lsrs r0, 29 + cmp r0, 0x4 + bls _0801DD0A + ands r2, r4 + movs r0, 0x10 + orrs r2, r0 + strb r2, [r3] +_0801DD0A: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801DCD8 + + thumb_func_start sub_801DD10 +sub_801DD10: @ 801DD10 + push {r4,lr} + adds r3, r0, 0 + ldr r0, [r3] + lsls r0, 24 + lsrs r0, 29 + adds r0, 0x1 + lsls r0, 5 + ldrb r1, [r3] + movs r4, 0x1F + adds r2, r4, 0 + ands r2, r1 + orrs r2, r0 + strb r2, [r3] + ldr r0, [r3] + lsls r0, 24 + lsrs r0, 29 + cmp r0, 0x5 + bls _0801DD3C + ands r2, r4 + movs r0, 0xA0 + orrs r2, r0 + strb r2, [r3] +_0801DD3C: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801DD10 + + thumb_func_start sub_801DD44 +sub_801DD44: @ 801DD44 + push {lr} + adds r2, r0, 0 + ldrb r1, [r2] + movs r0, 0xE0 + ands r0, r1 + cmp r0, 0xA0 + bne _0801DD56 + movs r0, 0x6 + b _0801DD92 +_0801DD56: + ldr r1, [r2] + lsls r0, r1, 30 + lsrs r0, 30 + cmp r0, 0x1 + beq _0801DD78 + cmp r0, 0x1 + bgt _0801DD6A + cmp r0, 0 + beq _0801DD74 + b _0801DD90 +_0801DD6A: + cmp r0, 0x2 + beq _0801DD7C + cmp r0, 0x3 + beq _0801DD80 + b _0801DD90 +_0801DD74: + movs r0, 0x3 + b _0801DD92 +_0801DD78: + movs r0, 0x1 + b _0801DD92 +_0801DD7C: + movs r0, 0x2 + b _0801DD92 +_0801DD80: + lsls r0, r1, 27 + lsrs r0, 29 + cmp r0, 0x2 + bhi _0801DD8C + movs r0, 0x4 + b _0801DD92 +_0801DD8C: + movs r0, 0x5 + b _0801DD92 +_0801DD90: + movs r0, 0 +_0801DD92: + pop {r1} + bx r1 + thumb_func_end sub_801DD44 + + thumb_func_start sub_801DD98 +sub_801DD98: @ 801DD98 + push {r4,lr} + ldr r4, =gUnknown_02022C84 + movs r0, 0xDE + lsls r0, 1 + bl Alloc + str r0, [r4] + bl sub_801DDD0 + ldr r1, =gKeyRepeatStartDelay + movs r0, 0x14 + strh r0, [r1] + movs r0, 0 + bl SetVBlankCallback + ldr r0, =c2_081284E0 + bl SetMainCallback2 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801DD98 + + thumb_func_start sub_801DDD0 +sub_801DDD0: @ 801DDD0 + push {r4-r7,lr} + adds r4, r0, 0 + movs r5, 0 + movs r0, 0 + strh r0, [r4, 0x4] + strh r0, [r4, 0x6] + strb r5, [r4, 0x10] + strb r5, [r4, 0x11] + strb r5, [r4, 0x12] + strb r5, [r4, 0x14] + strb r5, [r4, 0x15] + strb r5, [r4, 0x16] + movs r0, 0xFF + strb r0, [r4, 0x1A] + bl GetLinkPlayerCount + strb r0, [r4, 0xD] + bl GetMultiplayerId + strb r0, [r4, 0x13] + strb r5, [r4, 0x17] + strb r5, [r4, 0x18] + movs r1, 0xC8 + lsls r1, 1 + adds r0, r4, r1 + bl sub_801EF1C + ldr r7, =gSaveBlock1Ptr + ldr r6, =0x00003c88 + adds r4, 0xB9 + movs r5, 0x9 +_0801DE0E: + ldr r1, [r7] + adds r1, r6 + adds r0, r4, 0 + bl StringCopy + adds r6, 0x15 + adds r4, 0x15 + subs r5, 0x1 + cmp r5, 0 + bge _0801DE0E + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801DDD0 + + thumb_func_start sub_801DE30 +sub_801DE30: @ 801DE30 + push {r4,lr} + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + ldrb r0, [r0, 0xE] + bl DestroyTask + ldr r0, [r4] + ldrb r0, [r0, 0xF] + bl DestroyTask + ldr r0, [r4] + bl Free + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801DE30 + + thumb_func_start c2_081284E0 +c2_081284E0: @ 801DE54 + push {r4-r6,lr} + sub sp, 0x4 + ldr r0, =gMain + movs r1, 0x87 + lsls r1, 3 + adds r6, r0, r1 + ldrb r0, [r6] + cmp r0, 0x1 + beq _0801DE8C + cmp r0, 0x1 + bgt _0801DE74 + cmp r0, 0 + beq _0801DE7A + b _0801DF04 + .pool +_0801DE74: + cmp r0, 0x2 + beq _0801DEC8 + b _0801DF04 +_0801DE7A: + bl ResetTasks + bl ResetSpriteData + bl FreeAllSpritePalettes + bl sub_801F4D0 + b _0801DEBC +_0801DE8C: + bl sub_801F5B8 + bl sub_801F534 + adds r5, r0, 0 + cmp r5, 0 + bne _0801DF04 + movs r4, 0x1 + negs r4, r4 + adds r0, r4, 0 + movs r1, 0x10 + movs r2, 0 + bl BlendPalettes + str r5, [sp] + adds r0, r4, 0 + adds r1, r4, 0 + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + ldr r0, =sub_801DF20 + bl SetVBlankCallback +_0801DEBC: + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] + b _0801DF04 + .pool +_0801DEC8: + bl UpdatePaletteFade + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _0801DF04 + ldr r0, =sub_801DF38 + bl SetMainCallback2 + ldr r0, =sub_801DF54 + movs r1, 0x8 + bl CreateTask + ldr r4, =gUnknown_02022C84 + ldr r1, [r4] + strb r0, [r1, 0xE] + ldr r0, =sub_801F2B4 + movs r1, 0x7 + bl CreateTask + ldr r1, [r4] + strb r0, [r1, 0xF] + bl sub_800E0E8 + movs r0, 0xE8 + movs r1, 0x96 + bl sub_800DFB4 +_0801DF04: + add sp, 0x4 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end c2_081284E0 + + thumb_func_start sub_801DF20 +sub_801DF20: @ 801DF20 + push {lr} + bl TransferPlttBuffer + bl LoadOam + bl ProcessSpriteCopyRequests + bl sub_80BA0A8 + pop {r0} + bx r0 + thumb_func_end sub_801DF20 + + thumb_func_start sub_801DF38 +sub_801DF38: @ 801DF38 + push {lr} + bl RunTasks + bl sub_801F5B8 + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade + pop {r0} + bx r0 + thumb_func_end sub_801DF38 + + thumb_func_start sub_801DF54 +sub_801DF54: @ 801DF54 + push {r4,lr} + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + ldrb r0, [r0, 0x17] + cmp r0, 0x2 + beq _0801DF7A + cmp r0, 0x2 + bgt _0801DF70 + cmp r0, 0x1 + beq _0801DF76 + b _0801DF8A + .pool +_0801DF70: + cmp r0, 0x3 + beq _0801DF7E + b _0801DF8A +_0801DF76: + movs r0, 0x6 + b _0801DF80 +_0801DF7A: + movs r0, 0x7 + b _0801DF80 +_0801DF7E: + movs r0, 0x8 +_0801DF80: + bl sub_801EBD4 + ldr r1, [r4] + movs r0, 0 + strb r0, [r1, 0x17] +_0801DF8A: + ldr r1, =gUnknown_082F2A7C + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrh r0, [r0, 0x4] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + bl _call_via_r0 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801DF54 + + thumb_func_start sub_801DFAC +sub_801DFAC: @ 801DFAC + push {r4,lr} + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + ldrh r1, [r0, 0x6] + cmp r1, 0x1 + beq _0801DFE0 + cmp r1, 0x1 + bgt _0801DFC8 + cmp r1, 0 + beq _0801DFCE + b _0801E028 + .pool +_0801DFC8: + cmp r1, 0x2 + beq _0801E018 + b _0801E028 +_0801DFCE: + movs r1, 0xC8 + lsls r1, 1 + adds r0, r1 + bl sub_801EF24 + ldr r1, [r4] + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] +_0801DFE0: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801E028 + bl sub_8011A9C + cmp r0, 0 + bne _0801E028 + ldr r4, =gUnknown_02022C84 + ldr r1, [r4] + movs r0, 0xC8 + lsls r0, 1 + adds r1, r0 + movs r0, 0 + movs r2, 0x28 + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _0801E028 + ldr r1, [r4] + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] + b _0801E028 + .pool +_0801E018: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801E028 + movs r0, 0x1 + bl sub_801EBD4 +_0801E028: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801DFAC + + thumb_func_start sub_801E030 +sub_801E030: @ 801E030 + push {r4,r5,lr} + ldr r5, =gUnknown_02022C84 + ldr r3, [r5] + ldrh r0, [r3, 0x6] + cmp r0, 0 + beq _0801E048 + cmp r0, 0x1 + beq _0801E0F6 + b _0801E118 + .pool +_0801E048: + ldr r1, =gMain + ldrh r2, [r1, 0x2E] + movs r0, 0x8 + ands r0, r2 + cmp r0, 0 + beq _0801E068 + ldrb r0, [r3, 0x15] + cmp r0, 0 + beq _0801E118 + movs r0, 0x4 + bl sub_801EBD4 + b _0801E118 + .pool +_0801E068: + movs r0, 0x4 + ands r0, r2 + cmp r0, 0 + beq _0801E078 + movs r0, 0x2 + bl sub_801EBD4 + b _0801E118 +_0801E078: + ldrh r1, [r1, 0x30] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0801E0A4 + ldrb r0, [r3, 0x15] + cmp r0, 0 + beq _0801E09C + bl sub_801ED68 + movs r0, 0x8 + movs r1, 0 + bl sub_801F5EC + ldr r1, [r5] + movs r0, 0x1 + strh r0, [r1, 0x6] + b _0801E118 +_0801E09C: + movs r0, 0x3 + bl sub_801EBD4 + b _0801E118 +_0801E0A4: + movs r4, 0x1 + adds r0, r4, 0 + ands r0, r2 + cmp r0, 0 + beq _0801E0C0 + bl sub_801EC94 + movs r0, 0x8 + movs r1, 0 + bl sub_801F5EC + movs r0, 0x2 + movs r1, 0x1 + b _0801E0EC +_0801E0C0: + movs r0, 0x80 + lsls r0, 1 + ands r0, r2 + cmp r0, 0 + beq _0801E0E0 + ldrb r0, [r3, 0x10] + cmp r0, 0x3 + beq _0801E0D8 + bl sub_801ED94 + movs r0, 0x8 + b _0801E0EA +_0801E0D8: + movs r0, 0x5 + bl sub_801EBD4 + b _0801E118 +_0801E0E0: + bl sub_801EBE4 + cmp r0, 0 + beq _0801E118 + movs r0, 0x1 +_0801E0EA: + movs r1, 0 +_0801E0EC: + bl sub_801F5EC + ldr r0, [r5] + strh r4, [r0, 0x6] + b _0801E118 +_0801E0F6: + movs r0, 0 + bl sub_801F644 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + bl sub_801F644 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r4, 0 + bne _0801E118 + cmp r1, 0 + bne _0801E118 + ldr r0, [r5] + strh r1, [r0, 0x6] +_0801E118: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801E030 + + thumb_func_start sub_801E120 +sub_801E120: @ 801E120 + push {r4-r6,lr} + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrh r0, [r0, 0x6] + cmp r0, 0x4 + bls _0801E12E + b _0801E23A +_0801E12E: + lsls r0, 2 + ldr r1, =_0801E140 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801E140: + .4byte _0801E154 + .4byte _0801E15E + .4byte _0801E17C + .4byte _0801E208 + .4byte _0801E21C +_0801E154: + movs r0, 0x3 + movs r1, 0 + bl sub_801F5EC + b _0801E16A +_0801E15E: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E23A +_0801E16A: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] + b _0801E23A + .pool +_0801E17C: + bl ProcessMenuInput + lsls r0, 24 + asrs r0, 8 + lsrs r6, r0, 16 + asrs r4, r0, 16 + movs r0, 0x2 + negs r0, r0 + cmp r4, r0 + beq _0801E1B4 + adds r0, 0x1 + cmp r4, r0 + beq _0801E1D4 + movs r0, 0x4 + movs r1, 0 + bl sub_801F5EC + ldr r5, =gUnknown_02022C84 + ldr r2, [r5] + ldrb r0, [r2, 0x10] + cmp r0, r4 + beq _0801E1DC + cmp r4, 0x3 + ble _0801E1EC + b _0801E1DC + .pool +_0801E1B4: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _0801E23A + movs r0, 0x5 + bl PlaySE + movs r0, 0x1 + bl MoveMenuCursor + b _0801E23A + .pool +_0801E1D4: + movs r0, 0x4 + movs r1, 0 + bl sub_801F5EC +_0801E1DC: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x3 + strh r0, [r1, 0x6] + b _0801E23A + .pool +_0801E1EC: + movs r1, 0 + strb r1, [r2, 0x11] + ldr r0, [r5] + strb r1, [r0, 0x12] + movs r0, 0x5 + movs r1, 0x1 + bl sub_801F5EC + ldr r0, [r5] + strb r6, [r0, 0x10] + ldr r1, [r5] + movs r0, 0x4 + strh r0, [r1, 0x6] + b _0801E23A +_0801E208: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E23A + movs r0, 0x1 + bl sub_801EBD4 + b _0801E23A +_0801E21C: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E23A + movs r0, 0x1 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E23A + movs r0, 0x1 + bl sub_801EBD4 +_0801E23A: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_801E120 + + thumb_func_start sub_801E240 +sub_801E240: @ 801E240 + push {r4,r5,lr} + ldr r1, =gUnknown_02022C84 + ldr r0, [r1] + ldrh r0, [r0, 0x6] + adds r2, r1, 0 + cmp r0, 0xA + bls _0801E250 + b _0801E458 +_0801E250: + lsls r0, 2 + ldr r1, =_0801E264 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801E264: + .4byte _0801E290 + .4byte _0801E2A8 + .4byte _0801E2C4 + .4byte _0801E322 + .4byte _0801E3D4 + .4byte _0801E424 + .4byte _0801E458 + .4byte _0801E458 + .4byte _0801E378 + .4byte _0801E338 + .4byte _0801E35C +_0801E290: + movs r0, 0x6 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x1 + strh r0, [r1, 0x6] + b _0801E458 + .pool +_0801E2A8: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + beq _0801E2B6 + b _0801E458 +_0801E2B6: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x2 + strh r0, [r1, 0x6] + b _0801E458 + .pool +_0801E2C4: + bl sub_801FF08 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _0801E2E6 + cmp r1, 0 + bgt _0801E2DE + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _0801E396 + b _0801E458 +_0801E2DE: + cmp r1, 0x1 + beq _0801E2E4 + b _0801E458 +_0801E2E4: + b _0801E396 +_0801E2E6: + ldr r4, =gUnknown_02022C84 + ldr r1, [r4] + ldrb r0, [r1, 0x13] + cmp r0, 0 + bne _0801E310 + movs r2, 0xC8 + lsls r2, 1 + adds r0, r1, r2 + bl sub_801EFD0 + movs r0, 0x7 + movs r1, 0 + bl sub_801F5EC + ldr r1, [r4] + movs r0, 0x9 + strh r0, [r1, 0x6] + b _0801E458 + .pool +_0801E310: + movs r2, 0xC8 + lsls r2, 1 + adds r0, r1, r2 + bl sub_801EF7C + ldr r1, [r4] + movs r0, 0x4 + strh r0, [r1, 0x6] + b _0801E458 +_0801E322: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + beq _0801E330 + b _0801E458 +_0801E330: + movs r0, 0x1 + bl sub_801EBD4 + b _0801E458 +_0801E338: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + beq _0801E346 + b _0801E458 +_0801E346: + movs r0, 0x14 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0xA + strh r0, [r1, 0x6] + b _0801E458 + .pool +_0801E35C: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + beq _0801E36A + b _0801E458 +_0801E36A: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x8 + strh r0, [r1, 0x6] + b _0801E458 + .pool +_0801E378: + bl sub_801FF08 + lsls r0, 24 + asrs r5, r0, 24 + cmp r5, 0 + beq _0801E3AC + cmp r5, 0 + bgt _0801E392 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + beq _0801E396 + b _0801E458 +_0801E392: + cmp r5, 0x1 + bne _0801E458 +_0801E396: + movs r0, 0x7 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x3 + strh r0, [r1, 0x6] + b _0801E458 + .pool +_0801E3AC: + bl sub_80104B0 + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + movs r1, 0xC8 + lsls r1, 1 + adds r0, r1 + bl sub_801EFD0 + ldr r0, [r4] + movs r1, 0x4 + strh r1, [r0, 0x6] + movs r2, 0xDC + lsls r2, 1 + adds r0, r2 + strh r5, [r0] + b _0801E458 + .pool +_0801E3D4: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801E414 + bl sub_8011A9C + cmp r0, 0 + bne _0801E414 + ldr r4, =gUnknown_02022C84 + ldr r1, [r4] + movs r0, 0xC8 + lsls r0, 1 + adds r1, r0 + movs r0, 0 + movs r2, 0x28 + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _0801E414 + ldr r1, [r4] + ldrb r0, [r1, 0x13] + cmp r0, 0 + bne _0801E410 + movs r0, 0x6 + b _0801E412 + .pool +_0801E410: + movs r0, 0x5 +_0801E412: + strh r0, [r1, 0x6] +_0801E414: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801E458 + b _0801E42C + .pool +_0801E424: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801E438 +_0801E42C: + movs r0, 0x9 + bl sub_801EBD4 + b _0801E458 + .pool +_0801E438: + ldr r3, [r2] + movs r1, 0xDC + lsls r1, 1 + adds r2, r3, r1 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + lsls r0, 16 + movs r1, 0x96 + lsls r1, 17 + cmp r0, r1 + bls _0801E458 + movs r0, 0 + strh r0, [r2] + movs r0, 0x4 + strh r0, [r3, 0x6] +_0801E458: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801E240 + + thumb_func_start sub_801E460 +sub_801E460: @ 801E460 + push {r4,lr} + ldr r1, =gUnknown_02022C84 + ldr r0, [r1] + ldrh r0, [r0, 0x6] + adds r2, r1, 0 + cmp r0, 0x7 + bls _0801E470 + b _0801E5BC +_0801E470: + lsls r0, 2 + ldr r1, =_0801E484 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801E484: + .4byte _0801E4A4 + .4byte _0801E4C8 + .4byte _0801E4E8 + .4byte _0801E50C + .4byte _0801E540 + .4byte _0801E560 + .4byte _0801E584 + .4byte _0801E5A8 +_0801E4A4: + ldr r0, =sub_801F2B4 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + beq _0801E4B2 + b _0801E5BC +_0801E4B2: + movs r0, 0x7 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + b _0801E59A + .pool +_0801E4C8: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E5BC + movs r0, 0x12 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + b _0801E59A + .pool +_0801E4E8: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E5BC + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + movs r1, 0xC8 + lsls r1, 1 + adds r0, r1 + bl sub_801EFA8 + ldr r1, [r4] + b _0801E59A + .pool +_0801E50C: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801E5BC + bl sub_8011A9C + cmp r0, 0 + bne _0801E5BC + ldr r4, =gUnknown_02022C84 + ldr r1, [r4] + movs r0, 0xC8 + lsls r0, 1 + adds r1, r0 + movs r0, 0 + movs r2, 0x28 + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _0801E5BC + ldr r1, [r4] + b _0801E59A + .pool +_0801E540: + bl GetBlockReceivedStatus + movs r1, 0x1 + ands r1, r0 + cmp r1, 0 + beq _0801E5BC + bl sub_8011A9C + cmp r0, 0 + bne _0801E5BC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + b _0801E59A + .pool +_0801E560: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801E5BC + bl sub_8011A9C + adds r4, r0, 0 + cmp r4, 0 + bne _0801E5BC + bl sub_800AC34 + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + strh r4, [r1, 0xA] + b _0801E59A + .pool +_0801E584: + ldr r1, [r2] + ldrh r0, [r1, 0xA] + cmp r0, 0x95 + bhi _0801E590 + adds r0, 0x1 + strh r0, [r1, 0xA] +_0801E590: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801E5BC + ldr r1, [r2] +_0801E59A: + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] + b _0801E5BC + .pool +_0801E5A8: + ldr r1, [r2] + ldrh r0, [r1, 0xA] + cmp r0, 0x95 + bls _0801E5B8 + movs r0, 0x9 + bl sub_801EBD4 + b _0801E5BC +_0801E5B8: + adds r0, 0x1 + strh r0, [r1, 0xA] +_0801E5BC: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801E460 + + thumb_func_start sub_801E5C4 +sub_801E5C4: @ 801E5C4 + push {r4,r5,lr} + ldr r5, =gUnknown_02022C84 + ldr r1, [r5] + ldrh r0, [r1, 0x6] + cmp r0, 0x1 + beq _0801E604 + cmp r0, 0x1 + bgt _0801E5E0 + cmp r0, 0 + beq _0801E5EA + b _0801E662 + .pool +_0801E5E0: + cmp r0, 0x2 + beq _0801E62E + cmp r0, 0x3 + beq _0801E650 + b _0801E662 +_0801E5EA: + ldr r0, =sub_801F2B4 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _0801E662 + movs r0, 0x7 + movs r1, 0 + bl sub_801F5EC + b _0801E640 + .pool +_0801E604: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E662 + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801E662 + bl sub_8011A9C + adds r4, r0, 0 + cmp r4, 0 + bne _0801E662 + bl sub_800AC34 + ldr r1, [r5] + strh r4, [r1, 0xA] + b _0801E642 +_0801E62E: + ldrh r0, [r1, 0xA] + cmp r0, 0x95 + bhi _0801E638 + adds r0, 0x1 + strh r0, [r1, 0xA] +_0801E638: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801E662 +_0801E640: + ldr r1, [r5] +_0801E642: + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] + b _0801E662 + .pool +_0801E650: + ldrh r0, [r1, 0xA] + cmp r0, 0x95 + bls _0801E65E + movs r0, 0x9 + bl sub_801EBD4 + b _0801E662 +_0801E65E: + adds r0, 0x1 + strh r0, [r1, 0xA] +_0801E662: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_801E5C4 + + thumb_func_start sub_801E668 +sub_801E668: @ 801E668 + push {r4,lr} + ldr r1, =gUnknown_02022C84 + ldr r0, [r1] + ldrh r0, [r0, 0x6] + adds r2, r1, 0 + cmp r0, 0x4 + bhi _0801E75C + lsls r0, 2 + ldr r1, =_0801E688 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801E688: + .4byte _0801E69C + .4byte _0801E6C8 + .4byte _0801E6F0 + .4byte _0801E724 + .4byte _0801E748 +_0801E69C: + ldr r0, =sub_801F2B4 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _0801E75C + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + ldrb r0, [r0, 0x13] + cmp r0, 0 + beq _0801E6BA + movs r0, 0x7 + movs r1, 0 + bl sub_801F5EC +_0801E6BA: + ldr r1, [r4] + b _0801E73A + .pool +_0801E6C8: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E75C + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + ldrb r0, [r0, 0x13] + cmp r0, 0 + beq _0801E6E6 + movs r0, 0x13 + movs r1, 0 + bl sub_801F5EC +_0801E6E6: + ldr r1, [r4] + b _0801E73A + .pool +_0801E6F0: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _0801E75C + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801E75C + bl sub_8011A9C + adds r4, r0, 0 + cmp r4, 0 + bne _0801E75C + bl sub_800AC34 + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + strh r4, [r1, 0xA] + b _0801E73A + .pool +_0801E724: + ldr r1, [r2] + ldrh r0, [r1, 0xA] + cmp r0, 0x95 + bhi _0801E730 + adds r0, 0x1 + strh r0, [r1, 0xA] +_0801E730: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801E75C + ldr r1, [r2] +_0801E73A: + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] + b _0801E75C + .pool +_0801E748: + ldr r1, [r2] + ldrh r0, [r1, 0xA] + cmp r0, 0x95 + bls _0801E758 + movs r0, 0x9 + bl sub_801EBD4 + b _0801E75C +_0801E758: + adds r0, 0x1 + strh r0, [r1, 0xA] +_0801E75C: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801E668 + + thumb_func_start sub_801E764 +sub_801E764: @ 801E764 + push {r4,lr} + ldr r1, =gUnknown_02022C84 + ldr r0, [r1] + ldrh r0, [r0, 0x6] + adds r4, r1, 0 + cmp r0, 0x4 + bhi _0801E830 + lsls r0, 2 + ldr r1, =_0801E784 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801E784: + .4byte _0801E798 + .4byte _0801E7C0 + .4byte _0801E7F4 + .4byte _0801E802 + .4byte _0801E820 +_0801E798: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801E7AC + movs r0, 0x1 + bl sub_801EBD4 + b _0801E830 + .pool +_0801E7AC: + ldr r0, [r4] + movs r1, 0xC8 + lsls r1, 1 + adds r0, r1 + bl sub_801EF4C + ldr r1, [r4] + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] +_0801E7C0: + bl sub_800A520 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0801E830 + bl sub_8011A9C + cmp r0, 0 + bne _0801E830 + ldr r4, =gUnknown_02022C84 + ldr r1, [r4] + movs r0, 0xC8 + lsls r0, 1 + adds r1, r0 + movs r0, 0 + movs r2, 0x28 + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _0801E830 + ldr r1, [r4] + b _0801E812 + .pool +_0801E7F4: + bl sub_801EE10 + movs r0, 0x8 + movs r1, 0 + bl sub_801F5EC + b _0801E80E +_0801E802: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E830 +_0801E80E: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] +_0801E812: + ldrh r0, [r1, 0x6] + adds r0, 0x1 + strh r0, [r1, 0x6] + b _0801E830 + .pool +_0801E820: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0801E830 + movs r0, 0x1 + bl sub_801EBD4 +_0801E830: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801E764 + + thumb_func_start sub_801E838 +sub_801E838: @ 801E838 + push {r4,lr} + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrh r0, [r0, 0x6] + cmp r0, 0x6 + bls _0801E846 + b _0801E968 +_0801E846: + lsls r0, 2 + ldr r1, =_0801E858 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801E858: + .4byte _0801E874 + .4byte _0801E8A4 + .4byte _0801E8F8 + .4byte _0801E910 + .4byte _0801E920 + .4byte _0801E934 + .4byte _0801E94C +_0801E874: + bl sub_801EDC4 + cmp r0, 0 + beq _0801E890 + movs r0, 0x9 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x2 + b _0801E966 + .pool +_0801E890: + movs r0, 0xD + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x5 + b _0801E966 + .pool +_0801E8A4: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0801E8CC + bl sub_801EDE0 + movs r0, 0xB + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x3 + b _0801E966 + .pool +_0801E8CC: + movs r4, 0x2 + adds r0, r4, 0 + ands r0, r1 + cmp r0, 0 + beq _0801E8DA + movs r0, 0xA + b _0801E95A +_0801E8DA: + bl sub_801EBE4 + cmp r0, 0 + beq _0801E968 + movs r0, 0x1 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + strh r4, [r0, 0x6] + b _0801E968 + .pool +_0801E8F8: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E968 + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x1 + b _0801E966 + .pool +_0801E910: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E968 + movs r0, 0xA + b _0801E95A +_0801E920: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E968 + movs r0, 0x1 + bl sub_801EBD4 + b _0801E968 +_0801E934: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801E968 + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x6 + b _0801E966 + .pool +_0801E94C: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _0801E968 + movs r0, 0x7 +_0801E95A: + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x4 +_0801E966: + strh r0, [r1, 0x6] +_0801E968: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801E838 + + thumb_func_start sub_801E978 +sub_801E978: @ 801E978 + push {r4,lr} + sub sp, 0x4 + ldr r1, =gUnknown_02022C84 + ldr r0, [r1] + ldrh r0, [r0, 0x6] + adds r4, r1, 0 + cmp r0, 0xD + bls _0801E98A + b _0801EBC2 +_0801E98A: + lsls r0, 2 + ldr r1, =_0801E99C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801E99C: + .4byte _0801E9D4 + .4byte _0801E9EE + .4byte _0801EA14 + .4byte _0801EA58 + .4byte _0801EA7C + .4byte _0801EA98 + .4byte _0801EADC + .4byte _0801EB04 + .4byte _0801EB28 + .4byte _0801EB40 + .4byte _0801EB64 + .4byte _0801EB72 + .4byte _0801EB88 + .4byte _0801EBA8 +_0801E9D4: + ldr r1, [r4] + ldrb r0, [r1, 0x18] + cmp r0, 0 + bne _0801E9DE + b _0801EB82 +_0801E9DE: + movs r0, 0x7 + movs r1, 0 + bl sub_801F5EC + ldr r1, [r4] + movs r0, 0x1 + strh r0, [r1, 0x6] + b _0801EBC2 +_0801E9EE: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + beq _0801E9FC + b _0801EBC2 +_0801E9FC: + movs r0, 0xE + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x2 + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EA14: + bl sub_801FF08 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _0801EA40 + cmp r1, 0 + bgt _0801EA2E + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _0801EA34 + b _0801EBC2 +_0801EA2E: + cmp r1, 0x1 + beq _0801EA34 + b _0801EBC2 +_0801EA34: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + b _0801EB82 + .pool +_0801EA40: + movs r0, 0x7 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x3 + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EA58: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + beq _0801EA66 + b _0801EBC2 +_0801EA66: + movs r0, 0xF + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x4 + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EA7C: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + beq _0801EA8A + b _0801EBC2 +_0801EA8A: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x5 + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EA98: + bl sub_801FF08 + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _0801EAC4 + cmp r1, 0 + bgt _0801EAB2 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _0801EAB8 + b _0801EBC2 +_0801EAB2: + cmp r1, 0x1 + beq _0801EAB8 + b _0801EBC2 +_0801EAB8: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + b _0801EB82 + .pool +_0801EAC4: + movs r0, 0x7 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x6 + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EADC: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801EBC2 + movs r0, 0x10 + movs r1, 0 + bl sub_801F5EC + bl sub_801EE2C + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x7 + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EB04: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801EBC2 + bl sub_8076D5C + movs r0, 0 + bl TrySavingData + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x8 + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EB28: + movs r0, 0x11 + movs r1, 0 + bl sub_801F5EC + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x9 + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EB40: + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801EBC2 + movs r0, 0x37 + bl PlaySE + bl sav2_gender2_inplace_and_xFE + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0xA + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EB64: + ldr r1, [r4] + movs r0, 0 + strb r0, [r1, 0x19] + ldr r1, [r4] + movs r0, 0xB + strh r0, [r1, 0x6] + b _0801EBC2 +_0801EB72: + ldr r0, [r4] + ldrb r1, [r0, 0x19] + adds r1, 0x1 + strb r1, [r0, 0x19] + ldr r1, [r4] + ldrb r0, [r1, 0x19] + cmp r0, 0x78 + bls _0801EBC2 +_0801EB82: + movs r0, 0xC + strh r0, [r1, 0x6] + b _0801EBC2 +_0801EB88: + movs r1, 0x1 + negs r1, r1 + movs r0, 0 + str r0, [sp] + adds r0, r1, 0 + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0xD + strh r0, [r1, 0x6] + b _0801EBC2 + .pool +_0801EBA8: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _0801EBC2 + bl sub_801F544 + bl sub_801DE30 + ldr r0, =c2_exit_to_overworld_2_switch + bl SetMainCallback2 +_0801EBC2: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801E978 + + thumb_func_start sub_801EBD4 +sub_801EBD4: @ 801EBD4 + ldr r1, =gUnknown_02022C84 + ldr r1, [r1] + movs r2, 0 + strh r0, [r1, 0x4] + strh r2, [r1, 0x6] + bx lr + .pool + thumb_func_end sub_801EBD4 + + thumb_func_start sub_801EBE4 +sub_801EBE4: @ 801EBE4 + push {lr} + ldr r0, =gMain + ldrh r2, [r0, 0x30] + movs r0, 0x40 + ands r0, r2 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, 0 + bne _0801EC6E + movs r0, 0x80 + ands r0, r2 + cmp r0, 0 + beq _0801EC24 + ldr r0, =gUnknown_02022C84 + ldr r2, [r0] + ldr r1, =gUnknown_082F2AA4 + ldrb r0, [r2, 0x10] + adds r0, r1 + ldrb r1, [r2, 0x12] + ldrb r0, [r0] + cmp r1, r0 + bcs _0801EC20 + adds r0, r1, 0x1 + b _0801EC88 + .pool +_0801EC20: + strb r3, [r2, 0x12] + b _0801EC8A +_0801EC24: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + ldrb r0, [r1, 0x10] + cmp r0, 0x3 + beq _0801EC6A + movs r0, 0x20 + ands r0, r2 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, 0 + beq _0801EC52 + ldrb r0, [r1, 0x11] + cmp r0, 0 + beq _0801EC4C + subs r0, 0x1 + strb r0, [r1, 0x11] + b _0801EC8A + .pool +_0801EC4C: + movs r0, 0x4 + strb r0, [r1, 0x11] + b _0801EC8A +_0801EC52: + movs r0, 0x10 + ands r0, r2 + cmp r0, 0 + beq _0801EC6A + ldrb r0, [r1, 0x11] + cmp r0, 0x3 + bhi _0801EC66 + adds r0, 0x1 + strb r0, [r1, 0x11] + b _0801EC8A +_0801EC66: + strb r3, [r1, 0x11] + b _0801EC8A +_0801EC6A: + movs r0, 0 + b _0801EC8C +_0801EC6E: + ldr r0, =gUnknown_02022C84 + ldr r2, [r0] + ldrb r0, [r2, 0x12] + cmp r0, 0 + beq _0801EC80 + subs r0, 0x1 + b _0801EC88 + .pool +_0801EC80: + ldr r0, =gUnknown_082F2AA4 + ldrb r1, [r2, 0x10] + adds r1, r0 + ldrb r0, [r1] +_0801EC88: + strb r0, [r2, 0x12] +_0801EC8A: + movs r0, 0x1 +_0801EC8C: + pop {r1} + bx r1 + .pool + thumb_func_end sub_801EBE4 + + thumb_func_start sub_801EC94 +sub_801EC94: @ 801EC94 + push {r4-r6,lr} + sub sp, 0x18 + ldr r0, =gUnknown_02022C84 + ldr r5, [r0] + ldrb r0, [r5, 0x10] + cmp r0, 0x3 + beq _0801ECDC + ldr r3, =gUnknown_082F2BA8 + ldrb r1, [r5, 0x12] + lsls r1, 2 + adds r2, r0, 0 + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r1, r0 + adds r1, r3 + ldr r4, [r1] + ldrb r0, [r5, 0x11] + cmp r0, 0 + beq _0801ECCE + adds r1, r0, 0 +_0801ECBE: + ldrb r0, [r4] + cmp r0, 0xF9 + bne _0801ECC6 + adds r4, 0x1 +_0801ECC6: + adds r4, 0x1 + subs r1, 0x1 + cmp r1, 0 + bne _0801ECBE +_0801ECCE: + movs r5, 0x1 + b _0801ED02 + .pool +_0801ECDC: + ldrb r0, [r5, 0x12] + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 2 + adds r1, r0 + adds r1, 0xB9 + adds r1, r5, r1 + mov r0, sp + bl StringCopy + movs r1, 0 + strb r1, [r0] + movs r1, 0xFF + strb r1, [r0, 0x1] + mov r4, sp + mov r0, sp + bl StringLength_Multibyte + adds r5, r0, 0 +_0801ED02: + ldr r6, =gUnknown_02022C84 + ldr r1, [r6] + ldrb r0, [r1, 0x15] + strb r0, [r1, 0x14] + cmp r4, 0 + beq _0801ED5A + bl sub_801EE84 + adds r2, r0, 0 + subs r5, 0x1 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + beq _0801ED56 + ldr r0, [r6] + ldrb r0, [r0, 0x15] + cmp r0, 0xE + bhi _0801ED56 + adds r3, r6, 0 +_0801ED28: + ldrb r0, [r4] + cmp r0, 0xF9 + bne _0801ED34 + strb r0, [r2] + adds r4, 0x1 + adds r2, 0x1 +_0801ED34: + ldrb r0, [r4] + strb r0, [r2] + adds r4, 0x1 + adds r2, 0x1 + ldr r1, [r3] + ldrb r0, [r1, 0x15] + adds r0, 0x1 + strb r0, [r1, 0x15] + subs r5, 0x1 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + beq _0801ED56 + ldr r0, [r3] + ldrb r0, [r0, 0x15] + cmp r0, 0xE + bls _0801ED28 +_0801ED56: + movs r0, 0xFF + strb r0, [r2] +_0801ED5A: + add sp, 0x18 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801EC94 + + thumb_func_start sub_801ED68 +sub_801ED68: @ 801ED68 + push {r4,lr} + ldr r4, =gUnknown_02022C84 + ldr r1, [r4] + ldrb r0, [r1, 0x15] + strb r0, [r1, 0x14] + ldr r0, [r4] + ldrb r0, [r0, 0x15] + cmp r0, 0 + beq _0801ED8A + bl sub_801EEA8 + movs r1, 0xFF + strb r1, [r0] + ldr r1, [r4] + ldrb r0, [r1, 0x15] + subs r0, 0x1 + strb r0, [r1, 0x15] +_0801ED8A: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801ED68 + + thumb_func_start sub_801ED94 +sub_801ED94: @ 801ED94 + push {lr} + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + ldrb r0, [r1, 0x15] + subs r0, 0x1 + strb r0, [r1, 0x14] + bl sub_801EEA8 + adds r2, r0, 0 + ldrb r0, [r2] + cmp r0, 0xF9 + beq _0801EDB8 + ldr r1, =gUnknown_082F2AA8 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0801EDB8 + strb r0, [r2] +_0801EDB8: + pop {r0} + bx r0 + .pool + thumb_func_end sub_801ED94 + + thumb_func_start sub_801EDC4 +sub_801EDC4: @ 801EDC4 + push {lr} + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x15] + cmp r0, 0 + bne _0801EDD8 + movs r0, 0 + b _0801EDDA + .pool +_0801EDD8: + movs r0, 0x1 +_0801EDDA: + pop {r1} + bx r1 + thumb_func_end sub_801EDC4 + + thumb_func_start sub_801EDE0 +sub_801EDE0: @ 801EDE0 + push {r4,lr} + bl sub_801F114 + adds r1, r0, 0 + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + ldrb r3, [r0, 0x12] + lsls r2, r3, 2 + adds r2, r3 + lsls r2, 2 + adds r2, r3 + adds r2, 0xB9 + adds r0, r2 + bl StringCopy + ldr r1, [r4] + movs r0, 0x1 + strb r0, [r1, 0x18] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801EDE0 + + thumb_func_start sub_801EE10 +sub_801EE10: @ 801EE10 + ldr r1, =gUnknown_02022C84 + ldr r2, [r1] + movs r0, 0xFF + strb r0, [r2, 0x1A] + ldr r2, [r1] + movs r3, 0 + movs r0, 0xF + strb r0, [r2, 0x14] + ldr r0, [r1] + strb r3, [r0, 0x15] + bx lr + .pool + thumb_func_end sub_801EE10 + + thumb_func_start sub_801EE2C +sub_801EE2C: @ 801EE2C + push {r4-r7,lr} + mov r7, r8 + push {r7} + ldr r0, =gSaveBlock1Ptr + mov r8, r0 + ldr r7, =gUnknown_02022C84 + movs r6, 0xB9 + ldr r5, =0x00003c88 + movs r4, 0x9 +_0801EE3E: + mov r1, r8 + ldr r0, [r1] + adds r0, r5 + ldr r1, [r7] + adds r1, r6 + bl StringCopy + adds r6, 0x15 + adds r5, 0x15 + subs r4, 0x1 + cmp r4, 0 + bge _0801EE3E + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801EE2C + + thumb_func_start sub_801EE6C +sub_801EE6C: @ 801EE6C + ldr r2, =gUnknown_02022C84 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 2 + adds r1, r0 + adds r1, 0xB9 + ldr r0, [r2] + adds r0, r1 + bx lr + .pool + thumb_func_end sub_801EE6C + + thumb_func_start sub_801EE84 +sub_801EE84: @ 801EE84 + push {lr} + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x1A + ldrb r0, [r0, 0x1A] + cmp r0, 0xFF + beq _0801EE9C +_0801EE94: + adds r1, 0x1 + ldrb r0, [r1] + cmp r0, 0xFF + bne _0801EE94 +_0801EE9C: + adds r0, r1, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_801EE84 + + thumb_func_start sub_801EEA8 +sub_801EEA8: @ 801EEA8 + push {lr} + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + adds r2, r0, 0 + adds r2, 0x1A + adds r1, r2, 0 + ldrb r0, [r0, 0x1A] + cmp r0, 0xFF + beq _0801EECC +_0801EEBA: + adds r2, r1, 0 + ldrb r0, [r2] + cmp r0, 0xF9 + bne _0801EEC4 + adds r1, r2, 0x1 +_0801EEC4: + adds r1, 0x1 + ldrb r0, [r1] + cmp r0, 0xFF + bne _0801EEBA +_0801EECC: + adds r0, r2, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_801EEA8 + + thumb_func_start sub_801EED8 +sub_801EED8: @ 801EED8 + push {r4,lr} + ldr r4, =gUnknown_02022C84 + ldr r0, [r4] + adds r0, 0x1A + bl StringLength_Multibyte + adds r2, r0, 0 + ldr r0, [r4] + adds r1, r0, 0 + adds r1, 0x1A + movs r4, 0 + cmp r2, 0xA + bls _0801EF0C + subs r2, 0xA + movs r3, 0 + cmp r4, r2 + bcs _0801EF0C +_0801EEFA: + ldrb r0, [r1] + cmp r0, 0xF9 + bne _0801EF02 + adds r1, 0x1 +_0801EF02: + adds r1, 0x1 + adds r4, 0x1 + adds r3, 0x1 + cmp r3, r2 + bcc _0801EEFA +_0801EF0C: + lsls r0, r4, 16 + lsrs r0, 16 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801EED8 + + thumb_func_start sub_801EF1C +sub_801EF1C: @ 801EF1C + movs r1, 0 + strb r1, [r0] + bx lr + thumb_func_end sub_801EF1C + + thumb_func_start sub_801EF24 +sub_801EF24: @ 801EF24 + push {r4,lr} + adds r4, r0, 0 + movs r0, 0x2 + strb r0, [r4] + adds r0, r4, 0x1 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + bl StringCopy + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x13] + strb r0, [r4, 0x9] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801EF24 + + thumb_func_start sub_801EF4C +sub_801EF4C: @ 801EF4C + push {r4,lr} + adds r4, r0, 0 + movs r0, 0x1 + strb r0, [r4] + adds r0, r4, 0x1 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + bl StringCopy + adds r4, 0x9 + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + adds r1, 0x1A + adds r0, r4, 0 + bl StringCopy + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801EF4C + + thumb_func_start sub_801EF7C +sub_801EF7C: @ 801EF7C + push {r4,lr} + adds r4, r0, 0 + movs r0, 0x3 + strb r0, [r4] + adds r0, r4, 0x1 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + bl StringCopy + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x13] + strb r0, [r4, 0x9] + bl sub_8011A50 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801EF7C + + thumb_func_start sub_801EFA8 +sub_801EFA8: @ 801EFA8 + push {r4,lr} + adds r4, r0, 0 + movs r0, 0x4 + strb r0, [r4] + adds r0, r4, 0x1 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + bl StringCopy + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x13] + strb r0, [r4, 0x9] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801EFA8 + + thumb_func_start sub_801EFD0 +sub_801EFD0: @ 801EFD0 + push {r4,lr} + adds r4, r0, 0 + movs r0, 0x5 + strb r0, [r4] + adds r0, r4, 0x1 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + bl StringCopy + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x13] + strb r0, [r4, 0x9] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801EFD0 + + thumb_func_start sub_801EFF8 +sub_801EFF8: @ 801EFF8 + push {r4-r6,lr} + adds r6, r0, 0 + adds r5, r1, 0 + ldrb r0, [r5] + adds r1, r0, 0 + adds r4, r5, 0x1 + adds r5, r4, 0 + adds r5, 0x8 + cmp r0, 0x2 + beq _0801F020 + cmp r0, 0x2 + bgt _0801F016 + cmp r0, 0x1 + beq _0801F044 + b _0801F0A8 +_0801F016: + cmp r1, 0x3 + beq _0801F07A + cmp r1, 0x5 + beq _0801F06E + b _0801F0A8 +_0801F020: + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x13] + ldrb r1, [r4, 0x8] + cmp r0, r1 + beq _0801F0A8 + bl sub_81AFBF0 + movs r0, 0 + adds r1, r4, 0 + bl sub_81AFC0C + ldr r1, =gText_F700JoinedChat + b _0801F094 + .pool +_0801F044: + adds r0, r6, 0 + adds r1, r4, 0 + bl StringCopy + movs r1, 0xFC + strb r1, [r0] + adds r0, 0x1 + movs r1, 0x13 + strb r1, [r0] + adds r0, 0x1 + movs r1, 0x2A + strb r1, [r0] + adds r0, 0x1 + movs r1, 0xF0 + strb r1, [r0] + adds r0, 0x1 + adds r1, r5, 0 + bl StringCopy + movs r0, 0x1 + b _0801F0AA +_0801F06E: + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + adds r0, 0x79 + adds r1, r4, 0 + bl StringCopy +_0801F07A: + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x13] + ldrb r5, [r5] + cmp r0, r5 + beq _0801F0A8 + bl sub_81AFBF0 + movs r0, 0 + adds r1, r4, 0 + bl sub_81AFC0C + ldr r1, =gText_F700LeftChat +_0801F094: + adds r0, r6, 0 + bl sub_81AFC28 + movs r0, 0x1 + b _0801F0AA + .pool +_0801F0A8: + movs r0, 0 +_0801F0AA: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801EFF8 + + thumb_func_start sub_801F0B0 +sub_801F0B0: @ 801F0B0 + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x10] + bx lr + .pool + thumb_func_end sub_801F0B0 + + thumb_func_start sub_801F0BC +sub_801F0BC: @ 801F0BC + ldr r2, =gUnknown_02022C84 + ldr r3, [r2] + ldrb r2, [r3, 0x11] + strb r2, [r0] + ldrb r0, [r3, 0x12] + strb r0, [r1] + bx lr + .pool + thumb_func_end sub_801F0BC + + thumb_func_start sub_801F0D0 +sub_801F0D0: @ 801F0D0 + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + adds r0, 0x1A + bx lr + .pool + thumb_func_end sub_801F0D0 + + thumb_func_start sub_801F0DC +sub_801F0DC: @ 801F0DC + push {lr} + bl sub_801F0D0 + bl StringLength_Multibyte + pop {r1} + bx r1 + thumb_func_end sub_801F0DC + + thumb_func_start sub_801F0EC +sub_801F0EC: @ 801F0EC + push {r4,lr} + adds r4, r0, 0 + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r3, [r0, 0x15] + ldrb r2, [r0, 0x14] + subs r0, r3, r2 + cmp r0, 0 + bge _0801F108 + negs r0, r0 + str r3, [r4] + b _0801F10A + .pool +_0801F108: + str r2, [r4] +_0801F10A: + str r0, [r1] + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_801F0EC + + thumb_func_start sub_801F114 +sub_801F114: @ 801F114 + push {lr} + bl sub_801EED8 + lsls r0, 16 + lsrs r2, r0, 16 + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x1A + cmp r2, 0 + beq _0801F13A +_0801F12A: + ldrb r0, [r1] + cmp r0, 0xF9 + bne _0801F132 + adds r1, 0x1 +_0801F132: + adds r1, 0x1 + subs r2, 0x1 + cmp r2, 0 + bne _0801F12A +_0801F13A: + adds r0, r1, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_801F114 + + thumb_func_start sub_801F144 +sub_801F144: @ 801F144 + push {r4,lr} + bl sub_801EED8 + lsls r0, 16 + lsrs r4, r0, 16 + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x1A + movs r2, 0 + movs r3, 0 + cmp r2, r4 + bcs _0801F174 +_0801F15E: + ldrb r0, [r1] + cmp r0, 0xF9 + bne _0801F166 + adds r1, 0x1 +_0801F166: + adds r1, 0x1 + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + adds r3, 0x1 + cmp r3, r4 + bcc _0801F15E +_0801F174: + adds r0, r2, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_801F144 + + thumb_func_start sub_801F180 +sub_801F180: @ 801F180 + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + adds r0, 0x39 + bx lr + .pool + thumb_func_end sub_801F180 + + thumb_func_start sub_801F18C +sub_801F18C: @ 801F18C + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x16] + bx lr + .pool + thumb_func_end sub_801F18C + + thumb_func_start sub_801F198 +sub_801F198: @ 801F198 + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + ldrb r0, [r0, 0x15] + bx lr + .pool + thumb_func_end sub_801F198 + + thumb_func_start sub_801F1A4 +sub_801F1A4: @ 801F1A4 + push {lr} + bl sub_801EEA8 + ldrb r1, [r0] + cmp r1, 0xFF + bhi _0801F1BE + ldr r0, =gUnknown_082F2AA8 + adds r0, r1, r0 + ldrb r0, [r0] + cmp r0, r1 + beq _0801F1BE + cmp r0, 0 + bne _0801F1C8 +_0801F1BE: + movs r0, 0x3 + b _0801F1CA + .pool +_0801F1C8: + movs r0, 0 +_0801F1CA: + pop {r1} + bx r1 + thumb_func_end sub_801F1A4 + + thumb_func_start sub_801F1D0 +sub_801F1D0: @ 801F1D0 + ldr r0, =gUnknown_02022C84 + ldr r0, [r0] + adds r0, 0x79 + bx lr + .pool + thumb_func_end sub_801F1D0 + + thumb_func_start copy_strings_to_sav1 +copy_strings_to_sav1: @ 801F1DC + push {r4,lr} + ldr r4, =gSaveBlock1Ptr + ldr r0, [r4] + ldr r1, =0x00003c88 + adds r0, r1 + ldr r1, =gText_Hello + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003c9d + adds r0, r1 + ldr r1, =gText_Pokemon2 + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003cb2 + adds r0, r1 + ldr r1, =gText_Trade + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003cc7 + adds r0, r1 + ldr r1, =gText_Battle + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003cdc + adds r0, r1 + ldr r1, =gText_Lets + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003cf1 + adds r0, r1 + ldr r1, =gText_Ok + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003d06 + adds r0, r1 + ldr r1, =gText_Sorry + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003d1b + adds r0, r1 + ldr r1, =gText_YayUnkF9F9 + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003d30 + adds r0, r1 + ldr r1, =gText_ThankYou + bl StringCopy + ldr r0, [r4] + ldr r1, =0x00003d45 + adds r0, r1 + ldr r1, =gText_ByeBye + bl StringCopy + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end copy_strings_to_sav1 + + thumb_func_start sub_801F2B4 +sub_801F2B4: @ 801F2B4 + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0x7 + bls _0801F2CE + b _0801F4C4 +_0801F2CE: + lsls r0, 2 + ldr r1, =_0801F2E0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801F2E0: + .4byte _0801F300 + .4byte _0801F30E + .4byte _0801F4A8 + .4byte _0801F35C + .4byte _0801F448 + .4byte _0801F480 + .4byte _0801F494 + .4byte _0801F438 +_0801F300: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0801F30A + b _0801F49C +_0801F30A: + movs r0, 0x1 + strh r0, [r4] +_0801F30E: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + adds r2, r0, 0 + strh r0, [r4, 0x8] + ldr r3, =gUnknown_02022C84 + ldr r0, [r3] + ldrb r1, [r0, 0xD] + movs r5, 0x8 + ldrsh r0, [r4, r5] + cmp r1, r0 + beq _0801F33C + movs r0, 0x2 + strh r0, [r4] + ldr r0, [r3] + strb r2, [r0, 0xD] + b _0801F4C4 + .pool +_0801F33C: + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4, 0x6] + cmp r0, 0 + bne _0801F354 + bl sub_8011A9C + cmp r0, 0 + beq _0801F354 + b _0801F4C4 +_0801F354: + movs r0, 0 + strh r0, [r4, 0x2] + movs r0, 0x3 + strh r0, [r4] +_0801F35C: + movs r1, 0x2 + ldrsh r0, [r4, r1] + cmp r0, 0x4 + bgt _0801F396 + movs r2, 0x6 + ldrsh r0, [r4, r2] + movs r3, 0x2 + ldrsh r1, [r4, r3] + asrs r0, r1 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0801F396 + movs r2, 0x1 +_0801F378: + ldrh r0, [r4, 0x2] + adds r0, 0x1 + strh r0, [r4, 0x2] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x4 + bgt _0801F396 + movs r5, 0x6 + ldrsh r0, [r4, r5] + movs r3, 0x2 + ldrsh r1, [r4, r3] + asrs r0, r1 + ands r0, r2 + cmp r0, 0 + beq _0801F378 +_0801F396: + ldrh r1, [r4, 0x2] + movs r5, 0x2 + ldrsh r0, [r4, r5] + cmp r0, 0x5 + bne _0801F3A2 + b _0801F4C0 +_0801F3A2: + strh r1, [r4, 0x4] + lsls r0, r1, 24 + lsrs r0, 24 + bl ResetBlockReceivedFlag + movs r1, 0x2 + ldrsh r0, [r4, r1] + lsls r0, 8 + ldr r1, =gBlockRecvBuffer + adds r0, r1 + ldrb r0, [r0] + subs r0, 0x1 + cmp r0, 0x4 + bhi _0801F3E4 + lsls r0, 2 + ldr r1, =_0801F3D0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801F3D0: + .4byte _0801F3E4 + .4byte _0801F3E8 + .4byte _0801F3EC + .4byte _0801F3F0 + .4byte _0801F3F4 +_0801F3E4: + movs r0, 0x3 + b _0801F3F6 +_0801F3E8: + movs r0, 0x3 + b _0801F3F6 +_0801F3EC: + movs r0, 0x4 + b _0801F3F6 +_0801F3F0: + movs r0, 0x5 + b _0801F3F6 +_0801F3F4: + movs r0, 0x6 +_0801F3F6: + strh r0, [r4, 0xA] + ldr r5, =gUnknown_02022C84 + ldr r0, [r5] + adds r0, 0x39 + movs r2, 0x2 + ldrsh r1, [r4, r2] + lsls r1, 8 + ldr r2, =gBlockRecvBuffer + adds r1, r2 + bl sub_801EFF8 + cmp r0, 0 + beq _0801F42C + ldr r0, [r5] + ldrh r1, [r4, 0x2] + strb r1, [r0, 0x16] + movs r0, 0xC + movs r1, 0x2 + bl sub_801F5EC + movs r0, 0x7 + b _0801F42E + .pool +_0801F42C: + ldrh r0, [r4, 0xA] +_0801F42E: + strh r0, [r4] + ldrh r0, [r4, 0x2] + adds r0, 0x1 + strh r0, [r4, 0x2] + b _0801F4C4 +_0801F438: + movs r0, 0x2 + bl sub_801F644 + lsls r0, 24 + cmp r0, 0 + bne _0801F4C4 + ldrh r0, [r4, 0xA] + b _0801F4C2 +_0801F448: + ldr r6, =gUnknown_02022C84 + ldr r0, [r6] + ldrb r0, [r0, 0x13] + cmp r0, 0 + bne _0801F47C + movs r3, 0x4 + ldrsh r0, [r4, r3] + cmp r0, 0 + beq _0801F47C + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _0801F474 + bl sub_80104B0 + ldr r1, [r6] + movs r0, 0x1 + b _0801F49A + .pool +_0801F474: + movs r5, 0x4 + ldrsh r0, [r4, r5] + bl sub_8011DE0 +_0801F47C: + movs r0, 0x3 + b _0801F4C2 +_0801F480: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + ldrb r0, [r1, 0x13] + cmp r0, 0 + beq _0801F49C + movs r0, 0x2 + b _0801F49A + .pool +_0801F494: + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + movs r0, 0x3 +_0801F49A: + strb r0, [r1, 0x17] +_0801F49C: + adds r0, r5, 0 + bl DestroyTask + b _0801F4C4 + .pool +_0801F4A8: + bl sub_8011A9C + cmp r0, 0 + bne _0801F4C4 + ldr r0, =gUnknown_02022C84 + ldr r1, [r0] + ldrb r0, [r1, 0x13] + cmp r0, 0 + bne _0801F4C0 + ldrb r0, [r1, 0xD] + bl sub_80110B8 +_0801F4C0: + movs r0, 0x1 +_0801F4C2: + strh r0, [r4] +_0801F4C4: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801F2B4 + + thumb_func_start sub_801F4D0 +sub_801F4D0: @ 801F4D0 + push {r4,lr} + ldr r4, =gUnknown_02022C88 + ldr r0, =0x00002168 + bl Alloc + str r0, [r4] + cmp r0, 0 + beq _0801F52C + bl sub_8020890 + cmp r0, 0 + beq _0801F52C + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_082F2C60 + movs r0, 0 + movs r2, 0x4 + bl InitBgsFromTemplates + ldr r0, =gUnknown_082F2C70 + bl InitWindows + bl reset_temp_tile_data_buffers + bl sub_8020770 + ldr r0, [r4] + bl sub_801F574 + bl sub_801F580 + movs r0, 0 + movs r1, 0 + bl sub_801F5EC + movs r0, 0x1 + b _0801F52E + .pool +_0801F52C: + movs r0, 0 +_0801F52E: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801F4D0 + + thumb_func_start sub_801F534 +sub_801F534: @ 801F534 + push {lr} + movs r0, 0 + bl sub_801F644 + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + thumb_func_end sub_801F534 + + thumb_func_start sub_801F544 +sub_801F544: @ 801F544 + push {r4,lr} + bl sub_80208D0 + ldr r4, =gUnknown_02022C88 + ldr r0, [r4] + cmp r0, 0 + beq _0801F55A + bl Free + movs r0, 0 + str r0, [r4] +_0801F55A: + bl FreeAllWindowBuffers + ldr r1, =gUnknown_02039B28 + movs r0, 0x3 + strb r0, [r1, 0x15] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801F544 + + thumb_func_start sub_801F574 +sub_801F574: @ 801F574 + movs r2, 0 + movs r1, 0xFF + strh r1, [r0, 0x18] + strh r1, [r0, 0x1E] + strh r2, [r0, 0x1A] + bx lr + thumb_func_end sub_801F574 + + thumb_func_start sub_801F580 +sub_801F580: @ 801F580 + push {r4,r5,lr} + ldr r1, =gUnknown_02022C88 + ldr r0, [r1] + cmp r0, 0 + beq _0801F5A8 + movs r2, 0 + adds r4, r1, 0 + ldr r5, =sub_801FDD8 + movs r3, 0 +_0801F592: + ldr r0, [r4] + lsls r1, r2, 3 + adds r0, r1 + str r5, [r0] + strb r3, [r0, 0x4] + ldr r0, [r4] + adds r0, r1 + strb r3, [r0, 0x5] + adds r2, 0x1 + cmp r2, 0x2 + ble _0801F592 +_0801F5A8: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801F580 + + thumb_func_start sub_801F5B8 +sub_801F5B8: @ 801F5B8 + push {r4-r6,lr} + ldr r1, =gUnknown_02022C88 + ldr r0, [r1] + cmp r0, 0 + beq _0801F5E0 + movs r5, 0 + adds r6, r1, 0 +_0801F5C6: + ldr r1, [r6] + lsls r4, r5, 3 + adds r1, r4 + adds r0, r1, 0x5 + ldr r1, [r1] + bl _call_via_r1 + ldr r1, [r6] + adds r1, r4 + strb r0, [r1, 0x4] + adds r5, 0x1 + cmp r5, 0x2 + ble _0801F5C6 +_0801F5E0: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801F5B8 + + thumb_func_start sub_801F5EC +sub_801F5EC: @ 801F5EC + push {r4-r7,lr} + lsls r0, 16 + lsrs r6, r0, 16 + lsls r1, 24 + ldr r3, =gUnknown_02022C88 + ldr r0, [r3] + lsrs r1, 21 + adds r0, r1 + ldr r2, =sub_801FDD8 + str r2, [r0] + movs r4, 0 + adds r5, r3, 0 + adds r3, r1, 0 + mov r12, r4 + ldr r1, =gUnknown_082F2C98 + movs r7, 0x1 + adds r2, r1, 0x4 +_0801F60E: + ldrh r0, [r1] + cmp r0, r6 + bne _0801F634 + ldr r1, [r5] + adds r1, r3 + ldr r0, [r2] + str r0, [r1] + strb r7, [r1, 0x4] + ldr r0, [r5] + adds r0, r3 + mov r1, r12 + strb r1, [r0, 0x5] + b _0801F63E + .pool +_0801F634: + adds r1, 0x8 + adds r2, 0x8 + adds r4, 0x1 + cmp r4, 0x14 + bls _0801F60E +_0801F63E: + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_801F5EC + + thumb_func_start sub_801F644 +sub_801F644: @ 801F644 + lsls r0, 24 + ldr r1, =gUnknown_02022C88 + ldr r1, [r1] + lsrs r0, 21 + adds r1, r0 + ldrb r0, [r1, 0x4] + bx lr + .pool + thumb_func_end sub_801F644 + + thumb_func_start sub_801F658 +sub_801F658: @ 801F658 + push {r4,lr} + adds r4, r0, 0 + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _0801F6EE + ldrb r0, [r4] + cmp r0, 0x6 + bhi _0801F6E4 + lsls r0, 2 + ldr r1, =_0801F67C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801F67C: + .4byte _0801F698 + .4byte _0801F6A2 + .4byte _0801F6A8 + .4byte _0801F6AE + .4byte _0801F6B4 + .4byte _0801F6BA + .4byte _0801F6CC +_0801F698: + bl sub_8020480 + bl sub_8020538 + b _0801F6E8 +_0801F6A2: + bl sub_8020584 + b _0801F6E8 +_0801F6A8: + bl sub_80205B4 + b _0801F6E8 +_0801F6AE: + bl task_tutorial_story_unknown + b _0801F6E8 +_0801F6B4: + bl sub_8020680 + b _0801F6E8 +_0801F6BA: + bl sub_80206A4 + bl sub_80206D0 + bl sub_8020740 + bl sub_80206E8 + b _0801F6E8 +_0801F6CC: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801F6E8 + bl sub_80208E8 + bl sub_8020A68 + bl sub_8020B20 + b _0801F6E8 +_0801F6E4: + movs r0, 0 + b _0801F6F0 +_0801F6E8: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] +_0801F6EE: + movs r0, 0x1 +_0801F6F0: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801F658 + + thumb_func_start sub_801F6F8 +sub_801F6F8: @ 801F6F8 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801F708 + cmp r0, 0x1 + beq _0801F716 + b _0801F720 +_0801F708: + bl sub_80203B0 + movs r0, 0x3 + movs r1, 0x3 + bl CopyWindowToVram + b _0801F720 +_0801F716: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801F728 +_0801F720: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + movs r0, 0x1 +_0801F728: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801F6F8 + + thumb_func_start sub_801F730 +sub_801F730: @ 801F730 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801F740 + cmp r0, 0x1 + beq _0801F74E + b _0801F758 +_0801F740: + bl sub_802040C + movs r0, 0x3 + movs r1, 0x3 + bl CopyWindowToVram + b _0801F758 +_0801F74E: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801F760 +_0801F758: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + movs r0, 0x1 +_0801F760: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801F730 + + thumb_func_start sub_801F768 +sub_801F768: @ 801F768 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0x1 + beq _0801F79E + cmp r0, 0x1 + bgt _0801F77C + cmp r0, 0 + beq _0801F782 + b _0801F7C4 +_0801F77C: + cmp r0, 0x2 + beq _0801F7AA + b _0801F7C4 +_0801F782: + movs r0, 0x1 + bl sub_802091C + bl sub_8020320 + cmp r0, 0 + bne _0801F7CA + bl sub_80201A4 + movs r0, 0x2 + movs r1, 0x2 + bl CopyWindowToVram + b _0801F7C4 +_0801F79E: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + beq _0801F7C4 + b _0801F7CA +_0801F7AA: + bl sub_8020368 + cmp r0, 0 + bne _0801F7CA + bl sub_802093C + movs r0, 0 + bl sub_802091C + bl sub_8020B80 + movs r0, 0 + b _0801F7CC +_0801F7C4: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] +_0801F7CA: + movs r0, 0x1 +_0801F7CC: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801F768 + + thumb_func_start sub_801F7D4 +sub_801F7D4: @ 801F7D4 + push {lr} + bl sub_802093C + movs r0, 0 + pop {r1} + bx r1 + thumb_func_end sub_801F7D4 + + thumb_func_start sub_801F7E0 +sub_801F7E0: @ 801F7E0 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801F7F0 + cmp r0, 0x1 + beq _0801F814 + b _0801F81E +_0801F7F0: + movs r0, 0 + movs r1, 0 + bl sub_801FF18 + movs r0, 0x17 + movs r1, 0xB + movs r2, 0x1 + bl sub_801FDDC + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + b _0801F81E + .pool +_0801F814: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801F826 +_0801F81E: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + movs r0, 0x1 +_0801F826: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801F7E0 + + thumb_func_start sub_801F82C +sub_801F82C: @ 801F82C + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801F83C + cmp r0, 0x1 + beq _0801F84C + b _0801F862 +_0801F83C: + bl sub_8020094 + bl sub_801FEBC + movs r0, 0 + bl CopyBgTilemapBufferToVram + b _0801F862 +_0801F84C: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801F868 + bl sub_80200C8 + bl sub_801FEE4 + movs r0, 0 + b _0801F86A +_0801F862: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] +_0801F868: + movs r0, 0x1 +_0801F86A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801F82C + + thumb_func_start sub_801F870 +sub_801F870: @ 801F870 + push {r4,lr} + sub sp, 0xC + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801F882 + cmp r0, 0x1 + beq _0801F8BA + b _0801F8CC +_0801F882: + add r1, sp, 0x8 + add r0, sp, 0x4 + bl sub_801F0EC + ldr r0, [sp, 0x4] + lsls r0, 16 + lsrs r0, 16 + ldr r1, [sp, 0x8] + lsls r1, 16 + lsrs r1, 16 + movs r2, 0 + bl sub_80200EC + bl sub_801F0D0 + adds r1, r0, 0 + movs r0, 0x2 + str r0, [sp] + movs r0, 0 + movs r2, 0x3 + movs r3, 0x1 + bl sub_8020118 + movs r0, 0x1 + movs r1, 0x2 + bl CopyWindowToVram + b _0801F8CC +_0801F8BA: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801F8D2 + bl sub_8020B80 + movs r0, 0 + b _0801F8D4 +_0801F8CC: + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] +_0801F8D2: + movs r0, 0x1 +_0801F8D4: + add sp, 0xC + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801F870 + + thumb_func_start sub_801F8DC +sub_801F8DC: @ 801F8DC + push {r4-r6,lr} + sub sp, 0x4 + adds r6, r0, 0 + ldrb r0, [r6] + cmp r0, 0x1 + beq _0801F938 + cmp r0, 0x1 + bgt _0801F8F2 + cmp r0, 0 + beq _0801F8FC + b _0801F972 +_0801F8F2: + cmp r0, 0x2 + beq _0801F95C + cmp r0, 0x3 + beq _0801F96E + b _0801F972 +_0801F8FC: + bl sub_801F144 + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + bl sub_801F114 + adds r5, r0, 0 + bl StringLength_Multibyte + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + movs r2, 0x66 + bl sub_80200EC + movs r0, 0x5 + str r0, [sp] + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0 + movs r3, 0x4 + bl sub_8020118 + movs r0, 0x1 + movs r1, 0x2 + bl CopyWindowToVram + b _0801F972 +_0801F938: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801F978 + movs r0, 0x1 + movs r1, 0x10 + bl sub_801FF18 + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + b _0801F972 + .pool +_0801F95C: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801F978 + movs r0, 0x1 + bl sub_80209AC + b _0801F972 +_0801F96E: + movs r0, 0 + b _0801F97A +_0801F972: + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] +_0801F978: + movs r0, 0x1 +_0801F97A: + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801F8DC + + thumb_func_start sub_801F984 +sub_801F984: @ 801F984 + push {r4-r6,lr} + sub sp, 0x4 + adds r6, r0, 0 + ldrb r0, [r6] + cmp r0, 0x1 + beq _0801F9E0 + cmp r0, 0x1 + bgt _0801F99A + cmp r0, 0 + beq _0801F9A4 + b _0801FA1A +_0801F99A: + cmp r0, 0x2 + beq _0801FA00 + cmp r0, 0x3 + beq _0801FA16 + b _0801FA1A +_0801F9A4: + bl sub_801F144 + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + bl sub_801F114 + adds r5, r0, 0 + bl StringLength_Multibyte + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + movs r2, 0 + bl sub_80200EC + movs r0, 0x2 + str r0, [sp] + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0x3 + movs r3, 0x1 + bl sub_8020118 + movs r0, 0x1 + movs r1, 0x2 + bl CopyWindowToVram + b _0801FA1A +_0801F9E0: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801FA20 + bl sub_8020094 + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + b _0801FA1A + .pool +_0801FA00: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801FA20 + movs r0, 0 + bl sub_80209AC + bl sub_80200C8 + b _0801FA1A +_0801FA16: + movs r0, 0 + b _0801FA22 +_0801FA1A: + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] +_0801FA20: + movs r0, 0x1 +_0801FA22: + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801F984 + + thumb_func_start sub_801FA2C +sub_801FA2C: @ 801FA2C + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FA3C + cmp r0, 0x1 + beq _0801FA50 + b _0801FA5E +_0801FA3C: + bl sub_80201A4 + movs r0, 0x2 + movs r1, 0x2 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FA5E +_0801FA50: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801FA5E + movs r0, 0 + b _0801FA60 +_0801FA5E: + movs r0, 0x1 +_0801FA60: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FA2C + + thumb_func_start sub_801FA68 +sub_801FA68: @ 801FA68 + push {r4-r6,lr} + adds r6, r0, 0 + ldrb r0, [r6] + cmp r0, 0x4 + bhi _0801FB3A + lsls r0, 2 + ldr r1, =_0801FA80 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0801FA80: + .4byte _0801FA94 + .4byte _0801FAC0 + .4byte _0801FAF0 + .4byte _0801FB14 + .4byte _0801FADE +_0801FA94: + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrh r5, [r0, 0x1A] + bl sub_801F180 + adds r4, r0, 0 + bl sub_801F18C + adds r2, r0, 0 + lsls r2, 24 + lsrs r2, 24 + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_8020420 + movs r0, 0 + movs r1, 0x2 + bl CopyWindowToVram + b _0801FB34 + .pool +_0801FAC0: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0 + bne _0801FB3A + ldr r0, =gUnknown_02022C88 + ldr r1, [r0] + ldrh r0, [r1, 0x1A] + cmp r0, 0x8 + bhi _0801FAE8 + adds r0, 0x1 + strh r0, [r1, 0x1A] + movs r0, 0x4 + strb r0, [r6] +_0801FADE: + movs r0, 0 + b _0801FB3C + .pool +_0801FAE8: + strh r2, [r1, 0x1C] + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] +_0801FAF0: + movs r0, 0 + movs r1, 0 + movs r2, 0x5 + movs r3, 0x11 + bl ScrollWindow + movs r0, 0 + movs r1, 0x2 + bl CopyWindowToVram + ldr r0, =gUnknown_02022C88 + ldr r1, [r0] + ldrh r0, [r1, 0x1C] + adds r0, 0x1 + strh r0, [r1, 0x1C] + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] +_0801FB14: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0801FB3A + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrh r0, [r0, 0x1C] + cmp r0, 0x2 + bhi _0801FB34 + ldrb r0, [r6] + subs r0, 0x1 + b _0801FB38 + .pool +_0801FB34: + ldrb r0, [r6] + adds r0, 0x1 +_0801FB38: + strb r0, [r6] +_0801FB3A: + movs r0, 0x1 +_0801FB3C: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_801FA68 + + thumb_func_start sub_801FB44 +sub_801FB44: @ 801FB44 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FB54 + cmp r0, 0x1 + beq _0801FB60 + b _0801FB66 +_0801FB54: + bl sub_80209E0 + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FB66 +_0801FB60: + bl sub_8020A1C + b _0801FB68 +_0801FB66: + movs r0, 0x1 +_0801FB68: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FB44 + + thumb_func_start sub_801FB70 +sub_801FB70: @ 801FB70 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FB80 + cmp r0, 0x1 + beq _0801FBA0 + b _0801FBAA +_0801FB80: + movs r0, 0x3 + movs r1, 0x10 + bl sub_801FF18 + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FBAA + .pool +_0801FBA0: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801FBAC +_0801FBAA: + movs r0, 0x1 +_0801FBAC: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FB70 + + thumb_func_start sub_801FBB4 +sub_801FBB4: @ 801FBB4 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FBC4 + cmp r0, 0x1 + beq _0801FBE4 + b _0801FBEE +_0801FBC4: + movs r0, 0x4 + movs r1, 0 + bl sub_801FF18 + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FBEE + .pool +_0801FBE4: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801FBF0 +_0801FBEE: + movs r0, 0x1 +_0801FBF0: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FBB4 + + thumb_func_start sub_801FBF8 +sub_801FBF8: @ 801FBF8 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FC08 + cmp r0, 0x1 + beq _0801FC38 + b _0801FC42 +_0801FC08: + bl sub_81AFBF0 + bl sub_801F1D0 + adds r1, r0, 0 + movs r0, 0 + bl sub_81AFC0C + movs r0, 0x5 + movs r1, 0 + bl sub_801FF18 + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FC42 + .pool +_0801FC38: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801FC44 +_0801FC42: + movs r0, 0x1 +_0801FC44: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FBF8 + + thumb_func_start sub_801FC4C +sub_801FC4C: @ 801FC4C + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FC5C + cmp r0, 0x1 + beq _0801FC88 + b _0801FC92 +_0801FC5C: + movs r0, 0x6 + movs r1, 0 + bl sub_801FF18 + movs r0, 0x17 + movs r1, 0xA + movs r2, 0x1 + bl sub_801FDDC + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FC92 + .pool +_0801FC88: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801FC94 +_0801FC92: + movs r0, 0x1 +_0801FC94: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FC4C + + thumb_func_start sub_801FC9C +sub_801FC9C: @ 801FC9C + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FCAC + cmp r0, 0x1 + beq _0801FCD8 + b _0801FCE2 +_0801FCAC: + movs r0, 0x7 + movs r1, 0 + bl sub_801FF18 + movs r0, 0x17 + movs r1, 0xA + movs r2, 0x1 + bl sub_801FDDC + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FCE2 + .pool +_0801FCD8: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801FCE4 +_0801FCE2: + movs r0, 0x1 +_0801FCE4: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FC9C + + thumb_func_start sub_801FCEC +sub_801FCEC: @ 801FCEC + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FCFC + cmp r0, 0x1 + beq _0801FD1C + b _0801FD26 +_0801FCFC: + movs r0, 0x8 + movs r1, 0 + bl sub_801FF18 + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FD26 + .pool +_0801FD1C: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801FD28 +_0801FD26: + movs r0, 0x1 +_0801FD28: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FCEC + + thumb_func_start sub_801FD30 +sub_801FD30: @ 801FD30 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FD40 + cmp r0, 0x1 + beq _0801FD74 + b _0801FD7E +_0801FD40: + bl sub_81AFBF0 + ldr r0, =gSaveBlock2Ptr + ldr r1, [r0] + movs r0, 0 + bl sub_81AFC0C + movs r0, 0x9 + movs r1, 0 + bl sub_801FF18 + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FD7E + .pool +_0801FD74: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801FD80 +_0801FD7E: + movs r0, 0x1 +_0801FD80: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FD30 + + thumb_func_start sub_801FD88 +sub_801FD88: @ 801FD88 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + cmp r0, 0 + beq _0801FD98 + cmp r0, 0x1 + beq _0801FDC4 + b _0801FDCE +_0801FD98: + movs r0, 0xA + movs r1, 0 + bl sub_801FF18 + movs r0, 0x17 + movs r1, 0xA + movs r2, 0x1 + bl sub_801FDDC + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + ldrb r0, [r0, 0x1E] + movs r1, 0x3 + bl CopyWindowToVram + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + b _0801FDCE + .pool +_0801FDC4: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + lsrs r0, 24 + b _0801FDD0 +_0801FDCE: + movs r0, 0x1 +_0801FDD0: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_801FD88 + + thumb_func_start sub_801FDD8 +sub_801FDD8: @ 801FDD8 + movs r0, 0 + bx lr + thumb_func_end sub_801FDD8 + + thumb_func_start sub_801FDDC +sub_801FDDC: @ 801FDDC + push {r4-r7,lr} + sub sp, 0x14 + lsls r0, 24 + lsls r1, 24 + lsls r2, 24 + lsrs r7, r2, 24 + ldr r4, =0xffffff00 + ldr r2, [sp, 0xC] + ands r2, r4 + lsrs r0, 16 + ldr r3, =0xffff00ff + ands r2, r3 + orrs r2, r0 + lsrs r1, 8 + ldr r0, =0xff00ffff + ands r2, r0 + orrs r2, r1 + ldr r0, =0x00ffffff + ands r2, r0 + movs r0, 0xC0 + lsls r0, 19 + orrs r2, r0 + str r2, [sp, 0xC] + ldr r0, [sp, 0x10] + ands r0, r4 + movs r1, 0x4 + orrs r0, r1 + ands r0, r3 + movs r1, 0xE0 + lsls r1, 4 + orrs r0, r1 + ldr r1, =0x0000ffff + ands r0, r1 + movs r1, 0xA4 + lsls r1, 15 + orrs r0, r1 + str r0, [sp, 0x10] + add r0, sp, 0xC + bl AddWindow + adds r1, r0, 0 + ldr r5, =gUnknown_02022C88 + ldr r0, [r5] + movs r6, 0 + strh r1, [r0, 0x18] + lsls r0, r1, 16 + lsrs r0, 16 + cmp r0, 0xFF + beq _0801FE94 + lsls r0, r1, 24 + lsrs r0, 24 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r5] + ldrb r0, [r0, 0x18] + bl PutWindowTilemap + ldr r0, [r5] + ldrb r0, [r0, 0x18] + ldr r2, =gText_Yes + movs r1, 0x1 + str r1, [sp] + movs r4, 0xFF + str r4, [sp, 0x4] + str r6, [sp, 0x8] + movs r3, 0x8 + bl PrintTextOnWindow + ldr r0, [r5] + ldrb r0, [r0, 0x18] + ldr r2, =gText_No + movs r1, 0x11 + str r1, [sp] + str r4, [sp, 0x4] + str r6, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x8 + bl PrintTextOnWindow + ldr r0, [r5] + ldrb r0, [r0, 0x18] + movs r1, 0x1 + movs r2, 0xD + bl sub_8098858 + ldr r0, [r5] + ldrb r0, [r0, 0x18] + movs r1, 0x2 + adds r2, r7, 0 + bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed +_0801FE94: + add sp, 0x14 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801FDDC + + thumb_func_start sub_801FEBC +sub_801FEBC: @ 801FEBC + push {r4,lr} + ldr r4, =gUnknown_02022C88 + ldr r0, [r4] + ldrh r0, [r0, 0x18] + cmp r0, 0xFF + beq _0801FEDA + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + bl sub_8198070 + ldr r0, [r4] + ldrb r0, [r0, 0x18] + bl ClearWindowTilemap +_0801FEDA: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801FEBC + + thumb_func_start sub_801FEE4 +sub_801FEE4: @ 801FEE4 + push {r4,lr} + ldr r4, =gUnknown_02022C88 + ldr r0, [r4] + ldrh r0, [r0, 0x18] + cmp r0, 0xFF + beq _0801FEFE + lsls r0, 24 + lsrs r0, 24 + bl RemoveWindow + ldr r1, [r4] + movs r0, 0xFF + strh r0, [r1, 0x18] +_0801FEFE: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801FEE4 + + thumb_func_start sub_801FF08 +sub_801FF08: @ 801FF08 + push {lr} + bl ProcessMenuInput + lsls r0, 24 + asrs r0, 24 + pop {r1} + bx r1 + thumb_func_end sub_801FF08 + + thumb_func_start sub_801FF18 +sub_801FF18: @ 801FF18 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x1C + adds r7, r0, 0 + lsls r1, 16 + lsrs r1, 16 + mov r9, r1 + ldr r1, =0xffffff00 + ldr r3, [sp, 0x14] + ands r3, r1 + ldr r2, =0xffff00ff + ands r3, r2 + movs r0, 0x80 + lsls r0, 4 + orrs r3, r0 + ldr r0, =0xff00ffff + ands r3, r0 + movs r0, 0x80 + lsls r0, 13 + orrs r3, r0 + ldr r5, =0x00ffffff + ands r3, r5 + movs r0, 0xA8 + lsls r0, 21 + orrs r3, r0 + str r3, [sp, 0x14] + ldr r0, [sp, 0x18] + ands r0, r1 + movs r1, 0x4 + orrs r0, r1 + ands r0, r2 + movs r1, 0xE0 + lsls r1, 4 + orrs r0, r1 + ldr r1, =0x0000ffff + ands r0, r1 + movs r1, 0xD4 + lsls r1, 15 + orrs r0, r1 + str r0, [sp, 0x18] + ldr r1, =gUnknown_082F2D40 + lsls r0, r7, 1 + adds r0, r7 + lsls r0, 2 + adds r4, r0, r1 + ldrb r0, [r4, 0xA] + cmp r0, 0 + beq _0801FF98 + lsls r0, r3, 16 + movs r1, 0xF9 + lsls r1, 24 + adds r0, r1 + lsrs r0, 16 + ands r2, r3 + orrs r2, r0 + lsrs r1, r2, 24 + adds r1, 0x7 + lsls r1, 24 + adds r0, r5, 0 + ands r0, r2 + orrs r0, r1 + str r0, [sp, 0x14] +_0801FF98: + add r0, sp, 0x14 + bl AddWindow + ldr r5, =gUnknown_02022C88 + ldr r1, [r5] + strh r0, [r1, 0x1E] + ldrh r0, [r1, 0x1E] + mov r8, r0 + cmp r0, 0xFF + beq _08020082 + ldrb r0, [r4, 0x9] + cmp r0, 0 + beq _0801FFE0 + adds r0, r1, 0 + adds r0, 0x22 + ldr r1, [r4] + bl sub_81AFC28 + ldr r0, [r5] + adds r6, r0, 0 + adds r6, 0x22 + b _0801FFE2 + .pool +_0801FFE0: + ldr r6, [r4] +_0801FFE2: + mov r0, r9 + lsls r1, r0, 8 + movs r0, 0 + movs r2, 0 + bl ChangeBgY + mov r1, r8 + lsls r0, r1, 24 + lsrs r5, r0, 24 + adds r0, r5, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + adds r0, r5, 0 + bl PutWindowTilemap + ldr r1, =gUnknown_082F2D40 + lsls r0, r7, 1 + adds r0, r7 + lsls r0, 2 + adds r4, r0, r1 + ldrb r0, [r4, 0x4] + cmp r0, 0x1 + bne _08020050 + adds r0, r5, 0 + movs r1, 0xA + movs r2, 0x2 + bl sub_80989E0 + ldrb r3, [r4, 0x5] + adds r3, 0x8 + lsls r3, 24 + lsrs r3, 24 + ldrb r0, [r4, 0x6] + adds r0, 0x8 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp] + movs r0, 0xFF + str r0, [sp, 0x4] + movs r0, 0 + str r0, [sp, 0x8] + ldrb r0, [r4, 0x7] + str r0, [sp, 0xC] + ldrb r0, [r4, 0x8] + str r0, [sp, 0x10] + adds r0, r5, 0 + movs r1, 0x1 + adds r2, r6, 0 + bl sub_8199F74 + b _0802007A + .pool +_08020050: + adds r0, r5, 0 + movs r1, 0xA + movs r2, 0x2 + bl sub_8098858 + ldrb r3, [r4, 0x5] + ldrb r0, [r4, 0x6] + str r0, [sp] + movs r0, 0xFF + str r0, [sp, 0x4] + movs r0, 0 + str r0, [sp, 0x8] + ldrb r0, [r4, 0x7] + str r0, [sp, 0xC] + ldrb r0, [r4, 0x8] + str r0, [sp, 0x10] + adds r0, r5, 0 + movs r1, 0x1 + adds r2, r6, 0 + bl sub_8199F74 +_0802007A: + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + mov r1, r8 + strh r1, [r0, 0x1E] +_08020082: + add sp, 0x1C + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801FF18 + + thumb_func_start sub_8020094 +sub_8020094: @ 8020094 + push {r4,lr} + ldr r4, =gUnknown_02022C88 + ldr r0, [r4] + ldrh r0, [r0, 0x1E] + cmp r0, 0xFF + beq _080200B2 + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + bl sub_8198070 + ldr r0, [r4] + ldrb r0, [r0, 0x1E] + bl ClearWindowTilemap +_080200B2: + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020094 + + thumb_func_start sub_80200C8 +sub_80200C8: @ 80200C8 + push {r4,lr} + ldr r4, =gUnknown_02022C88 + ldr r0, [r4] + ldrh r0, [r0, 0x1E] + cmp r0, 0xFF + beq _080200E2 + lsls r0, 24 + lsrs r0, 24 + bl RemoveWindow + ldr r1, [r4] + movs r0, 0xFF + strh r0, [r1, 0x1E] +_080200E2: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80200C8 + + thumb_func_start sub_80200EC +sub_80200EC: @ 80200EC + push {lr} + sub sp, 0x8 + adds r3, r0, 0 + lsls r2, 24 + lsrs r2, 24 + lsls r3, 19 + lsrs r3, 16 + lsls r1, 19 + lsrs r1, 16 + str r1, [sp] + movs r0, 0xE + str r0, [sp, 0x4] + movs r0, 0x1 + adds r1, r2, 0 + adds r2, r3, 0 + movs r3, 0x1 + bl FillWindowPixelRect + add sp, 0x8 + pop {r0} + bx r0 + thumb_func_end sub_80200EC + + thumb_func_start sub_8020118 +sub_8020118: @ 8020118 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x34 + mov r10, r1 + ldr r1, [sp, 0x54] + lsls r0, 16 + lsrs r5, r0, 16 + mov r9, r5 + lsls r2, 24 + lsrs r4, r2, 24 + mov r8, r4 + lsls r3, 24 + lsrs r7, r3, 24 + lsls r1, 24 + lsrs r6, r1, 24 + cmp r4, 0 + beq _08020154 + bl sub_801F198 + adds r1, r0, 0 + subs r1, r5 + lsls r1, 16 + lsrs r1, 16 + adds r0, r5, 0 + adds r2, r4, 0 + bl sub_80200EC +_08020154: + add r0, sp, 0xC + mov r1, r8 + strb r1, [r0] + strb r7, [r0, 0x1] + strb r6, [r0, 0x2] + add r4, sp, 0x10 + movs r0, 0xFC + strb r0, [r4] + movs r0, 0x14 + strb r0, [r4, 0x1] + movs r0, 0x8 + strb r0, [r4, 0x2] + mov r0, sp + adds r0, 0x13 + mov r1, r10 + bl StringCopy + mov r0, r9 + lsls r2, r0, 27 + lsrs r2, 24 + add r1, sp, 0xC + str r1, [sp] + movs r0, 0x1 + negs r0, r0 + str r0, [sp, 0x4] + str r4, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x2 + movs r3, 0x1 + bl box_print + add sp, 0x34 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8020118 + + thumb_func_start sub_80201A4 +sub_80201A4: @ 80201A4 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4C + movs r0, 0x2 + movs r1, 0xFF + bl FillWindowPixelBuffer + bl sub_801F0B0 + lsls r0, 24 + lsrs r2, r0, 24 + add r1, sp, 0xC + movs r0, 0 + strb r0, [r1] + movs r0, 0xE + strb r0, [r1, 0x1] + movs r0, 0xD + strb r0, [r1, 0x2] + cmp r2, 0x3 + beq _08020240 + add r1, sp, 0x10 + movs r0, 0xFC + strb r0, [r1] + movs r0, 0x14 + strb r0, [r1, 0x1] + movs r0, 0x8 + strb r0, [r1, 0x2] + str r0, [sp, 0x40] + str r1, [sp, 0x44] + cmp r2, 0x2 + bne _080201EC + movs r1, 0x6 + str r1, [sp, 0x40] +_080201EC: + movs r7, 0 + movs r6, 0 + lsls r0, r2, 2 + ldr r1, =gUnknown_082F2BA8 + adds r0, r2 + lsls r0, 3 + adds r4, r0, r1 + ldr r0, [sp, 0x40] + lsls r5, r0, 24 +_080201FE: + ldr r1, [r4] + cmp r1, 0 + bne _08020206 + b _0802030C +_08020206: + mov r0, sp + adds r0, 0x13 + bl StringCopy + lsls r3, r6, 24 + lsrs r3, 24 + add r1, sp, 0xC + str r1, [sp] + movs r0, 0x1 + negs r0, r0 + str r0, [sp, 0x4] + ldr r0, [sp, 0x44] + str r0, [sp, 0x8] + movs r0, 0x2 + movs r1, 0 + lsrs r2, r5, 24 + bl box_print + adds r4, 0x4 + adds r7, 0x1 + adds r0, r6, 0 + adds r0, 0xC + lsls r0, 16 + lsrs r6, r0, 16 + cmp r7, 0x9 + ble _080201FE + b _0802030C + .pool +_08020240: + movs r1, 0x4 + str r1, [sp, 0x40] + movs r7, 0 + movs r6, 0 +_08020248: + adds r0, r7, 0 + bl sub_801EE6C + adds r5, r0, 0 + movs r0, 0 + adds r1, r5, 0 + movs r2, 0 + bl GetStringWidth + cmp r0, 0x28 + bgt _08020286 + lsls r3, r6, 24 + lsrs r3, 24 + add r4, sp, 0xC + str r4, [sp] + movs r0, 0x1 + negs r0, r0 + str r0, [sp, 0x4] + str r5, [sp, 0x8] + movs r0, 0x2 + movs r1, 0 + movs r4, 0x80 + lsls r4, 19 + lsrs r2, r4, 24 + bl box_print + adds r0, r7, 0x1 + str r0, [sp, 0x48] + adds r6, 0xC + mov r10, r6 + b _08020300 +_08020286: + adds r0, r5, 0 + bl StringLength_Multibyte + adds r4, r0, 0 + mov r1, sp + adds r1, 0x10 + str r1, [sp, 0x44] + ldr r0, [sp, 0x40] + lsls r0, 24 + mov r8, r0 + lsls r1, r6, 24 + mov r9, r1 + adds r0, r7, 0x1 + str r0, [sp, 0x48] + adds r6, 0xC + mov r10, r6 + ldr r7, [sp, 0x40] + adds r7, 0x23 + ldr r6, [sp, 0x44] +_080202AC: + subs r4, 0x1 + adds r0, r6, 0 + adds r1, r5, 0 + adds r2, r4, 0 + bl StringCopyN_Multibyte + movs r0, 0 + adds r1, r6, 0 + movs r2, 0 + bl GetStringWidth + cmp r0, 0x23 + bgt _080202AC + mov r1, r8 + lsrs r2, r1, 24 + mov r0, r9 + lsrs r4, r0, 24 + add r1, sp, 0xC + str r1, [sp] + movs r0, 0x1 + negs r0, r0 + str r0, [sp, 0x4] + ldr r1, [sp, 0x44] + str r1, [sp, 0x8] + movs r0, 0x2 + movs r1, 0 + adds r3, r4, 0 + bl box_print + adds r2, r7, 0 + add r0, sp, 0xC + str r0, [sp] + movs r1, 0x1 + negs r1, r1 + str r1, [sp, 0x4] + ldr r0, =gText_Ellipsis + str r0, [sp, 0x8] + movs r0, 0x2 + movs r1, 0 + adds r3, r4, 0 + bl box_print +_08020300: + ldr r7, [sp, 0x48] + mov r4, r10 + lsls r0, r4, 16 + lsrs r6, r0, 16 + cmp r7, 0x9 + ble _08020248 +_0802030C: + add sp, 0x4C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80201A4 + + thumb_func_start sub_8020320 +sub_8020320: @ 8020320 + push {r4,lr} + ldr r1, =gUnknown_02022C88 + ldr r2, [r1] + ldrh r3, [r2, 0x20] + movs r4, 0x20 + ldrsh r0, [r2, r4] + cmp r0, 0x37 + bgt _08020354 + adds r0, r3, 0 + adds r0, 0xC + strh r0, [r2, 0x20] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x37 + ble _08020348 + movs r0, 0x38 + strh r0, [r2, 0x20] + b _08020354 + .pool +_08020348: + movs r1, 0x20 + ldrsh r0, [r2, r1] + bl sub_80207C0 + movs r0, 0x1 + b _08020360 +_08020354: + ldr r0, [r1] + movs r4, 0x20 + ldrsh r0, [r0, r4] + bl sub_8020818 + movs r0, 0 +_08020360: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8020320 + + thumb_func_start sub_8020368 +sub_8020368: @ 8020368 + push {r4,lr} + ldr r1, =gUnknown_02022C88 + ldr r2, [r1] + ldrh r3, [r2, 0x20] + movs r4, 0x20 + ldrsh r0, [r2, r4] + cmp r0, 0 + ble _0802039C + adds r0, r3, 0 + subs r0, 0xC + strh r0, [r2, 0x20] + lsls r0, 16 + cmp r0, 0 + bgt _08020390 + movs r0, 0 + strh r0, [r2, 0x20] + b _0802039C + .pool +_08020390: + movs r1, 0x20 + ldrsh r0, [r2, r1] + bl sub_80207C0 + movs r0, 0x1 + b _080203A8 +_0802039C: + ldr r0, [r1] + movs r4, 0x20 + ldrsh r0, [r0, r4] + bl sub_8020818 + movs r0, 0 +_080203A8: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8020368 + + thumb_func_start sub_80203B0 +sub_80203B0: @ 80203B0 + push {r4,r5,lr} + sub sp, 0xC + movs r0, 0x3 + movs r1, 0x11 + bl FillWindowPixelBuffer + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0xD + bl sub_8098858 + movs r5, 0xE + str r5, [sp] + movs r4, 0x5 + str r4, [sp, 0x4] + ldr r0, =gUnknown_082F2DC8 + str r0, [sp, 0x8] + movs r0, 0x3 + movs r1, 0x2 + movs r2, 0x8 + movs r3, 0x1 + bl PrintTextArray + bl sub_801F0B0 + lsls r0, 24 + lsrs r0, 24 + str r5, [sp] + str r4, [sp, 0x4] + str r0, [sp, 0x8] + movs r0, 0x3 + movs r1, 0x2 + movs r2, 0 + movs r3, 0x1 + bl sub_81983AC + movs r0, 0x3 + bl PutWindowTilemap + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80203B0 + + thumb_func_start sub_802040C +sub_802040C: @ 802040C + push {lr} + movs r0, 0x3 + movs r1, 0 + bl sub_8198070 + movs r0, 0x3 + bl ClearWindowTilemap + pop {r0} + bx r0 + thumb_func_end sub_802040C + + thumb_func_start sub_8020420 +sub_8020420: @ 8020420 + push {r4,r5,lr} + sub sp, 0x10 + adds r5, r1, 0 + lsls r0, 16 + lsrs r0, 16 + lsls r2, 24 + add r3, sp, 0xC + movs r1, 0x1 + strb r1, [r3] + lsrs r2, 23 + adds r1, r2, 0x2 + strb r1, [r3, 0x1] + adds r1, r3, 0 + adds r2, 0x3 + strb r2, [r1, 0x2] + lsls r4, r0, 4 + subs r4, r0 + lsls r3, r4, 16 + lsrs r3, 16 + movs r0, 0xA8 + str r0, [sp] + movs r0, 0xF + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0x11 + movs r2, 0 + bl FillWindowPixelRect + adds r4, 0x1 + lsls r4, 24 + lsrs r4, 24 + add r0, sp, 0xC + str r0, [sp] + movs r0, 0x1 + negs r0, r0 + str r0, [sp, 0x4] + str r5, [sp, 0x8] + movs r0, 0 + movs r1, 0x2 + movs r2, 0 + adds r3, r4, 0 + bl box_print + add sp, 0x10 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8020420 + + thumb_func_start sub_8020480 +sub_8020480: @ 8020480 + push {lr} + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0 + bl ShowBg + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + movs r0, 0x3 + bl ShowBg + movs r1, 0x82 + lsls r1, 5 + movs r0, 0 + bl SetGpuRegBits + movs r0, 0x50 + movs r1, 0 + bl SetGpuReg + movs r1, 0xE0 + lsls r1, 8 + movs r0, 0 + bl ClearGpuRegBits + movs r1, 0x80 + lsls r1, 6 + movs r0, 0 + bl SetGpuRegBits + ldr r1, =0x000040f0 + movs r0, 0x40 + bl SetGpuReg + movs r0, 0x44 + movs r1, 0x90 + bl SetGpuReg + movs r0, 0x48 + movs r1, 0x3D + bl SetGpuReg + movs r0, 0x4A + movs r1, 0x3F + bl SetGpuReg + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020480 + + thumb_func_start sub_8020538 +sub_8020538: @ 8020538 + push {r4,lr} + ldr r4, =gUnknown_02022C88 + ldr r1, [r4] + movs r0, 0x94 + lsls r0, 1 + adds r1, r0 + movs r0, 0 + bl SetBgTilemapBuffer + ldr r1, [r4] + ldr r0, =0x00000928 + adds r1, r0 + movs r0, 0x1 + bl SetBgTilemapBuffer + ldr r1, [r4] + ldr r0, =0x00001128 + adds r1, r0 + movs r0, 0x3 + bl SetBgTilemapBuffer + ldr r1, [r4] + ldr r0, =0x00001928 + adds r1, r0 + movs r0, 0x2 + bl SetBgTilemapBuffer + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020538 + + thumb_func_start sub_8020584 +sub_8020584: @ 8020584 + push {lr} + sub sp, 0x8 + movs r1, 0xC0 + lsls r1, 19 + movs r0, 0 + movs r2, 0x20 + movs r3, 0x1 + bl RequestDma3Fill + movs r0, 0x20 + str r0, [sp] + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + add sp, 0x8 + pop {r0} + bx r0 + thumb_func_end sub_8020584 + + thumb_func_start sub_80205B4 +sub_80205B4: @ 80205B4 + push {lr} + sub sp, 0x4 + ldr r0, =gUnknown_08DD4BD0 + movs r1, 0x70 + movs r2, 0x20 + bl LoadPalette + ldr r0, =gUnknown_08DD4BB0 + movs r1, 0xC0 + movs r2, 0x20 + bl LoadPalette + ldr r1, =gUnknown_08DD4BF0 + movs r0, 0 + str r0, [sp] + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + ldr r1, =gUnknown_08DD4C4C + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_80205B4 + + thumb_func_start task_tutorial_story_unknown +task_tutorial_story_unknown: @ 8020604 + push {r4,r5,lr} + sub sp, 0x4 + ldr r0, =gUnknown_08DD4860 + movs r1, 0 + movs r2, 0x20 + bl LoadPalette + ldr r1, =gUnknown_08DD4880 + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + adds r5, r0, 0 + cmp r5, 0 + beq _0802064E + movs r1, 0x88 + lsls r1, 2 + adds r0, r5, r1 + ldr r4, =gUnknown_02022C88 + ldr r1, [r4] + ldr r2, =0x00002128 + adds r1, r2 + movs r2, 0x8 + bl CpuFastSet + movs r1, 0x84 + lsls r1, 3 + adds r0, r5, r1 + ldr r1, [r4] + ldr r2, =0x00002148 + adds r1, r2 + movs r2, 0x8 + bl CpuFastSet +_0802064E: + ldr r1, =gUnknown_08DD4AB8 + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end task_tutorial_story_unknown + + thumb_func_start sub_8020680 +sub_8020680: @ 8020680 + push {lr} + ldr r0, =gUnknown_082F2C20 + movs r1, 0x80 + movs r2, 0x20 + bl LoadPalette + ldr r1, =0x06004020 + movs r0, 0 + movs r2, 0x20 + movs r3, 0x1 + bl RequestDma3Fill + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020680 + + thumb_func_start sub_80206A4 +sub_80206A4: @ 80206A4 + push {lr} + ldr r0, =gUnknown_082F2C40 + movs r1, 0xF0 + movs r2, 0x20 + bl LoadPalette + movs r0, 0 + bl PutWindowTilemap + movs r0, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + movs r0, 0 + movs r1, 0x3 + bl CopyWindowToVram + pop {r0} + bx r0 + .pool + thumb_func_end sub_80206A4 + + thumb_func_start sub_80206D0 +sub_80206D0: @ 80206D0 + push {lr} + movs r0, 0x2 + bl PutWindowTilemap + bl sub_80201A4 + movs r0, 0x2 + movs r1, 0x3 + bl CopyWindowToVram + pop {r0} + bx r0 + thumb_func_end sub_80206D0 + + thumb_func_start sub_80206E8 +sub_80206E8: @ 80206E8 + push {r4,lr} + sub sp, 0xC + add r1, sp, 0x8 + movs r0, 0 + strb r0, [r1] + movs r0, 0xFF + strb r0, [r1, 0x1] + movs r4, 0 +_080206F8: + ldr r0, =gUnknown_02022C88 + ldr r1, [r0] + ldr r0, =0x00002128 + adds r1, r0 + lsls r2, r4, 19 + lsrs r2, 16 + movs r0, 0x8 + str r0, [sp] + movs r0, 0x10 + str r0, [sp, 0x4] + movs r0, 0x1 + movs r3, 0 + bl BlitBitmapToWindow + adds r4, 0x1 + cmp r4, 0xE + ble _080206F8 + movs r0, 0x1 + movs r1, 0 + bl FillWindowPixelBuffer + movs r0, 0x1 + bl PutWindowTilemap + movs r0, 0x1 + movs r1, 0x3 + bl CopyWindowToVram + add sp, 0xC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80206E8 + + thumb_func_start sub_8020740 +sub_8020740: @ 8020740 + push {lr} + movs r0, 0x3 + movs r1, 0x11 + bl FillWindowPixelBuffer + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0xD0 + bl sub_809882C + movs r0, 0x3 + movs r1, 0xA + movs r2, 0x20 + bl box_border_load_tiles_and_pal + ldr r0, =gUnknown_0860F074 + movs r1, 0xE0 + movs r2, 0x20 + bl LoadPalette + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020740 + + thumb_func_start sub_8020770 +sub_8020770: @ 8020770 + push {lr} + sub sp, 0x10 + ldr r0, =0xa2600001 + str r0, [sp, 0x4] + ldr r0, =0x04000014 + str r0, [sp] + mov r2, sp + movs r1, 0 + movs r0, 0x1 + strb r0, [r2, 0x8] + mov r0, sp + strb r1, [r0, 0x9] + ldr r0, =gUnknown_02022C88 + ldr r0, [r0] + strh r1, [r0, 0x20] + str r1, [sp, 0xC] + add r0, sp, 0xC + ldr r1, =gUnknown_02038C28 + ldr r2, =0x010003c0 + bl CpuFastSet + ldr r0, [sp] + ldr r1, [sp, 0x4] + ldr r2, [sp, 0x8] + bl sub_80BA038 + add sp, 0x10 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020770 + + thumb_func_start sub_80207C0 +sub_80207C0: @ 80207C0 + push {r4,r5,lr} + sub sp, 0x4 + lsls r0, 16 + lsrs r0, 16 + mov r1, sp + strh r0, [r1] + ldr r5, =gUnknown_02039B28 + ldrb r0, [r5, 0x14] + lsls r1, r0, 4 + subs r1, r0 + lsls r1, 7 + ldr r4, =gUnknown_02038C28 + adds r1, r4 + ldr r2, =0x01000090 + mov r0, sp + bl CpuSet + mov r0, sp + adds r0, 0x2 + movs r1, 0 + strh r1, [r0] + ldrb r2, [r5, 0x14] + lsls r1, r2, 4 + subs r1, r2 + lsls r1, 7 + movs r2, 0x90 + lsls r2, 1 + adds r4, r2 + adds r1, r4 + ldr r2, =0x01000010 + bl CpuSet + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80207C0 + + thumb_func_start sub_8020818 +sub_8020818: @ 8020818 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0x8 + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, sp + strh r4, [r0] + ldr r5, =gUnknown_02038C28 + ldr r0, =0x01000090 + mov r9, r0 + mov r0, sp + adds r1, r5, 0 + mov r2, r9 + bl CpuSet + mov r0, sp + adds r0, 0x2 + movs r6, 0 + strh r6, [r0] + movs r2, 0x90 + lsls r2, 1 + adds r1, r5, r2 + ldr r2, =0x01000010 + mov r8, r2 + bl CpuSet + add r0, sp, 0x4 + strh r4, [r0] + movs r2, 0xF0 + lsls r2, 3 + adds r1, r5, r2 + mov r2, r9 + bl CpuSet + mov r0, sp + adds r0, 0x6 + strh r6, [r0] + movs r1, 0x8A + lsls r1, 4 + adds r5, r1 + adds r1, r5, 0 + mov r2, r8 + bl CpuSet + add sp, 0x8 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020818 + + thumb_func_start sub_8020890 +sub_8020890: @ 8020890 + push {r4,r5,lr} + movs r5, 0 + ldr r4, =gUnknown_082F3134 +_08020896: + adds r0, r4, 0 + bl LoadCompressedObjectPic + adds r4, 0x8 + adds r5, 0x1 + cmp r5, 0x4 + bls _08020896 + ldr r0, =gUnknown_082F315C + bl LoadSpritePalette + ldr r4, =gUnknown_02022C8C + movs r0, 0x18 + bl Alloc + str r0, [r4] + cmp r0, 0 + beq _080208C8 + movs r0, 0x1 + b _080208CA + .pool +_080208C8: + movs r0, 0 +_080208CA: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8020890 + + thumb_func_start sub_80208D0 +sub_80208D0: @ 80208D0 + push {lr} + ldr r0, =gUnknown_02022C8C + ldr r0, [r0] + cmp r0, 0 + beq _080208DE + bl Free +_080208DE: + pop {r0} + bx r0 + .pool + thumb_func_end sub_80208D0 + + thumb_func_start sub_80208E8 +sub_80208E8: @ 80208E8 + push {lr} + ldr r0, =gUnknown_082F319C + movs r1, 0xA + movs r2, 0x18 + movs r3, 0 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnknown_02022C8C + ldr r2, [r1] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r0, =gSprites + adds r1, r0 + str r1, [r2] + pop {r0} + bx r0 + .pool + thumb_func_end sub_80208E8 + + thumb_func_start sub_802091C +sub_802091C: @ 802091C + ldr r1, =gUnknown_02022C8C + ldr r1, [r1] + ldr r2, [r1] + adds r2, 0x3E + movs r1, 0x1 + ands r0, r1 + lsls r0, 2 + ldrb r3, [r2] + movs r1, 0x5 + negs r1, r1 + ands r1, r3 + orrs r1, r0 + strb r1, [r2] + bx lr + .pool + thumb_func_end sub_802091C + + thumb_func_start sub_802093C +sub_802093C: @ 802093C + push {r4,r5,lr} + sub sp, 0x4 + bl sub_801F0B0 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + mov r5, sp + adds r5, 0x1 + mov r0, sp + adds r1, r5, 0 + bl sub_801F0BC + cmp r4, 0x3 + beq _0802097C + ldr r4, =gUnknown_02022C8C + ldr r0, [r4] + ldr r0, [r0] + movs r1, 0 + bl StartSpriteAnim + ldr r1, [r4] + ldr r2, [r1] + mov r0, sp + ldrb r0, [r0] + lsls r0, 3 + adds r0, 0xA + strh r0, [r2, 0x20] + ldr r2, [r1] + b _08020992 + .pool +_0802097C: + ldr r4, =gUnknown_02022C8C + ldr r0, [r4] + ldr r0, [r0] + movs r1, 0x2 + bl StartSpriteAnim + ldr r2, [r4] + ldr r1, [r2] + movs r0, 0x18 + strh r0, [r1, 0x20] + ldr r2, [r2] +_08020992: + ldrb r1, [r5] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, 0x18 + strh r0, [r2, 0x22] + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802093C + + thumb_func_start sub_80209AC +sub_80209AC: @ 80209AC + push {r4,lr} + adds r4, r0, 0 + lsls r4, 2 + ldr r0, =gUnknown_082F2DF0+2 + adds r4, r0 + movs r0, 0 + bl IndexOfSpritePaletteTag + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 4 + ldr r0, =0x01010000 + adds r1, r0 + lsrs r1, 16 + adds r0, r4, 0 + movs r2, 0x4 + bl LoadPalette + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80209AC + + thumb_func_start sub_80209E0 +sub_80209E0: @ 80209E0 + push {lr} + bl sub_801F0B0 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + beq _08020A00 + ldr r0, =gUnknown_02022C8C + ldr r0, [r0] + ldr r0, [r0] + movs r1, 0x1 + bl StartSpriteAnim + b _08020A0C + .pool +_08020A00: + ldr r0, =gUnknown_02022C8C + ldr r0, [r0] + ldr r0, [r0] + movs r1, 0x3 + bl StartSpriteAnim +_08020A0C: + ldr r0, =gUnknown_02022C8C + ldr r1, [r0] + movs r0, 0 + strh r0, [r1, 0x14] + pop {r0} + bx r0 + .pool + thumb_func_end sub_80209E0 + + thumb_func_start sub_8020A1C +sub_8020A1C: @ 8020A1C + push {r4,lr} + ldr r4, =gUnknown_02022C8C + ldr r1, [r4] + ldrh r0, [r1, 0x14] + cmp r0, 0x3 + bls _08020A30 +_08020A28: + movs r0, 0 + b _08020A62 + .pool +_08020A30: + adds r0, 0x1 + strh r0, [r1, 0x14] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x3 + bls _08020A60 + bl sub_801F0B0 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + beq _08020A54 + ldr r0, [r4] + ldr r0, [r0] + movs r1, 0 + bl StartSpriteAnim + b _08020A28 +_08020A54: + ldr r0, [r4] + ldr r0, [r0] + movs r1, 0x2 + bl StartSpriteAnim + b _08020A28 +_08020A60: + movs r0, 0x1 +_08020A62: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8020A1C + + thumb_func_start sub_8020A68 +sub_8020A68: @ 8020A68 + push {r4,r5,lr} + ldr r0, =gUnknown_082F31BC + movs r1, 0x4C + movs r2, 0x98 + movs r3, 0x2 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + ldr r5, =gUnknown_02022C8C + ldr r2, [r5] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r4, =gSprites + adds r1, r4 + str r1, [r2, 0x8] + ldr r0, =gUnknown_082F31D4 + movs r1, 0x40 + movs r2, 0x98 + movs r3, 0x1 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + ldr r2, [r5] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r4 + str r1, [r2, 0x4] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020A68 + + thumb_func_start sub_8020ABC +sub_8020ABC: @ 8020ABC + push {r4,lr} + adds r4, r0, 0 + bl sub_801F198 + adds r3, r0, 0 + cmp r3, 0xF + bne _08020AD8 + adds r0, r4, 0 + adds r0, 0x3E + ldrb r1, [r0] + movs r2, 0x4 + orrs r1, r2 + strb r1, [r0] + b _08020AEC +_08020AD8: + adds r2, r4, 0 + adds r2, 0x3E + ldrb r0, [r2] + movs r1, 0x5 + negs r1, r1 + ands r1, r0 + strb r1, [r2] + lsls r0, r3, 3 + adds r0, 0x4C + strh r0, [r4, 0x20] +_08020AEC: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8020ABC + + thumb_func_start sub_8020AF4 +sub_8020AF4: @ 8020AF4 + push {lr} + adds r1, r0, 0 + ldrh r0, [r1, 0x2E] + adds r0, 0x1 + movs r2, 0 + strh r0, [r1, 0x2E] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x4 + ble _08020B1A + strh r2, [r1, 0x2E] + ldrh r0, [r1, 0x24] + adds r0, 0x1 + strh r0, [r1, 0x24] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x4 + ble _08020B1A + strh r2, [r1, 0x24] +_08020B1A: + pop {r0} + bx r0 + thumb_func_end sub_8020AF4 + + thumb_func_start sub_8020B20 +sub_8020B20: @ 8020B20 + push {r4,r5,lr} + ldr r0, =gUnknown_082F322C + movs r1, 0x8 + movs r2, 0x98 + movs r3, 0x3 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + ldr r5, =gUnknown_02022C8C + ldr r2, [r5] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r4, =gSprites + adds r1, r4 + str r1, [r2, 0xC] + ldr r0, =gUnknown_082F3244 + movs r1, 0x20 + movs r2, 0x98 + movs r3, 0x4 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + ldr r2, [r5] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r4 + str r1, [r2, 0x10] + adds r1, 0x3E + ldrb r0, [r1] + movs r2, 0x4 + orrs r0, r2 + strb r0, [r1] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020B20 + + thumb_func_start sub_8020B80 +sub_8020B80: @ 8020B80 + push {r4,lr} + bl sub_801F0B0 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bne _08020BB8 + bl sub_801F0DC + cmp r0, 0 + beq _08020BC2 + ldr r3, =gUnknown_02022C8C + ldr r0, [r3] + ldr r1, [r0, 0x10] + adds r1, 0x3E + ldrb r2, [r1] + movs r0, 0x5 + negs r0, r0 + ands r0, r2 + strb r0, [r1] + ldr r0, [r3] + ldr r0, [r0, 0x10] + movs r1, 0x3 + bl StartSpriteAnim + b _08020BF6 + .pool +_08020BB8: + bl sub_801F1A4 + adds r4, r0, 0 + cmp r4, 0x3 + bne _08020BD8 +_08020BC2: + ldr r0, =gUnknown_02022C8C + ldr r0, [r0] + ldr r1, [r0, 0x10] + adds r1, 0x3E + ldrb r0, [r1] + movs r2, 0x4 + orrs r0, r2 + strb r0, [r1] + b _08020BF6 + .pool +_08020BD8: + ldr r3, =gUnknown_02022C8C + ldr r0, [r3] + ldr r1, [r0, 0x10] + adds r1, 0x3E + ldrb r2, [r1] + movs r0, 0x5 + negs r0, r0 + ands r0, r2 + strb r0, [r1] + ldr r0, [r3] + ldr r0, [r0, 0x10] + lsls r1, r4, 24 + lsrs r1, 24 + bl StartSpriteAnim +_08020BF6: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020B80 + + thumb_func_start sub_8020C00 +sub_8020C00: @ 8020C00 + ldr r0, =gUnknown_02022C90 + ldr r0, [r0] + bx lr + .pool + thumb_func_end sub_8020C00 + + thumb_func_start sub_8020C0C +sub_8020C0C: @ 8020C0C + push {r4,r5,lr} + adds r4, r0, 0 + ldr r5, =gUnknown_02022C90 + ldr r0, [r5] + cmp r0, 0 + bne _08020C20 + movs r0, 0x2 + b _08020C5C + .pool +_08020C20: + cmp r4, 0 + bne _08020C26 + ldr r4, [r0] +_08020C26: + ldrb r0, [r0, 0xA] + bl DestroyTask + ldr r0, [r5] + bl Free + movs r0, 0 + str r0, [r5] + adds r0, r4, 0 + bl SetMainCallback2 + ldr r0, =c2_exit_to_overworld_2_switch + cmp r4, r0 + bne _08020C5A + ldr r2, =gTextFlags + ldrb r0, [r2] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r2] + movs r0, 0xC8 + lsls r0, 1 + bl PlayNewMapMusic + ldr r0, =c1_overworld + bl set_callback1 +_08020C5A: + movs r0, 0 +_08020C5C: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8020C0C + + thumb_func_start sub_8020C70 +sub_8020C70: @ 8020C70 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0xC + adds r4, r0, 0 + movs r0, 0 + mov r8, r0 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _08020C8E + ldr r0, =gLinkVSyncDisabled + ldrb r0, [r0] + cmp r0, 0 + bne _08020CAC +_08020C8E: + adds r0, r4, 0 + bl SetMainCallback2 + ldr r0, =gUnknown_03005000 + mov r1, r8 + strh r1, [r0, 0x10] + strh r1, [r0, 0x12] + b _08020CF8 + .pool +_08020CAC: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + bl GetMultiplayerId + lsls r0, 24 + lsrs r7, r0, 24 + mov r0, r8 + cmp r0, 0x1 + bls _08020CC8 + cmp r7, r8 + bcc _08020CDC +_08020CC8: + adds r0, r4, 0 + bl SetMainCallback2 + ldr r0, =gUnknown_03005000 + movs r1, 0 + strh r1, [r0, 0x10] + strh r1, [r0, 0x12] + b _08020CF8 + .pool +_08020CDC: + ldr r6, =gUnknown_02022C90 + ldr r0, =0x000041c0 + bl AllocZeroed + adds r5, r0, 0 + str r5, [r6] + cmp r5, 0 + bne _08020D10 + adds r0, r4, 0 + bl SetMainCallback2 + ldr r0, =gUnknown_03005000 + strh r5, [r0, 0x10] + strh r5, [r0, 0x12] +_08020CF8: + adds r0, 0xEE + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] + b _08020D74 + .pool +_08020D10: + str r4, [r5] + movs r4, 0 + strb r7, [r5, 0x8] + ldr r0, [r6] + mov r1, r8 + strb r1, [r0, 0x9] + ldr r0, [r6] + bl sub_8020FC4 + ldr r1, [r6] + movs r2, 0x1 + movs r0, 0x1 + strh r0, [r1, 0x12] + strb r2, [r1, 0xE] + ldr r1, [r6] + movs r0, 0x6 + strb r0, [r1, 0xF] + ldr r0, [r6] + adds r0, 0x36 + movs r2, 0x1 + negs r2, r2 + movs r1, 0x10 + str r1, [sp] + str r4, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl sub_8024604 + ldr r2, [r6] + adds r2, 0x36 + movs r0, 0x4 + movs r1, 0x1 + bl sub_8022BEC + ldr r0, =sub_8020F88 + bl SetMainCallback2 + ldr r0, =sub_8020FA0 + movs r1, 0x8 + bl CreateTask + ldr r1, [r6] + strb r0, [r1, 0xA] + ldr r2, =gTextFlags + ldrb r1, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2] +_08020D74: + add sp, 0xC + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020C70 + + thumb_func_start sub_8020D8C +sub_8020D8C: @ 8020D8C + push {r4,lr} + sub sp, 0xC + ldr r1, =gScriptItemId + ldrh r0, [r1] + subs r0, 0x85 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2B + bls _08020DA8 + movs r0, 0x85 + strh r0, [r1] + b _08020DB0 + .pool +_08020DA8: + ldrh r0, [r1] + movs r1, 0x1 + bl RemoveBagItem +_08020DB0: + ldr r4, =gUnknown_02022C90 + ldr r2, [r4] + ldrb r0, [r2, 0x8] + lsls r0, 5 + adds r0, r2, r0 + ldr r1, =gScriptItemId + ldrh r1, [r1] + subs r1, 0x85 + adds r0, 0xA4 + movs r3, 0 + strh r1, [r0] + movs r0, 0x1 + strb r0, [r2, 0xE] + ldr r1, [r4] + movs r0, 0x9 + strb r0, [r1, 0xF] + ldr r0, [r4] + adds r0, 0x36 + movs r2, 0x1 + negs r2, r2 + movs r1, 0x10 + str r1, [sp] + str r3, [sp, 0x4] + str r3, [sp, 0x8] + movs r1, 0 + bl sub_8024604 + ldr r2, [r4] + adds r2, 0x36 + movs r0, 0x4 + movs r1, 0x1 + bl sub_8022BEC + ldr r0, =sub_8020FA0 + movs r1, 0x8 + bl CreateTask + ldr r1, [r4] + strb r0, [r1, 0xA] + ldr r0, =sub_8020F88 + bl SetMainCallback2 + add sp, 0xC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020D8C + + thumb_func_start sub_8020E1C +sub_8020E1C: @ 8020E1C + push {lr} + ldr r0, =gUnknown_02022C90 + ldr r0, [r0] + ldrb r0, [r0, 0xA] + bl DestroyTask + ldr r0, =sub_8020D8C + bl sub_81AABF0 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020E1C + + thumb_func_start sub_8020E3C +sub_8020E3C: @ 8020E3C + push {lr} + ldr r0, =sub_8020F74 + bl SetVBlankCallback + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020E3C + + thumb_func_start sub_8020E4C +sub_8020E4C: @ 8020E4C + push {lr} + movs r0, 0 + bl SetVBlankCallback + pop {r0} + bx r0 + thumb_func_end sub_8020E4C + + thumb_func_start sub_8020E58 +sub_8020E58: @ 8020E58 + push {r4-r6,lr} + ldr r4, =gUnknown_02022C90 + ldr r0, [r4] + adds r0, 0x6C + ldrh r2, [r0] + lsls r2, 8 + movs r1, 0xF0 + lsls r1, 6 + adds r0, r2, 0 + bl sub_81515FC + adds r2, r0, 0 + ldr r0, [r4] + adds r0, 0x72 + ldrh r3, [r0] + lsls r3, 8 + adds r0, r3, 0 + adds r1, r2, 0 + bl sub_81515FC + adds r3, r0, 0 + ldr r0, =0x0000ffff + ands r3, r0 + ldr r2, [r4] + strh r3, [r2, 0x16] + ldrb r0, [r2, 0x9] + cmp r0, 0x3 + beq _08020EDC + cmp r0, 0x3 + bgt _08020EA4 + cmp r0, 0x2 + beq _08020EAE + b _08020F48 + .pool +_08020EA4: + cmp r0, 0x4 + beq _08020EEC + cmp r0, 0x5 + beq _08020F20 + b _08020F48 +_08020EAE: + ldr r5, =gSaveBlock2Ptr + ldr r1, [r5] + movs r0, 0xF6 + lsls r0, 1 + adds r1, r0 + lsls r0, r3, 16 + lsrs r0, 16 + ldrh r1, [r1] + cmp r0, r1 + bls _08020F48 + adds r2, 0x25 + ldrb r0, [r2] + movs r1, 0x2 + orrs r0, r1 + strb r0, [r2] + ldr r0, [r5] + ldr r1, [r4] + ldrh r1, [r1, 0x16] + movs r2, 0xF6 + lsls r2, 1 + b _08020F14 + .pool +_08020EDC: + ldr r5, =gSaveBlock2Ptr + ldr r0, [r5] + movs r6, 0xF7 + lsls r6, 1 + b _08020F28 + .pool +_08020EEC: + ldr r5, =gSaveBlock2Ptr + ldr r1, [r5] + movs r0, 0xF8 + lsls r0, 1 + adds r1, r0 + lsls r0, r3, 16 + lsrs r0, 16 + ldrh r1, [r1] + cmp r0, r1 + bls _08020F48 + adds r2, 0x25 + ldrb r0, [r2] + movs r1, 0x2 + orrs r0, r1 + strb r0, [r2] + ldr r0, [r5] + ldr r1, [r4] + ldrh r1, [r1, 0x16] + movs r2, 0xF8 + lsls r2, 1 +_08020F14: + adds r0, r2 + strh r1, [r0] + b _08020F48 + .pool +_08020F20: + ldr r5, =gSaveBlock2Ptr + ldr r0, [r5] + movs r6, 0xF9 + lsls r6, 1 +_08020F28: + adds r1, r0, r6 + lsls r0, r3, 16 + lsrs r0, 16 + ldrh r1, [r1] + cmp r0, r1 + bls _08020F48 + adds r2, 0x25 + ldrb r0, [r2] + movs r1, 0x2 + orrs r0, r1 + strb r0, [r2] + ldr r1, [r5] + ldr r0, [r4] + ldrh r0, [r0, 0x16] + adds r1, r6 + strh r0, [r1] +_08020F48: + ldr r4, =gUnknown_02022C90 + ldr r1, [r4] + ldr r0, [r1, 0x68] + str r0, [r1, 0x1C] + bl sub_8024700 + lsls r0, 24 + cmp r0, 0 + bne _08020F66 + ldr r0, [r4] + adds r0, 0x25 + ldrb r1, [r0] + movs r2, 0x1 + orrs r1, r2 + strb r1, [r0] +_08020F66: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020E58 + + thumb_func_start sub_8020F74 +sub_8020F74: @ 8020F74 + push {lr} + bl TransferPlttBuffer + bl LoadOam + bl ProcessSpriteCopyRequests + pop {r0} + bx r0 + thumb_func_end sub_8020F74 + + thumb_func_start sub_8020F88 +sub_8020F88: @ 8020F88 + push {lr} + bl RunTasks + bl RunTextPrinters + bl AnimateSprites + bl BuildOamBuffer + pop {r0} + bx r0 + thumb_func_end sub_8020F88 + + thumb_func_start sub_8020FA0 +sub_8020FA0: @ 8020FA0 + push {r4,lr} + ldr r4, =gUnknown_02022C90 + ldr r0, [r4] + ldr r2, [r0, 0x4] + cmp r2, 0 + beq _08020FB4 + adds r1, r0, 0 + adds r1, 0x36 + bl _call_via_r2 +_08020FB4: + ldr r0, [r4] + bl sub_8021450 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8020FA0 + + thumb_func_start sub_8020FC4 +sub_8020FC4: @ 8020FC4 + push {r4-r6,lr} + adds r6, r0, 0 + movs r5, 0 + b _08020FE6 +_08020FCC: + lsls r0, r5, 5 + adds r0, 0x98 + adds r0, r6, r0 + lsls r1, r5, 3 + subs r1, r5 + lsls r1, 2 + ldr r2, =gLinkPlayers + 8 + adds r1, r2 + bl StringCopy + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_08020FE6: + ldrb r0, [r6, 0x9] + cmp r5, r0 + bcc _08020FCC + cmp r5, 0x4 + bhi _08021012 +_08020FF0: + lsls r4, r5, 5 + adds r0, r4, 0 + adds r0, 0x98 + adds r0, r6, r0 + movs r1, 0x1 + movs r2, 0x7 + bl memset + adds r4, r6, r4 + adds r4, 0x9F + movs r0, 0xFF + strb r0, [r4] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x4 + bls _08020FF0 +_08021012: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x14] + lsls r0, 29 + lsrs r0, 29 + cmp r0, 0x1 + beq _0802103E + cmp r0, 0x1 + bgt _08021034 + cmp r0, 0 + beq _0802103A + b _08021046 + .pool +_08021034: + cmp r0, 0x2 + beq _08021042 + b _08021046 +_0802103A: + movs r0, 0x8 + b _08021044 +_0802103E: + movs r0, 0x4 + b _08021044 +_08021042: + movs r0, 0x1 +_08021044: + strb r0, [r6, 0xB] +_08021046: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8020FC4 + + thumb_func_start sub_802104C +sub_802104C: @ 802104C + push {r4,r5,lr} + sub sp, 0xC + bl sub_8020C00 + adds r5, r0, 0 + cmp r5, 0 + bne _08021060 + movs r0, 0x1 + negs r0, r0 + b _08021304 +_08021060: + ldrb r0, [r5, 0xC] + cmp r0, 0x9 + bls _08021068 + b _080212FC +_08021068: + lsls r0, 2 + ldr r1, =_08021078 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08021078: + .4byte _080210A0 + .4byte _080210BE + .4byte _080210E4 + .4byte _080210F2 + .4byte _08021178 + .4byte _080211BE + .4byte _080211EC + .4byte _0802121C + .4byte _08021278 + .4byte _080212B4 +_080210A0: + movs r0, 0 + bl SetVBlankCallback + movs r0, 0 + bl SetHBlankCallback + movs r0, 0 + movs r1, 0 + bl SetGpuReg + bl remove_some_task + bl reset_temp_tile_data_buffers + b _080212FC +_080210BE: + add r0, sp, 0x8 + movs r4, 0 + strh r4, [r0] + movs r1, 0xE0 + lsls r1, 19 + ldr r2, =0x01000200 + bl CpuSet + ldr r0, =gReservedSpritePaletteCount + strb r4, [r0] + movs r0, 0x3 + bl sub_8034C54 + b _080212FC + .pool +_080210E4: + bl ResetPaletteFade + bl ResetSpriteData + bl FreeAllSpritePalettes + b _080212FC +_080210F2: + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_082F32C8 + movs r0, 0 + movs r2, 0x4 + bl InitBgsFromTemplates + movs r0, 0xE0 + lsls r0, 1 + adds r1, r5, r0 + movs r0, 0x1 + bl SetBgTilemapBuffer + movs r0, 0x87 + lsls r0, 6 + adds r1, r5, r0 + movs r0, 0x2 + bl SetBgTilemapBuffer + movs r0, 0xC7 + lsls r0, 6 + adds r1, r5, r0 + movs r0, 0x3 + bl SetBgTilemapBuffer + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x50 + movs r1, 0 + bl SetGpuReg + movs r0, 0x52 + movs r1, 0 + bl SetGpuReg + b _080212FC + .pool +_08021178: + movs r4, 0x20 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + movs r0, 0x40 + str r0, [sp, 0x4] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + b _080212FC +_080211BE: + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + ldr r1, =gUnknown_08DE34B8 + movs r0, 0 + str r0, [sp] + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + b _080212FC + .pool +_080211EC: + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + cmp r0, 0 + beq _080211F8 + b _08021302 +_080211F8: + bl sub_81971D0 + bl sub_8197200 + adds r0, r5, 0 + bl sub_8022588 + adds r0, r5, 0 + bl sub_8022600 + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x8] + movs r2, 0x80 + orrs r1, r2 + strb r1, [r0, 0x8] + b _080212FC + .pool +_0802121C: + ldr r0, =gUnknown_08DE3398 + movs r2, 0xC0 + lsls r2, 1 + movs r1, 0 + bl LoadPalette + ldr r1, =gBerryCrushGrinderTopTilemap + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + ldr r1, =gBerryCrushContainerCapTilemap + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + ldr r1, =gBerryCrushBackgroundTilemap + movs r0, 0x3 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + adds r0, r5, 0 + bl sub_80226D0 + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + b _080212FC + .pool +_08021278: + bl sub_800E0E8 + movs r0, 0 + movs r1, 0 + bl sub_800DFB4 + adds r0, r5, 0 + bl sub_8022730 + ldr r0, =gSpriteCoordOffsetY + ldrh r1, [r0] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x16 + bl SetGpuReg + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + b _080212FC + .pool +_080212B4: + ldr r2, =gPaletteFade + ldrb r1, [r2, 0x8] + movs r0, 0x7F + ands r0, r1 + strb r0, [r2, 0x8] + movs r0, 0x1 + negs r0, r0 + movs r1, 0x10 + movs r2, 0 + bl BlendPalettes + movs r0, 0 + bl ShowBg + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + movs r0, 0x3 + bl ShowBg + movs r1, 0x82 + lsls r1, 5 + movs r0, 0 + bl SetGpuRegBits + bl sub_8020E3C + movs r0, 0 + strb r0, [r5, 0xC] + movs r0, 0x1 + b _08021304 + .pool +_080212FC: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] +_08021302: + movs r0, 0 +_08021304: + add sp, 0xC + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_802104C + + thumb_func_start sub_802130C +sub_802130C: @ 802130C + push {r4,r5,lr} + sub sp, 0x8 + bl sub_8020C00 + adds r5, r0, 0 + cmp r5, 0 + bne _08021320 + movs r0, 0x1 + negs r0, r0 + b _08021446 +_08021320: + ldrb r0, [r5, 0xC] + cmp r0, 0x7 + bls _08021328 + b _0802143E +_08021328: + lsls r0, 2 + ldr r1, =_08021338 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08021338: + .4byte _08021358 + .4byte _0802135E + .4byte _08021368 + .4byte _0802137E + .4byte _0802138A + .4byte _080213E6 + .4byte _08021426 + .4byte _08021436 +_08021358: + bl sub_8010434 + b _0802143E +_0802135E: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08021444 +_08021368: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + bl UpdatePaletteFade + b _0802143E +_0802137E: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + beq _0802143E + b _08021444 +_0802138A: + movs r4, 0x20 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r4, [sp] + str r4, [sp, 0x4] + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + b _0802143E +_080213E6: + bl FreeAllWindowBuffers + movs r0, 0 + bl HideBg + movs r0, 0 + bl UnsetBgTilemapBuffer + movs r0, 0x1 + bl HideBg + movs r0, 0x1 + bl UnsetBgTilemapBuffer + movs r0, 0x2 + bl HideBg + movs r0, 0x2 + bl UnsetBgTilemapBuffer + movs r0, 0x3 + bl HideBg + movs r0, 0x3 + bl UnsetBgTilemapBuffer + movs r1, 0x82 + lsls r1, 5 + movs r0, 0 + bl ClearGpuRegBits + b _0802143E +_08021426: + bl sub_800E084 + adds r0, r5, 0 + bl sub_8022960 + bl sub_8034CC8 + b _0802143E +_08021436: + movs r0, 0 + strb r0, [r5, 0xC] + movs r0, 0x1 + b _08021446 +_0802143E: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] +_08021444: + movs r0, 0 +_08021446: + add sp, 0x8 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_802130C + + thumb_func_start sub_8021450 +sub_8021450: @ 8021450 + push {r4,lr} + adds r4, r0, 0 + ldr r0, =gSpriteCoordOffsetY + ldrh r1, [r4, 0x2C] + ldrh r2, [r4, 0x2A] + adds r1, r2 + strh r1, [r0] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x16 + bl SetGpuReg + ldrh r0, [r4, 0x12] + cmp r0, 0x7 + bne _0802147C + movs r1, 0x9C + lsls r1, 1 + adds r0, r4, r1 + ldrh r1, [r4, 0x28] + bl sub_8022524 +_0802147C: + movs r0, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8021450 + + thumb_func_start sub_8021488 +sub_8021488: @ 8021488 + movs r1, 0 + ldr r2, =0x0000ff98 + strh r2, [r0, 0x2A] + strh r1, [r0, 0x2C] + ldr r0, =gSpriteCoordOffsetX + strh r1, [r0] + ldr r0, =gSpriteCoordOffsetY + strh r2, [r0] + bx lr + .pool + thumb_func_end sub_8021488 + + thumb_func_start sub_80214A8 +sub_80214A8: @ 80214A8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + mov r10, r0 + str r1, [sp] + movs r0, 0 + mov r9, r0 + mov r1, r10 + ldrb r1, [r1, 0x9] + cmp r9, r1 + bcc _080214C6 + b _080215E4 +_080214C6: + ldr r1, =gUnknown_082F41E8 + mov r2, r9 + lsls r0, r2, 1 + adds r0, r1 + ldrh r2, [r0] + mov r1, r9 + lsls r0, r1, 5 + add r0, r10 + adds r0, 0xA4 + ldrh r3, [r0] + adds r3, 0x85 + lsls r3, 16 + lsrs r3, 16 + ldr r0, =gUnknown_082F436C + adds r1, r2, 0 + bl AddItemIconObjectWithCustomObjectTemplate + lsls r0, 24 + lsrs r0, 24 + mov r2, r9 + lsls r3, r2, 2 + ldr r1, [sp] + adds r1, 0x38 + adds r6, r1, r3 + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r0, =gSprites + adds r1, r0 + str r1, [r6] + ldrb r0, [r1, 0x5] + movs r2, 0xC + orrs r0, r2 + strb r0, [r1, 0x5] + ldr r2, [r6] + adds r2, 0x2C + ldrb r0, [r2] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r2] + ldr r1, [r6] + ldr r0, [sp] + adds r0, 0xC + adds r0, r3 + mov r8, r0 + ldr r0, [r0] + ldrh r0, [r0, 0x8] + adds r0, 0x78 + strh r0, [r1, 0x20] + ldr r1, [r6] + ldr r0, =0x0000fff0 + strh r0, [r1, 0x22] + ldr r3, [r6] + adds r5, r3, 0 + adds r5, 0x2E + movs r0, 0x80 + lsls r0, 2 + strh r0, [r5, 0x2] + movs r0, 0x20 + strh r0, [r5, 0x4] + movs r0, 0x70 + strh r0, [r5, 0xE] + mov r2, r8 + ldr r1, [r2] + ldrh r0, [r1, 0xA] + ldrh r1, [r1, 0x8] + subs r0, r1 + lsls r0, 16 + asrs r1, r0, 16 + adds r0, r1, 0 + cmp r1, 0 + bge _08021558 + adds r0, r1, 0x3 +_08021558: + asrs r0, 2 + strh r0, [r5, 0xC] + lsls r0, r1, 23 + lsrs r7, r0, 16 + movs r2, 0x80 + lsls r2, 2 + adds r2, 0x20 + lsrs r2, 1 + movs r0, 0x7 + movs r1, 0xFE + lsls r1, 6 + str r3, [sp, 0x4] + bl sub_81515D4 + adds r4, r0, 0 + ldr r0, [r6] + ldrh r0, [r0, 0x20] + lsls r0, 7 + ldr r3, [sp, 0x4] + strh r0, [r3, 0x2E] + lsls r1, r7, 16 + asrs r1, 16 + lsls r4, 16 + asrs r4, 16 + movs r0, 0x7 + adds r2, r4, 0 + bl sub_81515D4 + strh r0, [r5, 0x6] + movs r0, 0x7 + adds r1, r4, 0 + movs r2, 0x55 + bl sub_8151550 + adds r2, r0, 0 + movs r0, 0 + strh r0, [r5, 0x8] + lsls r2, 16 + asrs r2, 16 + movs r0, 0x7 + movs r1, 0xFE + lsls r1, 6 + bl sub_81515D4 + strh r0, [r5, 0xA] + ldrh r0, [r5, 0xE] + ldr r2, =0xffff8000 + adds r1, r2, 0 + orrs r0, r1 + strh r0, [r5, 0xE] + mov r1, r8 + ldr r0, [r1] + movs r2, 0x8 + ldrsh r0, [r0, r2] + cmp r0, 0 + bge _080215D0 + ldr r0, [r6] + movs r1, 0x1 + bl StartSpriteAffineAnim +_080215D0: + mov r0, r9 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + mov r0, r10 + ldrb r0, [r0, 0x9] + cmp r9, r0 + bcs _080215E4 + b _080214C6 +_080215E4: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80214A8 + + thumb_func_start sub_8021608 +sub_8021608: @ 8021608 + push {r4-r6,lr} + adds r5, r0, 0 + adds r4, r5, 0 + adds r4, 0x2E + ldrh r0, [r4, 0x4] + ldrh r1, [r4, 0x2] + adds r0, r1 + strh r0, [r4, 0x2] + lsls r0, 16 + asrs r0, 24 + ldrh r2, [r5, 0x26] + adds r0, r2 + strh r0, [r5, 0x26] + movs r1, 0xE + ldrsh r0, [r4, r1] + movs r6, 0x80 + lsls r6, 8 + ands r0, r6 + cmp r0, 0 + beq _0802166E + ldrh r0, [r4, 0x6] + ldrh r2, [r5, 0x2E] + adds r0, r2 + strh r0, [r5, 0x2E] + ldrh r0, [r4, 0xA] + ldrh r1, [r4, 0x8] + adds r0, r1 + strh r0, [r4, 0x8] + lsls r0, 16 + asrs r0, 23 + movs r2, 0xC + ldrsh r1, [r4, r2] + bl Sin + strh r0, [r5, 0x24] + movs r1, 0xE + ldrsh r0, [r4, r1] + ands r0, r6 + cmp r0, 0 + beq _0802166E + ldrh r0, [r4, 0x8] + lsls r0, 16 + asrs r0, 23 + cmp r0, 0x7E + ble _0802166E + movs r0, 0 + strh r0, [r5, 0x24] + ldrh r1, [r4, 0xE] + ldr r0, =0x00007fff + ands r0, r1 + strh r0, [r4, 0xE] +_0802166E: + ldrh r0, [r4] + lsls r0, 16 + asrs r0, 23 + strh r0, [r5, 0x20] + movs r2, 0x22 + ldrsh r1, [r5, r2] + movs r2, 0x26 + ldrsh r0, [r5, r2] + adds r1, r0 + ldrh r2, [r4, 0xE] + ldr r0, =0x00007fff + ands r0, r2 + cmp r1, r0 + blt _0802169A + ldr r0, =SpriteCallbackDummy + str r0, [r5, 0x1C] + adds r0, r5, 0 + bl FreeSpriteOamMatrix + adds r0, r5, 0 + bl DestroySprite +_0802169A: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8021608 + + thumb_func_start sub_80216A8 +sub_80216A8: @ 80216A8 + push {r4-r7,lr} + adds r6, r0, 0 + movs r5, 0 + ldrb r0, [r6, 0x9] + cmp r5, r0 + bcs _080216D4 + ldr r7, =gUnknown_082F41E8 +_080216B6: + lsls r0, r5, 1 + adds r0, r7 + ldrh r4, [r0] + adds r0, r4, 0 + bl FreeSpritePaletteByTag + adds r0, r4, 0 + bl FreeSpriteTilesByTag + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + ldrb r0, [r6, 0x9] + cmp r5, r0 + bcc _080216B6 +_080216D4: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80216A8 + + thumb_func_start sub_80216E0 +sub_80216E0: @ 80216E0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x10 + adds r6, r0, 0 + str r1, [sp] + movs r0, 0 + str r0, [sp, 0x4] + movs r1, 0x4E + adds r1, r6 + mov r10, r1 + mov r9, r0 + ldrb r2, [r6, 0x9] + cmp r0, r2 + bcs _080217AE + ldr r7, =gUnknown_082F41CC +_08021704: + mov r3, r10 + ldrh r0, [r3, 0xA] + mov r4, r9 + lsls r1, r4, 1 + add r1, r9 + asrs r0, r1 + lsls r0, 16 + movs r1, 0xE0 + lsls r1, 11 + ands r1, r0 + lsrs r1, 16 + mov r8, r1 + cmp r1, 0 + beq _0802179E + ldr r0, [sp, 0x4] + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0x4] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _08021748 + lsls r4, 2 + ldr r5, [sp] + adds r5, 0x24 + adds r0, r5, r4 + ldr r0, [r0] + movs r1, 0x1 + bl StartSpriteAnim + b _0802175A + .pool +_08021748: + mov r0, r9 + lsls r4, r0, 2 + ldr r5, [sp] + adds r5, 0x24 + adds r0, r5, r4 + ldr r0, [r0] + movs r1, 0 + bl StartSpriteAnim +_0802175A: + adds r3, r5, r4 + ldr r2, [r3] + adds r2, 0x3E + ldrb r0, [r2] + movs r4, 0x5 + negs r4, r4 + adds r1, r4, 0 + ands r0, r1 + strb r0, [r2] + ldr r2, [r3] + adds r2, 0x2C + ldrb r0, [r2] + subs r4, 0x3C + adds r1, r4, 0 + ands r0, r1 + strb r0, [r2] + ldr r2, [r3] + movs r0, 0x3 + mov r1, r8 + ands r1, r0 + mov r8, r1 + subs r1, 0x1 + lsls r1, 1 + adds r0, r1, r7 + ldrb r0, [r0] + lsls r0, 24 + asrs r0, 24 + strh r0, [r2, 0x24] + ldr r2, [r3] + ldr r3, =gUnknown_082F41CC+1 + adds r1, r3 + movs r0, 0 + ldrsb r0, [r1, r0] + strh r0, [r2, 0x26] +_0802179E: + mov r0, r9 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + ldrb r4, [r6, 0x9] + cmp r9, r4 + bcc _08021704 +_080217AE: + ldr r0, [sp, 0x4] + cmp r0, 0 + bne _080217C0 + adds r2, r6, 0 + adds r2, 0x25 + ldrb r1, [r2] + b _0802189C + .pool +_080217C0: + ldrh r0, [r6, 0x28] + movs r1, 0x3 + bl __umodsi3 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + mov r1, r8 + str r1, [sp, 0x8] + movs r2, 0 + mov r9, r2 + mov r3, r10 + ldrh r1, [r3, 0xC] + lsls r0, r1, 1 + adds r0, 0x3 + adds r6, 0x25 + str r6, [sp, 0xC] + adds r3, r1, 0 + cmp r9, r0 + bge _08021890 +_080217E8: + mov r4, r9 + lsls r1, r4, 2 + ldr r0, [sp] + adds r0, 0x4C + adds r7, r0, r1 + ldr r2, [r7] + adds r0, r2, 0 + adds r0, 0x3E + ldrb r1, [r0] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _0802187E + ldr r0, =sub_8022B28 + str r0, [r2, 0x1C] + lsls r1, r4, 1 + ldr r3, =gUnknown_082F41CC+6 + adds r0, r1, r3 + movs r4, 0 + ldrsb r4, [r0, r4] + adds r0, r4, 0 + adds r0, 0x78 + strh r0, [r2, 0x20] + ldr r2, [r7] + ldr r0, =gUnknown_082F41CC+7 + adds r1, r0 + movs r6, 0 + ldrsb r6, [r1, r6] + mov r1, r8 + lsls r0, r1, 2 + subs r0, 0x88 + subs r0, r6, r0 + strh r0, [r2, 0x22] + ldr r5, [r7] + ldr r2, [sp, 0x8] + lsls r1, r2, 2 + adds r0, r4, 0 + bl __divsi3 + adds r4, r0 + strh r4, [r5, 0x24] + ldr r0, [r7] + strh r6, [r0, 0x26] + mov r3, r10 + ldrb r1, [r3, 0x4] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _08021860 + ldr r0, [r7] + movs r1, 0x1 + bl StartSpriteAnim + b _08021868 + .pool +_08021860: + ldr r0, [r7] + movs r1, 0 + bl StartSpriteAnim +_08021868: + mov r0, r8 + adds r0, 0x1 + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + mov r4, r10 + ldrh r3, [r4, 0xC] + cmp r0, 0x3 + bls _0802187E + movs r0, 0 + mov r8, r0 +_0802187E: + mov r0, r9 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + lsls r0, r3, 1 + adds r0, 0x3 + cmp r9, r0 + blt _080217E8 +_08021890: + ldr r2, [sp, 0xC] + ldrb r1, [r2] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _080218A6 +_0802189C: + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2] + b _080218C4 +_080218A6: + ldr r3, [sp, 0x4] + cmp r3, 0x1 + bne _080218B4 + movs r0, 0x4E + bl PlaySE + b _080218BA +_080218B4: + movs r0, 0x4D + bl PlaySE +_080218BA: + ldr r4, [sp, 0xC] + ldrb r0, [r4] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r4] +_080218C4: + add sp, 0x10 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_80216E0 + + thumb_func_start sub_80218D4 +sub_80218D4: @ 80218D4 + push {r4-r7,lr} + adds r5, r0, 0 + adds r6, r1, 0 + movs r2, 0 + ldrb r0, [r5, 0x9] + cmp r2, r0 + bcs _08021906 + adds r4, r6, 0 + adds r4, 0x24 + movs r7, 0x4 + adds r3, r0, 0 +_080218EA: + lsls r0, r2, 2 + adds r0, r4, r0 + ldr r0, [r0] + adds r0, 0x3E + ldrb r1, [r0] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0 + beq _08021920 + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, r3 + bcc _080218EA +_08021906: + movs r2, 0 + adds r3, r6, 0 + adds r3, 0x4C + movs r4, 0x4 +_0802190E: + lsls r0, r2, 2 + adds r0, r3, r0 + ldr r0, [r0] + adds r0, 0x3E + ldrb r1, [r0] + adds r0, r4, 0 + ands r0, r1 + cmp r0, 0 + bne _08021924 +_08021920: + movs r0, 0 + b _0802193C +_08021924: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xA + bls _0802190E + movs r1, 0x2C + ldrsh r0, [r5, r1] + cmp r0, 0 + beq _0802193A + movs r0, 0 + strh r0, [r5, 0x2C] +_0802193A: + movs r0, 0x1 +_0802193C: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80218D4 + + thumb_func_start sub_8021944 +sub_8021944: @ 8021944 + push {r4-r7,lr} + adds r6, r0, 0 + lsls r4, r1, 16 + lsrs r4, 16 + movs r7, 0 + movs r5, 0xE1 + lsls r5, 4 + adds r0, r4, 0 + adds r1, r5, 0 + bl __udivsi3 + strh r0, [r6, 0x4] + adds r0, r4, 0 + adds r1, r5, 0 + bl __umodsi3 + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x3C + bl __udivsi3 + strh r0, [r6, 0x6] + adds r0, r4, 0 + movs r1, 0x3C + bl __umodsi3 + lsls r0, 24 + asrs r0, 16 + movs r1, 0x4 + bl sub_8151534 + adds r2, r7, 0 + lsls r0, 16 + asrs r3, r0, 16 + movs r0, 0x7 + mov r12, r0 + ldr r5, =gUnknown_082F334C + movs r4, 0x1 +_08021990: + mov r0, r12 + subs r1, r0, r2 + adds r0, r3, 0 + asrs r0, r1 + ands r0, r4 + cmp r0, 0 + beq _080219A6 + lsls r0, r2, 2 + adds r0, r5 + ldr r0, [r0] + adds r7, r0 +_080219A6: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x7 + bls _08021990 + ldr r1, =0x000f4240 + adds r0, r7, 0 + bl __udivsi3 + strh r0, [r6, 0x8] + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8021944 + + thumb_func_start sub_80219C8 +sub_80219C8: @ 80219C8 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0xC + adds r6, r0, 0 + adds r4, r1, 0 + adds r5, r2, 0 + mov r8, r3 + lsls r6, 24 + lsrs r6, 24 + lsls r4, 24 + lsrs r4, 24 + lsls r5, 24 + lsrs r5, 24 + movs r2, 0x1 + negs r2, r2 + movs r0, 0x2 + mov r1, r8 + bl GetStringWidth + lsls r4, 2 + lsrs r0, 1 + subs r4, r0 + lsls r4, 24 + lsrs r4, 24 + lsls r0, r5, 1 + adds r0, r5 + ldr r1, =gUnknown_082F32D8 + adds r0, r1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + mov r0, r8 + str r0, [sp, 0x8] + adds r0, r6, 0 + movs r1, 0x2 + adds r2, r4, 0 + movs r3, 0 + bl box_print + add sp, 0xC + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80219C8 + + thumb_func_start sub_8021A28 +sub_8021A28: @ 8021A28 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x2C + str r0, [sp, 0xC] + lsls r1, 24 + lsrs r1, 24 + str r1, [sp, 0x10] + lsls r2, 24 + lsrs r2, 24 + str r2, [sp, 0x14] + lsls r3, 24 + movs r0, 0 + str r0, [sp, 0x18] + movs r1, 0 + str r1, [sp, 0x1C] + ldr r2, [sp, 0xC] + adds r2, 0x68 + str r2, [sp, 0x20] + movs r4, 0xF0 + lsls r4, 24 + adds r3, r4 + lsrs r3, 24 + ldr r0, [sp, 0x10] + cmp r0, 0x2 + bne _08021A68 + adds r0, r3, 0 + subs r0, 0x2A + lsls r0, 24 + lsrs r3, r0, 24 +_08021A68: + ldr r2, [sp, 0xC] + ldrb r1, [r2, 0x9] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + subs r6, r3, r0 + cmp r6, 0 + ble _08021A84 + lsrs r0, r6, 31 + adds r0, r6, r0 + asrs r0, 1 + adds r6, r0, 0 + adds r6, 0x10 + b _08021A86 +_08021A84: + movs r6, 0x10 +_08021A86: + movs r5, 0 + ldr r3, [sp, 0xC] + ldrb r3, [r3, 0x9] + cmp r5, r3 + bcc _08021A92 + b _08021D14 +_08021A92: + ldr r4, [sp, 0x10] + lsls r4, 2 + str r4, [sp, 0x24] +_08021A98: + bl sub_81AFBF0 + ldr r0, [sp, 0x10] + cmp r0, 0x1 + beq _08021B48 + cmp r0, 0x1 + bgt _08021AC0 + cmp r0, 0 + beq _08021ADE + ldr r4, [sp, 0x14] + subs r4, 0x4 + lsls r1, r6, 24 + mov r10, r1 + ldr r2, [sp, 0x1C] + adds r2, 0xA2 + mov r9, r2 + ldr r3, [sp, 0x18] + lsls r3, 5 + mov r8, r3 + b _08021C5A +_08021AC0: + ldr r4, [sp, 0x10] + cmp r4, 0x2 + bne _08021AC8 + b _08021C1C +_08021AC8: + ldr r4, [sp, 0x14] + subs r4, 0x4 + lsls r0, r6, 24 + mov r10, r0 + ldr r1, [sp, 0x1C] + adds r1, 0xA2 + mov r9, r1 + ldr r2, [sp, 0x18] + lsls r2, 5 + mov r8, r2 + b _08021C5A +_08021ADE: + ldr r0, [sp, 0x20] + adds r0, 0x20 + adds r0, r5 + ldrb r0, [r0] + str r0, [sp, 0x18] + lsls r3, r5, 1 + ldr r2, [sp, 0x20] + adds r2, 0xC + cmp r5, 0 + beq _08021B04 + adds r0, r2, r3 + subs r1, r5, 0x1 + lsls r1, 1 + adds r1, r2, r1 + ldrh r0, [r0] + ldrh r1, [r1] + cmp r0, r1 + beq _08021B04 + str r5, [sp, 0x1C] +_08021B04: + ldr r4, [sp, 0x24] + ldr r1, [sp, 0x10] + adds r0, r4, r1 + lsls r0, 1 + adds r0, r3, r0 + adds r0, r2, r0 + ldrh r1, [r0] + ldr r0, =gStringVar4 + movs r2, 0x1 + movs r3, 0x4 + bl ConvertIntToDecimalStringN + ldr r0, =gUnknown_082F43B4 + adds r0, r4, r0 + ldr r1, [r0] + ldr r0, =gStringVar4 + bl StringAppend + ldr r4, [sp, 0x14] + subs r4, 0x4 + lsls r2, r6, 24 + mov r10, r2 + ldr r3, [sp, 0x1C] + adds r3, 0xA2 + mov r9, r3 + ldr r0, [sp, 0x18] + lsls r0, 5 + mov r8, r0 + b _08021C5A + .pool +_08021B48: + ldr r1, [sp, 0x20] + adds r0, r1, r5 + adds r0, 0x28 + ldrb r0, [r0] + str r0, [sp, 0x18] + lsls r3, r5, 1 + adds r2, r1, 0 + adds r2, 0xC + cmp r5, 0 + beq _08021B72 + adds r0, r3, 0 + adds r0, 0xA + adds r0, r2, r0 + adds r1, r3, 0 + adds r1, 0x8 + adds r1, r2, r1 + ldrh r0, [r0] + ldrh r1, [r1] + cmp r0, r1 + beq _08021B72 + str r5, [sp, 0x1C] +_08021B72: + ldr r0, [sp, 0x24] + ldr r1, [sp, 0x10] + adds r4, r0, r1 + lsls r4, 1 + adds r4, r3, r4 + adds r4, r2, r4 + ldrh r1, [r4] + lsrs r1, 4 + ldr r0, =gStringVar1 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + movs r7, 0 + ldrb r0, [r4] + movs r3, 0xF + ands r3, r0 + movs r2, 0 + ldr r4, [sp, 0x10] + lsls r4, 2 + str r4, [sp, 0x28] + ldr r4, [sp, 0x14] + subs r4, 0x4 + lsls r0, r6, 24 + mov r10, r0 + ldr r1, [sp, 0x1C] + adds r1, 0xA2 + mov r9, r1 + ldr r0, [sp, 0x18] + lsls r0, 5 + mov r8, r0 + adds r6, 0xE + adds r5, 0x1 + ldr r1, =gUnknown_082F334C + mov r12, r1 +_08021BB8: + movs r0, 0x3 + subs r1, r0, r2 + adds r0, r3, 0 + asrs r0, r1 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08021BD0 + lsls r0, r2, 2 + add r0, r12 + ldr r0, [r0] + adds r7, r0 +_08021BD0: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _08021BB8 + adds r0, r7, 0 + ldr r1, =0x000f4240 + bl __udivsi3 + lsls r0, 24 + lsrs r3, r0, 24 + ldr r0, =gStringVar2 + adds r1, r3, 0 + movs r2, 0x2 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r0, =gUnknown_082F43B4 + ldr r2, [sp, 0x28] + adds r0, r2, r0 + ldr r1, [r0] + ldr r0, =gStringVar4 + bl StringExpandPlaceholders + b _08021C5E + .pool +_08021C1C: + str r5, [sp, 0x18] + str r5, [sp, 0x1C] + lsls r7, r5, 5 + ldr r3, [sp, 0xC] + adds r0, r3, r7 + adds r0, 0xA4 + ldrb r2, [r0] + cmp r2, 0x2B + bls _08021C30 + movs r2, 0 +_08021C30: + lsls r1, r2, 3 + subs r1, r2 + lsls r1, 2 + ldr r0, =gBerries + adds r1, r0 + ldr r0, =gStringVar1 + bl StringCopy + ldr r0, =gUnknown_082F43B4 + ldr r1, [r0, 0x8] + ldr r0, =gStringVar4 + bl StringExpandPlaceholders + ldr r4, [sp, 0x14] + subs r4, 0x4 + lsls r0, r6, 24 + mov r10, r0 + movs r1, 0xA2 + adds r1, r5 + mov r9, r1 + mov r8, r7 +_08021C5A: + adds r6, 0xE + adds r5, 0x1 +_08021C5E: + movs r0, 0x2 + ldr r1, =gStringVar4 + adds r2, r4, 0 + bl GetStringRightAlignXOffset + adds r2, r0, 0 + ldr r3, [sp, 0xC] + movs r4, 0xDD + lsls r4, 1 + adds r0, r3, r4 + ldrb r0, [r0] + lsls r2, 24 + lsrs r2, 24 + mov r1, r10 + lsrs r3, r1, 24 + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + movs r4, 0 + str r4, [sp, 0x4] + ldr r1, =gStringVar4 + str r1, [sp, 0x8] + movs r1, 0x2 + bl box_print + ldr r3, [sp, 0x18] + ldr r2, [sp, 0xC] + ldrb r2, [r2, 0x8] + cmp r3, r2 + bne _08021CC0 + ldr r0, =gStringVar3 + ldr r1, =gText_1DotBlueF700 + bl StringCopy + b _08021CC8 + .pool +_08021CC0: + ldr r0, =gStringVar3 + ldr r1, =gText_1DotF700 + bl StringCopy +_08021CC8: + ldr r4, =gStringVar3 + mov r3, r9 + strb r3, [r4] + mov r1, r8 + adds r1, 0x98 + ldr r0, [sp, 0xC] + adds r1, r0, r1 + movs r0, 0 + bl sub_81AFC0C + ldr r0, =gStringVar4 + adds r1, r4, 0 + bl sub_81AFC28 + ldr r1, [sp, 0xC] + movs r2, 0xDD + lsls r2, 1 + adds r0, r1, r2 + ldrb r0, [r0] + mov r4, r10 + lsrs r3, r4, 24 + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + movs r1, 0 + str r1, [sp, 0x4] + ldr r2, =gStringVar4 + str r2, [sp, 0x8] + movs r1, 0x2 + movs r2, 0x4 + bl box_print + lsls r0, r5, 24 + lsrs r5, r0, 24 + ldr r3, [sp, 0xC] + ldrb r3, [r3, 0x9] + cmp r5, r3 + bcs _08021D14 + b _08021A98 +_08021D14: + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8021A28 + + thumb_func_start sub_8021D34 +sub_8021D34: @ 8021D34 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x1C + mov r8, r0 + movs r0, 0 + mov r10, r0 + movs r6, 0 + movs r1, 0 + str r1, [sp, 0xC] + mov r2, r8 + adds r2, 0x68 + str r2, [sp, 0x10] + movs r4, 0xDD + lsls r4, 1 + add r4, r8 + mov r9, r4 + ldrb r0, [r4] + movs r1, 0x4 + bl GetWindowAttribute + lsls r0, 27 + movs r1, 0xD6 + lsls r1, 24 + adds r0, r1 + lsrs r7, r0, 24 + movs r0, 0x9C + lsls r0, 1 + add r0, r8 + ldr r2, [sp, 0x10] + ldrh r1, [r2, 0x4] + bl sub_8021944 + ldrb r0, [r4] + ldr r4, =gUnknown_082F32D8 + str r4, [sp] + str r6, [sp, 0x4] + ldr r1, =gText_TimeColon + str r1, [sp, 0x8] + movs r1, 0x2 + movs r2, 0 + adds r3, r7, 0 + bl box_print + ldr r4, =gText_SpaceSec + movs r0, 0x2 + adds r1, r4, 0 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + movs r1, 0xB0 + subs r0, r1, r0 + lsls r0, 24 + lsrs r6, r0, 24 + mov r2, r9 + ldrb r0, [r2] + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + mov r2, r10 + str r2, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x2 + adds r2, r6, 0 + adds r3, r7, 0 + bl box_print + movs r0, 0x9F + lsls r0, 1 + add r0, r8 + movs r4, 0 + ldrsh r1, [r0, r4] + ldr r0, =gStringVar1 + movs r2, 0x2 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r0, =gStringVar2 + movs r1, 0xA0 + lsls r1, 1 + add r1, r8 + movs r2, 0 + ldrsh r1, [r1, r2] + movs r2, 0x2 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r5, =gStringVar4 + ldr r1, =gText_XDotY2 + adds r0, r5, 0 + bl StringExpandPlaceholders + movs r0, 0x2 + adds r1, r5, 0 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + subs r0, r6, r0 + lsls r0, 24 + lsrs r6, r0, 24 + mov r4, r9 + ldrb r0, [r4] + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + mov r2, r10 + str r2, [sp, 0x4] + str r5, [sp, 0x8] + movs r1, 0x2 + adds r2, r6, 0 + adds r3, r7, 0 + bl box_print + ldr r4, =gText_SpaceMin + movs r0, 0x2 + adds r1, r4, 0 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + subs r0, r6, r0 + lsls r0, 24 + lsrs r6, r0, 24 + mov r1, r9 + ldrb r0, [r1] + ldr r2, =gUnknown_082F32D8 + str r2, [sp] + mov r1, r10 + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x2 + adds r2, r6, 0 + adds r3, r7, 0 + bl box_print + movs r0, 0x9E + lsls r0, 1 + add r0, r8 + movs r2, 0 + ldrsh r1, [r0, r2] + ldr r0, =gStringVar1 + movs r2, 0x2 + movs r3, 0x1 + bl ConvertIntToDecimalStringN + ldr r1, =gText_StrVar1 + adds r0, r5, 0 + bl StringExpandPlaceholders + movs r0, 0x2 + adds r1, r5, 0 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + subs r0, r6, r0 + lsls r0, 24 + lsrs r6, r0, 24 + mov r4, r9 + ldrb r0, [r4] + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + mov r2, r10 + str r2, [sp, 0x4] + str r5, [sp, 0x8] + movs r1, 0x2 + adds r2, r6, 0 + adds r3, r7, 0 + bl box_print + adds r0, r7, 0 + adds r0, 0xE + lsls r0, 24 + lsrs r7, r0, 24 + ldrb r0, [r4] + ldr r4, =gUnknown_082F32D8 + str r4, [sp] + mov r1, r10 + str r1, [sp, 0x4] + ldr r1, =gText_PressingSpeed + str r1, [sp, 0x8] + movs r1, 0x2 + movs r2, 0 + adds r3, r7, 0 + bl box_print + ldr r4, =gText_TimesPerSec + movs r0, 0x2 + adds r1, r4, 0 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + movs r2, 0xB0 + subs r0, r2, r0 + lsls r0, 24 + str r0, [sp, 0x18] + lsrs r6, r0, 24 + mov r1, r9 + ldrb r0, [r1] + ldr r2, =gUnknown_082F32D8 + str r2, [sp] + mov r1, r10 + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x2 + adds r2, r6, 0 + adds r3, r7, 0 + bl box_print + mov r4, r8 + ldrb r2, [r4, 0x16] + ldrh r0, [r4, 0x16] + mov r12, r0 + movs r1, 0x7 + mov r9, r1 + movs r5, 0x1 + ldr r3, =gUnknown_082F334C +_08021EEC: + mov r4, r9 + mov r0, r10 + subs r1, r4, r0 + adds r0, r2, 0 + asrs r0, r1 + ands r0, r5 + cmp r0, 0 + beq _08021F0A + mov r1, r10 + lsls r0, r1, 2 + adds r0, r3 + ldr r0, [r0] + ldr r4, [sp, 0xC] + adds r4, r0 + str r4, [sp, 0xC] +_08021F0A: + mov r0, r10 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + cmp r0, 0x7 + bls _08021EEC + ldr r0, =gStringVar1 + mov r2, r12 + lsrs r1, r2, 8 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldr r4, =gStringVar2 + ldr r1, =0x000f4240 + ldr r0, [sp, 0xC] + bl __udivsi3 + adds r1, r0, 0 + adds r0, r4, 0 + movs r2, 0x2 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r4, =gStringVar4 + ldr r1, =gText_XDotY3 + adds r0, r4, 0 + bl StringExpandPlaceholders + movs r2, 0x1 + negs r2, r2 + movs r0, 0x2 + adds r1, r4, 0 + bl GetStringWidth + subs r0, r6, r0 + lsls r0, 24 + lsrs r6, r0, 24 + mov r0, r8 + adds r0, 0x25 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0 + beq _08021FC4 + movs r0, 0xDD + lsls r0, 1 + add r0, r8 + ldrb r0, [r0] + ldr r1, =gUnknown_082F32E7 + str r1, [sp] + movs r1, 0 + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x2 + adds r2, r6, 0 + adds r3, r7, 0 + bl box_print + b _08021FDE + .pool +_08021FC4: + movs r0, 0xDD + lsls r0, 1 + add r0, r8 + ldrb r0, [r0] + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + str r2, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x2 + adds r2, r6, 0 + adds r3, r7, 0 + bl box_print +_08021FDE: + adds r0, r7, 0 + adds r0, 0xE + lsls r0, 24 + lsrs r7, r0, 24 + movs r4, 0xDD + lsls r4, 1 + add r8, r4 + mov r1, r8 + ldrb r0, [r1] + ldr r2, =gUnknown_082F32D8 + mov r9, r2 + str r2, [sp] + movs r5, 0 + str r5, [sp, 0x4] + ldr r1, =gText_Silkiness + str r1, [sp, 0x8] + movs r1, 0x2 + movs r2, 0 + adds r3, r7, 0 + bl box_print + ldr r0, =gStringVar1 + ldr r4, [sp, 0x10] + ldrh r1, [r4, 0x8] + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldr r4, =gStringVar4 + ldr r1, =gText_Var1Percent + adds r0, r4, 0 + bl StringExpandPlaceholders + movs r2, 0x1 + negs r2, r2 + movs r0, 0x2 + adds r1, r4, 0 + bl GetStringWidth + movs r1, 0xB0 + subs r1, r0 + lsls r1, 24 + lsrs r6, r1, 24 + mov r1, r8 + ldrb r0, [r1] + mov r2, r9 + str r2, [sp] + str r5, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x2 + adds r2, r6, 0 + adds r3, r7, 0 + bl box_print + 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_8021D34 + + thumb_func_start sub_8022070 +sub_8022070: @ 8022070 + push {r4-r6,lr} + sub sp, 0x8 + adds r4, r0, 0 + adds r6, r1, 0 + adds r0, r6, 0 + adds r0, 0x80 + ldrb r0, [r0] + cmp r0, 0x5 + bls _08022084 + b _08022218 +_08022084: + lsls r0, 2 + ldr r1, =_08022094 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08022094: + .4byte _080220AC + .4byte _080220F8 + .4byte _0802210C + .4byte _08022130 + .4byte _080221F8 + .4byte _08022200 +_080220AC: + ldrb r0, [r4, 0x9] + subs r0, 0x2 + lsls r0, 24 + lsrs r5, r0, 24 + adds r0, r6, 0 + bl sub_8022554 + ldrh r0, [r4, 0x12] + lsls r0, 3 + ldr r2, =gUnknown_082F32CC + mov r1, sp + adds r0, r2 + ldm r0!, {r2,r3} + stm r1!, {r2,r3} + ldrh r0, [r4, 0x12] + cmp r0, 0xD + bne _080220DC + ldr r0, =gUnknown_082F3344 + adds r0, 0x4 + b _080220DE + .pool +_080220DC: + ldr r0, =gUnknown_082F3344 +_080220DE: + adds r0, r5, r0 + ldrb r1, [r0] + mov r0, sp + strb r1, [r0, 0x4] + mov r0, sp + bl AddWindow + adds r1, r6, 0 + adds r1, 0x82 + strb r0, [r1] + b _08022218 + .pool +_080220F8: + adds r4, r6, 0 + adds r4, 0x82 + ldrb r0, [r4] + bl PutWindowTilemap + ldrb r0, [r4] + movs r1, 0 + bl FillWindowPixelBuffer + b _08022218 +_0802210C: + adds r5, r6, 0 + adds r5, 0x82 + ldrb r0, [r5] + ldr r4, =0x0000021d + adds r1, r4, 0 + movs r2, 0xD0 + bl box_border_load_tiles_and_pal + ldrb r0, [r5] + movs r1, 0 + adds r2, r4, 0 + movs r3, 0xD + bl SetWindowBorderStyle + b _08022218 + .pool +_08022130: + ldrb r0, [r4, 0x9] + subs r0, 0x2 + lsls r0, 24 + lsrs r5, r0, 24 + ldrh r0, [r4, 0x12] + cmp r0, 0xC + beq _08022184 + cmp r0, 0xC + bgt _08022148 + cmp r0, 0xB + beq _0802214E + b _08022218 +_08022148: + cmp r0, 0xD + beq _080221C8 + b _08022218 +_0802214E: + adds r0, r6, 0 + adds r0, 0x82 + ldrb r0, [r0] + ldr r3, =gText_PressesRankings + movs r1, 0x14 + movs r2, 0x3 + bl sub_80219C8 + ldr r0, =gUnknown_082F3344 + adds r0, r5, r0 + ldrb r3, [r0] + lsls r3, 27 + lsrs r3, 24 + adds r0, r4, 0 + movs r1, 0 + movs r2, 0xA0 + bl sub_8021A28 + adds r1, r6, 0 + adds r1, 0x80 + movs r0, 0x5 + b _08022220 + .pool +_08022184: + adds r0, r6, 0 + adds r0, 0x82 + ldrb r0, [r0] + ldr r2, =gUnknown_082F43B4 + adds r1, r4, 0 + adds r1, 0x8F + ldrb r1, [r1] + adds r1, 0x3 + lsls r1, 2 + adds r1, r2 + ldr r3, [r1] + movs r1, 0x14 + movs r2, 0x4 + bl sub_80219C8 + ldr r0, =gUnknown_082F3344 + adds r0, r5, r0 + ldrb r3, [r0] + lsls r3, 27 + lsrs r3, 24 + adds r0, r4, 0 + movs r1, 0x1 + movs r2, 0xA0 + bl sub_8021A28 + adds r1, r6, 0 + adds r1, 0x80 + movs r0, 0x5 + b _08022220 + .pool +_080221C8: + adds r0, r6, 0 + adds r0, 0x82 + ldrb r0, [r0] + ldr r3, =gText_CrushingResults + movs r1, 0x16 + movs r2, 0x3 + bl sub_80219C8 + ldr r0, =gUnknown_082F3344 + adds r0, 0x4 + adds r0, r5, r0 + ldrb r3, [r0] + lsls r3, 27 + lsrs r3, 24 + adds r0, r4, 0 + movs r1, 0x2 + movs r2, 0xB0 + bl sub_8021A28 + b _08022218 + .pool +_080221F8: + adds r0, r4, 0 + bl sub_8021D34 + b _08022218 +_08022200: + adds r0, r6, 0 + adds r0, 0x82 + ldrb r0, [r0] + movs r1, 0x3 + bl CopyWindowToVram + adds r1, r6, 0 + adds r1, 0x80 + movs r0, 0 + strb r0, [r1] + movs r0, 0x1 + b _08022224 +_08022218: + adds r1, r6, 0 + adds r1, 0x80 + ldrb r0, [r1] + adds r0, 0x1 +_08022220: + strb r0, [r1] + movs r0, 0 +_08022224: + add sp, 0x8 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8022070 + + thumb_func_start sub_802222C +sub_802222C: @ 802222C + push {r4,r5,lr} + adds r4, r0, 0 + movs r0, 0xDD + lsls r0, 1 + adds r5, r4, r0 + ldrb r0, [r5] + movs r1, 0x1 + bl sub_8198070 + ldrb r0, [r5] + bl RemoveWindow + adds r0, r4, 0 + bl sub_8022600 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802222C + + thumb_func_start sub_8022250 +sub_8022250: @ 8022250 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x14 + lsls r0, 24 + lsrs r4, r0, 24 + movs r0, 0 + mov r9, r0 + movs r1, 0 + str r1, [sp, 0xC] + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r6, r0, r1 + movs r1, 0 + ldrsh r0, [r6, r1] + cmp r0, 0x1 + beq _080222D0 + cmp r0, 0x1 + bgt _08022288 + cmp r0, 0 + beq _08022296 + b _080224BA + .pool +_08022288: + cmp r0, 0x2 + bne _0802228E + b _08022480 +_0802228E: + cmp r0, 0x3 + bne _08022294 + b _08022494 +_08022294: + b _080224BA +_08022296: + ldr r0, =gUnknown_082F32EC + bl AddWindow + strh r0, [r6, 0x2] + lsls r0, 24 + lsrs r0, 24 + bl PutWindowTilemap + ldrb r0, [r6, 0x2] + movs r1, 0 + bl FillWindowPixelBuffer + ldrb r0, [r6, 0x2] + ldr r4, =0x0000021d + adds r1, r4, 0 + movs r2, 0xD0 + bl box_border_load_tiles_and_pal + ldrb r0, [r6, 0x2] + movs r1, 0 + adds r2, r4, 0 + movs r3, 0xD + bl SetWindowBorderStyle + b _080224BA + .pool +_080222D0: + ldr r0, =gText_BerryCrush2 + mov r10, r0 + movs r1, 0x1 + negs r1, r1 + mov r8, r1 + movs r0, 0x1 + mov r1, r10 + mov r2, r8 + bl GetStringWidth + lsrs r0, 1 + movs r4, 0x60 + subs r0, r4, r0 + lsls r0, 24 + lsrs r7, r0, 24 + ldrb r0, [r6, 0x2] + ldr r5, =gUnknown_082F32E1 + str r5, [sp] + mov r1, r9 + str r1, [sp, 0x4] + mov r1, r10 + str r1, [sp, 0x8] + movs r1, 0x1 + adds r2, r7, 0 + movs r3, 0x1 + bl box_print + ldr r0, =gText_PressingSpeedRankings + mov r10, r0 + movs r0, 0x1 + mov r1, r10 + mov r2, r8 + bl GetStringWidth + lsrs r0, 1 + subs r4, r0 + lsls r4, 24 + lsrs r7, r4, 24 + ldrb r0, [r6, 0x2] + str r5, [sp] + mov r1, r9 + str r1, [sp, 0x4] + mov r1, r10 + str r1, [sp, 0x8] + movs r1, 0x1 + adds r2, r7, 0 + movs r3, 0x11 + bl box_print + movs r0, 0x29 + mov r10, r0 +_08022336: + mov r1, r9 + adds r1, 0x2 + ldr r0, =gStringVar1 + movs r2, 0 + movs r3, 0x1 + bl ConvertIntToDecimalStringN + ldr r0, =gStringVar4 + ldr r1, =gText_Var1Players + bl StringExpandPlaceholders + ldrb r0, [r6, 0x2] + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + movs r1, 0 + str r1, [sp, 0x4] + ldr r1, =gStringVar4 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r2, 0 + mov r3, r10 + bl box_print + movs r0, 0x1 + ldr r1, =gText_TimesPerSec + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + movs r1, 0xC0 + subs r1, r0 + lsls r1, 24 + lsrs r7, r1, 24 + ldrb r0, [r6, 0x2] + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + movs r1, 0 + str r1, [sp, 0x4] + ldr r1, =gText_TimesPerSec + str r1, [sp, 0x8] + movs r1, 0x1 + adds r2, r7, 0 + mov r3, r10 + bl box_print + movs r2, 0 + mov r0, r9 + lsls r4, r0, 1 + mov r1, r10 + adds r1, 0x10 + str r1, [sp, 0x10] + movs r0, 0x1 + add r9, r0 + adds r0, r4, r6 + ldrb r3, [r0, 0x4] + movs r1, 0x7 + mov r12, r1 + movs r0, 0x1 + mov r8, r0 + ldr r5, =gUnknown_082F334C +_080223AE: + mov r0, r12 + subs r1, r0, r2 + adds r0, r3, 0 + asrs r0, r1 + mov r1, r8 + ands r0, r1 + cmp r0, 0 + beq _080223CA + lsls r0, r2, 2 + adds r0, r5 + ldr r0, [r0] + ldr r1, [sp, 0xC] + adds r1, r0 + str r1, [sp, 0xC] +_080223CA: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x7 + bls _080223AE + adds r0, r4, r6 + ldrh r1, [r0, 0x4] + lsrs r1, 8 + ldr r0, =gStringVar1 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldr r0, [sp, 0xC] + ldr r1, =0x000f4240 + bl __udivsi3 + adds r1, r0, 0 + ldr r0, =gStringVar2 + movs r2, 0x2 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r0, =gStringVar4 + ldr r1, =gText_XDotY3 + bl StringExpandPlaceholders + movs r0, 0x1 + ldr r1, =gStringVar4 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + subs r0, r7, r0 + lsls r0, 24 + lsrs r7, r0, 24 + ldrb r0, [r6, 0x2] + ldr r1, =gUnknown_082F32D8 + str r1, [sp] + movs r1, 0 + str r1, [sp, 0x4] + ldr r1, =gStringVar4 + str r1, [sp, 0x8] + movs r1, 0x1 + adds r2, r7, 0 + mov r3, r10 + bl box_print + ldr r1, [sp, 0x10] + lsls r0, r1, 24 + lsrs r0, 24 + mov r10, r0 + movs r0, 0 + str r0, [sp, 0xC] + mov r1, r9 + lsls r0, r1, 24 + lsrs r0, 24 + mov r9, r0 + cmp r0, 0x3 + bhi _08022444 + b _08022336 +_08022444: + ldrb r0, [r6, 0x2] + movs r1, 0x3 + bl CopyWindowToVram + b _080224BA + .pool +_08022480: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + bne _080224BA + b _080224C0 + .pool +_08022494: + ldrb r0, [r6, 0x2] + movs r1, 0x1 + bl sub_8198070 + ldrb r0, [r6, 0x2] + bl ClearWindowTilemap + ldrb r0, [r6, 0x2] + bl RemoveWindow + adds r0, r4, 0 + bl DestroyTask + bl EnableBothScriptContexts + bl ScriptContext2_Disable + mov r0, r9 + b _080224BE +_080224BA: + ldrh r0, [r6] + adds r0, 0x1 +_080224BE: + strh r0, [r6] +_080224C0: + add sp, 0x14 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8022250 + + thumb_func_start sub_80224D0 +sub_80224D0: @ 80224D0 + push {lr} + bl ScriptContext2_Enable + ldr r0, =sub_8022250 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + ldr r0, =gSaveBlock2Ptr + ldr r2, [r0] + movs r3, 0xF6 + lsls r3, 1 + adds r0, r2, r3 + ldrh r0, [r0] + strh r0, [r1, 0xC] + adds r3, 0x2 + adds r0, r2, r3 + ldrh r0, [r0] + strh r0, [r1, 0xE] + adds r3, 0x2 + adds r0, r2, r3 + ldrh r0, [r0] + strh r0, [r1, 0x10] + adds r3, 0x2 + adds r0, r2, r3 + ldrh r0, [r0] + strh r0, [r1, 0x12] + pop {r0} + bx r0 + .pool + thumb_func_end sub_80224D0 + + thumb_func_start sub_8022524 +sub_8022524: @ 8022524 + push {r4,lr} + adds r4, r0, 0 + lsls r1, 16 + lsrs r1, 16 + bl sub_8021944 + movs r0, 0x4 + ldrsh r1, [r4, r0] + movs r0, 0 + bl sub_8035044 + movs r0, 0x6 + ldrsh r1, [r4, r0] + movs r0, 0x1 + bl sub_8035044 + movs r0, 0x8 + ldrsh r1, [r4, r0] + movs r0, 0x2 + bl sub_8035044 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8022524 + + thumb_func_start sub_8022554 +sub_8022554: @ 8022554 + push {lr} + ldr r2, [r0, 0x78] + adds r2, 0x3E + ldrb r1, [r2] + movs r3, 0x4 + orrs r1, r3 + strb r1, [r2] + ldr r1, [r0, 0x7C] + adds r1, 0x3E + ldrb r0, [r1] + orrs r0, r3 + strb r0, [r1] + movs r0, 0x2 + movs r1, 0x1 + bl sub_803547C + movs r0, 0x1 + movs r1, 0x1 + bl sub_803547C + movs r0, 0 + movs r1, 0x1 + bl sub_803547C + pop {r0} + bx r0 + thumb_func_end sub_8022554 + + thumb_func_start sub_8022588 +sub_8022588: @ 8022588 + push {r4-r7,lr} + adds r5, r0, 0 + movs r6, 0 + ldrb r0, [r5, 0x9] + cmp r6, r0 + bcs _080225E8 + ldr r7, =gUnknown_082F417C +_08022596: + lsls r0, r6, 2 + movs r1, 0xA2 + lsls r1, 1 + adds r2, r5, r1 + adds r2, r0 + ldrb r1, [r5, 0x9] + subs r1, 0x2 + lsls r0, r1, 2 + adds r0, r1 + adds r0, r6, r0 + adds r0, r7 + ldrb r1, [r0] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + ldr r1, =gUnknown_082F4190 + adds r0, r1 + str r0, [r2] + ldrb r0, [r0] + lsls r0, 3 + ldr r1, =gUnknown_082F32F4 + adds r0, r1 + bl AddWindow + ldr r1, =0x000001bb + adds r4, r5, r1 + adds r4, r6 + strb r0, [r4] + ldrb r0, [r4] + bl PutWindowTilemap + ldrb r0, [r4] + movs r1, 0 + bl FillWindowPixelBuffer + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + ldrb r0, [r5, 0x9] + cmp r6, r0 + bcc _08022596 +_080225E8: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8022588 + + thumb_func_start sub_8022600 +sub_8022600: @ 8022600 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x14 + adds r6, r0, 0 + movs r7, 0 + ldrb r0, [r6, 0x9] + cmp r7, r0 + bcs _080226B6 + movs r1, 0 + mov r8, r1 +_08022616: + ldr r1, =0x000001bb + adds r0, r6, r1 + adds r5, r0, r7 + ldrb r0, [r5] + bl PutWindowTilemap + ldrb r0, [r6, 0x8] + cmp r7, r0 + bne _08022668 + lsls r4, r7, 5 + adds r4, 0x98 + adds r4, r6, r4 + movs r0, 0x2 + adds r1, r4, 0 + movs r2, 0 + bl GetStringWidth + lsrs r0, 1 + movs r2, 0x24 + subs r2, r0 + lsls r2, 24 + lsrs r2, 24 + ldrb r0, [r5] + mov r1, r8 + str r1, [sp] + str r1, [sp, 0x4] + ldr r1, =gUnknown_082F32DB + str r1, [sp, 0x8] + mov r1, r8 + str r1, [sp, 0xC] + str r4, [sp, 0x10] + movs r1, 0x2 + movs r3, 0x1 + bl AddTextPrinterParametrized2 + b _0802269C + .pool +_08022668: + lsls r4, r7, 5 + adds r4, 0x98 + adds r4, r6, r4 + movs r0, 0x2 + adds r1, r4, 0 + movs r2, 0 + bl GetStringWidth + lsrs r0, 1 + movs r2, 0x24 + subs r2, r0 + lsls r2, 24 + lsrs r2, 24 + ldrb r0, [r5] + mov r1, r8 + str r1, [sp] + str r1, [sp, 0x4] + ldr r1, =gUnknown_082F32DE + str r1, [sp, 0x8] + mov r1, r8 + str r1, [sp, 0xC] + str r4, [sp, 0x10] + movs r1, 0x2 + movs r3, 0x1 + bl AddTextPrinterParametrized2 +_0802269C: + ldr r1, =0x000001bb + adds r0, r6, r1 + adds r0, r7 + ldrb r0, [r0] + movs r1, 0x3 + bl CopyWindowToVram + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldrb r0, [r6, 0x9] + cmp r7, r0 + bcc _08022616 +_080226B6: + movs r0, 0 + bl CopyBgTilemapBufferToVram + add sp, 0x14 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8022600 + + thumb_func_start sub_80226D0 +sub_80226D0: @ 80226D0 + push {r4-r6,lr} + sub sp, 0x8 + adds r6, r0, 0 + movs r5, 0 + ldr r0, =gUnknown_08DE3FD4 + ldr r4, =0x0201c000 + adds r1, r4, 0 + bl LZ77UnCompWram + b _0802271A + .pool +_080226EC: + lsls r1, r5, 2 + movs r2, 0xA2 + lsls r2, 1 + adds r0, r6, r2 + adds r0, r1 + ldr r3, [r0] + ldrb r0, [r3] + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r4, r1 + ldrb r2, [r3, 0x1] + ldrb r3, [r3, 0x2] + movs r0, 0xA + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x3 + bl CopyToBgTilemapBufferRect + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_0802271A: + ldrb r0, [r6, 0x9] + cmp r5, r0 + bcc _080226EC + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_80226D0 + + thumb_func_start sub_8022730 +sub_8022730: @ 8022730 + push {r4-r7,lr} + adds r6, r0, 0 + movs r5, 0 + ldr r0, =0x0000ff98 + strh r0, [r6, 0x2A] + strh r5, [r6, 0x2C] + ldr r1, =gSpriteCoordOffsetX + strh r5, [r1] + ldr r1, =gSpriteCoordOffsetY + strh r0, [r1] + ldr r4, =gUnknown_082F41F4 +_08022746: + lsls r0, r5, 3 + adds r0, r4 + bl LoadCompressedObjectPic + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x3 + bls _08022746 + ldr r0, =gUnknown_082F421C + bl LoadSpritePalettes + ldr r0, =gUnknown_082F430C + movs r1, 0x78 + movs r2, 0x58 + movs r3, 0x5 + bl CreateSprite + lsls r0, 24 + lsrs r2, r0, 24 + movs r0, 0xAC + lsls r0, 1 + adds r3, r6, r0 + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + str r0, [r3] + ldrb r1, [r0, 0x5] + movs r2, 0xC + orrs r1, r2 + strb r1, [r0, 0x5] + ldr r1, [r3] + adds r1, 0x3E + ldrb r0, [r1] + movs r2, 0x2 + orrs r0, r2 + strb r0, [r1] + ldr r1, [r3] + adds r1, 0x2C + ldrb r0, [r1] + movs r2, 0x40 + orrs r0, r2 + strb r0, [r1] + movs r5, 0 + ldrb r1, [r6, 0x9] + cmp r5, r1 + bcs _08022822 + movs r7, 0x4 +_080227AA: + lsls r4, r5, 2 + movs r3, 0xA2 + lsls r3, 1 + adds r0, r6, r3 + adds r0, r4 + ldr r0, [r0] + ldrh r1, [r0, 0x4] + adds r1, 0x78 + lsls r1, 16 + asrs r1, 16 + ldrh r2, [r0, 0x6] + adds r2, 0x20 + lsls r2, 16 + asrs r2, 16 + ldr r0, =gUnknown_082F4324 + movs r3, 0 + bl CreateSprite + lsls r0, 24 + lsrs r2, r0, 24 + movs r0, 0xAE + lsls r0, 1 + adds r3, r6, r0 + adds r3, r4 + lsls r1, r2, 4 + adds r1, r2 + lsls r1, 2 + ldr r0, =gSprites + adds r1, r0 + str r1, [r3] + ldrb r0, [r1, 0x5] + movs r4, 0xD + negs r4, r4 + adds r2, r4, 0 + ands r0, r2 + orrs r0, r7 + strb r0, [r1, 0x5] + ldr r1, [r3] + adds r1, 0x3E + ldrb r0, [r1] + orrs r0, r7 + strb r0, [r1] + ldr r2, [r3] + adds r2, 0x3E + ldrb r0, [r2] + movs r1, 0x2 + orrs r0, r1 + strb r0, [r2] + ldr r2, [r3] + adds r2, 0x2C + ldrb r0, [r2] + movs r1, 0x40 + orrs r0, r1 + strb r0, [r2] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + ldrb r0, [r6, 0x9] + cmp r5, r0 + bcc _080227AA +_08022822: + movs r5, 0 + ldr r4, =gUnknown_082F41CC+6 + adds r7, r4, 0x1 +_08022828: + lsls r2, r5, 1 + adds r0, r2, r4 + movs r1, 0 + ldrsb r1, [r0, r1] + adds r1, 0x78 + adds r2, r7 + ldrb r2, [r2] + lsls r2, 24 + asrs r2, 24 + adds r2, 0x88 + ldr r0, =gUnknown_082F433C + movs r3, 0x6 + bl CreateSprite + lsls r0, 24 + lsrs r2, r0, 24 + lsls r0, r5, 2 + movs r1, 0xC2 + lsls r1, 1 + adds r3, r6, r1 + adds r3, r0 + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + str r0, [r3] + ldrb r1, [r0, 0x5] + movs r2, 0xC + orrs r1, r2 + strb r1, [r0, 0x5] + ldr r2, [r3] + adds r2, 0x3E + ldrb r0, [r2] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r2] + ldr r2, [r3] + adds r2, 0x2C + ldrb r0, [r2] + movs r1, 0x40 + orrs r0, r1 + strb r0, [r2] + ldr r0, [r3] + strh r5, [r0, 0x2E] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0xA + bls _08022828 + movs r5, 0 +_0802288E: + lsls r1, r5, 1 + adds r1, r5 + lsls r1, 19 + movs r3, 0xB0 + lsls r3, 16 + adds r1, r3 + asrs r1, 16 + ldr r0, =gUnknown_082F4354 + movs r2, 0x8 + movs r3, 0 + bl CreateSprite + lsls r0, 24 + lsrs r2, r0, 24 + lsls r0, r5, 2 + movs r4, 0xD8 + lsls r4, 1 + adds r3, r6, r4 + adds r3, r0 + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + str r0, [r3] + ldrb r1, [r0, 0x5] + movs r4, 0xD + negs r4, r4 + adds r2, r4, 0 + ands r1, r2 + strb r1, [r0, 0x5] + ldr r2, [r3] + adds r2, 0x3E + ldrb r0, [r2] + adds r4, 0x8 + adds r1, r4, 0 + ands r0, r1 + strb r0, [r2] + ldr r2, [r3] + adds r2, 0x2C + ldrb r0, [r2] + movs r3, 0x41 + negs r3, r3 + adds r1, r3, 0 + ands r0, r1 + strb r0, [r2] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x1 + bls _0802288E + ldr r4, =gUnknown_082F4384 + movs r0, 0 + movs r1, 0 + adds r2, r4, 0 + bl sub_8034D14 + adds r2, r4, 0 + adds r2, 0x10 + movs r0, 0x1 + movs r1, 0 + bl sub_8034D14 + adds r4, 0x20 + movs r0, 0x2 + movs r1, 0 + adds r2, r4, 0 + bl sub_8034D14 + ldrh r0, [r6, 0x12] + cmp r0, 0x1 + bne _08022928 + movs r4, 0x9C + lsls r4, 1 + adds r0, r6, r4 + bl sub_8022554 +_08022928: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8022730 + + thumb_func_start sub_8022960 +sub_8022960: @ 8022960 + push {r4-r6,lr} + adds r5, r0, 0 + movs r4, 0 + movs r0, 0x4 + bl FreeSpriteTilesByTag + movs r0, 0x3 + bl FreeSpriteTilesByTag + movs r0, 0x2 + bl FreeSpriteTilesByTag + movs r0, 0x1 + bl FreeSpriteTilesByTag + movs r0, 0x4 + bl FreeSpritePaletteByTag + movs r0, 0x2 + bl FreeSpritePaletteByTag + movs r0, 0x1 + bl FreeSpritePaletteByTag + movs r0, 0xD8 + lsls r0, 1 + adds r6, r5, r0 +_08022996: + lsls r0, r4, 2 + adds r0, r6, r0 + ldr r0, [r0] + bl DestroySprite + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x1 + bls _08022996 + movs r0, 0x2 + bl sub_80353DC + movs r0, 0x1 + bl sub_80353DC + movs r0, 0 + bl sub_80353DC + movs r4, 0 + movs r1, 0xC2 + lsls r1, 1 + adds r6, r5, r1 +_080229C4: + lsls r0, r4, 2 + adds r0, r6, r0 + ldr r0, [r0] + bl DestroySprite + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0xA + bls _080229C4 + movs r4, 0 + ldrb r2, [r5, 0x9] + cmp r4, r2 + bcs _080229FC +_080229E0: + lsls r1, r4, 2 + movs r2, 0xAE + lsls r2, 1 + adds r0, r5, r2 + adds r0, r1 + ldr r0, [r0] + bl DestroySprite + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + ldrb r0, [r5, 0x9] + cmp r4, r0 + bcc _080229E0 +_080229FC: + movs r1, 0xAC + lsls r1, 1 + adds r0, r5, r1 + ldr r2, [r0] + adds r0, r2, 0 + adds r0, 0x3E + ldrb r1, [r0] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08022A18 + adds r0, r2, 0 + bl DestroySprite +_08022A18: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8022960 + + thumb_func_start sub_8022A20 +sub_8022A20: @ 8022A20 + push {lr} + adds r3, r0, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _08022A46 + adds r2, r3, 0 + adds r2, 0x3E + ldrb r0, [r2] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r2] + subs r2, 0x12 + ldrb r0, [r2] + movs r1, 0x40 + orrs r0, r1 + strb r0, [r2] +_08022A46: + pop {r0} + bx r0 + thumb_func_end sub_8022A20 + + thumb_func_start sub_8022A4C +sub_8022A4C: @ 8022A4C + push {r4,r5,lr} + adds r3, r0, 0 + movs r1, 0 + ldr r5, =SpriteCallbackDummy + adds r2, r3, 0 + adds r2, 0x2E + movs r4, 0 +_08022A5A: + lsls r0, r1, 1 + adds r0, r2, r0 + strh r4, [r0] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x7 + bls _08022A5A + movs r0, 0 + strh r0, [r3, 0x24] + strh r0, [r3, 0x26] + adds r2, r3, 0 + adds r2, 0x3E + ldrb r0, [r2] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r2] + subs r2, 0x12 + ldrb r0, [r2] + movs r1, 0x40 + orrs r0, r1 + strb r0, [r2] + str r5, [r3, 0x1C] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8022A4C + + thumb_func_start sub_8022A94 +sub_8022A94: @ 8022A94 + push {r4-r6,lr} + adds r5, r0, 0 + adds r4, r5, 0 + adds r4, 0x2E + ldrh r0, [r4, 0x4] + ldrh r1, [r4, 0x2] + adds r0, r1 + strh r0, [r4, 0x2] + lsls r0, 16 + asrs r0, 24 + ldrh r2, [r5, 0x26] + adds r0, r2 + strh r0, [r5, 0x26] + movs r1, 0xE + ldrsh r0, [r4, r1] + movs r6, 0x80 + lsls r6, 8 + ands r0, r6 + cmp r0, 0 + beq _08022AFA + ldrh r0, [r4, 0x6] + ldrh r2, [r5, 0x2E] + adds r0, r2 + strh r0, [r5, 0x2E] + ldrh r0, [r4, 0xA] + ldrh r1, [r4, 0x8] + adds r0, r1 + strh r0, [r4, 0x8] + lsls r0, 16 + asrs r0, 23 + movs r2, 0xC + ldrsh r1, [r4, r2] + bl Sin + strh r0, [r5, 0x24] + movs r1, 0xE + ldrsh r0, [r4, r1] + ands r0, r6 + cmp r0, 0 + beq _08022AFA + ldrh r0, [r4, 0x8] + lsls r0, 16 + asrs r0, 23 + cmp r0, 0x7E + ble _08022AFA + movs r0, 0 + strh r0, [r5, 0x24] + ldrh r1, [r4, 0xE] + ldr r0, =0x00007fff + ands r0, r1 + strh r0, [r4, 0xE] +_08022AFA: + ldrh r0, [r4] + lsls r0, 16 + asrs r0, 23 + strh r0, [r5, 0x20] + movs r2, 0x22 + ldrsh r1, [r5, r2] + movs r2, 0x26 + ldrsh r0, [r5, r2] + adds r1, r0 + ldrh r2, [r4, 0xE] + ldr r0, =0x00007fff + ands r0, r2 + cmp r1, r0 + ble _08022B1A + ldr r0, =sub_8022A4C + str r0, [r5, 0x1C] +_08022B1A: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8022A94 + + thumb_func_start sub_8022B28 +sub_8022B28: @ 8022B28 + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r6, r0, 0 + adds r7, r6, 0 + adds r7, 0x2E + movs r0, 0 + mov r8, r0 + movs r2, 0xA0 + lsls r2, 2 + strh r2, [r7, 0x2] + movs r0, 0x20 + strh r0, [r7, 0x4] + movs r1, 0xA8 + strh r1, [r7, 0xE] + movs r0, 0x24 + ldrsh r4, [r6, r0] + lsls r4, 23 + lsrs r4, 16 + ldrh r0, [r6, 0x22] + subs r1, r0 + lsls r1, 23 + asrs r1, 16 + adds r2, 0x20 + asrs r2, 1 + movs r0, 0x7 + bl sub_81515D4 + adds r5, r0, 0 + ldrh r0, [r6, 0x20] + lsls r0, 7 + strh r0, [r6, 0x2E] + lsls r4, 16 + asrs r4, 16 + lsls r5, 16 + asrs r5, 16 + movs r0, 0x7 + adds r1, r4, 0 + adds r2, r5, 0 + bl sub_81515D4 + strh r0, [r7, 0x6] + movs r0, 0x7 + adds r1, r5, 0 + movs r2, 0x55 + bl sub_8151550 + adds r2, r0, 0 + mov r1, r8 + strh r1, [r7, 0x8] + movs r1, 0xFE + lsls r1, 6 + lsls r2, 16 + asrs r2, 16 + movs r0, 0x7 + bl sub_81515D4 + strh r0, [r7, 0xA] + movs r2, 0x24 + ldrsh r0, [r6, r2] + cmp r0, 0 + bge _08022BA6 + adds r0, 0x3 +_08022BA6: + asrs r0, 2 + strh r0, [r7, 0xC] + ldrh r0, [r7, 0xE] + ldr r2, =0xffff8000 + adds r1, r2, 0 + orrs r0, r1 + strh r0, [r7, 0xE] + mov r0, r8 + strh r0, [r6, 0x26] + strh r0, [r6, 0x24] + ldr r0, =sub_8022A94 + str r0, [r6, 0x1C] + adds r2, r6, 0 + adds r2, 0x2C + ldrb r1, [r2] + movs r0, 0x41 + negs r0, r0 + ands r0, r1 + strb r0, [r2] + adds r2, 0x12 + ldrb r1, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2] + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8022B28 + + thumb_func_start sub_8022BEC +sub_8022BEC: @ 8022BEC + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r7, r2, 0 + lsls r0, 16 + lsrs r5, r0, 16 + lsls r1, 24 + lsrs r4, r1, 24 + mov r8, r4 + bl sub_8020C00 + adds r6, r0, 0 + cmp r5, 0x19 + bls _08022C0A + movs r5, 0 +_08022C0A: + cmp r4, 0 + beq _08022C14 + cmp r4, 0x1 + beq _08022C40 + b _08022C4A +_08022C14: + cmp r5, 0 + beq _08022C28 + ldr r0, =gUnknown_082F43CC + lsls r1, r5, 2 + adds r1, r0 + ldr r2, [r1] + adds r0, r6, 0 + adds r1, r7, 0 + bl _call_via_r2 +_08022C28: + ldrb r0, [r6, 0xE] + cmp r0, 0x19 + bls _08022C32 + mov r0, r8 + strb r0, [r6, 0xE] +_08022C32: + ldr r0, =gUnknown_082F43CC + ldrb r1, [r6, 0xE] + lsls r1, 2 + b _08022C44 + .pool +_08022C40: + ldr r0, =gUnknown_082F43CC + lsls r1, r5, 2 +_08022C44: + adds r1, r0 + ldr r0, [r1] + str r0, [r6, 0x4] +_08022C4A: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8022BEC + + thumb_func_start sub_8022C58 +sub_8022C58: @ 8022C58 + push {r4-r6,lr} + sub sp, 0x4 + adds r6, r0, 0 + ldrb r2, [r1] + ldrb r3, [r1, 0x1] + lsls r3, 8 + orrs r2, r3 + ldrb r3, [r1, 0x2] + lsls r3, 16 + orrs r2, r3 + ldrb r3, [r1, 0x3] + lsls r3, 24 + adds r0, r2, 0 + orrs r0, r3 + ldrb r2, [r1, 0x9] + strb r2, [r1] + ldrb r4, [r1, 0x8] + lsls r4, 8 + ldrb r2, [r1, 0x7] + orrs r4, r2 + ldr r5, =gPaletteFade + ldrb r3, [r5, 0x8] + movs r2, 0x7F + ands r2, r3 + strb r2, [r5, 0x8] + movs r5, 0x4 + ldrsb r5, [r1, r5] + ldrb r2, [r1, 0x5] + ldrb r3, [r1, 0x6] + str r4, [sp] + adds r1, r5, 0 + bl BeginNormalPaletteFade + bl UpdatePaletteFade + movs r0, 0x2 + strb r0, [r6, 0xE] + movs r0, 0 + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8022C58 + + thumb_func_start sub_8022CB0 +sub_8022CB0: @ 8022CB0 + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + ldrb r0, [r4, 0xC] + cmp r0, 0x1 + beq _08022CE4 + cmp r0, 0x1 + bgt _08022CC6 + cmp r0, 0 + beq _08022CD0 + b _08022D06 +_08022CC6: + cmp r0, 0x2 + beq _08022CEA + cmp r0, 0x3 + beq _08022CF6 + b _08022D06 +_08022CD0: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + bne _08022D0C + ldrb r0, [r5] + cmp r0, 0 + bne _08022D06 + movs r0, 0x3 + b _08022D0A +_08022CE4: + bl sub_8010434 + b _08022D06 +_08022CEA: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + bne _08022D06 + b _08022D0C +_08022CF6: + ldrb r0, [r4, 0xF] + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r0, 0 + strb r0, [r4, 0xC] + b _08022D0E +_08022D06: + ldrb r0, [r4, 0xC] + adds r0, 0x1 +_08022D0A: + strb r0, [r4, 0xC] +_08022D0C: + movs r0, 0 +_08022D0E: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8022CB0 + + thumb_func_start sub_8022D14 +sub_8022D14: @ 8022D14 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x10 + adds r7, r0, 0 + adds r5, r1, 0 + ldrb r4, [r5, 0x3] + lsls r4, 8 + ldrb r0, [r5, 0x2] + orrs r4, r0 + ldrb r6, [r7, 0xC] + cmp r6, 0x1 + beq _08022DC0 + cmp r6, 0x1 + bgt _08022D38 + cmp r6, 0 + beq _08022D42 + b _08022E08 +_08022D38: + cmp r6, 0x2 + beq _08022DD8 + cmp r6, 0x3 + beq _08022DE8 + b _08022E08 +_08022D42: + movs r0, 0 + movs r1, 0 + bl sub_81973C4 + ldrb r1, [r5, 0x1] + movs r0, 0x2 + mov r8, r0 + ands r0, r1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _08022D90 + ldr r4, =gStringVar4 + ldr r1, =gUnknown_082F32A4 + ldrb r0, [r5] + lsls r0, 2 + adds r0, r1 + ldr r1, [r0] + adds r0, r4, 0 + bl StringExpandPlaceholders + ldrb r3, [r7, 0xB] + str r6, [sp] + mov r0, r8 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + adds r2, r4, 0 + bl AddTextPrinterParametrized + b _08022DB2 + .pool +_08022D90: + ldr r1, =gUnknown_082F32A4 + ldrb r0, [r5] + lsls r0, 2 + adds r0, r1 + ldr r2, [r0] + ldrb r3, [r7, 0xB] + str r4, [sp] + mov r0, r8 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + bl AddTextPrinterParametrized +_08022DB2: + movs r0, 0 + movs r1, 0x3 + bl CopyWindowToVram + b _08022E08 + .pool +_08022DC0: + movs r0, 0 + bl IsTextPrinterActive + lsls r0, 16 + cmp r0, 0 + bne _08022E0E + cmp r4, 0 + bne _08022E08 + ldrb r0, [r7, 0xC] + adds r0, 0x1 + strb r0, [r7, 0xC] + b _08022E08 +_08022DD8: + ldr r0, =gMain + ldrh r0, [r0, 0x2E] + ands r4, r0 + cmp r4, 0 + bne _08022E08 + b _08022E0E + .pool +_08022DE8: + ldrb r1, [r5, 0x1] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08022DFA + movs r0, 0 + movs r1, 0x1 + bl sub_8197434 +_08022DFA: + ldrb r0, [r7, 0xE] + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + ldrb r0, [r5, 0x4] + b _08022E0C +_08022E08: + ldrb r0, [r7, 0xC] + adds r0, 0x1 +_08022E0C: + strb r0, [r7, 0xC] +_08022E0E: + movs r0, 0 + add sp, 0x10 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8022D14 + + thumb_func_start sub_8022E1C +sub_8022E1C: @ 8022E1C + push {r4,lr} + adds r4, r0, 0 + bl sub_802104C + cmp r0, 0 + beq _08022E34 + ldrb r0, [r4, 0xE] + adds r2, r4, 0 + adds r2, 0x36 + movs r1, 0 + bl sub_8022BEC +_08022E34: + movs r0, 0 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8022E1C + + thumb_func_start sub_8022E3C +sub_8022E3C: @ 8022E3C + push {r4,lr} + adds r4, r0, 0 + bl sub_802130C + cmp r0, 0 + beq _08022E54 + ldrb r0, [r4, 0xE] + adds r2, r4, 0 + adds r2, 0x36 + movs r1, 0 + bl sub_8022BEC +_08022E54: + movs r0, 0 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8022E3C + + thumb_func_start sub_8022E5C +sub_8022E5C: @ 8022E5C + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4, 0xC] + cmp r0, 0 + beq _08022E6C + cmp r0, 0x1 + beq _08022E72 + b _08022E9C +_08022E6C: + bl sub_8010434 + b _08022E9C +_08022E72: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08022EA2 + ldr r0, =0x000001e5 + bl PlayNewMapMusic + movs r0, 0x7 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r1, 0 + movs r0, 0x3 + strh r0, [r4, 0x12] + strb r1, [r4, 0xC] + b _08022EA2 + .pool +_08022E9C: + ldrb r0, [r4, 0xC] + adds r0, 0x1 + strb r0, [r4, 0xC] +_08022EA2: + movs r0, 0 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8022E5C + + thumb_func_start sub_8022EAC +sub_8022EAC: @ 8022EAC + push {r4,r5,lr} + sub sp, 0x4 + adds r4, r0, 0 + adds r5, r1, 0 + ldrb r0, [r4, 0xC] + cmp r0, 0 + beq _08022EC2 + cmp r0, 0x1 + beq _08022EE8 + adds r0, 0x1 + b _08022EF8 +_08022EC2: + adds r0, r4, 0 + bl sub_8024578 + movs r0, 0x1 + str r0, [sp] + adds r0, r5, 0 + movs r1, 0 + movs r2, 0x1 + movs r3, 0 + bl sub_8024644 + movs r0, 0x7 + strb r0, [r4, 0xE] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + b _08022EFA +_08022EE8: + movs r0, 0x8 + strb r0, [r4, 0xE] + movs r0, 0x5 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r0, 0x2 +_08022EF8: + strb r0, [r4, 0xC] +_08022EFA: + movs r0, 0 + add sp, 0x4 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8022EAC + + thumb_func_start sub_8022F04 +sub_8022F04: @ 8022F04 + push {lr} + movs r1, 0 + str r1, [r0, 0x4] + ldr r0, =sub_8020E1C + bl SetMainCallback2 + movs r0, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8022F04 + + thumb_func_start sub_8022F1C +sub_8022F1C: @ 8022F1C + push {r4-r7,lr} + sub sp, 0x4 + adds r5, r0, 0 + adds r2, r1, 0 + ldrb r0, [r5, 0xC] + cmp r0, 0x5 + bls _08022F2C + b _08023060 +_08022F2C: + lsls r0, 2 + ldr r1, =_08022F3C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08022F3C: + .4byte _08022F54 + .4byte _08022F74 + .4byte _08022F7A + .4byte _08022FAA + .4byte _08022FBA + .4byte _08023044 +_08022F54: + movs r0, 0x1 + str r0, [sp] + adds r0, r2, 0 + movs r1, 0x1 + movs r2, 0 + movs r3, 0 + bl sub_8024644 + movs r0, 0x9 + strb r0, [r5, 0xE] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + b _08023066 +_08022F74: + bl sub_8010434 + b _08023060 +_08022F7A: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08023066 + adds r4, r5, 0 + adds r4, 0x42 + adds r0, r4, 0 + movs r1, 0 + movs r2, 0xC + bl memset + ldrb r0, [r5, 0x8] + lsls r0, 5 + adds r0, r5, r0 + adds r0, 0xA4 + ldrh r0, [r0] + strh r0, [r4] + movs r0, 0 + adds r1, r4, 0 + movs r2, 0x2 + bl SendBlock + b _08023060 +_08022FAA: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08023066 + movs r0, 0 + strh r0, [r5, 0x10] + b _08023060 +_08022FBA: + bl GetBlockReceivedStatus + ldr r2, =gUnknown_082F4448 + ldrb r4, [r5, 0x9] + subs r1, r4, 0x2 + adds r1, r2 + lsls r0, 24 + lsrs r0, 24 + ldrb r1, [r1] + cmp r0, r1 + bne _08023066 + movs r3, 0 + cmp r3, r4 + bcs _0802301E + ldr r7, =gBlockRecvBuffer + movs r6, 0 + ldr r4, =gUnknown_0858AB24 +_08022FDC: + lsls r0, r3, 5 + adds r0, r5, r0 + lsls r1, r3, 8 + adds r1, r7 + ldrh r1, [r1] + adds r2, r0, 0 + adds r2, 0xA4 + strh r1, [r2] + lsls r1, 16 + lsrs r1, 16 + cmp r1, 0xB0 + bls _08022FF6 + strh r6, [r2] +_08022FF6: + ldrh r1, [r2] + lsls r1, 2 + adds r1, r4 + ldrh r0, [r5, 0x18] + ldrb r1, [r1] + adds r0, r1 + strh r0, [r5, 0x18] + ldrh r0, [r2] + lsls r0, 2 + adds r0, r4 + ldrh r1, [r0, 0x2] + ldr r0, [r5, 0x1C] + adds r0, r1 + str r0, [r5, 0x1C] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + ldrb r0, [r5, 0x9] + cmp r3, r0 + bcc _08022FDC +_0802301E: + movs r0, 0 + strh r0, [r5, 0x10] + bl ResetBlockReceivedFlags + movs r1, 0x18 + ldrsh r0, [r5, r1] + lsls r0, 8 + movs r1, 0x80 + lsls r1, 6 + bl sub_81515FC + str r0, [r5, 0x20] + b _08023060 + .pool +_08023044: + movs r0, 0 + movs r1, 0x1 + bl sub_8197434 + movs r0, 0xA + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r1, 0 + movs r0, 0x4 + strh r0, [r5, 0x12] + strb r1, [r5, 0xC] + b _08023066 +_08023060: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] +_08023066: + movs r0, 0 + add sp, 0x4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8022F1C + + thumb_func_start sub_8023070 +sub_8023070: @ 8023070 + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4, 0xC] + cmp r0, 0x6 + bls _0802307C + b _080231A8 +_0802307C: + lsls r0, 2 + ldr r1, =_0802308C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802308C: + .4byte _080230A8 + .4byte _080230BA + .4byte _080230E8 + .4byte _08023120 + .4byte _08023150 + .4byte _08023172 + .4byte _08023184 +_080230A8: + movs r0, 0x9C + lsls r0, 1 + adds r1, r4, r0 + adds r0, r4, 0 + bl sub_80214A8 + bl sub_8010434 + b _080231A8 +_080230BA: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080231AE + movs r2, 0x9C + lsls r2, 1 + adds r1, r4, r2 + movs r0, 0 + strb r0, [r1] + ldr r3, =0x00000139 + adds r1, r4, r3 + strb r0, [r1] + adds r2, 0x2 + adds r1, r4, r2 + strb r0, [r1] + adds r3, 0x2 + adds r1, r4, r3 + strb r0, [r1] + b _080231A8 + .pool +_080230E8: + movs r0, 0x9C + lsls r0, 1 + adds r3, r4, r0 + ldrb r0, [r3] + lsls r0, 2 + movs r2, 0xB8 + lsls r2, 1 + adds r1, r4, r2 + adds r0, r1, r0 + ldr r2, [r0] + ldr r0, =sub_8021608 + str r0, [r2, 0x1C] + ldrb r0, [r3] + lsls r0, 2 + adds r1, r0 + ldr r1, [r1] + adds r1, 0x2C + ldrb r2, [r1] + movs r0, 0x7F + ands r0, r2 + strb r0, [r1] + movs r0, 0x3D + bl PlaySE + b _080231A8 + .pool +_08023120: + movs r3, 0x9C + lsls r3, 1 + adds r2, r4, r3 + ldrb r0, [r2] + lsls r0, 2 + adds r3, 0x38 + adds r1, r4, r3 + adds r3, r1, r0 + ldr r0, [r3] + ldr r1, [r0, 0x1C] + ldr r0, =sub_8021608 + cmp r1, r0 + beq _080231AE + movs r0, 0 + str r0, [r3] + ldrb r0, [r2] + adds r0, 0x1 + strb r0, [r2] + bl sub_8010434 + b _080231A8 + .pool +_08023150: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080231AE + movs r0, 0x9C + lsls r0, 1 + adds r1, r4, r0 + ldrb r0, [r1] + ldrb r2, [r4, 0x9] + cmp r0, r2 + bcs _0802316C + movs r0, 0x2 + b _080231AC +_0802316C: + movs r0, 0 + strb r0, [r1] + b _080231A8 +_08023172: + movs r3, 0x9C + lsls r3, 1 + adds r1, r4, r3 + adds r0, r4, 0 + bl sub_80216A8 + bl sub_8010434 + b _080231A8 +_08023184: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080231AE + movs r0, 0x2B + bl PlaySE + movs r0, 0xB + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r1, 0 + movs r0, 0x5 + strh r0, [r4, 0x12] + strb r1, [r4, 0xC] + b _080231AE +_080231A8: + ldrb r0, [r4, 0xC] + adds r0, 0x1 +_080231AC: + strb r0, [r4, 0xC] +_080231AE: + movs r0, 0 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8023070 + + thumb_func_start sub_80231B8 +sub_80231B8: @ 80231B8 + push {r4-r7,lr} + adds r4, r0, 0 + ldrb r1, [r4, 0xC] + cmp r1, 0x1 + beq _0802321C + cmp r1, 0x1 + bgt _080231CC + cmp r1, 0 + beq _080231D6 + b _080232DC +_080231CC: + cmp r1, 0x2 + beq _0802329C + cmp r1, 0x3 + beq _080232BE + b _080232DC +_080231D6: + ldrh r0, [r4, 0x2A] + adds r0, 0x4 + strh r0, [r4, 0x2A] + lsls r0, 16 + cmp r0, 0 + bge _080231E4 + b _080232E2 +_080231E4: + strh r1, [r4, 0x2A] + ldr r0, =0x00000139 + adds r3, r4, r0 + movs r0, 0x4 + strb r0, [r3] + movs r2, 0x9C + lsls r2, 1 + adds r1, r4, r2 + movs r0, 0 + strb r0, [r1] + ldr r2, =gUnknown_082F326C + ldrb r1, [r3] + lsls r0, r1, 3 + subs r0, r1 + adds r0, r2 + ldrb r0, [r0] + movs r2, 0x9D + lsls r2, 1 + adds r1, r4, r2 + strb r0, [r1] + movs r0, 0xD6 + bl PlaySE + b _080232DC + .pool +_0802321C: + ldr r7, =gUnknown_082F326C + movs r0, 0x9C + lsls r0, 1 + adds r6, r4, r0 + ldr r1, =0x00000139 + adds r5, r4, r1 + ldrb r1, [r5] + lsls r0, r1, 3 + subs r0, r1 + ldrb r2, [r6] + adds r0, r2 + adds r0, r7 + movs r1, 0 + ldrsb r1, [r0, r1] + strh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x12 + bl SetGpuReg + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1A + bl SetGpuReg + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1E + bl SetGpuReg + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] + movs r1, 0x9D + lsls r1, 1 + adds r2, r4, r1 + lsls r0, 24 + lsrs r0, 24 + ldrb r1, [r2] + cmp r0, r1 + bcc _080232E2 + ldrb r0, [r5] + cmp r0, 0 + beq _080232DC + subs r0, 0x1 + strb r0, [r5] + ldrb r1, [r5] + lsls r0, r1, 3 + subs r0, r1 + adds r0, r7 + ldrb r0, [r0] + strb r0, [r2] + movs r0, 0 + strb r0, [r6] + b _080232E2 + .pool +_0802329C: + movs r0, 0 + strh r0, [r4, 0x2C] + movs r0, 0x12 + movs r1, 0 + bl SetGpuReg + movs r0, 0x1A + movs r1, 0 + bl SetGpuReg + movs r0, 0x1E + movs r1, 0 + bl SetGpuReg + bl sub_8010434 + b _080232DC +_080232BE: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080232E2 + movs r0, 0xC + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r1, 0 + movs r0, 0x6 + strh r0, [r4, 0x12] + strb r1, [r4, 0xC] + b _080232E2 +_080232DC: + ldrb r0, [r4, 0xC] + adds r0, 0x1 + strb r0, [r4, 0xC] +_080232E2: + movs r0, 0 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80231B8 + + thumb_func_start sub_80232EC +sub_80232EC: @ 80232EC + push {r4,lr} + sub sp, 0x4 + adds r4, r0, 0 + ldrb r0, [r4, 0xC] + cmp r0, 0x1 + beq _0802330C + cmp r0, 0x1 + bgt _08023302 + cmp r0, 0 + beq _08023332 + b _0802338C +_08023302: + cmp r0, 0x2 + beq _0802332A + cmp r0, 0x3 + beq _08023338 + b _0802338C +_0802330C: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08023392 + movs r1, 0x80 + lsls r1, 5 + movs r0, 0 + str r0, [sp] + adds r0, r1, 0 + movs r2, 0x78 + movs r3, 0x50 + bl sub_802EB24 + b _0802338C +_0802332A: + bl sub_802EB84 + cmp r0, 0 + bne _08023392 +_08023332: + bl sub_8010434 + b _0802338C +_08023338: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08023392 + movs r0, 0x9C + lsls r0, 1 + adds r1, r4, r0 + movs r0, 0 + strb r0, [r1] + ldr r2, =0x00000139 + adds r1, r4, r2 + strb r0, [r1] + adds r2, 0x1 + adds r1, r4, r2 + strb r0, [r1] + adds r2, 0x1 + adds r1, r4, r2 + strb r0, [r1] + strh r0, [r4, 0x10] + ldrb r0, [r4, 0x8] + cmp r0, 0 + bne _08023378 + movs r0, 0xD + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + b _08023382 + .pool +_08023378: + movs r0, 0xE + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC +_08023382: + movs r1, 0 + movs r0, 0x7 + strh r0, [r4, 0x12] + strb r1, [r4, 0xC] + b _08023392 +_0802338C: + ldrb r0, [r4, 0xC] + adds r0, 0x1 + strb r0, [r4, 0xC] +_08023392: + movs r0, 0 + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_80232EC + + thumb_func_start sub_802339C +sub_802339C: @ 802339C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + adds r4, r0, 0 + movs r0, 0 + mov r8, r0 + movs r2, 0 + adds r7, r2, 0 + ldrb r1, [r4, 0x9] + cmp r7, r1 + bcs _080234AA + movs r2, 0x5E + adds r2, r4 + mov r9, r2 + ldr r3, =gUnknown_082F325C + mov r10, r3 +_080233C0: + lsls r0, r7, 4 + ldr r1, =gUnknown_03003090 + adds r2, r0, r1 + ldrh r1, [r2] + movs r0, 0xFF + lsls r0, 8 + ands r0, r1 + movs r3, 0xBC + lsls r3, 6 + cmp r0, r3 + bne _0802349E + ldrh r0, [r2, 0x2] + cmp r0, 0x2 + bne _0802349E + ldrb r1, [r2, 0x4] + movs r0, 0x4 + ands r0, r1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + beq _08023496 + mov r0, r9 + ldrb r2, [r0] + lsrs r1, r2, 3 + mov r3, r10 + adds r0, r7, r3 + ldrb r0, [r0] + orrs r1, r0 + lsls r1, 3 + movs r0, 0x7 + ands r0, r2 + orrs r0, r1 + mov r1, r9 + strb r0, [r1] + lsls r2, r7, 5 + adds r3, r4, r2 + mov r12, r3 + mov r1, r12 + adds r1, 0xB5 + movs r0, 0x1 + strb r0, [r1] + subs r1, 0x7 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + mov r0, r8 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + subs r1, 0x8 + ldrh r0, [r4, 0x28] + ldrh r1, [r1] + subs r0, r1 + lsls r0, 16 + lsrs r3, r0, 16 + mov r5, r12 + adds r5, 0xAA + ldrh r1, [r5] + subs r0, r1, 0x1 + adds r6, r2, 0 + cmp r3, r0 + blt _08023468 + adds r0, r1, 0x1 + cmp r3, r0 + bgt _08023468 + mov r1, r12 + adds r1, 0xA8 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + strh r3, [r5] + mov r0, r12 + adds r0, 0xAC + ldrh r1, [r1] + ldrh r2, [r0] + cmp r1, r2 + bls _08023476 + strh r1, [r0] + b _08023476 + .pool +_08023468: + adds r0, r4, r6 + adds r2, r0, 0 + adds r2, 0xA8 + movs r1, 0 + strh r1, [r2] + adds r0, 0xAA + strh r3, [r0] +_08023476: + adds r1, r4, r6 + ldrh r0, [r4, 0x28] + adds r3, r1, 0 + adds r3, 0xA6 + movs r2, 0 + strh r0, [r3] + adds r1, 0xB4 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bls _0802349E + strb r2, [r1] + b _0802349E +_08023496: + lsls r0, r7, 5 + adds r0, r4, r0 + adds r0, 0xB5 + strb r1, [r0] +_0802349E: + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldrb r3, [r4, 0x9] + cmp r7, r3 + bcc _080233C0 +_080234AA: + mov r0, r8 + cmp r0, 0x1 + bls _080234E0 + movs r7, 0 + ldrb r1, [r4, 0x9] + cmp r7, r1 + bcs _080234E0 + movs r3, 0x2 +_080234BA: + lsls r0, r7, 5 + adds r1, r4, r0 + adds r2, r1, 0 + adds r2, 0xB5 + ldrb r0, [r2] + cmp r0, 0 + beq _080234D4 + orrs r0, r3 + strb r0, [r2] + adds r1, 0xB0 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] +_080234D4: + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldrb r2, [r4, 0x9] + cmp r7, r2 + bcc _080234BA +_080234E0: + mov r3, r8 + cmp r3, 0 + beq _08023548 + ldrh r0, [r4, 0x2E] + add r0, r8 + strh r0, [r4, 0x2E] + ldr r1, =gUnknown_082F3264 + mov r0, r8 + subs r0, 0x1 + adds r0, r1 + ldrb r0, [r0] + add r0, r8 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + ldrh r0, [r4, 0x34] + add r0, r8 + strh r0, [r4, 0x34] + ldrh r0, [r4, 0x1A] + add r0, r8 + strh r0, [r4, 0x1A] + movs r1, 0x18 + ldrsh r0, [r4, r1] + movs r3, 0x1A + ldrsh r2, [r4, r3] + subs r0, r2 + cmp r0, 0 + ble _08023534 + lsls r2, 8 + ldr r1, [r4, 0x20] + adds r0, r2, 0 + bl sub_81515FC + adds r2, r0, 0 + asrs r2, 8 + adds r0, r4, 0 + adds r0, 0x24 + strb r2, [r0] + b _08023548 + .pool +_08023534: + adds r1, r4, 0 + adds r1, 0x24 + movs r0, 0x20 + strb r0, [r1] + adds r2, r4, 0 + adds r2, 0x5E + ldrb r0, [r2] + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2] +_08023548: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_802339C + + thumb_func_start sub_8023558 +sub_8023558: @ 8023558 + push {r4-r6,lr} + adds r3, r0, 0 + movs r6, 0 + movs r1, 0 + adds r4, r1, 0 + ldrb r0, [r3, 0x9] + cmp r4, r0 + bcs _080235B0 + adds r5, r3, 0 + adds r5, 0x64 +_0802356C: + lsls r0, r4, 5 + adds r1, r3, r0 + adds r0, r1, 0 + adds r0, 0xB5 + ldrb r2, [r0] + cmp r2, 0 + beq _080235A4 + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + adds r0, r1, 0 + adds r0, 0xB4 + ldrb r0, [r0] + adds r1, r0, 0x1 + movs r0, 0x2 + ands r0, r2 + cmp r0, 0 + beq _08023594 + movs r0, 0x4 + orrs r1, r0 +_08023594: + lsls r0, r4, 1 + adds r0, r4 + lsls r1, r0 + lsls r0, r1, 16 + lsrs r1, r0, 16 + ldrh r0, [r5] + orrs r1, r0 + strh r1, [r5] +_080235A4: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + ldrb r1, [r3, 0x9] + cmp r4, r1 + bcc _0802356C +_080235B0: + adds r0, r3, 0 + adds r0, 0x24 + ldrb r1, [r0] + adds r0, 0x3C + strh r1, [r0] + cmp r6, 0 + bne _080235D4 + ldr r2, =0x0000013b + adds r0, r3, r2 + ldrb r0, [r0] + cmp r0, 0 + beq _080236A0 + movs r4, 0x9C + lsls r4, 1 + adds r1, r3, r4 + b _08023612 + .pool +_080235D4: + ldr r5, =0x0000013b + adds r2, r3, r5 + ldrb r0, [r2] + cmp r0, 0 + beq _0802361A + ldr r0, =0x00000139 + adds r1, r3, r0 + ldrb r2, [r1] + cmp r6, r2 + beq _0802360C + subs r0, r6, 0x1 + strb r0, [r1] + ldr r1, =gUnknown_082F3290 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0] + movs r4, 0x9D + lsls r4, 1 + adds r1, r3, r4 + strb r0, [r1] + b _08023640 + .pool +_0802360C: + movs r5, 0x9C + lsls r5, 1 + adds r1, r3, r5 +_08023612: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _08023640 +_0802361A: + movs r0, 0x9C + lsls r0, 1 + adds r1, r3, r0 + movs r0, 0 + strb r0, [r1] + subs r0, r6, 0x1 + ldr r4, =0x00000139 + adds r1, r3, r4 + strb r0, [r1] + ldr r1, =gUnknown_082F3290 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0] + movs r5, 0x9D + lsls r5, 1 + adds r1, r3, r5 + strb r0, [r1] + movs r0, 0x1 + strb r0, [r2] +_08023640: + ldr r0, =0x0000013b + adds r4, r3, r0 + ldrb r0, [r4] + cmp r0, 0 + beq _080236A0 + movs r2, 0x9C + lsls r2, 1 + adds r1, r3, r2 + movs r5, 0x9D + lsls r5, 1 + adds r2, r3, r5 + ldrb r0, [r1] + ldrb r5, [r2] + cmp r0, r5 + bcc _0802367C + movs r0, 0 + strb r0, [r1] + ldr r5, =0x00000139 + adds r1, r3, r5 + strb r0, [r1] + strb r0, [r2] + strb r0, [r4] + movs r1, 0 + b _08023690 + .pool +_0802367C: + ldr r2, =gUnknown_082F3290 + ldrb r1, [r1] + ldr r4, =0x00000139 + adds r0, r3, r4 + ldrb r0, [r0] + lsls r0, 2 + adds r0, 0x1 + adds r1, r0 + adds r1, r2 + ldrb r1, [r1] +_08023690: + adds r0, r3, 0 + adds r0, 0x5F + strb r1, [r0] + b _080236A8 + .pool +_080236A0: + adds r1, r3, 0 + adds r1, 0x5F + movs r0, 0 + strb r0, [r1] +_080236A8: + ldrh r1, [r3, 0x26] + adds r0, r3, 0 + adds r0, 0x62 + strh r1, [r0] + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8023558 + + thumb_func_start sub_80236B8 +sub_80236B8: @ 80236B8 + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r5, r0, 0 + ldr r3, =gMain + ldrh r1, [r3, 0x2E] + movs r4, 0x1 + adds r0, r4, 0 + ands r0, r1 + cmp r0, 0 + beq _080236DA + adds r2, r5, 0 + adds r2, 0x5E + ldrb r0, [r2] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r2] +_080236DA: + ldrh r1, [r3, 0x2C] + adds r0, r4, 0 + ands r0, r1 + cmp r0, 0 + beq _080236FA + ldrb r0, [r5, 0x8] + lsls r0, 5 + adds r0, r5, r0 + adds r1, r0, 0 + adds r1, 0xB2 + ldrh r0, [r1] + ldrh r2, [r5, 0x28] + cmp r0, r2 + bcs _080236FA + adds r0, 0x1 + strh r0, [r1] +_080236FA: + ldrb r0, [r5, 0x8] + adds r7, r5, 0 + adds r7, 0x5E + cmp r0, 0 + beq _08023710 + ldrb r1, [r7] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + bne _08023710 + b _0802384C +_08023710: + adds r4, r5, 0 + adds r4, 0x5C + movs r0, 0x2 + strh r0, [r4] + ldrh r0, [r5, 0x28] + movs r1, 0x1E + bl __umodsi3 + lsls r0, 16 + mov r8, r4 + adds r6, r5, 0 + adds r6, 0x25 + cmp r0, 0 + bne _08023768 + movs r0, 0x2E + ldrsh r2, [r5, r0] + ldr r1, =gUnknown_082F4444 + ldrb r0, [r5, 0x9] + subs r0, 0x2 + adds r0, r1 + ldrb r0, [r0] + cmp r2, r0 + ble _08023754 + ldrh r0, [r5, 0x30] + adds r0, 0x1 + strh r0, [r5, 0x30] + ldrb r0, [r6] + movs r1, 0x10 + orrs r0, r1 + b _0802375C + .pool +_08023754: + ldrb r1, [r6] + movs r0, 0x11 + negs r0, r0 + ands r0, r1 +_0802375C: + strb r0, [r6] + movs r0, 0 + strh r0, [r5, 0x2E] + ldrh r0, [r5, 0x32] + adds r0, 0x1 + strh r0, [r5, 0x32] +_08023768: + ldrh r0, [r5, 0x28] + movs r1, 0xF + bl __umodsi3 + lsls r0, 16 + cmp r0, 0 + bne _080237DE + movs r0, 0x34 + ldrsh r2, [r5, r0] + ldr r3, =gUnknown_082F4434 + ldrb r0, [r5, 0x9] + subs r0, 0x2 + lsls r1, r0, 2 + adds r0, r1, r3 + ldrb r0, [r0] + cmp r2, r0 + bge _08023798 + ldrb r1, [r6] + movs r0, 0x1F + ands r0, r1 + strb r0, [r6] + b _080237D8 + .pool +_08023798: + adds r0, r3, 0x1 + adds r0, r1, r0 + ldrb r0, [r0] + cmp r2, r0 + bge _080237AC + ldrb r0, [r6] + movs r1, 0x1F + ands r1, r0 + movs r0, 0x20 + b _080237D4 +_080237AC: + adds r0, r3, 0x2 + adds r0, r1, r0 + ldrb r0, [r0] + cmp r2, r0 + bge _080237BC + movs r0, 0x2 + strh r0, [r5, 0x34] + b _080237D8 +_080237BC: + adds r0, r3, 0x3 + adds r0, r1, r0 + ldrb r0, [r0] + cmp r2, r0 + bge _080237CC + movs r0, 0x3 + strh r0, [r5, 0x34] + b _080237D8 +_080237CC: + ldrb r0, [r6] + movs r1, 0x1F + ands r1, r0 + movs r0, 0x80 +_080237D4: + orrs r1, r0 + strb r1, [r6] +_080237D8: + movs r0, 0 + strh r0, [r5, 0x34] + b _0802380A +_080237DE: + ldrh r0, [r5, 0x10] + adds r0, 0x1 + strh r0, [r5, 0x10] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x3C + bls _0802380A + cmp r0, 0x46 + bls _080237FA + bl sub_8011AC8 + movs r0, 0 + strh r0, [r5, 0x10] + b _0802380A +_080237FA: + ldrb r0, [r7] + movs r4, 0xF8 + ands r4, r0 + cmp r4, 0 + bne _0802380A + bl sub_8011AC8 + strh r4, [r5, 0x10] +_0802380A: + ldrh r1, [r5, 0x28] + ldr r0, =0x00008c9f + cmp r1, r0 + bls _0802381A + ldrb r0, [r7] + movs r1, 0x1 + orrs r0, r1 + strb r0, [r7] +_0802381A: + ldrb r1, [r6] + lsls r1, 27 + lsrs r1, 31 + lsls r1, 1 + ldrb r2, [r7] + movs r0, 0x3 + negs r0, r0 + ands r0, r2 + orrs r0, r1 + strb r0, [r7] + ldrb r0, [r6] + lsrs r0, 5 + adds r2, r5, 0 + adds r2, 0x66 + strh r0, [r2] + adds r4, r5, 0 + adds r4, 0x42 + adds r0, r4, 0 + mov r1, r8 + movs r2, 0xC + bl memcpy + adds r0, r4, 0 + bl sub_800FE50 +_0802384C: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80236B8 + + thumb_func_start sub_802385C +sub_802385C: @ 802385C + push {r4,r5,lr} + adds r5, r0, 0 + movs r4, 0 + ldr r3, =gUnknown_03003090 + ldrb r0, [r5, 0x9] + cmp r4, r0 + bcs _08023880 + movs r1, 0 +_0802386C: + lsls r0, r4, 5 + adds r0, r5, r0 + adds r0, 0xB5 + strb r1, [r0] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + ldrb r0, [r5, 0x9] + cmp r4, r0 + bcc _0802386C +_08023880: + adds r2, r3, 0 + ldrh r0, [r2] + movs r1, 0xFF + lsls r1, 8 + ands r1, r0 + movs r0, 0xBC + lsls r0, 6 + cmp r1, r0 + bne _08023898 + ldrh r0, [r2, 0x2] + cmp r0, 0x2 + beq _080238AC +_08023898: + adds r2, r5, 0 + adds r2, 0x25 + ldrb r1, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2] + b _080238EA + .pool +_080238AC: + adds r4, r5, 0 + adds r4, 0x4E + adds r0, r4, 0 + adds r1, r3, 0 + movs r2, 0xE + bl memcpy + ldrh r0, [r4, 0x6] + strh r0, [r5, 0x2A] + movs r0, 0x5 + ldrsb r0, [r4, r0] + strh r0, [r5, 0x2C] + ldrh r0, [r4, 0x8] + strh r0, [r5, 0x28] + movs r0, 0x9C + lsls r0, 1 + adds r1, r5, r0 + adds r0, r5, 0 + bl sub_80216E0 + ldrb r1, [r4, 0x4] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _080238EA + adds r0, r5, 0 + adds r0, 0x25 + ldrb r1, [r0] + movs r2, 0x8 + orrs r1, r2 + strb r1, [r0] +_080238EA: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802385C + + thumb_func_start sub_80238F0 +sub_80238F0: @ 80238F0 + push {r4,lr} + adds r4, r0, 0 + adds r0, 0x5C + movs r1, 0 + movs r2, 0xC + bl memset + adds r0, r4, 0 + adds r0, 0x4E + movs r1, 0 + movs r2, 0xE + bl memset + adds r0, r4, 0 + bl sub_802385C + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x12 + bl SetGpuReg + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1A + bl SetGpuReg + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1E + bl SetGpuReg + adds r0, r4, 0 + adds r0, 0x25 + ldrb r1, [r0] + movs r0, 0x8 + ands r0, r1 + cmp r0, 0 + beq _08023978 + ldrh r1, [r4, 0x28] + ldr r0, =0x00008c9f + cmp r1, r0 + bls _08023964 + adds r0, 0x1 + strh r0, [r4, 0x28] + movs r0, 0x10 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + b _0802396E + .pool +_08023964: + movs r0, 0xF + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC +_0802396E: + movs r1, 0 + movs r0, 0 + strh r0, [r4, 0x10] + strb r1, [r4, 0xC] + b _08023992 +_08023978: + ldrh r0, [r4, 0x26] + adds r0, 0x1 + strh r0, [r4, 0x26] + adds r0, r4, 0 + bl sub_802339C + adds r0, r4, 0 + bl sub_8023558 + adds r0, r4, 0 + bl sub_80236B8 + movs r0, 0 +_08023992: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_80238F0 + + thumb_func_start sub_8023998 +sub_8023998: @ 8023998 + push {r4,lr} + adds r4, r0, 0 + adds r0, 0x5C + movs r1, 0 + movs r2, 0xC + bl memset + adds r0, r4, 0 + adds r0, 0x4E + movs r1, 0 + movs r2, 0xE + bl memset + adds r0, r4, 0 + bl sub_802385C + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x12 + bl SetGpuReg + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1A + bl SetGpuReg + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1E + bl SetGpuReg + adds r0, r4, 0 + adds r0, 0x25 + ldrb r1, [r0] + movs r0, 0x8 + ands r0, r1 + cmp r0, 0 + beq _08023A20 + ldrh r1, [r4, 0x28] + ldr r0, =0x00008c9f + cmp r1, r0 + bls _08023A0C + adds r0, 0x1 + strh r0, [r4, 0x28] + movs r0, 0x10 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + b _08023A16 + .pool +_08023A0C: + movs r0, 0xF + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC +_08023A16: + movs r1, 0 + movs r0, 0 + strh r0, [r4, 0x10] + strb r1, [r4, 0xC] + b _08023A28 +_08023A20: + adds r0, r4, 0 + bl sub_80236B8 + movs r0, 0 +_08023A28: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8023998 + + thumb_func_start sub_8023A30 +sub_8023A30: @ 8023A30 + push {r4-r7,lr} + adds r4, r0, 0 + ldrb r0, [r4, 0xC] + cmp r0, 0x5 + bls _08023A3C + b _08023BB2 +_08023A3C: + lsls r0, 2 + ldr r1, =_08023A4C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08023A4C: + .4byte _08023A64 + .4byte _08023A8C + .4byte _08023ADC + .4byte _08023B5C + .4byte _08023B7A + .4byte _08023B94 +_08023A64: + movs r0, 0x8 + strh r0, [r4, 0x12] + movs r0, 0xD6 + bl PlaySE + movs r0, 0x1 + negs r0, r0 + ldr r2, =0x000003ff + movs r1, 0x8 + bl BlendPalettes + movs r0, 0x9C + lsls r0, 1 + adds r1, r4, r0 + movs r0, 0x2 + strb r0, [r1] + b _08023BB2 + .pool +_08023A8C: + movs r1, 0x9C + lsls r1, 1 + adds r5, r4, r1 + ldrb r0, [r5] + subs r0, 0x1 + strb r0, [r5] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xFF + beq _08023AA2 + b _08023BB8 +_08023AA2: + movs r0, 0x1 + negs r0, r0 + ldr r2, =0x000003ff + movs r1, 0 + bl BlendPalettes + ldr r2, =0x00000139 + adds r1, r4, r2 + movs r0, 0x4 + strb r0, [r1] + movs r0, 0 + strb r0, [r5] + ldr r2, =gUnknown_082F326C + ldrb r1, [r1] + lsls r0, r1, 3 + subs r0, r1 + adds r0, r2 + ldrb r0, [r0] + movs r2, 0x9D + lsls r2, 1 + adds r1, r4, r2 + strb r0, [r1] + b _08023BB2 + .pool +_08023ADC: + ldr r7, =gUnknown_082F326C + movs r0, 0x9C + lsls r0, 1 + adds r6, r4, r0 + ldr r1, =0x00000139 + adds r5, r4, r1 + ldrb r1, [r5] + lsls r0, r1, 3 + subs r0, r1 + ldrb r2, [r6] + adds r0, r2 + adds r0, r7 + movs r1, 0 + ldrsb r1, [r0, r1] + strh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x12 + bl SetGpuReg + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1A + bl SetGpuReg + ldrh r1, [r4, 0x2C] + negs r1, r1 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1E + bl SetGpuReg + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] + movs r1, 0x9D + lsls r1, 1 + adds r2, r4, r1 + lsls r0, 24 + lsrs r0, 24 + ldrb r1, [r2] + cmp r0, r1 + bcc _08023BB8 + ldrb r0, [r5] + cmp r0, 0 + beq _08023BB2 + subs r0, 0x1 + strb r0, [r5] + ldrb r1, [r5] + lsls r0, r1, 3 + subs r0, r1 + adds r0, r7 + ldrb r0, [r0] + strb r0, [r2] + movs r0, 0 + strb r0, [r6] + b _08023BB8 + .pool +_08023B5C: + movs r0, 0 + strh r0, [r4, 0x2C] + movs r0, 0x12 + movs r1, 0 + bl SetGpuReg + movs r0, 0x1A + movs r1, 0 + bl SetGpuReg + movs r0, 0x1E + movs r1, 0 + bl SetGpuReg + b _08023BB2 +_08023B7A: + movs r2, 0x9C + lsls r2, 1 + adds r1, r4, r2 + adds r0, r4, 0 + bl sub_80218D4 + cmp r0, 0 + beq _08023BB8 + bl sub_8010434 + movs r0, 0 + strh r0, [r4, 0x10] + b _08023BB2 +_08023B94: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08023BB8 + movs r0, 0x11 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r1, 0 + movs r0, 0 + strh r0, [r4, 0x10] + strb r1, [r4, 0xC] + b _08023BBA +_08023BB2: + ldrb r0, [r4, 0xC] + adds r0, 0x1 + strb r0, [r4, 0xC] +_08023BB8: + movs r0, 0 +_08023BBA: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8023A30 + + thumb_func_start sub_8023BC0 +sub_8023BC0: @ 8023BC0 + push {r4-r6,lr} + sub sp, 0x4 + adds r5, r0, 0 + adds r6, r1, 0 + ldrb r0, [r5, 0xC] + cmp r0, 0x1 + beq _08023C04 + cmp r0, 0x1 + bgt _08023BD8 + cmp r0, 0 + beq _08023BE2 + b _08023C9C +_08023BD8: + cmp r0, 0x2 + beq _08023C2A + cmp r0, 0x3 + beq _08023C5C + b _08023C9C +_08023BE2: + movs r0, 0x9 + strh r0, [r5, 0x12] + movs r0, 0x20 + bl PlaySE + movs r0, 0x1 + negs r0, r0 + movs r1, 0x8 + movs r2, 0x1F + bl BlendPalettes + movs r0, 0x9C + lsls r0, 1 + adds r1, r5, r0 + movs r0, 0x4 + strb r0, [r1] + b _08023C9C +_08023C04: + movs r0, 0x9C + lsls r0, 1 + adds r4, r5, r0 + ldrb r0, [r4] + subs r0, 0x1 + strb r0, [r4] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xFF + bne _08023CA2 + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + movs r2, 0x1F + bl BlendPalettes + movs r0, 0 + strb r0, [r4] + b _08023C9C +_08023C2A: + movs r0, 0x9C + lsls r0, 1 + adds r1, r5, r0 + adds r0, r5, 0 + bl sub_80218D4 + cmp r0, 0 + beq _08023CA2 + bl sub_8010434 + movs r0, 0 + strh r0, [r5, 0x10] + movs r0, 0x12 + movs r1, 0 + bl SetGpuReg + movs r0, 0x1A + movs r1, 0 + bl SetGpuReg + movs r0, 0x1E + movs r1, 0 + bl SetGpuReg + b _08023C9C +_08023C5C: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08023CA2 + ldr r0, =gStringVar1 + ldr r1, [r5, 0x1C] + movs r2, 0 + movs r3, 0x6 + bl ConvertIntToDecimalStringN + movs r4, 0 + str r4, [sp] + adds r0, r6, 0 + movs r1, 0x7 + movs r2, 0x1 + movs r3, 0 + bl sub_8024644 + movs r0, 0x13 + strb r0, [r5, 0xE] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r0, 0 + strh r4, [r5, 0x10] + b _08023CA0 + .pool +_08023C9C: + ldrb r0, [r5, 0xC] + adds r0, 0x1 +_08023CA0: + strb r0, [r5, 0xC] +_08023CA2: + movs r0, 0 + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8023BC0 + + thumb_func_start sub_8023CAC +sub_8023CAC: @ 8023CAC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x10 + adds r7, r0, 0 + ldrb r0, [r7, 0xC] + cmp r0, 0x7 + bls _08023CC2 + b _0802402E +_08023CC2: + lsls r0, 2 + ldr r1, =_08023CD0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08023CD0: + .4byte _08023CF0 + .4byte _08023D2A + .4byte _08023D38 + .4byte _08023DA0 + .4byte _08023F20 + .4byte _08023FD0 + .4byte _08023FDC + .4byte _08024010 +_08023CF0: + adds r4, r7, 0 + adds r4, 0x42 + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x4 + bl memset + ldrb r0, [r7, 0x8] + lsls r0, 5 + adds r0, r7, r0 + adds r2, r0, 0 + adds r2, 0xB2 + ldrh r1, [r7, 0x28] + ldrh r0, [r2] + cmp r0, r1 + bls _08023D12 + strh r1, [r2] +_08023D12: + ldrb r0, [r7, 0x8] + lsls r0, 5 + adds r0, r7, r0 + adds r0, 0xB2 + ldrh r0, [r0] + strh r0, [r4] + movs r0, 0 + adds r1, r4, 0 + movs r2, 0x2 + bl SendBlock + b _0802402E +_08023D2A: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + bne _08023D36 + b _08024034 +_08023D36: + b _08024004 +_08023D38: + bl GetBlockReceivedStatus + ldr r2, =gUnknown_082F4448 + ldrb r3, [r7, 0x9] + subs r1, r3, 0x2 + adds r1, r2 + lsls r0, 24 + lsrs r0, 24 + ldrb r1, [r1] + cmp r0, r1 + beq _08023D50 + b _08024034 +_08023D50: + movs r0, 0 + mov r8, r0 + adds r4, r7, 0 + adds r4, 0x42 + cmp r8, r3 + bcs _08023D7E + ldr r2, =gBlockRecvBuffer +_08023D5E: + mov r3, r8 + lsls r1, r3, 5 + adds r1, r7, r1 + lsls r0, r3, 8 + adds r0, r2 + ldrh r0, [r0] + adds r1, 0xB2 + strh r0, [r1] + mov r0, r8 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + ldrb r6, [r7, 0x9] + cmp r8, r6 + bcc _08023D5E +_08023D7E: + movs r0, 0 + strh r0, [r7, 0x10] + strh r0, [r4] + bl ResetBlockReceivedFlags + ldrb r0, [r7, 0x8] + cmp r0, 0 + bne _08023D9C + movs r0, 0x3 + b _08024032 + .pool +_08023D9C: + movs r0, 0x6 + b _08024032 +_08023DA0: + adds r0, r7, 0 + adds r0, 0x68 + movs r1, 0 + movs r2, 0x30 + bl memset + ldrh r1, [r7, 0x28] + adds r0, r7, 0 + adds r0, 0x6C + strh r1, [r0] + movs r0, 0x18 + ldrsh r4, [r7, r0] + ldrh r0, [r7, 0x28] + movs r1, 0x3C + bl __udivsi3 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + bl __divsi3 + adds r1, r7, 0 + adds r1, 0x6E + strh r0, [r1] + movs r1, 0x30 + ldrsh r0, [r7, r1] + lsls r0, 8 + movs r4, 0xC8 + lsls r4, 6 + adds r1, r4, 0 + bl sub_8151574 + adds r2, r0, 0 + movs r3, 0x32 + ldrsh r1, [r7, r3] + lsls r1, 8 + bl sub_81515FC + adds r2, r0, r4 + asrs r2, 8 + movs r1, 0x7F + adds r0, r2, 0 + ands r0, r1 + adds r1, r7, 0 + adds r1, 0x70 + strh r0, [r1] + lsls r2, 8 + movs r1, 0xC8 + lsls r1, 7 + adds r0, r2, 0 + bl sub_81515FC + adds r2, r0, 0 + ldrb r1, [r7, 0x9] + ldr r0, [r7, 0x1C] + muls r0, r1 + lsls r4, r0, 8 + adds r0, r4, 0 + adds r1, r2, 0 + bl sub_8151574 + adds r4, r0, 0 + asrs r0, r4, 8 + str r0, [r7, 0x68] + bl Random + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x3 + bl __umodsi3 + adds r1, r7, 0 + adds r1, 0x8F + strb r0, [r1] + movs r6, 0 + mov r8, r6 + mov r9, r1 + ldrb r0, [r7, 0x9] + cmp r8, r0 + bcc _08023E44 + b _0802402E +_08023E44: + adds r0, r7, 0 + adds r0, 0x88 + add r0, r8 + mov r1, r8 + strb r1, [r0] + adds r0, r7, 0 + adds r0, 0x90 + add r0, r8 + strb r1, [r0] + mov r3, r8 + lsls r2, r3, 1 + adds r1, r7, 0 + adds r1, 0x74 + adds r1, r2 + lsls r0, r3, 5 + adds r3, r7, r0 + adds r5, r3, 0 + adds r5, 0xAE + ldrh r0, [r5] + strh r0, [r1] + adds r1, r7, 0 + adds r1, 0x72 + ldrh r6, [r1] + adds r0, r6 + strh r0, [r1] + mov r1, r9 + ldrb r0, [r1] + adds r6, r2, 0 + cmp r0, 0x1 + beq _08023EAE + cmp r0, 0x1 + bgt _08023E8A + cmp r0, 0 + beq _08023E90 + b _08023F04 +_08023E8A: + cmp r0, 0x2 + beq _08023ECC + b _08023F04 +_08023E90: + ldrh r0, [r5] + cmp r0, 0 + beq _08023ED2 + adds r0, r3, 0 + adds r0, 0xAC + ldrh r2, [r0] + lsls r2, 8 + adds r0, r2, 0 + movs r1, 0xC8 + lsls r1, 7 + bl sub_8151574 + adds r2, r0, 0 + ldrh r4, [r5] + b _08023EFA +_08023EAE: + ldrh r0, [r5] + cmp r0, 0 + beq _08023ED2 + adds r0, r3, 0 + adds r0, 0xB0 + ldrh r2, [r0] + lsls r2, 8 + adds r0, r2, 0 + movs r1, 0xC8 + lsls r1, 7 + bl sub_8151574 + adds r2, r0, 0 + ldrh r4, [r5] + b _08023EFA +_08023ECC: + ldrh r0, [r5] + cmp r0, 0 + bne _08023ED6 +_08023ED2: + movs r4, 0 + b _08023F04 +_08023ED6: + adds r1, r3, 0 + adds r1, 0xB2 + ldrh r0, [r1] + ldrh r2, [r7, 0x28] + cmp r0, r2 + bcc _08023EE8 + movs r4, 0xC8 + lsls r4, 7 + b _08023F04 +_08023EE8: + ldrh r2, [r1] + lsls r2, 8 + adds r0, r2, 0 + movs r1, 0xC8 + lsls r1, 7 + bl sub_8151574 + adds r2, r0, 0 + ldrh r4, [r7, 0x28] +_08023EFA: + lsls r4, 8 + adds r1, r4, 0 + bl sub_81515FC + adds r4, r0, 0 +_08023F04: + asrs r4, 4 + adds r0, r7, 0 + adds r0, 0x7E + adds r0, r6 + strh r4, [r0] + mov r0, r8 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + ldrb r3, [r7, 0x9] + cmp r8, r3 + bcc _08023E44 + b _0802402E +_08023F20: + movs r6, 0 + mov r8, r6 + ldrb r0, [r7, 0x9] + subs r0, 0x1 + adds r1, r7, 0 + adds r1, 0x68 + str r1, [sp, 0xC] + cmp r8, r0 + bge _08023FC4 +_08023F32: + ldrb r0, [r7, 0x9] + subs r0, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + mov r2, r8 + adds r2, 0x1 + str r2, [sp, 0x8] + cmp r4, r8 + bls _08023FB4 + adds r3, r7, 0 + adds r3, 0x74 + str r3, [sp] + adds r6, r7, 0 + adds r6, 0x88 + str r6, [sp, 0x4] + movs r0, 0x90 + adds r0, r7 + mov r10, r0 + movs r1, 0x7E + adds r1, r7 + mov r9, r1 +_08023F5C: + subs r2, r4, 0x1 + mov r12, r2 + lsls r6, r2, 1 + ldr r0, [sp] + adds r3, r0, r6 + lsls r5, r4, 1 + adds r1, r0, r5 + ldrh r2, [r3] + ldrh r0, [r1] + cmp r2, r0 + bcs _08023F86 + ldrh r0, [r1] + strh r2, [r1] + strh r0, [r3] + ldr r1, [sp, 0x4] + adds r2, r1, r4 + ldrb r3, [r2] + add r1, r12 + ldrb r0, [r1] + strb r0, [r2] + strb r3, [r1] +_08023F86: + mov r2, r9 + adds r3, r2, r6 + adds r1, r2, r5 + ldrh r2, [r3] + ldrh r6, [r1] + cmp r2, r6 + bcs _08023FAA + ldrh r0, [r1] + strh r2, [r1] + strh r0, [r3] + mov r0, r10 + adds r2, r0, r4 + ldrb r3, [r2] + mov r1, r10 + add r1, r12 + ldrb r0, [r1] + strb r0, [r2] + strb r3, [r1] +_08023FAA: + mov r1, r12 + lsls r0, r1, 24 + lsrs r4, r0, 24 + cmp r4, r8 + bhi _08023F5C +_08023FB4: + ldr r2, [sp, 0x8] + lsls r0, r2, 24 + lsrs r0, 24 + mov r8, r0 + ldrb r0, [r7, 0x9] + subs r0, 0x1 + cmp r8, r0 + blt _08023F32 +_08023FC4: + movs r0, 0 + ldr r1, [sp, 0xC] + movs r2, 0x30 + bl SendBlock + b _0802402E +_08023FD0: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08024034 + b _08024004 +_08023FDC: + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08024034 + adds r4, r7, 0 + adds r4, 0x68 + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x30 + bl memset + ldr r1, =gBlockRecvBuffer + adds r0, r4, 0 + movs r2, 0x30 + bl memcpy + bl ResetBlockReceivedFlags +_08024004: + movs r0, 0 + strh r0, [r7, 0x10] + b _0802402E + .pool +_08024010: + bl sub_8020E58 + movs r0, 0x12 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r0, 0 + movs r1, 0xB + strh r1, [r7, 0x12] + strb r0, [r7, 0xC] + adds r1, r7, 0 + adds r1, 0x24 + strb r0, [r1] + b _08024034 +_0802402E: + ldrb r0, [r7, 0xC] + adds r0, 0x1 +_08024032: + strb r0, [r7, 0xC] +_08024034: + movs r0, 0 + add sp, 0x10 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8023CAC + + thumb_func_start sub_8024048 +sub_8024048: @ 8024048 + push {r4-r6,lr} + sub sp, 0x4 + adds r5, r0, 0 + adds r6, r1, 0 + ldrb r0, [r5, 0xC] + cmp r0, 0x4 + bhi _08024124 + lsls r0, 2 + ldr r1, =_08024064 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08024064: + .4byte _08024078 + .4byte _0802408A + .4byte _0802409C + .4byte _080240CC + .4byte _080240DC +_08024078: + movs r0, 0x9C + lsls r0, 1 + adds r1, r5, r0 + adds r0, r5, 0 + bl sub_8022070 + cmp r0, 0 + bne _08024124 + b _0802412A +_0802408A: + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x9C + lsls r0, 1 + adds r1, r5, r0 + movs r0, 0x1E + strb r0, [r1] + b _08024124 +_0802409C: + movs r0, 0x9C + lsls r0, 1 + adds r1, r5, r0 + ldrb r0, [r1] + cmp r0, 0 + beq _080240AE + subs r0, 0x1 + strb r0, [r1] + b _0802412A +_080240AE: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0802412A + movs r0, 0x5 + bl PlaySE + adds r0, r5, 0 + bl sub_802222C + b _08024124 + .pool +_080240CC: + ldrh r0, [r5, 0x12] + cmp r0, 0xC + bhi _08024124 + adds r0, 0x1 + movs r1, 0 + strh r0, [r5, 0x12] + strb r1, [r5, 0xC] + b _0802412A +_080240DC: + ldr r0, =gStringVar1 + ldr r1, [r5, 0x1C] + movs r2, 0 + movs r3, 0x6 + bl ConvertIntToDecimalStringN + ldr r4, =gStringVar2 + bl sub_80247BC + adds r1, r0, 0 + adds r0, r4, 0 + movs r2, 0 + movs r3, 0x6 + bl ConvertIntToDecimalStringN + movs r4, 0 + str r4, [sp] + adds r0, r6, 0 + movs r1, 0x2 + movs r2, 0x3 + movs r3, 0 + bl sub_8024644 + movs r0, 0x13 + strb r0, [r5, 0xE] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + strb r4, [r5, 0xC] + b _0802412A + .pool +_08024124: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] +_0802412A: + movs r0, 0 + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8024048 + + thumb_func_start sub_8024134 +sub_8024134: @ 8024134 + push {r4,r5,lr} + sub sp, 0x10 + adds r5, r0, 0 + adds r4, r1, 0 + ldrb r0, [r5, 0xC] + cmp r0, 0x4 + bhi _08024218 + lsls r0, 2 + ldr r1, =_08024150 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08024150: + .4byte _08024164 + .4byte _080241A0 + .4byte _080241A6 + .4byte _080241F0 + .4byte _08024204 +_08024164: + ldrh r1, [r5, 0x28] + ldr r0, =0x00008c9f + cmp r1, r0 + bls _08024176 + movs r1, 0x9C + lsls r1, 1 + adds r0, r5, r1 + bl sub_8022554 +_08024176: + movs r0, 0x1 + str r0, [sp] + adds r0, r4, 0 + movs r1, 0x8 + movs r2, 0 + movs r3, 0 + bl sub_8024644 + movs r4, 0 + movs r0, 0x13 + strb r0, [r5, 0xE] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + strb r4, [r5, 0xC] + b _0802421E + .pool +_080241A0: + bl sub_8010434 + b _08024218 +_080241A6: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0802421E + movs r0, 0 + movs r1, 0 + bl sub_81973C4 + ldr r2, =gUnknown_082C8959 + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + movs r3, 0 + bl AddTextPrinterParametrized + movs r0, 0 + movs r1, 0x3 + bl CopyWindowToVram + ldr r0, =sub_8153688 + movs r1, 0 + bl CreateTask + b _08024218 + .pool +_080241F0: + ldr r0, =sub_8153688 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + beq _08024218 + b _0802421E + .pool +_08024204: + movs r0, 0x14 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r1, 0 + movs r0, 0xF + strh r0, [r5, 0x12] + strb r1, [r5, 0xC] + b _0802421E +_08024218: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] +_0802421E: + movs r0, 0 + add sp, 0x10 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8024134 + + thumb_func_start sub_8024228 +sub_8024228: @ 8024228 + push {r4-r6,lr} + sub sp, 0x4 + adds r5, r0, 0 + adds r6, r1, 0 + ldrb r0, [r5, 0xC] + cmp r0, 0x1 + beq _0802426A + cmp r0, 0x1 + bgt _08024240 + cmp r0, 0 + beq _08024246 + b _080242D0 +_08024240: + cmp r0, 0x2 + beq _08024270 + b _080242D0 +_08024246: + movs r0, 0x1 + str r0, [sp] + adds r0, r6, 0 + movs r1, 0x4 + movs r2, 0 + movs r3, 0 + bl sub_8024644 + movs r0, 0x14 + strb r0, [r5, 0xE] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r0, 0 + strb r0, [r5, 0xC] + b _080242D8 +_0802426A: + bl sub_8197930 + b _080242D0 +_08024270: + bl sub_8198C58 + lsls r0, 24 + asrs r4, r0, 24 + movs r0, 0x2 + negs r0, r0 + cmp r4, r0 + beq _080242D6 + adds r0, r5, 0 + adds r0, 0x42 + movs r1, 0 + movs r2, 0xC + bl memset + cmp r4, 0 + bne _080242A2 + bl HasAtLeastOneBerry + lsls r0, 24 + cmp r0, 0 + beq _0802429E + strh r4, [r5, 0x14] + b _080242A6 +_0802429E: + movs r0, 0x3 + b _080242A4 +_080242A2: + movs r0, 0x1 +_080242A4: + strh r0, [r5, 0x14] +_080242A6: + movs r0, 0 + movs r1, 0x1 + bl sub_8197434 + movs r4, 0 + str r4, [sp] + adds r0, r6, 0 + movs r1, 0x8 + movs r2, 0 + movs r3, 0 + bl sub_8024644 + movs r0, 0x15 + strb r0, [r5, 0xE] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + strb r4, [r5, 0xC] + b _080242D6 +_080242D0: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] +_080242D6: + movs r0, 0 +_080242D8: + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8024228 + + thumb_func_start sub_80242E0 +sub_80242E0: @ 80242E0 + push {r4-r7,lr} + adds r4, r0, 0 + movs r5, 0 + ldrb r0, [r4, 0xC] + cmp r0, 0x1 + beq _08024306 + cmp r0, 0x1 + bgt _080242F6 + cmp r0, 0 + beq _08024300 + b _080243AC +_080242F6: + cmp r0, 0x2 + beq _08024328 + cmp r0, 0x3 + beq _08024336 + b _080243AC +_08024300: + bl sub_8010434 + b _080243AC +_08024306: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080243B2 + ldrh r0, [r4, 0x14] + adds r1, r4, 0 + adds r1, 0x42 + strh r0, [r1] + adds r0, r4, 0 + adds r0, 0x4E + strh r5, [r0] + movs r0, 0 + movs r2, 0x2 + bl SendBlock + b _080243AC +_08024328: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080243B2 + strh r5, [r4, 0x10] + b _080243AC +_08024336: + bl GetBlockReceivedStatus + ldr r2, =gUnknown_082F4448 + ldrb r3, [r4, 0x9] + subs r1, r3, 0x2 + adds r1, r2 + lsls r0, 24 + lsrs r0, 24 + ldrb r1, [r1] + cmp r0, r1 + bne _080243B2 + adds r7, r4, 0 + adds r7, 0x42 + adds r6, r4, 0 + adds r6, 0x4E + cmp r5, r3 + bcs _08024374 + adds r1, r6, 0 + ldr r2, =gBlockRecvBuffer +_0802435C: + lsls r0, r5, 8 + adds r0, r2 + ldrh r0, [r0] + ldrh r3, [r1] + adds r0, r3 + strh r0, [r1] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + ldrb r0, [r4, 0x9] + cmp r5, r0 + bcc _0802435C +_08024374: + ldrh r0, [r6] + cmp r0, 0 + beq _08024390 + movs r0, 0x17 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + b _0802439A + .pool +_08024390: + movs r0, 0x16 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC +_0802439A: + bl ResetBlockReceivedFlags + movs r1, 0 + movs r0, 0 + strh r0, [r7] + strh r0, [r6] + strh r0, [r4, 0x10] + strb r1, [r4, 0xC] + b _080243B4 +_080243AC: + ldrb r0, [r4, 0xC] + adds r0, 0x1 + strb r0, [r4, 0xC] +_080243B2: + movs r0, 0 +_080243B4: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80242E0 + + thumb_func_start sub_80243BC +sub_80243BC: @ 80243BC + push {r4,r5,lr} + sub sp, 0x4 + adds r5, r0, 0 + ldrb r4, [r5, 0xC] + cmp r4, 0x1 + beq _080243EA + cmp r4, 0x1 + bgt _080243D2 + cmp r4, 0 + beq _080243DC + b _08024434 +_080243D2: + cmp r4, 0x2 + beq _080243F6 + cmp r4, 0x3 + beq _0802441A + b _08024434 +_080243DC: + movs r0, 0x1 + negs r0, r0 + str r4, [sp] + movs r1, 0x1 + movs r2, 0 + movs r3, 0x10 + b _08024410 +_080243EA: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + beq _08024434 + b _0802443A +_080243F6: + movs r0, 0 + movs r1, 0x1 + bl sub_8197434 + adds r0, r5, 0 + bl sub_8021488 + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 +_08024410: + bl BeginNormalPaletteFade + bl UpdatePaletteFade + b _08024434 +_0802441A: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + bne _0802443A + movs r0, 0x7 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + movs r0, 0 + strh r4, [r5, 0x12] + b _08024438 +_08024434: + ldrb r0, [r5, 0xC] + adds r0, 0x1 +_08024438: + strb r0, [r5, 0xC] +_0802443A: + movs r0, 0 + add sp, 0x4 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_80243BC + + thumb_func_start sub_8024444 +sub_8024444: @ 8024444 + push {r4,r5,lr} + sub sp, 0x10 + adds r5, r0, 0 + ldrb r4, [r5, 0xC] + cmp r4, 0x1 + beq _080244BC + cmp r4, 0x1 + bgt _0802445A + cmp r4, 0 + beq _08024460 + b _080244F6 +_0802445A: + cmp r4, 0x2 + beq _080244D4 + b _080244F6 +_08024460: + movs r0, 0 + movs r1, 0 + bl sub_81973C4 + ldrh r1, [r5, 0x14] + cmp r1, 0x3 + bne _08024490 + ldr r0, =gUnknown_082F32A4 + ldr r2, [r0, 0x14] + ldrb r3, [r5, 0xB] + str r4, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + str r1, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + bl AddTextPrinterParametrized + b _080244AC + .pool +_08024490: + ldr r0, =gUnknown_082F32A4 + ldr r2, [r0, 0x18] + ldrb r3, [r5, 0xB] + str r4, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + bl AddTextPrinterParametrized +_080244AC: + movs r0, 0 + movs r1, 0x3 + bl CopyWindowToVram + b _080244F6 + .pool +_080244BC: + movs r0, 0 + bl IsTextPrinterActive + lsls r0, 16 + cmp r0, 0 + bne _080244FC + movs r0, 0x9C + lsls r0, 1 + adds r1, r5, r0 + movs r0, 0x78 + strb r0, [r1] + b _080244F6 +_080244D4: + movs r0, 0x9C + lsls r0, 1 + adds r1, r5, r0 + ldrb r0, [r1] + adds r4, r0, 0 + cmp r4, 0 + beq _080244E8 + subs r0, 0x1 + strb r0, [r1] + b _080244FC +_080244E8: + movs r0, 0x18 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + strb r4, [r5, 0xC] + b _080244FC +_080244F6: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] +_080244FC: + movs r0, 0 + add sp, 0x10 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8024444 + + thumb_func_start sub_8024508 +sub_8024508: @ 8024508 + push {r4,r5,lr} + adds r5, r0, 0 + ldrb r4, [r5, 0xC] + cmp r4, 0x1 + beq _08024528 + cmp r4, 0x1 + bgt _0802451C + cmp r4, 0 + beq _08024522 + b _08024558 +_0802451C: + cmp r4, 0x2 + beq _08024538 + b _08024558 +_08024522: + bl sub_8010434 + b _08024558 +_08024528: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0802455E + bl sub_800AC34 + b _08024558 +_08024538: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0802455E + movs r0, 0x19 + strb r0, [r5, 0xE] + movs r0, 0x5 + movs r1, 0x1 + movs r2, 0 + bl sub_8022BEC + strb r4, [r5, 0xC] + b _0802455E + .pool +_08024558: + ldrb r0, [r5, 0xC] + adds r0, 0x1 + strb r0, [r5, 0xC] +_0802455E: + movs r0, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8024508 + + thumb_func_start sub_8024568 +sub_8024568: @ 8024568 + push {lr} + movs r0, 0 + bl sub_8020C0C + movs r0, 0 + pop {r1} + bx r1 + thumb_func_end sub_8024568 + + thumb_func_start sub_8024578 +sub_8024578: @ 8024578 + push {r4-r6,lr} + adds r4, r0, 0 + movs r5, 0 + movs r0, 0x33 + bl IncrementGameStat + strb r5, [r4, 0xD] + movs r1, 0 + strh r5, [r4, 0x10] + movs r0, 0x2 + strh r0, [r4, 0x12] + strh r5, [r4, 0x14] + str r5, [r4, 0x1C] + strh r5, [r4, 0x18] + strh r5, [r4, 0x1A] + str r5, [r4, 0x20] + adds r0, r4, 0 + adds r0, 0x24 + strb r1, [r0] + adds r1, r4, 0 + adds r1, 0x25 + movs r0, 0 + strb r0, [r1] + strh r5, [r4, 0x26] + strh r5, [r4, 0x28] + strh r5, [r4, 0x2E] + ldr r0, =0x0000ffff + strh r0, [r4, 0x32] + strh r5, [r4, 0x30] + strh r5, [r4, 0x34] + movs r6, 0 + movs r3, 0 +_080245B8: + lsls r0, r5, 5 + adds r2, r4, r0 + adds r1, r2, 0 + adds r1, 0xA4 + ldr r0, =0x0000ffff + strh r0, [r1] + adds r0, r2, 0 + adds r0, 0xA6 + strh r3, [r0] + adds r0, 0x2 + strh r3, [r0] + adds r1, 0x6 + movs r0, 0x1 + strh r0, [r1] + adds r0, r2, 0 + adds r0, 0xAC + strh r3, [r0] + adds r0, 0x2 + strh r3, [r0] + adds r0, 0x2 + strh r3, [r0] + adds r0, 0x2 + strh r3, [r0] + adds r0, 0x2 + strb r6, [r0] + adds r0, 0x1 + strb r6, [r0] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x4 + bls _080245B8 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8024578 + + thumb_func_start sub_8024604 +sub_8024604: @ 8024604 + push {r4-r6,lr} + sub sp, 0x8 + str r2, [sp, 0x4] + ldr r5, [sp, 0x18] + ldr r6, [sp, 0x1C] + ldr r4, [sp, 0x20] + mov r2, sp + strh r4, [r2] + add r4, sp, 0x4 + ldrb r2, [r4] + strb r2, [r0] + ldrb r2, [r4, 0x1] + strb r2, [r0, 0x1] + ldrb r2, [r4, 0x2] + strb r2, [r0, 0x2] + ldrb r2, [r4, 0x3] + strb r2, [r0, 0x3] + strb r3, [r0, 0x4] + strb r5, [r0, 0x5] + strb r6, [r0, 0x6] + mov r2, sp + ldrb r2, [r2] + strb r2, [r0, 0x7] + mov r2, sp + ldrb r2, [r2, 0x1] + strb r2, [r0, 0x8] + strb r1, [r0, 0x9] + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8024604 + + thumb_func_start sub_8024644 +sub_8024644: @ 8024644 + push {r4,r5,lr} + sub sp, 0x4 + ldr r5, [sp, 0x10] + mov r4, sp + strh r3, [r4] + strb r1, [r0] + strb r2, [r0, 0x1] + mov r1, sp + ldrb r1, [r1] + strb r1, [r0, 0x2] + mov r1, sp + ldrb r1, [r1, 0x1] + strb r1, [r0, 0x3] + strb r5, [r0, 0x4] + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8024644 + + thumb_func_start sub_8024668 +sub_8024668: @ 8024668 + ldr r1, =gSaveBlock2Ptr + ldr r1, [r1] + adds r1, 0xAC + ldr r0, [r0] + ldr r1, [r1] + eors r0, r1 + bx lr + .pool + thumb_func_end sub_8024668 + + thumb_func_start SetBerryPowder +SetBerryPowder: @ 802467C + ldr r2, =gSaveBlock2Ptr + ldr r2, [r2] + adds r2, 0xAC + ldr r2, [r2] + eors r2, r1 + str r2, [r0] + bx lr + .pool + thumb_func_end SetBerryPowder + + thumb_func_start ApplyNewEncyprtionKeyToBerryPowder +ApplyNewEncyprtionKeyToBerryPowder: @ 8024690 + push {lr} + adds r1, r0, 0 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r2, 0xFA + lsls r2, 1 + adds r0, r2 + bl ApplyNewEncyprtionKeyToWord + pop {r0} + bx r0 + .pool + thumb_func_end ApplyNewEncyprtionKeyToBerryPowder + + thumb_func_start sub_80246AC +sub_80246AC: @ 80246AC + push {r4,lr} + adds r4, r0, 0 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r1, 0xFA + lsls r1, 1 + adds r0, r1 + bl sub_8024668 + cmp r0, r4 + bcc _080246CC + movs r0, 0x1 + b _080246CE + .pool +_080246CC: + movs r0, 0 +_080246CE: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_80246AC + + thumb_func_start sub_80246D4 +sub_80246D4: @ 80246D4 + push {lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r1, 0xFA + lsls r1, 1 + adds r0, r1 + bl sub_8024668 + ldr r1, =gSpecialVar_0x8004 + ldrh r1, [r1] + cmp r0, r1 + bcc _080246F8 + movs r0, 0x1 + b _080246FA + .pool +_080246F8: + movs r0, 0 +_080246FA: + pop {r1} + bx r1 + thumb_func_end sub_80246D4 + + thumb_func_start sub_8024700 +sub_8024700: @ 8024700 + push {r4,r5,lr} + adds r4, r0, 0 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r1, 0xFA + lsls r1, 1 + adds r5, r0, r1 + adds r0, r5, 0 + bl sub_8024668 + adds r1, r0, r4 + ldr r2, =0x0001869f + cmp r1, r2 + bhi _08024730 + adds r0, r5, 0 + bl SetBerryPowder + movs r0, 0x1 + b _0802473A + .pool +_08024730: + adds r0, r5, 0 + adds r1, r2, 0 + bl SetBerryPowder + movs r0, 0 +_0802473A: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8024700 + + thumb_func_start sub_8024740 +sub_8024740: @ 8024740 + push {r4,r5,lr} + adds r5, r0, 0 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r1, 0xFA + lsls r1, 1 + adds r4, r0, r1 + adds r0, r5, 0 + bl sub_80246AC + lsls r0, 24 + cmp r0, 0 + beq _08024774 + adds r0, r4, 0 + bl sub_8024668 + adds r1, r0, 0 + subs r1, r5 + adds r0, r4, 0 + bl SetBerryPowder + movs r0, 0x1 + b _08024776 + .pool +_08024774: + movs r0, 0 +_08024776: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8024740 + + thumb_func_start sub_802477C +sub_802477C: @ 802477C + push {r4,r5,lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r1, 0xFA + lsls r1, 1 + adds r4, r0, r1 + ldr r5, =gSpecialVar_0x8004 + ldrh r0, [r5] + bl sub_80246AC + lsls r0, 24 + cmp r0, 0 + beq _080247B4 + adds r0, r4, 0 + bl sub_8024668 + adds r1, r0, 0 + ldrh r0, [r5] + subs r1, r0 + adds r0, r4, 0 + bl SetBerryPowder + movs r0, 0x1 + b _080247B6 + .pool +_080247B4: + movs r0, 0 +_080247B6: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_802477C + + thumb_func_start sub_80247BC +sub_80247BC: @ 80247BC + push {lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r1, 0xFA + lsls r1, 1 + adds r0, r1 + bl sub_8024668 + pop {r1} + bx r1 + .pool + thumb_func_end sub_80247BC + + thumb_func_start sub_80247D4 +sub_80247D4: @ 80247D4 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0xC + adds r6, r0, 0 + mov r8, r2 + adds r4, r3, 0 + ldr r5, [sp, 0x24] + lsls r6, 24 + lsrs r6, 24 + mov r0, r8 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + lsls r4, 24 + lsrs r4, 24 + lsls r5, 24 + lsrs r5, 24 + ldr r0, =gStringVar1 + mov r9, r0 + movs r2, 0x1 + movs r3, 0x5 + bl ConvertIntToDecimalStringN + str r4, [sp] + str r5, [sp, 0x4] + movs r0, 0 + str r0, [sp, 0x8] + adds r0, r6, 0 + movs r1, 0x1 + mov r2, r9 + mov r3, r8 + 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 sub_80247D4 + + thumb_func_start sub_802482C +sub_802482C: @ 802482C + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0xC + adds r6, r0, 0 + adds r4, r1, 0 + adds r5, r2, 0 + mov r8, r3 + lsls r6, 24 + lsrs r6, 24 + lsls r4, 16 + lsrs r4, 16 + lsls r5, 24 + lsrs r5, 24 + adds r0, r6, 0 + movs r1, 0 + adds r2, r4, 0 + adds r3, r5, 0 + bl SetWindowBorderStyle + ldr r2, =gText_Powder + movs r0, 0x1 + str r0, [sp] + movs r0, 0xFF + str r0, [sp, 0x4] + movs r4, 0 + str r4, [sp, 0x8] + adds r0, r6, 0 + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + str r4, [sp] + adds r0, r6, 0 + mov r1, r8 + movs r2, 0x1A + movs r3, 0x11 + bl sub_80247D4 + add sp, 0xC + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802482C + + thumb_func_start sub_802488C +sub_802488C: @ 802488C + push {lr} + sub sp, 0x4 + bl sub_80247BC + adds r1, r0, 0 + ldr r0, =gUnknown_02022C94 + ldrb r0, [r0] + movs r2, 0 + str r2, [sp] + movs r2, 0x1A + movs r3, 0x11 + bl sub_80247D4 + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_802488C + + thumb_func_start sub_80248B0 +sub_80248B0: @ 80248B0 + push {r4,r5,lr} + sub sp, 0x18 + movs r0, 0x7 + str r0, [sp] + movs r0, 0x4 + str r0, [sp, 0x4] + movs r0, 0xF + str r0, [sp, 0x8] + movs r0, 0x1C + str r0, [sp, 0xC] + add r0, sp, 0x10 + movs r1, 0 + movs r2, 0x1 + movs r3, 0x1 + bl SetWindowTemplateFields + ldr r4, =gUnknown_02022C94 + add r0, sp, 0x10 + bl AddWindow + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0 + bl FillWindowPixelBuffer + ldrb r0, [r4] + bl PutWindowTilemap + ldrb r0, [r4] + ldr r5, =0x0000021d + adds r1, r5, 0 + movs r2, 0xD0 + bl box_border_load_tiles_and_pal + ldrb r4, [r4] + bl sub_80247BC + adds r3, r0, 0 + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0xD + bl sub_802482C + add sp, 0x18 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80248B0 + + thumb_func_start sub_8024918 +sub_8024918: @ 8024918 + push {r4,lr} + ldr r4, =gUnknown_02022C94 + ldrb r0, [r4] + bl ClearWindowTilemap + 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_8024918 + + thumb_func_start sub_802493C +sub_802493C: @ 802493C + push {r4-r6,lr} + adds r5, r1, 0 + lsls r0, 16 + lsrs r6, r0, 16 + ldr r1, =gUnknown_03000DB0 + movs r0, 0 + str r0, [r1] + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _08024A10 + ldr r4, =gUnknown_02022C98 + ldr r0, =0x00003330 + bl AllocZeroed + str r0, [r4] + cmp r0, 0 + beq _08024A10 + bl sub_8024A1C + ldr r0, [r4] + bl sub_8024A30 + ldr r0, [r4] + str r5, [r0] + bl GetMultiplayerId + ldr r1, [r4] + adds r1, 0x28 + strb r0, [r1] + ldr r1, [r4] + ldr r2, =0x000032cc + adds r0, r1, r2 + adds r2, r1, 0 + adds r2, 0x28 + ldrb r3, [r2] + lsls r2, r3, 4 + subs r2, r3 + lsls r2, 2 + adds r1, r2 + ldr r2, =0x000031a0 + adds r1, r2 + movs r2, 0x3C + bl memcpy + ldr r0, [r4] + adds r1, r0, 0 + adds r1, 0x28 + ldrb r1, [r1] + lsls r1, 2 + ldr r2, =0x0000318c + adds r1, r2 + adds r0, r1 + movs r1, 0x64 + muls r1, r6 + ldr r2, =gPlayerParty + adds r1, r2 + bl sub_80261F8 + ldr r0, =sub_8024BC8 + movs r1, 0x1 + bl CreateTask + ldr r0, =sub_80261CC + bl SetMainCallback2 + bl sub_80273F0 + ldr r2, [r4] + adds r0, r2, 0 + adds r0, 0x24 + ldrb r0, [r0] + adds r1, r2, 0 + adds r1, 0x44 + adds r2, 0x48 + bl sub_8026B5C + bl StopMapMusic + ldr r0, =0x0000021e + bl PlayNewMapMusic + b _08024A16 + .pool +_08024A10: + adds r0, r5, 0 + bl SetMainCallback2 +_08024A16: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_802493C + + thumb_func_start sub_8024A1C +sub_8024A1C: @ 8024A1C + push {lr} + bl ResetTasks + bl ResetSpriteData + bl FreeAllSpritePalettes + pop {r0} + bx r0 + thumb_func_end sub_8024A1C + + thumb_func_start sub_8024A30 +sub_8024A30: @ 8024A30 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x28 + adds r2, r0, 0 + movs r0, 0 + strb r0, [r2, 0xC] + strb r0, [r2, 0x10] + strb r0, [r2, 0x14] + strb r0, [r2, 0x18] + strb r0, [r2, 0x1C] + movs r3, 0x8E + lsls r3, 1 + adds r1, r2, r3 + str r0, [r1] + movs r7, 0x90 + lsls r7, 1 + adds r1, r2, r7 + str r0, [r1] + adds r1, r2, 0 + adds r1, 0x30 + strb r0, [r1] + adds r1, 0x10 + strb r0, [r1] + subs r1, 0x4 + strb r0, [r1] + adds r3, 0x10 + adds r1, r2, r3 + str r0, [r1] + movs r5, 0 + adds r1, r2, 0 + adds r1, 0x98 + movs r3, 0 +_08024A76: + adds r0, r1, r5 + strb r3, [r0] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x3 + bls _08024A76 + movs r5, 0 + adds r7, r2, 0 + adds r7, 0xA8 + str r7, [sp] + adds r0, r2, 0 + adds r0, 0xB0 + str r0, [sp, 0xC] + movs r1, 0x4A + adds r1, r2 + mov r10, r1 + movs r3, 0x4C + adds r3, r2 + mov r9, r3 + movs r7, 0x4E + adds r7, r2 + mov r12, r7 + subs r0, 0x60 + str r0, [sp, 0x24] + adds r6, r2, 0 + adds r6, 0x54 + adds r1, r2, 0 + adds r1, 0xD0 + str r1, [sp, 0x1C] + adds r3, r2, 0 + adds r3, 0xDC + str r3, [sp, 0x20] + adds r7, r2, 0 + adds r7, 0xC4 + str r7, [sp, 0x14] + adds r0, 0xA4 + str r0, [sp, 0x4] + adds r1, 0x25 + str r1, [sp, 0x8] + subs r3, 0xBC + str r3, [sp, 0x10] + movs r7, 0x24 + adds r7, r2 + mov r8, r7 + subs r0, 0xC0 + str r0, [sp, 0x18] + movs r3, 0 + movs r1, 0x86 + lsls r1, 1 + adds r4, r2, r1 + movs r7, 0x98 + lsls r7, 1 + adds r2, r7 +_08024AE2: + ldr r1, [sp] + adds r0, r1, r5 + strb r3, [r0] + ldr r7, [sp, 0xC] + adds r0, r7, r5 + strb r3, [r0] + lsls r0, r5, 1 + adds r0, r5 + lsls r0, 2 + mov r7, r10 + adds r1, r7, r0 + strh r3, [r1] + mov r7, r9 + adds r1, r7, r0 + strh r3, [r1] + mov r7, r12 + adds r1, r7, r0 + strh r3, [r1] + ldr r7, [sp, 0x24] + adds r1, r7, r0 + strh r3, [r1] + adds r0, r6, r0 + strh r3, [r0] + adds r0, r4, r5 + strb r3, [r0] + lsls r0, r5, 2 + adds r0, r2, r0 + str r3, [r0] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x4 + bls _08024AE2 + movs r5, 0 + movs r3, 0 + movs r4, 0xFF + ldr r6, [sp, 0x1C] +_08024B2C: + adds r0, r6, r5 + strb r3, [r0] + ldr r1, [sp, 0x20] + adds r0, r1, r5 + strb r3, [r0] + ldr r7, [sp, 0x14] + adds r0, r7, r5 + strb r3, [r0] + lsls r1, r5, 1 + ldr r0, [sp, 0x4] + adds r2, r0, r1 + ldrb r0, [r2] + orrs r0, r4 + strb r0, [r2] + ldr r7, [sp, 0x8] + adds r1, r7, r1 + ldrb r0, [r1] + orrs r0, r4 + strb r0, [r1] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0xA + bls _08024B2C + bl GetMultiplayerId + movs r1, 0 + lsls r0, 24 + cmp r0, 0 + bne _08024B6A + movs r1, 0x1 +_08024B6A: + ldr r0, [sp, 0x10] + strb r1, [r0] + bl GetLinkPlayerCount + mov r1, r8 + strb r0, [r1] + bl GetMultiplayerId + ldr r3, [sp, 0x18] + strb r0, [r3] + movs r5, 0x1 + mov r7, r8 + ldrb r7, [r7] + cmp r5, r7 + bcs _08024BB6 + ldr r7, [sp, 0x18] + mov r6, r8 +_08024B8C: + adds r4, r7, r5 + subs r0, r5, 0x1 + adds r0, r7, r0 + ldrb r0, [r0] + adds r0, 0x1 + strb r0, [r4] + ldrb r2, [r4] + ldrb r1, [r6] + subs r0, r1, 0x1 + cmp r2, r0 + ble _08024BAA + adds r0, r2, 0 + bl __umodsi3 + strb r0, [r4] +_08024BAA: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + ldrb r0, [r6] + cmp r5, r0 + bcc _08024B8C +_08024BB6: + add sp, 0x28 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8024A30 + + thumb_func_start sub_8024BC8 +sub_8024BC8: @ 8024BC8 + push {r4,r5,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r1, r0, 24 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + ldrb r0, [r0, 0xC] + cmp r0, 0x7 + bls _08024BDC + b _08024D34 +_08024BDC: + lsls r0, 2 + ldr r1, =_08024BF0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08024BF0: + .4byte _08024C10 + .4byte _08024C24 + .4byte _08024C4C + .4byte _08024C5A + .4byte _08024C80 + .4byte _08024CD4 + .4byte _08024CE6 + .4byte _08024D10 +_08024C10: + movs r0, 0 + bl SetVBlankCallback + ldr r0, =sub_8025910 + movs r1, 0x4 + bl sub_802620C + b _08024D20 + .pool +_08024C24: + ldr r0, =sub_8025910 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + beq _08024C32 + b _08024D40 +_08024C32: + ldr r4, =gUnknown_02022C98 + ldr r0, [r4] + movs r1, 0xB0 + lsls r1, 1 + adds r0, r1 + bl sub_8029274 + ldr r1, [r4] + b _08024D24 + .pool +_08024C4C: + bl sub_802A770 + cmp r0, 0 + bne _08024D40 + bl sub_8010434 + b _08024D20 +_08024C5A: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08024D40 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _08024D20 + bl sub_800E0E8 + movs r0, 0 + movs r1, 0 + bl sub_800DFB4 + b _08024D20 + .pool +_08024C80: + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x24 + ldrb r5, [r0] + bl sub_80283A8 + movs r4, 0 + cmp r4, r5 + bcs _08024CBA +_08024C92: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x34 + adds r0, r4 + ldrb r2, [r0] + lsls r0, r2, 2 + ldr r3, =0x0000318c + adds r0, r3 + adds r0, r1, r0 + adds r1, 0x24 + ldrb r3, [r1] + adds r1, r4, 0 + bl sub_8028408 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08024C92 +_08024CBA: + ldr r4, =gUnknown_02022C98 + ldr r0, [r4] + adds r0, 0x24 + ldrb r1, [r0] + movs r0, 0 + bl sub_802868C + ldr r1, [r4] + b _08024D24 + .pool +_08024CD4: + bl sub_8028A34 + bl sub_8028A88 + bl sub_8028D44 + bl sub_8028734 + b _08024D20 +_08024CE6: + movs r4, 0x1 + negs r4, r4 + adds r0, r4, 0 + movs r1, 0x10 + movs r2, 0 + bl BlendPalettes + movs r0, 0 + str r0, [sp] + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + ldr r0, =sub_80261E4 + bl SetVBlankCallback + b _08024D20 + .pool +_08024D10: + bl UpdatePaletteFade + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08024D40 +_08024D20: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] +_08024D24: + ldrb r0, [r1, 0xC] + adds r0, 0x1 + strb r0, [r1, 0xC] + b _08024D40 + .pool +_08024D34: + adds r0, r1, 0 + bl DestroyTask + ldr r0, =sub_802589C + bl sub_802621C +_08024D40: + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8024BC8 + + thumb_func_start sub_8024D4C +sub_8024D4C: @ 8024D4C + push {lr} + bl sub_8025D04 + ldr r1, =gUnknown_082F7AC4 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + ldrb r0, [r0, 0x18] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + bl _call_via_r0 + ldr r0, =gUnknown_03000DB0 + ldr r0, [r0] + cmp r0, 0 + bne _08024D70 + bl sub_8026AF4 +_08024D70: + bl sub_8025D50 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8024D4C + + thumb_func_start sub_8024D84 +sub_8024D84: @ 8024D84 + push {lr} + bl sub_8025E0C + ldr r1, =gUnknown_082F7AF4 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + ldrb r0, [r0, 0x18] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + bl _call_via_r0 + ldr r0, =gUnknown_03000DB0 + ldr r0, [r0] + cmp r0, 0 + bne _08024DA8 + bl sub_8026B28 +_08024DA8: + bl sub_8025ED8 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8024D84 + + thumb_func_start sub_8024DBC +sub_8024DBC: @ 8024DBC + push {r4,lr} + ldr r4, =gUnknown_02022C98 + ldr r0, [r4] + ldrb r0, [r0, 0x10] + cmp r0, 0 + beq _08024DD4 + cmp r0, 0x1 + beq _08024DEA + b _08024DF8 + .pool +_08024DD4: + movs r0, 0x1 + bl sub_8028504 + movs r0, 0x1 + bl sub_80292E0 + ldr r1, [r4] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _08024DF8 +_08024DEA: + bl sub_802A770 + cmp r0, 0 + bne _08024DF8 + movs r0, 0x1 + bl sub_8026240 +_08024DF8: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8024DBC + + thumb_func_start sub_8024E00 +sub_8024E00: @ 8024E00 + push {r4,lr} + ldr r4, =gUnknown_02022C98 + ldr r1, [r4] + ldrb r0, [r1, 0x10] + cmp r0, 0 + bne _08024E20 + bl sub_80262C0 + ldr r1, [r4] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _08024E30 + .pool +_08024E20: + movs r0, 0x8C + lsls r0, 1 + adds r1, r0 + movs r0, 0x1 + str r0, [r1] + movs r0, 0x2 + bl sub_8026240 +_08024E30: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8024E00 + + thumb_func_start sub_8024E38 +sub_8024E38: @ 8024E38 + push {r4,lr} + sub sp, 0x4 + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + ldrb r0, [r0, 0x10] + adds r4, r1, 0 + cmp r0, 0x5 + bhi _08024F08 + lsls r0, 2 + ldr r1, =_08024E5C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08024E5C: + .4byte _08024E74 + .4byte _08024E90 + .4byte _08024EA0 + .4byte _08024EC4 + .4byte _08024ED8 + .4byte _08024EF8 +_08024E74: + movs r0, 0 + str r0, [sp] + movs r0, 0x7 + movs r1, 0x8 + movs r2, 0x78 + movs r3, 0x50 + bl sub_802EB24 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08024EF0 + .pool +_08024E90: + bl sub_8010434 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08024EF0 + .pool +_08024EA0: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08024F08 + ldr r2, =gUnknown_02022C98 + ldr r1, [r2] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + movs r3, 0 + strb r0, [r1, 0x10] + ldr r0, [r2] + adds r0, 0x30 + strb r3, [r0] + b _08024F08 + .pool +_08024EC4: + bl sub_802EB84 + cmp r0, 0 + bne _08024F08 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08024EF0 + .pool +_08024ED8: + ldr r1, [r4] + adds r1, 0x30 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x5 + bls _08024F08 + bl sub_8010434 + ldr r1, [r4] +_08024EF0: + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _08024F08 +_08024EF8: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08024F08 + movs r0, 0x3 + bl sub_8026240 +_08024F08: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8024E38 + + thumb_func_start sub_8024F10 +sub_8024F10: @ 8024F10 + push {lr} + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + ldrb r0, [r1, 0x10] + cmp r0, 0 + bne _08024F2E + movs r2, 0x8E + lsls r2, 1 + adds r0, r1, r2 + ldr r0, [r0] + cmp r0, 0 + beq _08024F2E + movs r0, 0x4 + bl sub_8026240 +_08024F2E: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8024F10 + + thumb_func_start sub_8024F38 +sub_8024F38: @ 8024F38 + push {r4,lr} + ldr r4, =gUnknown_02022C98 + ldr r2, [r4] + ldrb r0, [r2, 0x10] + cmp r0, 0 + bne _08024FF6 + adds r0, r2, 0 + adds r0, 0x40 + ldrb r0, [r0] + cmp r0, 0x9 + bhi _08024FE8 + adds r0, r2, 0 + adds r0, 0xA8 + ldrb r0, [r0] + cmp r0, 0 + bne _08024FEE + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _08024F88 + ldr r1, =0x000031cc + adds r0, r2, r1 + ldrb r1, [r0] + cmp r1, 0 + bne _08024FEE + ldr r3, =0x000031d0 + adds r0, r2, r3 + strb r1, [r0] + movs r0, 0x2 + b _08024FC2 + .pool +_08024F88: + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _08024FA8 + ldr r3, =0x000031cc + adds r0, r2, r3 + ldrb r1, [r0] + cmp r1, 0 + bne _08024FEE + adds r3, 0x4 + adds r0, r2, r3 + strb r1, [r0] + movs r0, 0x1 + b _08024FC2 + .pool +_08024FA8: + movs r0, 0x20 + ands r0, r1 + cmp r0, 0 + beq _08024FD4 + ldr r3, =0x000031cc + adds r0, r2, r3 + ldrb r1, [r0] + cmp r1, 0 + bne _08024FEE + adds r3, 0x4 + adds r0, r2, r3 + strb r1, [r0] + movs r0, 0x3 +_08024FC2: + bl sub_8027518 + ldr r1, [r4] + ldr r2, =0x000031cc + adds r1, r2 + strb r0, [r1] + b _08024FEE + .pool +_08024FD4: + movs r0, 0 + bl sub_8027518 + ldr r1, [r4] + ldr r3, =0x000031cc + adds r1, r3 + strb r0, [r1] + b _08024FEE + .pool +_08024FE8: + movs r0, 0xB + bl sub_8026240 +_08024FEE: + bl sub_802671C + bl sub_8025F48 +_08024FF6: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8024F38 + + thumb_func_start sub_8024FFC +sub_8024FFC: @ 8024FFC + push {lr} + ldr r0, =gUnknown_02022C98 + ldr r2, [r0] + adds r0, r2, 0 + adds r0, 0x40 + ldrb r0, [r0] + cmp r0, 0x9 + bhi _080250C4 + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _0802504C + adds r0, r2, 0 + adds r0, 0x28 + ldrb r1, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r0, r2, r0 + ldr r1, =0x000031cc + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _080250CA + ldr r3, =0x000032f8 + adds r1, r2, r3 + movs r0, 0x2 + strb r0, [r1] + b _080250CA + .pool +_0802504C: + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _08025080 + adds r0, r2, 0 + adds r0, 0x28 + ldrb r1, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r0, r2, r0 + ldr r1, =0x000031cc + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _080250CA + ldr r3, =0x000032f8 + adds r1, r2, r3 + movs r0, 0x1 + strb r0, [r1] + b _080250CA + .pool +_08025080: + movs r0, 0x20 + ands r0, r1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, 0 + beq _080250B8 + adds r0, r2, 0 + adds r0, 0x28 + ldrb r1, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r0, r2, r0 + ldr r1, =0x000031cc + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _080250CA + ldr r3, =0x000032f8 + adds r1, r2, r3 + movs r0, 0x3 + strb r0, [r1] + b _080250CA + .pool +_080250B8: + ldr r3, =0x000032f8 + adds r0, r2, r3 + strb r1, [r0] + b _080250CA + .pool +_080250C4: + movs r0, 0xB + bl sub_8026240 +_080250CA: + bl sub_8026044 + pop {r0} + bx r0 + thumb_func_end sub_8024FFC + + thumb_func_start sub_80250D4 +sub_80250D4: @ 80250D4 + push {r4,r5,lr} + bl sub_802671C + bl sub_8025F48 + bl sub_8026C50 + cmp r0, 0x1 + bne _080250F2 + bl sub_80272A4 + movs r0, 0x5 + bl sub_8026240 + b _08025150 +_080250F2: + ldr r0, =gUnknown_02022C98 + ldr r2, [r0] + movs r1, 0x96 + lsls r1, 1 + adds r4, r2, r1 + movs r1, 0x1 + str r1, [r4] + movs r3, 0x1 + adds r1, r2, 0 + adds r1, 0x24 + adds r5, r0, 0 + ldrb r1, [r1] + cmp r3, r1 + bcs _08025150 + movs r1, 0x9A + lsls r1, 1 + adds r0, r2, r1 + ldr r0, [r0] + cmp r0, 0x1 + beq _08025124 + movs r0, 0 + str r0, [r4] + b _08025150 + .pool +_08025124: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + ldr r2, [r5] + adds r0, r2, 0 + adds r0, 0x24 + ldrb r0, [r0] + cmp r3, r0 + bcs _08025150 + lsls r0, r3, 2 + movs r4, 0x98 + lsls r4, 1 + adds r1, r2, r4 + adds r1, r0 + ldr r0, [r1] + cmp r0, 0x1 + beq _08025124 + movs r0, 0x96 + lsls r0, 1 + adds r1, r2, r0 + movs r0, 0 + str r0, [r1] +_08025150: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_80250D4 + + thumb_func_start sub_8025158 +sub_8025158: @ 8025158 + push {lr} + bl sub_8026044 + bl sub_8026C90 + cmp r0, 0x1 + bne _0802516C + movs r0, 0x5 + bl sub_8026240 +_0802516C: + pop {r0} + bx r0 + thumb_func_end sub_8025158 + + thumb_func_start sub_8025170 +sub_8025170: @ 8025170 + push {r4,lr} + bl GetBlockReceivedStatus + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_800A9D8 + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + beq _0802518C + movs r0, 0 + b _08025192 +_0802518C: + bl ResetBlockReceivedFlags + movs r0, 0x1 +_08025192: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8025170 + + thumb_func_start sub_8025198 +sub_8025198: @ 8025198 + push {r4,r5,lr} + ldr r5, =gUnknown_02022C98 + ldr r1, [r5] + ldrb r4, [r1, 0x10] + cmp r4, 0x1 + beq _080251D0 + cmp r4, 0x1 + bgt _080251B4 + cmp r4, 0 + beq _080251BA + b _0802520C + .pool +_080251B4: + cmp r4, 0x2 + beq _080251DC + b _0802520C +_080251BA: + adds r1, 0x4A + movs r0, 0 + movs r2, 0x3C + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _08025226 + ldr r0, [r5] + strb r4, [r0, 0x8] + b _08025202 +_080251D0: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08025226 + b _08025202 +_080251DC: + bl sub_8025170 + cmp r0, 0 + beq _080251EE + ldr r0, [r5] + adds r1, r0, 0 + adds r1, 0x24 + ldrb r1, [r1] + strb r1, [r0, 0x8] +_080251EE: + ldr r2, [r5] + adds r1, r2, 0 + adds r1, 0x24 + ldrb r0, [r2, 0x8] + ldrb r1, [r1] + cmp r0, r1 + bcc _08025226 + ldrb r0, [r2, 0x14] + adds r0, 0x1 + strb r0, [r2, 0x14] +_08025202: + ldr r1, [r5] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _08025226 +_0802520C: + movs r0, 0x1 + bl WaitFanfare + lsls r0, 24 + cmp r0, 0 + beq _08025226 + movs r0, 0x6 + bl sub_8026240 + ldr r0, =0x0000020b + movs r1, 0x4 + bl FadeOutAndPlayNewMapMusic +_08025226: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8025198 + + thumb_func_start sub_8025230 +sub_8025230: @ 8025230 + push {r4,r5,lr} + ldr r5, =gUnknown_02022C98 + ldr r2, [r5] + ldrb r4, [r2, 0x10] + cmp r4, 0x1 + beq _08025274 + cmp r4, 0x1 + bgt _0802524C + cmp r4, 0 + beq _08025252 + b _080252DC + .pool +_0802524C: + cmp r4, 0x2 + beq _08025282 + b _080252DC +_08025252: + ldrb r0, [r2, 0x14] + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, 0x4A + adds r1, r2, r1 + movs r0, 0 + movs r2, 0x3C + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _08025316 + ldr r0, [r5] + strb r4, [r0, 0x8] + ldr r1, [r5] + b _080252CC +_08025274: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08025316 + ldr r1, [r5] + b _080252CC +_08025282: + bl sub_8025170 + cmp r0, 0 + beq _080252B4 + movs r4, 0 + b _080252AA +_0802528E: + ldr r0, [r5] + adds r0, 0x4A + ldr r1, =gBlockRecvBuffer + movs r2, 0x3C + bl memcpy + ldr r1, [r5] + adds r0, r1, 0 + adds r0, 0x24 + ldrb r0, [r0] + strb r0, [r1, 0x8] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 +_080252AA: + ldr r0, [r5] + adds r0, 0x24 + ldrb r0, [r0] + cmp r4, r0 + bcc _0802528E +_080252B4: + ldr r3, =gUnknown_02022C98 + ldr r2, [r3] + adds r1, r2, 0 + adds r1, 0x24 + ldrb r0, [r2, 0x8] + ldrb r1, [r1] + cmp r0, r1 + bcc _08025316 + ldrb r0, [r2, 0x14] + adds r0, 0x1 + strb r0, [r2, 0x14] + ldr r1, [r3] +_080252CC: + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _08025316 + .pool +_080252DC: + movs r0, 0x1 + bl WaitFanfare + lsls r0, 24 + cmp r0, 0 + beq _08025316 + ldr r0, =gUnknown_02022C98 + ldr r2, [r0] + adds r0, r2, 0 + adds r0, 0x28 + ldrb r0, [r0] + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r0, r2, 0 + adds r0, 0x54 + adds r0, r1 + ldrh r1, [r0] + movs r3, 0x8A + lsls r3, 1 + adds r0, r2, r3 + strh r1, [r0] + movs r0, 0x6 + bl sub_8026240 + ldr r0, =0x0000020b + movs r1, 0x4 + bl FadeOutAndPlayNewMapMusic +_08025316: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8025230 + + thumb_func_start sub_8025324 +sub_8025324: @ 8025324 + push {r4,r5,lr} + sub sp, 0x4 + movs r1, 0x1 + mov r0, sp + strb r1, [r0] + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + ldrb r0, [r0, 0x10] + cmp r0, 0x4 + bls _0802533A + b _08025458 +_0802533A: + lsls r0, 2 + ldr r1, =_0802534C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802534C: + .4byte _08025360 + .4byte _08025384 + .4byte _0802539C + .4byte _080253BC + .4byte _080253DC +_08025360: + bl sub_802749C + movs r0, 0x1 + bl sub_80289E8 + bl sub_8028DFC + movs r0, 0x1 + bl sub_8028EC8 + movs r0, 0x2 + bl sub_80292E0 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08025448 + .pool +_08025384: + bl sub_802A770 + cmp r0, 0 + bne _08025466 + movs r0, 0x5 + bl sub_80292E0 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08025448 + .pool +_0802539C: + bl sub_802A794 + mov r1, sp + strb r0, [r1] + movs r0, 0 + movs r2, 0x1 + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _08025466 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08025448 + .pool +_080253BC: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _08025466 + ldr r3, =gUnknown_02022C98 + ldr r1, [r3] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + movs r2, 0 + strb r0, [r1, 0x10] + ldr r0, [r3] + strb r2, [r0, 0x8] + b _08025466 + .pool +_080253DC: + bl sub_8025170 + cmp r0, 0 + beq _08025422 + movs r2, 0 + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + adds r0, 0x24 + ldrb r0, [r0] + cmp r2, r0 + bcs _08025422 + adds r3, r1, 0 + movs r5, 0x86 + lsls r5, 1 + ldr r4, =gBlockRecvBuffer +_080253FA: + ldr r1, [r3] + adds r1, r2, r1 + adds r1, r5 + lsls r0, r2, 8 + adds r0, r4 + ldrb r0, [r0] + strb r0, [r1] + ldr r1, [r3] + adds r0, r1, 0 + adds r0, 0x24 + ldrb r0, [r0] + strb r0, [r1, 0x8] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, [r3] + adds r0, 0x24 + ldrb r0, [r0] + cmp r2, r0 + bcc _080253FA +_08025422: + ldr r4, =gUnknown_02022C98 + ldr r2, [r4] + adds r1, r2, 0 + adds r1, 0x24 + ldrb r0, [r2, 0x8] + ldrb r1, [r1] + cmp r0, r1 + bcc _08025466 + ldrb r0, [r2, 0x14] + adds r0, 0x1 + strb r0, [r2, 0x14] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x77 + bls _08025466 + movs r0, 0x6 + bl sub_80292E0 + ldr r1, [r4] +_08025448: + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _08025466 + .pool +_08025458: + bl sub_802A770 + cmp r0, 0 + bne _08025466 + movs r0, 0x7 + bl sub_8026240 +_08025466: + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8025324 + + thumb_func_start sub_8025470 +sub_8025470: @ 8025470 + push {r4,r5,lr} + sub sp, 0x4 + ldr r4, =gUnknown_02022C98 + ldr r0, [r4] + ldrb r0, [r0, 0x10] + cmp r0, 0x7 + bls _08025480 + b _08025606 +_08025480: + lsls r0, 2 + ldr r1, =_08025494 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08025494: + .4byte _080254B4 + .4byte _080254D4 + .4byte _080254F0 + .4byte _08025504 + .4byte _08025520 + .4byte _0802553C + .4byte _08025564 + .4byte _08025578 +_080254B4: + bl sub_8027748 + ldr r1, =0x00000bb7 + cmp r0, r1 + bls _080254C4 + movs r0, 0x4 + bl sub_80292E0 +_080254C4: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _080255E8 + .pool +_080254D4: + bl sub_802A770 + cmp r0, 0 + beq _080254DE + b _0802563C +_080254DE: + movs r0, 0x3 + bl sub_80292E0 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _080255E8 + .pool +_080254F0: + bl sub_8028FCC + bl sub_80272E8 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _080255E8 + .pool +_08025504: + bl sub_802A794 + lsls r0, 24 + lsrs r0, 24 + mov r1, sp + strb r0, [r1] + cmp r0, 0 + bne _08025516 + b _0802563C +_08025516: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _080255E8 + .pool +_08025520: + bl sub_802A770 + cmp r0, 0 + beq _0802552A + b _0802563C +_0802552A: + movs r0, 0x5 + bl sub_80292E0 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _080255E8 + .pool +_0802553C: + bl sub_802A794 + mov r1, sp + strb r0, [r1] + movs r0, 0 + movs r2, 0x1 + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _0802563C + ldr r2, =gUnknown_02022C98 + ldr r1, [r2] + movs r0, 0 + strb r0, [r1, 0x8] + ldr r1, [r2] + b _080255E8 + .pool +_08025564: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0802563C + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _080255E8 + .pool +_08025578: + bl sub_8025170 + cmp r0, 0 + beq _080255BE + movs r2, 0 + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + adds r0, 0x24 + ldrb r0, [r0] + cmp r2, r0 + bcs _080255BE + adds r3, r1, 0 + movs r5, 0x86 + lsls r5, 1 + ldr r4, =gBlockRecvBuffer +_08025596: + ldr r1, [r3] + adds r1, r2, r1 + adds r1, r5 + lsls r0, r2, 8 + adds r0, r4 + ldrb r0, [r0] + strb r0, [r1] + ldr r1, [r3] + adds r0, r1, 0 + adds r0, 0x24 + ldrb r0, [r0] + strb r0, [r1, 0x8] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, [r3] + adds r0, 0x24 + ldrb r0, [r0] + cmp r2, r0 + bcc _08025596 +_080255BE: + ldr r4, =gUnknown_02022C98 + ldr r2, [r4] + adds r1, r2, 0 + adds r1, 0x24 + ldrb r0, [r2, 0x8] + ldrb r1, [r1] + cmp r0, r1 + bcc _080255F8 + ldrb r0, [r2, 0x14] + adds r0, 0x1 + strb r0, [r2, 0x14] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x77 + bls _0802563C + bl sub_8027608 + movs r0, 0x6 + bl sub_80292E0 + ldr r1, [r4] +_080255E8: + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _0802563C + .pool +_080255F8: + bl sub_8027554 + b _0802563C +_080255FE: + movs r0, 0x8 + bl sub_8026240 + b _0802563C +_08025606: + bl sub_802A770 + cmp r0, 0 + bne _0802563C + movs r2, 0 + ldr r1, [r4] + adds r0, r1, 0 + adds r0, 0x24 + ldrb r0, [r0] + cmp r2, r0 + bcs _08025636 + movs r4, 0x86 + lsls r4, 1 + adds r3, r1, r4 + adds r1, r0, 0 +_08025624: + adds r0, r3, r2 + ldrb r0, [r0] + cmp r0, 0x2 + beq _080255FE + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, r1 + bcc _08025624 +_08025636: + movs r0, 0xA + bl sub_8026240 +_0802563C: + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8025470 + + thumb_func_start sub_8025644 +sub_8025644: @ 8025644 + push {r4,lr} + ldr r4, =gUnknown_02022C98 + ldr r0, [r4] + ldrb r0, [r0, 0x10] + cmp r0, 0x1 + beq _08025672 + cmp r0, 0x1 + bgt _08025660 + cmp r0, 0 + beq _08025666 + b _08025692 + .pool +_08025660: + cmp r0, 0x2 + beq _0802567C + b _08025692 +_08025666: + bl sub_800AC34 + movs r0, 0x7 + bl sub_80292E0 + b _08025688 +_08025672: + bl sub_802A770 + cmp r0, 0 + bne _080256A0 + b _08025688 +_0802567C: + bl sub_802A794 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x5 + bne _080256A0 +_08025688: + ldr r1, [r4] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _080256A0 +_08025692: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _080256A0 + movs r0, 0x9 + bl sub_8026240 +_080256A0: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8025644 + + thumb_func_start sub_80256AC +sub_80256AC: @ 80256AC + push {r4,lr} + sub sp, 0x4 + ldr r4, =gUnknown_02022C98 + ldr r0, [r4] + ldrb r1, [r0, 0x10] + cmp r1, 0x1 + beq _080256E0 + cmp r1, 0x1 + bgt _080256C8 + cmp r1, 0 + beq _080256CE + b _08025728 + .pool +_080256C8: + cmp r1, 0x2 + beq _080256F8 + b _08025728 +_080256CE: + movs r0, 0x1 + negs r0, r0 + str r1, [sp] + movs r1, 0 + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _0802571A +_080256E0: + bl UpdatePaletteFade + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _0802574C + b _0802571A + .pool +_080256F8: + bl sub_8028B80 + bl sub_80287E4 + ldr r0, [r4] + adds r0, 0x24 + ldrb r0, [r0] + bl sub_8028614 + bl sub_8028E84 + ldr r1, =gUnknown_03000DB0 + movs r0, 0x1 + str r0, [r1] + movs r0, 0x8 + bl sub_80292E0 +_0802571A: + ldr r1, [r4] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _0802574C + .pool +_08025728: + bl sub_802A770 + cmp r0, 0 + bne _0802574C + ldr r4, =gUnknown_02022C98 + ldr r0, [r4] + ldr r0, [r0] + bl SetMainCallback2 + ldr r0, [r4] + ldrb r0, [r0, 0x4] + bl DestroyTask + ldr r0, [r4] + bl Free + bl FreeAllWindowBuffers +_0802574C: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80256AC + + thumb_func_start sub_8025758 +sub_8025758: @ 8025758 + push {r4,lr} + sub sp, 0x4 + ldr r4, =gUnknown_02022C98 + ldr r1, [r4] + ldrb r0, [r1, 0x10] + cmp r0, 0x6 + bls _08025768 + b _0802585C +_08025768: + lsls r0, 2 + ldr r1, =_0802577C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802577C: + .4byte _08025798 + .4byte _08025838 + .4byte _080257B0 + .4byte _08025802 + .4byte _08025808 + .4byte _08025818 + .4byte _08025838 +_08025798: + movs r0, 0x9 + bl sub_80292E0 + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _08025848 +_080257B0: + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + b _08025848 +_08025802: + bl StopMapMusic + b _08025848 +_08025808: + ldr r0, =0x0000021e + bl PlayNewMapMusic + bl sub_8028E4C + b _08025848 + .pool +_08025818: + movs r4, 0x1 + negs r4, r4 + adds r0, r4, 0 + movs r1, 0x10 + movs r2, 0 + bl BlendPalettes + movs r0, 0 + str r0, [sp] + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + b _08025848 +_08025838: + bl UpdatePaletteFade + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _0802588C +_08025848: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _0802588C + .pool +_0802585C: + ldrb r0, [r1, 0x4] + bl DestroyTask + ldr r0, =sub_802589C + bl sub_802621C + bl sub_802903C + ldr r0, [r4] + bl sub_8024A30 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _08025882 + ldr r0, [r4] + adds r0, 0x24 + movs r1, 0x1 + strb r1, [r0] +_08025882: + bl sub_80273F0 + movs r0, 0 + bl sub_8028EC8 +_0802588C: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8025758 + + thumb_func_start sub_802589C +sub_802589C: @ 802589C + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + ldrb r0, [r0, 0x10] + adds r4, r1, 0 + cmp r0, 0x1 + beq _080258C8 + cmp r0, 0x1 + bgt _080258BC + cmp r0, 0 + beq _080258C2 + b _080258E0 + .pool +_080258BC: + cmp r0, 0x2 + beq _080258CE + b _080258E0 +_080258C2: + bl sub_8026264 + b _080258D2 +_080258C8: + bl sub_80286E4 + b _080258D6 +_080258CE: + bl sub_8028828 +_080258D2: + cmp r0, 0x1 + bne _08025904 +_080258D6: + ldr r1, [r4] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + b _08025904 +_080258E0: + ldr r0, [r4] + adds r0, 0x20 + ldrb r0, [r0] + cmp r0, 0 + beq _080258F8 + ldr r0, =sub_8024D4C + bl sub_802621C + b _080258FE + .pool +_080258F8: + ldr r0, =sub_8024D84 + bl sub_802621C +_080258FE: + adds r0, r5, 0 + bl DestroyTask +_08025904: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802589C + + thumb_func_start sub_8025910 +sub_8025910: @ 8025910 + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r5, r0, r1 + movs r0, 0 + ldrsh r4, [r5, r0] + cmp r4, 0x1 + beq _0802596C + cmp r4, 0x1 + bgt _08025938 + cmp r4, 0 + beq _0802593E + b _080259E8 + .pool +_08025938: + cmp r4, 0x2 + beq _0802597E + b _080259E8 +_0802593E: + ldr r6, =gUnknown_02022C98 + ldr r1, [r6] + adds r0, r1, 0 + adds r0, 0x28 + ldrb r0, [r0] + lsls r0, 2 + ldr r2, =0x0000318c + adds r0, r2 + adds r1, r0 + movs r0, 0 + movs r2, 0x1 + bl SendBlock + lsls r0, 24 + cmp r0, 0 + beq _080259E8 + ldr r0, [r6] + strb r4, [r0, 0x8] + b _08025976 + .pool +_0802596C: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _080259E8 +_08025976: + ldrh r0, [r5] + adds r0, 0x1 + strh r0, [r5] + b _080259E8 +_0802597E: + bl sub_8025170 + cmp r0, 0 + beq _080259C4 + movs r2, 0 + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + adds r0, 0x24 + ldrb r0, [r0] + cmp r2, r0 + bcs _080259C4 + adds r3, r1, 0 + ldr r5, =gBlockRecvBuffer + ldr r4, =0x0000318c +_0802599A: + ldr r0, [r3] + lsls r1, r2, 2 + adds r1, r0 + adds r1, r4 + lsls r0, r2, 8 + adds r0, r5 + ldrb r0, [r0] + strb r0, [r1] + ldr r1, [r3] + adds r0, r1, 0 + adds r0, 0x24 + ldrb r0, [r0] + strb r0, [r1, 0x8] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, [r3] + adds r0, 0x24 + ldrb r0, [r0] + cmp r2, r0 + bcc _0802599A +_080259C4: + ldr r4, =gUnknown_02022C98 + ldr r0, [r4] + adds r1, r0, 0 + adds r1, 0x24 + ldrb r0, [r0, 0x8] + ldrb r1, [r1] + cmp r0, r1 + bcc _080259E8 + adds r0, r6, 0 + bl DestroyTask + movs r0, 0x6 + bl sub_80292E0 + ldr r1, [r4] + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] +_080259E8: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8025910 + + thumb_func_start sub_80259FC +sub_80259FC: @ 80259FC + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x18 + ldr r6, =gUnknown_02022C98 + ldr r0, [r6] + adds r1, r0, 0 + adds r1, 0x24 + ldrb r7, [r1] + ldr r2, =0x000031a0 + adds r1, r0, r2 + ldr r3, =0x000031cc + adds r2, r0, r3 + ldr r4, =0x00003208 + adds r3, r0, r4 + ldr r5, =0x00003244 + adds r4, r0, r5 + str r4, [sp] + adds r5, 0x3C + adds r4, r0, r5 + str r4, [sp, 0x4] + adds r5, 0x3C + adds r4, r0, r5 + str r4, [sp, 0x8] + adds r4, r0, 0 + adds r4, 0x40 + str r4, [sp, 0xC] + movs r5, 0x90 + lsls r5, 1 + adds r4, r0, r5 + str r4, [sp, 0x10] + movs r4, 0x96 + lsls r4, 1 + adds r0, r4 + str r0, [sp, 0x14] + movs r0, 0 + bl sub_8028164 + ldr r1, [r6] + ldr r5, =0x000031b0 + adds r2, r1, r5 + str r0, [r2] + movs r0, 0x94 + lsls r0, 1 + adds r1, r0 + movs r0, 0x1 + strb r0, [r1] + movs r5, 0x1 + cmp r5, r7 + bcs _08025AA4 +_08025A60: + ldr r1, [r6] + adds r0, r1, 0 + adds r0, 0xA8 + adds r0, r5 + ldrb r0, [r0] + cmp r0, 0 + bne _08025A9A + lsls r0, r5, 4 + subs r0, r5 + lsls r4, r0, 2 + adds r1, r4, r1 + ldr r2, =0x000031cc + adds r1, r2 + adds r0, r5, 0 + bl sub_8028318 + adds r1, r0, 0 + cmp r1, 0 + bne _08025A9A + ldr r0, [r6] + adds r0, r4 + ldr r3, =0x000031cc + adds r0, r3 + strb r1, [r0] + ldr r0, [r6] + movs r4, 0x94 + lsls r4, 1 + adds r0, r4 + strb r1, [r0] +_08025A9A: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, r7 + bcc _08025A60 +_08025AA4: + ldr r5, =gUnknown_02022C98 + ldr r1, [r5] + movs r6, 0x92 + lsls r6, 1 + adds r1, r6 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3B + bls _08025B02 + ldr r1, [r5] + movs r2, 0x94 + lsls r2, 1 + adds r0, r1, r2 + ldrb r4, [r0] + cmp r4, 0 + beq _08025AF0 + bl sub_8011AC8 + ldr r0, [r5] + adds r0, r6 + movs r1, 0 + strb r1, [r0] + b _08025B02 + .pool +_08025AF0: + adds r0, r1, r6 + ldrb r0, [r0] + cmp r0, 0x46 + bls _08025B02 + bl sub_8011AC8 + ldr r0, [r5] + adds r0, r6 + strb r4, [r0] +_08025B02: + movs r5, 0 + cmp r5, r7 + bcs _08025BF6 + ldr r3, =0x000031cc + mov r12, r3 + ldr r4, =gUnknown_02022C98 + mov r8, r4 +_08025B10: + mov r6, r8 + ldr r2, [r6] + lsls r0, r5, 4 + subs r1, r0, r5 + lsls r1, 2 + adds r1, r2, r1 + add r1, r12 + ldrb r1, [r1] + adds r6, r0, 0 + cmp r1, 0 + beq _08025B36 + adds r0, r2, 0 + adds r0, 0xA8 + adds r1, r0, r5 + ldrb r0, [r1] + cmp r0, 0 + bne _08025B36 + movs r0, 0x1 + strb r0, [r1] +_08025B36: + adds r3, r4, 0 + ldr r1, [r3] + adds r0, r1, 0 + adds r0, 0xA8 + adds r0, r5 + ldrb r0, [r0] + cmp r0, 0x3 + bgt _08025B54 + cmp r0, 0x1 + bge _08025B5A + b _08025BEC + .pool +_08025B54: + cmp r0, 0x4 + beq _08025BA8 + b _08025BEC +_08025B5A: + adds r1, 0xB0 + adds r1, r5 + ldrb r0, [r1] + adds r0, 0x1 + movs r2, 0 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x5 + bls _08025BEC + ldr r0, [r3] + adds r0, 0xB0 + adds r0, r5 + strb r2, [r0] + ldr r0, [r3] + adds r0, 0xA8 + adds r0, r5 + strb r2, [r0] + ldr r0, [r3] + subs r1, r6, r5 + lsls r1, 2 + adds r0, r1 + add r0, r12 + strb r2, [r0] + ldr r0, [r3] + adds r0, r1 + ldr r6, =0x000031d0 + adds r0, r6 + strb r2, [r0] + ldr r0, [r3] + adds r0, r1 + ldr r1, =0x000031d4 + adds r0, r1 + b _08025BEA + .pool +_08025BA8: + adds r1, 0xB0 + adds r1, r5 + ldrb r0, [r1] + adds r0, 0x1 + movs r2, 0 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x27 + bls _08025BEC + ldr r0, [r4] + adds r0, 0xB0 + adds r0, r5 + strb r2, [r0] + ldr r0, [r4] + adds r0, 0xA8 + adds r0, r5 + strb r2, [r0] + ldr r0, [r4] + subs r1, r6, r5 + lsls r1, 2 + adds r0, r1 + add r0, r12 + strb r2, [r0] + ldr r0, [r4] + adds r0, r1 + ldr r3, =0x000031d0 + adds r0, r3 + strb r2, [r0] + ldr r0, [r4] + adds r0, r1 + ldr r6, =0x000031d4 + adds r0, r6 +_08025BEA: + strb r2, [r0] +_08025BEC: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, r7 + bcc _08025B10 +_08025BF6: + add sp, 0x18 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80259FC + + thumb_func_start sub_8025C0C +sub_8025C0C: @ 8025C0C + push {r4-r7,lr} + sub sp, 0x18 + ldr r5, =gUnknown_02022C98 + ldr r0, [r5] + adds r1, r0, 0 + adds r1, 0x24 + ldrb r6, [r1] + ldr r2, =0x000031a0 + adds r1, r0, r2 + ldr r3, =0x000031cc + adds r2, r0, r3 + ldr r4, =0x00003208 + adds r3, r0, r4 + ldr r7, =0x00003244 + adds r4, r0, r7 + str r4, [sp] + adds r7, 0x3C + adds r4, r0, r7 + str r4, [sp, 0x4] + adds r7, 0x3C + adds r4, r0, r7 + str r4, [sp, 0x8] + adds r4, r0, 0 + adds r4, 0x40 + str r4, [sp, 0xC] + movs r7, 0x90 + lsls r7, 1 + adds r4, r0, r7 + str r4, [sp, 0x10] + movs r4, 0x96 + lsls r4, 1 + adds r0, r4 + str r0, [sp, 0x14] + movs r0, 0 + bl sub_8028164 + ldr r1, [r5] + ldr r7, =0x000031b0 + adds r2, r1, r7 + str r0, [r2] + movs r0, 0x94 + lsls r0, 1 + adds r1, r0 + movs r0, 0x1 + strb r0, [r1] + movs r4, 0x1 + cmp r4, r6 + bcs _08025C9C +_08025C6C: + adds r0, r4, 0 + bl sub_8028374 + cmp r0, 0 + beq _08025C92 + ldr r0, =gUnknown_02022C98 + ldr r2, [r0] + lsls r1, r4, 2 + movs r3, 0x98 + lsls r3, 1 + adds r0, r2, r3 + adds r0, r1 + movs r1, 0x1 + str r1, [r0] + movs r7, 0x94 + lsls r7, 1 + adds r1, r2, r7 + movs r0, 0 + strb r0, [r1] +_08025C92: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r6 + bcc _08025C6C +_08025C9C: + ldr r5, =gUnknown_02022C98 + ldr r1, [r5] + movs r6, 0x92 + lsls r6, 1 + adds r1, r6 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3B + bls _08025CFA + ldr r1, [r5] + movs r2, 0x94 + lsls r2, 1 + adds r0, r1, r2 + ldrb r4, [r0] + cmp r4, 0 + beq _08025CE8 + bl sub_8011AC8 + ldr r0, [r5] + adds r0, r6 + movs r1, 0 + strb r1, [r0] + b _08025CFA + .pool +_08025CE8: + adds r0, r1, r6 + ldrb r0, [r0] + cmp r0, 0x46 + bls _08025CFA + bl sub_8011AC8 + ldr r0, [r5] + adds r0, r6 + strb r4, [r0] +_08025CFA: + add sp, 0x18 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8025C0C + + thumb_func_start sub_8025D04 +sub_8025D04: @ 8025D04 + push {r4,r5,lr} + ldr r5, =gUnknown_02022C98 + ldr r0, [r5] + ldrb r0, [r0, 0x18] + cmp r0, 0x4 + beq _08025D40 + cmp r0, 0x4 + bgt _08025D20 + cmp r0, 0x3 + beq _08025D26 + b _08025D4A + .pool +_08025D20: + cmp r0, 0xB + beq _08025D46 + b _08025D4A +_08025D26: + bl sub_8026BB8 + adds r4, r0, 0 + cmp r4, 0x1 + bne _08025D4A + bl sub_8026C28 + ldr r0, [r5] + movs r1, 0x8E + lsls r1, 1 + adds r0, r1 + str r4, [r0] + b _08025D4A +_08025D40: + bl sub_80259FC + b _08025D4A +_08025D46: + bl sub_8025C0C +_08025D4A: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8025D04 + + thumb_func_start sub_8025D50 +sub_8025D50: @ 8025D50 + push {r4-r6,lr} + sub sp, 0x14 + ldr r0, =gUnknown_02022C98 + ldr r5, [r0] + ldrb r0, [r5, 0x18] + cmp r0, 0x4 + beq _08025D68 + cmp r0, 0xB + beq _08025DB8 + b _08025DF4 + .pool +_08025D68: + ldr r1, =0x000032cc + adds r0, r5, r1 + ldr r2, =0x000031cc + adds r1, r5, r2 + ldr r3, =0x00003208 + adds r2, r5, r3 + ldr r4, =0x00003244 + adds r3, r5, r4 + movs r6, 0xCA + lsls r6, 6 + adds r4, r5, r6 + str r4, [sp] + adds r6, 0x3C + adds r4, r5, r6 + str r4, [sp, 0x4] + adds r4, r5, 0 + adds r4, 0x40 + ldrb r4, [r4] + str r4, [sp, 0x8] + movs r6, 0x90 + lsls r6, 1 + adds r4, r5, r6 + ldr r4, [r4] + str r4, [sp, 0xC] + adds r6, 0xC + adds r4, r5, r6 + ldr r4, [r4] + str r4, [sp, 0x10] + bl sub_8027E30 + b _08025DF4 + .pool +_08025DB8: + ldr r1, =0x000032cc + adds r0, r5, r1 + ldr r2, =0x000031cc + adds r1, r5, r2 + ldr r3, =0x00003208 + adds r2, r5, r3 + ldr r4, =0x00003244 + adds r3, r5, r4 + movs r6, 0xCA + lsls r6, 6 + adds r4, r5, r6 + str r4, [sp] + adds r6, 0x3C + adds r4, r5, r6 + str r4, [sp, 0x4] + adds r4, r5, 0 + adds r4, 0x40 + ldrb r4, [r4] + str r4, [sp, 0x8] + movs r6, 0x90 + lsls r6, 1 + adds r4, r5, r6 + ldr r4, [r4] + str r4, [sp, 0xC] + adds r6, 0xC + adds r4, r5, r6 + ldr r4, [r4] + str r4, [sp, 0x10] + bl sub_8027E30 +_08025DF4: + add sp, 0x14 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8025D50 + + thumb_func_start sub_8025E0C +sub_8025E0C: @ 8025E0C + push {r4-r6,lr} + sub sp, 0x18 + ldr r0, =gUnknown_02022C98 + ldr r5, [r0] + ldrb r0, [r5, 0x18] + cmp r0, 0x4 + beq _08025E24 + cmp r0, 0xB + beq _08025E7C + b _08025EC0 + .pool +_08025E24: + adds r0, r5, 0 + adds r0, 0x28 + ldrb r0, [r0] + lsls r1, r0, 4 + subs r1, r0 + lsls r1, 2 + ldr r2, =0x000031a0 + adds r1, r2 + adds r1, r5, r1 + ldr r3, =0x000031cc + adds r2, r5, r3 + ldr r4, =0x00003208 + adds r3, r5, r4 + ldr r6, =0x00003244 + adds r4, r5, r6 + str r4, [sp] + adds r6, 0x3C + adds r4, r5, r6 + str r4, [sp, 0x4] + adds r6, 0x3C + adds r4, r5, r6 + str r4, [sp, 0x8] + adds r4, r5, 0 + adds r4, 0x40 + str r4, [sp, 0xC] + movs r6, 0x90 + lsls r6, 1 + adds r4, r5, r6 + str r4, [sp, 0x10] + adds r6, 0xC + adds r4, r5, r6 + str r4, [sp, 0x14] + bl sub_8028164 + b _08025EC0 + .pool +_08025E7C: + adds r0, r5, 0 + adds r0, 0x28 + ldrb r0, [r0] + lsls r1, r0, 4 + subs r1, r0 + lsls r1, 2 + ldr r2, =0x000031a0 + adds r1, r2 + adds r1, r5, r1 + ldr r3, =0x000031cc + adds r2, r5, r3 + ldr r4, =0x00003208 + adds r3, r5, r4 + ldr r6, =0x00003244 + adds r4, r5, r6 + str r4, [sp] + adds r6, 0x3C + adds r4, r5, r6 + str r4, [sp, 0x4] + adds r6, 0x3C + adds r4, r5, r6 + str r4, [sp, 0x8] + adds r4, r5, 0 + adds r4, 0x40 + str r4, [sp, 0xC] + movs r6, 0x90 + lsls r6, 1 + adds r4, r5, r6 + str r4, [sp, 0x10] + adds r6, 0xC + adds r4, r5, r6 + str r4, [sp, 0x14] + bl sub_8028164 +_08025EC0: + add sp, 0x18 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8025E0C + + thumb_func_start sub_8025ED8 +sub_8025ED8: @ 8025ED8 + push {r4,lr} + ldr r4, =gUnknown_02022C98 + ldr r1, [r4] + ldrb r0, [r1, 0x18] + cmp r0, 0x4 + beq _08025F0E + cmp r0, 0x4 + bgt _08025EF4 + cmp r0, 0x3 + beq _08025EFA + b _08025F40 + .pool +_08025EF4: + cmp r0, 0xB + beq _08025F24 + b _08025F40 +_08025EFA: + movs r0, 0x1 + bl sub_8027DD0 + ldr r0, [r4] + movs r1, 0x8E + lsls r1, 1 + adds r0, r1 + movs r1, 0x1 + str r1, [r0] + b _08025F40 +_08025F0E: + ldr r2, =0x000032f8 + adds r1, r2 + ldrb r0, [r1] + cmp r0, 0 + beq _08025F40 + bl sub_80282EC + b _08025F40 + .pool +_08025F24: + movs r2, 0x90 + lsls r2, 1 + adds r0, r1, r2 + ldr r0, [r0] + cmp r0, 0 + bne _08025F40 + adds r2, 0xC + adds r0, r1, r2 + ldr r0, [r0] + cmp r0, 0 + bne _08025F40 + movs r0, 0x1 + bl sub_8028350 +_08025F40: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8025ED8 + + thumb_func_start sub_8025F48 +sub_8025F48: @ 8025F48 + push {r4-r6,lr} + ldr r6, =gUnknown_02022C98 + ldr r2, [r6] + adds r0, r2, 0 + adds r0, 0x28 + ldrb r1, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r1, r2, r0 + ldr r3, =0x000031cc + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, 0 + bne _08025F88 + bl IsSEPlaying + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + bne _08025FEA + ldr r0, [r6] + movs r2, 0xA2 + lsls r2, 1 + adds r0, r2 + strb r1, [r0] + b _08025FEA + .pool +_08025F88: + ldr r3, =0x000031d0 + adds r0, r1, r3 + ldrb r4, [r0] + cmp r4, 0x1 + bne _08025FB8 + movs r1, 0xA2 + lsls r1, 1 + adds r0, r2, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _08025FEA + movs r0, 0x1F + bl m4aSongNumStop + movs r0, 0x1F + bl PlaySE + ldr r0, [r6] + movs r2, 0xA2 + lsls r2, 1 + adds r0, r2 + b _08025FE8 + .pool +_08025FB8: + ldr r3, =0x000031d4 + adds r0, r1, r3 + ldrb r4, [r0] + cmp r4, 0x1 + bne _08025FEA + movs r5, 0xA2 + lsls r5, 1 + adds r0, r2, r5 + ldrb r0, [r0] + cmp r0, 0 + bne _08025FEA + bl IsSEPlaying + lsls r0, 24 + cmp r0, 0 + bne _08025FEA + movs r0, 0x16 + bl PlaySE + movs r0, 0x1 + bl sub_80284CC + ldr r0, [r6] + adds r0, r5 +_08025FE8: + strb r4, [r0] +_08025FEA: + ldr r0, =gUnknown_02022C98 + ldr r2, [r0] + movs r5, 0xAA + lsls r5, 1 + adds r1, r2, r5 + ldrb r1, [r1] + adds r4, r0, 0 + cmp r1, 0 + bne _0802601C + adds r0, r2, 0 + adds r0, 0x40 + ldrb r0, [r0] + cmp r0, 0x9 + bls _0802601C + bl StopMapMusic + ldr r0, [r4] + adds r0, r5 + movs r1, 0x1 + b _0802603A + .pool +_0802601C: + ldr r0, [r4] + movs r1, 0xAA + lsls r1, 1 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x1 + bne _0802603C + movs r0, 0xB + bl PlayFanfareByFanfareNum + ldr r0, [r4] + movs r2, 0xAA + lsls r2, 1 + adds r0, r2 + movs r1, 0x2 +_0802603A: + strb r1, [r0] +_0802603C: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8025F48 + + thumb_func_start sub_8026044 +sub_8026044: @ 8026044 + push {r4-r7,lr} + mov r7, r8 + push {r7} + ldr r6, =gUnknown_02022C98 + ldr r2, [r6] + adds r0, r2, 0 + adds r0, 0x44 + ldrb r0, [r0] + mov r8, r0 + adds r0, r2, 0 + adds r0, 0x48 + ldrb r7, [r0] + subs r0, 0x20 + ldrb r1, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r1, r2, r0 + ldr r3, =0x000031cc + adds r0, r1, r3 + ldrb r3, [r0] + cmp r3, 0 + bne _0802609C + ldr r4, =0x000031d0 + adds r0, r1, r4 + ldrb r0, [r0] + cmp r0, 0x1 + beq _080260FE + adds r4, 0x4 + adds r0, r1, r4 + ldrb r0, [r0] + cmp r0, 0x1 + beq _080260FE + movs r1, 0xA2 + lsls r1, 1 + adds r0, r2, r1 + strb r3, [r0] + b _080260FE + .pool +_0802609C: + ldr r3, =0x000031d0 + adds r0, r1, r3 + ldrb r4, [r0] + cmp r4, 0x1 + bne _080260CC + movs r1, 0xA2 + lsls r1, 1 + adds r0, r2, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _080260FE + movs r0, 0x1F + bl m4aSongNumStop + movs r0, 0x1F + bl PlaySE + ldr r0, [r6] + movs r3, 0xA2 + lsls r3, 1 + adds r0, r3 + b _080260FC + .pool +_080260CC: + ldr r4, =0x000031d4 + adds r0, r1, r4 + ldrb r4, [r0] + cmp r4, 0x1 + bne _080260FE + movs r5, 0xA2 + lsls r5, 1 + adds r0, r2, r5 + ldrb r0, [r0] + cmp r0, 0 + bne _080260FE + bl IsSEPlaying + lsls r0, 24 + cmp r0, 0 + bne _080260FE + movs r0, 0x16 + bl PlaySE + movs r0, 0x1 + bl sub_80284CC + ldr r0, [r6] + adds r0, r5 +_080260FC: + strb r4, [r0] +_080260FE: + mov r4, r8 + cmp r4, r7 + bcs _08026172 + ldr r5, =gUnknown_02022C98 +_08026106: + ldr r2, [r5] + adds r0, r2, 0 + adds r0, 0x28 + ldrb r1, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + ldr r1, =0x000031a0 + adds r0, r1 + adds r0, r2, r0 + adds r1, r0, 0 + adds r1, 0x14 + adds r0, 0x1F + adds r0, r4 + ldrb r0, [r0] + cmp r0, 0x9 + bls _0802615C + movs r3, 0xA4 + lsls r3, 1 + adds r0, r2, r3 + adds r0, r4 + ldrb r0, [r0] + cmp r0, 0 + bne _08026168 + adds r0, r1, r4 + ldrb r0, [r0] + adds r0, 0x4A + bl PlaySE + ldr r0, [r5] + movs r1, 0xA4 + lsls r1, 1 + adds r0, r1 + adds r0, r4 + movs r1, 0x1 + b _08026166 + .pool +_0802615C: + movs r3, 0xA4 + lsls r3, 1 + adds r0, r2, r3 + adds r0, r4 + movs r1, 0 +_08026166: + strb r1, [r0] +_08026168: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r7 + bcc _08026106 +_08026172: + ldr r0, =gUnknown_02022C98 + ldr r2, [r0] + movs r5, 0xAA + lsls r5, 1 + adds r1, r2, r5 + ldrb r1, [r1] + adds r4, r0, 0 + cmp r1, 0 + bne _080261A0 + adds r0, r2, 0 + adds r0, 0x40 + ldrb r0, [r0] + cmp r0, 0x9 + bls _080261A0 + bl StopMapMusic + ldr r0, [r4] + adds r0, r5 + movs r1, 0x1 + b _080261BE + .pool +_080261A0: + ldr r0, [r4] + movs r1, 0xAA + lsls r1, 1 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x1 + bne _080261C0 + movs r0, 0xB + bl PlayFanfareByFanfareNum + ldr r0, [r4] + movs r3, 0xAA + lsls r3, 1 + adds r0, r3 + movs r1, 0x2 +_080261BE: + strb r1, [r0] +_080261C0: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8026044 + + thumb_func_start sub_80261CC +sub_80261CC: @ 80261CC + push {lr} + bl RunTasks + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade + pop {r0} + bx r0 + thumb_func_end sub_80261CC + + thumb_func_start sub_80261E4 +sub_80261E4: @ 80261E4 + push {lr} + bl TransferPlttBuffer + bl LoadOam + bl ProcessSpriteCopyRequests + pop {r0} + bx r0 + thumb_func_end sub_80261E4 + + thumb_func_start sub_80261F8 +sub_80261F8: @ 80261F8 + push {r4,lr} + adds r4, r0, 0 + adds r0, r1, 0 + bl IsMonShiny + strb r0, [r4] + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_80261F8 + + thumb_func_start sub_802620C +sub_802620C: @ 802620C + push {lr} + lsls r1, 24 + lsrs r1, 24 + bl CreateTask + pop {r0} + bx r0 + thumb_func_end sub_802620C + + thumb_func_start sub_802621C +sub_802621C: @ 802621C + push {lr} + movs r1, 0x1 + bl CreateTask + ldr r1, =gUnknown_02022C98 + ldr r3, [r1] + movs r2, 0 + strb r0, [r3, 0x4] + ldr r0, [r1] + strb r2, [r0, 0x10] + ldr r0, [r1] + strb r2, [r0, 0xC] + ldr r0, [r1] + strb r2, [r0, 0x14] + pop {r0} + bx r0 + .pool + thumb_func_end sub_802621C + + thumb_func_start sub_8026240 +sub_8026240: @ 8026240 + push {r4,lr} + ldr r2, =gUnknown_02022C98 + ldr r1, [r2] + ldrb r3, [r1, 0x18] + movs r4, 0 + strb r3, [r1, 0x1C] + ldr r1, [r2] + strb r0, [r1, 0x18] + ldr r0, [r2] + strb r4, [r0, 0x10] + ldr r0, [r2] + strb r4, [r0, 0x14] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8026240 + + thumb_func_start sub_8026264 +sub_8026264: @ 8026264 + push {r4,lr} + ldr r3, =gUnknown_02022C98 + ldr r1, [r3] + ldrb r0, [r1, 0x14] + lsrs r2, r0, 2 + adds r0, 0x1 + strb r0, [r1, 0x14] + cmp r2, 0 + beq _080262B8 + ldr r3, [r3] + ldrb r0, [r3, 0x14] + movs r1, 0x3 + ands r0, r1 + cmp r0, 0 + bne _080262B8 + ldr r1, =gUnknown_082F7A94 + adds r0, r3, 0 + adds r0, 0x24 + ldrb r0, [r0] + subs r0, 0x1 + adds r0, r1 + ldrb r0, [r0] + cmp r2, r0 + bcc _080262A0 + movs r0, 0x1 + b _080262BA + .pool +_080262A0: + lsls r4, r2, 3 + adds r1, r4, 0 + movs r0, 0x14 + bl SetGpuReg + negs r4, r4 + lsls r4, 16 + lsrs r4, 16 + movs r0, 0x18 + adds r1, r4, 0 + bl SetGpuReg +_080262B8: + movs r0, 0 +_080262BA: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8026264 + + thumb_func_start sub_80262C0 +sub_80262C0: @ 80262C0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + ldr r2, =gUnknown_02022C98 + ldr r0, [r2] + adds r1, r0, 0 + adds r1, 0x44 + adds r0, 0x48 + ldrb r5, [r0] + ldrb r1, [r1] + cmp r1, r5 + bcs _0802630C + mov r8, r2 + ldr r0, =0x000032e0 + mov r12, r0 + movs r7, 0 + movs r6, 0x1 +_080262E2: + mov r2, r8 + ldr r0, [r2] + mov r2, r12 + adds r4, r0, r2 + ldr r2, =0x000032eb + adds r0, r2 + adds r2, r0, r1 + movs r3, 0 + adds r0, r1, 0 + ands r0, r6 + cmp r0, 0 + bne _080262FC + movs r3, 0x1 +_080262FC: + strb r3, [r2] + adds r0, r4, r1 + strb r7, [r0] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, r5 + bcc _080262E2 +_0802630C: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80262C0 + + 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} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 24 + lsrs r3, r1, 24 + lsls r2, 24 + lsrs r6, r2, 24 + movs r7, 0 + ldr r2, =gUnknown_02022C98 + ldr r1, [r2] + adds r0, r1, 0 + adds r0, 0x24 + ldrb r0, [r0] + subs r0, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =0x000032e0 + adds r1, r0 + mov r12, r2 + cmp r3, 0x2 + beq _08026670 + cmp r3, 0x2 + bgt _08026676 + cmp r3, 0x1 + beq _08026674 + b _08026676 + .pool +_08026670: + movs r7, 0x1 + b _08026676 +_08026674: + movs r7, 0x2 +_08026676: + adds r0, r1, 0 + adds r0, 0xB + adds r0, r6 + ldrb r0, [r0] + subs r0, 0x6 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _080266D4 + ldr r0, =gUnknown_082F449C+0x113 + lsls r1, r4, 1 + adds r1, r4 + adds r1, r7, r1 + lsls r2, r5, 4 + subs r2, r5 + adds r1, r2 + adds r1, r0 + ldrb r1, [r1] + cmp r6, r1 + bne _0802670A + mov r0, r12 + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0xC4 + adds r0, r6 + ldrb r0, [r0] + subs r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _080266D0 + lsls r0, r4, 4 + subs r0, r4 + lsls r0, 2 + adds r0, r1, r0 + ldr r1, =0x000031d4 + adds r0, r1 + movs r1, 0x1 + strb r1, [r0] + b _0802670A + .pool +_080266D0: + movs r0, 0x1 + b _0802670C +_080266D4: + ldr r0, =gUnknown_082F449C+0x113 + lsls r1, r4, 1 + adds r1, r4 + adds r1, r7, r1 + lsls r2, r5, 4 + subs r2, r5 + adds r1, r2 + adds r1, r0 + ldrb r1, [r1] + cmp r6, r1 + bne _0802670A + mov r1, r12 + ldr r0, [r1] + adds r0, 0xA8 + adds r0, r4 + movs r1, 0x4 + strb r1, [r0] + mov r0, r12 + ldr r1, [r0] + lsls r0, r4, 4 + subs r0, r4 + lsls r0, 2 + adds r1, r0 + ldr r0, =0x000031d4 + adds r1, r0 + movs r0, 0x1 + strb r0, [r1] +_0802670A: + movs r0, 0 +_0802670C: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8026634 + + thumb_func_start sub_802671C +sub_802671C: @ 802671C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + ldr r2, =gUnknown_02022C98 + ldr r4, [r2] + adds r0, r4, 0 + adds r0, 0x44 + ldrb r1, [r0] + adds r0, 0x4 + ldrb r0, [r0] + mov r9, r0 + movs r3, 0 + mov r10, r3 + movs r5, 0x90 + lsls r5, 1 + adds r0, r4, r5 + str r3, [r0] + adds r5, r1, 0 + mov r0, r9 + subs r0, 0x1 + cmp r5, r0 + blt _0802674E + b _08026974 +_0802674E: + mov r8, r2 +_08026750: + mov r0, r8 + ldr r4, [r0] + adds r0, r4, 0 + adds r0, 0xC4 + adds r0, r5 + ldrb r0, [r0] + cmp r0, 0x1 + bls _08026762 + b _0802686C +_08026762: + movs r1, 0x90 + lsls r1, 1 + adds r0, r4, r1 + movs r2, 0x1 + str r2, [r0] + ldr r1, =0x000032eb + adds r0, r4, r1 + adds r6, r0, r5 + ldrb r0, [r6] + cmp r0, 0x9 + bls _080267FC + movs r7, 0 + movs r0, 0xA + strb r0, [r6] + mov r1, r8 + ldr r0, [r1] + adds r0, 0xC4 + adds r0, r5 + movs r1, 0x3 + strb r1, [r0] + mov r1, r8 + ldr r0, [r1] + movs r6, 0xA4 + lsls r6, 1 + adds r0, r6 + adds r1, r0, r5 + ldrb r0, [r1] + cmp r0, 0 + bne _080267AC + strb r2, [r1] + ldr r2, =0x000032e0 + adds r0, r4, r2 + adds r0, r5 + ldrb r0, [r0] + adds r0, 0x4A + bl PlaySE +_080267AC: + mov r0, r8 + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x40 + ldrb r0, [r0] + cmp r0, 0x9 + bls _080267C2 + mov r2, r10 + cmp r2, 0x1 + beq _080267C2 + b _08026964 +_080267C2: + movs r0, 0x1 + mov r10, r0 + adds r0, r1, r6 + adds r0, r5 + strb r7, [r0] + mov r1, r8 + ldr r0, [r1] + adds r1, r0, 0 + adds r1, 0x40 + ldrb r0, [r1] + cmp r0, 0x9 + bhi _080267DE + adds r0, 0x1 + strb r0, [r1] +_080267DE: + movs r0, 0x3 + adds r1, r5, 0 + movs r2, 0 + bl sub_8026F1C + movs r0, 0 + bl sub_8027234 + b _08026964 + .pool +_080267FC: + adds r0, r5, 0 + bl sub_8026D8C + mov r2, r8 + ldr r7, [r2] + lsls r0, 24 + lsrs r0, 24 + adds r1, r7, 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 _08026822 + movs r3, 0x2 +_08026822: + ldr r2, =gUnknown_082F7A88 + ldr r0, =0x000032e0 + adds r1, r4, r0 + adds r1, r5 + lsls r0, r3, 1 + adds r0, r3 + ldrb r1, [r1] + adds r0, r1 + adds r0, r2 + ldrb r2, [r0] + adds r1, r7, 0 + adds r1, 0xD0 + adds r1, r5 + ldrb r0, [r1] + adds r0, 0x1 + movs r3, 0 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, r2 + bcc _0802685C + ldrb r0, [r6] + adds r0, 0x1 + strb r0, [r6] + mov r1, r8 + ldr r0, [r1] + adds r0, 0xD0 + adds r0, r5 + strb r3, [r0] +_0802685C: + bl sub_8026324 + b _08026964 + .pool +_0802686C: + cmp r0, 0x2 + bne _080268F4 + movs r2, 0x90 + lsls r2, 1 + adds r0, r4, r2 + movs r6, 0x1 + str r6, [r0] + adds r1, r4, 0 + adds r1, 0xDC + adds r1, r5 + ldrb r0, [r1] + adds r0, 0x1 + movs r3, 0 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x13 + bls _08026964 + mov r0, r8 + ldr r2, [r0] + adds r0, r2, 0 + adds r0, 0xB8 + adds r0, r5 + ldrb r1, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r2, r0 + ldr r1, =0x000031d0 + adds r2, r1 + strb r3, [r2] + mov r2, r8 + ldr r0, [r2] + adds r0, 0xDC + adds r0, r5 + strb r3, [r0] + ldr r0, [r2] + adds r0, 0xD0 + adds r0, r5 + strb r3, [r0] + ldr r0, [r2] + adds r0, 0xC4 + adds r0, r5 + strb r3, [r0] + ldr r1, =0x000032eb + adds r0, r4, r1 + adds r0, r5 + strb r6, [r0] + adds r0, r5, 0 + bl sub_8026D8C + lsls r0, 24 + lsrs r0, 24 + adds r1, r5, 0 + bl sub_8026DB0 + ldr r2, =0x000032e0 + adds r1, r4, r2 + adds r1, r5 + strb r0, [r1] + b _08026964 + .pool +_080268F4: + cmp r0, 0x3 + bne _08026964 + adds r1, r4, 0 + adds r1, 0xDC + adds r1, r5 + ldrb r0, [r1] + adds r0, 0x1 + movs r2, 0 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x13 + bls _08026964 + mov r0, r8 + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x40 + ldrb r0, [r0] + cmp r0, 0x9 + bhi _08026964 + adds r0, r1, 0 + adds r0, 0xDC + adds r0, r5 + strb r2, [r0] + mov r1, r8 + ldr r0, [r1] + adds r0, 0xD0 + adds r0, r5 + strb r2, [r0] + ldr r0, [r1] + adds r0, 0xC4 + adds r0, r5 + strb r2, [r0] + ldr r2, =0x000032eb + adds r0, r4, r2 + adds r0, r5 + movs r1, 0x1 + strb r1, [r0] + mov r0, r8 + ldr r1, [r0] + adds r1, 0xE8 + adds r1, r5 + subs r2, 0xB + adds r4, r2 + adds r4, r5 + ldrb r0, [r4] + strb r0, [r1] + adds r0, r5, 0 + bl sub_8026D8C + lsls r0, 24 + lsrs r0, 24 + adds r1, r5, 0 + bl sub_8026DB0 + strb r0, [r4] +_08026964: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + mov r0, r9 + subs r0, 0x1 + cmp r5, r0 + bge _08026974 + b _08026750 +_08026974: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802671C + + thumb_func_start sub_8026988 +sub_8026988: @ 8026988 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x44 + adds r0, 0x48 + ldrb r0, [r0] + mov r8, r0 + ldrb r6, [r1] + cmp r6, r8 + bcs _08026A7A + ldr r0, =gUnknown_082F449C + mov r9, r0 +_080269A8: + ldr r0, =gUnknown_02022C98 + ldr r3, [r0] + adds r0, r3, 0 + adds r0, 0x28 + ldrb r1, [r0] + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + ldr r2, =0x000031a0 + adds r0, r2 + adds r7, r3, r0 + movs r0, 0xB + adds r2, r1, 0 + muls r2, r0 + adds r2, r6, r2 + adds r3, 0x24 + ldrb r1, [r3] + subs r1, 0x1 + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 3 + subs r0, r1 + adds r2, r0 + add r2, r9 + ldrb r4, [r2] + adds r0, r7, 0 + adds r0, 0x1F + adds r0, r4 + ldrb r0, [r0] + cmp r0, 0 + beq _080269FC + adds r0, r6, 0 + movs r1, 0 + bl sub_8028BF8 + b _08026A04 + .pool +_080269FC: + adds r0, r6, 0 + movs r1, 0x1 + bl sub_8028BF8 +_08026A04: + adds r0, r7, 0 + adds r0, 0x1F + adds r5, r0, r4 + ldrb r0, [r5] + cmp r0, 0x9 + bls _08026A30 + adds r0, r7, 0 + adds r0, 0x14 + adds r0, r4 + ldrb r1, [r0] + adds r1, 0x3 + lsls r1, 24 + lsrs r1, 24 + adds r0, r6, 0 + bl sub_8028CA4 + ldrb r1, [r5] + lsls r1, 25 + movs r0, 0xFF + lsls r0, 24 + adds r1, r0 + b _08026A52 +_08026A30: + adds r0, r7, 0 + adds r0, 0x14 + adds r3, r0, r4 + ldrb r0, [r3] + cmp r0, 0x3 + bne _08026A5C + movs r0, 0x7 + strb r0, [r5] + adds r0, r6, 0 + movs r1, 0x6 + bl sub_8028CA4 + ldrb r1, [r5] + lsls r1, 25 + movs r2, 0xFF + lsls r2, 24 + adds r1, r2 +_08026A52: + lsrs r1, 24 + adds r0, r6, 0 + bl sub_8028C7C + b _08026A70 +_08026A5C: + ldrb r1, [r3] + adds r0, r6, 0 + bl sub_8028CA4 + ldrb r1, [r5] + lsls r1, 25 + lsrs r1, 24 + adds r0, r6, 0 + bl sub_8028C7C +_08026A70: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, r8 + bcc _080269A8 +_08026A7A: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8026988 + + thumb_func_start sub_8026A88 +sub_8026A88: @ 8026A88 + push {r4-r6,lr} + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + adds r0, 0x24 + ldrb r5, [r0] + movs r4, 0 + cmp r4, r5 + bcs _08026ABA + adds r6, r1, 0 +_08026A9A: + lsls r0, r4, 4 + subs r0, r4 + lsls r0, 2 + ldr r1, [r6] + adds r0, r1 + ldr r1, =0x000031cc + adds r0, r1 + ldrb r1, [r0] + adds r0, r4, 0 + bl sub_80286B4 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08026A9A +_08026ABA: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8026A88 + + thumb_func_start sub_8026AC8 +sub_8026AC8: @ 8026AC8 + push {r4,r5,lr} + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x24 + ldrb r5, [r0] + movs r4, 0 + cmp r4, r5 + bcs _08026AEA +_08026AD8: + adds r0, r4, 0 + movs r1, 0x4 + bl sub_80286B4 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08026AD8 +_08026AEA: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8026AC8 + + thumb_func_start sub_8026AF4 +sub_8026AF4: @ 8026AF4 + push {lr} + bl sub_8026988 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x40 + ldrb r0, [r0] + cmp r0, 0x9 + bls _08026B10 + bl sub_8026AC8 + b _08026B14 + .pool +_08026B10: + bl sub_8026A88 +_08026B14: + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x40 + ldrb r0, [r0] + bl sub_80288D4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8026AF4 + + thumb_func_start sub_8026B28 +sub_8026B28: @ 8026B28 + push {lr} + bl sub_8026988 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x40 + ldrb r0, [r0] + cmp r0, 0x9 + bls _08026B44 + bl sub_8026AC8 + b _08026B48 + .pool +_08026B44: + bl sub_8026A88 +_08026B48: + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x40 + ldrb r0, [r0] + bl sub_80288D4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8026B28 + + thumb_func_start sub_8026B5C +sub_8026B5C: @ 8026B5C + push {lr} + adds r3, r1, 0 + lsls r0, 24 + lsrs r0, 24 + subs r0, 0x1 + cmp r0, 0x4 + bhi _08026BB4 + lsls r0, 2 + ldr r1, =_08026B78 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08026B78: + .4byte _08026B8C + .4byte _08026B94 + .4byte _08026B9C + .4byte _08026BA4 + .4byte _08026BAC +_08026B8C: + movs r0, 0x4 + strb r0, [r3] + movs r0, 0x7 + b _08026BB2 +_08026B94: + movs r0, 0x3 + strb r0, [r3] + movs r0, 0x8 + b _08026BB2 +_08026B9C: + movs r0, 0x2 + strb r0, [r3] + movs r0, 0x9 + b _08026BB2 +_08026BA4: + movs r0, 0x1 + strb r0, [r3] + movs r0, 0xA + b _08026BB2 +_08026BAC: + movs r0, 0 + strb r0, [r3] + movs r0, 0xB +_08026BB2: + strb r0, [r2] +_08026BB4: + pop {r0} + bx r0 + thumb_func_end sub_8026B5C + + thumb_func_start sub_8026BB8 +sub_8026BB8: @ 8026BB8 + push {r4-r6,lr} + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + adds r0, 0x24 + ldrb r5, [r0] + movs r4, 0x1 + cmp r4, r5 + bcs _08026C1E + adds r6, r1, 0 +_08026BCA: + ldr r0, [r6] + movs r1, 0xAC + lsls r1, 1 + adds r0, r1 + adds r0, r4 + ldrb r0, [r0] + cmp r0, 0 + bne _08026BEC + adds r0, r4, 0 + bl sub_8027DFC + ldr r1, [r6] + movs r2, 0xAC + lsls r2, 1 + adds r1, r2 + adds r1, r4 + strb r0, [r1] +_08026BEC: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08026BCA + cmp r4, r5 + bcs _08026C1E + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + movs r2, 0xAC + lsls r2, 1 + adds r1, r0, r2 +_08026C04: + adds r0, r1, r4 + ldrb r0, [r0] + cmp r0, 0 + bne _08026C14 + movs r0, 0 + b _08026C20 + .pool +_08026C14: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08026C04 +_08026C1E: + movs r0, 0x1 +_08026C20: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8026BB8 + + thumb_func_start sub_8026C28 +sub_8026C28: @ 8026C28 + push {r4,lr} + movs r1, 0 + ldr r4, =gUnknown_02022C98 + movs r3, 0xAC + lsls r3, 1 + movs r2, 0 +_08026C34: + ldr r0, [r4] + adds r0, r3 + adds r0, r1 + strb r2, [r0] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x4 + bls _08026C34 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8026C28 + + thumb_func_start sub_8026C50 +sub_8026C50: @ 8026C50 + push {r4,lr} + ldr r3, =gUnknown_02022C98 + ldr r1, [r3] + adds r2, r1, 0 + adds r2, 0x40 + ldrb r0, [r2] + cmp r0, 0x9 + bls _08026C88 + movs r4, 0x90 + lsls r4, 1 + adds r0, r1, r4 + ldr r0, [r0] + cmp r0, 0 + bne _08026C88 + movs r0, 0xA + strb r0, [r2] + ldr r0, [r3] + movs r1, 0x96 + lsls r1, 1 + adds r0, r1 + ldr r0, [r0] + cmp r0, 0 + beq _08026C88 + movs r0, 0x1 + b _08026C8A + .pool +_08026C88: + movs r0, 0 +_08026C8A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8026C50 + + thumb_func_start sub_8026C90 +sub_8026C90: @ 8026C90 + push {r4-r6,lr} + ldr r4, =gUnknown_02022C98 + ldr r1, [r4] + adds r2, r1, 0 + adds r2, 0x40 + ldrb r0, [r2] + cmp r0, 0x9 + bls _08026D14 + adds r0, r1, 0 + adds r0, 0x44 + ldrb r3, [r0] + adds r0, 0x4 + ldrb r5, [r0] + movs r0, 0xA + strb r0, [r2] + ldr r4, [r4] + mov r12, r4 + movs r0, 0x96 + lsls r0, 1 + add r0, r12 + ldr r0, [r0] + cmp r0, 0 + beq _08026D14 + adds r4, r3, 0 + cmp r4, r5 + bcs _08026D04 + mov r0, r12 + adds r0, 0x28 + ldrb r3, [r0] + lsls r1, r3, 4 + subs r1, r3 + lsls r1, 2 + ldr r6, =gUnknown_082F449C + subs r0, 0x4 + ldrb r2, [r0] + subs r2, 0x1 + add r1, r12 + movs r0, 0xB + muls r3, r0 + lsls r0, r2, 3 + subs r0, r2 + lsls r0, 3 + subs r2, r0, r2 + ldr r0, =0x000031bf + adds r1, r0 +_08026CEA: + adds r0, r4, r3 + adds r0, r2 + adds r0, r6 + ldrb r0, [r0] + adds r0, r1, r0 + ldrb r0, [r0] + cmp r0, 0xA + bne _08026D14 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08026CEA +_08026D04: + movs r0, 0x1 + b _08026D16 + .pool +_08026D14: + movs r0, 0 +_08026D16: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8026C90 + + thumb_func_start sub_8026D1C +sub_8026D1C: @ 8026D1C + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + ldr r0, =gUnknown_082F7A9C + mov r8, r0 + ldr r0, =gUnknown_02022C98 + ldr r6, [r0] + adds r0, r6, 0 + adds r0, 0x90 + adds r0, r5 + mov r9, r0 + ldrb r7, [r0] + adds r0, r7, 0 + movs r1, 0x7 + bl __umodsi3 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + add r4, r8 + adds r0, r7, 0 + movs r1, 0x7 + bl __udivsi3 + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldrb r4, [r4] + adds r0, r4 + lsls r0, 24 + lsls r5, 1 + adds r6, 0x86 + adds r6, r5 + ldrh r1, [r6] + lsrs r0, 24 + cmp r1, r0 + bcc _08026D76 + adds r0, r7, 0x1 + mov r1, r9 + strb r0, [r1] +_08026D76: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8026D1C + + thumb_func_start sub_8026D8C +sub_8026D8C: @ 8026D8C + lsls r0, 24 + lsrs r0, 24 + ldr r3, =gUnknown_082F449C+0x1AC + ldr r1, =gUnknown_02022C98 + ldr r1, [r1] + adds r1, 0x24 + ldrb r1, [r1] + subs r1, 0x1 + movs r2, 0xB + muls r1, r2 + adds r0, r1 + adds r0, r3 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_8026D8C + + thumb_func_start sub_8026DB0 +sub_8026DB0: @ 8026DB0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r5, r1, 24 + ldr r4, =gUnknown_02022C98 + ldr r1, [r4] + adds r1, 0x24 + ldrb r2, [r1] + subs r2, 0x1 + lsls r2, 24 + lsrs r2, 24 + ldr r3, =gUnknown_082F449C+0x15E + lsls r1, r0, 1 + adds r1, r0 + lsls r0, r2, 4 + subs r0, r2 + adds r1, r0 + adds r0, r1, r3 + ldrb r0, [r0] + mov r12, r0 + adds r0, r3, 0x1 + adds r0, r1, r0 + ldrb r7, [r0] + adds r3, 0x2 + adds r1, r3 + ldrb r1, [r1] + mov r8, r1 + movs r3, 0 + ldr r1, =gUnknown_082F449C+0x1E3 + lsls r0, r2, 2 + adds r2, r0, r2 + adds r0, r2, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _08026E18 + adds r6, r1, 0 +_08026DFE: + adds r0, r3, r2 + adds r0, r6 + ldrb r0, [r0] + cmp r5, r0 + beq _08026E3C + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + adds r0, r3, r2 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _08026DFE +_08026E18: + ldr r0, [r4] + adds r0, 0x90 + mov r1, r12 + adds r2, r0, r1 + adds r1, r0, r7 + ldrb r0, [r2] + ldrb r3, [r1] + cmp r0, r3 + bls _08026E46 + adds r1, r0, 0 + b _08026E48 + .pool +_08026E3C: + ldr r0, [r4] + adds r0, 0x90 + adds r0, r7 + ldrb r0, [r0] + b _08026E5A +_08026E46: + ldrb r1, [r1] +_08026E48: + ldr r0, [r4] + adds r0, 0x90 + mov r2, r8 + adds r4, r0, r2 + ldrb r0, [r4] + cmp r0, r1 + bls _08026E58 + adds r1, r0, 0 +_08026E58: + adds r0, r1, 0 +_08026E5A: + adds r1, r5, 0 + bl sub_8026E70 + lsls r0, 24 + lsrs r0, 24 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8026DB0 + + thumb_func_start sub_8026E70 +sub_8026E70: @ 8026E70 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r2, =gUnknown_02022C98 + ldr r2, [r2] + adds r2, 0xE8 + adds r2, r1 + ldrb r4, [r2] + movs r1, 0x7 + bl __umodsi3 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x6 + bhi _08026EDE + lsls r0, 2 + ldr r1, =_08026EA4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08026EA4: + .4byte _08026EDE + .4byte _08026ED6 + .4byte _08026EE2 + .4byte _08026EC0 + .4byte _08026EC6 + .4byte _08026ECC + .4byte _08026ED2 +_08026EC0: + cmp r4, 0 + beq _08026ED6 + b _08026EDE +_08026EC6: + cmp r4, 0 + beq _08026EE2 + b _08026EDE +_08026ECC: + cmp r4, 0x2 + beq _08026ED6 + b _08026EE2 +_08026ED2: + cmp r4, 0 + bne _08026EDA +_08026ED6: + movs r0, 0x1 + b _08026EE4 +_08026EDA: + cmp r4, 0x1 + beq _08026EE2 +_08026EDE: + movs r0, 0 + b _08026EE4 +_08026EE2: + movs r0, 0x2 +_08026EE4: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8026E70 + + thumb_func_start sub_8026EEC +sub_8026EEC: @ 8026EEC + push {r4-r6,lr} + movs r6, 0 + movs r5, 0 + adds r4, r0, 0 + b _08026EFE +_08026EF6: + ldrh r0, [r4, 0x6] + adds r6, r0 + adds r4, 0xC + adds r5, 0x1 +_08026EFE: + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + cmp r5, r0 + blt _08026EF6 + cmp r6, 0xA + bgt _08026F12 + movs r0, 0 + b _08026F14 +_08026F12: + movs r0, 0x1 +_08026F14: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8026EEC + + thumb_func_start sub_8026F1C +sub_8026F1C: @ 8026F1C + push {r4-r6,lr} + lsls r0, 24 + lsrs r3, r0, 24 + lsls r1, 24 + lsrs r4, r1, 24 + lsls r2, 24 + lsrs r2, 24 + ldr r6, =gUnknown_02022C98 + ldr r1, [r6] + adds r0, r1, 0 + adds r0, 0x24 + ldrb r5, [r0] + cmp r3, 0 + bge _08026F3A + b _0802722C +_08026F3A: + cmp r3, 0x2 + ble _08026F48 + cmp r3, 0x3 + beq _08026F78 + b _0802722C + .pool +_08026F48: + ldr r3, =0x000031b4 + adds r0, r1, r3 + adds r0, r4 + ldrb r4, [r0] + lsls r4, 1 + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r4, r0 + adds r0, r1, 0 + adds r0, 0x4A + adds r0, r4 + ldrh r0, [r0] + ldr r1, =0x00004e20 + bl sub_8027A28 + ldr r1, [r6] + adds r1, 0x4A + adds r1, r4 + b _0802722A + .pool +_08026F78: + adds r0, r1, 0 + adds r0, 0x4A + bl sub_8026EEC + cmp r0, 0 + beq _08026F86 + b _0802722C +_08026F86: + cmp r5, 0x3 + bne _08026F8C + b _08027154 +_08026F8C: + cmp r5, 0x3 + bgt _08026F98 + cmp r5, 0x2 + bne _08026F96 + b _080271E8 +_08026F96: + b _0802722C +_08026F98: + cmp r5, 0x4 + bne _08026F9E + b _08027090 +_08026F9E: + cmp r5, 0x5 + beq _08026FA4 + b _0802722C +_08026FA4: + cmp r4, 0x9 + bls _08026FAA + b _0802722C +_08026FAA: + lsls r0, r4, 2 + ldr r1, =_08026FB8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08026FB8: + .4byte _08026FE0 + .4byte _08026FF8 + .4byte _08027004 + .4byte _0802701C + .4byte _08027028 + .4byte _08027040 + .4byte _0802704C + .4byte _08027060 + .4byte _0802706C + .4byte _08027084 +_08026FE0: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x68 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x74 + b _08027226 + .pool +_08026FF8: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x74 + b _08027226 + .pool +_08027004: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x74 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x80 + b _08027226 + .pool +_0802701C: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x80 + b _08027226 + .pool +_08027028: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x80 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x50 + b _08027226 + .pool +_08027040: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x50 + b _08027226 + .pool +_0802704C: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x50 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + b _08027224 + .pool +_08027060: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08027224 + .pool +_0802706C: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x5C + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x68 + b _08027226 + .pool +_08027084: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x68 + b _08027226 + .pool +_08027090: + subs r0, r4, 0x1 + cmp r0, 0x7 + bls _08027098 + b _0802722C +_08027098: + lsls r0, 2 + ldr r1, =_080270A8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080270A8: + .4byte _080270C8 + .4byte _080270E0 + .4byte _080270EC + .4byte _08027104 + .4byte _08027110 + .4byte _08027124 + .4byte _08027130 + .4byte _08027148 +_080270C8: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x68 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x74 + b _08027226 + .pool +_080270E0: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x74 + b _08027226 + .pool +_080270EC: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x74 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x50 + b _08027226 + .pool +_08027104: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x50 + b _08027226 + .pool +_08027110: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x50 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + b _08027224 + .pool +_08027124: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08027224 + .pool +_08027130: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x5C + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x68 + b _08027226 + .pool +_08027148: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x68 + b _08027226 + .pool +_08027154: + subs r0, r4, 0x2 + cmp r0, 0x5 + bhi _0802722C + lsls r0, 2 + ldr r1, =_08027168 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08027168: + .4byte _08027180 + .4byte _08027198 + .4byte _080271A4 + .4byte _080271BC + .4byte _080271C8 + .4byte _080271DC +_08027180: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x5C + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x68 + b _08027226 + .pool +_08027198: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x68 + b _08027226 + .pool +_080271A4: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x68 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + adds r1, 0x50 + b _08027226 + .pool +_080271BC: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x50 + b _08027226 + .pool +_080271C8: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r2, r1, 0 + adds r2, 0x50 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + b _08027224 + .pool +_080271DC: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + b _08027224 + .pool +_080271E8: + cmp r4, 0x4 + beq _0802720E + cmp r4, 0x4 + bgt _080271F6 + cmp r4, 0x3 + beq _08027200 + b _0802722C +_080271F6: + cmp r4, 0x5 + beq _08027214 + cmp r4, 0x6 + beq _08027222 + b _0802722C +_08027200: + ldr r1, [r6] + adds r2, r1, 0 + adds r2, 0x50 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + b _08027224 +_0802720E: + ldr r1, [r6] + adds r1, 0x50 + b _08027226 +_08027214: + ldr r1, [r6] + adds r2, r1, 0 + adds r2, 0x50 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + b _08027224 +_08027222: + ldr r1, [r6] +_08027224: + adds r1, 0x5C +_08027226: + ldrh r0, [r1] + adds r0, 0x1 +_0802722A: + strh r0, [r1] +_0802722C: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8026F1C + + thumb_func_start sub_8027234 +sub_8027234: @ 8027234 + push {r4,r5,lr} + adds r1, r0, 0 + ldr r4, =gUnknown_02022C98 + ldr r3, [r4] + adds r0, r3, 0 + adds r0, 0x24 + ldrb r0, [r0] + cmp r0, 0x5 + bne _0802729E + cmp r1, 0x1 + bne _08027280 + movs r5, 0x89 + lsls r5, 1 + adds r1, r3, r5 + ldrh r0, [r1] + adds r2, r0, 0x1 + strh r2, [r1] + movs r0, 0x8A + lsls r0, 1 + adds r1, r3, r0 + lsls r0, r2, 16 + lsrs r0, 16 + ldrh r3, [r1] + cmp r0, r3 + bls _08027268 + strh r2, [r1] +_08027268: + ldr r0, [r4] + adds r2, r0, r5 + ldrh r0, [r2] + ldr r1, =0x0000270f + cmp r0, r1 + bls _0802729E + strh r1, [r2] + b _0802729E + .pool +_08027280: + movs r2, 0x89 + lsls r2, 1 + adds r0, r3, r2 + movs r5, 0x8A + lsls r5, 1 + adds r1, r3, r5 + ldrh r0, [r0] + ldrh r3, [r1] + cmp r0, r3 + bls _08027296 + strh r0, [r1] +_08027296: + ldr r0, [r4] + adds r0, r2 + movs r1, 0 + strh r1, [r0] +_0802729E: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8027234 + + thumb_func_start sub_80272A4 +sub_80272A4: @ 80272A4 + push {r4,r5,lr} + movs r3, 0 + ldr r2, =gUnknown_02022C98 + ldr r0, [r2] + adds r0, 0x24 + ldrb r0, [r0] + cmp r3, r0 + bcs _080272DC + adds r5, r2, 0 + movs r4, 0x8A + lsls r4, 1 +_080272BA: + ldr r2, [r5] + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 2 + adds r1, r2, 0 + adds r1, 0x54 + adds r1, r0 + adds r0, r2, r4 + ldrh r0, [r0] + strh r0, [r1] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + adds r2, 0x24 + ldrb r2, [r2] + cmp r3, r2 + bcc _080272BA +_080272DC: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80272A4 + + thumb_func_start sub_80272E8 +sub_80272E8: @ 80272E8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + movs r5, 0 + ldr r7, =gUnknown_02022C98 + movs r4, 0 + ldr r0, =0x000031bf + mov r10, r0 +_080272FC: + movs r2, 0 + lsls r6, r5, 4 + lsls r1, r5, 1 + mov r8, r1 + lsls r0, r5, 3 + mov r12, r0 + adds r1, r5, 0x1 + mov r9, r1 + subs r0, r6, r5 + lsls r3, r0, 2 +_08027310: + ldr r0, [r7] + adds r1, r2, r3 + add r0, r10 + adds r0, r1 + strb r4, [r0] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xA + bls _08027310 + ldr r0, [r7] + subs r1, r6, r5 + lsls r1, 2 + adds r0, r1 + ldr r2, =0x000031cc + adds r0, r2 + strb r4, [r0] + ldr r0, [r7] + adds r0, r1 + ldr r1, =0x000031d0 + adds r0, r1 + strb r4, [r0] + ldr r0, [r7] + adds r0, 0x90 + adds r0, r5 + strb r4, [r0] + ldr r1, [r7] + adds r0, r1, 0 + adds r0, 0x86 + add r0, r8 + strh r4, [r0] + add r1, r12 + ldr r2, =0x00003308 + adds r1, r2 + strb r4, [r1] + ldr r2, [r7] + ldr r1, =0x0000330c + adds r0, r2, r1 + add r0, r12 + str r4, [r0] + mov r0, r8 + adds r1, r0, r5 + lsls r1, 2 + adds r0, r2, 0 + adds r0, 0x4A + adds r0, r1 + strh r4, [r0] + adds r0, r2, 0 + adds r0, 0x4C + adds r0, r1 + strh r4, [r0] + adds r0, r2, 0 + adds r0, 0x4E + adds r0, r1 + strh r4, [r0] + adds r0, r2, 0 + adds r0, 0x50 + adds r0, r1 + strh r4, [r0] + adds r0, r2, 0 + adds r0, 0x52 + adds r0, r1 + strh r4, [r0] + adds r0, r2, 0 + adds r0, 0x54 + adds r0, r1 + strh r4, [r0] + mov r1, r9 + lsls r0, r1, 24 + lsrs r5, r0, 24 + cmp r5, 0x4 + bls _080272FC + ldr r2, =gUnknown_02022C98 + ldr r0, [r2] + movs r1, 0xAA + lsls r1, 1 + adds r0, r1 + movs r2, 0 + strb r2, [r0] + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + movs r1, 0x89 + lsls r1, 1 + adds r3, r0, r1 + movs r1, 0 + strh r2, [r3] + adds r0, 0x40 + strb r1, [r0] + bl sub_8026A88 + bl sub_8026988 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80272E8 + + thumb_func_start sub_80273F0 +sub_80273F0: @ 80273F0 + push {r4,r5,lr} + movs r4, 0 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x24 + ldrb r0, [r0] + cmp r0, 0x4 + beq _0802740C + cmp r0, 0x5 + beq _08027410 + b _08027412 + .pool +_0802740C: + movs r4, 0x1 + b _08027412 +_08027410: + movs r4, 0x2 +_08027412: + bl Random + lsls r0, 16 + lsrs r0, 16 + movs r1, 0xA + bl __umodsi3 + lsls r0, 24 + lsrs r0, 24 + movs r3, 0 + lsls r1, r4, 2 + ldr r5, =gUnknown_02022C98 + ldr r2, =gUnknown_082F7AA4 + adds r1, r4 + lsls r1, 1 + adds r0, r1 + adds r0, r2 + ldrb r2, [r0] +_08027436: + ldr r1, [r5] + lsls r0, r3, 1 + adds r0, r3 + lsls r0, 2 + adds r1, 0x52 + adds r1, r0 + strh r2, [r1] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x4 + bls _08027436 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80273F0 + + thumb_func_start sub_802745C +sub_802745C: @ 802745C + push {lr} + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnknown_02022C98 + ldr r2, [r1] + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r0, r2, 0 + adds r0, 0x4A + adds r0, r1 + ldrh r3, [r0] + adds r0, r2, 0 + adds r0, 0x4C + adds r0, r1 + ldrh r0, [r0] + adds r2, 0x4E + adds r2, r1 + adds r3, r0 + ldrh r2, [r2] + adds r0, r3, r2 + ldr r1, =0x0000270f + cmp r0, r1 + bls _0802748E + adds r0, r1, 0 +_0802748E: + pop {r1} + bx r1 + .pool + thumb_func_end sub_802745C + + thumb_func_start sub_802749C +sub_802749C: @ 802749C + push {r4-r6,lr} + ldr r5, =gUnknown_02022C98 + ldr r0, [r5] + adds r0, 0x28 + ldrb r0, [r0] + bl sub_802745C + ldr r1, =0x0000270f + bl sub_8027A38 + adds r4, r0, 0 + ldr r0, [r5] + adds r0, 0x28 + ldrb r0, [r0] + bl sub_80276C0 + ldr r1, =0x000f4236 + bl sub_8027A38 + adds r2, r0, 0 + ldr r3, =gSaveBlock2Ptr + ldr r0, [r3] + movs r6, 0x83 + lsls r6, 2 + adds r1, r0, r6 + ldr r0, [r1] + cmp r0, r2 + bcs _080274D6 + str r2, [r1] +_080274D6: + ldr r0, [r3] + movs r2, 0x84 + lsls r2, 2 + adds r1, r0, r2 + ldrh r0, [r1] + cmp r0, r4 + bcs _080274E6 + strh r4, [r1] +_080274E6: + ldr r0, [r3] + ldr r6, =0x00000212 + adds r2, r0, r6 + ldr r0, [r5] + movs r1, 0x8A + lsls r1, 1 + adds r0, r1 + ldrh r1, [r0] + ldrh r0, [r2] + cmp r0, r1 + bcs _080274FE + strh r1, [r2] +_080274FE: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802749C + + thumb_func_start sub_8027518 +sub_8027518: @ 8027518 + push {r4-r7,lr} + lsls r0, 24 + lsrs r7, r0, 24 + ldr r1, =gUnknown_02022C98 + ldr r0, [r1] + adds r0, 0x9B + ldrb r6, [r0] + movs r3, 0x3 + adds r5, r1, 0 + adds r4, r5, 0 +_0802752C: + ldr r0, [r4] + adds r0, 0x98 + adds r2, r0, r3 + subs r1, r3, 0x1 + adds r0, r1 + ldrb r0, [r0] + strb r0, [r2] + lsls r1, 24 + lsrs r3, r1, 24 + cmp r3, 0 + bne _0802752C + ldr r0, [r5] + adds r0, 0x98 + strb r7, [r0] + adds r0, r6, 0 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8027518 + + thumb_func_start sub_8027554 +sub_8027554: @ 8027554 + push {r4,lr} + ldr r4, =gUnknown_02022C98 + ldr r3, [r4] + adds r0, r3, 0 + adds r0, 0x28 + ldrb r1, [r0] + adds r0, 0x88 + adds r2, r0, r1 + ldrb r0, [r2] + cmp r0, 0 + bne _080275FC + ldr r0, =gMain + ldrh r2, [r0, 0x2E] + movs r0, 0x40 + ands r0, r2 + cmp r0, 0 + beq _08027594 + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r0, r3, r0 + ldr r1, =0x000031cc + adds r0, r1 + movs r1, 0x2 + b _080275CA + .pool +_08027594: + movs r0, 0x20 + ands r0, r2 + cmp r0, 0 + beq _080275B0 + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r0, r3, r0 + ldr r1, =0x000031cc + adds r0, r1 + movs r1, 0x3 + b _080275CA + .pool +_080275B0: + movs r0, 0x10 + ands r0, r2 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, 0 + beq _080275E8 + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r0, r3, r0 + ldr r1, =0x000031cc + adds r0, r1 + movs r1, 0x1 +_080275CA: + strb r1, [r0] + ldr r0, [r4] + adds r1, r0, 0 + adds r1, 0x28 + adds r0, 0xB0 + ldrb r1, [r1] + adds r0, r1 + movs r1, 0x6 + strb r1, [r0] + movs r0, 0xD4 + bl PlaySE + b _08027600 + .pool +_080275E8: + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 2 + adds r0, r3, r0 + ldr r1, =0x000031cc + adds r0, r1 + strb r2, [r0] + b _08027600 + .pool +_080275FC: + subs r0, 0x1 + strb r0, [r2] +_08027600: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8027554 + + thumb_func_start sub_8027608 +sub_8027608: @ 8027608 + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x28 + ldrb r2, [r0] + lsls r0, r2, 4 + subs r0, r2 + lsls r0, 2 + adds r1, r0 + ldr r0, =0x000031cc + adds r1, r0 + movs r0, 0 + strb r0, [r1] + bx lr + .pool + thumb_func_end sub_8027608 + + thumb_func_start sub_802762C +sub_802762C: @ 802762C + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x28 + ldrb r2, [r0] + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 2 + adds r1, 0x52 + adds r1, r0 + ldrh r0, [r1] + adds r0, 0x85 + lsls r0, 16 + lsrs r0, 16 + bx lr + .pool + thumb_func_end sub_802762C + + thumb_func_start sub_8027650 +sub_8027650: @ 8027650 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x24 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_8027650 + + thumb_func_start sub_8027660 +sub_8027660: @ 8027660 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0802768C + ldr r0, =gUnknown_02022C98 + lsls r1, r2, 4 + subs r1, r2 + lsls r1, 2 + ldr r2, =0x000031a0 + adds r1, r2 + ldr r0, [r0] + b _08027694 + .pool +_0802768C: + lsls r0, r2, 3 + subs r0, r2 + lsls r0, 2 + ldr r1, =gLinkPlayers + 8 +_08027694: + adds r0, r1 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8027660 + + thumb_func_start sub_80276A0 +sub_80276A0: @ 80276A0 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + ldr r2, =gUnknown_02022C98 + ldr r3, [r2] + lsrs r1, 23 + lsls r2, r0, 1 + adds r2, r0 + lsls r2, 2 + adds r1, r2 + adds r3, 0x4A + adds r3, r1 + ldrh r0, [r3] + bx lr + .pool + thumb_func_end sub_80276A0 + + thumb_func_start sub_80276C0 +sub_80276C0: @ 80276C0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + lsls r0, 24 + lsrs r4, r0, 24 + movs r5, 0 + movs r3, 0 + ldr r0, =gUnknown_02022C98 + mov r9, r0 + ldr r2, =gUnknown_082F7B24 + mov r10, r2 + ldr r2, [r0] + lsls r1, r4, 1 + adds r0, r1, r4 + lsls r0, 2 + str r0, [sp] + adds r6, r2, 0 + adds r6, 0x4A + mov r12, r1 + mov r8, r10 +_080276EE: + lsls r1, r3, 1 + ldr r7, [sp] + adds r0, r1, r7 + adds r0, r6, r0 + ldrh r2, [r0] + add r1, r8 + movs r7, 0 + ldrsh r0, [r1, r7] + muls r0, r2 + adds r5, r0 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x2 + bls _080276EE + mov r0, r9 + ldr r1, [r0] + mov r2, r12 + adds r0, r2, r4 + lsls r0, 2 + adds r1, 0x50 + adds r1, r0 + ldrh r1, [r1] + mov r3, r10 + movs r7, 0x6 + ldrsh r0, [r3, r7] + muls r0, r1 + cmp r5, r0 + bls _08027734 + subs r0, r5, r0 + b _08027736 + .pool +_08027734: + movs r0, 0 +_08027736: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80276C0 + + thumb_func_start sub_8027748 +sub_8027748: @ 8027748 + push {r4-r6,lr} + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x24 + ldrb r6, [r0] + movs r0, 0 + bl sub_80276C0 + adds r5, r0, 0 + movs r4, 0x1 + cmp r4, r6 + bcs _08027776 +_08027760: + adds r0, r4, 0 + bl sub_80276C0 + cmp r0, r5 + bls _0802776C + adds r5, r0, 0 +_0802776C: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r6 + bcc _08027760 +_08027776: + ldr r1, =0x000f4236 + adds r0, r5, 0 + bl sub_8027A38 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8027748 + + thumb_func_start sub_802778C +sub_802778C: @ 802778C + push {r4,r5,lr} + lsls r0, 24 + ldr r1, =gUnknown_02022C98 + ldr r2, [r1] + adds r1, r2, 0 + adds r1, 0x24 + ldrb r5, [r1] + lsrs r4, r0, 23 + adds r2, 0x4A + adds r0, r2, r4 + ldrh r3, [r0] + movs r1, 0 + cmp r1, r5 + bcs _080277C4 +_080277A8: + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + adds r0, r4, r0 + adds r0, r2, r0 + ldrh r0, [r0] + cmp r0, r3 + bls _080277BA + adds r3, r0, 0 +_080277BA: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, r5 + bcc _080277A8 +_080277C4: + adds r0, r3, 0 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802778C + + thumb_func_start sub_80277D0 +sub_80277D0: @ 80277D0 + push {r4-r7,lr} + sub sp, 0x14 + lsls r0, 24 + lsrs r7, r0, 24 + movs r6, 0x1 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x24 + ldrb r5, [r0] + movs r4, 0 + cmp r4, r5 + bcs _080277FE +_080277E8: + adds r0, r4, 0 + bl sub_80276C0 + lsls r1, r4, 2 + add r1, sp + str r0, [r1] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _080277E8 +_080277FE: + lsls r7, 2 + mov r12, r7 + cmp r6, 0 + beq _08027838 + subs r7, r5, 0x1 +_08027808: + movs r6, 0 + movs r4, 0 + cmp r6, r7 + bge _08027834 + adds r5, r7, 0 +_08027812: + lsls r0, r4, 2 + mov r2, sp + adds r1, r2, r0 + adds r4, 0x1 + lsls r0, r4, 2 + adds r3, r2, r0 + ldr r0, [r1] + ldr r2, [r3] + cmp r0, r2 + bcs _0802782C + str r2, [r1] + str r0, [r3] + movs r6, 0x1 +_0802782C: + lsls r0, r4, 24 + lsrs r4, r0, 24 + cmp r4, r5 + blt _08027812 +_08027834: + cmp r6, 0 + bne _08027808 +_08027838: + mov r0, sp + add r0, r12 + ldr r0, [r0] + add sp, 0x14 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_80277D0 + + thumb_func_start sub_802784C +sub_802784C: @ 802784C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + movs r0, 0 + mov r10, r0 + mov r8, r0 + mov r9, r0 + ldr r6, =gUnknown_02022C98 + ldr r0, [r6] + adds r0, 0x24 + ldrb r5, [r0] + bl sub_8027748 + bl sub_8027748 + cmp r0, 0 + bne _080278A0 + movs r4, 0 + cmp r9, r5 + bcs _080278A0 + adds r2, r6, 0 + ldr r1, =0x00003308 + mov r12, r1 + movs r7, 0 + movs r6, 0x4 + ldr r3, =0x0000330c +_08027884: + ldr r0, [r2] + lsls r1, r4, 3 + adds r0, r1 + add r0, r12 + strb r6, [r0] + ldr r0, [r2] + adds r0, r3 + adds r0, r1 + str r7, [r0] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08027884 +_080278A0: + movs r4, 0 + cmp r4, r5 + bcs _080278CA +_080278A6: + adds r0, r4, 0 + bl sub_80276C0 + ldr r1, =0x000f4236 + bl sub_8027A38 + ldr r1, =gUnknown_02022C98 + ldr r1, [r1] + lsls r2, r4, 3 + ldr r3, =0x0000330c + adds r1, r3 + adds r1, r2 + str r0, [r1] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _080278A6 +_080278CA: + mov r0, r10 + bl sub_80277D0 + adds r6, r0, 0 + mov r3, r8 + movs r4, 0 + cmp r4, r5 + bcs _08027916 + ldr r7, =gUnknown_02022C98 + mov r10, r7 +_080278DE: + mov r0, r10 + ldr r2, [r0] + lsls r1, r4, 3 + ldr r7, =0x0000330c + adds r0, r2, r7 + adds r0, r1 + ldr r0, [r0] + cmp r6, r0 + bne _0802790C + adds r0, r2, r1 + ldr r1, =0x00003308 + adds r0, r1 + strb r3, [r0] + mov r0, r8 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + mov r0, r9 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 +_0802790C: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _080278DE +_08027916: + mov r10, r8 + cmp r9, r5 + bcc _080278CA + movs r0, 0 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802784C + + thumb_func_start sub_802793C +sub_802793C: @ 802793C + lsls r1, 24 + ldr r2, =gUnknown_02022C98 + ldr r2, [r2] + lsrs r1, 21 + ldr r3, =0x00003308 + adds r2, r3 + adds r2, r1 + ldr r1, [r2] + ldr r2, [r2, 0x4] + str r1, [r0] + str r2, [r0, 0x4] + bx lr + .pool + thumb_func_end sub_802793C + + thumb_func_start sub_802795C +sub_802795C: @ 802795C + push {r4-r7,lr} + sub sp, 0x14 + lsls r0, 24 + lsrs r6, r0, 24 + movs r7, 0 + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x24 + ldrb r5, [r0] + mov r0, sp + movs r1, 0 + movs r2, 0x14 + bl memset + movs r4, 0 + cmp r7, r5 + bcs _08027994 +_0802797E: + adds r0, r4, 0 + bl sub_80276C0 + lsls r1, r4, 2 + add r1, sp + str r0, [r1] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _0802797E +_08027994: + lsls r0, r6, 2 + add r0, sp + ldr r1, [r0] + movs r4, 0 +_0802799C: + cmp r4, r6 + beq _080279B0 + lsls r0, r4, 2 + add r0, sp + ldr r0, [r0] + cmp r1, r0 + bcs _080279B0 + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 +_080279B0: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x4 + bls _0802799C + adds r0, r7, 0 + add sp, 0x14 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802795C + + thumb_func_start sub_80279C8 +sub_80279C8: @ 80279C8 + push {r4-r6,lr} + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x28 + ldrb r4, [r0] + bl sub_802762C + lsls r0, 16 + lsrs r5, r0, 16 + adds r6, r5, 0 + adds r0, r4, 0 + bl sub_80276C0 + adds r4, r0, 0 + bl sub_8027748 + cmp r4, r0 + beq _080279F4 + movs r0, 0x3 + b _08027A22 + .pool +_080279F4: + adds r0, r5, 0 + movs r1, 0x1 + bl CheckBagHasSpace + lsls r0, 24 + cmp r0, 0 + bne _08027A06 + movs r0, 0x2 + b _08027A22 +_08027A06: + adds r0, r6, 0 + movs r1, 0x1 + bl AddBagItem + adds r0, r6, 0 + movs r1, 0x1 + bl CheckBagHasSpace + lsls r0, 24 + cmp r0, 0 + beq _08027A20 + movs r0, 0 + b _08027A22 +_08027A20: + movs r0, 0x1 +_08027A22: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_80279C8 + + thumb_func_start sub_8027A28 +sub_8027A28: @ 8027A28 + push {lr} + adds r2, r0, 0 + adds r0, r1, 0 + cmp r2, r0 + bcs _08027A34 + adds r0, r2, 0x1 +_08027A34: + pop {r1} + bx r1 + thumb_func_end sub_8027A28 + + thumb_func_start sub_8027A38 +sub_8027A38: @ 8027A38 + push {lr} + adds r2, r0, 0 + adds r0, r1, 0 + cmp r2, r0 + bcs _08027A44 + adds r0, r2, 0 +_08027A44: + pop {r1} + bx r1 + thumb_func_end sub_8027A38 + + thumb_func_start sub_8027A48 +sub_8027A48: @ 8027A48 + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnknown_02022C98 + ldr r1, [r1] + adds r1, 0x34 + adds r1, r0 + ldrb r0, [r1] + bx lr + .pool + thumb_func_end sub_8027A48 + + thumb_func_start sub_8027A5C +sub_8027A5C: @ 8027A5C + push {r4-r6,lr} + movs r5, 0 + ldr r6, =gScriptResult +_08027A62: + movs r0, 0x64 + adds r1, r5, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0x5 + bl GetMonData + cmp r0, 0 + beq _08027A94 + adds r0, r4, 0 + movs r1, 0x41 + bl GetMonData + cmp r0, 0x55 + bne _08027A94 + movs r0, 0x1 + strh r0, [r6] + b _08027AA0 + .pool +_08027A94: + adds r5, 0x1 + cmp r5, 0x5 + ble _08027A62 + ldr r1, =gScriptResult + movs r0, 0 + strh r0, [r1] +_08027AA0: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8027A5C + + thumb_func_start sub_8027AAC +sub_8027AAC: @ 8027AAC + push {r4,lr} + ldr r4, =sub_8027ACC + adds r0, r4, 0 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + bl _call_via_r4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8027AAC + + thumb_func_start sub_8027ACC +sub_8027ACC: @ 8027ACC + push {r4-r7,lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r7, r0, r1 + movs r1, 0 + ldrsh r0, [r7, r1] + cmp r0, 0x1 + beq _08027B94 + cmp r0, 0x1 + bgt _08027AF4 + cmp r0, 0 + beq _08027AFE + b _08027BE2 + .pool +_08027AF4: + cmp r0, 0x2 + beq _08027BA0 + cmp r0, 0x3 + beq _08027BC8 + b _08027BE2 +_08027AFE: + ldr r0, =gUnknown_082F7B2C + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp] + str r1, [sp, 0x4] + ldr r1, =gText_BerryPickingRecords + movs r0, 0x1 + movs r2, 0 + bl GetStringWidth + adds r4, r0, 0 + movs r6, 0 + ldr r5, =gUnknown_082F7B34 +_08027B18: + ldr r1, [r5] + movs r0, 0x1 + movs r2, 0 + bl GetStringWidth + adds r0, 0x32 + cmp r0, r4 + ble _08027B2A + adds r4, r0, 0 +_08027B2A: + adds r5, 0x4 + adds r6, 0x1 + cmp r6, 0x2 + bls _08027B18 + adds r0, r4, 0x7 + cmp r0, 0 + bge _08027B3A + adds r0, 0x7 +_08027B3A: + asrs r4, r0, 3 + movs r0, 0x1 + ands r0, r4 + cmp r0, 0 + beq _08027B46 + adds r4, 0x1 +_08027B46: + movs r1, 0x1E + subs r1, r4 + lsrs r0, r1, 31 + adds r1, r0 + asrs r1, 1 + lsls r1, 24 + lsrs r1, 16 + ldr r2, =0xffff00ff + ldr r0, [sp] + ands r0, r2 + orrs r0, r1 + lsls r2, r4, 24 + ldr r1, =0x00ffffff + ands r0, r1 + orrs r0, r2 + str r0, [sp] + mov r0, sp + bl AddWindow + strh r0, [r7, 0x2] + lsls r0, 24 + lsrs r0, 24 + adds r1, r4, 0 + bl sub_8027BEC + ldrb r0, [r7, 0x2] + movs r1, 0x3 + b _08027BB6 + .pool +_08027B94: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _08027BE2 + b _08027BBA +_08027BA0: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _08027BE2 + ldrb r0, [r7, 0x2] + bl rbox_fill_rectangle + ldrb r0, [r7, 0x2] + movs r1, 0x1 +_08027BB6: + bl CopyWindowToVram +_08027BBA: + ldrh r0, [r7] + adds r0, 0x1 + strh r0, [r7] + b _08027BE2 + .pool +_08027BC8: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _08027BE2 + ldrb r0, [r7, 0x2] + bl RemoveWindow + adds r0, r4, 0 + bl DestroyTask + bl EnableBothScriptContexts +_08027BE2: + add sp, 0x8 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8027ACC + + thumb_func_start sub_8027BEC +sub_8027BEC: @ 8027BEC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x20 + str r1, [sp, 0x18] + lsls r0, 24 + lsrs r7, r0, 24 + ldr r0, =gSaveBlock2Ptr + ldr r1, [r0] + movs r2, 0x84 + lsls r2, 2 + adds r0, r1, r2 + ldrh r0, [r0] + str r0, [sp, 0xC] + subs r2, 0x4 + adds r0, r1, r2 + ldr r0, [r0] + str r0, [sp, 0x10] + ldr r0, =0x00000212 + adds r1, r0 + ldrh r0, [r1] + str r0, [sp, 0x14] + ldr r4, =0x0000021d + adds r0, r7, 0 + adds r1, r4, 0 + movs r2, 0xD0 + bl box_border_load_tiles_and_pal + adds r0, r7, 0 + adds r1, r4, 0 + movs r2, 0xD + bl sub_8098858 + adds r0, r7, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r4, =gText_BerryPickingRecords + ldr r0, [sp, 0x18] + lsls r2, r0, 3 + movs r0, 0x1 + adds r1, r4, 0 + bl GetStringCenterAlignXOffset + adds r3, r0, 0 + lsls r3, 24 + lsrs r3, 24 + movs r0, 0x1 + str r0, [sp] + movs r0, 0xFF + str r0, [sp, 0x4] + movs r0, 0 + str r0, [sp, 0x8] + adds r0, r7, 0 + movs r1, 0x1 + adds r2, r4, 0 + bl PrintTextOnWindow + movs r6, 0 + ldr r2, =gStringVar1 + mov r8, r2 + movs r0, 0xFF + mov r10, r0 + mov r9, r6 + mov r2, sp + adds r2, 0xC + str r2, [sp, 0x1C] +_08027C76: + lsls r4, r6, 2 + ldr r0, [sp, 0x1C] + ldm r0!, {r1} + str r0, [sp, 0x1C] + ldr r0, =gUnknown_082F7B40 + adds r0, r6, r0 + ldrb r3, [r0] + mov r0, r8 + movs r2, 0 + bl ConvertIntToDecimalStringN + movs r0, 0x1 + mov r1, r8 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + adds r5, r0, 0 + ldr r0, =gUnknown_082F7B34 + adds r4, r0 + ldr r2, [r4] + ldr r0, =gUnknown_082F7B44 + lsls r4, r6, 1 + adds r0, r4, r0 + ldrb r0, [r0] + str r0, [sp] + mov r0, r10 + str r0, [sp, 0x4] + mov r0, r9 + str r0, [sp, 0x8] + adds r0, r7, 0 + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r2, [sp, 0x18] + lsls r3, r2, 3 + subs r3, r5 + lsls r3, 24 + lsrs r3, 24 + ldr r0, =gUnknown_082F7B4A + adds r4, r0 + ldrb r0, [r4] + str r0, [sp] + mov r0, r10 + str r0, [sp, 0x4] + mov r2, r9 + str r2, [sp, 0x8] + adds r0, r7, 0 + movs r1, 0x1 + mov r2, r8 + bl PrintTextOnWindow + adds r6, 0x1 + cmp r6, 0x2 + ble _08027C76 + adds r0, r7, 0 + bl PutWindowTilemap + add sp, 0x20 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8027BEC + + thumb_func_start sub_8027D20 +sub_8027D20: @ 8027D20 + push {lr} + bl GetLinkPlayerCount + ldr r1, =gUnknown_02022C98 + ldr r1, [r1] + adds r1, 0x24 + strb r0, [r1] + pop {r0} + bx r0 + .pool + thumb_func_end sub_8027D20 + + thumb_func_start sub_8027D38 +sub_8027D38: @ 8027D38 + push {r4-r7,lr} + ldr r0, =gUnknown_02022C98 + ldr r0, [r0] + adds r0, 0x24 + ldrb r4, [r0] + cmp r4, 0x4 + bhi _08027D66 + ldr r5, =gUnknown_082F7B90 +_08027D48: + lsls r0, r4, 3 + subs r0, r4 + lsls r0, 2 + ldr r1, =gLinkPlayers + 8 + adds r0, r1 + lsls r1, r4, 2 + adds r1, r5 + ldr r1, [r1] + bl StringCopy + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x4 + bls _08027D48 +_08027D66: + ldr r0, =gUnknown_02022C98 + ldr r1, [r0] + adds r1, 0x24 + movs r2, 0x5 + strb r2, [r1] + movs r1, 0 + mov r12, r0 +_08027D74: + movs r4, 0 + mov r2, r12 + ldr r0, [r2] + adds r0, 0x24 + adds r5, r1, 0x1 + ldrb r0, [r0] + cmp r4, r0 + bcs _08027DB2 + ldr r7, =gUnknown_02022C98 + lsls r3, r1, 1 + ldr r6, =gUnknown_082F7B50 +_08027D8A: + ldr r2, [r7] + lsls r0, r4, 1 + adds r0, r4 + lsls r0, 2 + adds r0, r3, r0 + adds r1, r2, 0 + adds r1, 0x4A + adds r1, r0 + lsls r0, r4, 3 + adds r0, r3, r0 + adds r0, r6 + ldrh r0, [r0] + strh r0, [r1] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + adds r2, 0x24 + ldrb r2, [r2] + cmp r4, r2 + bcc _08027D8A +_08027DB2: + lsls r0, r5, 24 + lsrs r1, r0, 24 + cmp r1, 0x3 + bls _08027D74 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8027D38 + + thumb_func_start sub_8027DD0 +sub_8027DD0: @ 8027DD0 + push {lr} + sub sp, 0x8 + ldr r3, =0xffffff00 + ldr r1, [sp] + ands r1, r3 + movs r2, 0x1 + orrs r1, r2 + str r1, [sp] + lsls r0, 24 + lsrs r0, 24 + ldr r1, [sp, 0x4] + ands r1, r3 + orrs r1, r0 + str r1, [sp, 0x4] + mov r0, sp + bl sub_800FE50 + add sp, 0x8 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8027DD0 + + thumb_func_start sub_8027DFC +sub_8027DFC: @ 8027DFC + push {lr} + adds r2, r0, 0 + ldr r3, =gUnknown_03003090 + ldrh r0, [r3] + movs r1, 0xFF + lsls r1, 8 + ands r1, r0 + movs r0, 0xBC + lsls r0, 6 + cmp r1, r0 + bne _08027E1E + lsls r0, r2, 4 + adds r1, r3, 0x2 + adds r1, r0, r1 + ldrb r0, [r1] + cmp r0, 0x1 + beq _08027E28 +_08027E1E: + movs r0, 0 + b _08027E2A + .pool +_08027E28: + ldrb r0, [r1, 0x4] +_08027E2A: + pop {r1} + bx r1 + thumb_func_end sub_8027DFC + + thumb_func_start sub_8027E30 +sub_8027E30: @ 8027E30 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x20 + ldr r4, [sp, 0x48] + lsls r4, 24 + str r4, [sp, 0x1C] + movs r4, 0x14 + adds r4, r0 + mov r9, r4 + mov r5, sp + movs r4, 0x2 + strb r4, [r5] + mov r10, sp + mov r5, r9 + ldrb r4, [r5, 0xB] + movs r7, 0xF + adds r5, r7, 0 + ands r5, r4 + mov r6, r10 + ldrb r6, [r6, 0x1] + mov r8, r6 + movs r4, 0x10 + negs r4, r4 + mov r6, r8 + ands r4, r6 + orrs r4, r5 + mov r5, r10 + strb r4, [r5, 0x1] + mov r8, sp + mov r6, r9 + ldrb r5, [r6, 0xC] + lsls r5, 4 + ands r4, r7 + orrs r4, r5 + mov r5, r8 + strb r4, [r5, 0x1] + ldrb r5, [r6, 0xD] + movs r6, 0xF + ands r5, r6 + mov r4, r10 + ldrb r4, [r4, 0x2] + mov r8, r4 + movs r4, 0x10 + negs r4, r4 + mov r6, r8 + ands r4, r6 + orrs r4, r5 + mov r5, r10 + strb r4, [r5, 0x2] + mov r8, sp + mov r6, r9 + ldrb r5, [r6, 0xE] + lsls r5, 4 + ands r4, r7 + orrs r4, r5 + mov r5, r8 + strb r4, [r5, 0x2] + ldrb r5, [r6, 0xF] + movs r6, 0xF + ands r5, r6 + mov r4, r10 + ldrb r4, [r4, 0x3] + mov r8, r4 + movs r4, 0x10 + negs r4, r4 + mov r6, r8 + ands r4, r6 + orrs r4, r5 + mov r5, r10 + strb r4, [r5, 0x3] + mov r8, sp + mov r6, r9 + ldrb r5, [r6, 0x10] + lsls r5, 4 + ands r4, r7 + orrs r4, r5 + mov r5, r8 + strb r4, [r5, 0x3] + ldrb r5, [r6, 0x11] + movs r6, 0xF + ands r5, r6 + mov r4, r10 + ldrb r4, [r4, 0x4] + mov r8, r4 + movs r4, 0x10 + negs r4, r4 + mov r6, r8 + ands r4, r6 + orrs r4, r5 + mov r5, r10 + strb r4, [r5, 0x4] + mov r8, sp + mov r6, r9 + ldrb r5, [r6, 0x12] + lsls r5, 4 + ands r4, r7 + orrs r4, r5 + mov r5, r8 + strb r4, [r5, 0x4] + ldrb r4, [r6, 0x13] + movs r6, 0xF + ands r4, r6 + mov r6, r8 + ldrb r5, [r6, 0x5] + movs r6, 0x10 + negs r6, r6 + ands r6, r5 + orrs r6, r4 + str r6, [sp, 0xC] + mov r4, r8 + strb r6, [r4, 0x5] + mov r5, sp + mov r6, r9 + ldrb r4, [r6, 0x14] + lsls r4, 4 + ldr r6, [sp, 0xC] + ands r6, r7 + orrs r6, r4 + strb r6, [r5, 0x5] + mov r7, sp + movs r4, 0x3 + mov r8, r4 + ldrb r0, [r0, 0x14] + mov r5, r8 + ands r0, r5 + ldrb r5, [r7, 0x6] + movs r6, 0x4 + negs r6, r6 + mov r10, r6 + mov r4, r10 + ands r4, r5 + orrs r4, r0 + strb r4, [r7, 0x6] + mov r5, r9 + ldrb r0, [r5, 0x1] + mov r6, r8 + ands r0, r6 + lsls r0, 2 + movs r5, 0xD + negs r5, r5 + ands r5, r4 + orrs r5, r0 + strb r5, [r7, 0x6] + mov r0, r9 + ldrb r4, [r0, 0x2] + ands r4, r6 + lsls r4, 4 + movs r0, 0x31 + negs r0, r0 + ands r0, r5 + orrs r0, r4 + strb r0, [r7, 0x6] + mov r5, sp + mov r6, r9 + ldrb r4, [r6, 0x3] + lsls r4, 6 + movs r6, 0x3F + ands r0, r6 + orrs r0, r4 + strb r0, [r5, 0x6] + mov r4, r9 + ldrb r0, [r4, 0x4] + mov r5, r8 + ands r0, r5 + ldrb r5, [r7, 0x7] + mov r4, r10 + ands r4, r5 + orrs r4, r0 + strb r4, [r7, 0x7] + mov r6, r9 + ldrb r0, [r6, 0x5] + mov r5, r8 + ands r0, r5 + lsls r0, 2 + movs r5, 0xD + negs r5, r5 + ands r5, r4 + orrs r5, r0 + strb r5, [r7, 0x7] + ldrb r4, [r6, 0x6] + mov r6, r8 + ands r4, r6 + lsls r4, 4 + movs r0, 0x31 + negs r0, r0 + ands r0, r5 + orrs r0, r4 + strb r0, [r7, 0x7] + mov r5, sp + mov r6, r9 + ldrb r4, [r6, 0x7] + lsls r4, 6 + movs r6, 0x3F + ands r0, r6 + orrs r0, r4 + strb r0, [r5, 0x7] + mov r8, sp + mov r0, r9 + ldrb r4, [r0, 0x8] + movs r7, 0x3 + adds r0, r7, 0 + ands r0, r4 + mov r4, r8 + ldrb r5, [r4, 0x8] + mov r4, r10 + ands r4, r5 + orrs r4, r0 + mov r5, r8 + strb r4, [r5, 0x8] + mov r6, r9 + ldrb r5, [r6, 0x9] + adds r0, r7, 0 + ands r0, r5 + lsls r0, 2 + movs r5, 0xD + negs r5, r5 + ands r5, r4 + orrs r5, r0 + mov r0, r8 + strb r5, [r0, 0x8] + ldrb r0, [r1] + adds r4, r7, 0 + ands r4, r0 + lsls r4, 4 + movs r0, 0x31 + negs r0, r0 + ands r0, r5 + orrs r0, r4 + mov r4, r8 + strb r0, [r4, 0x8] + mov r5, sp + ldrb r4, [r2] + lsls r4, 6 + movs r6, 0x3F + ands r0, r6 + orrs r0, r4 + strb r0, [r5, 0x8] + ldrb r4, [r3] + adds r0, r7, 0 + ands r0, r4 + ldrb r4, [r5, 0x9] + mov r6, r10 + ands r6, r4 + orrs r6, r0 + mov r10, r6 + strb r6, [r5, 0x9] + ldr r0, [sp, 0x40] + ldrb r4, [r0] + adds r0, r7, 0 + ands r0, r4 + lsls r0, 2 + movs r4, 0xD + negs r4, r4 + ands r6, r4 + orrs r6, r0 + str r6, [sp, 0x10] + strb r6, [r5, 0x9] + mov r4, sp + ldr r5, [sp, 0x44] + ldrb r0, [r5] + adds r6, r7, 0 + ands r6, r0 + lsls r0, r6, 4 + subs r7, 0x34 + ldr r5, [sp, 0x10] + ands r7, r5 + orrs r7, r0 + strb r7, [r4, 0x9] + mov r5, sp + ldrb r0, [r1, 0x4] + movs r6, 0x1 + mov r12, r6 + mov r4, r12 + ands r4, r0 + lsls r4, 6 + movs r0, 0x41 + negs r0, r0 + mov r10, r0 + ands r0, r7 + orrs r0, r4 + strb r0, [r5, 0x9] + ldrb r4, [r2, 0x4] + lsls r4, 7 + movs r5, 0x7F + ands r0, r5 + orrs r0, r4 + mov r4, r8 + strb r0, [r4, 0x9] + ldrb r4, [r3, 0x4] + mov r0, r12 + ands r0, r4 + mov r5, r8 + ldrb r4, [r5, 0xA] + movs r7, 0x2 + negs r7, r7 + adds r5, r7, 0 + ands r5, r4 + orrs r5, r0 + mov r6, r8 + strb r5, [r6, 0xA] + mov r9, sp + ldr r4, [sp, 0x40] + ldrb r0, [r4, 0x4] + mov r4, r12 + ands r4, r0 + lsls r4, 1 + movs r6, 0x3 + negs r6, r6 + mov r8, r6 + mov r0, r8 + ands r0, r5 + orrs r0, r4 + mov r4, r9 + strb r0, [r4, 0xA] + ldr r6, [sp, 0x44] + ldrb r5, [r6, 0x4] + mov r4, r12 + ands r4, r5 + lsls r4, 2 + movs r5, 0x5 + negs r5, r5 + ands r0, r5 + orrs r0, r4 + mov r4, r9 + strb r0, [r4, 0xA] + mov r4, sp + ldrb r1, [r1, 0x8] + mov r0, r12 + ands r0, r1 + lsls r0, 2 + ldrb r1, [r4, 0xB] + ands r5, r1 + orrs r5, r0 + strb r5, [r4, 0xB] + ldrb r1, [r2, 0x8] + mov r0, r12 + ands r0, r1 + lsls r0, 3 + movs r1, 0x9 + negs r1, r1 + ands r1, r5 + orrs r1, r0 + strb r1, [r4, 0xB] + ldrb r2, [r3, 0x8] + mov r0, r12 + ands r0, r2 + lsls r0, 4 + movs r2, 0x11 + negs r2, r2 + ands r2, r1 + orrs r2, r0 + strb r2, [r4, 0xB] + mov r3, sp + ldr r5, [sp, 0x40] + ldrb r0, [r5, 0x8] + mov r1, r12 + ands r1, r0 + lsls r1, 5 + movs r0, 0x21 + negs r0, r0 + ands r0, r2 + orrs r0, r1 + strb r0, [r3, 0xB] + mov r2, sp + ldrb r1, [r6, 0x8] + mov r6, r12 + ands r6, r1 + lsls r1, r6, 6 + mov r3, r10 + ands r0, r3 + orrs r0, r1 + strb r0, [r2, 0xB] + ldr r4, [sp, 0x1C] + lsrs r3, r4, 21 + ldrb r1, [r2, 0xA] + movs r0, 0x7 + ands r0, r1 + orrs r0, r3 + strb r0, [r2, 0xA] + mov r1, sp + ldr r5, [sp, 0x4C] + movs r6, 0x1 + ands r5, r6 + lsls r2, r5, 1 + ldrb r0, [r1, 0xB] + mov r3, r8 + ands r3, r0 + orrs r3, r2 + mov r8, r3 + strb r3, [r1, 0xB] + mov r0, sp + ldr r4, [sp, 0x50] + ands r4, r6 + mov r5, r8 + ands r5, r7 + orrs r5, r4 + strb r5, [r0, 0xB] + bl sub_800FE50 + 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_8027E30 + + thumb_func_start sub_8028164 +sub_8028164: @ 8028164 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r7, r1, 0 + adds r5, r2, 0 + adds r6, r3, 0 + ldr r0, [sp, 0x1C] + mov r12, r0 + ldr r1, [sp, 0x20] + mov r8, r1 + ldr r0, [sp, 0x24] + mov r9, r0 + adds r2, r7, 0 + adds r2, 0x14 + ldr r4, =gUnknown_03003090 + ldrh r0, [r4] + movs r1, 0xFF + lsls r1, 8 + ands r1, r0 + movs r0, 0xBC + lsls r0, 6 + cmp r1, r0 + bne _0802819C + adds r3, r4, 0x2 + ldrb r0, [r4, 0x2] + cmp r0, 0x2 + beq _080281A4 +_0802819C: + movs r0, 0 + b _080282DE + .pool +_080281A4: + ldrb r0, [r3, 0x1] + lsls r0, 28 + lsrs r0, 28 + strb r0, [r2, 0xB] + ldrb r0, [r3, 0x1] + lsrs r0, 4 + strb r0, [r2, 0xC] + ldrb r0, [r3, 0x2] + lsls r0, 28 + lsrs r0, 28 + strb r0, [r2, 0xD] + ldrb r0, [r3, 0x2] + lsrs r0, 4 + strb r0, [r2, 0xE] + ldrb r0, [r3, 0x3] + lsls r0, 28 + lsrs r0, 28 + strb r0, [r2, 0xF] + ldrb r0, [r3, 0x3] + lsrs r0, 4 + strb r0, [r2, 0x10] + ldrb r0, [r3, 0x4] + lsls r0, 28 + lsrs r0, 28 + strb r0, [r2, 0x11] + ldrb r0, [r3, 0x4] + lsrs r0, 4 + strb r0, [r2, 0x12] + ldrb r0, [r3, 0x5] + lsls r0, 28 + lsrs r0, 28 + strb r0, [r2, 0x13] + ldrb r0, [r3, 0x5] + lsrs r0, 4 + strb r0, [r2, 0x14] + ldrb r0, [r3, 0x1] + lsls r0, 28 + lsrs r0, 28 + strb r0, [r2, 0x15] + ldrb r0, [r3, 0x6] + lsls r0, 30 + lsrs r0, 30 + strb r0, [r7, 0x14] + ldrb r0, [r3, 0x6] + lsls r0, 28 + lsrs r0, 30 + strb r0, [r2, 0x1] + ldrb r0, [r3, 0x6] + lsls r0, 26 + lsrs r0, 30 + strb r0, [r2, 0x2] + ldrb r0, [r3, 0x6] + lsrs r0, 6 + strb r0, [r2, 0x3] + ldrb r0, [r3, 0x7] + lsls r0, 30 + lsrs r0, 30 + strb r0, [r2, 0x4] + ldrb r0, [r3, 0x7] + lsls r0, 28 + lsrs r0, 30 + strb r0, [r2, 0x5] + ldrb r0, [r3, 0x7] + lsls r0, 26 + lsrs r0, 30 + strb r0, [r2, 0x6] + ldrb r0, [r3, 0x7] + lsrs r0, 6 + strb r0, [r2, 0x7] + ldrb r0, [r3, 0x8] + lsls r0, 30 + lsrs r0, 30 + strb r0, [r2, 0x8] + ldrb r0, [r3, 0x8] + lsls r0, 28 + lsrs r0, 30 + strb r0, [r2, 0x9] + ldrb r0, [r3, 0x6] + lsls r0, 30 + lsrs r0, 30 + strb r0, [r2, 0xA] + ldrb r0, [r3, 0x8] + lsls r0, 26 + lsrs r0, 30 + strb r0, [r5] + ldrb r0, [r3, 0x9] + lsls r0, 25 + lsrs r0, 31 + strb r0, [r5, 0x4] + ldrb r0, [r3, 0xB] + lsls r0, 29 + lsrs r0, 31 + strb r0, [r5, 0x8] + ldrb r0, [r3, 0x8] + lsrs r0, 6 + strb r0, [r6] + ldrb r0, [r3, 0x9] + lsrs r0, 7 + strb r0, [r6, 0x4] + ldrb r0, [r3, 0xB] + lsls r0, 28 + lsrs r0, 31 + strb r0, [r6, 0x8] + ldrb r0, [r3, 0x9] + lsls r0, 30 + lsrs r0, 30 + mov r1, r12 + strb r0, [r1] + ldrb r0, [r3, 0xA] + lsls r0, 31 + lsrs r0, 31 + strb r0, [r1, 0x4] + ldrb r0, [r3, 0xB] + lsls r0, 27 + lsrs r0, 31 + strb r0, [r1, 0x8] + ldrb r0, [r3, 0x9] + lsls r0, 28 + lsrs r0, 30 + mov r1, r8 + strb r0, [r1] + ldrb r0, [r3, 0xA] + lsls r0, 30 + lsrs r0, 31 + strb r0, [r1, 0x4] + ldrb r0, [r3, 0xB] + lsls r0, 26 + lsrs r0, 31 + strb r0, [r1, 0x8] + ldrb r0, [r3, 0x9] + lsls r0, 26 + lsrs r0, 30 + mov r1, r9 + strb r0, [r1] + ldrb r0, [r3, 0xA] + lsls r0, 29 + lsrs r0, 31 + strb r0, [r1, 0x4] + ldrb r0, [r3, 0xB] + lsls r0, 25 + lsrs r0, 31 + strb r0, [r1, 0x8] + ldrb r0, [r3, 0xA] + lsrs r0, 3 + ldr r1, [sp, 0x28] + strb r0, [r1] + ldrb r0, [r3, 0xB] + lsls r0, 30 + lsrs r0, 31 + ldr r1, [sp, 0x2C] + str r0, [r1] + ldrb r0, [r3, 0xB] + lsls r0, 31 + lsrs r0, 31 + ldr r1, [sp, 0x30] + str r0, [r1] + movs r0, 0x1 +_080282DE: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8028164 + + thumb_func_start sub_80282EC +sub_80282EC: @ 80282EC + push {lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r0, 24 + ldr r3, =0xffffff00 + ldr r1, [sp] + ands r1, r3 + movs r2, 0x3 + orrs r1, r2 + str r1, [sp] + ldr r1, [sp, 0x4] + ands r1, r3 + orrs r1, r0 + str r1, [sp, 0x4] + mov r0, sp + bl sub_800FE50 + add sp, 0x8 + pop {r0} + bx r0 + .pool + thumb_func_end sub_80282EC + + thumb_func_start sub_8028318 +sub_8028318: @ 8028318 + push {r4,lr} + adds r2, r0, 0 + adds r4, r1, 0 + ldr r3, =gUnknown_03003090 + ldrh r0, [r3] + movs r1, 0xFF + lsls r1, 8 + ands r1, r0 + movs r0, 0xBC + lsls r0, 6 + cmp r1, r0 + bne _0802833C + lsls r0, r2, 4 + adds r1, r3, 0x2 + adds r1, r0, r1 + ldrb r0, [r1] + cmp r0, 0x3 + beq _08028344 +_0802833C: + movs r0, 0 + b _0802834A + .pool +_08028344: + ldrb r0, [r1, 0x4] + strb r0, [r4] + movs r0, 0x1 +_0802834A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8028318 + + thumb_func_start sub_8028350 +sub_8028350: @ 8028350 + push {lr} + sub sp, 0x8 + ldr r2, =0xffffff00 + ldr r1, [sp] + ands r1, r2 + movs r2, 0x4 + orrs r1, r2 + str r1, [sp] + str r0, [sp, 0x4] + mov r0, sp + bl sub_800FE50 + add sp, 0x8 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028350 + + thumb_func_start sub_8028374 +sub_8028374: @ 8028374 + push {lr} + adds r2, r0, 0 + ldr r3, =gUnknown_03003090 + ldrh r0, [r3] + movs r1, 0xFF + lsls r1, 8 + ands r1, r0 + movs r0, 0xBC + lsls r0, 6 + cmp r1, r0 + bne _08028396 + lsls r0, r2, 4 + adds r1, r3, 0x2 + adds r1, r0, r1 + ldrb r0, [r1] + cmp r0, 0x4 + beq _080283A0 +_08028396: + movs r0, 0 + b _080283A2 + .pool +_080283A0: + ldr r0, [r1, 0x4] +_080283A2: + pop {r1} + bx r1 + thumb_func_end sub_8028374 + + thumb_func_start sub_80283A8 +sub_80283A8: @ 80283A8 + push {r4,r5,lr} + sub sp, 0x18 + movs r5, 0xC0 + lsls r5, 6 + adds r0, r5, 0 + bl AllocZeroed + adds r4, r0, 0 + ldr r0, =gUnknown_082FB2D8 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x8] + str r1, [sp, 0xC] + ldr r0, =gUnknown_082FB2E0 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x10] + str r1, [sp, 0x14] + ldr r0, =gDodrioBerryPkmnGfx + adds r1, r4, 0 + bl LZ77UnCompWram + cmp r4, 0 + beq _080283E8 + str r4, [sp] + str r5, [sp, 0x4] + mov r0, sp + bl LoadSpriteSheet + adds r0, r4, 0 + bl Free +_080283E8: + add r0, sp, 0x8 + bl LoadSpritePalette + add r0, sp, 0x10 + bl LoadSpritePalette + add sp, 0x18 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80283A8 + + thumb_func_start sub_8028408 +sub_8028408: @ 8028408 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x30 + adds r6, r1, 0 + mov r8, r2 + adds r5, r3, 0 + lsls r6, 24 + lsrs r6, 24 + mov r1, r8 + lsls r1, 24 + lsrs r1, 24 + mov r8, r1 + lsls r5, 24 + lsrs r5, 24 + add r1, sp, 0x18 + movs r3, 0 + strh r3, [r1] + ldrb r2, [r0] + mov r0, sp + adds r0, 0x1A + strh r2, [r0] + ldr r0, =gUnknown_082FB1E0 + str r0, [sp, 0x1C] + ldr r0, =gUnknown_082FB228 + str r0, [sp, 0x20] + str r3, [sp, 0x24] + ldr r0, =gDummySpriteAffineAnimTable + str r0, [sp, 0x28] + ldr r0, =sub_80284A8 + str r0, [sp, 0x2C] + mov r0, sp + movs r2, 0x18 + bl memcpy + movs r0, 0x4 + bl AllocZeroed + ldr r1, =gUnknown_02022C9C + mov r2, r8 + lsls r4, r2, 2 + adds r4, r1 + str r0, [r4] + adds r0, r6, 0 + adds r1, r5, 0 + bl sub_8028F14 + adds r1, r0, 0 + lsls r1, 16 + asrs r1, 16 + mov r0, sp + movs r2, 0x88 + movs r3, 0x3 + bl CreateSprite + ldr r1, [r4] + lsls r0, 24 + lsrs r0, 24 + strh r0, [r1] + movs r0, 0x1 + mov r1, r8 + bl sub_8028654 + add sp, 0x30 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028408 + + thumb_func_start sub_80284A8 +sub_80284A8: @ 80284A8 + push {lr} + movs r2, 0x2E + ldrsh r1, [r0, r2] + cmp r1, 0x1 + beq _080284BC + cmp r1, 0x1 + ble _080284C6 + cmp r1, 0x2 + beq _080284C2 + b _080284C6 +_080284BC: + bl sub_802853C + b _080284C6 +_080284C2: + bl sub_80285AC +_080284C6: + pop {r0} + bx r0 + thumb_func_end sub_80284A8 + + thumb_func_start sub_80284CC +sub_80284CC: @ 80284CC + push {lr} + bl GetMultiplayerId + ldr r1, =gUnknown_02022C9C + lsls r0, 24 + lsrs r0, 22 + adds r0, r1 + ldr r0, [r0] + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + movs r2, 0 + movs r1, 0x1 + strh r1, [r0, 0x2E] + strh r2, [r0, 0x30] + strh r2, [r0, 0x32] + strh r2, [r0, 0x34] + strh r2, [r0, 0x36] + pop {r0} + bx r0 + .pool + thumb_func_end sub_80284CC + + thumb_func_start sub_8028504 +sub_8028504: @ 8028504 + push {lr} + bl GetMultiplayerId + ldr r1, =gUnknown_02022C9C + lsls r0, 24 + lsrs r0, 22 + adds r0, r1 + ldr r0, [r0] + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + movs r2, 0 + movs r1, 0x2 + strh r1, [r0, 0x2E] + strh r2, [r0, 0x30] + strh r2, [r0, 0x32] + strh r2, [r0, 0x34] + strh r2, [r0, 0x36] + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028504 + + thumb_func_start sub_802853C +sub_802853C: @ 802853C + push {r4,lr} + adds r4, r0, 0 + ldrh r0, [r4, 0x30] + adds r0, 0x1 + strh r0, [r4, 0x30] + lsls r0, 16 + asrs r2, r0, 16 + lsrs r0, 31 + adds r0, r2, r0 + asrs r1, r0, 1 + adds r0, r1, 0 + cmp r1, 0 + bge _08028558 + adds r0, r1, 0x3 +_08028558: + asrs r0, 2 + lsls r0, 2 + subs r0, r1, r0 + lsls r0, 24 + lsrs r0, 24 + cmp r2, 0x2 + ble _080285A2 + cmp r0, 0x2 + bgt _0802856E + cmp r0, 0x1 + bge _08028572 +_0802856E: + movs r0, 0x1 + b _08028574 +_08028572: + movs r0, 0xFF +_08028574: + lsls r0, 24 + asrs r0, 24 + ldrh r1, [r4, 0x20] + adds r0, r1 + strh r0, [r4, 0x20] + ldrh r0, [r4, 0x30] + adds r0, 0x1 + strh r0, [r4, 0x30] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x27 + ble _080285A2 + movs r0, 0 + strh r0, [r4, 0x2E] + bl sub_8027650 + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + movs r0, 0 + bl sub_8028F14 + strh r0, [r4, 0x20] +_080285A2: + movs r0, 0 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802853C + + thumb_func_start sub_80285AC +sub_80285AC: @ 80285AC + push {r4,r5,lr} + adds r5, r0, 0 + ldrh r0, [r5, 0x30] + adds r0, 0x1 + strh r0, [r5, 0x30] + lsls r0, 16 + asrs r0, 16 + movs r1, 0xD + bl __divsi3 + lsls r0, 16 + asrs r1, r0, 16 + adds r0, r1, 0 + cmp r1, 0 + bge _080285CC + adds r0, r1, 0x3 +_080285CC: + asrs r0, 2 + lsls r0, 2 + subs r0, r1, r0 + lsls r0, 24 + lsrs r4, r0, 24 + movs r1, 0x30 + ldrsh r0, [r5, r1] + movs r1, 0xD + bl __modsi3 + lsls r0, 16 + cmp r0, 0 + bne _080285F0 + cmp r4, 0 + beq _080285F0 + movs r0, 0xD4 + bl PlaySE +_080285F0: + movs r1, 0x30 + ldrsh r0, [r5, r1] + cmp r0, 0x67 + ble _080285FE + movs r0, 0 + strh r0, [r5, 0x2E] + movs r4, 0 +_080285FE: + bl GetMultiplayerId + lsls r0, 24 + lsrs r0, 24 + adds r1, r4, 0 + bl sub_80286B4 + movs r0, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_80285AC + + thumb_func_start sub_8028614 +sub_8028614: @ 8028614 + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + movs r4, 0 + cmp r4, r5 + bcs _08028646 + ldr r6, =gUnknown_02022C9C +_08028622: + lsls r0, r4, 2 + adds r0, r6 + ldr r0, [r0] + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + cmp r0, 0 + beq _0802863C + bl DestroySpriteAndFreeResources +_0802863C: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08028622 +_08028646: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028614 + + thumb_func_start sub_8028654 +sub_8028654: @ 8028654 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + ldr r3, =gSprites + ldr r2, =gUnknown_02022C9C + lsrs r1, 22 + adds r1, r2 + ldr r1, [r1] + ldrh r1, [r1] + lsls r2, r1, 4 + adds r2, r1 + lsls r2, 2 + adds r2, r3 + adds r2, 0x3E + movs r1, 0x1 + ands r0, r1 + lsls r0, 2 + ldrb r3, [r2] + movs r1, 0x5 + negs r1, r1 + ands r1, r3 + orrs r1, r0 + strb r1, [r2] + bx lr + .pool + thumb_func_end sub_8028654 + + thumb_func_start sub_802868C +sub_802868C: @ 802868C + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + lsls r1, 24 + lsrs r5, r1, 24 + movs r4, 0 + cmp r4, r5 + bcs _080286AE +_0802869C: + adds r0, r6, 0 + adds r1, r4, 0 + bl sub_8028654 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _0802869C +_080286AE: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_802868C + + thumb_func_start sub_80286B4 +sub_80286B4: @ 80286B4 + push {lr} + lsls r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r2, =gUnknown_02022C9C + lsrs r0, 22 + adds r0, r2 + ldr r0, [r0] + ldrh r2, [r0] + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + ldr r2, =gSprites + adds r0, r2 + bl StartSpriteAnim + pop {r0} + bx r0 + .pool + thumb_func_end sub_80286B4 + + thumb_func_start nullsub_15 +nullsub_15: @ 80286E0 + bx lr + thumb_func_end nullsub_15 + + thumb_func_start sub_80286E4 +sub_80286E4: @ 80286E4 + push {r4-r7,lr} + movs r4, 0 + ldr r0, =gSprites + mov r12, r0 + movs r6, 0 + ldr r5, =gUnknown_02022CF4 +_080286F0: + ldr r3, [r5] + lsls r1, r4, 1 + adds r0, r3, 0 + adds r0, 0x2A + adds r0, r1 + ldrh r0, [r0] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + add r1, r12 + lsls r0, r4, 4 + adds r0, 0x30 + strh r0, [r1, 0x20] + lsls r2, r4, 3 + movs r7, 0x8 + negs r7, r7 + adds r0, r7, 0 + subs r0, r2 + strh r0, [r1, 0x22] + adds r3, 0xC + adds r3, r4 + strb r6, [r3] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x9 + bls _080286F0 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80286E4 + + thumb_func_start sub_8028734 +sub_8028734: @ 8028734 + push {r4-r6,lr} + sub sp, 0x28 + movs r4, 0xC0 + lsls r4, 1 + adds r0, r4, 0 + bl AllocZeroed + adds r6, r0, 0 + ldr r0, =gUnknown_082FB2E8 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x20] + str r1, [sp, 0x24] + ldr r0, =gDodrioBerryStatusGfx + adds r1, r6, 0 + bl LZ77UnCompWram + cmp r6, 0 + beq _080287C4 + str r6, [sp, 0x18] + add r5, sp, 0x18 + movs r0, 0x80 + lsls r0, 9 + orrs r0, r4 + str r0, [r5, 0x4] + mov r1, sp + ldr r0, =gUnknown_082FB2F0 + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldr r4, =gUnknown_02022CF4 + movs r0, 0x40 + bl AllocZeroed + str r0, [r4] + adds r0, r5, 0 + bl LoadSpriteSheet + add r0, sp, 0x20 + bl LoadSpritePalette + movs r4, 0 +_0802878A: + lsls r1, r4, 20 + movs r0, 0xC0 + lsls r0, 14 + adds r1, r0 + asrs r1, 16 + lsls r0, r4, 3 + movs r3, 0x8 + negs r3, r3 + adds r2, r3, 0 + subs r2, r0 + lsls r2, 16 + asrs r2, 16 + mov r0, sp + movs r3, 0 + bl CreateSprite + ldr r1, =gUnknown_02022CF4 + ldr r1, [r1] + lsls r2, r4, 1 + adds r1, 0x2A + adds r1, r2 + lsls r0, 24 + lsrs r0, 24 + strh r0, [r1] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x9 + bls _0802878A +_080287C4: + adds r0, r6, 0 + bl Free + add sp, 0x28 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028734 + + thumb_func_start sub_80287E4 +sub_80287E4: @ 80287E4 + push {r4,r5,lr} + movs r4, 0 +_080287E8: + ldr r5, =gUnknown_02022CF4 + ldr r0, [r5] + lsls r1, r4, 1 + adds r0, 0x2A + adds r0, r1 + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + cmp r0, 0 + beq _08028806 + bl DestroySpriteAndFreeResources +_08028806: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x9 + bls _080287E8 + ldr r0, [r5] + bl Free + movs r0, 0 + str r0, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80287E4 + + thumb_func_start sub_8028828 +sub_8028828: @ 8028828 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x4 + movs r3, 0 + movs r6, 0 + ldr r0, =gUnknown_02022CF4 + mov r9, r0 +_0802883A: + mov r7, r9 + ldr r2, [r7] + lsls r5, r6, 1 + adds r0, r2, 0 + adds r0, 0x2A + adds r0, r5 + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r4, r0, r1 + adds r0, r2, 0 + adds r0, 0x16 + adds r0, r5 + movs r1, 0x2 + strh r1, [r0] + adds r0, r2, 0 + adds r0, 0xC + adds r2, r0, r6 + ldrb r1, [r2] + cmp r1, 0 + beq _08028870 + movs r7, 0x22 + ldrsh r0, [r4, r7] + cmp r0, 0x8 + beq _080288A6 +_08028870: + movs r3, 0x1 + movs r7, 0x22 + ldrsh r0, [r4, r7] + cmp r0, 0x8 + bne _08028896 + cmp r1, 0 + bne _080288A6 + strb r3, [r2] + mov r1, r9 + ldr r0, [r1] + adds r0, 0x16 + adds r0, r5 + ldr r1, =0x0000fff0 + strh r1, [r0] + movs r0, 0x24 + str r3, [sp] + bl PlaySE + ldr r3, [sp] +_08028896: + mov r7, r9 + ldr r0, [r7] + adds r0, 0x16 + adds r0, r5 + ldrh r0, [r0] + ldrh r1, [r4, 0x22] + adds r0, r1 + strh r0, [r4, 0x22] +_080288A6: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, 0x9 + bls _0802883A + cmp r3, 0 + bne _080288C4 + movs r0, 0x1 + b _080288C6 + .pool +_080288C4: + movs r0, 0 +_080288C6: + add sp, 0x4 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8028828 + + thumb_func_start sub_80288D4 +sub_80288D4: @ 80288D4 + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0xA + bls _08028910 + movs r4, 0 +_080288E0: + ldr r0, =gUnknown_02022CF4 + ldr r0, [r0] + lsls r1, r4, 1 + adds r0, 0x2A + adds r0, r1 + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + movs r1, 0x1 + bl StartSpriteAnim + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x9 + bls _080288E0 + b _080289DA + .pool +_08028910: + movs r4, 0 + movs r0, 0xA + subs r0, r5 + cmp r4, r0 + bge _080289D6 + ldr r6, =gSprites +_0802891C: + cmp r5, 0x6 + bls _08028984 + ldr r0, =gUnknown_02022CF4 + ldr r2, [r0] + ldr r1, =0x0000fffa + adds r0, r1, 0 + ldrh r1, [r2, 0x3E] + adds r0, r1 + adds r0, r5 + movs r1, 0 + strh r0, [r2, 0x3E] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1E + bls _0802894C + strh r1, [r2, 0x3E] + b _0802899E + .pool +_0802894C: + cmp r0, 0xA + bls _0802896A + lsls r1, r4, 1 + adds r0, r2, 0 + adds r0, 0x2A + adds r0, r1 + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r6 + movs r1, 0x2 + bl StartSpriteAnim + b _0802899E +_0802896A: + lsls r1, r4, 1 + adds r0, r2, 0 + adds r0, 0x2A + adds r0, r1 + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r6 + movs r1, 0 + bl StartSpriteAnim + b _0802899E +_08028984: + ldr r0, =gUnknown_02022CF4 + ldr r0, [r0] + lsls r1, r4, 1 + adds r0, 0x2A + adds r0, r1 + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r6 + movs r1, 0 + bl StartSpriteAnim +_0802899E: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + movs r0, 0xA + subs r0, r5 + cmp r4, r0 + blt _0802891C + b _080289D6 + .pool +_080289B4: + ldr r0, =gUnknown_02022CF4 + ldr r0, [r0] + lsls r1, r4, 1 + adds r0, 0x2A + adds r0, r1 + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + movs r1, 0x1 + bl StartSpriteAnim + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 +_080289D6: + cmp r4, 0x9 + bls _080289B4 +_080289DA: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80288D4 + + thumb_func_start sub_80289E8 +sub_80289E8: @ 80289E8 + push {r4-r7,lr} + lsls r0, 24 + lsrs r0, 24 + movs r3, 0 + ldr r7, =gSprites + movs r1, 0x1 + ands r0, r1 + lsls r4, r0, 2 + movs r6, 0x5 + negs r6, r6 + ldr r5, =gUnknown_02022CF4 +_080289FE: + ldr r0, [r5] + lsls r1, r3, 1 + adds r0, 0x2A + adds r0, r1 + ldrh r0, [r0] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r7 + adds r1, 0x3E + ldrb r2, [r1] + adds r0, r6, 0 + ands r0, r2 + orrs r0, r4 + strb r0, [r1] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x9 + bls _080289FE + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80289E8 + + thumb_func_start sub_8028A34 +sub_8028A34: @ 8028A34 + push {r4,r5,lr} + sub sp, 0x10 + movs r5, 0x90 + lsls r5, 3 + adds r0, r5, 0 + bl AllocZeroed + adds r4, r0, 0 + ldr r0, =gUnknown_082FB314 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x8] + str r1, [sp, 0xC] + ldr r0, =gDodrioBerrySpritesGfx + adds r1, r4, 0 + bl LZ77UnCompWram + cmp r4, 0 + beq _08028A6A + str r4, [sp] + movs r0, 0x80 + lsls r0, 10 + orrs r0, r5 + str r0, [sp, 0x4] + mov r0, sp + bl LoadSpriteSheet +_08028A6A: + add r0, sp, 0x8 + bl LoadSpritePalette + adds r0, r4, 0 + bl Free + add sp, 0x10 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028A34 + + thumb_func_start sub_8028A88 +sub_8028A88: @ 8028A88 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x30 + mov r1, sp + ldr r0, =gUnknown_082FB324 + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + add r2, sp, 0x18 + adds r1, r2, 0 + ldr r0, =gUnknown_082FB33C + ldm r0!, {r3-r5} + stm r1!, {r3-r5} + ldm r0!, {r3-r5} + stm r1!, {r3-r5} + movs r5, 0 + mov r9, r2 +_08028AB0: + movs r0, 0x4 + bl AllocZeroed + ldr r1, =gUnknown_02022CB8 + lsls r4, r5, 2 + adds r4, r1 + str r0, [r4] + lsls r0, r5, 3 + lsls r1, r5, 4 + adds r1, r0 + mov r0, sp + movs r2, 0x8 + movs r3, 0x1 + bl CreateSprite + ldr r1, [r4] + lsls r0, 24 + lsrs r0, 24 + strh r0, [r1] + adds r0, r5, 0 + movs r1, 0x1 + bl sub_8028BF8 + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0xA + bls _08028AB0 + movs r5, 0 + ldr r7, =gUnknown_02022CE4 + ldr r4, =gUnknown_082FB31C + mov r8, r4 +_08028AF0: + movs r0, 0x4 + bl AllocZeroed + lsls r1, r5, 2 + adds r4, r1, r7 + str r0, [r4] + adds r6, r1, 0 + cmp r5, 0x3 + bne _08028B2C + mov r0, r8 + movs r2, 0x6 + ldrsh r1, [r0, r2] + mov r0, r9 + movs r2, 0x31 + movs r3, 0 + bl CreateSprite + ldr r1, [r7, 0xC] + b _08028B40 + .pool +_08028B2C: + lsls r0, r5, 1 + add r0, r8 + movs r3, 0 + ldrsh r1, [r0, r3] + mov r0, r9 + movs r2, 0x34 + movs r3, 0 + bl CreateSprite + ldr r1, [r4] +_08028B40: + lsls r0, 24 + lsrs r0, 24 + strh r0, [r1] + adds r0, r6, r7 + ldr r0, [r0] + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + adds r1, r5, 0 + bl StartSpriteAnim + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x3 + bls _08028AF0 + movs r0, 0x1 + bl sub_8028C30 + add sp, 0x30 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028A88 + + thumb_func_start sub_8028B80 +sub_8028B80: @ 8028B80 + push {r4-r6,lr} + movs r5, 0 + ldr r6, =gUnknown_02022CB8 +_08028B86: + lsls r0, r5, 2 + adds r4, r0, r6 + ldr r0, [r4] + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + cmp r0, 0 + beq _08028BA0 + bl DestroySprite +_08028BA0: + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0xA + bls _08028B86 + movs r5, 0 + ldr r6, =gUnknown_02022CE4 +_08028BB8: + lsls r0, r5, 2 + adds r4, r0, r6 + ldr r0, [r4] + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + cmp r0, 0 + beq _08028BD2 + bl DestroySprite +_08028BD2: + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x3 + bls _08028BB8 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028B80 + + thumb_func_start sub_8028BF8 +sub_8028BF8: @ 8028BF8 + lsls r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r3, =gSprites + ldr r2, =gUnknown_02022CB8 + lsrs r0, 22 + adds r0, r2 + ldr r0, [r0] + ldrh r0, [r0] + lsls r2, r0, 4 + adds r2, r0 + lsls r2, 2 + adds r2, r3 + adds r2, 0x3E + movs r0, 0x1 + ands r1, r0 + lsls r1, 2 + ldrb r3, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r3 + orrs r0, r1 + strb r0, [r2] + bx lr + .pool + thumb_func_end sub_8028BF8 + + thumb_func_start sub_8028C30 +sub_8028C30: @ 8028C30 + push {r4-r7,lr} + lsls r0, 24 + lsrs r0, 24 + movs r3, 0 + ldr r7, =gSprites + ldr r6, =gUnknown_02022CE4 + movs r1, 0x1 + ands r0, r1 + lsls r4, r0, 2 + movs r5, 0x5 + negs r5, r5 +_08028C46: + lsls r0, r3, 2 + adds r0, r6 + ldr r0, [r0] + ldrh r0, [r0] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r7 + adds r1, 0x3E + ldrb r2, [r1] + adds r0, r5, 0 + ands r0, r2 + orrs r0, r4 + strb r0, [r1] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _08028C46 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028C30 + + thumb_func_start sub_8028C7C +sub_8028C7C: @ 8028C7C + lsls r0, 24 + lsls r1, 24 + ldr r3, =gSprites + ldr r2, =gUnknown_02022CB8 + lsrs r0, 22 + adds r0, r2 + ldr r0, [r0] + ldrh r2, [r0] + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + adds r0, r3 + lsrs r1, 21 + strh r1, [r0, 0x22] + bx lr + .pool + thumb_func_end sub_8028C7C + + thumb_func_start sub_8028CA4 +sub_8028CA4: @ 8028CA4 + push {lr} + lsls r0, 16 + lsls r1, 24 + lsrs r1, 24 + ldr r2, =gUnknown_02022CB8 + lsrs r0, 14 + adds r0, r2 + ldr r0, [r0] + ldrh r2, [r0] + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + ldr r2, =gSprites + adds r0, r2 + bl StartSpriteAnim + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028CA4 + + thumb_func_start sub_8028CD0 +sub_8028CD0: @ 8028CD0 + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gSprites + lsls r2, r0, 4 + adds r2, r0 + lsls r2, 2 + adds r2, r1 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 2 + adds r1, 0x32 + strh r1, [r2, 0x20] + movs r0, 0x32 + strh r0, [r2, 0x22] + bx lr + .pool + thumb_func_end sub_8028CD0 + + thumb_func_start sub_8028CF4 +sub_8028CF4: @ 8028CF4 + push {r4-r7,lr} + adds r4, r0, 0 + adds r0, 0x42 + movs r1, 0 + ldrsh r0, [r0, r1] + cmp r0, 0x1 + beq _08028D36 + movs r3, 0 + ldr r7, =gUnknown_082FB354 + ldr r6, =gUnknown_02022CB0 + movs r5, 0 +_08028D0A: + lsls r0, r3, 2 + adds r2, r0, r6 + ldr r1, [r2] + ldrh r0, [r1, 0x2] + adds r0, 0x1 + strh r0, [r1, 0x2] + adds r1, r3, r7 + lsls r0, 16 + lsrs r0, 16 + ldrb r1, [r1] + cmp r0, r1 + bls _08028D2C + ldrh r0, [r4, 0x20] + subs r0, 0x1 + strh r0, [r4, 0x20] + ldr r0, [r2] + strh r5, [r0, 0x2] +_08028D2C: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x1 + bls _08028D0A +_08028D36: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028CF4 + + thumb_func_start sub_8028D44 +sub_8028D44: @ 8028D44 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x28 + movs r4, 0x80 + lsls r4, 3 + adds r0, r4, 0 + bl AllocZeroed + adds r6, r0, 0 + ldr r0, =gUnknown_082FB360 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x20] + str r1, [sp, 0x24] + ldr r0, =gDodrioBerryPlatformGfx + adds r1, r6, 0 + bl LZ77UnCompWram + cmp r6, 0 + beq _08028DD2 + str r6, [sp, 0x18] + add r0, sp, 0x18 + movs r1, 0xA0 + lsls r1, 11 + orrs r1, r4 + str r1, [r0, 0x4] + mov r2, sp + ldr r1, =gUnknown_082FB368 + ldm r1!, {r3-r5} + stm r2!, {r3-r5} + ldm r1!, {r3-r5} + stm r2!, {r3-r5} + bl LoadSpriteSheet + add r0, sp, 0x20 + bl LoadSpritePalette + movs r5, 0 + ldr r7, =gUnknown_082FB356 + adds r0, r7, 0x2 + mov r9, r0 + ldr r1, =gUnknown_02022CB0 + mov r8, r1 +_08028D9E: + movs r0, 0x4 + bl AllocZeroed + lsls r2, r5, 2 + mov r3, r8 + adds r4, r2, r3 + str r0, [r4] + adds r0, r2, r7 + movs r3, 0 + ldrsh r1, [r0, r3] + add r2, r9 + movs r0, 0 + ldrsh r2, [r2, r0] + mov r0, sp + movs r3, 0x4 + bl CreateSprite + ldr r1, [r4] + lsls r0, 24 + lsrs r0, 24 + strh r0, [r1] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x1 + bls _08028D9E +_08028DD2: + adds r0, r6, 0 + bl Free + add sp, 0x28 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028D44 + + thumb_func_start sub_8028DFC +sub_8028DFC: @ 8028DFC + push {r4-r7,lr} + movs r3, 0 + ldr r0, =gUnknown_02022CB0 + mov r12, r0 + ldr r4, =gUnknown_082FB356 + adds r7, r4, 0x2 + ldr r6, =gSprites + movs r5, 0x1 +_08028E0C: + lsls r2, r3, 2 + mov r1, r12 + adds r0, r2, r1 + ldr r0, [r0] + ldrh r0, [r0] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r6 + adds r0, r1, 0 + adds r0, 0x42 + strh r5, [r0] + adds r0, r2, r4 + ldrh r0, [r0] + strh r0, [r1, 0x20] + adds r2, r7 + ldrh r0, [r2] + strh r0, [r1, 0x22] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x1 + bls _08028E0C + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028DFC + + thumb_func_start sub_8028E4C +sub_8028E4C: @ 8028E4C + push {r4,r5,lr} + movs r2, 0 + ldr r5, =gUnknown_02022CB0 + ldr r4, =gSprites + movs r3, 0 +_08028E56: + lsls r0, r2, 2 + adds r0, r5 + ldr r0, [r0] + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + adds r0, 0x42 + strh r3, [r0] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x1 + bls _08028E56 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028E4C + + thumb_func_start sub_8028E84 +sub_8028E84: @ 8028E84 + push {r4-r6,lr} + movs r5, 0 + ldr r6, =gUnknown_02022CB0 +_08028E8A: + lsls r0, r5, 2 + adds r4, r0, r6 + ldr r0, [r4] + ldrh r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + cmp r0, 0 + beq _08028EA4 + bl DestroySprite +_08028EA4: + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x1 + bls _08028E8A + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028E84 + + thumb_func_start sub_8028EC8 +sub_8028EC8: @ 8028EC8 + push {r4-r7,lr} + lsls r0, 24 + lsrs r0, 24 + movs r3, 0 + ldr r7, =gSprites + ldr r6, =gUnknown_02022CB0 + movs r1, 0x1 + ands r0, r1 + lsls r4, r0, 2 + movs r5, 0x5 + negs r5, r5 +_08028EDE: + lsls r0, r3, 2 + adds r0, r6 + ldr r0, [r0] + ldrh r0, [r0] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r7 + adds r1, 0x3E + ldrb r2, [r1] + adds r0, r5, 0 + ands r0, r2 + orrs r0, r4 + strb r0, [r1] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x1 + bls _08028EDE + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8028EC8 + + thumb_func_start sub_8028F14 +sub_8028F14: @ 8028F14 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r1, 24 + lsrs r1, 24 + movs r3, 0 + subs r0, r1, 0x1 + cmp r0, 0x4 + bhi _08028FC6 + lsls r0, 2 + ldr r1, =_08028F34 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08028F34: + .4byte _08028FB4 + .4byte _08028F48 + .4byte _08028F52 + .4byte _08028F66 + .4byte _08028F8E +_08028F48: + cmp r2, 0 + beq _08028F7E + cmp r2, 0x1 + bne _08028FC6 + b _08028F82 +_08028F52: + cmp r2, 0x1 + beq _08028FB8 + cmp r2, 0x1 + bgt _08028F60 + cmp r2, 0 + beq _08028FB4 + b _08028FC6 +_08028F60: + cmp r2, 0x2 + bne _08028FC6 + b _08028FC4 +_08028F66: + cmp r2, 0x1 + beq _08028F82 + cmp r2, 0x1 + bgt _08028F74 + cmp r2, 0 + beq _08028F7E + b _08028FC6 +_08028F74: + cmp r2, 0x2 + beq _08028F86 + cmp r2, 0x3 + beq _08028F8A + b _08028FC6 +_08028F7E: + movs r3, 0xC + b _08028FC6 +_08028F82: + movs r3, 0x12 + b _08028FC6 +_08028F86: + movs r3, 0x18 + b _08028FC6 +_08028F8A: + movs r3, 0x6 + b _08028FC6 +_08028F8E: + cmp r2, 0x4 + bhi _08028FC6 + lsls r0, r2, 2 + ldr r1, =_08028FA0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08028FA0: + .4byte _08028FB4 + .4byte _08028FB8 + .4byte _08028FBC + .4byte _08028FC0 + .4byte _08028FC4 +_08028FB4: + movs r3, 0xF + b _08028FC6 +_08028FB8: + movs r3, 0x15 + b _08028FC6 +_08028FBC: + movs r3, 0x1B + b _08028FC6 +_08028FC0: + movs r3, 0x3 + b _08028FC6 +_08028FC4: + movs r3, 0x9 +_08028FC6: + lsls r0, r3, 3 + pop {r1} + bx r1 + thumb_func_end sub_8028F14 + + thumb_func_start sub_8028FCC +sub_8028FCC: @ 8028FCC + push {r4,lr} + movs r4, 0 +_08028FD0: + adds r0, r4, 0 + movs r1, 0x1 + bl sub_8028BF8 + adds r0, r4, 0 + movs r1, 0x1 + bl sub_8028C7C + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0xA + bls _08028FD0 + movs r0, 0 + bl sub_80289E8 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8028FCC + + thumb_func_start sub_8028FF8 +sub_8028FF8: @ 8028FF8 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + adds r0, r4, 0 + bl sub_8098758 + ldr r1, [r0] + movs r2, 0x90 + lsls r2, 1 + movs r0, 0 + movs r3, 0x1 + bl LoadBgTiles + adds r0, r4, 0 + bl sub_8098758 + ldr r0, [r0, 0x4] + movs r1, 0xA0 + movs r2, 0x20 + bl LoadPalette + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8028FF8 + + thumb_func_start sub_802902C +sub_802902C: @ 802902C + push {lr} + movs r0, 0 + movs r1, 0xA + movs r2, 0xB0 + bl box_border_load_tiles_and_pal + pop {r0} + bx r0 + thumb_func_end sub_802902C + + thumb_func_start sub_802903C +sub_802903C: @ 802903C + ldr r3, =gUnknown_02022CF8 + ldr r0, [r3] + movs r2, 0xC0 + lsls r2, 6 + adds r1, r0, r2 + movs r2, 0 + str r2, [r1] + ldr r1, =0x00003014 + adds r0, r1 + strb r2, [r0] + ldr r0, [r3] + adds r1, 0x4 + adds r0, r1 + strb r2, [r0] + ldr r0, [r3] + adds r1, 0x8 + adds r0, r1 + strb r2, [r0] + ldr r0, [r3] + adds r1, 0x4 + adds r0, r1 + strb r2, [r0] + bx lr + .pool + thumb_func_end sub_802903C + + thumb_func_start sub_8029074 +sub_8029074: @ 8029074 + push {r4-r6,lr} + sub sp, 0xC + adds r4, r0, 0 + movs r6, 0xA + ldrb r2, [r4, 0x1] + subs r2, 0x1 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + subs r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + movs r5, 0x1 + str r5, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x1 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x1] + ldrb r3, [r4, 0x2] + subs r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + ldrb r0, [r4, 0x3] + str r0, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x2 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x3] + ldrb r0, [r4, 0x1] + adds r2, r0 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + subs r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + str r5, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x3 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x1] + subs r2, 0x1 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + str r5, [sp] + ldrb r0, [r4, 0x4] + str r0, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x4 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x3] + ldrb r0, [r4, 0x1] + adds r2, r0 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + str r5, [sp] + ldrb r0, [r4, 0x4] + str r0, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x6 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x1] + subs r2, 0x1 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x4] + ldrb r0, [r4, 0x2] + adds r3, r0 + lsls r3, 24 + lsrs r3, 24 + str r5, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x7 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x1] + ldrb r3, [r4, 0x4] + ldrb r0, [r4, 0x2] + adds r3, r0 + lsls r3, 24 + lsrs r3, 24 + ldrb r0, [r4, 0x3] + str r0, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x8 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x3] + ldrb r0, [r4, 0x1] + adds r2, r0 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x4] + ldrb r4, [r4, 0x2] + adds r3, r4 + lsls r3, 24 + lsrs r3, 24 + str r5, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x9 + bl FillBgTilemapBufferRect + add sp, 0xC + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8029074 + + thumb_func_start sub_8029174 +sub_8029174: @ 8029174 + push {r4-r6,lr} + sub sp, 0xC + adds r4, r0, 0 + movs r6, 0xB + ldrb r2, [r4, 0x1] + subs r2, 0x1 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + subs r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + movs r5, 0x1 + str r5, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0xA + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x1] + ldrb r3, [r4, 0x2] + subs r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + ldrb r0, [r4, 0x3] + str r0, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0xB + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x3] + ldrb r0, [r4, 0x1] + adds r2, r0 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + subs r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + str r5, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0xC + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x1] + subs r2, 0x1 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + str r5, [sp] + ldrb r0, [r4, 0x4] + str r0, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0xD + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x3] + ldrb r0, [r4, 0x1] + adds r2, r0 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x2] + str r5, [sp] + ldrb r0, [r4, 0x4] + str r0, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0xF + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x1] + subs r2, 0x1 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x4] + ldrb r0, [r4, 0x2] + adds r3, r0 + lsls r3, 24 + lsrs r3, 24 + str r5, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x10 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x1] + ldrb r3, [r4, 0x4] + ldrb r0, [r4, 0x2] + adds r3, r0 + lsls r3, 24 + lsrs r3, 24 + ldrb r0, [r4, 0x3] + str r0, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x11 + bl FillBgTilemapBufferRect + ldrb r2, [r4, 0x3] + ldrb r0, [r4, 0x1] + adds r2, r0 + lsls r2, 24 + lsrs r2, 24 + ldrb r3, [r4, 0x4] + ldrb r4, [r4, 0x2] + adds r3, r4 + lsls r3, 24 + lsrs r3, 24 + str r5, [sp] + str r5, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0 + movs r1, 0x12 + bl FillBgTilemapBufferRect + add sp, 0xC + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8029174 + + thumb_func_start sub_8029274 +sub_8029274: @ 8029274 + push {r4,lr} + ldr r4, =gUnknown_02022CF8 + str r0, [r4] + movs r2, 0xC0 + lsls r2, 6 + adds r1, r0, r2 + movs r2, 0 + str r2, [r1] + ldr r3, =0x00003014 + adds r1, r0, r3 + strb r2, [r1] + ldr r1, =0x00003018 + adds r0, r1 + strb r2, [r0] + ldr r0, [r4] + adds r3, 0xC + adds r0, r3 + strb r2, [r0] + ldr r0, [r4] + adds r1, 0xC + adds r0, r1 + strb r2, [r0] + ldr r0, =sub_8029314 + movs r1, 0x3 + bl CreateTask + ldr r1, [r4] + ldr r2, =0x00003004 + adds r1, r2 + strb r0, [r1] + ldr r0, =sub_8029338 + bl sub_802A72C + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8029274 + + thumb_func_start sub_80292D4 +sub_80292D4: @ 80292D4 + push {lr} + bl FreeAllWindowBuffers + pop {r0} + bx r0 + thumb_func_end sub_80292D4 + + thumb_func_start sub_80292E0 +sub_80292E0: @ 80292E0 + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + movs r4, 0 + ldr r5, =gUnknown_082FB40C + adds r7, r5, 0x4 +_080292EC: + lsls r1, r4, 3 + adds r0, r1, r5 + ldrb r0, [r0] + cmp r0, r6 + bne _080292FE + adds r0, r1, r7 + ldr r0, [r0] + bl sub_802A72C +_080292FE: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x9 + bls _080292EC + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80292E0 + + thumb_func_start sub_8029314 +sub_8029314: @ 8029314 + push {lr} + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + movs r1, 0xC0 + lsls r1, 6 + adds r0, r1 + ldr r0, [r0] + cmp r0, 0 + bne _0802932E + bl sub_802A75C + bl _call_via_r0 +_0802932E: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8029314 + + thumb_func_start sub_8029338 +sub_8029338: @ 8029338 + push {lr} + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r2, =0x00003014 + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x4 + bhi _08029430 + lsls r0, 2 + ldr r1, =_08029360 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08029360: + .4byte _08029374 + .4byte _0802937A + .4byte _08029394 + .4byte _080293D8 + .4byte _08029404 +_08029374: + bl sub_802A7A8 + b _08029414 +_0802937A: + bl sub_802A8E8 + cmp r0, 0x1 + bne _0802943A + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r2, =0x00003014 + adds r1, r2 + b _0802941C + .pool +_08029394: + ldr r1, =gDodrioBerryBgTilemap1 + movs r0, 0x3 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + ldr r1, =gDodrioBerryBgTilemap2Left + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + ldr r1, =gDodrioBerryBgTilemap2Right + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + movs r0, 0x3 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + b _08029414 + .pool +_080293D8: + movs r0, 0 + bl ShowBg + movs r0, 0x3 + bl ShowBg + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r2, =0x00003014 + adds r1, r2 + b _0802941C + .pool +_08029404: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x14] + lsrs r0, 3 + bl sub_8028FF8 + bl sub_802902C +_08029414: + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r0, =0x00003014 + adds r1, r0 +_0802941C: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _0802943A + .pool +_08029430: + movs r2, 0xC0 + lsls r2, 6 + adds r1, r2 + movs r0, 0x1 + str r0, [r1] +_0802943A: + pop {r0} + bx r0 + thumb_func_end sub_8029338 + + thumb_func_start sub_8029440 +sub_8029440: @ 8029440 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x1C + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r2, =0x00003014 + adds r1, r0, r2 + ldrb r0, [r1] + cmp r0, 0 + beq _08029488 + cmp r0, 0x1 + bne _08029460 + b _080295EC +_08029460: + adds r0, 0x1 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xB4 + bhi _0802946E + b _0802968E +_0802946E: + bl sub_8027650 + lsls r0, 24 + lsrs r7, r0, 24 + movs r6, 0 + cmp r6, r7 + bcc _0802947E + b _08029666 +_0802947E: + b _08029640 + .pool +_08029488: + bl sub_8027650 + lsls r0, 24 + lsrs r7, r0, 24 + ldr r1, =gUnknown_082FB3C8 + subs r0, r7, 0x1 + lsls r0, 2 + adds r0, r1 + ldr r5, [r0] + ldr r2, =0xffffff00 + ldr r0, [sp, 0xC] + ands r0, r2 + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0xE0 + lsls r1, 19 + orrs r0, r1 + str r0, [sp, 0xC] + ldr r0, [sp, 0x10] + ands r0, r2 + movs r1, 0x2 + orrs r0, r1 + ldr r1, =0xffff00ff + ands r0, r1 + movs r1, 0xD0 + lsls r1, 4 + orrs r0, r1 + ldr r1, =0x0000ffff + ands r0, r1 + movs r1, 0x98 + lsls r1, 13 + orrs r0, r1 + str r0, [sp, 0x10] + movs r6, 0 + cmp r6, r7 + bcs _080295B8 + mov r3, sp + adds r3, 0xC + str r3, [sp, 0x18] + mov r10, r4 + ldr r0, =0x00003008 + mov r9, r0 +_080294DC: + movs r1, 0 + mov r8, r1 + adds r0, r6, 0 + bl sub_8027A48 + lsls r0, 24 + lsrs r0, 24 + adds r4, r0, 0 + bl sub_8027660 + adds r1, r0, 0 + movs r0, 0x1 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + movs r1, 0x38 + subs r1, r0 + lsrs r1, 1 + str r1, [sp, 0x14] + ldrb r0, [r5] + lsls r0, 8 + ldr r2, =0xffff00ff + ldr r1, [sp, 0xC] + ands r1, r2 + orrs r1, r0 + str r1, [sp, 0xC] + ldrb r2, [r5, 0x1] + lsls r2, 16 + ldr r0, =0xff00ffff + ands r0, r1 + orrs r0, r2 + str r0, [sp, 0xC] + add r0, sp, 0xC + bl AddWindow + mov r2, r10 + ldr r1, [r2] + add r1, r9 + adds r1, r6 + strb r0, [r1] + ldr r0, [r2] + add r0, r9 + adds r0, r6 + ldrb r0, [r0] + bl ClearWindowTilemap + mov r3, r10 + ldr r0, [r3] + add r0, r9 + adds r0, r6 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + bl GetMultiplayerId + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + bne _0802955A + movs r0, 0x2 + mov r8, r0 +_0802955A: + adds r0, r4, 0 + bl sub_8027660 + adds r4, r0, 0 + mov r1, r10 + ldr r0, [r1] + add r0, r9 + adds r0, r6 + ldrb r0, [r0] + ldr r3, [sp, 0x14] + lsls r2, r3, 24 + lsrs r2, 24 + mov r3, r8 + lsls r1, r3, 1 + add r1, r8 + ldr r3, =gUnknown_082FB380 + adds r1, r3 + str r1, [sp] + movs r1, 0x1 + negs r1, r1 + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x1 + bl box_print + mov r2, r10 + ldr r0, [r2] + add r0, r9 + adds r0, r6 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r3, [sp, 0x18] + ldrh r0, [r3, 0x6] + adds r0, 0xE + strh r0, [r3, 0x6] + add r0, sp, 0xC + bl sub_8029174 + adds r5, 0x4 + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, r7 + bcc _080294DC +_080295B8: + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r0, =0x00003014 + adds r1, r0 + b _0802962A + .pool +_080295EC: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802968E + bl sub_8027650 + lsls r0, 24 + lsrs r7, r0, 24 + movs r6, 0 + cmp r6, r7 + bcs _0802961C +_08029604: + ldr r0, [r4] + ldr r1, =0x00003008 + adds r0, r1 + adds r0, r6 + ldrb r0, [r0] + bl PutWindowTilemap + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, r7 + bcc _08029604 +_0802961C: + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r2, =0x00003014 + adds r1, r2 +_0802962A: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _0802968E + .pool +_08029640: + ldr r5, =gUnknown_02022CF8 + ldr r0, [r5] + ldr r4, =0x00003008 + adds r0, r4 + adds r0, r6 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r5] + adds r0, r4 + adds r0, r6 + ldrb r0, [r0] + bl RemoveWindow + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, r7 + bcc _08029640 +_08029666: + movs r0, 0x1E + str r0, [sp] + movs r0, 0x14 + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + movs r3, 0xC0 + lsls r3, 6 + adds r0, r3 + movs r1, 0x1 + str r1, [r0] +_0802968E: + 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_8029440 + + thumb_func_start sub_80296A8 +sub_80296A8: @ 80296A8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x6C + lsls r0, 24 + movs r1, 0 + mov r8, r1 + movs r6, 0 + lsrs r7, r0, 24 + add r4, sp, 0x2C + ldr r1, =gUnknown_082FB45C + adds r0, r4, 0 + movs r2, 0x5 + bl memcpy + movs r5, 0 + cmp r5, r7 + bcs _080296F8 + add r4, sp, 0x34 +_080296D2: + mov r0, sp + adds r0, r5 + adds r0, 0x2C + strb r5, [r0] + add r0, sp, 0x5C + adds r1, r5, 0 + bl sub_802793C + lsls r2, r5, 3 + adds r2, r4, r2 + ldr r0, [sp, 0x5C] + ldr r1, [sp, 0x60] + str r0, [r2] + str r1, [r2, 0x4] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, r7 + bcc _080296D2 +_080296F8: + bl sub_8027748 + cmp r0, 0 + beq _0802972E +_08029700: + movs r5, 0 + cmp r5, r7 + bcs _08029728 + add r2, sp, 0x34 + add r1, sp, 0x2C +_0802970A: + lsls r0, r5, 3 + adds r0, r2, r0 + ldrb r0, [r0] + cmp r0, r8 + bne _0802971E + adds r0, r1, r6 + strb r5, [r0] + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 +_0802971E: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, r7 + bcc _0802970A +_08029728: + mov r8, r6 + cmp r6, r7 + bcc _08029700 +_0802972E: + movs r5, 0 + ldr r4, =gText_SpacePoints + cmp r5, r7 + bcs _08029754 + add r1, sp, 0x34 + add r6, sp, 0x38 + subs r3, r7, 0x1 +_0802973C: + lsls r2, r5, 3 + adds r0, r6, r2 + ldr r0, [r0] + cmp r0, 0 + bne _0802974A + adds r0, r1, r2 + strb r3, [r0] +_0802974A: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, r7 + bcc _0802973C +_08029754: + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0 + bl GetStringWidth + movs r1, 0xD8 + subs r1, r0 + str r1, [sp, 0x64] + movs r5, 0 + cmp r5, r7 + bcs _08029860 + mov r2, sp + adds r2, 0x34 + str r2, [sp, 0x68] + ldr r3, =0x00003009 + mov r10, r3 +_08029774: + movs r0, 0 + mov r8, r0 + mov r0, sp + adds r0, r5 + adds r0, 0x2C + ldrb r0, [r0] + adds r4, r0, 0 + lsls r1, r4, 3 + add r0, sp, 0x38 + adds r0, r1 + ldr r0, [r0] + mov r9, r0 + ldr r2, =gUnknown_02022CF8 + ldr r0, [r2] + add r0, r10 + ldrb r0, [r0] + ldr r2, =gUnknown_082FB3DC + ldr r3, [sp, 0x68] + adds r1, r3, r1 + ldrb r1, [r1] + lsls r1, 2 + adds r1, r2 + ldr r2, [r1] + ldr r3, =gUnknown_082FB402 + lsls r1, r5, 1 + adds r1, r3 + ldrb r6, [r1] + str r6, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + mov r3, r8 + str r3, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x8 + bl PrintTextOnWindow + bl GetMultiplayerId + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + bne _080297CC + movs r0, 0x2 + mov r8, r0 +_080297CC: + adds r0, r4, 0 + bl sub_8027660 + adds r3, r0, 0 + ldr r1, =gUnknown_02022CF8 + ldr r0, [r1] + add r0, r10 + ldrb r0, [r0] + mov r2, r8 + lsls r1, r2, 1 + add r1, r8 + ldr r2, =gUnknown_082FB380 + adds r1, r2 + str r1, [sp] + movs r1, 0x1 + negs r1, r1 + str r1, [sp, 0x4] + str r3, [sp, 0x8] + movs r1, 0x1 + movs r2, 0x1C + adds r3, r6, 0 + bl box_print + add r0, sp, 0xC + mov r1, r9 + movs r2, 0 + movs r3, 0x7 + bl ConvertIntToDecimalStringN + movs r0, 0x1 + add r1, sp, 0xC + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + adds r3, r0, 0 + ldr r2, =gUnknown_02022CF8 + ldr r0, [r2] + add r0, r10 + ldrb r0, [r0] + ldr r1, [sp, 0x64] + subs r3, r1, r3 + lsls r3, 24 + lsrs r3, 24 + str r6, [sp] + movs r2, 0xFF + str r2, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + add r2, sp, 0xC + bl PrintTextOnWindow + ldr r2, =gUnknown_02022CF8 + ldr r0, [r2] + add r0, r10 + ldrb r0, [r0] + ldr r1, [sp, 0x64] + lsls r3, r1, 24 + str r6, [sp] + movs r2, 0xFF + str r2, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + ldr r2, =gText_SpacePoints + lsrs r3, 24 + bl PrintTextOnWindow + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, r7 + bcc _08029774 +_08029860: + add sp, 0x6C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80296A8 + + thumb_func_start sub_802988C +sub_802988C: @ 802988C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x14 + bl sub_8027650 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0xC] + ldr r6, =gUnknown_02022CF8 + ldr r1, [r6] + ldr r2, =0x00003014 + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0xB + bls _080298B2 + b _08029FA8 +_080298B2: + lsls r0, 2 + ldr r1, =_080298C8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080298C8: + .4byte _080298F8 + .4byte _08029914 + .4byte _0802996C + .4byte _08029B6C + .4byte _08029BB8 + .4byte _08029BFC + .4byte _08029C60 + .4byte _08029C9C + .4byte _08029CE0 + .4byte _08029DA0 + .4byte _08029F08 + .4byte _08029F5C +_080298F8: + bl sub_802784C + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r0, =0x0000301c + adds r2, r1, r0 + movs r0, 0 + strh r0, [r2] + b _08029F8A + .pool +_08029914: + ldr r6, =gUnknown_082F7BBC + adds r0, r6, 0 + bl AddWindow + ldr r4, =gUnknown_02022CF8 + ldr r1, [r4] + ldr r2, =0x00003008 + mov r8, r2 + add r1, r8 + strb r0, [r1] + movs r0, 0x8 + adds r0, r6 + mov r9, r0 + bl AddWindow + ldr r1, [r4] + ldr r5, =0x00003009 + adds r1, r5 + strb r0, [r1] + ldr r0, [r4] + add r0, r8 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r4] + adds r0, r5 + ldrb r0, [r0] + bl ClearWindowTilemap + adds r0, r6, 0 + bl sub_8029174 + mov r0, r9 + bl sub_8029174 + b _08029F88 + .pool +_0802996C: + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r5, =0x00003008 + adds r0, r5 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r4] + ldr r1, =0x00003009 + mov r9, r1 + add r0, r9 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r2, =gText_BerryPickingResults + mov r8, r2 + movs r2, 0x1 + negs r2, r2 + movs r0, 0x1 + mov r1, r8 + bl GetStringWidth + adds r1, r0, 0 + movs r0, 0xE0 + subs r0, r1 + lsrs r3, r0, 1 + ldr r0, [r4] + adds r0, r5 + ldrb r0, [r0] + lsls r3, 24 + lsrs r3, 24 + movs r1, 0x1 + str r1, [sp] + movs r6, 0xFF + str r6, [sp, 0x4] + movs r5, 0 + str r5, [sp, 0x8] + mov r2, r8 + bl PrintTextOnWindow + ldr r0, [r4] + add r0, r9 + ldrb r0, [r0] + ldr r2, =gText_10P30P50P50P + movs r1, 0x11 + str r1, [sp] + str r6, [sp, 0x4] + str r5, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x44 + bl PrintTextOnWindow + mov r9, r5 + ldr r0, [sp, 0xC] + cmp r9, r0 + bcc _080299E2 + b _08029B2A +_080299E2: + movs r4, 0 + bl GetMultiplayerId + lsls r0, 24 + lsrs r0, 24 + cmp r9, r0 + bne _080299F2 + movs r4, 0x2 +_080299F2: + mov r0, r9 + bl sub_8027660 + adds r6, r0, 0 + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + ldr r1, =0x00003009 + adds r0, r1 + ldrb r0, [r0] + mov r2, r9 + lsls r5, r2, 1 + ldr r2, =gUnknown_082FB3F8 + adds r1, r5, r2 + ldrb r3, [r1] + lsls r1, r4, 1 + adds r1, r4 + ldr r2, =gUnknown_082FB380 + adds r1, r2 + str r1, [sp] + movs r4, 0x1 + negs r4, r4 + str r4, [sp, 0x4] + str r6, [sp, 0x8] + movs r1, 0x1 + movs r2, 0 + bl box_print + movs r7, 0 + mov r8, r5 + mov r0, r9 + adds r0, 0x1 + str r0, [sp, 0x10] + ldr r1, =gStringVar4 + mov r10, r1 +_08029A36: + mov r0, r9 + adds r1, r7, 0 + bl sub_80276A0 + lsls r0, 16 + lsrs r0, 16 + ldr r1, =0x0000270f + bl sub_8027A38 + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + adds r0, r7, 0 + bl sub_802778C + ldr r1, =0x0000270f + bl sub_8027A38 + lsls r0, 16 + lsrs r6, r0, 16 + mov r0, r10 + adds r1, r4, 0 + movs r2, 0 + movs r3, 0x4 + bl ConvertIntToDecimalStringN + movs r0, 0x1 + mov r1, r10 + movs r2, 0x1 + negs r2, r2 + bl GetStringWidth + adds r5, r0, 0 + cmp r6, r4 + bne _08029AE0 + cmp r6, 0 + beq _08029AE0 + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + lsls r1, r7, 1 + ldr r2, =gUnknown_082FB3F0 + adds r1, r2 + ldrb r2, [r1] + subs r2, r5 + lsls r2, 24 + lsrs r2, 24 + ldr r1, =gUnknown_082FB3F8 + add r1, r8 + ldrb r3, [r1] + ldr r1, =gUnknown_082FB383 + str r1, [sp] + movs r1, 0x1 + negs r1, r1 + str r1, [sp, 0x4] + mov r1, r10 + str r1, [sp, 0x8] + movs r1, 0x1 + bl box_print + b _08029B10 + .pool +_08029AE0: + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + lsls r1, r7, 1 + ldr r2, =gUnknown_082FB3F0 + adds r1, r2 + ldrb r3, [r1] + subs r3, r5 + lsls r3, 24 + lsrs r3, 24 + ldr r1, =gUnknown_082FB3F8 + add r1, r8 + ldrb r1, [r1] + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + ldr r2, =gStringVar4 + bl PrintTextOnWindow +_08029B10: + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + cmp r7, 0x3 + bls _08029A36 + ldr r1, [sp, 0x10] + lsls r0, r1, 24 + lsrs r0, 24 + mov r9, r0 + ldr r2, [sp, 0xC] + cmp r9, r2 + bcs _08029B2A + b _080299E2 +_08029B2A: + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x00003008 + adds r0, r1 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r0, [r4] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r1, [r4] + ldr r0, =0x00003014 + adds r1, r0 + b _08029F8E + .pool +_08029B6C: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _08029B90 + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x00003008 + adds r0, r1 + ldrb r0, [r0] + bl PutWindowTilemap + ldr r0, [r4] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + bl PutWindowTilemap +_08029B90: + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0 + bl sub_8028C30 + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r0, =0x00003014 + adds r1, r0 + b _08029F8E + .pool +_08029BB8: + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x0000301c + adds r2, r0, r1 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1D + bhi _08029BD0 + b _08029FF8 +_08029BD0: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _08029BDE + b _08029FF8 +_08029BDE: + movs r0, 0 + strh r0, [r2] + movs r0, 0x5 + bl PlaySE + movs r0, 0x1 + bl sub_8028C30 + b _08029F88 + .pool +_08029BFC: + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r5, =0x00003008 + adds r0, r5 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r4] + ldr r1, =0x00003009 + adds r0, r1 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r6, =gText_AnnouncingRankings + movs r2, 0x1 + negs r2, r2 + movs r0, 0x1 + adds r1, r6, 0 + bl GetStringWidth + adds r1, r0, 0 + movs r0, 0xE0 + subs r0, r1 + lsrs r3, r0, 1 + ldr r0, [r4] + adds r0, r5 + ldrb r0, [r0] + lsls r3, 24 + lsrs r3, 24 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + adds r2, r6, 0 + bl PrintTextOnWindow + b _08029F88 + .pool +_08029C60: + ldr r0, [sp, 0xC] + bl sub_80296A8 + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x00003008 + adds r0, r1 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r0, [r4] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r1, [r4] + ldr r0, =0x00003014 + adds r1, r0 + b _08029F8E + .pool +_08029C9C: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _08029CC0 + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x00003008 + adds r0, r1 + ldrb r0, [r0] + bl PutWindowTilemap + ldr r0, [r4] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + bl PutWindowTilemap +_08029CC0: + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r0, =0x00003014 + adds r1, r0 + b _08029F8E + .pool +_08029CE0: + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x0000301c + adds r2, r0, r1 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1D + bhi _08029CF8 + b _08029FF8 +_08029CF8: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _08029D06 + b _08029FF8 +_08029D06: + movs r0, 0 + strh r0, [r2] + movs r0, 0x5 + bl PlaySE + bl sub_8027748 + ldr r1, =0x00000bb7 + cmp r0, r1 + bhi _08029D3C + ldr r0, [r4] + ldr r2, =0x00003014 + adds r0, r2 + movs r1, 0x7F + strb r1, [r0] + b _08029D4C + .pool +_08029D3C: + bl StopMapMusic + ldr r1, [r4] + ldr r0, =0x00003014 + adds r1, r0 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] +_08029D4C: + movs r0, 0x1E + str r0, [sp] + movs r0, 0xF + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0x5 + bl FillBgTilemapBufferRect_Palette0 + ldr r5, =gUnknown_02022CF8 + ldr r0, [r5] + ldr r4, =0x00003009 + adds r0, r4 + ldrb r0, [r0] + bl RemoveWindow + ldr r6, =gUnknown_082F7BCC + adds r0, r6, 0 + bl AddWindow + ldr r1, [r5] + adds r1, r4 + strb r0, [r1] + ldr r0, [r5] + adds r0, r4 + ldrb r0, [r0] + bl ClearWindowTilemap + adds r0, r6, 0 + bl sub_8029174 + b _08029FF8 + .pool +_08029DA0: + ldr r0, =0x0000016f + bl PlayNewMapMusic + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r6, =0x00003008 + adds r0, r6 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r4] + ldr r1, =0x00003009 + mov r10, r1 + add r0, r10 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r5, =gText_AnnouncingPrizes + movs r2, 0x1 + negs r2, r2 + movs r0, 0x1 + adds r1, r5, 0 + bl GetStringWidth + adds r1, r0, 0 + movs r0, 0xE0 + subs r0, r1 + lsrs r3, r0, 1 + ldr r0, [r4] + adds r0, r6 + ldrb r0, [r0] + lsls r3, 24 + lsrs r3, 24 + movs r2, 0x1 + mov r9, r2 + str r2, [sp] + movs r1, 0xFF + mov r8, r1 + str r1, [sp, 0x4] + movs r6, 0 + str r6, [sp, 0x8] + movs r1, 0x1 + adds r2, r5, 0 + bl PrintTextOnWindow + bl sub_81AFBF0 + bl sub_802762C + lsls r0, 16 + lsrs r0, 16 + ldr r5, =gStringVar1 + adds r1, r5, 0 + bl CopyItemName + movs r0, 0 + adds r1, r5, 0 + bl sub_81AFC0C + ldr r7, =gStringVar4 + ldr r1, =gText_FirstPlacePrize + adds r0, r7, 0 + bl sub_81AFC28 + ldr r0, [r4] + add r0, r10 + ldrb r0, [r0] + mov r2, r9 + str r2, [sp] + mov r1, r8 + str r1, [sp, 0x4] + str r6, [sp, 0x8] + movs r1, 0x1 + adds r2, r7, 0 + movs r3, 0 + bl PrintTextOnWindow + bl sub_80279C8 + lsls r0, 24 + lsrs r4, r0, 24 + adds r6, r4, 0 + cmp r4, 0 + beq _08029EC8 + cmp r4, 0x3 + beq _08029EC8 + bl sub_81AFBF0 + bl sub_802762C + lsls r0, 16 + lsrs r0, 16 + adds r1, r5, 0 + bl CopyItemName + movs r0, 0 + adds r1, r5, 0 + bl sub_81AFC0C + cmp r4, 0x2 + bne _08029E9C + ldr r1, =gText_CantHoldAnyMore + adds r0, r7, 0 + bl sub_81AFC28 + b _08029EA8 + .pool +_08029E9C: + cmp r6, 0x1 + bne _08029EA8 + ldr r1, =gText_FilledStorageSpace + adds r0, r7, 0 + bl sub_81AFC28 +_08029EA8: + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + ldr r2, =gStringVar4 + movs r1, 0x29 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow +_08029EC8: + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x00003008 + adds r0, r1 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r0, [r4] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r1, [r4] + ldr r0, =0x00003014 + adds r1, r0 + b _08029F8E + .pool +_08029F08: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _08029F2C + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x00003008 + adds r0, r1 + ldrb r0, [r0] + bl PutWindowTilemap + ldr r0, [r4] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + bl PutWindowTilemap +_08029F2C: + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, =0x0000020b + movs r1, 0x14 + movs r2, 0xA + bl FadeOutAndFadeInNewMapMusic + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r0, =0x00003014 + adds r1, r0 + b _08029F8E + .pool +_08029F5C: + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x0000301c + adds r2, r0, r1 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1D + bls _08029FF8 + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08029FF8 + movs r0, 0 + strh r0, [r2] + movs r0, 0x5 + bl PlaySE +_08029F88: + ldr r1, [r4] +_08029F8A: + ldr r2, =0x00003014 + adds r1, r2 +_08029F8E: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _08029FF8 + .pool +_08029FA8: + ldr r5, =0x00003008 + adds r0, r1, r5 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r6] + ldr r4, =0x00003009 + adds r0, r4 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r6] + adds r0, r5 + ldrb r0, [r0] + bl RemoveWindow + ldr r0, [r6] + adds r0, r4 + ldrb r0, [r0] + bl RemoveWindow + movs r0, 0x1E + str r0, [sp] + movs r0, 0x14 + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, [r6] + movs r1, 0xC0 + lsls r1, 6 + adds r0, r1 + movs r1, 0x1 + str r1, [r0] +_08029FF8: + add sp, 0x14 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802988C + + thumb_func_start sub_802A010 +sub_802A010: @ 802A010 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x10 + ldr r1, =gUnknown_02022CF8 + ldr r2, [r1] + ldr r3, =0x00003014 + adds r0, r2, r3 + ldrb r6, [r0] + adds r7, r1, 0 + cmp r6, 0x1 + beq _0802A0CC + cmp r6, 0x1 + bgt _0802A040 + cmp r6, 0 + beq _0802A04E + b _0802A2FC + .pool +_0802A040: + cmp r6, 0x2 + bne _0802A046 + b _0802A194 +_0802A046: + cmp r6, 0x3 + bne _0802A04C + b _0802A1D0 +_0802A04C: + b _0802A2FC +_0802A04E: + ldr r0, =gUnknown_082F7BD4 + mov r9, r0 + bl AddWindow + ldr r1, [r7] + ldr r4, =0x00003008 + adds r1, r4 + strb r0, [r1] + movs r1, 0x8 + add r1, r9 + mov r8, r1 + mov r0, r8 + bl AddWindow + ldr r1, [r7] + ldr r2, =0x00003009 + adds r1, r2 + strb r0, [r1] + ldr r0, [r7] + adds r0, r4 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r7] + ldr r3, =0x00003009 + adds r0, r3 + ldrb r0, [r0] + bl ClearWindowTilemap + mov r0, r9 + bl sub_8029174 + mov r0, r8 + bl sub_8029074 + ldr r1, [r7] + ldr r0, =0x00003014 + adds r1, r0 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + ldr r0, [r7] + ldr r1, =0x00003020 + adds r0, r1 + strb r6, [r0] + ldr r0, [r7] + ldr r2, =0x00003024 + adds r0, r2 + strb r6, [r0] + b _0802A35E + .pool +_0802A0CC: + ldr r3, =0x00003008 + mov r8, r3 + adds r0, r2, r3 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r7] + ldr r1, =0x00003009 + mov r10, r1 + add r0, r10 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r7] + add r0, r8 + ldrb r0, [r0] + ldr r2, =gText_WantToPlayAgain + movs r1, 0x5 + str r1, [sp] + movs r3, 0xFF + mov r9, r3 + str r3, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r7] + add r0, r10 + ldrb r0, [r0] + ldr r2, =gText_Yes + str r6, [sp] + mov r3, r9 + str r3, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x8 + bl PrintTextOnWindow + ldr r0, [r7] + add r0, r10 + ldrb r0, [r0] + ldr r2, =gText_No + movs r1, 0x11 + str r1, [sp] + mov r3, r9 + str r3, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x8 + bl PrintTextOnWindow + ldr r0, [r7] + add r0, r10 + ldrb r0, [r0] + ldr r2, =gText_SelectorArrow2 + str r6, [sp] + mov r3, r9 + str r3, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r7] + add r0, r8 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r0, [r7] + add r0, r10 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r1, [r7] + ldr r2, =0x00003014 + adds r1, r2 + b _0802A2EA + .pool +_0802A194: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802A1B6 + ldr r0, [r7] + ldr r3, =0x00003008 + adds r0, r3 + ldrb r0, [r0] + bl PutWindowTilemap + ldr r0, [r7] + ldr r1, =0x00003009 + adds r0, r1 + ldrb r0, [r0] + bl PutWindowTilemap +_0802A1B6: + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r1, [r7] + ldr r2, =0x00003014 + adds r1, r2 + b _0802A2EA + .pool +_0802A1D0: + ldr r3, =0x00003020 + adds r0, r2, r3 + ldrb r5, [r0] + cmp r5, 0 + bne _0802A1DC + movs r5, 0x1 +_0802A1DC: + ldr r0, =0x00003009 + mov r8, r0 + adds r0, r2, r0 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r7] + add r0, r8 + ldrb r0, [r0] + ldr r2, =gText_Yes + movs r1, 0x1 + str r1, [sp] + movs r3, 0xFF + mov r10, r3 + str r3, [sp, 0x4] + movs r1, 0 + mov r9, r1 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x8 + bl PrintTextOnWindow + ldr r0, [r7] + add r0, r8 + ldrb r0, [r0] + ldr r2, =gText_No + movs r1, 0x11 + str r1, [sp] + mov r3, r10 + str r3, [sp, 0x4] + mov r1, r9 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x8 + bl PrintTextOnWindow + ldr r0, [r7] + add r0, r8 + ldrb r0, [r0] + ldr r2, =gText_SelectorArrow2 + subs r1, r5, 0x1 + lsls r1, 4 + adds r1, 0x1 + lsls r1, 24 + lsrs r1, 24 + str r1, [sp] + mov r3, r10 + str r3, [sp, 0x4] + mov r1, r9 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r7] + add r0, r8 + ldrb r0, [r0] + movs r1, 0x3 + bl CopyWindowToVram + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r5, 0x1 + movs r2, 0x1 + ands r2, r1 + cmp r2, 0 + beq _0802A294 + movs r0, 0x5 + bl PlaySE + ldr r0, [r7] + ldr r3, =0x00003020 + adds r1, r0, r3 + ldrb r0, [r1] + cmp r0, 0 + bne _0802A2E4 + strb r5, [r1] + b _0802A2E4 + .pool +_0802A294: + movs r0, 0xC0 + ands r0, r1 + cmp r0, 0 + beq _0802A2CC + movs r0, 0x5 + bl PlaySE + ldr r0, [r7] + ldr r2, =0x00003020 + adds r1, r0, r2 + ldrb r0, [r1] + cmp r0, 0x1 + beq _0802A2C2 + cmp r0, 0x1 + bgt _0802A2BC + cmp r0, 0 + beq _0802A2C2 + b _0802A35E + .pool +_0802A2BC: + cmp r0, 0x2 + beq _0802A2C8 + b _0802A35E +_0802A2C2: + movs r0, 0x2 + strb r0, [r1] + b _0802A35E +_0802A2C8: + strb r5, [r1] + b _0802A35E +_0802A2CC: + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0802A35E + movs r0, 0x5 + bl PlaySE + ldr r0, [r7] + ldr r3, =0x00003020 + adds r0, r3 + movs r1, 0x2 + strb r1, [r0] +_0802A2E4: + ldr r1, [r7] + ldr r0, =0x00003014 + adds r1, r0 +_0802A2EA: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _0802A35E + .pool +_0802A2FC: + ldr r0, [r7] + ldr r2, =0x00003020 + adds r1, r0, r2 + ldrb r1, [r1] + ldr r3, =0x00003024 + adds r0, r3 + strb r1, [r0] + ldr r0, [r7] + ldr r6, =0x00003008 + adds r0, r6 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r7] + ldr r1, =0x00003009 + adds r0, r1 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r7] + adds r0, r6 + ldrb r0, [r0] + bl RemoveWindow + ldr r0, [r7] + ldr r2, =0x00003009 + adds r0, r2 + ldrb r0, [r0] + bl RemoveWindow + movs r0, 0x1E + str r0, [sp] + movs r0, 0x14 + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, [r7] + movs r3, 0xC0 + lsls r3, 6 + adds r0, r3 + movs r1, 0x1 + str r1, [r0] +_0802A35E: + 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_802A010 + + thumb_func_start sub_802A380 +sub_802A380: @ 802A380 + push {r4-r6,lr} + sub sp, 0x10 + ldr r5, =gUnknown_02022CF8 + ldr r0, [r5] + ldr r6, =0x00003014 + adds r0, r6 + ldrb r4, [r0] + cmp r4, 0x1 + beq _0802A3D8 + cmp r4, 0x1 + bgt _0802A3A4 + cmp r4, 0 + beq _0802A3AE + b _0802A420 + .pool +_0802A3A4: + cmp r4, 0x2 + beq _0802A3EC + cmp r4, 0x3 + beq _0802A404 + b _0802A420 +_0802A3AE: + movs r0, 0 + movs r1, 0 + bl sub_81973C4 + ldr r2, =gUnknown_082C8959 + str r4, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + movs r3, 0 + bl AddTextPrinterParametrized + b _0802A410 + .pool +_0802A3D8: + movs r0, 0 + movs r1, 0x3 + bl CopyWindowToVram + ldr r1, [r5] + ldr r0, =0x00003014 + adds r1, r0 + b _0802A414 + .pool +_0802A3EC: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802A448 + ldr r0, =sub_8153688 + movs r1, 0 + bl CreateTask + b _0802A410 + .pool +_0802A404: + ldr r0, =sub_8153688 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _0802A448 +_0802A410: + ldr r1, [r5] + adds r1, r6 +_0802A414: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _0802A448 + .pool +_0802A420: + movs r0, 0x1E + str r0, [sp] + movs r0, 0x14 + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + movs r1, 0xC0 + lsls r1, 6 + adds r0, r1 + movs r1, 0x1 + str r1, [r0] +_0802A448: + add sp, 0x10 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802A380 + + thumb_func_start sub_802A454 +sub_802A454: @ 802A454 + push {r4-r6,lr} + sub sp, 0xC + ldr r1, =gUnknown_02022CF8 + ldr r2, [r1] + ldr r6, =0x00003014 + adds r0, r2, r6 + ldrb r0, [r0] + adds r5, r1, 0 + cmp r0, 0x1 + beq _0802A4AC + cmp r0, 0x1 + bgt _0802A47C + cmp r0, 0 + beq _0802A482 + b _0802A520 + .pool +_0802A47C: + cmp r0, 0x2 + beq _0802A4F4 + b _0802A520 +_0802A482: + ldr r4, =gUnknown_082F7BEC + adds r0, r4, 0 + bl AddWindow + ldr r1, [r5] + ldr r2, =0x00003008 + adds r1, r2 + strb r0, [r1] + ldr r0, [r5] + adds r0, r2 + ldrb r0, [r0] + bl ClearWindowTilemap + adds r0, r4, 0 + bl sub_8029174 + b _0802A510 + .pool +_0802A4AC: + ldr r4, =0x00003008 + adds r0, r2, r4 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r5] + adds r0, r4 + ldrb r0, [r0] + ldr r2, =gText_CommunicationStandby3 + movs r1, 0x5 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r5] + adds r0, r4 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r1, [r5] + ldr r0, =0x00003014 + adds r1, r0 + b _0802A514 + .pool +_0802A4F4: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802A50A + ldr r0, [r5] + ldr r1, =0x00003008 + adds r0, r1 + ldrb r0, [r0] + bl PutWindowTilemap +_0802A50A: + movs r0, 0 + bl CopyBgTilemapBufferToVram +_0802A510: + ldr r1, [r5] + adds r1, r6 +_0802A514: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _0802A52C + .pool +_0802A520: + ldr r0, [r5] + movs r1, 0xC0 + lsls r1, 6 + adds r0, r1 + movs r1, 0x1 + str r1, [r0] +_0802A52C: + add sp, 0xC + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_802A454 + + thumb_func_start sub_802A534 +sub_802A534: @ 802A534 + push {r4,r5,lr} + sub sp, 0x8 + ldr r5, =gUnknown_02022CF8 + ldr r0, [r5] + ldr r4, =0x00003008 + adds r0, r4 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r5] + adds r0, r4 + ldrb r0, [r0] + bl RemoveWindow + movs r0, 0x1E + str r0, [sp] + movs r0, 0x14 + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, [r5] + movs r1, 0xC0 + lsls r1, 6 + adds r0, r1 + movs r1, 0x1 + str r1, [r0] + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802A534 + + thumb_func_start sub_802A588 +sub_802A588: @ 802A588 + push {r4-r7,lr} + sub sp, 0xC + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r7, =0x00003014 + adds r2, r1, r7 + ldrb r5, [r2] + adds r6, r0, 0 + cmp r5, 0x1 + beq _0802A610 + cmp r5, 0x1 + bgt _0802A5B0 + cmp r5, 0 + beq _0802A5BA + b _0802A6A4 + .pool +_0802A5B0: + cmp r5, 0x2 + beq _0802A658 + cmp r5, 0x3 + beq _0802A684 + b _0802A6A4 +_0802A5BA: + ldr r4, =gUnknown_082F7BE4 + adds r0, r4, 0 + bl AddWindow + ldr r1, [r6] + ldr r2, =0x00003008 + adds r1, r2 + strb r0, [r1] + ldr r0, [r6] + adds r0, r2 + ldrb r0, [r0] + bl ClearWindowTilemap + adds r0, r4, 0 + bl sub_8029174 + ldr r1, [r6] + adds r1, r7 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + ldr r0, [r6] + ldr r2, =0x0000301c + adds r1, r0, r2 + movs r2, 0 + strh r5, [r1] + ldr r1, =0x00003020 + adds r0, r1 + strb r2, [r0] + ldr r0, [r6] + adds r1, 0x4 + adds r0, r1 + strb r2, [r0] + b _0802A6EA + .pool +_0802A610: + ldr r4, =0x00003008 + adds r0, r1, r4 + ldrb r0, [r0] + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, [r6] + adds r0, r4 + ldrb r0, [r0] + ldr r2, =gText_SomeoneDroppedOut + movs r1, 0x5 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r6] + adds r0, r4 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + ldr r1, [r6] + ldr r2, =0x00003014 + adds r1, r2 + b _0802A678 + .pool +_0802A658: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802A66E + ldr r0, [r6] + ldr r1, =0x00003008 + adds r0, r1 + ldrb r0, [r0] + bl PutWindowTilemap +_0802A66E: + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r1, [r6] + adds r1, r7 +_0802A678: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _0802A6EA + .pool +_0802A684: + ldr r0, =0x0000301c + adds r1, r0 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x77 + bls _0802A6EA + ldrb r0, [r2] + adds r0, 0x1 + strb r0, [r2] + b _0802A6EA + .pool +_0802A6A4: + ldr r0, [r6] + ldr r1, =0x00003024 + adds r0, r1 + movs r1, 0x5 + strb r1, [r0] + ldr r0, [r6] + ldr r4, =0x00003008 + adds r0, r4 + ldrb r0, [r0] + bl ClearWindowTilemap + ldr r0, [r6] + adds r0, r4 + ldrb r0, [r0] + bl RemoveWindow + movs r0, 0x1E + str r0, [sp] + movs r0, 0x14 + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, [r6] + movs r2, 0xC0 + lsls r2, 6 + adds r0, r2 + movs r1, 0x1 + str r1, [r0] +_0802A6EA: + add sp, 0xC + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802A588 + + thumb_func_start unused_0 +unused_0: @ 802A6FC + push {r4,lr} + ldr r4, =gUnknown_02022CF8 + ldr r0, [r4] + ldr r1, =0x00003004 + adds r0, r1 + ldrb r0, [r0] + bl DestroyTask + ldr r0, [r4] + movs r1, 0xC0 + lsls r1, 6 + adds r0, r1 + movs r1, 0x1 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end unused_0 + + thumb_func_start nullsub_16 +nullsub_16: @ 802A728 + bx lr + thumb_func_end nullsub_16 + + thumb_func_start sub_802A72C +sub_802A72C: @ 802A72C + push {r4,lr} + ldr r2, =gUnknown_02022CF8 + ldr r1, [r2] + ldr r3, =0x00003014 + adds r1, r3 + movs r3, 0 + strb r3, [r1] + ldr r1, [r2] + movs r4, 0xC0 + lsls r4, 6 + adds r2, r1, r4 + str r3, [r2] + ldr r2, =0x00003028 + adds r1, r2 + str r0, [r1] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802A72C + + thumb_func_start sub_802A75C +sub_802A75C: @ 802A75C + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + ldr r1, =0x00003028 + adds r0, r1 + ldr r0, [r0] + bx lr + .pool + thumb_func_end sub_802A75C + + thumb_func_start sub_802A770 +sub_802A770: @ 802A770 + push {lr} + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + movs r1, 0xC0 + lsls r1, 6 + adds r0, r1 + ldr r0, [r0] + cmp r0, 0x1 + beq _0802A78C + movs r0, 0x1 + b _0802A78E + .pool +_0802A78C: + movs r0, 0 +_0802A78E: + pop {r1} + bx r1 + thumb_func_end sub_802A770 + + thumb_func_start sub_802A794 +sub_802A794: @ 802A794 + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + ldr r1, =0x00003024 + adds r0, r1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_802A794 + + thumb_func_start sub_802A7A8 +sub_802A7A8: @ 802A7A8 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x8 + movs r3, 0xC0 + lsls r3, 19 + movs r4, 0xC0 + lsls r4, 9 + add r0, sp, 0x4 + mov r8, r0 + mov r2, sp + movs r6, 0 + ldr r1, =0x040000d4 + movs r5, 0x80 + lsls r5, 5 + ldr r7, =0x81000800 + movs r0, 0x81 + lsls r0, 24 + mov r12, r0 +_0802A7CE: + strh r6, [r2] + mov r0, sp + str r0, [r1] + str r3, [r1, 0x4] + str r7, [r1, 0x8] + ldr r0, [r1, 0x8] + adds r3, r5 + subs r4, r5 + cmp r4, r5 + bhi _0802A7CE + strh r6, [r2] + mov r2, sp + str r2, [r1] + str r3, [r1, 0x4] + lsrs r0, r4, 1 + mov r2, r12 + orrs r0, r2 + str r0, [r1, 0x8] + ldr r0, [r1, 0x8] + movs r0, 0xE0 + lsls r0, 19 + movs r3, 0x80 + lsls r3, 3 + movs r4, 0 + str r4, [sp, 0x4] + ldr r2, =0x040000d4 + mov r1, r8 + str r1, [r2] + str r0, [r2, 0x4] + lsrs r0, r3, 2 + movs r1, 0x85 + lsls r1, 24 + orrs r0, r1 + str r0, [r2, 0x8] + ldr r0, [r2, 0x8] + movs r1, 0xA0 + lsls r1, 19 + mov r0, sp + strh r4, [r0] + str r0, [r2] + str r1, [r2, 0x4] + lsrs r3, 1 + movs r0, 0x81 + lsls r0, 24 + orrs r3, r0 + str r3, [r2, 0x8] + ldr r0, [r2, 0x8] + movs r0, 0 + movs r1, 0 + bl SetGpuReg + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_082F7BA4 + movs r0, 0 + movs r2, 0x4 + bl InitBgsFromTemplates + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgX + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgY + bl sub_81971D0 + bl sub_8197200 + movs r1, 0x82 + lsls r1, 5 + movs r0, 0 + bl SetGpuReg + ldr r4, =gUnknown_02022CF8 + ldr r1, [r4] + movs r0, 0x3 + bl SetBgTilemapBuffer + ldr r1, [r4] + movs r2, 0x80 + lsls r2, 5 + adds r1, r2 + movs r0, 0x1 + bl SetBgTilemapBuffer + ldr r1, [r4] + movs r0, 0x80 + lsls r0, 6 + adds r1, r0 + movs r0, 0x2 + bl SetBgTilemapBuffer + add sp, 0x8 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802A7A8 + + thumb_func_start sub_802A8E8 +sub_802A8E8: @ 802A8E8 + push {lr} + sub sp, 0x4 + ldr r0, =gUnknown_02022CF8 + ldr r0, [r0] + ldr r2, =0x00003018 + adds r1, r0, r2 + ldrb r0, [r1] + cmp r0, 0x5 + bhi _0802A982 + lsls r0, 2 + ldr r1, =_0802A910 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802A910: + .4byte _0802A928 + .4byte _0802A938 + .4byte _0802A93E + .4byte _0802A94C + .4byte _0802A964 + .4byte _0802A972 +_0802A928: + ldr r0, =gDodrioBerryBgPal1 + movs r1, 0 + movs r2, 0x40 + bl LoadPalette + b _0802A98A + .pool +_0802A938: + bl reset_temp_tile_data_buffers + b _0802A98A +_0802A93E: + ldr r1, =gDodrioBerryBgGfx1 + movs r0, 0 + str r0, [sp] + movs r0, 0x3 + b _0802A954 + .pool +_0802A94C: + ldr r1, =gDodrioBerryBgGfx2 + movs r0, 0 + str r0, [sp] + movs r0, 0x1 +_0802A954: + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + b _0802A98A + .pool +_0802A964: + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0802A98A + b _0802A998 +_0802A972: + movs r0, 0x3 + bl stdpal_get + movs r1, 0xD0 + movs r2, 0x20 + bl LoadPalette + b _0802A98A +_0802A982: + movs r0, 0 + strb r0, [r1] + movs r0, 0x1 + b _0802A99A +_0802A98A: + ldr r0, =gUnknown_02022CF8 + ldr r1, [r0] + ldr r0, =0x00003018 + adds r1, r0 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] +_0802A998: + movs r0, 0 +_0802A99A: + add sp, 0x4 + pop {r1} + bx r1 + .pool + thumb_func_end sub_802A8E8 + + thumb_func_start sub_802A9A8 +sub_802A9A8: @ 802A9A8 + push {r4-r7,lr} + adds r6, r1, 0 + lsls r0, 16 + lsrs r7, r0, 16 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _0802AA3C + ldr r5, =gUnknown_02022CFC + ldr r0, =0x000083b0 + bl Alloc + str r0, [r5] + cmp r0, 0 + beq _0802AA3C + bl ResetTasks + ldr r0, =sub_802ACA0 + movs r1, 0x1 + bl CreateTask + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, [r5] + movs r1, 0 + strh r1, [r0, 0x8] + str r6, [r0] + strb r4, [r0, 0x4] + bl GetMultiplayerId + ldr r1, [r5] + strb r0, [r1, 0x6] + ldr r0, [r5] + ldrb r2, [r0, 0x6] + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 2 + ldr r2, =0x000082a8 + adds r1, r2 + adds r0, r1 + movs r1, 0x64 + muls r1, r7 + ldr r2, =gPlayerParty + adds r1, r2 + bl sub_802AC2C + ldr r0, [r5] + bl sub_802AA60 + ldr r2, [r5] + adds r0, r4, 0 + movs r1, 0x2 + bl SetWordTaskArg + ldr r0, =sub_802AC6C + bl SetMainCallback2 + b _0802AA42 + .pool +_0802AA3C: + adds r0, r6, 0 + bl SetMainCallback2 +_0802AA42: + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_802A9A8 + + thumb_func_start sub_802AA48 +sub_802AA48: @ 802AA48 + push {lr} + bl sub_802D0AC + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + bl Free + pop {r0} + bx r0 + .pool + thumb_func_end sub_802AA48 + + thumb_func_start sub_802AA60 +sub_802AA60: @ 802AA60 + push {r4,lr} + adds r4, r0, 0 + bl GetLinkPlayerCount + movs r2, 0 + strb r0, [r4, 0x5] + adds r1, r4, 0 + adds r1, 0x70 + movs r0, 0x5 + strb r0, [r1] + adds r0, r4, 0 + adds r0, 0x72 + strh r2, [r0] + bl sub_802AB20 + adds r0, r4, 0 + bl sub_802AA94 + ldrb r0, [r4, 0x5] + cmp r0, 0x5 + bne _0802AA8E + bl sub_802E3A8 +_0802AA8E: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_802AA60 + + thumb_func_start sub_802AA94 +sub_802AA94: @ 802AA94 + push {r4-r6,lr} + adds r4, r0, 0 + movs r0, 0x6 + str r0, [r4, 0x14] + str r0, [r4, 0x18] + adds r0, r4, 0 + adds r0, 0x4A + movs r6, 0 + movs r5, 0 + strh r5, [r0] + str r5, [r4, 0x1C] + str r5, [r4, 0x5C] + bl GetMultiplayerId + movs r1, 0 + lsls r0, 24 + cmp r0, 0 + bne _0802AABA + movs r1, 0x1 +_0802AABA: + adds r0, r4, 0 + adds r0, 0x47 + strb r1, [r0] + strh r5, [r4, 0x8] + strh r5, [r4, 0xA] + strh r5, [r4, 0xC] + strh r5, [r4, 0xE] + str r5, [r4, 0x58] + strh r5, [r4, 0x3A] + subs r0, 0x3 + strb r6, [r0] + str r5, [r4, 0x54] + adds r0, 0x2 + strb r6, [r0] + adds r0, 0x3 + strb r6, [r0] + subs r0, 0x1 + movs r1, 0x1 + strb r1, [r0] + str r5, [r4, 0x78] + adds r0, 0x29 + strb r6, [r0] + adds r0, 0x3 + strh r5, [r0] + str r1, [r4, 0x60] + subs r0, 0x27 + strb r6, [r0] + str r5, [r4, 0x68] + str r5, [r4, 0x64] + str r5, [r4, 0x2C] + str r5, [r4, 0x30] + bl sub_802AB98 + bl sub_802C0E8 + movs r2, 0 + adds r5, r4, 0 + adds r5, 0x7C + movs r3, 0 + adds r1, r4, 0 + adds r1, 0x9A +_0802AB0C: + adds r0, r5, r2 + strb r3, [r0] + strh r3, [r1] + adds r1, 0x2 + adds r2, 0x1 + cmp r2, 0x4 + ble _0802AB0C + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_802AA94 + + thumb_func_start sub_802AB20 +sub_802AB20: @ 802AB20 + push {r4-r7,lr} + mov r7, r8 + push {r7} + ldr r7, =gUnknown_02022CFC + movs r6, 0 + movs r5, 0 + ldr r0, =gPkmnJumpSpecies + mov r8, r0 + movs r4, 0x4 +_0802AB32: + ldr r0, [r7] + adds r0, r5 + ldr r1, =0x000082a8 + adds r0, r1 + ldrh r0, [r0] + bl sub_802AC00 + lsls r0, 16 + ldr r1, [r7] + adds r1, r6 + asrs r0, 14 + add r0, r8 + ldrh r0, [r0, 0x2] + ldr r2, =0x000082f0 + adds r1, r2 + strh r0, [r1] + adds r6, 0x28 + adds r5, 0xC + subs r4, 0x1 + cmp r4, 0 + bge _0802AB32 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + ldr r0, =0x000083ac + adds r3, r1, r0 + ldrb r2, [r1, 0x6] + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r2, =0x000082e4 + adds r0, r2 + adds r1, r0 + str r1, [r3] + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802AB20 + + thumb_func_start sub_802AB98 +sub_802AB98: @ 802AB98 + push {r4-r7,lr} + movs r5, 0 + ldr r6, =gUnknown_02022CFC + movs r4, 0 + movs r3, 0 +_0802ABA2: + ldr r2, [r6] + adds r1, r2, r3 + ldr r7, =0x000082f2 + adds r0, r1, r7 + strh r4, [r0] + adds r7, 0x2 + adds r0, r1, r7 + strh r4, [r0] + ldr r0, =0x000082f6 + adds r1, r0 + strh r4, [r1] + ldr r1, =0x000082e4 + adds r0, r2, r1 + adds r0, r3 + str r4, [r0] + subs r7, 0xC + adds r0, r2, r7 + adds r0, r3 + ldr r1, =0x7fffffff + str r1, [r0] + ldr r1, =0x000082f8 + adds r0, r2, r1 + adds r0, r3 + str r4, [r0] + adds r2, 0x8B + adds r2, r5 + movs r0, 0x9 + strb r0, [r2] + adds r3, 0x28 + adds r5, 0x1 + cmp r5, 0x4 + ble _0802ABA2 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802AB98 + + thumb_func_start sub_802AC00 +sub_802AC00: @ 802AC00 + push {lr} + lsls r0, 16 + lsrs r3, r0, 16 + movs r1, 0 + ldr r2, =gPkmnJumpSpecies +_0802AC0A: + ldrh r0, [r2] + cmp r0, r3 + bne _0802AC1C + lsls r0, r1, 16 + asrs r0, 16 + b _0802AC28 + .pool +_0802AC1C: + adds r2, 0x4 + adds r1, 0x1 + cmp r1, 0x63 + bls _0802AC0A + movs r0, 0x1 + negs r0, r0 +_0802AC28: + pop {r1} + bx r1 + thumb_func_end sub_802AC00 + + thumb_func_start sub_802AC2C +sub_802AC2C: @ 802AC2C + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r1, 0 + adds r0, r4, 0 + movs r1, 0xB + bl GetMonData + strh r0, [r5] + adds r0, r4, 0 + movs r1, 0x1 + bl GetMonData + str r0, [r5, 0x4] + adds r0, r4, 0 + movs r1, 0 + bl GetMonData + str r0, [r5, 0x8] + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802AC2C + + thumb_func_start sub_802AC58 +sub_802AC58: @ 802AC58 + push {lr} + bl TransferPlttBuffer + bl LoadOam + bl ProcessSpriteCopyRequests + pop {r0} + bx r0 + thumb_func_end sub_802AC58 + + thumb_func_start sub_802AC6C +sub_802AC6C: @ 802AC6C + push {lr} + bl RunTasks + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade + pop {r0} + bx r0 + thumb_func_end sub_802AC6C + + thumb_func_start sub_802AC84 +sub_802AC84: @ 802AC84 + push {lr} + movs r1, 0x1 + bl CreateTask + ldr r2, =gUnknown_02022CFC + ldr r1, [r2] + movs r3, 0 + strb r0, [r1, 0x4] + ldr r0, [r2] + strh r3, [r0, 0x8] + pop {r0} + bx r0 + .pool + thumb_func_end sub_802AC84 + + thumb_func_start sub_802ACA0 +sub_802ACA0: @ 802ACA0 + push {r4,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r4, r0, 24 + ldr r1, =gUnknown_02022CFC + ldr r0, [r1] + ldrh r0, [r0, 0x8] + adds r2, r1, 0 + cmp r0, 0x5 + bls _0802ACB6 + b _0802AE08 +_0802ACB6: + lsls r0, 2 + ldr r1, =_0802ACC8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802ACC8: + .4byte _0802ACE0 + .4byte _0802AD0C + .4byte _0802AD3C + .4byte _0802AD68 + .4byte _0802ADA4 + .4byte _0802ADD0 +_0802ACE0: + movs r0, 0 + bl SetVBlankCallback + bl ResetSpriteData + bl FreeAllSpritePalettes + ldr r0, =sub_802BD84 + movs r1, 0x5 + bl sub_802BE60 + movs r0, 0x4 + bl FadeOutMapMusic + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + b _0802ADC0 + .pool +_0802AD0C: + ldr r0, =sub_802BD84 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _0802AE08 + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + adds r0, 0xA4 + bl sub_802D074 + bl sub_800E0E8 + movs r0, 0 + movs r1, 0 + bl sub_800DFB4 + ldr r1, [r4] + b _0802ADC0 + .pool +_0802AD3C: + bl sub_802D0F0 + cmp r0, 0 + bne _0802AE08 + bl IsNotWaitingForBGMStop + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0802AE08 + ldr r0, =0x0000021a + movs r1, 0x8 + bl FadeOutAndPlayNewMapMusic + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + b _0802ADC0 + .pool +_0802AD68: + bl sub_800A520 + lsls r0, 24 + cmp r0, 0 + beq _0802AE08 + movs r4, 0x1 + negs r4, r4 + adds r0, r4, 0 + movs r1, 0x10 + movs r2, 0 + bl BlendPalettes + movs r0, 0 + str r0, [sp] + adds r0, r4, 0 + adds r1, r4, 0 + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + ldr r0, =sub_802AC58 + bl SetVBlankCallback + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + b _0802ADC0 + .pool +_0802ADA4: + bl UpdatePaletteFade + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0 + bne _0802AE08 + ldr r1, =gUnknown_02022CFC + ldr r0, [r1] + strb r2, [r0, 0x7] + ldr r1, [r1] +_0802ADC0: + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802AE08 + .pool +_0802ADD0: + ldr r0, [r2] + ldrb r1, [r0, 0x7] + adds r1, 0x1 + strb r1, [r0, 0x7] + ldr r1, [r2] + ldrb r0, [r1, 0x7] + cmp r0, 0x13 + bls _0802AE08 + adds r0, r1, 0 + adds r0, 0x47 + ldrb r0, [r0] + cmp r0, 0 + beq _0802ADF8 + ldr r0, =sub_802AF80 + bl sub_802AC84 + b _0802ADFE + .pool +_0802ADF8: + ldr r0, =sub_802B194 + bl sub_802AC84 +_0802ADFE: + bl sub_802BE80 + adds r0, r4, 0 + bl DestroyTask +_0802AE08: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802ACA0 + + thumb_func_start sub_802AE14 +sub_802AE14: @ 802AE14 + push {lr} + adds r1, r0, 0 + cmp r1, 0 + bne _0802AE34 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + ldr r0, =0x00001111 + str r0, [r1, 0x30] + movs r0, 0x1 + str r0, [r1, 0x2C] + b _0802AE46 + .pool +_0802AE34: + ldr r0, =gUnknown_02022CFC + ldr r2, [r0] + subs r1, 0x1 + movs r0, 0x1 + lsls r0, r1 + subs r0, 0x1 + str r0, [r2, 0x30] + movs r0, 0 + str r0, [r2, 0x2C] +_0802AE46: + pop {r0} + bx r0 + .pool + thumb_func_end sub_802AE14 + + thumb_func_start sub_802AE50 +sub_802AE50: @ 802AE50 + push {r4-r6,lr} + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + adds r1, 0x70 + movs r2, 0 + strb r0, [r1] + ldr r0, [r4] + movs r3, 0 + strh r2, [r0, 0x8] + strh r2, [r0, 0xA] + adds r0, 0x48 + movs r1, 0x1 + strb r1, [r0] + ldr r0, [r4] + adds r0, 0x49 + strb r3, [r0] + movs r3, 0x1 + ldr r0, [r4] + ldrb r0, [r0, 0x5] + cmp r3, r0 + bge _0802AE94 + adds r6, r4, 0 + ldr r5, =0x000082fc + movs r4, 0 + movs r2, 0x28 +_0802AE82: + ldr r1, [r6] + adds r0, r1, r5 + adds r0, r2 + str r4, [r0] + adds r2, 0x28 + adds r3, 0x1 + ldrb r1, [r1, 0x5] + cmp r3, r1 + blt _0802AE82 +_0802AE94: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802AE50 + + thumb_func_start sub_802AEA4 +sub_802AEA4: @ 802AEA4 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + movs r4, 0x1 + movs r0, 0 + str r0, [sp, 0x4] + ldr r7, =gUnknown_02022CFC + ldr r0, [r7] + ldrb r0, [r0, 0x5] + cmp r4, r0 + bge _0802AF48 + adds r1, r7, 0 + mov r10, r1 + movs r2, 0x2 + add r2, sp + mov r8, r2 + ldr r3, =0x0000830c + mov r9, r3 + movs r6, 0x28 +_0802AED0: + mov r1, r10 + ldr r0, [r1] + adds r1, r0, r6 + ldr r2, =0x000082f4 + adds r1, r2 + ldrh r5, [r1] + add r0, r9 + adds r1, r4, 0 + mov r2, sp + mov r3, r8 + bl sub_802E264 + cmp r0, 0 + beq _0802AF10 + ldr r2, [r7] + lsls r1, r4, 1 + adds r0, r2, 0 + adds r0, 0x90 + adds r0, r1 + mov r3, r8 + ldrh r1, [r3] + strh r1, [r0] + adds r2, 0x8B + adds r2, r4 + mov r0, sp + ldrb r0, [r0] + strb r0, [r2] + ldr r0, [r7] + adds r0, r6 + ldr r1, =0x000082f6 + adds r0, r1 + strh r5, [r0] +_0802AF10: + mov r2, r10 + ldr r1, [r2] + ldr r3, =0x000082fc + adds r0, r1, r3 + adds r0, r6 + ldr r0, [r0] + cmp r0, 0 + beq _0802AF36 + adds r0, r1, 0 + adds r0, 0x8B + adds r0, r4 + adds r1, 0x70 + ldrb r0, [r0] + ldrb r1, [r1] + cmp r0, r1 + bne _0802AF36 + ldr r0, [sp, 0x4] + adds r0, 0x1 + str r0, [sp, 0x4] +_0802AF36: + movs r1, 0x28 + add r9, r1 + adds r6, 0x28 + adds r4, 0x1 + ldr r7, =gUnknown_02022CFC + ldr r0, [r7] + ldrb r0, [r0, 0x5] + cmp r4, r0 + blt _0802AED0 +_0802AF48: + ldr r2, =gUnknown_02022CFC + ldr r1, [r2] + ldrb r0, [r1, 0x5] + subs r0, 0x1 + ldr r3, [sp, 0x4] + cmp r3, r0 + bne _0802AF5C + adds r1, 0x49 + movs r0, 0x1 + strb r0, [r1] +_0802AF5C: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802AEA4 + + thumb_func_start sub_802AF80 +sub_802AF80: @ 802AF80 + push {r4,r5,lr} + bl sub_802AEA4 + bl sub_802C43C + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x48 + ldrb r0, [r0] + cmp r0, 0 + bne _0802AFB2 + adds r0, r1, 0 + adds r0, 0x49 + ldrb r0, [r0] + cmp r0, 0 + beq _0802AFB2 + adds r0, r1, 0 + adds r0, 0x4C + ldrb r0, [r0] + bl sub_802AE50 + movs r0, 0x3 + bl sub_802AE14 +_0802AFB2: + ldr r4, =gUnknown_02022CFC + ldr r2, [r4] + adds r0, r2, 0 + adds r0, 0x48 + ldrb r5, [r0] + cmp r5, 0x1 + bne _0802AFEE + ldr r1, =gUnknown_082FB5F4 + adds r0, 0x28 + ldrb r0, [r0] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + bl _call_via_r0 + adds r1, r0, 0 + cmp r1, 0 + bne _0802AFEE + ldr r0, [r4] + adds r0, 0x48 + strb r1, [r0] + ldr r1, [r4] + ldrb r2, [r1, 0x6] + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r2, =0x000082fc + adds r1, r2 + adds r1, r0 + str r5, [r1] +_0802AFEE: + bl sub_802C1DC + bl sub_802B008 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802AF80 + + thumb_func_start sub_802B008 +sub_802B008: @ 802B008 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + ldr r0, [r1, 0x2C] + cmp r0, 0 + bne _0802B01E + ldr r2, =0x000082e4 + adds r0, r1, r2 + adds r1, 0x70 + bl sub_802E138 +_0802B01E: + ldr r1, [r4] + ldr r2, [r1, 0x30] + ldr r0, =0x00001111 + cmp r2, r0 + beq _0802B030 + ldr r0, [r1, 0x2C] + adds r0, 0x1 + ands r0, r2 + str r0, [r1, 0x2C] +_0802B030: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802B008 + + thumb_func_start sub_802B044 +sub_802B044: @ 802B044 + ldr r2, =gUnknown_02022CFC + ldr r1, [r2] + adds r1, 0x70 + movs r3, 0 + strb r0, [r1] + ldr r0, [r2] + strh r3, [r0, 0x8] + strh r3, [r0, 0xA] + adds r0, 0x48 + movs r1, 0x1 + strb r1, [r0] + ldr r1, [r2] + ldrb r2, [r1, 0x6] + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r2, =0x000082fc + adds r1, r2 + adds r1, r0 + str r3, [r1] + bx lr + .pool + thumb_func_end sub_802B044 + + thumb_func_start sub_802B078 +sub_802B078: @ 802B078 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x10 + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldr r2, =0x000082f4 + adds r1, r0, r2 + ldrh r1, [r1] + mov r8, r1 + ldr r3, =0x000082e4 + adds r0, r3 + mov r1, sp + bl sub_802E1BC + cmp r0, 0 + beq _0802B128 + ldr r2, [r4] + ldrb r0, [r2, 0x6] + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r3, =0x000082fc + adds r0, r2, r3 + adds r0, r1 + ldr r0, [r0] + cmp r0, 0x1 + bne _0802B0C6 + mov r0, sp + adds r1, r2, 0 + adds r1, 0x70 + ldrb r0, [r0] + ldrb r1, [r1] + cmp r0, r1 + beq _0802B0C6 + mov r0, sp + ldrb r0, [r0] + bl sub_802B044 +_0802B0C6: + ldr r3, =gUnknown_02022CFC + ldr r2, [r3] + ldr r0, [r2, 0x78] + ldr r1, [sp, 0x8] + cmp r0, r1 + beq _0802B108 + str r1, [r2, 0x78] + movs r4, 0x1 + str r4, [r2, 0x5C] + mov r0, sp + ldrb r1, [r0, 0x1] + adds r0, r2, 0 + adds r0, 0x71 + strb r1, [r0] + ldr r0, [r3] + adds r1, r0, 0 + adds r1, 0x71 + ldrb r1, [r1] + cmp r1, 0 + beq _0802B104 + adds r0, 0x4D + strb r4, [r0] + b _0802B108 + .pool +_0802B104: + adds r0, 0x4D + strb r1, [r0] +_0802B108: + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + mov r0, sp + ldrh r0, [r0, 0x2] + adds r2, r1, 0 + adds r2, 0x72 + strh r0, [r2] + mov r0, sp + ldrh r2, [r0, 0x4] + adds r0, r1, 0 + adds r0, 0x74 + strh r2, [r0] + ldr r0, =0x000082f6 + adds r1, r0 + mov r2, r8 + strh r2, [r1] +_0802B128: + movs r4, 0x1 + ldr r2, =gUnknown_02022CFC + ldr r0, [r2] + ldrb r0, [r0, 0x5] + cmp r4, r0 + bge _0802B176 + adds r7, r2, 0 + ldr r6, =0x0000830c + movs r5, 0x28 +_0802B13A: + ldr r1, [r7] + ldrb r3, [r1, 0x6] + cmp r4, r3 + beq _0802B168 + adds r0, r1, r5 + ldr r3, =0x000082f4 + adds r0, r3 + ldrh r0, [r0] + mov r8, r0 + adds r0, r1, r6 + adds r1, r4, 0 + str r2, [sp, 0xC] + bl sub_802E2D0 + ldr r2, [sp, 0xC] + cmp r0, 0 + beq _0802B168 + ldr r0, [r7] + adds r0, r5 + ldr r1, =0x000082f6 + adds r0, r1 + mov r3, r8 + strh r3, [r0] +_0802B168: + adds r6, 0x28 + adds r5, 0x28 + adds r4, 0x1 + ldr r0, [r2] + ldrb r0, [r0, 0x5] + cmp r4, r0 + blt _0802B13A +_0802B176: + add sp, 0x10 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802B078 + + thumb_func_start sub_802B194 +sub_802B194: @ 802B194 + push {r4,lr} + bl sub_802B078 + ldr r4, =gUnknown_02022CFC + ldr r2, [r4] + adds r0, r2, 0 + adds r0, 0x48 + ldrb r0, [r0] + cmp r0, 0 + beq _0802B1E0 + ldr r1, =gUnknown_082FB618 + adds r0, r2, 0 + adds r0, 0x70 + ldrb r0, [r0] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + bl _call_via_r0 + adds r1, r0, 0 + cmp r1, 0 + bne _0802B1E0 + ldr r0, [r4] + adds r0, 0x48 + strb r1, [r0] + ldr r1, [r4] + ldrb r2, [r1, 0x6] + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r2, =0x000082fc + adds r1, r2 + adds r1, r0 + movs r0, 0x1 + str r0, [r1] + movs r0, 0x3 + bl sub_802AE14 +_0802B1E0: + bl sub_802C1DC + bl sub_802B1FC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802B194 + + thumb_func_start sub_802B1FC +sub_802B1FC: @ 802B1FC + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r2, [r4] + ldr r0, [r2, 0x2C] + cmp r0, 0 + bne _0802B224 + ldrb r1, [r2, 0x6] + lsls r0, r1, 2 + adds r0, r1 + lsls r0, 3 + ldr r1, =0x000082e4 + adds r0, r1 + adds r0, r2, r0 + adds r1, r2, 0 + adds r1, 0x70 + ldrb r1, [r1] + adds r2, 0x42 + ldrh r2, [r2] + bl sub_802E234 +_0802B224: + ldr r1, [r4] + ldr r2, [r1, 0x30] + ldr r0, =0x00001111 + cmp r2, r0 + beq _0802B236 + ldr r0, [r1, 0x2C] + adds r0, 0x1 + ands r0, r2 + str r0, [r1, 0x2C] +_0802B236: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802B1FC + + thumb_func_start sub_802B248 +sub_802B248: @ 802B248 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x8] + cmp r0, 0 + beq _0802B260 + cmp r0, 0x1 + beq _0802B26E + b _0802B294 + .pool +_0802B260: + movs r0, 0x3 + bl sub_802AE14 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B26E: + bl sub_802B7E0 + cmp r0, 0 + bne _0802B294 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x4A + ldrh r0, [r0] + adds r2, r1, 0 + adds r2, 0x72 + strh r0, [r2] + adds r1, 0x4C + movs r0, 0x1 + strb r0, [r1] + movs r0, 0 + b _0802B296 + .pool +_0802B294: + movs r0, 0x1 +_0802B296: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B248 + + thumb_func_start sub_802B29C +sub_802B29C: @ 802B29C + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x8] + cmp r0, 0 + beq _0802B2B4 + cmp r0, 0x1 + beq _0802B2CA + movs r0, 0x1 + b _0802B2CE + .pool +_0802B2B4: + movs r0, 0 + bl sub_802AE14 + ldr r1, [r4] + adds r0, r1, 0 + adds r0, 0x72 + ldrh r0, [r0] + str r0, [r1, 0x24] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B2CA: + bl sub_802B7E0 +_0802B2CE: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B29C + + thumb_func_start sub_802B2D4 +sub_802B2D4: @ 802B2D4 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + ldrh r0, [r1, 0x8] + cmp r0, 0 + beq _0802B2EC + cmp r0, 0x1 + beq _0802B300 + b _0802B314 + .pool +_0802B2EC: + bl sub_802C0E8 + movs r0, 0x5 + bl sub_802AE14 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802B314 +_0802B300: + adds r0, r1, 0 + adds r0, 0x49 + ldrb r0, [r0] + cmp r0, 0 + beq _0802B314 + adds r1, 0x4C + movs r0, 0x2 + strb r0, [r1] + movs r0, 0 + b _0802B316 +_0802B314: + movs r0, 0x1 +_0802B316: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B2D4 + + thumb_func_start sub_802B31C +sub_802B31C: @ 802B31C + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x8] + cmp r0, 0 + beq _0802B334 + cmp r0, 0x1 + beq _0802B352 + b _0802B35E + .pool +_0802B334: + bl sub_802C0E8 + movs r0, 0 + bl sub_802AE14 + ldr r1, [r4] + adds r0, r1, 0 + adds r0, 0x72 + ldrh r0, [r0] + adds r2, r1, 0 + adds r2, 0x4A + strh r0, [r2] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B352: + bl sub_802C70C + cmp r0, 0 + beq _0802B35E + movs r0, 0 + b _0802B360 +_0802B35E: + movs r0, 0x1 +_0802B360: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B31C + + thumb_func_start sub_802B368 +sub_802B368: @ 802B368 + push {lr} + bl sub_802B8CC + cmp r0, 0 + bne _0802B390 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x4A + ldrh r0, [r0] + adds r2, r1, 0 + adds r2, 0x72 + strh r0, [r2] + adds r1, 0x4C + movs r0, 0x1 + strb r0, [r1] + b _0802B3AA + .pool +_0802B390: + bl sub_802C538 + cmp r0, 0 + beq _0802B39C + movs r0, 0x1 + b _0802B3AC +_0802B39C: + bl sub_802C0B8 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + adds r0, 0x4C + movs r1, 0x3 + strb r1, [r0] +_0802B3AA: + movs r0, 0 +_0802B3AC: + pop {r1} + bx r1 + .pool + thumb_func_end sub_802B368 + + thumb_func_start sub_802B3B4 +sub_802B3B4: @ 802B3B4 + push {lr} + bl sub_802B8CC + cmp r0, 0 + beq _0802B3CE + bl sub_802C538 + cmp r0, 0 + beq _0802B3CA + movs r0, 0x1 + b _0802B3D0 +_0802B3CA: + bl sub_802C0B8 +_0802B3CE: + movs r0, 0 +_0802B3D0: + pop {r1} + bx r1 + thumb_func_end sub_802B3B4 + + thumb_func_start sub_802B3D4 +sub_802B3D4: @ 802B3D4 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x8] + cmp r0, 0x1 + beq _0802B40C + cmp r0, 0x1 + bgt _0802B3F0 + cmp r0, 0 + beq _0802B3F6 + b _0802B468 + .pool +_0802B3F0: + cmp r0, 0x2 + beq _0802B460 + b _0802B468 +_0802B3F6: + bl sub_802C538 + bl sub_802C5DC + cmp r0, 0 + beq _0802B468 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802B468 +_0802B40C: + bl sub_802B964 + cmp r0, 0 + bne _0802B468 + bl sub_802C7BC + cmp r0, 0 + beq _0802B42E + bl sub_802C7E0 + ldr r1, [r4] + adds r2, r1, 0 + adds r2, 0x72 + strh r0, [r2] + adds r1, 0x4C + movs r0, 0x7 + b _0802B454 +_0802B42E: + ldr r1, [r4] + adds r0, r1, 0 + adds r0, 0x74 + ldrh r0, [r0] + cmp r0, 0xC7 + bls _0802B448 + ldrh r0, [r1, 0xE] + adds r2, r1, 0 + adds r2, 0x72 + strh r0, [r2] + adds r1, 0x4C + movs r0, 0x8 + b _0802B454 +_0802B448: + ldrh r0, [r1, 0xE] + adds r2, r1, 0 + adds r2, 0x72 + strh r0, [r2] + adds r1, 0x4C + movs r0, 0x4 +_0802B454: + strb r0, [r1] + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B460: + movs r0, 0 + b _0802B46A + .pool +_0802B468: + movs r0, 0x1 +_0802B46A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B3D4 + + thumb_func_start sub_802B470 +sub_802B470: @ 802B470 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x8] + cmp r0, 0x1 + beq _0802B4B0 + cmp r0, 0x1 + bgt _0802B48C + cmp r0, 0 + beq _0802B492 + b _0802B4C4 + .pool +_0802B48C: + cmp r0, 0x2 + beq _0802B4C0 + b _0802B4C4 +_0802B492: + bl sub_802C538 + cmp r0, 0 + bne _0802B49E + bl sub_802C0B8 +_0802B49E: + bl sub_802C5DC + cmp r0, 0 + beq _0802B4C4 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802B4C4 +_0802B4B0: + bl sub_802B964 + cmp r0, 0 + bne _0802B4C4 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B4C0: + movs r0, 0 + b _0802B4C6 +_0802B4C4: + movs r0, 0x1 +_0802B4C6: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B470 + + thumb_func_start sub_802B4CC +sub_802B4CC: @ 802B4CC + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r1, [r0, 0x8] + cmp r1, 0x1 + beq _0802B500 + cmp r1, 0x1 + bgt _0802B4E8 + cmp r1, 0 + beq _0802B4F2 + b _0802B560 + .pool +_0802B4E8: + cmp r1, 0x2 + beq _0802B52C + cmp r1, 0x3 + beq _0802B556 + b _0802B560 +_0802B4F2: + movs r0, 0x4 + bl sub_802AE14 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B500: + bl sub_802BB84 + cmp r0, 0 + bne _0802B560 + ldr r4, =gUnknown_02022CFC + ldr r2, [r4] + ldr r0, [r2, 0x78] + adds r1, r2, 0 + adds r1, 0x74 + ldrh r1, [r1] + adds r2, 0x72 + ldrh r2, [r2] + bl sub_802E354 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802B560 + .pool +_0802B52C: + adds r0, 0x49 + ldrb r0, [r0] + cmp r0, 0 + beq _0802B560 + bl sub_802C650 + cmp r0, 0 + beq _0802B544 + ldr r0, [r4] + adds r0, 0x4C + movs r1, 0x5 + b _0802B54A +_0802B544: + ldr r0, [r4] + adds r0, 0x4C + movs r1, 0x6 +_0802B54A: + strb r1, [r0] + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B556: + movs r0, 0 + b _0802B562 + .pool +_0802B560: + movs r0, 0x1 +_0802B562: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B4CC + + thumb_func_start sub_802B568 +sub_802B568: @ 802B568 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x8] + cmp r0, 0 + beq _0802B580 + cmp r0, 0x1 + beq _0802B58E + b _0802B5C0 + .pool +_0802B580: + movs r0, 0 + bl sub_802AE14 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B58E: + bl sub_802BB84 + cmp r0, 0 + bne _0802B5C0 + ldr r4, =gUnknown_02022CFC + ldr r2, [r4] + ldr r0, [r2, 0x78] + adds r1, r2, 0 + adds r1, 0x74 + ldrh r1, [r1] + adds r2, 0x72 + ldrh r2, [r2] + bl sub_802E354 + ldr r0, [r4] + adds r1, r0, 0 + adds r1, 0x45 + ldrb r1, [r1] + adds r0, 0x42 + strh r1, [r0] + movs r0, 0 + b _0802B5C2 + .pool +_0802B5C0: + movs r0, 0x1 +_0802B5C2: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B568 + + thumb_func_start sub_802B5C8 +sub_802B5C8: @ 802B5C8 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + ldrh r0, [r1, 0x8] + cmp r0, 0 + beq _0802B5E0 + cmp r0, 0x1 + beq _0802B5F2 + b _0802B61E + .pool +_0802B5E0: + bl sub_802BD30 + cmp r0, 0 + bne _0802B61E + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802B61E +_0802B5F2: + adds r0, r1, 0 + adds r0, 0x49 + ldrb r0, [r0] + cmp r0, 0 + beq _0802B61E + adds r0, r1, 0 + bl sub_802AA94 + bl Random + ldr r1, [r4] + lsls r0, 16 + lsrs r0, 16 + str r0, [r1, 0x24] + adds r3, r1, 0 + adds r3, 0x72 + movs r2, 0 + strh r0, [r3] + adds r1, 0x4C + strb r2, [r1] + movs r0, 0 + b _0802B620 +_0802B61E: + movs r0, 0x1 +_0802B620: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B5C8 + + thumb_func_start sub_802B628 +sub_802B628: @ 802B628 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x8] + cmp r0, 0 + beq _0802B640 + cmp r0, 0x1 + beq _0802B656 + b _0802B65A + .pool +_0802B640: + bl sub_802BD30 + cmp r0, 0 + bne _0802B65A + ldr r0, [r4] + bl sub_802AA94 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] +_0802B656: + movs r0, 0 + b _0802B65C +_0802B65A: + movs r0, 0x1 +_0802B65C: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B628 + + thumb_func_start sub_802B664 +sub_802B664: @ 802B664 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + ldrh r0, [r1, 0x8] + cmp r0, 0x1 + beq _0802B68C + cmp r0, 0x1 + bgt _0802B680 + cmp r0, 0 + beq _0802B686 + b _0802B6B0 + .pool +_0802B680: + cmp r0, 0x2 + beq _0802B69C + b _0802B6B0 +_0802B686: + movs r0, 0x1 + strh r0, [r1, 0x8] + b _0802B6B0 +_0802B68C: + movs r0, 0 + bl sub_802AE14 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802B6B0 +_0802B69C: + bl sub_802BC60 + cmp r0, 0 + bne _0802B6B0 + ldr r0, [r4] + ldr r0, [r0] + bl SetMainCallback2 + bl sub_802AA48 +_0802B6B0: + movs r0, 0x1 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B664 + + thumb_func_start sub_802B6B8 +sub_802B6B8: @ 802B6B8 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x8] + cmp r0, 0 + beq _0802B6D0 + cmp r0, 0x1 + beq _0802B6E0 + b _0802B6FC + .pool +_0802B6D0: + movs r0, 0x4 + bl sub_802AE14 + ldr r1, [r4] + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802B6FC +_0802B6E0: + bl sub_802BA58 + cmp r0, 0 + bne _0802B6FC + ldr r0, [r4] + ldrh r1, [r0, 0xE] + adds r2, r0, 0 + adds r2, 0x72 + strh r1, [r2] + adds r0, 0x4C + movs r1, 0x8 + strb r1, [r0] + movs r0, 0 + b _0802B6FE +_0802B6FC: + movs r0, 0x1 +_0802B6FE: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B6B8 + + thumb_func_start sub_802B704 +sub_802B704: @ 802B704 + push {lr} + movs r0, 0 + bl sub_802AE14 + bl sub_802BA58 + cmp r0, 0 + beq _0802B718 + movs r0, 0x1 + b _0802B71A +_0802B718: + movs r0, 0 +_0802B71A: + pop {r1} + bx r1 + thumb_func_end sub_802B704 + + thumb_func_start sub_802B720 +sub_802B720: @ 802B720 + push {r4,lr} + ldr r1, =gUnknown_02022CFC + ldr r0, [r1] + ldrh r0, [r0, 0x8] + adds r4, r1, 0 + cmp r0, 0x4 + bhi _0802B7D8 + lsls r0, 2 + ldr r1, =_0802B740 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802B740: + .4byte _0802B754 + .4byte _0802B770 + .4byte _0802B780 + .4byte _0802B798 + .4byte _0802B7BC +_0802B754: + ldr r2, [r4] + ldr r0, [r2, 0x78] + adds r1, r2, 0 + adds r1, 0x74 + ldrh r1, [r1] + adds r2, 0x72 + ldrh r2, [r2] + bl sub_802E354 + movs r0, 0x5 + bl sub_802D0C8 + ldr r1, [r4] + b _0802B7AC +_0802B770: + bl sub_802D0F0 + cmp r0, 0 + bne _0802B7D8 + movs r0, 0 + bl sub_802AE14 + b _0802B7A8 +_0802B780: + bl sub_802C70C + cmp r0, 0 + beq _0802B7D8 + ldr r0, =sub_8153688 + movs r1, 0x6 + bl CreateTask + b _0802B7A8 + .pool +_0802B798: + ldr r0, =sub_8153688 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _0802B7D8 + bl sub_802DA14 +_0802B7A8: + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] +_0802B7AC: + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0802B7D8 + .pool +_0802B7BC: + bl sub_802DA44 + cmp r0, 0 + bne _0802B7D8 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + adds r0, 0x4C + movs r1, 0x4 + strb r1, [r0] + movs r0, 0 + b _0802B7DA + .pool +_0802B7D8: + movs r0, 0x1 +_0802B7DA: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802B720 + + thumb_func_start sub_802B7E0 +sub_802B7E0: @ 802B7E0 + push {r4,r5,lr} + ldr r1, =gUnknown_02022CFC + ldr r0, [r1] + ldrh r0, [r0, 0xA] + adds r4, r1, 0 + cmp r0, 0x7 + bhi _0802B8C4 + lsls r0, 2 + ldr r1, =_0802B800 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802B800: + .4byte _0802B820 + .4byte _0802B82C + .4byte _0802B84C + .4byte _0802B866 + .4byte _0802B878 + .4byte _0802B880 + .4byte _0802B8A0 + .4byte _0802B8BA +_0802B820: + movs r0, 0x2 + bl sub_802D0C8 + bl sub_802DDE0 + b _0802B890 +_0802B82C: + bl sub_802D0F0 + adds r5, r0, 0 + cmp r5, 0 + bne _0802B8C4 + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrb r0, [r0, 0x6] + bl sub_802DDF4 + ldr r1, [r4] + strh r5, [r1, 0x3C] + b _0802B894 + .pool +_0802B84C: + ldr r1, [r4] + ldrh r0, [r1, 0x3C] + adds r0, 0x1 + strh r0, [r1, 0x3C] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x78 + bls _0802B8C4 + movs r0, 0x3 + bl sub_802D0C8 + ldr r1, [r4] + b _0802B894 +_0802B866: + bl sub_802D0F0 + cmp r0, 0x1 + beq _0802B8C4 + bl sub_802DE08 + cmp r0, 0x1 + beq _0802B8C4 + b _0802B890 +_0802B878: + movs r0, 0x9 + bl sub_802D0C8 + b _0802B890 +_0802B880: + bl sub_802D0F0 + cmp r0, 0 + bne _0802B8C4 + bl sub_802C260 + bl sub_802D764 +_0802B890: + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] +_0802B894: + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] + b _0802B8C4 + .pool +_0802B8A0: + bl sub_802D788 + cmp r0, 0 + bne _0802B8C4 + bl sub_802C270 + bl sub_802BEA0 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] +_0802B8BA: + movs r0, 0 + b _0802B8C6 + .pool +_0802B8C4: + movs r0, 0x1 +_0802B8C6: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_802B7E0 + + thumb_func_start sub_802B8CC +sub_802B8CC: @ 802B8CC + push {r4,r5,lr} + bl sub_802BEE4 + ldr r5, =gUnknown_02022CFC + ldr r1, [r5] + ldrh r4, [r1, 0x36] + cmp r4, 0 + beq _0802B8E8 + movs r0, 0 + strh r0, [r1, 0x36] + b _0802B95C + .pool +_0802B8E8: + ldrh r0, [r1, 0xA] + cmp r0, 0x1 + beq _0802B914 + cmp r0, 0x1 + bgt _0802B8F8 + cmp r0, 0 + beq _0802B902 + b _0802B95A +_0802B8F8: + cmp r0, 0x2 + beq _0802B938 + cmp r0, 0x3 + beq _0802B94C + b _0802B95A +_0802B902: + movs r0, 0 + bl sub_802C130 + cmp r0, 0 + beq _0802B95A + ldr r1, [r5] + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] +_0802B914: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0802B95A + bl sub_802C164 + movs r0, 0x3 + bl sub_802AE14 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + b _0802B944 + .pool +_0802B938: + movs r0, 0x1 + bl sub_802C130 + cmp r0, 0x1 + bne _0802B95A + ldr r1, [r5] +_0802B944: + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] + b _0802B95A +_0802B94C: + movs r0, 0 + bl sub_802C130 + cmp r0, 0x1 + bne _0802B95A + ldr r0, [r5] + strh r4, [r0, 0xA] +_0802B95A: + movs r0, 0x1 +_0802B95C: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_802B8CC + + thumb_func_start sub_802B964 +sub_802B964: @ 802B964 + push {r4-r6,lr} + ldr r1, =gUnknown_02022CFC + ldr r0, [r1] + ldrh r0, [r0, 0xA] + adds r5, r1, 0 + cmp r0, 0x4 + bhi _0802BA50 + lsls r0, 2 + ldr r1, =_0802B984 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802B984: + .4byte _0802B998 + .4byte _0802B9BC + .4byte _0802BA00 + .4byte _0802BA24 + .4byte _0802BA46 +_0802B998: + movs r4, 0 + ldr r0, [r5] + ldrb r0, [r0, 0x5] + cmp r4, r0 + bge _0802B9B8 + adds r6, r5, 0 +_0802B9A4: + adds r0, r4, 0 + bl sub_802DDB8 + cmp r0, 0x1 + beq _0802BA50 + adds r4, 0x1 + ldr r0, [r6] + ldrb r0, [r0, 0x5] + cmp r4, r0 + blt _0802B9A4 +_0802B9B8: + ldr r1, [r5] + b _0802BA1C +_0802B9BC: + movs r4, 0 + ldr r0, [r5] + ldrb r0, [r0, 0x5] + cmp r4, r0 + bge _0802B9EC + adds r6, r5, 0 + movs r5, 0 +_0802B9CA: + ldr r0, [r6] + adds r0, r5 + ldr r1, =0x000082f4 + adds r0, r1 + ldrh r0, [r0] + cmp r0, 0x2 + bne _0802B9E0 + lsls r0, r4, 24 + lsrs r0, 24 + bl sub_802DDA0 +_0802B9E0: + adds r5, 0x28 + adds r4, 0x1 + ldr r0, [r6] + ldrb r0, [r0, 0x5] + cmp r4, r0 + blt _0802B9CA +_0802B9EC: + movs r0, 0x1 + bl sub_802D0C8 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + b _0802BA18 + .pool +_0802BA00: + ldr r1, [r5] + ldrh r0, [r1, 0x3C] + adds r0, 0x1 + strh r0, [r1, 0x3C] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x64 + bls _0802BA50 + movs r0, 0x3 + bl sub_802D0C8 + ldr r1, [r5] +_0802BA18: + movs r0, 0 + strh r0, [r1, 0x3C] +_0802BA1C: + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] + b _0802BA50 +_0802BA24: + bl sub_802D0F0 + adds r5, r0, 0 + cmp r5, 0 + bne _0802BA50 + bl sub_802DDCC + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + adds r0, 0x71 + strb r5, [r0] + bl sub_802C114 + ldr r1, [r4] + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] +_0802BA46: + movs r0, 0 + b _0802BA52 + .pool +_0802BA50: + movs r0, 0x1 +_0802BA52: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_802B964 + + thumb_func_start sub_802BA58 +sub_802BA58: @ 802BA58 + push {r4,lr} + ldr r1, =gUnknown_02022CFC + ldr r0, [r1] + ldrh r0, [r0, 0xA] + adds r4, r1, 0 + cmp r0, 0x6 + bls _0802BA68 + b _0802BB7C +_0802BA68: + lsls r0, 2 + ldr r1, =_0802BA7C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802BA7C: + .4byte _0802BA98 + .4byte _0802BAB8 + .4byte _0802BAD0 + .4byte _0802BB00 + .4byte _0802BAB8 + .4byte _0802BAD0 + .4byte _0802BB70 +_0802BA98: + ldr r2, [r4] + adds r0, r2, 0 + adds r0, 0x72 + ldrh r0, [r0] + adds r1, r2, 0 + adds r1, 0x3E + adds r2, 0x40 + bl sub_802C808 + ldr r1, [r4] + ldrh r0, [r1, 0x3E] + adds r1, 0x40 + ldrh r1, [r1] + bl sub_802D7E8 + b _0802BAF0 +_0802BAB8: + bl sub_802D974 + adds r2, r0, 0 + cmp r2, 0 + bne _0802BB7C + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + strh r2, [r1, 0x3C] + b _0802BAF2 + .pool +_0802BAD0: + ldr r1, [r4] + ldrh r0, [r1, 0x3C] + adds r2, r0, 0x1 + strh r2, [r1, 0x3C] + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + bne _0802BAEC + lsls r0, r2, 16 + lsrs r0, 16 + cmp r0, 0xB4 + bls _0802BB7C +_0802BAEC: + bl sub_802DA14 +_0802BAF0: + ldr r1, [r4] +_0802BAF2: + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] + b _0802BB7C + .pool +_0802BB00: + bl sub_802DA44 + cmp r0, 0 + bne _0802BB7C + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + ldrh r0, [r1, 0x3E] + adds r1, 0x40 + ldrh r1, [r1] + bl sub_802C880 + ldr r1, [r4] + adds r2, r1, 0 + adds r2, 0x40 + strh r0, [r2] + lsls r0, 16 + cmp r0, 0 + beq _0802BB58 + ldrh r0, [r1, 0x3E] + ldrh r1, [r2] + bl AddBagItem + lsls r0, 24 + cmp r0, 0 + beq _0802BB58 + ldr r0, [r4] + ldrh r0, [r0, 0x3E] + movs r1, 0x1 + bl CheckBagHasSpace + lsls r0, 24 + cmp r0, 0 + bne _0802BB50 + ldr r0, [r4] + ldrh r0, [r0, 0x3E] + bl sub_802D884 + b _0802BB62 + .pool +_0802BB50: + ldr r1, [r4] + movs r0, 0x6 + strh r0, [r1, 0xA] + b _0802BB7C +_0802BB58: + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0x3E] + bl sub_802D8FC +_0802BB62: + ldr r1, [r4] + movs r0, 0x4 + strh r0, [r1, 0xA] + b _0802BB7C + .pool +_0802BB70: + bl sub_802DA44 + cmp r0, 0 + bne _0802BB7C + movs r0, 0 + b _0802BB7E +_0802BB7C: + movs r0, 0x1 +_0802BB7E: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802BA58 + + thumb_func_start sub_802BB84 +sub_802BB84: @ 802BB84 + push {r4,lr} + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldrh r0, [r0, 0xA] + cmp r0, 0x6 + bhi _0802BC58 + lsls r0, 2 + ldr r1, =_0802BBA4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802BBA4: + .4byte _0802BBC0 + .4byte _0802BBC4 + .4byte _0802BBCE + .4byte _0802BC1C + .4byte _0802BC26 + .4byte _0802BC3C + .4byte _0802BC4E +_0802BBC0: + movs r0, 0x4 + b _0802BC28 +_0802BBC4: + bl sub_802D0F0 + cmp r0, 0 + bne _0802BC58 + b _0802BC2C +_0802BBCE: + bl sub_802DA8C + lsls r0, 24 + asrs r1, r0, 24 + cmp r1, 0 + beq _0802BC04 + cmp r1, 0 + bgt _0802BBE8 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _0802BBEC + b _0802BC58 +_0802BBE8: + cmp r1, 0x1 + bne _0802BC58 +_0802BBEC: + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + adds r0, 0x45 + movs r1, 0x1 + strb r1, [r0] + movs r0, 0x6 + bl sub_802D0C8 + ldr r1, [r4] + b _0802BC30 + .pool +_0802BC04: + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + adds r0, 0x45 + movs r1, 0x2 + strb r1, [r0] + movs r0, 0x6 + bl sub_802D0C8 + ldr r1, [r4] + b _0802BC30 + .pool +_0802BC1C: + bl sub_802D0F0 + cmp r0, 0 + bne _0802BC58 + b _0802BC2C +_0802BC26: + movs r0, 0x8 +_0802BC28: + bl sub_802D0C8 +_0802BC2C: + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] +_0802BC30: + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] + b _0802BC58 + .pool +_0802BC3C: + bl sub_802D0F0 + cmp r0, 0 + bne _0802BC58 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] +_0802BC4E: + movs r0, 0 + b _0802BC5A + .pool +_0802BC58: + movs r0, 0x1 +_0802BC5A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802BB84 + + thumb_func_start sub_802BC60 +sub_802BC60: @ 802BC60 + push {r4,lr} + sub sp, 0x4 + ldr r1, =gUnknown_02022CFC + ldr r0, [r1] + ldrh r0, [r0, 0xA] + adds r4, r1, 0 + cmp r0, 0x5 + bhi _0802BD24 + lsls r0, 2 + ldr r1, =_0802BC84 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802BC84: + .4byte _0802BC9C + .4byte _0802BCA2 + .4byte _0802BCB2 + .4byte _0802BCC8 + .4byte _0802BCEE + .4byte _0802BD14 +_0802BC9C: + bl sub_802DA14 + b _0802BCFE +_0802BCA2: + bl sub_802DA44 + cmp r0, 0 + bne _0802BD24 + movs r0, 0x7 + bl sub_802D0C8 + b _0802BCFE +_0802BCB2: + bl sub_802D0F0 + adds r2, r0, 0 + cmp r2, 0 + bne _0802BD24 + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + strh r2, [r1, 0x3C] + b _0802BD02 + .pool +_0802BCC8: + ldr r1, [r4] + ldrh r0, [r1, 0x3C] + adds r0, 0x1 + strh r0, [r1, 0x3C] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x78 + bls _0802BD24 + movs r1, 0x1 + negs r1, r1 + movs r0, 0 + str r0, [sp] + adds r0, r1, 0 + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + ldr r1, [r4] + b _0802BD02 +_0802BCEE: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _0802BD24 + bl sub_800AC34 +_0802BCFE: + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] +_0802BD02: + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] + b _0802BD24 + .pool +_0802BD14: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0802BD24 + movs r0, 0 + b _0802BD26 + .pool +_0802BD24: + movs r0, 0x1 +_0802BD26: + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802BC60 + + thumb_func_start sub_802BD30 +sub_802BD30: @ 802BD30 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldrh r0, [r0, 0xA] + cmp r0, 0x1 + beq _0802BD66 + cmp r0, 0x1 + bgt _0802BD4C + cmp r0, 0 + beq _0802BD52 + b _0802BD7A + .pool +_0802BD4C: + cmp r0, 0x2 + beq _0802BD76 + b _0802BD7A +_0802BD52: + bl sub_802DA14 + movs r0, 0 + bl sub_802DD64 + ldr r1, [r4] + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] + b _0802BD7A +_0802BD66: + bl sub_802DA44 + cmp r0, 0 + bne _0802BD7A + ldr r1, [r4] + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] +_0802BD76: + movs r0, 0 + b _0802BD7C +_0802BD7A: + movs r0, 0x1 +_0802BD7C: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802BD30 + + thumb_func_start sub_802BD84 +sub_802BD84: @ 802BD84 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + lsls r0, 2 + add r0, r10 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r6, r0, r1 + mov r0, r10 + movs r1, 0xE + bl GetWordTaskArg + mov r8, r0 + movs r1, 0 + ldrsh r0, [r6, r1] + cmp r0, 0 + beq _0802BDC8 + cmp r0, 0x1 + beq _0802BDDC + b _0802BE48 + .pool +_0802BDBC: + bl sub_802AB20 + mov r0, r10 + bl DestroyTask + b _0802BE48 +_0802BDC8: + movs r1, 0 + adds r0, r6, 0 + adds r0, 0x8 +_0802BDCE: + strh r1, [r0, 0x4] + subs r0, 0x2 + cmp r0, r6 + bge _0802BDCE + ldrh r0, [r6] + adds r0, 0x1 + strh r0, [r6] +_0802BDDC: + mov r3, r8 + ldrb r1, [r3, 0x6] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 2 + ldr r4, =0x000082a8 + adds r0, r4 + add r0, r8 + bl sub_802E0AC + movs r2, 0 + adds r5, r6, 0x4 + mov r9, r2 + movs r7, 0x83 + lsls r7, 8 + add r7, r8 + add r4, r8 +_0802BDFE: + movs r1, 0 + ldrsh r0, [r5, r1] + cmp r0, 0 + bne _0802BE38 + adds r0, r2, 0 + adds r1, r4, 0 + str r2, [sp] + bl sub_802E0D0 + ldr r2, [sp] + cmp r0, 0 + beq _0802BE38 + ldr r1, =gLinkPlayers + 8 + add r1, r9 + adds r0, r7, 0 + bl StringCopy + movs r0, 0x1 + strh r0, [r5] + ldrh r0, [r6, 0x2] + adds r0, 0x1 + strh r0, [r6, 0x2] + movs r3, 0x2 + ldrsh r0, [r6, r3] + ldr r2, [sp] + mov r1, r8 + ldrb r1, [r1, 0x5] + cmp r0, r1 + beq _0802BDBC +_0802BE38: + adds r5, 0x2 + movs r3, 0x1C + add r9, r3 + adds r7, 0x28 + adds r4, 0xC + adds r2, 0x1 + cmp r2, 0x4 + ble _0802BDFE +_0802BE48: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802BD84 + + thumb_func_start sub_802BE60 +sub_802BE60: @ 802BE60 + push {lr} + lsls r1, 24 + lsrs r1, 24 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnknown_02022CFC + ldr r2, [r1] + movs r1, 0xE + bl SetWordTaskArg + pop {r0} + bx r0 + .pool + thumb_func_end sub_802BE60 + + thumb_func_start sub_802BE80 +sub_802BE80: @ 802BE80 + ldr r0, =gUnknown_02022CFC + ldr r2, [r0] + adds r0, r2, 0 + adds r0, 0x4A + movs r1, 0 + strh r1, [r0] + movs r0, 0x6 + str r0, [r2, 0x14] + strh r1, [r2, 0x34] + str r1, [r2, 0x1C] + strh r1, [r2, 0x36] + str r1, [r2, 0x10] + bx lr + .pool + thumb_func_end sub_802BE80 + + thumb_func_start sub_802BEA0 +sub_802BEA0: @ 802BEA0 + push {r4,lr} + ldr r3, =gUnknown_02022CFC + ldr r0, [r3] + adds r1, r0, 0 + adds r1, 0x4A + movs r4, 0 + movs r2, 0 + strh r2, [r1] + ldr r1, =0x000006ff + strh r1, [r0, 0x34] + movs r1, 0x7 + str r1, [r0, 0x14] + strh r2, [r0, 0x36] + str r2, [r0, 0x10] + adds r0, 0x51 + strb r4, [r0] + ldr r0, [r3] + adds r0, 0x50 + strb r4, [r0] + ldr r0, [r3] + str r2, [r0, 0x20] + adds r1, r0, 0 + adds r1, 0x4E + strh r2, [r1] + str r2, [r0, 0x6C] + bl sub_802BF7C + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802BEA0 + + thumb_func_start sub_802BEE4 +sub_802BEE4: @ 802BEE4 + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + adds r0, r1, 0 + adds r0, 0x46 + ldrb r0, [r0] + cmp r0, 0 + beq _0802BF34 + adds r1, 0x4A + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + bl sub_802BF48 + ldr r3, [r4] + ldrh r1, [r3, 0x34] + adds r2, r1, r0 + strh r2, [r3, 0x34] + lsls r1, r2, 16 + ldr r0, =0x09fe0000 + cmp r1, r0 + bls _0802BF16 + ldr r1, =0xfffff601 + adds r0, r2, r1 + strh r0, [r3, 0x34] +_0802BF16: + ldr r1, [r4] + ldr r2, [r1, 0x14] + str r2, [r1, 0x18] + ldrh r0, [r1, 0x34] + lsrs r0, 8 + str r0, [r1, 0x14] + cmp r0, 0x6 + bls _0802BF34 + cmp r2, 0x6 + bhi _0802BF34 + ldrh r0, [r1, 0x36] + adds r0, 0x1 + strh r0, [r1, 0x36] + bl sub_802BF7C +_0802BF34: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802BEE4 + + thumb_func_start sub_802BF48 +sub_802BF48: @ 802BF48 + push {lr} + ldr r0, =gUnknown_02022CFC + ldr r2, [r0] + ldr r0, [r2, 0x10] + cmp r0, 0 + beq _0802BF5C + movs r0, 0 + b _0802BF72 + .pool +_0802BF5C: + ldr r3, [r2, 0x1C] + ldrh r1, [r2, 0x34] + ldr r0, =0x000005ff + cmp r1, r0 + bhi _0802BF70 + ldr r0, [r2, 0x20] + adds r0, 0x50 + str r0, [r2, 0x20] + lsrs r0, 8 + adds r3, r0 +_0802BF70: + adds r0, r3, 0 +_0802BF72: + pop {r1} + bx r1 + .pool + thumb_func_end sub_802BF48 + + thumb_func_start sub_802BF7C +sub_802BF7C: @ 802BF7C + push {r4,lr} + ldr r4, =gUnknown_02022CFC + ldr r3, [r4] + movs r0, 0 + str r0, [r3, 0x20] + adds r1, r3, 0 + adds r1, 0x4E + ldrh r0, [r1] + cmp r0, 0 + beq _0802BFC0 + subs r0, 0x1 + strh r0, [r1] + ldr r0, [r3, 0x6C] + cmp r0, 0 + beq _0802C08A + bl sub_802C098 + movs r1, 0x3 + ands r1, r0 + cmp r1, 0 + beq _0802BFB0 + ldr r1, [r4] + b _0802C086 + .pool +_0802BFB0: + ldr r1, [r4] + ldr r0, [r1, 0x28] + cmp r0, 0x36 + bls _0802BFBC + movs r0, 0x1E + b _0802C088 +_0802BFBC: + movs r0, 0x52 + b _0802C088 +_0802BFC0: + adds r2, r3, 0 + adds r2, 0x50 + ldrb r1, [r2] + movs r0, 0x8 + ands r0, r1 + cmp r0, 0 + bne _0802C014 + ldr r0, =gUnknown_082FB63C + ldrb r1, [r2] + lsls r1, 1 + adds r1, r0 + adds r0, r3, 0 + adds r0, 0x51 + ldrb r2, [r0] + lsls r0, r2, 3 + subs r0, r2 + ldrh r1, [r1] + adds r0, r1 + str r0, [r3, 0x28] + bl sub_802C098 + ldr r2, [r4] + ldr r3, =gUnknown_082FB64C + movs r1, 0x3 + ands r1, r0 + lsls r1, 1 + adds r1, r3 + ldrh r0, [r1] + adds r0, 0x2 + adds r1, r2, 0 + adds r1, 0x4E + strh r0, [r1] + adds r2, 0x50 + ldrb r0, [r2] + adds r0, 0x1 + strb r0, [r2] + b _0802C082 + .pool +_0802C014: + lsls r0, r1, 24 + lsrs r0, 24 + cmp r0, 0x8 + bne _0802C030 + adds r1, r3, 0 + adds r1, 0x51 + ldrb r0, [r1] + cmp r0, 0x2 + bhi _0802C02C + adds r0, 0x1 + strb r0, [r1] + b _0802C030 +_0802C02C: + movs r0, 0x1 + str r0, [r3, 0x6C] +_0802C030: + ldr r2, =gUnknown_082FB63C + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + mov r12, r0 + mov r3, r12 + adds r3, 0x50 + ldrb r0, [r3] + movs r1, 0xF + subs r1, r0 + lsls r1, 1 + adds r1, r2 + mov r0, r12 + adds r0, 0x51 + ldrb r2, [r0] + lsls r0, r2, 3 + subs r0, r2 + ldrh r1, [r1] + adds r0, r1 + mov r1, r12 + str r0, [r1, 0x28] + ldrb r0, [r3] + adds r0, 0x1 + strb r0, [r3] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xF + bls _0802C082 + bl sub_802C098 + movs r1, 0x3 + ands r1, r0 + cmp r1, 0 + bne _0802C07A + ldr r1, [r4] + ldr r0, [r1, 0x28] + subs r0, 0x5 + str r0, [r1, 0x28] +_0802C07A: + ldr r0, [r4] + adds r0, 0x50 + movs r1, 0 + strb r1, [r0] +_0802C082: + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] +_0802C086: + ldr r0, [r1, 0x28] +_0802C088: + str r0, [r1, 0x1C] +_0802C08A: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802BF7C + + thumb_func_start sub_802C098 +sub_802C098: @ 802C098 + ldr r0, =gUnknown_02022CFC + ldr r2, [r0] + ldr r1, [r2, 0x24] + ldr r0, =0x41c64e6d + muls r0, r1 + ldr r1, =0x00006073 + adds r0, r1 + str r0, [r2, 0x24] + lsrs r0, 16 + bx lr + .pool + thumb_func_end sub_802C098 + + thumb_func_start sub_802C0B8 +sub_802C0B8: @ 802C0B8 + push {lr} + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + movs r0, 0x1 + str r0, [r1, 0x10] + movs r0, 0x6 + str r0, [r1, 0x14] + ldr r0, =0x000005ff + strh r0, [r1, 0x34] + bl sub_802C270 + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C0B8 + + thumb_func_start sub_802C0DC +sub_802C0DC: @ 802C0DC + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldr r0, [r0, 0x10] + bx lr + .pool + thumb_func_end sub_802C0DC + + thumb_func_start sub_802C0E8 +sub_802C0E8: @ 802C0E8 + push {r4,r5,lr} + ldr r5, =gUnknown_02022CFC + ldr r4, =0x000082f8 + movs r3, 0 + movs r2, 0 + movs r1, 0x4 +_0802C0F4: + ldr r0, [r5] + adds r0, r4 + adds r0, r2 + str r3, [r0] + adds r2, 0x28 + subs r1, 0x1 + cmp r1, 0 + bge _0802C0F4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C0E8 + + thumb_func_start sub_802C114 +sub_802C114: @ 802C114 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldr r1, =0x000083ac + adds r0, r1 + ldr r1, [r0] + movs r2, 0 + strh r2, [r1, 0x10] + ldr r0, [r0] + strh r2, [r0, 0x12] + bx lr + .pool + thumb_func_end sub_802C114 + + thumb_func_start sub_802C130 +sub_802C130: @ 802C130 + push {lr} + lsls r0, 16 + lsrs r0, 16 + ldr r1, =gUnknown_02022CFC + ldr r2, [r1] + ldrb r3, [r2, 0x6] + lsls r1, r3, 2 + adds r1, r3 + lsls r1, 3 + adds r2, r1 + ldr r1, =0x000082f4 + adds r2, r1 + ldrh r1, [r2] + cmp r1, r0 + beq _0802C15C + movs r0, 0 + b _0802C15E + .pool +_0802C15C: + movs r0, 0x1 +_0802C15E: + pop {r1} + bx r1 + thumb_func_end sub_802C130 + + thumb_func_start sub_802C164 +sub_802C164: @ 802C164 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldr r1, =0x000083ac + adds r2, r0, r1 + ldr r1, [r2] + adds r0, 0x4A + ldrh r0, [r0] + strh r0, [r1, 0xE] + ldr r1, [r2] + ldrh r0, [r1, 0x10] + strh r0, [r1, 0x12] + ldr r1, [r2] + movs r0, 0x1 + strh r0, [r1, 0x10] + bx lr + .pool + thumb_func_end sub_802C164 + + thumb_func_start sub_802C18C +sub_802C18C: @ 802C18C + push {r4,lr} + ldr r0, =gUnknown_02022CFC + ldr r2, [r0] + ldr r0, =0x000083ac + adds r3, r2, r0 + ldr r1, [r3] + ldrh r0, [r1, 0x10] + strh r0, [r1, 0x12] + ldr r0, [r3] + movs r4, 0x2 + strh r4, [r0, 0x10] + ldr r1, [r3] + adds r2, 0x4A + ldrh r0, [r2] + strh r0, [r1, 0xE] + ldr r0, [r3] + str r4, [r0, 0x14] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C18C + + thumb_func_start sub_802C1BC +sub_802C1BC: @ 802C1BC + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldr r1, =0x000083ac + adds r0, r1 + ldr r1, [r0] + ldrh r2, [r1, 0x10] + movs r3, 0 + strh r2, [r1, 0x12] + ldr r0, [r0] + strh r3, [r0, 0x10] + bx lr + .pool + thumb_func_end sub_802C1BC + + thumb_func_start sub_802C1DC +sub_802C1DC: @ 802C1DC + push {r4,r5,lr} + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + ldr r0, [r1, 0x5C] + cmp r0, 0 + beq _0802C21C + ldr r0, [r1, 0x78] + bl sub_802DD64 + ldr r1, [r4] + movs r5, 0 + str r5, [r1, 0x5C] + adds r0, r1, 0 + adds r0, 0x4D + ldrb r0, [r0] + cmp r0, 0 + beq _0802C21C + adds r0, r1, 0 + adds r0, 0x71 + ldrb r0, [r0] + bl sub_802DCCC + ldr r1, =gUnknown_082FB654 + subs r0, 0x2 + lsls r0, 1 + adds r0, r1 + ldrh r0, [r0] + bl PlaySE + ldr r0, [r4] + adds r0, 0x4D + strb r5, [r0] +_0802C21C: + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + adds r0, 0x74 + ldrh r0, [r0] + bl sub_802DD74 + bl sub_802C280 + bl sub_802C240 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C1DC + + thumb_func_start sub_802C240 +sub_802C240: @ 802C240 + push {lr} + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x46 + ldrb r0, [r0] + cmp r0, 0 + beq _0802C256 + ldr r0, [r1, 0x14] + bl sub_802DC9C +_0802C256: + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C240 + + thumb_func_start sub_802C260 +sub_802C260: @ 802C260 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + adds r0, 0x46 + movs r1, 0 + strb r1, [r0] + bx lr + .pool + thumb_func_end sub_802C260 + + thumb_func_start sub_802C270 +sub_802C270: @ 802C270 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + adds r0, 0x46 + movs r1, 0x1 + strb r1, [r0] + bx lr + .pool + thumb_func_end sub_802C270 + + thumb_func_start sub_802C280 +sub_802C280: @ 802C280 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + movs r6, 0 + ldr r2, =gUnknown_02022CFC + ldr r0, [r2] + ldrb r0, [r0, 0x5] + mov r9, r0 + movs r5, 0 + cmp r6, r9 + bge _0802C360 + mov r10, r2 + mov r8, r5 + movs r7, 0 +_0802C2A2: + mov r0, r10 + ldr r3, [r0] + adds r1, r3, r7 + ldr r2, =0x000082f4 + adds r0, r1, r2 + ldrh r2, [r0] + cmp r2, 0x1 + beq _0802C2D4 + cmp r2, 0x1 + bgt _0802C2C4 + cmp r2, 0 + beq _0802C2CA + b _0802C354 + .pool +_0802C2C4: + cmp r2, 0x2 + beq _0802C338 + b _0802C354 +_0802C2CA: + adds r0, r5, 0 + movs r1, 0 + bl sub_802DC80 + b _0802C354 +_0802C2D4: + ldr r0, =0x000082f6 + adds r4, r1, r0 + ldrh r0, [r4] + cmp r0, 0x1 + bne _0802C2F6 + ldr r0, =0x000082f2 + adds r0, r1 + adds r1, r3, 0 + adds r1, 0x9A + add r1, r8 + str r1, [sp] + ldrh r1, [r0] + mov r12, r1 + ldr r0, [sp] + ldrh r0, [r0] + cmp r12, r0 + beq _0802C31E +_0802C2F6: + ldrb r3, [r3, 0x6] + cmp r5, r3 + bne _0802C2FE + strh r2, [r4] +_0802C2FE: + orrs r6, r2 + mov r1, r10 + ldr r2, [r1] + ldr r1, =0x000082e8 + adds r0, r2, r1 + adds r0, r7 + ldr r1, =0x7fffffff + str r1, [r0] + adds r1, r2, 0 + adds r1, 0x9A + add r1, r8 + adds r2, r7 + ldr r0, =0x000082f2 + adds r2, r0 + ldrh r0, [r2] + strh r0, [r1] +_0802C31E: + adds r0, r5, 0 + bl sub_802C398 + b _0802C354 + .pool +_0802C338: + ldr r0, =0x000082f6 + adds r1, r0 + ldrh r0, [r1] + cmp r0, 0x2 + beq _0802C354 + ldrb r3, [r3, 0x6] + cmp r5, r3 + bne _0802C34A + strh r2, [r1] +_0802C34A: + orrs r6, r2 + lsls r0, r5, 24 + lsrs r0, 24 + bl sub_802DD88 +_0802C354: + movs r1, 0x2 + add r8, r1 + adds r7, 0x28 + adds r5, 0x1 + cmp r5, r9 + blt _0802C2A2 +_0802C360: + movs r0, 0x2 + ands r0, r6 + cmp r0, 0 + beq _0802C378 + movs r0, 0x83 + lsls r0, 1 + bl PlaySE + b _0802C386 + .pool +_0802C378: + movs r0, 0x1 + ands r6, r0 + cmp r6, 0 + beq _0802C386 + movs r0, 0xA + bl PlaySE +_0802C386: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_802C280 + + thumb_func_start sub_802C398 +sub_802C398: @ 802C398 + push {r4-r6,lr} + adds r6, r0, 0 + ldr r0, =gUnknown_02022CFC + ldr r2, [r0] + ldr r0, [r2, 0x68] + cmp r0, 0 + bne _0802C432 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =0x000082e4 + adds r0, r1 + adds r5, r2, r0 + ldr r1, [r5, 0x4] + ldr r0, =0x7fffffff + cmp r1, r0 + beq _0802C3D0 + adds r0, r1, 0x1 + str r0, [r5, 0x4] + adds r3, r0, 0 + b _0802C3E8 + .pool +_0802C3D0: + adds r0, r2, 0 + adds r0, 0x4A + ldrh r1, [r0] + ldrh r0, [r5, 0xE] + subs r3, r1, r0 + ldr r0, =0x0000fde7 + cmp r3, r0 + ble _0802C3E6 + ldr r0, =0xffff0218 + adds r3, r0 + adds r3, r1 +_0802C3E6: + str r3, [r5, 0x4] +_0802C3E8: + cmp r3, 0x3 + ble _0802C432 + subs r3, 0x4 + cmp r3, 0x2F + bgt _0802C414 + ldr r2, =gUnknown_082FB65C + ldrh r1, [r5, 0xC] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 4 + adds r0, r3, r0 + adds r0, r2 + movs r4, 0 + ldrsb r4, [r0, r4] + b _0802C416 + .pool +_0802C414: + movs r4, 0 +_0802C416: + adds r1, r4, 0 + adds r0, r6, 0 + bl sub_802DC80 + cmp r4, 0 + bne _0802C430 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldrb r0, [r0, 0x6] + cmp r6, r0 + bne _0802C430 + bl sub_802C1BC +_0802C430: + str r4, [r5] +_0802C432: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C398 + + thumb_func_start sub_802C43C +sub_802C43C: @ 802C43C + push {r4,r5,lr} + ldr r5, =gUnknown_02022CFC + ldr r1, [r5] + ldr r0, [r1, 0x14] + cmp r0, 0x8 + bne _0802C4CE + ldr r0, [r1, 0x18] + cmp r0, 0x7 + bne _0802C4CE + ldr r4, [r1, 0x58] + cmp r4, 0 + bne _0802C46C + bl sub_802C780 + ldr r0, [r5] + str r4, [r0, 0x54] + movs r1, 0x1 + str r1, [r0, 0x58] + adds r0, 0x71 + strb r4, [r0] + b _0802C4CE + .pool +_0802C46C: + ldr r0, [r1, 0x54] + cmp r0, 0x5 + bne _0802C480 + ldrh r0, [r1, 0xC] + adds r0, 0x1 + strh r0, [r1, 0xC] + ldrh r0, [r1, 0xC] + bl sub_802C7A0 + b _0802C484 +_0802C480: + movs r0, 0 + strh r0, [r1, 0xC] +_0802C484: + ldr r4, =gUnknown_02022CFC + ldr r1, [r4] + ldr r0, [r1, 0x54] + cmp r0, 0x1 + ble _0802C49E + movs r0, 0x1 + str r0, [r1, 0x64] + adds r0, r1, 0 + adds r0, 0x86 + adds r1, 0x81 + movs r2, 0x5 + bl memcpy +_0802C49E: + bl sub_802C780 + ldr r0, [r4] + movs r2, 0 + str r2, [r0, 0x54] + movs r1, 0x1 + str r1, [r0, 0x58] + adds r0, 0x71 + strb r2, [r0] + ldr r0, [r4] + adds r2, r0, 0 + adds r2, 0x74 + ldrh r1, [r2] + ldr r0, =0x0000270e + cmp r1, r0 + bhi _0802C4C2 + adds r0, r1, 0x1 + strh r0, [r2] +_0802C4C2: + movs r0, 0xA + bl sub_802C688 + movs r0, 0x3 + bl sub_802AE14 +_0802C4CE: + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldr r0, [r0, 0x64] + cmp r0, 0 + beq _0802C504 + bl sub_802C618 + cmp r0, 0x1 + beq _0802C4E8 + ldr r0, [r4] + ldr r0, [r0, 0x14] + cmp r0, 0 + bne _0802C504 +_0802C4E8: + ldr r0, [r4] + adds r0, 0x86 + bl sub_802C73C + bl sub_802C790 + bl sub_802C688 + movs r0, 0x3 + bl sub_802AE14 + ldr r1, [r4] + movs r0, 0 + str r0, [r1, 0x64] +_0802C504: + ldr r4, =gUnknown_02022CFC + ldr r0, [r4] + ldr r0, [r0, 0x58] + cmp r0, 0 + beq _0802C52A + bl sub_802C6B0 + adds r2, r0, 0 + ldr r1, [r4] + ldr r0, [r1, 0x54] + cmp r2, r0 + ble _0802C52A + str r2, [r1, 0x54] + adds r0, r1, 0 + adds r0, 0x81 + adds r1, 0x7C + movs r2, 0x5 + bl memcpy +_0802C52A: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C43C + + thumb_func_start sub_802C538 +sub_802C538: @ 802C538 + push {r4,r5,lr} + ldr r5, =gUnknown_02022CFC + ldr r1, [r5] + ldr r0, [r1, 0x14] + cmp r0, 0x6 + bne _0802C582 + ldr r4, =0x000083ac + adds r0, r1, r4 + ldr r1, [r0] + ldr r0, [r1] + cmp r0, 0 + bne _0802C582 + ldrh r0, [r1, 0x12] + cmp r0, 0x1 + bne _0802C578 + bl sub_802C0DC + adds r1, r0, 0 + cmp r1, 0x1 + bne _0802C578 + ldr r0, [r5] + adds r0, r4 + ldr r0, [r0] + str r1, [r0, 0x14] + b _0802C582 + .pool +_0802C574: + movs r0, 0 + b _0802C5CA +_0802C578: + bl sub_802C18C + movs r0, 0x3 + bl sub_802AE14 +_0802C582: + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + ldr r0, [r1, 0x14] + cmp r0, 0x7 + bne _0802C5A8 + ldr r0, [r1, 0x18] + cmp r0, 0x6 + bne _0802C5A8 + ldr r2, =0x000083ac + adds r0, r1, r2 + ldr r1, [r0] + ldrh r0, [r1, 0x10] + cmp r0, 0x2 + beq _0802C5A8 + movs r0, 0x1 + str r0, [r1, 0x14] + movs r0, 0x3 + bl sub_802AE14 +_0802C5A8: + movs r2, 0 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldrb r1, [r0, 0x5] + cmp r2, r1 + bge _0802C5C8 + adds r3, r1, 0 + ldr r4, =0x000082f4 + adds r1, r0, r4 +_0802C5BA: + ldrh r0, [r1] + cmp r0, 0x2 + beq _0802C574 + adds r1, 0x28 + adds r2, 0x1 + cmp r2, r3 + blt _0802C5BA +_0802C5C8: + movs r0, 0x1 +_0802C5CA: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802C538 + + thumb_func_start sub_802C5DC +sub_802C5DC: @ 802C5DC + push {r4,lr} + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldrb r3, [r0, 0x5] + movs r4, 0 + cmp r4, r3 + bge _0802C600 + ldr r1, =0x000082f8 + adds r2, r0, r1 + adds r1, r3, 0 +_0802C5F0: + ldr r0, [r2] + cmp r0, 0 + beq _0802C5F8 + adds r4, 0x1 +_0802C5F8: + adds r2, 0x28 + subs r1, 0x1 + cmp r1, 0 + bne _0802C5F0 +_0802C600: + movs r0, 0 + cmp r4, r3 + bne _0802C608 + movs r0, 0x1 +_0802C608: + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802C5DC + + thumb_func_start sub_802C618 +sub_802C618: @ 802C618 + push {r4,lr} + movs r2, 0 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldrb r1, [r0, 0x5] + cmp r2, r1 + bge _0802C648 + adds r3, r1, 0 + ldr r4, =0x000082f8 + adds r1, r0, r4 +_0802C62C: + ldr r0, [r1] + cmp r0, 0x1 + beq _0802C640 + movs r0, 0 + b _0802C64A + .pool +_0802C640: + adds r1, 0x28 + adds r2, 0x1 + cmp r2, r3 + blt _0802C62C +_0802C648: + movs r0, 0x1 +_0802C64A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802C618 + + thumb_func_start sub_802C650 +sub_802C650: @ 802C650 + push {lr} + ldr r0, =gUnknown_02022CFC + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x45 + ldrb r0, [r0] + cmp r0, 0x1 + bne _0802C668 +_0802C660: + movs r0, 0 + b _0802C684 + .pool +_0802C668: + movs r2, 0x1 + ldrb r0, [r1, 0x5] + cmp r2, r0 + bge _0802C682 + adds r3, r0, 0 + adds r1, 0x92 +_0802C674: + ldrh r0, [r1] + cmp r0, 0x1 + beq _0802C660 + adds r1, 0x2 + adds r2, 0x1 + cmp r2, r3 + blt _0802C674 +_0802C682: + movs r0, 0x1 +_0802C684: + pop {r1} + bx r1 + thumb_func_end sub_802C650 + + thumb_func_start sub_802C688 +sub_802C688: @ 802C688 + push {lr} + ldr r1, =gUnknown_02022CFC + ldr r2, [r1] + ldr r1, [r2, 0x78] + adds r1, r0 + str r1, [r2, 0x78] + movs r0, 0x1 + str r0, [r2, 0x5C] + ldr r0, =0x00018695 + cmp r1, r0 + bls _0802C6A2 + adds r0, 0x1 + str r0, [r2, 0x78] +_0802C6A2: + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C688 + + thumb_func_start sub_802C6B0 +sub_802C6B0: @ 802C6B0 + push {r4-r7,lr} + movs r5, 0 + ldr r1, =gUnknown_02022CFC + ldr r0, [r1] + ldrb r4, [r0, 0x5] + movs r2, 0 + cmp r5, r4 + bge _0802C702 + mov r12, r1 + movs r3, 0 + ldr r7, =0x000082e4 + movs r6, 0x1E + negs r6, r6 +_0802C6CA: + mov r0, r12 + ldr r1, [r0] + adds r0, r1, r7 + adds r0, r3 + ldr r0, [r0] + cmp r0, r6 + bne _0802C6F0 + adds r0, r1, 0 + adds r0, 0x7C + adds r0, r2 + movs r1, 0x1 + strb r1, [r0] + adds r5, 0x1 + b _0802C6FA + .pool +_0802C6F0: + adds r0, r1, 0 + adds r0, 0x7C + adds r0, r2 + movs r1, 0 + strb r1, [r0] +_0802C6FA: + adds r3, 0x28 + adds r2, 0x1 + cmp r2, r4 + blt _0802C6CA +_0802C702: + adds r0, r5, 0 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_802C6B0 + + thumb_func_start sub_802C70C +sub_802C70C: @ 802C70C + push {lr} + movs r2, 0 + ldr r1, =gUnknown_03005000 + ldr r3, =0x000009e6 + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, 0 + bne _0802C728 + ldr r3, =0x00000c1a + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, 0 + bne _0802C728 + movs r2, 0x1 +_0802C728: + adds r0, r2, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_802C70C + + thumb_func_start sub_802C73C +sub_802C73C: @ 802C73C + push {r4-r6,lr} + adds r4, r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + ldr r6, =gUnknown_02022CFC + movs r5, 0x1 +_0802C74A: + adds r0, r4, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0802C75A + adds r0, r5, 0 + lsls r0, r1 + orrs r2, r0 + adds r3, 0x1 +_0802C75A: + adds r1, 0x1 + cmp r1, 0x4 + ble _0802C74A + ldr r0, [r6] + adds r0, 0x71 + strb r2, [r0] + cmp r2, 0 + beq _0802C772 + ldr r0, [r6] + adds r0, 0x4D + movs r1, 0x1 + strb r1, [r0] +_0802C772: + adds r0, r3, 0 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802C73C + + thumb_func_start sub_802C780 +sub_802C780: @ 802C780 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + adds r0, 0x44 + movs r1, 0 + strb r1, [r0] + bx lr + .pool + thumb_func_end sub_802C780 + + thumb_func_start sub_802C790 +sub_802C790: @ 802C790 + ldr r1, =gUnknown_082FB6EC + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + bx lr + .pool + thumb_func_end sub_802C790 + + thumb_func_start sub_802C7A0 +sub_802C7A0: @ 802C7A0 + push {lr} + lsls r0, 16 + lsrs r1, r0, 16 + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldrh r2, [r0, 0xE] + cmp r1, r2 + bls _0802C7B2 + strh r1, [r0, 0xE] +_0802C7B2: + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C7A0 + + thumb_func_start sub_802C7BC +sub_802C7BC: @ 802C7BC + push {lr} + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldr r1, =gUnknown_082FB714 + ldr r2, [r0, 0x78] + ldr r0, [r1] + cmp r2, r0 + bcs _0802C7D8 + movs r0, 0 + b _0802C7DA + .pool +_0802C7D8: + movs r0, 0x1 +_0802C7DA: + pop {r1} + bx r1 + thumb_func_end sub_802C7BC + + thumb_func_start sub_802C7E0 +sub_802C7E0: @ 802C7E0 + push {r4,lr} + bl sub_802C818 + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + bl sub_802C838 + lsls r0, 16 + lsrs r0, 4 + ldr r1, =0x00000fff + ands r4, r1 + orrs r0, r4 + lsls r0, 16 + lsrs r0, 16 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802C7E0 + + thumb_func_start sub_802C808 +sub_802C808: @ 802C808 + lsls r0, 16 + lsrs r3, r0, 28 + strh r3, [r2] + lsls r0, 4 + lsrs r0, 20 + strh r0, [r1] + bx lr + thumb_func_end sub_802C808 + + thumb_func_start sub_802C818 +sub_802C818: @ 802C818 + push {lr} + bl Random + lsls r0, 16 + movs r1, 0xE0 + lsls r1, 11 + ands r1, r0 + ldr r0, =gUnknown_082FB704 + lsrs r1, 15 + adds r1, r0 + ldrh r0, [r1] + pop {r1} + bx r1 + .pool + thumb_func_end sub_802C818 + + thumb_func_start sub_802C838 +sub_802C838: @ 802C838 + push {r4-r6,lr} + movs r5, 0 + movs r4, 0 + ldr r3, =gUnknown_02022CFC + ldr r0, [r3] + ldr r2, =gUnknown_082FB714 + ldr r1, [r0, 0x78] + ldr r0, [r2] + cmp r1, r0 + bcc _0802C874 + ldr r5, [r2, 0x4] + adds r6, r3, 0 + adds r3, r2, 0x4 +_0802C852: + adds r3, 0x8 + adds r2, 0x8 + adds r4, 0x1 + cmp r4, 0x4 + bhi _0802C874 + ldr r0, [r6] + ldr r1, [r0, 0x78] + ldr r0, [r2] + cmp r1, r0 + bcc _0802C874 + ldr r5, [r3] + b _0802C852 + .pool +_0802C874: + lsls r0, r5, 16 + lsrs r0, 16 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_802C838 + + thumb_func_start sub_802C880 +sub_802C880: @ 802C880 + push {r4,r5,lr} + lsls r0, 16 + lsrs r5, r0, 16 + lsls r1, 16 + lsrs r4, r1, 16 + b _0802C892 +_0802C88C: + subs r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 +_0802C892: + cmp r4, 0 + beq _0802C8A4 + adds r0, r5, 0 + adds r1, r4, 0 + bl CheckBagHasSpace + lsls r0, 24 + cmp r0, 0 + beq _0802C88C +_0802C8A4: + adds r0, r4, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_802C880 + + thumb_func_start sub_802C8AC +sub_802C8AC: @ 802C8AC + push {lr} + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + thumb_func_end sub_802C8AC + + thumb_func_start sub_802C8BC +sub_802C8BC: @ 802C8BC + ldr r0, =gUnknown_02022CFC + ldr r0, [r0] + ldrb r0, [r0, 0x6] + bx lr + .pool + thumb_func_end sub_802C8BC + + thumb_func_start sub_802C8C8 +sub_802C8C8: @ 802C8C8 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gUnknown_02022CFC + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + ldr r0, =0x000082a8 + adds r1, r0 + ldr r0, [r2] + adds r0, r1 + bx lr + .pool + thumb_func_end sub_802C8C8 + + thumb_func_start sub_802C8E8 +sub_802C8E8: @ 802C8E8 + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + ldr r2, =gUnknown_02022CFC + lsls r0, r1, 2 + adds r0, r1 + lsls r0, 3 + ldr r1, [r2] + adds r0, r1 + movs r1, 0x83 + lsls r1, 8 + adds r0, r1 + bx lr + .pool + thumb_func_end sub_802C8E8 + + thumb_func_start sub_802C908 +sub_802C908: @ 802C908 + push {lr} + lsls r0, 16 + lsrs r0, 16 + bl sub_802AC00 + lsls r0, 16 + asrs r0, 16 + mvns r0, r0 + lsrs r0, 31 + pop {r1} + bx r1 + thumb_func_end sub_802C908 + + thumb_func_start sub_802C920 +sub_802C920: @ 802C920 + push {r4,r5,lr} + movs r5, 0 +_0802C924: + movs r0, 0x64 + adds r1, r5, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0x5 + bl GetMonData + cmp r0, 0 + beq _0802C95C + adds r0, r4, 0 + movs r1, 0x41 + bl GetMonData + lsls r0, 16 + lsrs r0, 16 + bl sub_802C908 + cmp r0, 0 + beq _0802C95C + ldr r1, =gScriptResult + movs r0, 0x1 + b _0802C966 + .pool +_0802C95C: + adds r5, 0x1 + cmp r5, 0x5 + ble _0802C924 + ldr r1, =gScriptResult + movs r0, 0 +_0802C966: + strh r0, [r1] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C920 + + thumb_func_start sub_802C974 +sub_802C974: @ 802C974 + push {r4-r6,lr} + adds r6, r0, 0 + movs r4, 0 + ldr r5, =gUnknown_082FBE08 +_0802C97C: + adds r0, r5, 0 + bl LoadCompressedObjectPic + adds r5, 0x8 + adds r4, 0x1 + cmp r4, 0x4 + bls _0802C97C + movs r4, 0 + ldr r5, =gUnknown_082FBE30 +_0802C98E: + adds r0, r5, 0 + bl LoadSpritePalette + adds r5, 0x8 + adds r4, 0x1 + cmp r4, 0x1 + bls _0802C98E + movs r0, 0x5 + bl IndexOfSpritePaletteTag + strb r0, [r6, 0xE] + movs r0, 0x6 + bl IndexOfSpritePaletteTag + strb r0, [r6, 0xF] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C974 + + thumb_func_start sub_802C9BC +sub_802C9BC: @ 802C9BC + push {lr} + movs r2, 0 + movs r1, 0x7 + adds r0, 0x3C +_0802C9C4: + strh r2, [r0] + subs r0, 0x2 + subs r1, 0x1 + cmp r1, 0 + bge _0802C9C4 + pop {r0} + bx r0 + thumb_func_end sub_802C9BC + + thumb_func_start sub_802C9D4 +sub_802C9D4: @ 802C9D4 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x34 + mov r9, r0 + adds r7, r1, 0 + ldr r0, [sp, 0x54] + lsls r2, 16 + lsrs r2, 16 + str r2, [sp, 0x28] + lsls r3, 16 + lsrs r3, 16 + str r3, [sp, 0x2C] + lsls r0, 24 + lsrs r6, r0, 24 + mov r1, sp + ldr r0, =gUnknown_082FBE40 + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + movs r0, 0x80 + lsls r0, 6 + bl Alloc + mov r8, r0 + movs r0, 0x80 + lsls r0, 4 + bl Alloc + mov r10, r0 + bl sub_802C8BC + lsls r0, 16 + lsrs r0, 16 + cmp r6, r0 + bne _0802CA2C + movs r0, 0x3 + b _0802CA32 + .pool +_0802CA2C: + adds r0, r6, 0x4 + lsls r0, 24 + lsrs r0, 24 +_0802CA32: + str r0, [sp, 0x30] + mov r1, r8 + cmp r1, 0 + beq _0802CAF4 + mov r2, r10 + cmp r2, 0 + beq _0802CAF4 + ldrh r2, [r7] + lsls r0, r2, 3 + ldr r1, =gMonStillFrontPicTable + adds r0, r1 + ldr r3, [r7, 0x8] + mov r1, r8 + bl HandleLoadSpecialPokePic + mov r3, r8 + str r3, [sp, 0x18] + adds r4, r6, 0 + add r0, sp, 0x18 + ldr r5, =0xffff0000 + lsls r1, r4, 16 + movs r2, 0x80 + lsls r2, 4 + orrs r1, r2 + str r1, [r0, 0x4] + bl LoadSpriteSheet + ldrh r0, [r7] + ldr r1, [r7, 0x4] + ldr r2, [r7, 0x8] + bl species_and_otid_get_pal + str r0, [sp, 0x20] + add r0, sp, 0x20 + ldr r1, [r0, 0x4] + ands r1, r5 + orrs r1, r4 + str r1, [r0, 0x4] + bl LoadCompressedObjectPalette + mov r0, r8 + bl Free + mov r0, r10 + bl Free + mov r1, sp + mov r0, sp + ldrh r0, [r0] + adds r0, r6 + strh r0, [r1] + mov r0, sp + ldrh r0, [r0, 0x2] + adds r0, r6 + strh r0, [r1, 0x2] + ldr r4, [sp, 0x28] + lsls r1, r4, 16 + asrs r1, 16 + ldr r0, [sp, 0x2C] + lsls r2, r0, 16 + asrs r2, 16 + mov r0, sp + ldr r3, [sp, 0x30] + bl CreateSprite + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x40 + beq _0802CAF4 + lsls r0, r6, 2 + ldr r2, =0x000081a8 + add r2, r9 + adds r2, r0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + str r0, [r2] + ldr r0, =0x000081fc + add r0, r9 + adds r0, r6 + add r1, sp, 0x30 + ldrb r1, [r1] + strb r1, [r0] + b _0802CB00 + .pool +_0802CAF4: + lsls r0, r6, 2 + ldr r1, =0x000081a8 + add r1, r9 + adds r1, r0 + movs r0, 0 + str r0, [r1] +_0802CB00: + add sp, 0x34 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802C9D4 + + thumb_func_start sub_802CB14 +sub_802CB14: @ 802CB14 + push {r4-r6,lr} + adds r4, r0, 0 + lsls r6, r1, 2 + ldr r0, =0x000081bc + adds r5, r4, r0 + adds r5, r6 + ldr r0, [r5] + bl sub_802C9BC + ldr r2, [r5] + ldr r0, =0x000081a8 + adds r4, r0 + adds r4, r6 + ldr r1, [r4] + ldr r0, =gSprites + subs r1, r0 + lsls r0, r1, 4 + subs r0, r1 + lsls r1, r0, 8 + adds r0, r1 + lsls r1, r0, 16 + adds r0, r1 + negs r0, r0 + asrs r0, 2 + strh r0, [r2, 0x3C] + ldr r1, [r5] + adds r1, 0x3E + ldrb r2, [r1] + movs r0, 0x5 + negs r0, r0 + ands r0, r2 + strb r0, [r1] + ldr r1, [r5] + movs r0, 0x60 + strh r0, [r1, 0x22] + ldr r0, [r5] + ldr r1, =sub_802CB7C + str r1, [r0, 0x1C] + movs r1, 0x1 + bl StartSpriteAnim + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CB14 + + thumb_func_start sub_802CB7C +sub_802CB7C: @ 802CB7C + push {lr} + adds r2, r0, 0 + movs r1, 0x2E + ldrsh r0, [r2, r1] + cmp r0, 0x1 + beq _0802CBA8 + cmp r0, 0x1 + bgt _0802CB92 + cmp r0, 0 + beq _0802CB98 + b _0802CBE6 +_0802CB92: + cmp r0, 0x2 + beq _0802CBC8 + b _0802CBE6 +_0802CB98: + adds r0, r2, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _0802CBE6 + b _0802CBD6 +_0802CBA8: + ldrh r1, [r2, 0x22] + subs r1, 0x1 + strh r1, [r2, 0x22] + ldrh r0, [r2, 0x30] + adds r0, 0x1 + strh r0, [r2, 0x30] + lsls r1, 16 + asrs r1, 16 + cmp r1, 0x48 + bgt _0802CBE6 + movs r0, 0x48 + strh r0, [r2, 0x22] + ldrh r0, [r2, 0x2E] + adds r0, 0x1 + strh r0, [r2, 0x2E] + b _0802CBE6 +_0802CBC8: + ldrh r0, [r2, 0x30] + adds r0, 0x1 + strh r0, [r2, 0x30] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x2F + ble _0802CBE6 +_0802CBD6: + adds r3, r2, 0 + adds r3, 0x3E + ldrb r0, [r3] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r3] + ldr r0, =SpriteCallbackDummy + str r0, [r2, 0x1C] +_0802CBE6: + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CB7C + + thumb_func_start sub_802CBF0 +sub_802CBF0: @ 802CBF0 + push {lr} + lsls r1, 2 + ldr r2, =0x000081a8 + adds r0, r2 + adds r0, r1 + ldr r2, [r0] + ldr r1, =sub_802CC40 + str r1, [r2, 0x1C] + movs r1, 0 + strh r1, [r2, 0x26] + ldr r0, [r0] + bl sub_802C9BC + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CBF0 + + thumb_func_start sub_802CC18 +sub_802CC18: @ 802CC18 + push {lr} + movs r2, 0 + lsls r1, 2 + ldr r3, =0x000081a8 + adds r0, r3 + adds r0, r1 + ldr r0, [r0] + ldr r1, [r0, 0x1C] + ldr r0, =sub_802CC40 + cmp r1, r0 + bne _0802CC30 + movs r2, 0x1 +_0802CC30: + adds r0, r2, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_802CC18 + + thumb_func_start sub_802CC40 +sub_802CC40: @ 802CC40 + push {lr} + adds r2, r0, 0 + ldrh r0, [r2, 0x30] + adds r0, 0x1 + strh r0, [r2, 0x30] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x1 + ble _0802CC6C + ldrh r0, [r2, 0x32] + adds r0, 0x1 + strh r0, [r2, 0x32] + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0802CC64 + movs r0, 0x2 + b _0802CC66 +_0802CC64: + ldr r0, =0x0000fffe +_0802CC66: + strh r0, [r2, 0x26] + movs r0, 0 + strh r0, [r2, 0x30] +_0802CC6C: + movs r1, 0x32 + ldrsh r0, [r2, r1] + cmp r0, 0xC + ble _0802CC7C + movs r0, 0 + strh r0, [r2, 0x26] + ldr r0, =SpriteCallbackDummy + str r0, [r2, 0x1C] +_0802CC7C: + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CC40 + + thumb_func_start sub_802CC88 +sub_802CC88: @ 802CC88 + push {r4,lr} + adds r4, r0, 0 + lsls r1, 2 + ldr r0, =0x000081a8 + adds r4, r0 + adds r4, r1 + ldr r0, [r4] + bl sub_802C9BC + ldr r1, [r4] + ldr r0, =sub_802CD08 + str r0, [r1, 0x1C] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CC88 + + thumb_func_start sub_802CCB0 +sub_802CCB0: @ 802CCB0 + push {r4-r7,lr} + adds r4, r0, 0 + bl sub_802C8AC + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0 + beq _0802CCF4 + movs r1, 0x5 + negs r1, r1 + mov r12, r1 + ldr r1, =0x000081a8 + adds r3, r4, r1 + ldr r7, =sub_802CD08 + ldr r6, =SpriteCallbackDummy + movs r5, 0xA + adds r4, r0, 0 +_0802CCD2: + ldr r2, [r3] + ldr r0, [r2, 0x1C] + cmp r0, r7 + bne _0802CCEC + adds r2, 0x3E + ldrb r1, [r2] + mov r0, r12 + ands r0, r1 + strb r0, [r2] + ldr r0, [r3] + str r6, [r0, 0x1C] + adds r0, 0x43 + strb r5, [r0] +_0802CCEC: + adds r3, 0x4 + subs r4, 0x1 + cmp r4, 0 + bne _0802CCD2 +_0802CCF4: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CCB0 + + thumb_func_start sub_802CD08 +sub_802CD08: @ 802CD08 + push {lr} + adds r3, r0, 0 + ldrh r0, [r3, 0x2E] + adds r0, 0x1 + strh r0, [r3, 0x2E] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x3 + ble _0802CD36 + movs r0, 0 + strh r0, [r3, 0x2E] + adds r3, 0x3E + ldrb r2, [r3] + lsls r0, r2, 29 + lsrs r0, 31 + movs r1, 0x1 + eors r1, r0 + lsls r1, 2 + movs r0, 0x5 + negs r0, r0 + ands r0, r2 + orrs r0, r1 + strb r0, [r3] +_0802CD36: + pop {r0} + bx r0 + thumb_func_end sub_802CD08 + + thumb_func_start sub_802CD3C +sub_802CD3C: @ 802CD3C + push {r4,r5,lr} + adds r4, r0, 0 + bl sub_802C8AC + lsls r0, 16 + lsrs r3, r0, 16 + movs r2, 0 + cmp r2, r3 + bge _0802CD66 + ldr r0, =0x000081fc + adds r5, r4, r0 + subs r0, 0x54 + adds r4, r0 +_0802CD56: + ldm r4!, {r0} + adds r1, r5, r2 + ldrb r1, [r1] + adds r0, 0x43 + strb r1, [r0] + adds r2, 0x1 + cmp r2, r3 + blt _0802CD56 +_0802CD66: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CD3C + + thumb_func_start sub_802CD70 +sub_802CD70: @ 802CD70 + push {r4,lr} + adds r4, r0, 0 + lsls r1, 2 + ldr r0, =0x000081a8 + adds r4, r0 + adds r4, r1 + ldr r0, [r4] + bl sub_802C9BC + ldr r1, [r4] + ldr r0, =sub_802CDD4 + str r0, [r1, 0x1C] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CD70 + + thumb_func_start sub_802CD98 +sub_802CD98: @ 802CD98 + push {r4,r5,lr} + adds r4, r0, 0 + bl sub_802C8AC + lsls r0, 16 + lsrs r3, r0, 16 + movs r2, 0 + cmp r2, r3 + bge _0802CDCC + ldr r5, =sub_802CDD4 + ldr r0, =0x000081a8 + adds r1, r4, r0 +_0802CDB0: + ldr r0, [r1] + ldr r0, [r0, 0x1C] + cmp r0, r5 + bne _0802CDC4 + movs r0, 0x1 + b _0802CDCE + .pool +_0802CDC4: + adds r1, 0x4 + adds r2, 0x1 + cmp r2, r3 + blt _0802CDB0 +_0802CDCC: + movs r0, 0 +_0802CDCE: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_802CD98 + + thumb_func_start sub_802CDD4 +sub_802CDD4: @ 802CDD4 + push {r4,r5,lr} + adds r5, r0, 0 + movs r0, 0x2E + ldrsh r4, [r5, r0] + cmp r4, 0 + beq _0802CDE6 + cmp r4, 0x1 + beq _0802CDF4 + b _0802CE3C +_0802CDE6: + movs r0, 0x22 + bl PlaySE + strh r4, [r5, 0x30] + ldrh r0, [r5, 0x2E] + adds r0, 0x1 + strh r0, [r5, 0x2E] +_0802CDF4: + ldrh r0, [r5, 0x30] + adds r0, 0x4 + strh r0, [r5, 0x30] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x7F + ble _0802CE06 + movs r0, 0 + strh r0, [r5, 0x30] +_0802CE06: + ldr r1, =gSineTable + movs r2, 0x30 + ldrsh r0, [r5, r2] + lsls r0, 1 + adds r0, r1 + ldrh r0, [r0] + lsls r0, 16 + asrs r0, 19 + negs r0, r0 + strh r0, [r5, 0x26] + movs r0, 0x30 + ldrsh r1, [r5, r0] + cmp r1, 0 + bne _0802CE3C + ldrh r0, [r5, 0x32] + adds r0, 0x1 + strh r0, [r5, 0x32] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x1 + bgt _0802CE38 + strh r1, [r5, 0x2E] + b _0802CE3C + .pool +_0802CE38: + ldr r0, =SpriteCallbackDummy + str r0, [r5, 0x1C] +_0802CE3C: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CDD4 + + thumb_func_start sub_802CE48 +sub_802CE48: @ 802CE48 + push {r4,r5,lr} + adds r5, r0, 0 + lsls r3, 24 + lsrs r4, r3, 24 + ldr r0, =gUnknown_082FC00C + lsls r1, 16 + asrs r1, 16 + lsls r2, 16 + asrs r2, 16 + movs r3, 0x1 + bl CreateSprite + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x40 + beq _0802CE88 + ldr r0, =gSprites + lsls r1, r2, 4 + adds r1, r2 + lsls r1, 2 + adds r1, r0 + adds r3, r1, 0 + adds r3, 0x3E + ldrb r0, [r3] + movs r2, 0x4 + orrs r0, r2 + strb r0, [r3] + lsls r2, r4, 2 + ldr r3, =0x000081bc + adds r0, r5, r3 + adds r0, r2 + str r1, [r0] +_0802CE88: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CE48 + + thumb_func_start sub_802CE9C +sub_802CE9C: @ 802CE9C + push {r4-r7,lr} + adds r7, r0, 0 + movs r5, 0 + movs r4, 0 + ldr r6, =gUnknown_082FBE58 +_0802CEA6: + ldr r1, =gUnknown_082FBEB8 + lsls r0, r4, 2 + adds r0, r1 + ldr r0, [r0] + ldr r2, =gUnknown_082FBEA8 + lsls r1, r5, 1 + adds r1, r2 + movs r2, 0 + ldrsh r1, [r1, r2] + movs r3, 0 + ldrsh r2, [r6, r3] + movs r3, 0x2 + bl CreateSprite + lsls r0, 24 + lsrs r1, r0, 24 + lsls r0, r5, 2 + ldr r3, =0x000081d0 + adds r2, r7, r3 + adds r2, r0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + str r0, [r2] + adds r5, 0x1 + adds r6, 0x14 + adds r4, 0x1 + cmp r4, 0x3 + ble _0802CEA6 + movs r4, 0x3 + movs r6, 0x3C +_0802CEE8: + ldr r1, =gUnknown_082FBEB8 + lsls r0, r4, 2 + adds r0, r1 + ldr r0, [r0] + ldr r2, =gUnknown_082FBEA8 + lsls r1, r5, 1 + adds r1, r2 + movs r2, 0 + ldrsh r1, [r1, r2] + ldr r2, =gUnknown_082FBE58 + adds r2, r6, r2 + movs r3, 0 + ldrsh r2, [r2, r3] + movs r3, 0x2 + bl CreateSprite + lsls r0, 24 + lsrs r1, r0, 24 + lsls r0, r5, 2 + ldr r3, =0x000081d0 + adds r2, r7, r3 + adds r2, r0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + str r0, [r2] + adds r0, 0x3F + ldrb r1, [r0] + movs r2, 0x1 + orrs r1, r2 + strb r1, [r0] + adds r5, 0x1 + subs r6, 0x14 + subs r4, 0x1 + cmp r4, 0 + bge _0802CEE8 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CE9C + + thumb_func_start sub_802CF50 +sub_802CF50: @ 802CF50 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0xC + str r0, [sp, 0x8] + cmp r1, 0x5 + ble _0802CF70 + movs r0, 0xA + subs r1, r0, r1 + movs r0, 0x3 + str r0, [sp] + ldr r2, [sp, 0x8] + ldrb r0, [r2, 0xF] + b _0802CF78 +_0802CF70: + movs r3, 0x2 + str r3, [sp] + ldr r7, [sp, 0x8] + ldrb r0, [r7, 0xE] +_0802CF78: + movs r6, 0 + lsls r2, r1, 1 + str r2, [sp, 0x4] + lsls r0, 4 + mov r9, r0 + lsls r1, 24 + mov r8, r1 + ldr r0, =gUnknown_082FBE58 + adds r4, r2, r0 + ldr r3, [sp] + lsls r3, 2 + mov r10, r3 + movs r5, 0x3 +_0802CF92: + lsls r0, r6, 2 + ldr r7, [sp, 0x8] + ldr r1, =0x000081d0 + adds r2, r7, r1 + adds r2, r0 + ldr r1, [r2] + ldrh r0, [r4] + strh r0, [r1, 0x22] + ldr r3, [r2] + ldrb r0, [r3, 0x5] + movs r7, 0xD + negs r7, r7 + adds r1, r7, 0 + ands r0, r1 + mov r1, r10 + orrs r0, r1 + strb r0, [r3, 0x5] + ldr r3, [r2] + ldrb r1, [r3, 0x5] + movs r0, 0xF + ands r0, r1 + mov r7, r9 + orrs r0, r7 + strb r0, [r3, 0x5] + ldr r0, [r2] + mov r2, r8 + lsrs r1, r2, 24 + bl StartSpriteAnim + adds r6, 0x1 + adds r4, 0x14 + subs r5, 0x1 + cmp r5, 0 + bge _0802CF92 + movs r5, 0x3 + ldr r0, =gUnknown_082FBE58 + ldr r3, [sp, 0x4] + adds r0, r3, r0 + adds r4, r0, 0 + adds r4, 0x3C + ldr r7, [sp] + lsls r7, 2 + mov r10, r7 +_0802CFE8: + lsls r0, r6, 2 + ldr r1, [sp, 0x8] + ldr r3, =0x000081d0 + adds r2, r1, r3 + adds r2, r0 + ldr r1, [r2] + ldrh r0, [r4] + strh r0, [r1, 0x22] + ldr r3, [r2] + ldrb r0, [r3, 0x5] + movs r7, 0xD + negs r7, r7 + adds r1, r7, 0 + ands r0, r1 + mov r1, r10 + orrs r0, r1 + strb r0, [r3, 0x5] + ldr r3, [r2] + ldrb r1, [r3, 0x5] + movs r0, 0xF + ands r0, r1 + mov r7, r9 + orrs r0, r7 + strb r0, [r3, 0x5] + ldr r0, [r2] + mov r2, r8 + lsrs r1, r2, 24 + bl StartSpriteAnim + adds r6, 0x1 + subs r4, 0x14 + subs r5, 0x1 + cmp r5, 0 + bge _0802CFE8 + add sp, 0xC + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802CF50 + + thumb_func_start sub_802D044 +sub_802D044: @ 802D044 + push {r4,lr} + sub sp, 0x4 + adds r4, r0, 0 + movs r0, 0 + str r0, [sp] + movs r0, 0x9 + movs r1, 0x7 + movs r2, 0x78 + movs r3, 0x50 + bl sub_802EB24 + adds r0, r4, 0 + bl sub_802CD3C + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_802D044 + + thumb_func_start sub_802D068 +sub_802D068: @ 802D068 + push {lr} + bl sub_802EB84 + pop {r1} + bx r1 + thumb_func_end sub_802D068 + + thumb_func_start sub_802D074 +sub_802D074: @ 802D074 + push {r4,lr} + ldr r4, =gUnknown_02022D00 + str r0, [r4] + bl sub_802D0BC + ldr r0, =sub_802D12C + movs r1, 0x3 + bl CreateTask + ldr r1, [r4] + strb r0, [r1, 0x6] + ldr r2, [r4] + ldrb r0, [r2, 0x6] + movs r1, 0x2 + bl SetWordTaskArg + ldr r0, =sub_802D150 + bl sub_802D108 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D074 + + thumb_func_start sub_802D0AC +sub_802D0AC: @ 802D0AC + push {lr} + bl FreeAllWindowBuffers + bl sub_8034CC8 + pop {r0} + bx r0 + thumb_func_end sub_802D0AC + + thumb_func_start sub_802D0BC +sub_802D0BC: @ 802D0BC + movs r1, 0 + strh r1, [r0, 0x4] + str r1, [r0] + movs r1, 0xFF + strh r1, [r0, 0x12] + bx lr + thumb_func_end sub_802D0BC + + thumb_func_start sub_802D0C8 +sub_802D0C8: @ 802D0C8 + push {r4-r6,lr} + adds r6, r0, 0 + movs r5, 0 + ldr r4, =gUnknown_082FE18C +_0802D0D0: + ldr r0, [r4] + cmp r0, r6 + bne _0802D0DC + ldr r0, [r4, 0x4] + bl sub_802D108 +_0802D0DC: + adds r4, 0x8 + adds r5, 0x1 + cmp r5, 0x9 + bls _0802D0D0 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D0C8 + + thumb_func_start sub_802D0F0 +sub_802D0F0: @ 802D0F0 + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + ldr r1, [r0] + movs r0, 0x1 + eors r1, r0 + negs r0, r1 + orrs r0, r1 + lsrs r0, 31 + bx lr + .pool + thumb_func_end sub_802D0F0 + + thumb_func_start sub_802D108 +sub_802D108: @ 802D108 + push {r4,lr} + adds r2, r0, 0 + ldr r4, =gUnknown_02022D00 + ldr r0, [r4] + ldrb r0, [r0, 0x6] + movs r1, 0 + bl SetWordTaskArg + ldr r1, [r4] + movs r0, 0 + strh r0, [r1, 0x4] + str r0, [r1] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D108 + + thumb_func_start sub_802D12C +sub_802D12C: @ 802D12C + push {lr} + lsls r0, 24 + lsrs r1, r0, 24 + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + ldr r0, [r0] + cmp r0, 0 + bne _0802D148 + adds r0, r1, 0 + movs r1, 0 + bl GetWordTaskArg + bl _call_via_r0 +_0802D148: + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D12C + + thumb_func_start sub_802D150 +sub_802D150: @ 802D150 + push {r4-r6,lr} + sub sp, 0x8 + ldr r6, =gUnknown_02022D00 + ldr r1, [r6] + ldrh r5, [r1, 0x4] + cmp r5, 0x1 + bne _0802D160 + b _0802D298 +_0802D160: + cmp r5, 0x1 + bgt _0802D170 + cmp r5, 0 + beq _0802D178 + b _0802D2DA + .pool +_0802D170: + cmp r5, 0x2 + bne _0802D176 + b _0802D2D6 +_0802D176: + b _0802D2DA +_0802D178: + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_082FE164 + movs r0, 0 + movs r2, 0x4 + bl InitBgsFromTemplates + ldr r0, =gUnknown_082FE174 + bl InitWindows + bl reset_temp_tile_data_buffers + ldr r0, [r6] + bl sub_802C974 + bl sub_802DD08 + ldr r0, =gPkmnJumpBgPal + movs r1, 0 + movs r2, 0x20 + bl LoadPalette + ldr r1, =gPkmnJumpBgGfx + str r5, [sp] + movs r0, 0x3 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + ldr r1, =gPkmnJumpBgTilemap + movs r4, 0x1 + str r4, [sp] + movs r0, 0x3 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + ldr r0, =gPkmnJumpVenusaurPal + movs r1, 0x30 + movs r2, 0x20 + bl LoadPalette + ldr r1, =gPkmnJumpVenusaurGfx + str r5, [sp] + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + ldr r1, =gPkmnJumpVenusaurTilemap + str r4, [sp] + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + ldr r0, =gPkmnJumpResultsPal + movs r1, 0x10 + movs r2, 0x20 + bl LoadPalette + ldr r1, =gPkmnJumpResultsGfx + str r5, [sp] + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + ldr r1, =gPkmnJumpResultsTilemap + str r4, [sp] + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + ldr r0, =gPkmnJumpPal3 + movs r1, 0x20 + movs r2, 0x20 + bl LoadPalette + ldr r1, [r6] + movs r0, 0xD3 + lsls r0, 1 + adds r1, r0 + movs r0, 0 + bl SetBgTilemapBuffer + movs r0, 0x20 + str r0, [sp] + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + bl sub_802DB8C + movs r0, 0 + bl sub_802DD64 + movs r0, 0 + movs r1, 0x1 + movs r2, 0xE0 + bl sub_8098C6C + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + bl sub_8199D98 + b _0802D2CC + .pool +_0802D298: + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + cmp r0, 0 + bne _0802D2DA + bl sub_802DBF8 + ldr r0, [r6] + bl sub_802CE9C + ldr r0, [r6] + movs r1, 0x6 + bl sub_802CF50 + movs r0, 0x3 + bl ShowBg + movs r0, 0 + bl ShowBg + movs r0, 0x2 + bl ShowBg + movs r0, 0x1 + bl HideBg +_0802D2CC: + ldr r1, [r6] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D2DA +_0802D2D6: + movs r0, 0x1 + str r0, [r1] +_0802D2DA: + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_802D150 + + thumb_func_start sub_802D2E4 +sub_802D2E4: @ 802D2E4 + push {r4,lr} + ldr r4, =gUnknown_02022D00 + ldr r0, [r4] + ldrh r0, [r0, 0x4] + cmp r0, 0x1 + beq _0802D310 + cmp r0, 0x1 + bgt _0802D300 + cmp r0, 0 + beq _0802D30A + b _0802D34A + .pool +_0802D300: + cmp r0, 0x2 + beq _0802D322 + cmp r0, 0x3 + beq _0802D33A + b _0802D34A +_0802D30A: + bl sub_802DE1C + b _0802D330 +_0802D310: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D34A + movs r0, 0 + bl sub_802DF70 + b _0802D330 +_0802D322: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D34A + bl sub_802DFD4 +_0802D330: + ldr r1, [r4] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D34A +_0802D33A: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D34A + ldr r1, [r4] + movs r0, 0x1 + str r0, [r1] +_0802D34A: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_802D2E4 + + thumb_func_start sub_802D350 +sub_802D350: @ 802D350 + push {r4,lr} + ldr r4, =gUnknown_02022D00 + ldr r0, [r4] + ldrh r0, [r0, 0x4] + cmp r0, 0x1 + beq _0802D37C + cmp r0, 0x1 + bgt _0802D36C + cmp r0, 0 + beq _0802D376 + b _0802D3B6 + .pool +_0802D36C: + cmp r0, 0x2 + beq _0802D38E + cmp r0, 0x3 + beq _0802D3A6 + b _0802D3B6 +_0802D376: + bl sub_802DE1C + b _0802D39C +_0802D37C: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D3B6 + movs r0, 0x1 + bl sub_802DF70 + b _0802D39C +_0802D38E: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D3B6 + bl sub_802DFD4 +_0802D39C: + ldr r1, [r4] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D3B6 +_0802D3A6: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D3B6 + ldr r1, [r4] + movs r0, 0x1 + str r0, [r1] +_0802D3B6: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_802D350 + + thumb_func_start sub_802D3BC +sub_802D3BC: @ 802D3BC + push {r4,r5,lr} + bl sub_802C8AC + lsls r0, 16 + lsrs r5, r0, 16 + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + ldrh r0, [r0, 0x4] + cmp r0, 0 + beq _0802D3DC + cmp r0, 0x1 + beq _0802D410 + b _0802D43E + .pool +_0802D3DC: + movs r4, 0 + cmp r4, r5 + bge _0802D3F8 +_0802D3E2: + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + lsls r1, r4, 1 + adds r0, 0x1C + adds r0, r1 + ldrb r0, [r0] + bl ClearWindowTilemap + adds r4, 0x1 + cmp r4, r5 + blt _0802D3E2 +_0802D3F8: + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r0, =gUnknown_02022D00 + ldr r1, [r0] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D43E + .pool +_0802D410: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D43E + movs r4, 0 + cmp r4, r5 + bge _0802D436 +_0802D420: + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + lsls r1, r4, 1 + adds r0, 0x1C + adds r0, r1 + ldrb r0, [r0] + bl RemoveWindow + adds r4, 0x1 + cmp r4, r5 + blt _0802D420 +_0802D436: + ldr r0, =gUnknown_02022D00 + ldr r1, [r0] + movs r0, 0x1 + str r0, [r1] +_0802D43E: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D3BC + + thumb_func_start sub_802D448 +sub_802D448: @ 802D448 + push {r4,r5,lr} + sub sp, 0xC + ldr r5, =gUnknown_02022D00 + ldr r0, [r5] + ldrh r4, [r0, 0x4] + cmp r4, 0x1 + beq _0802D4A4 + cmp r4, 0x1 + bgt _0802D464 + cmp r4, 0 + beq _0802D46A + b _0802D4EC + .pool +_0802D464: + cmp r4, 0x2 + beq _0802D4DC + b _0802D4EC +_0802D46A: + movs r0, 0x1 + movs r1, 0x8 + movs r2, 0x14 + movs r3, 0x2 + bl sub_802DA9C + ldr r1, [r5] + strh r0, [r1, 0x12] + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gText_WantToPlayAgain2 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x2 + bl CopyWindowToVram + b _0802D4D2 + .pool +_0802D4A4: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D4EC + ldr r0, [r5] + ldrb r0, [r0, 0x12] + bl PutWindowTilemap + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x1 + movs r2, 0xE + bl sub_8098858 + movs r0, 0x17 + movs r1, 0x7 + movs r2, 0 + bl sub_802DB18 + movs r0, 0 + bl CopyBgTilemapBufferToVram +_0802D4D2: + ldr r1, [r5] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D4EC +_0802D4DC: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D4EC + ldr r1, [r5] + movs r0, 0x1 + str r0, [r1] +_0802D4EC: + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802D448 + + thumb_func_start sub_802D4F4 +sub_802D4F4: @ 802D4F4 + push {r4,r5,lr} + sub sp, 0xC + ldr r5, =gUnknown_02022D00 + ldr r0, [r5] + ldrh r4, [r0, 0x4] + cmp r4, 0x1 + beq _0802D550 + cmp r4, 0x1 + bgt _0802D510 + cmp r4, 0 + beq _0802D516 + b _0802D58E + .pool +_0802D510: + cmp r4, 0x2 + beq _0802D57E + b _0802D58E +_0802D516: + movs r0, 0x2 + movs r1, 0x7 + movs r2, 0x1A + movs r3, 0x4 + bl sub_802DA9C + ldr r1, [r5] + strh r0, [r1, 0x12] + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gUnknown_082C8959 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x2 + bl CopyWindowToVram + b _0802D574 + .pool +_0802D550: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D58E + ldr r0, [r5] + ldrb r0, [r0, 0x12] + bl PutWindowTilemap + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x1 + movs r2, 0xE + bl sub_8098858 + movs r0, 0 + bl CopyBgTilemapBufferToVram +_0802D574: + ldr r1, [r5] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D58E +_0802D57E: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D58E + ldr r1, [r5] + movs r0, 0x1 + str r0, [r1] +_0802D58E: + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802D4F4 + + thumb_func_start sub_802D598 +sub_802D598: @ 802D598 + push {r4,r5,lr} + ldr r5, =gUnknown_02022D00 + ldr r0, [r5] + ldrh r4, [r0, 0x4] + cmp r4, 0 + beq _0802D5B0 + cmp r4, 0x1 + beq _0802D5C8 + b _0802D5DE + .pool +_0802D5B0: + bl sub_802DA14 + bl sub_8198C78 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r1, [r5] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D5DE +_0802D5C8: + bl sub_802DA44 + cmp r0, 0 + bne _0802D5DE + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D5DE + ldr r0, [r5] + str r4, [r0] +_0802D5DE: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802D598 + + thumb_func_start sub_802D5E4 +sub_802D5E4: @ 802D5E4 + push {r4,r5,lr} + sub sp, 0xC + ldr r5, =gUnknown_02022D00 + ldr r0, [r5] + ldrh r4, [r0, 0x4] + cmp r4, 0x1 + beq _0802D640 + cmp r4, 0x1 + bgt _0802D600 + cmp r4, 0 + beq _0802D606 + b _0802D67E + .pool +_0802D600: + cmp r4, 0x2 + beq _0802D66E + b _0802D67E +_0802D606: + movs r0, 0x2 + movs r1, 0x8 + movs r2, 0x16 + movs r3, 0x4 + bl sub_802DA9C + ldr r1, [r5] + strh r0, [r1, 0x12] + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gText_SomeoneDroppedOut2 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x2 + bl CopyWindowToVram + b _0802D664 + .pool +_0802D640: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D67E + ldr r0, [r5] + ldrb r0, [r0, 0x12] + bl PutWindowTilemap + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x1 + movs r2, 0xE + bl sub_8098858 + movs r0, 0 + bl CopyBgTilemapBufferToVram +_0802D664: + ldr r1, [r5] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D67E +_0802D66E: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D67E + ldr r1, [r5] + movs r0, 0x1 + str r0, [r1] +_0802D67E: + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802D5E4 + + thumb_func_start sub_802D688 +sub_802D688: @ 802D688 + push {r4,r5,lr} + sub sp, 0xC + ldr r5, =gUnknown_02022D00 + ldr r0, [r5] + ldrh r4, [r0, 0x4] + cmp r4, 0x1 + beq _0802D6E4 + cmp r4, 0x1 + bgt _0802D6A4 + cmp r4, 0 + beq _0802D6AA + b _0802D722 + .pool +_0802D6A4: + cmp r4, 0x2 + beq _0802D712 + b _0802D722 +_0802D6AA: + movs r0, 0x7 + movs r1, 0xA + movs r2, 0x10 + movs r3, 0x2 + bl sub_802DA9C + ldr r1, [r5] + strh r0, [r1, 0x12] + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gText_CommunicationStandby4 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x2 + bl CopyWindowToVram + b _0802D708 + .pool +_0802D6E4: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D722 + ldr r0, [r5] + ldrb r0, [r0, 0x12] + bl PutWindowTilemap + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x1 + movs r2, 0xE + bl sub_8098858 + movs r0, 0 + bl CopyBgTilemapBufferToVram +_0802D708: + ldr r1, [r5] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D722 +_0802D712: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802D722 + ldr r1, [r5] + movs r0, 0x1 + str r0, [r1] +_0802D722: + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802D688 + + thumb_func_start sub_802D72C +sub_802D72C: @ 802D72C + push {r4,r5,lr} + ldr r5, =gUnknown_02022D00 + ldr r0, [r5] + ldrh r4, [r0, 0x4] + cmp r4, 0 + beq _0802D744 + cmp r4, 0x1 + beq _0802D752 + b _0802D75E + .pool +_0802D744: + bl sub_802D044 + ldr r1, [r5] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] + b _0802D75E +_0802D752: + bl sub_802D068 + cmp r0, 0 + bne _0802D75E + ldr r0, [r5] + str r4, [r0] +_0802D75E: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802D72C + + thumb_func_start sub_802D764 +sub_802D764: @ 802D764 + push {lr} + ldr r1, =gUnknown_02022D00 + ldr r0, [r1] + movs r2, 0 + strb r2, [r0, 0xA] + ldr r0, [r1] + strb r2, [r0, 0xB] + ldr r2, [r1] + movs r0, 0x6 + strb r0, [r2, 0xC] + ldr r0, [r1] + ldrb r0, [r0, 0xC] + bl sub_802DC9C + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D764 + + thumb_func_start sub_802D788 +sub_802D788: @ 802D788 + push {r4,lr} + ldr r0, =gUnknown_02022D00 + ldr r2, [r0] + ldrb r3, [r2, 0xA] + adds r4, r0, 0 + cmp r3, 0 + beq _0802D7A0 + cmp r3, 0x1 + beq _0802D7DA + b _0802D7DE + .pool +_0802D7A0: + ldrb r0, [r2, 0xB] + adds r0, 0x1 + strb r0, [r2, 0xB] + ldr r1, [r4] + ldrb r0, [r1, 0xB] + cmp r0, 0xA + bls _0802D7CA + strb r3, [r1, 0xB] + ldr r0, [r4] + ldrb r1, [r0, 0xC] + adds r1, 0x1 + strb r1, [r0, 0xC] + ldr r1, [r4] + ldrb r0, [r1, 0xC] + cmp r0, 0x9 + bls _0802D7CA + strb r3, [r1, 0xC] + ldr r1, [r4] + ldrb r0, [r1, 0xA] + adds r0, 0x1 + strb r0, [r1, 0xA] +_0802D7CA: + ldr r0, [r4] + ldrb r0, [r0, 0xC] + bl sub_802DC9C + ldr r0, [r4] + ldrb r0, [r0, 0xC] + cmp r0, 0x7 + bne _0802D7DE +_0802D7DA: + movs r0, 0 + b _0802D7E0 +_0802D7DE: + movs r0, 0x1 +_0802D7E0: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802D788 + + thumb_func_start sub_802D7E8 +sub_802D7E8: @ 802D7E8 + push {r4,r5,lr} + sub sp, 0xC + adds r4, r1, 0 + lsls r0, 16 + lsrs r0, 16 + lsls r4, 16 + lsrs r4, 16 + ldr r5, =gUnknown_02022D00 + ldr r1, [r5] + adds r1, 0x26 + adds r2, r4, 0 + bl CopyItemNameHandlePlural + ldr r0, [r5] + adds r0, 0x66 + adds r1, r4, 0 + movs r2, 0 + movs r3, 0x1 + bl ConvertIntToDecimalStringN + bl sub_81AFBF0 + ldr r1, [r5] + adds r1, 0x26 + movs r0, 0 + bl sub_81AFC0C + ldr r1, [r5] + adds r1, 0x66 + movs r0, 0x1 + bl sub_81AFC0C + ldr r0, [r5] + adds r0, 0xA6 + ldr r1, =gText_AwesomeWonF701F700 + bl sub_81AFC28 + movs r0, 0x4 + movs r1, 0x8 + movs r2, 0x16 + movs r3, 0x4 + bl sub_802DA9C + ldr r2, [r5] + movs r4, 0 + movs r3, 0 + strh r0, [r2, 0x12] + lsls r0, 24 + lsrs r0, 24 + adds r2, 0xA6 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + str r3, [sp, 0x8] + movs r1, 0x1 + bl PrintTextOnWindow + ldr r0, [r5] + ldrb r0, [r0, 0x12] + movs r1, 0x2 + bl CopyWindowToVram + ldr r1, [r5] + ldr r0, =0x0000016f + strh r0, [r1, 0x14] + strb r4, [r1, 0xD] + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D7E8 + + thumb_func_start sub_802D884 +sub_802D884: @ 802D884 + push {r4-r6,lr} + sub sp, 0xC + lsls r0, 16 + lsrs r0, 16 + ldr r4, =gUnknown_02022D00 + ldr r1, [r4] + adds r1, 0x26 + bl CopyItemName + bl sub_81AFBF0 + ldr r1, [r4] + adds r1, 0x26 + movs r0, 0 + bl sub_81AFC0C + ldr r0, [r4] + adds r0, 0xA6 + ldr r1, =gText_FilledStorageSpace2 + bl sub_81AFC28 + movs r0, 0x4 + movs r1, 0x8 + movs r2, 0x16 + movs r3, 0x4 + bl sub_802DA9C + ldr r2, [r4] + movs r6, 0 + movs r5, 0 + strh r0, [r2, 0x12] + lsls r0, 24 + lsrs r0, 24 + adds r2, 0xA6 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + str r5, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r4] + ldrb r0, [r0, 0x12] + movs r1, 0x2 + bl CopyWindowToVram + ldr r0, [r4] + strh r5, [r0, 0x14] + strb r6, [r0, 0xD] + add sp, 0xC + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D884 + + thumb_func_start sub_802D8FC +sub_802D8FC: @ 802D8FC + push {r4-r6,lr} + sub sp, 0xC + lsls r0, 16 + lsrs r0, 16 + ldr r4, =gUnknown_02022D00 + ldr r1, [r4] + adds r1, 0x26 + bl CopyItemName + bl sub_81AFBF0 + ldr r1, [r4] + adds r1, 0x26 + movs r0, 0 + bl sub_81AFC0C + ldr r0, [r4] + adds r0, 0xA6 + ldr r1, =gText_CantHoldMore + bl sub_81AFC28 + movs r0, 0x4 + movs r1, 0x9 + movs r2, 0x16 + movs r3, 0x2 + bl sub_802DA9C + ldr r2, [r4] + movs r6, 0 + movs r5, 0 + strh r0, [r2, 0x12] + lsls r0, 24 + lsrs r0, 24 + adds r2, 0xA6 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + str r1, [sp, 0x4] + str r5, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [r4] + ldrb r0, [r0, 0x12] + movs r1, 0x2 + bl CopyWindowToVram + ldr r0, [r4] + strh r5, [r0, 0x14] + strb r6, [r0, 0xD] + add sp, 0xC + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802D8FC + + thumb_func_start sub_802D974 +sub_802D974: @ 802D974 + push {r4,lr} + ldr r4, =gUnknown_02022D00 + ldr r0, [r4] + ldrb r0, [r0, 0xD] + cmp r0, 0x1 + beq _0802D9C8 + cmp r0, 0x1 + bgt _0802D990 + cmp r0, 0 + beq _0802D99A + b _0802DA0C + .pool +_0802D990: + cmp r0, 0x2 + beq _0802D9EE + cmp r0, 0x3 + beq _0802DA02 + b _0802DA0C +_0802D99A: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802DA0C + ldr r0, [r4] + ldrb r0, [r0, 0x12] + bl PutWindowTilemap + ldr r0, [r4] + ldrb r0, [r0, 0x12] + movs r1, 0x1 + movs r2, 0xE + bl sub_8098858 + movs r0, 0 + bl CopyBgTilemapBufferToVram + ldr r1, [r4] + ldrb r0, [r1, 0xD] + adds r0, 0x1 + strb r0, [r1, 0xD] + b _0802DA0C +_0802D9C8: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802DA0C + ldr r1, [r4] + ldrh r0, [r1, 0x14] + cmp r0, 0 + bne _0802D9E0 + ldrb r0, [r1, 0xD] + adds r0, 0x2 + b _0802DA00 +_0802D9E0: + ldrh r0, [r1, 0x14] + bl PlayFanfare + ldr r1, [r4] + ldrb r0, [r1, 0xD] + adds r0, 0x1 + strb r0, [r1, 0xD] +_0802D9EE: + bl IsFanfareTaskInactive + lsls r0, 24 + cmp r0, 0 + beq _0802DA0C + ldr r0, =gUnknown_02022D00 + ldr r1, [r0] + ldrb r0, [r1, 0xD] + adds r0, 0x1 +_0802DA00: + strb r0, [r1, 0xD] +_0802DA02: + movs r0, 0 + b _0802DA0E + .pool +_0802DA0C: + movs r0, 0x1 +_0802DA0E: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802D974 + + thumb_func_start sub_802DA14 +sub_802DA14: @ 802DA14 + push {r4,lr} + ldr r4, =gUnknown_02022D00 + ldr r0, [r4] + ldrh r0, [r0, 0x12] + cmp r0, 0xFF + beq _0802DA38 + lsls r0, 24 + lsrs r0, 24 + bl rbox_fill_rectangle + ldr r0, [r4] + ldrb r0, [r0, 0x12] + movs r1, 0x1 + bl CopyWindowToVram + ldr r1, [r4] + movs r0, 0 + strb r0, [r1, 0xD] +_0802DA38: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DA14 + + thumb_func_start sub_802DA44 +sub_802DA44: @ 802DA44 + push {r4,lr} + ldr r4, =gUnknown_02022D00 + ldr r1, [r4] + ldrh r0, [r1, 0x12] + cmp r0, 0xFF + bne _0802DA58 +_0802DA50: + movs r0, 0 + b _0802DA84 + .pool +_0802DA58: + ldrb r0, [r1, 0xD] + cmp r0, 0 + bne _0802DA7E + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802DA82 + ldr r0, [r4] + ldrb r0, [r0, 0x12] + bl RemoveWindow + ldr r1, [r4] + movs r0, 0xFF + strh r0, [r1, 0x12] + ldrb r0, [r1, 0xD] + adds r0, 0x1 + strb r0, [r1, 0xD] + b _0802DA50 +_0802DA7E: + cmp r0, 0x1 + beq _0802DA50 +_0802DA82: + movs r0, 0x1 +_0802DA84: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802DA44 + + thumb_func_start sub_802DA8C +sub_802DA8C: @ 802DA8C + push {lr} + bl sub_8198C58 + lsls r0, 24 + asrs r0, 24 + pop {r1} + bx r1 + thumb_func_end sub_802DA8C + + thumb_func_start sub_802DA9C +sub_802DA9C: @ 802DA9C + push {r4-r6,lr} + sub sp, 0x8 + ldr r6, =0xffffff00 + ldr r4, [sp] + ands r4, r6 + lsls r0, 24 + lsrs r0, 16 + ldr r5, =0xffff00ff + ands r4, r5 + orrs r4, r0 + lsls r1, 24 + lsrs r1, 8 + ldr r0, =0xff00ffff + ands r4, r0 + orrs r4, r1 + lsls r2, 24 + ldr r0, =0x00ffffff + ands r4, r0 + orrs r4, r2 + str r4, [sp] + lsls r3, 24 + lsrs r3, 24 + ldr r0, [sp, 0x4] + ands r0, r6 + orrs r0, r3 + ands r0, r5 + movs r1, 0xF0 + lsls r1, 4 + orrs r0, r1 + ldr r1, =0x0000ffff + ands r0, r1 + movs r1, 0x86 + lsls r1, 15 + orrs r0, r1 + str r0, [sp, 0x4] + mov r0, sp + bl AddWindow + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + lsls r0, r4, 24 + lsrs r0, 24 + movs r1, 0x11 + bl FillWindowPixelBuffer + adds r0, r4, 0 + add sp, 0x8 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802DA9C + + thumb_func_start sub_802DB18 +sub_802DB18: @ 802DB18 + push {r4,r5,lr} + sub sp, 0x8 + adds r3, r2, 0 + lsls r3, 24 + lsrs r3, 24 + ldr r5, =0xffffff00 + ldr r2, [sp] + ands r2, r5 + lsls r0, 24 + lsrs r0, 16 + ldr r4, =0xffff00ff + ands r2, r4 + orrs r2, r0 + lsls r1, 24 + lsrs r1, 8 + ldr r0, =0xff00ffff + ands r2, r0 + orrs r2, r1 + ldr r0, =0x00ffffff + ands r2, r0 + movs r0, 0xC0 + lsls r0, 19 + orrs r2, r0 + str r2, [sp] + ldr r0, [sp, 0x4] + ands r0, r5 + movs r1, 0x4 + orrs r0, r1 + ands r0, r4 + movs r1, 0x80 + lsls r1, 2 + orrs r0, r1 + ldr r1, =0x0000ffff + ands r0, r1 + movs r1, 0xAC + lsls r1, 14 + orrs r0, r1 + str r0, [sp, 0x4] + mov r0, sp + movs r1, 0x1 + movs r2, 0xD + bl CreateYesNoMenu + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DB18 + + thumb_func_start sub_802DB8C +sub_802DB8C: @ 802DB8C + push {r4,lr} + sub sp, 0x10 + ldr r1, =gUnknown_082FE1DC + add r0, sp, 0xC + movs r2, 0x3 + bl memcpy + movs r0, 0 + bl PutWindowTilemap + movs r0, 0x1 + bl PutWindowTilemap + movs r0, 0 + movs r1, 0 + bl FillWindowPixelBuffer + movs r0, 0x1 + movs r1, 0 + bl FillWindowPixelBuffer + add r0, sp, 0xC + str r0, [sp] + movs r4, 0 + str r4, [sp, 0x4] + ldr r0, =gText_SpacePoints2 + str r0, [sp, 0x8] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0x1 + bl box_print + add r0, sp, 0xC + str r0, [sp] + str r4, [sp, 0x4] + ldr r0, =gText_SpaceTimes3 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0x1 + bl box_print + add sp, 0x10 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DB8C + + thumb_func_start sub_802DBF8 +sub_802DBF8: @ 802DBF8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + bl sub_802C8AC + lsls r0, 16 + lsrs r0, 16 + mov r10, r0 + ldr r1, =gUnknown_082FE260 + subs r0, 0x2 + lsls r0, 2 + adds r0, r1 + ldr r5, [r0] + movs r6, 0 + cmp r6, r10 + bge _0802DC62 + ldr r0, =gMonFrontPicCoords + mov r9, r0 + ldr r1, =gUnknown_02022D00 + mov r8, r1 +_0802DC26: + lsls r4, r6, 24 + lsrs r4, 24 + adds r0, r4, 0 + bl sub_802C8C8 + adds r1, r0, 0 + ldrh r0, [r1] + lsls r0, 2 + add r0, r9 + ldrb r3, [r0, 0x1] + mov r2, r8 + ldr r0, [r2] + movs r7, 0 + ldrsh r2, [r5, r7] + adds r3, 0x70 + str r4, [sp] + bl sub_802C9D4 + mov r1, r8 + ldr r0, [r1] + movs r2, 0 + ldrsh r1, [r5, r2] + movs r2, 0x70 + adds r3, r4, 0 + bl sub_802CE48 + adds r5, 0x2 + adds r6, 0x1 + cmp r6, r10 + blt _0802DC26 +_0802DC62: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DBF8 + + thumb_func_start sub_802DC80 +sub_802DC80: @ 802DC80 + ldr r2, =gUnknown_02022D00 + ldr r2, [r2] + lsls r0, 2 + ldr r3, =0x000081a8 + adds r2, r3 + adds r2, r0 + ldr r0, [r2] + strh r1, [r0, 0x26] + bx lr + .pool + thumb_func_end sub_802DC80 + + thumb_func_start sub_802DC9C +sub_802DC9C: @ 802DC9C + push {r4,lr} + adds r4, r0, 0 + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + adds r1, r4, 0 + bl sub_802CF50 + ldr r0, =gUnknown_082FE1DF + adds r4, r0 + ldrb r0, [r4] + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 13 + movs r0, 0x2 + movs r2, 0 + bl ChangeBgY + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DC9C + + thumb_func_start sub_802DCCC +sub_802DCCC: @ 802DCCC + push {r4-r6,lr} + lsls r0, 24 + lsrs r4, r0, 24 + movs r5, 0 + movs r6, 0 +_0802DCD6: + movs r0, 0x1 + ands r0, r4 + cmp r0, 0 + beq _0802DCEA + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + adds r1, r5, 0 + bl sub_802CB14 + adds r6, 0x1 +_0802DCEA: + lsrs r4, 1 + adds r5, 0x1 + cmp r5, 0x4 + ble _0802DCD6 + subs r0, r6, 0x2 + lsls r0, 24 + lsrs r0, 24 + bl sub_802E00C + adds r0, r6, 0 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802DCCC + + thumb_func_start sub_802DD08 +sub_802DD08: @ 802DD08 + push {r4,lr} + sub sp, 0x10 + mov r1, sp + movs r0, 0x40 + strb r0, [r1] + movs r0, 0x5 + strb r0, [r1, 0x1] + movs r0, 0x8 + strb r0, [r1, 0x2] + movs r0, 0x6C + strh r0, [r1, 0x4] + movs r4, 0x6 + strh r4, [r1, 0x6] + ldr r0, =gUnknown_082FE1EC + str r0, [sp, 0x8] + ldr r0, =gUnknown_082FE1F4 + str r0, [sp, 0xC] + movs r0, 0x2 + bl sub_8034C54 + movs r0, 0 + movs r1, 0 + mov r2, sp + bl sub_8034D14 + mov r1, sp + movs r0, 0x4 + strb r0, [r1, 0x1] + movs r0, 0x1E + strh r0, [r1, 0x4] + mov r0, sp + strh r4, [r0, 0x6] + movs r0, 0x1 + movs r1, 0 + mov r2, sp + bl sub_8034D14 + add sp, 0x10 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DD08 + + thumb_func_start sub_802DD64 +sub_802DD64: @ 802DD64 + push {lr} + adds r1, r0, 0 + movs r0, 0 + bl sub_8035044 + pop {r0} + bx r0 + thumb_func_end sub_802DD64 + + thumb_func_start sub_802DD74 +sub_802DD74: @ 802DD74 + push {lr} + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x1 + bl sub_8035044 + pop {r0} + bx r0 + thumb_func_end sub_802DD74 + + thumb_func_start sub_802DD88 +sub_802DD88: @ 802DD88 + push {lr} + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + bl sub_802CBF0 + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DD88 + + thumb_func_start sub_802DDA0 +sub_802DDA0: @ 802DDA0 + push {lr} + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + bl sub_802CC88 + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DDA0 + + thumb_func_start sub_802DDB8 +sub_802DDB8: @ 802DDB8 + push {lr} + adds r1, r0, 0 + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + bl sub_802CC18 + pop {r1} + bx r1 + .pool + thumb_func_end sub_802DDB8 + + thumb_func_start sub_802DDCC +sub_802DDCC: @ 802DDCC + push {lr} + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + bl sub_802CCB0 + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DDCC + + thumb_func_start sub_802DDE0 +sub_802DDE0: @ 802DDE0 + push {lr} + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + bl sub_802CD3C + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DDE0 + + thumb_func_start sub_802DDF4 +sub_802DDF4: @ 802DDF4 + push {lr} + adds r1, r0, 0 + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + bl sub_802CD70 + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DDF4 + + thumb_func_start sub_802DE08 +sub_802DE08: @ 802DE08 + push {lr} + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + bl sub_802CD98 + pop {r1} + bx r1 + .pool + thumb_func_end sub_802DE08 + + thumb_func_start sub_802DE1C +sub_802DE1C: @ 802DE1C + push {r4-r7,lr} + sub sp, 0x8 + bl sub_802C8AC + lsls r0, 16 + lsrs r7, r0, 16 + ldr r1, =gUnknown_082FE234 + subs r0, r7, 0x2 + lsls r0, 2 + adds r0, r1 + ldr r4, [r0] + ldr r2, =0xffffff00 + ldr r0, [sp] + ands r0, r2 + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0x80 + lsls r1, 20 + orrs r0, r1 + str r0, [sp] + ldr r0, [sp, 0x4] + ands r0, r2 + movs r1, 0x2 + orrs r0, r1 + ldr r1, =0xffff00ff + ands r0, r1 + movs r1, 0x80 + lsls r1, 2 + orrs r0, r1 + ldr r1, =0x0000ffff + ands r0, r1 + movs r1, 0xAC + lsls r1, 14 + orrs r0, r1 + str r0, [sp, 0x4] + movs r5, 0 + cmp r5, r7 + bge _0802DEAC + mov r6, sp +_0802DE6A: + ldrb r0, [r4] + lsls r0, 8 + ldr r2, =0xffff00ff + ldr r1, [sp] + ands r1, r2 + orrs r1, r0 + str r1, [sp] + ldrb r2, [r4, 0x2] + lsls r2, 16 + ldr r0, =0xff00ffff + ands r0, r1 + orrs r0, r2 + str r0, [sp] + mov r0, sp + bl AddWindow + ldr r1, =gUnknown_02022D00 + ldr r1, [r1] + lsls r2, r5, 1 + adds r1, 0x1C + adds r1, r2 + strh r0, [r1] + lsls r0, 24 + lsrs r0, 24 + bl ClearWindowTilemap + ldrh r0, [r6, 0x6] + adds r0, 0x10 + strh r0, [r6, 0x6] + adds r4, 0x4 + adds r5, 0x1 + cmp r5, r7 + blt _0802DE6A +_0802DEAC: + movs r0, 0 + bl CopyBgTilemapBufferToVram + add sp, 0x8 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DE1C + + thumb_func_start sub_802DED8 +sub_802DED8: @ 802DED8 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0x10 + adds r5, r0, 0 + lsls r2, 24 + lsrs r2, 24 + lsls r3, 24 + lsrs r3, 24 + add r0, sp, 0xC + strb r1, [r0] + strb r2, [r0, 0x1] + strb r3, [r0, 0x2] + ldr r6, =gUnknown_02022D00 + ldr r0, [r6] + lsls r1, r5, 1 + mov r8, r1 + adds r0, 0x1C + add r0, r8 + ldrb r0, [r0] + movs r1, 0 + bl FillWindowPixelBuffer + lsls r5, 24 + lsrs r5, 24 + adds r0, r5, 0 + bl sub_802C8E8 + adds r1, r0, 0 + movs r2, 0x1 + negs r2, r2 + mov r9, r2 + movs r0, 0x1 + bl GetStringWidth + movs r4, 0x40 + subs r4, r0 + lsrs r4, 1 + adds r0, r5, 0 + bl sub_802C8E8 + adds r1, r0, 0 + ldr r0, [r6] + adds r0, 0x1C + add r0, r8 + ldrb r0, [r0] + lsls r4, 24 + lsrs r4, 24 + add r2, sp, 0xC + str r2, [sp] + mov r2, r9 + str r2, [sp, 0x4] + str r1, [sp, 0x8] + movs r1, 0x1 + adds r2, r4, 0 + movs r3, 0x1 + bl box_print + ldr r0, [r6] + adds r0, 0x1C + add r0, r8 + ldrb r0, [r0] + movs r1, 0x2 + bl CopyWindowToVram + add sp, 0x10 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DED8 + + thumb_func_start sub_802DF70 +sub_802DF70: @ 802DF70 + push {r4-r6,lr} + adds r4, r0, 0 + bl sub_802C8AC + lsls r0, 16 + lsrs r5, r0, 16 + cmp r4, 0 + bne _0802DF9A + movs r4, 0 + cmp r4, r5 + bge _0802DFCC +_0802DF86: + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x2 + movs r3, 0x3 + bl sub_802DED8 + adds r4, 0x1 + cmp r4, r5 + blt _0802DF86 + b _0802DFCC +_0802DF9A: + bl sub_802C8BC + lsls r0, 16 + lsrs r6, r0, 16 + movs r4, 0 + cmp r4, r5 + bge _0802DFCC +_0802DFA8: + cmp r6, r4 + beq _0802DFBA + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x2 + movs r3, 0x3 + bl sub_802DED8 + b _0802DFC6 +_0802DFBA: + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x4 + movs r3, 0x5 + bl sub_802DED8 +_0802DFC6: + adds r4, 0x1 + cmp r4, r5 + blt _0802DFA8 +_0802DFCC: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_802DF70 + + thumb_func_start sub_802DFD4 +sub_802DFD4: @ 802DFD4 + push {r4,r5,lr} + bl sub_802C8AC + lsls r0, 16 + lsrs r5, r0, 16 + movs r4, 0 + cmp r4, r5 + bge _0802DFFA +_0802DFE4: + ldr r0, =gUnknown_02022D00 + ldr r0, [r0] + lsls r1, r4, 1 + adds r0, 0x1C + adds r0, r1 + ldrb r0, [r0] + bl PutWindowTilemap + adds r4, 0x1 + cmp r4, r5 + blt _0802DFE4 +_0802DFFA: + movs r0, 0 + bl CopyBgTilemapBufferToVram + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802DFD4 + + thumb_func_start sub_802E00C +sub_802E00C: @ 802E00C + push {r4,lr} + adds r1, r0, 0 + lsls r1, 24 + lsrs r4, r1, 24 + ldr r0, =gUnknown_02022D00 + ldr r2, [r0] + movs r0, 0 + str r0, [r2, 0x18] + lsrs r1, 25 + lsls r1, 16 + movs r0, 0x1 + movs r2, 0 + bl ChangeBgX + movs r0, 0x1 + ands r4, r0 + lsls r4, 8 + subs r4, 0x28 + lsls r4, 8 + adds r1, r4, 0 + movs r2, 0 + bl ChangeBgY + movs r0, 0x1 + bl ShowBg + ldr r0, =sub_802E090 + movs r1, 0x4 + bl CreateTask + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802E00C + + thumb_func_start sub_802E058 +sub_802E058: @ 802E058 + push {r4,lr} + ldr r4, =gUnknown_02022D00 + ldr r0, [r4] + ldr r0, [r0, 0x18] + cmp r0, 0x1F + bls _0802E06C + movs r0, 0 + b _0802E08A + .pool +_0802E06C: + movs r0, 0x1 + movs r1, 0x80 + movs r2, 0x1 + bl ChangeBgY + ldr r1, [r4] + ldr r0, [r1, 0x18] + adds r0, 0x1 + str r0, [r1, 0x18] + cmp r0, 0x1F + bls _0802E088 + movs r0, 0x1 + bl HideBg +_0802E088: + movs r0, 0x1 +_0802E08A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802E058 + + thumb_func_start sub_802E090 +sub_802E090: @ 802E090 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + bl sub_802E058 + cmp r0, 0 + bne _0802E0A4 + adds r0, r4, 0 + bl DestroyTask +_0802E0A4: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_802E090 + + thumb_func_start sub_802E0AC +sub_802E0AC: @ 802E0AC + push {lr} + sub sp, 0xC + mov r2, sp + movs r1, 0x1 + strb r1, [r2] + ldrh r1, [r0] + strh r1, [r2, 0x2] + ldr r1, [r0, 0x4] + str r1, [sp, 0x8] + ldr r0, [r0, 0x8] + str r0, [sp, 0x4] + mov r0, sp + bl sub_800FE50 + add sp, 0xC + pop {r0} + bx r0 + thumb_func_end sub_802E0AC + + thumb_func_start sub_802E0D0 +sub_802E0D0: @ 802E0D0 + push {r4,lr} + sub sp, 0xC + adds r4, r1, 0 + ldr r3, =gUnknown_03003090 + lsls r2, r0, 4 + adds r0, r2, r3 + ldrh r1, [r0] + movs r0, 0xFF + lsls r0, 8 + ands r0, r1 + movs r1, 0xBC + lsls r1, 6 + cmp r0, r1 + bne _0802E100 + adds r1, r3, 0x2 + adds r1, r2, r1 + mov r0, sp + movs r2, 0xC + bl memcpy + mov r0, sp + ldrb r0, [r0] + cmp r0, 0x1 + beq _0802E108 +_0802E100: + movs r0, 0 + b _0802E118 + .pool +_0802E108: + mov r0, sp + ldrh r0, [r0, 0x2] + strh r0, [r4] + ldr r0, [sp, 0x8] + str r0, [r4, 0x4] + ldr r0, [sp, 0x4] + str r0, [r4, 0x8] + movs r0, 0x1 +_0802E118: + add sp, 0xC + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802E0D0 + + thumb_func_start sub_802E120 +sub_802E120: @ 802E120 + push {lr} + sub sp, 0xC + mov r2, sp + movs r1, 0x2 + strb r1, [r2] + str r0, [sp, 0x4] + mov r0, sp + bl sub_800FE50 + add sp, 0xC + pop {r0} + bx r0 + thumb_func_end sub_802E120 + + thumb_func_start sub_802E138 +sub_802E138: @ 802E138 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0xC + mov r3, sp + movs r2, 0x3 + strb r2, [r3] + ldr r3, [r1, 0x8] + lsls r3, 15 + ldr r2, [sp, 0x8] + ldr r4, =0x00007fff + mov r8, r4 + ands r2, r4 + orrs r2, r3 + str r2, [sp, 0x8] + mov r6, sp + ldrb r2, [r1, 0x1] + movs r5, 0x1F + adds r3, r5, 0 + ands r3, r2 + ldrb r4, [r6, 0x3] + movs r2, 0x20 + negs r2, r2 + ands r2, r4 + orrs r2, r3 + strb r2, [r6, 0x3] + mov r3, sp + ldrb r2, [r1] + strb r2, [r3, 0x1] + ldrh r2, [r1, 0x2] + strh r2, [r3, 0x6] + mov r4, sp + ldrh r2, [r1, 0x4] + mov r1, r8 + ands r2, r1 + ldrh r3, [r4, 0x8] + ldr r1, =0xffff8000 + ands r1, r3 + orrs r1, r2 + strh r1, [r4, 0x8] + mov r2, sp + ldrh r1, [r0, 0x10] + strb r1, [r2, 0x2] + mov r3, sp + ldr r1, [r0, 0x14] + lsls r1, 5 + ldrb r2, [r3, 0x3] + ands r5, r2 + orrs r5, r1 + strb r5, [r3, 0x3] + mov r1, sp + ldrh r0, [r0, 0xE] + strh r0, [r1, 0x4] + mov r0, sp + bl sub_800FE50 + add sp, 0xC + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802E138 + + thumb_func_start sub_802E1BC +sub_802E1BC: @ 802E1BC + push {r4,r5,lr} + sub sp, 0xC + adds r5, r0, 0 + adds r4, r1, 0 + ldr r2, =gUnknown_03003090 + ldrh r0, [r2] + movs r1, 0xFF + lsls r1, 8 + ands r1, r0 + movs r0, 0xBC + lsls r0, 6 + cmp r1, r0 + bne _0802E228 + adds r1, r2, 0x2 + mov r0, sp + movs r2, 0xC + bl memcpy + mov r0, sp + ldrb r0, [r0] + cmp r0, 0x3 + bne _0802E228 + ldr r0, [sp, 0x8] + lsrs r0, 15 + str r0, [r4, 0x8] + mov r0, sp + ldrb r1, [r0, 0x3] + lsls r0, r1, 27 + lsrs r0, 27 + strb r0, [r4, 0x1] + mov r0, sp + ldrb r0, [r0, 0x1] + strb r0, [r4] + mov r0, sp + ldrh r0, [r0, 0x6] + strh r0, [r4, 0x2] + mov r0, sp + ldrh r0, [r0, 0x8] + lsls r0, 17 + lsrs r0, 17 + strh r0, [r4, 0x4] + mov r0, sp + ldrb r0, [r0, 0x2] + strh r0, [r5, 0x10] + lsls r1, 24 + lsrs r1, 29 + str r1, [r5, 0x14] + mov r0, sp + ldrh r0, [r0, 0x4] + strh r0, [r5, 0xE] + movs r0, 0x1 + b _0802E22A + .pool +_0802E228: + movs r0, 0 +_0802E22A: + add sp, 0xC + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_802E1BC + + thumb_func_start sub_802E234 +sub_802E234: @ 802E234 + push {r4,lr} + sub sp, 0xC + mov r4, sp + movs r3, 0x4 + strb r3, [r4] + ldrh r3, [r0, 0x10] + strb r3, [r4, 0x1] + ldr r3, [r0, 0x14] + strb r3, [r4, 0x2] + ldr r3, [r0, 0x18] + strb r3, [r4, 0x3] + mov r3, sp + ldrh r0, [r0, 0xE] + strh r0, [r3, 0x4] + mov r0, sp + strb r1, [r0, 0x6] + strh r2, [r0, 0x8] + bl sub_800FE50 + add sp, 0xC + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_802E234 + + thumb_func_start sub_802E264 +sub_802E264: @ 802E264 + push {r4-r6,lr} + sub sp, 0xC + adds r4, r0, 0 + adds r5, r2, 0 + adds r6, r3, 0 + ldr r3, =gUnknown_03003090 + lsls r2, r1, 4 + adds r0, r2, r3 + ldrh r1, [r0] + movs r0, 0xFF + lsls r0, 8 + ands r0, r1 + movs r1, 0xBC + lsls r1, 6 + cmp r0, r1 + bne _0802E2C4 + adds r1, r3, 0x2 + adds r1, r2, r1 + mov r0, sp + movs r2, 0xC + bl memcpy + mov r0, sp + ldrb r0, [r0] + cmp r0, 0x4 + bne _0802E2C4 + mov r0, sp + ldrb r0, [r0, 0x1] + strh r0, [r4, 0x10] + mov r0, sp + ldrb r0, [r0, 0x2] + str r0, [r4, 0x14] + mov r0, sp + ldrb r0, [r0, 0x3] + str r0, [r4, 0x18] + mov r0, sp + ldrh r0, [r0, 0x4] + strh r0, [r4, 0xE] + mov r0, sp + ldrb r0, [r0, 0x6] + strb r0, [r5] + mov r0, sp + ldrh r0, [r0, 0x8] + strh r0, [r6] + movs r0, 0x1 + b _0802E2C6 + .pool +_0802E2C4: + movs r0, 0 +_0802E2C6: + add sp, 0xC + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_802E264 + + thumb_func_start sub_802E2D0 +sub_802E2D0: @ 802E2D0 + push {r4,lr} + sub sp, 0xC + adds r4, r0, 0 + ldr r3, =gUnknown_03003090 + lsls r2, r1, 4 + adds r0, r2, r3 + ldrh r1, [r0] + movs r0, 0xFF + lsls r0, 8 + ands r0, r1 + movs r1, 0xBC + lsls r1, 6 + cmp r0, r1 + bne _0802E320 + adds r1, r3, 0x2 + adds r1, r2, r1 + mov r0, sp + movs r2, 0xC + bl memcpy + mov r0, sp + ldrb r0, [r0] + cmp r0, 0x4 + bne _0802E320 + mov r0, sp + ldrb r0, [r0, 0x1] + strh r0, [r4, 0x10] + mov r0, sp + ldrb r0, [r0, 0x2] + str r0, [r4, 0x14] + mov r0, sp + ldrb r0, [r0, 0x3] + str r0, [r4, 0x18] + mov r0, sp + ldrh r0, [r0, 0x4] + strh r0, [r4, 0xE] + movs r0, 0x1 + b _0802E322 + .pool +_0802E320: + movs r0, 0 +_0802E322: + add sp, 0xC + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802E2D0 + + thumb_func_start sub_802E32C +sub_802E32C: @ 802E32C + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r1, 0xFE + lsls r1, 1 + adds r0, r1 + bx lr + .pool + thumb_func_end sub_802E32C + + thumb_func_start ResetPokeJumpResults +ResetPokeJumpResults: @ 802E33C + push {lr} + bl sub_802E32C + movs r1, 0 + strh r1, [r0] + str r1, [r0, 0xC] + strh r1, [r0, 0x4] + strh r1, [r0, 0x6] + str r1, [r0, 0x8] + strh r1, [r0, 0x2] + pop {r0} + bx r0 + thumb_func_end ResetPokeJumpResults + + thumb_func_start sub_802E354 +sub_802E354: @ 802E354 + push {r4-r6,lr} + adds r4, r0, 0 + lsls r1, 16 + lsrs r5, r1, 16 + lsls r2, 16 + lsrs r6, r2, 16 + bl sub_802E32C + adds r1, r0, 0 + movs r2, 0 + ldr r0, [r1, 0xC] + cmp r0, r4 + bcs _0802E378 + ldr r0, =0x00018696 + cmp r4, r0 + bhi _0802E378 + str r4, [r1, 0xC] + movs r2, 0x1 +_0802E378: + ldrh r0, [r1] + cmp r0, r5 + bcs _0802E388 + ldr r0, =0x0000270f + cmp r5, r0 + bhi _0802E388 + strh r5, [r1] + movs r2, 0x1 +_0802E388: + ldrh r0, [r1, 0x4] + cmp r0, r6 + bcs _0802E398 + ldr r0, =0x0000270f + cmp r6, r0 + bhi _0802E398 + strh r6, [r1, 0x4] + movs r2, 0x1 +_0802E398: + adds r0, r2, 0 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802E354 + + thumb_func_start sub_802E3A8 +sub_802E3A8: @ 802E3A8 + push {lr} + bl sub_802E32C + adds r2, r0, 0 + ldrh r1, [r2, 0x6] + ldr r0, =0x0000270e + cmp r1, r0 + bhi _0802E3BC + adds r0, r1, 0x1 + strh r0, [r2, 0x6] +_0802E3BC: + pop {r0} + bx r0 + .pool + thumb_func_end sub_802E3A8 + + thumb_func_start sub_802E3C4 +sub_802E3C4: @ 802E3C4 + push {r4,lr} + ldr r4, =sub_802E3E4 + adds r0, r4, 0 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + bl _call_via_r4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802E3C4 + + thumb_func_start sub_802E3E4 +sub_802E3E4: @ 802E3E4 + push {r4-r7,lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r7, r0, r1 + movs r1, 0 + ldrsh r0, [r7, r1] + cmp r0, 0x1 + beq _0802E4A8 + cmp r0, 0x1 + bgt _0802E40C + cmp r0, 0 + beq _0802E416 + b _0802E4F6 + .pool +_0802E40C: + cmp r0, 0x2 + beq _0802E4B4 + cmp r0, 0x3 + beq _0802E4DC + b _0802E4F6 +_0802E416: + ldr r0, =gUnknown_082FE270 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp] + str r1, [sp, 0x4] + ldr r1, =gText_PkmnJumpRecords + movs r0, 0x1 + movs r2, 0 + bl GetStringWidth + adds r4, r0, 0 + movs r6, 0 + ldr r5, =gUnknown_082FE278 +_0802E430: + ldr r1, [r5] + movs r0, 0x1 + movs r2, 0 + bl GetStringWidth + adds r0, 0x26 + cmp r0, r4 + ble _0802E442 + adds r4, r0, 0 +_0802E442: + adds r5, 0x4 + adds r6, 0x1 + cmp r6, 0x2 + bls _0802E430 + adds r0, r4, 0x7 + cmp r0, 0 + bge _0802E452 + adds r0, 0x7 +_0802E452: + asrs r4, r0, 3 + movs r0, 0x1 + ands r0, r4 + cmp r0, 0 + beq _0802E45E + adds r4, 0x1 +_0802E45E: + movs r1, 0x1E + subs r1, r4 + lsrs r0, r1, 31 + adds r1, r0 + asrs r1, 1 + lsls r1, 24 + lsrs r1, 16 + ldr r2, =0xffff00ff + ldr r0, [sp] + ands r0, r2 + orrs r0, r1 + lsls r2, r4, 24 + ldr r1, =0x00ffffff + ands r0, r1 + orrs r0, r2 + str r0, [sp] + mov r0, sp + bl AddWindow + strh r0, [r7, 0x2] + ldrh r0, [r7, 0x2] + adds r1, r4, 0 + bl sub_802E500 + ldrb r0, [r7, 0x2] + movs r1, 0x3 + b _0802E4CA + .pool +_0802E4A8: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802E4F6 + b _0802E4CE +_0802E4B4: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _0802E4F6 + ldrb r0, [r7, 0x2] + bl rbox_fill_rectangle + ldrb r0, [r7, 0x2] + movs r1, 0x1 +_0802E4CA: + bl CopyWindowToVram +_0802E4CE: + ldrh r0, [r7] + adds r0, 0x1 + strh r0, [r7] + b _0802E4F6 + .pool +_0802E4DC: + bl IsDma3ManagerBusyWithBgCopy + lsls r0, 24 + cmp r0, 0 + bne _0802E4F6 + ldrb r0, [r7, 0x2] + bl RemoveWindow + adds r0, r4, 0 + bl DestroyTask + bl EnableBothScriptContexts +_0802E4F6: + add sp, 0x8 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_802E3E4 + + thumb_func_start sub_802E500 +sub_802E500: @ 802E500 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x24 + str r1, [sp, 0x1C] + lsls r0, 16 + lsrs r0, 16 + str r0, [sp, 0x18] + bl sub_802E32C + ldrh r1, [r0] + str r1, [sp, 0xC] + ldr r1, [r0, 0xC] + str r1, [sp, 0x10] + ldrh r0, [r0, 0x4] + str r0, [sp, 0x14] + ldr r0, [sp, 0x18] + lsls r4, r0, 24 + lsrs r4, 24 + ldr r5, =0x0000021d + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0xD0 + bl box_border_load_tiles_and_pal + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0xD + bl sub_8098858 + adds r0, r4, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r5, =gText_PkmnJumpRecords + ldr r1, [sp, 0x1C] + lsls r2, r1, 3 + movs r0, 0x1 + adds r1, r5, 0 + bl GetStringCenterAlignXOffset + adds r3, r0, 0 + lsls r3, 24 + lsrs r3, 24 + movs r0, 0x1 + str r0, [sp] + movs r0, 0xFF + str r0, [sp, 0x4] + movs r0, 0 + str r0, [sp, 0x8] + adds r0, r4, 0 + movs r1, 0x1 + adds r2, r5, 0 + bl PrintTextOnWindow + movs r6, 0 + adds r7, r4, 0 + movs r0, 0xFF + mov r10, r0 + mov r9, r6 + mov r1, sp + adds r1, 0xC + str r1, [sp, 0x20] + movs r0, 0xC8 + lsls r0, 21 + mov r8, r0 + ldr r5, =gStringVar1 +_0802E58A: + ldr r1, =gUnknown_082FE278 + lsls r0, r6, 2 + adds r0, r1 + ldr r2, [r0] + mov r1, r8 + lsrs r4, r1, 24 + str r4, [sp] + mov r0, r10 + str r0, [sp, 0x4] + mov r1, r9 + str r1, [sp, 0x8] + adds r0, r7, 0 + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldr r0, [sp, 0x20] + ldm r0!, {r1} + str r0, [sp, 0x20] + adds r0, r5, 0 + movs r2, 0 + movs r3, 0x5 + bl ConvertIntToDecimalStringN + adds r0, r5, 0 + bl sub_802E620 + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0 + bl GetStringWidth + ldr r1, [sp, 0x1C] + lsls r3, r1, 3 + subs r3, r0 + lsls r3, 24 + lsrs r3, 24 + str r4, [sp] + mov r0, r10 + str r0, [sp, 0x4] + mov r1, r9 + str r1, [sp, 0x8] + adds r0, r7, 0 + movs r1, 0x1 + adds r2, r5, 0 + bl PrintTextOnWindow + movs r0, 0x80 + lsls r0, 21 + add r8, r0 + adds r6, 0x1 + ldr r1, [sp, 0x18] + lsls r0, r1, 24 + cmp r6, 0x2 + bls _0802E58A + lsrs r0, 24 + bl PutWindowTilemap + 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_802E500 + + thumb_func_start sub_802E620 +sub_802E620: @ 802E620 + push {lr} + adds r1, r0, 0 + b _0802E628 +_0802E626: + adds r1, 0x1 +_0802E628: + ldrb r0, [r1] + cmp r0, 0xFF + beq _0802E636 + cmp r0, 0 + bne _0802E626 + movs r0, 0xFF + strb r0, [r1] +_0802E636: + pop {r0} + bx r0 + thumb_func_end sub_802E620 + + thumb_func_start sub_802E63C +sub_802E63C: @ 802E63C + push {r4,r5,lr} + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r0, =sub_802E6D0 + bl CreateTask + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + adds r0, r1 + movs r1, 0x1 + strh r1, [r0, 0x8] + strh r5, [r0, 0xA] + ldr r0, =gUnknown_082FE748 + lsls r5, 4 + adds r5, r0 + ldr r1, [r5] + adds r0, r4, 0 + bl _call_via_r1 + adds r0, r4, 0 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802E63C + + thumb_func_start sub_802E688 +sub_802E688: @ 802E688 + push {lr} + ldr r0, =sub_802E6D0 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + beq _0802E6B4 + ldr r0, =gTasks + lsls r1, r2, 2 + adds r1, r2 + lsls r1, 3 + adds r1, r0 + movs r0, 0x2 + strh r0, [r1, 0x8] + movs r0, 0x1 + b _0802E6B6 + .pool +_0802E6B4: + movs r0, 0 +_0802E6B6: + pop {r1} + bx r1 + thumb_func_end sub_802E688 + + thumb_func_start sub_802E6BC +sub_802E6BC: @ 802E6BC + push {lr} + ldr r0, =sub_802E6D0 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_802E6BC + + thumb_func_start sub_802E6D0 +sub_802E6D0: @ 802E6D0 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0x3 + beq _0802E71C + cmp r0, 0x3 + bgt _0802E6F8 + cmp r0, 0x2 + beq _0802E6FE + b _0802E752 + .pool +_0802E6F8: + cmp r0, 0x4 + beq _0802E738 + b _0802E752 +_0802E6FE: + ldr r1, =gUnknown_082FE748 + movs r2, 0x2 + ldrsh r0, [r4, r2] + lsls r0, 4 + adds r1, 0x8 + adds r0, r1 + ldr r1, [r0] + adds r0, r5, 0 + bl _call_via_r1 + movs r0, 0x3 + strh r0, [r4] + b _0802E752 + .pool +_0802E71C: + ldr r0, =gUnknown_082FE748 + movs r2, 0x2 + ldrsh r1, [r4, r2] + lsls r1, 4 + adds r0, 0xC + adds r1, r0 + ldr r1, [r1] + adds r0, r5, 0 + bl _call_via_r1 + b _0802E752 + .pool +_0802E738: + ldr r0, =gUnknown_082FE748 + movs r2, 0x2 + ldrsh r1, [r4, r2] + lsls r1, 4 + adds r0, 0x4 + adds r1, r0 + ldr r1, [r1] + adds r0, r5, 0 + bl _call_via_r1 + adds r0, r5, 0 + bl DestroyTask +_0802E752: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802E6D0 + + thumb_func_start sub_802E75C +sub_802E75C: @ 802E75C + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r4, r1, 0 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + movs r1, 0x6 + ldrsh r0, [r4, r1] + lsls r0, 3 + ldr r1, =gUnknown_082FE6C8 + adds r0, r1 + bl LoadCompressedObjectPic + movs r2, 0x8 + ldrsh r0, [r4, r2] + lsls r0, 3 + ldr r1, =gUnknown_082FE6D8 + adds r0, r1 + bl LoadSpritePalette + movs r5, 0 + movs r3, 0x10 + ldrsh r0, [r4, r3] + cmp r5, r0 + bge _0802E7C4 +_0802E790: + movs r0, 0x4 + ldrsh r1, [r4, r0] + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 3 + ldr r1, =gUnknown_082FE730 + adds r0, r1 + movs r2, 0x12 + ldrsh r1, [r4, r2] + movs r3, 0x14 + ldrsh r2, [r4, r3] + ldrb r3, [r4, 0xE] + bl CreateSprite + lsls r1, r5, 1 + adds r1, r4 + lsls r0, 24 + lsrs r0, 24 + strh r0, [r1, 0x1A] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + movs r1, 0x10 + ldrsh r0, [r4, r1] + cmp r5, r0 + blt _0802E790 +_0802E7C4: + movs r5, 0 + movs r2, 0x10 + ldrsh r0, [r4, r2] + cmp r5, r0 + bge _0802E820 + movs r7, 0x3 + movs r3, 0xD + negs r3, r3 + mov r12, r3 + ldr r6, =gSprites +_0802E7D8: + lsls r0, r5, 1 + adds r0, r4 + movs r1, 0x1A + ldrsh r0, [r0, r1] + lsls r2, r0, 4 + adds r2, r0 + lsls r2, 2 + adds r2, r6 + ldrb r1, [r4, 0xC] + ands r1, r7 + lsls r1, 2 + ldrb r3, [r2, 0x5] + mov r0, r12 + ands r0, r3 + orrs r0, r1 + strb r0, [r2, 0x5] + adds r3, r2, 0 + adds r3, 0x3E + ldrb r0, [r3] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r3] + ldrh r0, [r4, 0xA] + strh r0, [r2, 0x30] + mov r3, r8 + strh r3, [r2, 0x34] + strh r5, [r2, 0x36] + ldrh r0, [r4, 0x1A] + strh r0, [r2, 0x38] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + movs r1, 0x10 + ldrsh r0, [r4, r1] + cmp r5, r0 + blt _0802E7D8 +_0802E820: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802E75C + + thumb_func_start sub_802E83C +sub_802E83C: @ 802E83C + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r4, r0, 2 + adds r4, r0 + lsls r4, 3 + ldr r1, =gTasks + 0x8 + adds r4, r1 + movs r5, 0 + strh r5, [r4, 0x4] + strh r5, [r4, 0x6] + strh r5, [r4, 0x8] + movs r1, 0x3C + strh r1, [r4, 0xA] + strh r5, [r4, 0xC] + strh r5, [r4, 0xE] + movs r1, 0x3 + strh r1, [r4, 0x10] + movs r1, 0x78 + strh r1, [r4, 0x12] + movs r1, 0x58 + strh r1, [r4, 0x14] + adds r1, r4, 0 + bl sub_802E75C + movs r0, 0x1C + ldrsh r1, [r4, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r5, =gSprites + adds r0, r5 + movs r1, 0x4 + bl StartSpriteAnim + movs r0, 0x1C + ldrsh r1, [r4, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + ldr r1, =0x0000ffe0 + strh r1, [r0, 0x24] + movs r0, 0x1E + ldrsh r1, [r4, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + movs r1, 0x5 + bl StartSpriteAnim + movs r0, 0x1E + ldrsh r1, [r4, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + movs r1, 0x20 + strh r1, [r0, 0x24] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802E83C + + thumb_func_start sub_802E8C8 +sub_802E8C8: @ 802E8C8 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + movs r5, 0 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r4, r1, r0 + b _0802E8FC + .pool +_0802E8E0: + lsls r0, r5, 1 + adds r0, r4 + movs r2, 0x1A + ldrsh r1, [r0, r2] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + bl DestroySprite + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_0802E8FC: + movs r1, 0x10 + ldrsh r0, [r4, r1] + cmp r5, r0 + blt _0802E8E0 + ldr r1, =gUnknown_082FE6C8 + movs r2, 0x6 + ldrsh r0, [r4, r2] + lsls r0, 3 + adds r0, r1 + ldrh r0, [r0, 0x6] + bl FreeSpriteTilesByTag + ldr r1, =gUnknown_082FE6D8 + movs r2, 0x8 + ldrsh r0, [r4, r2] + lsls r0, 3 + adds r0, r1 + ldrh r0, [r0, 0x4] + bl FreeSpritePaletteByTag + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802E8C8 + + thumb_func_start sub_802E938 +sub_802E938: @ 802E938 + push {r4-r6,lr} + adds r6, r0, 0 + movs r0, 0x34 + ldrsh r1, [r6, r0] + lsls r0, r1, 2 + adds r0, r1 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r5, r0, r1 + movs r1, 0x16 + ldrsh r0, [r5, r1] + movs r2, 0xA + ldrsh r1, [r5, r2] + bl __modsi3 + cmp r0, 0 + bne _0802EA4A + ldrh r2, [r5, 0x16] + movs r3, 0x16 + ldrsh r1, [r5, r3] + movs r3, 0x14 + ldrsh r0, [r5, r3] + cmp r1, r0 + beq _0802EA4A + strh r2, [r5, 0x14] + movs r1, 0x32 + ldrsh r0, [r6, r1] + cmp r0, 0x4 + bhi _0802EA44 + lsls r0, 2 + ldr r1, =_0802E984 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802E984: + .4byte _0802E998 + .4byte _0802E9A6 + .4byte _0802E9A6 + .4byte _0802E9BA + .4byte _0802EA04 +_0802E998: + adds r2, r6, 0 + adds r2, 0x3E + ldrb r1, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2] +_0802E9A6: + movs r0, 0x38 + bl PlaySE + ldrh r1, [r6, 0x32] + lsls r1, 24 + lsrs r1, 24 + adds r0, r6, 0 + bl StartSpriteAnim + b _0802EA44 +_0802E9BA: + movs r0, 0x15 + bl PlaySE + ldrh r1, [r6, 0x32] + lsls r1, 24 + lsrs r1, 24 + adds r0, r6, 0 + bl StartSpriteAnim + ldr r4, =gSprites + movs r2, 0x1C + ldrsh r0, [r5, r2] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r4 + adds r1, 0x3E + ldrb r3, [r1] + movs r2, 0x5 + negs r2, r2 + adds r0, r2, 0 + ands r0, r3 + strb r0, [r1] + movs r3, 0x1E + ldrsh r1, [r5, r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + adds r0, 0x3E + ldrb r1, [r0] + ands r2, r1 + strb r2, [r0] + b _0802EA44 + .pool +_0802EA04: + adds r1, r6, 0 + adds r1, 0x3E + ldrb r0, [r1] + movs r2, 0x4 + orrs r0, r2 + strb r0, [r1] + ldr r3, =gSprites + movs r0, 0x1C + ldrsh r1, [r5, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + adds r0, 0x3E + ldrb r1, [r0] + orrs r1, r2 + strb r1, [r0] + movs r0, 0x1E + ldrsh r1, [r5, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + adds r0, 0x3E + ldrb r1, [r0] + orrs r1, r2 + strb r1, [r0] + movs r0, 0x4 + strh r0, [r5] + b _0802EA4A + .pool +_0802EA44: + ldrh r0, [r6, 0x32] + adds r0, 0x1 + strh r0, [r6, 0x32] +_0802EA4A: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_802E938 + + thumb_func_start sub_802EA50 +sub_802EA50: @ 802EA50 + push {r4-r6,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r4, r0, 2 + adds r4, r0 + lsls r4, 3 + ldr r5, =gTasks + 0x8 + adds r6, r4, r5 + movs r0, 0x38 + bl PlaySE + ldr r2, =gSprites + movs r0, 0x1A + ldrsh r1, [r6, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r1, r2, 0 + adds r1, 0x1C + adds r0, r1 + ldr r1, =sub_802E938 + str r1, [r0] + movs r0, 0x1A + ldrsh r1, [r6, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r2, [r0] + movs r1, 0x5 + negs r1, r1 + ands r1, r2 + strb r1, [r0] + subs r5, 0x8 + adds r4, r5 + movs r0, 0x3 + strh r0, [r4, 0x8] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802EA50 + + thumb_func_start sub_802EAB0 +sub_802EAB0: @ 802EAB0 + push {r4,r5,lr} + sub sp, 0xC + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r4, r1, r0 + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _0802EB14 + ldr r1, =gUnknown_03003090 + ldrh r0, [r1, 0x2] + ldr r5, =0x00007fff + cmp r0, r5 + bne _0802EAD8 + ldrh r0, [r1, 0x4] + strh r0, [r4, 0x16] +_0802EAD8: + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + bne _0802EB1A + ldrh r0, [r4, 0x18] + adds r0, 0x1 + strh r0, [r4, 0x18] + mov r0, sp + movs r1, 0 + movs r2, 0xC + bl memset + mov r0, sp + strh r5, [r0] + mov r1, sp + ldrh r0, [r4, 0x18] + strh r0, [r1, 0x2] + mov r0, sp + bl sub_800FE50 + b _0802EB1A + .pool +_0802EB14: + ldrh r0, [r4, 0x16] + adds r0, 0x1 + strh r0, [r4, 0x16] +_0802EB1A: + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_802EAB0 + + thumb_func_start sub_802EB24 +sub_802EB24: @ 802EB24 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x4 + adds r4, r0, 0 + adds r5, r1, 0 + adds r6, r2, 0 + ldr r0, [sp, 0x18] + lsls r4, 16 + lsrs r4, 16 + lsls r5, 16 + lsrs r5, 16 + lsls r6, 16 + lsrs r6, 16 + lsls r3, 16 + lsrs r3, 16 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + ldr r0, =sub_802EB98 + movs r1, 0x50 + str r3, [sp] + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + strh r4, [r1, 0xC] + strh r5, [r1, 0xE] + strh r6, [r1, 0x10] + ldr r3, [sp] + strh r3, [r1, 0x12] + mov r0, r8 + strh r0, [r1, 0x14] + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802EB24 + + thumb_func_start sub_802EB84 +sub_802EB84: @ 802EB84 + push {lr} + ldr r0, =sub_802EB98 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_802EB84 + + thumb_func_start sub_802EB98 +sub_802EB98: @ 802EB98 + push {r4-r6,lr} + sub sp, 0xC + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r5, r0, r1 + movs r1, 0 + ldrsh r0, [r5, r1] + cmp r0, 0x1 + beq _0802EC08 + cmp r0, 0x1 + bgt _0802EBC0 + cmp r0, 0 + beq _0802EBC6 + b _0802EC8A + .pool +_0802EBC0: + cmp r0, 0x2 + beq _0802EC4C + b _0802EC8A +_0802EBC6: + ldrh r0, [r5, 0x4] + ldrh r1, [r5, 0x6] + bl sub_802EF50 + ldrh r0, [r5, 0x4] + ldrh r1, [r5, 0x6] + movs r3, 0x8 + ldrsh r2, [r5, r3] + movs r4, 0xA + ldrsh r3, [r5, r4] + ldrb r4, [r5, 0xC] + str r4, [sp] + bl sub_802EFA8 + lsls r0, 24 + lsrs r0, 24 + strh r0, [r5, 0xE] + ldrh r0, [r5, 0x4] + ldrh r1, [r5, 0x6] + movs r3, 0x8 + ldrsh r2, [r5, r3] + movs r4, 0xA + ldrsh r3, [r5, r4] + ldrb r4, [r5, 0xC] + str r4, [sp] + adds r4, r5, 0 + adds r4, 0x10 + str r4, [sp, 0x4] + adds r4, 0x2 + str r4, [sp, 0x8] + bl sub_802EFFC + b _0802EC3E +_0802EC08: + ldrb r0, [r5, 0xE] + bl sub_802EC98 + cmp r0, 0 + bne _0802EC8A + ldrb r0, [r5, 0xE] + ldrb r1, [r5, 0x10] + ldrb r2, [r5, 0x12] + bl sub_802EDCC + movs r0, 0xE + ldrsh r1, [r5, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r4, =gSprites + adds r0, r4 + bl FreeSpriteOamMatrix + movs r3, 0xE + ldrsh r1, [r5, r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + bl DestroySprite +_0802EC3E: + ldrh r0, [r5] + adds r0, 0x1 + strh r0, [r5] + b _0802EC8A + .pool +_0802EC4C: + ldrb r0, [r5, 0x10] + bl sub_802EE30 + cmp r0, 0 + bne _0802EC8A + movs r4, 0x10 + ldrsh r1, [r5, r4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r4, =gSprites + adds r0, r4 + bl DestroySprite + movs r0, 0x12 + ldrsh r1, [r5, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + bl DestroySprite + ldrh r0, [r5, 0x4] + bl FreeSpriteTilesByTag + ldrh r0, [r5, 0x6] + bl FreeSpritePaletteByTag + adds r0, r6, 0 + bl DestroyTask +_0802EC8A: + add sp, 0xC + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802EB98 + + thumb_func_start sub_802EC98 +sub_802EC98: @ 802EC98 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r0, =gSprites + adds r4, r1, r0 + movs r1, 0x2E + ldrsh r0, [r4, r1] + cmp r0, 0x7 + bls _0802ECB2 + b _0802EDC4 +_0802ECB2: + lsls r0, 2 + ldr r1, =_0802ECC4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802ECC4: + .4byte _0802ECE4 + .4byte _0802ECF6 + .4byte _0802ED1C + .4byte _0802ED2C + .4byte _0802ED4E + .4byte _0802ED86 + .4byte _0802EDAC + .4byte _0802ED82 +_0802ECE4: + movs r1, 0x80 + lsls r1, 4 + adds r0, r4, 0 + movs r2, 0x1A + bl sub_8007E18 + ldrh r0, [r4, 0x2E] + adds r0, 0x1 + strh r0, [r4, 0x2E] +_0802ECF6: + movs r2, 0x32 + ldrsh r0, [r4, r2] + cmp r0, 0 + bne _0802ED04 + movs r0, 0x39 + bl PlaySE +_0802ED04: + ldrh r0, [r4, 0x32] + adds r0, 0x1 + strh r0, [r4, 0x32] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x13 + ble _0802EDC4 + movs r0, 0 + strh r0, [r4, 0x32] + adds r0, r4, 0 + movs r1, 0x1 + b _0802EDA2 +_0802ED1C: + adds r0, r4, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x20 + ands r0, r1 + cmp r0, 0 + beq _0802EDC4 + b _0802EDA6 +_0802ED2C: + ldrh r0, [r4, 0x32] + adds r0, 0x1 + strh r0, [r4, 0x32] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x3 + ble _0802EDC4 + movs r0, 0 + strh r0, [r4, 0x32] + ldrh r0, [r4, 0x2E] + adds r0, 0x1 + strh r0, [r4, 0x2E] + adds r0, r4, 0 + movs r1, 0x2 + bl StartSpriteAffineAnim + b _0802EDC4 +_0802ED4E: + ldrh r0, [r4, 0x22] + subs r0, 0x4 + strh r0, [r4, 0x22] + ldrh r0, [r4, 0x32] + adds r0, 0x1 + strh r0, [r4, 0x32] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x7 + ble _0802EDC4 + ldrh r1, [r4, 0x36] + movs r2, 0x36 + ldrsh r0, [r4, r2] + cmp r0, 0x1 + bgt _0802ED7E + adds r1, 0x1 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + bl StartSpriteAnim + movs r0, 0 + strh r0, [r4, 0x32] + b _0802EDA6 +_0802ED7E: + movs r0, 0x7 + strh r0, [r4, 0x2E] +_0802ED82: + movs r0, 0 + b _0802EDC6 +_0802ED86: + ldrh r0, [r4, 0x22] + adds r0, 0x4 + strh r0, [r4, 0x22] + ldrh r0, [r4, 0x32] + adds r0, 0x1 + strh r0, [r4, 0x32] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x7 + ble _0802EDC4 + movs r0, 0 + strh r0, [r4, 0x32] + adds r0, r4, 0 + movs r1, 0x3 +_0802EDA2: + bl StartSpriteAffineAnim +_0802EDA6: + ldrh r0, [r4, 0x2E] + adds r0, 0x1 + b _0802EDC2 +_0802EDAC: + adds r0, r4, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x20 + ands r0, r1 + cmp r0, 0 + beq _0802EDC4 + ldrh r0, [r4, 0x36] + adds r0, 0x1 + strh r0, [r4, 0x36] + movs r0, 0x1 +_0802EDC2: + strh r0, [r4, 0x2E] +_0802EDC4: + movs r0, 0x1 +_0802EDC6: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_802EC98 + + thumb_func_start sub_802EDCC +sub_802EDCC: @ 802EDCC + push {r4-r6,lr} + mov r6, r8 + push {r6} + lsls r1, 24 + lsrs r1, 24 + lsls r2, 24 + lsrs r2, 24 + ldr r0, =gSprites + mov r8, r0 + lsls r4, r1, 4 + adds r4, r1 + lsls r4, 2 + adds r5, r4, r0 + ldr r0, =0x0000ffd8 + strh r0, [r5, 0x26] + lsls r3, r2, 4 + adds r3, r2 + lsls r3, 2 + mov r1, r8 + adds r2, r3, r1 + strh r0, [r2, 0x26] + adds r5, 0x3E + ldrb r6, [r5] + movs r1, 0x5 + negs r1, r1 + adds r0, r1, 0 + ands r0, r6 + strb r0, [r5] + adds r2, 0x3E + ldrb r0, [r2] + ands r1, r0 + strb r1, [r2] + movs r0, 0x1C + add r8, r0 + add r4, r8 + ldr r0, =sub_802EE5C + str r0, [r4] + add r3, r8 + str r0, [r3] + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802EDCC + + thumb_func_start sub_802EE30 +sub_802EE30: @ 802EE30 + push {lr} + lsls r0, 24 + lsrs r0, 24 + movs r3, 0 + ldr r2, =gSprites + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r2, 0x1C + adds r1, r2 + ldr r1, [r1] + ldr r0, =sub_802EE5C + cmp r1, r0 + bne _0802EE4E + movs r3, 0x1 +_0802EE4E: + adds r0, r3, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_802EE30 + + thumb_func_start sub_802EE5C +sub_802EE5C: @ 802EE5C + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r5, 0 + adds r4, 0x2E + movs r1, 0x2E + ldrsh r0, [r5, r1] + cmp r0, 0x4 + bhi _0802EF46 + lsls r0, 2 + ldr r1, =_0802EE7C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0802EE7C: + .4byte _0802EE90 + .4byte _0802EEA0 + .4byte _0802EEC8 + .4byte _0802EEFC + .4byte _0802EF34 +_0802EE90: + movs r0, 0x40 + strh r0, [r4, 0x8] + ldrh r0, [r5, 0x26] + lsls r0, 4 + strh r0, [r4, 0xA] + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] +_0802EEA0: + ldrh r1, [r4, 0x8] + ldrh r2, [r4, 0xA] + adds r0, r1, r2 + strh r0, [r4, 0xA] + adds r1, 0x1 + strh r1, [r4, 0x8] + lsls r0, 16 + asrs r0, 20 + strh r0, [r5, 0x26] + cmp r0, 0 + blt _0802EF46 + movs r0, 0x39 + bl PlaySE + movs r0, 0 + strh r0, [r5, 0x26] + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] + b _0802EF46 +_0802EEC8: + ldrh r0, [r4, 0x2] + adds r0, 0xC + strh r0, [r4, 0x2] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x7F + ble _0802EEE6 + movs r0, 0x39 + bl PlaySE + movs r0, 0 + strh r0, [r4, 0x2] + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] +_0802EEE6: + ldr r0, =gSineTable + movs r2, 0x2 + ldrsh r1, [r4, r2] + lsls r1, 1 + adds r1, r0 + movs r2, 0 + ldrsh r0, [r1, r2] + asrs r0, 4 + b _0802EF2A + .pool +_0802EEFC: + ldrh r0, [r4, 0x2] + adds r0, 0x10 + strh r0, [r4, 0x2] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x7F + ble _0802EF1A + movs r0, 0x39 + bl PlaySE + movs r0, 0 + strh r0, [r4, 0x2] + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] +_0802EF1A: + ldr r1, =gSineTable + movs r2, 0x2 + ldrsh r0, [r4, r2] + lsls r0, 1 + adds r0, r1 + ldrh r0, [r0] + lsls r0, 16 + asrs r0, 21 +_0802EF2A: + negs r0, r0 + strh r0, [r5, 0x26] + b _0802EF46 + .pool +_0802EF34: + ldrh r0, [r4, 0x2] + adds r0, 0x1 + strh r0, [r4, 0x2] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x28 + ble _0802EF46 + ldr r0, =SpriteCallbackDummy + str r0, [r5, 0x1C] +_0802EF46: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802EE5C + + thumb_func_start sub_802EF50 +sub_802EF50: @ 802EF50 + push {r4,lr} + sub sp, 0x10 + lsls r1, 16 + lsrs r1, 16 + ldr r2, =gUnknown_082FEBCC + ldr r3, [r2, 0x4] + ldr r2, [r2] + str r2, [sp] + str r3, [sp, 0x4] + ldr r2, =gUnknown_082FEBD4 + ldr r3, [r2, 0x4] + ldr r2, [r2] + str r2, [sp, 0x8] + str r3, [sp, 0xC] + lsls r0, 16 + ldr r3, =0x0000ffff + ldr r2, [sp, 0x4] + ands r2, r3 + orrs r2, r0 + str r2, [sp, 0x4] + ldr r2, =0xffff0000 + add r4, sp, 0x8 + ldr r0, [r4, 0x4] + ands r0, r2 + orrs r0, r1 + str r0, [r4, 0x4] + mov r0, sp + bl LoadCompressedObjectPic + adds r0, r4, 0 + bl LoadSpritePalette + add sp, 0x10 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_802EF50 + + thumb_func_start sub_802EFA8 +sub_802EFA8: @ 802EFA8 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x18 + mov r12, r3 + ldr r3, [sp, 0x30] + lsls r1, 16 + lsrs r1, 16 + lsls r3, 24 + lsrs r3, 24 + mov r8, r3 + mov r5, sp + ldr r4, =gUnknown_082FEC90 + ldm r4!, {r3,r6,r7} + stm r5!, {r3,r6,r7} + ldm r4!, {r3,r6,r7} + stm r5!, {r3,r6,r7} + mov r4, sp + strh r0, [r4] + mov r0, sp + strh r1, [r0, 0x2] + lsls r2, 16 + asrs r2, 16 + mov r0, r12 + lsls r6, r0, 16 + asrs r6, 16 + mov r0, sp + adds r1, r2, 0 + adds r2, r6, 0 + mov r3, r8 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + add sp, 0x18 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_802EFA8 + + thumb_func_start sub_802EFFC +sub_802EFFC: @ 802EFFC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + mov r12, r3 + ldr r6, [sp, 0x38] + ldr r3, [sp, 0x3C] + mov r9, r3 + ldr r4, [sp, 0x40] + mov r8, r4 + lsls r1, 16 + lsrs r1, 16 + lsls r6, 24 + lsrs r6, 24 + mov r10, r6 + mov r4, sp + ldr r3, =gUnknown_082FECA8 + ldm r3!, {r5-r7} + stm r4!, {r5-r7} + ldm r3!, {r5-r7} + stm r4!, {r5-r7} + mov r3, sp + strh r0, [r3] + mov r0, sp + strh r1, [r0, 0x2] + lsls r2, 16 + asrs r4, r2, 16 + ldr r0, =0xffe00000 + adds r2, r0 + asrs r2, 16 + mov r1, r12 + lsls r5, r1, 16 + asrs r5, 16 + mov r0, sp + adds r1, r2, 0 + adds r2, r5, 0 + mov r3, r10 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + mov r3, r9 + strh r0, [r3] + adds r4, 0x20 + lsls r4, 16 + asrs r4, 16 + mov r0, sp + adds r1, r4, 0 + adds r2, r5, 0 + mov r3, r10 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + mov r4, r8 + strh r0, [r4] + ldr r2, =gSprites + mov r5, r9 + movs r6, 0 + ldrsh r1, [r5, r6] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r1, [r0] + movs r3, 0x4 + orrs r1, r3 + strb r1, [r0] + movs r7, 0 + ldrsh r1, [r4, r7] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r1, [r0] + orrs r1, r3 + strb r1, [r0] + movs r0, 0 + ldrsh r1, [r4, r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r1, 0x1 + bl StartSpriteAnim + 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 sub_802EFFC + + .align 2, 0 @ don't pad with nop diff --git a/data/link.s b/data/link.s index f679e4b14..b5ff999b8 100644 --- a/data/link.s +++ b/data/link.s @@ -7,7 +7,6 @@ .align 2 - .align 2 gUnknown_082ED1FC:: @ 82ED1FC BgTemplate .4byte 0x000001F8 .4byte 0x00001081 @@ -22,4620 +21,3 @@ gUnknown_082ED204:: @ 82ED204 .align 2 gUnknown_082ED224:: @ 82ED224 .byte 0x00, 0x01, 0x02, 0x00, 0xff, 0xfe, 0xff, 0x00 - - .align 2 -gWirelessLinkIconPalette:: @ 82ED22C - .incbin "graphics/interface/wireless_link_icon.gbapal" - - .align 2 -gWirelessLinkIconPic:: @ 82ED22C - .incbin "graphics/interface/wireless_link_icon.4bpp.lz" - - .align 2 -gUnknown_082ED370:: @ 82ED370 - .byte 0xff, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37 - .byte 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f - .byte 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47 - .byte 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f - .byte 0x00, 0xab, 0xb5, 0xb6, 0xb1, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0xb2, 0xf1, 0x00, 0xae, 0xad, 0xba - .byte 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8 - .byte 0xa9, 0xaa, 0x00, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f - .byte 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1 - .byte 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9 - .byte 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1 - .byte 0xd2, 0xd3, 0xd4, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6 - .byte 0x00, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb - .byte 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3 - .byte 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb - .byte 0xec, 0xed, 0xee, 0x2d, 0x2f, 0x30, 0x31, 0x32 - .byte 0x33, 0x34, 0x35, 0x36, 0x50, 0x00, 0x01, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a - .byte 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 - .byte 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a - .byte 0x1b, 0xad, 0xb3, 0xb4, 0x00, 0xaf, 0x7d, 0x7f - .byte 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xa0 - .byte 0xae, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 - .byte 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f - .byte 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67 - .byte 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f - .byte 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77 - .byte 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7e, 0xb0, 0xac - .byte 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23 - .byte 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b - .byte 0x2c, 0x2e, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c - .byte 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94 - - .align 2 -gUnknown_082ED470:: @ 82ED470 - .byte 0x20, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c - .byte 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94 - .byte 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c - .byte 0x9d, 0x9e, 0x9f, 0xa0, 0xe0, 0xe1, 0xe2, 0xe3 - .byte 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb - .byte 0xec, 0xed, 0xee, 0xef, 0xf0, 0x7b, 0xf1, 0x7c - .byte 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x07 - .byte 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f - .byte 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 - .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f - .byte 0x84, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7 - .byte 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf - .byte 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 - .byte 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf - .byte 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7 - .byte 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xa6, 0xdd, 0xa7 - .byte 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xf2 - .byte 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa - .byte 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x01, 0x02, 0x03 - .byte 0x04, 0x05, 0x06, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f - .byte 0xaf, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 - .byte 0x37, 0x38, 0x39, 0x21, 0xdf, 0xa1, 0xb0, 0xa5 - .byte 0xde, 0x24, 0x2a, 0xa2, 0xa3, 0x22, 0x23, 0x20 - .byte 0xa4, 0x20, 0x2f, 0x41, 0x42, 0x43, 0x44, 0x45 - .byte 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d - .byte 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55 - .byte 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63 - .byte 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b - .byte 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73 - .byte 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20 - .byte 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 - - .align 2 -gUnknown_082ED570:: @ 82ED570 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082ED578:: @ 82ED578 - .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x0005, 0x0010, 0x000a - .2byte 0x000c, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED594:: @ 82ED594 - .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x000a, 0x0008, 0x0005 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED5A8:: @ 82ED5A8 - .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED5B4:: @ 82ED5B4 - .2byte 0x0004, 0x000a, 0x0014, 0x000a, 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED5C0:: @ 82ED5C0 - .2byte 0x0018, 0x000a, 0x0004, 0x000a, 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED5CC:: @ 82ED5CC - .4byte gUnknown_082ED578 - .4byte gUnknown_082ED594 - .4byte gUnknown_082ED5A8 - .4byte gUnknown_082ED5B4 - .4byte gUnknown_082ED5C0 - - .align 2 -gUnknown_082ED5E0:: @ 82ED5E0 - obj_tiles gWirelessLinkIconPic, 0x0380, 0xD431 - - .align 2 -gUnknown_082ED5E8:: @ 82ED5E8 - obj_pal gWirelessLinkIconPalette, 0xD432 - - .align 2 -gUnknown_082ED5F0:: @ 82ED5F0 - spr_template 0xD431, 0xD432, gUnknown_082ED570, gUnknown_082ED5CC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082ED608:: @ 82ED608 - .byte 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00 - .byte 0x14, 0x2b, 0x02, 0x02, 0x22, 0x2b, 0x02, 0x02 - .byte 0x01, 0x00, 0x58, 0x02, 0x2c, 0x01, 0x00, 0x00 - - .align 2 -gUnknown_082ED620:: @ 82ED620 - .byte 0x00, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082ED628:: @ 82ED628 - .4byte 0x00000000, 0x00000001, 0x00000003, 0x00000007 - .4byte 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f - .4byte 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff - .4byte 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff - .4byte 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff - .4byte 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff - .4byte 0x00ffffff - -gUnknown_082ED68C:: @ 82ED68C - .byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02 - .byte 0x03 - -gUnknown_082ED695:: @ 82ED695 - .byte 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03 - .byte 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04 - -gUnknown_082ED6A5:: @ 82ED6A5 - .byte 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00 - .byte 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00 - .byte 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082ED6B8:: @ 82ED6B8 - .4byte gUnknown_020228C4 - .4byte 0x000000c8 - .4byte gUnknown_020228C4 - .4byte 0x000000c8 - .4byte gUnknown_020228C4 - .4byte 0x00000064 - .4byte gUnknown_020228C4 - .4byte 0x000000dc - .4byte gUnknown_020228C4 - .4byte 0x00000028 - - .align 2 -gUnknown_082ED6E0:: @ 82ED6E0 - .2byte 0x0002, 0x7f7d, 0x0000, 0xffff - - .ascii "RFU WAIT" - .space 7 - - .ascii "RFU BOOT" - .space 7 - - .ascii "RFU ERROR" - .space 6 - - .ascii "RFU RESET" - .space 6 - - .ascii "RFU CONFIG" - .space 5 - - .ascii "RFU START" - .space 6 - - .ascii "RFU SC POLL" - .space 4 - - .ascii "RFU SP POLL" - .space 4 - - .ascii "RFU START" - .space 6 - - .ascii "RFU SEND ERR" - .space 3 - - .ascii "RFU CP POLL" - .space 4 - - .ascii " " - .space 2 - - .ascii "RECOVER START " - .space 2 - - .ascii "DISSCONECT " - .space 2 - - .ascii "RECOVER SUUSES" - .space 2 - - .ascii "RECOVER FAILED" - .space 2 - - .align 2 -gUnknown_082ED7E0:: @ 82ED7E0 - .4byte sub_801084C - .4byte sub_8010AAC - .4byte sub_8010D0C - - .align 2 -gUnknown_082ED7EC:: @ 82ED7EC - .ascii "PokemonSioInfo" - - .align 2 -gUnknown_082ED7FC:: @ 82ED7FC - .ascii "LINK LOSS DISCONNECT!" - - .align 2 -gUnknown_082ED814:: @ 82ED814 - .ascii "LINK LOSS RECOVERY NOW" - - .align 2 -gUnknown_082ED82C:: @ 82ED82C - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 - -gUnknown_082ED84B:: @ 82ED84B - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 - -gUnknown_082ED85B:: @ 82ED85B - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 - .byte 0x00, 0x20, 0x00, 0x2a, 0x00 - -gUnknown_082ED868:: @ 82ED868 - .asciz "NOWSLOT" - - .asciz " " - - .asciz "CLOCK DRIFT" - - .asciz "BUSY SEND " - - .asciz "CMD REJECT " - - .asciz "CLOCK SLAVE" - - .ascii "CHILD " - - .align 2 - .ascii "PARENT" - - .align 2 - .ascii "SEARCH" - - .align 2 -gText_EmptyString:: @ 82ED8C4 - .string "$" - - .align 2 -gText_Colon:: @ 82ED8C8 - .string ":$" - - .align 2 -gText_UnkCtrlCodeF907:: @ 82ED8CC - .string "{UNK_CTRL_F907}$" - - .align 2 -gText_PleaseStartOver:: @ 82ED8D0 - .string "Please start over from the beginning.$" - - .align 2 -gText_WirelessSearchCanceled:: @ 82ED8F8 - .string "The WIRELESS COMMUNICATION\nSYSTEM search has been canceled.$" - - .align 2 - .string "Awaiting communication\nfrom another player.$" - - .align 2 -gText_AwaitingCommunication:: @ 82ED960 - .string "{STR_VAR_1}! Awaiting\ncommunication from another player.$" - -gText_AwaitingLink:: @ 82ED990 - .string "{STR_VAR_1}! Awaiting link!\nPress START when everyone’s ready.$" - - .align 2 -gJPText_SingleBattle:: @ 82ED9C8 - .string "シングルバトルを かいさいする$" @ "shingurubatoruwo kaisaisuru" ("hold a single battle" in Japanese) - - .align 2 -gJPText_DoubleBattle:: @ 82ED9D8 - .string "ダブルバトルを かいさいする$" @ "daburubatoruwo kaisaisuru" ("hold a double battle" in Japanese) - - .align 2 -gJPText_MultiBattle:: @ 82ED9E8 - .string "マルチバトルを かいさいする$" @ "maruchibatoruwo kaisaisuru" ("hold a multi battle" in Japanese) - - .align 2 -gJPText_TradePokemon:: @ 82ED9F8 - .string "ポケモンこうかんを かいさいする$" @ "pokemonkoukanwo kaisaisuru" ("trade Pokémon" in Japanese) - - .align 2 -gJPText_Chat:: @ 82EDA0C - .string "チャットを かいさいする$" @ "chattowo kaisaisuru" ("chat" in Japanese) - - .align 2 -gJPText_DistWonderCard:: @ 82EDA1C - .string "ふしぎなカードをくばる$" @ "fushiginakaadowokubaru" ("distribute Wonder Card" in Japanese) - - .align 2 -gJPText_DistWonderNews:: @ 82EDA28 - .string "ふしぎなニュースをくばる$" @ "fushiginanyuusuwokubaru" ("distribute Wonder News" in Japanese) - - .align 2 - .string "ふしぎなできごとを かいさいする$" @ "fushiginadekigotowo kaisaisuru" ("hold a session of Mystery Event" in Japanese) - - .align 2 -gJPText_HoldPokemonJump:: @ 82EDA4C - .string "なわとびを かいさいする$" @ "nawatobiwo kaisaisuru" ("hold a session of Jump" in Japanese) - - .align 2 -gJPText_HoldBerryCrush:: @ 82EDA5C - .string "きのみマッシャーを かいさいする$" @ "kinomimassha-wo kaisaisuru" ("hold a session of Berry Masher" in Japanese) - - .align 2 -gJPText_HoldBerryPicking:: @ 82EDA70 - .string "きのみどりを かいさいする$" @ "kinomidoriwo kaisaisuru" ("hold a session of Berry Picking" in Japanese) - - .align 2 -gJPText_HoldSpinTrade:: @ 82EDA80 - .string "ぐるぐるこうかんを かいさいする$" @ "gurugurukoukanwo kaisaisuru" ("hold a session of Spin Trade" in Japanese) - - .align 2 -gJPText_HoldSpinShop:: @ 82EDA94 - .string "ぐるぐるショップを かいさいする$" @ "gurugurushoppuwo kaisaisuru" ("hold a session of Spin Shop" in Japanese) - - .align 2 - .4byte gJPText_SingleBattle - .4byte gJPText_DoubleBattle - .4byte gJPText_MultiBattle - .4byte gJPText_TradePokemon - .4byte gJPText_Chat - .4byte gJPText_DistWonderCard - .4byte gJPText_DistWonderNews - .4byte gJPText_DistWonderCard - .4byte gJPText_HoldPokemonJump - .4byte gJPText_HoldBerryCrush - .4byte gJPText_HoldBerryPicking - .4byte gJPText_HoldBerryPicking - .4byte gJPText_HoldSpinTrade - .4byte gJPText_HoldSpinShop - -gText_1PlayerNeeded:: @ 82EDAE0 - .string "1 player\nneeded.$" - -gText_2PlayersNeeded:: @ 82EDAF1 - .string "2 players\nneeded.$" - -gText_3PlayersNeeded:: @ 82EDB03 - .string "3 players\nneeded.$" - -gText_4PlayersNeeded:: @ 82EDB15 - .string "4 players\nneeded.$" - -gText_2PlayerMode:: @ 82EDB27 - .string "2-PLAYER\nMODE$" - -gText_3PlayerMode:: @ 82EDB35 - .string "3-PLAYER\nMODE$" - -gText_4PlayerMode:: @ 82EDB43 - .string "4-PLAYER\nMODE$" - -gText_5PlayerMode:: @ 82EDB51 - .string "5-PLAYER\nMODE$" - - .align 2 -gUnknown_082EDB60:: @ 82EDB60 - .4byte gText_1PlayerNeeded - .4byte gText_2PlayerMode - .4byte NULL - .4byte NULL - .4byte NULL - .4byte gText_3PlayersNeeded - .4byte gText_2PlayersNeeded - .4byte gText_1PlayerNeeded - .4byte gText_4PlayerMode - .4byte NULL - .4byte gText_1PlayerNeeded - .4byte gText_2PlayerMode - .4byte gText_3PlayerMode - .4byte gText_4PlayerMode - .4byte gText_5PlayerMode - .4byte gText_2PlayersNeeded - .4byte gText_1PlayerNeeded - .4byte gText_3PlayerMode - .4byte gText_4PlayerMode - .4byte gText_5PlayerMode - .4byte gText_1PlayerNeeded - .4byte gText_2PlayerMode - .4byte gText_3PlayerMode - .4byte gText_4PlayerMode - .4byte NULL - - .align 2 -gUnknown_082EDBC4:: @ 82EDBC4 - .string "{UNK_CTRL_F801}CANCEL$" - - .align 2 - .string "ため\nさんかしゃ ぼしゅうちゅう です!$" @ "tame\nsankasha boshuuchuu desu!" - - .align 2 -gUnknown_082EDBE8:: @ 82EDBE8 - .string "{STR_VAR_2} contacted you for\n{STR_VAR_1}. Accept?$" - - .align 2 -gUnknown_082EDC0C:: @ 82EDC0C - .string "{STR_VAR_2} contacted you.\nWill you share {STR_VAR_1}?$" - - .align 2 -gUnknown_082EDC34:: @ 82EDC34 - .string "{STR_VAR_2} contacted you.\nAdd to the members?$" - - .align 2 -gUnknown_082EDC5C:: @ 82EDC5C - .string "{STR_VAR_1}!\nAre these members OK?$" - - .align 2 -gUnknown_082EDC78:: @ 82EDC78 - .string "Cancel {STR_VAR_1} MODE\nwith these members?$" - - .align 2 -gUnknown_082EDC9C:: @ 82EDC9C - .string "An “OK” was sent\nto {STR_VAR_1}.$" - - .align 2 -gUnknown_082EDCB4:: @ 82EDCB4 - .string "The other TRAINER doesn’t appear\nto be available now…\p$" - - .align 2 -gUnknown_082EDCEC:: @ 82EDCEC - .string "You can’t transmit with a TRAINER\nwho is too far away.\p$" - - .align 2 -gUnknown_082EDD24:: @ 82EDD24 - .string "The other TRAINER(S) is/are not\nready yet.\p$" - - .align 2 -gUnknown_082EDD50:: @ 82EDD50 - .4byte gUnknown_082EDCEC - .4byte gUnknown_082EDD24 - - .align 2 -gUnknown_082EDD58:: @ 82EDD58 - .string "The {STR_VAR_1} MODE with\nthese members will be canceled.{PAUSE 60}$" - - .align 2 -gUnknown_082EDD8C:: @ 82EDD8C - .string "There is a member who can no\nlonger remain available.\p$" - - .align 2 -gUnknown_082EDDC4:: @ 82EDDC4 - .4byte gUnknown_082EDCB4 - .4byte gUnknown_082EDD8C - - .align 2 -gUnknown_082EDDCC:: @ 82EDDCC - .string "The other TRAINER appears\nunavailable…\p$" - - .align 2 -gUnknown_082EDDF4:: @ 82EDDF4 - .string "{STR_VAR_1} sent back an “OK”!$" - - .align 2 -gUnknown_082EDE0C:: @ 82EDE0C - .string "{STR_VAR_1} OK’d your registration as\na member.$" - - .align 2 -gUnknown_082EDE34:: @ 82EDE34 - .string "{STR_VAR_1} replied, “No…”\p$" - - .align 2 -gUnknown_082EDE48:: @ 82EDE48 - .string "{STR_VAR_1}!\nAwaiting other members!$" - - .align 2 -gUnknown_082EDE64:: @ 82EDE64 - .string "Quit being a member?$" - - .align 2 -gUnknown_082EDE7C:: @ 82EDE7C - .string "You stopped being a member.\p$" - - .align 2 -gUnknown_082EDE9C:: @ 82EDE9C - .4byte NULL - .4byte gUnknown_082EDD8C - .4byte gUnknown_082EDDCC - .4byte NULL - .4byte NULL - .4byte NULL - .4byte gUnknown_082EDE34 - .4byte NULL - .4byte NULL - .4byte gUnknown_082EDE7C - - .align 2 -gUnknown_082EDEC4:: @ 82EDEC4 - .string "The WIRELESS COMMUNICATION\nSYSTEM link has been established.$" - - .align 2 -gUnknown_082EDF04:: @ 82EDF04 - .string "The WIRELESS COMMUNICATION\nSYSTEM link has been dropped…$" - - .align 2 -gUnknown_082EDF40:: @ 82EDF40 - .string "The link with your friend has been\ndropped…$" - - .align 2 -gUnknown_082EDF6C:: @ 82EDF6C - .string "{STR_VAR_1} replied, “No…”$" - - .align 2 -gUnknown_082EDF80:: @ 82EDF80 - .4byte NULL - .4byte gUnknown_082EDF40 - .4byte gUnknown_082EDF40 - .4byte NULL - .4byte NULL - .4byte NULL - .4byte gUnknown_082EDF6C - .4byte NULL - .4byte NULL - .4byte NULL - - .align 2 -gUnknown_082EDFA8:: @ 82EDF80 - .string "Do you want the {STR_VAR_2}\nMODE?$" - - .align 2 -gUnknown_082EDFC4:: @ 82EDFC4 - .string "Do you want the {STR_VAR_2}\nMODE?$" - - .align 2 - .4byte gUnknown_082EDFA8 - .4byte gUnknown_082EDFC4 - - .align 2 - .string "Communicating…\nPlease wait.$" - - .align 2 -gUnknown_082EE004:: @ 82EE004 - .string "Awaiting {STR_VAR_1}’s response about\nthe trade…$" - - .align 2 -gUnknown_082EE02C:: @ 82EE02C - .string "Communicating{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" - - .align 2 -gUnknown_082EE098:: @ 82EE098 - .string "Communicating with {STR_VAR_1}{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" - - .align 2 -gUnknown_082EE104:: @ 82EE104 - .string "Please wait a while{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" - - .align 2 -gUnknown_082EE17C:: @ 82EE17C - .4byte gUnknown_082EE02C - .4byte gUnknown_082EE098 - .4byte gUnknown_082EE104 - - .align 2 -gUnknown_082EE188:: @ 82EE188 - .string "Hiya! Is there something that you\nwanted to do?$" - - .align 2 -gUnknown_082EE1B8:: @ 82EE1B8 - .string "Hello!\nWould you like to do something?$" - - .align 2 -gUnknown_082EE1E0:: @ 82EE1E0 - .string "{STR_VAR_1}: Hiya, we meet again!\nWhat are you up for this time?$" - - .align 2 -gUnknown_082EE218:: @ 82EE218 - .string "{STR_VAR_1}: Oh! {PLAYER}, hello!\nWould you like to do something?$" - - .align 2 -gUnknown_082EE24C:: @ 82EE24C - .4byte gUnknown_082EE188 - .4byte gUnknown_082EE1B8 - .4byte gUnknown_082EE1E0 - .4byte gUnknown_082EE218 - - .align 2 -gUnknown_082EE25C:: @ 82EE25C - .string "Want to do something?$" - - .align 2 -gUnknown_082EE274:: @ 82EE274 - .string "Would you like to do something?$" - - .align 2 -gUnknown_082EE294:: @ 82EE294 - .string "{STR_VAR_1}: What would you like to\ndo now?$" - - .align 2 - .string "{STR_VAR_1}: Want to do anything else?$" - - .align 2 - .4byte gUnknown_082EE25C - .4byte gUnknown_082EE274 - .4byte gUnknown_082EE294 - .4byte gUnknown_082EE294 - - .align 2 -gUnknown_082EE2E8:: @ 82EE2E8 - .string "Somebody has contacted you.{PAUSE 60}$" - - .align 2 -gUnknown_082EE308:: @ 82EE308 - .string "{STR_VAR_1} has contacted you.{PAUSE 60}$" - - .align 2 -gUnknown_082EE324:: @ 82EE324 - .4byte gUnknown_082EE2E8 - .4byte gUnknown_082EE308 - - .align 2 -gUnknown_082EE32C:: @ 82EE32C - .string "Awaiting a response from\nthe other TRAINER…$" - - .align 2 -gUnknown_082EE358:: @ 82EE358 - .string "Awaiting a response from\n{STR_VAR_1}…$" - - .align 2 -gUnknown_082EE378:: @ 82EE378 - .4byte gUnknown_082EE32C - .4byte gUnknown_082EE358 - - .align 2 -gUnknown_082EE380:: @ 82EE380 - .string "The other TRAINER showed\nyou their TRAINER CARD.\pWould you like to show your\nTRAINER CARD?$" - - .align 2 -gUnknown_082EE3DC:: @ 82EE3DC - .string "The other TRAINER challenges you\nto battle.\pWill you accept the battle\nchallenge?$" - - .align 2 -gUnknown_082EE430:: @ 82EE430 - .string "The other TRAINER invites you\nto chat.\pWill you accept the chat\ninvitation?$" - - .align 2 -gUnknown_082EE47C:: @ 82EE47C - .string "There is an offer to trade your\nregistered Lv. {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}\pin exchange for a\nLv. {SPECIAL_F7 0x02} {SPECIAL_F7 0x03}.\pWill you accept this trade\noffer?$" - - .align 2 -gUnknown_082EE4F0:: @ 82EE4F0 - .string "There is an offer to trade your\nregistered EGG.\lWill you accept this trade offer?$" - - .align 2 -gUnknown_082EE544:: @ 82EE544 - .string "The chat has been dropped.\p$" - - .align 2 -gUnknown_082EE560:: @ 82EE560 - .string "You declined the offer.\p$" - - .align 2 -gUnknown_082EE57C:: @ 82EE57C - .string "You declined the offer.\p$" - - .align 2 -gUnknown_082EE598:: @ 82EE598 - .string "The chat was ended.\p$" - - .align 2 - .4byte gUnknown_082EE380 - .4byte gUnknown_082EE3DC - .4byte gUnknown_082EE430 - .4byte gUnknown_082EE47C - - .align 2 -gUnknown_082EE5C0:: @ 82EE5C0 - .string "Oh, hey! We’re in a chat right now.\nWant to join us?$" - - .align 2 -gUnknown_082EE5F8:: @ 82EE5F8 - .string "{STR_VAR_1}: Hey, {PLAYER}!\nWe’re having a chat right now.\lWant to join us?$" - - .align 2 -gUnknown_082EE638:: @ 82EE638 - .string "Oh, hi! We’re having a chat now.\nWould you like to join us?$" - - .align 2 -gUnknown_082EE674:: @ 82EE674 - .string "{STR_VAR_1}: Oh, hi, {PLAYER}!\nWe’re having a chat now.\lWould you like to join us?$" - - .align 2 -gUnknown_082EE6B8:: @ 82EE6B8 - .4byte gUnknown_082EE5C0 - .4byte gUnknown_082EE638 - .4byte gUnknown_082EE5F8 - .4byte gUnknown_082EE674 - - .align 2 -gUnknown_082EE6C8:: @ 82EE6C8 - .string "……\nThe TRAINER appears to be busy…\p$" - - .align 2 -gUnknown_082EE6EC:: @ 82EE6EC - .string "A battle, huh?\nAll right, just give me some time.$" - - .align 2 -gUnknown_082EE720:: @ 82EE720 - .string "You want to chat, huh?\nSure, just wait a little.$" - - .align 2 -gUnknown_082EE754:: @ 82EE754 - .string "Sure thing! As my “Greetings,”\nhere’s my TRAINER CARD.$" - - .align 2 -gUnknown_082EE78C:: @ 82EE78C - .string "A battle? Of course, but I need\ntime to get ready.$" - - .align 2 -gUnknown_082EE7C0:: @ 82EE7C0 - .string "Did you want to chat?\nOkay, but please wait a moment.$" - - .align 2 -gUnknown_082EE7F8:: @ 82EE7F8 - .string "As my introduction, I’ll show you\nmy TRAINER CARD.$" - - .align 2 -gUnknown_082EE82C:: @ 82EE82C - .4byte gUnknown_082EE6EC - .4byte gUnknown_082EE720 - .4byte NULL - .4byte gUnknown_082EE754 - .4byte gUnknown_082EE78C - .4byte gUnknown_082EE7C0 - .4byte NULL - .4byte gUnknown_082EE7F8 - - .align 2 - .string "You want to chat, huh?\nSure, just wait a little.$" - - .align 2 -gUnknown_082EE880:: @ 82EE880 - .string "Thanks for waiting!\nLet’s get our battle started!{PAUSE 60}$" - - .align 2 -gUnknown_082EE8B8:: @ 82EE880 - .string "All right!\nLet’s chat!{PAUSE 60}$" - - .align 2 -gUnknown_082EE8D4:: @ 82EE8D4 - .string "Sorry I made you wait!\nLet’s get started!{PAUSE 60}$" - - .align 2 -gUnknown_082EE904:: @ 82EE904 - .string "Sorry I made you wait!\nLet’s chat.{PAUSE 60}$" - - .align 2 -gUnknown_082EE92C:: @ 82EE92C - .string "The trade will be started.{PAUSE 60}$" - - .align 2 -gUnknown_082EE94C:: @ 82EE94C - .string "The battle will be started.{PAUSE 60}$" - - .align 2 -gUnknown_082EE96C:: @ 82EE96C - .string "Entering the chat…{PAUSE 60}$" - - .align 2 -gUnknown_082EE984:: @ 82EE984 - .4byte gUnknown_082EE94C - .4byte gUnknown_082EE96C - .4byte gUnknown_082EE92C - .4byte gUnknown_082EE94C - .4byte gUnknown_082EE96C - .4byte gUnknown_082EE92C - .4byte gUnknown_082EE880 - .4byte gUnknown_082EE8B8 - .4byte gUnknown_082EE92C - .4byte gUnknown_082EE8D4 - .4byte gUnknown_082EE904 - .4byte gUnknown_082EE92C - - .align 2 -gUnknown_082EE9B4:: @ 82EE9B4 - .string "Sorry! My POKéMON don’t seem to\nbe feeling too well right now.\lLet me battle you another time.\p$" - - .align 2 -gUnknown_082EEA14:: @ 82EEA14 - .string "I’m terribly sorry, but my POKéMON\naren’t feeling well…\pLet’s battle another time.\p$" - - .align 2 -gUnknown_082EEA68:: @ 82EEA68 - .4byte gUnknown_082EE9B4 - .4byte gUnknown_082EEA14 - - .align 2 -gUnknown_082EEA70:: @ 82EEA70 - .string "Huh? My TRAINER CARD…\nWhere’d it go now?\lSorry! I’ll show you another time!\p$" - - .align 2 -gUnknown_082EEAC0:: @ 82EEAC0 - .string "Oh? Now where did I put my\nTRAINER CARD?…\lSorry! I’ll show you later!\p$" - - .align 2 -gUnknown_082EEB08:: @ 82EEB08 - .4byte gUnknown_082EEA70 - .4byte gUnknown_082EEAC0 - - .align 2 -gUnknown_082EEB10:: @ 82EEB10 - .string "If you want to do something with\nme, just give me a shout!\p$" - - .align 2 -gUnknown_082EEB4C:: @ 82EEB4C - .string "If you want to do something with\nme, don’t be shy.\p$" - - .align 2 -gUnknown_082EEB80:: @ 82EEB80 - .4byte gUnknown_082EEB10 - .4byte gUnknown_082EEB4C - - .align 2 -gUnknown_082EEB88:: @ 82EEB88 - .string "Whoops! Sorry, but I have to do\nsomething else.\lAnother time, okay?\p$" - - .align 2 -gUnknown_082EEBD0:: @ 82EEBD0 - .string "If you want to battle, you need\ntwo POKéMON that are below\lLv. 30.\p$" - - .align 2 -gUnknown_082EEC14:: @ 82EEC14 - .string "For a battle, you need two\nPOKéMON that are below Lv. 30.\p$" - - .align 2 -gUnknown_082EEC50:: @ 82EEC50 - .string "Oh, all right.\nCome see me anytime, okay?\p$" - - .align 2 -gUnknown_082EEC7C:: @ 82EEC7C - .string "Oh…\nPlease come by anytime.\p$" - - .align 2 -gUnknown_082EEC9C:: @ 82EEC9C - .4byte gUnknown_082EEC50 - .4byte gUnknown_082EEC7C - - .align 2 -gUnknown_082EECA4:: @ 82EECA4 - .string "Oh, sorry!\nI just can’t right this instant.\lLet’s chat another time.\p$" - - .align 2 -gUnknown_082EECEC:: @ 82EECEC - .string "Oh, I’m sorry.\nI have too much to do right now.\lLet’s chat some other time.\p$" - - .align 2 -gUnknown_082EED3C:: @ 82EED3C - .4byte gUnknown_082EECA4 - .4byte gUnknown_082EECEC - - .align 2 -gUnknown_082EED44:: @ 82EED3C - .string "Whoa!\nI can tell you’re pretty tough!\p$" - - .align 2 -gUnknown_082EED6C:: @ 82EED6C - .string "You used that move?\nThat’s good strategy!\p$" - - .align 2 -gUnknown_082EED98:: @ 82EED98 - .string "Way to go!\nThat was an eye-opener!\p$" - - .align 2 -gUnknown_082EEDBC:: @ 82EEDBC - .string "Oh! How could you use that\nPOKéMON in that situation?\p$" - - .align 2 -gUnknown_082EEDF4:: @ 82EEDF4 - .string "That POKéMON…\nIt’s been raised really well!\p$" - - .align 2 -gUnknown_082EEE24:: @ 82EEE24 - .string "That’s it!\nThis is the right move now!\p$" - - .align 2 -gUnknown_082EEE4C:: @ 82EEE4C - .string "That’s awesome!\nYou can battle that way?\p$" - - .align 2 -gUnknown_082EEE78:: @ 82EEE78 - .string "You have exquisite timing for\nswitching POKéMON!\p$" - - .align 2 -gUnknown_082EEEAC:: @ 82EEEAC - .4byte gUnknown_082EED44 - .4byte gUnknown_082EED6C - .4byte gUnknown_082EED98 - .4byte gUnknown_082EEDBC - .4byte gUnknown_082EEDF4 - .4byte gUnknown_082EEE24 - .4byte gUnknown_082EEE4C - .4byte gUnknown_082EEE78 - - .align 2 -gUnknown_082EEECC:: @ 82EEECC - .string "Oh, I see!\nThis is educational!\p$" - - .align 2 -gUnknown_082EEEF0:: @ 82EEEF0 - .string "Don’t say anything funny anymore!\nI’m sore from laughing!\p$" - - .align 2 -gUnknown_082EEF2C:: @ 82EEF2C - .string "Oh?\nSomething like that happened.\p$" - - .align 2 -gUnknown_082EEF50:: @ 82EEF50 - .string "Hmhm… What?\nSo is this what you’re saying?\p$" - - .align 2 -gUnknown_082EEF7C:: @ 82EEF7C - .string "Is that right?\nI didn’t know that.\p$" - - .align 2 -gUnknown_082EEFA0:: @ 82EEFA0 - .string "Ahaha!\nWhat is that about?\p$" - - .align 2 -gUnknown_082EEFBC:: @ 82EEFBC - .string "Yes, that’s exactly it!\nThat’s what I meant.\p$" - - .align 2 -gUnknown_082EEFEC:: @ 82EEFEC - .string "In other words…\nYes! That’s right!\p$" - - .align 2 -gUnknown_082EF010:: @ 82EF010 - .4byte gUnknown_082EEECC - .4byte gUnknown_082EEEF0 - .4byte gUnknown_082EEF2C - .4byte gUnknown_082EEF50 - .4byte gUnknown_082EEF7C - .4byte gUnknown_082EEFA0 - .4byte gUnknown_082EEFBC - .4byte gUnknown_082EEFEC - - .align 2 -gUnknown_082EF030:: @ 82EF030 - .string "I’m just showing my TRAINER CARD\nas my way of greeting.\p$" - - .align 2 -gUnknown_082EF06C:: @ 82EF06C - .string "I hope I get to know you better!\p$" - - .align 2 -gUnknown_082EF090:: @ 82EF010 - .string "We’re showing each other our\nTRAINER CARDS to get acquainted.\p$" - - .align 2 -gUnknown_082EF0D0:: @ 82EF0D0 - .string "Glad to meet you.\nPlease don’t be a stranger!\p$" - - .align 2 -gUnknown_082EF100:: @ 82EF100 - .4byte gUnknown_082EF030 - .4byte gUnknown_082EF06C - .4byte gUnknown_082EF090 - .4byte gUnknown_082EF0D0 - - .align 2 -gUnknown_082EF110:: @ 82EF110 - .string "Yeahah!\nI really wanted this POKéMON!\p$" - - .align 2 -gUnknown_082EF138:: @ 82EF138 - .string "Finally, a trade got me that\nPOKéMON I’d wanted a long time.\p$" - - .align 2 -gUnknown_082EF178:: @ 82EF178 - .string "I’m trading POKéMON right now.\p$" - - .align 2 -gUnknown_082EF198:: @ 82EF198 - .string "I finally got that POKéMON I\nwanted in a trade!\p$" - - .align 2 -gUnknown_082EF1CC:: @ 82EF1CC - .4byte gUnknown_082EF110 - .4byte gUnknown_082EF138 - .4byte NULL - .4byte NULL - .4byte gUnknown_082EF178 - .4byte gUnknown_082EF198 - .4byte NULL - .4byte NULL - - .align 2 -gUnknown_082EF1EC:: @ 82EF1EC - .string "{STR_VAR_1} checked the\nTRADING BOARD.\p$" - - .align 2 -gUnknown_082EF20C:: @ 82EF20C - .string "Welcome to the TRADING BOARD.\pYou may register your POKéMON\nand offer it up for a trade.\pWould you like to register one of\nyour POKéMON?$" - - .align 2 -gUnknown_082EF298:: @ 82EF298 - .string "This TRADING BOARD is used for\noffering a POKéMON for a trade.\pAll you need to do is register a\nPOKéMON for a trade.\pAnother TRAINER may offer a party\nPOKéMON in return for the trade.\pWe hope you will register POKéMON\nand trade them with many, many\lother TRAINERS.\pWould you like to register one of\nyour POKéMON?$" - - .align 2 - .string "We have registered your POKéMON for\ntrade on the TRADING BOARD.\pThank you for using this service!\p$" - - .align 2 - .string "Nobody has registered any POKéMON\nfor trade on the TRADING BOARD.\p\n$" - - .align 2 -gUnknown_082EF47C:: @ 82EF47C - .string "Please choose the type of POKéMON\nthat you would like in the trade.\n$" - - .align 2 -gUnknown_082EF4C4:: @ 82EF4C4 - .string "Which of your party POKéMON will\nyou offer in trade?\p$" - - .align 2 -gUnknown_082EF4FC:: @ 82EF4FC - .string "Registration has been canceled.\p$" - - .align 2 -gUnknown_082EF520:: @ 82EF520 - .string "Registration has been completed.\p$" - - .align 2 -gUnknown_082EF544:: @ 82EF544 - .string "The trade has been canceled.\p$" - - .align 2 -gUnknown_082EF564:: @ 82EF564 - .string "Cancel the registration of your\nLv. {STR_VAR_2} {STR_VAR_1}?$" - - .align 2 -gUnknown_082EF590:: @ 82EF590 - .string "Cancel the registration of your\nEGG?$" - - .align 2 -gUnknown_082EF5B8:: @ 82EF5B8 - .string "The registration has been canceled.\p$" - - .align 2 - .string "TRAINERS wishing to make a trade\nwill be listed.$" - - .align 2 - .string "Please choose the TRAINER with whom\nyou would like to trade POKéMON.$" - - .align 2 -gUnknown_082EF65C:: @ 82EF65C - .string "Would you like to ask {STR_VAR_1} to\nmake a trade?$" - - .align 2 - .string "Awaiting a response from\nthe other TRAINER…$" - - .align 2 - .string "You have not registered a POKéMON\nfor trading.\p$" - - .align 2 -gUnknown_082EF6E4:: @ 82EF6E4 - .string "You don’t have a {STR_VAR_2}-type\nPOKéMON that {STR_VAR_1} wants.\p$" - - .align 2 -gUnknown_082EF718:: @ 82EF718 - .string "You don’t have an EGG that\n{STR_VAR_1} wants.\p$" - - .align 2 -gUnknown_082EF740:: @ 82EF740 - .string "{STR_VAR_1} can’t make a trade for\nyour POKéMON right now.\p$" - - .align 2 -gUnknown_082EF774:: @ 82EF774 - .string "You can’t make a trade for\n{STR_VAR_1}’s POKéMON right now.\p$" - - .align 2 - .4byte gUnknown_082EF740 - .4byte gUnknown_082EF774 - - .align 2 -gUnknown_082EF7B0:: @ 82EF7B0 - .string "Your trade offer was rejected.\p$" - - .align 2 -gUnknown_082EF7D0:: @ 82EF7D0 - .string "EGG TRADE$" - - .align 2 -gUnknown_082EF7DC:: @ 82EF7DC - .string "{UNK_CTRL_F80A}CHOOSE {UNK_CTRL_F800}JOIN {UNK_CTRL_F801}CANCEL$" - - .align 2 -gUnknown_082EF7F8:: @ 82EF7F8 - .string "Please choose a TRAINER.$" - - .align 2 -gUnknown_082EF814:: @ 82EF814 - .string "Please choose a TRAINER for\na SINGLE BATTLE.$" - - .align 2 -gUnknown_082EF844:: @ 82EF844 - .string "Please choose a TRAINER for\na DOUBLE BATTLE.$" - - .align 2 -gUnknown_082EF874:: @ 82EF874 - .string "Please choose the LEADER\nfor a MULTI BATTLE.$" - - .align 2 -gUnknown_082EF8A4:: @ 82EF8A4 - .string "Please choose the TRAINER to\ntrade with.$" - - .align 2 -gUnknown_082EF8D0:: @ 82EF8D0 - .string "Please choose the TRAINER who is\nsharing WONDER CARDS.$" - - .align 2 -gUnknown_082EF908:: @ 82EF908 - .string "Please choose the TRAINER who is\nsharing WONDER NEWS.$" - - .align 2 -gUnknown_082EF940:: @ 82EF940 - .string "Jump with mini POKéMON!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EF974:: @ 82EF974 - .string "BERRY CRUSH!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EF99C:: @ 82EF974 - .string "DODRIO BERRY-PICKING!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EF9CC:: @ 82EF9CC - .string "BERRY BLENDER!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EF9F8:: @ 82EF9F8 - .string "RECORD CORNER!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFA24:: @ 82EFA24 - .string "COOLNESS CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFA50:: @ 82EFA50 - .string "BEAUTY CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFA7C:: @ 82EFA7C - .string "CUTENESS CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFAA8:: @ 82EFAA8 - .string "SMARTNESS CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFAD8:: @ 82EFAD8 - .string "TOUGHNESS CONTEST!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFB08:: @ 82EFB08 - .string "BATTLE TOWER LEVEL 50!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFB3C:: @ 82EFB3C - .string "BATTLE TOWER OPEN LEVEL!\nPlease choose the LEADER.$" - - .align 2 -gUnknown_082EFB70:: @ 82EFB70 - .4byte gUnknown_082EF814 - .4byte gUnknown_082EF844 - .4byte gUnknown_082EF874 - .4byte gUnknown_082EF8A4 - .4byte gUnknown_082EF940 - .4byte gUnknown_082EF974 - .4byte gUnknown_082EF99C - .4byte gUnknown_082EF8D0 - .4byte gUnknown_082EF908 - .4byte NULL - .4byte NULL - .4byte NULL - .4byte gUnknown_082EF9F8 - .4byte gUnknown_082EF9CC - .4byte NULL - .4byte gUnknown_082EFA24 - .4byte gUnknown_082EFA50 - .4byte gUnknown_082EFA7C - .4byte gUnknown_082EFAA8 - .4byte gUnknown_082EFAD8 - .4byte gUnknown_082EFB08 - .4byte gUnknown_082EFB3C - - .align 2 -gUnknown_082EFBC8:: @ 82EFBC8 - .string "Searching for a WIRELESS\nCOMMUNICATION SYSTEM. Wait...$" - - .align 2 - .string "For a DOUBLE BATTLE, you must have\nat least two POKéMON.\p$" - - .align 2 -gUnknown_082EFC3C:: @ 82EFC3C - .string "Awaiting {STR_VAR_1}’s response…$" - - .align 2 -gUnknown_082EFC54:: @ 82EFC54 - .string "{STR_VAR_1} has been asked to register\nyou as a member. Please wait.$" - - .align 2 -gUnknown_082EFC90:: @ 82EFC90 - .string "Awaiting a response from the\nWIRELESS COMMUNICATION SYSTEM.$" - - .align 2 - .string "Please wait for other TRAINERS to\ngather and get ready.$" - - .align 2 -gUnknown_082EFD04:: @ 82EFD04 - .string "No CARDS appear to be shared \nright now.$" - - .align 2 -gUnknown_082EFD30:: @ 82EFD30 - .string "No NEWS appears to be shared\nright now.$" - - .align 2 -gUnknown_082EFD58:: @ 82EFD58 - .4byte gUnknown_082EFD04 - .4byte gUnknown_082EFD30 - - .align 2 -gUnknown_082EFD60:: @ 82EFD60 - .string "BATTLE$" - - .align 2 -gUnknown_082EFD68:: @ 82EFD68 - .string "CHAT$" - - .align 2 -gUnknown_082EFD70:: @ 82EFD70 - .string "GREETINGS$" - - .align 2 -gUnknown_082EFD7C:: @ 82EFD7C - .string "EXIT$" - - .align 2 -gUnknown_082EFD84:: @ 82EFD84 - .string "EXIT$" - - .align 2 -gUnknown_082EFD8C:: @ 82EFD8C - .string "INFO$" - - .align 2 -gUnknown_082EFD94:: @ 82EFD94 - .string "NAME{CLEAR_TO 0x3C}WANTED{CLEAR_TO 0x6E}OFFER{CLEAR_TO 0xC6}LV.$" - - .align 2 -gUnknown_082EFDB0:: @ 82EFDB0 - .string "SINGLE BATTLE$" - - .align 2 -gUnknown_082EFDC0:: @ 82EFDC0 - .string "DOUBLE BATTLE$" - - .align 2 -gUnknown_082EFDD0:: @ 82EFDD0 - .string "MULTI BATTLE$" - - .align 2 -gUnknown_082EFDE0:: @ 82EFDE0 - .string "POKéMON TRADES$" - - .align 2 -gUnknown_082EFDF0:: @ 82EFDF0 - .string "CHAT$" - - .align 2 -gUnknown_082EFDF8:: @ 82EFDF8 - .string "CARDS$" - - .align 2 -gUnknown_082EFE00:: @ 82EFE00 - .string "WONDER CARDS$" - - .align 2 -gUnknown_082EFE10:: @ 82EFE10 - .string "WONDER NEWS$" - - .align 2 -gUnknown_082EFE1C:: @ 82EFE1C - .string "POKéMON JUMP$" - - .align 2 -gUnknown_082EFE2C:: @ 82EFE2C - .string "BERRY CRUSH$" - - .align 2 -gUnknown_082EFE38:: @ 82EFE38 - .string "BERRY-PICKING$" - - .align 2 -gUnknown_082EFE48:: @ 82EFE48 - .string "SEARCH$" - - .align 2 -gUnknown_082EFE50:: @ 82EFE50 - .string "BERRY BLENDER$" - - .align 2 -gUnknown_082EFE60:: @ 82EFE60 - .string "RECORD CORNER$" - - .align 2 -gUnknown_082EFE70:: @ 82EFE70 - .string "COOL CONTEST$" - - .align 2 -gUnknown_082EFE80:: @ 82EFE80 - .string "BEAUTY CONTEST$" - - .align 2 -gUnknown_082EFE90:: @ 82EFE90 - .string "CUTE CONTEST$" - - .align 2 -gUnknown_082EFEA0:: @ 82EFEA0 - .string "SMART CONTEST$" - - .align 2 -gUnknown_082EFEB0:: @ 82EFEB0 - .string "TOUGH CONTEST$" - - .align 2 -gUnknown_082EFEC0:: @ 82EFEC0 - .string "BATTLE TOWER LV. 50$" - - .align 2 -gUnknown_082EFED4:: @ 82EFED4 - .string "BATTLE TOWER OPEN LEVEL$" - - .align 2 -gUnknown_082EFEEC:: @ 82EFEEC - .string "It’s a NORMAL CARD.$" - - .align 2 -gUnknown_082EFF00:: @ 82EFF00 - .string "It’s a BRONZE CARD!$" - - .align 2 -gUnknown_082EFF14:: @ 82EFF14 - .string "It’s a COPPER CARD!$" - - .align 2 -gUnknown_082EFF28:: @ 82EFF28 - .string "It’s a SILVER CARD!$" - - .align 2 -gUnknown_082EFF3C:: @ 82EFF3C - .string "It’s a GOLD CARD!$" - - .align 2 -gUnknown_082EFF50:: @ 82EFF50 - .4byte gUnknown_082EFEEC - .4byte gUnknown_082EFF00 - .4byte gUnknown_082EFF14 - .4byte gUnknown_082EFF28 - .4byte gUnknown_082EFF3C - -gUnknown_082EFF64:: @ 82EFF64 - .string "This is {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}’s\nTRAINER CARD…\l{SPECIAL_F7 0x02}\pPOKéDEX: {SPECIAL_F7 0x03}\nTIME: {SPECIAL_F7 0x04}:{SPECIAL_F7 0x05}\p$" - - .align 2 -gUnknown_082EFFA4:: @ 82EFFA4 - .string "BATTLES: WINS: {SPECIAL_F7 0x00} LOSSES: {SPECIAL_F7 0x02}\nTRADES: {SPECIAL_F7 0x03}\p“{SPECIAL_F7 0x04} {SPECIAL_F7 0x05}\n{SPECIAL_F7 0x06} {SPECIAL_F7 0x07}”\p$" - - .align 2 -gUnknown_082EFFDC:: @ 82EFFDC - .string "{SPECIAL_F7 0x01}: Glad to have met you!{PAUSE 60}$" - - .align 2 -gUnknown_082EFFFC:: @ 82EFFFC - .string "{SPECIAL_F7 0x01}: Glad to meet you!{PAUSE 60}$" - - .align 2 -gUnknown_082F0018:: @ 82F0018 - .4byte gUnknown_082EFFDC - .4byte gUnknown_082EFFFC - - .align 2 -gUnknown_082F0020:: @ 82F0020 - .string "Finished checking {SPECIAL_F7 0x01}’s\nTRAINER CARD.{PAUSE 60}$" - - .align 2 -gUnknown_082F0048:: @ 82F0048 - .4byte gText_EmptyString - .4byte gUnknown_082EFDB0 - .4byte gUnknown_082EFDC0 - .4byte gUnknown_082EFDD0 - .4byte gUnknown_082EFDE0 - .4byte gUnknown_082EFDF0 - .4byte gUnknown_082EFE00 - .4byte gUnknown_082EFE10 - .4byte gUnknown_082EFDF8 - .4byte gUnknown_082EFE1C - .4byte gUnknown_082EFE2C - .4byte gUnknown_082EFE38 - .4byte gUnknown_082EFE48 - .4byte gText_EmptyString - .4byte gUnknown_082EFED4 - .4byte gUnknown_082EFE60 - .4byte gUnknown_082EFE50 - .4byte gText_EmptyString - .4byte gText_EmptyString - .4byte gText_EmptyString - .4byte gText_EmptyString - .4byte gUnknown_082EFE00 - .4byte gUnknown_082EFE10 - .4byte gUnknown_082EFE70 - .4byte gUnknown_082EFE80 - .4byte gUnknown_082EFE90 - .4byte gUnknown_082EFEA0 - .4byte gUnknown_082EFEB0 - .4byte gUnknown_082EFEC0 - - .align 2 -gUnknown_082F00BC:: @ 82F00BC - window_template 0x00, 0x00, 0x00, 0x1E, 0x02, 0x0F, 0x0008 - - .align 2 -gUnknown_082F00C4:: @ 82F00C4 - .byte 0x01, 0x02, 0x00, 0x00 - .byte 0x02, 0x02, 0x00, 0x00 - .byte 0x03, 0x04, 0x00, 0x00 - .byte 0x04, 0x02, 0x00, 0x00 - .byte 0x09, 0x25, 0x00, 0x00 - .byte 0x0a, 0x25, 0x00, 0x00 - .byte 0x0b, 0x35, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x0f, 0x24, 0x00, 0x00 - .byte 0x10, 0x24, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x17, 0x24, 0x00, 0x00 - .byte 0x18, 0x24, 0x00, 0x00 - .byte 0x19, 0x24, 0x00, 0x00 - .byte 0x1a, 0x24, 0x00, 0x00 - .byte 0x1b, 0x24, 0x00, 0x00 - .byte 0x1c, 0x02, 0x00, 0x00 - .byte 0x0e, 0x02, 0x00, 0x00 - - .align 2 -gUnknown_082F011C:: @ 82F011C - window_template 0x00, 0x01, 0x03, 0x0d, 0x08, 0x0f, 0x0044 - - .align 2 -gUnknown_082F0124:: @ 82F0124 - window_template 0x00, 0x01, 0x03, 0x0d, 0x0a, 0x0f, 0x0044 - - .align 2 -gUnknown_082F012C:: @ 82F012C - window_template 0x00, 0x10, 0x03, 0x07, 0x04, 0x0f, 0x00c6 - - .align 2 -gUnknown_082F0134:: @ 82F0134 - .4byte gText_EmptyString - .4byte 0x00000000 - .4byte gText_EmptyString - .4byte 0x00000001 - .4byte gText_EmptyString - .4byte 0x00000002 - .4byte gText_EmptyString - .4byte 0x00000003 - .4byte gText_EmptyString - .4byte 0x00000004 - - .align 2 -gUnknown_082F015C:: @ 82F015C struct ListMenuTemplate - .4byte gUnknown_082F0134 - .4byte NULL - .4byte sub_8013278 - .byte 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x21, 0x31, 0x00, 0x41 - - .align 2 -gUnknown_082F0174:: @ 82F0174 - window_template 0x00, 0x01, 0x03, 0x11, 0x0a, 0x0f, 0x0044 - - .align 2 -gUnknown_082F017C:: @ 82F017C - window_template 0x00, 0x14, 0x03, 0x07, 0x04, 0x0f, 0x00ee - - .align 2 -gUnknown_082F0184:: @ 82F0184 - .4byte gText_EmptyString, 0x00000000 - .4byte gText_EmptyString, 0x00000001 - .4byte gText_EmptyString, 0x00000002 - .4byte gText_EmptyString, 0x00000003 - .4byte gText_EmptyString, 0x00000004 - .4byte gText_EmptyString, 0x00000005 - .4byte gText_EmptyString, 0x00000006 - .4byte gText_EmptyString, 0x00000007 - .4byte gText_EmptyString, 0x00000008 - .4byte gText_EmptyString, 0x00000009 - .4byte gText_EmptyString, 0x0000000a - .4byte gText_EmptyString, 0x0000000b - .4byte gText_EmptyString, 0x0000000c - .4byte gText_EmptyString, 0x0000000d - .4byte gText_EmptyString, 0x0000000e - .4byte gText_EmptyString, 0x0000000f - - .align 2 -gUnknown_082F0204:: @ 82F0204 struct ListMenuTemplate - .4byte gUnknown_082F0184 - .4byte sub_81AF078 - .4byte sub_8013DF4 - .byte 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x40, 0x01 - - .align 2 -gUnknown_082F021C:: @ 82F021C - window_template 0x00, 0x14, 0x05, 0x10, 0x08, 0x0f, 0x0001 - - .align 2 -gUnknown_082F0224:: @ 82F0224 - .4byte gUnknown_082EFD70, 0x00000208 - .4byte gUnknown_082EFD60, 0x00000241 - .4byte gUnknown_082EFD68, 0x00000245 - .4byte gUnknown_082EFD7C, 0x00000040 - - .align 2 -gUnknown_082F0244:: @ 82F0244 struct ListMenuTemplate - .4byte gUnknown_082F0224 - .byte 0x79, 0xf0, 0x1a, 0x08 - .4byte NULL - .byte 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F025C:: @ 82F025C - window_template 0x00, 0x12, 0x07, 0x10, 0x06, 0x0f, 0x0001 - -gUnknown_082F0264:: @ 82F0264 - .4byte gText_Register, 0x00000001 - .4byte gUnknown_082EFD8C, 0x00000002 - .4byte gUnknown_082EFD7C, 0x00000003 - - .align 2 -gUnknown_082F027C:: @ 82F027C - .4byte gUnknown_082F0264 - .4byte sub_81AF078 - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F0294:: @ 82F0294 - window_template 0x00, 0x14, 0x01, 0x10, 0x0c, 0x0f, 0x0001 - - .align 2 -gUnknown_082F029C:: @ 82F029C - .4byte gTypeNames, 0x00000000 @ NORMAL - .4byte gTypeNames+0x46, 0x0000000a @ FIRE - .4byte gTypeNames+0x4D, 0x0000000b @ WATER - .4byte gTypeNames+0x5B, 0x0000000d @ ELECTR - .4byte gTypeNames+0x54, 0x0000000c @ GRASS - .4byte gTypeNames+0x69, 0x0000000f @ ICE - .4byte gTypeNames+0x1C, 0x00000004 @ GROUND - .4byte gTypeNames+0x23, 0x00000005 @ ROCK - .4byte gTypeNames+0x0E, 0x00000002 @ FLYING - .4byte gTypeNames+0x62, 0x0000000e @ PSYCHC - .4byte gTypeNames+0x07, 0x00000001 @ FIGHT - .4byte gTypeNames+0x15, 0x00000003 @ POISON - .4byte gTypeNames+0x2A, 0x00000006 @ BUG - .4byte gTypeNames+0x31, 0x00000007 @ GHOST - .4byte gTypeNames+0x70, 0x00000010 @ DRAGON - .4byte gTypeNames+0x38, 0x00000008 @ STEEL - .4byte gTypeNames+0x77, 0x00000011 @ DARK - .4byte gUnknown_082EFD7C, 0x00000012 @ EXIT - - .align 2 -gUnknown_082F032C:: @ 82F032C - .4byte gUnknown_082F029C - .4byte sub_81AF078 - .4byte NULL - .byte 0x12, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F0344:: @ 82F0344 - window_template 0x00, 0x01, 0x01, 0x1c, 0x02, 0x0d, 0x0001 - - .align 2 -gUnknown_082F034C:: @ 82F034C - window_template 0x00, 0x01, 0x05, 0x1c, 0x0c, 0x0d, 0x0039 - - .align 2 -gUnknown_082F0354:: @ 82F0354 - .4byte gText_EmptyString, 0xfffffffd - .4byte gText_EmptyString, 0x00000000 - .4byte gText_EmptyString, 0x00000001 - .4byte gText_EmptyString, 0x00000002 - .4byte gText_EmptyString, 0x00000003 - .4byte gText_EmptyString, 0x00000004 - .4byte gText_EmptyString, 0x00000005 - .4byte gText_EmptyString, 0x00000006 - .4byte gText_EmptyString, 0x00000007 - .4byte gUnknown_082EFD84, 0x00000008 - - .align 2 -gUnknown_082F03A4:: @ 82F03A4 - .4byte gUnknown_082F0354 - .4byte sub_81AF078 - .4byte sub_8017BE8 - .byte 0x0a, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0xe1, 0xdf, 0x00, 0x01 - - .align 2 - window_template 0x00, 0x01, 0x05, 0x1c, 0x0c, 0x0d, 0x0039 - - .align 2 -gUnknown_082F03C4:: @ 82F03C4 - .4byte gText_EmptyString, 0x00000000 - .4byte gText_EmptyString, 0x00000001 - .4byte gText_EmptyString, 0x00000002 - .4byte gText_EmptyString, 0x00000003 - .4byte gText_EmptyString, 0x00000004 - .4byte gText_EmptyString, 0x00000005 - .4byte gText_EmptyString, 0x00000006 - .4byte gText_EmptyString, 0x00000007 - .4byte gText_EmptyString, 0x00000008 - .4byte gText_EmptyString, 0x00000009 - .4byte gText_EmptyString, 0x0000000a - .4byte gText_EmptyString, 0x0000000b - .4byte gText_EmptyString, 0x0000000c - .4byte gText_EmptyString, 0x0000000d - .4byte gText_EmptyString, 0x0000000e - .4byte gText_EmptyString, 0x0000000f - - .align 2 - .4byte gUnknown_082F03C4 - .4byte sub_81AF078 - .4byte nullsub_14 - .byte 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x40, 0x01 - - .align 2 -gUnknown_082F045C:: @ 82F045C - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F0474:: @ 82F0474 - .byte 0x01, 0xff - - .align 2 -gUnknown_082F0478:: @ 82F0478 - .byte 0x02, 0xff - - .align 2 -gUnknown_082F047C:: @ 82F047C - .byte 0x03, 0xff - - .align 2 -gUnknown_082F0480:: @ 82F0480 - .byte 0x04, 0xff - - .align 2 -gUnknown_082F0484:: @ 82F0484 - .byte 0x09, 0xff - - .align 2 -gUnknown_082F0488:: @ 82F0488 - .byte 0x0a, 0xff - - .align 2 -gUnknown_082F048C:: @ 82F048C - .byte 0x0b, 0xff - - .align 2 -gUnknown_082F0490:: @ 82F0490 - .byte 0x15, 0xff - - .align 2 -gUnknown_082F0494:: @ 82F0494 - .byte 0x16, 0xff - - .align 2 -gUnknown_082F0498:: @ 82F0498 - .byte 0x40, 0x41, 0x44, 0x45, 0x48, 0x51, 0x52, 0x53, 0x54, 0xff - - .align 2 -gUnknown_082F04A4:: @ 82F04A4 - .byte 0x0c, 0xff - - .align 2 -gUnknown_082F04A8:: @ 82F04A8 - .byte 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15, 0x16, 0x0d, 0xff - - .align 2 -gUnknown_082F04B4:: @ 82F04B4 - .byte 0x0f, 0xff - - .align 2 -gUnknown_082F04B8:: @ 82F04B8 - .byte 0x10, 0xff - - .align 2 -gUnknown_082F04BC:: @ 82F04BC - .byte 0x17, 0xff - - .align 2 -gUnknown_082F04C0:: @ 82F04C0 - .byte 0x18, 0xff - - .align 2 -gUnknown_082F04C4:: @ 82F04C4 - .byte 0x19, 0xff - - .align 2 -gUnknown_082F04C8:: @ 82F04C8 - .byte 0x1a, 0xff - - .align 2 -gUnknown_082F04CC:: @ 82F04CC - .byte 0x1b, 0xff - - .align 2 -gUnknown_082F04D0:: @ 82F04D0 - .byte 0x1c, 0xff - - .align 2 -gUnknown_082F04D4:: @ 82F04D4 - .byte 0x0e, 0xff - - .align 2 -gUnknown_082F04D8:: @ 82F04D8 - .4byte gUnknown_082F0474 - .4byte gUnknown_082F0478 - .4byte gUnknown_082F047C - .4byte gUnknown_082F0480 - .4byte gUnknown_082F0484 - .4byte gUnknown_082F0488 - .4byte gUnknown_082F048C - .4byte gUnknown_082F0490 - .4byte gUnknown_082F0494 - .4byte gUnknown_082F0498 - .4byte gUnknown_082F04A4 - .4byte gUnknown_082F04A8 - .4byte gUnknown_082F04B4 - .4byte gUnknown_082F04B8 - .4byte NULL - .4byte gUnknown_082F04BC - .4byte gUnknown_082F04C0 - .4byte gUnknown_082F04C4 - .4byte gUnknown_082F04C8 - .4byte gUnknown_082F04CC - .4byte gUnknown_082F04D0 - .4byte gUnknown_082F04D4 - - .align 2 -gUnknown_082F0530:: @ 82F0530 - .byte 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15 - .byte 0x16, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x00, 0x17 - .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x0e, 0x00, 0x00 - - .align 2 -gUnkTextboxBorderPal:: @ 82F0548 - .incbin "graphics/interface/unk_textbox_border.gbapal" - - .align 2 -gUnkTextboxBorderGfx:: @ 82F0568 - .incbin "graphics/interface/unk_textbox_border.4bpp.lz" - - .align 2 -gUnknown_082F0598:: @ 82F0598 struct BgTemplate - .4byte 0x000000f8 - .4byte 0x000010e1 - .4byte 0x000020d2 - .4byte 0x000030c3 - - .align 2 -gUnknown_082F05A8:: @ 82F05A8 - window_template 0x00, 0x00, 0x00, 0x1e, 0x02, 0x0c, 0x0013 - window_template 0x00, 0x01, 0x0f, 0x1c, 0x04, 0x0c, 0x004f - window_template 0x00, 0x00, 0x0f, 0x1e, 0x05, 0x0d, 0x004f - window_template_terminator - - .align 2 -gUnknown_082F05C8:: @ 82F05C8 - window_template 0x00, 0x01, 0x0f, 0x1c, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05D0:: @ 82F05D0 - window_template 0x00, 0x01, 0x0f, 0x14, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05D8:: @ 82F05D8 - window_template 0x00, 0x01, 0x0f, 0x13, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05E0:: @ 82F05E0 - window_template 0x00, 0x08, 0x06, 0x0e, 0x06, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05E8:: @ 82F05E8 - window_template 0x00, 0x17, 0x0f, 0x06, 0x04, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05F0:: @ 82F05F0 - window_template 0x00, 0x16, 0x0b, 0x07, 0x08, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05F8:: @ 82F05F8 - window_template 0x00, 0x16, 0x0d, 0x07, 0x06, 0x0c, 0x0155 - - .align 2 -gUnknown_082F0600:: @ 82F0600 - window_template 0x00, 0x16, 0x0f, 0x07, 0x04, 0x0c, 0x0155 - - .align 2 -gUnknown_082F0608:: @ 82F0608 - .4byte gText_WonderCards, 0x00000000 - .4byte gText_WonderNews, 0x00000001 - .4byte gText_Exit3, 0xfffffffe - - .align 2 -gUnknown_082F0620:: @ 82F0620 - .4byte gText_WirelessCommunication, 0x00000000 - .4byte gText_Friend2, 0x00000001 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0638:: @ 82F0638 struct ListMenuTemplate - .4byte NULL - .4byte sub_81AF078 - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F0650:: @ 82F0650 - .4byte gText_Receive, 0x00000000 - .4byte gText_Send, 0x00000001 - .4byte gText_Toss, 0x00000002 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0670:: @ 82F0670 - .4byte gText_Receive, 0x00000000 - .4byte gText_Toss, 0x00000002 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0688:: @ 82F0688 - .4byte gText_Receive, 0x00000000 - .4byte gText_Send, 0x00000001 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F06A0:: @ 82F06A0 - .4byte gText_Receive, 0x00000000 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F06B0:: @ 82F06B0 struct ListMenuTemplate - .4byte gUnknown_082F0650 - .4byte sub_81AF078 - .4byte NULL - .byte 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06C8:: @ 82F06C8 - .4byte gUnknown_082F0670 - .4byte sub_81AF078 - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06E0:: @ 82F06E0 - .4byte gUnknown_082F0688 - .4byte sub_81AF078 - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06F8:: @ 82F06F8 - .4byte gUnknown_082F06A0 - .4byte sub_81AF078 - .4byte NULL - .byte 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 - .4byte gText_VarietyOfEventsImportedWireless - .4byte gText_WonderCardsInPossession - .4byte gText_ReadNewsThatArrived - .4byte gText_ReturnToTitle - - .align 2 -gUnknown_082F0720:: @ 82F0720 struct TextColor - .byte 0x00, 0x01, 0x02 - - .align 2 - .byte 0x00, 0x01, 0x02 - - .align 2 -gUnknown_082F0728:: @ 82F0728 struct TextColor - .byte 0x01, 0x02, 0x03 - - .align 2 -gUnknown_082F072C:: @ 82F072C - .byte 0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42 - .byte 0x00, 0x00, 0x22, 0x28, 0x20, 0x2f, 0x2f, 0x0e - .byte 0x14, 0x2d, 0x00, 0x00 - - .align 2 -gUnknown_082F0740:: @ 82F0740 - .2byte 0x0004, 0x0006, 0x000d, 0x0008 - .2byte 0x000a, 0x0006, 0x0001, 0x0008 - .2byte 0x000d, 0x0004, 0x0007, 0x0004 - .2byte 0x0001, 0x0004, 0x0007, 0x0008 - - .align 2 -gUnknown_082F0760:: @ 82F0760 - .byte 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00 - .byte 0x00, 0x01 - -gUnknown_082F076A:: @ 82F076A - .byte 0x00, 0x02, 0x01, 0x04, 0x03 - -gUnknown_082F076F:: @ 82F076F - .byte 0x01, 0x03, 0x01, 0x04, 0x02 - -gUnknown_082F0774:: @ 82F0774 - .byte 0x09, 0x08, 0x07, 0x02, 0x06, 0x05, 0x04, 0x03 - .byte 0xbf, 0x02, 0xc0, 0x02, 0xc1, 0x02, 0xc2, 0x02 - .byte 0xc3, 0x02, 0xc4, 0x02, 0xc5, 0x02, 0xc6, 0x02 - -gUnknown_082F078C:: @ 82F078C - .byte 0x9c, 0xfe - -gUnknown_082F078E:: @ 82F078E - .byte 0x9d, 0xfe - - .align 2 -gWirelessInfoScreenPal:: @ 82F0790 - .incbin "graphics/interface/wireless_info_screen.gbapal" - - .align 2 -gWirelessInfoScreenGfx:: @ 82F0990 - .incbin "graphics/interface/wireless_info_screen.4bpp.lz" - - .align 2 -gWirelessInfoScreenTilemap:: @ 82F0BA0 - .incbin "graphics/interface/wireless_info_screen.bin.lz" - - .align 2 -gUnknown_082F0D34:: @ 82F0D34 - .4byte 0x000001f8 - .4byte 0x00001081 - - .align 2 -gUnknown_082F0D3C:: @ 82F0D3C - window_template 0x00, 0x03, 0x00, 0x18, 0x03, 0x0f, 0x0001 - window_template 0x00, 0x03, 0x04, 0x15, 0x0f, 0x0f, 0x0049 - window_template 0x00, 0x18, 0x04, 0x03, 0x0f, 0x0f, 0x0184 - window_template_terminator - - .align 2 -gUnknown_082F0D5C:: @ 82F0D5C - .4byte gText_WirelessCommStatus - .4byte gText_PeopleTrading - .4byte gText_PeopleBattling - .4byte gText_PeopleInUnionRoom - .4byte gText_PeopleCommunicating - - .align 2 -gUnknown_082F0D70:: @ 82F0D70 - .byte 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x03, 0x01 - .byte 0x04, 0x04, 0x00, 0x02, 0x06, 0x03, 0x02, 0x07 - .byte 0x03, 0x02, 0x09, 0x03, 0x00, 0x0a, 0x03, 0x00 - .byte 0x0b, 0x03, 0x00, 0x0c, 0xff, 0x00, 0x0d, 0x00 - .byte 0x00, 0x10, 0x03, 0x00, 0x0f, 0x03, 0x00, 0x40 - .byte 0x02, 0x01, 0x41, 0x02, 0x02, 0x44, 0x02, 0x02 - .byte 0x45, 0x02, 0x00, 0x48, 0x02, 0x02, 0x54, 0x02 - .byte 0x01, 0x53, 0x02, 0x02, 0x51, 0x02, 0x01, 0x52 - .byte 0x02, 0x01, 0x15, 0x03, 0x02, 0x16, 0x03, 0x02 - .byte 0x17, 0x03, 0x00, 0x18, 0x03, 0x00, 0x19, 0x03 - .byte 0x00, 0x1a, 0x03, 0x00, 0x1b, 0x03, 0x00, 0x1c - .byte 0x01, 0x02, 0x0e, 0x01, 0x02, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F0DD0:: @ 82F0DD0 - .4byte 0x000001FC - - .align 2 -gUnknown_082F0DD4:: @ 82F0DD4 - window_template 0x00, 0x03, 0x0f, 0x18, 0x04, 0x0e, 0x0014 - window_template_terminator - - .align 2 -gUnknown_082F0DE4:: @ 82F0DE4 - .byte 0x01, 0x02, 0x03 - - .align 2 -gUnknown_082F0DE8:: @ 82F0DE8 - .2byte 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, 0x013f, 0x0140, 0x0141 - .2byte 0x0142, 0x0143, 0x0144, 0x0145, 0x0146, 0x0147, 0x0148, 0x0149 - .2byte 0x014a, 0x014b, 0x014c, 0x014d - - .align 2 -gUnknown_082F0E10:: @ 82F0E10 - .byte 0x00, 0x02, 0x03 - .byte 0x00, 0x01, 0x02 - - .align 2 -gUnknown_082F0E18:: @ 82F0E18 - .byte 0x07, 0x04, 0x07, 0x00 - - .align 2 -gUnknown_082F0E1C:: @ 82F0E1C - window_template 0x01, 0x01, 0x01, 0x19, 0x04, 0x02, 0x029C - window_template 0x01, 0x01, 0x06, 0x1C, 0x08, 0x02, 0x01BC - window_template 0x01, 0x01, 0x0E, 0x1C, 0x05, 0x02, 0x0130 - - .align 2 -gWonderCardBgPal1:: @ 82F0E34 - .incbin "graphics/interface/wonder_card_1.gbapal" - - .align 2 -gWonderCardBgPal2:: @ 82F0E54 - .incbin "graphics/interface/wonder_card_2.gbapal" - - .align 2 -gWonderCardBgPal3:: @ 82F0E74 - .incbin "graphics/interface/wonder_card_3.gbapal" - - .align 2 -gWonderCardBgPal4:: @ 82F0E94 - .incbin "graphics/interface/wonder_card_4.gbapal" - - .align 2 -gWonderCardBgPal5:: @ 82F0EB4 - .incbin "graphics/interface/wonder_card_5.gbapal" - - .align 2 -gWonderCardBgPal6:: @ 82F0ED4 - .incbin "graphics/interface/wonder_card_6.gbapal" - - .align 2 -gWonderCardBgPal7:: @ 82F0EF4 - .incbin "graphics/interface/wonder_card_7.gbapal" - - .align 2 -gWonderCardBgPal8:: @ 82F0F14 - .incbin "graphics/interface/wonder_card_8.gbapal" - - .align 2 -gWonderCardBgGfx1:: @ 82F0F34 - .incbin "graphics/interface/wonder_card_1.4bpp.lz" - - .align 2 -gWonderCardBgTilemap1:: @ 82F1030 - .incbin "graphics/interface/wonder_card_1.bin.lz" - - .align 2 -gWonderCardBgGfx2:: @ 82F1124 - .incbin "graphics/interface/wonder_card_2.4bpp.lz" - - .align 2 -gWonderCardBgTilemap2:: @ 82F1218 - .incbin "graphics/interface/wonder_card_2.bin.lz" - - .align 2 -gWonderCardBgGfx3:: @ 82F1300 - .incbin "graphics/interface/wonder_card_3.4bpp.lz" - - .align 2 -gWonderCardBgTilemap3:: @ 82F13D4 - .incbin "graphics/interface/wonder_card_3.bin.lz" - - .align 2 -gWonderCardBgGfx7:: @ 82F14A8 - .incbin "graphics/interface/wonder_card_7.4bpp.lz" - - .align 2 -gWonderCardBgTilemap7:: @ 82F16DC - .incbin "graphics/interface/wonder_card_7.bin.lz" - - .align 2 -gWonderCardBgGfx8:: @ 82F1824 - .incbin "graphics/interface/wonder_card_8.4bpp.lz" - - .align 2 -gWonderCardBgTilemap8:: @ 82F1A54 - .incbin "graphics/interface/wonder_card_8.bin.lz" - - .align 2 -gWonderCardShadowPal1:: @ 82F1B9C - .incbin "graphics/interface/wonder_card_shadow_1.gbapal" - - .align 2 -gWonderCardShadowPal2:: @ 82F1BBC - .incbin "graphics/interface/wonder_card_shadow_2.gbapal" - - .align 2 -gWonderCardShadowPal3:: @ 82F1BDC - .incbin "graphics/interface/wonder_card_shadow_3.gbapal" - - .align 2 -gWonderCardShadowPal4:: @ 82F1BFC - .incbin "graphics/interface/wonder_card_shadow_4.gbapal" - - .align 2 -gWonderCardShadowPal5:: @ 82F1C1C - .incbin "graphics/interface/wonder_card_shadow_5.gbapal" - - .align 2 -gWonderCardShadowPal6:: @ 82F1C3C - .incbin "graphics/interface/wonder_card_shadow_6.gbapal" - - .align 2 -gWonderCardShadowPal7:: @ 82F1C5C - .incbin "graphics/interface/wonder_card_shadow_7.gbapal" - - .align 2 -gWonderCardShadowPal8:: @ 82F1C7C - .incbin "graphics/interface/wonder_card_shadow_8.gbapal" - - .align 2 -gWonderCardShadowGfx:: @ 82F1C9C - .incbin "graphics/interface/wonder_card_shadow.4bpp.lz" - - .align 2 -gUnknown_082F1D00:: @ 82F1D00 struct CompressedSpriteSheet - .4byte gWonderCardShadowGfx - .2byte 0x0100 - .2byte 0x8000 - - .align 2 -gUnknown_082F1D08:: @ 82F1D08 struct SpritePalette - .4byte gWonderCardShadowPal1 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal2 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal3 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal4 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal5 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal6 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal7 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal8 - .2byte 0x8000 - - .align 2 -gUnknown_082F1D48:: @ 82F1D48 - spr_template 0x8000, 0x8000, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F1D60:: @ 82F1D60 - .4byte 0x00000001, gWonderCardBgGfx1, gWonderCardBgTilemap1, gWonderCardBgPal1 - .4byte 0x00001001, gWonderCardBgGfx2, gWonderCardBgTilemap2, gWonderCardBgPal2 - .4byte 0x00002001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal3 - .4byte 0x00003001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal4 - .4byte 0x00004001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal5 - .4byte 0x00005001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal6 - .4byte 0x00006001, gWonderCardBgGfx7, gWonderCardBgTilemap7, gWonderCardBgPal7 - .4byte 0x00007001, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8 - -gUnknown_082F1DE0:: @ 82F1DE0 - .byte 0x00, 0x02, 0x03, 0x00, 0x01, 0x02, 0x00, 0x00 - -gUnknown_082F1DE8:: @ 82F1DE8 - window_template 0x00, 0x01, 0x00, 0x1C, 0x03, 0x02, 0x02AC - window_template 0x02, 0x01, 0x03, 0x1C, 0x14, 0x02, 0x007C - -gUnknown_082F1DF8:: @ 82F1DF8 - .4byte 0x0318e802, 0x000098e8, 0x10000002, 0x00001000 - - .align 2 -gWonderNewsPal1:: @ 82F1E08 - .incbin "graphics/interface/wonder_news_1.gbapal" - - .align 2 -gWonderNewsPal7:: @ 82F1E28 - .incbin "graphics/interface/wonder_news_7.gbapal" - - .align 2 -gWonderNewsPal8:: @ 82F1E48 - .incbin "graphics/interface/wonder_news_8.gbapal" - - .align 2 -gWonderNewsGfx1:: @ 82F1E68 - .incbin "graphics/interface/wonder_news_1.4bpp.lz" - - .align 2 -gWonderNewsTilemap1:: @ 82F1EE8 - .incbin "graphics/interface/wonder_news_1.bin.lz" - - .align 2 -gWonderNewsGfx2:: @ 82F1FC4 - .incbin "graphics/interface/wonder_news_2.4bpp.lz" - - .align 2 -gWonderNewsTilemap2:: @ 82F1FF4 - .incbin "graphics/interface/wonder_news_2.bin.lz" - - .align 2 -gWonderNewsGfx3:: @ 82F20B4 - .incbin "graphics/interface/wonder_news_3.4bpp.lz" - - .align 2 -gWonderNewsTilemap3:: @ 82F2124 - .incbin "graphics/interface/wonder_news_3.bin.lz" - - .align 2 -gWonderNewsGfx7:: @ 82F21F0 - .incbin "graphics/interface/wonder_news_7.4bpp.lz" - - .align 2 -gWonderNewsTilemap7:: @ 82F2280 - .incbin "graphics/interface/wonder_news_7.bin.lz" - - .align 2 -gWonderNewsGfx8:: @ 82F235C - .incbin "graphics/interface/wonder_news_8.4bpp.lz" - - .align 2 -gWonderNewsTilemap8:: @ 82F23EC - .incbin "graphics/interface/wonder_news_8.bin.lz" - - .align 2 -gUnknown_082F24C8:: @ 82F24C8 - .4byte 0x00000001, gWonderNewsGfx1, gWonderNewsTilemap1, gWonderNewsPal1 - .4byte 0x00000001, gWonderNewsGfx2, gWonderNewsTilemap2, gWonderCardBgPal2 - .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal3 - .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal4 - .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal5 - .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal6 - .4byte 0x00000001, gWonderNewsGfx7, gWonderNewsTilemap7, gWonderNewsPal7 - .4byte 0x00000001, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8 - - .align 2 -gUnknown_082F2548:: @ 82F2548 - .4byte sub_801D1AC - .4byte sub_801D1B4 - .4byte sub_801D1B8 - .4byte sub_801D1D4 - .4byte sub_801D1F0 - - .align 2 -gUnknown_082F255C:: @ 82F255C - .4byte sub_801D5D0 - .4byte sub_801D5F8 - .4byte sub_801D5FC - .4byte sub_801D61C - .4byte sub_801D63C - .4byte sub_801D810 - .4byte sub_801D828 - .4byte sub_801D860 - - .align 2 -gText_CanceledReadingCard:: @ 82F257C - .string "Canceled reading\nthe Card.$" - - .align 2 -gUnknown_082F2598:: @ 82F2598 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F25A8:: @ 82F25A8 - .byte 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F25C8:: @ 82F25C8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F25D8:: @ 82F25D8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F25E8:: @ 82F25E8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F25F8:: @ 82F25F8 - .byte 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00 - .byte 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00 - .byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2628:: @ 82F2628 - .byte 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2650:: @ 82F2650 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2660:: @ 82F2660 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2670:: @ 82F2670 - .byte 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2698:: @ 82F2698 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F26A8:: @ 82F26A8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F26B8:: @ 82F26B8 - .byte 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00 - .byte 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00 - .byte 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F26F8:: @ 82F26F8 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25C8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25D8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2698 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2788:: @ 82F2788 - .byte 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26B8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00 - - .4byte gText_CanceledReadingCard - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F27D0:: @ 82F27D0 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2650 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2800:: @ 82F2800 - .byte 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2628 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F27D0 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2660 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2884:: @ 82F2884 - .byte 0x12, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25F8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F28E4:: @ 82F28E4 - .byte 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2670 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2884 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2788 - - .align 2 -gUnknown_082F292C:: @ 82F292C - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26A8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 - .byte 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25E8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F298C:: @ 82F298C - .byte 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 - .byte 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25A8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26F8 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2800 - - .align 2 -gUnknown_082F29EC:: @ 82F29EC - .byte 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25A8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26F8 - .byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F28E4 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2884 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F292C - - .align 2 -gUnknown_082F2A7C:: @ 82F2A7C - .4byte sub_801DFAC - .4byte sub_801E030 - .4byte sub_801E120 - .4byte sub_801E240 - .4byte sub_801E764 - .4byte sub_801E838 - .4byte sub_801E460 - .4byte sub_801E5C4 - .4byte sub_801E668 - .4byte sub_801E978 - - .align 2 -gUnknown_082F2AA4:: @ 82F2AA4 - .byte 0x09, 0x09, 0x09, 0x09 - - .align 2 -gUnknown_082F2AA8:: @ 82F2AA8 - .byte 0x00, 0x16, 0x17, 0x68, 0x19, 0x1a, 0x1b, 0x1c - .byte 0x1d, 0x1e, 0x00, 0x20, 0x21, 0x22, 0x23, 0x24 - .byte 0x25, 0x26, 0x27, 0x28, 0x29, 0x15, 0x01, 0x02 - .byte 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 - .byte 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 - .byte 0x13, 0x14, 0x2a, 0x2b, 0x2c, 0x2d, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x36, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x53, 0x54, 0x55, 0x56, 0x00 - .byte 0x00, 0x00, 0x6f, 0x5b, 0x5c, 0x5d, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x84, 0x85, 0x86, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7 - .byte 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf - .byte 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7 - .byte 0xb8, 0xb9, 0xba, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9 - .byte 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1 - .byte 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9 - .byte 0xea, 0xeb, 0xec, 0xed, 0xee, 0xbb, 0xbc, 0xbd - .byte 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5 - .byte 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd - .byte 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xef - .byte 0xf0, 0xf4, 0xf5, 0xf6, 0xf1, 0xf2, 0xf3, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2BA8:: @ 82F2BA8 - .4byte gUnknown_0862B9F9 - .4byte gUnknown_0862B9FF - .4byte gUnknown_0862BA05 - .4byte gUnknown_0862BA0B - .4byte gUnknown_0862BA11 - .4byte gUnknown_0862BA17 - .4byte gUnknown_0862BA1D - .4byte gUnknown_0862BA23 - .4byte gUnknown_0862BA29 - .4byte gUnknown_0862BA2F - .4byte gUnknown_0862BA35 - .4byte gUnknown_0862BA3B - .4byte gUnknown_0862BA41 - .4byte gUnknown_0862BA47 - .4byte gUnknown_0862BA4D - .4byte gUnknown_0862BA53 - .4byte gUnknown_0862BA59 - .4byte gUnknown_0862BA5F - .4byte gUnknown_0862BA65 - .4byte gUnknown_0862BA6B - .4byte gUnknown_0862BA79 - .4byte gUnknown_0862BA84 - .4byte gUnknown_0862BA8F - .4byte gUnknown_0862BA9A - .4byte gUnknown_0862BAA3 - .4byte gUnknown_0862BAAE - .4byte gUnknown_0862BAB9 - .4byte gUnknown_0862BAC4 - .4byte gUnknown_0862BACF - .4byte gUnknown_0862BADA - - .align 2 -gUnknown_082F2C20:: @ 82F2C20 - .incbin "graphics/interface/unk_palette1.gbapal" - - .align 2 -gUnknown_082F2C40:: @ 82F2C40 - .incbin "graphics/interface/unk_palette2.gbapal" - - .align 2 -gUnknown_082F2C60:: @ 82F2C60 struct BgTemplate - .4byte 0x00000070, 0x000011fd, 0x0000217a, 0x000070f7 - - .align 2 -gUnknown_082F2C70:: @ 82F2C70 - window_template 0x03, 0x08, 0x01, 0x15, 0x13, 0x0f, 0x0001 - window_template 0x01, 0x09, 0x12, 0x0f, 0x02, 0x0c, 0x007a - window_template 0x01, 0x00, 0x02, 0x06, 0x0f, 0x07, 0x0020 - window_template 0x00, 0x01, 0x02, 0x07, 0x09, 0x0e, 0x0013 - window_template_terminator - - .align 2 -gUnknown_082F2C98:: @ 82F2C98 - .4byte 0x00000000, sub_801F658 - .4byte 0x00000003, sub_801F6F8 - .4byte 0x00000004, sub_801F730 - .4byte 0x00000005, sub_801F768 - .4byte 0x00000001, sub_801F7D4 - .4byte 0x00000006, sub_801F7E0 - .4byte 0x00000007, sub_801F82C - .4byte 0x00000008, sub_801F870 - .4byte 0x00000009, sub_801F8DC - .4byte 0x0000000a, sub_801F984 - .4byte 0x0000000b, sub_801FA2C - .4byte 0x0000000c, sub_801FA68 - .4byte 0x00000002, sub_801FB44 - .4byte 0x0000000d, sub_801FB70 - .4byte 0x00000012, sub_801FBB4 - .4byte 0x00000013, sub_801FBF8 - .4byte 0x0000000e, sub_801FC4C - .4byte 0x0000000f, sub_801FC9C - .4byte 0x00000010, sub_801FCEC - .4byte 0x00000011, sub_801FD30 - .4byte 0x00000014, sub_801FD88 - - .align 2 -gUnknown_082F2D40:: @ 82F2D40 - .4byte gText_QuitChatting - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_RegisterTextWhere - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_RegisterTextHere - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_InputText - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_ExitingChat - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_LeaderLeftEndingChat - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00 - - .4byte gText_RegisteredTextChanged - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_AlreadySavedFile - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_SavingDontTurnOff - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_PlayerSavedGame - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00 - - .4byte gText_IfLeaderLeavesChatEnds - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .align 2 -gText_Ellipsis:: @ 82F2DC4 - .string "…$" - - .align 2 -gUnknown_082F2DC8:: @ 82F2DC8 - .4byte gText_Upper, 0x00000000 - .4byte gText_Lower, 0x00000000 - .4byte gText_Symbols, 0x00000000 - .4byte gText_Register2, 0x00000000 - .4byte gText_Exit2, 0x00000000 - - .align 2 -gUnknown_082F2DF0:: @ 82F2DF0 - .incbin "graphics/interface/unk_palette3.gbapal" - - .align 2 -gUnknown_082F2E10:: @ 82F2E10 - .incbin "graphics/interface/unk_cursor.4bpp.lz" - - .align 2 -gUnknown_082F3094:: @ 82F3094 - .incbin "graphics/interface/unk_dash.4bpp.lz" - - .align 2 -gUnknown_082F30B4:: @ 82F30B4 - .incbin "graphics/interface/unk_cursor_arrow.4bpp.lz" - - .align 2 -gUnknown_082F30E0:: @ 82F30E0 - .incbin "graphics/interface/unk_rbutton.4bpp.lz" - - .align 2 -gUnknown_082F3134:: @ 82F3134 - .4byte gUnknown_082F2E10 - .2byte 0x1000, 0x0000 - - .4byte gUnknown_082F30B4 - .2byte 0x0040, 0x0001 - - .4byte gUnknown_082F3094 - .2byte 0x0040, 0x0002 - - .4byte gUnknown_082F30E0 - .2byte 0x0080, 0x0003 - - .4byte gUnknown_08DD4CF8 - .2byte 0x0400, 0x0004 - - .align 2 -gUnknown_082F315C:: @ 82F315C struct SpritePalette - .4byte gUnknown_082F2DF0 - .2byte 0x0000 - - .align 2 -gUnknown_082F3164:: @ 82F3164 - .2byte 0x4000, 0xc000, 0x0400, 0x0000 - - .align 2 -gUnknown_082F316C:: @ 82F316C - .2byte 0x0000, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3174:: @ 82F3174 - .2byte 0x0020, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F317C:: @ 82F317C - .2byte 0x0040, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3184:: @ 82F3184 - .2byte 0x0060, 0x001e, 0xffff, 0x0000 - -gUnknown_082F318C:: @ 82F318C - .4byte gUnknown_082F316C - .4byte gUnknown_082F3174 - .4byte gUnknown_082F317C - .4byte gUnknown_082F3184 - - .align 2 -gUnknown_082F319C:: @ 82F319C - spr_template 0x0000, 0x0000, gUnknown_082F3164, gUnknown_082F318C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F31B4:: @ 82F31B4 - .byte 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31BC:: @ 82F31BC - spr_template 0x0002, 0x0000, gUnknown_082F31B4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8020ABC - - .align 2 -gUnknown_082F31D4:: @ 82F31D4 - spr_template 0x0001, 0x0000, gUnknown_082F31B4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8020AF4 - - .align 2 -gUnknown_082F31EC:: @ 82F31EC - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31F4:: @ 82F31F4 - .byte 0x00, 0x40, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31FC:: @ 82F31FC - .2byte 0x0000, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3204:: @ 82F3204 - .2byte 0x0008, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F320C:: @ 82F320C - .2byte 0x0010, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3214:: @ 82F3214 - .2byte 0x0018, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F321C:: @ 82F321C - .4byte gUnknown_082F31FC - .4byte gUnknown_082F3204 - .4byte gUnknown_082F320C - .4byte gUnknown_082F3214 - - .align 2 -gUnknown_082F322C:: @ 82F322C - spr_template 0x0003, 0x0000, gUnknown_082F31EC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F3244:: @ 82F3244 - spr_template 0x0004, 0x0000, gUnknown_082F31F4, gUnknown_082F321C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F325C:: @ 82F325C - .byte 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 - - .align 2 -gUnknown_082F3264:: @ 82F3264 - .byte 0x00, 0x01, 0x02, 0x03, 0x05, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F326C:: @ 82F326C - .byte 0x04, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00, 0x04 - .byte 0x02, 0x00, 0xff, 0x00, 0x00, 0x00, 0x04, 0x02 - .byte 0x00, 0xfe, 0x00, 0x00, 0x00, 0x06, 0x03, 0x01 - .byte 0xff, 0xfd, 0xff, 0x00, 0x06, 0x04, 0x01, 0xfe - .byte 0xfc, 0xfe, 0x00, 0x00 - - .align 2 -gUnknown_082F3290:: @ 82F3290 - .byte 0x03, 0x02, 0x01, 0x00, 0x03, 0x03, 0x01, 0x00 - .byte 0x03, 0x03, 0x02, 0x00, 0x03, 0x04, 0x02, 0x00 - .byte 0x03, 0x05, 0x03, 0x00 - - .align 2 -gUnknown_082F32A4:: @ 82F32A4 - .4byte gText_ReadyToBerryCrush - .4byte gText_WaitForAllChooseBerry - .4byte gText_EndedWithXUnitsPowder - .4byte gText_RecordingGameResults - .4byte gText_PlayBerryCrushAgain - .4byte gText_YouHaveNoBerries - .4byte gText_MemberDroppedOut - .4byte gText_TimesUpNoGoodPowder - .4byte gText_CommunicationStandby2 - - .align 2 -gUnknown_082F32C8:: @ 82F32C8 struct BgTemplate - .4byte 0x000000F8 - - .align 2 -gUnknown_082F32CC:: @ 82F32CC struct BgTemplate? not sure - .byte 0xd1, 0x14, 0x00, 0x00, 0xc2, 0x20, 0x00, 0x00 - .byte 0xb3, 0x30, 0x00, 0x00 - - .align 2 -gUnknown_082F32D8:: @ 82F32D8 - .byte 0x01, 0x02, 0x03 - -gUnknown_082F32DB:: @ 82F32DB - .byte 0x00, 0x01, 0x02 - -gUnknown_082F32DE:: @ 82F32DE - .byte 0x00, 0x03, 0x04 - -gUnknown_082F32E1:: @ 82F32E1 - .byte 0x01, 0x08, 0x09 - .byte 0x01, 0x06, 0x07 - -gUnknown_082F32E7:: @ 82F32E7 - .byte 0x01, 0x04, 0x05 - - .align 2 -gUnknown_082F32EC:: @ 82F32EC - window_template 0x00, 0x03, 0x04, 0x18, 0x0d, 0x0f, 0x0001 - - .align 2 -gUnknown_082F32F4:: @ 82F32F4 - window_template 0x00, 0x00, 0x00, 0x09, 0x02, 0x08, 0x03ed - window_template 0x00, 0x00, 0x03, 0x09, 0x02, 0x08, 0x03db - window_template 0x00, 0x00, 0x06, 0x09, 0x02, 0x08, 0x03c9 - window_template 0x00, 0x15, 0x03, 0x09, 0x02, 0x08, 0x03b7 - window_template 0x00, 0x15, 0x06, 0x09, 0x02, 0x08, 0x03a5 - window_template_terminator - - window_template 0x00, 0x05, 0x02, 0x14, 0x10, 0x0f, 0x0001 - window_template 0x00, 0x05, 0x02, 0x14, 0x10, 0x0f, 0x0001 - window_template 0x00, 0x04, 0x02, 0x16, 0x10, 0x0f, 0x0001 - window_template_terminator - - .align 2 -gUnknown_082F3344:: @ 82F3344 - .byte 0x06, 0x08, 0x09, 0x0b, 0x0c, 0x0e, 0x0f, 0x10 - - .align 2 -gUnknown_082F334C:: @ 82F334C - .byte 0x80, 0xf0, 0xfa, 0x02, 0x40, 0x78, 0x7d, 0x01 - .byte 0x20, 0xbc, 0xbe, 0x00, 0x10, 0x5e, 0x5f, 0x00 - .byte 0x08, 0xaf, 0x2f, 0x00, 0x84, 0xd7, 0x17, 0x00 - .byte 0xc2, 0xeb, 0x0b, 0x00, 0xe1, 0xf5, 0x05, 0x00 - - .align 2 -gBerryCrushGrinderBasePal:: @ 82F336C - .incbin "graphics/interface/berrycrush_grinder_base.gbapal" - - .align 2 -gBerryCrushMiscSpritesPal:: @ 82F338C - .incbin "graphics/interface/berrycrush_misc.gbapal" - - .align 2 -gBerryCrushTimerDigitsPal:: @ 82F33AC - .incbin "graphics/interface/berrycrush_timerdigits.gbapal" - - .align 2 -gBerryCrushGrinderBaseGfx:: @ 82F33CC - .incbin "graphics/interface/berrycrush_grinder_base.4bpp.lz" - - .align 2 -gBerryCrushBtnPressGfx:: @ 82F36F8 - .incbin "graphics/interface/berrycrush_btnpress.4bpp.lz" - - .align 2 -gBerryCrushSparkleGfx:: @ 82F3A74 - .incbin "graphics/interface/berrycrush_sparkle.4bpp.lz" - - .align 2 -gBerryCrushTimerDigitsGfx:: @ 82F3BC0 - .incbin "graphics/interface/berrycrush_timerdigits.4bpp.lz" - - .align 2 -gBerryCrushGrinderTopTilemap:: @ 82F3C8C - .incbin "graphics/interface/berrycrush_grinder_top.bin.lz" - - .align 2 -gBerryCrushContainerCapTilemap:: @ 82F3DBC - .incbin "graphics/interface/berrycrush_container_cap.bin.lz" - - .align 2 -gBerryCrushBackgroundTilemap:: @ 82F3F54 - .incbin "graphics/interface/berrycrush_background.bin.lz" - - .align 2 -gUnknown_082F417C:: @ 82F417C - .byte 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03 - .byte 0x00, 0x00, 0x01, 0x03, 0x02, 0x04, 0x00, 0x00 - .byte 0x01, 0x03, 0x02, 0x04 - - .align 2 -gUnknown_082F4190:: @ 82F4190 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff - .byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00 - .byte 0xe4, 0xff, 0xfc, 0xff, 0xe8, 0xff, 0x10, 0x00 - .byte 0x02, 0x00, 0x06, 0x00, 0xf0, 0xff, 0x14, 0x00 - .byte 0xf8, 0xff, 0x10, 0x00, 0x03, 0x14, 0x03, 0x00 - .byte 0x1c, 0x00, 0xfc, 0xff, 0x20, 0x00, 0xf8, 0xff - .byte 0x04, 0x14, 0x06, 0x00, 0x10, 0x00, 0x14, 0x00 - .byte 0x10, 0x00, 0xf8, 0xff - - .align 2 -gUnknown_082F41CC:: @ 82F41CC - .byte 0x00, 0x00, 0xff, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0xf0, 0xfc, 0x10, 0xfc, 0xf8, 0xfe, 0x08, 0xfe - .byte 0xe8, 0xf8, 0x18, 0xf8, 0xe0, 0xf4, 0x20, 0xf4 - .byte 0xd8, 0xf0, 0x28, 0xf0 - - .align 2 -gUnknown_082F41E8:: @ 82F41E8 - .2byte 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0000 - - .align 2 -gUnknown_082F41F4:: @ 82F41F4 - .4byte gBerryCrushGrinderBaseGfx - .2byte 0x0800, 0x0001 - - .4byte gBerryCrushBtnPressGfx - .2byte 0x0e00, 0x0002 - - .4byte gBerryCrushSparkleGfx - .2byte 0x0700, 0x0003 - - .align 2 -gUnknown_082F420C:: @ 82F420C - .4byte gBerryCrushTimerDigitsGfx - .2byte 0x02c0, 0x0004 - - .4byte NULL - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082F421C:: @ 82F421C - .4byte gBerryCrushGrinderBasePal - .2byte 0x0001 - - .align 2 - .4byte gBerryCrushMiscSpritesPal - .2byte 0x0002 - - .align 2 -gUnknown_082F422C:: @ 82F422C - .align 2 - .4byte gBerryCrushTimerDigitsPal - .2byte 0x0004 - - .align 2 - .4byte NULL - .2byte 0x0000 - - .align 2 -gUnknown_082F423C:: @ 82F423C - .2byte 0x0000, 0x0000, 0xffff, 0x0000 - - .align 2 -gUnknown_082F4244:: @ 82F4244 - .2byte 0x0000, 0x0004, 0x0010, 0x0004, 0x0020, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_082F4254:: @ 82F4254 - .2byte 0x0030, 0x0002, 0x0040, 0x0002, 0x0050, 0x0002, 0x0060, 0x0002 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082F4268:: @ 82F4268 - .2byte 0x0000, 0x0002, 0x0004, 0x0002, 0x0008, 0x0002, 0x000c, 0x0002 - .2byte 0x0010, 0x0002, 0x0014, 0x0002, 0xfffe, 0x0000 - - .align 2 -gUnknown_082F4284:: @ 82F4284 - .2byte 0x0018, 0x0004, 0x001c, 0x0004, 0x0020, 0x0004, 0x0024, 0x0004 - .2byte 0x0028, 0x0004, 0x002c, 0x0004, 0x0030, 0x0004, 0x0034, 0x0004 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082F42A8:: @ 82F42A8 - .2byte 0x0014, 0x0000, 0xffff, 0x0000 - - .align 2 -gUnknown_082F42B0:: @ 82F42B0 - .2byte 0x0000, 0x0000, 0xffff, 0x0000 - - .align 2 -gUnknown_082F42B8:: @ 82F42B8 - .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0102, 0x0000 - .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 - - .align 2 -gUnknown_082F42D0:: @ 82F42D0 - .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x01fe, 0x0000 - .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 - - .align 2 -gUnknown_082F42E8:: @ 82F42E8 - .4byte gUnknown_082F423C - - .align 2 -gUnknown_082F42EC:: @ 82F42EC - .4byte gUnknown_082F4244 - .4byte gUnknown_082F4254 - - .align 2 -gUnknown_082F42F4:: @ 82F42F4 - .4byte gUnknown_082F4268 - .4byte gUnknown_082F4284 - - .align 2 -gUnknown_082F42FC:: @ 82F42FC - .4byte gUnknown_082F42A8 - - .align 2 -gUnknown_082F4300:: @ 82F4300 - .4byte gUnknown_082F42B0 - - .align 2 -gUnknown_082F4304:: @ 82F4304 - .4byte gUnknown_082F42B8 - .4byte gUnknown_082F42D0 - - .align 2 -gUnknown_082F430C:: @ 82F430C - spr_template 0x0001, 0x0001, gUnknown_0852491C, gUnknown_082F42E8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F4324:: @ 82F4324 - spr_template 0x0002, 0x0002, gUnknown_08524914, gUnknown_082F42EC, NULL, gDummySpriteAffineAnimTable, sub_8022A20 - - .align 2 -gUnknown_082F433C:: @ 82F433C - spr_template 0x0003, 0x0002, gUnknown_0852490C, gUnknown_082F42F4, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F4354:: @ 82F4354 - spr_template 0x0004, 0x0004, gUnknown_08524944, gUnknown_082F42FC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F436C:: @ 82F436C - spr_template 0x0005, 0x0005, gUnknown_085249D4, gUnknown_082F4300, NULL, gUnknown_082F4304, SpriteCallbackDummy - - .align 2 -gUnknown_082F4384:: @ 82F4384 - .byte 0x09, 0x02, 0x08, 0x00, 0x9c, 0x00, 0x00, 0x00 - .4byte gUnknown_082F420C - .4byte gUnknown_082F422C - - .byte 0x08, 0x02, 0x08, 0x00, 0xb4, 0x00, 0x00, 0x00 - .4byte gUnknown_082F420C - .4byte gUnknown_082F422C - - .byte 0x08, 0x02, 0x08, 0x00, 0xcc, 0x00, 0x00, 0x00 - .4byte gUnknown_082F420C - .4byte gUnknown_082F422C - - .align 2 -gUnknown_082F43B4:: @ 82F43B4 - .4byte gText_SpaceTimes2 - .4byte gText_XDotY - .4byte gText_Var1Berry - .4byte gText_NeatnessRankings - .4byte gText_CoopRankings - .4byte gText_PressingPowerRankings - - .align 2 -gUnknown_082F43CC:: @ 82F43CC - .4byte NULL - .4byte sub_8022C58 - .4byte sub_8022CB0 - .4byte sub_8022D14 - .4byte sub_8022E1C - .4byte sub_8022E3C - .4byte sub_8022E5C - .4byte sub_8022EAC - .4byte sub_8022F04 - .4byte sub_8022F1C - .4byte sub_8023070 - .4byte sub_80231B8 - .4byte sub_80232EC - .4byte sub_80238F0 - .4byte sub_8023998 - .4byte sub_8023A30 - .4byte sub_8023BC0 - .4byte sub_8023CAC - .4byte sub_8024048 - .4byte sub_8024134 - .4byte sub_8024228 - .4byte sub_80242E0 - .4byte sub_80243BC - .4byte sub_8024444 - .4byte sub_8024508 - .4byte sub_8024568 - - .align 2 -gUnknown_082F4434:: @ 82F4434 - .byte 0x02, 0x04, 0x06, 0x07, 0x03, 0x05, 0x08, 0x0b - .byte 0x03, 0x07, 0x0b, 0x0f, 0x04, 0x08, 0x0c, 0x11 - -gUnknown_082F4444:: @ 82F4444 - .byte 0x05, 0x07, 0x09, 0x0c - -gUnknown_082F4448:: @ 82F4448 - .byte 0x03, 0x07, 0x0f, 0x1f - - .align 2 -gUnknown_082F7BA4_UnrefDupe:: @ 82F444C struct BgTemplate - .4byte 0x000001e0 - .4byte 0x000012c9 - .4byte 0x000012ea - .4byte 0x000021ff - .4byte 0x000000ff - .4byte 0x00000000 - - .align 2 -gUnknown_082F7BBC_UnrefDupe:: @ 82F4464 - window_template 0x00, 0x01, 0x01, 0x1c, 0x02, 0x0d, 0x0013 - window_template 0x00, 0x01, 0x05, 0x1c, 0x0e, 0x0d, 0x004b - - .align 2 -gUnknown_082F7BCC_UnrefDupe:: @ 82F4474 - window_template 0x00, 0x01, 0x05, 0x1c, 0x07, 0x0d, 0x004b - - .align 2 -gUnknown_082F7BD4_UnrefDupe:: @ 82F447C - window_template 0x00, 0x01, 0x08, 0x13, 0x03, 0x0d, 0x0013 - window_template 0x00, 0x16, 0x07, 0x06, 0x04, 0x0d, 0x004c - - .align 2 -gUnknown_082F7BE4_UnrefDupe:: @ 82F448C - window_template 0x00, 0x04, 0x06, 0x16, 0x05, 0x0d, 0x0013 - - .align 2 -gUnknown_082F7BEC_UnrefDupe:: @ 82F4494 - window_template 0x00, 0x05, 0x08, 0x13, 0x03, 0x0d, 0x0013 - - .align 2 -gUnknown_082F449C:: @ 82F449C - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - .byte 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x03, 0x08 - .byte 0x09, 0x00, 0x00, 0x01, 0x02, 0x05, 0x06, 0x03 - .byte 0x04, 0x05, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x02, 0x09 - .byte 0x00, 0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x02 - .byte 0x03, 0x04, 0x09, 0x00, 0x00, 0x01, 0x06, 0x07 - .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x09, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x00 - .byte 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01 - .byte 0x02, 0x03, 0x00, 0x00, 0x05, 0x06, 0x07, 0x08 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x07 - .byte 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03 - .byte 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 - .byte 0x01, 0x02, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08 - .byte 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 - .byte 0x08, 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 - .byte 0x06, 0x07, 0x08, 0x04, 0x05, 0x06, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x03, 0x04, 0x05, 0x05, 0x06, 0x03 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x04, 0x05, 0x06, 0x06, 0x07, 0x02, 0x02 - .byte 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x04, 0x05, 0x05, 0x06, 0x07, 0x07, 0x08 - .byte 0x01, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x04 - .byte 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x00 - .byte 0x00, 0x01, 0x02, 0x02, 0x03, 0x04, 0x01, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01 - .byte 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00 - .byte 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01 - .byte 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x00, 0x00 - .byte 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x02 - .byte 0x01, 0x02, 0x03, 0x02, 0x03, 0x04, 0x03, 0x04 - .byte 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09 - .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x09, 0x09 - .byte 0x09, 0x09, 0x00, 0x00, 0x01, 0x01, 0x00, 0x09 - .byte 0x09, 0x09, 0x09, 0x09, 0x02, 0x02, 0x00, 0x00 - .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x03, 0x03 - .byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x09 - .byte 0x03, 0x03, 0x04, 0x04, 0x00, 0x00, 0x01, 0x01 - .byte 0x02, 0x02, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x06, 0x00, 0x00, 0x00, 0x03, 0x05, 0x07 - .byte 0x00, 0x00, 0x02, 0x04, 0x06, 0x08, 0x00, 0x01 - .byte 0x03, 0x05, 0x06, 0x09 - - .align 2 -gUnknown_082F7DF0_UnrefDupe:: @ 82F4698 - .incbin "graphics/interface/dodrioberry_bg1.gbapal" - - .align 2 - .incbin "graphics/interface/dodrioberry_bg2.gbapal" - - .align 2 -gUnknown_082F7E30_UnrefDupe:: @ 82F46B8 - .incbin "graphics/interface/dodrioberry_pkmn.gbapal" - - .align 2 -gUnknown_082F7E50_UnrefDupe:: @ 82F46D8 - .incbin "graphics/interface/dodrioberry_shiny.gbapal" - - .align 2 -gUnknown_082F7E70_UnrefDupe:: @ 82F46F8 - .incbin "graphics/interface/dodrioberry_status.gbapal" - - .align 2 -gUnknown_082F7E90_UnrefDupe:: @ 82F4718 - .incbin "graphics/interface/dodrioberry_berrysprites.gbapal" - - .align 2 -gUnknown_082F7EB0_UnrefDupe:: @ 82F4738 - .incbin "graphics/interface/dodrioberry_berrysprites.4bpp.lz" - - .align 2 -gUnknown_082F8064_UnrefDupe:: @ 82F490C - .incbin "graphics/interface/dodrioberry_platform.gbapal" - - .align 2 -gUnknown_082F8084_UnrefDupe:: @ 82F492C - .incbin "graphics/interface/dodrioberry_bg1.4bpp.lz" - - .align 2 -gUnknown_082F8914_UnrefDupe:: @ 82F51BC - .incbin "graphics/interface/dodrioberry_bg2.4bpp.lz" - - .align 2 -gUnknown_082F96E0_UnrefDupe:: @ 82F5F88 - .incbin "graphics/interface/dodrioberry_status.4bpp.lz" - - .align 2 -gUnknown_082F9774_UnrefDupe:: @ 82F601C - .incbin "graphics/interface/dodrioberry_platform.4bpp.lz" - - .align 2 -gUnknown_082F98BC_UnrefDupe:: @ 82F6164 - .incbin "graphics/interface/dodrioberry_pkmn.4bpp.lz" - - .align 2 -gUnknown_082FAAD8_UnrefDupe:: @ 82F7380 - .incbin "graphics/interface/dodrioberry_bg1.bin.lz" - - .align 2 -gUnknown_082FAD44_UnrefDupe:: @ 82F75EC - .incbin "graphics/interface/dodrioberry_bg2right.bin.lz" - - .align 2 -gUnknown_082FAF94_UnrefDupe:: @ 82F783C - .incbin "graphics/interface/dodrioberry_bg2left.bin.lz" - - .align 2 -gUnknown_082F7A88:: @ 82F7A88 - .byte 0x28, 0x18, 0x0d, 0x20, 0x13, 0x0a, 0x16, 0x0d - .byte 0x07, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F7A94:: @ 82F7A94 - .byte 0x08, 0x05, 0x08, 0x0b, 0x0f, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F7A9C:: @ 82F7A9C - .byte 0x05, 0x0a, 0x14, 0x1e, 0x32, 0x46, 0x64, 0x00 - - .align 2 -gUnknown_082F7AA4:: @ 82F7AA4 - .byte 0x0f, 0x10, 0x11, 0x12, 0x13, 0x13, 0x12, 0x11 - .byte 0x10, 0x0f, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 - .byte 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21 - .byte 0x22, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x00, 0x00 - - .align 2 -gUnknown_082F7AC4:: @ 82F7AC4 - .4byte sub_8024DBC - .4byte sub_8024E00 - .4byte sub_8024E38 - .4byte sub_8024F10 - .4byte sub_8024F38 - .4byte sub_8025198 - .4byte sub_8025324 - .4byte sub_8025470 - .4byte sub_8025644 - .4byte sub_80256AC - .4byte sub_8025758 - .4byte sub_80250D4 - - .align 2 -gUnknown_082F7AF4:: @ 82F7AF4 - .4byte sub_8024DBC - .4byte sub_8024E00 - .4byte sub_8024E38 - .4byte sub_8024F10 - .4byte sub_8024FFC - .4byte sub_8025230 - .4byte sub_8025324 - .4byte sub_8025470 - .4byte sub_8025644 - .4byte sub_80256AC - .4byte sub_8025758 - .4byte sub_8025158 - - .align 2 -gUnknown_082F7B24:: @ 82F7B24 - .2byte 0x000a, 0x001e, 0x0032, 0x0032 - - .align 2 -gUnknown_082F7B2C:: @ 82F7B2C - .byte 0x00, 0x05, 0x01, 0x14, 0x0b, 0x0f, 0x01, 0x00 - - .align 2 -gUnknown_082F7B34:: @ 82F7B34 - .4byte gText_BerriesPicked - .4byte gText_BestScore - .4byte gText_BerriesInRowFivePlayers - - .align 2 -gUnknown_082F7B40:: @ 82F7B40 - .byte 0x04, 0x07, 0x04, 0x00 - - .align 2 -gUnknown_082F7B44:: @ 82F7B44 - .2byte 0x0019, 0x0029, 0x0039 - -gUnknown_082F7B4A:: @ 82F7B4A - .2byte 0x0019, 0x0029, 0x0049 - - .align 2 -gUnknown_082F7B50:: @ 82F7B50 - .2byte 0x270f, 0x0000, 0x005a, 0x270f, 0x270f, 0x270f, 0x0046, 0x270f - .2byte 0x270f, 0x0000, 0x270f, 0x0000, 0x270f, 0x270f, 0x003c, 0x0000 - .2byte 0x270f, 0x270f, 0x270f, 0x0000 - - .align 2 -gUnknown_082F7B78:: @ 82F7B78 - .string "ÀÁÂÇÈÉÊ$" - - .align 2 -gUnknown_082F7B80:: @ 82F7B80 - .string "ABCDEFG$" - - .align 2 -gUnknown_082F7B88:: @ 82F7B88 - .string "0123456$" - - .align 2 -gUnknown_082F7B90:: @ 82F7B90 - .4byte gUnknown_082F7B78 - .4byte gUnknown_082F7B78 - .4byte gUnknown_082F7B78 - .4byte gUnknown_082F7B80 - .4byte gUnknown_082F7B88 - - .align 2 -gUnknown_082F7BA4:: @ 82F7BA4 struct BgTemplate - .4byte 0x000001e0 - .4byte 0x000012c9 - .4byte 0x000012ea - .4byte 0x000021ff - .4byte 0x000000ff - .4byte 0x00000000 - - .align 2 -gUnknown_082F7BBC:: @ 82F7BBC - window_template 0x00, 0x01, 0x01, 0x1c, 0x02, 0x0d, 0x0013 - window_template 0x00, 0x01, 0x05, 0x1c, 0x0e, 0x0d, 0x004b - - .align 2 -gUnknown_082F7BCC:: @ 82F7BCC - window_template 0x00, 0x01, 0x05, 0x1c, 0x07, 0x0d, 0x004b - - .align 2 -gUnknown_082F7BD4:: @ 82F7BD4 - window_template 0x00, 0x01, 0x08, 0x13, 0x03, 0x0d, 0x0013 - window_template 0x00, 0x16, 0x07, 0x06, 0x04, 0x0d, 0x004c - - .align 2 -gUnknown_082F7BE4:: @ 82F7BE4 - window_template 0x00, 0x04, 0x06, 0x16, 0x05, 0x0d, 0x0013 - - .align 2 -gUnknown_082F7BEC:: @ 82F7BEC - window_template 0x00, 0x05, 0x08, 0x13, 0x03, 0x0d, 0x0013 - - .align 2 -gUnknown_082F449C_UnrefDupe:: @ 82F7BF4 - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - .byte 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x03, 0x08 - .byte 0x09, 0x00, 0x00, 0x01, 0x02, 0x05, 0x06, 0x03 - .byte 0x04, 0x05, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x02, 0x09 - .byte 0x00, 0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x02 - .byte 0x03, 0x04, 0x09, 0x00, 0x00, 0x01, 0x06, 0x07 - .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x09, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x00 - .byte 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01 - .byte 0x02, 0x03, 0x00, 0x00, 0x05, 0x06, 0x07, 0x08 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x07 - .byte 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03 - .byte 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 - .byte 0x01, 0x02, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08 - .byte 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 - .byte 0x08, 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 - .byte 0x06, 0x07, 0x08, 0x04, 0x05, 0x06, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x03, 0x04, 0x05, 0x05, 0x06, 0x03 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x04, 0x05, 0x06, 0x06, 0x07, 0x02, 0x02 - .byte 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x04, 0x05, 0x05, 0x06, 0x07, 0x07, 0x08 - .byte 0x01, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x04 - .byte 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x00 - .byte 0x00, 0x01, 0x02, 0x02, 0x03, 0x04, 0x01, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01 - .byte 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00 - .byte 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01 - .byte 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x00, 0x00 - .byte 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x02 - .byte 0x01, 0x02, 0x03, 0x02, 0x03, 0x04, 0x03, 0x04 - .byte 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09 - .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x09, 0x09 - .byte 0x09, 0x09, 0x00, 0x00, 0x01, 0x01, 0x00, 0x09 - .byte 0x09, 0x09, 0x09, 0x09, 0x02, 0x02, 0x00, 0x00 - .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x03, 0x03 - .byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x09 - .byte 0x03, 0x03, 0x04, 0x04, 0x00, 0x00, 0x01, 0x01 - .byte 0x02, 0x02, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x06, 0x00, 0x00, 0x00, 0x03, 0x05, 0x07 - .byte 0x00, 0x00, 0x02, 0x04, 0x06, 0x08, 0x00, 0x01 - .byte 0x03, 0x05, 0x06, 0x09 - - .align 2 -gDodrioBerryBgPal1:: @ 82F7DF0 - .incbin "graphics/interface/dodrioberry_bg1.gbapal" - - .align 2 - .incbin "graphics/interface/dodrioberry_bg2.gbapal" - - .align 2 -gDodrioBerryPkmnPal:: @ 82F7E30 - .incbin "graphics/interface/dodrioberry_pkmn.gbapal" - - .align 2 -gDodrioBerryShinyPal:: @ 82F7E50 - .incbin "graphics/interface/dodrioberry_shiny.gbapal" - - .align 2 -gDodrioBerryStatusPal:: @ 82F7E70 - .incbin "graphics/interface/dodrioberry_status.gbapal" - - .align 2 -gDodrioBerrySpritesPal:: @ 82F7E90 - .incbin "graphics/interface/dodrioberry_berrysprites.gbapal" - - .align 2 -gDodrioBerrySpritesGfx:: @ 82F7EB0 - .incbin "graphics/interface/dodrioberry_berrysprites.4bpp.lz" - - .align 2 -gDodrioBerryPlatformPal:: @ 82F8064 - .incbin "graphics/interface/dodrioberry_platform.gbapal" - - .align 2 -gDodrioBerryBgGfx1:: @ 82F8084 - .incbin "graphics/interface/dodrioberry_bg1.4bpp.lz" - - .align 2 -gDodrioBerryBgGfx2:: @ 82F8914 - .incbin "graphics/interface/dodrioberry_bg2.4bpp.lz" - - .align 2 -gDodrioBerryStatusGfx:: @ 82F96E0 - .incbin "graphics/interface/dodrioberry_status.4bpp.lz" - - .align 2 -gDodrioBerryPlatformGfx:: @ 82F9774 - .incbin "graphics/interface/dodrioberry_platform.4bpp.lz" - - .align 2 -gDodrioBerryPkmnGfx:: @ 82F98BC - .incbin "graphics/interface/dodrioberry_pkmn.4bpp.lz" - - .align 2 -gDodrioBerryBgTilemap1:: @ 82FAAD8 - .incbin "graphics/interface/dodrioberry_bg1.bin.lz" - - .align 2 -gDodrioBerryBgTilemap2Right:: @ 82FAD44 - .incbin "graphics/interface/dodrioberry_bg2right.bin.lz" - - .align 2 -gDodrioBerryBgTilemap2Left:: @ 82FAF94 - .incbin "graphics/interface/dodrioberry_bg2left.bin.lz" - - .align 2 -gUnknown_082FB1E0:: @ 82FB1E0 - .byte 0x00, 0x00, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FB1E8:: @ 82FB1E8 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FB1F0:: @ 82FB1F0 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FB1F8:: @ 82FB1F8 - .byte 0x00, 0x40, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x00 - - .align 2 -gUnknown_082FB200:: @ 82FB200 - .2byte 0x0000, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB208:: @ 82FB208 - .2byte 0x0040, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB210:: @ 82FB210 - .2byte 0x0080, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB218:: @ 82FB218 - .2byte 0x00c0, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB220:: @ 82FB220 - .2byte 0x0100, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB228:: @ 82FB228 - .4byte gUnknown_082FB200 - .4byte gUnknown_082FB208 - .4byte gUnknown_082FB210 - .4byte gUnknown_082FB218 - .4byte gUnknown_082FB220 - - .align 2 -gUnknown_082FB23C:: @ 82FB23C - .2byte 0x0000, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB244:: @ 82FB244 - .2byte 0x0004, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB24C:: @ 82FB24C - .2byte 0x0008, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB254:: @ 82FB254 - .4byte gUnknown_082FB23C - .4byte gUnknown_082FB244 - .4byte gUnknown_082FB24C - - .align 2 -gUnknown_082FB260:: @ 82FB260 - .2byte 0x0000, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB268:: @ 82FB268 - .2byte 0x0004, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB270:: @ 82FB270 - .2byte 0x0008, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB278:: @ 82FB278 - .2byte 0x000c, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB280:: @ 82FB280 - .2byte 0x0010, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB288:: @ 82FB288 - .2byte 0x0014, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB290:: @ 82FB290 - .2byte 0x0018, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB298:: @ 82FB298 - .2byte 0x001c, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB2A0:: @ 82FB2A0 - .2byte 0x0020, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB2A8:: @ 82FB2A8 - .4byte gUnknown_082FB260 - .4byte gUnknown_082FB268 - .4byte gUnknown_082FB270 - .4byte gUnknown_082FB278 - .4byte gUnknown_082FB280 - .4byte gUnknown_082FB288 - .4byte gUnknown_082FB290 - .4byte gUnknown_082FB298 - .4byte gUnknown_082FB2A0 - - .align 2 -gUnknown_082FB2CC:: @ 82FB2CC - .2byte 0x0000, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB2D4:: @ 82FB2D4 - .4byte gUnknown_082FB2CC - - .align 2 -gUnknown_082FB2D8:: @ 82FB2D8 - obj_pal gDodrioBerryPkmnPal, 0x0000 - - .align 2 -gUnknown_082FB2E0:: @ 82FB2E0 - obj_pal gDodrioBerryShinyPal, 0x0001 - - .align 2 -gUnknown_082FB2E8:: @ 82FB2E8 - obj_pal gDodrioBerryStatusPal, 0x0002 - - .align 2 -gUnknown_082FB2F0:: @ 82FB2F0 - spr_template 0x0001, 0x0002, gUnknown_082FB1E8, gUnknown_082FB254, NULL, gDummySpriteAffineAnimTable, nullsub_15 - - .align 2 - .byte 0xD4, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44 - .byte 0x45, 0xFB, 0x00, 0x00 - - .align 2 -gUnknown_082FB314:: @ 82FB314 - obj_pal gDodrioBerrySpritesPal, 0x0003 - - .align 2 -gUnknown_082FB31C:: @ 82FB31C - .2byte 0x0058, 0x0080, 0x00a8, 0x00d0 - - .align 2 -gUnknown_082FB324:: @ 82FB324 - spr_template 0x0002, 0x0003, gUnknown_082FB1F0, gUnknown_082FB2A8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FB33C:: @ 82FB33C - spr_template 0x0002, 0x0003, gUnknown_082FB1E8, gUnknown_082FB2A8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FB354:: @ 82FB354 - .byte 0x1E, 0x14 - -gUnknown_082FB356:: @ 82FB356 - .byte 0xE6, 0x00 - - .align 2 -gUnknown_082FB358:: @ 82FB358 - .2byte 0x0037, 0x001e, 0x004a, 0x0000 - - .align 2 -gUnknown_082FB360:: @ 82FB360 - obj_pal gDodrioBerryPlatformPal, 0x0006 - - .align 2 -gUnknown_082FB368:: @ 82FB368 - spr_template 0x0005, 0x0006, gUnknown_082FB1F8, gUnknown_082FB2D4, NULL, gDummySpriteAffineAnimTable, sub_8028CF4 - - .align 2 -gUnknown_082FB380:: @ 82FB380 - .byte 0x01, 0x02, 0x03 - -gUnknown_082FB383:: @ 82FB383 - .byte 0x01, 0x04, 0x05 - .byte 0x01, 0x08, 0x09 - .byte 0x01, 0x06, 0x07 - - .align 2 -gUnknown_082FB38C:: @ 82FB38C - .byte 0x0c, 0x06, 0x00, 0x00 - - .align 2 -gUnknown_082FB390:: @ 82FB390 - .byte 0x09, 0x0a, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00 - - .align 2 -gUnknown_082FB398:: @ 82FB398 - .byte 0x0c, 0x06, 0x00, 0x00, 0x12, 0x0a, 0x00, 0x00 - .byte 0x06, 0x0a, 0x00, 0x00 - - .align 2 -gUnknown_082FB3A4:: @ 82FB3A4 - .byte 0x09, 0x0a, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00 - .byte 0x15, 0x0a, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00 - - .align 2 -gUnknown_082FB3B4:: @ 82FB3B4 - .byte 0x0c, 0x06, 0x00, 0x00, 0x12, 0x0a, 0x00, 0x00 - .byte 0x17, 0x06, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00 - .byte 0x06, 0x0a, 0x00, 0x00 - - .align 2 -gUnknown_082FB3C8:: @ 82FB3C8 - .4byte gUnknown_082FB38C - .4byte gUnknown_082FB390 - .4byte gUnknown_082FB398 - .4byte gUnknown_082FB3A4 - .4byte gUnknown_082FB3B4 - - .align 2 -gUnknown_082FB3DC:: @ 82FB3DC - .4byte gText_1Colon - .4byte gText_2Colon - .4byte gText_3Colon - .4byte gText_4Colon - .4byte gText_5Colon - - .align 2 -gUnknown_082FB3F0:: @ 82FB3F0 - .2byte 0x005c, 0x0084, 0x00ac, 0x00d4 - -gUnknown_082FB3F8:: @ 82FB3F8 - .2byte 0x0021, 0x0031, 0x0041, 0x0051, 0x0061 - -gUnknown_082FB402:: @ 82FB402 - .2byte 0x0011, 0x0021, 0x0031, 0x0041, 0x0051 - - .align 2 -gUnknown_082FB40C:: @ 82FB40C - .4byte 0x00000000, sub_8029338 - .4byte 0x00000001, sub_8029440 - .4byte 0x00000002, sub_802988C - .4byte 0x00000003, sub_802A010 - .4byte 0x00000004, sub_802A380 - .4byte 0x00000005, sub_802A454 - .4byte 0x00000006, sub_802A534 - .4byte 0x00000007, sub_802A588 - .4byte 0x00000008, unused_0 - .4byte 0x00000009, nullsub_16 - - .align 2 -gUnknown_082FB45C:: @ 82FB45C - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00 - - .align 2 -gPkmnJumpSpecies:: @ 82FB464 - .2byte SPECIES_BULBASAUR, 0x0002 - .2byte SPECIES_CHARMANDER, 0x0001 - .2byte SPECIES_SQUIRTLE, 0x0000 - .2byte SPECIES_CATERPIE, 0x0001 - .2byte SPECIES_METAPOD, 0x0001 - .2byte SPECIES_WEEDLE, 0x0001 - .2byte SPECIES_KAKUNA, 0x0001 - .2byte SPECIES_RATTATA, 0x0001 - .2byte SPECIES_RATICATE, 0x0001 - .2byte SPECIES_PIKACHU, 0x0000 - .2byte SPECIES_SANDSHREW, 0x0000 - .2byte SPECIES_NIDORAN_F, 0x0000 - .2byte SPECIES_NIDORAN_M, 0x0000 - .2byte SPECIES_CLEFAIRY, 0x0000 - .2byte SPECIES_VULPIX, 0x0000 - .2byte SPECIES_JIGGLYPUFF, 0x0002 - .2byte SPECIES_ODDISH, 0x0002 - .2byte SPECIES_PARAS, 0x0001 - .2byte SPECIES_MEOWTH, 0x0000 - .2byte SPECIES_PSYDUCK, 0x0002 - .2byte SPECIES_MANKEY, 0x0001 - .2byte SPECIES_GROWLITHE, 0x0001 - .2byte SPECIES_POLIWAG, 0x0002 - .2byte SPECIES_BELLSPROUT, 0x0002 - .2byte SPECIES_SHELLDER, 0x0001 - .2byte SPECIES_KRABBY, 0x0001 - .2byte SPECIES_EXEGGCUTE, 0x0002 - .2byte SPECIES_CUBONE, 0x0000 - .2byte SPECIES_DITTO, 0x0002 - .2byte SPECIES_EEVEE, 0x0000 - .2byte SPECIES_OMANYTE, 0x0001 - .2byte SPECIES_KABUTO, 0x0001 - .2byte SPECIES_CHIKORITA, 0x0002 - .2byte SPECIES_CYNDAQUIL, 0x0001 - .2byte SPECIES_TOTODILE, 0x0000 - .2byte SPECIES_SPINARAK, 0x0001 - .2byte SPECIES_PICHU, 0x0000 - .2byte SPECIES_CLEFFA, 0x0000 - .2byte SPECIES_IGGLYBUFF, 0x0002 - .2byte SPECIES_TOGEPI, 0x0002 - .2byte SPECIES_MAREEP, 0x0000 - .2byte SPECIES_BELLOSSOM, 0x0002 - .2byte SPECIES_MARILL, 0x0002 - .2byte SPECIES_SUNKERN, 0x0002 - .2byte SPECIES_WOOPER, 0x0002 - .2byte SPECIES_PINECO, 0x0002 - .2byte SPECIES_SNUBBULL, 0x0000 - .2byte SPECIES_SHUCKLE, 0x0002 - .2byte SPECIES_TEDDIURSA, 0x0000 - .2byte SPECIES_SLUGMA, 0x0002 - .2byte SPECIES_SWINUB, 0x0000 - .2byte SPECIES_HOUNDOUR, 0x0001 - .2byte SPECIES_PHANPY, 0x0000 - .2byte SPECIES_PORYGON2, 0x0000 - .2byte SPECIES_TYROGUE, 0x0001 - .2byte SPECIES_SMOOCHUM, 0x0002 - .2byte SPECIES_ELEKID, 0x0001 - .2byte SPECIES_MAGBY, 0x0001 - .2byte SPECIES_LARVITAR, 0x0001 - .2byte SPECIES_TREECKO, 0x0001 - .2byte SPECIES_TORCHIC, 0x0002 - .2byte SPECIES_MUDKIP, 0x0000 - .2byte SPECIES_MARSHTOMP, 0x0000 - .2byte SPECIES_POOCHYENA, 0x0001 - .2byte SPECIES_ZIGZAGOON, 0x0000 - .2byte SPECIES_LINOONE, 0x0000 - .2byte SPECIES_WURMPLE, 0x0001 - .2byte SPECIES_SILCOON, 0x0002 - .2byte SPECIES_CASCOON, 0x0002 - .2byte SPECIES_LOTAD, 0x0002 - .2byte SPECIES_SEEDOT, 0x0001 - .2byte SPECIES_RALTS, 0x0000 - .2byte SPECIES_KIRLIA, 0x0000 - .2byte SPECIES_SURSKIT, 0x0002 - .2byte SPECIES_SHROOMISH, 0x0002 - .2byte SPECIES_NINCADA, 0x0001 - .2byte SPECIES_WHISMUR, 0x0000 - .2byte SPECIES_AZURILL, 0x0002 - .2byte SPECIES_SKITTY, 0x0000 - .2byte SPECIES_SABLEYE, 0x0000 - .2byte SPECIES_MAWILE, 0x0000 - .2byte SPECIES_ARON, 0x0001 - .2byte SPECIES_MEDITITE, 0x0002 - .2byte SPECIES_ELECTRIKE, 0x0001 - .2byte SPECIES_PLUSLE, 0x0001 - .2byte SPECIES_MINUN, 0x0001 - .2byte SPECIES_VOLBEAT, 0x0000 - .2byte SPECIES_ILLUMISE, 0x0000 - .2byte SPECIES_ROSELIA, 0x0002 - .2byte SPECIES_GULPIN, 0x0002 - .2byte SPECIES_NUMEL, 0x0002 - .2byte SPECIES_TORKOAL, 0x0002 - .2byte SPECIES_SPOINK, 0x0000 - .2byte SPECIES_TRAPINCH, 0x0002 - .2byte SPECIES_CACNEA, 0x0002 - .2byte SPECIES_ANORITH, 0x0001 - .2byte SPECIES_WYNAUT, 0x0000 - .2byte SPECIES_SNORUNT, 0x0000 - .2byte SPECIES_CLAMPERL, 0x0001 - .2byte SPECIES_BAGON, 0x0001 - - .align 2 -gUnknown_082FB5F4:: @ 82FB5F4 - .4byte sub_802B248 - .4byte sub_802B2D4 - .4byte sub_802B368 - .4byte sub_802B3D4 - .4byte sub_802B4CC - .4byte sub_802B5C8 - .4byte sub_802B664 - .4byte sub_802B6B8 - .4byte sub_802B720 - - .align 2 -gUnknown_082FB618:: @ 82FB618 - .4byte sub_802B29C - .4byte sub_802B31C - .4byte sub_802B3B4 - .4byte sub_802B470 - .4byte sub_802B568 - .4byte sub_802B628 - .4byte sub_802B664 - .4byte sub_802B704 - .4byte sub_802B720 - - .align 2 -gUnknown_082FB63C:: @ 82FB63C - .2byte 0x001a, 0x001f, 0x0024, 0x0029, 0x002e, 0x0033, 0x0038, 0x003d - - .align 2 -gUnknown_082FB64C:: @ 82FB64C - .2byte 0x0000, 0x0001, 0x0001, 0x0002 - - .align 2 -gUnknown_082FB654:: @ 82FB654 - .2byte 0x005f, 0x0066, 0x00e4, 0x0105 - - .align 2 -gUnknown_082FB65C:: @ 82FB65C - .byte 0xfd, 0xfa, 0xf8, 0xf6, 0xf3, 0xf1, 0xef, 0xed - .byte 0xeb, 0xe9, 0xe7, 0xe5, 0xe4, 0xe3, 0xe2, 0xe2 - .byte 0xe2, 0xe4, 0xe5, 0xe6, 0xe7, 0xe9, 0xea, 0xec - .byte 0xee, 0xef, 0xf1, 0xf3, 0xf5, 0xf8, 0xfa, 0xfc - .byte 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0xfd, 0xfa, 0xf7, 0xf5, 0xf2, 0xf0, 0xee, 0xec - .byte 0xea, 0xe8, 0xe6, 0xe4, 0xe3, 0xe2, 0xe2, 0xe4 - .byte 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf5 - .byte 0xf7, 0xfa, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0xfd, 0xfa, 0xf7, 0xf5, 0xf3, 0xf1, 0xef, 0xed - .byte 0xeb, 0xe9, 0xe7, 0xe5, 0xe4, 0xe3, 0xe2, 0xe2 - .byte 0xe2, 0xe2, 0xe3, 0xe3, 0xe4, 0xe4, 0xe5, 0xe5 - .byte 0xe6, 0xe7, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2 - .byte 0xf4, 0xf5, 0xf7, 0xfa, 0xfc, 0xff, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FB6EC:: @ 82FB6EC - .4byte 0x00000000, 0x00000000, 0x00000032, 0x00000064 - .4byte 0x000000c8, 0x000001f4 - - .align 2 -gUnknown_082FB704:: @ 82FB704 - .2byte 0x008a, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, 0x0093 - - .align 2 -gUnknown_082FB714:: @ 82FB714 - .4byte 0x00001388, 0x00000001, 0x00001f40, 0x00000002 - .4byte 0x00002ee0, 0x00000003, 0x00003e80, 0x00000004 - .4byte 0x00004e20, 0x00000005 - - .align 2 -gPkmnJumpPal1:: @ 82FB73C - .incbin "graphics/interface/pkmnjump_pal1.gbapal" - - .align 2 -gPkmnJumpPal2:: @ 82FB75C - .incbin "graphics/interface/pkmnjump_pal2.gbapal" - - .align 2 -gPkmnJumpRopeGfx1:: @ 82FB77C - .incbin "graphics/interface/pkmnjump_rope1.4bpp.lz" - - .align 2 -gPkmnJumpRopeGfx2:: @ 82FB89C - .incbin "graphics/interface/pkmnjump_rope2.4bpp.lz" - - .align 2 -gPkmnJumpRopeGfx3:: @ 82FBA70 - .incbin "graphics/interface/pkmnjump_rope3.4bpp.lz" - - .align 2 -gPkmnJumpRopeGfx4:: @ 82FBBA0 - .incbin "graphics/interface/pkmnjump_rope4.4bpp.lz" - - .align 2 -gPkmnJumpStarGfx:: @ 82FBC9C - .incbin "graphics/interface/pkmnjump_star.4bpp.lz" - - .align 2 -gUnknown_082FBE08:: @ 82FBE08 - obj_tiles gPkmnJumpRopeGfx1, 0x0600, 0x0005 - - .align 2 - obj_tiles gPkmnJumpRopeGfx2, 0x0c00, 0x0006 - - .align 2 - obj_tiles gPkmnJumpRopeGfx3, 0x0600, 0x0007 - - .align 2 - obj_tiles gPkmnJumpRopeGfx4, 0x0600, 0x0008 - - .align 2 - obj_tiles gPkmnJumpStarGfx, 0x0200, 0x000a - - .align 2 -gUnknown_082FBE30:: @ 82FBE30 - obj_pal gPkmnJumpPal1, 0x0005 - - .align 2 - obj_pal gPkmnJumpPal2, 0x0006 - - .align 2 -gUnknown_082FBE40:: @ 82FBE40 - spr_template 0x0000, 0x0000, gUnknown_082FBEC8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_082FBE58:: @ 82FBE58 - .2byte 0x0060, 0x0060, 0x0060, 0x0072, 0x0078, 0x0078, 0x0078, 0x0072 - .2byte 0x0060, 0x0060, 0x0046, 0x0050, 0x0060, 0x0072, 0x0078, 0x0080 - .2byte 0x0078, 0x0072, 0x0060, 0x0050, 0x0032, 0x0048, 0x0060, 0x0072 - .2byte 0x0080, 0x0088, 0x0080, 0x0072, 0x0060, 0x0048, 0x002a, 0x0048 - .2byte 0x0060, 0x0072, 0x0080, 0x0088, 0x0080, 0x0072, 0x0060, 0x0048 - -gUnknown_082FBEA8:: @ 82FBEA8 - .2byte 0x0010, 0x0028, 0x0048, 0x0068, 0x0088, 0x00a8, 0x00c8, 0x00e0 - - .align 2 -gUnknown_082FBEB8:: @ 82FBEB8 - .4byte gUnknown_082FBF78 - .4byte gUnknown_082FBF90 - .4byte gUnknown_082FBFA8 - .4byte gUnknown_082FBFC0 - - .align 2 -gUnknown_082FBEC8:: @ 82FBED0 - .byte 0x00, 0x00, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FBED0:: @ 82FBED0 - .byte 0x00, 0x80, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FBED8:: @ 82FBED8 - .byte 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FBEE0:: @ 82FBEE0 - .byte 0x00, 0x40, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FBEE8:: @ 82FBEE8 - .2byte 0x0000, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBEF0:: @ 82FBEF0 - .2byte 0x0008, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBEF8:: @ 82FBEF8 - .2byte 0x0010, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF00:: @ 82FBF00 - .2byte 0x0018, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF08:: @ 82FBF08 - .2byte 0x0020, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF10:: @ 82FBF10 - .2byte 0x0028, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF18:: @ 82FBF18 - .2byte 0x0000, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF20:: @ 82FBF20 - .2byte 0x0010, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF28:: @ 82FBF28 - .2byte 0x0020, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF30:: @ 82FBF30 - .2byte 0x0030, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF38:: @ 82FBF38 - .2byte 0x0040, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF40:: @ 82FBF40 - .2byte 0x0050, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF48:: @ 82FBF48 - .4byte gUnknown_082FBEE8 - .4byte gUnknown_082FBEF0 - .4byte gUnknown_082FBEF8 - .4byte gUnknown_082FBF00 - .4byte gUnknown_082FBF08 - .4byte gUnknown_082FBF10 - - .align 2 -gUnknown_082FBF60:: @ 82FBF60 - .4byte gUnknown_082FBF18 - .4byte gUnknown_082FBF20 - .4byte gUnknown_082FBF28 - .4byte gUnknown_082FBF30 - .4byte gUnknown_082FBF38 - .4byte gUnknown_082FBF40 - - .align 2 -gUnknown_082FBF78:: @ 82FBF78 - spr_template 0x0005, 0x0005, gUnknown_082FBED0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FBF90:: @ 82FBF90 - spr_template 0x0006, 0x0005, gUnknown_082FBED8, gUnknown_082FBF60, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FBFA8:: @ 82FBFA8 - spr_template 0x0007, 0x0005, gUnknown_082FBEE0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FBFC0:: @ 82FBFC0 - spr_template 0x0008, 0x0005, gUnknown_082FBEE0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FBFD8:: @ 82FBFD8 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x04, 0x00, 0x00 - - .align 2 -gUnknown_082FBFE0:: @ 82FBFE0 - .2byte 0x0000, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBFE8:: @ 82FBFE8 - .2byte 0x0000, 0x0004 - .2byte 0x0004, 0x0004 - .2byte 0x0008, 0x0004 - .2byte 0x000c, 0x0004 - .2byte 0xfffd, 0x0001 - .2byte 0x0000, 0x0004 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FC004:: @ 82FC004 - .4byte gUnknown_082FBFE0 - .4byte gUnknown_082FBFE8 - - .align 2 -gUnknown_082FC00C:: @ 82FC00C - spr_template 0x000a, 0x0005, gUnknown_082FBFD8, gUnknown_082FC004, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gPkmnJumpPal3:: @ 82FC024 - .incbin "graphics/interface/pkmnjump_pal3.gbapal" - - .align 2 -gPkmnJumpBgPal:: @ 82FC044 - .incbin "graphics/interface/pkmnjump_bg.gbapal" - - .align 2 -gPkmnJumpBgGfx:: @ 82FC064 - .incbin "graphics/interface/pkmnjump_bg.4bpp.lz" - - .align 2 -gPkmnJumpBgTilemap:: @ 82FC290 - .incbin "graphics/interface/pkmnjump_bg.bin.lz" - - .align 2 -gPkmnJumpVenusaurPal:: @ 82FC440 - .incbin "graphics/interface/pkmnjump_venusaur.gbapal" - - .align 2 -gPkmnJumpVenusaurGfx:: @ 82FC460 - .incbin "graphics/interface/pkmnjump_venusaur.4bpp.lz" - - .align 2 -gPkmnJumpVenusaurTilemap:: @ 82FCDB0 - .incbin "graphics/interface/pkmnjump_venusaur.bin.lz" - - .align 2 -gPkmnJumpResultsPal:: @ 82FD168 - .incbin "graphics/interface/pkmnjump_results.gbapal" - - .align 2 -gPkmnJumpResultsGfx:: @ 82FD188 - .incbin "graphics/interface/pkmnjump_results.4bpp.lz" - - .align 2 -gPkmnJumpResultsTilemap:: @ 82FDC38 - .incbin "graphics/interface/pkmnjump_results.bin.lz" - - .align 2 -gUnknown_082FE164:: @ 82FE164 struct BgTemplate - .4byte 0x000001b0, 0x000025e6, 0x000016c9, 0x000031df - - .align 2 -gUnknown_082FE174:: @ 82FE174 - window_template 0x00, 0x13, 0x00, 0x06, 0x02, 0x02, 0x0013 - window_template 0x00, 0x08, 0x00, 0x06, 0x02, 0x02, 0x001f - window_template_terminator - - .align 2 -gUnknown_082FE18C:: @ 82FE18C - .4byte 0x00000000, sub_802D150 - .4byte 0x00000001, sub_802D2E4 - .4byte 0x00000002, sub_802D350 - .4byte 0x00000003, sub_802D3BC - .4byte 0x00000004, sub_802D448 - .4byte 0x00000005, sub_802D4F4 - .4byte 0x00000006, sub_802D598 - .4byte 0x00000007, sub_802D5E4 - .4byte 0x00000009, sub_802D72C - .4byte 0x00000008, sub_802D688 - - .align 2 -gUnknown_082FE1DC:: @ 82FE1DC - .byte 0x00, 0x02, 0x03 - -gUnknown_082FE1DF:: @ 82FE1DF - .byte 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FE1EC:: @ 82FE1EC - obj_tiles gUnknown_082FF1F8, 0x0000, 0x0320 - - .align 2 -gUnknown_082FE1F4:: @ 82FE1F4 - obj_pal gUnknown_082FF1D8, 0x0320 - - .align 2 -gUnknown_082FE1FC:: @ 82FE1FC - .2byte 0x0006, 0x0008, 0x0010, 0x0008 - - .align 2 -gUnknown_082FE204:: @ 82FE204 - .2byte 0x0006, 0x0008, 0x000b, 0x0006, 0x0010, 0x0008 - - .align 2 -gUnknown_082FE210:: @ 82FE210 - .2byte 0x0002, 0x0006, 0x0006, 0x0008, 0x0010, 0x0008, 0x0014, 0x0006 - - .align 2 -gUnknown_082FE220:: @ 82FE220 - .2byte 0x0002, 0x0006, 0x0006, 0x0008, 0x000b, 0x0006 - .2byte 0x0010, 0x0008, 0x0014, 0x0006 - - .align 2 -gUnknown_082FE234:: @ 82FE234 - .4byte gUnknown_082FE1FC - .4byte gUnknown_082FE204 - .4byte gUnknown_082FE210 - .4byte gUnknown_082FE220 - - .align 2 -gUnknown_082FE244:: @ 82FE244 - .2byte 0x0058, 0x0098 - -gUnknown_082FE248:: @ 82FE248 - .2byte 0x0058, 0x0078, 0x0098 - -gUnknown_082FE24E:: @ 82FE24E - .2byte 0x0038, 0x0058, 0x0098, 0x00b8 - -gUnknown_082FE256:: @ 82FE256 - .2byte 0x0038, 0x0058, 0x0078, 0x0098, 0x00b8 - - .align 2 -gUnknown_082FE260:: @ 82FE260 - .4byte gUnknown_082FE244 - .4byte gUnknown_082FE248 - .4byte gUnknown_082FE24E - .4byte gUnknown_082FE256 - - .align 2 -gUnknown_082FE270:: @ 82FE270 - .4byte 0x1c010100, 0x00010f09 - - .align 2 -gUnknown_082FE278:: @ 82FE278 - .4byte gText_JumpsInARow - .4byte gText_BestScore2 - .4byte gText_ExcellentsInARow - - .align 2 -gPkmnJump321StartPal1:: @ 82FE284 - .incbin "graphics/interface/pkmnjump_321start1.gbapal" - - .align 2 -gPkmnJump321StartGfx1:: @ 82FE2A4 - .incbin "graphics/interface/pkmnjump_321start1.4bpp.lz" - - .align 2 -gUnknown_082FE6C8:: @ 82FE6C8 - obj_tiles gPkmnJump321StartGfx1, 0x0c00, 0x2000 - null_obj_tiles - - .align 2 -gUnknown_082FE6D8:: @ 82FE6D8 - obj_pal gPkmnJump321StartPal1, 0x2000 - null_obj_pal - - .align 2 -gUnknown_082FE6E8:: @ 82FE6E8 - .2byte 0x0000, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE6F0:: @ 82FE6F0 - .2byte 0x0010, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE6F8:: @ 82FE6F8 - .2byte 0x0020, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE700:: @ 82FE700 - .2byte 0x0040, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE708:: @ 82FE708 - .2byte 0x0030, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE710:: @ 82FE710 - .2byte 0x0050, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE718:: @ 82FE718 - .4byte gUnknown_082FE6E8 - .4byte gUnknown_082FE6F0 - .4byte gUnknown_082FE6F8 - .4byte gUnknown_082FE700 - .4byte gUnknown_082FE708 - .4byte gUnknown_082FE710 - - .align 2 -gUnknown_082FE730:: @ 82FE730 - spr_template 0x2000, 0x2000, gUnknown_08524914, gUnknown_082FE718, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FE748:: @ 82FE748 - .4byte sub_802E83C - .4byte sub_802E8C8 - .4byte sub_802EA50 - .4byte sub_802EAB0 - - .align 2 -gPkmnJump321StartPal2:: @ 82FE758 - .incbin "graphics/interface/pkmnjump_321start2.gbapal" - - .align 2 -gPkmnJump321StartGfx2:: @ 82FE778 - .incbin "graphics/interface/pkmnjump_321start2.4bpp.lz" - - .align 2 -gUnknown_082FEBCC:: @ 82FEBCC - obj_tiles gPkmnJump321StartGfx2, 0x0e00, 0x0000 - - .align 2 -gUnknown_082FEBD4:: @ 82FEBD4 - obj_pal gPkmnJump321StartPal2, 0x0000 - - .align 2 -gUnknown_082FEBDC:: @ 82FEBDC - .byte 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FEBE4:: @ 82FEBE4 - .byte 0x00, 0x40, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FEBEC:: @ 82FEBEC - .2byte 0x0000, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEBF4:: @ 82FEBF4 - .2byte 0x0010, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEBFC:: @ 82FEBFC - .2byte 0x0020, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEC04:: @ 82FEC04 - .4byte gUnknown_082FEBEC - .4byte gUnknown_082FEBF4 - .4byte gUnknown_082FEBFC - - .align 2 -gUnknown_082FEC10:: @ 82FEC10 - .2byte 0x0030, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEC18:: @ 82FEC18 - .2byte 0x0050, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEC20:: @ 82FEC20 - .4byte gUnknown_082FEC10 - .4byte gUnknown_082FEC18 - - .align 2 -gUnknown_082FEC28:: @ 82FEC28 - .2byte 0x0100, 0x0100 - .2byte 0x0000, 0x0000 - .2byte 0x7fff, 0x0000 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082FEC38:: @ 82FEC38 - .2byte 0x0100, 0x0100 - .2byte 0x0000, 0x0000 - .2byte 0x0010, 0xfff0 - .2byte 0x0800, 0x0000 - .2byte 0x7fff, 0x0000 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082FEC50:: @ 82FEC50 - .2byte 0xffee, 0x0012 - .2byte 0x0800, 0x0000 - .2byte 0x7fff, 0x0000 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082FEC60:: @ 82FEC60 - .2byte 0x0006, 0xfffa - .2byte 0x0800, 0x0000 - .2byte 0xfffc, 0x0004 - .2byte 0x0800, 0x0000 - .2byte 0x0100, 0x0100 - .2byte 0x0000, 0x0000 - .2byte 0x7fff, 0x0000 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082FEC80:: @ 82FEC80 - .4byte gUnknown_082FEC28 - .4byte gUnknown_082FEC38 - .4byte gUnknown_082FEC50 - .4byte gUnknown_082FEC60 - -gUnknown_082FEC90:: @ 82FEC90 - spr_template 0x0000, 0x0000, gUnknown_082FEBDC, gUnknown_082FEC04, NULL, gUnknown_082FEC80, SpriteCallbackDummy - -gUnknown_082FECA8:: @ 82FECA8 - spr_template 0x0000, 0x0000, gUnknown_082FEBE4, gUnknown_082FEC20, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - diff --git a/data/link_rfu.s b/data/link_rfu.s new file mode 100644 index 000000000..c8ae0789f --- /dev/null +++ b/data/link_rfu.s @@ -0,0 +1,244 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + + .align 2 +gWirelessLinkIconPalette:: @ 82ED22C + .incbin "graphics/interface/wireless_link_icon.gbapal" + + .align 2 +gWirelessLinkIconPic:: @ 82ED22C + .incbin "graphics/interface/wireless_link_icon.4bpp.lz" + + .align 2 +gUnknown_082ED370:: @ 82ED370 + .byte 0xff, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37 + .byte 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f + .byte 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47 + .byte 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f + .byte 0x00, 0xab, 0xb5, 0xb6, 0xb1, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0xb2, 0xf1, 0x00, 0xae, 0xad, 0xba + .byte 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8 + .byte 0xa9, 0xaa, 0x00, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f + .byte 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1 + .byte 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9 + .byte 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1 + .byte 0xd2, 0xd3, 0xd4, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6 + .byte 0x00, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb + .byte 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3 + .byte 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb + .byte 0xec, 0xed, 0xee, 0x2d, 0x2f, 0x30, 0x31, 0x32 + .byte 0x33, 0x34, 0x35, 0x36, 0x50, 0x00, 0x01, 0x02 + .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a + .byte 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 + .byte 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a + .byte 0x1b, 0xad, 0xb3, 0xb4, 0x00, 0xaf, 0x7d, 0x7f + .byte 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xa0 + .byte 0xae, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 + .byte 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f + .byte 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67 + .byte 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f + .byte 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77 + .byte 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7e, 0xb0, 0xac + .byte 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23 + .byte 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b + .byte 0x2c, 0x2e, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c + .byte 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94 + + .align 2 +gUnknown_082ED470:: @ 82ED470 + .byte 0x20, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c + .byte 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94 + .byte 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c + .byte 0x9d, 0x9e, 0x9f, 0xa0, 0xe0, 0xe1, 0xe2, 0xe3 + .byte 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb + .byte 0xec, 0xed, 0xee, 0xef, 0xf0, 0x7b, 0xf1, 0x7c + .byte 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x07 + .byte 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f + .byte 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 + .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f + .byte 0x84, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7 + .byte 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf + .byte 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 + .byte 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf + .byte 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7 + .byte 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xa6, 0xdd, 0xa7 + .byte 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xf2 + .byte 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa + .byte 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x01, 0x02, 0x03 + .byte 0x04, 0x05, 0x06, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f + .byte 0xaf, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 + .byte 0x37, 0x38, 0x39, 0x21, 0xdf, 0xa1, 0xb0, 0xa5 + .byte 0xde, 0x24, 0x2a, 0xa2, 0xa3, 0x22, 0x23, 0x20 + .byte 0xa4, 0x20, 0x2f, 0x41, 0x42, 0x43, 0x44, 0x45 + .byte 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d + .byte 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55 + .byte 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63 + .byte 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b + .byte 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73 + .byte 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20 + .byte 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20 + .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 + + .align 2 +gUnknown_082ED570:: @ 82ED570 + .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082ED578:: @ 82ED578 + .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x0005, 0x0010, 0x000a + .2byte 0x000c, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000 + + .align 2 +gUnknown_082ED594:: @ 82ED594 + .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x000a, 0x0008, 0x0005 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082ED5A8:: @ 82ED5A8 + .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000 + + .align 2 +gUnknown_082ED5B4:: @ 82ED5B4 + .2byte 0x0004, 0x000a, 0x0014, 0x000a, 0xfffe, 0x0000 + + .align 2 +gUnknown_082ED5C0:: @ 82ED5C0 + .2byte 0x0018, 0x000a, 0x0004, 0x000a, 0xfffe, 0x0000 + + .align 2 +gUnknown_082ED5CC:: @ 82ED5CC + .4byte gUnknown_082ED578 + .4byte gUnknown_082ED594 + .4byte gUnknown_082ED5A8 + .4byte gUnknown_082ED5B4 + .4byte gUnknown_082ED5C0 + + .align 2 +gUnknown_082ED5E0:: @ 82ED5E0 + obj_tiles gWirelessLinkIconPic, 0x0380, 0xD431 + + .align 2 +gUnknown_082ED5E8:: @ 82ED5E8 + obj_pal gWirelessLinkIconPalette, 0xD432 + + .align 2 +gUnknown_082ED5F0:: @ 82ED5F0 + spr_template 0xD431, 0xD432, gUnknown_082ED570, gUnknown_082ED5CC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082ED608:: @ 82ED608 + .byte 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00 + .byte 0x14, 0x2b, 0x02, 0x02, 0x22, 0x2b, 0x02, 0x02 + .byte 0x01, 0x00, 0x58, 0x02, 0x2c, 0x01, 0x00, 0x00 + + .align 2 +gUnknown_082ED620:: @ 82ED620 + .byte 0x00, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082ED628:: @ 82ED628 + .4byte 0x00000000, 0x00000001, 0x00000003, 0x00000007 + .4byte 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f + .4byte 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff + .4byte 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff + .4byte 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff + .4byte 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff + .4byte 0x00ffffff + +gUnknown_082ED68C:: @ 82ED68C + .byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02 + .byte 0x03 + +gUnknown_082ED695:: @ 82ED695 + .byte 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03 + .byte 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04 + +gUnknown_082ED6A5:: @ 82ED6A5 + .byte 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00 + .byte 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00 + .byte 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082ED6B8:: @ 82ED6B8 + .4byte gUnknown_020228C4 + .4byte 0x000000c8 + .4byte gUnknown_020228C4 + .4byte 0x000000c8 + .4byte gUnknown_020228C4 + .4byte 0x00000064 + .4byte gUnknown_020228C4 + .4byte 0x000000dc + .4byte gUnknown_020228C4 + .4byte 0x00000028 + + .align 2 +gUnknown_082ED6E0:: @ 82ED6E0 + .2byte 0x0002, 0x7f7d, 0x0000, 0xffff + + .ascii "RFU WAIT" + .space 7 + + .ascii "RFU BOOT" + .space 7 + + .ascii "RFU ERROR" + .space 6 + + .ascii "RFU RESET" + .space 6 + + .ascii "RFU CONFIG" + .space 5 + + .ascii "RFU START" + .space 6 + + .ascii "RFU SC POLL" + .space 4 + + .ascii "RFU SP POLL" + .space 4 + + .ascii "RFU START" + .space 6 + + .ascii "RFU SEND ERR" + .space 3 + + .ascii "RFU CP POLL" + .space 4 + + .ascii " " + .space 2 + + .ascii "RECOVER START " + .space 2 + + .ascii "DISSCONECT " + .space 2 + + .ascii "RECOVER SUUSES" + .space 2 + + .ascii "RECOVER FAILED" + .space 2 + + .align 2 +gUnknown_082ED7E0:: @ 82ED7E0 + .4byte sub_801084C + .4byte sub_8010AAC + .4byte sub_8010D0C + + .align 2 +gUnknown_082ED7EC:: @ 82ED7EC + .ascii "PokemonSioInfo" + + .align 2 +gUnknown_082ED7FC:: @ 82ED7FC + .ascii "LINK LOSS DISCONNECT!" + + .align 2 +gUnknown_082ED814:: @ 82ED814 + .ascii "LINK LOSS RECOVERY NOW" diff --git a/data/rom_8011DC0.s b/data/rom_8011DC0.s new file mode 100644 index 000000000..57340cd6a --- /dev/null +++ b/data/rom_8011DC0.s @@ -0,0 +1,4382 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + + .align 2 + +gUnknown_082ED82C:: @ 82ED82C + .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 + +gUnknown_082ED84B:: @ 82ED84B + .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 + +gUnknown_082ED85B:: @ 82ED85B + .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + .byte 0x00, 0x20, 0x00, 0x2a, 0x00 + +gUnknown_082ED868:: @ 82ED868 + .asciz "NOWSLOT" + + .asciz " " + + .asciz "CLOCK DRIFT" + + .asciz "BUSY SEND " + + .asciz "CMD REJECT " + + .asciz "CLOCK SLAVE" + + .ascii "CHILD " + + .align 2 + .ascii "PARENT" + + .align 2 + .ascii "SEARCH" + + .align 2 +gText_EmptyString:: @ 82ED8C4 + .string "$" + + .align 2 +gText_Colon:: @ 82ED8C8 + .string ":$" + + .align 2 +gText_UnkCtrlCodeF907:: @ 82ED8CC + .string "{UNK_CTRL_F907}$" + + .align 2 +gText_PleaseStartOver:: @ 82ED8D0 + .string "Please start over from the beginning.$" + + .align 2 +gText_WirelessSearchCanceled:: @ 82ED8F8 + .string "The WIRELESS COMMUNICATION\nSYSTEM search has been canceled.$" + + .align 2 + .string "Awaiting communication\nfrom another player.$" + + .align 2 +gText_AwaitingCommunication:: @ 82ED960 + .string "{STR_VAR_1}! Awaiting\ncommunication from another player.$" + +gText_AwaitingLink:: @ 82ED990 + .string "{STR_VAR_1}! Awaiting link!\nPress START when everyone’s ready.$" + + .align 2 +gJPText_SingleBattle:: @ 82ED9C8 + .string "シングルバトルを かいさいする$" @ "shingurubatoruwo kaisaisuru" ("hold a single battle" in Japanese) + + .align 2 +gJPText_DoubleBattle:: @ 82ED9D8 + .string "ダブルバトルを かいさいする$" @ "daburubatoruwo kaisaisuru" ("hold a double battle" in Japanese) + + .align 2 +gJPText_MultiBattle:: @ 82ED9E8 + .string "マルチバトルを かいさいする$" @ "maruchibatoruwo kaisaisuru" ("hold a multi battle" in Japanese) + + .align 2 +gJPText_TradePokemon:: @ 82ED9F8 + .string "ポケモンこうかんを かいさいする$" @ "pokemonkoukanwo kaisaisuru" ("trade Pokémon" in Japanese) + + .align 2 +gJPText_Chat:: @ 82EDA0C + .string "チャットを かいさいする$" @ "chattowo kaisaisuru" ("chat" in Japanese) + + .align 2 +gJPText_DistWonderCard:: @ 82EDA1C + .string "ふしぎなカードをくばる$" @ "fushiginakaadowokubaru" ("distribute Wonder Card" in Japanese) + + .align 2 +gJPText_DistWonderNews:: @ 82EDA28 + .string "ふしぎなニュースをくばる$" @ "fushiginanyuusuwokubaru" ("distribute Wonder News" in Japanese) + + .align 2 + .string "ふしぎなできごとを かいさいする$" @ "fushiginadekigotowo kaisaisuru" ("hold a session of Mystery Event" in Japanese) + + .align 2 +gJPText_HoldPokemonJump:: @ 82EDA4C + .string "なわとびを かいさいする$" @ "nawatobiwo kaisaisuru" ("hold a session of Jump" in Japanese) + + .align 2 +gJPText_HoldBerryCrush:: @ 82EDA5C + .string "きのみマッシャーを かいさいする$" @ "kinomimassha-wo kaisaisuru" ("hold a session of Berry Masher" in Japanese) + + .align 2 +gJPText_HoldBerryPicking:: @ 82EDA70 + .string "きのみどりを かいさいする$" @ "kinomidoriwo kaisaisuru" ("hold a session of Berry Picking" in Japanese) + + .align 2 +gJPText_HoldSpinTrade:: @ 82EDA80 + .string "ぐるぐるこうかんを かいさいする$" @ "gurugurukoukanwo kaisaisuru" ("hold a session of Spin Trade" in Japanese) + + .align 2 +gJPText_HoldSpinShop:: @ 82EDA94 + .string "ぐるぐるショップを かいさいする$" @ "gurugurushoppuwo kaisaisuru" ("hold a session of Spin Shop" in Japanese) + + .align 2 + .4byte gJPText_SingleBattle + .4byte gJPText_DoubleBattle + .4byte gJPText_MultiBattle + .4byte gJPText_TradePokemon + .4byte gJPText_Chat + .4byte gJPText_DistWonderCard + .4byte gJPText_DistWonderNews + .4byte gJPText_DistWonderCard + .4byte gJPText_HoldPokemonJump + .4byte gJPText_HoldBerryCrush + .4byte gJPText_HoldBerryPicking + .4byte gJPText_HoldBerryPicking + .4byte gJPText_HoldSpinTrade + .4byte gJPText_HoldSpinShop + +gText_1PlayerNeeded:: @ 82EDAE0 + .string "1 player\nneeded.$" + +gText_2PlayersNeeded:: @ 82EDAF1 + .string "2 players\nneeded.$" + +gText_3PlayersNeeded:: @ 82EDB03 + .string "3 players\nneeded.$" + +gText_4PlayersNeeded:: @ 82EDB15 + .string "4 players\nneeded.$" + +gText_2PlayerMode:: @ 82EDB27 + .string "2-PLAYER\nMODE$" + +gText_3PlayerMode:: @ 82EDB35 + .string "3-PLAYER\nMODE$" + +gText_4PlayerMode:: @ 82EDB43 + .string "4-PLAYER\nMODE$" + +gText_5PlayerMode:: @ 82EDB51 + .string "5-PLAYER\nMODE$" + + .align 2 +gUnknown_082EDB60:: @ 82EDB60 + .4byte gText_1PlayerNeeded + .4byte gText_2PlayerMode + .4byte NULL + .4byte NULL + .4byte NULL + .4byte gText_3PlayersNeeded + .4byte gText_2PlayersNeeded + .4byte gText_1PlayerNeeded + .4byte gText_4PlayerMode + .4byte NULL + .4byte gText_1PlayerNeeded + .4byte gText_2PlayerMode + .4byte gText_3PlayerMode + .4byte gText_4PlayerMode + .4byte gText_5PlayerMode + .4byte gText_2PlayersNeeded + .4byte gText_1PlayerNeeded + .4byte gText_3PlayerMode + .4byte gText_4PlayerMode + .4byte gText_5PlayerMode + .4byte gText_1PlayerNeeded + .4byte gText_2PlayerMode + .4byte gText_3PlayerMode + .4byte gText_4PlayerMode + .4byte NULL + + .align 2 +gUnknown_082EDBC4:: @ 82EDBC4 + .string "{UNK_CTRL_F801}CANCEL$" + + .align 2 + .string "ため\nさんかしゃ ぼしゅうちゅう です!$" @ "tame\nsankasha boshuuchuu desu!" + + .align 2 +gUnknown_082EDBE8:: @ 82EDBE8 + .string "{STR_VAR_2} contacted you for\n{STR_VAR_1}. Accept?$" + + .align 2 +gUnknown_082EDC0C:: @ 82EDC0C + .string "{STR_VAR_2} contacted you.\nWill you share {STR_VAR_1}?$" + + .align 2 +gUnknown_082EDC34:: @ 82EDC34 + .string "{STR_VAR_2} contacted you.\nAdd to the members?$" + + .align 2 +gUnknown_082EDC5C:: @ 82EDC5C + .string "{STR_VAR_1}!\nAre these members OK?$" + + .align 2 +gUnknown_082EDC78:: @ 82EDC78 + .string "Cancel {STR_VAR_1} MODE\nwith these members?$" + + .align 2 +gUnknown_082EDC9C:: @ 82EDC9C + .string "An “OK” was sent\nto {STR_VAR_1}.$" + + .align 2 +gUnknown_082EDCB4:: @ 82EDCB4 + .string "The other TRAINER doesn’t appear\nto be available now…\p$" + + .align 2 +gUnknown_082EDCEC:: @ 82EDCEC + .string "You can’t transmit with a TRAINER\nwho is too far away.\p$" + + .align 2 +gUnknown_082EDD24:: @ 82EDD24 + .string "The other TRAINER(S) is/are not\nready yet.\p$" + + .align 2 +gUnknown_082EDD50:: @ 82EDD50 + .4byte gUnknown_082EDCEC + .4byte gUnknown_082EDD24 + + .align 2 +gUnknown_082EDD58:: @ 82EDD58 + .string "The {STR_VAR_1} MODE with\nthese members will be canceled.{PAUSE 60}$" + + .align 2 +gUnknown_082EDD8C:: @ 82EDD8C + .string "There is a member who can no\nlonger remain available.\p$" + + .align 2 +gUnknown_082EDDC4:: @ 82EDDC4 + .4byte gUnknown_082EDCB4 + .4byte gUnknown_082EDD8C + + .align 2 +gUnknown_082EDDCC:: @ 82EDDCC + .string "The other TRAINER appears\nunavailable…\p$" + + .align 2 +gUnknown_082EDDF4:: @ 82EDDF4 + .string "{STR_VAR_1} sent back an “OK”!$" + + .align 2 +gUnknown_082EDE0C:: @ 82EDE0C + .string "{STR_VAR_1} OK’d your registration as\na member.$" + + .align 2 +gUnknown_082EDE34:: @ 82EDE34 + .string "{STR_VAR_1} replied, “No…”\p$" + + .align 2 +gUnknown_082EDE48:: @ 82EDE48 + .string "{STR_VAR_1}!\nAwaiting other members!$" + + .align 2 +gUnknown_082EDE64:: @ 82EDE64 + .string "Quit being a member?$" + + .align 2 +gUnknown_082EDE7C:: @ 82EDE7C + .string "You stopped being a member.\p$" + + .align 2 +gUnknown_082EDE9C:: @ 82EDE9C + .4byte NULL + .4byte gUnknown_082EDD8C + .4byte gUnknown_082EDDCC + .4byte NULL + .4byte NULL + .4byte NULL + .4byte gUnknown_082EDE34 + .4byte NULL + .4byte NULL + .4byte gUnknown_082EDE7C + + .align 2 +gUnknown_082EDEC4:: @ 82EDEC4 + .string "The WIRELESS COMMUNICATION\nSYSTEM link has been established.$" + + .align 2 +gUnknown_082EDF04:: @ 82EDF04 + .string "The WIRELESS COMMUNICATION\nSYSTEM link has been dropped…$" + + .align 2 +gUnknown_082EDF40:: @ 82EDF40 + .string "The link with your friend has been\ndropped…$" + + .align 2 +gUnknown_082EDF6C:: @ 82EDF6C + .string "{STR_VAR_1} replied, “No…”$" + + .align 2 +gUnknown_082EDF80:: @ 82EDF80 + .4byte NULL + .4byte gUnknown_082EDF40 + .4byte gUnknown_082EDF40 + .4byte NULL + .4byte NULL + .4byte NULL + .4byte gUnknown_082EDF6C + .4byte NULL + .4byte NULL + .4byte NULL + + .align 2 +gUnknown_082EDFA8:: @ 82EDF80 + .string "Do you want the {STR_VAR_2}\nMODE?$" + + .align 2 +gUnknown_082EDFC4:: @ 82EDFC4 + .string "Do you want the {STR_VAR_2}\nMODE?$" + + .align 2 + .4byte gUnknown_082EDFA8 + .4byte gUnknown_082EDFC4 + + .align 2 + .string "Communicating…\nPlease wait.$" + + .align 2 +gUnknown_082EE004:: @ 82EE004 + .string "Awaiting {STR_VAR_1}’s response about\nthe trade…$" + + .align 2 +gUnknown_082EE02C:: @ 82EE02C + .string "Communicating{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" + + .align 2 +gUnknown_082EE098:: @ 82EE098 + .string "Communicating with {STR_VAR_1}{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" + + .align 2 +gUnknown_082EE104:: @ 82EE104 + .string "Please wait a while{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.\n{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.{PAUSE 15}.$" + + .align 2 +gUnknown_082EE17C:: @ 82EE17C + .4byte gUnknown_082EE02C + .4byte gUnknown_082EE098 + .4byte gUnknown_082EE104 + + .align 2 +gUnknown_082EE188:: @ 82EE188 + .string "Hiya! Is there something that you\nwanted to do?$" + + .align 2 +gUnknown_082EE1B8:: @ 82EE1B8 + .string "Hello!\nWould you like to do something?$" + + .align 2 +gUnknown_082EE1E0:: @ 82EE1E0 + .string "{STR_VAR_1}: Hiya, we meet again!\nWhat are you up for this time?$" + + .align 2 +gUnknown_082EE218:: @ 82EE218 + .string "{STR_VAR_1}: Oh! {PLAYER}, hello!\nWould you like to do something?$" + + .align 2 +gUnknown_082EE24C:: @ 82EE24C + .4byte gUnknown_082EE188 + .4byte gUnknown_082EE1B8 + .4byte gUnknown_082EE1E0 + .4byte gUnknown_082EE218 + + .align 2 +gUnknown_082EE25C:: @ 82EE25C + .string "Want to do something?$" + + .align 2 +gUnknown_082EE274:: @ 82EE274 + .string "Would you like to do something?$" + + .align 2 +gUnknown_082EE294:: @ 82EE294 + .string "{STR_VAR_1}: What would you like to\ndo now?$" + + .align 2 + .string "{STR_VAR_1}: Want to do anything else?$" + + .align 2 + .4byte gUnknown_082EE25C + .4byte gUnknown_082EE274 + .4byte gUnknown_082EE294 + .4byte gUnknown_082EE294 + + .align 2 +gUnknown_082EE2E8:: @ 82EE2E8 + .string "Somebody has contacted you.{PAUSE 60}$" + + .align 2 +gUnknown_082EE308:: @ 82EE308 + .string "{STR_VAR_1} has contacted you.{PAUSE 60}$" + + .align 2 +gUnknown_082EE324:: @ 82EE324 + .4byte gUnknown_082EE2E8 + .4byte gUnknown_082EE308 + + .align 2 +gUnknown_082EE32C:: @ 82EE32C + .string "Awaiting a response from\nthe other TRAINER…$" + + .align 2 +gUnknown_082EE358:: @ 82EE358 + .string "Awaiting a response from\n{STR_VAR_1}…$" + + .align 2 +gUnknown_082EE378:: @ 82EE378 + .4byte gUnknown_082EE32C + .4byte gUnknown_082EE358 + + .align 2 +gUnknown_082EE380:: @ 82EE380 + .string "The other TRAINER showed\nyou their TRAINER CARD.\pWould you like to show your\nTRAINER CARD?$" + + .align 2 +gUnknown_082EE3DC:: @ 82EE3DC + .string "The other TRAINER challenges you\nto battle.\pWill you accept the battle\nchallenge?$" + + .align 2 +gUnknown_082EE430:: @ 82EE430 + .string "The other TRAINER invites you\nto chat.\pWill you accept the chat\ninvitation?$" + + .align 2 +gUnknown_082EE47C:: @ 82EE47C + .string "There is an offer to trade your\nregistered Lv. {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}\pin exchange for a\nLv. {SPECIAL_F7 0x02} {SPECIAL_F7 0x03}.\pWill you accept this trade\noffer?$" + + .align 2 +gUnknown_082EE4F0:: @ 82EE4F0 + .string "There is an offer to trade your\nregistered EGG.\lWill you accept this trade offer?$" + + .align 2 +gUnknown_082EE544:: @ 82EE544 + .string "The chat has been dropped.\p$" + + .align 2 +gUnknown_082EE560:: @ 82EE560 + .string "You declined the offer.\p$" + + .align 2 +gUnknown_082EE57C:: @ 82EE57C + .string "You declined the offer.\p$" + + .align 2 +gUnknown_082EE598:: @ 82EE598 + .string "The chat was ended.\p$" + + .align 2 + .4byte gUnknown_082EE380 + .4byte gUnknown_082EE3DC + .4byte gUnknown_082EE430 + .4byte gUnknown_082EE47C + + .align 2 +gUnknown_082EE5C0:: @ 82EE5C0 + .string "Oh, hey! We’re in a chat right now.\nWant to join us?$" + + .align 2 +gUnknown_082EE5F8:: @ 82EE5F8 + .string "{STR_VAR_1}: Hey, {PLAYER}!\nWe’re having a chat right now.\lWant to join us?$" + + .align 2 +gUnknown_082EE638:: @ 82EE638 + .string "Oh, hi! We’re having a chat now.\nWould you like to join us?$" + + .align 2 +gUnknown_082EE674:: @ 82EE674 + .string "{STR_VAR_1}: Oh, hi, {PLAYER}!\nWe’re having a chat now.\lWould you like to join us?$" + + .align 2 +gUnknown_082EE6B8:: @ 82EE6B8 + .4byte gUnknown_082EE5C0 + .4byte gUnknown_082EE638 + .4byte gUnknown_082EE5F8 + .4byte gUnknown_082EE674 + + .align 2 +gUnknown_082EE6C8:: @ 82EE6C8 + .string "……\nThe TRAINER appears to be busy…\p$" + + .align 2 +gUnknown_082EE6EC:: @ 82EE6EC + .string "A battle, huh?\nAll right, just give me some time.$" + + .align 2 +gUnknown_082EE720:: @ 82EE720 + .string "You want to chat, huh?\nSure, just wait a little.$" + + .align 2 +gUnknown_082EE754:: @ 82EE754 + .string "Sure thing! As my “Greetings,”\nhere’s my TRAINER CARD.$" + + .align 2 +gUnknown_082EE78C:: @ 82EE78C + .string "A battle? Of course, but I need\ntime to get ready.$" + + .align 2 +gUnknown_082EE7C0:: @ 82EE7C0 + .string "Did you want to chat?\nOkay, but please wait a moment.$" + + .align 2 +gUnknown_082EE7F8:: @ 82EE7F8 + .string "As my introduction, I’ll show you\nmy TRAINER CARD.$" + + .align 2 +gUnknown_082EE82C:: @ 82EE82C + .4byte gUnknown_082EE6EC + .4byte gUnknown_082EE720 + .4byte NULL + .4byte gUnknown_082EE754 + .4byte gUnknown_082EE78C + .4byte gUnknown_082EE7C0 + .4byte NULL + .4byte gUnknown_082EE7F8 + + .align 2 + .string "You want to chat, huh?\nSure, just wait a little.$" + + .align 2 +gUnknown_082EE880:: @ 82EE880 + .string "Thanks for waiting!\nLet’s get our battle started!{PAUSE 60}$" + + .align 2 +gUnknown_082EE8B8:: @ 82EE880 + .string "All right!\nLet’s chat!{PAUSE 60}$" + + .align 2 +gUnknown_082EE8D4:: @ 82EE8D4 + .string "Sorry I made you wait!\nLet’s get started!{PAUSE 60}$" + + .align 2 +gUnknown_082EE904:: @ 82EE904 + .string "Sorry I made you wait!\nLet’s chat.{PAUSE 60}$" + + .align 2 +gUnknown_082EE92C:: @ 82EE92C + .string "The trade will be started.{PAUSE 60}$" + + .align 2 +gUnknown_082EE94C:: @ 82EE94C + .string "The battle will be started.{PAUSE 60}$" + + .align 2 +gUnknown_082EE96C:: @ 82EE96C + .string "Entering the chat…{PAUSE 60}$" + + .align 2 +gUnknown_082EE984:: @ 82EE984 + .4byte gUnknown_082EE94C + .4byte gUnknown_082EE96C + .4byte gUnknown_082EE92C + .4byte gUnknown_082EE94C + .4byte gUnknown_082EE96C + .4byte gUnknown_082EE92C + .4byte gUnknown_082EE880 + .4byte gUnknown_082EE8B8 + .4byte gUnknown_082EE92C + .4byte gUnknown_082EE8D4 + .4byte gUnknown_082EE904 + .4byte gUnknown_082EE92C + + .align 2 +gUnknown_082EE9B4:: @ 82EE9B4 + .string "Sorry! My POKéMON don’t seem to\nbe feeling too well right now.\lLet me battle you another time.\p$" + + .align 2 +gUnknown_082EEA14:: @ 82EEA14 + .string "I’m terribly sorry, but my POKéMON\naren’t feeling well…\pLet’s battle another time.\p$" + + .align 2 +gUnknown_082EEA68:: @ 82EEA68 + .4byte gUnknown_082EE9B4 + .4byte gUnknown_082EEA14 + + .align 2 +gUnknown_082EEA70:: @ 82EEA70 + .string "Huh? My TRAINER CARD…\nWhere’d it go now?\lSorry! I’ll show you another time!\p$" + + .align 2 +gUnknown_082EEAC0:: @ 82EEAC0 + .string "Oh? Now where did I put my\nTRAINER CARD?…\lSorry! I’ll show you later!\p$" + + .align 2 +gUnknown_082EEB08:: @ 82EEB08 + .4byte gUnknown_082EEA70 + .4byte gUnknown_082EEAC0 + + .align 2 +gUnknown_082EEB10:: @ 82EEB10 + .string "If you want to do something with\nme, just give me a shout!\p$" + + .align 2 +gUnknown_082EEB4C:: @ 82EEB4C + .string "If you want to do something with\nme, don’t be shy.\p$" + + .align 2 +gUnknown_082EEB80:: @ 82EEB80 + .4byte gUnknown_082EEB10 + .4byte gUnknown_082EEB4C + + .align 2 +gUnknown_082EEB88:: @ 82EEB88 + .string "Whoops! Sorry, but I have to do\nsomething else.\lAnother time, okay?\p$" + + .align 2 +gUnknown_082EEBD0:: @ 82EEBD0 + .string "If you want to battle, you need\ntwo POKéMON that are below\lLv. 30.\p$" + + .align 2 +gUnknown_082EEC14:: @ 82EEC14 + .string "For a battle, you need two\nPOKéMON that are below Lv. 30.\p$" + + .align 2 +gUnknown_082EEC50:: @ 82EEC50 + .string "Oh, all right.\nCome see me anytime, okay?\p$" + + .align 2 +gUnknown_082EEC7C:: @ 82EEC7C + .string "Oh…\nPlease come by anytime.\p$" + + .align 2 +gUnknown_082EEC9C:: @ 82EEC9C + .4byte gUnknown_082EEC50 + .4byte gUnknown_082EEC7C + + .align 2 +gUnknown_082EECA4:: @ 82EECA4 + .string "Oh, sorry!\nI just can’t right this instant.\lLet’s chat another time.\p$" + + .align 2 +gUnknown_082EECEC:: @ 82EECEC + .string "Oh, I’m sorry.\nI have too much to do right now.\lLet’s chat some other time.\p$" + + .align 2 +gUnknown_082EED3C:: @ 82EED3C + .4byte gUnknown_082EECA4 + .4byte gUnknown_082EECEC + + .align 2 +gUnknown_082EED44:: @ 82EED3C + .string "Whoa!\nI can tell you’re pretty tough!\p$" + + .align 2 +gUnknown_082EED6C:: @ 82EED6C + .string "You used that move?\nThat’s good strategy!\p$" + + .align 2 +gUnknown_082EED98:: @ 82EED98 + .string "Way to go!\nThat was an eye-opener!\p$" + + .align 2 +gUnknown_082EEDBC:: @ 82EEDBC + .string "Oh! How could you use that\nPOKéMON in that situation?\p$" + + .align 2 +gUnknown_082EEDF4:: @ 82EEDF4 + .string "That POKéMON…\nIt’s been raised really well!\p$" + + .align 2 +gUnknown_082EEE24:: @ 82EEE24 + .string "That’s it!\nThis is the right move now!\p$" + + .align 2 +gUnknown_082EEE4C:: @ 82EEE4C + .string "That’s awesome!\nYou can battle that way?\p$" + + .align 2 +gUnknown_082EEE78:: @ 82EEE78 + .string "You have exquisite timing for\nswitching POKéMON!\p$" + + .align 2 +gUnknown_082EEEAC:: @ 82EEEAC + .4byte gUnknown_082EED44 + .4byte gUnknown_082EED6C + .4byte gUnknown_082EED98 + .4byte gUnknown_082EEDBC + .4byte gUnknown_082EEDF4 + .4byte gUnknown_082EEE24 + .4byte gUnknown_082EEE4C + .4byte gUnknown_082EEE78 + + .align 2 +gUnknown_082EEECC:: @ 82EEECC + .string "Oh, I see!\nThis is educational!\p$" + + .align 2 +gUnknown_082EEEF0:: @ 82EEEF0 + .string "Don’t say anything funny anymore!\nI’m sore from laughing!\p$" + + .align 2 +gUnknown_082EEF2C:: @ 82EEF2C + .string "Oh?\nSomething like that happened.\p$" + + .align 2 +gUnknown_082EEF50:: @ 82EEF50 + .string "Hmhm… What?\nSo is this what you’re saying?\p$" + + .align 2 +gUnknown_082EEF7C:: @ 82EEF7C + .string "Is that right?\nI didn’t know that.\p$" + + .align 2 +gUnknown_082EEFA0:: @ 82EEFA0 + .string "Ahaha!\nWhat is that about?\p$" + + .align 2 +gUnknown_082EEFBC:: @ 82EEFBC + .string "Yes, that’s exactly it!\nThat’s what I meant.\p$" + + .align 2 +gUnknown_082EEFEC:: @ 82EEFEC + .string "In other words…\nYes! That’s right!\p$" + + .align 2 +gUnknown_082EF010:: @ 82EF010 + .4byte gUnknown_082EEECC + .4byte gUnknown_082EEEF0 + .4byte gUnknown_082EEF2C + .4byte gUnknown_082EEF50 + .4byte gUnknown_082EEF7C + .4byte gUnknown_082EEFA0 + .4byte gUnknown_082EEFBC + .4byte gUnknown_082EEFEC + + .align 2 +gUnknown_082EF030:: @ 82EF030 + .string "I’m just showing my TRAINER CARD\nas my way of greeting.\p$" + + .align 2 +gUnknown_082EF06C:: @ 82EF06C + .string "I hope I get to know you better!\p$" + + .align 2 +gUnknown_082EF090:: @ 82EF010 + .string "We’re showing each other our\nTRAINER CARDS to get acquainted.\p$" + + .align 2 +gUnknown_082EF0D0:: @ 82EF0D0 + .string "Glad to meet you.\nPlease don’t be a stranger!\p$" + + .align 2 +gUnknown_082EF100:: @ 82EF100 + .4byte gUnknown_082EF030 + .4byte gUnknown_082EF06C + .4byte gUnknown_082EF090 + .4byte gUnknown_082EF0D0 + + .align 2 +gUnknown_082EF110:: @ 82EF110 + .string "Yeahah!\nI really wanted this POKéMON!\p$" + + .align 2 +gUnknown_082EF138:: @ 82EF138 + .string "Finally, a trade got me that\nPOKéMON I’d wanted a long time.\p$" + + .align 2 +gUnknown_082EF178:: @ 82EF178 + .string "I’m trading POKéMON right now.\p$" + + .align 2 +gUnknown_082EF198:: @ 82EF198 + .string "I finally got that POKéMON I\nwanted in a trade!\p$" + + .align 2 +gUnknown_082EF1CC:: @ 82EF1CC + .4byte gUnknown_082EF110 + .4byte gUnknown_082EF138 + .4byte NULL + .4byte NULL + .4byte gUnknown_082EF178 + .4byte gUnknown_082EF198 + .4byte NULL + .4byte NULL + + .align 2 +gUnknown_082EF1EC:: @ 82EF1EC + .string "{STR_VAR_1} checked the\nTRADING BOARD.\p$" + + .align 2 +gUnknown_082EF20C:: @ 82EF20C + .string "Welcome to the TRADING BOARD.\pYou may register your POKéMON\nand offer it up for a trade.\pWould you like to register one of\nyour POKéMON?$" + + .align 2 +gUnknown_082EF298:: @ 82EF298 + .string "This TRADING BOARD is used for\noffering a POKéMON for a trade.\pAll you need to do is register a\nPOKéMON for a trade.\pAnother TRAINER may offer a party\nPOKéMON in return for the trade.\pWe hope you will register POKéMON\nand trade them with many, many\lother TRAINERS.\pWould you like to register one of\nyour POKéMON?$" + + .align 2 + .string "We have registered your POKéMON for\ntrade on the TRADING BOARD.\pThank you for using this service!\p$" + + .align 2 + .string "Nobody has registered any POKéMON\nfor trade on the TRADING BOARD.\p\n$" + + .align 2 +gUnknown_082EF47C:: @ 82EF47C + .string "Please choose the type of POKéMON\nthat you would like in the trade.\n$" + + .align 2 +gUnknown_082EF4C4:: @ 82EF4C4 + .string "Which of your party POKéMON will\nyou offer in trade?\p$" + + .align 2 +gUnknown_082EF4FC:: @ 82EF4FC + .string "Registration has been canceled.\p$" + + .align 2 +gUnknown_082EF520:: @ 82EF520 + .string "Registration has been completed.\p$" + + .align 2 +gUnknown_082EF544:: @ 82EF544 + .string "The trade has been canceled.\p$" + + .align 2 +gUnknown_082EF564:: @ 82EF564 + .string "Cancel the registration of your\nLv. {STR_VAR_2} {STR_VAR_1}?$" + + .align 2 +gUnknown_082EF590:: @ 82EF590 + .string "Cancel the registration of your\nEGG?$" + + .align 2 +gUnknown_082EF5B8:: @ 82EF5B8 + .string "The registration has been canceled.\p$" + + .align 2 + .string "TRAINERS wishing to make a trade\nwill be listed.$" + + .align 2 + .string "Please choose the TRAINER with whom\nyou would like to trade POKéMON.$" + + .align 2 +gUnknown_082EF65C:: @ 82EF65C + .string "Would you like to ask {STR_VAR_1} to\nmake a trade?$" + + .align 2 + .string "Awaiting a response from\nthe other TRAINER…$" + + .align 2 + .string "You have not registered a POKéMON\nfor trading.\p$" + + .align 2 +gUnknown_082EF6E4:: @ 82EF6E4 + .string "You don’t have a {STR_VAR_2}-type\nPOKéMON that {STR_VAR_1} wants.\p$" + + .align 2 +gUnknown_082EF718:: @ 82EF718 + .string "You don’t have an EGG that\n{STR_VAR_1} wants.\p$" + + .align 2 +gUnknown_082EF740:: @ 82EF740 + .string "{STR_VAR_1} can’t make a trade for\nyour POKéMON right now.\p$" + + .align 2 +gUnknown_082EF774:: @ 82EF774 + .string "You can’t make a trade for\n{STR_VAR_1}’s POKéMON right now.\p$" + + .align 2 + .4byte gUnknown_082EF740 + .4byte gUnknown_082EF774 + + .align 2 +gUnknown_082EF7B0:: @ 82EF7B0 + .string "Your trade offer was rejected.\p$" + + .align 2 +gUnknown_082EF7D0:: @ 82EF7D0 + .string "EGG TRADE$" + + .align 2 +gUnknown_082EF7DC:: @ 82EF7DC + .string "{UNK_CTRL_F80A}CHOOSE {UNK_CTRL_F800}JOIN {UNK_CTRL_F801}CANCEL$" + + .align 2 +gUnknown_082EF7F8:: @ 82EF7F8 + .string "Please choose a TRAINER.$" + + .align 2 +gUnknown_082EF814:: @ 82EF814 + .string "Please choose a TRAINER for\na SINGLE BATTLE.$" + + .align 2 +gUnknown_082EF844:: @ 82EF844 + .string "Please choose a TRAINER for\na DOUBLE BATTLE.$" + + .align 2 +gUnknown_082EF874:: @ 82EF874 + .string "Please choose the LEADER\nfor a MULTI BATTLE.$" + + .align 2 +gUnknown_082EF8A4:: @ 82EF8A4 + .string "Please choose the TRAINER to\ntrade with.$" + + .align 2 +gUnknown_082EF8D0:: @ 82EF8D0 + .string "Please choose the TRAINER who is\nsharing WONDER CARDS.$" + + .align 2 +gUnknown_082EF908:: @ 82EF908 + .string "Please choose the TRAINER who is\nsharing WONDER NEWS.$" + + .align 2 +gUnknown_082EF940:: @ 82EF940 + .string "Jump with mini POKéMON!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EF974:: @ 82EF974 + .string "BERRY CRUSH!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EF99C:: @ 82EF974 + .string "DODRIO BERRY-PICKING!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EF9CC:: @ 82EF9CC + .string "BERRY BLENDER!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EF9F8:: @ 82EF9F8 + .string "RECORD CORNER!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EFA24:: @ 82EFA24 + .string "COOLNESS CONTEST!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EFA50:: @ 82EFA50 + .string "BEAUTY CONTEST!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EFA7C:: @ 82EFA7C + .string "CUTENESS CONTEST!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EFAA8:: @ 82EFAA8 + .string "SMARTNESS CONTEST!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EFAD8:: @ 82EFAD8 + .string "TOUGHNESS CONTEST!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EFB08:: @ 82EFB08 + .string "BATTLE TOWER LEVEL 50!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EFB3C:: @ 82EFB3C + .string "BATTLE TOWER OPEN LEVEL!\nPlease choose the LEADER.$" + + .align 2 +gUnknown_082EFB70:: @ 82EFB70 + .4byte gUnknown_082EF814 + .4byte gUnknown_082EF844 + .4byte gUnknown_082EF874 + .4byte gUnknown_082EF8A4 + .4byte gUnknown_082EF940 + .4byte gUnknown_082EF974 + .4byte gUnknown_082EF99C + .4byte gUnknown_082EF8D0 + .4byte gUnknown_082EF908 + .4byte NULL + .4byte NULL + .4byte NULL + .4byte gUnknown_082EF9F8 + .4byte gUnknown_082EF9CC + .4byte NULL + .4byte gUnknown_082EFA24 + .4byte gUnknown_082EFA50 + .4byte gUnknown_082EFA7C + .4byte gUnknown_082EFAA8 + .4byte gUnknown_082EFAD8 + .4byte gUnknown_082EFB08 + .4byte gUnknown_082EFB3C + + .align 2 +gUnknown_082EFBC8:: @ 82EFBC8 + .string "Searching for a WIRELESS\nCOMMUNICATION SYSTEM. Wait...$" + + .align 2 + .string "For a DOUBLE BATTLE, you must have\nat least two POKéMON.\p$" + + .align 2 +gUnknown_082EFC3C:: @ 82EFC3C + .string "Awaiting {STR_VAR_1}’s response…$" + + .align 2 +gUnknown_082EFC54:: @ 82EFC54 + .string "{STR_VAR_1} has been asked to register\nyou as a member. Please wait.$" + + .align 2 +gUnknown_082EFC90:: @ 82EFC90 + .string "Awaiting a response from the\nWIRELESS COMMUNICATION SYSTEM.$" + + .align 2 + .string "Please wait for other TRAINERS to\ngather and get ready.$" + + .align 2 +gUnknown_082EFD04:: @ 82EFD04 + .string "No CARDS appear to be shared \nright now.$" + + .align 2 +gUnknown_082EFD30:: @ 82EFD30 + .string "No NEWS appears to be shared\nright now.$" + + .align 2 +gUnknown_082EFD58:: @ 82EFD58 + .4byte gUnknown_082EFD04 + .4byte gUnknown_082EFD30 + + .align 2 +gUnknown_082EFD60:: @ 82EFD60 + .string "BATTLE$" + + .align 2 +gUnknown_082EFD68:: @ 82EFD68 + .string "CHAT$" + + .align 2 +gUnknown_082EFD70:: @ 82EFD70 + .string "GREETINGS$" + + .align 2 +gUnknown_082EFD7C:: @ 82EFD7C + .string "EXIT$" + + .align 2 +gUnknown_082EFD84:: @ 82EFD84 + .string "EXIT$" + + .align 2 +gUnknown_082EFD8C:: @ 82EFD8C + .string "INFO$" + + .align 2 +gUnknown_082EFD94:: @ 82EFD94 + .string "NAME{CLEAR_TO 0x3C}WANTED{CLEAR_TO 0x6E}OFFER{CLEAR_TO 0xC6}LV.$" + + .align 2 +gUnknown_082EFDB0:: @ 82EFDB0 + .string "SINGLE BATTLE$" + + .align 2 +gUnknown_082EFDC0:: @ 82EFDC0 + .string "DOUBLE BATTLE$" + + .align 2 +gUnknown_082EFDD0:: @ 82EFDD0 + .string "MULTI BATTLE$" + + .align 2 +gUnknown_082EFDE0:: @ 82EFDE0 + .string "POKéMON TRADES$" + + .align 2 +gUnknown_082EFDF0:: @ 82EFDF0 + .string "CHAT$" + + .align 2 +gUnknown_082EFDF8:: @ 82EFDF8 + .string "CARDS$" + + .align 2 +gUnknown_082EFE00:: @ 82EFE00 + .string "WONDER CARDS$" + + .align 2 +gUnknown_082EFE10:: @ 82EFE10 + .string "WONDER NEWS$" + + .align 2 +gUnknown_082EFE1C:: @ 82EFE1C + .string "POKéMON JUMP$" + + .align 2 +gUnknown_082EFE2C:: @ 82EFE2C + .string "BERRY CRUSH$" + + .align 2 +gUnknown_082EFE38:: @ 82EFE38 + .string "BERRY-PICKING$" + + .align 2 +gUnknown_082EFE48:: @ 82EFE48 + .string "SEARCH$" + + .align 2 +gUnknown_082EFE50:: @ 82EFE50 + .string "BERRY BLENDER$" + + .align 2 +gUnknown_082EFE60:: @ 82EFE60 + .string "RECORD CORNER$" + + .align 2 +gUnknown_082EFE70:: @ 82EFE70 + .string "COOL CONTEST$" + + .align 2 +gUnknown_082EFE80:: @ 82EFE80 + .string "BEAUTY CONTEST$" + + .align 2 +gUnknown_082EFE90:: @ 82EFE90 + .string "CUTE CONTEST$" + + .align 2 +gUnknown_082EFEA0:: @ 82EFEA0 + .string "SMART CONTEST$" + + .align 2 +gUnknown_082EFEB0:: @ 82EFEB0 + .string "TOUGH CONTEST$" + + .align 2 +gUnknown_082EFEC0:: @ 82EFEC0 + .string "BATTLE TOWER LV. 50$" + + .align 2 +gUnknown_082EFED4:: @ 82EFED4 + .string "BATTLE TOWER OPEN LEVEL$" + + .align 2 +gUnknown_082EFEEC:: @ 82EFEEC + .string "It’s a NORMAL CARD.$" + + .align 2 +gUnknown_082EFF00:: @ 82EFF00 + .string "It’s a BRONZE CARD!$" + + .align 2 +gUnknown_082EFF14:: @ 82EFF14 + .string "It’s a COPPER CARD!$" + + .align 2 +gUnknown_082EFF28:: @ 82EFF28 + .string "It’s a SILVER CARD!$" + + .align 2 +gUnknown_082EFF3C:: @ 82EFF3C + .string "It’s a GOLD CARD!$" + + .align 2 +gUnknown_082EFF50:: @ 82EFF50 + .4byte gUnknown_082EFEEC + .4byte gUnknown_082EFF00 + .4byte gUnknown_082EFF14 + .4byte gUnknown_082EFF28 + .4byte gUnknown_082EFF3C + +gUnknown_082EFF64:: @ 82EFF64 + .string "This is {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}’s\nTRAINER CARD…\l{SPECIAL_F7 0x02}\pPOKéDEX: {SPECIAL_F7 0x03}\nTIME: {SPECIAL_F7 0x04}:{SPECIAL_F7 0x05}\p$" + + .align 2 +gUnknown_082EFFA4:: @ 82EFFA4 + .string "BATTLES: WINS: {SPECIAL_F7 0x00} LOSSES: {SPECIAL_F7 0x02}\nTRADES: {SPECIAL_F7 0x03}\p“{SPECIAL_F7 0x04} {SPECIAL_F7 0x05}\n{SPECIAL_F7 0x06} {SPECIAL_F7 0x07}”\p$" + + .align 2 +gUnknown_082EFFDC:: @ 82EFFDC + .string "{SPECIAL_F7 0x01}: Glad to have met you!{PAUSE 60}$" + + .align 2 +gUnknown_082EFFFC:: @ 82EFFFC + .string "{SPECIAL_F7 0x01}: Glad to meet you!{PAUSE 60}$" + + .align 2 +gUnknown_082F0018:: @ 82F0018 + .4byte gUnknown_082EFFDC + .4byte gUnknown_082EFFFC + + .align 2 +gUnknown_082F0020:: @ 82F0020 + .string "Finished checking {SPECIAL_F7 0x01}’s\nTRAINER CARD.{PAUSE 60}$" + + .align 2 +gUnknown_082F0048:: @ 82F0048 + .4byte gText_EmptyString + .4byte gUnknown_082EFDB0 + .4byte gUnknown_082EFDC0 + .4byte gUnknown_082EFDD0 + .4byte gUnknown_082EFDE0 + .4byte gUnknown_082EFDF0 + .4byte gUnknown_082EFE00 + .4byte gUnknown_082EFE10 + .4byte gUnknown_082EFDF8 + .4byte gUnknown_082EFE1C + .4byte gUnknown_082EFE2C + .4byte gUnknown_082EFE38 + .4byte gUnknown_082EFE48 + .4byte gText_EmptyString + .4byte gUnknown_082EFED4 + .4byte gUnknown_082EFE60 + .4byte gUnknown_082EFE50 + .4byte gText_EmptyString + .4byte gText_EmptyString + .4byte gText_EmptyString + .4byte gText_EmptyString + .4byte gUnknown_082EFE00 + .4byte gUnknown_082EFE10 + .4byte gUnknown_082EFE70 + .4byte gUnknown_082EFE80 + .4byte gUnknown_082EFE90 + .4byte gUnknown_082EFEA0 + .4byte gUnknown_082EFEB0 + .4byte gUnknown_082EFEC0 + + .align 2 +gUnknown_082F00BC:: @ 82F00BC + window_template 0x00, 0x00, 0x00, 0x1E, 0x02, 0x0F, 0x0008 + + .align 2 +gUnknown_082F00C4:: @ 82F00C4 + .byte 0x01, 0x02, 0x00, 0x00 + .byte 0x02, 0x02, 0x00, 0x00 + .byte 0x03, 0x04, 0x00, 0x00 + .byte 0x04, 0x02, 0x00, 0x00 + .byte 0x09, 0x25, 0x00, 0x00 + .byte 0x0a, 0x25, 0x00, 0x00 + .byte 0x0b, 0x35, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x0f, 0x24, 0x00, 0x00 + .byte 0x10, 0x24, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x17, 0x24, 0x00, 0x00 + .byte 0x18, 0x24, 0x00, 0x00 + .byte 0x19, 0x24, 0x00, 0x00 + .byte 0x1a, 0x24, 0x00, 0x00 + .byte 0x1b, 0x24, 0x00, 0x00 + .byte 0x1c, 0x02, 0x00, 0x00 + .byte 0x0e, 0x02, 0x00, 0x00 + + .align 2 +gUnknown_082F011C:: @ 82F011C + window_template 0x00, 0x01, 0x03, 0x0d, 0x08, 0x0f, 0x0044 + + .align 2 +gUnknown_082F0124:: @ 82F0124 + window_template 0x00, 0x01, 0x03, 0x0d, 0x0a, 0x0f, 0x0044 + + .align 2 +gUnknown_082F012C:: @ 82F012C + window_template 0x00, 0x10, 0x03, 0x07, 0x04, 0x0f, 0x00c6 + + .align 2 +gUnknown_082F0134:: @ 82F0134 + .4byte gText_EmptyString + .4byte 0x00000000 + .4byte gText_EmptyString + .4byte 0x00000001 + .4byte gText_EmptyString + .4byte 0x00000002 + .4byte gText_EmptyString + .4byte 0x00000003 + .4byte gText_EmptyString + .4byte 0x00000004 + + .align 2 +gUnknown_082F015C:: @ 82F015C struct ListMenuTemplate + .4byte gUnknown_082F0134 + .4byte NULL + .4byte sub_8013278 + .byte 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x21, 0x31, 0x00, 0x41 + + .align 2 +gUnknown_082F0174:: @ 82F0174 + window_template 0x00, 0x01, 0x03, 0x11, 0x0a, 0x0f, 0x0044 + + .align 2 +gUnknown_082F017C:: @ 82F017C + window_template 0x00, 0x14, 0x03, 0x07, 0x04, 0x0f, 0x00ee + + .align 2 +gUnknown_082F0184:: @ 82F0184 + .4byte gText_EmptyString, 0x00000000 + .4byte gText_EmptyString, 0x00000001 + .4byte gText_EmptyString, 0x00000002 + .4byte gText_EmptyString, 0x00000003 + .4byte gText_EmptyString, 0x00000004 + .4byte gText_EmptyString, 0x00000005 + .4byte gText_EmptyString, 0x00000006 + .4byte gText_EmptyString, 0x00000007 + .4byte gText_EmptyString, 0x00000008 + .4byte gText_EmptyString, 0x00000009 + .4byte gText_EmptyString, 0x0000000a + .4byte gText_EmptyString, 0x0000000b + .4byte gText_EmptyString, 0x0000000c + .4byte gText_EmptyString, 0x0000000d + .4byte gText_EmptyString, 0x0000000e + .4byte gText_EmptyString, 0x0000000f + + .align 2 +gUnknown_082F0204:: @ 82F0204 struct ListMenuTemplate + .4byte gUnknown_082F0184 + .4byte sub_81AF078 + .4byte sub_8013DF4 + .byte 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x40, 0x01 + + .align 2 +gUnknown_082F021C:: @ 82F021C + window_template 0x00, 0x14, 0x05, 0x10, 0x08, 0x0f, 0x0001 + + .align 2 +gUnknown_082F0224:: @ 82F0224 + .4byte gUnknown_082EFD70, 0x00000208 + .4byte gUnknown_082EFD60, 0x00000241 + .4byte gUnknown_082EFD68, 0x00000245 + .4byte gUnknown_082EFD7C, 0x00000040 + + .align 2 +gUnknown_082F0244:: @ 82F0244 struct ListMenuTemplate + .4byte gUnknown_082F0224 + .byte 0x79, 0xf0, 0x1a, 0x08 + .4byte NULL + .byte 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x00, 0x01 + + .align 2 +gUnknown_082F025C:: @ 82F025C + window_template 0x00, 0x12, 0x07, 0x10, 0x06, 0x0f, 0x0001 + +gUnknown_082F0264:: @ 82F0264 + .4byte gText_Register, 0x00000001 + .4byte gUnknown_082EFD8C, 0x00000002 + .4byte gUnknown_082EFD7C, 0x00000003 + + .align 2 +gUnknown_082F027C:: @ 82F027C + .4byte gUnknown_082F0264 + .4byte sub_81AF078 + .4byte NULL + .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x00, 0x01 + + .align 2 +gUnknown_082F0294:: @ 82F0294 + window_template 0x00, 0x14, 0x01, 0x10, 0x0c, 0x0f, 0x0001 + + .align 2 +gUnknown_082F029C:: @ 82F029C + .4byte gTypeNames, 0x00000000 @ NORMAL + .4byte gTypeNames+0x46, 0x0000000a @ FIRE + .4byte gTypeNames+0x4D, 0x0000000b @ WATER + .4byte gTypeNames+0x5B, 0x0000000d @ ELECTR + .4byte gTypeNames+0x54, 0x0000000c @ GRASS + .4byte gTypeNames+0x69, 0x0000000f @ ICE + .4byte gTypeNames+0x1C, 0x00000004 @ GROUND + .4byte gTypeNames+0x23, 0x00000005 @ ROCK + .4byte gTypeNames+0x0E, 0x00000002 @ FLYING + .4byte gTypeNames+0x62, 0x0000000e @ PSYCHC + .4byte gTypeNames+0x07, 0x00000001 @ FIGHT + .4byte gTypeNames+0x15, 0x00000003 @ POISON + .4byte gTypeNames+0x2A, 0x00000006 @ BUG + .4byte gTypeNames+0x31, 0x00000007 @ GHOST + .4byte gTypeNames+0x70, 0x00000010 @ DRAGON + .4byte gTypeNames+0x38, 0x00000008 @ STEEL + .4byte gTypeNames+0x77, 0x00000011 @ DARK + .4byte gUnknown_082EFD7C, 0x00000012 @ EXIT + + .align 2 +gUnknown_082F032C:: @ 82F032C + .4byte gUnknown_082F029C + .4byte sub_81AF078 + .4byte NULL + .byte 0x12, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x00, 0x01 + + .align 2 +gUnknown_082F0344:: @ 82F0344 + window_template 0x00, 0x01, 0x01, 0x1c, 0x02, 0x0d, 0x0001 + + .align 2 +gUnknown_082F034C:: @ 82F034C + window_template 0x00, 0x01, 0x05, 0x1c, 0x0c, 0x0d, 0x0039 + + .align 2 +gUnknown_082F0354:: @ 82F0354 + .4byte gText_EmptyString, 0xfffffffd + .4byte gText_EmptyString, 0x00000000 + .4byte gText_EmptyString, 0x00000001 + .4byte gText_EmptyString, 0x00000002 + .4byte gText_EmptyString, 0x00000003 + .4byte gText_EmptyString, 0x00000004 + .4byte gText_EmptyString, 0x00000005 + .4byte gText_EmptyString, 0x00000006 + .4byte gText_EmptyString, 0x00000007 + .4byte gUnknown_082EFD84, 0x00000008 + + .align 2 +gUnknown_082F03A4:: @ 82F03A4 + .4byte gUnknown_082F0354 + .4byte sub_81AF078 + .4byte sub_8017BE8 + .byte 0x0a, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0xe1, 0xdf, 0x00, 0x01 + + .align 2 + window_template 0x00, 0x01, 0x05, 0x1c, 0x0c, 0x0d, 0x0039 + + .align 2 +gUnknown_082F03C4:: @ 82F03C4 + .4byte gText_EmptyString, 0x00000000 + .4byte gText_EmptyString, 0x00000001 + .4byte gText_EmptyString, 0x00000002 + .4byte gText_EmptyString, 0x00000003 + .4byte gText_EmptyString, 0x00000004 + .4byte gText_EmptyString, 0x00000005 + .4byte gText_EmptyString, 0x00000006 + .4byte gText_EmptyString, 0x00000007 + .4byte gText_EmptyString, 0x00000008 + .4byte gText_EmptyString, 0x00000009 + .4byte gText_EmptyString, 0x0000000a + .4byte gText_EmptyString, 0x0000000b + .4byte gText_EmptyString, 0x0000000c + .4byte gText_EmptyString, 0x0000000d + .4byte gText_EmptyString, 0x0000000e + .4byte gText_EmptyString, 0x0000000f + + .align 2 + .4byte gUnknown_082F03C4 + .4byte sub_81AF078 + .4byte nullsub_14 + .byte 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x40, 0x01 + + .align 2 +gUnknown_082F045C:: @ 82F045C + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F0474:: @ 82F0474 + .byte 0x01, 0xff + + .align 2 +gUnknown_082F0478:: @ 82F0478 + .byte 0x02, 0xff + + .align 2 +gUnknown_082F047C:: @ 82F047C + .byte 0x03, 0xff + + .align 2 +gUnknown_082F0480:: @ 82F0480 + .byte 0x04, 0xff + + .align 2 +gUnknown_082F0484:: @ 82F0484 + .byte 0x09, 0xff + + .align 2 +gUnknown_082F0488:: @ 82F0488 + .byte 0x0a, 0xff + + .align 2 +gUnknown_082F048C:: @ 82F048C + .byte 0x0b, 0xff + + .align 2 +gUnknown_082F0490:: @ 82F0490 + .byte 0x15, 0xff + + .align 2 +gUnknown_082F0494:: @ 82F0494 + .byte 0x16, 0xff + + .align 2 +gUnknown_082F0498:: @ 82F0498 + .byte 0x40, 0x41, 0x44, 0x45, 0x48, 0x51, 0x52, 0x53, 0x54, 0xff + + .align 2 +gUnknown_082F04A4:: @ 82F04A4 + .byte 0x0c, 0xff + + .align 2 +gUnknown_082F04A8:: @ 82F04A8 + .byte 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15, 0x16, 0x0d, 0xff + + .align 2 +gUnknown_082F04B4:: @ 82F04B4 + .byte 0x0f, 0xff + + .align 2 +gUnknown_082F04B8:: @ 82F04B8 + .byte 0x10, 0xff + + .align 2 +gUnknown_082F04BC:: @ 82F04BC + .byte 0x17, 0xff + + .align 2 +gUnknown_082F04C0:: @ 82F04C0 + .byte 0x18, 0xff + + .align 2 +gUnknown_082F04C4:: @ 82F04C4 + .byte 0x19, 0xff + + .align 2 +gUnknown_082F04C8:: @ 82F04C8 + .byte 0x1a, 0xff + + .align 2 +gUnknown_082F04CC:: @ 82F04CC + .byte 0x1b, 0xff + + .align 2 +gUnknown_082F04D0:: @ 82F04D0 + .byte 0x1c, 0xff + + .align 2 +gUnknown_082F04D4:: @ 82F04D4 + .byte 0x0e, 0xff + + .align 2 +gUnknown_082F04D8:: @ 82F04D8 + .4byte gUnknown_082F0474 + .4byte gUnknown_082F0478 + .4byte gUnknown_082F047C + .4byte gUnknown_082F0480 + .4byte gUnknown_082F0484 + .4byte gUnknown_082F0488 + .4byte gUnknown_082F048C + .4byte gUnknown_082F0490 + .4byte gUnknown_082F0494 + .4byte gUnknown_082F0498 + .4byte gUnknown_082F04A4 + .4byte gUnknown_082F04A8 + .4byte gUnknown_082F04B4 + .4byte gUnknown_082F04B8 + .4byte NULL + .4byte gUnknown_082F04BC + .4byte gUnknown_082F04C0 + .4byte gUnknown_082F04C4 + .4byte gUnknown_082F04C8 + .4byte gUnknown_082F04CC + .4byte gUnknown_082F04D0 + .4byte gUnknown_082F04D4 + + .align 2 +gUnknown_082F0530:: @ 82F0530 + .byte 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15 + .byte 0x16, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x00, 0x17 + .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x0e, 0x00, 0x00 + + .align 2 +gUnkTextboxBorderPal:: @ 82F0548 + .incbin "graphics/interface/unk_textbox_border.gbapal" + + .align 2 +gUnkTextboxBorderGfx:: @ 82F0568 + .incbin "graphics/interface/unk_textbox_border.4bpp.lz" + + .align 2 +gUnknown_082F0598:: @ 82F0598 struct BgTemplate + .4byte 0x000000f8 + .4byte 0x000010e1 + .4byte 0x000020d2 + .4byte 0x000030c3 + + .align 2 +gUnknown_082F05A8:: @ 82F05A8 + window_template 0x00, 0x00, 0x00, 0x1e, 0x02, 0x0c, 0x0013 + window_template 0x00, 0x01, 0x0f, 0x1c, 0x04, 0x0c, 0x004f + window_template 0x00, 0x00, 0x0f, 0x1e, 0x05, 0x0d, 0x004f + window_template_terminator + + .align 2 +gUnknown_082F05C8:: @ 82F05C8 + window_template 0x00, 0x01, 0x0f, 0x1c, 0x04, 0x0c, 0x00e5 + + .align 2 +gUnknown_082F05D0:: @ 82F05D0 + window_template 0x00, 0x01, 0x0f, 0x14, 0x04, 0x0c, 0x00e5 + + .align 2 +gUnknown_082F05D8:: @ 82F05D8 + window_template 0x00, 0x01, 0x0f, 0x13, 0x04, 0x0c, 0x00e5 + + .align 2 +gUnknown_082F05E0:: @ 82F05E0 + window_template 0x00, 0x08, 0x06, 0x0e, 0x06, 0x0c, 0x0155 + + .align 2 +gUnknown_082F05E8:: @ 82F05E8 + window_template 0x00, 0x17, 0x0f, 0x06, 0x04, 0x0c, 0x0155 + + .align 2 +gUnknown_082F05F0:: @ 82F05F0 + window_template 0x00, 0x16, 0x0b, 0x07, 0x08, 0x0c, 0x0155 + + .align 2 +gUnknown_082F05F8:: @ 82F05F8 + window_template 0x00, 0x16, 0x0d, 0x07, 0x06, 0x0c, 0x0155 + + .align 2 +gUnknown_082F0600:: @ 82F0600 + window_template 0x00, 0x16, 0x0f, 0x07, 0x04, 0x0c, 0x0155 + + .align 2 +gUnknown_082F0608:: @ 82F0608 + .4byte gText_WonderCards, 0x00000000 + .4byte gText_WonderNews, 0x00000001 + .4byte gText_Exit3, 0xfffffffe + + .align 2 +gUnknown_082F0620:: @ 82F0620 + .4byte gText_WirelessCommunication, 0x00000000 + .4byte gText_Friend2, 0x00000001 + .4byte gText_Cancel2, 0xfffffffe + + .align 2 +gUnknown_082F0638:: @ 82F0638 struct ListMenuTemplate + .4byte NULL + .4byte sub_81AF078 + .4byte NULL + .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x00, 0x01 + + .align 2 +gUnknown_082F0650:: @ 82F0650 + .4byte gText_Receive, 0x00000000 + .4byte gText_Send, 0x00000001 + .4byte gText_Toss, 0x00000002 + .4byte gText_Cancel2, 0xfffffffe + + .align 2 +gUnknown_082F0670:: @ 82F0670 + .4byte gText_Receive, 0x00000000 + .4byte gText_Toss, 0x00000002 + .4byte gText_Cancel2, 0xfffffffe + + .align 2 +gUnknown_082F0688:: @ 82F0688 + .4byte gText_Receive, 0x00000000 + .4byte gText_Send, 0x00000001 + .4byte gText_Cancel2, 0xfffffffe + + .align 2 +gUnknown_082F06A0:: @ 82F06A0 + .4byte gText_Receive, 0x00000000 + .4byte gText_Cancel2, 0xfffffffe + + .align 2 +gUnknown_082F06B0:: @ 82F06B0 struct ListMenuTemplate + .4byte gUnknown_082F0650 + .4byte sub_81AF078 + .4byte NULL + .byte 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x00, 0x01 + + .align 2 +gUnknown_082F06C8:: @ 82F06C8 + .4byte gUnknown_082F0670 + .4byte sub_81AF078 + .4byte NULL + .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x00, 0x01 + + .align 2 +gUnknown_082F06E0:: @ 82F06E0 + .4byte gUnknown_082F0688 + .4byte sub_81AF078 + .4byte NULL + .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x00, 0x01 + + .align 2 +gUnknown_082F06F8:: @ 82F06F8 + .4byte gUnknown_082F06A0 + .4byte sub_81AF078 + .4byte NULL + .byte 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00 + .byte 0x21, 0x31, 0x00, 0x01 + + .align 2 + .4byte gText_VarietyOfEventsImportedWireless + .4byte gText_WonderCardsInPossession + .4byte gText_ReadNewsThatArrived + .4byte gText_ReturnToTitle + + .align 2 +gUnknown_082F0720:: @ 82F0720 struct TextColor + .byte 0x00, 0x01, 0x02 + + .align 2 + .byte 0x00, 0x01, 0x02 + + .align 2 +gUnknown_082F0728:: @ 82F0728 struct TextColor + .byte 0x01, 0x02, 0x03 + + .align 2 +gUnknown_082F072C:: @ 82F072C + .byte 0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42 + .byte 0x00, 0x00, 0x22, 0x28, 0x20, 0x2f, 0x2f, 0x0e + .byte 0x14, 0x2d, 0x00, 0x00 + + .align 2 +gUnknown_082F0740:: @ 82F0740 + .2byte 0x0004, 0x0006, 0x000d, 0x0008 + .2byte 0x000a, 0x0006, 0x0001, 0x0008 + .2byte 0x000d, 0x0004, 0x0007, 0x0004 + .2byte 0x0001, 0x0004, 0x0007, 0x0008 + + .align 2 +gUnknown_082F0760:: @ 82F0760 + .byte 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00 + .byte 0x00, 0x01 + +gUnknown_082F076A:: @ 82F076A + .byte 0x00, 0x02, 0x01, 0x04, 0x03 + +gUnknown_082F076F:: @ 82F076F + .byte 0x01, 0x03, 0x01, 0x04, 0x02 + +gUnknown_082F0774:: @ 82F0774 + .byte 0x09, 0x08, 0x07, 0x02, 0x06, 0x05, 0x04, 0x03 + .byte 0xbf, 0x02, 0xc0, 0x02, 0xc1, 0x02, 0xc2, 0x02 + .byte 0xc3, 0x02, 0xc4, 0x02, 0xc5, 0x02, 0xc6, 0x02 + +gUnknown_082F078C:: @ 82F078C + .byte 0x9c, 0xfe + +gUnknown_082F078E:: @ 82F078E + .byte 0x9d, 0xfe + + .align 2 +gWirelessInfoScreenPal:: @ 82F0790 + .incbin "graphics/interface/wireless_info_screen.gbapal" + + .align 2 +gWirelessInfoScreenGfx:: @ 82F0990 + .incbin "graphics/interface/wireless_info_screen.4bpp.lz" + + .align 2 +gWirelessInfoScreenTilemap:: @ 82F0BA0 + .incbin "graphics/interface/wireless_info_screen.bin.lz" + + .align 2 +gUnknown_082F0D34:: @ 82F0D34 + .4byte 0x000001f8 + .4byte 0x00001081 + + .align 2 +gUnknown_082F0D3C:: @ 82F0D3C + window_template 0x00, 0x03, 0x00, 0x18, 0x03, 0x0f, 0x0001 + window_template 0x00, 0x03, 0x04, 0x15, 0x0f, 0x0f, 0x0049 + window_template 0x00, 0x18, 0x04, 0x03, 0x0f, 0x0f, 0x0184 + window_template_terminator + + .align 2 +gUnknown_082F0D5C:: @ 82F0D5C + .4byte gText_WirelessCommStatus + .4byte gText_PeopleTrading + .4byte gText_PeopleBattling + .4byte gText_PeopleInUnionRoom + .4byte gText_PeopleCommunicating + + .align 2 +gUnknown_082F0D70:: @ 82F0D70 + .byte 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x03, 0x01 + .byte 0x04, 0x04, 0x00, 0x02, 0x06, 0x03, 0x02, 0x07 + .byte 0x03, 0x02, 0x09, 0x03, 0x00, 0x0a, 0x03, 0x00 + .byte 0x0b, 0x03, 0x00, 0x0c, 0xff, 0x00, 0x0d, 0x00 + .byte 0x00, 0x10, 0x03, 0x00, 0x0f, 0x03, 0x00, 0x40 + .byte 0x02, 0x01, 0x41, 0x02, 0x02, 0x44, 0x02, 0x02 + .byte 0x45, 0x02, 0x00, 0x48, 0x02, 0x02, 0x54, 0x02 + .byte 0x01, 0x53, 0x02, 0x02, 0x51, 0x02, 0x01, 0x52 + .byte 0x02, 0x01, 0x15, 0x03, 0x02, 0x16, 0x03, 0x02 + .byte 0x17, 0x03, 0x00, 0x18, 0x03, 0x00, 0x19, 0x03 + .byte 0x00, 0x1a, 0x03, 0x00, 0x1b, 0x03, 0x00, 0x1c + .byte 0x01, 0x02, 0x0e, 0x01, 0x02, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F0DD0:: @ 82F0DD0 + .4byte 0x000001FC + + .align 2 +gUnknown_082F0DD4:: @ 82F0DD4 + window_template 0x00, 0x03, 0x0f, 0x18, 0x04, 0x0e, 0x0014 + window_template_terminator + + .align 2 +gUnknown_082F0DE4:: @ 82F0DE4 + .byte 0x01, 0x02, 0x03 + + .align 2 +gUnknown_082F0DE8:: @ 82F0DE8 + .2byte 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, 0x013f, 0x0140, 0x0141 + .2byte 0x0142, 0x0143, 0x0144, 0x0145, 0x0146, 0x0147, 0x0148, 0x0149 + .2byte 0x014a, 0x014b, 0x014c, 0x014d + + .align 2 +gUnknown_082F0E10:: @ 82F0E10 + .byte 0x00, 0x02, 0x03 + .byte 0x00, 0x01, 0x02 + + .align 2 +gUnknown_082F0E18:: @ 82F0E18 + .byte 0x07, 0x04, 0x07, 0x00 + + .align 2 +gUnknown_082F0E1C:: @ 82F0E1C + window_template 0x01, 0x01, 0x01, 0x19, 0x04, 0x02, 0x029C + window_template 0x01, 0x01, 0x06, 0x1C, 0x08, 0x02, 0x01BC + window_template 0x01, 0x01, 0x0E, 0x1C, 0x05, 0x02, 0x0130 + + .align 2 +gWonderCardBgPal1:: @ 82F0E34 + .incbin "graphics/interface/wonder_card_1.gbapal" + + .align 2 +gWonderCardBgPal2:: @ 82F0E54 + .incbin "graphics/interface/wonder_card_2.gbapal" + + .align 2 +gWonderCardBgPal3:: @ 82F0E74 + .incbin "graphics/interface/wonder_card_3.gbapal" + + .align 2 +gWonderCardBgPal4:: @ 82F0E94 + .incbin "graphics/interface/wonder_card_4.gbapal" + + .align 2 +gWonderCardBgPal5:: @ 82F0EB4 + .incbin "graphics/interface/wonder_card_5.gbapal" + + .align 2 +gWonderCardBgPal6:: @ 82F0ED4 + .incbin "graphics/interface/wonder_card_6.gbapal" + + .align 2 +gWonderCardBgPal7:: @ 82F0EF4 + .incbin "graphics/interface/wonder_card_7.gbapal" + + .align 2 +gWonderCardBgPal8:: @ 82F0F14 + .incbin "graphics/interface/wonder_card_8.gbapal" + + .align 2 +gWonderCardBgGfx1:: @ 82F0F34 + .incbin "graphics/interface/wonder_card_1.4bpp.lz" + + .align 2 +gWonderCardBgTilemap1:: @ 82F1030 + .incbin "graphics/interface/wonder_card_1.bin.lz" + + .align 2 +gWonderCardBgGfx2:: @ 82F1124 + .incbin "graphics/interface/wonder_card_2.4bpp.lz" + + .align 2 +gWonderCardBgTilemap2:: @ 82F1218 + .incbin "graphics/interface/wonder_card_2.bin.lz" + + .align 2 +gWonderCardBgGfx3:: @ 82F1300 + .incbin "graphics/interface/wonder_card_3.4bpp.lz" + + .align 2 +gWonderCardBgTilemap3:: @ 82F13D4 + .incbin "graphics/interface/wonder_card_3.bin.lz" + + .align 2 +gWonderCardBgGfx7:: @ 82F14A8 + .incbin "graphics/interface/wonder_card_7.4bpp.lz" + + .align 2 +gWonderCardBgTilemap7:: @ 82F16DC + .incbin "graphics/interface/wonder_card_7.bin.lz" + + .align 2 +gWonderCardBgGfx8:: @ 82F1824 + .incbin "graphics/interface/wonder_card_8.4bpp.lz" + + .align 2 +gWonderCardBgTilemap8:: @ 82F1A54 + .incbin "graphics/interface/wonder_card_8.bin.lz" + + .align 2 +gWonderCardShadowPal1:: @ 82F1B9C + .incbin "graphics/interface/wonder_card_shadow_1.gbapal" + + .align 2 +gWonderCardShadowPal2:: @ 82F1BBC + .incbin "graphics/interface/wonder_card_shadow_2.gbapal" + + .align 2 +gWonderCardShadowPal3:: @ 82F1BDC + .incbin "graphics/interface/wonder_card_shadow_3.gbapal" + + .align 2 +gWonderCardShadowPal4:: @ 82F1BFC + .incbin "graphics/interface/wonder_card_shadow_4.gbapal" + + .align 2 +gWonderCardShadowPal5:: @ 82F1C1C + .incbin "graphics/interface/wonder_card_shadow_5.gbapal" + + .align 2 +gWonderCardShadowPal6:: @ 82F1C3C + .incbin "graphics/interface/wonder_card_shadow_6.gbapal" + + .align 2 +gWonderCardShadowPal7:: @ 82F1C5C + .incbin "graphics/interface/wonder_card_shadow_7.gbapal" + + .align 2 +gWonderCardShadowPal8:: @ 82F1C7C + .incbin "graphics/interface/wonder_card_shadow_8.gbapal" + + .align 2 +gWonderCardShadowGfx:: @ 82F1C9C + .incbin "graphics/interface/wonder_card_shadow.4bpp.lz" + + .align 2 +gUnknown_082F1D00:: @ 82F1D00 struct CompressedSpriteSheet + .4byte gWonderCardShadowGfx + .2byte 0x0100 + .2byte 0x8000 + + .align 2 +gUnknown_082F1D08:: @ 82F1D08 struct SpritePalette + .4byte gWonderCardShadowPal1 + .2byte 0x8000 + + .align 2 + .4byte gWonderCardShadowPal2 + .2byte 0x8000 + + .align 2 + .4byte gWonderCardShadowPal3 + .2byte 0x8000 + + .align 2 + .4byte gWonderCardShadowPal4 + .2byte 0x8000 + + .align 2 + .4byte gWonderCardShadowPal5 + .2byte 0x8000 + + .align 2 + .4byte gWonderCardShadowPal6 + .2byte 0x8000 + + .align 2 + .4byte gWonderCardShadowPal7 + .2byte 0x8000 + + .align 2 + .4byte gWonderCardShadowPal8 + .2byte 0x8000 + + .align 2 +gUnknown_082F1D48:: @ 82F1D48 + spr_template 0x8000, 0x8000, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082F1D60:: @ 82F1D60 + .4byte 0x00000001, gWonderCardBgGfx1, gWonderCardBgTilemap1, gWonderCardBgPal1 + .4byte 0x00001001, gWonderCardBgGfx2, gWonderCardBgTilemap2, gWonderCardBgPal2 + .4byte 0x00002001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal3 + .4byte 0x00003001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal4 + .4byte 0x00004001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal5 + .4byte 0x00005001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal6 + .4byte 0x00006001, gWonderCardBgGfx7, gWonderCardBgTilemap7, gWonderCardBgPal7 + .4byte 0x00007001, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8 + +gUnknown_082F1DE0:: @ 82F1DE0 + .byte 0x00, 0x02, 0x03, 0x00, 0x01, 0x02, 0x00, 0x00 + +gUnknown_082F1DE8:: @ 82F1DE8 + window_template 0x00, 0x01, 0x00, 0x1C, 0x03, 0x02, 0x02AC + window_template 0x02, 0x01, 0x03, 0x1C, 0x14, 0x02, 0x007C + +gUnknown_082F1DF8:: @ 82F1DF8 + .4byte 0x0318e802, 0x000098e8, 0x10000002, 0x00001000 + + .align 2 +gWonderNewsPal1:: @ 82F1E08 + .incbin "graphics/interface/wonder_news_1.gbapal" + + .align 2 +gWonderNewsPal7:: @ 82F1E28 + .incbin "graphics/interface/wonder_news_7.gbapal" + + .align 2 +gWonderNewsPal8:: @ 82F1E48 + .incbin "graphics/interface/wonder_news_8.gbapal" + + .align 2 +gWonderNewsGfx1:: @ 82F1E68 + .incbin "graphics/interface/wonder_news_1.4bpp.lz" + + .align 2 +gWonderNewsTilemap1:: @ 82F1EE8 + .incbin "graphics/interface/wonder_news_1.bin.lz" + + .align 2 +gWonderNewsGfx2:: @ 82F1FC4 + .incbin "graphics/interface/wonder_news_2.4bpp.lz" + + .align 2 +gWonderNewsTilemap2:: @ 82F1FF4 + .incbin "graphics/interface/wonder_news_2.bin.lz" + + .align 2 +gWonderNewsGfx3:: @ 82F20B4 + .incbin "graphics/interface/wonder_news_3.4bpp.lz" + + .align 2 +gWonderNewsTilemap3:: @ 82F2124 + .incbin "graphics/interface/wonder_news_3.bin.lz" + + .align 2 +gWonderNewsGfx7:: @ 82F21F0 + .incbin "graphics/interface/wonder_news_7.4bpp.lz" + + .align 2 +gWonderNewsTilemap7:: @ 82F2280 + .incbin "graphics/interface/wonder_news_7.bin.lz" + + .align 2 +gWonderNewsGfx8:: @ 82F235C + .incbin "graphics/interface/wonder_news_8.4bpp.lz" + + .align 2 +gWonderNewsTilemap8:: @ 82F23EC + .incbin "graphics/interface/wonder_news_8.bin.lz" + + .align 2 +gUnknown_082F24C8:: @ 82F24C8 + .4byte 0x00000001, gWonderNewsGfx1, gWonderNewsTilemap1, gWonderNewsPal1 + .4byte 0x00000001, gWonderNewsGfx2, gWonderNewsTilemap2, gWonderCardBgPal2 + .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal3 + .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal4 + .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal5 + .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal6 + .4byte 0x00000001, gWonderNewsGfx7, gWonderNewsTilemap7, gWonderNewsPal7 + .4byte 0x00000001, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8 + + .align 2 +gUnknown_082F2548:: @ 82F2548 + .4byte sub_801D1AC + .4byte sub_801D1B4 + .4byte sub_801D1B8 + .4byte sub_801D1D4 + .4byte sub_801D1F0 + + .align 2 +gUnknown_082F255C:: @ 82F255C + .4byte sub_801D5D0 + .4byte sub_801D5F8 + .4byte sub_801D5FC + .4byte sub_801D61C + .4byte sub_801D63C + .4byte sub_801D810 + .4byte sub_801D828 + .4byte sub_801D860 + + .align 2 +gText_CanceledReadingCard:: @ 82F257C + .string "Canceled reading\nthe Card.$" + + .align 2 +gUnknown_082F2598:: @ 82F2598 + .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F25A8:: @ 82F25A8 + .byte 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F25C8:: @ 82F25C8 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F25D8:: @ 82F25D8 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F25E8:: @ 82F25E8 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F25F8:: @ 82F25F8 + .byte 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00 + .byte 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00 + .byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2628:: @ 82F2628 + .byte 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00 + .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2650:: @ 82F2650 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2660:: @ 82F2660 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2670:: @ 82F2670 + .byte 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2698:: @ 82F2698 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F26A8:: @ 82F26A8 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F26B8:: @ 82F26B8 + .byte 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00 + .byte 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00 + .byte 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F26F8:: @ 82F26F8 + .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F25C8 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F25D8 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2698 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2788:: @ 82F2788 + .byte 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F26B8 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00 + + .4byte gText_CanceledReadingCard + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F27D0:: @ 82F27D0 + .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2650 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2800:: @ 82F2800 + .byte 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2628 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F27D0 + .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2660 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2884:: @ 82F2884 + .byte 0x12, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F25F8 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F28E4:: @ 82F28E4 + .byte 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2670 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .byte 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2884 + .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2788 + + .align 2 +gUnknown_082F292C:: @ 82F292C + .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F26A8 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 + .byte 0x10, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F25E8 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F298C:: @ 82F298C + .byte 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 + .byte 0x20, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F25A8 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F26F8 + .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2800 + + .align 2 +gUnknown_082F29EC:: @ 82F29EC + .byte 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F25A8 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F26F8 + .byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F28E4 + .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F2884 + .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gUnknown_082F292C + + .align 2 +gUnknown_082F2A7C:: @ 82F2A7C + .4byte sub_801DFAC + .4byte sub_801E030 + .4byte sub_801E120 + .4byte sub_801E240 + .4byte sub_801E764 + .4byte sub_801E838 + .4byte sub_801E460 + .4byte sub_801E5C4 + .4byte sub_801E668 + .4byte sub_801E978 + + .align 2 +gUnknown_082F2AA4:: @ 82F2AA4 + .byte 0x09, 0x09, 0x09, 0x09 + + .align 2 +gUnknown_082F2AA8:: @ 82F2AA8 + .byte 0x00, 0x16, 0x17, 0x68, 0x19, 0x1a, 0x1b, 0x1c + .byte 0x1d, 0x1e, 0x00, 0x20, 0x21, 0x22, 0x23, 0x24 + .byte 0x25, 0x26, 0x27, 0x28, 0x29, 0x15, 0x01, 0x02 + .byte 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 + .byte 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 + .byte 0x13, 0x14, 0x2a, 0x2b, 0x2c, 0x2d, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x36, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x53, 0x54, 0x55, 0x56, 0x00 + .byte 0x00, 0x00, 0x6f, 0x5b, 0x5c, 0x5d, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x84, 0x85, 0x86, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7 + .byte 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf + .byte 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7 + .byte 0xb8, 0xb9, 0xba, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9 + .byte 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1 + .byte 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9 + .byte 0xea, 0xeb, 0xec, 0xed, 0xee, 0xbb, 0xbc, 0xbd + .byte 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5 + .byte 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd + .byte 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xef + .byte 0xf0, 0xf4, 0xf5, 0xf6, 0xf1, 0xf2, 0xf3, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F2BA8:: @ 82F2BA8 + .4byte gUnknown_0862B9F9 + .4byte gUnknown_0862B9FF + .4byte gUnknown_0862BA05 + .4byte gUnknown_0862BA0B + .4byte gUnknown_0862BA11 + .4byte gUnknown_0862BA17 + .4byte gUnknown_0862BA1D + .4byte gUnknown_0862BA23 + .4byte gUnknown_0862BA29 + .4byte gUnknown_0862BA2F + .4byte gUnknown_0862BA35 + .4byte gUnknown_0862BA3B + .4byte gUnknown_0862BA41 + .4byte gUnknown_0862BA47 + .4byte gUnknown_0862BA4D + .4byte gUnknown_0862BA53 + .4byte gUnknown_0862BA59 + .4byte gUnknown_0862BA5F + .4byte gUnknown_0862BA65 + .4byte gUnknown_0862BA6B + .4byte gUnknown_0862BA79 + .4byte gUnknown_0862BA84 + .4byte gUnknown_0862BA8F + .4byte gUnknown_0862BA9A + .4byte gUnknown_0862BAA3 + .4byte gUnknown_0862BAAE + .4byte gUnknown_0862BAB9 + .4byte gUnknown_0862BAC4 + .4byte gUnknown_0862BACF + .4byte gUnknown_0862BADA + + .align 2 +gUnknown_082F2C20:: @ 82F2C20 + .incbin "graphics/interface/unk_palette1.gbapal" + + .align 2 +gUnknown_082F2C40:: @ 82F2C40 + .incbin "graphics/interface/unk_palette2.gbapal" + + .align 2 +gUnknown_082F2C60:: @ 82F2C60 struct BgTemplate + .4byte 0x00000070, 0x000011fd, 0x0000217a, 0x000070f7 + + .align 2 +gUnknown_082F2C70:: @ 82F2C70 + window_template 0x03, 0x08, 0x01, 0x15, 0x13, 0x0f, 0x0001 + window_template 0x01, 0x09, 0x12, 0x0f, 0x02, 0x0c, 0x007a + window_template 0x01, 0x00, 0x02, 0x06, 0x0f, 0x07, 0x0020 + window_template 0x00, 0x01, 0x02, 0x07, 0x09, 0x0e, 0x0013 + window_template_terminator + + .align 2 +gUnknown_082F2C98:: @ 82F2C98 + .4byte 0x00000000, sub_801F658 + .4byte 0x00000003, sub_801F6F8 + .4byte 0x00000004, sub_801F730 + .4byte 0x00000005, sub_801F768 + .4byte 0x00000001, sub_801F7D4 + .4byte 0x00000006, sub_801F7E0 + .4byte 0x00000007, sub_801F82C + .4byte 0x00000008, sub_801F870 + .4byte 0x00000009, sub_801F8DC + .4byte 0x0000000a, sub_801F984 + .4byte 0x0000000b, sub_801FA2C + .4byte 0x0000000c, sub_801FA68 + .4byte 0x00000002, sub_801FB44 + .4byte 0x0000000d, sub_801FB70 + .4byte 0x00000012, sub_801FBB4 + .4byte 0x00000013, sub_801FBF8 + .4byte 0x0000000e, sub_801FC4C + .4byte 0x0000000f, sub_801FC9C + .4byte 0x00000010, sub_801FCEC + .4byte 0x00000011, sub_801FD30 + .4byte 0x00000014, sub_801FD88 + + .align 2 +gUnknown_082F2D40:: @ 82F2D40 + .4byte gText_QuitChatting + .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gText_RegisterTextWhere + .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gText_RegisterTextHere + .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gText_InputText + .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gText_ExitingChat + .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 + + .4byte gText_LeaderLeftEndingChat + .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00 + + .4byte gText_RegisteredTextChanged + .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 + + .4byte gText_AlreadySavedFile + .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 + + .4byte gText_SavingDontTurnOff + .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 + + .4byte gText_PlayerSavedGame + .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00 + + .4byte gText_IfLeaderLeavesChatEnds + .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 + + .align 2 +gText_Ellipsis:: @ 82F2DC4 + .string "…$" + + .align 2 +gUnknown_082F2DC8:: @ 82F2DC8 + .4byte gText_Upper, 0x00000000 + .4byte gText_Lower, 0x00000000 + .4byte gText_Symbols, 0x00000000 + .4byte gText_Register2, 0x00000000 + .4byte gText_Exit2, 0x00000000 + + .align 2 +gUnknown_082F2DF0:: @ 82F2DF0 + .incbin "graphics/interface/unk_palette3.gbapal" + + .align 2 +gUnknown_082F2E10:: @ 82F2E10 + .incbin "graphics/interface/unk_cursor.4bpp.lz" + + .align 2 +gUnknown_082F3094:: @ 82F3094 + .incbin "graphics/interface/unk_dash.4bpp.lz" + + .align 2 +gUnknown_082F30B4:: @ 82F30B4 + .incbin "graphics/interface/unk_cursor_arrow.4bpp.lz" + + .align 2 +gUnknown_082F30E0:: @ 82F30E0 + .incbin "graphics/interface/unk_rbutton.4bpp.lz" + + .align 2 +gUnknown_082F3134:: @ 82F3134 + .4byte gUnknown_082F2E10 + .2byte 0x1000, 0x0000 + + .4byte gUnknown_082F30B4 + .2byte 0x0040, 0x0001 + + .4byte gUnknown_082F3094 + .2byte 0x0040, 0x0002 + + .4byte gUnknown_082F30E0 + .2byte 0x0080, 0x0003 + + .4byte gUnknown_08DD4CF8 + .2byte 0x0400, 0x0004 + + .align 2 +gUnknown_082F315C:: @ 82F315C struct SpritePalette + .4byte gUnknown_082F2DF0 + .2byte 0x0000 + + .align 2 +gUnknown_082F3164:: @ 82F3164 + .2byte 0x4000, 0xc000, 0x0400, 0x0000 + + .align 2 +gUnknown_082F316C:: @ 82F316C + .2byte 0x0000, 0x001e, 0xffff, 0x0000 + + .align 2 +gUnknown_082F3174:: @ 82F3174 + .2byte 0x0020, 0x001e, 0xffff, 0x0000 + + .align 2 +gUnknown_082F317C:: @ 82F317C + .2byte 0x0040, 0x001e, 0xffff, 0x0000 + + .align 2 +gUnknown_082F3184:: @ 82F3184 + .2byte 0x0060, 0x001e, 0xffff, 0x0000 + +gUnknown_082F318C:: @ 82F318C + .4byte gUnknown_082F316C + .4byte gUnknown_082F3174 + .4byte gUnknown_082F317C + .4byte gUnknown_082F3184 + + .align 2 +gUnknown_082F319C:: @ 82F319C + spr_template 0x0000, 0x0000, gUnknown_082F3164, gUnknown_082F318C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082F31B4:: @ 82F31B4 + .byte 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082F31BC:: @ 82F31BC + spr_template 0x0002, 0x0000, gUnknown_082F31B4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8020ABC + + .align 2 +gUnknown_082F31D4:: @ 82F31D4 + spr_template 0x0001, 0x0000, gUnknown_082F31B4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8020AF4 + + .align 2 +gUnknown_082F31EC:: @ 82F31EC + .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082F31F4:: @ 82F31F4 + .byte 0x00, 0x40, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082F31FC:: @ 82F31FC + .2byte 0x0000, 0x0002, 0xffff, 0x0000 + + .align 2 +gUnknown_082F3204:: @ 82F3204 + .2byte 0x0008, 0x0002, 0xffff, 0x0000 + + .align 2 +gUnknown_082F320C:: @ 82F320C + .2byte 0x0010, 0x0002, 0xffff, 0x0000 + + .align 2 +gUnknown_082F3214:: @ 82F3214 + .2byte 0x0018, 0x0002, 0xffff, 0x0000 + + .align 2 +gUnknown_082F321C:: @ 82F321C + .4byte gUnknown_082F31FC + .4byte gUnknown_082F3204 + .4byte gUnknown_082F320C + .4byte gUnknown_082F3214 + + .align 2 +gUnknown_082F322C:: @ 82F322C + spr_template 0x0003, 0x0000, gUnknown_082F31EC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082F3244:: @ 82F3244 + spr_template 0x0004, 0x0000, gUnknown_082F31F4, gUnknown_082F321C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082F325C:: @ 82F325C + .byte 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 + + .align 2 +gUnknown_082F3264:: @ 82F3264 + .byte 0x00, 0x01, 0x02, 0x03, 0x05, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F326C:: @ 82F326C + .byte 0x04, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00, 0x04 + .byte 0x02, 0x00, 0xff, 0x00, 0x00, 0x00, 0x04, 0x02 + .byte 0x00, 0xfe, 0x00, 0x00, 0x00, 0x06, 0x03, 0x01 + .byte 0xff, 0xfd, 0xff, 0x00, 0x06, 0x04, 0x01, 0xfe + .byte 0xfc, 0xfe, 0x00, 0x00 + + .align 2 +gUnknown_082F3290:: @ 82F3290 + .byte 0x03, 0x02, 0x01, 0x00, 0x03, 0x03, 0x01, 0x00 + .byte 0x03, 0x03, 0x02, 0x00, 0x03, 0x04, 0x02, 0x00 + .byte 0x03, 0x05, 0x03, 0x00 + + .align 2 +gUnknown_082F32A4:: @ 82F32A4 + .4byte gText_ReadyToBerryCrush + .4byte gText_WaitForAllChooseBerry + .4byte gText_EndedWithXUnitsPowder + .4byte gText_RecordingGameResults + .4byte gText_PlayBerryCrushAgain + .4byte gText_YouHaveNoBerries + .4byte gText_MemberDroppedOut + .4byte gText_TimesUpNoGoodPowder + .4byte gText_CommunicationStandby2 + + .align 2 +gUnknown_082F32C8:: @ 82F32C8 struct BgTemplate + .4byte 0x000000F8 + + .align 2 +gUnknown_082F32CC:: @ 82F32CC struct BgTemplate? not sure + .byte 0xd1, 0x14, 0x00, 0x00, 0xc2, 0x20, 0x00, 0x00 + .byte 0xb3, 0x30, 0x00, 0x00 + + .align 2 +gUnknown_082F32D8:: @ 82F32D8 + .byte 0x01, 0x02, 0x03 + +gUnknown_082F32DB:: @ 82F32DB + .byte 0x00, 0x01, 0x02 + +gUnknown_082F32DE:: @ 82F32DE + .byte 0x00, 0x03, 0x04 + +gUnknown_082F32E1:: @ 82F32E1 + .byte 0x01, 0x08, 0x09 + .byte 0x01, 0x06, 0x07 + +gUnknown_082F32E7:: @ 82F32E7 + .byte 0x01, 0x04, 0x05 + + .align 2 +gUnknown_082F32EC:: @ 82F32EC + window_template 0x00, 0x03, 0x04, 0x18, 0x0d, 0x0f, 0x0001 + + .align 2 +gUnknown_082F32F4:: @ 82F32F4 + window_template 0x00, 0x00, 0x00, 0x09, 0x02, 0x08, 0x03ed + window_template 0x00, 0x00, 0x03, 0x09, 0x02, 0x08, 0x03db + window_template 0x00, 0x00, 0x06, 0x09, 0x02, 0x08, 0x03c9 + window_template 0x00, 0x15, 0x03, 0x09, 0x02, 0x08, 0x03b7 + window_template 0x00, 0x15, 0x06, 0x09, 0x02, 0x08, 0x03a5 + window_template_terminator + + window_template 0x00, 0x05, 0x02, 0x14, 0x10, 0x0f, 0x0001 + window_template 0x00, 0x05, 0x02, 0x14, 0x10, 0x0f, 0x0001 + window_template 0x00, 0x04, 0x02, 0x16, 0x10, 0x0f, 0x0001 + window_template_terminator + + .align 2 +gUnknown_082F3344:: @ 82F3344 + .byte 0x06, 0x08, 0x09, 0x0b, 0x0c, 0x0e, 0x0f, 0x10 + + .align 2 +gUnknown_082F334C:: @ 82F334C + .byte 0x80, 0xf0, 0xfa, 0x02, 0x40, 0x78, 0x7d, 0x01 + .byte 0x20, 0xbc, 0xbe, 0x00, 0x10, 0x5e, 0x5f, 0x00 + .byte 0x08, 0xaf, 0x2f, 0x00, 0x84, 0xd7, 0x17, 0x00 + .byte 0xc2, 0xeb, 0x0b, 0x00, 0xe1, 0xf5, 0x05, 0x00 + + .align 2 +gBerryCrushGrinderBasePal:: @ 82F336C + .incbin "graphics/interface/berrycrush_grinder_base.gbapal" + + .align 2 +gBerryCrushMiscSpritesPal:: @ 82F338C + .incbin "graphics/interface/berrycrush_misc.gbapal" + + .align 2 +gBerryCrushTimerDigitsPal:: @ 82F33AC + .incbin "graphics/interface/berrycrush_timerdigits.gbapal" + + .align 2 +gBerryCrushGrinderBaseGfx:: @ 82F33CC + .incbin "graphics/interface/berrycrush_grinder_base.4bpp.lz" + + .align 2 +gBerryCrushBtnPressGfx:: @ 82F36F8 + .incbin "graphics/interface/berrycrush_btnpress.4bpp.lz" + + .align 2 +gBerryCrushSparkleGfx:: @ 82F3A74 + .incbin "graphics/interface/berrycrush_sparkle.4bpp.lz" + + .align 2 +gBerryCrushTimerDigitsGfx:: @ 82F3BC0 + .incbin "graphics/interface/berrycrush_timerdigits.4bpp.lz" + + .align 2 +gBerryCrushGrinderTopTilemap:: @ 82F3C8C + .incbin "graphics/interface/berrycrush_grinder_top.bin.lz" + + .align 2 +gBerryCrushContainerCapTilemap:: @ 82F3DBC + .incbin "graphics/interface/berrycrush_container_cap.bin.lz" + + .align 2 +gBerryCrushBackgroundTilemap:: @ 82F3F54 + .incbin "graphics/interface/berrycrush_background.bin.lz" + + .align 2 +gUnknown_082F417C:: @ 82F417C + .byte 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03 + .byte 0x00, 0x00, 0x01, 0x03, 0x02, 0x04, 0x00, 0x00 + .byte 0x01, 0x03, 0x02, 0x04 + + .align 2 +gUnknown_082F4190:: @ 82F4190 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff + .byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00 + .byte 0xe4, 0xff, 0xfc, 0xff, 0xe8, 0xff, 0x10, 0x00 + .byte 0x02, 0x00, 0x06, 0x00, 0xf0, 0xff, 0x14, 0x00 + .byte 0xf8, 0xff, 0x10, 0x00, 0x03, 0x14, 0x03, 0x00 + .byte 0x1c, 0x00, 0xfc, 0xff, 0x20, 0x00, 0xf8, 0xff + .byte 0x04, 0x14, 0x06, 0x00, 0x10, 0x00, 0x14, 0x00 + .byte 0x10, 0x00, 0xf8, 0xff + + .align 2 +gUnknown_082F41CC:: @ 82F41CC + .byte 0x00, 0x00, 0xff, 0x00, 0x01, 0x01, 0x00, 0x00 + .byte 0xf0, 0xfc, 0x10, 0xfc, 0xf8, 0xfe, 0x08, 0xfe + .byte 0xe8, 0xf8, 0x18, 0xf8, 0xe0, 0xf4, 0x20, 0xf4 + .byte 0xd8, 0xf0, 0x28, 0xf0 + + .align 2 +gUnknown_082F41E8:: @ 82F41E8 + .2byte 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0000 + + .align 2 +gUnknown_082F41F4:: @ 82F41F4 + .4byte gBerryCrushGrinderBaseGfx + .2byte 0x0800, 0x0001 + + .4byte gBerryCrushBtnPressGfx + .2byte 0x0e00, 0x0002 + + .4byte gBerryCrushSparkleGfx + .2byte 0x0700, 0x0003 + + .align 2 +gUnknown_082F420C:: @ 82F420C + .4byte gBerryCrushTimerDigitsGfx + .2byte 0x02c0, 0x0004 + + .4byte NULL + .2byte 0x0000, 0x0000 + + .align 2 +gUnknown_082F421C:: @ 82F421C + .4byte gBerryCrushGrinderBasePal + .2byte 0x0001 + + .align 2 + .4byte gBerryCrushMiscSpritesPal + .2byte 0x0002 + + .align 2 +gUnknown_082F422C:: @ 82F422C + .align 2 + .4byte gBerryCrushTimerDigitsPal + .2byte 0x0004 + + .align 2 + .4byte NULL + .2byte 0x0000 + + .align 2 +gUnknown_082F423C:: @ 82F423C + .2byte 0x0000, 0x0000, 0xffff, 0x0000 + + .align 2 +gUnknown_082F4244:: @ 82F4244 + .2byte 0x0000, 0x0004, 0x0010, 0x0004, 0x0020, 0x0004, 0xffff, 0x0000 + + .align 2 +gUnknown_082F4254:: @ 82F4254 + .2byte 0x0030, 0x0002, 0x0040, 0x0002, 0x0050, 0x0002, 0x0060, 0x0002 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082F4268:: @ 82F4268 + .2byte 0x0000, 0x0002, 0x0004, 0x0002, 0x0008, 0x0002, 0x000c, 0x0002 + .2byte 0x0010, 0x0002, 0x0014, 0x0002, 0xfffe, 0x0000 + + .align 2 +gUnknown_082F4284:: @ 82F4284 + .2byte 0x0018, 0x0004, 0x001c, 0x0004, 0x0020, 0x0004, 0x0024, 0x0004 + .2byte 0x0028, 0x0004, 0x002c, 0x0004, 0x0030, 0x0004, 0x0034, 0x0004 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082F42A8:: @ 82F42A8 + .2byte 0x0014, 0x0000, 0xffff, 0x0000 + + .align 2 +gUnknown_082F42B0:: @ 82F42B0 + .2byte 0x0000, 0x0000, 0xffff, 0x0000 + + .align 2 +gUnknown_082F42B8:: @ 82F42B8 + .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0102, 0x0000 + .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 + + .align 2 +gUnknown_082F42D0:: @ 82F42D0 + .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x01fe, 0x0000 + .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 + + .align 2 +gUnknown_082F42E8:: @ 82F42E8 + .4byte gUnknown_082F423C + + .align 2 +gUnknown_082F42EC:: @ 82F42EC + .4byte gUnknown_082F4244 + .4byte gUnknown_082F4254 + + .align 2 +gUnknown_082F42F4:: @ 82F42F4 + .4byte gUnknown_082F4268 + .4byte gUnknown_082F4284 + + .align 2 +gUnknown_082F42FC:: @ 82F42FC + .4byte gUnknown_082F42A8 + + .align 2 +gUnknown_082F4300:: @ 82F4300 + .4byte gUnknown_082F42B0 + + .align 2 +gUnknown_082F4304:: @ 82F4304 + .4byte gUnknown_082F42B8 + .4byte gUnknown_082F42D0 + + .align 2 +gUnknown_082F430C:: @ 82F430C + spr_template 0x0001, 0x0001, gUnknown_0852491C, gUnknown_082F42E8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082F4324:: @ 82F4324 + spr_template 0x0002, 0x0002, gUnknown_08524914, gUnknown_082F42EC, NULL, gDummySpriteAffineAnimTable, sub_8022A20 + + .align 2 +gUnknown_082F433C:: @ 82F433C + spr_template 0x0003, 0x0002, gUnknown_0852490C, gUnknown_082F42F4, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082F4354:: @ 82F4354 + spr_template 0x0004, 0x0004, gUnknown_08524944, gUnknown_082F42FC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082F436C:: @ 82F436C + spr_template 0x0005, 0x0005, gUnknown_085249D4, gUnknown_082F4300, NULL, gUnknown_082F4304, SpriteCallbackDummy + + .align 2 +gUnknown_082F4384:: @ 82F4384 + .byte 0x09, 0x02, 0x08, 0x00, 0x9c, 0x00, 0x00, 0x00 + .4byte gUnknown_082F420C + .4byte gUnknown_082F422C + + .byte 0x08, 0x02, 0x08, 0x00, 0xb4, 0x00, 0x00, 0x00 + .4byte gUnknown_082F420C + .4byte gUnknown_082F422C + + .byte 0x08, 0x02, 0x08, 0x00, 0xcc, 0x00, 0x00, 0x00 + .4byte gUnknown_082F420C + .4byte gUnknown_082F422C + + .align 2 +gUnknown_082F43B4:: @ 82F43B4 + .4byte gText_SpaceTimes2 + .4byte gText_XDotY + .4byte gText_Var1Berry + .4byte gText_NeatnessRankings + .4byte gText_CoopRankings + .4byte gText_PressingPowerRankings + + .align 2 +gUnknown_082F43CC:: @ 82F43CC + .4byte NULL + .4byte sub_8022C58 + .4byte sub_8022CB0 + .4byte sub_8022D14 + .4byte sub_8022E1C + .4byte sub_8022E3C + .4byte sub_8022E5C + .4byte sub_8022EAC + .4byte sub_8022F04 + .4byte sub_8022F1C + .4byte sub_8023070 + .4byte sub_80231B8 + .4byte sub_80232EC + .4byte sub_80238F0 + .4byte sub_8023998 + .4byte sub_8023A30 + .4byte sub_8023BC0 + .4byte sub_8023CAC + .4byte sub_8024048 + .4byte sub_8024134 + .4byte sub_8024228 + .4byte sub_80242E0 + .4byte sub_80243BC + .4byte sub_8024444 + .4byte sub_8024508 + .4byte sub_8024568 + + .align 2 +gUnknown_082F4434:: @ 82F4434 + .byte 0x02, 0x04, 0x06, 0x07, 0x03, 0x05, 0x08, 0x0b + .byte 0x03, 0x07, 0x0b, 0x0f, 0x04, 0x08, 0x0c, 0x11 + +gUnknown_082F4444:: @ 82F4444 + .byte 0x05, 0x07, 0x09, 0x0c + +gUnknown_082F4448:: @ 82F4448 + .byte 0x03, 0x07, 0x0f, 0x1f + + .align 2 +gUnknown_082F7BA4_UnrefDupe:: @ 82F444C struct BgTemplate + .4byte 0x000001e0 + .4byte 0x000012c9 + .4byte 0x000012ea + .4byte 0x000021ff + .4byte 0x000000ff + .4byte 0x00000000 + + .align 2 +gUnknown_082F7BBC_UnrefDupe:: @ 82F4464 + window_template 0x00, 0x01, 0x01, 0x1c, 0x02, 0x0d, 0x0013 + window_template 0x00, 0x01, 0x05, 0x1c, 0x0e, 0x0d, 0x004b + + .align 2 +gUnknown_082F7BCC_UnrefDupe:: @ 82F4474 + window_template 0x00, 0x01, 0x05, 0x1c, 0x07, 0x0d, 0x004b + + .align 2 +gUnknown_082F7BD4_UnrefDupe:: @ 82F447C + window_template 0x00, 0x01, 0x08, 0x13, 0x03, 0x0d, 0x0013 + window_template 0x00, 0x16, 0x07, 0x06, 0x04, 0x0d, 0x004c + + .align 2 +gUnknown_082F7BE4_UnrefDupe:: @ 82F448C + window_template 0x00, 0x04, 0x06, 0x16, 0x05, 0x0d, 0x0013 + + .align 2 +gUnknown_082F7BEC_UnrefDupe:: @ 82F4494 + window_template 0x00, 0x05, 0x08, 0x13, 0x03, 0x0d, 0x0013 + + .align 2 +gUnknown_082F449C:: @ 82F449C + .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 + .byte 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x03, 0x08 + .byte 0x09, 0x00, 0x00, 0x01, 0x02, 0x05, 0x06, 0x03 + .byte 0x04, 0x05, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 + .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x02, 0x09 + .byte 0x00, 0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x02 + .byte 0x03, 0x04, 0x09, 0x00, 0x00, 0x01, 0x06, 0x07 + .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x09, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02 + .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x00 + .byte 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01 + .byte 0x02, 0x03, 0x00, 0x00, 0x05, 0x06, 0x07, 0x08 + .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x07 + .byte 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03 + .byte 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x02 + .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 + .byte 0x01, 0x02, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 + .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08 + .byte 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 + .byte 0x08, 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 + .byte 0x06, 0x07, 0x08, 0x04, 0x05, 0x06, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x03, 0x04, 0x05, 0x05, 0x06, 0x03 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x04, 0x05, 0x06, 0x06, 0x07, 0x02, 0x02 + .byte 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x04, 0x05, 0x05, 0x06, 0x07, 0x07, 0x08 + .byte 0x01, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x04 + .byte 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x00 + .byte 0x00, 0x01, 0x02, 0x02, 0x03, 0x04, 0x01, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01 + .byte 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00 + .byte 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01 + .byte 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x00, 0x00 + .byte 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x02 + .byte 0x01, 0x02, 0x03, 0x02, 0x03, 0x04, 0x03, 0x04 + .byte 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09 + .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x09, 0x09 + .byte 0x09, 0x09, 0x00, 0x00, 0x01, 0x01, 0x00, 0x09 + .byte 0x09, 0x09, 0x09, 0x09, 0x02, 0x02, 0x00, 0x00 + .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x03, 0x03 + .byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x09 + .byte 0x03, 0x03, 0x04, 0x04, 0x00, 0x00, 0x01, 0x01 + .byte 0x02, 0x02, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00 + .byte 0x04, 0x06, 0x00, 0x00, 0x00, 0x03, 0x05, 0x07 + .byte 0x00, 0x00, 0x02, 0x04, 0x06, 0x08, 0x00, 0x01 + .byte 0x03, 0x05, 0x06, 0x09 + + .align 2 +gUnknown_082F7DF0_UnrefDupe:: @ 82F4698 + .incbin "graphics/interface/dodrioberry_bg1.gbapal" + + .align 2 + .incbin "graphics/interface/dodrioberry_bg2.gbapal" + + .align 2 +gUnknown_082F7E30_UnrefDupe:: @ 82F46B8 + .incbin "graphics/interface/dodrioberry_pkmn.gbapal" + + .align 2 +gUnknown_082F7E50_UnrefDupe:: @ 82F46D8 + .incbin "graphics/interface/dodrioberry_shiny.gbapal" + + .align 2 +gUnknown_082F7E70_UnrefDupe:: @ 82F46F8 + .incbin "graphics/interface/dodrioberry_status.gbapal" + + .align 2 +gUnknown_082F7E90_UnrefDupe:: @ 82F4718 + .incbin "graphics/interface/dodrioberry_berrysprites.gbapal" + + .align 2 +gUnknown_082F7EB0_UnrefDupe:: @ 82F4738 + .incbin "graphics/interface/dodrioberry_berrysprites.4bpp.lz" + + .align 2 +gUnknown_082F8064_UnrefDupe:: @ 82F490C + .incbin "graphics/interface/dodrioberry_platform.gbapal" + + .align 2 +gUnknown_082F8084_UnrefDupe:: @ 82F492C + .incbin "graphics/interface/dodrioberry_bg1.4bpp.lz" + + .align 2 +gUnknown_082F8914_UnrefDupe:: @ 82F51BC + .incbin "graphics/interface/dodrioberry_bg2.4bpp.lz" + + .align 2 +gUnknown_082F96E0_UnrefDupe:: @ 82F5F88 + .incbin "graphics/interface/dodrioberry_status.4bpp.lz" + + .align 2 +gUnknown_082F9774_UnrefDupe:: @ 82F601C + .incbin "graphics/interface/dodrioberry_platform.4bpp.lz" + + .align 2 +gUnknown_082F98BC_UnrefDupe:: @ 82F6164 + .incbin "graphics/interface/dodrioberry_pkmn.4bpp.lz" + + .align 2 +gUnknown_082FAAD8_UnrefDupe:: @ 82F7380 + .incbin "graphics/interface/dodrioberry_bg1.bin.lz" + + .align 2 +gUnknown_082FAD44_UnrefDupe:: @ 82F75EC + .incbin "graphics/interface/dodrioberry_bg2right.bin.lz" + + .align 2 +gUnknown_082FAF94_UnrefDupe:: @ 82F783C + .incbin "graphics/interface/dodrioberry_bg2left.bin.lz" + + .align 2 +gUnknown_082F7A88:: @ 82F7A88 + .byte 0x28, 0x18, 0x0d, 0x20, 0x13, 0x0a, 0x16, 0x0d + .byte 0x07, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F7A94:: @ 82F7A94 + .byte 0x08, 0x05, 0x08, 0x0b, 0x0f, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082F7A9C:: @ 82F7A9C + .byte 0x05, 0x0a, 0x14, 0x1e, 0x32, 0x46, 0x64, 0x00 + + .align 2 +gUnknown_082F7AA4:: @ 82F7AA4 + .byte 0x0f, 0x10, 0x11, 0x12, 0x13, 0x13, 0x12, 0x11 + .byte 0x10, 0x0f, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 + .byte 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21 + .byte 0x22, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x00, 0x00 + + .align 2 +gUnknown_082F7AC4:: @ 82F7AC4 + .4byte sub_8024DBC + .4byte sub_8024E00 + .4byte sub_8024E38 + .4byte sub_8024F10 + .4byte sub_8024F38 + .4byte sub_8025198 + .4byte sub_8025324 + .4byte sub_8025470 + .4byte sub_8025644 + .4byte sub_80256AC + .4byte sub_8025758 + .4byte sub_80250D4 + + .align 2 +gUnknown_082F7AF4:: @ 82F7AF4 + .4byte sub_8024DBC + .4byte sub_8024E00 + .4byte sub_8024E38 + .4byte sub_8024F10 + .4byte sub_8024FFC + .4byte sub_8025230 + .4byte sub_8025324 + .4byte sub_8025470 + .4byte sub_8025644 + .4byte sub_80256AC + .4byte sub_8025758 + .4byte sub_8025158 + + .align 2 +gUnknown_082F7B24:: @ 82F7B24 + .2byte 0x000a, 0x001e, 0x0032, 0x0032 + + .align 2 +gUnknown_082F7B2C:: @ 82F7B2C + .byte 0x00, 0x05, 0x01, 0x14, 0x0b, 0x0f, 0x01, 0x00 + + .align 2 +gUnknown_082F7B34:: @ 82F7B34 + .4byte gText_BerriesPicked + .4byte gText_BestScore + .4byte gText_BerriesInRowFivePlayers + + .align 2 +gUnknown_082F7B40:: @ 82F7B40 + .byte 0x04, 0x07, 0x04, 0x00 + + .align 2 +gUnknown_082F7B44:: @ 82F7B44 + .2byte 0x0019, 0x0029, 0x0039 + +gUnknown_082F7B4A:: @ 82F7B4A + .2byte 0x0019, 0x0029, 0x0049 + + .align 2 +gUnknown_082F7B50:: @ 82F7B50 + .2byte 0x270f, 0x0000, 0x005a, 0x270f, 0x270f, 0x270f, 0x0046, 0x270f + .2byte 0x270f, 0x0000, 0x270f, 0x0000, 0x270f, 0x270f, 0x003c, 0x0000 + .2byte 0x270f, 0x270f, 0x270f, 0x0000 + + .align 2 +gUnknown_082F7B78:: @ 82F7B78 + .string "ÀÁÂÇÈÉÊ$" + + .align 2 +gUnknown_082F7B80:: @ 82F7B80 + .string "ABCDEFG$" + + .align 2 +gUnknown_082F7B88:: @ 82F7B88 + .string "0123456$" + + .align 2 +gUnknown_082F7B90:: @ 82F7B90 + .4byte gUnknown_082F7B78 + .4byte gUnknown_082F7B78 + .4byte gUnknown_082F7B78 + .4byte gUnknown_082F7B80 + .4byte gUnknown_082F7B88 + + .align 2 +gUnknown_082F7BA4:: @ 82F7BA4 struct BgTemplate + .4byte 0x000001e0 + .4byte 0x000012c9 + .4byte 0x000012ea + .4byte 0x000021ff + .4byte 0x000000ff + .4byte 0x00000000 + + .align 2 +gUnknown_082F7BBC:: @ 82F7BBC + window_template 0x00, 0x01, 0x01, 0x1c, 0x02, 0x0d, 0x0013 + window_template 0x00, 0x01, 0x05, 0x1c, 0x0e, 0x0d, 0x004b + + .align 2 +gUnknown_082F7BCC:: @ 82F7BCC + window_template 0x00, 0x01, 0x05, 0x1c, 0x07, 0x0d, 0x004b + + .align 2 +gUnknown_082F7BD4:: @ 82F7BD4 + window_template 0x00, 0x01, 0x08, 0x13, 0x03, 0x0d, 0x0013 + window_template 0x00, 0x16, 0x07, 0x06, 0x04, 0x0d, 0x004c + + .align 2 +gUnknown_082F7BE4:: @ 82F7BE4 + window_template 0x00, 0x04, 0x06, 0x16, 0x05, 0x0d, 0x0013 + + .align 2 +gUnknown_082F7BEC:: @ 82F7BEC + window_template 0x00, 0x05, 0x08, 0x13, 0x03, 0x0d, 0x0013 + + .align 2 +gUnknown_082F449C_UnrefDupe:: @ 82F7BF4 + .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 + .byte 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x03, 0x08 + .byte 0x09, 0x00, 0x00, 0x01, 0x02, 0x05, 0x06, 0x03 + .byte 0x04, 0x05, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 + .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x02, 0x09 + .byte 0x00, 0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x02 + .byte 0x03, 0x04, 0x09, 0x00, 0x00, 0x01, 0x06, 0x07 + .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x09, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02 + .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x00 + .byte 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01 + .byte 0x02, 0x03, 0x00, 0x00, 0x05, 0x06, 0x07, 0x08 + .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x07 + .byte 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03 + .byte 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x02 + .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 + .byte 0x01, 0x02, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 + .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08 + .byte 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 + .byte 0x08, 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 + .byte 0x06, 0x07, 0x08, 0x04, 0x05, 0x06, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x03, 0x04, 0x05, 0x05, 0x06, 0x03 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x04, 0x05, 0x06, 0x06, 0x07, 0x02, 0x02 + .byte 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x04, 0x05, 0x05, 0x06, 0x07, 0x07, 0x08 + .byte 0x01, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x04 + .byte 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x00 + .byte 0x00, 0x01, 0x02, 0x02, 0x03, 0x04, 0x01, 0x00 + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01 + .byte 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00 + .byte 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01 + .byte 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x00, 0x00 + .byte 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x02 + .byte 0x01, 0x02, 0x03, 0x02, 0x03, 0x04, 0x03, 0x04 + .byte 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09 + .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x09, 0x09 + .byte 0x09, 0x09, 0x00, 0x00, 0x01, 0x01, 0x00, 0x09 + .byte 0x09, 0x09, 0x09, 0x09, 0x02, 0x02, 0x00, 0x00 + .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x03, 0x03 + .byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x09 + .byte 0x03, 0x03, 0x04, 0x04, 0x00, 0x00, 0x01, 0x01 + .byte 0x02, 0x02, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00 + .byte 0x04, 0x06, 0x00, 0x00, 0x00, 0x03, 0x05, 0x07 + .byte 0x00, 0x00, 0x02, 0x04, 0x06, 0x08, 0x00, 0x01 + .byte 0x03, 0x05, 0x06, 0x09 + + .align 2 +gDodrioBerryBgPal1:: @ 82F7DF0 + .incbin "graphics/interface/dodrioberry_bg1.gbapal" + + .align 2 + .incbin "graphics/interface/dodrioberry_bg2.gbapal" + + .align 2 +gDodrioBerryPkmnPal:: @ 82F7E30 + .incbin "graphics/interface/dodrioberry_pkmn.gbapal" + + .align 2 +gDodrioBerryShinyPal:: @ 82F7E50 + .incbin "graphics/interface/dodrioberry_shiny.gbapal" + + .align 2 +gDodrioBerryStatusPal:: @ 82F7E70 + .incbin "graphics/interface/dodrioberry_status.gbapal" + + .align 2 +gDodrioBerrySpritesPal:: @ 82F7E90 + .incbin "graphics/interface/dodrioberry_berrysprites.gbapal" + + .align 2 +gDodrioBerrySpritesGfx:: @ 82F7EB0 + .incbin "graphics/interface/dodrioberry_berrysprites.4bpp.lz" + + .align 2 +gDodrioBerryPlatformPal:: @ 82F8064 + .incbin "graphics/interface/dodrioberry_platform.gbapal" + + .align 2 +gDodrioBerryBgGfx1:: @ 82F8084 + .incbin "graphics/interface/dodrioberry_bg1.4bpp.lz" + + .align 2 +gDodrioBerryBgGfx2:: @ 82F8914 + .incbin "graphics/interface/dodrioberry_bg2.4bpp.lz" + + .align 2 +gDodrioBerryStatusGfx:: @ 82F96E0 + .incbin "graphics/interface/dodrioberry_status.4bpp.lz" + + .align 2 +gDodrioBerryPlatformGfx:: @ 82F9774 + .incbin "graphics/interface/dodrioberry_platform.4bpp.lz" + + .align 2 +gDodrioBerryPkmnGfx:: @ 82F98BC + .incbin "graphics/interface/dodrioberry_pkmn.4bpp.lz" + + .align 2 +gDodrioBerryBgTilemap1:: @ 82FAAD8 + .incbin "graphics/interface/dodrioberry_bg1.bin.lz" + + .align 2 +gDodrioBerryBgTilemap2Right:: @ 82FAD44 + .incbin "graphics/interface/dodrioberry_bg2right.bin.lz" + + .align 2 +gDodrioBerryBgTilemap2Left:: @ 82FAF94 + .incbin "graphics/interface/dodrioberry_bg2left.bin.lz" + + .align 2 +gUnknown_082FB1E0:: @ 82FB1E0 + .byte 0x00, 0x00, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082FB1E8:: @ 82FB1E8 + .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082FB1F0:: @ 82FB1F0 + .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082FB1F8:: @ 82FB1F8 + .byte 0x00, 0x40, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x00 + + .align 2 +gUnknown_082FB200:: @ 82FB200 + .2byte 0x0000, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB208:: @ 82FB208 + .2byte 0x0040, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB210:: @ 82FB210 + .2byte 0x0080, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB218:: @ 82FB218 + .2byte 0x00c0, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB220:: @ 82FB220 + .2byte 0x0100, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB228:: @ 82FB228 + .4byte gUnknown_082FB200 + .4byte gUnknown_082FB208 + .4byte gUnknown_082FB210 + .4byte gUnknown_082FB218 + .4byte gUnknown_082FB220 + + .align 2 +gUnknown_082FB23C:: @ 82FB23C + .2byte 0x0000, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB244:: @ 82FB244 + .2byte 0x0004, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB24C:: @ 82FB24C + .2byte 0x0008, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB254:: @ 82FB254 + .4byte gUnknown_082FB23C + .4byte gUnknown_082FB244 + .4byte gUnknown_082FB24C + + .align 2 +gUnknown_082FB260:: @ 82FB260 + .2byte 0x0000, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB268:: @ 82FB268 + .2byte 0x0004, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB270:: @ 82FB270 + .2byte 0x0008, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB278:: @ 82FB278 + .2byte 0x000c, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB280:: @ 82FB280 + .2byte 0x0010, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB288:: @ 82FB288 + .2byte 0x0014, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB290:: @ 82FB290 + .2byte 0x0018, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB298:: @ 82FB298 + .2byte 0x001c, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB2A0:: @ 82FB2A0 + .2byte 0x0020, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB2A8:: @ 82FB2A8 + .4byte gUnknown_082FB260 + .4byte gUnknown_082FB268 + .4byte gUnknown_082FB270 + .4byte gUnknown_082FB278 + .4byte gUnknown_082FB280 + .4byte gUnknown_082FB288 + .4byte gUnknown_082FB290 + .4byte gUnknown_082FB298 + .4byte gUnknown_082FB2A0 + + .align 2 +gUnknown_082FB2CC:: @ 82FB2CC + .2byte 0x0000, 0x0014 + .2byte 0xfffe, 0x0000 + + .align 2 +gUnknown_082FB2D4:: @ 82FB2D4 + .4byte gUnknown_082FB2CC + + .align 2 +gUnknown_082FB2D8:: @ 82FB2D8 + obj_pal gDodrioBerryPkmnPal, 0x0000 + + .align 2 +gUnknown_082FB2E0:: @ 82FB2E0 + obj_pal gDodrioBerryShinyPal, 0x0001 + + .align 2 +gUnknown_082FB2E8:: @ 82FB2E8 + obj_pal gDodrioBerryStatusPal, 0x0002 + + .align 2 +gUnknown_082FB2F0:: @ 82FB2F0 + spr_template 0x0001, 0x0002, gUnknown_082FB1E8, gUnknown_082FB254, NULL, gDummySpriteAffineAnimTable, nullsub_15 + + .align 2 + .byte 0xD4, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44 + .byte 0x45, 0xFB, 0x00, 0x00 + + .align 2 +gUnknown_082FB314:: @ 82FB314 + obj_pal gDodrioBerrySpritesPal, 0x0003 + + .align 2 +gUnknown_082FB31C:: @ 82FB31C + .2byte 0x0058, 0x0080, 0x00a8, 0x00d0 + + .align 2 +gUnknown_082FB324:: @ 82FB324 + spr_template 0x0002, 0x0003, gUnknown_082FB1F0, gUnknown_082FB2A8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082FB33C:: @ 82FB33C + spr_template 0x0002, 0x0003, gUnknown_082FB1E8, gUnknown_082FB2A8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082FB354:: @ 82FB354 + .byte 0x1E, 0x14 + +gUnknown_082FB356:: @ 82FB356 + .byte 0xE6, 0x00 + + .align 2 +gUnknown_082FB358:: @ 82FB358 + .2byte 0x0037, 0x001e, 0x004a, 0x0000 + + .align 2 +gUnknown_082FB360:: @ 82FB360 + obj_pal gDodrioBerryPlatformPal, 0x0006 + + .align 2 +gUnknown_082FB368:: @ 82FB368 + spr_template 0x0005, 0x0006, gUnknown_082FB1F8, gUnknown_082FB2D4, NULL, gDummySpriteAffineAnimTable, sub_8028CF4 + + .align 2 +gUnknown_082FB380:: @ 82FB380 + .byte 0x01, 0x02, 0x03 + +gUnknown_082FB383:: @ 82FB383 + .byte 0x01, 0x04, 0x05 + .byte 0x01, 0x08, 0x09 + .byte 0x01, 0x06, 0x07 + + .align 2 +gUnknown_082FB38C:: @ 82FB38C + .byte 0x0c, 0x06, 0x00, 0x00 + + .align 2 +gUnknown_082FB390:: @ 82FB390 + .byte 0x09, 0x0a, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00 + + .align 2 +gUnknown_082FB398:: @ 82FB398 + .byte 0x0c, 0x06, 0x00, 0x00, 0x12, 0x0a, 0x00, 0x00 + .byte 0x06, 0x0a, 0x00, 0x00 + + .align 2 +gUnknown_082FB3A4:: @ 82FB3A4 + .byte 0x09, 0x0a, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00 + .byte 0x15, 0x0a, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00 + + .align 2 +gUnknown_082FB3B4:: @ 82FB3B4 + .byte 0x0c, 0x06, 0x00, 0x00, 0x12, 0x0a, 0x00, 0x00 + .byte 0x17, 0x06, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00 + .byte 0x06, 0x0a, 0x00, 0x00 + + .align 2 +gUnknown_082FB3C8:: @ 82FB3C8 + .4byte gUnknown_082FB38C + .4byte gUnknown_082FB390 + .4byte gUnknown_082FB398 + .4byte gUnknown_082FB3A4 + .4byte gUnknown_082FB3B4 + + .align 2 +gUnknown_082FB3DC:: @ 82FB3DC + .4byte gText_1Colon + .4byte gText_2Colon + .4byte gText_3Colon + .4byte gText_4Colon + .4byte gText_5Colon + + .align 2 +gUnknown_082FB3F0:: @ 82FB3F0 + .2byte 0x005c, 0x0084, 0x00ac, 0x00d4 + +gUnknown_082FB3F8:: @ 82FB3F8 + .2byte 0x0021, 0x0031, 0x0041, 0x0051, 0x0061 + +gUnknown_082FB402:: @ 82FB402 + .2byte 0x0011, 0x0021, 0x0031, 0x0041, 0x0051 + + .align 2 +gUnknown_082FB40C:: @ 82FB40C + .4byte 0x00000000, sub_8029338 + .4byte 0x00000001, sub_8029440 + .4byte 0x00000002, sub_802988C + .4byte 0x00000003, sub_802A010 + .4byte 0x00000004, sub_802A380 + .4byte 0x00000005, sub_802A454 + .4byte 0x00000006, sub_802A534 + .4byte 0x00000007, sub_802A588 + .4byte 0x00000008, unused_0 + .4byte 0x00000009, nullsub_16 + + .align 2 +gUnknown_082FB45C:: @ 82FB45C + .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00 + + .align 2 +gPkmnJumpSpecies:: @ 82FB464 + .2byte SPECIES_BULBASAUR, 0x0002 + .2byte SPECIES_CHARMANDER, 0x0001 + .2byte SPECIES_SQUIRTLE, 0x0000 + .2byte SPECIES_CATERPIE, 0x0001 + .2byte SPECIES_METAPOD, 0x0001 + .2byte SPECIES_WEEDLE, 0x0001 + .2byte SPECIES_KAKUNA, 0x0001 + .2byte SPECIES_RATTATA, 0x0001 + .2byte SPECIES_RATICATE, 0x0001 + .2byte SPECIES_PIKACHU, 0x0000 + .2byte SPECIES_SANDSHREW, 0x0000 + .2byte SPECIES_NIDORAN_F, 0x0000 + .2byte SPECIES_NIDORAN_M, 0x0000 + .2byte SPECIES_CLEFAIRY, 0x0000 + .2byte SPECIES_VULPIX, 0x0000 + .2byte SPECIES_JIGGLYPUFF, 0x0002 + .2byte SPECIES_ODDISH, 0x0002 + .2byte SPECIES_PARAS, 0x0001 + .2byte SPECIES_MEOWTH, 0x0000 + .2byte SPECIES_PSYDUCK, 0x0002 + .2byte SPECIES_MANKEY, 0x0001 + .2byte SPECIES_GROWLITHE, 0x0001 + .2byte SPECIES_POLIWAG, 0x0002 + .2byte SPECIES_BELLSPROUT, 0x0002 + .2byte SPECIES_SHELLDER, 0x0001 + .2byte SPECIES_KRABBY, 0x0001 + .2byte SPECIES_EXEGGCUTE, 0x0002 + .2byte SPECIES_CUBONE, 0x0000 + .2byte SPECIES_DITTO, 0x0002 + .2byte SPECIES_EEVEE, 0x0000 + .2byte SPECIES_OMANYTE, 0x0001 + .2byte SPECIES_KABUTO, 0x0001 + .2byte SPECIES_CHIKORITA, 0x0002 + .2byte SPECIES_CYNDAQUIL, 0x0001 + .2byte SPECIES_TOTODILE, 0x0000 + .2byte SPECIES_SPINARAK, 0x0001 + .2byte SPECIES_PICHU, 0x0000 + .2byte SPECIES_CLEFFA, 0x0000 + .2byte SPECIES_IGGLYBUFF, 0x0002 + .2byte SPECIES_TOGEPI, 0x0002 + .2byte SPECIES_MAREEP, 0x0000 + .2byte SPECIES_BELLOSSOM, 0x0002 + .2byte SPECIES_MARILL, 0x0002 + .2byte SPECIES_SUNKERN, 0x0002 + .2byte SPECIES_WOOPER, 0x0002 + .2byte SPECIES_PINECO, 0x0002 + .2byte SPECIES_SNUBBULL, 0x0000 + .2byte SPECIES_SHUCKLE, 0x0002 + .2byte SPECIES_TEDDIURSA, 0x0000 + .2byte SPECIES_SLUGMA, 0x0002 + .2byte SPECIES_SWINUB, 0x0000 + .2byte SPECIES_HOUNDOUR, 0x0001 + .2byte SPECIES_PHANPY, 0x0000 + .2byte SPECIES_PORYGON2, 0x0000 + .2byte SPECIES_TYROGUE, 0x0001 + .2byte SPECIES_SMOOCHUM, 0x0002 + .2byte SPECIES_ELEKID, 0x0001 + .2byte SPECIES_MAGBY, 0x0001 + .2byte SPECIES_LARVITAR, 0x0001 + .2byte SPECIES_TREECKO, 0x0001 + .2byte SPECIES_TORCHIC, 0x0002 + .2byte SPECIES_MUDKIP, 0x0000 + .2byte SPECIES_MARSHTOMP, 0x0000 + .2byte SPECIES_POOCHYENA, 0x0001 + .2byte SPECIES_ZIGZAGOON, 0x0000 + .2byte SPECIES_LINOONE, 0x0000 + .2byte SPECIES_WURMPLE, 0x0001 + .2byte SPECIES_SILCOON, 0x0002 + .2byte SPECIES_CASCOON, 0x0002 + .2byte SPECIES_LOTAD, 0x0002 + .2byte SPECIES_SEEDOT, 0x0001 + .2byte SPECIES_RALTS, 0x0000 + .2byte SPECIES_KIRLIA, 0x0000 + .2byte SPECIES_SURSKIT, 0x0002 + .2byte SPECIES_SHROOMISH, 0x0002 + .2byte SPECIES_NINCADA, 0x0001 + .2byte SPECIES_WHISMUR, 0x0000 + .2byte SPECIES_AZURILL, 0x0002 + .2byte SPECIES_SKITTY, 0x0000 + .2byte SPECIES_SABLEYE, 0x0000 + .2byte SPECIES_MAWILE, 0x0000 + .2byte SPECIES_ARON, 0x0001 + .2byte SPECIES_MEDITITE, 0x0002 + .2byte SPECIES_ELECTRIKE, 0x0001 + .2byte SPECIES_PLUSLE, 0x0001 + .2byte SPECIES_MINUN, 0x0001 + .2byte SPECIES_VOLBEAT, 0x0000 + .2byte SPECIES_ILLUMISE, 0x0000 + .2byte SPECIES_ROSELIA, 0x0002 + .2byte SPECIES_GULPIN, 0x0002 + .2byte SPECIES_NUMEL, 0x0002 + .2byte SPECIES_TORKOAL, 0x0002 + .2byte SPECIES_SPOINK, 0x0000 + .2byte SPECIES_TRAPINCH, 0x0002 + .2byte SPECIES_CACNEA, 0x0002 + .2byte SPECIES_ANORITH, 0x0001 + .2byte SPECIES_WYNAUT, 0x0000 + .2byte SPECIES_SNORUNT, 0x0000 + .2byte SPECIES_CLAMPERL, 0x0001 + .2byte SPECIES_BAGON, 0x0001 + + .align 2 +gUnknown_082FB5F4:: @ 82FB5F4 + .4byte sub_802B248 + .4byte sub_802B2D4 + .4byte sub_802B368 + .4byte sub_802B3D4 + .4byte sub_802B4CC + .4byte sub_802B5C8 + .4byte sub_802B664 + .4byte sub_802B6B8 + .4byte sub_802B720 + + .align 2 +gUnknown_082FB618:: @ 82FB618 + .4byte sub_802B29C + .4byte sub_802B31C + .4byte sub_802B3B4 + .4byte sub_802B470 + .4byte sub_802B568 + .4byte sub_802B628 + .4byte sub_802B664 + .4byte sub_802B704 + .4byte sub_802B720 + + .align 2 +gUnknown_082FB63C:: @ 82FB63C + .2byte 0x001a, 0x001f, 0x0024, 0x0029, 0x002e, 0x0033, 0x0038, 0x003d + + .align 2 +gUnknown_082FB64C:: @ 82FB64C + .2byte 0x0000, 0x0001, 0x0001, 0x0002 + + .align 2 +gUnknown_082FB654:: @ 82FB654 + .2byte 0x005f, 0x0066, 0x00e4, 0x0105 + + .align 2 +gUnknown_082FB65C:: @ 82FB65C + .byte 0xfd, 0xfa, 0xf8, 0xf6, 0xf3, 0xf1, 0xef, 0xed + .byte 0xeb, 0xe9, 0xe7, 0xe5, 0xe4, 0xe3, 0xe2, 0xe2 + .byte 0xe2, 0xe4, 0xe5, 0xe6, 0xe7, 0xe9, 0xea, 0xec + .byte 0xee, 0xef, 0xf1, 0xf3, 0xf5, 0xf8, 0xfa, 0xfc + .byte 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xfd, 0xfa, 0xf7, 0xf5, 0xf2, 0xf0, 0xee, 0xec + .byte 0xea, 0xe8, 0xe6, 0xe4, 0xe3, 0xe2, 0xe2, 0xe4 + .byte 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf5 + .byte 0xf7, 0xfa, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xfd, 0xfa, 0xf7, 0xf5, 0xf3, 0xf1, 0xef, 0xed + .byte 0xeb, 0xe9, 0xe7, 0xe5, 0xe4, 0xe3, 0xe2, 0xe2 + .byte 0xe2, 0xe2, 0xe3, 0xe3, 0xe4, 0xe4, 0xe5, 0xe5 + .byte 0xe6, 0xe7, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2 + .byte 0xf4, 0xf5, 0xf7, 0xfa, 0xfc, 0xff, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082FB6EC:: @ 82FB6EC + .4byte 0x00000000, 0x00000000, 0x00000032, 0x00000064 + .4byte 0x000000c8, 0x000001f4 + + .align 2 +gUnknown_082FB704:: @ 82FB704 + .2byte 0x008a, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, 0x0093 + + .align 2 +gUnknown_082FB714:: @ 82FB714 + .4byte 0x00001388, 0x00000001, 0x00001f40, 0x00000002 + .4byte 0x00002ee0, 0x00000003, 0x00003e80, 0x00000004 + .4byte 0x00004e20, 0x00000005 + + .align 2 +gPkmnJumpPal1:: @ 82FB73C + .incbin "graphics/interface/pkmnjump_pal1.gbapal" + + .align 2 +gPkmnJumpPal2:: @ 82FB75C + .incbin "graphics/interface/pkmnjump_pal2.gbapal" + + .align 2 +gPkmnJumpRopeGfx1:: @ 82FB77C + .incbin "graphics/interface/pkmnjump_rope1.4bpp.lz" + + .align 2 +gPkmnJumpRopeGfx2:: @ 82FB89C + .incbin "graphics/interface/pkmnjump_rope2.4bpp.lz" + + .align 2 +gPkmnJumpRopeGfx3:: @ 82FBA70 + .incbin "graphics/interface/pkmnjump_rope3.4bpp.lz" + + .align 2 +gPkmnJumpRopeGfx4:: @ 82FBBA0 + .incbin "graphics/interface/pkmnjump_rope4.4bpp.lz" + + .align 2 +gPkmnJumpStarGfx:: @ 82FBC9C + .incbin "graphics/interface/pkmnjump_star.4bpp.lz" + + .align 2 +gUnknown_082FBE08:: @ 82FBE08 + obj_tiles gPkmnJumpRopeGfx1, 0x0600, 0x0005 + + .align 2 + obj_tiles gPkmnJumpRopeGfx2, 0x0c00, 0x0006 + + .align 2 + obj_tiles gPkmnJumpRopeGfx3, 0x0600, 0x0007 + + .align 2 + obj_tiles gPkmnJumpRopeGfx4, 0x0600, 0x0008 + + .align 2 + obj_tiles gPkmnJumpStarGfx, 0x0200, 0x000a + + .align 2 +gUnknown_082FBE30:: @ 82FBE30 + obj_pal gPkmnJumpPal1, 0x0005 + + .align 2 + obj_pal gPkmnJumpPal2, 0x0006 + + .align 2 +gUnknown_082FBE40:: @ 82FBE40 + spr_template 0x0000, 0x0000, gUnknown_082FBEC8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + +gUnknown_082FBE58:: @ 82FBE58 + .2byte 0x0060, 0x0060, 0x0060, 0x0072, 0x0078, 0x0078, 0x0078, 0x0072 + .2byte 0x0060, 0x0060, 0x0046, 0x0050, 0x0060, 0x0072, 0x0078, 0x0080 + .2byte 0x0078, 0x0072, 0x0060, 0x0050, 0x0032, 0x0048, 0x0060, 0x0072 + .2byte 0x0080, 0x0088, 0x0080, 0x0072, 0x0060, 0x0048, 0x002a, 0x0048 + .2byte 0x0060, 0x0072, 0x0080, 0x0088, 0x0080, 0x0072, 0x0060, 0x0048 + +gUnknown_082FBEA8:: @ 82FBEA8 + .2byte 0x0010, 0x0028, 0x0048, 0x0068, 0x0088, 0x00a8, 0x00c8, 0x00e0 + + .align 2 +gUnknown_082FBEB8:: @ 82FBEB8 + .4byte gUnknown_082FBF78 + .4byte gUnknown_082FBF90 + .4byte gUnknown_082FBFA8 + .4byte gUnknown_082FBFC0 + + .align 2 +gUnknown_082FBEC8:: @ 82FBED0 + .byte 0x00, 0x00, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082FBED0:: @ 82FBED0 + .byte 0x00, 0x80, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082FBED8:: @ 82FBED8 + .byte 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082FBEE0:: @ 82FBEE0 + .byte 0x00, 0x40, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 + + .align 2 +gUnknown_082FBEE8:: @ 82FBEE8 + .2byte 0x0000, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBEF0:: @ 82FBEF0 + .2byte 0x0008, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBEF8:: @ 82FBEF8 + .2byte 0x0010, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF00:: @ 82FBF00 + .2byte 0x0018, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF08:: @ 82FBF08 + .2byte 0x0020, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF10:: @ 82FBF10 + .2byte 0x0028, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF18:: @ 82FBF18 + .2byte 0x0000, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF20:: @ 82FBF20 + .2byte 0x0010, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF28:: @ 82FBF28 + .2byte 0x0020, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF30:: @ 82FBF30 + .2byte 0x0030, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF38:: @ 82FBF38 + .2byte 0x0040, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF40:: @ 82FBF40 + .2byte 0x0050, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBF48:: @ 82FBF48 + .4byte gUnknown_082FBEE8 + .4byte gUnknown_082FBEF0 + .4byte gUnknown_082FBEF8 + .4byte gUnknown_082FBF00 + .4byte gUnknown_082FBF08 + .4byte gUnknown_082FBF10 + + .align 2 +gUnknown_082FBF60:: @ 82FBF60 + .4byte gUnknown_082FBF18 + .4byte gUnknown_082FBF20 + .4byte gUnknown_082FBF28 + .4byte gUnknown_082FBF30 + .4byte gUnknown_082FBF38 + .4byte gUnknown_082FBF40 + + .align 2 +gUnknown_082FBF78:: @ 82FBF78 + spr_template 0x0005, 0x0005, gUnknown_082FBED0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082FBF90:: @ 82FBF90 + spr_template 0x0006, 0x0005, gUnknown_082FBED8, gUnknown_082FBF60, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082FBFA8:: @ 82FBFA8 + spr_template 0x0007, 0x0005, gUnknown_082FBEE0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082FBFC0:: @ 82FBFC0 + spr_template 0x0008, 0x0005, gUnknown_082FBEE0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082FBFD8:: @ 82FBFD8 + .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x04, 0x00, 0x00 + + .align 2 +gUnknown_082FBFE0:: @ 82FBFE0 + .2byte 0x0000, 0x0000 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FBFE8:: @ 82FBFE8 + .2byte 0x0000, 0x0004 + .2byte 0x0004, 0x0004 + .2byte 0x0008, 0x0004 + .2byte 0x000c, 0x0004 + .2byte 0xfffd, 0x0001 + .2byte 0x0000, 0x0004 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FC004:: @ 82FC004 + .4byte gUnknown_082FBFE0 + .4byte gUnknown_082FBFE8 + + .align 2 +gUnknown_082FC00C:: @ 82FC00C + spr_template 0x000a, 0x0005, gUnknown_082FBFD8, gUnknown_082FC004, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gPkmnJumpPal3:: @ 82FC024 + .incbin "graphics/interface/pkmnjump_pal3.gbapal" + + .align 2 +gPkmnJumpBgPal:: @ 82FC044 + .incbin "graphics/interface/pkmnjump_bg.gbapal" + + .align 2 +gPkmnJumpBgGfx:: @ 82FC064 + .incbin "graphics/interface/pkmnjump_bg.4bpp.lz" + + .align 2 +gPkmnJumpBgTilemap:: @ 82FC290 + .incbin "graphics/interface/pkmnjump_bg.bin.lz" + + .align 2 +gPkmnJumpVenusaurPal:: @ 82FC440 + .incbin "graphics/interface/pkmnjump_venusaur.gbapal" + + .align 2 +gPkmnJumpVenusaurGfx:: @ 82FC460 + .incbin "graphics/interface/pkmnjump_venusaur.4bpp.lz" + + .align 2 +gPkmnJumpVenusaurTilemap:: @ 82FCDB0 + .incbin "graphics/interface/pkmnjump_venusaur.bin.lz" + + .align 2 +gPkmnJumpResultsPal:: @ 82FD168 + .incbin "graphics/interface/pkmnjump_results.gbapal" + + .align 2 +gPkmnJumpResultsGfx:: @ 82FD188 + .incbin "graphics/interface/pkmnjump_results.4bpp.lz" + + .align 2 +gPkmnJumpResultsTilemap:: @ 82FDC38 + .incbin "graphics/interface/pkmnjump_results.bin.lz" + + .align 2 +gUnknown_082FE164:: @ 82FE164 struct BgTemplate + .4byte 0x000001b0, 0x000025e6, 0x000016c9, 0x000031df + + .align 2 +gUnknown_082FE174:: @ 82FE174 + window_template 0x00, 0x13, 0x00, 0x06, 0x02, 0x02, 0x0013 + window_template 0x00, 0x08, 0x00, 0x06, 0x02, 0x02, 0x001f + window_template_terminator + + .align 2 +gUnknown_082FE18C:: @ 82FE18C + .4byte 0x00000000, sub_802D150 + .4byte 0x00000001, sub_802D2E4 + .4byte 0x00000002, sub_802D350 + .4byte 0x00000003, sub_802D3BC + .4byte 0x00000004, sub_802D448 + .4byte 0x00000005, sub_802D4F4 + .4byte 0x00000006, sub_802D598 + .4byte 0x00000007, sub_802D5E4 + .4byte 0x00000009, sub_802D72C + .4byte 0x00000008, sub_802D688 + + .align 2 +gUnknown_082FE1DC:: @ 82FE1DC + .byte 0x00, 0x02, 0x03 + +gUnknown_082FE1DF:: @ 82FE1DF + .byte 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00 + .byte 0x00, 0x02, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082FE1EC:: @ 82FE1EC + obj_tiles gUnknown_082FF1F8, 0x0000, 0x0320 + + .align 2 +gUnknown_082FE1F4:: @ 82FE1F4 + obj_pal gUnknown_082FF1D8, 0x0320 + + .align 2 +gUnknown_082FE1FC:: @ 82FE1FC + .2byte 0x0006, 0x0008, 0x0010, 0x0008 + + .align 2 +gUnknown_082FE204:: @ 82FE204 + .2byte 0x0006, 0x0008, 0x000b, 0x0006, 0x0010, 0x0008 + + .align 2 +gUnknown_082FE210:: @ 82FE210 + .2byte 0x0002, 0x0006, 0x0006, 0x0008, 0x0010, 0x0008, 0x0014, 0x0006 + + .align 2 +gUnknown_082FE220:: @ 82FE220 + .2byte 0x0002, 0x0006, 0x0006, 0x0008, 0x000b, 0x0006 + .2byte 0x0010, 0x0008, 0x0014, 0x0006 + + .align 2 +gUnknown_082FE234:: @ 82FE234 + .4byte gUnknown_082FE1FC + .4byte gUnknown_082FE204 + .4byte gUnknown_082FE210 + .4byte gUnknown_082FE220 + + .align 2 +gUnknown_082FE244:: @ 82FE244 + .2byte 0x0058, 0x0098 + +gUnknown_082FE248:: @ 82FE248 + .2byte 0x0058, 0x0078, 0x0098 + +gUnknown_082FE24E:: @ 82FE24E + .2byte 0x0038, 0x0058, 0x0098, 0x00b8 + +gUnknown_082FE256:: @ 82FE256 + .2byte 0x0038, 0x0058, 0x0078, 0x0098, 0x00b8 + + .align 2 +gUnknown_082FE260:: @ 82FE260 + .4byte gUnknown_082FE244 + .4byte gUnknown_082FE248 + .4byte gUnknown_082FE24E + .4byte gUnknown_082FE256 + + .align 2 +gUnknown_082FE270:: @ 82FE270 + .4byte 0x1c010100, 0x00010f09 + + .align 2 +gUnknown_082FE278:: @ 82FE278 + .4byte gText_JumpsInARow + .4byte gText_BestScore2 + .4byte gText_ExcellentsInARow + + .align 2 +gPkmnJump321StartPal1:: @ 82FE284 + .incbin "graphics/interface/pkmnjump_321start1.gbapal" + + .align 2 +gPkmnJump321StartGfx1:: @ 82FE2A4 + .incbin "graphics/interface/pkmnjump_321start1.4bpp.lz" + + .align 2 +gUnknown_082FE6C8:: @ 82FE6C8 + obj_tiles gPkmnJump321StartGfx1, 0x0c00, 0x2000 + null_obj_tiles + + .align 2 +gUnknown_082FE6D8:: @ 82FE6D8 + obj_pal gPkmnJump321StartPal1, 0x2000 + null_obj_pal + + .align 2 +gUnknown_082FE6E8:: @ 82FE6E8 + .2byte 0x0000, 0x0000 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FE6F0:: @ 82FE6F0 + .2byte 0x0010, 0x0000 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FE6F8:: @ 82FE6F8 + .2byte 0x0020, 0x0000 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FE700:: @ 82FE700 + .2byte 0x0040, 0x0000 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FE708:: @ 82FE708 + .2byte 0x0030, 0x0000 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FE710:: @ 82FE710 + .2byte 0x0050, 0x0000 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FE718:: @ 82FE718 + .4byte gUnknown_082FE6E8 + .4byte gUnknown_082FE6F0 + .4byte gUnknown_082FE6F8 + .4byte gUnknown_082FE700 + .4byte gUnknown_082FE708 + .4byte gUnknown_082FE710 + + .align 2 +gUnknown_082FE730:: @ 82FE730 + spr_template 0x2000, 0x2000, gUnknown_08524914, gUnknown_082FE718, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + + .align 2 +gUnknown_082FE748:: @ 82FE748 + .4byte sub_802E83C + .4byte sub_802E8C8 + .4byte sub_802EA50 + .4byte sub_802EAB0 + + .align 2 +gPkmnJump321StartPal2:: @ 82FE758 + .incbin "graphics/interface/pkmnjump_321start2.gbapal" + + .align 2 +gPkmnJump321StartGfx2:: @ 82FE778 + .incbin "graphics/interface/pkmnjump_321start2.4bpp.lz" + + .align 2 +gUnknown_082FEBCC:: @ 82FEBCC + obj_tiles gPkmnJump321StartGfx2, 0x0e00, 0x0000 + + .align 2 +gUnknown_082FEBD4:: @ 82FEBD4 + obj_pal gPkmnJump321StartPal2, 0x0000 + + .align 2 +gUnknown_082FEBDC:: @ 82FEBDC + .byte 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082FEBE4:: @ 82FEBE4 + .byte 0x00, 0x40, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_082FEBEC:: @ 82FEBEC + .2byte 0x0000, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FEBF4:: @ 82FEBF4 + .2byte 0x0010, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FEBFC:: @ 82FEBFC + .2byte 0x0020, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FEC04:: @ 82FEC04 + .4byte gUnknown_082FEBEC + .4byte gUnknown_082FEBF4 + .4byte gUnknown_082FEBFC + + .align 2 +gUnknown_082FEC10:: @ 82FEC10 + .2byte 0x0030, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FEC18:: @ 82FEC18 + .2byte 0x0050, 0x0001 + .2byte 0xffff, 0x0000 + + .align 2 +gUnknown_082FEC20:: @ 82FEC20 + .4byte gUnknown_082FEC10 + .4byte gUnknown_082FEC18 + + .align 2 +gUnknown_082FEC28:: @ 82FEC28 + .2byte 0x0100, 0x0100 + .2byte 0x0000, 0x0000 + .2byte 0x7fff, 0x0000 + .2byte 0x0000, 0x0000 + + .align 2 +gUnknown_082FEC38:: @ 82FEC38 + .2byte 0x0100, 0x0100 + .2byte 0x0000, 0x0000 + .2byte 0x0010, 0xfff0 + .2byte 0x0800, 0x0000 + .2byte 0x7fff, 0x0000 + .2byte 0x0000, 0x0000 + + .align 2 +gUnknown_082FEC50:: @ 82FEC50 + .2byte 0xffee, 0x0012 + .2byte 0x0800, 0x0000 + .2byte 0x7fff, 0x0000 + .2byte 0x0000, 0x0000 + + .align 2 +gUnknown_082FEC60:: @ 82FEC60 + .2byte 0x0006, 0xfffa + .2byte 0x0800, 0x0000 + .2byte 0xfffc, 0x0004 + .2byte 0x0800, 0x0000 + .2byte 0x0100, 0x0100 + .2byte 0x0000, 0x0000 + .2byte 0x7fff, 0x0000 + .2byte 0x0000, 0x0000 + + .align 2 +gUnknown_082FEC80:: @ 82FEC80 + .4byte gUnknown_082FEC28 + .4byte gUnknown_082FEC38 + .4byte gUnknown_082FEC50 + .4byte gUnknown_082FEC60 + +gUnknown_082FEC90:: @ 82FEC90 + spr_template 0x0000, 0x0000, gUnknown_082FEBDC, gUnknown_082FEC04, NULL, gUnknown_082FEC80, SpriteCallbackDummy + +gUnknown_082FECA8:: @ 82FECA8 + spr_template 0x0000, 0x0000, gUnknown_082FEBE4, gUnknown_082FEC20, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + diff --git a/include/link.h b/include/link.h index b48b248f0..9c9793249 100644 --- a/include/link.h +++ b/include/link.h @@ -197,6 +197,7 @@ void sub_800AC34(void); void sub_800B628(void); void sub_80097E8(void); void sub_800A994(u32 seed, u8 flags); +void sub_800A418(void); extern u16 gUnknown_03003020[6]; extern u32 gUnknown_0300302C; diff --git a/ld_script.txt b/ld_script.txt index 34b9a7722..6308d5917 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -53,6 +53,8 @@ SECTIONS { src/string_util.o(.text); src/link.o(.text); asm/link.o(.text); + asm/link_rfu.o(.text); + asm/rom_8011DC0.o(.text); src/rtc.o(.text); asm/main_menu.o(.text); src/battle_controllers.o(.text); @@ -330,6 +332,8 @@ SECTIONS { src/string_util.o(.rodata); src/link.o(.rodata); data/link.o(.rodata); + data/link_rfu.o(.rodata); + data/rom_8011DC0.o(.rodata); src/rtc.o(.rodata); data/main_menu.o(.rodata); data/battle_1.o(.rodata); diff --git a/src/link.c b/src/link.c index 13efb9504..16208652e 100644 --- a/src/link.c +++ b/src/link.c @@ -122,7 +122,6 @@ bool32 sub_800A2F4(const void *src, size_t size); static void sub_800A364(void); static void sub_800A388(void); static void sub_800A3EC(void); -void sub_800A418(void); void task00_link_test(u8 taskId); void sub_800A588(u8 who); u16 sub_800A648(u16 *src, u16 size); @@ -135,11 +134,14 @@ void sub_800B4A4(void); void sub_800B524(struct LinkPlayer *linkPlayer); void sub_800B53C(void); void sub_800B594(void); + +// rfu u32 sub_800BEC0(void); void sub_800E700(void); void sub_800EDD4(void); bool32 sub_800F7E4(void); void sub_800F804(void); +void sub_800F850(void); void Rfu_set_zero(void); u8 sub_80104F4(void); @@ -967,3 +969,16 @@ void sub_800A3F8(void) sub_8009D90(0x4444); gUnknown_020223C0 ++; } + +void sub_800A418(void) +{ + gUnknown_020223C0 = 0; + if (gLinkVSyncDisabled) + { + sub_800F850(); + } + else + { + gUnknown_03003140 = sub_800A3F8; + } +} From b92d85fd301c1492b8f03be8a98e61f94eb3171d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 20:55:03 -0500 Subject: [PATCH 021/123] Decompile link data --- data/link.s | 23 ----------------------- ld_script.txt | 1 - src/link.c | 26 +++++++++++++++++++++++++- 3 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 data/link.s diff --git a/data/link.s b/data/link.s deleted file mode 100644 index b5ff999b8..000000000 --- a/data/link.s +++ /dev/null @@ -1,23 +0,0 @@ -@ the second big chunk of data - - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 - -gUnknown_082ED1FC:: @ 82ED1FC BgTemplate - .4byte 0x000001F8 - .4byte 0x00001081 - - .align 2 -gUnknown_082ED204:: @ 82ED204 - window_template 0x00, 0x00, 0x00, 0x1E, 0x05, 0x0F, 0x0002 - window_template 0x00, 0x00, 0x06, 0x1E, 0x07, 0x0F, 0x0098 - window_template 0x00, 0x00, 0x0D, 0x1E, 0x07, 0x0F, 0x016A - window_template_terminator - - .align 2 -gUnknown_082ED224:: @ 82ED224 - .byte 0x00, 0x01, 0x02, 0x00, 0xff, 0xfe, 0xff, 0x00 diff --git a/ld_script.txt b/ld_script.txt index 6308d5917..ee24d7903 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -331,7 +331,6 @@ SECTIONS { data/io_reg.o(.rodata); src/string_util.o(.rodata); src/link.o(.rodata); - data/link.o(.rodata); data/link_rfu.o(.rodata); data/rom_8011DC0.o(.rodata); src/rtc.o(.rodata); diff --git a/src/link.c b/src/link.c index 16208652e..d9d5a48dd 100644 --- a/src/link.c +++ b/src/link.c @@ -3,6 +3,8 @@ #include "global.h" #include "malloc.h" #include "save.h" +#include "bg.h" +#include "window.h" #include "librfu.h" #include "rng.h" #include "decompress.h" @@ -169,7 +171,29 @@ const u8 gUnknown_082ED1D0[] = { }; const char gASCIIGameFreakInc[] = "GameFreak inc."; const char gASCIITestPrint[] = "TEST PRINT\nP0\nP1\nP2\nP3"; - +const struct BgTemplate gUnknown_082ED1FC[] = { + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 31, + .priority = 0 + }, { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 8, + .priority = 1 + } +}; +const struct WindowTemplate gUnknown_082ED204[] = { + {0x00, 0x00, 0x00, 0x1E, 0x05, 0x0F, 0x0002}, + {0x00, 0x00, 0x06, 0x1E, 0x07, 0x0F, 0x0098}, + {0x00, 0x00, 0x0D, 0x1E, 0x07, 0x0F, 0x016A}, + DUMMY_WIN_TEMPLATE +}; +const u8 gUnknown_082ED224[] = { + 0x00, 0x01, 0x02, 0x00, + 0xff, 0xfe, 0xff, 0x00 +}; // .text From 27c0dc0fd59f4e71f09313613a1a03bd48e6209d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 22:08:17 -0500 Subject: [PATCH 022/123] through sub_800A588 --- asm/battle_tower.s | 4 +- asm/berry_blender.s | 14 +- asm/cable_club.s | 12 +- asm/contest_link_80FC4F4.s | 2 +- asm/link.s | 229 +++------------------------------ asm/link_rfu.s | 4 +- asm/record_mixing.s | 6 +- asm/rom4.s | 18 +-- asm/rom6.s | 2 +- asm/rom_8011DC0.s | 2 +- asm/start_menu.s | 2 +- asm/trade.s | 28 ++-- asm/trainer_card.s | 2 +- include/link.h | 9 +- include/link_rfu.h | 24 ++++ src/battle_2.c | 25 ++-- src/battle_controller_player.c | 4 +- src/battle_controllers.c | 4 +- src/evolution_scene.c | 4 +- src/link.c | 119 +++++++++++++---- src/main.c | 2 +- src/reshow_battle_screen.c | 2 +- sym_common.txt | 2 +- 23 files changed, 207 insertions(+), 313 deletions(-) create mode 100644 include/link_rfu.h diff --git a/asm/battle_tower.s b/asm/battle_tower.s index 122d9d27c..c21a706f4 100755 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -5264,7 +5264,7 @@ _08164D14: ldrb r0, [r0] cmp r0, 0 beq _08164DB0 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _08164DB0 @@ -5302,7 +5302,7 @@ _08164DB6: thumb_func_start sub_8164DCC sub_8164DCC: @ 8164DCC push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08164DDA diff --git a/asm/berry_blender.s b/asm/berry_blender.s index 6d18ab7cb..fc7e747b9 100644 --- a/asm/berry_blender.s +++ b/asm/berry_blender.s @@ -516,7 +516,7 @@ _0807FBBE: ldrb r0, [r0] cmp r0, 0 beq _0807FC14 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _0807FC14 @@ -1122,7 +1122,7 @@ _08080126: bne _0808016A b _080804F8 _0808016A: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _08080174 @@ -3334,7 +3334,7 @@ sub_80814B0: @ 80814B0 ldrb r0, [r0] cmp r0, 0 beq _080814E4 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080814E4 @@ -4706,7 +4706,7 @@ sub_8081F94: @ 8081F94 ldrb r0, [r0] cmp r0, 0 beq _08081FB8 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08081FB8 @@ -4852,7 +4852,7 @@ _080820EC: ldrb r0, [r0] cmp r0, 0 beq _0808218C - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _0808218C @@ -4968,7 +4968,7 @@ _080821D4: ldrb r0, [r0] cmp r0, 0 beq _08082254 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08082254 @@ -6250,7 +6250,7 @@ sub_8082D28: @ 8082D28 lsls r0, 24 lsrs r1, r0, 24 _08082D3C: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08082DCC diff --git a/asm/cable_club.s b/asm/cable_club.s index 15ba76e9c..254272c4d 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -2172,7 +2172,7 @@ sub_80B360C: @ 80B360C movs r5, 0x1 eors r0, r5 bl sub_813C2A0 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080B36B2 @@ -2512,7 +2512,7 @@ _080B391C: thumb_func_start sub_80B3924 sub_80B3924: @ 80B3924 push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080B3940 @@ -2552,7 +2552,7 @@ sub_80B3968: @ 80B3968 ldr r2, =0x00002211 adds r0, r2, 0 strh r0, [r1] - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080B3994 @@ -2661,7 +2661,7 @@ _080B3A62: ldrb r0, [r0] cmp r0, 0 beq _080B3AA6 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _080B3AA0 @@ -2752,7 +2752,7 @@ _080B3B20: beq _080B3B9E b _080B3BB8 _080B3B2A: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080B3B40 @@ -2825,7 +2825,7 @@ _080B3BB8: thumb_func_start sub_80B3BC4 sub_80B3BC4: @ 80B3BC4 push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _080B3BD6 diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s index f1e2019da..953f69479 100644 --- a/asm/contest_link_80FC4F4.s +++ b/asm/contest_link_80FC4F4.s @@ -147,7 +147,7 @@ sub_80FC5DC: @ 80FC5DC ldr r1, =gUnknown_02039F2A movs r0, 0x1 strb r0, [r1] - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x1 bne _080FC60C diff --git a/asm/link.s b/asm/link.s index 0f1c1cb68..5e5349f63 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,207 +5,10 @@ .text - thumb_func_start sub_800A44C -sub_800A44C: @ 800A44C - ldr r0, =gUnknown_020223C0 - ldr r0, [r0] - bx lr - .pool - thumb_func_end sub_800A44C - - thumb_func_start sub_800A458 -sub_800A458: @ 800A458 - push {lr} - ldr r0, =0x0000aaaa - bl sub_8009D90 - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A458 - - thumb_func_start GetMultiplayerId -GetMultiplayerId: @ 800A468 - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0x1 - beq _0800A484 - ldr r0, =0x04000128 - ldr r0, [r0] - lsls r0, 26 - lsrs r0, 30 - b _0800A48C - .pool -_0800A484: - bl rfu_get_multiplayer_id - lsls r0, 24 - lsrs r0, 24 -_0800A48C: - pop {r1} - bx r1 - thumb_func_end GetMultiplayerId - - thumb_func_start bitmask_all_link_players_but_self -bitmask_all_link_players_but_self: @ 800A490 - push {lr} - bl GetMultiplayerId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - lsls r0, r1 - movs r1, 0xF - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end bitmask_all_link_players_but_self - - thumb_func_start SendBlock -SendBlock: @ 800A4AC - push {lr} - adds r3, r1, 0 - lsls r2, 16 - lsrs r1, r2, 16 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0x1 - beq _0800A4C8 - adds r0, r3, 0 - bl sub_800A2F4 - b _0800A4CE - .pool -_0800A4C8: - adds r0, r3, 0 - bl sub_800FE84 -_0800A4CE: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end SendBlock - - thumb_func_start sub_800A4D8 -sub_800A4D8: @ 800A4D8 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - adds r2, r1, 0 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800A4F8 - adds r0, r1, 0 - bl sub_8010100 - lsls r0, 24 - lsrs r0, 24 - b _0800A514 - .pool -_0800A4F8: - ldr r0, =gUnknown_03003140 - ldr r0, [r0] - cmp r0, 0 - beq _0800A508 - movs r0, 0 - b _0800A514 - .pool -_0800A508: - ldr r0, =gUnknown_03003150 - strb r2, [r0] - ldr r0, =0x0000cccc - bl sub_8009D90 - movs r0, 0x1 -_0800A514: - pop {r1} - bx r1 - .pool - thumb_func_end sub_800A4D8 - - thumb_func_start sub_800A520 -sub_800A520: @ 800A520 - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800A538 - bl sub_8010500 - lsls r0, 24 - lsrs r0, 24 - b _0800A546 - .pool -_0800A538: - movs r1, 0 - ldr r0, =gUnknown_03003140 - ldr r0, [r0] - cmp r0, 0 - bne _0800A544 - movs r1, 0x1 -_0800A544: - adds r0, r1, 0 -_0800A546: - pop {r1} - bx r1 - .pool - thumb_func_end sub_800A520 - - thumb_func_start GetBlockReceivedStatus -GetBlockReceivedStatus: @ 800A550 - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0x1 - beq _0800A57C - ldr r2, =gUnknown_0300307C - ldrb r0, [r2, 0x3] - lsls r0, 3 - ldrb r1, [r2, 0x2] - lsls r1, 2 - orrs r0, r1 - ldrb r1, [r2, 0x1] - lsls r1, 1 - orrs r0, r1 - ldrb r1, [r2] - orrs r0, r1 - b _0800A580 - .pool -_0800A57C: - bl sub_800FCD8 -_0800A580: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end GetBlockReceivedStatus - - thumb_func_start sub_800A588 -sub_800A588: @ 800A588 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800A5A4 - adds r0, r1, 0 - bl sub_800F6FC - b _0800A5AC - .pool -_0800A5A4: - ldr r0, =gUnknown_0300307C - adds r0, r1, r0 - movs r1, 0x1 - strb r1, [r0] -_0800A5AC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A588 - thumb_func_start ResetBlockReceivedFlags ResetBlockReceivedFlags: @ 800A5B4 push {r4,lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x1 bne _0800A5D4 @@ -240,7 +43,7 @@ ResetBlockReceivedFlag: @ 800A5EC push {lr} lsls r0, 24 lsrs r1, r0, 24 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x1 bne _0800A608 @@ -986,7 +789,7 @@ sub_800ABAC: @ 800ABAC thumb_func_start sub_800ABBC sub_800ABBC: @ 800ABBC push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _0800ABDC @@ -1019,7 +822,7 @@ sub_800ABF4: @ 800ABF4 push {lr} lsls r0, 16 lsrs r3, r0, 16 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x1 bne _0800AC0C @@ -1046,7 +849,7 @@ _0800AC20: thumb_func_start sub_800AC34 sub_800AC34: @ 800AC34 push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x1 bne _0800AC48 @@ -1144,7 +947,7 @@ _0800ACF4: thumb_func_start sub_800AD10 sub_800AD10: @ 800AD10 push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x1 bne _0800AD24 @@ -1248,7 +1051,7 @@ _0800ADDA: thumb_func_start sub_800ADF8 sub_800ADF8: @ 800ADF8 push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x1 bne _0800AE0C @@ -1415,7 +1218,7 @@ c2_800ACD4: @ 800AF30 bl FillPalette bl ResetTasks bl remove_some_task - ldr r1, =gLinkVSyncDisabled + ldr r1, =gSerialIsRFU ldrb r0, [r1] cmp r0, 0 beq _0800AF8C @@ -1669,7 +1472,7 @@ _0800B20C: bl PlaySE b _0800B260 _0800B214: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x2 bne _0800B244 @@ -1708,7 +1511,7 @@ _0800B260: ldrb r1, [r1] cmp r1, 0xA0 bne _0800B2D0 - ldr r4, =gLinkVSyncDisabled + ldr r4, =gSerialIsRFU ldrb r2, [r4] cmp r2, 0x1 bne _0800B2A8 @@ -1910,7 +1713,7 @@ _0800B3F4: thumb_func_start HandleLinkConnection HandleLinkConnection: @ 800B40C push {r4,r5,lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _0800B45C @@ -1965,7 +1768,7 @@ sub_800B488: @ 800B488 ldrb r0, [r0] cmp r0, 0 bne _0800B498 - ldr r1, =gLinkVSyncDisabled + ldr r1, =gSerialIsRFU movs r0, 0x1 strb r0, [r1] _0800B498: @@ -1981,7 +1784,7 @@ sub_800B4A4: @ 800B4A4 ldrb r1, [r0] cmp r1, 0 bne _0800B4B2 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU strb r1, [r0] _0800B4B2: pop {r0} @@ -1996,7 +1799,7 @@ sub_800B4C0: @ 800B4C0 ldrb r1, [r0] cmp r1, 0 bne _0800B4CE - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU strb r1, [r0] _0800B4CE: pop {r0} @@ -2007,7 +1810,7 @@ _0800B4CE: thumb_func_start sub_800B4DC sub_800B4DC: @ 800B4DC push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _0800B4FC @@ -2041,7 +1844,7 @@ _0800B514: thumb_func_start sub_800B518 sub_800B518: @ 800B518 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] bx lr .pool diff --git a/asm/link_rfu.s b/asm/link_rfu.s index d5d22a8db..a2b90dc7a 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -4737,7 +4737,7 @@ sub_800E3A8: @ 800E3A8 mov r5, r8 push {r5-r7} sub sp, 0x20 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _0800E3BE @@ -9820,7 +9820,7 @@ sub_8010DB4: @ 8010DB4 cmp r0, 0 beq _08010DE4 _08010DDE: - ldr r1, =gLinkVSyncDisabled + ldr r1, =gSerialIsRFU movs r0, 0x2 strb r0, [r1] _08010DE4: diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 7e9ea30d1..8a1f41126 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -621,7 +621,7 @@ _080E726C: bne _080E730A movs r0, 0x4 strh r0, [r5] - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _080E7296 @@ -664,7 +664,7 @@ _080E72C0: ldr r0, [r0] bl Free bl sub_808729C - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080E72F8 @@ -2393,7 +2393,7 @@ _080E80C0: lsls r0, 24 cmp r0, 0 bne _080E810A - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080E80E8 diff --git a/asm/rom4.s b/asm/rom4.s index fdb8d7a60..a7e98d013 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -3395,7 +3395,7 @@ c2_8056854: @ 8086140 ldr r0, =c1_link_related bl set_callback1 bl sub_8086C2C - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08086174 @@ -3586,7 +3586,7 @@ sub_808631C: @ 808631C bne _0808632E bl sub_80097E8 _0808632E: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08086348 @@ -3768,7 +3768,7 @@ _080864DA: bl cur_mapheader_run_tileset_funcs_after_some_cpuset b _08086506 _080864E0: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08086506 @@ -4056,7 +4056,7 @@ _08086766: bl cur_mapheader_run_tileset_funcs_after_some_cpuset b _08086792 _0808676C: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08086792 @@ -4565,7 +4565,7 @@ _08086BCA: thumb_func_start c1_link_related c1_link_related: @ 8086BD8 push {r4,lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08086BF2 @@ -4631,7 +4631,7 @@ c1_link_related_func_set: @ 8086C50 thumb_func_start sub_8086C64 sub_8086C64: @ 8086C64 push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08086C82 @@ -5029,7 +5029,7 @@ _08086FC0: movs r0, 0x11 strh r0, [r1] _08086FC6: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08086FFC @@ -5926,7 +5926,7 @@ _08087666: thumb_func_start sub_808766C sub_808766C: @ 808766C push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _08087688 @@ -5946,7 +5946,7 @@ _0808768A: thumb_func_start sub_8087690 sub_8087690: @ 8087690 push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _080876B0 diff --git a/asm/rom6.s b/asm/rom6.s index 87b780ba5..20058db9d 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -11823,7 +11823,7 @@ _0813B790: b _0813B7C6 .pool _0813B7A8: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _0813B7B4 diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 8185238bd..fc70f498a 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -28592,7 +28592,7 @@ sub_8020C70: @ 8020C70 ldrb r0, [r0] cmp r0, 0 beq _08020C8E - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _08020CAC diff --git a/asm/start_menu.s b/asm/start_menu.s index 3c8c4c3cf..0da38ba4b 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -1712,7 +1712,7 @@ _080A05AC: movs r2, 0x10 movs r3, 0 bl BeginNormalPaletteFade - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080A0620 diff --git a/asm/trade.s b/asm/trade.s index ebb624d90..61a814421 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -135,7 +135,7 @@ _08077258: thumb_func_start sub_8077260 sub_8077260: @ 8077260 push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08077280 @@ -409,7 +409,7 @@ _080774B2: ldr r0, [r0] adds r0, 0xA8 strb r2, [r0] - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08077528 @@ -531,7 +531,7 @@ _08077600: ldr r0, [r0] adds r0, 0xA8 strb r2, [r0] - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 bne _0807762A @@ -543,7 +543,7 @@ _0807762A: b _08077B46 .pool _08077648: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08077680 @@ -1182,7 +1182,7 @@ _08077C28: b _080780D8 .pool _08077C3C: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08077C50 @@ -1780,7 +1780,7 @@ sub_807816C: @ 807816C adds r0, 0x7E ldrb r0, [r0] strb r0, [r1, 0x1] - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080781B4 @@ -1809,7 +1809,7 @@ sub_80781C8: @ 80781C8 ldr r5, =gMain ldr r0, =sub_80773AC str r0, [r5, 0x8] - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08078220 @@ -4004,7 +4004,7 @@ sub_8079490: @ 8079490 ands r0, r1 cmp r0, 0 bne _080794C4 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _080794B4 @@ -4029,7 +4029,7 @@ _080794C4: thumb_func_start sub_80794CC sub_80794CC: @ 80794CC push {lr} - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _08079518 @@ -7507,7 +7507,7 @@ _0807B0F0: ands r0, r1 cmp r0, 0 bne _0807B116 - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _0807B110 @@ -13831,7 +13831,7 @@ _0807EDC0: movs r0, 0x15 bl IncrementGameStat _0807EDCE: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _0807EDF6 @@ -14044,7 +14044,7 @@ _0807EFA4: lsrs r0, 24 cmp r0, 0x1 bne _0807F03A - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _0807EFD8 @@ -14071,7 +14071,7 @@ _0807EFE4: b _0807F03A .pool _0807EFF0: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _0807F028 @@ -14141,7 +14141,7 @@ c2_080543C4: @ 807F068 ldr r0, [r4] bl Free str r5, [r4] - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0 beq _0807F0B6 diff --git a/asm/trainer_card.s b/asm/trainer_card.s index bee1f4f7f..4f1183477 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -187,7 +187,7 @@ _080C2830: bl sub_80C4630 b _080C28D4 _080C2836: - ldr r0, =gLinkVSyncDisabled + ldr r0, =gSerialIsRFU ldrb r0, [r0] cmp r0, 0x1 bne _080C2852 diff --git a/include/link.h b/include/link.h index 9c9793249..8ec0431aa 100644 --- a/include/link.h +++ b/include/link.h @@ -29,6 +29,8 @@ #define MASTER_HANDSHAKE 0x8FFF #define SLAVE_HANDSHAKE 0xB9A0 +#define SIO_MULTI_CNT ((volatile struct SioMultiCnt *)REG_ADDR_SIOCNT) + enum { LINK_STATE_START0, @@ -142,7 +144,7 @@ extern u8 gShouldAdvanceLinkState; extern struct LinkPlayer gLinkPlayers[]; extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; -extern bool8 gLinkVSyncDisabled; +extern bool8 gSerialIsRFU; void Task_DestroySelf(u8); void OpenLink(void); @@ -162,7 +164,7 @@ void sub_8007E24(void); void sub_8007E4C(void); u8 GetMultiplayerId(void); u8 bitmask_all_link_players_but_self(void); -bool8 SendBlock(u8, void *, u16); +bool8 SendBlock(u8, const void *, u16); u8 GetBlockReceivedStatus(void); void ResetBlockReceivedFlags(void); void ResetBlockReceivedFlag(u8); @@ -183,7 +185,6 @@ u8 GetLinkPlayerCount(void); void sub_800E0E8(void); bool8 sub_800A520(void); -bool8 sub_8010500(void); void sub_800DFB4(u8, u8); void sub_800ADF8(void); void sub_800B488(void); @@ -215,7 +216,7 @@ extern u8 gUnknown_030030EC[4]; extern u8 gUnknown_030030F0[4]; extern u16 gUnknown_030030F4; extern u8 gUnknown_030030F8; -extern bool8 gLinkVSyncDisabled; +extern bool8 gSerialIsRFU; extern bool8 gUnknown_03003100; extern u16 gUnknown_03003110[8]; extern u8 gUnknown_03003120; diff --git a/include/link_rfu.h b/include/link_rfu.h new file mode 100644 index 000000000..ff71c65aa --- /dev/null +++ b/include/link_rfu.h @@ -0,0 +1,24 @@ +#ifndef GUARD_LINK_RFU_H +#define GUARD_LINK_RFU_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations +u32 sub_800BEC0(void); +void sub_800E700(void); +void sub_800EDD4(void); +bool32 sub_800F7E4(void); +void sub_800F804(void); +void sub_800F850(void); +void Rfu_set_zero(void); +u8 sub_80104F4(void); +u8 rfu_get_multiplayer_id(void); +bool32 sub_800FE84(const void *src, size_t size); +bool8 sub_8010100(u8 a0); +bool8 sub_8010500(void); +u8 sub_800FCD8(void); +void sub_800F6FC(u8 who); + +#endif //GUARD_LINK_RFU_H diff --git a/src/battle_2.c b/src/battle_2.c index 24b43bdbd..a69a16dac 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -17,6 +17,7 @@ #include "items.h" #include "hold_effects.h" #include "link.h" +#include "link_rfu.h" #include "bg.h" #include "dma3.h" #include "string_util.h" @@ -734,7 +735,7 @@ static void CB2_HandleStartBattle(void) sub_805EF14(); gBattleCommunication[MULTIUSE_STATE] = 1; } - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800E0E8(); break; case 1: @@ -758,7 +759,7 @@ static void CB2_HandleStartBattle(void) SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); gBattleCommunication[MULTIUSE_STATE] = 2; } - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800DFB4(0, 0); } } @@ -929,7 +930,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) sub_805EF14(); gBattleCommunication[MULTIUSE_STATE] = 1; } - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800E0E8(); // fall through case 1: @@ -960,7 +961,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) gBattleCommunication[MULTIUSE_STATE] = 2; } - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800DFB4(0, 0); } } @@ -1237,14 +1238,14 @@ static void CB2_PreInitMultiBattle(void) if (sub_800A520() && !gPaletteFade.active) { gBattleCommunication[MULTIUSE_STATE]++; - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800ADF8(); else sub_800AC34(); } break; case 3: - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { if (sub_8010500()) { @@ -1329,7 +1330,7 @@ static void CB2_HandleStartMultiBattle(void) sub_805EF14(); gBattleCommunication[MULTIUSE_STATE] = 1; } - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800E0E8(); break; case 1: @@ -1347,7 +1348,7 @@ static void CB2_HandleStartMultiBattle(void) SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); gBattleCommunication[MULTIUSE_STATE]++; } - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800DFB4(0, 0); } } @@ -2132,12 +2133,12 @@ static void sub_8038F34(void) } break; case 8: - if (!gLinkVSyncDisabled) + if (!gSerialIsRFU) sub_800AC34(); gBattleCommunication[MULTIUSE_STATE]++; break; case 9: - if (!gMain.field_439_x4 || gLinkVSyncDisabled || gReceivedRemoteLinkPlayers != 1) + if (!gMain.field_439_x4 || gSerialIsRFU || gReceivedRemoteLinkPlayers != 1) { gMain.field_439_x4 = 0; SetMainCallback2(gMain.savedCallback); @@ -2316,13 +2317,13 @@ static void sub_803939C(void) case 8: if (--gBattleCommunication[1] == 0) { - if (gMain.field_439_x4 && !gLinkVSyncDisabled) + if (gMain.field_439_x4 && !gSerialIsRFU) sub_800AC34(); gBattleCommunication[MULTIUSE_STATE]++; } break; case 9: - if (!gMain.field_439_x4 || gLinkVSyncDisabled || gReceivedRemoteLinkPlayers != 1) + if (!gMain.field_439_x4 || gSerialIsRFU || gReceivedRemoteLinkPlayers != 1) { gMain.field_439_x4 = 0; if (!gPaletteFade.active) diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 10d361cb9..2a882de99 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -896,7 +896,7 @@ static void HandleMoveSwitchting(void) static void sub_80586F8(void) { - if (gLinkVSyncDisabled == 0) + if (gSerialIsRFU == 0) { if (gReceivedRemoteLinkPlayers == 0) { @@ -932,7 +932,7 @@ void sub_80587B0(void) { if (sub_800A520()) { - if (gLinkVSyncDisabled == 0) + if (gSerialIsRFU == 0) sub_800AC34(); else sub_800ADF8(); diff --git a/src/battle_controllers.c b/src/battle_controllers.c index d3653d0b3..d741a8a98 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -59,7 +59,7 @@ void HandleLinkBattleSetup(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800B488(); if (!gReceivedRemoteLinkPlayers) sub_8009734(); @@ -780,7 +780,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId) gTasks[taskId].data[11]++; break; case 2: - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { gTasks[taskId].data[11]++; } diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 68731a14a..101feab56 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -405,7 +405,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) } break; case 6: - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { sub_800E0E8(); sub_800DFB4(0, 0); @@ -1188,7 +1188,7 @@ static void Task_TradeEvolutionScene(u8 taskID) case 5: if (!gPaletteFade.active) { - if (gLinkVSyncDisabled) + if (gSerialIsRFU) sub_800E084(); Free(GetBgTilemapBuffer(3)); diff --git a/src/link.c b/src/link.c index d9d5a48dd..68868491b 100644 --- a/src/link.c +++ b/src/link.c @@ -16,6 +16,7 @@ #include "palette.h" #include "task.h" #include "trade.h" +#include "link_rfu.h" #include "link.h" // Static type declarations @@ -37,13 +38,6 @@ struct LinkTestBGInfo u32 dummy_C; }; -struct SIOCnt { - u32 cnt0_0:4; - u32 cnt0_2:2; -}; - -#define REG_SIOCNT_STRUCT (*(volatile struct SIOCnt *)REG_ADDR_SIOCNT) - // Static RAM declarations IWRAM_DATA struct BlockTransfer gUnknown_03000D10; @@ -88,7 +82,7 @@ u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; u16 gUnknown_030030F4; u8 gUnknown_030030F8; -bool8 gLinkVSyncDisabled; +bool8 gSerialIsRFU; bool8 gUnknown_03003100; u16 gUnknown_03003110[8]; u8 gUnknown_03003120; @@ -137,16 +131,6 @@ void sub_800B524(struct LinkPlayer *linkPlayer); void sub_800B53C(void); void sub_800B594(void); -// rfu -u32 sub_800BEC0(void); -void sub_800E700(void); -void sub_800EDD4(void); -bool32 sub_800F7E4(void); -void sub_800F804(void); -void sub_800F850(void); -void Rfu_set_zero(void); -u8 sub_80104F4(void); - // .rodata ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal"); @@ -333,7 +317,7 @@ void sub_8009734(void) { int i; - if (!gLinkVSyncDisabled) + if (!gSerialIsRFU) { sub_800B628(); sub_80096D0(); @@ -365,7 +349,7 @@ void sub_8009734(void) void sub_80097E8(void) { gReceivedRemoteLinkPlayers = FALSE; - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { sub_800EDD4(); } @@ -467,7 +451,7 @@ u16 sub_80099E0(const u16 *src) gUnknown_03003084 = *src; if (gUnknown_030030E0 & 0x40) { - sub_8009AA0(REG_SIOCNT_STRUCT.cnt0_2); + sub_8009AA0(SIO_MULTI_CNT->id); if (gUnknown_03003140 != NULL) { gUnknown_03003140(); @@ -685,7 +669,7 @@ void sub_8009D90(u16 command) void sub_8009F18(void) { - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { sub_800F804(); } @@ -694,7 +678,7 @@ void sub_8009F18(void) bool32 sub_8009F3C(void) { - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { return sub_800F7E4(); } @@ -715,7 +699,7 @@ static void sub_8009F70(void) void sub_8009F8C(void) { - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { Rfu_set_zero(); } @@ -727,7 +711,7 @@ void sub_8009F8C(void) void sub_8009FAC(void) { - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { Rfu_set_zero(); } @@ -739,7 +723,7 @@ void sub_8009FAC(void) u8 GetLinkPlayerCount(void) { - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { return sub_80104F4(); } @@ -997,7 +981,7 @@ void sub_800A3F8(void) void sub_800A418(void) { gUnknown_020223C0 = 0; - if (gLinkVSyncDisabled) + if (gSerialIsRFU) { sub_800F850(); } @@ -1006,3 +990,84 @@ void sub_800A418(void) gUnknown_03003140 = sub_800A3F8; } } + +u32 sub_800A44C(void) +{ + return gUnknown_020223C0; +} + +void sub_800A458(void) +{ + sub_8009D90(0xaaaa); +} + +u8 GetMultiplayerId(void) +{ + if (gSerialIsRFU == TRUE) + { + return rfu_get_multiplayer_id(); + } + return SIO_MULTI_CNT->id; +} + +u8 bitmask_all_link_players_but_self(void) +{ + u8 mpId; + + mpId = GetMultiplayerId(); + return ((1 << MAX_LINK_PLAYERS) - 1) ^ (1 << mpId); +} + +bool8 SendBlock(u8 unused, const void *src, u16 size) +{ + if (gSerialIsRFU == TRUE) + { + return sub_800FE84(src, size); + } + return sub_800A2F4(src, size); +} + +bool8 sub_800A4D8(u8 a0) +{ + if (gSerialIsRFU == TRUE) + { + return sub_8010100(a0); + } + if (gUnknown_03003140 == NULL) + { + gUnknown_03003150 = a0; + sub_8009D90(0xcccc); + return TRUE; + } + return FALSE; +} + +bool8 sub_800A520(void) +{ + if (gSerialIsRFU == TRUE) + { + return sub_8010500(); + } + return gUnknown_03003140 == NULL; +} + +u8 GetBlockReceivedStatus(void) +{ + if (gSerialIsRFU == TRUE) + { + return sub_800FCD8(); + } + return (gUnknown_0300307C[3] << 3) | (gUnknown_0300307C[2] << 2) | (gUnknown_0300307C[1] << 1) | (gUnknown_0300307C[0] << 0); +} + +void sub_800A588(u8 who) +{ + if (gSerialIsRFU == TRUE) + { + sub_800F6FC(who); + } + else + { + gUnknown_0300307C[who] = TRUE; + } +} diff --git a/src/main.c b/src/main.c index b90dc3837..61f6f60a4 100644 --- a/src/main.c +++ b/src/main.c @@ -336,7 +336,7 @@ extern void ProcessDma3Requests(void); static void VBlankIntr(void) { - if (gLinkVSyncDisabled != FALSE) + if (gSerialIsRFU != FALSE) LinkVSync(); else if (gUnknown_03002748 == FALSE) sub_800B9B8(); diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 002f4f069..87ad20ed7 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -177,7 +177,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void) ActionSelectionCreateCursorAt(gActionSelectionCursor[gBankInMenu], 0); - if (gLinkVSyncDisabled != 0 && gReceivedRemoteLinkPlayers != 0) + if (gSerialIsRFU != 0 && gReceivedRemoteLinkPlayers != 0) { sub_800E0E8(); sub_800DFB4(0, 0); diff --git a/sym_common.txt b/sym_common.txt index 7a35ae5bd..e228ed613 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -60,7 +60,7 @@ gUnknown_030030F4: @ 30030F4 gUnknown_030030F8: @ 30030F8 .space 0x4 -gLinkVSyncDisabled: @ 30030FC +gSerialIsRFU: @ 30030FC .space 0x4 gUnknown_03003100: @ 3003100 From efd0651efeeb42eb6e6a68b88ab2f9a93407666b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 22:34:23 -0500 Subject: [PATCH 023/123] through sub_800A678 --- asm/link.s | 142 --------------------------------------------- include/link.h | 15 ++++- include/link_rfu.h | 7 ++- src/link.c | 73 +++++++++++++++++++++-- 4 files changed, 85 insertions(+), 152 deletions(-) diff --git a/asm/link.s b/asm/link.s index 5e5349f63..ba7593695 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,148 +5,6 @@ .text - thumb_func_start ResetBlockReceivedFlags -ResetBlockReceivedFlags: @ 800A5B4 - push {r4,lr} - ldr r0, =gSerialIsRFU - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800A5D4 - movs r4, 0 -_0800A5C0: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_800F728 - adds r4, 0x1 - cmp r4, 0x4 - ble _0800A5C0 - b _0800A5E2 - .pool -_0800A5D4: - ldr r1, =gUnknown_0300307C - movs r2, 0 - adds r0, r1, 0x3 -_0800A5DA: - strb r2, [r0] - subs r0, 0x1 - cmp r0, r1 - bge _0800A5DA -_0800A5E2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ResetBlockReceivedFlags - - thumb_func_start ResetBlockReceivedFlag -ResetBlockReceivedFlag: @ 800A5EC - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gSerialIsRFU - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800A608 - adds r0, r1, 0 - bl sub_800F728 - b _0800A616 - .pool -_0800A608: - ldr r0, =gUnknown_0300307C - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - beq _0800A616 - movs r0, 0 - strb r0, [r1] -_0800A616: - pop {r0} - bx r0 - .pool - thumb_func_end ResetBlockReceivedFlag - - thumb_func_start sub_800A620 -sub_800A620: @ 800A620 - push {lr} - ldr r0, =gUnknown_030030E0 - ldr r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0800A63C - movs r0, 0x1C - ands r1, r0 - cmp r1, 0x4 - bls _0800A63C - ldr r1, =gUnknown_03003144 - movs r0, 0x1 - strb r0, [r1] -_0800A63C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A620 - - thumb_func_start sub_800A648 -sub_800A648: @ 800A648 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 16 - movs r3, 0 - movs r2, 0 - lsrs r1, 17 - cmp r3, r1 - bcs _0800A66E -_0800A658: - lsls r0, r2, 1 - adds r0, r4 - ldrh r0, [r0] - adds r0, r3, r0 - lsls r0, 16 - lsrs r3, r0, 16 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, r1 - bcc _0800A658 -_0800A66E: - adds r0, r3, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_800A648 - - thumb_func_start sub_800A678 -sub_800A678: @ 800A678 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - ldr r4, =gUnknown_03003130 - ldr r3, [r4] - lsls r3, 11 - movs r5, 0xC0 - lsls r5, 19 - adds r3, r5 - lsrs r2, 19 - adds r2, r1 - lsls r2, 1 - adds r2, r3 - ldr r3, [r4, 0x4] - lsls r3, 12 - ldr r1, [r4, 0x8] - adds r1, 0x1 - adds r0, r1 - orrs r3, r0 - strh r3, [r2] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A678 - thumb_func_start sub_800A6B0 sub_800A6B0: @ 800A6B0 push {r4,r5,lr} diff --git a/include/link.h b/include/link.h index 8ec0431aa..09e2789f5 100644 --- a/include/link.h +++ b/include/link.h @@ -2,6 +2,7 @@ #define GUARD_LINK_H #define MAX_LINK_PLAYERS 4 +#define MAX_RFU_PLAYERS 5 #define CMD_LENGTH 8 #define QUEUE_CAPACITY 50 #define BLOCK_BUFFER_SIZE 0x100 @@ -26,6 +27,18 @@ #define EXTRACT_RECEIVED_NOTHING(status) \ (((status) >> LINK_STAT_RECEIVED_NOTHING_SHIFT) & 1) +struct LinkStatus +{ + u32 localId:2; + u32 playerCount:3; + u32 master:1; + u32 connEstablished:1; + u32 unused_7:1; + u32 receivedNothing:1; + u32 unused_9:7; + u32 errors:7; +}; + #define MASTER_HANDSHAKE 0x8FFF #define SLAVE_HANDSHAKE 0xB9A0 @@ -138,7 +151,7 @@ extern u8 gUnknown_020228C4[BLOCK_BUFFER_SIZE]; // gBlockSendBuffer extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; extern u16 gLinkType; extern u32 gLinkStatus; -extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS + 1][BLOCK_BUFFER_SIZE / 2]; +extern u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2]; extern u16 gSendCmd[CMD_LENGTH]; extern u8 gShouldAdvanceLinkState; extern struct LinkPlayer gLinkPlayers[]; diff --git a/include/link_rfu.h b/include/link_rfu.h index ff71c65aa..71b35b25c 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -9,16 +9,17 @@ u32 sub_800BEC0(void); void sub_800E700(void); void sub_800EDD4(void); +void sub_800F6FC(u8 who); +void sub_800F728(u8 who); bool32 sub_800F7E4(void); void sub_800F804(void); void sub_800F850(void); +u8 sub_800FCD8(void); +bool32 sub_800FE84(const void *src, size_t size); void Rfu_set_zero(void); u8 sub_80104F4(void); u8 rfu_get_multiplayer_id(void); -bool32 sub_800FE84(const void *src, size_t size); bool8 sub_8010100(u8 a0); bool8 sub_8010500(void); -u8 sub_800FCD8(void); -void sub_800F6FC(u8 who); #endif //GUARD_LINK_RFU_H diff --git a/src/link.c b/src/link.c index 68868491b..532079498 100644 --- a/src/link.c +++ b/src/link.c @@ -97,14 +97,14 @@ u8 gUnknown_03003160; EWRAM_DATA u8 gUnknown_020223BC = 0; EWRAM_DATA u8 gUnknown_020223BD = 0; EWRAM_DATA u32 gUnknown_020223C0 = 0; -EWRAM_DATA u16 gBlockRecvBuffer[MAX_LINK_PLAYERS + 1][BLOCK_BUFFER_SIZE / 2] = {}; +EWRAM_DATA u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2] = {}; EWRAM_DATA u8 gUnknown_020228C4[BLOCK_BUFFER_SIZE] = {}; EWRAM_DATA bool8 gUnknown_020229C4 = FALSE; EWRAM_DATA u16 gUnknown_020229C6 = 0; EWRAM_DATA u16 gUnknown_020229C8 = 0; EWRAM_DATA struct LinkPlayer gUnknown_020229CC = {}; -EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_LINK_PLAYERS + 1] = {}; -EWRAM_DATA struct LinkPlayer gUnknown_02022A74[MAX_LINK_PLAYERS + 1] = {}; +EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {}; +EWRAM_DATA struct LinkPlayer gUnknown_02022A74[MAX_RFU_PLAYERS] = {}; // Static ROM declarations @@ -120,7 +120,7 @@ static void sub_800A388(void); static void sub_800A3EC(void); void task00_link_test(u8 taskId); void sub_800A588(u8 who); -u16 sub_800A648(u16 *src, u16 size); +u16 sub_800A648(const u16 *src, u16 size); void sub_800A6E8(u32 pos, u8 a0, u8 a1, u8 a2); void sub_800A824(void); void c2_800ACD4(void); @@ -449,7 +449,7 @@ u16 sub_80099E0(const u16 *src) gUnknown_03003110[i] = 0; } gUnknown_03003084 = *src; - if (gUnknown_030030E0 & 0x40) + if (gUnknown_030030E0 & LINK_STAT_CONN_ESTABLISHED) { sub_8009AA0(SIO_MULTI_CNT->id); if (gUnknown_03003140 != NULL) @@ -627,7 +627,7 @@ void sub_8009D90(u16 command) u8 i; gUnknown_03003110[0] = 0x7777; - for (i = 0; i < 5; i ++) + for (i = 0; i < MAX_RFU_PLAYERS; i ++) { gUnknown_03003110[i + 1] = 0xEE; } @@ -1071,3 +1071,64 @@ void sub_800A588(u8 who) gUnknown_0300307C[who] = TRUE; } } + +void ResetBlockReceivedFlags(void) +{ + int i; + + if (gSerialIsRFU == TRUE) + { + for (i = 0; i < MAX_RFU_PLAYERS; i ++) + { + sub_800F728(i); + } + } + else + { + for (i = 0; i < MAX_LINK_PLAYERS; i ++) + { + gUnknown_0300307C[i] = FALSE; + } + } +} + +void ResetBlockReceivedFlag(u8 who) +{ + if (gSerialIsRFU == TRUE) + { + sub_800F728(who); + } + else if (gUnknown_0300307C[who]) + { + gUnknown_0300307C[who] = FALSE; + } +} + +void sub_800A620(void) +{ + if ((gUnknown_030030E0 & LINK_STAT_MASTER) && EXTRACT_PLAYER_COUNT(gUnknown_030030E0) > 1) + { + gUnknown_03003144 = TRUE; + } +} + +u16 sub_800A648(const u16 *data, u16 size) +{ + u16 chksum; + u16 i; + + chksum = 0; + for (i = 0; i < size / 2; i ++) + { + chksum += data[i]; + } + return chksum; +} + +void sub_800A678(u8 a0, u8 a1, u8 a2) +{ + u16 *vAddr; + + vAddr = (u16 *)BG_SCREEN_ADDR(gUnknown_03003130.screenBaseBlock); + vAddr[a2 * 32 + a1] = (gUnknown_03003130.paletteNum << 12) | (a0 + 1 + gUnknown_03003130.dummy_8); +} From ee738c74b9e0e39fae410834add43388c12d176c Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 22:44:35 -0500 Subject: [PATCH 024/123] through sub_800A6E8 --- asm/link.s | 79 ------------------------------------------------------ src/link.c | 25 +++++++++++++++++ 2 files changed, 25 insertions(+), 79 deletions(-) diff --git a/asm/link.s b/asm/link.s index ba7593695..8b1d2f17f 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,85 +5,6 @@ .text - thumb_func_start sub_800A6B0 -sub_800A6B0: @ 800A6B0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - ldr r4, =gUnknown_03003130 - ldr r3, [r4] - lsls r3, 11 - movs r5, 0xC0 - lsls r5, 19 - adds r3, r5 - lsrs r2, 19 - adds r2, r1 - lsls r2, 1 - adds r2, r3 - ldr r3, [r4, 0x4] - lsls r3, 12 - ldr r1, [r4, 0x8] - adds r1, r0 - orrs r3, r1 - strh r3, [r2] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A6B0 - - thumb_func_start sub_800A6E8 -sub_800A6E8: @ 800A6E8 - push {r4-r7,lr} - sub sp, 0x10 - adds r5, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - movs r4, 0 - cmp r4, r3 - bge _0800A714 - movs r2, 0xF -_0800A702: - mov r0, sp - adds r1, r0, r4 - adds r0, r5, 0 - ands r0, r2 - strb r0, [r1] - lsrs r5, 4 - adds r4, 0x1 - cmp r4, r3 - blt _0800A702 -_0800A714: - subs r4, r3, 0x1 - cmp r4, 0 - blt _0800A734 -_0800A71A: - mov r1, sp - adds r0, r1, r4 - ldrb r0, [r0] - adds r1, r6, 0 - adds r2, r7, 0 - bl sub_800A678 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - subs r4, 0x1 - cmp r4, 0 - bge _0800A71A -_0800A734: - add sp, 0x10 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A6E8 - thumb_func_start sub_800A73C sub_800A73C: @ 800A73C push {r4-r7,lr} diff --git a/src/link.c b/src/link.c index 532079498..c2ef12786 100644 --- a/src/link.c +++ b/src/link.c @@ -1132,3 +1132,28 @@ void sub_800A678(u8 a0, u8 a1, u8 a2) vAddr = (u16 *)BG_SCREEN_ADDR(gUnknown_03003130.screenBaseBlock); vAddr[a2 * 32 + a1] = (gUnknown_03003130.paletteNum << 12) | (a0 + 1 + gUnknown_03003130.dummy_8); } + +void sub_800A6B0(u8 a0, u8 a1, u8 a2) +{ + u16 *vAddr; + + vAddr = (u16 *)BG_SCREEN_ADDR(gUnknown_03003130.screenBaseBlock); + vAddr[a2 * 32 + a1] = (gUnknown_03003130.paletteNum << 12) | (a0 + gUnknown_03003130.dummy_8); +} + +void sub_800A6E8(u32 a0, u8 a1, u8 a2, u8 a3) +{ + u8 sp[32 / 2]; + int i; + + for (i = 0; i < a3; i ++) + { + sp[i] = a0 & 0xf; + a0 >>= 4; + } + for (i = a3 - 1; i >= 0; i --) + { + sub_800A678(sp[i], a1, a2); + a1 ++; + } +} From 92afe9e33f7056170cfb826359d634c8ab9c4262 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 22:54:40 -0500 Subject: [PATCH 025/123] sub_800A73C --- asm/link.s | 85 ------------------------------------------------------ src/link.c | 28 ++++++++++++++++++ 2 files changed, 28 insertions(+), 85 deletions(-) diff --git a/asm/link.s b/asm/link.s index 8b1d2f17f..139108837 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,91 +5,6 @@ .text - thumb_func_start sub_800A73C -sub_800A73C: @ 800A73C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - adds r6, r0, 0 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x10] - cmp r6, 0 - bge _0800A768 - str r7, [sp, 0x10] - negs r6, r6 -_0800A768: - movs r5, 0 - movs r1, 0x1 - negs r1, r1 - add r1, r8 - mov r10, r1 - cmp r5, r8 - bge _0800A794 -_0800A776: - mov r0, sp - adds r4, r0, r5 - adds r0, r6, 0 - movs r1, 0xA - bl __modsi3 - strb r0, [r4] - adds r0, r6, 0 - movs r1, 0xA - bl __divsi3 - adds r6, r0, 0 - adds r5, 0x1 - cmp r5, r8 - blt _0800A776 -_0800A794: - mov r5, r10 - cmp r5, 0 - blt _0800A7B4 -_0800A79A: - mov r1, sp - adds r0, r1, r5 - ldrb r0, [r0] - adds r1, r7, 0 - mov r2, r9 - bl sub_800A678 - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - subs r5, 0x1 - cmp r5, 0 - bge _0800A79A -_0800A7B4: - movs r0, 0x1 - negs r0, r0 - ldr r1, [sp, 0x10] - cmp r1, r0 - beq _0800A7CA - lsls r1, 24 - lsrs r1, 24 - movs r0, 0xA - mov r2, r9 - bl sub_800A678 -_0800A7CA: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A73C - thumb_func_start sub_800A7DC sub_800A7DC: @ 800A7DC push {r4-r7,lr} diff --git a/src/link.c b/src/link.c index c2ef12786..ede672f18 100644 --- a/src/link.c +++ b/src/link.c @@ -1157,3 +1157,31 @@ void sub_800A6E8(u32 a0, u8 a1, u8 a2, u8 a3) a1 ++; } } + +void sub_800A73C(int a0, u8 a1, u8 a2, u8 a3) +{ + u8 sp[32 / 2]; + int sp10; + int i; + + sp10 = -1; + if (a0 < 0) + { + sp10 = a1; + a0 = -a0; + } + for (i = 0; i < a3; i ++) + { + sp[i] = a0 % 10; + a0 /= 10; + } + for (i = a3 - 1; i >= 0; i --) + { + sub_800A678(sp[i], a1, a2); + a1 ++; + } + if (sp10 != -1) + { + sub_800A678(10, sp10, a2); + } +} From 2c37f83546887e51098c04da0648e91234aa38e7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 23:12:21 -0500 Subject: [PATCH 026/123] sub_800A7DC --- asm/link.s | 42 ------------------------------------------ src/link.c | 33 ++++++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/asm/link.s b/asm/link.s index 139108837..5edbc7e6d 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,48 +5,6 @@ .text - thumb_func_start sub_800A7DC -sub_800A7DC: @ 800A7DC - push {r4-r7,lr} - adds r3, r0, 0 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - movs r6, 0 - ldrb r0, [r3] - cmp r0, 0 - beq _0800A81C - adds r4, r3, 0 - lsls r5, r2, 24 -_0800A7F4: - ldrb r0, [r4] - cmp r0, 0xA - bne _0800A804 - movs r0, 0x80 - lsls r0, 17 - adds r5, r0 - movs r6, 0 - b _0800A814 -_0800A804: - ldrb r0, [r4] - adds r1, r7, r6 - lsls r1, 24 - lsrs r1, 24 - lsrs r2, r5, 24 - bl sub_800A6B0 - adds r6, 0x1 -_0800A814: - adds r4, 0x1 - ldrb r0, [r4] - cmp r0, 0 - bne _0800A7F4 -_0800A81C: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A7DC - thumb_func_start sub_800A824 sub_800A824: @ 800A824 push {lr} diff --git a/src/link.c b/src/link.c index ede672f18..bba217b4d 100644 --- a/src/link.c +++ b/src/link.c @@ -1125,7 +1125,7 @@ u16 sub_800A648(const u16 *data, u16 size) return chksum; } -void sub_800A678(u8 a0, u8 a1, u8 a2) +void sub_800A678(char a0, u8 a1, u8 a2) { u16 *vAddr; @@ -1133,7 +1133,7 @@ void sub_800A678(u8 a0, u8 a1, u8 a2) vAddr[a2 * 32 + a1] = (gUnknown_03003130.paletteNum << 12) | (a0 + 1 + gUnknown_03003130.dummy_8); } -void sub_800A6B0(u8 a0, u8 a1, u8 a2) +void sub_800A6B0(char a0, u8 a1, u8 a2) { u16 *vAddr; @@ -1143,7 +1143,7 @@ void sub_800A6B0(u8 a0, u8 a1, u8 a2) void sub_800A6E8(u32 a0, u8 a1, u8 a2, u8 a3) { - u8 sp[32 / 2]; + char sp[32 / 2]; int i; for (i = 0; i < a3; i ++) @@ -1160,7 +1160,7 @@ void sub_800A6E8(u32 a0, u8 a1, u8 a2, u8 a3) void sub_800A73C(int a0, u8 a1, u8 a2, u8 a3) { - u8 sp[32 / 2]; + char sp[32 / 2]; int sp10; int i; @@ -1182,6 +1182,29 @@ void sub_800A73C(int a0, u8 a1, u8 a2, u8 a3) } if (sp10 != -1) { - sub_800A678(10, sp10, a2); + sub_800A678(*"\n", sp10, a2); + } +} + +void sub_800A7DC(const char *a0, u8 a1, u8 a2) +{ + int r6; + int i; + int r5; + + r5 = 0; + r6 = 0; + for (i = 0; a0[i] != 0; a0 ++) + { + if (a0[i] == *"\n") + { + r5 ++; + r6 = 0; + } + else + { + sub_800A6B0(a0[i], a1 + r6, a2 + r5); + r6 ++; + } } } From e874cbd9d952f9cb893885c04c61908910cc7791 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 11 Nov 2017 00:05:44 -0500 Subject: [PATCH 027/123] Rename functions in link.c --- asm/berry_blender.s | 76 ++--- asm/cable_club.s | 94 +++--- asm/contest_link_80FC4F4.s | 8 +- asm/field_screen.s | 2 +- asm/intro.s | 2 +- asm/link.s | 328 ++++++--------------- asm/link_rfu.s | 112 +++---- asm/mystery_event_menu.s | 20 +- asm/pokenav.s | 38 +-- asm/record_mixing.s | 4 +- asm/rom4.s | 4 +- asm/rom_8011DC0.s | 70 ++--- asm/trade.s | 30 +- common_syms/link.txt | 2 +- common_syms/main.txt | 4 +- data/link_rfu.s | 10 +- data/specials.inc | 2 +- include/link.h | 45 +-- include/main.h | 4 +- src/battle_controllers.c | 2 +- src/link.c | 584 ++++++++++++++++++++----------------- src/main.c | 18 +- sym_common.txt | 26 +- 23 files changed, 688 insertions(+), 797 deletions(-) diff --git a/asm/berry_blender.s b/asm/berry_blender.s index fc7e747b9..511120f2d 100644 --- a/asm/berry_blender.s +++ b/asm/berry_blender.s @@ -1021,7 +1021,7 @@ _0808003C: .4byte _08080508 _08080094: bl sub_8080588 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00004422 adds r0, r2, 0 strh r0, [r1] @@ -1193,7 +1193,7 @@ _080801F8: ldr r1, =gScriptItemId ldrh r1, [r1] bl sub_807FE14 - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, [r4] adds r1, r5 movs r2, 0x10 @@ -2063,7 +2063,7 @@ _08080950: bl sub_8080674 movs r4, 0 movs r6, 0 - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType mov r12, r0 movs r7, 0x92 lsls r7, 1 @@ -2571,9 +2571,9 @@ _08080DAE: thumb_func_start sub_8080DF8 sub_8080DF8: @ 8080DF8 push {lr} - ldr r3, =gUnknown_03003110 + ldr r3, =gSendCmd movs r0, 0 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds movs r2, 0x3 _08080E02: strh r0, [r3] @@ -2608,7 +2608,7 @@ sub_8080E20: @ 8080E20 ldrsh r1, [r2, r4] cmp r0, r1 ble _08080E58 - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds movs r4, 0xC ldrsh r1, [r2, r4] lsls r1, 4 @@ -2704,12 +2704,12 @@ _08080ED8: bgt _08080F40 cmp r1, 0x4B bls _08080F2C - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00004523 b _08080F30 .pool _08080F2C: - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00005432 _08080F30: strh r0, [r1, 0x14] @@ -2728,7 +2728,7 @@ _08080F40: lsrs r0, 24 cmp r0, 0x3B bhi _08080F68 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00005432 b _08080F9E .pool @@ -2745,7 +2745,7 @@ _08080F6E: lsrs r0, 24 cmp r0, 0x13 bhi _08080F8C - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00005432 b _08080F9E .pool @@ -2758,7 +2758,7 @@ _08080F90: bl sub_8080E6C b _08080FA0 _08080F9A: - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00004523 _08080F9E: strh r0, [r1, 0x14] @@ -2847,13 +2847,13 @@ sub_8080FD0: @ 8080FD0 bgt _08081088 cmp r2, 0x42 bls _08081078 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00004523 strh r0, [r1, 0x24] b _080810B0 .pool _08081078: - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00005432 strh r0, [r1, 0x24] b _080810B0 @@ -2861,7 +2861,7 @@ _08081078: _08081088: cmp r2, 0x41 bls _08081092 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00004523 strh r0, [r1, 0x24] _08081092: @@ -2871,7 +2871,7 @@ _08081092: lsrs r0, 24 cmp r0, 0x18 bhi _080810A4 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00005432 strh r0, [r1, 0x24] _080810A4: @@ -2889,7 +2889,7 @@ _080810B0: b _080810EC .pool _080810CC: - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds ldr r1, =0x00004523 strh r1, [r0, 0x24] movs r0, 0x1 @@ -2972,13 +2972,13 @@ sub_80810F8: @ 80810F8 bgt _080811AC cmp r2, 0x58 bls _0808119C - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00004523 strh r0, [r1, 0x34] b _080811DE .pool _0808119C: - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00005432 strh r0, [r1, 0x34] b _080811DE @@ -2986,7 +2986,7 @@ _0808119C: _080811AC: cmp r2, 0x3C bls _080811C0 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00004523 b _080811D0 .pool @@ -2997,7 +2997,7 @@ _080811C0: lsrs r0, 24 cmp r0, 0x4 bhi _080811D2 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r0, =0x00005432 _080811D0: strh r0, [r1, 0x34] @@ -3016,7 +3016,7 @@ _080811DE: b _08081218 .pool _080811F8: - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds ldr r1, =0x00004523 strh r1, [r0, 0x34] movs r0, 0x1 @@ -3063,7 +3063,7 @@ sub_8081224: @ 8081224 ldrsh r0, [r2, r1] cmp r0, 0 bne _0808127E - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds ldr r1, =0x00004523 strh r1, [r0, 0x14] movs r0, 0x1 @@ -3370,9 +3370,9 @@ sub_80814F4: @ 80814F4 ldrh r0, [r0] cmp r0, 0 beq _0808153C - ldr r3, =gUnknown_03003110 + ldr r3, =gSendCmd ldrh r0, [r3, 0x4] - ldr r2, =gUnknown_03003090 + ldr r2, =gRecvCmds cmp r0, 0 beq _0808151C movs r1, 0 @@ -3381,7 +3381,7 @@ sub_80814F4: @ 80814F4 strh r0, [r2] strh r1, [r3, 0x4] _0808151C: - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds ldr r3, =0x00004444 adds r1, r2, 0 adds r1, 0x10 @@ -3409,7 +3409,7 @@ _0808153C: blt _0808154C b _080816F6 _0808154C: - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds adds r2, r0, 0 adds r2, 0x20 str r2, [sp] @@ -3605,7 +3605,7 @@ _080816F6: cmp r7, r0 bge _08081722 movs r2, 0 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds _08081710: strh r2, [r1] strh r2, [r1, 0x4] @@ -3711,19 +3711,19 @@ _080817BA: lsrs r0, 24 cmp r0, 0x2 bne _08081810 - ldr r1, =gUnknown_03003110 + ldr r1, =gSendCmd ldr r0, =0x00004523 b _08081828 .pool _08081810: cmp r0, 0x1 bne _08081824 - ldr r1, =gUnknown_03003110 + ldr r1, =gSendCmd ldr r0, =0x00005432 b _08081828 .pool _08081824: - ldr r1, =gUnknown_03003110 + ldr r1, =gSendCmd ldr r0, =0x00002345 _08081828: strh r0, [r1, 0x4] @@ -3804,7 +3804,7 @@ _080818B4: lsls r5, 1 adds r1, r5 ldrh r1, [r1] - bl sub_800A994 + bl SetLinkDebugValues bl sub_80814F4 ldr r0, [r4] adds r0, r5 @@ -4804,7 +4804,7 @@ _08082078: lsls r0, 16 cmp r0, 0 bgt _080820C6 - bl sub_8009F8C + bl ClearLinkCallback ldr r2, [r4] adds r1, r2, 0 adds r1, 0x4C @@ -5176,7 +5176,7 @@ _0808239E: b _0808249E .pool _080823B0: - ldr r6, =gUnknown_03003110 + ldr r6, =gSendCmd adds r0, r6, 0 bl sub_8081F94 ldr r4, =gUnknown_020322A4 @@ -5972,7 +5972,7 @@ sub_8082AD4: @ 8082AD4 bne _08082AE0 b _08082CA4 _08082AE0: - ldr r4, =gUnknown_03003090 + ldr r4, =gRecvCmds ldrh r0, [r4] ldr r1, =0x00002fff movs r2, 0xBC @@ -6051,7 +6051,7 @@ _08082B8A: b _08082BF4 .pool _08082B9C: - ldr r6, =gUnknown_03003090 + ldr r6, =gRecvCmds lsls r4, r5, 4 adds r0, r4, r6 ldrh r0, [r0] @@ -6146,7 +6146,7 @@ _08082C4E: cmp r0, r4 beq _08082C48 _08082C6A: - ldr r4, =gUnknown_03003110 + ldr r4, =gSendCmd adds r0, r4, 0 bl sub_8081F94 bl GetLinkPlayerCount @@ -6269,7 +6269,7 @@ _08082D3C: ldrh r1, [r2] adds r0, r1 strh r0, [r2] - ldr r1, =gUnknown_03003110 + ldr r1, =gSendCmd movs r4, 0x8B lsls r4, 1 adds r0, r3, r4 @@ -6284,7 +6284,7 @@ _08082D3C: b _08082DEA .pool _08082D90: - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds ldrh r0, [r3] movs r1, 0xFF lsls r1, 8 diff --git a/asm/cable_club.s b/asm/cable_club.s index 254272c4d..df8e248ad 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -143,7 +143,7 @@ sub_80B2478: @ 80B2478 lsrs r0, 24 lsls r1, 24 lsrs r1, 24 - bl sub_800A0C8 + bl GetLinkPlayerDataExchangeStatusTimed lsls r0, 24 lsrs r0, 24 subs r0, 0x1 @@ -244,7 +244,7 @@ sub_80B252C: @ 80B252C lsrs r1, r0, 24 cmp r1, 0 bne _080B2570 - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType strh r1, [r0] ldr r1, =gTasks lsls r0, r4, 2 @@ -274,7 +274,7 @@ sub_80B2578: @ 80B2578 cmp r0, 0 beq _080B258E movs r0, 0x1 - bl sub_800B330 + bl SetSuppressLinkErrorMessage _080B258E: ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -286,7 +286,7 @@ _080B258E: b _080B25BA .pool _080B25A4: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType movs r0, 0 strh r0, [r1] ldr r1, =gTasks @@ -374,9 +374,9 @@ sub_80B2634: @ 80B2634 ldrsh r2, [r4, r3] cmp r2, 0 bne _080B266C - bl sub_800A0AC + bl OpenLinkTimed bl sub_800AB98 - bl sub_800A2BC + bl ResetLinkPlayers ldr r0, =gUnknown_08550594 bl AddWindow strh r0, [r4, 0xA] @@ -418,7 +418,7 @@ sub_80B2688: @ 80B2688 cmp r5, 0x1 bls _080B26FC movs r0, 0x1 - bl sub_800B330 + bl SetSuppressLinkErrorMessage ldr r1, =gTasks lsls r0, r4, 2 adds r0, r4 @@ -729,7 +729,7 @@ _080B297C: cmp r2, 0x9 bne _080B2994 _080B2984: - bl sub_80097E8 + bl CloseLink bl HideFieldMessageBox ldr r0, =sub_80B2CB0 b _080B29E4 @@ -743,7 +743,7 @@ _080B2994: strb r0, [r1] ldrb r0, [r4] bl sub_800AA04 - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer adds r0, r4, 0 bl sub_80C30A4 ldr r0, =gUnknown_0203CEF8 @@ -812,7 +812,7 @@ _080B2A42: cmp r0, 0x9 bne _080B2A6C _080B2A4A: - bl sub_80097E8 + bl CloseLink _080B2A4E: bl HideFieldMessageBox ldr r0, =gTasks @@ -833,7 +833,7 @@ _080B2A6C: strb r0, [r1] ldrb r0, [r4] bl sub_800AA04 - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer adds r0, r4, 0 bl sub_80C30A4 ldr r0, =gUnknown_0203CEF8 @@ -964,7 +964,7 @@ task_map_chg_seq_0807EC34: @ 80B2B94 ldrh r0, [r5] cmp r0, 0x1 bne _080B2C10 - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType ldrh r2, [r0] ldr r0, =0x00002266 cmp r2, r0 @@ -1065,7 +1065,7 @@ _080B2C7E: cmp r4, r0 bcc _080B2C5C movs r0, 0 - bl sub_800B330 + bl SetSuppressLinkErrorMessage bl ResetBlockReceivedFlags ldr r0, =gScriptResult adds r1, r5, 0 @@ -1215,20 +1215,20 @@ _080B2DC0: b _080B2E34 _080B2DCA: movs r3, 0x2 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002233 b _080B2E30 .pool _080B2DDC: movs r3, 0x2 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002244 b _080B2E30 .pool _080B2DEC: movs r3, 0x4 movs r2, 0x4 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002255 b _080B2E30 .pool @@ -1243,12 +1243,12 @@ _080B2E00: ands r0, r1 cmp r0, 0 bne _080B2E2C - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002266 b _080B2E30 .pool _080B2E2C: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r4, =0x00002277 _080B2E30: adds r0, r4, 0 @@ -1266,7 +1266,7 @@ _080B2E34: thumb_func_start sub_80B2E4C sub_80B2E4C: @ 80B2E4C push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001133 adds r0, r2, 0 strh r0, [r1] @@ -1287,7 +1287,7 @@ sub_80B2E74: @ 80B2E74 ldr r1, =gScriptResult movs r0, 0 strh r0, [r1] - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00003311 adds r0, r2, 0 strh r0, [r1] @@ -1454,7 +1454,7 @@ _080B2FC6: thumb_func_start sub_80B2FD8 sub_80B2FD8: @ 80B2FD8 push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00004411 adds r0, r2, 0 strh r0, [r1] @@ -1472,7 +1472,7 @@ sub_80B2FD8: @ 80B2FD8 thumb_func_start sub_80B3000 sub_80B3000: @ 80B3000 push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00006601 adds r0, r2, 0 strh r0, [r1] @@ -1490,7 +1490,7 @@ sub_80B3000: @ 80B3000 thumb_func_start sub_80B3028 sub_80B3028: @ 80B3028 push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00006602 adds r0, r2, 0 strh r0, [r1] @@ -1540,17 +1540,17 @@ _080B3084: .4byte _080B3128 .4byte _080B30D8 _080B30A8: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002233 b _080B3124 .pool _080B30B8: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002244 b _080B3124 .pool _080B30C8: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002255 b _080B3124 .pool @@ -1564,22 +1564,22 @@ _080B30D8: ands r0, r1 cmp r0, 0 bne _080B3100 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002266 b _080B3124 .pool _080B3100: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002277 b _080B3124 .pool _080B3110: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001111 b _080B3124 .pool _080B3120: - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00003322 _080B3124: adds r0, r2, 0 @@ -1610,8 +1610,8 @@ sub_80B3144: @ 80B3144 ldrsh r2, [r4, r3] cmp r2, 0 bne _080B3178 - bl sub_8009734 - bl sub_800A2BC + bl OpenLink + bl ResetLinkPlayers ldr r0, =task00_08081A90 movs r1, 0x50 bl CreateTask @@ -1710,7 +1710,7 @@ sub_80B3220: @ 80B3220 ldrb r0, [r0] cmp r0, 0x1 bne _080B3248 - bl sub_800A23C + bl IsLinkPlayerDataExchangeComplete lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -1809,11 +1809,11 @@ _080B32F8: movs r0, 0x1 movs r1, 0 bl fade_screen - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002211 adds r0, r2, 0 strh r0, [r1] - bl sub_8009FAC + bl ClearLinkCallback_2 b _080B3346 .pool _080B3318: @@ -1922,11 +1922,11 @@ _080B3408: movs r0, 0x1 movs r1, 0 bl fade_screen - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType ldr r2, =0x00002211 adds r1, r2, 0 strh r1, [r0] - bl sub_8009FAC + bl ClearLinkCallback_2 movs r0, 0x1 strh r0, [r6] b _080B3532 @@ -1945,7 +1945,7 @@ _080B343A: b _080B3532 .pool _080B3444: - ldr r1, =gUnknown_020229CC + ldr r1, =gLocalLinkPlayer movs r0, 0 movs r2, 0x1C bl SendBlock @@ -2400,7 +2400,7 @@ _080B382E: movs r0, 0x1 movs r1, 0 bl fade_screen - bl sub_8009FAC + bl ClearLinkCallback_2 b _080B3864 _080B3840: ldr r0, =gPaletteFade @@ -2548,7 +2548,7 @@ nullsub_37: @ 80B3964 thumb_func_start sub_80B3968 sub_80B3968: @ 80B3968 push {lr} - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002211 adds r0, r2, 0 strh r0, [r1] @@ -2651,8 +2651,8 @@ task00_08081A90: @ 80B3A30 lsls r0, 17 cmp r1, r0 ble _080B3A62 - bl sub_80097E8 - ldr r0, =c2_800ACD4 + bl CloseLink + ldr r0, =CB2_LinkError bl SetMainCallback2 adds r0, r4, 0 bl DestroyTask @@ -2669,8 +2669,8 @@ _080B3A62: lsls r0, 24 cmp r0, 0 bne _080B3A86 - bl sub_80097E8 - ldr r0, =c2_800ACD4 + bl CloseLink + ldr r0, =CB2_LinkError bl SetMainCallback2 _080B3A86: adds r0, r4, 0 @@ -2761,7 +2761,7 @@ _080B3B2A: b _080B3BB8 .pool _080B3B40: - bl sub_8009734 + bl OpenLink ldr r0, =task00_08081A90 movs r1, 0x1 bl CreateTask @@ -2808,7 +2808,7 @@ _080B3B9E: ldrb r0, [r0] cmp r0, 0x1 bne _080B3BB8 - bl sub_800A23C + bl IsLinkPlayerDataExchangeComplete lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -2829,7 +2829,7 @@ sub_80B3BC4: @ 80B3BC4 ldrb r0, [r0] cmp r0, 0 bne _080B3BD6 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00002288 adds r0, r2, 0 strh r0, [r1] diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s index 953f69479..135e04e5e 100644 --- a/asm/contest_link_80FC4F4.s +++ b/asm/contest_link_80FC4F4.s @@ -284,7 +284,7 @@ _080FC6FE: lsls r0, 24 cmp r0, 0 beq _080FC7F4 - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gUnknown_02039F25 ldrb r1, [r1] lsls r1, 6 @@ -297,7 +297,7 @@ _080FC6FE: b _080FC7F4 .pool _080FC738: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gUnknown_02039F25 ldrb r1, [r1] lsls r1, 6 @@ -487,7 +487,7 @@ _080FC8D8: beq _080FC954 b _080FC96E _080FC8DE: - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer ldrh r0, [r4, 0x1A] strb r0, [r1] bl GetMultiplayerId @@ -1142,7 +1142,7 @@ _080FCE8C: beq _080FCEFC b _080FCF16 _080FCE92: - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer movs r0, 0x6E strb r0, [r1] bl GetMultiplayerId diff --git a/asm/field_screen.s b/asm/field_screen.s index 4ab8a5a53..462237bee 100644 --- a/asm/field_screen.s +++ b/asm/field_screen.s @@ -8987,7 +8987,7 @@ _080AF994: beq _080AF9D0 b _080AF9E8 _080AF99A: - bl sub_8009FAC + bl ClearLinkCallback_2 movs r0, 0x1 movs r1, 0 bl fade_screen diff --git a/asm/intro.s b/asm/intro.s index 32b52ed06..c4d7f80e8 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -562,7 +562,7 @@ task_intro_2: @ 816D12C movs r0, 0xCF lsls r0, 1 bl m4aSongNumStart - bl sub_800B628 + bl ResetSerial add sp, 0x4 pop {r4,r5} pop {r0} diff --git a/asm/link.s b/asm/link.s index 5edbc7e6d..b3b2d77c2 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,163 +5,15 @@ .text - thumb_func_start sub_800A824 -sub_800A824: @ 800A824 - push {lr} - ldr r0, =gUnknown_030030E0 - ldr r0, [r0] - movs r1, 0x20 - ands r0, r1 - cmp r0, 0 -_0800A830: - beq _0800A838 - ldr r0, =0x00002222 - bl sub_8009D90 -_0800A838: - ldr r1, =gUnknown_03003140 - movs r0, 0 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A824 - - thumb_func_start task00_link_test -task00_link_test: @ 800A850 - push {r4-r6,lr} - sub sp, 0x20 - ldr r1, =gASCIITestPrint - mov r0, sp - bl strcpy - mov r0, sp - movs r1, 0x5 - movs r2, 0x2 - bl sub_800A7DC - ldr r0, =gUnknown_03003144 - ldrb r0, [r0] - movs r1, 0x2 - movs r2, 0x1 - movs r3, 0x2 - bl sub_800A6E8 - ldr r4, =gUnknown_030030E0 - ldr r0, [r4] - movs r1, 0xF - movs r2, 0x1 - movs r3, 0x8 - bl sub_800A6E8 - ldr r0, =gUnknown_03003170 - ldrb r0, [r0, 0x1] - movs r1, 0x2 - movs r2, 0xA - movs r3, 0x2 - bl sub_800A6E8 - ldr r0, [r4] - movs r1, 0x1C - ands r0, r1 - lsrs r0, 2 - movs r1, 0xF - movs r2, 0xA - movs r3, 0x2 - bl sub_800A6E8 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0xF - movs r2, 0xC - movs r3, 0x2 - bl sub_800A6E8 - ldr r0, =gUnknown_03003160 - ldrb r0, [r0] - movs r1, 0x19 - movs r2, 0x1 - movs r3, 0x2 - bl sub_800A6E8 - ldr r0, =gUnknown_03004130 - ldrb r0, [r0] - movs r1, 0x19 - movs r2, 0x2 - movs r3, 0x2 - bl sub_800A6E8 - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - movs r1, 0xF - movs r2, 0x5 - movs r3, 0x2 - bl sub_800A6E8 - ldr r0, =gUnknown_0300302C - ldr r0, [r0] - movs r1, 0x2 - movs r2, 0xC - movs r3, 0x8 - bl sub_800A6E8 - ldr r0, =gUnknown_03003070 - ldr r0, [r0] - movs r1, 0x2 - movs r2, 0xD - movs r3, 0x8 - bl sub_800A6E8 - bl sub_800B2E8 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x19 - movs r2, 0x5 - movs r3, 0x1 - bl sub_800A6E8 - bl sub_800B2F8 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x19 - movs r2, 0x6 - movs r3, 0x1 - bl sub_800A6E8 - bl sub_800B320 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x19 - movs r2, 0x7 - movs r3, 0x1 - bl sub_800A6E8 - bl sub_800B33C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x19 - movs r2, 0x8 - movs r3, 0x1 - bl sub_800A6E8 - movs r6, 0 - movs r5, 0x80 - lsls r5, 19 - ldr r4, =gUnknown_03003148 -_0800A94E: - ldrh r0, [r4] - lsrs r2, r5, 24 - movs r1, 0xA - movs r3, 0x4 - bl sub_800A6E8 - movs r0, 0x80 - lsls r0, 17 - adds r5, r0 - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _0800A94E - add sp, 0x20 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task00_link_test - - thumb_func_start sub_800A994 -sub_800A994: @ 800A994 + thumb_func_start SetLinkDebugValues +SetLinkDebugValues: @ 800A994 ldr r2, =gUnknown_0300302C str r0, [r2] ldr r0, =gUnknown_03003070 str r1, [r0] bx lr .pool - thumb_func_end sub_800A994 + thumb_func_end SetLinkDebugValues thumb_func_start sub_800A9A8 sub_800A9A8: @ 800A9A8 @@ -281,7 +133,7 @@ sub_800AA60: @ 800AA60 ldr r0, =gUnknown_02022A74 ldr r2, =0x00002288 mov r8, r2 - ldr r7, =gUnknown_020229C6 + ldr r7, =gLinkType mov r6, r12 adds r6, 0x14 adds r5, r0, 0x4 @@ -393,11 +245,11 @@ _0800AB36: cmp r0, 0 beq _0800AB6A _0800AB5A: - ldr r1, =gUnknown_0300306C + ldr r1, =gLinkErrorOccurred movs r0, 0x1 strb r0, [r1] - bl sub_80097E8 - ldr r0, =c2_800ACD4 + bl CloseLink + ldr r0, =CB2_LinkError bl SetMainCallback2 _0800AB6A: adds r0, r4, 0x1 @@ -429,7 +281,7 @@ sub_800AB98: @ 800AB98 thumb_func_start sub_800ABAC sub_800ABAC: @ 800ABAC - ldr r0, =gUnknown_030030E0 + ldr r0, =gLinkStatus ldr r0, [r0] movs r1, 0x1C ands r0, r1 @@ -445,7 +297,7 @@ sub_800ABBC: @ 800ABBC ldrb r0, [r0] cmp r0, 0 bne _0800ABDC - ldr r0, =gUnknown_030030E0 + ldr r0, =gLinkStatus ldr r0, [r0] lsrs r0, 5 movs r1, 0x1 @@ -482,7 +334,7 @@ sub_800ABF4: @ 800ABF4 b _0800AC20 .pool _0800AC0C: - ldr r2, =gUnknown_03003140 + ldr r2, =gLinkCallback ldr r1, [r2] cmp r1, 0 bne _0800AC20 @@ -509,7 +361,7 @@ sub_800AC34: @ 800AC34 b _0800AC70 .pool _0800AC48: - ldr r2, =gUnknown_03003140 + ldr r2, =gLinkCallback ldr r1, [r2] cmp r1, 0 beq _0800AC64 @@ -540,8 +392,8 @@ sub_800AC80: @ 800AC80 cmp r0, 0 bne _0800AC96 ldr r0, =0x00005fff - bl sub_8009D90 - ldr r1, =gUnknown_03003140 + bl BuildSendCmd + ldr r1, =gLinkCallback ldr r0, =sub_800ACAC str r0, [r1] _0800AC96: @@ -580,11 +432,11 @@ _0800ACD0: negs r1, r1 ands r0, r1 str r0, [r2] - ldr r0, =gUnknown_03002748 + ldr r0, =gLinkVSyncDisabled movs r4, 0x1 strb r4, [r0] - bl sub_80097E8 - ldr r1, =gUnknown_03003140 + bl CloseLink + ldr r1, =gLinkCallback movs r0, 0 str r0, [r1] ldr r0, =gUnknown_030030E4 @@ -607,7 +459,7 @@ sub_800AD10: @ 800AD10 b _0800AD4C .pool _0800AD24: - ldr r2, =gUnknown_03003140 + ldr r2, =gLinkCallback ldr r1, [r2] cmp r1, 0 beq _0800AD40 @@ -638,8 +490,8 @@ sub_800AD5C: @ 800AD5C cmp r0, 0 bne _0800AD72 ldr r0, =0x00005fff - bl sub_8009D90 - ldr r1, =gUnknown_03003140 + bl BuildSendCmd + ldr r1, =gLinkCallback ldr r0, =sub_800AD88 str r0, [r1] _0800AD72: @@ -684,11 +536,11 @@ _0800ADB6: negs r1, r1 ands r0, r1 str r0, [r2] - ldr r0, =gUnknown_03002748 + ldr r0, =gLinkVSyncDisabled movs r4, 0x1 strb r4, [r0] - bl sub_80097E8 - ldr r1, =gUnknown_03003140 + bl CloseLink + ldr r1, =gLinkCallback movs r0, 0 str r0, [r1] ldr r0, =gUnknown_030030E4 @@ -711,7 +563,7 @@ sub_800ADF8: @ 800ADF8 b _0800AE1E .pool _0800AE0C: - ldr r1, =gUnknown_03003140 + ldr r1, =gLinkCallback ldr r0, [r1] cmp r0, 0 bne _0800AE18 @@ -735,8 +587,8 @@ sub_800AE30: @ 800AE30 cmp r0, 0 bne _0800AE46 ldr r0, =0x00002ffe - bl sub_8009D90 - ldr r1, =gUnknown_03003140 + bl BuildSendCmd + ldr r1, =gLinkCallback ldr r0, =sub_800AE5C str r0, [r1] _0800AE46: @@ -772,7 +624,7 @@ _0800AE86: cmp r1, r2 bne _0800AEA4 movs r1, 0 - ldr r4, =gUnknown_03003140 + ldr r4, =gLinkCallback ldr r3, =gUnknown_030030EC movs r2, 0 _0800AE92: @@ -795,18 +647,18 @@ _0800AEA4: thumb_func_start sub_800AEB4 sub_800AEB4: @ 800AEB4 push {lr} - ldr r0, =gUnknown_020229C4 + ldr r0, =gLinkOpen ldrb r0, [r0] cmp r0, 0 beq _0800AEF4 - ldr r0, =gUnknown_030030E0 + ldr r0, =gLinkStatus ldr r2, [r0] movs r0, 0xFE lsls r0, 11 ands r0, r2 cmp r0, 0 beq _0800AEF4 - ldr r0, =gUnknown_030030F8 + ldr r0, =gSuppressLinkErrorMessage ldrb r0, [r0] cmp r0, 0 bne _0800AEEA @@ -818,13 +670,13 @@ sub_800AEB4: @ 800AEB4 ldr r0, =gUnknown_03003160 ldrb r0, [r0] strb r0, [r1, 0x5] - ldr r0, =c2_800ACD4 + ldr r0, =CB2_LinkError bl SetMainCallback2 _0800AEEA: - ldr r1, =gUnknown_0300306C + ldr r1, =gLinkErrorOccurred movs r0, 0x1 strb r0, [r1] - bl sub_80097E8 + bl CloseLink _0800AEF4: pop {r0} bx r0 @@ -845,8 +697,8 @@ sub_800AF18: @ 800AF18 .pool thumb_func_end sub_800AF18 - thumb_func_start c2_800ACD4 -c2_800ACD4: @ 800AF30 + thumb_func_start CB2_LinkError +CB2_LinkError: @ 800AF30 push {r4,lr} movs r0, 0 movs r1, 0 @@ -935,7 +787,7 @@ _0800AF8C: ldr r1, =gSoftResetDisabled movs r0, 0 strb r0, [r1] - ldr r0, =sub_8009404 + ldr r0, =Task_DestroySelf movs r1, 0 bl CreateTask bl StopMapMusic @@ -953,7 +805,7 @@ _0800B03C: pop {r0} bx r0 .pool - thumb_func_end c2_800ACD4 + thumb_func_end CB2_LinkError thumb_func_start sub_800B080 sub_800B080: @ 800B080 @@ -1251,7 +1103,7 @@ _0800B314: thumb_func_start sub_800B320 sub_800B320: @ 800B320 - ldr r0, =gUnknown_030030E0 + ldr r0, =gLinkStatus ldr r0, [r0] lsrs r0, 6 movs r1, 0x1 @@ -1260,17 +1112,17 @@ sub_800B320: @ 800B320 .pool thumb_func_end sub_800B320 - thumb_func_start sub_800B330 -sub_800B330: @ 800B330 - ldr r1, =gUnknown_030030F8 + thumb_func_start SetSuppressLinkErrorMessage +SetSuppressLinkErrorMessage: @ 800B330 + ldr r1, =gSuppressLinkErrorMessage strb r0, [r1] bx lr .pool - thumb_func_end sub_800B330 + thumb_func_end SetSuppressLinkErrorMessage thumb_func_start sub_800B33C sub_800B33C: @ 800B33C - ldr r0, =gUnknown_0300306C + ldr r0, =gLinkErrorOccurred ldrb r0, [r0] bx lr .pool @@ -1279,11 +1131,11 @@ sub_800B33C: @ 800B33C thumb_func_start sub_800B348 sub_800B348: @ 800B348 push {r4-r6,lr} - bl sub_8009638 - ldr r1, =gUnknown_03003030 + bl InitLocalLinkPlayer + ldr r1, =gLocalLinkPlayerBlock adds r2, r1, 0 adds r2, 0x10 - ldr r0, =gUnknown_020229CC + ldr r0, =gLocalLinkPlayer ldm r0!, {r3-r5} stm r2!, {r3-r5} ldm r0!, {r3,r4,r6} @@ -1307,7 +1159,7 @@ sub_800B348: @ 800B348 strh r2, [r0] ldrb r2, [r3, 0x2] strb r2, [r0, 0x2] - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r2, 0x3C bl memcpy pop {r4-r6} @@ -1353,7 +1205,7 @@ sub_800B3A4: @ 800B3A4 cmp r0, 0 beq _0800B3F4 _0800B3EE: - ldr r0, =c2_800ACD4 + ldr r0, =CB2_LinkError bl SetMainCallback2 _0800B3F4: pop {r4-r6} @@ -1369,14 +1221,14 @@ HandleLinkConnection: @ 800B40C ldrb r0, [r0] cmp r0, 0 bne _0800B45C - ldr r0, =gUnknown_03003144 - ldr r1, =gUnknown_03003110 - ldr r2, =gUnknown_03003090 + ldr r0, =gShouldAdvanceLinkState + ldr r1, =gSendCmd + ldr r2, =gRecvCmds bl sub_800B638 - ldr r4, =gUnknown_030030E0 + ldr r4, =gLinkStatus str r0, [r4] ldr r0, =gMain+0x2c - bl sub_80099E0 + bl LinkMain2 ldr r0, [r4] movs r1, 0x80 lsls r1, 1 @@ -1466,7 +1318,7 @@ sub_800B4DC: @ 800B4DC ldrb r0, [r0] cmp r0, 0 bne _0800B4FC - ldr r0, =gUnknown_03003170 + ldr r0, =gLink ldr r1, =0x00000fbd adds r0, r1 ldrb r0, [r0] @@ -1516,8 +1368,8 @@ sub_800B524: @ 800B524 bx r0 thumb_func_end sub_800B524 - thumb_func_start sub_800B53C -sub_800B53C: @ 800B53C + thumb_func_start DisableSerial +DisableSerial: @ 800B53C push {lr} sub sp, 0x4 movs r0, 0xC0 @@ -1541,7 +1393,7 @@ sub_800B53C: @ 800B53C str r0, [r2] str r1, [r2, 0x4] str r0, [sp] - ldr r1, =gUnknown_03003170 + ldr r1, =gLink ldr r2, =0x050003f0 mov r0, sp bl CpuSet @@ -1549,10 +1401,10 @@ sub_800B53C: @ 800B53C pop {r0} bx r0 .pool - thumb_func_end sub_800B53C + thumb_func_end DisableSerial - thumb_func_start sub_800B594 -sub_800B594: @ 800B594 + thumb_func_start EnableSerial +EnableSerial: @ 800B594 push {r4,r5,lr} sub sp, 0x4 movs r0, 0xC0 @@ -1576,7 +1428,7 @@ sub_800B594: @ 800B594 strh r4, [r0] movs r5, 0 str r5, [sp] - ldr r1, =gUnknown_03003170 + ldr r1, =gLink ldr r2, =0x050003f0 mov r0, sp bl CpuSet @@ -1599,16 +1451,16 @@ sub_800B594: @ 800B594 pop {r0} bx r0 .pool - thumb_func_end sub_800B594 + thumb_func_end EnableSerial - thumb_func_start sub_800B628 -sub_800B628: @ 800B628 + thumb_func_start ResetSerial +ResetSerial: @ 800B628 push {lr} - bl sub_800B594 - bl sub_800B53C + bl EnableSerial + bl DisableSerial pop {r0} bx r0 - thumb_func_end sub_800B628 + thumb_func_end ResetSerial thumb_func_start sub_800B638 sub_800B638: @ 800B638 @@ -1616,7 +1468,7 @@ sub_800B638: @ 800B638 adds r4, r0, 0 adds r5, r1, 0 adds r6, r2, 0 - ldr r0, =gUnknown_03003170 + ldr r0, =gLink ldrb r0, [r0, 0x1] cmp r0, 0x4 bhi _0800B6EA @@ -1634,8 +1486,8 @@ _0800B65C: .4byte _0800B6D4 .4byte _0800B6DE _0800B670: - bl sub_800B53C - ldr r1, =gUnknown_03003170 + bl DisableSerial + ldr r1, =gLink movs r0, 0x1 strb r0, [r1, 0x1] b _0800B6EA @@ -1644,8 +1496,8 @@ _0800B680: ldrb r0, [r4] cmp r0, 0x1 bne _0800B6EA - bl sub_800B594 - ldr r1, =gUnknown_03003170 + bl EnableSerial + ldr r1, =gLink movs r0, 0x2 strb r0, [r1, 0x1] b _0800B6EA @@ -1659,7 +1511,7 @@ _0800B698: bl sub_800B764 b _0800B6EA _0800B6A8: - ldr r2, =gUnknown_03003170 + ldr r2, =gLink ldrb r0, [r2] cmp r0, 0x8 bne _0800B6EA @@ -1670,7 +1522,7 @@ _0800B6A8: b _0800B6EA .pool _0800B6C0: - ldr r0, =gUnknown_03003170 + ldr r0, =gLink movs r1, 0 strb r1, [r0, 0x1] ldr r0, =0x0400012a @@ -1679,7 +1531,7 @@ _0800B6C0: .pool _0800B6D4: bl sub_800B790 - ldr r1, =gUnknown_03003170 + ldr r1, =gLink movs r0, 0x4 strb r0, [r1, 0x1] _0800B6DE: @@ -1690,7 +1542,7 @@ _0800B6DE: _0800B6EA: movs r0, 0 strb r0, [r4] - ldr r1, =gUnknown_03003170 + ldr r1, =gLink ldrb r2, [r1, 0x2] ldrb r0, [r1, 0x3] lsls r0, 2 @@ -1762,7 +1614,7 @@ sub_800B764: @ 800B764 ldr r1, [r0] movs r0, 0xC ands r1, r0 - ldr r2, =gUnknown_03003170 + ldr r2, =gLink cmp r1, 0x8 bne _0800B788 ldrb r0, [r2, 0x2] @@ -1782,7 +1634,7 @@ _0800B78C: thumb_func_start sub_800B790 sub_800B790: @ 800B790 push {lr} - ldr r0, =gUnknown_03003170 + ldr r0, =gLink ldrb r0, [r0] cmp r0, 0 beq _0800B7AE @@ -1815,7 +1667,7 @@ sub_800B7C0: @ 800B7C0 strh r0, [r2] movs r0, 0 strh r0, [r1] - ldr r1, =gUnknown_03003170 + ldr r1, =gLink ldr r4, =0x00000339 adds r0, r1, r4 ldrb r4, [r0] @@ -1920,7 +1772,7 @@ sub_800B8A8: @ 800B8A8 strh r0, [r2] movs r0, 0 strh r0, [r1] - ldr r1, =gUnknown_03003170 + ldr r1, =gLink ldr r3, =0x00000fbd adds r0, r1, r3 ldrb r0, [r0] @@ -2042,7 +1894,7 @@ _0800B990: thumb_func_start sub_800B9B8 sub_800B9B8: @ 800B9B8 push {r4,lr} - ldr r3, =gUnknown_03003170 + ldr r3, =gLink ldrb r4, [r3] cmp r4, 0 beq _0800B9F4 @@ -2114,7 +1966,7 @@ Timer3Intr: @ 800BA28 thumb_func_start sub_800BA38 sub_800BA38: @ 800BA38 push {r4,lr} - ldr r4, =gUnknown_03003170 + ldr r4, =gLink ldr r0, =0x04000128 ldr r1, [r0] lsls r0, r1, 26 @@ -2150,7 +2002,7 @@ _0800BA86: movs r0, 0x4 strb r0, [r4, 0x1] _0800BA8A: - ldr r3, =gUnknown_03003170 + ldr r3, =gLink ldrb r0, [r3, 0xD] adds r0, 0x1 movs r2, 0 @@ -2192,7 +2044,7 @@ sub_800BAD0: @ 800BAD0 push {r6,r7} movs r5, 0 ldr r6, =0x0000ffff - ldr r0, =gUnknown_03003170 + ldr r0, =gLink ldrb r1, [r0, 0xE] adds r7, r0, 0 cmp r1, 0x1 @@ -2207,7 +2059,7 @@ _0800BAFC: _0800BB00: adds r0, r2, 0 strh r0, [r1] - ldr r2, =gUnknown_03003170+0x4 + ldr r2, =gLink+0x4 ldr r3, =0x04000120 ldr r0, [r3] ldr r1, [r3, 0x4] @@ -2313,7 +2165,7 @@ sub_800BBCC: @ 800BBCC ldr r0, [r0] str r0, [sp] str r1, [sp, 0x4] - ldr r0, =gUnknown_03003170 + ldr r0, =gLink ldrb r1, [r0, 0x16] adds r6, r0, 0 cmp r1, 0 @@ -2447,7 +2299,7 @@ _0800BCD0: thumb_func_start sub_800BCE4 sub_800BCE4: @ 800BCE4 push {r4,lr} - ldr r0, =gUnknown_03003170 + ldr r0, =gLink ldrb r1, [r0, 0x16] adds r4, r0, 0 cmp r1, 0x8 @@ -2533,7 +2385,7 @@ _0800BD8C: thumb_func_start sub_800BD98 sub_800BD98: @ 800BD98 push {lr} - ldr r0, =gUnknown_03003170 + ldr r0, =gLink ldrb r0, [r0] cmp r0, 0 beq _0800BDB4 @@ -2555,7 +2407,7 @@ _0800BDB4: thumb_func_start sub_800BDCC sub_800BDCC: @ 800BDCC push {lr} - ldr r1, =gUnknown_03003170 + ldr r1, =gLink ldrb r0, [r1, 0x17] cmp r0, 0x8 bne _0800BDE4 @@ -2582,7 +2434,7 @@ _0800BDF4: thumb_func_start sub_800BDFC sub_800BDFC: @ 800BDFC push {r4-r6,lr} - ldr r1, =gUnknown_03003170 + ldr r1, =gLink ldr r2, =0x00000339 adds r0, r1, r2 movs r2, 0 @@ -2624,7 +2476,7 @@ _0800BE22: thumb_func_start sub_800BE50 sub_800BE50: @ 800BE50 push {r4-r7,lr} - ldr r1, =gUnknown_03003170 + ldr r1, =gLink ldr r2, =0x00000fbd adds r0, r1, r2 movs r2, 0 diff --git a/asm/link_rfu.s b/asm/link_rfu.s index a2b90dc7a..4b5a3b6b5 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5084,13 +5084,13 @@ _0800E64A: adds r0, r4, 0 bl sub_800D724 strh r5, [r7] - ldr r1, =gUnknown_03003110 + ldr r1, =gSendCmd ldr r2, =0x01000008 adds r0, r7, 0 bl CpuSet mov r0, r8 strh r5, [r0] - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r2, =0x01000028 bl CpuSet mov r0, r9 @@ -5143,7 +5143,7 @@ sub_800E700: @ 800E700 lsrs r1, r0, 16 cmp r1, 0 bne _0800E732 - ldr r0, =gUnknown_020229C6 + ldr r0, =gLinkType strh r1, [r0] bl sub_800AAF4 movs r0, 0 @@ -6115,7 +6115,7 @@ sub_800EFB0: @ 800EFB0 push {r4-r7,lr} sub sp, 0x4 movs r2, 0 - ldr r7, =gUnknown_03003090 + ldr r7, =gRecvCmds ldr r0, =gUnknown_03005000 adds r6, r7, 0 ldr r1, =0x00000c87 @@ -6160,8 +6160,8 @@ _0800EFD0: thumb_func_start sub_800F014 sub_800F014: @ 800F014 push {lr} - ldr r3, =gUnknown_03003110 - ldr r2, =gUnknown_03003090 + ldr r3, =gSendCmd + ldr r2, =gRecvCmds movs r1, 0x6 _0800F01C: ldrh r0, [r3] @@ -6171,7 +6171,7 @@ _0800F01C: subs r1, 0x1 cmp r1, 0 bge _0800F01C - ldr r1, =gUnknown_03003110 + ldr r1, =gSendCmd movs r2, 0 adds r0, r1, 0 adds r0, 0xC @@ -6250,7 +6250,7 @@ _0800F0C4: .pool _0800F0CC: movs r3, 0 - ldr r4, =gUnknown_03003090 + ldr r4, =gRecvCmds _0800F0D0: movs r2, 0 lsls r0, r3, 4 @@ -6518,7 +6518,7 @@ _0800F2E0: str r2, [sp, 0x4] adds r5, 0x1 str r5, [sp] - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds mov r9, r1 adds r5, r3, 0 adds r7, r4, 0 @@ -6745,7 +6745,7 @@ sub_800F4F0: @ 800F4F0 mov r1, sp bl sub_800D934 movs r1, 0 - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds mov r12, r0 _0800F506: movs r4, 0 @@ -6849,7 +6849,7 @@ _0800F5C0: ldrb r1, [r2] strb r0, [r2] bl sub_8010528 - ldr r5, =gUnknown_03003110 + ldr r5, =gSendCmd add r4, sp, 0x48 adds r0, r5, 0 adds r1, r4, 0 @@ -7069,7 +7069,7 @@ rfu_func_080F97B8: @ 800F794 ldrh r2, [r3] cmp r2, 0 beq _0800F7C6 - ldr r0, =gUnknown_030022B4 + ldr r0, =gLinkTransferringData ldrb r0, [r0] cmp r0, 0x1 beq _0800F7C6 @@ -7143,7 +7143,7 @@ sub_800F820: @ 800F820 cmp r0, 0 bne _0800F83C bl sub_8082D18 - ldr r1, =gUnknown_03003110 + ldr r1, =gSendCmd strh r0, [r1, 0xC] _0800F83C: ldr r1, =gUnknown_020223C0 @@ -7182,7 +7182,7 @@ sub_800F86C: @ 800F86C _0800F87A: mov r1, r8 lsls r0, r1, 4 - ldr r2, =gUnknown_03003090 + ldr r2, =gRecvCmds adds r1, r0, r2 ldrh r7, [r1] movs r3, 0xFF @@ -7282,12 +7282,12 @@ _0800F920: beq _0800F930 b _0800FC08 _0800F930: - ldr r1, =gUnknown_03003090+0x2 + ldr r1, =gRecvCmds+0x2 adds r0, r5, r1 ldrh r0, [r0] ldr r2, =gUnknown_03005000 strb r0, [r2, 0xD] - ldr r3, =gUnknown_03003090+0x4 + ldr r3, =gRecvCmds+0x4 adds r0, r5, r3 bl sub_800F74C ldr r4, =gUnknown_03005CCE @@ -7317,13 +7317,13 @@ _0800F982: adds r0, 0x80 movs r2, 0 strh r4, [r0] - ldr r1, =gUnknown_03003090+0x2 + ldr r1, =gRecvCmds+0x2 adds r0, r5, r1 ldrh r0, [r0] adds r1, r3, 0 adds r1, 0x82 strh r0, [r1] - ldr r1, =gUnknown_03003090+0x4 + ldr r1, =gRecvCmds+0x4 adds r0, r5, r1 ldrh r1, [r0] adds r0, r3, 0 @@ -7392,7 +7392,7 @@ _0800FA0E: adds r2, r4, 0x1 lsls r0, r2, 1 adds r0, r3 - ldr r4, =gUnknown_03003090 + ldr r4, =gRecvCmds adds r0, r4 ldrh r0, [r0] strh r0, [r1] @@ -7453,7 +7453,7 @@ _0800FA90: .pool _0800FAAC: ldr r2, =gUnknown_082ED6B8 - ldr r3, =gUnknown_03003090+0x2 + ldr r3, =gRecvCmds+0x2 adds r0, r5, r3 ldrh r1, [r0] lsls r1, 3 @@ -7477,7 +7477,7 @@ _0800FAE0: movs r4, 0x80 lsls r4, 1 adds r0, r2, r4 - ldr r3, =gUnknown_03003090+0x2 + ldr r3, =gRecvCmds+0x2 adds r1, r5, r3 ldrh r0, [r0] mov r6, r8 @@ -7505,7 +7505,7 @@ _0800FB10: adds r6, 0x1 cmp r0, 0 beq _0800FC08 - ldr r0, =gUnknown_03003090+0x2 + ldr r0, =gRecvCmds+0x2 adds r4, r5, r0 ldrh r1, [r4] ldr r0, =gUnknown_03007890 @@ -7516,14 +7516,14 @@ _0800FB10: beq _0800FB48 strb r2, [r3] bl sub_800D630 - ldr r1, =gUnknown_03003090+0x4 + ldr r1, =gRecvCmds+0x4 adds r0, r5, r1 ldrh r1, [r0] ldr r2, =0x00000ce4 adds r0, r7, r2 strb r1, [r0] _0800FB48: - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds adds r0, 0x6 adds r0, r5, r0 ldrh r0, [r0] @@ -7536,16 +7536,16 @@ _0800FB78: movs r0, 0xEE lsls r0, 8 bl sub_800FD14 - ldr r1, =gUnknown_03003110 - ldr r3, =gUnknown_03003090+0x2 + ldr r1, =gSendCmd + ldr r3, =gRecvCmds+0x2 adds r0, r5, r3 ldrh r0, [r0] strh r0, [r1, 0x2] - ldr r4, =gUnknown_03003090+0x4 + ldr r4, =gRecvCmds+0x4 adds r0, r5, r4 ldrh r0, [r0] strh r0, [r1, 0x4] - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds adds r0, 0x6 adds r0, r5, r0 ldrh r0, [r0] @@ -7561,13 +7561,13 @@ _0800FBB0: bne _0800FC44 ldr r0, =0x00000ce3 adds r2, r4, r0 - ldr r1, =gUnknown_03003090+0x2 + ldr r1, =gRecvCmds+0x2 adds r3, r5, r1 ldrb r1, [r3] ldrb r0, [r2] orrs r0, r1 strb r0, [r2] - ldr r2, =gUnknown_03003090+0x4 + ldr r2, =gRecvCmds+0x4 adds r0, r5, r2 ldrh r1, [r0] ldr r2, =0x00000ce4 @@ -7582,7 +7582,7 @@ _0800FBF4: mov r3, r8 lsls r1, r3, 1 adds r1, r0 - ldr r4, =gUnknown_03003090+0x2 + ldr r4, =gRecvCmds+0x2 adds r0, r5, r4 ldrh r0, [r0] strh r0, [r1] @@ -7747,7 +7747,7 @@ sub_800FD14: @ 800FD14 push {r4,r5,lr} lsls r0, 16 lsrs r1, r0, 16 - ldr r5, =gUnknown_03003110 + ldr r5, =gSendCmd strh r1, [r5] movs r0, 0xF0 lsls r0, 7 @@ -7900,7 +7900,7 @@ _0800FE46: sub_800FE50: @ 800FE50 push {r4,lr} adds r4, r0, 0 - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 bne _0800FE76 @@ -7934,7 +7934,7 @@ sub_800FE84: @ 800FE84 ldr r0, [r5] cmp r0, 0 bne _0800FEB8 - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 bne _0800FEB8 @@ -7986,7 +7986,7 @@ _0800FEC8: str r7, [r5, 0x70] b _0800FF1C _0800FF0A: - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer cmp r7, r4 beq _0800FF1A adds r0, r4, 0 @@ -8019,7 +8019,7 @@ _0800FF32: thumb_func_start rfufunc_80F9F44 rfufunc_80F9F44: @ 800FF4C push {r4,r5,lr} - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 bne _0800FFA0 @@ -8044,7 +8044,7 @@ rfufunc_80F9F44: @ 800FF4C .pool _0800FF84: bl GetMultiplayerId - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds lsls r0, 24 lsrs r0, 20 adds r0, r1 @@ -8070,7 +8070,7 @@ sub_800FFB0: @ 800FFB0 ldr r0, =gUnknown_03005000 mov r12, r0 ldr r5, [r0, 0x70] - ldr r3, =gUnknown_03003110 + ldr r3, =gSendCmd mov r2, r12 adds r2, 0x6C ldrh r1, [r2] @@ -8139,7 +8139,7 @@ rfufunc_80FA020: @ 8010028 ldrb r0, [r5, 0xC] cmp r0, 0 bne _080100F0 - ldr r3, =gUnknown_03003110 + ldr r3, =gSendCmd adds r2, r5, 0 adds r2, 0x6E ldrh r0, [r2] @@ -8150,7 +8150,7 @@ rfufunc_80FA020: @ 8010028 strh r0, [r3] movs r4, 0 mov r9, r5 - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds mov r12, r0 lsls r5, r6, 4 adds r7, r2, 0 @@ -8376,7 +8376,7 @@ _08010220: thumb_func_start sub_801022C sub_801022C: @ 801022C push {r4,lr} - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 bne _0801024E @@ -8531,7 +8531,7 @@ sub_8010358: @ 8010358 ldrb r0, [r0] cmp r0, 0 bne _0801037A - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 bne _0801037A @@ -8560,7 +8560,7 @@ sub_8010390: @ 8010390 ldrb r0, [r0] cmp r0, 0 bne _0801041E - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 bne _0801041E @@ -8603,7 +8603,7 @@ _080103FA: ldrb r0, [r0] cmp r0, 0 bne _0801041E - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 bne _0801041E @@ -9241,7 +9241,7 @@ _080108F0: b _080109D2 .pool _08010904: - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 bne _080109D2 @@ -9513,7 +9513,7 @@ _08010B28: .4byte _08010C0A .4byte _08010C94 _08010B40: - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 beq _08010B4A @@ -9527,7 +9527,7 @@ _08010B4A: b _08010C4A .pool _08010B60: - ldr r0, =gUnknown_03003110 + ldr r0, =gSendCmd ldrh r0, [r0] cmp r0, 0 beq _08010B6A @@ -9571,7 +9571,7 @@ _08010B8C: b _08010C4A .pool _08010BC0: - ldr r5, =gUnknown_020228C4 + ldr r5, =gBlockSendBuffer adds r1, r5, 0 ldr r0, =gUnknown_082ED7EC ldm r0!, {r2-r4} @@ -9609,7 +9609,7 @@ _08010BE2: adds r0, 0x1 strh r0, [r1, 0x8] _08010C0A: - ldr r5, =gUnknown_020228C4 + ldr r5, =gBlockSendBuffer ldr r1, =gUnknown_03005000 ldrb r0, [r1, 0xD] strb r0, [r5, 0xF] @@ -9633,7 +9633,7 @@ _08010C20: mov r1, r12 movs r2, 0x8C bl memcpy - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer movs r0, 0 movs r2, 0xA0 bl SendBlock @@ -9758,7 +9758,7 @@ _08010D56: cmp r0, 0 beq _08010DA6 bl sub_800B348 - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer movs r0, 0 movs r2, 0x3C bl SendBlock @@ -9824,7 +9824,7 @@ _08010DDE: movs r0, 0x2 strb r0, [r1] _08010DE4: - ldr r4, =c2_800ACD4 + ldr r4, =CB2_LinkError adds r0, r4, 0 bl SetMainCallback2 ldr r0, =gMain @@ -9862,7 +9862,7 @@ _08010E20: ldrb r1, [r0] movs r1, 0x2 strb r1, [r0] - bl sub_80097E8 + bl CloseLink b _08010E8E .pool _08010E5C: @@ -11412,7 +11412,7 @@ sub_8011AC8: @ 8011AC8 sub sp, 0x4 movs r0, 0 str r0, [sp] - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldr r2, =0x05000014 mov r0, sp bl CpuSet @@ -11445,12 +11445,12 @@ sub_8011AFC: @ 8011AFC lsls r0, 24 cmp r0, 0 beq _08011B70 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001111 adds r0, r2, 0 strh r0, [r1] bl sub_800B488 - bl sub_8009734 + bl OpenLink ldr r0, =gMain ldrh r0, [r0, 0x24] bl SeedRng diff --git a/asm/mystery_event_menu.s b/asm/mystery_event_menu.s index df8e443a1..a1a90cd4d 100644 --- a/asm/mystery_event_menu.s +++ b/asm/mystery_event_menu.s @@ -84,7 +84,7 @@ _081789AC: movs r0, 0x50 movs r1, 0 bl SetGpuReg - ldr r0, =sub_8009404 + ldr r0, =Task_DestroySelf movs r1, 0 bl CreateTask bl StopMapMusic @@ -232,15 +232,15 @@ _08178B56: ldrb r0, [r1] adds r0, 0x1 strb r0, [r1] - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00005501 adds r0, r2, 0 strh r0, [r1] - bl sub_8009734 + bl OpenLink b _08178E58 .pool _08178B80: - ldr r0, =gUnknown_030030E0 + ldr r0, =gLinkStatus ldr r1, [r0] movs r0, 0x20 ands r0, r1 @@ -327,7 +327,7 @@ _08178C38: _08178C42: movs r0, 0x5 bl PlaySE - bl sub_80097E8 + bl CloseLink movs r0, 0x87 lsls r0, 3 adds r1, r4, r0 @@ -345,7 +345,7 @@ _08178C54: _08178C68: movs r0, 0x2 movs r1, 0x2 - bl sub_800A0C8 + bl GetLinkPlayerDataExchangeStatusTimed lsls r0, 24 lsrs r0, 24 cmp r0, 0x3 @@ -383,7 +383,7 @@ _08178CAC: b _08178E34 .pool _08178CCC: - bl sub_80097E8 + bl CloseLink _08178CD0: ldr r4, =gStringVar4 adds r0, r4, 0 @@ -416,7 +416,7 @@ _08178D00: _08178D0E: movs r0, 0x5 bl PlaySE - bl sub_80097E8 + bl CloseLink movs r2, 0x87 lsls r2, 3 adds r1, r4, r2 @@ -560,7 +560,7 @@ _08178E48: bne _08178E58 bl DoSoftReset _08178E58: - ldr r0, =gUnknown_030030E0 + ldr r0, =gLinkStatus ldr r0, [r0] movs r1, 0x40 ands r0, r1 @@ -570,7 +570,7 @@ _08178E58: lsls r0, 24 cmp r0, 0 bne _08178E98 - bl sub_80097E8 + bl CloseLink ldr r4, =gStringVar4 adds r0, r4, 0 movs r1, 0x1 diff --git a/asm/pokenav.s b/asm/pokenav.s index 86fe8813e..1ccb893af 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -25789,7 +25789,7 @@ sub_81D3B54: @ 81D3B54 adds r5, r1, 0 bl sub_81D41A0 movs r7, 0x2 - ldr r4, =gUnknown_03003144 + ldr r4, =gShouldAdvanceLinkState _081D3B64: bl sub_81D4170 ldr r0, =gUnknown_030012E2 @@ -25857,7 +25857,7 @@ sub_81D3BE8: @ 81D3BE8 adds r5, r0, 0 bl sub_81D41A0 movs r6, 0x2 - ldr r4, =gUnknown_03003144 + ldr r4, =gShouldAdvanceLinkState _081D3BF6: bl sub_81D4170 ldr r0, =gUnknown_030012E2 @@ -26006,7 +26006,7 @@ sub_81D3D34: @ 81D3D34 movs r1, 0x8 orrs r0, r1 strh r0, [r2] - ldr r0, =gUnknown_03003144 + ldr r0, =gShouldAdvanceLinkState strb r3, [r0] ldr r0, =gUnknown_030012E6 strh r3, [r0] @@ -26062,7 +26062,7 @@ _081D3DC8: beq _081D3DD8 bl sub_81D413C _081D3DD8: - ldr r0, =gUnknown_03003144 + ldr r0, =gShouldAdvanceLinkState ldrb r0, [r0] cmp r0, 0x2 beq _081D3DE2 @@ -26080,7 +26080,7 @@ _081D3DE8: movs r0, 0x3 strb r0, [r1, 0x1] _081D3DFC: - ldr r0, =gUnknown_03003144 + ldr r0, =gShouldAdvanceLinkState ldrb r0, [r0] cmp r0, 0x2 bne _081D3E18 @@ -28050,7 +28050,7 @@ _081D4E12: beq _081D4E1C movs r5, 0x3 _081D4E1C: - ldr r1, =gUnknown_03003144 + ldr r1, =gShouldAdvanceLinkState movs r0, 0 strb r0, [r1] adds r0, r5, 0 @@ -28068,13 +28068,13 @@ sub_81D4E30: @ 81D4E30 lsls r2, 6 movs r1, 0 bl memset - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00005503 adds r0, r2, 0 strh r0, [r1] - bl sub_8009734 + bl OpenLink movs r0, 0x1 - bl sub_800B330 + bl SetSuppressLinkErrorMessage pop {r0} bx r0 .pool @@ -28090,7 +28090,7 @@ sub_81D4E60: @ 81D4E60 strh r0, [r1] movs r0, 0 strh r0, [r2] - ldr r0, =gUnknown_03003170+0x4 + ldr r0, =gLink+0x4 ldr r1, [r0, 0x4] ldr r0, [r0] str r0, [sp, 0x4] @@ -28256,7 +28256,7 @@ _081D4FB6: ldrb r0, [r0] cmp r0, 0 beq _081D4FE6 - bl sub_800A23C + bl IsLinkPlayerDataExchangeComplete lsls r0, 24 cmp r0, 0 beq _081D4FE0 @@ -28447,7 +28447,7 @@ _081D515C: beq _081D5166 b _081D52FC _081D5166: - bl sub_80097E8 + bl CloseLink b _081D525C _081D516C: adds r0, r4, 0 @@ -28500,7 +28500,7 @@ _081D51D0: beq _081D51F4 movs r0, 0x5 bl PlaySE - bl sub_80097E8 + bl CloseLink adds r0, r4, 0 bl sub_81D505C b _081D535A @@ -28513,7 +28513,7 @@ _081D51F4: bls _081D5210 adds r0, r4, 0 bl sub_81D505C - bl sub_80097E8 + bl CloseLink movs r0, 0x7 strb r0, [r4, 0x8] b _081D548A @@ -28523,7 +28523,7 @@ _081D5210: beq _081D522E movs r0, 0x5 bl PlaySE - bl sub_80097E8 + bl CloseLink adds r0, r4, 0 bl sub_81D505C movs r0, 0x8 @@ -28537,7 +28537,7 @@ _081D522E: bne _081D523C b _081D548A _081D523C: - bl sub_80097E8 + bl CloseLink bl sub_81D4E30 adds r0, r4, 0 bl sub_81D505C @@ -28654,13 +28654,13 @@ _081D5340: _081D5350: movs r0, 0x5 bl PlaySE - bl sub_80097E8 + bl CloseLink _081D535A: movs r0, 0x17 strb r0, [r4, 0x8] b _081D548A _081D5360: - bl sub_80097E8 + bl CloseLink movs r0, 0x15 strb r0, [r4, 0x8] b _081D548A @@ -28670,7 +28670,7 @@ _081D536A: cmp r0, 0 beq _081D537A _081D5374: - bl sub_80097E8 + bl CloseLink b _081D53C0 _081D537A: bl GetBlockReceivedStatus diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 8a1f41126..89507d3f3 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -747,7 +747,7 @@ _080E7384: movs r0, 0xC8 lsls r0, 1 strh r0, [r5, 0x8] - bl sub_8009FAC + bl ClearLinkCallback_2 b _080E7566 .pool _080E73A0: @@ -993,7 +993,7 @@ _080E75AC: movs r0, 0xC8 muls r0, r2 adds r1, r0 - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r2, 0xC8 bl memcpy b _080E75FC diff --git a/asm/rom4.s b/asm/rom4.s index a7e98d013..819cbea81 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -3584,7 +3584,7 @@ sub_808631C: @ 808631C lsrs r0, 24 cmp r0, 0x1 bne _0808632E - bl sub_80097E8 + bl CloseLink _0808632E: ldr r0, =gSerialIsRFU ldrb r0, [r0] @@ -5950,7 +5950,7 @@ sub_8087690: @ 8087690 ldrb r0, [r0] cmp r0, 0 bne _080876B0 - ldr r0, =gUnknown_03003170 + ldr r0, =gLink ldr r1, =0x00000339 adds r0, r1 ldrb r0, [r0] diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index fc70f498a..e429ae6af 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -70,7 +70,7 @@ sub_8011E2C: @ 8011E2C push {r4-r6,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r6, =gUnknown_03003110 + ldr r6, =gSendCmd ldrh r0, [r6] cmp r0, 0 bne _08011E7A @@ -1244,7 +1244,7 @@ _08012848: movs r2, 0 bl sub_8010F84 bl sub_800B488 - bl sub_8009734 + bl OpenLink ldrb r1, [r4] movs r0, 0xF ands r0, r1 @@ -2752,7 +2752,7 @@ _08013590: movs r2, 0 bl sub_8010F84 bl sub_800B488 - bl sub_8009734 + bl OpenLink bl sub_8011C5C movs r0, 0x70 bl AllocZeroed @@ -3500,7 +3500,7 @@ _08013CD0: movs r2, 0 bl sub_8010F84 bl sub_800B488 - bl sub_8009734 + bl OpenLink bl sub_8011C5C movs r0, 0x1 bl sub_80111B0 @@ -3934,7 +3934,7 @@ _08013FFC: b _0801405A .pool _08014038: - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer ldr r0, =gSaveBlock1Ptr ldr r1, [r0] ldr r0, =0x00002be0 @@ -4505,7 +4505,7 @@ _080145D8: .pool _080145F4: bl overworld_free_bg_tilemaps - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 bl sp000_heal_pokemon @@ -4524,7 +4524,7 @@ _08014620: bl sp000_heal_pokemon bl copy_player_party_to_sav1 bl copy_bags_and_unk_data_from_save_blocks - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 movs r0, 0x2 @@ -4540,7 +4540,7 @@ _0801464C: bl sp000_heal_pokemon bl copy_player_party_to_sav1 bl copy_bags_and_unk_data_from_save_blocks - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 movs r0, 0x5 @@ -4552,7 +4552,7 @@ _0801464C: b _080146B0 .pool _08014678: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 bl overworld_free_bg_tilemaps @@ -4565,7 +4565,7 @@ _08014678: b _080146B0 .pool _08014698: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 bl overworld_free_bg_tilemaps @@ -4605,7 +4605,7 @@ _080146F6: bl sub_801DD98 b _08014764 _080146FC: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0 bl sub_80143E4 ldr r0, =sub_80141A4 @@ -4675,7 +4675,7 @@ sub_8014790: @ 8014790 lsls r0, 3 ldr r1, =gTasks + 0x8 adds r7, r0, r1 - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer mov r9, r0 movs r1, 0 ldrsh r0, [r7, r1] @@ -4999,7 +4999,7 @@ _08014AB0: movs r1, 0 bl sub_8010FA0 bl sub_800B488 - bl sub_8009734 + bl OpenLink movs r0, 0x2 bl sub_8011C10 movs r0, 0x1 @@ -5537,7 +5537,7 @@ _08014FA4: movs r2, 0 bl sub_8010F84 bl sub_800B488 - bl sub_8009734 + bl OpenLink bl sub_8011C5C movs r0, 0x70 bl AllocZeroed @@ -5925,7 +5925,7 @@ _08015358: movs r2, 0 bl sub_8010F84 bl sub_800B488 - bl sub_8009734 + bl OpenLink bl sub_8011C5C movs r0, 0x70 bl AllocZeroed @@ -6475,7 +6475,7 @@ _08015878: ldrh r2, [r2, 0xC] bl sub_8010FCC bl sub_800B488 - bl sub_8009734 + bl OpenLink bl sub_8011C84 ldr r0, [r6, 0x8] movs r1, 0x1 @@ -6822,7 +6822,7 @@ _08015BBE: bne _08015BCA bl _08016878 _08015BCA: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 ldr r0, =sub_80140E0 @@ -7349,7 +7349,7 @@ _080160DA: bne _080160E4 b _08016878 _080160E4: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 ldr r0, =sub_80140E0 @@ -8184,7 +8184,7 @@ _08016894: sub_801689C: @ 801689C push {r4,r5,lr} adds r2, r0, 0 - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds ldrh r5, [r3, 0x12] adds r4, r5, 0 cmp r4, 0 @@ -8325,7 +8325,7 @@ _080169BE: movs r2, 0 bl sub_8010F84 bl sub_800B488 - bl sub_8009734 + bl OpenLink bl sub_8011C84 movs r0, 0x1 bl sub_80111B0 @@ -11147,7 +11147,7 @@ _08017FC6: sub_8017FD8: @ 8017FD8 push {lr} adds r2, r0, 0 - ldr r0, =gUnknown_03003090 + ldr r0, =gRecvCmds ldrh r1, [r0, 0x2] cmp r1, 0 beq _08017FFC @@ -14200,7 +14200,7 @@ _080198FE: b _08019922 .pool _0801990C: - bl sub_80097E8 + bl CloseLink ldr r0, [r5, 0x10] bl Free adds r0, r4, 0 @@ -16823,7 +16823,7 @@ _0801AE48: beq _0801AE54 b _0801AFAE _0801AE54: - ldr r4, =gUnknown_020228C4 + ldr r4, =gBlockSendBuffer adds r0, r4, 0 movs r1, 0 movs r2, 0x20 @@ -16840,7 +16840,7 @@ _0801AE78: movs r0, 0x51 _0801AE7A: strb r0, [r4] - ldr r1, =gUnknown_020228C4 + ldr r1, =gBlockSendBuffer movs r0, 0 movs r2, 0x20 bl SendBlock @@ -33351,7 +33351,7 @@ sub_802339C: @ 802339C mov r10, r3 _080233C0: lsls r0, r7, 4 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds adds r2, r0, r1 ldrh r1, [r2] movs r0, 0xFF @@ -33960,7 +33960,7 @@ sub_802385C: @ 802385C push {r4,r5,lr} adds r5, r0, 0 movs r4, 0 - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds ldrb r0, [r5, 0x9] cmp r4, r0 bcs _08023880 @@ -42728,7 +42728,7 @@ sub_8027DD0: @ 8027DD0 sub_8027DFC: @ 8027DFC push {lr} adds r2, r0, 0 - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds ldrh r0, [r3] movs r1, 0xFF lsls r1, 8 @@ -43184,7 +43184,7 @@ sub_8028164: @ 8028164 mov r9, r0 adds r2, r7, 0 adds r2, 0x14 - ldr r4, =gUnknown_03003090 + ldr r4, =gRecvCmds ldrh r0, [r4] movs r1, 0xFF lsls r1, 8 @@ -43397,7 +43397,7 @@ sub_8028318: @ 8028318 push {r4,lr} adds r2, r0, 0 adds r4, r1, 0 - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds ldrh r0, [r3] movs r1, 0xFF lsls r1, 8 @@ -43449,7 +43449,7 @@ sub_8028350: @ 8028350 sub_8028374: @ 8028374 push {lr} adds r2, r0, 0 - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds ldrh r0, [r3] movs r1, 0xFF lsls r1, 8 @@ -54921,7 +54921,7 @@ sub_802E0D0: @ 802E0D0 push {r4,lr} sub sp, 0xC adds r4, r1, 0 - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds lsls r2, r0, 4 adds r0, r2, r3 ldrh r1, [r0] @@ -55048,7 +55048,7 @@ sub_802E1BC: @ 802E1BC sub sp, 0xC adds r5, r0, 0 adds r4, r1, 0 - ldr r2, =gUnknown_03003090 + ldr r2, =gRecvCmds ldrh r0, [r2] movs r1, 0xFF lsls r1, 8 @@ -55138,7 +55138,7 @@ sub_802E264: @ 802E264 adds r4, r0, 0 adds r5, r2, 0 adds r6, r3, 0 - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds lsls r2, r1, 4 adds r0, r2, r3 ldrh r1, [r0] @@ -55193,7 +55193,7 @@ sub_802E2D0: @ 802E2D0 push {r4,lr} sub sp, 0xC adds r4, r0, 0 - ldr r3, =gUnknown_03003090 + ldr r3, =gRecvCmds lsls r2, r1, 4 adds r0, r2, r3 ldrh r1, [r0] @@ -56187,7 +56187,7 @@ sub_802EAB0: @ 802EAB0 ldrb r0, [r0] cmp r0, 0 beq _0802EB14 - ldr r1, =gUnknown_03003090 + ldr r1, =gRecvCmds ldrh r0, [r1, 0x2] ldr r5, =0x00007fff cmp r0, r5 diff --git a/asm/trade.s b/asm/trade.s index 61a814421..c32fd4209 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -401,7 +401,7 @@ _080774B2: ldrb r2, [r0] cmp r2, 0 bne _0807754C - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r5, =0x00001122 adds r0, r5, 0 strh r0, [r1] @@ -414,12 +414,12 @@ _080774B2: cmp r0, 0 beq _08077528 bl sub_800B488 - bl sub_8009734 + bl OpenLink bl sub_8011BA4 b _08077B46 .pool _08077528: - bl sub_8009734 + bl OpenLink ldr r0, =gMain movs r7, 0x87 lsls r7, 3 @@ -510,7 +510,7 @@ _080775E8: beq _080775F2 b _08077B46 _080775F2: - bl sub_800A23C + bl IsLinkPlayerDataExchangeComplete lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -2142,7 +2142,7 @@ _08078484: .4byte _080786F0 .4byte _08078720 _080784DC: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gPlayerParty movs r2, 0xC8 bl sub_8078438 @@ -2208,7 +2208,7 @@ _08078552: b _080787A2 .pool _0807857C: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gPlayerParty + 200 movs r2, 0xC8 bl sub_8078438 @@ -2247,7 +2247,7 @@ _080785B6: b _080787A2 .pool _080785E0: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gPlayerParty + 400 movs r2, 0xC8 bl sub_8078438 @@ -2286,7 +2286,7 @@ _0807861A: b _080787A2 .pool _08078644: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gSaveBlock1Ptr ldr r1, [r1] ldr r2, =0x00002be0 @@ -2328,7 +2328,7 @@ _0807868A: b _080787A2 .pool _080786B4: - ldr r0, =gUnknown_020228C4 + ldr r0, =gBlockSendBuffer ldr r1, =gSaveBlock1Ptr ldr r1, [r1] ldr r2, =0x000031a8 @@ -7024,8 +7024,8 @@ _0807AC92: lsls r0, 1 cmp r1, r0 bls _0807ACC4 - bl sub_80097E8 - ldr r0, =c2_800ACD4 + bl CloseLink + ldr r0, =CB2_LinkError bl SetMainCallback2 ldr r1, [r4] adds r3, r1, 0 @@ -7258,11 +7258,11 @@ _0807AEAC: ldrb r0, [r0] cmp r0, 0 bne _0807AEC0 - ldr r1, =gUnknown_020229C6 + ldr r1, =gLinkType ldr r2, =0x00001144 adds r0, r2, 0 strh r0, [r1] - bl sub_80097E8 + bl CloseLink _0807AEC0: ldr r4, =gUnknown_020322A0 movs r5, 0x80 @@ -7330,7 +7330,7 @@ _0807AF58: adds r0, 0xFA movs r1, 0x1 strb r1, [r0] - bl sub_8009734 + bl OpenLink ldr r1, =gMain movs r2, 0x87 lsls r2, 3 @@ -7407,7 +7407,7 @@ _0807B006: beq _0807B014 b _0807B116 _0807B014: - bl sub_800A23C + bl IsLinkPlayerDataExchangeComplete lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 diff --git a/common_syms/link.txt b/common_syms/link.txt index 22e3081ee..69a66331a 100644 --- a/common_syms/link.txt +++ b/common_syms/link.txt @@ -1 +1 @@ -gUnknown_03003130 +gLinkTestBGInfo diff --git a/common_syms/main.txt b/common_syms/main.txt index 8e0b9abf5..a620083d1 100644 --- a/common_syms/main.txt +++ b/common_syms/main.txt @@ -1,9 +1,9 @@ gKeyRepeatStartDelay -gUnknown_030022B4 +gLinkTransferringData gMain gKeyRepeatContinueDelay gSoftResetDisabled gIntrTable -gUnknown_03002748 +gLinkVSyncDisabled IntrMain_Buffer gPcmDmaCounter diff --git a/data/link_rfu.s b/data/link_rfu.s index c8ae0789f..3ecfe5e42 100644 --- a/data/link_rfu.s +++ b/data/link_rfu.s @@ -162,15 +162,15 @@ gUnknown_082ED6A5:: @ 82ED6A5 .align 2 gUnknown_082ED6B8:: @ 82ED6B8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000c8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000c8 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x00000064 - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x000000dc - .4byte gUnknown_020228C4 + .4byte gBlockSendBuffer .4byte 0x00000028 .align 2 diff --git a/data/specials.inc b/data/specials.inc index 49f6b91a0..c5beece6c 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -39,7 +39,7 @@ gSpecials:: @ 81DBA64 def_special sub_80B2E4C def_special sub_80B2E74 def_special sub_80B2EA8 - def_special sub_80097E8 + def_special CloseLink def_special sub_80B3968 def_special sub_80B3924 def_special nullsub_37 diff --git a/include/link.h b/include/link.h index 09e2789f5..917331c34 100644 --- a/include/link.h +++ b/include/link.h @@ -59,6 +59,9 @@ enum EXCHANGE_COMPLETE, EXCHANGE_TIMED_OUT, EXCHANGE_IN_PROGRESS, + EXCHANGE_STAT_4, + EXCHANGE_STAT_5, + EXCHANGE_STAT_6 }; enum @@ -146,8 +149,8 @@ struct BlockRequest extern const struct BlockRequest sBlockRequestLookupTable[5]; extern struct Link gLink; -extern u16 gRecvCmds[CMD_LENGTH][MAX_LINK_PLAYERS]; -extern u8 gUnknown_020228C4[BLOCK_BUFFER_SIZE]; // gBlockSendBuffer +extern u16 gRecvCmds[MAX_LINK_PLAYERS][CMD_LENGTH]; +extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; // gBlockSendBuffer extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; extern u16 gLinkType; extern u32 gLinkStatus; @@ -162,14 +165,14 @@ extern bool8 gSerialIsRFU; void Task_DestroySelf(u8); void OpenLink(void); void CloseLink(void); -u16 LinkMain2(u16 *); +u16 LinkMain2(const u16 *); void sub_8007B14(void); bool32 sub_8007B24(void); void ClearLinkCallback(void); void ClearLinkCallback_2(void); u8 GetLinkPlayerCount(void); void OpenLinkTimed(void); -u8 GetLinkPlayerDataExchangeStatusTimed(void); +u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper); bool8 IsLinkPlayerDataExchangeComplete(void); u32 GetLinkPlayerTrainerId(u8); void ResetLinkPlayers(void); @@ -181,7 +184,6 @@ bool8 SendBlock(u8, const void *, u16); u8 GetBlockReceivedStatus(void); void ResetBlockReceivedFlags(void); void ResetBlockReceivedFlag(u8); -void SetLinkDebugValues(u32, u32); u8 GetLinkPlayerCount_2(void); bool8 IsLinkMaster(void); void CB2_LinkError(void); @@ -201,43 +203,44 @@ bool8 sub_800A520(void); void sub_800DFB4(u8, u8); void sub_800ADF8(void); void sub_800B488(void); -void sub_8009734(void); void sub_800A620(void); void sub_8011BD0(void); u8 sub_800ABAC(void); u8 sub_800ABBC(void); void sub_800AC34(void); -void sub_800B628(void); -void sub_80097E8(void); -void sub_800A994(u32 seed, u8 flags); +void SetLinkDebugValues(u32 seed, u32 flags); void sub_800A418(void); +void SetSuppressLinkErrorMessage(bool8 flag); +void sub_800B524(struct LinkPlayer *linkPlayer); +u8 sub_800B2E8(void); +u8 sub_800B320(void); +u8 sub_800B33C(void); extern u16 gUnknown_03003020[6]; extern u32 gUnknown_0300302C; -extern struct LinkPlayerBlock gUnknown_03003030; -extern bool8 gUnknown_0300306C; +extern struct LinkPlayerBlock gLocalLinkPlayerBlock; +extern bool8 gLinkErrorOccurred; extern u32 gUnknown_03003070; extern bool8 gUnknown_03003078[4]; extern u8 gUnknown_0300307C[4]; -extern u16 gUnknown_03003084; -extern u16 gUnknown_03003090[4][8]; -extern u32 gUnknown_030030E0; +extern u16 gLinkHeldKeys; +extern u32 gLinkStatus; extern u8 gUnknown_030030E4; extern u8 gUnknown_030030E8; extern u8 gUnknown_030030EC[4]; extern u8 gUnknown_030030F0[4]; extern u16 gUnknown_030030F4; -extern u8 gUnknown_030030F8; +extern u8 gSuppressLinkErrorMessage; extern bool8 gSerialIsRFU; extern bool8 gUnknown_03003100; -extern u16 gUnknown_03003110[8]; extern u8 gUnknown_03003120; -extern struct LinkTestBGInfo gUnknown_03003130; -extern void (*gUnknown_03003140)(void); -extern bool8 gUnknown_03003144; -extern u16 gUnknown_03003148[4]; -extern u8 gUnknown_03003150; +extern struct LinkTestBGInfo gLinkTestBGInfo; +extern void (*gLinkCallback)(void); +extern bool8 gShouldAdvanceLinkState; +extern u16 gLinkTestBlockChecksums[4]; +extern u8 gBlockRequestType; extern u8 gUnknown_03003160; +extern u8 gUnknown_03004130; #endif // GUARD_LINK_H diff --git a/include/main.h b/include/main.h index 26a81e60a..5caa82cdf 100644 --- a/include/main.h +++ b/include/main.h @@ -46,12 +46,12 @@ extern const u8 gGameVersion; extern const u8 gGameLanguage; extern u16 gKeyRepeatStartDelay; -extern bool8 gUnknown_030022B4; +extern bool8 gLinkTransferringData; extern struct Main gMain; extern u16 gKeyRepeatContinueDelay; extern bool8 gSoftResetDisabled; extern IntrFunc gIntrTable[]; -extern u8 gUnknown_03002748; +extern u8 gLinkVSyncDisabled; extern u32 IntrMain_Buffer[]; extern u8 gPcmDmaCounter; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index d741a8a98..ce96fff6a 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -62,7 +62,7 @@ void HandleLinkBattleSetup(void) if (gSerialIsRFU) sub_800B488(); if (!gReceivedRemoteLinkPlayers) - sub_8009734(); + OpenLink(); CreateTask(task00_08081A90, 0); CreateTasksForSendRecvLinkBuffers(); } diff --git a/src/link.c b/src/link.c index bba217b4d..07598bc1f 100644 --- a/src/link.c +++ b/src/link.c @@ -40,16 +40,16 @@ struct LinkTestBGInfo // Static RAM declarations -IWRAM_DATA struct BlockTransfer gUnknown_03000D10; +IWRAM_DATA struct BlockTransfer sBlockSend; IWRAM_DATA u32 link_c_unused_03000d1c; -IWRAM_DATA struct BlockTransfer gUnknown_03000D20[MAX_LINK_PLAYERS]; -IWRAM_DATA u32 gUnknown_03000D50; +IWRAM_DATA struct BlockTransfer sBlockRecv[MAX_LINK_PLAYERS]; +IWRAM_DATA u32 sBlockSendDelayCounter; IWRAM_DATA u32 gUnknown_03000D54; IWRAM_DATA u8 gUnknown_03000D58; -IWRAM_DATA u32 gUnknown_03000D5C; +IWRAM_DATA u32 sPlayerDataExchangeStatus; IWRAM_DATA u32 gUnknown_03000D60; -IWRAM_DATA u8 gUnknown_03000D64; -ALIGNED() IWRAM_DATA u8 gUnknown_03000D68[MAX_LINK_PLAYERS]; +IWRAM_DATA u8 sLinkTestLastBlockSendPos; +ALIGNED() IWRAM_DATA u8 sLinkTestLastBlockRecvPos[MAX_LINK_PLAYERS]; IWRAM_DATA u8 gUnknown_03000D6C; IWRAM_DATA bool8 gUnknown_03000D6D; IWRAM_DATA u16 gUnknown_03000D6E; @@ -68,68 +68,68 @@ IWRAM_DATA bool32 gUnknown_03000DB0; u16 gUnknown_03003020[6]; u32 gUnknown_0300302C; -struct LinkPlayerBlock gUnknown_03003030; -bool8 gUnknown_0300306C; +struct LinkPlayerBlock gLocalLinkPlayerBlock; +bool8 gLinkErrorOccurred; u32 gUnknown_03003070; bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; -u16 gUnknown_03003084; -u16 gUnknown_03003090[MAX_LINK_PLAYERS][8]; -u32 gUnknown_030030E0; +u16 gLinkHeldKeys; +u16 gRecvCmds[MAX_LINK_PLAYERS][8]; +u32 gLinkStatus; u8 gUnknown_030030E4; bool8 gUnknown_030030E8; u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; u16 gUnknown_030030F4; -u8 gUnknown_030030F8; +u8 gSuppressLinkErrorMessage; bool8 gSerialIsRFU; bool8 gUnknown_03003100; -u16 gUnknown_03003110[8]; +u16 gSendCmd[8]; u8 gUnknown_03003120; bool8 gReceivedRemoteLinkPlayers; -struct LinkTestBGInfo gUnknown_03003130; -void (*gUnknown_03003140)(void); -bool8 gUnknown_03003144; -u16 gUnknown_03003148[MAX_LINK_PLAYERS]; -u8 gUnknown_03003150; +struct LinkTestBGInfo gLinkTestBGInfo; +void (*gLinkCallback)(void); +bool8 gShouldAdvanceLinkState; +u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; +u8 gBlockRequestType; u8 gUnknown_03003160; +struct Link gLink; +u8 gUnknown_03004130; -EWRAM_DATA u8 gUnknown_020223BC = 0; +EWRAM_DATA u8 gLinkTestDebugValuesEnabled = 0; EWRAM_DATA u8 gUnknown_020223BD = 0; EWRAM_DATA u32 gUnknown_020223C0 = 0; EWRAM_DATA u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2] = {}; -EWRAM_DATA u8 gUnknown_020228C4[BLOCK_BUFFER_SIZE] = {}; -EWRAM_DATA bool8 gUnknown_020229C4 = FALSE; -EWRAM_DATA u16 gUnknown_020229C6 = 0; -EWRAM_DATA u16 gUnknown_020229C8 = 0; -EWRAM_DATA struct LinkPlayer gUnknown_020229CC = {}; +EWRAM_DATA u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE] = {}; +EWRAM_DATA bool8 gLinkOpen = FALSE; +EWRAM_DATA u16 gLinkType = 0; +EWRAM_DATA u16 gLinkTimeOutCounter = 0; +EWRAM_DATA struct LinkPlayer gLocalLinkPlayer = {}; EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {}; EWRAM_DATA struct LinkPlayer gUnknown_02022A74[MAX_RFU_PLAYERS] = {}; // Static ROM declarations -void sub_8009638(void); +void InitLocalLinkPlayer(void); void sub_80096BC(void); -static void c2_08009A8C(void); -static void sub_8009AA0(u8 unused); +static void CB2_LinkTest(void); +static void ProcessRecvCmds(u8 unused); static void sub_8009F70(void); -static void sub_800A2E0(void); -bool32 sub_800A2F4(const void *src, size_t size); -static void sub_800A364(void); -static void sub_800A388(void); -static void sub_800A3EC(void); -void task00_link_test(u8 taskId); -void sub_800A588(u8 who); -u16 sub_800A648(const u16 *src, u16 size); -void sub_800A6E8(u32 pos, u8 a0, u8 a1, u8 a2); -void sub_800A824(void); -void c2_800ACD4(void); +static void ResetBlockSend(void); +static bool32 InitBlockSend(const void *src, size_t size); +static void LinkCB_BlockSendBegin(void); +static void LinkCB_BlockSend(void); +static void LinkCB_BlockSendEnd(void); +static void SetBlockReceivedFlag(u8 who); +static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size); +static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2); +static void LinkCB_RequestPlayerDataExchange(void); +static void task00_link_test(u8 taskId); void sub_800AEB4(void); -void sub_800B330(bool8 flag); +u8 sub_800B2F8(void); void sub_800B4A4(void); -void sub_800B524(struct LinkPlayer *linkPlayer); -void sub_800B53C(void); -void sub_800B594(void); +void DisableSerial(void); +void EnableSerial(void); // .rodata @@ -141,13 +141,13 @@ const u16 gLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits const u8 unkstring_82ed160[] = _("{HIGHLIGHT TRANSPARENT}{COLOR WHITE}"); const u16 g2BlankTilesGfx[] = INCBIN_U16("graphics/interface/blank_1x2.4bpp"); const struct BlockRequest gUnknown_082ED1A8[] = { - {gUnknown_020228C4, 200}, - {gUnknown_020228C4, 200}, - {gUnknown_020228C4, 100}, - {gUnknown_020228C4, 220}, - {gUnknown_020228C4, 40} + {gBlockSendBuffer, 200}, + {gBlockSendBuffer, 200}, + {gBlockSendBuffer, 100}, + {gBlockSendBuffer, 220}, + {gBlockSendBuffer, 40} }; -const u8 gUnknown_082ED1D0[] = { +const u8 gBGControlRegs[] = { REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, @@ -192,50 +192,50 @@ bool8 sub_80093CC(void) return TRUE; } sub_800B4A4(); - sub_80097E8(); + CloseLink(); RestoreSerialTimer3IntrHandlers(); return FALSE; } -void sub_8009404(u8 taskId) +void Task_DestroySelf(u8 taskId) { DestroyTask(taskId); } -void sub_8009414(u8 a0, u8 a1, u8 a2, u8 a3, u16 a4) +static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock, u16 a4) { - LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20); - DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3) + (16 * a4), sizeof gLinkTestDigitsGfx); - gUnknown_03003130.screenBaseBlock = a2; - gUnknown_03003130.paletteNum = a0; - gUnknown_03003130.dummy_8 = a4; - switch (a1) + LoadPalette(gLinkTestDigitsPal, paletteNum * 16, 0x20); + DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock) + (16 * a4), sizeof gLinkTestDigitsGfx); + gLinkTestBGInfo.screenBaseBlock = screenBaseBlock; + gLinkTestBGInfo.paletteNum = paletteNum; + gLinkTestBGInfo.dummy_8 = a4; + switch (bgNum) { case 1: - SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_SCREENBASE(a2) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(a3)); + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(charBaseBlock)); break; case 2: - SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_SCREENBASE(a2) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(a3)); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(charBaseBlock)); break; case 3: - SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_SCREENBASE(a2) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(a3)); + SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(charBaseBlock)); break; } - SetGpuReg(REG_OFFSET_BG0HOFS + a1 * 4, 0); - SetGpuReg(REG_OFFSET_BG0VOFS + a1 * 4, 0); + SetGpuReg(REG_OFFSET_BG0HOFS + bgNum * 4, 0); + SetGpuReg(REG_OFFSET_BG0VOFS + bgNum * 4, 0); } -void sub_80094EC(u8 a0, u8 a1, u8 a2, u8 a3) +void sub_80094EC(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock) { - LoadPalette(gLinkTestDigitsPal, a0 * 16, 0x20); - DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(a3), sizeof gLinkTestDigitsGfx); - gUnknown_03003130.screenBaseBlock = a2; - gUnknown_03003130.paletteNum = a0; - gUnknown_03003130.dummy_8 = 0; - SetGpuReg(gUnknown_082ED1D0[a1], BGCNT_SCREENBASE(a2) | BGCNT_CHARBASE(a3)); + LoadPalette(gLinkTestDigitsPal, paletteNum * 16, 0x20); + DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock), sizeof gLinkTestDigitsGfx); + gLinkTestBGInfo.screenBaseBlock = screenBaseBlock; + gLinkTestBGInfo.paletteNum = paletteNum; + gLinkTestBGInfo.dummy_8 = 0; + SetGpuReg(gBGControlRegs[bgNum], BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock)); } -void sub_8009570(void) +void LinkTestScreen(void) { int i; @@ -243,45 +243,45 @@ void sub_8009570(void) FreeAllSpritePalettes(); ResetTasks(); SetVBlankCallback(sub_80096BC); - sub_800A2E0(); - gUnknown_020229C6 = 0x1111; - sub_8009734(); + ResetBlockSend(); + gLinkType = 0x1111; + OpenLink(); SeedRng(gMain.vblankCounter2); for (i = 0; i < MAX_LINK_PLAYERS; i ++) { gSaveBlock2Ptr->playerTrainerId[i] = Random() % 256; } - sub_8009414(0, 2, 4, 0, 0); + InitLinkTestBG(0, 2, 4, 0, 0); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON); - CreateTask(sub_8009404, 0); + CreateTask(Task_DestroySelf, 0); RunTasks(); AnimateSprites(); BuildOamBuffer(); UpdatePaletteFade(); gUnknown_03000D60 = 0; - sub_8009638(); + InitLocalLinkPlayer(); CreateTask(task00_link_test, 0); - SetMainCallback2(c2_08009A8C); + SetMainCallback2(CB2_LinkTest); } void sub_8009628(u8 a0) { - gUnknown_020229CC.lp_field_18 = a0; + gLocalLinkPlayer.lp_field_18 = a0; } -void sub_8009638(void) +void InitLocalLinkPlayer(void) { - gUnknown_020229CC.trainerId = gSaveBlock2Ptr->playerTrainerId[0] | (gSaveBlock2Ptr->playerTrainerId[1] << 8) | (gSaveBlock2Ptr->playerTrainerId[2] << 16) | (gSaveBlock2Ptr->playerTrainerId[3] << 24); - StringCopy(gUnknown_020229CC.name, gSaveBlock2Ptr->playerName); - gUnknown_020229CC.gender = gSaveBlock2Ptr->playerGender; - gUnknown_020229CC.linkType = gUnknown_020229C6; - gUnknown_020229CC.language = gGameLanguage; - gUnknown_020229CC.version = gGameVersion + 0x4000; - gUnknown_020229CC.lp_field_2 = 0x8000; - gUnknown_020229CC.name[8] = IsNationalPokedexEnabled(); + gLocalLinkPlayer.trainerId = gSaveBlock2Ptr->playerTrainerId[0] | (gSaveBlock2Ptr->playerTrainerId[1] << 8) | (gSaveBlock2Ptr->playerTrainerId[2] << 16) | (gSaveBlock2Ptr->playerTrainerId[3] << 24); + StringCopy(gLocalLinkPlayer.name, gSaveBlock2Ptr->playerName); + gLocalLinkPlayer.gender = gSaveBlock2Ptr->playerGender; + gLocalLinkPlayer.linkType = gLinkType; + gLocalLinkPlayer.language = gGameLanguage; + gLocalLinkPlayer.version = gGameVersion + 0x4000; + gLocalLinkPlayer.lp_field_2 = 0x8000; + gLocalLinkPlayer.name[8] = IsNationalPokedexEnabled(); if (FlagGet(SYS_UNKNOWN_87F)) { - gUnknown_020229CC.name[8] |= 0x10; + gLocalLinkPlayer.name[8] |= 0x10; } } @@ -292,46 +292,46 @@ void sub_80096BC(void) TransferPlttBuffer(); } -void sub_80096D0(void) +void InitLink(void) { int i; for (i = 0; i < 8; i ++) { - gUnknown_03003110[i] = 0xefff; + gSendCmd[i] = 0xefff; } - gUnknown_020229C4 = TRUE; - sub_800B594(); + gLinkOpen = TRUE; + EnableSerial(); } -void task02_080097CC(u8 taskId) +void Task_TriggerHandshake(u8 taskId) { if (++ gTasks[taskId].data[0] == 5) { - gUnknown_03003144 = TRUE; + gShouldAdvanceLinkState = TRUE; DestroyTask(taskId); } } -void sub_8009734(void) +void OpenLink(void) { int i; if (!gSerialIsRFU) { - sub_800B628(); - sub_80096D0(); - gUnknown_03003140 = sub_800A824; - gUnknown_03002748 = 0; - gUnknown_0300306C = 0; - gUnknown_030030F8 = 0; + ResetSerial(); + InitLink(); + gLinkCallback = LinkCB_RequestPlayerDataExchange; + gLinkVSyncDisabled = FALSE; + gLinkErrorOccurred = FALSE; + gSuppressLinkErrorMessage = FALSE; ResetBlockReceivedFlags(); - sub_800A2E0(); + ResetBlockSend(); gUnknown_03000D54 = 0; gUnknown_030030E8 = 0; gUnknown_030030E4 = 0; gUnknown_030030F4 = 0; - CreateTask(task02_080097CC, 2); + CreateTask(Task_TriggerHandshake, 2); } else { @@ -346,33 +346,33 @@ void sub_8009734(void) } } -void sub_80097E8(void) +void CloseLink(void) { gReceivedRemoteLinkPlayers = FALSE; if (gSerialIsRFU) { sub_800EDD4(); } - gUnknown_020229C4 = FALSE; - sub_800B53C(); + gLinkOpen = FALSE; + DisableSerial(); } -static void sub_8009818(u8 nothing, u8 is, u8 used) +static void TestBlockTransfer(u8 nothing, u8 is, u8 used) { u8 i; u8 status; - if (gUnknown_03000D64 != gUnknown_03000D10.pos) + if (sLinkTestLastBlockSendPos != sBlockSend.pos) { - sub_800A6E8(gUnknown_03000D10.pos, 2, 3, 2); - gUnknown_03000D64 = gUnknown_03000D10.pos; + LinkTest_prnthex(sBlockSend.pos, 2, 3, 2); + sLinkTestLastBlockSendPos = sBlockSend.pos; } for (i = 0; i < MAX_LINK_PLAYERS; i ++) { - if (gUnknown_03000D68[i] != gUnknown_03000D20[i].pos) + if (sLinkTestLastBlockRecvPos[i] != sBlockRecv[i].pos) { - sub_800A6E8(gUnknown_03000D20[i].pos, 2, i + 4, 2); - gUnknown_03000D68[i] = gUnknown_03000D20[i].pos; + LinkTest_prnthex(sBlockRecv[i].pos, 2, i + 4, 2); + sLinkTestLastBlockRecvPos[i] = sBlockRecv[i].pos; } } status = GetBlockReceivedStatus(); @@ -382,27 +382,27 @@ static void sub_8009818(u8 nothing, u8 is, u8 used) { if ((status >> i) & 1) { - gUnknown_03003148[i] = sub_800A648(gBlockRecvBuffer[i], gUnknown_03000D20[i].size); + gLinkTestBlockChecksums[i] = LinkTestCalcBlockChecksum(gBlockRecvBuffer[i], sBlockRecv[i].size); ResetBlockReceivedFlag(i); - if (gUnknown_03003148[i] != 0x0342) + if (gLinkTestBlockChecksums[i] != 0x0342) { - gUnknown_020223BC = 0; - gUnknown_020223BD = 0; + gLinkTestDebugValuesEnabled = FALSE; + gUnknown_020223BD = FALSE; } } } } } -void sub_8009900(void) +void LinkTestProcessKeyInput(void) { if (gMain.newKeys & A_BUTTON) { - gUnknown_03003144 = TRUE; + gShouldAdvanceLinkState = TRUE; } if (gMain.heldKeys & B_BUTTON) { - sub_800A2F4(gHeap + 0x4000, 0x00002004); + InitBlockSend(gHeap + 0x4000, 0x00002004); } if (gMain.newKeys & L_BUTTON) { @@ -410,7 +410,7 @@ void sub_8009900(void) } if (gMain.newKeys & START_BUTTON) { - sub_800B330(1); + SetSuppressLinkErrorMessage(TRUE); } if (gMain.newKeys & R_BUTTON) { @@ -420,48 +420,48 @@ void sub_8009900(void) { sub_800AC34(); } - if (gUnknown_020223BC) + if (gLinkTestDebugValuesEnabled) { - sub_800A994(gMain.vblankCounter2, gUnknown_03003140 ? gUnknown_03002748 : gUnknown_03002748 | 0x10); + SetLinkDebugValues(gMain.vblankCounter2, gLinkCallback ? gLinkVSyncDisabled : gLinkVSyncDisabled | 0x10); } } -static void c2_08009A8C(void) +static void CB2_LinkTest(void) { - sub_8009900(); - sub_8009818(1, 1, 0); + LinkTestProcessKeyInput(); + TestBlockTransfer(1, 1, 0); RunTasks(); AnimateSprites(); BuildOamBuffer(); UpdatePaletteFade(); } -u16 sub_80099E0(const u16 *src) +u16 LinkMain2(const u16 *heldKeys) { u8 i; - if (!gUnknown_020229C4) + if (!gLinkOpen) { return 0; } for (i = 0; i < 8; i ++) { - gUnknown_03003110[i] = 0; + gSendCmd[i] = 0; } - gUnknown_03003084 = *src; - if (gUnknown_030030E0 & LINK_STAT_CONN_ESTABLISHED) + gLinkHeldKeys = *heldKeys; + if (gLinkStatus & LINK_STAT_CONN_ESTABLISHED) { - sub_8009AA0(SIO_MULTI_CNT->id); - if (gUnknown_03003140 != NULL) + ProcessRecvCmds(SIO_MULTI_CNT->id); + if (gLinkCallback != NULL) { - gUnknown_03003140(); + gLinkCallback(); } sub_800AEB4(); } - return gUnknown_030030E0; + return gLinkStatus; } -void sub_8009A58(u8 who) +void HandleReceiveRemoteLinkPlayer(u8 who) { int i; int count; @@ -478,33 +478,33 @@ void sub_8009A58(u8 who) } } -static void sub_8009AA0(u8 unused) +static void ProcessRecvCmds(u8 unused) { u16 i; for (i = 0; i < MAX_LINK_PLAYERS; i ++) { gUnknown_03003020[i] = 0; - if (gUnknown_03003090[i][0] == 0) + if (gRecvCmds[i][0] == 0) { continue; } - switch (gUnknown_03003090[i][0]) + switch (gRecvCmds[i][0]) { case 0x2222: { struct LinkPlayerBlock *block; - sub_8009638(); - block = &gUnknown_03003030; - block->linkPlayer = gUnknown_020229CC; + InitLocalLinkPlayer(); + block = &gLocalLinkPlayerBlock; + block->linkPlayer = gLocalLinkPlayer; memcpy(block->magic1, gASCIIGameFreakInc, sizeof(block->magic1) - 1); memcpy(block->magic2, gASCIIGameFreakInc, sizeof(block->magic2) - 1); - sub_800A2F4(block, sizeof(*block)); + InitBlockSend(block, sizeof(*block)); break; } case 0x4444: - gUnknown_03003020[i] = gUnknown_03003090[i][1]; + gUnknown_03003020[i] = gRecvCmds[i][1]; break; case 0x5555: gUnknown_030030E8 = 1; @@ -516,15 +516,15 @@ static void sub_8009AA0(u8 unused) { struct BlockTransfer *blockRecv; - blockRecv = &gUnknown_03000D20[i]; + blockRecv = &sBlockRecv[i]; blockRecv->pos = 0; - blockRecv->size = gUnknown_03003090[i][1]; - blockRecv->multiplayerId = gUnknown_03003090[i][2]; + blockRecv->size = gRecvCmds[i][1]; + blockRecv->multiplayerId = gRecvCmds[i][2]; break; } case 0x8888: { - if (gUnknown_03000D20[i].size > BLOCK_BUFFER_SIZE) + if (sBlockRecv[i].size > BLOCK_BUFFER_SIZE) { u16 *buffer; u16 j; @@ -532,7 +532,7 @@ static void sub_8009AA0(u8 unused) buffer = (u16 *)gDecompressionBuffer; for (j = 0; j < CMD_LENGTH - 1; j ++) { - buffer[(gUnknown_03000D20[i].pos / 2) + j] = gUnknown_03003090[i][j + 1]; + buffer[(sBlockRecv[i].pos / 2) + j] = gRecvCmds[i][j + 1]; } } else @@ -541,13 +541,13 @@ static void sub_8009AA0(u8 unused) for (j = 0; j < CMD_LENGTH - 1; j ++) { - gBlockRecvBuffer[i][(gUnknown_03000D20[i].pos / 2) + j] = gUnknown_03003090[i][j + 1]; + gBlockRecvBuffer[i][(sBlockRecv[i].pos / 2) + j] = gRecvCmds[i][j + 1]; } } - gUnknown_03000D20[i].pos += (CMD_LENGTH - 1) * 2; + sBlockRecv[i].pos += (CMD_LENGTH - 1) * 2; - if (gUnknown_03000D20[i].pos >= gUnknown_03000D20[i].size) + if (sBlockRecv[i].pos >= sBlockRecv[i].size) { if (gUnknown_03003078[i] == TRUE) { @@ -567,16 +567,16 @@ static void sub_8009AA0(u8 unused) if (strcmp(block->magic1, gASCIIGameFreakInc) != 0 || strcmp(block->magic2, gASCIIGameFreakInc) != 0) { - SetMainCallback2(c2_800ACD4); + SetMainCallback2(CB2_LinkError); } else { - sub_8009A58(i); + HandleReceiveRemoteLinkPlayer(i); } } else { - sub_800A588(i); + SetBlockReceivedFlag(i); } } } @@ -591,78 +591,78 @@ static void sub_8009AA0(u8 unused) sub_800A418(); break; case 0xCCCC: - SendBlock(0, gUnknown_082ED1A8[gUnknown_03003090[i][1]].address, gUnknown_082ED1A8[gUnknown_03003090[i][1]].size); + SendBlock(0, gUnknown_082ED1A8[gRecvCmds[i][1]].address, gUnknown_082ED1A8[gRecvCmds[i][1]].size); break; case 0xCAFE: - gUnknown_03003020[i] = gUnknown_03003090[i][1]; + gUnknown_03003020[i] = gRecvCmds[i][1]; break; } } } -void sub_8009D90(u16 command) +void BuildSendCmd(u16 command) { switch (command) { case 0x2222: - gUnknown_03003110[0] = 0x2222; - gUnknown_03003110[1] = gUnknown_020229C6; + gSendCmd[0] = 0x2222; + gSendCmd[1] = gLinkType; break; case 0x2ffe: - gUnknown_03003110[0] = 0x2ffe; + gSendCmd[0] = 0x2ffe; break; case 0x4444: - gUnknown_03003110[0] = 0x4444; - gUnknown_03003110[1] = gMain.heldKeys; + gSendCmd[0] = 0x4444; + gSendCmd[1] = gMain.heldKeys; break; case 0x5555: - gUnknown_03003110[0] = 0x5555; + gSendCmd[0] = 0x5555; break; case 0x6666: - gUnknown_03003110[0] = 0x6666; - gUnknown_03003110[1] = 0; + gSendCmd[0] = 0x6666; + gSendCmd[1] = 0; break; case 0x7777: { u8 i; - gUnknown_03003110[0] = 0x7777; - for (i = 0; i < MAX_RFU_PLAYERS; i ++) + gSendCmd[0] = 0x7777; + for (i = 0; i < 5; i ++) { - gUnknown_03003110[i + 1] = 0xEE; + gSendCmd[i + 1] = 0xEE; } break; } case 0xbbbb: - gUnknown_03003110[0] = 0xbbbb; - gUnknown_03003110[1] = gUnknown_03000D10.size; - gUnknown_03003110[2] = gUnknown_03000D10.multiplayerId + 0x80; + gSendCmd[0] = 0xbbbb; + gSendCmd[1] = sBlockSend.size; + gSendCmd[2] = sBlockSend.multiplayerId + 0x80; break; case 0xaaaa: - gUnknown_03003110[0] = 0xaaaa; + gSendCmd[0] = 0xaaaa; break; case 0xaaab: - gUnknown_03003110[0] = 0xaaab; - gUnknown_03003110[1] = gScriptItemId; + gSendCmd[0] = 0xaaab; + gSendCmd[1] = gScriptItemId; break; case 0xcccc: - gUnknown_03003110[0] = 0xcccc; - gUnknown_03003110[1] = gUnknown_03003150; + gSendCmd[0] = 0xcccc; + gSendCmd[1] = gBlockRequestType; break; case 0x5fff: - gUnknown_03003110[0] = 0x5fff; - gUnknown_03003110[1] = gUnknown_030030F4; + gSendCmd[0] = 0x5fff; + gSendCmd[1] = gUnknown_030030F4; break; case 0x5566: - gUnknown_03003110[0] = 0x5566; + gSendCmd[0] = 0x5566; break; case 0xcafe: - if (gUnknown_03005DA8 == 0 || gUnknown_030022B4) + if (gUnknown_03005DA8 == 0 || gLinkTransferringData) { break; } - gUnknown_03003110[0] = 0xcafe; - gUnknown_03003110[1] = gUnknown_03005DA8; + gSendCmd[0] = 0xcafe; + gSendCmd[1] = gUnknown_03005DA8; break; } } @@ -673,7 +673,7 @@ void sub_8009F18(void) { sub_800F804(); } - gUnknown_03003140 = sub_8009F70; + gLinkCallback = sub_8009F70; } bool32 sub_8009F3C(void) @@ -682,7 +682,7 @@ bool32 sub_8009F3C(void) { return sub_800F7E4(); } - if (gUnknown_03003140 == sub_8009F70) + if (gLinkCallback == sub_8009F70) { return TRUE; } @@ -693,11 +693,11 @@ static void sub_8009F70(void) { if (gReceivedRemoteLinkPlayers == TRUE) { - sub_8009D90(0xcafe); + BuildSendCmd(0xcafe); } } -void sub_8009F8C(void) +void ClearLinkCallback(void) { if (gSerialIsRFU) { @@ -705,11 +705,11 @@ void sub_8009F8C(void) } else { - gUnknown_03003140 = NULL; + gLinkCallback = NULL; } } -void sub_8009FAC(void) +void ClearLinkCallback_2(void) { if (gSerialIsRFU) { @@ -717,7 +717,7 @@ void sub_8009FAC(void) } else { - gUnknown_03003140 = NULL; + gLinkCallback = NULL; } } @@ -727,7 +727,7 @@ u8 GetLinkPlayerCount(void) { return sub_80104F4(); } - return EXTRACT_PLAYER_COUNT(gUnknown_030030E0); + return EXTRACT_PLAYER_COUNT(gLinkStatus); } int sub_8009FF8(u32 version1, u32 version2) @@ -781,14 +781,14 @@ bool32 sub_800A07C(void) return FALSE; } -void sub_800A0AC(void) +void OpenLinkTimed(void) { - gUnknown_03000D5C = 0; - gUnknown_020229C8 = 0; - sub_8009734(); + sPlayerDataExchangeStatus = EXCHANGE_NOT_STARTED; + gLinkTimeOutCounter = 0; + OpenLink(); } -u8 sub_800A0C8(int lower, int upper) +u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper) { int i; int count; @@ -803,15 +803,15 @@ u8 sub_800A0C8(int lower, int upper) cmpVal = sub_800ABAC(); if (lower > cmpVal || cmpVal > upper) { - gUnknown_03000D5C = 6; + sPlayerDataExchangeStatus = EXCHANGE_STAT_6; return 6; } else { if (GetLinkPlayerCount() == 0) { - gUnknown_0300306C = TRUE; - sub_80097E8(); + gLinkErrorOccurred = TRUE; + CloseLink(); } for (i = 0, index = 0; i < GetLinkPlayerCount(); index ++, i ++) { @@ -827,24 +827,24 @@ u8 sub_800A0C8(int lower, int upper) switch (sub_807A728()) { case 1: - gUnknown_03000D5C = 4; + sPlayerDataExchangeStatus = EXCHANGE_STAT_4; break; case 2: - gUnknown_03000D5C = 5; + sPlayerDataExchangeStatus = EXCHANGE_STAT_5; break; case 0: - gUnknown_03000D5C = 1; + sPlayerDataExchangeStatus = EXCHANGE_COMPLETE; break; } } else { - gUnknown_03000D5C = 1; + sPlayerDataExchangeStatus = EXCHANGE_COMPLETE; } } else { - gUnknown_03000D5C = 3; + sPlayerDataExchangeStatus = EXCHANGE_IN_PROGRESS; linkType1 = gLinkPlayers[GetMultiplayerId()].linkType; linkType2 = gLinkPlayers[GetMultiplayerId() ^ 1].linkType; if ((linkType1 == 0x2266 && linkType2 == 0x2277) || (linkType1 == 0x2277 && linkType2 == 0x2266)) @@ -854,14 +854,14 @@ u8 sub_800A0C8(int lower, int upper) } } } - else if (++ gUnknown_020229C8 > 600) + else if (++ gLinkTimeOutCounter > 600) { - gUnknown_03000D5C = 2; + sPlayerDataExchangeStatus = EXCHANGE_TIMED_OUT; } - return gUnknown_03000D5C; + return sPlayerDataExchangeStatus; } -bool8 sub_800A23C(void) +bool8 IsLinkPlayerDataExchangeComplete(void) { u8 i; u8 count; @@ -878,12 +878,12 @@ bool8 sub_800A23C(void) if (count == GetLinkPlayerCount()) { retval = TRUE; - gUnknown_03000D5C = 1; + sPlayerDataExchangeStatus = EXCHANGE_COMPLETE; } else { retval = FALSE; - gUnknown_03000D5C = 3; + sPlayerDataExchangeStatus = EXCHANGE_IN_PROGRESS; } return retval; } @@ -893,7 +893,7 @@ u32 GetLinkPlayerTrainerId(u8 who) return gLinkPlayers[who].trainerId; } -void sub_800A2BC(void) +void ResetLinkPlayers(void) { int i; @@ -903,78 +903,78 @@ void sub_800A2BC(void) } } -static void sub_800A2E0(void) +static void ResetBlockSend(void) { - gUnknown_03000D10.active = FALSE; - gUnknown_03000D10.pos = 0; - gUnknown_03000D10.size = 0; - gUnknown_03000D10.src = NULL; + sBlockSend.active = FALSE; + sBlockSend.pos = 0; + sBlockSend.size = 0; + sBlockSend.src = NULL; } -bool32 sub_800A2F4(const void *src, size_t size) +static bool32 InitBlockSend(const void *src, size_t size) { - if (gUnknown_03000D10.active) + if (sBlockSend.active) { return FALSE; } - gUnknown_03000D10.multiplayerId = GetMultiplayerId(); - gUnknown_03000D10.active = TRUE; - gUnknown_03000D10.size = size; - gUnknown_03000D10.pos = 0; + sBlockSend.multiplayerId = GetMultiplayerId(); + sBlockSend.active = TRUE; + sBlockSend.size = size; + sBlockSend.pos = 0; if (size > 0x100) { - gUnknown_03000D10.src = src; + sBlockSend.src = src; } else { - if (src != gUnknown_020228C4) + if (src != gBlockSendBuffer) { - memcpy(gUnknown_020228C4, src, size); + memcpy(gBlockSendBuffer, src, size); } - gUnknown_03000D10.src = gUnknown_020228C4; + sBlockSend.src = gBlockSendBuffer; } - sub_8009D90(0xbbbb); - gUnknown_03003140 = sub_800A364; - gUnknown_03000D50 = 0; + BuildSendCmd(0xbbbb); + gLinkCallback = LinkCB_BlockSendBegin; + sBlockSendDelayCounter = 0; return TRUE; } -static void sub_800A364(void) +static void LinkCB_BlockSendBegin(void) { - if (++ gUnknown_03000D50 > 2) + if (++ sBlockSendDelayCounter > 2) { - gUnknown_03003140 = sub_800A388; + gLinkCallback = LinkCB_BlockSend; } } -static void sub_800A388(void) +static void LinkCB_BlockSend(void) { int i; const u8 *src; - src = gUnknown_03000D10.src; - gUnknown_03003110[0] = 0x8888; + src = sBlockSend.src; + gSendCmd[0] = 0x8888; for (i = 0; i < 7; i ++) { - gUnknown_03003110[i + 1] = (src[gUnknown_03000D10.pos + i * 2 + 1] << 8) | src[gUnknown_03000D10.pos + i * 2]; + gSendCmd[i + 1] = (src[sBlockSend.pos + i * 2 + 1] << 8) | src[sBlockSend.pos + i * 2]; } - gUnknown_03000D10.pos += 14; - if (gUnknown_03000D10.size <= gUnknown_03000D10.pos) + sBlockSend.pos += 14; + if (sBlockSend.size <= sBlockSend.pos) { - gUnknown_03000D10.active = FALSE; - gUnknown_03003140 = sub_800A3EC; + sBlockSend.active = FALSE; + gLinkCallback = LinkCB_BlockSendEnd; } } -static void sub_800A3EC(void) +static void LinkCB_BlockSendEnd(void) { - gUnknown_03003140 = NULL; + gLinkCallback = NULL; } -void sub_800A3F8(void) +static void sub_800A3F8(void) { GetMultiplayerId(); - sub_8009D90(0x4444); + BuildSendCmd(0x4444); gUnknown_020223C0 ++; } @@ -987,7 +987,7 @@ void sub_800A418(void) } else { - gUnknown_03003140 = sub_800A3F8; + gLinkCallback = sub_800A3F8; } } @@ -998,7 +998,7 @@ u32 sub_800A44C(void) void sub_800A458(void) { - sub_8009D90(0xaaaa); + BuildSendCmd(0xaaaa); } u8 GetMultiplayerId(void) @@ -1024,7 +1024,7 @@ bool8 SendBlock(u8 unused, const void *src, u16 size) { return sub_800FE84(src, size); } - return sub_800A2F4(src, size); + return InitBlockSend(src, size); } bool8 sub_800A4D8(u8 a0) @@ -1033,10 +1033,10 @@ bool8 sub_800A4D8(u8 a0) { return sub_8010100(a0); } - if (gUnknown_03003140 == NULL) + if (gLinkCallback == NULL) { - gUnknown_03003150 = a0; - sub_8009D90(0xcccc); + gBlockRequestType = a0; + BuildSendCmd(0xcccc); return TRUE; } return FALSE; @@ -1048,7 +1048,7 @@ bool8 sub_800A520(void) { return sub_8010500(); } - return gUnknown_03003140 == NULL; + return gLinkCallback == NULL; } u8 GetBlockReceivedStatus(void) @@ -1060,7 +1060,7 @@ u8 GetBlockReceivedStatus(void) return (gUnknown_0300307C[3] << 3) | (gUnknown_0300307C[2] << 2) | (gUnknown_0300307C[1] << 1) | (gUnknown_0300307C[0] << 0); } -void sub_800A588(u8 who) +static void SetBlockReceivedFlag(u8 who) { if (gSerialIsRFU == TRUE) { @@ -1106,13 +1106,13 @@ void ResetBlockReceivedFlag(u8 who) void sub_800A620(void) { - if ((gUnknown_030030E0 & LINK_STAT_MASTER) && EXTRACT_PLAYER_COUNT(gUnknown_030030E0) > 1) + if ((gLinkStatus & LINK_STAT_MASTER) && EXTRACT_PLAYER_COUNT(gLinkStatus) > 1) { - gUnknown_03003144 = TRUE; + gShouldAdvanceLinkState = TRUE; } } -u16 sub_800A648(const u16 *data, u16 size) +static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size) { u16 chksum; u16 i; @@ -1120,45 +1120,45 @@ u16 sub_800A648(const u16 *data, u16 size) chksum = 0; for (i = 0; i < size / 2; i ++) { - chksum += data[i]; + chksum += src[i]; } return chksum; } -void sub_800A678(char a0, u8 a1, u8 a2) +static void LinkTest_prnthexchar(char a0, u8 a1, u8 a2) { u16 *vAddr; - vAddr = (u16 *)BG_SCREEN_ADDR(gUnknown_03003130.screenBaseBlock); - vAddr[a2 * 32 + a1] = (gUnknown_03003130.paletteNum << 12) | (a0 + 1 + gUnknown_03003130.dummy_8); + vAddr = (u16 *)BG_SCREEN_ADDR(gLinkTestBGInfo.screenBaseBlock); + vAddr[a2 * 32 + a1] = (gLinkTestBGInfo.paletteNum << 12) | (a0 + 1 + gLinkTestBGInfo.dummy_8); } -void sub_800A6B0(char a0, u8 a1, u8 a2) +static void LinkTest_prntchar(char a0, u8 a1, u8 a2) { u16 *vAddr; - vAddr = (u16 *)BG_SCREEN_ADDR(gUnknown_03003130.screenBaseBlock); - vAddr[a2 * 32 + a1] = (gUnknown_03003130.paletteNum << 12) | (a0 + gUnknown_03003130.dummy_8); + vAddr = (u16 *)BG_SCREEN_ADDR(gLinkTestBGInfo.screenBaseBlock); + vAddr[a2 * 32 + a1] = (gLinkTestBGInfo.paletteNum << 12) | (a0 + gLinkTestBGInfo.dummy_8); } -void sub_800A6E8(u32 a0, u8 a1, u8 a2, u8 a3) +static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2) { char sp[32 / 2]; int i; - for (i = 0; i < a3; i ++) + for (i = 0; i < a2; i ++) { - sp[i] = a0 & 0xf; - a0 >>= 4; + sp[i] = pos & 0xf; + pos >>= 4; } - for (i = a3 - 1; i >= 0; i --) + for (i = a2 - 1; i >= 0; i --) { - sub_800A678(sp[i], a1, a2); - a1 ++; + LinkTest_prnthexchar(sp[i], a0, a1); + a0 ++; } } -void sub_800A73C(int a0, u8 a1, u8 a2, u8 a3) +static void LinkTest_prntint(int a0, u8 a1, u8 a2, u8 a3) { char sp[32 / 2]; int sp10; @@ -1177,16 +1177,16 @@ void sub_800A73C(int a0, u8 a1, u8 a2, u8 a3) } for (i = a3 - 1; i >= 0; i --) { - sub_800A678(sp[i], a1, a2); + LinkTest_prnthexchar(sp[i], a1, a2); a1 ++; } if (sp10 != -1) { - sub_800A678(*"\n", sp10, a2); + LinkTest_prnthexchar(*"\n", sp10, a2); } } -void sub_800A7DC(const char *a0, u8 a1, u8 a2) +static void LinkTest_prntstr(const char *a0, u8 a1, u8 a2) { int r6; int i; @@ -1203,8 +1203,44 @@ void sub_800A7DC(const char *a0, u8 a1, u8 a2) } else { - sub_800A6B0(a0[i], a1 + r6, a2 + r5); + LinkTest_prntchar(a0[i], a1 + r6, a2 + r5); r6 ++; } } } + +static void LinkCB_RequestPlayerDataExchange(void) +{ + if (gLinkStatus & LINK_STAT_MASTER) + { + BuildSendCmd(0x2222); + } + gLinkCallback = NULL; +} + +static void task00_link_test(u8 taskId) +{ + char sp[32]; + int i; + + strcpy(sp, gASCIITestPrint); + LinkTest_prntstr(sp, 5, 2); + LinkTest_prnthex(gShouldAdvanceLinkState, 2, 1, 2); + LinkTest_prnthex(gLinkStatus, 15, 1, 8); + LinkTest_prnthex(gLink.state, 2, 10, 2); + LinkTest_prnthex(EXTRACT_PLAYER_COUNT(gLinkStatus), 15, 10, 2); + LinkTest_prnthex(GetMultiplayerId(), 15, 12, 2); + LinkTest_prnthex(gUnknown_03003160, 25, 1, 2); + LinkTest_prnthex(gUnknown_03004130, 25, 2, 2); + LinkTest_prnthex(GetBlockReceivedStatus(), 15, 5, 2); + LinkTest_prnthex(gUnknown_0300302C, 2, 12, 8); + LinkTest_prnthex(gUnknown_03003070, 2, 13, 8); + LinkTest_prnthex(sub_800B2E8(), 25, 5, 1); + LinkTest_prnthex(sub_800B2F8(), 25, 6, 1); + LinkTest_prnthex(sub_800B320(), 25, 7, 1); + LinkTest_prnthex(sub_800B33C(), 25, 8, 1); + for (i = 0; i < MAX_LINK_PLAYERS; i++) + { + LinkTest_prnthex(gLinkTestBlockChecksums[i], 10, 4 + i, 4); + } +} diff --git a/src/main.c b/src/main.c index 61f6f60a4..a67bed035 100644 --- a/src/main.c +++ b/src/main.c @@ -80,12 +80,12 @@ const IntrFunc gIntrTableTemplate[] = static u16 gUnknown_03000000; u16 gKeyRepeatStartDelay; -bool8 gUnknown_030022B4; +bool8 gLinkTransferringData; struct Main gMain; u16 gKeyRepeatContinueDelay; bool8 gSoftResetDisabled; IntrFunc gIntrTable[INTR_COUNT]; -u8 gUnknown_03002748; +u8 gLinkVSyncDisabled; u32 IntrMain_Buffer[0x200]; u8 gPcmDmaCounter; @@ -129,7 +129,7 @@ void AgbMain() if (gFlashMemoryPresent != TRUE) SetMainCallback2(NULL); - gUnknown_030022B4 = FALSE; + gLinkTransferringData = FALSE; gUnknown_03000000 = 0xFC0; for (;;) @@ -147,22 +147,22 @@ void AgbMain() if (sub_8087634() == 1) { - gUnknown_030022B4 = TRUE; + gLinkTransferringData = TRUE; UpdateLinkAndCallCallbacks(); - gUnknown_030022B4 = FALSE; + gLinkTransferringData = FALSE; } else { - gUnknown_030022B4 = FALSE; + gLinkTransferringData = FALSE; UpdateLinkAndCallCallbacks(); if (sub_80875C8() == 1) { gMain.newKeys = 0; ClearSpriteCopyRequests(); - gUnknown_030022B4 = TRUE; + gLinkTransferringData = TRUE; UpdateLinkAndCallCallbacks(); - gUnknown_030022B4 = FALSE; + gLinkTransferringData = FALSE; } } @@ -338,7 +338,7 @@ static void VBlankIntr(void) { if (gSerialIsRFU != FALSE) LinkVSync(); - else if (gUnknown_03002748 == FALSE) + else if (gLinkVSyncDisabled == FALSE) sub_800B9B8(); gMain.vblankCounter1++; diff --git a/sym_common.txt b/sym_common.txt index e228ed613..13eb9e604 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -18,10 +18,10 @@ gUnknown_03003020: @ 3003020 gUnknown_0300302C: @ 300302C .space 0x4 -gUnknown_03003030: @ 3003030 +gLocalLinkPlayerBlock: @ 3003030 .space 0x3C -gUnknown_0300306C: @ 300306C +gLinkErrorOccurred: @ 300306C .space 0x4 gUnknown_03003070: @ 3003070 @@ -33,13 +33,13 @@ gUnknown_03003078: @ 3003078 gUnknown_0300307C: @ 300307C .space 0x8 -gUnknown_03003084: @ 3003084 +gLinkHeldKeys: @ 3003084 .space 0xC -gUnknown_03003090: @ 3003090 +gRecvCmds: @ 3003090 .space 0x50 -gUnknown_030030E0: @ 30030E0 +gLinkStatus: @ 30030E0 .space 0x4 gUnknown_030030E4: @ 30030E4 @@ -57,7 +57,7 @@ gUnknown_030030F0: @ 30030F0 gUnknown_030030F4: @ 30030F4 .space 0x4 -gUnknown_030030F8: @ 30030F8 +gSuppressLinkErrorMessage: @ 30030F8 .space 0x4 gSerialIsRFU: @ 30030FC @@ -66,7 +66,7 @@ gSerialIsRFU: @ 30030FC gUnknown_03003100: @ 3003100 .space 0x10 -gUnknown_03003110: @ 3003110 +gSendCmd: @ 3003110 .space 0x10 gUnknown_03003120: @ 3003120 @@ -75,25 +75,25 @@ gUnknown_03003120: @ 3003120 gReceivedRemoteLinkPlayers: @ 3003124 .space 0xC -gUnknown_03003130: @ 3003130 +gLinkTestBGInfo: @ 3003130 .space 0x10 -gUnknown_03003140: @ 3003140 +gLinkCallback: @ 3003140 .space 0x4 -gUnknown_03003144: @ 3003144 +gShouldAdvanceLinkState: @ 3003144 .space 0x4 -gUnknown_03003148: @ 3003148 +gLinkTestBlockChecksums: @ 3003148 .space 0x8 -gUnknown_03003150: @ 3003150 +gBlockRequestType: @ 3003150 .space 0x10 gUnknown_03003160: @ 3003160 .space 0x10 -gUnknown_03003170: @ 3003170 +gLink: @ 3003170 .space 0xFC0 gUnknown_03004130: @ 3004130 From 3321548956e2c7311bedb5bdfc4693c2010467f2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 11 Nov 2017 00:25:05 -0500 Subject: [PATCH 028/123] Link common syms --- asm/link.s | 10 ----- common_syms/link.txt | 36 ++++++++++++++++++ include/link.h | 24 ++++++++---- src/link.c | 30 +++++++++++---- sym_common.txt | 91 +------------------------------------------- 5 files changed, 75 insertions(+), 116 deletions(-) diff --git a/asm/link.s b/asm/link.s index b3b2d77c2..9f9a04d49 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,16 +5,6 @@ .text - thumb_func_start SetLinkDebugValues -SetLinkDebugValues: @ 800A994 - ldr r2, =gUnknown_0300302C - str r0, [r2] - ldr r0, =gUnknown_03003070 - str r1, [r0] - bx lr - .pool - thumb_func_end SetLinkDebugValues - thumb_func_start sub_800A9A8 sub_800A9A8: @ 800A9A8 push {r4,lr} diff --git a/common_syms/link.txt b/common_syms/link.txt index 69a66331a..150e93e88 100644 --- a/common_syms/link.txt +++ b/common_syms/link.txt @@ -1 +1,37 @@ +gUnknown_03003020 +gLinkDebugSeed +gLocalLinkPlayerBlock +gLinkErrorOccurred +gLinkDebugFlags +gUnknown_03003074 +gUnknown_03003078 +gUnknown_0300307C +gFiller_03003080 +gLinkHeldKeys +gRecvCmds +gLinkStatus +gUnknown_030030E4 +gUnknown_030030E8 +gUnknown_030030EC +gUnknown_030030F0 +gUnknown_030030F4 +gSuppressLinkErrorMessage +gSerialIsRFU +gUnknown_03003100 +gSendCmd +gUnknown_03003120 +gReceivedRemoteLinkPlayers gLinkTestBGInfo +gLinkCallback +gShouldAdvanceLinkState +gLinkTestBlockChecksums +gBlockRequestType +gFiller_03003154 +gFiller_03003158 +gFiller_0300315c +gUnknown_03003160 +gLink +gUnknown_03004130 +gUnknown_03004134 +gFiller_03004138 +gFiller_0300413C diff --git a/include/link.h b/include/link.h index 917331c34..283e13aa1 100644 --- a/include/link.h +++ b/include/link.h @@ -149,7 +149,7 @@ struct BlockRequest extern const struct BlockRequest sBlockRequestLookupTable[5]; extern struct Link gLink; -extern u16 gRecvCmds[MAX_LINK_PLAYERS][CMD_LENGTH]; +extern u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH]; extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; // gBlockSendBuffer extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; extern u16 gLinkType; @@ -218,18 +218,18 @@ u8 sub_800B320(void); u8 sub_800B33C(void); extern u16 gUnknown_03003020[6]; -extern u32 gUnknown_0300302C; +extern u32 gLinkDebugSeed; extern struct LinkPlayerBlock gLocalLinkPlayerBlock; extern bool8 gLinkErrorOccurred; -extern u32 gUnknown_03003070; -extern bool8 gUnknown_03003078[4]; -extern u8 gUnknown_0300307C[4]; +extern u32 gLinkDebugFlags; +extern bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; +extern u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; extern u16 gLinkHeldKeys; extern u32 gLinkStatus; extern u8 gUnknown_030030E4; extern u8 gUnknown_030030E8; -extern u8 gUnknown_030030EC[4]; -extern u8 gUnknown_030030F0[4]; +extern u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; +extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; extern u16 gUnknown_030030F4; extern u8 gSuppressLinkErrorMessage; extern bool8 gSerialIsRFU; @@ -238,9 +238,17 @@ extern u8 gUnknown_03003120; extern struct LinkTestBGInfo gLinkTestBGInfo; extern void (*gLinkCallback)(void); extern bool8 gShouldAdvanceLinkState; -extern u16 gLinkTestBlockChecksums[4]; +extern u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; extern u8 gBlockRequestType; extern u8 gUnknown_03003160; extern u8 gUnknown_03004130; +extern u16 gUnknown_03004134; +extern u32 gUnknown_03003074; +extern u32 gFiller_03003154; +extern u32 gFiller_03003158; +extern u32 gFiller_0300315c; +extern u32 gFiller_03004138; +extern u32 gFiller_0300413C; +extern u32 gFiller_03003080; #endif // GUARD_LINK_H diff --git a/src/link.c b/src/link.c index 07598bc1f..d5fc890ca 100644 --- a/src/link.c +++ b/src/link.c @@ -67,14 +67,16 @@ IWRAM_DATA void *gUnknown_03000DAC; IWRAM_DATA bool32 gUnknown_03000DB0; u16 gUnknown_03003020[6]; -u32 gUnknown_0300302C; +u32 gLinkDebugSeed; struct LinkPlayerBlock gLocalLinkPlayerBlock; bool8 gLinkErrorOccurred; -u32 gUnknown_03003070; +u32 gLinkDebugFlags; +u32 gUnknown_03003074; bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; +u32 gFiller_03003080; u16 gLinkHeldKeys; -u16 gRecvCmds[MAX_LINK_PLAYERS][8]; +u16 gRecvCmds[MAX_RFU_PLAYERS][8]; u32 gLinkStatus; u8 gUnknown_030030E4; bool8 gUnknown_030030E8; @@ -92,9 +94,15 @@ void (*gLinkCallback)(void); bool8 gShouldAdvanceLinkState; u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; u8 gBlockRequestType; +u32 gFiller_03003154; +u32 gFiller_03003158; +u32 gFiller_0300315c; u8 gUnknown_03003160; struct Link gLink; u8 gUnknown_03004130; +u16 gUnknown_03004134; +u32 gFiller_03004138; +u32 gFiller_0300413C; EWRAM_DATA u8 gLinkTestDebugValuesEnabled = 0; EWRAM_DATA u8 gUnknown_020223BD = 0; @@ -124,7 +132,7 @@ static void SetBlockReceivedFlag(u8 who); static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size); static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2); static void LinkCB_RequestPlayerDataExchange(void); -static void task00_link_test(u8 taskId); +static void Task_PrintTestData(u8 taskId); void sub_800AEB4(void); u8 sub_800B2F8(void); void sub_800B4A4(void); @@ -260,7 +268,7 @@ void LinkTestScreen(void) UpdatePaletteFade(); gUnknown_03000D60 = 0; InitLocalLinkPlayer(); - CreateTask(task00_link_test, 0); + CreateTask(Task_PrintTestData, 0); SetMainCallback2(CB2_LinkTest); } @@ -1218,7 +1226,7 @@ static void LinkCB_RequestPlayerDataExchange(void) gLinkCallback = NULL; } -static void task00_link_test(u8 taskId) +static void Task_PrintTestData(u8 taskId) { char sp[32]; int i; @@ -1233,8 +1241,8 @@ static void task00_link_test(u8 taskId) LinkTest_prnthex(gUnknown_03003160, 25, 1, 2); LinkTest_prnthex(gUnknown_03004130, 25, 2, 2); LinkTest_prnthex(GetBlockReceivedStatus(), 15, 5, 2); - LinkTest_prnthex(gUnknown_0300302C, 2, 12, 8); - LinkTest_prnthex(gUnknown_03003070, 2, 13, 8); + LinkTest_prnthex(gLinkDebugSeed, 2, 12, 8); + LinkTest_prnthex(gLinkDebugFlags, 2, 13, 8); LinkTest_prnthex(sub_800B2E8(), 25, 5, 1); LinkTest_prnthex(sub_800B2F8(), 25, 6, 1); LinkTest_prnthex(sub_800B320(), 25, 7, 1); @@ -1244,3 +1252,9 @@ static void task00_link_test(u8 taskId) LinkTest_prnthex(gLinkTestBlockChecksums[i], 10, 4 + i, 4); } } + +void SetLinkDebugValues(u32 seed, u32 flags) +{ + gLinkDebugSeed = seed; + gLinkDebugFlags = flags; +} diff --git a/sym_common.txt b/sym_common.txt index 13eb9e604..298c4470e 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -11,96 +11,7 @@ gUnknown_03002F70: @ 3002F70 .include "text.o" .include "sprite.o" - -gUnknown_03003020: @ 3003020 - .space 0xC - -gUnknown_0300302C: @ 300302C - .space 0x4 - -gLocalLinkPlayerBlock: @ 3003030 - .space 0x3C - -gLinkErrorOccurred: @ 300306C - .space 0x4 - -gUnknown_03003070: @ 3003070 - .space 0x8 - -gUnknown_03003078: @ 3003078 - .space 0x4 - -gUnknown_0300307C: @ 300307C - .space 0x8 - -gLinkHeldKeys: @ 3003084 - .space 0xC - -gRecvCmds: @ 3003090 - .space 0x50 - -gLinkStatus: @ 30030E0 - .space 0x4 - -gUnknown_030030E4: @ 30030E4 - .space 0x4 - -gUnknown_030030E8: @ 30030E8 - .space 0x4 - -gUnknown_030030EC: @ 30030EC - .space 0x4 - -gUnknown_030030F0: @ 30030F0 - .space 0x4 - -gUnknown_030030F4: @ 30030F4 - .space 0x4 - -gSuppressLinkErrorMessage: @ 30030F8 - .space 0x4 - -gSerialIsRFU: @ 30030FC - .space 0x4 - -gUnknown_03003100: @ 3003100 - .space 0x10 - -gSendCmd: @ 3003110 - .space 0x10 - -gUnknown_03003120: @ 3003120 - .space 0x4 - -gReceivedRemoteLinkPlayers: @ 3003124 - .space 0xC - -gLinkTestBGInfo: @ 3003130 - .space 0x10 - -gLinkCallback: @ 3003140 - .space 0x4 - -gShouldAdvanceLinkState: @ 3003144 - .space 0x4 - -gLinkTestBlockChecksums: @ 3003148 - .space 0x8 - -gBlockRequestType: @ 3003150 - .space 0x10 - -gUnknown_03003160: @ 3003160 - .space 0x10 - -gLink: @ 3003170 - .space 0xFC0 - -gUnknown_03004130: @ 3004130 - .space 0x4 - -gUnknown_03004134: @ 3004134 - .space 0xC + .include "link.o" gUnknown_03004140: @ 3004140 .space 0x10 From 8eb7bdc617d126ae0a37acbce90c53cd61c5d668 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 11 Nov 2017 00:39:02 -0500 Subject: [PATCH 029/123] Reinfer file boundaries --- asm/link.s | 3855 +++++++++++++++++++++++++++++++++++- asm/link_rfu.s | 4716 +++++++++------------------------------------ asm/rom_8011DC0.s | 863 --------- src/link.c | 8 - src/link_rfu.c | 16 + src/rom_8011DC0.c | 18 + sym_bss.txt | 2 + 7 files changed, 4753 insertions(+), 4725 deletions(-) create mode 100644 src/link_rfu.c create mode 100644 src/rom_8011DC0.c diff --git a/asm/link.s b/asm/link.s index 9f9a04d49..9c921b4d5 100644 --- a/asm/link.s +++ b/asm/link.s @@ -2519,6 +2519,3859 @@ _0800BE86: .pool thumb_func_end sub_800BE50 -@ break +// RFU; bss indicates that no file boundary exists here + + thumb_func_start sub_800BEC0 +sub_800BEC0: @ 800BEC0 + push {r4,lr} + bl rfu_REQBN_softReset_and_checkID + adds r4, r0, 0 + ldr r0, =0x00008001 + cmp r4, r0 + bne _0800BED4 + ldr r1, =gUnknown_03004140 + movs r0, 0x1 + strb r0, [r1, 0x8] +_0800BED4: + ldr r0, =gUnknown_03004140 + ldrb r2, [r0, 0x4] + adds r1, r0, 0 + cmp r2, 0x17 + beq _0800BEE8 + cmp r2, 0x1 + beq _0800BEE8 + movs r0, 0 + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] +_0800BEE8: + movs r0, 0 + strb r0, [r1, 0x7] + strb r0, [r1, 0xD] + strb r0, [r1, 0x1] + strb r0, [r1] + movs r0, 0xFF + strb r0, [r1, 0x6] + bl sub_800D610 + adds r0, r4, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800BEC0 + + thumb_func_start rfu_REQ_sendData_wrapper +rfu_REQ_sendData_wrapper: @ 800BF0C + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0 + bne _0800BF34 + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x2] + movs r2, 0 + cmp r0, 0x1 + bne _0800BF3C + movs r2, 0x1 + b _0800BF3C + .pool +_0800BF34: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x3] + movs r1, 0 + strb r1, [r0, 0x3] +_0800BF3C: + adds r0, r2, 0 + bl rfu_REQ_sendData + pop {r0} + bx r0 + .pool + thumb_func_end rfu_REQ_sendData_wrapper + + thumb_func_start sub_800BF4C +sub_800BF4C: @ 800BF4C + push {r4-r6,lr} + sub sp, 0x4 + adds r5, r0, 0 + adds r6, r1, 0 + cmp r5, 0 + beq _0800BF94 + mov r1, sp + movs r0, 0 + strh r0, [r1] + ldr r4, =gUnknown_03004140 + ldr r2, =0x01000024 + mov r0, sp + adds r1, r4, 0 + bl CpuSet + movs r0, 0xFF + strb r0, [r4, 0x6] + str r5, [r4, 0x40] + str r6, [r4, 0x44] + ldr r0, =sub_800CEB0 + bl rfu_setMSCCallback + ldr r0, =sub_800C7B4 + bl rfu_setREQCallback + movs r0, 0 + b _0800BF96 + .pool +_0800BF94: + movs r0, 0x4 +_0800BF96: + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_800BF4C + + thumb_func_start sub_800BFA0 +sub_800BFA0: @ 800BFA0 + push {r4,lr} + sub sp, 0x4 + mov r1, sp + movs r0, 0 + strh r0, [r1] + ldr r4, =gUnknown_03004140 + ldr r2, =0x01000020 + mov r0, sp + adds r1, r4, 0 + bl CpuSet + movs r0, 0xFF + strb r0, [r4, 0x6] + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800BFA0 + + thumb_func_start sub_800BFCC +sub_800BFCC: @ 800BFCC + push {r4,lr} + adds r4, r0, 0 + bl sub_800C000 + ldr r1, =gUnknown_03004140 + movs r2, 0x1 + strb r2, [r1, 0x4] + movs r0, 0x2 + strb r0, [r1, 0x5] + str r4, [r1, 0x3C] + ldrb r0, [r4, 0x11] + strb r0, [r1, 0x9] + ldrh r0, [r4, 0x12] + strh r0, [r1, 0x32] + ldrh r0, [r4, 0x14] + strh r0, [r1, 0x18] + ldrb r0, [r4, 0x10] + cmp r0, 0 + beq _0800BFF4 + strb r2, [r1, 0xB] +_0800BFF4: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800BFCC + + thumb_func_start sub_800C000 +sub_800C000: @ 800C000 + push {r4,r5,lr} + ldr r2, =gUnknown_03004140 + movs r0, 0 + strb r0, [r2, 0x5] + strb r0, [r2, 0x4] + movs r1, 0xFF + strb r1, [r2, 0x6] + strb r0, [r2, 0x7] + strb r0, [r2, 0x10] + strb r0, [r2, 0xC] + adds r1, r2, 0 + adds r1, 0x24 + strb r0, [r1] + adds r1, 0xC + strb r0, [r1] + movs r3, 0 + adds r5, r2, 0 + adds r5, 0x28 + movs r4, 0 + adds r2, 0x34 +_0800C028: + lsls r1, r3, 1 + adds r0, r1, r5 + strh r4, [r0] + adds r1, r2 + strh r4, [r1] + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800C028 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800C000 + + thumb_func_start sub_800C048 +sub_800C048: @ 800C048 + ldr r1, =gUnknown_03004140 + movs r0, 0x15 + strb r0, [r1, 0x4] + bx lr + .pool + thumb_func_end sub_800C048 + + thumb_func_start sub_800C054 +sub_800C054: @ 800C054 + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r6, r3, 0 + lsls r0, 24 + lsrs r5, r0, 24 + lsls r1, 16 + lsrs r7, r1, 16 + lsls r2, 16 + lsrs r2, 16 + mov r8, r2 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + cmp r0, 0 + beq _0800C090 + cmp r0, 0x8 + bne _0800C07A + cmp r5, 0x1 + beq _0800C090 +_0800C07A: + movs r0, 0x1 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x1 + b _0800C122 + .pool +_0800C090: + bl rfu_getMasterSlave + lsls r0, 24 + cmp r0, 0 + bne _0800C0B0 + ldr r1, =gUnknown_03004140 + movs r0, 0x2 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x2 + b _0800C122 + .pool +_0800C0B0: + movs r2, 0 + ldrh r0, [r6] + ldr r4, =0x0000ffff + adds r1, r6, 0x2 + ldr r3, =gUnknown_03004140 + cmp r0, r4 + beq _0800C0D0 +_0800C0BE: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xF + bhi _0800C0D0 + ldrh r0, [r1] + adds r1, 0x2 + cmp r0, r4 + bne _0800C0BE +_0800C0D0: + cmp r2, 0x10 + bne _0800C0EC + movs r0, 0x4 + strh r0, [r3, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x4 + b _0800C122 + .pool +_0800C0EC: + cmp r5, 0x1 + bls _0800C0FA + movs r0, 0x1 + strb r0, [r3, 0x7] + movs r5, 0x1 + movs r7, 0 + b _0800C0FE +_0800C0FA: + movs r0, 0 + strb r0, [r3, 0x7] +_0800C0FE: + cmp r5, 0 + beq _0800C108 + movs r0, 0x5 + strb r0, [r3, 0x4] + b _0800C116 +_0800C108: + movs r0, 0x9 + strb r0, [r3, 0x4] + ldrb r0, [r3, 0xB] + cmp r0, 0 + beq _0800C116 + movs r0, 0x2 + strb r0, [r3, 0xB] +_0800C116: + strb r5, [r3, 0x6] + strh r7, [r3, 0x1A] + mov r0, r8 + strh r0, [r3, 0x26] + str r6, [r3, 0x20] + movs r0, 0 +_0800C122: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800C054 + + thumb_func_start sub_800C12C +sub_800C12C: @ 800C12C + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 16 + lsrs r6, r0, 16 + lsls r1, 16 + lsrs r1, 16 + mov r8, r1 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + cmp r0, 0 + beq _0800C164 + subs r0, 0x9 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bls _0800C164 + movs r0, 0x1 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x1 + b _0800C204 + .pool +_0800C164: + bl rfu_getMasterSlave + lsls r0, 24 + cmp r0, 0 + bne _0800C184 + ldr r1, =gUnknown_03004140 + movs r0, 0x2 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x2 + b _0800C204 + .pool +_0800C184: + movs r2, 0 + ldr r0, =gUnknown_03007890 + ldr r1, [r0] + ldrb r3, [r1, 0x8] + ldr r5, =gUnknown_03004140 + adds r7, r0, 0 + cmp r2, r3 + bcs _0800C1B2 + ldrh r0, [r1, 0x14] + cmp r0, r6 + beq _0800C1B2 + adds r4, r1, 0 + adds r1, r3, 0 +_0800C19E: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, r1 + bcs _0800C1B2 + lsls r0, r2, 5 + adds r0, r4, r0 + ldrh r0, [r0, 0x14] + cmp r0, r6 + bne _0800C19E +_0800C1B2: + ldr r0, [r7] + ldrb r0, [r0, 0x8] + cmp r0, 0 + beq _0800C1BE + cmp r2, r0 + bne _0800C1D8 +_0800C1BE: + movs r0, 0x3 + strh r0, [r5, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x3 + b _0800C204 + .pool +_0800C1D8: + ldrb r0, [r5, 0x4] + cmp r0, 0 + beq _0800C1E2 + cmp r0, 0x9 + bne _0800C1EA +_0800C1E2: + movs r0, 0xC + strb r0, [r5, 0x4] + movs r0, 0xD + b _0800C1F0 +_0800C1EA: + movs r0, 0xB + strb r0, [r5, 0x4] + movs r0, 0xC +_0800C1F0: + strb r0, [r5, 0x5] + strh r6, [r5, 0x1E] + mov r0, r8 + strh r0, [r5, 0x1A] + ldrb r0, [r5, 0x7] + cmp r0, 0 + beq _0800C202 + movs r0, 0x7 + strb r0, [r5, 0x7] +_0800C202: + movs r0, 0 +_0800C204: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800C12C + + thumb_func_start sub_800C210 +sub_800C210: @ 800C210 + push {r4-r7,lr} + lsls r0, 24 + lsrs r1, r0, 24 + ldr r6, =gUnknown_03004140 + adds r3, r6, 0 + adds r3, 0x30 + ldrb r2, [r3] + adds r0, r1, 0 + ands r0, r2 + cmp r0, 0 + beq _0800C26C + adds r0, r2, 0 + bics r0, r1 + strb r0, [r3] + movs r4, 0 + ldr r7, =gUnknown_03007890 + movs r5, 0x1 + adds r3, 0x4 + movs r2, 0 +_0800C236: + adds r0, r1, 0 + asrs r0, r4 + ands r0, r5 + cmp r0, 0 + beq _0800C246 + lsls r0, r4, 1 + adds r0, r3 + strh r2, [r0] +_0800C246: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800C236 + ldr r0, [r7] + ldrb r4, [r0, 0x3] + ands r4, r1 + cmp r4, 0 + beq _0800C260 + adds r0, r4, 0 + bl sub_800D334 +_0800C260: + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x33 + adds r1, r4, 0 + bl sub_800D30C +_0800C26C: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800C210 + + thumb_func_start sub_800C27C +sub_800C27C: @ 800C27C + push {r4,r5,lr} + lsls r0, 24 + movs r2, 0 + ldr r1, =gUnknown_03004140 + strb r2, [r1, 0x7] + adds r5, r1, 0 + cmp r0, 0 + beq _0800C29C + bl sub_800C000 + movs r0, 0x17 + strb r0, [r5, 0x4] + b _0800C366 + .pool +_0800C29C: + ldrb r0, [r5, 0x4] + subs r0, 0x5 + cmp r0, 0xD + bhi _0800C352 + lsls r0, 2 + ldr r1, =_0800C2B4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C2B4: + .4byte _0800C2EC + .4byte _0800C2F8 + .4byte _0800C2F8 + .4byte _0800C358 + .4byte _0800C302 + .4byte _0800C30C + .4byte _0800C30C + .4byte _0800C316 + .4byte _0800C320 + .4byte _0800C320 + .4byte _0800C358 + .4byte _0800C326 + .4byte _0800C34C + .4byte _0800C34C +_0800C2EC: + movs r1, 0 + movs r0, 0x8 + strb r0, [r5, 0x4] + strb r1, [r5, 0x5] + movs r2, 0x13 + b _0800C358 +_0800C2F8: + movs r0, 0x7 + strb r0, [r5, 0x4] + movs r0, 0x8 + strb r0, [r5, 0x5] + b _0800C358 +_0800C302: + movs r0, 0 + strb r0, [r5, 0x5] + strb r0, [r5, 0x4] + movs r2, 0x21 + b _0800C358 +_0800C30C: + movs r1, 0 + movs r0, 0xB + strb r0, [r5, 0x4] + strb r1, [r5, 0x5] + b _0800C358 +_0800C316: + movs r0, 0 + strb r0, [r5, 0x5] + strb r0, [r5, 0x4] + movs r2, 0x23 + b _0800C358 +_0800C320: + movs r0, 0xE + strb r0, [r5, 0x4] + b _0800C358 +_0800C326: + ldrb r0, [r5, 0x11] + strb r0, [r5, 0x4] + ldrb r0, [r5, 0x12] + strb r0, [r5, 0x5] + ldr r4, =gUnknown_03007890 + ldr r0, [r4] + ldrb r0, [r0, 0x3] + bl sub_800D334 + ldr r0, [r4] + ldrb r0, [r0, 0x3] + strh r0, [r5, 0x14] + movs r0, 0x33 + movs r1, 0x1 + bl sub_800D30C + b _0800C366 + .pool +_0800C34C: + movs r0, 0x12 + strb r0, [r5, 0x4] + b _0800C358 +_0800C352: + strb r2, [r5, 0x5] + strb r2, [r5, 0x4] + movs r2, 0x43 +_0800C358: + ldrb r0, [r5, 0x4] + cmp r0, 0 + bne _0800C366 + adds r0, r2, 0 + movs r1, 0 + bl sub_800D30C +_0800C366: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_800C27C + + thumb_func_start sub_800C36C +sub_800C36C: @ 800C36C + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x4 + lsls r0, 16 + lsrs r0, 16 + movs r1, 0 + mov r8, r1 + mov r5, sp + adds r5, 0x1 + mov r4, sp + adds r4, 0x2 + mov r1, sp + adds r2, r5, 0 + adds r3, r4, 0 + bl rfu_REQBN_watchLink + mov r0, sp + ldrb r0, [r0] + adds r7, r4, 0 + cmp r0, 0 + beq _0800C43E + ldr r1, =gUnknown_03004140 + mov r0, sp + ldrb r0, [r0] + strh r0, [r1, 0x14] + ldrb r0, [r5] + strh r0, [r1, 0x16] + ldrb r0, [r1, 0x9] + adds r6, r1, 0 + cmp r0, 0 + beq _0800C426 + movs r0, 0x1 + strb r0, [r6, 0xA] + ldrb r0, [r6, 0x6] + cmp r0, 0 + bne _0800C3C2 + ldrb r0, [r5] + cmp r0, 0 + bne _0800C3C2 + movs r0, 0x4 + strb r0, [r6, 0xA] +_0800C3C2: + ldrb r0, [r6, 0xA] + cmp r0, 0x1 + bne _0800C40C + movs r2, 0 + mov r4, sp + movs r5, 0x1 + mov r12, r6 + mov r3, r12 + adds r3, 0x30 + movs r6, 0x34 + add r6, r12 + mov r9, r6 +_0800C3DA: + ldrb r0, [r4] + asrs r0, r2 + ands r0, r5 + cmp r0, 0 + beq _0800C3F8 + adds r0, r5, 0 + lsls r0, r2 + ldrb r1, [r3] + orrs r0, r1 + strb r0, [r3] + lsls r0, r2, 1 + add r0, r9 + mov r6, r12 + ldrh r1, [r6, 0x32] + strh r1, [r0] +_0800C3F8: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C3DA + movs r0, 0x31 + b _0800C41E + .pool +_0800C40C: + movs r0, 0 + strb r0, [r6, 0xA] + mov r0, sp + ldrb r0, [r0] + bl sub_800D334 + movs r0, 0x1 + mov r8, r0 + movs r0, 0x33 +_0800C41E: + movs r1, 0x1 + bl sub_800D30C + b _0800C43A +_0800C426: + mov r0, sp + ldrb r0, [r0] + bl sub_800D334 + movs r1, 0x1 + mov r8, r1 + movs r0, 0x30 + movs r1, 0x2 + bl sub_800D30C +_0800C43A: + bl sub_800D610 +_0800C43E: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800C518 + ldrb r0, [r7] + cmp r0, 0 + beq _0800C49C + movs r2, 0 + ldr r6, =gUnknown_03004140 + movs r3, 0x1 + adds r4, r6, 0 + adds r4, 0x34 + adds r6, 0x30 + adds r5, r7, 0 +_0800C45C: + ldrb r0, [r6] + asrs r0, r2 + ands r0, r3 + cmp r0, 0 + beq _0800C478 + ldrb r0, [r5] + asrs r0, r2 + ands r0, r3 + cmp r0, 0 + beq _0800C478 + lsls r0, r2, 1 + adds r0, r4 + movs r1, 0 + strh r1, [r0] +_0800C478: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C45C + ldr r3, =gUnknown_03004140 + adds r2, r3, 0 + adds r2, 0x30 + ldrb r1, [r7] + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r7] + strh r0, [r3, 0x14] + movs r0, 0x32 + movs r1, 0x1 + bl sub_800D30C +_0800C49C: + ldr r0, =gUnknown_03004140 + adds r3, r0, 0 + adds r3, 0x30 + ldrb r1, [r3] + adds r6, r0, 0 + cmp r1, 0 + beq _0800C514 + movs r4, 0 + movs r2, 0 + movs r5, 0x1 +_0800C4B0: + ldrb r0, [r3] + asrs r0, r2 + ands r0, r5 + cmp r0, 0 + beq _0800C4E2 + lsls r1, r2, 1 + adds r0, r6, 0 + adds r0, 0x34 + adds r1, r0 + ldrh r0, [r1] + cmp r0, 0 + beq _0800C4E2 + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + bne _0800C4E2 + adds r0, r5, 0 + lsls r0, r2 + ldrb r1, [r3] + bics r1, r0 + strb r1, [r3] + orrs r4, r0 + lsls r0, r4, 24 + lsrs r4, r0, 24 +_0800C4E2: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C4B0 + cmp r4, 0 + beq _0800C506 + adds r0, r4, 0 + bl sub_800D334 + movs r6, 0x1 + mov r8, r6 + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x33 + movs r1, 0x1 + bl sub_800D30C +_0800C506: + ldr r0, =gUnknown_03004140 + adds r1, r0, 0 + adds r1, 0x30 + ldrb r1, [r1] + adds r6, r0, 0 + cmp r1, 0 + bne _0800C518 +_0800C514: + movs r0, 0 + strb r0, [r6, 0xA] +_0800C518: + mov r0, r8 + add sp, 0x4 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800C36C + + thumb_func_start rfu_syncVBlank_ +rfu_syncVBlank_: @ 800C530 + push {lr} + bl rfu_syncVBlank + lsls r0, 16 + cmp r0, 0 + beq _0800C548 + movs r0, 0xF1 + movs r1, 0 + bl sub_800D30C + bl sub_800D610 +_0800C548: + pop {r0} + bx r0 + thumb_func_end rfu_syncVBlank_ + + thumb_func_start sub_800C54C +sub_800C54C: @ 800C54C + push {r4,lr} + adds r3, r0, 0 + ldr r1, =gUnknown_03004140 + ldr r2, [r1, 0x40] + cmp r2, 0 + bne _0800C568 + ldrb r0, [r1, 0x4] + cmp r0, 0 + beq _0800C568 + strb r2, [r1, 0x4] + b _0800C736 + .pool +_0800C568: + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x7] + cmp r0, 0 + beq _0800C576 + adds r0, r3, 0 + bl sub_800C744 +_0800C576: + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x4] + cmp r0, 0 + bne _0800C580 + b _0800C700 +_0800C580: + bl rfu_waitREQComplete + movs r0, 0x1 + strb r0, [r4, 0xE] + ldrb r0, [r4, 0x4] + subs r0, 0x1 + cmp r0, 0x16 + bls _0800C592 + b _0800C6F6 +_0800C592: + lsls r0, 2 + ldr r1, =_0800C5A4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C5A4: + .4byte _0800C624 + .4byte _0800C65C + .4byte _0800C662 + .4byte _0800C678 + .4byte _0800C690 + .4byte _0800C696 + .4byte _0800C69C + .4byte _0800C6F6 + .4byte _0800C6A2 + .4byte _0800C6A8 + .4byte _0800C6AE + .4byte _0800C6B4 + .4byte _0800C6C4 + .4byte _0800C6CA + .4byte _0800C6F6 + .4byte _0800C6D0 + .4byte _0800C6E0 + .4byte _0800C6E6 + .4byte _0800C6EC + .4byte _0800C6F6 + .4byte _0800C6F2 + .4byte _0800C6F6 + .4byte _0800C600 +_0800C600: + bl sub_800BEC0 + ldr r1, =0x00008001 + movs r2, 0xFF + cmp r0, r1 + bne _0800C60E + movs r2, 0x44 +_0800C60E: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + adds r0, r2, 0 + b _0800C64E + .pool +_0800C624: + bl sub_800BEC0 + ldr r1, =0x00008001 + cmp r0, r1 + bne _0800C644 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + movs r1, 0x3 + strb r1, [r0, 0x5] + b _0800C6F6 + .pool +_0800C644: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + movs r0, 0xFF +_0800C64E: + movs r1, 0 + bl sub_800D30C + b _0800C6F6 + .pool +_0800C65C: + bl rfu_REQ_reset + b _0800C6F6 +_0800C662: + ldr r0, =gUnknown_03004140 + ldr r2, [r0, 0x3C] + ldrh r0, [r2, 0x2] + ldrb r1, [r2] + ldrb r2, [r2, 0x1] + bl rfu_REQ_configSystem + b _0800C6F6 + .pool +_0800C678: + ldr r0, =gUnknown_03004140 + ldr r3, [r0, 0x3C] + ldrb r0, [r3, 0x4] + ldrh r1, [r3, 0x6] + ldr r2, [r3, 0x8] + ldr r3, [r3, 0xC] + bl rfu_REQ_configGameData + b _0800C6F6 + .pool +_0800C690: + bl rfu_REQ_startSearchChild + b _0800C6F6 +_0800C696: + bl rfu_REQ_pollSearchChild + b _0800C6F6 +_0800C69C: + bl rfu_REQ_endSearchChild + b _0800C6F6 +_0800C6A2: + bl rfu_REQ_startSearchParent + b _0800C6F6 +_0800C6A8: + bl rfu_REQ_pollSearchParent + b _0800C6F6 +_0800C6AE: + bl rfu_REQ_endSearchParent + b _0800C6F6 +_0800C6B4: + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x1E] + bl rfu_REQ_startConnectParent + b _0800C6F6 + .pool +_0800C6C4: + bl rfu_REQ_pollConnectParent + b _0800C6F6 +_0800C6CA: + bl rfu_REQ_endConnectParent + b _0800C6F6 +_0800C6D0: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x3] + bl rfu_REQ_CHILD_startConnectRecovery + b _0800C6F6 + .pool +_0800C6E0: + bl rfu_REQ_CHILD_pollConnectRecovery + b _0800C6F6 +_0800C6E6: + bl rfu_REQ_CHILD_endConnectRecovery + b _0800C6F6 +_0800C6EC: + bl rfu_REQ_changeMasterSlave + b _0800C6F6 +_0800C6F2: + bl rfu_REQ_stopMode +_0800C6F6: + bl rfu_waitREQComplete + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0xE] +_0800C700: + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x4] + subs r0, 0x12 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _0800C710 + b _0800C576 +_0800C710: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800C726 + movs r0, 0 + bl sub_800C36C + lsls r0, 24 + cmp r0, 0 + bne _0800C736 +_0800C726: + bl sub_800CF34 + bl sub_800D158 + bl sub_800D268 + bl sub_800D434 +_0800C736: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800C54C + + thumb_func_start sub_800C744 +sub_800C744: @ 800C744 + push {r4,lr} + adds r3, r0, 0 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x7] + adds r4, r0, 0 + cmp r1, 0x5 + bne _0800C76E + movs r2, 0x1 + strb r2, [r4, 0x6] + strb r1, [r4, 0x4] + ldrh r0, [r4, 0x1C] + strh r0, [r4, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C76C + movs r0, 0x6 + strb r0, [r4, 0x7] + b _0800C76E + .pool +_0800C76C: + strb r2, [r4, 0x7] +_0800C76E: + ldrb r0, [r4, 0x7] + cmp r0, 0x1 + bne _0800C798 + strb r0, [r4, 0x6] + movs r0, 0x5 + strb r0, [r4, 0x4] + adds r0, r3, 0 + movs r1, 0x8C + bl __umodsi3 + strh r0, [r4, 0x1A] + movs r1, 0x8C + subs r1, r0 + strh r1, [r4, 0x1C] + lsls r0, 16 + cmp r0, 0 + beq _0800C794 + movs r0, 0x2 + b _0800C796 +_0800C794: + movs r0, 0x3 +_0800C796: + strb r0, [r4, 0x7] +_0800C798: + ldrb r0, [r4, 0x7] + cmp r0, 0x3 + bne _0800C7AE + movs r0, 0 + strb r0, [r4, 0x6] + movs r0, 0x28 + strh r0, [r4, 0x1A] + movs r0, 0x4 + strb r0, [r4, 0x7] + movs r0, 0x9 + strb r0, [r4, 0x4] +_0800C7AE: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_800C744 + + thumb_func_start sub_800C7B4 +sub_800C7B4: @ 800C7B4 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x4 + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + lsls r1, 16 + lsrs r6, r1, 16 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0xE] + adds r7, r0, 0 + cmp r1, 0 + bne _0800C7D2 + b _0800CC98 +_0800C7D2: + movs r0, 0 + strb r0, [r7, 0xE] + mov r0, r8 + subs r0, 0x10 + cmp r0, 0x2D + bls _0800C7E0 + b _0800CC8A +_0800C7E0: + lsls r0, 2 + ldr r1, =_0800C7F4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C7F4: + .4byte _0800C8AC + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800C8D8 + .4byte _0800C8C4 + .4byte _0800CC8A + .4byte _0800C8EC + .4byte _0800C8FC + .4byte _0800C920 + .4byte _0800C940 + .4byte _0800C960 + .4byte _0800C9D0 + .4byte _0800CA02 + .4byte _0800CA18 + .4byte _0800CA60 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CBD8 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CAD0 + .4byte _0800CB1C + .4byte _0800CB64 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC78 +_0800C8AC: + cmp r6, 0 + beq _0800C8B2 + b _0800CC8A +_0800C8B2: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + movs r1, 0x4 + strb r1, [r0, 0x5] + b _0800CC8A + .pool +_0800C8C4: + cmp r6, 0 + beq _0800C8CA + b _0800CC8A +_0800C8CA: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + strb r6, [r0, 0x5] + b _0800CC8A + .pool +_0800C8D8: + cmp r6, 0 + beq _0800C8DE + b _0800CC8A +_0800C8DE: + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0x5] + strb r6, [r0, 0x4] + movs r0, 0 + b _0800CBF6 + .pool +_0800C8EC: + cmp r6, 0 + beq _0800C8F2 + b _0800CC8A +_0800C8F2: + ldr r1, =gUnknown_03004140 + movs r0, 0x6 + b _0800CA0C + .pool +_0800C8FC: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800C906 + b _0800CC8A +_0800C906: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C912 + b _0800CC8A +_0800C912: + movs r0, 0x7 + strb r0, [r1, 0x4] + movs r0, 0x8 + strb r0, [r1, 0x5] + b _0800CC8A + .pool +_0800C920: + cmp r6, 0 + beq _0800C926 + b _0800CC8A +_0800C926: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + strb r6, [r0, 0x5] + ldrb r0, [r0, 0x7] + cmp r0, 0 + beq _0800C936 + b _0800CC8A +_0800C936: + movs r0, 0x13 + b _0800CBF6 + .pool +_0800C940: + cmp r6, 0 + beq _0800C946 + b _0800CC8A +_0800C946: + ldrb r0, [r7, 0xB] + cmp r0, 0x1 + bne _0800C956 + ldrh r0, [r7, 0x1A] + cmp r0, 0x1 + bls _0800C956 + subs r0, 0x1 + strh r0, [r7, 0x1A] +_0800C956: + ldr r1, =gUnknown_03004140 + movs r0, 0xA + b _0800CA0C + .pool +_0800C960: + cmp r6, 0 + bne _0800C9A6 + bl sub_800D294 + lsls r0, 24 + lsrs r0, 24 + mov r1, sp + strb r0, [r1] + ldr r4, =gUnknown_03004140 + strh r0, [r4, 0x14] + cmp r0, 0 + beq _0800C980 + movs r0, 0x20 + movs r1, 0x1 + bl sub_800D30C +_0800C980: + ldrb r0, [r4, 0xB] + cmp r0, 0 + beq _0800C9A6 + ldrh r0, [r4, 0x1A] + cmp r0, 0x1 + beq _0800C9A6 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0x4 + bne _0800C9A6 + bl rfu_REQ_endSearchParent + bl rfu_waitREQComplete + movs r0, 0x9 + strb r0, [r4, 0x4] + movs r0, 0x1 + strb r0, [r4, 0xB] +_0800C9A6: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800C9B0 + b _0800CC8A +_0800C9B0: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C9BC + b _0800CC8A +_0800C9BC: + movs r0, 0xB + strb r0, [r1, 0x4] + movs r0, 0 + strb r0, [r1, 0x5] + b _0800CC8A + .pool +_0800C9D0: + cmp r6, 0 + beq _0800C9D6 + b _0800CC8A +_0800C9D6: + ldr r2, =gUnknown_03004140 + ldrb r0, [r2, 0x5] + strb r0, [r2, 0x4] + ldrb r1, [r2, 0x7] + cmp r1, 0 + bne _0800C9F4 + lsls r0, 24 + cmp r0, 0 + beq _0800C9EA + b _0800CC8A +_0800C9EA: + movs r0, 0x21 + b _0800CBF6 + .pool +_0800C9F4: + cmp r1, 0x7 + bne _0800C9FA + b _0800CC8A +_0800C9FA: + movs r0, 0x5 + strb r0, [r2, 0x4] + strb r0, [r2, 0x7] + b _0800CC8A +_0800CA02: + cmp r6, 0 + beq _0800CA08 + b _0800CC8A +_0800CA08: + ldr r1, =gUnknown_03004140 + movs r0, 0xD +_0800CA0C: + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + b _0800CC8A + .pool +_0800CA18: + cmp r6, 0 + bne _0800CA3C + ldr r4, =gUnknown_03004150 + mov r0, sp + adds r1, r4, 0 + bl rfu_getConnectParentStatus + lsls r0, 16 + cmp r0, 0 + bne _0800CA3C + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CA3C + adds r1, r4, 0 + subs r1, 0x10 + movs r0, 0xE + strb r0, [r1, 0x4] +_0800CA3C: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800CA46 + b _0800CC8A +_0800CA46: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800CA52 + b _0800CC8A +_0800CA52: + movs r0, 0xE + strb r0, [r1, 0x4] + b _0800CC8A + .pool +_0800CA60: + cmp r6, 0 + beq _0800CA66 + b _0800CC8A +_0800CA66: + ldr r4, =gUnknown_03004150 + mov r0, sp + adds r1, r4, 0 + bl rfu_getConnectParentStatus + lsls r0, 16 + cmp r0, 0 + beq _0800CA78 + b _0800CC8A +_0800CA78: + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CA9C + adds r1, r4, 0 + subs r1, 0x10 + movs r0, 0x13 + strb r0, [r1, 0x4] + movs r0, 0xF + strb r0, [r1, 0x5] + movs r0, 0x22 + strh r0, [r1, 0x1E] + ldrb r0, [r1, 0x10] + strh r0, [r1, 0x14] + b _0800CABC + .pool +_0800CA9C: + adds r1, r4, 0 + subs r1, 0x10 + strb r6, [r1, 0x5] + strb r6, [r1, 0x4] + movs r0, 0x23 + strh r0, [r1, 0x1E] + mov r0, sp + ldrb r0, [r0] + strh r0, [r1, 0x14] + ldrb r0, [r1, 0x7] + cmp r0, 0 + beq _0800CABC + movs r0, 0x3 + strb r0, [r1, 0x7] + movs r0, 0x9 + strb r0, [r1, 0x4] +_0800CABC: + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x1E] + movs r1, 0x1 + bl sub_800D30C + movs r0, 0 + strh r0, [r4, 0x1E] + b _0800CC8A + .pool +_0800CAD0: + cmp r6, 0 + beq _0800CAD6 + b _0800CC8A +_0800CAD6: + ldr r2, =gUnknown_03007890 + ldr r3, [r2] + ldrb r0, [r3, 0x3] + movs r1, 0 + strh r0, [r7, 0x14] + movs r0, 0x11 + strb r0, [r7, 0x5] + strb r0, [r7, 0x4] + strb r1, [r7, 0x10] + ldrb r0, [r3, 0x3] + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0800CAF4 + b _0800CC8A +_0800CAF4: + adds r1, r7, 0 + movs r3, 0x1 +_0800CAF8: + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bls _0800CB08 + b _0800CC8A +_0800CB08: + ldr r0, [r2] + ldrb r0, [r0, 0x3] + ldrb r4, [r7, 0x10] + asrs r0, r4 + ands r0, r3 + cmp r0, 0 + beq _0800CAF8 + b _0800CC8A + .pool +_0800CB1C: + cmp r6, 0 + bne _0800CB3A + mov r0, sp + bl rfu_CHILD_getConnectRecoveryStatus + lsls r0, 16 + cmp r0, 0 + bne _0800CB3A + mov r0, sp + ldrb r0, [r0] + cmp r0, 0x1 + bhi _0800CB3A + ldr r1, =gUnknown_03004140 + movs r0, 0x12 + strb r0, [r1, 0x4] +_0800CB3A: + ldr r2, =gUnknown_03004140 + ldrb r0, [r2, 0x10] + lsls r0, 1 + adds r1, r2, 0 + adds r1, 0x34 + adds r1, r0, r1 + ldrh r0, [r1] + cmp r0, 0 + bne _0800CB4E + b _0800CC8A +_0800CB4E: + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + beq _0800CB5A + b _0800CC8A +_0800CB5A: + movs r0, 0x12 + strb r0, [r2, 0x4] + b _0800CC8A + .pool +_0800CB64: + cmp r6, 0 + beq _0800CB6A + b _0800CC8A +_0800CB6A: + mov r0, sp + bl rfu_CHILD_getConnectRecoveryStatus + lsls r0, 16 + cmp r0, 0 + beq _0800CB78 + b _0800CC8A +_0800CB78: + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CB94 + ldr r1, =gUnknown_03004140 + movs r0, 0x13 + strb r0, [r1, 0x4] + movs r0, 0x16 + strb r0, [r1, 0x5] + movs r0, 0x32 + strh r0, [r1, 0x1E] + b _0800CBA8 + .pool +_0800CB94: + ldr r4, =gUnknown_03004140 + strb r6, [r4, 0x5] + strb r6, [r4, 0x4] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x3] + bl sub_800D334 + movs r0, 0x33 + strh r0, [r4, 0x1E] +_0800CBA8: + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, r5, 0 + adds r1, 0x34 + adds r0, r1 + movs r1, 0 + movs r4, 0 + strh r4, [r0] + adds r0, r5, 0 + adds r0, 0x30 + strb r1, [r0] + strb r1, [r5, 0xA] + ldrb r0, [r5, 0x1E] + movs r1, 0x1 + bl sub_800D30C + strh r4, [r5, 0x1E] + b _0800CC8A + .pool +_0800CBD8: + cmp r6, 0 + bne _0800CC8A + ldr r5, =gUnknown_03004140 + ldrb r1, [r5, 0x5] + adds r0, r1, 0 + cmp r0, 0x16 + bne _0800CC04 + ldrb r0, [r5, 0x11] + strb r0, [r5, 0x4] + ldrb r0, [r5, 0x12] + strb r0, [r5, 0x5] + ldrb r0, [r5, 0x2] + movs r0, 0x1 + strb r0, [r5, 0x2] + movs r0, 0x41 +_0800CBF6: + movs r1, 0 + bl sub_800D30C + b _0800CC8A + .pool +_0800CC04: + cmp r0, 0xF + bne _0800CC8A + strb r1, [r5, 0x4] + ldrb r0, [r5, 0x2] + movs r4, 0x1 + strb r4, [r5, 0x2] + movs r0, 0x41 + movs r1, 0 + bl sub_800D30C + adds r1, r5, 0 + adds r1, 0x24 + ldrb r0, [r5, 0x10] + lsls r4, r0 + ldrb r0, [r1] + orrs r4, r0 + strb r4, [r1] + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, 0x4 + adds r0, r1 + ldrh r1, [r5, 0x26] + movs r7, 0 + strh r1, [r0] + ldrb r1, [r5, 0x10] + movs r0, 0x4 + bl rfu_clearSlot + mov r4, sp + ldrb r0, [r5, 0x10] + movs r1, 0xE + bl rfu_NI_CHILD_setSendGameName + strb r0, [r4] + lsls r0, 24 + cmp r0, 0 + beq _0800CC8A + strb r7, [r5, 0x5] + strb r7, [r5, 0x4] + bl sub_800D610 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x2] + ldrb r0, [r0, 0x3] + orrs r0, r1 + bl sub_800D334 + mov r0, sp + ldrb r0, [r0] + strh r0, [r5, 0x14] + movs r0, 0x25 + movs r1, 0x1 + bl sub_800D30C + b _0800CC8A + .pool +_0800CC78: + cmp r6, 0 + bne _0800CC8A + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0x5] + strb r6, [r0, 0x4] + movs r0, 0x42 + movs r1, 0 + bl sub_800D30C +_0800CC8A: + ldr r1, =gUnknown_03004140 + movs r0, 0x1 + strb r0, [r1, 0xE] + b _0800CCE6 + .pool +_0800CC98: + cmp r6, 0x3 + bne _0800CCE6 + ldrb r0, [r7, 0xF] + cmp r0, 0 + beq _0800CCE6 + mov r3, r8 + cmp r3, 0x24 + beq _0800CCB0 + cmp r3, 0x26 + beq _0800CCB0 + cmp r3, 0x27 + bne _0800CCE6 +_0800CCB0: + bl rfu_REQ_RFUStatus + bl rfu_waitREQComplete + mov r0, sp + bl rfu_getRFUStatus + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CCE6 + ldr r4, =gUnknown_03007890 + ldr r0, [r4] + ldrb r0, [r0] + cmp r0, 0 + bne _0800CCE6 + bl rfu_getSTWIRecvBuffer + ldr r1, [r4] + ldrb r1, [r1, 0x2] + strb r1, [r0, 0x4] + movs r1, 0x1 + strb r1, [r0, 0x5] + movs r0, 0x29 + bl sub_800C36C + movs r6, 0 +_0800CCE6: + mov r4, r8 + cmp r4, 0x26 + bne _0800CCEE + b _0800CE02 +_0800CCEE: + cmp r4, 0x26 + bgt _0800CD00 + cmp r4, 0x10 + bne _0800CCF8 + b _0800CE20 +_0800CCF8: + b _0800CE3E + .pool +_0800CD00: + mov r0, r8 + cmp r0, 0x30 + beq _0800CD0E + cmp r0, 0x3D + bne _0800CD0C + b _0800CE20 +_0800CD0C: + b _0800CE3E +_0800CD0E: + cmp r6, 0 + beq _0800CD14 + b _0800CE42 +_0800CD14: + bl rfu_getSTWIRecvBuffer + ldr r4, =gUnknown_03004140 + ldrb r0, [r0, 0x8] + strh r0, [r4, 0x14] + bl sub_800D358 + adds r2, r4, 0 + adds r2, 0x30 + ldrb r1, [r2] + cmp r1, 0 + beq _0800CD6A + ldrb r0, [r4, 0x14] + adds r3, r1, 0 + bics r3, r0 + adds r0, r3, 0 + strb r0, [r2] + movs r3, 0 + adds r7, r4, 0 + adds r1, r7, 0 + movs r5, 0x1 + adds r4, r1, 0 + adds r4, 0x34 + movs r2, 0 +_0800CD44: + ldrh r0, [r1, 0x14] + asrs r0, r3 + ands r0, r5 + cmp r0, 0 + beq _0800CD54 + lsls r0, r3, 1 + adds r0, r4 + strh r2, [r0] +_0800CD54: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800CD44 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x6] + cmp r0, 0 + bne _0800CD6A + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] +_0800CD6A: + mov r3, sp + ldr r1, =gUnknown_03004140 + ldrb r2, [r1] + ldrb r0, [r1, 0x14] + ands r0, r2 + strb r0, [r3] + movs r3, 0 + adds r7, r1, 0 + ldr r2, =gUnknown_03007890 + mov r1, sp + movs r5, 0x1 + adds r4, r7, 0 +_0800CD82: + ldrb r0, [r1] + asrs r0, r3 + ands r0, r5 + cmp r0, 0 + beq _0800CD96 + ldrb r0, [r4, 0x1] + cmp r0, 0 + beq _0800CD96 + subs r0, 0x1 + strb r0, [r7, 0x1] +_0800CD96: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800CD82 + ldrb r1, [r7, 0x14] + ldrb r0, [r7] + bics r0, r1 + strb r0, [r7] + ldrb r1, [r7, 0x7] + cmp r1, 0 + beq _0800CDE0 + ldr r0, [r2] + ldrb r0, [r0] + cmp r0, 0xFF + bne _0800CDF2 + cmp r1, 0x8 + bne _0800CDCC + ldrh r0, [r7, 0x1C] + strh r0, [r7, 0x1A] + movs r0, 0x6 + strb r0, [r7, 0x7] + b _0800CDDE + .pool +_0800CDCC: + ldrb r0, [r7, 0x4] + subs r0, 0x6 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _0800CDE0 + movs r0, 0x1 + strb r0, [r7, 0x7] + movs r0, 0x5 +_0800CDDE: + strb r0, [r7, 0x4] +_0800CDE0: + ldr r0, [r2] + ldrb r0, [r0] + cmp r0, 0xFF + bne _0800CDF2 + ldrb r0, [r7, 0x4] + cmp r0, 0 + bne _0800CDF2 + movs r0, 0xFF + strb r0, [r7, 0x6] +_0800CDF2: + ldrb r0, [r7, 0xE] + cmp r0, 0 + bne _0800CE3E + movs r0, 0x40 + movs r1, 0x1 + bl sub_800D30C + b _0800CE3E +_0800CE02: + bl sub_800D20C + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0xFF + beq _0800CE3E + movs r0, 0x50 + movs r1, 0 + bl sub_800D30C + b _0800CE3E + .pool +_0800CE20: + cmp r6, 0 + bne _0800CE42 + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0xD] + strb r6, [r0, 0x1] + strb r6, [r0] + movs r1, 0xFF + strb r1, [r0, 0x6] + bl sub_800D610 + mov r4, r8 + cmp r4, 0x3D + bne _0800CE3E + bl sub_800BFA0 +_0800CE3E: + cmp r6, 0 + beq _0800CE92 +_0800CE42: + ldr r7, =gUnknown_03004140 + mov r0, r8 + cmp r0, 0x1C + bne _0800CE74 + cmp r6, 0 + beq _0800CE74 + ldrb r0, [r7, 0x7] + cmp r0, 0x4 + bne _0800CE74 + ldr r2, =gUnknown_03007890 + ldr r1, [r2] + movs r0, 0x1 + strb r0, [r1] + ldr r1, [r2] + movs r0, 0xF + strb r0, [r1, 0x2] + bl sub_800D334 + bl rfu_waitREQComplete + b _0800CEA4 + .pool +_0800CE74: + movs r1, 0 + mov r3, r8 + strh r3, [r7, 0x14] + strh r6, [r7, 0x16] + ldrb r0, [r7, 0xE] + cmp r0, 0 + beq _0800CE86 + strb r1, [r7, 0x5] + strb r1, [r7, 0x4] +_0800CE86: + movs r0, 0xF0 + movs r1, 0x2 + bl sub_800D30C + bl sub_800D610 +_0800CE92: + mov r4, r8 + cmp r4, 0xFF + bne _0800CEA4 + movs r0, 0xF2 + movs r1, 0 + bl sub_800D30C + bl sub_800D610 +_0800CEA4: + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800C7B4 + + thumb_func_start sub_800CEB0 +sub_800CEB0: @ 800CEB0 + push {r4-r7,lr} + sub sp, 0x4 + lsls r0, 16 + lsrs r6, r0, 16 + ldr r4, =gUnknown_03004140 + ldrb r7, [r4, 0xE] + movs r0, 0 + strb r0, [r4, 0xE] + movs r0, 0x1 + strb r0, [r4, 0xF] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r5, [r0] + cmp r5, 0 + bne _0800CEEC + adds r0, r6, 0 + bl sub_800C36C + ldrb r0, [r4, 0x2] + cmp r0, 0x1 + beq _0800CF04 + bl sub_800D610 + strb r5, [r4, 0xF] + strb r7, [r4, 0xE] + b _0800CF28 + .pool +_0800CEEC: + mov r0, sp + bl rfu_UNI_PARENT_getDRAC_ACK + lsls r0, 16 + cmp r0, 0 + bne _0800CF04 + mov r1, sp + ldrb r0, [r4, 0x3] + ldrb r1, [r1] + orrs r0, r1 + ldrb r1, [r4, 0x3] + strb r0, [r4, 0x3] +_0800CF04: + ldr r4, =gUnknown_03004140 + ldr r1, [r4, 0x44] + cmp r1, 0 + beq _0800CF20 + adds r0, r6, 0 + bl _call_via_r1 + bl rfu_waitREQComplete + ldrb r0, [r4, 0x2] + cmp r0, 0x2 + bne _0800CF20 + bl sub_800D610 +_0800CF20: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0xF] + strb r7, [r1, 0xE] +_0800CF28: + add sp, 0x4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800CEB0 + + thumb_func_start sub_800CF34 +sub_800CF34: @ 800CF34 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + subs r0, 0x5 + lsls r0, 24 + lsrs r0, 24 + adds r3, r1, 0 + cmp r0, 0x3 + bls _0800CF52 + b _0800D146 +_0800CF52: + ldr r0, =gUnknown_03007890 + ldr r2, [r0] + ldrb r1, [r2, 0x2] + ldrb r0, [r3, 0xC] + adds r4, r1, 0 + eors r4, r0 + ands r4, r1 + ldrb r0, [r2, 0x7] + bics r4, r0 + mov r8, r4 + strb r1, [r3, 0xC] + cmp r4, 0 + beq _0800CF7A + strh r4, [r3, 0x14] + movs r0, 0x10 + movs r1, 0x1 + str r3, [sp, 0x4] + bl sub_800D30C + ldr r3, [sp, 0x4] +_0800CF7A: + movs r0, 0 + str r0, [sp] + movs r6, 0 + adds r7, r3, 0 + movs r1, 0x24 + adds r1, r3 + mov r9, r1 +_0800CF88: + movs r0, 0x80 + lsls r0, 17 + lsls r0, r6 + lsrs r4, r0, 24 + movs r5, 0 + mov r0, r8 + ands r0, r4 + cmp r0, 0 + beq _0800CFDA + lsls r1, r6, 1 + adds r0, r7, 0 + adds r0, 0x28 + adds r1, r0 + ldrh r0, [r7, 0x26] + strh r0, [r1] + mov r2, r9 + ldrb r1, [r2] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r2] + adds r6, 0x1 + mov r10, r6 + b _0800D090 + .pool +_0800CFC0: + ldrb r1, [r7] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r7] + ldrb r0, [r7, 0x1] + adds r0, 0x1 + strb r0, [r7, 0x1] + ldr r0, [sp] + orrs r0, r4 + str r0, [sp] + movs r0, 0x1 + orrs r5, r0 + b _0800D024 +_0800CFDA: + mov r1, r9 + ldrb r0, [r1] + ands r0, r4 + adds r2, r6, 0x1 + mov r10, r2 + cmp r0, 0 + beq _0800D090 + ldr r0, =gUnknown_03007880 + lsls r1, r6, 2 + adds r1, r0 + ldr r1, [r1] + ldrh r0, [r1, 0x34] + cmp r0, 0x46 + bne _0800D040 + adds r0, r1, 0 + adds r0, 0x61 + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800D058 + movs r5, 0x2 + ldr r3, [r3, 0x20] + ldrh r2, [r3] + ldr r0, =0x0000ffff + cmp r2, r0 + beq _0800D024 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + lsls r1, r6, 5 + adds r0, r1 + ldrh r0, [r0, 0x18] + ldr r1, =0x0000ffff +_0800D018: + cmp r0, r2 + beq _0800CFC0 + adds r3, 0x2 + ldrh r2, [r3] + cmp r2, r1 + bne _0800D018 +_0800D024: + movs r0, 0x1 + ands r0, r5 + cmp r0, 0 + bne _0800D058 + movs r0, 0x4 + orrs r5, r0 + b _0800D058 + .pool +_0800D040: + lsls r1, r6, 1 + adds r0, r3, 0 + adds r0, 0x28 + adds r1, r0 + ldrh r0, [r1] + subs r0, 0x1 + strh r0, [r1] + ldr r1, =0x0000ffff + ands r0, r1 + cmp r0, 0 + bne _0800D058 + movs r5, 0x6 +_0800D058: + movs r0, 0x2 + ands r0, r5 + cmp r0, 0 + beq _0800D07E + mov r2, r9 + ldrb r0, [r2] + bics r0, r4 + movs r2, 0 + mov r1, r9 + strb r0, [r1] + lsls r0, r6, 1 + adds r1, r7, 0 + adds r1, 0x28 + adds r0, r1 + strh r2, [r0] + movs r0, 0x8 + adds r1, r6, 0 + bl rfu_clearSlot +_0800D07E: + movs r0, 0x4 + ands r5, r0 + ldr r3, =gUnknown_03004140 + cmp r5, 0 + beq _0800D090 + ldrb r1, [r7, 0xD] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r7, 0xD] +_0800D090: + mov r2, r10 + lsls r0, r2, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bhi _0800D09C + b _0800CF88 +_0800D09C: + ldr r4, [sp] + cmp r4, 0 + beq _0800D0AE + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x11 + movs r1, 0x1 + bl sub_800D30C +_0800D0AE: + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0xD] + cmp r0, 0 + beq _0800D0EA + movs r5, 0x1 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x6] + cmp r0, 0 + beq _0800D0CE + ldrb r0, [r1, 0x3] + ldrb r1, [r1] + ands r0, r1 + cmp r0, r1 + beq _0800D0CE + movs r5, 0 +_0800D0CE: + cmp r5, 0 + beq _0800D0EA + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0xD] + bl sub_800D334 + ldrb r0, [r4, 0xD] + movs r1, 0 + strh r0, [r4, 0x14] + strb r1, [r4, 0xD] + movs r0, 0x12 + movs r1, 0x1 + bl sub_800D30C +_0800D0EA: + ldr r0, =gUnknown_03004140 + adds r1, r0, 0 + adds r1, 0x24 + ldrb r1, [r1] + adds r3, r0, 0 + cmp r1, 0 + bne _0800D146 + ldrb r0, [r3, 0x4] + cmp r0, 0x8 + bne _0800D146 + ldrb r0, [r3, 0x7] + cmp r0, 0 + bne _0800D120 + strb r0, [r3, 0x5] + strb r0, [r3, 0x4] + movs r0, 0x14 + movs r1, 0 + bl sub_800D30C + b _0800D146 + .pool +_0800D120: + cmp r0, 0x2 + bne _0800D12C + movs r0, 0x3 + strb r0, [r3, 0x7] + movs r0, 0x9 + b _0800D132 +_0800D12C: + movs r0, 0x1 + strb r0, [r3, 0x7] + movs r0, 0x5 +_0800D132: + strb r0, [r3, 0x4] + ldrb r0, [r3] + cmp r0, 0 + beq _0800D146 + movs r0, 0 + strh r0, [r3, 0x1A] + movs r0, 0x8 + strb r0, [r3, 0x7] + movs r0, 0x5 + strb r0, [r3, 0x4] +_0800D146: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800CF34 + + thumb_func_start sub_800D158 +sub_800D158: @ 800D158 + push {r4-r6,lr} + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r6, r0, 0 + movs r0, 0 + strh r0, [r1] + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x4] + cmp r0, 0xF + bne _0800D1BC + ldrb r1, [r4, 0x10] + lsls r1, 1 + adds r5, r4, 0 + adds r5, 0x28 + adds r1, r5 + ldrh r0, [r1] + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + beq _0800D192 + ldr r1, =gUnknown_03007880 + ldrb r0, [r4, 0x10] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0x27 + bne _0800D1BC +_0800D192: + bl sub_800D630 + movs r0, 0x18 + strb r0, [r4, 0x4] + ldrb r1, [r4, 0x10] + movs r0, 0x4 + bl rfu_clearSlot + adds r2, r4, 0 + adds r2, 0x24 + movs r1, 0x1 + ldrb r0, [r4, 0x10] + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r4, 0x10] + lsls r0, 1 + adds r0, r5 + movs r1, 0 + strh r1, [r0] +_0800D1BC: + ldr r0, =0x04000208 + strh r6, [r0] + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x4] + cmp r0, 0x18 + bne _0800D1F6 + ldrb r0, [r5, 0x2] + cmp r0, 0x1 + bne _0800D1D2 + bl sub_800D630 +_0800D1D2: + ldrb r0, [r5, 0x2] + adds r4, r0, 0 + cmp r4, 0 + bne _0800D1F6 + strb r4, [r5, 0x5] + strb r4, [r5, 0x4] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x2] + ldrb r0, [r0, 0x3] + orrs r0, r1 + bl sub_800D334 + strh r4, [r5, 0x14] + movs r0, 0x25 + movs r1, 0x1 + bl sub_800D30C +_0800D1F6: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D158 + + thumb_func_start sub_800D20C +sub_800D20C: @ 800D20C + push {r4,r5,lr} + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x4] + cmp r0, 0xF + bne _0800D258 + ldr r1, =gUnknown_03007880 + ldrb r2, [r5, 0x10] + lsls r0, r2, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0x26 + bne _0800D258 + movs r4, 0 + strb r4, [r5, 0x5] + strb r4, [r5, 0x4] + movs r0, 0x4 + adds r1, r2, 0 + bl rfu_clearSlot + adds r2, r5, 0 + adds r2, 0x24 + movs r1, 0x1 + ldrb r0, [r5, 0x10] + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, r5, 0 + adds r1, 0x28 + adds r0, r1 + strh r4, [r0] + movs r0, 0x24 + movs r1, 0 + bl sub_800D30C +_0800D258: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D20C + + thumb_func_start sub_800D268 +sub_800D268: @ 800D268 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x6] + cmp r0, 0 + bne _0800D28C + ldrb r0, [r1, 0xA] + cmp r0, 0x1 + bne _0800D28C + ldrb r0, [r1, 0x4] + strb r0, [r1, 0x11] + ldrb r0, [r1, 0x5] + strb r0, [r1, 0x12] + movs r0, 0x10 + strb r0, [r1, 0x4] + movs r0, 0x11 + strb r0, [r1, 0x5] + movs r0, 0x2 + strb r0, [r1, 0xA] +_0800D28C: + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D268 + + thumb_func_start sub_800D294 +sub_800D294: @ 800D294 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + movs r6, 0 + movs r5, 0 + ldr r1, =gUnknown_03007890 + ldr r0, [r1] + ldrb r0, [r0, 0x8] + cmp r6, r0 + bcs _0800D2F0 + mov r8, r0 + ldr r0, =gUnknown_03004140 + mov r10, r0 + mov r9, r1 +_0800D2B4: + mov r1, r10 + ldr r3, [r1, 0x20] + ldrh r2, [r3] + adds r0, r5, 0x1 + mov r12, r0 + ldr r1, =0x0000ffff + cmp r2, r1 + beq _0800D2E6 + mov r1, r9 + ldr r0, [r1] + lsls r1, r5, 5 + adds r0, r1 + ldrh r4, [r0, 0x18] + ldr r7, =0x0000ffff + movs r1, 0x1 + lsls r1, r5 +_0800D2D4: + cmp r4, r2 + bne _0800D2DE + orrs r6, r1 + lsls r0, r6, 24 + lsrs r6, r0, 24 +_0800D2DE: + adds r3, 0x2 + ldrh r2, [r3] + cmp r2, r7 + bne _0800D2D4 +_0800D2E6: + mov r1, r12 + lsls r0, r1, 24 + lsrs r5, r0, 24 + cmp r5, r8 + bcc _0800D2B4 +_0800D2F0: + adds r0, r6, 0 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D294 + + thumb_func_start sub_800D30C +sub_800D30C: @ 800D30C + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r4, =gUnknown_03004140 + ldr r2, [r4, 0x40] + cmp r2, 0 + beq _0800D322 + bl _call_via_r2 +_0800D322: + movs r0, 0 + strh r0, [r4, 0x16] + strh r0, [r4, 0x14] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D30C + + thumb_func_start sub_800D334 +sub_800D334: @ 800D334 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r4, =gUnknown_03004140 + ldrb r5, [r4, 0xE] + movs r1, 0x1 + strb r1, [r4, 0xE] + bl rfu_REQ_disconnect + bl rfu_waitREQComplete + strb r5, [r4, 0xE] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D334 + + thumb_func_start sub_800D358 +sub_800D358: @ 800D358 + push {r4-r7,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x4] + cmp r0, 0 + beq _0800D3A0 + movs r4, 0 +_0800D36A: + ldr r1, =gUnknown_03007880 + lsls r0, r4, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2] + movs r3, 0x80 + lsls r3, 8 + adds r1, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D396 + ldrb r1, [r2, 0x1A] + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D396 + adds r2, r1, 0 + bics r2, r5 + movs r0, 0x20 + adds r1, r4, 0 + bl rfu_changeSendTarget +_0800D396: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D36A +_0800D3A0: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x5] + cmp r0, 0 + beq _0800D3DE + movs r4, 0 +_0800D3AC: + ldr r1, =gUnknown_03007880 + lsls r0, r4, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2, 0x34] + movs r3, 0x80 + lsls r3, 8 + adds r1, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D3D4 + adds r0, r2, 0 + adds r0, 0x4E + ldrb r0, [r0] + ands r0, r5 + cmp r0, 0 + beq _0800D3D4 + adds r0, r4, 0 + bl rfu_NI_stopReceivingData +_0800D3D4: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D3AC +_0800D3DE: + ldr r0, =gUnknown_03007890 + ldr r3, [r0] + ldrb r2, [r3, 0x6] + cmp r2, 0 + beq _0800D41C + mvns r1, r5 + adds r0, r1, 0 + ands r0, r2 + strb r0, [r3, 0x6] + movs r4, 0 + ldr r7, =gUnknown_03007870 + ldr r6, =0x00008024 +_0800D3F6: + lsls r0, r4, 2 + adds r0, r7 + ldr r2, [r0] + ldrh r0, [r2] + cmp r0, r6 + bne _0800D412 + ldrb r3, [r2, 0x3] + adds r0, r5, 0 + ands r0, r3 + cmp r0, 0 + beq _0800D412 + adds r0, r1, 0 + ands r0, r3 + strb r0, [r2, 0x3] +_0800D412: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D3F6 +_0800D41C: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D358 + + thumb_func_start sub_800D434 +sub_800D434: @ 800D434 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x18] + cmp r0, 0 + beq _0800D510 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x4] + cmp r0, 0 + beq _0800D4D4 + movs r6, 0 +_0800D454: + ldr r3, =gUnknown_03007880 + lsls r2, r6, 2 + adds r0, r2, r3 + ldr r0, [r0] + ldrh r1, [r0] + movs r4, 0x80 + lsls r4, 8 + adds r0, r4, 0 + ands r1, r0 + adds r7, r2, 0 + adds r0, r6, 0x1 + mov r9, r0 + cmp r1, 0 + beq _0800D4CA + movs r5, 0 + movs r4, 0 + movs r1, 0x1 + mov r8, r1 + mov r10, r3 +_0800D47A: + adds r0, r7, r3 + ldr r0, [r0] + ldrb r0, [r0, 0x1A] + asrs r0, r4 + mov r1, r8 + ands r0, r1 + cmp r0, 0 + beq _0800D4A4 + lsls r0, r4, 2 + adds r0, r3 + ldr r0, [r0] + ldr r1, =gUnknown_03004140 + ldrh r0, [r0, 0x2] + ldrh r1, [r1, 0x18] + cmp r0, r1 + bls _0800D4A4 + mov r0, r8 + lsls r0, r4 + orrs r5, r0 + lsls r0, r5, 24 + lsrs r5, r0, 24 +_0800D4A4: + cmp r5, 0 + beq _0800D4C0 + mov r1, r10 + adds r0, r7, r1 + ldr r0, [r0] + ldrb r0, [r0, 0x1A] + adds r2, r5, 0 + eors r2, r0 + movs r0, 0x20 + adds r1, r6, 0 + str r3, [sp] + bl rfu_changeSendTarget + ldr r3, [sp] +_0800D4C0: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D47A +_0800D4CA: + mov r3, r9 + lsls r0, r3, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bls _0800D454 +_0800D4D4: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x5] + cmp r0, 0 + beq _0800D510 + movs r6, 0 +_0800D4E0: + ldr r1, =gUnknown_03007880 + lsls r0, r6, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2, 0x34] + movs r4, 0x80 + lsls r4, 8 + adds r1, r4, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D506 + ldr r1, =gUnknown_03004140 + ldrh r0, [r2, 0x36] + ldrh r1, [r1, 0x18] + cmp r0, r1 + bls _0800D506 + adds r0, r6, 0 + bl rfu_NI_stopReceivingData +_0800D506: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bls _0800D4E0 +_0800D510: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D434 + + thumb_func_start sub_800D52C +sub_800D52C: @ 800D52C + push {lr} + ldr r1, =gUnknown_03004140 + str r0, [r1, 0x44] + ldr r0, =sub_800CEB0 + bl rfu_setMSCCallback + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D52C + + thumb_func_start sub_800D544 +sub_800D544: @ 800D544 + ldr r1, =gUnknown_03004140 + str r0, [r1, 0x40] + bx lr + .pool + thumb_func_end sub_800D544 + + thumb_func_start sub_800D550 +sub_800D550: @ 800D550 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 16 + lsrs r5, r1, 16 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x9] + adds r3, r0, 0 + cmp r1, 0 + beq _0800D578 + cmp r4, 0 + bne _0800D578 + adds r0, 0x30 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D578 + movs r0, 0x5 + b _0800D588 + .pool +_0800D578: + ldr r2, =0x04000208 + ldrh r1, [r2] + movs r0, 0 + strh r0, [r2] + strb r4, [r3, 0x9] + strh r5, [r3, 0x32] + strh r1, [r2] + movs r0, 0 +_0800D588: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D550 + + thumb_func_start sub_800D594 +sub_800D594: @ 800D594 + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x4] + ldrb r0, [r0, 0x5] + orrs r0, r1 + cmp r0, 0 + bne _0800D5B8 + ldr r0, =gUnknown_03004140 + strh r2, [r0, 0x18] + movs r0, 0 + b _0800D5C8 + .pool +_0800D5B8: + ldr r1, =gUnknown_03004140 + movs r0, 0x6 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x6 +_0800D5C8: + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D594 + + thumb_func_start sub_800D5D0 +sub_800D5D0: @ 800D5D0 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + adds r3, r2, 0 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + subs r0, 0x9 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bhi _0800D5FC + movs r0, 0x7 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x7 + b _0800D60A + .pool +_0800D5FC: + cmp r2, 0 + beq _0800D606 + movs r0, 0x1 + strb r0, [r1, 0xB] + b _0800D608 +_0800D606: + strb r3, [r1, 0xB] +_0800D608: + movs r0, 0 +_0800D60A: + pop {r1} + bx r1 + thumb_func_end sub_800D5D0 + + thumb_func_start sub_800D610 +sub_800D610: @ 800D610 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x2] + cmp r0, 0 + beq _0800D628 + ldrb r0, [r1, 0x2] + movs r0, 0 + strb r0, [r1, 0x2] + movs r0, 0x45 + movs r1, 0 + bl sub_800D30C +_0800D628: + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D610 + + thumb_func_start sub_800D630 +sub_800D630: @ 800D630 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x2] + cmp r0, 0 + bne _0800D648 + movs r0, 0x45 + movs r1, 0 + bl sub_800D30C + b _0800D654 + .pool +_0800D648: + ldrb r0, [r1, 0x2] + cmp r0, 0x1 + bne _0800D654 + ldrb r0, [r1, 0x2] + movs r0, 0x2 + strb r0, [r1, 0x2] +_0800D654: + pop {r0} + bx r0 + thumb_func_end sub_800D630 + + thumb_func_start sub_800D658 +sub_800D658: @ 800D658 + push {lr} + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x7] + adds r2, r0, 0 + cmp r1, 0 + beq _0800D6C2 + ldrb r0, [r2, 0x4] + subs r0, 0x5 + cmp r0, 0x6 + bhi _0800D6C2 + lsls r0, 2 + ldr r1, =_0800D680 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800D680: + .4byte _0800D69C + .4byte _0800D6A4 + .4byte _0800D6AE + .4byte _0800D6AE + .4byte _0800D6B4 + .4byte _0800D6B4 + .4byte _0800D6BA +_0800D69C: + movs r0, 0x3 + strb r0, [r2, 0x7] + movs r0, 0x9 + b _0800D6C0 +_0800D6A4: + movs r0, 0x2 + strb r0, [r2, 0x7] + movs r0, 0x1 + strh r0, [r2, 0x1A] + b _0800D6C2 +_0800D6AE: + movs r0, 0x2 + strb r0, [r2, 0x7] + b _0800D6C2 +_0800D6B4: + movs r0, 0x28 + strh r0, [r2, 0x1A] + b _0800D6C2 +_0800D6BA: + movs r0, 0x28 + strh r0, [r2, 0x1A] + movs r0, 0xA +_0800D6C0: + strb r0, [r2, 0x4] +_0800D6C2: + pop {r0} + bx r0 + thumb_func_end sub_800D658 + + thumb_func_start sub_800D6C8 +sub_800D6C8: @ 800D6C8 + push {r4,r5,lr} + adds r3, r0, 0 + movs r0, 0 + movs r4, 0 + movs r5, 0x46 +_0800D6D2: + adds r2, r0, 0x1 + movs r1, 0x45 + muls r0, r5 + adds r0, r3 + adds r0, 0x45 +_0800D6DC: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D6DC + adds r0, r2, 0 + cmp r0, 0x1F + ble _0800D6D2 + movs r1, 0 + ldr r2, =0x000008c1 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x8C + lsls r2, 4 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x000008c2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x000008c3 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D6C8 + + thumb_func_start sub_800D724 +sub_800D724: @ 800D724 + push {r4,lr} + adds r3, r0, 0 + movs r1, 0 + movs r4, 0 +_0800D72C: + lsls r0, r1, 3 + adds r2, r1, 0x1 + subs r0, r1 + movs r1, 0xD + lsls r0, 1 + adds r0, r3 + adds r0, 0xD +_0800D73A: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D73A + adds r1, r2, 0 + cmp r1, 0x27 + ble _0800D72C + movs r1, 0 + ldr r2, =0x00000231 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x8C + lsls r2, 2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000232 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000233 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D724 + + thumb_func_start sub_800D780 +sub_800D780: @ 800D780 + push {r4,lr} + adds r3, r0, 0 + movs r1, 0 + movs r4, 0 +_0800D788: + lsls r0, r1, 8 + adds r2, r1, 0x1 + movs r1, 0xFF + adds r0, r3 + adds r0, 0xFF +_0800D792: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D792 + adds r1, r2, 0 + cmp r1, 0x1 + ble _0800D788 + movs r1, 0 + ldr r2, =0x00000201 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x80 + lsls r2, 2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000202 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000203 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D780 + + thumb_func_start sub_800D7D8 +sub_800D7D8: @ 800D7D8 + push {r4-r7,lr} + adds r3, r0, 0 + adds r4, r1, 0 + ldr r1, =0x000008c2 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0x1F + bhi _0800D874 + ldr r0, =0x04000208 + ldrh r1, [r0] + adds r7, r1, 0 + movs r1, 0 + strh r1, [r0] + movs r5, 0 + movs r2, 0 +_0800D7F6: + adds r1, r4, r2 + ldrb r0, [r1] + cmp r0, 0 + bne _0800D80A + ldrb r0, [r1, 0x1] + cmp r0, 0 + bne _0800D80A + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_0800D80A: + adds r2, 0xE + cmp r2, 0x45 + ble _0800D7F6 + cmp r5, 0x5 + beq _0800D866 + movs r2, 0 + movs r0, 0x8C + lsls r0, 4 + adds r5, r3, r0 + movs r6, 0x46 +_0800D81E: + ldrb r0, [r5] + adds r1, r0, 0 + muls r1, r6 + adds r1, r2, r1 + adds r1, r3, r1 + adds r0, r4, r2 + ldrb r0, [r0] + strb r0, [r1] + adds r2, 0x1 + cmp r2, 0x45 + ble _0800D81E + movs r0, 0x8C + lsls r0, 4 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1F + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x000008c2 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r1, 0 + adds r0, r4, 0 + adds r0, 0x45 +_0800D85E: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r4 + bge _0800D85E +_0800D866: + ldr r0, =0x04000208 + strh r7, [r0] + b _0800D87E + .pool +_0800D874: + ldr r1, =0x000008c3 + adds r0, r3, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800D87E: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D7D8 + + thumb_func_start sub_800D888 +sub_800D888: @ 800D888 + push {r4-r7,lr} + adds r6, r0, 0 + adds r5, r1, 0 + ldr r1, =0x00000232 + adds r0, r6, r1 + ldrb r0, [r0] + cmp r0, 0x27 + bhi _0800D920 + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r7, r0, 0 + movs r0, 0 + strh r0, [r1] + movs r2, 0 + ldrb r0, [r5] + cmp r0, 0 + bne _0800D8B8 +_0800D8AA: + adds r2, 0x1 + cmp r2, 0xD + bgt _0800D8B8 + adds r0, r5, r2 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D8AA +_0800D8B8: + cmp r2, 0xE + beq _0800D910 + movs r2, 0 + movs r0, 0x8C + lsls r0, 2 + adds r3, r6, r0 +_0800D8C4: + ldrb r1, [r3] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r2, r0 + adds r0, r6, r0 + adds r1, r5, r2 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xD + ble _0800D8C4 + movs r1, 0x8C + lsls r1, 2 + adds r4, r6, r1 + ldrb r0, [r4] + adds r0, 0x1 + ldrb r1, [r4] + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0x28 + bl __umodsi3 + ldrb r1, [r4] + strb r0, [r4] + ldr r0, =0x00000232 + adds r1, r6, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r1, 0 + adds r0, r5, 0 + adds r0, 0xD +_0800D908: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r5 + bge _0800D908 +_0800D910: + ldr r0, =0x04000208 + strh r7, [r0] + b _0800D92A + .pool +_0800D920: + ldr r1, =0x00000233 + adds r0, r6, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800D92A: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D888 + + thumb_func_start sub_800D934 +sub_800D934: @ 800D934 + push {r4-r7,lr} + adds r3, r0, 0 + adds r4, r1, 0 + ldr r1, =0x04000208 + ldrh r0, [r1] + mov r12, r0 + movs r0, 0 + strh r0, [r1] + movs r1, 0x8C + lsls r1, 4 + adds r0, r3, r1 + ldr r7, =0x000008c1 + adds r5, r3, r7 + ldrb r1, [r0] + ldrb r0, [r5] + cmp r1, r0 + beq _0800D960 + ldr r1, =0x000008c3 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D984 +_0800D960: + movs r1, 0 + adds r0, r4, 0 + adds r0, 0x45 +_0800D966: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r4 + bge _0800D966 + ldr r0, =0x04000208 + mov r7, r12 + strh r7, [r0] + movs r0, 0 + b _0800D9CA + .pool +_0800D984: + movs r2, 0 + movs r6, 0x46 +_0800D988: + adds r1, r4, r2 + ldrb r0, [r5] + adds r7, r0, 0 + muls r7, r6 + adds r0, r7, 0 + adds r0, r2, r0 + adds r0, r3, r0 + ldrb r0, [r0] + strb r0, [r1] + adds r2, 0x1 + cmp r2, 0x45 + ble _0800D988 + ldr r0, =0x000008c1 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1F + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r7, =0x000008c2 + adds r1, r3, r7 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x04000208 + mov r1, r12 + strh r1, [r0] + movs r0, 0x1 +_0800D9CA: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D934 + + thumb_func_start sub_800D9DC +sub_800D9DC: @ 800D9DC + push {r4-r7,lr} + adds r5, r0, 0 + adds r6, r1, 0 + movs r1, 0x8C + lsls r1, 2 + adds r0, r5, r1 + adds r1, 0x1 + adds r4, r5, r1 + ldrb r1, [r0] + ldrb r0, [r4] + cmp r1, r0 + beq _0800DA00 + ldr r1, =0x00000233 + adds r0, r5, r1 + ldrb r0, [r0] + adds r2, r0, 0 + cmp r2, 0 + beq _0800DA08 +_0800DA00: + movs r0, 0 + b _0800DA54 + .pool +_0800DA08: + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r7, r0, 0 + strh r2, [r1] + movs r3, 0 +_0800DA12: + adds r2, r6, r3 + ldrb r1, [r4] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r3, r0 + adds r0, r5, r0 + ldrb r0, [r0] + strb r0, [r2] + adds r3, 0x1 + cmp r3, 0xD + ble _0800DA12 + ldr r0, =0x00000231 + adds r4, r5, r0 + ldrb r0, [r4] + adds r0, 0x1 + ldrb r1, [r4] + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0x28 + bl __umodsi3 + ldrb r1, [r4] + strb r0, [r4] + ldr r0, =0x00000232 + adds r1, r5, r0 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x04000208 + strh r7, [r0] + movs r0, 0x1 +_0800DA54: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D9DC + + thumb_func_start sub_800DA68 +sub_800DA68: @ 800DA68 + push {r4,lr} + adds r2, r0, 0 + adds r4, r1, 0 + ldrb r0, [r4, 0x1] + cmp r0, 0 + bne _0800DA7E + adds r0, r2, 0 + movs r1, 0 + bl sub_800DAC8 + b _0800DAC0 +_0800DA7E: + movs r3, 0 +_0800DA80: + ldrb r1, [r2, 0x1C] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r3, r0 + adds r0, r2, r0 + adds r1, r4, r3 + ldrb r1, [r1] + strb r1, [r0] + adds r3, 0x1 + cmp r3, 0xD + ble _0800DA80 + ldrb r0, [r2, 0x1C] + adds r0, 0x1 + ldrb r1, [r2, 0x1C] + strb r0, [r2, 0x1C] + ldrb r1, [r2, 0x1C] + movs r0, 0x1 + ands r0, r1 + ldrb r1, [r2, 0x1C] + strb r0, [r2, 0x1C] + ldrb r0, [r2, 0x1E] + cmp r0, 0x1 + bhi _0800DABA + ldrb r0, [r2, 0x1E] + adds r0, 0x1 + ldrb r1, [r2, 0x1E] + strb r0, [r2, 0x1E] + b _0800DAC0 +_0800DABA: + ldrb r0, [r2, 0x1C] + ldrb r1, [r2, 0x1D] + strb r0, [r2, 0x1D] +_0800DAC0: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_800DA68 + + thumb_func_start sub_800DAC8 +sub_800DAC8: @ 800DAC8 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + ldrb r0, [r3, 0x1E] + cmp r0, 0 + bne _0800DAD8 + movs r0, 0 + b _0800DB12 +_0800DAD8: + cmp r5, 0 + beq _0800DAF6 + movs r4, 0 +_0800DADE: + adds r2, r5, r4 + ldrb r1, [r3, 0x1D] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r4, r0 + adds r0, r3, r0 + ldrb r0, [r0] + strb r0, [r2] + adds r4, 0x1 + cmp r4, 0xD + ble _0800DADE +_0800DAF6: + ldrb r0, [r3, 0x1D] + adds r0, 0x1 + ldrb r1, [r3, 0x1D] + strb r0, [r3, 0x1D] + ldrb r1, [r3, 0x1D] + movs r0, 0x1 + ands r0, r1 + ldrb r1, [r3, 0x1D] + strb r0, [r3, 0x1D] + ldrb r0, [r3, 0x1E] + subs r0, 0x1 + ldrb r1, [r3, 0x1E] + strb r0, [r3, 0x1E] + movs r0, 0x1 +_0800DB12: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_800DAC8 + + thumb_func_start sub_800DB18 +sub_800DB18: @ 800DB18 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + ldr r1, =0x00000202 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0x1 + bhi _0800DB70 + movs r2, 0 + movs r0, 0x80 + lsls r0, 2 + adds r4, r3, r0 +_0800DB30: + ldrb r0, [r4] + lsls r0, 8 + adds r0, r2, r0 + adds r0, r3, r0 + adds r1, r5, r2 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xFF + ble _0800DB30 + movs r0, 0x80 + lsls r0, 2 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1 + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x00000202 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + b _0800DB7A + .pool +_0800DB70: + ldr r1, =0x00000203 + adds r0, r3, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800DB7A: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DB18 + + thumb_func_start sub_800DB84 +sub_800DB84: @ 800DB84 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + movs r1, 0x80 + lsls r1, 2 + adds r0, r3, r1 + adds r1, 0x1 + adds r4, r3, r1 + ldrb r1, [r0] + ldrb r0, [r4] + cmp r1, r0 + beq _0800DBA6 + ldr r1, =0x00000203 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0800DBB0 +_0800DBA6: + movs r0, 0 + b _0800DBEA + .pool +_0800DBB0: + movs r2, 0 +_0800DBB2: + adds r0, r5, r2 + ldrb r1, [r4] + lsls r1, 8 + adds r1, r2, r1 + adds r1, r3, r1 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xFF + ble _0800DBB2 + ldr r0, =0x00000201 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1 + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x00000202 + adds r1, r3, r0 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r0, 0x1 +_0800DBEA: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800DB84 + + thumb_func_start sub_800DBF8 +sub_800DBF8: @ 800DBF8 + push {r4-r7,lr} + adds r6, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r1, 0 + movs r5, 0 + cmp r1, 0x1 + beq _0800DC36 + cmp r1, 0x1 + bgt _0800DC12 + cmp r1, 0 + beq _0800DC1C + b _0800DCAA +_0800DC12: + cmp r0, 0x2 + beq _0800DC56 + cmp r0, 0x3 + beq _0800DC76 + b _0800DCAA +_0800DC1C: + movs r4, 0 +_0800DC1E: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r1, [r0] + lsls r0, r5, 16 + asrs r0, 16 + adds r0, r1 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, r1, 0 + cmp r4, 0xC7 + ble _0800DC1E + b _0800DC70 +_0800DC36: + movs r4, 0 + adds r2, r6, 0 + adds r2, 0xC8 +_0800DC3C: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r1, [r0] + lsls r0, r5, 16 + asrs r0, 16 + adds r0, r1 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, r1, 0 + cmp r4, 0x63 + ble _0800DC3C + strh r5, [r2] + b _0800DCAA +_0800DC56: + movs r4, 0 +_0800DC58: + bl Random + lsls r0, 24 + lsrs r0, 24 + adds r1, r6, r4 + strb r0, [r1] + adds r0, r5, r0 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, 0x1 + cmp r4, 0xC7 + ble _0800DC58 +_0800DC70: + adds r0, r6, r4 + strh r5, [r0] + b _0800DCAA +_0800DC76: + movs r4, 0 + ldr r3, =gUnknown_03000D74 + ldrb r1, [r3] + ldrb r0, [r3] + adds r7, r0, 0x1 + adds r2, r1, 0x1 + movs r0, 0xFF + mov r12, r0 +_0800DC86: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r2, [r0] + adds r0, r4, r7 + mov r4, r12 + ands r0, r4 + adds r0, r5, r0 + lsls r0, 16 + lsrs r5, r0, 16 + adds r2, 0x1 + adds r4, r1, 0 + cmp r1, 0xC7 + ble _0800DC86 + adds r0, r6, r1 + strh r5, [r0] + ldrb r0, [r3] + adds r0, 0x1 + strb r0, [r3] +_0800DCAA: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DBF8 .align 2, 0 @ Don't pad with nop. diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 4b5a3b6b5..87d80bba7 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,3859 +5,6 @@ .text - thumb_func_start sub_800BEC0 -sub_800BEC0: @ 800BEC0 - push {r4,lr} - bl rfu_REQBN_softReset_and_checkID - adds r4, r0, 0 - ldr r0, =0x00008001 - cmp r4, r0 - bne _0800BED4 - ldr r1, =gUnknown_03004140 - movs r0, 0x1 - strb r0, [r1, 0x8] -_0800BED4: - ldr r0, =gUnknown_03004140 - ldrb r2, [r0, 0x4] - adds r1, r0, 0 - cmp r2, 0x17 - beq _0800BEE8 - cmp r2, 0x1 - beq _0800BEE8 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] -_0800BEE8: - movs r0, 0 - strb r0, [r1, 0x7] - strb r0, [r1, 0xD] - strb r0, [r1, 0x1] - strb r0, [r1] - movs r0, 0xFF - strb r0, [r1, 0x6] - bl sub_800D610 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800BEC0 - - thumb_func_start rfu_REQ_sendData_wrapper -rfu_REQ_sendData_wrapper: @ 800BF0C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - bne _0800BF34 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x2] - movs r2, 0 - cmp r0, 0x1 - bne _0800BF3C - movs r2, 0x1 - b _0800BF3C - .pool -_0800BF34: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x3] - movs r1, 0 - strb r1, [r0, 0x3] -_0800BF3C: - adds r0, r2, 0 - bl rfu_REQ_sendData - pop {r0} - bx r0 - .pool - thumb_func_end rfu_REQ_sendData_wrapper - - thumb_func_start sub_800BF4C -sub_800BF4C: @ 800BF4C - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - cmp r5, 0 - beq _0800BF94 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldr r2, =0x01000024 - mov r0, sp - adds r1, r4, 0 - bl CpuSet - movs r0, 0xFF - strb r0, [r4, 0x6] - str r5, [r4, 0x40] - str r6, [r4, 0x44] - ldr r0, =sub_800CEB0 - bl rfu_setMSCCallback - ldr r0, =sub_800C7B4 - bl rfu_setREQCallback - movs r0, 0 - b _0800BF96 - .pool -_0800BF94: - movs r0, 0x4 -_0800BF96: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_800BF4C - - thumb_func_start sub_800BFA0 -sub_800BFA0: @ 800BFA0 - push {r4,lr} - sub sp, 0x4 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldr r2, =0x01000020 - mov r0, sp - adds r1, r4, 0 - bl CpuSet - movs r0, 0xFF - strb r0, [r4, 0x6] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BFA0 - - thumb_func_start sub_800BFCC -sub_800BFCC: @ 800BFCC - push {r4,lr} - adds r4, r0, 0 - bl sub_800C000 - ldr r1, =gUnknown_03004140 - movs r2, 0x1 - strb r2, [r1, 0x4] - movs r0, 0x2 - strb r0, [r1, 0x5] - str r4, [r1, 0x3C] - ldrb r0, [r4, 0x11] - strb r0, [r1, 0x9] - ldrh r0, [r4, 0x12] - strh r0, [r1, 0x32] - ldrh r0, [r4, 0x14] - strh r0, [r1, 0x18] - ldrb r0, [r4, 0x10] - cmp r0, 0 - beq _0800BFF4 - strb r2, [r1, 0xB] -_0800BFF4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BFCC - - thumb_func_start sub_800C000 -sub_800C000: @ 800C000 - push {r4,r5,lr} - ldr r2, =gUnknown_03004140 - movs r0, 0 - strb r0, [r2, 0x5] - strb r0, [r2, 0x4] - movs r1, 0xFF - strb r1, [r2, 0x6] - strb r0, [r2, 0x7] - strb r0, [r2, 0x10] - strb r0, [r2, 0xC] - adds r1, r2, 0 - adds r1, 0x24 - strb r0, [r1] - adds r1, 0xC - strb r0, [r1] - movs r3, 0 - adds r5, r2, 0 - adds r5, 0x28 - movs r4, 0 - adds r2, 0x34 -_0800C028: - lsls r1, r3, 1 - adds r0, r1, r5 - strh r4, [r0] - adds r1, r2 - strh r4, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800C028 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C000 - - thumb_func_start sub_800C048 -sub_800C048: @ 800C048 - ldr r1, =gUnknown_03004140 - movs r0, 0x15 - strb r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_800C048 - - thumb_func_start sub_800C054 -sub_800C054: @ 800C054 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r3, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 16 - lsrs r2, 16 - mov r8, r2 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C090 - cmp r0, 0x8 - bne _0800C07A - cmp r5, 0x1 - beq _0800C090 -_0800C07A: - movs r0, 0x1 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x1 - b _0800C122 - .pool -_0800C090: - bl rfu_getMasterSlave - lsls r0, 24 - cmp r0, 0 - bne _0800C0B0 - ldr r1, =gUnknown_03004140 - movs r0, 0x2 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x2 - b _0800C122 - .pool -_0800C0B0: - movs r2, 0 - ldrh r0, [r6] - ldr r4, =0x0000ffff - adds r1, r6, 0x2 - ldr r3, =gUnknown_03004140 - cmp r0, r4 - beq _0800C0D0 -_0800C0BE: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xF - bhi _0800C0D0 - ldrh r0, [r1] - adds r1, 0x2 - cmp r0, r4 - bne _0800C0BE -_0800C0D0: - cmp r2, 0x10 - bne _0800C0EC - movs r0, 0x4 - strh r0, [r3, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x4 - b _0800C122 - .pool -_0800C0EC: - cmp r5, 0x1 - bls _0800C0FA - movs r0, 0x1 - strb r0, [r3, 0x7] - movs r5, 0x1 - movs r7, 0 - b _0800C0FE -_0800C0FA: - movs r0, 0 - strb r0, [r3, 0x7] -_0800C0FE: - cmp r5, 0 - beq _0800C108 - movs r0, 0x5 - strb r0, [r3, 0x4] - b _0800C116 -_0800C108: - movs r0, 0x9 - strb r0, [r3, 0x4] - ldrb r0, [r3, 0xB] - cmp r0, 0 - beq _0800C116 - movs r0, 0x2 - strb r0, [r3, 0xB] -_0800C116: - strb r5, [r3, 0x6] - strh r7, [r3, 0x1A] - mov r0, r8 - strh r0, [r3, 0x26] - str r6, [r3, 0x20] - movs r0, 0 -_0800C122: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800C054 - - thumb_func_start sub_800C12C -sub_800C12C: @ 800C12C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C164 - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _0800C164 - movs r0, 0x1 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x1 - b _0800C204 - .pool -_0800C164: - bl rfu_getMasterSlave - lsls r0, 24 - cmp r0, 0 - bne _0800C184 - ldr r1, =gUnknown_03004140 - movs r0, 0x2 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x2 - b _0800C204 - .pool -_0800C184: - movs r2, 0 - ldr r0, =gUnknown_03007890 - ldr r1, [r0] - ldrb r3, [r1, 0x8] - ldr r5, =gUnknown_03004140 - adds r7, r0, 0 - cmp r2, r3 - bcs _0800C1B2 - ldrh r0, [r1, 0x14] - cmp r0, r6 - beq _0800C1B2 - adds r4, r1, 0 - adds r1, r3, 0 -_0800C19E: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r1 - bcs _0800C1B2 - lsls r0, r2, 5 - adds r0, r4, r0 - ldrh r0, [r0, 0x14] - cmp r0, r6 - bne _0800C19E -_0800C1B2: - ldr r0, [r7] - ldrb r0, [r0, 0x8] - cmp r0, 0 - beq _0800C1BE - cmp r2, r0 - bne _0800C1D8 -_0800C1BE: - movs r0, 0x3 - strh r0, [r5, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x3 - b _0800C204 - .pool -_0800C1D8: - ldrb r0, [r5, 0x4] - cmp r0, 0 - beq _0800C1E2 - cmp r0, 0x9 - bne _0800C1EA -_0800C1E2: - movs r0, 0xC - strb r0, [r5, 0x4] - movs r0, 0xD - b _0800C1F0 -_0800C1EA: - movs r0, 0xB - strb r0, [r5, 0x4] - movs r0, 0xC -_0800C1F0: - strb r0, [r5, 0x5] - strh r6, [r5, 0x1E] - mov r0, r8 - strh r0, [r5, 0x1A] - ldrb r0, [r5, 0x7] - cmp r0, 0 - beq _0800C202 - movs r0, 0x7 - strb r0, [r5, 0x7] -_0800C202: - movs r0, 0 -_0800C204: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800C12C - - thumb_func_start sub_800C210 -sub_800C210: @ 800C210 - push {r4-r7,lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r6, =gUnknown_03004140 - adds r3, r6, 0 - adds r3, 0x30 - ldrb r2, [r3] - adds r0, r1, 0 - ands r0, r2 - cmp r0, 0 - beq _0800C26C - adds r0, r2, 0 - bics r0, r1 - strb r0, [r3] - movs r4, 0 - ldr r7, =gUnknown_03007890 - movs r5, 0x1 - adds r3, 0x4 - movs r2, 0 -_0800C236: - adds r0, r1, 0 - asrs r0, r4 - ands r0, r5 - cmp r0, 0 - beq _0800C246 - lsls r0, r4, 1 - adds r0, r3 - strh r2, [r0] -_0800C246: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800C236 - ldr r0, [r7] - ldrb r4, [r0, 0x3] - ands r4, r1 - cmp r4, 0 - beq _0800C260 - adds r0, r4, 0 - bl sub_800D334 -_0800C260: - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - adds r1, r4, 0 - bl sub_800D30C -_0800C26C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C210 - - thumb_func_start sub_800C27C -sub_800C27C: @ 800C27C - push {r4,r5,lr} - lsls r0, 24 - movs r2, 0 - ldr r1, =gUnknown_03004140 - strb r2, [r1, 0x7] - adds r5, r1, 0 - cmp r0, 0 - beq _0800C29C - bl sub_800C000 - movs r0, 0x17 - strb r0, [r5, 0x4] - b _0800C366 - .pool -_0800C29C: - ldrb r0, [r5, 0x4] - subs r0, 0x5 - cmp r0, 0xD - bhi _0800C352 - lsls r0, 2 - ldr r1, =_0800C2B4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C2B4: - .4byte _0800C2EC - .4byte _0800C2F8 - .4byte _0800C2F8 - .4byte _0800C358 - .4byte _0800C302 - .4byte _0800C30C - .4byte _0800C30C - .4byte _0800C316 - .4byte _0800C320 - .4byte _0800C320 - .4byte _0800C358 - .4byte _0800C326 - .4byte _0800C34C - .4byte _0800C34C -_0800C2EC: - movs r1, 0 - movs r0, 0x8 - strb r0, [r5, 0x4] - strb r1, [r5, 0x5] - movs r2, 0x13 - b _0800C358 -_0800C2F8: - movs r0, 0x7 - strb r0, [r5, 0x4] - movs r0, 0x8 - strb r0, [r5, 0x5] - b _0800C358 -_0800C302: - movs r0, 0 - strb r0, [r5, 0x5] - strb r0, [r5, 0x4] - movs r2, 0x21 - b _0800C358 -_0800C30C: - movs r1, 0 - movs r0, 0xB - strb r0, [r5, 0x4] - strb r1, [r5, 0x5] - b _0800C358 -_0800C316: - movs r0, 0 - strb r0, [r5, 0x5] - strb r0, [r5, 0x4] - movs r2, 0x23 - b _0800C358 -_0800C320: - movs r0, 0xE - strb r0, [r5, 0x4] - b _0800C358 -_0800C326: - ldrb r0, [r5, 0x11] - strb r0, [r5, 0x4] - ldrb r0, [r5, 0x12] - strb r0, [r5, 0x5] - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - bl sub_800D334 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - strh r0, [r5, 0x14] - movs r0, 0x33 - movs r1, 0x1 - bl sub_800D30C - b _0800C366 - .pool -_0800C34C: - movs r0, 0x12 - strb r0, [r5, 0x4] - b _0800C358 -_0800C352: - strb r2, [r5, 0x5] - strb r2, [r5, 0x4] - movs r2, 0x43 -_0800C358: - ldrb r0, [r5, 0x4] - cmp r0, 0 - bne _0800C366 - adds r0, r2, 0 - movs r1, 0 - bl sub_800D30C -_0800C366: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_800C27C - - thumb_func_start sub_800C36C -sub_800C36C: @ 800C36C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0 - mov r8, r1 - mov r5, sp - adds r5, 0x1 - mov r4, sp - adds r4, 0x2 - mov r1, sp - adds r2, r5, 0 - adds r3, r4, 0 - bl rfu_REQBN_watchLink - mov r0, sp - ldrb r0, [r0] - adds r7, r4, 0 - cmp r0, 0 - beq _0800C43E - ldr r1, =gUnknown_03004140 - mov r0, sp - ldrb r0, [r0] - strh r0, [r1, 0x14] - ldrb r0, [r5] - strh r0, [r1, 0x16] - ldrb r0, [r1, 0x9] - adds r6, r1, 0 - cmp r0, 0 - beq _0800C426 - movs r0, 0x1 - strb r0, [r6, 0xA] - ldrb r0, [r6, 0x6] - cmp r0, 0 - bne _0800C3C2 - ldrb r0, [r5] - cmp r0, 0 - bne _0800C3C2 - movs r0, 0x4 - strb r0, [r6, 0xA] -_0800C3C2: - ldrb r0, [r6, 0xA] - cmp r0, 0x1 - bne _0800C40C - movs r2, 0 - mov r4, sp - movs r5, 0x1 - mov r12, r6 - mov r3, r12 - adds r3, 0x30 - movs r6, 0x34 - add r6, r12 - mov r9, r6 -_0800C3DA: - ldrb r0, [r4] - asrs r0, r2 - ands r0, r5 - cmp r0, 0 - beq _0800C3F8 - adds r0, r5, 0 - lsls r0, r2 - ldrb r1, [r3] - orrs r0, r1 - strb r0, [r3] - lsls r0, r2, 1 - add r0, r9 - mov r6, r12 - ldrh r1, [r6, 0x32] - strh r1, [r0] -_0800C3F8: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C3DA - movs r0, 0x31 - b _0800C41E - .pool -_0800C40C: - movs r0, 0 - strb r0, [r6, 0xA] - mov r0, sp - ldrb r0, [r0] - bl sub_800D334 - movs r0, 0x1 - mov r8, r0 - movs r0, 0x33 -_0800C41E: - movs r1, 0x1 - bl sub_800D30C - b _0800C43A -_0800C426: - mov r0, sp - ldrb r0, [r0] - bl sub_800D334 - movs r1, 0x1 - mov r8, r1 - movs r0, 0x30 - movs r1, 0x2 - bl sub_800D30C -_0800C43A: - bl sub_800D610 -_0800C43E: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800C518 - ldrb r0, [r7] - cmp r0, 0 - beq _0800C49C - movs r2, 0 - ldr r6, =gUnknown_03004140 - movs r3, 0x1 - adds r4, r6, 0 - adds r4, 0x34 - adds r6, 0x30 - adds r5, r7, 0 -_0800C45C: - ldrb r0, [r6] - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - beq _0800C478 - ldrb r0, [r5] - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - beq _0800C478 - lsls r0, r2, 1 - adds r0, r4 - movs r1, 0 - strh r1, [r0] -_0800C478: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C45C - ldr r3, =gUnknown_03004140 - adds r2, r3, 0 - adds r2, 0x30 - ldrb r1, [r7] - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r7] - strh r0, [r3, 0x14] - movs r0, 0x32 - movs r1, 0x1 - bl sub_800D30C -_0800C49C: - ldr r0, =gUnknown_03004140 - adds r3, r0, 0 - adds r3, 0x30 - ldrb r1, [r3] - adds r6, r0, 0 - cmp r1, 0 - beq _0800C514 - movs r4, 0 - movs r2, 0 - movs r5, 0x1 -_0800C4B0: - ldrb r0, [r3] - asrs r0, r2 - ands r0, r5 - cmp r0, 0 - beq _0800C4E2 - lsls r1, r2, 1 - adds r0, r6, 0 - adds r0, 0x34 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _0800C4E2 - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _0800C4E2 - adds r0, r5, 0 - lsls r0, r2 - ldrb r1, [r3] - bics r1, r0 - strb r1, [r3] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0800C4E2: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C4B0 - cmp r4, 0 - beq _0800C506 - adds r0, r4, 0 - bl sub_800D334 - movs r6, 0x1 - mov r8, r6 - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - movs r1, 0x1 - bl sub_800D30C -_0800C506: - ldr r0, =gUnknown_03004140 - adds r1, r0, 0 - adds r1, 0x30 - ldrb r1, [r1] - adds r6, r0, 0 - cmp r1, 0 - bne _0800C518 -_0800C514: - movs r0, 0 - strb r0, [r6, 0xA] -_0800C518: - mov r0, r8 - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800C36C - - thumb_func_start rfu_syncVBlank_ -rfu_syncVBlank_: @ 800C530 - push {lr} - bl rfu_syncVBlank - lsls r0, 16 - cmp r0, 0 - beq _0800C548 - movs r0, 0xF1 - movs r1, 0 - bl sub_800D30C - bl sub_800D610 -_0800C548: - pop {r0} - bx r0 - thumb_func_end rfu_syncVBlank_ - - thumb_func_start sub_800C54C -sub_800C54C: @ 800C54C - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gUnknown_03004140 - ldr r2, [r1, 0x40] - cmp r2, 0 - bne _0800C568 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C568 - strb r2, [r1, 0x4] - b _0800C736 - .pool -_0800C568: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x7] - cmp r0, 0 - beq _0800C576 - adds r0, r3, 0 - bl sub_800C744 -_0800C576: - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x4] - cmp r0, 0 - bne _0800C580 - b _0800C700 -_0800C580: - bl rfu_waitREQComplete - movs r0, 0x1 - strb r0, [r4, 0xE] - ldrb r0, [r4, 0x4] - subs r0, 0x1 - cmp r0, 0x16 - bls _0800C592 - b _0800C6F6 -_0800C592: - lsls r0, 2 - ldr r1, =_0800C5A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C5A4: - .4byte _0800C624 - .4byte _0800C65C - .4byte _0800C662 - .4byte _0800C678 - .4byte _0800C690 - .4byte _0800C696 - .4byte _0800C69C - .4byte _0800C6F6 - .4byte _0800C6A2 - .4byte _0800C6A8 - .4byte _0800C6AE - .4byte _0800C6B4 - .4byte _0800C6C4 - .4byte _0800C6CA - .4byte _0800C6F6 - .4byte _0800C6D0 - .4byte _0800C6E0 - .4byte _0800C6E6 - .4byte _0800C6EC - .4byte _0800C6F6 - .4byte _0800C6F2 - .4byte _0800C6F6 - .4byte _0800C600 -_0800C600: - bl sub_800BEC0 - ldr r1, =0x00008001 - movs r2, 0xFF - cmp r0, r1 - bne _0800C60E - movs r2, 0x44 -_0800C60E: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - adds r0, r2, 0 - b _0800C64E - .pool -_0800C624: - bl sub_800BEC0 - ldr r1, =0x00008001 - cmp r0, r1 - bne _0800C644 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - movs r1, 0x3 - strb r1, [r0, 0x5] - b _0800C6F6 - .pool -_0800C644: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - movs r0, 0xFF -_0800C64E: - movs r1, 0 - bl sub_800D30C - b _0800C6F6 - .pool -_0800C65C: - bl rfu_REQ_reset - b _0800C6F6 -_0800C662: - ldr r0, =gUnknown_03004140 - ldr r2, [r0, 0x3C] - ldrh r0, [r2, 0x2] - ldrb r1, [r2] - ldrb r2, [r2, 0x1] - bl rfu_REQ_configSystem - b _0800C6F6 - .pool -_0800C678: - ldr r0, =gUnknown_03004140 - ldr r3, [r0, 0x3C] - ldrb r0, [r3, 0x4] - ldrh r1, [r3, 0x6] - ldr r2, [r3, 0x8] - ldr r3, [r3, 0xC] - bl rfu_REQ_configGameData - b _0800C6F6 - .pool -_0800C690: - bl rfu_REQ_startSearchChild - b _0800C6F6 -_0800C696: - bl rfu_REQ_pollSearchChild - b _0800C6F6 -_0800C69C: - bl rfu_REQ_endSearchChild - b _0800C6F6 -_0800C6A2: - bl rfu_REQ_startSearchParent - b _0800C6F6 -_0800C6A8: - bl rfu_REQ_pollSearchParent - b _0800C6F6 -_0800C6AE: - bl rfu_REQ_endSearchParent - b _0800C6F6 -_0800C6B4: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x1E] - bl rfu_REQ_startConnectParent - b _0800C6F6 - .pool -_0800C6C4: - bl rfu_REQ_pollConnectParent - b _0800C6F6 -_0800C6CA: - bl rfu_REQ_endConnectParent - b _0800C6F6 -_0800C6D0: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bl rfu_REQ_CHILD_startConnectRecovery - b _0800C6F6 - .pool -_0800C6E0: - bl rfu_REQ_CHILD_pollConnectRecovery - b _0800C6F6 -_0800C6E6: - bl rfu_REQ_CHILD_endConnectRecovery - b _0800C6F6 -_0800C6EC: - bl rfu_REQ_changeMasterSlave - b _0800C6F6 -_0800C6F2: - bl rfu_REQ_stopMode -_0800C6F6: - bl rfu_waitREQComplete - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0xE] -_0800C700: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x4] - subs r0, 0x12 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0800C710 - b _0800C576 -_0800C710: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800C726 - movs r0, 0 - bl sub_800C36C - lsls r0, 24 - cmp r0, 0 - bne _0800C736 -_0800C726: - bl sub_800CF34 - bl sub_800D158 - bl sub_800D268 - bl sub_800D434 -_0800C736: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C54C - - thumb_func_start sub_800C744 -sub_800C744: @ 800C744 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x7] - adds r4, r0, 0 - cmp r1, 0x5 - bne _0800C76E - movs r2, 0x1 - strb r2, [r4, 0x6] - strb r1, [r4, 0x4] - ldrh r0, [r4, 0x1C] - strh r0, [r4, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C76C - movs r0, 0x6 - strb r0, [r4, 0x7] - b _0800C76E - .pool -_0800C76C: - strb r2, [r4, 0x7] -_0800C76E: - ldrb r0, [r4, 0x7] - cmp r0, 0x1 - bne _0800C798 - strb r0, [r4, 0x6] - movs r0, 0x5 - strb r0, [r4, 0x4] - adds r0, r3, 0 - movs r1, 0x8C - bl __umodsi3 - strh r0, [r4, 0x1A] - movs r1, 0x8C - subs r1, r0 - strh r1, [r4, 0x1C] - lsls r0, 16 - cmp r0, 0 - beq _0800C794 - movs r0, 0x2 - b _0800C796 -_0800C794: - movs r0, 0x3 -_0800C796: - strb r0, [r4, 0x7] -_0800C798: - ldrb r0, [r4, 0x7] - cmp r0, 0x3 - bne _0800C7AE - movs r0, 0 - strb r0, [r4, 0x6] - movs r0, 0x28 - strh r0, [r4, 0x1A] - movs r0, 0x4 - strb r0, [r4, 0x7] - movs r0, 0x9 - strb r0, [r4, 0x4] -_0800C7AE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800C744 - - thumb_func_start sub_800C7B4 -sub_800C7B4: @ 800C7B4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r6, r1, 16 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0xE] - adds r7, r0, 0 - cmp r1, 0 - bne _0800C7D2 - b _0800CC98 -_0800C7D2: - movs r0, 0 - strb r0, [r7, 0xE] - mov r0, r8 - subs r0, 0x10 - cmp r0, 0x2D - bls _0800C7E0 - b _0800CC8A -_0800C7E0: - lsls r0, 2 - ldr r1, =_0800C7F4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C7F4: - .4byte _0800C8AC - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800C8D8 - .4byte _0800C8C4 - .4byte _0800CC8A - .4byte _0800C8EC - .4byte _0800C8FC - .4byte _0800C920 - .4byte _0800C940 - .4byte _0800C960 - .4byte _0800C9D0 - .4byte _0800CA02 - .4byte _0800CA18 - .4byte _0800CA60 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CBD8 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CAD0 - .4byte _0800CB1C - .4byte _0800CB64 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC78 -_0800C8AC: - cmp r6, 0 - beq _0800C8B2 - b _0800CC8A -_0800C8B2: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - movs r1, 0x4 - strb r1, [r0, 0x5] - b _0800CC8A - .pool -_0800C8C4: - cmp r6, 0 - beq _0800C8CA - b _0800CC8A -_0800C8CA: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - b _0800CC8A - .pool -_0800C8D8: - cmp r6, 0 - beq _0800C8DE - b _0800CC8A -_0800C8DE: - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0x5] - strb r6, [r0, 0x4] - movs r0, 0 - b _0800CBF6 - .pool -_0800C8EC: - cmp r6, 0 - beq _0800C8F2 - b _0800CC8A -_0800C8F2: - ldr r1, =gUnknown_03004140 - movs r0, 0x6 - b _0800CA0C - .pool -_0800C8FC: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800C906 - b _0800CC8A -_0800C906: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C912 - b _0800CC8A -_0800C912: - movs r0, 0x7 - strb r0, [r1, 0x4] - movs r0, 0x8 - strb r0, [r1, 0x5] - b _0800CC8A - .pool -_0800C920: - cmp r6, 0 - beq _0800C926 - b _0800CC8A -_0800C926: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - ldrb r0, [r0, 0x7] - cmp r0, 0 - beq _0800C936 - b _0800CC8A -_0800C936: - movs r0, 0x13 - b _0800CBF6 - .pool -_0800C940: - cmp r6, 0 - beq _0800C946 - b _0800CC8A -_0800C946: - ldrb r0, [r7, 0xB] - cmp r0, 0x1 - bne _0800C956 - ldrh r0, [r7, 0x1A] - cmp r0, 0x1 - bls _0800C956 - subs r0, 0x1 - strh r0, [r7, 0x1A] -_0800C956: - ldr r1, =gUnknown_03004140 - movs r0, 0xA - b _0800CA0C - .pool -_0800C960: - cmp r6, 0 - bne _0800C9A6 - bl sub_800D294 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - ldr r4, =gUnknown_03004140 - strh r0, [r4, 0x14] - cmp r0, 0 - beq _0800C980 - movs r0, 0x20 - movs r1, 0x1 - bl sub_800D30C -_0800C980: - ldrb r0, [r4, 0xB] - cmp r0, 0 - beq _0800C9A6 - ldrh r0, [r4, 0x1A] - cmp r0, 0x1 - beq _0800C9A6 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0x4 - bne _0800C9A6 - bl rfu_REQ_endSearchParent - bl rfu_waitREQComplete - movs r0, 0x9 - strb r0, [r4, 0x4] - movs r0, 0x1 - strb r0, [r4, 0xB] -_0800C9A6: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800C9B0 - b _0800CC8A -_0800C9B0: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C9BC - b _0800CC8A -_0800C9BC: - movs r0, 0xB - strb r0, [r1, 0x4] - movs r0, 0 - strb r0, [r1, 0x5] - b _0800CC8A - .pool -_0800C9D0: - cmp r6, 0 - beq _0800C9D6 - b _0800CC8A -_0800C9D6: - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x5] - strb r0, [r2, 0x4] - ldrb r1, [r2, 0x7] - cmp r1, 0 - bne _0800C9F4 - lsls r0, 24 - cmp r0, 0 - beq _0800C9EA - b _0800CC8A -_0800C9EA: - movs r0, 0x21 - b _0800CBF6 - .pool -_0800C9F4: - cmp r1, 0x7 - bne _0800C9FA - b _0800CC8A -_0800C9FA: - movs r0, 0x5 - strb r0, [r2, 0x4] - strb r0, [r2, 0x7] - b _0800CC8A -_0800CA02: - cmp r6, 0 - beq _0800CA08 - b _0800CC8A -_0800CA08: - ldr r1, =gUnknown_03004140 - movs r0, 0xD -_0800CA0C: - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - b _0800CC8A - .pool -_0800CA18: - cmp r6, 0 - bne _0800CA3C - ldr r4, =gUnknown_03004150 - mov r0, sp - adds r1, r4, 0 - bl rfu_getConnectParentStatus - lsls r0, 16 - cmp r0, 0 - bne _0800CA3C - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CA3C - adds r1, r4, 0 - subs r1, 0x10 - movs r0, 0xE - strb r0, [r1, 0x4] -_0800CA3C: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800CA46 - b _0800CC8A -_0800CA46: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800CA52 - b _0800CC8A -_0800CA52: - movs r0, 0xE - strb r0, [r1, 0x4] - b _0800CC8A - .pool -_0800CA60: - cmp r6, 0 - beq _0800CA66 - b _0800CC8A -_0800CA66: - ldr r4, =gUnknown_03004150 - mov r0, sp - adds r1, r4, 0 - bl rfu_getConnectParentStatus - lsls r0, 16 - cmp r0, 0 - beq _0800CA78 - b _0800CC8A -_0800CA78: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CA9C - adds r1, r4, 0 - subs r1, 0x10 - movs r0, 0x13 - strb r0, [r1, 0x4] - movs r0, 0xF - strb r0, [r1, 0x5] - movs r0, 0x22 - strh r0, [r1, 0x1E] - ldrb r0, [r1, 0x10] - strh r0, [r1, 0x14] - b _0800CABC - .pool -_0800CA9C: - adds r1, r4, 0 - subs r1, 0x10 - strb r6, [r1, 0x5] - strb r6, [r1, 0x4] - movs r0, 0x23 - strh r0, [r1, 0x1E] - mov r0, sp - ldrb r0, [r0] - strh r0, [r1, 0x14] - ldrb r0, [r1, 0x7] - cmp r0, 0 - beq _0800CABC - movs r0, 0x3 - strb r0, [r1, 0x7] - movs r0, 0x9 - strb r0, [r1, 0x4] -_0800CABC: - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x1E] - movs r1, 0x1 - bl sub_800D30C - movs r0, 0 - strh r0, [r4, 0x1E] - b _0800CC8A - .pool -_0800CAD0: - cmp r6, 0 - beq _0800CAD6 - b _0800CC8A -_0800CAD6: - ldr r2, =gUnknown_03007890 - ldr r3, [r2] - ldrb r0, [r3, 0x3] - movs r1, 0 - strh r0, [r7, 0x14] - movs r0, 0x11 - strb r0, [r7, 0x5] - strb r0, [r7, 0x4] - strb r1, [r7, 0x10] - ldrb r0, [r3, 0x3] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800CAF4 - b _0800CC8A -_0800CAF4: - adds r1, r7, 0 - movs r3, 0x1 -_0800CAF8: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bls _0800CB08 - b _0800CC8A -_0800CB08: - ldr r0, [r2] - ldrb r0, [r0, 0x3] - ldrb r4, [r7, 0x10] - asrs r0, r4 - ands r0, r3 - cmp r0, 0 - beq _0800CAF8 - b _0800CC8A - .pool -_0800CB1C: - cmp r6, 0 - bne _0800CB3A - mov r0, sp - bl rfu_CHILD_getConnectRecoveryStatus - lsls r0, 16 - cmp r0, 0 - bne _0800CB3A - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0800CB3A - ldr r1, =gUnknown_03004140 - movs r0, 0x12 - strb r0, [r1, 0x4] -_0800CB3A: - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x10] - lsls r0, 1 - adds r1, r2, 0 - adds r1, 0x34 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, 0 - bne _0800CB4E - b _0800CC8A -_0800CB4E: - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _0800CB5A - b _0800CC8A -_0800CB5A: - movs r0, 0x12 - strb r0, [r2, 0x4] - b _0800CC8A - .pool -_0800CB64: - cmp r6, 0 - beq _0800CB6A - b _0800CC8A -_0800CB6A: - mov r0, sp - bl rfu_CHILD_getConnectRecoveryStatus - lsls r0, 16 - cmp r0, 0 - beq _0800CB78 - b _0800CC8A -_0800CB78: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CB94 - ldr r1, =gUnknown_03004140 - movs r0, 0x13 - strb r0, [r1, 0x4] - movs r0, 0x16 - strb r0, [r1, 0x5] - movs r0, 0x32 - strh r0, [r1, 0x1E] - b _0800CBA8 - .pool -_0800CB94: - ldr r4, =gUnknown_03004140 - strb r6, [r4, 0x5] - strb r6, [r4, 0x4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bl sub_800D334 - movs r0, 0x33 - strh r0, [r4, 0x1E] -_0800CBA8: - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x34 - adds r0, r1 - movs r1, 0 - movs r4, 0 - strh r4, [r0] - adds r0, r5, 0 - adds r0, 0x30 - strb r1, [r0] - strb r1, [r5, 0xA] - ldrb r0, [r5, 0x1E] - movs r1, 0x1 - bl sub_800D30C - strh r4, [r5, 0x1E] - b _0800CC8A - .pool -_0800CBD8: - cmp r6, 0 - bne _0800CC8A - ldr r5, =gUnknown_03004140 - ldrb r1, [r5, 0x5] - adds r0, r1, 0 - cmp r0, 0x16 - bne _0800CC04 - ldrb r0, [r5, 0x11] - strb r0, [r5, 0x4] - ldrb r0, [r5, 0x12] - strb r0, [r5, 0x5] - ldrb r0, [r5, 0x2] - movs r0, 0x1 - strb r0, [r5, 0x2] - movs r0, 0x41 -_0800CBF6: - movs r1, 0 - bl sub_800D30C - b _0800CC8A - .pool -_0800CC04: - cmp r0, 0xF - bne _0800CC8A - strb r1, [r5, 0x4] - ldrb r0, [r5, 0x2] - movs r4, 0x1 - strb r4, [r5, 0x2] - movs r0, 0x41 - movs r1, 0 - bl sub_800D30C - adds r1, r5, 0 - adds r1, 0x24 - ldrb r0, [r5, 0x10] - lsls r4, r0 - ldrb r0, [r1] - orrs r4, r0 - strb r4, [r1] - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, 0x4 - adds r0, r1 - ldrh r1, [r5, 0x26] - movs r7, 0 - strh r1, [r0] - ldrb r1, [r5, 0x10] - movs r0, 0x4 - bl rfu_clearSlot - mov r4, sp - ldrb r0, [r5, 0x10] - movs r1, 0xE - bl rfu_NI_CHILD_setSendGameName - strb r0, [r4] - lsls r0, 24 - cmp r0, 0 - beq _0800CC8A - strb r7, [r5, 0x5] - strb r7, [r5, 0x4] - bl sub_800D610 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl sub_800D334 - mov r0, sp - ldrb r0, [r0] - strh r0, [r5, 0x14] - movs r0, 0x25 - movs r1, 0x1 - bl sub_800D30C - b _0800CC8A - .pool -_0800CC78: - cmp r6, 0 - bne _0800CC8A - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0x5] - strb r6, [r0, 0x4] - movs r0, 0x42 - movs r1, 0 - bl sub_800D30C -_0800CC8A: - ldr r1, =gUnknown_03004140 - movs r0, 0x1 - strb r0, [r1, 0xE] - b _0800CCE6 - .pool -_0800CC98: - cmp r6, 0x3 - bne _0800CCE6 - ldrb r0, [r7, 0xF] - cmp r0, 0 - beq _0800CCE6 - mov r3, r8 - cmp r3, 0x24 - beq _0800CCB0 - cmp r3, 0x26 - beq _0800CCB0 - cmp r3, 0x27 - bne _0800CCE6 -_0800CCB0: - bl rfu_REQ_RFUStatus - bl rfu_waitREQComplete - mov r0, sp - bl rfu_getRFUStatus - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CCE6 - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - bne _0800CCE6 - bl rfu_getSTWIRecvBuffer - ldr r1, [r4] - ldrb r1, [r1, 0x2] - strb r1, [r0, 0x4] - movs r1, 0x1 - strb r1, [r0, 0x5] - movs r0, 0x29 - bl sub_800C36C - movs r6, 0 -_0800CCE6: - mov r4, r8 - cmp r4, 0x26 - bne _0800CCEE - b _0800CE02 -_0800CCEE: - cmp r4, 0x26 - bgt _0800CD00 - cmp r4, 0x10 - bne _0800CCF8 - b _0800CE20 -_0800CCF8: - b _0800CE3E - .pool -_0800CD00: - mov r0, r8 - cmp r0, 0x30 - beq _0800CD0E - cmp r0, 0x3D - bne _0800CD0C - b _0800CE20 -_0800CD0C: - b _0800CE3E -_0800CD0E: - cmp r6, 0 - beq _0800CD14 - b _0800CE42 -_0800CD14: - bl rfu_getSTWIRecvBuffer - ldr r4, =gUnknown_03004140 - ldrb r0, [r0, 0x8] - strh r0, [r4, 0x14] - bl sub_800D358 - adds r2, r4, 0 - adds r2, 0x30 - ldrb r1, [r2] - cmp r1, 0 - beq _0800CD6A - ldrb r0, [r4, 0x14] - adds r3, r1, 0 - bics r3, r0 - adds r0, r3, 0 - strb r0, [r2] - movs r3, 0 - adds r7, r4, 0 - adds r1, r7, 0 - movs r5, 0x1 - adds r4, r1, 0 - adds r4, 0x34 - movs r2, 0 -_0800CD44: - ldrh r0, [r1, 0x14] - asrs r0, r3 - ands r0, r5 - cmp r0, 0 - beq _0800CD54 - lsls r0, r3, 1 - adds r0, r4 - strh r2, [r0] -_0800CD54: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800CD44 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x6] - cmp r0, 0 - bne _0800CD6A - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] -_0800CD6A: - mov r3, sp - ldr r1, =gUnknown_03004140 - ldrb r2, [r1] - ldrb r0, [r1, 0x14] - ands r0, r2 - strb r0, [r3] - movs r3, 0 - adds r7, r1, 0 - ldr r2, =gUnknown_03007890 - mov r1, sp - movs r5, 0x1 - adds r4, r7, 0 -_0800CD82: - ldrb r0, [r1] - asrs r0, r3 - ands r0, r5 - cmp r0, 0 - beq _0800CD96 - ldrb r0, [r4, 0x1] - cmp r0, 0 - beq _0800CD96 - subs r0, 0x1 - strb r0, [r7, 0x1] -_0800CD96: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800CD82 - ldrb r1, [r7, 0x14] - ldrb r0, [r7] - bics r0, r1 - strb r0, [r7] - ldrb r1, [r7, 0x7] - cmp r1, 0 - beq _0800CDE0 - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0xFF - bne _0800CDF2 - cmp r1, 0x8 - bne _0800CDCC - ldrh r0, [r7, 0x1C] - strh r0, [r7, 0x1A] - movs r0, 0x6 - strb r0, [r7, 0x7] - b _0800CDDE - .pool -_0800CDCC: - ldrb r0, [r7, 0x4] - subs r0, 0x6 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _0800CDE0 - movs r0, 0x1 - strb r0, [r7, 0x7] - movs r0, 0x5 -_0800CDDE: - strb r0, [r7, 0x4] -_0800CDE0: - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0xFF - bne _0800CDF2 - ldrb r0, [r7, 0x4] - cmp r0, 0 - bne _0800CDF2 - movs r0, 0xFF - strb r0, [r7, 0x6] -_0800CDF2: - ldrb r0, [r7, 0xE] - cmp r0, 0 - bne _0800CE3E - movs r0, 0x40 - movs r1, 0x1 - bl sub_800D30C - b _0800CE3E -_0800CE02: - bl sub_800D20C - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0xFF - beq _0800CE3E - movs r0, 0x50 - movs r1, 0 - bl sub_800D30C - b _0800CE3E - .pool -_0800CE20: - cmp r6, 0 - bne _0800CE42 - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0xD] - strb r6, [r0, 0x1] - strb r6, [r0] - movs r1, 0xFF - strb r1, [r0, 0x6] - bl sub_800D610 - mov r4, r8 - cmp r4, 0x3D - bne _0800CE3E - bl sub_800BFA0 -_0800CE3E: - cmp r6, 0 - beq _0800CE92 -_0800CE42: - ldr r7, =gUnknown_03004140 - mov r0, r8 - cmp r0, 0x1C - bne _0800CE74 - cmp r6, 0 - beq _0800CE74 - ldrb r0, [r7, 0x7] - cmp r0, 0x4 - bne _0800CE74 - ldr r2, =gUnknown_03007890 - ldr r1, [r2] - movs r0, 0x1 - strb r0, [r1] - ldr r1, [r2] - movs r0, 0xF - strb r0, [r1, 0x2] - bl sub_800D334 - bl rfu_waitREQComplete - b _0800CEA4 - .pool -_0800CE74: - movs r1, 0 - mov r3, r8 - strh r3, [r7, 0x14] - strh r6, [r7, 0x16] - ldrb r0, [r7, 0xE] - cmp r0, 0 - beq _0800CE86 - strb r1, [r7, 0x5] - strb r1, [r7, 0x4] -_0800CE86: - movs r0, 0xF0 - movs r1, 0x2 - bl sub_800D30C - bl sub_800D610 -_0800CE92: - mov r4, r8 - cmp r4, 0xFF - bne _0800CEA4 - movs r0, 0xF2 - movs r1, 0 - bl sub_800D30C - bl sub_800D610 -_0800CEA4: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800C7B4 - - thumb_func_start sub_800CEB0 -sub_800CEB0: @ 800CEB0 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r4, =gUnknown_03004140 - ldrb r7, [r4, 0xE] - movs r0, 0 - strb r0, [r4, 0xE] - movs r0, 0x1 - strb r0, [r4, 0xF] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r5, [r0] - cmp r5, 0 - bne _0800CEEC - adds r0, r6, 0 - bl sub_800C36C - ldrb r0, [r4, 0x2] - cmp r0, 0x1 - beq _0800CF04 - bl sub_800D610 - strb r5, [r4, 0xF] - strb r7, [r4, 0xE] - b _0800CF28 - .pool -_0800CEEC: - mov r0, sp - bl rfu_UNI_PARENT_getDRAC_ACK - lsls r0, 16 - cmp r0, 0 - bne _0800CF04 - mov r1, sp - ldrb r0, [r4, 0x3] - ldrb r1, [r1] - orrs r0, r1 - ldrb r1, [r4, 0x3] - strb r0, [r4, 0x3] -_0800CF04: - ldr r4, =gUnknown_03004140 - ldr r1, [r4, 0x44] - cmp r1, 0 - beq _0800CF20 - adds r0, r6, 0 - bl _call_via_r1 - bl rfu_waitREQComplete - ldrb r0, [r4, 0x2] - cmp r0, 0x2 - bne _0800CF20 - bl sub_800D610 -_0800CF20: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0xF] - strb r7, [r1, 0xE] -_0800CF28: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800CEB0 - - thumb_func_start sub_800CF34 -sub_800CF34: @ 800CF34 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - subs r0, 0x5 - lsls r0, 24 - lsrs r0, 24 - adds r3, r1, 0 - cmp r0, 0x3 - bls _0800CF52 - b _0800D146 -_0800CF52: - ldr r0, =gUnknown_03007890 - ldr r2, [r0] - ldrb r1, [r2, 0x2] - ldrb r0, [r3, 0xC] - adds r4, r1, 0 - eors r4, r0 - ands r4, r1 - ldrb r0, [r2, 0x7] - bics r4, r0 - mov r8, r4 - strb r1, [r3, 0xC] - cmp r4, 0 - beq _0800CF7A - strh r4, [r3, 0x14] - movs r0, 0x10 - movs r1, 0x1 - str r3, [sp, 0x4] - bl sub_800D30C - ldr r3, [sp, 0x4] -_0800CF7A: - movs r0, 0 - str r0, [sp] - movs r6, 0 - adds r7, r3, 0 - movs r1, 0x24 - adds r1, r3 - mov r9, r1 -_0800CF88: - movs r0, 0x80 - lsls r0, 17 - lsls r0, r6 - lsrs r4, r0, 24 - movs r5, 0 - mov r0, r8 - ands r0, r4 - cmp r0, 0 - beq _0800CFDA - lsls r1, r6, 1 - adds r0, r7, 0 - adds r0, 0x28 - adds r1, r0 - ldrh r0, [r7, 0x26] - strh r0, [r1] - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r2] - adds r6, 0x1 - mov r10, r6 - b _0800D090 - .pool -_0800CFC0: - ldrb r1, [r7] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r7] - ldrb r0, [r7, 0x1] - adds r0, 0x1 - strb r0, [r7, 0x1] - ldr r0, [sp] - orrs r0, r4 - str r0, [sp] - movs r0, 0x1 - orrs r5, r0 - b _0800D024 -_0800CFDA: - mov r1, r9 - ldrb r0, [r1] - ands r0, r4 - adds r2, r6, 0x1 - mov r10, r2 - cmp r0, 0 - beq _0800D090 - ldr r0, =gUnknown_03007880 - lsls r1, r6, 2 - adds r1, r0 - ldr r1, [r1] - ldrh r0, [r1, 0x34] - cmp r0, 0x46 - bne _0800D040 - adds r0, r1, 0 - adds r0, 0x61 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800D058 - movs r5, 0x2 - ldr r3, [r3, 0x20] - ldrh r2, [r3] - ldr r0, =0x0000ffff - cmp r2, r0 - beq _0800D024 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - lsls r1, r6, 5 - adds r0, r1 - ldrh r0, [r0, 0x18] - ldr r1, =0x0000ffff -_0800D018: - cmp r0, r2 - beq _0800CFC0 - adds r3, 0x2 - ldrh r2, [r3] - cmp r2, r1 - bne _0800D018 -_0800D024: - movs r0, 0x1 - ands r0, r5 - cmp r0, 0 - bne _0800D058 - movs r0, 0x4 - orrs r5, r0 - b _0800D058 - .pool -_0800D040: - lsls r1, r6, 1 - adds r0, r3, 0 - adds r0, 0x28 - adds r1, r0 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - ldr r1, =0x0000ffff - ands r0, r1 - cmp r0, 0 - bne _0800D058 - movs r5, 0x6 -_0800D058: - movs r0, 0x2 - ands r0, r5 - cmp r0, 0 - beq _0800D07E - mov r2, r9 - ldrb r0, [r2] - bics r0, r4 - movs r2, 0 - mov r1, r9 - strb r0, [r1] - lsls r0, r6, 1 - adds r1, r7, 0 - adds r1, 0x28 - adds r0, r1 - strh r2, [r0] - movs r0, 0x8 - adds r1, r6, 0 - bl rfu_clearSlot -_0800D07E: - movs r0, 0x4 - ands r5, r0 - ldr r3, =gUnknown_03004140 - cmp r5, 0 - beq _0800D090 - ldrb r1, [r7, 0xD] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r7, 0xD] -_0800D090: - mov r2, r10 - lsls r0, r2, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bhi _0800D09C - b _0800CF88 -_0800D09C: - ldr r4, [sp] - cmp r4, 0 - beq _0800D0AE - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x11 - movs r1, 0x1 - bl sub_800D30C -_0800D0AE: - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0xD] - cmp r0, 0 - beq _0800D0EA - movs r5, 0x1 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0 - beq _0800D0CE - ldrb r0, [r1, 0x3] - ldrb r1, [r1] - ands r0, r1 - cmp r0, r1 - beq _0800D0CE - movs r5, 0 -_0800D0CE: - cmp r5, 0 - beq _0800D0EA - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0xD] - bl sub_800D334 - ldrb r0, [r4, 0xD] - movs r1, 0 - strh r0, [r4, 0x14] - strb r1, [r4, 0xD] - movs r0, 0x12 - movs r1, 0x1 - bl sub_800D30C -_0800D0EA: - ldr r0, =gUnknown_03004140 - adds r1, r0, 0 - adds r1, 0x24 - ldrb r1, [r1] - adds r3, r0, 0 - cmp r1, 0 - bne _0800D146 - ldrb r0, [r3, 0x4] - cmp r0, 0x8 - bne _0800D146 - ldrb r0, [r3, 0x7] - cmp r0, 0 - bne _0800D120 - strb r0, [r3, 0x5] - strb r0, [r3, 0x4] - movs r0, 0x14 - movs r1, 0 - bl sub_800D30C - b _0800D146 - .pool -_0800D120: - cmp r0, 0x2 - bne _0800D12C - movs r0, 0x3 - strb r0, [r3, 0x7] - movs r0, 0x9 - b _0800D132 -_0800D12C: - movs r0, 0x1 - strb r0, [r3, 0x7] - movs r0, 0x5 -_0800D132: - strb r0, [r3, 0x4] - ldrb r0, [r3] - cmp r0, 0 - beq _0800D146 - movs r0, 0 - strh r0, [r3, 0x1A] - movs r0, 0x8 - strb r0, [r3, 0x7] - movs r0, 0x5 - strb r0, [r3, 0x4] -_0800D146: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800CF34 - - thumb_func_start sub_800D158 -sub_800D158: @ 800D158 - push {r4-r6,lr} - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r6, r0, 0 - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x4] - cmp r0, 0xF - bne _0800D1BC - ldrb r1, [r4, 0x10] - lsls r1, 1 - adds r5, r4, 0 - adds r5, 0x28 - adds r1, r5 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _0800D192 - ldr r1, =gUnknown_03007880 - ldrb r0, [r4, 0x10] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x27 - bne _0800D1BC -_0800D192: - bl sub_800D630 - movs r0, 0x18 - strb r0, [r4, 0x4] - ldrb r1, [r4, 0x10] - movs r0, 0x4 - bl rfu_clearSlot - adds r2, r4, 0 - adds r2, 0x24 - movs r1, 0x1 - ldrb r0, [r4, 0x10] - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r4, 0x10] - lsls r0, 1 - adds r0, r5 - movs r1, 0 - strh r1, [r0] -_0800D1BC: - ldr r0, =0x04000208 - strh r6, [r0] - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x4] - cmp r0, 0x18 - bne _0800D1F6 - ldrb r0, [r5, 0x2] - cmp r0, 0x1 - bne _0800D1D2 - bl sub_800D630 -_0800D1D2: - ldrb r0, [r5, 0x2] - adds r4, r0, 0 - cmp r4, 0 - bne _0800D1F6 - strb r4, [r5, 0x5] - strb r4, [r5, 0x4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl sub_800D334 - strh r4, [r5, 0x14] - movs r0, 0x25 - movs r1, 0x1 - bl sub_800D30C -_0800D1F6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D158 - - thumb_func_start sub_800D20C -sub_800D20C: @ 800D20C - push {r4,r5,lr} - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x4] - cmp r0, 0xF - bne _0800D258 - ldr r1, =gUnknown_03007880 - ldrb r2, [r5, 0x10] - lsls r0, r2, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x26 - bne _0800D258 - movs r4, 0 - strb r4, [r5, 0x5] - strb r4, [r5, 0x4] - movs r0, 0x4 - adds r1, r2, 0 - bl rfu_clearSlot - adds r2, r5, 0 - adds r2, 0x24 - movs r1, 0x1 - ldrb r0, [r5, 0x10] - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x28 - adds r0, r1 - strh r4, [r0] - movs r0, 0x24 - movs r1, 0 - bl sub_800D30C -_0800D258: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D20C - - thumb_func_start sub_800D268 -sub_800D268: @ 800D268 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x6] - cmp r0, 0 - bne _0800D28C - ldrb r0, [r1, 0xA] - cmp r0, 0x1 - bne _0800D28C - ldrb r0, [r1, 0x4] - strb r0, [r1, 0x11] - ldrb r0, [r1, 0x5] - strb r0, [r1, 0x12] - movs r0, 0x10 - strb r0, [r1, 0x4] - movs r0, 0x11 - strb r0, [r1, 0x5] - movs r0, 0x2 - strb r0, [r1, 0xA] -_0800D28C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D268 - - thumb_func_start sub_800D294 -sub_800D294: @ 800D294 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r6, 0 - movs r5, 0 - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - cmp r6, r0 - bcs _0800D2F0 - mov r8, r0 - ldr r0, =gUnknown_03004140 - mov r10, r0 - mov r9, r1 -_0800D2B4: - mov r1, r10 - ldr r3, [r1, 0x20] - ldrh r2, [r3] - adds r0, r5, 0x1 - mov r12, r0 - ldr r1, =0x0000ffff - cmp r2, r1 - beq _0800D2E6 - mov r1, r9 - ldr r0, [r1] - lsls r1, r5, 5 - adds r0, r1 - ldrh r4, [r0, 0x18] - ldr r7, =0x0000ffff - movs r1, 0x1 - lsls r1, r5 -_0800D2D4: - cmp r4, r2 - bne _0800D2DE - orrs r6, r1 - lsls r0, r6, 24 - lsrs r6, r0, 24 -_0800D2DE: - adds r3, 0x2 - ldrh r2, [r3] - cmp r2, r7 - bne _0800D2D4 -_0800D2E6: - mov r1, r12 - lsls r0, r1, 24 - lsrs r5, r0, 24 - cmp r5, r8 - bcc _0800D2B4 -_0800D2F0: - adds r0, r6, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D294 - - thumb_func_start sub_800D30C -sub_800D30C: @ 800D30C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r4, =gUnknown_03004140 - ldr r2, [r4, 0x40] - cmp r2, 0 - beq _0800D322 - bl _call_via_r2 -_0800D322: - movs r0, 0 - strh r0, [r4, 0x16] - strh r0, [r4, 0x14] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D30C - - thumb_func_start sub_800D334 -sub_800D334: @ 800D334 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gUnknown_03004140 - ldrb r5, [r4, 0xE] - movs r1, 0x1 - strb r1, [r4, 0xE] - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - strb r5, [r4, 0xE] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D334 - - thumb_func_start sub_800D358 -sub_800D358: @ 800D358 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0800D3A0 - movs r4, 0 -_0800D36A: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D396 - ldrb r1, [r2, 0x1A] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D396 - adds r2, r1, 0 - bics r2, r5 - movs r0, 0x20 - adds r1, r4, 0 - bl rfu_changeSendTarget -_0800D396: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D36A -_0800D3A0: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _0800D3DE - movs r4, 0 -_0800D3AC: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2, 0x34] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D3D4 - adds r0, r2, 0 - adds r0, 0x4E - ldrb r0, [r0] - ands r0, r5 - cmp r0, 0 - beq _0800D3D4 - adds r0, r4, 0 - bl rfu_NI_stopReceivingData -_0800D3D4: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D3AC -_0800D3DE: - ldr r0, =gUnknown_03007890 - ldr r3, [r0] - ldrb r2, [r3, 0x6] - cmp r2, 0 - beq _0800D41C - mvns r1, r5 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3, 0x6] - movs r4, 0 - ldr r7, =gUnknown_03007870 - ldr r6, =0x00008024 -_0800D3F6: - lsls r0, r4, 2 - adds r0, r7 - ldr r2, [r0] - ldrh r0, [r2] - cmp r0, r6 - bne _0800D412 - ldrb r3, [r2, 0x3] - adds r0, r5, 0 - ands r0, r3 - cmp r0, 0 - beq _0800D412 - adds r0, r1, 0 - ands r0, r3 - strb r0, [r2, 0x3] -_0800D412: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D3F6 -_0800D41C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D358 - - thumb_func_start sub_800D434 -sub_800D434: @ 800D434 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x18] - cmp r0, 0 - beq _0800D510 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0800D4D4 - movs r6, 0 -_0800D454: - ldr r3, =gUnknown_03007880 - lsls r2, r6, 2 - adds r0, r2, r3 - ldr r0, [r0] - ldrh r1, [r0] - movs r4, 0x80 - lsls r4, 8 - adds r0, r4, 0 - ands r1, r0 - adds r7, r2, 0 - adds r0, r6, 0x1 - mov r9, r0 - cmp r1, 0 - beq _0800D4CA - movs r5, 0 - movs r4, 0 - movs r1, 0x1 - mov r8, r1 - mov r10, r3 -_0800D47A: - adds r0, r7, r3 - ldr r0, [r0] - ldrb r0, [r0, 0x1A] - asrs r0, r4 - mov r1, r8 - ands r0, r1 - cmp r0, 0 - beq _0800D4A4 - lsls r0, r4, 2 - adds r0, r3 - ldr r0, [r0] - ldr r1, =gUnknown_03004140 - ldrh r0, [r0, 0x2] - ldrh r1, [r1, 0x18] - cmp r0, r1 - bls _0800D4A4 - mov r0, r8 - lsls r0, r4 - orrs r5, r0 - lsls r0, r5, 24 - lsrs r5, r0, 24 -_0800D4A4: - cmp r5, 0 - beq _0800D4C0 - mov r1, r10 - adds r0, r7, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1A] - adds r2, r5, 0 - eors r2, r0 - movs r0, 0x20 - adds r1, r6, 0 - str r3, [sp] - bl rfu_changeSendTarget - ldr r3, [sp] -_0800D4C0: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D47A -_0800D4CA: - mov r3, r9 - lsls r0, r3, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0800D454 -_0800D4D4: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _0800D510 - movs r6, 0 -_0800D4E0: - ldr r1, =gUnknown_03007880 - lsls r0, r6, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2, 0x34] - movs r4, 0x80 - lsls r4, 8 - adds r1, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D506 - ldr r1, =gUnknown_03004140 - ldrh r0, [r2, 0x36] - ldrh r1, [r1, 0x18] - cmp r0, r1 - bls _0800D506 - adds r0, r6, 0 - bl rfu_NI_stopReceivingData -_0800D506: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0800D4E0 -_0800D510: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D434 - - thumb_func_start sub_800D52C -sub_800D52C: @ 800D52C - push {lr} - ldr r1, =gUnknown_03004140 - str r0, [r1, 0x44] - ldr r0, =sub_800CEB0 - bl rfu_setMSCCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D52C - - thumb_func_start sub_800D544 -sub_800D544: @ 800D544 - ldr r1, =gUnknown_03004140 - str r0, [r1, 0x40] - bx lr - .pool - thumb_func_end sub_800D544 - - thumb_func_start sub_800D550 -sub_800D550: @ 800D550 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x9] - adds r3, r0, 0 - cmp r1, 0 - beq _0800D578 - cmp r4, 0 - bne _0800D578 - adds r0, 0x30 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D578 - movs r0, 0x5 - b _0800D588 - .pool -_0800D578: - ldr r2, =0x04000208 - ldrh r1, [r2] - movs r0, 0 - strh r0, [r2] - strb r4, [r3, 0x9] - strh r5, [r3, 0x32] - strh r1, [r2] - movs r0, 0 -_0800D588: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D550 - - thumb_func_start sub_800D594 -sub_800D594: @ 800D594 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x4] - ldrb r0, [r0, 0x5] - orrs r0, r1 - cmp r0, 0 - bne _0800D5B8 - ldr r0, =gUnknown_03004140 - strh r2, [r0, 0x18] - movs r0, 0 - b _0800D5C8 - .pool -_0800D5B8: - ldr r1, =gUnknown_03004140 - movs r0, 0x6 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x6 -_0800D5C8: - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D594 - - thumb_func_start sub_800D5D0 -sub_800D5D0: @ 800D5D0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - adds r3, r2, 0 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0800D5FC - movs r0, 0x7 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x7 - b _0800D60A - .pool -_0800D5FC: - cmp r2, 0 - beq _0800D606 - movs r0, 0x1 - strb r0, [r1, 0xB] - b _0800D608 -_0800D606: - strb r3, [r1, 0xB] -_0800D608: - movs r0, 0 -_0800D60A: - pop {r1} - bx r1 - thumb_func_end sub_800D5D0 - - thumb_func_start sub_800D610 -sub_800D610: @ 800D610 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x2] - cmp r0, 0 - beq _0800D628 - ldrb r0, [r1, 0x2] - movs r0, 0 - strb r0, [r1, 0x2] - movs r0, 0x45 - movs r1, 0 - bl sub_800D30C -_0800D628: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D610 - - thumb_func_start sub_800D630 -sub_800D630: @ 800D630 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x2] - cmp r0, 0 - bne _0800D648 - movs r0, 0x45 - movs r1, 0 - bl sub_800D30C - b _0800D654 - .pool -_0800D648: - ldrb r0, [r1, 0x2] - cmp r0, 0x1 - bne _0800D654 - ldrb r0, [r1, 0x2] - movs r0, 0x2 - strb r0, [r1, 0x2] -_0800D654: - pop {r0} - bx r0 - thumb_func_end sub_800D630 - - thumb_func_start sub_800D658 -sub_800D658: @ 800D658 - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x7] - adds r2, r0, 0 - cmp r1, 0 - beq _0800D6C2 - ldrb r0, [r2, 0x4] - subs r0, 0x5 - cmp r0, 0x6 - bhi _0800D6C2 - lsls r0, 2 - ldr r1, =_0800D680 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800D680: - .4byte _0800D69C - .4byte _0800D6A4 - .4byte _0800D6AE - .4byte _0800D6AE - .4byte _0800D6B4 - .4byte _0800D6B4 - .4byte _0800D6BA -_0800D69C: - movs r0, 0x3 - strb r0, [r2, 0x7] - movs r0, 0x9 - b _0800D6C0 -_0800D6A4: - movs r0, 0x2 - strb r0, [r2, 0x7] - movs r0, 0x1 - strh r0, [r2, 0x1A] - b _0800D6C2 -_0800D6AE: - movs r0, 0x2 - strb r0, [r2, 0x7] - b _0800D6C2 -_0800D6B4: - movs r0, 0x28 - strh r0, [r2, 0x1A] - b _0800D6C2 -_0800D6BA: - movs r0, 0x28 - strh r0, [r2, 0x1A] - movs r0, 0xA -_0800D6C0: - strb r0, [r2, 0x4] -_0800D6C2: - pop {r0} - bx r0 - thumb_func_end sub_800D658 - - thumb_func_start sub_800D6C8 -sub_800D6C8: @ 800D6C8 - push {r4,r5,lr} - adds r3, r0, 0 - movs r0, 0 - movs r4, 0 - movs r5, 0x46 -_0800D6D2: - adds r2, r0, 0x1 - movs r1, 0x45 - muls r0, r5 - adds r0, r3 - adds r0, 0x45 -_0800D6DC: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D6DC - adds r0, r2, 0 - cmp r0, 0x1F - ble _0800D6D2 - movs r1, 0 - ldr r2, =0x000008c1 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x8C - lsls r2, 4 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x000008c2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x000008c3 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D6C8 - - thumb_func_start sub_800D724 -sub_800D724: @ 800D724 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0 - movs r4, 0 -_0800D72C: - lsls r0, r1, 3 - adds r2, r1, 0x1 - subs r0, r1 - movs r1, 0xD - lsls r0, 1 - adds r0, r3 - adds r0, 0xD -_0800D73A: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D73A - adds r1, r2, 0 - cmp r1, 0x27 - ble _0800D72C - movs r1, 0 - ldr r2, =0x00000231 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x8C - lsls r2, 2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000232 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000233 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D724 - - thumb_func_start sub_800D780 -sub_800D780: @ 800D780 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0 - movs r4, 0 -_0800D788: - lsls r0, r1, 8 - adds r2, r1, 0x1 - movs r1, 0xFF - adds r0, r3 - adds r0, 0xFF -_0800D792: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D792 - adds r1, r2, 0 - cmp r1, 0x1 - ble _0800D788 - movs r1, 0 - ldr r2, =0x00000201 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x80 - lsls r2, 2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000202 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000203 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D780 - - thumb_func_start sub_800D7D8 -sub_800D7D8: @ 800D7D8 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x000008c2 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1F - bhi _0800D874 - ldr r0, =0x04000208 - ldrh r1, [r0] - adds r7, r1, 0 - movs r1, 0 - strh r1, [r0] - movs r5, 0 - movs r2, 0 -_0800D7F6: - adds r1, r4, r2 - ldrb r0, [r1] - cmp r0, 0 - bne _0800D80A - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _0800D80A - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0800D80A: - adds r2, 0xE - cmp r2, 0x45 - ble _0800D7F6 - cmp r5, 0x5 - beq _0800D866 - movs r2, 0 - movs r0, 0x8C - lsls r0, 4 - adds r5, r3, r0 - movs r6, 0x46 -_0800D81E: - ldrb r0, [r5] - adds r1, r0, 0 - muls r1, r6 - adds r1, r2, r1 - adds r1, r3, r1 - adds r0, r4, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D81E - movs r0, 0x8C - lsls r0, 4 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x000008c2 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D85E: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D85E -_0800D866: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D87E - .pool -_0800D874: - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D87E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D7D8 - - thumb_func_start sub_800D888 -sub_800D888: @ 800D888 - push {r4-r7,lr} - adds r6, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000232 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0x27 - bhi _0800D920 - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - movs r0, 0 - strh r0, [r1] - movs r2, 0 - ldrb r0, [r5] - cmp r0, 0 - bne _0800D8B8 -_0800D8AA: - adds r2, 0x1 - cmp r2, 0xD - bgt _0800D8B8 - adds r0, r5, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D8AA -_0800D8B8: - cmp r2, 0xE - beq _0800D910 - movs r2, 0 - movs r0, 0x8C - lsls r0, 2 - adds r3, r6, r0 -_0800D8C4: - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r2, r0 - adds r0, r6, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xD - ble _0800D8C4 - movs r1, 0x8C - lsls r1, 2 - adds r4, r6, r1 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r6, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r5, 0 - adds r0, 0xD -_0800D908: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r5 - bge _0800D908 -_0800D910: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D92A - .pool -_0800D920: - ldr r1, =0x00000233 - adds r0, r6, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D92A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D888 - - thumb_func_start sub_800D934 -sub_800D934: @ 800D934 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x04000208 - ldrh r0, [r1] - mov r12, r0 - movs r0, 0 - strh r0, [r1] - movs r1, 0x8C - lsls r1, 4 - adds r0, r3, r1 - ldr r7, =0x000008c1 - adds r5, r3, r7 - ldrb r1, [r0] - ldrb r0, [r5] - cmp r1, r0 - beq _0800D960 - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D984 -_0800D960: - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D966: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D966 - ldr r0, =0x04000208 - mov r7, r12 - strh r7, [r0] - movs r0, 0 - b _0800D9CA - .pool -_0800D984: - movs r2, 0 - movs r6, 0x46 -_0800D988: - adds r1, r4, r2 - ldrb r0, [r5] - adds r7, r0, 0 - muls r7, r6 - adds r0, r7, 0 - adds r0, r2, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D988 - ldr r0, =0x000008c1 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r7, =0x000008c2 - adds r1, r3, r7 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - mov r1, r12 - strh r1, [r0] - movs r0, 0x1 -_0800D9CA: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D934 - - thumb_func_start sub_800D9DC -sub_800D9DC: @ 800D9DC - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r1, 0x8C - lsls r1, 2 - adds r0, r5, r1 - adds r1, 0x1 - adds r4, r5, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DA00 - ldr r1, =0x00000233 - adds r0, r5, r1 - ldrb r0, [r0] - adds r2, r0, 0 - cmp r2, 0 - beq _0800DA08 -_0800DA00: - movs r0, 0 - b _0800DA54 - .pool -_0800DA08: - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - strh r2, [r1] - movs r3, 0 -_0800DA12: - adds r2, r6, r3 - ldrb r1, [r4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r5, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA12 - ldr r0, =0x00000231 - adds r4, r5, r0 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r5, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - strh r7, [r0] - movs r0, 0x1 -_0800DA54: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D9DC - - thumb_func_start sub_800DA68 -sub_800DA68: @ 800DA68 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _0800DA7E - adds r0, r2, 0 - movs r1, 0 - bl sub_800DAC8 - b _0800DAC0 -_0800DA7E: - movs r3, 0 -_0800DA80: - ldrb r1, [r2, 0x1C] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r2, r0 - adds r1, r4, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA80 - ldrb r0, [r2, 0x1C] - adds r0, 0x1 - ldrb r1, [r2, 0x1C] - strb r0, [r2, 0x1C] - ldrb r1, [r2, 0x1C] - movs r0, 0x1 - ands r0, r1 - ldrb r1, [r2, 0x1C] - strb r0, [r2, 0x1C] - ldrb r0, [r2, 0x1E] - cmp r0, 0x1 - bhi _0800DABA - ldrb r0, [r2, 0x1E] - adds r0, 0x1 - ldrb r1, [r2, 0x1E] - strb r0, [r2, 0x1E] - b _0800DAC0 -_0800DABA: - ldrb r0, [r2, 0x1C] - ldrb r1, [r2, 0x1D] - strb r0, [r2, 0x1D] -_0800DAC0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800DA68 - - thumb_func_start sub_800DAC8 -sub_800DAC8: @ 800DAC8 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - ldrb r0, [r3, 0x1E] - cmp r0, 0 - bne _0800DAD8 - movs r0, 0 - b _0800DB12 -_0800DAD8: - cmp r5, 0 - beq _0800DAF6 - movs r4, 0 -_0800DADE: - adds r2, r5, r4 - ldrb r1, [r3, 0x1D] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r4, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r4, 0x1 - cmp r4, 0xD - ble _0800DADE -_0800DAF6: - ldrb r0, [r3, 0x1D] - adds r0, 0x1 - ldrb r1, [r3, 0x1D] - strb r0, [r3, 0x1D] - ldrb r1, [r3, 0x1D] - movs r0, 0x1 - ands r0, r1 - ldrb r1, [r3, 0x1D] - strb r0, [r3, 0x1D] - ldrb r0, [r3, 0x1E] - subs r0, 0x1 - ldrb r1, [r3, 0x1E] - strb r0, [r3, 0x1E] - movs r0, 0x1 -_0800DB12: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_800DAC8 - - thumb_func_start sub_800DB18 -sub_800DB18: @ 800DB18 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000202 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0800DB70 - movs r2, 0 - movs r0, 0x80 - lsls r0, 2 - adds r4, r3, r0 -_0800DB30: - ldrb r0, [r4] - lsls r0, 8 - adds r0, r2, r0 - adds r0, r3, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xFF - ble _0800DB30 - movs r0, 0x80 - lsls r0, 2 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1 - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x00000202 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - b _0800DB7A - .pool -_0800DB70: - ldr r1, =0x00000203 - adds r0, r3, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800DB7A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DB18 - - thumb_func_start sub_800DB84 -sub_800DB84: @ 800DB84 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - movs r1, 0x80 - lsls r1, 2 - adds r0, r3, r1 - adds r1, 0x1 - adds r4, r3, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DBA6 - ldr r1, =0x00000203 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800DBB0 -_0800DBA6: - movs r0, 0 - b _0800DBEA - .pool -_0800DBB0: - movs r2, 0 -_0800DBB2: - adds r0, r5, r2 - ldrb r1, [r4] - lsls r1, 8 - adds r1, r2, r1 - adds r1, r3, r1 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xFF - ble _0800DBB2 - ldr r0, =0x00000201 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1 - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x00000202 - adds r1, r3, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0x1 -_0800DBEA: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800DB84 - - thumb_func_start sub_800DBF8 -sub_800DBF8: @ 800DBF8 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r1, 0 - movs r5, 0 - cmp r1, 0x1 - beq _0800DC36 - cmp r1, 0x1 - bgt _0800DC12 - cmp r1, 0 - beq _0800DC1C - b _0800DCAA -_0800DC12: - cmp r0, 0x2 - beq _0800DC56 - cmp r0, 0x3 - beq _0800DC76 - b _0800DCAA -_0800DC1C: - movs r4, 0 -_0800DC1E: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r1, [r0] - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r1, 0 - cmp r4, 0xC7 - ble _0800DC1E - b _0800DC70 -_0800DC36: - movs r4, 0 - adds r2, r6, 0 - adds r2, 0xC8 -_0800DC3C: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r1, [r0] - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r1, 0 - cmp r4, 0x63 - ble _0800DC3C - strh r5, [r2] - b _0800DCAA -_0800DC56: - movs r4, 0 -_0800DC58: - bl Random - lsls r0, 24 - lsrs r0, 24 - adds r1, r6, r4 - strb r0, [r1] - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, 0x1 - cmp r4, 0xC7 - ble _0800DC58 -_0800DC70: - adds r0, r6, r4 - strh r5, [r0] - b _0800DCAA -_0800DC76: - movs r4, 0 - ldr r3, =gUnknown_03000D74 - ldrb r1, [r3] - ldrb r0, [r3] - adds r7, r0, 0x1 - adds r2, r1, 0x1 - movs r0, 0xFF - mov r12, r0 -_0800DC86: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r2, [r0] - adds r0, r4, r7 - mov r4, r12 - ands r0, r4 - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r2, 0x1 - adds r4, r1, 0 - cmp r1, 0xC7 - ble _0800DC86 - adds r0, r6, r1 - strh r5, [r0] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] -_0800DCAA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DBF8 - thumb_func_start sub_800DCB4 sub_800DCB4: @ 800DCB4 push {r4,r5,lr} @@ -11740,4 +7887,867 @@ sub_8011D6C: @ 8011D6C .pool thumb_func_end sub_8011D6C + thumb_func_start sub_8011DC0 +sub_8011DC0: @ 8011DC0 + push {lr} + lsls r1, 16 + lsrs r1, 16 + bl sub_8011CE4 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xFF + beq _08011DDA + movs r0, 0x1 + lsls r0, r1 + bl sub_8011D6C +_08011DDA: + pop {r0} + bx r0 + thumb_func_end sub_8011DC0 + + thumb_func_start sub_8011DE0 +sub_8011DE0: @ 8011DE0 + push {r4-r6,lr} + adds r4, r0, 0 + cmp r4, 0 + beq _08011E20 + movs r3, 0 + movs r2, 0 + ldr r5, =gUnknown_03005CDE + adds r6, r5, 0x4 +_08011DF0: + adds r0, r2, r5 + ldrb r0, [r0] + cmp r0, r4 + bne _08011E0E + ldrb r0, [r6] + asrs r0, r2 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08011E0E + adds r0, r1, 0 + lsls r0, r2 + orrs r3, r0 + lsls r0, r3, 24 + lsrs r3, r0, 24 +_08011E0E: + adds r2, 0x1 + cmp r2, 0x3 + ble _08011DF0 + cmp r3, 0 + beq _08011E20 + adds r0, r3, 0 + movs r1, 0x2 + bl sub_8011E94 +_08011E20: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011DE0 + + thumb_func_start sub_8011E2C +sub_8011E2C: @ 8011E2C + push {r4-r6,lr} + lsls r0, 24 + lsrs r4, r0, 24 + ldr r6, =gSendCmd + ldrh r0, [r6] + cmp r0, 0 + bne _08011E7A + ldr r5, =gUnknown_03005000 + ldr r1, =0x00000ce8 + adds r0, r5, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _08011E7A + movs r0, 0xED + lsls r0, 8 + bl sub_800FD14 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldrh r1, [r0, 0x8] + strh r1, [r6, 0x2] + ldrh r1, [r0, 0xA] + strh r1, [r6, 0x4] + ldr r1, =gUnknown_082ED695 + movs r2, 0x8 + ldrsh r0, [r0, r2] + adds r0, r1 + ldrb r1, [r5, 0xD] + ldrb r0, [r0] + subs r1, r0 + strb r1, [r5, 0xD] + ldrb r0, [r5, 0xD] + strh r0, [r6, 0x6] + adds r0, r4, 0 + bl DestroyTask +_08011E7A: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011E2C + + thumb_func_start sub_8011E94 +sub_8011E94: @ 8011E94 + push {r4-r6,lr} + adds r4, r0, 0 + adds r6, r1, 0 + ldr r5, =sub_8011E2C + adds r0, r5, 0 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + bne _08011ECC + adds r0, r5, 0 + movs r1, 0x5 + bl CreateTask + lsls r0, 24 + lsrs r2, r0, 24 + ldr r1, =gTasks + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r1 + strh r4, [r0, 0x8] + b _08011EDC + .pool +_08011ECC: + ldr r0, =gTasks + lsls r1, r2, 2 + adds r1, r2 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x8] + orrs r4, r0 + strh r4, [r1, 0x8] +_08011EDC: + ldr r1, =gTasks + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r1 + strh r6, [r0, 0xA] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011E94 + + thumb_func_start sub_8011EF4 +sub_8011EF4: @ 8011EF4 + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + bl sub_800EE94 + lsls r0, 24 + cmp r0, 0 + beq _08011FA4 + adds r0, r4, 0 + adds r0, 0x10 + bl sub_8011CD8 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + bl sub_8011CE4 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + beq _08011F8C + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + lsls r1, r2, 5 + adds r0, r1 + ldrb r0, [r0, 0x16] + cmp r0, 0xFF + beq _08011F5C + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000c3d + adds r0, r1 + strb r2, [r0] + bl sub_800EEBC + cmp r0, 0 + beq _08011FAA + b _08011F84 + .pool +_08011F5C: + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r5, 0x7F + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0x15 + beq _08011FA4 + bl sub_800F7DC + ldrb r1, [r0, 0xA] + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0x16 + beq _08011FA4 + movs r1, 0xE0 + lsls r1, 7 + movs r0, 0x2 + bl sub_8011A64 +_08011F84: + adds r0, r6, 0 + bl DestroyTask + b _08011FAA +_08011F8C: + ldrh r0, [r4, 0x1E] + adds r0, 0x1 + strh r0, [r4, 0x1E] + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000c3d + adds r0, r1 + strb r2, [r0] + b _08011FAA + .pool +_08011FA4: + ldrh r0, [r4, 0x1E] + adds r0, 0x1 + strh r0, [r4, 0x1E] +_08011FAA: + movs r1, 0x1E + ldrsh r0, [r4, r1] + cmp r0, 0xF0 + ble _08011FC2 + movs r1, 0xE0 + lsls r1, 7 + movs r0, 0x2 + bl sub_8011A64 + adds r0, r6, 0 + bl DestroyTask +_08011FC2: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8011EF4 + + thumb_func_start sub_8011FC8 +sub_8011FC8: @ 8011FC8 + push {r4-r6,lr} + adds r6, r0, 0 + lsls r5, r1, 16 + lsrs r5, 16 + ldr r0, =gUnknown_03005000 + adds r0, 0xF1 + movs r1, 0 + strb r1, [r0] + ldr r0, =sub_8011EF4 + movs r1, 0x3 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + lsls r4, r0, 2 + adds r4, r0 + lsls r4, 3 + ldr r0, =gTasks + 0x8 + adds r4, r0 + adds r0, r4, 0 + adds r1, r6, 0 + bl StringCopy + strh r5, [r4, 0x10] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8011FC8 + + thumb_func_start sub_801200C +sub_801200C: @ 801200C + push {r4,r5,lr} + adds r4, r1, 0 + lsls r0, 16 + lsrs r5, r0, 16 + bl sub_800F7DC + ldrb r1, [r0, 0xA] + movs r2, 0x7F + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0x45 + bne _08012032 + ldrb r1, [r4, 0xA] + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0x45 + beq _08012092 +_0801202E: + movs r0, 0x1 + b _08012094 +_08012032: + ldrb r1, [r4, 0xA] + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0x40 + bne _0801202E + cmp r5, 0x44 + bne _08012092 + ldr r5, =gUnknown_0300510A + ldrh r0, [r5, 0x8] + ldr r3, =0x000003ff + adds r2, r3, 0 + ands r2, r0 + movs r0, 0xCE + lsls r0, 1 + cmp r2, r0 + bne _08012068 + ldrh r1, [r4, 0x8] + adds r0, r3, 0 + ands r0, r1 + cmp r0, r2 + beq _08012092 + b _0801202E + .pool +_08012068: + ldrh r1, [r4, 0x8] + adds r0, r3, 0 + ands r0, r1 + cmp r0, r2 + bne _0801202E + ldrb r2, [r4, 0xB] + movs r0, 0xFE + ldrb r3, [r5, 0xB] + adds r1, r0, 0 + ands r1, r2 + ands r0, r3 + cmp r1, r0 + bne _0801202E + ldrb r2, [r4, 0x9] + movs r0, 0xFC + ldrb r3, [r5, 0x9] + adds r1, r0, 0 + ands r1, r2 + ands r0, r3 + cmp r1, r0 + bne _0801202E +_08012092: + movs r0, 0 +_08012094: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_801200C + + thumb_func_start sub_801209C +sub_801209C: @ 801209C + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r5, r0, 24 + mov r8, r5 + ldr r6, =gUnknown_03005000 + adds r0, r6, 0 + adds r0, 0xF1 + ldrb r0, [r0] + cmp r0, 0x4 + bne _080120BA + adds r0, r5, 0 + bl DestroyTask +_080120BA: + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r4, r0, r1 + ldrh r0, [r4, 0x8] + adds r0, 0x1 + strh r0, [r4, 0x8] + lsls r0, 16 + movs r1, 0x96 + lsls r1, 17 + cmp r0, r1 + ble _080120E4 + movs r1, 0xE0 + lsls r1, 7 + movs r0, 0x2 + bl sub_8011A64 + adds r0, r5, 0 + bl DestroyTask +_080120E4: + ldr r1, =0x00000ccd + adds r0, r6, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0801217C + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x6] + cmp r0, 0 + bne _0801217C + movs r2, 0x86 + lsls r2, 1 + adds r0, r6, r2 + bl sub_8011CD8 + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + ldr r2, =0x00000119 + adds r0, r6, r2 + bl sub_8011CE4 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + beq _0801217C + movs r1, 0xA + ldrsh r0, [r4, r1] + ldr r7, =gUnknown_03007890 + lsls r4, r2, 5 + adds r2, r4, 0 + adds r2, 0x14 + ldr r1, [r7] + adds r1, r2 + adds r1, 0x6 + bl sub_801200C + cmp r0, 0 + bne _0801216C + ldr r0, [r7] + adds r1, r0, r4 + ldrb r0, [r1, 0x16] + cmp r0, 0xFF + beq _0801217C + ldrh r0, [r1, 0x14] + movs r1, 0x5A + bl sub_800C12C + lsls r0, 24 + cmp r0, 0 + bne _0801217C + movs r0, 0xA + strh r0, [r6, 0x4] + adds r0, r5, 0 + bl DestroyTask + b _0801217C + .pool +_0801216C: + movs r1, 0xE0 + lsls r1, 7 + movs r0, 0x2 + bl sub_8011A64 + mov r0, r8 + bl DestroyTask +_0801217C: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_801209C + + thumb_func_start sub_8012188 +sub_8012188: @ 8012188 + push {r4-r7,lr} + adds r3, r0, 0 + adds r5, r1, 0 + lsls r4, r2, 24 + lsrs r4, 24 + ldr r6, =gUnknown_03005000 + ldr r1, =0x00000ccf + adds r0, r6, r1 + movs r7, 0 + strb r7, [r0] + adds r0, r6, 0 + adds r0, 0xF1 + strb r7, [r0] + ldr r1, =0x00000119 + adds r0, r6, r1 + adds r1, r3, 0 + bl StringCopy + movs r1, 0x85 + lsls r1, 1 + adds r0, r6, r1 + adds r1, r5, 0 + movs r2, 0xD + bl memcpy + bl sub_800D658 + ldr r0, =sub_801209C + movs r1, 0x2 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r5, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r5 + strh r4, [r1, 0xA] + ldr r0, =sub_800EB44 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r1, r0, 24 + adds r2, r1, 0 + cmp r4, 0x45 + bne _08012210 + cmp r1, 0xFF + beq _0801221E + lsls r0, r1, 2 + adds r0, r1 + lsls r0, 3 + adds r0, r5 + movs r1, 0x1 + strh r1, [r0, 0x16] + b _0801221E + .pool +_08012210: + cmp r2, 0xFF + beq _0801221E + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r5 + strh r7, [r0, 0x16] +_0801221E: + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8012188 + + thumb_func_start sub_8012224 +sub_8012224: @ 8012224 + push {lr} + ldr r0, =gUnknown_03005000 + adds r0, 0xF0 + ldrb r0, [r0] + cmp r0, 0x1 + beq _08012238 + movs r0, 0 + b _0801223A + .pool +_08012238: + movs r0, 0x1 +_0801223A: + pop {r1} + bx r1 + thumb_func_end sub_8012224 + + thumb_func_start sub_8012240 +sub_8012240: @ 8012240 + push {r4,lr} + movs r1, 0 + ldr r0, =gUnknown_03004140 + ldrb r2, [r0] + ldr r4, =gUnknown_03005CD1 + movs r3, 0x1 +_0801224C: + adds r0, r2, 0 + asrs r0, r1 + ands r0, r3 + cmp r0, 0 + beq _0801226C + adds r0, r1, r4 + ldrb r0, [r0] + cmp r0, 0 + bne _0801226C + movs r0, 0 + b _08012274 + .pool +_0801226C: + adds r1, 0x1 + cmp r1, 0x3 + ble _0801224C + movs r0, 0x1 +_08012274: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8012240 + + thumb_func_start sub_801227C +sub_801227C: @ 801227C + push {r4,lr} + movs r4, 0 +_08012280: + lsls r2, r4, 24 + lsrs r2, 24 + ldr r0, =gUnknown_082ED82C + movs r1, 0 + bl nullsub_5 + adds r4, 0x1 + cmp r4, 0x13 + ble _08012280 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801227C + + thumb_func_start sub_801229C +sub_801229C: @ 801229C + push {r4-r7,lr} + mov r7, r8 + push {r7} + bl GetBlockReceivedStatus + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x1C + movs r2, 0x13 + movs r3, 0x2 + bl nullsub_13 + ldr r4, =gUnknown_03007890 + ldr r0, [r4] + ldrb r0, [r0, 0x2] + movs r1, 0x14 + movs r2, 0x1 + movs r3, 0x1 + bl nullsub_13 + ldr r0, [r4] + ldrb r0, [r0, 0x3] + movs r1, 0x17 + movs r2, 0x1 + movs r3, 0x1 + bl nullsub_13 + ldr r0, =gUnknown_03005000 + ldrb r0, [r0, 0xC] + cmp r0, 0x1 + bne _08012378 + movs r6, 0 + adds r7, r4, 0 + movs r5, 0x14 +_080122E0: + ldr r2, [r7] + ldrb r0, [r2, 0x7] + asrs r0, r6 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0801231E + lsls r0, r6, 5 + adds r0, r2, r0 + ldrh r0, [r0, 0x18] + adds r4, r6, 0x3 + lsls r4, 24 + lsrs r4, 24 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, [r7] + adds r0, r5 + adds r0, 0x6 + movs r1, 0x6 + adds r2, r4, 0 + bl nullsub_5 + ldr r0, [r7] + adds r0, r5 + adds r0, 0x15 + movs r1, 0x16 + adds r2, r4, 0 + bl nullsub_5 +_0801231E: + adds r5, 0x20 + adds r6, 0x1 + cmp r6, 0x3 + ble _080122E0 + movs r6, 0 + ldr r0, =gUnknown_03005000 + mov r8, r0 +_0801232C: + movs r5, 0 + adds r7, r6, 0x1 + lsls r0, r6, 3 + adds r2, r6, 0 + adds r2, 0xB + subs r0, r6 + lsls r0, 1 + mov r1, r8 + adds r1, 0x14 + adds r4, r0, r1 + lsls r6, r2, 24 +_08012342: + ldrb r0, [r4] + lsls r1, r5, 25 + lsrs r1, 24 + lsrs r2, r6, 24 + movs r3, 0x2 + bl nullsub_13 + adds r4, 0x1 + adds r5, 0x1 + cmp r5, 0xD + ble _08012342 + adds r6, r7, 0 + cmp r6, 0x3 + ble _0801232C + ldr r0, =gUnknown_082ED868 + movs r1, 0x1 + movs r2, 0xF + bl nullsub_5 + b _080124AA + .pool +_08012378: + ldr r1, [r4] + ldrb r0, [r1, 0x2] + cmp r0, 0 + beq _08012414 + ldrb r0, [r1, 0x7] + cmp r0, 0 + beq _08012414 + movs r6, 0 + movs r5, 0xC0 + lsls r5, 18 +_0801238C: + lsrs r4, r5, 24 + movs r0, 0 + movs r1, 0x1 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, =gUnknown_082ED84B + movs r1, 0x6 + adds r2, r4, 0 + bl nullsub_5 + ldr r0, =gUnknown_082ED85B + movs r1, 0x16 + adds r2, r4, 0 + bl nullsub_5 + movs r1, 0x80 + lsls r1, 17 + adds r5, r1 + adds r6, 0x1 + cmp r6, 0x3 + ble _0801238C + ldr r5, =gUnknown_03007890 + ldr r1, [r5] + ldr r4, =gUnknown_03005000 + ldr r0, =0x00000c3e + adds r4, r0 + ldrb r0, [r4] + lsls r0, 5 + adds r1, r0 + ldrh r0, [r1, 0x18] + movs r1, 0x1 + movs r2, 0x3 + movs r3, 0x4 + bl nullsub_13 + ldrb r1, [r4] + lsls r1, 5 + adds r1, 0x14 + ldr r0, [r5] + adds r0, r1 + adds r0, 0x6 + movs r1, 0x6 + movs r2, 0x3 + bl nullsub_5 + ldrb r1, [r4] + lsls r1, 5 + adds r1, 0x14 + ldr r0, [r5] + adds r0, r1 + adds r0, 0x15 + movs r1, 0x16 + movs r2, 0x3 + bl nullsub_5 + b _080124AA + .pool +_08012414: + movs r6, 0 + ldr r1, =gUnknown_03007890 + ldr r0, [r1] + ldrb r0, [r0, 0x8] + cmp r6, r0 + bge _08012470 + adds r7, r1, 0 + movs r1, 0x14 + mov r8, r1 +_08012426: + ldr r0, [r7] + lsls r5, r6, 5 + adds r1, r0, r5 + ldrb r0, [r1, 0x16] + cmp r0, 0xFF + beq _08012462 + ldrh r0, [r1, 0x18] + adds r4, r6, 0x3 + lsls r4, 24 + lsrs r4, 24 + movs r1, 0x1 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, [r7] + adds r0, r5 + ldrh r0, [r0, 0x14] + movs r1, 0x6 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, [r7] + add r0, r8 + adds r0, 0x15 + movs r1, 0x16 + adds r2, r4, 0 + bl nullsub_5 +_08012462: + movs r0, 0x20 + add r8, r0 + adds r6, 0x1 + ldr r0, [r7] + ldrb r0, [r0, 0x8] + cmp r6, r0 + blt _08012426 +_08012470: + cmp r6, 0x3 + bgt _080124AA + lsls r0, r6, 24 + movs r1, 0xC0 + lsls r1, 18 + adds r5, r0, r1 +_0801247C: + lsrs r4, r5, 24 + movs r0, 0 + movs r1, 0x1 + adds r2, r4, 0 + movs r3, 0x4 + bl nullsub_13 + ldr r0, =gUnknown_082ED84B + movs r1, 0x6 + adds r2, r4, 0 + bl nullsub_5 + ldr r0, =gUnknown_082ED85B + movs r1, 0x16 + adds r2, r4, 0 + bl nullsub_5 + movs r0, 0x80 + lsls r0, 17 + adds r5, r0 + adds r6, 0x1 + cmp r6, 0x3 + ble _0801247C +_080124AA: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_801229C + + thumb_func_start sub_80124C0 +sub_80124C0: @ 80124C0 + ldr r0, =gUnknown_03005000 + ldr r1, =0x00000c1a + adds r0, r1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_80124C0 + + thumb_func_start sub_80124D4 +sub_80124D4: @ 80124D4 + ldr r0, =gUnknown_03005000 + ldr r1, =0x000009e6 + adds r0, r1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_80124D4 + .align 2, 0 @ don't pad with nop diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index e429ae6af..5a7c8f77e 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -5,869 +5,6 @@ .text - thumb_func_start sub_8011DC0 -sub_8011DC0: @ 8011DC0 - push {lr} - lsls r1, 16 - lsrs r1, 16 - bl sub_8011CE4 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - beq _08011DDA - movs r0, 0x1 - lsls r0, r1 - bl sub_8011D6C -_08011DDA: - pop {r0} - bx r0 - thumb_func_end sub_8011DC0 - - thumb_func_start sub_8011DE0 -sub_8011DE0: @ 8011DE0 - push {r4-r6,lr} - adds r4, r0, 0 - cmp r4, 0 - beq _08011E20 - movs r3, 0 - movs r2, 0 - ldr r5, =gUnknown_03005CDE - adds r6, r5, 0x4 -_08011DF0: - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, r4 - bne _08011E0E - ldrb r0, [r6] - asrs r0, r2 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08011E0E - adds r0, r1, 0 - lsls r0, r2 - orrs r3, r0 - lsls r0, r3, 24 - lsrs r3, r0, 24 -_08011E0E: - adds r2, 0x1 - cmp r2, 0x3 - ble _08011DF0 - cmp r3, 0 - beq _08011E20 - adds r0, r3, 0 - movs r1, 0x2 - bl sub_8011E94 -_08011E20: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011DE0 - - thumb_func_start sub_8011E2C -sub_8011E2C: @ 8011E2C - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r6, =gSendCmd - ldrh r0, [r6] - cmp r0, 0 - bne _08011E7A - ldr r5, =gUnknown_03005000 - ldr r1, =0x00000ce8 - adds r0, r5, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08011E7A - movs r0, 0xED - lsls r0, 8 - bl sub_800FD14 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - strh r1, [r6, 0x2] - ldrh r1, [r0, 0xA] - strh r1, [r6, 0x4] - ldr r1, =gUnknown_082ED695 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r0, r1 - ldrb r1, [r5, 0xD] - ldrb r0, [r0] - subs r1, r0 - strb r1, [r5, 0xD] - ldrb r0, [r5, 0xD] - strh r0, [r6, 0x6] - adds r0, r4, 0 - bl DestroyTask -_08011E7A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011E2C - - thumb_func_start sub_8011E94 -sub_8011E94: @ 8011E94 - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - ldr r5, =sub_8011E2C - adds r0, r5, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _08011ECC - adds r0, r5, 0 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - b _08011EDC - .pool -_08011ECC: - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - orrs r4, r0 - strh r4, [r1, 0x8] -_08011EDC: - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r6, [r0, 0xA] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011E94 - - thumb_func_start sub_8011EF4 -sub_8011EF4: @ 8011EF4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_800EE94 - lsls r0, 24 - cmp r0, 0 - beq _08011FA4 - adds r0, r4, 0 - adds r0, 0x10 - bl sub_8011CD8 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl sub_8011CE4 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _08011F8C - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - lsls r1, r2, 5 - adds r0, r1 - ldrb r0, [r0, 0x16] - cmp r0, 0xFF - beq _08011F5C - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000c3d - adds r0, r1 - strb r2, [r0] - bl sub_800EEBC - cmp r0, 0 - beq _08011FAA - b _08011F84 - .pool -_08011F5C: - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r5, 0x7F - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0x15 - beq _08011FA4 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0x16 - beq _08011FA4 - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 -_08011F84: - adds r0, r6, 0 - bl DestroyTask - b _08011FAA -_08011F8C: - ldrh r0, [r4, 0x1E] - adds r0, 0x1 - strh r0, [r4, 0x1E] - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000c3d - adds r0, r1 - strb r2, [r0] - b _08011FAA - .pool -_08011FA4: - ldrh r0, [r4, 0x1E] - adds r0, 0x1 - strh r0, [r4, 0x1E] -_08011FAA: - movs r1, 0x1E - ldrsh r0, [r4, r1] - cmp r0, 0xF0 - ble _08011FC2 - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 - adds r0, r6, 0 - bl DestroyTask -_08011FC2: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8011EF4 - - thumb_func_start sub_8011FC8 -sub_8011FC8: @ 8011FC8 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r5, r1, 16 - lsrs r5, 16 - ldr r0, =gUnknown_03005000 - adds r0, 0xF1 - movs r1, 0 - strb r1, [r0] - ldr r0, =sub_8011EF4 - movs r1, 0x3 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - adds r0, r4, 0 - adds r1, r6, 0 - bl StringCopy - strh r5, [r4, 0x10] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011FC8 - - thumb_func_start sub_801200C -sub_801200C: @ 801200C - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 16 - lsrs r5, r0, 16 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r2, 0x7F - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0x45 - bne _08012032 - ldrb r1, [r4, 0xA] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0x45 - beq _08012092 -_0801202E: - movs r0, 0x1 - b _08012094 -_08012032: - ldrb r1, [r4, 0xA] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0x40 - bne _0801202E - cmp r5, 0x44 - bne _08012092 - ldr r5, =gUnknown_0300510A - ldrh r0, [r5, 0x8] - ldr r3, =0x000003ff - adds r2, r3, 0 - ands r2, r0 - movs r0, 0xCE - lsls r0, 1 - cmp r2, r0 - bne _08012068 - ldrh r1, [r4, 0x8] - adds r0, r3, 0 - ands r0, r1 - cmp r0, r2 - beq _08012092 - b _0801202E - .pool -_08012068: - ldrh r1, [r4, 0x8] - adds r0, r3, 0 - ands r0, r1 - cmp r0, r2 - bne _0801202E - ldrb r2, [r4, 0xB] - movs r0, 0xFE - ldrb r3, [r5, 0xB] - adds r1, r0, 0 - ands r1, r2 - ands r0, r3 - cmp r1, r0 - bne _0801202E - ldrb r2, [r4, 0x9] - movs r0, 0xFC - ldrb r3, [r5, 0x9] - adds r1, r0, 0 - ands r1, r2 - ands r0, r3 - cmp r1, r0 - bne _0801202E -_08012092: - movs r0, 0 -_08012094: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801200C - - thumb_func_start sub_801209C -sub_801209C: @ 801209C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - mov r8, r5 - ldr r6, =gUnknown_03005000 - adds r0, r6, 0 - adds r0, 0xF1 - ldrb r0, [r0] - cmp r0, 0x4 - bne _080120BA - adds r0, r5, 0 - bl DestroyTask -_080120BA: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - lsls r0, 16 - movs r1, 0x96 - lsls r1, 17 - cmp r0, r1 - ble _080120E4 - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 - adds r0, r5, 0 - bl DestroyTask -_080120E4: - ldr r1, =0x00000ccd - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0801217C - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x6] - cmp r0, 0 - bne _0801217C - movs r2, 0x86 - lsls r2, 1 - adds r0, r6, r2 - bl sub_8011CD8 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldr r2, =0x00000119 - adds r0, r6, r2 - bl sub_8011CE4 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _0801217C - movs r1, 0xA - ldrsh r0, [r4, r1] - ldr r7, =gUnknown_03007890 - lsls r4, r2, 5 - adds r2, r4, 0 - adds r2, 0x14 - ldr r1, [r7] - adds r1, r2 - adds r1, 0x6 - bl sub_801200C - cmp r0, 0 - bne _0801216C - ldr r0, [r7] - adds r1, r0, r4 - ldrb r0, [r1, 0x16] - cmp r0, 0xFF - beq _0801217C - ldrh r0, [r1, 0x14] - movs r1, 0x5A - bl sub_800C12C - lsls r0, 24 - cmp r0, 0 - bne _0801217C - movs r0, 0xA - strh r0, [r6, 0x4] - adds r0, r5, 0 - bl DestroyTask - b _0801217C - .pool -_0801216C: - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 - mov r0, r8 - bl DestroyTask -_0801217C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801209C - - thumb_func_start sub_8012188 -sub_8012188: @ 8012188 - push {r4-r7,lr} - adds r3, r0, 0 - adds r5, r1, 0 - lsls r4, r2, 24 - lsrs r4, 24 - ldr r6, =gUnknown_03005000 - ldr r1, =0x00000ccf - adds r0, r6, r1 - movs r7, 0 - strb r7, [r0] - adds r0, r6, 0 - adds r0, 0xF1 - strb r7, [r0] - ldr r1, =0x00000119 - adds r0, r6, r1 - adds r1, r3, 0 - bl StringCopy - movs r1, 0x85 - lsls r1, 1 - adds r0, r6, r1 - adds r1, r5, 0 - movs r2, 0xD - bl memcpy - bl sub_800D658 - ldr r0, =sub_801209C - movs r1, 0x2 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - strh r4, [r1, 0xA] - ldr r0, =sub_800EB44 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r1, r0, 24 - adds r2, r1, 0 - cmp r4, 0x45 - bne _08012210 - cmp r1, 0xFF - beq _0801221E - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - movs r1, 0x1 - strh r1, [r0, 0x16] - b _0801221E - .pool -_08012210: - cmp r2, 0xFF - beq _0801221E - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r5 - strh r7, [r0, 0x16] -_0801221E: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8012188 - - thumb_func_start sub_8012224 -sub_8012224: @ 8012224 - push {lr} - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08012238 - movs r0, 0 - b _0801223A - .pool -_08012238: - movs r0, 0x1 -_0801223A: - pop {r1} - bx r1 - thumb_func_end sub_8012224 - - thumb_func_start sub_8012240 -sub_8012240: @ 8012240 - push {r4,lr} - movs r1, 0 - ldr r0, =gUnknown_03004140 - ldrb r2, [r0] - ldr r4, =gUnknown_03005CD1 - movs r3, 0x1 -_0801224C: - adds r0, r2, 0 - asrs r0, r1 - ands r0, r3 - cmp r0, 0 - beq _0801226C - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _0801226C - movs r0, 0 - b _08012274 - .pool -_0801226C: - adds r1, 0x1 - cmp r1, 0x3 - ble _0801224C - movs r0, 0x1 -_08012274: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8012240 - - thumb_func_start sub_801227C -sub_801227C: @ 801227C - push {r4,lr} - movs r4, 0 -_08012280: - lsls r2, r4, 24 - lsrs r2, 24 - ldr r0, =gUnknown_082ED82C - movs r1, 0 - bl nullsub_5 - adds r4, 0x1 - cmp r4, 0x13 - ble _08012280 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801227C - - thumb_func_start sub_801229C -sub_801229C: @ 801229C - push {r4-r7,lr} - mov r7, r8 - push {r7} - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1C - movs r2, 0x13 - movs r3, 0x2 - bl nullsub_13 - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0, 0x2] - movs r1, 0x14 - movs r2, 0x1 - movs r3, 0x1 - bl nullsub_13 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - movs r1, 0x17 - movs r2, 0x1 - movs r3, 0x1 - bl nullsub_13 - ldr r0, =gUnknown_03005000 - ldrb r0, [r0, 0xC] - cmp r0, 0x1 - bne _08012378 - movs r6, 0 - adds r7, r4, 0 - movs r5, 0x14 -_080122E0: - ldr r2, [r7] - ldrb r0, [r2, 0x7] - asrs r0, r6 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801231E - lsls r0, r6, 5 - adds r0, r2, r0 - ldrh r0, [r0, 0x18] - adds r4, r6, 0x3 - lsls r4, 24 - lsrs r4, 24 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - adds r0, r5 - adds r0, 0x6 - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, [r7] - adds r0, r5 - adds r0, 0x15 - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 -_0801231E: - adds r5, 0x20 - adds r6, 0x1 - cmp r6, 0x3 - ble _080122E0 - movs r6, 0 - ldr r0, =gUnknown_03005000 - mov r8, r0 -_0801232C: - movs r5, 0 - adds r7, r6, 0x1 - lsls r0, r6, 3 - adds r2, r6, 0 - adds r2, 0xB - subs r0, r6 - lsls r0, 1 - mov r1, r8 - adds r1, 0x14 - adds r4, r0, r1 - lsls r6, r2, 24 -_08012342: - ldrb r0, [r4] - lsls r1, r5, 25 - lsrs r1, 24 - lsrs r2, r6, 24 - movs r3, 0x2 - bl nullsub_13 - adds r4, 0x1 - adds r5, 0x1 - cmp r5, 0xD - ble _08012342 - adds r6, r7, 0 - cmp r6, 0x3 - ble _0801232C - ldr r0, =gUnknown_082ED868 - movs r1, 0x1 - movs r2, 0xF - bl nullsub_5 - b _080124AA - .pool -_08012378: - ldr r1, [r4] - ldrb r0, [r1, 0x2] - cmp r0, 0 - beq _08012414 - ldrb r0, [r1, 0x7] - cmp r0, 0 - beq _08012414 - movs r6, 0 - movs r5, 0xC0 - lsls r5, 18 -_0801238C: - lsrs r4, r5, 24 - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, =gUnknown_082ED84B - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, =gUnknown_082ED85B - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 - movs r1, 0x80 - lsls r1, 17 - adds r5, r1 - adds r6, 0x1 - cmp r6, 0x3 - ble _0801238C - ldr r5, =gUnknown_03007890 - ldr r1, [r5] - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r4, r0 - ldrb r0, [r4] - lsls r0, 5 - adds r1, r0 - ldrh r0, [r1, 0x18] - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x4 - bl nullsub_13 - ldrb r1, [r4] - lsls r1, 5 - adds r1, 0x14 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x6 - movs r1, 0x6 - movs r2, 0x3 - bl nullsub_5 - ldrb r1, [r4] - lsls r1, 5 - adds r1, 0x14 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x15 - movs r1, 0x16 - movs r2, 0x3 - bl nullsub_5 - b _080124AA - .pool -_08012414: - movs r6, 0 - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - cmp r6, r0 - bge _08012470 - adds r7, r1, 0 - movs r1, 0x14 - mov r8, r1 -_08012426: - ldr r0, [r7] - lsls r5, r6, 5 - adds r1, r0, r5 - ldrb r0, [r1, 0x16] - cmp r0, 0xFF - beq _08012462 - ldrh r0, [r1, 0x18] - adds r4, r6, 0x3 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - adds r0, r5 - ldrh r0, [r0, 0x14] - movs r1, 0x6 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - add r0, r8 - adds r0, 0x15 - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 -_08012462: - movs r0, 0x20 - add r8, r0 - adds r6, 0x1 - ldr r0, [r7] - ldrb r0, [r0, 0x8] - cmp r6, r0 - blt _08012426 -_08012470: - cmp r6, 0x3 - bgt _080124AA - lsls r0, r6, 24 - movs r1, 0xC0 - lsls r1, 18 - adds r5, r0, r1 -_0801247C: - lsrs r4, r5, 24 - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, =gUnknown_082ED84B - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, =gUnknown_082ED85B - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 - movs r0, 0x80 - lsls r0, 17 - adds r5, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0801247C -_080124AA: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801229C - - thumb_func_start sub_80124C0 -sub_80124C0: @ 80124C0 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000c1a - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80124C0 - - thumb_func_start sub_80124D4 -sub_80124D4: @ 80124D4 - ldr r0, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80124D4 - thumb_func_start nullsub_89 nullsub_89: @ 80124E8 bx lr diff --git a/src/link.c b/src/link.c index d5fc890ca..5ed05f50f 100644 --- a/src/link.c +++ b/src/link.c @@ -57,14 +57,6 @@ IWRAM_DATA u16 gUnknown_03000D70; IWRAM_DATA u8 gUnknown_03000D72; IWRAM_DATA u8 gUnknown_03000D73; IWRAM_DATA u8 gUnknown_03000D74; -ALIGNED() IWRAM_DATA u8 gUnknown_03000D78; -ALIGNED(8) IWRAM_DATA u8 gUnknown_03000D80[16]; -IWRAM_DATA u16 gUnknown_03000D90[8]; -IWRAM_DATA u32 gUnknown_03000DA0; -IWRAM_DATA u32 gUnknown_03000DA4; -IWRAM_DATA void *gUnknown_03000DA8; -IWRAM_DATA void *gUnknown_03000DAC; -IWRAM_DATA bool32 gUnknown_03000DB0; u16 gUnknown_03003020[6]; u32 gLinkDebugSeed; diff --git a/src/link_rfu.c b/src/link_rfu.c new file mode 100644 index 000000000..43169a275 --- /dev/null +++ b/src/link_rfu.c @@ -0,0 +1,16 @@ + +// Includes +#include "global.h" + +// Static type declarations + +// Static RAM declarations +IWRAM_DATA u8 gUnknown_03000D78[8]; +IWRAM_DATA u8 gUnknown_03000D80[16]; +IWRAM_DATA u16 gUnknown_03000D90[8]; + +// Static ROM declarations + +// .rodata + +// .text diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c new file mode 100644 index 000000000..9076b611a --- /dev/null +++ b/src/rom_8011DC0.c @@ -0,0 +1,18 @@ + +// Includes +#include "global.h" + +// Static type declarations + +// Static RAM declarations +IWRAM_DATA u32 gUnknown_03000DA0; +IWRAM_DATA u32 gUnknown_03000DA4; +IWRAM_DATA void *gUnknown_03000DA8; +IWRAM_DATA void *gUnknown_03000DAC; +IWRAM_DATA bool32 gUnknown_03000DB0; + +// Static ROM declarations + +// .rodata + +// .text diff --git a/sym_bss.txt b/sym_bss.txt index db7495182..ab01d89bc 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -6,6 +6,8 @@ .include "src/text.o" .include "src/sprite.o" .include "src/link.o" + .include "src/link_rfu.o" + .include "src/rom_8011DC0.o" .include "src/rtc.o" .include "src/main_menu.o" .include "src/battle_1.o" From d0578ca9e0c144a8e2c32d874be2d48af65f4403 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 11 Nov 2017 09:56:47 -0500 Subject: [PATCH 030/123] through sub_800AA54 --- asm/link.s | 101 ----------------------------------------------------- src/link.c | 48 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 101 deletions(-) diff --git a/asm/link.s b/asm/link.s index 9c921b4d5..60d1c9a8f 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,107 +5,6 @@ .text - thumb_func_start sub_800A9A8 -sub_800A9A8: @ 800A9A8 - push {r4,lr} - movs r1, 0 - movs r2, 0 - ldr r0, =gUnknown_03003100 - ldrb r0, [r0] - cmp r1, r0 - bge _0800A9CA - movs r4, 0x1 - adds r3, r0, 0 -_0800A9BA: - adds r0, r4, 0 - lsls r0, r2 - orrs r1, r0 - lsls r0, r1, 24 - lsrs r1, r0, 24 - adds r2, 0x1 - cmp r2, r3 - blt _0800A9BA -_0800A9CA: - adds r0, r1, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800A9A8 - - thumb_func_start sub_800A9D8 -sub_800A9D8: @ 800A9D8 - push {r4-r6,lr} - movs r4, 0 - movs r5, 0 - movs r6, 0x1 - b _0800A9EE -_0800A9E2: - adds r0, r6, 0 - lsls r0, r5 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 - adds r5, 0x1 -_0800A9EE: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - blt _0800A9E2 - adds r0, r4, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_800A9D8 - - thumb_func_start sub_800AA04 -sub_800AA04: @ 800AA04 - push {r4-r7,lr} - ldr r1, =gUnknown_03003100 - strb r0, [r1] - bl GetMultiplayerId - ldr r1, =gUnknown_03003120 - strb r0, [r1] - ldr r4, =gLinkPlayers - ldr r3, =gUnknown_02022A74 - movs r2, 0x4 -_0800AA18: - adds r0, r3, 0 - adds r1, r4, 0 - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldr r1, [r1] - str r1, [r0] - adds r4, 0x1C - adds r3, 0x1C - subs r2, 0x1 - cmp r2, 0 - bge _0800AA18 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AA04 - - thumb_func_start sub_800AA48 -sub_800AA48: @ 800AA48 - ldr r0, =gUnknown_03003100 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800AA48 - - thumb_func_start sub_800AA54 -sub_800AA54: @ 800AA54 - ldr r0, =gUnknown_03003120 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800AA54 - thumb_func_start sub_800AA60 sub_800AA60: @ 800AA60 push {r4-r7,lr} diff --git a/src/link.c b/src/link.c index 5ed05f50f..d6bb7bd7d 100644 --- a/src/link.c +++ b/src/link.c @@ -1250,3 +1250,51 @@ void SetLinkDebugValues(u32 seed, u32 flags) gLinkDebugSeed = seed; gLinkDebugFlags = flags; } + +u8 sub_800A9A8(void) +{ + int i; + u8 flags; + + flags = 0; + for (i = 0; i < gUnknown_03003100; i ++) + { + flags |= (1 << i); + } + return flags; +} + +u8 sub_800A9D8(void) +{ + int i; + u8 flags; + + flags = 0; + for (i = 0; i < GetLinkPlayerCount(); i ++) + { + flags |= (1 << i); + } + return flags; +} + +void sub_800AA04(u8 a0) +{ + int i; + + gUnknown_03003100 = a0; + gUnknown_03003120 = GetMultiplayerId(); + for (i = 0; i < MAX_RFU_PLAYERS; i ++) + { + gUnknown_02022A74[i] = gLinkPlayers[i]; + } +} + +u8 sub_800AA48(void) +{ + return gUnknown_03003100; +} + +u8 sub_800AA54(void) +{ + return gUnknown_03003120; +} From 2e95c5575fb53107501f1a9a950d453048297148 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 20:57:21 -0500 Subject: [PATCH 031/123] sub_800AA60 --- asm/link.s | 83 +++----------------------------------------- common_syms/link.txt | 2 +- include/link.h | 2 +- src/link.c | 45 ++++++++++++++++++++---- 4 files changed, 46 insertions(+), 86 deletions(-) diff --git a/asm/link.s b/asm/link.s index 60d1c9a8f..0d97ed0ca 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,83 +5,10 @@ .text - thumb_func_start sub_800AA60 -sub_800AA60: @ 800AA60 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r3, 0 - ldr r0, =gUnknown_03003100 - ldrb r1, [r0] - mov r9, r0 - cmp r3, r1 - bge _0800AAB4 - ldr r0, =gLinkPlayers - mov r12, r0 - ldr r0, =gUnknown_02022A74 - ldr r2, =0x00002288 - mov r8, r2 - ldr r7, =gLinkType - mov r6, r12 - adds r6, 0x14 - adds r5, r0, 0x4 - movs r4, 0 - adds r2, r1, 0 -_0800AA8A: - mov r0, r12 - adds r0, 0x4 - adds r0, r4, r0 - ldr r1, [r0] - ldr r0, [r5] - cmp r1, r0 - bne _0800AAA8 - ldrh r0, [r7] - cmp r0, r8 - bne _0800AAA6 - adds r1, r0, 0 - ldr r0, [r6] - cmp r1, r0 - bne _0800AAA8 -_0800AAA6: - adds r3, 0x1 -_0800AAA8: - adds r6, 0x1C - adds r5, 0x1C - adds r4, 0x1C - subs r2, 0x1 - cmp r2, 0 - bne _0800AA8A -_0800AAB4: - mov r0, r9 - ldrb r0, [r0] - cmp r3, r0 - bne _0800AAE4 - bl sub_800ABAC - lsls r0, 24 - lsrs r0, 24 - mov r1, r9 - ldrb r1, [r1] - cmp r0, r1 - bne _0800AAE4 - movs r0, 0x1 - b _0800AAE6 - .pool -_0800AAE4: - movs r0, 0 -_0800AAE6: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800AA60 - thumb_func_start sub_800AAF4 sub_800AAF4: @ 800AAF4 push {r4,r5,lr} - ldr r5, =gUnknown_02022A74 + ldr r5, =gSavedLinkPlayers movs r4, 0x3 _0800AAFA: adds r0, r5, 0 @@ -104,11 +31,11 @@ sub_800AB18: @ 800AB18 mov r7, r8 push {r7} movs r4, 0 - ldr r0, =gUnknown_03003100 + ldr r0, =gSavedLinkPlayerCount ldrb r0, [r0] cmp r4, r0 bcs _0800AB78 - ldr r6, =gUnknown_02022A74 + ldr r6, =gSavedLinkPlayers ldr r5, =gLinkPlayers movs r0, 0x8 adds r0, r6 @@ -144,7 +71,7 @@ _0800AB6A: adds r0, r4, 0x1 lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_03003100 + ldr r0, =gSavedLinkPlayerCount ldrb r0, [r0] cmp r4, r0 bcc _0800AB36 @@ -159,7 +86,7 @@ _0800AB78: thumb_func_start sub_800AB98 sub_800AB98: @ 800AB98 - ldr r0, =gUnknown_03003100 + ldr r0, =gSavedLinkPlayerCount movs r1, 0 strb r1, [r0] ldr r0, =gUnknown_03003120 diff --git a/common_syms/link.txt b/common_syms/link.txt index 150e93e88..7ac33a869 100644 --- a/common_syms/link.txt +++ b/common_syms/link.txt @@ -17,7 +17,7 @@ gUnknown_030030F0 gUnknown_030030F4 gSuppressLinkErrorMessage gSerialIsRFU -gUnknown_03003100 +gSavedLinkPlayerCount gSendCmd gUnknown_03003120 gReceivedRemoteLinkPlayers diff --git a/include/link.h b/include/link.h index 283e13aa1..6231dd9e4 100644 --- a/include/link.h +++ b/include/link.h @@ -233,7 +233,7 @@ extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; extern u16 gUnknown_030030F4; extern u8 gSuppressLinkErrorMessage; extern bool8 gSerialIsRFU; -extern bool8 gUnknown_03003100; +extern bool8 gSavedLinkPlayerCount; extern u8 gUnknown_03003120; extern struct LinkTestBGInfo gLinkTestBGInfo; extern void (*gLinkCallback)(void); diff --git a/src/link.c b/src/link.c index d6bb7bd7d..1ccfb5158 100644 --- a/src/link.c +++ b/src/link.c @@ -77,7 +77,7 @@ u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; u16 gUnknown_030030F4; u8 gSuppressLinkErrorMessage; bool8 gSerialIsRFU; -bool8 gUnknown_03003100; +bool8 gSavedLinkPlayerCount; u16 gSendCmd[8]; u8 gUnknown_03003120; bool8 gReceivedRemoteLinkPlayers; @@ -106,7 +106,7 @@ EWRAM_DATA u16 gLinkType = 0; EWRAM_DATA u16 gLinkTimeOutCounter = 0; EWRAM_DATA struct LinkPlayer gLocalLinkPlayer = {}; EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {}; -EWRAM_DATA struct LinkPlayer gUnknown_02022A74[MAX_RFU_PLAYERS] = {}; +EWRAM_DATA struct LinkPlayer gSavedLinkPlayers[MAX_RFU_PLAYERS] = {}; // Static ROM declarations @@ -1257,7 +1257,7 @@ u8 sub_800A9A8(void) u8 flags; flags = 0; - for (i = 0; i < gUnknown_03003100; i ++) + for (i = 0; i < gSavedLinkPlayerCount; i ++) { flags |= (1 << i); } @@ -1281,20 +1281,53 @@ void sub_800AA04(u8 a0) { int i; - gUnknown_03003100 = a0; + gSavedLinkPlayerCount = a0; gUnknown_03003120 = GetMultiplayerId(); for (i = 0; i < MAX_RFU_PLAYERS; i ++) { - gUnknown_02022A74[i] = gLinkPlayers[i]; + gSavedLinkPlayers[i] = gLinkPlayers[i]; } } u8 sub_800AA48(void) { - return gUnknown_03003100; + return gSavedLinkPlayerCount; } u8 sub_800AA54(void) { return gUnknown_03003120; } + +bool8 sub_800AA60(void) +{ + int i; + unsigned count; + + count = 0; + for (i = 0; i < gSavedLinkPlayerCount; i ++) + { + if (gLinkPlayers[i].trainerId == gSavedLinkPlayers[i].trainerId) + { + if (gLinkType == 0x2288) + { + if (gLinkType == gLinkPlayers[i].linkType) + { + count ++; + } + } + else + { + count ++; + } + } + } + if (count == gSavedLinkPlayerCount) + { + if (sub_800ABAC() == gSavedLinkPlayerCount) + { + return TRUE; + } + } + return FALSE; +} From 5ec0fc9aa0b62ee15bf7fea44371f928ed222371 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 21:26:11 -0500 Subject: [PATCH 032/123] sub_800AB18 --- asm/link.s | 79 ------------------------------------------------------ src/link.c | 26 ++++++++++++++++++ 2 files changed, 26 insertions(+), 79 deletions(-) diff --git a/asm/link.s b/asm/link.s index 0d97ed0ca..70fd1fede 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,85 +5,6 @@ .text - thumb_func_start sub_800AAF4 -sub_800AAF4: @ 800AAF4 - push {r4,r5,lr} - ldr r5, =gSavedLinkPlayers - movs r4, 0x3 -_0800AAFA: - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x1C - bl CpuSet - adds r5, 0x1C - subs r4, 0x1 - cmp r4, 0 - bge _0800AAFA - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AAF4 - - thumb_func_start sub_800AB18 -sub_800AB18: @ 800AB18 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r4, 0 - ldr r0, =gSavedLinkPlayerCount - ldrb r0, [r0] - cmp r4, r0 - bcs _0800AB78 - ldr r6, =gSavedLinkPlayers - ldr r5, =gLinkPlayers - movs r0, 0x8 - adds r0, r6 - mov r8, r0 - adds r7, r5, 0 - adds r7, 0x8 -_0800AB36: - lsls r0, r4, 3 - subs r0, r4 - lsls r2, r0, 2 - adds r1, r6, 0x4 - adds r1, r2, r1 - adds r0, r5, 0x4 - adds r0, r2, r0 - ldr r1, [r1] - ldr r0, [r0] - cmp r1, r0 - bne _0800AB5A - mov r1, r8 - adds r0, r2, r1 - adds r1, r2, r7 - bl StringCompare - cmp r0, 0 - beq _0800AB6A -_0800AB5A: - ldr r1, =gLinkErrorOccurred - movs r0, 0x1 - strb r0, [r1] - bl CloseLink - ldr r0, =CB2_LinkError - bl SetMainCallback2 -_0800AB6A: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSavedLinkPlayerCount - ldrb r0, [r0] - cmp r4, r0 - bcc _0800AB36 -_0800AB78: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AB18 - thumb_func_start sub_800AB98 sub_800AB98: @ 800AB98 ldr r0, =gSavedLinkPlayerCount diff --git a/src/link.c b/src/link.c index 1ccfb5158..5ca08dd27 100644 --- a/src/link.c +++ b/src/link.c @@ -1331,3 +1331,29 @@ bool8 sub_800AA60(void) } return FALSE; } + +void sub_800AAF4(void) +{ + int i; + + // Clearly not what was meant to be written, but here it is anyway. + for (i = 0; i < 4; i ++) + { + CpuSet(&gSavedLinkPlayers[i], NULL, sizeof(struct LinkPlayer)); + } +} + +void sub_800AB18(void) +{ + u8 i; + + for (i = 0; i < gSavedLinkPlayerCount; i ++) + { + if (gSavedLinkPlayers[i].trainerId != gLinkPlayers[i].trainerId || StringCompare(gSavedLinkPlayers[i].name, gLinkPlayers[i].name) != 0) + { + gLinkErrorOccurred = TRUE; + CloseLink(); + SetMainCallback2(CB2_LinkError); + } + } +} From b346bac98b9328ad2da85e89b885ea09f247e98d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 21:31:08 -0500 Subject: [PATCH 033/123] through GetLinkPlayerCount_2 --- asm/cable_club.s | 20 ++++++++++---------- asm/link.s | 22 ---------------------- asm/mystery_event_menu.s | 2 +- asm/pokenav.s | 8 ++++---- asm/record_mixing.s | 10 +++++----- asm/trade.s | 4 ++-- common_syms/link.txt | 2 +- include/link.h | 3 +-- src/battle_controllers.c | 2 +- src/link.c | 23 +++++++++++++++++------ 10 files changed, 42 insertions(+), 54 deletions(-) diff --git a/asm/cable_club.s b/asm/cable_club.s index df8e248ad..e00866a1c 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -178,7 +178,7 @@ _080B24C8: b _080B24F2 _080B24CC: ldr r4, =gStringVar1 - bl sub_800ABAC + bl GetLinkPlayerCount_2 adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -404,7 +404,7 @@ sub_80B2688: @ 80B2688 push {r4,r5,lr} lsls r0, 24 lsrs r4, r0, 24 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r5, r0, 24 adds r0, r4, 0 @@ -506,7 +506,7 @@ sub_80B275C: @ 80B275C mov r9, r0 mov r7, r8 add r7, r9 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r5, r0, 24 adds r0, r4, 0 @@ -585,7 +585,7 @@ sub_80B2804: @ 80B2804 bne _080B2898 bl sub_800AA48 adds r4, r0, 0 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r4, 24 lsls r0, 24 cmp r4, r0 @@ -652,7 +652,7 @@ sub_80B28A8: @ 80B28A8 lsrs r0, 24 cmp r0, 0x1 beq _080B290A - bl sub_800ABAC + bl GetLinkPlayerCount_2 adds r4, r0, 0 bl sub_800AA48 lsls r4, 24 @@ -735,7 +735,7 @@ _080B2984: b _080B29E4 .pool _080B2994: - bl sub_800ABAC + bl GetLinkPlayerCount_2 ldr r4, =gUnknown_03005DB8 strb r0, [r4] bl GetMultiplayerId @@ -825,7 +825,7 @@ _080B2A4E: b _080B2ACE .pool _080B2A6C: - bl sub_800ABAC + bl GetLinkPlayerCount_2 ldr r4, =gUnknown_03005DB8 strb r0, [r4] bl GetMultiplayerId @@ -1640,7 +1640,7 @@ sub_80B3194: @ 80B3194 lsls r0, 24 lsrs r4, r0, 24 adds r5, r4, 0 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -1681,7 +1681,7 @@ sub_80B31E8: @ 80B31E8 lsrs r5, r0, 24 bl sub_800AA48 adds r4, r0, 0 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r4, 24 lsls r0, 24 cmp r4, r0 @@ -2779,7 +2779,7 @@ _080B3B54: strh r0, [r5, 0x2] b _080B3B96 _080B3B68: - bl sub_800ABAC + bl GetLinkPlayerCount_2 adds r4, r0, 0 bl sub_800AA48 lsls r4, 24 diff --git a/asm/link.s b/asm/link.s index 70fd1fede..5c517544e 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,28 +5,6 @@ .text - thumb_func_start sub_800AB98 -sub_800AB98: @ 800AB98 - ldr r0, =gSavedLinkPlayerCount - movs r1, 0 - strb r1, [r0] - ldr r0, =gUnknown_03003120 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_800AB98 - - thumb_func_start sub_800ABAC -sub_800ABAC: @ 800ABAC - ldr r0, =gLinkStatus - ldr r0, [r0] - movs r1, 0x1C - ands r0, r1 - lsrs r0, 2 - bx lr - .pool - thumb_func_end sub_800ABAC - thumb_func_start sub_800ABBC sub_800ABBC: @ 800ABBC push {lr} diff --git a/asm/mystery_event_menu.s b/asm/mystery_event_menu.s index a1a90cd4d..ad9da463e 100644 --- a/asm/mystery_event_menu.s +++ b/asm/mystery_event_menu.s @@ -282,7 +282,7 @@ _08178BCC: _08178BDA: b _08178E34 _08178BDC: - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0x2 diff --git a/asm/pokenav.s b/asm/pokenav.s index 1ccb893af..414ca3672 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -28132,7 +28132,7 @@ sub_81D4EC0: @ 81D4EC0 lsls r0, 24 cmp r0, 0 beq _081D4EDC - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r0, 24 cmp r0, 0x2 @@ -28190,7 +28190,7 @@ _081D4F38: lsls r0, 24 cmp r0, 0 beq _081D4F88 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -28212,7 +28212,7 @@ _081D4F54: strb r0, [r4] b _081D500C _081D4F6C: - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r0, 24 cmp r0, 0x2 @@ -28506,7 +28506,7 @@ _081D51D0: b _081D535A .pool _081D51F4: - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 89507d3f3..9de2911ea 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -765,7 +765,7 @@ _080E73B0: movs r0, 0x65 b _080E7564 _080E73B8: - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r4, r0, 24 bl sub_800ABBC @@ -796,7 +796,7 @@ _080E73EA: _080E73F8: bl sub_800AA48 adds r4, r0, 0 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r4, 24 lsls r0, 24 cmp r4, r0 @@ -808,7 +808,7 @@ _080E740C: strh r4, [r5, 0x20] lsls r4, 16 asrs r4, 16 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r0, 24 lsls r1, r0, 4 @@ -824,7 +824,7 @@ _080E742A: _080E7432: bl sub_800AA48 adds r4, r0, 0 - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r4, 24 lsls r0, 24 cmp r4, r0 @@ -868,7 +868,7 @@ _080E746E: b _080E7564 .pool _080E7490: - bl sub_800ABAC + bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r0, 24 movs r1, 0 diff --git a/asm/trade.s b/asm/trade.s index c32fd4209..8235dc0df 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -464,7 +464,7 @@ _0807757A: b _08077B22 .pool _0807758C: - bl sub_800ABAC + bl GetLinkPlayerCount_2 adds r4, r0, 0 bl sub_800AA48 lsls r4, 24 @@ -7373,7 +7373,7 @@ _0807AFBC: bne _0807AFC8 b _0807B0DC _0807AFC8: - bl sub_800ABAC + bl GetLinkPlayerCount_2 adds r4, r0, 0 bl sub_800AA48 lsls r4, 24 diff --git a/common_syms/link.txt b/common_syms/link.txt index 7ac33a869..9b168d932 100644 --- a/common_syms/link.txt +++ b/common_syms/link.txt @@ -19,7 +19,7 @@ gSuppressLinkErrorMessage gSerialIsRFU gSavedLinkPlayerCount gSendCmd -gUnknown_03003120 +gSavedMultiplayerId gReceivedRemoteLinkPlayers gLinkTestBGInfo gLinkCallback diff --git a/include/link.h b/include/link.h index 6231dd9e4..605d32aec 100644 --- a/include/link.h +++ b/include/link.h @@ -205,7 +205,6 @@ void sub_800ADF8(void); void sub_800B488(void); void sub_800A620(void); void sub_8011BD0(void); -u8 sub_800ABAC(void); u8 sub_800ABBC(void); void sub_800AC34(void); @@ -234,7 +233,7 @@ extern u16 gUnknown_030030F4; extern u8 gSuppressLinkErrorMessage; extern bool8 gSerialIsRFU; extern bool8 gSavedLinkPlayerCount; -extern u8 gUnknown_03003120; +extern u8 gSavedMultiplayerId; extern struct LinkTestBGInfo gLinkTestBGInfo; extern void (*gLinkCallback)(void); extern bool8 gShouldAdvanceLinkState; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index ce96fff6a..431f5d97a 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -791,7 +791,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId) else var = (gBattleTypeFlags & BATTLE_TYPE_MULTI) ? 4 : 2; - if (sub_800ABAC() >= var) + if (GetLinkPlayerCount_2() >= var) { if (sub_800ABBC()) { diff --git a/src/link.c b/src/link.c index 5ca08dd27..d6cc1b5de 100644 --- a/src/link.c +++ b/src/link.c @@ -79,7 +79,7 @@ u8 gSuppressLinkErrorMessage; bool8 gSerialIsRFU; bool8 gSavedLinkPlayerCount; u16 gSendCmd[8]; -u8 gUnknown_03003120; +u8 gSavedMultiplayerId; bool8 gReceivedRemoteLinkPlayers; struct LinkTestBGInfo gLinkTestBGInfo; void (*gLinkCallback)(void); @@ -468,7 +468,7 @@ void HandleReceiveRemoteLinkPlayer(u8 who) count = 0; gUnknown_03003078[who] = FALSE; - for (i = 0; i < sub_800ABAC(); i ++) + for (i = 0; i < GetLinkPlayerCount_2(); i ++) { count += gUnknown_03003078[i]; } @@ -800,7 +800,7 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper) count = 0; if (gReceivedRemoteLinkPlayers == TRUE) { - cmpVal = sub_800ABAC(); + cmpVal = GetLinkPlayerCount_2(); if (lower > cmpVal || cmpVal > upper) { sPlayerDataExchangeStatus = EXCHANGE_STAT_6; @@ -1282,7 +1282,7 @@ void sub_800AA04(u8 a0) int i; gSavedLinkPlayerCount = a0; - gUnknown_03003120 = GetMultiplayerId(); + gSavedMultiplayerId = GetMultiplayerId(); for (i = 0; i < MAX_RFU_PLAYERS; i ++) { gSavedLinkPlayers[i] = gLinkPlayers[i]; @@ -1296,7 +1296,7 @@ u8 sub_800AA48(void) u8 sub_800AA54(void) { - return gUnknown_03003120; + return gSavedMultiplayerId; } bool8 sub_800AA60(void) @@ -1324,7 +1324,7 @@ bool8 sub_800AA60(void) } if (count == gSavedLinkPlayerCount) { - if (sub_800ABAC() == gSavedLinkPlayerCount) + if (GetLinkPlayerCount_2() == gSavedLinkPlayerCount) { return TRUE; } @@ -1357,3 +1357,14 @@ void sub_800AB18(void) } } } + +void sub_800AB98(void) +{ + gSavedLinkPlayerCount = 0; + gSavedMultiplayerId = 0; +} + +u8 GetLinkPlayerCount_2(void) +{ + return EXTRACT_PLAYER_COUNT(gLinkStatus); +} From ccf6599b4038a5a957576f7ab88027dd98c07dcf Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 22:09:11 -0500 Subject: [PATCH 034/123] sub_800AC34 --- asm/cable_club.s | 6 +-- asm/link.s | 94 ---------------------------------------- asm/link_rfu.s | 6 +-- asm/mystery_event_menu.s | 2 +- asm/pokenav.s | 4 +- asm/record_mixing.s | 2 +- asm/trade.s | 4 +- include/link.h | 2 +- include/link_rfu.h | 2 + src/battle_controllers.c | 2 +- src/link.c | 59 +++++++++++++++++++++++++ sym_ewram.txt | 9 ---- 12 files changed, 75 insertions(+), 117 deletions(-) diff --git a/asm/cable_club.s b/asm/cable_club.s index e00866a1c..5b4e77619 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -426,7 +426,7 @@ sub_80B2688: @ 80B2688 adds r4, r0, r1 movs r0, 0 strh r0, [r4, 0xE] - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -1645,7 +1645,7 @@ sub_80B3194: @ 80B3194 lsrs r0, 24 cmp r0, 0x1 bls _080B31DA - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -2786,7 +2786,7 @@ _080B3B68: lsls r0, 24 cmp r4, r0 bcc _080B3BB8 - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 cmp r0, 0 beq _080B3B96 diff --git a/asm/link.s b/asm/link.s index 5c517544e..63273c8b5 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,100 +5,6 @@ .text - thumb_func_start sub_800ABBC -sub_800ABBC: @ 800ABBC - push {lr} - ldr r0, =gSerialIsRFU - ldrb r0, [r0] - cmp r0, 0 - bne _0800ABDC - ldr r0, =gLinkStatus - ldr r0, [r0] - lsrs r0, 5 - movs r1, 0x1 - ands r0, r1 - b _0800ABE4 - .pool -_0800ABDC: - bl sub_8011AB0 - lsls r0, 24 - lsrs r0, 24 -_0800ABE4: - pop {r1} - bx r1 - thumb_func_end sub_800ABBC - - thumb_func_start sub_800ABE8 -sub_800ABE8: @ 800ABE8 - ldr r0, =gUnknown_03000D58 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800ABE8 - - thumb_func_start sub_800ABF4 -sub_800ABF4: @ 800ABF4 - push {lr} - lsls r0, 16 - lsrs r3, r0, 16 - ldr r0, =gSerialIsRFU - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800AC0C - bl task_add_05_task_del_08FA224_when_no_RfuFunc - b _0800AC20 - .pool -_0800AC0C: - ldr r2, =gLinkCallback - ldr r1, [r2] - cmp r1, 0 - bne _0800AC20 - ldr r0, =sub_800AC80 - str r0, [r2] - ldr r0, =gUnknown_030030E4 - strb r1, [r0] - ldr r0, =gUnknown_030030F4 - strh r3, [r0] -_0800AC20: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800ABF4 - - thumb_func_start sub_800AC34 -sub_800AC34: @ 800AC34 - push {lr} - ldr r0, =gSerialIsRFU - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800AC48 - bl task_add_05_task_del_08FA224_when_no_RfuFunc - b _0800AC70 - .pool -_0800AC48: - ldr r2, =gLinkCallback - ldr r1, [r2] - cmp r1, 0 - beq _0800AC64 - ldr r1, =gUnknown_02022B08 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _0800AC70 - .pool -_0800AC64: - ldr r0, =sub_800AC80 - str r0, [r2] - ldr r0, =gUnknown_030030E4 - strb r1, [r0] - ldr r0, =gUnknown_030030F4 - strh r1, [r0] -_0800AC70: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AC34 - thumb_func_start sub_800AC80 sub_800AC80: @ 800AC80 push {lr} diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 87d80bba7..934de184f 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7537,13 +7537,13 @@ sub_8011A9C: @ 8011A9C .pool thumb_func_end sub_8011A9C - thumb_func_start sub_8011AB0 -sub_8011AB0: @ 8011AB0 + thumb_func_start Rfu_IsMaster +Rfu_IsMaster: @ 8011AB0 ldr r0, =gUnknown_03005000 ldrb r0, [r0, 0xC] bx lr .pool - thumb_func_end sub_8011AB0 + thumb_func_end Rfu_IsMaster thumb_func_start LinkVSync LinkVSync: @ 8011ABC diff --git a/asm/mystery_event_menu.s b/asm/mystery_event_menu.s index ad9da463e..4915c199c 100644 --- a/asm/mystery_event_menu.s +++ b/asm/mystery_event_menu.s @@ -566,7 +566,7 @@ _08178E58: ands r0, r1 cmp r0, 0 beq _08178E98 - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 cmp r0, 0 bne _08178E98 diff --git a/asm/pokenav.s b/asm/pokenav.s index 414ca3672..98a0a4951 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -28128,7 +28128,7 @@ _081D4EBA: thumb_func_start sub_81D4EC0 sub_81D4EC0: @ 81D4EC0 push {lr} - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 cmp r0, 0 beq _081D4EDC @@ -28186,7 +28186,7 @@ _081D4F20: .4byte _081D4FEC .4byte _081D4FF8 _081D4F38: - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 cmp r0, 0 beq _081D4F88 diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 9de2911ea..1c84ba801 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -768,7 +768,7 @@ _080E73B8: bl GetLinkPlayerCount_2 lsls r0, 24 lsrs r4, r0, 24 - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 diff --git a/asm/trade.s b/asm/trade.s index 8235dc0df..aafa9f245 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -473,7 +473,7 @@ _0807758C: bcs _080775A0 b _08077B46 _080775A0: - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 cmp r0, 0 beq _080775D8 @@ -7367,7 +7367,7 @@ _0807AFAC: b _0807B0E4 .pool _0807AFBC: - bl sub_800ABBC + bl IsLinkMaster lsls r0, 24 cmp r0, 0 bne _0807AFC8 diff --git a/include/link.h b/include/link.h index 605d32aec..d4610eed5 100644 --- a/include/link.h +++ b/include/link.h @@ -205,7 +205,7 @@ void sub_800ADF8(void); void sub_800B488(void); void sub_800A620(void); void sub_8011BD0(void); -u8 sub_800ABBC(void); +u8 IsLinkMaster(void); void sub_800AC34(void); void SetLinkDebugValues(u32 seed, u32 flags); diff --git a/include/link_rfu.h b/include/link_rfu.h index 71b35b25c..39f68d1f1 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -21,5 +21,7 @@ u8 sub_80104F4(void); u8 rfu_get_multiplayer_id(void); bool8 sub_8010100(u8 a0); bool8 sub_8010500(void); +bool8 Rfu_IsMaster(void); +void task_add_05_task_del_08FA224_when_no_RfuFunc(void); #endif //GUARD_LINK_RFU_H diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 431f5d97a..b82a0a40e 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -793,7 +793,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId) if (GetLinkPlayerCount_2() >= var) { - if (sub_800ABBC()) + if (IsLinkMaster()) { sub_800A620(); gTasks[taskId].data[11]++; diff --git a/src/link.c b/src/link.c index d6cc1b5de..3ab9acb7c 100644 --- a/src/link.c +++ b/src/link.c @@ -107,6 +107,12 @@ EWRAM_DATA u16 gLinkTimeOutCounter = 0; EWRAM_DATA struct LinkPlayer gLocalLinkPlayer = {}; EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {}; EWRAM_DATA struct LinkPlayer gSavedLinkPlayers[MAX_RFU_PLAYERS] = {}; +EWRAM_DATA struct { + u32 status; + u8 unk_04; +} gUnknown_02022B00 = {}; +EWRAM_DATA u16 gUnknown_02022B08 = 0; +EWRAM_DATA void *gUnknown_02022B0C = NULL; // Static ROM declarations @@ -125,6 +131,7 @@ static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size); static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2); static void LinkCB_RequestPlayerDataExchange(void); static void Task_PrintTestData(u8 taskId); +void sub_800AC80(void); void sub_800AEB4(void); u8 sub_800B2F8(void); void sub_800B4A4(void); @@ -1368,3 +1375,55 @@ u8 GetLinkPlayerCount_2(void) { return EXTRACT_PLAYER_COUNT(gLinkStatus); } + +bool8 IsLinkMaster(void) +{ + if (gSerialIsRFU) + { + return Rfu_IsMaster(); + } + return EXTRACT_MASTER(gLinkStatus); +} + +u8 sub_800ABE8(void) +{ + return gUnknown_03000D58; +} + +void sub_800ABF4(u16 a0) +{ + if (gSerialIsRFU == TRUE) + { + task_add_05_task_del_08FA224_when_no_RfuFunc(); + } + else + { + if (gLinkCallback == NULL) + { + gLinkCallback = sub_800AC80; + gUnknown_030030E4 = 0; + gUnknown_030030F4 = a0; + } + } +} + +void sub_800AC34(void) +{ + if (gSerialIsRFU == TRUE) + { + task_add_05_task_del_08FA224_when_no_RfuFunc(); + } + else + { + if (gLinkCallback != NULL) + { + gUnknown_02022B08 ++; + } + else + { + gLinkCallback = sub_800AC80; + gUnknown_030030E4 = 0; + gUnknown_030030F4 = 0; + } + } +} diff --git a/sym_ewram.txt b/sym_ewram.txt index 2a1218996..c0c08848d 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -20,15 +20,6 @@ gStringVar4: @ 2021FC4 .include "src/string_util.o" .include "src/link.o" -gUnknown_02022B00: @ 2022B00 - .space 0x8 - -gUnknown_02022B08: @ 2022B08 - .space 0x4 - -gUnknown_02022B0C: @ 2022B0C - .space 0x4 - gUnknown_02022B10: @ 2022B10 .space 0x4 From 6fe7b33ae15d33896f7808e52ca921d4f5881941 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 22:24:15 -0500 Subject: [PATCH 035/123] through sub_800AD10 --- asm/link.s | 98 ------------------------------------------------------ src/link.c | 60 ++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 99 deletions(-) diff --git a/asm/link.s b/asm/link.s index 63273c8b5..0ba740590 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,104 +5,6 @@ .text - thumb_func_start sub_800AC80 -sub_800AC80: @ 800AC80 - push {lr} - ldr r0, =gUnknown_03004130 - ldrb r0, [r0] - cmp r0, 0 - bne _0800AC96 - ldr r0, =0x00005fff - bl BuildSendCmd - ldr r1, =gLinkCallback - ldr r0, =sub_800ACAC - str r0, [r1] -_0800AC96: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AC80 - - thumb_func_start sub_800ACAC -sub_800ACAC: @ 800ACAC - push {r4,lr} - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r2, r0, 24 - movs r3, 0 - movs r1, 0 - cmp r3, r2 - bge _0800ACD0 - ldr r4, =gUnknown_030030F0 -_0800ACC0: - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0800ACCA - adds r3, 0x1 -_0800ACCA: - adds r1, 0x1 - cmp r1, r2 - blt _0800ACC0 -_0800ACD0: - cmp r3, r2 - bne _0800ACF4 - ldr r2, =gBattleTypeFlags - ldr r0, [r2] - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - str r0, [r2] - ldr r0, =gLinkVSyncDisabled - movs r4, 0x1 - strb r4, [r0] - bl CloseLink - ldr r1, =gLinkCallback - movs r0, 0 - str r0, [r1] - ldr r0, =gUnknown_030030E4 - strb r4, [r0] -_0800ACF4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800ACAC - - thumb_func_start sub_800AD10 -sub_800AD10: @ 800AD10 - push {lr} - ldr r0, =gSerialIsRFU - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800AD24 - bl task_add_05_task_del_08FA224_when_no_RfuFunc - b _0800AD4C - .pool -_0800AD24: - ldr r2, =gLinkCallback - ldr r1, [r2] - cmp r1, 0 - beq _0800AD40 - ldr r1, =gUnknown_02022B08 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _0800AD4C - .pool -_0800AD40: - ldr r0, =sub_800AD5C - str r0, [r2] - ldr r0, =gUnknown_030030E4 - strb r1, [r0] - ldr r0, =gUnknown_030030F4 - strh r1, [r0] -_0800AD4C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AD10 - thumb_func_start sub_800AD5C sub_800AD5C: @ 800AD5C push {lr} diff --git a/src/link.c b/src/link.c index 3ab9acb7c..ab1b9174c 100644 --- a/src/link.c +++ b/src/link.c @@ -16,6 +16,7 @@ #include "palette.h" #include "task.h" #include "trade.h" +#include "battle.h" #include "link_rfu.h" #include "link.h" @@ -131,7 +132,9 @@ static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size); static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2); static void LinkCB_RequestPlayerDataExchange(void); static void Task_PrintTestData(u8 taskId); -void sub_800AC80(void); +static void sub_800AC80(void); +static void sub_800ACAC(void); +void sub_800AD5C(void); void sub_800AEB4(void); u8 sub_800B2F8(void); void sub_800B4A4(void); @@ -1427,3 +1430,58 @@ void sub_800AC34(void) } } } + +static void sub_800AC80(void) +{ + if (gUnknown_03004130 == 0) + { + BuildSendCmd(0x5fff); + gLinkCallback = sub_800ACAC; + } +} + +static void sub_800ACAC(void) +{ + int i; + unsigned count; + u8 linkPlayerCount; + + linkPlayerCount = GetLinkPlayerCount(); + count = 0; + for (i = 0; i < linkPlayerCount; i ++) + { + if (gUnknown_030030F0[i]) + { + count ++; + } + } + if (count == linkPlayerCount) + { + gBattleTypeFlags &= ~BATTLE_TYPE_20; + gLinkVSyncDisabled = TRUE; + CloseLink(); + gLinkCallback = NULL; + gUnknown_030030E4 = 1; + } +} + +void sub_800AD10(void) +{ + if (gSerialIsRFU == TRUE) + { + task_add_05_task_del_08FA224_when_no_RfuFunc(); + } + else + { + if (gLinkCallback != NULL) + { + gUnknown_02022B08 ++; + } + else + { + gLinkCallback = sub_800AD5C; + gUnknown_030030E4 = 0; + gUnknown_030030F4 = 0; + } + } +} From 16dba15c1c80ce545b4ed4178d42412bb98bdd33 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 22:30:00 -0500 Subject: [PATCH 036/123] through sub_800AD88 --- asm/link.s | 70 ------------------------------------------------------ src/link.c | 41 +++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 71 deletions(-) diff --git a/asm/link.s b/asm/link.s index 0ba740590..d333c26f5 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,76 +5,6 @@ .text - thumb_func_start sub_800AD5C -sub_800AD5C: @ 800AD5C - push {lr} - ldr r0, =gUnknown_03004130 - ldrb r0, [r0] - cmp r0, 0 - bne _0800AD72 - ldr r0, =0x00005fff - bl BuildSendCmd - ldr r1, =gLinkCallback - ldr r0, =sub_800AD88 - str r0, [r1] -_0800AD72: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AD5C - - thumb_func_start sub_800AD88 -sub_800AD88: @ 800AD88 - push {r4,r5,lr} - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r3, r0, 24 - movs r1, 0 - movs r2, 0 - cmp r1, r3 - bge _0800ADB6 - ldr r5, =gUnknown_030030F0 - ldr r4, =gLinkPlayers -_0800AD9E: - ldrh r0, [r4, 0x1A] - cmp r0, 0x1 - beq _0800ADAC - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, 0 - beq _0800ADAE -_0800ADAC: - adds r1, 0x1 -_0800ADAE: - adds r4, 0x1C - adds r2, 0x1 - cmp r2, r3 - blt _0800AD9E -_0800ADB6: - cmp r1, r3 - bne _0800ADDA - ldr r2, =gBattleTypeFlags - ldr r0, [r2] - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - str r0, [r2] - ldr r0, =gLinkVSyncDisabled - movs r4, 0x1 - strb r4, [r0] - bl CloseLink - ldr r1, =gLinkCallback - movs r0, 0 - str r0, [r1] - ldr r0, =gUnknown_030030E4 - strb r4, [r0] -_0800ADDA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AD88 - thumb_func_start sub_800ADF8 sub_800ADF8: @ 800ADF8 push {lr} diff --git a/src/link.c b/src/link.c index ab1b9174c..b01e53789 100644 --- a/src/link.c +++ b/src/link.c @@ -134,7 +134,8 @@ static void LinkCB_RequestPlayerDataExchange(void); static void Task_PrintTestData(u8 taskId); static void sub_800AC80(void); static void sub_800ACAC(void); -void sub_800AD5C(void); +static void sub_800AD5C(void); +static void sub_800AD88(void); void sub_800AEB4(void); u8 sub_800B2F8(void); void sub_800B4A4(void); @@ -1485,3 +1486,41 @@ void sub_800AD10(void) } } } + +static void sub_800AD5C(void) +{ + if (gUnknown_03004130 == 0) + { + BuildSendCmd(0x5fff); + gLinkCallback = sub_800AD88; + } +} + +static void sub_800AD88(void) +{ + int i; + unsigned count; + u8 linkPlayerCount; + + linkPlayerCount = GetLinkPlayerCount(); + count = 0; + for (i = 0; i < linkPlayerCount; i ++) + { + if (gLinkPlayers[i].language == LANGUAGE_JAPANESE) + { + count ++; + } + else if (gUnknown_030030F0[i]) + { + count ++; + } + } + if (count == linkPlayerCount) + { + gBattleTypeFlags &= ~BATTLE_TYPE_20; + gLinkVSyncDisabled = TRUE; + CloseLink(); + gLinkCallback = NULL; + gUnknown_030030E4 = 1; + } +} From e6b38426b7c882a3ae09ac9e6e27e12b06e7ffd1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 22:44:20 -0500 Subject: [PATCH 037/123] sub_800ADF8 --- asm/link.s | 92 ---------------------------------------------- include/link_rfu.h | 1 + src/link.c | 84 +++++++++++++++++++++++++++++++++--------- 3 files changed, 68 insertions(+), 109 deletions(-) diff --git a/asm/link.s b/asm/link.s index d333c26f5..75fec838b 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,98 +5,6 @@ .text - thumb_func_start sub_800ADF8 -sub_800ADF8: @ 800ADF8 - push {lr} - ldr r0, =gSerialIsRFU - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800AE0C - bl sub_8010434 - b _0800AE1E - .pool -_0800AE0C: - ldr r1, =gLinkCallback - ldr r0, [r1] - cmp r0, 0 - bne _0800AE18 - ldr r0, =sub_800AE30 - str r0, [r1] -_0800AE18: - ldr r1, =gUnknown_030030E4 - movs r0, 0 - strb r0, [r1] -_0800AE1E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800ADF8 - - thumb_func_start sub_800AE30 -sub_800AE30: @ 800AE30 - push {lr} - ldr r0, =gUnknown_03004130 - ldrb r0, [r0] - cmp r0, 0 - bne _0800AE46 - ldr r0, =0x00002ffe - bl BuildSendCmd - ldr r1, =gLinkCallback - ldr r0, =sub_800AE5C - str r0, [r1] -_0800AE46: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AE30 - - thumb_func_start sub_800AE5C -sub_800AE5C: @ 800AE5C - push {r4,lr} - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - cmp r1, r2 - bcs _0800AE86 - ldr r3, =gUnknown_030030EC - ldrb r0, [r3] - cmp r0, 0 - beq _0800AE86 -_0800AE74: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r2 - bcs _0800AE86 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _0800AE74 -_0800AE86: - cmp r1, r2 - bne _0800AEA4 - movs r1, 0 - ldr r4, =gLinkCallback - ldr r3, =gUnknown_030030EC - movs r2, 0 -_0800AE92: - adds r0, r1, r3 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _0800AE92 - movs r0, 0 - str r0, [r4] -_0800AEA4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AE5C - thumb_func_start sub_800AEB4 sub_800AEB4: @ 800AEB4 push {lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 39f68d1f1..59cdc82d0 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -23,5 +23,6 @@ bool8 sub_8010100(u8 a0); bool8 sub_8010500(void); bool8 Rfu_IsMaster(void); void task_add_05_task_del_08FA224_when_no_RfuFunc(void); +void sub_8010434(void); #endif //GUARD_LINK_RFU_H diff --git a/src/link.c b/src/link.c index b01e53789..291c32e5b 100644 --- a/src/link.c +++ b/src/link.c @@ -71,10 +71,10 @@ u32 gFiller_03003080; u16 gLinkHeldKeys; u16 gRecvCmds[MAX_RFU_PLAYERS][8]; u32 gLinkStatus; -u8 gUnknown_030030E4; +bool8 gUnknown_030030E4; bool8 gUnknown_030030E8; -u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; -u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; +bool8 gUnknown_030030EC[MAX_LINK_PLAYERS]; +bool8 gUnknown_030030F0[MAX_LINK_PLAYERS]; u16 gUnknown_030030F4; u8 gSuppressLinkErrorMessage; bool8 gSerialIsRFU; @@ -136,6 +136,8 @@ static void sub_800AC80(void); static void sub_800ACAC(void); static void sub_800AD5C(void); static void sub_800AD88(void); +static void sub_800AE30(void); +static void sub_800AE5C(void); void sub_800AEB4(void); u8 sub_800B2F8(void); void sub_800B4A4(void); @@ -339,8 +341,8 @@ void OpenLink(void) ResetBlockReceivedFlags(); ResetBlockSend(); gUnknown_03000D54 = 0; - gUnknown_030030E8 = 0; - gUnknown_030030E4 = 0; + gUnknown_030030E8 = FALSE; + gUnknown_030030E4 = FALSE; gUnknown_030030F4 = 0; CreateTask(Task_TriggerHandshake, 2); } @@ -351,9 +353,9 @@ void OpenLink(void) gReceivedRemoteLinkPlayers = 0; for (i = 0; i < MAX_LINK_PLAYERS; i ++) { - gUnknown_03003078[i] = 1; - gUnknown_030030F0[i] = 0; - gUnknown_030030EC[i] = 0; + gUnknown_03003078[i] = TRUE; + gUnknown_030030F0[i] = FALSE; + gUnknown_030030EC[i] = FALSE; } } @@ -518,10 +520,10 @@ static void ProcessRecvCmds(u8 unused) gUnknown_03003020[i] = gRecvCmds[i][1]; break; case 0x5555: - gUnknown_030030E8 = 1; + gUnknown_030030E8 = TRUE; break; case 0x5566: - gUnknown_030030E8 = 1; + gUnknown_030030E8 = TRUE; break; case 0xBBBB: { @@ -593,10 +595,10 @@ static void ProcessRecvCmds(u8 unused) } break; case 0x5FFF: - gUnknown_030030F0[i] = 1; + gUnknown_030030F0[i] = TRUE; break; case 0x2FFE: - gUnknown_030030EC[i] = 1; + gUnknown_030030EC[i] = TRUE; break; case 0xAAAA: sub_800A418(); @@ -1405,7 +1407,7 @@ void sub_800ABF4(u16 a0) if (gLinkCallback == NULL) { gLinkCallback = sub_800AC80; - gUnknown_030030E4 = 0; + gUnknown_030030E4 = FALSE; gUnknown_030030F4 = a0; } } @@ -1426,7 +1428,7 @@ void sub_800AC34(void) else { gLinkCallback = sub_800AC80; - gUnknown_030030E4 = 0; + gUnknown_030030E4 = FALSE; gUnknown_030030F4 = 0; } } @@ -1462,7 +1464,7 @@ static void sub_800ACAC(void) gLinkVSyncDisabled = TRUE; CloseLink(); gLinkCallback = NULL; - gUnknown_030030E4 = 1; + gUnknown_030030E4 = TRUE; } } @@ -1481,7 +1483,7 @@ void sub_800AD10(void) else { gLinkCallback = sub_800AD5C; - gUnknown_030030E4 = 0; + gUnknown_030030E4 = FALSE; gUnknown_030030F4 = 0; } } @@ -1521,6 +1523,54 @@ static void sub_800AD88(void) gLinkVSyncDisabled = TRUE; CloseLink(); gLinkCallback = NULL; - gUnknown_030030E4 = 1; + gUnknown_030030E4 = TRUE; + } +} + +void sub_800ADF8(void) +{ + if (gSerialIsRFU == TRUE) + { + sub_8010434(); + } + else + { + if (gLinkCallback == NULL) + { + gLinkCallback = sub_800AE30; + } + gUnknown_030030E4 = FALSE; + } +} + +static void sub_800AE30(void) +{ + if (gUnknown_03004130 == 0) + { + BuildSendCmd(0x2ffe); + gLinkCallback = sub_800AE5C; + } +} + +static void sub_800AE5C(void) +{ + u8 i; + u8 linkPlayerCount; + + linkPlayerCount = GetLinkPlayerCount(); + for (i = 0; i < linkPlayerCount; i ++) + { + if (!gUnknown_030030EC[i]) + { + break; + } + } + if (i == linkPlayerCount) + { + for (i = 0; i < MAX_LINK_PLAYERS; i ++) + { + gUnknown_030030EC[i] = FALSE; + } + gLinkCallback = NULL; } } From 344a71d347c487f9fb4213637f3930e2643444d9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 23:16:51 -0500 Subject: [PATCH 038/123] through CB2_LinkError --- asm/link.s | 179 ++----------------------------------- common_syms/link.txt | 4 +- include/link.h | 7 +- include/link_rfu.h | 1 + include/m4a.h | 4 + include/malloc.h | 1 + include/new_menu_helpers.h | 2 + src/link.c | 105 +++++++++++++++++++--- 8 files changed, 118 insertions(+), 185 deletions(-) diff --git a/asm/link.s b/asm/link.s index 75fec838b..c32a4d8ac 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,169 +5,6 @@ .text - thumb_func_start sub_800AEB4 -sub_800AEB4: @ 800AEB4 - push {lr} - ldr r0, =gLinkOpen - ldrb r0, [r0] - cmp r0, 0 - beq _0800AEF4 - ldr r0, =gLinkStatus - ldr r2, [r0] - movs r0, 0xFE - lsls r0, 11 - ands r0, r2 - cmp r0, 0 - beq _0800AEF4 - ldr r0, =gSuppressLinkErrorMessage - ldrb r0, [r0] - cmp r0, 0 - bne _0800AEEA - ldr r1, =gUnknown_02022B00 - str r2, [r1] - ldr r0, =gUnknown_03004130 - ldrb r0, [r0] - strb r0, [r1, 0x4] - ldr r0, =gUnknown_03003160 - ldrb r0, [r0] - strb r0, [r1, 0x5] - ldr r0, =CB2_LinkError - bl SetMainCallback2 -_0800AEEA: - ldr r1, =gLinkErrorOccurred - movs r0, 0x1 - strb r0, [r1] - bl CloseLink -_0800AEF4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AEB4 - - thumb_func_start sub_800AF18 -sub_800AF18: @ 800AF18 - push {r4,lr} - ldr r4, =gUnknown_02022B00 - str r0, [r4] - strb r1, [r4, 0x5] - strb r2, [r4, 0x4] - strb r3, [r4, 0x6] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AF18 - - thumb_func_start CB2_LinkError -CB2_LinkError: @ 800AF30 - push {r4,lr} - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r0, =gMPlay_SE1 - bl m4aMPlayStop - ldr r0, =gMPlay_SE2 - bl m4aMPlayStop - ldr r0, =gMPlay_SE3 - bl m4aMPlayStop - ldr r0, =0x02000000 - movs r1, 0xE0 - lsls r1, 9 - bl InitHeap - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetPaletteFadeControl - movs r0, 0 - movs r1, 0 - movs r2, 0x2 - bl FillPalette - bl ResetTasks - bl remove_some_task - ldr r1, =gSerialIsRFU - ldrb r0, [r1] - cmp r0, 0 - beq _0800AF8C - ldr r0, =gUnknown_02022B00 - ldrb r0, [r0, 0x6] - cmp r0, 0 - bne _0800AF88 - movs r0, 0x3 - strb r0, [r1] -_0800AF88: - bl sub_800E604 -_0800AF8C: - ldr r0, =sub_80096BC - bl SetVBlankCallback - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082ED1FC - movs r0, 0 - movs r2, 0x2 - bl InitBgsFromTemplates - ldr r4, =gUnknown_02022B0C - movs r0, 0x80 - lsls r0, 4 - bl Alloc - adds r1, r0, 0 - str r1, [r4] - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r0, =gUnknown_082ED204 - bl InitWindows - lsls r0, 16 - cmp r0, 0 - beq _0800B03C - bl DeactivateAllTextPrinters - bl reset_temp_tile_data_buffers - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x10 - movs r1, 0 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - movs r0, 0x14 - movs r1, 0 - bl SetGpuReg - movs r0, 0x16 - movs r1, 0 - bl SetGpuReg - movs r1, 0xE0 - lsls r1, 8 - movs r0, 0 - bl ClearGpuRegBits - ldr r0, =gUnknown_0860F074 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gSoftResetDisabled - movs r0, 0 - strb r0, [r1] - ldr r0, =Task_DestroySelf - movs r1, 0 - bl CreateTask - bl StopMapMusic - ldr r1, =gMain - movs r0, 0 - str r0, [r1] - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - ldr r0, =sub_800B1A0 - bl SetMainCallback2 -_0800B03C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end CB2_LinkError - thumb_func_start sub_800B080 sub_800B080: @ 800B080 push {r4,r5,lr} @@ -311,7 +148,7 @@ _0800B1D2: beq _0800B214 b _0800B260 _0800B1D8: - ldr r0, =gUnknown_02022B00 + ldr r0, =sLinkErrorBuffer ldrb r0, [r0, 0x6] cmp r0, 0 beq _0800B1EC @@ -324,7 +161,7 @@ _0800B1EC: _0800B1F2: movs r0, 0 bl ShowBg - ldr r0, =gUnknown_02022B00 + ldr r0, =sLinkErrorBuffer ldrb r0, [r0, 0x6] cmp r0, 0 beq _0800B260 @@ -388,7 +225,7 @@ _0800B260: bl PlaySE movs r0, 0 strb r0, [r4] - ldr r1, =gUnknown_02022B00 + ldr r1, =sLinkErrorBuffer movs r0, 0 strb r0, [r1, 0x6] bl sub_81700F8 @@ -803,9 +640,9 @@ EnableSerial: @ 800B594 strb r4, [r0] ldr r0, =gUnknown_03000D73 strb r4, [r0] - ldr r0, =gUnknown_03003160 + ldr r0, =gLastSendQueueCount strb r4, [r0] - ldr r0, =gUnknown_03004130 + ldr r0, =gLastRecvQueueCount strb r4, [r0] add sp, 0x4 pop {r4,r5} @@ -1051,7 +888,7 @@ _0800B7FE: movs r2, 0 ldr r4, =gUnknown_03000D6E mov r9, r4 - ldr r1, =gUnknown_03003160 + ldr r1, =gLastSendQueueCount mov r10, r1 lsls r5, r0, 1 movs r0, 0x18 @@ -1084,7 +921,7 @@ _0800B850: strb r0, [r6, 0x12] ldr r2, =gUnknown_03000D6E mov r9, r2 - ldr r4, =gUnknown_03003160 + ldr r4, =gLastSendQueueCount mov r10, r4 _0800B85C: mov r1, r9 @@ -1374,7 +1211,7 @@ _0800BA8A: asrs r0, 24 cmp r0, 0x8 bne _0800BAAA - ldr r0, =gUnknown_03004130 + ldr r0, =gLastRecvQueueCount ldr r2, =0x00000fbd adds r1, r3, r2 ldrb r1, [r1] diff --git a/common_syms/link.txt b/common_syms/link.txt index 9b168d932..657f97396 100644 --- a/common_syms/link.txt +++ b/common_syms/link.txt @@ -29,9 +29,9 @@ gBlockRequestType gFiller_03003154 gFiller_03003158 gFiller_0300315c -gUnknown_03003160 +gLastSendQueueCount gLink -gUnknown_03004130 +gLastRecvQueueCount gUnknown_03004134 gFiller_03004138 gFiller_0300413C diff --git a/include/link.h b/include/link.h index d4610eed5..2689f2596 100644 --- a/include/link.h +++ b/include/link.h @@ -17,6 +17,7 @@ #define LINK_STAT_RECEIVED_NOTHING 0x00000100 #define LINK_STAT_RECEIVED_NOTHING_SHIFT 8 #define LINK_STAT_ERRORS 0x0007F000 +#define LINK_STAT_ERRORS_SHIFT 12 #define EXTRACT_PLAYER_COUNT(status) \ (((status) & LINK_STAT_PLAYER_COUNT) >> LINK_STAT_PLAYER_COUNT_SHIFT) @@ -26,6 +27,8 @@ (((status) >> LINK_STAT_CONN_ESTABLISHED_SHIFT) & 1) #define EXTRACT_RECEIVED_NOTHING(status) \ (((status) >> LINK_STAT_RECEIVED_NOTHING_SHIFT) & 1) +#define EXTRACT_LINK_ERRORS(status) \ +(((status) & LINK_STAT_ERRORS) >> LINK_STAT_ERRORS_SHIFT) struct LinkStatus { @@ -239,8 +242,8 @@ extern void (*gLinkCallback)(void); extern bool8 gShouldAdvanceLinkState; extern u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; extern u8 gBlockRequestType; -extern u8 gUnknown_03003160; -extern u8 gUnknown_03004130; +extern u8 gLastSendQueueCount; +extern u8 gLastRecvQueueCount; extern u16 gUnknown_03004134; extern u32 gUnknown_03003074; extern u32 gFiller_03003154; diff --git a/include/link_rfu.h b/include/link_rfu.h index 59cdc82d0..1f29d863d 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -24,5 +24,6 @@ bool8 sub_8010500(void); bool8 Rfu_IsMaster(void); void task_add_05_task_del_08FA224_when_no_RfuFunc(void); void sub_8010434(void); +void sub_800E604(void); #endif //GUARD_LINK_RFU_H diff --git a/include/m4a.h b/include/m4a.h index 8c3380dd8..316b85082 100644 --- a/include/m4a.h +++ b/include/m4a.h @@ -17,4 +17,8 @@ void m4aMPlayFadeOutTemporarily(struct MusicPlayerInfo *mplayInfo, u16 speed); void m4aMPlayFadeIn(struct MusicPlayerInfo *mplayInfo, u16 speed); void m4aMPlayImmInit(struct MusicPlayerInfo *mplayInfo); +extern struct MusicPlayerInfo gMPlay_SE1; +extern struct MusicPlayerInfo gMPlay_SE2; +extern struct MusicPlayerInfo gMPlay_SE3; + #endif //GUARD_M4A_H diff --git a/include/malloc.h b/include/malloc.h index f3a731797..a6abab5e4 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -1,6 +1,7 @@ #ifndef GUARD_MALLOC_H #define GUARD_MALLOC_H +#define HEAP_SIZE 0x1C000 #define malloc Alloc #define calloc(ct, sz) AllocZeroed((ct) * (sz)) #define free Free diff --git a/include/new_menu_helpers.h b/include/new_menu_helpers.h index 42b8c60b1..2deb8d8cd 100644 --- a/include/new_menu_helpers.h +++ b/include/new_menu_helpers.h @@ -4,6 +4,8 @@ #include "text.h" #include "task.h" +extern const u16 gUnknown_0860F074[]; + void sub_81973A4(void); void sub_81973C4(u8, u8); void sub_819746C(u8 windowId, bool8 copyToVram); diff --git a/src/link.c b/src/link.c index 291c32e5b..c9a555dbb 100644 --- a/src/link.c +++ b/src/link.c @@ -1,6 +1,7 @@ // Includes #include "global.h" +#include "m4a.h" #include "malloc.h" #include "save.h" #include "bg.h" @@ -15,6 +16,11 @@ #include "gpu_regs.h" #include "palette.h" #include "task.h" +#include "unknown_task.h" +#include "menu.h" +#include "new_menu_helpers.h" +#include "text.h" +#include "sound.h" #include "trade.h" #include "battle.h" #include "link_rfu.h" @@ -90,9 +96,9 @@ u8 gBlockRequestType; u32 gFiller_03003154; u32 gFiller_03003158; u32 gFiller_0300315c; -u8 gUnknown_03003160; +u8 gLastSendQueueCount; struct Link gLink; -u8 gUnknown_03004130; +u8 gLastRecvQueueCount; u16 gUnknown_03004134; u32 gFiller_03004138; u32 gFiller_0300413C; @@ -110,8 +116,10 @@ EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {}; EWRAM_DATA struct LinkPlayer gSavedLinkPlayers[MAX_RFU_PLAYERS] = {}; EWRAM_DATA struct { u32 status; - u8 unk_04; -} gUnknown_02022B00 = {}; + u8 lastRecvQueueCount; + u8 lastSendQueueCount; + u8 unk_06; +} sLinkErrorBuffer = {}; EWRAM_DATA u16 gUnknown_02022B08 = 0; EWRAM_DATA void *gUnknown_02022B0C = NULL; @@ -138,7 +146,8 @@ static void sub_800AD5C(void); static void sub_800AD88(void); static void sub_800AE30(void); static void sub_800AE5C(void); -void sub_800AEB4(void); +static void sub_800AEB4(void); +void sub_800B1A0(void); u8 sub_800B2F8(void); void sub_800B4A4(void); void DisableSerial(void); @@ -1243,8 +1252,8 @@ static void Task_PrintTestData(u8 taskId) LinkTest_prnthex(gLink.state, 2, 10, 2); LinkTest_prnthex(EXTRACT_PLAYER_COUNT(gLinkStatus), 15, 10, 2); LinkTest_prnthex(GetMultiplayerId(), 15, 12, 2); - LinkTest_prnthex(gUnknown_03003160, 25, 1, 2); - LinkTest_prnthex(gUnknown_03004130, 25, 2, 2); + LinkTest_prnthex(gLastSendQueueCount, 25, 1, 2); + LinkTest_prnthex(gLastRecvQueueCount, 25, 2, 2); LinkTest_prnthex(GetBlockReceivedStatus(), 15, 5, 2); LinkTest_prnthex(gLinkDebugSeed, 2, 12, 8); LinkTest_prnthex(gLinkDebugFlags, 2, 13, 8); @@ -1436,7 +1445,7 @@ void sub_800AC34(void) static void sub_800AC80(void) { - if (gUnknown_03004130 == 0) + if (gLastRecvQueueCount == 0) { BuildSendCmd(0x5fff); gLinkCallback = sub_800ACAC; @@ -1491,7 +1500,7 @@ void sub_800AD10(void) static void sub_800AD5C(void) { - if (gUnknown_03004130 == 0) + if (gLastRecvQueueCount == 0) { BuildSendCmd(0x5fff); gLinkCallback = sub_800AD88; @@ -1545,7 +1554,7 @@ void sub_800ADF8(void) static void sub_800AE30(void) { - if (gUnknown_03004130 == 0) + if (gLastRecvQueueCount == 0) { BuildSendCmd(0x2ffe); gLinkCallback = sub_800AE5C; @@ -1574,3 +1583,79 @@ static void sub_800AE5C(void) gLinkCallback = NULL; } } + +static void sub_800AEB4(void) +{ + if (gLinkOpen && EXTRACT_LINK_ERRORS(gLinkStatus)) + { + if (!gSuppressLinkErrorMessage) + { + sLinkErrorBuffer.status = gLinkStatus; + sLinkErrorBuffer.lastRecvQueueCount = gLastRecvQueueCount; + sLinkErrorBuffer.lastSendQueueCount = gLastSendQueueCount; + SetMainCallback2(CB2_LinkError); + } + gLinkErrorOccurred = TRUE; + CloseLink(); + } +} + +void sub_800AF18(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06) +{ + sLinkErrorBuffer.status = status; + sLinkErrorBuffer.lastSendQueueCount = lastSendQueueCount; + sLinkErrorBuffer.lastRecvQueueCount = lastRecvQueueCount; + sLinkErrorBuffer.unk_06 = unk_06; +} + +void CB2_LinkError(void) +{ + u8 *tilemapBuffer; + + SetGpuReg(REG_OFFSET_DISPCNT, 0); + m4aMPlayStop(&gMPlay_SE1); + m4aMPlayStop(&gMPlay_SE2); + m4aMPlayStop(&gMPlay_SE3); + InitHeap(gHeap, HEAP_SIZE); + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetPaletteFadeControl(); + FillPalette(0, 0, 2); + ResetTasks(); + remove_some_task(); + if (gSerialIsRFU) + { + if (!sLinkErrorBuffer.unk_06) + { + gSerialIsRFU = 3; + } + sub_800E604(); + } + SetVBlankCallback(sub_80096BC); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_082ED1FC, 2); + gUnknown_02022B0C = tilemapBuffer = malloc(0x800); + SetBgTilemapBuffer(1, tilemapBuffer); + if (InitWindows(gUnknown_082ED204)) + { + DeactivateAllTextPrinters(); + reset_temp_tile_data_buffers(); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BG0HOFS, 0); + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + SetGpuReg(REG_OFFSET_BG1HOFS, 0); + SetGpuReg(REG_OFFSET_BG1VOFS, 0); + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON); + LoadPalette(gUnknown_0860F074, 0xf0, 0x20); + gSoftResetDisabled = FALSE; + CreateTask(Task_DestroySelf, 0); + StopMapMusic(); + gMain.callback1 = NULL; + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); + SetMainCallback2(sub_800B1A0); + } +} From 85cf626316c6300cd77978d769a8758ec43a2ca4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 23:33:03 -0500 Subject: [PATCH 039/123] sub_800B080 --- asm/link.s | 69 ------------------------------------------- include/menu.h | 1 + include/strings.h | 2 ++ src/egg_hatch.c | 6 ---- src/evolution_scene.c | 3 -- src/link.c | 18 +++++++++++ 6 files changed, 21 insertions(+), 78 deletions(-) diff --git a/asm/link.s b/asm/link.s index c32a4d8ac..931a7c26a 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,75 +5,6 @@ .text - thumb_func_start sub_800B080 -sub_800B080: @ 800B080 - push {r4,r5,lr} - sub sp, 0xC - ldr r1, =g2BlankTilesGfx - movs r0, 0 - movs r2, 0x20 - movs r3, 0 - bl LoadBgTiles - ldr r1, =gWirelessLinkDisplayGfx - movs r5, 0 - str r5, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl copy_decompressed_tile_data_to_vram_autofree - ldr r1, =gWirelessLinkDisplayTilemap - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - ldr r0, =gWirelessLinkDisplayPal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r4, =gUnknown_082ED224 - str r4, [sp] - str r5, [sp, 0x4] - ldr r0, =gText_CommErrorEllipsis - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x3 - movs r2, 0x2 - movs r3, 0x6 - bl box_print - str r4, [sp] - str r5, [sp, 0x4] - ldr r0, =gText_MoveCloserToLinkPartner - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0x3 - movs r2, 0x2 - movs r3, 0x1 - bl box_print - movs r0, 0 - bl PutWindowTilemap - movs r0, 0x2 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0 - bl CopyWindowToVram - movs r0, 0x2 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B080 - thumb_func_start sub_800B138 sub_800B138: @ 800B138 push {lr} diff --git a/include/menu.h b/include/menu.h index d8b2afc5c..e0d06e715 100644 --- a/include/menu.h +++ b/include/menu.h @@ -29,5 +29,6 @@ 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 void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); s8 sub_8198C58(void); +void copy_decompressed_tile_data_to_vram_autofree(u8 arg0, const void *arg1, bool32 arg2, u16 arg3, u8 arg4); #endif // GUARD_MENU_H diff --git a/include/strings.h b/include/strings.h index fcdb1eca4..299d637b8 100644 --- a/include/strings.h +++ b/include/strings.h @@ -75,5 +75,7 @@ extern const u8 gText_NoRegistry[]; extern const u8 gText_OkayToDeleteFromRegistry[]; extern const u8 gText_RegisteredDataDeleted[]; extern const u8 gUnknown_085EA79D[]; +extern const u8 gText_CommErrorEllipsis[]; +extern const u8 gText_MoveCloserToLinkPartner[]; #endif //GUARD_STRINGS_H diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 589e8901d..9d1f6fd0e 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -58,20 +58,14 @@ extern const u8 gText_NickHatchPrompt[]; extern u8* GetMonNick(struct Pokemon* mon, u8* dst); extern u8* GetBoxMonNick(struct BoxPokemon* boxMon, u8* dst); extern u8 sav1_map_get_name(void); -extern s8 sub_8198C58(void); extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8); extern void sub_806A068(u16, u8); extern void fade_screen(u8, u8); extern void overworld_free_bg_tilemaps(void); extern void sub_80AF168(void); -extern void AllocateMonSpritesGfx(void); -extern void FreeMonSpritesGfx(void); extern void remove_some_task(void); -extern void reset_temp_tile_data_buffers(void); extern void c2_exit_to_overworld_2_switch(void); extern void play_some_sound(void); -extern void copy_decompressed_tile_data_to_vram_autofree(u8 bg_id, const void* src, u16 size, u16 offset, u8 mode); -extern void CreateYesNoMenu(const struct WindowTemplate*, u16, u8, u8); extern void DoNamingScreen(u8, const u8*, u16, u8, u32, MainCallback); extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); extern u16 sub_80D22D0(void); diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 101feab56..569dcfe35 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -75,9 +75,6 @@ extern const u8 gText_PkmnStoppedEvolving[]; extern const u8 gText_EllipsisQuestionMark[]; extern const u8 gText_CommunicationStandby5[]; -extern void copy_decompressed_tile_data_to_vram_autofree(u8 arg0, const void *arg1, bool32 arg2, u16 arg3, u8 arg4); -extern u32 sub_80391E0(u8, u8); -extern void SpriteCallbackDummy_2(struct Sprite *sprite); extern void sub_80356D0(void); extern void sub_807B154(void); extern void sub_806A068(u16, u8); diff --git a/src/link.c b/src/link.c index c9a555dbb..09f3b6d6f 100644 --- a/src/link.c +++ b/src/link.c @@ -20,6 +20,7 @@ #include "menu.h" #include "new_menu_helpers.h" #include "text.h" +#include "strings.h" #include "sound.h" #include "trade.h" #include "battle.h" @@ -1659,3 +1660,20 @@ void CB2_LinkError(void) SetMainCallback2(sub_800B1A0); } } + +void sub_800B080(void) +{ + LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0); + copy_decompressed_tile_data_to_vram_autofree(1, gWirelessLinkDisplayGfx, FALSE, 0, 0); + CopyToBgTilemapBuffer(1, gWirelessLinkDisplayTilemap, 0, 0); + CopyBgTilemapBufferToVram(1); + LoadPalette(gWirelessLinkDisplayPal, 0, 0x20); + FillWindowPixelBuffer(0, 0x00); + FillWindowPixelBuffer(2, 0x00); + box_print(0, 3, 2, 6, gUnknown_082ED224, 0, gText_CommErrorEllipsis); + box_print(2, 3, 2, 1, gUnknown_082ED224, 0, gText_MoveCloserToLinkPartner); + PutWindowTilemap(0); + PutWindowTilemap(2); + CopyWindowToVram(0, 0); + CopyWindowToVram(2, 3); +} From f21c5ebea50685982daf1f81cda4c535615a6ef8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 23:58:05 -0500 Subject: [PATCH 040/123] through sub_800B1A0 --- asm/battle_tower.s | 4 +- asm/berry_blender.s | 14 +-- asm/cable_club.s | 12 +- asm/contest_link_80FC4F4.s | 2 +- asm/link.s | 203 +-------------------------------- asm/link_rfu.s | 4 +- asm/record_mixing.s | 6 +- asm/rom4.s | 18 +-- asm/rom6.s | 2 +- asm/rom_8011DC0.s | 2 +- asm/start_menu.s | 2 +- asm/trade.s | 28 ++--- asm/trainer_card.s | 2 +- common_syms/link.txt | 2 +- include/link.h | 4 +- include/reset_save_heap.h | 12 ++ include/strings.h | 3 + src/battle_2.c | 24 ++-- src/battle_controller_player.c | 4 +- src/battle_controllers.c | 4 +- src/evolution_scene.c | 4 +- src/link.c | 133 +++++++++++++++++---- src/main.c | 2 +- src/reshow_battle_screen.c | 2 +- 24 files changed, 200 insertions(+), 293 deletions(-) create mode 100644 include/reset_save_heap.h diff --git a/asm/battle_tower.s b/asm/battle_tower.s index c21a706f4..cd04f695d 100755 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -5264,7 +5264,7 @@ _08164D14: ldrb r0, [r0] cmp r0, 0 beq _08164DB0 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _08164DB0 @@ -5302,7 +5302,7 @@ _08164DB6: thumb_func_start sub_8164DCC sub_8164DCC: @ 8164DCC push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08164DDA diff --git a/asm/berry_blender.s b/asm/berry_blender.s index 511120f2d..bee82b213 100644 --- a/asm/berry_blender.s +++ b/asm/berry_blender.s @@ -516,7 +516,7 @@ _0807FBBE: ldrb r0, [r0] cmp r0, 0 beq _0807FC14 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _0807FC14 @@ -1122,7 +1122,7 @@ _08080126: bne _0808016A b _080804F8 _0808016A: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _08080174 @@ -3334,7 +3334,7 @@ sub_80814B0: @ 80814B0 ldrb r0, [r0] cmp r0, 0 beq _080814E4 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080814E4 @@ -4706,7 +4706,7 @@ sub_8081F94: @ 8081F94 ldrb r0, [r0] cmp r0, 0 beq _08081FB8 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08081FB8 @@ -4852,7 +4852,7 @@ _080820EC: ldrb r0, [r0] cmp r0, 0 beq _0808218C - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _0808218C @@ -4968,7 +4968,7 @@ _080821D4: ldrb r0, [r0] cmp r0, 0 beq _08082254 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08082254 @@ -6250,7 +6250,7 @@ sub_8082D28: @ 8082D28 lsls r0, 24 lsrs r1, r0, 24 _08082D3C: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08082DCC diff --git a/asm/cable_club.s b/asm/cable_club.s index 5b4e77619..ae818fdc9 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -2172,7 +2172,7 @@ sub_80B360C: @ 80B360C movs r5, 0x1 eors r0, r5 bl sub_813C2A0 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080B36B2 @@ -2512,7 +2512,7 @@ _080B391C: thumb_func_start sub_80B3924 sub_80B3924: @ 80B3924 push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080B3940 @@ -2552,7 +2552,7 @@ sub_80B3968: @ 80B3968 ldr r2, =0x00002211 adds r0, r2, 0 strh r0, [r1] - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080B3994 @@ -2661,7 +2661,7 @@ _080B3A62: ldrb r0, [r0] cmp r0, 0 beq _080B3AA6 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _080B3AA0 @@ -2752,7 +2752,7 @@ _080B3B20: beq _080B3B9E b _080B3BB8 _080B3B2A: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080B3B40 @@ -2825,7 +2825,7 @@ _080B3BB8: thumb_func_start sub_80B3BC4 sub_80B3BC4: @ 80B3BC4 push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _080B3BD6 diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s index 135e04e5e..621e26038 100644 --- a/asm/contest_link_80FC4F4.s +++ b/asm/contest_link_80FC4F4.s @@ -147,7 +147,7 @@ sub_80FC5DC: @ 80FC5DC ldr r1, =gUnknown_02039F2A movs r0, 0x1 strb r0, [r1] - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0x1 bne _080FC60C diff --git a/asm/link.s b/asm/link.s index 931a7c26a..c5fcb39de 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,197 +5,6 @@ .text - thumb_func_start sub_800B138 -sub_800B138: @ 800B138 - push {lr} - sub sp, 0xC - ldr r1, =g2BlankTilesGfx - movs r0, 0 - movs r2, 0x20 - movs r3, 0 - bl LoadBgTiles - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_082ED224 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - ldr r0, =gText_CommErrorCheckConnections - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x3 - movs r2, 0x2 - movs r3, 0 - bl box_print - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x2 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0 - bl CopyWindowToVram - movs r0, 0x2 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B138 - - thumb_func_start sub_800B1A0 -sub_800B1A0: @ 800B1A0 - push {r4,lr} - sub sp, 0xC - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1E - beq _0800B20C - cmp r0, 0x1E - bgt _0800B1C4 - cmp r0, 0 - beq _0800B1D8 - cmp r0, 0x2 - beq _0800B1F2 - b _0800B260 - .pool -_0800B1C4: - cmp r0, 0x5A - beq _0800B20C - cmp r0, 0x5A - bgt _0800B1D2 - cmp r0, 0x3C - beq _0800B20C - b _0800B260 -_0800B1D2: - cmp r0, 0x82 - beq _0800B214 - b _0800B260 -_0800B1D8: - ldr r0, =sLinkErrorBuffer - ldrb r0, [r0, 0x6] - cmp r0, 0 - beq _0800B1EC - bl sub_800B080 - b _0800B260 - .pool -_0800B1EC: - bl sub_800B138 - b _0800B260 -_0800B1F2: - movs r0, 0 - bl ShowBg - ldr r0, =sLinkErrorBuffer - ldrb r0, [r0, 0x6] - cmp r0, 0 - beq _0800B260 - movs r0, 0x1 - bl ShowBg - b _0800B260 - .pool -_0800B20C: - movs r0, 0x16 - bl PlaySE - b _0800B260 -_0800B214: - ldr r0, =gSerialIsRFU - ldrb r0, [r0] - cmp r0, 0x2 - bne _0800B244 - ldr r0, =gUnknown_082ED224 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - ldr r0, =gText_ABtnTitleScreen - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x3 - movs r2, 0x2 - movs r3, 0x14 - bl box_print - b _0800B260 - .pool -_0800B244: - cmp r0, 0x1 - bne _0800B260 - ldr r0, =gUnknown_082ED224 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - ldr r0, =gText_ABtnRegistrationCounter - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x3 - movs r2, 0x2 - movs r3, 0x14 - bl box_print -_0800B260: - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r0, r2 - ldrb r1, [r1] - cmp r1, 0xA0 - bne _0800B2D0 - ldr r4, =gSerialIsRFU - ldrb r2, [r4] - cmp r2, 0x1 - bne _0800B2A8 - ldrh r0, [r0, 0x2E] - ands r2, r0 - cmp r2, 0 - beq _0800B2C2 - movs r0, 0x15 - bl PlaySE - movs r0, 0 - strb r0, [r4] - ldr r1, =sLinkErrorBuffer - movs r0, 0 - strb r0, [r1, 0x6] - bl sub_81700F8 - b _0800B2C2 - .pool -_0800B2A8: - cmp r2, 0x2 - bne _0800B2C2 - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800B2C2 - bl rfu_REQ_stopMode - bl rfu_waitREQComplete - bl DoSoftReset -_0800B2C2: - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r0, r2 - ldrb r1, [r1] - cmp r1, 0xA0 - beq _0800B2DC -_0800B2D0: - movs r2, 0x87 - lsls r2, 3 - adds r1, r0, r2 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0800B2DC: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B1A0 - thumb_func_start sub_800B2E8 sub_800B2E8: @ 800B2E8 ldr r0, =0x04000128 @@ -346,7 +155,7 @@ _0800B3F4: thumb_func_start HandleLinkConnection HandleLinkConnection: @ 800B40C push {r4,r5,lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _0800B45C @@ -401,7 +210,7 @@ sub_800B488: @ 800B488 ldrb r0, [r0] cmp r0, 0 bne _0800B498 - ldr r1, =gSerialIsRFU + ldr r1, =gWirelessCommType movs r0, 0x1 strb r0, [r1] _0800B498: @@ -417,7 +226,7 @@ sub_800B4A4: @ 800B4A4 ldrb r1, [r0] cmp r1, 0 bne _0800B4B2 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType strb r1, [r0] _0800B4B2: pop {r0} @@ -432,7 +241,7 @@ sub_800B4C0: @ 800B4C0 ldrb r1, [r0] cmp r1, 0 bne _0800B4CE - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType strb r1, [r0] _0800B4CE: pop {r0} @@ -443,7 +252,7 @@ _0800B4CE: thumb_func_start sub_800B4DC sub_800B4DC: @ 800B4DC push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _0800B4FC @@ -477,7 +286,7 @@ _0800B514: thumb_func_start sub_800B518 sub_800B518: @ 800B518 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] bx lr .pool diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 934de184f..1e7f4a182 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -884,7 +884,7 @@ sub_800E3A8: @ 800E3A8 mov r5, r8 push {r5-r7} sub sp, 0x20 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _0800E3BE @@ -5967,7 +5967,7 @@ sub_8010DB4: @ 8010DB4 cmp r0, 0 beq _08010DE4 _08010DDE: - ldr r1, =gSerialIsRFU + ldr r1, =gWirelessCommType movs r0, 0x2 strb r0, [r1] _08010DE4: diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 1c84ba801..d6b331834 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -621,7 +621,7 @@ _080E726C: bne _080E730A movs r0, 0x4 strh r0, [r5] - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _080E7296 @@ -664,7 +664,7 @@ _080E72C0: ldr r0, [r0] bl Free bl sub_808729C - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080E72F8 @@ -2393,7 +2393,7 @@ _080E80C0: lsls r0, 24 cmp r0, 0 bne _080E810A - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080E80E8 diff --git a/asm/rom4.s b/asm/rom4.s index 819cbea81..575b18991 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -3395,7 +3395,7 @@ c2_8056854: @ 8086140 ldr r0, =c1_link_related bl set_callback1 bl sub_8086C2C - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08086174 @@ -3586,7 +3586,7 @@ sub_808631C: @ 808631C bne _0808632E bl CloseLink _0808632E: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08086348 @@ -3768,7 +3768,7 @@ _080864DA: bl cur_mapheader_run_tileset_funcs_after_some_cpuset b _08086506 _080864E0: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08086506 @@ -4056,7 +4056,7 @@ _08086766: bl cur_mapheader_run_tileset_funcs_after_some_cpuset b _08086792 _0808676C: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08086792 @@ -4565,7 +4565,7 @@ _08086BCA: thumb_func_start c1_link_related c1_link_related: @ 8086BD8 push {r4,lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08086BF2 @@ -4631,7 +4631,7 @@ c1_link_related_func_set: @ 8086C50 thumb_func_start sub_8086C64 sub_8086C64: @ 8086C64 push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08086C82 @@ -5029,7 +5029,7 @@ _08086FC0: movs r0, 0x11 strh r0, [r1] _08086FC6: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08086FFC @@ -5926,7 +5926,7 @@ _08087666: thumb_func_start sub_808766C sub_808766C: @ 808766C push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _08087688 @@ -5946,7 +5946,7 @@ _0808768A: thumb_func_start sub_8087690 sub_8087690: @ 8087690 push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _080876B0 diff --git a/asm/rom6.s b/asm/rom6.s index 20058db9d..d4ad771aa 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -11823,7 +11823,7 @@ _0813B790: b _0813B7C6 .pool _0813B7A8: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _0813B7B4 diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 5a7c8f77e..a0be88e11 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -27729,7 +27729,7 @@ sub_8020C70: @ 8020C70 ldrb r0, [r0] cmp r0, 0 beq _08020C8E - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _08020CAC diff --git a/asm/start_menu.s b/asm/start_menu.s index 0da38ba4b..072bcfdc7 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -1712,7 +1712,7 @@ _080A05AC: movs r2, 0x10 movs r3, 0 bl BeginNormalPaletteFade - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080A0620 diff --git a/asm/trade.s b/asm/trade.s index aafa9f245..25017bcfd 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -135,7 +135,7 @@ _08077258: thumb_func_start sub_8077260 sub_8077260: @ 8077260 push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08077280 @@ -409,7 +409,7 @@ _080774B2: ldr r0, [r0] adds r0, 0xA8 strb r2, [r0] - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08077528 @@ -531,7 +531,7 @@ _08077600: ldr r0, [r0] adds r0, 0xA8 strb r2, [r0] - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 bne _0807762A @@ -543,7 +543,7 @@ _0807762A: b _08077B46 .pool _08077648: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08077680 @@ -1182,7 +1182,7 @@ _08077C28: b _080780D8 .pool _08077C3C: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08077C50 @@ -1780,7 +1780,7 @@ sub_807816C: @ 807816C adds r0, 0x7E ldrb r0, [r0] strb r0, [r1, 0x1] - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080781B4 @@ -1809,7 +1809,7 @@ sub_80781C8: @ 80781C8 ldr r5, =gMain ldr r0, =sub_80773AC str r0, [r5, 0x8] - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08078220 @@ -4004,7 +4004,7 @@ sub_8079490: @ 8079490 ands r0, r1 cmp r0, 0 bne _080794C4 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _080794B4 @@ -4029,7 +4029,7 @@ _080794C4: thumb_func_start sub_80794CC sub_80794CC: @ 80794CC push {lr} - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _08079518 @@ -7507,7 +7507,7 @@ _0807B0F0: ands r0, r1 cmp r0, 0 bne _0807B116 - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _0807B110 @@ -13831,7 +13831,7 @@ _0807EDC0: movs r0, 0x15 bl IncrementGameStat _0807EDCE: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _0807EDF6 @@ -14044,7 +14044,7 @@ _0807EFA4: lsrs r0, 24 cmp r0, 0x1 bne _0807F03A - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _0807EFD8 @@ -14071,7 +14071,7 @@ _0807EFE4: b _0807F03A .pool _0807EFF0: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _0807F028 @@ -14141,7 +14141,7 @@ c2_080543C4: @ 807F068 ldr r0, [r4] bl Free str r5, [r4] - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0 beq _0807F0B6 diff --git a/asm/trainer_card.s b/asm/trainer_card.s index 4f1183477..ddb0271a6 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -187,7 +187,7 @@ _080C2830: bl sub_80C4630 b _080C28D4 _080C2836: - ldr r0, =gSerialIsRFU + ldr r0, =gWirelessCommType ldrb r0, [r0] cmp r0, 0x1 bne _080C2852 diff --git a/common_syms/link.txt b/common_syms/link.txt index 657f97396..564802b1a 100644 --- a/common_syms/link.txt +++ b/common_syms/link.txt @@ -16,7 +16,7 @@ gUnknown_030030EC gUnknown_030030F0 gUnknown_030030F4 gSuppressLinkErrorMessage -gSerialIsRFU +gWirelessCommType gSavedLinkPlayerCount gSendCmd gSavedMultiplayerId diff --git a/include/link.h b/include/link.h index 2689f2596..60f7a27fa 100644 --- a/include/link.h +++ b/include/link.h @@ -163,7 +163,7 @@ extern u8 gShouldAdvanceLinkState; extern struct LinkPlayer gLinkPlayers[]; extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; -extern bool8 gSerialIsRFU; +extern bool8 gWirelessCommType; void Task_DestroySelf(u8); void OpenLink(void); @@ -234,7 +234,7 @@ extern u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; extern u16 gUnknown_030030F4; extern u8 gSuppressLinkErrorMessage; -extern bool8 gSerialIsRFU; +extern bool8 gWirelessCommType; extern bool8 gSavedLinkPlayerCount; extern u8 gSavedMultiplayerId; extern struct LinkTestBGInfo gLinkTestBGInfo; diff --git a/include/reset_save_heap.h b/include/reset_save_heap.h new file mode 100644 index 000000000..12fd186ec --- /dev/null +++ b/include/reset_save_heap.h @@ -0,0 +1,12 @@ +#ifndef GUARD_RESET_SAVE_HEAP_H +#define GUARD_RESET_SAVE_HEAP_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations + +void sub_81700F8(void); + +#endif //GUARD_RESET_SAVE_HEAP_H diff --git a/include/strings.h b/include/strings.h index 299d637b8..f3efe88e4 100644 --- a/include/strings.h +++ b/include/strings.h @@ -77,5 +77,8 @@ extern const u8 gText_RegisteredDataDeleted[]; extern const u8 gUnknown_085EA79D[]; extern const u8 gText_CommErrorEllipsis[]; extern const u8 gText_MoveCloserToLinkPartner[]; +extern const u8 gText_CommErrorCheckConnections[]; +extern const u8 gText_ABtnTitleScreen[]; +extern const u8 gText_ABtnRegistrationCounter[]; #endif //GUARD_STRINGS_H diff --git a/src/battle_2.c b/src/battle_2.c index a69a16dac..41b2b1313 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -735,7 +735,7 @@ static void CB2_HandleStartBattle(void) sub_805EF14(); gBattleCommunication[MULTIUSE_STATE] = 1; } - if (gSerialIsRFU) + if (gWirelessCommType) sub_800E0E8(); break; case 1: @@ -759,7 +759,7 @@ static void CB2_HandleStartBattle(void) SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); gBattleCommunication[MULTIUSE_STATE] = 2; } - if (gSerialIsRFU) + if (gWirelessCommType) sub_800DFB4(0, 0); } } @@ -930,7 +930,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) sub_805EF14(); gBattleCommunication[MULTIUSE_STATE] = 1; } - if (gSerialIsRFU) + if (gWirelessCommType) sub_800E0E8(); // fall through case 1: @@ -961,7 +961,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) gBattleCommunication[MULTIUSE_STATE] = 2; } - if (gSerialIsRFU) + if (gWirelessCommType) sub_800DFB4(0, 0); } } @@ -1238,14 +1238,14 @@ static void CB2_PreInitMultiBattle(void) if (sub_800A520() && !gPaletteFade.active) { gBattleCommunication[MULTIUSE_STATE]++; - if (gSerialIsRFU) + if (gWirelessCommType) sub_800ADF8(); else sub_800AC34(); } break; case 3: - if (gSerialIsRFU) + if (gWirelessCommType) { if (sub_8010500()) { @@ -1330,7 +1330,7 @@ static void CB2_HandleStartMultiBattle(void) sub_805EF14(); gBattleCommunication[MULTIUSE_STATE] = 1; } - if (gSerialIsRFU) + if (gWirelessCommType) sub_800E0E8(); break; case 1: @@ -1348,7 +1348,7 @@ static void CB2_HandleStartMultiBattle(void) SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); gBattleCommunication[MULTIUSE_STATE]++; } - if (gSerialIsRFU) + if (gWirelessCommType) sub_800DFB4(0, 0); } } @@ -2133,12 +2133,12 @@ static void sub_8038F34(void) } break; case 8: - if (!gSerialIsRFU) + if (!gWirelessCommType) sub_800AC34(); gBattleCommunication[MULTIUSE_STATE]++; break; case 9: - if (!gMain.field_439_x4 || gSerialIsRFU || gReceivedRemoteLinkPlayers != 1) + if (!gMain.field_439_x4 || gWirelessCommType || gReceivedRemoteLinkPlayers != 1) { gMain.field_439_x4 = 0; SetMainCallback2(gMain.savedCallback); @@ -2317,13 +2317,13 @@ static void sub_803939C(void) case 8: if (--gBattleCommunication[1] == 0) { - if (gMain.field_439_x4 && !gSerialIsRFU) + if (gMain.field_439_x4 && !gWirelessCommType) sub_800AC34(); gBattleCommunication[MULTIUSE_STATE]++; } break; case 9: - if (!gMain.field_439_x4 || gSerialIsRFU || gReceivedRemoteLinkPlayers != 1) + if (!gMain.field_439_x4 || gWirelessCommType || gReceivedRemoteLinkPlayers != 1) { gMain.field_439_x4 = 0; if (!gPaletteFade.active) diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 2a882de99..9b6c3c46d 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -896,7 +896,7 @@ static void HandleMoveSwitchting(void) static void sub_80586F8(void) { - if (gSerialIsRFU == 0) + if (gWirelessCommType == 0) { if (gReceivedRemoteLinkPlayers == 0) { @@ -932,7 +932,7 @@ void sub_80587B0(void) { if (sub_800A520()) { - if (gSerialIsRFU == 0) + if (gWirelessCommType == 0) sub_800AC34(); else sub_800ADF8(); diff --git a/src/battle_controllers.c b/src/battle_controllers.c index b82a0a40e..b3d93d759 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -59,7 +59,7 @@ void HandleLinkBattleSetup(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - if (gSerialIsRFU) + if (gWirelessCommType) sub_800B488(); if (!gReceivedRemoteLinkPlayers) OpenLink(); @@ -780,7 +780,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId) gTasks[taskId].data[11]++; break; case 2: - if (gSerialIsRFU) + if (gWirelessCommType) { gTasks[taskId].data[11]++; } diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 569dcfe35..03b9dec3f 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -402,7 +402,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) } break; case 6: - if (gSerialIsRFU) + if (gWirelessCommType) { sub_800E0E8(); sub_800DFB4(0, 0); @@ -1185,7 +1185,7 @@ static void Task_TradeEvolutionScene(u8 taskID) case 5: if (!gPaletteFade.active) { - if (gSerialIsRFU) + if (gWirelessCommType) sub_800E084(); Free(GetBgTilemapBuffer(3)); diff --git a/src/link.c b/src/link.c index 09f3b6d6f..1ee4ade4f 100644 --- a/src/link.c +++ b/src/link.c @@ -3,6 +3,7 @@ #include "global.h" #include "m4a.h" #include "malloc.h" +#include "reset_save_heap.h" #include "save.h" #include "bg.h" #include "window.h" @@ -21,6 +22,7 @@ #include "new_menu_helpers.h" #include "text.h" #include "strings.h" +#include "songs.h" #include "sound.h" #include "trade.h" #include "battle.h" @@ -84,7 +86,7 @@ bool8 gUnknown_030030EC[MAX_LINK_PLAYERS]; bool8 gUnknown_030030F0[MAX_LINK_PLAYERS]; u16 gUnknown_030030F4; u8 gSuppressLinkErrorMessage; -bool8 gSerialIsRFU; +bool8 gWirelessCommType; bool8 gSavedLinkPlayerCount; u16 gSendCmd[8]; u8 gSavedMultiplayerId; @@ -148,7 +150,7 @@ static void sub_800AD88(void); static void sub_800AE30(void); static void sub_800AE5C(void); static void sub_800AEB4(void); -void sub_800B1A0(void); +static void sub_800B1A0(void); u8 sub_800B2F8(void); void sub_800B4A4(void); void DisableSerial(void); @@ -340,7 +342,7 @@ void OpenLink(void) { int i; - if (!gSerialIsRFU) + if (!gWirelessCommType) { ResetSerial(); InitLink(); @@ -372,7 +374,7 @@ void OpenLink(void) void CloseLink(void) { gReceivedRemoteLinkPlayers = FALSE; - if (gSerialIsRFU) + if (gWirelessCommType) { sub_800EDD4(); } @@ -692,7 +694,7 @@ void BuildSendCmd(u16 command) void sub_8009F18(void) { - if (gSerialIsRFU) + if (gWirelessCommType) { sub_800F804(); } @@ -701,7 +703,7 @@ void sub_8009F18(void) bool32 sub_8009F3C(void) { - if (gSerialIsRFU) + if (gWirelessCommType) { return sub_800F7E4(); } @@ -722,7 +724,7 @@ static void sub_8009F70(void) void ClearLinkCallback(void) { - if (gSerialIsRFU) + if (gWirelessCommType) { Rfu_set_zero(); } @@ -734,7 +736,7 @@ void ClearLinkCallback(void) void ClearLinkCallback_2(void) { - if (gSerialIsRFU) + if (gWirelessCommType) { Rfu_set_zero(); } @@ -746,7 +748,7 @@ void ClearLinkCallback_2(void) u8 GetLinkPlayerCount(void) { - if (gSerialIsRFU) + if (gWirelessCommType) { return sub_80104F4(); } @@ -1004,7 +1006,7 @@ static void sub_800A3F8(void) void sub_800A418(void) { gUnknown_020223C0 = 0; - if (gSerialIsRFU) + if (gWirelessCommType) { sub_800F850(); } @@ -1026,7 +1028,7 @@ void sub_800A458(void) u8 GetMultiplayerId(void) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { return rfu_get_multiplayer_id(); } @@ -1043,7 +1045,7 @@ u8 bitmask_all_link_players_but_self(void) bool8 SendBlock(u8 unused, const void *src, u16 size) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { return sub_800FE84(src, size); } @@ -1052,7 +1054,7 @@ bool8 SendBlock(u8 unused, const void *src, u16 size) bool8 sub_800A4D8(u8 a0) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { return sub_8010100(a0); } @@ -1067,7 +1069,7 @@ bool8 sub_800A4D8(u8 a0) bool8 sub_800A520(void) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { return sub_8010500(); } @@ -1076,7 +1078,7 @@ bool8 sub_800A520(void) u8 GetBlockReceivedStatus(void) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { return sub_800FCD8(); } @@ -1085,7 +1087,7 @@ u8 GetBlockReceivedStatus(void) static void SetBlockReceivedFlag(u8 who) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { sub_800F6FC(who); } @@ -1099,7 +1101,7 @@ void ResetBlockReceivedFlags(void) { int i; - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { for (i = 0; i < MAX_RFU_PLAYERS; i ++) { @@ -1117,7 +1119,7 @@ void ResetBlockReceivedFlags(void) void ResetBlockReceivedFlag(u8 who) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { sub_800F728(who); } @@ -1394,7 +1396,7 @@ u8 GetLinkPlayerCount_2(void) bool8 IsLinkMaster(void) { - if (gSerialIsRFU) + if (gWirelessCommType) { return Rfu_IsMaster(); } @@ -1408,7 +1410,7 @@ u8 sub_800ABE8(void) void sub_800ABF4(u16 a0) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { task_add_05_task_del_08FA224_when_no_RfuFunc(); } @@ -1425,7 +1427,7 @@ void sub_800ABF4(u16 a0) void sub_800AC34(void) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { task_add_05_task_del_08FA224_when_no_RfuFunc(); } @@ -1480,7 +1482,7 @@ static void sub_800ACAC(void) void sub_800AD10(void) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { task_add_05_task_del_08FA224_when_no_RfuFunc(); } @@ -1539,7 +1541,7 @@ static void sub_800AD88(void) void sub_800ADF8(void) { - if (gSerialIsRFU == TRUE) + if (gWirelessCommType == TRUE) { sub_8010434(); } @@ -1624,11 +1626,11 @@ void CB2_LinkError(void) FillPalette(0, 0, 2); ResetTasks(); remove_some_task(); - if (gSerialIsRFU) + if (gWirelessCommType) { if (!sLinkErrorBuffer.unk_06) { - gSerialIsRFU = 3; + gWirelessCommType = 3; } sub_800E604(); } @@ -1677,3 +1679,84 @@ void sub_800B080(void) CopyWindowToVram(0, 0); CopyWindowToVram(2, 3); } + +void sub_800B138(void) +{ + LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0); + FillWindowPixelBuffer(1, 0x00); + FillWindowPixelBuffer(2, 0x00); + box_print(1, 3, 2, 0, gUnknown_082ED224, 0, gText_CommErrorCheckConnections); + PutWindowTilemap(1); + PutWindowTilemap(2); + CopyWindowToVram(1, 0); + CopyWindowToVram(2, 3); +} + +static void sub_800B1A0(void) +{ + switch (gMain.state) + { + case 00: + if (sLinkErrorBuffer.unk_06) + { + sub_800B080(); + } + else + { + sub_800B138(); + } + break; + case 02: + ShowBg(0); + if (sLinkErrorBuffer.unk_06) + { + ShowBg(1); + } + break; + case 30: + PlaySE(SE_BOO); + break; + case 60: + PlaySE(SE_BOO); + break; + case 90: + PlaySE(SE_BOO); + break; + case 130: + if (gWirelessCommType == 2) + { + box_print(0, 3, 2, 20, gUnknown_082ED224, 0, gText_ABtnTitleScreen); + } + else if (gWirelessCommType == 1) + { + box_print(0, 3, 2, 20, gUnknown_082ED224, 0, gText_ABtnRegistrationCounter); + } + break; + } + if (gMain.state == 160) + { + if (gWirelessCommType == 1) + { + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_PIN); + gWirelessCommType = 0; + sLinkErrorBuffer.unk_06 = 0; + sub_81700F8(); + } + } + else if (gWirelessCommType == 2) + { + if (gMain.newKeys & A_BUTTON) + { + rfu_REQ_stopMode(); + rfu_waitREQComplete(); + DoSoftReset(); + } + } + } + if (gMain.state != 160) + { + gMain.state ++; + } +} diff --git a/src/main.c b/src/main.c index a67bed035..c2baa23af 100644 --- a/src/main.c +++ b/src/main.c @@ -336,7 +336,7 @@ extern void ProcessDma3Requests(void); static void VBlankIntr(void) { - if (gSerialIsRFU != FALSE) + if (gWirelessCommType != FALSE) LinkVSync(); else if (gLinkVSyncDisabled == FALSE) sub_800B9B8(); diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 87ad20ed7..b0f4dcbf4 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -177,7 +177,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void) ActionSelectionCreateCursorAt(gActionSelectionCursor[gBankInMenu], 0); - if (gSerialIsRFU != 0 && gReceivedRemoteLinkPlayers != 0) + if (gWirelessCommType != 0 && gReceivedRemoteLinkPlayers != 0) { sub_800E0E8(); sub_800DFB4(0, 0); From 8904f62cc846cf55fa9b3dea1f7607e039affee3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 00:15:31 -0500 Subject: [PATCH 041/123] through sub_800B33C --- asm/link.s | 61 ------------------------------------------------------ src/link.c | 29 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 63 deletions(-) diff --git a/asm/link.s b/asm/link.s index c5fcb39de..437f2e0c6 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,67 +5,6 @@ .text - thumb_func_start sub_800B2E8 -sub_800B2E8: @ 800B2E8 - ldr r0, =0x04000128 - ldrh r0, [r0] - lsrs r0, 2 - movs r1, 0x1 - ands r0, r1 - bx lr - .pool - thumb_func_end sub_800B2E8 - - thumb_func_start sub_800B2F8 -sub_800B2F8: @ 800B2F8 - push {lr} - movs r3, 0 - ldr r2, =0x04000128 - ldrh r1, [r2] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0800B314 - ldrh r1, [r2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _0800B314 - movs r3, 0x1 -_0800B314: - adds r0, r3, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_800B2F8 - - thumb_func_start sub_800B320 -sub_800B320: @ 800B320 - ldr r0, =gLinkStatus - ldr r0, [r0] - lsrs r0, 6 - movs r1, 0x1 - ands r0, r1 - bx lr - .pool - thumb_func_end sub_800B320 - - thumb_func_start SetSuppressLinkErrorMessage -SetSuppressLinkErrorMessage: @ 800B330 - ldr r1, =gSuppressLinkErrorMessage - strb r0, [r1] - bx lr - .pool - thumb_func_end SetSuppressLinkErrorMessage - - thumb_func_start sub_800B33C -sub_800B33C: @ 800B33C - ldr r0, =gLinkErrorOccurred - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800B33C - thumb_func_start sub_800B348 sub_800B348: @ 800B348 push {r4-r6,lr} diff --git a/src/link.c b/src/link.c index 1ee4ade4f..71efbf358 100644 --- a/src/link.c +++ b/src/link.c @@ -1663,7 +1663,7 @@ void CB2_LinkError(void) } } -void sub_800B080(void) +static void sub_800B080(void) { LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0); copy_decompressed_tile_data_to_vram_autofree(1, gWirelessLinkDisplayGfx, FALSE, 0, 0); @@ -1680,7 +1680,7 @@ void sub_800B080(void) CopyWindowToVram(2, 3); } -void sub_800B138(void) +static void sub_800B138(void) { LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0); FillWindowPixelBuffer(1, 0x00); @@ -1760,3 +1760,28 @@ static void sub_800B1A0(void) gMain.state ++; } } + +bool8 sub_800B2E8(void) +{ + return (REG_SIOCNT & 0x04) != 0; +} + +bool8 sub_800B2F8(void) +{ + return (REG_SIOCNT & 0x8) && !(REG_SIOCNT & 0x04); +} + +bool8 sub_800B320(void) +{ + return EXTRACT_CONN_ESTABLISHED(gLinkStatus); +} + +void SetSuppressLinkErrorMessage(bool8 flag) +{ + gSuppressLinkErrorMessage = flag; +} + +bool8 sub_800B33C(void) +{ + return gLinkErrorOccurred; +} From abec2b934054e21149bd7c0cb802875f9071c172 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 00:31:27 -0500 Subject: [PATCH 042/123] through sub_800B3A4 --- asm/link.s | 86 ------------------------------------------------------ src/link.c | 27 +++++++++++++++++ 2 files changed, 27 insertions(+), 86 deletions(-) diff --git a/asm/link.s b/asm/link.s index 437f2e0c6..11018c943 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,92 +5,6 @@ .text - thumb_func_start sub_800B348 -sub_800B348: @ 800B348 - push {r4-r6,lr} - bl InitLocalLinkPlayer - ldr r1, =gLocalLinkPlayerBlock - adds r2, r1, 0 - adds r2, 0x10 - ldr r0, =gLocalLinkPlayer - ldm r0!, {r3-r5} - stm r2!, {r3-r5} - ldm r0!, {r3,r4,r6} - stm r2!, {r3,r4,r6} - ldr r0, [r0] - str r0, [r2] - ldr r3, =gASCIIGameFreakInc - adds r2, r1, 0 - adds r0, r3, 0 - ldm r0!, {r4-r6} - stm r2!, {r4-r6} - ldrh r4, [r0] - strh r4, [r2] - ldrb r0, [r0, 0x2] - strb r0, [r2, 0x2] - adds r0, r1, 0 - adds r0, 0x2C - ldm r3!, {r2,r5,r6} - stm r0!, {r2,r5,r6} - ldrh r2, [r3] - strh r2, [r0] - ldrb r2, [r3, 0x2] - strb r2, [r0, 0x2] - ldr r0, =gBlockSendBuffer - movs r2, 0x3C - bl memcpy - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B348 - - thumb_func_start sub_800B3A4 -sub_800B3A4: @ 800B3A4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 8 - ldr r1, =gBlockRecvBuffer - adds r4, r2, r1 - lsls r2, r0, 3 - subs r2, r0 - lsls r2, 2 - ldr r0, =gLinkPlayers - adds r2, r0 - adds r1, r2, 0 - adds r0, r4, 0 - adds r0, 0x10 - ldm r0!, {r3,r5,r6} - stm r1!, {r3,r5,r6} - ldm r0!, {r3,r5,r6} - stm r1!, {r3,r5,r6} - ldr r0, [r0] - str r0, [r1] - adds r0, r2, 0 - bl sub_800B524 - ldr r5, =gASCIIGameFreakInc - adds r0, r4, 0 - adds r1, r5, 0 - bl strcmp - cmp r0, 0 - bne _0800B3EE - adds r0, r4, 0 - adds r0, 0x2C - adds r1, r5, 0 - bl strcmp - cmp r0, 0 - beq _0800B3F4 -_0800B3EE: - ldr r0, =CB2_LinkError - bl SetMainCallback2 -_0800B3F4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B3A4 - thumb_func_start HandleLinkConnection HandleLinkConnection: @ 800B40C push {r4,r5,lr} diff --git a/src/link.c b/src/link.c index 71efbf358..af31b37f6 100644 --- a/src/link.c +++ b/src/link.c @@ -1785,3 +1785,30 @@ bool8 sub_800B33C(void) { return gLinkErrorOccurred; } + +void sub_800B348(void) +{ + struct LinkPlayerBlock *block; + + InitLocalLinkPlayer(); + block = &gLocalLinkPlayerBlock; + block->linkPlayer = gLocalLinkPlayer; + memcpy(block->magic1, gASCIIGameFreakInc, sizeof(block->magic1) - 1); + memcpy(block->magic2, gASCIIGameFreakInc, sizeof(block->magic2) - 1); + memcpy(gBlockSendBuffer, block, sizeof(*block)); +} + +void sub_800B3A4(u8 who) +{ + struct LinkPlayerBlock *block; + struct LinkPlayer *player; + + block = (struct LinkPlayerBlock *)gBlockRecvBuffer[who]; + player = &gLinkPlayers[who]; + *player = block->linkPlayer; + sub_800B524(player); + if (strcmp(block->magic1, gASCIIGameFreakInc) != 0 || strcmp(block->magic2, gASCIIGameFreakInc) != 0) + { + SetMainCallback2(CB2_LinkError); + } +} From 7e4cb5f332de1d72fc57be82f4eca0ecd5db5f8d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 01:01:27 -0500 Subject: [PATCH 043/123] HandleLinkConnection --- asm/link.s | 51 -------------------------------------------- include/agb_flash.h | 12 +++++++++++ include/crt0.h | 11 ++++++++++ include/intro.h | 11 ++++++++++ include/link.h | 5 ++--- include/link_rfu.h | 5 +++++ include/load_save.h | 3 ++- include/m4a.h | 1 + include/overworld.h | 4 ++++ src/link.c | 30 ++++++++++++++++++++++++++ src/main.c | 52 ++++++++++++++------------------------------- 11 files changed, 94 insertions(+), 91 deletions(-) create mode 100644 include/agb_flash.h create mode 100644 include/crt0.h create mode 100644 include/intro.h diff --git a/asm/link.s b/asm/link.s index 11018c943..9a617995f 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,57 +5,6 @@ .text - thumb_func_start HandleLinkConnection -HandleLinkConnection: @ 800B40C - push {r4,r5,lr} - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - bne _0800B45C - ldr r0, =gShouldAdvanceLinkState - ldr r1, =gSendCmd - ldr r2, =gRecvCmds - bl sub_800B638 - ldr r4, =gLinkStatus - str r0, [r4] - ldr r0, =gMain+0x2c - bl LinkMain2 - ldr r0, [r4] - movs r1, 0x80 - lsls r1, 1 - ands r0, r1 - cmp r0, 0 - beq _0800B480 - bl sub_808766C - cmp r0, 0x1 - bne _0800B480 -_0800B43E: - movs r0, 0x1 - b _0800B482 - .pool -_0800B45C: - bl sub_8010EC0 - adds r4, r0, 0 - bl sub_8010F1C - adds r5, r0, 0 - bl sub_808766C - cmp r0, 0x1 - bne _0800B480 - cmp r4, 0x1 - beq _0800B43E - bl sub_800F0B8 - cmp r0, 0 - bne _0800B43E - cmp r5, 0 - bne _0800B43E -_0800B480: - movs r0, 0 -_0800B482: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end HandleLinkConnection - thumb_func_start sub_800B488 sub_800B488: @ 800B488 push {lr} diff --git a/include/agb_flash.h b/include/agb_flash.h new file mode 100644 index 000000000..27e45e8fa --- /dev/null +++ b/include/agb_flash.h @@ -0,0 +1,12 @@ +#ifndef GUARD_AGB_FLASH_H +#define GUARD_AGB_FLASH_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations + +u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void)); + +#endif //GUARD_AGB_FLASH_H diff --git a/include/crt0.h b/include/crt0.h new file mode 100644 index 000000000..3121eeaed --- /dev/null +++ b/include/crt0.h @@ -0,0 +1,11 @@ +#ifndef GUARD_CRT0_H +#define GUARD_CRT0_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations +extern u32 IntrMain[]; + +#endif //GUARD_CRT0_H diff --git a/include/intro.h b/include/intro.h new file mode 100644 index 000000000..3a0fee07f --- /dev/null +++ b/include/intro.h @@ -0,0 +1,11 @@ +#ifndef GUARD_INTRO_H +#define GUARD_INTRO_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations +void c2_copyright_1(void); + +#endif //GUARD_INTRO_H diff --git a/include/link.h b/include/link.h index 60f7a27fa..50a74e612 100644 --- a/include/link.h +++ b/include/link.h @@ -159,7 +159,6 @@ extern u16 gLinkType; extern u32 gLinkStatus; extern u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2]; extern u16 gSendCmd[CMD_LENGTH]; -extern u8 gShouldAdvanceLinkState; extern struct LinkPlayer gLinkPlayers[]; extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; @@ -200,7 +199,6 @@ void LinkVSync(void); void Timer3Intr(void); void SerialCB(void); u8 GetLinkPlayerCount(void); - void sub_800E0E8(void); bool8 sub_800A520(void); void sub_800DFB4(u8, u8); @@ -210,7 +208,7 @@ void sub_800A620(void); void sub_8011BD0(void); u8 IsLinkMaster(void); void sub_800AC34(void); - +bool8 HandleLinkConnection(void); void SetLinkDebugValues(u32 seed, u32 flags); void sub_800A418(void); void SetSuppressLinkErrorMessage(bool8 flag); @@ -218,6 +216,7 @@ void sub_800B524(struct LinkPlayer *linkPlayer); u8 sub_800B2E8(void); u8 sub_800B320(void); u8 sub_800B33C(void); +void sub_800B9B8(void); extern u16 gUnknown_03003020[6]; extern u32 gLinkDebugSeed; diff --git a/include/link_rfu.h b/include/link_rfu.h index 1f29d863d..a63e07745 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -25,5 +25,10 @@ bool8 Rfu_IsMaster(void); void task_add_05_task_del_08FA224_when_no_RfuFunc(void); void sub_8010434(void); void sub_800E604(void); +void sub_800E174(void); +void sub_800E6D0(void); +bool32 sub_8010EC0(void); +bool32 sub_8010F1C(void); +bool32 sub_800F0B8(void); #endif //GUARD_LINK_RFU_H diff --git a/include/load_save.h b/include/load_save.h index 1f406bbad..92c99fd90 100644 --- a/include/load_save.h +++ b/include/load_save.h @@ -2,6 +2,8 @@ #define GUARD_LOAD_SAVE_H extern bool32 gFlashMemoryPresent; +extern struct SaveBlock2 gSaveblock2; +extern struct PokemonStorage gPokemonStorage; void ClearSav2(void); void ClearSav1(void); @@ -19,6 +21,5 @@ void LoadSerializedGame(void); void LoadPlayerBag(void); void SavePlayerBag(void); void SetSaveBlocksPointers(u16); -void MoveSaveBlocks_ResetHeap(void); #endif // GUARD_LOAD_SAVE_H diff --git a/include/m4a.h b/include/m4a.h index 316b85082..ad81028f7 100644 --- a/include/m4a.h +++ b/include/m4a.h @@ -20,5 +20,6 @@ void m4aMPlayImmInit(struct MusicPlayerInfo *mplayInfo); extern struct MusicPlayerInfo gMPlay_SE1; extern struct MusicPlayerInfo gMPlay_SE2; extern struct MusicPlayerInfo gMPlay_SE3; +extern struct SoundInfo gSoundInfo; #endif //GUARD_M4A_H diff --git a/include/overworld.h b/include/overworld.h index 45723c3e9..11aadaf0e 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -66,4 +66,8 @@ void c2_load_new_map(void); void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused); void mapldr_default(void); +bool32 sub_80875C8(void); +bool32 sub_8087634(void); +bool32 sub_808766C(void); + #endif //GUARD_ROM4_H diff --git a/src/link.c b/src/link.c index af31b37f6..ecaeafd97 100644 --- a/src/link.c +++ b/src/link.c @@ -152,6 +152,7 @@ static void sub_800AE5C(void); static void sub_800AEB4(void); static void sub_800B1A0(void); u8 sub_800B2F8(void); +u32 sub_800B638(bool8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[8]); void sub_800B4A4(void); void DisableSerial(void); void EnableSerial(void); @@ -1812,3 +1813,32 @@ void sub_800B3A4(u8 who) SetMainCallback2(CB2_LinkError); } } + +bool8 HandleLinkConnection(void) +{ + bool32 r4; + bool32 r5; + + if (gWirelessCommType == 0) + { + gLinkStatus = sub_800B638(&gShouldAdvanceLinkState, gSendCmd, gRecvCmds); + LinkMain2(&gMain.heldKeys); + if ((gLinkStatus & LINK_STAT_RECEIVED_NOTHING) && sub_808766C() == TRUE) + { + return TRUE; + } + } + else + { + r4 = sub_8010EC0(); + r5 = sub_8010F1C(); + if (sub_808766C() == TRUE) + { + if (r4 == TRUE || sub_800F0B8() || r5) + { + return TRUE; + } + } + } + return FALSE; +} diff --git a/src/main.c b/src/main.c index c2baa23af..00dd99dc3 100644 --- a/src/main.c +++ b/src/main.c @@ -1,50 +1,30 @@ #include "global.h" -#include "main.h" +#include "crt0.h" +#include "malloc.h" #include "link.h" +#include "link_rfu.h" +#include "librfu.h" #include "m4a.h" +#include "bg.h" #include "rtc.h" +#include "unknown_task.h" #include "rng.h" +#include "overworld.h" +#include "play_time.h" #include "dma3.h" #include "gba/flash_internal.h" +#include "load_save.h" +#include "gpu_regs.h" +#include "agb_flash.h" +#include "sound.h" #include "battle.h" +#include "battle_controllers.h" +#include "text.h" +#include "intro.h" +#include "main.h" -extern u16 GetGpuReg(u8); -extern void SetGpuReg(u8, u16); -extern void LinkVSync(void); -extern void sub_800E174(void); -extern void sub_800B9B8(void); -extern void InitGpuRegManager(void); -extern void sub_800E6D0(void); -extern void CheckForFlashMemory(void); -extern void InitMapMusic(void); -extern void ResetBgs(void); -extern void SetDefaultFontsPointer(void); -extern void InitHeap(void *heapStart, u32 heapSize); // malloc.h -extern void rfu_REQ_stopMode(void); -extern void rfu_waitREQComplete(void); -extern bool32 sub_8087634(void); -extern bool32 sub_80875C8(void); -extern void ClearSpriteCopyRequests(void); -extern void PlayTimeCounter_Update(void); -extern void MapMusicMain(void); -extern void EnableInterrupts(u16); -extern void sub_8033648(void); -extern u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void)); -extern void remove_some_task(void); - -extern struct SoundInfo gSoundInfo; -extern u32 gFlashMemoryPresent; -extern u32 IntrMain[]; -extern u8 gHeap[]; -extern struct SaveBlock2 gSaveblock2; -extern struct PokemonStorage gPokemonStorage; -extern u32 gBattleTypeFlags; extern u32 *gUnknown_0203CF5C; -void Timer3Intr(void); -bool8 HandleLinkConnection(void); -void c2_copyright_1(void); - static void VBlankIntr(void); static void HBlankIntr(void); static void VCountIntr(void); From 515459d151bcc9b4f046a93a77e8e9412a2f2ca4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 01:04:31 -0500 Subject: [PATCH 044/123] through sub_800B4C0 --- asm/link.s | 46 ---------------------------------------------- src/link.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 49 deletions(-) diff --git a/asm/link.s b/asm/link.s index 9a617995f..6c7b3ff4a 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,52 +5,6 @@ .text - thumb_func_start sub_800B488 -sub_800B488: @ 800B488 - push {lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0800B498 - ldr r1, =gWirelessCommType - movs r0, 0x1 - strb r0, [r1] -_0800B498: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B488 - - thumb_func_start sub_800B4A4 -sub_800B4A4: @ 800B4A4 - push {lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r1, [r0] - cmp r1, 0 - bne _0800B4B2 - ldr r0, =gWirelessCommType - strb r1, [r0] -_0800B4B2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B4A4 - - thumb_func_start sub_800B4C0 -sub_800B4C0: @ 800B4C0 - push {lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r1, [r0] - cmp r1, 0 - bne _0800B4CE - ldr r0, =gWirelessCommType - strb r1, [r0] -_0800B4CE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B4C0 - thumb_func_start sub_800B4DC sub_800B4DC: @ 800B4DC push {lr} diff --git a/src/link.c b/src/link.c index ecaeafd97..44d96937e 100644 --- a/src/link.c +++ b/src/link.c @@ -151,9 +151,9 @@ static void sub_800AE30(void); static void sub_800AE5C(void); static void sub_800AEB4(void); static void sub_800B1A0(void); -u8 sub_800B2F8(void); +static bool8 sub_800B2F8(void); u32 sub_800B638(bool8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[8]); -void sub_800B4A4(void); +static void sub_800B4A4(void); void DisableSerial(void); void EnableSerial(void); @@ -1767,7 +1767,7 @@ bool8 sub_800B2E8(void) return (REG_SIOCNT & 0x04) != 0; } -bool8 sub_800B2F8(void) +static bool8 sub_800B2F8(void) { return (REG_SIOCNT & 0x8) && !(REG_SIOCNT & 0x04); } @@ -1842,3 +1842,27 @@ bool8 HandleLinkConnection(void) } return FALSE; } + +void sub_800B488(void) +{ + if (gReceivedRemoteLinkPlayers == 0) + { + gWirelessCommType = 1; + } +} + +static void sub_800B4A4(void) +{ + if (gReceivedRemoteLinkPlayers == 0) + { + gWirelessCommType = 0; + } +} + +void sub_800B4C0(void) +{ + if (gReceivedRemoteLinkPlayers == 0) + { + gWirelessCommType = 0; + } +} From fcb8c8cf32f424bf83c8e95555ac41598e71104c Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 01:12:34 -0500 Subject: [PATCH 045/123] through sub_800B524 --- asm/link.s | 57 ---------------------------------------------- include/link.h | 42 +++++++++++++++++----------------- include/link_rfu.h | 1 + src/link.c | 29 +++++++++++++++++++++++ 4 files changed, 51 insertions(+), 78 deletions(-) diff --git a/asm/link.s b/asm/link.s index 6c7b3ff4a..c1e8a4904 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,63 +5,6 @@ .text - thumb_func_start sub_800B4DC -sub_800B4DC: @ 800B4DC - push {lr} - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - bne _0800B4FC - ldr r0, =gLink - ldr r1, =0x00000fbd - adds r0, r1 - ldrb r0, [r0] - b _0800B500 - .pool -_0800B4FC: - bl sub_80124D4 -_0800B500: - pop {r1} - bx r1 - thumb_func_end sub_800B4DC - - thumb_func_start sub_800B504 -sub_800B504: @ 800B504 - push {lr} - bl sub_800B4DC - cmp r0, 0x2 - bhi _0800B512 - movs r0, 0 - b _0800B514 -_0800B512: - movs r0, 0x1 -_0800B514: - pop {r1} - bx r1 - thumb_func_end sub_800B504 - - thumb_func_start sub_800B518 -sub_800B518: @ 800B518 - ldr r0, =gWirelessCommType - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800B518 - - thumb_func_start sub_800B524 -sub_800B524: @ 800B524 - push {lr} - ldrb r1, [r0, 0x10] - strb r1, [r0, 0x12] - adds r2, r0, 0 - adds r2, 0x8 - ldrb r1, [r0, 0x1A] - adds r0, r2, 0 - bl ConvertInternationalString - pop {r0} - bx r0 - thumb_func_end sub_800B524 - thumb_func_start DisableSerial DisableSerial: @ 800B53C push {lr} diff --git a/include/link.h b/include/link.h index 50a74e612..edbf0be38 100644 --- a/include/link.h +++ b/include/link.h @@ -104,9 +104,9 @@ struct LinkPlayerBlock struct SendQueue { - u16 data[CMD_LENGTH][QUEUE_CAPACITY]; - u8 pos; - u8 count; + /* 0x000 */ u16 data[CMD_LENGTH][QUEUE_CAPACITY]; + /* 0x320 */ u8 pos; + /* 0x321 */ u8 count; }; struct RecvQueue @@ -118,29 +118,29 @@ struct RecvQueue struct Link { - u8 isMaster; // 0: slave, 8: master - u8 state; - u8 localId; // local multi-player ID - u8 playerCount; - u16 tempRecvBuffer[4]; - bool8 receivedNothing; - s8 serialIntrCounter; - bool8 handshakeAsMaster; - u8 link_field_F; + /* 0x000 */ u8 isMaster; // 0: slave, 8: master + /* 0x001 */ u8 state; + /* 0x002 */ u8 localId; // local multi-player ID + /* 0x003 */ u8 playerCount; + /* 0x004 */ u16 tempRecvBuffer[4]; + /* 0x00c */ bool8 receivedNothing; + /* 0x00d */ s8 serialIntrCounter; + /* 0x00e */ bool8 handshakeAsMaster; + /* 0x00f */ u8 link_field_F; // error conditions - bool8 hardwareError; // hardware reported an error - bool8 badChecksum; // checksum didn't match between devices - u8 queueFull; // send or recv queue out of space - u8 lag; // connection is lagging + /* 0x010 */ bool8 hardwareError; // hardware reported an error + /* 0x011 */ bool8 badChecksum; // checksum didn't match between devices + /* 0x012 */ u8 queueFull; // send or recv queue out of space + /* 0x013 */ u8 lag; // connection is lagging - u16 checksum; + /* 0x014 */ u16 checksum; - u8 sendCmdIndex; - u8 recvCmdIndex; + /* 0x016 */ u8 sendCmdIndex; + /* 0x017 */ u8 recvCmdIndex; - struct SendQueue sendQueue; - struct RecvQueue recvQueue; + /* 0x018 */ struct SendQueue sendQueue; + /* 0x33c */ struct RecvQueue recvQueue; }; struct BlockRequest diff --git a/include/link_rfu.h b/include/link_rfu.h index a63e07745..2062b3a79 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -30,5 +30,6 @@ void sub_800E6D0(void); bool32 sub_8010EC0(void); bool32 sub_8010F1C(void); bool32 sub_800F0B8(void); +u32 sub_80124D4(void); #endif //GUARD_LINK_RFU_H diff --git a/src/link.c b/src/link.c index 44d96937e..266c7109d 100644 --- a/src/link.c +++ b/src/link.c @@ -1866,3 +1866,32 @@ void sub_800B4C0(void) gWirelessCommType = 0; } } + +u32 sub_800B4DC(void) +{ + if (gWirelessCommType != 0) + { + return sub_80124D4(); + } + return gLink.recvQueue.count; +} + +bool8 sub_800B504(void) +{ + if (sub_800B4DC() > 2) + { + return TRUE; + } + return FALSE; +} + +u8 sub_800B518(void) +{ + return gWirelessCommType; +} + +void sub_800B524(struct LinkPlayer *player) +{ + player->name[10] = player->name[8]; + ConvertInternationalString(player->name, player->language); +} From 910c39d4ef3fbb752188b83b565effce14136ddf Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 01:20:38 -0500 Subject: [PATCH 046/123] DisableSerial --- asm/link.s | 35 ----------------------------------- include/link.h | 4 ++-- src/link.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/asm/link.s b/asm/link.s index c1e8a4904..68b29166c 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,41 +5,6 @@ .text - thumb_func_start DisableSerial -DisableSerial: @ 800B53C - push {lr} - sub sp, 0x4 - movs r0, 0xC0 - bl DisableInterrupts - ldr r1, =0x04000128 - movs r2, 0x80 - lsls r2, 6 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =0x0400010e - movs r2, 0 - strh r2, [r0] - adds r1, 0xDA - movs r0, 0xC0 - strh r0, [r1] - ldr r0, =0x0400012a - strh r2, [r0] - ldr r2, =0x04000120 - movs r0, 0 - movs r1, 0 - str r0, [r2] - str r1, [r2, 0x4] - str r0, [sp] - ldr r1, =gLink - ldr r2, =0x050003f0 - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end DisableSerial - thumb_func_start EnableSerial EnableSerial: @ 800B594 push {r4,r5,lr} diff --git a/include/link.h b/include/link.h index edbf0be38..38c2f1388 100644 --- a/include/link.h +++ b/include/link.h @@ -95,9 +95,9 @@ struct LinkPlayer struct LinkPlayerBlock { - u8 magic1[16]; + char magic1[16]; struct LinkPlayer linkPlayer; - u8 magic2[16]; + char magic2[16]; }; // circular queues diff --git a/src/link.c b/src/link.c index 266c7109d..3839a0194 100644 --- a/src/link.c +++ b/src/link.c @@ -1895,3 +1895,14 @@ void sub_800B524(struct LinkPlayer *player) player->name[10] = player->name[8]; ConvertInternationalString(player->name, player->language); } + +void DisableSerial(void) +{ + DisableInterrupts(INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); + REG_SIOCNT = SIO_MULTI_MODE; + REG_TMCNT_H(3) = 0; + REG_IF = INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL; + REG_SIOMLT_SEND = 0; + REG_SIOMLT_RECV = 0; + CpuFill32(0, &gLink, sizeof(gLink)); +} From 2be3083b3ee71e2287d4ecc6d3b8b9b3558b8740 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 01:24:28 -0500 Subject: [PATCH 047/123] through ResetSerial --- asm/link.s | 59 ------------------------------------------------------ src/link.c | 24 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 59 deletions(-) diff --git a/asm/link.s b/asm/link.s index 68b29166c..8ae822c47 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,65 +5,6 @@ .text - thumb_func_start EnableSerial -EnableSerial: @ 800B594 - push {r4,r5,lr} - sub sp, 0x4 - movs r0, 0xC0 - bl DisableInterrupts - ldr r0, =0x04000134 - movs r4, 0 - strh r4, [r0] - ldr r2, =0x04000128 - movs r1, 0x80 - lsls r1, 6 - adds r0, r1, 0 - strh r0, [r2] - ldrh r0, [r2] - ldr r3, =0x00004003 - adds r1, r3, 0 - orrs r0, r1 - strh r0, [r2] - movs r0, 0x80 - bl EnableInterrupts - ldr r0, =0x0400012a - strh r4, [r0] - movs r5, 0 - str r5, [sp] - ldr r1, =gLink - ldr r2, =0x050003f0 - mov r0, sp - bl CpuSet - ldr r0, =gUnknown_03000D6C - strb r4, [r0] - ldr r0, =gUnknown_03000D6E - strh r5, [r0] - ldr r0, =gUnknown_03000D70 - strh r5, [r0] - ldr r0, =gUnknown_03000D72 - strb r4, [r0] - ldr r0, =gUnknown_03000D73 - strb r4, [r0] - ldr r0, =gLastSendQueueCount - strb r4, [r0] - ldr r0, =gLastRecvQueueCount - strb r4, [r0] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end EnableSerial - - thumb_func_start ResetSerial -ResetSerial: @ 800B628 - push {lr} - bl EnableSerial - bl DisableSerial - pop {r0} - bx r0 - thumb_func_end ResetSerial - thumb_func_start sub_800B638 sub_800B638: @ 800B638 push {r4-r7,lr} diff --git a/src/link.c b/src/link.c index 3839a0194..3da48a951 100644 --- a/src/link.c +++ b/src/link.c @@ -1906,3 +1906,27 @@ void DisableSerial(void) REG_SIOMLT_RECV = 0; CpuFill32(0, &gLink, sizeof(gLink)); } + +void EnableSerial(void) +{ + DisableInterrupts(INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); + REG_RCNT = 0; + REG_SIOCNT = SIO_MULTI_MODE; + REG_SIOCNT |= SIO_115200_BPS | SIO_INTR_ENABLE; + EnableInterrupts(INTR_FLAG_SERIAL); + REG_SIOMLT_SEND = 0; + CpuFill32(0, &gLink, sizeof(gLink)); + gUnknown_03000D6C = 0; + gUnknown_03000D6E = 0; + gUnknown_03000D70 = 0; + gUnknown_03000D72 = 0; + gUnknown_03000D73 = 0; + gLastSendQueueCount = 0; + gLastRecvQueueCount = 0; +} + +void ResetSerial(void) +{ + EnableSerial(); + DisableSerial(); +} From c81d50cb2f57eb7d3121e71552c196f5867674cb Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 01:46:22 -0500 Subject: [PATCH 048/123] LinkMain1 --- asm/cable_club.s | 8 +-- asm/link.s | 145 -------------------------------------- asm/mystery_event_menu.s | 2 +- asm/pokenav.s | 6 +- asm/trade.s | 6 +- include/link.h | 7 +- src/link.c | 147 +++++++++++++++++++++++++++++++++------ 7 files changed, 137 insertions(+), 184 deletions(-) diff --git a/asm/cable_club.s b/asm/cable_club.s index ae818fdc9..f892b2ca4 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -205,7 +205,7 @@ sub_80B24F8: @ 80B24F8 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl sub_800B33C + bl HasLinkErrorOccurred lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -239,7 +239,7 @@ sub_80B252C: @ 80B252C ands r0, r1 cmp r0, 0 beq _080B2570 - bl sub_800B320 + bl IsLinkConnectionEstablished lsls r0, 24 lsrs r1, r0, 24 cmp r1, 0 @@ -269,7 +269,7 @@ sub_80B2578: @ 80B2578 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl sub_800B320 + bl IsLinkConnectionEstablished lsls r0, 24 cmp r0, 0 beq _080B258E @@ -309,7 +309,7 @@ sub_80B25CC: @ 80B25CC push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl sub_800B2E8 + bl GetSioMultiSI lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 diff --git a/asm/link.s b/asm/link.s index 8ae822c47..3188bcb42 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,151 +5,6 @@ .text - thumb_func_start sub_800B638 -sub_800B638: @ 800B638 - push {r4-r7,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r0, =gLink - ldrb r0, [r0, 0x1] - cmp r0, 0x4 - bhi _0800B6EA - lsls r0, 2 - ldr r1, =_0800B65C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800B65C: - .4byte _0800B670 - .4byte _0800B680 - .4byte _0800B698 - .4byte _0800B6D4 - .4byte _0800B6DE -_0800B670: - bl DisableSerial - ldr r1, =gLink - movs r0, 0x1 - strb r0, [r1, 0x1] - b _0800B6EA - .pool -_0800B680: - ldrb r0, [r4] - cmp r0, 0x1 - bne _0800B6EA - bl EnableSerial - ldr r1, =gLink - movs r0, 0x2 - strb r0, [r1, 0x1] - b _0800B6EA - .pool -_0800B698: - ldrb r1, [r4] - cmp r1, 0x1 - beq _0800B6A8 - cmp r1, 0x2 - beq _0800B6C0 - bl sub_800B764 - b _0800B6EA -_0800B6A8: - ldr r2, =gLink - ldrb r0, [r2] - cmp r0, 0x8 - bne _0800B6EA - ldrb r0, [r2, 0x3] - cmp r0, 0x1 - bls _0800B6EA - strb r1, [r2, 0xE] - b _0800B6EA - .pool -_0800B6C0: - ldr r0, =gLink - movs r1, 0 - strb r1, [r0, 0x1] - ldr r0, =0x0400012a - strh r1, [r0] - b _0800B6EA - .pool -_0800B6D4: - bl sub_800B790 - ldr r1, =gLink - movs r0, 0x4 - strb r0, [r1, 0x1] -_0800B6DE: - adds r0, r5, 0 - bl sub_800B7C0 - adds r0, r6, 0 - bl sub_800B8A8 -_0800B6EA: - movs r0, 0 - strb r0, [r4] - ldr r1, =gLink - ldrb r2, [r1, 0x2] - ldrb r0, [r1, 0x3] - lsls r0, 2 - orrs r2, r0 - ldrb r0, [r1] - cmp r0, 0x8 - bne _0800B702 - movs r0, 0x20 - orrs r2, r0 -_0800B702: - ldrb r0, [r1, 0xC] - lsls r3, r0, 8 - ldrb r0, [r1, 0xF] - lsls r4, r0, 9 - ldrb r0, [r1, 0x10] - lsls r5, r0, 12 - ldrb r0, [r1, 0x11] - lsls r6, r0, 13 - ldrb r0, [r1, 0x12] - lsls r7, r0, 14 - ldrb r0, [r1, 0x1] - cmp r0, 0x4 - bne _0800B728 - movs r0, 0x40 - orrs r0, r3 - orrs r0, r2 - b _0800B72C - .pool -_0800B728: - adds r0, r2, 0 - orrs r0, r3 -_0800B72C: - orrs r0, r4 - orrs r0, r5 - orrs r0, r6 - orrs r0, r7 - adds r2, r0, 0 - ldrb r3, [r1, 0x13] - cmp r3, 0x1 - bne _0800B742 - movs r0, 0x80 - lsls r0, 9 - orrs r2, r0 -_0800B742: - ldrb r0, [r1, 0x2] - cmp r0, 0x3 - bls _0800B74E - movs r0, 0x80 - lsls r0, 10 - orrs r2, r0 -_0800B74E: - adds r1, r2, 0 - cmp r3, 0x2 - bne _0800B75A - movs r0, 0x80 - lsls r0, 11 - orrs r1, r0 -_0800B75A: - adds r0, r1, 0 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800B638 - thumb_func_start sub_800B764 sub_800B764: @ 800B764 push {lr} diff --git a/asm/mystery_event_menu.s b/asm/mystery_event_menu.s index 4915c199c..cc2744ba0 100644 --- a/asm/mystery_event_menu.s +++ b/asm/mystery_event_menu.s @@ -333,7 +333,7 @@ _08178C42: adds r1, r4, r0 b _08178D1E _08178C54: - bl sub_800B320 + bl IsLinkConnectionEstablished lsls r0, 24 cmp r0, 0 beq _08178D00 diff --git a/asm/pokenav.s b/asm/pokenav.s index 98a0a4951..929e07295 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -28157,7 +28157,7 @@ sub_81D4EE4: @ 81D4EE4 lsrs r0, 24 cmp r0, 0x2 bhi _081D4F08 - bl sub_800B33C + bl HasLinkErrorOccurred lsls r0, 24 cmp r0, 0 beq _081D4F08 @@ -28248,7 +28248,7 @@ _081D4FA0: movs r0, 0x5 b _081D500E _081D4FB6: - bl sub_800B320 + bl IsLinkConnectionEstablished lsls r0, 24 cmp r0, 0 beq _081D500C @@ -28665,7 +28665,7 @@ _081D5360: strb r0, [r4, 0x8] b _081D548A _081D536A: - bl sub_800B33C + bl HasLinkErrorOccurred lsls r0, 24 cmp r0, 0 beq _081D537A diff --git a/asm/trade.s b/asm/trade.s index 25017bcfd..a5e7cf4ce 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -12856,7 +12856,7 @@ _0807E4AE: _0807E4B2: strb r0, [r1] _0807E4B4: - bl sub_800B33C + bl HasLinkErrorOccurred lsls r0, 24 cmp r0, 0 bne _0807E4C2 @@ -14099,7 +14099,7 @@ _0807F028: ldr r0, =c2_080543C4 bl SetMainCallback2 _0807F03A: - bl sub_800B33C + bl HasLinkErrorOccurred lsls r0, 24 cmp r0, 0 bne _0807F048 @@ -14883,7 +14883,7 @@ _0807F6F8: ldr r0, =c2_080543C4 bl SetMainCallback2 _0807F70C: - bl sub_800B33C + bl HasLinkErrorOccurred lsls r0, 24 cmp r0, 0 bne _0807F71A diff --git a/include/link.h b/include/link.h index 38c2f1388..88f638d78 100644 --- a/include/link.h +++ b/include/link.h @@ -153,7 +153,6 @@ extern const struct BlockRequest sBlockRequestLookupTable[5]; extern struct Link gLink; extern u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH]; -extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; // gBlockSendBuffer extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; extern u16 gLinkType; extern u32 gLinkStatus; @@ -194,7 +193,7 @@ bool8 IsLinkConnectionEstablished(void); void SetSuppressLinkErrorMessage(bool8); bool8 HasLinkErrorOccurred(void); void ResetSerial(void); -u32 LinkMain1(u8 *, u16 *, u16[CMD_LENGTH][MAX_LINK_PLAYERS]); +u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENGTH]); void LinkVSync(void); void Timer3Intr(void); void SerialCB(void); @@ -213,9 +212,7 @@ void SetLinkDebugValues(u32 seed, u32 flags); void sub_800A418(void); void SetSuppressLinkErrorMessage(bool8 flag); void sub_800B524(struct LinkPlayer *linkPlayer); -u8 sub_800B2E8(void); -u8 sub_800B320(void); -u8 sub_800B33C(void); +u8 GetSioMultiSI(void); void sub_800B9B8(void); extern u16 gUnknown_03003020[6]; diff --git a/src/link.c b/src/link.c index 3da48a951..3adfc1b76 100644 --- a/src/link.c +++ b/src/link.c @@ -78,7 +78,7 @@ bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; u32 gFiller_03003080; u16 gLinkHeldKeys; -u16 gRecvCmds[MAX_RFU_PLAYERS][8]; +u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH]; u32 gLinkStatus; bool8 gUnknown_030030E4; bool8 gUnknown_030030E8; @@ -88,12 +88,12 @@ u16 gUnknown_030030F4; u8 gSuppressLinkErrorMessage; bool8 gWirelessCommType; bool8 gSavedLinkPlayerCount; -u16 gSendCmd[8]; +u16 gSendCmd[CMD_LENGTH]; u8 gSavedMultiplayerId; bool8 gReceivedRemoteLinkPlayers; struct LinkTestBGInfo gLinkTestBGInfo; void (*gLinkCallback)(void); -bool8 gShouldAdvanceLinkState; +u8 gShouldAdvanceLinkState; u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; u8 gBlockRequestType; u32 gFiller_03003154; @@ -149,14 +149,19 @@ static void sub_800AD5C(void); static void sub_800AD88(void); static void sub_800AE30(void); static void sub_800AE5C(void); -static void sub_800AEB4(void); -static void sub_800B1A0(void); -static bool8 sub_800B2F8(void); -u32 sub_800B638(bool8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[8]); +static void CheckErrorStatus(void); +static void CB2_PrintErrorMessage(void); +static bool8 IsSioMultiMaster(void); +u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENGTH]); static void sub_800B4A4(void); void DisableSerial(void); void EnableSerial(void); +void sub_800B764(void); +void sub_800B790(void); +void sub_800B7C0(u16 *queue); +void sub_800B8A8(u16 (*queue)[CMD_LENGTH]); + // .rodata ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal"); @@ -334,7 +339,7 @@ void Task_TriggerHandshake(u8 taskId) { if (++ gTasks[taskId].data[0] == 5) { - gShouldAdvanceLinkState = TRUE; + gShouldAdvanceLinkState = 1; DestroyTask(taskId); } } @@ -424,7 +429,7 @@ void LinkTestProcessKeyInput(void) { if (gMain.newKeys & A_BUTTON) { - gShouldAdvanceLinkState = TRUE; + gShouldAdvanceLinkState = 1; } if (gMain.heldKeys & B_BUTTON) { @@ -482,7 +487,7 @@ u16 LinkMain2(const u16 *heldKeys) { gLinkCallback(); } - sub_800AEB4(); + CheckErrorStatus(); } return gLinkStatus; } @@ -1134,7 +1139,7 @@ void sub_800A620(void) { if ((gLinkStatus & LINK_STAT_MASTER) && EXTRACT_PLAYER_COUNT(gLinkStatus) > 1) { - gShouldAdvanceLinkState = TRUE; + gShouldAdvanceLinkState = 1; } } @@ -1261,10 +1266,10 @@ static void Task_PrintTestData(u8 taskId) LinkTest_prnthex(GetBlockReceivedStatus(), 15, 5, 2); LinkTest_prnthex(gLinkDebugSeed, 2, 12, 8); LinkTest_prnthex(gLinkDebugFlags, 2, 13, 8); - LinkTest_prnthex(sub_800B2E8(), 25, 5, 1); - LinkTest_prnthex(sub_800B2F8(), 25, 6, 1); - LinkTest_prnthex(sub_800B320(), 25, 7, 1); - LinkTest_prnthex(sub_800B33C(), 25, 8, 1); + LinkTest_prnthex(GetSioMultiSI(), 25, 5, 1); + LinkTest_prnthex(IsSioMultiMaster(), 25, 6, 1); + LinkTest_prnthex(IsLinkConnectionEstablished(), 25, 7, 1); + LinkTest_prnthex(HasLinkErrorOccurred(), 25, 8, 1); for (i = 0; i < MAX_LINK_PLAYERS; i++) { LinkTest_prnthex(gLinkTestBlockChecksums[i], 10, 4 + i, 4); @@ -1588,7 +1593,7 @@ static void sub_800AE5C(void) } } -static void sub_800AEB4(void) +static void CheckErrorStatus(void) { if (gLinkOpen && EXTRACT_LINK_ERRORS(gLinkStatus)) { @@ -1660,7 +1665,7 @@ void CB2_LinkError(void) AnimateSprites(); BuildOamBuffer(); UpdatePaletteFade(); - SetMainCallback2(sub_800B1A0); + SetMainCallback2(CB2_PrintErrorMessage); } } @@ -1693,7 +1698,7 @@ static void sub_800B138(void) CopyWindowToVram(2, 3); } -static void sub_800B1A0(void) +static void CB2_PrintErrorMessage(void) { switch (gMain.state) { @@ -1762,17 +1767,17 @@ static void sub_800B1A0(void) } } -bool8 sub_800B2E8(void) +bool8 GetSioMultiSI(void) { return (REG_SIOCNT & 0x04) != 0; } -static bool8 sub_800B2F8(void) +static bool8 IsSioMultiMaster(void) { return (REG_SIOCNT & 0x8) && !(REG_SIOCNT & 0x04); } -bool8 sub_800B320(void) +bool8 IsLinkConnectionEstablished(void) { return EXTRACT_CONN_ESTABLISHED(gLinkStatus); } @@ -1782,7 +1787,7 @@ void SetSuppressLinkErrorMessage(bool8 flag) gSuppressLinkErrorMessage = flag; } -bool8 sub_800B33C(void) +bool8 HasLinkErrorOccurred(void) { return gLinkErrorOccurred; } @@ -1821,7 +1826,7 @@ bool8 HandleLinkConnection(void) if (gWirelessCommType == 0) { - gLinkStatus = sub_800B638(&gShouldAdvanceLinkState, gSendCmd, gRecvCmds); + gLinkStatus = LinkMain1(&gShouldAdvanceLinkState, gSendCmd, gRecvCmds); LinkMain2(&gMain.heldKeys); if ((gLinkStatus & LINK_STAT_RECEIVED_NOTHING) && sub_808766C() == TRUE) { @@ -1930,3 +1935,99 @@ void ResetSerial(void) EnableSerial(); DisableSerial(); } + +u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENGTH]) +{ + u32 retVal; + u32 retVal2; + + switch (gLink.state) + { + case LINK_STATE_START0: + DisableSerial(); + gLink.state = 1; + break; + case LINK_STATE_START1: + if (*shouldAdvanceLinkState == 1) + { + EnableSerial(); + gLink.state = 2; + } + break; + case LINK_STATE_HANDSHAKE: + switch (*shouldAdvanceLinkState) + { + default: + sub_800B764(); + break; + case 1: + if (gLink.isMaster == 8 && gLink.playerCount > 1) + { + gLink.handshakeAsMaster = TRUE; + } + break; + case 2: + gLink.state = LINK_STATE_START0; + REG_SIOMLT_SEND = 0; + break; + } + break; + case LINK_STATE_INIT_TIMER: + sub_800B790(); + gLink.state = LINK_STATE_CONN_ESTABLISHED; + // fallthrough + case LINK_STATE_CONN_ESTABLISHED: + sub_800B7C0(sendCmd); + sub_800B8A8(recvCmds); + break; + } + *shouldAdvanceLinkState = 0; + retVal = gLink.localId; + retVal |= (gLink.playerCount << 2); + if (gLink.isMaster == 8) + { + retVal |= 0x20; + } + { + u32 receivedNothing = gLink.receivedNothing << 8; + u32 link_field_F = gLink.link_field_F << 9; + u32 hardwareError = gLink.hardwareError << 12; + u32 badChecksum = gLink.badChecksum << 13; + u32 queueFull = gLink.queueFull << 14; + u32 val; + + if (gLink.state == LINK_STATE_CONN_ESTABLISHED) + { + val = 0x40; + val |= receivedNothing; + val |= retVal; + val |= link_field_F; + val |= hardwareError; + val |= badChecksum; + val |= queueFull; + } + else + { + val = retVal; + val |= receivedNothing; + val |= link_field_F; + val |= hardwareError; + val |= badChecksum; + val |= queueFull; + } + + retVal = val; + } + + if (gLink.lag == LAG_MASTER) + retVal |= 0x10000; + + if (gLink.localId > 3) + retVal |= 0x20000; + + retVal2 = retVal; + if (gLink.lag == LAG_SLAVE) + retVal2 |= 0x40000; + + return retVal2; +} From 6f8da5dcb66d16954800c73a67b3cd06f8ac0702 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 14 Nov 2017 08:31:37 -0500 Subject: [PATCH 049/123] through DequeueRecvCmd --- asm/link.s | 284 --------------------------------------- asm/link_rfu.s | 2 +- asm/rom4.s | 4 +- common_syms/link.txt | 10 +- include/link.h | 43 +++++- src/link.c | 313 +++++++++++++++++++++++++++++-------------- 6 files changed, 255 insertions(+), 401 deletions(-) diff --git a/asm/link.s b/asm/link.s index 3188bcb42..59e307e21 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,290 +5,6 @@ .text - thumb_func_start sub_800B764 -sub_800B764: @ 800B764 - push {lr} - ldr r0, =0x04000128 - ldr r1, [r0] - movs r0, 0xC - ands r1, r0 - ldr r2, =gLink - cmp r1, 0x8 - bne _0800B788 - ldrb r0, [r2, 0x2] - cmp r0, 0 - bne _0800B788 - strb r1, [r2] - b _0800B78C - .pool -_0800B788: - movs r0, 0 - strb r0, [r2] -_0800B78C: - pop {r0} - bx r0 - thumb_func_end sub_800B764 - - thumb_func_start sub_800B790 -sub_800B790: @ 800B790 - push {lr} - ldr r0, =gLink - ldrb r0, [r0] - cmp r0, 0 - beq _0800B7AE - ldr r1, =0x0400010c - ldr r2, =0x0000ff3b - adds r0, r2, 0 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x41 - strh r0, [r1] - movs r0, 0x40 - bl EnableInterrupts -_0800B7AE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B790 - - thumb_func_start sub_800B7C0 -sub_800B7C0: @ 800B7C0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r3, r0, 0 - ldr r2, =gUnknown_03004134 - ldr r1, =0x04000208 - ldrh r0, [r1] - strh r0, [r2] - movs r0, 0 - strh r0, [r1] - ldr r1, =gLink - ldr r4, =0x00000339 - adds r0, r1, r4 - ldrb r4, [r0] - adds r6, r1, 0 - cmp r4, 0x31 - bhi _0800B850 - movs r1, 0xCE - lsls r1, 2 - adds r0, r6, r1 - ldrb r0, [r0] - adds r0, r4, r0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x31 - bls _0800B7FE - subs r0, 0x32 - lsls r0, 24 - lsrs r0, 24 -_0800B7FE: - movs r2, 0 - ldr r4, =gUnknown_03000D6E - mov r9, r4 - ldr r1, =gLastSendQueueCount - mov r10, r1 - lsls r5, r0, 1 - movs r0, 0x18 - adds r0, r6 - mov r8, r0 - mov r12, r2 - movs r7, 0x64 -_0800B814: - ldrh r0, [r4] - ldrh r1, [r3] - orrs r0, r1 - strh r0, [r4] - adds r0, r2, 0 - muls r0, r7 - adds r0, r5, r0 - add r0, r8 - strh r1, [r0] - mov r1, r12 - strh r1, [r3] - adds r3, 0x2 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _0800B814 - b _0800B85C - .pool -_0800B850: - movs r0, 0x1 - strb r0, [r6, 0x12] - ldr r2, =gUnknown_03000D6E - mov r9, r2 - ldr r4, =gLastSendQueueCount - mov r10, r4 -_0800B85C: - mov r1, r9 - ldrh r0, [r1] - cmp r0, 0 - beq _0800B874 - ldr r2, =0x00000339 - adds r0, r6, r2 - ldrb r1, [r0] - adds r1, 0x1 - movs r2, 0 - strb r1, [r0] - mov r4, r9 - strh r2, [r4] -_0800B874: - ldr r1, =0x04000208 - ldr r2, =gUnknown_03004134 - ldrh r0, [r2] - strh r0, [r1] - ldr r4, =0x00000339 - adds r0, r6, r4 - ldrb r0, [r0] - mov r1, r10 - strb r0, [r1] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B7C0 - - thumb_func_start sub_800B8A8 -sub_800B8A8: @ 800B8A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r9, r0 - ldr r2, =gUnknown_03004134 - ldr r1, =0x04000208 - ldrh r0, [r1] - strh r0, [r2] - movs r0, 0 - strh r0, [r1] - ldr r1, =gLink - ldr r3, =0x00000fbd - adds r0, r1, r3 - ldrb r0, [r0] - mov r12, r1 - cmp r0, 0 - bne _0800B914 - movs r3, 0 - ldrb r0, [r1, 0x3] - cmp r3, r0 - bcs _0800B8FA - movs r5, 0 - adds r6, r0, 0 -_0800B8DA: - movs r2, 0 - lsls r1, r3, 4 - adds r4, r3, 0x1 - add r1, r9 -_0800B8E2: - lsls r0, r2, 1 - adds r0, r1 - strh r5, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _0800B8E2 - lsls r0, r4, 24 - lsrs r3, r0, 24 - cmp r3, r6 - bcc _0800B8DA -_0800B8FA: - movs r0, 0x1 - mov r7, r12 - strb r0, [r7, 0xC] - b _0800B990 - .pool -_0800B914: - movs r3, 0 - mov r0, r12 - ldrb r1, [r0, 0x3] - cmp r3, r1 - bcs _0800B96A - ldr r0, =0x00000fbc - add r0, r12 - ldrb r0, [r0] - lsls r6, r0, 1 - movs r2, 0xCF - lsls r2, 2 - add r2, r12 - mov r8, r2 - mov r10, r1 -_0800B930: - movs r2, 0 - lsls r1, r3, 4 - adds r4, r3, 0x1 - lsls r0, r3, 1 - mov r7, r9 - adds r5, r1, r7 - adds r0, r3 - lsls r0, 3 - adds r0, r3 - lsls r3, r0, 5 -_0800B944: - lsls r1, r2, 1 - adds r1, r5 - movs r7, 0x64 - adds r0, r2, 0 - muls r0, r7 - adds r0, r6, r0 - adds r0, r3 - add r0, r8 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _0800B944 - lsls r0, r4, 24 - lsrs r3, r0, 24 - cmp r3, r10 - bcc _0800B930 -_0800B96A: - mov r2, r12 - ldr r0, =0x00000fbd - adds r1, r2, r0 - ldrb r0, [r1] - subs r0, 0x1 - movs r3, 0 - strb r0, [r1] - ldr r1, =0x00000fbc - adds r2, r1 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x31 - bls _0800B98C - strb r3, [r2] -_0800B98C: - mov r2, r12 - strb r3, [r2, 0xC] -_0800B990: - ldr r1, =0x04000208 - ldr r3, =gUnknown_03004134 - ldrh r0, [r3] - strh r0, [r1] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B8A8 - thumb_func_start sub_800B9B8 sub_800B9B8: @ 800B9B8 push {r4,lr} diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 1e7f4a182..3641ec1a3 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -3725,7 +3725,7 @@ _0800FBB0: b _0800FC08 .pool _0800FBF4: - ldr r0, =gUnknown_03003020 + ldr r0, =gLinkPartnersHeldKeys mov r3, r8 lsls r1, r3, 1 adds r1, r0 diff --git a/asm/rom4.s b/asm/rom4.s index 575b18991..0aaea22c8 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -4578,7 +4578,7 @@ c1_link_related: @ 8086BD8 _08086BF2: ldr r0, =gUnknown_03005DB4 ldrb r4, [r0] - ldr r0, =gUnknown_03003020 + ldr r0, =gLinkPartnersHeldKeys adds r1, r4, 0 bl sub_8086F38 ldr r0, =gUnknown_03000E14 @@ -4610,7 +4610,7 @@ sub_8086C2C: @ 8086C2C thumb_func_start sub_8086C40 sub_8086C40: @ 8086C40 push {lr} - ldr r0, =gUnknown_03003020 + ldr r0, =gLinkPartnersHeldKeys bl sub_808709C pop {r0} bx r0 diff --git a/common_syms/link.txt b/common_syms/link.txt index 564802b1a..a6d096116 100644 --- a/common_syms/link.txt +++ b/common_syms/link.txt @@ -1,11 +1,11 @@ -gUnknown_03003020 +gLinkPartnersHeldKeys gLinkDebugSeed gLocalLinkPlayerBlock gLinkErrorOccurred gLinkDebugFlags -gUnknown_03003074 -gUnknown_03003078 -gUnknown_0300307C +gFiller_03003074 +gRemoteLinkPlayersNotReceived +gBlockReceivedStatus gFiller_03003080 gLinkHeldKeys gRecvCmds @@ -32,6 +32,6 @@ gFiller_0300315c gLastSendQueueCount gLink gLastRecvQueueCount -gUnknown_03004134 +gLinkSavedIme gFiller_03004138 gFiller_0300413C diff --git a/include/link.h b/include/link.h index 88f638d78..023d95207 100644 --- a/include/link.h +++ b/include/link.h @@ -7,6 +7,9 @@ #define QUEUE_CAPACITY 50 #define BLOCK_BUFFER_SIZE 0x100 +#define LINK_SLAVE 0 +#define LINK_MASTER 8 + #define LINK_STAT_LOCAL_ID 0x00000003 #define LINK_STAT_PLAYER_COUNT 0x0000001C #define LINK_STAT_PLAYER_COUNT_SHIFT 2 @@ -16,9 +19,24 @@ #define LINK_STAT_CONN_ESTABLISHED_SHIFT 6 #define LINK_STAT_RECEIVED_NOTHING 0x00000100 #define LINK_STAT_RECEIVED_NOTHING_SHIFT 8 +#define LINK_STAT_UNK_FLAG_9 0x00000200 +#define LINK_STAT_UNK_FLAG_9_SHIFT 9 #define LINK_STAT_ERRORS 0x0007F000 #define LINK_STAT_ERRORS_SHIFT 12 +#define LINK_STAT_ERROR_HARDWARE 0x00001000 +#define LINK_STAT_ERROR_HARDWARE_SHIFT 12 +#define LINK_STAT_ERROR_CHECKSUM 0x00002000 +#define LINK_STAT_ERROR_CHECKSUM_SHIFT 13 +#define LINK_STAT_ERROR_QUEUE_FULL 0x00004000 +#define LINK_STAT_ERROR_QUEUE_FULL_SHIFT 14 +#define LINK_STAT_ERROR_LAG_MASTER 0x00010000 +#define LINK_STAT_ERROR_LAG_MASTER_SHIFT 16 +#define LINK_STAT_ERROR_INVALID_ID 0x00020000 +#define LINK_STAT_ERROR_INVALID_ID_SHIFT 17 +#define LINK_STAT_ERROR_LAG_SLAVE 0x00040000 +#define LINK_STAT_ERROR_LAG_SLAVE_SHIFT 18 + #define EXTRACT_PLAYER_COUNT(status) \ (((status) & LINK_STAT_PLAYER_COUNT) >> LINK_STAT_PLAYER_COUNT_SHIFT) #define EXTRACT_MASTER(status) \ @@ -30,6 +48,21 @@ #define EXTRACT_LINK_ERRORS(status) \ (((status) & LINK_STAT_ERRORS) >> LINK_STAT_ERRORS_SHIFT) +#define LINKCMD_SEND_LINK_TYPE 0x2222 +#define LINKCMD_0x2FFE 0x2FFE +#define LINKCMD_SEND_HELD_KEYS 0x4444 +#define LINKCMD_0x5555 0x5555 +#define LINKCMD_0x5566 0x5566 +#define LINKCMD_0x5FFF 0x5FFF +#define LINKCMD_0x6666 0x6666 +#define LINKCMD_0x7777 0x7777 +#define LINKCMD_CONT_BLOCK 0x8888 +#define LINKCMD_0xAAAA 0xAAAA +#define LINKCMD_0xAAAB 0xAAAB +#define LINKCMD_INIT_BLOCK 0xBBBB +#define LINKCMD_SEND_HELD_KEYS_2 0xCAFE +#define LINKCMD_0xCCCC 0xCCCC + struct LinkStatus { u32 localId:2; @@ -215,13 +248,13 @@ void sub_800B524(struct LinkPlayer *linkPlayer); u8 GetSioMultiSI(void); void sub_800B9B8(void); -extern u16 gUnknown_03003020[6]; +extern u16 gLinkPartnersHeldKeys[6]; extern u32 gLinkDebugSeed; extern struct LinkPlayerBlock gLocalLinkPlayerBlock; extern bool8 gLinkErrorOccurred; extern u32 gLinkDebugFlags; -extern bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; -extern u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; +extern bool8 gRemoteLinkPlayersNotReceived[MAX_LINK_PLAYERS]; +extern u8 gBlockReceivedStatus[MAX_LINK_PLAYERS]; extern u16 gLinkHeldKeys; extern u32 gLinkStatus; extern u8 gUnknown_030030E4; @@ -240,8 +273,8 @@ extern u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; extern u8 gBlockRequestType; extern u8 gLastSendQueueCount; extern u8 gLastRecvQueueCount; -extern u16 gUnknown_03004134; -extern u32 gUnknown_03003074; +extern u16 gLinkSavedIme; +extern u32 gFiller_03003074; extern u32 gFiller_03003154; extern u32 gFiller_03003158; extern u32 gFiller_0300315c; diff --git a/src/link.c b/src/link.c index 3adfc1b76..eb6d573d5 100644 --- a/src/link.c +++ b/src/link.c @@ -62,20 +62,20 @@ IWRAM_DATA u8 sLinkTestLastBlockSendPos; ALIGNED() IWRAM_DATA u8 sLinkTestLastBlockRecvPos[MAX_LINK_PLAYERS]; IWRAM_DATA u8 gUnknown_03000D6C; IWRAM_DATA bool8 gUnknown_03000D6D; -IWRAM_DATA u16 gUnknown_03000D6E; +IWRAM_DATA u16 sSendNonzeroCheck; IWRAM_DATA u16 gUnknown_03000D70; IWRAM_DATA u8 gUnknown_03000D72; IWRAM_DATA u8 gUnknown_03000D73; IWRAM_DATA u8 gUnknown_03000D74; -u16 gUnknown_03003020[6]; +u16 gLinkPartnersHeldKeys[6]; u32 gLinkDebugSeed; struct LinkPlayerBlock gLocalLinkPlayerBlock; bool8 gLinkErrorOccurred; u32 gLinkDebugFlags; -u32 gUnknown_03003074; -bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; -u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; +u32 gFiller_03003074; +bool8 gRemoteLinkPlayersNotReceived[MAX_LINK_PLAYERS]; +u8 gBlockReceivedStatus[MAX_LINK_PLAYERS]; u32 gFiller_03003080; u16 gLinkHeldKeys; u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH]; @@ -102,7 +102,7 @@ u32 gFiller_0300315c; u8 gLastSendQueueCount; struct Link gLink; u8 gLastRecvQueueCount; -u16 gUnknown_03004134; +u16 gLinkSavedIme; u32 gFiller_03004138; u32 gFiller_0300413C; @@ -128,8 +128,8 @@ EWRAM_DATA void *gUnknown_02022B0C = NULL; // Static ROM declarations -void InitLocalLinkPlayer(void); -void sub_80096BC(void); +static void InitLocalLinkPlayer(void); +static void sub_80096BC(void); static void CB2_LinkTest(void); static void ProcessRecvCmds(u8 unused); static void sub_8009F70(void); @@ -152,15 +152,13 @@ static void sub_800AE5C(void); static void CheckErrorStatus(void); static void CB2_PrintErrorMessage(void); static bool8 IsSioMultiMaster(void); -u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENGTH]); static void sub_800B4A4(void); -void DisableSerial(void); -void EnableSerial(void); - -void sub_800B764(void); -void sub_800B790(void); -void sub_800B7C0(u16 *queue); -void sub_800B8A8(u16 (*queue)[CMD_LENGTH]); +static void DisableSerial(void); +static void EnableSerial(void); +static void CheckMasterOrSlave(void); +static void InitTimer(void); +static void EnqueueSendCmd(u16 *sendCmd); +static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]); // .rodata @@ -300,7 +298,7 @@ void sub_8009628(u8 a0) gLocalLinkPlayer.lp_field_18 = a0; } -void InitLocalLinkPlayer(void) +static void InitLocalLinkPlayer(void) { gLocalLinkPlayer.trainerId = gSaveBlock2Ptr->playerTrainerId[0] | (gSaveBlock2Ptr->playerTrainerId[1] << 8) | (gSaveBlock2Ptr->playerTrainerId[2] << 16) | (gSaveBlock2Ptr->playerTrainerId[3] << 24); StringCopy(gLocalLinkPlayer.name, gSaveBlock2Ptr->playerName); @@ -316,14 +314,14 @@ void InitLocalLinkPlayer(void) } } -void sub_80096BC(void) +static void sub_80096BC(void) { LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); } -void InitLink(void) +static void InitLink(void) { int i; @@ -335,7 +333,7 @@ void InitLink(void) EnableSerial(); } -void Task_TriggerHandshake(u8 taskId) +static void Task_TriggerHandshake(u8 taskId) { if (++ gTasks[taskId].data[0] == 5) { @@ -371,7 +369,7 @@ void OpenLink(void) gReceivedRemoteLinkPlayers = 0; for (i = 0; i < MAX_LINK_PLAYERS; i ++) { - gUnknown_03003078[i] = TRUE; + gRemoteLinkPlayersNotReceived[i] = TRUE; gUnknown_030030F0[i] = FALSE; gUnknown_030030EC[i] = FALSE; } @@ -425,7 +423,7 @@ static void TestBlockTransfer(u8 nothing, u8 is, u8 used) } } -void LinkTestProcessKeyInput(void) +static void LinkTestProcessKeyInput(void) { if (gMain.newKeys & A_BUTTON) { @@ -492,16 +490,16 @@ u16 LinkMain2(const u16 *heldKeys) return gLinkStatus; } -void HandleReceiveRemoteLinkPlayer(u8 who) +static void HandleReceiveRemoteLinkPlayer(u8 who) { int i; int count; count = 0; - gUnknown_03003078[who] = FALSE; + gRemoteLinkPlayersNotReceived[who] = FALSE; for (i = 0; i < GetLinkPlayerCount_2(); i ++) { - count += gUnknown_03003078[i]; + count += gRemoteLinkPlayersNotReceived[i]; } if (count == 0 && gReceivedRemoteLinkPlayers == 0) { @@ -515,14 +513,14 @@ static void ProcessRecvCmds(u8 unused) for (i = 0; i < MAX_LINK_PLAYERS; i ++) { - gUnknown_03003020[i] = 0; + gLinkPartnersHeldKeys[i] = 0; if (gRecvCmds[i][0] == 0) { continue; } switch (gRecvCmds[i][0]) { - case 0x2222: + case LINKCMD_SEND_LINK_TYPE: { struct LinkPlayerBlock *block; @@ -534,16 +532,16 @@ static void ProcessRecvCmds(u8 unused) InitBlockSend(block, sizeof(*block)); break; } - case 0x4444: - gUnknown_03003020[i] = gRecvCmds[i][1]; + case LINKCMD_SEND_HELD_KEYS: + gLinkPartnersHeldKeys[i] = gRecvCmds[i][1]; break; - case 0x5555: + case LINKCMD_0x5555: gUnknown_030030E8 = TRUE; break; - case 0x5566: + case LINKCMD_0x5566: gUnknown_030030E8 = TRUE; break; - case 0xBBBB: + case LINKCMD_INIT_BLOCK: { struct BlockTransfer *blockRecv; @@ -553,7 +551,7 @@ static void ProcessRecvCmds(u8 unused) blockRecv->multiplayerId = gRecvCmds[i][2]; break; } - case 0x8888: + case LINKCMD_CONT_BLOCK: { if (sBlockRecv[i].size > BLOCK_BUFFER_SIZE) { @@ -580,7 +578,7 @@ static void ProcessRecvCmds(u8 unused) if (sBlockRecv[i].pos >= sBlockRecv[i].size) { - if (gUnknown_03003078[i] == TRUE) + if (gRemoteLinkPlayersNotReceived[i] == TRUE) { struct LinkPlayerBlock *block; struct LinkPlayer *linkPlayer; @@ -612,87 +610,87 @@ static void ProcessRecvCmds(u8 unused) } } break; - case 0x5FFF: + case LINKCMD_0x5FFF: gUnknown_030030F0[i] = TRUE; break; - case 0x2FFE: + case LINKCMD_0x2FFE: gUnknown_030030EC[i] = TRUE; break; - case 0xAAAA: + case LINKCMD_0xAAAA: sub_800A418(); break; - case 0xCCCC: + case LINKCMD_0xCCCC: SendBlock(0, gUnknown_082ED1A8[gRecvCmds[i][1]].address, gUnknown_082ED1A8[gRecvCmds[i][1]].size); break; - case 0xCAFE: - gUnknown_03003020[i] = gRecvCmds[i][1]; + case LINKCMD_SEND_HELD_KEYS_2: + gLinkPartnersHeldKeys[i] = gRecvCmds[i][1]; break; } } } -void BuildSendCmd(u16 command) +static void BuildSendCmd(u16 command) { switch (command) { - case 0x2222: - gSendCmd[0] = 0x2222; + case LINKCMD_SEND_LINK_TYPE: + gSendCmd[0] = LINKCMD_SEND_LINK_TYPE; gSendCmd[1] = gLinkType; break; - case 0x2ffe: - gSendCmd[0] = 0x2ffe; + case LINKCMD_0x2FFE: + gSendCmd[0] = LINKCMD_0x2FFE; break; - case 0x4444: - gSendCmd[0] = 0x4444; + case LINKCMD_SEND_HELD_KEYS: + gSendCmd[0] = LINKCMD_SEND_HELD_KEYS; gSendCmd[1] = gMain.heldKeys; break; - case 0x5555: - gSendCmd[0] = 0x5555; + case LINKCMD_0x5555: + gSendCmd[0] = LINKCMD_0x5555; break; - case 0x6666: - gSendCmd[0] = 0x6666; + case LINKCMD_0x6666: + gSendCmd[0] = LINKCMD_0x6666; gSendCmd[1] = 0; break; - case 0x7777: + case LINKCMD_0x7777: { u8 i; - gSendCmd[0] = 0x7777; + gSendCmd[0] = LINKCMD_0x7777; for (i = 0; i < 5; i ++) { gSendCmd[i + 1] = 0xEE; } break; } - case 0xbbbb: - gSendCmd[0] = 0xbbbb; + case LINKCMD_INIT_BLOCK: + gSendCmd[0] = LINKCMD_INIT_BLOCK; gSendCmd[1] = sBlockSend.size; gSendCmd[2] = sBlockSend.multiplayerId + 0x80; break; - case 0xaaaa: - gSendCmd[0] = 0xaaaa; + case LINKCMD_0xAAAA: + gSendCmd[0] = LINKCMD_0xAAAA; break; - case 0xaaab: - gSendCmd[0] = 0xaaab; + case LINKCMD_0xAAAB: + gSendCmd[0] = LINKCMD_0xAAAB; gSendCmd[1] = gScriptItemId; break; - case 0xcccc: - gSendCmd[0] = 0xcccc; + case LINKCMD_0xCCCC: + gSendCmd[0] = LINKCMD_0xCCCC; gSendCmd[1] = gBlockRequestType; break; - case 0x5fff: - gSendCmd[0] = 0x5fff; + case LINKCMD_0x5FFF: + gSendCmd[0] = LINKCMD_0x5FFF; gSendCmd[1] = gUnknown_030030F4; break; - case 0x5566: - gSendCmd[0] = 0x5566; + case LINKCMD_0x5566: + gSendCmd[0] = LINKCMD_0x5566; break; - case 0xcafe: + case LINKCMD_SEND_HELD_KEYS_2: if (gUnknown_03005DA8 == 0 || gLinkTransferringData) { break; } - gSendCmd[0] = 0xcafe; + gSendCmd[0] = LINKCMD_SEND_HELD_KEYS_2; gSendCmd[1] = gUnknown_03005DA8; break; } @@ -724,7 +722,7 @@ static void sub_8009F70(void) { if (gReceivedRemoteLinkPlayers == TRUE) { - BuildSendCmd(0xcafe); + BuildSendCmd(LINKCMD_SEND_HELD_KEYS_2); } } @@ -761,7 +759,7 @@ u8 GetLinkPlayerCount(void) return EXTRACT_PLAYER_COUNT(gLinkStatus); } -int sub_8009FF8(u32 version1, u32 version2) +static int sub_8009FF8(u32 version1, u32 version2) { int i; u8 nPlayers; @@ -964,7 +962,7 @@ static bool32 InitBlockSend(const void *src, size_t size) } sBlockSend.src = gBlockSendBuffer; } - BuildSendCmd(0xbbbb); + BuildSendCmd(LINKCMD_INIT_BLOCK); gLinkCallback = LinkCB_BlockSendBegin; sBlockSendDelayCounter = 0; return TRUE; @@ -984,7 +982,7 @@ static void LinkCB_BlockSend(void) const u8 *src; src = sBlockSend.src; - gSendCmd[0] = 0x8888; + gSendCmd[0] = LINKCMD_CONT_BLOCK; for (i = 0; i < 7; i ++) { gSendCmd[i + 1] = (src[sBlockSend.pos + i * 2 + 1] << 8) | src[sBlockSend.pos + i * 2]; @@ -1005,7 +1003,7 @@ static void LinkCB_BlockSendEnd(void) static void sub_800A3F8(void) { GetMultiplayerId(); - BuildSendCmd(0x4444); + BuildSendCmd(LINKCMD_SEND_HELD_KEYS); gUnknown_020223C0 ++; } @@ -1029,7 +1027,7 @@ u32 sub_800A44C(void) void sub_800A458(void) { - BuildSendCmd(0xaaaa); + BuildSendCmd(LINKCMD_0xAAAA); } u8 GetMultiplayerId(void) @@ -1067,7 +1065,7 @@ bool8 sub_800A4D8(u8 a0) if (gLinkCallback == NULL) { gBlockRequestType = a0; - BuildSendCmd(0xcccc); + BuildSendCmd(LINKCMD_0xCCCC); return TRUE; } return FALSE; @@ -1088,7 +1086,7 @@ u8 GetBlockReceivedStatus(void) { return sub_800FCD8(); } - return (gUnknown_0300307C[3] << 3) | (gUnknown_0300307C[2] << 2) | (gUnknown_0300307C[1] << 1) | (gUnknown_0300307C[0] << 0); + return (gBlockReceivedStatus[3] << 3) | (gBlockReceivedStatus[2] << 2) | (gBlockReceivedStatus[1] << 1) | (gBlockReceivedStatus[0] << 0); } static void SetBlockReceivedFlag(u8 who) @@ -1099,7 +1097,7 @@ static void SetBlockReceivedFlag(u8 who) } else { - gUnknown_0300307C[who] = TRUE; + gBlockReceivedStatus[who] = TRUE; } } @@ -1118,7 +1116,7 @@ void ResetBlockReceivedFlags(void) { for (i = 0; i < MAX_LINK_PLAYERS; i ++) { - gUnknown_0300307C[i] = FALSE; + gBlockReceivedStatus[i] = FALSE; } } } @@ -1129,9 +1127,9 @@ void ResetBlockReceivedFlag(u8 who) { sub_800F728(who); } - else if (gUnknown_0300307C[who]) + else if (gBlockReceivedStatus[who]) { - gUnknown_0300307C[who] = FALSE; + gBlockReceivedStatus[who] = FALSE; } } @@ -1244,7 +1242,7 @@ static void LinkCB_RequestPlayerDataExchange(void) { if (gLinkStatus & LINK_STAT_MASTER) { - BuildSendCmd(0x2222); + BuildSendCmd(LINKCMD_SEND_LINK_TYPE); } gLinkCallback = NULL; } @@ -1456,7 +1454,7 @@ static void sub_800AC80(void) { if (gLastRecvQueueCount == 0) { - BuildSendCmd(0x5fff); + BuildSendCmd(LINKCMD_0x5FFF); gLinkCallback = sub_800ACAC; } } @@ -1511,7 +1509,7 @@ static void sub_800AD5C(void) { if (gLastRecvQueueCount == 0) { - BuildSendCmd(0x5fff); + BuildSendCmd(LINKCMD_0x5FFF); gLinkCallback = sub_800AD88; } } @@ -1565,7 +1563,7 @@ static void sub_800AE30(void) { if (gLastRecvQueueCount == 0) { - BuildSendCmd(0x2ffe); + BuildSendCmd(LINKCMD_0x2FFE); gLinkCallback = sub_800AE5C; } } @@ -1901,7 +1899,7 @@ void sub_800B524(struct LinkPlayer *player) ConvertInternationalString(player->name, player->language); } -void DisableSerial(void) +static void DisableSerial(void) { DisableInterrupts(INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); REG_SIOCNT = SIO_MULTI_MODE; @@ -1912,7 +1910,7 @@ void DisableSerial(void) CpuFill32(0, &gLink, sizeof(gLink)); } -void EnableSerial(void) +static void EnableSerial(void) { DisableInterrupts(INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); REG_RCNT = 0; @@ -1922,7 +1920,7 @@ void EnableSerial(void) REG_SIOMLT_SEND = 0; CpuFill32(0, &gLink, sizeof(gLink)); gUnknown_03000D6C = 0; - gUnknown_03000D6E = 0; + sSendNonzeroCheck = 0; gUnknown_03000D70 = 0; gUnknown_03000D72 = 0; gUnknown_03000D73 = 0; @@ -1958,10 +1956,10 @@ u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENG switch (*shouldAdvanceLinkState) { default: - sub_800B764(); + CheckMasterOrSlave(); break; case 1: - if (gLink.isMaster == 8 && gLink.playerCount > 1) + if (gLink.isMaster == LINK_MASTER && gLink.playerCount > 1) { gLink.handshakeAsMaster = TRUE; } @@ -1973,32 +1971,32 @@ u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENG } break; case LINK_STATE_INIT_TIMER: - sub_800B790(); + InitTimer(); gLink.state = LINK_STATE_CONN_ESTABLISHED; // fallthrough case LINK_STATE_CONN_ESTABLISHED: - sub_800B7C0(sendCmd); - sub_800B8A8(recvCmds); + EnqueueSendCmd(sendCmd); + DequeueRecvCmds(recvCmds); break; } *shouldAdvanceLinkState = 0; retVal = gLink.localId; - retVal |= (gLink.playerCount << 2); - if (gLink.isMaster == 8) + retVal |= (gLink.playerCount << LINK_STAT_PLAYER_COUNT_SHIFT); + if (gLink.isMaster == LINK_MASTER) { - retVal |= 0x20; + retVal |= LINK_STAT_MASTER; } { - u32 receivedNothing = gLink.receivedNothing << 8; - u32 link_field_F = gLink.link_field_F << 9; - u32 hardwareError = gLink.hardwareError << 12; - u32 badChecksum = gLink.badChecksum << 13; - u32 queueFull = gLink.queueFull << 14; + u32 receivedNothing = gLink.receivedNothing << LINK_STAT_RECEIVED_NOTHING_SHIFT; + u32 link_field_F = gLink.link_field_F << LINK_STAT_UNK_FLAG_9_SHIFT; + u32 hardwareError = gLink.hardwareError << LINK_STAT_ERROR_HARDWARE_SHIFT; + u32 badChecksum = gLink.badChecksum << LINK_STAT_ERROR_CHECKSUM_SHIFT; + u32 queueFull = gLink.queueFull << LINK_STAT_ERROR_QUEUE_FULL_SHIFT; u32 val; if (gLink.state == LINK_STATE_CONN_ESTABLISHED) { - val = 0x40; + val = LINK_STAT_CONN_ESTABLISHED; val |= receivedNothing; val |= retVal; val |= link_field_F; @@ -2020,14 +2018,121 @@ u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENG } if (gLink.lag == LAG_MASTER) - retVal |= 0x10000; + { + retVal |= LINK_STAT_ERROR_LAG_MASTER; + } - if (gLink.localId > 3) - retVal |= 0x20000; + if (gLink.localId >= MAX_LINK_PLAYERS) + { + retVal |= LINK_STAT_ERROR_INVALID_ID; + } retVal2 = retVal; if (gLink.lag == LAG_SLAVE) - retVal2 |= 0x40000; + { + retVal2 |= LINK_STAT_ERROR_LAG_SLAVE; + } return retVal2; } + +static void CheckMasterOrSlave(void) +{ + u32 terminals; + + terminals = *(vu32 *)REG_ADDR_SIOCNT & (SIO_MULTI_SD | SIO_MULTI_SI); + if (terminals == SIO_MULTI_SD && gLink.localId == 0) + { + gLink.isMaster = LINK_MASTER; + } + else + { + gLink.isMaster = LINK_SLAVE; + } +} + +static void InitTimer(void) +{ + if (gLink.isMaster) + { + REG_TM3CNT_L = 0xFF3B; + REG_TM3CNT_H = TIMER_64CLK | TIMER_INTR_ENABLE; + EnableInterrupts(INTR_FLAG_TIMER3); + } +} + +static void EnqueueSendCmd(u16 *sendCmd) +{ + u8 i; + u8 offset; + + gLinkSavedIme = REG_IME; + REG_IME = 0; + if (gLink.sendQueue.count < QUEUE_CAPACITY) + { + offset = gLink.sendQueue.pos + gLink.sendQueue.count; + if (offset >= QUEUE_CAPACITY) + { + offset -= QUEUE_CAPACITY; + } + for (i = 0; i < CMD_LENGTH; i ++) + { + sSendNonzeroCheck |= *sendCmd; + gLink.sendQueue.data[i][offset] = *sendCmd; + *sendCmd = 0; + sendCmd++; + } + } + else + { + gLink.queueFull = QUEUE_FULL_SEND; + } + if (sSendNonzeroCheck) + { + gLink.sendQueue.count ++; + sSendNonzeroCheck = 0; + } + REG_IME = gLinkSavedIme; + gLastSendQueueCount = gLink.sendQueue.count; +} + + +static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]) +{ + u8 i; + u8 j; + + gLinkSavedIme = REG_IME; + REG_IME = 0; + if (gLink.recvQueue.count == 0) + { + for (i = 0; i < gLink.playerCount; i ++) + { + for (j = 0; j < CMD_LENGTH; j ++) + { + recvCmds[i][j] = 0; + } + } + + gLink.receivedNothing = TRUE; + } + else + { + for (i = 0; i < gLink.playerCount; i ++) + { + for (j = 0; j < CMD_LENGTH; j ++) + { + recvCmds[i][j] = gLink.recvQueue.data[i][j][gLink.recvQueue.pos]; + } + } + gLink.recvQueue.count --; + gLink.recvQueue.pos ++; + if (gLink.recvQueue.pos >= QUEUE_CAPACITY) + { + gLink.recvQueue.pos = 0; + } + gLink.receivedNothing = FALSE; + } + REG_IME = gLinkSavedIme; +} + From 3bb450645b65fee8a901521d148ab87f81f8f20b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 14 Nov 2017 08:44:32 -0500 Subject: [PATCH 050/123] LinkVSync --- asm/intro.s | 2 +- asm/link.s | 87 +++++++--------------------------------------- asm/link_rfu.s | 6 ++-- include/link.h | 1 - include/link_rfu.h | 1 + src/link.c | 51 +++++++++++++++++++++++++-- src/main.c | 6 ++-- 7 files changed, 69 insertions(+), 85 deletions(-) diff --git a/asm/intro.s b/asm/intro.s index c4d7f80e8..b59ce9012 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -282,7 +282,7 @@ _0816CE6C: .pool _0816CE8C: bl GameCubeMultiBoot_Quit - ldr r0, =sub_800BA38 + ldr r0, =SerialCB bl SetSerialCallback _0816CE96: movs r0, 0 diff --git a/asm/link.s b/asm/link.s index 59e307e21..92e476b61 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,80 +5,17 @@ .text - thumb_func_start sub_800B9B8 -sub_800B9B8: @ 800B9B8 - push {r4,lr} - ldr r3, =gLink - ldrb r4, [r3] - cmp r4, 0 - beq _0800B9F4 - ldrb r0, [r3, 0x1] - cmp r0, 0x2 - beq _0800B9EE - cmp r0, 0x4 - bne _0800BA1E - movs r0, 0xD - ldrsb r0, [r3, r0] - cmp r0, 0x8 - bgt _0800B9E4 - ldrb r0, [r3, 0x10] - cmp r0, 0x1 - beq _0800B9EE - movs r0, 0x1 - strb r0, [r3, 0x13] - b _0800BA1E - .pool -_0800B9E4: - ldrb r0, [r3, 0x13] - cmp r0, 0x1 - beq _0800BA1E - movs r0, 0 - strb r0, [r3, 0xD] -_0800B9EE: - bl sub_800BAC0 - b _0800BA1E -_0800B9F4: - ldrb r2, [r3, 0x1] - cmp r2, 0x4 - beq _0800B9FE - cmp r2, 0x2 - bne _0800BA1E -_0800B9FE: - ldr r1, =gUnknown_03000D6C - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xA - bls _0800BA1E - cmp r2, 0x4 - bne _0800BA16 - movs r0, 0x2 - strb r0, [r3, 0x13] -_0800BA16: - cmp r2, 0x2 - bne _0800BA1E - strb r4, [r3, 0x3] - strb r4, [r3, 0xF] -_0800BA1E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800B9B8 - thumb_func_start Timer3Intr Timer3Intr: @ 800BA28 push {lr} - bl sub_800BD98 - bl sub_800BAC0 + bl StopTimer + bl StartTransfer pop {r0} bx r0 thumb_func_end Timer3Intr - thumb_func_start sub_800BA38 -sub_800BA38: @ 800BA38 + thumb_func_start SerialCB +SerialCB: @ 800BA38 push {r4,lr} ldr r4, =gLink ldr r0, =0x04000128 @@ -121,7 +58,7 @@ _0800BA8A: adds r0, 0x1 movs r2, 0 strb r0, [r3, 0xD] - ldr r1, =gUnknown_03000D6C + ldr r1, =sNumVBlanksWithoutSerialIntr strb r2, [r1] lsls r0, 24 asrs r0, 24 @@ -137,10 +74,10 @@ _0800BAAA: pop {r0} bx r0 .pool - thumb_func_end sub_800BA38 + thumb_func_end SerialCB - thumb_func_start sub_800BAC0 -sub_800BAC0: @ 800BAC0 + thumb_func_start StartTransfer +StartTransfer: @ 800BAC0 ldr r0, =0x04000128 ldrh r1, [r0] movs r2, 0x80 @@ -148,7 +85,7 @@ sub_800BAC0: @ 800BAC0 strh r1, [r0] bx lr .pool - thumb_func_end sub_800BAC0 + thumb_func_end StartTransfer thumb_func_start sub_800BAD0 sub_800BAD0: @ 800BAD0 @@ -496,8 +433,8 @@ _0800BD8C: .pool thumb_func_end sub_800BCE4 - thumb_func_start sub_800BD98 -sub_800BD98: @ 800BD98 + thumb_func_start StopTimer +StopTimer: @ 800BD98 push {lr} ldr r0, =gLink ldrb r0, [r0] @@ -516,7 +453,7 @@ _0800BDB4: pop {r0} bx r0 .pool - thumb_func_end sub_800BD98 + thumb_func_end StopTimer thumb_func_start sub_800BDCC sub_800BDCC: @ 800BDCC diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 3641ec1a3..43a99267f 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7545,13 +7545,13 @@ Rfu_IsMaster: @ 8011AB0 .pool thumb_func_end Rfu_IsMaster - thumb_func_start LinkVSync -LinkVSync: @ 8011ABC + thumb_func_start RfuVSync +RfuVSync: @ 8011ABC push {lr} bl rfu_syncVBlank_ pop {r0} bx r0 - thumb_func_end LinkVSync + thumb_func_end RfuVSync thumb_func_start sub_8011AC8 sub_8011AC8: @ 8011AC8 diff --git a/include/link.h b/include/link.h index 023d95207..dab00195c 100644 --- a/include/link.h +++ b/include/link.h @@ -246,7 +246,6 @@ void sub_800A418(void); void SetSuppressLinkErrorMessage(bool8 flag); void sub_800B524(struct LinkPlayer *linkPlayer); u8 GetSioMultiSI(void); -void sub_800B9B8(void); extern u16 gLinkPartnersHeldKeys[6]; extern u32 gLinkDebugSeed; diff --git a/include/link_rfu.h b/include/link_rfu.h index 2062b3a79..62cff87b9 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -31,5 +31,6 @@ bool32 sub_8010EC0(void); bool32 sub_8010F1C(void); bool32 sub_800F0B8(void); u32 sub_80124D4(void); +void RfuVSync(void); #endif //GUARD_LINK_RFU_H diff --git a/src/link.c b/src/link.c index eb6d573d5..a57385a59 100644 --- a/src/link.c +++ b/src/link.c @@ -60,7 +60,7 @@ IWRAM_DATA u32 sPlayerDataExchangeStatus; IWRAM_DATA u32 gUnknown_03000D60; IWRAM_DATA u8 sLinkTestLastBlockSendPos; ALIGNED() IWRAM_DATA u8 sLinkTestLastBlockRecvPos[MAX_LINK_PLAYERS]; -IWRAM_DATA u8 gUnknown_03000D6C; +IWRAM_DATA u8 sNumVBlanksWithoutSerialIntr; IWRAM_DATA bool8 gUnknown_03000D6D; IWRAM_DATA u16 sSendNonzeroCheck; IWRAM_DATA u16 gUnknown_03000D70; @@ -159,6 +159,7 @@ static void CheckMasterOrSlave(void); static void InitTimer(void); static void EnqueueSendCmd(u16 *sendCmd); static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]); +void StartTransfer(void); // .rodata @@ -1919,7 +1920,7 @@ static void EnableSerial(void) EnableInterrupts(INTR_FLAG_SERIAL); REG_SIOMLT_SEND = 0; CpuFill32(0, &gLink, sizeof(gLink)); - gUnknown_03000D6C = 0; + sNumVBlanksWithoutSerialIntr = 0; sSendNonzeroCheck = 0; gUnknown_03000D70 = 0; gUnknown_03000D72 = 0; @@ -2136,3 +2137,49 @@ static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]) REG_IME = gLinkSavedIme; } +void LinkVSync(void) +{ + if (gLink.isMaster) + { + switch (gLink.state) + { + case LINK_STATE_CONN_ESTABLISHED: + if (gLink.serialIntrCounter < 9) + { + if (gLink.hardwareError != TRUE) + { + gLink.lag = LAG_MASTER; + } + else + { + StartTransfer(); + } + } + else if (gLink.lag != LAG_MASTER) + { + gLink.serialIntrCounter = 0; + StartTransfer(); + } + break; + case LINK_STATE_HANDSHAKE: + StartTransfer(); + break; + } + } + else if (gLink.state == LINK_STATE_CONN_ESTABLISHED || gLink.state == LINK_STATE_HANDSHAKE) + { + if (++ sNumVBlanksWithoutSerialIntr > 10) + { + if (gLink.state == LINK_STATE_CONN_ESTABLISHED) + { + gLink.lag = LAG_SLAVE; + } + if (gLink.state == LINK_STATE_HANDSHAKE) + { + gLink.playerCount = 0; + gLink.link_field_F = FALSE; + } + } + } +} + diff --git a/src/main.c b/src/main.c index 00dd99dc3..09ab3f5e4 100644 --- a/src/main.c +++ b/src/main.c @@ -316,10 +316,10 @@ extern void ProcessDma3Requests(void); static void VBlankIntr(void) { - if (gWirelessCommType != FALSE) - LinkVSync(); + if (gWirelessCommType != 0) + RfuVSync(); else if (gLinkVSyncDisabled == FALSE) - sub_800B9B8(); + LinkVSync(); gMain.vblankCounter1++; From 50501396b21bf132cf71d0f5d353bf51d277ba27 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 15 Nov 2017 08:44:11 -0500 Subject: [PATCH 051/123] DoHandshake --- asm/link.s | 218 ++----------------------------------------------- include/link.h | 2 +- src/link.c | 110 ++++++++++++++++++++++++- 3 files changed, 117 insertions(+), 213 deletions(-) diff --git a/asm/link.s b/asm/link.s index 92e476b61..a2f630487 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,208 +5,8 @@ .text - thumb_func_start Timer3Intr -Timer3Intr: @ 800BA28 - push {lr} - bl StopTimer - bl StartTransfer - pop {r0} - bx r0 - thumb_func_end Timer3Intr - - thumb_func_start SerialCB -SerialCB: @ 800BA38 - push {r4,lr} - ldr r4, =gLink - ldr r0, =0x04000128 - ldr r1, [r0] - lsls r0, r1, 26 - lsrs r0, 30 - strb r0, [r4, 0x2] - ldrb r0, [r4, 0x1] - cmp r0, 0x2 - beq _0800BA6C - cmp r0, 0x4 - bne _0800BA8A - lsls r0, r1, 25 - lsrs r0, 31 - strb r0, [r4, 0x10] - bl sub_800BBCC - bl sub_800BCE4 - bl sub_800BDCC - b _0800BA8A - .pool -_0800BA6C: - bl sub_800BAD0 - lsls r0, 24 - cmp r0, 0 - beq _0800BA8A - ldrb r0, [r4] - cmp r0, 0 - beq _0800BA86 - movs r0, 0x3 - strb r0, [r4, 0x1] - movs r0, 0x8 - strb r0, [r4, 0xD] - b _0800BA8A -_0800BA86: - movs r0, 0x4 - strb r0, [r4, 0x1] -_0800BA8A: - ldr r3, =gLink - ldrb r0, [r3, 0xD] - adds r0, 0x1 - movs r2, 0 - strb r0, [r3, 0xD] - ldr r1, =sNumVBlanksWithoutSerialIntr - strb r2, [r1] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x8 - bne _0800BAAA - ldr r0, =gLastRecvQueueCount - ldr r2, =0x00000fbd - adds r1, r3, r2 - ldrb r1, [r1] - strb r1, [r0] -_0800BAAA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SerialCB - - thumb_func_start StartTransfer -StartTransfer: @ 800BAC0 - ldr r0, =0x04000128 - ldrh r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strh r1, [r0] - bx lr - .pool - thumb_func_end StartTransfer - - thumb_func_start sub_800BAD0 -sub_800BAD0: @ 800BAD0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r5, 0 - ldr r6, =0x0000ffff - ldr r0, =gLink - ldrb r1, [r0, 0xE] - adds r7, r0, 0 - cmp r1, 0x1 - bne _0800BAFC - ldr r1, =0x0400012a - ldr r2, =0x00008fff - b _0800BB00 - .pool -_0800BAFC: - ldr r1, =0x0400012a - ldr r2, =0x0000b9a0 -_0800BB00: - adds r0, r2, 0 - strh r0, [r1] - ldr r2, =gLink+0x4 - ldr r3, =0x04000120 - ldr r0, [r3] - ldr r1, [r3, 0x4] - str r0, [r2] - str r1, [r2, 0x4] - movs r0, 0 - movs r1, 0 - str r0, [r3] - str r1, [r3, 0x4] - strb r0, [r2, 0xA] - movs r4, 0 - ldr r0, =gUnknown_03000D73 - mov r9, r0 - mov r8, r2 - ldr r2, =0x00008fff - ldr r1, =0x0000ffff - mov r12, r1 -_0800BB28: - lsls r0, r4, 1 - add r0, r8 - ldrh r3, [r0] - movs r0, 0x4 - negs r0, r0 - ands r0, r3 - ldr r1, =0x0000b9a0 - cmp r0, r1 - beq _0800BB40 - adds r0, r3, 0 - cmp r0, r2 - bne _0800BB70 -_0800BB40: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r3, 0 - cmp r6, r0 - bls _0800BB78 - cmp r0, 0 - beq _0800BB78 - adds r6, r3, 0 - b _0800BB78 - .pool -_0800BB70: - cmp r0, r12 - beq _0800BB82 - movs r5, 0 - b _0800BB82 -_0800BB78: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800BB28 -_0800BB82: - strb r5, [r7, 0x3] - adds r0, r5, 0 - cmp r0, 0x1 - bls _0800BBB2 - mov r2, r9 - ldrb r2, [r2] - cmp r0, r2 - bne _0800BBA4 - ldrh r1, [r7, 0x4] - ldr r0, =0x00008fff - cmp r1, r0 - bne _0800BBA4 - movs r0, 0x1 - b _0800BBBE - .pool -_0800BBA4: - ldrb r0, [r7, 0x3] - cmp r0, 0x1 - bls _0800BBB2 - movs r0, 0x3 - ands r6, r0 - adds r0, r6, 0x1 - b _0800BBB4 -_0800BBB2: - movs r0, 0 -_0800BBB4: - strb r0, [r7, 0xF] - ldrb r0, [r7, 0x3] - mov r1, r9 - strb r0, [r1] - movs r0, 0 -_0800BBBE: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800BAD0 - - thumb_func_start sub_800BBCC -sub_800BBCC: @ 800BBCC + thumb_func_start DoRecv +DoRecv: @ 800BBCC push {r4-r7,lr} mov r7, r8 push {r7} @@ -345,10 +145,10 @@ _0800BCD0: pop {r0} bx r0 .pool - thumb_func_end sub_800BBCC + thumb_func_end DoRecv - thumb_func_start sub_800BCE4 -sub_800BCE4: @ 800BCE4 + thumb_func_start DoSend +DoSend: @ 800BCE4 push {r4,lr} ldr r0, =gLink ldrb r1, [r0, 0x16] @@ -431,7 +231,7 @@ _0800BD8C: pop {r0} bx r0 .pool - thumb_func_end sub_800BCE4 + thumb_func_end DoSend thumb_func_start StopTimer StopTimer: @ 800BD98 @@ -455,8 +255,8 @@ _0800BDB4: .pool thumb_func_end StopTimer - thumb_func_start sub_800BDCC -sub_800BDCC: @ 800BDCC + thumb_func_start SendRecvDone +SendRecvDone: @ 800BDCC push {lr} ldr r1, =gLink ldrb r0, [r1, 0x17] @@ -480,7 +280,7 @@ _0800BDF4: pop {r0} bx r0 .pool - thumb_func_end sub_800BDCC + thumb_func_end SendRecvDone thumb_func_start sub_800BDFC sub_800BDFC: @ 800BDFC diff --git a/include/link.h b/include/link.h index dab00195c..22be82d44 100644 --- a/include/link.h +++ b/include/link.h @@ -78,7 +78,7 @@ struct LinkStatus #define MASTER_HANDSHAKE 0x8FFF #define SLAVE_HANDSHAKE 0xB9A0 -#define SIO_MULTI_CNT ((volatile struct SioMultiCnt *)REG_ADDR_SIOCNT) +#define SIO_MULTI_CNT ((struct SioMultiCnt *)REG_ADDR_SIOCNT) enum { diff --git a/src/link.c b/src/link.c index a57385a59..741f5f707 100644 --- a/src/link.c +++ b/src/link.c @@ -65,7 +65,7 @@ IWRAM_DATA bool8 gUnknown_03000D6D; IWRAM_DATA u16 sSendNonzeroCheck; IWRAM_DATA u16 gUnknown_03000D70; IWRAM_DATA u8 gUnknown_03000D72; -IWRAM_DATA u8 gUnknown_03000D73; +IWRAM_DATA u8 sHandshakePlayerCount; IWRAM_DATA u8 gUnknown_03000D74; u16 gLinkPartnersHeldKeys[6]; @@ -159,7 +159,12 @@ static void CheckMasterOrSlave(void); static void InitTimer(void); static void EnqueueSendCmd(u16 *sendCmd); static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]); -void StartTransfer(void); +static void StartTransfer(void); +static bool8 DoHandshake(void); +void DoRecv(void); +void DoSend(void); +void StopTimer(void); +void SendRecvDone(void); // .rodata @@ -1924,7 +1929,7 @@ static void EnableSerial(void) sSendNonzeroCheck = 0; gUnknown_03000D70 = 0; gUnknown_03000D72 = 0; - gUnknown_03000D73 = 0; + sHandshakePlayerCount = 0; gLastSendQueueCount = 0; gLastRecvQueueCount = 0; } @@ -2183,3 +2188,102 @@ void LinkVSync(void) } } +void Timer3Intr(void) +{ + StopTimer(); + StartTransfer(); +} + +void SerialCB(void) +{ + gLink.localId = SIO_MULTI_CNT->id; + switch (gLink.state) + { + case LINK_STATE_CONN_ESTABLISHED: + gLink.hardwareError = SIO_MULTI_CNT->error; + DoRecv(); + DoSend(); + SendRecvDone(); + break; + case LINK_STATE_HANDSHAKE: + if (DoHandshake()) + { + if (gLink.isMaster) + { + gLink.state = LINK_STATE_INIT_TIMER; + gLink.serialIntrCounter = 8; + } + else + { + gLink.state = LINK_STATE_CONN_ESTABLISHED; + } + } + break; + } + gLink.serialIntrCounter ++; + sNumVBlanksWithoutSerialIntr = 0; + if (gLink.serialIntrCounter == 8) + { + gLastRecvQueueCount = gLink.recvQueue.count; + } +} + +static void StartTransfer(void) +{ + REG_SIOCNT |= SIO_START; +} + +static bool8 DoHandshake(void) +{ + u8 i; + u8 playerCount; + u16 minRecv; + + playerCount = 0; + minRecv = 0xFFFF; + if (gLink.handshakeAsMaster == TRUE) + { + REG_SIOMLT_SEND = MASTER_HANDSHAKE; + } + else + { + REG_SIOMLT_SEND = SLAVE_HANDSHAKE; + } + *(u64 *)gLink.tempRecvBuffer = REG_SIOMLT_RECV; + REG_SIOMLT_RECV = 0; + gLink.handshakeAsMaster = FALSE; + for (i = 0; i < 4; i ++) + { + if ((gLink.tempRecvBuffer[i] & ~0x3) == SLAVE_HANDSHAKE || gLink.tempRecvBuffer[i] == MASTER_HANDSHAKE) + { + playerCount ++; + if (minRecv > gLink.tempRecvBuffer[i] && gLink.tempRecvBuffer[i] != 0) + { + minRecv = gLink.tempRecvBuffer[i]; + } + } + else + { + if (gLink.tempRecvBuffer[i] != 0xFFFF) + { + playerCount = 0; + } + break; + } + } + gLink.playerCount = playerCount; + if (gLink.playerCount > 1 && gLink.playerCount == sHandshakePlayerCount && gLink.tempRecvBuffer[0] == MASTER_HANDSHAKE) + { + return TRUE; + } + if (gLink.playerCount > 1) + { + gLink.link_field_F = (minRecv & 3) + 1; + } + else + { + gLink.link_field_F = 0; + } + sHandshakePlayerCount = gLink.playerCount; + return FALSE; +} From 2fd6aad25aa0157102e7c287e8a0b4d1605b8fa4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 16 Nov 2017 21:38:06 -0500 Subject: [PATCH 052/123] through SendRecvDone --- asm/link.s | 277 ----------------------------------------------------- src/link.c | 257 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 183 insertions(+), 351 deletions(-) diff --git a/asm/link.s b/asm/link.s index a2f630487..9f646bce5 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,283 +5,6 @@ .text - thumb_func_start DoRecv -DoRecv: @ 800BBCC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - ldr r0, =0x04000120 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, =gLink - ldrb r1, [r0, 0x16] - adds r6, r0, 0 - cmp r1, 0 - bne _0800BC30 - movs r4, 0 - ldr r7, =gUnknown_03000D72 - ldrb r0, [r6, 0x3] - cmp r4, r0 - bcs _0800BC1A - adds r5, r6, 0 - ldrh r1, [r6, 0x14] - adds r3, r7, 0 - adds r2, r6, 0 -_0800BBFA: - lsls r0, r4, 1 - add r0, sp - ldrh r0, [r0] - cmp r1, r0 - beq _0800BC0E - ldrb r0, [r3] - cmp r0, 0 - beq _0800BC0E - movs r0, 0x1 - strb r0, [r5, 0x11] -_0800BC0E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldrb r0, [r2, 0x3] - cmp r4, r0 - bcc _0800BBFA -_0800BC1A: - movs r0, 0 - strh r0, [r6, 0x14] - movs r0, 0x1 - strb r0, [r7] - b _0800BCD0 - .pool -_0800BC30: - ldr r2, =0x00000fbc - adds r1, r6, r2 - adds r2, 0x1 - adds r0, r6, r2 - ldrb r2, [r0] - ldrb r1, [r1] - adds r0, r2, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x31 - bls _0800BC4C - subs r0, 0x32 - lsls r0, 24 - lsrs r0, 24 -_0800BC4C: - cmp r2, 0x31 - bhi _0800BCA8 - movs r4, 0 - ldrb r1, [r6, 0x3] - cmp r4, r1 - bcs _0800BCAC - adds r5, r6, 0 - ldr r7, =gUnknown_03000D70 - lsls r0, 1 - mov r12, r0 - movs r2, 0xCF - lsls r2, 2 - adds r2, r6 - mov r8, r2 -_0800BC68: - lsls r1, r4, 1 - mov r2, sp - adds r0, r2, r1 - ldrh r3, [r0] - ldrh r2, [r5, 0x14] - adds r0, r3, r2 - strh r0, [r5, 0x14] - ldrh r0, [r7] - orrs r0, r3 - strh r0, [r7] - ldrb r2, [r5, 0x17] - movs r0, 0x64 - muls r0, r2 - add r0, r12 - adds r1, r4 - lsls r1, 3 - adds r1, r4 - lsls r1, 5 - adds r0, r1 - add r0, r8 - strh r3, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldrb r0, [r5, 0x3] - cmp r4, r0 - bcc _0800BC68 - b _0800BCAC - .pool -_0800BCA8: - movs r0, 0x2 - strb r0, [r6, 0x12] -_0800BCAC: - ldrb r0, [r6, 0x17] - adds r0, 0x1 - strb r0, [r6, 0x17] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x8 - bne _0800BCD0 - ldr r2, =gUnknown_03000D70 - ldrh r0, [r2] - cmp r0, 0 - beq _0800BCD0 - ldr r1, =0x00000fbd - adds r0, r6, r1 - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - movs r0, 0 - strh r0, [r2] -_0800BCD0: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DoRecv - - thumb_func_start DoSend -DoSend: @ 800BCE4 - push {r4,lr} - ldr r0, =gLink - ldrb r1, [r0, 0x16] - adds r4, r0, 0 - cmp r1, 0x8 - bne _0800BD36 - ldr r1, =0x0400012a - ldrh r0, [r4, 0x14] - strh r0, [r1] - ldr r1, =gUnknown_03000D6D - ldrb r2, [r1] - cmp r2, 0 - bne _0800BD30 - ldr r0, =0x00000339 - adds r1, r4, r0 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - movs r0, 0xCE - lsls r0, 2 - adds r1, r4, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x31 - bls _0800BD8C - strb r2, [r1] - b _0800BD8C - .pool -_0800BD30: - movs r0, 0 - strb r0, [r1] - b _0800BD8C -_0800BD36: - ldr r1, =gUnknown_03000D6D - ldrb r0, [r1] - cmp r0, 0 - bne _0800BD52 - ldr r2, =0x00000339 - adds r0, r4, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _0800BD4C - movs r0, 0x1 - strb r0, [r1] -_0800BD4C: - ldrb r0, [r1] - cmp r0, 0 - beq _0800BD68 -_0800BD52: - ldr r1, =0x0400012a - movs r0, 0 - strh r0, [r1] - b _0800BD86 - .pool -_0800BD68: - ldr r3, =0x0400012a - movs r1, 0xCE - lsls r1, 2 - adds r0, r4, r1 - ldrb r0, [r0] - lsls r0, 1 - ldrb r2, [r4, 0x16] - movs r1, 0x64 - muls r1, r2 - adds r0, r1 - adds r1, r4, 0 - adds r1, 0x18 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r3] -_0800BD86: - ldrb r0, [r4, 0x16] - adds r0, 0x1 - strb r0, [r4, 0x16] -_0800BD8C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end DoSend - - thumb_func_start StopTimer -StopTimer: @ 800BD98 - push {lr} - ldr r0, =gLink - ldrb r0, [r0] - cmp r0, 0 - beq _0800BDB4 - ldr r2, =0x0400010e - ldrh r1, [r2] - ldr r0, =0x0000ff7f - ands r0, r1 - strh r0, [r2] - ldr r1, =0x0400010c - ldr r2, =0x0000ff3b - adds r0, r2, 0 - strh r0, [r1] -_0800BDB4: - pop {r0} - bx r0 - .pool - thumb_func_end StopTimer - - thumb_func_start SendRecvDone -SendRecvDone: @ 800BDCC - push {lr} - ldr r1, =gLink - ldrb r0, [r1, 0x17] - cmp r0, 0x8 - bne _0800BDE4 - movs r0, 0 - strb r0, [r1, 0x16] - strb r0, [r1, 0x17] - b _0800BDF4 - .pool -_0800BDE4: - ldrb r0, [r1] - cmp r0, 0 - beq _0800BDF4 - ldr r0, =0x0400010e - ldrh r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strh r1, [r0] -_0800BDF4: - pop {r0} - bx r0 - .pool - thumb_func_end SendRecvDone - thumb_func_start sub_800BDFC sub_800BDFC: @ 800BDFC push {r4-r6,lr} diff --git a/src/link.c b/src/link.c index 23ebdc01a..adb997511 100644 --- a/src/link.c +++ b/src/link.c @@ -61,10 +61,10 @@ IWRAM_DATA u32 gUnknown_03000D60; IWRAM_DATA u8 sLinkTestLastBlockSendPos; ALIGNED() IWRAM_DATA u8 sLinkTestLastBlockRecvPos[MAX_LINK_PLAYERS]; IWRAM_DATA u8 sNumVBlanksWithoutSerialIntr; -IWRAM_DATA bool8 gUnknown_03000D6D; +IWRAM_DATA bool8 sSendBufferEmpty; IWRAM_DATA u16 sSendNonzeroCheck; -IWRAM_DATA u16 gUnknown_03000D70; -IWRAM_DATA u8 gUnknown_03000D72; +IWRAM_DATA u16 sRecvNonzeroCheck; +IWRAM_DATA u8 sChecksumAvailable; IWRAM_DATA u8 sHandshakePlayerCount; IWRAM_DATA u8 gUnknown_03000D74; @@ -161,10 +161,10 @@ static void EnqueueSendCmd(u16 *sendCmd); static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]); static void StartTransfer(void); static bool8 DoHandshake(void); -void DoRecv(void); -void DoSend(void); -void StopTimer(void); -void SendRecvDone(void); +static void DoRecv(void); +static void DoSend(void); +static void StopTimer(void); +static void SendRecvDone(void); // .rodata @@ -282,7 +282,7 @@ void LinkTestScreen(void) gLinkType = 0x1111; OpenLink(); SeedRng(gMain.vblankCounter2); - for (i = 0; i < MAX_LINK_PLAYERS; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { gSaveBlock2Ptr->playerTrainerId[i] = Random() % 256; } @@ -331,7 +331,7 @@ static void InitLink(void) { int i; - for (i = 0; i < 8; i ++) + for (i = 0; i < 8; i++) { gSendCmd[i] = 0xefff; } @@ -341,7 +341,7 @@ static void InitLink(void) static void Task_TriggerHandshake(u8 taskId) { - if (++ gTasks[taskId].data[0] == 5) + if (++gTasks[taskId].data[0] == 5) { gShouldAdvanceLinkState = 1; DestroyTask(taskId); @@ -373,7 +373,7 @@ void OpenLink(void) sub_800E700(); } gReceivedRemoteLinkPlayers = 0; - for (i = 0; i < MAX_LINK_PLAYERS; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { gRemoteLinkPlayersNotReceived[i] = TRUE; gUnknown_030030F0[i] = FALSE; @@ -402,7 +402,7 @@ static void TestBlockTransfer(u8 nothing, u8 is, u8 used) LinkTest_prnthex(sBlockSend.pos, 2, 3, 2); sLinkTestLastBlockSendPos = sBlockSend.pos; } - for (i = 0; i < MAX_LINK_PLAYERS; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { if (sLinkTestLastBlockRecvPos[i] != sBlockRecv[i].pos) { @@ -413,7 +413,7 @@ static void TestBlockTransfer(u8 nothing, u8 is, u8 used) status = GetBlockReceivedStatus(); if (status == 0xF) // 0b1111 { - for (i = 0; i < MAX_LINK_PLAYERS; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { if ((status >> i) & 1) { @@ -479,7 +479,7 @@ u16 LinkMain2(const u16 *heldKeys) { return 0; } - for (i = 0; i < 8; i ++) + for (i = 0; i < 8; i++) { gSendCmd[i] = 0; } @@ -503,7 +503,7 @@ static void HandleReceiveRemoteLinkPlayer(u8 who) count = 0; gRemoteLinkPlayersNotReceived[who] = FALSE; - for (i = 0; i < GetLinkPlayerCount_2(); i ++) + for (i = 0; i < GetLinkPlayerCount_2(); i++) { count += gRemoteLinkPlayersNotReceived[i]; } @@ -517,7 +517,7 @@ static void ProcessRecvCmds(u8 unused) { u16 i; - for (i = 0; i < MAX_LINK_PLAYERS; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { gLinkPartnersHeldKeys[i] = 0; if (gRecvCmds[i][0] == 0) @@ -565,7 +565,7 @@ static void ProcessRecvCmds(u8 unused) u16 j; buffer = (u16 *)gDecompressionBuffer; - for (j = 0; j < CMD_LENGTH - 1; j ++) + for (j = 0; j < CMD_LENGTH - 1; j++) { buffer[(sBlockRecv[i].pos / 2) + j] = gRecvCmds[i][j + 1]; } @@ -574,7 +574,7 @@ static void ProcessRecvCmds(u8 unused) { u16 j; - for (j = 0; j < CMD_LENGTH - 1; j ++) + for (j = 0; j < CMD_LENGTH - 1; j++) { gBlockRecvBuffer[i][(sBlockRecv[i].pos / 2) + j] = gRecvCmds[i][j + 1]; } @@ -662,7 +662,7 @@ static void BuildSendCmd(u16 command) u8 i; gSendCmd[0] = LINKCMD_0x7777; - for (i = 0; i < 5; i ++) + for (i = 0; i < 5; i++) { gSendCmd[i + 1] = 0xEE; } @@ -771,7 +771,7 @@ static int sub_8009FF8(u32 version1, u32 version2) u8 nPlayers; nPlayers = GetLinkPlayerCount(); - for (i = 0; i < nPlayers; i ++) + for (i = 0; i < nPlayers; i++) { if ((gLinkPlayers[i].version & 0xFF) == version1 || (gLinkPlayers[i].version & 0xFF) == version2) { @@ -848,11 +848,11 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper) gLinkErrorOccurred = TRUE; CloseLink(); } - for (i = 0, index = 0; i < GetLinkPlayerCount(); index ++, i ++) + for (i = 0, index = 0; i < GetLinkPlayerCount(); index++, i++) { if (gLinkPlayers[index].linkType == gLinkPlayers[0].linkType) { - count ++; + count++; } } if (count == GetLinkPlayerCount()) @@ -889,7 +889,7 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper) } } } - else if (++ gLinkTimeOutCounter > 600) + else if (++gLinkTimeOutCounter > 600) { sPlayerDataExchangeStatus = EXCHANGE_TIMED_OUT; } @@ -903,11 +903,11 @@ bool8 IsLinkPlayerDataExchangeComplete(void) bool8 retval; count = 0; - for (i = 0; i < GetLinkPlayerCount(); i ++) + for (i = 0; i < GetLinkPlayerCount(); i++) { if (gLinkPlayers[i].linkType == gLinkPlayers[0].linkType) { - count ++; + count++; } } if (count == GetLinkPlayerCount()) @@ -932,7 +932,7 @@ void ResetLinkPlayers(void) { int i; - for (i = 0; i <= MAX_LINK_PLAYERS; i ++) + for (i = 0; i <= MAX_LINK_PLAYERS; i++) { gLinkPlayers[i] = (struct LinkPlayer){}; } @@ -976,7 +976,7 @@ static bool32 InitBlockSend(const void *src, size_t size) static void LinkCB_BlockSendBegin(void) { - if (++ sBlockSendDelayCounter > 2) + if (++sBlockSendDelayCounter > 2) { gLinkCallback = LinkCB_BlockSend; } @@ -989,7 +989,7 @@ static void LinkCB_BlockSend(void) src = sBlockSend.src; gSendCmd[0] = LINKCMD_CONT_BLOCK; - for (i = 0; i < 7; i ++) + for (i = 0; i < 7; i++) { gSendCmd[i + 1] = (src[sBlockSend.pos + i * 2 + 1] << 8) | src[sBlockSend.pos + i * 2]; } @@ -1010,7 +1010,7 @@ static void sub_800A3F8(void) { GetMultiplayerId(); BuildSendCmd(LINKCMD_SEND_HELD_KEYS); - gUnknown_020223C0 ++; + gUnknown_020223C0++; } void sub_800A418(void) @@ -1113,14 +1113,14 @@ void ResetBlockReceivedFlags(void) if (gWirelessCommType == TRUE) { - for (i = 0; i < MAX_RFU_PLAYERS; i ++) + for (i = 0; i < MAX_RFU_PLAYERS; i++) { sub_800F728(i); } } else { - for (i = 0; i < MAX_LINK_PLAYERS; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { gBlockReceivedStatus[i] = FALSE; } @@ -1153,7 +1153,7 @@ static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size) u16 i; chksum = 0; - for (i = 0; i < size / 2; i ++) + for (i = 0; i < size / 2; i++) { chksum += src[i]; } @@ -1181,15 +1181,15 @@ static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2) char sp[32 / 2]; int i; - for (i = 0; i < a2; i ++) + for (i = 0; i < a2; i++) { sp[i] = pos & 0xf; pos >>= 4; } - for (i = a2 - 1; i >= 0; i --) + for (i = a2 - 1; i >= 0; i--) { LinkTest_prnthexchar(sp[i], a0, a1); - a0 ++; + a0++; } } @@ -1205,15 +1205,15 @@ static void LinkTest_prntint(int a0, u8 a1, u8 a2, u8 a3) sp10 = a1; a0 = -a0; } - for (i = 0; i < a3; i ++) + for (i = 0; i < a3; i++) { sp[i] = a0 % 10; a0 /= 10; } - for (i = a3 - 1; i >= 0; i --) + for (i = a3 - 1; i >= 0; i--) { LinkTest_prnthexchar(sp[i], a1, a2); - a1 ++; + a1++; } if (sp10 != -1) { @@ -1229,17 +1229,17 @@ static void LinkTest_prntstr(const char *a0, u8 a1, u8 a2) r5 = 0; r6 = 0; - for (i = 0; a0[i] != 0; a0 ++) + for (i = 0; a0[i] != 0; a0++) { if (a0[i] == *"\n") { - r5 ++; + r5++; r6 = 0; } else { LinkTest_prntchar(a0[i], a1 + r6, a2 + r5); - r6 ++; + r6++; } } } @@ -1292,7 +1292,7 @@ u8 sub_800A9A8(void) u8 flags; flags = 0; - for (i = 0; i < gSavedLinkPlayerCount; i ++) + for (i = 0; i < gSavedLinkPlayerCount; i++) { flags |= (1 << i); } @@ -1305,7 +1305,7 @@ u8 sub_800A9D8(void) u8 flags; flags = 0; - for (i = 0; i < GetLinkPlayerCount(); i ++) + for (i = 0; i < GetLinkPlayerCount(); i++) { flags |= (1 << i); } @@ -1318,7 +1318,7 @@ void sub_800AA04(u8 a0) gSavedLinkPlayerCount = a0; gSavedMultiplayerId = GetMultiplayerId(); - for (i = 0; i < MAX_RFU_PLAYERS; i ++) + for (i = 0; i < MAX_RFU_PLAYERS; i++) { gSavedLinkPlayers[i] = gLinkPlayers[i]; } @@ -1340,7 +1340,7 @@ bool8 sub_800AA60(void) unsigned count; count = 0; - for (i = 0; i < gSavedLinkPlayerCount; i ++) + for (i = 0; i < gSavedLinkPlayerCount; i++) { if (gLinkPlayers[i].trainerId == gSavedLinkPlayers[i].trainerId) { @@ -1348,12 +1348,12 @@ bool8 sub_800AA60(void) { if (gLinkType == gLinkPlayers[i].linkType) { - count ++; + count++; } } else { - count ++; + count++; } } } @@ -1372,7 +1372,7 @@ void sub_800AAF4(void) int i; // Clearly not what was meant to be written, but here it is anyway. - for (i = 0; i < 4; i ++) + for (i = 0; i < 4; i++) { CpuSet(&gSavedLinkPlayers[i], NULL, sizeof(struct LinkPlayer)); } @@ -1382,7 +1382,7 @@ void sub_800AB18(void) { u8 i; - for (i = 0; i < gSavedLinkPlayerCount; i ++) + for (i = 0; i < gSavedLinkPlayerCount; i++) { if (gSavedLinkPlayers[i].trainerId != gLinkPlayers[i].trainerId || StringCompare(gSavedLinkPlayers[i].name, gLinkPlayers[i].name) != 0) { @@ -1445,7 +1445,7 @@ void sub_800AC34(void) { if (gLinkCallback != NULL) { - gUnknown_02022B08 ++; + gUnknown_02022B08++; } else { @@ -1473,11 +1473,11 @@ static void sub_800ACAC(void) linkPlayerCount = GetLinkPlayerCount(); count = 0; - for (i = 0; i < linkPlayerCount; i ++) + for (i = 0; i < linkPlayerCount; i++) { if (gUnknown_030030F0[i]) { - count ++; + count++; } } if (count == linkPlayerCount) @@ -1500,7 +1500,7 @@ void sub_800AD10(void) { if (gLinkCallback != NULL) { - gUnknown_02022B08 ++; + gUnknown_02022B08++; } else { @@ -1528,15 +1528,15 @@ static void sub_800AD88(void) linkPlayerCount = GetLinkPlayerCount(); count = 0; - for (i = 0; i < linkPlayerCount; i ++) + for (i = 0; i < linkPlayerCount; i++) { if (gLinkPlayers[i].language == LANGUAGE_JAPANESE) { - count ++; + count++; } else if (gUnknown_030030F0[i]) { - count ++; + count++; } } if (count == linkPlayerCount) @@ -1580,7 +1580,7 @@ static void sub_800AE5C(void) u8 linkPlayerCount; linkPlayerCount = GetLinkPlayerCount(); - for (i = 0; i < linkPlayerCount; i ++) + for (i = 0; i < linkPlayerCount; i++) { if (!gUnknown_030030EC[i]) { @@ -1589,7 +1589,7 @@ static void sub_800AE5C(void) } if (i == linkPlayerCount) { - for (i = 0; i < MAX_LINK_PLAYERS; i ++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { gUnknown_030030EC[i] = FALSE; } @@ -1767,7 +1767,7 @@ static void CB2_PrintErrorMessage(void) } if (gMain.state != 160) { - gMain.state ++; + gMain.state++; } } @@ -1927,8 +1927,8 @@ static void EnableSerial(void) CpuFill32(0, &gLink, sizeof(gLink)); sNumVBlanksWithoutSerialIntr = 0; sSendNonzeroCheck = 0; - gUnknown_03000D70 = 0; - gUnknown_03000D72 = 0; + sRecvNonzeroCheck = 0; + sChecksumAvailable = 0; sHandshakePlayerCount = 0; gLastSendQueueCount = 0; gLastRecvQueueCount = 0; @@ -2061,7 +2061,7 @@ static void InitTimer(void) { if (gLink.isMaster) { - REG_TM3CNT_L = 0xFF3B; + REG_TM3CNT_L = -197; REG_TM3CNT_H = TIMER_64CLK | TIMER_INTR_ENABLE; EnableInterrupts(INTR_FLAG_TIMER3); } @@ -2081,7 +2081,7 @@ static void EnqueueSendCmd(u16 *sendCmd) { offset -= QUEUE_CAPACITY; } - for (i = 0; i < CMD_LENGTH; i ++) + for (i = 0; i < CMD_LENGTH; i++) { sSendNonzeroCheck |= *sendCmd; gLink.sendQueue.data[i][offset] = *sendCmd; @@ -2095,7 +2095,7 @@ static void EnqueueSendCmd(u16 *sendCmd) } if (sSendNonzeroCheck) { - gLink.sendQueue.count ++; + gLink.sendQueue.count++; sSendNonzeroCheck = 0; } REG_IME = gLinkSavedIme; @@ -2112,9 +2112,9 @@ static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]) REG_IME = 0; if (gLink.recvQueue.count == 0) { - for (i = 0; i < gLink.playerCount; i ++) + for (i = 0; i < gLink.playerCount; i++) { - for (j = 0; j < CMD_LENGTH; j ++) + for (j = 0; j < CMD_LENGTH; j++) { recvCmds[i][j] = 0; } @@ -2124,15 +2124,15 @@ static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]) } else { - for (i = 0; i < gLink.playerCount; i ++) + for (i = 0; i < gLink.playerCount; i++) { - for (j = 0; j < CMD_LENGTH; j ++) + for (j = 0; j < CMD_LENGTH; j++) { recvCmds[i][j] = gLink.recvQueue.data[i][j][gLink.recvQueue.pos]; } } - gLink.recvQueue.count --; - gLink.recvQueue.pos ++; + gLink.recvQueue.count--; + gLink.recvQueue.pos++; if (gLink.recvQueue.pos >= QUEUE_CAPACITY) { gLink.recvQueue.pos = 0; @@ -2142,6 +2142,8 @@ static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]) REG_IME = gLinkSavedIme; } +// link_intr.c + void LinkVSync(void) { if (gLink.isMaster) @@ -2173,7 +2175,7 @@ void LinkVSync(void) } else if (gLink.state == LINK_STATE_CONN_ESTABLISHED || gLink.state == LINK_STATE_HANDSHAKE) { - if (++ sNumVBlanksWithoutSerialIntr > 10) + if (++sNumVBlanksWithoutSerialIntr > 10) { if (gLink.state == LINK_STATE_CONN_ESTABLISHED) { @@ -2220,7 +2222,7 @@ void SerialCB(void) } break; } - gLink.serialIntrCounter ++; + gLink.serialIntrCounter++; sNumVBlanksWithoutSerialIntr = 0; if (gLink.serialIntrCounter == 8) { @@ -2252,11 +2254,11 @@ static bool8 DoHandshake(void) *(u64 *)gLink.tempRecvBuffer = REG_SIOMLT_RECV; REG_SIOMLT_RECV = 0; gLink.handshakeAsMaster = FALSE; - for (i = 0; i < 4; i ++) + for (i = 0; i < 4; i++) { if ((gLink.tempRecvBuffer[i] & ~0x3) == SLAVE_HANDSHAKE || gLink.tempRecvBuffer[i] == MASTER_HANDSHAKE) { - playerCount ++; + playerCount++; if (minRecv > gLink.tempRecvBuffer[i] && gLink.tempRecvBuffer[i] != 0) { minRecv = gLink.tempRecvBuffer[i]; @@ -2287,3 +2289,110 @@ static bool8 DoHandshake(void) sHandshakePlayerCount = gLink.playerCount; return FALSE; } + +static void DoRecv(void) +{ + u16 recv[4]; + u8 i; + u8 index; + + *(u64 *)recv = REG_SIOMLT_RECV; + if (gLink.sendCmdIndex == 0) + { + for (i = 0; i < gLink.playerCount; i++) + { + if (gLink.checksum != recv[i] && sChecksumAvailable) + { + gLink.badChecksum = TRUE; + } + } + gLink.checksum = 0; + sChecksumAvailable = TRUE; + } + else + { + index = gLink.recvQueue.pos + gLink.recvQueue.count; + if (index >= QUEUE_CAPACITY) + { + index -= QUEUE_CAPACITY; + } + if (gLink.recvQueue.count < QUEUE_CAPACITY) + { + for (i = 0; i < gLink.playerCount; i++) + { + gLink.checksum += recv[i]; + sRecvNonzeroCheck |= recv[i]; + gLink.recvQueue.data[i][gLink.recvCmdIndex][index] = recv[i]; + } + } + else + { + gLink.queueFull = QUEUE_FULL_RECV; + } + gLink.recvCmdIndex++; + if (gLink.recvCmdIndex == CMD_LENGTH && sRecvNonzeroCheck) + { + gLink.recvQueue.count++; + sRecvNonzeroCheck = 0; + } + } +} + +static void DoSend(void) +{ + if (gLink.sendCmdIndex == CMD_LENGTH) + { + REG_SIOMLT_SEND = gLink.checksum; + if (!sSendBufferEmpty) + { + gLink.sendQueue.count--; + gLink.sendQueue.pos++; + if (gLink.sendQueue.pos >= QUEUE_CAPACITY) + { + gLink.sendQueue.pos = 0; + } + } + else + { + sSendBufferEmpty = FALSE; + } + } + else + { + if (!sSendBufferEmpty && gLink.sendQueue.count == 0) + { + sSendBufferEmpty = TRUE; + } + if (sSendBufferEmpty) + { + REG_SIOMLT_SEND = 0; + } + else + { + REG_SIOMLT_SEND = gLink.sendQueue.data[gLink.sendCmdIndex][gLink.sendQueue.pos]; + } + gLink.sendCmdIndex++; + } +} + +static void StopTimer(void) +{ + if (gLink.isMaster) + { + REG_TM3CNT_H &= ~TIMER_ENABLE; + REG_TM3CNT_L = -197; + } +} + +static void SendRecvDone(void) +{ + if (gLink.recvCmdIndex == CMD_LENGTH) + { + gLink.sendCmdIndex = 0; + gLink.recvCmdIndex = 0; + } + else if (gLink.isMaster) + { + REG_TM3CNT_H |= TIMER_ENABLE; + } +} From cc37d7e15b5d5b23bc56bb8fc3787198db934757 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 16 Nov 2017 22:13:42 -0500 Subject: [PATCH 053/123] reset buffers --- asm/link.s | 98 ------------------------------------------------------ src/link.c | 40 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 98 deletions(-) diff --git a/asm/link.s b/asm/link.s index 9f646bce5..b25568209 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,104 +5,6 @@ .text - thumb_func_start sub_800BDFC -sub_800BDFC: @ 800BDFC - push {r4-r6,lr} - ldr r1, =gLink - ldr r2, =0x00000339 - adds r0, r1, r2 - movs r2, 0 - strb r2, [r0] - movs r3, 0xCE - lsls r3, 2 - adds r0, r1, r3 - strb r2, [r0] - movs r0, 0 - movs r6, 0x64 - adds r5, r1, 0 - adds r5, 0x18 - ldr r4, =0x0000efff -_0800BE1A: - movs r2, 0 - adds r1, r0, 0x1 - adds r3, r0, 0 - muls r3, r6 -_0800BE22: - lsls r0, r2, 1 - adds r0, r3 - adds r0, r5 - strh r4, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x31 - bls _0800BE22 - lsls r0, r1, 24 - lsrs r0, 24 - cmp r0, 0x7 - bls _0800BE1A - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BDFC - - thumb_func_start sub_800BE50 -sub_800BE50: @ 800BE50 - push {r4-r7,lr} - ldr r1, =gLink - ldr r2, =0x00000fbd - adds r0, r1, r2 - movs r2, 0 - strb r2, [r0] - ldr r3, =0x00000fbc - adds r0, r1, r3 - strb r2, [r0] - movs r0, 0x64 - mov r12, r0 - movs r3, 0xCF - lsls r3, 2 - adds r7, r1, r3 - ldr r6, =0x0000efff -_0800BE6E: - movs r3, 0 - lsls r0, r2, 1 - adds r5, r2, 0x1 - adds r0, r2 - lsls r0, 3 - adds r0, r2 - lsls r4, r0, 5 -_0800BE7C: - movs r2, 0 - adds r1, r3, 0x1 - mov r0, r12 - muls r0, r3 - adds r3, r0, 0 -_0800BE86: - lsls r0, r2, 1 - adds r0, r3 - adds r0, r4 - adds r0, r7 - strh r6, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x31 - bls _0800BE86 - lsls r0, r1, 24 - lsrs r3, r0, 24 - cmp r3, 0x7 - bls _0800BE7C - lsls r0, r5, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800BE6E - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BE50 - // RFU; bss indicates that no file boundary exists here thumb_func_start sub_800BEC0 diff --git a/src/link.c b/src/link.c index adb997511..aa9e0a65d 100644 --- a/src/link.c +++ b/src/link.c @@ -1771,6 +1771,8 @@ static void CB2_PrintErrorMessage(void) } } +// TODO: there might be a file boundary here, let's name it + bool8 GetSioMultiSI(void) { return (REG_SIOCNT & 0x04) != 0; @@ -1940,6 +1942,8 @@ void ResetSerial(void) DisableSerial(); } +// link_main1.c + u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENGTH]) { u32 retVal; @@ -2396,3 +2400,39 @@ static void SendRecvDone(void) REG_TM3CNT_H |= TIMER_ENABLE; } } + +void ResetSendBuffer(void) +{ + u8 i; + u8 j; + + gLink.sendQueue.count = 0; + gLink.sendQueue.pos = 0; + for (i = 0; i < CMD_LENGTH; i++) + { + for (j = 0; j < QUEUE_CAPACITY; j++) + { + gLink.sendQueue.data[i][j] = 0xEFFF; + } + } +} + +void ResetRecvBuffer(void) +{ + u8 i; + u8 j; + u8 k; + + gLink.recvQueue.count = 0; + gLink.recvQueue.pos = 0; + for (i = 0; i < MAX_LINK_PLAYERS; i++) + { + for (j = 0; j < CMD_LENGTH; j++) + { + for (k = 0; k < QUEUE_CAPACITY; k++) + { + gLink.recvQueue.data[i][j][k] = 0xEFFF; + } + } + } +} From 3c20c54b83d00724b5b724f25eaa294e6afb8f3e Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 16 Nov 2017 23:37:09 -0500 Subject: [PATCH 054/123] sub_800BEC0 --- asm/link.s | 38 -------------------------------------- include/librfu.h | 1 + include/link_rfu.h | 16 ++++++++++++++++ src/link.c | 31 +++++++++++++++++++++++++++++++ src/link_rfu.c | 4 ++++ 5 files changed, 52 insertions(+), 38 deletions(-) diff --git a/asm/link.s b/asm/link.s index b25568209..38629bff9 100644 --- a/asm/link.s +++ b/asm/link.s @@ -7,44 +7,6 @@ // RFU; bss indicates that no file boundary exists here - thumb_func_start sub_800BEC0 -sub_800BEC0: @ 800BEC0 - push {r4,lr} - bl rfu_REQBN_softReset_and_checkID - adds r4, r0, 0 - ldr r0, =0x00008001 - cmp r4, r0 - bne _0800BED4 - ldr r1, =gUnknown_03004140 - movs r0, 0x1 - strb r0, [r1, 0x8] -_0800BED4: - ldr r0, =gUnknown_03004140 - ldrb r2, [r0, 0x4] - adds r1, r0, 0 - cmp r2, 0x17 - beq _0800BEE8 - cmp r2, 0x1 - beq _0800BEE8 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] -_0800BEE8: - movs r0, 0 - strb r0, [r1, 0x7] - strb r0, [r1, 0xD] - strb r0, [r1, 0x1] - strb r0, [r1] - movs r0, 0xFF - strb r0, [r1, 0x6] - bl sub_800D610 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800BEC0 - thumb_func_start rfu_REQ_sendData_wrapper rfu_REQ_sendData_wrapper: @ 800BF0C push {lr} diff --git a/include/librfu.h b/include/librfu.h index 0cf781d73..609fffea2 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -108,3 +108,4 @@ extern struct RfuStruct *gRfuState; void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam); void rfu_REQ_stopMode(void); void rfu_waitREQComplete(void); +u32 rfu_REQBN_softReset_and_checkID(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index 62cff87b9..a395119fa 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -3,8 +3,24 @@ // Exported type declarations +struct UnkRfuStruct_1 { + u8 unk_00; + u8 unk_01; + u8 unk_02; + u8 unk_03; + u8 unk_04; + u8 unk_05; + u8 unk_06; + u8 unk_07; + u8 unk_08; + u8 filler_09[4]; + u8 unk_0d; +}; + // Exported RAM declarations +extern struct UnkRfuStruct_1 gUnknown_03004140; + // Exported ROM declarations u32 sub_800BEC0(void); void sub_800E700(void); diff --git a/src/link.c b/src/link.c index aa9e0a65d..645fcc182 100644 --- a/src/link.c +++ b/src/link.c @@ -143,12 +143,14 @@ static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size); static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2); static void LinkCB_RequestPlayerDataExchange(void); static void Task_PrintTestData(u8 taskId); + static void sub_800AC80(void); static void sub_800ACAC(void); static void sub_800AD5C(void); static void sub_800AD88(void); static void sub_800AE30(void); static void sub_800AE5C(void); + static void CheckErrorStatus(void); static void CB2_PrintErrorMessage(void); static bool8 IsSioMultiMaster(void); @@ -159,6 +161,7 @@ static void CheckMasterOrSlave(void); static void InitTimer(void); static void EnqueueSendCmd(u16 *sendCmd); static void DequeueRecvCmds(u16 (*recvCmds)[CMD_LENGTH]); + static void StartTransfer(void); static bool8 DoHandshake(void); static void DoRecv(void); @@ -166,6 +169,8 @@ static void DoSend(void); static void StopTimer(void); static void SendRecvDone(void); +void sub_800D610(void); + // .rodata ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal"); @@ -2436,3 +2441,29 @@ void ResetRecvBuffer(void) } } } + +// rfu + +u32 sub_800BEC0(void) +{ + u32 r4; + u8 r2; + + r4 = rfu_REQBN_softReset_and_checkID(); + if (r4 == 0x8001) + { + gUnknown_03004140.unk_08 = 1; + } + if (gUnknown_03004140.unk_04 != 0x17 && gUnknown_03004140.unk_04 != 0x01) + { + gUnknown_03004140.unk_05 = 0; + gUnknown_03004140.unk_04 = 0; + } + gUnknown_03004140.unk_07 = 0; + gUnknown_03004140.unk_0d = 0; + gUnknown_03004140.unk_01 = 0; + gUnknown_03004140.unk_00 = 0; + gUnknown_03004140.unk_06 = -1; + sub_800D610(); + return r4; +} diff --git a/src/link_rfu.c b/src/link_rfu.c index 43169a275..f654b9430 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1,9 +1,13 @@ // Includes #include "global.h" +#include "link.h" +#include "link_rfu.h" // Static type declarations +struct UnkRfuStruct_1 gUnknown_03004140; + // Static RAM declarations IWRAM_DATA u8 gUnknown_03000D78[8]; IWRAM_DATA u8 gUnknown_03000D80[16]; From 8377b0066252f5b5c214acd2d6f44b9590f8d3d9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 17 Nov 2017 00:05:28 -0500 Subject: [PATCH 055/123] rfu_REQ_sendData_wrapper --- asm/link.s | 31 ------------------------------- include/librfu.h | 38 ++++++++++++++++++++++++++++++++++++++ include/link_rfu.h | 2 +- src/librfu_rfu.c | 26 +------------------------- src/link.c | 20 +++++++++++++++++++- 5 files changed, 59 insertions(+), 58 deletions(-) diff --git a/asm/link.s b/asm/link.s index 38629bff9..5abaef5b1 100644 --- a/asm/link.s +++ b/asm/link.s @@ -7,37 +7,6 @@ // RFU; bss indicates that no file boundary exists here - thumb_func_start rfu_REQ_sendData_wrapper -rfu_REQ_sendData_wrapper: @ 800BF0C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - bne _0800BF34 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x2] - movs r2, 0 - cmp r0, 0x1 - bne _0800BF3C - movs r2, 0x1 - b _0800BF3C - .pool -_0800BF34: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x3] - movs r1, 0 - strb r1, [r0, 0x3] -_0800BF3C: - adds r0, r2, 0 - bl rfu_REQ_sendData - pop {r0} - bx r0 - .pool - thumb_func_end rfu_REQ_sendData_wrapper - thumb_func_start sub_800BF4C sub_800BF4C: @ 800BF4C push {r4-r6,lr} diff --git a/include/librfu.h b/include/librfu.h index 609fffea2..4e3c82ac3 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -103,9 +103,47 @@ struct RfuIntrStruct u8 block2[0x30]; }; +struct RfuUnk1 +{ + u8 unk_0[0x14]; + u32 unk_14; + u32 unk_18; + struct RfuIntrStruct unk_1c; +}; + +struct RfuUnk2 +{ + u8 unk_0[0x68]; + u32 unk_68; + u32 unk_6c; + u8 unk_70[0x70]; +}; + +struct RfuUnk3 +{ + u32 unk_0; + u32 unk_4; + u8 unk_8[0xD4]; + u32 unk_dc; +}; + +struct RfuUnk5 +{ + u8 unk_00; +}; + extern struct RfuStruct *gRfuState; +extern struct RfuUnk5 *gUnknown_03007890; +extern u32 *gUnknown_03007894; +extern struct RfuUnk3* gUnknown_03007898; +extern struct RfuUnk2* gUnknown_03007880[4]; +extern struct RfuUnk1* gUnknown_03007870[4]; +extern void* sub_82E53F4; +extern void rfu_STC_clearAPIVariables(void); + void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam); void rfu_REQ_stopMode(void); void rfu_waitREQComplete(void); u32 rfu_REQBN_softReset_and_checkID(void); +void rfu_REQ_sendData(u8); diff --git a/include/link_rfu.h b/include/link_rfu.h index a395119fa..8929973d8 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -7,7 +7,7 @@ struct UnkRfuStruct_1 { u8 unk_00; u8 unk_01; u8 unk_02; - u8 unk_03; + vu8 unk_03; u8 unk_04; u8 unk_05; u8 unk_06; diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index cf3fe12ad..2169f4578 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -3,31 +3,7 @@ #include "librfu.h" -struct RfuUnk1 -{ - u8 unk_0[0x14]; - u32 unk_14; - u32 unk_18; - struct RfuIntrStruct unk_1c; -}; - -struct RfuUnk2 -{ - u8 unk_0[0x68]; - u32 unk_68; - u32 unk_6c; - u8 unk_70[0x70]; -}; - -struct RfuUnk3 -{ - u32 unk_0; - u32 unk_4; - u8 unk_8[0xD4]; - u32 unk_dc; -}; - -extern u32 *gUnknown_03007890; +extern struct RfuUnk5 *gUnknown_03007890; extern u32 *gUnknown_03007894; extern struct RfuUnk3* gUnknown_03007898; extern struct RfuUnk2* gUnknown_03007880[4]; diff --git a/src/link.c b/src/link.c index 645fcc182..fc9e14b68 100644 --- a/src/link.c +++ b/src/link.c @@ -2447,7 +2447,6 @@ void ResetRecvBuffer(void) u32 sub_800BEC0(void) { u32 r4; - u8 r2; r4 = rfu_REQBN_softReset_and_checkID(); if (r4 == 0x8001) @@ -2467,3 +2466,22 @@ u32 sub_800BEC0(void) sub_800D610(); return r4; } + +void rfu_REQ_sendData_wrapper(u8 r2) +{ + u8 val; + if (!gUnknown_03007890->unk_00) + { + val = gUnknown_03004140.unk_02; + r2 = 0; + if (val == 1) + { + r2 = 1; + } + } + else + { + gUnknown_03004140.unk_03 = 0; + } + rfu_REQ_sendData(r2); +} From a054b244ab150b3823aa513cc215c81dc426c796 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 17 Nov 2017 08:33:25 -0500 Subject: [PATCH 056/123] sub_800BF4C --- asm/link.s | 36 ------------------------------------ include/librfu.h | 2 ++ include/link_rfu.h | 3 +++ src/link.c | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 36 deletions(-) diff --git a/asm/link.s b/asm/link.s index 5abaef5b1..93005de35 100644 --- a/asm/link.s +++ b/asm/link.s @@ -7,42 +7,6 @@ // RFU; bss indicates that no file boundary exists here - thumb_func_start sub_800BF4C -sub_800BF4C: @ 800BF4C - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - cmp r5, 0 - beq _0800BF94 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldr r2, =0x01000024 - mov r0, sp - adds r1, r4, 0 - bl CpuSet - movs r0, 0xFF - strb r0, [r4, 0x6] - str r5, [r4, 0x40] - str r6, [r4, 0x44] - ldr r0, =sub_800CEB0 - bl rfu_setMSCCallback - ldr r0, =sub_800C7B4 - bl rfu_setREQCallback - movs r0, 0 - b _0800BF96 - .pool -_0800BF94: - movs r0, 0x4 -_0800BF96: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_800BF4C - thumb_func_start sub_800BFA0 sub_800BFA0: @ 800BFA0 push {r4,lr} diff --git a/include/librfu.h b/include/librfu.h index 4e3c82ac3..9b82de0b7 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -147,3 +147,5 @@ void rfu_REQ_stopMode(void); void rfu_waitREQComplete(void); u32 rfu_REQBN_softReset_and_checkID(void); void rfu_REQ_sendData(u8); +void rfu_setMSCCallback(void (*func)(u16)); +void rfu_setREQCallback(void (*func)(u16, u16)); diff --git a/include/link_rfu.h b/include/link_rfu.h index 8929973d8..24bddbe57 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -15,6 +15,9 @@ struct UnkRfuStruct_1 { u8 unk_08; u8 filler_09[4]; u8 unk_0d; + u8 filler_0e[0x32]; + void (*unk_40)(u8); + void (*unk_44)(void); }; // Exported RAM declarations diff --git a/src/link.c b/src/link.c index fc9e14b68..963ef603e 100644 --- a/src/link.c +++ b/src/link.c @@ -170,6 +170,8 @@ static void StopTimer(void); static void SendRecvDone(void); void sub_800D610(void); +void sub_800CEB0(u16 unk0); +void sub_800C7B4(u16 unk0, u16 unk1); // .rodata @@ -2485,3 +2487,18 @@ void rfu_REQ_sendData_wrapper(u8 r2) } rfu_REQ_sendData(r2); } + +int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) +{ + if (func1 == NULL) + { + return 4; + } + CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140)); + gUnknown_03004140.unk_06 = -1; + gUnknown_03004140.unk_40 = func1; + gUnknown_03004140.unk_44 = func2; + rfu_setMSCCallback(sub_800CEB0); + rfu_setREQCallback(sub_800C7B4); + return 0; +} From 06c1908d00b61a87be8ba9505aebb55d48e7dff7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 17 Nov 2017 08:44:54 -0500 Subject: [PATCH 057/123] through sub_800BFCC --- asm/link.s | 49 ---------------------------------------------- include/link_rfu.h | 21 ++++++++++++++++++-- src/link.c | 22 +++++++++++++++++++++ 3 files changed, 41 insertions(+), 51 deletions(-) diff --git a/asm/link.s b/asm/link.s index 93005de35..f0250361f 100644 --- a/asm/link.s +++ b/asm/link.s @@ -7,55 +7,6 @@ // RFU; bss indicates that no file boundary exists here - thumb_func_start sub_800BFA0 -sub_800BFA0: @ 800BFA0 - push {r4,lr} - sub sp, 0x4 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldr r2, =0x01000020 - mov r0, sp - adds r1, r4, 0 - bl CpuSet - movs r0, 0xFF - strb r0, [r4, 0x6] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BFA0 - - thumb_func_start sub_800BFCC -sub_800BFCC: @ 800BFCC - push {r4,lr} - adds r4, r0, 0 - bl sub_800C000 - ldr r1, =gUnknown_03004140 - movs r2, 0x1 - strb r2, [r1, 0x4] - movs r0, 0x2 - strb r0, [r1, 0x5] - str r4, [r1, 0x3C] - ldrb r0, [r4, 0x11] - strb r0, [r1, 0x9] - ldrh r0, [r4, 0x12] - strh r0, [r1, 0x32] - ldrh r0, [r4, 0x14] - strh r0, [r1, 0x18] - ldrb r0, [r4, 0x10] - cmp r0, 0 - beq _0800BFF4 - strb r2, [r1, 0xB] -_0800BFF4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BFCC - thumb_func_start sub_800C000 sub_800C000: @ 800C000 push {r4,r5,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 24bddbe57..88737559f 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -3,6 +3,15 @@ // Exported type declarations +struct UnkLinkRfuStruct_02022B2C +{ + u8 filler_00[16]; + u8 unk_10; + u8 unk_11; + u16 unk_12; + u16 unk_14; +}; + struct UnkRfuStruct_1 { u8 unk_00; u8 unk_01; @@ -13,9 +22,17 @@ struct UnkRfuStruct_1 { u8 unk_06; u8 unk_07; u8 unk_08; - u8 filler_09[4]; + u8 unk_09; + u8 unk_0a; + u8 unk_0b; + u8 unk_0c; u8 unk_0d; - u8 filler_0e[0x32]; + u8 filler_0e[10]; + u16 unk_18; + u8 filler_1a[0x18]; + u16 unk_32; + u8 filler_34[8]; + struct UnkLinkRfuStruct_02022B2C *unk_3c; void (*unk_40)(u8); void (*unk_44)(void); }; diff --git a/src/link.c b/src/link.c index 963ef603e..96234ad04 100644 --- a/src/link.c +++ b/src/link.c @@ -172,6 +172,7 @@ static void SendRecvDone(void); void sub_800D610(void); void sub_800CEB0(u16 unk0); void sub_800C7B4(u16 unk0, u16 unk1); +void sub_800C000(void); // .rodata @@ -2502,3 +2503,24 @@ int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) rfu_setREQCallback(sub_800C7B4); return 0; } + +void sub_800BFA0(void) +{ + CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140) - 2 * sizeof(void *)); + gUnknown_03004140.unk_06 = -1; +} + +void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0) +{ + sub_800C000(); + gUnknown_03004140.unk_04 = 1; + gUnknown_03004140.unk_05 = 2; + gUnknown_03004140.unk_3c = unk0; + gUnknown_03004140.unk_09 = unk0->unk_11; + gUnknown_03004140.unk_32 = unk0->unk_12; + gUnknown_03004140.unk_18 = unk0->unk_14; + if (unk0->unk_10) + { + gUnknown_03004140.unk_0b = 1; + } +} From 648f3245c1843e1128c6832b445ac8ba31433a56 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 18 Nov 2017 15:00:38 -0500 Subject: [PATCH 058/123] through sub_800C054 --- asm/link.s | 165 +-------------------------------------------- include/librfu.h | 1 + include/link_rfu.h | 17 ++++- src/link.c | 85 +++++++++++++++++++++++ sym_common.txt | 6 +- 5 files changed, 105 insertions(+), 169 deletions(-) diff --git a/asm/link.s b/asm/link.s index f0250361f..cff75670e 100644 --- a/asm/link.s +++ b/asm/link.s @@ -7,167 +7,6 @@ // RFU; bss indicates that no file boundary exists here - thumb_func_start sub_800C000 -sub_800C000: @ 800C000 - push {r4,r5,lr} - ldr r2, =gUnknown_03004140 - movs r0, 0 - strb r0, [r2, 0x5] - strb r0, [r2, 0x4] - movs r1, 0xFF - strb r1, [r2, 0x6] - strb r0, [r2, 0x7] - strb r0, [r2, 0x10] - strb r0, [r2, 0xC] - adds r1, r2, 0 - adds r1, 0x24 - strb r0, [r1] - adds r1, 0xC - strb r0, [r1] - movs r3, 0 - adds r5, r2, 0 - adds r5, 0x28 - movs r4, 0 - adds r2, 0x34 -_0800C028: - lsls r1, r3, 1 - adds r0, r1, r5 - strh r4, [r0] - adds r1, r2 - strh r4, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800C028 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C000 - - thumb_func_start sub_800C048 -sub_800C048: @ 800C048 - ldr r1, =gUnknown_03004140 - movs r0, 0x15 - strb r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_800C048 - - thumb_func_start sub_800C054 -sub_800C054: @ 800C054 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r3, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 16 - lsrs r2, 16 - mov r8, r2 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C090 - cmp r0, 0x8 - bne _0800C07A - cmp r5, 0x1 - beq _0800C090 -_0800C07A: - movs r0, 0x1 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x1 - b _0800C122 - .pool -_0800C090: - bl rfu_getMasterSlave - lsls r0, 24 - cmp r0, 0 - bne _0800C0B0 - ldr r1, =gUnknown_03004140 - movs r0, 0x2 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x2 - b _0800C122 - .pool -_0800C0B0: - movs r2, 0 - ldrh r0, [r6] - ldr r4, =0x0000ffff - adds r1, r6, 0x2 - ldr r3, =gUnknown_03004140 - cmp r0, r4 - beq _0800C0D0 -_0800C0BE: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xF - bhi _0800C0D0 - ldrh r0, [r1] - adds r1, 0x2 - cmp r0, r4 - bne _0800C0BE -_0800C0D0: - cmp r2, 0x10 - bne _0800C0EC - movs r0, 0x4 - strh r0, [r3, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x4 - b _0800C122 - .pool -_0800C0EC: - cmp r5, 0x1 - bls _0800C0FA - movs r0, 0x1 - strb r0, [r3, 0x7] - movs r5, 0x1 - movs r7, 0 - b _0800C0FE -_0800C0FA: - movs r0, 0 - strb r0, [r3, 0x7] -_0800C0FE: - cmp r5, 0 - beq _0800C108 - movs r0, 0x5 - strb r0, [r3, 0x4] - b _0800C116 -_0800C108: - movs r0, 0x9 - strb r0, [r3, 0x4] - ldrb r0, [r3, 0xB] - cmp r0, 0 - beq _0800C116 - movs r0, 0x2 - strb r0, [r3, 0xB] -_0800C116: - strb r5, [r3, 0x6] - strh r7, [r3, 0x1A] - mov r0, r8 - strh r0, [r3, 0x26] - str r6, [r3, 0x20] - movs r0, 0 -_0800C122: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800C054 - thumb_func_start sub_800C12C sub_800C12C: @ 800C12C push {r4-r7,lr} @@ -1255,7 +1094,7 @@ _0800CA0C: _0800CA18: cmp r6, 0 bne _0800CA3C - ldr r4, =gUnknown_03004150 + ldr r4, =gUnknown_03004140+0x10 mov r0, sp adds r1, r4, 0 bl rfu_getConnectParentStatus @@ -1293,7 +1132,7 @@ _0800CA60: beq _0800CA66 b _0800CC8A _0800CA66: - ldr r4, =gUnknown_03004150 + ldr r4, =gUnknown_03004140+0x10 mov r0, sp adds r1, r4, 0 bl rfu_getConnectParentStatus diff --git a/include/librfu.h b/include/librfu.h index 9b82de0b7..3d1970437 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -149,3 +149,4 @@ u32 rfu_REQBN_softReset_and_checkID(void); void rfu_REQ_sendData(u8); void rfu_setMSCCallback(void (*func)(u16)); void rfu_setREQCallback(void (*func)(u16, u16)); +bool8 rfu_getMasterSlave(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index 88737559f..29f2a724c 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -27,11 +27,22 @@ struct UnkRfuStruct_1 { u8 unk_0b; u8 unk_0c; u8 unk_0d; - u8 filler_0e[10]; + u8 filler_0e[2]; + u8 unk_10; + u8 filler_11[3]; + u16 unk_14; + u8 filler_16[2]; u16 unk_18; - u8 filler_1a[0x18]; + u16 unk_1a; + u8 filler_1c[4]; + u16 *unk_20; + u8 unk_24; + u16 unk_26; + u16 unk_28[4]; + u8 unk_30; + // aligned u16 unk_32; - u8 filler_34[8]; + u16 unk_34[4]; struct UnkLinkRfuStruct_02022B2C *unk_3c; void (*unk_40)(u8); void (*unk_44)(void); diff --git a/src/link.c b/src/link.c index 96234ad04..9fae98454 100644 --- a/src/link.c +++ b/src/link.c @@ -174,6 +174,8 @@ void sub_800CEB0(u16 unk0); void sub_800C7B4(u16 unk0, u16 unk1); void sub_800C000(void); +void sub_800D30C(u8 a0, u8 a1); + // .rodata ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal"); @@ -2524,3 +2526,86 @@ void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0) gUnknown_03004140.unk_0b = 1; } } + +void sub_800C000(void) +{ + u8 i; + + gUnknown_03004140.unk_05 = 0; + gUnknown_03004140.unk_04 = 0; + gUnknown_03004140.unk_06 = -1; + gUnknown_03004140.unk_07 = 0; + gUnknown_03004140.unk_10 = 0; + gUnknown_03004140.unk_0c = 0; + gUnknown_03004140.unk_24 = 0; + gUnknown_03004140.unk_30 = 0; + for (i = 0; i < 4; i++) + { + gUnknown_03004140.unk_28[i] = 0; + gUnknown_03004140.unk_34[i] = 0; + } +} + +void sub_800C048(void) +{ + gUnknown_03004140.unk_04 = 0x15; +} + +u8 sub_800C054(u8 r5, u16 r7, u16 r8, u16 *r6) +{ + u8 i; + u16 *buffer; + + if (gUnknown_03004140.unk_04 != 0 && (gUnknown_03004140.unk_04 != 0x08 || r5 != 1)) + { + gUnknown_03004140.unk_14 = 1; + sub_800D30C(0xf3, 0x01); + return 1; + } + if (!rfu_getMasterSlave()) + { + gUnknown_03004140.unk_14 = 2; + sub_800D30C(0xf3, 0x01); + return 2; + } + for (i = 0, buffer = r6; i < 16; i++) + { + if (*buffer++ == 0xFFFF) + { + break; + } + } + if (i == 16) + { + gUnknown_03004140.unk_14 = 4; + sub_800D30C(0xf3, 0x01); + return 4; + } + if (r5 > 1) + { + gUnknown_03004140.unk_07 = 1; + r5 = 1; + r7 = 0; + } + else + { + gUnknown_03004140.unk_07 = 0; + } + if (r5 != 0) + { + gUnknown_03004140.unk_04 = 5; + } + else + { + gUnknown_03004140.unk_04 = 9; + if (gUnknown_03004140.unk_0b) + { + gUnknown_03004140.unk_0b = 2; + } + } + gUnknown_03004140.unk_06 = r5; + gUnknown_03004140.unk_1a = r7; + gUnknown_03004140.unk_26 = r8; + gUnknown_03004140.unk_20 = r6; + return 0; +} diff --git a/sym_common.txt b/sym_common.txt index 298c4470e..488ccd9a7 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -14,10 +14,10 @@ gUnknown_03002F70: @ 3002F70 .include "link.o" gUnknown_03004140: @ 3004140 - .space 0x10 + .space 0x48 -gUnknown_03004150: @ 3004150 - .space 0x40 +gUnknown_03004188: @ 3004150 + .space 0x8 gUnknown_03004190: @ 3004190 .space 0xE70 From f25cdb483795454d0d89d59fd614697e6c4b8cc4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 18 Nov 2017 15:15:54 -0500 Subject: [PATCH 059/123] resolve questionable file boundary decision --- asm/link.s | 2 - ld_script.txt | 1 + src/link.c | 169 ------------------------------------------------ src/link_rfu.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 171 insertions(+), 172 deletions(-) diff --git a/asm/link.s b/asm/link.s index cff75670e..dba40d2a9 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,8 +5,6 @@ .text -// RFU; bss indicates that no file boundary exists here - thumb_func_start sub_800C12C sub_800C12C: @ 800C12C push {r4-r7,lr} diff --git a/ld_script.txt b/ld_script.txt index 17a6fd8e4..a4ce5e236 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -52,6 +52,7 @@ SECTIONS { src/sprite.o(.text); src/string_util.o(.text); src/link.o(.text); + src/link_rfu.o(.text); asm/link.o(.text); asm/link_rfu.o(.text); asm/rom_8011DC0.o(.text); diff --git a/src/link.c b/src/link.c index 9fae98454..8c6dda32a 100644 --- a/src/link.c +++ b/src/link.c @@ -66,7 +66,6 @@ IWRAM_DATA u16 sSendNonzeroCheck; IWRAM_DATA u16 sRecvNonzeroCheck; IWRAM_DATA u8 sChecksumAvailable; IWRAM_DATA u8 sHandshakePlayerCount; -IWRAM_DATA u8 gUnknown_03000D74; u16 gLinkPartnersHeldKeys[6]; u32 gLinkDebugSeed; @@ -169,13 +168,6 @@ static void DoSend(void); static void StopTimer(void); static void SendRecvDone(void); -void sub_800D610(void); -void sub_800CEB0(u16 unk0); -void sub_800C7B4(u16 unk0, u16 unk1); -void sub_800C000(void); - -void sub_800D30C(u8 a0, u8 a1); - // .rodata ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal"); @@ -2448,164 +2440,3 @@ void ResetRecvBuffer(void) } // rfu - -u32 sub_800BEC0(void) -{ - u32 r4; - - r4 = rfu_REQBN_softReset_and_checkID(); - if (r4 == 0x8001) - { - gUnknown_03004140.unk_08 = 1; - } - if (gUnknown_03004140.unk_04 != 0x17 && gUnknown_03004140.unk_04 != 0x01) - { - gUnknown_03004140.unk_05 = 0; - gUnknown_03004140.unk_04 = 0; - } - gUnknown_03004140.unk_07 = 0; - gUnknown_03004140.unk_0d = 0; - gUnknown_03004140.unk_01 = 0; - gUnknown_03004140.unk_00 = 0; - gUnknown_03004140.unk_06 = -1; - sub_800D610(); - return r4; -} - -void rfu_REQ_sendData_wrapper(u8 r2) -{ - u8 val; - if (!gUnknown_03007890->unk_00) - { - val = gUnknown_03004140.unk_02; - r2 = 0; - if (val == 1) - { - r2 = 1; - } - } - else - { - gUnknown_03004140.unk_03 = 0; - } - rfu_REQ_sendData(r2); -} - -int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) -{ - if (func1 == NULL) - { - return 4; - } - CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140)); - gUnknown_03004140.unk_06 = -1; - gUnknown_03004140.unk_40 = func1; - gUnknown_03004140.unk_44 = func2; - rfu_setMSCCallback(sub_800CEB0); - rfu_setREQCallback(sub_800C7B4); - return 0; -} - -void sub_800BFA0(void) -{ - CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140) - 2 * sizeof(void *)); - gUnknown_03004140.unk_06 = -1; -} - -void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0) -{ - sub_800C000(); - gUnknown_03004140.unk_04 = 1; - gUnknown_03004140.unk_05 = 2; - gUnknown_03004140.unk_3c = unk0; - gUnknown_03004140.unk_09 = unk0->unk_11; - gUnknown_03004140.unk_32 = unk0->unk_12; - gUnknown_03004140.unk_18 = unk0->unk_14; - if (unk0->unk_10) - { - gUnknown_03004140.unk_0b = 1; - } -} - -void sub_800C000(void) -{ - u8 i; - - gUnknown_03004140.unk_05 = 0; - gUnknown_03004140.unk_04 = 0; - gUnknown_03004140.unk_06 = -1; - gUnknown_03004140.unk_07 = 0; - gUnknown_03004140.unk_10 = 0; - gUnknown_03004140.unk_0c = 0; - gUnknown_03004140.unk_24 = 0; - gUnknown_03004140.unk_30 = 0; - for (i = 0; i < 4; i++) - { - gUnknown_03004140.unk_28[i] = 0; - gUnknown_03004140.unk_34[i] = 0; - } -} - -void sub_800C048(void) -{ - gUnknown_03004140.unk_04 = 0x15; -} - -u8 sub_800C054(u8 r5, u16 r7, u16 r8, u16 *r6) -{ - u8 i; - u16 *buffer; - - if (gUnknown_03004140.unk_04 != 0 && (gUnknown_03004140.unk_04 != 0x08 || r5 != 1)) - { - gUnknown_03004140.unk_14 = 1; - sub_800D30C(0xf3, 0x01); - return 1; - } - if (!rfu_getMasterSlave()) - { - gUnknown_03004140.unk_14 = 2; - sub_800D30C(0xf3, 0x01); - return 2; - } - for (i = 0, buffer = r6; i < 16; i++) - { - if (*buffer++ == 0xFFFF) - { - break; - } - } - if (i == 16) - { - gUnknown_03004140.unk_14 = 4; - sub_800D30C(0xf3, 0x01); - return 4; - } - if (r5 > 1) - { - gUnknown_03004140.unk_07 = 1; - r5 = 1; - r7 = 0; - } - else - { - gUnknown_03004140.unk_07 = 0; - } - if (r5 != 0) - { - gUnknown_03004140.unk_04 = 5; - } - else - { - gUnknown_03004140.unk_04 = 9; - if (gUnknown_03004140.unk_0b) - { - gUnknown_03004140.unk_0b = 2; - } - } - gUnknown_03004140.unk_06 = r5; - gUnknown_03004140.unk_1a = r7; - gUnknown_03004140.unk_26 = r8; - gUnknown_03004140.unk_20 = r6; - return 0; -} diff --git a/src/link_rfu.c b/src/link_rfu.c index f654b9430..7f4a3695b 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2,6 +2,7 @@ // Includes #include "global.h" #include "link.h" +#include "librfu.h" #include "link_rfu.h" // Static type declarations @@ -9,12 +10,180 @@ struct UnkRfuStruct_1 gUnknown_03004140; // Static RAM declarations -IWRAM_DATA u8 gUnknown_03000D78[8]; +IWRAM_DATA u8 gUnknown_03000D74; +ALIGNED(4) IWRAM_DATA u8 gUnknown_03000D78[8]; IWRAM_DATA u8 gUnknown_03000D80[16]; IWRAM_DATA u16 gUnknown_03000D90[8]; // Static ROM declarations +void sub_800C000(void); +void sub_800CEB0(u16 unk0); +void sub_800C7B4(u16 unk0, u16 unk1); +void sub_800D30C(u8 a0, u8 a1); +void sub_800D610(void); + // .rodata // .text + +u32 sub_800BEC0(void) +{ + u32 r4; + + r4 = rfu_REQBN_softReset_and_checkID(); + if (r4 == 0x8001) + { + gUnknown_03004140.unk_08 = 1; + } + if (gUnknown_03004140.unk_04 != 0x17 && gUnknown_03004140.unk_04 != 0x01) + { + gUnknown_03004140.unk_05 = 0; + gUnknown_03004140.unk_04 = 0; + } + gUnknown_03004140.unk_07 = 0; + gUnknown_03004140.unk_0d = 0; + gUnknown_03004140.unk_01 = 0; + gUnknown_03004140.unk_00 = 0; + gUnknown_03004140.unk_06 = -1; + sub_800D610(); + return r4; +} + +void rfu_REQ_sendData_wrapper(u8 r2) +{ + u8 val; + if (!gUnknown_03007890->unk_00) + { + val = gUnknown_03004140.unk_02; + r2 = 0; + if (val == 1) + { + r2 = 1; + } + } + else + { + gUnknown_03004140.unk_03 = 0; + } + rfu_REQ_sendData(r2); +} + +int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) +{ + if (func1 == NULL) + { + return 4; + } + CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140)); + gUnknown_03004140.unk_06 = -1; + gUnknown_03004140.unk_40 = func1; + gUnknown_03004140.unk_44 = func2; + rfu_setMSCCallback(sub_800CEB0); + rfu_setREQCallback(sub_800C7B4); + return 0; +} + +void sub_800BFA0(void) +{ + CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140) - 2 * sizeof(void *)); + gUnknown_03004140.unk_06 = -1; +} + +void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0) +{ + sub_800C000(); + gUnknown_03004140.unk_04 = 1; + gUnknown_03004140.unk_05 = 2; + gUnknown_03004140.unk_3c = unk0; + gUnknown_03004140.unk_09 = unk0->unk_11; + gUnknown_03004140.unk_32 = unk0->unk_12; + gUnknown_03004140.unk_18 = unk0->unk_14; + if (unk0->unk_10) + { + gUnknown_03004140.unk_0b = 1; + } +} + +void sub_800C000(void) +{ + u8 i; + + gUnknown_03004140.unk_05 = 0; + gUnknown_03004140.unk_04 = 0; + gUnknown_03004140.unk_06 = -1; + gUnknown_03004140.unk_07 = 0; + gUnknown_03004140.unk_10 = 0; + gUnknown_03004140.unk_0c = 0; + gUnknown_03004140.unk_24 = 0; + gUnknown_03004140.unk_30 = 0; + for (i = 0; i < 4; i++) + { + gUnknown_03004140.unk_28[i] = 0; + gUnknown_03004140.unk_34[i] = 0; + } +} + +void sub_800C048(void) +{ + gUnknown_03004140.unk_04 = 0x15; +} + +u8 sub_800C054(u8 r5, u16 r7, u16 r8, u16 *r6) +{ + u8 i; + u16 *buffer; + + if (gUnknown_03004140.unk_04 != 0 && (gUnknown_03004140.unk_04 != 0x08 || r5 != 1)) + { + gUnknown_03004140.unk_14 = 1; + sub_800D30C(0xf3, 0x01); + return 1; + } + if (!rfu_getMasterSlave()) + { + gUnknown_03004140.unk_14 = 2; + sub_800D30C(0xf3, 0x01); + return 2; + } + for (i = 0, buffer = r6; i < 16; i++) + { + if (*buffer++ == 0xFFFF) + { + break; + } + } + if (i == 16) + { + gUnknown_03004140.unk_14 = 4; + sub_800D30C(0xf3, 0x01); + return 4; + } + if (r5 > 1) + { + gUnknown_03004140.unk_07 = 1; + r5 = 1; + r7 = 0; + } + else + { + gUnknown_03004140.unk_07 = 0; + } + if (r5 != 0) + { + gUnknown_03004140.unk_04 = 5; + } + else + { + gUnknown_03004140.unk_04 = 9; + if (gUnknown_03004140.unk_0b) + { + gUnknown_03004140.unk_0b = 2; + } + } + gUnknown_03004140.unk_06 = r5; + gUnknown_03004140.unk_1a = r7; + gUnknown_03004140.unk_26 = r8; + gUnknown_03004140.unk_20 = r6; + return 0; +} From 728532be77667a16ae0ace16f06e9cd76a591606 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 18 Nov 2017 20:33:53 -0500 Subject: [PATCH 060/123] Return stuff to its rightful place, and set up struct definitions for later --- asm/link.s | 3546 -------------------------------------------- asm/link_rfu.s | 3546 +++++++++++++++++++++++++++++++++++++++++++- include/link_rfu.h | 19 + ld_script.txt | 1 - src/link_rfu.c | 4 + sym_ewram.txt | 13 +- 6 files changed, 3566 insertions(+), 3563 deletions(-) delete mode 100644 asm/link.s diff --git a/asm/link.s b/asm/link.s deleted file mode 100644 index dba40d2a9..000000000 --- a/asm/link.s +++ /dev/null @@ -1,3546 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_800C12C -sub_800C12C: @ 800C12C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C164 - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _0800C164 - movs r0, 0x1 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x1 - b _0800C204 - .pool -_0800C164: - bl rfu_getMasterSlave - lsls r0, 24 - cmp r0, 0 - bne _0800C184 - ldr r1, =gUnknown_03004140 - movs r0, 0x2 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x2 - b _0800C204 - .pool -_0800C184: - movs r2, 0 - ldr r0, =gUnknown_03007890 - ldr r1, [r0] - ldrb r3, [r1, 0x8] - ldr r5, =gUnknown_03004140 - adds r7, r0, 0 - cmp r2, r3 - bcs _0800C1B2 - ldrh r0, [r1, 0x14] - cmp r0, r6 - beq _0800C1B2 - adds r4, r1, 0 - adds r1, r3, 0 -_0800C19E: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r1 - bcs _0800C1B2 - lsls r0, r2, 5 - adds r0, r4, r0 - ldrh r0, [r0, 0x14] - cmp r0, r6 - bne _0800C19E -_0800C1B2: - ldr r0, [r7] - ldrb r0, [r0, 0x8] - cmp r0, 0 - beq _0800C1BE - cmp r2, r0 - bne _0800C1D8 -_0800C1BE: - movs r0, 0x3 - strh r0, [r5, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x3 - b _0800C204 - .pool -_0800C1D8: - ldrb r0, [r5, 0x4] - cmp r0, 0 - beq _0800C1E2 - cmp r0, 0x9 - bne _0800C1EA -_0800C1E2: - movs r0, 0xC - strb r0, [r5, 0x4] - movs r0, 0xD - b _0800C1F0 -_0800C1EA: - movs r0, 0xB - strb r0, [r5, 0x4] - movs r0, 0xC -_0800C1F0: - strb r0, [r5, 0x5] - strh r6, [r5, 0x1E] - mov r0, r8 - strh r0, [r5, 0x1A] - ldrb r0, [r5, 0x7] - cmp r0, 0 - beq _0800C202 - movs r0, 0x7 - strb r0, [r5, 0x7] -_0800C202: - movs r0, 0 -_0800C204: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800C12C - - thumb_func_start sub_800C210 -sub_800C210: @ 800C210 - push {r4-r7,lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r6, =gUnknown_03004140 - adds r3, r6, 0 - adds r3, 0x30 - ldrb r2, [r3] - adds r0, r1, 0 - ands r0, r2 - cmp r0, 0 - beq _0800C26C - adds r0, r2, 0 - bics r0, r1 - strb r0, [r3] - movs r4, 0 - ldr r7, =gUnknown_03007890 - movs r5, 0x1 - adds r3, 0x4 - movs r2, 0 -_0800C236: - adds r0, r1, 0 - asrs r0, r4 - ands r0, r5 - cmp r0, 0 - beq _0800C246 - lsls r0, r4, 1 - adds r0, r3 - strh r2, [r0] -_0800C246: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800C236 - ldr r0, [r7] - ldrb r4, [r0, 0x3] - ands r4, r1 - cmp r4, 0 - beq _0800C260 - adds r0, r4, 0 - bl sub_800D334 -_0800C260: - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - adds r1, r4, 0 - bl sub_800D30C -_0800C26C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C210 - - thumb_func_start sub_800C27C -sub_800C27C: @ 800C27C - push {r4,r5,lr} - lsls r0, 24 - movs r2, 0 - ldr r1, =gUnknown_03004140 - strb r2, [r1, 0x7] - adds r5, r1, 0 - cmp r0, 0 - beq _0800C29C - bl sub_800C000 - movs r0, 0x17 - strb r0, [r5, 0x4] - b _0800C366 - .pool -_0800C29C: - ldrb r0, [r5, 0x4] - subs r0, 0x5 - cmp r0, 0xD - bhi _0800C352 - lsls r0, 2 - ldr r1, =_0800C2B4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C2B4: - .4byte _0800C2EC - .4byte _0800C2F8 - .4byte _0800C2F8 - .4byte _0800C358 - .4byte _0800C302 - .4byte _0800C30C - .4byte _0800C30C - .4byte _0800C316 - .4byte _0800C320 - .4byte _0800C320 - .4byte _0800C358 - .4byte _0800C326 - .4byte _0800C34C - .4byte _0800C34C -_0800C2EC: - movs r1, 0 - movs r0, 0x8 - strb r0, [r5, 0x4] - strb r1, [r5, 0x5] - movs r2, 0x13 - b _0800C358 -_0800C2F8: - movs r0, 0x7 - strb r0, [r5, 0x4] - movs r0, 0x8 - strb r0, [r5, 0x5] - b _0800C358 -_0800C302: - movs r0, 0 - strb r0, [r5, 0x5] - strb r0, [r5, 0x4] - movs r2, 0x21 - b _0800C358 -_0800C30C: - movs r1, 0 - movs r0, 0xB - strb r0, [r5, 0x4] - strb r1, [r5, 0x5] - b _0800C358 -_0800C316: - movs r0, 0 - strb r0, [r5, 0x5] - strb r0, [r5, 0x4] - movs r2, 0x23 - b _0800C358 -_0800C320: - movs r0, 0xE - strb r0, [r5, 0x4] - b _0800C358 -_0800C326: - ldrb r0, [r5, 0x11] - strb r0, [r5, 0x4] - ldrb r0, [r5, 0x12] - strb r0, [r5, 0x5] - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - bl sub_800D334 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - strh r0, [r5, 0x14] - movs r0, 0x33 - movs r1, 0x1 - bl sub_800D30C - b _0800C366 - .pool -_0800C34C: - movs r0, 0x12 - strb r0, [r5, 0x4] - b _0800C358 -_0800C352: - strb r2, [r5, 0x5] - strb r2, [r5, 0x4] - movs r2, 0x43 -_0800C358: - ldrb r0, [r5, 0x4] - cmp r0, 0 - bne _0800C366 - adds r0, r2, 0 - movs r1, 0 - bl sub_800D30C -_0800C366: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_800C27C - - thumb_func_start sub_800C36C -sub_800C36C: @ 800C36C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0 - mov r8, r1 - mov r5, sp - adds r5, 0x1 - mov r4, sp - adds r4, 0x2 - mov r1, sp - adds r2, r5, 0 - adds r3, r4, 0 - bl rfu_REQBN_watchLink - mov r0, sp - ldrb r0, [r0] - adds r7, r4, 0 - cmp r0, 0 - beq _0800C43E - ldr r1, =gUnknown_03004140 - mov r0, sp - ldrb r0, [r0] - strh r0, [r1, 0x14] - ldrb r0, [r5] - strh r0, [r1, 0x16] - ldrb r0, [r1, 0x9] - adds r6, r1, 0 - cmp r0, 0 - beq _0800C426 - movs r0, 0x1 - strb r0, [r6, 0xA] - ldrb r0, [r6, 0x6] - cmp r0, 0 - bne _0800C3C2 - ldrb r0, [r5] - cmp r0, 0 - bne _0800C3C2 - movs r0, 0x4 - strb r0, [r6, 0xA] -_0800C3C2: - ldrb r0, [r6, 0xA] - cmp r0, 0x1 - bne _0800C40C - movs r2, 0 - mov r4, sp - movs r5, 0x1 - mov r12, r6 - mov r3, r12 - adds r3, 0x30 - movs r6, 0x34 - add r6, r12 - mov r9, r6 -_0800C3DA: - ldrb r0, [r4] - asrs r0, r2 - ands r0, r5 - cmp r0, 0 - beq _0800C3F8 - adds r0, r5, 0 - lsls r0, r2 - ldrb r1, [r3] - orrs r0, r1 - strb r0, [r3] - lsls r0, r2, 1 - add r0, r9 - mov r6, r12 - ldrh r1, [r6, 0x32] - strh r1, [r0] -_0800C3F8: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C3DA - movs r0, 0x31 - b _0800C41E - .pool -_0800C40C: - movs r0, 0 - strb r0, [r6, 0xA] - mov r0, sp - ldrb r0, [r0] - bl sub_800D334 - movs r0, 0x1 - mov r8, r0 - movs r0, 0x33 -_0800C41E: - movs r1, 0x1 - bl sub_800D30C - b _0800C43A -_0800C426: - mov r0, sp - ldrb r0, [r0] - bl sub_800D334 - movs r1, 0x1 - mov r8, r1 - movs r0, 0x30 - movs r1, 0x2 - bl sub_800D30C -_0800C43A: - bl sub_800D610 -_0800C43E: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800C518 - ldrb r0, [r7] - cmp r0, 0 - beq _0800C49C - movs r2, 0 - ldr r6, =gUnknown_03004140 - movs r3, 0x1 - adds r4, r6, 0 - adds r4, 0x34 - adds r6, 0x30 - adds r5, r7, 0 -_0800C45C: - ldrb r0, [r6] - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - beq _0800C478 - ldrb r0, [r5] - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - beq _0800C478 - lsls r0, r2, 1 - adds r0, r4 - movs r1, 0 - strh r1, [r0] -_0800C478: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C45C - ldr r3, =gUnknown_03004140 - adds r2, r3, 0 - adds r2, 0x30 - ldrb r1, [r7] - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r7] - strh r0, [r3, 0x14] - movs r0, 0x32 - movs r1, 0x1 - bl sub_800D30C -_0800C49C: - ldr r0, =gUnknown_03004140 - adds r3, r0, 0 - adds r3, 0x30 - ldrb r1, [r3] - adds r6, r0, 0 - cmp r1, 0 - beq _0800C514 - movs r4, 0 - movs r2, 0 - movs r5, 0x1 -_0800C4B0: - ldrb r0, [r3] - asrs r0, r2 - ands r0, r5 - cmp r0, 0 - beq _0800C4E2 - lsls r1, r2, 1 - adds r0, r6, 0 - adds r0, 0x34 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _0800C4E2 - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _0800C4E2 - adds r0, r5, 0 - lsls r0, r2 - ldrb r1, [r3] - bics r1, r0 - strb r1, [r3] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0800C4E2: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C4B0 - cmp r4, 0 - beq _0800C506 - adds r0, r4, 0 - bl sub_800D334 - movs r6, 0x1 - mov r8, r6 - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - movs r1, 0x1 - bl sub_800D30C -_0800C506: - ldr r0, =gUnknown_03004140 - adds r1, r0, 0 - adds r1, 0x30 - ldrb r1, [r1] - adds r6, r0, 0 - cmp r1, 0 - bne _0800C518 -_0800C514: - movs r0, 0 - strb r0, [r6, 0xA] -_0800C518: - mov r0, r8 - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800C36C - - thumb_func_start rfu_syncVBlank_ -rfu_syncVBlank_: @ 800C530 - push {lr} - bl rfu_syncVBlank - lsls r0, 16 - cmp r0, 0 - beq _0800C548 - movs r0, 0xF1 - movs r1, 0 - bl sub_800D30C - bl sub_800D610 -_0800C548: - pop {r0} - bx r0 - thumb_func_end rfu_syncVBlank_ - - thumb_func_start sub_800C54C -sub_800C54C: @ 800C54C - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gUnknown_03004140 - ldr r2, [r1, 0x40] - cmp r2, 0 - bne _0800C568 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C568 - strb r2, [r1, 0x4] - b _0800C736 - .pool -_0800C568: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x7] - cmp r0, 0 - beq _0800C576 - adds r0, r3, 0 - bl sub_800C744 -_0800C576: - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x4] - cmp r0, 0 - bne _0800C580 - b _0800C700 -_0800C580: - bl rfu_waitREQComplete - movs r0, 0x1 - strb r0, [r4, 0xE] - ldrb r0, [r4, 0x4] - subs r0, 0x1 - cmp r0, 0x16 - bls _0800C592 - b _0800C6F6 -_0800C592: - lsls r0, 2 - ldr r1, =_0800C5A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C5A4: - .4byte _0800C624 - .4byte _0800C65C - .4byte _0800C662 - .4byte _0800C678 - .4byte _0800C690 - .4byte _0800C696 - .4byte _0800C69C - .4byte _0800C6F6 - .4byte _0800C6A2 - .4byte _0800C6A8 - .4byte _0800C6AE - .4byte _0800C6B4 - .4byte _0800C6C4 - .4byte _0800C6CA - .4byte _0800C6F6 - .4byte _0800C6D0 - .4byte _0800C6E0 - .4byte _0800C6E6 - .4byte _0800C6EC - .4byte _0800C6F6 - .4byte _0800C6F2 - .4byte _0800C6F6 - .4byte _0800C600 -_0800C600: - bl sub_800BEC0 - ldr r1, =0x00008001 - movs r2, 0xFF - cmp r0, r1 - bne _0800C60E - movs r2, 0x44 -_0800C60E: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - adds r0, r2, 0 - b _0800C64E - .pool -_0800C624: - bl sub_800BEC0 - ldr r1, =0x00008001 - cmp r0, r1 - bne _0800C644 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - movs r1, 0x3 - strb r1, [r0, 0x5] - b _0800C6F6 - .pool -_0800C644: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - movs r0, 0xFF -_0800C64E: - movs r1, 0 - bl sub_800D30C - b _0800C6F6 - .pool -_0800C65C: - bl rfu_REQ_reset - b _0800C6F6 -_0800C662: - ldr r0, =gUnknown_03004140 - ldr r2, [r0, 0x3C] - ldrh r0, [r2, 0x2] - ldrb r1, [r2] - ldrb r2, [r2, 0x1] - bl rfu_REQ_configSystem - b _0800C6F6 - .pool -_0800C678: - ldr r0, =gUnknown_03004140 - ldr r3, [r0, 0x3C] - ldrb r0, [r3, 0x4] - ldrh r1, [r3, 0x6] - ldr r2, [r3, 0x8] - ldr r3, [r3, 0xC] - bl rfu_REQ_configGameData - b _0800C6F6 - .pool -_0800C690: - bl rfu_REQ_startSearchChild - b _0800C6F6 -_0800C696: - bl rfu_REQ_pollSearchChild - b _0800C6F6 -_0800C69C: - bl rfu_REQ_endSearchChild - b _0800C6F6 -_0800C6A2: - bl rfu_REQ_startSearchParent - b _0800C6F6 -_0800C6A8: - bl rfu_REQ_pollSearchParent - b _0800C6F6 -_0800C6AE: - bl rfu_REQ_endSearchParent - b _0800C6F6 -_0800C6B4: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x1E] - bl rfu_REQ_startConnectParent - b _0800C6F6 - .pool -_0800C6C4: - bl rfu_REQ_pollConnectParent - b _0800C6F6 -_0800C6CA: - bl rfu_REQ_endConnectParent - b _0800C6F6 -_0800C6D0: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bl rfu_REQ_CHILD_startConnectRecovery - b _0800C6F6 - .pool -_0800C6E0: - bl rfu_REQ_CHILD_pollConnectRecovery - b _0800C6F6 -_0800C6E6: - bl rfu_REQ_CHILD_endConnectRecovery - b _0800C6F6 -_0800C6EC: - bl rfu_REQ_changeMasterSlave - b _0800C6F6 -_0800C6F2: - bl rfu_REQ_stopMode -_0800C6F6: - bl rfu_waitREQComplete - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0xE] -_0800C700: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x4] - subs r0, 0x12 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0800C710 - b _0800C576 -_0800C710: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800C726 - movs r0, 0 - bl sub_800C36C - lsls r0, 24 - cmp r0, 0 - bne _0800C736 -_0800C726: - bl sub_800CF34 - bl sub_800D158 - bl sub_800D268 - bl sub_800D434 -_0800C736: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C54C - - thumb_func_start sub_800C744 -sub_800C744: @ 800C744 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x7] - adds r4, r0, 0 - cmp r1, 0x5 - bne _0800C76E - movs r2, 0x1 - strb r2, [r4, 0x6] - strb r1, [r4, 0x4] - ldrh r0, [r4, 0x1C] - strh r0, [r4, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C76C - movs r0, 0x6 - strb r0, [r4, 0x7] - b _0800C76E - .pool -_0800C76C: - strb r2, [r4, 0x7] -_0800C76E: - ldrb r0, [r4, 0x7] - cmp r0, 0x1 - bne _0800C798 - strb r0, [r4, 0x6] - movs r0, 0x5 - strb r0, [r4, 0x4] - adds r0, r3, 0 - movs r1, 0x8C - bl __umodsi3 - strh r0, [r4, 0x1A] - movs r1, 0x8C - subs r1, r0 - strh r1, [r4, 0x1C] - lsls r0, 16 - cmp r0, 0 - beq _0800C794 - movs r0, 0x2 - b _0800C796 -_0800C794: - movs r0, 0x3 -_0800C796: - strb r0, [r4, 0x7] -_0800C798: - ldrb r0, [r4, 0x7] - cmp r0, 0x3 - bne _0800C7AE - movs r0, 0 - strb r0, [r4, 0x6] - movs r0, 0x28 - strh r0, [r4, 0x1A] - movs r0, 0x4 - strb r0, [r4, 0x7] - movs r0, 0x9 - strb r0, [r4, 0x4] -_0800C7AE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800C744 - - thumb_func_start sub_800C7B4 -sub_800C7B4: @ 800C7B4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r6, r1, 16 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0xE] - adds r7, r0, 0 - cmp r1, 0 - bne _0800C7D2 - b _0800CC98 -_0800C7D2: - movs r0, 0 - strb r0, [r7, 0xE] - mov r0, r8 - subs r0, 0x10 - cmp r0, 0x2D - bls _0800C7E0 - b _0800CC8A -_0800C7E0: - lsls r0, 2 - ldr r1, =_0800C7F4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C7F4: - .4byte _0800C8AC - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800C8D8 - .4byte _0800C8C4 - .4byte _0800CC8A - .4byte _0800C8EC - .4byte _0800C8FC - .4byte _0800C920 - .4byte _0800C940 - .4byte _0800C960 - .4byte _0800C9D0 - .4byte _0800CA02 - .4byte _0800CA18 - .4byte _0800CA60 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CBD8 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CAD0 - .4byte _0800CB1C - .4byte _0800CB64 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC78 -_0800C8AC: - cmp r6, 0 - beq _0800C8B2 - b _0800CC8A -_0800C8B2: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - movs r1, 0x4 - strb r1, [r0, 0x5] - b _0800CC8A - .pool -_0800C8C4: - cmp r6, 0 - beq _0800C8CA - b _0800CC8A -_0800C8CA: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - b _0800CC8A - .pool -_0800C8D8: - cmp r6, 0 - beq _0800C8DE - b _0800CC8A -_0800C8DE: - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0x5] - strb r6, [r0, 0x4] - movs r0, 0 - b _0800CBF6 - .pool -_0800C8EC: - cmp r6, 0 - beq _0800C8F2 - b _0800CC8A -_0800C8F2: - ldr r1, =gUnknown_03004140 - movs r0, 0x6 - b _0800CA0C - .pool -_0800C8FC: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800C906 - b _0800CC8A -_0800C906: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C912 - b _0800CC8A -_0800C912: - movs r0, 0x7 - strb r0, [r1, 0x4] - movs r0, 0x8 - strb r0, [r1, 0x5] - b _0800CC8A - .pool -_0800C920: - cmp r6, 0 - beq _0800C926 - b _0800CC8A -_0800C926: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - ldrb r0, [r0, 0x7] - cmp r0, 0 - beq _0800C936 - b _0800CC8A -_0800C936: - movs r0, 0x13 - b _0800CBF6 - .pool -_0800C940: - cmp r6, 0 - beq _0800C946 - b _0800CC8A -_0800C946: - ldrb r0, [r7, 0xB] - cmp r0, 0x1 - bne _0800C956 - ldrh r0, [r7, 0x1A] - cmp r0, 0x1 - bls _0800C956 - subs r0, 0x1 - strh r0, [r7, 0x1A] -_0800C956: - ldr r1, =gUnknown_03004140 - movs r0, 0xA - b _0800CA0C - .pool -_0800C960: - cmp r6, 0 - bne _0800C9A6 - bl sub_800D294 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - ldr r4, =gUnknown_03004140 - strh r0, [r4, 0x14] - cmp r0, 0 - beq _0800C980 - movs r0, 0x20 - movs r1, 0x1 - bl sub_800D30C -_0800C980: - ldrb r0, [r4, 0xB] - cmp r0, 0 - beq _0800C9A6 - ldrh r0, [r4, 0x1A] - cmp r0, 0x1 - beq _0800C9A6 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0x4 - bne _0800C9A6 - bl rfu_REQ_endSearchParent - bl rfu_waitREQComplete - movs r0, 0x9 - strb r0, [r4, 0x4] - movs r0, 0x1 - strb r0, [r4, 0xB] -_0800C9A6: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800C9B0 - b _0800CC8A -_0800C9B0: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C9BC - b _0800CC8A -_0800C9BC: - movs r0, 0xB - strb r0, [r1, 0x4] - movs r0, 0 - strb r0, [r1, 0x5] - b _0800CC8A - .pool -_0800C9D0: - cmp r6, 0 - beq _0800C9D6 - b _0800CC8A -_0800C9D6: - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x5] - strb r0, [r2, 0x4] - ldrb r1, [r2, 0x7] - cmp r1, 0 - bne _0800C9F4 - lsls r0, 24 - cmp r0, 0 - beq _0800C9EA - b _0800CC8A -_0800C9EA: - movs r0, 0x21 - b _0800CBF6 - .pool -_0800C9F4: - cmp r1, 0x7 - bne _0800C9FA - b _0800CC8A -_0800C9FA: - movs r0, 0x5 - strb r0, [r2, 0x4] - strb r0, [r2, 0x7] - b _0800CC8A -_0800CA02: - cmp r6, 0 - beq _0800CA08 - b _0800CC8A -_0800CA08: - ldr r1, =gUnknown_03004140 - movs r0, 0xD -_0800CA0C: - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - b _0800CC8A - .pool -_0800CA18: - cmp r6, 0 - bne _0800CA3C - ldr r4, =gUnknown_03004140+0x10 - mov r0, sp - adds r1, r4, 0 - bl rfu_getConnectParentStatus - lsls r0, 16 - cmp r0, 0 - bne _0800CA3C - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CA3C - adds r1, r4, 0 - subs r1, 0x10 - movs r0, 0xE - strb r0, [r1, 0x4] -_0800CA3C: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800CA46 - b _0800CC8A -_0800CA46: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800CA52 - b _0800CC8A -_0800CA52: - movs r0, 0xE - strb r0, [r1, 0x4] - b _0800CC8A - .pool -_0800CA60: - cmp r6, 0 - beq _0800CA66 - b _0800CC8A -_0800CA66: - ldr r4, =gUnknown_03004140+0x10 - mov r0, sp - adds r1, r4, 0 - bl rfu_getConnectParentStatus - lsls r0, 16 - cmp r0, 0 - beq _0800CA78 - b _0800CC8A -_0800CA78: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CA9C - adds r1, r4, 0 - subs r1, 0x10 - movs r0, 0x13 - strb r0, [r1, 0x4] - movs r0, 0xF - strb r0, [r1, 0x5] - movs r0, 0x22 - strh r0, [r1, 0x1E] - ldrb r0, [r1, 0x10] - strh r0, [r1, 0x14] - b _0800CABC - .pool -_0800CA9C: - adds r1, r4, 0 - subs r1, 0x10 - strb r6, [r1, 0x5] - strb r6, [r1, 0x4] - movs r0, 0x23 - strh r0, [r1, 0x1E] - mov r0, sp - ldrb r0, [r0] - strh r0, [r1, 0x14] - ldrb r0, [r1, 0x7] - cmp r0, 0 - beq _0800CABC - movs r0, 0x3 - strb r0, [r1, 0x7] - movs r0, 0x9 - strb r0, [r1, 0x4] -_0800CABC: - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x1E] - movs r1, 0x1 - bl sub_800D30C - movs r0, 0 - strh r0, [r4, 0x1E] - b _0800CC8A - .pool -_0800CAD0: - cmp r6, 0 - beq _0800CAD6 - b _0800CC8A -_0800CAD6: - ldr r2, =gUnknown_03007890 - ldr r3, [r2] - ldrb r0, [r3, 0x3] - movs r1, 0 - strh r0, [r7, 0x14] - movs r0, 0x11 - strb r0, [r7, 0x5] - strb r0, [r7, 0x4] - strb r1, [r7, 0x10] - ldrb r0, [r3, 0x3] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800CAF4 - b _0800CC8A -_0800CAF4: - adds r1, r7, 0 - movs r3, 0x1 -_0800CAF8: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bls _0800CB08 - b _0800CC8A -_0800CB08: - ldr r0, [r2] - ldrb r0, [r0, 0x3] - ldrb r4, [r7, 0x10] - asrs r0, r4 - ands r0, r3 - cmp r0, 0 - beq _0800CAF8 - b _0800CC8A - .pool -_0800CB1C: - cmp r6, 0 - bne _0800CB3A - mov r0, sp - bl rfu_CHILD_getConnectRecoveryStatus - lsls r0, 16 - cmp r0, 0 - bne _0800CB3A - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0800CB3A - ldr r1, =gUnknown_03004140 - movs r0, 0x12 - strb r0, [r1, 0x4] -_0800CB3A: - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x10] - lsls r0, 1 - adds r1, r2, 0 - adds r1, 0x34 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, 0 - bne _0800CB4E - b _0800CC8A -_0800CB4E: - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _0800CB5A - b _0800CC8A -_0800CB5A: - movs r0, 0x12 - strb r0, [r2, 0x4] - b _0800CC8A - .pool -_0800CB64: - cmp r6, 0 - beq _0800CB6A - b _0800CC8A -_0800CB6A: - mov r0, sp - bl rfu_CHILD_getConnectRecoveryStatus - lsls r0, 16 - cmp r0, 0 - beq _0800CB78 - b _0800CC8A -_0800CB78: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CB94 - ldr r1, =gUnknown_03004140 - movs r0, 0x13 - strb r0, [r1, 0x4] - movs r0, 0x16 - strb r0, [r1, 0x5] - movs r0, 0x32 - strh r0, [r1, 0x1E] - b _0800CBA8 - .pool -_0800CB94: - ldr r4, =gUnknown_03004140 - strb r6, [r4, 0x5] - strb r6, [r4, 0x4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bl sub_800D334 - movs r0, 0x33 - strh r0, [r4, 0x1E] -_0800CBA8: - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x34 - adds r0, r1 - movs r1, 0 - movs r4, 0 - strh r4, [r0] - adds r0, r5, 0 - adds r0, 0x30 - strb r1, [r0] - strb r1, [r5, 0xA] - ldrb r0, [r5, 0x1E] - movs r1, 0x1 - bl sub_800D30C - strh r4, [r5, 0x1E] - b _0800CC8A - .pool -_0800CBD8: - cmp r6, 0 - bne _0800CC8A - ldr r5, =gUnknown_03004140 - ldrb r1, [r5, 0x5] - adds r0, r1, 0 - cmp r0, 0x16 - bne _0800CC04 - ldrb r0, [r5, 0x11] - strb r0, [r5, 0x4] - ldrb r0, [r5, 0x12] - strb r0, [r5, 0x5] - ldrb r0, [r5, 0x2] - movs r0, 0x1 - strb r0, [r5, 0x2] - movs r0, 0x41 -_0800CBF6: - movs r1, 0 - bl sub_800D30C - b _0800CC8A - .pool -_0800CC04: - cmp r0, 0xF - bne _0800CC8A - strb r1, [r5, 0x4] - ldrb r0, [r5, 0x2] - movs r4, 0x1 - strb r4, [r5, 0x2] - movs r0, 0x41 - movs r1, 0 - bl sub_800D30C - adds r1, r5, 0 - adds r1, 0x24 - ldrb r0, [r5, 0x10] - lsls r4, r0 - ldrb r0, [r1] - orrs r4, r0 - strb r4, [r1] - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, 0x4 - adds r0, r1 - ldrh r1, [r5, 0x26] - movs r7, 0 - strh r1, [r0] - ldrb r1, [r5, 0x10] - movs r0, 0x4 - bl rfu_clearSlot - mov r4, sp - ldrb r0, [r5, 0x10] - movs r1, 0xE - bl rfu_NI_CHILD_setSendGameName - strb r0, [r4] - lsls r0, 24 - cmp r0, 0 - beq _0800CC8A - strb r7, [r5, 0x5] - strb r7, [r5, 0x4] - bl sub_800D610 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl sub_800D334 - mov r0, sp - ldrb r0, [r0] - strh r0, [r5, 0x14] - movs r0, 0x25 - movs r1, 0x1 - bl sub_800D30C - b _0800CC8A - .pool -_0800CC78: - cmp r6, 0 - bne _0800CC8A - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0x5] - strb r6, [r0, 0x4] - movs r0, 0x42 - movs r1, 0 - bl sub_800D30C -_0800CC8A: - ldr r1, =gUnknown_03004140 - movs r0, 0x1 - strb r0, [r1, 0xE] - b _0800CCE6 - .pool -_0800CC98: - cmp r6, 0x3 - bne _0800CCE6 - ldrb r0, [r7, 0xF] - cmp r0, 0 - beq _0800CCE6 - mov r3, r8 - cmp r3, 0x24 - beq _0800CCB0 - cmp r3, 0x26 - beq _0800CCB0 - cmp r3, 0x27 - bne _0800CCE6 -_0800CCB0: - bl rfu_REQ_RFUStatus - bl rfu_waitREQComplete - mov r0, sp - bl rfu_getRFUStatus - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CCE6 - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - bne _0800CCE6 - bl rfu_getSTWIRecvBuffer - ldr r1, [r4] - ldrb r1, [r1, 0x2] - strb r1, [r0, 0x4] - movs r1, 0x1 - strb r1, [r0, 0x5] - movs r0, 0x29 - bl sub_800C36C - movs r6, 0 -_0800CCE6: - mov r4, r8 - cmp r4, 0x26 - bne _0800CCEE - b _0800CE02 -_0800CCEE: - cmp r4, 0x26 - bgt _0800CD00 - cmp r4, 0x10 - bne _0800CCF8 - b _0800CE20 -_0800CCF8: - b _0800CE3E - .pool -_0800CD00: - mov r0, r8 - cmp r0, 0x30 - beq _0800CD0E - cmp r0, 0x3D - bne _0800CD0C - b _0800CE20 -_0800CD0C: - b _0800CE3E -_0800CD0E: - cmp r6, 0 - beq _0800CD14 - b _0800CE42 -_0800CD14: - bl rfu_getSTWIRecvBuffer - ldr r4, =gUnknown_03004140 - ldrb r0, [r0, 0x8] - strh r0, [r4, 0x14] - bl sub_800D358 - adds r2, r4, 0 - adds r2, 0x30 - ldrb r1, [r2] - cmp r1, 0 - beq _0800CD6A - ldrb r0, [r4, 0x14] - adds r3, r1, 0 - bics r3, r0 - adds r0, r3, 0 - strb r0, [r2] - movs r3, 0 - adds r7, r4, 0 - adds r1, r7, 0 - movs r5, 0x1 - adds r4, r1, 0 - adds r4, 0x34 - movs r2, 0 -_0800CD44: - ldrh r0, [r1, 0x14] - asrs r0, r3 - ands r0, r5 - cmp r0, 0 - beq _0800CD54 - lsls r0, r3, 1 - adds r0, r4 - strh r2, [r0] -_0800CD54: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800CD44 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x6] - cmp r0, 0 - bne _0800CD6A - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] -_0800CD6A: - mov r3, sp - ldr r1, =gUnknown_03004140 - ldrb r2, [r1] - ldrb r0, [r1, 0x14] - ands r0, r2 - strb r0, [r3] - movs r3, 0 - adds r7, r1, 0 - ldr r2, =gUnknown_03007890 - mov r1, sp - movs r5, 0x1 - adds r4, r7, 0 -_0800CD82: - ldrb r0, [r1] - asrs r0, r3 - ands r0, r5 - cmp r0, 0 - beq _0800CD96 - ldrb r0, [r4, 0x1] - cmp r0, 0 - beq _0800CD96 - subs r0, 0x1 - strb r0, [r7, 0x1] -_0800CD96: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800CD82 - ldrb r1, [r7, 0x14] - ldrb r0, [r7] - bics r0, r1 - strb r0, [r7] - ldrb r1, [r7, 0x7] - cmp r1, 0 - beq _0800CDE0 - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0xFF - bne _0800CDF2 - cmp r1, 0x8 - bne _0800CDCC - ldrh r0, [r7, 0x1C] - strh r0, [r7, 0x1A] - movs r0, 0x6 - strb r0, [r7, 0x7] - b _0800CDDE - .pool -_0800CDCC: - ldrb r0, [r7, 0x4] - subs r0, 0x6 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _0800CDE0 - movs r0, 0x1 - strb r0, [r7, 0x7] - movs r0, 0x5 -_0800CDDE: - strb r0, [r7, 0x4] -_0800CDE0: - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0xFF - bne _0800CDF2 - ldrb r0, [r7, 0x4] - cmp r0, 0 - bne _0800CDF2 - movs r0, 0xFF - strb r0, [r7, 0x6] -_0800CDF2: - ldrb r0, [r7, 0xE] - cmp r0, 0 - bne _0800CE3E - movs r0, 0x40 - movs r1, 0x1 - bl sub_800D30C - b _0800CE3E -_0800CE02: - bl sub_800D20C - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0xFF - beq _0800CE3E - movs r0, 0x50 - movs r1, 0 - bl sub_800D30C - b _0800CE3E - .pool -_0800CE20: - cmp r6, 0 - bne _0800CE42 - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0xD] - strb r6, [r0, 0x1] - strb r6, [r0] - movs r1, 0xFF - strb r1, [r0, 0x6] - bl sub_800D610 - mov r4, r8 - cmp r4, 0x3D - bne _0800CE3E - bl sub_800BFA0 -_0800CE3E: - cmp r6, 0 - beq _0800CE92 -_0800CE42: - ldr r7, =gUnknown_03004140 - mov r0, r8 - cmp r0, 0x1C - bne _0800CE74 - cmp r6, 0 - beq _0800CE74 - ldrb r0, [r7, 0x7] - cmp r0, 0x4 - bne _0800CE74 - ldr r2, =gUnknown_03007890 - ldr r1, [r2] - movs r0, 0x1 - strb r0, [r1] - ldr r1, [r2] - movs r0, 0xF - strb r0, [r1, 0x2] - bl sub_800D334 - bl rfu_waitREQComplete - b _0800CEA4 - .pool -_0800CE74: - movs r1, 0 - mov r3, r8 - strh r3, [r7, 0x14] - strh r6, [r7, 0x16] - ldrb r0, [r7, 0xE] - cmp r0, 0 - beq _0800CE86 - strb r1, [r7, 0x5] - strb r1, [r7, 0x4] -_0800CE86: - movs r0, 0xF0 - movs r1, 0x2 - bl sub_800D30C - bl sub_800D610 -_0800CE92: - mov r4, r8 - cmp r4, 0xFF - bne _0800CEA4 - movs r0, 0xF2 - movs r1, 0 - bl sub_800D30C - bl sub_800D610 -_0800CEA4: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800C7B4 - - thumb_func_start sub_800CEB0 -sub_800CEB0: @ 800CEB0 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r4, =gUnknown_03004140 - ldrb r7, [r4, 0xE] - movs r0, 0 - strb r0, [r4, 0xE] - movs r0, 0x1 - strb r0, [r4, 0xF] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r5, [r0] - cmp r5, 0 - bne _0800CEEC - adds r0, r6, 0 - bl sub_800C36C - ldrb r0, [r4, 0x2] - cmp r0, 0x1 - beq _0800CF04 - bl sub_800D610 - strb r5, [r4, 0xF] - strb r7, [r4, 0xE] - b _0800CF28 - .pool -_0800CEEC: - mov r0, sp - bl rfu_UNI_PARENT_getDRAC_ACK - lsls r0, 16 - cmp r0, 0 - bne _0800CF04 - mov r1, sp - ldrb r0, [r4, 0x3] - ldrb r1, [r1] - orrs r0, r1 - ldrb r1, [r4, 0x3] - strb r0, [r4, 0x3] -_0800CF04: - ldr r4, =gUnknown_03004140 - ldr r1, [r4, 0x44] - cmp r1, 0 - beq _0800CF20 - adds r0, r6, 0 - bl _call_via_r1 - bl rfu_waitREQComplete - ldrb r0, [r4, 0x2] - cmp r0, 0x2 - bne _0800CF20 - bl sub_800D610 -_0800CF20: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0xF] - strb r7, [r1, 0xE] -_0800CF28: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800CEB0 - - thumb_func_start sub_800CF34 -sub_800CF34: @ 800CF34 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - subs r0, 0x5 - lsls r0, 24 - lsrs r0, 24 - adds r3, r1, 0 - cmp r0, 0x3 - bls _0800CF52 - b _0800D146 -_0800CF52: - ldr r0, =gUnknown_03007890 - ldr r2, [r0] - ldrb r1, [r2, 0x2] - ldrb r0, [r3, 0xC] - adds r4, r1, 0 - eors r4, r0 - ands r4, r1 - ldrb r0, [r2, 0x7] - bics r4, r0 - mov r8, r4 - strb r1, [r3, 0xC] - cmp r4, 0 - beq _0800CF7A - strh r4, [r3, 0x14] - movs r0, 0x10 - movs r1, 0x1 - str r3, [sp, 0x4] - bl sub_800D30C - ldr r3, [sp, 0x4] -_0800CF7A: - movs r0, 0 - str r0, [sp] - movs r6, 0 - adds r7, r3, 0 - movs r1, 0x24 - adds r1, r3 - mov r9, r1 -_0800CF88: - movs r0, 0x80 - lsls r0, 17 - lsls r0, r6 - lsrs r4, r0, 24 - movs r5, 0 - mov r0, r8 - ands r0, r4 - cmp r0, 0 - beq _0800CFDA - lsls r1, r6, 1 - adds r0, r7, 0 - adds r0, 0x28 - adds r1, r0 - ldrh r0, [r7, 0x26] - strh r0, [r1] - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r2] - adds r6, 0x1 - mov r10, r6 - b _0800D090 - .pool -_0800CFC0: - ldrb r1, [r7] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r7] - ldrb r0, [r7, 0x1] - adds r0, 0x1 - strb r0, [r7, 0x1] - ldr r0, [sp] - orrs r0, r4 - str r0, [sp] - movs r0, 0x1 - orrs r5, r0 - b _0800D024 -_0800CFDA: - mov r1, r9 - ldrb r0, [r1] - ands r0, r4 - adds r2, r6, 0x1 - mov r10, r2 - cmp r0, 0 - beq _0800D090 - ldr r0, =gUnknown_03007880 - lsls r1, r6, 2 - adds r1, r0 - ldr r1, [r1] - ldrh r0, [r1, 0x34] - cmp r0, 0x46 - bne _0800D040 - adds r0, r1, 0 - adds r0, 0x61 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800D058 - movs r5, 0x2 - ldr r3, [r3, 0x20] - ldrh r2, [r3] - ldr r0, =0x0000ffff - cmp r2, r0 - beq _0800D024 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - lsls r1, r6, 5 - adds r0, r1 - ldrh r0, [r0, 0x18] - ldr r1, =0x0000ffff -_0800D018: - cmp r0, r2 - beq _0800CFC0 - adds r3, 0x2 - ldrh r2, [r3] - cmp r2, r1 - bne _0800D018 -_0800D024: - movs r0, 0x1 - ands r0, r5 - cmp r0, 0 - bne _0800D058 - movs r0, 0x4 - orrs r5, r0 - b _0800D058 - .pool -_0800D040: - lsls r1, r6, 1 - adds r0, r3, 0 - adds r0, 0x28 - adds r1, r0 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - ldr r1, =0x0000ffff - ands r0, r1 - cmp r0, 0 - bne _0800D058 - movs r5, 0x6 -_0800D058: - movs r0, 0x2 - ands r0, r5 - cmp r0, 0 - beq _0800D07E - mov r2, r9 - ldrb r0, [r2] - bics r0, r4 - movs r2, 0 - mov r1, r9 - strb r0, [r1] - lsls r0, r6, 1 - adds r1, r7, 0 - adds r1, 0x28 - adds r0, r1 - strh r2, [r0] - movs r0, 0x8 - adds r1, r6, 0 - bl rfu_clearSlot -_0800D07E: - movs r0, 0x4 - ands r5, r0 - ldr r3, =gUnknown_03004140 - cmp r5, 0 - beq _0800D090 - ldrb r1, [r7, 0xD] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r7, 0xD] -_0800D090: - mov r2, r10 - lsls r0, r2, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bhi _0800D09C - b _0800CF88 -_0800D09C: - ldr r4, [sp] - cmp r4, 0 - beq _0800D0AE - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x11 - movs r1, 0x1 - bl sub_800D30C -_0800D0AE: - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0xD] - cmp r0, 0 - beq _0800D0EA - movs r5, 0x1 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0 - beq _0800D0CE - ldrb r0, [r1, 0x3] - ldrb r1, [r1] - ands r0, r1 - cmp r0, r1 - beq _0800D0CE - movs r5, 0 -_0800D0CE: - cmp r5, 0 - beq _0800D0EA - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0xD] - bl sub_800D334 - ldrb r0, [r4, 0xD] - movs r1, 0 - strh r0, [r4, 0x14] - strb r1, [r4, 0xD] - movs r0, 0x12 - movs r1, 0x1 - bl sub_800D30C -_0800D0EA: - ldr r0, =gUnknown_03004140 - adds r1, r0, 0 - adds r1, 0x24 - ldrb r1, [r1] - adds r3, r0, 0 - cmp r1, 0 - bne _0800D146 - ldrb r0, [r3, 0x4] - cmp r0, 0x8 - bne _0800D146 - ldrb r0, [r3, 0x7] - cmp r0, 0 - bne _0800D120 - strb r0, [r3, 0x5] - strb r0, [r3, 0x4] - movs r0, 0x14 - movs r1, 0 - bl sub_800D30C - b _0800D146 - .pool -_0800D120: - cmp r0, 0x2 - bne _0800D12C - movs r0, 0x3 - strb r0, [r3, 0x7] - movs r0, 0x9 - b _0800D132 -_0800D12C: - movs r0, 0x1 - strb r0, [r3, 0x7] - movs r0, 0x5 -_0800D132: - strb r0, [r3, 0x4] - ldrb r0, [r3] - cmp r0, 0 - beq _0800D146 - movs r0, 0 - strh r0, [r3, 0x1A] - movs r0, 0x8 - strb r0, [r3, 0x7] - movs r0, 0x5 - strb r0, [r3, 0x4] -_0800D146: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800CF34 - - thumb_func_start sub_800D158 -sub_800D158: @ 800D158 - push {r4-r6,lr} - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r6, r0, 0 - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x4] - cmp r0, 0xF - bne _0800D1BC - ldrb r1, [r4, 0x10] - lsls r1, 1 - adds r5, r4, 0 - adds r5, 0x28 - adds r1, r5 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _0800D192 - ldr r1, =gUnknown_03007880 - ldrb r0, [r4, 0x10] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x27 - bne _0800D1BC -_0800D192: - bl sub_800D630 - movs r0, 0x18 - strb r0, [r4, 0x4] - ldrb r1, [r4, 0x10] - movs r0, 0x4 - bl rfu_clearSlot - adds r2, r4, 0 - adds r2, 0x24 - movs r1, 0x1 - ldrb r0, [r4, 0x10] - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r4, 0x10] - lsls r0, 1 - adds r0, r5 - movs r1, 0 - strh r1, [r0] -_0800D1BC: - ldr r0, =0x04000208 - strh r6, [r0] - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x4] - cmp r0, 0x18 - bne _0800D1F6 - ldrb r0, [r5, 0x2] - cmp r0, 0x1 - bne _0800D1D2 - bl sub_800D630 -_0800D1D2: - ldrb r0, [r5, 0x2] - adds r4, r0, 0 - cmp r4, 0 - bne _0800D1F6 - strb r4, [r5, 0x5] - strb r4, [r5, 0x4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl sub_800D334 - strh r4, [r5, 0x14] - movs r0, 0x25 - movs r1, 0x1 - bl sub_800D30C -_0800D1F6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D158 - - thumb_func_start sub_800D20C -sub_800D20C: @ 800D20C - push {r4,r5,lr} - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x4] - cmp r0, 0xF - bne _0800D258 - ldr r1, =gUnknown_03007880 - ldrb r2, [r5, 0x10] - lsls r0, r2, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x26 - bne _0800D258 - movs r4, 0 - strb r4, [r5, 0x5] - strb r4, [r5, 0x4] - movs r0, 0x4 - adds r1, r2, 0 - bl rfu_clearSlot - adds r2, r5, 0 - adds r2, 0x24 - movs r1, 0x1 - ldrb r0, [r5, 0x10] - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x28 - adds r0, r1 - strh r4, [r0] - movs r0, 0x24 - movs r1, 0 - bl sub_800D30C -_0800D258: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D20C - - thumb_func_start sub_800D268 -sub_800D268: @ 800D268 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x6] - cmp r0, 0 - bne _0800D28C - ldrb r0, [r1, 0xA] - cmp r0, 0x1 - bne _0800D28C - ldrb r0, [r1, 0x4] - strb r0, [r1, 0x11] - ldrb r0, [r1, 0x5] - strb r0, [r1, 0x12] - movs r0, 0x10 - strb r0, [r1, 0x4] - movs r0, 0x11 - strb r0, [r1, 0x5] - movs r0, 0x2 - strb r0, [r1, 0xA] -_0800D28C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D268 - - thumb_func_start sub_800D294 -sub_800D294: @ 800D294 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r6, 0 - movs r5, 0 - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - cmp r6, r0 - bcs _0800D2F0 - mov r8, r0 - ldr r0, =gUnknown_03004140 - mov r10, r0 - mov r9, r1 -_0800D2B4: - mov r1, r10 - ldr r3, [r1, 0x20] - ldrh r2, [r3] - adds r0, r5, 0x1 - mov r12, r0 - ldr r1, =0x0000ffff - cmp r2, r1 - beq _0800D2E6 - mov r1, r9 - ldr r0, [r1] - lsls r1, r5, 5 - adds r0, r1 - ldrh r4, [r0, 0x18] - ldr r7, =0x0000ffff - movs r1, 0x1 - lsls r1, r5 -_0800D2D4: - cmp r4, r2 - bne _0800D2DE - orrs r6, r1 - lsls r0, r6, 24 - lsrs r6, r0, 24 -_0800D2DE: - adds r3, 0x2 - ldrh r2, [r3] - cmp r2, r7 - bne _0800D2D4 -_0800D2E6: - mov r1, r12 - lsls r0, r1, 24 - lsrs r5, r0, 24 - cmp r5, r8 - bcc _0800D2B4 -_0800D2F0: - adds r0, r6, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D294 - - thumb_func_start sub_800D30C -sub_800D30C: @ 800D30C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r4, =gUnknown_03004140 - ldr r2, [r4, 0x40] - cmp r2, 0 - beq _0800D322 - bl _call_via_r2 -_0800D322: - movs r0, 0 - strh r0, [r4, 0x16] - strh r0, [r4, 0x14] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D30C - - thumb_func_start sub_800D334 -sub_800D334: @ 800D334 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gUnknown_03004140 - ldrb r5, [r4, 0xE] - movs r1, 0x1 - strb r1, [r4, 0xE] - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - strb r5, [r4, 0xE] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D334 - - thumb_func_start sub_800D358 -sub_800D358: @ 800D358 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0800D3A0 - movs r4, 0 -_0800D36A: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D396 - ldrb r1, [r2, 0x1A] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D396 - adds r2, r1, 0 - bics r2, r5 - movs r0, 0x20 - adds r1, r4, 0 - bl rfu_changeSendTarget -_0800D396: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D36A -_0800D3A0: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _0800D3DE - movs r4, 0 -_0800D3AC: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2, 0x34] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D3D4 - adds r0, r2, 0 - adds r0, 0x4E - ldrb r0, [r0] - ands r0, r5 - cmp r0, 0 - beq _0800D3D4 - adds r0, r4, 0 - bl rfu_NI_stopReceivingData -_0800D3D4: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D3AC -_0800D3DE: - ldr r0, =gUnknown_03007890 - ldr r3, [r0] - ldrb r2, [r3, 0x6] - cmp r2, 0 - beq _0800D41C - mvns r1, r5 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3, 0x6] - movs r4, 0 - ldr r7, =gUnknown_03007870 - ldr r6, =0x00008024 -_0800D3F6: - lsls r0, r4, 2 - adds r0, r7 - ldr r2, [r0] - ldrh r0, [r2] - cmp r0, r6 - bne _0800D412 - ldrb r3, [r2, 0x3] - adds r0, r5, 0 - ands r0, r3 - cmp r0, 0 - beq _0800D412 - adds r0, r1, 0 - ands r0, r3 - strb r0, [r2, 0x3] -_0800D412: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D3F6 -_0800D41C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D358 - - thumb_func_start sub_800D434 -sub_800D434: @ 800D434 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x18] - cmp r0, 0 - beq _0800D510 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0800D4D4 - movs r6, 0 -_0800D454: - ldr r3, =gUnknown_03007880 - lsls r2, r6, 2 - adds r0, r2, r3 - ldr r0, [r0] - ldrh r1, [r0] - movs r4, 0x80 - lsls r4, 8 - adds r0, r4, 0 - ands r1, r0 - adds r7, r2, 0 - adds r0, r6, 0x1 - mov r9, r0 - cmp r1, 0 - beq _0800D4CA - movs r5, 0 - movs r4, 0 - movs r1, 0x1 - mov r8, r1 - mov r10, r3 -_0800D47A: - adds r0, r7, r3 - ldr r0, [r0] - ldrb r0, [r0, 0x1A] - asrs r0, r4 - mov r1, r8 - ands r0, r1 - cmp r0, 0 - beq _0800D4A4 - lsls r0, r4, 2 - adds r0, r3 - ldr r0, [r0] - ldr r1, =gUnknown_03004140 - ldrh r0, [r0, 0x2] - ldrh r1, [r1, 0x18] - cmp r0, r1 - bls _0800D4A4 - mov r0, r8 - lsls r0, r4 - orrs r5, r0 - lsls r0, r5, 24 - lsrs r5, r0, 24 -_0800D4A4: - cmp r5, 0 - beq _0800D4C0 - mov r1, r10 - adds r0, r7, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1A] - adds r2, r5, 0 - eors r2, r0 - movs r0, 0x20 - adds r1, r6, 0 - str r3, [sp] - bl rfu_changeSendTarget - ldr r3, [sp] -_0800D4C0: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D47A -_0800D4CA: - mov r3, r9 - lsls r0, r3, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0800D454 -_0800D4D4: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _0800D510 - movs r6, 0 -_0800D4E0: - ldr r1, =gUnknown_03007880 - lsls r0, r6, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2, 0x34] - movs r4, 0x80 - lsls r4, 8 - adds r1, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D506 - ldr r1, =gUnknown_03004140 - ldrh r0, [r2, 0x36] - ldrh r1, [r1, 0x18] - cmp r0, r1 - bls _0800D506 - adds r0, r6, 0 - bl rfu_NI_stopReceivingData -_0800D506: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0800D4E0 -_0800D510: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D434 - - thumb_func_start sub_800D52C -sub_800D52C: @ 800D52C - push {lr} - ldr r1, =gUnknown_03004140 - str r0, [r1, 0x44] - ldr r0, =sub_800CEB0 - bl rfu_setMSCCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D52C - - thumb_func_start sub_800D544 -sub_800D544: @ 800D544 - ldr r1, =gUnknown_03004140 - str r0, [r1, 0x40] - bx lr - .pool - thumb_func_end sub_800D544 - - thumb_func_start sub_800D550 -sub_800D550: @ 800D550 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x9] - adds r3, r0, 0 - cmp r1, 0 - beq _0800D578 - cmp r4, 0 - bne _0800D578 - adds r0, 0x30 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D578 - movs r0, 0x5 - b _0800D588 - .pool -_0800D578: - ldr r2, =0x04000208 - ldrh r1, [r2] - movs r0, 0 - strh r0, [r2] - strb r4, [r3, 0x9] - strh r5, [r3, 0x32] - strh r1, [r2] - movs r0, 0 -_0800D588: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D550 - - thumb_func_start sub_800D594 -sub_800D594: @ 800D594 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x4] - ldrb r0, [r0, 0x5] - orrs r0, r1 - cmp r0, 0 - bne _0800D5B8 - ldr r0, =gUnknown_03004140 - strh r2, [r0, 0x18] - movs r0, 0 - b _0800D5C8 - .pool -_0800D5B8: - ldr r1, =gUnknown_03004140 - movs r0, 0x6 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x6 -_0800D5C8: - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D594 - - thumb_func_start sub_800D5D0 -sub_800D5D0: @ 800D5D0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - adds r3, r2, 0 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0800D5FC - movs r0, 0x7 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x7 - b _0800D60A - .pool -_0800D5FC: - cmp r2, 0 - beq _0800D606 - movs r0, 0x1 - strb r0, [r1, 0xB] - b _0800D608 -_0800D606: - strb r3, [r1, 0xB] -_0800D608: - movs r0, 0 -_0800D60A: - pop {r1} - bx r1 - thumb_func_end sub_800D5D0 - - thumb_func_start sub_800D610 -sub_800D610: @ 800D610 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x2] - cmp r0, 0 - beq _0800D628 - ldrb r0, [r1, 0x2] - movs r0, 0 - strb r0, [r1, 0x2] - movs r0, 0x45 - movs r1, 0 - bl sub_800D30C -_0800D628: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D610 - - thumb_func_start sub_800D630 -sub_800D630: @ 800D630 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x2] - cmp r0, 0 - bne _0800D648 - movs r0, 0x45 - movs r1, 0 - bl sub_800D30C - b _0800D654 - .pool -_0800D648: - ldrb r0, [r1, 0x2] - cmp r0, 0x1 - bne _0800D654 - ldrb r0, [r1, 0x2] - movs r0, 0x2 - strb r0, [r1, 0x2] -_0800D654: - pop {r0} - bx r0 - thumb_func_end sub_800D630 - - thumb_func_start sub_800D658 -sub_800D658: @ 800D658 - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x7] - adds r2, r0, 0 - cmp r1, 0 - beq _0800D6C2 - ldrb r0, [r2, 0x4] - subs r0, 0x5 - cmp r0, 0x6 - bhi _0800D6C2 - lsls r0, 2 - ldr r1, =_0800D680 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800D680: - .4byte _0800D69C - .4byte _0800D6A4 - .4byte _0800D6AE - .4byte _0800D6AE - .4byte _0800D6B4 - .4byte _0800D6B4 - .4byte _0800D6BA -_0800D69C: - movs r0, 0x3 - strb r0, [r2, 0x7] - movs r0, 0x9 - b _0800D6C0 -_0800D6A4: - movs r0, 0x2 - strb r0, [r2, 0x7] - movs r0, 0x1 - strh r0, [r2, 0x1A] - b _0800D6C2 -_0800D6AE: - movs r0, 0x2 - strb r0, [r2, 0x7] - b _0800D6C2 -_0800D6B4: - movs r0, 0x28 - strh r0, [r2, 0x1A] - b _0800D6C2 -_0800D6BA: - movs r0, 0x28 - strh r0, [r2, 0x1A] - movs r0, 0xA -_0800D6C0: - strb r0, [r2, 0x4] -_0800D6C2: - pop {r0} - bx r0 - thumb_func_end sub_800D658 - - thumb_func_start sub_800D6C8 -sub_800D6C8: @ 800D6C8 - push {r4,r5,lr} - adds r3, r0, 0 - movs r0, 0 - movs r4, 0 - movs r5, 0x46 -_0800D6D2: - adds r2, r0, 0x1 - movs r1, 0x45 - muls r0, r5 - adds r0, r3 - adds r0, 0x45 -_0800D6DC: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D6DC - adds r0, r2, 0 - cmp r0, 0x1F - ble _0800D6D2 - movs r1, 0 - ldr r2, =0x000008c1 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x8C - lsls r2, 4 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x000008c2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x000008c3 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D6C8 - - thumb_func_start sub_800D724 -sub_800D724: @ 800D724 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0 - movs r4, 0 -_0800D72C: - lsls r0, r1, 3 - adds r2, r1, 0x1 - subs r0, r1 - movs r1, 0xD - lsls r0, 1 - adds r0, r3 - adds r0, 0xD -_0800D73A: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D73A - adds r1, r2, 0 - cmp r1, 0x27 - ble _0800D72C - movs r1, 0 - ldr r2, =0x00000231 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x8C - lsls r2, 2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000232 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000233 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D724 - - thumb_func_start sub_800D780 -sub_800D780: @ 800D780 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0 - movs r4, 0 -_0800D788: - lsls r0, r1, 8 - adds r2, r1, 0x1 - movs r1, 0xFF - adds r0, r3 - adds r0, 0xFF -_0800D792: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D792 - adds r1, r2, 0 - cmp r1, 0x1 - ble _0800D788 - movs r1, 0 - ldr r2, =0x00000201 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x80 - lsls r2, 2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000202 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000203 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D780 - - thumb_func_start sub_800D7D8 -sub_800D7D8: @ 800D7D8 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x000008c2 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1F - bhi _0800D874 - ldr r0, =0x04000208 - ldrh r1, [r0] - adds r7, r1, 0 - movs r1, 0 - strh r1, [r0] - movs r5, 0 - movs r2, 0 -_0800D7F6: - adds r1, r4, r2 - ldrb r0, [r1] - cmp r0, 0 - bne _0800D80A - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _0800D80A - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0800D80A: - adds r2, 0xE - cmp r2, 0x45 - ble _0800D7F6 - cmp r5, 0x5 - beq _0800D866 - movs r2, 0 - movs r0, 0x8C - lsls r0, 4 - adds r5, r3, r0 - movs r6, 0x46 -_0800D81E: - ldrb r0, [r5] - adds r1, r0, 0 - muls r1, r6 - adds r1, r2, r1 - adds r1, r3, r1 - adds r0, r4, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D81E - movs r0, 0x8C - lsls r0, 4 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x000008c2 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D85E: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D85E -_0800D866: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D87E - .pool -_0800D874: - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D87E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D7D8 - - thumb_func_start sub_800D888 -sub_800D888: @ 800D888 - push {r4-r7,lr} - adds r6, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000232 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0x27 - bhi _0800D920 - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - movs r0, 0 - strh r0, [r1] - movs r2, 0 - ldrb r0, [r5] - cmp r0, 0 - bne _0800D8B8 -_0800D8AA: - adds r2, 0x1 - cmp r2, 0xD - bgt _0800D8B8 - adds r0, r5, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D8AA -_0800D8B8: - cmp r2, 0xE - beq _0800D910 - movs r2, 0 - movs r0, 0x8C - lsls r0, 2 - adds r3, r6, r0 -_0800D8C4: - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r2, r0 - adds r0, r6, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xD - ble _0800D8C4 - movs r1, 0x8C - lsls r1, 2 - adds r4, r6, r1 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r6, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r5, 0 - adds r0, 0xD -_0800D908: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r5 - bge _0800D908 -_0800D910: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D92A - .pool -_0800D920: - ldr r1, =0x00000233 - adds r0, r6, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D92A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D888 - - thumb_func_start sub_800D934 -sub_800D934: @ 800D934 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x04000208 - ldrh r0, [r1] - mov r12, r0 - movs r0, 0 - strh r0, [r1] - movs r1, 0x8C - lsls r1, 4 - adds r0, r3, r1 - ldr r7, =0x000008c1 - adds r5, r3, r7 - ldrb r1, [r0] - ldrb r0, [r5] - cmp r1, r0 - beq _0800D960 - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D984 -_0800D960: - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D966: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D966 - ldr r0, =0x04000208 - mov r7, r12 - strh r7, [r0] - movs r0, 0 - b _0800D9CA - .pool -_0800D984: - movs r2, 0 - movs r6, 0x46 -_0800D988: - adds r1, r4, r2 - ldrb r0, [r5] - adds r7, r0, 0 - muls r7, r6 - adds r0, r7, 0 - adds r0, r2, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D988 - ldr r0, =0x000008c1 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r7, =0x000008c2 - adds r1, r3, r7 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - mov r1, r12 - strh r1, [r0] - movs r0, 0x1 -_0800D9CA: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D934 - - thumb_func_start sub_800D9DC -sub_800D9DC: @ 800D9DC - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r1, 0x8C - lsls r1, 2 - adds r0, r5, r1 - adds r1, 0x1 - adds r4, r5, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DA00 - ldr r1, =0x00000233 - adds r0, r5, r1 - ldrb r0, [r0] - adds r2, r0, 0 - cmp r2, 0 - beq _0800DA08 -_0800DA00: - movs r0, 0 - b _0800DA54 - .pool -_0800DA08: - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - strh r2, [r1] - movs r3, 0 -_0800DA12: - adds r2, r6, r3 - ldrb r1, [r4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r5, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA12 - ldr r0, =0x00000231 - adds r4, r5, r0 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r5, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - strh r7, [r0] - movs r0, 0x1 -_0800DA54: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D9DC - - thumb_func_start sub_800DA68 -sub_800DA68: @ 800DA68 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _0800DA7E - adds r0, r2, 0 - movs r1, 0 - bl sub_800DAC8 - b _0800DAC0 -_0800DA7E: - movs r3, 0 -_0800DA80: - ldrb r1, [r2, 0x1C] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r2, r0 - adds r1, r4, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA80 - ldrb r0, [r2, 0x1C] - adds r0, 0x1 - ldrb r1, [r2, 0x1C] - strb r0, [r2, 0x1C] - ldrb r1, [r2, 0x1C] - movs r0, 0x1 - ands r0, r1 - ldrb r1, [r2, 0x1C] - strb r0, [r2, 0x1C] - ldrb r0, [r2, 0x1E] - cmp r0, 0x1 - bhi _0800DABA - ldrb r0, [r2, 0x1E] - adds r0, 0x1 - ldrb r1, [r2, 0x1E] - strb r0, [r2, 0x1E] - b _0800DAC0 -_0800DABA: - ldrb r0, [r2, 0x1C] - ldrb r1, [r2, 0x1D] - strb r0, [r2, 0x1D] -_0800DAC0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800DA68 - - thumb_func_start sub_800DAC8 -sub_800DAC8: @ 800DAC8 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - ldrb r0, [r3, 0x1E] - cmp r0, 0 - bne _0800DAD8 - movs r0, 0 - b _0800DB12 -_0800DAD8: - cmp r5, 0 - beq _0800DAF6 - movs r4, 0 -_0800DADE: - adds r2, r5, r4 - ldrb r1, [r3, 0x1D] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r4, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r4, 0x1 - cmp r4, 0xD - ble _0800DADE -_0800DAF6: - ldrb r0, [r3, 0x1D] - adds r0, 0x1 - ldrb r1, [r3, 0x1D] - strb r0, [r3, 0x1D] - ldrb r1, [r3, 0x1D] - movs r0, 0x1 - ands r0, r1 - ldrb r1, [r3, 0x1D] - strb r0, [r3, 0x1D] - ldrb r0, [r3, 0x1E] - subs r0, 0x1 - ldrb r1, [r3, 0x1E] - strb r0, [r3, 0x1E] - movs r0, 0x1 -_0800DB12: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_800DAC8 - - thumb_func_start sub_800DB18 -sub_800DB18: @ 800DB18 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000202 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0800DB70 - movs r2, 0 - movs r0, 0x80 - lsls r0, 2 - adds r4, r3, r0 -_0800DB30: - ldrb r0, [r4] - lsls r0, 8 - adds r0, r2, r0 - adds r0, r3, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xFF - ble _0800DB30 - movs r0, 0x80 - lsls r0, 2 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1 - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x00000202 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - b _0800DB7A - .pool -_0800DB70: - ldr r1, =0x00000203 - adds r0, r3, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800DB7A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DB18 - - thumb_func_start sub_800DB84 -sub_800DB84: @ 800DB84 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - movs r1, 0x80 - lsls r1, 2 - adds r0, r3, r1 - adds r1, 0x1 - adds r4, r3, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DBA6 - ldr r1, =0x00000203 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800DBB0 -_0800DBA6: - movs r0, 0 - b _0800DBEA - .pool -_0800DBB0: - movs r2, 0 -_0800DBB2: - adds r0, r5, r2 - ldrb r1, [r4] - lsls r1, 8 - adds r1, r2, r1 - adds r1, r3, r1 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xFF - ble _0800DBB2 - ldr r0, =0x00000201 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1 - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x00000202 - adds r1, r3, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0x1 -_0800DBEA: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800DB84 - - thumb_func_start sub_800DBF8 -sub_800DBF8: @ 800DBF8 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r1, 0 - movs r5, 0 - cmp r1, 0x1 - beq _0800DC36 - cmp r1, 0x1 - bgt _0800DC12 - cmp r1, 0 - beq _0800DC1C - b _0800DCAA -_0800DC12: - cmp r0, 0x2 - beq _0800DC56 - cmp r0, 0x3 - beq _0800DC76 - b _0800DCAA -_0800DC1C: - movs r4, 0 -_0800DC1E: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r1, [r0] - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r1, 0 - cmp r4, 0xC7 - ble _0800DC1E - b _0800DC70 -_0800DC36: - movs r4, 0 - adds r2, r6, 0 - adds r2, 0xC8 -_0800DC3C: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r1, [r0] - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r1, 0 - cmp r4, 0x63 - ble _0800DC3C - strh r5, [r2] - b _0800DCAA -_0800DC56: - movs r4, 0 -_0800DC58: - bl Random - lsls r0, 24 - lsrs r0, 24 - adds r1, r6, r4 - strb r0, [r1] - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, 0x1 - cmp r4, 0xC7 - ble _0800DC58 -_0800DC70: - adds r0, r6, r4 - strh r5, [r0] - b _0800DCAA -_0800DC76: - movs r4, 0 - ldr r3, =gUnknown_03000D74 - ldrb r1, [r3] - ldrb r0, [r3] - adds r7, r0, 0x1 - adds r2, r1, 0x1 - movs r0, 0xFF - mov r12, r0 -_0800DC86: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r2, [r0] - adds r0, r4, r7 - mov r4, r12 - ands r0, r4 - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r2, 0x1 - adds r4, r1, 0 - cmp r1, 0xC7 - ble _0800DC86 - adds r0, r6, r1 - strh r5, [r0] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] -_0800DCAA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DBF8 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 43a99267f..b5b7a43f2 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,6 +5,3544 @@ .text + thumb_func_start sub_800C12C +sub_800C12C: @ 800C12C + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 16 + lsrs r6, r0, 16 + lsls r1, 16 + lsrs r1, 16 + mov r8, r1 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + cmp r0, 0 + beq _0800C164 + subs r0, 0x9 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bls _0800C164 + movs r0, 0x1 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x1 + b _0800C204 + .pool +_0800C164: + bl rfu_getMasterSlave + lsls r0, 24 + cmp r0, 0 + bne _0800C184 + ldr r1, =gUnknown_03004140 + movs r0, 0x2 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x2 + b _0800C204 + .pool +_0800C184: + movs r2, 0 + ldr r0, =gUnknown_03007890 + ldr r1, [r0] + ldrb r3, [r1, 0x8] + ldr r5, =gUnknown_03004140 + adds r7, r0, 0 + cmp r2, r3 + bcs _0800C1B2 + ldrh r0, [r1, 0x14] + cmp r0, r6 + beq _0800C1B2 + adds r4, r1, 0 + adds r1, r3, 0 +_0800C19E: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, r1 + bcs _0800C1B2 + lsls r0, r2, 5 + adds r0, r4, r0 + ldrh r0, [r0, 0x14] + cmp r0, r6 + bne _0800C19E +_0800C1B2: + ldr r0, [r7] + ldrb r0, [r0, 0x8] + cmp r0, 0 + beq _0800C1BE + cmp r2, r0 + bne _0800C1D8 +_0800C1BE: + movs r0, 0x3 + strh r0, [r5, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x3 + b _0800C204 + .pool +_0800C1D8: + ldrb r0, [r5, 0x4] + cmp r0, 0 + beq _0800C1E2 + cmp r0, 0x9 + bne _0800C1EA +_0800C1E2: + movs r0, 0xC + strb r0, [r5, 0x4] + movs r0, 0xD + b _0800C1F0 +_0800C1EA: + movs r0, 0xB + strb r0, [r5, 0x4] + movs r0, 0xC +_0800C1F0: + strb r0, [r5, 0x5] + strh r6, [r5, 0x1E] + mov r0, r8 + strh r0, [r5, 0x1A] + ldrb r0, [r5, 0x7] + cmp r0, 0 + beq _0800C202 + movs r0, 0x7 + strb r0, [r5, 0x7] +_0800C202: + movs r0, 0 +_0800C204: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_800C12C + + thumb_func_start sub_800C210 +sub_800C210: @ 800C210 + push {r4-r7,lr} + lsls r0, 24 + lsrs r1, r0, 24 + ldr r6, =gUnknown_03004140 + adds r3, r6, 0 + adds r3, 0x30 + ldrb r2, [r3] + adds r0, r1, 0 + ands r0, r2 + cmp r0, 0 + beq _0800C26C + adds r0, r2, 0 + bics r0, r1 + strb r0, [r3] + movs r4, 0 + ldr r7, =gUnknown_03007890 + movs r5, 0x1 + adds r3, 0x4 + movs r2, 0 +_0800C236: + adds r0, r1, 0 + asrs r0, r4 + ands r0, r5 + cmp r0, 0 + beq _0800C246 + lsls r0, r4, 1 + adds r0, r3 + strh r2, [r0] +_0800C246: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800C236 + ldr r0, [r7] + ldrb r4, [r0, 0x3] + ands r4, r1 + cmp r4, 0 + beq _0800C260 + adds r0, r4, 0 + bl sub_800D334 +_0800C260: + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x33 + adds r1, r4, 0 + bl sub_800D30C +_0800C26C: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800C210 + + thumb_func_start sub_800C27C +sub_800C27C: @ 800C27C + push {r4,r5,lr} + lsls r0, 24 + movs r2, 0 + ldr r1, =gUnknown_03004140 + strb r2, [r1, 0x7] + adds r5, r1, 0 + cmp r0, 0 + beq _0800C29C + bl sub_800C000 + movs r0, 0x17 + strb r0, [r5, 0x4] + b _0800C366 + .pool +_0800C29C: + ldrb r0, [r5, 0x4] + subs r0, 0x5 + cmp r0, 0xD + bhi _0800C352 + lsls r0, 2 + ldr r1, =_0800C2B4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C2B4: + .4byte _0800C2EC + .4byte _0800C2F8 + .4byte _0800C2F8 + .4byte _0800C358 + .4byte _0800C302 + .4byte _0800C30C + .4byte _0800C30C + .4byte _0800C316 + .4byte _0800C320 + .4byte _0800C320 + .4byte _0800C358 + .4byte _0800C326 + .4byte _0800C34C + .4byte _0800C34C +_0800C2EC: + movs r1, 0 + movs r0, 0x8 + strb r0, [r5, 0x4] + strb r1, [r5, 0x5] + movs r2, 0x13 + b _0800C358 +_0800C2F8: + movs r0, 0x7 + strb r0, [r5, 0x4] + movs r0, 0x8 + strb r0, [r5, 0x5] + b _0800C358 +_0800C302: + movs r0, 0 + strb r0, [r5, 0x5] + strb r0, [r5, 0x4] + movs r2, 0x21 + b _0800C358 +_0800C30C: + movs r1, 0 + movs r0, 0xB + strb r0, [r5, 0x4] + strb r1, [r5, 0x5] + b _0800C358 +_0800C316: + movs r0, 0 + strb r0, [r5, 0x5] + strb r0, [r5, 0x4] + movs r2, 0x23 + b _0800C358 +_0800C320: + movs r0, 0xE + strb r0, [r5, 0x4] + b _0800C358 +_0800C326: + ldrb r0, [r5, 0x11] + strb r0, [r5, 0x4] + ldrb r0, [r5, 0x12] + strb r0, [r5, 0x5] + ldr r4, =gUnknown_03007890 + ldr r0, [r4] + ldrb r0, [r0, 0x3] + bl sub_800D334 + ldr r0, [r4] + ldrb r0, [r0, 0x3] + strh r0, [r5, 0x14] + movs r0, 0x33 + movs r1, 0x1 + bl sub_800D30C + b _0800C366 + .pool +_0800C34C: + movs r0, 0x12 + strb r0, [r5, 0x4] + b _0800C358 +_0800C352: + strb r2, [r5, 0x5] + strb r2, [r5, 0x4] + movs r2, 0x43 +_0800C358: + ldrb r0, [r5, 0x4] + cmp r0, 0 + bne _0800C366 + adds r0, r2, 0 + movs r1, 0 + bl sub_800D30C +_0800C366: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_800C27C + + thumb_func_start sub_800C36C +sub_800C36C: @ 800C36C + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x4 + lsls r0, 16 + lsrs r0, 16 + movs r1, 0 + mov r8, r1 + mov r5, sp + adds r5, 0x1 + mov r4, sp + adds r4, 0x2 + mov r1, sp + adds r2, r5, 0 + adds r3, r4, 0 + bl rfu_REQBN_watchLink + mov r0, sp + ldrb r0, [r0] + adds r7, r4, 0 + cmp r0, 0 + beq _0800C43E + ldr r1, =gUnknown_03004140 + mov r0, sp + ldrb r0, [r0] + strh r0, [r1, 0x14] + ldrb r0, [r5] + strh r0, [r1, 0x16] + ldrb r0, [r1, 0x9] + adds r6, r1, 0 + cmp r0, 0 + beq _0800C426 + movs r0, 0x1 + strb r0, [r6, 0xA] + ldrb r0, [r6, 0x6] + cmp r0, 0 + bne _0800C3C2 + ldrb r0, [r5] + cmp r0, 0 + bne _0800C3C2 + movs r0, 0x4 + strb r0, [r6, 0xA] +_0800C3C2: + ldrb r0, [r6, 0xA] + cmp r0, 0x1 + bne _0800C40C + movs r2, 0 + mov r4, sp + movs r5, 0x1 + mov r12, r6 + mov r3, r12 + adds r3, 0x30 + movs r6, 0x34 + add r6, r12 + mov r9, r6 +_0800C3DA: + ldrb r0, [r4] + asrs r0, r2 + ands r0, r5 + cmp r0, 0 + beq _0800C3F8 + adds r0, r5, 0 + lsls r0, r2 + ldrb r1, [r3] + orrs r0, r1 + strb r0, [r3] + lsls r0, r2, 1 + add r0, r9 + mov r6, r12 + ldrh r1, [r6, 0x32] + strh r1, [r0] +_0800C3F8: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C3DA + movs r0, 0x31 + b _0800C41E + .pool +_0800C40C: + movs r0, 0 + strb r0, [r6, 0xA] + mov r0, sp + ldrb r0, [r0] + bl sub_800D334 + movs r0, 0x1 + mov r8, r0 + movs r0, 0x33 +_0800C41E: + movs r1, 0x1 + bl sub_800D30C + b _0800C43A +_0800C426: + mov r0, sp + ldrb r0, [r0] + bl sub_800D334 + movs r1, 0x1 + mov r8, r1 + movs r0, 0x30 + movs r1, 0x2 + bl sub_800D30C +_0800C43A: + bl sub_800D610 +_0800C43E: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800C518 + ldrb r0, [r7] + cmp r0, 0 + beq _0800C49C + movs r2, 0 + ldr r6, =gUnknown_03004140 + movs r3, 0x1 + adds r4, r6, 0 + adds r4, 0x34 + adds r6, 0x30 + adds r5, r7, 0 +_0800C45C: + ldrb r0, [r6] + asrs r0, r2 + ands r0, r3 + cmp r0, 0 + beq _0800C478 + ldrb r0, [r5] + asrs r0, r2 + ands r0, r3 + cmp r0, 0 + beq _0800C478 + lsls r0, r2, 1 + adds r0, r4 + movs r1, 0 + strh r1, [r0] +_0800C478: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C45C + ldr r3, =gUnknown_03004140 + adds r2, r3, 0 + adds r2, 0x30 + ldrb r1, [r7] + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r7] + strh r0, [r3, 0x14] + movs r0, 0x32 + movs r1, 0x1 + bl sub_800D30C +_0800C49C: + ldr r0, =gUnknown_03004140 + adds r3, r0, 0 + adds r3, 0x30 + ldrb r1, [r3] + adds r6, r0, 0 + cmp r1, 0 + beq _0800C514 + movs r4, 0 + movs r2, 0 + movs r5, 0x1 +_0800C4B0: + ldrb r0, [r3] + asrs r0, r2 + ands r0, r5 + cmp r0, 0 + beq _0800C4E2 + lsls r1, r2, 1 + adds r0, r6, 0 + adds r0, 0x34 + adds r1, r0 + ldrh r0, [r1] + cmp r0, 0 + beq _0800C4E2 + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + bne _0800C4E2 + adds r0, r5, 0 + lsls r0, r2 + ldrb r1, [r3] + bics r1, r0 + strb r1, [r3] + orrs r4, r0 + lsls r0, r4, 24 + lsrs r4, r0, 24 +_0800C4E2: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _0800C4B0 + cmp r4, 0 + beq _0800C506 + adds r0, r4, 0 + bl sub_800D334 + movs r6, 0x1 + mov r8, r6 + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x33 + movs r1, 0x1 + bl sub_800D30C +_0800C506: + ldr r0, =gUnknown_03004140 + adds r1, r0, 0 + adds r1, 0x30 + ldrb r1, [r1] + adds r6, r0, 0 + cmp r1, 0 + bne _0800C518 +_0800C514: + movs r0, 0 + strb r0, [r6, 0xA] +_0800C518: + mov r0, r8 + add sp, 0x4 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800C36C + + thumb_func_start rfu_syncVBlank_ +rfu_syncVBlank_: @ 800C530 + push {lr} + bl rfu_syncVBlank + lsls r0, 16 + cmp r0, 0 + beq _0800C548 + movs r0, 0xF1 + movs r1, 0 + bl sub_800D30C + bl sub_800D610 +_0800C548: + pop {r0} + bx r0 + thumb_func_end rfu_syncVBlank_ + + thumb_func_start sub_800C54C +sub_800C54C: @ 800C54C + push {r4,lr} + adds r3, r0, 0 + ldr r1, =gUnknown_03004140 + ldr r2, [r1, 0x40] + cmp r2, 0 + bne _0800C568 + ldrb r0, [r1, 0x4] + cmp r0, 0 + beq _0800C568 + strb r2, [r1, 0x4] + b _0800C736 + .pool +_0800C568: + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x7] + cmp r0, 0 + beq _0800C576 + adds r0, r3, 0 + bl sub_800C744 +_0800C576: + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x4] + cmp r0, 0 + bne _0800C580 + b _0800C700 +_0800C580: + bl rfu_waitREQComplete + movs r0, 0x1 + strb r0, [r4, 0xE] + ldrb r0, [r4, 0x4] + subs r0, 0x1 + cmp r0, 0x16 + bls _0800C592 + b _0800C6F6 +_0800C592: + lsls r0, 2 + ldr r1, =_0800C5A4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C5A4: + .4byte _0800C624 + .4byte _0800C65C + .4byte _0800C662 + .4byte _0800C678 + .4byte _0800C690 + .4byte _0800C696 + .4byte _0800C69C + .4byte _0800C6F6 + .4byte _0800C6A2 + .4byte _0800C6A8 + .4byte _0800C6AE + .4byte _0800C6B4 + .4byte _0800C6C4 + .4byte _0800C6CA + .4byte _0800C6F6 + .4byte _0800C6D0 + .4byte _0800C6E0 + .4byte _0800C6E6 + .4byte _0800C6EC + .4byte _0800C6F6 + .4byte _0800C6F2 + .4byte _0800C6F6 + .4byte _0800C600 +_0800C600: + bl sub_800BEC0 + ldr r1, =0x00008001 + movs r2, 0xFF + cmp r0, r1 + bne _0800C60E + movs r2, 0x44 +_0800C60E: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + adds r0, r2, 0 + b _0800C64E + .pool +_0800C624: + bl sub_800BEC0 + ldr r1, =0x00008001 + cmp r0, r1 + bne _0800C644 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + movs r1, 0x3 + strb r1, [r0, 0x5] + b _0800C6F6 + .pool +_0800C644: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + movs r0, 0xFF +_0800C64E: + movs r1, 0 + bl sub_800D30C + b _0800C6F6 + .pool +_0800C65C: + bl rfu_REQ_reset + b _0800C6F6 +_0800C662: + ldr r0, =gUnknown_03004140 + ldr r2, [r0, 0x3C] + ldrh r0, [r2, 0x2] + ldrb r1, [r2] + ldrb r2, [r2, 0x1] + bl rfu_REQ_configSystem + b _0800C6F6 + .pool +_0800C678: + ldr r0, =gUnknown_03004140 + ldr r3, [r0, 0x3C] + ldrb r0, [r3, 0x4] + ldrh r1, [r3, 0x6] + ldr r2, [r3, 0x8] + ldr r3, [r3, 0xC] + bl rfu_REQ_configGameData + b _0800C6F6 + .pool +_0800C690: + bl rfu_REQ_startSearchChild + b _0800C6F6 +_0800C696: + bl rfu_REQ_pollSearchChild + b _0800C6F6 +_0800C69C: + bl rfu_REQ_endSearchChild + b _0800C6F6 +_0800C6A2: + bl rfu_REQ_startSearchParent + b _0800C6F6 +_0800C6A8: + bl rfu_REQ_pollSearchParent + b _0800C6F6 +_0800C6AE: + bl rfu_REQ_endSearchParent + b _0800C6F6 +_0800C6B4: + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x1E] + bl rfu_REQ_startConnectParent + b _0800C6F6 + .pool +_0800C6C4: + bl rfu_REQ_pollConnectParent + b _0800C6F6 +_0800C6CA: + bl rfu_REQ_endConnectParent + b _0800C6F6 +_0800C6D0: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x3] + bl rfu_REQ_CHILD_startConnectRecovery + b _0800C6F6 + .pool +_0800C6E0: + bl rfu_REQ_CHILD_pollConnectRecovery + b _0800C6F6 +_0800C6E6: + bl rfu_REQ_CHILD_endConnectRecovery + b _0800C6F6 +_0800C6EC: + bl rfu_REQ_changeMasterSlave + b _0800C6F6 +_0800C6F2: + bl rfu_REQ_stopMode +_0800C6F6: + bl rfu_waitREQComplete + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0xE] +_0800C700: + ldr r0, =gUnknown_03004140 + ldrb r0, [r0, 0x4] + subs r0, 0x12 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _0800C710 + b _0800C576 +_0800C710: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800C726 + movs r0, 0 + bl sub_800C36C + lsls r0, 24 + cmp r0, 0 + bne _0800C736 +_0800C726: + bl sub_800CF34 + bl sub_800D158 + bl sub_800D268 + bl sub_800D434 +_0800C736: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800C54C + + thumb_func_start sub_800C744 +sub_800C744: @ 800C744 + push {r4,lr} + adds r3, r0, 0 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x7] + adds r4, r0, 0 + cmp r1, 0x5 + bne _0800C76E + movs r2, 0x1 + strb r2, [r4, 0x6] + strb r1, [r4, 0x4] + ldrh r0, [r4, 0x1C] + strh r0, [r4, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C76C + movs r0, 0x6 + strb r0, [r4, 0x7] + b _0800C76E + .pool +_0800C76C: + strb r2, [r4, 0x7] +_0800C76E: + ldrb r0, [r4, 0x7] + cmp r0, 0x1 + bne _0800C798 + strb r0, [r4, 0x6] + movs r0, 0x5 + strb r0, [r4, 0x4] + adds r0, r3, 0 + movs r1, 0x8C + bl __umodsi3 + strh r0, [r4, 0x1A] + movs r1, 0x8C + subs r1, r0 + strh r1, [r4, 0x1C] + lsls r0, 16 + cmp r0, 0 + beq _0800C794 + movs r0, 0x2 + b _0800C796 +_0800C794: + movs r0, 0x3 +_0800C796: + strb r0, [r4, 0x7] +_0800C798: + ldrb r0, [r4, 0x7] + cmp r0, 0x3 + bne _0800C7AE + movs r0, 0 + strb r0, [r4, 0x6] + movs r0, 0x28 + strh r0, [r4, 0x1A] + movs r0, 0x4 + strb r0, [r4, 0x7] + movs r0, 0x9 + strb r0, [r4, 0x4] +_0800C7AE: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_800C744 + + thumb_func_start sub_800C7B4 +sub_800C7B4: @ 800C7B4 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x4 + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + lsls r1, 16 + lsrs r6, r1, 16 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0xE] + adds r7, r0, 0 + cmp r1, 0 + bne _0800C7D2 + b _0800CC98 +_0800C7D2: + movs r0, 0 + strb r0, [r7, 0xE] + mov r0, r8 + subs r0, 0x10 + cmp r0, 0x2D + bls _0800C7E0 + b _0800CC8A +_0800C7E0: + lsls r0, 2 + ldr r1, =_0800C7F4 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800C7F4: + .4byte _0800C8AC + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800C8D8 + .4byte _0800C8C4 + .4byte _0800CC8A + .4byte _0800C8EC + .4byte _0800C8FC + .4byte _0800C920 + .4byte _0800C940 + .4byte _0800C960 + .4byte _0800C9D0 + .4byte _0800CA02 + .4byte _0800CA18 + .4byte _0800CA60 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CBD8 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CAD0 + .4byte _0800CB1C + .4byte _0800CB64 + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC8A + .4byte _0800CC78 +_0800C8AC: + cmp r6, 0 + beq _0800C8B2 + b _0800CC8A +_0800C8B2: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + movs r1, 0x4 + strb r1, [r0, 0x5] + b _0800CC8A + .pool +_0800C8C4: + cmp r6, 0 + beq _0800C8CA + b _0800CC8A +_0800C8CA: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + strb r6, [r0, 0x5] + b _0800CC8A + .pool +_0800C8D8: + cmp r6, 0 + beq _0800C8DE + b _0800CC8A +_0800C8DE: + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0x5] + strb r6, [r0, 0x4] + movs r0, 0 + b _0800CBF6 + .pool +_0800C8EC: + cmp r6, 0 + beq _0800C8F2 + b _0800CC8A +_0800C8F2: + ldr r1, =gUnknown_03004140 + movs r0, 0x6 + b _0800CA0C + .pool +_0800C8FC: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800C906 + b _0800CC8A +_0800C906: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C912 + b _0800CC8A +_0800C912: + movs r0, 0x7 + strb r0, [r1, 0x4] + movs r0, 0x8 + strb r0, [r1, 0x5] + b _0800CC8A + .pool +_0800C920: + cmp r6, 0 + beq _0800C926 + b _0800CC8A +_0800C926: + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x5] + strb r1, [r0, 0x4] + strb r6, [r0, 0x5] + ldrb r0, [r0, 0x7] + cmp r0, 0 + beq _0800C936 + b _0800CC8A +_0800C936: + movs r0, 0x13 + b _0800CBF6 + .pool +_0800C940: + cmp r6, 0 + beq _0800C946 + b _0800CC8A +_0800C946: + ldrb r0, [r7, 0xB] + cmp r0, 0x1 + bne _0800C956 + ldrh r0, [r7, 0x1A] + cmp r0, 0x1 + bls _0800C956 + subs r0, 0x1 + strh r0, [r7, 0x1A] +_0800C956: + ldr r1, =gUnknown_03004140 + movs r0, 0xA + b _0800CA0C + .pool +_0800C960: + cmp r6, 0 + bne _0800C9A6 + bl sub_800D294 + lsls r0, 24 + lsrs r0, 24 + mov r1, sp + strb r0, [r1] + ldr r4, =gUnknown_03004140 + strh r0, [r4, 0x14] + cmp r0, 0 + beq _0800C980 + movs r0, 0x20 + movs r1, 0x1 + bl sub_800D30C +_0800C980: + ldrb r0, [r4, 0xB] + cmp r0, 0 + beq _0800C9A6 + ldrh r0, [r4, 0x1A] + cmp r0, 0x1 + beq _0800C9A6 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0x4 + bne _0800C9A6 + bl rfu_REQ_endSearchParent + bl rfu_waitREQComplete + movs r0, 0x9 + strb r0, [r4, 0x4] + movs r0, 0x1 + strb r0, [r4, 0xB] +_0800C9A6: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800C9B0 + b _0800CC8A +_0800C9B0: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800C9BC + b _0800CC8A +_0800C9BC: + movs r0, 0xB + strb r0, [r1, 0x4] + movs r0, 0 + strb r0, [r1, 0x5] + b _0800CC8A + .pool +_0800C9D0: + cmp r6, 0 + beq _0800C9D6 + b _0800CC8A +_0800C9D6: + ldr r2, =gUnknown_03004140 + ldrb r0, [r2, 0x5] + strb r0, [r2, 0x4] + ldrb r1, [r2, 0x7] + cmp r1, 0 + bne _0800C9F4 + lsls r0, 24 + cmp r0, 0 + beq _0800C9EA + b _0800CC8A +_0800C9EA: + movs r0, 0x21 + b _0800CBF6 + .pool +_0800C9F4: + cmp r1, 0x7 + bne _0800C9FA + b _0800CC8A +_0800C9FA: + movs r0, 0x5 + strb r0, [r2, 0x4] + strb r0, [r2, 0x7] + b _0800CC8A +_0800CA02: + cmp r6, 0 + beq _0800CA08 + b _0800CC8A +_0800CA08: + ldr r1, =gUnknown_03004140 + movs r0, 0xD +_0800CA0C: + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] + b _0800CC8A + .pool +_0800CA18: + cmp r6, 0 + bne _0800CA3C + ldr r4, =gUnknown_03004140+0x10 + mov r0, sp + adds r1, r4, 0 + bl rfu_getConnectParentStatus + lsls r0, 16 + cmp r0, 0 + bne _0800CA3C + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CA3C + adds r1, r4, 0 + subs r1, 0x10 + movs r0, 0xE + strb r0, [r1, 0x4] +_0800CA3C: + ldr r1, =gUnknown_03004140 + ldrh r0, [r1, 0x1A] + cmp r0, 0 + bne _0800CA46 + b _0800CC8A +_0800CA46: + subs r0, 0x1 + strh r0, [r1, 0x1A] + lsls r0, 16 + cmp r0, 0 + beq _0800CA52 + b _0800CC8A +_0800CA52: + movs r0, 0xE + strb r0, [r1, 0x4] + b _0800CC8A + .pool +_0800CA60: + cmp r6, 0 + beq _0800CA66 + b _0800CC8A +_0800CA66: + ldr r4, =gUnknown_03004140+0x10 + mov r0, sp + adds r1, r4, 0 + bl rfu_getConnectParentStatus + lsls r0, 16 + cmp r0, 0 + beq _0800CA78 + b _0800CC8A +_0800CA78: + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CA9C + adds r1, r4, 0 + subs r1, 0x10 + movs r0, 0x13 + strb r0, [r1, 0x4] + movs r0, 0xF + strb r0, [r1, 0x5] + movs r0, 0x22 + strh r0, [r1, 0x1E] + ldrb r0, [r1, 0x10] + strh r0, [r1, 0x14] + b _0800CABC + .pool +_0800CA9C: + adds r1, r4, 0 + subs r1, 0x10 + strb r6, [r1, 0x5] + strb r6, [r1, 0x4] + movs r0, 0x23 + strh r0, [r1, 0x1E] + mov r0, sp + ldrb r0, [r0] + strh r0, [r1, 0x14] + ldrb r0, [r1, 0x7] + cmp r0, 0 + beq _0800CABC + movs r0, 0x3 + strb r0, [r1, 0x7] + movs r0, 0x9 + strb r0, [r1, 0x4] +_0800CABC: + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x1E] + movs r1, 0x1 + bl sub_800D30C + movs r0, 0 + strh r0, [r4, 0x1E] + b _0800CC8A + .pool +_0800CAD0: + cmp r6, 0 + beq _0800CAD6 + b _0800CC8A +_0800CAD6: + ldr r2, =gUnknown_03007890 + ldr r3, [r2] + ldrb r0, [r3, 0x3] + movs r1, 0 + strh r0, [r7, 0x14] + movs r0, 0x11 + strb r0, [r7, 0x5] + strb r0, [r7, 0x4] + strb r1, [r7, 0x10] + ldrb r0, [r3, 0x3] + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _0800CAF4 + b _0800CC8A +_0800CAF4: + adds r1, r7, 0 + movs r3, 0x1 +_0800CAF8: + ldrb r0, [r1, 0x10] + adds r0, 0x1 + strb r0, [r1, 0x10] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bls _0800CB08 + b _0800CC8A +_0800CB08: + ldr r0, [r2] + ldrb r0, [r0, 0x3] + ldrb r4, [r7, 0x10] + asrs r0, r4 + ands r0, r3 + cmp r0, 0 + beq _0800CAF8 + b _0800CC8A + .pool +_0800CB1C: + cmp r6, 0 + bne _0800CB3A + mov r0, sp + bl rfu_CHILD_getConnectRecoveryStatus + lsls r0, 16 + cmp r0, 0 + bne _0800CB3A + mov r0, sp + ldrb r0, [r0] + cmp r0, 0x1 + bhi _0800CB3A + ldr r1, =gUnknown_03004140 + movs r0, 0x12 + strb r0, [r1, 0x4] +_0800CB3A: + ldr r2, =gUnknown_03004140 + ldrb r0, [r2, 0x10] + lsls r0, 1 + adds r1, r2, 0 + adds r1, 0x34 + adds r1, r0, r1 + ldrh r0, [r1] + cmp r0, 0 + bne _0800CB4E + b _0800CC8A +_0800CB4E: + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + beq _0800CB5A + b _0800CC8A +_0800CB5A: + movs r0, 0x12 + strb r0, [r2, 0x4] + b _0800CC8A + .pool +_0800CB64: + cmp r6, 0 + beq _0800CB6A + b _0800CC8A +_0800CB6A: + mov r0, sp + bl rfu_CHILD_getConnectRecoveryStatus + lsls r0, 16 + cmp r0, 0 + beq _0800CB78 + b _0800CC8A +_0800CB78: + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CB94 + ldr r1, =gUnknown_03004140 + movs r0, 0x13 + strb r0, [r1, 0x4] + movs r0, 0x16 + strb r0, [r1, 0x5] + movs r0, 0x32 + strh r0, [r1, 0x1E] + b _0800CBA8 + .pool +_0800CB94: + ldr r4, =gUnknown_03004140 + strb r6, [r4, 0x5] + strb r6, [r4, 0x4] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x3] + bl sub_800D334 + movs r0, 0x33 + strh r0, [r4, 0x1E] +_0800CBA8: + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, r5, 0 + adds r1, 0x34 + adds r0, r1 + movs r1, 0 + movs r4, 0 + strh r4, [r0] + adds r0, r5, 0 + adds r0, 0x30 + strb r1, [r0] + strb r1, [r5, 0xA] + ldrb r0, [r5, 0x1E] + movs r1, 0x1 + bl sub_800D30C + strh r4, [r5, 0x1E] + b _0800CC8A + .pool +_0800CBD8: + cmp r6, 0 + bne _0800CC8A + ldr r5, =gUnknown_03004140 + ldrb r1, [r5, 0x5] + adds r0, r1, 0 + cmp r0, 0x16 + bne _0800CC04 + ldrb r0, [r5, 0x11] + strb r0, [r5, 0x4] + ldrb r0, [r5, 0x12] + strb r0, [r5, 0x5] + ldrb r0, [r5, 0x2] + movs r0, 0x1 + strb r0, [r5, 0x2] + movs r0, 0x41 +_0800CBF6: + movs r1, 0 + bl sub_800D30C + b _0800CC8A + .pool +_0800CC04: + cmp r0, 0xF + bne _0800CC8A + strb r1, [r5, 0x4] + ldrb r0, [r5, 0x2] + movs r4, 0x1 + strb r4, [r5, 0x2] + movs r0, 0x41 + movs r1, 0 + bl sub_800D30C + adds r1, r5, 0 + adds r1, 0x24 + ldrb r0, [r5, 0x10] + lsls r4, r0 + ldrb r0, [r1] + orrs r4, r0 + strb r4, [r1] + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, 0x4 + adds r0, r1 + ldrh r1, [r5, 0x26] + movs r7, 0 + strh r1, [r0] + ldrb r1, [r5, 0x10] + movs r0, 0x4 + bl rfu_clearSlot + mov r4, sp + ldrb r0, [r5, 0x10] + movs r1, 0xE + bl rfu_NI_CHILD_setSendGameName + strb r0, [r4] + lsls r0, 24 + cmp r0, 0 + beq _0800CC8A + strb r7, [r5, 0x5] + strb r7, [r5, 0x4] + bl sub_800D610 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x2] + ldrb r0, [r0, 0x3] + orrs r0, r1 + bl sub_800D334 + mov r0, sp + ldrb r0, [r0] + strh r0, [r5, 0x14] + movs r0, 0x25 + movs r1, 0x1 + bl sub_800D30C + b _0800CC8A + .pool +_0800CC78: + cmp r6, 0 + bne _0800CC8A + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0x5] + strb r6, [r0, 0x4] + movs r0, 0x42 + movs r1, 0 + bl sub_800D30C +_0800CC8A: + ldr r1, =gUnknown_03004140 + movs r0, 0x1 + strb r0, [r1, 0xE] + b _0800CCE6 + .pool +_0800CC98: + cmp r6, 0x3 + bne _0800CCE6 + ldrb r0, [r7, 0xF] + cmp r0, 0 + beq _0800CCE6 + mov r3, r8 + cmp r3, 0x24 + beq _0800CCB0 + cmp r3, 0x26 + beq _0800CCB0 + cmp r3, 0x27 + bne _0800CCE6 +_0800CCB0: + bl rfu_REQ_RFUStatus + bl rfu_waitREQComplete + mov r0, sp + bl rfu_getRFUStatus + mov r0, sp + ldrb r0, [r0] + cmp r0, 0 + bne _0800CCE6 + ldr r4, =gUnknown_03007890 + ldr r0, [r4] + ldrb r0, [r0] + cmp r0, 0 + bne _0800CCE6 + bl rfu_getSTWIRecvBuffer + ldr r1, [r4] + ldrb r1, [r1, 0x2] + strb r1, [r0, 0x4] + movs r1, 0x1 + strb r1, [r0, 0x5] + movs r0, 0x29 + bl sub_800C36C + movs r6, 0 +_0800CCE6: + mov r4, r8 + cmp r4, 0x26 + bne _0800CCEE + b _0800CE02 +_0800CCEE: + cmp r4, 0x26 + bgt _0800CD00 + cmp r4, 0x10 + bne _0800CCF8 + b _0800CE20 +_0800CCF8: + b _0800CE3E + .pool +_0800CD00: + mov r0, r8 + cmp r0, 0x30 + beq _0800CD0E + cmp r0, 0x3D + bne _0800CD0C + b _0800CE20 +_0800CD0C: + b _0800CE3E +_0800CD0E: + cmp r6, 0 + beq _0800CD14 + b _0800CE42 +_0800CD14: + bl rfu_getSTWIRecvBuffer + ldr r4, =gUnknown_03004140 + ldrb r0, [r0, 0x8] + strh r0, [r4, 0x14] + bl sub_800D358 + adds r2, r4, 0 + adds r2, 0x30 + ldrb r1, [r2] + cmp r1, 0 + beq _0800CD6A + ldrb r0, [r4, 0x14] + adds r3, r1, 0 + bics r3, r0 + adds r0, r3, 0 + strb r0, [r2] + movs r3, 0 + adds r7, r4, 0 + adds r1, r7, 0 + movs r5, 0x1 + adds r4, r1, 0 + adds r4, 0x34 + movs r2, 0 +_0800CD44: + ldrh r0, [r1, 0x14] + asrs r0, r3 + ands r0, r5 + cmp r0, 0 + beq _0800CD54 + lsls r0, r3, 1 + adds r0, r4 + strh r2, [r0] +_0800CD54: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800CD44 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x6] + cmp r0, 0 + bne _0800CD6A + strb r0, [r1, 0x5] + strb r0, [r1, 0x4] +_0800CD6A: + mov r3, sp + ldr r1, =gUnknown_03004140 + ldrb r2, [r1] + ldrb r0, [r1, 0x14] + ands r0, r2 + strb r0, [r3] + movs r3, 0 + adds r7, r1, 0 + ldr r2, =gUnknown_03007890 + mov r1, sp + movs r5, 0x1 + adds r4, r7, 0 +_0800CD82: + ldrb r0, [r1] + asrs r0, r3 + ands r0, r5 + cmp r0, 0 + beq _0800CD96 + ldrb r0, [r4, 0x1] + cmp r0, 0 + beq _0800CD96 + subs r0, 0x1 + strb r0, [r7, 0x1] +_0800CD96: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x3 + bls _0800CD82 + ldrb r1, [r7, 0x14] + ldrb r0, [r7] + bics r0, r1 + strb r0, [r7] + ldrb r1, [r7, 0x7] + cmp r1, 0 + beq _0800CDE0 + ldr r0, [r2] + ldrb r0, [r0] + cmp r0, 0xFF + bne _0800CDF2 + cmp r1, 0x8 + bne _0800CDCC + ldrh r0, [r7, 0x1C] + strh r0, [r7, 0x1A] + movs r0, 0x6 + strb r0, [r7, 0x7] + b _0800CDDE + .pool +_0800CDCC: + ldrb r0, [r7, 0x4] + subs r0, 0x6 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _0800CDE0 + movs r0, 0x1 + strb r0, [r7, 0x7] + movs r0, 0x5 +_0800CDDE: + strb r0, [r7, 0x4] +_0800CDE0: + ldr r0, [r2] + ldrb r0, [r0] + cmp r0, 0xFF + bne _0800CDF2 + ldrb r0, [r7, 0x4] + cmp r0, 0 + bne _0800CDF2 + movs r0, 0xFF + strb r0, [r7, 0x6] +_0800CDF2: + ldrb r0, [r7, 0xE] + cmp r0, 0 + bne _0800CE3E + movs r0, 0x40 + movs r1, 0x1 + bl sub_800D30C + b _0800CE3E +_0800CE02: + bl sub_800D20C + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0] + cmp r0, 0xFF + beq _0800CE3E + movs r0, 0x50 + movs r1, 0 + bl sub_800D30C + b _0800CE3E + .pool +_0800CE20: + cmp r6, 0 + bne _0800CE42 + ldr r0, =gUnknown_03004140 + strb r6, [r0, 0xD] + strb r6, [r0, 0x1] + strb r6, [r0] + movs r1, 0xFF + strb r1, [r0, 0x6] + bl sub_800D610 + mov r4, r8 + cmp r4, 0x3D + bne _0800CE3E + bl sub_800BFA0 +_0800CE3E: + cmp r6, 0 + beq _0800CE92 +_0800CE42: + ldr r7, =gUnknown_03004140 + mov r0, r8 + cmp r0, 0x1C + bne _0800CE74 + cmp r6, 0 + beq _0800CE74 + ldrb r0, [r7, 0x7] + cmp r0, 0x4 + bne _0800CE74 + ldr r2, =gUnknown_03007890 + ldr r1, [r2] + movs r0, 0x1 + strb r0, [r1] + ldr r1, [r2] + movs r0, 0xF + strb r0, [r1, 0x2] + bl sub_800D334 + bl rfu_waitREQComplete + b _0800CEA4 + .pool +_0800CE74: + movs r1, 0 + mov r3, r8 + strh r3, [r7, 0x14] + strh r6, [r7, 0x16] + ldrb r0, [r7, 0xE] + cmp r0, 0 + beq _0800CE86 + strb r1, [r7, 0x5] + strb r1, [r7, 0x4] +_0800CE86: + movs r0, 0xF0 + movs r1, 0x2 + bl sub_800D30C + bl sub_800D610 +_0800CE92: + mov r4, r8 + cmp r4, 0xFF + bne _0800CEA4 + movs r0, 0xF2 + movs r1, 0 + bl sub_800D30C + bl sub_800D610 +_0800CEA4: + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800C7B4 + + thumb_func_start sub_800CEB0 +sub_800CEB0: @ 800CEB0 + push {r4-r7,lr} + sub sp, 0x4 + lsls r0, 16 + lsrs r6, r0, 16 + ldr r4, =gUnknown_03004140 + ldrb r7, [r4, 0xE] + movs r0, 0 + strb r0, [r4, 0xE] + movs r0, 0x1 + strb r0, [r4, 0xF] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r5, [r0] + cmp r5, 0 + bne _0800CEEC + adds r0, r6, 0 + bl sub_800C36C + ldrb r0, [r4, 0x2] + cmp r0, 0x1 + beq _0800CF04 + bl sub_800D610 + strb r5, [r4, 0xF] + strb r7, [r4, 0xE] + b _0800CF28 + .pool +_0800CEEC: + mov r0, sp + bl rfu_UNI_PARENT_getDRAC_ACK + lsls r0, 16 + cmp r0, 0 + bne _0800CF04 + mov r1, sp + ldrb r0, [r4, 0x3] + ldrb r1, [r1] + orrs r0, r1 + ldrb r1, [r4, 0x3] + strb r0, [r4, 0x3] +_0800CF04: + ldr r4, =gUnknown_03004140 + ldr r1, [r4, 0x44] + cmp r1, 0 + beq _0800CF20 + adds r0, r6, 0 + bl _call_via_r1 + bl rfu_waitREQComplete + ldrb r0, [r4, 0x2] + cmp r0, 0x2 + bne _0800CF20 + bl sub_800D610 +_0800CF20: + ldr r1, =gUnknown_03004140 + movs r0, 0 + strb r0, [r1, 0xF] + strb r7, [r1, 0xE] +_0800CF28: + add sp, 0x4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800CEB0 + + thumb_func_start sub_800CF34 +sub_800CF34: @ 800CF34 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + subs r0, 0x5 + lsls r0, 24 + lsrs r0, 24 + adds r3, r1, 0 + cmp r0, 0x3 + bls _0800CF52 + b _0800D146 +_0800CF52: + ldr r0, =gUnknown_03007890 + ldr r2, [r0] + ldrb r1, [r2, 0x2] + ldrb r0, [r3, 0xC] + adds r4, r1, 0 + eors r4, r0 + ands r4, r1 + ldrb r0, [r2, 0x7] + bics r4, r0 + mov r8, r4 + strb r1, [r3, 0xC] + cmp r4, 0 + beq _0800CF7A + strh r4, [r3, 0x14] + movs r0, 0x10 + movs r1, 0x1 + str r3, [sp, 0x4] + bl sub_800D30C + ldr r3, [sp, 0x4] +_0800CF7A: + movs r0, 0 + str r0, [sp] + movs r6, 0 + adds r7, r3, 0 + movs r1, 0x24 + adds r1, r3 + mov r9, r1 +_0800CF88: + movs r0, 0x80 + lsls r0, 17 + lsls r0, r6 + lsrs r4, r0, 24 + movs r5, 0 + mov r0, r8 + ands r0, r4 + cmp r0, 0 + beq _0800CFDA + lsls r1, r6, 1 + adds r0, r7, 0 + adds r0, 0x28 + adds r1, r0 + ldrh r0, [r7, 0x26] + strh r0, [r1] + mov r2, r9 + ldrb r1, [r2] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r2] + adds r6, 0x1 + mov r10, r6 + b _0800D090 + .pool +_0800CFC0: + ldrb r1, [r7] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r7] + ldrb r0, [r7, 0x1] + adds r0, 0x1 + strb r0, [r7, 0x1] + ldr r0, [sp] + orrs r0, r4 + str r0, [sp] + movs r0, 0x1 + orrs r5, r0 + b _0800D024 +_0800CFDA: + mov r1, r9 + ldrb r0, [r1] + ands r0, r4 + adds r2, r6, 0x1 + mov r10, r2 + cmp r0, 0 + beq _0800D090 + ldr r0, =gUnknown_03007880 + lsls r1, r6, 2 + adds r1, r0 + ldr r1, [r1] + ldrh r0, [r1, 0x34] + cmp r0, 0x46 + bne _0800D040 + adds r0, r1, 0 + adds r0, 0x61 + ldrb r0, [r0] + cmp r0, 0x1 + bne _0800D058 + movs r5, 0x2 + ldr r3, [r3, 0x20] + ldrh r2, [r3] + ldr r0, =0x0000ffff + cmp r2, r0 + beq _0800D024 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + lsls r1, r6, 5 + adds r0, r1 + ldrh r0, [r0, 0x18] + ldr r1, =0x0000ffff +_0800D018: + cmp r0, r2 + beq _0800CFC0 + adds r3, 0x2 + ldrh r2, [r3] + cmp r2, r1 + bne _0800D018 +_0800D024: + movs r0, 0x1 + ands r0, r5 + cmp r0, 0 + bne _0800D058 + movs r0, 0x4 + orrs r5, r0 + b _0800D058 + .pool +_0800D040: + lsls r1, r6, 1 + adds r0, r3, 0 + adds r0, 0x28 + adds r1, r0 + ldrh r0, [r1] + subs r0, 0x1 + strh r0, [r1] + ldr r1, =0x0000ffff + ands r0, r1 + cmp r0, 0 + bne _0800D058 + movs r5, 0x6 +_0800D058: + movs r0, 0x2 + ands r0, r5 + cmp r0, 0 + beq _0800D07E + mov r2, r9 + ldrb r0, [r2] + bics r0, r4 + movs r2, 0 + mov r1, r9 + strb r0, [r1] + lsls r0, r6, 1 + adds r1, r7, 0 + adds r1, 0x28 + adds r0, r1 + strh r2, [r0] + movs r0, 0x8 + adds r1, r6, 0 + bl rfu_clearSlot +_0800D07E: + movs r0, 0x4 + ands r5, r0 + ldr r3, =gUnknown_03004140 + cmp r5, 0 + beq _0800D090 + ldrb r1, [r7, 0xD] + adds r0, r4, 0 + orrs r0, r1 + strb r0, [r7, 0xD] +_0800D090: + mov r2, r10 + lsls r0, r2, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bhi _0800D09C + b _0800CF88 +_0800D09C: + ldr r4, [sp] + cmp r4, 0 + beq _0800D0AE + ldr r0, =gUnknown_03004140 + strh r4, [r0, 0x14] + movs r0, 0x11 + movs r1, 0x1 + bl sub_800D30C +_0800D0AE: + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0xD] + cmp r0, 0 + beq _0800D0EA + movs r5, 0x1 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x6] + cmp r0, 0 + beq _0800D0CE + ldrb r0, [r1, 0x3] + ldrb r1, [r1] + ands r0, r1 + cmp r0, r1 + beq _0800D0CE + movs r5, 0 +_0800D0CE: + cmp r5, 0 + beq _0800D0EA + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0xD] + bl sub_800D334 + ldrb r0, [r4, 0xD] + movs r1, 0 + strh r0, [r4, 0x14] + strb r1, [r4, 0xD] + movs r0, 0x12 + movs r1, 0x1 + bl sub_800D30C +_0800D0EA: + ldr r0, =gUnknown_03004140 + adds r1, r0, 0 + adds r1, 0x24 + ldrb r1, [r1] + adds r3, r0, 0 + cmp r1, 0 + bne _0800D146 + ldrb r0, [r3, 0x4] + cmp r0, 0x8 + bne _0800D146 + ldrb r0, [r3, 0x7] + cmp r0, 0 + bne _0800D120 + strb r0, [r3, 0x5] + strb r0, [r3, 0x4] + movs r0, 0x14 + movs r1, 0 + bl sub_800D30C + b _0800D146 + .pool +_0800D120: + cmp r0, 0x2 + bne _0800D12C + movs r0, 0x3 + strb r0, [r3, 0x7] + movs r0, 0x9 + b _0800D132 +_0800D12C: + movs r0, 0x1 + strb r0, [r3, 0x7] + movs r0, 0x5 +_0800D132: + strb r0, [r3, 0x4] + ldrb r0, [r3] + cmp r0, 0 + beq _0800D146 + movs r0, 0 + strh r0, [r3, 0x1A] + movs r0, 0x8 + strb r0, [r3, 0x7] + movs r0, 0x5 + strb r0, [r3, 0x4] +_0800D146: + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800CF34 + + thumb_func_start sub_800D158 +sub_800D158: @ 800D158 + push {r4-r6,lr} + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r6, r0, 0 + movs r0, 0 + strh r0, [r1] + ldr r4, =gUnknown_03004140 + ldrb r0, [r4, 0x4] + cmp r0, 0xF + bne _0800D1BC + ldrb r1, [r4, 0x10] + lsls r1, 1 + adds r5, r4, 0 + adds r5, 0x28 + adds r1, r5 + ldrh r0, [r1] + subs r0, 0x1 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + beq _0800D192 + ldr r1, =gUnknown_03007880 + ldrb r0, [r4, 0x10] + lsls r0, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0x27 + bne _0800D1BC +_0800D192: + bl sub_800D630 + movs r0, 0x18 + strb r0, [r4, 0x4] + ldrb r1, [r4, 0x10] + movs r0, 0x4 + bl rfu_clearSlot + adds r2, r4, 0 + adds r2, 0x24 + movs r1, 0x1 + ldrb r0, [r4, 0x10] + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r4, 0x10] + lsls r0, 1 + adds r0, r5 + movs r1, 0 + strh r1, [r0] +_0800D1BC: + ldr r0, =0x04000208 + strh r6, [r0] + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x4] + cmp r0, 0x18 + bne _0800D1F6 + ldrb r0, [r5, 0x2] + cmp r0, 0x1 + bne _0800D1D2 + bl sub_800D630 +_0800D1D2: + ldrb r0, [r5, 0x2] + adds r4, r0, 0 + cmp r4, 0 + bne _0800D1F6 + strb r4, [r5, 0x5] + strb r4, [r5, 0x4] + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x2] + ldrb r0, [r0, 0x3] + orrs r0, r1 + bl sub_800D334 + strh r4, [r5, 0x14] + movs r0, 0x25 + movs r1, 0x1 + bl sub_800D30C +_0800D1F6: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D158 + + thumb_func_start sub_800D20C +sub_800D20C: @ 800D20C + push {r4,r5,lr} + ldr r5, =gUnknown_03004140 + ldrb r0, [r5, 0x4] + cmp r0, 0xF + bne _0800D258 + ldr r1, =gUnknown_03007880 + ldrb r2, [r5, 0x10] + lsls r0, r2, 2 + adds r0, r1 + ldr r0, [r0] + ldrh r0, [r0] + cmp r0, 0x26 + bne _0800D258 + movs r4, 0 + strb r4, [r5, 0x5] + strb r4, [r5, 0x4] + movs r0, 0x4 + adds r1, r2, 0 + bl rfu_clearSlot + adds r2, r5, 0 + adds r2, 0x24 + movs r1, 0x1 + ldrb r0, [r5, 0x10] + lsls r1, r0 + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldrb r0, [r5, 0x10] + lsls r0, 1 + adds r1, r5, 0 + adds r1, 0x28 + adds r0, r1 + strh r4, [r0] + movs r0, 0x24 + movs r1, 0 + bl sub_800D30C +_0800D258: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D20C + + thumb_func_start sub_800D268 +sub_800D268: @ 800D268 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x6] + cmp r0, 0 + bne _0800D28C + ldrb r0, [r1, 0xA] + cmp r0, 0x1 + bne _0800D28C + ldrb r0, [r1, 0x4] + strb r0, [r1, 0x11] + ldrb r0, [r1, 0x5] + strb r0, [r1, 0x12] + movs r0, 0x10 + strb r0, [r1, 0x4] + movs r0, 0x11 + strb r0, [r1, 0x5] + movs r0, 0x2 + strb r0, [r1, 0xA] +_0800D28C: + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D268 + + thumb_func_start sub_800D294 +sub_800D294: @ 800D294 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + movs r6, 0 + movs r5, 0 + ldr r1, =gUnknown_03007890 + ldr r0, [r1] + ldrb r0, [r0, 0x8] + cmp r6, r0 + bcs _0800D2F0 + mov r8, r0 + ldr r0, =gUnknown_03004140 + mov r10, r0 + mov r9, r1 +_0800D2B4: + mov r1, r10 + ldr r3, [r1, 0x20] + ldrh r2, [r3] + adds r0, r5, 0x1 + mov r12, r0 + ldr r1, =0x0000ffff + cmp r2, r1 + beq _0800D2E6 + mov r1, r9 + ldr r0, [r1] + lsls r1, r5, 5 + adds r0, r1 + ldrh r4, [r0, 0x18] + ldr r7, =0x0000ffff + movs r1, 0x1 + lsls r1, r5 +_0800D2D4: + cmp r4, r2 + bne _0800D2DE + orrs r6, r1 + lsls r0, r6, 24 + lsrs r6, r0, 24 +_0800D2DE: + adds r3, 0x2 + ldrh r2, [r3] + cmp r2, r7 + bne _0800D2D4 +_0800D2E6: + mov r1, r12 + lsls r0, r1, 24 + lsrs r5, r0, 24 + cmp r5, r8 + bcc _0800D2B4 +_0800D2F0: + adds r0, r6, 0 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D294 + + thumb_func_start sub_800D30C +sub_800D30C: @ 800D30C + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r4, =gUnknown_03004140 + ldr r2, [r4, 0x40] + cmp r2, 0 + beq _0800D322 + bl _call_via_r2 +_0800D322: + movs r0, 0 + strh r0, [r4, 0x16] + strh r0, [r4, 0x14] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D30C + + thumb_func_start sub_800D334 +sub_800D334: @ 800D334 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r4, =gUnknown_03004140 + ldrb r5, [r4, 0xE] + movs r1, 0x1 + strb r1, [r4, 0xE] + bl rfu_REQ_disconnect + bl rfu_waitREQComplete + strb r5, [r4, 0xE] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D334 + + thumb_func_start sub_800D358 +sub_800D358: @ 800D358 + push {r4-r7,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x4] + cmp r0, 0 + beq _0800D3A0 + movs r4, 0 +_0800D36A: + ldr r1, =gUnknown_03007880 + lsls r0, r4, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2] + movs r3, 0x80 + lsls r3, 8 + adds r1, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D396 + ldrb r1, [r2, 0x1A] + adds r0, r5, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D396 + adds r2, r1, 0 + bics r2, r5 + movs r0, 0x20 + adds r1, r4, 0 + bl rfu_changeSendTarget +_0800D396: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D36A +_0800D3A0: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x5] + cmp r0, 0 + beq _0800D3DE + movs r4, 0 +_0800D3AC: + ldr r1, =gUnknown_03007880 + lsls r0, r4, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2, 0x34] + movs r3, 0x80 + lsls r3, 8 + adds r1, r3, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D3D4 + adds r0, r2, 0 + adds r0, 0x4E + ldrb r0, [r0] + ands r0, r5 + cmp r0, 0 + beq _0800D3D4 + adds r0, r4, 0 + bl rfu_NI_stopReceivingData +_0800D3D4: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D3AC +_0800D3DE: + ldr r0, =gUnknown_03007890 + ldr r3, [r0] + ldrb r2, [r3, 0x6] + cmp r2, 0 + beq _0800D41C + mvns r1, r5 + adds r0, r1, 0 + ands r0, r2 + strb r0, [r3, 0x6] + movs r4, 0 + ldr r7, =gUnknown_03007870 + ldr r6, =0x00008024 +_0800D3F6: + lsls r0, r4, 2 + adds r0, r7 + ldr r2, [r0] + ldrh r0, [r2] + cmp r0, r6 + bne _0800D412 + ldrb r3, [r2, 0x3] + adds r0, r5, 0 + ands r0, r3 + cmp r0, 0 + beq _0800D412 + adds r0, r1, 0 + ands r0, r3 + strb r0, [r2, 0x3] +_0800D412: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D3F6 +_0800D41C: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D358 + + thumb_func_start sub_800D434 +sub_800D434: @ 800D434 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + ldr r0, =gUnknown_03004140 + ldrh r0, [r0, 0x18] + cmp r0, 0 + beq _0800D510 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x4] + cmp r0, 0 + beq _0800D4D4 + movs r6, 0 +_0800D454: + ldr r3, =gUnknown_03007880 + lsls r2, r6, 2 + adds r0, r2, r3 + ldr r0, [r0] + ldrh r1, [r0] + movs r4, 0x80 + lsls r4, 8 + adds r0, r4, 0 + ands r1, r0 + adds r7, r2, 0 + adds r0, r6, 0x1 + mov r9, r0 + cmp r1, 0 + beq _0800D4CA + movs r5, 0 + movs r4, 0 + movs r1, 0x1 + mov r8, r1 + mov r10, r3 +_0800D47A: + adds r0, r7, r3 + ldr r0, [r0] + ldrb r0, [r0, 0x1A] + asrs r0, r4 + mov r1, r8 + ands r0, r1 + cmp r0, 0 + beq _0800D4A4 + lsls r0, r4, 2 + adds r0, r3 + ldr r0, [r0] + ldr r1, =gUnknown_03004140 + ldrh r0, [r0, 0x2] + ldrh r1, [r1, 0x18] + cmp r0, r1 + bls _0800D4A4 + mov r0, r8 + lsls r0, r4 + orrs r5, r0 + lsls r0, r5, 24 + lsrs r5, r0, 24 +_0800D4A4: + cmp r5, 0 + beq _0800D4C0 + mov r1, r10 + adds r0, r7, r1 + ldr r0, [r0] + ldrb r0, [r0, 0x1A] + adds r2, r5, 0 + eors r2, r0 + movs r0, 0x20 + adds r1, r6, 0 + str r3, [sp] + bl rfu_changeSendTarget + ldr r3, [sp] +_0800D4C0: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _0800D47A +_0800D4CA: + mov r3, r9 + lsls r0, r3, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bls _0800D454 +_0800D4D4: + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r0, [r0, 0x5] + cmp r0, 0 + beq _0800D510 + movs r6, 0 +_0800D4E0: + ldr r1, =gUnknown_03007880 + lsls r0, r6, 2 + adds r0, r1 + ldr r2, [r0] + ldrh r0, [r2, 0x34] + movs r4, 0x80 + lsls r4, 8 + adds r1, r4, 0 + ands r0, r1 + cmp r0, 0 + beq _0800D506 + ldr r1, =gUnknown_03004140 + ldrh r0, [r2, 0x36] + ldrh r1, [r1, 0x18] + cmp r0, r1 + bls _0800D506 + adds r0, r6, 0 + bl rfu_NI_stopReceivingData +_0800D506: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bls _0800D4E0 +_0800D510: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D434 + + thumb_func_start sub_800D52C +sub_800D52C: @ 800D52C + push {lr} + ldr r1, =gUnknown_03004140 + str r0, [r1, 0x44] + ldr r0, =sub_800CEB0 + bl rfu_setMSCCallback + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D52C + + thumb_func_start sub_800D544 +sub_800D544: @ 800D544 + ldr r1, =gUnknown_03004140 + str r0, [r1, 0x40] + bx lr + .pool + thumb_func_end sub_800D544 + + thumb_func_start sub_800D550 +sub_800D550: @ 800D550 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 16 + lsrs r5, r1, 16 + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x9] + adds r3, r0, 0 + cmp r1, 0 + beq _0800D578 + cmp r4, 0 + bne _0800D578 + adds r0, 0x30 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D578 + movs r0, 0x5 + b _0800D588 + .pool +_0800D578: + ldr r2, =0x04000208 + ldrh r1, [r2] + movs r0, 0 + strh r0, [r2] + strb r4, [r3, 0x9] + strh r5, [r3, 0x32] + strh r1, [r2] + movs r0, 0 +_0800D588: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D550 + + thumb_func_start sub_800D594 +sub_800D594: @ 800D594 + push {lr} + lsls r0, 16 + lsrs r2, r0, 16 + ldr r0, =gUnknown_03007890 + ldr r0, [r0] + ldrb r1, [r0, 0x4] + ldrb r0, [r0, 0x5] + orrs r0, r1 + cmp r0, 0 + bne _0800D5B8 + ldr r0, =gUnknown_03004140 + strh r2, [r0, 0x18] + movs r0, 0 + b _0800D5C8 + .pool +_0800D5B8: + ldr r1, =gUnknown_03004140 + movs r0, 0x6 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x6 +_0800D5C8: + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D594 + + thumb_func_start sub_800D5D0 +sub_800D5D0: @ 800D5D0 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + adds r3, r2, 0 + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x4] + subs r0, 0x9 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bhi _0800D5FC + movs r0, 0x7 + strh r0, [r1, 0x14] + movs r0, 0xF3 + movs r1, 0x1 + bl sub_800D30C + movs r0, 0x7 + b _0800D60A + .pool +_0800D5FC: + cmp r2, 0 + beq _0800D606 + movs r0, 0x1 + strb r0, [r1, 0xB] + b _0800D608 +_0800D606: + strb r3, [r1, 0xB] +_0800D608: + movs r0, 0 +_0800D60A: + pop {r1} + bx r1 + thumb_func_end sub_800D5D0 + + thumb_func_start sub_800D610 +sub_800D610: @ 800D610 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x2] + cmp r0, 0 + beq _0800D628 + ldrb r0, [r1, 0x2] + movs r0, 0 + strb r0, [r1, 0x2] + movs r0, 0x45 + movs r1, 0 + bl sub_800D30C +_0800D628: + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D610 + + thumb_func_start sub_800D630 +sub_800D630: @ 800D630 + push {lr} + ldr r1, =gUnknown_03004140 + ldrb r0, [r1, 0x2] + cmp r0, 0 + bne _0800D648 + movs r0, 0x45 + movs r1, 0 + bl sub_800D30C + b _0800D654 + .pool +_0800D648: + ldrb r0, [r1, 0x2] + cmp r0, 0x1 + bne _0800D654 + ldrb r0, [r1, 0x2] + movs r0, 0x2 + strb r0, [r1, 0x2] +_0800D654: + pop {r0} + bx r0 + thumb_func_end sub_800D630 + + thumb_func_start sub_800D658 +sub_800D658: @ 800D658 + push {lr} + ldr r0, =gUnknown_03004140 + ldrb r1, [r0, 0x7] + adds r2, r0, 0 + cmp r1, 0 + beq _0800D6C2 + ldrb r0, [r2, 0x4] + subs r0, 0x5 + cmp r0, 0x6 + bhi _0800D6C2 + lsls r0, 2 + ldr r1, =_0800D680 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0800D680: + .4byte _0800D69C + .4byte _0800D6A4 + .4byte _0800D6AE + .4byte _0800D6AE + .4byte _0800D6B4 + .4byte _0800D6B4 + .4byte _0800D6BA +_0800D69C: + movs r0, 0x3 + strb r0, [r2, 0x7] + movs r0, 0x9 + b _0800D6C0 +_0800D6A4: + movs r0, 0x2 + strb r0, [r2, 0x7] + movs r0, 0x1 + strh r0, [r2, 0x1A] + b _0800D6C2 +_0800D6AE: + movs r0, 0x2 + strb r0, [r2, 0x7] + b _0800D6C2 +_0800D6B4: + movs r0, 0x28 + strh r0, [r2, 0x1A] + b _0800D6C2 +_0800D6BA: + movs r0, 0x28 + strh r0, [r2, 0x1A] + movs r0, 0xA +_0800D6C0: + strb r0, [r2, 0x4] +_0800D6C2: + pop {r0} + bx r0 + thumb_func_end sub_800D658 + + thumb_func_start sub_800D6C8 +sub_800D6C8: @ 800D6C8 + push {r4,r5,lr} + adds r3, r0, 0 + movs r0, 0 + movs r4, 0 + movs r5, 0x46 +_0800D6D2: + adds r2, r0, 0x1 + movs r1, 0x45 + muls r0, r5 + adds r0, r3 + adds r0, 0x45 +_0800D6DC: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D6DC + adds r0, r2, 0 + cmp r0, 0x1F + ble _0800D6D2 + movs r1, 0 + ldr r2, =0x000008c1 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x8C + lsls r2, 4 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x000008c2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x000008c3 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D6C8 + + thumb_func_start sub_800D724 +sub_800D724: @ 800D724 + push {r4,lr} + adds r3, r0, 0 + movs r1, 0 + movs r4, 0 +_0800D72C: + lsls r0, r1, 3 + adds r2, r1, 0x1 + subs r0, r1 + movs r1, 0xD + lsls r0, 1 + adds r0, r3 + adds r0, 0xD +_0800D73A: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D73A + adds r1, r2, 0 + cmp r1, 0x27 + ble _0800D72C + movs r1, 0 + ldr r2, =0x00000231 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x8C + lsls r2, 2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000232 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000233 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D724 + + thumb_func_start sub_800D780 +sub_800D780: @ 800D780 + push {r4,lr} + adds r3, r0, 0 + movs r1, 0 + movs r4, 0 +_0800D788: + lsls r0, r1, 8 + adds r2, r1, 0x1 + movs r1, 0xFF + adds r0, r3 + adds r0, 0xFF +_0800D792: + strb r4, [r0] + subs r0, 0x1 + subs r1, 0x1 + cmp r1, 0 + bge _0800D792 + adds r1, r2, 0 + cmp r1, 0x1 + ble _0800D788 + movs r1, 0 + ldr r2, =0x00000201 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + movs r2, 0x80 + lsls r2, 2 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000202 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + ldr r2, =0x00000203 + adds r0, r3, r2 + ldrb r2, [r0] + strb r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D780 + + thumb_func_start sub_800D7D8 +sub_800D7D8: @ 800D7D8 + push {r4-r7,lr} + adds r3, r0, 0 + adds r4, r1, 0 + ldr r1, =0x000008c2 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0x1F + bhi _0800D874 + ldr r0, =0x04000208 + ldrh r1, [r0] + adds r7, r1, 0 + movs r1, 0 + strh r1, [r0] + movs r5, 0 + movs r2, 0 +_0800D7F6: + adds r1, r4, r2 + ldrb r0, [r1] + cmp r0, 0 + bne _0800D80A + ldrb r0, [r1, 0x1] + cmp r0, 0 + bne _0800D80A + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_0800D80A: + adds r2, 0xE + cmp r2, 0x45 + ble _0800D7F6 + cmp r5, 0x5 + beq _0800D866 + movs r2, 0 + movs r0, 0x8C + lsls r0, 4 + adds r5, r3, r0 + movs r6, 0x46 +_0800D81E: + ldrb r0, [r5] + adds r1, r0, 0 + muls r1, r6 + adds r1, r2, r1 + adds r1, r3, r1 + adds r0, r4, r2 + ldrb r0, [r0] + strb r0, [r1] + adds r2, 0x1 + cmp r2, 0x45 + ble _0800D81E + movs r0, 0x8C + lsls r0, 4 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1F + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x000008c2 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r1, 0 + adds r0, r4, 0 + adds r0, 0x45 +_0800D85E: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r4 + bge _0800D85E +_0800D866: + ldr r0, =0x04000208 + strh r7, [r0] + b _0800D87E + .pool +_0800D874: + ldr r1, =0x000008c3 + adds r0, r3, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800D87E: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D7D8 + + thumb_func_start sub_800D888 +sub_800D888: @ 800D888 + push {r4-r7,lr} + adds r6, r0, 0 + adds r5, r1, 0 + ldr r1, =0x00000232 + adds r0, r6, r1 + ldrb r0, [r0] + cmp r0, 0x27 + bhi _0800D920 + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r7, r0, 0 + movs r0, 0 + strh r0, [r1] + movs r2, 0 + ldrb r0, [r5] + cmp r0, 0 + bne _0800D8B8 +_0800D8AA: + adds r2, 0x1 + cmp r2, 0xD + bgt _0800D8B8 + adds r0, r5, r2 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D8AA +_0800D8B8: + cmp r2, 0xE + beq _0800D910 + movs r2, 0 + movs r0, 0x8C + lsls r0, 2 + adds r3, r6, r0 +_0800D8C4: + ldrb r1, [r3] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r2, r0 + adds r0, r6, r0 + adds r1, r5, r2 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xD + ble _0800D8C4 + movs r1, 0x8C + lsls r1, 2 + adds r4, r6, r1 + ldrb r0, [r4] + adds r0, 0x1 + ldrb r1, [r4] + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0x28 + bl __umodsi3 + ldrb r1, [r4] + strb r0, [r4] + ldr r0, =0x00000232 + adds r1, r6, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r1, 0 + adds r0, r5, 0 + adds r0, 0xD +_0800D908: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r5 + bge _0800D908 +_0800D910: + ldr r0, =0x04000208 + strh r7, [r0] + b _0800D92A + .pool +_0800D920: + ldr r1, =0x00000233 + adds r0, r6, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800D92A: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800D888 + + thumb_func_start sub_800D934 +sub_800D934: @ 800D934 + push {r4-r7,lr} + adds r3, r0, 0 + adds r4, r1, 0 + ldr r1, =0x04000208 + ldrh r0, [r1] + mov r12, r0 + movs r0, 0 + strh r0, [r1] + movs r1, 0x8C + lsls r1, 4 + adds r0, r3, r1 + ldr r7, =0x000008c1 + adds r5, r3, r7 + ldrb r1, [r0] + ldrb r0, [r5] + cmp r1, r0 + beq _0800D960 + ldr r1, =0x000008c3 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0800D984 +_0800D960: + movs r1, 0 + adds r0, r4, 0 + adds r0, 0x45 +_0800D966: + strb r1, [r0] + subs r0, 0x1 + cmp r0, r4 + bge _0800D966 + ldr r0, =0x04000208 + mov r7, r12 + strh r7, [r0] + movs r0, 0 + b _0800D9CA + .pool +_0800D984: + movs r2, 0 + movs r6, 0x46 +_0800D988: + adds r1, r4, r2 + ldrb r0, [r5] + adds r7, r0, 0 + muls r7, r6 + adds r0, r7, 0 + adds r0, r2, r0 + adds r0, r3, r0 + ldrb r0, [r0] + strb r0, [r1] + adds r2, 0x1 + cmp r2, 0x45 + ble _0800D988 + ldr r0, =0x000008c1 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1F + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r7, =0x000008c2 + adds r1, r3, r7 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x04000208 + mov r1, r12 + strh r1, [r0] + movs r0, 0x1 +_0800D9CA: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D934 + + thumb_func_start sub_800D9DC +sub_800D9DC: @ 800D9DC + push {r4-r7,lr} + adds r5, r0, 0 + adds r6, r1, 0 + movs r1, 0x8C + lsls r1, 2 + adds r0, r5, r1 + adds r1, 0x1 + adds r4, r5, r1 + ldrb r1, [r0] + ldrb r0, [r4] + cmp r1, r0 + beq _0800DA00 + ldr r1, =0x00000233 + adds r0, r5, r1 + ldrb r0, [r0] + adds r2, r0, 0 + cmp r2, 0 + beq _0800DA08 +_0800DA00: + movs r0, 0 + b _0800DA54 + .pool +_0800DA08: + ldr r1, =0x04000208 + ldrh r0, [r1] + adds r7, r0, 0 + strh r2, [r1] + movs r3, 0 +_0800DA12: + adds r2, r6, r3 + ldrb r1, [r4] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r3, r0 + adds r0, r5, r0 + ldrb r0, [r0] + strb r0, [r2] + adds r3, 0x1 + cmp r3, 0xD + ble _0800DA12 + ldr r0, =0x00000231 + adds r4, r5, r0 + ldrb r0, [r4] + adds r0, 0x1 + ldrb r1, [r4] + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0x28 + bl __umodsi3 + ldrb r1, [r4] + strb r0, [r4] + ldr r0, =0x00000232 + adds r1, r5, r0 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x04000208 + strh r7, [r0] + movs r0, 0x1 +_0800DA54: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800D9DC + + thumb_func_start sub_800DA68 +sub_800DA68: @ 800DA68 + push {r4,lr} + adds r2, r0, 0 + adds r4, r1, 0 + ldrb r0, [r4, 0x1] + cmp r0, 0 + bne _0800DA7E + adds r0, r2, 0 + movs r1, 0 + bl sub_800DAC8 + b _0800DAC0 +_0800DA7E: + movs r3, 0 +_0800DA80: + ldrb r1, [r2, 0x1C] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r3, r0 + adds r0, r2, r0 + adds r1, r4, r3 + ldrb r1, [r1] + strb r1, [r0] + adds r3, 0x1 + cmp r3, 0xD + ble _0800DA80 + ldrb r0, [r2, 0x1C] + adds r0, 0x1 + ldrb r1, [r2, 0x1C] + strb r0, [r2, 0x1C] + ldrb r1, [r2, 0x1C] + movs r0, 0x1 + ands r0, r1 + ldrb r1, [r2, 0x1C] + strb r0, [r2, 0x1C] + ldrb r0, [r2, 0x1E] + cmp r0, 0x1 + bhi _0800DABA + ldrb r0, [r2, 0x1E] + adds r0, 0x1 + ldrb r1, [r2, 0x1E] + strb r0, [r2, 0x1E] + b _0800DAC0 +_0800DABA: + ldrb r0, [r2, 0x1C] + ldrb r1, [r2, 0x1D] + strb r0, [r2, 0x1D] +_0800DAC0: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_800DA68 + + thumb_func_start sub_800DAC8 +sub_800DAC8: @ 800DAC8 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + ldrb r0, [r3, 0x1E] + cmp r0, 0 + bne _0800DAD8 + movs r0, 0 + b _0800DB12 +_0800DAD8: + cmp r5, 0 + beq _0800DAF6 + movs r4, 0 +_0800DADE: + adds r2, r5, r4 + ldrb r1, [r3, 0x1D] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 1 + adds r0, r4, r0 + adds r0, r3, r0 + ldrb r0, [r0] + strb r0, [r2] + adds r4, 0x1 + cmp r4, 0xD + ble _0800DADE +_0800DAF6: + ldrb r0, [r3, 0x1D] + adds r0, 0x1 + ldrb r1, [r3, 0x1D] + strb r0, [r3, 0x1D] + ldrb r1, [r3, 0x1D] + movs r0, 0x1 + ands r0, r1 + ldrb r1, [r3, 0x1D] + strb r0, [r3, 0x1D] + ldrb r0, [r3, 0x1E] + subs r0, 0x1 + ldrb r1, [r3, 0x1E] + strb r0, [r3, 0x1E] + movs r0, 0x1 +_0800DB12: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_800DAC8 + + thumb_func_start sub_800DB18 +sub_800DB18: @ 800DB18 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + ldr r1, =0x00000202 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0x1 + bhi _0800DB70 + movs r2, 0 + movs r0, 0x80 + lsls r0, 2 + adds r4, r3, r0 +_0800DB30: + ldrb r0, [r4] + lsls r0, 8 + adds r0, r2, r0 + adds r0, r3, r0 + adds r1, r5, r2 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xFF + ble _0800DB30 + movs r0, 0x80 + lsls r0, 2 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1 + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x00000202 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + b _0800DB7A + .pool +_0800DB70: + ldr r1, =0x00000203 + adds r0, r3, r1 + ldrb r1, [r0] + movs r1, 0x1 + strb r1, [r0] +_0800DB7A: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DB18 + + thumb_func_start sub_800DB84 +sub_800DB84: @ 800DB84 + push {r4,r5,lr} + adds r3, r0, 0 + adds r5, r1, 0 + movs r1, 0x80 + lsls r1, 2 + adds r0, r3, r1 + adds r1, 0x1 + adds r4, r3, r1 + ldrb r1, [r0] + ldrb r0, [r4] + cmp r1, r0 + beq _0800DBA6 + ldr r1, =0x00000203 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _0800DBB0 +_0800DBA6: + movs r0, 0 + b _0800DBEA + .pool +_0800DBB0: + movs r2, 0 +_0800DBB2: + adds r0, r5, r2 + ldrb r1, [r4] + lsls r1, 8 + adds r1, r2, r1 + adds r1, r3, r1 + ldrb r1, [r1] + strb r1, [r0] + adds r2, 0x1 + cmp r2, 0xFF + ble _0800DBB2 + ldr r0, =0x00000201 + adds r1, r3, r0 + ldrb r0, [r1] + adds r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + ldrb r2, [r1] + movs r0, 0x1 + ands r0, r2 + ldrb r2, [r1] + strb r0, [r1] + ldr r0, =0x00000202 + adds r1, r3, r0 + ldrb r0, [r1] + subs r0, 0x1 + ldrb r2, [r1] + strb r0, [r1] + movs r0, 0x1 +_0800DBEA: + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_800DB84 + + thumb_func_start sub_800DBF8 +sub_800DBF8: @ 800DBF8 + push {r4-r7,lr} + adds r6, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r1, 0 + movs r5, 0 + cmp r1, 0x1 + beq _0800DC36 + cmp r1, 0x1 + bgt _0800DC12 + cmp r1, 0 + beq _0800DC1C + b _0800DCAA +_0800DC12: + cmp r0, 0x2 + beq _0800DC56 + cmp r0, 0x3 + beq _0800DC76 + b _0800DCAA +_0800DC1C: + movs r4, 0 +_0800DC1E: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r1, [r0] + lsls r0, r5, 16 + asrs r0, 16 + adds r0, r1 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, r1, 0 + cmp r4, 0xC7 + ble _0800DC1E + b _0800DC70 +_0800DC36: + movs r4, 0 + adds r2, r6, 0 + adds r2, 0xC8 +_0800DC3C: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r1, [r0] + lsls r0, r5, 16 + asrs r0, 16 + adds r0, r1 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, r1, 0 + cmp r4, 0x63 + ble _0800DC3C + strh r5, [r2] + b _0800DCAA +_0800DC56: + movs r4, 0 +_0800DC58: + bl Random + lsls r0, 24 + lsrs r0, 24 + adds r1, r6, r4 + strb r0, [r1] + adds r0, r5, r0 + lsls r0, 16 + lsrs r5, r0, 16 + adds r4, 0x1 + cmp r4, 0xC7 + ble _0800DC58 +_0800DC70: + adds r0, r6, r4 + strh r5, [r0] + b _0800DCAA +_0800DC76: + movs r4, 0 + ldr r3, =gUnknown_03000D74 + ldrb r1, [r3] + ldrb r0, [r3] + adds r7, r0, 0x1 + adds r2, r1, 0x1 + movs r0, 0xFF + mov r12, r0 +_0800DC86: + adds r0, r6, r4 + adds r1, r4, 0x1 + strb r2, [r0] + adds r0, r4, r7 + mov r4, r12 + ands r0, r4 + adds r0, r5, r0 + lsls r0, 16 + lsrs r5, r0, 16 + adds r2, 0x1 + adds r4, r1, 0 + cmp r1, 0xC7 + ble _0800DC86 + adds r0, r6, r1 + strh r5, [r0] + ldrb r0, [r3] + adds r0, 0x1 + strb r0, [r3] +_0800DCAA: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_800DBF8 + thumb_func_start sub_800DCB4 sub_800DCB4: @ 800DCB4 push {r4,r5,lr} @@ -388,7 +3926,7 @@ sub_800DF90: @ 800DF90 ldr r1, =gUnknown_02022B14 movs r2, 0xD bl memcpy - ldr r1, =gUnknown_02022B22 + ldr r1, =gUnknown_02022B14 + 0xE adds r0, r4, 0 movs r2, 0x8 bl memcpy @@ -6135,7 +9673,7 @@ _08010F3C: thumb_func_start sub_8010F48 sub_8010F48: @ 8010F48 push {lr} - ldr r0, =gUnknown_02022B22 + ldr r0, =gUnknown_02022B14 + 0xE ldr r1, =gSaveBlock2Ptr ldr r1, [r1] bl StringCopy @@ -6295,7 +9833,7 @@ sub_8011068: @ 8011068 ands r1, r3 orrs r1, r0 strb r1, [r2, 0xA] - ldr r3, =gUnknown_02022B22 + ldr r3, =gUnknown_02022B14 + 0xE movs r0, 0 movs r1, 0x2 bl rfu_REQ_configGameData @@ -6314,7 +9852,7 @@ sub_8011090: @ 8011090 bl sub_8010F84 _0801109E: ldr r2, =gUnknown_02022B14 - ldr r3, =gUnknown_02022B22 + ldr r3, =gUnknown_02022B14 + 0xE movs r0, 0 movs r1, 0x2 bl rfu_REQ_configGameData diff --git a/include/link_rfu.h b/include/link_rfu.h index 29f2a724c..f64c74f6b 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -3,6 +3,25 @@ // Exported type declarations +struct UnkLinkRfuStruct_02022B14 +{ + u8 unk_00_0:4; + u8 unk_00_4:1; + u8 unk_00_5:1; + u8 unk_00_6:2; + u8 filler_01[2]; + u8 unk_03[4]; + u16 unk_08_0:10; + u16 unk_09_2:6; + u8 unk_0a_0:7; + u8 unk_0a_7:1; + u8 unk_0b_0:1; + u8 unk_0b_1:7; + u8 unk_0c; + u8 unk_0d; + u8 filler_0e[8]; +}; + struct UnkLinkRfuStruct_02022B2C { u8 filler_00[16]; diff --git a/ld_script.txt b/ld_script.txt index a4ce5e236..86f89eb46 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -53,7 +53,6 @@ SECTIONS { src/string_util.o(.text); src/link.o(.text); src/link_rfu.o(.text); - asm/link.o(.text); asm/link_rfu.o(.text); asm/rom_8011DC0.o(.text); src/rtc.o(.text); diff --git a/src/link_rfu.c b/src/link_rfu.c index 7f4a3695b..b7b36db2a 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -15,6 +15,10 @@ ALIGNED(4) IWRAM_DATA u8 gUnknown_03000D78[8]; IWRAM_DATA u8 gUnknown_03000D80[16]; IWRAM_DATA u16 gUnknown_03000D90[8]; +EWRAM_DATA u8 gUnknown_02022B10 = 0; +EWRAM_DATA struct UnkLinkRfuStruct_02022B14 gUnknown_02022B14 = {}; +EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {}; + // Static ROM declarations void sub_800C000(void); diff --git a/sym_ewram.txt b/sym_ewram.txt index 45b4505c2..0e1c490fc 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -19,18 +19,7 @@ gStringVar4: @ 2021FC4 .include "src/string_util.o" .include "src/link.o" - -gUnknown_02022B10: @ 2022B10 - .space 0x4 - -gUnknown_02022B14: @ 2022B14 - .space 0xE - -gUnknown_02022B22: @ 2022B22 - .space 0xA - -gUnknown_02022B2C: @ 2022B2C - .space 0x18 + .include "src/link_rfu.o" gUnknown_02022B44: @ 2022B44 .space 0xDC From bd30e5aa24e830105d8172972645c713ec586865 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 18 Nov 2017 20:55:57 -0500 Subject: [PATCH 061/123] sub_800C12C --- asm/link_rfu.s | 117 --------------------------------------------- include/librfu.h | 7 +++ include/link_rfu.h | 3 +- src/librfu_rfu.c | 8 ---- src/link_rfu.c | 50 +++++++++++++++++++ 5 files changed, 59 insertions(+), 126 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index b5b7a43f2..7d8c8b2b1 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,123 +5,6 @@ .text - thumb_func_start sub_800C12C -sub_800C12C: @ 800C12C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C164 - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _0800C164 - movs r0, 0x1 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x1 - b _0800C204 - .pool -_0800C164: - bl rfu_getMasterSlave - lsls r0, 24 - cmp r0, 0 - bne _0800C184 - ldr r1, =gUnknown_03004140 - movs r0, 0x2 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x2 - b _0800C204 - .pool -_0800C184: - movs r2, 0 - ldr r0, =gUnknown_03007890 - ldr r1, [r0] - ldrb r3, [r1, 0x8] - ldr r5, =gUnknown_03004140 - adds r7, r0, 0 - cmp r2, r3 - bcs _0800C1B2 - ldrh r0, [r1, 0x14] - cmp r0, r6 - beq _0800C1B2 - adds r4, r1, 0 - adds r1, r3, 0 -_0800C19E: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r1 - bcs _0800C1B2 - lsls r0, r2, 5 - adds r0, r4, r0 - ldrh r0, [r0, 0x14] - cmp r0, r6 - bne _0800C19E -_0800C1B2: - ldr r0, [r7] - ldrb r0, [r0, 0x8] - cmp r0, 0 - beq _0800C1BE - cmp r2, r0 - bne _0800C1D8 -_0800C1BE: - movs r0, 0x3 - strh r0, [r5, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x3 - b _0800C204 - .pool -_0800C1D8: - ldrb r0, [r5, 0x4] - cmp r0, 0 - beq _0800C1E2 - cmp r0, 0x9 - bne _0800C1EA -_0800C1E2: - movs r0, 0xC - strb r0, [r5, 0x4] - movs r0, 0xD - b _0800C1F0 -_0800C1EA: - movs r0, 0xB - strb r0, [r5, 0x4] - movs r0, 0xC -_0800C1F0: - strb r0, [r5, 0x5] - strh r6, [r5, 0x1E] - mov r0, r8 - strh r0, [r5, 0x1A] - ldrb r0, [r5, 0x7] - cmp r0, 0 - beq _0800C202 - movs r0, 0x7 - strb r0, [r5, 0x7] -_0800C202: - movs r0, 0 -_0800C204: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800C12C - thumb_func_start sub_800C210 sub_800C210: @ 800C210 push {r4-r7,lr} diff --git a/include/librfu.h b/include/librfu.h index 3d1970437..481845f09 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -130,6 +130,13 @@ struct RfuUnk3 struct RfuUnk5 { u8 unk_00; + u8 filler_01[2]; + u8 unk_03; + u8 filler_04[4]; + u8 unk_08; + u8 filler_09[11]; + u16 unk_14; + u8 filler_16[10]; }; extern struct RfuStruct *gRfuState; diff --git a/include/link_rfu.h b/include/link_rfu.h index f64c74f6b..64510c1c6 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -53,7 +53,8 @@ struct UnkRfuStruct_1 { u8 filler_16[2]; u16 unk_18; u16 unk_1a; - u8 filler_1c[4]; + u8 filler_1c[2]; + u16 unk_1e; u16 *unk_20; u8 unk_24; u16 unk_26; diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 2169f4578..c5aa25c10 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -3,14 +3,6 @@ #include "librfu.h" -extern struct RfuUnk5 *gUnknown_03007890; -extern u32 *gUnknown_03007894; -extern struct RfuUnk3* gUnknown_03007898; -extern struct RfuUnk2* gUnknown_03007880[4]; -extern struct RfuUnk1* gUnknown_03007870[4]; -extern void* sub_82E53F4; -extern void rfu_STC_clearAPIVariables(void); - // Nonmatching, only register differences /*u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterruptToRam) { diff --git a/src/link_rfu.c b/src/link_rfu.c index b7b36db2a..8d81cddc4 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -191,3 +191,53 @@ u8 sub_800C054(u8 r5, u16 r7, u16 r8, u16 *r6) gUnknown_03004140.unk_20 = r6; return 0; } + +u8 sub_800C12C(u16 r6, u16 r8) +{ + u8 i; + struct RfuUnk5 *tmp; + + if (gUnknown_03004140.unk_04 != 0 && (gUnknown_03004140.unk_04 < 9 || gUnknown_03004140.unk_04 > 11)) + { + gUnknown_03004140.unk_14 = 1; + sub_800D30C(0xF3, 0x01); + return 1; + } + if (!rfu_getMasterSlave()) + { + gUnknown_03004140.unk_14 = 2; + sub_800D30C(0xF3, 0x01); + return 2; + } + for (i = 0; i < gUnknown_03007890->unk_08; i ++) + { + tmp = &gUnknown_03007890[i]; + if (tmp->unk_14 == r6) + { + break; + } + } + if (gUnknown_03007890->unk_08 == 0 || i == gUnknown_03007890->unk_08) + { + gUnknown_03004140.unk_14 = 3; + sub_800D30C(0xF3, 0x01); + return 3; + } + if (gUnknown_03004140.unk_04 == 0 || gUnknown_03004140.unk_04 == 9) + { + gUnknown_03004140.unk_04 = 12; + gUnknown_03004140.unk_05 = 13; + } + else + { + gUnknown_03004140.unk_04 = 11; + gUnknown_03004140.unk_05 = 12; + } + gUnknown_03004140.unk_1e = r6; + gUnknown_03004140.unk_1a = r8; + if (gUnknown_03004140.unk_07 != 0) + { + gUnknown_03004140.unk_07 = 7; + } + return 0; +} From 155bb03f469d6183fc8bac015da35d563b3bea45 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 18 Nov 2017 21:09:42 -0500 Subject: [PATCH 062/123] sub_800C210 --- asm/link_rfu.s | 56 ------------------------------------------------ include/librfu.h | 2 +- src/link_rfu.c | 27 ++++++++++++++++++++++- 3 files changed, 27 insertions(+), 58 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 7d8c8b2b1..5354304ee 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,62 +5,6 @@ .text - thumb_func_start sub_800C210 -sub_800C210: @ 800C210 - push {r4-r7,lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r6, =gUnknown_03004140 - adds r3, r6, 0 - adds r3, 0x30 - ldrb r2, [r3] - adds r0, r1, 0 - ands r0, r2 - cmp r0, 0 - beq _0800C26C - adds r0, r2, 0 - bics r0, r1 - strb r0, [r3] - movs r4, 0 - ldr r7, =gUnknown_03007890 - movs r5, 0x1 - adds r3, 0x4 - movs r2, 0 -_0800C236: - adds r0, r1, 0 - asrs r0, r4 - ands r0, r5 - cmp r0, 0 - beq _0800C246 - lsls r0, r4, 1 - adds r0, r3 - strh r2, [r0] -_0800C246: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800C236 - ldr r0, [r7] - ldrb r4, [r0, 0x3] - ands r4, r1 - cmp r4, 0 - beq _0800C260 - adds r0, r4, 0 - bl sub_800D334 -_0800C260: - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - adds r1, r4, 0 - bl sub_800D30C -_0800C26C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C210 - thumb_func_start sub_800C27C sub_800C27C: @ 800C27C push {r4,r5,lr} diff --git a/include/librfu.h b/include/librfu.h index 481845f09..292b14406 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -132,7 +132,7 @@ struct RfuUnk5 u8 unk_00; u8 filler_01[2]; u8 unk_03; - u8 filler_04[4]; + u8 unk_04[4]; u8 unk_08; u8 filler_09[11]; u16 unk_14; diff --git a/src/link_rfu.c b/src/link_rfu.c index 8d81cddc4..32365debb 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -25,6 +25,7 @@ void sub_800C000(void); void sub_800CEB0(u16 unk0); void sub_800C7B4(u16 unk0, u16 unk1); void sub_800D30C(u8 a0, u8 a1); +void sub_800D334(u8 a0); void sub_800D610(void); // .rodata @@ -209,7 +210,7 @@ u8 sub_800C12C(u16 r6, u16 r8) sub_800D30C(0xF3, 0x01); return 2; } - for (i = 0; i < gUnknown_03007890->unk_08; i ++) + for (i = 0; i < gUnknown_03007890->unk_08; i++) { tmp = &gUnknown_03007890[i]; if (tmp->unk_14 == r6) @@ -241,3 +242,27 @@ u8 sub_800C12C(u16 r6, u16 r8) } return 0; } + +void sub_800C210(u8 a0) +{ + u8 i; + + if (a0 & gUnknown_03004140.unk_30) + { + gUnknown_03004140.unk_30 &= ~a0; + for (i = 0; i < 4; i++) + { + if ((a0 >> i) & 1) + { + gUnknown_03004140.unk_34[i] = 0; + } + } + i = gUnknown_03007890->unk_03 & a0; + if (i) + { + sub_800D334(i); + } + gUnknown_03004140.unk_14 = i; + sub_800D30C(0x33, i); + } +} From bf06edfcd36666a38aae6eda515a5cfe24e2a851 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 18 Nov 2017 23:30:23 -0500 Subject: [PATCH 063/123] sub_800C27C --- asm/link_rfu.s | 115 --------------------------------------------- include/link_rfu.h | 4 +- src/link_rfu.c | 82 ++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 116 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 5354304ee..00eaf23de 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,121 +5,6 @@ .text - thumb_func_start sub_800C27C -sub_800C27C: @ 800C27C - push {r4,r5,lr} - lsls r0, 24 - movs r2, 0 - ldr r1, =gUnknown_03004140 - strb r2, [r1, 0x7] - adds r5, r1, 0 - cmp r0, 0 - beq _0800C29C - bl sub_800C000 - movs r0, 0x17 - strb r0, [r5, 0x4] - b _0800C366 - .pool -_0800C29C: - ldrb r0, [r5, 0x4] - subs r0, 0x5 - cmp r0, 0xD - bhi _0800C352 - lsls r0, 2 - ldr r1, =_0800C2B4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C2B4: - .4byte _0800C2EC - .4byte _0800C2F8 - .4byte _0800C2F8 - .4byte _0800C358 - .4byte _0800C302 - .4byte _0800C30C - .4byte _0800C30C - .4byte _0800C316 - .4byte _0800C320 - .4byte _0800C320 - .4byte _0800C358 - .4byte _0800C326 - .4byte _0800C34C - .4byte _0800C34C -_0800C2EC: - movs r1, 0 - movs r0, 0x8 - strb r0, [r5, 0x4] - strb r1, [r5, 0x5] - movs r2, 0x13 - b _0800C358 -_0800C2F8: - movs r0, 0x7 - strb r0, [r5, 0x4] - movs r0, 0x8 - strb r0, [r5, 0x5] - b _0800C358 -_0800C302: - movs r0, 0 - strb r0, [r5, 0x5] - strb r0, [r5, 0x4] - movs r2, 0x21 - b _0800C358 -_0800C30C: - movs r1, 0 - movs r0, 0xB - strb r0, [r5, 0x4] - strb r1, [r5, 0x5] - b _0800C358 -_0800C316: - movs r0, 0 - strb r0, [r5, 0x5] - strb r0, [r5, 0x4] - movs r2, 0x23 - b _0800C358 -_0800C320: - movs r0, 0xE - strb r0, [r5, 0x4] - b _0800C358 -_0800C326: - ldrb r0, [r5, 0x11] - strb r0, [r5, 0x4] - ldrb r0, [r5, 0x12] - strb r0, [r5, 0x5] - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - bl sub_800D334 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - strh r0, [r5, 0x14] - movs r0, 0x33 - movs r1, 0x1 - bl sub_800D30C - b _0800C366 - .pool -_0800C34C: - movs r0, 0x12 - strb r0, [r5, 0x4] - b _0800C358 -_0800C352: - strb r2, [r5, 0x5] - strb r2, [r5, 0x4] - movs r2, 0x43 -_0800C358: - ldrb r0, [r5, 0x4] - cmp r0, 0 - bne _0800C366 - adds r0, r2, 0 - movs r1, 0 - bl sub_800D30C -_0800C366: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_800C27C - thumb_func_start sub_800C36C sub_800C36C: @ 800C36C push {r4-r7,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 64510c1c6..ce9953450 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -48,7 +48,9 @@ struct UnkRfuStruct_1 { u8 unk_0d; u8 filler_0e[2]; u8 unk_10; - u8 filler_11[3]; + u8 unk_11; + u8 unk_12; + // aligned u16 unk_14; u8 filler_16[2]; u16 unk_18; diff --git a/src/link_rfu.c b/src/link_rfu.c index 32365debb..4f98d945f 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -266,3 +266,85 @@ void sub_800C210(u8 a0) sub_800D30C(0x33, i); } } + +void sub_800C27C(bool8 a0) +{ + u8 r2; + + r2 = 0; + gUnknown_03004140.unk_07 = 0; + if (a0) + { + sub_800C000(); + gUnknown_03004140.unk_04 = 23; + } + else + { + switch (gUnknown_03004140.unk_04) + { + case 5: + gUnknown_03004140.unk_04 = 8; + gUnknown_03004140.unk_05 = 0; + r2 = 0x13; + break; + case 6: + gUnknown_03004140.unk_04 = 7; + gUnknown_03004140.unk_05 = 8; + break; + case 7: + gUnknown_03004140.unk_04 = 7; + gUnknown_03004140.unk_05 = 8; + break; + case 8: + break; + case 9: + gUnknown_03004140.unk_05 = 0; + gUnknown_03004140.unk_04 = 0; + r2 = 0x21; + break; + case 10: + gUnknown_03004140.unk_04 = 11; + gUnknown_03004140.unk_05 = 0; + break; + case 11: + gUnknown_03004140.unk_04 = 11; + gUnknown_03004140.unk_05 = 0; + break; + case 12: + gUnknown_03004140.unk_05 = 0; + gUnknown_03004140.unk_04 = 0; + r2 = 0x23; + break; + case 13: + gUnknown_03004140.unk_04 = 14; + break; + case 14: + gUnknown_03004140.unk_04 = 14; + break; + case 15: + break; + case 16: + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_11; + gUnknown_03004140.unk_05 = gUnknown_03004140.unk_12; + sub_800D334(gUnknown_03007890->unk_03); + gUnknown_03004140.unk_14 = gUnknown_03007890->unk_03; + sub_800D30C(0x33, 0x01); + return; + case 17: + gUnknown_03004140.unk_04 = 18; + break; + case 18: + gUnknown_03004140.unk_04 = 18; + break; + default: + gUnknown_03004140.unk_05 = 0; + gUnknown_03004140.unk_04 = 0; + r2 = 0x43; + break; + } + if (gUnknown_03004140.unk_04 == 0) + { + sub_800D30C(r2, 0); + } + } +} From 22600e81cca075ecfa570365f14070d9318b33ce Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 19 Nov 2017 00:02:15 -0500 Subject: [PATCH 064/123] Start parsing out link_rfu common syms --- asm/link_rfu.s | 46 ++++++++++++------------ common_syms/link_rfu.txt | 2 ++ include/link_rfu.h | 76 ++++++++++++++++++++++------------------ src/link.c | 2 -- src/link_rfu.c | 10 +++--- sym_common.txt | 53 +--------------------------- 6 files changed, 74 insertions(+), 115 deletions(-) create mode 100644 common_syms/link_rfu.txt diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 00eaf23de..0c84af711 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -4470,7 +4470,7 @@ _0800E64A: cmp r4, 0 bge _0800E64A movs r5, 0 - ldr r4, =gUnknown_0300506C + ldr r4, =gUnknown_03005000+0x6C adds r0, r4, 0 bl sub_800FCC4 adds r0, r4, 0 @@ -4530,7 +4530,7 @@ sub_800E6D0: @ 800E6D0 thumb_func_start sub_800E700 sub_800E700: @ 800E700 push {r4,lr} - ldr r0, =gUnknown_03004190 + ldr r0, =gUnknown_03004140+0x50 ldr r1, =0x00000e64 ldr r4, =gIntrTable + 0x4 adds r2, r4, 0 @@ -4692,7 +4692,7 @@ sub_800E88C: @ 800E88C bne _0800E8CC movs r3, 0 movs r5, 0x1 - ldr r1, =gUnknown_03005CDE + ldr r1, =gUnknown_03005000+0xCDE _0800E8A6: adds r0, r2, 0 ands r0, r5 @@ -4717,7 +4717,7 @@ _0800E8CC: mvns r0, r1 mov r12, r0 movs r7, 0x1 - ldr r4, =gUnknown_03005CDE + ldr r4, =gUnknown_03005000+0xCDE _0800E8D6: adds r2, r1, 0 ands r2, r7 @@ -4733,14 +4733,14 @@ _0800E8E2: cmp r3, 0x3 bls _0800E8D6 movs r4, 0x4 - ldr r0, =gUnknown_03005CDE + ldr r0, =gUnknown_03005000+0xCDE ldrb r7, [r0] _0800E8F4: movs r3, 0 subs r1, r4, 0x1 cmp r7, r4 beq _0800E910 - ldr r2, =gUnknown_03005CDE + ldr r2, =gUnknown_03005000+0xCDE _0800E8FE: adds r0, r3, 0x1 lsls r0, 24 @@ -4764,7 +4764,7 @@ _0800E916: ands r5, r0 movs r3, 0 movs r2, 0x1 - ldr r1, =gUnknown_03005CDE + ldr r1, =gUnknown_03005000+0xCDE _0800E928: adds r0, r5, 0 ands r0, r2 @@ -4949,7 +4949,7 @@ _0800EABC: lsls r2, r4, 3 subs r2, r4 lsls r2, 1 - ldr r0, =gUnknown_03005014 + ldr r0, =gUnknown_03005000+0x14 adds r2, r0 movs r0, 0x10 adds r1, r4, 0 @@ -4976,7 +4976,7 @@ sub_800EAFC: @ 800EAFC push {r4-r6,lr} ldr r0, =gUnknown_03004140 ldrb r5, [r0] - ldr r4, =gUnknown_03005C87 + ldr r4, =gUnknown_03005000+0xC87 adds r0, r5, 0 adds r1, r4, 0 movs r2, 0x46 @@ -5905,7 +5905,7 @@ _0800F2E0: movs r0, 0x1F ands r0, r1 strb r0, [r2] - ldr r2, =gUnknown_03005CDE + ldr r2, =gUnknown_03005000+0xCDE adds r0, r5, r2 ldrb r0, [r0] movs r6, 0 @@ -6138,7 +6138,7 @@ sub_800F4F0: @ 800F4F0 mov r7, r8 push {r7} sub sp, 0x58 - ldr r0, =gUnknown_03005124 + ldr r0, =gUnknown_03005000+0x124 mov r1, sp bl sub_800D934 movs r1, 0 @@ -6344,7 +6344,7 @@ _0800F6A0: adds r4, 0x1 cmp r4, 0x6 ble _0800F6A0 - ldr r0, =gUnknown_030059E8 + ldr r0, =gUnknown_03005000+0x9E8 mov r1, r12 bl sub_800D888 movs r1, 0x1 @@ -6356,7 +6356,7 @@ _0800F6A0: _0800F6C8: adds r1, r7, 0 adds r5, r6, 0 - ldr r3, =gUnknown_0300506E + ldr r3, =gUnknown_03005000+0x6E ldrh r3, [r3] cmp r5, r3 blt _0800F65A @@ -6687,7 +6687,7 @@ _0800F930: ldr r3, =gRecvCmds+0x4 adds r0, r5, r3 bl sub_800F74C - ldr r4, =gUnknown_03005CCE + ldr r4, =gUnknown_03005000+0xCCE strb r0, [r4] b _0800FC08 .pool @@ -6863,7 +6863,7 @@ _0800FAAC: b _0800FC04 .pool _0800FAD0: - ldr r1, =gUnknown_030050E4 + ldr r1, =gUnknown_03005000+0xE4 add r1, r8 movs r0, 0x1 strb r0, [r1] @@ -7266,7 +7266,7 @@ _0800FE14: .pool _0800FE20: movs r4, 0 - ldr r3, =gUnknown_030050F2 + ldr r3, =gUnknown_03005000+0xF2 _0800FE24: adds r2, r4, 0x1 lsls r1, r2, 1 @@ -7304,7 +7304,7 @@ sub_800FE50: @ 800FE50 bl sub_8011A80 cmp r0, 0 bne _0800FE76 - ldr r0, =gUnknown_030050F2 + ldr r0, =gUnknown_03005000+0xF2 adds r1, r4, 0 movs r2, 0xC bl memcpy @@ -8255,7 +8255,7 @@ sub_80105EC: @ 80105EC push {r4-r6,lr} movs r3, 0 movs r1, 0 - ldr r5, =gUnknown_03005CD5 + ldr r5, =gUnknown_03005000+0xCD5 movs r6, 0x1 movs r4, 0 _080105F8: @@ -8280,7 +8280,7 @@ _0801060C: bl rfu_waitREQComplete _08010620: movs r1, 0 - ldr r2, =gUnknown_03005CD5 + ldr r2, =gUnknown_03005000+0xCD5 _08010624: adds r0, r1, r2 ldrb r0, [r0] @@ -8756,7 +8756,7 @@ sub_80109E8: @ 80109E8 lsrs r2, r0, 16 movs r1, 0 movs r5, 0x1 - ldr r4, =gUnknown_03005CDE + ldr r4, =gUnknown_03005000+0xCDE movs r3, 0 _080109F6: adds r0, r2, 0 @@ -11163,7 +11163,7 @@ sub_8011DE0: @ 8011DE0 beq _08011E20 movs r3, 0 movs r2, 0 - ldr r5, =gUnknown_03005CDE + ldr r5, =gUnknown_03005000+0xCDE adds r6, r5, 0x4 _08011DF0: adds r0, r2, r5 @@ -11444,7 +11444,7 @@ _08012032: bne _0801202E cmp r5, 0x44 bne _08012092 - ldr r5, =gUnknown_0300510A + ldr r5, =gUnknown_03005000+0x10A ldrh r0, [r5, 0x8] ldr r3, =0x000003ff adds r2, r3, 0 @@ -11686,7 +11686,7 @@ sub_8012240: @ 8012240 movs r1, 0 ldr r0, =gUnknown_03004140 ldrb r2, [r0] - ldr r4, =gUnknown_03005CD1 + ldr r4, =gUnknown_03005000+0xCD1 movs r3, 0x1 _0801224C: adds r0, r2, 0 diff --git a/common_syms/link_rfu.txt b/common_syms/link_rfu.txt new file mode 100644 index 000000000..67dd00ca7 --- /dev/null +++ b/common_syms/link_rfu.txt @@ -0,0 +1,2 @@ +gUnknown_03004140 +gUnknown_03005000 diff --git a/include/link_rfu.h b/include/link_rfu.h index ce9953450..424a4767f 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -32,47 +32,55 @@ struct UnkLinkRfuStruct_02022B2C }; struct UnkRfuStruct_1 { - u8 unk_00; - u8 unk_01; - u8 unk_02; - vu8 unk_03; - u8 unk_04; - u8 unk_05; - u8 unk_06; - u8 unk_07; - u8 unk_08; - u8 unk_09; - u8 unk_0a; - u8 unk_0b; - u8 unk_0c; - u8 unk_0d; - u8 filler_0e[2]; - u8 unk_10; - u8 unk_11; - u8 unk_12; + /* 0x000 */ u8 unk_00; + /* 0x001 */ u8 unk_01; + /* 0x002 */ u8 unk_02; + /* 0x003 */ vu8 unk_03; + /* 0x004 */ u8 unk_04; + /* 0x005 */ u8 unk_05; + /* 0x006 */ u8 unk_06; + /* 0x007 */ u8 unk_07; + /* 0x008 */ u8 unk_08; + /* 0x009 */ u8 unk_09; + /* 0x00a */ u8 unk_0a; + /* 0x00b */ u8 unk_0b; + /* 0x00c */ u8 unk_0c; + /* 0x00d */ u8 unk_0d; + /* 0x00e */ u8 filler_0e[2]; + /* 0x010 */ u8 unk_10; + /* 0x011 */ u8 unk_11; + /* 0x012 */ u8 unk_12; // aligned - u16 unk_14; - u8 filler_16[2]; - u16 unk_18; - u16 unk_1a; - u8 filler_1c[2]; - u16 unk_1e; - u16 *unk_20; - u8 unk_24; - u16 unk_26; - u16 unk_28[4]; - u8 unk_30; + /* 0x014 */ u16 unk_14; + /* 0x016 */ u8 filler_16[2]; + /* 0x018 */ u16 unk_18; + /* 0x01a */ u16 unk_1a; + /* 0x01c */ u8 filler_1c[2]; + /* 0x01e */ u16 unk_1e; + /* 0x020 */ u16 *unk_20; + /* 0x024 */ u8 unk_24; + /* 0x026 */ u16 unk_26; + /* 0x028 */ u16 unk_28[4]; + /* 0x030 */ u8 unk_30; // aligned - u16 unk_32; - u16 unk_34[4]; - struct UnkLinkRfuStruct_02022B2C *unk_3c; - void (*unk_40)(u8); - void (*unk_44)(void); + /* 0x032 */ u16 unk_32; + /* 0x034 */ u16 unk_34[4]; + /* 0x03c */ struct UnkLinkRfuStruct_02022B2C *unk_3c; + /* 0x040 */ void (*unk_40)(u8); + /* 0x044 */ void (*unk_44)(void); + /* 0x048 */ u8 filler_48[0xe78]; +}; + +struct UnkRfuStruct_2 { + /* 0x000 */ u8 filler_00[13]; + /* 0x00d */ u8 playerCount; + /* 0x00e */ u8 filler_0e[0xcea]; }; // Exported RAM declarations extern struct UnkRfuStruct_1 gUnknown_03004140; +extern struct UnkRfuStruct_2 gUnknown_03005000; // Exported ROM declarations u32 sub_800BEC0(void); diff --git a/src/link.c b/src/link.c index 8c6dda32a..eebafef2c 100644 --- a/src/link.c +++ b/src/link.c @@ -2438,5 +2438,3 @@ void ResetRecvBuffer(void) } } } - -// rfu diff --git a/src/link_rfu.c b/src/link_rfu.c index 4f98d945f..9cc4b497a 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -7,9 +7,11 @@ // Static type declarations -struct UnkRfuStruct_1 gUnknown_03004140; - // Static RAM declarations + +struct UnkRfuStruct_1 gUnknown_03004140; +struct UnkRfuStruct_2 gUnknown_03005000; + IWRAM_DATA u8 gUnknown_03000D74; ALIGNED(4) IWRAM_DATA u8 gUnknown_03000D78[8]; IWRAM_DATA u8 gUnknown_03000D80[16]; @@ -80,7 +82,7 @@ int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) { return 4; } - CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140)); + CpuFill16(0, &gUnknown_03004140, offsetof(struct UnkRfuStruct_1, filler_48)); gUnknown_03004140.unk_06 = -1; gUnknown_03004140.unk_40 = func1; gUnknown_03004140.unk_44 = func2; @@ -91,7 +93,7 @@ int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) void sub_800BFA0(void) { - CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140) - 2 * sizeof(void *)); + CpuFill16(0, &gUnknown_03004140, offsetof(struct UnkRfuStruct_1, unk_40)); gUnknown_03004140.unk_06 = -1; } diff --git a/sym_common.txt b/sym_common.txt index 488ccd9a7..6a5b0fdc1 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -12,58 +12,7 @@ gUnknown_03002F70: @ 3002F70 .include "text.o" .include "sprite.o" .include "link.o" - -gUnknown_03004140: @ 3004140 - .space 0x48 - -gUnknown_03004188: @ 3004150 - .space 0x8 - -gUnknown_03004190: @ 3004190 - .space 0xE70 - -gUnknown_03005000: @ 3005000 - .space 0x14 - -gUnknown_03005014: @ 3005014 - .space 0x58 - -gUnknown_0300506C: @ 300506C - .space 0x2 - -gUnknown_0300506E: @ 300506E - .space 0x76 - -gUnknown_030050E4: @ 30050E4 - .space 0xE - -gUnknown_030050F2: @ 30050F2 - .space 0x18 - -gUnknown_0300510A: @ 300510A - .space 0x1A - -gUnknown_03005124: @ 3005124 - .space 0x8C4 - -gUnknown_030059E8: @ 30059E8 - .space 0x29F - -gUnknown_03005C87: @ 3005C87 - .space 0x47 - -gUnknown_03005CCE: @ 3005CCE - .space 0x3 - -gUnknown_03005CD1: @ 3005CD1 - .space 0x4 - -gUnknown_03005CD5: @ 3005CD5 - .space 0x9 - -gUnknown_03005CDE: @ 3005CDE - .space 0x1A - + .include "link_rfu.o" .include "rtc.o" gPreBattleCallback1: @ 3005D00 From a5498843faacb5ec40fd48771573c998198f16af Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 19 Nov 2017 00:06:13 -0500 Subject: [PATCH 065/123] Annotate possible file boundaries in link_rfu --- asm/link_rfu.s | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 0c84af711..c5eaa2faa 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -2450,6 +2450,8 @@ _0800D6C2: bx r0 thumb_func_end sub_800D658 +@ file boundary? + thumb_func_start sub_800D6C8 sub_800D6C8: @ 800D6C8 push {r4,r5,lr} @@ -4415,6 +4417,8 @@ _0800E5C0: .pool thumb_func_end sub_800E5AC +@ file boundary? + thumb_func_start nullsub_5 nullsub_5: @ 800E5FC bx lr From 03ce7b042a3b5471d7d84959f7ce21793eda0063 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 19 Nov 2017 10:20:44 -0500 Subject: [PATCH 066/123] sub_800C36C --- asm/link_rfu.s | 232 --------------------------------------------- include/librfu.h | 1 + include/link_rfu.h | 2 +- src/link_rfu.c | 92 ++++++++++++++++++ 4 files changed, 94 insertions(+), 233 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index c5eaa2faa..dfc434f67 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,238 +5,6 @@ .text - thumb_func_start sub_800C36C -sub_800C36C: @ 800C36C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0 - mov r8, r1 - mov r5, sp - adds r5, 0x1 - mov r4, sp - adds r4, 0x2 - mov r1, sp - adds r2, r5, 0 - adds r3, r4, 0 - bl rfu_REQBN_watchLink - mov r0, sp - ldrb r0, [r0] - adds r7, r4, 0 - cmp r0, 0 - beq _0800C43E - ldr r1, =gUnknown_03004140 - mov r0, sp - ldrb r0, [r0] - strh r0, [r1, 0x14] - ldrb r0, [r5] - strh r0, [r1, 0x16] - ldrb r0, [r1, 0x9] - adds r6, r1, 0 - cmp r0, 0 - beq _0800C426 - movs r0, 0x1 - strb r0, [r6, 0xA] - ldrb r0, [r6, 0x6] - cmp r0, 0 - bne _0800C3C2 - ldrb r0, [r5] - cmp r0, 0 - bne _0800C3C2 - movs r0, 0x4 - strb r0, [r6, 0xA] -_0800C3C2: - ldrb r0, [r6, 0xA] - cmp r0, 0x1 - bne _0800C40C - movs r2, 0 - mov r4, sp - movs r5, 0x1 - mov r12, r6 - mov r3, r12 - adds r3, 0x30 - movs r6, 0x34 - add r6, r12 - mov r9, r6 -_0800C3DA: - ldrb r0, [r4] - asrs r0, r2 - ands r0, r5 - cmp r0, 0 - beq _0800C3F8 - adds r0, r5, 0 - lsls r0, r2 - ldrb r1, [r3] - orrs r0, r1 - strb r0, [r3] - lsls r0, r2, 1 - add r0, r9 - mov r6, r12 - ldrh r1, [r6, 0x32] - strh r1, [r0] -_0800C3F8: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C3DA - movs r0, 0x31 - b _0800C41E - .pool -_0800C40C: - movs r0, 0 - strb r0, [r6, 0xA] - mov r0, sp - ldrb r0, [r0] - bl sub_800D334 - movs r0, 0x1 - mov r8, r0 - movs r0, 0x33 -_0800C41E: - movs r1, 0x1 - bl sub_800D30C - b _0800C43A -_0800C426: - mov r0, sp - ldrb r0, [r0] - bl sub_800D334 - movs r1, 0x1 - mov r8, r1 - movs r0, 0x30 - movs r1, 0x2 - bl sub_800D30C -_0800C43A: - bl sub_800D610 -_0800C43E: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800C518 - ldrb r0, [r7] - cmp r0, 0 - beq _0800C49C - movs r2, 0 - ldr r6, =gUnknown_03004140 - movs r3, 0x1 - adds r4, r6, 0 - adds r4, 0x34 - adds r6, 0x30 - adds r5, r7, 0 -_0800C45C: - ldrb r0, [r6] - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - beq _0800C478 - ldrb r0, [r5] - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - beq _0800C478 - lsls r0, r2, 1 - adds r0, r4 - movs r1, 0 - strh r1, [r0] -_0800C478: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C45C - ldr r3, =gUnknown_03004140 - adds r2, r3, 0 - adds r2, 0x30 - ldrb r1, [r7] - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r7] - strh r0, [r3, 0x14] - movs r0, 0x32 - movs r1, 0x1 - bl sub_800D30C -_0800C49C: - ldr r0, =gUnknown_03004140 - adds r3, r0, 0 - adds r3, 0x30 - ldrb r1, [r3] - adds r6, r0, 0 - cmp r1, 0 - beq _0800C514 - movs r4, 0 - movs r2, 0 - movs r5, 0x1 -_0800C4B0: - ldrb r0, [r3] - asrs r0, r2 - ands r0, r5 - cmp r0, 0 - beq _0800C4E2 - lsls r1, r2, 1 - adds r0, r6, 0 - adds r0, 0x34 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _0800C4E2 - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _0800C4E2 - adds r0, r5, 0 - lsls r0, r2 - ldrb r1, [r3] - bics r1, r0 - strb r1, [r3] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0800C4E2: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800C4B0 - cmp r4, 0 - beq _0800C506 - adds r0, r4, 0 - bl sub_800D334 - movs r6, 0x1 - mov r8, r6 - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - movs r1, 0x1 - bl sub_800D30C -_0800C506: - ldr r0, =gUnknown_03004140 - adds r1, r0, 0 - adds r1, 0x30 - ldrb r1, [r1] - adds r6, r0, 0 - cmp r1, 0 - bne _0800C518 -_0800C514: - movs r0, 0 - strb r0, [r6, 0xA] -_0800C518: - mov r0, r8 - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800C36C - thumb_func_start rfu_syncVBlank_ rfu_syncVBlank_: @ 800C530 push {lr} diff --git a/include/librfu.h b/include/librfu.h index 292b14406..45b3e1cd3 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -157,3 +157,4 @@ void rfu_REQ_sendData(u8); void rfu_setMSCCallback(void (*func)(u16)); void rfu_setREQCallback(void (*func)(u16, u16)); bool8 rfu_getMasterSlave(void); +void rfu_REQBN_watchLink(u16 a0, u8 *a1, u8 *a2, u8 *a3); diff --git a/include/link_rfu.h b/include/link_rfu.h index 424a4767f..e9b6548a5 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -52,7 +52,7 @@ struct UnkRfuStruct_1 { /* 0x012 */ u8 unk_12; // aligned /* 0x014 */ u16 unk_14; - /* 0x016 */ u8 filler_16[2]; + /* 0x016 */ u16 unk_16; /* 0x018 */ u16 unk_18; /* 0x01a */ u16 unk_1a; /* 0x01c */ u8 filler_1c[2]; diff --git a/src/link_rfu.c b/src/link_rfu.c index 9cc4b497a..f0439eac3 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -350,3 +350,95 @@ void sub_800C27C(bool8 a0) } } } + +bool8 sub_800C36C(u16 a0) +{ + bool8 retVal; + u8 i; + u8 sp0; + u8 sp1; + u8 sp2; + u8 flags; + + retVal = FALSE; + rfu_REQBN_watchLink(a0, &sp0, &sp1, &sp2); + if (sp0) + { + gUnknown_03004140.unk_14 = sp0; + gUnknown_03004140.unk_16 = sp1; + if (gUnknown_03004140.unk_09) + { + gUnknown_03004140.unk_0a = 1; + if (gUnknown_03004140.unk_06 == 0 && sp1 == 0) + { + gUnknown_03004140.unk_0a = 4; + } + if (gUnknown_03004140.unk_0a == 1) + { + for (i = 0; i < 4; i++) + { + if ((sp0 >> i) & 1) + { + gUnknown_03004140.unk_30 |= (1 << i); + gUnknown_03004140.unk_34[i] = gUnknown_03004140.unk_32; + } + } + sub_800D30C(0x31, 0x01); + } + else + { + gUnknown_03004140.unk_0a = 0; + sub_800D334(sp0); + retVal = TRUE; + sub_800D30C(0x33, 0x01); + } + } + else + { + sub_800D334(sp0); + retVal = TRUE; + sub_800D30C(0x30, 0x02); + } + sub_800D610(); + } + if (gUnknown_03007890->unk_00 == 1) + { + if (sp2) + { + for (i = 0; i < 4; i++) + { + if ((gUnknown_03004140.unk_30 >> i) & 1 && (sp2 >> i) & 1) + { + gUnknown_03004140.unk_34[i] = 0; + } + } + gUnknown_03004140.unk_30 &= ~sp2; + gUnknown_03004140.unk_14 = sp2; + sub_800D30C(0x32, 0x01); + } + if (gUnknown_03004140.unk_30) + { + flags = 0; + for (i = 0; i < 4; i++) + { + if ((gUnknown_03004140.unk_30 >> i) & 1 && gUnknown_03004140.unk_34[i] && --gUnknown_03004140.unk_34[i] == 0) + { + gUnknown_03004140.unk_30 &= ~(1 << i); + flags |= (1 << i); + } + } + if (flags) + { + sub_800D334(flags); + retVal = TRUE; + gUnknown_03004140.unk_14 = flags; + sub_800D30C(0x33, 0x01); + } + } + if (!gUnknown_03004140.unk_30) + { + gUnknown_03004140.unk_0a = 0; + } + } + return retVal; +} From cc82358864afc54281326734487bec1354fa4d9d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 19 Nov 2017 16:54:49 -0500 Subject: [PATCH 067/123] sub_800C54C --- asm/link_rfu.s | 229 --------------------------------------------- include/librfu.h | 17 ++++ include/link_rfu.h | 11 ++- src/link_rfu.c | 127 +++++++++++++++++++++++++ 4 files changed, 153 insertions(+), 231 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index dfc434f67..169279f43 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,235 +5,6 @@ .text - thumb_func_start rfu_syncVBlank_ -rfu_syncVBlank_: @ 800C530 - push {lr} - bl rfu_syncVBlank - lsls r0, 16 - cmp r0, 0 - beq _0800C548 - movs r0, 0xF1 - movs r1, 0 - bl sub_800D30C - bl sub_800D610 -_0800C548: - pop {r0} - bx r0 - thumb_func_end rfu_syncVBlank_ - - thumb_func_start sub_800C54C -sub_800C54C: @ 800C54C - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gUnknown_03004140 - ldr r2, [r1, 0x40] - cmp r2, 0 - bne _0800C568 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0800C568 - strb r2, [r1, 0x4] - b _0800C736 - .pool -_0800C568: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x7] - cmp r0, 0 - beq _0800C576 - adds r0, r3, 0 - bl sub_800C744 -_0800C576: - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x4] - cmp r0, 0 - bne _0800C580 - b _0800C700 -_0800C580: - bl rfu_waitREQComplete - movs r0, 0x1 - strb r0, [r4, 0xE] - ldrb r0, [r4, 0x4] - subs r0, 0x1 - cmp r0, 0x16 - bls _0800C592 - b _0800C6F6 -_0800C592: - lsls r0, 2 - ldr r1, =_0800C5A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C5A4: - .4byte _0800C624 - .4byte _0800C65C - .4byte _0800C662 - .4byte _0800C678 - .4byte _0800C690 - .4byte _0800C696 - .4byte _0800C69C - .4byte _0800C6F6 - .4byte _0800C6A2 - .4byte _0800C6A8 - .4byte _0800C6AE - .4byte _0800C6B4 - .4byte _0800C6C4 - .4byte _0800C6CA - .4byte _0800C6F6 - .4byte _0800C6D0 - .4byte _0800C6E0 - .4byte _0800C6E6 - .4byte _0800C6EC - .4byte _0800C6F6 - .4byte _0800C6F2 - .4byte _0800C6F6 - .4byte _0800C600 -_0800C600: - bl sub_800BEC0 - ldr r1, =0x00008001 - movs r2, 0xFF - cmp r0, r1 - bne _0800C60E - movs r2, 0x44 -_0800C60E: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - adds r0, r2, 0 - b _0800C64E - .pool -_0800C624: - bl sub_800BEC0 - ldr r1, =0x00008001 - cmp r0, r1 - bne _0800C644 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - movs r1, 0x3 - strb r1, [r0, 0x5] - b _0800C6F6 - .pool -_0800C644: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - movs r0, 0xFF -_0800C64E: - movs r1, 0 - bl sub_800D30C - b _0800C6F6 - .pool -_0800C65C: - bl rfu_REQ_reset - b _0800C6F6 -_0800C662: - ldr r0, =gUnknown_03004140 - ldr r2, [r0, 0x3C] - ldrh r0, [r2, 0x2] - ldrb r1, [r2] - ldrb r2, [r2, 0x1] - bl rfu_REQ_configSystem - b _0800C6F6 - .pool -_0800C678: - ldr r0, =gUnknown_03004140 - ldr r3, [r0, 0x3C] - ldrb r0, [r3, 0x4] - ldrh r1, [r3, 0x6] - ldr r2, [r3, 0x8] - ldr r3, [r3, 0xC] - bl rfu_REQ_configGameData - b _0800C6F6 - .pool -_0800C690: - bl rfu_REQ_startSearchChild - b _0800C6F6 -_0800C696: - bl rfu_REQ_pollSearchChild - b _0800C6F6 -_0800C69C: - bl rfu_REQ_endSearchChild - b _0800C6F6 -_0800C6A2: - bl rfu_REQ_startSearchParent - b _0800C6F6 -_0800C6A8: - bl rfu_REQ_pollSearchParent - b _0800C6F6 -_0800C6AE: - bl rfu_REQ_endSearchParent - b _0800C6F6 -_0800C6B4: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x1E] - bl rfu_REQ_startConnectParent - b _0800C6F6 - .pool -_0800C6C4: - bl rfu_REQ_pollConnectParent - b _0800C6F6 -_0800C6CA: - bl rfu_REQ_endConnectParent - b _0800C6F6 -_0800C6D0: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bl rfu_REQ_CHILD_startConnectRecovery - b _0800C6F6 - .pool -_0800C6E0: - bl rfu_REQ_CHILD_pollConnectRecovery - b _0800C6F6 -_0800C6E6: - bl rfu_REQ_CHILD_endConnectRecovery - b _0800C6F6 -_0800C6EC: - bl rfu_REQ_changeMasterSlave - b _0800C6F6 -_0800C6F2: - bl rfu_REQ_stopMode -_0800C6F6: - bl rfu_waitREQComplete - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0xE] -_0800C700: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x4] - subs r0, 0x12 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0800C710 - b _0800C576 -_0800C710: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800C726 - movs r0, 0 - bl sub_800C36C - lsls r0, 24 - cmp r0, 0 - bne _0800C736 -_0800C726: - bl sub_800CF34 - bl sub_800D158 - bl sub_800D268 - bl sub_800D434 -_0800C736: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C54C - thumb_func_start sub_800C744 sub_800C744: @ 800C744 push {r4,lr} diff --git a/include/librfu.h b/include/librfu.h index 45b3e1cd3..cdc33c91a 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -158,3 +158,20 @@ void rfu_setMSCCallback(void (*func)(u16)); void rfu_setREQCallback(void (*func)(u16, u16)); bool8 rfu_getMasterSlave(void); void rfu_REQBN_watchLink(u16 a0, u8 *a1, u8 *a2, u8 *a3); +bool16 rfu_syncVBlank(void); +void rfu_REQ_reset(void); +void rfu_REQ_configSystem(u16, u8, u8); +void rfu_REQ_configGameData(u8, u16, u32, u32); +void rfu_REQ_startSearchChild(void); +void rfu_REQ_pollSearchChild(void); +void rfu_REQ_endSearchChild(void); +void rfu_REQ_startSearchParent(void); +void rfu_REQ_pollSearchParent(void); +void rfu_REQ_endSearchParent(void); +void rfu_REQ_startConnectParent(u16); +void rfu_REQ_pollConnectParent(void); +void rfu_REQ_endConnectParent(void); +void rfu_REQ_CHILD_startConnectRecovery(u8); +void rfu_REQ_CHILD_pollConnectRecovery(void); +void rfu_REQ_CHILD_endConnectRecovery(void); +void rfu_REQ_changeMasterSlave(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index e9b6548a5..12ff03330 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -24,7 +24,13 @@ struct UnkLinkRfuStruct_02022B14 struct UnkLinkRfuStruct_02022B2C { - u8 filler_00[16]; + u8 unk_00; + u8 unk_01; + u16 unk_02; + u8 unk_04; + u16 unk_06; + u32 unk_08; + u32 unk_0c; u8 unk_10; u8 unk_11; u16 unk_12; @@ -46,7 +52,8 @@ struct UnkRfuStruct_1 { /* 0x00b */ u8 unk_0b; /* 0x00c */ u8 unk_0c; /* 0x00d */ u8 unk_0d; - /* 0x00e */ u8 filler_0e[2]; + /* 0x00e */ u8 unk_0e; + /* 0x00f */ u8 unk_0f; /* 0x010 */ u8 unk_10; /* 0x011 */ u8 unk_11; /* 0x012 */ u8 unk_12; diff --git a/src/link_rfu.c b/src/link_rfu.c index f0439eac3..6e0d3e249 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -29,6 +29,11 @@ void sub_800C7B4(u16 unk0, u16 unk1); void sub_800D30C(u8 a0, u8 a1); void sub_800D334(u8 a0); void sub_800D610(void); +void sub_800C744(u32 a0); +void sub_800CF34(void); +void sub_800D158(void); +void sub_800D268(void); +void sub_800D434(void); // .rodata @@ -442,3 +447,125 @@ bool8 sub_800C36C(u16 a0) } return retVal; } + +void rfu_syncVBlank_(void) +{ + if (rfu_syncVBlank()) + { + sub_800D30C(0xF1, 0x00); + sub_800D610(); + } +} + +void sub_800C54C(u32 a0) +{ + u8 r2; + + if (gUnknown_03004140.unk_40 == NULL && gUnknown_03004140.unk_04 != 0) + { + gUnknown_03004140.unk_04 = 0; + } + else + { + if (gUnknown_03004140.unk_07 != 0) + { + sub_800C744(a0); + } + do { + + if (gUnknown_03004140.unk_04 != 0) + { + rfu_waitREQComplete(); + gUnknown_03004140.unk_0e = 1; + switch (gUnknown_03004140.unk_04) + { + case 23: + r2 = sub_800BEC0() == 0x8001 ? 0x44 : 0xFF; + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + sub_800D30C(r2, 0); + break; + case 1: + if (sub_800BEC0() == 0x8001) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05; + gUnknown_03004140.unk_05 = 3; + } + else + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + sub_800D30C(0xFF, 0); + } + break; + case 2: + rfu_REQ_reset(); + break; + case 3: + rfu_REQ_configSystem(gUnknown_03004140.unk_3c->unk_02, gUnknown_03004140.unk_3c->unk_00, gUnknown_03004140.unk_3c->unk_01); + break; + case 4: + rfu_REQ_configGameData(gUnknown_03004140.unk_3c->unk_04, gUnknown_03004140.unk_3c->unk_06, gUnknown_03004140.unk_3c->unk_08, gUnknown_03004140.unk_3c->unk_0c); + break; + case 5: + rfu_REQ_startSearchChild(); + break; + case 6: + rfu_REQ_pollSearchChild(); + break; + case 7: + rfu_REQ_endSearchChild(); + break; + case 8: + break; + case 9: + rfu_REQ_startSearchParent(); + break; + case 10: + rfu_REQ_pollSearchParent(); + break; + case 11: + rfu_REQ_endSearchParent(); + break; + case 12: + rfu_REQ_startConnectParent(gUnknown_03004140.unk_1e); + break; + case 13: + rfu_REQ_pollConnectParent(); + break; + case 14: + rfu_REQ_endConnectParent(); + break; + case 15: + break; + case 16: + rfu_REQ_CHILD_startConnectRecovery(gUnknown_03007890->unk_03); + break; + case 17: + rfu_REQ_CHILD_pollConnectRecovery(); + break; + case 18: + rfu_REQ_CHILD_endConnectRecovery(); + break; + case 19: + rfu_REQ_changeMasterSlave(); + break; + case 20: + break; + case 21: + rfu_REQ_stopMode(); + break; + case 22: + break; + } + rfu_waitREQComplete(); + gUnknown_03004140.unk_0e = 0; + } + } while (gUnknown_03004140.unk_04 == 18 || gUnknown_03004140.unk_04 == 19); + if (gUnknown_03007890->unk_00 != 1 || !sub_800C36C(0)) + { + sub_800CF34(); + sub_800D158(); + sub_800D268(); + sub_800D434(); + } + } +} From 035c0b0ecd03f890f3f8ed13ae5cdc3f98c941db Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 19 Nov 2017 18:34:28 -0500 Subject: [PATCH 068/123] sub_800C744 --- asm/link_rfu.s | 64 ---------------------------------------------- include/link_rfu.h | 2 +- src/link_rfu.c | 44 +++++++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 67 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 169279f43..e33e66ed2 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,70 +5,6 @@ .text - thumb_func_start sub_800C744 -sub_800C744: @ 800C744 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x7] - adds r4, r0, 0 - cmp r1, 0x5 - bne _0800C76E - movs r2, 0x1 - strb r2, [r4, 0x6] - strb r1, [r4, 0x4] - ldrh r0, [r4, 0x1C] - strh r0, [r4, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C76C - movs r0, 0x6 - strb r0, [r4, 0x7] - b _0800C76E - .pool -_0800C76C: - strb r2, [r4, 0x7] -_0800C76E: - ldrb r0, [r4, 0x7] - cmp r0, 0x1 - bne _0800C798 - strb r0, [r4, 0x6] - movs r0, 0x5 - strb r0, [r4, 0x4] - adds r0, r3, 0 - movs r1, 0x8C - bl __umodsi3 - strh r0, [r4, 0x1A] - movs r1, 0x8C - subs r1, r0 - strh r1, [r4, 0x1C] - lsls r0, 16 - cmp r0, 0 - beq _0800C794 - movs r0, 0x2 - b _0800C796 -_0800C794: - movs r0, 0x3 -_0800C796: - strb r0, [r4, 0x7] -_0800C798: - ldrb r0, [r4, 0x7] - cmp r0, 0x3 - bne _0800C7AE - movs r0, 0 - strb r0, [r4, 0x6] - movs r0, 0x28 - strh r0, [r4, 0x1A] - movs r0, 0x4 - strb r0, [r4, 0x7] - movs r0, 0x9 - strb r0, [r4, 0x4] -_0800C7AE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800C744 - thumb_func_start sub_800C7B4 sub_800C7B4: @ 800C7B4 push {r4-r7,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 12ff03330..7c1949bba 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -62,7 +62,7 @@ struct UnkRfuStruct_1 { /* 0x016 */ u16 unk_16; /* 0x018 */ u16 unk_18; /* 0x01a */ u16 unk_1a; - /* 0x01c */ u8 filler_1c[2]; + /* 0x01c */ u16 unk_1c; /* 0x01e */ u16 unk_1e; /* 0x020 */ u16 *unk_20; /* 0x024 */ u8 unk_24; diff --git a/src/link_rfu.c b/src/link_rfu.c index 6e0d3e249..de0b782f8 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -471,8 +471,8 @@ void sub_800C54C(u32 a0) { sub_800C744(a0); } - do { - + do + { if (gUnknown_03004140.unk_04 != 0) { rfu_waitREQComplete(); @@ -569,3 +569,43 @@ void sub_800C54C(u32 a0) } } } + +void sub_800C744(u32 a0) +{ + if (gUnknown_03004140.unk_07 == 5) + { + gUnknown_03004140.unk_06 = 1; + gUnknown_03004140.unk_04 = 5; + gUnknown_03004140.unk_1a = gUnknown_03004140.unk_1c; + if (gUnknown_03004140.unk_1a) + { + gUnknown_03004140.unk_07 = 6; + } + else + { + gUnknown_03004140.unk_07 = 1; + } + } + if (gUnknown_03004140.unk_07 == 1) + { + gUnknown_03004140.unk_06 = 1; + gUnknown_03004140.unk_04 = 5; + gUnknown_03004140.unk_1a = a0 % 140; + gUnknown_03004140.unk_1c = 140 - gUnknown_03004140.unk_1a; + if (gUnknown_03004140.unk_1a) + { + gUnknown_03004140.unk_07 = 2; + } + else + { + gUnknown_03004140.unk_07 = 3; + } + } + if (gUnknown_03004140.unk_07 == 3) + { + gUnknown_03004140.unk_06 = 0; + gUnknown_03004140.unk_1a = 40; + gUnknown_03004140.unk_07 = 4; + gUnknown_03004140.unk_04 = 9; + } +} From 7a38a43f81e4aa5d6b9001d31b47e1a000786e3e Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 21 Nov 2017 09:14:43 -0500 Subject: [PATCH 069/123] sub_800C7B4 --- asm/link_rfu.s | 854 --------------------------------------------- include/librfu.h | 10 +- include/link_rfu.h | 2 +- src/link_rfu.c | 367 +++++++++++++++++++ 4 files changed, 377 insertions(+), 856 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index e33e66ed2..64f564d08 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,860 +5,6 @@ .text - thumb_func_start sub_800C7B4 -sub_800C7B4: @ 800C7B4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r6, r1, 16 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0xE] - adds r7, r0, 0 - cmp r1, 0 - bne _0800C7D2 - b _0800CC98 -_0800C7D2: - movs r0, 0 - strb r0, [r7, 0xE] - mov r0, r8 - subs r0, 0x10 - cmp r0, 0x2D - bls _0800C7E0 - b _0800CC8A -_0800C7E0: - lsls r0, 2 - ldr r1, =_0800C7F4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800C7F4: - .4byte _0800C8AC - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800C8D8 - .4byte _0800C8C4 - .4byte _0800CC8A - .4byte _0800C8EC - .4byte _0800C8FC - .4byte _0800C920 - .4byte _0800C940 - .4byte _0800C960 - .4byte _0800C9D0 - .4byte _0800CA02 - .4byte _0800CA18 - .4byte _0800CA60 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CBD8 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CAD0 - .4byte _0800CB1C - .4byte _0800CB64 - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC8A - .4byte _0800CC78 -_0800C8AC: - cmp r6, 0 - beq _0800C8B2 - b _0800CC8A -_0800C8B2: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - movs r1, 0x4 - strb r1, [r0, 0x5] - b _0800CC8A - .pool -_0800C8C4: - cmp r6, 0 - beq _0800C8CA - b _0800CC8A -_0800C8CA: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - b _0800CC8A - .pool -_0800C8D8: - cmp r6, 0 - beq _0800C8DE - b _0800CC8A -_0800C8DE: - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0x5] - strb r6, [r0, 0x4] - movs r0, 0 - b _0800CBF6 - .pool -_0800C8EC: - cmp r6, 0 - beq _0800C8F2 - b _0800CC8A -_0800C8F2: - ldr r1, =gUnknown_03004140 - movs r0, 0x6 - b _0800CA0C - .pool -_0800C8FC: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800C906 - b _0800CC8A -_0800C906: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C912 - b _0800CC8A -_0800C912: - movs r0, 0x7 - strb r0, [r1, 0x4] - movs r0, 0x8 - strb r0, [r1, 0x5] - b _0800CC8A - .pool -_0800C920: - cmp r6, 0 - beq _0800C926 - b _0800CC8A -_0800C926: - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x5] - strb r1, [r0, 0x4] - strb r6, [r0, 0x5] - ldrb r0, [r0, 0x7] - cmp r0, 0 - beq _0800C936 - b _0800CC8A -_0800C936: - movs r0, 0x13 - b _0800CBF6 - .pool -_0800C940: - cmp r6, 0 - beq _0800C946 - b _0800CC8A -_0800C946: - ldrb r0, [r7, 0xB] - cmp r0, 0x1 - bne _0800C956 - ldrh r0, [r7, 0x1A] - cmp r0, 0x1 - bls _0800C956 - subs r0, 0x1 - strh r0, [r7, 0x1A] -_0800C956: - ldr r1, =gUnknown_03004140 - movs r0, 0xA - b _0800CA0C - .pool -_0800C960: - cmp r6, 0 - bne _0800C9A6 - bl sub_800D294 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - ldr r4, =gUnknown_03004140 - strh r0, [r4, 0x14] - cmp r0, 0 - beq _0800C980 - movs r0, 0x20 - movs r1, 0x1 - bl sub_800D30C -_0800C980: - ldrb r0, [r4, 0xB] - cmp r0, 0 - beq _0800C9A6 - ldrh r0, [r4, 0x1A] - cmp r0, 0x1 - beq _0800C9A6 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0x4 - bne _0800C9A6 - bl rfu_REQ_endSearchParent - bl rfu_waitREQComplete - movs r0, 0x9 - strb r0, [r4, 0x4] - movs r0, 0x1 - strb r0, [r4, 0xB] -_0800C9A6: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800C9B0 - b _0800CC8A -_0800C9B0: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800C9BC - b _0800CC8A -_0800C9BC: - movs r0, 0xB - strb r0, [r1, 0x4] - movs r0, 0 - strb r0, [r1, 0x5] - b _0800CC8A - .pool -_0800C9D0: - cmp r6, 0 - beq _0800C9D6 - b _0800CC8A -_0800C9D6: - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x5] - strb r0, [r2, 0x4] - ldrb r1, [r2, 0x7] - cmp r1, 0 - bne _0800C9F4 - lsls r0, 24 - cmp r0, 0 - beq _0800C9EA - b _0800CC8A -_0800C9EA: - movs r0, 0x21 - b _0800CBF6 - .pool -_0800C9F4: - cmp r1, 0x7 - bne _0800C9FA - b _0800CC8A -_0800C9FA: - movs r0, 0x5 - strb r0, [r2, 0x4] - strb r0, [r2, 0x7] - b _0800CC8A -_0800CA02: - cmp r6, 0 - beq _0800CA08 - b _0800CC8A -_0800CA08: - ldr r1, =gUnknown_03004140 - movs r0, 0xD -_0800CA0C: - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] - b _0800CC8A - .pool -_0800CA18: - cmp r6, 0 - bne _0800CA3C - ldr r4, =gUnknown_03004140+0x10 - mov r0, sp - adds r1, r4, 0 - bl rfu_getConnectParentStatus - lsls r0, 16 - cmp r0, 0 - bne _0800CA3C - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CA3C - adds r1, r4, 0 - subs r1, 0x10 - movs r0, 0xE - strb r0, [r1, 0x4] -_0800CA3C: - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x1A] - cmp r0, 0 - bne _0800CA46 - b _0800CC8A -_0800CA46: - subs r0, 0x1 - strh r0, [r1, 0x1A] - lsls r0, 16 - cmp r0, 0 - beq _0800CA52 - b _0800CC8A -_0800CA52: - movs r0, 0xE - strb r0, [r1, 0x4] - b _0800CC8A - .pool -_0800CA60: - cmp r6, 0 - beq _0800CA66 - b _0800CC8A -_0800CA66: - ldr r4, =gUnknown_03004140+0x10 - mov r0, sp - adds r1, r4, 0 - bl rfu_getConnectParentStatus - lsls r0, 16 - cmp r0, 0 - beq _0800CA78 - b _0800CC8A -_0800CA78: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CA9C - adds r1, r4, 0 - subs r1, 0x10 - movs r0, 0x13 - strb r0, [r1, 0x4] - movs r0, 0xF - strb r0, [r1, 0x5] - movs r0, 0x22 - strh r0, [r1, 0x1E] - ldrb r0, [r1, 0x10] - strh r0, [r1, 0x14] - b _0800CABC - .pool -_0800CA9C: - adds r1, r4, 0 - subs r1, 0x10 - strb r6, [r1, 0x5] - strb r6, [r1, 0x4] - movs r0, 0x23 - strh r0, [r1, 0x1E] - mov r0, sp - ldrb r0, [r0] - strh r0, [r1, 0x14] - ldrb r0, [r1, 0x7] - cmp r0, 0 - beq _0800CABC - movs r0, 0x3 - strb r0, [r1, 0x7] - movs r0, 0x9 - strb r0, [r1, 0x4] -_0800CABC: - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x1E] - movs r1, 0x1 - bl sub_800D30C - movs r0, 0 - strh r0, [r4, 0x1E] - b _0800CC8A - .pool -_0800CAD0: - cmp r6, 0 - beq _0800CAD6 - b _0800CC8A -_0800CAD6: - ldr r2, =gUnknown_03007890 - ldr r3, [r2] - ldrb r0, [r3, 0x3] - movs r1, 0 - strh r0, [r7, 0x14] - movs r0, 0x11 - strb r0, [r7, 0x5] - strb r0, [r7, 0x4] - strb r1, [r7, 0x10] - ldrb r0, [r3, 0x3] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800CAF4 - b _0800CC8A -_0800CAF4: - adds r1, r7, 0 - movs r3, 0x1 -_0800CAF8: - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bls _0800CB08 - b _0800CC8A -_0800CB08: - ldr r0, [r2] - ldrb r0, [r0, 0x3] - ldrb r4, [r7, 0x10] - asrs r0, r4 - ands r0, r3 - cmp r0, 0 - beq _0800CAF8 - b _0800CC8A - .pool -_0800CB1C: - cmp r6, 0 - bne _0800CB3A - mov r0, sp - bl rfu_CHILD_getConnectRecoveryStatus - lsls r0, 16 - cmp r0, 0 - bne _0800CB3A - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0800CB3A - ldr r1, =gUnknown_03004140 - movs r0, 0x12 - strb r0, [r1, 0x4] -_0800CB3A: - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x10] - lsls r0, 1 - adds r1, r2, 0 - adds r1, 0x34 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, 0 - bne _0800CB4E - b _0800CC8A -_0800CB4E: - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _0800CB5A - b _0800CC8A -_0800CB5A: - movs r0, 0x12 - strb r0, [r2, 0x4] - b _0800CC8A - .pool -_0800CB64: - cmp r6, 0 - beq _0800CB6A - b _0800CC8A -_0800CB6A: - mov r0, sp - bl rfu_CHILD_getConnectRecoveryStatus - lsls r0, 16 - cmp r0, 0 - beq _0800CB78 - b _0800CC8A -_0800CB78: - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CB94 - ldr r1, =gUnknown_03004140 - movs r0, 0x13 - strb r0, [r1, 0x4] - movs r0, 0x16 - strb r0, [r1, 0x5] - movs r0, 0x32 - strh r0, [r1, 0x1E] - b _0800CBA8 - .pool -_0800CB94: - ldr r4, =gUnknown_03004140 - strb r6, [r4, 0x5] - strb r6, [r4, 0x4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bl sub_800D334 - movs r0, 0x33 - strh r0, [r4, 0x1E] -_0800CBA8: - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x34 - adds r0, r1 - movs r1, 0 - movs r4, 0 - strh r4, [r0] - adds r0, r5, 0 - adds r0, 0x30 - strb r1, [r0] - strb r1, [r5, 0xA] - ldrb r0, [r5, 0x1E] - movs r1, 0x1 - bl sub_800D30C - strh r4, [r5, 0x1E] - b _0800CC8A - .pool -_0800CBD8: - cmp r6, 0 - bne _0800CC8A - ldr r5, =gUnknown_03004140 - ldrb r1, [r5, 0x5] - adds r0, r1, 0 - cmp r0, 0x16 - bne _0800CC04 - ldrb r0, [r5, 0x11] - strb r0, [r5, 0x4] - ldrb r0, [r5, 0x12] - strb r0, [r5, 0x5] - ldrb r0, [r5, 0x2] - movs r0, 0x1 - strb r0, [r5, 0x2] - movs r0, 0x41 -_0800CBF6: - movs r1, 0 - bl sub_800D30C - b _0800CC8A - .pool -_0800CC04: - cmp r0, 0xF - bne _0800CC8A - strb r1, [r5, 0x4] - ldrb r0, [r5, 0x2] - movs r4, 0x1 - strb r4, [r5, 0x2] - movs r0, 0x41 - movs r1, 0 - bl sub_800D30C - adds r1, r5, 0 - adds r1, 0x24 - ldrb r0, [r5, 0x10] - lsls r4, r0 - ldrb r0, [r1] - orrs r4, r0 - strb r4, [r1] - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, 0x4 - adds r0, r1 - ldrh r1, [r5, 0x26] - movs r7, 0 - strh r1, [r0] - ldrb r1, [r5, 0x10] - movs r0, 0x4 - bl rfu_clearSlot - mov r4, sp - ldrb r0, [r5, 0x10] - movs r1, 0xE - bl rfu_NI_CHILD_setSendGameName - strb r0, [r4] - lsls r0, 24 - cmp r0, 0 - beq _0800CC8A - strb r7, [r5, 0x5] - strb r7, [r5, 0x4] - bl sub_800D610 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl sub_800D334 - mov r0, sp - ldrb r0, [r0] - strh r0, [r5, 0x14] - movs r0, 0x25 - movs r1, 0x1 - bl sub_800D30C - b _0800CC8A - .pool -_0800CC78: - cmp r6, 0 - bne _0800CC8A - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0x5] - strb r6, [r0, 0x4] - movs r0, 0x42 - movs r1, 0 - bl sub_800D30C -_0800CC8A: - ldr r1, =gUnknown_03004140 - movs r0, 0x1 - strb r0, [r1, 0xE] - b _0800CCE6 - .pool -_0800CC98: - cmp r6, 0x3 - bne _0800CCE6 - ldrb r0, [r7, 0xF] - cmp r0, 0 - beq _0800CCE6 - mov r3, r8 - cmp r3, 0x24 - beq _0800CCB0 - cmp r3, 0x26 - beq _0800CCB0 - cmp r3, 0x27 - bne _0800CCE6 -_0800CCB0: - bl rfu_REQ_RFUStatus - bl rfu_waitREQComplete - mov r0, sp - bl rfu_getRFUStatus - mov r0, sp - ldrb r0, [r0] - cmp r0, 0 - bne _0800CCE6 - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - bne _0800CCE6 - bl rfu_getSTWIRecvBuffer - ldr r1, [r4] - ldrb r1, [r1, 0x2] - strb r1, [r0, 0x4] - movs r1, 0x1 - strb r1, [r0, 0x5] - movs r0, 0x29 - bl sub_800C36C - movs r6, 0 -_0800CCE6: - mov r4, r8 - cmp r4, 0x26 - bne _0800CCEE - b _0800CE02 -_0800CCEE: - cmp r4, 0x26 - bgt _0800CD00 - cmp r4, 0x10 - bne _0800CCF8 - b _0800CE20 -_0800CCF8: - b _0800CE3E - .pool -_0800CD00: - mov r0, r8 - cmp r0, 0x30 - beq _0800CD0E - cmp r0, 0x3D - bne _0800CD0C - b _0800CE20 -_0800CD0C: - b _0800CE3E -_0800CD0E: - cmp r6, 0 - beq _0800CD14 - b _0800CE42 -_0800CD14: - bl rfu_getSTWIRecvBuffer - ldr r4, =gUnknown_03004140 - ldrb r0, [r0, 0x8] - strh r0, [r4, 0x14] - bl sub_800D358 - adds r2, r4, 0 - adds r2, 0x30 - ldrb r1, [r2] - cmp r1, 0 - beq _0800CD6A - ldrb r0, [r4, 0x14] - adds r3, r1, 0 - bics r3, r0 - adds r0, r3, 0 - strb r0, [r2] - movs r3, 0 - adds r7, r4, 0 - adds r1, r7, 0 - movs r5, 0x1 - adds r4, r1, 0 - adds r4, 0x34 - movs r2, 0 -_0800CD44: - ldrh r0, [r1, 0x14] - asrs r0, r3 - ands r0, r5 - cmp r0, 0 - beq _0800CD54 - lsls r0, r3, 1 - adds r0, r4 - strh r2, [r0] -_0800CD54: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800CD44 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x6] - cmp r0, 0 - bne _0800CD6A - strb r0, [r1, 0x5] - strb r0, [r1, 0x4] -_0800CD6A: - mov r3, sp - ldr r1, =gUnknown_03004140 - ldrb r2, [r1] - ldrb r0, [r1, 0x14] - ands r0, r2 - strb r0, [r3] - movs r3, 0 - adds r7, r1, 0 - ldr r2, =gUnknown_03007890 - mov r1, sp - movs r5, 0x1 - adds r4, r7, 0 -_0800CD82: - ldrb r0, [r1] - asrs r0, r3 - ands r0, r5 - cmp r0, 0 - beq _0800CD96 - ldrb r0, [r4, 0x1] - cmp r0, 0 - beq _0800CD96 - subs r0, 0x1 - strb r0, [r7, 0x1] -_0800CD96: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800CD82 - ldrb r1, [r7, 0x14] - ldrb r0, [r7] - bics r0, r1 - strb r0, [r7] - ldrb r1, [r7, 0x7] - cmp r1, 0 - beq _0800CDE0 - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0xFF - bne _0800CDF2 - cmp r1, 0x8 - bne _0800CDCC - ldrh r0, [r7, 0x1C] - strh r0, [r7, 0x1A] - movs r0, 0x6 - strb r0, [r7, 0x7] - b _0800CDDE - .pool -_0800CDCC: - ldrb r0, [r7, 0x4] - subs r0, 0x6 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _0800CDE0 - movs r0, 0x1 - strb r0, [r7, 0x7] - movs r0, 0x5 -_0800CDDE: - strb r0, [r7, 0x4] -_0800CDE0: - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0xFF - bne _0800CDF2 - ldrb r0, [r7, 0x4] - cmp r0, 0 - bne _0800CDF2 - movs r0, 0xFF - strb r0, [r7, 0x6] -_0800CDF2: - ldrb r0, [r7, 0xE] - cmp r0, 0 - bne _0800CE3E - movs r0, 0x40 - movs r1, 0x1 - bl sub_800D30C - b _0800CE3E -_0800CE02: - bl sub_800D20C - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0xFF - beq _0800CE3E - movs r0, 0x50 - movs r1, 0 - bl sub_800D30C - b _0800CE3E - .pool -_0800CE20: - cmp r6, 0 - bne _0800CE42 - ldr r0, =gUnknown_03004140 - strb r6, [r0, 0xD] - strb r6, [r0, 0x1] - strb r6, [r0] - movs r1, 0xFF - strb r1, [r0, 0x6] - bl sub_800D610 - mov r4, r8 - cmp r4, 0x3D - bne _0800CE3E - bl sub_800BFA0 -_0800CE3E: - cmp r6, 0 - beq _0800CE92 -_0800CE42: - ldr r7, =gUnknown_03004140 - mov r0, r8 - cmp r0, 0x1C - bne _0800CE74 - cmp r6, 0 - beq _0800CE74 - ldrb r0, [r7, 0x7] - cmp r0, 0x4 - bne _0800CE74 - ldr r2, =gUnknown_03007890 - ldr r1, [r2] - movs r0, 0x1 - strb r0, [r1] - ldr r1, [r2] - movs r0, 0xF - strb r0, [r1, 0x2] - bl sub_800D334 - bl rfu_waitREQComplete - b _0800CEA4 - .pool -_0800CE74: - movs r1, 0 - mov r3, r8 - strh r3, [r7, 0x14] - strh r6, [r7, 0x16] - ldrb r0, [r7, 0xE] - cmp r0, 0 - beq _0800CE86 - strb r1, [r7, 0x5] - strb r1, [r7, 0x4] -_0800CE86: - movs r0, 0xF0 - movs r1, 0x2 - bl sub_800D30C - bl sub_800D610 -_0800CE92: - mov r4, r8 - cmp r4, 0xFF - bne _0800CEA4 - movs r0, 0xF2 - movs r1, 0 - bl sub_800D30C - bl sub_800D610 -_0800CEA4: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800C7B4 - thumb_func_start sub_800CEB0 sub_800CEB0: @ 800CEB0 push {r4-r7,lr} diff --git a/include/librfu.h b/include/librfu.h index cdc33c91a..65e981dda 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -130,7 +130,8 @@ struct RfuUnk3 struct RfuUnk5 { u8 unk_00; - u8 filler_01[2]; + u8 unk_01; + u8 unk_02; u8 unk_03; u8 unk_04[4]; u8 unk_08; @@ -175,3 +176,10 @@ void rfu_REQ_CHILD_startConnectRecovery(u8); void rfu_REQ_CHILD_pollConnectRecovery(void); void rfu_REQ_CHILD_endConnectRecovery(void); void rfu_REQ_changeMasterSlave(void); +void rfu_REQ_RFUStatus(void); +void rfu_getRFUStatus(u8 *status); +u8 *rfu_getSTWIRecvBuffer(void); +u8 rfu_NI_CHILD_setSendGameName(u8 a0, u8 a1); +void rfu_clearSlot(u8 a0, u8 a1); +bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status); +bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1); diff --git a/include/link_rfu.h b/include/link_rfu.h index 7c1949bba..69c7d2e2b 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -40,7 +40,7 @@ struct UnkLinkRfuStruct_02022B2C struct UnkRfuStruct_1 { /* 0x000 */ u8 unk_00; /* 0x001 */ u8 unk_01; - /* 0x002 */ u8 unk_02; + /* 0x002 */ vu8 unk_02; /* 0x003 */ vu8 unk_03; /* 0x004 */ u8 unk_04; /* 0x005 */ u8 unk_05; diff --git a/src/link_rfu.c b/src/link_rfu.c index de0b782f8..12ec3e708 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -32,7 +32,10 @@ void sub_800D610(void); void sub_800C744(u32 a0); void sub_800CF34(void); void sub_800D158(void); +void sub_800D20C(void); void sub_800D268(void); +u8 sub_800D294(void); +void sub_800D358(void); void sub_800D434(void); // .rodata @@ -609,3 +612,367 @@ void sub_800C744(u32 a0) gUnknown_03004140.unk_04 = 9; } } + +void sub_800C7B4(u16 r8, u16 r6) +{ + u8 sp0; + register u8 *stwiRecvBuffer asm("r0"); + u8 *tmp; + u8 i; + + if (gUnknown_03004140.unk_0e != 0) + { + gUnknown_03004140.unk_0e = 0; + switch (r8) + { + case 16: + if (r6 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05; + gUnknown_03004140.unk_05 = 4; + } + break; + case 23: + if (r6 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05; + gUnknown_03004140.unk_05 = 0; + } + break; + case 22: + if (r6 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + sub_800D30C(0x00, 0x00); + } + break; + case 25: + if (r6 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 6; + } + break; + case 26: + if (gUnknown_03004140.unk_1a && --gUnknown_03004140.unk_1a == 0) + { + gUnknown_03004140.unk_04 = 7; + gUnknown_03004140.unk_05 = 8; + } + break; + case 27: + if (r6 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05; + gUnknown_03004140.unk_05 = 0; + if (gUnknown_03004140.unk_07 == 0) + { + sub_800D30C(0x13, 0x00); + } + } + break; + case 28: + if (r6 == 0) + { + if (gUnknown_03004140.unk_0b == 1 && gUnknown_03004140.unk_1a > 1) + { + gUnknown_03004140.unk_1a--; + } + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 10; + } + break; + case 29: + if (r6 == 0) + { + sp0 = sub_800D294(); + gUnknown_03004140.unk_14 = sp0; + if (sp0) + { + sub_800D30C(0x20, 0x01); + } + if (gUnknown_03004140.unk_0b && gUnknown_03004140.unk_1a != 1 && gUnknown_03007890->unk_08 == 4) + { + rfu_REQ_endSearchParent(); + rfu_waitREQComplete(); + gUnknown_03004140.unk_04 = 9; + gUnknown_03004140.unk_0b = 1; + } + } + if (gUnknown_03004140.unk_1a && --gUnknown_03004140.unk_1a == 0) + { + gUnknown_03004140.unk_04 = 11; + gUnknown_03004140.unk_05 = 0; + } + break; + case 30: + if (r6 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05; + if (gUnknown_03004140.unk_07 == 0) + { + if (gUnknown_03004140.unk_04 == 0) + { + sub_800D30C(0x21, 0x00); + } + } + else if (gUnknown_03004140.unk_07 != 7) + { + gUnknown_03004140.unk_04 = 5; + gUnknown_03004140.unk_07 = 5; + } + } + break; + case 31: + if (r6 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 13; + } + break; + case 32: + if (r6 == 0 && !rfu_getConnectParentStatus(&sp0, &gUnknown_03004140.unk_10) && !sp0) + { + gUnknown_03004140.unk_04 = 14; + } + if (gUnknown_03004140.unk_1a && --gUnknown_03004140.unk_1a == 0) + { + gUnknown_03004140.unk_04 = 14; + } + break; + case 33: + if (r6 == 0 && !rfu_getConnectParentStatus(&sp0, &gUnknown_03004140.unk_10)) + { + if (!sp0) + { + gUnknown_03004140.unk_04 = 19; + gUnknown_03004140.unk_05 = 15; + gUnknown_03004140.unk_1e = 0x22; + gUnknown_03004140.unk_14 = gUnknown_03004140.unk_10; + } + else + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + gUnknown_03004140.unk_1e = 0x23; + gUnknown_03004140.unk_14 = sp0; + if (gUnknown_03004140.unk_07) + { + gUnknown_03004140.unk_07 = 3; + gUnknown_03004140.unk_04 = 9; + } + } + sub_800D30C(gUnknown_03004140.unk_1e, 0x01); + gUnknown_03004140.unk_1e = 0; + } + break; + case 50: + if (r6 == 0) + { + gUnknown_03004140.unk_14 = gUnknown_03007890->unk_03; + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 17; + for (gUnknown_03004140.unk_10 = 0; gUnknown_03004140.unk_10 < 4; gUnknown_03004140.unk_10 ++) + { + if ((gUnknown_03007890->unk_03 >> gUnknown_03004140.unk_10) & 1) + { + break; + } + } + } + break; + case 51: + if (r6 == 0 && !rfu_CHILD_getConnectRecoveryStatus(&sp0) && sp0 < 2) + { + gUnknown_03004140.unk_04 = 18; + } + if (gUnknown_03004140.unk_34[gUnknown_03004140.unk_10] && --gUnknown_03004140.unk_34[gUnknown_03004140.unk_10] == 0) + { + gUnknown_03004140.unk_04 = 18; + } + break; + case 52: + if (r6 == 0 && !rfu_CHILD_getConnectRecoveryStatus(&sp0)) + { + if (!sp0) + { + gUnknown_03004140.unk_04 = 19; + gUnknown_03004140.unk_05 = 22; + gUnknown_03004140.unk_1e = 0x32; + } + else + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + sub_800D334(gUnknown_03007890->unk_03); + gUnknown_03004140.unk_1e = 0x33; + } + gUnknown_03004140.unk_34[gUnknown_03004140.unk_10] = 0; + gUnknown_03004140.unk_30 = 0; + gUnknown_03004140.unk_0a = 0; + sub_800D30C(gUnknown_03004140.unk_1e, 0x01); + gUnknown_03004140.unk_1e = 0; + } + break; + case 39: + if (r6 == 0) + { + if (gUnknown_03004140.unk_05 == 22) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_11; + gUnknown_03004140.unk_05 = gUnknown_03004140.unk_12; + gUnknown_03004140.unk_02 = 1; + sub_800D30C(0x41, 0x00); + } + else if (gUnknown_03004140.unk_05 == 15) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05; + gUnknown_03004140.unk_02 = 1; + sub_800D30C(0x41, 0x00); + gUnknown_03004140.unk_24 |= 1 << gUnknown_03004140.unk_10; + gUnknown_03004140.unk_28[gUnknown_03004140.unk_10] = gUnknown_03004140.unk_26; + rfu_clearSlot(4, gUnknown_03004140.unk_10); + tmp = &sp0; + *tmp = rfu_NI_CHILD_setSendGameName(gUnknown_03004140.unk_10, 0x0e); + if (*tmp) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + sub_800D610(); + sub_800D334(gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03); + gUnknown_03004140.unk_14 = sp0; + sub_800D30C(0x25, 0x01); + } + } + } + break; + case 61: + if (r6 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + sub_800D30C(0x42, 0x00); + } + break; + } + gUnknown_03004140.unk_0e = 1; + } + else if (r6 == 3 && gUnknown_03004140.unk_0f && (r8 == 0x24 || r8 == 0x26 || r8 == 0x27)) + { + rfu_REQ_RFUStatus(); + rfu_waitREQComplete(); + rfu_getRFUStatus(&sp0); + if (sp0 == 0 && gUnknown_03007890->unk_00 == 0) + { + stwiRecvBuffer = rfu_getSTWIRecvBuffer(); + stwiRecvBuffer[4] = gUnknown_03007890->unk_02; + stwiRecvBuffer[5] = 1; + sub_800C36C(0x29); + r6 = 0; + } + } + switch (r8) + { + case 48: + if (r6 == 0) + { + stwiRecvBuffer = rfu_getSTWIRecvBuffer(); + gUnknown_03004140.unk_14 = stwiRecvBuffer[8]; + sub_800D358(); + if (gUnknown_03004140.unk_30) + { + gUnknown_03004140.unk_30 &= ~gUnknown_03004140.unk_14; + for (i = 0; i < 4; i++) + { + if ((gUnknown_03004140.unk_14 >> i) & 1) + { + gUnknown_03004140.unk_34[i] = 0; + } + } + if (gUnknown_03004140.unk_06 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + } + } + sp0 = gUnknown_03004140.unk_00 & gUnknown_03004140.unk_14; + for (i = 0; i < 4; i++) + { + if ((sp0 >> i) & 1 && gUnknown_03004140.unk_01) + { + gUnknown_03004140.unk_01--; + } + } + gUnknown_03004140.unk_00 &= ~gUnknown_03004140.unk_14; + if (gUnknown_03004140.unk_07) + { + if (gUnknown_03007890->unk_00 == 0xFF) + { + if (gUnknown_03004140.unk_07 == 8) + { + gUnknown_03004140.unk_1a = gUnknown_03004140.unk_1c; + gUnknown_03004140.unk_07 = 6; + gUnknown_03004140.unk_04 = 6; + } + else if (gUnknown_03004140.unk_04 != 6 && gUnknown_03004140.unk_04 != 7) + { + gUnknown_03004140.unk_07 = 1; + gUnknown_03004140.unk_04 = 5; + } + } + } + if (gUnknown_03007890->unk_00 == 0xFF) + { + if (gUnknown_03004140.unk_04 == 0) + { + gUnknown_03004140.unk_06 = -1; + } + } + if (gUnknown_03004140.unk_0e == 0) + { + sub_800D30C(0x40, 0x01); + } + } + break; + case 38: + sub_800D20C(); + if (gUnknown_03007890->unk_00 != 0xFF) + { + sub_800D30C(0x50, 0x00); + } + break; + case 16: + case 61: + if (r6 == 0) + { + gUnknown_03004140.unk_0d = 0; + gUnknown_03004140.unk_01 = 0; + gUnknown_03004140.unk_00 = 0;; + gUnknown_03004140.unk_06 = -1; + sub_800D610(); + if (r8 == 61) + { + sub_800BFA0(); + } + } + break; + } + if (r6 != 0) + { + if (r8 == 28 && r6 != 0 && gUnknown_03004140.unk_07 == 4) + { + gUnknown_03007890->unk_00 = 1; + gUnknown_03007890->unk_02 = 15; + sub_800D334(15); + rfu_waitREQComplete(); + return; + } + else + { + gUnknown_03004140.unk_14 = r8; + gUnknown_03004140.unk_16 = r6; + if (gUnknown_03004140.unk_0e) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + } + sub_800D30C(0xf0, 0x02); + sub_800D610(); + } + } + if (r8 == 0xFF) + { + sub_800D30C(0xf2, 0x00); + sub_800D610(); + } +} From 73b0f9eb5358b839bfa5f3d1b4c4163fe893d428 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 22 Nov 2017 00:16:00 -0500 Subject: [PATCH 070/123] sub_800CEB0 --- asm/link_rfu.s | 64 ---------------------------------------------- include/librfu.h | 1 + include/link_rfu.h | 2 +- src/link_rfu.c | 41 ++++++++++++++++++++++++++++- 4 files changed, 42 insertions(+), 66 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 64f564d08..d1eb8c9d2 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,70 +5,6 @@ .text - thumb_func_start sub_800CEB0 -sub_800CEB0: @ 800CEB0 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r4, =gUnknown_03004140 - ldrb r7, [r4, 0xE] - movs r0, 0 - strb r0, [r4, 0xE] - movs r0, 0x1 - strb r0, [r4, 0xF] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r5, [r0] - cmp r5, 0 - bne _0800CEEC - adds r0, r6, 0 - bl sub_800C36C - ldrb r0, [r4, 0x2] - cmp r0, 0x1 - beq _0800CF04 - bl sub_800D610 - strb r5, [r4, 0xF] - strb r7, [r4, 0xE] - b _0800CF28 - .pool -_0800CEEC: - mov r0, sp - bl rfu_UNI_PARENT_getDRAC_ACK - lsls r0, 16 - cmp r0, 0 - bne _0800CF04 - mov r1, sp - ldrb r0, [r4, 0x3] - ldrb r1, [r1] - orrs r0, r1 - ldrb r1, [r4, 0x3] - strb r0, [r4, 0x3] -_0800CF04: - ldr r4, =gUnknown_03004140 - ldr r1, [r4, 0x44] - cmp r1, 0 - beq _0800CF20 - adds r0, r6, 0 - bl _call_via_r1 - bl rfu_waitREQComplete - ldrb r0, [r4, 0x2] - cmp r0, 0x2 - bne _0800CF20 - bl sub_800D610 -_0800CF20: - ldr r1, =gUnknown_03004140 - movs r0, 0 - strb r0, [r1, 0xF] - strb r7, [r1, 0xE] -_0800CF28: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800CEB0 - thumb_func_start sub_800CF34 sub_800CF34: @ 800CF34 push {r4-r7,lr} diff --git a/include/librfu.h b/include/librfu.h index 65e981dda..7891f8679 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -183,3 +183,4 @@ u8 rfu_NI_CHILD_setSendGameName(u8 a0, u8 a1); void rfu_clearSlot(u8 a0, u8 a1); bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status); bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1); +bool16 rfu_UNI_PARENT_getDRAC_ACK(u8 *a0); diff --git a/include/link_rfu.h b/include/link_rfu.h index 69c7d2e2b..8634a4706 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -74,7 +74,7 @@ struct UnkRfuStruct_1 { /* 0x034 */ u16 unk_34[4]; /* 0x03c */ struct UnkLinkRfuStruct_02022B2C *unk_3c; /* 0x040 */ void (*unk_40)(u8); - /* 0x044 */ void (*unk_44)(void); + /* 0x044 */ void (*unk_44)(u16); /* 0x048 */ u8 filler_48[0xe78]; }; diff --git a/src/link_rfu.c b/src/link_rfu.c index 12ec3e708..5beb7c88b 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -84,7 +84,7 @@ void rfu_REQ_sendData_wrapper(u8 r2) rfu_REQ_sendData(r2); } -int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) +int sub_800BF4C(void (*func1)(u8), void (*func2)(u16)) { if (func1 == NULL) { @@ -976,3 +976,42 @@ void sub_800C7B4(u16 r8, u16 r6) sub_800D610(); } } + +void sub_800CEB0(u16 r6) +{ + u8 r7; + u8 sp0; + + r7 = gUnknown_03004140.unk_0e; + gUnknown_03004140.unk_0e = 0; + gUnknown_03004140.unk_0f = 1; + if (gUnknown_03007890->unk_00 == 0) + { + sub_800C36C(r6); + if (gUnknown_03004140.unk_02 != 1) + { + sub_800D610(); + gUnknown_03004140.unk_0f = 0; + gUnknown_03004140.unk_0e = r7; + return; + } + } + else + { + if (!rfu_UNI_PARENT_getDRAC_ACK(&sp0)) + { + gUnknown_03004140.unk_03 |= sp0; + } + } + if (gUnknown_03004140.unk_44 != NULL) + { + gUnknown_03004140.unk_44(r6); + rfu_waitREQComplete(); + if (gUnknown_03004140.unk_02 == 2) + { + sub_800D610(); + } + } + gUnknown_03004140.unk_0f = 0; + gUnknown_03004140.unk_0e = r7; +} From 3f00d341d56ded86572e7528065def4e4f74687d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 28 Nov 2017 19:41:32 -0500 Subject: [PATCH 071/123] nonmatching sub_800CF34 --- asm/link_rfu.s | 274 ----------------------------- include/librfu.h | 14 +- src/link_rfu.c | 438 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 427 insertions(+), 299 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 3c825581f..07de82aba 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,280 +5,6 @@ .text - thumb_func_start sub_800CF34 -sub_800CF34: @ 800CF34 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - subs r0, 0x5 - lsls r0, 24 - lsrs r0, 24 - adds r3, r1, 0 - cmp r0, 0x3 - bls _0800CF52 - b _0800D146 -_0800CF52: - ldr r0, =gUnknown_03007890 - ldr r2, [r0] - ldrb r1, [r2, 0x2] - ldrb r0, [r3, 0xC] - adds r4, r1, 0 - eors r4, r0 - ands r4, r1 - ldrb r0, [r2, 0x7] - bics r4, r0 - mov r8, r4 - strb r1, [r3, 0xC] - cmp r4, 0 - beq _0800CF7A - strh r4, [r3, 0x14] - movs r0, 0x10 - movs r1, 0x1 - str r3, [sp, 0x4] - bl sub_800D30C - ldr r3, [sp, 0x4] -_0800CF7A: - movs r0, 0 - str r0, [sp] - movs r6, 0 - adds r7, r3, 0 - movs r1, 0x24 - adds r1, r3 - mov r9, r1 -_0800CF88: - movs r0, 0x80 - lsls r0, 17 - lsls r0, r6 - lsrs r4, r0, 24 - movs r5, 0 - mov r0, r8 - ands r0, r4 - cmp r0, 0 - beq _0800CFDA - lsls r1, r6, 1 - adds r0, r7, 0 - adds r0, 0x28 - adds r1, r0 - ldrh r0, [r7, 0x26] - strh r0, [r1] - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r2] - adds r6, 0x1 - mov r10, r6 - b _0800D090 - .pool -_0800CFC0: - ldrb r1, [r7] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r7] - ldrb r0, [r7, 0x1] - adds r0, 0x1 - strb r0, [r7, 0x1] - ldr r0, [sp] - orrs r0, r4 - str r0, [sp] - movs r0, 0x1 - orrs r5, r0 - b _0800D024 -_0800CFDA: - mov r1, r9 - ldrb r0, [r1] - ands r0, r4 - adds r2, r6, 0x1 - mov r10, r2 - cmp r0, 0 - beq _0800D090 - ldr r0, =gUnknown_03007880 - lsls r1, r6, 2 - adds r1, r0 - ldr r1, [r1] - ldrh r0, [r1, 0x34] - cmp r0, 0x46 - bne _0800D040 - adds r0, r1, 0 - adds r0, 0x61 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800D058 - movs r5, 0x2 - ldr r3, [r3, 0x20] - ldrh r2, [r3] - ldr r0, =0x0000ffff - cmp r2, r0 - beq _0800D024 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - lsls r1, r6, 5 - adds r0, r1 - ldrh r0, [r0, 0x18] - ldr r1, =0x0000ffff -_0800D018: - cmp r0, r2 - beq _0800CFC0 - adds r3, 0x2 - ldrh r2, [r3] - cmp r2, r1 - bne _0800D018 -_0800D024: - movs r0, 0x1 - ands r0, r5 - cmp r0, 0 - bne _0800D058 - movs r0, 0x4 - orrs r5, r0 - b _0800D058 - .pool -_0800D040: - lsls r1, r6, 1 - adds r0, r3, 0 - adds r0, 0x28 - adds r1, r0 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - ldr r1, =0x0000ffff - ands r0, r1 - cmp r0, 0 - bne _0800D058 - movs r5, 0x6 -_0800D058: - movs r0, 0x2 - ands r0, r5 - cmp r0, 0 - beq _0800D07E - mov r2, r9 - ldrb r0, [r2] - bics r0, r4 - movs r2, 0 - mov r1, r9 - strb r0, [r1] - lsls r0, r6, 1 - adds r1, r7, 0 - adds r1, 0x28 - adds r0, r1 - strh r2, [r0] - movs r0, 0x8 - adds r1, r6, 0 - bl rfu_clearSlot -_0800D07E: - movs r0, 0x4 - ands r5, r0 - ldr r3, =gUnknown_03004140 - cmp r5, 0 - beq _0800D090 - ldrb r1, [r7, 0xD] - adds r0, r4, 0 - orrs r0, r1 - strb r0, [r7, 0xD] -_0800D090: - mov r2, r10 - lsls r0, r2, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bhi _0800D09C - b _0800CF88 -_0800D09C: - ldr r4, [sp] - cmp r4, 0 - beq _0800D0AE - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x11 - movs r1, 0x1 - bl sub_800D30C -_0800D0AE: - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0xD] - cmp r0, 0 - beq _0800D0EA - movs r5, 0x1 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0 - beq _0800D0CE - ldrb r0, [r1, 0x3] - ldrb r1, [r1] - ands r0, r1 - cmp r0, r1 - beq _0800D0CE - movs r5, 0 -_0800D0CE: - cmp r5, 0 - beq _0800D0EA - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0xD] - bl sub_800D334 - ldrb r0, [r4, 0xD] - movs r1, 0 - strh r0, [r4, 0x14] - strb r1, [r4, 0xD] - movs r0, 0x12 - movs r1, 0x1 - bl sub_800D30C -_0800D0EA: - ldr r0, =gUnknown_03004140 - adds r1, r0, 0 - adds r1, 0x24 - ldrb r1, [r1] - adds r3, r0, 0 - cmp r1, 0 - bne _0800D146 - ldrb r0, [r3, 0x4] - cmp r0, 0x8 - bne _0800D146 - ldrb r0, [r3, 0x7] - cmp r0, 0 - bne _0800D120 - strb r0, [r3, 0x5] - strb r0, [r3, 0x4] - movs r0, 0x14 - movs r1, 0 - bl sub_800D30C - b _0800D146 - .pool -_0800D120: - cmp r0, 0x2 - bne _0800D12C - movs r0, 0x3 - strb r0, [r3, 0x7] - movs r0, 0x9 - b _0800D132 -_0800D12C: - movs r0, 0x1 - strb r0, [r3, 0x7] - movs r0, 0x5 -_0800D132: - strb r0, [r3, 0x4] - ldrb r0, [r3] - cmp r0, 0 - beq _0800D146 - movs r0, 0 - strh r0, [r3, 0x1A] - movs r0, 0x8 - strb r0, [r3, 0x7] - movs r0, 0x5 - strb r0, [r3, 0x4] -_0800D146: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800CF34 - thumb_func_start sub_800D158 sub_800D158: @ 800D158 push {r4-r6,lr} diff --git a/include/librfu.h b/include/librfu.h index 7891f8679..05d895148 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -113,7 +113,11 @@ struct RfuUnk1 struct RfuUnk2 { - u8 unk_0[0x68]; + u8 unk_0[0x34]; + u16 unk_34; + u8 fill_36[0x2b]; + u8 unk_61; + u8 fill_62[6]; u32 unk_68; u32 unk_6c; u8 unk_70[0x70]; @@ -133,11 +137,15 @@ struct RfuUnk5 u8 unk_01; u8 unk_02; u8 unk_03; - u8 unk_04[4]; + u8 unk_04; + u8 unk_05; + u8 unk_06; + u8 unk_07; u8 unk_08; u8 filler_09[11]; u16 unk_14; - u8 filler_16[10]; + u8 filler_16[2]; + u16 unk_18[4]; }; extern struct RfuStruct *gRfuState; diff --git a/src/link_rfu.c b/src/link_rfu.c index 5beb7c88b..9f06e9141 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -68,7 +68,7 @@ u32 sub_800BEC0(void) void rfu_REQ_sendData_wrapper(u8 r2) { u8 val; - if (!gUnknown_03007890->unk_00) + if (!gUnknown_03007890[0].unk_00) { val = gUnknown_03004140.unk_02; r2 = 0; @@ -220,7 +220,7 @@ u8 sub_800C12C(u16 r6, u16 r8) sub_800D30C(0xF3, 0x01); return 2; } - for (i = 0; i < gUnknown_03007890->unk_08; i++) + for (i = 0; i < gUnknown_03007890[0].unk_08; i++) { tmp = &gUnknown_03007890[i]; if (tmp->unk_14 == r6) @@ -228,7 +228,7 @@ u8 sub_800C12C(u16 r6, u16 r8) break; } } - if (gUnknown_03007890->unk_08 == 0 || i == gUnknown_03007890->unk_08) + if (gUnknown_03007890[0].unk_08 == 0 || i == gUnknown_03007890[0].unk_08) { gUnknown_03004140.unk_14 = 3; sub_800D30C(0xF3, 0x01); @@ -267,7 +267,7 @@ void sub_800C210(u8 a0) gUnknown_03004140.unk_34[i] = 0; } } - i = gUnknown_03007890->unk_03 & a0; + i = gUnknown_03007890[0].unk_03 & a0; if (i) { sub_800D334(i); @@ -336,8 +336,8 @@ void sub_800C27C(bool8 a0) case 16: gUnknown_03004140.unk_04 = gUnknown_03004140.unk_11; gUnknown_03004140.unk_05 = gUnknown_03004140.unk_12; - sub_800D334(gUnknown_03007890->unk_03); - gUnknown_03004140.unk_14 = gUnknown_03007890->unk_03; + sub_800D334(gUnknown_03007890[0].unk_03); + gUnknown_03004140.unk_14 = gUnknown_03007890[0].unk_03; sub_800D30C(0x33, 0x01); return; case 17: @@ -409,7 +409,7 @@ bool8 sub_800C36C(u16 a0) } sub_800D610(); } - if (gUnknown_03007890->unk_00 == 1) + if (gUnknown_03007890[0].unk_00 == 1) { if (sp2) { @@ -540,7 +540,7 @@ void sub_800C54C(u32 a0) case 15: break; case 16: - rfu_REQ_CHILD_startConnectRecovery(gUnknown_03007890->unk_03); + rfu_REQ_CHILD_startConnectRecovery(gUnknown_03007890[0].unk_03); break; case 17: rfu_REQ_CHILD_pollConnectRecovery(); @@ -563,7 +563,7 @@ void sub_800C54C(u32 a0) gUnknown_03004140.unk_0e = 0; } } while (gUnknown_03004140.unk_04 == 18 || gUnknown_03004140.unk_04 == 19); - if (gUnknown_03007890->unk_00 != 1 || !sub_800C36C(0)) + if (gUnknown_03007890[0].unk_00 != 1 || !sub_800C36C(0)) { sub_800CF34(); sub_800D158(); @@ -689,7 +689,7 @@ void sub_800C7B4(u16 r8, u16 r6) { sub_800D30C(0x20, 0x01); } - if (gUnknown_03004140.unk_0b && gUnknown_03004140.unk_1a != 1 && gUnknown_03007890->unk_08 == 4) + if (gUnknown_03004140.unk_0b && gUnknown_03004140.unk_1a != 1 && gUnknown_03007890[0].unk_08 == 4) { rfu_REQ_endSearchParent(); rfu_waitREQComplete(); @@ -765,11 +765,11 @@ void sub_800C7B4(u16 r8, u16 r6) case 50: if (r6 == 0) { - gUnknown_03004140.unk_14 = gUnknown_03007890->unk_03; + gUnknown_03004140.unk_14 = gUnknown_03007890[0].unk_03; gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 17; for (gUnknown_03004140.unk_10 = 0; gUnknown_03004140.unk_10 < 4; gUnknown_03004140.unk_10 ++) { - if ((gUnknown_03007890->unk_03 >> gUnknown_03004140.unk_10) & 1) + if ((gUnknown_03007890[0].unk_03 >> gUnknown_03004140.unk_10) & 1) { break; } @@ -798,7 +798,7 @@ void sub_800C7B4(u16 r8, u16 r6) else { gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; - sub_800D334(gUnknown_03007890->unk_03); + sub_800D334(gUnknown_03007890[0].unk_03); gUnknown_03004140.unk_1e = 0x33; } gUnknown_03004140.unk_34[gUnknown_03004140.unk_10] = 0; @@ -832,7 +832,7 @@ void sub_800C7B4(u16 r8, u16 r6) { gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; sub_800D610(); - sub_800D334(gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03); + sub_800D334(gUnknown_03007890[0].unk_02 | gUnknown_03007890[0].unk_03); gUnknown_03004140.unk_14 = sp0; sub_800D30C(0x25, 0x01); } @@ -854,10 +854,10 @@ void sub_800C7B4(u16 r8, u16 r6) rfu_REQ_RFUStatus(); rfu_waitREQComplete(); rfu_getRFUStatus(&sp0); - if (sp0 == 0 && gUnknown_03007890->unk_00 == 0) + if (sp0 == 0 && gUnknown_03007890[0].unk_00 == 0) { stwiRecvBuffer = rfu_getSTWIRecvBuffer(); - stwiRecvBuffer[4] = gUnknown_03007890->unk_02; + stwiRecvBuffer[4] = gUnknown_03007890[0].unk_02; stwiRecvBuffer[5] = 1; sub_800C36C(0x29); r6 = 0; @@ -897,7 +897,7 @@ void sub_800C7B4(u16 r8, u16 r6) gUnknown_03004140.unk_00 &= ~gUnknown_03004140.unk_14; if (gUnknown_03004140.unk_07) { - if (gUnknown_03007890->unk_00 == 0xFF) + if (gUnknown_03007890[0].unk_00 == 0xFF) { if (gUnknown_03004140.unk_07 == 8) { @@ -912,7 +912,7 @@ void sub_800C7B4(u16 r8, u16 r6) } } } - if (gUnknown_03007890->unk_00 == 0xFF) + if (gUnknown_03007890[0].unk_00 == 0xFF) { if (gUnknown_03004140.unk_04 == 0) { @@ -927,7 +927,7 @@ void sub_800C7B4(u16 r8, u16 r6) break; case 38: sub_800D20C(); - if (gUnknown_03007890->unk_00 != 0xFF) + if (gUnknown_03007890[0].unk_00 != 0xFF) { sub_800D30C(0x50, 0x00); } @@ -952,8 +952,8 @@ void sub_800C7B4(u16 r8, u16 r6) { if (r8 == 28 && r6 != 0 && gUnknown_03004140.unk_07 == 4) { - gUnknown_03007890->unk_00 = 1; - gUnknown_03007890->unk_02 = 15; + gUnknown_03007890[0].unk_00 = 1; + gUnknown_03007890[0].unk_02 = 15; sub_800D334(15); rfu_waitREQComplete(); return; @@ -985,7 +985,7 @@ void sub_800CEB0(u16 r6) r7 = gUnknown_03004140.unk_0e; gUnknown_03004140.unk_0e = 0; gUnknown_03004140.unk_0f = 1; - if (gUnknown_03007890->unk_00 == 0) + if (gUnknown_03007890[0].unk_00 == 0) { sub_800C36C(r6); if (gUnknown_03004140.unk_02 != 1) @@ -1015,3 +1015,397 @@ void sub_800CEB0(u16 r6) gUnknown_03004140.unk_0f = 0; gUnknown_03004140.unk_0e = r7; } + +#ifdef NONMATCHING +void sub_800CF34(void) +{ + u8 flags; + u8 sp0; + u8 i; + u8 r5; + u8 r4; + u16 *ptr; + + if (gUnknown_03004140.unk_04 == 5 || gUnknown_03004140.unk_04 == 6 || gUnknown_03004140.unk_04 == 7 || gUnknown_03004140.unk_04 == 8) + { + flags = ((gUnknown_03007890[0].unk_02 ^ gUnknown_03004140.unk_0c) & gUnknown_03007890[0].unk_02) & ~gUnknown_03007890[0].unk_07; + gUnknown_03004140.unk_0c = gUnknown_03007890[0].unk_02; + if (flags) + { + gUnknown_03004140.unk_14 = flags; + sub_800D30C(0x10, 0x01); + } + sp0 = 0x00; + for (i = 0; i < 4; i++) + { + r4 = 1 << i; + r5 = 0x00; + if (flags & r4) + { + gUnknown_03004140.unk_28[i] = gUnknown_03004140.unk_26; + gUnknown_03004140.unk_24 |= r4; + } + else if (gUnknown_03004140.unk_24 & r4) + { + if (gUnknown_03007880[i]->unk_34 == 0x46) + { + if (gUnknown_03007880[i]->unk_61 == 1) + { + r5 = 0x02; + for (ptr = gUnknown_03004140.unk_20; *ptr != 0xFFFF; ptr++) + { + if (*gUnknown_03007890[i].unk_18 == *ptr) // FIXME: Role of r0 and r1 is swapped + { + gUnknown_03004140.unk_00 |= r4; + gUnknown_03004140.unk_01++; + sp0 |= r4; + r5 |= 0x01; + break; + } + } + if (!(r5 & 0x01)) + { + r5 |= 0x04; + } + } + } + else if (--gUnknown_03004140.unk_28[i] == 0) + { + r5 = 0x06; + } + if (r5 & 0x02) + { + gUnknown_03004140.unk_24 &= ~r4; + gUnknown_03004140.unk_28[i] = 0; + rfu_clearSlot(0x08, i); + } + if (r5 & 0x04) + { + gUnknown_03004140.unk_0d |= r4; + } + } + } + if (sp0) + { + gUnknown_03004140.unk_14 = sp0; + sub_800D30C(0x11, 0x01); + } + if (gUnknown_03004140.unk_0d) + { + r5 = 0x01; + if (gUnknown_03007890[0].unk_06 && ((gUnknown_03004140.unk_03 & gUnknown_03004140.unk_00) != gUnknown_03004140.unk_00)) + { + r5 = 0x00; + } + if (r5) + { + sub_800D334(gUnknown_03004140.unk_0d); + gUnknown_03004140.unk_14 = gUnknown_03004140.unk_0d; + gUnknown_03004140.unk_0d = 0; + sub_800D30C(0x12, 0x01); + } + } + if (gUnknown_03004140.unk_24 == 0 && gUnknown_03004140.unk_04 == 8) + { + if (gUnknown_03004140.unk_07 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + sub_800D30C(0x14, 0x00); + } + else + { + if (gUnknown_03004140.unk_07 == 2) + { + gUnknown_03004140.unk_07 = 3; + gUnknown_03004140.unk_04 = 9; + } + else + { + gUnknown_03004140.unk_07 = 1; + gUnknown_03004140.unk_04 = 5; + } + if (gUnknown_03004140.unk_00) + { + gUnknown_03004140.unk_1a = 0; + gUnknown_03004140.unk_07 = 8; + gUnknown_03004140.unk_04 = 5; + } + } + } + } +} +#else +__attribute__((naked)) void sub_800CF34(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, 0x8\n" + "\tldr r1, =gUnknown_03004140\n" + "\tldrb r0, [r1, 0x4]\n" + "\tsubs r0, 0x5\n" + "\tlsls r0, 24\n" + "\tlsrs r0, 24\n" + "\tadds r3, r1, 0\n" + "\tcmp r0, 0x3\n" + "\tbls _0800CF52\n" + "\tb _0800D146_break\n" + "_0800CF52:\n" + "\tldr r0, =gUnknown_03007890\n" + "\tldr r2, [r0]\n" + "\tldrb r1, [r2, 0x2]\n" + "\tldrb r0, [r3, 0xC]\n" + "\tadds r4, r1, 0\n" + "\teors r4, r0\n" + "\tands r4, r1\n" + "\tldrb r0, [r2, 0x7]\n" + "\tbics r4, r0\n" + "\tmov r8, r4\n" + "\tstrb r1, [r3, 0xC]\n" + "\tcmp r4, 0\n" + "\tbeq _0800CF7A\n" + "\tstrh r4, [r3, 0x14]\n" + "\tmovs r0, 0x10\n" + "\tmovs r1, 0x1\n" + "\tstr r3, [sp, 0x4]\n" + "\tbl sub_800D30C\n" + "\tldr r3, [sp, 0x4]\n" + "_0800CF7A:\n" + "\tmovs r0, 0\n" + "\tstr r0, [sp]\n" + "\tmovs r6, 0\n" + "\tadds r7, r3, 0\n" + "\tmovs r1, 0x24\n" + "\tadds r1, r3\n" + "\tmov r9, r1\n" + "_0800CF88:\n" + "\tmovs r0, 0x80\n" + "\tlsls r0, 17\n" + "\tlsls r0, r6\n" + "\tlsrs r4, r0, 24\n" + "\tmovs r5, 0\n" + "\tmov r0, r8\n" + "\tands r0, r4\n" + "\tcmp r0, 0\n" + "\tbeq _0800CFDA\n" + "\tlsls r1, r6, 1\n" + "\tadds r0, r7, 0\n" + "\tadds r0, 0x28\n" + "\tadds r1, r0\n" + "\tldrh r0, [r7, 0x26]\n" + "\tstrh r0, [r1]\n" + "\tmov r2, r9\n" + "\tldrb r1, [r2]\n" + "\tadds r0, r4, 0\n" + "\torrs r0, r1\n" + "\tstrb r0, [r2]\n" + "\tadds r6, 0x1\n" + "\tmov r10, r6\n" + "\tb _0800D090\n" + "\t.pool\n" + "_0800CFC0:\n" + "\tldrb r1, [r7]\n" + "\tadds r0, r4, 0\n" + "\torrs r0, r1\n" + "\tstrb r0, [r7]\n" + "\tldrb r0, [r7, 0x1]\n" + "\tadds r0, 0x1\n" + "\tstrb r0, [r7, 0x1]\n" + "\tldr r0, [sp]\n" + "\torrs r0, r4\n" + "\tstr r0, [sp]\n" + "\tmovs r0, 0x1\n" + "\torrs r5, r0\n" + "\tb _0800D024\n" + "_0800CFDA:\n" + "\tmov r1, r9\n" + "\tldrb r0, [r1]\n" + "\tands r0, r4\n" + "\tadds r2, r6, 0x1\n" + "\tmov r10, r2\n" + "\tcmp r0, 0\n" + "\tbeq _0800D090\n" + "\tldr r0, =gUnknown_03007880\n" + "\tlsls r1, r6, 2\n" + "\tadds r1, r0\n" + "\tldr r1, [r1]\n" + "\tldrh r0, [r1, 0x34]\n" + "\tcmp r0, 0x46\n" + "\tbne _0800D040\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0x61\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0x1\n" + "\tbne _0800D058\n" + "\tmovs r5, 0x2\n" + "\tldr r3, [r3, 0x20]\n" + "\tldrh r2, [r3]\n" + "\tldr r0, =0x0000ffff\n" + "\tcmp r2, r0\n" + "\tbeq _0800D024\n" + "\tldr r0, =gUnknown_03007890\n" + "\tldr r0, [r0]\n" + "\tlsls r1, r6, 5\n" + "\tadds r0, r1\n" + "\tldrh r0, [r0, 0x18]\n" + "\tldr r1, =0x0000ffff\n" + "_0800D018:\n" + "\tcmp r0, r2\n" + "\tbeq _0800CFC0\n" + "\tadds r3, 0x2\n" + "\tldrh r2, [r3]\n" + "\tcmp r2, r1\n" + "\tbne _0800D018\n" + "_0800D024:\n" + "\tmovs r0, 0x1\n" + "\tands r0, r5\n" + "\tcmp r0, 0\n" + "\tbne _0800D058\n" + "\tmovs r0, 0x4\n" + "\torrs r5, r0\n" + "\tb _0800D058\n" + "\t.pool\n" + "_0800D040:\n" + "\tlsls r1, r6, 1\n" + "\tadds r0, r3, 0\n" + "\tadds r0, 0x28\n" + "\tadds r1, r0\n" + "\tldrh r0, [r1]\n" + "\tsubs r0, 0x1\n" + "\tstrh r0, [r1]\n" + "\tldr r1, =0x0000ffff\n" + "\tands r0, r1\n" + "\tcmp r0, 0\n" + "\tbne _0800D058\n" + "\tmovs r5, 0x6\n" + "_0800D058:\n" + "\tmovs r0, 0x2\n" + "\tands r0, r5\n" + "\tcmp r0, 0\n" + "\tbeq _0800D07E\n" + "\tmov r2, r9\n" + "\tldrb r0, [r2]\n" + "\tbics r0, r4\n" + "\tmovs r2, 0\n" + "\tmov r1, r9\n" + "\tstrb r0, [r1]\n" + "\tlsls r0, r6, 1\n" + "\tadds r1, r7, 0\n" + "\tadds r1, 0x28\n" + "\tadds r0, r1\n" + "\tstrh r2, [r0]\n" + "\tmovs r0, 0x8\n" + "\tadds r1, r6, 0\n" + "\tbl rfu_clearSlot\n" + "_0800D07E:\n" + "\tmovs r0, 0x4\n" + "\tands r5, r0\n" + "\tldr r3, =gUnknown_03004140\n" + "\tcmp r5, 0\n" + "\tbeq _0800D090\n" + "\tldrb r1, [r7, 0xD]\n" + "\tadds r0, r4, 0\n" + "\torrs r0, r1\n" + "\tstrb r0, [r7, 0xD]\n" + "_0800D090:\n" + "\tmov r2, r10\n" + "\tlsls r0, r2, 24\n" + "\tlsrs r6, r0, 24\n" + "\tcmp r6, 0x3\n" + "\tbhi _0800D09C\n" + "\tb _0800CF88\n" + "_0800D09C:\n" + "\tldr r4, [sp]\n" + "\tcmp r4, 0\n" + "\tbeq _0800D0AE\n" + "\tldr r0, =gUnknown_03004140\n" + "\tstrh r4, [r0, 0x14]\n" + "\tmovs r0, 0x11\n" + "\tmovs r1, 0x1\n" + "\tbl sub_800D30C\n" + "_0800D0AE:\n" + "\tldr r1, =gUnknown_03004140\n" + "\tldrb r0, [r1, 0xD]\n" + "\tcmp r0, 0\n" + "\tbeq _0800D0EA\n" + "\tmovs r5, 0x1\n" + "\tldr r0, =gUnknown_03007890\n" + "\tldr r0, [r0]\n" + "\tldrb r0, [r0, 0x6]\n" + "\tcmp r0, 0\n" + "\tbeq _0800D0CE\n" + "\tldrb r0, [r1, 0x3]\n" + "\tldrb r1, [r1]\n" + "\tands r0, r1\n" + "\tcmp r0, r1\n" + "\tbeq _0800D0CE\n" + "\tmovs r5, 0\n" + "_0800D0CE:\n" + "\tcmp r5, 0\n" + "\tbeq _0800D0EA\n" + "\tldr r4, =gUnknown_03004140\n" + "\tldrb r0, [r4, 0xD]\n" + "\tbl sub_800D334\n" + "\tldrb r0, [r4, 0xD]\n" + "\tmovs r1, 0\n" + "\tstrh r0, [r4, 0x14]\n" + "\tstrb r1, [r4, 0xD]\n" + "\tmovs r0, 0x12\n" + "\tmovs r1, 0x1\n" + "\tbl sub_800D30C\n" + "_0800D0EA:\n" + "\tldr r0, =gUnknown_03004140\n" + "\tadds r1, r0, 0\n" + "\tadds r1, 0x24\n" + "\tldrb r1, [r1]\n" + "\tadds r3, r0, 0\n" + "\tcmp r1, 0\n" + "\tbne _0800D146_break\n" + "\tldrb r0, [r3, 0x4]\n" + "\tcmp r0, 0x8\n" + "\tbne _0800D146_break\n" + "\tldrb r0, [r3, 0x7]\n" + "\tcmp r0, 0\n" + "\tbne _0800D120\n" + "\tstrb r0, [r3, 0x5]\n" + "\tstrb r0, [r3, 0x4]\n" + "\tmovs r0, 0x14\n" + "\tmovs r1, 0\n" + "\tbl sub_800D30C\n" + "\tb _0800D146_break\n" + "\t.pool\n" + "_0800D120:\n" + "\tcmp r0, 0x2\n" + "\tbne _0800D12C\n" + "\tmovs r0, 0x3\n" + "\tstrb r0, [r3, 0x7]\n" + "\tmovs r0, 0x9\n" + "\tb _0800D132\n" + "_0800D12C:\n" + "\tmovs r0, 0x1\n" + "\tstrb r0, [r3, 0x7]\n" + "\tmovs r0, 0x5\n" + "_0800D132:\n" + "\tstrb r0, [r3, 0x4]\n" + "\tldrb r0, [r3]\n" + "\tcmp r0, 0\n" + "\tbeq _0800D146_break\n" + "\tmovs r0, 0\n" + "\tstrh r0, [r3, 0x1A]\n" + "\tmovs r0, 0x8\n" + "\tstrb r0, [r3, 0x7]\n" + "\tmovs r0, 0x5\n" + "\tstrb r0, [r3, 0x4]\n" + "_0800D146_break:\n" + "\tadd sp, 0x8\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"); +} +#endif From 295e45c788f89bf06bdb8659338bb05ba70d81b2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 29 Nov 2017 08:46:16 -0500 Subject: [PATCH 072/123] sub_800D158 --- asm/link_rfu.s | 86 ------------------------------------------------ include/librfu.h | 3 +- src/link_rfu.c | 39 ++++++++++++++++++++-- 3 files changed, 38 insertions(+), 90 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 07de82aba..738ed91b9 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,92 +5,6 @@ .text - thumb_func_start sub_800D158 -sub_800D158: @ 800D158 - push {r4-r6,lr} - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r6, r0, 0 - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldrb r0, [r4, 0x4] - cmp r0, 0xF - bne _0800D1BC - ldrb r1, [r4, 0x10] - lsls r1, 1 - adds r5, r4, 0 - adds r5, 0x28 - adds r1, r5 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _0800D192 - ldr r1, =gUnknown_03007880 - ldrb r0, [r4, 0x10] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x27 - bne _0800D1BC -_0800D192: - bl sub_800D630 - movs r0, 0x18 - strb r0, [r4, 0x4] - ldrb r1, [r4, 0x10] - movs r0, 0x4 - bl rfu_clearSlot - adds r2, r4, 0 - adds r2, 0x24 - movs r1, 0x1 - ldrb r0, [r4, 0x10] - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r4, 0x10] - lsls r0, 1 - adds r0, r5 - movs r1, 0 - strh r1, [r0] -_0800D1BC: - ldr r0, =0x04000208 - strh r6, [r0] - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x4] - cmp r0, 0x18 - bne _0800D1F6 - ldrb r0, [r5, 0x2] - cmp r0, 0x1 - bne _0800D1D2 - bl sub_800D630 -_0800D1D2: - ldrb r0, [r5, 0x2] - adds r4, r0, 0 - cmp r4, 0 - bne _0800D1F6 - strb r4, [r5, 0x5] - strb r4, [r5, 0x4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl sub_800D334 - strh r4, [r5, 0x14] - movs r0, 0x25 - movs r1, 0x1 - bl sub_800D30C -_0800D1F6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D158 - thumb_func_start sub_800D20C sub_800D20C: @ 800D20C push {r4,r5,lr} diff --git a/include/librfu.h b/include/librfu.h index 05d895148..15c09a6d6 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -113,7 +113,8 @@ struct RfuUnk1 struct RfuUnk2 { - u8 unk_0[0x34]; + u16 unk_0; + u8 fill_2[0x32]; u16 unk_34; u8 fill_36[0x2b]; u8 unk_61; diff --git a/src/link_rfu.c b/src/link_rfu.c index 9f06e9141..36ae9c1d6 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -24,14 +24,15 @@ EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {}; // Static ROM declarations void sub_800C000(void); -void sub_800CEB0(u16 unk0); -void sub_800C7B4(u16 unk0, u16 unk1); +void sub_800CEB0(u16 r6); +void sub_800C7B4(u16 r8, u16 r6); void sub_800D30C(u8 a0, u8 a1); void sub_800D334(u8 a0); void sub_800D610(void); +void sub_800D630(void); void sub_800C744(u32 a0); void sub_800CF34(void); -void sub_800D158(void); +static void sub_800D158(void); void sub_800D20C(void); void sub_800D268(void); u8 sub_800D294(void); @@ -1409,3 +1410,35 @@ __attribute__((naked)) void sub_800CF34(void) "\tbx r0"); } #endif + +static void sub_800D158(void) +{ + u16 imeBak = REG_IME; + REG_IME = 0; + if (gUnknown_03004140.unk_04 == 15) + { + if (--gUnknown_03004140.unk_28[gUnknown_03004140.unk_10] == 0 || gUnknown_03007880[gUnknown_03004140.unk_10]->unk_0 == 0x27) + { + sub_800D630(); + gUnknown_03004140.unk_04 = 24; + rfu_clearSlot(4, gUnknown_03004140.unk_10); + gUnknown_03004140.unk_24 &= ~(1 << gUnknown_03004140.unk_10); + gUnknown_03004140.unk_28[gUnknown_03004140.unk_10] = 0; + } + } + REG_IME = imeBak; + if (gUnknown_03004140.unk_04 == 24) + { + if (gUnknown_03004140.unk_02 == 1) + { + sub_800D630(); + } + if (gUnknown_03004140.unk_02 == 0) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + sub_800D334(gUnknown_03007890[0].unk_02 | gUnknown_03007890[0].unk_03); + gUnknown_03004140.unk_14 = 0; + sub_800D30C(0x25, 0x01); + } + } +} From c906978692e9663ecea16f2dcc01abcd9f2ef765 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 29 Nov 2017 23:58:48 -0500 Subject: [PATCH 073/123] through sub_800D294; fix sub_800CF34 --- asm/link_rfu.s | 135 ---------------- include/librfu.h | 12 +- src/link_rfu.c | 394 ++++++++++------------------------------------- 3 files changed, 89 insertions(+), 452 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 738ed91b9..bbf490508 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,141 +5,6 @@ .text - thumb_func_start sub_800D20C -sub_800D20C: @ 800D20C - push {r4,r5,lr} - ldr r5, =gUnknown_03004140 - ldrb r0, [r5, 0x4] - cmp r0, 0xF - bne _0800D258 - ldr r1, =gUnknown_03007880 - ldrb r2, [r5, 0x10] - lsls r0, r2, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x26 - bne _0800D258 - movs r4, 0 - strb r4, [r5, 0x5] - strb r4, [r5, 0x4] - movs r0, 0x4 - adds r1, r2, 0 - bl rfu_clearSlot - adds r2, r5, 0 - adds r2, 0x24 - movs r1, 0x1 - ldrb r0, [r5, 0x10] - lsls r1, r0 - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldrb r0, [r5, 0x10] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x28 - adds r0, r1 - strh r4, [r0] - movs r0, 0x24 - movs r1, 0 - bl sub_800D30C -_0800D258: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D20C - - thumb_func_start sub_800D268 -sub_800D268: @ 800D268 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x6] - cmp r0, 0 - bne _0800D28C - ldrb r0, [r1, 0xA] - cmp r0, 0x1 - bne _0800D28C - ldrb r0, [r1, 0x4] - strb r0, [r1, 0x11] - ldrb r0, [r1, 0x5] - strb r0, [r1, 0x12] - movs r0, 0x10 - strb r0, [r1, 0x4] - movs r0, 0x11 - strb r0, [r1, 0x5] - movs r0, 0x2 - strb r0, [r1, 0xA] -_0800D28C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D268 - - thumb_func_start sub_800D294 -sub_800D294: @ 800D294 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r6, 0 - movs r5, 0 - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - cmp r6, r0 - bcs _0800D2F0 - mov r8, r0 - ldr r0, =gUnknown_03004140 - mov r10, r0 - mov r9, r1 -_0800D2B4: - mov r1, r10 - ldr r3, [r1, 0x20] - ldrh r2, [r3] - adds r0, r5, 0x1 - mov r12, r0 - ldr r1, =0x0000ffff - cmp r2, r1 - beq _0800D2E6 - mov r1, r9 - ldr r0, [r1] - lsls r1, r5, 5 - adds r0, r1 - ldrh r4, [r0, 0x18] - ldr r7, =0x0000ffff - movs r1, 0x1 - lsls r1, r5 -_0800D2D4: - cmp r4, r2 - bne _0800D2DE - orrs r6, r1 - lsls r0, r6, 24 - lsrs r6, r0, 24 -_0800D2DE: - adds r3, 0x2 - ldrh r2, [r3] - cmp r2, r7 - bne _0800D2D4 -_0800D2E6: - mov r1, r12 - lsls r0, r1, 24 - lsrs r5, r0, 24 - cmp r5, r8 - bcc _0800D2B4 -_0800D2F0: - adds r0, r6, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D294 - thumb_func_start sub_800D30C sub_800D30C: @ 800D30C push {r4,lr} diff --git a/include/librfu.h b/include/librfu.h index 15c09a6d6..988ee1c0e 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -132,6 +132,14 @@ struct RfuUnk3 u32 unk_dc; }; +struct RfuUnkSub +{ + u16 unk_00; + u8 unk_02; + u16 unk_04; + u8 filler_06[26]; +}; + struct RfuUnk5 { u8 unk_00; @@ -144,9 +152,7 @@ struct RfuUnk5 u8 unk_07; u8 unk_08; u8 filler_09[11]; - u16 unk_14; - u8 filler_16[2]; - u16 unk_18[4]; + struct RfuUnkSub unk_14[4]; }; extern struct RfuStruct *gRfuState; diff --git a/src/link_rfu.c b/src/link_rfu.c index 36ae9c1d6..82a68214f 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -23,19 +23,19 @@ EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {}; // Static ROM declarations -void sub_800C000(void); +static void sub_800C000(void); void sub_800CEB0(u16 r6); void sub_800C7B4(u16 r8, u16 r6); void sub_800D30C(u8 a0, u8 a1); void sub_800D334(u8 a0); void sub_800D610(void); void sub_800D630(void); -void sub_800C744(u32 a0); -void sub_800CF34(void); +static void sub_800C744(u32 a0); +static void sub_800CF34(void); static void sub_800D158(void); -void sub_800D20C(void); -void sub_800D268(void); -u8 sub_800D294(void); +static void sub_800D20C(void); +static void sub_800D268(void); +static u8 sub_800D294(void); void sub_800D358(void); void sub_800D434(void); @@ -69,7 +69,7 @@ u32 sub_800BEC0(void) void rfu_REQ_sendData_wrapper(u8 r2) { u8 val; - if (!gUnknown_03007890[0].unk_00) + if (!gUnknown_03007890->unk_00) { val = gUnknown_03004140.unk_02; r2 = 0; @@ -121,7 +121,7 @@ void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0) } } -void sub_800C000(void) +static void sub_800C000(void) { u8 i; @@ -221,15 +221,14 @@ u8 sub_800C12C(u16 r6, u16 r8) sub_800D30C(0xF3, 0x01); return 2; } - for (i = 0; i < gUnknown_03007890[0].unk_08; i++) + for (i = 0; i < gUnknown_03007890->unk_08; i++) { - tmp = &gUnknown_03007890[i]; - if (tmp->unk_14 == r6) + if (gUnknown_03007890->unk_14[i].unk_00 == r6) { break; } } - if (gUnknown_03007890[0].unk_08 == 0 || i == gUnknown_03007890[0].unk_08) + if (gUnknown_03007890->unk_08 == 0 || i == gUnknown_03007890->unk_08) { gUnknown_03004140.unk_14 = 3; sub_800D30C(0xF3, 0x01); @@ -268,7 +267,7 @@ void sub_800C210(u8 a0) gUnknown_03004140.unk_34[i] = 0; } } - i = gUnknown_03007890[0].unk_03 & a0; + i = gUnknown_03007890->unk_03 & a0; if (i) { sub_800D334(i); @@ -337,8 +336,8 @@ void sub_800C27C(bool8 a0) case 16: gUnknown_03004140.unk_04 = gUnknown_03004140.unk_11; gUnknown_03004140.unk_05 = gUnknown_03004140.unk_12; - sub_800D334(gUnknown_03007890[0].unk_03); - gUnknown_03004140.unk_14 = gUnknown_03007890[0].unk_03; + sub_800D334(gUnknown_03007890->unk_03); + gUnknown_03004140.unk_14 = gUnknown_03007890->unk_03; sub_800D30C(0x33, 0x01); return; case 17: @@ -410,7 +409,7 @@ bool8 sub_800C36C(u16 a0) } sub_800D610(); } - if (gUnknown_03007890[0].unk_00 == 1) + if (gUnknown_03007890->unk_00 == 1) { if (sp2) { @@ -541,7 +540,7 @@ void sub_800C54C(u32 a0) case 15: break; case 16: - rfu_REQ_CHILD_startConnectRecovery(gUnknown_03007890[0].unk_03); + rfu_REQ_CHILD_startConnectRecovery(gUnknown_03007890->unk_03); break; case 17: rfu_REQ_CHILD_pollConnectRecovery(); @@ -564,7 +563,7 @@ void sub_800C54C(u32 a0) gUnknown_03004140.unk_0e = 0; } } while (gUnknown_03004140.unk_04 == 18 || gUnknown_03004140.unk_04 == 19); - if (gUnknown_03007890[0].unk_00 != 1 || !sub_800C36C(0)) + if (gUnknown_03007890->unk_00 != 1 || !sub_800C36C(0)) { sub_800CF34(); sub_800D158(); @@ -574,7 +573,7 @@ void sub_800C54C(u32 a0) } } -void sub_800C744(u32 a0) +static void sub_800C744(u32 a0) { if (gUnknown_03004140.unk_07 == 5) { @@ -690,7 +689,7 @@ void sub_800C7B4(u16 r8, u16 r6) { sub_800D30C(0x20, 0x01); } - if (gUnknown_03004140.unk_0b && gUnknown_03004140.unk_1a != 1 && gUnknown_03007890[0].unk_08 == 4) + if (gUnknown_03004140.unk_0b && gUnknown_03004140.unk_1a != 1 && gUnknown_03007890->unk_08 == 4) { rfu_REQ_endSearchParent(); rfu_waitREQComplete(); @@ -766,11 +765,11 @@ void sub_800C7B4(u16 r8, u16 r6) case 50: if (r6 == 0) { - gUnknown_03004140.unk_14 = gUnknown_03007890[0].unk_03; + gUnknown_03004140.unk_14 = gUnknown_03007890->unk_03; gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 17; for (gUnknown_03004140.unk_10 = 0; gUnknown_03004140.unk_10 < 4; gUnknown_03004140.unk_10 ++) { - if ((gUnknown_03007890[0].unk_03 >> gUnknown_03004140.unk_10) & 1) + if ((gUnknown_03007890->unk_03 >> gUnknown_03004140.unk_10) & 1) { break; } @@ -799,7 +798,7 @@ void sub_800C7B4(u16 r8, u16 r6) else { gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; - sub_800D334(gUnknown_03007890[0].unk_03); + sub_800D334(gUnknown_03007890->unk_03); gUnknown_03004140.unk_1e = 0x33; } gUnknown_03004140.unk_34[gUnknown_03004140.unk_10] = 0; @@ -833,7 +832,7 @@ void sub_800C7B4(u16 r8, u16 r6) { gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; sub_800D610(); - sub_800D334(gUnknown_03007890[0].unk_02 | gUnknown_03007890[0].unk_03); + sub_800D334(gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03); gUnknown_03004140.unk_14 = sp0; sub_800D30C(0x25, 0x01); } @@ -855,10 +854,10 @@ void sub_800C7B4(u16 r8, u16 r6) rfu_REQ_RFUStatus(); rfu_waitREQComplete(); rfu_getRFUStatus(&sp0); - if (sp0 == 0 && gUnknown_03007890[0].unk_00 == 0) + if (sp0 == 0 && gUnknown_03007890->unk_00 == 0) { stwiRecvBuffer = rfu_getSTWIRecvBuffer(); - stwiRecvBuffer[4] = gUnknown_03007890[0].unk_02; + stwiRecvBuffer[4] = gUnknown_03007890->unk_02; stwiRecvBuffer[5] = 1; sub_800C36C(0x29); r6 = 0; @@ -898,7 +897,7 @@ void sub_800C7B4(u16 r8, u16 r6) gUnknown_03004140.unk_00 &= ~gUnknown_03004140.unk_14; if (gUnknown_03004140.unk_07) { - if (gUnknown_03007890[0].unk_00 == 0xFF) + if (gUnknown_03007890->unk_00 == 0xFF) { if (gUnknown_03004140.unk_07 == 8) { @@ -913,7 +912,7 @@ void sub_800C7B4(u16 r8, u16 r6) } } } - if (gUnknown_03007890[0].unk_00 == 0xFF) + if (gUnknown_03007890->unk_00 == 0xFF) { if (gUnknown_03004140.unk_04 == 0) { @@ -928,7 +927,7 @@ void sub_800C7B4(u16 r8, u16 r6) break; case 38: sub_800D20C(); - if (gUnknown_03007890[0].unk_00 != 0xFF) + if (gUnknown_03007890->unk_00 != 0xFF) { sub_800D30C(0x50, 0x00); } @@ -953,8 +952,8 @@ void sub_800C7B4(u16 r8, u16 r6) { if (r8 == 28 && r6 != 0 && gUnknown_03004140.unk_07 == 4) { - gUnknown_03007890[0].unk_00 = 1; - gUnknown_03007890[0].unk_02 = 15; + gUnknown_03007890->unk_00 = 1; + gUnknown_03007890->unk_02 = 15; sub_800D334(15); rfu_waitREQComplete(); return; @@ -986,7 +985,7 @@ void sub_800CEB0(u16 r6) r7 = gUnknown_03004140.unk_0e; gUnknown_03004140.unk_0e = 0; gUnknown_03004140.unk_0f = 1; - if (gUnknown_03007890[0].unk_00 == 0) + if (gUnknown_03007890->unk_00 == 0) { sub_800C36C(r6); if (gUnknown_03004140.unk_02 != 1) @@ -1017,8 +1016,7 @@ void sub_800CEB0(u16 r6) gUnknown_03004140.unk_0e = r7; } -#ifdef NONMATCHING -void sub_800CF34(void) +static void sub_800CF34(void) { u8 flags; u8 sp0; @@ -1029,8 +1027,8 @@ void sub_800CF34(void) if (gUnknown_03004140.unk_04 == 5 || gUnknown_03004140.unk_04 == 6 || gUnknown_03004140.unk_04 == 7 || gUnknown_03004140.unk_04 == 8) { - flags = ((gUnknown_03007890[0].unk_02 ^ gUnknown_03004140.unk_0c) & gUnknown_03007890[0].unk_02) & ~gUnknown_03007890[0].unk_07; - gUnknown_03004140.unk_0c = gUnknown_03007890[0].unk_02; + flags = ((gUnknown_03007890->unk_02 ^ gUnknown_03004140.unk_0c) & gUnknown_03007890->unk_02) & ~gUnknown_03007890->unk_07; + gUnknown_03004140.unk_0c = gUnknown_03007890->unk_02; if (flags) { gUnknown_03004140.unk_14 = flags; @@ -1055,7 +1053,7 @@ void sub_800CF34(void) r5 = 0x02; for (ptr = gUnknown_03004140.unk_20; *ptr != 0xFFFF; ptr++) { - if (*gUnknown_03007890[i].unk_18 == *ptr) // FIXME: Role of r0 and r1 is swapped + if (gUnknown_03007890->unk_14[i].unk_04 == *ptr) { gUnknown_03004140.unk_00 |= r4; gUnknown_03004140.unk_01++; @@ -1094,7 +1092,7 @@ void sub_800CF34(void) if (gUnknown_03004140.unk_0d) { r5 = 0x01; - if (gUnknown_03007890[0].unk_06 && ((gUnknown_03004140.unk_03 & gUnknown_03004140.unk_00) != gUnknown_03004140.unk_00)) + if (gUnknown_03007890->unk_06 && ((gUnknown_03004140.unk_03 & gUnknown_03004140.unk_00) != gUnknown_03004140.unk_00)) { r5 = 0x00; } @@ -1135,281 +1133,6 @@ void sub_800CF34(void) } } } -#else -__attribute__((naked)) void sub_800CF34(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, 0x8\n" - "\tldr r1, =gUnknown_03004140\n" - "\tldrb r0, [r1, 0x4]\n" - "\tsubs r0, 0x5\n" - "\tlsls r0, 24\n" - "\tlsrs r0, 24\n" - "\tadds r3, r1, 0\n" - "\tcmp r0, 0x3\n" - "\tbls _0800CF52\n" - "\tb _0800D146_break\n" - "_0800CF52:\n" - "\tldr r0, =gUnknown_03007890\n" - "\tldr r2, [r0]\n" - "\tldrb r1, [r2, 0x2]\n" - "\tldrb r0, [r3, 0xC]\n" - "\tadds r4, r1, 0\n" - "\teors r4, r0\n" - "\tands r4, r1\n" - "\tldrb r0, [r2, 0x7]\n" - "\tbics r4, r0\n" - "\tmov r8, r4\n" - "\tstrb r1, [r3, 0xC]\n" - "\tcmp r4, 0\n" - "\tbeq _0800CF7A\n" - "\tstrh r4, [r3, 0x14]\n" - "\tmovs r0, 0x10\n" - "\tmovs r1, 0x1\n" - "\tstr r3, [sp, 0x4]\n" - "\tbl sub_800D30C\n" - "\tldr r3, [sp, 0x4]\n" - "_0800CF7A:\n" - "\tmovs r0, 0\n" - "\tstr r0, [sp]\n" - "\tmovs r6, 0\n" - "\tadds r7, r3, 0\n" - "\tmovs r1, 0x24\n" - "\tadds r1, r3\n" - "\tmov r9, r1\n" - "_0800CF88:\n" - "\tmovs r0, 0x80\n" - "\tlsls r0, 17\n" - "\tlsls r0, r6\n" - "\tlsrs r4, r0, 24\n" - "\tmovs r5, 0\n" - "\tmov r0, r8\n" - "\tands r0, r4\n" - "\tcmp r0, 0\n" - "\tbeq _0800CFDA\n" - "\tlsls r1, r6, 1\n" - "\tadds r0, r7, 0\n" - "\tadds r0, 0x28\n" - "\tadds r1, r0\n" - "\tldrh r0, [r7, 0x26]\n" - "\tstrh r0, [r1]\n" - "\tmov r2, r9\n" - "\tldrb r1, [r2]\n" - "\tadds r0, r4, 0\n" - "\torrs r0, r1\n" - "\tstrb r0, [r2]\n" - "\tadds r6, 0x1\n" - "\tmov r10, r6\n" - "\tb _0800D090\n" - "\t.pool\n" - "_0800CFC0:\n" - "\tldrb r1, [r7]\n" - "\tadds r0, r4, 0\n" - "\torrs r0, r1\n" - "\tstrb r0, [r7]\n" - "\tldrb r0, [r7, 0x1]\n" - "\tadds r0, 0x1\n" - "\tstrb r0, [r7, 0x1]\n" - "\tldr r0, [sp]\n" - "\torrs r0, r4\n" - "\tstr r0, [sp]\n" - "\tmovs r0, 0x1\n" - "\torrs r5, r0\n" - "\tb _0800D024\n" - "_0800CFDA:\n" - "\tmov r1, r9\n" - "\tldrb r0, [r1]\n" - "\tands r0, r4\n" - "\tadds r2, r6, 0x1\n" - "\tmov r10, r2\n" - "\tcmp r0, 0\n" - "\tbeq _0800D090\n" - "\tldr r0, =gUnknown_03007880\n" - "\tlsls r1, r6, 2\n" - "\tadds r1, r0\n" - "\tldr r1, [r1]\n" - "\tldrh r0, [r1, 0x34]\n" - "\tcmp r0, 0x46\n" - "\tbne _0800D040\n" - "\tadds r0, r1, 0\n" - "\tadds r0, 0x61\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0x1\n" - "\tbne _0800D058\n" - "\tmovs r5, 0x2\n" - "\tldr r3, [r3, 0x20]\n" - "\tldrh r2, [r3]\n" - "\tldr r0, =0x0000ffff\n" - "\tcmp r2, r0\n" - "\tbeq _0800D024\n" - "\tldr r0, =gUnknown_03007890\n" - "\tldr r0, [r0]\n" - "\tlsls r1, r6, 5\n" - "\tadds r0, r1\n" - "\tldrh r0, [r0, 0x18]\n" - "\tldr r1, =0x0000ffff\n" - "_0800D018:\n" - "\tcmp r0, r2\n" - "\tbeq _0800CFC0\n" - "\tadds r3, 0x2\n" - "\tldrh r2, [r3]\n" - "\tcmp r2, r1\n" - "\tbne _0800D018\n" - "_0800D024:\n" - "\tmovs r0, 0x1\n" - "\tands r0, r5\n" - "\tcmp r0, 0\n" - "\tbne _0800D058\n" - "\tmovs r0, 0x4\n" - "\torrs r5, r0\n" - "\tb _0800D058\n" - "\t.pool\n" - "_0800D040:\n" - "\tlsls r1, r6, 1\n" - "\tadds r0, r3, 0\n" - "\tadds r0, 0x28\n" - "\tadds r1, r0\n" - "\tldrh r0, [r1]\n" - "\tsubs r0, 0x1\n" - "\tstrh r0, [r1]\n" - "\tldr r1, =0x0000ffff\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbne _0800D058\n" - "\tmovs r5, 0x6\n" - "_0800D058:\n" - "\tmovs r0, 0x2\n" - "\tands r0, r5\n" - "\tcmp r0, 0\n" - "\tbeq _0800D07E\n" - "\tmov r2, r9\n" - "\tldrb r0, [r2]\n" - "\tbics r0, r4\n" - "\tmovs r2, 0\n" - "\tmov r1, r9\n" - "\tstrb r0, [r1]\n" - "\tlsls r0, r6, 1\n" - "\tadds r1, r7, 0\n" - "\tadds r1, 0x28\n" - "\tadds r0, r1\n" - "\tstrh r2, [r0]\n" - "\tmovs r0, 0x8\n" - "\tadds r1, r6, 0\n" - "\tbl rfu_clearSlot\n" - "_0800D07E:\n" - "\tmovs r0, 0x4\n" - "\tands r5, r0\n" - "\tldr r3, =gUnknown_03004140\n" - "\tcmp r5, 0\n" - "\tbeq _0800D090\n" - "\tldrb r1, [r7, 0xD]\n" - "\tadds r0, r4, 0\n" - "\torrs r0, r1\n" - "\tstrb r0, [r7, 0xD]\n" - "_0800D090:\n" - "\tmov r2, r10\n" - "\tlsls r0, r2, 24\n" - "\tlsrs r6, r0, 24\n" - "\tcmp r6, 0x3\n" - "\tbhi _0800D09C\n" - "\tb _0800CF88\n" - "_0800D09C:\n" - "\tldr r4, [sp]\n" - "\tcmp r4, 0\n" - "\tbeq _0800D0AE\n" - "\tldr r0, =gUnknown_03004140\n" - "\tstrh r4, [r0, 0x14]\n" - "\tmovs r0, 0x11\n" - "\tmovs r1, 0x1\n" - "\tbl sub_800D30C\n" - "_0800D0AE:\n" - "\tldr r1, =gUnknown_03004140\n" - "\tldrb r0, [r1, 0xD]\n" - "\tcmp r0, 0\n" - "\tbeq _0800D0EA\n" - "\tmovs r5, 0x1\n" - "\tldr r0, =gUnknown_03007890\n" - "\tldr r0, [r0]\n" - "\tldrb r0, [r0, 0x6]\n" - "\tcmp r0, 0\n" - "\tbeq _0800D0CE\n" - "\tldrb r0, [r1, 0x3]\n" - "\tldrb r1, [r1]\n" - "\tands r0, r1\n" - "\tcmp r0, r1\n" - "\tbeq _0800D0CE\n" - "\tmovs r5, 0\n" - "_0800D0CE:\n" - "\tcmp r5, 0\n" - "\tbeq _0800D0EA\n" - "\tldr r4, =gUnknown_03004140\n" - "\tldrb r0, [r4, 0xD]\n" - "\tbl sub_800D334\n" - "\tldrb r0, [r4, 0xD]\n" - "\tmovs r1, 0\n" - "\tstrh r0, [r4, 0x14]\n" - "\tstrb r1, [r4, 0xD]\n" - "\tmovs r0, 0x12\n" - "\tmovs r1, 0x1\n" - "\tbl sub_800D30C\n" - "_0800D0EA:\n" - "\tldr r0, =gUnknown_03004140\n" - "\tadds r1, r0, 0\n" - "\tadds r1, 0x24\n" - "\tldrb r1, [r1]\n" - "\tadds r3, r0, 0\n" - "\tcmp r1, 0\n" - "\tbne _0800D146_break\n" - "\tldrb r0, [r3, 0x4]\n" - "\tcmp r0, 0x8\n" - "\tbne _0800D146_break\n" - "\tldrb r0, [r3, 0x7]\n" - "\tcmp r0, 0\n" - "\tbne _0800D120\n" - "\tstrb r0, [r3, 0x5]\n" - "\tstrb r0, [r3, 0x4]\n" - "\tmovs r0, 0x14\n" - "\tmovs r1, 0\n" - "\tbl sub_800D30C\n" - "\tb _0800D146_break\n" - "\t.pool\n" - "_0800D120:\n" - "\tcmp r0, 0x2\n" - "\tbne _0800D12C\n" - "\tmovs r0, 0x3\n" - "\tstrb r0, [r3, 0x7]\n" - "\tmovs r0, 0x9\n" - "\tb _0800D132\n" - "_0800D12C:\n" - "\tmovs r0, 0x1\n" - "\tstrb r0, [r3, 0x7]\n" - "\tmovs r0, 0x5\n" - "_0800D132:\n" - "\tstrb r0, [r3, 0x4]\n" - "\tldrb r0, [r3]\n" - "\tcmp r0, 0\n" - "\tbeq _0800D146_break\n" - "\tmovs r0, 0\n" - "\tstrh r0, [r3, 0x1A]\n" - "\tmovs r0, 0x8\n" - "\tstrb r0, [r3, 0x7]\n" - "\tmovs r0, 0x5\n" - "\tstrb r0, [r3, 0x4]\n" - "_0800D146_break:\n" - "\tadd sp, 0x8\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"); -} -#endif static void sub_800D158(void) { @@ -1436,9 +1159,52 @@ static void sub_800D158(void) if (gUnknown_03004140.unk_02 == 0) { gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; - sub_800D334(gUnknown_03007890[0].unk_02 | gUnknown_03007890[0].unk_03); + sub_800D334(gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03); gUnknown_03004140.unk_14 = 0; sub_800D30C(0x25, 0x01); } } } + +static void sub_800D20C(void) +{ + if (gUnknown_03004140.unk_04 == 15 && gUnknown_03007880[gUnknown_03004140.unk_10]->unk_0 == 0x26) + { + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + rfu_clearSlot(4, gUnknown_03004140.unk_10); + gUnknown_03004140.unk_24 &= ~(1 << gUnknown_03004140.unk_10); + gUnknown_03004140.unk_28[gUnknown_03004140.unk_10] = 0; + sub_800D30C(0x24, 0x00); + } +} + +static void sub_800D268(void) +{ + if (gUnknown_03004140.unk_06 == 0 && gUnknown_03004140.unk_0a == 1) + { + gUnknown_03004140.unk_11 = gUnknown_03004140.unk_04; + gUnknown_03004140.unk_12 = gUnknown_03004140.unk_05; + gUnknown_03004140.unk_04 = 16; + gUnknown_03004140.unk_05 = 17; + gUnknown_03004140.unk_0a = 2; + } +} + +static u8 sub_800D294(void) +{ + u8 i; + u16 *ptr; + u8 flags = 0x00; + + for (i = 0; i < gUnknown_03007890->unk_08; i++) + { + for (ptr = gUnknown_03004140.unk_20; *ptr != 0xffff; ptr++) + { + if (gUnknown_03007890->unk_14[i].unk_04 == *ptr) + { + flags |= (1 << i); + } + } + } + return flags; +} From a781a6d5fdbebe8174bbb70ca82efaf9145729aa Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 30 Nov 2017 00:19:44 -0500 Subject: [PATCH 074/123] through sub_800D358 --- asm/link_rfu.s | 153 --------------------------------------------- include/librfu.h | 31 +++++---- include/link_rfu.h | 2 +- src/link_rfu.c | 75 +++++++++++++++++++--- 4 files changed, 85 insertions(+), 176 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index bbf490508..adc7e7d82 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,159 +5,6 @@ .text - thumb_func_start sub_800D30C -sub_800D30C: @ 800D30C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r4, =gUnknown_03004140 - ldr r2, [r4, 0x40] - cmp r2, 0 - beq _0800D322 - bl _call_via_r2 -_0800D322: - movs r0, 0 - strh r0, [r4, 0x16] - strh r0, [r4, 0x14] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D30C - - thumb_func_start sub_800D334 -sub_800D334: @ 800D334 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gUnknown_03004140 - ldrb r5, [r4, 0xE] - movs r1, 0x1 - strb r1, [r4, 0xE] - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - strb r5, [r4, 0xE] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D334 - - thumb_func_start sub_800D358 -sub_800D358: @ 800D358 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0800D3A0 - movs r4, 0 -_0800D36A: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D396 - ldrb r1, [r2, 0x1A] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D396 - adds r2, r1, 0 - bics r2, r5 - movs r0, 0x20 - adds r1, r4, 0 - bl rfu_changeSendTarget -_0800D396: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D36A -_0800D3A0: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _0800D3DE - movs r4, 0 -_0800D3AC: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2, 0x34] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D3D4 - adds r0, r2, 0 - adds r0, 0x4E - ldrb r0, [r0] - ands r0, r5 - cmp r0, 0 - beq _0800D3D4 - adds r0, r4, 0 - bl rfu_NI_stopReceivingData -_0800D3D4: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D3AC -_0800D3DE: - ldr r0, =gUnknown_03007890 - ldr r3, [r0] - ldrb r2, [r3, 0x6] - cmp r2, 0 - beq _0800D41C - mvns r1, r5 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3, 0x6] - movs r4, 0 - ldr r7, =gUnknown_03007870 - ldr r6, =0x00008024 -_0800D3F6: - lsls r0, r4, 2 - adds r0, r7 - ldr r2, [r0] - ldrh r0, [r2] - cmp r0, r6 - bne _0800D412 - ldrb r3, [r2, 0x3] - adds r0, r5, 0 - ands r0, r3 - cmp r0, 0 - beq _0800D412 - adds r0, r1, 0 - ands r0, r3 - strb r0, [r2, 0x3] -_0800D412: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D3F6 -_0800D41C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D358 - thumb_func_start sub_800D434 sub_800D434: @ 800D434 push {r4-r7,lr} diff --git a/include/librfu.h b/include/librfu.h index 988ee1c0e..8d61c2559 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -105,7 +105,10 @@ struct RfuIntrStruct struct RfuUnk1 { - u8 unk_0[0x14]; + u16 unk_0; + u8 unk_2; + u8 unk_3; + u8 fill_4[0x10]; u32 unk_14; u32 unk_18; struct RfuIntrStruct unk_1c; @@ -114,9 +117,13 @@ struct RfuUnk1 struct RfuUnk2 { u16 unk_0; - u8 fill_2[0x32]; + u8 fill_2[0x18]; + u8 unk_1a; + u8 fill_1b[0x19]; u16 unk_34; - u8 fill_36[0x2b]; + u8 fill_36[0x18]; + u8 unk_4e; + u8 fill_4f[0x12]; u8 unk_61; u8 fill_62[6]; u32 unk_68; @@ -132,14 +139,6 @@ struct RfuUnk3 u32 unk_dc; }; -struct RfuUnkSub -{ - u16 unk_00; - u8 unk_02; - u16 unk_04; - u8 filler_06[26]; -}; - struct RfuUnk5 { u8 unk_00; @@ -152,7 +151,12 @@ struct RfuUnk5 u8 unk_07; u8 unk_08; u8 filler_09[11]; - struct RfuUnkSub unk_14[4]; + struct RfuUnk5Sub { + u16 unk_00; + u8 unk_02; + u16 unk_04; + u8 filler_06[26]; + } unk_14[4]; }; extern struct RfuStruct *gRfuState; @@ -199,3 +203,6 @@ void rfu_clearSlot(u8 a0, u8 a1); bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status); bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1); bool16 rfu_UNI_PARENT_getDRAC_ACK(u8 *a0); +void rfu_REQ_disconnect(u8 who); +void rfu_changeSendTarget(u8 a0, u8 who, u8 a2); +void rfu_NI_stopReceivingData(u8 who); diff --git a/include/link_rfu.h b/include/link_rfu.h index 8634a4706..f82fbd05a 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -73,7 +73,7 @@ struct UnkRfuStruct_1 { /* 0x032 */ u16 unk_32; /* 0x034 */ u16 unk_34[4]; /* 0x03c */ struct UnkLinkRfuStruct_02022B2C *unk_3c; - /* 0x040 */ void (*unk_40)(u8); + /* 0x040 */ void (*unk_40)(u8, u8); /* 0x044 */ void (*unk_44)(u16); /* 0x048 */ u8 filler_48[0xe78]; }; diff --git a/src/link_rfu.c b/src/link_rfu.c index 82a68214f..ffe119a17 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -24,20 +24,20 @@ EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {}; // Static ROM declarations static void sub_800C000(void); -void sub_800CEB0(u16 r6); -void sub_800C7B4(u16 r8, u16 r6); -void sub_800D30C(u8 a0, u8 a1); -void sub_800D334(u8 a0); -void sub_800D610(void); -void sub_800D630(void); +static void sub_800C7B4(u16 r8, u16 r6); static void sub_800C744(u32 a0); +void sub_800CEB0(u16 r6); static void sub_800CF34(void); static void sub_800D158(void); static void sub_800D20C(void); static void sub_800D268(void); static u8 sub_800D294(void); -void sub_800D358(void); +void sub_800D30C(u8 a0, u8 a1); +static void sub_800D334(u8 a0); +static void sub_800D358(u8 a0); void sub_800D434(void); +void sub_800D610(void); +void sub_800D630(void); // .rodata @@ -85,7 +85,7 @@ void rfu_REQ_sendData_wrapper(u8 r2) rfu_REQ_sendData(r2); } -int sub_800BF4C(void (*func1)(u8), void (*func2)(u16)) +int sub_800BF4C(void (*func1)(u8, u8), void (*func2)(u16)) { if (func1 == NULL) { @@ -613,7 +613,7 @@ static void sub_800C744(u32 a0) } } -void sub_800C7B4(u16 r8, u16 r6) +static void sub_800C7B4(u16 r8, u16 r6) { u8 sp0; register u8 *stwiRecvBuffer asm("r0"); @@ -870,7 +870,7 @@ void sub_800C7B4(u16 r8, u16 r6) { stwiRecvBuffer = rfu_getSTWIRecvBuffer(); gUnknown_03004140.unk_14 = stwiRecvBuffer[8]; - sub_800D358(); + sub_800D358(gUnknown_03004140.unk_14); if (gUnknown_03004140.unk_30) { gUnknown_03004140.unk_30 &= ~gUnknown_03004140.unk_14; @@ -1208,3 +1208,58 @@ static u8 sub_800D294(void) } return flags; } + +void sub_800D30C(u8 a0, u8 a1) +{ + if (gUnknown_03004140.unk_40 != NULL) + { + gUnknown_03004140.unk_40(a0, a1); + } + gUnknown_03004140.unk_14 = gUnknown_03004140.unk_16 = 0; +} + +static void sub_800D334(u8 a0) +{ + u8 unk_0e_bak = gUnknown_03004140.unk_0e; + gUnknown_03004140.unk_0e = 1; + rfu_REQ_disconnect(a0); + rfu_waitREQComplete(); + gUnknown_03004140.unk_0e = unk_0e_bak; +} + +static void sub_800D358(u8 a0) +{ + u8 i; + + if (gUnknown_03007890->unk_04) + { + for (i = 0; i < 4; i++) + { + if (gUnknown_03007880[i]->unk_0 & 0x8000 && gUnknown_03007880[i]->unk_1a & a0) + { + rfu_changeSendTarget(0x20, i, gUnknown_03007880[i]->unk_1a & ~a0); + } + } + } + if (gUnknown_03007890->unk_05) + { + for (i = 0; i < 4; i++) + { + if (gUnknown_03007880[i]->unk_34 & 0x8000 && gUnknown_03007880[i]->unk_4e & a0) + { + rfu_NI_stopReceivingData(i); + } + } + } + if (gUnknown_03007890->unk_06) + { + gUnknown_03007890->unk_06 &= ~a0; + for (i = 0; i < 4; i++) + { + if (gUnknown_03007870[i]->unk_0 == 0x8024 && a0 & gUnknown_03007870[i]->unk_3) + { + gUnknown_03007870[i]->unk_3 &= ~a0; + } + } + } +} From 6f84853b0842387197848af7de08ef6c980271f3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 30 Nov 2017 08:26:39 -0500 Subject: [PATCH 075/123] sub_800D434 --- asm/link_rfu.s | 130 ----------------------------------------------- include/librfu.h | 6 ++- src/link_rfu.c | 44 +++++++++++++++- 3 files changed, 47 insertions(+), 133 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index adc7e7d82..47e3526e7 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,136 +5,6 @@ .text - thumb_func_start sub_800D434 -sub_800D434: @ 800D434 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x18] - cmp r0, 0 - beq _0800D510 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0800D4D4 - movs r6, 0 -_0800D454: - ldr r3, =gUnknown_03007880 - lsls r2, r6, 2 - adds r0, r2, r3 - ldr r0, [r0] - ldrh r1, [r0] - movs r4, 0x80 - lsls r4, 8 - adds r0, r4, 0 - ands r1, r0 - adds r7, r2, 0 - adds r0, r6, 0x1 - mov r9, r0 - cmp r1, 0 - beq _0800D4CA - movs r5, 0 - movs r4, 0 - movs r1, 0x1 - mov r8, r1 - mov r10, r3 -_0800D47A: - adds r0, r7, r3 - ldr r0, [r0] - ldrb r0, [r0, 0x1A] - asrs r0, r4 - mov r1, r8 - ands r0, r1 - cmp r0, 0 - beq _0800D4A4 - lsls r0, r4, 2 - adds r0, r3 - ldr r0, [r0] - ldr r1, =gUnknown_03004140 - ldrh r0, [r0, 0x2] - ldrh r1, [r1, 0x18] - cmp r0, r1 - bls _0800D4A4 - mov r0, r8 - lsls r0, r4 - orrs r5, r0 - lsls r0, r5, 24 - lsrs r5, r0, 24 -_0800D4A4: - cmp r5, 0 - beq _0800D4C0 - mov r1, r10 - adds r0, r7, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1A] - adds r2, r5, 0 - eors r2, r0 - movs r0, 0x20 - adds r1, r6, 0 - str r3, [sp] - bl rfu_changeSendTarget - ldr r3, [sp] -_0800D4C0: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800D47A -_0800D4CA: - mov r3, r9 - lsls r0, r3, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0800D454 -_0800D4D4: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _0800D510 - movs r6, 0 -_0800D4E0: - ldr r1, =gUnknown_03007880 - lsls r0, r6, 2 - adds r0, r1 - ldr r2, [r0] - ldrh r0, [r2, 0x34] - movs r4, 0x80 - lsls r4, 8 - adds r1, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _0800D506 - ldr r1, =gUnknown_03004140 - ldrh r0, [r2, 0x36] - ldrh r1, [r1, 0x18] - cmp r0, r1 - bls _0800D506 - adds r0, r6, 0 - bl rfu_NI_stopReceivingData -_0800D506: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0800D4E0 -_0800D510: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D434 - thumb_func_start sub_800D52C sub_800D52C: @ 800D52C push {lr} diff --git a/include/librfu.h b/include/librfu.h index 8d61c2559..90bae1dbb 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -117,11 +117,13 @@ struct RfuUnk1 struct RfuUnk2 { u16 unk_0; - u8 fill_2[0x18]; + u16 unk_2; + u8 fill_4[0x16]; u8 unk_1a; u8 fill_1b[0x19]; u16 unk_34; - u8 fill_36[0x18]; + u16 unk_36; + u8 fill_38[0x16]; u8 unk_4e; u8 fill_4f[0x12]; u8 unk_61; diff --git a/src/link_rfu.c b/src/link_rfu.c index ffe119a17..e47a42bb4 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -35,7 +35,7 @@ static u8 sub_800D294(void); void sub_800D30C(u8 a0, u8 a1); static void sub_800D334(u8 a0); static void sub_800D358(u8 a0); -void sub_800D434(void); +static void sub_800D434(void); void sub_800D610(void); void sub_800D630(void); @@ -1263,3 +1263,45 @@ static void sub_800D358(u8 a0) } } } + +static void sub_800D434(void) +{ + u8 i; + u8 j; + u8 flags; + + if (gUnknown_03004140.unk_18) + { + if (gUnknown_03007890->unk_04) + { + for (i = 0; i < 4; i ++) + { + if (gUnknown_03007880[i]->unk_0 & 0x8000) + { + flags = 0; + for (j = 0; j < 4; j++) + { + if ((gUnknown_03007880[i]->unk_1a >> j) & 1 && gUnknown_03007880[j]->unk_2 > gUnknown_03004140.unk_18) + { + flags |= (1 << j); + } + if (flags) + { + rfu_changeSendTarget(0x20, i, flags ^ gUnknown_03007880[i]->unk_1a); + } + } + } + } + } + if (gUnknown_03007890->unk_05) + { + for (i = 0; i < 4; i++) + { + if (gUnknown_03007880[i]->unk_34 & 0x8000 && gUnknown_03007880[i]->unk_36 > gUnknown_03004140.unk_18) + { + rfu_NI_stopReceivingData(i); + } + } + } + } +} From f3ad97ad13a8d7e46609306d6c44805350280a5c Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 30 Nov 2017 08:35:33 -0500 Subject: [PATCH 076/123] through sub_800D550 --- asm/link_rfu.s | 57 -------------------------------------------------- src/link_rfu.c | 30 ++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 59 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 47e3526e7..cce8bee0f 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,63 +5,6 @@ .text - thumb_func_start sub_800D52C -sub_800D52C: @ 800D52C - push {lr} - ldr r1, =gUnknown_03004140 - str r0, [r1, 0x44] - ldr r0, =sub_800CEB0 - bl rfu_setMSCCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D52C - - thumb_func_start sub_800D544 -sub_800D544: @ 800D544 - ldr r1, =gUnknown_03004140 - str r0, [r1, 0x40] - bx lr - .pool - thumb_func_end sub_800D544 - - thumb_func_start sub_800D550 -sub_800D550: @ 800D550 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x9] - adds r3, r0, 0 - cmp r1, 0 - beq _0800D578 - cmp r4, 0 - bne _0800D578 - adds r0, 0x30 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D578 - movs r0, 0x5 - b _0800D588 - .pool -_0800D578: - ldr r2, =0x04000208 - ldrh r1, [r2] - movs r0, 0 - strh r0, [r2] - strb r4, [r3, 0x9] - strh r5, [r3, 0x32] - strh r1, [r2] - movs r0, 0 -_0800D588: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D550 - thumb_func_start sub_800D594 sub_800D594: @ 800D594 push {lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index e47a42bb4..e3630347a 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -26,7 +26,7 @@ EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {}; static void sub_800C000(void); static void sub_800C7B4(u16 r8, u16 r6); static void sub_800C744(u32 a0); -void sub_800CEB0(u16 r6); +static void sub_800CEB0(u16 r6); static void sub_800CF34(void); static void sub_800D158(void); static void sub_800D20C(void); @@ -977,7 +977,7 @@ static void sub_800C7B4(u16 r8, u16 r6) } } -void sub_800CEB0(u16 r6) +static void sub_800CEB0(u16 r6) { u8 r7; u8 sp0; @@ -1305,3 +1305,29 @@ static void sub_800D434(void) } } } + +void sub_800D52C(void (*func)(u16)) +{ + gUnknown_03004140.unk_44 = func; + rfu_setMSCCallback(sub_800CEB0); +} + +void sub_800D544(void (*func)(u8, u8)) +{ + gUnknown_03004140.unk_40 = func; +} + +u8 sub_800D550(u8 a0, u16 a1) +{ + u16 imeBak; + if (gUnknown_03004140.unk_09 && a0 == 0 && gUnknown_03004140.unk_30) + { + return 5; + } + imeBak = REG_IME; + REG_IME = 0; + gUnknown_03004140.unk_09 = a0; + gUnknown_03004140.unk_32 = a1; + REG_IME = imeBak; + return 0; +} From f974812e9bc4358642098f24ecbe2224c9cca54d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 30 Nov 2017 08:43:04 -0500 Subject: [PATCH 077/123] through sub_800D5D0 --- asm/link_rfu.s | 67 -------------------------------------------------- src/link_rfu.c | 31 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 67 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index cce8bee0f..8718810ff 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,73 +5,6 @@ .text - thumb_func_start sub_800D594 -sub_800D594: @ 800D594 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x4] - ldrb r0, [r0, 0x5] - orrs r0, r1 - cmp r0, 0 - bne _0800D5B8 - ldr r0, =gUnknown_03004140 - strh r2, [r0, 0x18] - movs r0, 0 - b _0800D5C8 - .pool -_0800D5B8: - ldr r1, =gUnknown_03004140 - movs r0, 0x6 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x6 -_0800D5C8: - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D594 - - thumb_func_start sub_800D5D0 -sub_800D5D0: @ 800D5D0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - adds r3, r2, 0 - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x4] - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0800D5FC - movs r0, 0x7 - strh r0, [r1, 0x14] - movs r0, 0xF3 - movs r1, 0x1 - bl sub_800D30C - movs r0, 0x7 - b _0800D60A - .pool -_0800D5FC: - cmp r2, 0 - beq _0800D606 - movs r0, 0x1 - strb r0, [r1, 0xB] - b _0800D608 -_0800D606: - strb r3, [r1, 0xB] -_0800D608: - movs r0, 0 -_0800D60A: - pop {r1} - bx r1 - thumb_func_end sub_800D5D0 - thumb_func_start sub_800D610 sub_800D610: @ 800D610 push {lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index e3630347a..5eecb57d6 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1331,3 +1331,34 @@ u8 sub_800D550(u8 a0, u16 a1) REG_IME = imeBak; return 0; } + +u8 sub_800D594(u16 a0) +{ + if (gUnknown_03007890->unk_04 | gUnknown_03007890->unk_05) + { + gUnknown_03004140.unk_14 = 6; + sub_800D30C(0xf3, 0x01); + return 6; + } + gUnknown_03004140.unk_18 = a0; + return 0; +} + +u8 sub_800D5D0(u8 a0) +{ + if (gUnknown_03004140.unk_04 == 9 || gUnknown_03004140.unk_04 == 10 || gUnknown_03004140.unk_04 == 11) + { + gUnknown_03004140.unk_14 = 7; + sub_800D30C(0xf3, 0x01); + return 7; + } + if (a0) + { + gUnknown_03004140.unk_0b = 1; + } + else + { + gUnknown_03004140.unk_0b = 0; + } + return 0; +} From 9f4ecadbfa514a3620dd7e4ddadf0b55e30a9900 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 30 Nov 2017 22:05:07 -0500 Subject: [PATCH 078/123] through sub_800D658 --- asm/link_rfu.s | 100 ------------------------------------------------- src/link_rfu.c | 57 ++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 103 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 8718810ff..f187207cb 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,106 +5,6 @@ .text - thumb_func_start sub_800D610 -sub_800D610: @ 800D610 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x2] - cmp r0, 0 - beq _0800D628 - ldrb r0, [r1, 0x2] - movs r0, 0 - strb r0, [r1, 0x2] - movs r0, 0x45 - movs r1, 0 - bl sub_800D30C -_0800D628: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D610 - - thumb_func_start sub_800D630 -sub_800D630: @ 800D630 - push {lr} - ldr r1, =gUnknown_03004140 - ldrb r0, [r1, 0x2] - cmp r0, 0 - bne _0800D648 - movs r0, 0x45 - movs r1, 0 - bl sub_800D30C - b _0800D654 - .pool -_0800D648: - ldrb r0, [r1, 0x2] - cmp r0, 0x1 - bne _0800D654 - ldrb r0, [r1, 0x2] - movs r0, 0x2 - strb r0, [r1, 0x2] -_0800D654: - pop {r0} - bx r0 - thumb_func_end sub_800D630 - - thumb_func_start sub_800D658 -sub_800D658: @ 800D658 - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r1, [r0, 0x7] - adds r2, r0, 0 - cmp r1, 0 - beq _0800D6C2 - ldrb r0, [r2, 0x4] - subs r0, 0x5 - cmp r0, 0x6 - bhi _0800D6C2 - lsls r0, 2 - ldr r1, =_0800D680 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800D680: - .4byte _0800D69C - .4byte _0800D6A4 - .4byte _0800D6AE - .4byte _0800D6AE - .4byte _0800D6B4 - .4byte _0800D6B4 - .4byte _0800D6BA -_0800D69C: - movs r0, 0x3 - strb r0, [r2, 0x7] - movs r0, 0x9 - b _0800D6C0 -_0800D6A4: - movs r0, 0x2 - strb r0, [r2, 0x7] - movs r0, 0x1 - strh r0, [r2, 0x1A] - b _0800D6C2 -_0800D6AE: - movs r0, 0x2 - strb r0, [r2, 0x7] - b _0800D6C2 -_0800D6B4: - movs r0, 0x28 - strh r0, [r2, 0x1A] - b _0800D6C2 -_0800D6BA: - movs r0, 0x28 - strh r0, [r2, 0x1A] - movs r0, 0xA -_0800D6C0: - strb r0, [r2, 0x4] -_0800D6C2: - pop {r0} - bx r0 - thumb_func_end sub_800D658 - @ file boundary? thumb_func_start sub_800D6C8 diff --git a/src/link_rfu.c b/src/link_rfu.c index 5eecb57d6..704f272a3 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -32,11 +32,11 @@ static void sub_800D158(void); static void sub_800D20C(void); static void sub_800D268(void); static u8 sub_800D294(void); -void sub_800D30C(u8 a0, u8 a1); +static void sub_800D30C(u8 a0, u8 a1); static void sub_800D334(u8 a0); static void sub_800D358(u8 a0); static void sub_800D434(void); -void sub_800D610(void); +static void sub_800D610(void); void sub_800D630(void); // .rodata @@ -1209,7 +1209,7 @@ static u8 sub_800D294(void) return flags; } -void sub_800D30C(u8 a0, u8 a1) +static void sub_800D30C(u8 a0, u8 a1) { if (gUnknown_03004140.unk_40 != NULL) { @@ -1362,3 +1362,54 @@ u8 sub_800D5D0(u8 a0) } return 0; } + +static void sub_800D610(void) +{ + if (gUnknown_03004140.unk_02) + { + gUnknown_03004140.unk_02 = 0; + sub_800D30C(0x45, 0x00); + } +} + +void sub_800D630(void) +{ + if (gUnknown_03004140.unk_02 == 0) + { + sub_800D30C(0x45, 0x00); + } + else if (gUnknown_03004140.unk_02 == 1) + { + gUnknown_03004140.unk_02 = 2; + } +} + +void sub_800D658(void) +{ + if (gUnknown_03004140.unk_07) + { + switch (gUnknown_03004140.unk_04) + { + case 5: + gUnknown_03004140.unk_07 = 3; + gUnknown_03004140.unk_04 = 9; + break; + case 6: + gUnknown_03004140.unk_07 = 2; + gUnknown_03004140.unk_1a = 1; + break; + case 7: + case 8: + gUnknown_03004140.unk_07 = 2; + break; + case 9: + case 10: + gUnknown_03004140.unk_1a = 40; + break; + case 11: + gUnknown_03004140.unk_1a = 40; + gUnknown_03004140.unk_04 = 10; + break; + } + } +} From cf539e253ebd1950916ceb976fa7a3c2b4a43386 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 30 Nov 2017 22:56:56 -0500 Subject: [PATCH 079/123] through sub_800D780 --- asm/link_rfu.s | 138 --------------------------------------------- include/link_rfu.h | 32 ++++++++++- src/link_rfu.c | 56 ++++++++++++++++++ 3 files changed, 86 insertions(+), 140 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index f187207cb..46d134786 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,144 +7,6 @@ @ file boundary? - thumb_func_start sub_800D6C8 -sub_800D6C8: @ 800D6C8 - push {r4,r5,lr} - adds r3, r0, 0 - movs r0, 0 - movs r4, 0 - movs r5, 0x46 -_0800D6D2: - adds r2, r0, 0x1 - movs r1, 0x45 - muls r0, r5 - adds r0, r3 - adds r0, 0x45 -_0800D6DC: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D6DC - adds r0, r2, 0 - cmp r0, 0x1F - ble _0800D6D2 - movs r1, 0 - ldr r2, =0x000008c1 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x8C - lsls r2, 4 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x000008c2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x000008c3 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D6C8 - - thumb_func_start sub_800D724 -sub_800D724: @ 800D724 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0 - movs r4, 0 -_0800D72C: - lsls r0, r1, 3 - adds r2, r1, 0x1 - subs r0, r1 - movs r1, 0xD - lsls r0, 1 - adds r0, r3 - adds r0, 0xD -_0800D73A: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D73A - adds r1, r2, 0 - cmp r1, 0x27 - ble _0800D72C - movs r1, 0 - ldr r2, =0x00000231 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x8C - lsls r2, 2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000232 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000233 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D724 - - thumb_func_start sub_800D780 -sub_800D780: @ 800D780 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0 - movs r4, 0 -_0800D788: - lsls r0, r1, 8 - adds r2, r1, 0x1 - movs r1, 0xFF - adds r0, r3 - adds r0, 0xFF -_0800D792: - strb r4, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800D792 - adds r1, r2, 0 - cmp r1, 0x1 - ble _0800D788 - movs r1, 0 - ldr r2, =0x00000201 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - movs r2, 0x80 - lsls r2, 2 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000202 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - ldr r2, =0x00000203 - adds r0, r3, r2 - ldrb r2, [r0] - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D780 - thumb_func_start sub_800D7D8 sub_800D7D8: @ 800D7D8 push {r4-r7,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index f82fbd05a..51ebab9cf 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -78,11 +78,39 @@ struct UnkRfuStruct_1 { /* 0x048 */ u8 filler_48[0xe78]; }; +struct UnkRfuStruct_2_Sub_124 { + /* 0x000 */ u8 unk_00[32][70]; + /* 0x8c0 */ vu8 unk_8c0; + /* 0x8c1 */ vu8 unk_8c1; + /* 0x8c2 */ vu8 unk_8c2; + /* 0x8c3 */ vu8 unk_8c3; +}; + +struct UnkRfuStruct_2_Sub_9e8 { + /* 0x000 */ u8 unk_00[40][14]; + /* 0x230 */ vu8 unk_230; + /* 0x231 */ vu8 unk_231; + /* 0x232 */ vu8 unk_232; + /* 0x233 */ vu8 unk_233; +}; + +struct UnkRfuStruct_Sub_Unused { + /* 0x000 */ u8 unk_00[2][256]; + /* 0x200 */ vu8 unk_200; + /* 0x201 */ vu8 unk_201; + /* 0x202 */ vu8 unk_202; + /* 0x203 */ vu8 unk_203; +}; + struct UnkRfuStruct_2 { /* 0x000 */ u8 filler_00[13]; /* 0x00d */ u8 playerCount; - /* 0x00e */ u8 filler_0e[0xcea]; -}; + /* 0x00e */ u8 filler_0e[0x5e]; + /* 0x06c */ u8 filler_6c[0xb8]; + /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; + /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; + /* 0xc1c */ u8 filler_c1c[0xdc]; +}; // size = 0xcf8 // Exported RAM declarations diff --git a/src/link_rfu.c b/src/link_rfu.c index 704f272a3..4f2dbd186 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1413,3 +1413,59 @@ void sub_800D658(void) } } } + +// TODO: Is there a file boundary here? + +void sub_800D6C8(struct UnkRfuStruct_2_Sub_124 *ptr) +{ + int i; + int j; + + for (i = 0; i < 32; i++) + { + for (j = 0; j < 70; j++) + { + ptr->unk_00[i][j] = 0; + } + } + ptr->unk_8c1 = 0; + ptr->unk_8c0 = 0; + ptr->unk_8c2 = 0; + ptr->unk_8c3 = 0; +} + +void sub_800D724(struct UnkRfuStruct_2_Sub_9e8 *ptr) +{ + int i; + int j; + + for (i = 0; i < 40; i++) + { + for (j = 0; j < 14; j++) + { + ptr->unk_00[i][j] = 0; + } + } + ptr->unk_231 = 0; + ptr->unk_230 = 0; + ptr->unk_232 = 0; + ptr->unk_233 = 0; +} + +void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr) +{ + int i; + int j; + + for (i = 0; i < 2; i++) + { + for (j = 0; j < 256; j++) + { + ptr->unk_00[i][j] = 0; + } + } + ptr->unk_201 = 0; + ptr->unk_200 = 0; + ptr->unk_202 = 0; + ptr->unk_203 = 0; +} From a7e95b97ca1ee009e60ec6d8c53cb845f8599165 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 30 Nov 2017 23:20:43 -0500 Subject: [PATCH 080/123] sub_800D7D8 --- asm/link_rfu.s | 95 ---------------------------------------------- include/link_rfu.h | 3 +- src/link_rfu.c | 40 +++++++++++++++++++ 3 files changed, 42 insertions(+), 96 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 46d134786..d1cba6e7a 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,101 +7,6 @@ @ file boundary? - thumb_func_start sub_800D7D8 -sub_800D7D8: @ 800D7D8 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x000008c2 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1F - bhi _0800D874 - ldr r0, =0x04000208 - ldrh r1, [r0] - adds r7, r1, 0 - movs r1, 0 - strh r1, [r0] - movs r5, 0 - movs r2, 0 -_0800D7F6: - adds r1, r4, r2 - ldrb r0, [r1] - cmp r0, 0 - bne _0800D80A - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _0800D80A - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0800D80A: - adds r2, 0xE - cmp r2, 0x45 - ble _0800D7F6 - cmp r5, 0x5 - beq _0800D866 - movs r2, 0 - movs r0, 0x8C - lsls r0, 4 - adds r5, r3, r0 - movs r6, 0x46 -_0800D81E: - ldrb r0, [r5] - adds r1, r0, 0 - muls r1, r6 - adds r1, r2, r1 - adds r1, r3, r1 - adds r0, r4, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D81E - movs r0, 0x8C - lsls r0, 4 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x000008c2 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D85E: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D85E -_0800D866: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D87E - .pool -_0800D874: - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D87E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D7D8 - thumb_func_start sub_800D888 sub_800D888: @ 800D888 push {r4-r7,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 51ebab9cf..ad313d5da 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -109,7 +109,8 @@ struct UnkRfuStruct_2 { /* 0x06c */ u8 filler_6c[0xb8]; /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; - /* 0xc1c */ u8 filler_c1c[0xdc]; + /* 0xc1c */ u8 filler_c1c[0x23]; + /* 0xc3f */ u8 filler_c3f[0xb9]; }; // size = 0xcf8 // Exported RAM declarations diff --git a/src/link_rfu.c b/src/link_rfu.c index 4f2dbd186..7145c602d 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1469,3 +1469,43 @@ void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr) ptr->unk_202 = 0; ptr->unk_203 = 0; } + +void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) +{ + int i; + u16 imeBak; + u8 count; + + if (q1->unk_8c2 < 32) + { + imeBak = REG_IME; + REG_IME = 0; + count = 0; + for (i = 0; i < 70; i += 14) + { + if (q2[i] == 0 && q2[i + 1] == 0) + { + count++; + } + } + if (count != 5) + { + for (i = 0; i < 70; i++) + { + q1->unk_00[q1->unk_8c0][i] = q2[i]; + } + q1->unk_8c0++; + q1->unk_8c0 %= 32; + q1->unk_8c2++; + for (i = 0; i < 70; i++) + { + q2[i] = 0; + } + } + REG_IME = imeBak; + } + else + { + q1->unk_8c3 = 1; + } +} From b07ad8b169bbc55af12e495a063c88d41fd4350f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 1 Dec 2017 08:45:49 -0500 Subject: [PATCH 081/123] through sub_800D9DC --- asm/link_rfu.s | 244 ------------------------------------------------- src/link_rfu.c | 87 ++++++++++++++++++ 2 files changed, 87 insertions(+), 244 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index d1cba6e7a..f8d6eddcd 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,250 +7,6 @@ @ file boundary? - thumb_func_start sub_800D888 -sub_800D888: @ 800D888 - push {r4-r7,lr} - adds r6, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000232 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0x27 - bhi _0800D920 - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - movs r0, 0 - strh r0, [r1] - movs r2, 0 - ldrb r0, [r5] - cmp r0, 0 - bne _0800D8B8 -_0800D8AA: - adds r2, 0x1 - cmp r2, 0xD - bgt _0800D8B8 - adds r0, r5, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D8AA -_0800D8B8: - cmp r2, 0xE - beq _0800D910 - movs r2, 0 - movs r0, 0x8C - lsls r0, 2 - adds r3, r6, r0 -_0800D8C4: - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r2, r0 - adds r0, r6, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xD - ble _0800D8C4 - movs r1, 0x8C - lsls r1, 2 - adds r4, r6, r1 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r6, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0 - adds r0, r5, 0 - adds r0, 0xD -_0800D908: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r5 - bge _0800D908 -_0800D910: - ldr r0, =0x04000208 - strh r7, [r0] - b _0800D92A - .pool -_0800D920: - ldr r1, =0x00000233 - adds r0, r6, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800D92A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800D888 - - thumb_func_start sub_800D934 -sub_800D934: @ 800D934 - push {r4-r7,lr} - adds r3, r0, 0 - adds r4, r1, 0 - ldr r1, =0x04000208 - ldrh r0, [r1] - mov r12, r0 - movs r0, 0 - strh r0, [r1] - movs r1, 0x8C - lsls r1, 4 - adds r0, r3, r1 - ldr r7, =0x000008c1 - adds r5, r3, r7 - ldrb r1, [r0] - ldrb r0, [r5] - cmp r1, r0 - beq _0800D960 - ldr r1, =0x000008c3 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800D984 -_0800D960: - movs r1, 0 - adds r0, r4, 0 - adds r0, 0x45 -_0800D966: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r4 - bge _0800D966 - ldr r0, =0x04000208 - mov r7, r12 - strh r7, [r0] - movs r0, 0 - b _0800D9CA - .pool -_0800D984: - movs r2, 0 - movs r6, 0x46 -_0800D988: - adds r1, r4, r2 - ldrb r0, [r5] - adds r7, r0, 0 - muls r7, r6 - adds r0, r7, 0 - adds r0, r2, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x45 - ble _0800D988 - ldr r0, =0x000008c1 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1F - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r7, =0x000008c2 - adds r1, r3, r7 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - mov r1, r12 - strh r1, [r0] - movs r0, 0x1 -_0800D9CA: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D934 - - thumb_func_start sub_800D9DC -sub_800D9DC: @ 800D9DC - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r1, 0x8C - lsls r1, 2 - adds r0, r5, r1 - adds r1, 0x1 - adds r4, r5, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DA00 - ldr r1, =0x00000233 - adds r0, r5, r1 - ldrb r0, [r0] - adds r2, r0, 0 - cmp r2, 0 - beq _0800DA08 -_0800DA00: - movs r0, 0 - b _0800DA54 - .pool -_0800DA08: - ldr r1, =0x04000208 - ldrh r0, [r1] - adds r7, r0, 0 - strh r2, [r1] - movs r3, 0 -_0800DA12: - adds r2, r6, r3 - ldrb r1, [r4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r5, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA12 - ldr r0, =0x00000231 - adds r4, r5, r0 - ldrb r0, [r4] - adds r0, 0x1 - ldrb r1, [r4] - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0x28 - bl __umodsi3 - ldrb r1, [r4] - strb r0, [r4] - ldr r0, =0x00000232 - adds r1, r5, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x04000208 - strh r7, [r0] - movs r0, 0x1 -_0800DA54: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800D9DC - thumb_func_start sub_800DA68 sub_800DA68: @ 800DA68 push {r4,lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index 7145c602d..e3ed18604 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1509,3 +1509,90 @@ void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) q1->unk_8c3 = 1; } } + +void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) +{ + int i; + u16 imeBak; + + if (q1->unk_232 < 40) + { + imeBak = REG_IME; + REG_IME = 0; + for (i = 0; i < 14; i++) + { + if (q2[i] != 0) + { + break; + } + } + if (i != 14) + { + for (i = 0; i < 14; i++) + { + q1->unk_00[q1->unk_230][i] = q2[i]; + } + q1->unk_230++; + q1->unk_230 %= 40; + q1->unk_232++; + for (i = 0; i < 14; i++) + { + q2[i] = 0; + } + } + REG_IME = imeBak; + } + else + { + q1->unk_233 = 1; + } +} + +bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) +{ + u16 imeBak; + int i; + + imeBak = REG_IME; + REG_IME = 0; + if (q1->unk_8c0 == q1->unk_8c1 || q1->unk_8c3 != 0) + { + for (i = 0; i < 70; i++) + { + q2[i] = 0; + } + REG_IME = imeBak; + return FALSE; + } + for (i = 0; i < 70; i++) + { + q2[i] = q1->unk_00[q1->unk_8c1][i]; + } + q1->unk_8c1++; + q1->unk_8c1 %= 32; + q1->unk_8c2--; + REG_IME = imeBak; + return TRUE; +} + +bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) +{ + int i; + u16 imeBak; + + if (q1->unk_230 == q1->unk_231 || q1->unk_233 != 0) + { + return FALSE; + } + imeBak = REG_IME; + REG_IME = 0; + for (i = 0; i < 14; i++) + { + q2[i] = q1->unk_00[q1->unk_231][i]; + } + q1->unk_231++; + q1->unk_231 %= 40; + q1->unk_232--; + REG_IME = imeBak; + return TRUE; +} From e2244831a77723a1a565b8df24dda3ade00f584f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 1 Dec 2017 21:51:06 -0500 Subject: [PATCH 082/123] through sub_800DB18 --- asm/link_rfu.s | 160 --------------------------------------------- include/link_rfu.h | 10 ++- src/link_rfu.c | 69 +++++++++++++++++++ 3 files changed, 78 insertions(+), 161 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index f8d6eddcd..3667d39bc 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,166 +7,6 @@ @ file boundary? - thumb_func_start sub_800DA68 -sub_800DA68: @ 800DA68 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _0800DA7E - adds r0, r2, 0 - movs r1, 0 - bl sub_800DAC8 - b _0800DAC0 -_0800DA7E: - movs r3, 0 -_0800DA80: - ldrb r1, [r2, 0x1C] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r3, r0 - adds r0, r2, r0 - adds r1, r4, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0xD - ble _0800DA80 - ldrb r0, [r2, 0x1C] - adds r0, 0x1 - ldrb r1, [r2, 0x1C] - strb r0, [r2, 0x1C] - ldrb r1, [r2, 0x1C] - movs r0, 0x1 - ands r0, r1 - ldrb r1, [r2, 0x1C] - strb r0, [r2, 0x1C] - ldrb r0, [r2, 0x1E] - cmp r0, 0x1 - bhi _0800DABA - ldrb r0, [r2, 0x1E] - adds r0, 0x1 - ldrb r1, [r2, 0x1E] - strb r0, [r2, 0x1E] - b _0800DAC0 -_0800DABA: - ldrb r0, [r2, 0x1C] - ldrb r1, [r2, 0x1D] - strb r0, [r2, 0x1D] -_0800DAC0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800DA68 - - thumb_func_start sub_800DAC8 -sub_800DAC8: @ 800DAC8 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - ldrb r0, [r3, 0x1E] - cmp r0, 0 - bne _0800DAD8 - movs r0, 0 - b _0800DB12 -_0800DAD8: - cmp r5, 0 - beq _0800DAF6 - movs r4, 0 -_0800DADE: - adds r2, r5, r4 - ldrb r1, [r3, 0x1D] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, r4, r0 - adds r0, r3, r0 - ldrb r0, [r0] - strb r0, [r2] - adds r4, 0x1 - cmp r4, 0xD - ble _0800DADE -_0800DAF6: - ldrb r0, [r3, 0x1D] - adds r0, 0x1 - ldrb r1, [r3, 0x1D] - strb r0, [r3, 0x1D] - ldrb r1, [r3, 0x1D] - movs r0, 0x1 - ands r0, r1 - ldrb r1, [r3, 0x1D] - strb r0, [r3, 0x1D] - ldrb r0, [r3, 0x1E] - subs r0, 0x1 - ldrb r1, [r3, 0x1E] - strb r0, [r3, 0x1E] - movs r0, 0x1 -_0800DB12: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_800DAC8 - - thumb_func_start sub_800DB18 -sub_800DB18: @ 800DB18 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - ldr r1, =0x00000202 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0800DB70 - movs r2, 0 - movs r0, 0x80 - lsls r0, 2 - adds r4, r3, r0 -_0800DB30: - ldrb r0, [r4] - lsls r0, 8 - adds r0, r2, r0 - adds r0, r3, r0 - adds r1, r5, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xFF - ble _0800DB30 - movs r0, 0x80 - lsls r0, 2 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1 - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x00000202 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - b _0800DB7A - .pool -_0800DB70: - ldr r1, =0x00000203 - adds r0, r3, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] -_0800DB7A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DB18 - thumb_func_start sub_800DB84 sub_800DB84: @ 800DB84 push {r4,r5,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index ad313d5da..28e244503 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -94,6 +94,13 @@ struct UnkRfuStruct_2_Sub_9e8 { /* 0x233 */ vu8 unk_233; }; +struct UnkRfuStruct_2_Sub_c1c { + /* 0x00 */ u8 unk_00[2][14]; + /* 0x1c */ vu8 unk_1c; + /* 0x1d */ vu8 unk_1d; + /* 0x1e */ vu8 unk_1e; +}; + struct UnkRfuStruct_Sub_Unused { /* 0x000 */ u8 unk_00[2][256]; /* 0x200 */ vu8 unk_200; @@ -109,7 +116,8 @@ struct UnkRfuStruct_2 { /* 0x06c */ u8 filler_6c[0xb8]; /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; - /* 0xc1c */ u8 filler_c1c[0x23]; + /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; + /* 0xc3c */ u8 filler_c3c[3]; /* 0xc3f */ u8 filler_c3f[0xb9]; }; // size = 0xcf8 diff --git a/src/link_rfu.c b/src/link_rfu.c index e3ed18604..63776a298 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -38,6 +38,7 @@ static void sub_800D358(u8 a0); static void sub_800D434(void); static void sub_800D610(void); void sub_800D630(void); +bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); // .rodata @@ -1596,3 +1597,71 @@ bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) REG_IME = imeBak; return TRUE; } + +void sub_800DA68(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2) +{ + int i; + + if (q2[1] == 0) + { + sub_800DAC8(q1, NULL); + } + else + { + for (i = 0; i < 14; i++) + { + q1->unk_00[q1->unk_1c][i] = q2[i]; + } + q1->unk_1c++; + q1->unk_1c %= 2; + if (q1->unk_1e < 2) + { + q1->unk_1e++; + } + else + { + q1->unk_1d = q1->unk_1c; + } + } +} + +bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2) +{ + int i; + + if (q1->unk_1e == 0) + { + return FALSE; + } + if (q2 != NULL) + { + for (i = 0; i < 14; i++) + { + q2[i] = q1->unk_00[q1->unk_1d][i]; + } + } + q1->unk_1d++; + q1->unk_1d %= 2; + q1->unk_1e--; + return TRUE; +} + +void sub_800DB18(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2) +{ + int i; + + if (q1->unk_202 < 2) + { + for (i = 0; i < 256; i++) + { + q1->unk_00[q1->unk_200][i] = q2[i]; + } + q1->unk_200++; + q1->unk_200 %= 2; + q1->unk_202++; + } + else + { + q1->unk_203 = 1; + } +} From c282e4fa59bc88e874aa5056a3e57fc35b3fefe5 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 2 Dec 2017 10:19:02 -0500 Subject: [PATCH 083/123] sub_800DBF8 --- asm/link_rfu.s | 168 --------------------------------------------- include/link_rfu.h | 5 ++ src/link_rfu.c | 63 +++++++++++++++++ 3 files changed, 68 insertions(+), 168 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 3667d39bc..1347ac077 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,174 +7,6 @@ @ file boundary? - thumb_func_start sub_800DB84 -sub_800DB84: @ 800DB84 - push {r4,r5,lr} - adds r3, r0, 0 - adds r5, r1, 0 - movs r1, 0x80 - lsls r1, 2 - adds r0, r3, r1 - adds r1, 0x1 - adds r4, r3, r1 - ldrb r1, [r0] - ldrb r0, [r4] - cmp r1, r0 - beq _0800DBA6 - ldr r1, =0x00000203 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800DBB0 -_0800DBA6: - movs r0, 0 - b _0800DBEA - .pool -_0800DBB0: - movs r2, 0 -_0800DBB2: - adds r0, r5, r2 - ldrb r1, [r4] - lsls r1, 8 - adds r1, r2, r1 - adds r1, r3, r1 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xFF - ble _0800DBB2 - ldr r0, =0x00000201 - adds r1, r3, r0 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x1 - ands r0, r2 - ldrb r2, [r1] - strb r0, [r1] - ldr r0, =0x00000202 - adds r1, r3, r0 - ldrb r0, [r1] - subs r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0x1 -_0800DBEA: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800DB84 - - thumb_func_start sub_800DBF8 -sub_800DBF8: @ 800DBF8 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r1, 0 - movs r5, 0 - cmp r1, 0x1 - beq _0800DC36 - cmp r1, 0x1 - bgt _0800DC12 - cmp r1, 0 - beq _0800DC1C - b _0800DCAA -_0800DC12: - cmp r0, 0x2 - beq _0800DC56 - cmp r0, 0x3 - beq _0800DC76 - b _0800DCAA -_0800DC1C: - movs r4, 0 -_0800DC1E: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r1, [r0] - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r1, 0 - cmp r4, 0xC7 - ble _0800DC1E - b _0800DC70 -_0800DC36: - movs r4, 0 - adds r2, r6, 0 - adds r2, 0xC8 -_0800DC3C: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r1, [r0] - lsls r0, r5, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r1, 0 - cmp r4, 0x63 - ble _0800DC3C - strh r5, [r2] - b _0800DCAA -_0800DC56: - movs r4, 0 -_0800DC58: - bl Random - lsls r0, 24 - lsrs r0, 24 - adds r1, r6, r4 - strb r0, [r1] - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, 0x1 - cmp r4, 0xC7 - ble _0800DC58 -_0800DC70: - adds r0, r6, r4 - strh r5, [r0] - b _0800DCAA -_0800DC76: - movs r4, 0 - ldr r3, =gUnknown_03000D74 - ldrb r1, [r3] - ldrb r0, [r3] - adds r7, r0, 0x1 - adds r2, r1, 0x1 - movs r0, 0xFF - mov r12, r0 -_0800DC86: - adds r0, r6, r4 - adds r1, r4, 0x1 - strb r2, [r0] - adds r0, r4, r7 - mov r4, r12 - ands r0, r4 - adds r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r2, 0x1 - adds r4, r1, 0 - cmp r1, 0xC7 - ble _0800DC86 - adds r0, r6, r1 - strh r5, [r0] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] -_0800DCAA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DBF8 - thumb_func_start sub_800DCB4 sub_800DCB4: @ 800DCB4 push {r4,r5,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 28e244503..f02a0baef 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -109,6 +109,11 @@ struct UnkRfuStruct_Sub_Unused { /* 0x203 */ vu8 unk_203; }; +struct UnkRfuStruct_Sub_Unused2 { + /* 0x000 */ u8 unk_00[200]; + /* 0x0c8 */ u16 unk_c8; +}; + struct UnkRfuStruct_2 { /* 0x000 */ u8 filler_00[13]; /* 0x00d */ u8 playerCount; diff --git a/src/link_rfu.c b/src/link_rfu.c index 63776a298..608a6bdd3 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1,6 +1,7 @@ // Includes #include "global.h" +#include "rng.h" #include "link.h" #include "librfu.h" #include "link_rfu.h" @@ -1665,3 +1666,65 @@ void sub_800DB18(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2) q1->unk_203 = 1; } } + +bool8 sub_800DB84(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2) +{ + int i; + + if (q1->unk_200 == q1->unk_201 || q1->unk_203) + { + return FALSE; + } + for (i = 0; i < 256; i++) + { + q2[i] = q1->unk_00[q1->unk_201][i]; + } + q1->unk_201++; + q1->unk_201 %= 2; + q1->unk_202--; + return TRUE; +} + +void sub_800DBF8(struct UnkRfuStruct_Sub_Unused2 *q1, u8 mode) +{ + int i; + u8 rval; + u16 r5 = 0; + switch (mode) + { + case 0: + for (i = 0; i < 200; i++) + { + q1->unk_00[i] = i + 1; + r5 += i + 1; + } + *((u16 *)(q1->unk_00 + i)) = r5; + break; + case 1: + for (i = 0; i < 100; i++) + { + q1->unk_00[i] = i + 1; + r5 += i + 1; + } + *((u16 *)(q1->unk_00 + 200)) = r5; + break; + case 2: + for (i = 0; i < 200; i++) + { + rval = Random(); + q1->unk_00[i] = rval; + r5 += rval; + } + *((u16 *)(q1->unk_00 + i)) = r5; + break; + case 3: + for (i = 0; i < 200; i++) + { + q1->unk_00[i] = i + 1 + gUnknown_03000D74; + r5 += (i + 1 + gUnknown_03000D74) & 0xFF; + } + *((u16 *)(q1->unk_00 + i)) = r5; + gUnknown_03000D74++; + break; + } +} From 519c8d42f873471ced07bbcbddbf102e037c0c0e Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 3 Dec 2017 20:04:54 -0500 Subject: [PATCH 084/123] through sub_800DD94 --- asm/link_rfu.s | 244 --------------------------------------------- data/link_rfu.s | 78 --------------- include/librfu.h | 4 +- include/link_rfu.h | 24 ++--- ld_script.txt | 1 + src/link_rfu.c | 243 ++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 250 insertions(+), 344 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 1347ac077..2f5ed4cec 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,250 +7,6 @@ @ file boundary? - thumb_func_start sub_800DCB4 -sub_800DCB4: @ 800DCB4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r3, 0 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0800DCD8 - ldr r5, =gUnknown_082ED470 - adds r2, r1, 0 -_0800DCC4: - adds r1, r4, r3 - ldrb r0, [r2] - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - adds r3, 0x1 - ldrb r0, [r2] - cmp r0, 0xFF - bne _0800DCC4 -_0800DCD8: - adds r1, r4, r3 - movs r0, 0 - strb r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DCB4 - - thumb_func_start sub_800DCE8 -sub_800DCE8: @ 800DCE8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r3, 0 - ldrb r0, [r1] - cmp r0, 0 - beq _0800DD0C - ldr r5, =gUnknown_082ED370 - adds r2, r1, 0 -_0800DCF8: - adds r1, r4, r3 - ldrb r0, [r2] - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - adds r3, 0x1 - ldrb r0, [r2] - cmp r0, 0 - bne _0800DCF8 -_0800DD0C: - adds r1, r4, r3 - movs r0, 0xFF - strb r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DCE8 - - thumb_func_start sub_800DD1C -sub_800DD1C: @ 800DD1C - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r0, =gUnknown_03007890 - ldr r4, [r0] - ldrb r2, [r4, 0x2] - ldrb r1, [r4] - adds r7, r0, 0 - cmp r1, 0x1 - bne _0800DD72 - movs r3, 0 - ands r1, r2 - cmp r1, 0 - beq _0800DD4E - cmp r5, 0x1 - bne _0800DD48 - ldrb r0, [r4, 0xA] - b _0800DD8C - .pool -_0800DD48: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0800DD4E: - lsrs r2, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bhi _0800DD8A - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _0800DD4E - adds r0, r6, 0x1 - cmp r5, r0 - bne _0800DD48 -_0800DD68: - ldr r0, [r7] - adds r0, 0xA - adds r0, r3 - ldrb r0, [r0] - b _0800DD8C -_0800DD72: - movs r3, 0 - movs r1, 0x1 -_0800DD76: - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0800DD68 - lsrs r2, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800DD76 -_0800DD8A: - movs r0, 0 -_0800DD8C: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800DD1C - - thumb_func_start sub_800DD94 -sub_800DD94: @ 800DD94 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - movs r4, 0 - ldr r0, =gSaveBlock2Ptr - mov r8, r0 - adds r6, r7, 0x2 - ldr r0, [r0] - adds r5, r0, 0 - adds r5, 0xA -_0800DDB2: - adds r0, r6, r4 - adds r1, r5, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x1 - ble _0800DDB2 - movs r4, 0 - lsls r2, 7 - mov r12, r2 - adds r1, r7, 0x4 -_0800DDC8: - adds r0, r1, r4 - strb r3, [r0] - asrs r3, 8 - adds r4, 0x1 - cmp r4, 0x3 - ble _0800DDC8 - mov r1, r8 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - movs r6, 0x1 - movs r1, 0x1 - ands r1, r0 - ldrb r2, [r7, 0xB] - movs r5, 0x2 - negs r5, r5 - adds r0, r5, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r7, 0xB] - movs r4, 0x7F - mov r1, r9 - ands r1, r4 - ldrb r2, [r7, 0xA] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - ands r0, r4 - mov r1, r12 - orrs r0, r1 - strb r0, [r7, 0xA] - ldrb r0, [r7] - movs r1, 0x10 - negs r1, r1 - ands r1, r0 - movs r0, 0x2 - orrs r1, r0 - ldrb r2, [r7, 0x1] - movs r0, 0x3D - negs r0, r0 - ands r0, r2 - movs r2, 0xC - orrs r0, r2 - strb r0, [r7, 0x1] - movs r0, 0x11 - negs r0, r0 - ands r1, r0 - subs r0, 0x10 - ands r1, r0 - subs r0, 0x20 - ands r1, r0 - strb r1, [r7] - ldr r0, =0x0000087f - bl FlagGet - lsls r0, 7 - ldrb r1, [r7] - ands r4, r1 - orrs r4, r0 - strb r4, [r7] - bl IsNationalPokedexEnabled - ands r0, r6 - ldrb r1, [r7, 0x1] - ands r5, r1 - orrs r5, r0 - strb r5, [r7, 0x1] - ldr r0, =0x00000864 - bl FlagGet - ands r6, r0 - lsls r6, 1 - ldrb r1, [r7, 0x1] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - orrs r0, r6 - strb r0, [r7, 0x1] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DD94 - thumb_func_start sub_800DE7C sub_800DE7C: @ 800DE7C push {r4-r7,lr} diff --git a/data/link_rfu.s b/data/link_rfu.s index 3ecfe5e42..ac9ae69f5 100644 --- a/data/link_rfu.s +++ b/data/link_rfu.s @@ -3,84 +3,6 @@ .section .rodata - .align 2 -gWirelessLinkIconPalette:: @ 82ED22C - .incbin "graphics/interface/wireless_link_icon.gbapal" - - .align 2 -gWirelessLinkIconPic:: @ 82ED22C - .incbin "graphics/interface/wireless_link_icon.4bpp.lz" - - .align 2 -gUnknown_082ED370:: @ 82ED370 - .byte 0xff, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37 - .byte 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f - .byte 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47 - .byte 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f - .byte 0x00, 0xab, 0xb5, 0xb6, 0xb1, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0xb2, 0xf1, 0x00, 0xae, 0xad, 0xba - .byte 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8 - .byte 0xa9, 0xaa, 0x00, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f - .byte 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1 - .byte 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9 - .byte 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1 - .byte 0xd2, 0xd3, 0xd4, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6 - .byte 0x00, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb - .byte 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3 - .byte 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb - .byte 0xec, 0xed, 0xee, 0x2d, 0x2f, 0x30, 0x31, 0x32 - .byte 0x33, 0x34, 0x35, 0x36, 0x50, 0x00, 0x01, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a - .byte 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 - .byte 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a - .byte 0x1b, 0xad, 0xb3, 0xb4, 0x00, 0xaf, 0x7d, 0x7f - .byte 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xa0 - .byte 0xae, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 - .byte 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f - .byte 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67 - .byte 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f - .byte 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77 - .byte 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7e, 0xb0, 0xac - .byte 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23 - .byte 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b - .byte 0x2c, 0x2e, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c - .byte 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94 - - .align 2 -gUnknown_082ED470:: @ 82ED470 - .byte 0x20, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c - .byte 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94 - .byte 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c - .byte 0x9d, 0x9e, 0x9f, 0xa0, 0xe0, 0xe1, 0xe2, 0xe3 - .byte 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb - .byte 0xec, 0xed, 0xee, 0xef, 0xf0, 0x7b, 0xf1, 0x7c - .byte 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x07 - .byte 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f - .byte 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 - .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f - .byte 0x84, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7 - .byte 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf - .byte 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 - .byte 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf - .byte 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7 - .byte 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xa6, 0xdd, 0xa7 - .byte 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xf2 - .byte 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa - .byte 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x01, 0x02, 0x03 - .byte 0x04, 0x05, 0x06, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f - .byte 0xaf, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 - .byte 0x37, 0x38, 0x39, 0x21, 0xdf, 0xa1, 0xb0, 0xa5 - .byte 0xde, 0x24, 0x2a, 0xa2, 0xa3, 0x22, 0x23, 0x20 - .byte 0xa4, 0x20, 0x2f, 0x41, 0x42, 0x43, 0x44, 0x45 - .byte 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d - .byte 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55 - .byte 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63 - .byte 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b - .byte 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73 - .byte 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20 - .byte 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20 - .byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 - .align 2 gUnknown_082ED570:: @ 82ED570 .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 diff --git a/include/librfu.h b/include/librfu.h index 90bae1dbb..a012b64ec 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -152,7 +152,9 @@ struct RfuUnk5 u8 unk_06; u8 unk_07; u8 unk_08; - u8 filler_09[11]; + u8 filler_09[1]; + u8 unk_0a[4]; + u8 filler_0e[6]; struct RfuUnk5Sub { u16 unk_00; u8 unk_02; diff --git a/include/link_rfu.h b/include/link_rfu.h index f02a0baef..9b7fa6e7e 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -5,17 +5,22 @@ struct UnkLinkRfuStruct_02022B14 { - u8 unk_00_0:4; - u8 unk_00_4:1; - u8 unk_00_5:1; - u8 unk_00_6:2; - u8 filler_01[2]; - u8 unk_03[4]; + u16 unk_00_0:4; + u16 unk_00_4:1; + u16 unk_00_5:1; + u16 unk_00_6:1; + u16 unk_00_7:1; + u16 unk_01_0:1; + u16 unk_01_1:1; + u16 unk_01_2:4; + u16 unk_01_6:2; + u8 playerTrainerId[2]; + u8 unk_04[4]; u16 unk_08_0:10; u16 unk_09_2:6; u8 unk_0a_0:7; u8 unk_0a_7:1; - u8 unk_0b_0:1; + u8 playerGender:1; u8 unk_0b_1:7; u8 unk_0c; u8 unk_0d; @@ -109,11 +114,6 @@ struct UnkRfuStruct_Sub_Unused { /* 0x203 */ vu8 unk_203; }; -struct UnkRfuStruct_Sub_Unused2 { - /* 0x000 */ u8 unk_00[200]; - /* 0x0c8 */ u16 unk_c8; -}; - struct UnkRfuStruct_2 { /* 0x000 */ u8 filler_00[13]; /* 0x00d */ u8 playerCount; diff --git a/ld_script.txt b/ld_script.txt index ef28e79dd..40a15e15a 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -331,6 +331,7 @@ SECTIONS { data/io_reg.o(.rodata); src/string_util.o(.rodata); src/link.o(.rodata); + src/link_rfu.o(.rodata); data/link_rfu.o(.rodata); data/rom_8011DC0.o(.rodata); src/rtc.o(.rodata); diff --git a/src/link_rfu.c b/src/link_rfu.c index 608a6bdd3..bf7e92e69 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2,6 +2,8 @@ // Includes #include "global.h" #include "rng.h" +#include "text.h" +#include "event_data.h" #include "link.h" #include "librfu.h" #include "link_rfu.h" @@ -43,6 +45,77 @@ bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); // .rodata +const u16 gWirelessLinkIconPalette[] = INCBIN_U16("graphics/interface/wireless_link_icon.gbapal"); +const u8 gWirelessLinkIconPic[] = INCBIN_U8("graphics/interface/wireless_link_icon.4bpp.lz"); +const u8 gUnknown_082ED370[] = { + 0xff, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x00, 0xab, 0xb5, 0xb6, 0xb1, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xb2, 0xf1, 0x00, 0xae, 0xad, 0xba, + 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, + 0xa9, 0xaa, 0x00, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, + 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, + 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, + 0xd2, 0xd3, 0xd4, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, + 0x00, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, + 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, + 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, + 0xec, 0xed, 0xee, 0x2d, 0x2f, 0x30, 0x31, 0x32, + 0x33, 0x34, 0x35, 0x36, 0x50, 0x00, 0x01, 0x02, + 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, + 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, + 0x1b, 0xad, 0xb3, 0xb4, 0x00, 0xaf, 0x7d, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xa0, + 0xae, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7e, 0xb0, 0xac, + 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, + 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, + 0x2c, 0x2e, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, + 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94 +}; +const u8 gUnknown_082ED470[] = { + 0x20, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, + 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, + 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, + 0x9d, 0x9e, 0x9f, 0xa0, 0xe0, 0xe1, 0xe2, 0xe3, + 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, + 0xec, 0xed, 0xee, 0xef, 0xf0, 0x7b, 0xf1, 0x7c, + 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x84, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xa6, 0xdd, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xf2, + 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, + 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0xaf, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x21, 0xdf, 0xa1, 0xb0, 0xa5, + 0xde, 0x24, 0x2a, 0xa2, 0xa3, 0x22, 0x23, 0x20, + 0xa4, 0x20, 0x2f, 0x41, 0x42, 0x43, 0x44, 0x45, + 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, + 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, + 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, + 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, + 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, + 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, + 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 +}; + // .text u32 sub_800BEC0(void) @@ -1685,7 +1758,7 @@ bool8 sub_800DB84(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2) return TRUE; } -void sub_800DBF8(struct UnkRfuStruct_Sub_Unused2 *q1, u8 mode) +void sub_800DBF8(u8 *q1, u8 mode) { int i; u8 rval; @@ -1695,36 +1768,188 @@ void sub_800DBF8(struct UnkRfuStruct_Sub_Unused2 *q1, u8 mode) case 0: for (i = 0; i < 200; i++) { - q1->unk_00[i] = i + 1; + q1[i] = i + 1; r5 += i + 1; } - *((u16 *)(q1->unk_00 + i)) = r5; + *((u16 *)(q1 + i)) = r5; break; case 1: for (i = 0; i < 100; i++) { - q1->unk_00[i] = i + 1; + q1[i] = i + 1; r5 += i + 1; } - *((u16 *)(q1->unk_00 + 200)) = r5; + *((u16 *)(q1 + 200)) = r5; break; case 2: for (i = 0; i < 200; i++) { rval = Random(); - q1->unk_00[i] = rval; + q1[i] = rval; r5 += rval; } - *((u16 *)(q1->unk_00 + i)) = r5; + *((u16 *)(q1 + i)) = r5; break; case 3: for (i = 0; i < 200; i++) { - q1->unk_00[i] = i + 1 + gUnknown_03000D74; + q1[i] = i + 1 + gUnknown_03000D74; r5 += (i + 1 + gUnknown_03000D74) & 0xFF; } - *((u16 *)(q1->unk_00 + i)) = r5; + *((u16 *)(q1 + i)) = r5; gUnknown_03000D74++; break; } } + +void PkmnStrToASCII(u8 *q1, const u8 *q2) +{ + int i; + + for (i = 0; q2[i] != EOS; i++) + { + q1[i] = gUnknown_082ED470[q2[i]]; + } + q1[i] = 0; +} + +void ASCIIToPkmnStr(u8 *q1, const u8 *q2) +{ + int i; + + for (i = 0; q2[i] != 0; i++) + { + q1[i] = gUnknown_082ED370[q2[i]]; + } + q1[i] = EOS; +} + +#ifdef NONMATCHING +u8 sub_800DD1C(u8 maxFlags) +{ + u8 flagCount = 0; + u8 flags = gUnknown_03007890->unk_02; + u8 i; + + if (gUnknown_03007890->unk_00 == 1) + { + i = 0; + for (i = 0; i < 4; flags >>= 1, i++) + { + if (flags & 1) + { + if (maxFlags == flagCount + 1) + { + return gUnknown_03007890->unk_0a[i]; + } + flagCount++; + } + } + } + else + { + for (i = 0; i < 4; flags >>= 1, i++) + { + if (flags & 1) + { + return gUnknown_03007890->unk_0a[i]; + } + } + } + return 0; +} +#else +__attribute__((naked)) u8 sub_800DD1C(u8 maxFlags) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tlsls r0, 24\n" + "\tlsrs r5, r0, 24\n" + "\tmovs r6, 0\n" + "\tldr r0, =gUnknown_03007890\n" + "\tldr r4, [r0]\n" + "\tldrb r2, [r4, 0x2]\n" + "\tldrb r1, [r4]\n" + "\tadds r7, r0, 0\n" + "\tcmp r1, 0x1\n" + "\tbne _0800DD72\n" + "\tmovs r3, 0\n" + "\tands r1, r2\n" + "\tcmp r1, 0\n" + "\tbeq _0800DD4E\n" + "\tcmp r5, 0x1\n" + "\tbne _0800DD48\n" + "\tldrb r0, [r4, 0xA]\n" + "\tb _0800DD8C\n" + "\t.pool\n" + "_0800DD48:\n" + "\tadds r0, r6, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r6, r0, 24\n" + "_0800DD4E:\n" + "\tlsrs r2, 1\n" + "\tadds r0, r3, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r3, r0, 24\n" + "\tcmp r3, 0x3\n" + "\tbhi _0800DD8A\n" + "\tmovs r0, 0x1\n" + "\tands r0, r2\n" + "\tcmp r0, 0\n" + "\tbeq _0800DD4E\n" + "\tadds r0, r6, 0x1\n" + "\tcmp r5, r0\n" + "\tbne _0800DD48\n" + "_0800DD68:\n" + "\tldr r0, [r7]\n" + "\tadds r0, 0xA\n" + "\tadds r0, r3\n" + "\tldrb r0, [r0]\n" + "\tb _0800DD8C\n" + "_0800DD72:\n" + "\tmovs r3, 0\n" + "\tmovs r1, 0x1\n" + "_0800DD76:\n" + "\tadds r0, r2, 0\n" + "\tands r0, r1\n" + "\tcmp r0, 0\n" + "\tbne _0800DD68\n" + "\tlsrs r2, 1\n" + "\tadds r0, r3, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r3, r0, 24\n" + "\tcmp r3, 0x3\n" + "\tbls _0800DD76\n" + "_0800DD8A:\n" + "\tmovs r0, 0\n" + "_0800DD8C:\n" + "\tpop {r4-r7}\n" + "\tpop {r1}\n" + "\tbx r1"); +} +#endif + +void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, int r3) +{ + int i; + + for (i = 0; i < 2; i++) + { + data->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i]; + } + for (i = 0; i < 4; i++) + { + data->unk_04[i] = r3; + r3 >>= 8; + } + data->playerGender = gSaveBlock2Ptr->playerGender; + data->unk_0a_0 = r9; + data->unk_0a_7 = r2; + data->unk_00_0 = 2; + data->unk_01_2 = 3; + data->unk_00_4 = 0; + data->unk_00_5 = 0; + data->unk_00_6 = 0; + data->unk_00_7 = FlagGet(FLAG_SYS_UNKNOWN_87F); + data->unk_01_0 = IsNationalPokedexEnabled(); + data->unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR); +} From d5bc329de73f2ef9b4ba84d71d784b9f949f2169 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 3 Dec 2017 20:32:49 -0500 Subject: [PATCH 085/123] through sub_800DF90 --- asm/link_rfu.s | 149 --------------------------------------------- include/librfu.h | 3 +- include/link_rfu.h | 4 +- src/link_rfu.c | 62 ++++++++++++++++++- 4 files changed, 64 insertions(+), 154 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 2f5ed4cec..7c5cd94e1 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,155 +7,6 @@ @ file boundary? - thumb_func_start sub_800DE7C -sub_800DE7C: @ 800DE7C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - mov r8, r1 - lsls r2, 24 - lsrs r5, r2, 24 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x6] - cmp r0, 0x1 - bne _0800DED8 - movs r0, 0x1 - mov r9, r0 - ldr r6, =gUnknown_03007890 - ldr r0, [r6] - lsls r4, r5, 5 - adds r0, r4 - ldrh r0, [r0, 0x18] - bl sub_8010454 - cmp r0, 0 - beq _0800DEB8 - ldr r1, [r6] - ldrb r0, [r1, 0x7] - asrs r0, r5 - mov r2, r9 - ands r0, r2 - cmp r0, 0 - bne _0800DEF0 -_0800DEB8: - adds r0, r7, 0 - movs r1, 0 - movs r2, 0xD - bl memset - mov r0, r8 - movs r1, 0 - movs r2, 0x8 - bl memset - b _0800DF24 - .pool -_0800DED8: - movs r0, 0 - mov r9, r0 - ldr r6, =gUnknown_03007890 - ldr r0, [r6] - lsls r4, r5, 5 - adds r0, r4 - ldrh r0, [r0, 0x18] - bl sub_8010454 - cmp r0, 0 - beq _0800DF10 - ldr r1, [r6] -_0800DEF0: - adds r1, r4, r1 - adds r1, 0x1A - adds r0, r7, 0 - movs r2, 0xD - bl memcpy - ldr r1, [r6] - adds r1, r4, r1 - adds r1, 0x29 - mov r0, r8 - movs r2, 0x8 - bl memcpy - b _0800DF24 - .pool -_0800DF10: - adds r0, r7, 0 - movs r1, 0 - movs r2, 0xD - bl memset - mov r0, r8 - movs r1, 0 - movs r2, 0x8 - bl memset -_0800DF24: - mov r0, r9 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800DE7C - - thumb_func_start sub_800DF34 -sub_800DF34: @ 800DF34 - push {r4-r7,lr} - adds r3, r0, 0 - adds r5, r1, 0 - lsls r2, 24 - movs r7, 0 - ldr r6, =gUnknown_03007890 - ldr r0, [r6] - lsrs r4, r2, 19 - adds r2, r0, r4 - ldrh r1, [r2, 0x18] - ldr r0, =0x00007f7d - cmp r1, r0 - bne _0800DF74 - adds r1, r2, 0 - adds r1, 0x1A - adds r0, r3, 0 - movs r2, 0xD - bl memcpy - ldr r1, [r6] - adds r1, r4, r1 - adds r1, 0x29 - adds r0, r5, 0 - movs r2, 0x8 - bl memcpy - movs r7, 0x1 - b _0800DF88 - .pool -_0800DF74: - adds r0, r3, 0 - movs r1, 0 - movs r2, 0xD - bl memset - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x8 - bl memset -_0800DF88: - adds r0, r7, 0 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800DF34 - - thumb_func_start sub_800DF90 -sub_800DF90: @ 800DF90 - push {r4,lr} - adds r4, r1, 0 - ldr r1, =gUnknown_02022B14 - movs r2, 0xD - bl memcpy - ldr r1, =gUnknown_02022B14 + 0xE - adds r0, r4, 0 - movs r2, 0x8 - bl memcpy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DF90 - thumb_func_start sub_800DFB4 sub_800DFB4: @ 800DFB4 push {r4,r5,lr} diff --git a/include/librfu.h b/include/librfu.h index a012b64ec..1f22133b9 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -159,7 +159,8 @@ struct RfuUnk5 u16 unk_00; u8 unk_02; u16 unk_04; - u8 filler_06[26]; + u8 unk_06[15]; + u8 unk_15[11]; } unk_14[4]; }; diff --git a/include/link_rfu.h b/include/link_rfu.h index 9b7fa6e7e..1d430cb51 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -3,7 +3,7 @@ // Exported type declarations -struct UnkLinkRfuStruct_02022B14 +struct __attribute__((packed)) UnkLinkRfuStruct_02022B14 { u16 unk_00_0:4; u16 unk_00_4:1; @@ -23,8 +23,6 @@ struct UnkLinkRfuStruct_02022B14 u8 playerGender:1; u8 unk_0b_1:7; u8 unk_0c; - u8 unk_0d; - u8 filler_0e[8]; }; struct UnkLinkRfuStruct_02022B2C diff --git a/src/link_rfu.c b/src/link_rfu.c index bf7e92e69..c1a3b1d09 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -21,7 +21,8 @@ IWRAM_DATA u8 gUnknown_03000D80[16]; IWRAM_DATA u16 gUnknown_03000D90[8]; EWRAM_DATA u8 gUnknown_02022B10 = 0; -EWRAM_DATA struct UnkLinkRfuStruct_02022B14 gUnknown_02022B14 = {}; +EWRAM_DATA ALIGNED(4) struct UnkLinkRfuStruct_02022B14 gUnknown_02022B14 = {}; +EWRAM_DATA ALIGNED(2) u8 gUnknown_02022B22[8] = {}; EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {}; // Static ROM declarations @@ -42,6 +43,7 @@ static void sub_800D434(void); static void sub_800D610(void); void sub_800D630(void); bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); +bool32 sub_8010454(u16 a0); // .rodata @@ -1953,3 +1955,61 @@ void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, int r data->unk_01_0 = IsNationalPokedexEnabled(); data->unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR); } + +bool8 sub_800DE7C(void *buff1, void *buff2, u8 idx) +{ + bool8 retVal; + + if (gUnknown_03004140.unk_06 == 1) + { + retVal = TRUE; + if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04) && ((gUnknown_03007890->unk_07 >> idx) & 1)) + { + memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); + memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); + } + else + { + memset(buff1, 0, 13); + memset(buff2, 0, 8); + } + } + else + { + retVal = FALSE; + if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04)) + { + memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); + memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); + } + else + { + memset(buff1, 0, 13); + memset(buff2, 0, 8); + } + } + return retVal; +} + +bool8 sub_800DF34(void *buff1, void *buff2, u8 idx) +{ + bool8 retVal = FALSE; + if (gUnknown_03007890->unk_14[idx].unk_04 == 0x7F7D) + { + memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); + memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); + retVal = TRUE; + } + else + { + memset(buff1, 0, 13); + memset(buff2, 0, 8); + } + return retVal; +} + +void sub_800DF90(void *buff1, void *buff2) +{ + memcpy(buff1, &gUnknown_02022B14, 13); + memcpy(buff2, gUnknown_02022B22, 8); +} From 8b5d6fe5d915053d6e052ba3279c8d1a98fd1509 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 3 Dec 2017 22:01:06 -0500 Subject: [PATCH 086/123] CreateWirelessStatusIndicatorSprite --- asm/contest.s | 2 +- asm/contest_link_80F57C4.s | 4 +- asm/link_rfu.s | 99 ++----------------------------- asm/rom4.s | 4 +- asm/rom_8011DC0.s | 18 +++--- asm/script_pokemon_util_80F87D8.s | 2 +- asm/trade.s | 6 +- asm/trainer_card.s | 2 +- data/link_rfu.s | 46 -------------- include/link.h | 2 +- src/battle_2.c | 6 +- src/berry_blender.c | 4 +- src/evolution_scene.c | 2 +- src/link_rfu.c | 97 ++++++++++++++++++++++++++++-- src/reshow_battle_screen.c | 2 +- 15 files changed, 125 insertions(+), 171 deletions(-) diff --git a/asm/contest.s b/asm/contest.s index 88d4203ab..2366d5b99 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -643,7 +643,7 @@ _080D7C04: bl sub_800E0E8 movs r0, 0x8 movs r1, 0x8 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite _080D7C56: pop {r4-r6} pop {r0} diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 7f32c880c..46ba8036f 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -2128,9 +2128,9 @@ sub_80F6AE8: @ 80F6AE8 bl sub_800E0E8 movs r0, 0x8 movs r1, 0x8 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite ldr r4, =gSprites - ldr r0, =gUnknown_02022B10 + ldr r0, =gWirelessStatusIndicatorSpriteId ldrb r1, [r0] lsls r0, r1, 4 adds r0, r1 diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 7c5cd94e1..35628de34 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,98 +7,11 @@ @ file boundary? - thumb_func_start sub_800DFB4 -sub_800DFB4: @ 800DFB4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - cmp r3, 0 - bne _0800DFCA - cmp r2, 0 - bne _0800DFCA - movs r3, 0xE7 - movs r2, 0x8 -_0800DFCA: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800E024 - ldr r0, =gUnknown_082ED5F0 - adds r1, r3, 0 - movs r3, 0 - bl CreateSprite - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gSprites - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - adds r4, r0 - ldr r0, =0x00001234 - strh r0, [r4, 0x3C] - ldr r0, =gUnknown_082ED5E0 - ldrh r0, [r0, 0x6] - bl GetSpriteTileStartByTag - strh r0, [r4, 0x3A] - adds r4, 0x3E - ldrb r0, [r4] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4] - ldr r0, =gUnknown_02022B10 - strb r5, [r0] - b _0800E06A - .pool -_0800E024: - ldr r0, =gUnknown_082ED5F0 - adds r1, r3, 0 - movs r3, 0 - bl CreateSprite - ldr r4, =gUnknown_02022B10 - strb r0, [r4] - ldr r5, =gSprites - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x00001234 - strh r1, [r0, 0x3C] - ldr r0, =gUnknown_082ED5E0 - ldrh r0, [r0, 0x6] - bl GetSpriteTileStartByTag - ldrb r2, [r4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - strh r0, [r1, 0x3A] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_0800E06A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800DFB4 - thumb_func_start sub_800E084 sub_800E084: @ 800E084 push {r4,lr} ldr r4, =gSprites - ldr r3, =gUnknown_02022B10 + ldr r3, =gWirelessStatusIndicatorSpriteId ldrb r1, [r3] lsls r0, r1, 4 adds r0, r1 @@ -139,7 +52,7 @@ _0800E0CA: thumb_func_start sub_800E0E8 sub_800E0E8: @ 800E0E8 push {r4,lr} - ldr r4, =gUnknown_082ED5E0 + ldr r4, =sWirelessStatusIndicatorSpriteSheet ldrh r0, [r4, 0x6] bl GetSpriteTileStartByTag lsls r0, 16 @@ -149,9 +62,9 @@ sub_800E0E8: @ 800E0E8 adds r0, r4, 0 bl LoadCompressedObjectPic _0800E100: - ldr r0, =gUnknown_082ED5E8 + ldr r0, =sWirelessStatusIndicatorSpritePalette bl LoadSpritePalette - ldr r1, =gUnknown_02022B10 + ldr r1, =gWirelessStatusIndicatorSpriteId movs r0, 0xFF strb r0, [r1] pop {r4} @@ -215,7 +128,7 @@ sub_800E174: @ 800E174 push {r4-r7,lr} mov r7, r8 push {r7} - ldr r1, =gUnknown_02022B10 + ldr r1, =gWirelessStatusIndicatorSpriteId ldrb r0, [r1] cmp r0, 0xFF bne _0800E184 @@ -377,7 +290,7 @@ _0800E2B2: movs r1, 0x84 lsls r1, 3 adds r0, r4, r1 - ldr r1, =gUnknown_082ED570 + ldr r1, =sWirelessStatusIndicatorOamData ldr r2, [r1, 0x4] ldr r1, [r1] str r1, [r0] diff --git a/asm/rom4.s b/asm/rom4.s index 478446a35..cb18d01a2 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -3775,7 +3775,7 @@ _080864E0: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite b _08086506 .pool _080864FC: @@ -4063,7 +4063,7 @@ _0808676C: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite b _08086792 .pool _08086788: diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index fad003150..d89593cb4 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -764,7 +764,7 @@ _08012BF6: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite movs r0, 0x5 strb r0, [r6, 0x19] ldrb r1, [r6, 0x13] @@ -2540,7 +2540,7 @@ sub_8013BD8: @ 8013BD8 bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite ldrb r0, [r4, 0xE] bl sub_81AE70C ldr r0, =gStringVar1 @@ -4319,7 +4319,7 @@ _08014C82: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite ldr r1, [r5] ldrb r0, [r5, 0x13] lsls r0, 5 @@ -4816,7 +4816,7 @@ _080150D6: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite ldrb r0, [r7, 0xE] bl sub_81AE70C ldr r0, =gStringVar1 @@ -5188,7 +5188,7 @@ _08015452: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite ldr r0, [r5] adds r4, r0, 0 adds r4, 0x10 @@ -22061,7 +22061,7 @@ _0801DEC8: bl sub_800E0E8 movs r0, 0xE8 movs r1, 0x96 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite _0801DF04: add sp, 0x4 pop {r4-r6} @@ -28419,7 +28419,7 @@ _08021278: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite adds r0, r5, 0 bl sub_8022730 ldr r0, =gSpriteCoordOffsetY @@ -35628,7 +35628,7 @@ _08024C5A: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite b _08024D20 .pool _08024C80: @@ -47465,7 +47465,7 @@ _0802AD0C: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite ldr r1, [r4] b _0802ADC0 .pool diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index 3a3cf4269..220dfeefb 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -1100,7 +1100,7 @@ sub_80F90DC: @ 80F90DC bl sub_800E0E8 movs r0, 0x8 movs r1, 0x8 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite _080F90FE: pop {r0} bx r0 diff --git a/asm/trade.s b/asm/trade.s index 399cc506e..68ea6affd 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -563,7 +563,7 @@ _0807765C: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite b _08077B46 .pool _08077680: @@ -1189,7 +1189,7 @@ _08077C3C: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite _08077C50: ldr r1, =gMain movs r3, 0x87 @@ -7514,7 +7514,7 @@ _0807B0F0: bl sub_800E0E8 movs r0, 0 movs r1, 0 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite _0807B110: ldr r0, =sub_807EA2C bl SetMainCallback2 diff --git a/asm/trainer_card.s b/asm/trainer_card.s index dc0a32b77..8cc500552 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -198,7 +198,7 @@ _080C2836: bl sub_800E0E8 movs r0, 0xE6 movs r1, 0x96 - bl sub_800DFB4 + bl CreateWirelessStatusIndicatorSprite _080C2852: movs r6, 0x1 negs r6, r6 diff --git a/data/link_rfu.s b/data/link_rfu.s index ac9ae69f5..2f5e9ff85 100644 --- a/data/link_rfu.s +++ b/data/link_rfu.s @@ -3,52 +3,6 @@ .section .rodata - .align 2 -gUnknown_082ED570:: @ 82ED570 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082ED578:: @ 82ED578 - .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x0005, 0x0010, 0x000a - .2byte 0x000c, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED594:: @ 82ED594 - .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x000a, 0x0008, 0x0005 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED5A8:: @ 82ED5A8 - .2byte 0x0004, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED5B4:: @ 82ED5B4 - .2byte 0x0004, 0x000a, 0x0014, 0x000a, 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED5C0:: @ 82ED5C0 - .2byte 0x0018, 0x000a, 0x0004, 0x000a, 0xfffe, 0x0000 - - .align 2 -gUnknown_082ED5CC:: @ 82ED5CC - .4byte gUnknown_082ED578 - .4byte gUnknown_082ED594 - .4byte gUnknown_082ED5A8 - .4byte gUnknown_082ED5B4 - .4byte gUnknown_082ED5C0 - - .align 2 -gUnknown_082ED5E0:: @ 82ED5E0 - obj_tiles gWirelessLinkIconPic, 0x0380, 0xD431 - - .align 2 -gUnknown_082ED5E8:: @ 82ED5E8 - obj_pal gWirelessLinkIconPalette, 0xD432 - - .align 2 -gUnknown_082ED5F0:: @ 82ED5F0 - spr_template 0xD431, 0xD432, gUnknown_082ED570, gUnknown_082ED5CC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - .align 2 gUnknown_082ED608:: @ 82ED608 .byte 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00 diff --git a/include/link.h b/include/link.h index 41dd8f9c8..b33b7a012 100644 --- a/include/link.h +++ b/include/link.h @@ -234,7 +234,7 @@ u8 GetLinkPlayerCount(void); bool32 InUnionRoom(void); void sub_800E0E8(void); bool8 sub_800A520(void); -void sub_800DFB4(u8, u8); +void CreateWirelessStatusIndicatorSprite(u8, u8); void sub_800ADF8(void); void sub_800B488(void); void sub_800A620(void); diff --git a/src/battle_2.c b/src/battle_2.c index c4713a88a..efef5355b 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -736,7 +736,7 @@ static void CB2_HandleStartBattle(void) gBattleCommunication[MULTIUSE_STATE] = 2; } if (gWirelessCommType) - sub_800DFB4(0, 0); + CreateWirelessStatusIndicatorSprite(0, 0); } } else @@ -938,7 +938,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) } if (gWirelessCommType) - sub_800DFB4(0, 0); + CreateWirelessStatusIndicatorSprite(0, 0); } } else @@ -1325,7 +1325,7 @@ static void CB2_HandleStartMultiBattle(void) gBattleCommunication[MULTIUSE_STATE]++; } if (gWirelessCommType) - sub_800DFB4(0, 0); + CreateWirelessStatusIndicatorSprite(0, 0); } } else diff --git a/src/berry_blender.c b/src/berry_blender.c index 604db9b46..11ae82011 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -956,7 +956,7 @@ static void sub_807FAC8(void) if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType) { sub_800E0E8(); - sub_800DFB4(0, 0); + CreateWirelessStatusIndicatorSprite(0, 0); } SetVBlankCallback(VBlankCB0_BerryBlender); sBerryBlenderData->mainState++; @@ -1162,7 +1162,7 @@ static void sub_8080018(void) if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType) { sub_800E0E8(); - sub_800DFB4(0, 0); + CreateWirelessStatusIndicatorSprite(0, 0); } sBerryBlenderData->mainState++; break; diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 03b9dec3f..9be016826 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -405,7 +405,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) if (gWirelessCommType) { sub_800E0E8(); - sub_800DFB4(0, 0); + CreateWirelessStatusIndicatorSprite(0, 0); } BlendPalettes(-1,0x10, 0); gMain.state++; diff --git a/src/link_rfu.c b/src/link_rfu.c index c1a3b1d09..68d42ec4a 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -20,7 +20,7 @@ ALIGNED(4) IWRAM_DATA u8 gUnknown_03000D78[8]; IWRAM_DATA u8 gUnknown_03000D80[16]; IWRAM_DATA u16 gUnknown_03000D90[8]; -EWRAM_DATA u8 gUnknown_02022B10 = 0; +EWRAM_DATA u8 gWirelessStatusIndicatorSpriteId = 0; EWRAM_DATA ALIGNED(4) struct UnkLinkRfuStruct_02022B14 gUnknown_02022B14 = {}; EWRAM_DATA ALIGNED(2) u8 gUnknown_02022B22[8] = {}; EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {}; @@ -49,7 +49,7 @@ bool32 sub_8010454(u16 a0); const u16 gWirelessLinkIconPalette[] = INCBIN_U16("graphics/interface/wireless_link_icon.gbapal"); const u8 gWirelessLinkIconPic[] = INCBIN_U8("graphics/interface/wireless_link_icon.4bpp.lz"); -const u8 gUnknown_082ED370[] = { +const u8 sWireless_ASCIItoRSETable[] = { 0xff, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, @@ -83,7 +83,7 @@ const u8 gUnknown_082ED370[] = { 0x2c, 0x2e, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94 }; -const u8 gUnknown_082ED470[] = { +const u8 sWireless_RSEtoASCIITable[] = { 0x20, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, @@ -117,6 +117,67 @@ const u8 gUnknown_082ED470[] = { 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 }; +const struct OamData sWirelessStatusIndicatorOamData = { + .size = 1 +}; +static const union AnimCmd sWirelessStatusIndicatorAnim0[] = { + // 3 bars + ANIMCMD_FRAME( 4, 5), + ANIMCMD_FRAME( 8, 5), + ANIMCMD_FRAME(12, 5), + ANIMCMD_FRAME(16, 10), + ANIMCMD_FRAME(12, 5), + ANIMCMD_FRAME( 8, 5), + ANIMCMD_JUMP(0) +}; +static const union AnimCmd sWirelessStatusIndicatorAnim1[] = { + // 2 bars + ANIMCMD_FRAME( 4, 5), + ANIMCMD_FRAME( 8, 5), + ANIMCMD_FRAME(12, 10), + ANIMCMD_FRAME( 8, 5), + ANIMCMD_JUMP(0) +}; +static const union AnimCmd sWirelessStatusIndicatorAnim2[] = { + // 1 bar + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(8, 5), + ANIMCMD_JUMP(0) +}; +static const union AnimCmd sWirelessStatusIndicatorAnim3[] = { + // searching + ANIMCMD_FRAME( 4, 10), + ANIMCMD_FRAME(20, 10), + ANIMCMD_JUMP(0) +}; +static const union AnimCmd sWirelessStatusIndicatorAnim4[] = { + // error + ANIMCMD_FRAME(24, 10), + ANIMCMD_FRAME( 4, 10), + ANIMCMD_JUMP(0) +}; +static const union AnimCmd *const sWirelessStatusIndicatorAnims[] = { + sWirelessStatusIndicatorAnim0, + sWirelessStatusIndicatorAnim1, + sWirelessStatusIndicatorAnim2, + sWirelessStatusIndicatorAnim3, + sWirelessStatusIndicatorAnim4 +}; +const struct SpriteSheet sWirelessStatusIndicatorSpriteSheet = { + gWirelessLinkIconPic, 0x0380, 0xD431 +}; +const struct SpritePalette sWirelessStatusIndicatorSpritePalette = { + gWirelessLinkIconPalette, 0xD432 +}; +static const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = { + 0xD431, + 0xD432, + &sWirelessStatusIndicatorOamData, + sWirelessStatusIndicatorAnims, + NULL, + gDummySpriteAffineAnimTable, + SpriteCallbackDummy +}; // .text @@ -1810,7 +1871,7 @@ void PkmnStrToASCII(u8 *q1, const u8 *q2) for (i = 0; q2[i] != EOS; i++) { - q1[i] = gUnknown_082ED470[q2[i]]; + q1[i] = sWireless_RSEtoASCIITable[q2[i]]; } q1[i] = 0; } @@ -1821,7 +1882,7 @@ void ASCIIToPkmnStr(u8 *q1, const u8 *q2) for (i = 0; q2[i] != 0; i++) { - q1[i] = gUnknown_082ED370[q2[i]]; + q1[i] = sWireless_ASCIItoRSETable[q2[i]]; } q1[i] = EOS; } @@ -2013,3 +2074,29 @@ void sub_800DF90(void *buff1, void *buff2) memcpy(buff1, &gUnknown_02022B14, 13); memcpy(buff2, gUnknown_02022B22, 8); } + +void CreateWirelessStatusIndicatorSprite(u8 x, u8 y) +{ + u8 sprId; + + if (x == 0 && y == 0) + { + x = 0xE7; + y = 0x08; + } + if (gUnknown_03007890->unk_00 == 1) + { + sprId = CreateSprite(&sWirelessStatusIndicatorSpriteTemplate, x, y, 0); + gSprites[sprId].data7 = 0x1234; + gSprites[sprId].data6 = GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag); + gSprites[sprId].invisible = TRUE; + gWirelessStatusIndicatorSpriteId = sprId; + } + else + { + gWirelessStatusIndicatorSpriteId = CreateSprite(&sWirelessStatusIndicatorSpriteTemplate, x, y, 0); + gSprites[gWirelessStatusIndicatorSpriteId].data7 = 0x1234; + gSprites[gWirelessStatusIndicatorSpriteId].data6 = GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag); + gSprites[gWirelessStatusIndicatorSpriteId].invisible = TRUE; + } +} diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index de2dcf213..a2efbf1e5 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -180,7 +180,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void) if (gWirelessCommType != 0 && gReceivedRemoteLinkPlayers != 0) { sub_800E0E8(); - sub_800DFB4(0, 0); + CreateWirelessStatusIndicatorSprite(0, 0); } } break; From 3dd7ec7526af6f49b77367d91cd1a9565847dc64 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 3 Dec 2017 22:23:46 -0500 Subject: [PATCH 087/123] through sub_800E15C --- asm/link_rfu.s | 116 ------------------------------------------------- src/link_rfu.c | 49 ++++++++++++++++++++- 2 files changed, 48 insertions(+), 117 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 35628de34..7e67be316 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,122 +7,6 @@ @ file boundary? - thumb_func_start sub_800E084 -sub_800E084: @ 800E084 - push {r4,lr} - ldr r4, =gSprites - ldr r3, =gWirelessStatusIndicatorSpriteId - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r4 - movs r0, 0x3C - ldrsh r1, [r2, r0] - ldr r0, =0x00001234 - cmp r1, r0 - bne _0800E0CA - movs r0, 0 - strh r0, [r2, 0x3C] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r3, =gMain - movs r0, 0x84 - lsls r0, 3 - adds r3, r0 - ldr r0, =gDummyOamData - ldr r1, [r0] - ldr r2, [r0, 0x4] - str r1, [r3] - str r2, [r3, 0x4] - ldr r1, =0x070003e8 - movs r2, 0x4 - bl CpuSet -_0800E0CA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E084 - - thumb_func_start sub_800E0E8 -sub_800E0E8: @ 800E0E8 - push {r4,lr} - ldr r4, =sWirelessStatusIndicatorSpriteSheet - ldrh r0, [r4, 0x6] - bl GetSpriteTileStartByTag - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - bne _0800E100 - adds r0, r4, 0 - bl LoadCompressedObjectPic -_0800E100: - ldr r0, =sWirelessStatusIndicatorSpritePalette - bl LoadSpritePalette - ldr r1, =gWirelessStatusIndicatorSpriteId - movs r0, 0xFF - strb r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E0E8 - - thumb_func_start sub_800E124 -sub_800E124: @ 800E124 - push {r4,lr} - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r2, [r0, 0x2] - movs r3, 0 - movs r4, 0x1 -_0800E130: - adds r0, r2, 0 - ands r0, r4 - cmp r0, 0 - beq _0800E148 - ldr r0, [r1] - adds r0, 0xA - adds r0, r3 - ldrb r0, [r0] - b _0800E156 - .pool -_0800E148: - lsrs r2, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800E130 - movs r0, 0 -_0800E156: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_800E124 - - thumb_func_start sub_800E15C -sub_800E15C: @ 800E15C - push {lr} - adds r2, r0, 0 - movs r3, 0x32 - ldrsh r0, [r2, r3] - cmp r0, r1 - beq _0800E170 - movs r0, 0 - strh r1, [r2, 0x32] - strh r0, [r2, 0x34] - strh r0, [r2, 0x36] -_0800E170: - pop {r0} - bx r0 - thumb_func_end sub_800E15C - thumb_func_start sub_800E174 sub_800E174: @ 800E174 push {r4-r7,lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index 68d42ec4a..eaf919bae 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2,6 +2,7 @@ // Includes #include "global.h" #include "rng.h" +#include "decompress.h" #include "text.h" #include "event_data.h" #include "link.h" @@ -163,7 +164,7 @@ static const union AnimCmd *const sWirelessStatusIndicatorAnims[] = { sWirelessStatusIndicatorAnim3, sWirelessStatusIndicatorAnim4 }; -const struct SpriteSheet sWirelessStatusIndicatorSpriteSheet = { +const struct CompressedSpriteSheet sWirelessStatusIndicatorSpriteSheet = { gWirelessLinkIconPic, 0x0380, 0xD431 }; const struct SpritePalette sWirelessStatusIndicatorSpritePalette = { @@ -2100,3 +2101,49 @@ void CreateWirelessStatusIndicatorSprite(u8 x, u8 y) gSprites[gWirelessStatusIndicatorSpriteId].invisible = TRUE; } } + +void sub_800E084(void) +{ + if (gSprites[gWirelessStatusIndicatorSpriteId].data7 == 0x1234) + { + gSprites[gWirelessStatusIndicatorSpriteId].data7 = 0; + DestroySprite(&gSprites[gWirelessStatusIndicatorSpriteId]); + gMain.oamBuffer[125] = gDummyOamData; + CpuCopy16(&gDummyOamData, (struct OamData *)OAM + 125, sizeof(struct OamData)); + } +} + +void sub_800E0E8(void) +{ + if (GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag) == 0xFFFF) + { + LoadCompressedObjectPic(&sWirelessStatusIndicatorSpriteSheet); + } + LoadSpritePalette(&sWirelessStatusIndicatorSpritePalette); + gWirelessStatusIndicatorSpriteId = 0xFF; +} + +u8 sub_800E124(void) +{ + u8 i; + u8 flags = gUnknown_03007890->unk_02; + for (i = 0; i < 4; i++) + { + if (flags & 1) + { + return gUnknown_03007890->unk_0a[i]; + } + flags >>= 1; + } + return 0; +} + +void sub_800E15C(struct Sprite *sprite, int val) +{ + if (sprite->data2 != val) + { + sprite->data2 = val; + sprite->data3 = 0; + sprite->data4 = 0; + } +} From feb0d13534c9fbd424091297e2510b2f0e206402 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 3 Dec 2017 23:33:49 -0500 Subject: [PATCH 088/123] sub_800E174 --- asm/link_rfu.s | 243 ------------------------------------------------- src/link_rfu.c | 80 +++++++++++++++- 2 files changed, 77 insertions(+), 246 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 7e67be316..0a1881093 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,249 +7,6 @@ @ file boundary? - thumb_func_start sub_800E174 -sub_800E174: @ 800E174 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r1, =gWirelessStatusIndicatorSpriteId - ldrb r0, [r1] - cmp r0, 0xFF - bne _0800E184 - b _0800E346 -_0800E184: - ldr r2, =gSprites - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - movs r0, 0x3C - ldrsh r1, [r2, r0] - ldr r0, =0x00001234 - cmp r1, r0 - beq _0800E19C - b _0800E346 -_0800E19C: - adds r6, r2, 0 - movs r5, 0xFF - movs r4, 0 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800E1F6 - adds r7, r6, 0 - adds r7, 0x28 - movs r1, 0x29 - adds r1, r6 - mov r8, r1 - b _0800E1E6 - .pool -_0800E1C8: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_800DD1C - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bcc _0800E1E6 - adds r0, r4, 0 - bl sub_800DD1C - lsls r0, 24 - lsrs r5, r0, 24 -_0800E1E6: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r4, r0 - blt _0800E1C8 - b _0800E208 -_0800E1F6: - bl sub_800E124 - lsls r0, 24 - lsrs r5, r0, 24 - adds r7, r6, 0 - adds r7, 0x28 - movs r2, 0x29 - adds r2, r6 - mov r8, r2 -_0800E208: - bl sub_8012224 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800E218 - movs r0, 0x4 - b _0800E246 -_0800E218: - cmp r5, 0x18 - bhi _0800E220 - movs r0, 0x3 - b _0800E246 -_0800E220: - adds r0, r5, 0 - subs r0, 0x19 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x65 - bhi _0800E230 - movs r0, 0x2 - b _0800E246 -_0800E230: - adds r0, r5, 0 - subs r0, 0x7F - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x65 - bhi _0800E240 - movs r0, 0x1 - b _0800E246 -_0800E240: - cmp r5, 0xE4 - bls _0800E248 - movs r0, 0 -_0800E246: - strh r0, [r6, 0x2E] -_0800E248: - movs r3, 0x2E - ldrsh r1, [r6, r3] - movs r2, 0x30 - ldrsh r0, [r6, r2] - cmp r1, r0 - beq _0800E25E - adds r0, r6, 0 - bl sub_800E15C - ldrh r0, [r6, 0x2E] - strh r0, [r6, 0x30] -_0800E25E: - movs r0, 0x32 - ldrsh r1, [r6, r0] - ldr r2, [r6, 0x8] - lsls r1, 2 - adds r1, r2 - movs r3, 0x36 - ldrsh r0, [r6, r3] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsls r0, 10 - lsrs r0, 26 - movs r3, 0x34 - ldrsh r1, [r6, r3] - cmp r0, r1 - bge _0800E2AC - ldrh r0, [r6, 0x36] - adds r0, 0x1 - movs r3, 0 - strh r0, [r6, 0x36] - strh r3, [r6, 0x34] - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 2 - adds r0, r2 - movs r2, 0x36 - ldrsh r1, [r6, r2] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - movs r0, 0 - ldrsh r1, [r1, r0] - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - bne _0800E2B2 - strh r3, [r6, 0x36] - b _0800E2B2 -_0800E2AC: - ldrh r0, [r6, 0x34] - adds r0, 0x1 - strh r0, [r6, 0x34] -_0800E2B2: - ldr r4, =gMain - movs r1, 0x84 - lsls r1, 3 - adds r0, r4, r1 - ldr r1, =sWirelessStatusIndicatorOamData - ldr r2, [r1, 0x4] - ldr r1, [r1] - str r1, [r0] - str r2, [r0, 0x4] - movs r3, 0x20 - ldrsh r2, [r6, r3] - movs r1, 0 - ldrsb r1, [r7, r1] - adds r2, r1 - ldr r1, =0x00000422 - adds r5, r4, r1 - ldr r3, =0x000001ff - adds r1, r3, 0 - ands r2, r1 - ldrh r3, [r5] - ldr r1, =0xfffffe00 - ands r1, r3 - orrs r1, r2 - strh r1, [r5] - ldrh r1, [r6, 0x22] - mov r2, r8 - ldrb r2, [r2] - adds r1, r2 - strb r1, [r0] - ldrb r2, [r6, 0x5] - ldr r3, =0x00000425 - adds r5, r4, r3 - lsrs r2, 4 - lsls r2, 4 - ldrb r3, [r5] - movs r1, 0xF - ands r1, r3 - orrs r1, r2 - strb r1, [r5] - movs r1, 0x32 - ldrsh r2, [r6, r1] - ldr r1, [r6, 0x8] - lsls r2, 2 - adds r2, r1 - movs r3, 0x36 - ldrsh r1, [r6, r3] - ldr r2, [r2] - lsls r1, 2 - adds r1, r2 - ldrh r2, [r1] - ldrh r6, [r6, 0x3A] - adds r2, r6 - ldr r1, =0x00000424 - adds r4, r1 - ldr r3, =0x000003ff - adds r1, r3, 0 - ands r2, r1 - ldrh r3, [r4] - ldr r1, =0xfffffc00 - ands r1, r3 - orrs r1, r2 - strh r1, [r4] - ldr r1, =0x070003e8 - movs r2, 0x4 - bl CpuSet - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800E346 - bl sub_800E084 -_0800E346: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E174 - thumb_func_start sub_800E378 sub_800E378: @ 800E378 push {lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index eaf919bae..b663ec20e 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -45,6 +45,8 @@ static void sub_800D610(void); void sub_800D630(void); bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); bool32 sub_8010454(u16 a0); +u8 sub_8011A74(void); +u8 sub_8012224(void); // .rodata @@ -2138,12 +2140,84 @@ u8 sub_800E124(void) return 0; } -void sub_800E15C(struct Sprite *sprite, int val) +void sub_800E15C(struct Sprite *sprite, int signalStrengthAnimNum) { - if (sprite->data2 != val) + if (sprite->data2 != signalStrengthAnimNum) { - sprite->data2 = val; + sprite->data2 = signalStrengthAnimNum; sprite->data3 = 0; sprite->data4 = 0; } } + +void sub_800E174(void) +{ + if (gWirelessStatusIndicatorSpriteId != 0xFF && gSprites[gWirelessStatusIndicatorSpriteId].data7 == 0x1234) + { + struct Sprite *sprite = &gSprites[gWirelessStatusIndicatorSpriteId]; + u8 signalStrength = 255; + u8 i = 0; + if (gUnknown_03007890->unk_00 == 1) + { + for (i = 0; i < GetLinkPlayerCount() - 1; i++) + { + if (signalStrength >= sub_800DD1C(i + 1)) + { + signalStrength = sub_800DD1C(i + 1); + } + } + } + else + { + signalStrength = sub_800E124(); + } + if (sub_8012224() == TRUE) + { + sprite->data0 = 4; + } + else if (signalStrength < 25) + { + sprite->data0 = 3; + } + else if (signalStrength >= 25 && signalStrength < 127) + { + sprite->data0 = 2; + } + else if (signalStrength >= 127 && signalStrength < 229) + { + sprite->data0 = 1; + } + else if (signalStrength >= 229) + { + sprite->data0 = 0; + } + if (sprite->data0 != sprite->data1) + { + sub_800E15C(sprite, sprite->data0); + sprite->data1 = sprite->data0; + } + if (sprite->anims[sprite->data2][sprite->data4].frame.duration < sprite->data3) + { + sprite->data4++; + sprite->data3 = 0; + if (sprite->anims[sprite->data2][sprite->data4].type == -2) + { + sprite->data4 = 0; + } + } + else + { + sprite->data3++; + } + gMain.oamBuffer[125] = sWirelessStatusIndicatorOamData; + gMain.oamBuffer[125].x = sprite->pos1.x + sprite->centerToCornerVecX; + gMain.oamBuffer[125].y = sprite->pos1.y + sprite->centerToCornerVecY; + gMain.oamBuffer[125].paletteNum = sprite->oam.paletteNum; + gMain.oamBuffer[125].tileNum = sprite->data6 + sprite->anims[sprite->data2][sprite->data4].frame.imageValue; + CpuCopy16(gMain.oamBuffer + 125, (struct OamData *)OAM + 125, sizeof(struct OamData)); + if (sub_8011A74() == 1) + { + sub_800E084(); + } + } +} From 0b58905eeaf63584af069f9f74360aaf52b407b8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 4 Dec 2017 19:10:37 -0500 Subject: [PATCH 089/123] sub_800E3A8 --- asm/link_rfu.s | 227 ----------------------------------------------- include/global.h | 9 +- src/link_rfu.c | 71 +++++++++++++++ 3 files changed, 79 insertions(+), 228 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 0a1881093..93fdefbd2 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -7,233 +7,6 @@ @ file boundary? - thumb_func_start sub_800E378 -sub_800E378: @ 800E378 - push {lr} - stm r0!, {r1} - adds r1, r2, 0 - bl StringCopy - pop {r0} - bx r0 - thumb_func_end sub_800E378 - - thumb_func_start sub_800E388 -sub_800E388: @ 800E388 - push {lr} - adds r2, r0, 0 - movs r1, 0 -_0800E38E: - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800E39A - movs r0, 0x1 - b _0800E3A2 -_0800E39A: - adds r1, 0x1 - cmp r1, 0x7 - ble _0800E38E - movs r0, 0 -_0800E3A2: - pop {r1} - bx r1 - thumb_func_end sub_800E388 - - thumb_func_start sub_800E3A8 -sub_800E3A8: @ 800E3A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - bne _0800E3BE - b _0800E520 -_0800E3BE: - movs r0, 0xF0 - bl AllocZeroed - str r0, [sp, 0x14] - movs r4, 0 - b _0800E434 - .pool -_0800E3D0: - lsls r2, r4, 2 - mov r0, sp - adds r1, r0, r2 - movs r0, 0x1 - negs r0, r0 - str r0, [r1] - movs r5, 0 - mov r8, r2 - lsls r0, r4, 3 - adds r1, r4, 0x1 - mov r9, r1 - subs r0, r4 - lsls r0, 2 - str r0, [sp, 0x1C] - ldr r7, =gLinkPlayers + 8 - mov r10, r7 - ldr r6, =0x00003b98 - movs r4, 0 - mov r0, r10 - subs r0, 0x4 - ldr r1, [sp, 0x1C] - adds r3, r1, r0 -_0800E3FC: - ldrh r1, [r3] - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r7, =0x00003b98 - adds r0, r2, r7 - adds r0, r4 - ldr r0, [r0] - cmp r1, r0 - bne _0800E428 - adds r1, r2, r6 - adds r1, 0x4 - ldr r0, [sp, 0x1C] - add r0, r10 - str r3, [sp, 0x18] - bl StringCompare - ldr r3, [sp, 0x18] - cmp r0, 0 - bne _0800E428 - mov r0, sp - add r0, r8 - str r5, [r0] -_0800E428: - adds r6, 0xC - adds r4, 0xC - adds r5, 0x1 - cmp r5, 0x13 - ble _0800E3FC - mov r4, r9 -_0800E434: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _0800E3D0 - movs r0, 0 - mov r8, r0 - movs r4, 0 - mov r7, sp - movs r5, 0 - ldr r6, [sp, 0x14] - b _0800E4AC - .pool -_0800E45C: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - beq _0800E4A6 - ldr r2, =gLinkPlayers - adds r0, r5, r2 - ldrh r0, [r0, 0x1A] - cmp r0, 0x1 - beq _0800E4A6 - adds r0, r2, 0x4 - adds r0, r5, r0 - ldrh r1, [r0] - adds r2, 0x8 - adds r2, r5, r2 - adds r0, r6, 0 - bl sub_800E378 - ldr r2, [r7] - cmp r2, 0 - blt _0800E4A0 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldr r1, =0x00003b9c - adds r0, r1 - movs r1, 0 - movs r2, 0x8 - bl memset -_0800E4A0: - adds r6, 0xC - movs r0, 0x1 - add r8, r0 -_0800E4A6: - adds r7, 0x4 - adds r5, 0x1C - adds r4, 0x1 -_0800E4AC: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _0800E45C - movs r4, 0 - ldr r1, =gSaveBlock1Ptr - mov r9, r1 - ldr r6, =0x00003b98 - movs r7, 0 - mov r1, r8 - lsls r0, r1, 1 - add r0, r8 - lsls r0, 2 - ldr r1, [sp, 0x14] - adds r5, r0, r1 -_0800E4CE: - mov r1, r9 - ldr r0, [r1] - adds r0, r6 - adds r0, 0x4 - bl sub_800E388 - cmp r0, 0 - beq _0800E500 - mov r0, r9 - ldr r2, [r0] - ldr r1, =0x00003b98 - adds r0, r2, r1 - adds r0, r7 - ldr r1, [r0] - adds r2, r6 - adds r2, 0x4 - adds r0, r5, 0 - bl sub_800E378 - adds r5, 0xC - movs r0, 0x1 - add r8, r0 - mov r1, r8 - cmp r1, 0x13 - bgt _0800E50A -_0800E500: - adds r6, 0xC - adds r7, 0xC - adds r4, 0x1 - cmp r4, 0x13 - ble _0800E4CE -_0800E50A: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r7, =0x00003b98 - adds r0, r7 - ldr r1, [sp, 0x14] - movs r2, 0xF0 - bl memcpy - ldr r0, [sp, 0x14] - bl Free -_0800E520: - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E3A8 - thumb_func_start sub_800E540 sub_800E540: @ 800E540 push {r4-r7,lr} diff --git a/include/global.h b/include/global.h index cfde8ce52..fd52e5a28 100644 --- a/include/global.h +++ b/include/global.h @@ -562,6 +562,11 @@ struct WaldaPhrase bool8 patternUnlocked; }; +struct UnkSaveSubstruct_3b98 { + u32 trainerId; + u8 trainerName[8]; +}; + struct SaveBlock1 { /*0x00*/ struct Coords16 pos; @@ -646,7 +651,9 @@ struct SaveBlock1 /*0x3B14*/ struct RecordMixingGift recordMixingGift; /*0x3B24*/ u8 seen2[52]; /*0x3B58*/ LilycoveLady lilycoveLady; - /*0x3B88*/ u8 filler_3B88[0x1E8]; + /*0x3B88*/ u8 filler_3B88[0x10]; + /*0x3B98*/ struct UnkSaveSubstruct_3b98 unk_3B98[20]; + /*0x3C88*/ u8 filler_3C88[0xE8]; /*0x3D70*/ struct WaldaPhrase waldaPhrase; // sizeof: 0x3D88 }; diff --git a/src/link_rfu.c b/src/link_rfu.c index b663ec20e..a098be336 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1,9 +1,11 @@ // Includes #include "global.h" +#include "malloc.h" #include "rng.h" #include "decompress.h" #include "text.h" +#include "string_util.h" #include "event_data.h" #include "link.h" #include "librfu.h" @@ -2221,3 +2223,72 @@ void sub_800E174(void) } } } + +void sub_800E378(struct UnkSaveSubstruct_3b98 *dest, u32 trainerId, const u8 *name) +{ + dest->trainerId = trainerId; + StringCopy(dest->trainerName, name); +} + +bool32 sub_800E388(const u8 *name) +{ + int i; + + for (i = 0; i < 8; i++) + { + if (name[i] != 0) + { + return TRUE; + } + } + return FALSE; +} + +void sub_800E3A8(void) +{ + if (gWirelessCommType != 0) + { + int i; + int j; + int cnt; + int sp0[5]; + struct UnkSaveSubstruct_3b98 *sp14 = calloc(20, sizeof(struct UnkSaveSubstruct_3b98)); + for (i = 0; i < GetLinkPlayerCount(); i++) + { + sp0[i] = -1; + for (j = 0; j < 20; j++) + { + if ((u16)gLinkPlayers[i].trainerId == gSaveBlock1Ptr->unk_3B98[j].trainerId && StringCompare(gLinkPlayers[i].name, gSaveBlock1Ptr->unk_3B98[j].trainerName) == 0) + { + sp0[i] = j; + } + } + } + cnt = 0; + for (i = 0; i < GetLinkPlayerCount(); i++) + { + if (i != GetMultiplayerId() && gLinkPlayers[i].language != LANGUAGE_JAPANESE) + { + sub_800E378(&sp14[cnt], (u16)gLinkPlayers[i].trainerId, gLinkPlayers[i].name); + if (sp0[i] >= 0) + { + memset(gSaveBlock1Ptr->unk_3B98[sp0[i]].trainerName, 0, 8); + } + cnt++; + } + } + for (i = 0; i < 20; i++) + { + if (sub_800E388(gSaveBlock1Ptr->unk_3B98[i].trainerName)) + { + sub_800E378(&sp14[cnt], gSaveBlock1Ptr->unk_3B98[i].trainerId, gSaveBlock1Ptr->unk_3B98[i].trainerName); + if (++cnt >= 20) + { + break; + } + } + } + memcpy(gSaveBlock1Ptr->unk_3B98, sp14, 20 * sizeof(struct UnkSaveSubstruct_3b98)); + free(sp14); + } +} From 92fd61d6f28b28fb50421aaba6a978850ed87629 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 4 Dec 2017 19:51:26 -0500 Subject: [PATCH 090/123] through sub_800E604 --- asm/link_rfu.s | 188 --------------------------------------------- include/link.h | 2 +- include/link_rfu.h | 24 +++++- src/link_rfu.c | 63 +++++++++++++++ 4 files changed, 84 insertions(+), 193 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 93fdefbd2..5be4b05f2 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,194 +5,6 @@ .text -@ file boundary? - - thumb_func_start sub_800E540 -sub_800E540: @ 800E540 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r9, r1 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - movs r7, 0 - ldr r6, =gSaveBlock1Ptr - ldr r4, =0x00003b98 - movs r5, 0 -_0800E558: - ldr r0, [r6] - adds r0, r4 - adds r0, 0x4 - mov r1, r9 - bl StringCompare - cmp r0, 0 - bne _0800E584 - ldr r0, [r6] - ldr r1, =0x00003b98 - adds r0, r1 - adds r0, r5 - ldr r0, [r0] - cmp r0, r8 - bne _0800E584 - movs r0, 0x1 - b _0800E59E - .pool -_0800E584: - ldr r0, [r6] - adds r0, r4 - adds r0, 0x4 - bl sub_800E388 - cmp r0, 0 - beq _0800E59C - adds r4, 0xC - adds r5, 0xC - adds r7, 0x1 - cmp r7, 0x13 - ble _0800E558 -_0800E59C: - movs r0, 0 -_0800E59E: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800E540 - - thumb_func_start sub_800E5AC -sub_800E5AC: @ 800E5AC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - ldr r0, =0x00003b98 - mov r8, r0 - movs r7, 0 - mov r6, r8 - movs r5, 0 - movs r4, 0x13 -_0800E5C0: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - mov r2, r8 - adds r0, r1, r2 - adds r0, r5 - str r7, [r0] - mov r0, sp - strh r7, [r0] - adds r1, r6 - adds r1, 0x4 - ldr r2, =0x01000004 - bl CpuSet - adds r6, 0xC - adds r5, 0xC - subs r4, 0x1 - cmp r4, 0 - bge _0800E5C0 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E5AC - -@ file boundary? - - thumb_func_start nullsub_5 -nullsub_5: @ 800E5FC - bx lr - thumb_func_end nullsub_5 - - thumb_func_start nullsub_13 -nullsub_13: @ 800E600 - bx lr - thumb_func_end nullsub_13 - - thumb_func_start sub_800E604 -sub_800E604: @ 800E604 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - ldr r6, =gUnknown_03005000 - adds r5, r6, 0 - adds r5, 0xEE - ldrb r4, [r5] - mov r0, sp - movs r7, 0 - strh r7, [r0] - ldr r2, =0x0100067a - adds r1, r6, 0 - bl CpuSet - ldrb r0, [r5] - strb r4, [r5] - movs r0, 0xFF - strb r0, [r6, 0xC] - ldrb r0, [r5] - cmp r0, 0x4 - beq _0800E636 - ldrb r0, [r5] - strb r7, [r5] -_0800E636: - mov r7, sp - adds r7, 0x2 - add r0, sp, 0x4 - mov r8, r0 - movs r0, 0x6 - add r0, sp - mov r9, r0 - adds r5, r6, 0 - adds r5, 0x80 - movs r4, 0x4 -_0800E64A: - adds r0, r5, 0 - bl sub_800FCC4 - adds r5, 0x14 - subs r4, 0x1 - cmp r4, 0 - bge _0800E64A - movs r5, 0 - ldr r4, =gUnknown_03005000+0x6C - adds r0, r4, 0 - bl sub_800FCC4 - adds r0, r4, 0 - adds r0, 0xB8 - bl sub_800D6C8 - ldr r0, =0x0000097c - adds r4, r0 - adds r0, r4, 0 - bl sub_800D724 - strh r5, [r7] - ldr r1, =gSendCmd - ldr r2, =0x01000008 - adds r0, r7, 0 - bl CpuSet - mov r0, r8 - strh r5, [r0] - ldr r1, =gRecvCmds - ldr r2, =0x01000028 - bl CpuSet - mov r0, r9 - strh r5, [r0] - ldr r1, =gLinkPlayers - ldr r2, =0x01000046 - bl CpuSet - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E604 - thumb_func_start sub_800E6D0 sub_800E6D0: @ 800E6D0 push {r4-r6,lr} diff --git a/include/link.h b/include/link.h index b33b7a012..32fadc5ea 100644 --- a/include/link.h +++ b/include/link.h @@ -191,7 +191,7 @@ extern u16 gLinkType; extern u32 gLinkStatus; extern u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2]; extern u16 gSendCmd[CMD_LENGTH]; -extern struct LinkPlayer gLinkPlayers[]; +extern struct LinkPlayer gLinkPlayers[5]; extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; extern bool8 gWirelessCommType; diff --git a/include/link_rfu.h b/include/link_rfu.h index 1d430cb51..f43f3dd12 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -81,6 +81,17 @@ struct UnkRfuStruct_1 { /* 0x048 */ u8 filler_48[0xe78]; }; +struct UnkRfuStruct_2_Sub_6c { + /* 0x00 */ u16 unk_00; + /* 0x02 */ u16 unk_02; + /* 0x04 */ u32 unk_04; + /* 0x08 */ u32 unk_08; + /* 0x0c */ u8 filler_0c[4]; + /* 0x10 */ u8 unk_10; + /* 0x11 */ u8 unk_11; + /* 0x12 */ u8 unk_12; +}; + struct UnkRfuStruct_2_Sub_124 { /* 0x000 */ u8 unk_00[32][70]; /* 0x8c0 */ vu8 unk_8c0; @@ -113,16 +124,21 @@ struct UnkRfuStruct_Sub_Unused { }; struct UnkRfuStruct_2 { - /* 0x000 */ u8 filler_00[13]; + /* 0x000 */ u8 filler_00[12]; + /* 0x00c */ u8 unk_0c; /* 0x00d */ u8 playerCount; /* 0x00e */ u8 filler_0e[0x5e]; - /* 0x06c */ u8 filler_6c[0xb8]; + /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c; + /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5]; + /* 0x0e4 */ u8 filler_e4[10]; + /* 0x0ee */ vu8 unk_ee; + /* 0x0ef */ u8 filler_ef[0x35]; /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; /* 0xc3c */ u8 filler_c3c[3]; - /* 0xc3f */ u8 filler_c3f[0xb9]; -}; // size = 0xcf8 + /* 0xc3f */ u8 filler_c3f[0xb5]; +}; // size = 0xcf4 // Exported RAM declarations diff --git a/src/link_rfu.c b/src/link_rfu.c index a098be336..3eb74a100 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -46,6 +46,7 @@ static void sub_800D434(void); static void sub_800D610(void); void sub_800D630(void); bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); +void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); u8 sub_8011A74(void); u8 sub_8012224(void); @@ -2292,3 +2293,65 @@ void sub_800E3A8(void) free(sp14); } } + +bool32 sub_800E540(u16 id, u8 *name) +{ + int i; + + for (i = 0; i < 20; i++) + { + if (StringCompare(gSaveBlock1Ptr->unk_3B98[i].trainerName, name) == 0 && gSaveBlock1Ptr->unk_3B98[i].trainerId == id) + { + return TRUE; + } + if (!sub_800E388(gSaveBlock1Ptr->unk_3B98[i].trainerName)) + { + return FALSE; + } + } + return FALSE; +} + +void sub_800E5AC(void) +{ + int i; + + for (i = 0; i < 20; i++) + { + gSaveBlock1Ptr->unk_3B98[i].trainerId = 0; + CpuFill16(0, gSaveBlock1Ptr->unk_3B98[i].trainerName, 8); + } +} + +void nullsub_5(void *unused_0, u8 unused_1, u8 unused_2) +{ + // debug? +} + +void nullsub_13(u8 unused_0, u8 unused_1, u8 unused_2, u8 unused_3) +{ + +} + +void sub_800E604(void) +{ + int i; + u8 unk_ee_bak = gUnknown_03005000.unk_ee; + CpuFill16(0, &gUnknown_03005000, sizeof gUnknown_03005000); + gUnknown_03005000.unk_ee = unk_ee_bak; + gUnknown_03005000.unk_0c = 0xFF; + if (gUnknown_03005000.unk_ee != 4) + { + gUnknown_03005000.unk_ee = 0; + } + for (i = 0; i < 5; i++) + { + sub_800FCC4(gUnknown_03005000.unk_80 + i); + } + sub_800FCC4(&gUnknown_03005000.unk_6c); + sub_800D6C8(&gUnknown_03005000.unk_124); + sub_800D724(&gUnknown_03005000.unk_9e8); + CpuFill16(0, gSendCmd, sizeof gSendCmd); + CpuFill16(0, gRecvCmds, sizeof gRecvCmds); + CpuFill16(0, gLinkPlayers, sizeof gLinkPlayers) +} From 765ad80884338edfa752dcee450f62742b94d547 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 4 Dec 2017 20:06:03 -0500 Subject: [PATCH 091/123] through sub_800E700 --- asm/link_rfu.s | 51 ---------------------------------------------- include/librfu.h | 2 ++ include/link.h | 1 + include/link_rfu.h | 4 +++- src/link_rfu.c | 26 +++++++++++++++++++++++ 5 files changed, 32 insertions(+), 52 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 5be4b05f2..0a93e630f 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,57 +5,6 @@ .text - thumb_func_start sub_800E6D0 -sub_800E6D0: @ 800E6D0 - push {r4-r6,lr} - ldr r4, =gIntrTable - ldr r5, [r4, 0x4] - ldr r6, [r4, 0x8] - bl sub_800E700 - bl rfu_REQ_stopMode - bl rfu_waitREQComplete - ldr r1, =0x04000208 - movs r0, 0 - strh r0, [r1] - str r5, [r4, 0x4] - str r6, [r4, 0x8] - movs r0, 0x1 - strh r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E6D0 - - thumb_func_start sub_800E700 -sub_800E700: @ 800E700 - push {r4,lr} - ldr r0, =gUnknown_03004140+0x50 - ldr r1, =0x00000e64 - ldr r4, =gIntrTable + 0x4 - adds r2, r4, 0 - movs r3, 0x1 - bl rfu_initializeAPI - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - bne _0800E732 - ldr r0, =gLinkType - strh r1, [r0] - bl sub_800AAF4 - movs r0, 0 - bl sub_80111B0 - bl sub_800E604 - adds r1, r4, 0x4 - movs r0, 0x3 - bl rfu_setTimerInterrupt -_0800E732: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E700 - thumb_func_start sub_800E748 sub_800E748: @ 800E748 push {r4,r5,lr} diff --git a/include/librfu.h b/include/librfu.h index 1f22133b9..e1e6d5f80 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -211,3 +211,5 @@ bool16 rfu_UNI_PARENT_getDRAC_ACK(u8 *a0); void rfu_REQ_disconnect(u8 who); void rfu_changeSendTarget(u8 a0, u8 who, u8 a2); void rfu_NI_stopReceivingData(u8 who); +u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterruptToRam); +void rfu_setTimerInterrupt(u8 which, IntrFunc *intr); diff --git a/include/link.h b/include/link.h index 32fadc5ea..c01f24d27 100644 --- a/include/link.h +++ b/include/link.h @@ -247,6 +247,7 @@ void sub_800A418(void); void SetSuppressLinkErrorMessage(bool8 flag); void sub_800B524(struct LinkPlayer *linkPlayer); u8 GetSioMultiSI(void); +void sub_800AAF4(void); extern u16 gLinkPartnersHeldKeys[6]; extern u32 gLinkDebugSeed; diff --git a/include/link_rfu.h b/include/link_rfu.h index f43f3dd12..6a55bb536 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -78,7 +78,9 @@ struct UnkRfuStruct_1 { /* 0x03c */ struct UnkLinkRfuStruct_02022B2C *unk_3c; /* 0x040 */ void (*unk_40)(u8, u8); /* 0x044 */ void (*unk_44)(u16); - /* 0x048 */ u8 filler_48[0xe78]; + /* 0x048 */ u8 filler_48[8]; + /* 0x050 */ u32 unk_50[0x399]; + /* 0xeb4 */ u8 filler_e64[12]; }; struct UnkRfuStruct_2_Sub_6c { diff --git a/src/link_rfu.c b/src/link_rfu.c index 3eb74a100..32080bf29 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -48,6 +48,7 @@ void sub_800D630(void); bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); +void sub_80111B0(bool32 a0); u8 sub_8011A74(void); u8 sub_8012224(void); @@ -2355,3 +2356,28 @@ void sub_800E604(void) CpuFill16(0, gRecvCmds, sizeof gRecvCmds); CpuFill16(0, gLinkPlayers, sizeof gLinkPlayers) } + +void sub_800E6D0(void) +{ + IntrFunc serialIntr = gIntrTable[1]; + IntrFunc timerIntr = gIntrTable[2]; + sub_800E700(); + rfu_REQ_stopMode(); + rfu_waitREQComplete(); + REG_IME = 0; + gIntrTable[1] = serialIntr; + gIntrTable[2] = timerIntr; + REG_IME = INTR_FLAG_VBLANK; +} + +void sub_800E700(void) +{ + if (!rfu_initializeAPI(gUnknown_03004140.unk_50, sizeof gUnknown_03004140.unk_50, gIntrTable + 1, TRUE)) + { + gLinkType = 0; + sub_800AAF4(); + sub_80111B0(0); + sub_800E604(); + rfu_setTimerInterrupt(3, gIntrTable + 2); + } +} From 21619096da8532cdb16caf56f38af996bbf75540 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 4 Dec 2017 21:05:41 -0500 Subject: [PATCH 092/123] sub_800E748 --- asm/link_rfu.s | 111 --------------------------------------------- include/link_rfu.h | 12 +++-- src/link_rfu.c | 56 ++++++++++++++++++++--- 3 files changed, 59 insertions(+), 120 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 0a93e630f..6205b4204 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,117 +5,6 @@ .text - thumb_func_start sub_800E748 -sub_800E748: @ 800E748 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_8010750 - ldr r0, =gUnknown_03005000 - ldrh r0, [r0, 0x4] - cmp r0, 0x12 - bls _0800E75C - b _0800E862 -_0800E75C: - lsls r0, 2 - ldr r1, =_0800E770 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800E770: - .4byte _0800E7BC - .4byte _0800E862 - .4byte _0800E7E4 - .4byte _0800E862 - .4byte _0800E814 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E862 - .4byte _0800E828 -_0800E7BC: - ldr r0, =gUnknown_02022B2C - bl sub_800BFCC - ldr r0, =gUnknown_03005000 - movs r2, 0x1 - strh r2, [r0, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0xA] - b _0800E862 - .pool -_0800E7E4: - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - ldr r3, =gUnknown_082ED6E0 - movs r1, 0 - movs r2, 0xF0 - bl sub_800C054 - movs r0, 0x3 - strh r0, [r4, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x6 - strh r1, [r0, 0xA] - b _0800E862 - .pool -_0800E814: - movs r0, 0 - bl sub_800C27C - ldr r1, =gUnknown_03005000 - movs r0, 0x5 - strh r0, [r1, 0x4] - b _0800E862 - .pool -_0800E828: - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000cdb - adds r1, r4, r0 - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r0, =sub_800EDBC - bl sub_800D52C - bl sub_800EAB4 - bl sub_800EAFC - movs r0, 0x14 - strh r0, [r4, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - strh r1, [r0, 0xA] - ldr r0, =sub_801084C - movs r1, 0x5 - bl CreateTask - adds r0, r5, 0 - bl DestroyTask -_0800E862: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E748 - thumb_func_start sub_800E87C sub_800E87C: @ 800E87C lsls r0, 24 diff --git a/include/link_rfu.h b/include/link_rfu.h index 6a55bb536..4f8e193fc 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -67,7 +67,7 @@ struct UnkRfuStruct_1 { /* 0x01a */ u16 unk_1a; /* 0x01c */ u16 unk_1c; /* 0x01e */ u16 unk_1e; - /* 0x020 */ u16 *unk_20; + /* 0x020 */ const u16 *unk_20; /* 0x024 */ u8 unk_24; /* 0x026 */ u16 unk_26; /* 0x028 */ u16 unk_28[4]; @@ -126,7 +126,9 @@ struct UnkRfuStruct_Sub_Unused { }; struct UnkRfuStruct_2 { - /* 0x000 */ u8 filler_00[12]; + /* 0x000 */ u8 filler_00[4]; + /* 0x004 */ u16 unk_04; + /* 0x006 */ u8 filler_06[6]; /* 0x00c */ u8 unk_0c; /* 0x00d */ u8 playerCount; /* 0x00e */ u8 filler_0e[0x5e]; @@ -139,7 +141,9 @@ struct UnkRfuStruct_2 { /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; /* 0xc3c */ u8 filler_c3c[3]; - /* 0xc3f */ u8 filler_c3f[0xb5]; + /* 0xc3f */ u8 filler_c3f[0x9c]; + /* 0xcdb */ vu8 unk_cdb; + /* 0xcdc */ u8 filler_cdc[0x18]; }; // size = 0xcf4 // Exported RAM declarations @@ -174,5 +178,7 @@ bool32 sub_8010F1C(void); bool32 sub_800F0B8(void); u32 sub_80124D4(void); void RfuVSync(void); +void sub_80111B0(bool32 a0); +u8 sub_8011A74(void); #endif //GUARD_LINK_RFU_H diff --git a/src/link_rfu.c b/src/link_rfu.c index 32080bf29..14584f99f 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2,6 +2,7 @@ // Includes #include "global.h" #include "malloc.h" +#include "task.h" #include "rng.h" #include "decompress.h" #include "text.h" @@ -46,10 +47,13 @@ static void sub_800D434(void); static void sub_800D610(void); void sub_800D630(void); bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); +void sub_800EDBC(u16 a0); +void sub_800EAB4(void); +void sub_800EAFC(void); void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); -void sub_80111B0(bool32 a0); -u8 sub_8011A74(void); +void sub_8010750(void); +void sub_801084C(u8 taskId); u8 sub_8012224(void); // .rodata @@ -186,6 +190,8 @@ static const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = { SpriteCallbackDummy }; +extern const u16 gUnknown_082ED6E0[4]; + // .text u32 sub_800BEC0(void) @@ -290,10 +296,10 @@ void sub_800C048(void) gUnknown_03004140.unk_04 = 0x15; } -u8 sub_800C054(u8 r5, u16 r7, u16 r8, u16 *r6) +u8 sub_800C054(u8 r5, u16 r7, u16 r8, const u16 *r6) { u8 i; - u16 *buffer; + const u16 *buffer; if (gUnknown_03004140.unk_04 != 0 && (gUnknown_03004140.unk_04 != 0x08 || r5 != 1)) { @@ -1168,7 +1174,7 @@ static void sub_800CF34(void) u8 i; u8 r5; u8 r4; - u16 *ptr; + const u16 *ptr; if (gUnknown_03004140.unk_04 == 5 || gUnknown_03004140.unk_04 == 6 || gUnknown_03004140.unk_04 == 7 || gUnknown_03004140.unk_04 == 8) { @@ -1338,7 +1344,7 @@ static void sub_800D268(void) static u8 sub_800D294(void) { u8 i; - u16 *ptr; + const u16 *ptr; u8 flags = 0x00; for (i = 0; i < gUnknown_03007890->unk_08; i++) @@ -2381,3 +2387,41 @@ void sub_800E700(void) rfu_setTimerInterrupt(3, gIntrTable + 2); } } + +void sub_800E748(u8 taskId) +{ + sub_8010750(); + switch (gUnknown_03005000.unk_04) + { + case 0: + sub_800BFCC(&gUnknown_02022B2C); + gUnknown_03005000.unk_04 = 1; + gTasks[taskId].data[1] = 1; + break; + case 1: + break; + case 2: + sub_800C054(gUnknown_03005000.unk_0c, 0, 240, gUnknown_082ED6E0); + gUnknown_03005000.unk_04 = 3; + gTasks[taskId].data[1] = 6; + break; + case 3: + break; + case 4: + sub_800C27C(FALSE); + gUnknown_03005000.unk_04 = 5; + break; + case 5: + break; + case 18: + gUnknown_03005000.unk_cdb = 0; + sub_800D52C(sub_800EDBC); + sub_800EAB4(); + sub_800EAFC(); + gUnknown_03005000.unk_04 = 20; + gTasks[taskId].data[1] = 8; + CreateTask(sub_801084C, 5); + DestroyTask(taskId); + break; + } +} From dc0d544119e0e4ed567e8da5a25616bfcb5c6285 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 5 Dec 2017 23:54:31 -0500 Subject: [PATCH 093/123] sub_800E87C, remaining data in link_rfu --- asm/link_rfu.s | 11 ----- data/link_rfu.s | 120 --------------------------------------------- include/librfu.h | 4 +- include/link_rfu.h | 6 +-- ld_script.txt | 1 - src/link_rfu.c | 102 +++++++++++++++++++++++++++++++++++++- 6 files changed, 106 insertions(+), 138 deletions(-) delete mode 100644 data/link_rfu.s diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 6205b4204..94eb4a625 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,17 +5,6 @@ .text - thumb_func_start sub_800E87C -sub_800E87C: @ 800E87C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_082ED6A5 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800E87C - thumb_func_start sub_800E88C sub_800E88C: @ 800E88C push {r4-r7,lr} diff --git a/data/link_rfu.s b/data/link_rfu.s deleted file mode 100644 index 2f5e9ff85..000000000 --- a/data/link_rfu.s +++ /dev/null @@ -1,120 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_082ED608:: @ 82ED608 - .byte 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00 - .byte 0x14, 0x2b, 0x02, 0x02, 0x22, 0x2b, 0x02, 0x02 - .byte 0x01, 0x00, 0x58, 0x02, 0x2c, 0x01, 0x00, 0x00 - - .align 2 -gUnknown_082ED620:: @ 82ED620 - .byte 0x00, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082ED628:: @ 82ED628 - .4byte 0x00000000, 0x00000001, 0x00000003, 0x00000007 - .4byte 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f - .4byte 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff - .4byte 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff - .4byte 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff - .4byte 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff - .4byte 0x00ffffff - -gUnknown_082ED68C:: @ 82ED68C - .byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02 - .byte 0x03 - -gUnknown_082ED695:: @ 82ED695 - .byte 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03 - .byte 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04 - -gUnknown_082ED6A5:: @ 82ED6A5 - .byte 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00 - .byte 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00 - .byte 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082ED6B8:: @ 82ED6B8 - .4byte gBlockSendBuffer - .4byte 0x000000c8 - .4byte gBlockSendBuffer - .4byte 0x000000c8 - .4byte gBlockSendBuffer - .4byte 0x00000064 - .4byte gBlockSendBuffer - .4byte 0x000000dc - .4byte gBlockSendBuffer - .4byte 0x00000028 - - .align 2 -gUnknown_082ED6E0:: @ 82ED6E0 - .2byte 0x0002, 0x7f7d, 0x0000, 0xffff - - .ascii "RFU WAIT" - .space 7 - - .ascii "RFU BOOT" - .space 7 - - .ascii "RFU ERROR" - .space 6 - - .ascii "RFU RESET" - .space 6 - - .ascii "RFU CONFIG" - .space 5 - - .ascii "RFU START" - .space 6 - - .ascii "RFU SC POLL" - .space 4 - - .ascii "RFU SP POLL" - .space 4 - - .ascii "RFU START" - .space 6 - - .ascii "RFU SEND ERR" - .space 3 - - .ascii "RFU CP POLL" - .space 4 - - .ascii " " - .space 2 - - .ascii "RECOVER START " - .space 2 - - .ascii "DISSCONECT " - .space 2 - - .ascii "RECOVER SUUSES" - .space 2 - - .ascii "RECOVER FAILED" - .space 2 - - .align 2 -gUnknown_082ED7E0:: @ 82ED7E0 - .4byte sub_801084C - .4byte sub_8010AAC - .4byte sub_8010D0C - - .align 2 -gUnknown_082ED7EC:: @ 82ED7EC - .ascii "PokemonSioInfo" - - .align 2 -gUnknown_082ED7FC:: @ 82ED7FC - .ascii "LINK LOSS DISCONNECT!" - - .align 2 -gUnknown_082ED814:: @ 82ED814 - .ascii "LINK LOSS RECOVERY NOW" diff --git a/include/librfu.h b/include/librfu.h index e1e6d5f80..fa8cadd9f 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -174,6 +174,8 @@ extern struct RfuUnk1* gUnknown_03007870[4]; extern void* sub_82E53F4; extern void rfu_STC_clearAPIVariables(void); +struct UnkLinkRfuStruct_02022B14; + void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam); void rfu_REQ_stopMode(void); void rfu_waitREQComplete(void); @@ -186,7 +188,7 @@ void rfu_REQBN_watchLink(u16 a0, u8 *a1, u8 *a2, u8 *a3); bool16 rfu_syncVBlank(void); void rfu_REQ_reset(void); void rfu_REQ_configSystem(u16, u8, u8); -void rfu_REQ_configGameData(u8, u16, u32, u32); +void rfu_REQ_configGameData(u8, u16, struct UnkLinkRfuStruct_02022B14 *, u8 *); void rfu_REQ_startSearchChild(void); void rfu_REQ_pollSearchChild(void); void rfu_REQ_endSearchChild(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index 4f8e193fc..f0b8ca84c 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -32,8 +32,8 @@ struct UnkLinkRfuStruct_02022B2C u16 unk_02; u8 unk_04; u16 unk_06; - u32 unk_08; - u32 unk_0c; + struct UnkLinkRfuStruct_02022B14 *unk_08; + u8 *unk_0c; u8 unk_10; u8 unk_11; u16 unk_12; @@ -75,7 +75,7 @@ struct UnkRfuStruct_1 { // aligned /* 0x032 */ u16 unk_32; /* 0x034 */ u16 unk_34[4]; - /* 0x03c */ struct UnkLinkRfuStruct_02022B2C *unk_3c; + /* 0x03c */ const struct UnkLinkRfuStruct_02022B2C *unk_3c; /* 0x040 */ void (*unk_40)(u8, u8); /* 0x044 */ void (*unk_44)(u16); /* 0x048 */ u8 filler_48[8]; diff --git a/ld_script.txt b/ld_script.txt index 40a15e15a..6433bc8d2 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -332,7 +332,6 @@ SECTIONS { src/string_util.o(.rodata); src/link.o(.rodata); src/link_rfu.o(.rodata); - data/link_rfu.o(.rodata); data/rom_8011DC0.o(.rodata); src/rtc.o(.rodata); data/main_menu.o(.rodata); diff --git a/src/link_rfu.c b/src/link_rfu.c index 14584f99f..e21e79c41 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -54,6 +54,8 @@ void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); void sub_8010750(void); void sub_801084C(u8 taskId); +void sub_8010AAC(u8 taskId); +void sub_8010D0C(u8 taskId); u8 sub_8012224(void); // .rodata @@ -190,7 +192,98 @@ static const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = { SpriteCallbackDummy }; -extern const u16 gUnknown_082ED6E0[4]; +const struct UnkLinkRfuStruct_02022B2C gUnknown_082ED608 = { + 0x04, 0x20, 0x00, 0x00, 0x02, + &gUnknown_02022B14, + gUnknown_02022B22, + 0x01, 0x00, 0x258, 0x12c +}; +const u8 gUnknown_082ED620[] = { + 0, 3, 2, 1, 0 +}; +const u32 gUnknown_082ED628[] = { + 0x000000, + 0x000001, + 0x000003, + 0x000007, + 0x00000f, + 0x00001f, + 0x00003f, + 0x00007f, + 0x0000ff, + 0x0001ff, + 0x0003ff, + 0x0007ff, + 0x000fff, + 0x001fff, + 0x003fff, + 0x007fff, + 0x00ffff, + 0x01ffff, + 0x03ffff, + 0x07ffff, + 0x0fffff, + 0x1fffff, + 0x3fffff, + 0x7fffff, + 0xffffff +}; +const u8 gUnknown_082ED68C[] = { + 0, 0, 1, + 1, 2, 2, + 2, 2, 3 +}; +const u8 gUnknown_082ED695[] = { + 0, 1, 1, 2, + 1, 2, 2, 3, + 1, 2, 2, 3, + 2, 3, 3, 4 +}; +const u8 gUnknown_082ED6A5[] = { + 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 +}; +const struct { + u8 *buffer; + u16 size; +} gUnknown_082ED6B8[] = { + { gBlockSendBuffer, 200 }, + { gBlockSendBuffer, 200 }, + { gBlockSendBuffer, 100 }, + { gBlockSendBuffer, 220 }, + { gBlockSendBuffer, 40 } +}; +const u16 gUnknown_082ED6E0[] = { + 0x0002, 0x7f7d, 0x0000, 0xffff +}; + +const char sUnref_082ED6E8[][15] = { + "RFU WAIT", + "RFU BOOT", + "RFU ERROR", + "RFU RESET", + "RFU CONFIG", + "RFU START", + "RFU SC POLL", + "RFU SP POLL", + "RFU START", + "RFU SEND ERR", + "RFU CP POLL" +}; +const char sUnref_082ED6E9[][16] = { + " ", + "RECOVER START ", + "DISSCONECT ", + "RECOVER SUUSES", + "RECOVER FAILED" +}; +const TaskFunc gUnknown_082ED7E0[] = { + sub_801084C, + sub_8010AAC, + sub_8010D0C +}; +const char gUnknown_082ED7EC[] = "PokemonSioInfo"; +const char gUnknown_082ED7FC[] = "LINK LOSS DISCONNECT!"; +const char gUnknown_082ED814[] = "LINK LOSS RECOVERY NOW"; // .text @@ -257,7 +350,7 @@ void sub_800BFA0(void) gUnknown_03004140.unk_06 = -1; } -void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0) +void sub_800BFCC(const struct UnkLinkRfuStruct_02022B2C *unk0) { sub_800C000(); gUnknown_03004140.unk_04 = 1; @@ -2425,3 +2518,8 @@ void sub_800E748(u8 taskId) break; } } + +u8 sub_800E87C(u8 idx) +{ + return gUnknown_082ED6A5[idx]; +} From 4f342198c2e4c579d0f3b42aa85eb6699145ad5f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 6 Dec 2017 23:55:40 -0500 Subject: [PATCH 094/123] sub_800E88C --- asm/link_rfu.s | 109 --------------------------------------------- include/link_rfu.h | 4 +- src/link_rfu.c | 44 ++++++++++++++++++ 3 files changed, 47 insertions(+), 110 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 94eb4a625..17bf9231c 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,115 +5,6 @@ .text - thumb_func_start sub_800E88C -sub_800E88C: @ 800E88C - push {r4-r7,lr} - adds r2, r0, 0 - adds r5, r1, 0 - movs r4, 0x1 - adds r1, r2, 0 - movs r6, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0800E8CC - movs r3, 0 - movs r5, 0x1 - ldr r1, =gUnknown_03005000+0xCDE -_0800E8A6: - adds r0, r2, 0 - ands r0, r5 - cmp r0, 0 - beq _0800E8B8 - adds r0, r3, r1 - strb r4, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_0800E8B8: - asrs r2, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800E8A6 - b _0800E942 - .pool -_0800E8CC: - movs r3, 0 - mvns r0, r1 - mov r12, r0 - movs r7, 0x1 - ldr r4, =gUnknown_03005000+0xCDE -_0800E8D6: - adds r2, r1, 0 - ands r2, r7 - cmp r2, 0 - bne _0800E8E2 - adds r0, r3, r4 - strb r2, [r0] -_0800E8E2: - asrs r1, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800E8D6 - movs r4, 0x4 - ldr r0, =gUnknown_03005000+0xCDE - ldrb r7, [r0] -_0800E8F4: - movs r3, 0 - subs r1, r4, 0x1 - cmp r7, r4 - beq _0800E910 - ldr r2, =gUnknown_03005000+0xCDE -_0800E8FE: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bhi _0800E910 - adds r0, r3, r2 - ldrb r0, [r0] - cmp r0, r4 - bne _0800E8FE -_0800E910: - cmp r3, 0x4 - bne _0800E916 - adds r6, r4, 0 -_0800E916: - lsls r0, r1, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0800E8F4 - mov r0, r12 - ands r5, r0 - movs r3, 0 - movs r2, 0x1 - ldr r1, =gUnknown_03005000+0xCDE -_0800E928: - adds r0, r5, 0 - ands r0, r2 - cmp r0, 0 - beq _0800E936 - adds r0, r3, r1 - strb r6, [r0] - adds r6, 0x1 -_0800E936: - asrs r5, 1 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _0800E928 -_0800E942: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E88C - thumb_func_start sub_800E94C sub_800E94C: @ 800E94C push {r4-r7,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index f0b8ca84c..54d513b10 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -143,7 +143,9 @@ struct UnkRfuStruct_2 { /* 0xc3c */ u8 filler_c3c[3]; /* 0xc3f */ u8 filler_c3f[0x9c]; /* 0xcdb */ vu8 unk_cdb; - /* 0xcdc */ u8 filler_cdc[0x18]; + /* 0xcdc */ u8 filler_cdc[2]; + /* 0xcde */ u8 unk_cde[4]; + /* 0xce2 */ u8 filler_ce2[18]; }; // size = 0xcf4 // Exported RAM declarations diff --git a/src/link_rfu.c b/src/link_rfu.c index e21e79c41..46a765709 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2523,3 +2523,47 @@ u8 sub_800E87C(u8 idx) { return gUnknown_082ED6A5[idx]; } + +void sub_800E88C(int r2, int r5) +{ + u8 i; + u8 r4 = 1; + int r1 = r2; + int r6 = 0; + if (r5 == -1) + { + for (i = 0; i < 4; r2 >>= 1, i++) + { + if (r2 & 1) + { + gUnknown_03005000.unk_cde[i] = r4; + r4++; + } + } + } + else + { + for (i = 0; i < 4; r1 >>= 1, i++) + { + if (!(r1 & 1)) + { + gUnknown_03005000.unk_cde[i] = 0; + } + } + for (r4 = 4; r4 != 0; r4--) + { + for (i = 0; i < 4 && gUnknown_03005000.unk_cde[i] != r4; i++); + if (i == 4) + { + r6 = r4; + } + } + for (r5 &= ~r2, i = 0; i < 4; r5 >>= 1, i++) + { + if (r5 & 1) + { + gUnknown_03005000.unk_cde[i] = r6++; + } + } + } +} From 94da6de903cc56ae4b92e6d27c50c7f19094a653 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 7 Dec 2017 00:28:12 -0500 Subject: [PATCH 095/123] sub_800E94C --- asm/link_rfu.s | 148 --------------------------------------------- include/librfu.h | 6 +- include/link_rfu.h | 21 +++++-- src/link_rfu.c | 57 +++++++++++++++++ sym_ewram.txt | 3 - 5 files changed, 78 insertions(+), 157 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 17bf9231c..901fbb060 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,154 +5,6 @@ .text - thumb_func_start sub_800E94C -sub_800E94C: @ 800E94C - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_03005000 - ldrh r3, [r0, 0x4] - adds r7, r0, 0 - cmp r3, 0xC - bls _0800E95E - b _0800EA9A -_0800E95E: - lsls r0, r3, 2 - ldr r1, =_0800E970 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800E970: - .4byte _0800E9A4 - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800E9BC - .4byte _0800EA9A - .4byte _0800EA9A - .4byte _0800E9E4 - .4byte _0800EA9A - .4byte _0800E9F8 - .4byte _0800EA3C -_0800E9A4: - ldr r0, =gUnknown_082ED608 - bl sub_800BFCC - ldr r0, =gUnknown_03005000 - movs r2, 0x1 - strh r2, [r0, 0x4] - b _0800E9CC - .pool -_0800E9BC: - ldrb r0, [r7, 0xC] - ldr r3, =gUnknown_082ED6E0 - movs r1, 0 - movs r2, 0xF0 - bl sub_800C054 - movs r2, 0x7 - strh r2, [r7, 0x4] -_0800E9CC: - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0xA] - b _0800EA9A - .pool -_0800E9E4: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r0, 0xA - strh r0, [r1, 0xA] - b _0800EA9A - .pool -_0800E9F8: - bl sub_80107A0 - cmp r0, 0x6 - beq _0800EA1C - cmp r0, 0x6 - bgt _0800EA0A - cmp r0, 0x5 - beq _0800EA10 - b _0800EA9A -_0800EA0A: - cmp r0, 0x9 - beq _0800EA1C - b _0800EA9A -_0800EA10: - ldr r1, =gUnknown_03005000 - movs r0, 0xC - strh r0, [r1, 0x4] - b _0800EA9A - .pool -_0800EA1C: - bl sub_800D630 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000ce4 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - adds r0, r6, 0 - bl DestroyTask - b _0800EA9A - .pool -_0800EA3C: - ldr r0, =0x00000c3e - adds r4, r7, r0 - ldrb r0, [r4] - movs r5, 0x80 - lsls r5, 17 - lsls r5, r0 - lsrs r5, 24 - ldrb r1, [r4] - movs r0, 0xC - bl rfu_clearSlot - ldrb r1, [r4] - ldr r0, =0x00000c3f - adds r2, r7, r0 - movs r0, 0x10 - movs r3, 0x46 - bl rfu_setRecvBuffer - adds r1, r7, 0 - adds r1, 0x4C - adds r0, r5, 0 - movs r2, 0xE - bl rfu_UNI_setSendData - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - strh r1, [r0, 0xA] - adds r0, r6, 0 - bl DestroyTask - ldr r4, =gUnknown_02022B44 - ldrb r0, [r4, 0xF] - cmp r0, 0 - bne _0800EA92 - bl sub_801227C - ldrb r0, [r4, 0xF] - adds r0, 0x1 - strb r0, [r4, 0xF] -_0800EA92: - ldr r0, =sub_801084C - movs r1, 0x5 - bl CreateTask -_0800EA9A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800E94C - thumb_func_start sub_800EAB4 sub_800EAB4: @ 800EAB4 push {r4,r5,lr} diff --git a/include/librfu.h b/include/librfu.h index fa8cadd9f..71feb81bf 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -128,8 +128,8 @@ struct RfuUnk2 u8 fill_4f[0x12]; u8 unk_61; u8 fill_62[6]; - u32 unk_68; - u32 unk_6c; + void *unk_68; + void *unk_6c; u8 unk_70[0x70]; }; @@ -215,3 +215,5 @@ void rfu_changeSendTarget(u8 a0, u8 who, u8 a2); void rfu_NI_stopReceivingData(u8 who); u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterruptToRam); void rfu_setTimerInterrupt(u8 which, IntrFunc *intr); +void rfu_setRecvBuffer(u8 a0, u8 a1, void *a2, size_t a3); +void rfu_UNI_setSendData(u8 flag, void *ptr, u8 size); diff --git a/include/link_rfu.h b/include/link_rfu.h index 54d513b10..4a8571ce7 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -40,6 +40,13 @@ struct UnkLinkRfuStruct_02022B2C u16 unk_14; }; +struct UnkLinkRfuStruct_02022B44 +{ + u8 fill_00[15]; + u8 unk_0f; + u8 fill_10[0xcc]; +}; + struct UnkRfuStruct_1 { /* 0x000 */ u8 unk_00; /* 0x001 */ u8 unk_01; @@ -131,7 +138,9 @@ struct UnkRfuStruct_2 { /* 0x006 */ u8 filler_06[6]; /* 0x00c */ u8 unk_0c; /* 0x00d */ u8 playerCount; - /* 0x00e */ u8 filler_0e[0x5e]; + /* 0x00e */ u8 filler_0e[0x3e]; + /* 0x04c */ u8 unk_4c[14 * 2]; + /* 0x068 */ u8 filler_68[4]; /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c; /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5]; /* 0x0e4 */ u8 filler_e4[10]; @@ -140,12 +149,16 @@ struct UnkRfuStruct_2 { /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; - /* 0xc3c */ u8 filler_c3c[3]; - /* 0xc3f */ u8 filler_c3f[0x9c]; + /* 0xc3c */ u8 filler_c3c[2]; + /* 0xc3e */ vu8 unk_c3e; + /* 0xc3f */ u8 unk_c3f[70 * 2]; + /* 0xccb */ u8 filler_ccb[16]; /* 0xcdb */ vu8 unk_cdb; /* 0xcdc */ u8 filler_cdc[2]; /* 0xcde */ u8 unk_cde[4]; - /* 0xce2 */ u8 filler_ce2[18]; + /* 0xce2 */ u8 filler_ce2[2]; + /* 0xce4 */ u8 unk_ce4; + /* 0xce5 */ u8 filler_ce5[15]; }; // size = 0xcf4 // Exported RAM declarations diff --git a/src/link_rfu.c b/src/link_rfu.c index 46a765709..622dafe37 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -28,6 +28,7 @@ EWRAM_DATA u8 gWirelessStatusIndicatorSpriteId = 0; EWRAM_DATA ALIGNED(4) struct UnkLinkRfuStruct_02022B14 gUnknown_02022B14 = {}; EWRAM_DATA ALIGNED(2) u8 gUnknown_02022B22[8] = {}; EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {}; +EWRAM_DATA struct UnkLinkRfuStruct_02022B44 gUnknown_02022B44 = {}; // Static ROM declarations @@ -53,10 +54,12 @@ void sub_800EAFC(void); void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); void sub_8010750(void); +int sub_80107A0(void); void sub_801084C(u8 taskId); void sub_8010AAC(u8 taskId); void sub_8010D0C(u8 taskId); u8 sub_8012224(void); +void sub_801227C(void); // .rodata @@ -2567,3 +2570,57 @@ void sub_800E88C(int r2, int r5) } } } + +void sub_800E94C(u8 taskId) +{ + switch (gUnknown_03005000.unk_04) + { + case 0: + sub_800BFCC(&gUnknown_082ED608); + gUnknown_03005000.unk_04 = 1; + gTasks[taskId].data[1] = 1; + break; + case 1: + break; + case 6: + sub_800C054(gUnknown_03005000.unk_0c, 0, 0xf0, gUnknown_082ED6E0); + gUnknown_03005000.unk_04 = 7; + gTasks[taskId].data[1] = 7; + break; + case 7: + break; + case 9: + gTasks[taskId].data[1] = 10; + break; + case 11: + switch (sub_80107A0()) + { + case 5: + gUnknown_03005000.unk_04 = 12; + break; + case 6: + case 9: + sub_800D630(); + gUnknown_03005000.unk_ce4 = 2; + DestroyTask(taskId); + break; + } + break; + case 12: + { + u8 r5 = 1 << gUnknown_03005000.unk_c3e; + rfu_clearSlot(12, gUnknown_03005000.unk_c3e); + rfu_setRecvBuffer(16, gUnknown_03005000.unk_c3e, gUnknown_03005000.unk_c3f, 70); + rfu_UNI_setSendData(r5, gUnknown_03005000.unk_4c, 14); + gTasks[taskId].data[1] = 8; + DestroyTask(taskId); + if (gUnknown_02022B44.unk_0f == 0) + { + sub_801227C(); + gUnknown_02022B44.unk_0f++; + } + CreateTask(sub_801084C, 5); + break; + } + } +} diff --git a/sym_ewram.txt b/sym_ewram.txt index 54da10ab1..2e7949ed9 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -21,9 +21,6 @@ gStringVar4: @ 2021FC4 .include "src/link.o" .include "src/link_rfu.o" -gUnknown_02022B44: @ 2022B44 - .space 0xDC - gUnknown_02022C20: @ 2022C20 .space 0xC From 399d3731da58db91649539cd7c142982e9d6d0ea Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 7 Dec 2017 00:29:58 -0500 Subject: [PATCH 096/123] Reformat asm/librfu.s to clarify what is being accessed in pc-relative loads --- asm/librfu.s | 1224 +++++++++++++++++++++----------------------------- 1 file changed, 518 insertions(+), 706 deletions(-) diff --git a/asm/librfu.s b/asm/librfu.s index 5fc1b0d6f..82fba2202 100644 --- a/asm/librfu.s +++ b/asm/librfu.s @@ -33,35 +33,35 @@ _082E3EDC: _082E3EE0: cmp r7, 0 beq _082E3EEC - ldr r3, _082E3EE8 + ldr r3, =0x00000e64 b _082E3EEE .align 2, 0 -_082E3EE8: .4byte 0x00000e64 + .pool _082E3EEC: - ldr r3, _082E3EF8 + ldr r3, =0x00000504 _082E3EEE: cmp r2, r3 bcs _082E3EFC movs r0, 0x1 b _082E3FB8 .align 2, 0 -_082E3EF8: .4byte 0x00000504 + .pool _082E3EFC: - ldr r0, _082E3FC0 + ldr r0, =gUnknown_03007890 str r4, [r0] - ldr r1, _082E3FC4 + ldr r1, =gUnknown_03007894 adds r0, r4, 0 adds r0, 0xB4 str r0, [r1] - ldr r1, _082E3FC8 + ldr r1, =gUnknown_03007898 adds r0, 0x28 str r0, [r1] - ldr r2, _082E3FCC + ldr r2, =gUnknown_03007880 movs r1, 0xDE lsls r1, 1 adds r0, r4, r1 str r0, [r2] - ldr r1, _082E3FD0 + ldr r1, =gUnknown_03007870 movs r3, 0xDF lsls r3, 2 adds r0, r4, r3 @@ -88,10 +88,10 @@ _082E3F28: lsrs r5, r0, 16 cmp r5, 0x3 bls _082E3F28 - ldr r0, _082E3FC8 + ldr r0, =gUnknown_03007898 ldr r1, [r0] adds r1, 0xDC - ldr r4, _082E3FD0 + ldr r4, =gUnknown_03007870 ldr r0, [r4, 0xC] adds r0, 0x1C str r0, [r1] @@ -100,7 +100,7 @@ _082E3F28: bl STWI_init_all bl rfu_STC_clearAPIVariables movs r5, 0 - ldr r3, _082E3FCC + ldr r3, =gUnknown_03007880 movs r2, 0 _082E3F6C: lsls r1, r5, 2 @@ -117,16 +117,16 @@ _082E3F6C: lsrs r5, r0, 16 cmp r5, 0x3 bls _082E3F6C - ldr r4, _082E3FD4 + ldr r4, =sub_82E53F4 movs r0, 0x2 negs r0, r0 ands r4, r0 - ldr r1, _082E3FC8 + ldr r1, =gUnknown_03007898 ldr r0, [r1] adds r2, r0, 0 adds r2, 0x8 movs r3, 0x2F - ldr r5, _082E3FD8 + ldr r5, =0x0000ffff _082E3F9C: ldrh r0, [r4] strh r0, [r2] @@ -147,30 +147,24 @@ _082E3FB8: pop {r1} bx r1 .align 2, 0 -_082E3FC0: .4byte gUnknown_03007890 -_082E3FC4: .4byte gUnknown_03007894 -_082E3FC8: .4byte gUnknown_03007898 -_082E3FCC: .4byte gUnknown_03007880 -_082E3FD0: .4byte gUnknown_03007870 -_082E3FD4: .4byte sub_82E53F4 -_082E3FD8: .4byte 0x0000ffff + .pool thumb_func_end rfu_initializeAPI thumb_func_start rfu_STC_clearAPIVariables rfu_STC_clearAPIVariables: @ 82E3FDC push {r4-r7,lr} sub sp, 0x4 - ldr r1, _082E4050 + ldr r1, =0x04000208 ldrh r0, [r1] adds r7, r0, 0 movs r6, 0 strh r6, [r1] - ldr r5, _082E4054 + ldr r5, =gUnknown_03007894 ldr r1, [r5] ldrb r4, [r1] mov r0, sp strh r6, [r0] - ldr r2, _082E4058 + ldr r2, =0x01000014 bl CpuSet ldr r2, [r5] movs r0, 0x8 @@ -180,9 +174,9 @@ rfu_STC_clearAPIVariables: @ 82E3FDC mov r0, sp adds r0, 0x2 strh r1, [r0] - ldr r4, _082E405C + ldr r4, =gUnknown_03007890 ldr r1, [r4] - ldr r2, _082E4060 + ldr r2, =0x0100005a bl CpuSet ldr r1, [r4] movs r0, 0x4 @@ -208,30 +202,26 @@ _082E4030: lsrs r2, r0, 24 cmp r2, 0x3 bls _082E4030 - ldr r0, _082E4050 + ldr r0, =0x04000208 strh r7, [r0] add sp, 0x4 pop {r4-r7} pop {r0} bx r0 .align 2, 0 -_082E4050: .4byte 0x04000208 -_082E4054: .4byte gUnknown_03007894 -_082E4058: .4byte 0x01000014 -_082E405C: .4byte gUnknown_03007890 -_082E4060: .4byte 0x0100005a + .pool thumb_func_end rfu_STC_clearAPIVariables thumb_func_start rfu_REQ_PARENT_resumeRetransmitAndChange rfu_REQ_PARENT_resumeRetransmitAndChange: @ 82E4064 push {lr} - ldr r0, _082E4074 + ldr r0, =rfu_STC_REQ_callback bl STWI_set_Callback_M bl STWI_send_ResumeRetransmitAndChangeREQ pop {r0} bx r0 .align 2, 0 -_082E4074: .4byte rfu_STC_REQ_callback + .pool thumb_func_end rfu_REQ_PARENT_resumeRetransmitAndChange thumb_func_start rfu_UNI_PARENT_getDRAC_ACK @@ -240,7 +230,7 @@ rfu_UNI_PARENT_getDRAC_ACK: @ 82E4078 adds r4, r0, 0 movs r0, 0 strb r0, [r4] - ldr r5, _082E4090 + ldr r5, =gUnknown_03007890 ldr r0, [r5] ldrb r0, [r0] cmp r0, 0x1 @@ -249,7 +239,7 @@ rfu_UNI_PARENT_getDRAC_ACK: @ 82E4078 lsls r0, 2 b _082E40BA .align 2, 0 -_082E4090: .4byte gUnknown_03007890 + .pool _082E4094: bl rfu_getSTWIRecvBuffer adds r1, r0, 0 @@ -294,13 +284,13 @@ rfu_setTimerInterrupt: @ 82E40C0 thumb_func_start rfu_getSTWIRecvBuffer rfu_getSTWIRecvBuffer: @ 82E40D4 - ldr r0, _082E40E0 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] bx lr .align 2, 0 -_082E40E0: .4byte gUnknown_03007898 + .pool thumb_func_end rfu_getSTWIRecvBuffer thumb_func_start rfu_setMSCCallback @@ -315,7 +305,7 @@ rfu_setMSCCallback: @ 82E40E4 rfu_setREQCallback: @ 82E40F0 push {lr} adds r1, r0, 0 - ldr r0, _082E4108 + ldr r0, =gUnknown_03007898 ldr r0, [r0] str r1, [r0] negs r0, r1 @@ -325,7 +315,7 @@ rfu_setREQCallback: @ 82E40F0 pop {r0} bx r0 .align 2, 0 -_082E4108: .4byte gUnknown_03007898 + .pool thumb_func_end rfu_setREQCallback thumb_func_start rfu_enableREQCallback @@ -334,16 +324,16 @@ rfu_enableREQCallback: @ 82E410C lsls r0, 24 cmp r0, 0 beq _082E4124 - ldr r0, _082E4120 + ldr r0, =gUnknown_03007894 ldr r2, [r0] ldrb r1, [r2] movs r0, 0x8 orrs r0, r1 b _082E412E .align 2, 0 -_082E4120: .4byte gUnknown_03007894 + .pool _082E4124: - ldr r0, _082E4134 + ldr r0, =gUnknown_03007894 ldr r2, [r0] ldrb r1, [r2] movs r0, 0xF7 @@ -353,7 +343,7 @@ _082E412E: pop {r0} bx r0 .align 2, 0 -_082E4134: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_enableREQCallback thumb_func_start rfu_STC_REQ_callback @@ -363,9 +353,9 @@ rfu_STC_REQ_callback: @ 82E4138 lsrs r5, r0, 24 lsls r1, 16 lsrs r4, r1, 16 - ldr r0, _082E416C + ldr r0, =rfu_CB_defaultCallback bl STWI_set_Callback_M - ldr r0, _082E4170 + ldr r0, =gUnknown_03007894 ldr r0, [r0] strh r4, [r0, 0x1C] ldrb r1, [r0] @@ -373,7 +363,7 @@ rfu_STC_REQ_callback: @ 82E4138 ands r0, r1 cmp r0, 0 beq _082E4166 - ldr r0, _082E4174 + ldr r0, =gUnknown_03007898 ldr r0, [r0] ldr r2, [r0] adds r0, r5, 0 @@ -384,9 +374,7 @@ _082E4166: pop {r0} bx r0 .align 2, 0 -_082E416C: .4byte rfu_CB_defaultCallback -_082E4170: .4byte gUnknown_03007894 -_082E4174: .4byte gUnknown_03007898 + .pool thumb_func_end rfu_STC_REQ_callback thumb_func_start rfu_CB_defaultCallback @@ -398,21 +386,21 @@ rfu_CB_defaultCallback: @ 82E4178 lsrs r3, r1, 16 cmp r0, 0xFF bne _082E41D4 - ldr r0, _082E41DC + ldr r0, =gUnknown_03007894 ldr r0, [r0] ldrb r1, [r0] movs r0, 0x8 ands r0, r1 cmp r0, 0 beq _082E41A2 - ldr r0, _082E41E0 + ldr r0, =gUnknown_03007898 ldr r0, [r0] ldr r2, [r0] movs r0, 0xFF adds r1, r3, 0 bl _call_via_r2 _082E41A2: - ldr r0, _082E41E4 + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r1, [r0, 0x2] ldrb r0, [r0, 0x3] @@ -434,7 +422,7 @@ _082E41C2: lsrs r4, r0, 24 cmp r4, 0x3 bls _082E41B0 - ldr r0, _082E41E4 + ldr r0, =gUnknown_03007890 ldr r1, [r0] movs r0, 0xFF strb r0, [r1] @@ -443,41 +431,39 @@ _082E41D4: pop {r0} bx r0 .align 2, 0 -_082E41DC: .4byte gUnknown_03007894 -_082E41E0: .4byte gUnknown_03007898 -_082E41E4: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_CB_defaultCallback thumb_func_start rfu_waitREQComplete rfu_waitREQComplete: @ 82E41E8 push {lr} bl STWI_poll_CommandEnd - ldr r0, _082E41F8 + ldr r0, =gUnknown_03007894 ldr r0, [r0] ldrh r0, [r0, 0x1C] pop {r1} bx r1 .align 2, 0 -_082E41F8: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_waitREQComplete thumb_func_start rfu_REQ_RFUStatus rfu_REQ_RFUStatus: @ 82E41FC push {lr} - ldr r0, _082E420C + ldr r0, =rfu_STC_REQ_callback bl STWI_set_Callback_M bl STWI_send_SystemStatusREQ pop {r0} bx r0 .align 2, 0 -_082E420C: .4byte rfu_STC_REQ_callback + .pool thumb_func_end rfu_REQ_RFUStatus thumb_func_start rfu_getRFUStatus rfu_getRFUStatus: @ 82E4210 push {r4,r5,lr} adds r4, r0, 0 - ldr r5, _082E4228 + ldr r5, =gUnknown_03007898 ldr r0, [r5] adds r0, 0xDC ldr r0, [r0] @@ -487,7 +473,7 @@ rfu_getRFUStatus: @ 82E4210 movs r0, 0x10 b _082E4246 .align 2, 0 -_082E4228: .4byte gUnknown_03007898 + .pool _082E422C: bl STWI_poll_CommandEnd lsls r0, 16 @@ -512,12 +498,11 @@ _082E4246: thumb_func_start sub_82E424C sub_82E424C: @ 82E424C push {lr} - ldr r2, _082E4254 - ldr r3, _082E4258 + ldr r2, =gUnknown_089A324C + ldr r3, =gDma3Requests + 0xE0 b _082E4266 .align 2, 0 -_082E4254: .4byte gUnknown_089A324C -_082E4258: .4byte gDma3Requests + 0xE0 + .pool thumb_func_end sub_82E424C thumb_func_start sub_82E425C @@ -546,17 +531,17 @@ _082E4274: lsrs r1, r0, 24 cmp r1, 0x59 bls _082E4274 - ldr r0, _082E42B0 + ldr r0, =gDma3Requests + 0xEA ldrh r0, [r0] cmp r3, r0 bne _082E42BC movs r0, 0xC0 lsls r0, 18 - ldr r1, _082E42B4 + ldr r1, =gUnknown_03007890 ldr r1, [r1] movs r2, 0x5A bl CpuSet - ldr r0, _082E42B8 + ldr r0, =gUnknown_03007894 ldr r2, [r0] ldrb r1, [r2] movs r0, 0x80 @@ -565,9 +550,7 @@ _082E4274: movs r0, 0 b _082E42BE .align 2, 0 -_082E42B0: .4byte gDma3Requests + 0xEA -_082E42B4: .4byte gUnknown_03007890 -_082E42B8: .4byte gUnknown_03007894 + .pool _082E42BC: movs r0, 0x1 _082E42BE: @@ -578,35 +561,34 @@ _082E42BE: thumb_func_start rfu_REQ_stopMode rfu_REQ_stopMode: @ 82E42C4 push {lr} - ldr r0, _082E42E4 + ldr r0, =0x04000208 ldrh r0, [r0] cmp r0, 0 bne _082E42EC movs r0, 0x3D movs r1, 0x6 bl rfu_STC_REQ_callback - ldr r0, _082E42E8 + ldr r0, =gRfuState ldr r1, [r0] ldrh r0, [r1, 0x12] movs r0, 0x6 strh r0, [r1, 0x12] b _082E4362 .align 2, 0 -_082E42E4: .4byte 0x04000208 -_082E42E8: .4byte gRfuState + .pool _082E42EC: bl AgbRFU_SoftReset bl rfu_STC_clearAPIVariables movs r0, 0x8 bl sub_82E6D6C - ldr r1, _082E433C + ldr r1, =0x00008001 cmp r0, r1 bne _082E4350 - ldr r0, _082E4340 + ldr r0, =gRfuState ldr r0, [r0] ldrb r0, [r0, 0xA] lsls r0, 2 - ldr r2, _082E4344 + ldr r2, =0x04000100 adds r1, r0, r2 movs r0, 0 str r0, [r1] @@ -615,8 +597,8 @@ _082E42EC: str r0, [r1] ldr r0, [r1] lsls r0, 16 - ldr r2, _082E4348 - ldr r3, _082E434C + ldr r2, =0x0105ffff + ldr r3, =rfu_CB_stopMode cmp r0, r2 bhi _082E432A _082E4322: @@ -632,13 +614,9 @@ _082E432A: bl STWI_send_StopModeREQ b _082E4362 .align 2, 0 -_082E433C: .4byte 0x00008001 -_082E4340: .4byte gRfuState -_082E4344: .4byte 0x04000100 -_082E4348: .4byte 0x0105ffff -_082E434C: .4byte rfu_CB_stopMode + .pool _082E4350: - ldr r1, _082E4368 + ldr r1, =0x04000128 movs r2, 0x80 lsls r2, 6 adds r0, r2, 0 @@ -650,7 +628,7 @@ _082E4362: pop {r0} bx r0 .align 2, 0 -_082E4368: .4byte 0x04000128 + .pool thumb_func_end rfu_REQ_stopMode thumb_func_start rfu_CB_stopMode @@ -663,7 +641,7 @@ rfu_CB_stopMode: @ 82E436C adds r2, r1, 0 cmp r2, 0 bne _082E4386 - ldr r1, _082E4394 + ldr r1, =0x04000128 movs r4, 0x80 lsls r4, 6 adds r0, r4, 0 @@ -676,13 +654,13 @@ _082E4386: pop {r0} bx r0 .align 2, 0 -_082E4394: .4byte 0x04000128 + .pool thumb_func_end rfu_CB_stopMode thumb_func_start rfu_REQBN_softReset_and_checkID rfu_REQBN_softReset_and_checkID: @ 82E4398 push {lr} - ldr r0, _082E43A8 + ldr r0, =0x04000208 ldrh r0, [r0] cmp r0, 0 bne _082E43AC @@ -690,7 +668,7 @@ rfu_REQBN_softReset_and_checkID: @ 82E4398 negs r0, r0 b _082E43CC .align 2, 0 -_082E43A8: .4byte 0x04000208 + .pool _082E43AC: bl AgbRFU_SoftReset bl rfu_STC_clearAPIVariables @@ -699,7 +677,7 @@ _082E43AC: adds r2, r0, 0 cmp r2, 0 bne _082E43CA - ldr r1, _082E43D0 + ldr r1, =0x04000128 movs r3, 0x80 lsls r3, 6 adds r0, r3, 0 @@ -710,19 +688,19 @@ _082E43CC: pop {r1} bx r1 .align 2, 0 -_082E43D0: .4byte 0x04000128 + .pool thumb_func_end rfu_REQBN_softReset_and_checkID thumb_func_start rfu_REQ_reset rfu_REQ_reset: @ 82E43D4 push {lr} - ldr r0, _082E43E4 + ldr r0, =rfu_CB_reset bl STWI_set_Callback_M bl STWI_send_ResetREQ pop {r0} bx r0 .align 2, 0 -_082E43E4: .4byte rfu_CB_reset + .pool thumb_func_end rfu_REQ_reset thumb_func_start rfu_CB_reset @@ -756,7 +734,7 @@ rfu_REQ_configSystem: @ 82E440C lsrs r5, 24 lsls r2, 24 lsrs r6, r2, 24 - ldr r0, _082E4444 + ldr r0, =rfu_STC_REQ_callback bl STWI_set_Callback_M movs r0, 0x3 ands r4, r0 @@ -768,16 +746,15 @@ rfu_REQ_configSystem: @ 82E440C bl STWI_send_SystemConfigREQ cmp r6, 0 bne _082E444C - ldr r0, _082E4448 + ldr r0, =gUnknown_03007894 ldr r1, [r0] movs r0, 0x1 strh r0, [r1, 0x1A] b _082E4466 .align 2, 0 -_082E4444: .4byte rfu_STC_REQ_callback -_082E4448: .4byte gUnknown_03007894 + .pool _082E444C: - ldr r5, _082E446C + ldr r5, =0x04000208 ldrh r4, [r5] movs r0, 0 strh r0, [r5] @@ -785,7 +762,7 @@ _082E444C: lsls r0, 2 adds r1, r6, 0 bl Div - ldr r1, _082E4470 + ldr r1, =gUnknown_03007894 ldr r1, [r1] strh r0, [r1, 0x1A] strh r4, [r5] @@ -794,8 +771,7 @@ _082E4466: pop {r0} bx r0 .align 2, 0 -_082E446C: .4byte 0x04000208 -_082E4470: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_REQ_configSystem thumb_func_start rfu_REQ_configGameData @@ -821,7 +797,7 @@ rfu_REQ_configGameData: @ 82E4474 strb r2, [r0, 0x1] _082E449A: movs r2, 0x2 - ldr r0, _082E44FC + ldr r0, =rfu_CB_configGameData mov r12, r0 _082E44A0: mov r3, sp @@ -871,7 +847,7 @@ _082E44E6: pop {r0} bx r0 .align 2, 0 -_082E44FC: .4byte rfu_CB_configGameData + .pool thumb_func_end rfu_REQ_configGameData thumb_func_start rfu_CB_configGameData @@ -884,10 +860,10 @@ rfu_CB_configGameData: @ 82E4500 lsrs r7, r1, 16 cmp r7, 0 bne _082E458A - ldr r0, _082E4544 + ldr r0, =gRfuState ldr r0, [r0] ldr r1, [r0, 0x24] - ldr r0, _082E4548 + ldr r0, =gUnknown_03007890 ldr r6, [r0] ldrb r2, [r1, 0x4] adds r5, r6, 0 @@ -911,8 +887,7 @@ rfu_CB_configGameData: @ 82E4500 movs r0, 0x1 b _082E4552 .align 2, 0 -_082E4544: .4byte gRfuState -_082E4548: .4byte gUnknown_03007890 + .pool _082E454C: adds r1, r6, 0 adds r1, 0x97 @@ -920,7 +895,7 @@ _082E454C: _082E4552: strb r0, [r1] movs r2, 0 - ldr r3, _082E4598 + ldr r3, =gUnknown_03007890 _082E4558: ldr r0, [r3] adds r0, 0x9A @@ -935,7 +910,7 @@ _082E4558: bls _082E4558 adds r4, 0x1 movs r2, 0 - ldr r3, _082E4598 + ldr r3, =gUnknown_03007890 _082E4574: ldr r0, [r3] adds r0, 0xA9 @@ -956,15 +931,15 @@ _082E458A: pop {r0} bx r0 .align 2, 0 -_082E4598: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_CB_configGameData thumb_func_start rfu_REQ_startSearchChild rfu_REQ_startSearchChild: @ 82E459C push {r4,lr} movs r1, 0 - ldr r4, _082E45E4 - ldr r3, _082E45E8 + ldr r4, =rfu_CB_defaultCallback + ldr r3, =gUnknown_03007894 movs r2, 0 _082E45A6: ldr r0, [r3] @@ -984,7 +959,7 @@ _082E45A6: lsrs r1, r0, 16 cmp r1, 0 bne _082E45F0 - ldr r0, _082E45EC + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] @@ -995,21 +970,19 @@ _082E45A6: bl rfu_STC_clearLinkStatus b _082E45F6 .align 2, 0 -_082E45E4: .4byte rfu_CB_defaultCallback -_082E45E8: .4byte gUnknown_03007894 -_082E45EC: .4byte gUnknown_03007898 + .pool _082E45F0: movs r0, 0x19 bl rfu_STC_REQ_callback _082E45F6: - ldr r0, _082E4608 + ldr r0, =rfu_CB_startSearchChild bl STWI_set_Callback_M bl STWI_send_SC_StartREQ pop {r4} pop {r0} bx r0 .align 2, 0 -_082E4608: .4byte rfu_CB_startSearchChild + .pool thumb_func_end rfu_REQ_startSearchChild thumb_func_start rfu_CB_startSearchChild @@ -1022,7 +995,7 @@ rfu_CB_startSearchChild: @ 82E460C adds r2, r1, 0 cmp r2, 0 bne _082E4624 - ldr r0, _082E4630 + ldr r0, =gUnknown_03007894 ldr r1, [r0] movs r0, 0x1 strb r0, [r1, 0x9] @@ -1033,7 +1006,7 @@ _082E4624: pop {r0} bx r0 .align 2, 0 -_082E4630: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_CB_startSearchChild thumb_func_start rfu_STC_clearLinkStatus @@ -1049,16 +1022,16 @@ rfu_STC_clearLinkStatus: @ 82E4634 mov r0, sp movs r5, 0 strh r5, [r0] - ldr r4, _082E4690 + ldr r4, =gUnknown_03007890 ldr r1, [r4] adds r1, 0x14 - ldr r2, _082E4694 + ldr r2, =0x01000040 bl CpuSet ldr r0, [r4] strb r5, [r0, 0x8] _082E465C: movs r1, 0 - ldr r2, _082E4690 + ldr r2, =gUnknown_03007890 adds r4, r2, 0 movs r3, 0 _082E4664: @@ -1085,32 +1058,31 @@ _082E4664: pop {r0} bx r0 .align 2, 0 -_082E4690: .4byte gUnknown_03007890 -_082E4694: .4byte 0x01000040 + .pool thumb_func_end rfu_STC_clearLinkStatus thumb_func_start rfu_REQ_pollSearchChild rfu_REQ_pollSearchChild: @ 82E4698 push {lr} - ldr r0, _082E46A8 + ldr r0, =rfu_CB_pollAndEndSearchChild bl STWI_set_Callback_M bl STWI_send_SC_PollingREQ pop {r0} bx r0 .align 2, 0 -_082E46A8: .4byte rfu_CB_pollAndEndSearchChild + .pool thumb_func_end rfu_REQ_pollSearchChild thumb_func_start rfu_REQ_endSearchChild rfu_REQ_endSearchChild: @ 82E46AC push {lr} - ldr r0, _082E46BC + ldr r0, =rfu_CB_pollAndEndSearchChild bl STWI_set_Callback_M bl STWI_send_SC_EndREQ pop {r0} bx r0 .align 2, 0 -_082E46BC: .4byte rfu_CB_pollAndEndSearchChild + .pool thumb_func_end rfu_REQ_endSearchChild thumb_func_start rfu_CB_pollAndEndSearchChild @@ -1126,13 +1098,13 @@ rfu_CB_pollAndEndSearchChild: @ 82E46C0 _082E46D2: cmp r4, 0x1A bne _082E4714 - ldr r5, _082E4708 + ldr r5, =gUnknown_03007890 ldr r0, [r5] adds r0, 0x94 ldrh r0, [r0] cmp r0, 0 bne _082E4730 - ldr r0, _082E470C + ldr r0, =rfu_CB_defaultCallback bl STWI_set_Callback_M bl STWI_send_SystemStatusREQ bl STWI_poll_CommandEnd @@ -1140,7 +1112,7 @@ _082E46D2: cmp r0, 0 bne _082E4730 ldr r1, [r5] - ldr r0, _082E4710 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] @@ -1149,13 +1121,11 @@ _082E46D2: strh r0, [r1] b _082E4730 .align 2, 0 -_082E4708: .4byte gUnknown_03007890 -_082E470C: .4byte rfu_CB_defaultCallback -_082E4710: .4byte gUnknown_03007898 + .pool _082E4714: cmp r4, 0x1B bne _082E4730 - ldr r0, _082E4740 + ldr r0, =gUnknown_03007890 ldr r1, [r0] ldrb r0, [r1] cmp r0, 0xFF @@ -1164,7 +1134,7 @@ _082E4714: movs r0, 0 strh r0, [r1] _082E4728: - ldr r0, _082E4744 + ldr r0, =gUnknown_03007894 ldr r1, [r0] movs r0, 0 strb r0, [r1, 0x9] @@ -1176,8 +1146,7 @@ _082E4730: pop {r0} bx r0 .align 2, 0 -_082E4740: .4byte gUnknown_03007890 -_082E4744: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_CB_pollAndEndSearchChild thumb_func_start rfu_STC_readChildList @@ -1185,7 +1154,7 @@ rfu_STC_readChildList: @ 82E4748 push {r4-r7,lr} mov r7, r8 push {r7} - ldr r0, _082E47F8 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] @@ -1193,9 +1162,9 @@ rfu_STC_readChildList: @ 82E4748 adds r6, r0, 0x4 cmp r7, 0 beq _082E47EE - ldr r0, _082E47FC + ldr r0, =gUnknown_03007894 mov r8, r0 - ldr r1, _082E4800 + ldr r1, =gUnknown_03007890 mov r12, r1 _082E4766: ldrb r4, [r6, 0x2] @@ -1274,21 +1243,19 @@ _082E47EE: pop {r0} bx r0 .align 2, 0 -_082E47F8: .4byte gUnknown_03007898 -_082E47FC: .4byte gUnknown_03007894 -_082E4800: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_STC_readChildList thumb_func_start rfu_REQ_startSearchParent rfu_REQ_startSearchParent: @ 82E4804 push {lr} - ldr r0, _082E4814 + ldr r0, =rfu_CB_startSearchParent bl STWI_set_Callback_M bl STWI_send_SP_StartREQ pop {r0} bx r0 .align 2, 0 -_082E4814: .4byte rfu_CB_startSearchParent + .pool thumb_func_end rfu_REQ_startSearchParent thumb_func_start rfu_CB_startSearchParent @@ -1315,13 +1282,13 @@ _082E482E: thumb_func_start rfu_REQ_pollSearchParent rfu_REQ_pollSearchParent: @ 82E483C push {lr} - ldr r0, _082E484C + ldr r0, =sub_82E4850 bl STWI_set_Callback_M bl STWI_send_SP_PollingREQ pop {r0} bx r0 .align 2, 0 -_082E484C: .4byte sub_82E4850 + .pool thumb_func_end rfu_REQ_pollSearchParent thumb_func_start sub_82E4850 @@ -1347,13 +1314,13 @@ _082E4864: thumb_func_start rfu_REQ_endSearchParent rfu_REQ_endSearchParent: @ 82E4874 push {lr} - ldr r0, _082E4884 + ldr r0, =rfu_STC_REQ_callback bl STWI_set_Callback_M bl STWI_send_SP_EndREQ pop {r0} bx r0 .align 2, 0 -_082E4884: .4byte rfu_STC_REQ_callback + .pool thumb_func_end rfu_REQ_endSearchParent thumb_func_start rfu_STC_readParentCandidateList @@ -1365,12 +1332,12 @@ rfu_STC_readParentCandidateList: @ 82E4888 mov r0, sp movs r4, 0 strh r4, [r0] - ldr r5, _082E4930 + ldr r5, =gUnknown_03007890 ldr r1, [r5] adds r1, 0x14 - ldr r2, _082E4934 + ldr r2, =0x01000040 bl CpuSet - ldr r0, _082E4938 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r2, [r0] @@ -1382,7 +1349,7 @@ rfu_STC_readParentCandidateList: @ 82E4888 cmp r7, 0 beq _082E498C mov r12, r5 - ldr r0, _082E493C + ldr r0, =0x00007fff mov r8, r0 _082E48BE: subs r0, r7, 0x7 @@ -1444,10 +1411,7 @@ _082E48D8: strb r0, [r4, 0x3] b _082E4942 .align 2, 0 -_082E4930: .4byte gUnknown_03007890 -_082E4934: .4byte 0x01000040 -_082E4938: .4byte gUnknown_03007898 -_082E493C: .4byte 0x00007fff + .pool _082E4940: strb r3, [r4, 0x3] _082E4942: @@ -1507,7 +1471,7 @@ rfu_REQ_startConnectParent: @ 82E4998 lsrs r4, r0, 16 movs r3, 0 movs r2, 0 - ldr r1, _082E49E4 + ldr r1, =gUnknown_03007890 ldr r0, [r1] ldrh r0, [r0, 0x14] cmp r0, r4 @@ -1533,18 +1497,16 @@ _082E49C4: _082E49CC: cmp r3, 0 bne _082E49F0 - ldr r0, _082E49E8 + ldr r0, =gUnknown_03007894 ldr r0, [r0] strh r4, [r0, 0x1E] - ldr r0, _082E49EC + ldr r0, =rfu_STC_REQ_callback bl STWI_set_Callback_M adds r0, r4, 0 bl STWI_send_CP_StartREQ b _082E49F8 .align 2, 0 -_082E49E4: .4byte gUnknown_03007890 -_082E49E8: .4byte gUnknown_03007894 -_082E49EC: .4byte rfu_STC_REQ_callback + .pool _082E49F0: movs r0, 0x1F adds r1, r3, 0 @@ -1558,13 +1520,13 @@ _082E49F8: thumb_func_start rfu_REQ_pollConnectParent rfu_REQ_pollConnectParent: @ 82E4A00 push {lr} - ldr r0, _082E4A10 + ldr r0, =rfu_CB_pollConnectParent bl STWI_set_Callback_M bl STWI_send_CP_PollingREQ pop {r0} bx r0 .align 2, 0 -_082E4A10: .4byte rfu_CB_pollConnectParent + .pool thumb_func_end rfu_REQ_pollConnectParent thumb_func_start rfu_CB_pollConnectParent @@ -1583,7 +1545,7 @@ rfu_CB_pollConnectParent: @ 82E4A14 str r1, [sp, 0x28] cmp r1, 0 bne _082E4B16 - ldr r0, _082E4AD0 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] @@ -1597,7 +1559,7 @@ rfu_CB_pollConnectParent: @ 82E4A14 lsls r0, 17 lsls r0, r1 lsrs r2, r0, 24 - ldr r4, _082E4AD4 + ldr r4, =gUnknown_03007890 ldr r3, [r4] ldrb r1, [r3, 0x2] adds r0, r2, 0 @@ -1621,7 +1583,7 @@ rfu_CB_pollConnectParent: @ 82E4A14 strb r0, [r1, 0x1] ldr r0, [r4] strb r2, [r0] - ldr r3, _082E4AD8 + ldr r3, =gUnknown_03007894 ldr r2, [r3] ldrb r1, [r2] movs r0, 0x80 @@ -1656,17 +1618,14 @@ _082E4A92: ldr r1, [r7] adds r1, 0x14 adds r0, r6, 0 - ldr r2, _082E4ADC + ldr r2, =0x01000040 bl CpuSet ldr r0, [r7] mov r1, r8 strb r1, [r0, 0x8] b _082E4AF4 .align 2, 0 -_082E4AD0: .4byte gUnknown_03007898 -_082E4AD4: .4byte gUnknown_03007890 -_082E4AD8: .4byte gUnknown_03007894 -_082E4ADC: .4byte 0x01000040 + .pool _082E4AE0: adds r0, r4, 0 adds r0, 0x14 @@ -1682,7 +1641,7 @@ _082E4AEA: _082E4AF4: cmp r5, 0x3 bhi _082E4B16 - ldr r4, _082E4B30 + ldr r4, =gUnknown_03007890 mov r0, r10 lsls r5, r0, 5 adds r0, r5, 0 @@ -1709,7 +1668,7 @@ _082E4B16: pop {r0} bx r0 .align 2, 0 -_082E4B30: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_CB_pollConnectParent thumb_func_start rfu_getConnectParentStatus @@ -1718,7 +1677,7 @@ rfu_getConnectParentStatus: @ 82E4B34 adds r3, r0, 0 movs r0, 0xFF strb r0, [r3] - ldr r0, _082E4B54 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r2, [r0] @@ -1731,7 +1690,7 @@ rfu_getConnectParentStatus: @ 82E4B34 movs r0, 0x10 b _082E4B64 .align 2, 0 -_082E4B54: .4byte gUnknown_03007898 + .pool _082E4B58: adds r2, 0x6 ldrb r0, [r2] @@ -1747,17 +1706,17 @@ _082E4B64: thumb_func_start rfu_REQ_endConnectParent rfu_REQ_endConnectParent: @ 82E4B68 push {lr} - ldr r0, _082E4B94 + ldr r0, =rfu_CB_pollConnectParent bl STWI_set_Callback_M bl STWI_send_CP_EndREQ - ldr r0, _082E4B98 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r1, [r0] ldrb r0, [r1, 0x6] cmp r0, 0x3 bhi _082E4B90 - ldr r0, _082E4B9C + ldr r0, =gUnknown_03007894 ldr r0, [r0] adds r0, 0xA ldrb r1, [r1, 0x6] @@ -1768,21 +1727,19 @@ _082E4B90: pop {r0} bx r0 .align 2, 0 -_082E4B94: .4byte rfu_CB_pollConnectParent -_082E4B98: .4byte gUnknown_03007898 -_082E4B9C: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_REQ_endConnectParent thumb_func_start rfu_syncVBlank rfu_syncVBlank: @ 82E4BA0 push {r4,r5,lr} bl rfu_NI_checkCommFailCounter - ldr r0, _082E4BE8 + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r0, [r0] cmp r0, 0xFF beq _082E4C78 - ldr r4, _082E4BEC + ldr r4, =gUnknown_03007894 ldr r1, [r4] ldrb r0, [r1, 0x6] cmp r0, 0 @@ -1810,8 +1767,7 @@ _082E4BBE: strh r0, [r1, 0x20] b _082E4BFA .align 2, 0 -_082E4BE8: .4byte gUnknown_03007890 -_082E4BEC: .4byte gUnknown_03007894 + .pool _082E4BF0: cmp r3, 0 beq _082E4C10 @@ -1822,16 +1778,16 @@ _082E4BFA: cmp r3, 0 beq _082E4C10 _082E4BFE: - ldr r3, _082E4C0C + ldr r3, =gUnknown_03007894 ldr r2, [r3] ldrb r1, [r2] movs r0, 0xFD ands r0, r1 b _082E4C1A .align 2, 0 -_082E4C0C: .4byte gUnknown_03007894 + .pool _082E4C10: - ldr r3, _082E4C6C + ldr r3, =gUnknown_03007894 ldr r2, [r3] ldrb r1, [r2] movs r0, 0x2 @@ -1850,7 +1806,7 @@ _082E4C1A: movs r0, 0xFB ands r0, r1 strb r0, [r3] - ldr r0, _082E4C70 + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r1, [r0, 0x2] ldrb r0, [r0, 0x3] @@ -1872,15 +1828,14 @@ _082E4C54: lsrs r4, r0, 24 cmp r4, 0x3 bls _082E4C42 - ldr r0, _082E4C70 + ldr r0, =gUnknown_03007890 ldr r1, [r0] movs r0, 0xFF strb r0, [r1] movs r0, 0x1 b _082E4C7A .align 2, 0 -_082E4C6C: .4byte gUnknown_03007894 -_082E4C70: .4byte gUnknown_03007890 + .pool _082E4C74: subs r0, 0x1 strh r0, [r3, 0x20] @@ -1919,21 +1874,21 @@ rfu_REQBN_watchLink: @ 82E4C80 ldrb r0, [r2, 0xC] ldr r2, [sp, 0x4] strb r0, [r2] - ldr r5, _082E4D20 + ldr r5, =gUnknown_03007890 ldr r0, [r5] ldrb r0, [r0] cmp r0, 0xFF bne _082E4CBE b _082E504E _082E4CBE: - ldr r0, _082E4D24 + ldr r0, =gRfuState ldr r0, [r0] ldrb r0, [r0, 0x14] cmp r0, 0 bne _082E4CCA b _082E504E _082E4CCA: - ldr r3, _082E4D28 + ldr r3, =gUnknown_03007894 ldr r2, [r3] ldrb r1, [r2] movs r4, 0x4 @@ -1957,7 +1912,7 @@ _082E4CEE: lsrs r0, 24 cmp r0, 0x29 bne _082E4D30 - ldr r0, _082E4D2C + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r1, [r0] @@ -1979,16 +1934,13 @@ _082E4D18: str r2, [sp, 0x8] b _082E4D88 .align 2, 0 -_082E4D20: .4byte gUnknown_03007890 -_082E4D24: .4byte gRfuState -_082E4D28: .4byte gUnknown_03007894 -_082E4D2C: .4byte gUnknown_03007898 + .pool _082E4D30: movs r0, 0x9B lsls r0, 1 cmp r6, r0 bne _082E4D80 - ldr r0, _082E4DDC + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] @@ -2011,7 +1963,7 @@ _082E4D56: ands r0, r1 cmp r0, 0 beq _082E4D76 - ldr r0, _082E4DE0 + ldr r0, =gUnknown_03007890 ldr r0, [r0] adds r0, 0xA adds r0, r5 @@ -2031,7 +1983,7 @@ _082E4D80: bne _082E4D88 b _082E504E _082E4D88: - ldr r4, _082E4DDC + ldr r4, =gUnknown_03007898 ldr r0, [r4] adds r0, 0xDC ldr r0, [r0] @@ -2039,7 +1991,7 @@ _082E4D88: str r1, [sp, 0x10] ldr r0, [r0, 0x4] str r0, [sp, 0x14] - ldr r0, _082E4DE4 + ldr r0, =rfu_CB_defaultCallback bl STWI_set_Callback_M bl STWI_send_LinkStatusREQ bl STWI_poll_CommandEnd @@ -2053,7 +2005,7 @@ _082E4D88: ldr r0, [r0] adds r2, r0, 0x4 movs r5, 0 - ldr r3, _082E4DE0 + ldr r3, =gUnknown_03007890 _082E4DBC: ldr r0, [r3] adds r0, 0xA @@ -2071,9 +2023,7 @@ _082E4DBC: movs r5, 0 b _082E4DF4 .align 2, 0 -_082E4DDC: .4byte gUnknown_03007898 -_082E4DE0: .4byte gUnknown_03007890 -_082E4DE4: .4byte rfu_CB_defaultCallback + .pool _082E4DE8: movs r0, 0x11 ldr r1, [sp, 0xC] @@ -2081,7 +2031,7 @@ _082E4DE8: ldr r0, [sp, 0xC] b _082E5050 _082E4DF4: - ldr r1, _082E4E7C + ldr r1, =gUnknown_03007894 ldr r0, [r1] adds r0, 0xE adds r2, r0, r5 @@ -2091,7 +2041,7 @@ _082E4DF4: beq _082E4E1A subs r0, 0x4 strb r0, [r2] - ldr r0, _082E4E80 + ldr r0, =gUnknown_03007890 ldr r0, [r0] adds r0, 0xA adds r1, r0, r5 @@ -2115,7 +2065,7 @@ _082E4E2E: ldr r2, [sp, 0x8] cmp r2, 0x1 bne _082E4F10 - ldr r4, _082E4E80 + ldr r4, =gUnknown_03007890 ldr r1, [r4] ldrb r0, [r1, 0x2] ands r0, r6 @@ -2152,15 +2102,14 @@ _082E4E2E: strb r2, [r0] b _082E4F10 .align 2, 0 -_082E4E7C: .4byte gUnknown_03007894 -_082E4E80: .4byte gUnknown_03007890 + .pool _082E4E84: bl STWI_send_SystemStatusREQ bl STWI_poll_CommandEnd lsls r0, 16 cmp r0, 0 bne _082E4F10 - ldr r0, _082E4EB4 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] @@ -2177,9 +2126,9 @@ _082E4E84: ldr r0, [sp] b _082E4F0E .align 2, 0 -_082E4EB4: .4byte gUnknown_03007898 + .pool _082E4EB8: - ldr r2, _082E4F00 + ldr r2, =gUnknown_03007894 ldr r1, [r2] adds r1, 0xA adds r1, r5 @@ -2214,7 +2163,7 @@ _082E4EB8: strb r0, [r2] b _082E4F10 .align 2, 0 -_082E4F00: .4byte gUnknown_03007894 + .pool _082E4F04: ldr r0, [r3] adds r0, 0xA @@ -2224,7 +2173,7 @@ _082E4F04: _082E4F0E: strb r1, [r0] _082E4F10: - ldr r2, _082E4F70 + ldr r2, =gUnknown_03007890 mov r12, r2 ldr r1, [r2] ldrb r7, [r1] @@ -2266,15 +2215,14 @@ _082E4F10: ldrb r0, [r1, 0x1] adds r0, 0x1 strb r0, [r1, 0x1] - ldr r0, _082E4F74 + ldr r0, =gUnknown_03007894 ldr r0, [r0] adds r0, 0xA adds r0, r5 strb r3, [r0] b _082E5002 .align 2, 0 -_082E4F70: .4byte gUnknown_03007890 -_082E4F74: .4byte gUnknown_03007894 + .pool _082E4F78: movs r0, 0 strb r0, [r4] @@ -2287,7 +2235,7 @@ _082E4F7E: bne _082E5002 bl STWI_send_SlotStatusREQ bl STWI_poll_CommandEnd - ldr r0, _082E4FC8 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r2, [r0] @@ -2302,7 +2250,7 @@ _082E4F7E: ldrb r0, [r2, 0x2] cmp r0, r5 bne _082E4FD0 - ldr r0, _082E4FCC + ldr r0, =gUnknown_03007894 ldr r0, [r0] lsls r1, r5, 1 adds r0, 0x12 @@ -2316,8 +2264,7 @@ _082E4F7E: lsls r0, 24 b _082E4FFE .align 2, 0 -_082E4FC8: .4byte gUnknown_03007898 -_082E4FCC: .4byte gUnknown_03007894 + .pool _082E4FD0: adds r2, 0x4 subs r0, r3, 0x1 @@ -2329,7 +2276,7 @@ _082E4FD0: ldrb r0, [r2, 0x2] cmp r0, r5 bne _082E4FD0 - ldr r0, _082E5060 + ldr r0, =gUnknown_03007894 ldr r0, [r0] lsls r1, r5, 1 adds r0, 0x12 @@ -2346,7 +2293,7 @@ _082E4FFE: lsrs r0, 24 mov r9, r0 _082E5002: - ldr r0, _082E5064 + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r1, [r0, 0x2] mov r2, r8 @@ -2373,7 +2320,7 @@ _082E5028: bl STWI_send_DisconnectREQ bl STWI_poll_CommandEnd _082E5038: - ldr r1, _082E5068 + ldr r1, =gUnknown_03007898 ldr r0, [r1] adds r0, 0xDC ldr r0, [r0] @@ -2396,9 +2343,7 @@ _082E5050: pop {r1} bx r1 .align 2, 0 -_082E5060: .4byte gUnknown_03007894 -_082E5064: .4byte gUnknown_03007890 -_082E5068: .4byte gUnknown_03007898 + .pool thumb_func_end rfu_REQBN_watchLink thumb_func_start rfu_STC_removeLinkData @@ -2416,13 +2361,13 @@ rfu_STC_removeLinkData: @ 82E506C lsls r0, 17 lsls r0, r7 lsrs r6, r0, 24 - ldr r0, _082E511C + ldr r0, =gUnknown_03007894 ldr r0, [r0] adds r0, 0xE adds r0, r7 movs r1, 0 strb r1, [r0] - ldr r1, _082E5120 + ldr r1, =gUnknown_03007890 ldr r4, [r1] ldrb r0, [r4, 0x2] ands r0, r6 @@ -2449,7 +2394,7 @@ _082E50AA: strb r0, [r2, 0x3] ldr r3, [r3] ldr r0, [r3] - ldr r1, _082E5124 + ldr r1, =0x00ff00ff ands r0, r1 cmp r0, 0 bne _082E50D2 @@ -2468,7 +2413,7 @@ _082E50D2: mov r2, r8 ldr r1, [r2] adds r1, r0 - ldr r2, _082E5128 + ldr r2, =0x01000010 mov r0, sp bl CpuSet mov r0, r8 @@ -2494,10 +2439,7 @@ _082E5110: pop {r0} bx r0 .align 2, 0 -_082E511C: .4byte gUnknown_03007894 -_082E5120: .4byte gUnknown_03007890 -_082E5124: .4byte 0x00ff00ff -_082E5128: .4byte 0x01000010 + .pool thumb_func_end rfu_STC_removeLinkData thumb_func_start rfu_REQ_disconnect @@ -2505,7 +2447,7 @@ rfu_REQ_disconnect: @ 82E512C push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r2, _082E5170 + ldr r2, =gUnknown_03007890 ldr r1, [r2] ldrb r0, [r1, 0x2] ldrb r1, [r1, 0x3] @@ -2513,7 +2455,7 @@ rfu_REQ_disconnect: @ 82E512C ands r0, r4 cmp r0, 0 beq _082E51B0 - ldr r0, _082E5174 + ldr r0, =gUnknown_03007894 ldr r1, [r0] strb r4, [r1, 0x5] ldr r2, [r2] @@ -2536,14 +2478,13 @@ rfu_REQ_disconnect: @ 82E512C bl rfu_CB_disconnect b _082E51B0 .align 2, 0 -_082E5170: .4byte gUnknown_03007890 -_082E5174: .4byte gUnknown_03007894 + .pool _082E5178: ldr r0, [r3] ldrb r0, [r0, 0x9] cmp r0, 0 beq _082E51A4 - ldr r0, _082E51A0 + ldr r0, =rfu_CB_defaultCallback bl STWI_set_Callback_M bl STWI_send_SC_EndREQ bl STWI_poll_CommandEnd @@ -2555,9 +2496,9 @@ _082E5178: bl rfu_STC_REQ_callback b _082E51B0 .align 2, 0 -_082E51A0: .4byte rfu_CB_defaultCallback + .pool _082E51A4: - ldr r0, _082E51B8 + ldr r0, =rfu_CB_disconnect bl STWI_set_Callback_M adds r0, r4, 0 bl STWI_send_DisconnectREQ @@ -2566,7 +2507,7 @@ _082E51B0: pop {r0} bx r0 .align 2, 0 -_082E51B8: .4byte rfu_CB_disconnect + .pool thumb_func_end rfu_REQ_disconnect thumb_func_start rfu_CB_disconnect @@ -2578,19 +2519,19 @@ rfu_CB_disconnect: @ 82E51BC lsrs r5, r1, 16 cmp r5, 0x3 bne _082E51F8 - ldr r0, _082E528C + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r0, [r0] cmp r0, 0 bne _082E51F8 - ldr r0, _082E5290 + ldr r0, =rfu_CB_defaultCallback bl STWI_set_Callback_M bl STWI_send_SystemStatusREQ bl STWI_poll_CommandEnd lsls r0, 16 cmp r0, 0 bne _082E51F8 - ldr r0, _082E5294 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] @@ -2599,9 +2540,9 @@ rfu_CB_disconnect: @ 82E51BC bne _082E51F8 movs r5, 0 _082E51F8: - ldr r3, _082E5298 + ldr r3, =gUnknown_03007894 ldr r2, [r3] - ldr r0, _082E528C + ldr r0, =gUnknown_03007890 ldr r1, [r0] ldrb r0, [r1, 0x2] ldrb r1, [r1, 0x3] @@ -2609,7 +2550,7 @@ _082E51F8: ldrb r1, [r2, 0x5] ands r0, r1 strb r0, [r2, 0x5] - ldr r0, _082E5294 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r1, [r0] @@ -2624,7 +2565,7 @@ _082E5220: lsls r0, 17 lsls r0, r4 lsrs r0, 24 - ldr r1, _082E5298 + ldr r1, =gUnknown_03007894 ldr r1, [r1] ldrb r1, [r1, 0x5] ands r0, r1 @@ -2640,7 +2581,7 @@ _082E523C: cmp r4, 0x3 bls _082E5220 _082E5246: - ldr r0, _082E528C + ldr r0, =gUnknown_03007890 ldr r2, [r0] ldrb r1, [r2, 0x2] ldrb r0, [r2, 0x3] @@ -2653,12 +2594,12 @@ _082E5258: adds r0, r6, 0 adds r1, r5, 0 bl rfu_STC_REQ_callback - ldr r0, _082E5298 + ldr r0, =gUnknown_03007894 ldr r0, [r0] ldrb r0, [r0, 0x9] cmp r0, 0 beq _082E5286 - ldr r0, _082E5290 + ldr r0, =rfu_CB_defaultCallback bl STWI_set_Callback_M bl STWI_send_SC_StartREQ bl STWI_poll_CommandEnd @@ -2673,10 +2614,7 @@ _082E5286: pop {r0} bx r0 .align 2, 0 -_082E528C: .4byte gUnknown_03007890 -_082E5290: .4byte rfu_CB_defaultCallback -_082E5294: .4byte gUnknown_03007898 -_082E5298: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_CB_disconnect thumb_func_start rfu_REQ_CHILD_startConnectRecovery @@ -2684,13 +2622,13 @@ rfu_REQ_CHILD_startConnectRecovery: @ 82E529C push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r0, _082E52EC + ldr r0, =gUnknown_03007894 ldr r0, [r0] strb r5, [r0, 0x5] movs r4, 0 movs r0, 0x1 ands r0, r5 - ldr r2, _082E52F0 + ldr r2, =rfu_STC_REQ_callback cmp r0, 0 bne _082E52CA movs r1, 0x1 @@ -2708,7 +2646,7 @@ _082E52B6: _082E52CA: adds r0, r2, 0 bl STWI_set_Callback_M - ldr r0, _082E52F4 + ldr r0, =gUnknown_03007890 ldr r1, [r0] lsls r0, r4, 5 adds r0, r1, r0 @@ -2721,21 +2659,19 @@ _082E52CA: pop {r0} bx r0 .align 2, 0 -_082E52EC: .4byte gUnknown_03007894 -_082E52F0: .4byte rfu_STC_REQ_callback -_082E52F4: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_REQ_CHILD_startConnectRecovery thumb_func_start rfu_REQ_CHILD_pollConnectRecovery rfu_REQ_CHILD_pollConnectRecovery: @ 82E52F8 push {lr} - ldr r0, _082E5308 + ldr r0, =rfu_CB_CHILD_pollConnectRecovery bl STWI_set_Callback_M bl STWI_send_CPR_PollingREQ pop {r0} bx r0 .align 2, 0 -_082E5308: .4byte rfu_CB_CHILD_pollConnectRecovery + .pool thumb_func_end rfu_REQ_CHILD_pollConnectRecovery thumb_func_start rfu_CB_CHILD_pollConnectRecovery @@ -2750,20 +2686,20 @@ rfu_CB_CHILD_pollConnectRecovery: @ 82E530C lsrs r7, r1, 16 cmp r7, 0 bne _082E5390 - ldr r0, _082E53A4 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] ldrb r0, [r0, 0x4] cmp r0, 0 bne _082E5390 - ldr r0, _082E53A8 + ldr r0, =gUnknown_03007894 ldr r1, [r0] ldrb r1, [r1, 0x5] adds r6, r0, 0 cmp r1, 0 beq _082E5390 - ldr r1, _082E53AC + ldr r1, =gUnknown_03007890 ldr r0, [r1] strb r7, [r0] movs r4, 0 @@ -2818,9 +2754,7 @@ _082E5390: pop {r0} bx r0 .align 2, 0 -_082E53A4: .4byte gUnknown_03007898 -_082E53A8: .4byte gUnknown_03007894 -_082E53AC: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_CB_CHILD_pollConnectRecovery thumb_func_start rfu_CHILD_getConnectRecoveryStatus @@ -2829,7 +2763,7 @@ rfu_CHILD_getConnectRecoveryStatus: @ 82E53B0 adds r2, r0, 0 movs r0, 0xFF strb r0, [r2] - ldr r0, _082E53D0 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r1, [r0] @@ -2842,7 +2776,7 @@ rfu_CHILD_getConnectRecoveryStatus: @ 82E53B0 movs r0, 0x10 b _082E53DA .align 2, 0 -_082E53D0: .4byte gUnknown_03007898 + .pool _082E53D4: ldrb r0, [r1, 0x4] strb r0, [r2] @@ -2855,13 +2789,13 @@ _082E53DA: thumb_func_start rfu_REQ_CHILD_endConnectRecovery rfu_REQ_CHILD_endConnectRecovery: @ 82E53E0 push {lr} - ldr r0, _082E53F0 + ldr r0, =rfu_CB_CHILD_pollConnectRecovery bl STWI_set_Callback_M bl STWI_send_CPR_EndREQ pop {r0} bx r0 .align 2, 0 -_082E53F0: .4byte rfu_CB_CHILD_pollConnectRecovery + .pool thumb_func_end rfu_REQ_CHILD_endConnectRecovery thumb_func_start sub_82E53F4 @@ -2905,12 +2839,12 @@ rfu_REQ_changeMasterSlave: @ 82E5424 lsrs r0, 16 cmp r0, 0x1 bne _082E5444 - ldr r0, _082E5440 + ldr r0, =rfu_STC_REQ_callback bl STWI_set_Callback_M bl STWI_send_MS_ChangeREQ b _082E544C .align 2, 0 -_082E5440: .4byte rfu_STC_REQ_callback + .pool _082E5444: movs r0, 0x27 movs r1, 0 @@ -2929,7 +2863,7 @@ rfu_getMasterSlave: @ 82E5450 lsrs r2, r0, 24 cmp r2, 0x1 bne _082E547E - ldr r0, _082E5484 + ldr r0, =gRfuState ldr r1, [r0] adds r0, r1, 0 adds r0, 0x2C @@ -2950,7 +2884,7 @@ _082E547E: pop {r1} bx r1 .align 2, 0 -_082E5484: .4byte gRfuState + .pool thumb_func_end rfu_getMasterSlave thumb_func_start rfu_clearAllSlot @@ -2959,7 +2893,7 @@ rfu_clearAllSlot: @ 82E5488 mov r7, r8 push {r7} sub sp, 0x4 - ldr r1, _082E550C + ldr r1, =0x04000208 ldrh r0, [r1] mov r8, r0 movs r0, 0 @@ -2972,21 +2906,21 @@ rfu_clearAllSlot: @ 82E5488 _082E54A4: mov r0, sp strh r7, [r0] - ldr r0, _082E5510 + ldr r0, =gUnknown_03007880 lsls r4, r5, 2 adds r0, r4, r0 ldr r1, [r0] mov r0, sp - ldr r2, _082E5514 + ldr r2, =0x01000034 bl CpuSet strh r7, [r6] - ldr r0, _082E5518 + ldr r0, =gUnknown_03007870 adds r4, r0 ldr r1, [r4] adds r0, r6, 0 - ldr r2, _082E551C + ldr r2, =0x0100000a bl CpuSet - ldr r3, _082E5520 + ldr r3, =gUnknown_03007890 ldr r0, [r3] adds r0, 0x10 adds r0, r5 @@ -3007,10 +2941,10 @@ _082E54A4: strb r1, [r0, 0x5] ldr r0, [r3] strb r1, [r0, 0x6] - ldr r0, _082E5524 + ldr r0, =gUnknown_03007894 ldr r0, [r0] strb r1, [r0, 0x2] - ldr r0, _082E550C + ldr r0, =0x04000208 mov r1, r8 strh r1, [r0] add sp, 0x4 @@ -3020,13 +2954,7 @@ _082E54A4: pop {r0} bx r0 .align 2, 0 -_082E550C: .4byte 0x04000208 -_082E5510: .4byte gUnknown_03007880 -_082E5514: .4byte 0x01000034 -_082E5518: .4byte gUnknown_03007870 -_082E551C: .4byte 0x0100000a -_082E5520: .4byte gUnknown_03007890 -_082E5524: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_clearAllSlot thumb_func_start rfu_STC_releaseFrame @@ -3038,14 +2966,14 @@ rfu_STC_releaseFrame: @ 82E5528 adds r5, r2, 0 lsls r1, 24 lsrs r3, r1, 24 - ldr r0, _082E5560 + ldr r0, =gUnknown_03007894 ldr r0, [r0] ldrb r1, [r0] movs r0, 0x80 ands r0, r1 cmp r0, 0 bne _082E5568 - ldr r6, _082E5564 + ldr r6, =gUnknown_03007890 cmp r3, 0 bne _082E5554 ldr r1, [r6] @@ -3060,10 +2988,9 @@ _082E5554: strb r0, [r1, 0xF] b _082E5588 .align 2, 0 -_082E5560: .4byte gUnknown_03007894 -_082E5564: .4byte gUnknown_03007890 + .pool _082E5568: - ldr r6, _082E5590 + ldr r6, =gUnknown_03007890 cmp r3, 0 bne _082E557C ldr r1, [r6] @@ -3085,7 +3012,7 @@ _082E5588: pop {r0} bx r0 .align 2, 0 -_082E5590: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_STC_releaseFrame thumb_func_start rfu_clearSlot @@ -3116,7 +3043,7 @@ _082E55B4: lsls r0, 3 b _082E572C _082E55C4: - ldr r1, _082E5608 + ldr r1, =0x04000208 ldrh r0, [r1] mov r10, r0 movs r0, 0 @@ -3127,7 +3054,7 @@ _082E55C4: cmp r0, 0 beq _082E568C movs r3, 0 - ldr r1, _082E560C + ldr r1, =gUnknown_03007880 lsls r0, r7, 2 adds r0, r1 mov r9, r0 @@ -3142,7 +3069,7 @@ _082E55E2: beq _082E5634 mov r2, r9 ldr r4, [r2] - ldr r0, _082E5610 + ldr r0, =gUnknown_03007890 ldr r2, [r0] adds r0, r4, 0 adds r0, 0x2C @@ -3152,9 +3079,7 @@ _082E55E2: strb r0, [r2, 0x4] b _082E5634 .align 2, 0 -_082E5608: .4byte 0x04000208 -_082E560C: .4byte gUnknown_03007880 -_082E5610: .4byte gUnknown_03007890 + .pool _082E5614: movs r0, 0x8 mov r1, r8 @@ -3165,7 +3090,7 @@ _082E5614: ldr r0, [r2] adds r4, r0, 0 adds r4, 0x34 - ldr r0, _082E56C8 + ldr r0, =gUnknown_03007890 ldr r2, [r0] movs r1, 0x1 lsls r1, r7 @@ -3212,7 +3137,7 @@ _082E5674: strh r0, [r1] mov r0, sp adds r1, r4, 0 - ldr r2, _082E56CC + ldr r2, =0x0100001a bl CpuSet _082E5684: lsls r0, r6, 16 @@ -3225,7 +3150,7 @@ _082E568C: ands r0, r4 cmp r0, 0 beq _082E5702 - ldr r1, _082E56D0 + ldr r1, =gUnknown_03007870 lsls r0, r7, 2 adds r0, r1 ldr r3, [r0] @@ -3235,14 +3160,14 @@ _082E568C: ands r0, r1 cmp r0, 0 beq _082E56F4 - ldr r0, _082E56D4 + ldr r0, =gUnknown_03007894 ldr r0, [r0] ldrb r1, [r0] movs r0, 0x80 ands r0, r1 cmp r0, 0 bne _082E56D8 - ldr r2, _082E56C8 + ldr r2, =gUnknown_03007890 ldr r1, [r2] ldrb r0, [r1, 0xF] adds r0, 0x3 @@ -3251,12 +3176,9 @@ _082E568C: strb r0, [r1, 0xF] b _082E56EA .align 2, 0 -_082E56C8: .4byte gUnknown_03007890 -_082E56CC: .4byte 0x0100001a -_082E56D0: .4byte gUnknown_03007870 -_082E56D4: .4byte gUnknown_03007894 + .pool _082E56D8: - ldr r2, _082E573C + ldr r2, =gUnknown_03007890 ldr r1, [r2] adds r1, 0x10 adds r1, r7 @@ -3275,7 +3197,7 @@ _082E56F4: mov r0, sp movs r1, 0 strh r1, [r0] - ldr r2, _082E5740 + ldr r2, =0x01000006 adds r1, r3, 0 bl CpuSet _082E5702: @@ -3287,16 +3209,16 @@ _082E5702: mov r1, sp movs r0, 0 strh r0, [r1] - ldr r1, _082E5744 + ldr r1, =gUnknown_03007870 lsls r0, r7, 2 adds r0, r1 ldr r1, [r0] adds r1, 0xC - ldr r2, _082E5748 + ldr r2, =0x01000004 mov r0, sp bl CpuSet _082E5724: - ldr r0, _082E574C + ldr r0, =0x04000208 mov r2, r10 strh r2, [r0] movs r0, 0 @@ -3310,11 +3232,7 @@ _082E572C: pop {r1} bx r1 .align 2, 0 -_082E573C: .4byte gUnknown_03007890 -_082E5740: .4byte 0x01000006 -_082E5744: .4byte gUnknown_03007870 -_082E5748: .4byte 0x01000004 -_082E574C: .4byte 0x04000208 + .pool thumb_func_end rfu_clearSlot thumb_func_start rfu_setRecvBuffer @@ -3338,7 +3256,7 @@ _082E576C: ands r0, r3 cmp r0, 0 beq _082E5788 - ldr r0, _082E5784 + ldr r0, =gUnknown_03007880 lsls r1, 2 adds r1, r0 ldr r0, [r1] @@ -3346,7 +3264,7 @@ _082E576C: str r6, [r0, 0x6C] b _082E57A2 .align 2, 0 -_082E5784: .4byte gUnknown_03007880 + .pool _082E5788: movs r0, 0x10 ands r2, r0 @@ -3356,7 +3274,7 @@ _082E5788: lsls r0, 3 b _082E57A4 _082E5796: - ldr r0, _082E57AC + ldr r0, =gUnknown_03007870 lsls r1, r4, 2 adds r1, r0 ldr r0, [r1] @@ -3369,7 +3287,7 @@ _082E57A4: pop {r1} bx r1 .align 2, 0 -_082E57AC: .4byte gUnknown_03007870 + .pool thumb_func_end rfu_setRecvBuffer thumb_func_start rfu_NI_setSendData @@ -3406,7 +3324,7 @@ rfu_UNI_setSendData: @ 82E57DC lsrs r1, r0, 24 lsls r2, 24 lsrs r2, 24 - ldr r0, _082E57F8 + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r0, [r0] cmp r0, 0x1 @@ -3414,7 +3332,7 @@ rfu_UNI_setSendData: @ 82E57DC adds r0, r2, 0x3 b _082E57FE .align 2, 0 -_082E57F8: .4byte gUnknown_03007890 + .pool _082E57FC: adds r0, r2, 0x2 _082E57FE: @@ -3444,7 +3362,7 @@ rfu_NI_CHILD_setSendGameName: @ 82E5818 lsls r1, 17 lsls r1, r0 lsrs r1, 24 - ldr r0, _082E5848 + ldr r0, =gUnknown_03007890 ldr r3, [r0] adds r3, 0x98 movs r0, 0x1A @@ -3457,7 +3375,7 @@ rfu_NI_CHILD_setSendGameName: @ 82E5818 pop {r1} bx r1 .align 2, 0 -_082E5848: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_NI_CHILD_setSendGameName thumb_func_start rfu_STC_setSendData_org @@ -3476,17 +3394,16 @@ rfu_STC_setSendData_org: @ 82E584C lsls r2, 24 lsrs r2, 24 mov r8, r2 - ldr r0, _082E5878 + ldr r0, =gUnknown_03007890 ldr r2, [r0] ldrb r1, [r2] mov r10, r0 cmp r1, 0xFF bne _082E5880 - ldr r0, _082E587C + ldr r0, =0x00000301 b _082E5A36 .align 2, 0 -_082E5878: .4byte gUnknown_03007890 -_082E587C: .4byte 0x00000301 + .pool _082E5880: movs r0, 0xF ands r0, r3 @@ -3502,10 +3419,10 @@ _082E588E: ands r0, r3 cmp r0, r3 beq _082E58A4 - ldr r0, _082E58A0 + ldr r0, =0x00000401 b _082E5A36 .align 2, 0 -_082E58A0: .4byte 0x00000401 + .pool _082E58A4: movs r0, 0x10 ands r0, r6 @@ -3519,15 +3436,15 @@ _082E58B2: ands r0, r3 cmp r0, 0 beq _082E58C0 - ldr r0, _082E58BC + ldr r0, =0x00000402 b _082E5A36 .align 2, 0 -_082E58BC: .4byte 0x00000402 + .pool _082E58C0: movs r2, 0 movs r0, 0x1 ands r0, r3 - ldr r4, _082E58F0 + ldr r4, =gUnknown_089A3220 cmp r0, 0 bne _082E58E2 movs r1, 0x1 @@ -3551,7 +3468,7 @@ _082E58E2: adds r1, 0xF b _082E58FE .align 2, 0 -_082E58F0: .4byte gUnknown_089A3220 + .pool _082E58F4: cmp r0, 0 bne _082E5900 @@ -3578,7 +3495,7 @@ _082E5918: lsls r0, 3 b _082E5A36 _082E591E: - ldr r1, _082E596C + ldr r1, =0x04000208 ldrh r0, [r1] str r0, [sp, 0x4] movs r7, 0 @@ -3592,7 +3509,7 @@ _082E591E: cmp r6, 0x40 bne _082E59F4 _082E5938: - ldr r1, _082E5970 + ldr r1, =gUnknown_03007880 lsls r0, r2, 2 adds r0, r1 ldr r0, [r0] @@ -3618,8 +3535,7 @@ _082E5938: strb r7, [r1] b _082E5978 .align 2, 0 -_082E596C: .4byte 0x04000208 -_082E5970: .4byte gUnknown_03007880 + .pool _082E5974: movs r0, 0x1 strb r0, [r1] @@ -3652,7 +3568,7 @@ _082E5998: bls _082E5998 movs r2, 0 movs r5, 0x1 - ldr r4, _082E59EC + ldr r4, =gUnknown_03007880 movs r1, 0 _082E59B2: adds r0, r3, 0 @@ -3681,19 +3597,18 @@ _082E59C4: mov r1, r8 subs r0, r1 strb r0, [r2] - ldr r0, _082E59F0 + ldr r0, =0x00008021 mov r2, r12 strh r0, [r2] b _082E5A2C .align 2, 0 -_082E59EC: .4byte gUnknown_03007880 -_082E59F0: .4byte 0x00008021 + .pool _082E59F4: movs r0, 0x10 ands r0, r6 cmp r0, 0 beq _082E5A2C - ldr r1, _082E5A48 + ldr r1, =gUnknown_03007870 lsls r0, r2, 2 adds r0, r1 ldr r1, [r0] @@ -3709,7 +3624,7 @@ _082E59F4: subs r0, r2 mov r2, r9 strb r0, [r2] - ldr r0, _082E5A4C + ldr r0, =0x00008024 strh r0, [r1] mov r0, r10 ldr r2, [r0] @@ -3718,7 +3633,7 @@ _082E59F4: orrs r0, r1 strb r0, [r2, 0x6] _082E5A2C: - ldr r0, _082E5A50 + ldr r0, =0x04000208 mov r1, sp ldrh r1, [r1, 0x4] strh r1, [r0] @@ -3733,9 +3648,7 @@ _082E5A36: pop {r1} bx r1 .align 2, 0 -_082E5A48: .4byte gUnknown_03007870 -_082E5A4C: .4byte 0x00008024 -_082E5A50: .4byte 0x04000208 + .pool thumb_func_end rfu_STC_setSendData_org thumb_func_start rfu_changeSendTarget @@ -3761,13 +3674,13 @@ rfu_changeSendTarget: @ 82E5A54 _082E5A78: cmp r0, 0x20 bne _082E5B18 - ldr r0, _082E5B08 + ldr r0, =gUnknown_03007880 mov r12, r0 lsls r0, r7, 2 add r0, r12 ldr r5, [r0] ldrh r2, [r5] - ldr r1, _082E5B0C + ldr r1, =0x00008020 adds r0, r1, 0 ands r0, r2 cmp r0, r1 @@ -3783,7 +3696,7 @@ _082E5A78: bne _082E5AA6 b _082E5BAA _082E5AA6: - ldr r1, _082E5B10 + ldr r1, =0x04000208 ldrh r0, [r1] mov r8, r0 strh r2, [r1] @@ -3812,7 +3725,7 @@ _082E5AD2: lsrs r2, r0, 24 cmp r2, 0x3 bls _082E5ABE - ldr r0, _082E5B14 + ldr r0, =gUnknown_03007890 ldr r1, [r0] ldrb r0, [r1, 0x4] ldr r2, [sp] @@ -3829,34 +3742,29 @@ _082E5AD2: movs r0, 0x27 strh r0, [r5] _082E5AFE: - ldr r0, _082E5B10 + ldr r0, =0x04000208 mov r1, r8 strh r1, [r0] b _082E5BAA .align 2, 0 -_082E5B08: .4byte gUnknown_03007880 -_082E5B0C: .4byte 0x00008020 -_082E5B10: .4byte 0x04000208 -_082E5B14: .4byte gUnknown_03007890 + .pool _082E5B18: cmp r3, 0x10 bne _082E5BA4 - ldr r3, _082E5B34 + ldr r3, =gUnknown_03007870 lsls r1, r7, 2 adds r0, r1, r3 ldr r0, [r0] ldrh r2, [r0] - ldr r0, _082E5B38 + ldr r0, =0x00008024 adds r5, r3, 0 cmp r2, r0 beq _082E5B40 _082E5B2E: - ldr r0, _082E5B3C + ldr r0, =0x00000403 b _082E5BAC .align 2, 0 -_082E5B34: .4byte gUnknown_03007870 -_082E5B38: .4byte 0x00008024 -_082E5B3C: .4byte 0x00000403 + .pool _082E5B40: movs r3, 0 movs r2, 0 @@ -3880,16 +3788,16 @@ _082E5B54: cmp r2, 0 beq _082E5B70 _082E5B66: - ldr r0, _082E5B6C + ldr r0, =0x00000404 b _082E5BAC .align 2, 0 -_082E5B6C: .4byte 0x00000404 + .pool _082E5B70: - ldr r3, _082E5B9C + ldr r3, =0x04000208 ldrh r0, [r3] mov r8, r0 strh r2, [r3] - ldr r4, _082E5BA0 + ldr r4, =gUnknown_03007890 ldr r2, [r4] adds r5, r1, r5 ldr r0, [r5] @@ -3908,8 +3816,7 @@ _082E5B70: strh r2, [r3] b _082E5BAA .align 2, 0 -_082E5B9C: .4byte 0x04000208 -_082E5BA0: .4byte gUnknown_03007890 + .pool _082E5BA4: movs r0, 0xC0 lsls r0, 3 @@ -3938,13 +3845,13 @@ rfu_NI_stopReceivingData: @ 82E5BBC lsls r0, 3 b _082E5C26 _082E5BCC: - ldr r1, _082E5BF8 + ldr r1, =gUnknown_03007880 lsls r0, r3, 2 adds r0, r1 ldr r2, [r0] adds r5, r2, 0 adds r5, 0x34 - ldr r1, _082E5BFC + ldr r1, =0x04000208 ldrh r0, [r1] adds r4, r0, 0 movs r0, 0 @@ -3955,20 +3862,18 @@ _082E5BCC: ands r0, r1 cmp r0, 0 beq _082E5C20 - ldr r0, _082E5C00 + ldr r0, =0x00008043 cmp r1, r0 bne _082E5C04 movs r0, 0x48 b _082E5C06 .align 2, 0 -_082E5BF8: .4byte gUnknown_03007880 -_082E5BFC: .4byte 0x04000208 -_082E5C00: .4byte 0x00008043 + .pool _082E5C04: movs r0, 0x47 _082E5C06: strh r0, [r2, 0x34] - ldr r0, _082E5C2C + ldr r0, =gUnknown_03007890 ldr r2, [r0] movs r1, 0x1 lsls r1, r3 @@ -3980,7 +3885,7 @@ _082E5C06: adds r2, r5, 0 bl rfu_STC_releaseFrame _082E5C20: - ldr r0, _082E5C30 + ldr r0, =0x04000208 strh r4, [r0] movs r0, 0 _082E5C26: @@ -3988,8 +3893,7 @@ _082E5C26: pop {r1} bx r1 .align 2, 0 -_082E5C2C: .4byte gUnknown_03007890 -_082E5C30: .4byte 0x04000208 + .pool thumb_func_end rfu_NI_stopReceivingData thumb_func_start rfu_UNI_changeAndReadySendData @@ -4007,22 +3911,20 @@ rfu_UNI_changeAndReadySendData: @ 82E5C34 lsls r0, 3 b _082E5CC0 _082E5C4C: - ldr r1, _082E5C60 + ldr r1, =gUnknown_03007870 lsls r0, 2 adds r0, r1 ldr r4, [r0] ldrh r1, [r4] - ldr r0, _082E5C64 + ldr r0, =0x00008024 cmp r1, r0 beq _082E5C6C - ldr r0, _082E5C68 + ldr r0, =0x00000403 b _082E5CC0 .align 2, 0 -_082E5C60: .4byte gUnknown_03007870 -_082E5C64: .4byte 0x00008024 -_082E5C68: .4byte 0x00000403 + .pool _082E5C6C: - ldr r0, _082E5C80 + ldr r0, =gUnknown_03007890 ldr r1, [r0] ldrb r0, [r1] cmp r0, 0x1 @@ -4033,7 +3935,7 @@ _082E5C6C: ldrb r1, [r1, 0xF] b _082E5C92 .align 2, 0 -_082E5C80: .4byte gUnknown_03007890 + .pool _082E5C84: adds r0, r3, 0 adds r0, 0x10 @@ -4048,7 +3950,7 @@ _082E5C92: lsrs r3, r0, 24 cmp r3, r5 bcc _082E5CBC - ldr r2, _082E5CB8 + ldr r2, =0x04000208 ldrh r1, [r2] movs r0, 0 strh r0, [r2] @@ -4062,7 +3964,7 @@ _082E5C92: movs r0, 0 b _082E5CC0 .align 2, 0 -_082E5CB8: .4byte 0x04000208 + .pool _082E5CBC: movs r0, 0xA0 lsls r0, 3 @@ -4079,12 +3981,12 @@ rfu_UNI_readySendData: @ 82E5CC8 lsrs r0, 24 cmp r0, 0x3 bhi _082E5CE6 - ldr r1, _082E5CEC + ldr r1, =gUnknown_03007870 lsls r0, 2 adds r0, r1 ldr r2, [r0] ldrh r1, [r2] - ldr r0, _082E5CF0 + ldr r0, =0x00008024 cmp r1, r0 bne _082E5CE6 movs r0, 0x1 @@ -4093,8 +3995,7 @@ _082E5CE6: pop {r0} bx r0 .align 2, 0 -_082E5CEC: .4byte gUnknown_03007870 -_082E5CF0: .4byte 0x00008024 + .pool thumb_func_end rfu_UNI_readySendData thumb_func_start rfu_UNI_clearRecvNewDataFlag @@ -4104,7 +4005,7 @@ rfu_UNI_clearRecvNewDataFlag: @ 82E5CF4 lsrs r0, 24 cmp r0, 0x3 bhi _082E5D0A - ldr r1, _082E5D10 + ldr r1, =gUnknown_03007870 lsls r0, 2 adds r0, r1 ldr r1, [r0] @@ -4114,7 +4015,7 @@ _082E5D0A: pop {r0} bx r0 .align 2, 0 -_082E5D10: .4byte gUnknown_03007870 + .pool thumb_func_end rfu_UNI_clearRecvNewDataFlag thumb_func_start rfu_REQ_sendData @@ -4122,7 +4023,7 @@ rfu_REQ_sendData: @ 82E5D14 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r0, _082E5D60 + ldr r0, =gUnknown_03007890 ldr r2, [r0] ldrb r1, [r2] adds r4, r0, 0 @@ -4140,7 +4041,7 @@ _082E5D28: orrs r3, r0 cmp r3, 0 bne _082E5DB8 - ldr r0, _082E5D64 + ldr r0, =gUnknown_03007894 ldr r2, [r0] ldrb r1, [r2, 0x3] adds r4, r0, 0 @@ -4159,8 +4060,7 @@ _082E5D50: strb r0, [r1, 0x8] b _082E5D6E .align 2, 0 -_082E5D60: .4byte gUnknown_03007890 -_082E5D64: .4byte gUnknown_03007894 + .pool _082E5D68: ldrb r0, [r1, 0x7] adds r0, 0x1 @@ -4176,13 +4076,13 @@ _082E5D6E: cmp r0, 0 bne _082E5E12 _082E5D80: - ldr r4, _082E5DA4 + ldr r4, =gUnknown_03007898 ldr r1, [r4] movs r0, 0x1 str r0, [r1, 0x68] movs r0, 0xFF str r0, [r1, 0x78] - ldr r0, _082E5DA8 + ldr r0, =sub_82E5F00 bl STWI_set_Callback_M cmp r5, 0 bne _082E5DAC @@ -4192,8 +4092,7 @@ _082E5D80: bl STWI_send_DataTxREQ b _082E5E4E .align 2, 0 -_082E5DA4: .4byte gUnknown_03007898 -_082E5DA8: .4byte sub_82E5F00 + .pool _082E5DAC: ldr r0, [r4] adds r0, 0x68 @@ -4211,14 +4110,14 @@ _082E5DC4: ldrb r0, [r0, 0xE] cmp r0, 0 beq _082E5E12 - ldr r0, _082E5DF0 + ldr r0, =rfu_CB_sendData bl STWI_set_Callback_M cmp r5, 0 beq _082E5DFC - ldr r0, _082E5DF4 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0x68 - ldr r1, _082E5DF8 + ldr r1, =gUnknown_03007894 ldr r1, [r1] ldr r1, [r1, 0x24] adds r1, 0x4 @@ -4227,14 +4126,12 @@ _082E5DC4: bl STWI_send_DataTxAndChangeREQ b _082E5E4E .align 2, 0 -_082E5DF0: .4byte rfu_CB_sendData -_082E5DF4: .4byte gUnknown_03007898 -_082E5DF8: .4byte gUnknown_03007894 + .pool _082E5DFC: - ldr r0, _082E5E34 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0x68 - ldr r1, _082E5E38 + ldr r1, =gUnknown_03007894 ldr r1, [r1] ldr r1, [r1, 0x24] adds r1, 0x4 @@ -4244,12 +4141,12 @@ _082E5DFC: _082E5E12: cmp r5, 0 beq _082E5E4E - ldr r0, _082E5E3C + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r0, [r0] cmp r0, 0x1 bne _082E5E44 - ldr r0, _082E5E40 + ldr r0, =gRfuState ldr r0, [r0] ldr r1, [r0, 0x1C] cmp r1, 0 @@ -4258,12 +4155,9 @@ _082E5E12: bl _call_via_r1 b _082E5E4E .align 2, 0 -_082E5E34: .4byte gUnknown_03007898 -_082E5E38: .4byte gUnknown_03007894 -_082E5E3C: .4byte gUnknown_03007890 -_082E5E40: .4byte gRfuState + .pool _082E5E44: - ldr r0, _082E5E54 + ldr r0, =rfu_CB_sendData2 bl STWI_set_Callback_M bl STWI_send_MS_ChangeREQ _082E5E4E: @@ -4271,7 +4165,7 @@ _082E5E4E: pop {r0} bx r0 .align 2, 0 -_082E5E54: .4byte rfu_CB_sendData2 + .pool thumb_func_end rfu_REQ_sendData thumb_func_start rfu_CB_sendData @@ -4284,10 +4178,10 @@ rfu_CB_sendData: @ 82E5E58 cmp r7, 0 bne _082E5EC2 movs r6, 0 - ldr r0, _082E5EE0 + ldr r0, =0x00008020 mov r8, r0 _082E5E6C: - ldr r0, _082E5EE4 + ldr r0, =gUnknown_03007870 lsls r2, r6, 2 adds r0, r2, r0 ldr r1, [r0] @@ -4297,7 +4191,7 @@ _082E5E6C: movs r0, 0 strb r0, [r1, 0x2] _082E5E7E: - ldr r0, _082E5EE8 + ldr r0, =gUnknown_03007880 adds r0, r2, r0 ldr r4, [r0] ldrh r0, [r4] @@ -4307,7 +4201,7 @@ _082E5E7E: movs r1, 0 adds r2, r4, 0 bl rfu_STC_releaseFrame - ldr r5, _082E5EEC + ldr r5, =gUnknown_03007890 ldr r2, [r5] ldrb r1, [r4, 0x1A] ldrb r0, [r2, 0x4] @@ -4333,7 +4227,7 @@ _082E5EB8: cmp r6, 0x3 bls _082E5E6C _082E5EC2: - ldr r0, _082E5EEC + ldr r0, =gUnknown_03007890 ldr r1, [r0] ldrb r0, [r1, 0xE] movs r0, 0 @@ -4347,10 +4241,7 @@ _082E5EC2: pop {r0} bx r0 .align 2, 0 -_082E5EE0: .4byte 0x00008020 -_082E5EE4: .4byte gUnknown_03007870 -_082E5EE8: .4byte gUnknown_03007880 -_082E5EEC: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_CB_sendData thumb_func_start rfu_CB_sendData2 @@ -4395,7 +4286,7 @@ rfu_constructSendLLFrame: @ 82E5F28 mov r5, r8 push {r5-r7} sub sp, 0x4 - ldr r0, _082E5FD4 + ldr r0, =gUnknown_03007890 ldr r2, [r0] ldrb r0, [r2] cmp r0, 0xFF @@ -4413,7 +4304,7 @@ _082E5F40: movs r0, 0 strb r0, [r2, 0xE] mov r8, r0 - ldr r0, _082E5FD8 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0x6C str r0, [sp] @@ -4421,11 +4312,11 @@ _082E5F40: movs r0, 0x80 lsls r0, 8 mov r9, r0 - ldr r1, _082E5FDC + ldr r1, =0x00008024 mov r10, r1 _082E5F6A: movs r5, 0 - ldr r0, _082E5FE0 + ldr r0, =gUnknown_03007880 lsls r7, r6, 2 adds r4, r7, r0 ldr r2, [r4] @@ -4454,7 +4345,7 @@ _082E5F8A: lsrs r0, 16 adds r5, r0 _082E5FA6: - ldr r0, _082E5FE4 + ldr r0, =gUnknown_03007870 adds r0, r7, r0 ldr r0, [r0] ldrh r0, [r0] @@ -4469,7 +4360,7 @@ _082E5FA6: _082E5FC0: cmp r5, 0 beq _082E5FF4 - ldr r0, _082E5FD4 + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r0, [r0] cmp r0, 0x1 @@ -4477,11 +4368,7 @@ _082E5FC0: add r8, r5 b _082E5FF4 .align 2, 0 -_082E5FD4: .4byte gUnknown_03007890 -_082E5FD8: .4byte gUnknown_03007898 -_082E5FDC: .4byte 0x00008024 -_082E5FE0: .4byte gUnknown_03007880 -_082E5FE4: .4byte gUnknown_03007870 + .pool _082E5FE8: adds r0, r7, r6 adds r0, 0x8 @@ -4495,15 +4382,15 @@ _082E5FF4: lsrs r6, r0, 24 cmp r6, 0x3 bls _082E5F6A - ldr r6, _082E6054 + ldr r6, =gUnknown_03007894 mov r0, r8 cmp r0, 0 beq _082E603E ldr r2, [sp] movs r0, 0x3 ands r0, r2 - ldr r5, _082E6058 - ldr r1, _082E605C + ldr r5, =gUnknown_03007890 + ldr r1, =gUnknown_03007898 cmp r0, 0 beq _082E6026 movs r4, 0 @@ -4543,9 +4430,7 @@ _082E6044: pop {r0} bx r0 .align 2, 0 -_082E6054: .4byte gUnknown_03007894 -_082E6058: .4byte gUnknown_03007890 -_082E605C: .4byte gUnknown_03007898 + .pool thumb_func_end rfu_constructSendLLFrame thumb_func_start rfu_STC_NI_constructLLSF @@ -4561,15 +4446,15 @@ rfu_STC_NI_constructLLSF: @ 82E6060 lsls r0, 24 lsrs r0, 24 mov r10, r0 - ldr r2, _082E60DC + ldr r2, =gUnknown_03007890 ldr r0, [r2] ldrb r0, [r0] lsls r0, 4 - ldr r1, _082E60E0 + ldr r1, =gUnknown_089A3220 adds r0, r1 mov r8, r0 ldrh r1, [r4] - ldr r0, _082E60E4 + ldr r0, =0x00008022 cmp r1, r0 bne _082E60CA adds r3, r4, 0 @@ -4615,11 +4500,9 @@ _082E60CA: movs r5, 0 b _082E612C .align 2, 0 -_082E60DC: .4byte gUnknown_03007890 -_082E60E0: .4byte gUnknown_089A3220 -_082E60E4: .4byte 0x00008022 + .pool _082E60E8: - ldr r0, _082E6114 + ldr r0, =0x00008022 cmp r9, r0 bne _082E611C adds r3, r4, 0 @@ -4642,7 +4525,7 @@ _082E60E8: lsrs r5, r0, 16 b _082E6130 .align 2, 0 -_082E6114: .4byte 0x00008022 + .pool _082E6118: adds r5, r7, 0 b _082E6130 @@ -4687,7 +4570,7 @@ _082E6130: orrs r3, r0 orrs r3, r5 str r3, [sp] - ldr r2, _082E61EC + ldr r2, =gUnknown_03007890 ldr r0, [r2] ldrb r0, [r0] cmp r0, 0x1 @@ -4728,7 +4611,7 @@ _082E61A2: adds r0, r1 ldr r0, [r0] str r0, [sp, 0x4] - ldr r0, _082E61F0 + ldr r0, =gUnknown_03007898 ldr r1, [r0] add r0, sp, 0x4 ldr r3, [r1, 0x4] @@ -4737,7 +4620,7 @@ _082E61A2: bl _call_via_r3 _082E61C2: ldrh r1, [r4] - ldr r0, _082E61F4 + ldr r0, =0x00008022 cmp r1, r0 bne _082E61DC ldrb r0, [r6] @@ -4750,7 +4633,7 @@ _082E61C2: movs r0, 0 strb r0, [r6] _082E61DC: - ldr r0, _082E61EC + ldr r0, =gUnknown_03007890 ldr r2, [r0] ldrb r1, [r2] cmp r1, 0x1 @@ -4759,9 +4642,7 @@ _082E61DC: strb r1, [r2, 0xE] b _082E6206 .align 2, 0 -_082E61EC: .4byte gUnknown_03007890 -_082E61F0: .4byte gUnknown_03007898 -_082E61F4: .4byte 0x00008022 + .pool _082E61F8: movs r0, 0x1 mov r1, r10 @@ -4796,7 +4677,7 @@ rfu_STC_UNI_constructLLSF: @ 82E6220 lsls r0, 24 lsrs r0, 24 mov r8, r0 - ldr r1, _082E6248 + ldr r1, =gUnknown_03007870 lsls r0, 2 adds r0, r1 ldr r4, [r0] @@ -4810,13 +4691,13 @@ _082E6244: movs r0, 0 b _082E62E8 .align 2, 0 -_082E6248: .4byte gUnknown_03007870 + .pool _082E624C: - ldr r0, _082E62C4 + ldr r0, =gUnknown_03007890 ldr r2, [r0] ldrb r0, [r2] lsls r0, 4 - ldr r1, _082E62C8 + ldr r1, =gUnknown_089A3220 adds r5, r0, r1 ldrh r0, [r4] movs r1, 0xF @@ -4836,7 +4717,7 @@ _082E624C: _082E6276: mov r2, sp movs r3, 0 - ldr r1, _082E62CC + ldr r1, =gUnknown_03007898 mov r12, r1 add r7, sp, 0x4 ldrb r0, [r5] @@ -4865,7 +4746,7 @@ _082E629E: adds r0, r7, 0 adds r1, r6, 0 bl _call_via_r3 - ldr r0, _082E62C4 + ldr r0, =gUnknown_03007890 ldr r2, [r0] ldrb r0, [r2] cmp r0, 0x1 @@ -4874,9 +4755,7 @@ _082E629E: movs r0, 0x10 b _082E62DC .align 2, 0 -_082E62C4: .4byte gUnknown_03007890 -_082E62C8: .4byte gUnknown_089A3220 -_082E62CC: .4byte gUnknown_03007898 + .pool _082E62D0: movs r0, 0x10 mov r1, r8 @@ -4903,12 +4782,12 @@ _082E62E8: thumb_func_start rfu_REQ_recvData rfu_REQ_recvData: @ 82E62F4 push {r4,lr} - ldr r0, _082E6328 + ldr r0, =gUnknown_03007890 ldr r4, [r0] ldrb r0, [r4] cmp r0, 0xFF beq _082E6320 - ldr r2, _082E632C + ldr r2, =gUnknown_03007894 ldr r3, [r2] ldrb r0, [r4, 0x4] ldrb r1, [r4, 0x5] @@ -4919,7 +4798,7 @@ rfu_REQ_recvData: @ 82E62F4 strb r0, [r3, 0x3] ldr r0, [r2] strb r1, [r0, 0x4] - ldr r0, _082E6330 + ldr r0, =rfu_CB_recvData bl STWI_set_Callback_M bl STWI_send_DataRxREQ _082E6320: @@ -4927,9 +4806,7 @@ _082E6320: pop {r0} bx r0 .align 2, 0 -_082E6328: .4byte gUnknown_03007890 -_082E632C: .4byte gUnknown_03007894 -_082E6330: .4byte rfu_CB_recvData + .pool thumb_func_end rfu_REQ_recvData thumb_func_start rfu_CB_recvData @@ -4946,17 +4823,17 @@ rfu_CB_recvData: @ 82E6334 lsrs r7, r1, 16 cmp r7, 0 bne _082E63F8 - ldr r0, _082E6370 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r0, [r0] ldrb r0, [r0, 0x1] cmp r0, 0 beq _082E63F8 - ldr r0, _082E6374 + ldr r0, =gUnknown_03007894 ldr r0, [r0] strb r7, [r0, 0x1] - ldr r0, _082E6378 + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r0, [r0] cmp r0, 0x1 @@ -4964,25 +4841,23 @@ rfu_CB_recvData: @ 82E6334 bl rfu_STC_PARENT_analyzeRecvPacket b _082E6380 .align 2, 0 -_082E6370: .4byte gUnknown_03007898 -_082E6374: .4byte gUnknown_03007894 -_082E6378: .4byte gUnknown_03007890 + .pool _082E637C: bl rfu_STC_CHILD_analyzeRecvPacket _082E6380: movs r6, 0 - ldr r0, _082E6410 + ldr r0, =0x00008043 mov r8, r0 - ldr r3, _082E6414 + ldr r3, =gUnknown_03007890 _082E6388: - ldr r0, _082E6418 + ldr r0, =gUnknown_03007880 lsls r1, r6, 2 adds r1, r0 ldr r4, [r1] ldrh r0, [r4, 0x34] cmp r0, r8 bne _082E63DA - ldr r0, _082E641C + ldr r0, =gUnknown_03007894 ldr r0, [r0] ldrb r0, [r0, 0x1] asrs r0, r6 @@ -5022,7 +4897,7 @@ _082E63DA: lsrs r6, r0, 24 cmp r6, 0x3 bls _082E6388 - ldr r0, _082E641C + ldr r0, =gUnknown_03007894 ldr r1, [r0] ldrb r0, [r1, 0x4] cmp r0, 0 @@ -5044,17 +4919,14 @@ _082E63F8: pop {r0} bx r0 .align 2, 0 -_082E6410: .4byte 0x00008043 -_082E6414: .4byte gUnknown_03007890 -_082E6418: .4byte gUnknown_03007880 -_082E641C: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_CB_recvData thumb_func_start rfu_STC_PARENT_analyzeRecvPacket rfu_STC_PARENT_analyzeRecvPacket: @ 82E6420 push {r4-r7,lr} sub sp, 0x4 - ldr r1, _082E64B0 + ldr r1, =gUnknown_03007898 ldr r0, [r1] adds r0, 0xDC ldr r0, [r0] @@ -5063,7 +4935,7 @@ rfu_STC_PARENT_analyzeRecvPacket: @ 82E6420 movs r5, 0 mov r12, r1 movs r7, 0x1F - ldr r4, _082E64B4 + ldr r4, =gUnknown_03007894 movs r6, 0x1 _082E643A: mov r0, sp @@ -5129,14 +5001,13 @@ _082E64A0: pop {r0} bx r0 .align 2, 0 -_082E64B0: .4byte gUnknown_03007898 -_082E64B4: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_STC_PARENT_analyzeRecvPacket thumb_func_start rfu_STC_CHILD_analyzeRecvPacket rfu_STC_CHILD_analyzeRecvPacket: @ 82E64B8 push {r4-r6,lr} - ldr r0, _082E6508 + ldr r0, =gUnknown_03007898 ldr r0, [r0] adds r0, 0xDC ldr r1, [r0] @@ -5147,7 +5018,7 @@ rfu_STC_CHILD_analyzeRecvPacket: @ 82E64B8 adds r5, 0x8 cmp r4, 0 bne _082E64D8 - ldr r0, _082E650C + ldr r0, =gUnknown_03007894 ldr r1, [r0] movs r0, 0xF strb r0, [r1, 0x1] @@ -5177,8 +5048,7 @@ _082E6500: pop {r0} bx r0 .align 2, 0 -_082E6508: .4byte gUnknown_03007898 -_082E650C: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_STC_CHILD_analyzeRecvPacket thumb_func_start rfu_STC_analyzeLLSF @@ -5195,14 +5065,14 @@ rfu_STC_analyzeLLSF: @ 82E6510 mov r12, r0 lsls r2, 16 lsrs r3, r2, 16 - ldr r2, _082E6544 + ldr r2, =gUnknown_03007890 ldr r0, [r2] ldrb r0, [r0] mvns r0, r0 movs r1, 0x1 ands r0, r1 lsls r0, 4 - ldr r1, _082E6548 + ldr r1, =gUnknown_089A3220 adds r6, r0, r1 ldrb r0, [r6] cmp r3, r0 @@ -5210,8 +5080,7 @@ rfu_STC_analyzeLLSF: @ 82E6510 adds r0, r3, 0 b _082E673E .align 2, 0 -_082E6544: .4byte gUnknown_03007890 -_082E6548: .4byte gUnknown_089A3220 + .pool _082E654C: movs r5, 0 movs r4, 0 @@ -5239,7 +5108,7 @@ _082E6574: lsrs r0, r3 mov r3, r8 ands r0, r3 - ldr r1, _082E664C + ldr r1, =0xffffff00 mov r10, r1 mov r3, r10 mov r2, r9 @@ -5252,7 +5121,7 @@ _082E6574: ldrb r1, [r6, 0x8] ands r0, r1 lsls r0, 8 - ldr r4, _082E6650 + ldr r4, =0xffff00ff adds r2, r4, 0 ands r2, r3 orrs r2, r0 @@ -5263,7 +5132,7 @@ _082E6574: ldrb r1, [r6, 0x9] ands r0, r1 lsls r0, 16 - ldr r3, _082E6654 + ldr r3, =0xff00ffff ands r3, r2 orrs r3, r0 str r3, [sp] @@ -5273,7 +5142,7 @@ _082E6574: ldrb r1, [r6, 0xA] ands r0, r1 lsls r0, 24 - ldr r2, _082E6658 + ldr r2, =0x00ffffff mov r8, r2 mov r1, r8 ands r1, r3 @@ -5303,7 +5172,7 @@ _082E6574: ldrh r0, [r6, 0xE] ands r5, r0 lsls r1, r5, 16 - ldr r0, _082E665C + ldr r0, =0x0000ffff ands r0, r4 orrs r0, r1 str r0, [sp, 0x4] @@ -5319,7 +5188,7 @@ _082E6574: beq _082E661A b _082E673C _082E661A: - ldr r2, _082E6660 + ldr r2, =gUnknown_03007890 ldr r3, [r2] ldrb r2, [r3] cmp r2, 0x1 @@ -5344,12 +5213,7 @@ _082E6632: bl rfu_STC_UNI_receive b _082E673C .align 2, 0 -_082E664C: .4byte 0xffffff00 -_082E6650: .4byte 0xffff00ff -_082E6654: .4byte 0xff00ffff -_082E6658: .4byte 0x00ffffff -_082E665C: .4byte 0x0000ffff -_082E6660: .4byte gUnknown_03007890 + .pool _082E6664: mov r5, r9 ldrb r0, [r5, 0x3] @@ -5362,7 +5226,7 @@ _082E6664: b _082E673C _082E6678: movs r4, 0 - ldr r1, _082E6690 + ldr r1, =gUnknown_03007880 ldr r0, [r1] ldrb r0, [r0, 0x1A] mov r5, r12 @@ -5373,7 +5237,7 @@ _082E6678: ldrb r0, [r3, 0x4] b _082E66BA .align 2, 0 -_082E6690: .4byte gUnknown_03007880 + .pool _082E6694: adds r0, r4, 0x1 lsls r0, 24 @@ -5390,7 +5254,7 @@ _082E6694: ands r0, r2 cmp r0, 0 beq _082E6694 - ldr r3, _082E66D4 + ldr r3, =gUnknown_03007890 ldr r0, [r3] ldrb r0, [r0, 0x4] mov r5, r12 @@ -5408,7 +5272,7 @@ _082E66BA: bl rfu_STC_NI_receive_Sender b _082E673C .align 2, 0 -_082E66D4: .4byte gUnknown_03007890 + .pool _082E66D8: ldrb r1, [r3, 0x2] mov r2, r9 @@ -5443,7 +5307,7 @@ _082E6706: bl rfu_STC_NI_receive_Receiver b _082E6732 _082E6718: - ldr r0, _082E6750 + ldr r0, =gUnknown_03007890 ldr r0, [r0] ldrb r0, [r0, 0x4] asrs r0, r4 @@ -5473,7 +5337,7 @@ _082E673E: pop {r1} bx r1 .align 2, 0 -_082E6750: .4byte gUnknown_03007890 + .pool thumb_func_end rfu_STC_analyzeLLSF thumb_func_start rfu_STC_UNI_receive @@ -5484,7 +5348,7 @@ rfu_STC_UNI_receive: @ 82E6754 str r2, [sp] lsls r0, 24 lsrs r7, r0, 24 - ldr r2, _082E6788 + ldr r2, =gUnknown_03007870 lsls r1, r7, 2 adds r1, r2 ldr r3, [r1] @@ -5501,12 +5365,11 @@ rfu_STC_UNI_receive: @ 82E6754 bcs _082E6790 movs r0, 0x49 strh r0, [r3, 0xC] - ldr r0, _082E678C + ldr r0, =0x00000701 strh r0, [r5, 0x2] b _082E67DE .align 2, 0 -_082E6788: .4byte gUnknown_03007870 -_082E678C: .4byte 0x00000701 + .pool _082E6790: ldrb r0, [r5, 0x7] cmp r0, 0 @@ -5514,11 +5377,11 @@ _082E6790: ldrb r0, [r5, 0x6] cmp r0, 0 beq _082E67B4 - ldr r0, _082E67A4 + ldr r0, =0x00000709 strh r0, [r5, 0x2] b _082E67DE .align 2, 0 -_082E67A4: .4byte 0x00000709 + .pool _082E67A8: ldrb r0, [r5, 0x6] cmp r0, 0 @@ -5528,7 +5391,7 @@ _082E67A8: strh r0, [r5, 0x2] _082E67B4: movs r4, 0 - ldr r0, _082E67FC + ldr r0, =0x00008042 strh r0, [r5] ldrh r0, [r6, 0x6] strh r0, [r5, 0x4] @@ -5538,7 +5401,7 @@ _082E67B4: ldr r0, [r0] ldr r0, [r0, 0x14] str r0, [sp, 0x4] - ldr r0, _082E6800 + ldr r0, =gUnknown_03007898 ldr r0, [r0] add r1, sp, 0x4 ldr r3, [r0, 0x4] @@ -5551,7 +5414,7 @@ _082E67DE: ldrh r0, [r5, 0x2] cmp r0, 0 beq _082E67F2 - ldr r0, _082E6804 + ldr r0, =gUnknown_03007894 ldr r2, [r0] movs r0, 0x10 lsls r0, r7 @@ -5564,9 +5427,7 @@ _082E67F2: pop {r0} bx r0 .align 2, 0 -_082E67FC: .4byte 0x00008042 -_082E6800: .4byte gUnknown_03007898 -_082E6804: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_STC_UNI_receive thumb_func_start rfu_STC_NI_receive_Sender @@ -5582,7 +5443,7 @@ rfu_STC_NI_receive_Sender: @ 82E6808 lsls r1, 24 lsrs r1, 24 mov r10, r1 - ldr r1, _082E68D4 + ldr r1, =gUnknown_03007880 lsrs r0, 22 adds r0, r1 ldr r0, [r0] @@ -5598,13 +5459,13 @@ rfu_STC_NI_receive_Sender: @ 82E6808 ldrb r2, [r6, 0x2] cmp r2, 0x2 bne _082E6844 - ldr r0, _082E68D8 + ldr r0, =0x00008022 cmp r9, r0 beq _082E685E _082E6844: cmp r2, 0x1 bne _082E684E - ldr r0, _082E68DC + ldr r0, =0x00008021 cmp r9, r0 beq _082E685E _082E684E: @@ -5613,7 +5474,7 @@ _082E684E: mov r8, r3 cmp r2, 0x3 bne _082E6882 - ldr r0, _082E68E0 + ldr r0, =0x00008023 cmp r9, r0 bne _082E6882 _082E685E: @@ -5658,14 +5519,14 @@ _082E6882: strb r1, [r0] mov r7, r12 ldrh r1, [r7] - ldr r2, _082E68E4 + ldr r2, =0x00007fdf adds r0, r1, r2 lsls r0, 16 lsrs r0, 16 adds r5, r3, 0 cmp r0, 0x1 bhi _082E6970 - ldr r0, _082E68DC + ldr r0, =0x00008021 cmp r1, r0 bne _082E68E8 ldrb r1, [r6, 0x4] @@ -5678,11 +5539,7 @@ _082E6882: str r0, [r1] b _082E68FE .align 2, 0 -_082E68D4: .4byte gUnknown_03007880 -_082E68D8: .4byte 0x00008022 -_082E68DC: .4byte 0x00008021 -_082E68E0: .4byte 0x00008023 -_082E68E4: .4byte 0x00007fdf + .pool _082E68E8: ldrb r2, [r6, 0x4] lsls r2, 2 @@ -5713,7 +5570,7 @@ _082E6912: strb r2, [r0] mov r7, r12 ldrh r1, [r7] - ldr r0, _082E6954 + ldr r0, =0x00008021 cmp r1, r0 bne _082E695C movs r4, 0 @@ -5738,28 +5595,27 @@ _082E6926: bls _082E6926 ldr r0, [r7, 0x30] str r0, [r7, 0x14] - ldr r0, _082E6958 + ldr r0, =0x00008022 strh r0, [r7] b _082E697E .align 2, 0 -_082E6954: .4byte 0x00008021 -_082E6958: .4byte 0x00008022 + .pool _082E695C: strb r2, [r5] mov r0, r12 str r2, [r0, 0x14] - ldr r0, _082E696C + ldr r0, =0x00008023 mov r1, r12 strh r0, [r1] b _082E697E .align 2, 0 -_082E696C: .4byte 0x00008023 + .pool _082E6970: lsls r1, 16 - ldr r0, _082E69E0 + ldr r0, =0x80230000 cmp r1, r0 bne _082E697E - ldr r0, _082E69E4 + ldr r0, =0x00008020 mov r2, r12 strh r0, [r2] _082E697E: @@ -5785,11 +5641,11 @@ _082E697E: cmp r0, 0 beq _082E69CE _082E69A8: - ldr r4, _082E69E8 + ldr r4, =0x04000208 ldrh r2, [r4] movs r0, 0 strh r0, [r4] - ldr r0, _082E69EC + ldr r0, =gUnknown_03007894 ldr r3, [r0] movs r0, 0x10 mov r7, r10 @@ -5799,7 +5655,7 @@ _082E69A8: movs r1, 0 strb r0, [r3, 0x2] lsls r0, r7, 2 - ldr r3, _082E69F0 + ldr r3, =gUnknown_03007880 adds r0, r3 ldr r0, [r0] strh r1, [r0, 0x2] @@ -5814,11 +5670,7 @@ _082E69CE: pop {r0} bx r0 .align 2, 0 -_082E69E0: .4byte 0x80230000 -_082E69E4: .4byte 0x00008020 -_082E69E8: .4byte 0x04000208 -_082E69EC: .4byte gUnknown_03007894 -_082E69F0: .4byte gUnknown_03007880 + .pool thumb_func_end rfu_STC_NI_receive_Sender thumb_func_start rfu_STC_NI_receive_Receiver @@ -5835,7 +5687,7 @@ rfu_STC_NI_receive_Receiver: @ 82E69F4 lsrs r0, 24 mov r8, r0 movs r7, 0 - ldr r1, _082E6A54 + ldr r1, =gUnknown_03007880 lsls r0, 2 adds r0, r1 ldr r4, [r0] @@ -5852,7 +5704,7 @@ rfu_STC_NI_receive_Receiver: @ 82E69F4 ldrb r0, [r6, 0x2] cmp r0, 0x3 bne _082E6A64 - ldr r0, _082E6A58 + ldr r0, =gUnknown_03007894 ldr r2, [r0] movs r0, 0x1 mov r1, r8 @@ -5861,25 +5713,22 @@ rfu_STC_NI_receive_Receiver: @ 82E69F4 orrs r0, r1 strb r0, [r2, 0x1] ldrh r1, [r4, 0x34] - ldr r0, _082E6A5C + ldr r0, =0x00008042 cmp r1, r0 bne _082E6AAA adds r0, r4, 0 adds r0, 0x54 strb r7, [r0] strb r7, [r3] - ldr r0, _082E6A60 + ldr r0, =0x00008043 strh r0, [r4, 0x34] b _082E6AAA .align 2, 0 -_082E6A54: .4byte gUnknown_03007880 -_082E6A58: .4byte gUnknown_03007894 -_082E6A5C: .4byte 0x00008042 -_082E6A60: .4byte 0x00008043 + .pool _082E6A64: cmp r0, 0x2 bne _082E6A90 - ldr r0, _082E6A88 + ldr r0, =0x00008041 cmp r9, r0 bne _082E6A7C ldr r0, [r5, 0x14] @@ -5890,17 +5739,16 @@ _082E6A64: bl rfu_STC_NI_initSlot_asRecvDataEntity _082E6A7C: ldrh r1, [r5] - ldr r0, _082E6A8C + ldr r0, =0x00008042 cmp r1, r0 bne _082E6AAA b _082E6AAE .align 2, 0 -_082E6A88: .4byte 0x00008041 -_082E6A8C: .4byte 0x00008042 + .pool _082E6A90: cmp r0, 0x1 bne _082E6AAA - ldr r7, _082E6B5C + ldr r7, =0x00008041 cmp r9, r7 beq _082E6AAE mov r0, r8 @@ -5925,7 +5773,7 @@ _082E6AAE: ands r0, r1 cmp r2, r0 bne _082E6B04 - ldr r0, _082E6B60 + ldr r0, =gUnknown_03007898 ldr r0, [r0] lsls r1, r3, 2 adds r1, 0x4 @@ -5935,7 +5783,7 @@ _082E6AAE: mov r0, sp bl _call_via_r3 ldrh r1, [r5] - ldr r0, _082E6B64 + ldr r0, =0x00008042 cmp r1, r0 bne _082E6AF4 ldrb r0, [r6, 0x4] @@ -5979,11 +5827,11 @@ _082E6B04: cmp r0, r6 bne _082E6B4A _082E6B2C: - ldr r3, _082E6B68 + ldr r3, =0x04000208 ldrh r2, [r3] movs r0, 0 strh r0, [r3] - ldr r0, _082E6B6C + ldr r0, =gUnknown_03007894 ldr r4, [r0] movs r0, 0x1 mov r1, r8 @@ -6004,11 +5852,7 @@ _082E6B4A: pop {r0} bx r0 .align 2, 0 -_082E6B5C: .4byte 0x00008041 -_082E6B60: .4byte gUnknown_03007898 -_082E6B64: .4byte 0x00008042 -_082E6B68: .4byte 0x04000208 -_082E6B6C: .4byte gUnknown_03007894 + .pool thumb_func_end rfu_STC_NI_receive_Receiver thumb_func_start rfu_STC_NI_initSlot_asRecvControllData @@ -6017,7 +5861,7 @@ rfu_STC_NI_initSlot_asRecvControllData: @ 82E6B70 adds r2, r1, 0 lsls r0, 24 lsrs r4, r0, 24 - ldr r0, _082E6B8C + ldr r0, =gUnknown_03007890 ldr r3, [r0] ldrb r1, [r3] mov r12, r0 @@ -6028,7 +5872,7 @@ rfu_STC_NI_initSlot_asRecvControllData: @ 82E6B70 adds r1, 0xF b _082E6B98 .align 2, 0 -_082E6B8C: .4byte gUnknown_03007890 + .pool _082E6B90: movs r5, 0x2 adds r0, r4, 0 @@ -6049,9 +5893,9 @@ _082E6B98: bcs _082E6BD0 movs r0, 0x49 strh r0, [r2] - ldr r0, _082E6BC8 + ldr r0, =0x00000702 strh r0, [r2, 0x18] - ldr r0, _082E6BCC + ldr r0, =gUnknown_03007894 ldr r2, [r0] ldrb r1, [r2, 0x4] adds r0, r6, 0 @@ -6059,8 +5903,7 @@ _082E6B98: strb r0, [r2, 0x4] b _082E6BF6 .align 2, 0 -_082E6BC8: .4byte 0x00000702 -_082E6BCC: .4byte gUnknown_03007894 + .pool _082E6BD0: strh r3, [r2, 0x18] ldrb r0, [r1] @@ -6074,7 +5917,7 @@ _082E6BD0: strb r7, [r2, 0x1F] strh r3, [r2, 0x2E] strb r4, [r2, 0x1A] - ldr r0, _082E6BFC + ldr r0, =0x00008041 strh r0, [r2] mov r0, r12 ldr r1, [r0] @@ -6086,7 +5929,7 @@ _082E6BF6: pop {r0} bx r0 .align 2, 0 -_082E6BFC: .4byte 0x00008041 + .pool thumb_func_end rfu_STC_NI_initSlot_asRecvControllData thumb_func_start rfu_STC_NI_initSlot_asRecvDataEntity @@ -6100,7 +5943,7 @@ rfu_STC_NI_initSlot_asRecvDataEntity: @ 82E6C00 ldrb r0, [r0] cmp r0, 0x1 bne _082E6C24 - ldr r0, _082E6C20 + ldr r0, =gUnknown_03007890 lsls r1, r5, 5 adds r1, 0x14 ldr r0, [r0] @@ -6108,9 +5951,9 @@ rfu_STC_NI_initSlot_asRecvDataEntity: @ 82E6C00 adds r0, 0x4 b _082E6C7A .align 2, 0 -_082E6C20: .4byte gUnknown_03007890 + .pool _082E6C24: - ldr r1, _082E6C68 + ldr r1, =gUnknown_03007880 lsls r0, r5, 2 adds r0, r1 ldr r2, [r0] @@ -6122,18 +5965,18 @@ _082E6C24: lsls r1, 17 lsls r1, r5 lsrs r1, 24 - ldr r0, _082E6C6C + ldr r0, =gUnknown_03007894 ldr r3, [r0] ldrb r2, [r3, 0x4] adds r0, r1, 0 orrs r0, r2 strb r0, [r3, 0x4] - ldr r0, _082E6C70 + ldr r0, =gUnknown_03007890 ldr r2, [r0] ldrb r0, [r2, 0x5] bics r0, r1 strb r0, [r2, 0x5] - ldr r0, _082E6C74 + ldr r0, =0x00000701 strh r0, [r4, 0x18] movs r0, 0x47 strh r0, [r4] @@ -6143,10 +5986,7 @@ _082E6C24: bl rfu_STC_releaseFrame b _082E6CAC .align 2, 0 -_082E6C68: .4byte gUnknown_03007880 -_082E6C6C: .4byte gUnknown_03007894 -_082E6C70: .4byte gUnknown_03007890 -_082E6C74: .4byte 0x00000701 + .pool _082E6C78: ldr r0, [r2, 0x68] _082E6C7A: @@ -6174,39 +6014,39 @@ _082E6C86: bls _082E6C86 ldr r0, [r4, 0x30] str r0, [r4, 0x14] - ldr r0, _082E6CB4 + ldr r0, =0x00008042 strh r0, [r4] _082E6CAC: pop {r4-r7} pop {r0} bx r0 .align 2, 0 -_082E6CB4: .4byte 0x00008042 + .pool thumb_func_end rfu_STC_NI_initSlot_asRecvDataEntity thumb_func_start rfu_NI_checkCommFailCounter rfu_NI_checkCommFailCounter: @ 82E6CB8 push {r4-r7,lr} - ldr r2, _082E6D44 + ldr r2, =gUnknown_03007890 ldr r0, [r2] ldrb r1, [r0, 0x4] ldrb r0, [r0, 0x5] orrs r0, r1 cmp r0, 0 beq _082E6D3E - ldr r1, _082E6D48 + ldr r1, =0x04000208 ldrh r0, [r1] mov r12, r0 movs r0, 0 strh r0, [r1] - ldr r1, _082E6D4C + ldr r1, =gUnknown_03007894 ldr r0, [r1] ldrb r0, [r0, 0x2] lsrs r7, r0, 4 movs r3, 0 adds r6, r1, 0 adds r5, r2, 0 - ldr r4, _082E6D50 + ldr r4, =gUnknown_03007880 _082E6CE2: movs r0, 0x80 lsls r0, 17 @@ -6253,7 +6093,7 @@ _082E6D28: ldr r0, [r6] movs r1, 0 strb r1, [r0, 0x2] - ldr r0, _082E6D48 + ldr r0, =0x04000208 mov r1, r12 strh r1, [r0] _082E6D3E: @@ -6261,16 +6101,13 @@ _082E6D3E: pop {r0} bx r0 .align 2, 0 -_082E6D44: .4byte gUnknown_03007890 -_082E6D48: .4byte 0x04000208 -_082E6D4C: .4byte gUnknown_03007894 -_082E6D50: .4byte gUnknown_03007880 + .pool thumb_func_end rfu_NI_checkCommFailCounter thumb_func_start rfu_REQ_noise rfu_REQ_noise: @ 82E6D54 push {lr} - ldr r0, _082E6D68 + ldr r0, =rfu_STC_REQ_callback bl STWI_set_Callback_M movs r0, 0x1 movs r1, 0 @@ -6278,7 +6115,7 @@ rfu_REQ_noise: @ 82E6D54 pop {r0} bx r0 .align 2, 0 -_082E6D68: .4byte rfu_STC_REQ_callback + .pool thumb_func_end rfu_REQ_noise thumb_func_start sub_82E6D6C @@ -6288,7 +6125,7 @@ sub_82E6D6C: @ 82E6D6C push {r7} lsls r0, 24 lsrs r5, r0, 24 - ldr r0, _082E6D84 + ldr r0, =0x04000208 ldrh r0, [r0] cmp r0, 0 bne _082E6D88 @@ -6296,32 +6133,29 @@ sub_82E6D6C: @ 82E6D6C negs r0, r0 b _082E6E08 .align 2, 0 -_082E6D84: .4byte 0x04000208 + .pool _082E6D88: - ldr r0, _082E6DB4 + ldr r0, =0x04000200 ldrh r0, [r0] mov r8, r0 - ldr r4, _082E6DB8 + ldr r4, =gRfuState ldr r1, [r4] movs r0, 0xA str r0, [r1] - ldr r0, _082E6DBC + ldr r0, =sub_82E6F88 bl STWI_set_Callback_ID bl sub_82E6E20 ldr r0, [r4] ldrb r0, [r0, 0xA] lsls r0, 2 - ldr r1, _082E6DC0 + ldr r1, =0x04000100 adds r4, r0, r1 lsls r0, r5, 27 lsrs r5, r0, 24 movs r7, 0 b _082E6DD6 .align 2, 0 -_082E6DB4: .4byte 0x04000200 -_082E6DB8: .4byte gRfuState -_082E6DBC: .4byte sub_82E6F88 -_082E6DC0: .4byte 0x04000100 + .pool _082E6DC4: strh r6, [r4, 0x2] strh r6, [r4] @@ -6344,15 +6178,15 @@ _082E6DD6: cmp r6, 0 beq _082E6DC4 _082E6DEA: - ldr r1, _082E6E14 + ldr r1, =0x04000208 movs r0, 0 strh r0, [r1] - ldr r0, _082E6E18 + ldr r0, =0x04000200 mov r2, r8 strh r2, [r0] movs r0, 0x1 strh r0, [r1] - ldr r0, _082E6E1C + ldr r0, =gRfuState ldr r1, [r0] movs r0, 0 str r0, [r1] @@ -6365,20 +6199,18 @@ _082E6E08: pop {r1} bx r1 .align 2, 0 -_082E6E14: .4byte 0x04000208 -_082E6E18: .4byte 0x04000200 -_082E6E1C: .4byte gRfuState + .pool thumb_func_end sub_82E6D6C thumb_func_start sub_82E6E20 sub_82E6E20: @ 82E6E20 push {r4,r5,lr} sub sp, 0x4 - ldr r3, _082E6E78 + ldr r3, =0x04000208 movs r4, 0 strh r4, [r3] - ldr r2, _082E6E7C - ldr r0, _082E6E80 + ldr r2, =0x04000200 + ldr r0, =gRfuState ldr r0, [r0] movs r1, 0x8 ldrb r0, [r0, 0xA] @@ -6390,7 +6222,7 @@ sub_82E6E20: @ 82E6E20 strh r0, [r2] movs r0, 0x1 strh r0, [r3] - ldr r0, _082E6E84 + ldr r0, =0x04000134 strh r4, [r0] subs r2, 0xD8 movs r1, 0x80 @@ -6405,30 +6237,24 @@ sub_82E6E20: @ 82E6E20 strh r0, [r2] movs r0, 0 str r0, [sp] - ldr r1, _082E6E88 - ldr r2, _082E6E8C + ldr r1, =gUnknown_030078A0 + ldr r2, =0x05000003 mov r0, sp bl CpuSet - ldr r0, _082E6E90 + ldr r0, =0x04000202 strh r5, [r0] add sp, 0x4 pop {r4,r5} pop {r0} bx r0 .align 2, 0 -_082E6E78: .4byte 0x04000208 -_082E6E7C: .4byte 0x04000200 -_082E6E80: .4byte gRfuState -_082E6E84: .4byte 0x04000134 -_082E6E88: .4byte gUnknown_030078A0 -_082E6E8C: .4byte 0x05000003 -_082E6E90: .4byte 0x04000202 + .pool thumb_func_end sub_82E6E20 thumb_func_start sub_82E6E94 sub_82E6E94: @ 82E6E94 push {r4-r7,lr} - ldr r0, _082E6EA8 + ldr r0, =gUnknown_030078A0 ldrb r1, [r0, 0x1] mov r12, r1 adds r7, r0, 0 @@ -6438,19 +6264,19 @@ sub_82E6E94: @ 82E6E94 beq _082E6EE4 b _082E6F7C .align 2, 0 -_082E6EA8: .4byte gUnknown_030078A0 + .pool _082E6EAC: movs r6, 0x1 strb r6, [r7] - ldr r3, _082E6ED8 + ldr r3, =0x04000128 ldrh r0, [r3] movs r5, 0x1 orrs r0, r5 strh r0, [r3] - ldr r4, _082E6EDC + ldr r4, =0x04000208 mov r0, r12 strh r0, [r4] - ldr r2, _082E6EE0 + ldr r2, =0x04000200 ldrh r0, [r2] movs r1, 0x80 orrs r0, r1 @@ -6462,9 +6288,7 @@ _082E6EAC: strb r0, [r3] b _082E6F80 .align 2, 0 -_082E6ED8: .4byte 0x04000128 -_082E6EDC: .4byte 0x04000208 -_082E6EE0: .4byte 0x04000200 + .pool _082E6EE4: ldrh r0, [r7, 0xA] cmp r0, 0 @@ -6475,9 +6299,9 @@ _082E6EE4: ldrh r0, [r7, 0x2] cmp r0, 0 bne _082E6F80 - ldr r3, _082E6F0C + ldr r3, =0x04000208 strh r0, [r3] - ldr r2, _082E6F10 + ldr r2, =0x04000128 ldrh r0, [r2] movs r1, 0x80 orrs r0, r1 @@ -6486,32 +6310,31 @@ _082E6EE4: strh r1, [r3] b _082E6F80 .align 2, 0 -_082E6F0C: .4byte 0x04000208 -_082E6F10: .4byte 0x04000128 + .pool _082E6F14: ldrh r1, [r7, 0x4] - ldr r0, _082E6F60 + ldr r0, =0x00008001 cmp r1, r0 beq _082E6F80 ldrh r6, [r7, 0x2] cmp r6, 0 bne _082E6F80 - ldr r4, _082E6F64 + ldr r4, =0x04000208 strh r6, [r4] - ldr r3, _082E6F68 + ldr r3, =0x04000200 ldrh r1, [r3] - ldr r0, _082E6F6C + ldr r0, =0x0000ff7f ands r0, r1 strh r0, [r3] mov r7, r12 strh r7, [r4] - ldr r2, _082E6F70 + ldr r2, =0x04000128 strh r6, [r2] movs r1, 0x80 lsls r1, 5 adds r0, r1, 0 strh r0, [r2] - ldr r0, _082E6F74 + ldr r0, =0x04000202 movs r5, 0x80 strh r5, [r0] ldrh r0, [r2] @@ -6528,12 +6351,7 @@ _082E6F14: strh r0, [r4] b _082E6F80 .align 2, 0 -_082E6F60: .4byte 0x00008001 -_082E6F64: .4byte 0x04000208 -_082E6F68: .4byte 0x04000200 -_082E6F6C: .4byte 0x0000ff7f -_082E6F70: .4byte 0x04000128 -_082E6F74: .4byte 0x04000202 + .pool _082E6F78: movs r0, 0x2 strb r0, [r7, 0x1] @@ -6551,14 +6369,14 @@ _082E6F82: thumb_func_start sub_82E6F88 sub_82E6F88: @ 82E6F88 push {r4,r5,lr} - ldr r0, _082E6FD0 + ldr r0, =0x04000120 ldr r5, [r0] - ldr r0, _082E6FD4 + ldr r0, =gUnknown_030078A0 ldrb r1, [r0] adds r4, r0, 0 cmp r1, 0x1 beq sub_82E6FA2 - ldr r0, _082E6FD8 + ldr r0, =0x04000128 ldrh r1, [r0] movs r2, 0x80 orrs r1, r2 @@ -6590,9 +6408,7 @@ sub_82E6FA2: @ 82E6FA2 strh r5, [r4, 0xA] b _082E6FF6 .align 2, 0 -_082E6FD0: .4byte 0x04000120 -_082E6FD4: .4byte gUnknown_030078A0 -_082E6FD8: .4byte 0x04000128 + .pool _082E6FDC: ldrh r0, [r4, 0x4] mvns r0, r0 @@ -6613,19 +6429,19 @@ _082E6FF6: cmp r0, 0x3 bhi _082E700C lsls r0, 1 - ldr r1, _082E7008 + ldr r1, =gUnknown_089A3258 adds r0, r1 ldrh r0, [r0] b _082E700E .align 2, 0 -_082E7008: .4byte gUnknown_089A3258 + .pool _082E700C: - ldr r0, _082E7064 + ldr r0, =0x00008001 _082E700E: strh r0, [r4, 0x4] mvns r0, r5 strh r0, [r4, 0x6] - ldr r3, _082E7068 + ldr r3, =0x04000120 ldrh r2, [r4, 0x4] ldrb r1, [r4] movs r0, 0x1 @@ -6643,12 +6459,12 @@ _082E700E: ldrh r0, [r4, 0x2] cmp r0, 0 bne _082E703E - ldr r0, _082E706C + ldr r0, =0x0000494e cmp r5, r0 bne _082E705C _082E703E: movs r0, 0 - ldr r1, _082E7070 + ldr r1, =0x00000257 _082E7042: adds r0, 0x1 lsls r0, 16 @@ -6658,7 +6474,7 @@ _082E7042: ldrh r0, [r4, 0xA] cmp r0, 0 bne _082E705C - ldr r0, _082E7074 + ldr r0, =0x04000128 ldrh r1, [r0] movs r2, 0x80 orrs r1, r2 @@ -6668,11 +6484,7 @@ _082E705C: pop {r0} bx r0 .align 2, 0 -_082E7064: .4byte 0x00008001 -_082E7068: .4byte 0x04000120 -_082E706C: .4byte 0x0000494e -_082E7070: .4byte 0x00000257 -_082E7074: .4byte 0x04000128 + .pool thumb_func_end sub_82E6FA2 .align 2, 0 @ Don't pad with nop. From c9f43116aaf2a6df147463e7500ea1b73b6a76ee Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 7 Dec 2017 08:48:49 -0500 Subject: [PATCH 097/123] through sub_800EAFC --- asm/link_rfu.s | 67 ---------------------------------------------- include/link_rfu.h | 15 +++++++---- src/link_rfu.c | 25 +++++++++++++++++ 3 files changed, 35 insertions(+), 72 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 901fbb060..5a611409b 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,73 +5,6 @@ .text - thumb_func_start sub_800EAB4 -sub_800EAB4: @ 800EAB4 - push {r4,r5,lr} - ldr r0, =gUnknown_03004140 - ldrb r5, [r0] - movs r4, 0 -_0800EABC: - movs r0, 0x1 - ands r0, r5 - cmp r0, 0 - beq _0800EAE0 - lsls r2, r4, 3 - subs r2, r4 - lsls r2, 1 - ldr r0, =gUnknown_03005000+0x14 - adds r2, r0 - movs r0, 0x10 - adds r1, r4, 0 - movs r3, 0xE - bl rfu_setRecvBuffer - movs r0, 0x3 - adds r1, r4, 0 - bl rfu_clearSlot -_0800EAE0: - lsrs r5, 1 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800EABC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EAB4 - - thumb_func_start sub_800EAFC -sub_800EAFC: @ 800EAFC - push {r4-r6,lr} - ldr r0, =gUnknown_03004140 - ldrb r5, [r0] - ldr r4, =gUnknown_03005000+0xC87 - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0x46 - bl rfu_UNI_setSendData - adds r0, r5, 0 - bl sub_800E87C - ldr r1, =0xfffff379 - adds r6, r4, r1 - adds r1, r4, 0 - adds r1, 0x53 - strb r0, [r1] - adds r4, 0x5B - strb r5, [r4] - movs r1, 0x1 - negs r1, r1 - adds r0, r5, 0 - bl sub_800E88C - movs r0, 0x1 - strb r0, [r6, 0xC] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EAFC - thumb_func_start sub_800EB44 sub_800EB44: @ 800EB44 push {r4-r6,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 4a8571ce7..3af74b51e 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -138,8 +138,9 @@ struct UnkRfuStruct_2 { /* 0x006 */ u8 filler_06[6]; /* 0x00c */ u8 unk_0c; /* 0x00d */ u8 playerCount; - /* 0x00e */ u8 filler_0e[0x3e]; - /* 0x04c */ u8 unk_4c[14 * 2]; + /* 0x00e */ u8 filler_0e[6]; + /* 0x014 */ u8 unk_14[4][14]; + /* 0x04c */ u8 unk_4c[2][14]; /* 0x068 */ u8 filler_68[4]; /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c; /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5]; @@ -151,12 +152,16 @@ struct UnkRfuStruct_2 { /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; /* 0xc3c */ u8 filler_c3c[2]; /* 0xc3e */ vu8 unk_c3e; - /* 0xc3f */ u8 unk_c3f[70 * 2]; - /* 0xccb */ u8 filler_ccb[16]; + /* 0xc3f */ u8 unk_c3f[70]; + /* 0xc85 */ u8 filler_c85[2]; + /* 0xc87 */ u8 unk_c87[70]; + /* 0xccb */ u8 filler_ccb[13]; + /* 0xccb */ u8 unk_cda; /* 0xcdb */ vu8 unk_cdb; /* 0xcdc */ u8 filler_cdc[2]; /* 0xcde */ u8 unk_cde[4]; - /* 0xce2 */ u8 filler_ce2[2]; + /* 0xce2 */ u8 unk_ce2; + /* 0xce2 */ u8 unk_ce3; /* 0xce4 */ u8 unk_ce4; /* 0xce5 */ u8 filler_ce5[15]; }; // size = 0xcf4 diff --git a/src/link_rfu.c b/src/link_rfu.c index 622dafe37..7ded13865 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2624,3 +2624,28 @@ void sub_800E94C(u8 taskId) } } } + +void sub_800EAB4(void) +{ + u8 i; + u8 r5 = gUnknown_03004140.unk_00; + for (i = 0; i < 4; i++) + { + if (r5 & 1) + { + rfu_setRecvBuffer(16, i, gUnknown_03005000.unk_14[i], 14); + rfu_clearSlot(3, i); + } + r5 >>= 1; + } +} + +void sub_800EAFC(void) +{ + u8 r5 = gUnknown_03004140.unk_00; + rfu_UNI_setSendData(r5, gUnknown_03005000.unk_c87, 70); + gUnknown_03005000.unk_cda = sub_800E87C(r5); + gUnknown_03005000.unk_ce2 = r5; + sub_800E88C(r5, -1); + gUnknown_03005000.unk_0c = 1; +} From 6441ba7832728de250c756f8b4d2956b94acac9a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 7 Dec 2017 20:04:07 -0500 Subject: [PATCH 098/123] sub_800EB44 --- asm/link_rfu.s | 170 --------------------------------------------- include/librfu.h | 2 +- include/link_rfu.h | 4 +- src/link_rfu.c | 65 +++++++++++++++++ 4 files changed, 69 insertions(+), 172 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 5a611409b..bcf91a559 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,176 +5,6 @@ .text - thumb_func_start sub_800EB44 -sub_800EB44: @ 800EB44 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x54 - bne _0800EB78 - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bne _0800EB78 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - movs r0, 0 - movs r1, 0 - bl sub_8011A64 -_0800EB78: - ldr r0, =gUnknown_03005000 - ldrh r2, [r0, 0x4] - adds r6, r0, 0 - cmp r2, 0x12 - bls _0800EB84 - b _0800ECF4 -_0800EB84: - lsls r0, r2, 2 - ldr r1, =_0800EB9C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0800EB9C: - .4byte _0800EBE8 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800ECF4 - .4byte _0800EC38 - .4byte _0800EC98 - .4byte _0800ECF4 - .4byte _0800ECAC - .4byte _0800EC10 - .4byte _0800ECF4 -_0800EBE8: - ldr r0, =gUnknown_02022B2C - bl sub_800BFCC - ldr r0, =gUnknown_03005000 - movs r2, 0x1 - strh r2, [r0, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0xA] - b _0800ECF4 - .pool -_0800EC10: - ldr r3, =gUnknown_082ED6E0 - movs r0, 0x2 - movs r1, 0 - movs r2, 0xF0 - bl sub_800C054 - ldr r0, =sub_800ED34 - bl sub_800D52C - ldr r1, =gUnknown_03005000 - movs r0, 0x12 - strh r0, [r1, 0x4] - b _0800ECF4 - .pool -_0800EC38: - ldr r1, =0x00000c3e - adds r0, r6, r1 - ldrb r1, [r0] - movs r0, 0x80 - lsls r0, 17 - lsls r0, r1 - lsrs r0, 24 - adds r1, r6, 0 - adds r1, 0x4C - movs r2, 0xE - bl rfu_UNI_setSendData - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0800ECF4 - strb r0, [r6, 0xC] - adds r0, r5, 0 - bl DestroyTask - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - movs r2, 0x16 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _0800EC88 - ldr r0, =sub_8010D0C - movs r1, 0x1 - bl CreateTask - b _0800ECF4 - .pool -_0800EC88: - ldr r0, =sub_801084C - movs r1, 0x5 - bl CreateTask - b _0800ECF4 - .pool -_0800EC98: - movs r0, 0 - bl sub_800C27C - ldr r1, =gUnknown_03005000 - movs r0, 0xF - strh r0, [r1, 0x4] - b _0800ECF4 - .pool -_0800ECAC: - ldr r0, =0x00000cdb - adds r1, r6, r0 - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r0, =sub_800EDBC - bl sub_800D52C - movs r0, 0x1 - bl sub_8011068 - bl sub_800EAB4 - bl sub_800EAFC - movs r0, 0x14 - strh r0, [r6, 0x4] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - strh r1, [r0, 0xA] - movs r4, 0x1 - strb r4, [r6, 0xC] - ldr r0, =sub_801084C - movs r1, 0x5 - bl CreateTask - ldr r1, =0x00000ce8 - adds r0, r6, r1 - strb r4, [r0] - adds r0, r5, 0 - bl DestroyTask -_0800ECF4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EB44 - thumb_func_start sub_800ED10 sub_800ED10: @ 800ED10 push {lr} diff --git a/include/librfu.h b/include/librfu.h index 71feb81bf..235e5c558 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -216,4 +216,4 @@ void rfu_NI_stopReceivingData(u8 who); u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterruptToRam); void rfu_setTimerInterrupt(u8 which, IntrFunc *intr); void rfu_setRecvBuffer(u8 a0, u8 a1, void *a2, size_t a3); -void rfu_UNI_setSendData(u8 flag, void *ptr, u8 size); +bool16 rfu_UNI_setSendData(u8 flag, void *ptr, u8 size); diff --git a/include/link_rfu.h b/include/link_rfu.h index 3af74b51e..865603ed8 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -163,7 +163,9 @@ struct UnkRfuStruct_2 { /* 0xce2 */ u8 unk_ce2; /* 0xce2 */ u8 unk_ce3; /* 0xce4 */ u8 unk_ce4; - /* 0xce5 */ u8 filler_ce5[15]; + /* 0xce5 */ u8 filler_ce5[3]; + /* 0xce8 */ u8 unk_ce8; + /* 0xce9 */ u8 filler_ce9[11]; }; // size = 0xcf4 // Exported RAM declarations diff --git a/src/link_rfu.c b/src/link_rfu.c index 7ded13865..8c75483be 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -51,6 +51,8 @@ bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); void sub_800EDBC(u16 a0); void sub_800EAB4(void); void sub_800EAFC(void); +void sub_800ED34(u16 a0); +struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void); void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); void sub_8010750(void); @@ -58,6 +60,8 @@ int sub_80107A0(void); void sub_801084C(u8 taskId); void sub_8010AAC(u8 taskId); void sub_8010D0C(u8 taskId); +void sub_8011068(u8 a0); +void sub_8011A64(u8 a0, u8 a1); u8 sub_8012224(void); void sub_801227C(void); @@ -2649,3 +2653,64 @@ void sub_800EAFC(void) sub_800E88C(r5, -1); gUnknown_03005000.unk_0c = 1; } + +void sub_800EB44(u8 taskId) +{ + if (sub_800F7DC()->unk_0a_0 == 0x54 && sub_8011A74() == 4) + { + rfu_REQ_disconnect(gUnknown_03004140.unk_00); + rfu_waitREQComplete(); + sub_8011A64(0, 0); + } + switch (gUnknown_03005000.unk_04) + { + case 0: + sub_800BFCC(&gUnknown_02022B2C); + gUnknown_03005000.unk_04 = 1; + gTasks[taskId].data[1] = 1; + break; + case 1: + break; + case 17: + sub_800C054(2, 0, 240, gUnknown_082ED6E0); + sub_800D52C(sub_800ED34); + gUnknown_03005000.unk_04 = 18; + break; + case 18: + break; + case 13: + if (rfu_UNI_setSendData(1 << gUnknown_03005000.unk_c3e, gUnknown_03005000.unk_4c, 14) == 0) + { + gUnknown_03005000.unk_0c = 0; + DestroyTask(taskId); + if (gTasks[taskId].data[7]) + { + CreateTask(sub_8010D0C, 1); + } + else + { + CreateTask(sub_801084C, 5); + } + } + break; + case 14: + sub_800C27C(0); + gUnknown_03005000.unk_04 = 15; + break; + case 15: + break; + case 16: + gUnknown_03005000.unk_cdb = 0; + sub_800D52C(sub_800EDBC); + sub_8011068(1); + sub_800EAB4(); + sub_800EAFC(); + gUnknown_03005000.unk_04 = 20; + gTasks[taskId].data[1] = 8; + gUnknown_03005000.unk_0c = 1; + CreateTask(sub_801084C, 5); + gUnknown_03005000.unk_ce8 = 1; + DestroyTask(taskId); + break; + } +} From abc3869eca632f22c805682696f3e4fdf5c82f8d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 7 Dec 2017 20:21:30 -0500 Subject: [PATCH 099/123] through sub_800EDBC --- asm/link_rfu.s | 91 ---------------------------------------------- include/librfu.h | 6 ++- include/link_rfu.h | 10 +++-- src/link_rfu.c | 50 ++++++++++++++++++++++--- 4 files changed, 56 insertions(+), 101 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index bcf91a559..b95a9e5c8 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,97 +5,6 @@ .text - thumb_func_start sub_800ED10 -sub_800ED10: @ 800ED10 - push {lr} - ldr r3, =gUnknown_082ED6E0 - movs r0, 0x1 - movs r1, 0 - movs r2, 0xF0 - bl sub_800C054 - pop {r0} - bx r0 - .pool - thumb_func_end sub_800ED10 - - thumb_func_start sub_800ED28 -sub_800ED28: @ 800ED28 - push {lr} - movs r0, 0 - bl sub_800C27C - pop {r0} - bx r0 - thumb_func_end sub_800ED28 - - thumb_func_start sub_800ED34 -sub_800ED34: @ 800ED34 - push {r4,lr} - ldr r0, =gUnknown_03005000 - movs r2, 0 - movs r1, 0xD - adds r0, 0x59 -_0800ED3E: - strb r2, [r0] - subs r0, 0x1 - subs r1, 0x1 - cmp r1, 0 - bge _0800ED3E - bl rfu_REQ_recvData - bl rfu_waitREQComplete - ldr r1, =gUnknown_03007870 - ldr r3, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r4, r3, r0 - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x12] - cmp r0, 0 - beq _0800ED9A - movs r2, 0xCD - lsls r2, 4 - adds r1, r3, r2 - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r1, 0x92 - lsls r1, 1 - adds r0, r3, r1 - ldr r2, =0x00000c3f - adds r1, r3, r2 - bl sub_800D7D8 - ldr r1, =gUnknown_02022B44 - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - bl sub_800F048 - ldrb r0, [r4] - bl rfu_UNI_readySendData - ldrb r0, [r4] - bl rfu_UNI_clearRecvNewDataFlag -_0800ED9A: - movs r0, 0x1 - bl rfu_REQ_sendData_wrapper - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800ED34 - - thumb_func_start sub_800EDBC -sub_800EDBC: @ 800EDBC - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cdb - adds r0, r1 - ldrb r1, [r0] - movs r1, 0x1 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_800EDBC - thumb_func_start sub_800EDD4 sub_800EDD4: @ 800EDD4 push {r4-r6,lr} diff --git a/include/librfu.h b/include/librfu.h index 235e5c558..29c1f9464 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -108,7 +108,8 @@ struct RfuUnk1 u16 unk_0; u8 unk_2; u8 unk_3; - u8 fill_4[0x10]; + u8 fill_4[14]; + u8 unk_12; u32 unk_14; u32 unk_18; struct RfuIntrStruct unk_1c; @@ -217,3 +218,6 @@ u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterr void rfu_setTimerInterrupt(u8 which, IntrFunc *intr); void rfu_setRecvBuffer(u8 a0, u8 a1, void *a2, size_t a3); bool16 rfu_UNI_setSendData(u8 flag, void *ptr, u8 size); +void rfu_REQ_recvData(void); +void rfu_UNI_readySendData(u8 a0); +void rfu_UNI_clearRecvNewDataFlag(u8 a0); diff --git a/include/link_rfu.h b/include/link_rfu.h index 865603ed8..641558444 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -42,7 +42,9 @@ struct UnkLinkRfuStruct_02022B2C struct UnkLinkRfuStruct_02022B44 { - u8 fill_00[15]; + u8 fill_00[6]; + u16 unk_06; + u8 fill_08[7]; u8 unk_0f; u8 fill_10[0xcc]; }; @@ -155,8 +157,10 @@ struct UnkRfuStruct_2 { /* 0xc3f */ u8 unk_c3f[70]; /* 0xc85 */ u8 filler_c85[2]; /* 0xc87 */ u8 unk_c87[70]; - /* 0xccb */ u8 filler_ccb[13]; - /* 0xccb */ u8 unk_cda; + /* 0xccb */ u8 filler_ccd[3]; + /* 0xcd0 */ vu8 unk_cd0; + /* 0xcd1 */ u8 filler_cd1[9]; + /* 0xcda */ u8 unk_cda; /* 0xcdb */ vu8 unk_cdb; /* 0xcdc */ u8 filler_cdc[2]; /* 0xcde */ u8 unk_cde[4]; diff --git a/src/link_rfu.c b/src/link_rfu.c index 8c75483be..4e86c81fb 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -48,10 +48,11 @@ static void sub_800D434(void); static void sub_800D610(void); void sub_800D630(void); bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); -void sub_800EDBC(u16 a0); -void sub_800EAB4(void); -void sub_800EAFC(void); -void sub_800ED34(u16 a0); +static void sub_800EAB4(void); +static void sub_800EAFC(void); +void sub_800ED34(u16 unused); +static void sub_800EDBC(u16 unused); +void sub_800F048(void); struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void); void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); @@ -2629,7 +2630,7 @@ void sub_800E94C(u8 taskId) } } -void sub_800EAB4(void) +static void sub_800EAB4(void) { u8 i; u8 r5 = gUnknown_03004140.unk_00; @@ -2644,7 +2645,7 @@ void sub_800EAB4(void) } } -void sub_800EAFC(void) +static void sub_800EAFC(void) { u8 r5 = gUnknown_03004140.unk_00; rfu_UNI_setSendData(r5, gUnknown_03005000.unk_c87, 70); @@ -2714,3 +2715,40 @@ void sub_800EB44(u8 taskId) break; } } + +void sub_800ED10(void) +{ + sub_800C054(1, 0, 240, gUnknown_082ED6E0); +} + +void sub_800ED28(void) +{ + sub_800C27C(FALSE); +} + +void sub_800ED34(u16 unused) +{ + int i; + + for (i = 0; i < 14; i++) + { + gUnknown_03005000.unk_4c[0][i] = 0; + } + rfu_REQ_recvData(); + rfu_waitREQComplete(); + if (gUnknown_03007870[gUnknown_03005000.unk_c3e]->unk_12) + { + gUnknown_03005000.unk_cd0++; + sub_800D7D8(&gUnknown_03005000.unk_124, gUnknown_03005000.unk_c3f); + gUnknown_02022B44.unk_06++; + sub_800F048(); + rfu_UNI_readySendData(gUnknown_03005000.unk_c3e); + rfu_UNI_clearRecvNewDataFlag(gUnknown_03005000.unk_c3e); + } + rfu_REQ_sendData_wrapper(1); +} + +static void sub_800EDBC(u16 unused) +{ + gUnknown_03005000.unk_cdb = 1; +} From 253b3c2fa5e5bf2be1190ae1423d3132b252caf7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 8 Dec 2017 08:24:54 -0500 Subject: [PATCH 100/123] sub_800EDD4 --- asm/link_rfu.s | 72 ---------------------------------------------- include/link_rfu.h | 4 ++- src/link_rfu.c | 40 +++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 74 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index b95a9e5c8..67a9d6225 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,78 +5,6 @@ .text - thumb_func_start sub_800EDD4 -sub_800EDD4: @ 800EDD4 - push {r4-r6,lr} - bl sub_800C048 - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - bne _0800EDF0 - ldr r0, =sub_800E748 - b _0800EDF6 - .pool -_0800EDF0: - cmp r0, 0 - bne _0800EE18 - ldr r0, =sub_800E94C -_0800EDF6: - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE38 - adds r0, r4, 0 - adds r0, 0x67 - ldrb r0, [r0] - bl DestroyTask - bl sub_800E604 - b _0800EE38 - .pool -_0800EE18: - cmp r0, 0x2 - bne _0800EE38 - ldr r0, =sub_800EB44 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE38 - adds r0, r4, 0 - adds r0, 0x67 - ldrb r0, [r0] - bl DestroyTask - bl sub_800E604 -_0800EE38: - movs r5, 0 - ldr r6, =gUnknown_082ED7E0 -_0800EE3C: - lsls r0, r5, 2 - adds r0, r6 - ldr r4, [r0] - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE5E - adds r0, r4, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0800EE5E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x2 - bls _0800EE3C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EDD4 - thumb_func_start sub_800EE78 sub_800EE78: @ 800EE78 push {lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 641558444..d2cb554fd 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -142,7 +142,9 @@ struct UnkRfuStruct_2 { /* 0x00d */ u8 playerCount; /* 0x00e */ u8 filler_0e[6]; /* 0x014 */ u8 unk_14[4][14]; - /* 0x04c */ u8 unk_4c[2][14]; + /* 0x04c */ u8 unk_4c[14]; + /* 0x05a */ u8 filler_5a[13]; + /* 0x067 */ u8 unk_67; /* 0x068 */ u8 filler_68[4]; /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c; /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5]; diff --git a/src/link_rfu.c b/src/link_rfu.c index 4e86c81fb..ef4614194 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2732,7 +2732,7 @@ void sub_800ED34(u16 unused) for (i = 0; i < 14; i++) { - gUnknown_03005000.unk_4c[0][i] = 0; + gUnknown_03005000.unk_4c[i] = 0; } rfu_REQ_recvData(); rfu_waitREQComplete(); @@ -2752,3 +2752,41 @@ static void sub_800EDBC(u16 unused) { gUnknown_03005000.unk_cdb = 1; } + +void sub_800EDD4(void) +{ + u8 i; + + sub_800C048(); + if (gUnknown_03005000.unk_0c == 1) + { + if (FuncIsActiveTask(sub_800E748) == TRUE) + { + DestroyTask(gUnknown_03005000.unk_67); + sub_800E604(); + } + } + else if (gUnknown_03005000.unk_0c == 0) + { + if (FuncIsActiveTask(sub_800E94C) == TRUE) + { + DestroyTask(gUnknown_03005000.unk_67); + sub_800E604(); + } + } + else if (gUnknown_03005000.unk_0c == 2) + { + if (FuncIsActiveTask(sub_800EB44) == TRUE) + { + DestroyTask(gUnknown_03005000.unk_67); + sub_800E604(); + } + } + for (i = 0; i < 3; i++) + { + if (FuncIsActiveTask(gUnknown_082ED7E0[i]) == TRUE) + { + DestroyTask(FindTaskIdByFunc(gUnknown_082ED7E0[i])); + } + } +} From beeb86be37f819bb03301dc118aa68495d5dc01a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 10 Dec 2017 10:23:43 -0500 Subject: [PATCH 101/123] through (nonmatching) sub_800EFB0 --- asm/link_rfu.s | 219 --------------------------------------------- include/link_rfu.h | 11 ++- src/link_rfu.c | 139 ++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 223 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 67a9d6225..1376732f5 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,225 +5,6 @@ .text - thumb_func_start sub_800EE78 -sub_800EE78: @ 800EE78 - push {lr} - ldr r0, =sub_800E748 - movs r1, 0x1 - bl CreateTask - ldr r1, =gUnknown_03005000 - adds r1, 0x67 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EE78 - - thumb_func_start sub_800EE94 -sub_800EE94: @ 800EE94 - push {lr} - ldr r1, =gUnknown_03005000 - ldrh r0, [r1, 0x4] - cmp r0, 0x7 - bne _0800EEB4 - ldr r2, =0x00000ccd - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800EEB4 - movs r0, 0x1 - b _0800EEB6 - .pool -_0800EEB4: - movs r0, 0 -_0800EEB6: - pop {r1} - bx r1 - thumb_func_end sub_800EE94 - - thumb_func_start sub_800EEBC -sub_800EEBC: @ 800EEBC - push {r4,lr} - ldr r4, =gUnknown_03005000 - ldrh r0, [r4, 0x4] - cmp r0, 0x7 - bne _0800EEF8 - ldr r0, =gUnknown_03007890 - ldr r1, [r0] - ldr r2, =0x00000c3d - adds r0, r4, r2 - ldrb r0, [r0] - lsls r0, 5 - adds r1, r0 - ldrh r0, [r1, 0x14] - movs r1, 0xF0 - bl sub_800C12C - lsls r0, 24 - cmp r0, 0 - bne _0800EEF8 - movs r0, 0x9 - strh r0, [r4, 0x4] - movs r0, 0x1 - b _0800EEFA - .pool -_0800EEF8: - movs r0, 0 -_0800EEFA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_800EEBC - - thumb_func_start sub_800EF00 -sub_800EF00: @ 800EF00 - push {lr} - ldr r0, =sub_800E94C - movs r1, 0x1 - bl CreateTask - ldr r1, =gUnknown_03005000 - adds r1, 0x67 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EF00 - - thumb_func_start sub_800EF1C -sub_800EF1C: @ 800EF1C - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - cmp r0, 0 - bne _0800EF30 - movs r0, 0 - b _0800EF32 - .pool -_0800EF30: - movs r0, 0x1 -_0800EF32: - pop {r1} - bx r1 - thumb_func_end sub_800EF1C - - thumb_func_start sub_800EF38 -sub_800EF38: @ 800EF38 - ldr r1, =gUnknown_03005000 - movs r0, 0x4 - strh r0, [r1, 0x4] - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - ldr r2, =0x00000ce7 - adds r1, r2 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_800EF38 - - thumb_func_start sub_800EF58 -sub_800EF58: @ 800EF58 - push {lr} - adds r1, r0, 0 - ldr r2, =gUnknown_03005000 - ldrh r0, [r2, 0x4] - cmp r0, 0x11 - beq _0800EF68 - cmp r1, 0 - beq _0800EF74 -_0800EF68: - movs r0, 0x12 - strh r0, [r2, 0x4] - movs r0, 0x1 - b _0800EF76 - .pool -_0800EF74: - movs r0, 0 -_0800EF76: - pop {r1} - bx r1 - thumb_func_end sub_800EF58 - - thumb_func_start sub_800EF7C -sub_800EF7C: @ 800EF7C - ldr r1, =gUnknown_03005000 - movs r0, 0xE - strh r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_800EF7C - - thumb_func_start sub_800EF88 -sub_800EF88: @ 800EF88 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - movs r2, 0 - b _0800EF9A -_0800EF92: - lsrs r1, 1 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_0800EF9A: - cmp r2, 0x3 - bhi _0800EFAC - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800EF92 - adds r0, r2, 0 - bl rfu_UNI_readySendData -_0800EFAC: - pop {r0} - bx r0 - thumb_func_end sub_800EF88 - - thumb_func_start sub_800EFB0 -sub_800EFB0: @ 800EFB0 - push {r4-r7,lr} - sub sp, 0x4 - movs r2, 0 - ldr r7, =gRecvCmds - ldr r0, =gUnknown_03005000 - adds r6, r7, 0 - ldr r1, =0x00000c87 - adds r5, r0, r1 -_0800EFC0: - movs r3, 0 - lsls r0, r2, 3 - lsls r1, r2, 4 - adds r4, r2, 0x1 - subs r0, r2 - lsls r0, 1 - adds r2, r0, r5 - adds r1, r6 -_0800EFD0: - ldrh r0, [r1] - lsrs r0, 8 - strb r0, [r2, 0x1] - ldrh r0, [r1] - strb r0, [r2] - adds r2, 0x2 - adds r1, 0x2 - adds r3, 0x1 - cmp r3, 0x6 - ble _0800EFD0 - adds r2, r4, 0 - cmp r2, 0x4 - ble _0800EFC0 - movs r0, 0 - mov r1, sp - strh r0, [r1] - ldr r2, =0x01000028 - mov r0, sp - adds r1, r7, 0 - bl CpuSet - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EFB0 - thumb_func_start sub_800F014 sub_800F014: @ 800F014 push {lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index d2cb554fd..957104197 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -154,12 +154,14 @@ struct UnkRfuStruct_2 { /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; - /* 0xc3c */ u8 filler_c3c[2]; + /* 0xc3c */ u8 unk_c3c; + /* 0xc3d */ u8 unk_c3d; /* 0xc3e */ vu8 unk_c3e; /* 0xc3f */ u8 unk_c3f[70]; /* 0xc85 */ u8 filler_c85[2]; - /* 0xc87 */ u8 unk_c87[70]; - /* 0xccb */ u8 filler_ccd[3]; + /* 0xc87 */ u8 unk_c87[5][7][2]; + /* 0xccd */ u8 unk_ccd; + /* 0xcce */ u8 filler_cce[2]; /* 0xcd0 */ vu8 unk_cd0; /* 0xcd1 */ u8 filler_cd1[9]; /* 0xcda */ u8 unk_cda; @@ -169,7 +171,8 @@ struct UnkRfuStruct_2 { /* 0xce2 */ u8 unk_ce2; /* 0xce2 */ u8 unk_ce3; /* 0xce4 */ u8 unk_ce4; - /* 0xce5 */ u8 filler_ce5[3]; + /* 0xce5 */ u8 filler_ce5[2]; + /* 0xce7 */ u8 unk_ce7; /* 0xce8 */ u8 unk_ce8; /* 0xce9 */ u8 filler_ce9[11]; }; // size = 0xcf4 diff --git a/src/link_rfu.c b/src/link_rfu.c index ef4614194..65998dbc6 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2790,3 +2790,142 @@ void sub_800EDD4(void) } } } + +void sub_800EE78(void) +{ + gUnknown_03005000.unk_67 = CreateTask(sub_800E748, 1); +} + +bool8 sub_800EE94(void) +{ + if (gUnknown_03005000.unk_04 == 7 && gUnknown_03005000.unk_ccd) + { + return TRUE; + } + return FALSE; +} + +bool8 sub_800EEBC(void) +{ + if (gUnknown_03005000.unk_04 == 7 && !sub_800C12C(gUnknown_03007890->unk_14[gUnknown_03005000.unk_c3d].unk_00, 240)) + { + gUnknown_03005000.unk_04 = 9; + return TRUE; + } + return FALSE; +} + +void sub_800EF00(void) +{ + gUnknown_03005000.unk_67 = CreateTask(sub_800E94C, 1); +} + +bool8 sub_800EF1C(void) +{ + if (gUnknown_03004140.unk_00) + { + return TRUE; + } + return FALSE; +} + +void sub_800EF38(void) +{ + gUnknown_03005000.unk_04 = 4; + gUnknown_03005000.unk_ce7 = gUnknown_03004140.unk_00; +} + +bool8 sub_800EF58(bool32 a0) +{ + if (gUnknown_03005000.unk_04 == 17 || a0) + { + gUnknown_03005000.unk_04 = 18; + return TRUE; + } + return FALSE; +} + +void sub_800EF7C(void) +{ + gUnknown_03005000.unk_04 = 14; +} + +void sub_800EF88(u8 a0) +{ + u8 i; + + for (i = 0; i < 4; i++) + { + if (a0 & 1) + { + rfu_UNI_readySendData(i); + break; + } + a0 >>= 1; + } +} + +#ifdef NONMATCHING +// FIXME: gUnknown_03005000.unk_c87 should be in r5 +// FIXME: gRecvCmds should be in r6 and r7 +void sub_800EFB0(void) +{ + int i, j; + for (i = 0; i < 5; i++) + { + for (j = 0; j < 7; j++) + { + gUnknown_03005000.unk_c87[i][j][1] = gRecvCmds[i][j] >> 8; + gUnknown_03005000.unk_c87[i][j][0] = gRecvCmds[i][j]; + } + } + CpuFill16(0, gRecvCmds, sizeof gRecvCmds); +} +#else +__attribute__((naked)) void sub_800EFB0(void) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tsub sp, 0x4\n" + "\tmovs r2, 0\n" + "\tldr r7, =gRecvCmds\n" + "\tldr r0, =gUnknown_03005000\n" + "\tadds r6, r7, 0\n" + "\tldr r1, =0x00000c87\n" + "\tadds r5, r0, r1\n" + "_0800EFC0:\n" + "\tmovs r3, 0\n" + "\tlsls r0, r2, 3\n" + "\tlsls r1, r2, 4\n" + "\tadds r4, r2, 0x1\n" + "\tsubs r0, r2\n" + "\tlsls r0, 1\n" + "\tadds r2, r0, r5\n" + "\tadds r1, r6\n" + "_0800EFD0:\n" + "\tldrh r0, [r1]\n" + "\tlsrs r0, 8\n" + "\tstrb r0, [r2, 0x1]\n" + "\tldrh r0, [r1]\n" + "\tstrb r0, [r2]\n" + "\tadds r2, 0x2\n" + "\tadds r1, 0x2\n" + "\tadds r3, 0x1\n" + "\tcmp r3, 0x6\n" + "\tble _0800EFD0\n" + "\tadds r2, r4, 0\n" + "\tcmp r2, 0x4\n" + "\tble _0800EFC0\n" + "\tmovs r0, 0\n" + "\tmov r1, sp\n" + "\tstrh r0, [r1]\n" + "\tldr r2, =0x01000028\n" + "\tmov r0, sp\n" + "\tadds r1, r7, 0\n" + "\tbl CpuSet\n" + "\tadd sp, 0x4\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.pool"); +} +#endif From b1c6f80e10ca18d18ca11091449a9969e2b9aa05 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 10 Dec 2017 10:31:11 -0500 Subject: [PATCH 102/123] through sub_800F048 --- asm/link_rfu.s | 79 ---------------------------------------------- include/link_rfu.h | 2 +- src/link_rfu.c | 36 ++++++++++++++++++++- 3 files changed, 36 insertions(+), 81 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 1376732f5..5a325f201 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,85 +5,6 @@ .text - thumb_func_start sub_800F014 -sub_800F014: @ 800F014 - push {lr} - ldr r3, =gSendCmd - ldr r2, =gRecvCmds - movs r1, 0x6 -_0800F01C: - ldrh r0, [r3] - strh r0, [r2] - adds r3, 0x2 - adds r2, 0x2 - subs r1, 0x1 - cmp r1, 0 - bge _0800F01C - ldr r1, =gSendCmd - movs r2, 0 - adds r0, r1, 0 - adds r0, 0xC -_0800F032: - strh r2, [r0] - subs r0, 0x2 - cmp r0, r1 - bge _0800F032 - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F014 - - thumb_func_start sub_800F048 -sub_800F048: @ 800F048 - push {r4,r5,lr} - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000c3c - adds r5, r4, r0 - ldrb r0, [r5] - cmp r0, 0 - beq _0800F07A - ldr r1, =0x00000c1c - adds r0, r4, r1 - adds r1, r4, 0 - adds r1, 0x4C - bl sub_800DAC8 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =0x00000c3a - adds r0, r4, r1 - ldrb r0, [r0] - adds r1, r0, 0 - cmp r1, 0 - bne _0800F076 - ldrb r0, [r5] - strb r1, [r5] -_0800F076: - cmp r2, 0 - bne _0800F09E -_0800F07A: - ldr r5, =gUnknown_03005000 - ldr r1, =0x00000c3c - adds r0, r5, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0800F09E - ldr r1, =0x000009e8 - adds r0, r5, r1 - adds r4, r5, 0 - adds r4, 0x4C - adds r1, r4, 0 - bl sub_800D9DC - ldr r1, =0x00000c1c - adds r0, r5, r1 - adds r1, r4, 0 - bl sub_800DA68 -_0800F09E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F048 - thumb_func_start sub_800F0B8 sub_800F0B8: @ 800F0B8 push {r4,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 957104197..f17becf10 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -154,7 +154,7 @@ struct UnkRfuStruct_2 { /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; - /* 0xc3c */ u8 unk_c3c; + /* 0xc3c */ vu8 unk_c3c; /* 0xc3d */ u8 unk_c3d; /* 0xc3e */ vu8 unk_c3e; /* 0xc3f */ u8 unk_c3f[70]; diff --git a/src/link_rfu.c b/src/link_rfu.c index 65998dbc6..be86684ec 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -52,7 +52,7 @@ static void sub_800EAB4(void); static void sub_800EAFC(void); void sub_800ED34(u16 unused); static void sub_800EDBC(u16 unused); -void sub_800F048(void); +static void sub_800F048(void); struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void); void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); @@ -2929,3 +2929,37 @@ __attribute__((naked)) void sub_800EFB0(void) "\t.pool"); } #endif + +void sub_800F014(void) +{ + int i; + for (i = 0; i < 7; i++) + { + gRecvCmds[0][i] = gSendCmd[i]; + } + for (i = 0; i < 7; i++) + { + gSendCmd[i] = 0; + } +} + +static void sub_800F048(void) +{ + if (gUnknown_03005000.unk_c3c) + { + u8 r2 = sub_800DAC8(&gUnknown_03005000.unk_c1c, gUnknown_03005000.unk_4c); + if (gUnknown_03005000.unk_c1c.unk_1e == 0) + { + gUnknown_03005000.unk_c3c = 0; + } + if (r2) + { + return; + } + } + if (gUnknown_03005000.unk_c3c == 0) + { + sub_800D9DC(&gUnknown_03005000.unk_9e8, gUnknown_03005000.unk_4c); + sub_800DA68(&gUnknown_03005000.unk_c1c, gUnknown_03005000.unk_4c); + } +} From 5b526906e1dc4b3dd55cc739670836718a90dff7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 16 Dec 2017 12:07:20 -0500 Subject: [PATCH 103/123] through sub_800F0F8 --- asm/link_rfu.s | 130 --------------------------------------------- include/librfu.h | 1 + include/link_rfu.h | 6 ++- src/link_rfu.c | 72 ++++++++++++++++++++++++- 4 files changed, 76 insertions(+), 133 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 5a325f201..ff7b2caa1 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,136 +5,6 @@ .text - thumb_func_start sub_800F0B8 -sub_800F0B8: @ 800F0B8 - push {r4,lr} - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0 - bne _0800F0CC -_0800F0C4: - movs r0, 0 - b _0800F0EC - .pool -_0800F0CC: - movs r3, 0 - ldr r4, =gRecvCmds -_0800F0D0: - movs r2, 0 - lsls r0, r3, 4 - adds r1, r0, r4 -_0800F0D6: - ldrh r0, [r1] - cmp r0, 0 - bne _0800F0C4 - adds r1, 0x2 - adds r2, 0x1 - cmp r2, 0x6 - ble _0800F0D6 - adds r3, 0x1 - cmp r3, 0x4 - ble _0800F0D0 - movs r0, 0x1 -_0800F0EC: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F0B8 - - thumb_func_start sub_800F0F8 -sub_800F0F8: @ 800F0F8 - push {r4-r6,lr} - ldr r6, =gUnknown_03005000 - ldrh r0, [r6, 0x4] - cmp r0, 0x13 - bhi _0800F118 - bl rfu_REQ_recvData - bl rfu_waitREQComplete - movs r0, 0 - bl rfu_REQ_sendData_wrapper - b _0800F1D2 - .pool -_0800F118: - ldr r0, =0x00000cdb - adds r1, r6, r0 - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r0, =0x00000ce2 - adds r1, r6, r0 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r1] - ldrb r0, [r0, 0x2] - ands r0, r1 - cmp r0, r1 - bne _0800F1D2 - cmp r0, 0 - beq _0800F1D2 - ldr r1, =0x00000cdc - adds r0, r6, r1 - ldrb r0, [r0] - adds r5, r0, 0 - cmp r5, 0 - bne _0800F1C8 - ldr r0, =0x00000ce3 - adds r4, r6, r0 - ldrb r0, [r4] - cmp r0, 0 - beq _0800F1A8 - bl sub_8011D6C - strb r5, [r4] - ldr r1, =0x00000ce4 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800F18C - movs r4, 0x80 - lsls r4, 8 - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 - adds r0, r4, 0 - bl sub_8011170 - b _0800F1D2 - .pool -_0800F18C: - ldr r0, =gUnknown_03004140 - ldrb r4, [r0] - cmp r4, 0 - bne _0800F1A8 - bl sub_800EDD4 - ldr r0, =gReceivedRemoteLinkPlayers - strb r4, [r0] - b _0800F1D2 - .pool -_0800F1A8: - bl sub_800EFB0 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cda - adds r0, r1 - ldrb r0, [r0] - bl rfu_UNI_readySendData - movs r0, 0x1 - bl rfu_REQ_sendData_wrapper - b _0800F1CC - .pool -_0800F1C8: - bl rfu_REQ_PARENT_resumeRetransmitAndChange -_0800F1CC: - ldr r1, =gUnknown_03005000 - movs r0, 0x1 - strb r0, [r1, 0xE] -_0800F1D2: - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F0F8 - thumb_func_start sub_800F1E0 sub_800F1E0: @ 800F1E0 push {r4-r7,lr} diff --git a/include/librfu.h b/include/librfu.h index 29c1f9464..9e1c2ff60 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -221,3 +221,4 @@ bool16 rfu_UNI_setSendData(u8 flag, void *ptr, u8 size); void rfu_REQ_recvData(void); void rfu_UNI_readySendData(u8 a0); void rfu_UNI_clearRecvNewDataFlag(u8 a0); +void rfu_REQ_PARENT_resumeRetransmitAndChange(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index f17becf10..278bb084c 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -140,7 +140,8 @@ struct UnkRfuStruct_2 { /* 0x006 */ u8 filler_06[6]; /* 0x00c */ u8 unk_0c; /* 0x00d */ u8 playerCount; - /* 0x00e */ u8 filler_0e[6]; + /* 0x00e */ u8 unk_0e; + /* 0x00f */ u8 filler_0f[5]; /* 0x014 */ u8 unk_14[4][14]; /* 0x04c */ u8 unk_4c[14]; /* 0x05a */ u8 filler_5a[13]; @@ -166,7 +167,8 @@ struct UnkRfuStruct_2 { /* 0xcd1 */ u8 filler_cd1[9]; /* 0xcda */ u8 unk_cda; /* 0xcdb */ vu8 unk_cdb; - /* 0xcdc */ u8 filler_cdc[2]; + /* 0xcdc */ vu8 unk_cdc; + /* 0xcdd */ u8 unk_cdd; /* 0xcde */ u8 unk_cde[4]; /* 0xce2 */ u8 unk_ce2; /* 0xce2 */ u8 unk_ce3; diff --git a/src/link_rfu.c b/src/link_rfu.c index 7ac380ddf..06fdbe207 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -62,7 +62,9 @@ void sub_801084C(u8 taskId); void sub_8010AAC(u8 taskId); void sub_8010D0C(u8 taskId); void sub_8011068(u8 a0); -void sub_8011A64(u8 a0, u8 a1); +void sub_8011170(u32 a0); +void sub_8011A64(u8 a0, u16 a1); +void sub_8011D6C(u8 a0); u8 sub_8012224(void); void sub_801227C(void); @@ -2963,3 +2965,71 @@ static void sub_800F048(void) sub_800DA68(&gUnknown_03005000.unk_c1c, gUnknown_03005000.unk_4c); } } + +bool32 sub_800F0B8(void) +{ + int i; + int j; + + if (gUnknown_03007890->unk_06 == 0) + { + return FALSE; + } + for (i = 0; i < 5; i++) + { + for (j = 0; j < 7; j++) + { + if (gRecvCmds[i][j] != 0) + { + return FALSE; + } + } + } + return TRUE; +} + +bool32 sub_800F0F8(void) +{ + if (gUnknown_03005000.unk_04 < 20) + { + rfu_REQ_recvData(); + rfu_waitREQComplete(); + rfu_REQ_sendData_wrapper(0); + } + else + { + gUnknown_03005000.unk_cdb = 0; + if ((gUnknown_03005000.unk_ce2 & gUnknown_03007890->unk_02) == gUnknown_03005000.unk_ce2 && (gUnknown_03005000.unk_ce2 & gUnknown_03007890->unk_02)) + { + if (!gUnknown_03005000.unk_cdc) + { + if (gUnknown_03005000.unk_ce3) + { + sub_8011D6C(gUnknown_03005000.unk_ce3); + gUnknown_03005000.unk_ce3 = 0; + if (gUnknown_03005000.unk_ce4 == 1) + { + sub_8011A64(2, 0x8000); + sub_8011170(0x8000); + return FALSE; + } + if (!gUnknown_03004140.unk_00) + { + sub_800EDD4(); + gReceivedRemoteLinkPlayers = 0; + return FALSE; + } + } + sub_800EFB0(); + rfu_UNI_readySendData(gUnknown_03005000.unk_cda); + rfu_REQ_sendData_wrapper(1); + } + else + { + rfu_REQ_PARENT_resumeRetransmitAndChange(); + } + gUnknown_03005000.unk_0e = 1; + } + } + return FALSE; +} From cfb0e233eebd172ce9131f4e4b940b18db6eb1d0 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 18 Jan 2018 08:46:17 -0500 Subject: [PATCH 104/123] sub_800F1E0 --- asm/link_rfu.s | 319 --------------------------------------------- include/link_rfu.h | 13 +- src/link_rfu.c | 90 +++++++++++++ 3 files changed, 99 insertions(+), 323 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index ff7b2caa1..72691fd6c 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,325 +5,6 @@ .text - thumb_func_start sub_800F1E0 -sub_800F1E0: @ 800F1E0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r0, =gUnknown_03005000 - ldrh r1, [r0, 0x4] - adds r6, r0, 0 - cmp r1, 0x13 - bhi _0800F1F8 - b _0800F45A -_0800F1F8: - ldrb r0, [r6, 0xE] - cmp r0, 0x1 - beq _0800F200 - b _0800F45A -_0800F200: - bl rfu_waitREQComplete - ldr r0, =0x00000cdb - adds r2, r6, r0 - ldrb r0, [r2] - cmp r0, 0 - bne _0800F220 - adds r1, r6, 0 - adds r1, 0xEE -_0800F212: - ldrb r0, [r1] - cmp r0, 0 - beq _0800F21A - b _0800F480 -_0800F21A: - ldrb r0, [r2] - cmp r0, 0 - beq _0800F212 -_0800F220: - bl rfu_REQ_recvData - bl rfu_waitREQComplete - ldr r2, =gUnknown_03004140 - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ce2 - adds r0, r4, r1 - ldrb r1, [r2, 0x3] - ldrb r0, [r0] - ands r1, r0 - cmp r1, r0 - beq _0800F23C - b _0800F444 -_0800F23C: - ldr r6, =0x00000cdc - adds r1, r4, r6 - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r1, =gUnknown_02022B44 - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - ldrb r7, [r2] - movs r5, 0 -_0800F252: - movs r0, 0x1 - ands r0, r7 - lsrs r1, r7, 1 - str r1, [sp, 0x4] - adds r2, r5, 0x1 - str r2, [sp] - cmp r0, 0 - bne _0800F264 - b _0800F364 -_0800F264: - ldr r1, =gUnknown_03005000 - lsls r2, r5, 3 - subs r0, r2, r5 - lsls r4, r0, 1 - adds r0, r1, 0 - adds r0, 0x15 - adds r0, r4, r0 - ldrb r0, [r0] - adds r6, r1, 0 - adds r3, r2, 0 - lsls r1, r5, 24 - mov r10, r1 - cmp r0, 0 - beq _0800F35C - ldr r2, =0x00000cee - adds r0, r6, r2 - adds r1, r5, r0 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0800F2E0 - adds r0, r6, 0 - adds r0, 0x14 - adds r0, r4, r0 - ldrb r2, [r0] - lsrs r2, 5 - ldrb r0, [r1] - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - cmp r2, r0 - beq _0800F2E0 - ldr r0, =0x00000cea - adds r1, r6, r0 - adds r1, r5, r1 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _0800F35C - movs r0, 0x81 - lsls r0, 8 - bl sub_8011170 - b _0800F35C - .pool -_0800F2E0: - ldr r2, =gUnknown_03005000 - ldr r6, =0x00000cee - adds r1, r2, r6 - adds r1, r5, r1 - subs r3, r5 - lsls r3, 1 - adds r4, r2, 0 - adds r4, 0x14 - adds r2, r3, r4 - ldrb r0, [r2] - lsrs r0, 5 - strb r0, [r1] - ldr r1, =gUnknown_03005000 - subs r6, 0x4 - adds r0, r1, r6 - adds r0, r5, r0 - movs r1, 0 - strb r1, [r0] - ldrb r1, [r2] - movs r0, 0x1F - ands r0, r1 - strb r0, [r2] - ldr r2, =gUnknown_03005000+0xCDE - adds r0, r5, r2 - ldrb r0, [r0] - movs r6, 0 - lsls r1, r5, 24 - mov r10, r1 - lsrs r2, r7, 1 - str r2, [sp, 0x4] - adds r5, 0x1 - str r5, [sp] - ldr r1, =gRecvCmds - mov r9, r1 - adds r5, r3, 0 - adds r7, r4, 0 - lsls r0, 4 - mov r8, r0 - adds r2, r5, 0x1 - mov r12, r2 -_0800F330: - lsls r1, r6, 1 - mov r0, r8 - adds r4, r1, r0 - add r4, r9 - mov r2, r12 - adds r3, r1, r2 - adds r3, r7 - ldrb r2, [r3] - lsls r2, 8 - adds r1, r5 - adds r1, r7 - ldrb r0, [r1] - orrs r0, r2 - strh r0, [r4] - movs r0, 0 - strb r0, [r3] - strb r0, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x6 - bls _0800F330 -_0800F35C: - mov r1, r10 - lsrs r0, r1, 24 - bl rfu_UNI_clearRecvNewDataFlag -_0800F364: - ldr r2, [sp, 0x4] - lsls r0, r2, 16 - lsrs r7, r0, 16 - ldr r6, [sp] - lsls r0, r6, 16 - lsrs r5, r0, 16 - cmp r5, 0x3 - bhi _0800F376 - b _0800F252 -_0800F376: - bl sub_800F014 - movs r0, 0 - bl sub_800F86C - bl sub_8010528 - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ce5 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0800F452 - ldr r2, =0x00000cd9 - adds r0, r4, r2 - ldrb r2, [r0] - cmp r2, 0 - bne _0800F452 - ldr r0, =gUnknown_02022B44 - ldrb r1, [r0, 0xE] - strb r2, [r0, 0xE] - ldr r6, =0x00000cda - adds r0, r4, r6 - ldrb r1, [r0] - movs r0, 0x3 - bl rfu_clearSlot - movs r5, 0 - adds r7, r4, 0 - adds r7, 0x14 -_0800F3B2: - ldr r0, =0x00000ce5 - adds r6, r4, r0 - ldrb r0, [r6] - asrs r0, r5 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800F3D6 - lsls r1, r5, 24 - lsrs r1, 24 - lsls r2, r5, 3 - subs r2, r5 - lsls r2, 1 - adds r2, r7 - movs r0, 0x10 - movs r3, 0xE - bl rfu_setRecvBuffer -_0800F3D6: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x3 - bls _0800F3B2 - subs r4, r6, 0x3 - ldrb r0, [r4] - ldrb r2, [r6] - adds r1, r0, 0 - orrs r1, r2 - bl sub_800E88C - ldrb r1, [r6] - movs r2, 0 - strb r1, [r6, 0x4] - ldrb r0, [r4] - orrs r0, r1 - strb r0, [r4] - strb r2, [r6] - ldrb r0, [r4] - adds r1, r6, 0 - subs r1, 0x5E - movs r2, 0x46 - bl rfu_UNI_setSendData - ldrb r0, [r4] - bl sub_800E87C - adds r1, r6, 0 - subs r1, 0xB - strb r0, [r1] - ldr r0, =sub_8010AAC - movs r1, 0 - bl CreateTask - b _0800F452 - .pool -_0800F444: - ldr r2, =0x00000cdc - adds r1, r4, r2 - ldrb r0, [r1] - movs r2, 0 - movs r0, 0x1 - strb r0, [r1] - strb r2, [r4, 0xE] -_0800F452: - ldr r1, =gUnknown_03005000 - movs r0, 0 - strb r0, [r1, 0xE] - adds r6, r1, 0 -_0800F45A: - ldr r1, =0x00000cdc - adds r0, r6, r1 - ldrb r0, [r0] - adds r1, r0, 0 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0 - beq _0800F484 - movs r0, 0x1 - ands r0, r1 - b _0800F486 - .pool -_0800F480: - movs r0, 0 - b _0800F486 -_0800F484: - movs r0, 0 -_0800F486: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_800F1E0 - thumb_func_start sub_800F498 sub_800F498: @ 800F498 push {r4,r5,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 278bb084c..d6f0b5b79 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -44,7 +44,8 @@ struct UnkLinkRfuStruct_02022B44 { u8 fill_00[6]; u16 unk_06; - u8 fill_08[7]; + u8 fill_08[6]; + vu8 unk_0e; u8 unk_0f; u8 fill_10[0xcc]; }; @@ -164,7 +165,8 @@ struct UnkRfuStruct_2 { /* 0xccd */ u8 unk_ccd; /* 0xcce */ u8 filler_cce[2]; /* 0xcd0 */ vu8 unk_cd0; - /* 0xcd1 */ u8 filler_cd1[9]; + /* 0xcd1 */ u8 filler_cd1[8]; + /* 0xcd9 */ u8 unk_cd9; /* 0xcda */ u8 unk_cda; /* 0xcdb */ vu8 unk_cdb; /* 0xcdc */ vu8 unk_cdc; @@ -173,10 +175,13 @@ struct UnkRfuStruct_2 { /* 0xce2 */ u8 unk_ce2; /* 0xce2 */ u8 unk_ce3; /* 0xce4 */ u8 unk_ce4; - /* 0xce5 */ u8 filler_ce5[2]; + /* 0xce5 */ u8 unk_ce5; + /* 0xce5 */ u8 unk_ce6; /* 0xce7 */ u8 unk_ce7; /* 0xce8 */ u8 unk_ce8; - /* 0xce9 */ u8 filler_ce9[11]; + /* 0xce9 */ u8 unk_ce9; + /* 0xcea */ u8 unk_cea[4]; + /* 0xcee */ u8 unk_cee[4]; }; // size = 0xcf4 // Exported RAM declarations diff --git a/src/link_rfu.c b/src/link_rfu.c index 06fdbe207..d5a789bed 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -54,8 +54,10 @@ void sub_800ED34(u16 unused); static void sub_800EDBC(u16 unused); static void sub_800F048(void); struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void); +void sub_800F86C(u8 a0); void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); bool32 sub_8010454(u16 a0); +void sub_8010528(void); void sub_8010750(void); int sub_80107A0(void); void sub_801084C(u8 taskId); @@ -3033,3 +3035,91 @@ bool32 sub_800F0F8(void) } return FALSE; } + +bool32 sub_800F1E0(void) +{ + u16 i; + u16 flags; + u8 r0; + u16 j; + u8 retval; + + if (gUnknown_03005000.unk_04 >= 20 && gUnknown_03005000.unk_0e == 1) + { + rfu_waitREQComplete(); + while (gUnknown_03005000.unk_cdb == 0) + { + if (gUnknown_03005000.unk_ee != 0) + { + return FALSE; + } + } + rfu_REQ_recvData(); + rfu_waitREQComplete(); + if ((gUnknown_03004140.unk_03 & gUnknown_03005000.unk_ce2) == gUnknown_03005000.unk_ce2) + { + gUnknown_03005000.unk_cdc = 0; + gUnknown_02022B44.unk_06++; + flags = gUnknown_03004140.unk_00; + for (i = 0; i < 4; i++) + { + if (flags & 1) + { + if (gUnknown_03005000.unk_14[i][1]) + { + if (gUnknown_03005000.unk_cee[i] != 0xff && (gUnknown_03005000.unk_14[i][0] >> 5) != ((gUnknown_03005000.unk_cee[i] + 1) & 7)) + { + if (++gUnknown_03005000.unk_cea[i] > 4) + sub_8011170(0x8100); + } + else + { + gUnknown_03005000.unk_cee[i] = gUnknown_03005000.unk_14[i][0] / 32; + gUnknown_03005000.unk_cea[i] = 0; + gUnknown_03005000.unk_14[i][0] &= 0x1f; + r0 = gUnknown_03005000.unk_cde[i]; + for (j = 0; j < 7; j++) + { + gRecvCmds[r0][j] = (gUnknown_03005000.unk_14[i][(j << 1) + 1] << 8) | gUnknown_03005000.unk_14[i][(j << 1) + 0]; + gUnknown_03005000.unk_14[i][(j << 1) + 1] = 0; + gUnknown_03005000.unk_14[i][(j << 1) + 0] = 0; + } + } + } + rfu_UNI_clearRecvNewDataFlag(i); + } + flags >>= 1; + } + sub_800F014(); + sub_800F86C(0); + sub_8010528(); + if (gUnknown_03005000.unk_ce5 && !gUnknown_03005000.unk_cd9) + { + gUnknown_02022B44.unk_0e = 0; + rfu_clearSlot(3, gUnknown_03005000.unk_cda); + for (i = 0; i < 4; i++) + { + if ((gUnknown_03005000.unk_ce5 >> i) & 1) + { + rfu_setRecvBuffer(0x10, i, gUnknown_03005000.unk_14[i], 14); + } + } + sub_800E88C(gUnknown_03005000.unk_ce2, gUnknown_03005000.unk_ce2 | gUnknown_03005000.unk_ce5); + gUnknown_03005000.unk_ce9 = gUnknown_03005000.unk_ce5; + gUnknown_03005000.unk_ce2 |= gUnknown_03005000.unk_ce5; + gUnknown_03005000.unk_ce5 = 0; + rfu_UNI_setSendData(gUnknown_03005000.unk_ce2, gUnknown_03005000.unk_c87, 70); + gUnknown_03005000.unk_cda = sub_800E87C(gUnknown_03005000.unk_ce2); + CreateTask(sub_8010AAC, 0); + } + } + else + { + gUnknown_03005000.unk_cdc = 1; + gUnknown_03005000.unk_0e = 0; + } + gUnknown_03005000.unk_0e = 0; + } + retval = gUnknown_03005000.unk_cdc; + return gUnknown_03007890->unk_06 ? retval & 1 : FALSE; +} From 090f70dd5b0983b761b08c04c8cfc9873738db52 Mon Sep 17 00:00:00 2001 From: scnorton Date: Thu, 18 Jan 2018 13:18:24 -0500 Subject: [PATCH 105/123] sub_800F498 --- asm/link_rfu.s | 50 ---------------------------------------------- include/link_rfu.h | 4 +++- src/link_rfu.c | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 51 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 72691fd6c..c88c29329 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,56 +5,6 @@ .text - thumb_func_start sub_800F498 -sub_800F498: @ 800F498 - push {r4,r5,lr} - adds r4, r0, 0 - adds r2, r1, 0 - ldrh r1, [r4] - cmp r1, 0 - beq _0800F4DC - ldr r0, =gUnknown_03005000 - movs r5, 0x81 - lsls r5, 1 - adds r3, r0, r5 - ldrb r0, [r3] - lsls r0, 5 - orrs r0, r1 - strh r0, [r4] - ldrb r0, [r3] - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - strb r0, [r3] - adds r3, r4, 0 - movs r4, 0x6 -_0800F4C2: - ldrh r1, [r3] - lsrs r0, r1, 8 - strb r0, [r2, 0x1] - strb r1, [r2] - adds r2, 0x2 - adds r3, 0x2 - subs r4, 0x1 - cmp r4, 0 - bge _0800F4C2 - b _0800F4EA - .pool -_0800F4DC: - movs r1, 0 - adds r0, r2, 0 - adds r0, 0xD -_0800F4E2: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r2 - bge _0800F4E2 -_0800F4EA: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_800F498 - thumb_func_start sub_800F4F0 sub_800F4F0: @ 800F4F0 push {r4-r7,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index d6f0b5b79..3cad90fc0 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -152,7 +152,9 @@ struct UnkRfuStruct_2 { /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5]; /* 0x0e4 */ u8 filler_e4[10]; /* 0x0ee */ vu8 unk_ee; - /* 0x0ef */ u8 filler_ef[0x35]; + /* 0x0ef */ u8 filler_ef[0x13]; + /* 0x102 */ u8 unk_102; + /* 0x103 */ u8 filler_103[0x21]; /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; diff --git a/src/link_rfu.c b/src/link_rfu.c index d5a789bed..6d6099188 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -3123,3 +3123,24 @@ bool32 sub_800F1E0(void) retval = gUnknown_03005000.unk_cdc; return gUnknown_03007890->unk_06 ? retval & 1 : FALSE; } + +void sub_800F498(u16 *a0, u8 *a1) +{ + int i; + + if (a0[0]) + { + a0[0] |= (gUnknown_03005000.unk_102 << 5); + gUnknown_03005000.unk_102 = (gUnknown_03005000.unk_102 + 1) & 7; + for (i = 0; i < 7; i++) + { + a1[2 * i + 1] = a0[i] >> 8; + a1[2 * i + 0] = a0[i]; + } + } + else + { + for (i = 0; i < 14; i++) + a1[i] = 0; + } +} From 68e9b5719c36f3bbbd807a2139e35d2c4207395d Mon Sep 17 00:00:00 2001 From: scnorton Date: Thu, 18 Jan 2018 17:38:51 -0500 Subject: [PATCH 106/123] sub_800F4F0 --- asm/link_rfu.s | 145 --------------------------------------------- include/librfu.h | 1 + include/link_rfu.h | 2 +- src/link_rfu.c | 47 +++++++++++++++ 4 files changed, 49 insertions(+), 146 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index c88c29329..da233b86b 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,151 +5,6 @@ .text - thumb_func_start sub_800F4F0 -sub_800F4F0: @ 800F4F0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x58 - ldr r0, =gUnknown_03005000+0x124 - mov r1, sp - bl sub_800D934 - movs r1, 0 - ldr r0, =gRecvCmds - mov r12, r0 -_0800F506: - movs r4, 0 - lsls r0, r1, 3 - adds r2, r1, 0x1 - mov r8, r2 - lsls r6, r1, 4 - subs r0, r1 - lsls r5, r0, 1 -_0800F514: - lsls r1, r4, 1 - adds r3, r1, r6 - add r3, r12 - adds r1, r5, r1 - adds r0, r1, 0x1 - add r0, sp - ldrb r2, [r0] - lsls r2, 8 - mov r7, sp - adds r0, r7, r1 - ldrb r0, [r0] - orrs r0, r2 - strh r0, [r3] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bls _0800F514 - mov r1, r8 - lsls r0, r1, 24 - lsrs r1, r0, 24 - cmp r1, 0x4 - bls _0800F506 - movs r0, 0 - bl sub_800F86C - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x2] - cmp r0, 0 - bne _0800F5C0 - ldr r0, =gUnknown_03005000 - ldr r2, =0x00000ce4 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _0800F5C0 - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - bl sub_8011A74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0800F58C - cmp r0, 0x6 - beq _0800F58C - cmp r0, 0x9 - beq _0800F58C - movs r1, 0x90 - lsls r1, 8 - movs r0, 0x2 - bl sub_8011A64 -_0800F58C: - bl rfu_clearAllSlot - ldr r1, =gReceivedRemoteLinkPlayers - movs r0, 0 - strb r0, [r1] - ldr r0, =gUnknown_03005000 - movs r5, 0 - str r5, [r0] - ldr r7, =0x00000ce4 - adds r6, r0, r7 - ldrb r0, [r6] - cmp r0, 0x1 - bne _0800F5B8 - movs r4, 0x90 - lsls r4, 8 - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 - adds r0, r4, 0 - bl sub_8011170 -_0800F5B8: - ldr r0, =gUnknown_03004140 - strb r5, [r0, 0x5] - strb r5, [r0, 0x4] - strb r5, [r6] -_0800F5C0: - ldr r6, =gUnknown_03005000 - movs r0, 0xCD - lsls r0, 4 - adds r2, r6, r0 - ldrb r0, [r2] - cmp r0, 0 - beq _0800F604 - ldrb r0, [r2] - subs r0, 0x1 - ldrb r1, [r2] - strb r0, [r2] - bl sub_8010528 - ldr r5, =gSendCmd - add r4, sp, 0x48 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_800F498 - ldr r1, =0x000009e8 - adds r0, r6, r1 - adds r1, r4, 0 - bl sub_800D888 - movs r1, 0 - movs r2, 0 -_0800F5F4: - lsls r0, r1, 1 - adds r0, r5 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x6 - bls _0800F5F4 -_0800F604: - bl sub_800F0B8 - add sp, 0x58 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F4F0 - thumb_func_start sub_800F638 sub_800F638: @ 800F638 push {r4-r7,lr} diff --git a/include/librfu.h b/include/librfu.h index 9e1c2ff60..88cbe2d3d 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -208,6 +208,7 @@ void rfu_getRFUStatus(u8 *status); u8 *rfu_getSTWIRecvBuffer(void); u8 rfu_NI_CHILD_setSendGameName(u8 a0, u8 a1); void rfu_clearSlot(u8 a0, u8 a1); +void rfu_clearAllSlot(void); bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status); bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1); bool16 rfu_UNI_PARENT_getDRAC_ACK(u8 *a0); diff --git a/include/link_rfu.h b/include/link_rfu.h index 3cad90fc0..80d2689ed 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -136,7 +136,7 @@ struct UnkRfuStruct_Sub_Unused { }; struct UnkRfuStruct_2 { - /* 0x000 */ u8 filler_00[4]; + /* 0x000 */ u32 unk_00; /* 0x004 */ u16 unk_04; /* 0x006 */ u8 filler_06[6]; /* 0x00c */ u8 unk_0c; diff --git a/src/link_rfu.c b/src/link_rfu.c index 6d6099188..f8a978e1f 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -3144,3 +3144,50 @@ void sub_800F498(u16 *a0, u8 *a1) a1[i] = 0; } } + +bool32 sub_800F4F0(void) +{ + u8 i; + u8 j; + u8 sp00[MAX_RFU_PLAYERS * (2 * (CMD_LENGTH - 1))]; + u8 sp48[2 * (CMD_LENGTH - 1)]; + u8 switchval; + + sub_800D934(&gUnknown_03005000.unk_124, sp00); + for (i = 0; i < MAX_RFU_PLAYERS; i++) + { + for (j = 0; j < CMD_LENGTH - 1; j++) + { + gRecvCmds[i][j] = (sp00[i * 14 + (j << 1) + 1] << 8) | sp00[i * 14 + (j << 1) + 0]; + } + } + sub_800F86C(0); + if (gUnknown_03004140.unk_02 == 0 && gUnknown_03005000.unk_ce4) + { + rfu_REQ_disconnect(gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03); + rfu_waitREQComplete(); + switchval = sub_8011A74(); + if (switchval != 1 && switchval != 6 && switchval != 9) + sub_8011A64(2, 0x9000); + rfu_clearAllSlot(); + gReceivedRemoteLinkPlayers = FALSE; + gUnknown_03005000.unk_00 = 0; + if (gUnknown_03005000.unk_ce4 == 1) + { + sub_8011A64(2, 0x9000); + sub_8011170(0x9000); + } + gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0; + gUnknown_03005000.unk_ce4 = 0; + } + if (gUnknown_03005000.unk_cd0) + { + gUnknown_03005000.unk_cd0--; + sub_8010528(); + sub_800F498(gSendCmd, sp48); + sub_800D888(&gUnknown_03005000.unk_9e8, sp48); + for (i = 0; i < CMD_LENGTH - 1; i++) + gSendCmd[i] = 0; + } + return sub_800F0B8(); +} From 58def21c6299f05c702d613bdcc9086058586539 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 18 Jan 2018 19:23:12 -0500 Subject: [PATCH 107/123] nonmatching sub_800F638 --- asm/link_rfu.s | 94 ---------------------------------- include/link_rfu.h | 4 +- src/link_rfu.c | 125 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 96 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index da233b86b..baddaf055 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,100 +5,6 @@ .text - thumb_func_start sub_800F638 -sub_800F638: @ 800F638 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_03005000 - ldr r2, [r0, 0x70] - mov r10, r2 - movs r5, 0 - adds r2, r0, 0 - adds r2, 0x6E - ldrh r3, [r2] - cmp r5, r3 - bge _0800F6D4 - mov r9, r0 - ldr r0, =gUnknown_03000D90 - mov r8, r0 -_0800F65A: - movs r0, 0x1 - ands r0, r1 - lsrs r7, r1, 1 - adds r6, r5, 0x1 - cmp r0, 0 - bne _0800F6C8 - ldr r1, =0xffff8900 - adds r0, r1, 0 - adds r1, r5, 0 - orrs r1, r0 - mov r2, r8 - strh r1, [r2] - movs r4, 0 - lsls r0, r5, 1 - ldr r3, =gUnknown_03000D80 - mov r12, r3 - adds r0, r5 - lsls r0, 2 - mov r1, r10 - adds r2, r0, r1 - mov r3, r8 - adds r3, 0x2 -_0800F686: - ldrb r1, [r2, 0x1] - lsls r1, 8 - ldrb r0, [r2] - orrs r0, r1 - strh r0, [r3] - adds r2, 0x2 - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x6 - ble _0800F686 - movs r4, 0 - ldr r2, =gUnknown_03000D90 - ldr r1, =gUnknown_03000D80 -_0800F6A0: - ldrh r0, [r2] - lsrs r0, 8 - strb r0, [r1, 0x1] - ldrh r0, [r2] - strb r0, [r1] - adds r2, 0x2 - adds r1, 0x2 - adds r4, 0x1 - cmp r4, 0x6 - ble _0800F6A0 - ldr r0, =gUnknown_03005000+0x9E8 - mov r1, r12 - bl sub_800D888 - movs r1, 0x1 - lsls r1, r5 - mov r2, r9 - ldr r0, [r2, 0x78] - orrs r0, r1 - str r0, [r2, 0x78] -_0800F6C8: - adds r1, r7, 0 - adds r5, r6, 0 - ldr r3, =gUnknown_03005000+0x6E - ldrh r3, [r3] - cmp r5, r3 - blt _0800F65A -_0800F6D4: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F638 - thumb_func_start sub_800F6FC sub_800F6FC: @ 800F6FC push {lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 80d2689ed..6e8346a88 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -96,9 +96,9 @@ struct UnkRfuStruct_1 { struct UnkRfuStruct_2_Sub_6c { /* 0x00 */ u16 unk_00; /* 0x02 */ u16 unk_02; - /* 0x04 */ u32 unk_04; + /* 0x04 */ u8 *unk_04; /* 0x08 */ u32 unk_08; - /* 0x0c */ u8 filler_0c[4]; + /* 0x0c */ u32 unk_0c; /* 0x10 */ u8 unk_10; /* 0x11 */ u8 unk_11; /* 0x12 */ u8 unk_12; diff --git a/src/link_rfu.c b/src/link_rfu.c index f8a978e1f..10a6a7914 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -3191,3 +3191,128 @@ bool32 sub_800F4F0(void) } return sub_800F0B8(); } + +#ifdef NONMATCHING +void sub_800F638(u8 unused, u32 flags) +{ + int i; + int j; + + u8 *r10 = gUnknown_03005000.unk_6c.unk_04; + for (i = 0; i < gUnknown_03005000.unk_6c.unk_02; i++) + { + if (!(flags & 1)) + { + gUnknown_03000D90[0] = (~0x76ff) | i; + for (j = 0; j < 7; j++) + { + gUnknown_03000D90[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0]; + } + for (j = 0; j < 7; j++) + // This should be an ascending loop. + // GCC compiles this as descending. + { + gUnknown_03000D80[2 * j + 1] = gUnknown_03000D90[j] >> 8; + gUnknown_03000D80[2 * j + 0] = gUnknown_03000D90[j]; + } + sub_800D888(&gUnknown_03005000.unk_9e8, gUnknown_03000D80); + gUnknown_03005000.unk_6c.unk_0c |= (1 << i); + } + flags >>= 1; + } +} +#else +__attribute__((naked)) void sub_800F638(u8 unused, u32 flags) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tldr r0, =gUnknown_03005000\n" + "\tldr r2, [r0, 0x70]\n" + "\tmov r10, r2\n" + "\tmovs r5, 0\n" + "\tadds r2, r0, 0\n" + "\tadds r2, 0x6E\n" + "\tldrh r3, [r2]\n" + "\tcmp r5, r3\n" + "\tbge _0800F6D4\n" + "\tmov r9, r0\n" + "\tldr r0, =gUnknown_03000D90\n" + "\tmov r8, r0\n" + "_0800F65A:\n" + "\tmovs r0, 0x1\n" + "\tands r0, r1\n" + "\tlsrs r7, r1, 1\n" + "\tadds r6, r5, 0x1\n" + "\tcmp r0, 0\n" + "\tbne _0800F6C8\n" + "\tldr r1, =0xffff8900\n" + "\tadds r0, r1, 0\n" + "\tadds r1, r5, 0\n" + "\torrs r1, r0\n" + "\tmov r2, r8\n" + "\tstrh r1, [r2]\n" + "\tmovs r4, 0\n" + "\tlsls r0, r5, 1\n" + "\tldr r3, =gUnknown_03000D80\n" + "\tmov r12, r3\n" + "\tadds r0, r5\n" + "\tlsls r0, 2\n" + "\tmov r1, r10\n" + "\tadds r2, r0, r1\n" + "\tmov r3, r8\n" + "\tadds r3, 0x2\n" + "_0800F686:\n" + "\tldrb r1, [r2, 0x1]\n" + "\tlsls r1, 8\n" + "\tldrb r0, [r2]\n" + "\torrs r0, r1\n" + "\tstrh r0, [r3]\n" + "\tadds r2, 0x2\n" + "\tadds r3, 0x2\n" + "\tadds r4, 0x1\n" + "\tcmp r4, 0x6\n" + "\tble _0800F686\n" + "\tmovs r4, 0\n" + "\tldr r2, =gUnknown_03000D90\n" + "\tldr r1, =gUnknown_03000D80\n" + "_0800F6A0:\n" + "\tldrh r0, [r2]\n" + "\tlsrs r0, 8\n" + "\tstrb r0, [r1, 0x1]\n" + "\tldrh r0, [r2]\n" + "\tstrb r0, [r1]\n" + "\tadds r2, 0x2\n" + "\tadds r1, 0x2\n" + "\tadds r4, 0x1\n" + "\tcmp r4, 0x6\n" + "\tble _0800F6A0\n" + "\tldr r0, =gUnknown_03005000+0x9E8\n" + "\tmov r1, r12\n" + "\tbl sub_800D888\n" + "\tmovs r1, 0x1\n" + "\tlsls r1, r5\n" + "\tmov r2, r9\n" + "\tldr r0, [r2, 0x78]\n" + "\torrs r0, r1\n" + "\tstr r0, [r2, 0x78]\n" + "_0800F6C8:\n" + "\tadds r1, r7, 0\n" + "\tadds r5, r6, 0\n" + "\tldr r3, =gUnknown_03005000+0x6E\n" + "\tldrh r3, [r3]\n" + "\tcmp r5, r3\n" + "\tblt _0800F65A\n" + "_0800F6D4:\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 From c383d490ad249f8496f42cb6b8a10d74957053ef Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 19 Jan 2018 19:13:45 -0500 Subject: [PATCH 108/123] through sub_800F850 --- asm/link_rfu.s | 196 --------------------------------------------- include/link.h | 1 + include/link_rfu.h | 7 +- src/link_rfu.c | 74 +++++++++++++++++ 4 files changed, 80 insertions(+), 198 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index baddaf055..1a6091803 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,202 +5,6 @@ .text - thumb_func_start sub_800F6FC -sub_800F6FC: @ 800F6FC - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_03005000 - ldrb r2, [r0, 0xC] - cmp r2, 0x1 - bne _0800F71C - cmp r1, 0 - beq _0800F71C - adds r0, 0x61 - adds r0, r1, r0 - strb r2, [r0] - b _0800F724 - .pool -_0800F71C: - adds r0, 0x5C - adds r0, r1, r0 - movs r1, 0x1 - strb r1, [r0] -_0800F724: - pop {r0} - bx r0 - thumb_func_end sub_800F6FC - - thumb_func_start sub_800F728 -sub_800F728: @ 800F728 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gUnknown_03005000 - adds r1, r3, 0 - adds r1, 0x5C - adds r1, r0, r1 - movs r2, 0 - strb r2, [r1] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - adds r1, 0x92 - strb r2, [r1] - bx lr - .pool - thumb_func_end sub_800F728 - - thumb_func_start sub_800F74C -sub_800F74C: @ 800F74C - push {r4,r5,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_03005000 - ldrb r1, [r0, 0xC] - adds r5, r0, 0 - cmp r1, 0x1 - bne _0800F764 - movs r0, 0 - b _0800F786 - .pool -_0800F764: - movs r2, 0 - ldr r0, =0x00000cde - adds r4, r5, r0 -_0800F76A: - adds r1, r2, r4 - adds r0, r3, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _0800F76A - ldr r1, =0x00000c3e - adds r0, r5, r1 - ldrb r0, [r0] - adds r0, r3 - ldrb r0, [r0] -_0800F786: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F74C - - thumb_func_start rfu_func_080F97B8 -rfu_func_080F97B8: @ 800F794 - push {lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0800F7C6 - ldr r3, =gUnknown_03005DA8 - ldrh r2, [r3] - cmp r2, 0 - beq _0800F7C6 - ldr r0, =gLinkTransferringData - ldrb r0, [r0] - cmp r0, 0x1 - beq _0800F7C6 - ldr r1, =gUnknown_03000D78 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldrb r0, [r1] - lsls r0, 8 - orrs r0, r2 - strh r0, [r3] - movs r0, 0xBE - lsls r0, 8 - bl sub_800FD14 -_0800F7C6: - pop {r0} - bx r0 - .pool - thumb_func_end rfu_func_080F97B8 - - thumb_func_start sub_800F7DC -sub_800F7DC: @ 800F7DC - ldr r0, =gUnknown_02022B14 - bx lr - .pool - thumb_func_end sub_800F7DC - - thumb_func_start sub_800F7E4 -sub_800F7E4: @ 800F7E4 - push {lr} - movs r2, 0 - ldr r0, =gUnknown_03005000 - ldr r1, [r0] - ldr r0, =rfu_func_080F97B8 - cmp r1, r0 - bne _0800F7F4 - movs r2, 0x1 -_0800F7F4: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_800F7E4 - - thumb_func_start sub_800F804 -sub_800F804: @ 800F804 - ldr r1, =gUnknown_03005000 - ldr r0, =rfu_func_080F97B8 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_800F804 - - thumb_func_start Rfu_set_zero -Rfu_set_zero: @ 800F814 - ldr r1, =gUnknown_03005000 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end Rfu_set_zero - - thumb_func_start sub_800F820 -sub_800F820: @ 800F820 - push {lr} - movs r0, 0x88 - lsls r0, 7 - bl sub_800FD14 - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0800F83C - bl GetBlenderArrowPosition - ldr r1, =gSendCmd - strh r0, [r1, 0xC] -_0800F83C: - ldr r1, =gUnknown_020223C0 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F820 - - thumb_func_start sub_800F850 -sub_800F850: @ 800F850 - push {lr} - ldr r1, =gUnknown_03005000 - ldr r0, [r1] - cmp r0, 0 - bne _0800F85E - ldr r0, =sub_800F820 - str r0, [r1] -_0800F85E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800F850 - thumb_func_start sub_800F86C sub_800F86C: @ 800F86C push {r4-r7,lr} diff --git a/include/link.h b/include/link.h index c01f24d27..918a7480b 100644 --- a/include/link.h +++ b/include/link.h @@ -195,6 +195,7 @@ extern struct LinkPlayer gLinkPlayers[5]; extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; extern bool8 gWirelessCommType; +extern u32 gUnknown_020223C0; void Task_DestroySelf(u8); void OpenLink(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index 6e8346a88..144a863b5 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -136,7 +136,7 @@ struct UnkRfuStruct_Sub_Unused { }; struct UnkRfuStruct_2 { - /* 0x000 */ u32 unk_00; + /* 0x000 */ void (*unk_00)(void); /* 0x004 */ u16 unk_04; /* 0x006 */ u8 filler_06[6]; /* 0x00c */ u8 unk_0c; @@ -145,7 +145,10 @@ struct UnkRfuStruct_2 { /* 0x00f */ u8 filler_0f[5]; /* 0x014 */ u8 unk_14[4][14]; /* 0x04c */ u8 unk_4c[14]; - /* 0x05a */ u8 filler_5a[13]; + /* 0x05a */ u8 filler_5a[2]; + /* 0x05c */ u8 unk_5c[5]; + /* 0x061 */ u8 unk_61[5]; + /* 0x066 */ u8 unk_66; /* 0x067 */ u8 unk_67; /* 0x068 */ u8 filler_68[4]; /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c; diff --git a/src/link_rfu.c b/src/link_rfu.c index 10a6a7914..2fe991c41 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2,12 +2,14 @@ // Includes #include "global.h" #include "malloc.h" +#include "berry_blender.h" #include "task.h" #include "random.h" #include "decompress.h" #include "text.h" #include "string_util.h" #include "event_data.h" +#include "overworld.h" #include "link.h" #include "librfu.h" #include "link_rfu.h" @@ -56,6 +58,7 @@ static void sub_800F048(void); struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void); void sub_800F86C(u8 a0); void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); +void sub_800FD14(u16 a0); bool32 sub_8010454(u16 a0); void sub_8010528(void); void sub_8010750(void); @@ -3316,3 +3319,74 @@ __attribute__((naked)) void sub_800F638(u8 unused, u32 flags) "\t.pool"); } #endif + +void sub_800F6FC(u8 a0) +{ + if (gUnknown_03005000.unk_0c == 1 && a0) + gUnknown_03005000.unk_61[a0] = 1; + else + gUnknown_03005000.unk_5c[a0] = 1; +} + +void sub_800F728(u8 a0) +{ + gUnknown_03005000.unk_5c[a0] = 0; + gUnknown_03005000.unk_80[a0].unk_12 = 0; +} + +u8 sub_800F74C(const u8 *a0) +{ + u8 i; + + if (gUnknown_03005000.unk_0c == 1) + return FALSE; + for (i = 0; i < 4; i++) + { + gUnknown_03005000.unk_cde[i] = a0[i]; + } + return a0[gUnknown_03005000.unk_c3e]; +} + +void rfu_func_080F97B8(void) +{ + if (gReceivedRemoteLinkPlayers && gUnknown_03005DA8 && gLinkTransferringData != 1) + { + gUnknown_03000D78[0]++; + gUnknown_03005DA8 |= (gUnknown_03000D78[0] << 8); + sub_800FD14(0xbe00); + } +} + +struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void) +{ + return &gUnknown_02022B14; +} + +bool32 sub_800F7E4(void) +{ + return gUnknown_03005000.unk_00 == rfu_func_080F97B8; +} + +void sub_800F804(void) +{ + gUnknown_03005000.unk_00 = rfu_func_080F97B8; +} + +void Rfu_set_zero(void) +{ + gUnknown_03005000.unk_00 = NULL; +} + +void sub_800F820(void) +{ + sub_800FD14(0x4400); + if (GetMultiplayerId() == 0) + gSendCmd[6] = GetBlenderArrowPosition(); + gUnknown_020223C0++; +} + +void sub_800F850(void) +{ + if (gUnknown_03005000.unk_00 == NULL) + gUnknown_03005000.unk_00 = sub_800F820; +} From 1c15b896a8cd40cd55cbcaa17d6893cfadfa4405 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 19 Jan 2018 21:50:30 -0500 Subject: [PATCH 109/123] sub_800F86C --- asm/link_rfu.s | 462 --------------------------------------------- include/link_rfu.h | 9 +- src/link_rfu.c | 110 ++++++++++- 3 files changed, 115 insertions(+), 466 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 1a6091803..2247baf0d 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,468 +5,6 @@ .text - thumb_func_start sub_800F86C -sub_800F86C: @ 800F86C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r8, r0 -_0800F87A: - mov r1, r8 - lsls r0, r1, 4 - ldr r2, =gRecvCmds - adds r1, r0, r2 - ldrh r7, [r1] - movs r3, 0xFF - lsls r3, 8 - adds r1, r3, 0 - ands r1, r7 - movs r2, 0x88 - lsls r2, 8 - adds r5, r0, 0 - cmp r1, r2 - beq _0800F960 - cmp r1, r2 - bgt _0800F8D6 - movs r0, 0xCC - lsls r0, 7 - cmp r1, r0 - bne _0800F8A4 - b _0800FAE0 -_0800F8A4: - cmp r1, r0 - bgt _0800F8C4 - movs r0, 0x88 - lsls r0, 7 - cmp r1, r0 - bne _0800F8B2 - b _0800FBF4 -_0800F8B2: - movs r0, 0xBE - lsls r0, 7 - cmp r1, r0 - bne _0800F8BC - b _0800FAD0 -_0800F8BC: - b _0800FC04 - .pool -_0800F8C4: - movs r0, 0xEE - lsls r0, 7 - cmp r1, r0 - beq _0800F920 - movs r0, 0xF0 - lsls r0, 7 - cmp r1, r0 - beq _0800F90E - b _0800FC04 -_0800F8D6: - movs r0, 0xBE - lsls r0, 8 - cmp r1, r0 - bne _0800F8E0 - b _0800FBF4 -_0800F8E0: - cmp r1, r0 - bgt _0800F8F8 - movs r0, 0x89 - lsls r0, 8 - cmp r1, r0 - beq _0800F9C8 - movs r0, 0xA1 - lsls r0, 8 - cmp r1, r0 - bne _0800F8F6 - b _0800FAAC -_0800F8F6: - b _0800FC04 -_0800F8F8: - movs r0, 0xED - lsls r0, 8 - cmp r1, r0 - bne _0800F902 - b _0800FB10 -_0800F902: - movs r0, 0xEE - lsls r0, 8 - cmp r1, r0 - bne _0800F90C - b _0800FBB0 -_0800F90C: - b _0800FC04 -_0800F90E: - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0 - bne _0800F920 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0800F920 - b _0800FC50 -_0800F920: - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0] - mov r6, r8 - adds r6, 0x1 - cmp r0, 0 - beq _0800F930 - b _0800FC08 -_0800F930: - ldr r1, =gRecvCmds+0x2 - adds r0, r5, r1 - ldrh r0, [r0] - ldr r2, =gUnknown_03005000 - strb r0, [r2, 0xD] - ldr r3, =gRecvCmds+0x4 - adds r0, r5, r3 - bl sub_800F74C - ldr r4, =gUnknown_03005000+0xCCE - strb r0, [r4] - b _0800FC08 - .pool -_0800F960: - ldr r0, =gUnknown_03005000 - mov r9, r0 - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r7, r0, 2 - mov r2, r9 - adds r3, r7, r2 - movs r4, 0x92 - adds r4, r3 - mov r12, r4 - ldrb r4, [r4] - mov r6, r8 - adds r6, 0x1 - cmp r4, 0 - beq _0800F982 - b _0800FC08 -_0800F982: - adds r0, r3, 0 - adds r0, 0x80 - movs r2, 0 - strh r4, [r0] - ldr r1, =gRecvCmds+0x2 - adds r0, r5, r1 - ldrh r0, [r0] - adds r1, r3, 0 - adds r1, 0x82 - strh r0, [r1] - ldr r1, =gRecvCmds+0x4 - adds r0, r5, r1 - ldrh r1, [r0] - adds r0, r3, 0 - adds r0, 0x91 - strb r1, [r0] - mov r0, r9 - adds r0, 0x88 - adds r0, r7, r0 - str r4, [r0] - movs r0, 0x1 - mov r3, r12 - strb r0, [r3] - mov r0, r9 - adds r0, 0x5C - add r0, r8 - strb r2, [r0] - b _0800FC08 - .pool -_0800F9C8: - ldr r4, =gUnknown_03005000 - mov r9, r4 - mov r0, r8 - lsls r1, r0, 2 - adds r0, r1, r0 - lsls r4, r0, 2 - mov r3, r9 - adds r2, r4, r3 - adds r0, r2, 0 - adds r0, 0x92 - ldrb r3, [r0] - mov r10, r1 - mov r6, r8 - adds r6, 0x1 - cmp r3, 0x1 - beq _0800F9EA - b _0800FC08 -_0800F9EA: - movs r0, 0xFF - ands r0, r7 - adds r2, 0x80 - strh r0, [r2] - mov r1, r9 - adds r1, 0x88 - adds r1, r4, r1 - lsls r3, r0 - ldr r0, [r1] - orrs r0, r3 - str r0, [r1] - movs r4, 0 - ldr r0, =gBlockRecvBuffer - mov r9, r0 - mov r12, r2 - mov r1, r8 - lsls r7, r1, 8 - adds r3, r5, 0 -_0800FA0E: - mov r2, r12 - ldrh r0, [r2] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 1 - adds r1, r4 - lsls r1, 1 - adds r1, r7 - add r1, r9 - adds r2, r4, 0x1 - lsls r0, r2, 1 - adds r0, r3 - ldr r4, =gRecvCmds - adds r0, r4 - ldrh r0, [r0] - strh r0, [r1] - lsls r2, 16 - lsrs r4, r2, 16 - cmp r4, 0x5 - bls _0800FA0E - ldr r4, =gUnknown_03005000 - mov r0, r10 - add r0, r8 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x88 - adds r1, r0, r1 - adds r2, r0, r4 - adds r0, r2, 0 - adds r0, 0x82 - ldrh r0, [r0] - lsls r0, 2 - ldr r3, =gUnknown_082ED628 - adds r0, r3 - ldr r1, [r1] - ldr r0, [r0] - cmp r1, r0 - beq _0800FA5C - b _0800FC08 -_0800FA5C: - adds r1, r2, 0 - adds r1, 0x92 - movs r0, 0x2 - strb r0, [r1] - mov r1, r8 - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_800F6FC - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - beq _0800FA7E - b _0800FC08 -_0800FA7E: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0800FA88 - b _0800FC08 -_0800FA88: - ldrb r0, [r4, 0xC] - cmp r0, 0 - beq _0800FA90 - b _0800FC08 -_0800FA90: - ldr r0, =gBlockRecvBuffer - bl sub_8010A70 - b _0800FC08 - .pool -_0800FAAC: - ldr r2, =gUnknown_082ED6B8 - ldr r3, =gRecvCmds+0x2 - adds r0, r5, r3 - ldrh r1, [r0] - lsls r1, 3 - adds r0, r1, r2 - ldr r0, [r0] - adds r2, 0x4 - adds r1, r2 - ldrh r1, [r1] - bl sub_800FE84 - b _0800FC04 - .pool -_0800FAD0: - ldr r1, =gUnknown_03005000+0xE4 - add r1, r8 - movs r0, 0x1 - strb r0, [r1] - b _0800FC04 - .pool -_0800FAE0: - ldr r2, =gUnknown_03005000 - movs r4, 0x80 - lsls r4, 1 - adds r0, r2, r4 - ldr r3, =gRecvCmds+0x2 - adds r1, r5, r3 - ldrh r0, [r0] - mov r6, r8 - adds r6, 0x1 - ldrh r1, [r1] - cmp r0, r1 - beq _0800FAFA - b _0800FC08 -_0800FAFA: - adds r0, r2, 0 - adds r0, 0xE9 - add r0, r8 - movs r1, 0x1 - strb r1, [r0] - b _0800FC08 - .pool -_0800FB10: - ldr r7, =gUnknown_03005000 - ldrb r2, [r7, 0xC] - cmp r2, 0 - bne _0800FB78 - ldr r3, =gReceivedRemoteLinkPlayers - ldrb r0, [r3] - mov r6, r8 - adds r6, 0x1 - cmp r0, 0 - beq _0800FC08 - ldr r0, =gRecvCmds+0x2 - adds r4, r5, r0 - ldrh r1, [r4] - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r0, [r0, 0x2] - ands r1, r0 - cmp r1, 0 - beq _0800FB48 - strb r2, [r3] - bl sub_800D630 - ldr r1, =gRecvCmds+0x4 - adds r0, r5, r1 - ldrh r1, [r0] - ldr r2, =0x00000ce4 - adds r0, r7, r2 - strb r1, [r0] -_0800FB48: - ldr r0, =gRecvCmds - adds r0, 0x6 - adds r0, r5, r0 - ldrh r0, [r0] - strb r0, [r7, 0xD] - ldrh r0, [r4] - bl sub_80109E8 - b _0800FC08 - .pool -_0800FB78: - movs r0, 0xEE - lsls r0, 8 - bl sub_800FD14 - ldr r1, =gSendCmd - ldr r3, =gRecvCmds+0x2 - adds r0, r5, r3 - ldrh r0, [r0] - strh r0, [r1, 0x2] - ldr r4, =gRecvCmds+0x4 - adds r0, r5, r4 - ldrh r0, [r0] - strh r0, [r1, 0x4] - ldr r0, =gRecvCmds - adds r0, 0x6 - adds r0, r5, r0 - ldrh r0, [r0] - strh r0, [r1, 0x6] - b _0800FC04 - .pool -_0800FBB0: - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - mov r6, r8 - adds r6, 0x1 - cmp r0, 0x1 - bne _0800FC44 - ldr r0, =0x00000ce3 - adds r2, r4, r0 - ldr r1, =gRecvCmds+0x2 - adds r3, r5, r1 - ldrb r1, [r3] - ldrb r0, [r2] - orrs r0, r1 - strb r0, [r2] - ldr r2, =gRecvCmds+0x4 - adds r0, r5, r2 - ldrh r1, [r0] - ldr r2, =0x00000ce4 - adds r0, r4, r2 - strb r1, [r0] - ldrh r0, [r3] - bl sub_80109E8 - b _0800FC08 - .pool -_0800FBF4: - ldr r0, =gLinkPartnersHeldKeys - mov r3, r8 - lsls r1, r3, 1 - adds r1, r0 - ldr r4, =gRecvCmds+0x2 - adds r0, r5, r4 - ldrh r0, [r0] - strh r0, [r1] -_0800FC04: - mov r6, r8 - adds r6, 0x1 -_0800FC08: - ldr r3, =gUnknown_03005000 - ldrb r4, [r3, 0xC] - cmp r4, 0x1 - bne _0800FC44 - adds r0, r3, 0 - adds r0, 0x61 - mov r1, r8 - adds r2, r1, r0 - ldrb r0, [r2] - adds r1, r0, 0 - cmp r1, 0 - beq _0800FC44 - cmp r1, 0x4 - bne _0800FC40 - adds r0, r3, 0 - adds r0, 0x5C - add r0, r8 - movs r1, 0 - strb r4, [r0] - strb r1, [r2] - b _0800FC44 - .pool -_0800FC40: - adds r0, 0x1 - strb r0, [r2] -_0800FC44: - lsls r0, r6, 16 - lsrs r0, 16 - mov r8, r0 - cmp r0, 0x4 - bhi _0800FC50 - b _0800F87A -_0800FC50: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800F86C - thumb_func_start sub_800FC60 sub_800FC60: @ 800FC60 push {lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 144a863b5..12ee00e0e 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -153,9 +153,11 @@ struct UnkRfuStruct_2 { /* 0x068 */ u8 filler_68[4]; /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c; /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5]; - /* 0x0e4 */ u8 filler_e4[10]; + /* 0x0e4 */ u8 unk_e4[5]; + /* 0x0e9 */ u8 unk_e9[5]; /* 0x0ee */ vu8 unk_ee; - /* 0x0ef */ u8 filler_ef[0x13]; + /* 0x0ef */ u8 filler_ef[0x11]; + /* 0x100 */ u16 unk_100; /* 0x102 */ u8 unk_102; /* 0x103 */ u8 filler_103[0x21]; /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; @@ -168,7 +170,8 @@ struct UnkRfuStruct_2 { /* 0xc85 */ u8 filler_c85[2]; /* 0xc87 */ u8 unk_c87[5][7][2]; /* 0xccd */ u8 unk_ccd; - /* 0xcce */ u8 filler_cce[2]; + /* 0xcce */ u8 unk_cce; + /* 0xccf */ u8 unk_ccf; /* 0xcd0 */ vu8 unk_cd0; /* 0xcd1 */ u8 filler_cd1[8]; /* 0xcd9 */ u8 unk_cd9; diff --git a/src/link_rfu.c b/src/link_rfu.c index 2fe991c41..66e36396d 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -64,6 +64,8 @@ void sub_8010528(void); void sub_8010750(void); int sub_80107A0(void); void sub_801084C(u8 taskId); +void sub_80109E8(u16 a0); +void sub_8010A70(void *a0); void sub_8010AAC(u8 taskId); void sub_8010D0C(u8 taskId); void sub_8011068(u8 a0); @@ -259,7 +261,7 @@ const u8 gUnknown_082ED6A5[] = { }; const struct { u8 *buffer; - u16 size; + u32 size; } gUnknown_082ED6B8[] = { { gBlockSendBuffer, 200 }, { gBlockSendBuffer, 200 }, @@ -3390,3 +3392,109 @@ void sub_800F850(void) if (gUnknown_03005000.unk_00 == NULL) gUnknown_03005000.unk_00 = sub_800F820; } + +void sub_800F86C(u8 unused) +{ + u16 i; + u16 j; + + for (i = 0; i < MAX_RFU_PLAYERS; i++) + { + switch (gRecvCmds[i][0] & 0xff00) + { + case 0x7800: + if (gUnknown_03005000.unk_0c == 0 && gReceivedRemoteLinkPlayers != 0) + return; + // fallthrough + case 0x7700: + if (gUnknown_03007890->unk_00 == 0) + { + gUnknown_03005000.playerCount = gRecvCmds[i][1]; + gUnknown_03005000.unk_cce = sub_800F74C((u8 *)(gRecvCmds[i] + 2)); + } + break; + case 0x8800: + if (gUnknown_03005000.unk_80[i].unk_12 == 0) + { + gUnknown_03005000.unk_80[i].unk_00 = 0; + gUnknown_03005000.unk_80[i].unk_02 = gRecvCmds[i][1]; + gUnknown_03005000.unk_80[i].unk_11 = gRecvCmds[i][2]; + gUnknown_03005000.unk_80[i].unk_08 = 0; + gUnknown_03005000.unk_80[i].unk_12 = 1; + gUnknown_03005000.unk_5c[i] = 0; + } + break; + case 0x8900: + if (gUnknown_03005000.unk_80[i].unk_12 == 1) + { + gUnknown_03005000.unk_80[i].unk_00 = gRecvCmds[i][0] & 0xff; + gUnknown_03005000.unk_80[i].unk_08 |= (1 << gUnknown_03005000.unk_80[i].unk_00); + for (j = 0; j < 6; j++) + gBlockRecvBuffer[i][gUnknown_03005000.unk_80[i].unk_00 * 6 + j] = gRecvCmds[i][j + 1]; + if (gUnknown_03005000.unk_80[i].unk_08 == gUnknown_082ED628[gUnknown_03005000.unk_80[i].unk_02]) + { + gUnknown_03005000.unk_80[i].unk_12 = 2; + sub_800F6FC(i); + if (sub_800F7DC()->unk_0a_0 == 0x45 && gReceivedRemoteLinkPlayers != 0 && gUnknown_03005000.unk_0c == 0) + sub_8010A70(gBlockRecvBuffer); + } + } + break; + case 0xa100: + sub_800FE84(gUnknown_082ED6B8[gRecvCmds[i][1]].buffer, (u16)gUnknown_082ED6B8[gRecvCmds[i][1]].size); + break; + case 0x5f00: + gUnknown_03005000.unk_e4[i] = 1; + break; + case 0x6600: + if (gUnknown_03005000.unk_100 == gRecvCmds[i][1]) + gUnknown_03005000.unk_e9[i] = 1; + break; + case 0xed00: + if (gUnknown_03005000.unk_0c == 0) + { + if (gReceivedRemoteLinkPlayers != 0) + { + if (gRecvCmds[i][1] & gUnknown_03007890->unk_02) + { + gReceivedRemoteLinkPlayers = 0; + sub_800D630(); + gUnknown_03005000.unk_ce4 = gRecvCmds[i][2]; + } + gUnknown_03005000.playerCount = gRecvCmds[i][3]; + sub_80109E8(gRecvCmds[i][1]); + } + } + else + { + sub_800FD14(0xee00); + gSendCmd[1] = gRecvCmds[i][1]; + gSendCmd[2] = gRecvCmds[i][2]; + gSendCmd[3] = gRecvCmds[i][3]; + } + break; + case 0xee00: + if (gUnknown_03005000.unk_0c == 1) + { + gUnknown_03005000.unk_ce3 |= gRecvCmds[i][1]; + gUnknown_03005000.unk_ce4 = gRecvCmds[i][2]; + sub_80109E8(gRecvCmds[i][1]); + } + break; + case 0x4400: + case 0xbe00: + gLinkPartnersHeldKeys[i] = gRecvCmds[i][1]; + break; + } + if (gUnknown_03005000.unk_0c == 1 && gUnknown_03005000.unk_61[i]) + { + if (gUnknown_03005000.unk_61[i] == 4) + { + gUnknown_03005000.unk_5c[i] = 1; + gUnknown_03005000.unk_61[i] = 0; + } + else + gUnknown_03005000.unk_61[i]++; + } + } +} From b9e5ad9f11584098f7afce770fc06501b85abd46 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 19 Jan 2018 22:03:02 -0500 Subject: [PATCH 110/123] through sub_800FCD8 --- asm/link_rfu.s | 110 ------------------------------------------------- src/link_rfu.c | 50 ++++++++++++++++++++++ 2 files changed, 50 insertions(+), 110 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 2247baf0d..5d33cd242 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,116 +5,6 @@ .text - thumb_func_start sub_800FC60 -sub_800FC60: @ 800FC60 - push {lr} - movs r2, 0 - ldr r0, =gUnknown_03005000 - adds r1, r0, 0 - adds r1, 0x92 -_0800FC6A: - ldrb r0, [r1] - cmp r0, 0 - beq _0800FC78 - movs r0, 0 - b _0800FC82 - .pool -_0800FC78: - adds r1, 0x14 - adds r2, 0x1 - cmp r2, 0x4 - ble _0800FC6A - movs r0, 0x1 -_0800FC82: - pop {r1} - bx r1 - thumb_func_end sub_800FC60 - - thumb_func_start sub_800FC88 -sub_800FC88: @ 800FC88 - push {r4,lr} - movs r1, 0 - ldr r2, =gUnknown_03005000 - ldrb r0, [r2, 0xD] - cmp r1, r0 - bge _0800FCBC - adds r4, r0, 0 - adds r3, r2, 0 - adds r3, 0x92 - adds r2, 0x5C -_0800FC9C: - ldrb r0, [r3] - cmp r0, 0x2 - bne _0800FCAA - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0800FCB4 -_0800FCAA: - movs r0, 0 - b _0800FCBE - .pool -_0800FCB4: - adds r3, 0x14 - adds r1, 0x1 - cmp r1, r4 - blt _0800FC9C -_0800FCBC: - movs r0, 0x1 -_0800FCBE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_800FC88 - - thumb_func_start sub_800FCC4 -sub_800FCC4: @ 800FCC4 - movs r2, 0 - movs r1, 0 - strh r1, [r0] - strh r1, [r0, 0x2] - str r1, [r0, 0x4] - str r1, [r0, 0x8] - strb r2, [r0, 0x10] - strb r2, [r0, 0x11] - strb r2, [r0, 0x12] - bx lr - thumb_func_end sub_800FCC4 - - thumb_func_start sub_800FCD8 -sub_800FCD8: @ 800FCD8 - push {r4,lr} - movs r2, 0 - movs r1, 0 - ldr r0, =gUnknown_03005000 - adds r3, r0, 0 - adds r3, 0x92 - adds r4, r0, 0 - adds r4, 0x5C -_0800FCE8: - ldrb r0, [r3] - cmp r0, 0x2 - bne _0800FCFE - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0x1 - bne _0800FCFE - lsls r0, r1 - orrs r2, r0 - lsls r0, r2, 24 - lsrs r2, r0, 24 -_0800FCFE: - adds r3, 0x14 - adds r1, 0x1 - cmp r1, 0x4 - ble _0800FCE8 - adds r0, r2, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800FCD8 - thumb_func_start sub_800FD14 sub_800FD14: @ 800FD14 push {r4,r5,lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index 66e36396d..a6ece43bb 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -3498,3 +3498,53 @@ void sub_800F86C(u8 unused) } } } + +bool8 sub_800FC60(void) +{ + int i; + + for (i = 0; i < 5; i++) + { + if (gUnknown_03005000.unk_80[i].unk_12) + return FALSE; + } + return TRUE; +} + +bool8 sub_800FC88(void) +{ + int i; + + for (i = 0; i < gUnknown_03005000.playerCount; i++) + { + if (gUnknown_03005000.unk_80[i].unk_12 != 2 || gUnknown_03005000.unk_5c[i] != 1) + return FALSE; + } + return TRUE; +} + +void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data) +{ + data->unk_00 = 0; + data->unk_02 = 0; + data->unk_04 = NULL; + data->unk_08 = 0; + data->unk_10 = 0; + data->unk_11 = 0; + data->unk_12 = 0; +} + +u8 sub_800FCD8(void) +{ + u8 flags = 0; + int i; + + for (i = 0; i < 5; i++) + { + if (gUnknown_03005000.unk_80[i].unk_12 == 2 && gUnknown_03005000.unk_5c[i] == 1) + { + flags |= (1 << i); + } + } + return flags; +} From 6ac0175c1e23a686bc85743b6de34390c3d09db4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 10:16:09 -0500 Subject: [PATCH 111/123] nonmatching sub_800FD14 --- asm/link_rfu.s | 154 ---------------------------------- include/link_rfu.h | 7 +- src/link_rfu.c | 201 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 206 insertions(+), 156 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 5d33cd242..2aeb664d3 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,160 +5,6 @@ .text - thumb_func_start sub_800FD14 -sub_800FD14: @ 800FD14 - push {r4,r5,lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r5, =gSendCmd - strh r1, [r5] - movs r0, 0xF0 - lsls r0, 7 - adds r4, r5, 0 - cmp r1, r0 - beq _0800FDB0 - cmp r1, r0 - bgt _0800FD62 - movs r0, 0xBE - lsls r0, 7 - cmp r1, r0 - beq _0800FE00 - cmp r1, r0 - bgt _0800FD50 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - beq _0800FE20 - movs r0, 0x88 - lsls r0, 7 - cmp r1, r0 - beq _0800FE14 - b _0800FE46 - .pool -_0800FD50: - movs r0, 0xCC - lsls r0, 7 - cmp r1, r0 - beq _0800FE00 - movs r0, 0xEE - lsls r0, 7 - cmp r1, r0 - beq _0800FDB0 - b _0800FE46 -_0800FD62: - movs r0, 0xBE - lsls r0, 8 - cmp r1, r0 - beq _0800FE40 - cmp r1, r0 - bgt _0800FE46 - movs r0, 0x88 - lsls r0, 8 - cmp r1, r0 - beq _0800FD80 - movs r0, 0xA1 - lsls r0, 8 - cmp r1, r0 - beq _0800FD98 - b _0800FE46 -_0800FD80: - ldr r0, =gUnknown_03005000 - adds r1, r0, 0 - adds r1, 0x6E - ldrh r1, [r1] - strh r1, [r5, 0x2] - adds r0, 0x7D - ldrb r0, [r0] - adds r0, 0x80 - strh r0, [r5, 0x4] - b _0800FE46 - .pool -_0800FD98: - bl sub_800FC60 - lsls r0, 24 - cmp r0, 0 - beq _0800FE46 - ldr r0, =gUnknown_03005000 - adds r0, 0x5A - ldrb r0, [r0] - b _0800FE44 - .pool -_0800FDB0: - ldr r3, =gUnknown_03005000 - ldr r1, =0x00000ce2 - adds r0, r3, r1 - ldr r2, =0x00000ce3 - adds r1, r3, r2 - ldrb r2, [r0] - ldrb r0, [r1] - eors r0, r2 - ldr r1, =gUnknown_082ED695 - adds r0, r1 - ldrb r0, [r0] - adds r0, 0x1 - strb r0, [r3, 0xD] - ldrb r0, [r3, 0xD] - strh r0, [r4, 0x2] - adds r2, r4, 0x4 - movs r4, 0 - ldr r0, =0x00000cde - adds r3, r0 -_0800FDD6: - adds r1, r2, r4 - adds r0, r4, r3 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800FDD6 - b _0800FE46 - .pool -_0800FE00: - ldr r0, =gUnknown_03005000 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r4, 0x2] - b _0800FE46 - .pool -_0800FE14: - strh r1, [r5] - ldr r0, =gMain - ldrh r0, [r0, 0x2C] - b _0800FE44 - .pool -_0800FE20: - movs r4, 0 - ldr r3, =gUnknown_03005000+0xF2 -_0800FE24: - adds r2, r4, 0x1 - lsls r1, r2, 1 - adds r1, r5 - lsls r0, r4, 1 - adds r0, r3 - ldrh r0, [r0] - strh r0, [r1] - lsls r2, 24 - lsrs r4, r2, 24 - cmp r4, 0x5 - bls _0800FE24 - b _0800FE46 - .pool -_0800FE40: - ldr r0, =gUnknown_03005DA8 - ldrh r0, [r0] -_0800FE44: - strh r0, [r5, 0x2] -_0800FE46: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800FD14 - thumb_func_start sub_800FE50 sub_800FE50: @ 800FE50 push {r4,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 12ee00e0e..0c279f50b 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -145,7 +145,8 @@ struct UnkRfuStruct_2 { /* 0x00f */ u8 filler_0f[5]; /* 0x014 */ u8 unk_14[4][14]; /* 0x04c */ u8 unk_4c[14]; - /* 0x05a */ u8 filler_5a[2]; + /* 0x05a */ u8 unk_5a; + /* 0x05b */ u8 unk_5b; /* 0x05c */ u8 unk_5c[5]; /* 0x061 */ u8 unk_61[5]; /* 0x066 */ u8 unk_66; @@ -156,7 +157,9 @@ struct UnkRfuStruct_2 { /* 0x0e4 */ u8 unk_e4[5]; /* 0x0e9 */ u8 unk_e9[5]; /* 0x0ee */ vu8 unk_ee; - /* 0x0ef */ u8 filler_ef[0x11]; + /* 0x0ef */ u8 filler_ef[3]; + /* 0x0f2 */ u16 unk_f2[6]; + /* 0x0fe */ u8 filler_fe[2]; /* 0x100 */ u16 unk_100; /* 0x102 */ u8 unk_102; /* 0x103 */ u8 filler_103[0x21]; diff --git a/src/link_rfu.c b/src/link_rfu.c index a6ece43bb..8e2ecb5fd 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -3548,3 +3548,204 @@ u8 sub_800FCD8(void) } return flags; } + +#ifdef NONMATCHING +// The switch tree is incorrect +void sub_800FD14(u16 command) +{ + u8 i; + u8 *buff; + u8 tmp; + + gSendCmd[0] = command; + switch (command) + { + case 0x8800: + gSendCmd[1] = gUnknown_03005000.unk_6c.unk_02; + gSendCmd[2] = gUnknown_03005000.unk_6c.unk_11 + 0x80; + break; + case 0xa100: + if (sub_800FC60()) + gSendCmd[1] = gUnknown_03005000.unk_5a; + break; + case 0x7800: + case 0x7700: + tmp = gUnknown_03005000.unk_ce2 ^ gUnknown_03005000.unk_ce3; + gUnknown_03005000.playerCount = gUnknown_082ED695[tmp] + 1; + gSendCmd[1] = gUnknown_03005000.playerCount; + buff = (u8 *)(gSendCmd + 2); + for (i = 0; i < 4; i++) + buff[i] = gUnknown_03005000.unk_cde[i]; + break; + case 0x6600: + case 0x5f00: + gSendCmd[1] = gUnknown_03005000.unk_100; + break; + case 0x4400: + gSendCmd[0] = 0x4400; + gSendCmd[1] = gMain.heldKeys; + break; + case 0x2f00: + for (i = 0; i < 6; i++) + gSendCmd[1 + i] = gUnknown_03005000.unk_f2[i]; + break; + case 0xbe00: + gSendCmd[1] = gUnknown_03005DA8; + break; + } +} +#else +__attribute__((naked)) void sub_800FD14(u16 command) +{ + asm_unified("\tpush {r4,r5,lr}\n" + "\tlsls r0, 16\n" + "\tlsrs r1, r0, 16\n" + "\tldr r5, =gSendCmd\n" + "\tstrh r1, [r5]\n" + "\tmovs r0, 0xF0\n" + "\tlsls r0, 7\n" + "\tadds r4, r5, 0\n" + "\tcmp r1, r0\n" + "\tbeq _0800FDB0_case_7700_case_7800\n" + "\tcmp r1, r0\n" + "\tbgt _0800FD62\n" + "\tmovs r0, 0xBE\n" + "\tlsls r0, 7\n" + "\tcmp r1, r0\n" + "\tbeq _0800FE00_case_5f00_case_6600\n" + "\tcmp r1, r0\n" + "\tbgt _0800FD50\n" + "\tmovs r0, 0xBC\n" + "\tlsls r0, 6\n" + "\tcmp r1, r0\n" + "\tbeq _0800FE20_case_2f00\n" + "\tmovs r0, 0x88\n" + "\tlsls r0, 7\n" + "\tcmp r1, r0\n" + "\tbeq _0800FE14_case_4400\n" + "\tb _0800FE46_break\n" + "\t.pool\n" + "_0800FD50:\n" + "\tmovs r0, 0xCC\n" + "\tlsls r0, 7\n" + "\tcmp r1, r0\n" + "\tbeq _0800FE00_case_5f00_case_6600\n" + "\tmovs r0, 0xEE\n" + "\tlsls r0, 7\n" + "\tcmp r1, r0\n" + "\tbeq _0800FDB0_case_7700_case_7800\n" + "\tb _0800FE46_break\n" + "_0800FD62:\n" + "\tmovs r0, 0xBE\n" + "\tlsls r0, 8\n" + "\tcmp r1, r0\n" + "\tbeq _0800FE40_case_be00\n" + "\tcmp r1, r0\n" + "\tbgt _0800FE46_break\n" + "\tmovs r0, 0x88\n" + "\tlsls r0, 8\n" + "\tcmp r1, r0\n" + "\tbeq _0800FD80_case_8800\n" + "\tmovs r0, 0xA1\n" + "\tlsls r0, 8\n" + "\tcmp r1, r0\n" + "\tbeq _0800FD98_case_a100\n" + "\tb _0800FE46_break\n" + "_0800FD80_case_8800:\n" + "\tldr r0, =gUnknown_03005000\n" + "\tadds r1, r0, 0\n" + "\tadds r1, 0x6E\n" + "\tldrh r1, [r1]\n" + "\tstrh r1, [r5, 0x2]\n" + "\tadds r0, 0x7D\n" + "\tldrb r0, [r0]\n" + "\tadds r0, 0x80\n" + "\tstrh r0, [r5, 0x4]\n" + "\tb _0800FE46_break\n" + "\t.pool\n" + "_0800FD98_case_a100:\n" + "\tbl sub_800FC60\n" + "\tlsls r0, 24\n" + "\tcmp r0, 0\n" + "\tbeq _0800FE46_break\n" + "\tldr r0, =gUnknown_03005000\n" + "\tadds r0, 0x5A\n" + "\tldrb r0, [r0]\n" + "\tb _0800FE44_str_break\n" + "\t.pool\n" + "_0800FDB0_case_7700_case_7800:\n" + "\tldr r3, =gUnknown_03005000\n" + "\tldr r1, =0x00000ce2\n" + "\tadds r0, r3, r1\n" + "\tldr r2, =0x00000ce3\n" + "\tadds r1, r3, r2\n" + "\tldrb r2, [r0]\n" + "\tldrb r0, [r1]\n" + "\teors r0, r2\n" + "\tldr r1, =gUnknown_082ED695\n" + "\tadds r0, r1\n" + "\tldrb r0, [r0]\n" + "\tadds r0, 0x1\n" + "\tstrb r0, [r3, 0xD]\n" + "\tldrb r0, [r3, 0xD]\n" + "\tstrh r0, [r4, 0x2]\n" + "\tadds r2, r4, 0x4\n" + "\tmovs r4, 0\n" + "\tldr r0, =0x00000cde\n" + "\tadds r3, r0\n" + "_0800FDD6:\n" + "\tadds r1, r2, r4\n" + "\tadds r0, r4, r3\n" + "\tldrb r0, [r0]\n" + "\tstrb r0, [r1]\n" + "\tadds r0, r4, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r4, r0, 24\n" + "\tcmp r4, 0x3\n" + "\tbls _0800FDD6\n" + "\tb _0800FE46_break\n" + "\t.pool\n" + "_0800FE00_case_5f00_case_6600:\n" + "\tldr r0, =gUnknown_03005000\n" + "\tmovs r1, 0x80\n" + "\tlsls r1, 1\n" + "\tadds r0, r1\n" + "\tldrh r0, [r0]\n" + "\tstrh r0, [r4, 0x2]\n" + "\tb _0800FE46_break\n" + "\t.pool\n" + "_0800FE14_case_4400:\n" + "\tstrh r1, [r5]\n" + "\tldr r0, =gMain\n" + "\tldrh r0, [r0, 0x2C]\n" + "\tb _0800FE44_str_break\n" + "\t.pool\n" + "_0800FE20_case_2f00:\n" + "\tmovs r4, 0\n" + "\tldr r3, =gUnknown_03005000+0xF2\n" + "_0800FE24:\n" + "\tadds r2, r4, 0x1\n" + "\tlsls r1, r2, 1\n" + "\tadds r1, r5\n" + "\tlsls r0, r4, 1\n" + "\tadds r0, r3\n" + "\tldrh r0, [r0]\n" + "\tstrh r0, [r1]\n" + "\tlsls r2, 24\n" + "\tlsrs r4, r2, 24\n" + "\tcmp r4, 0x5\n" + "\tbls _0800FE24\n" + "\tb _0800FE46_break\n" + "\t.pool\n" + "_0800FE40_case_be00:\n" + "\tldr r0, =gUnknown_03005DA8\n" + "\tldrh r0, [r0]\n" + "_0800FE44_str_break:\n" + "\tstrh r0, [r5, 0x2]\n" + "_0800FE46_break:\n" + "\tpop {r4,r5}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.pool"); +} +#endif From b8af0f011d2968977e72cff5d8bae35b169c0046 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 11:53:35 -0500 Subject: [PATCH 112/123] through rfufunc_80FA020 --- asm/link_rfu.s | 331 --------------------------------------------- include/link_rfu.h | 15 +- src/link_rfu.c | 119 ++++++++++++++-- 3 files changed, 120 insertions(+), 345 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 2aeb664d3..3d85d8a7d 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,337 +5,6 @@ .text - thumb_func_start sub_800FE50 -sub_800FE50: @ 800FE50 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - bne _0800FE76 - bl sub_8011A80 - cmp r0, 0 - bne _0800FE76 - ldr r0, =gUnknown_03005000+0xF2 - adds r1, r4, 0 - movs r2, 0xC - bl memcpy - movs r0, 0xBC - lsls r0, 6 - bl sub_800FD14 -_0800FE76: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800FE50 - - thumb_func_start sub_800FE84 -@ bool8 sub_800FE84(u32 a1, u32 size) -sub_800FE84: @ 800FE84 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - adds r6, r1, 0 - ldr r5, =gUnknown_03005000 - ldr r0, [r5] - cmp r0, 0 - bne _0800FEB8 - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - bne _0800FEB8 - movs r0, 0x7C - adds r0, r5 - mov r9, r0 - ldrb r1, [r0] - mov r8, r1 - cmp r1, 0 - beq _0800FEC8 - ldr r1, =gUnknown_02022B44 - adds r1, 0x83 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0800FEB8: - movs r0, 0 - b _0800FF32 - .pool -_0800FEC8: - adds r0, r6, 0 - movs r1, 0xC - bl __umodsi3 - negs r4, r0 - orrs r4, r0 - lsrs r4, 31 - bl GetMultiplayerId - adds r1, r5, 0 - adds r1, 0x7D - strb r0, [r1] - movs r0, 0x1 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - movs r1, 0xC - bl __udivsi3 - adds r0, r4 - adds r1, r5, 0 - adds r1, 0x6E - strh r0, [r1] - adds r0, r5, 0 - adds r0, 0x6C - mov r1, r8 - strh r1, [r0] - movs r0, 0x80 - lsls r0, 1 - cmp r6, r0 - bls _0800FF0A - str r7, [r5, 0x70] - b _0800FF1C -_0800FF0A: - ldr r4, =gBlockSendBuffer - cmp r7, r4 - beq _0800FF1A - adds r0, r4, 0 - adds r1, r7, 0 - adds r2, r6, 0 - bl memcpy -_0800FF1A: - str r4, [r5, 0x70] -_0800FF1C: - movs r0, 0x88 - lsls r0, 8 - bl sub_800FD14 - ldr r0, =gUnknown_03005000 - ldr r1, =rfufunc_80F9F44 - str r1, [r0] - adds r0, 0x5B - movs r1, 0 - strb r1, [r0] - movs r0, 0x1 -_0800FF32: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800FE84 - - thumb_func_start rfufunc_80F9F44 -rfufunc_80F9F44: @ 800FF4C - push {r4,r5,lr} - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - bne _0800FFA0 - movs r5, 0x88 - lsls r5, 8 - adds r0, r5, 0 - bl sub_800FD14 - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - bne _0800FF84 - adds r1, r4, 0 - adds r1, 0x5B - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _0800FFA0 - b _0800FF9C - .pool -_0800FF84: - bl GetMultiplayerId - ldr r1, =gRecvCmds - lsls r0, 24 - lsrs r0, 20 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - cmp r0, r5 - bne _0800FFA0 -_0800FF9C: - ldr r0, =sub_800FFB0 - str r0, [r4] -_0800FFA0: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end rfufunc_80F9F44 - - thumb_func_start sub_800FFB0 -sub_800FFB0: @ 800FFB0 - push {r4-r6,lr} - ldr r0, =gUnknown_03005000 - mov r12, r0 - ldr r5, [r0, 0x70] - ldr r3, =gSendCmd - mov r2, r12 - adds r2, 0x6C - ldrh r1, [r2] - movs r4, 0x89 - lsls r4, 8 - adds r0, r4, 0 - orrs r0, r1 - strh r0, [r3] - movs r4, 0 - adds r6, r2, 0 - adds r3, 0x2 -_0800FFD0: - lsls r2, r4, 1 - ldrh r1, [r6] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, r5 - ldrb r1, [r0, 0x1] - lsls r1, 8 - ldrb r0, [r0] - orrs r0, r1 - strh r0, [r3] - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x6 - ble _0800FFD0 - mov r0, r12 - adds r0, 0x6C - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - adds r0, 0x2 - ldrh r0, [r0] - lsls r1, 16 - lsrs r1, 16 - cmp r0, r1 - bhi _08010014 - mov r0, r12 - adds r0, 0x7C - movs r1, 0 - strb r1, [r0] - ldr r0, =rfufunc_80FA020 - mov r1, r12 - str r0, [r1] -_08010014: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800FFB0 - - thumb_func_start rfufunc_80FA020 -rfufunc_80FA020: @ 8010028 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r5, =gUnknown_03005000 - ldr r0, [r5, 0x70] - mov r8, r0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _080100F0 - ldr r3, =gSendCmd - adds r2, r5, 0 - adds r2, 0x6E - ldrh r0, [r2] - subs r0, 0x1 - ldr r4, =0xffff8900 - adds r1, r4, 0 - orrs r0, r1 - strh r0, [r3] - movs r4, 0 - mov r9, r5 - ldr r0, =gRecvCmds - mov r12, r0 - lsls r5, r6, 4 - adds r7, r2, 0 - adds r3, 0x2 -_08010064: - lsls r2, r4, 1 - ldrh r1, [r7] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - add r0, r8 - adds r1, r0, 0 - subs r1, 0xB - ldrb r1, [r1] - lsls r1, 8 - subs r0, 0xC - ldrb r0, [r0] - orrs r0, r1 - strh r0, [r3] - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x6 - ble _08010064 - mov r1, r12 - adds r0, r5, r1 - ldrb r1, [r0] - mov r3, r9 - adds r0, r3, 0 - adds r0, 0x6E - ldrh r0, [r0] - subs r0, 0x1 - cmp r1, r0 - bne _080100F4 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 2 - adds r1, r3, 0 - adds r1, 0x88 - adds r1, r0, r1 - ldr r2, =gUnknown_082ED628 - adds r0, r3 - adds r0, 0x82 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r2 - ldr r1, [r1] - ldr r0, [r0] - cmp r1, r0 - beq _080100E8 - adds r0, r6, 0 - bl sub_800F638 - ldr r1, =gUnknown_02022B44 - adds r1, 0x64 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _080100F4 - .pool -_080100E8: - movs r0, 0 - mov r4, r9 - str r0, [r4] - b _080100F4 -_080100F0: - movs r0, 0 - str r0, [r5] -_080100F4: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end rfufunc_80FA020 - thumb_func_start sub_8010100 sub_8010100: @ 8010100 push {lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 0c279f50b..a5d237b9f 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -47,7 +47,11 @@ struct UnkLinkRfuStruct_02022B44 u8 fill_08[6]; vu8 unk_0e; u8 unk_0f; - u8 fill_10[0xcc]; + u8 fill_10[0x54]; + u16 unk_64; + u8 fill_66[0x1d]; + u8 unk_83; + u8 fill_84[0x58]; }; struct UnkRfuStruct_1 { @@ -96,7 +100,7 @@ struct UnkRfuStruct_1 { struct UnkRfuStruct_2_Sub_6c { /* 0x00 */ u16 unk_00; /* 0x02 */ u16 unk_02; - /* 0x04 */ u8 *unk_04; + /* 0x04 */ const u8 *unk_04; /* 0x08 */ u32 unk_08; /* 0x0c */ u32 unk_0c; /* 0x10 */ u8 unk_10; @@ -210,7 +214,7 @@ bool32 sub_800F7E4(void); void sub_800F804(void); void sub_800F850(void); u8 sub_800FCD8(void); -bool32 sub_800FE84(const void *src, size_t size); +bool32 sub_800FE84(const u8 *src, size_t size); void Rfu_set_zero(void); u8 sub_80104F4(void); u8 rfu_get_multiplayer_id(void); @@ -224,10 +228,15 @@ void sub_800E174(void); void sub_800E6D0(void); bool32 sub_8010EC0(void); bool32 sub_8010F1C(void); +bool32 sub_8011A80(void); bool32 sub_800F0B8(void); u32 sub_80124D4(void); void RfuVSync(void); void sub_80111B0(bool32 a0); u8 sub_8011A74(void); +struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void); +void sub_8011068(u8 a0); +void sub_8011170(u32 a0); +void sub_8011A64(u8 a0, u16 a1); #endif //GUARD_LINK_RFU_H diff --git a/src/link_rfu.c b/src/link_rfu.c index 8e2ecb5fd..1a57ff872 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -49,16 +49,18 @@ static void sub_800D358(u8 a0); static void sub_800D434(void); static void sub_800D610(void); void sub_800D630(void); -bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); +static bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2); static void sub_800EAB4(void); static void sub_800EAFC(void); void sub_800ED34(u16 unused); static void sub_800EDBC(u16 unused); static void sub_800F048(void); -struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void); -void sub_800F86C(u8 a0); -void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); -void sub_800FD14(u16 a0); +static void sub_800F86C(u8 unused); +static void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); +void sub_800FD14(u16 command); +void rfufunc_80F9F44(void); +void sub_800FFB0(void); +void rfufunc_80FA020(void); bool32 sub_8010454(u16 a0); void sub_8010528(void); void sub_8010750(void); @@ -68,9 +70,6 @@ void sub_80109E8(u16 a0); void sub_8010A70(void *a0); void sub_8010AAC(u8 taskId); void sub_8010D0C(u8 taskId); -void sub_8011068(u8 a0); -void sub_8011170(u32 a0); -void sub_8011A64(u8 a0, u16 a1); void sub_8011D6C(u8 a0); u8 sub_8012224(void); void sub_801227C(void); @@ -1885,7 +1884,7 @@ void sub_800DA68(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2) } } -bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2) +static bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2) { int i; @@ -3393,7 +3392,7 @@ void sub_800F850(void) gUnknown_03005000.unk_00 = sub_800F820; } -void sub_800F86C(u8 unused) +static void sub_800F86C(u8 unused) { u16 i; u16 j; @@ -3523,7 +3522,7 @@ bool8 sub_800FC88(void) return TRUE; } -void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data) +static void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data) { data->unk_00 = 0; data->unk_02 = 0; @@ -3749,3 +3748,101 @@ __attribute__((naked)) void sub_800FD14(u16 command) "\t.pool"); } #endif + +void sub_800FE50(u16 *a0) +{ + if (gSendCmd[0] == 0 && sub_8011A80() == 0) + { + memcpy(gUnknown_03005000.unk_f2, a0, sizeof(gUnknown_03005000.unk_f2)); + sub_800FD14(0x2f00); + } +} + +bool32 sub_800FE84(const u8 *src, size_t size) +{ + bool8 r4; + if (gUnknown_03005000.unk_00 != NULL) + return FALSE; + if (gSendCmd[0] != 0) + return FALSE; + if (gUnknown_03005000.unk_6c.unk_10 != 0) + { + gUnknown_02022B44.unk_83++; + return FALSE; + } + r4 = (size % 12) != 0; + gUnknown_03005000.unk_6c.unk_11 = GetMultiplayerId(); + gUnknown_03005000.unk_6c.unk_10 = 1; + gUnknown_03005000.unk_6c.unk_02 = (size / 12) + r4; + gUnknown_03005000.unk_6c.unk_00 = 0; + if (size > 0x100) + gUnknown_03005000.unk_6c.unk_04 = src; + else + { + if (src != gBlockSendBuffer) + memcpy(gBlockSendBuffer, src, size); + gUnknown_03005000.unk_6c.unk_04 = gBlockSendBuffer; + } + sub_800FD14(0x8800); + gUnknown_03005000.unk_00 = rfufunc_80F9F44; + gUnknown_03005000.unk_5b = 0; + return TRUE; +} + +void rfufunc_80F9F44(void) +{ + if (gSendCmd[0] == 0) + { + sub_800FD14(0x8800); + if (gUnknown_03005000.unk_0c == 1) + { + if (++gUnknown_03005000.unk_5b > 2) + gUnknown_03005000.unk_00 = sub_800FFB0; + } + else + { + if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == 0x8800) + gUnknown_03005000.unk_00 = sub_800FFB0; + } + } +} + +void sub_800FFB0(void) +{ + int i; + const u8 *src = gUnknown_03005000.unk_6c.unk_04; + gSendCmd[0] = 0x8900 | gUnknown_03005000.unk_6c.unk_00; + for (i = 0; i < 7; i++) + gSendCmd[i + 1] = (src[(i << 1) + gUnknown_03005000.unk_6c.unk_00 * 12 + 1] << 8) | src[(i << 1) + gUnknown_03005000.unk_6c.unk_00 * 12 + 0]; + gUnknown_03005000.unk_6c.unk_00++; + if (gUnknown_03005000.unk_6c.unk_02 <= gUnknown_03005000.unk_6c.unk_00) + { + gUnknown_03005000.unk_6c.unk_10 = 0; + gUnknown_03005000.unk_00 = rfufunc_80FA020; + } +} + +void rfufunc_80FA020(void) +{ + const u8 *src = gUnknown_03005000.unk_6c.unk_04; + u8 mpId = GetMultiplayerId(); + int i; + if (gUnknown_03005000.unk_0c == 0) + { + gSendCmd[0] = (~0x76ff) | (gUnknown_03005000.unk_6c.unk_02 - 1); + for (i = 0; i < 7; i++) + gSendCmd[i + 1] = (src[(i << 1) + (gUnknown_03005000.unk_6c.unk_02 - 1) * 12 + 1] << 8) | src[(i << 1) + (gUnknown_03005000.unk_6c.unk_02 - 1) * 12 + 0]; + if ((u8)gRecvCmds[mpId][0] == gUnknown_03005000.unk_6c.unk_02 - 1) + { + if (gUnknown_03005000.unk_80[mpId].unk_08 != gUnknown_082ED628[gUnknown_03005000.unk_80[mpId].unk_02]) + { + sub_800F638(mpId, gUnknown_03005000.unk_80[mpId].unk_08); + gUnknown_02022B44.unk_64++; + } + else + gUnknown_03005000.unk_00 = NULL; + } + } + else + gUnknown_03005000.unk_00 = NULL; +} From b8ad1a0fc4b63bc2f2ec5734799fbfde7273420d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 12:00:56 -0500 Subject: [PATCH 113/123] through sub_8010198 --- asm/link_rfu.s | 97 ---------------------------------------------- include/link_rfu.h | 3 +- src/link_rfu.c | 41 ++++++++++++++++++++ 3 files changed, 43 insertions(+), 98 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 3d85d8a7d..91d45b87a 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,103 +5,6 @@ .text - thumb_func_start sub_8010100 -sub_8010100: @ 8010100 - push {lr} - ldr r1, =gUnknown_03005000 - adds r1, 0x5A - strb r0, [r1] - movs r0, 0xA1 - lsls r0, 8 - bl sub_800FD14 - movs r0, 0x1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8010100 - - thumb_func_start sub_801011C -sub_801011C: @ 801011C - push {lr} - bl rfu_clearAllSlot - bl sub_800C048 - ldr r1, =gReceivedRemoteLinkPlayers - movs r0, 0 - strb r0, [r1] - ldr r2, =gUnknown_03005000 - adds r3, r2, 0 - adds r3, 0xEF - movs r1, 0 - movs r0, 0x1 - strb r0, [r3] - str r1, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_801011C - - thumb_func_start sub_8010148 -sub_8010148: @ 8010148 - push {lr} - ldr r0, =gUnknown_03007890 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - ldrb r0, [r0, 0x3] - orrs r0, r1 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - bl sub_801011C - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010148 - - thumb_func_start sub_8010168 -sub_8010168: @ 8010168 - push {r4,lr} - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0 - bne _08010188 - bl sub_800D630 - ldr r0, =0x00000ce4 - adds r1, r4, r0 - movs r0, 0x2 - strb r0, [r1] - b _0801018C - .pool -_08010188: - ldr r0, =sub_8010148 - str r0, [r4] -_0801018C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010168 - - thumb_func_start sub_8010198 -sub_8010198: @ 8010198 - push {lr} - bl sub_800D630 - ldr r2, =gUnknown_03005000 - ldr r0, =0x00000ce4 - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =gUnknown_03007890 - ldr r1, [r0] - ldrb r0, [r1, 0x2] - ldrb r1, [r1, 0x3] - orrs r0, r1 - ldr r1, =0x00000ce3 - adds r2, r1 - strb r0, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010198 - thumb_func_start sub_80101CC sub_80101CC: @ 80101CC push {r4,r5,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index a5d237b9f..3b6ff4e67 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -161,7 +161,8 @@ struct UnkRfuStruct_2 { /* 0x0e4 */ u8 unk_e4[5]; /* 0x0e9 */ u8 unk_e9[5]; /* 0x0ee */ vu8 unk_ee; - /* 0x0ef */ u8 filler_ef[3]; + /* 0x0ef */ u8 unk_ef; + /* 0x0f0 */ u8 filler_f0[2]; /* 0x0f2 */ u16 unk_f2[6]; /* 0x0fe */ u8 filler_fe[2]; /* 0x100 */ u16 unk_100; diff --git a/src/link_rfu.c b/src/link_rfu.c index 1a57ff872..e2d08a514 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -3846,3 +3846,44 @@ void rfufunc_80FA020(void) else gUnknown_03005000.unk_00 = NULL; } + +bool8 sub_8010100(u8 a0) +{ + gUnknown_03005000.unk_5a = a0; + sub_800FD14(0xa100); + return TRUE; +} + +void sub_801011C(void) +{ + rfu_clearAllSlot(); + sub_800C048(); + gReceivedRemoteLinkPlayers = 0; + gUnknown_03005000.unk_ef = 1; + gUnknown_03005000.unk_00 = NULL; +} + +void sub_8010148(void) +{ + rfu_REQ_disconnect(gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03); + rfu_waitREQComplete(); + sub_801011C(); +} + +void sub_8010168(void) +{ + if (gUnknown_03005000.unk_0c == 0) + { + sub_800D630(); + gUnknown_03005000.unk_ce4 = 2; + } + else + gUnknown_03005000.unk_00 = sub_8010148; +} + +void sub_8010198(void) +{ + sub_800D630(); + gUnknown_03005000.unk_ce4 = 1; + gUnknown_03005000.unk_ce3 = gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03; +} From c5096c81add4aa23157a16ba66934973aadf3045 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 14:29:13 -0500 Subject: [PATCH 114/123] through task_add_05_task_del_08FA224_when_no_RfuFunc --- asm/link_rfu.s | 116 ------------------------------------------------- src/link_rfu.c | 50 +++++++++++++++++++++ 2 files changed, 50 insertions(+), 116 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 91d45b87a..bb9506eb8 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,122 +5,6 @@ .text - thumb_func_start sub_80101CC -sub_80101CC: @ 80101CC - push {r4,r5,lr} - ldr r0, =gUnknown_03005000 - ldrb r5, [r0, 0xD] - movs r2, 0 - movs r1, 0 - adds r3, r0, 0 - adds r4, r3, 0 - adds r4, 0xE4 -_080101DC: - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _080101E6 - adds r2, 0x1 -_080101E6: - adds r1, 0x1 - cmp r1, 0x4 - ble _080101DC - cmp r2, r5 - bne _08010220 - ldr r2, =gBattleTypeFlags - ldr r0, [r2] - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - str r0, [r2] - ldrb r0, [r3, 0xC] - cmp r0, 0 - bne _0801021C - adds r0, r3, 0 - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0x3 - strb r1, [r0] - bl sub_8010168 - b _08010220 - .pool -_0801021C: - ldr r0, =sub_8010168 - str r0, [r3] -_08010220: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80101CC - - thumb_func_start sub_801022C -sub_801022C: @ 801022C - push {r4,lr} - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - bne _0801024E - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ce8 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0801024E - movs r0, 0xBE - lsls r0, 7 - bl sub_800FD14 - ldr r0, =sub_80101CC - str r0, [r4] -_0801024E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801022C - - thumb_func_start sub_8010264 -sub_8010264: @ 8010264 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r2, =gUnknown_03005000 - ldr r0, [r2] - cmp r0, 0 - bne _08010284 - ldr r1, =0x00000cd9 - adds r0, r2, r1 - movs r1, 0x1 - strb r1, [r0] - ldr r0, =sub_801022C - str r0, [r2] - adds r0, r3, 0 - bl DestroyTask -_08010284: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010264 - - thumb_func_start task_add_05_task_del_08FA224_when_no_RfuFunc -task_add_05_task_del_08FA224_when_no_RfuFunc: @ 8010294 - push {r4,lr} - ldr r4, =sub_8010264 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080102AC - adds r0, r4, 0 - movs r1, 0x5 - bl CreateTask -_080102AC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_add_05_task_del_08FA224_when_no_RfuFunc - thumb_func_start sub_80102B8 sub_80102B8: @ 80102B8 push {r4,r5,lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index e2d08a514..285f4f9ea 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2,6 +2,7 @@ // Includes #include "global.h" #include "malloc.h" +#include "battle.h" #include "berry_blender.h" #include "task.h" #include "random.h" @@ -3887,3 +3888,52 @@ void sub_8010198(void) gUnknown_03005000.unk_ce4 = 1; gUnknown_03005000.unk_ce3 = gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03; } + +void sub_80101CC(void) +{ + int i; + u8 playerCount = gUnknown_03005000.playerCount; + int count = 0; + + for (i = 0; i < MAX_RFU_PLAYERS; i++) + { + if (gUnknown_03005000.unk_e4[i]) + count++; + } + if (count == playerCount) + { + gBattleTypeFlags &= ~BATTLE_TYPE_20; + if (gUnknown_03005000.unk_0c == 0) + { + gUnknown_03005000.unk_ee = 3; + sub_8010168(); + } + else + gUnknown_03005000.unk_00 = sub_8010168; + } +} + +void sub_801022C(void) +{ + if (gSendCmd[0] == 0 && gUnknown_03005000.unk_ce8 == 0) + { + sub_800FD14(0x5f00); + gUnknown_03005000.unk_00 = sub_80101CC; + } +} + +void sub_8010264(u8 taskId) +{ + if (gUnknown_03005000.unk_00 == 0) + { + gUnknown_03005000.unk_cd9 = 1; + gUnknown_03005000.unk_00 = sub_801022C; + DestroyTask(taskId); + } +} + +void task_add_05_task_del_08FA224_when_no_RfuFunc(void) +{ + if (!FuncIsActiveTask(sub_8010264)) + CreateTask(sub_8010264, 5); +} From aa6ffc5ba1c605c3ddbf9abd8dd96d3b16348ed6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 14:59:34 -0500 Subject: [PATCH 115/123] through sub_8010528 --- asm/link_rfu.s | 332 --------------------------------------------- include/link_rfu.h | 5 +- src/link_rfu.c | 134 +++++++++++++++++- 3 files changed, 135 insertions(+), 336 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index bb9506eb8..1a964417b 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,338 +5,6 @@ .text - thumb_func_start sub_80102B8 -sub_80102B8: @ 80102B8 - push {r4,r5,lr} - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _080102E6 - ldr r1, =gUnknown_03005000 - ldr r2, =0x000009e6 - adds r0, r1, r2 - ldrb r0, [r0] - adds r4, r0, 0 - cmp r4, 0 - bne _080102E6 - adds r5, r1, 0 - adds r5, 0xFE - ldrh r0, [r5] - cmp r0, 0x3C - bls _080102E6 - movs r0, 0xCC - lsls r0, 7 - bl sub_800FD14 - strh r4, [r5] -_080102E6: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - cmp r1, r2 - bcs _08010312 - ldr r0, =gUnknown_03005000 - adds r3, r0, 0 - adds r3, 0xE9 - ldrb r0, [r3] - cmp r0, 0 - beq _08010312 -_08010300: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r2 - bcs _08010312 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _08010300 -_08010312: - ldr r4, =gUnknown_03005000 - cmp r1, r2 - bne _0801033E - movs r1, 0 - adds r3, r4, 0 - adds r3, 0xE9 - movs r2, 0 -_08010320: - adds r0, r1, r3 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x4 - bls _08010320 - movs r1, 0x80 - lsls r1, 1 - adds r0, r4, r1 - ldrh r1, [r0] - adds r1, 0x1 - movs r2, 0 - strh r1, [r0] - str r2, [r4] -_0801033E: - adds r1, r4, 0 - adds r1, 0xFE - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80102B8 - - thumb_func_start sub_8010358 -sub_8010358: @ 8010358 - push {r4,lr} - ldr r4, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0801037A - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - bne _0801037A - movs r0, 0xCC - lsls r0, 7 - bl sub_800FD14 - ldr r0, =sub_80102B8 - str r0, [r4] -_0801037A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010358 - - thumb_func_start sub_8010390 -sub_8010390: @ 8010390 - push {r4,lr} - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _080103CC - ldr r4, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0801041E - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - bne _0801041E - movs r0, 0xCC - lsls r0, 7 - bl sub_800FD14 - ldr r0, =sub_80102B8 - b _0801041C - .pool -_080103CC: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0x1 - cmp r1, r2 - bcs _080103FA - ldr r3, =gUnknown_03005000 - adds r0, r3, 0 - adds r0, 0xEA - ldrb r0, [r0] - cmp r0, 0 - beq _080103FA - adds r3, 0xE9 -_080103E8: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r2 - bcs _080103FA - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _080103E8 -_080103FA: - cmp r1, r2 - bne _0801041E - ldr r4, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0801041E - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - bne _0801041E - movs r0, 0xCC - lsls r0, 7 - bl sub_800FD14 - ldr r0, =sub_8010358 -_0801041C: - str r0, [r4] -_0801041E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010390 - - thumb_func_start sub_8010434 -sub_8010434: @ 8010434 - push {lr} - ldr r1, =gUnknown_03005000 - ldr r2, [r1] - cmp r2, 0 - bne _08010448 - ldr r0, =sub_8010390 - str r0, [r1] - adds r0, r1, 0 - adds r0, 0xFE - strh r2, [r0] -_08010448: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010434 - - thumb_func_start sub_8010454 -sub_8010454: @ 8010454 - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gUnknown_082ED6E0 - ldrh r0, [r1] - cmp r0, r3 - beq _08010482 - ldr r4, =0x0000ffff - adds r2, r1, 0 -_08010464: - ldrh r0, [r2] - cmp r0, r4 - bne _08010478 - movs r0, 0 - b _08010484 - .pool -_08010478: - adds r1, 0x2 - adds r2, 0x2 - ldrh r0, [r1] - cmp r0, r3 - bne _08010464 -_08010482: - movs r0, 0x1 -_08010484: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8010454 - - thumb_func_start sub_801048C -sub_801048C: @ 801048C - push {lr} - cmp r0, 0 - beq _080104A0 - movs r1, 0x96 - lsls r1, 2 - movs r0, 0x1 - bl sub_800D550 - movs r0, 0 - b _080104AC -_080104A0: - movs r0, 0 - movs r1, 0 - bl sub_800D550 - lsls r0, 24 - lsrs r0, 24 -_080104AC: - pop {r1} - bx r1 - thumb_func_end sub_801048C - - thumb_func_start sub_80104B0 -sub_80104B0: @ 80104B0 - push {lr} - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cd9 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - movs r0, 0 - bl sub_800C27C - pop {r0} - bx r0 - .pool - thumb_func_end sub_80104B0 - - thumb_func_start rfu_get_multiplayer_id -rfu_get_multiplayer_id: @ 80104D0 - push {lr} - ldr r1, =gUnknown_03005000 - ldrb r0, [r1, 0xC] - cmp r0, 0x1 - beq _080104EC - ldr r2, =0x00000cce - adds r0, r1, r2 - ldrb r0, [r0] - b _080104EE - .pool -_080104EC: - movs r0, 0 -_080104EE: - pop {r1} - bx r1 - thumb_func_end rfu_get_multiplayer_id - - thumb_func_start sub_80104F4 -sub_80104F4: @ 80104F4 - ldr r0, =gUnknown_03005000 - ldrb r0, [r0, 0xD] - bx lr - .pool - thumb_func_end sub_80104F4 - - thumb_func_start sub_8010500 -sub_8010500: @ 8010500 - push {lr} - ldr r2, =gUnknown_03005000 - adds r0, r2, 0 - adds r0, 0xF1 - ldrb r0, [r0] - cmp r0, 0x2 - bne _08010518 - movs r0, 0 - b _08010524 - .pool -_08010518: - movs r1, 0 - ldr r0, [r2] - cmp r0, 0 - bne _08010522 - movs r1, 0x1 -_08010522: - adds r0, r1, 0 -_08010524: - pop {r1} - bx r1 - thumb_func_end sub_8010500 - - thumb_func_start sub_8010528 -sub_8010528: @ 8010528 - push {lr} - ldr r0, =gUnknown_03005000 - ldr r0, [r0] - cmp r0, 0 - beq _08010536 - bl _call_via_r0 -_08010536: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010528 - thumb_func_start sub_8010540 sub_8010540: @ 8010540 push {r4-r7,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 3b6ff4e67..7a79b8008 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -162,9 +162,10 @@ struct UnkRfuStruct_2 { /* 0x0e9 */ u8 unk_e9[5]; /* 0x0ee */ vu8 unk_ee; /* 0x0ef */ u8 unk_ef; - /* 0x0f0 */ u8 filler_f0[2]; + /* 0x0f0 */ u8 unk_f0; + /* 0x0f1 */ u8 unk_f1; /* 0x0f2 */ u16 unk_f2[6]; - /* 0x0fe */ u8 filler_fe[2]; + /* 0x0fe */ u16 unk_fe; /* 0x100 */ u16 unk_100; /* 0x102 */ u8 unk_102; /* 0x103 */ u8 filler_103[0x21]; diff --git a/src/link_rfu.c b/src/link_rfu.c index 285f4f9ea..aa5e114da 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -62,7 +62,7 @@ void sub_800FD14(u16 command); void rfufunc_80F9F44(void); void sub_800FFB0(void); void rfufunc_80FA020(void); -bool32 sub_8010454(u16 a0); +bool32 sub_8010454(u32 a0); void sub_8010528(void); void sub_8010750(void); int sub_80107A0(void); @@ -3924,7 +3924,7 @@ void sub_801022C(void) void sub_8010264(u8 taskId) { - if (gUnknown_03005000.unk_00 == 0) + if (gUnknown_03005000.unk_00 == NULL) { gUnknown_03005000.unk_cd9 = 1; gUnknown_03005000.unk_00 = sub_801022C; @@ -3937,3 +3937,133 @@ void task_add_05_task_del_08FA224_when_no_RfuFunc(void) if (!FuncIsActiveTask(sub_8010264)) CreateTask(sub_8010264, 5); } + +void sub_80102B8(void) +{ + u8 playerCount; + u8 i; + + if (GetMultiplayerId() != 0) + { + u8 r4 = gUnknown_03005000.unk_124.unk_8c2; + if (r4 == 0 && gUnknown_03005000.unk_fe > 0x3c) + { + sub_800FD14(0x6600); + gUnknown_03005000.unk_fe = r4; + } + } + playerCount = GetLinkPlayerCount(); + for (i = 0; i < playerCount; i++) + { + if (gUnknown_03005000.unk_e9[i] == 0) + break; + } + if (i == playerCount) + { + for (i = 0; i < MAX_RFU_PLAYERS; i++) + gUnknown_03005000.unk_e9[i] = 0; + gUnknown_03005000.unk_100++; + gUnknown_03005000.unk_00 = NULL; + } + gUnknown_03005000.unk_fe++; +} + +void sub_8010358(void) +{ + if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0) + { + sub_800FD14(0x6600); + gUnknown_03005000.unk_00 = sub_80102B8; + } +} + +void sub_8010390(void) +{ + u8 i; + u8 playerCount; + + if (GetMultiplayerId() != 0) + { + if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0) + { + sub_800FD14(0x6600); + gUnknown_03005000.unk_00 = sub_80102B8; + } + } + else + { + playerCount = GetLinkPlayerCount(); + for (i = 1; i < playerCount; i++) + { + if (gUnknown_03005000.unk_e9[i] == 0) + break; + } + if (i == playerCount) + { + if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0) + { + sub_800FD14(0x6600); + gUnknown_03005000.unk_00 = sub_8010358; + } + } + } +} + +void sub_8010434(void) +{ + if (gUnknown_03005000.unk_00 == NULL) + { + gUnknown_03005000.unk_00 = sub_8010390; + gUnknown_03005000.unk_fe = 0; + } +} + +bool32 sub_8010454(u32 a0) +{ + int i; + for (i = 0; gUnknown_082ED6E0[i] != a0; i++) + { + if (gUnknown_082ED6E0[i] == 0xffff) + return FALSE; + } + return TRUE; +} + +u8 sub_801048C(bool32 a0) +{ + if (a0 == 0) + return sub_800D550(0, 0); + sub_800D550(1, 0x258); + return FALSE; +} + +void sub_80104B0(void) +{ + gUnknown_03005000.unk_cd9 = 1; + sub_800C27C(FALSE); +} + +u8 rfu_get_multiplayer_id(void) +{ + if (gUnknown_03005000.unk_0c == 1) + return 0; + return gUnknown_03005000.unk_cce; +} + +u8 sub_80104F4(void) +{ + return gUnknown_03005000.playerCount; +} + +bool8 sub_8010500(void) +{ + if (gUnknown_03005000.unk_f1 == 2) + return FALSE; + return gUnknown_03005000.unk_00 ? FALSE : TRUE; +} + +void sub_8010528(void) +{ + if (gUnknown_03005000.unk_00) + gUnknown_03005000.unk_00(); +} From a8e8bfb4c8868d3dd8cf0c5ead8af81acd8a17f0 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 15:50:45 -0500 Subject: [PATCH 116/123] through sub_8010750 --- asm/link_rfu.s | 300 --------------------------------------------- include/librfu.h | 1 + include/link_rfu.h | 6 +- src/link_rfu.c | 123 +++++++++++++++++-- 4 files changed, 120 insertions(+), 310 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 1a964417b..ff5553ce2 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,306 +5,6 @@ .text - thumb_func_start sub_8010540 -sub_8010540: @ 8010540 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r7, 0 - movs r5, 0 - ldr r6, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r0, r6 - mov r8, r0 -_08010552: - ldr r1, =0x00000cd1 - adds r0, r6, r1 - adds r4, r5, r0 - ldrb r0, [r4] - subs r0, 0x5 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _080105DA - ldr r1, =gUnknown_03007880 - lsls r0, r5, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x46 - beq _08010576 - cmp r0, 0x48 - bne _080105C0 -_08010576: - ldr r2, =0x00000cd5 - adds r0, r6, r2 - adds r1, r5, r0 - ldrb r0, [r1] - cmp r0, 0x8 - bne _080105DA - movs r0, 0x9 - strb r0, [r4] - movs r0, 0xA - strb r0, [r1] - lsls r1, r5, 24 - lsrs r1, 24 - movs r0, 0x8 - bl rfu_clearSlot - movs r0, 0x80 - lsls r0, 17 - lsls r0, r5 - lsrs r0, 24 - movs r1, 0x8 - adds r2, r4, 0 - movs r3, 0x1 - bl rfu_NI_setSendData - movs r7, 0x1 - b _080105DA - .pool -_080105C0: - mov r2, r8 - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x47 - bne _080105DA - lsls r1, r5, 24 - lsrs r1, 24 - movs r0, 0x8 - bl rfu_clearSlot -_080105DA: - adds r5, 0x1 - cmp r5, 0x3 - ble _08010552 - adds r0, r7, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8010540 - - thumb_func_start sub_80105EC -sub_80105EC: @ 80105EC - push {r4-r6,lr} - movs r3, 0 - movs r1, 0 - ldr r5, =gUnknown_03005000+0xCD5 - movs r6, 0x1 - movs r4, 0 -_080105F8: - adds r2, r1, r5 - ldrb r0, [r2] - cmp r0, 0xB - bne _0801060C - adds r0, r6, 0 - lsls r0, r1 - orrs r3, r0 - lsls r0, r3, 24 - lsrs r3, r0, 24 - strb r4, [r2] -_0801060C: - adds r1, 0x1 - cmp r1, 0x3 - ble _080105F8 - cmp r3, 0 - beq _08010620 - adds r0, r3, 0 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete -_08010620: - movs r1, 0 - ldr r2, =gUnknown_03005000+0xCD5 -_08010624: - adds r0, r1, r2 - ldrb r0, [r0] - subs r0, 0xA - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0801063C - movs r0, 0x1 - b _08010644 - .pool -_0801063C: - adds r1, 0x1 - cmp r1, 0x3 - ble _08010624 - movs r0, 0 -_08010644: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80105EC - - thumb_func_start sub_801064C -sub_801064C: @ 801064C - push {lr} - adds r2, r0, 0 - adds r0, r1, 0 - lsls r2, 16 - lsrs r2, 16 - adds r1, r2, 0 - bl sub_8011CE4 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - beq _08010680 - ldr r0, =gUnknown_03005000 - ldr r2, =0x00000cd1 - adds r0, r2 - adds r0, r1, r0 - ldrb r0, [r0] - cmp r0, 0x9 - beq _08010680 - movs r0, 0 - b _08010682 - .pool -_08010680: - movs r0, 0x1 -_08010682: - pop {r1} - bx r1 - thumb_func_end sub_801064C - - thumb_func_start sub_8010688 -sub_8010688: @ 8010688 - push {r4-r6,lr} - adds r6, r0, 0 - adds r0, r2, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 16 - lsrs r1, 16 - bl sub_8011CE4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_03005000 - ldr r0, =0x00000cd1 - adds r5, r0 - adds r5, r4, r5 - strb r6, [r5] - movs r0, 0x4 - adds r1, r4, 0 - bl rfu_clearSlot - movs r0, 0x80 - lsls r0, 17 - lsls r0, r4 - lsrs r0, 24 - movs r1, 0x8 - adds r2, r5, 0 - movs r3, 0x1 - bl rfu_NI_setSendData - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010688 - - thumb_func_start sub_80106D4 -sub_80106D4: @ 80106D4 - push {r4,r5,lr} - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000c85 - adds r5, r4, r0 - movs r0, 0x8 - strb r0, [r5] - ldr r0, =0x00000c3e - adds r4, r0 - ldrb r1, [r4] - movs r0, 0x4 - bl rfu_clearSlot - ldrb r1, [r4] - movs r0, 0x80 - lsls r0, 17 - lsls r0, r1 - lsrs r0, 24 - movs r1, 0x8 - adds r2, r5, 0 - movs r3, 0x1 - bl rfu_NI_setSendData - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80106D4 - - thumb_func_start sub_8010714 -sub_8010714: @ 8010714 - push {lr} - adds r2, r0, 0 - adds r0, r1, 0 - lsls r2, 16 - lsrs r2, 16 - adds r1, r2, 0 - bl sub_8011CE4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _08010730 - movs r0, 0x2 - b _0801074A -_08010730: - ldr r1, =gUnknown_03007880 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0 - beq _08010748 - movs r0, 0 - b _0801074A - .pool -_08010748: - movs r0, 0x1 -_0801074A: - pop {r1} - bx r1 - thumb_func_end sub_8010714 - - thumb_func_start sub_8010750 -sub_8010750: @ 8010750 - push {r4,r5,lr} - bl sub_8010540 - movs r4, 0 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cd5 - adds r5, r0, r1 -_0801075E: - ldr r1, =gUnknown_03007880 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - ldrh r0, [r0] - subs r0, 0x26 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bhi _08010788 - adds r1, r4, r5 - ldrb r0, [r1] - cmp r0, 0xA - bne _0801077E - movs r0, 0xB - strb r0, [r1] -_0801077E: - lsls r1, r4, 24 - lsrs r1, 24 - movs r0, 0x4 - bl rfu_clearSlot -_08010788: - adds r4, 0x1 - cmp r4, 0x3 - ble _0801075E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010750 - thumb_func_start sub_80107A0 sub_80107A0: @ 80107A0 push {r4,r5,lr} diff --git a/include/librfu.h b/include/librfu.h index 88cbe2d3d..9dd547eee 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -223,3 +223,4 @@ void rfu_REQ_recvData(void); void rfu_UNI_readySendData(u8 a0); void rfu_UNI_clearRecvNewDataFlag(u8 a0); void rfu_REQ_PARENT_resumeRetransmitAndChange(void); +void rfu_NI_setSendData(u8, u8, u8 *, u8); diff --git a/include/link_rfu.h b/include/link_rfu.h index 7a79b8008..b14a889bc 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -176,13 +176,15 @@ struct UnkRfuStruct_2 { /* 0xc3d */ u8 unk_c3d; /* 0xc3e */ vu8 unk_c3e; /* 0xc3f */ u8 unk_c3f[70]; - /* 0xc85 */ u8 filler_c85[2]; + /* 0xc85 */ u8 unk_c85; + /* 0xc86 */ u8 unk_c86; /* 0xc87 */ u8 unk_c87[5][7][2]; /* 0xccd */ u8 unk_ccd; /* 0xcce */ u8 unk_cce; /* 0xccf */ u8 unk_ccf; /* 0xcd0 */ vu8 unk_cd0; - /* 0xcd1 */ u8 filler_cd1[8]; + /* 0xcd1 */ u8 unk_cd1[4]; + /* 0xcd5 */ u8 unk_cd5[4]; /* 0xcd9 */ u8 unk_cd9; /* 0xcda */ u8 unk_cda; /* 0xcdb */ vu8 unk_cdb; diff --git a/src/link_rfu.c b/src/link_rfu.c index aa5e114da..0842818b4 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -59,11 +59,11 @@ static void sub_800F048(void); static void sub_800F86C(u8 unused); static void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data); void sub_800FD14(u16 command); -void rfufunc_80F9F44(void); -void sub_800FFB0(void); -void rfufunc_80FA020(void); +static void rfufunc_80F9F44(void); +static void sub_800FFB0(void); +static void rfufunc_80FA020(void); bool32 sub_8010454(u32 a0); -void sub_8010528(void); +static void sub_8010528(void); void sub_8010750(void); int sub_80107A0(void); void sub_801084C(u8 taskId); @@ -71,6 +71,7 @@ void sub_80109E8(u16 a0); void sub_8010A70(void *a0); void sub_8010AAC(u8 taskId); void sub_8010D0C(u8 taskId); +u8 sub_8011CE4(const u8 *a0, u16 a1); void sub_8011D6C(u8 a0); u8 sub_8012224(void); void sub_801227C(void); @@ -3790,7 +3791,7 @@ bool32 sub_800FE84(const u8 *src, size_t size) return TRUE; } -void rfufunc_80F9F44(void) +static void rfufunc_80F9F44(void) { if (gSendCmd[0] == 0) { @@ -3808,7 +3809,7 @@ void rfufunc_80F9F44(void) } } -void sub_800FFB0(void) +static void sub_800FFB0(void) { int i; const u8 *src = gUnknown_03005000.unk_6c.unk_04; @@ -3823,7 +3824,7 @@ void sub_800FFB0(void) } } -void rfufunc_80FA020(void) +static void rfufunc_80FA020(void) { const u8 *src = gUnknown_03005000.unk_6c.unk_04; u8 mpId = GetMultiplayerId(); @@ -4062,8 +4063,114 @@ bool8 sub_8010500(void) return gUnknown_03005000.unk_00 ? FALSE : TRUE; } -void sub_8010528(void) +static void sub_8010528(void) { if (gUnknown_03005000.unk_00) gUnknown_03005000.unk_00(); } + +bool8 sub_8010540(void) +{ + int i; + bool8 retval = FALSE; + for (i = 0; i < 4; i++) + { + if (gUnknown_03005000.unk_cd1[i] < 5 || gUnknown_03005000.unk_cd1[i] > 6) + { + if (gUnknown_03007880[i]->unk_34 == 0x46 || gUnknown_03007880[i]->unk_34 == 0x48) + { + if (gUnknown_03005000.unk_cd5[i] == 8) + { + gUnknown_03005000.unk_cd1[i] = 9; + gUnknown_03005000.unk_cd5[i] = 10; + rfu_clearSlot(8, i); + rfu_NI_setSendData(1 << i, 8, gUnknown_03005000.unk_cd1 + i, 1); + retval = TRUE; + } + + } + else if (gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_34 == 0x47) + rfu_clearSlot(8, i); + { + + } + } + } + return retval; +} + +bool8 sub_80105EC(void) +{ + u8 flags = 0; + int i; + for (i = 0; i < 4; i++) + { + if (gUnknown_03005000.unk_cd5[i] == 11) + { + flags |= (1 << i); + gUnknown_03005000.unk_cd5[i] = 0; + } + } + if (flags) + { + rfu_REQ_disconnect(flags); + rfu_waitREQComplete(); + } + for (i = 0; i < 4; i++) + { + if (gUnknown_03005000.unk_cd5[i] == 10 || gUnknown_03005000.unk_cd5[i] == 11) + return TRUE; + } + return FALSE; +} + +bool8 sub_801064C(u16 a0, const u8 *a1) +{ + u8 r1 = sub_8011CE4(a1, a0); + if (r1 == 0xFF) + return TRUE; + if (gUnknown_03005000.unk_cd1[r1] == 9) + return TRUE; + return FALSE; +} + +void sub_8010688(u8 a0, u16 a1, const u8 *a2) +{ + u8 r4 = sub_8011CE4(a2, a1); + gUnknown_03005000.unk_cd1[r4] = a0; + rfu_clearSlot(4, r4); + rfu_NI_setSendData(1 << r4, 8, gUnknown_03005000.unk_cd1 + r4, 1); +} + +void sub_80106D4(void) +{ + gUnknown_03005000.unk_c85 = 8; + rfu_clearSlot(4, gUnknown_03005000.unk_c3e); + rfu_NI_setSendData(1 << gUnknown_03005000.unk_c3e, 8, &gUnknown_03005000.unk_c85, 1); +} + +u8 sub_8010714(u16 a0, const u8 *a1) +{ + u8 r0 = sub_8011CE4(a1, a0); + if (r0 == 0xff) + return 2; + if (gUnknown_03007880[r0]->unk_0 == 0) + return TRUE; + return FALSE; +} + +void sub_8010750(void) +{ + int i; + + sub_8010540(); + for (i = 0; i < 4; i++) + { + if (gUnknown_03007880[i]->unk_0 == 0x26 || gUnknown_03007880[i]->unk_0 == 0x27) + { + if (gUnknown_03005000.unk_cd5[i] == 10) + gUnknown_03005000.unk_cd5[i] = 11; + rfu_clearSlot(4, i); + } + } +} From 95d77c25f390afa8702469b3dfd17c8dc375a3e2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 16:38:44 -0500 Subject: [PATCH 117/123] through sub_801084C --- asm/link_rfu.s | 280 ------------------------------------------------- include/link.h | 2 + src/link.c | 7 +- src/link_rfu.c | 106 +++++++++++++++++++ 4 files changed, 112 insertions(+), 283 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index ff5553ce2..e64801388 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,286 +5,6 @@ .text - thumb_func_start sub_80107A0 -sub_80107A0: @ 80107A0 - push {r4,r5,lr} - movs r4, 0 - ldr r1, =gUnknown_03005000 - ldr r2, =0x00000c85 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x8 - bne _080107DA - ldr r2, =gUnknown_03007880 - ldr r0, =0x00000c3e - adds r1, r0 - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x26 - beq _080107D2 - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0x27 - bne _080107DA -_080107D2: - ldrb r1, [r1] - movs r0, 0x4 - bl rfu_clearSlot -_080107DA: - ldr r2, =gUnknown_03007880 - ldr r5, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r1, r5, r0 - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x46 - beq _080107FE - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x48 - bne _0801082C -_080107FE: - ldrb r1, [r1] - movs r0, 0x8 - bl rfu_clearSlot - ldr r2, =0x00000c86 - adds r4, r5, r2 - ldrb r0, [r4] - movs r1, 0 - bl sub_8011A64 - ldrb r4, [r4] - b _08010844 - .pool -_0801082C: - ldrb r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0, 0x34] - cmp r0, 0x47 - bne _08010844 - ldrb r1, [r1] - movs r0, 0x8 - bl rfu_clearSlot - movs r4, 0x6 -_08010844: - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80107A0 - - thumb_func_start sub_801084C -sub_801084C: @ 801084C - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r5, =gUnknown_03005000 - adds r0, r5, 0 - adds r0, 0xF1 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08010872 - ldr r0, =0x00000ce8 - adds r1, r5, r0 - movs r0, 0 - strb r0, [r1] - adds r0, r6, 0 - bl DestroyTask -_08010872: - ldr r2, =gTasks - lsls r1, r6, 2 - adds r0, r1, r6 - lsls r0, 3 - adds r4, r0, r2 - movs r2, 0x8 - ldrsh r0, [r4, r2] - adds r7, r1, 0 - cmp r0, 0x3 - beq _0801091C - cmp r0, 0x3 - bgt _080108A4 - cmp r0, 0x1 - beq _080108CC - cmp r0, 0x1 - bgt _08010918 - cmp r0, 0 - beq _080108B6 - b _080109D2 - .pool -_080108A4: - cmp r0, 0x5 - beq _08010950 - cmp r0, 0x5 - blt _0801093E - cmp r0, 0x6 - beq _08010984 - cmp r0, 0x65 - beq _08010904 - b _080109D2 -_080108B6: - bl sub_800FC60 - lsls r0, 24 - cmp r0, 0 - bne _080108C2 - b _080109D2 -_080108C2: - bl ResetBlockReceivedFlags - bl sub_800B348 - b _08010948 -_080108CC: - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - bne _0801090C - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080108E8 - movs r0, 0xF0 - lsls r0, 7 - bl sub_800FD14 - b _080108F0 - .pool -_080108E8: - movs r0, 0xEE - lsls r0, 7 - bl sub_800FD14 -_080108F0: - ldr r0, =gTasks - adds r1, r7, r6 - lsls r1, 3 - adds r1, r0 - movs r0, 0x65 - strh r0, [r1, 0x8] - b _080109D2 - .pool -_08010904: - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - bne _080109D2 -_0801090C: - movs r0, 0x2 - strh r0, [r4, 0x8] - b _080109D2 - .pool -_08010918: - ldrb r0, [r5, 0xD] - b _08010944 -_0801091C: - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - bne _08010948 - bl sub_800FC60 - lsls r0, 24 - cmp r0, 0 - beq _080109D2 - adds r1, r5, 0 - adds r1, 0x5A - movs r0, 0 - strb r0, [r1] - movs r0, 0xA1 - lsls r0, 8 - bl sub_800FD14 - b _08010948 -_0801093E: - bl sub_800FC88 - lsls r0, 24 -_08010944: - cmp r0, 0 - beq _080109D2 -_08010948: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080109D2 -_08010950: - movs r4, 0 - ldrb r0, [r5, 0xD] - cmp r4, r0 - bge _0801096E -_08010958: - adds r0, r4, 0 - bl sub_800B3A4 - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_800F728 - adds r4, 0x1 - ldrb r2, [r5, 0xD] - cmp r4, r2 - blt _08010958 -_0801096E: - ldr r0, =gTasks - adds r1, r7, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080109D2 - .pool -_08010984: - adds r0, r6, 0 - bl DestroyTask - ldr r1, =gReceivedRemoteLinkPlayers - movs r0, 0x1 - strb r0, [r1] - ldr r0, =0x00000ce8 - adds r1, r5, r0 - movs r0, 0 - strb r0, [r1] - movs r1, 0x96 - lsls r1, 2 - movs r0, 0x1 - bl sub_800D550 - ldr r2, =0x00000ce6 - adds r1, r5, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _080109D2 - movs r4, 0 - adds r2, r1, 0 - movs r3, 0x1 - ldr r0, =0x00000ce5 - adds r5, r0 -_080109B6: - ldrb r0, [r2] - asrs r0, r4 - ands r0, r3 - cmp r0, 0 - beq _080109CC - adds r0, r3, 0 - lsls r0, r4 - strb r0, [r5] - ldrb r1, [r2] - eors r0, r1 - strb r0, [r2] -_080109CC: - adds r4, 0x1 - cmp r4, 0x3 - ble _080109B6 -_080109D2: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801084C - thumb_func_start sub_80109E8 sub_80109E8: @ 80109E8 push {r4,r5,lr} diff --git a/include/link.h b/include/link.h index 918a7480b..43a09863e 100644 --- a/include/link.h +++ b/include/link.h @@ -249,6 +249,8 @@ void SetSuppressLinkErrorMessage(bool8 flag); void sub_800B524(struct LinkPlayer *linkPlayer); u8 GetSioMultiSI(void); void sub_800AAF4(void); +void sub_800B348(void); +void sub_800B3A4(u32 who); extern u16 gLinkPartnersHeldKeys[6]; extern u32 gLinkDebugSeed; diff --git a/src/link.c b/src/link.c index c59691bc8..1e8332f57 100644 --- a/src/link.c +++ b/src/link.c @@ -1812,13 +1812,14 @@ void sub_800B348(void) memcpy(gBlockSendBuffer, block, sizeof(*block)); } -void sub_800B3A4(u8 who) +void sub_800B3A4(u32 who) { + u8 who_ = who; struct LinkPlayerBlock *block; struct LinkPlayer *player; - block = (struct LinkPlayerBlock *)gBlockRecvBuffer[who]; - player = &gLinkPlayers[who]; + block = (struct LinkPlayerBlock *)gBlockRecvBuffer[who_]; + player = &gLinkPlayers[who_]; *player = block->linkPlayer; sub_800B524(player); if (strcmp(block->magic1, gASCIIGameFreakInc) != 0 || strcmp(block->magic2, gASCIIGameFreakInc) != 0) diff --git a/src/link_rfu.c b/src/link_rfu.c index 0842818b4..b666ffc39 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -4174,3 +4174,109 @@ void sub_8010750(void) } } } + +int sub_80107A0(void) +{ + int retval = 0; + if (gUnknown_03005000.unk_c85 == 8) + { + if (gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_0 == 0x26 || gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_0 == 0x27) + rfu_clearSlot(4, gUnknown_03005000.unk_c3e); + } + if (gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_34 == 0x46 || gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_34 == 0x48) + { + rfu_clearSlot(8, gUnknown_03005000.unk_c3e); + sub_8011A64(gUnknown_03005000.unk_c86, 0); + retval = gUnknown_03005000.unk_c86; + } + else if (gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_34 == 0x47) + { + rfu_clearSlot(8, gUnknown_03005000.unk_c3e); + retval = 6; + } + return retval; +} + +void sub_801084C(u8 taskId) +{ + int i; + + if (gUnknown_03005000.unk_f1 == 1 || gUnknown_03005000.unk_f1 == 2) + { + gUnknown_03005000.unk_ce8 = 0; + DestroyTask(taskId); + } + switch (gTasks[taskId].data[0]) + { + case 0: + if (sub_800FC60()) + { + ResetBlockReceivedFlags(); + sub_800B348(); + gTasks[taskId].data[0]++; + } + break; + case 1: + if (gUnknown_03005000.unk_0c == 1) + { + if (gReceivedRemoteLinkPlayers) + sub_800FD14(0x7800); + else + sub_800FD14(0x7700); + gTasks[taskId].data[0] = 101; + } + else + gTasks[taskId].data[0] = 2; + break; + case 101: + if (gSendCmd[0] == 0) + gTasks[taskId].data[0] = 2; + break; + case 2: + if (gUnknown_03005000.playerCount) + gTasks[taskId].data[0]++; + break; + case 3: + if (gUnknown_03005000.unk_0c == 1) + { + if (sub_800FC60()) + { + gUnknown_03005000.unk_5a = 0; + sub_800FD14(0xa100); + gTasks[taskId].data[0]++; + } + } + else + gTasks[taskId].data[0]++; + break; + case 4: + if (sub_800FC88()) + gTasks[taskId].data[0]++; + break; + case 5: + for (i = 0; i < gUnknown_03005000.playerCount; i++) + { + sub_800B3A4(i); + sub_800F728(i); + } + gTasks[taskId].data[0]++; + break; + case 6: + DestroyTask(taskId); + gReceivedRemoteLinkPlayers = 1; + gUnknown_03005000.unk_ce8 = 0; + sub_800D550(1, 0x258); + if (gUnknown_03005000.unk_ce6) + { + for (i = 0; i < 4; i++) + { + if ((gUnknown_03005000.unk_ce6 >> i) & 1) + { + gUnknown_03005000.unk_ce5 = 1 << i; + gUnknown_03005000.unk_ce6 ^= (1 << i); + } + } + } + break; + } +} From ef412145d07e74b2db6555e726a7944f9451c48e Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 17:28:10 -0500 Subject: [PATCH 118/123] through sub_8010A70 --- asm/link_rfu.s | 101 --------------------------------------------- include/link_rfu.h | 8 ++++ src/link.c | 2 +- src/link_rfu.c | 34 +++++++++++++++ 4 files changed, 43 insertions(+), 102 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index e64801388..b46fb0f83 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,107 +5,6 @@ .text - thumb_func_start sub_80109E8 -sub_80109E8: @ 80109E8 - push {r4,r5,lr} - lsls r0, 16 - lsrs r2, r0, 16 - movs r1, 0 - movs r5, 0x1 - ldr r4, =gUnknown_03005000+0xCDE - movs r3, 0 -_080109F6: - adds r0, r2, 0 - asrs r0, r1 - ands r0, r5 - cmp r0, 0 - beq _08010A04 - adds r0, r1, r4 - strb r3, [r0] -_08010A04: - adds r1, 0x1 - cmp r1, 0x3 - ble _080109F6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80109E8 - - thumb_func_start sub_8010A14 -sub_8010A14: @ 8010A14 - push {r4-r7,lr} - adds r2, r0, 0 - ldr r1, =gUnknown_03005000 - ldrb r0, [r2, 0xF] - strb r0, [r1, 0xD] - movs r4, 0 - ldr r0, =0x00000cde - adds r5, r1, r0 - adds r3, r2, 0 - adds r3, 0x10 -_08010A28: - adds r0, r4, r5 - adds r1, r3, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x3 - ble _08010A28 - adds r6, r2, 0 - ldr r5, =gLinkPlayers - movs r4, 0x4 -_08010A3C: - adds r0, r5, 0 - adds r1, r6, 0 - adds r1, 0x14 - ldm r1!, {r2,r3,r7} - stm r0!, {r2,r3,r7} - ldm r1!, {r2,r3,r7} - stm r0!, {r2,r3,r7} - ldr r1, [r1] - str r1, [r0] - adds r0, r5, 0 - bl sub_800B524 - adds r6, 0x1C - adds r5, 0x1C - subs r4, 0x1 - cmp r4, 0 - bge _08010A3C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010A14 - - thumb_func_start sub_8010A70 -sub_8010A70: @ 8010A70 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldr r0, =gUnknown_082ED7EC - adds r1, r4, 0 - bl strcmp - adds r5, r0, 0 - cmp r5, 0 - bne _08010A9C - adds r0, r4, 0 - bl sub_8010A14 - mov r0, sp - strh r5, [r0] - ldr r2, =0x0100007e - adds r1, r4, 0 - bl CpuSet - movs r0, 0 - bl ResetBlockReceivedFlag -_08010A9C: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010A70 - thumb_func_start sub_8010AAC sub_8010AAC: @ 8010AAC push {r4-r7,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index b14a889bc..a53b58d8b 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -203,6 +203,14 @@ struct UnkRfuStruct_2 { /* 0xcee */ u8 unk_cee[4]; }; // size = 0xcf4 +struct UnkRfuStruct_8010A14 { + char unk_00[15]; + u8 unk_0f; + u8 unk_10[4]; + struct LinkPlayer unk_14[4]; + u8 fill_84[0x78]; +}; + // Exported RAM declarations extern struct UnkRfuStruct_1 gUnknown_03004140; diff --git a/src/link.c b/src/link.c index 1e8332f57..65c5d3982 100644 --- a/src/link.c +++ b/src/link.c @@ -26,8 +26,8 @@ #include "sound.h" #include "trade.h" #include "battle.h" -#include "link_rfu.h" #include "link.h" +#include "link_rfu.h" // Static type declarations diff --git a/src/link_rfu.c b/src/link_rfu.c index b666ffc39..0dc253d77 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -4280,3 +4280,37 @@ void sub_801084C(u8 taskId) break; } } + +void sub_80109E8(u16 a0) +{ + int i; + + for (i = 0; i < 4; i++) + { + if ((a0 >> i) & 1) + gUnknown_03005000.unk_cde[i] = 0; + } +} + +void sub_8010A14(const struct UnkRfuStruct_8010A14 *a0) +{ + int i; + gUnknown_03005000.playerCount = a0->unk_0f; + for (i = 0; i < 4; i++) + gUnknown_03005000.unk_cde[i] = a0->unk_10[i]; + for (i = 0; i < MAX_RFU_PLAYERS; i++) + { + gLinkPlayers[i] = a0->unk_14[i]; + sub_800B524(gLinkPlayers + i); + } +} + +void sub_8010A70(void *a0) +{ + if (strcmp(gUnknown_082ED7EC, a0) == 0) + { + sub_8010A14(a0); + CpuFill16(0, a0, sizeof(struct UnkRfuStruct_8010A14)); + ResetBlockReceivedFlag(0); + } +} From 1566dca0c2b0bc8f4bf5dc11d013477051ea9f6b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 18:43:58 -0500 Subject: [PATCH 119/123] through sub_8010EC0 --- asm/link_rfu.s | 507 ------------------------------------------ include/link.h | 4 +- include/link_rfu.h | 11 +- include/rom_8011DC0.h | 12 + src/link_rfu.c | 163 ++++++++++++++ 5 files changed, 184 insertions(+), 513 deletions(-) create mode 100644 include/rom_8011DC0.h diff --git a/asm/link_rfu.s b/asm/link_rfu.s index b46fb0f83..a55ae2d40 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,513 +5,6 @@ .text - thumb_func_start sub_8010AAC -sub_8010AAC: @ 8010AAC - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r3, =gUnknown_03005000 - ldr r2, =gUnknown_082ED68C - ldr r1, =0x00000ce9 - adds r0, r3, r1 - ldrb r1, [r0] - adds r1, r2 - ldr r2, =0x00000cde - adds r0, r3, r2 - ldrb r1, [r1] - adds r0, r1 - ldrb r4, [r0] - adds r0, r3, 0 - adds r0, 0xF1 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08010AE8 - ldr r5, =0x00000ce8 - adds r1, r3, r5 - movs r0, 0 - strb r0, [r1] - adds r0, r6, 0 - bl DestroyTask -_08010AE8: - ldr r0, =gTasks - lsls r2, r6, 2 - adds r1, r2, r6 - lsls r1, 3 - adds r1, r0 - movs r3, 0x8 - ldrsh r1, [r1, r3] - adds r3, r0, 0 - adds r7, r2, 0 - cmp r1, 0x5 - bls _08010B00 - b _08010CF0 -_08010B00: - lsls r0, r1, 2 - ldr r1, =_08010B28 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08010B28: - .4byte _08010B40 - .4byte _08010B60 - .4byte _08010B78 - .4byte _08010BC0 - .4byte _08010C0A - .4byte _08010C94 -_08010B40: - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - beq _08010B4A - b _08010CF0 -_08010B4A: - adds r0, r4, 0 - bl ResetBlockReceivedFlag - movs r0, 0xF0 - lsls r0, 7 - bl sub_800FD14 - b _08010C4A - .pool -_08010B60: - ldr r0, =gSendCmd - ldrh r0, [r0] - cmp r0, 0 - beq _08010B6A - b _08010CF0 -_08010B6A: - adds r1, r7, r6 - lsls r1, 3 - adds r1, r3 - b _08010C52 - .pool -_08010B78: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - asrs r0, r4 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08010B8C - b _08010CF0 -_08010B8C: - adds r0, r4, 0 - bl ResetBlockReceivedFlag - lsls r2, r4, 8 - ldr r0, =gBlockRecvBuffer - adds r2, r0 - ldr r1, =gLinkPlayers - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r0, r1 - adds r1, r0, 0 - adds r2, 0x10 - ldm r2!, {r3-r5} - stm r1!, {r3-r5} - ldm r2!, {r3-r5} - stm r1!, {r3-r5} - ldr r2, [r2] - str r2, [r1] - bl sub_800B524 - b _08010C4A - .pool -_08010BC0: - ldr r5, =gBlockSendBuffer - adds r1, r5, 0 - ldr r0, =gUnknown_082ED7EC - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldrh r2, [r0] - strh r2, [r1] - ldrb r0, [r0, 0x2] - strb r0, [r1, 0x2] - ldr r1, =gUnknown_03005000 - ldrb r0, [r1, 0xD] - strb r0, [r5, 0xF] - movs r2, 0 - adds r4, r5, 0 - adds r4, 0x10 - ldr r0, =0x00000cde - adds r3, r1, r0 -_08010BE2: - adds r0, r4, r2 - adds r1, r2, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x3 - ble _08010BE2 - ldr r1, =gLinkPlayers - adds r0, r5, 0 - adds r0, 0x14 - movs r2, 0x8C - bl memcpy - ldr r0, =gTasks - adds r1, r7, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_08010C0A: - ldr r5, =gBlockSendBuffer - ldr r1, =gUnknown_03005000 - ldrb r0, [r1, 0xD] - strb r0, [r5, 0xF] - movs r2, 0 - ldr r3, =gLinkPlayers - mov r12, r3 - adds r4, r5, 0 - adds r4, 0x10 - ldr r0, =0x00000cde - adds r3, r1, r0 -_08010C20: - adds r0, r4, r2 - adds r1, r2, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x3 - ble _08010C20 - adds r0, r5, 0 - adds r0, 0x14 - mov r1, r12 - movs r2, 0x8C - bl memcpy - ldr r1, =gBlockSendBuffer - movs r0, 0 - movs r2, 0xA0 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _08010CF0 -_08010C4A: - ldr r0, =gTasks - adds r1, r7, r6 - lsls r1, 3 - adds r1, r0 -_08010C52: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _08010CF0 - .pool -_08010C74: - adds r0, r3, 0 - lsls r0, r2 - ldr r2, =0x00000ce5 - adds r1, r5, r2 - strb r0, [r1] - ldrb r1, [r4] - eors r0, r1 - strb r0, [r4] - ldr r4, =0x00000ce8 - adds r0, r5, r4 - strb r3, [r0] - b _08010CEA - .pool -_08010C94: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08010CF0 - bl GetBlockReceivedStatus - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - beq _08010CF0 - mov r0, sp - movs r4, 0 - strh r4, [r0] - ldr r1, =gBlockRecvBuffer - ldr r2, =0x0100007e - bl CpuSet - movs r0, 0 - bl ResetBlockReceivedFlag - ldr r1, =gUnknown_03005000 - ldr r5, =0x00000ce8 - adds r0, r1, r5 - strb r4, [r0] - ldr r0, =0x00000ce6 - adds r3, r1, r0 - ldrb r0, [r3] - cmp r0, 0 - beq _08010CEA - movs r2, 0 - adds r5, r1, 0 - adds r4, r3, 0 - ldrb r1, [r4] - movs r3, 0x1 -_08010CDA: - adds r0, r1, 0 - asrs r0, r2 - ands r0, r3 - cmp r0, 0 - bne _08010C74 - adds r2, 0x1 - cmp r2, 0x3 - ble _08010CDA -_08010CEA: - adds r0, r6, 0 - bl DestroyTask -_08010CF0: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010AAC - - thumb_func_start sub_8010D0C -sub_8010D0C: @ 8010D0C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gUnknown_03005000 - adds r0, r6, 0 - adds r0, 0xF1 - ldrb r0, [r0] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08010D2A - adds r0, r5, 0 - bl DestroyTask -_08010D2A: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08010D70 - cmp r0, 0x1 - bgt _08010D50 - cmp r0, 0 - beq _08010D56 - b _08010DA6 - .pool -_08010D50: - cmp r0, 0x2 - beq _08010D82 - b _08010DA6 -_08010D56: - ldrb r0, [r6, 0xD] - cmp r0, 0 - beq _08010DA6 - bl sub_800B348 - ldr r1, =gBlockSendBuffer - movs r0, 0 - movs r2, 0x3C - bl SendBlock - b _08010D7A - .pool -_08010D70: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08010DA6 -_08010D7A: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _08010DA6 -_08010D82: - bl GetBlockReceivedStatus - movs r4, 0x1 - adds r1, r4, 0 - ands r1, r0 - cmp r1, 0 - beq _08010DA6 - ldr r0, =gBlockRecvBuffer - bl sub_8010A14 - movs r0, 0 - bl ResetBlockReceivedFlag - ldr r0, =gReceivedRemoteLinkPlayers - strb r4, [r0] - adds r0, r5, 0 - bl DestroyTask -_08010DA6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010D0C - - thumb_func_start sub_8010DB4 -sub_8010DB4: @ 8010DB4 - push {r4-r7,lr} - ldr r0, =gUnknown_03005000 - adds r1, r0, 0 - adds r1, 0xEE - ldrb r1, [r1] - adds r3, r0, 0 - cmp r1, 0x1 - bne _08010E5C - ldr r2, =gUnknown_03004140 - ldrb r0, [r2, 0x2] - cmp r0, 0 - bne _08010E5C - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =sub_8018438 - cmp r1, r0 - beq _08010DDE - ldr r0, [r2, 0x3C] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _08010DE4 -_08010DDE: - ldr r1, =gWirelessCommType - movs r0, 0x2 - strb r0, [r1] -_08010DE4: - ldr r4, =CB2_LinkError - adds r0, r4, 0 - bl SetMainCallback2 - ldr r0, =gMain - str r4, [r0, 0x8] - ldr r5, =gUnknown_03005000 - ldrh r0, [r5, 0xA] - lsls r4, r0, 16 - ldrh r0, [r5, 0x10] - lsls r0, 8 - orrs r4, r0 - ldrh r0, [r5, 0x12] - orrs r4, r0 - ldr r1, =0x000009e6 - adds r0, r5, r1 - ldrb r0, [r0] - adds r7, r0, 0 - ldr r1, =0x00000c1a - adds r0, r5, r1 - ldrb r0, [r0] - adds r6, r0, 0 - bl sub_8011A74 - movs r3, 0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _08010E20 - movs r3, 0x1 -_08010E20: - adds r0, r4, 0 - adds r1, r7, 0 - adds r2, r6, 0 - bl sub_800AF18 - adds r0, r5, 0 - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0x2 - strb r1, [r0] - bl CloseLink - b _08010E8E - .pool -_08010E5C: - ldr r1, =0x00000c1b - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08010E70 - ldr r1, =0x000009e7 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08010E8E -_08010E70: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x2] - cmp r0, 0 - beq _08010E7C - bl sub_800D630 -_08010E7C: - movs r4, 0xE0 - lsls r4, 7 - movs r0, 0x1 - adds r1, r4, 0 - bl sub_8011A64 - adds r0, r4, 0 - bl sub_8011170 -_08010E8E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010DB4 - - thumb_func_start rfu_REQ_recvData_then_sendData -rfu_REQ_recvData_then_sendData: @ 8010EA0 - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x6] - cmp r0, 0x1 - bne _08010EB8 - bl rfu_REQ_recvData - bl rfu_waitREQComplete - movs r0, 0 - bl rfu_REQ_sendData_wrapper -_08010EB8: - pop {r0} - bx r0 - .pool - thumb_func_end rfu_REQ_recvData_then_sendData - - thumb_func_start sub_8010EC0 -sub_8010EC0: @ 8010EC0 - push {r4,r5,lr} - movs r5, 0 - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ccd - adds r0, r4, r1 - strb r5, [r0] - bl Random2 - lsls r0, 16 - lsrs r0, 16 - bl sub_800C54C - adds r0, r4, 0 - adds r0, 0xEF - ldrb r0, [r0] - cmp r0, 0 - bne _08010F14 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - beq _08010F02 - cmp r0, 0x1 - bgt _08010EFC - cmp r0, 0 - beq _08010F08 - b _08010F14 - .pool -_08010EFC: - cmp r0, 0x2 - beq _08010F10 - b _08010F14 -_08010F02: - bl sub_800F0F8 - b _08010F14 -_08010F08: - bl sub_800F4F0 - adds r5, r0, 0 - b _08010F14 -_08010F10: - bl rfu_REQ_recvData_then_sendData -_08010F14: - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8010EC0 - thumb_func_start sub_8010F1C sub_8010F1C: @ 8010F1C push {r4,lr} diff --git a/include/link.h b/include/link.h index 43a09863e..cadabebc9 100644 --- a/include/link.h +++ b/include/link.h @@ -194,7 +194,6 @@ extern u16 gSendCmd[CMD_LENGTH]; extern struct LinkPlayer gLinkPlayers[5]; extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; -extern bool8 gWirelessCommType; extern u32 gUnknown_020223C0; void Task_DestroySelf(u8); @@ -249,6 +248,7 @@ void SetSuppressLinkErrorMessage(bool8 flag); void sub_800B524(struct LinkPlayer *linkPlayer); u8 GetSioMultiSI(void); void sub_800AAF4(void); +void sub_800AF18(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06); void sub_800B348(void); void sub_800B3A4(u32 who); @@ -267,7 +267,7 @@ extern u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; extern u16 gUnknown_030030F4; extern u8 gSuppressLinkErrorMessage; -extern bool8 gWirelessCommType; +extern u8 gWirelessCommType; extern bool8 gSavedLinkPlayerCount; extern u8 gSavedMultiplayerId; extern struct LinkTestBGInfo gLinkTestBGInfo; diff --git a/include/link_rfu.h b/include/link_rfu.h index a53b58d8b..0f7c52524 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -142,11 +142,14 @@ struct UnkRfuStruct_Sub_Unused { struct UnkRfuStruct_2 { /* 0x000 */ void (*unk_00)(void); /* 0x004 */ u16 unk_04; - /* 0x006 */ u8 filler_06[6]; + /* 0x006 */ u8 filler_06[4]; + /* 0x00a */ u16 unk_0a; /* 0x00c */ u8 unk_0c; /* 0x00d */ u8 playerCount; /* 0x00e */ u8 unk_0e; - /* 0x00f */ u8 filler_0f[5]; + /* 0x00f */ u8 unk_0f; + /* 0x010 */ u16 unk_10; + /* 0x012 */ u16 unk_12; /* 0x014 */ u8 unk_14[4][14]; /* 0x04c */ u8 unk_4c[14]; /* 0x05a */ u8 unk_5a; @@ -207,8 +210,8 @@ struct UnkRfuStruct_8010A14 { char unk_00[15]; u8 unk_0f; u8 unk_10[4]; - struct LinkPlayer unk_14[4]; - u8 fill_84[0x78]; + struct LinkPlayer unk_14[5]; + u8 fill_a0[0x5c]; }; // Exported RAM declarations diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h new file mode 100644 index 000000000..fd8c35f56 --- /dev/null +++ b/include/rom_8011DC0.h @@ -0,0 +1,12 @@ +#ifndef GUARD_rom_8011DC0_H +#define GUARD_rom_8011DC0_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations + +void sub_8018438(void); + +#endif //GUARD_rom_8011DC0_H diff --git a/src/link_rfu.c b/src/link_rfu.c index 0dc253d77..a6883a304 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -13,6 +13,7 @@ #include "overworld.h" #include "link.h" #include "librfu.h" +#include "rom_8011DC0.h" #include "link_rfu.h" // Static type declarations @@ -4314,3 +4315,165 @@ void sub_8010A70(void *a0) ResetBlockReceivedFlag(0); } } + +void sub_8010AAC(u8 taskId) +{ + int i; + struct LinkPlayerBlock *r2; + struct UnkRfuStruct_8010A14 *r5; + u8 r4 = gUnknown_03005000.unk_cde[gUnknown_082ED68C[gUnknown_03005000.unk_ce9]]; + if (gUnknown_03005000.unk_f1 == 1 || gUnknown_03005000.unk_f1 == 2) + { + gUnknown_03005000.unk_ce8 = 0; + DestroyTask(taskId); + } + switch (gTasks[taskId].data[0]) + { + case 0: + if (gSendCmd[0] == 0) + { + ResetBlockReceivedFlag(r4); + sub_800FD14(0x7800); + gTasks[taskId].data[0]++; + } + break; + case 1: + if (gSendCmd[0] == 0) + gTasks[taskId].data[0]++; + break; + case 2: + if ((GetBlockReceivedStatus() >> r4) & 1) + { + ResetBlockReceivedFlag(r4); + r2 = (struct LinkPlayerBlock *)gBlockRecvBuffer[r4]; + gLinkPlayers[r4] = r2->linkPlayer; + sub_800B524(gLinkPlayers + r4); + gTasks[taskId].data[0]++; + } + break; + case 3: + r5 = (struct UnkRfuStruct_8010A14 *)gBlockSendBuffer; + memcpy(r5->unk_00, gUnknown_082ED7EC, sizeof gUnknown_082ED7EC); + r5->unk_0f = gUnknown_03005000.playerCount; + for (i = 0; i < 4; i++) + r5->unk_10[i] = gUnknown_03005000.unk_cde[i]; + memcpy(r5->unk_14, gLinkPlayers, sizeof gLinkPlayers); + gTasks[taskId].data[0]++; + // fallthrough + case 4: + r5 = (struct UnkRfuStruct_8010A14 *)gBlockSendBuffer; + r5->unk_0f = gUnknown_03005000.playerCount; + for (i = 0; i < 4; i++) + r5->unk_10[i] = gUnknown_03005000.unk_cde[i]; + memcpy(r5->unk_14, gLinkPlayers, sizeof gLinkPlayers); + if (SendBlock(0, gBlockSendBuffer, 0xa0)) + gTasks[taskId].data[0]++; + break; + case 5: + if (sub_800A520() && GetBlockReceivedStatus() & 1) + { + CpuFill16(0, gBlockRecvBuffer, sizeof(struct UnkRfuStruct_8010A14)); + ResetBlockReceivedFlag(0); + gUnknown_03005000.unk_ce8 = 0; + if (gUnknown_03005000.unk_ce6) + { + for (i = 0; i < 4; i++) + { + if ((gUnknown_03005000.unk_ce6 >> i) & 1) + { + gUnknown_03005000.unk_ce5 = 1 << i; + gUnknown_03005000.unk_ce6 ^= (1 << i); + gUnknown_03005000.unk_ce8 = 1; + break; + } + } + } + DestroyTask(taskId); + } + break; + } +} + +void sub_8010D0C(u8 taskId) +{ + if (gUnknown_03005000.unk_f1 == 1 || gUnknown_03005000.unk_f1 == 2) + DestroyTask(taskId); + switch (gTasks[taskId].data[0]) + { + case 0: + if (gUnknown_03005000.playerCount) + { + sub_800B348(); + SendBlock(0, gBlockSendBuffer, sizeof(struct LinkPlayerBlock)); + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_800A520()) + gTasks[taskId].data[0]++; + break; + case 2: + if (GetBlockReceivedStatus() & 1) + { + sub_8010A14((const struct UnkRfuStruct_8010A14 *)gBlockRecvBuffer); + ResetBlockReceivedFlag(0); + gReceivedRemoteLinkPlayers = 1; + DestroyTask(taskId); + } + break; + } +} + +void sub_8010DB4(void) +{ + if (gUnknown_03005000.unk_ee == 1 && gUnknown_03004140.unk_02 == 0) + { + if (gMain.callback2 == sub_8018438 || gUnknown_03004140.unk_3c->unk_04) + gWirelessCommType = 2; + SetMainCallback2(CB2_LinkError); + gMain.savedCallback = CB2_LinkError; + sub_800AF18((gUnknown_03005000.unk_0a << 16) | (gUnknown_03005000.unk_10 << 8) | gUnknown_03005000.unk_12, gUnknown_03005000.unk_124.unk_8c2, gUnknown_03005000.unk_9e8.unk_232, sub_8011A74() == 2); + gUnknown_03005000.unk_ee = 2; + CloseLink(); + } + else if (gUnknown_03005000.unk_9e8.unk_233 == 1 || gUnknown_03005000.unk_124.unk_8c3 == 1) + { + if (gUnknown_03004140.unk_02) + sub_800D630(); + sub_8011A64(1, 0x7000); + sub_8011170(0x7000); + } +} + +void rfu_REQ_recvData_then_sendData(void) +{ + if (gUnknown_03004140.unk_06 == 1) + { + rfu_REQ_recvData(); + rfu_waitREQComplete(); + rfu_REQ_sendData_wrapper(0); + } +} + +bool32 sub_8010EC0(void) +{ + bool32 retval = FALSE; + gUnknown_03005000.unk_ccd = 0; + sub_800C54C(Random2()); + if (gUnknown_03005000.unk_ef == 0) + { + switch (gUnknown_03005000.unk_0c) + { + case 1: + sub_800F0F8(); + break; + case 0: + retval = sub_800F4F0(); + break; + case 2: + rfu_REQ_recvData_then_sendData(); + break; + } + } + return retval; +} From 3faaeafffe12a53fc525d6b9950e97d1ccd4cbad Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 19:23:21 -0500 Subject: [PATCH 120/123] through sub_8011090 --- asm/link_rfu.s | 216 ------------------------------------------------- src/link_rfu.c | 71 ++++++++++++++++ 2 files changed, 71 insertions(+), 216 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index a55ae2d40..d7389616e 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,222 +5,6 @@ .text - thumb_func_start sub_8010F1C -sub_8010F1C: @ 8010F1C - push {r4,lr} - movs r4, 0 - ldr r1, =gUnknown_03005000 - adds r0, r1, 0 - adds r0, 0xEF - ldrb r0, [r0] - cmp r0, 0 - bne _08010F3C - ldrb r0, [r1, 0xC] - cmp r0, 0x1 - bne _08010F38 - bl sub_800F1E0 - adds r4, r0, 0 -_08010F38: - bl sub_8010DB4 -_08010F3C: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8010F1C - - thumb_func_start sub_8010F48 -sub_8010F48: @ 8010F48 - push {lr} - ldr r0, =gUnknown_02022B14 + 0xE - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F48 - - thumb_func_start sub_8010F60 -sub_8010F60: @ 8010F60 - push {r4,lr} - ldr r4, =gUnknown_02022B14 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0xD - bl memset - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_800DD94 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F60 - - thumb_func_start sub_8010F84 -sub_8010F84: @ 8010F84 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_02022B14 - adds r1, r4, 0 - bl sub_800DD94 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F84 - - thumb_func_start sub_8010FA0 -sub_8010FA0: @ 8010FA0 - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - movs r4, 0x1 - ands r0, r4 - lsls r0, 4 - ldrb r3, [r5] - movs r2, 0x11 - negs r2, r2 - ands r2, r3 - orrs r2, r0 - ands r1, r4 - lsls r1, 5 - movs r0, 0x21 - negs r0, r0 - ands r2, r0 - orrs r2, r1 - strb r2, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010FA0 - - thumb_func_start sub_8010FCC -sub_8010FCC: @ 8010FCC - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - lsls r0, 2 - ldrb r4, [r5, 0x9] - movs r3, 0x3 - ands r3, r4 - orrs r3, r0 - strb r3, [r5, 0x9] - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r1, r0 - ldrh r3, [r5, 0x8] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r1 - strh r0, [r5, 0x8] - lsls r2, 1 - ldrb r1, [r5, 0xB] - movs r0, 0x1 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0xB] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010FCC - - thumb_func_start sub_801100C -sub_801100C: @ 801100C - push {r4,lr} - movs r4, 0x80 - ldr r3, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r0, r1, r3 - ldrb r2, [r0, 0x13] - lsls r2, 3 - orrs r2, r4 - adds r3, 0x4 - adds r1, r3 - ldr r0, [r1] - movs r1, 0x7 - ands r0, r1 - orrs r0, r2 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801100C - - thumb_func_start sub_801103C -sub_801103C: @ 801103C - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - movs r4, 0x1 - b _08011054 - .pool -_08011048: - adds r0, r4, 0 - bl sub_801100C - adds r1, r5, r4 - strb r0, [r1, 0x3] - adds r4, 0x1 -_08011054: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _08011048 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801103C - - thumb_func_start sub_8011068 -sub_8011068: @ 8011068 - push {lr} - lsls r0, 24 - ldr r2, =gUnknown_02022B14 - lsrs r0, 17 - ldrb r3, [r2, 0xA] - movs r1, 0x7F - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0xA] - ldr r3, =gUnknown_02022B14 + 0xE - movs r0, 0 - movs r1, 0x2 - bl rfu_REQ_configGameData - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011068 - - thumb_func_start sub_8011090 -sub_8011090: @ 8011090 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0801109E - bl sub_8010F84 -_0801109E: - ldr r2, =gUnknown_02022B14 - ldr r3, =gUnknown_02022B14 + 0xE - movs r0, 0 - movs r1, 0x2 - bl rfu_REQ_configGameData - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011090 - thumb_func_start sub_80110B8 sub_80110B8: @ 80110B8 push {r4-r7,lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index a6883a304..6e8d99c0d 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -4477,3 +4477,74 @@ bool32 sub_8010EC0(void) } return retval; } + +bool32 sub_8010F1C(void) +{ + bool32 retval = FALSE; + if (gUnknown_03005000.unk_ef == 0) + { + if (gUnknown_03005000.unk_0c == 1) + retval = sub_800F1E0(); + sub_8010DB4(); + } + return retval; +} + +void sub_8010F48(void) +{ + StringCopy(gUnknown_02022B22, gSaveBlock2Ptr->playerName); +} + +void sub_8010F60(void) +{ + gUnknown_02022B14 = (struct UnkLinkRfuStruct_02022B14){}; + sub_800DD94(&gUnknown_02022B14, 0, 0, 0); +} + +void sub_8010F84(u8 a0, u32 a1, u32 a2) +{ + sub_800DD94(&gUnknown_02022B14, a0, a2, a1); +} + +void sub_8010FA0(bool32 a0, bool32 a1) +{ + gUnknown_02022B14.unk_00_4 = a0; + gUnknown_02022B14.unk_00_5 = a1; +} + +void sub_8010FCC(u32 a0, u32 a1, u32 a2) +{ + gUnknown_02022B14.unk_09_2 = a0; + gUnknown_02022B14.unk_08_0 = a1; + gUnknown_02022B14.unk_0b_1 = a2; +} + +u8 sub_801100C(int a0) +{ + u8 retval = 0x80; + retval |= (gLinkPlayers[a0].gender << 3); + retval |= (gLinkPlayers[a0].trainerId & 7); + return retval; +} + +void sub_801103C(void) +{ + struct UnkLinkRfuStruct_02022B14 *r5 = &gUnknown_02022B14; + int i; + + for (i = 1; i < GetLinkPlayerCount(); i++) + r5->unk_04[i - 1] = sub_801100C(i); +} + +void sub_8011068(u8 a0) +{ + gUnknown_02022B14.unk_0a_7 = a0; + rfu_REQ_configGameData(0, 2, &gUnknown_02022B14, gUnknown_02022B22); +} + +void sub_8011090(u8 a0, u32 a1, u32 a2) +{ + if (a0) + sub_8010F84(a0, a1, a2); + rfu_REQ_configGameData(0, 2, &gUnknown_02022B14, gUnknown_02022B22); +} From 7af3cd051edcaa9918096a1d1b7e43a15d3682f6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 19:51:19 -0500 Subject: [PATCH 121/123] through sub_80111FC --- asm/link_rfu.s | 173 ------------------------------------------------- src/link_rfu.c | 62 ++++++++++++++++++ 2 files changed, 62 insertions(+), 173 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index d7389616e..e1bf3bbc9 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,179 +5,6 @@ .text - thumb_func_start sub_80110B8 -sub_80110B8: @ 80110B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r9, r0 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - bne _0801114C - movs r5, 0 - movs r7, 0 - ldr r3, =gUnknown_03005000 - ldr r1, =0x00000ce2 - adds r0, r3, r1 - ldr r2, =0x00000ce3 - adds r1, r3, r2 - ldrb r2, [r0] - ldrb r0, [r1] - adds r1, r0, 0 - eors r1, r2 - mov r8, r1 - movs r4, 0 - movs r6, 0x1 - ldr r2, =gLinkPlayers - mov r12, r2 - ldr r0, =0x00000cde - adds r0, r3 - mov r10, r0 - mov r3, r12 - adds r3, 0x4 -_080110FC: - mov r0, r8 - asrs r0, r4 - ands r0, r6 - cmp r0, 0 - beq _0801113C - mov r1, r10 - adds r0, r4, r1 - ldrb r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - mov r2, r12 - adds r1, r0, r2 - ldrb r1, [r1, 0x13] - adds r2, r6, 0 - ands r2, r1 - lsls r2, 3 - adds r0, r3 - ldr r1, [r0] - movs r0, 0x7 - ands r1, r0 - movs r0, 0x80 - orrs r1, r0 - orrs r2, r1 - lsls r0, r5, 3 - lsls r2, r0 - orrs r7, r2 - adds r5, 0x1 - mov r0, r9 - subs r0, 0x1 - cmp r5, r0 - beq _08011142 -_0801113C: - adds r4, 0x1 - cmp r4, 0x3 - ble _080110FC -_08011142: - movs r0, 0x45 - adds r1, r7, 0 - movs r2, 0 - bl sub_8011090 -_0801114C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80110B8 - - thumb_func_start sub_8011170 -sub_8011170: @ 8011170 - push {r4,lr} - adds r4, r0, 0 - ldr r2, =gUnknown_03005000 - adds r3, r2, 0 - adds r3, 0xEE - ldrb r0, [r3] - cmp r0, 0 - bne _08011192 - ldr r1, =gUnknown_03004140 - ldrh r0, [r1, 0x14] - strh r0, [r2, 0x10] - ldrh r0, [r1, 0x16] - strh r0, [r2, 0x12] - strh r4, [r2, 0xA] - ldrb r0, [r3] - movs r0, 0x1 - strb r0, [r3] -_08011192: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011170 - - thumb_func_start sub_80111A0 -sub_80111A0: @ 80111A0 - ldr r0, =gUnknown_03005000 - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_80111A0 - - thumb_func_start sub_80111B0 -sub_80111B0: @ 80111B0 - push {lr} - adds r2, r0, 0 - cmp r2, 0 - bne _080111C8 - ldr r0, =gUnknown_03005000 - adds r0, 0xEE - ldrb r1, [r0] - strb r2, [r0] - b _080111D2 - .pool -_080111C8: - ldr r0, =gUnknown_03005000 - adds r0, 0xEE - ldrb r1, [r0] - movs r1, 0x4 - strb r1, [r0] -_080111D2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80111B0 - - thumb_func_start sub_80111DC -sub_80111DC: @ 80111DC - push {lr} - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - movs r1, 0x1 - bl sub_8011E94 - ldr r1, =gUnknown_03005000 - movs r0, 0 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80111DC - - thumb_func_start sub_80111FC -sub_80111FC: @ 80111FC - ldr r1, =gUnknown_03005000 - ldr r0, =sub_80111DC - str r0, [r1] - bx lr - .pool - thumb_func_end sub_80111FC - thumb_func_start sub_801120C sub_801120C: @ 801120C push {r4-r7,lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index 6e8d99c0d..ed7062d98 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -74,6 +74,7 @@ void sub_8010AAC(u8 taskId); void sub_8010D0C(u8 taskId); u8 sub_8011CE4(const u8 *a0, u16 a1); void sub_8011D6C(u8 a0); +void sub_8011E94(u8 a0, u8 a1); u8 sub_8012224(void); void sub_801227C(void); @@ -4548,3 +4549,64 @@ void sub_8011090(u8 a0, u32 a1, u32 a2) sub_8010F84(a0, a1, a2); rfu_REQ_configGameData(0, 2, &gUnknown_02022B14, gUnknown_02022B22); } + +void sub_80110B8(u32 a0) +{ + int i; + u32 r5; + u32 r7; + int r8; + + if (sub_800F7DC()->unk_0a_0 == 0x45) + { + r5 = 0; + r7 = 0; + r8 = gUnknown_03005000.unk_ce2 ^ gUnknown_03005000.unk_ce3; + for (i = 0; i < 4; i++) + { + if ((r8 >> i) & 1) + { + r7 |= ((0x80 | ((gLinkPlayers[gUnknown_03005000.unk_cde[i]].gender & 1) << 3) | (gLinkPlayers[gUnknown_03005000.unk_cde[i]].trainerId & 7)) << (r5 << 3)); + r5++; + if (r5 == a0 - 1) + break; + } + } + sub_8011090(0x45, r7, 0); + } +} + +void sub_8011170(u32 a0) +{ + if (gUnknown_03005000.unk_ee == 0) + { + gUnknown_03005000.unk_10 = gUnknown_03004140.unk_14; + gUnknown_03005000.unk_12 = gUnknown_03004140.unk_16; + gUnknown_03005000.unk_0a = a0; + gUnknown_03005000.unk_ee = 1; + } +} + +void sub_80111A0(void) +{ + gUnknown_03005000.unk_ee = 0; +} + +void sub_80111B0(bool32 a0) +{ + if (!a0) + gUnknown_03005000.unk_ee = 0; + else + gUnknown_03005000.unk_ee = 4; +} + +void sub_80111DC(void) +{ + sub_8011E94(gUnknown_03004140.unk_00, 1); + gUnknown_03005000.unk_00 = NULL; +} + +void sub_80111FC(void) +{ + gUnknown_03005000.unk_00 = sub_80111DC; +} From d35cf06854be09a6bcf5ceb63cdb54cefd6d48a2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 21 Jan 2018 18:25:23 -0500 Subject: [PATCH 122/123] nonmatching sub_801120C --- asm/link_rfu.s | 241 ----------------------- include/global.h | 1 + include/librfu.h | 39 +++- include/link_rfu.h | 22 --- src/battle_2.c | 2 +- src/battle_interface.c | 2 +- src/battle_script_commands.c | 6 +- src/berry_fix_program.c | 2 +- src/bg.c | 6 +- src/braille_puzzles.c | 2 +- src/decompress.c | 2 +- src/decoration.c | 2 +- src/lilycove_lady.c | 2 +- src/link_rfu.c | 364 +++++++++++++++++++++++++++++++++-- src/palette.c | 4 +- src/pokemon_summary_screen.c | 16 +- src/recorded_battle.c | 2 +- src/scrcmd.c | 2 +- src/secret_base.c | 2 +- src/sprite.c | 2 +- src/text.c | 8 +- src/tv.c | 4 +- src/util.c | 2 +- 23 files changed, 413 insertions(+), 322 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index e1bf3bbc9..e53685c28 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,247 +5,6 @@ .text - thumb_func_start sub_801120C -sub_801120C: @ 801120C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r4, r0, 24 - movs r6, 0 - cmp r4, 0x32 - bne _08011222 - b _08011360 -_08011222: - cmp r4, 0x32 - bgt _08011252 - cmp r4, 0x13 - bgt _08011240 - cmp r4, 0x12 - blt _08011230 - b _080113EE -_08011230: - cmp r4, 0x10 - bne _08011236 - b _080113EE -_08011236: - cmp r4, 0x10 - bgt _0801128C - cmp r4, 0 - beq _0801127E - b _080113EE -_08011240: - cmp r4, 0x30 - bne _08011246 - b _0801136C -_08011246: - cmp r4, 0x30 - ble _0801124C - b _08011354 -_0801124C: - cmp r4, 0x14 - beq _08011328 - b _080113EE -_08011252: - cmp r4, 0x44 - bgt _08011264 - cmp r4, 0x42 - blt _0801125C - b _080113EE -_0801125C: - cmp r4, 0x33 - bne _08011262 - b _0801136C -_08011262: - b _080113EE -_08011264: - cmp r4, 0xF3 - bne _0801126A - b _080113BA -_0801126A: - cmp r4, 0xF3 - bgt _08011276 - cmp r4, 0xF0 - bge _08011274 - b _080113EE -_08011274: - b _080113D4 -_08011276: - cmp r4, 0xFF - bne _0801127C - b _080113D4 -_0801127C: - b _080113EE -_0801127E: - ldr r1, =gUnknown_03005000 - movs r0, 0x2 - strh r0, [r1, 0x4] - b _080113EE - .pool -_0801128C: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x14] - bl sub_80115EC - movs r5, 0 - movs r0, 0x1 - mov r8, r0 - ldr r1, =gUnknown_03005000 - mov r9, r1 - ldr r3, =0x00000cd5 - add r3, r9 - mov r10, r3 - movs r7, 0x7F -_080112A6: - ldr r0, =gUnknown_03004140 - ldrh r0, [r0, 0x14] - asrs r0, r5 - mov r1, r8 - ands r0, r1 - cmp r0, 0 - beq _0801130E - ldr r0, =gUnknown_03007890 - lsls r1, r5, 5 - adds r1, 0x14 - ldr r0, [r0] - adds r0, r1 - ldrb r0, [r0, 0x10] - adds r4, r7, 0 - ands r4, r0 - bl sub_800F7DC - ldrb r1, [r0, 0xA] - adds r0, r7, 0 - ands r0, r1 - cmp r4, r0 - bne _08011304 - ldr r0, =0x00000cd1 - add r0, r9 - adds r0, r5, r0 - movs r1, 0 - strb r1, [r0] - mov r3, r10 - adds r2, r5, r3 - strb r1, [r2] - movs r0, 0x20 - adds r1, r5, 0 - movs r3, 0x1 - bl rfu_setRecvBuffer - b _0801130E - .pool -_08011304: - mov r0, r8 - lsls r0, r5 - orrs r6, r0 - lsls r0, r6, 24 - lsrs r6, r0, 24 -_0801130E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _080112A6 - cmp r6, 0 - beq _080113EE - adds r0, r6, 0 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete - b _080113EE -_08011328: - ldr r4, =gUnknown_03005000 - ldr r1, =0x00000ce7 - adds r0, r4, r1 - ldr r1, =gUnknown_03004140 - ldrb r2, [r0] - ldrb r0, [r1] - cmp r2, r0 - beq _08011342 - eors r0, r2 - bl rfu_REQ_disconnect - bl rfu_waitREQComplete -_08011342: - movs r0, 0x11 - strh r0, [r4, 0x4] - b _080113EE - .pool -_08011354: - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - b _080113EA - .pool -_08011360: - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - movs r1, 0x3 - b _080113EC - .pool -_0801136C: - ldr r1, =gUnknown_03005000 - adds r2, r1, 0 - adds r2, 0xF0 - movs r0, 0x4 - strb r0, [r2] - ldr r3, =0x00000ce2 - adds r1, r3 - ldr r0, =gUnknown_03004140 - ldrb r2, [r0, 0x14] - ldrb r0, [r1] - adds r3, r0, 0 - bics r3, r2 - adds r2, r3, 0 - strb r2, [r1] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - bne _080113B0 - cmp r2, 0 - bne _080113AC - adds r0, r4, 0 - bl sub_8011170 - b _080113B0 - .pool -_080113AC: - bl sub_80111FC -_080113B0: - movs r0, 0x2 - adds r1, r4, 0 - bl sub_8011A64 - b _080113EE -_080113BA: - movs r0, 0x1 - movs r1, 0xF3 - bl sub_8011A64 - movs r0, 0xF3 - bl sub_8011170 - ldr r0, =gUnknown_03005000 - adds r0, 0xEF - b _080113EA - .pool -_080113D4: - adds r0, r4, 0 - bl sub_8011170 - movs r0, 0x1 - adds r1, r4, 0 - bl sub_8011A64 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000cdb - adds r0, r1 - ldrb r1, [r0] -_080113EA: - movs r1, 0x1 -_080113EC: - strb r1, [r0] -_080113EE: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801120C - thumb_func_start sub_8011404 sub_8011404: @ 8011404 push {r4,r5,lr} diff --git a/include/global.h b/include/global.h index 1987a0ada..c32909c93 100644 --- a/include/global.h +++ b/include/global.h @@ -10,6 +10,7 @@ // to help in decompiling #define asm_comment(x) asm volatile("@ -- " x " -- ") #define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided") +#define ASM_DIRECT __attribute__((naked)) #if defined (__APPLE__) || defined (__CYGWIN__) void *memset(void *, int, size_t); diff --git a/include/librfu.h b/include/librfu.h index 9dd547eee..aae7df4e9 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -67,6 +67,28 @@ union RfuPacket struct RfuPacket8 rfuPacket8; }; +struct __attribute__((packed)) UnkLinkRfuStruct_02022B14 +{ + u16 unk_00_0:4; + u16 unk_00_4:1; + u16 unk_00_5:1; + u16 unk_00_6:1; + u16 unk_00_7:1; + u16 unk_01_0:1; + u16 unk_01_1:1; + u16 unk_01_2:4; + u16 unk_01_6:2; + u8 playerTrainerId[2]; + u8 unk_04[4]; + u16 unk_08_0:10; + u16 unk_09_2:6; + u8 unk_0a_0:7; + u8 unk_0a_7:1; + u8 playerGender:1; + u8 unk_0b_1:7; + u8 unk_0c; +}; + struct RfuStruct { vs32 unk_0; @@ -142,6 +164,15 @@ struct RfuUnk3 u32 unk_dc; }; +struct RfuUnk5Sub { + u16 unk_00; + u8 unk_02; + u16 unk_04; + struct UnkLinkRfuStruct_02022B14 unk_06; + u8 fill_13[2]; + u8 unk_15[8]; +}; + struct RfuUnk5 { u8 unk_00; @@ -156,13 +187,7 @@ struct RfuUnk5 u8 filler_09[1]; u8 unk_0a[4]; u8 filler_0e[6]; - struct RfuUnk5Sub { - u16 unk_00; - u8 unk_02; - u16 unk_04; - u8 unk_06[15]; - u8 unk_15[11]; - } unk_14[4]; + struct RfuUnk5Sub unk_14[4]; }; extern struct RfuStruct *gRfuState; diff --git a/include/link_rfu.h b/include/link_rfu.h index 0f7c52524..a6084b138 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -3,28 +3,6 @@ // Exported type declarations -struct __attribute__((packed)) UnkLinkRfuStruct_02022B14 -{ - u16 unk_00_0:4; - u16 unk_00_4:1; - u16 unk_00_5:1; - u16 unk_00_6:1; - u16 unk_00_7:1; - u16 unk_01_0:1; - u16 unk_01_1:1; - u16 unk_01_2:4; - u16 unk_01_6:2; - u8 playerTrainerId[2]; - u8 unk_04[4]; - u16 unk_08_0:10; - u16 unk_09_2:6; - u8 unk_0a_0:7; - u8 unk_0a_7:1; - u8 playerGender:1; - u8 unk_0b_1:7; - u8 unk_0c; -}; - struct UnkLinkRfuStruct_02022B2C { u8 unk_00; diff --git a/src/battle_2.c b/src/battle_2.c index aa033c537..2d7f860c7 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -3362,7 +3362,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void) } #else -__attribute__((naked)) +ASM_DIRECT static void BattleIntroOpponent1SendsOutMonAnimation(void) { asm(".syntax unified\n\ diff --git a/src/battle_interface.c b/src/battle_interface.c index 6a6bf00a2..47e1d7db3 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -657,7 +657,7 @@ static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2) } #else -__attribute__((naked)) +ASM_DIRECT static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2) { asm(".syntax unified\n\ diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c7976fc2a..b7e493122 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3713,7 +3713,7 @@ static void atk24(void) } } #else -__attribute__((naked)) +ASM_DIRECT static void atk24(void) { asm("\n\ @@ -4593,7 +4593,7 @@ static void atk48_playstatchangeanimation(void) } } #else -__attribute__((naked)) +ASM_DIRECT static void atk48_playstatchangeanimation(void) { asm("\n\ @@ -9486,7 +9486,7 @@ static void atkC1_hiddenpowercalc(void) } #else -__attribute__((naked)) +ASM_DIRECT static void atkC1_hiddenpowercalc(void) { asm(".syntax unified\n\ diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index 3b2bfb5f7..f233dc645 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -265,7 +265,7 @@ static void berry_fix_gpu_set(void) } #else -__attribute__((naked)) static void berry_fix_gpu_set(void) +ASM_DIRECT static void berry_fix_gpu_set(void) { asm(".syntax unified\n" "\tpush {r4-r6,lr}\n" diff --git a/src/bg.c b/src/bg.c index b699a0b1f..22861b64d 100644 --- a/src/bg.c +++ b/src/bg.c @@ -463,7 +463,7 @@ bool8 IsDma3ManagerBusyWithBgCopy(void) return FALSE; } #else -__attribute__((naked)) +ASM_DIRECT bool8 IsDma3ManagerBusyWithBgCopy(void) { asm("push {r4-r7,lr}\n\ @@ -1048,7 +1048,7 @@ void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 } } }*/ -__attribute__((naked)) +ASM_DIRECT void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2) { asm("push {r4-r7,lr}\n\ @@ -1495,7 +1495,7 @@ void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 pal *dest = test; } #else -__attribute__((naked)) +ASM_DIRECT void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2) { asm("push {r4-r6,lr}\n\ diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index d6924de9f..55e75bfbf 100755 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -421,7 +421,7 @@ bool8 ShouldDoBrailleRegicePuzzle(void) return FALSE; } #else -__attribute__((naked)) +ASM_DIRECT bool8 ShouldDoBrailleRegicePuzzle(void) { asm(".syntax unified\n\ diff --git a/src/decompress.c b/src/decompress.c index 8e8827194..fb288bf4a 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -117,7 +117,7 @@ void Unused_LZDecompressWramIndirect(const void **src, void *dest) } // This one (unused) function is really challenging, won't even try to decompile it. -__attribute__((naked)) +ASM_DIRECT void sub_803471C() { asm(".syntax unified\n\ diff --git a/src/decoration.c b/src/decoration.c index c539091c8..3bff5208e 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -2542,7 +2542,7 @@ void sub_812A0E8(u8 taskId) } } #else -__attribute__((naked)) void sub_812A0E8(u8 taskId) +ASM_DIRECT void sub_812A0E8(u8 taskId) { asm_unified("\tpush {r4-r7,lr}\n" "\tlsls r0, 24\n" diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c index 927b87c72..dcdf9b45a 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -641,7 +641,7 @@ static u8 sub_818E13C(void) return retval; } #else -__attribute__((naked)) static u8 sub_818E13C(void) +ASM_DIRECT static u8 sub_818E13C(void) { asm_unified("\tpush {r4-r7,lr}\n" "\tmovs r7, 0x1\n" diff --git a/src/link_rfu.c b/src/link_rfu.c index ed7062d98..186d54fd3 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -72,6 +72,7 @@ void sub_80109E8(u16 a0); void sub_8010A70(void *a0); void sub_8010AAC(u8 taskId); void sub_8010D0C(u8 taskId); +void sub_80115EC(u16 a0); u8 sub_8011CE4(const u8 *a0, u16 a1); void sub_8011D6C(u8 a0); void sub_8011E94(u8 a0, u8 a1); @@ -2048,7 +2049,7 @@ u8 sub_800DD1C(u8 maxFlags) return 0; } #else -__attribute__((naked)) u8 sub_800DD1C(u8 maxFlags) +ASM_DIRECT u8 sub_800DD1C(u8 maxFlags) { asm_unified("\tpush {r4-r7,lr}\n" "\tlsls r0, 24\n" @@ -2143,7 +2144,7 @@ void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, int r data->unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR); } -bool8 sub_800DE7C(void *buff1, void *buff2, u8 idx) +bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx) { bool8 retVal; @@ -2152,13 +2153,13 @@ bool8 sub_800DE7C(void *buff1, void *buff2, u8 idx) retVal = TRUE; if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04) && ((gUnknown_03007890->unk_07 >> idx) & 1)) { - memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); - memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); + memcpy(buff1, &gUnknown_03007890->unk_14[idx].unk_06, sizeof(gUnknown_03007890->unk_14[idx].unk_06)); + memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, sizeof(gUnknown_03007890->unk_14[idx].unk_15)); } else { - memset(buff1, 0, 13); - memset(buff2, 0, 8); + memset(buff1, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_06)); + memset(buff2, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_15)); } } else @@ -2166,38 +2167,38 @@ bool8 sub_800DE7C(void *buff1, void *buff2, u8 idx) retVal = FALSE; if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04)) { - memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); - memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); + memcpy(buff1, &gUnknown_03007890->unk_14[idx].unk_06, sizeof(gUnknown_03007890->unk_14[idx].unk_06)); + memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, sizeof(gUnknown_03007890->unk_14[idx].unk_15)); } else { - memset(buff1, 0, 13); - memset(buff2, 0, 8); + memset(buff1, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_06)); + memset(buff2, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_15)); } } return retVal; } -bool8 sub_800DF34(void *buff1, void *buff2, u8 idx) +bool8 sub_800DF34(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx) { bool8 retVal = FALSE; if (gUnknown_03007890->unk_14[idx].unk_04 == 0x7F7D) { - memcpy(buff1, gUnknown_03007890->unk_14[idx].unk_06, 13); + *buff1 = gUnknown_03007890->unk_14[idx].unk_06; memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, 8); retVal = TRUE; } else { - memset(buff1, 0, 13); + *buff1 = (struct UnkLinkRfuStruct_02022B14){}; memset(buff2, 0, 8); } return retVal; } -void sub_800DF90(void *buff1, void *buff2) +void sub_800DF90(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2) { - memcpy(buff1, &gUnknown_02022B14, 13); + *buff1 = gUnknown_02022B14; memcpy(buff2, gUnknown_02022B22, 8); } @@ -2894,7 +2895,7 @@ void sub_800EFB0(void) CpuFill16(0, gRecvCmds, sizeof gRecvCmds); } #else -__attribute__((naked)) void sub_800EFB0(void) +ASM_DIRECT void sub_800EFB0(void) { asm_unified("\tpush {r4-r7,lr}\n" "\tsub sp, 0x4\n" @@ -3230,7 +3231,7 @@ void sub_800F638(u8 unused, u32 flags) } } #else -__attribute__((naked)) void sub_800F638(u8 unused, u32 flags) +ASM_DIRECT void sub_800F638(u8 unused, u32 flags) { asm_unified("\tpush {r4-r7,lr}\n" "\tmov r7, r10\n" @@ -3598,7 +3599,7 @@ void sub_800FD14(u16 command) } } #else -__attribute__((naked)) void sub_800FD14(u16 command) +ASM_DIRECT void sub_800FD14(u16 command) { asm_unified("\tpush {r4,r5,lr}\n" "\tlsls r0, 16\n" @@ -4610,3 +4611,330 @@ void sub_80111FC(void) { gUnknown_03005000.unk_00 = sub_80111DC; } + +#ifdef NONMATCHING +void sub_801120C(u8 a0) +{ + u8 i; + u8 r6 = 0; + struct RfuUnk5Sub *unk5Sub; + switch (a0) + { + case 0x00: + gUnknown_03005000.unk_04 = 2; + break; + case 0x10: + break; + case 0x11: + sub_80115EC(gUnknown_03004140.unk_14); + for (i = 0; i < 4; i++) + { + if ((gUnknown_03004140.unk_14 >> i) & 1) + { + unk5Sub = &gUnknown_03007890->unk_14[i]; + if (unk5Sub->unk_06.unk_0a_0 == sub_800F7DC()->unk_0a_0) + { + gUnknown_03005000.unk_cd1[i] = 0; + gUnknown_03005000.unk_cd5[i] = 0; + rfu_setRecvBuffer(0x20, i, gUnknown_03005000.unk_cd5 + i, 1); + } + else + { + r6 |= (1 << i); + } + } + } + if (r6) + { + rfu_REQ_disconnect(r6); + rfu_waitREQComplete(); + } + break; + case 0x12: + break; + case 0x13: + break; + case 0x14: + if (gUnknown_03005000.unk_ce7 != gUnknown_03004140.unk_00) + { + rfu_REQ_disconnect(gUnknown_03005000.unk_ce7 ^ gUnknown_03004140.unk_00); + rfu_waitREQComplete(); + } + gUnknown_03005000.unk_04 = 0x11; + break; + case 0x31: + gUnknown_03005000.unk_f0 = 1; + break; + case 0x32: + gUnknown_03005000.unk_f0 = 3; + break; + case 0x30: + case 0x33: + gUnknown_03005000.unk_f0 = 4; + gUnknown_03005000.unk_ce2 &= ~gUnknown_03004140.unk_14; + if (gReceivedRemoteLinkPlayers == 1) + { + if (gUnknown_03005000.unk_ce2 == 0) + sub_8011170(a0); + else + sub_80111FC(); + } + sub_8011A64(2, a0); + break; + case 0x42 ... 0x44: + break; + case 0xf3: + sub_8011A64(1, a0); + sub_8011170(a0); + gUnknown_03005000.unk_ef = 1; + break; + case 0xf0 ... 0xf2: + case 0xff: + sub_8011170(a0); + sub_8011A64(1, a0); + gUnknown_03005000.unk_cdb = 1; + break; + } +} +#else +ASM_DIRECT void sub_801120C(u8 a0) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tlsls r0, 24\n" + "\tlsrs r4, r0, 24\n" + "\tmovs r6, 0\n" + "\tcmp r4, 0x32\n" + "\tbne _08011222\n" + "\tb _08011360_case_32\n" + "_08011222:\n" + "\tcmp r4, 0x32\n" + "\tbgt _08011252\n" + "\tcmp r4, 0x13\n" + "\tbgt _08011240\n" + "\tcmp r4, 0x12\n" + "\tblt _08011230\n" + "\tb _080113EE_break\n" + "_08011230:\n" + "\tcmp r4, 0x10\n" + "\tbne _08011236\n" + "\tb _080113EE_break\n" + "_08011236:\n" + "\tcmp r4, 0x10\n" + "\tbgt _0801128C_case_11\n" + "\tcmp r4, 0\n" + "\tbeq _0801127E_case_00\n" + "\tb _080113EE_break\n" + "_08011240:\n" + "\tcmp r4, 0x30\n" + "\tbne _08011246\n" + "\tb _0801136C_case_30_case_33\n" + "_08011246:\n" + "\tcmp r4, 0x30\n" + "\tble _0801124C\n" + "\tb _08011354_case_31\n" + "_0801124C:\n" + "\tcmp r4, 0x14\n" + "\tbeq _08011328_case_14\n" + "\tb _080113EE_break\n" + "_08011252:\n" + "\tcmp r4, 0x44\n" + "\tbgt _08011264\n" + "\tcmp r4, 0x42\n" + "\tblt _0801125C\n" + "\tb _080113EE_break\n" + "_0801125C:\n" + "\tcmp r4, 0x33\n" + "\tbne _08011262\n" + "\tb _0801136C_case_30_case_33\n" + "_08011262:\n" + "\tb _080113EE_break\n" + "_08011264:\n" + "\tcmp r4, 0xF3\n" + "\tbne _0801126A\n" + "\tb _080113BA_case_f3\n" + "_0801126A:\n" + "\tcmp r4, 0xF3\n" + "\tbgt _08011276\n" + "\tcmp r4, 0xF0\n" + "\tbge _08011274\n" + "\tb _080113EE_break\n" + "_08011274:\n" + "\tb _080113D4_case_f0_f1_f2_ff\n" + "_08011276:\n" + "\tcmp r4, 0xFF\n" + "\tbne _0801127C\n" + "\tb _080113D4_case_f0_f1_f2_ff\n" + "_0801127C:\n" + "\tb _080113EE_break\n" + "_0801127E_case_00:\n" + "\tldr r1, =gUnknown_03005000\n" + "\tmovs r0, 0x2\n" + "\tstrh r0, [r1, 0x4]\n" + "\tb _080113EE_break\n" + "\t.pool\n" + "_0801128C_case_11:\n" + "\tldr r0, =gUnknown_03004140\n" + "\tldrh r0, [r0, 0x14]\n" + "\tbl sub_80115EC\n" + "\tmovs r5, 0\n" + "\tmovs r0, 0x1\n" + "\tmov r8, r0\n" + "\tldr r1, =gUnknown_03005000\n" + "\tmov r9, r1\n" + "\tldr r3, =0x00000cd5\n" + "\tadd r3, r9\n" + "\tmov r10, r3\n" + "\tmovs r7, 0x7F\n" + "_080112A6:\n" + "\tldr r0, =gUnknown_03004140\n" + "\tldrh r0, [r0, 0x14]\n" + "\tasrs r0, r5\n" + "\tmov r1, r8\n" + "\tands r0, r1\n" + "\tcmp r0, 0\n" + "\tbeq _0801130E\n" + "\tldr r0, =gUnknown_03007890\n" + "\tlsls r1, r5, 5\n" + "\tadds r1, 0x14\n" + "\tldr r0, [r0]\n" + "\tadds r0, r1\n" + "\tldrb r0, [r0, 0x10]\n" + "\tadds r4, r7, 0\n" + "\tands r4, r0\n" + "\tbl sub_800F7DC\n" + "\tldrb r1, [r0, 0xA]\n" + "\tadds r0, r7, 0\n" + "\tands r0, r1\n" + "\tcmp r4, r0\n" + "\tbne _08011304\n" + "\tldr r0, =0x00000cd1\n" + "\tadd r0, r9\n" + "\tadds r0, r5, r0\n" + "\tmovs r1, 0\n" + "\tstrb r1, [r0]\n" + "\tmov r3, r10\n" + "\tadds r2, r5, r3\n" + "\tstrb r1, [r2]\n" + "\tmovs r0, 0x20\n" + "\tadds r1, r5, 0\n" + "\tmovs r3, 0x1\n" + "\tbl rfu_setRecvBuffer\n" + "\tb _0801130E\n" + "\t.pool\n" + "_08011304:\n" + "\tmov r0, r8\n" + "\tlsls r0, r5\n" + "\torrs r6, r0\n" + "\tlsls r0, r6, 24\n" + "\tlsrs r6, r0, 24\n" + "_0801130E:\n" + "\tadds r0, r5, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r5, r0, 24\n" + "\tcmp r5, 0x3\n" + "\tbls _080112A6\n" + "\tcmp r6, 0\n" + "\tbeq _080113EE_break\n" + "\tadds r0, r6, 0\n" + "\tbl rfu_REQ_disconnect\n" + "\tbl rfu_waitREQComplete\n" + "\tb _080113EE_break\n" + "_08011328_case_14:\n" + "\tldr r4, =gUnknown_03005000\n" + "\tldr r1, =0x00000ce7\n" + "\tadds r0, r4, r1\n" + "\tldr r1, =gUnknown_03004140\n" + "\tldrb r2, [r0]\n" + "\tldrb r0, [r1]\n" + "\tcmp r2, r0\n" + "\tbeq _08011342\n" + "\teors r0, r2\n" + "\tbl rfu_REQ_disconnect\n" + "\tbl rfu_waitREQComplete\n" + "_08011342:\n" + "\tmovs r0, 0x11\n" + "\tstrh r0, [r4, 0x4]\n" + "\tb _080113EE_break\n" + "\t.pool\n" + "_08011354_case_31:\n" + "\tldr r0, =gUnknown_03005000\n" + "\tadds r0, 0xF0\n" + "\tb _080113EA\n" + "\t.pool\n" + "_08011360_case_32:\n" + "\tldr r0, =gUnknown_03005000\n" + "\tadds r0, 0xF0\n" + "\tmovs r1, 0x3\n" + "\tb _080113EC\n" + "\t.pool\n" + "_0801136C_case_30_case_33:\n" + "\tldr r1, =gUnknown_03005000\n" + "\tadds r2, r1, 0\n" + "\tadds r2, 0xF0\n" + "\tmovs r0, 0x4\n" + "\tstrb r0, [r2]\n" + "\tldr r3, =0x00000ce2\n" + "\tadds r1, r3\n" + "\tldr r0, =gUnknown_03004140\n" + "\tldrb r2, [r0, 0x14]\n" + "\tldrb r0, [r1]\n" + "\tadds r3, r0, 0\n" + "\tbics r3, r2\n" + "\tadds r2, r3, 0\n" + "\tstrb r2, [r1]\n" + "\tldr r0, =gReceivedRemoteLinkPlayers\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0x1\n" + "\tbne _080113B0\n" + "\tcmp r2, 0\n" + "\tbne _080113AC\n" + "\tadds r0, r4, 0\n" + "\tbl sub_8011170\n" + "\tb _080113B0\n" + "\t.pool\n" + "_080113AC:\n" + "\tbl sub_80111FC\n" + "_080113B0:\n" + "\tmovs r0, 0x2\n" + "\tadds r1, r4, 0\n" + "\tbl sub_8011A64\n" + "\tb _080113EE_break\n" + "_080113BA_case_f3:\n" + "\tmovs r0, 0x1\n" + "\tmovs r1, 0xF3\n" + "\tbl sub_8011A64\n" + "\tmovs r0, 0xF3\n" + "\tbl sub_8011170\n" + "\tldr r0, =gUnknown_03005000\n" + "\tadds r0, 0xEF\n" + "\tb _080113EA\n" + "\t.pool\n" + "_080113D4_case_f0_f1_f2_ff:\n" + "\tadds r0, r4, 0\n" + "\tbl sub_8011170\n" + "\tmovs r0, 0x1\n" + "\tadds r1, r4, 0\n" + "\tbl sub_8011A64\n" + "\tldr r0, =gUnknown_03005000\n" + "\tldr r1, =0x00000cdb\n" + "\tadds r0, r1\n" + "\tldrb r1, [r0]\n" + "_080113EA:\n" + "\tmovs r1, 0x1\n" + "_080113EC:\n" + "\tstrb r1, [r0]\n" + "_080113EE_break:\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 diff --git a/src/palette.c b/src/palette.c index d7b6ad479..417981e47 100644 --- a/src/palette.c +++ b/src/palette.c @@ -930,7 +930,7 @@ void TintPalette_SepiaTone(u16 *palette, u16 count) } } #else -__attribute__((naked)) +ASM_DIRECT void TintPalette_SepiaTone(u16 *palette, u16 count) { asm("push {r4-r7,lr}\n\ @@ -1036,7 +1036,7 @@ void TintPalette_CustomTone(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5) return; } #else -__attribute__((naked)) +ASM_DIRECT void TintPalette_CustomTone(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5) { asm("push {r4-r7,lr}\n\ diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e56448d8b..31af2bf2f 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1435,7 +1435,7 @@ void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) *ppBonusesPtr = localPpBonuses; } #else -__attribute__((naked)) +ASM_DIRECT void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) { asm(".syntax unified\n\ @@ -1646,7 +1646,7 @@ void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) *ppBonusesPtr = localPpBonuses; } #else -__attribute__((naked)) +ASM_DIRECT void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) { asm(".syntax unified\n\ @@ -2057,7 +2057,7 @@ void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) Free(alloced); } #else -__attribute__((naked)) +ASM_DIRECT void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) { asm(".syntax unified\n\ @@ -2359,7 +2359,7 @@ void sub_81C2194(u16 *a, u16 b, u8 c) } } #else -__attribute__((naked)) +ASM_DIRECT void sub_81C2194(u16 *a, u16 b, u8 c) { asm(".syntax unified\n\ @@ -2808,7 +2808,7 @@ u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) return r4[a]; } #else -__attribute__((naked)) +ASM_DIRECT u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) { asm(".syntax unified\n\ @@ -2853,7 +2853,7 @@ void sub_81C2D68(u8 a) } } #else -__attribute__((naked)) +ASM_DIRECT void sub_81C2D68(u8 a) { asm(".syntax unified\n\ @@ -3110,7 +3110,7 @@ void sub_81C335C() sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1); } #else -__attribute__((naked)) +ASM_DIRECT void sub_81C335C() { asm(".syntax unified\n\ @@ -3453,7 +3453,7 @@ void sub_81C3B08(u8 a) sub_81C25A4(sp, text, offset, (a<<4), 0, r5); } #else -__attribute__((naked)) +ASM_DIRECT void sub_81C3B08(u8 a) { asm(".syntax unified\n\ diff --git a/src/recorded_battle.c b/src/recorded_battle.c index c88229c61..db8e2816d 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -484,7 +484,7 @@ u32 MoveRecordedBattleToSaveData(void) } #else -__attribute__((naked)) +ASM_DIRECT u32 MoveRecordedBattleToSaveData(void) { asm(".syntax unified\n\ diff --git a/src/scrcmd.c b/src/scrcmd.c index 0557cd95e..16a39cd8c 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1537,7 +1537,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) CopyWindowToVram(gUnknown_03000F30, 3); return FALSE; }*/ -__attribute__((naked)) +ASM_DIRECT bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) { asm("push {r4-r7,lr}\n\ diff --git a/src/secret_base.c b/src/secret_base.c index bf6bec1f8..e2cb3b520 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -765,7 +765,7 @@ void sub_80E9914(void) } } #else -__attribute__((naked)) void sub_80E9914(void) +ASM_DIRECT void sub_80E9914(void) { asm_unified("\tpush {r4-r7,lr}\n" "\tmov r7, r10\n" diff --git a/src/sprite.c b/src/sprite.c index 6d76b9854..8d416f578 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -1228,7 +1228,7 @@ void obj_update_pos2(struct Sprite* sprite, s32 a1, s32 a2) } } #else -__attribute__((naked)) +ASM_DIRECT void obj_update_pos2(struct Sprite* sprite, s32 a1, s32 a2) { asm(".syntax unified\n\ diff --git a/src/text.c b/src/text.c index 5db3ba308..52ea06f84 100644 --- a/src/text.c +++ b/src/text.c @@ -374,7 +374,7 @@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) *(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor; } #else -__attribute__((naked)) +ASM_DIRECT void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) { asm("push {r4-r7,lr}\n\ @@ -870,7 +870,7 @@ void DecompressGlyphTile(const u16 *src, u16 *dest) *(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]]; } #else -__attribute__((naked)) +ASM_DIRECT void DecompressGlyphTile(const u16 *src, u16 *dest) { asm("push {r4-r7,lr}\n\ @@ -1051,7 +1051,7 @@ u8 GetLastTextColor(u8 colorType) } } -__attribute__((naked)) +ASM_DIRECT void CopyGlyphToWindow(struct TextPrinter *x) { asm("push {r4-r7,lr}\n\ @@ -2047,7 +2047,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c } } -__attribute__((naked)) +ASM_DIRECT u16 RenderText(struct TextPrinter *textPrinter) // 80057B4 { asm("push {r4-r6,lr}\n\ diff --git a/src/tv.c b/src/tv.c index af0c7069c..1053e51af 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2154,7 +2154,7 @@ void sub_80EDE98(TVShow *show) } } #else -__attribute__((naked)) +ASM_DIRECT void sub_80EDE98(TVShow *show) { asm_unified("\tpush {r4-r7,lr}\n" @@ -4110,7 +4110,7 @@ void sub_80F0708(void) // FIXME: register allocation shenanigans } } #else -__attribute__((naked)) void sub_80F0708(void) +ASM_DIRECT void sub_80F0708(void) { asm_unified("\tpush {r4-r7,lr}\n" "\tmov r7, r9\n" diff --git a/src/util.c b/src/util.c index 58088c3ee..4f9241b21 100644 --- a/src/util.c +++ b/src/util.c @@ -230,7 +230,7 @@ void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output) } #else -__attribute__((naked)) void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output) +ASM_DIRECT void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output) { asm("\n\ .syntax unified\n\ From f39053ee3023b02139784f88d346b3b57853c307 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 3 Feb 2018 10:19:56 -0500 Subject: [PATCH 123/123] common syms in window.c, because why not --- common_syms/window.txt | 5 +++++ include/window.h | 6 ++++++ src/window.c | 7 +++++-- sym_common.txt | 9 +-------- 4 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 common_syms/window.txt diff --git a/common_syms/window.txt b/common_syms/window.txt new file mode 100644 index 000000000..e1b52a24f --- /dev/null +++ b/common_syms/window.txt @@ -0,0 +1,5 @@ +filler_03002F58 +filler_03002F5C +gUnknown_03002F60 +filler_03002F64 +gUnknown_03002F70 diff --git a/include/window.h b/include/window.h index b630cd316..d52f07e94 100644 --- a/include/window.h +++ b/include/window.h @@ -68,5 +68,11 @@ void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, u8 *pixels, u16 srcX, u16 src void CopyWindowToVram8Bit(u8 windowId, u8 mode); extern struct Window gWindows[]; +extern void* gUnknown_03002F70[]; +extern u32 filler_03002F58; +extern u32 filler_03002F5C; +extern u32 filler_03002F64; + +extern u8 gUnknown_03002F60; #endif // GUARD_WINDOW_H diff --git a/src/window.c b/src/window.c index 3913b5800..40dfd5aa5 100644 --- a/src/window.c +++ b/src/window.c @@ -2,8 +2,11 @@ #include "window.h" #include "malloc.h" -extern u8 gUnknown_03002F60; -extern void* gUnknown_03002F70[]; +u32 filler_03002F58; +u32 filler_03002F5C; +u8 gUnknown_03002F60; +u32 filler_03002F64; +void *gUnknown_03002F70[4]; extern u32 gUnneededFireRedVariable; #define WINDOWS_MAX 32 diff --git a/sym_common.txt b/sym_common.txt index 9641c28b9..dacc91d10 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -1,14 +1,7 @@ .space 0x8 .include "main.o" .include "bg.o" - - .align 4 -gUnknown_03002F60: @ 3002F60 - .space 0x10 - -gUnknown_03002F70: @ 3002F70 - .space 0x10 - + .include "window.o" .include "text.o" .include "sprite.o" .include "link.o"