Match sub_80574C4

This commit is contained in:
Kermalis
2023-08-30 23:44:24 -04:00
parent 6f3447b803
commit bafb0bbba7
2 changed files with 59 additions and 97 deletions

View File

@@ -1,97 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_80574C4
sub_80574C4:
push {r4-r6,lr}
sub sp, 0x104
adds r4, r0, 0
adds r5, r1, 0
movs r3, 0
movs r2, 0
ldr r0, [r4]
cmp r0, 0
beq _08057502
cmp r0, r5
beq _080574EA
_080574DA:
lsls r0, r3, 2
mov r6, sp
adds r1, r6, r0
lsls r0, r2, 2
adds r0, r4
ldr r0, [r0]
str r0, [r1]
adds r3, 0x1
_080574EA:
adds r2, 0x1
cmp r2, 0x40
bgt _08057502
lsls r0, r2, 2
adds r0, r4
ldr r0, [r0]
cmp r0, 0
beq _08057502
cmp r0, r5
beq _080574EA
cmp r3, 0x3F
ble _080574DA
_08057502:
movs r2, 0
ldr r0, [r4]
b _08057524
_08057508:
lsls r0, r3, 2
mov r6, sp
adds r1, r6, r0
lsls r0, r2, 2
adds r0, r4
ldr r0, [r0]
str r0, [r1]
adds r3, 0x1
_08057518:
adds r2, 0x1
cmp r2, 0x40
bgt _08057530
lsls r0, r2, 2
adds r0, r4
ldr r0, [r0]
_08057524:
cmp r0, 0
beq _08057530
cmp r0, r5
bne _08057518
cmp r3, 0x3F
ble _08057508
_08057530:
cmp r3, 0x40
bgt _08057542
movs r1, 0
lsls r0, r3, 2
add r0, sp
_0805753A:
stm r0!, {r1}
adds r3, 0x1
cmp r3, 0x40
ble _0805753A
_08057542:
mov r3, sp
adds r1, r4, 0
movs r2, 0x40
_08057548:
ldm r3!, {r0}
stm r1!, {r0}
subs r2, 0x1
cmp r2, 0
bge _08057548
add sp, 0x104
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_80574C4
.align 2,0 @ Don't pad with nop

View File

@@ -136,6 +136,65 @@ extern void sub_806F324(struct Entity *, s32, u32, u32);
extern s16 gUnknown_80F4DB4;
extern u32 gUnknown_8106A4C;
// TODO: WTF are these loops? https://decomp.me/scratch/svYTQ
void sub_80574C4(s32 *a0, s32 a1)
{
s32 r2;
s32 r3;
s32 temp;
s32 buffer[0x41];
r3 = 0;
r2 = 0;
if (a0[0] != 0) {
if (a0[0] == a1)
goto continue1;
itsmol1:
buffer[r3] = a0[r2];
r3++;
continue1:
r2++;
if (r2 >= 0x41)
goto break1;
if (a0[r2] == 0)
goto break1;
if (a0[r2] == a1)
goto continue1;
if (r3 < 0x40)
goto itsmol1;
}
break1:
r2 = 0;
temp = a0[r2];
goto for2;
itsmol2:
buffer[r3] = a0[r2];
r3++;
continue2:
r2++;
if (r2 > 0x40)
goto break2;
temp = a0[r2];
for2:
if (temp == 0)
goto break2;
if (temp != a1)
goto continue2;
if (r3 < 0x40)
goto itsmol2;
break2:
while (r3 < 0x41) {
buffer[r3] = 0;
r3++;
}
for (r2 = 0; r2 < 0x41; r2++) {
a0[r2] = buffer[r2];
}
}
bool8 sub_805755C(struct Entity* pokemon, u16 moveID)
{
if ((moveID == MOVE_SOLARBEAM) && (GetApparentWeather(pokemon) == WEATHER_SUNNY)) {