through sub_8018A50

This commit is contained in:
PikalaxALT 2019-03-30 20:04:30 -04:00
parent 5bf7886a70
commit 1ce07deeac
2 changed files with 145 additions and 368 deletions

View File

@ -5,372 +5,6 @@
.text .text
thumb_func_start sub_8018838
sub_8018838: @ 8018838
push {lr}
sub sp, 0xC
cmp r0, 0
beq _08018846
cmp r0, 0x1
beq _0801885E
b _08018876
_08018846:
movs r0, 0x20
str r0, [sp]
str r0, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0
movs r1, 0
movs r2, 0
movs r3, 0
bl FillBgTilemapBufferRect
b _08018876
_0801885E:
movs r0, 0x20
str r0, [sp]
movs r0, 0x1E
str r0, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0
movs r1, 0
movs r2, 0
movs r3, 0x2
bl FillBgTilemapBufferRect
_08018876:
movs r0, 0
bl CopyBgTilemapBufferToVram
add sp, 0xC
pop {r0}
bx r0
thumb_func_end sub_8018838
thumb_func_start sub_8018884
sub_8018884: @ 8018884
push {r4,lr}
sub sp, 0x14
adds r1, r0, 0
ldr r4, =gStringVar4
adds r0, r4, 0
bl StringExpandPlaceholders
movs r0, 0x1
movs r1, 0x11
bl FillWindowPixelBuffer
movs r1, 0
str r1, [sp]
str r1, [sp, 0x4]
ldr r0, =gUnknown_082F0728
str r0, [sp, 0x8]
str r1, [sp, 0xC]
str r4, [sp, 0x10]
movs r0, 0x1
movs r1, 0x1
movs r2, 0
movs r3, 0x1
bl AddTextPrinterParameterized4
movs r0, 0x1
movs r1, 0x1
movs r2, 0xF
bl sub_8098858
movs r0, 0x1
bl PutWindowTilemap
movs r0, 0x1
movs r1, 0x3
bl CopyWindowToVram
add sp, 0x14
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8018884
thumb_func_start sub_80188DC
sub_80188DC: @ 80188DC
push {lr}
movs r0, 0x1
bl rbox_fill_rectangle
movs r0, 0x1
bl ClearWindowTilemap
movs r0, 0x1
movs r1, 0x1
bl CopyWindowToVram
pop {r0}
bx r0
thumb_func_end sub_80188DC
thumb_func_start mevent_0814257C
mevent_0814257C: @ 80188F8
push {r4,lr}
sub sp, 0xC
adds r4, r0, 0
adds r0, r1, 0
ldrb r2, [r4]
cmp r2, 0x1
beq _08018920
cmp r2, 0x1
bgt _08018910
cmp r2, 0
beq _0801891A
b _08018980
_08018910:
cmp r2, 0x2
beq _08018954
cmp r2, 0xFF
beq _0801897C
b _08018980
_0801891A:
bl sub_8018884
b _08018944
_08018920:
movs r0, 0
str r0, [sp]
ldr r0, =gUnknown_02022C58
str r0, [sp, 0x4]
adds r0, 0x1
str r0, [sp, 0x8]
movs r0, 0x1
movs r1, 0xD0
movs r2, 0x14
movs r3, 0x1
bl DrawDownArrow
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x3
ands r0, r1
cmp r0, 0
beq _08018980
_08018944:
ldrb r0, [r4]
adds r0, 0x1
b _0801897E
.pool
_08018954:
movs r0, 0x1
str r0, [sp]
ldr r0, =gUnknown_02022C58
str r0, [sp, 0x4]
adds r0, 0x1
str r0, [sp, 0x8]
movs r0, 0x1
movs r1, 0xD0
movs r2, 0x14
movs r3, 0x1
bl DrawDownArrow
movs r0, 0
strb r0, [r4]
bl sub_80188DC
movs r0, 0x1
b _08018982
.pool
_0801897C:
movs r0, 0x2
_0801897E:
strb r0, [r4]
_08018980:
movs r0, 0
_08018982:
add sp, 0xC
pop {r4}
pop {r1}
bx r1
thumb_func_end mevent_0814257C
thumb_func_start sub_801898C
sub_801898C: @ 801898C
push {lr}
sub sp, 0xC
movs r0, 0
str r0, [sp]
ldr r0, =gUnknown_02022C58
str r0, [sp, 0x4]
adds r0, 0x1
str r0, [sp, 0x8]
movs r0, 0x1
movs r1, 0xD0
movs r2, 0x14
movs r3, 0x1
bl DrawDownArrow
add sp, 0xC
pop {r0}
bx r0
.pool
thumb_func_end sub_801898C
thumb_func_start sub_80189B4
sub_80189B4: @ 80189B4
push {lr}
sub sp, 0xC
movs r0, 0x1
str r0, [sp]
ldr r0, =gUnknown_02022C58
str r0, [sp, 0x4]
adds r0, 0x1
str r0, [sp, 0x8]
movs r0, 0x1
movs r1, 0xD0
movs r2, 0x14
movs r3, 0x1
bl DrawDownArrow
add sp, 0xC
pop {r0}
bx r0
.pool
thumb_func_end sub_80189B4
thumb_func_start sub_80189DC
sub_80189DC: @ 80189DC
push {r4,lr}
adds r4, r0, 0
ldrb r0, [r4]
cmp r0, 0
beq _080189EC
cmp r0, 0x1
beq _08018A08
b _08018A14
_080189EC:
bl sub_801898C
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x3
ands r0, r1
cmp r0, 0
beq _08018A14
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
b _08018A14
.pool
_08018A08:
bl sub_80189B4
movs r0, 0
strb r0, [r4]
movs r0, 0x1
b _08018A16
_08018A14:
movs r0, 0
_08018A16:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_80189DC
thumb_func_start sub_8018A1C
sub_8018A1C: @ 8018A1C
push {r4,lr}
adds r4, r0, 0
ldrb r0, [r4]
cmp r0, 0
bne _08018A2C
adds r0, r1, 0
bl sub_8018884
_08018A2C:
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
lsls r0, 24
lsrs r0, 24
cmp r0, 0x78
bhi _08018A3E
movs r0, 0
b _08018A48
_08018A3E:
movs r0, 0
strb r0, [r4]
bl sub_80188DC
movs r0, 0x1
_08018A48:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8018A1C
thumb_func_start sub_8018A50
sub_8018A50: @ 8018A50
push {r4,r5,lr}
sub sp, 0x24
lsls r2, 24
add r1, sp, 0x4
ldr r0, =gUnknown_082F0638
ldm r0!, {r3-r5}
stm r1!, {r3-r5}
ldm r0!, {r3-r5}
stm r1!, {r3-r5}
ldr r0, =gUnknown_082F05E0
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [sp, 0x1C]
str r1, [sp, 0x20]
cmp r2, 0
bne _08018A80
ldr r0, =gUnknown_082F0608
b _08018A82
.pool
_08018A80:
ldr r0, =gUnknown_082F0620
_08018A82:
str r0, [sp, 0x4]
add r0, sp, 0x4
bl sub_81DB41C
adds r3, r0, 0
movs r0, 0x1
ands r0, r3
cmp r0, 0
beq _08018A96
adds r3, 0x1
_08018A96:
lsls r1, r3, 24
ldr r0, =0x00ffffff
ldr r2, [sp, 0x1C]
ands r2, r0
orrs r2, r1
str r2, [sp, 0x1C]
cmp r3, 0x1D
bgt _08018ACC
movs r0, 0x1E
subs r0, r3
lsrs r1, r0, 31
adds r0, r1
asrs r0, 1
lsls r0, 24
lsrs r0, 16
ldr r1, =0xffff00ff
ands r1, r2
orrs r1, r0
str r1, [sp, 0x1C]
b _08018AD2
.pool
_08018ACC:
ldr r0, =0xffff00ff
ands r2, r0
str r2, [sp, 0x1C]
_08018AD2:
add r0, sp, 0x1C
movs r1, 0xE0
str r1, [sp]
add r1, sp, 0x4
movs r2, 0x1
movs r3, 0xA
bl DoMysteryGiftListMenu
adds r4, r0, 0
movs r0, 0x1
negs r0, r0
cmp r4, r0
beq _08018AFA
movs r0, 0x2
bl ClearWindowTilemap
movs r0, 0x2
movs r1, 0x1
bl CopyWindowToVram
_08018AFA:
adds r0, r4, 0
add sp, 0x24
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_8018A50
thumb_func_start sub_8018B08 thumb_func_start sub_8018B08
sub_8018B08: @ 8018B08 sub_8018B08: @ 8018B08
push {r4-r6,lr} push {r4-r6,lr}

