chao_garden: more

This commit is contained in:
Oliver Bell committed 2026-01-04 12:45:12 +00:00
1 parent 5f7c70c9bb
commit f370bbd307
3 files changed
+53 -42

No files matched your search

-42
View File
@@ -4,48 +4,6 @@
.syntax unified
.arm
thumb_func_start sub_02001588
sub_02001588: @ 0x02001588
push {r4, r5, lr}
adds r4, r1, #0
lsls r2, r2, #0x18
lsrs r2, r2, #0x18
adds r4, r4, r2
adds r5, r2, #0
b _020015A2
_02001596:
movs r1, #0xa
bl Div
subs r4, #1
strb r1, [r4]
subs r5, #1
_020015A2:
cmp r5, #0
ble _020015AE
cmp r0, #9
bgt _02001596
subs r4, #1
strb r0, [r4]
_020015AE:
movs r0, #0
cmp r5, #1
ble _020015C6
movs r1, #0
_020015B6:
subs r4, #1
strb r1, [r4]
adds r0, #1
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
subs r5, #1
cmp r5, #1
bgt _020015B6
_020015C6:
pop {r4, r5}
pop {r1}
bx r1
thumb_func_start sub_020015cc
sub_020015cc: @ 0x020015cc
push {r4, r5, r6, r7, lr}
+41
View File
@@ -477,3 +477,44 @@ s16 sub_02001554(u16 arg0)
temp_r0 = gUnknown_030013A8 * 2;
return Mod(temp_r0 >> 0x11, arg0);
}
// Very likely a fake match: https://decomp.me/scratch/L9Uxl
u8 sub_02001588(s32 p0, u8 *arg1, u32 arg2)
{
u8 *var_r4;
s32 var_r5;
u8 r0;
#ifndef NON_MATCHING
var_r4 = arg1;
asm("" ::"r"(var_r4));
var_r4 = &var_r4[(u8)arg2];
#else
var_r4 = &arg1[(u8)arg2];
#endif
var_r5 = (u8)arg2;
while (var_r5 > 0) {
#ifndef NON_MATCHING
register u32 r1 asm("r1");
#else
u32 r1;
#endif
if (p0 <= 9) {
*--var_r4 = p0;
break;
}
r1 = 10;
p0 = Div(p0, r1);
*--var_r4 = r1;
var_r5 -= 1;
}
r0 = 0;
while (var_r5 > 1) {
*--var_r4 = 0;
r0++;
var_r5 -= 1;
}
return r0;
}
+12
View File
@@ -0,0 +1,12 @@
import re
with open("chao_garden/asm/code.s", "r") as code_file:
data = code_file.read()
regex = re.compile("IWRAM_START \+ 0x([A-F0-9]{3})")
matches = regex.findall(data)
unique = sorted(list(set("".join(match) for match in matches)))
for replace in unique:
data = data.replace(f"IWRAM_START + 0x{replace}", f"gUnknown_03000{replace}")
print(f" . = 0x00000{replace}; gUnknown_03000{replace} = .;")