Merge pull request #194 from DizzyEggg/decompile_mystery_event_menu

decompile mystery event menu
This commit is contained in:
Diegoisawesome 2018-01-30 20:33:27 -06:00 committed by GitHub
commit eb5737357d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 465 additions and 831 deletions

View File

@ -178,7 +178,7 @@ _080B24C8:
b _080B24F2 b _080B24F2
_080B24CC: _080B24CC:
ldr r4, =gStringVar1 ldr r4, =gStringVar1
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r1, r0, 0 adds r1, r0, 0
lsls r1, 24 lsls r1, 24
lsrs r1, 24 lsrs r1, 24
@ -239,7 +239,7 @@ sub_80B252C: @ 80B252C
ands r0, r1 ands r0, r1
cmp r0, 0 cmp r0, 0
beq _080B2570 beq _080B2570
bl sub_800B320 bl IsLinkConnectionEstablished
lsls r0, 24 lsls r0, 24
lsrs r1, r0, 24 lsrs r1, r0, 24
cmp r1, 0 cmp r1, 0
@ -269,7 +269,7 @@ sub_80B2578: @ 80B2578
push {r4,lr} push {r4,lr}
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl sub_800B320 bl IsLinkConnectionEstablished
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080B258E beq _080B258E
@ -404,7 +404,7 @@ sub_80B2688: @ 80B2688
push {r4,r5,lr} push {r4,r5,lr}
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 24 lsrs r5, r0, 24
adds r0, r4, 0 adds r0, r4, 0
@ -426,7 +426,7 @@ sub_80B2688: @ 80B2688
adds r4, r0, r1 adds r4, r0, r1
movs r0, 0 movs r0, 0
strh r0, [r4, 0xE] strh r0, [r4, 0xE]
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -506,7 +506,7 @@ sub_80B275C: @ 80B275C
mov r9, r0 mov r9, r0
mov r7, r8 mov r7, r8
add r7, r9 add r7, r9
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 24 lsrs r5, r0, 24
adds r0, r4, 0 adds r0, r4, 0
@ -585,7 +585,7 @@ sub_80B2804: @ 80B2804
bne _080B2898 bne _080B2898
bl sub_800AA48 bl sub_800AA48
adds r4, r0, 0 adds r4, r0, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
@ -652,7 +652,7 @@ sub_80B28A8: @ 80B28A8
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
beq _080B290A beq _080B290A
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r4, r0, 0 adds r4, r0, 0
bl sub_800AA48 bl sub_800AA48
lsls r4, 24 lsls r4, 24
@ -729,13 +729,13 @@ _080B297C:
cmp r2, 0x9 cmp r2, 0x9
bne _080B2994 bne _080B2994
_080B2984: _080B2984:
bl sub_80097E8 bl CloseLink
bl HideFieldMessageBox bl HideFieldMessageBox
ldr r0, =sub_80B2CB0 ldr r0, =sub_80B2CB0
b _080B29E4 b _080B29E4
.pool .pool
_080B2994: _080B2994:
bl sub_800ABAC bl GetLinkPlayerCount_2
ldr r4, =gUnknown_03005DB8 ldr r4, =gUnknown_03005DB8
strb r0, [r4] strb r0, [r4]
bl GetMultiplayerId bl GetMultiplayerId
@ -812,7 +812,7 @@ _080B2A42:
cmp r0, 0x9 cmp r0, 0x9
bne _080B2A6C bne _080B2A6C
_080B2A4A: _080B2A4A:
bl sub_80097E8 bl CloseLink
_080B2A4E: _080B2A4E:
bl HideFieldMessageBox bl HideFieldMessageBox
ldr r0, =gTasks ldr r0, =gTasks
@ -825,7 +825,7 @@ _080B2A4E:
b _080B2ACE b _080B2ACE
.pool .pool
_080B2A6C: _080B2A6C:
bl sub_800ABAC bl GetLinkPlayerCount_2
ldr r4, =gUnknown_03005DB8 ldr r4, =gUnknown_03005DB8
strb r0, [r4] strb r0, [r4]
bl GetMultiplayerId bl GetMultiplayerId
@ -1610,7 +1610,7 @@ sub_80B3144: @ 80B3144
ldrsh r2, [r4, r3] ldrsh r2, [r4, r3]
cmp r2, 0 cmp r2, 0
bne _080B3178 bne _080B3178
bl sub_8009734 bl OpenLink
bl sub_800A2BC bl sub_800A2BC
ldr r0, =task00_08081A90 ldr r0, =task00_08081A90
movs r1, 0x50 movs r1, 0x50
@ -1640,12 +1640,12 @@ sub_80B3194: @ 80B3194
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
adds r5, r4, 0 adds r5, r4, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
bls _080B31DA bls _080B31DA
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -1681,7 +1681,7 @@ sub_80B31E8: @ 80B31E8
lsrs r5, r0, 24 lsrs r5, r0, 24
bl sub_800AA48 bl sub_800AA48
adds r4, r0, 0 adds r4, r0, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
@ -2651,7 +2651,7 @@ task00_08081A90: @ 80B3A30
lsls r0, 17 lsls r0, 17
cmp r1, r0 cmp r1, r0
ble _080B3A62 ble _080B3A62
bl sub_80097E8 bl CloseLink
ldr r0, =c2_800ACD4 ldr r0, =c2_800ACD4
bl SetMainCallback2 bl SetMainCallback2
adds r0, r4, 0 adds r0, r4, 0
@ -2669,7 +2669,7 @@ _080B3A62:
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
bne _080B3A86 bne _080B3A86
bl sub_80097E8 bl CloseLink
ldr r0, =c2_800ACD4 ldr r0, =c2_800ACD4
bl SetMainCallback2 bl SetMainCallback2
_080B3A86: _080B3A86:
@ -2761,7 +2761,7 @@ _080B3B2A:
b _080B3BB8 b _080B3BB8
.pool .pool
_080B3B40: _080B3B40:
bl sub_8009734 bl OpenLink
ldr r0, =task00_08081A90 ldr r0, =task00_08081A90
movs r1, 0x1 movs r1, 0x1
bl CreateTask bl CreateTask
@ -2779,14 +2779,14 @@ _080B3B54:
strh r0, [r5, 0x2] strh r0, [r5, 0x2]
b _080B3B96 b _080B3B96
_080B3B68: _080B3B68:
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r4, r0, 0 adds r4, r0, 0
bl sub_800AA48 bl sub_800AA48
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
bcc _080B3BB8 bcc _080B3BB8
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080B3B96 beq _080B3B96

View File

