mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-26 13:31:03 +01:00
through sub_81CF3F8
This commit is contained in:
parent
18f29c566a
commit
330fc46df8
@ -5,187 +5,6 @@
|
||||
|
||||
@ File centered around AllocSubstruct(7)
|
||||
|
||||
thumb_func_start sub_81CF2C4
|
||||
sub_81CF2C4: @ 81CF2C4
|
||||
push {r4-r7,lr}
|
||||
adds r5, r0, 0
|
||||
adds r7, r1, 0
|
||||
movs r1, 0
|
||||
ldr r0, [r5, 0x20]
|
||||
ldrh r2, [r0]
|
||||
lsrs r3, r2, 1
|
||||
cmp r2, r3
|
||||
beq _081CF2F4
|
||||
adds r6, r0, 0
|
||||
ldrh r4, [r7, 0x2]
|
||||
_081CF2DA:
|
||||
lsls r0, r3, 2
|
||||
adds r0, r6, r0
|
||||
ldrh r0, [r0, 0x6]
|
||||
cmp r4, r0
|
||||
bls _081CF2E8
|
||||
adds r2, r3, 0
|
||||
b _081CF2EA
|
||||
_081CF2E8:
|
||||
adds r1, r3, 0x1
|
||||
_081CF2EA:
|
||||
subs r0, r2, r1
|
||||
lsrs r0, 1
|
||||
adds r3, r1, r0
|
||||
cmp r2, r3
|
||||
bne _081CF2DA
|
||||
_081CF2F4:
|
||||
ldr r0, [r5, 0x20]
|
||||
ldrh r2, [r0]
|
||||
lsls r6, r3, 2
|
||||
cmp r2, r3
|
||||
bls _081CF318
|
||||
lsls r0, r2, 2
|
||||
subs r4, r0, 0x4
|
||||
_081CF302:
|
||||
ldr r0, [r5, 0x20]
|
||||
lsls r1, r2, 2
|
||||
adds r0, 0x4
|
||||
adds r1, r0, r1
|
||||
adds r0, r4
|
||||
ldr r0, [r0]
|
||||
str r0, [r1]
|
||||
subs r4, 0x4
|
||||
subs r2, 0x1
|
||||
cmp r2, r3
|
||||
bhi _081CF302
|
||||
_081CF318:
|
||||
ldr r0, [r5, 0x20]
|
||||
adds r0, 0x4
|
||||
adds r0, r6
|
||||
ldr r1, [r7]
|
||||
str r1, [r0]
|
||||
ldr r1, [r5, 0x20]
|
||||
ldrh r0, [r1]
|
||||
adds r0, 0x1
|
||||
strh r0, [r1]
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81CF2C4
|
||||
|
||||
thumb_func_start sub_81CF330
|
||||
sub_81CF330: @ 81CF330
|
||||
push {r4,lr}
|
||||
movs r1, 0x81
|
||||
lsls r1, 4
|
||||
movs r0, 0x8
|
||||
bl AllocSubstruct
|
||||
adds r4, r0, 0
|
||||
cmp r4, 0
|
||||
beq _081CF360
|
||||
ldr r0, =sub_81CF418
|
||||
movs r1, 0x1
|
||||
bl CreateLoopedTask
|
||||
str r0, [r4, 0x4]
|
||||
ldr r0, =sub_81CF3E4
|
||||
str r0, [r4]
|
||||
movs r0, 0
|
||||
str r0, [r4, 0xC]
|
||||
movs r0, 0x1
|
||||
b _081CF362
|
||||
.pool
|
||||
_081CF360:
|
||||
movs r0, 0
|
||||
_081CF362:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF330
|
||||
|
||||
thumb_func_start sub_81CF368
|
||||
sub_81CF368: @ 81CF368
|
||||
push {r4,lr}
|
||||
movs r1, 0x81
|
||||
lsls r1, 4
|
||||
movs r0, 0x8
|
||||
bl AllocSubstruct
|
||||
adds r4, r0, 0
|
||||
cmp r4, 0
|
||||
beq _081CF398
|
||||
ldr r0, =sub_81CF418
|
||||
movs r1, 0x1
|
||||
bl CreateLoopedTask
|
||||
str r0, [r4, 0x4]
|
||||
ldr r0, =sub_81CF3E4
|
||||
str r0, [r4]
|
||||
movs r0, 0x1
|
||||
str r0, [r4, 0xC]
|
||||
b _081CF39A
|
||||
.pool
|
||||
_081CF398:
|
||||
movs r0, 0
|
||||
_081CF39A:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF368
|
||||
|
||||
thumb_func_start sub_81CF3A0
|
||||
sub_81CF3A0: @ 81CF3A0
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
movs r0, 0x8
|
||||
bl GetSubstructPtr
|
||||
adds r5, r0, 0
|
||||
ldr r0, =gUnknown_08623598
|
||||
lsls r4, 2
|
||||
adds r4, r0
|
||||
ldr r0, [r4]
|
||||
movs r1, 0x1
|
||||
bl CreateLoopedTask
|
||||
str r0, [r5, 0x4]
|
||||
ldr r0, =sub_81CF3E4
|
||||
str r0, [r5]
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81CF3A0
|
||||
|
||||
thumb_func_start sub_81CF3D0
|
||||
sub_81CF3D0: @ 81CF3D0
|
||||
push {lr}
|
||||
movs r0, 0x8
|
||||
bl GetSubstructPtr
|
||||
ldr r0, [r0]
|
||||
bl _call_via_r0
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF3D0
|
||||
|
||||
thumb_func_start sub_81CF3E4
|
||||
sub_81CF3E4: @ 81CF3E4
|
||||
push {lr}
|
||||
movs r0, 0x8
|
||||
bl GetSubstructPtr
|
||||
ldr r0, [r0, 0x4]
|
||||
bl IsLoopedTaskActive
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF3E4
|
||||
|
||||
thumb_func_start sub_81CF3F8
|
||||
sub_81CF3F8: @ 81CF3F8
|
||||
push {r4,lr}
|
||||
movs r0, 0x8
|
||||
bl GetSubstructPtr
|
||||
adds r4, r0, 0
|
||||
bl sub_81C8234
|
||||
ldrb r0, [r4, 0x8]
|
||||
bl RemoveWindow
|
||||
movs r0, 0x8
|
||||
bl FreePokenavSubstruct
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81CF3F8
|
||||
|
||||
thumb_func_start sub_81CF418
|
||||
sub_81CF418: @ 81CF418
|
||||
push {r4,r5,lr}
|
||||
|
@ -310,3 +310,86 @@ u32 sub_81CF278(s32 state)
|
||||
ptr->unk18 = 1;
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
void sub_81CF2C4(struct PokenavSub7 *structPtr, struct PokenavMonList *item)
|
||||
{
|
||||
u32 left = 0;
|
||||
u32 right = structPtr->unkPtr->unk0;
|
||||
u32 insertionIdx = left + (right - left) / 2;
|
||||
|
||||
while (right != insertionIdx)
|
||||
{
|
||||
if (item->unk6 > structPtr->unkPtr->unk4[insertionIdx].unk6)
|
||||
right = insertionIdx;
|
||||
else
|
||||
left = insertionIdx + 1;
|
||||
insertionIdx = left + (right - left) / 2;
|
||||
}
|
||||
for (right = structPtr->unkPtr->unk0; right > insertionIdx; right--)
|
||||
structPtr->unkPtr->unk4[right] = structPtr->unkPtr->unk4[right - 1];
|
||||
structPtr->unkPtr->unk4[insertionIdx] = *item;
|
||||
structPtr->unkPtr->unk0++;
|
||||
}
|
||||
|
||||
// PokenavSub8
|
||||
|
||||
struct PokenavSub8
|
||||
{
|
||||
bool32 (*callback)(void);
|
||||
u32 ltid;
|
||||
u8 winid;
|
||||
bool32 unkC;
|
||||
u16 buff[0x400];
|
||||
}; // size: 0x810
|
||||
|
||||
bool32 sub_81CF3E4(void);
|
||||
u32 sub_81CF418(s32 state);
|
||||
|
||||
bool32 sub_81CF330(void)
|
||||
{
|
||||
struct PokenavSub8 * unk = AllocSubstruct(8, sizeof(struct PokenavSub8));
|
||||
if (unk == NULL)
|
||||
return FALSE;
|
||||
unk->ltid = CreateLoopedTask(sub_81CF418, 1);
|
||||
unk->callback = sub_81CF3E4;
|
||||
unk->unkC = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 sub_81CF368(void)
|
||||
{
|
||||
struct PokenavSub8 * unk = AllocSubstruct(8, sizeof(struct PokenavSub8));
|
||||
if (unk == NULL)
|
||||
return FALSE;
|
||||
unk->ltid = CreateLoopedTask(sub_81CF418, 1);
|
||||
unk->callback = sub_81CF3E4;
|
||||
unk->unkC = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_81CF3A0(s32 idx)
|
||||
{
|
||||
struct PokenavSub8 * unk = (struct PokenavSub8 *)GetSubstructPtr(8);
|
||||
unk->ltid = CreateLoopedTask(gUnknown_08623598[idx], 1);
|
||||
unk->callback = sub_81CF3E4;
|
||||
}
|
||||
|
||||
bool32 sub_81CF3D0(void)
|
||||
{
|
||||
struct PokenavSub8 * unk = (struct PokenavSub8 *)GetSubstructPtr(8);
|
||||
return unk->callback();
|
||||
}
|
||||
|
||||
bool32 sub_81CF3E4(void)
|
||||
{
|
||||
struct PokenavSub8 * unk = (struct PokenavSub8 *)GetSubstructPtr(8);
|
||||
return IsLoopedTaskActive(unk->ltid);
|
||||
}
|
||||
|
||||
void sub_81CF3F8(void)
|
||||
{
|
||||
struct PokenavSub8 * unk = (struct PokenavSub8 *)GetSubstructPtr(8);
|
||||
sub_81C8234();
|
||||
RemoveWindow(unk->winid);
|
||||
FreePokenavSubstruct(8);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user