View File

@ -20,12 +20,12 @@
#include "ereader_screen.h" #include "ereader_screen.h"
#include "international_string_util.h" #include "international_string_util.h"
#include "list_menu.h" #include "list_menu.h"
#include "string_util.h"
void bgid_upload_textbox_1(u8 bgId); void bgid_upload_textbox_1(u8 bgId);
void task_add_00_mystery_gift(void); void task_add_00_mystery_gift(void);
EWRAM_DATA u8 gUnknown_02022C58 = 0; EWRAM_DATA u8 gUnknown_02022C58[2] = {};
EWRAM_DATA u8 gUnknown_02022C59 = 0;
const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal");
const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz");
@ -492,3 +492,146 @@ void sub_8018798(u32 bg)
} }
} }
} }
void sub_8018838(bool32 arg)
{
switch (arg)
{
case 0:
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x11);
break;
case 1:
FillBgTilemapBufferRect(0, 0, 0, 2, 32, 30, 0x11);
break;
}
CopyBgTilemapBufferToVram(0);
}
void sub_8018884(const u8 *str)
{
StringExpandPlaceholders(gStringVar4, str);
FillWindowPixelBuffer(1, 0x11);
AddTextPrinterParameterized4(1, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4);
sub_8098858(1, 0x001, 0xF);
PutWindowTilemap(1);
CopyWindowToVram(1, 3);
}
void sub_80188DC(void)
{
rbox_fill_rectangle(1);
ClearWindowTilemap(1);
CopyWindowToVram(1, 1);
}
bool32 mevent_0814257C(u8 *textState, const u8 *str)
{
switch (*textState)
{
case 0:
sub_8018884(str);
goto inc;
case 1:
DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]);
if (({gMain.newKeys & (A_BUTTON | B_BUTTON);}))
{
inc:
(*textState)++;
}
break;
case 2:
DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]);
*textState = 0;
sub_80188DC();
return TRUE;
case 0xFF:
*textState = 2;
break;
}
return FALSE;
}
void sub_801898C(void)
{
DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]);
}
void sub_80189B4(void)
{
DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]);
}
bool32 sub_80189DC(u8 * textState)
{
switch (*textState)
{
case 0:
sub_801898C();
if (({gMain.newKeys & (A_BUTTON | B_BUTTON);}))
{
(*textState)++;
}
break;
case 1:
sub_80189B4();
*textState = 0;
return TRUE;
}
return FALSE;
}
bool32 sub_8018A1C(u8 * counter, const u8 * str)
{
if (*counter == 0)
{
sub_8018884(str);
}
if (++(*counter) > 120)
{
*counter = 0;
sub_80188DC();
return TRUE;
}
else
{
return FALSE;
}
}
s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2)
{
struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638;
struct WindowTemplate windowTemplate = gUnknown_082F05E0;
s32 r3;
s32 r4;
if (r2 == FALSE)
{
listMenuTemplate.items = gUnknown_082F0608;
}
else
{
listMenuTemplate.items = gUnknown_082F0620;
}
r3 = sub_81DB41C(&listMenuTemplate);
if (r3 & 1)
{
r3++;
}
windowTemplate.width = r3;
if (r3 < 30)
{
windowTemplate.tilemapLeft = (30 - r3) / 2;
}
else
{
windowTemplate.tilemapLeft = 0;
}
r4 = DoMysteryGiftListMenu(&windowTemplate, &listMenuTemplate, 1, 0x00A, 0xE0);
if (r4 != -1)
{
ClearWindowTilemap(2);
CopyWindowToVram(2, 1);
}
return r4;
}