through sub_801704C

This commit is contained in:
PikalaxALT 2019-03-27 10:44:49 -04:00
parent 44f7d49c2e
commit 9a8b001ebf
4 changed files with 122 additions and 327 deletions

View File

@ -5,330 +5,6 @@
.text
thumb_func_start sub_8016DF0
sub_8016DF0: @ 8016DF0
push {r4-r6,lr}
adds r4, r0, 0
adds r5, r1, 0
adds r6, r2, 0
ldr r0, =sub_8016CA0
movs r1, 0
bl CreateTask
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r2, =gTasks + 0x8
adds r3, r1, r2
str r4, [r3]
str r5, [r3, 0x4]
adds r2, r1
strh r6, [r2, 0x8]
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end sub_8016DF0
thumb_func_start sub_8016E24
sub_8016E24: @ 8016E24
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0xC
lsls r0, 24
lsrs r0, 24
mov r10, r0
lsls r0, 2
add r0, r10
lsls r0, 3
ldr r1, =gTasks + 0x8
adds r6, r0, r1
movs r3, 0
_08016E42:
lsls r4, r3, 3
subs r0, r4, r3
lsls r5, r0, 2
ldr r0, [r6]
adds r0, r5
adds r1, r0, 0
adds r1, 0x10
lsls r2, r3, 24
lsrs r2, 24
str r3, [sp]
bl sub_800DE7C
ldr r0, [r6]
adds r0, r5
ldrb r0, [r0, 0xA]
lsls r0, 25
lsrs r0, 25
mov r2, r10
lsls r1, r2, 2
add r1, r10
lsls r1, 3
ldr r7, =gTasks
adds r1, r7
movs r2, 0xC
ldrsh r1, [r1, r2]
bl sub_8013D88
mov r8, r4
ldr r3, [sp]
cmp r0, 0
bne _08016E8E
ldr r1, [r6]
adds r1, r5
ldr r0, =gUnknown_082F045C
ldm r0!, {r2,r4,r7}
stm r1!, {r2,r4,r7}
ldm r0!, {r2,r4,r7}
stm r1!, {r2,r4,r7}
_08016E8E:
adds r4, r3, 0x1
mov r9, r4
cmp r3, 0
ble _08016ED2
str r5, [sp, 0x4]
movs r5, 0
str r5, [sp, 0x8]
adds r4, r3, 0
_08016E9E:
ldr r1, [r6]
ldr r7, [sp, 0x8]
adds r0, r1, r7
ldr r2, [sp, 0x4]
adds r1, r2
str r3, [sp]
bl sub_8017630
lsls r0, 24
ldr r3, [sp]
cmp r0, 0
bne _08016EC6
ldr r1, [r6]
ldr r5, [sp, 0x4]
adds r1, r5
ldr r0, =gUnknown_082F045C
ldm r0!, {r2,r5,r7}
stm r1!, {r2,r5,r7}
ldm r0!, {r2,r5,r7}
stm r1!, {r2,r5,r7}
_08016EC6:
ldr r7, [sp, 0x8]
adds r7, 0x1C
str r7, [sp, 0x8]
subs r4, 0x1
cmp r4, 0
bne _08016E9E
_08016ED2:
mov r0, r8
subs r4, r0, r3
lsls r4, 2
ldr r0, [r6]
adds r0, r4
ldr r1, =gUnknown_082F045C
bl sub_8017630
ldr r3, [r6]
adds r3, r4
movs r2, 0x1
ands r2, r0
ldrb r0, [r3, 0x18]
movs r4, 0x2
negs r4, r4
adds r1, r4, 0
ands r0, r1
orrs r0, r2
strb r0, [r3, 0x18]
mov r3, r9
cmp r3, 0x3
ble _08016E42
add sp, 0xC
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8016E24
thumb_func_start sub_8016F1C
sub_8016F1C: @ 8016F1C
push {lr}
lsls r1, 16
asrs r1, 16
cmp r1, 0x7
bne _08016F2C
ldrb r1, [r0]
movs r0, 0x20
b _08016F34
_08016F2C:
cmp r1, 0x8
bne _08016F3E
ldrb r1, [r0]
movs r0, 0x10
_08016F34:
ands r0, r1
cmp r0, 0
beq _08016F3E
movs r0, 0x1
b _08016F40
_08016F3E:
movs r0, 0
_08016F40:
pop {r1}
bx r1
thumb_func_end sub_8016F1C
thumb_func_start sub_8016F44
sub_8016F44: @ 8016F44
push {r4-r7,lr}
mov r7, r8
push {r7}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks + 0x8
adds r4, r1, r0
movs r6, 0
subs r0, 0x8
movs r5, 0
adds r1, r0
mov r8, r1
_08016F62:
ldr r0, [r4]
adds r0, r5
adds r1, r0, 0
adds r1, 0x10
lsls r2, r6, 24
lsrs r2, 24
bl sub_800DF34
lsls r0, 24
cmp r0, 0
beq _08016F86
ldr r0, [r4]
adds r0, r5
mov r2, r8
movs r3, 0xC
ldrsh r1, [r2, r3]
bl sub_8016F1C
_08016F86:
ldr r0, [r4]
adds r0, r5
ldr r1, =gUnknown_082F045C
bl sub_8017630
ldr r3, [r4]
adds r3, r5
movs r2, 0x1
ands r2, r0
ldrb r0, [r3, 0x18]
movs r7, 0x2
negs r7, r7
adds r1, r7, 0
ands r0, r1
orrs r0, r2
strb r0, [r3, 0x18]
adds r5, 0x1C
adds r6, 0x1
cmp r6, 0x3
ble _08016F62
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8016F44
thumb_func_start sub_8016FC0
sub_8016FC0: @ 8016FC0
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
ldr r0, =sub_8016E24
movs r1, 0
bl CreateTask
lsls r0, 24
lsrs r0, 24
lsls r2, r0, 2
adds r2, r0
lsls r2, 3
ldr r1, =gTasks + 0x8
adds r3, r2, r1
str r4, [r3]
adds r1, r2
strh r5, [r1, 0x4]
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_8016FC0
thumb_func_start sub_8016FF0
sub_8016FF0: @ 8016FF0
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
ldr r0, =sub_8016F44
movs r1, 0
bl CreateTask
lsls r0, 24
lsrs r0, 24
lsls r2, r0, 2
adds r2, r0
lsls r2, 3
ldr r1, =gTasks + 0x8
adds r3, r2, r1
str r4, [r3]
adds r1, r2
strh r5, [r1, 0x4]
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_8016FF0
thumb_func_start sub_8017020
sub_8017020: @ 8017020
push {r4,lr}
adds r4, r0, 0
bl sub_81973A4
movs r0, 0
movs r1, 0x1
bl DrawDialogueFrame
ldr r0, =gStringVar4
adds r1, r4, 0
bl StringExpandPlaceholders
movs r0, 0
movs r1, 0x1
bl AddTextPrinterWithCustomSpeedForMessage
movs r0, 0
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_8017020
thumb_func_start sub_801704C
sub_801704C: @ 801704C
push {lr}
bl RunTextPrintersAndIsPrinter0Active
lsls r0, 16
cmp r0, 0
beq _0801705C
movs r0, 0
b _0801705E
_0801705C:
movs r0, 0x1
_0801705E:
pop {r1}
bx r1
thumb_func_end sub_801704C
thumb_func_start PrintOnTextbox
PrintOnTextbox: @ 8017064
push {r4,r5,lr}

