Match InBoxInput_Normal, HandleInput_InParty, HandleInput_OnBox, and HandleInput_OnButtons

This commit is contained in:
GriffinR 2020-05-21 13:04:13 -04:00 committed by huderlem
parent 5019381911
commit 210862f7b6

View File

@ -6926,21 +6926,20 @@ static u8 HandleInput_InBox(void)
}
}
// This group of four functions handling input simply CANNOT be matched.
// GF must have written them in a really weird way, a way not a sane person could dream to reproduce.
#ifdef NONMATCHING
static u8 InBoxInput_Normal(void)
{
u8 retVal;
s8 cursorArea = sBoxCursorArea;
s8 cursorPosition = sBoxCursorPosition;
s8 cursorArea;
s8 cursorPosition;
do
{
cursorArea = sBoxCursorArea;
cursorPosition = sBoxCursorPosition;
sPSSData->field_CD2 = 0;
sPSSData->field_CD3 = 0;
sPSSData->field_CD7 = 0;
do
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
{
retVal = TRUE;
@ -7065,310 +7064,6 @@ static u8 InBoxInput_Normal(void)
return retVal;
}
#else
NAKED
static u8 InBoxInput_Normal(void)
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
ldr r0, =sBoxCursorArea\n\
ldrb r0, [r0]\n\
mov r8, r0\n\
ldr r2, =sBoxCursorPosition\n\
ldrb r4, [r2]\n\
ldr r5, =sPSSData\n\
ldr r0, [r5]\n\
ldr r1, =0x00000cd2\n\
mov r10, r1\n\
add r0, r10\n\
movs r1, 0\n\
strb r1, [r0]\n\
ldr r0, [r5]\n\
ldr r7, =0x00000cd3\n\
adds r0, r7\n\
strb r1, [r0]\n\
ldr r0, [r5]\n\
ldr r3, =0x00000cd7\n\
mov r9, r3\n\
add r0, r9\n\
strb r1, [r0]\n\
ldr r6, =gMain\n\
ldrh r1, [r6, 0x30]\n\
movs r0, 0x40\n\
ands r0, r1\n\
adds r3, r2, 0\n\
cmp r0, 0\n\
beq _080CF14C\n\
b _080CF33C\n\
_080CF14C:\n\
movs r0, 0x80\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF1A8\n\
movs r6, 0x1\n\
lsls r0, r4, 24\n\
movs r1, 0xC0\n\
lsls r1, 19\n\
adds r0, r1\n\
lsrs r4, r0, 24\n\
asrs r0, 24\n\
cmp r0, 0x1D\n\
bgt _080CF168\n\
b _080CF358\n\
_080CF168:\n\
movs r2, 0x3\n\
mov r8, r2\n\
subs r0, 0x1E\n\
lsls r0, 24\n\
asrs r0, 24\n\
movs r1, 0x3\n\
bl __divsi3\n\
lsls r0, 24\n\
lsrs r4, r0, 24\n\
ldr r0, [r5]\n\
add r0, r10\n\
strb r6, [r0]\n\
ldr r0, [r5]\n\
add r0, r9\n\
strb r6, [r0]\n\
b _080CF358\n\
.pool\n\
_080CF1A8:\n\
movs r0, 0x20\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF1DE\n\
movs r6, 0x1\n\
movs r0, 0\n\
ldrsb r0, [r3, r0]\n\
movs r1, 0x6\n\
bl __modsi3\n\
lsls r0, 24\n\
cmp r0, 0\n\
beq _080CF1CA\n\
lsls r0, r4, 24\n\
movs r3, 0xFF\n\
lsls r3, 24\n\
b _080CF34C\n\
_080CF1CA:\n\
ldr r0, [r5]\n\
adds r0, r7\n\
movs r1, 0xFF\n\
strb r1, [r0]\n\
lsls r0, r4, 24\n\
movs r1, 0xA0\n\
lsls r1, 19\n\
adds r0, r1\n\
lsrs r4, r0, 24\n\
b _080CF358\n\
_080CF1DE:\n\
movs r0, 0x10\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF212\n\
movs r6, 0x1\n\
movs r0, 0\n\
ldrsb r0, [r3, r0]\n\
adds r0, 0x1\n\
movs r1, 0x6\n\
bl __modsi3\n\
cmp r0, 0\n\
beq _080CF204\n\
lsls r0, r4, 24\n\
movs r2, 0x80\n\
lsls r2, 17\n\
adds r0, r2\n\
lsrs r4, r0, 24\n\
b _080CF358\n\
_080CF204:\n\
ldr r0, [r5]\n\
adds r0, r7\n\
strb r6, [r0]\n\
lsls r0, r4, 24\n\
movs r3, 0xFB\n\
lsls r3, 24\n\
b _080CF34C\n\
_080CF212:\n\
ldrh r1, [r6, 0x2E]\n\
movs r0, 0x8\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF220\n\
movs r6, 0x1\n\
b _080CF352\n\
_080CF220:\n\
movs r4, 0x1\n\
movs r0, 0x1\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF2E4\n\
bl sub_80CFA5C\n\
lsls r0, 24\n\
cmp r0, 0\n\
beq _080CF2E4\n\
ldr r0, =sCanOnlyMove\n\
ldrb r0, [r0]\n\
cmp r0, 0\n\
bne _080CF244\n\
movs r0, 0x8\n\
b _080CF366\n\
.pool\n\
_080CF244:\n\
ldr r1, [r5]\n\
ldrb r0, [r1, 0x1]\n\
cmp r0, 0x2\n\
bne _080CF254\n\
ldr r0, =sIsMonBeingMoved\n\
ldrb r0, [r0]\n\
cmp r0, 0x1\n\
bne _080CF2D4\n\
_080CF254:\n\
movs r0, 0\n\
bl sub_80CFF98\n\
subs r0, 0x1\n\
lsls r0, 24\n\
asrs r0, 24\n\
cmp r0, 0xE\n\
bhi _080CF2E4\n\
lsls r0, 2\n\
ldr r1, =_080CF278\n\
adds r0, r1\n\
ldr r0, [r0]\n\
mov pc, r0\n\
.pool\n\
.align 2, 0\n\
_080CF278:\n\
.4byte _080CF2B4\n\
.4byte _080CF2B8\n\
.4byte _080CF2BC\n\
.4byte _080CF2C0\n\
.4byte _080CF2C4\n\
.4byte _080CF2E4\n\
.4byte _080CF2E4\n\
.4byte _080CF2E4\n\
.4byte _080CF2E4\n\
.4byte _080CF2E4\n\
.4byte _080CF2E4\n\
.4byte _080CF2C8\n\
.4byte _080CF2CC\n\
.4byte _080CF2E4\n\
.4byte _080CF2D0\n\
_080CF2B4:\n\
movs r0, 0xB\n\
b _080CF366\n\
_080CF2B8:\n\
movs r0, 0xC\n\
b _080CF366\n\
_080CF2BC:\n\
movs r0, 0xD\n\
b _080CF366\n\
_080CF2C0:\n\
movs r0, 0xE\n\
b _080CF366\n\
_080CF2C4:\n\
movs r0, 0xF\n\
b _080CF366\n\
_080CF2C8:\n\
movs r0, 0x10\n\
b _080CF366\n\
_080CF2CC:\n\
movs r0, 0x11\n\
b _080CF366\n\
_080CF2D0:\n\
movs r0, 0x12\n\
b _080CF366\n\
_080CF2D4:\n\
ldr r2, =0x000021ff\n\
adds r0, r1, r2\n\
strb r4, [r0]\n\
movs r0, 0x14\n\
b _080CF366\n\
.pool\n\
_080CF2E4:\n\
ldr r2, =gMain\n\
ldrh r1, [r2, 0x2E]\n\
movs r0, 0x2\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF2F8\n\
movs r0, 0x13\n\
b _080CF366\n\
.pool\n\
_080CF2F8:\n\
ldr r0, =gSaveBlock2Ptr\n\
ldr r0, [r0]\n\
ldrb r0, [r0, 0x13]\n\
cmp r0, 0x1\n\
bne _080CF326\n\
ldrh r1, [r2, 0x2C]\n\
movs r0, 0x80\n\
lsls r0, 2\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF318\n\
movs r0, 0xA\n\
b _080CF366\n\
.pool\n\
_080CF318:\n\
movs r0, 0x80\n\
lsls r0, 1\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF326\n\
movs r0, 0x9\n\
b _080CF366\n\
_080CF326:\n\
ldrh r1, [r2, 0x2E]\n\
movs r0, 0x4\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF338\n\
bl sub_80CFDC4\n\
movs r0, 0\n\
b _080CF366\n\
_080CF338:\n\
movs r6, 0\n\
b _080CF364\n\
_080CF33C:\n\
movs r6, 0x1\n\
movs r0, 0\n\
ldrsb r0, [r2, r0]\n\
cmp r0, 0x5\n\
ble _080CF352\n\
lsls r0, r4, 24\n\
movs r3, 0xFA\n\
lsls r3, 24\n\
_080CF34C:\n\
adds r0, r3\n\
lsrs r4, r0, 24\n\
b _080CF358\n\
_080CF352:\n\
movs r0, 0x2\n\
mov r8, r0\n\
movs r4, 0\n\
_080CF358:\n\
cmp r6, 0\n\
beq _080CF364\n\
mov r0, r8\n\
adds r1, r4, 0\n\
bl sub_80CD894\n\
_080CF364:\n\
adds r0, r6, 0\n\
_080CF366:\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1\n\
");
}
#endif
static u8 InBoxInput_GrabbingMultiple(void)
{
@ -7526,22 +7221,23 @@ static u8 InBoxInput_MovingMultiple(void)
}
}
#ifdef NONMATCHING
static u8 HandleInput_InParty(void)
{
u8 retVal;
bool8 gotoBox;
s8 cursorArea = sBoxCursorArea;
s8 cursorPosition = sBoxCursorPosition;
s8 cursorArea;
s8 cursorPosition;
do
{
cursorArea = sBoxCursorArea;
cursorPosition = sBoxCursorPosition;
sPSSData->field_CD3 = 0;
sPSSData->field_CD2 = 0;
sPSSData->field_CD7 = 0;
gotoBox = FALSE;
retVal = 0;
do
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
{
if (--cursorPosition < 0)
@ -7647,290 +7343,19 @@ static u8 HandleInput_InParty(void)
return retVal;
}
#else
NAKED
static u8 HandleInput_InParty(void)
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r9\n\
mov r6, r8\n\
push {r6,r7}\n\
ldr r0, =sBoxCursorArea\n\
ldrb r0, [r0]\n\
mov r9, r0\n\
ldr r6, =sBoxCursorPosition\n\
ldrb r4, [r6]\n\
ldr r2, =sPSSData\n\
ldr r0, [r2]\n\
ldr r1, =0x00000cd3\n\
adds r0, r1\n\
movs r1, 0\n\
strb r1, [r0]\n\
ldr r0, [r2]\n\
ldr r3, =0x00000cd2\n\
adds r0, r3\n\
strb r1, [r0]\n\
ldr r0, [r2]\n\
adds r3, 0x5\n\
adds r0, r3\n\
strb r1, [r0]\n\
mov r8, r1\n\
movs r7, 0\n\
ldr r1, =gMain\n\
ldrh r3, [r1, 0x30]\n\
movs r0, 0x40\n\
ands r0, r3\n\
adds r5, r6, 0\n\
mov r12, r1\n\
cmp r0, 0\n\
beq _080CF608\n\
b _080CF7A8\n\
_080CF608:\n\
movs r0, 0x80\n\
ands r0, r3\n\
cmp r0, 0\n\
beq _080CF64C\n\
lsls r0, r4, 24\n\
movs r1, 0x80\n\
lsls r1, 17\n\
adds r0, r1\n\
lsrs r4, r0, 24\n\
asrs r0, 24\n\
cmp r0, 0x6\n\
ble _080CF622\n\
movs r4, 0\n\
_080CF622:\n\
lsls r0, r4, 24\n\
asrs r0, 24\n\
movs r1, 0\n\
ldrsb r1, [r5, r1]\n\
cmp r0, r1\n\
bne _080CF630\n\
b _080CF7C6\n\
_080CF630:\n\
movs r7, 0x1\n\
b _080CF7CA\n\
.pool\n\
_080CF64C:\n\
movs r0, 0x20\n\
ands r0, r3\n\
cmp r0, 0\n\
beq _080CF670\n\
ldrb r1, [r5]\n\
movs r0, 0\n\
ldrsb r0, [r5, r0]\n\
cmp r0, 0\n\
beq _080CF670\n\
movs r7, 0x1\n\
ldr r0, [r2]\n\
ldr r2, =0x00000cd6\n\
adds r0, r2\n\
strb r1, [r0]\n\
movs r4, 0\n\
b _080CF7C6\n\
.pool\n\
_080CF670:\n\
mov r3, r12\n\
ldrh r1, [r3, 0x30]\n\
movs r0, 0x10\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF69E\n\
movs r0, 0\n\
ldrsb r0, [r5, r0]\n\
cmp r0, 0\n\
bne _080CF694\n\
movs r7, 0x1\n\
ldr r0, [r2]\n\
ldr r1, =0x00000cd6\n\
adds r0, r1\n\
ldrb r4, [r0]\n\
b _080CF7C6\n\
.pool\n\
_080CF694:\n\
movs r7, 0x6\n\
movs r2, 0\n\
mov r9, r2\n\
movs r4, 0\n\
b _080CF7C6\n\
_080CF69E:\n\
mov r3, r12\n\
ldrh r1, [r3, 0x2E]\n\
movs r0, 0x1\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF75C\n\
movs r0, 0\n\
ldrsb r0, [r5, r0]\n\
cmp r0, 0x6\n\
bne _080CF6C4\n\
ldr r0, [r2]\n\
ldrb r0, [r0, 0x1]\n\
cmp r0, 0x1\n\
bne _080CF6BE\n\
movs r0, 0x4\n\
b _080CF7D8\n\
_080CF6BE:\n\
movs r0, 0x1\n\
mov r8, r0\n\
b _080CF75C\n\
_080CF6C4:\n\
bl sub_80CFA5C\n\
lsls r0, 24\n\
cmp r0, 0\n\
beq _080CF75C\n\
ldr r0, =sCanOnlyMove\n\
ldrb r0, [r0]\n\
cmp r0, 0\n\
bne _080CF6E0\n\
movs r0, 0x8\n\
b _080CF7D8\n\
.pool\n\
_080CF6E0:\n\
movs r0, 0\n\
bl sub_80CFF98\n\
subs r0, 0x1\n\
lsls r0, 24\n\
asrs r0, 24\n\
cmp r0, 0xE\n\
bhi _080CF75C\n\
lsls r0, 2\n\
ldr r1, =_080CF700\n\
adds r0, r1\n\
ldr r0, [r0]\n\
mov pc, r0\n\
.pool\n\
.align 2, 0\n\
_080CF700:\n\
.4byte _080CF73C\n\
.4byte _080CF740\n\
.4byte _080CF744\n\
.4byte _080CF748\n\
.4byte _080CF74C\n\
.4byte _080CF75C\n\
.4byte _080CF75C\n\
.4byte _080CF75C\n\
.4byte _080CF75C\n\
.4byte _080CF75C\n\
.4byte _080CF75C\n\
.4byte _080CF750\n\
.4byte _080CF754\n\
.4byte _080CF75C\n\
.4byte _080CF758\n\
_080CF73C:\n\
movs r0, 0xB\n\
b _080CF7D8\n\
_080CF740:\n\
movs r0, 0xC\n\
b _080CF7D8\n\
_080CF744:\n\
movs r0, 0xD\n\
b _080CF7D8\n\
_080CF748:\n\
movs r0, 0xE\n\
b _080CF7D8\n\
_080CF74C:\n\
movs r0, 0xF\n\
b _080CF7D8\n\
_080CF750:\n\
movs r0, 0x10\n\
b _080CF7D8\n\
_080CF754:\n\
movs r0, 0x11\n\
b _080CF7D8\n\
_080CF758:\n\
movs r0, 0x12\n\
b _080CF7D8\n\
_080CF75C:\n\
ldr r2, =gMain\n\
ldrh r1, [r2, 0x2E]\n\
movs r0, 0x2\n\
ands r0, r1\n\
mov r12, r2\n\
cmp r0, 0\n\
beq _080CF784\n\
ldr r0, =sPSSData\n\
ldr r0, [r0]\n\
ldrb r0, [r0, 0x1]\n\
cmp r0, 0x1\n\
bne _080CF780\n\
movs r0, 0x13\n\
b _080CF7D8\n\
.pool\n\
_080CF780:\n\
movs r1, 0x1\n\
mov r8, r1\n\
_080CF784:\n\
mov r2, r8\n\
cmp r2, 0\n\
beq _080CF794\n\
movs r7, 0x6\n\
movs r3, 0\n\
mov r9, r3\n\
movs r4, 0\n\
b _080CF7C6\n\
_080CF794:\n\
mov r0, r12\n\
ldrh r1, [r0, 0x2E]\n\
movs r0, 0x4\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF7C6\n\
bl sub_80CFDC4\n\
movs r0, 0\n\
b _080CF7D8\n\
_080CF7A8:\n\
lsls r0, r4, 24\n\
movs r1, 0xFF\n\
lsls r1, 24\n\
adds r0, r1\n\
lsrs r4, r0, 24\n\
cmp r0, 0\n\
bge _080CF7B8\n\
movs r4, 0x6\n\
_080CF7B8:\n\
lsls r0, r4, 24\n\
asrs r0, 24\n\
movs r1, 0\n\
ldrsb r1, [r6, r1]\n\
cmp r0, r1\n\
beq _080CF7C6\n\
movs r7, 0x1\n\
_080CF7C6:\n\
cmp r7, 0\n\
beq _080CF7D6\n\
_080CF7CA:\n\
cmp r7, 0x6\n\
beq _080CF7D6\n\
mov r0, r9\n\
adds r1, r4, 0\n\
bl sub_80CD894\n\
_080CF7D6:\n\
adds r0, r7, 0\n\
_080CF7D8:\n\
pop {r3,r4}\n\
mov r8, r3\n\
mov r9, r4\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1");
}
#endif
#ifdef NONMATCHING
static u8 HandleInput_OnBox(void)
{
u8 retVal;
s8 cursorArea;
s8 cursorPosition;
do
{
sPSSData->field_CD3 = 0;
sPSSData->field_CD2 = 0;
sPSSData->field_CD7 = 0;
do
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
{
retVal = 1;
@ -7989,152 +7414,30 @@ static u8 HandleInput_OnBox(void)
return retVal;
}
#else
NAKED
static u8 HandleInput_OnBox(void)
{
asm_unified("\n\
push {r4-r6,lr}\n\
ldr r3, =sPSSData\n\
ldr r0, [r3]\n\
ldr r1, =0x00000cd3\n\
adds r0, r1\n\
movs r1, 0\n\
strb r1, [r0]\n\
ldr r0, [r3]\n\
ldr r2, =0x00000cd2\n\
adds r0, r2\n\
strb r1, [r0]\n\
ldr r0, [r3]\n\
ldr r5, =0x00000cd7\n\
adds r0, r5\n\
strb r1, [r0]\n\
ldr r1, =gMain\n\
ldrh r2, [r1, 0x30]\n\
movs r0, 0x40\n\
ands r0, r2\n\
cmp r0, 0\n\
bne _080CF8AA\n\
movs r0, 0x80\n\
ands r0, r2\n\
cmp r0, 0\n\
beq _080CF834\n\
movs r4, 0x1\n\
movs r1, 0\n\
movs r6, 0x2\n\
b _080CF8B6\n\
.pool\n\
_080CF834:\n\
ldrh r2, [r1, 0x2C]\n\
movs r0, 0x20\n\
ands r0, r2\n\
cmp r0, 0\n\
bne _080CF85A\n\
movs r0, 0x10\n\
ands r0, r2\n\
cmp r0, 0\n\
bne _080CF86E\n\
ldr r0, =gSaveBlock2Ptr\n\
ldr r0, [r0]\n\
ldrb r0, [r0, 0x13]\n\
cmp r0, 0x1\n\
bne _080CF872\n\
movs r0, 0x80\n\
lsls r0, 2\n\
ands r0, r2\n\
cmp r0, 0\n\
beq _080CF864\n\
_080CF85A:\n\
movs r0, 0xA\n\
b _080CF8D2\n\
.pool\n\
_080CF864:\n\
movs r0, 0x80\n\
lsls r0, 1\n\
ands r0, r2\n\
cmp r0, 0\n\
beq _080CF872\n\
_080CF86E:\n\
movs r0, 0x9\n\
b _080CF8D2\n\
_080CF872:\n\
ldrh r1, [r1, 0x2E]\n\
movs r0, 0x1\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF88A\n\
movs r0, 0\n\
bl sub_80CD1A8\n\
bl AddBoxMenu\n\
movs r0, 0x7\n\
b _080CF8D2\n\
_080CF88A:\n\
movs r0, 0x2\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF896\n\
movs r0, 0x13\n\
b _080CF8D2\n\
_080CF896:\n\
movs r0, 0x4\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF8A6\n\
bl sub_80CFDC4\n\
movs r0, 0\n\
b _080CF8D2\n\
_080CF8A6:\n\
movs r4, 0\n\
b _080CF8D0\n\
_080CF8AA:\n\
movs r4, 0x1\n\
movs r1, 0x3\n\
movs r6, 0\n\
ldr r0, [r3]\n\
adds r0, r5\n\
strb r4, [r0]\n\
_080CF8B6:\n\
cmp r4, 0\n\
beq _080CF8D0\n\
lsls r5, r1, 24\n\
cmp r1, 0x2\n\
beq _080CF8C6\n\
movs r0, 0\n\
bl sub_80CD1A8\n\
_080CF8C6:\n\
lsrs r0, r5, 24\n\
lsls r1, r6, 24\n\
lsrs r1, 24\n\
bl sub_80CD894\n\
_080CF8D0:\n\
adds r0, r4, 0\n\
_080CF8D2:\n\
pop {r4-r6}\n\
pop {r1}\n\
bx r1\n\
");
}
#endif
#ifdef NONMATCHING
static u8 HandleInput_OnButtons(void)
{
u8 retVal;
s8 cursorArea = sBoxCursorArea;
s8 cursorPosition = sBoxCursorPosition;
s8 cursorArea;
s8 cursorPosition;
do
{
cursorArea = sBoxCursorArea;
cursorPosition = sBoxCursorPosition;
sPSSData->field_CD3 = 0;
sPSSData->field_CD2 = 0;
sPSSData->field_CD7 = 0;
do
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
{
retVal = 1;
cursorArea = CURSOR_AREA_IN_BOX;
sPSSData->field_CD2 = -1;
cursorPosition = (sBoxCursorPosition == 0) ? IN_BOX_COUNT - 1 - 5 : IN_BOX_COUNT - 1;
if (sBoxCursorPosition == 0)
cursorPosition = IN_BOX_COUNT - 1 - 5;
else
cursorPosition = IN_BOX_COUNT - 1;
sPSSData->field_CD7 = 1;
break;
}
@ -8181,148 +7484,6 @@ static u8 HandleInput_OnButtons(void)
return retVal;
}
#else
NAKED
static u8 HandleInput_OnButtons(void)
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r8\n\
push {r7}\n\
ldr r0, =sBoxCursorArea\n\
ldrb r0, [r0]\n\
mov r8, r0\n\
ldr r0, =sBoxCursorPosition\n\
mov r12, r0\n\
ldrb r2, [r0]\n\
ldr r3, =sPSSData\n\
ldr r0, [r3]\n\
ldr r1, =0x00000cd3\n\
adds r0, r1\n\
movs r1, 0\n\
strb r1, [r0]\n\
ldr r0, [r3]\n\
ldr r6, =0x00000cd2\n\
adds r0, r6\n\
strb r1, [r0]\n\
ldr r0, [r3]\n\
ldr r5, =0x00000cd7\n\
adds r0, r5\n\
strb r1, [r0]\n\
ldr r7, =gMain\n\
ldrh r1, [r7, 0x30]\n\
movs r0, 0x40\n\
ands r0, r1\n\
adds r4, r3, 0\n\
cmp r0, 0\n\
bne _080CF9B2\n\
movs r0, 0x88\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF944\n\
movs r7, 0x1\n\
movs r0, 0x2\n\
mov r8, r0\n\
movs r2, 0\n\
ldr r0, [r4]\n\
b _080CF9D0\n\
.pool\n\
_080CF944:\n\
movs r0, 0x20\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF960\n\
movs r7, 0x1\n\
lsls r0, r2, 24\n\
movs r1, 0xFF\n\
lsls r1, 24\n\
adds r0, r1\n\
lsrs r2, r0, 24\n\
cmp r0, 0\n\
bge _080CF9D4\n\
movs r2, 0x1\n\
b _080CF9D4\n\
_080CF960:\n\
movs r0, 0x10\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF97E\n\
movs r7, 0x1\n\
lsls r0, r2, 24\n\
movs r1, 0x80\n\
lsls r1, 17\n\
adds r0, r1\n\
lsrs r2, r0, 24\n\
asrs r0, 24\n\
cmp r0, 0x1\n\
ble _080CF9D4\n\
movs r2, 0\n\
b _080CF9D4\n\
_080CF97E:\n\
ldrh r1, [r7, 0x2E]\n\
movs r0, 0x1\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF992\n\
movs r0, 0x4\n\
cmp r2, 0\n\
bne _080CF9E2\n\
movs r0, 0x5\n\
b _080CF9E2\n\
_080CF992:\n\
movs r0, 0x2\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF99E\n\
movs r0, 0x13\n\
b _080CF9E2\n\
_080CF99E:\n\
movs r0, 0x4\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _080CF9AE\n\
bl sub_80CFDC4\n\
movs r0, 0\n\
b _080CF9E2\n\
_080CF9AE:\n\
movs r7, 0\n\
b _080CF9E0\n\
_080CF9B2:\n\
movs r7, 0x1\n\
movs r0, 0\n\
mov r8, r0\n\
ldr r0, [r3]\n\
adds r0, r6\n\
movs r1, 0xFF\n\
strb r1, [r0]\n\
mov r1, r12\n\
movs r0, 0\n\
ldrsb r0, [r1, r0]\n\
movs r2, 0x1D\n\
cmp r0, 0\n\
bne _080CF9CE\n\
movs r2, 0x18\n\
_080CF9CE:\n\
ldr r0, [r3]\n\
_080CF9D0:\n\
adds r0, r5\n\
strb r7, [r0]\n\
_080CF9D4:\n\
cmp r7, 0\n\
beq _080CF9E0\n\
mov r0, r8\n\
adds r1, r2, 0\n\
bl sub_80CD894\n\
_080CF9E0:\n\
adds r0, r7, 0\n\
_080CF9E2:\n\
pop {r3}\n\
mov r8, r3\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1");
}
#endif
static u8 HandleInput(void)
{