sub_811AAAC

This commit is contained in:
PikalaxALT 2017-11-02 20:51:13 -04:00
parent 881d222621
commit 42c1164d72
2 changed files with 58 additions and 95 deletions

View file

@ -5,93 +5,6 @@
.text
thumb_func_start sub_811AA90
sub_811AA90: @ 811AA90
push {r4,lr}
ldr r4, =gUnknown_0203A118
ldr r0, [r4]
cmp r0, 0
beq _0811AAA2
bl Free
movs r0, 0
str r0, [r4]
_0811AAA2:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_811AA90
thumb_func_start sub_811AAAC
sub_811AAAC: @ 811AAAC
push {lr}
ldr r0, =gUnknown_0203A118
ldr r0, [r0]
ldrb r0, [r0, 0x4]
cmp r0, 0xA
bhi _0811AB3E
lsls r0, 2
ldr r1, =_0811AACC
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_0811AACC:
.4byte _0811AAF8
.4byte _0811AAFE
.4byte _0811AB04
.4byte _0811AB0A
.4byte _0811AB10
.4byte _0811AB16
.4byte _0811AB1C
.4byte _0811AB22
.4byte _0811AB28
.4byte _0811AB2E
.4byte _0811AB34
_0811AAF8:
bl sub_811AB68
b _0811AB38
_0811AAFE:
bl sub_811ACDC
b _0811AB38
_0811AB04:
bl sub_811AE44
b _0811AB38
_0811AB0A:
bl sub_811AF00
b _0811AB38
_0811AB10:
bl sub_811AF8C
b _0811AB38
_0811AB16:
bl sub_811B040
b _0811AB38
_0811AB1C:
bl sub_811AFEC
b _0811AB38
_0811AB22:
bl sub_811B08C
b _0811AB38
_0811AB28:
bl sub_811B0BC
b _0811AB38
_0811AB2E:
bl sub_811B0E8
b _0811AB38
_0811AB34:
bl sub_811B0F8
_0811AB38:
lsls r0, 16
lsrs r0, 16
b _0811AB40
_0811AB3E:
movs r0, 0
_0811AB40:
pop {r1}
bx r1
thumb_func_end sub_811AAAC
thumb_func_start sub_811AB44
sub_811AB44: @ 811AB44
push {lr}

View file

@ -53,13 +53,24 @@ static void sub_811A2C0(u8);
static void sub_811A278(void);
static bool8 sub_811A428(u8);
static void sub_811A2FC(u8);
/*static*/ void sub_811A4D0(MainCallback);
static void sub_811A4D0(MainCallback);
static bool32 sub_811A88C(u16);
static void sub_811A8A4(u16);
static void sub_811A8F0(void);
static bool8 sub_811A95C(u8, u16 *, u8);
void sub_811AA90(void);
/*static*/ u16 sub_811AAAC(void);
static bool8 EasyChat_AllocateResources(u8, u16 *, u8);
static void EasyChat_FreeResources(void);
static u16 sub_811AAAC(void);
u16 sub_811AB68(void);
u16 sub_811ACDC(void);
u16 sub_811AE44(void);
u16 sub_811AF00(void);
u16 sub_811AF8C(void);
u16 sub_811B040(void);
u16 sub_811AFEC(void);
u16 sub_811B08C(void);
u16 sub_811B0BC(void);
u16 sub_811B0E8(void);
u16 sub_811B0F8(void);
u8 sub_811BCC8(u8);
void sub_811BDF0(u8 *);
bool8 sub_811BF8C(void);
@ -219,7 +230,7 @@ static bool8 sub_811A428(u8 taskId)
}
break;
case 2:
if (!sub_811A95C(data[EZCHAT_TASK_KIND], (u16 *)GetWordTaskArg(taskId, EZCHAT_TASK_WORDS), data[EZCHAT_TASK_SIZE]))
if (!EasyChat_AllocateResources(data[EZCHAT_TASK_KIND], (u16 *)GetWordTaskArg(taskId, EZCHAT_TASK_WORDS), data[EZCHAT_TASK_SIZE]))
{
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
@ -243,10 +254,10 @@ static bool8 sub_811A428(u8 taskId)
return TRUE;
}
void sub_811A4D0(MainCallback callback)
static void sub_811A4D0(MainCallback callback)
{
sub_811C13C();
sub_811AA90();
EasyChat_FreeResources();
sub_811F2B8();
FreeAllWindowBuffers();
SetMainCallback2(callback);
@ -422,7 +433,7 @@ static void sub_811A938(void)
sub_811A20C(0x11, gSaveBlock1Ptr->lilycoveLady.quiz.unk_002, sub_80861B0, 3);
}
static bool8 sub_811A95C(u8 kind, u16 *words, u8 sizeParam)
static bool8 EasyChat_AllocateResources(u8 kind, u16 *words, u8 sizeParam)
{
u8 r6;
int i;
@ -474,3 +485,42 @@ static bool8 sub_811A95C(u8 kind, u16 *words, u8 sizeParam)
gUnknown_0203A118->unk_0d = (sub_811F3AC() - 1) / 2 + 1;
return TRUE;
}
static void EasyChat_FreeResources(void)
{
if (gUnknown_0203A118 != NULL)
{
free(gUnknown_0203A118);
gUnknown_0203A118 = NULL;
}
}
static u16 sub_811AAAC(void)
{
switch (gUnknown_0203A118->unk_04)
{
case 0:
return sub_811AB68();
case 1:
return sub_811ACDC();
case 2:
return sub_811AE44();
case 3:
return sub_811AF00();
case 4:
return sub_811AF8C();
case 5:
return sub_811B040();
case 6:
return sub_811AFEC();
case 7:
return sub_811B08C();
case 8:
return sub_811B0BC();
case 9:
return sub_811B0E8();
case 10:
return sub_811B0F8();
}
return 0;
}