mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
sub_800C12C
This commit is contained in:
parent
728532be77
commit
bd30e5aa24
117
asm/link_rfu.s
117
asm/link_rfu.s
@ -5,123 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_800C12C
|
||||
sub_800C12C: @ 800C12C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
lsls r0, 16
|
||||
lsrs r6, r0, 16
|
||||
lsls r1, 16
|
||||
lsrs r1, 16
|
||||
mov r8, r1
|
||||
ldr r1, =gUnknown_03004140
|
||||
ldrb r0, [r1, 0x4]
|
||||
cmp r0, 0
|
||||
beq _0800C164
|
||||
subs r0, 0x9
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x2
|
||||
bls _0800C164
|
||||
movs r0, 0x1
|
||||
strh r0, [r1, 0x14]
|
||||
movs r0, 0xF3
|
||||
movs r1, 0x1
|
||||
bl sub_800D30C
|
||||
movs r0, 0x1
|
||||
b _0800C204
|
||||
.pool
|
||||
_0800C164:
|
||||
bl rfu_getMasterSlave
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0800C184
|
||||
ldr r1, =gUnknown_03004140
|
||||
movs r0, 0x2
|
||||
strh r0, [r1, 0x14]
|
||||
movs r0, 0xF3
|
||||
movs r1, 0x1
|
||||
bl sub_800D30C
|
||||
movs r0, 0x2
|
||||
b _0800C204
|
||||
.pool
|
||||
_0800C184:
|
||||
movs r2, 0
|
||||
ldr r0, =gUnknown_03007890
|
||||
ldr r1, [r0]
|
||||
ldrb r3, [r1, 0x8]
|
||||
ldr r5, =gUnknown_03004140
|
||||
adds r7, r0, 0
|
||||
cmp r2, r3
|
||||
bcs _0800C1B2
|
||||
ldrh r0, [r1, 0x14]
|
||||
cmp r0, r6
|
||||
beq _0800C1B2
|
||||
adds r4, r1, 0
|
||||
adds r1, r3, 0
|
||||
_0800C19E:
|
||||
adds r0, r2, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
cmp r2, r1
|
||||
bcs _0800C1B2
|
||||
lsls r0, r2, 5
|
||||
adds r0, r4, r0
|
||||
ldrh r0, [r0, 0x14]
|
||||
cmp r0, r6
|
||||
bne _0800C19E
|
||||
_0800C1B2:
|
||||
ldr r0, [r7]
|
||||
ldrb r0, [r0, 0x8]
|
||||
cmp r0, 0
|
||||
beq _0800C1BE
|
||||
cmp r2, r0
|
||||
bne _0800C1D8
|
||||
_0800C1BE:
|
||||
movs r0, 0x3
|
||||
strh r0, [r5, 0x14]
|
||||
movs r0, 0xF3
|
||||
movs r1, 0x1
|
||||
bl sub_800D30C
|
||||
movs r0, 0x3
|
||||
b _0800C204
|
||||
.pool
|
||||
_0800C1D8:
|
||||
ldrb r0, [r5, 0x4]
|
||||
cmp r0, 0
|
||||
beq _0800C1E2
|
||||
cmp r0, 0x9
|
||||
bne _0800C1EA
|
||||
_0800C1E2:
|
||||
movs r0, 0xC
|
||||
strb r0, [r5, 0x4]
|
||||
movs r0, 0xD
|
||||
b _0800C1F0
|
||||
_0800C1EA:
|
||||
movs r0, 0xB
|
||||
strb r0, [r5, 0x4]
|
||||
movs r0, 0xC
|
||||
_0800C1F0:
|
||||
strb r0, [r5, 0x5]
|
||||
strh r6, [r5, 0x1E]
|
||||
mov r0, r8
|
||||
strh r0, [r5, 0x1A]
|
||||
ldrb r0, [r5, 0x7]
|
||||
cmp r0, 0
|
||||
beq _0800C202
|
||||
movs r0, 0x7
|
||||
strb r0, [r5, 0x7]
|
||||
_0800C202:
|
||||
movs r0, 0
|
||||
_0800C204:
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800C12C
|
||||
|
||||
thumb_func_start sub_800C210
|
||||
sub_800C210: @ 800C210
|
||||
push {r4-r7,lr}
|
||||
|
@ -130,6 +130,13 @@ struct RfuUnk3
|
||||
struct RfuUnk5
|
||||
{
|
||||
u8 unk_00;
|
||||
u8 filler_01[2];
|
||||
u8 unk_03;
|
||||
u8 filler_04[4];
|
||||
u8 unk_08;
|
||||
u8 filler_09[11];
|
||||
u16 unk_14;
|
||||
u8 filler_16[10];
|
||||
};
|
||||
|
||||
extern struct RfuStruct *gRfuState;
|
||||
|
@ -53,7 +53,8 @@ struct UnkRfuStruct_1 {
|
||||
u8 filler_16[2];
|
||||
u16 unk_18;
|
||||
u16 unk_1a;
|
||||
u8 filler_1c[4];
|
||||
u8 filler_1c[2];
|
||||
u16 unk_1e;
|
||||
u16 *unk_20;
|
||||
u8 unk_24;
|
||||
u16 unk_26;
|
||||
|
@ -3,14 +3,6 @@
|
||||
|
||||
#include "librfu.h"
|
||||
|
||||
extern struct RfuUnk5 *gUnknown_03007890;
|
||||
extern u32 *gUnknown_03007894;
|
||||
extern struct RfuUnk3* gUnknown_03007898;
|
||||
extern struct RfuUnk2* gUnknown_03007880[4];
|
||||
extern struct RfuUnk1* gUnknown_03007870[4];
|
||||
extern void* sub_82E53F4;
|
||||
extern void rfu_STC_clearAPIVariables(void);
|
||||
|
||||
// Nonmatching, only register differences
|
||||
/*u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterruptToRam)
|
||||
{
|
||||
|
@ -191,3 +191,53 @@ u8 sub_800C054(u8 r5, u16 r7, u16 r8, u16 *r6)
|
||||
gUnknown_03004140.unk_20 = r6;
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 sub_800C12C(u16 r6, u16 r8)
|
||||
{
|
||||
u8 i;
|
||||
struct RfuUnk5 *tmp;
|
||||
|
||||
if (gUnknown_03004140.unk_04 != 0 && (gUnknown_03004140.unk_04 < 9 || gUnknown_03004140.unk_04 > 11))
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 1;
|
||||
sub_800D30C(0xF3, 0x01);
|
||||
return 1;
|
||||
}
|
||||
if (!rfu_getMasterSlave())
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 2;
|
||||
sub_800D30C(0xF3, 0x01);
|
||||
return 2;
|
||||
}
|
||||
for (i = 0; i < gUnknown_03007890->unk_08; i ++)
|
||||
{
|
||||
tmp = &gUnknown_03007890[i];
|
||||
if (tmp->unk_14 == r6)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gUnknown_03007890->unk_08 == 0 || i == gUnknown_03007890->unk_08)
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 3;
|
||||
sub_800D30C(0xF3, 0x01);
|
||||
return 3;
|
||||
}
|
||||
if (gUnknown_03004140.unk_04 == 0 || gUnknown_03004140.unk_04 == 9)
|
||||
{
|
||||
gUnknown_03004140.unk_04 = 12;
|
||||
gUnknown_03004140.unk_05 = 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03004140.unk_04 = 11;
|
||||
gUnknown_03004140.unk_05 = 12;
|
||||
}
|
||||
gUnknown_03004140.unk_1e = r6;
|
||||
gUnknown_03004140.unk_1a = r8;
|
||||
if (gUnknown_03004140.unk_07 != 0)
|
||||
{
|
||||
gUnknown_03004140.unk_07 = 7;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user