through sub_8017168

This commit is contained in:
PikalaxALT 2019-03-27 13:16:10 -04:00
parent 9a8b001ebf
commit 8e0773675c
3 changed files with 72 additions and 143 deletions

View File

@ -5,149 +5,6 @@
.text
thumb_func_start PrintOnTextbox
PrintOnTextbox: @ 8017064
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
ldrb r0, [r4]
cmp r0, 0
beq _08017076
cmp r0, 0x1
beq _0801709C
b _080170AE
_08017076:
bl sub_81973A4
movs r0, 0
movs r1, 0x1
bl DrawDialogueFrame
ldr r0, =gStringVar4
adds r1, r5, 0
bl StringExpandPlaceholders
movs r0, 0x1
bl AddTextPrinterForMessage_2
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
b _080170AE
.pool
_0801709C:
bl RunTextPrintersAndIsPrinter0Active
lsls r0, 16
lsrs r0, 16
cmp r0, 0
bne _080170AE
strb r0, [r4]
movs r0, 0x1
b _080170B0
_080170AE:
movs r0, 0
_080170B0:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end PrintOnTextbox
thumb_func_start sub_80170B8
sub_80170B8: @ 80170B8
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
ldrb r0, [r4]
cmp r0, 0
beq _080170CA
cmp r0, 0x1
beq _080170E0
b _0801710C
_080170CA:
cmp r5, 0
beq _080170D4
movs r0, 0x3
negs r0, r0
b _08017110
_080170D4:
bl DisplayYesNoMenuDefaultYes
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
b _0801710C
_080170E0:
cmp r5, 0
beq _080170F2
bl sub_8198C78
movs r0, 0
strb r0, [r4]
movs r0, 0x3
negs r0, r0
b _08017110
_080170F2:
bl Menu_ProcessInputNoWrapClearOnChoose
lsls r0, 24
asrs r1, r0, 24
movs r2, 0x80
lsls r2, 17
adds r0, r2
lsrs r0, 24
cmp r0, 0x2
bhi _0801710C
strb r5, [r4]
adds r0, r1, 0
b _08017110
_0801710C:
movs r0, 0x2
negs r0, r0
_08017110:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_80170B8
thumb_func_start sub_8017118
sub_8017118: @ 8017118
push {r4,lr}
sub sp, 0x8
bl AddWindow
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
adds r0, r4, 0
movs r1, 0
bl DrawStdWindowFrame
adds r0, r4, 0
movs r1, 0xFF
bl FillWindowPixelBuffer
ldr r2, =gUnknown_082EFD94
movs r0, 0x1
str r0, [sp]
movs r0, 0x6
str r0, [sp, 0x4]
adds r0, r4, 0
movs r1, 0x1
movs r3, 0x8
bl sub_80173E0
adds r0, r4, 0
movs r1, 0x2
bl CopyWindowToVram
adds r0, r4, 0
bl PutWindowTilemap
adds r0, r4, 0
add sp, 0x8
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_8017118
thumb_func_start sub_8017168
sub_8017168: @ 8017168
push {lr}
lsls r0, 24
lsrs r0, 24
bl RemoveWindow
pop {r0}
bx r0
thumb_func_end sub_8017168
thumb_func_start sub_8017178
sub_8017178: @ 8017178
push {r4-r7,lr}

View File

@ -100,5 +100,6 @@ 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);
void sub_8198C78(void);
#endif // GUARD_MENU_H

View File

@ -331,6 +331,7 @@ extern const u8 gUnknown_082EF298[];
extern const u8 gUnknown_082EF65C[];
extern const u8 gUnknown_082EF6E4[];
extern const u8 gUnknown_082EF718[];
extern const u8 gUnknown_082EFD94[];
extern const u32 gUnknown_082F00C4[];
@ -3622,3 +3623,73 @@ bool32 sub_801704C(void)
return FALSE;
}
}
bool8 PrintOnTextbox(u8 *textState, const u8 *str)
{
switch (*textState)
{
case 0:
sub_81973A4();
DrawDialogueFrame(0, 1);
StringExpandPlaceholders(gStringVar4, str);
AddTextPrinterForMessage_2(TRUE);
(*textState)++;
break;
case 1:
if (!RunTextPrintersAndIsPrinter0Active())
{
*textState = 0;
return TRUE;
}
break;
}
return FALSE;
}
s8 sub_80170B8(u8 *arg0, bool32 arg1)
{
s8 r1;
switch (*arg0)
{
case 0:
if (arg1)
{
return -3;
}
DisplayYesNoMenuDefaultYes();
(*arg0)++;
break;
case 1:
if (arg1)
{
sub_8198C78();
*arg0 = 0;
return -3;
}
r1 = Menu_ProcessInputNoWrapClearOnChoose();
if (r1 == -1 || r1 == 0 || r1 == 1)
{
*arg0 = 0;
return r1;
}
break;
}
return -2;
}
u8 sub_8017118(struct WindowTemplate * template)
{
u8 windowId = AddWindow(template);
DrawStdWindowFrame(windowId, FALSE);
FillWindowPixelBuffer(windowId, 0xFF);
sub_80173E0(windowId, 1, gUnknown_082EFD94, 8, 1, 6);
CopyWindowToVram(windowId, 2);
PutWindowTilemap(windowId);
return windowId;
}
void sub_8017168(u8 windowId)
{
RemoveWindow(windowId);
}