Merge branch 'menu' of git://github.com/PikalaxALT/pokeemerald into PikalaxALT-menu

This commit is contained in:
Diegoisawesome 2018-02-07 00:16:11 -06:00
commit 41c389e565

View File

@ -2000,21 +2000,86 @@ void sub_819A024(u8 windowId, const u8 *src, u16 a2, u16 a3)
}
//Screw this function, it's long and unreferenced and ugh
/*void sub_819A080(u16 *a0, u16 *a1, u16 a2, u16 a3, u16 a4, u16 a5, u16 a6, u16 a7)
struct UnkStruct_819A080 {
u8 *unk00;
u16 unk04;
u16 unk06;
};
#ifdef NONMATCHING
void sub_819A080(struct UnkStruct_819A080 *a0, struct UnkStruct_819A080 *a1, u16 a2, u16 a3, u16 a4, u16 a5, u16 a6, u16 a7)
{
int v1 = ((a0[2] - a4) > a6) ? (a6 + a2) : (a0[2] - a4);
int v2;
if (a0[3] - a5 < a7)
v2 = a3 + a0[3] - a5;
else
v2 = a3 + a7;
}*/
// r3 = a3
// r4 = a5
// r1 = a6
// r5 = a7
// sp+00 = a0
// sp+04 = a1
// sp+08 = a2
// sp+0c = a4
int sp10 = a1->unk04 - a4 > a6 ? a6 + a2 : a1->unk04 - a4;
int sp14 = a0->unk06 - a5 < a7 ? a3 + a0->unk06 - a5 : a3 + a7;
int sp18 = (a0->unk04 + (a0->unk04 & 0x7)) / 8;
int sp1c = (a1->unk04 + (a1->unk04 & 0x7)) / 8;
int r12; // sp+20
int r8; // sp+24
int r5;
int r6;
u16 r2;
for (r12 = a3, r8 = a5; r12 < sp14; r12++, r8++)
{
for (r5 = a2, r6 = a4; a5 < sp10; a5++, a6++)
{
u8 *r3 = a0->unk00 + ((r5 >> 1) & 0x3) + ((r5 >> 3) << 5) + (((r12 >> 3) * sp18) << 5) + ((r12 & 0x7) << 2);
u8 *r4 = a1->unk00 + ((r6 >> 1) & 0x3) + ((r6 >> 3) << 5) + (((r8 >> 3) * sp1c) << 5) + ((r8 & 0x7) << 2);
if (((uintptr_t)r4) & 0x1)
{
u16 *r4_2 = (u16 *)(r4 - 1);
if (r6 & 0x1)
{
r2 = *r4_2 & 0x0fff;
if (r5 & 0x1)
*r4_2 = r2 | ((*r3 & 0xf0) << 8);
else
*r4_2 = r2 | ((*r3 & 0x0f) << 12);
}
else
{
r2 = *r4_2 * 0xf0ff;
if (r5 & 0x1)
*r4_2 = r2 | ((*r3 & 0xf0) << 4);
else
*r4_2 = r2 | ((*r3 & 0x0f) << 8);
}
}
else
{
u16 *r4_2 = (u16 *)r4;
if (r6 & 1)
{
r2 = *r4_2 & 0xff0f;
if (r5 & 1)
*r4_2 = r2 | ((*r3 & 0xf0) << 0);
else
*r4_2 = r2 | ((*r3 & 0x0f) << 4);
}
else
{
r2 = *r4_2 & 0xfff0;
if (r5 & 1)
*r4_2 = r2 | ((*r3 & 0xf0) >> 4);
else
*r4_2 = r2 | ((*r3 & 0x0f) >> 0);
}
}
}
}
}
#else
__attribute__((naked))
void sub_819A080(u16 *a0, u16 *a1, u16 a2, u16 a3, u16 a4, u16 a5, u16 a6, u16 a7)
void sub_819A080(struct UnkStruct_819A080 *a0, struct UnkStruct_819A080 *a1, u16 a2, u16 a3, u16 a4, u16 a5, u16 a6, u16 a7)
{
asm("push {r4-r7,lr}\n\
mov r7, r10\n\
@ -2264,6 +2329,7 @@ _0819A24A:\n\
pop {r0}\n\
bx r0\n");
}
#endif
void sub_819A25C(u8 palOffset, u16 speciesId)
{