mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
nonmatching sub_800F638
This commit is contained in:
parent
68e9b5719c
commit
58def21c62
@ -5,100 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_800F638
|
||||
sub_800F638: @ 800F638
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
ldr r0, =gUnknown_03005000
|
||||
ldr r2, [r0, 0x70]
|
||||
mov r10, r2
|
||||
movs r5, 0
|
||||
adds r2, r0, 0
|
||||
adds r2, 0x6E
|
||||
ldrh r3, [r2]
|
||||
cmp r5, r3
|
||||
bge _0800F6D4
|
||||
mov r9, r0
|
||||
ldr r0, =gUnknown_03000D90
|
||||
mov r8, r0
|
||||
_0800F65A:
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
lsrs r7, r1, 1
|
||||
adds r6, r5, 0x1
|
||||
cmp r0, 0
|
||||
bne _0800F6C8
|
||||
ldr r1, =0xffff8900
|
||||
adds r0, r1, 0
|
||||
adds r1, r5, 0
|
||||
orrs r1, r0
|
||||
mov r2, r8
|
||||
strh r1, [r2]
|
||||
movs r4, 0
|
||||
lsls r0, r5, 1
|
||||
ldr r3, =gUnknown_03000D80
|
||||
mov r12, r3
|
||||
adds r0, r5
|
||||
lsls r0, 2
|
||||
mov r1, r10
|
||||
adds r2, r0, r1
|
||||
mov r3, r8
|
||||
adds r3, 0x2
|
||||
_0800F686:
|
||||
ldrb r1, [r2, 0x1]
|
||||
lsls r1, 8
|
||||
ldrb r0, [r2]
|
||||
orrs r0, r1
|
||||
strh r0, [r3]
|
||||
adds r2, 0x2
|
||||
adds r3, 0x2
|
||||
adds r4, 0x1
|
||||
cmp r4, 0x6
|
||||
ble _0800F686
|
||||
movs r4, 0
|
||||
ldr r2, =gUnknown_03000D90
|
||||
ldr r1, =gUnknown_03000D80
|
||||
_0800F6A0:
|
||||
ldrh r0, [r2]
|
||||
lsrs r0, 8
|
||||
strb r0, [r1, 0x1]
|
||||
ldrh r0, [r2]
|
||||
strb r0, [r1]
|
||||
adds r2, 0x2
|
||||
adds r1, 0x2
|
||||
adds r4, 0x1
|
||||
cmp r4, 0x6
|
||||
ble _0800F6A0
|
||||
ldr r0, =gUnknown_03005000+0x9E8
|
||||
mov r1, r12
|
||||
bl sub_800D888
|
||||
movs r1, 0x1
|
||||
lsls r1, r5
|
||||
mov r2, r9
|
||||
ldr r0, [r2, 0x78]
|
||||
orrs r0, r1
|
||||
str r0, [r2, 0x78]
|
||||
_0800F6C8:
|
||||
adds r1, r7, 0
|
||||
adds r5, r6, 0
|
||||
ldr r3, =gUnknown_03005000+0x6E
|
||||
ldrh r3, [r3]
|
||||
cmp r5, r3
|
||||
blt _0800F65A
|
||||
_0800F6D4:
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_800F638
|
||||
|
||||
thumb_func_start sub_800F6FC
|
||||
sub_800F6FC: @ 800F6FC
|
||||
push {lr}
|
||||
|
@ -96,9 +96,9 @@ struct UnkRfuStruct_1 {
|
||||
struct UnkRfuStruct_2_Sub_6c {
|
||||
/* 0x00 */ u16 unk_00;
|
||||
/* 0x02 */ u16 unk_02;
|
||||
/* 0x04 */ u32 unk_04;
|
||||
/* 0x04 */ u8 *unk_04;
|
||||
/* 0x08 */ u32 unk_08;
|
||||
/* 0x0c */ u8 filler_0c[4];
|
||||
/* 0x0c */ u32 unk_0c;
|
||||
/* 0x10 */ u8 unk_10;
|
||||
/* 0x11 */ u8 unk_11;
|
||||
/* 0x12 */ u8 unk_12;
|
||||
|
125
src/link_rfu.c
125
src/link_rfu.c
@ -3191,3 +3191,128 @@ bool32 sub_800F4F0(void)
|
||||
}
|
||||
return sub_800F0B8();
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
void sub_800F638(u8 unused, u32 flags)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
u8 *r10 = gUnknown_03005000.unk_6c.unk_04;
|
||||
for (i = 0; i < gUnknown_03005000.unk_6c.unk_02; i++)
|
||||
{
|
||||
if (!(flags & 1))
|
||||
{
|
||||
gUnknown_03000D90[0] = (~0x76ff) | i;
|
||||
for (j = 0; j < 7; j++)
|
||||
{
|
||||
gUnknown_03000D90[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0];
|
||||
}
|
||||
for (j = 0; j < 7; j++)
|
||||
// This should be an ascending loop.
|
||||
// GCC compiles this as descending.
|
||||
{
|
||||
gUnknown_03000D80[2 * j + 1] = gUnknown_03000D90[j] >> 8;
|
||||
gUnknown_03000D80[2 * j + 0] = gUnknown_03000D90[j];
|
||||
}
|
||||
sub_800D888(&gUnknown_03005000.unk_9e8, gUnknown_03000D80);
|
||||
gUnknown_03005000.unk_6c.unk_0c |= (1 << i);
|
||||
}
|
||||
flags >>= 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
__attribute__((naked)) void sub_800F638(u8 unused, u32 flags)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
"\tmov r6, r9\n"
|
||||
"\tmov r5, r8\n"
|
||||
"\tpush {r5-r7}\n"
|
||||
"\tldr r0, =gUnknown_03005000\n"
|
||||
"\tldr r2, [r0, 0x70]\n"
|
||||
"\tmov r10, r2\n"
|
||||
"\tmovs r5, 0\n"
|
||||
"\tadds r2, r0, 0\n"
|
||||
"\tadds r2, 0x6E\n"
|
||||
"\tldrh r3, [r2]\n"
|
||||
"\tcmp r5, r3\n"
|
||||
"\tbge _0800F6D4\n"
|
||||
"\tmov r9, r0\n"
|
||||
"\tldr r0, =gUnknown_03000D90\n"
|
||||
"\tmov r8, r0\n"
|
||||
"_0800F65A:\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tands r0, r1\n"
|
||||
"\tlsrs r7, r1, 1\n"
|
||||
"\tadds r6, r5, 0x1\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _0800F6C8\n"
|
||||
"\tldr r1, =0xffff8900\n"
|
||||
"\tadds r0, r1, 0\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tmov r2, r8\n"
|
||||
"\tstrh r1, [r2]\n"
|
||||
"\tmovs r4, 0\n"
|
||||
"\tlsls r0, r5, 1\n"
|
||||
"\tldr r3, =gUnknown_03000D80\n"
|
||||
"\tmov r12, r3\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tlsls r0, 2\n"
|
||||
"\tmov r1, r10\n"
|
||||
"\tadds r2, r0, r1\n"
|
||||
"\tmov r3, r8\n"
|
||||
"\tadds r3, 0x2\n"
|
||||
"_0800F686:\n"
|
||||
"\tldrb r1, [r2, 0x1]\n"
|
||||
"\tlsls r1, 8\n"
|
||||
"\tldrb r0, [r2]\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstrh r0, [r3]\n"
|
||||
"\tadds r2, 0x2\n"
|
||||
"\tadds r3, 0x2\n"
|
||||
"\tadds r4, 0x1\n"
|
||||
"\tcmp r4, 0x6\n"
|
||||
"\tble _0800F686\n"
|
||||
"\tmovs r4, 0\n"
|
||||
"\tldr r2, =gUnknown_03000D90\n"
|
||||
"\tldr r1, =gUnknown_03000D80\n"
|
||||
"_0800F6A0:\n"
|
||||
"\tldrh r0, [r2]\n"
|
||||
"\tlsrs r0, 8\n"
|
||||
"\tstrb r0, [r1, 0x1]\n"
|
||||
"\tldrh r0, [r2]\n"
|
||||
"\tstrb r0, [r1]\n"
|
||||
"\tadds r2, 0x2\n"
|
||||
"\tadds r1, 0x2\n"
|
||||
"\tadds r4, 0x1\n"
|
||||
"\tcmp r4, 0x6\n"
|
||||
"\tble _0800F6A0\n"
|
||||
"\tldr r0, =gUnknown_03005000+0x9E8\n"
|
||||
"\tmov r1, r12\n"
|
||||
"\tbl sub_800D888\n"
|
||||
"\tmovs r1, 0x1\n"
|
||||
"\tlsls r1, r5\n"
|
||||
"\tmov r2, r9\n"
|
||||
"\tldr r0, [r2, 0x78]\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstr r0, [r2, 0x78]\n"
|
||||
"_0800F6C8:\n"
|
||||
"\tadds r1, r7, 0\n"
|
||||
"\tadds r5, r6, 0\n"
|
||||
"\tldr r3, =gUnknown_03005000+0x6E\n"
|
||||
"\tldrh r3, [r3]\n"
|
||||
"\tcmp r5, r3\n"
|
||||
"\tblt _0800F65A\n"
|
||||
"_0800F6D4:\n"
|
||||
"\tpop {r3-r5}\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tmov r9, r4\n"
|
||||
"\tmov r10, r5\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.pool");
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user