View File

@ -281,6 +281,7 @@ void sub_8011DE0(u32 arg0);
u8 sub_801100C(int a0);
void sub_800EF7C(void);
bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx);
bool8 sub_800DF34(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx);
s32 sub_800E87C(u8 idx);
void sub_8011BA4(void);
void sub_8010198(void);

View File

@ -99,5 +99,6 @@ void sub_8199CBC(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8 height);
u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile);
void sub_8198314(void);
void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram);
void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed);
#endif // GUARD_MENU_H

View File

@ -241,7 +241,7 @@ void sub_8018784(u8 windowId);
void sub_8018884(const u8 *src);
bool32 mevent_0814257C(u8 *textState, const u8 *str);
s8 sub_8018B08(u8 *textState, u8 *arg1, u8 arg2, const u8 *str);
bool32 sub_8016F1C(struct UnkStruct_x20 *arg0, s16 arg1);
bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1);
u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2);
void sub_8019F2C(void);
void sub_8019E70(u8 *arg0, s32 arg1);
@ -274,7 +274,7 @@ void sub_8019F04(u8 *spriteIds);
void sub_8019E3C(void);
void sub_80173B0(void);
s32 sub_8017D04(u32 type, u32 species);
void sub_8017020(const u8 *src);
bool32 sub_8017020(const u8 *src);
void sub_8019BA8(void *);
s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3);
void sub_801697C(u8 taskId);
@ -2340,7 +2340,7 @@ void sub_80152F4(u8 taskId)
{
if (data->field_0->arr[0].field_1A_0 == 1 && !data->field_0->arr[0].unk.field_0.unk_0a_7)
{
if (sub_8016F1C(&data->field_0->arr[0], data->field_12 + 7))
if (sub_8016F1C(&data->field_0->arr[0].unk.field_0, data->field_12 + 7))
{
data->field_F = 0;
data->field_14 = 0;
@ -3505,3 +3505,120 @@ void sub_8016CA0(u8 taskId)
}
}
}
u8 sub_8016DF0(struct UnkStruct_Main4 * a0, struct UnkStruct_Main4 * a1, u32 a2)
{
u8 taskId = CreateTask(sub_8016CA0, 0);
struct UnkStruct_Main4 ** data = (void *)gTasks[taskId].data;
data[0] = a0;
data[1] = a1;
gTasks[taskId].data[4] = a2;
return taskId;
}
void sub_8016E24(u8 taskId)
{
s32 i, j;
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
for (i = 0; i < 4; i++)
{
sub_800DE7C(&ptr[0]->arr[i].unk0.field_0, ptr[0]->arr[i].unk0.playerName, i);
if (!sub_8013D88(ptr[0]->arr[i].unk0.field_0.unk_0a_0, gTasks[taskId].data[2]))
{
ptr[0]->arr[i].unk0 = gUnknown_082F045C;
}
for (j = 0; j < i; j++)
{
if (!sub_8017630(&ptr[0]->arr[j].unk0, &ptr[0]->arr[i].unk0))
{
ptr[0]->arr[i].unk0 = gUnknown_082F045C;
}
}
ptr[0]->arr[i].unk18 = sub_8017630(&ptr[0]->arr[i].unk0, &gUnknown_082F045C);
}
}
bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1)
{
if (arg1 == 7)
{
if (!arg0->unk_00.unk_00_5)
{
return FALSE;
}
else
{
return TRUE;
}
}
else if (arg1 == 8)
{
if (!arg0->unk_00.unk_00_4)
{
return FALSE;
}
else
{
return TRUE;
}
}
else
{
return FALSE;
}
}
void sub_8016F44(u8 taskId)
{
s32 i;
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
for (i = 0; i < 4; i++)
{
if (sub_800DF34(&ptr[0]->arr[i].unk0.field_0, ptr[0]->arr[i].unk0.playerName, i))
{
sub_8016F1C(&ptr[0]->arr[i].unk0.field_0, gTasks[taskId].data[2]);
}
ptr[0]->arr[i].unk18 = sub_8017630(&ptr[0]->arr[i].unk0, &gUnknown_082F045C);
}
}
u8 sub_8016FC0(struct UnkStruct_Main4 * a0, u32 a1)
{
u8 taskId = CreateTask(sub_8016E24, 0);
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
ptr[0] = a0;
gTasks[taskId].data[2] = a1;
return taskId;
}
u8 sub_8016FF0(struct UnkStruct_Main4 * a0, u32 a1)
{
u8 taskId = CreateTask(sub_8016F44, 0);
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
ptr[0] = a0;
gTasks[taskId].data[2] = a1;
return taskId;
}
bool32 sub_8017020(const u8 *src)
{
sub_81973A4();
DrawDialogueFrame(0, 1);
StringExpandPlaceholders(gStringVar4, src);
AddTextPrinterWithCustomSpeedForMessage(FALSE, 1);
return FALSE;
}
bool32 sub_801704C(void)
{
if (!RunTextPrintersAndIsPrinter0Active())
{
return TRUE;
}
else
{
return FALSE;
}
}