through sub_800A588

This commit is contained in:
PikalaxALT 2017-11-10 22:08:17 -05:00
parent b92d85fd30
commit 27c0dc0fd5
23 changed files with 207 additions and 313 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -11823,7 +11823,7 @@ _0813B790:
b _0813B7C6
.pool
_0813B7A8:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gSerialIsRFU
ldrb r0, [r0]
cmp r0, 0
bne _0813B7B4

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

24
include/link_rfu.h Normal file
View File

@ -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

View File

@ -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)

View File

@ -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();

View File

@ -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]++;
}

View File

@ -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));

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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);

View File

@ -60,7 +60,7 @@ gUnknown_030030F4: @ 30030F4
gUnknown_030030F8: @ 30030F8
.space 0x4
gLinkVSyncDisabled: @ 30030FC
gSerialIsRFU: @ 30030FC
.space 0x4
gUnknown_03003100: @ 3003100