sub_800D158

This commit is contained in:
PikalaxALT 2017-11-29 08:46:16 -05:00
parent 3f00d341d5
commit 295e45c788
3 changed files with 38 additions and 90 deletions

View File

@ -5,92 +5,6 @@
.text
thumb_func_start sub_800D158
sub_800D158: @ 800D158
push {r4-r6,lr}
ldr r1, =0x04000208
ldrh r0, [r1]
adds r6, r0, 0
movs r0, 0
strh r0, [r1]
ldr r4, =gUnknown_03004140
ldrb r0, [r4, 0x4]
cmp r0, 0xF
bne _0800D1BC
ldrb r1, [r4, 0x10]
lsls r1, 1
adds r5, r4, 0
adds r5, 0x28
adds r1, r5
ldrh r0, [r1]
subs r0, 0x1
strh r0, [r1]
lsls r0, 16
cmp r0, 0
beq _0800D192
ldr r1, =gUnknown_03007880
ldrb r0, [r4, 0x10]
lsls r0, 2
adds r0, r1
ldr r0, [r0]
ldrh r0, [r0]
cmp r0, 0x27
bne _0800D1BC
_0800D192:
bl sub_800D630
movs r0, 0x18
strb r0, [r4, 0x4]
ldrb r1, [r4, 0x10]
movs r0, 0x4
bl rfu_clearSlot
adds r2, r4, 0
adds r2, 0x24
movs r1, 0x1
ldrb r0, [r4, 0x10]
lsls r1, r0
ldrb r0, [r2]
bics r0, r1
strb r0, [r2]
ldrb r0, [r4, 0x10]
lsls r0, 1
adds r0, r5
movs r1, 0
strh r1, [r0]
_0800D1BC:
ldr r0, =0x04000208
strh r6, [r0]
ldr r5, =gUnknown_03004140
ldrb r0, [r5, 0x4]
cmp r0, 0x18
bne _0800D1F6
ldrb r0, [r5, 0x2]
cmp r0, 0x1
bne _0800D1D2
bl sub_800D630
_0800D1D2:
ldrb r0, [r5, 0x2]
adds r4, r0, 0
cmp r4, 0
bne _0800D1F6
strb r4, [r5, 0x5]
strb r4, [r5, 0x4]
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r1, [r0, 0x2]
ldrb r0, [r0, 0x3]
orrs r0, r1
bl sub_800D334
strh r4, [r5, 0x14]
movs r0, 0x25
movs r1, 0x1
bl sub_800D30C
_0800D1F6:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_800D158
thumb_func_start sub_800D20C
sub_800D20C: @ 800D20C
push {r4,r5,lr}

View File

@ -113,7 +113,8 @@ struct RfuUnk1
struct RfuUnk2
{
u8 unk_0[0x34];
u16 unk_0;
u8 fill_2[0x32];
u16 unk_34;
u8 fill_36[0x2b];
u8 unk_61;

View File

@ -24,14 +24,15 @@ EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {};
// Static ROM declarations
void sub_800C000(void);
void sub_800CEB0(u16 unk0);
void sub_800C7B4(u16 unk0, u16 unk1);
void sub_800CEB0(u16 r6);
void sub_800C7B4(u16 r8, u16 r6);
void sub_800D30C(u8 a0, u8 a1);
void sub_800D334(u8 a0);
void sub_800D610(void);
void sub_800D630(void);
void sub_800C744(u32 a0);
void sub_800CF34(void);
void sub_800D158(void);
static void sub_800D158(void);
void sub_800D20C(void);
void sub_800D268(void);
u8 sub_800D294(void);
@ -1409,3 +1410,35 @@ __attribute__((naked)) void sub_800CF34(void)
"\tbx r0");
}
#endif
static void sub_800D158(void)
{
u16 imeBak = REG_IME;
REG_IME = 0;
if (gUnknown_03004140.unk_04 == 15)
{
if (--gUnknown_03004140.unk_28[gUnknown_03004140.unk_10] == 0 || gUnknown_03007880[gUnknown_03004140.unk_10]->unk_0 == 0x27)
{
sub_800D630();
gUnknown_03004140.unk_04 = 24;
rfu_clearSlot(4, gUnknown_03004140.unk_10);
gUnknown_03004140.unk_24 &= ~(1 << gUnknown_03004140.unk_10);
gUnknown_03004140.unk_28[gUnknown_03004140.unk_10] = 0;
}
}
REG_IME = imeBak;
if (gUnknown_03004140.unk_04 == 24)
{
if (gUnknown_03004140.unk_02 == 1)
{
sub_800D630();
}
if (gUnknown_03004140.unk_02 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
sub_800D334(gUnknown_03007890[0].unk_02 | gUnknown_03007890[0].unk_03);
gUnknown_03004140.unk_14 = 0;
sub_800D30C(0x25, 0x01);
}
}
}