@ -15,7 +15,7 @@ sub_80093CC: @ 80093CC
cmp r0, r1 cmp r0, r1
beq _080093F4 beq _080093F4
bl sub_800B4A4 bl sub_800B4A4
bl sub_80097E8 bl CloseLink
bl RestoreSerialTimer3IntrHandlers bl RestoreSerialTimer3IntrHandlers
movs r0, 0 movs r0, 0
b _080093FE b _080093FE
@ -29,15 +29,15 @@ _080093FE:
bx r1 bx r1
thumb_func_end sub_80093CC thumb_func_end sub_80093CC
thumb_func_start sub_8009404 thumb_func_start Task_DestroySelf
sub_8009404: @ 8009404 Task_DestroySelf: @ 8009404
push {lr} push {lr}
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
bl DestroyTask bl DestroyTask
pop {r0} pop {r0}
bx r0 bx r0
thumb_func_end sub_8009404 thumb_func_end Task_DestroySelf
thumb_func_start sub_8009414 thumb_func_start sub_8009414
sub_8009414: @ 8009414 sub_8009414: @ 8009414
@ -210,7 +210,7 @@ sub_8009570: @ 8009570
ldr r2, =0x00001111 ldr r2, =0x00001111
adds r0, r2, 0 adds r0, r2, 0
strh r0, [r1] strh r0, [r1]
bl sub_8009734 bl OpenLink
ldr r0, =gMain ldr r0, =gMain
ldrh r0, [r0, 0x24] ldrh r0, [r0, 0x24]
bl SeedRng bl SeedRng
@ -236,7 +236,7 @@ _080095A0:
lsls r1, 5 lsls r1, 5
movs r0, 0 movs r0, 0
bl SetGpuReg bl SetGpuReg
ldr r0, =sub_8009404 ldr r0, =Task_DestroySelf
movs r1, 0 movs r1, 0
bl CreateTask bl CreateTask
bl RunTasks bl RunTasks
@ -384,8 +384,8 @@ _08009726:
.pool .pool
thumb_func_end task02_080097CC thumb_func_end task02_080097CC
thumb_func_start sub_8009734 thumb_func_start OpenLink
sub_8009734: @ 8009734 OpenLink: @ 8009734
push {r4-r6,lr} push {r4-r6,lr}
ldr r0, =gLinkVSyncDisabled ldr r0, =gLinkVSyncDisabled
ldrb r4, [r0] ldrb r4, [r0]
@ -443,10 +443,10 @@ _080097BE:
pop {r0} pop {r0}
bx r0 bx r0
.pool .pool
thumb_func_end sub_8009734 thumb_func_end OpenLink
thumb_func_start sub_80097E8 thumb_func_start CloseLink
sub_80097E8: @ 80097E8 CloseLink: @ 80097E8
push {r4,lr} push {r4,lr}
ldr r0, =gReceivedRemoteLinkPlayers ldr r0, =gReceivedRemoteLinkPlayers
movs r4, 0 movs r4, 0
@ -464,7 +464,7 @@ _080097FC:
pop {r0} pop {r0}
bx r0 bx r0
.pool .pool
thumb_func_end sub_80097E8 thumb_func_end CloseLink
thumb_func_start sub_8009818 thumb_func_start sub_8009818
sub_8009818: @ 8009818 sub_8009818: @ 8009818
@ -698,7 +698,7 @@ _080099FC:
bls _080099FC bls _080099FC
ldrh r0, [r4] ldrh r0, [r4]
strh r0, [r5] strh r0, [r5]
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldr r0, [r0] ldr r0, [r0]
movs r1, 0x40 movs r1, 0x40
ands r0, r1 ands r0, r1
@ -717,7 +717,7 @@ _080099FC:
_08009A34: _08009A34:
bl sub_800AEB4 bl sub_800AEB4
_08009A38: _08009A38:
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldrh r0, [r0] ldrh r0, [r0]
_08009A3C: _08009A3C:
pop {r4,r5} pop {r4,r5}
@ -745,7 +745,7 @@ _08009A70:
adds r5, r0 adds r5, r0
adds r4, 0x1 adds r4, 0x1
_08009A78: _08009A78:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r4, r0 cmp r4, r0
@ -1378,7 +1378,7 @@ GetLinkPlayerCount: @ 8009FCC
ldrb r0, [r0] ldrb r0, [r0]
cmp r0, 0 cmp r0, 0
bne _08009FEC bne _08009FEC
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldr r0, [r0] ldr r0, [r0]
movs r1, 0x1C movs r1, 0x1C
ands r0, r1 ands r0, r1
@ -1514,7 +1514,7 @@ sub_800A0AC: @ 800A0AC
str r1, [r0] str r1, [r0]
ldr r0, =gUnknown_020229C8 ldr r0, =gUnknown_020229C8
strh r1, [r0] strh r1, [r0]
bl sub_8009734 bl OpenLink
pop {r0} pop {r0}
bx r0 bx r0
.pool .pool
@ -1532,7 +1532,7 @@ sub_800A0C8: @ 800A0C8
beq _0800A0DA beq _0800A0DA
b _0800A214 b _0800A214
_0800A0DA: _0800A0DA:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r5, r0 cmp r5, r0
@ -1552,7 +1552,7 @@ _0800A0FC:
bne _0800A10E bne _0800A10E
ldr r0, =gUnknown_0300306C ldr r0, =gUnknown_0300306C
strb r4, [r0] strb r4, [r0]
bl sub_80097E8 bl CloseLink
_0800A10E: _0800A10E:
movs r6, 0 movs r6, 0
ldr r4, =gLinkPlayers ldr r4, =gLinkPlayers
@ -2211,7 +2211,7 @@ _0800A616:
thumb_func_start sub_800A620 thumb_func_start sub_800A620
sub_800A620: @ 800A620 sub_800A620: @ 800A620
push {lr} push {lr}
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldr r1, [r0] ldr r1, [r0]
movs r0, 0x20 movs r0, 0x20
ands r0, r1 ands r0, r1
@ -2499,7 +2499,7 @@ _0800A81C:
thumb_func_start sub_800A824 thumb_func_start sub_800A824
sub_800A824: @ 800A824 sub_800A824: @ 800A824
push {lr} push {lr}
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldr r0, [r0] ldr r0, [r0]
movs r1, 0x20 movs r1, 0x20
ands r0, r1 ands r0, r1
@ -2534,7 +2534,7 @@ task00_link_test: @ 800A850
movs r2, 0x1 movs r2, 0x1
movs r3, 0x2 movs r3, 0x2
bl sub_800A6E8 bl sub_800A6E8
ldr r4, =gUnknown_030030E0 ldr r4, =gLinkStatus
ldr r0, [r4] ldr r0, [r4]
movs r1, 0xF movs r1, 0xF
movs r2, 0x1 movs r2, 0x1
@ -2606,7 +2606,7 @@ task00_link_test: @ 800A850
movs r2, 0x6 movs r2, 0x6
movs r3, 0x1 movs r3, 0x1
bl sub_800A6E8 bl sub_800A6E8
bl sub_800B320 bl IsLinkConnectionEstablished
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0x19 movs r1, 0x19
@ -2807,7 +2807,7 @@ _0800AAB4:
ldrb r0, [r0] ldrb r0, [r0]
cmp r3, r0 cmp r3, r0
bne _0800AAE4 bne _0800AAE4
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
mov r1, r9 mov r1, r9
@ -2887,7 +2887,7 @@ _0800AB5A:
ldr r1, =gUnknown_0300306C ldr r1, =gUnknown_0300306C
movs r0, 0x1 movs r0, 0x1
strb r0, [r1] strb r0, [r1]
bl sub_80097E8 bl CloseLink
ldr r0, =c2_800ACD4 ldr r0, =c2_800ACD4
bl SetMainCallback2 bl SetMainCallback2
_0800AB6A: _0800AB6A:
@ -2918,25 +2918,25 @@ sub_800AB98: @ 800AB98
.pool .pool
thumb_func_end sub_800AB98 thumb_func_end sub_800AB98
thumb_func_start sub_800ABAC thumb_func_start GetLinkPlayerCount_2
sub_800ABAC: @ 800ABAC GetLinkPlayerCount_2: @ 800ABAC
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldr r0, [r0] ldr r0, [r0]
movs r1, 0x1C movs r1, 0x1C
ands r0, r1 ands r0, r1
lsrs r0, 2 lsrs r0, 2
bx lr bx lr
.pool .pool
thumb_func_end sub_800ABAC thumb_func_end GetLinkPlayerCount_2
thumb_func_start sub_800ABBC thumb_func_start IsLinkMaster
sub_800ABBC: @ 800ABBC IsLinkMaster: @ 800ABBC
push {lr} push {lr}
ldr r0, =gLinkVSyncDisabled ldr r0, =gLinkVSyncDisabled
ldrb r0, [r0] ldrb r0, [r0]
cmp r0, 0 cmp r0, 0
bne _0800ABDC bne _0800ABDC
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldr r0, [r0] ldr r0, [r0]
lsrs r0, 5 lsrs r0, 5
movs r1, 0x1 movs r1, 0x1
@ -2950,7 +2950,7 @@ _0800ABDC:
_0800ABE4: _0800ABE4:
pop {r1} pop {r1}
bx r1 bx r1
thumb_func_end sub_800ABBC thumb_func_end IsLinkMaster
thumb_func_start sub_800ABE8 thumb_func_start sub_800ABE8
sub_800ABE8: @ 800ABE8 sub_800ABE8: @ 800ABE8
@ -3074,7 +3074,7 @@ _0800ACD0:
ldr r0, =gUnknown_03002748 ldr r0, =gUnknown_03002748
movs r4, 0x1 movs r4, 0x1
strb r4, [r0] strb r4, [r0]
bl sub_80097E8 bl CloseLink
ldr r1, =gUnknown_03003140 ldr r1, =gUnknown_03003140
movs r0, 0 movs r0, 0
str r0, [r1] str r0, [r1]
@ -3178,7 +3178,7 @@ _0800ADB6:
ldr r0, =gUnknown_03002748 ldr r0, =gUnknown_03002748
movs r4, 0x1 movs r4, 0x1
strb r4, [r0] strb r4, [r0]
bl sub_80097E8 bl CloseLink
ldr r1, =gUnknown_03003140 ldr r1, =gUnknown_03003140
movs r0, 0 movs r0, 0
str r0, [r1] str r0, [r1]
@ -3290,7 +3290,7 @@ sub_800AEB4: @ 800AEB4
ldrb r0, [r0] ldrb r0, [r0]
cmp r0, 0 cmp r0, 0
beq _0800AEF4 beq _0800AEF4
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldr r2, [r0] ldr r2, [r0]
movs r0, 0xFE movs r0, 0xFE
lsls r0, 11 lsls r0, 11
@ -3315,7 +3315,7 @@ _0800AEEA:
ldr r1, =gUnknown_0300306C ldr r1, =gUnknown_0300306C
movs r0, 0x1 movs r0, 0x1
strb r0, [r1] strb r0, [r1]
bl sub_80097E8 bl CloseLink
_0800AEF4: _0800AEF4:
pop {r0} pop {r0}
bx r0 bx r0
@ -3426,7 +3426,7 @@ _0800AF8C:
ldr r1, =gSoftResetDisabled ldr r1, =gSoftResetDisabled
movs r0, 0 movs r0, 0
strb r0, [r1] strb r0, [r1]
ldr r0, =sub_8009404 ldr r0, =Task_DestroySelf
movs r1, 0 movs r1, 0
bl CreateTask bl CreateTask
bl StopMapMusic bl StopMapMusic
@ -3740,16 +3740,16 @@ _0800B314:
.pool .pool
thumb_func_end sub_800B2F8 thumb_func_end sub_800B2F8
thumb_func_start sub_800B320 thumb_func_start IsLinkConnectionEstablished
sub_800B320: @ 800B320 IsLinkConnectionEstablished: @ 800B320
ldr r0, =gUnknown_030030E0 ldr r0, =gLinkStatus
ldr r0, [r0] ldr r0, [r0]
lsrs r0, 6 lsrs r0, 6
movs r1, 0x1 movs r1, 0x1
ands r0, r1 ands r0, r1
bx lr bx lr
.pool .pool
thumb_func_end sub_800B320 thumb_func_end IsLinkConnectionEstablished
thumb_func_start sub_800B330 thumb_func_start sub_800B330
sub_800B330: @ 800B330 sub_800B330: @ 800B330
@ -3864,7 +3864,7 @@ HandleLinkConnection: @ 800B40C
ldr r1, =gSendCmd ldr r1, =gSendCmd
ldr r2, =gRecvCmds ldr r2, =gRecvCmds
bl sub_800B638 bl sub_800B638
ldr r4, =gUnknown_030030E0 ldr r4, =gLinkStatus
str r0, [r4] str r0, [r4]
ldr r0, =gUnknown_030022EC ldr r0, =gUnknown_030022EC
bl sub_80099E0 bl sub_80099E0
@ -15025,7 +15025,7 @@ _08010E20:
ldrb r1, [r0] ldrb r1, [r0]
movs r1, 0x2 movs r1, 0x2
strb r1, [r0] strb r1, [r0]
bl sub_80097E8 bl CloseLink
b _08010E8E b _08010E8E
.pool .pool
_08010E5C: _08010E5C:
@ -16613,7 +16613,7 @@ sub_8011AFC: @ 8011AFC
adds r0, r2, 0 adds r0, r2, 0
strh r0, [r1] strh r0, [r1]
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
ldr r0, =gMain ldr r0, =gMain
ldrh r0, [r0, 0x24] ldrh r0, [r0, 0x24]
bl SeedRng bl SeedRng
@ -18142,7 +18142,7 @@ _08012848:
movs r2, 0 movs r2, 0
bl sub_8010F84 bl sub_8010F84
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
ldrb r1, [r4] ldrb r1, [r4]
movs r0, 0xF movs r0, 0xF
ands r0, r1 ands r0, r1
@ -19650,7 +19650,7 @@ _08013590:
movs r2, 0 movs r2, 0
bl sub_8010F84 bl sub_8010F84
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
bl sub_8011C5C bl sub_8011C5C
movs r0, 0x70 movs r0, 0x70
bl AllocZeroed bl AllocZeroed
@ -20398,7 +20398,7 @@ _08013CD0:
movs r2, 0 movs r2, 0
bl sub_8010F84 bl sub_8010F84
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
bl sub_8011C5C bl sub_8011C5C
movs r0, 0x1 movs r0, 0x1
bl sub_80111B0 bl sub_80111B0
@ -21897,7 +21897,7 @@ _08014AB0:
movs r1, 0 movs r1, 0
bl sub_8010FA0 bl sub_8010FA0
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
movs r0, 0x2 movs r0, 0x2
bl sub_8011C10 bl sub_8011C10
movs r0, 0x1 movs r0, 0x1
@ -22435,7 +22435,7 @@ _08014FA4:
movs r2, 0 movs r2, 0
bl sub_8010F84 bl sub_8010F84
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
bl sub_8011C5C bl sub_8011C5C
movs r0, 0x70 movs r0, 0x70
bl AllocZeroed bl AllocZeroed
@ -22823,7 +22823,7 @@ _08015358:
movs r2, 0 movs r2, 0
bl sub_8010F84 bl sub_8010F84
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
bl sub_8011C5C bl sub_8011C5C
movs r0, 0x70 movs r0, 0x70
bl AllocZeroed bl AllocZeroed
@ -23373,7 +23373,7 @@ _08015878:
ldrh r2, [r2, 0xC] ldrh r2, [r2, 0xC]
bl sub_8010FCC bl sub_8010FCC
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
bl sub_8011C84 bl sub_8011C84
ldr r0, [r6, 0x8] ldr r0, [r6, 0x8]
movs r1, 0x1 movs r1, 0x1
@ -25223,7 +25223,7 @@ _080169BE:
movs r2, 0 movs r2, 0
bl sub_8010F84 bl sub_8010F84
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
bl sub_8011C84 bl sub_8011C84
movs r0, 0x1 movs r0, 0x1
bl sub_80111B0 bl sub_80111B0
@ -31098,7 +31098,7 @@ _080198FE:
b _08019922 b _08019922
.pool .pool
_0801990C: _0801990C:
bl sub_80097E8 bl CloseLink
ldr r0, [r5, 0x10] ldr r0, [r5, 0x10]
bl Free bl Free
adds r0, r4, 0 adds r0, r4, 0

