sub_811A95C
This commit is contained in:
parent
1049cd670d
commit
881d222621
2 changed files with 92 additions and 157 deletions
153
asm/easy_chat.s
153
asm/easy_chat.s
|
@ -5,159 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_811A95C
|
||||
sub_811A95C: @ 811A95C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
mov r8, r1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
ldr r4, =gUnknown_0203A118
|
||||
movs r0, 0x50
|
||||
bl Alloc
|
||||
str r0, [r4]
|
||||
cmp r0, 0
|
||||
bne _0811A984
|
||||
movs r0, 0
|
||||
b _0811AA7E
|
||||
.pool
|
||||
_0811A984:
|
||||
movs r7, 0
|
||||
strb r5, [r0]
|
||||
ldr r0, [r4]
|
||||
mov r1, r8
|
||||
str r1, [r0, 0x38]
|
||||
strb r7, [r0, 0x5]
|
||||
ldr r0, [r4]
|
||||
strb r7, [r0, 0x6]
|
||||
ldr r0, [r4]
|
||||
strb r7, [r0, 0x9]
|
||||
ldr r0, [r4]
|
||||
strb r6, [r0, 0x12]
|
||||
ldr r0, [r4]
|
||||
strb r7, [r0, 0x13]
|
||||
adds r0, r5, 0
|
||||
bl sub_811BCC8
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
cmp r5, 0x10
|
||||
bne _0811A9C6
|
||||
ldr r0, [r4]
|
||||
adds r0, 0x14
|
||||
bl sub_811BDF0
|
||||
ldr r0, [r4]
|
||||
adds r1, r0, 0
|
||||
adds r1, 0x14
|
||||
str r1, [r0, 0x34]
|
||||
movs r1, 0x7
|
||||
strb r1, [r0, 0x4]
|
||||
lsls r0, r6, 1
|
||||
b _0811A9DE
|
||||
_0811A9C6:
|
||||
ldr r0, [r4]
|
||||
strb r7, [r0, 0x4]
|
||||
ldr r3, [r4]
|
||||
ldr r1, =gUnknown_08597550
|
||||
lsls r2, r6, 1
|
||||
adds r0, r2, r6
|
||||
lsls r0, 3
|
||||
adds r1, 0x4
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
str r0, [r3, 0x34]
|
||||
adds r0, r2, 0
|
||||
_0811A9DE:
|
||||
ldr r3, =gUnknown_0203A118
|
||||
ldr r2, [r3]
|
||||
ldr r1, =gUnknown_08597550
|
||||
adds r0, r6
|
||||
lsls r0, 3
|
||||
adds r0, r1
|
||||
ldrb r1, [r0, 0x1]
|
||||
strb r1, [r2, 0x2]
|
||||
ldr r1, [r3]
|
||||
ldrb r0, [r0, 0x2]
|
||||
strb r0, [r1, 0x3]
|
||||
ldr r0, [r3]
|
||||
ldrb r2, [r0, 0x2]
|
||||
ldrb r1, [r0, 0x3]
|
||||
adds r4, r2, 0
|
||||
muls r4, r1
|
||||
adds r1, r4, 0
|
||||
strb r1, [r0, 0x7]
|
||||
ldr r0, [r3]
|
||||
strb r6, [r0, 0x1]
|
||||
ldr r1, [r3]
|
||||
ldrb r0, [r1, 0x7]
|
||||
adds r4, r3, 0
|
||||
cmp r0, 0x9
|
||||
bls _0811AA14
|
||||
movs r0, 0x9
|
||||
strb r0, [r1, 0x7]
|
||||
_0811AA14:
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
beq _0811AA34
|
||||
ldr r0, [r4]
|
||||
adds r1, r0, 0
|
||||
adds r1, 0x3C
|
||||
ldrb r2, [r0, 0x7]
|
||||
mov r0, r8
|
||||
bl CpuSet
|
||||
b _0811AA64
|
||||
.pool
|
||||
_0811AA34:
|
||||
movs r3, 0
|
||||
ldr r0, [r4]
|
||||
ldrb r0, [r0, 0x7]
|
||||
cmp r3, r0
|
||||
bge _0811AA5C
|
||||
adds r6, r4, 0
|
||||
ldr r1, =0x0000ffff
|
||||
adds r5, r1, 0
|
||||
_0811AA44:
|
||||
ldr r2, [r6]
|
||||
lsls r0, r3, 1
|
||||
adds r1, r2, 0
|
||||
adds r1, 0x3C
|
||||
adds r1, r0
|
||||
ldrh r0, [r1]
|
||||
orrs r0, r5
|
||||
strh r0, [r1]
|
||||
adds r3, 0x1
|
||||
ldrb r2, [r2, 0x7]
|
||||
cmp r3, r2
|
||||
blt _0811AA44
|
||||
_0811AA5C:
|
||||
ldr r1, [r4]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x3C
|
||||
str r0, [r1, 0x38]
|
||||
_0811AA64:
|
||||
bl sub_811F3AC
|
||||
ldr r1, =gUnknown_0203A118
|
||||
ldr r2, [r1]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
subs r0, 0x1
|
||||
lsrs r1, r0, 31
|
||||
adds r0, r1
|
||||
asrs r0, 1
|
||||
adds r0, 0x1
|
||||
strb r0, [r2, 0xD]
|
||||
movs r0, 0x1
|
||||
_0811AA7E:
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_811A95C
|
||||
|
||||
thumb_func_start sub_811AA90
|
||||
sub_811AA90: @ 811AA90
|
||||
push {r4,lr}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
// Includes
|
||||
#include "global.h"
|
||||
#include "malloc.h"
|
||||
#include "songs.h"
|
||||
#include "sound.h"
|
||||
#include "overworld.h"
|
||||
|
@ -23,6 +24,31 @@
|
|||
#define EZCHAT_TASK_SIZE 7
|
||||
|
||||
// Static RAM declarations
|
||||
|
||||
EWRAM_DATA struct {
|
||||
u8 kind;
|
||||
u8 unk_01;
|
||||
u8 unk_02;
|
||||
u8 unk_03;
|
||||
u8 unk_04;
|
||||
u8 unk_05;
|
||||
u8 unk_06;
|
||||
u8 unk_07;
|
||||
u8 unk_08;
|
||||
u8 unk_09;
|
||||
u8 filler_0a[0x3];
|
||||
u8 unk_0d;
|
||||
u8 unk_0e[0x4];
|
||||
u8 sizeParam;
|
||||
u8 unk_13;
|
||||
u8 unk_14[0x20];
|
||||
const u8 *src;
|
||||
const u16 *words;
|
||||
u16 ecWordBuffer[9];
|
||||
} *gUnknown_0203A118 = NULL;
|
||||
|
||||
// Static ROM declarations
|
||||
|
||||
static void sub_811A2C0(u8);
|
||||
static void sub_811A278(void);
|
||||
static bool8 sub_811A428(u8);
|
||||
|
@ -31,9 +57,11 @@ static void sub_811A2FC(u8);
|
|||
static bool32 sub_811A88C(u16);
|
||||
static void sub_811A8A4(u16);
|
||||
static void sub_811A8F0(void);
|
||||
bool8 sub_811A95C(u8, u32, u8);
|
||||
static bool8 sub_811A95C(u8, u16 *, u8);
|
||||
void sub_811AA90(void);
|
||||
/*static*/ u16 sub_811AAAC(void);
|
||||
u8 sub_811BCC8(u8);
|
||||
void sub_811BDF0(u8 *);
|
||||
bool8 sub_811BF8C(void);
|
||||
bool8 sub_811BFA4(void);
|
||||
void sub_811C13C(void);
|
||||
|
@ -41,8 +69,7 @@ void sub_811C13C(void);
|
|||
/*static*/ bool8 sub_811C170(void);
|
||||
bool8 sub_811F28C(void);
|
||||
void sub_811F2B8(void);
|
||||
|
||||
// Static ROM declarations
|
||||
u8 sub_811F3AC(void);
|
||||
|
||||
// .rodata
|
||||
|
||||
|
@ -50,6 +77,14 @@ extern const struct {
|
|||
u16 word;
|
||||
MainCallback callback;
|
||||
} gUnknown_08597530[4];
|
||||
extern const struct {
|
||||
u8 unk_00;
|
||||
u8 unk_01;
|
||||
u8 unk_02;
|
||||
u8 unk_03;
|
||||
u8 *data;
|
||||
u8 filler_08[16];
|
||||
} gUnknown_08597550[];
|
||||
|
||||
// .text
|
||||
|
||||
|
@ -184,7 +219,7 @@ static bool8 sub_811A428(u8 taskId)
|
|||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!sub_811A95C(data[EZCHAT_TASK_KIND], GetWordTaskArg(taskId, EZCHAT_TASK_WORDS), data[EZCHAT_TASK_SIZE]))
|
||||
if (!sub_811A95C(data[EZCHAT_TASK_KIND], (u16 *)GetWordTaskArg(taskId, EZCHAT_TASK_WORDS), data[EZCHAT_TASK_SIZE]))
|
||||
{
|
||||
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
|
||||
}
|
||||
|
@ -386,3 +421,56 @@ 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)
|
||||
{
|
||||
u8 r6;
|
||||
int i;
|
||||
|
||||
gUnknown_0203A118 = malloc(sizeof(*gUnknown_0203A118));
|
||||
if (gUnknown_0203A118 == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
gUnknown_0203A118->kind = kind;
|
||||
gUnknown_0203A118->words = words;
|
||||
gUnknown_0203A118->unk_05 = 0;
|
||||
gUnknown_0203A118->unk_06 = 0;
|
||||
gUnknown_0203A118->unk_09 = 0;
|
||||
gUnknown_0203A118->sizeParam = sizeParam;
|
||||
gUnknown_0203A118->unk_13 = 0;
|
||||
r6 = sub_811BCC8(kind);
|
||||
if (kind == 0x10)
|
||||
{
|
||||
sub_811BDF0(gUnknown_0203A118->unk_14);
|
||||
gUnknown_0203A118->src = gUnknown_0203A118->unk_14;
|
||||
gUnknown_0203A118->unk_04 = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203A118->unk_04 = 0;
|
||||
gUnknown_0203A118->src = gUnknown_08597550[r6].data;
|
||||
}
|
||||
gUnknown_0203A118->unk_02 = gUnknown_08597550[r6].unk_01;
|
||||
gUnknown_0203A118->unk_03 = gUnknown_08597550[r6].unk_02;
|
||||
gUnknown_0203A118->unk_07 = gUnknown_0203A118->unk_02 * gUnknown_0203A118->unk_03;
|
||||
gUnknown_0203A118->unk_01 = r6;
|
||||
if (gUnknown_0203A118->unk_07 > 9)
|
||||
{
|
||||
gUnknown_0203A118->unk_07 = 9;
|
||||
}
|
||||
if (words != NULL)
|
||||
{
|
||||
CpuCopy16(words, gUnknown_0203A118->ecWordBuffer, gUnknown_0203A118->unk_07 * sizeof(u16));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < gUnknown_0203A118->unk_07; i ++)
|
||||
{
|
||||
gUnknown_0203A118->ecWordBuffer[i] = -1;
|
||||
}
|
||||
gUnknown_0203A118->words = gUnknown_0203A118->ecWordBuffer;
|
||||
}
|
||||
gUnknown_0203A118->unk_0d = (sub_811F3AC() - 1) / 2 + 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue