Merge pull request #205 from jiangzhengwenjz/librfu

librfu
This commit is contained in:
PikalaxALT
2020-01-09 15:20:58 -05:00
committed by GitHub
24 changed files with 3833 additions and 8657 deletions
+1 -1
View File
@@ -204,7 +204,7 @@ loop:
jump_intr:
strh r0, [r3, OFFSET_REG_IF - 0x200]
bic r2, r2, r0
ldr r0, =gRfuState
ldr r0, =gSTWIStatus
ldr r0, [r0]
ldrb r0, [r0, 0xA]
mov r1, 0x8
-6697
View File
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -9,7 +9,7 @@
IntrSIO32: @ 81DFC50
mov r12, sp
stmdb sp!, {r11,r12,lr,pc}
ldr r3, _081DFCB0 @ =gRfuState
ldr r3, _081DFCB0 @ =gSTWIStatus
ldr r0, [r3]
ldr r2, [r0]
sub r11, r12, 0x4
@@ -34,7 +34,7 @@ _081DFCA4:
ldmdb r11, {r11,sp,lr}
bx lr
.align 2, 0
_081DFCB0: .4byte gRfuState
_081DFCB0: .4byte gSTWIStatus
arm_func_end IntrSIO32
arm_func_start sio32intr_clock_master
@@ -45,7 +45,7 @@ sio32intr_clock_master: @ 81DFCB4
sub r11, r12, 0x4
bl STWI_set_timer_in_RAM
mov r4, 0x120
ldr r2, _081DFF28 @ =gRfuState
ldr r2, _081DFF28 @ =gSTWIStatus
add r4, r4, 0x4000000
ldr lr, [r4]
ldr r12, [r2]
@@ -208,7 +208,7 @@ _081DFEFC:
bl sub_81E05A4
b _081DFF3C
.align 2, 0
_081DFF28: .4byte gRfuState
_081DFF28: .4byte gSTWIStatus
_081DFF2C:
add r3, r5, 0x3
strh r3, [r4]
@@ -223,7 +223,7 @@ _081DFF3C:
sio32intr_clock_slave: @ 81DFF44
mov r12, sp
stmdb sp!, {r4-r6,r11,r12,lr,pc}
ldr r4, _081E02F0 @ =gRfuState
ldr r4, _081E02F0 @ =gSTWIStatus
mov r0, 0x64
ldr r3, [r4]
mov r6, 0
@@ -473,7 +473,7 @@ _081E02E0:
bhi _081E02E0
b _081E031C
.align 2, 0
_081E02F0: .4byte gRfuState
_081E02F0: .4byte gSTWIStatus
_081E02F4: .4byte 0x996601ee
_081E02F8:
mov r2, 0xFF00
@@ -510,7 +510,7 @@ handshake_wait: @ 81E0350
mov r1, 0x128
add r1, r1, 0x4000000
mov r0, r0, lsl 16
ldr r2, _081E03B4 @ =gRfuState
ldr r2, _081E03B4 @ =gSTWIStatus
sub r11, r12, 0x4
mov lr, r0, lsr 14
ldr r12, [r2]
@@ -533,7 +533,7 @@ _081E03A0:
ldmdb r11, {r11,sp,lr}
bx lr
.align 2, 0
_081E03B4: .4byte gRfuState
_081E03B4: .4byte gSTWIStatus
arm_func_end handshake_wait
arm_func_start STWI_set_timer_in_RAM
@@ -544,7 +544,7 @@ STWI_set_timer_in_RAM: @ 81E03B8
add r1, r1, 0x4000000
mov r3, 0
sub r11, r12, 0x4
ldr r12, _081E0470 @ =gRfuState
ldr r12, _081E0470 @ =gSTWIStatus
and lr, r0, 0xFF
ldr r2, [r12]
cmp lr, 0x50
@@ -589,7 +589,7 @@ _081E0458:
mov r3, 0x3
b _081E0488
.align 2, 0
_081E0470: .4byte gRfuState
_081E0470: .4byte gSTWIStatus
_081E0474:
mvn r3, 0x850
sub r3, r3, 0x2
@@ -621,7 +621,7 @@ STWI_stop_timer_in_RAM: @ 81E04C8
mov r12, sp
stmdb sp!, {r11,r12,lr,pc}
mov r1, 0x100
ldr lr, _081E0514 @ =gRfuState
ldr lr, _081E0514 @ =gSTWIStatus
add r0, r1, 0x4000000
ldr r2, [lr]
sub r11, r12, 0x4
@@ -638,14 +638,14 @@ STWI_stop_timer_in_RAM: @ 81E04C8
ldmdb r11, {r11,sp,lr}
bx lr
.align 2, 0
_081E0514: .4byte gRfuState
_081E0514: .4byte gSTWIStatus
arm_func_end STWI_stop_timer_in_RAM
arm_func_start STWI_init_slave
STWI_init_slave: @ 81E0518
mov r12, sp
stmdb sp!, {r11,r12,lr,pc}
ldr r0, _081E05A0 @ =gRfuState
ldr r0, _081E05A0 @ =gSTWIStatus
ldr r2, [r0]
mov r3, 0x5
str r3, [r2]
@@ -678,7 +678,7 @@ STWI_init_slave: @ 81E0518
ldmdb r11, {r11,sp,lr}
bx lr
.align 2, 0
_081E05A0: .4byte gRfuState
_081E05A0: .4byte gSTWIStatus
arm_func_end STWI_init_slave
arm_func_start sub_81E05A4
-1560
View File
File diff suppressed because it is too large Load Diff
+67 -67
View File
@@ -50,7 +50,7 @@ rfu_REQ_sendData_wrapper: @ 80FD3F0
push {lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r0, _080FD410 @ =gUnknown_3007460
ldr r0, _080FD410 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0
@@ -63,7 +63,7 @@ rfu_REQ_sendData_wrapper: @ 80FD3F0
movs r2, 0x1
b _080FD420
.align 2, 0
_080FD410: .4byte gUnknown_3007460
_080FD410: .4byte gRfuLinkStatus
_080FD414: .4byte gUnknown_3005E10
_080FD418:
ldr r0, _080FD42C @ =gUnknown_3005E10
@@ -383,7 +383,7 @@ _080FD648:
_080FD664: .4byte gUnknown_3005E10
_080FD668:
movs r2, 0
ldr r0, _080FD6B4 @ =gUnknown_3007460
ldr r0, _080FD6B4 @ =gRfuLinkStatus
ldr r1, [r0]
ldrb r3, [r1, 0x8]
ldr r5, _080FD6B8 @ =gUnknown_3005E10
@@ -422,7 +422,7 @@ _080FD6A2:
movs r0, 0x3
b _080FD6E8
.align 2, 0
_080FD6B4: .4byte gUnknown_3007460
_080FD6B4: .4byte gRfuLinkStatus
_080FD6B8: .4byte gUnknown_3005E10
_080FD6BC:
ldrb r0, [r5, 0x4]
@@ -476,7 +476,7 @@ sub_80FD6F4: @ 80FD6F4
bics r0, r1
strb r0, [r3]
movs r4, 0
ldr r7, _080FD75C @ =gUnknown_3007460
ldr r7, _080FD75C @ =gRfuLinkStatus
movs r5, 0x1
adds r3, 0x4
movs r2, 0
@@ -514,7 +514,7 @@ _080FD750:
bx r0
.align 2, 0
_080FD758: .4byte gUnknown_3005E10
_080FD75C: .4byte gUnknown_3007460
_080FD75C: .4byte gRfuLinkStatus
thumb_func_end sub_80FD6F4
thumb_func_start sub_80FD760
@@ -601,7 +601,7 @@ _080FD80A:
strb r0, [r5, 0x4]
ldrb r0, [r5, 0x12]
strb r0, [r5, 0x5]
ldr r4, _080FD82C @ =gUnknown_3007460
ldr r4, _080FD82C @ =gRfuLinkStatus
ldr r0, [r4]
ldrb r0, [r0, 0x3]
bl sub_80FE818
@@ -613,7 +613,7 @@ _080FD80A:
bl sub_80FE7F0
b _080FD84A
.align 2, 0
_080FD82C: .4byte gUnknown_3007460
_080FD82C: .4byte gRfuLinkStatus
_080FD830:
movs r0, 0x12
strb r0, [r5, 0x4]
@@ -653,7 +653,7 @@ sub_80FD850: @ 80FD850
mov r1, sp
adds r2, r5, 0
adds r3, r4, 0
bl sub_81E13F0
bl rfu_REQBN_watchLink
mov r0, sp
ldrb r0, [r0]
adds r7, r4, 0
@@ -743,7 +743,7 @@ _080FD90A:
_080FD91E:
bl sub_80FEAF4
_080FD922:
ldr r0, _080FDA0C @ =gUnknown_3007460
ldr r0, _080FDA0C @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0x1
@@ -866,7 +866,7 @@ _080FD9FC:
pop {r1}
bx r1
.align 2, 0
_080FDA0C: .4byte gUnknown_3007460
_080FDA0C: .4byte gRfuLinkStatus
_080FDA10: .4byte gUnknown_3005E10
thumb_func_end sub_80FD850
@@ -1025,7 +1025,7 @@ _080FDB5C:
.align 2, 0
_080FDB70: .4byte gUnknown_3005E10
_080FDB74:
bl sub_81E0CAC
bl rfu_REQ_startSearchChild
b _080FDBDA
_080FDB7A:
bl rfu_REQ_pollSearchChild
@@ -1056,13 +1056,13 @@ _080FDBAE:
bl rfu_REQ_endConnectParent
b _080FDBDA
_080FDBB4:
ldr r0, _080FDBC0 @ =gUnknown_3007460
ldr r0, _080FDBC0 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x3]
bl rfu_REQ_CHILD_startConnectRecovery
b _080FDBDA
.align 2, 0
_080FDBC0: .4byte gUnknown_3007460
_080FDBC0: .4byte gRfuLinkStatus
_080FDBC4:
bl rfu_REQ_CHILD_pollConnectRecovery
b _080FDBDA
@@ -1089,7 +1089,7 @@ _080FDBE4:
bhi _080FDBF4
b _080FDA5A
_080FDBF4:
ldr r0, _080FDC24 @ =gUnknown_3007460
ldr r0, _080FDC24 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0x1
@@ -1110,7 +1110,7 @@ _080FDC1A:
bx r0
.align 2, 0
_080FDC20: .4byte gUnknown_3005E10
_080FDC24: .4byte gUnknown_3007460
_080FDC24: .4byte gRfuLinkStatus
thumb_func_end sub_80FDA30
thumb_func_start sub_80FDC28
@@ -1387,7 +1387,7 @@ _080FDE64:
ldrh r0, [r4, 0x1A]
cmp r0, 0x1
beq _080FDE8A
ldr r0, _080FDEB0 @ =gUnknown_3007460
ldr r0, _080FDEB0 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x8]
cmp r0, 0x4
@@ -1419,7 +1419,7 @@ _080FDEA0:
b _080FE16E
.align 2, 0
_080FDEAC: .4byte gUnknown_3005E10
_080FDEB0: .4byte gUnknown_3007460
_080FDEB0: .4byte gRfuLinkStatus
_080FDEB4:
cmp r6, 0
beq _080FDEBA
@@ -1563,7 +1563,7 @@ _080FDFB4:
beq _080FDFBA
b _080FE16E
_080FDFBA:
ldr r2, _080FDFFC @ =gUnknown_3007460
ldr r2, _080FDFFC @ =gRfuLinkStatus
ldr r3, [r2]
ldrb r0, [r3, 0x3]
movs r1, 0
@@ -1600,7 +1600,7 @@ _080FDFEC:
beq _080FDFDC
b _080FE16E
.align 2, 0
_080FDFFC: .4byte gUnknown_3007460
_080FDFFC: .4byte gRfuLinkStatus
_080FE000:
cmp r6, 0
bne _080FE01E
@@ -1670,7 +1670,7 @@ _080FE078:
ldr r4, _080FE0B4 @ =gUnknown_3005E10
strb r6, [r4, 0x5]
strb r6, [r4, 0x4]
ldr r0, _080FE0B8 @ =gUnknown_3007460
ldr r0, _080FE0B8 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x3]
bl sub_80FE818
@@ -1697,7 +1697,7 @@ _080FE08C:
b _080FE16E
.align 2, 0
_080FE0B4: .4byte gUnknown_3005E10
_080FE0B8: .4byte gUnknown_3007460
_080FE0B8: .4byte gRfuLinkStatus
_080FE0BC:
cmp r6, 0
bne _080FE16E
@@ -1758,7 +1758,7 @@ _080FE0E8:
strb r7, [r5, 0x5]
strb r7, [r5, 0x4]
bl sub_80FEAF4
ldr r0, _080FE158 @ =gUnknown_3007460
ldr r0, _080FE158 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r1, [r0, 0x2]
ldrb r0, [r0, 0x3]
@@ -1772,7 +1772,7 @@ _080FE0E8:
bl sub_80FE7F0
b _080FE16E
.align 2, 0
_080FE158: .4byte gUnknown_3007460
_080FE158: .4byte gRfuLinkStatus
_080FE15C:
cmp r6, 0
bne _080FE16E
@@ -1811,7 +1811,7 @@ _080FE194:
ldrb r0, [r0]
cmp r0, 0
bne _080FE1CA
ldr r4, _080FE1E0 @ =gUnknown_3007460
ldr r4, _080FE1E0 @ =gRfuLinkStatus
ldr r0, [r4]
ldrb r0, [r0]
cmp r0, 0
@@ -1839,7 +1839,7 @@ _080FE1D2:
_080FE1DC:
b _080FE322
.align 2, 0
_080FE1E0: .4byte gUnknown_3007460
_080FE1E0: .4byte gRfuLinkStatus
_080FE1E4:
mov r0, r8
cmp r0, 0x30
@@ -1906,7 +1906,7 @@ _080FE24E:
strb r0, [r3]
movs r3, 0
adds r7, r1, 0
ldr r2, _080FE2AC @ =gUnknown_3007460
ldr r2, _080FE2AC @ =gRfuLinkStatus
mov r1, sp
movs r5, 0x1
adds r4, r7, 0
@@ -1947,7 +1947,7 @@ _080FE27A:
b _080FE2C2
.align 2, 0
_080FE2A8: .4byte gUnknown_3005E10
_080FE2AC: .4byte gUnknown_3007460
_080FE2AC: .4byte gRfuLinkStatus
_080FE2B0:
ldrb r0, [r7, 0x4]
subs r0, 0x6
@@ -1980,7 +1980,7 @@ _080FE2D6:
b _080FE322
_080FE2E6:
bl sub_80FE6F0
ldr r0, _080FE300 @ =gUnknown_3007460
ldr r0, _080FE300 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0xFF
@@ -1990,7 +1990,7 @@ _080FE2E6:
bl sub_80FE7F0
b _080FE322
.align 2, 0
_080FE300: .4byte gUnknown_3007460
_080FE300: .4byte gRfuLinkStatus
_080FE304:
cmp r6, 0
bne _080FE326
@@ -2018,7 +2018,7 @@ _080FE326:
ldrb r0, [r7, 0x7]
cmp r0, 0x4
bne _080FE358
ldr r2, _080FE354 @ =gUnknown_3007460
ldr r2, _080FE354 @ =gRfuLinkStatus
ldr r1, [r2]
movs r0, 0x1
strb r0, [r1]
@@ -2030,7 +2030,7 @@ _080FE326:
b _080FE388
.align 2, 0
_080FE350: .4byte gUnknown_3005E10
_080FE354: .4byte gUnknown_3007460
_080FE354: .4byte gRfuLinkStatus
_080FE358:
movs r1, 0
mov r3, r8
@@ -2075,7 +2075,7 @@ sub_80FE394: @ 80FE394
strb r0, [r4, 0xE]
movs r0, 0x1
strb r0, [r4, 0xF]
ldr r0, _080FE3CC @ =gUnknown_3007460
ldr r0, _080FE3CC @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r5, [r0]
cmp r5, 0
@@ -2091,7 +2091,7 @@ sub_80FE394: @ 80FE394
b _080FE40C
.align 2, 0
_080FE3C8: .4byte gUnknown_3005E10
_080FE3CC: .4byte gUnknown_3007460
_080FE3CC: .4byte gRfuLinkStatus
_080FE3D0:
mov r0, sp
bl rfu_UNI_PARENT_getDRAC_ACK
@@ -2148,7 +2148,7 @@ sub_80FE418: @ 80FE418
bls _080FE436
b _080FE62A
_080FE436:
ldr r0, _080FE4A0 @ =gUnknown_3007460
ldr r0, _080FE4A0 @ =gRfuLinkStatus
ldr r2, [r0]
ldrb r1, [r2, 0x2]
ldrb r0, [r3, 0xC]
@@ -2201,7 +2201,7 @@ _080FE46C:
b _080FE574
.align 2, 0
_080FE49C: .4byte gUnknown_3005E10
_080FE4A0: .4byte gUnknown_3007460
_080FE4A0: .4byte gRfuLinkStatus
_080FE4A4:
ldrb r1, [r7]
adds r0, r4, 0
@@ -2224,7 +2224,7 @@ _080FE4BE:
mov r10, r2
cmp r0, 0
beq _080FE574
ldr r0, _080FE518 @ =gUnknown_3007450
ldr r0, _080FE518 @ =gRfuSlotStatusNI
lsls r1, r6, 2
adds r1, r0
ldr r1, [r1]
@@ -2242,7 +2242,7 @@ _080FE4BE:
ldr r0, _080FE51C @ =0x0000ffff
cmp r2, r0
beq _080FE508
ldr r0, _080FE520 @ =gUnknown_3007460
ldr r0, _080FE520 @ =gRfuLinkStatus
ldr r0, [r0]
lsls r1, r6, 5
adds r0, r1
@@ -2264,9 +2264,9 @@ _080FE508:
orrs r5, r0
b _080FE53C
.align 2, 0
_080FE518: .4byte gUnknown_3007450
_080FE518: .4byte gRfuSlotStatusNI
_080FE51C: .4byte 0x0000ffff
_080FE520: .4byte gUnknown_3007460
_080FE520: .4byte gRfuLinkStatus
_080FE524:
lsls r1, r6, 1
adds r0, r3, 0
@@ -2331,7 +2331,7 @@ _080FE592:
cmp r0, 0
beq _080FE5CE
movs r5, 0x1
ldr r0, _080FE600 @ =gUnknown_3007460
ldr r0, _080FE600 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x6]
cmp r0, 0
@@ -2378,7 +2378,7 @@ _080FE5CE:
.align 2, 0
_080FE5F8: .4byte 0x0000ffff
_080FE5FC: .4byte gUnknown_3005E10
_080FE600: .4byte gUnknown_3007460
_080FE600: .4byte gRfuLinkStatus
_080FE604:
cmp r0, 0x2
bne _080FE610
@@ -2435,7 +2435,7 @@ sub_80FE63C: @ 80FE63C
lsls r0, 16
cmp r0, 0
beq _080FE676
ldr r1, _080FE6E8 @ =gUnknown_3007450
ldr r1, _080FE6E8 @ =gRfuSlotStatusNI
ldrb r0, [r4, 0x10]
lsls r0, 2
adds r0, r1
@@ -2481,7 +2481,7 @@ _080FE6B6:
bne _080FE6DA
strb r4, [r5, 0x5]
strb r4, [r5, 0x4]
ldr r0, _080FE6EC @ =gUnknown_3007460
ldr r0, _080FE6EC @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r1, [r0, 0x2]
ldrb r0, [r0, 0x3]
@@ -2498,8 +2498,8 @@ _080FE6DA:
.align 2, 0
_080FE6E0: .4byte 0x04000208
_080FE6E4: .4byte gUnknown_3005E10
_080FE6E8: .4byte gUnknown_3007450
_080FE6EC: .4byte gUnknown_3007460
_080FE6E8: .4byte gRfuSlotStatusNI
_080FE6EC: .4byte gRfuLinkStatus
thumb_func_end sub_80FE63C
thumb_func_start sub_80FE6F0
@@ -2509,7 +2509,7 @@ sub_80FE6F0: @ 80FE6F0
ldrb r0, [r5, 0x4]
cmp r0, 0xF
bne _080FE73C
ldr r1, _080FE748 @ =gUnknown_3007450
ldr r1, _080FE748 @ =gRfuSlotStatusNI
ldrb r2, [r5, 0x10]
lsls r0, r2, 2
adds r0, r1
@@ -2546,7 +2546,7 @@ _080FE73C:
bx r0
.align 2, 0
_080FE744: .4byte gUnknown_3005E10
_080FE748: .4byte gUnknown_3007450
_080FE748: .4byte gRfuSlotStatusNI
thumb_func_end sub_80FE6F0
thumb_func_start sub_80FE74C
@@ -2585,7 +2585,7 @@ sub_80FE778: @ 80FE778
push {r5-r7}
movs r6, 0
movs r5, 0
ldr r1, _080FE7E4 @ =gUnknown_3007460
ldr r1, _080FE7E4 @ =gRfuLinkStatus
ldr r0, [r1]
ldrb r0, [r0, 0x8]
cmp r6, r0
@@ -2638,7 +2638,7 @@ _080FE7D4:
pop {r1}
bx r1
.align 2, 0
_080FE7E4: .4byte gUnknown_3007460
_080FE7E4: .4byte gRfuLinkStatus
_080FE7E8: .4byte gUnknown_3005E10
_080FE7EC: .4byte 0x0000ffff
thumb_func_end sub_80FE778
@@ -2690,14 +2690,14 @@ sub_80FE83C: @ 80FE83C
push {r4-r7,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r0, _080FE908 @ =gUnknown_3007460
ldr r0, _080FE908 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x4]
cmp r0, 0
beq _080FE884
movs r4, 0
_080FE84E:
ldr r1, _080FE90C @ =gUnknown_3007450
ldr r1, _080FE90C @ =gRfuSlotStatusNI
lsls r0, r4, 2
adds r0, r1
ldr r2, [r0]
@@ -2725,14 +2725,14 @@ _080FE87A:
cmp r4, 0x3
bls _080FE84E
_080FE884:
ldr r0, _080FE908 @ =gUnknown_3007460
ldr r0, _080FE908 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x5]
cmp r0, 0
beq _080FE8C2
movs r4, 0
_080FE890:
ldr r1, _080FE90C @ =gUnknown_3007450
ldr r1, _080FE90C @ =gRfuSlotStatusNI
lsls r0, r4, 2
adds r0, r1
ldr r2, [r0]
@@ -2758,7 +2758,7 @@ _080FE8B8:
cmp r4, 0x3
bls _080FE890
_080FE8C2:
ldr r0, _080FE908 @ =gUnknown_3007460
ldr r0, _080FE908 @ =gRfuLinkStatus
ldr r3, [r0]
ldrb r2, [r3, 0x6]
cmp r2, 0
@@ -2768,7 +2768,7 @@ _080FE8C2:
ands r0, r2
strb r0, [r3, 0x6]
movs r4, 0
ldr r7, _080FE910 @ =gUnknown_3007440
ldr r7, _080FE910 @ =gRfuSlotStatusUNI
ldr r6, _080FE914 @ =0x00008024
_080FE8DA:
lsls r0, r4, 2
@@ -2796,9 +2796,9 @@ _080FE900:
pop {r0}
bx r0
.align 2, 0
_080FE908: .4byte gUnknown_3007460
_080FE90C: .4byte gUnknown_3007450
_080FE910: .4byte gUnknown_3007440
_080FE908: .4byte gRfuLinkStatus
_080FE90C: .4byte gRfuSlotStatusNI
_080FE910: .4byte gRfuSlotStatusUNI
_080FE914: .4byte 0x00008024
thumb_func_end sub_80FE83C
@@ -2814,14 +2814,14 @@ sub_80FE918: @ 80FE918
ldrh r0, [r0, 0x18]
cmp r0, 0
beq _080FE9F4
ldr r0, _080FEA08 @ =gUnknown_3007460
ldr r0, _080FEA08 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x4]
cmp r0, 0
beq _080FE9B8
movs r6, 0
_080FE938:
ldr r3, _080FEA0C @ =gUnknown_3007450
ldr r3, _080FEA0C @ =gRfuSlotStatusNI
lsls r2, r6, 2
adds r0, r2, r3
ldr r0, [r0]
@@ -2889,14 +2889,14 @@ _080FE9AE:
cmp r6, 0x3
bls _080FE938
_080FE9B8:
ldr r0, _080FEA08 @ =gUnknown_3007460
ldr r0, _080FEA08 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x5]
cmp r0, 0
beq _080FE9F4
movs r6, 0
_080FE9C4:
ldr r1, _080FEA0C @ =gUnknown_3007450
ldr r1, _080FEA0C @ =gRfuSlotStatusNI
lsls r0, r6, 2
adds r0, r1
ldr r2, [r0]
@@ -2931,8 +2931,8 @@ _080FE9F4:
bx r0
.align 2, 0
_080FEA04: .4byte gUnknown_3005E10
_080FEA08: .4byte gUnknown_3007460
_080FEA0C: .4byte gUnknown_3007450
_080FEA08: .4byte gRfuLinkStatus
_080FEA0C: .4byte gRfuSlotStatusNI
thumb_func_end sub_80FE918
thumb_func_start sub_80FEA10
@@ -3002,7 +3002,7 @@ sub_80FEA78: @ 80FEA78
push {lr}
lsls r0, 16
lsrs r2, r0, 16
ldr r0, _080FEA94 @ =gUnknown_3007460
ldr r0, _080FEA94 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r1, [r0, 0x4]
ldrb r0, [r0, 0x5]
@@ -3014,7 +3014,7 @@ sub_80FEA78: @ 80FEA78
movs r0, 0
b _080FEAAC
.align 2, 0
_080FEA94: .4byte gUnknown_3007460
_080FEA94: .4byte gRfuLinkStatus
_080FEA98: .4byte gUnknown_3005E10
_080FEA9C:
ldr r1, _080FEAB0 @ =gUnknown_3005E10
+66 -66
View File
@@ -132,12 +132,12 @@ _080F86F0: .4byte 0x04000208
thumb_func_start sub_80F86F4
sub_80F86F4: @ 80F86F4
push {r4,lr}
ldr r0, _080F8728 @ =gUnknown_3001190
ldr r0, _080F8728 @ =gRfuAPIBuffer
ldr r1, _080F872C @ =0x00000e64
ldr r4, _080F8730 @ =gIntrTable + 0x4
adds r2, r4, 0
movs r3, 0x1
bl sub_81E05B0
bl rfu_initializeAPI
lsls r0, 16
lsrs r1, r0, 16
cmp r1, 0
@@ -155,7 +155,7 @@ _080F8722:
pop {r0}
bx r0
.align 2, 0
_080F8728: .4byte gUnknown_3001190
_080F8728: .4byte gRfuAPIBuffer
_080F872C: .4byte 0x00000e64
_080F8730: .4byte gIntrTable + 0x4
_080F8734: .4byte gLinkType
@@ -871,7 +871,7 @@ _080F8D2A:
bge _080F8D2A
bl rfu_REQ_recvData
bl rfu_waitREQComplete
ldr r1, _080F8D94 @ =gUnknown_3007440
ldr r1, _080F8D94 @ =gRfuSlotStatusUNI
ldr r3, _080F8D90 @ =gUnknown_3005450
ldr r0, _080F8D98 @ =0x000008f6
adds r4, r3, r0
@@ -911,7 +911,7 @@ _080F8D84:
bx r0
.align 2, 0
_080F8D90: .4byte gUnknown_3005450
_080F8D94: .4byte gUnknown_3007440
_080F8D94: .4byte gRfuSlotStatusUNI
_080F8D98: .4byte 0x000008f6
_080F8D9C: .4byte 0x00000988
_080F8DA0: .4byte 0x000008f7
@@ -1074,7 +1074,7 @@ sub_80F8ECC: @ 80F8ECC
ldrh r0, [r4, 0x4]
cmp r0, 0x7
bne _080F8F08
ldr r0, _080F8F00 @ =gUnknown_3007460
ldr r0, _080F8F00 @ =gRfuLinkStatus
ldr r1, [r0]
ldr r2, _080F8F04 @ =0x000008f5
adds r0, r4, r2
@@ -1093,7 +1093,7 @@ sub_80F8ECC: @ 80F8ECC
b _080F8F0A
.align 2, 0
_080F8EFC: .4byte gUnknown_3005450
_080F8F00: .4byte gUnknown_3007460
_080F8F00: .4byte gRfuLinkStatus
_080F8F04: .4byte 0x000008f5
_080F8F08:
movs r0, 0
@@ -1363,7 +1363,7 @@ _080F90D8: .4byte 0x000008f2
thumb_func_start IsRfuRecvQueueEmpty
IsRfuRecvQueueEmpty: @ 80F90DC
push {r4,lr}
ldr r0, _080F90EC @ =gUnknown_3007460
ldr r0, _080F90EC @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x6]
cmp r0, 0
@@ -1372,7 +1372,7 @@ _080F90E8:
movs r0, 0
b _080F9110
.align 2, 0
_080F90EC: .4byte gUnknown_3007460
_080F90EC: .4byte gRfuLinkStatus
_080F90F0:
movs r3, 0
ldr r4, _080F9118 @ =gRecvCmds
@@ -1422,7 +1422,7 @@ _080F913C:
strb r0, [r1]
ldr r0, _080F919C @ =0x0000099a
adds r1, r6, r0
ldr r0, _080F91A0 @ =gUnknown_3007460
ldr r0, _080F91A0 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r1, [r1]
ldrb r0, [r0, 0x2]
@@ -1460,7 +1460,7 @@ _080F913C:
.align 2, 0
_080F9198: .4byte 0x00000993
_080F919C: .4byte 0x0000099a
_080F91A0: .4byte gUnknown_3007460
_080F91A0: .4byte gRfuLinkStatus
_080F91A4: .4byte 0x00000994
_080F91A8: .4byte 0x0000099b
_080F91AC: .4byte 0x0000099c
@@ -1815,7 +1815,7 @@ _080F947E:
adds r0, r6, r1
ldrb r0, [r0]
adds r1, r0, 0
ldr r0, _080F94A0 @ =gUnknown_3007460
ldr r0, _080F94A0 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x6]
cmp r0, 0
@@ -1826,7 +1826,7 @@ _080F947E:
.align 2, 0
_080F9498: .4byte 0x00000994
_080F949C: .4byte gUnknown_3005450
_080F94A0: .4byte gUnknown_3007460
_080F94A0: .4byte gRfuLinkStatus
_080F94A4:
movs r0, 0
b _080F94AA
@@ -1950,7 +1950,7 @@ _080F9538:
ldrb r0, [r0]
cmp r0, 0
beq _080F95E4
ldr r0, _080F964C @ =gUnknown_3007460
ldr r0, _080F964C @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r1, [r0, 0x2]
ldrb r0, [r0, 0x3]
@@ -2042,7 +2042,7 @@ _080F963C: .4byte gRecvCmds
_080F9640: .4byte gUnknown_3005E10
_080F9644: .4byte gUnknown_3005450
_080F9648: .4byte 0x0000099c
_080F964C: .4byte gUnknown_3007460
_080F964C: .4byte gRfuLinkStatus
_080F9650: .4byte gReceivedRemoteLinkPlayers
_080F9654: .4byte 0x00000988
_080F9658: .4byte gSendCmd
@@ -2435,7 +2435,7 @@ _080F9902:
beq _080F9914
b _080F9C40
_080F9914:
ldr r0, _080F9944 @ =gUnknown_3007460
ldr r0, _080F9944 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
mov r6, r8
@@ -2458,7 +2458,7 @@ _080F9924:
.align 2, 0
_080F993C: .4byte gUnknown_3005450
_080F9940: .4byte gReceivedRemoteLinkPlayers
_080F9944: .4byte gUnknown_3007460
_080F9944: .4byte gRfuLinkStatus
_080F9948: .4byte gRecvCmds + 2
_080F994C: .4byte gRecvCmds + 4
_080F9950: .4byte gUnknown_3005DD6
@@ -2688,7 +2688,7 @@ _080F9B00:
ldr r0, _080F9B54 @ =gRecvCmds + 2
adds r4, r5, r0
ldrh r1, [r4]
ldr r0, _080F9B58 @ =gUnknown_3007460
ldr r0, _080F9B58 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0, 0x2]
ands r1, r0
@@ -2715,7 +2715,7 @@ _080F9B38:
_080F9B4C: .4byte gUnknown_3005450
_080F9B50: .4byte gReceivedRemoteLinkPlayers
_080F9B54: .4byte gRecvCmds + 2
_080F9B58: .4byte gUnknown_3007460
_080F9B58: .4byte gRfuLinkStatus
_080F9B5C: .4byte gRecvCmds + 4
_080F9B60: .4byte 0x0000099c
_080F9B64: .4byte gRecvCmds
@@ -3502,7 +3502,7 @@ _080FA13C: .4byte gUnknown_3005450
thumb_func_start sub_80FA140
sub_80FA140: @ 80FA140
push {lr}
ldr r0, _080FA15C @ =gUnknown_3007460
ldr r0, _080FA15C @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r1, [r0, 0x2]
ldrb r0, [r0, 0x3]
@@ -3513,7 +3513,7 @@ sub_80FA140: @ 80FA140
pop {r0}
bx r0
.align 2, 0
_080FA15C: .4byte gUnknown_3007460
_080FA15C: .4byte gRfuLinkStatus
thumb_func_end sub_80FA140
thumb_func_start sub_80FA160
@@ -3552,7 +3552,7 @@ sub_80FA190: @ 80FA190
adds r1, r2, r0
movs r0, 0x1
strb r0, [r1]
ldr r0, _080FA1BC @ =gUnknown_3007460
ldr r0, _080FA1BC @ =gRfuLinkStatus
ldr r1, [r0]
ldrb r0, [r1, 0x2]
ldrb r1, [r1, 0x3]
@@ -3565,7 +3565,7 @@ sub_80FA190: @ 80FA190
.align 2, 0
_080FA1B4: .4byte gUnknown_3005450
_080FA1B8: .4byte 0x0000099c
_080FA1BC: .4byte gUnknown_3007460
_080FA1BC: .4byte gRfuLinkStatus
_080FA1C0: .4byte 0x0000099b
thumb_func_end sub_80FA190
@@ -4065,7 +4065,7 @@ _080FA53A:
lsrs r0, 24
cmp r0, 0x1
bls _080FA5C2
ldr r1, _080FA5A0 @ =gUnknown_3007450
ldr r1, _080FA5A0 @ =gRfuSlotStatusNI
lsls r0, r5, 2
adds r0, r1
ldr r0, [r0]
@@ -4103,7 +4103,7 @@ _080FA55E:
_080FA594: .4byte gUnknown_3005450
_080FA598: .4byte 0x000008f6
_080FA59C: .4byte 0x00000989
_080FA5A0: .4byte gUnknown_3007450
_080FA5A0: .4byte gRfuSlotStatusNI
_080FA5A4: .4byte 0x0000098d
_080FA5A8:
mov r2, r8
@@ -4300,7 +4300,7 @@ sub_80FA6FC: @ 80FA6FC
movs r0, 0x2
b _080FA732
_080FA718:
ldr r1, _080FA72C @ =gUnknown_3007450
ldr r1, _080FA72C @ =gRfuSlotStatusNI
lsls r0, 2
adds r0, r1
ldr r0, [r0]
@@ -4310,7 +4310,7 @@ _080FA718:
movs r0, 0
b _080FA732
.align 2, 0
_080FA72C: .4byte gUnknown_3007450
_080FA72C: .4byte gRfuSlotStatusNI
_080FA730:
movs r0, 0x1
_080FA732:
@@ -4327,7 +4327,7 @@ sub_80FA738: @ 80FA738
ldr r1, _080FA780 @ =0x0000098d
adds r5, r0, r1
_080FA746:
ldr r1, _080FA784 @ =gUnknown_3007450
ldr r1, _080FA784 @ =gRfuSlotStatusNI
lsls r0, r4, 2
adds r0, r1
ldr r0, [r0]
@@ -4358,7 +4358,7 @@ _080FA770:
.align 2, 0
_080FA77C: .4byte gUnknown_3005450
_080FA780: .4byte 0x0000098d
_080FA784: .4byte gUnknown_3007450
_080FA784: .4byte gRfuSlotStatusNI
thumb_func_end sub_80FA738
thumb_func_start sub_80FA788
@@ -4371,7 +4371,7 @@ sub_80FA788: @ 80FA788
ldrb r0, [r0]
cmp r0, 0x8
bne _080FA7C2
ldr r2, _080FA808 @ =gUnknown_3007450
ldr r2, _080FA808 @ =gRfuSlotStatusNI
ldr r0, _080FA80C @ =0x000008f6
adds r1, r0
ldrb r0, [r1]
@@ -4393,7 +4393,7 @@ _080FA7BA:
movs r0, 0x4
bl rfu_clearSlot
_080FA7C2:
ldr r2, _080FA808 @ =gUnknown_3007450
ldr r2, _080FA808 @ =gRfuSlotStatusNI
ldr r5, _080FA800 @ =gUnknown_3005450
ldr r0, _080FA80C @ =0x000008f6
adds r1, r5, r0
@@ -4425,7 +4425,7 @@ _080FA7E6:
.align 2, 0
_080FA800: .4byte gUnknown_3005450
_080FA804: .4byte 0x0000093d
_080FA808: .4byte gUnknown_3007450
_080FA808: .4byte gRfuSlotStatusNI
_080FA80C: .4byte 0x000008f6
_080FA810: .4byte 0x0000093e
_080FA814:
@@ -5772,7 +5772,7 @@ _080FB21E:
ands r0, r1
cmp r0, 0
beq _080FB286
ldr r0, _080FB274 @ =gUnknown_3007460
ldr r0, _080FB274 @ =gRfuLinkStatus
lsls r1, r5, 5
adds r1, 0x14
ldr r0, [r0]
@@ -5803,7 +5803,7 @@ _080FB21E:
_080FB268: .4byte gUnknown_3005E10
_080FB26C: .4byte gUnknown_3005450
_080FB270: .4byte 0x0000098d
_080FB274: .4byte gUnknown_3007460
_080FB274: .4byte gRfuLinkStatus
_080FB278: .4byte 0x00000989
_080FB27C:
mov r0, r8
@@ -6216,7 +6216,7 @@ sub_80FB5A0: @ 80FB5A0
movs r3, 0
movs r2, 0
movs r4, 0x1
ldr r6, _080FB5E8 @ =gUnknown_3007460
ldr r6, _080FB5E8 @ =gRfuLinkStatus
movs r7, 0x7F
_080FB5AE:
adds r0, r5, 0
@@ -6249,7 +6249,7 @@ _080FB5D4:
pop {r1}
bx r1
.align 2, 0
_080FB5E8: .4byte gUnknown_3007460
_080FB5E8: .4byte gRfuLinkStatus
thumb_func_end sub_80FB5A0
thumb_func_start sub_80FB5EC
@@ -6601,7 +6601,7 @@ _080FB894:
adds r1, 0xF0
movs r0, 0x3
strb r0, [r1]
ldr r0, _080FB8B8 @ =gUnknown_3007460
ldr r0, _080FB8B8 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0
@@ -6615,7 +6615,7 @@ _080FB8AA:
b _080FB9C0
.align 2, 0
_080FB8B4: .4byte gUnknown_3005450
_080FB8B8: .4byte gUnknown_3007460
_080FB8B8: .4byte gRfuLinkStatus
_080FB8BC: .4byte 0x000008f4
_080FB8C0:
ldr r0, _080FB900 @ =gUnknown_3005450
@@ -6674,7 +6674,7 @@ _080FB916:
movs r0, 0
bl sub_80FD760
_080FB934:
ldr r0, _080FB96C @ =gUnknown_3007460
ldr r0, _080FB96C @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0xFF
@@ -6700,7 +6700,7 @@ _080FB95A:
.align 2, 0
_080FB964: .4byte 0x0000099c
_080FB968: .4byte gReceivedRemoteLinkPlayers
_080FB96C: .4byte gUnknown_3007460
_080FB96C: .4byte gRfuLinkStatus
_080FB970: .4byte gUnknown_3005E10
_080FB974: .4byte sub_80F8B34
_080FB978: .4byte gUnknown_3005450
@@ -7108,7 +7108,7 @@ sub_80FBC70: @ 80FBC70
movs r0, 0xFF
mov r9, r0
movs r7, 0
ldr r1, _080FBCF4 @ =gUnknown_3007460
ldr r1, _080FBCF4 @ =gRfuLinkStatus
mov r8, r1
_080FBC8E:
lsls r4, r7, 5
@@ -7162,7 +7162,7 @@ _080FBCE2:
pop {r1}
bx r1
.align 2, 0
_080FBCF4: .4byte gUnknown_3007460
_080FBCF4: .4byte gRfuLinkStatus
thumb_func_end sub_80FBC70
thumb_func_start sub_80FBCF8
@@ -7391,7 +7391,7 @@ sub_80FBE80: @ 80FBE80
lsrs r2, r0, 24
cmp r2, 0xFF
beq _080FBF18
ldr r0, _080FBEDC @ =gUnknown_3007460
ldr r0, _080FBEDC @ =gRfuLinkStatus
ldr r0, [r0]
lsls r1, r2, 5
adds r0, r1
@@ -7408,7 +7408,7 @@ sub_80FBE80: @ 80FBE80
b _080FBF10
.align 2, 0
_080FBED8: .4byte gTasks+0x8
_080FBEDC: .4byte gUnknown_3007460
_080FBEDC: .4byte gRfuLinkStatus
_080FBEE0: .4byte gUnknown_3005450
_080FBEE4: .4byte 0x000008f5
_080FBEE8:
@@ -7638,7 +7638,7 @@ _080FC070:
beq _080FC108
movs r1, 0xA
ldrsh r0, [r4, r1]
ldr r7, _080FC0F4 @ =gUnknown_3007460
ldr r7, _080FC0F4 @ =gRfuLinkStatus
lsls r4, r2, 5
adds r2, r4, 0
adds r2, 0x14
@@ -7670,7 +7670,7 @@ _080FC0E4: .4byte gTasks
_080FC0E8: .4byte 0x00000985
_080FC0EC: .4byte gUnknown_3005E10
_080FC0F0: .4byte 0x00000119
_080FC0F4: .4byte gUnknown_3007460
_080FC0F4: .4byte gRfuLinkStatus
_080FC0F8:
movs r1, 0xE0
lsls r1, 7
@@ -7845,7 +7845,7 @@ sub_80FC228: @ 80FC228
movs r2, 0x13
movs r3, 0x2
bl nullsub_88
ldr r4, _080FC2F8 @ =gUnknown_3007460
ldr r4, _080FC2F8 @ =gRfuLinkStatus
ldr r0, [r4]
ldrb r0, [r0, 0x2]
movs r1, 0x14
@@ -7934,7 +7934,7 @@ _080FC2CE:
bl nullsub_87
b _080FC436
.align 2, 0
_080FC2F8: .4byte gUnknown_3007460
_080FC2F8: .4byte gRfuLinkStatus
_080FC2FC: .4byte gUnknown_3005450
_080FC300: .4byte gUnknown_843EE64
_080FC304:
@@ -7969,7 +7969,7 @@ _080FC318:
adds r6, 0x1
cmp r6, 0x3
ble _080FC318
ldr r5, _080FC394 @ =gUnknown_3007460
ldr r5, _080FC394 @ =gRfuLinkStatus
ldr r1, [r5]
ldr r4, _080FC398 @ =gUnknown_3005450
ldr r0, _080FC39C @ =0x000008f6
@@ -8004,12 +8004,12 @@ _080FC318:
.align 2, 0
_080FC38C: .4byte gUnknown_843EE47
_080FC390: .4byte gUnknown_843EE57
_080FC394: .4byte gUnknown_3007460
_080FC394: .4byte gRfuLinkStatus
_080FC398: .4byte gUnknown_3005450
_080FC39C: .4byte 0x000008f6
_080FC3A0:
movs r6, 0
ldr r1, _080FC440 @ =gUnknown_3007460
ldr r1, _080FC440 @ =gRfuLinkStatus
ldr r0, [r1]
ldrb r0, [r0, 0x8]
cmp r6, r0
@@ -8088,7 +8088,7 @@ _080FC436:
pop {r0}
bx r0
.align 2, 0
_080FC440: .4byte gUnknown_3007460
_080FC440: .4byte gRfuLinkStatus
_080FC444: .4byte gUnknown_843EE47
_080FC448: .4byte gUnknown_843EE57
thumb_func_end sub_80FC228
@@ -9032,7 +9032,7 @@ sub_80FCADC: @ 80FCADC
lsls r0, 24
lsrs r5, r0, 24
movs r6, 0
ldr r0, _080FCB04 @ =gUnknown_3007460
ldr r0, _080FCB04 @ =gRfuLinkStatus
ldr r4, [r0]
ldrb r2, [r4, 0x2]
ldrb r1, [r4]
@@ -9048,7 +9048,7 @@ sub_80FCADC: @ 80FCADC
ldrb r0, [r4, 0xA]
b _080FCB4C
.align 2, 0
_080FCB04: .4byte gUnknown_3007460
_080FCB04: .4byte gRfuLinkStatus
_080FCB08:
adds r0, r6, 0x1
lsls r0, 24
@@ -9234,7 +9234,7 @@ sub_80FCC3C: @ 80FCC3C
bne _080FCC98
movs r0, 0x1
mov r9, r0
ldr r6, _080FCC94 @ =gUnknown_3007460
ldr r6, _080FCC94 @ =gRfuLinkStatus
ldr r0, [r6]
lsls r4, r5, 5
adds r0, r4
@@ -9261,11 +9261,11 @@ _080FCC78:
b _080FCCE4
.align 2, 0
_080FCC90: .4byte gUnknown_3005E10
_080FCC94: .4byte gUnknown_3007460
_080FCC94: .4byte gRfuLinkStatus
_080FCC98:
movs r0, 0
mov r9, r0
ldr r6, _080FCCCC @ =gUnknown_3007460
ldr r6, _080FCCCC @ =gRfuLinkStatus
ldr r0, [r6]
lsls r4, r5, 5
adds r0, r4
@@ -9288,7 +9288,7 @@ _080FCCB0:
bl memcpy
b _080FCCE4
.align 2, 0
_080FCCCC: .4byte gUnknown_3007460
_080FCCCC: .4byte gRfuLinkStatus
_080FCCD0:
adds r0, r7, 0
movs r1, 0
@@ -9315,7 +9315,7 @@ sub_80FCCF4: @ 80FCCF4
adds r5, r1, 0
lsls r2, 24
movs r7, 0
ldr r6, _080FCD2C @ =gUnknown_3007460
ldr r6, _080FCD2C @ =gRfuLinkStatus
ldr r0, [r6]
lsrs r4, r2, 19
adds r2, r0, r4
@@ -9337,7 +9337,7 @@ sub_80FCCF4: @ 80FCCF4
movs r7, 0x1
b _080FCD48
.align 2, 0
_080FCD2C: .4byte gUnknown_3007460
_080FCD2C: .4byte gRfuLinkStatus
_080FCD30: .4byte 0x00007f7d
_080FCD34:
adds r0, r3, 0
@@ -9388,7 +9388,7 @@ CreateWirelessStatusIndicatorSprite: @ 80FCD74
movs r3, 0xE7
movs r2, 0x8
_080FCD8A:
ldr r0, _080FCDCC @ =gUnknown_3007460
ldr r0, _080FCDCC @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0x1
@@ -9420,7 +9420,7 @@ _080FCD8A:
strb r5, [r0]
b _080FCE2A
.align 2, 0
_080FCDCC: .4byte gUnknown_3007460
_080FCDCC: .4byte gRfuLinkStatus
_080FCDD0: .4byte gUnknown_843F284
_080FCDD4: .4byte gSprites
_080FCDD8: .4byte 0x00001234
@@ -9551,7 +9551,7 @@ _080FCEE0: .4byte gUnknown_203ACE4
thumb_func_start sub_80FCEE4
sub_80FCEE4: @ 80FCEE4
push {r4,lr}
ldr r1, _080FCF04 @ =gUnknown_3007460
ldr r1, _080FCF04 @ =gRfuLinkStatus
ldr r0, [r1]
ldrb r2, [r0, 0x2]
movs r3, 0
@@ -9567,7 +9567,7 @@ _080FCEF0:
ldrb r0, [r0]
b _080FCF16
.align 2, 0
_080FCF04: .4byte gUnknown_3007460
_080FCF04: .4byte gRfuLinkStatus
_080FCF08:
lsrs r2, 1
adds r0, r3, 0x1
@@ -9626,7 +9626,7 @@ _080FCF5C:
adds r6, r2, 0
movs r5, 0xFF
movs r4, 0
ldr r0, _080FCF84 @ =gUnknown_3007460
ldr r0, _080FCF84 @ =gRfuLinkStatus
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0x1
@@ -9641,7 +9641,7 @@ _080FCF5C:
_080FCF78: .4byte gUnknown_203ACE4
_080FCF7C: .4byte gSprites
_080FCF80: .4byte 0x00001234
_080FCF84: .4byte gUnknown_3007460
_080FCF84: .4byte gRfuLinkStatus
_080FCF88:
adds r0, r4, 0x1
lsls r0, 24
+2 -2
View File
@@ -10493,7 +10493,7 @@ _0811AFF8:
_0811AFFA:
cmp r4, 0x3
bgt _0811B030
ldr r0, _0811B044 @ =gUnknown_3007460
ldr r0, _0811B044 @ =gRfuLinkStatus
ldr r0, [r0]
lsls r1, r4, 5
adds r0, r1
@@ -10526,7 +10526,7 @@ _0811B030:
bl StringCopy
b _0811B080
.align 2, 0
_0811B044: .4byte gUnknown_3007460
_0811B044: .4byte gRfuLinkStatus
_0811B048: .4byte gSpeciesNames
_0811B04C: .4byte gUnknown_8457DB8
_0811B050:
+5
View File
@@ -0,0 +1,5 @@
gRfuSlotStatusUNI
gRfuSlotStatusNI
gRfuLinkStatus
gRfuStatic
gRfuFixed
+1
View File
@@ -0,0 +1 @@
gRfuS32Id
+1
View File
@@ -0,0 +1 @@
gSTWIStatus
-28
View File
@@ -1,28 +0,0 @@
.section .rodata
.set VERSION_MAJOR, 1
.set VERSION_MINOR, 0
.set VERSION_REVISION, 24
.align 2
_Str_RfuHeader::
.byte 2, 14, 0, 10, 9, 5, 7, 2
.byte 0, 15, 1, 3, 3, 0, 31, 0
.byte 3, 22, 18, 14, 13, 9, 11, 3
.byte 15, 15, 1, 3, 3, 0, 0x7f, 0
.ascii "RFU_V"
.byte VERSION_MAJOR + 0x30
.byte VERSION_MINOR + 0x30
.byte (VERSION_REVISION / 10) + 0x30
.byte (VERSION_REVISION % 10) + 0x30
.byte 0
.align 2
_Str_RFU_MBOOT::
.asciz "RFU-MBOOT"
.align 2
_Str_Sio32ID::
.asciz "NINTENDOSio32ID_030820"
+2 -2
View File
@@ -1,4 +1,4 @@
#ifndef GUARD_CONSTANTS_TRADE_H
#ifndef GUARD_CONSTANTS_TRADE_H
#define GUARD_CONSTANTS_TRADE_H
// TODO: document trade.c and trade_scene.c with corresponding macros
@@ -115,4 +115,4 @@
#define CANT_REGISTER_MON 1
#define CANT_REGISTER_EGG 2
#endif //GUARD_CONSTANTS_TRADE_H
#endif // GUARD_CONSTANTS_TRADE_H
+7 -1
View File
@@ -137,6 +137,8 @@
#define REG_OFFSET_DMA3CNT_H 0xde
#define REG_OFFSET_TMCNT 0x100
#define REG_OFFSET_TMCNT_L 0x100
#define REG_OFFSET_TMCNT_H 0x102
#define REG_OFFSET_TM0CNT 0x100
#define REG_OFFSET_TM0CNT_L 0x100
#define REG_OFFSET_TM0CNT_H 0x102
@@ -298,6 +300,8 @@
#define REG_ADDR_DMA3CNT_H (REG_BASE + REG_OFFSET_DMA3CNT_H)
#define REG_ADDR_TMCNT (REG_BASE + REG_OFFSET_TMCNT)
#define REG_ADDR_TMCNT_L (REG_BASE + REG_OFFSET_TMCNT_L)
#define REG_ADDR_TMCNT_H (REG_BASE + REG_OFFSET_TMCNT_H)
#define REG_ADDR_TM0CNT (REG_BASE + REG_OFFSET_TM0CNT)
#define REG_ADDR_TM0CNT_L (REG_BASE + REG_OFFSET_TM0CNT_L)
#define REG_ADDR_TM0CNT_H (REG_BASE + REG_OFFSET_TM0CNT_H)
@@ -457,7 +461,9 @@
#define REG_DMA3CNT_L (*(vu16 *)REG_ADDR_DMA3CNT_L)
#define REG_DMA3CNT_H (*(vu16 *)REG_ADDR_DMA3CNT_H)
#define REG_TMCNT(n) (*(vu16 *)(REG_ADDR_TMCNT + ((n) * 4)))
#define REG_TMCNT(n) (*(vu32 *)(REG_ADDR_TMCNT + ((n) * 4)))
#define REG_TMCNT_L(n) (*(vu16 *)(REG_ADDR_TMCNT_L + ((n) * 4)))
#define REG_TMCNT_H(n) (*(vu16 *)(REG_ADDR_TMCNT_H + ((n) * 4)))
#define REG_TM0CNT (*(vu32 *)REG_ADDR_TM0CNT)
#define REG_TM0CNT_L (*(vu16 *)REG_ADDR_TM0CNT_L)
#define REG_TM0CNT_H (*(vu16 *)REG_ADDR_TM0CNT_H)
+11 -1
View File
@@ -105,7 +105,7 @@
} \
}
#define DmaClearLarge(dmaNum, dest, size, block, bit) \
#define DmaClearLarge(dmaNum, dest, size, block, bit) \
{ \
u32 _size = size; \
while (1) \
@@ -170,4 +170,14 @@
#define DmaFill16Defvars(dmaNum, value, dest, size) DmaFillDefvars(dmaNum, value, dest, size, 16)
#define DmaFill32Defvars(dmaNum, value, dest, size) DmaFillDefvars(dmaNum, value, dest, size, 32)
#define IntrEnable(flags) \
{ \
u16 imeTemp; \
\
imeTemp = REG_IME; \
REG_IME = 0; \
REG_IE |= flags; \
REG_IME = imeTemp; \
}
#endif // GUARD_GBA_MACRO_H
+2
View File
@@ -45,4 +45,6 @@ void RLUnCompVram(const void *src, void *dest);
int MultiBoot(struct MultiBootParam *mp);
s32 Div(s32 num, s32 denom);
#endif // GUARD_GBA_SYSCALL_H
+603 -187
View File
@@ -1,58 +1,309 @@
#ifndef GUARD_LIBRFU_H
#define GUARD_LIBRFU_H
#include "global.h"
#include "main.h"
enum
/* TODOs:
* - split files
* - documentation
* - decompile librfu_intr.s once arm support is back again
(for internal structs not documented in SDK)
* - check if any field needs to be volatile
* - check if field names make sense
*/
// --------------------------------------------------------------------------
//
// Restrictions When Using RFU
//
// --------------------------------------------------------------------------
/*
The following restrictions apply when using RFU.
<Restrictions for Direct Sound>
(a) The timer for Sound DMA uses only 0
(b) The prescaler for the timer count for the Sound DMA uses 59.5 ns.
(c) The sound sampling rate is Max36.314KHz.
<Restrictions for H-DMA or DMA started with V-Blank>
These types of DMA can be operated on a maximum CPU cycle of 42 cycles.
Calculate the number of the transferable DMA count based on this 42 cycles and the access cycles of the destination and source.
For example, if both the CPU internal RAM --> VRAM have a one cycle access, then a 21 count DMA can occur.
If RFU is used outside of these restrictions, problems, such as the loss of data caused by the failure of the AGB, as a clock slave,
to notify that data has been received from the RFU, will occur.
When this problem occurs, the REQ callback will send a REQ_commandID=ID_CLOCK_SLAVE_MS_CHANGE_ERROR_BY_DMA_REQ notification.
(When using Link Manager, the LMAN call back will send a LMAN_msg=LMAN_MSG_CLOCK_SLAVE_MS_CHANGE_ERROR_BY_DMA notification.)
*/
// REQ-COMMAND (STWI) ID CODE LIST
// REQ Command ID returned by the REQ callback
#define ID_RESET_REQ 0x0010
#define ID_LINK_STATUS_REQ 0x0011
#define ID_VERSION_STATUS_REQ 0x0012 // not defined in SDK header
#define ID_SYSTEM_STATUS_REQ 0x0013
#define ID_SLOT_STATUS_REQ 0x0014 // not defined in SDK header
#define ID_CONFIG_STATUS_REQ 0x0015 // not defined in SDK header
#define ID_GAME_CONFIG_REQ 0x0016
#define ID_SYSTEM_CONFIG_REQ 0x0017
#define ID_SC_START_REQ 0x0019
#define ID_SC_POLL_REQ 0x001a
#define ID_SC_END_REQ 0x001b
#define ID_SP_START_REQ 0x001c
#define ID_SP_POLL_REQ 0x001d
#define ID_SP_END_REQ 0x001e
#define ID_CP_START_REQ 0x001f
#define ID_CP_POLL_REQ 0x0020
#define ID_CP_END_REQ 0x0021
#define ID_DATA_TX_REQ 0x0024
#define ID_DATA_TX_AND_CHANGE_REQ 0x0025
#define ID_DATA_RX_REQ 0x0026
#define ID_MS_CHANGE_REQ 0x0027 // When returned by the REQ callback, this ID indicates that execution of rfu_REQ_changeMasterSlave has finished.
// This ID is returned by both the REQ callback and the MSC callback.
// When returned by the MSC callback, this is notification that after the AGB has been made into the clock slave, the MC_Timer expired and the RFU returned the AGB to be the clock master.
#define ID_DISCONNECT_REQ 0x0030
#define ID_TEST_MODE_REQ 0x0031 // not defined in SDK header
#define ID_CPR_START_REQ 0x0032
#define ID_CPR_POLL_REQ 0x0033
#define ID_CPR_END_REQ 0x0034
#define ID_UNK35_REQ 0x0035 // not defined in SDK header
#define ID_RESUME_RETRANSMIT_AND_CHANGE_REQ 0x0037
#define ID_STOP_MODE_REQ 0x003d
#define ID_CLOCK_SLAVE_MS_CHANGE_ERROR_BY_DMA_REQ 0x00ff // When the AGB is the clock slave, the RFU generates an informational notice, and an automatically started DMA, such as HDMA, is generated at the instant the AGB is being returned as the clock master. This ID is notified by a REQ callback when the exchange of this information (REQ command) fails.
// REQ Command ID returned by the MSC callback
#define ID_DISCONNECTED_AND_CHANGE_REQ 0x0029
#define ID_DATA_READY_AND_CHANGE_REQ 0x0028
#define ID_DRAC_REQ_WITH_ACK_FLAG 0x0128
// --------------------------------------------------------------------------
//
// Data Definitions
//
// --------------------------------------------------------------------------
#define RFU_ID 0x00008001 // ID number of AGB-RFU device: ID returned by execution of rfu_REQBN_softReset_and_checkID.
#define RFU_MBOOT_DOWNLOADER_SERIAL_NO 0x0000 // The game serial number of the multi-boot downloader (programs that boot without a Game Pak)
#define RFU_API_BUFF_SIZE_RAM 0x0e8c // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in RAM)
#define RFU_API_BUFF_SIZE_ROM 0x052c // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in ROM)
#define RFU_CHILD_MAX 4 // Maximum number of slaves that can be connected to one parent device
#define RFU_GAME_NAME_LENGTH 13 // Possible length of game name set by rfu_REQB_configGameData
#define RFU_USER_NAME_LENGTH 8 // Possible length of user name set by rfu_REQB_configGameData
#define RFU_H_DMA_MAX_CPU_CYCLE 42 // Maximum number of CPU cycles for H-DMA or DMA that starts with V-Blank that can operate when using RFU
// Value to determine the level of the icon that displays the link strength of the wireless status (value of rfuLinkStatus->strength[0-3])
#define RFU_LINK_ICON_LEVEL4_MAX 255 // 90% -100% (If the value is betwen 229 and 255, the icon level is 4)
#define RFU_LINK_ICON_LEVEL4_MIN 229
#define RFU_LINK_ICON_LEVEL3_MAX 228 // 50% - 89% (If the value is betwen 127 and 228, the icon level is 3)
#define RFU_LINK_ICON_LEVEL3_MIN 127
#define RFU_LINK_ICON_LEVEL2_MAX 126 // 10% - 49% (If the value is betwen 25 and 126, the icon level is 2)
#define RFU_LINK_ICON_LEVEL2_MIN 25
#define RFU_LINK_ICON_LEVEL1_MAX 24 // 0% - 9% (If the value is betwen 0 and 24, the icon level is 1)
#define RFU_LINK_ICON_LEVEL1_MIN 0
// *******************************************************
// Definition Data for Arguments Used in Library Functions
// *******************************************************
// Specified by u16 mbootFlag in rfu_REQ_configGameData
#define RFU_MBOOT_FLAG 0x01 // Enabling this flag, allows connection to a multi-boot program.
// AvailSlot (number of slots available for connection) used in u16 availSlotFlag in rfu_REQ_configSystem
#define AVAIL_SLOT4 0x0000
#define AVAIL_SLOT3 0x0001
#define AVAIL_SLOT2 0x0002
#define AVAIL_SLOT1 0x0003
// u8 connTypeFlag specified by rfu_setRecvBuffer
#define TYPE_UNI 0x10 // UNI-type
#define TYPE_NI 0x20 // NI-type
// u8 connTypeFlag specified by rfu_clearSlot
#define TYPE_UNI_SEND 0x01 // UNI-type send
#define TYPE_UNI_RECV 0x02 // UNI-type receive
#define TYPE_NI_SEND 0x04 // NI-type send
#define TYPE_NI_RECV 0x08 // NI-type receive
// *******************************************************
// Definition Data Returned by Return Values for Library Functions
// *******************************************************
// The function doesn't have return value.
// Value of u8 *status for rfu_REQ_pollConnectParent (Connection Trial Status)
// #define CP_STATUS_DONE 0x00 // Connection successful
// #define CP_STATUS_IN_PROCESS 0x01 // Connecting
// #define CP_STATUS_SLOT_CLOSED 0x02 // Parent device is not in connection mode with child device
// #define CP_STATUS_DISCONNECTED 0x03 // Disconnected by parent device while connecting
// #define CP_STATUS_UNKNOWN 0xff // Cannot read status due to REQ-API execution error
// The function doesn't exist.
// Value of u8 *status argument for rfu_REQ_pollRecoveryConnect (Link Restore Status)
// #define RC_STATUS_DONE 0x00 // Connection restore successful
// #define RC_STATUS_FAILED 0x01 // Connection restore failure (meaningless to try anymore)
// #define RC_STATUS_SEARCHING_PARENT 0x02 // Searching for parent device
// #define RC_STATUS_UNKNOWN 0xff // Cannot read status due to REQ-API execution error
// Value of u8 *linkLossReason argument for rfu_REQBN_watchLink (Reason for Link Loss)
#define REASON_DISCONNECTED 0x00 // State of complete disconnection with rfuLL_disconnect and no possibility of restoring the link (can detect only child device)
#define REASON_LINK_LOSS 0x01 // State of link loss that allows for the possibility for the link to be restored
// *******************************************************
// Definition Data Returned with Return Values for Library Functions
// *******************************************************
// Value returned by rfu_getMasterSlave
#define AGB_CLK_SLAVE 0 // AGB clock slave
#define AGB_CLK_MASTER 1 // AGB clock master
// *******************************************************
// Error Code Group for Library Functions
// *******************************************************
// Error codes returned by u16 REQ_result with a REQ callback when a REQ-API function is executed
#define ERR_REQ_CMD 0x0000
#define ERR_REQ_CMD_CLOCK_DRIFT (ERR_REQ_CMD | 0x0001) // Clock drift occurs when a REQ command is sent
#define ERR_REQ_CMD_SENDING (ERR_REQ_CMD | 0x0002) // The next command cannot be issued because a REQ command is being sent
#define ERR_REQ_CMD_ACK_REJECTION (ERR_REQ_CMD | 0x0003) // The REQ command was refused when issued
#define ERR_REQ_CMD_CLOCK_SLAVE (ERR_REQ_CMD | 0x0004) // Issuing the REQ command was attempted but failed because the AGB is the clock slave
#define ERR_REQ_CMD_IME_DISABLE (ERR_REQ_CMD | 0x0006) // Issuing the REQ command was attempted but failed because the IME register is 0
#define ERR_PID_NOT_FOUND 0x0100 // The specified PID does not exist in the gRfuLinkStatus->partner[0-3].id list
// Error code returned by the return value of rfu_initializeAPI
#define ERR_RFU_API_BUFF_SIZE 0x0001
#define ERR_RFU_API_BUFF_ADR 0x0002
// Error codes returned by return values for rfu_REQBN_softReset_and_checkID
#define ERR_ID_CHECK_IME_DISABLE 0xffffffff // ID check could not be executed because REG_IME=0 when executing rfu_REQBN_softReset_and_checkID
// Error codes returned by rfu_getConnectParentStatus and rfu_CHILD_getConnectRecoveryStatus
#define ERR_REQ_CMD_ID (ERR_REQ_CMD | 0x0010) // A required REQ command was not executed within this function execution
// Error codes returned by rfu_NI_setSendData, rfu_UNI_setSendData, and rfu_NI_CHILD_setSendGameName
#define ERR_MODE 0x0300
#define ERR_MODE_NOT_PARENT (ERR_MODE | 0x0000) // not in SDK
#define ERR_MODE_NOT_CONNECTED (ERR_MODE | 0x0001) // RFU is not in connection mode (parent or child)
#define ERR_SLOT 0x0400
#define ERR_SLOT_NO (ERR_SLOT | 0x0000) // The specified slot number is not right
#define ERR_SLOT_NOT_CONNECTED (ERR_SLOT | 0x0001) // The specified slot is not connected
#define ERR_SLOT_BUSY (ERR_SLOT | 0x0002) // The specified slot is already communicating
#define ERR_SLOT_NOT_SENDING (ERR_SLOT | 0x0003) // The specified slot is not currently sending (Note: This is returned by rfu_UNI_re_setSendData)
#define ERR_SLOT_TARGET (ERR_SLOT | 0x0004) // The specified target slot is not right
#define ERR_SUBFRAME_SIZE 0x0500 // The specified subframe size is either larger than the remaining communication frame size or smaller than the link layer subframe header size
// Error code returned by rfu_clearSlot, rfu_setRecvBuffer, and rfu_changeSendTarget
#define ERR_COMM_TYPE 0x0600 // The specified communication format is not right
// Error code returned by rfu_REQ_recvData (when receiving NI-type or UNI-type data)
#define ERR_DATA_RECV 0x0700 // Error notification is issued in the following format.
// "ERR_DATA_RECV | (slot number issuing error with 0x0010<<UNI) | (slot number issuing error with 0x0001<<NI)"
// The actual error code is stored in gRfuSlotStatusNI or gRfuSlotStatusUNI[x]->recv.errorCode.
// Error code during NI-type communication (code entered into gRfuSlotStatusNI[x]->recv.errorCode)
#define ERR_RECV_BUFF_OVER (ERR_DATA_RECV | 0x0001) // The receive data size is larger than the receive buffer (Note: This error is used for both NI and UNI)
#define ERR_RECV_REPLY_SUBFRAME_SIZE (ERR_DATA_RECV | 0x0002) // All frames are already in use by other communications, and a subframe for reception response could not be secured
// Error code during UNI-type communication (code entered into gRfuSlotStatusUNI[x]->recv.errorCode)
#define ERR_RECV_DATA_OVERWRITED (ERR_DATA_RECV | 0x0008) // Received new data when gRfuSlotStatusUNI[x]->recv.newDataFlag=1
// not in SDK header
#define ERR_RECV_UNK (ERR_DATA_RECV | 0x0001 | 0x0008)
// *******************************************************
// Definition Data Used by Global Variables in the Library
// *******************************************************
// gRfuLinkStatus-------------------------------------------
// Connection status (refer to gRfuLinkStatus->parentChild)
#define MODE_NEUTRAL 0xff // Initialization
#define MODE_CHILD 0x00 // Child
#define MODE_PARENT 0x01 // Parent
// gRfuSlotStatusNI,UNI-----------------------------------
// Definition data for NI-(Numbered Information) and UNI-(Un-Numbered Information) type communication
// Definition data common to NI- and UNI-type communication
#define LLF_P_SIZE 87 // Maximum link layer communication frame size for the Parent (Maximum number of bytes per transmission)
#define LLF_C_SIZE 16 // " " for the Child
#define LLSF_P_HEADER_SIZE 3 // Header size used by one link layer subframe (NI or UNI frame) for the Parent
#define LLSF_C_HEADER_SIZE 2 // " " for the Child
// Link Layer Communication Code
#define LCOM_NULL 0x0000
#define LCOM_NI_START 0x0001
#define LCOM_NI 0x0002
#define LCOM_NI_END 0x0003
#define LCOM_UNI 0x0004
// Flag for Slot Status Data
#define SLOT_BUSY_FLAG 0x8000 // Slot in use
#define SLOT_SEND_FLAG 0x0020 // Send
#define SLOT_RECV_FLAG 0x0040 // Receive
// NI- and UNI-type shared slot stand-by data (same state as gRfuSlotStatusNI[x]->send or ->recv.state or gRfuSlotStatusUNI)
#define SLOT_STATE_READY 0x0000 // Slot initialization
// Status data for NI-type communication (gRfuSlotStatusNI[x]->send or ->recv.state)
#define SLOT_STATE_SEND_START (SLOT_BUSY_FLAG | SLOT_SEND_FLAG | LCOM_NI_START) // Start transmission
#define SLOT_STATE_SENDING (SLOT_BUSY_FLAG | SLOT_SEND_FLAG | LCOM_NI) // Transmitting
#define SLOT_STATE_SEND_LAST (SLOT_BUSY_FLAG | SLOT_SEND_FLAG | LCOM_NI_END) // Verify transmission end
#define SLOT_STATE_SEND_NULL (SLOT_BUSY_FLAG | SLOT_SEND_FLAG | LCOM_NULL) // Send NULL subframe to notify end of transmission
#define SLOT_STATE_SEND_SUCCESS ( SLOT_SEND_FLAG | 0x006) // Transmission successful
#define SLOT_STATE_SEND_FAILED ( SLOT_SEND_FLAG | 0x007) // Transmission failed
// Distinction of slot where transmission succeeded/failed compares gRfuSlotStatusNI[x]->send.bmSlot and same bmSlot_org
#define SLOT_STATE_RECV_START (SLOT_BUSY_FLAG | SLOT_RECV_FLAG | LCOM_NI_START) // Start reception
#define SLOT_STATE_RECEIVING (SLOT_BUSY_FLAG | SLOT_RECV_FLAG | LCOM_NI) // Receiving
#define SLOT_STATE_RECV_LAST (SLOT_BUSY_FLAG | SLOT_RECV_FLAG | LCOM_NI_END) // Verify reception end
#define SLOT_STATE_RECV_SUCCESS ( SLOT_RECV_FLAG | 0x006) // Reception successful
#define SLOT_STATE_RECV_FAILED ( SLOT_RECV_FLAG | 0x007) // Reception failed
#define SLOT_STATE_RECV_SUCCESS_AND_SENDSIDE_UNKNOWN (SLOT_RECV_FLAG | 0x008) // The data was received successful, but because the end of the communication was incomplete, whether the transmission side status is successful or failed is unknown
#define SLOT_STATE_RECV_IGNORE ( SLOT_RECV_FLAG | 0x009) // Ignore reception (refer to gRfuSlotStatusNI[x]->recv.errorCode for reason for ignoring)
// Status data for UNI-type communication (refer to gRfuSlotStatusUNI[x]->send.state)
#define SLOT_STATE_SEND_UNI (SLOT_BUSY_FLAG | SLOT_SEND_FLAG | LCOM_UNI) // Transmitting
// TODO: move the 2 structs to some other header as they're declared by GF
struct UnkLinkRfuStruct_02022B14Substruct
{
RFU_RESET = 0x10,
RFU_LINK_STATUS,
RFU_VERSION_STATUS,
RFU_SYSTEM_STATUS,
RFU_SLOT_STATUS,
RFU_CONFIG_STATUS,
RFU_GAME_CONFIG,
RFU_SYSTEM_CONFIG,
RFU_UNK18,
RFU_SC_START,
RFU_SC_POLLING,
RFU_SC_END,
RFU_SP_START,
RFU_SP_POLLING,
RFU_SP_END,
RFU_CP_START,
RFU_CP_POLLING,
RFU_CP_END,
RFU_UNK22,
RFU_UNK23,
RFU_DATA_TX,
RFU_DATA_TX_AND_CHANGE,
RFU_DATA_RX,
RFU_MS_CHANGE,
RFU_DATA_READY_AND_CHANGE,
RFU_DISCONNECTED_AND_CHANGE,
RFU_UNK2A,
RFU_UNK2B,
RFU_UNK2C,
RFU_UNK2D,
RFU_UNK2E,
RFU_UNK2F,
RFU_DISCONNECT,
RFU_TEST_MODE,
RFU_CPR_START,
RFU_CPR_POLLING,
RFU_CPR_END,
RFU_UNK35,
RFU_UNK36,
RFU_RESUME_RETRANSMIT_AND_CHANGE,
RFU_UNK38,
RFU_UNK39,
RFU_UNK3A,
RFU_UNK3B,
RFU_UNK3C,
RFU_STOP_MODE, //3D
u16 unk_00_0:4;
u16 unk_00_4:1;
u16 unk_00_5:1;
u16 unk_00_6:1;
u16 isChampion:1;
u16 hasNationalDex:1;
u16 gameClear:1;
u16 unk_01_2:4;
u16 unk_01_6:2;
u8 playerTrainerId[2];
};
struct __attribute__((packed, aligned(2))) UnkLinkRfuStruct_02022B14
{
struct UnkLinkRfuStruct_02022B14Substruct unk_00;
u8 unk_04[4];
u16 species:10;
u16 type:6;
u8 unk_0a_0:7;
u8 unk_0a_7:1;
u8 playerGender:1;
u8 level:7;
u8 unk_0c;
};
// the following structs are not documented in SDK
struct RfuPacket8
{
u8 data[0x74];
@@ -70,199 +321,364 @@ union RfuPacket
struct RfuPacket8 rfuPacket8;
};
struct UnkLinkRfuStruct_02022B14Substruct
struct STWIStatus
{
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];
};
struct __attribute__((packed, aligned(2))) UnkLinkRfuStruct_02022B14
{
struct UnkLinkRfuStruct_02022B14Substruct unk_00;
u8 unk_04[4];
u16 species:10;
u16 type: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;
u8 txParams;
u8 unk_5;
u8 activeCommand;
u8 unk_7;
u8 unk_8;
u8 unk_9;
vs32 state;
u8 reqLength;
u8 reqNext;
u8 reqActiveCommand;
u8 ackLength;
u8 ackNext;
u8 ackActiveCommand;
u8 timerSelect;
u8 unk_b;
int timerState;
u32 timerState; // this field is s32 in emerald
vu8 timerActive;
u8 unk_11;
vu16 unk_12;
vu16 error;
vu8 msMode;
u8 unk_15;
u8 recoveryCount;
u8 unk_16;
u8 unk_17;
void (*callbackM)();
void (*callbackS)();
u32 callbackID;
union RfuPacket * txPacket;
union RfuPacket * rxPacket;
void (*callbackS)(u16);
void (*unk_20)(void);
union RfuPacket *txPacket;
union RfuPacket *rxPacket;
vu8 unk_2c;
u8 padding[3];
};
// This struct is used as u8 array in SDK.
struct RfuIntrStruct
{
u8 rxPacketAlloc[0x74];
u8 txPacketAlloc[0x74];
u8 block1[0x960];
u8 block2[0x30];
union RfuPacket rxPacketAlloc;
union RfuPacket txPacketAlloc;
u8 block1[0x960]; // size of librfu_intr.s binary
struct STWIStatus block2;
};
struct RfuUnk1
// Data Structure for Transmitting UNI-Type Data
struct UNISend
{
u16 unk_0;
u8 unk_2;
u8 unk_3;
u8 fill_4[14];
u8 unk_12;
u32 unk_14;
u32 unk_18;
struct RfuIntrStruct unk_1c;
u16 state; // Slot communication state (SLOT_STATE_READY, SLOT_STATE_SEND_UNI)
u8 dataReadyFlag; // Flag indicating transmission data is prepared (0: data sent; 1: transmission data ready)
// Set with rfu_UNI_re_setSendData or rfu_UNI_readySendData, cleared when data is sent with rfu_REQ_sendData.
u8 bmSlot; // Expresses transmission destination slot as bits
u16 payloadSize; // Payload size of 1 transmission. "size" specified by rfu_UNI_setSendData or rfu_UNI_re_setSendData is used.
const void *src; // Beginning address of transmission data
};
struct RfuUnk2
// Data Structure for Receiving UNI Data
struct UNIRecv
{
u16 unk_0;
u16 unk_2;
u8 fill_4[0x16];
u8 unk_1a;
u8 fill_1b[0x19];
u16 unk_34;
u16 unk_36;
u8 fill_38[0x16];
u8 unk_4e;
u8 fill_4f[0x12];
u8 unk_61;
u8 fill_62[6];
void *unk_68;
void *unk_6c;
u8 unk_70[0x70];
u16 state; // Slot communication state (SLOT_STATE_READY, SLOT_STATE_RECEIVING, SLOT_STATE_RECV_IGNORE)
u16 errorCode; // Error code during reception
u16 dataSize; // Size of receive data
u8 newDataFlag; // Flag indicating whether receive data has newly arrived (0: no newly arrived data; 1: newly arrived data)
// The flag is cleared with rfu_UNI_clearRecvNewDataFlag; it is set when data is received with rfu_REQ_recvData.
u8 dataBlockFlag; // Flag for unreferenced receive data overwrite block (default is 0 Note: not used)
};
struct RfuUnk3
// Slot Status Data Structure for UNI-Type Communication
struct RfuSlotStatusUNI
{
u32 unk_0;
u32 unk_4;
u8 unk_8[0xD4];
u32 unk_dc;
struct UNISend send; // Transmission Status
struct UNIRecv recv; // Reception Status
void *recvBuffer; // Reception Buffer Address
u32 recvBufferSize; // Reception Buffer Size
};
struct RfuUnk5Sub
#define WINDOW_COUNT 4
struct NIComm
{
u16 unk_00;
u8 unk_02;
u16 unk_04;
struct UnkLinkRfuStruct_02022B14 unk_06;
u8 fill_13[1];
u8 playerName[PLAYER_NAME_LENGTH + 1];
u16 state; // Communication state of slot
u16 failCounter; // Count of failed transmissions/receptions (Count is increased when transmission/reception of data does not succeed within 1PF=16.7 ms)
const u8 *now_p[WINDOW_COUNT]; // Address of current send/receive (The data is divided into WINDOW_COUNT blocks and sent in payloadSize units.)
// remainSize is u32 in SDK. This is a hack to match ASM
s32 remainSize; // Size of remaining communication data
u16 errorCode; // Error code
u8 bmSlot; // Expresses the current communication slot in bits
// (When sending from the Master, because multiple slaves can be specified with bmSlot, communications are terminated based on the failCounter for each child device)
// Parameters used inside the Library
u8 recvAckFlag[WINDOW_COUNT];
u8 ack;
u8 phase;
u8 n[WINDOW_COUNT];
// Parameters indicating the current communication content
const void *src; // Start address transmission data (valid only for transmitting device)
u8 bmSlotOrg; // Expresses the communication source slot at the beginning of the transmission in bits (valid only for transmitting device)
u8 dataType; // Transmission/reception data type (0: User data; 1: Game identification information)
u16 payloadSize; // Payload size for one transmission
u32 dataSize; // Size of transmission/reception data
// Calculated by subtracting link layer header size from subFrameSize specified by the rfu_NI_setSendData function
};
struct RfuUnk5
struct RfuSlotStatusNI
{
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[1];
u8 unk_0a[4];
u8 filler_0e[6];
struct RfuUnk5Sub unk_14[4];
struct NIComm send; // Transmission Status
struct NIComm recv; // Reception Status
void *recvBuffer; // Reception Buffer Address
u32 recvBufferSize; // Reception Buffer Size
};
extern struct RfuStruct * gRfuState;
// Game Identification Information Data Structure
struct RfuTgtData
{
u16 id; // ID of parent candidate ID of connection partner
u8 slot; // Slot number where parent candidate can enter Connection slot number
u8 mbootFlag; // Flag to indicate whether or not the parent candidate Flag to indicate whether or not the connection partner
// is multiboot program for download is multiboot program for download
u16 serialNo; // Game serial number of parent candidate Game serial number of connection partner
u8 gname[RFU_GAME_NAME_LENGTH + 2]; // Game name of parent candidate Game name of connection partner
u8 uname[RFU_USER_NAME_LENGTH + 1]; // User name for parent candidate User name for connection partner
};
extern struct RfuUnk5 * gUnknown_3007460;
extern u32 *gUnknown_3007464;
extern struct RfuUnk3 * gUnknown_3007468;
extern struct RfuUnk2 * gUnknown_3007450[4];
extern struct RfuUnk1 * gUnknown_3007440[4];
extern struct {
struct RfuLinkStatus
{
u8 parentChild; // Connection status (0x01:MODE_PARENT 0x00:MODE_CHILD 0xff:MODE_NEUTRAL)
u8 connCount; // Number of connections
u8 connSlotFlag; // Flag to indicate in bits the connection slot (0x01<<Connection slot number)
u8 linkLossSlotFlag; // Flag to indicate in bits the slot where the link loss was generated (")
u8 sendSlotNIFlag; // Flag to indicate in bits the slot where NI-type send is occurring (")
u8 recvSlotNIFlag; // Flag to indicate in bits the slot where NI-type receive is occurring (")
u8 sendSlotUNIFlag; // Flag to indicate in bits the slot where UNI-type send is occurring (")
u8 getNameFlag; // Parent: Flag to indicate whether or not game identification information was obtained from the child connected to this slot (")
// Child: Flag to indicate whether or not game identification information was sent to the parent connected to this slot (")
u8 findParentCount; // Number of parent candidates discovered with rfu_REQ_xxxSearchParent, valid only with a child device
u8 watchInterval; // Link monitor execution interval (16.7 ms unit AGB picture frame)
u8 strength[RFU_CHILD_MAX]; // Link strength value (0x00 - 0xff; 0x00 is link loss. Updates with rfu_REQBN_watchLink)
vu8 LLFReadyFlag; // Indicates whether the link layer frame to send next has be constructed (Flag is on when calling rfu_constructLLFrame, flag is cleared when sending by rfu_REQ_sendData.)
u8 remainLLFrameSizeParent; // Remaining size of the link layer communication frame for the parent device
u8 remainLLFrameSizeChild[RFU_CHILD_MAX]; // Remaining size of the link layer communication frame for each slot for child device
struct RfuTgtData partner[RFU_CHILD_MAX]; // Parent, Child: When there is a connection, the matrix element corresponding to the number of the connected slot
// stores the game identification information for the connection partner.
// Child: Stores the game identification information for the parent candidate discovered when executing rfu_REQ_xxxxSearchParent.
struct RfuTgtData my; // The device's own game identification information (unrelated to the element slot value)
};
// the following structs are not documented in SDK
struct RfuFixed
{
void (*reqCallback)(u16, u16);
void (*fastCopyPtr)(const u8 **, u8 **, s32);
u16 fastCopyBuffer[24];
u32 fastCopyBuffer2[12];
u32 LLFBuffer[29];
struct RfuIntrStruct *STWIBuffer;
};
struct RfuStatic
{
u8 flags;
u8 NIEndRecvFlag;
u8 recvRenewalFlag;
u8 commExistFlag;
u8 recvErrorFlag;
u8 recoveryBmSlot;
u8 nowWatchInterval;
u8 nullFrameCount;
u8 emberCount;
u8 SCStartFlag;
u8 linkEmergencyFlag[4];
u8 lsFixedCount[4];
u16 cidBak[4];
u16 unk_1a;
u16 reqResult;
u16 tryPid;
u16 watchdogTimer;
u32 totalPacketSize;
};
struct RfuS32Id
{
u8 unk0;
u8 unk1;
u16 unk2;
u16 unk4;
u8 fill6[4];
u16 unk6;
u16 unk8; // unused
u16 unkA;
} gUnknown_3007470;
};
extern void rfu_STC_clearAPIVariables(void);
struct RfuAPIBuffer
{
struct RfuLinkStatus linkStatus;
struct RfuStatic static_;
struct RfuFixed fixed;
struct RfuSlotStatusNI NI[RFU_CHILD_MAX];
struct RfuSlotStatusUNI UNI[RFU_CHILD_MAX];
struct RfuIntrStruct intr;
};
void STWI_init_all(struct RfuIntrStruct * interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam);
void rfu_REQ_stopMode(void);
void rfu_waitREQComplete(void);
extern struct STWIStatus *gSTWIStatus;
extern struct RfuLinkStatus *gRfuLinkStatus;
extern struct RfuStatic *gRfuStatic;
extern struct RfuFixed *gRfuFixed;
extern struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX];
extern struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX];
extern struct RfuS32Id gRfuS32Id;
// librfu_s32id
s32 AgbRFU_checkID(u8);
// Arguments with "bm..." specify slots of the form (0x01 << slot number) that are the object of a function operation.
// librfu_rfu
// API Initialization and Initial Settings
// API Initialization
u16 rfu_initializeAPI(struct RfuAPIBuffer *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p, bool8 copyInterruptToRam);
// Set Timer Interrupt
void rfu_setTimerInterrupt(u8 timerNo, IntrFunc *timerIntrTable_p);
// Resident Function called from within a V-Blank Interrupt
u16 rfu_syncVBlank(void);
// Specify REQ Callback function
void rfu_setREQCallback(void (*callback)(u16 reqCommandId, u16 reqResult));
// REQ-API Execution Completion Wait
u16 rfu_waitREQComplete(void);
// RFU Initialization and Initial Settings
// RFU Startup and ID Check (Forced RFU reset occurs simultaneously)
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);
void rfu_REQBN_watchLink(u16 a0, u8 *a1, u8 *a2, u8 *a3);
bool16 rfu_syncVBlank(void);
// RFU Reset
void rfu_REQ_reset(void);
void rfu_REQ_configSystem(u16, u8, u8);
void rfu_REQ_configGameData(u8, u16, struct UnkLinkRfuStruct_02022B14 *, u8 *);
// Set RFU to Stop Mode (Power Down)
void rfu_REQ_stopMode(void);
// RFU Hardware Settings
void rfu_REQ_configSystem(u16 availSlotFlag, u8 maxMFrame, u8 mcTimer);
// Game Identification Information Configuration
void rfu_REQ_configGameData(u8 mbootFlag, u16 serialNo, const u8 *gname, const u8 *uname);
// RFU Connection Process
// Operate as parent device; search for and connect to child device
void rfu_REQ_startSearchChild(void);
void rfu_REQ_pollSearchChild(void);
void rfu_REQ_endSearchChild(void);
// Operate as child device; search for parent device
void rfu_REQ_startSearchParent(void);
void rfu_REQ_pollSearchParent(void);
void rfu_REQ_endSearchParent(void);
void rfu_REQ_startConnectParent(u16);
// Operate as child device; connect to specified parent device
void rfu_REQ_startConnectParent(u16 pid);
void rfu_REQ_pollConnectParent(void);
void rfu_REQ_endConnectParent(void);
void rfu_REQ_CHILD_startConnectRecovery(u8);
u16 rfu_getConnectParentStatus(u8 *status,u8 *connectSlotNo);
// Restore link from child device
void rfu_REQ_CHILD_startConnectRecovery(u8 bmRecoverySlot);
void rfu_REQ_CHILD_pollConnectRecovery(void);
void rfu_REQ_CHILD_endConnectRecovery(void);
u16 rfu_CHILD_getConnectRecoveryStatus(u8 *status);
// RFU Link Management
// Link Monitoring
u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason, u8 *parentBmLinkRecoverySlot);
// Link Disconnect
void rfu_REQ_disconnect(u8 bmDisconnectSlot);
// Relation of clock between AGB and RFU
// Switch to AGB clock slave
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);
// Acquire either the master or slave clock from the current AGB-RFU
bool8 rfu_getMasterSlave(void);
// Communication Configuration
// MSC Callback Configuration
void rfu_setMSCCallback(void (*callback)(u16 reqCommandId));
// Shared by NI- and UNI-type communications
// Clear Communication Status
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);
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);
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);
u16 rfu_clearSlot(u8 connTypeFlag, u8 slotStatusIndex);
// Set Receive Buffer
u16 rfu_setRecvBuffer(u8 connType, u8 slotNo, void *buffer, u32 buffSize);
// Receive/Send Data
// UNI-type communication
// Set transmission data
u16 rfu_UNI_setSendData(u8 bmSendSlot, const void *src, u8 size);
// Enable transmission data
void rfu_UNI_readySendData(u8 slotStatusIndex);
// Change address or size of transmission data and enable transmission data
u16 rfu_UNI_changeAndReadySendData(u8 slotStatusIndex, const void *src, u8 size);
// Used only by parent device. At the beginning of a MSC Callback that received notification that the data transmission completed, an ACK flag is obtained.
u16 rfu_UNI_PARENT_getDRAC_ACK(u8 *ackFlag);
// Clear the flag that indicates newly arrived reception data
void rfu_UNI_clearRecvNewDataFlag(u8 slotStatusIndex);
// NI-type Communication
// Set transmission data
u16 rfu_NI_setSendData(u8 bmSendSlot, u8 subFrameSize, const void *src, u32 size);
// Used only by child device. After establishing connection at the RFU level, configure transmission of child device game identification information in order to authenticate connection
u16 rfu_NI_CHILD_setSendGameName(u8 slotNo, u8 subFrameSize);
// Stop the NI data currently being received
u16 rfu_NI_stopReceivingData(u8 slotStatusIndex);
// Shared by NI- and UNI-type communications
// Narrow transmission targets for transmission data.
u16 rfu_changeSendTarget(u8 connType, u8 slotStatusIndex, u8 bmNewTgtSlot);
// Functions for sending/receiving data to RFU
// Data transmission
void rfu_REQ_sendData(u8 clockChangeFlag);
// Used only by parent device. Resend previous sent data (packet)
void rfu_REQ_PARENT_resumeRetransmitAndChange(void);
void rfu_NI_setSendData(u8, u8, const void *, u32);
// Read receive data
void rfu_REQ_recvData(void);
// For Multi-boot
// Inherits the information about the link established by the downloader just after the program downloaded with multiboot starts up.
u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void);
// For Debug
// Obtain address of the SWTI-layer receive buffer
struct RfuIntrStruct *rfu_getSTWIRecvBuffer(void);
// Obtain RFU state
void rfu_REQ_RFUStatus(void);
u16 rfu_getRFUStatus(u8 *rfuState);
// Using RFU, generate noise (jamming radio waves) for other RFUs
void rfu_REQ_noise(void);
// librfu_intr
void IntrSIO32(void);
// librfu_stwi
void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam);
void STWI_set_MS_mode(u8 mode);
void STWI_init_Callback_M(void);
void STWI_init_Callback_S(void);
void STWI_set_Callback_M(void *callbackM);
void STWI_set_Callback_S(void (*callbackS)(u16));
void STWI_init_timer(IntrFunc *interrupt, s32 timerSelect);
void AgbRFU_SoftReset(void);
void STWI_set_Callback_ID(void (*func)(void));
u16 STWI_read_status(u8 index);
u16 STWI_poll_CommandEnd(void);
void STWI_send_DataRxREQ(void);
void STWI_send_MS_ChangeREQ(void);
void STWI_send_StopModeREQ(void);
void STWI_send_SystemStatusREQ(void);
void STWI_send_GameConfigREQ(const u8 *unk1, const u8 *data);
void STWI_send_ResetREQ(void);
void STWI_send_LinkStatusREQ(void);
void STWI_send_VersionStatusREQ(void);
void STWI_send_SlotStatusREQ(void);
void STWI_send_ConfigStatusREQ(void);
void STWI_send_ResumeRetransmitAndChangeREQ(void);
void STWI_send_SystemConfigREQ(u16 unk1, u8 unk2, u8 unk3);
void STWI_send_SC_StartREQ(void);
void STWI_send_SC_PollingREQ(void);
void STWI_send_SC_EndREQ(void);
void STWI_send_SP_StartREQ(void);
void STWI_send_SP_PollingREQ(void);
void STWI_send_SP_EndREQ(void);
void STWI_send_CP_StartREQ(u16 unk1);
void STWI_send_CP_PollingREQ(void);
void STWI_send_CP_EndREQ(void);
void STWI_send_DataTxREQ(const void *in, u8 size);
void STWI_send_DataTxAndChangeREQ(const void *in, u8 size);
void STWI_send_DataReadyAndChangeREQ(u8 unk);
void STWI_send_DisconnectedAndChangeREQ(u8 unk0, u8 unk1);
void STWI_send_DisconnectREQ(u8 unk);
void STWI_send_TestModeREQ(u8 unk0, u8 unk1);
void STWI_send_CPR_StartREQ(u16 unk0, u16 unk1, u8 unk2);
void STWI_send_CPR_PollingREQ(void);
void STWI_send_CPR_EndREQ(void);
#endif // GUARD_LIBRFU_H
+5 -3
View File
@@ -317,9 +317,10 @@ SECTIONS {
src/agb_flash_1m.o(.text);
src/agb_flash_mx.o(.text);
src/agb_flash_le.o(.text);
asm/librfu_stwi.o(.text);
src/librfu_stwi.o(.text);
asm/librfu_intr.o(.text);
asm/librfu.o(.text);
src/librfu_rfu.o(.text);
src/librfu_s32id.o(.text);
src/isagbprn.o(.text);
asm/libagbsyscall.o(.text);
*libgcc.a:_call_via_rX.o(.text);
@@ -939,7 +940,8 @@ SECTIONS {
src/agb_flash_1m.o(.rodata);
src/agb_flash_mx.o(.rodata);
src/agb_flash_le.o(.rodata);
data/librfu_rodata.o(.rodata);
src/librfu_rfu.o(.rodata);
src/librfu_s32id.o(.rodata);
src/isagbprn.o(.rodata);
*libgcc.a:_divdi3.o(.rodata);
*libgcc.a:_udivdi3.o(.rodata);
+1 -1
View File
@@ -74,7 +74,7 @@ u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void))
return 1;
sTimerNum = timerNum;
sTimerReg = &REG_TMCNT(sTimerNum);
sTimerReg = &REG_TMCNT_L(sTimerNum);
*intrFunc = FlashTimerIntr;
return 0;
}
+2222
View File
File diff suppressed because it is too large Load Diff
+164
View File
@@ -0,0 +1,164 @@
#include "librfu.h"
static void Sio32IDIntr(void);
static void Sio32IDInit(void);
static s32 Sio32IDMain(void);
struct RfuS32Id gRfuS32Id;
static const u16 Sio32ConnectionData[] = { 0x494e, 0x544e, 0x4e45, 0x4f44 }; // NINTENDO
static const char Sio32IDLib_Var[] = "Sio32ID_030820";
s32 AgbRFU_checkID(u8 r5)
{
u16 r8;
vu16 *r4;
s32 r6;
if (REG_IME == 0)
return -1;
r8 = REG_IE;
gSTWIStatus->state = 10;
STWI_set_Callback_ID(Sio32IDIntr);
Sio32IDInit();
r4 = &REG_TMCNT_L(gSTWIStatus->timerSelect);
r5 *= 8;
while (--r5 != 0xFF)
{
r6 = Sio32IDMain();
if (r6 != 0)
break;
r4[1] = 0;
r4[0] = 0;
r4[1] = TIMER_1024CLK | TIMER_ENABLE;
while (r4[0] < 32)
;
r4[1] = 0;
r4[0] = 0;
}
REG_IME = 0;
REG_IE = r8;
REG_IME = 1;
gSTWIStatus->state = 0;
STWI_set_Callback_ID(NULL);
return r6;
}
static void Sio32IDInit(void)
{
REG_IME = 0;
REG_IE &= ~((8 << gSTWIStatus->timerSelect) | INTR_FLAG_SERIAL);
REG_IME = 1;
REG_RCNT = 0;
REG_SIOCNT = SIO_32BIT_MODE;
REG_SIOCNT |= SIO_INTR_ENABLE | SIO_ENABLE;
CpuFill32(0, &gRfuS32Id, sizeof(struct RfuS32Id));
REG_IF = INTR_FLAG_SERIAL;
}
static s32 Sio32IDMain(void)
{
u8 r12;
switch (r12 = gRfuS32Id.unk1)
{
case 0:
gRfuS32Id.unk0 = 1;
REG_SIOCNT |= SIO_38400_BPS;
REG_IME = r12;
REG_IE |= INTR_FLAG_SERIAL;
REG_IME = 1;
gRfuS32Id.unk1 = 1;
*(vu8 *)&REG_SIOCNT |= SIO_ENABLE;
break;
case 1:
if (gRfuS32Id.unkA == 0)
{
if (gRfuS32Id.unk0 == 1)
{
if (gRfuS32Id.unk2 == 0)
{
REG_IME = gRfuS32Id.unk2;
REG_SIOCNT |= SIO_ENABLE;
REG_IME = r12;
}
}
else if (gRfuS32Id.unk4 != 0x8001 && !gRfuS32Id.unk2)
{
REG_IME = gRfuS32Id.unk2;
REG_IE &= ~INTR_FLAG_SERIAL;
REG_IME = r12;
REG_SIOCNT = gRfuS32Id.unk2;
REG_SIOCNT = SIO_32BIT_MODE;
REG_IF = INTR_FLAG_SERIAL;
REG_SIOCNT |= SIO_INTR_ENABLE | SIO_ENABLE;
REG_IME = gRfuS32Id.unk2;
REG_IE |= INTR_FLAG_SERIAL;
REG_IME = r12;
}
break;
}
else
{
gRfuS32Id.unk1 = 2;
// fallthrough
}
default:
return gRfuS32Id.unkA;
}
return 0;
}
static void Sio32IDIntr(void)
{
u32 r5;
u16 r0;
#ifndef NONMATCHING
register u32 r1 asm("r1");
register u16 r0_ asm("r0");
#else
u32 r1;
u16 r0_;
#endif
r5 = REG_SIODATA32;
if (gRfuS32Id.unk0 != 1)
REG_SIOCNT |= SIO_ENABLE;
r1 = 16 * gRfuS32Id.unk0; // to handle side effect of inline asm
r1 = (r5 << r1) >> 16;
r5 = (r5 << 16 * (1 - gRfuS32Id.unk0)) >> 16;
if (gRfuS32Id.unkA == 0)
{
if (r1 == gRfuS32Id.unk6)
{
if (gRfuS32Id.unk2 > 3)
{
gRfuS32Id.unkA = r5;
}
else if (r1 == (u16)~gRfuS32Id.unk4)
{
r0_ = ~gRfuS32Id.unk6;
if (r5 == r0_)
++gRfuS32Id.unk2;
}
}
else
{
gRfuS32Id.unk2 = gRfuS32Id.unkA;
}
}
if (gRfuS32Id.unk2 < 4)
gRfuS32Id.unk4 = *(gRfuS32Id.unk2 + Sio32ConnectionData);
else
gRfuS32Id.unk4 = 0x8001;
gRfuS32Id.unk6 = ~r5;
REG_SIODATA32 = (gRfuS32Id.unk4 << 16 * (1 - gRfuS32Id.unk0))
+ (gRfuS32Id.unk6 << 16 * gRfuS32Id.unk0);
if (gRfuS32Id.unk0 == 1 && (gRfuS32Id.unk2 || r5 == 0x494E))
{
for (r0 = 0; r0 < 600; ++r0)
;
if (gRfuS32Id.unkA == 0)
REG_SIOCNT |= SIO_ENABLE;
}
}
+647
View File
@@ -0,0 +1,647 @@
#include "librfu.h"
static void STWI_intr_timer(void);
static u16 STWI_init(u8 request);
static s32 STWI_start_Command(void);
static void STWI_set_timer(u8 unk);
static void STWI_stop_timer(void);
static s32 STWI_restart_Command(void);
static s32 STWI_reset_ClockCounter(void);
struct STWIStatus *gSTWIStatus;
void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam)
{
// If we're copying our interrupt into RAM, DMA it to block1 and use
// block2 for our STWIStatus, otherwise block1 holds the STWIStatus.
// interrupt usually is a pointer to gIntrTable[1]
if (copyInterruptToRam == TRUE)
{
*interrupt = (IntrFunc)interruptStruct->block1;
DmaCopy16(3, &IntrSIO32, interruptStruct->block1, sizeof(interruptStruct->block1));
gSTWIStatus = &interruptStruct->block2;
}
else
{
*interrupt = IntrSIO32;
gSTWIStatus = (struct STWIStatus *)interruptStruct->block1;
}
gSTWIStatus->rxPacket = &interruptStruct->rxPacketAlloc;
gSTWIStatus->txPacket = &interruptStruct->txPacketAlloc;
gSTWIStatus->msMode = 1;
gSTWIStatus->state = 0;
gSTWIStatus->reqLength = 0;
gSTWIStatus->reqNext = 0;
gSTWIStatus->ackLength = 0;
gSTWIStatus->ackNext = 0;
gSTWIStatus->ackActiveCommand = 0;
gSTWIStatus->timerState = 0;
gSTWIStatus->timerActive = 0;
gSTWIStatus->error = 0;
gSTWIStatus->recoveryCount = 0;
gSTWIStatus->unk_2c = 0;
REG_RCNT = 0x100; // TODO: mystery bit?
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
STWI_init_Callback_M();
STWI_init_Callback_S();
IntrEnable(INTR_FLAG_SERIAL);
}
void STWI_init_timer(IntrFunc *interrupt, s32 timerSelect)
{
*interrupt = STWI_intr_timer;
gSTWIStatus->timerSelect = timerSelect;
IntrEnable(INTR_FLAG_TIMER0 << gSTWIStatus->timerSelect);
}
void AgbRFU_SoftReset(void)
{
vu16 *timerL;
vu16 *timerH;
REG_RCNT = 0x8000;
REG_RCNT = 0x80A0; // all these bits are undocumented
timerL = &REG_TMCNT_L(gSTWIStatus->timerSelect);
timerH = &REG_TMCNT_H(gSTWIStatus->timerSelect);
*timerH = 0;
*timerL = 0;
*timerH = TIMER_ENABLE | TIMER_1024CLK;
while (*timerL <= 0x11)
REG_RCNT = 0x80A2;
*timerH = 3;
REG_RCNT = 0x80A0;
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
gSTWIStatus->state = 0;
gSTWIStatus->reqLength = 0;
gSTWIStatus->reqNext = 0;
gSTWIStatus->reqActiveCommand = 0;
gSTWIStatus->ackLength = 0;
gSTWIStatus->ackNext = 0;
gSTWIStatus->ackActiveCommand = 0;
gSTWIStatus->timerState = 0;
gSTWIStatus->timerActive = 0;
gSTWIStatus->error = 0;
gSTWIStatus->msMode = 1;
gSTWIStatus->recoveryCount = 0;
gSTWIStatus->unk_2c = 0;
}
void STWI_set_MS_mode(u8 mode)
{
gSTWIStatus->msMode = mode;
}
u16 STWI_read_status(u8 index)
{
switch (index)
{
case 0:
return gSTWIStatus->error;
case 1:
return gSTWIStatus->msMode;
case 2:
return gSTWIStatus->state;
case 3:
return gSTWIStatus->reqActiveCommand;
default:
return 0xFFFF;
}
}
void STWI_init_Callback_M(void)
{
STWI_set_Callback_M(NULL);
}
void STWI_init_Callback_S(void)
{
STWI_set_Callback_S(NULL);
}
// The callback can take 2 or 3 arguments.
void STWI_set_Callback_M(void *callbackM)
{
gSTWIStatus->callbackM = callbackM;
}
void STWI_set_Callback_S(void (*callbackS)(u16))
{
gSTWIStatus->callbackS = callbackS;
}
void STWI_set_Callback_ID(void (*func)(void)) // name in SDK, but is actually setting a function pointer
{
gSTWIStatus->unk_20 = func;
}
u16 STWI_poll_CommandEnd(void)
{
while (gSTWIStatus->unk_2c == TRUE)
;
return gSTWIStatus->error;
}
void STWI_send_ResetREQ(void)
{
if (!STWI_init(ID_RESET_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_LinkStatusREQ(void)
{
if (!STWI_init(ID_LINK_STATUS_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_VersionStatusREQ(void)
{
if (!STWI_init(ID_VERSION_STATUS_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_SystemStatusREQ(void)
{
if (!STWI_init(ID_SYSTEM_STATUS_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_SlotStatusREQ(void)
{
if (!STWI_init(ID_SLOT_STATUS_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_ConfigStatusREQ(void)
{
if (!STWI_init(ID_CONFIG_STATUS_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_GameConfigREQ(const u8 *unk1, const u8 *data)
{
u8 *packetBytes;
s32 i;
if (!STWI_init(ID_GAME_CONFIG_REQ))
{
gSTWIStatus->reqLength = 6;
// TODO: what is unk1
packetBytes = gSTWIStatus->txPacket->rfuPacket8.data;
packetBytes += sizeof(u32);
*(u16 *)packetBytes = *(u16 *)unk1;
packetBytes += sizeof(u16);
unk1 += sizeof(u16);
for (i = 0; i < 14; ++i)
{
*packetBytes = *unk1;
++packetBytes;
++unk1;
}
for (i = 0; i < 8; ++i)
{
*packetBytes = *data;
++packetBytes;
++data;
}
STWI_start_Command();
}
}
void STWI_send_SystemConfigREQ(u16 unk1, u8 unk2, u8 unk3)
{
if (!STWI_init(ID_SYSTEM_CONFIG_REQ))
{
u8 *packetBytes;
gSTWIStatus->reqLength = 1;
packetBytes = gSTWIStatus->txPacket->rfuPacket8.data;
packetBytes += sizeof(u32);
*packetBytes++ = unk3;
*packetBytes++ = unk2;
*(u16*)packetBytes = unk1;
STWI_start_Command();
}
}
void STWI_send_SC_StartREQ(void)
{
if (!STWI_init(ID_SC_START_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_SC_PollingREQ(void)
{
if (!STWI_init(ID_SC_POLL_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_SC_EndREQ(void)
{
if (!STWI_init(ID_SC_END_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_SP_StartREQ(void)
{
if (!STWI_init(ID_SP_START_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_SP_PollingREQ(void)
{
if (!STWI_init(ID_SP_POLL_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_SP_EndREQ(void)
{
if (!STWI_init(ID_SP_END_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_CP_StartREQ(u16 unk1)
{
if (!STWI_init(ID_CP_START_REQ))
{
gSTWIStatus->reqLength = 1;
gSTWIStatus->txPacket->rfuPacket32.data[0] = unk1;
STWI_start_Command();
}
}
void STWI_send_CP_PollingREQ(void)
{
if (!STWI_init(ID_CP_POLL_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_CP_EndREQ(void)
{
if (!STWI_init(ID_CP_END_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_DataTxREQ(const void *in, u8 size)
{
if (!STWI_init(ID_DATA_TX_REQ))
{
u8 reqLength = (size / sizeof(u32));
if (size & (sizeof(u32) - 1))
reqLength += 1;
gSTWIStatus->reqLength = reqLength;
CpuCopy32(in, gSTWIStatus->txPacket->rfuPacket32.data, gSTWIStatus->reqLength * sizeof(u32));
STWI_start_Command();
}
}
void STWI_send_DataTxAndChangeREQ(const void *in, u8 size)
{
if (!STWI_init(ID_DATA_TX_AND_CHANGE_REQ))
{
u8 reqLength = (size / sizeof(u32));
if (size & (sizeof(u32) - 1))
reqLength += 1;
gSTWIStatus->reqLength = reqLength;
CpuCopy32(in, gSTWIStatus->txPacket->rfuPacket32.data, gSTWIStatus->reqLength * sizeof(u32));
STWI_start_Command();
}
}
void STWI_send_DataRxREQ(void)
{
if (!STWI_init(ID_DATA_RX_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_MS_ChangeREQ(void)
{
if (!STWI_init(ID_MS_CHANGE_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_DataReadyAndChangeREQ(u8 unk)
{
if (!STWI_init(ID_DATA_READY_AND_CHANGE_REQ))
{
if (!unk)
{
gSTWIStatus->reqLength = 0;
}
else
{
u8 *packetBytes;
gSTWIStatus->reqLength = 1;
packetBytes = gSTWIStatus->txPacket->rfuPacket8.data;
packetBytes += sizeof(u32);
*packetBytes++ = unk;
*packetBytes++ = 0;
*packetBytes++ = 0;
*packetBytes = 0;
}
STWI_start_Command();
}
}
void STWI_send_DisconnectedAndChangeREQ(u8 unk0, u8 unk1)
{
if (!STWI_init(ID_DISCONNECTED_AND_CHANGE_REQ))
{
u8 *packetBytes;
gSTWIStatus->reqLength = 1;
packetBytes = gSTWIStatus->txPacket->rfuPacket8.data;
packetBytes += sizeof(u32);
*packetBytes++ = unk0;
*packetBytes++ = unk1;
*packetBytes++ = 0;
*packetBytes = 0;
STWI_start_Command();
}
}
void STWI_send_ResumeRetransmitAndChangeREQ(void)
{
if (!STWI_init(ID_RESUME_RETRANSMIT_AND_CHANGE_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_DisconnectREQ(u8 unk)
{
if (!STWI_init(ID_DISCONNECT_REQ))
{
gSTWIStatus->reqLength = 1;
gSTWIStatus->txPacket->rfuPacket32.data[0] = unk;
STWI_start_Command();
}
}
void STWI_send_TestModeREQ(u8 unk0, u8 unk1)
{
if (!STWI_init(ID_TEST_MODE_REQ))
{
gSTWIStatus->reqLength = 1;
gSTWIStatus->txPacket->rfuPacket32.data[0] = unk0 | (unk1 << 8);
STWI_start_Command();
}
}
void STWI_send_CPR_StartREQ(u16 unk0, u16 unk1, u8 unk2)
{
u32 *packetData;
u32 arg1;
if (!STWI_init(ID_CPR_START_REQ))
{
gSTWIStatus->reqLength = 2;
arg1 = unk1 | (unk0 << 16);
packetData = gSTWIStatus->txPacket->rfuPacket32.data;
packetData[0] = arg1;
packetData[1] = unk2;
STWI_start_Command();
}
}
void STWI_send_CPR_PollingREQ(void)
{
if (!STWI_init(ID_CPR_POLL_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_CPR_EndREQ(void)
{
if (!STWI_init(ID_CPR_END_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
void STWI_send_StopModeREQ(void)
{
if (!STWI_init(ID_STOP_MODE_REQ))
{
gSTWIStatus->reqLength = 0;
STWI_start_Command();
}
}
static void STWI_intr_timer(void)
{
switch (gSTWIStatus->timerState)
{
// TODO: Make an enum for these
case 2:
gSTWIStatus->timerActive = 1;
STWI_set_timer(50);
break;
case 1:
case 4:
STWI_stop_timer();
STWI_restart_Command();
break;
case 3:
gSTWIStatus->timerActive = 1;
STWI_stop_timer();
STWI_reset_ClockCounter();
if (gSTWIStatus->callbackM != NULL)
gSTWIStatus->callbackM(255, 0);
break;
}
}
static void STWI_set_timer(u8 unk)
{
vu16 *timerL;
vu16 *timerH;
timerL = &REG_TMCNT_L(gSTWIStatus->timerSelect);
timerH = &REG_TMCNT_H(gSTWIStatus->timerSelect);
REG_IME = 0;
switch (unk)
{
case 50:
*timerL = 0xFCCB;
gSTWIStatus->timerState = 1;
break;
case 80:
*timerL = 0xFAE0;
gSTWIStatus->timerState = 2;
break;
case 100:
*timerL = 0xF996;
gSTWIStatus->timerState = 3;
break;
case 130:
*timerL = 0xF7AD;
gSTWIStatus->timerState = 4;
break;
}
*timerH = TIMER_ENABLE | TIMER_INTR_ENABLE | TIMER_1024CLK;
REG_IF = INTR_FLAG_TIMER0 << gSTWIStatus->timerSelect;
REG_IME = 1;
}
static void STWI_stop_timer(void)
{
gSTWIStatus->timerState = 0;
REG_TMCNT_L(gSTWIStatus->timerSelect) = 0;
REG_TMCNT_H(gSTWIStatus->timerSelect) = 0;
}
static u16 STWI_init(u8 request)
{
if (!REG_IME)
{
gSTWIStatus->error = ERR_REQ_CMD_IME_DISABLE;
if (gSTWIStatus->callbackM != NULL)
gSTWIStatus->callbackM(request, gSTWIStatus->error);
return TRUE;
}
else if (gSTWIStatus->unk_2c == TRUE)
{
gSTWIStatus->error = ERR_REQ_CMD_SENDING;
gSTWIStatus->unk_2c = FALSE;
if (gSTWIStatus->callbackM != NULL)
gSTWIStatus->callbackM(request, gSTWIStatus->error);
return TRUE;
}
else if(!gSTWIStatus->msMode)
{
gSTWIStatus->error = ERR_REQ_CMD_CLOCK_SLAVE;
if (gSTWIStatus->callbackM != NULL)
gSTWIStatus->callbackM(request, gSTWIStatus->error, gSTWIStatus);
return TRUE;
}
else
{
gSTWIStatus->unk_2c = TRUE;
gSTWIStatus->reqActiveCommand = request;
gSTWIStatus->state = 0;
gSTWIStatus->reqLength = 0;
gSTWIStatus->reqNext = 0;
gSTWIStatus->ackLength = 0;
gSTWIStatus->ackNext = 0;
gSTWIStatus->ackActiveCommand = 0;
gSTWIStatus->timerState = 0;
gSTWIStatus->timerActive = 0;
gSTWIStatus->error = 0;
gSTWIStatus->recoveryCount = 0;
REG_RCNT = 0x100;
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
return FALSE;
}
}
static s32 STWI_start_Command(void)
{
u16 imeTemp;
// equivalent to gSTWIStatus->txPacket->rfuPacket32.command,
// but the cast here is required to avoid register issue
*(u32 *)gSTWIStatus->txPacket->rfuPacket8.data = 0x99660000 | (gSTWIStatus->reqLength << 8) | gSTWIStatus->reqActiveCommand;
REG_SIODATA32 = gSTWIStatus->txPacket->rfuPacket32.command;
gSTWIStatus->state = 0;
gSTWIStatus->reqNext = 1;
imeTemp = REG_IME;
REG_IME = 0;
REG_IE |= (INTR_FLAG_TIMER0 << gSTWIStatus->timerSelect);
REG_IE |= INTR_FLAG_SERIAL;
REG_IME = imeTemp;
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_MULTI_BUSY | SIO_115200_BPS;
return 0;
}
static s32 STWI_restart_Command(void)
{
if (gSTWIStatus->recoveryCount <= 1)
{
++gSTWIStatus->recoveryCount;
STWI_start_Command();
}
else
{
if (gSTWIStatus->reqActiveCommand == ID_MS_CHANGE_REQ || gSTWIStatus->reqActiveCommand == ID_DATA_TX_AND_CHANGE_REQ || gSTWIStatus->reqActiveCommand == ID_UNK35_REQ || gSTWIStatus->reqActiveCommand == ID_RESUME_RETRANSMIT_AND_CHANGE_REQ)
{
gSTWIStatus->error = ERR_REQ_CMD_CLOCK_DRIFT;
gSTWIStatus->unk_2c = 0;
if (gSTWIStatus->callbackM != NULL)
gSTWIStatus->callbackM(gSTWIStatus->reqActiveCommand, gSTWIStatus->error);
}
else
{
gSTWIStatus->error = ERR_REQ_CMD_CLOCK_DRIFT;
gSTWIStatus->unk_2c = 0;
if (gSTWIStatus->callbackM != NULL)
gSTWIStatus->callbackM(gSTWIStatus->reqActiveCommand, gSTWIStatus->error);
gSTWIStatus->state = 4; // TODO: what's 4
}
}
return 0;
}
static s32 STWI_reset_ClockCounter(void)
{
gSTWIStatus->state = 5; // TODO: what is 5
gSTWIStatus->reqLength = 0;
gSTWIStatus->reqNext = 0;
REG_SIODATA32 = (1 << 31);
REG_SIOCNT = 0;
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
REG_SIOCNT = (SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS) + 0x7F;
return 0;
}
+5 -5
View File
@@ -2765,10 +2765,10 @@ static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet)
int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 species1, u16 species2, u8 type, u16 species3, u8 isObedientBitSet)
{
u8 r9 = a0.unk_01_0;
u8 r4 = a0.unk_00_7;
u8 r10 = a1.unk_01_0;
u8 r0 = a1.unk_00_7;
u8 r9 = a0.hasNationalDex;
u8 r4 = a0.isChampion;
u8 r10 = a1.hasNationalDex;
u8 r0 = a1.isChampion;
u8 r1 = a1.unk_01_2;
u8 r2;
@@ -2845,7 +2845,7 @@ int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, str
int CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct a0, u16 species, u16 a2, u8 a3)
{
u8 canTradeEggAndNational = a0.unk_01_0;
u8 canTradeEggAndNational = a0.hasNationalDex;
if (IsDeoxysOrMewUntradable(a2, a3))
{
+1 -1
View File
@@ -74,7 +74,7 @@ gUnknown_3000FE8: @ 3000FE8
gUnknown_3001188: @ 3001188
.space 0x8
gUnknown_3001190: @ 3001190
gRfuAPIBuffer: @ 3001190
.space 0xE68
gUnknown_3001FF8: @ 3001FF8
+6 -21
View File
@@ -159,24 +159,9 @@ gUnknown_3005E94: @ 3005E94
.include "berry_fix_program.o"
.include "m4a.o"
.include "agb_flash.o"
gRfuState: @ 3007438
.space 0x8
gUnknown_3007440: @ 3007440
.space 0x10
gUnknown_3007450: @ 3007450
.space 0x10
gUnknown_3007460: @ 3007460
.space 0x4
gUnknown_3007464: @ 3007464
.space 0x4
gUnknown_3007468: @ 3007468
.space 0x8
gUnknown_3007470: @ 3007470
.space 0xC
.align 2
.include "librfu_stwi.o"
.align 4
.include "librfu_rfu.o"
.align 4
.include "librfu_s32id.o"