View File

@ -1495,7 +1495,7 @@ _08030478:
b _0803048A b _0803048A
.pool .pool
_08030480: _08030480:
ldr r0, =sub_8178974 ldr r0, =CB2_InitMysteryEventMenu
b _0803048A b _0803048A
.pool .pool
_08030488: _08030488:

View File

@ -1,669 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_8178944
sub_8178944: @ 8178944
push {lr}
bl LoadOam
bl ProcessSpriteCopyRequests
bl TransferPlttBuffer
pop {r0}
bx r0
thumb_func_end sub_8178944
thumb_func_start sub_8178958
sub_8178958: @ 8178958
push {lr}
movs r2, 0
ldr r1, =gLinkPlayers
ldrh r0, [r1, 0x1A]
ldrh r1, [r1, 0x36]
cmp r0, r1
bne _08178968
movs r2, 0x1
_08178968:
adds r0, r2, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_8178958
thumb_func_start sub_8178974
sub_8178974: @ 8178974
push {r4,lr}
sub sp, 0x8
bl ResetSpriteData
bl FreeAllSpritePalettes
bl ResetTasks
ldr r0, =sub_8178944
bl SetVBlankCallback
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_085EFD64
movs r0, 0
movs r2, 0x1
bl InitBgsFromTemplates
ldr r0, =gUnknown_085EFD68
bl InitWindows
lsls r0, 16
cmp r0, 0
beq _08178A22
bl DeactivateAllTextPrinters
movs r4, 0
_081789AC:
lsls r0, r4, 24
lsrs r0, 24
movs r1, 0
bl FillWindowPixelBuffer
adds r4, 0x1
cmp r4, 0x1
ble _081789AC
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
movs r1, 0x1
movs r2, 0xD0
bl sub_809882C
movs r0, 0xE0
bl sub_81978B0
movs r1, 0xA0
lsls r1, 1
movs r0, 0
bl SetGpuReg
movs r0, 0x50
movs r1, 0
bl SetGpuReg
ldr r0, =sub_8009404
movs r1, 0
bl CreateTask
bl StopMapMusic
bl RunTasks
bl AnimateSprites
bl BuildOamBuffer
bl RunTextPrinters
bl UpdatePaletteFade
movs r0, 0
movs r1, 0
movs r2, 0x2
bl FillPalette
ldr r0, =sub_8178A78
bl SetMainCallback2
_08178A22:
add sp, 0x8
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8178974
thumb_func_start sub_8178A40
sub_8178A40: @ 8178A40
push {r4-r6,lr}
adds r6, r0, 0
adds r4, r1, 0
movs r5, 0x1
cmp r4, 0
bne _08178A54
ldr r1, =gText_EventSafelyLoaded
bl StringCopy
movs r5, 0
_08178A54:
cmp r4, 0x2
bne _08178A5A
movs r5, 0
_08178A5A:
cmp r4, 0x1
bne _08178A66
ldr r1, =gText_LoadErrorEndingSession
adds r0, r6, 0
bl StringCopy
_08178A66:
adds r0, r5, 0
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end sub_8178A40
thumb_func_start sub_8178A78
sub_8178A78: @ 8178A78
push {r4-r6,lr}
sub sp, 0x8
ldr r1, =gMain
movs r2, 0x87
lsls r2, 3
adds r0, r1, r2
ldrb r0, [r0]
adds r4, r1, 0
cmp r0, 0x10
bls _08178A8E
b _08178E58
_08178A8E:
lsls r0, 2
ldr r1, =_08178AA0
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08178AA0:
.4byte _08178AE4
.4byte _08178B12
.4byte _08178B48
.4byte _08178B80
.4byte _08178BCC
.4byte _08178BDC
.4byte _08178C54
.4byte _08178D28
.4byte _08178D38
.4byte _08178D58
.4byte _08178D60
.4byte _08178D74
.4byte _08178DBC
.4byte _08178DE0
.4byte _08178E0C
.4byte _08178E24
.4byte _08178E48
_08178AE4:
movs r0, 0
movs r1, 0x1
movs r2, 0x1
movs r3, 0xD
bl SetWindowBorderStyle
movs r0, 0
bl PutWindowTilemap
movs r0, 0
movs r1, 0x3
bl CopyWindowToVram
movs r0, 0
bl ShowBg
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0x10
movs r3, 0
b _08178E30
_08178B12:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _08178B20
b _08178E58
_08178B20:
ldr r1, =gText_LinkStandby2
movs r0, 0x1
str r0, [sp]
movs r0, 0
movs r2, 0x1
movs r3, 0x2
bl sub_8178EC4
ldr r1, =gMain
movs r2, 0x87
lsls r2, 3
adds r1, r2
b _08178E3C
.pool
_08178B48:
movs r0, 0
bl IsTextPrinterActive
lsls r0, 16
cmp r0, 0
beq _08178B56
b _08178E58
_08178B56:
ldr r1, =gMain
movs r0, 0x87
lsls r0, 3
adds r1, r0
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
ldr r1, =gLinkType
ldr r2, =0x00005501
adds r0, r2, 0
strh r0, [r1]
bl sub_8009734
b _08178E58
.pool
_08178B80:
ldr r0, =gUnknown_030030E0
ldr r1, [r0]
movs r0, 0x20
ands r0, r1
cmp r0, 0
bne _08178B8E
b _08178D00
_08178B8E:
movs r0, 0x1C
ands r1, r0
cmp r1, 0x4
bhi _08178B98
b _08178D00
_08178B98:
movs r0, 0x15
bl PlaySE
ldr r1, =gText_PressAToLoadEvent
movs r0, 0x1
str r0, [sp]
movs r0, 0
movs r2, 0x1
movs r3, 0x2
bl sub_8178EC4
ldr r1, =gMain
movs r0, 0x87
lsls r0, 3
adds r1, r0
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _08178D00
.pool
_08178BCC:
movs r0, 0
bl IsTextPrinterActive
lsls r0, 16
cmp r0, 0
beq _08178BDA
b _08178E58
_08178BDA:
b _08178E34
_08178BDC:
bl sub_800ABAC
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x2
bne _08178CD0
ldr r4, =gMain
ldrh r1, [r4, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _08178C38
movs r0, 0x5
bl PlaySE
bl sub_800A620
movs r0, 0x1
movs r1, 0x1
movs r2, 0x1
movs r3, 0xD
bl SetWindowBorderStyle
ldr r1, =gText_LoadingEvent
movs r0, 0
str r0, [sp]
movs r0, 0x1
movs r2, 0x1
movs r3, 0x2
bl sub_8178EC4
movs r0, 0x1
bl PutWindowTilemap
movs r0, 0x1
movs r1, 0x3
bl CopyWindowToVram
movs r2, 0x87
lsls r2, 3
adds r1, r4, r2
b _08178E3C
.pool
_08178C38:
adds r0, r2, 0
ands r0, r1
cmp r0, 0
bne _08178C42
b _08178E58
_08178C42:
movs r0, 0x5
bl PlaySE
bl sub_80097E8
movs r0, 0x87
lsls r0, 3
adds r1, r4, r0
b _08178D1E
_08178C54:
bl sub_800B320
lsls r0, 24
cmp r0, 0
beq _08178D00
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
bne _08178C68
b _08178E58
_08178C68:
movs r0, 0x2
movs r1, 0x2
bl sub_800A0C8
lsls r0, 24
lsrs r0, 24
cmp r0, 0x3
bne _08178CAC
bl sub_800AC34
ldr r4, =gStringVar4
adds r0, r4, 0
movs r1, 0x1
bl sub_8178A40
movs r0, 0x1
str r0, [sp]
movs r0, 0
adds r1, r4, 0
movs r2, 0x1
movs r3, 0x2
bl sub_8178EC4
ldr r0, =gMain
movs r2, 0x87
lsls r2, 3
adds r0, r2
b _08178CF2
.pool
_08178CAC:
bl sub_8178958
lsls r0, 24
cmp r0, 0
beq _08178CCC
ldr r1, =gText_DontRemoveCableTurnOff
movs r0, 0x1
str r0, [sp]
movs r0, 0
movs r2, 0x1
movs r3, 0x2
bl sub_8178EC4
b _08178E34
.pool
_08178CCC:
bl sub_80097E8
_08178CD0:
ldr r4, =gStringVar4
adds r0, r4, 0
movs r1, 0x1
bl sub_8178A40
movs r0, 0x1
str r0, [sp]
movs r0, 0
adds r1, r4, 0
movs r2, 0x1
movs r3, 0x2
bl sub_8178EC4
ldr r0, =gMain
movs r1, 0x87
lsls r1, 3
adds r0, r1
_08178CF2:
movs r1, 0xD
strb r1, [r0]
b _08178E58
.pool
_08178D00:
ldr r4, =gMain
ldrh r1, [r4, 0x2E]
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _08178D0E
b _08178E58
_08178D0E:
movs r0, 0x5
bl PlaySE
bl sub_80097E8
movs r2, 0x87
lsls r2, 3
adds r1, r4, r2
_08178D1E:
movs r0, 0xF
strb r0, [r1]
b _08178E58
.pool
_08178D28:
movs r0, 0
bl IsTextPrinterActive
lsls r0, 16
cmp r0, 0
beq _08178D36
b _08178E58
_08178D36:
b _08178E34
_08178D38:
bl GetBlockReceivedStatus
lsls r0, 24
cmp r0, 0
bne _08178D44
b _08178E58
_08178D44:
bl ResetBlockReceivedFlags
ldr r1, =gMain
movs r2, 0x87
lsls r2, 3
adds r1, r2
b _08178E3C
.pool
_08178D58:
movs r0, 0x87
lsls r0, 3
adds r1, r4, r0
b _08178E3C
_08178D60:
bl sub_800AC34
ldr r1, =gMain
movs r2, 0x87
lsls r2, 3
adds r1, r2
b _08178E3C
.pool
_08178D74:
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r6, [r0]
cmp r6, 0
bne _08178E58
ldr r5, =0x0201c000
adds r0, r5, 0
bl RunMysteryEventScript
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
str r6, [sp, 0x4]
ldr r2, =0x050001f5
add r0, sp, 0x4
adds r1, r5, 0
bl CpuSet
ldr r0, =gStringVar4
adds r1, r4, 0
bl sub_8178A40
lsls r0, 24
cmp r0, 0
bne _08178E34
movs r0, 0
bl TrySavingData
b _08178E34
.pool
_08178DBC:
ldr r1, =gStringVar4
movs r0, 0x1
str r0, [sp]
movs r0, 0
movs r2, 0x1
movs r3, 0x2
bl sub_8178EC4
ldr r1, =gMain
movs r2, 0x87
lsls r2, 3
adds r1, r2
b _08178E3C
.pool
_08178DE0:
movs r0, 0
bl IsTextPrinterActive
lsls r0, 16
lsrs r2, r0, 16
cmp r2, 0
bne _08178E58
ldr r0, =gMain
movs r1, 0x87
lsls r1, 3
adds r0, r1
ldrb r1, [r0]
adds r1, 0x1
strb r1, [r0]
ldr r0, =gUnknown_0203BCF8
strb r2, [r0]
b _08178E58
.pool
_08178E0C:
ldrh r1, [r4, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _08178E58
movs r0, 0x5
bl PlaySE
movs r2, 0x87
lsls r2, 3
adds r1, r4, r2
b _08178E3C
_08178E24:
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0
movs r3, 0x10
_08178E30:
bl BeginNormalPaletteFade
_08178E34:
ldr r1, =gMain
movs r0, 0x87
lsls r0, 3
adds r1, r0
_08178E3C:
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _08178E58
.pool
_08178E48:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _08178E58
bl DoSoftReset
_08178E58:
ldr r0, =gUnknown_030030E0
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
cmp r0, 0
beq _08178E98
bl sub_800ABBC
lsls r0, 24
cmp r0, 0
bne _08178E98
bl sub_80097E8
ldr r4, =gStringVar4
adds r0, r4, 0
movs r1, 0x1
bl sub_8178A40
movs r0, 0x1
str r0, [sp]
movs r0, 0
adds r1, r4, 0
movs r2, 0x1
movs r3, 0x2
bl sub_8178EC4
ldr r0, =gMain
movs r1, 0x87
lsls r1, 3
adds r0, r1
movs r1, 0xD
strb r1, [r0]
_08178E98:
bl RunTasks
bl AnimateSprites
bl BuildOamBuffer
bl RunTextPrinters
bl UpdatePaletteFade
add sp, 0x8
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8178A78
thumb_func_start sub_8178EC4
sub_8178EC4: @ 8178EC4
push {r4-r6,lr}
mov r6, r10
mov r5, r9
mov r4, r8
push {r4-r6}
sub sp, 0x1C
adds r5, r0, 0
mov r10, r1
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 r8, r1
add r0, sp, 0x14
mov r1, r8
strb r1, [r0]
adds r1, r0, 0
movs r0, 0x2
strb r0, [r1, 0x1]
movs r0, 0x3
strb r0, [r1, 0x2]
adds r0, r1, 0
ldrb r0, [r0]
lsls r1, r0, 4
orrs r1, r0
lsls r1, 24
lsrs r1, 24
adds r0, r5, 0
str r3, [sp, 0x18]
bl FillWindowPixelBuffer
mov r0, r9
str r0, [sp]
mov r1, r8
str r1, [sp, 0x4]
add r0, sp, 0x14
str r0, [sp, 0x8]
lsls r4, 24
asrs r4, 24
str r4, [sp, 0xC]
mov r1, r10
str r1, [sp, 0x10]
adds r0, r5, 0
movs r1, 0x1
adds r2, r6, 0
ldr r3, [sp, 0x18]
bl AddTextPrinterParameterized2
add sp, 0x1C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_8178EC4
.align 2, 0 @ Don't pad with nop.

View File

@ -3584,7 +3584,7 @@ sub_808631C: @ 808631C
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
bne _0808632E bne _0808632E
bl sub_80097E8 bl CloseLink
_0808632E: _0808632E:
ldr r0, =gLinkVSyncDisabled ldr r0, =gLinkVSyncDisabled
ldrb r0, [r0] ldrb r0, [r0]

View File

@ -28072,7 +28072,7 @@ sub_81D4E30: @ 81D4E30
ldr r2, =0x00005503 ldr r2, =0x00005503
adds r0, r2, 0 adds r0, r2, 0
strh r0, [r1] strh r0, [r1]
bl sub_8009734 bl OpenLink
movs r0, 0x1 movs r0, 0x1
bl sub_800B330 bl sub_800B330
pop {r0} pop {r0}
@ -28128,11 +28128,11 @@ _081D4EBA:
thumb_func_start sub_81D4EC0 thumb_func_start sub_81D4EC0
sub_81D4EC0: @ 81D4EC0 sub_81D4EC0: @ 81D4EC0
push {lr} push {lr}
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _081D4EDC beq _081D4EDC
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x2 cmp r0, 0x2
@ -28186,11 +28186,11 @@ _081D4F20:
.4byte _081D4FEC .4byte _081D4FEC
.4byte _081D4FF8 .4byte _081D4FF8
_081D4F38: _081D4F38:
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _081D4F88 beq _081D4F88
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -28212,7 +28212,7 @@ _081D4F54:
strb r0, [r4] strb r0, [r4]
b _081D500C b _081D500C
_081D4F6C: _081D4F6C:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x2 cmp r0, 0x2
@ -28248,7 +28248,7 @@ _081D4FA0:
movs r0, 0x5 movs r0, 0x5
b _081D500E b _081D500E
_081D4FB6: _081D4FB6:
bl sub_800B320 bl IsLinkConnectionEstablished
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _081D500C beq _081D500C
@ -28447,7 +28447,7 @@ _081D515C:
beq _081D5166 beq _081D5166
b _081D52FC b _081D52FC
_081D5166: _081D5166:
bl sub_80097E8 bl CloseLink
b _081D525C b _081D525C
_081D516C: _081D516C:
adds r0, r4, 0 adds r0, r4, 0
@ -28500,20 +28500,20 @@ _081D51D0:
beq _081D51F4 beq _081D51F4
movs r0, 0x5 movs r0, 0x5
bl PlaySE bl PlaySE
bl sub_80097E8 bl CloseLink
adds r0, r4, 0 adds r0, r4, 0
bl sub_81D505C bl sub_81D505C
b _081D535A b _081D535A
.pool .pool
_081D51F4: _081D51F4:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
bls _081D5210 bls _081D5210
adds r0, r4, 0 adds r0, r4, 0
bl sub_81D505C bl sub_81D505C
bl sub_80097E8 bl CloseLink
movs r0, 0x7 movs r0, 0x7
strb r0, [r4, 0x8] strb r0, [r4, 0x8]
b _081D548A b _081D548A
@ -28523,7 +28523,7 @@ _081D5210:
beq _081D522E beq _081D522E
movs r0, 0x5 movs r0, 0x5
bl PlaySE bl PlaySE
bl sub_80097E8 bl CloseLink
adds r0, r4, 0 adds r0, r4, 0
bl sub_81D505C bl sub_81D505C
movs r0, 0x8 movs r0, 0x8
@ -28537,7 +28537,7 @@ _081D522E:
bne _081D523C bne _081D523C
b _081D548A b _081D548A
_081D523C: _081D523C:
bl sub_80097E8 bl CloseLink
bl sub_81D4E30 bl sub_81D4E30
adds r0, r4, 0 adds r0, r4, 0
bl sub_81D505C bl sub_81D505C
@ -28654,13 +28654,13 @@ _081D5340:
_081D5350: _081D5350:
movs r0, 0x5 movs r0, 0x5
bl PlaySE bl PlaySE
bl sub_80097E8 bl CloseLink
_081D535A: _081D535A:
movs r0, 0x17 movs r0, 0x17
strb r0, [r4, 0x8] strb r0, [r4, 0x8]
b _081D548A b _081D548A
_081D5360: _081D5360:
bl sub_80097E8 bl CloseLink
movs r0, 0x15 movs r0, 0x15
strb r0, [r4, 0x8] strb r0, [r4, 0x8]
b _081D548A b _081D548A
@ -28670,7 +28670,7 @@ _081D536A:
cmp r0, 0 cmp r0, 0
beq _081D537A beq _081D537A
_081D5374: _081D5374:
bl sub_80097E8 bl CloseLink
b _081D53C0 b _081D53C0
_081D537A: _081D537A:
bl GetBlockReceivedStatus bl GetBlockReceivedStatus

View File

@ -765,10 +765,10 @@ _080E73B0:
movs r0, 0x65 movs r0, 0x65
b _080E7564 b _080E7564
_080E73B8: _080E73B8:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -796,7 +796,7 @@ _080E73EA:
_080E73F8: _080E73F8:
bl sub_800AA48 bl sub_800AA48
adds r4, r0, 0 adds r4, r0, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
@ -808,7 +808,7 @@ _080E740C:
strh r4, [r5, 0x20] strh r4, [r5, 0x20]
lsls r4, 16 lsls r4, 16
asrs r4, 16 asrs r4, 16
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
lsls r1, r0, 4 lsls r1, r0, 4
@ -824,7 +824,7 @@ _080E742A:
_080E7432: _080E7432:
bl sub_800AA48 bl sub_800AA48
adds r4, r0, 0 adds r4, r0, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
@ -868,7 +868,7 @@ _080E746E:
b _080E7564 b _080E7564
.pool .pool
_080E7490: _080E7490:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0 movs r1, 0

View File

@ -416,12 +416,12 @@ _080774B2:
cmp r0, 0 cmp r0, 0
beq _08077528 beq _08077528
bl sub_800B488 bl sub_800B488
bl sub_8009734 bl OpenLink
bl sub_8011BA4 bl sub_8011BA4
b _08077B46 b _08077B46
.pool .pool
_08077528: _08077528:
bl sub_8009734 bl OpenLink
ldr r0, =gMain ldr r0, =gMain
movs r7, 0x87 movs r7, 0x87
lsls r7, 3 lsls r7, 3
@ -466,7 +466,7 @@ _0807757A:
b _08077B22 b _08077B22
.pool .pool
_0807758C: _0807758C:
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r4, r0, 0 adds r4, r0, 0
bl sub_800AA48 bl sub_800AA48
lsls r4, 24 lsls r4, 24
@ -475,7 +475,7 @@ _0807758C:
bcs _080775A0 bcs _080775A0
b _08077B46 b _08077B46
_080775A0: _080775A0:
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080775D8 beq _080775D8
@ -7026,7 +7026,7 @@ _0807AC92:
lsls r0, 1 lsls r0, 1
cmp r1, r0 cmp r1, r0
bls _0807ACC4 bls _0807ACC4
bl sub_80097E8 bl CloseLink
ldr r0, =c2_800ACD4 ldr r0, =c2_800ACD4
bl SetMainCallback2 bl SetMainCallback2
ldr r1, [r4] ldr r1, [r4]
@ -7264,7 +7264,7 @@ _0807AEAC:
ldr r2, =0x00001144 ldr r2, =0x00001144
adds r0, r2, 0 adds r0, r2, 0
strh r0, [r1] strh r0, [r1]
bl sub_80097E8 bl CloseLink
_0807AEC0: _0807AEC0:
ldr r4, =gUnknown_020322A0 ldr r4, =gUnknown_020322A0
movs r5, 0x80 movs r5, 0x80
@ -7332,7 +7332,7 @@ _0807AF58:
adds r0, 0xFA adds r0, 0xFA
movs r1, 0x1 movs r1, 0x1
strb r1, [r0] strb r1, [r0]
bl sub_8009734 bl OpenLink
ldr r1, =gMain ldr r1, =gMain
movs r2, 0x87 movs r2, 0x87
lsls r2, 3 lsls r2, 3
@ -7369,13 +7369,13 @@ _0807AFAC:
b _0807B0E4 b _0807B0E4
.pool .pool
_0807AFBC: _0807AFBC:
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
bne _0807AFC8 bne _0807AFC8
b _0807B0DC b _0807B0DC
_0807AFC8: _0807AFC8:
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r4, r0, 0 adds r4, r0, 0
bl sub_800AA48 bl sub_800AA48
lsls r4, 24 lsls r4, 24

View File

@ -1,12 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnknown_085EFD64:: @ 85EFD64
.4byte 0x1F8
gUnknown_085EFD68:: @ 85EFD68
window_template 0, 4, 15, 22, 4, 14, 20
window_template 0, 7, 6, 16, 4, 14, 0x6C
null_window_template

View File

@ -231,7 +231,7 @@ OldaleTown_PokemonCenter_2F_EventScript_276C9D:: @ 8276C9D
end end
OldaleTown_PokemonCenter_2F_EventScript_276CB5:: @ 8276CB5 OldaleTown_PokemonCenter_2F_EventScript_276CB5:: @ 8276CB5
special sub_80097E8 special CloseLink
setvar VAR_0x4087, 0 setvar VAR_0x4087, 0
compare VAR_0x8007, 0 compare VAR_0x8007, 0
goto_eq OldaleTown_PokemonCenter_2F_EventScript_276DD5 goto_eq OldaleTown_PokemonCenter_2F_EventScript_276DD5
@ -254,7 +254,7 @@ OldaleTown_PokemonCenter_2F_EventScript_276CE7:: @ 8276CE7
end end
OldaleTown_PokemonCenter_2F_EventScript_276CFF:: @ 8276CFF OldaleTown_PokemonCenter_2F_EventScript_276CFF:: @ 8276CFF
special sub_80097E8 special CloseLink
setvar VAR_0x4087, 0 setvar VAR_0x4087, 0
compare VAR_0x8007, 0 compare VAR_0x8007, 0
goto_eq OldaleTown_PokemonCenter_2F_EventScript_276DD5 goto_eq OldaleTown_PokemonCenter_2F_EventScript_276DD5
@ -276,7 +276,7 @@ OldaleTown_PokemonCenter_2F_EventScript_276D2C:: @ 8276D2C
end end
OldaleTown_PokemonCenter_2F_EventScript_276D44:: @ 8276D44 OldaleTown_PokemonCenter_2F_EventScript_276D44:: @ 8276D44
special sub_80097E8 special CloseLink
setvar VAR_0x4087, 0 setvar VAR_0x4087, 0
applymovement 255, OldaleTown_PokemonCenter_2F_Movement_27734F applymovement 255, OldaleTown_PokemonCenter_2F_Movement_27734F
waitmovement 0 waitmovement 0
@ -501,25 +501,25 @@ OldaleTown_PokemonCenter_2F_EventScript_277046:: @ 8277046
end end
OldaleTown_PokemonCenter_2F_EventScript_277072:: @ 8277072 OldaleTown_PokemonCenter_2F_EventScript_277072:: @ 8277072
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_27833D, 4 msgbox OldaleTown_PokemonCenter_2F_Text_27833D, 4
goto OldaleTown_PokemonCenter_2F_EventScript_2770A5 goto OldaleTown_PokemonCenter_2F_EventScript_2770A5
end end
OldaleTown_PokemonCenter_2F_EventScript_277083:: @ 8277083 OldaleTown_PokemonCenter_2F_EventScript_277083:: @ 8277083
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_278307, 4 msgbox OldaleTown_PokemonCenter_2F_Text_278307, 4
goto OldaleTown_PokemonCenter_2F_EventScript_2770A5 goto OldaleTown_PokemonCenter_2F_EventScript_2770A5
end end
OldaleTown_PokemonCenter_2F_EventScript_277094:: @ 8277094 OldaleTown_PokemonCenter_2F_EventScript_277094:: @ 8277094
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_2782D1, 4 msgbox OldaleTown_PokemonCenter_2F_Text_2782D1, 4
goto OldaleTown_PokemonCenter_2F_EventScript_2770A5 goto OldaleTown_PokemonCenter_2F_EventScript_2770A5
end end
OldaleTown_PokemonCenter_2F_EventScript_2770A5:: @ 82770A5 OldaleTown_PokemonCenter_2F_EventScript_2770A5:: @ 82770A5
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_278372, 4 msgbox OldaleTown_PokemonCenter_2F_Text_278372, 4
release release
end end
@ -658,45 +658,45 @@ OldaleTown_PokemonCenter_2F_EventScript_27724C:: @ 827724C
end end
OldaleTown_PokemonCenter_2F_EventScript_2772AB:: @ 82772AB OldaleTown_PokemonCenter_2F_EventScript_2772AB:: @ 82772AB
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_278565, 4 msgbox OldaleTown_PokemonCenter_2F_Text_278565, 4
release release
end end
OldaleTown_PokemonCenter_2F_EventScript_2772B8:: @ 82772B8 OldaleTown_PokemonCenter_2F_EventScript_2772B8:: @ 82772B8
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_2785C9, 4 msgbox OldaleTown_PokemonCenter_2F_Text_2785C9, 4
release release
end end
BattleFrontier_BattleTowerLobby_EventScript_2772C5:: @ 82772C5 BattleFrontier_BattleTowerLobby_EventScript_2772C5:: @ 82772C5
OldaleTown_PokemonCenter_2F_EventScript_2772C5:: @ 82772C5 OldaleTown_PokemonCenter_2F_EventScript_2772C5:: @ 82772C5
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_27821C, 4 msgbox OldaleTown_PokemonCenter_2F_Text_27821C, 4
release release
end end
BattleFrontier_BattleTowerLobby_EventScript_2772D2:: @ 82772D2 BattleFrontier_BattleTowerLobby_EventScript_2772D2:: @ 82772D2
OldaleTown_PokemonCenter_2F_EventScript_2772D2:: @ 82772D2 OldaleTown_PokemonCenter_2F_EventScript_2772D2:: @ 82772D2
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_2781C7, 4 msgbox OldaleTown_PokemonCenter_2F_Text_2781C7, 4
release release
end end
OldaleTown_PokemonCenter_2F_EventScript_2772DF:: @ 82772DF OldaleTown_PokemonCenter_2F_EventScript_2772DF:: @ 82772DF
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_278255, 4 msgbox OldaleTown_PokemonCenter_2F_Text_278255, 4
release release
end end
OldaleTown_PokemonCenter_2F_EventScript_2772EC:: @ 82772EC OldaleTown_PokemonCenter_2F_EventScript_2772EC:: @ 82772EC
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_278291, 4 msgbox OldaleTown_PokemonCenter_2F_Text_278291, 4
release release
end end
MossdeepCity_GameCorner_1F_EventScript_2772F9:: @ 82772F9 MossdeepCity_GameCorner_1F_EventScript_2772F9:: @ 82772F9
special sub_80097E8 special CloseLink
msgbox MossdeepCity_GameCorner_1F_Text_278D51, 4 msgbox MossdeepCity_GameCorner_1F_Text_278D51, 4
release release
end end
@ -708,19 +708,19 @@ OldaleTown_PokemonCenter_2F_EventScript_277306:: @ 8277306
end end
OldaleTown_PokemonCenter_2F_EventScript_27730E:: @ 827730E OldaleTown_PokemonCenter_2F_EventScript_27730E:: @ 827730E
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_2782A8, 4 msgbox OldaleTown_PokemonCenter_2F_Text_2782A8, 4
release release
end end
OldaleTown_PokemonCenter_2F_EventScript_27731B:: @ 827731B OldaleTown_PokemonCenter_2F_EventScript_27731B:: @ 827731B
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_2785E9, 4 msgbox OldaleTown_PokemonCenter_2F_Text_2785E9, 4
release release
end end
OldaleTown_PokemonCenter_2F_EventScript_277328:: @ 8277328 OldaleTown_PokemonCenter_2F_EventScript_277328:: @ 8277328
special sub_80097E8 special CloseLink
msgbox OldaleTown_PokemonCenter_2F_Text_278651, 4 msgbox OldaleTown_PokemonCenter_2F_Text_278651, 4
release release
end end

View File

@ -725,7 +725,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23F0E3:: @ 823F0E3
special copy_player_party_from_sav1 special copy_player_party_from_sav1
BattleFrontier_BattleTowerLobby_EventScript_23F0E6:: @ 823F0E6 BattleFrontier_BattleTowerLobby_EventScript_23F0E6:: @ 823F0E6
special sub_80097E8 special CloseLink
msgbox BattleFrontier_BattleTowerLobby_Text_23FD07, 4 msgbox BattleFrontier_BattleTowerLobby_Text_23FD07, 4
BattleFrontier_BattleTowerLobby_EventScript_23F0F1:: @ 823F0F1 BattleFrontier_BattleTowerLobby_EventScript_23F0F1:: @ 823F0F1
@ -951,7 +951,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23F2C5:: @ 823F2C5
end end
BattleFrontier_BattleTowerLobby_EventScript_23F327:: @ 823F327 BattleFrontier_BattleTowerLobby_EventScript_23F327:: @ 823F327
special sub_80097E8 special CloseLink
compare VAR_0x8005, 3 compare VAR_0x8005, 3
goto_eq BattleFrontier_BattleTowerLobby_EventScript_23F33F goto_eq BattleFrontier_BattleTowerLobby_EventScript_23F33F
msgbox BattleFrontier_BattleTowerLobby_Text_278255, 4 msgbox BattleFrontier_BattleTowerLobby_Text_278255, 4
@ -966,13 +966,13 @@ BattleFrontier_BattleTowerLobby_EventScript_23F33F:: @ 823F33F
BattleFrontier_BattleTowerLobby_EventScript_23F351:: @ 823F351 BattleFrontier_BattleTowerLobby_EventScript_23F351:: @ 823F351
msgbox BattleFrontier_BattleTowerLobby_Text_241240, 4 msgbox BattleFrontier_BattleTowerLobby_Text_241240, 4
special sub_80097E8 special CloseLink
msgbox BattleFrontier_BattleTowerLobby_Text_2782A8, 4 msgbox BattleFrontier_BattleTowerLobby_Text_2782A8, 4
release release
end end
BattleFrontier_BattleTowerLobby_EventScript_23F366:: @ 823F366 BattleFrontier_BattleTowerLobby_EventScript_23F366:: @ 823F366
special sub_80097E8 special CloseLink
compare VAR_0x8005, 0 compare VAR_0x8005, 0
call_if 1, BattleFrontier_BattleTowerLobby_EventScript_23F394 call_if 1, BattleFrontier_BattleTowerLobby_EventScript_23F394
compare VAR_0x8005, 1 compare VAR_0x8005, 1

View File

@ -709,7 +709,7 @@ LilycoveCity_ContestLobby_EventScript_21A971:: @ 821A971
end end
LilycoveCity_ContestLobby_EventScript_21A97F:: @ 821A97F LilycoveCity_ContestLobby_EventScript_21A97F:: @ 821A97F
special sub_80097E8 special CloseLink
msgbox LilycoveCity_ContestLobby_Text_27BD4F, 4 msgbox LilycoveCity_ContestLobby_Text_27BD4F, 4
release release
end end
@ -811,13 +811,13 @@ LilycoveCity_ContestLobby_EventScript_21AAE1:: @ 821AAE1
end end
LilycoveCity_ContestLobby_EventScript_21AAEF:: @ 821AAEF LilycoveCity_ContestLobby_EventScript_21AAEF:: @ 821AAEF
special sub_80097E8 special CloseLink
msgbox LilycoveCity_ContestLobby_Text_27821C, 4 msgbox LilycoveCity_ContestLobby_Text_27821C, 4
release release
end end
LilycoveCity_ContestLobby_EventScript_21AAFC:: @ 821AAFC LilycoveCity_ContestLobby_EventScript_21AAFC:: @ 821AAFC
special sub_80097E8 special CloseLink
msgbox LilycoveCity_ContestLobby_Text_27C879, 4 msgbox LilycoveCity_ContestLobby_Text_27C879, 4
release release
end end

View File

@ -655,25 +655,25 @@ LilycoveCity_ContestLobby_EventScript_29416C:: @ 829416C
end end
LilycoveCity_ContestLobby_EventScript_294176:: @ 8294176 LilycoveCity_ContestLobby_EventScript_294176:: @ 8294176
special sub_80097E8 special CloseLink
msgbox LilycoveCity_ContestLobby_Text_2781C7, 4 msgbox LilycoveCity_ContestLobby_Text_2781C7, 4
releaseall releaseall
end end
LilycoveCity_ContestLobby_EventScript_294183:: @ 8294183 LilycoveCity_ContestLobby_EventScript_294183:: @ 8294183
special sub_80097E8 special CloseLink
msgbox LilycoveCity_ContestLobby_Text_278255, 4 msgbox LilycoveCity_ContestLobby_Text_278255, 4
releaseall releaseall
end end
LilycoveCity_ContestLobby_EventScript_294190:: @ 8294190 LilycoveCity_ContestLobby_EventScript_294190:: @ 8294190
special sub_80097E8 special CloseLink
msgbox gUnknown_08272D9C, 4 msgbox gUnknown_08272D9C, 4
releaseall releaseall
end end
LilycoveCity_ContestLobby_EventScript_29419D:: @ 829419D LilycoveCity_ContestLobby_EventScript_29419D:: @ 829419D
special sub_80097E8 special CloseLink
msgbox LilycoveCity_ContestLobby_Text_27821C, 4 msgbox LilycoveCity_ContestLobby_Text_27821C, 4
releaseall releaseall
end end

View File

@ -40,7 +40,7 @@ gSpecials:: @ 81DBA64
def_special sub_80B2E4C def_special sub_80B2E4C
def_special sub_80B2E74 def_special sub_80B2E74
def_special sub_80B2EA8 def_special sub_80B2EA8
def_special sub_80097E8 def_special CloseLink
def_special sub_80B3968 def_special sub_80B3968
def_special sub_80B3924 def_special sub_80B3924
def_special nullsub_37 def_special nullsub_37

View File

@ -143,8 +143,9 @@ extern struct LinkPlayer gLinkPlayers[];
extern u16 word_3002910[]; extern u16 word_3002910[];
extern bool8 gReceivedRemoteLinkPlayers; extern bool8 gReceivedRemoteLinkPlayers;
extern bool8 gLinkVSyncDisabled; extern bool8 gLinkVSyncDisabled;
extern u32 gLinkStatus;
void Task_DestroySelf(u8); void Task_DestroySelf(u8 taskId);
void OpenLink(void); void OpenLink(void);
void CloseLink(void); void CloseLink(void);
u16 LinkMain2(u16 *); u16 LinkMain2(u16 *);
@ -188,11 +189,10 @@ bool8 sub_8010500(void);
void sub_800DFB4(u8, u8); void sub_800DFB4(u8, u8);
void sub_800ADF8(void); void sub_800ADF8(void);
void sub_800B488(void); void sub_800B488(void);
void sub_8009734(void); void OpenLink(void);
void sub_800A620(void); void sub_800A620(void);
void sub_8011BD0(void); void sub_8011BD0(void);
u8 sub_800ABAC(void);
u8 sub_800ABBC(void);
void sub_800AC34(void); void sub_800AC34(void);
u8 sub_800A0C8(s32, s32);
#endif // GUARD_LINK_H #endif // GUARD_LINK_H

View File

@ -0,0 +1,6 @@
#ifndef GUARD_MYSTERY_EVENT_MENU_H
#define GUARD_MYSTERY_EVENT_MENU_H
void CB2_InitMysteryEventMenu(void);
#endif // GUARD_MYSTERY_EVENT_MENU_H

View File

@ -202,4 +202,12 @@ extern const u8 gText_ButtonMode[];
extern const u8 gText_MaleSymbol[]; extern const u8 gText_MaleSymbol[];
extern const u8 gText_FemaleSymbol[]; extern const u8 gText_FemaleSymbol[];
// mystery event menu text
extern const u8 gText_EventSafelyLoaded[];
extern const u8 gText_LoadErrorEndingSession[];
extern const u8 gText_PressAToLoadEvent[];
extern const u8 gText_LoadingEvent[];
extern const u8 gText_DontRemoveCableTurnOff[];
extern const u8 gText_LinkStandby2[];
#endif //GUARD_STRINGS_H #endif //GUARD_STRINGS_H

View File

@ -230,7 +230,7 @@ SECTIONS {
src/lottery_corner.o(.text); src/lottery_corner.o(.text);
src/diploma.o(.text); src/diploma.o(.text);
asm/berry_tag_screen.o(.text); asm/berry_tag_screen.o(.text);
asm/mystery_event_menu.o(.text); src/mystery_event_menu.o(.text);
src/save_failed_screen.o(.text); src/save_failed_screen.o(.text);
src/braille_puzzles.o(.text); src/braille_puzzles.o(.text);
src/pokeblock_feed.o(.text); src/pokeblock_feed.o(.text);
@ -505,7 +505,7 @@ SECTIONS {
src/diploma.o(.rodata); src/diploma.o(.rodata);
data/strings.o(.rodata); data/strings.o(.rodata);
data/berry_tag_screen.o(.rodata); data/berry_tag_screen.o(.rodata);
data/mystery_event_menu.o(.rodata); src/mystery_event_menu.o(.rodata);
src/save_failed_screen.o(.rodata); src/save_failed_screen.o(.rodata);
data/braille_puzzles.o(.rodata); data/braille_puzzles.o(.rodata);
src/pokeblock_feed.o(.rodata); src/pokeblock_feed.o(.rodata);

View File

@ -64,7 +64,7 @@ void HandleLinkBattleSetup(void)
if (gLinkVSyncDisabled) if (gLinkVSyncDisabled)
sub_800B488(); sub_800B488();
if (!gReceivedRemoteLinkPlayers) if (!gReceivedRemoteLinkPlayers)
sub_8009734(); OpenLink();
CreateTask(task00_08081A90, 0); CreateTask(task00_08081A90, 0);
CreateTasksForSendRecvLinkBuffers(); CreateTasksForSendRecvLinkBuffers();
} }
@ -793,9 +793,9 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
else else
var = (gBattleTypeFlags & BATTLE_TYPE_MULTI) ? 4 : 2; var = (gBattleTypeFlags & BATTLE_TYPE_MULTI) ? 4 : 2;
if (sub_800ABAC() >= var) if (GetLinkPlayerCount_2() >= var)
{ {
if (sub_800ABBC()) if (IsLinkMaster())
{ {
sub_800A620(); sub_800A620();
gTasks[taskId].data[11]++; gTasks[taskId].data[11]++;

303
src/mystery_event_menu.c Normal file
View File

@ -0,0 +1,303 @@
#include "global.h"
#include "mystery_event_menu.h"
#include "link.h"
#include "main.h"
#include "menu.h"
#include "mystery_event_script.h"
#include "palette.h"
#include "save.h"
#include "constants/songs.h"
#include "sound.h"
#include "sprite.h"
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "text.h"
#include "bg.h"
#include "window.h"
#include "gpu_regs.h"
#include "text_window.h"
#include "new_menu_helpers.h"
#include "decompress.h"
// this file's functions
static void CB2_MysteryEventMenu(void);
static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed);
// EWRAM vars
static EWRAM_DATA u8 sUnknown_0203BCF8 = 0; // set but unused
// const rom data
static const struct BgTemplate sBgTemplates[] =
{
{
.bg = 0,
.charBaseIndex = 2,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
}
};
static const struct WindowTemplate sWindowTemplates[] =
{
{0, 4, 15, 22, 4, 14, 20},
{0, 7, 6, 16, 4, 14, 0x6C},
DUMMY_WIN_TEMPLATE
};
// code
static void VBlankCB(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
static bool8 CheckLanguageMatch(void)
{
return (gLinkPlayers[0].language == gLinkPlayers[1].language);
}
void CB2_InitMysteryEventMenu(void)
{
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
SetVBlankCallback(VBlankCB);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
if (InitWindows(sWindowTemplates))
{
s32 i;
DeactivateAllTextPrinters();
for (i = 0; i < 2; i++)
FillWindowPixelBuffer(i, 0);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
sub_809882C(0, 1u, 0xD0u);
sub_81978B0(0xE0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
CreateTask(Task_DestroySelf, 0);
StopMapMusic();
RunTasks();
AnimateSprites();
BuildOamBuffer();
RunTextPrinters();
UpdatePaletteFade();
FillPalette(0, 0, 2);
SetMainCallback2(CB2_MysteryEventMenu);
}
}
static bool8 GetEventLoadMessage(u8 *dest, u32 status)
{
bool8 retVal = TRUE;
if (status == 0)
{
StringCopy(dest, gText_EventSafelyLoaded);
retVal = FALSE;
}
if (status == 2)
retVal = FALSE;
if (status == 1)
StringCopy(dest, gText_LoadErrorEndingSession);
return retVal;
}
static void CB2_MysteryEventMenu(void)
{
switch (gMain.state)
{
case 0:
SetWindowBorderStyle(0, 1, 1, 0xD);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
ShowBg(0);
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
gMain.state++;
break;
case 1:
if (!gPaletteFade.active)
{
PrintMysteryMenuText(0, gText_LinkStandby2, 1, 2, 1);
gMain.state++;
}
break;
case 2:
if (!IsTextPrinterActive(0))
{
gMain.state++;
gLinkType = 21761;
OpenLink();
}
break;
case 3:
if ((gLinkStatus & 0x20) && (gLinkStatus & 0x1C) > 4)
{
PlaySE(SE_PIN);
PrintMysteryMenuText(0, gText_PressAToLoadEvent, 1, 2, 1);
gMain.state++;
}
if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
CloseLink();
gMain.state = 15;
}
break;
case 4:
if (!IsTextPrinterActive(0))
gMain.state++;
break;
case 5:
if (GetLinkPlayerCount_2() == 2)
{
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
sub_800A620();
SetWindowBorderStyle(1, 1, 1, 0xD);
PrintMysteryMenuText(1, gText_LoadingEvent, 1, 2, 0);
PutWindowTilemap(1);
CopyWindowToVram(1, 3);
gMain.state++;
}
else if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
CloseLink();
gMain.state = 15;
}
}
else
{
GetEventLoadMessage(gStringVar4, 1);
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
gMain.state = 13;
}
break;
case 6:
if (IsLinkConnectionEstablished())
{
if (gReceivedRemoteLinkPlayers != 0)
{
if (sub_800A0C8(2, 2) == 3)
{
sub_800AC34();
GetEventLoadMessage(gStringVar4, 1);
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
gMain.state = 13;
}
else if (CheckLanguageMatch())
{
PrintMysteryMenuText(0, gText_DontRemoveCableTurnOff, 1, 2, 1);
gMain.state++;
}
else
{
CloseLink();
GetEventLoadMessage(gStringVar4, 1);
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
gMain.state = 13;
}
}
}
else if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
CloseLink();
gMain.state = 15;
}
break;
case 7:
if (!IsTextPrinterActive(0))
gMain.state++;
break;
case 8:
if (GetBlockReceivedStatus())
{
ResetBlockReceivedFlags();
gMain.state++;
}
break;
case 9:
gMain.state++;
break;
case 10:
sub_800AC34();
gMain.state++;
break;
case 11:
if (gReceivedRemoteLinkPlayers == 0)
{
u16 unkVal = RunMysteryEventScript(gDecompressionBuffer);
CpuFill32(0, gDecompressionBuffer, 0x7D4);
if (!GetEventLoadMessage(gStringVar4, unkVal))
TrySavingData(NORMAL_SAVE);
gMain.state++;
}
break;
case 12:
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
gMain.state++;
break;
case 13:
if (!IsTextPrinterActive(0))
{
gMain.state++;
sUnknown_0203BCF8 = 0;
}
break;
case 14:
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
gMain.state++;
}
break;
case 15:
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
gMain.state++;
break;
case 16:
if (!gPaletteFade.active)
DoSoftReset();
break;
}
if (gLinkStatus & 0x40 && !IsLinkMaster())
{
CloseLink();
GetEventLoadMessage(gStringVar4, 1);
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
gMain.state = 13;
}
RunTasks();
AnimateSprites();
BuildOamBuffer();
RunTextPrinters();
UpdatePaletteFade();
}
static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed)
{
struct TextColor textColor;
u8 letterSpacing = 0;
u8 lineSpacing = 1;
textColor.fgColor = 1;
textColor.bgColor = 2;
textColor.shadowColor = 3;
FillWindowPixelBuffer(windowId, (textColor.fgColor) | (textColor.fgColor << 4));
AddTextPrinterParameterized2(windowId, 1, x, y, letterSpacing, lineSpacing, &textColor, speed, text);
}

View File

@ -84,7 +84,7 @@ gUnknown_03003092: @ 3003092
gUnknown_03003094: @ 3003094 gUnknown_03003094: @ 3003094
.space 0x4C .space 0x4C
gUnknown_030030E0: @ 30030E0 gLinkStatus: @ 30030E0
.space 0x4 .space 0x4
gUnknown_030030E4: @ 30030E4 gUnknown_030030E4: @ 30030E4

View File

@ -1270,9 +1270,7 @@ gUnknown_0203BCE8: @ 203BCE8
gUnknown_0203BCF4: @ 203BCF4 gUnknown_0203BCF4: @ 203BCF4
.space 0x4 .space 0x4
gUnknown_0203BCF8: @ 203BCF8 .include "src/mystery_event_menu.o"
.space 0x4
.include "src/save_failed_screen.o" .include "src/save_failed_screen.o"
gBraillePuzzleCallbackFlag: @ 203BD14 gBraillePuzzleCallbackFlag: @ 203BD14