Skip to content

Commit

Permalink
up to 0x4040
Browse files Browse the repository at this point in the history
  • Loading branch information
patataofcourse committed May 4, 2023
1 parent b7db07c commit 47cd93c
Show file tree
Hide file tree
Showing 8 changed files with 307 additions and 5 deletions.
2 changes: 2 additions & 0 deletions arm9/arm9.ld
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ SECTIONS {
build/asm/CList.o(.text);
build/asm/code_020036e8.o(.text);
build/asm/memory.o(.text);
build/asm/code_02003c94.o(.text);
build/asm/OMObjText.o(.text);
. = ALIGN(4);

# non-disassembled
Expand Down
151 changes: 151 additions & 0 deletions arm9/asm/OMObjText.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
@ OMObjectText class

.include "global.s"

.section .text


arm_func_start func_02003e3c
func_02003e3c: @ 0x02003e3c
push {r3, r4, r5, r6, r7, r8, lr}
sub sp, sp, #0x24
ldr r4, _02003fd4 @ =0x02045e14
mov r8, r0
mov r7, r1
mov r6, r2
mov r5, r3
str r4, [r8]
bl func_02009e7c
ldr r1, [sp, #0x44]
cmp r1, #0
moveq r1, #1
movne r1, #0
cmp r0, #0
moveq r0, #1
movne r0, #0
eors r2, r1, r0
ldreq r1, _02003fd8 @ =0x04001000
ldreq r0, _02003fdc @ =0x00300010
ldreq r1, [r1]
beq _02003e9c
mov r0, #0x4000000
ldr r1, [r0]
ldr r0, _02003fdc @ =0x00300010
_02003e9c:
and r0, r1, r0
str r7, [r8, #4]
asr r0, r0, #0x14
str r6, [r8, #0x38]
and r4, r0, #3
cmp r2, #0
movne ip, #0x6400000
ldr r1, [sp, #0x40]
str r5, [r8, #0x3c]
mov r0, #4
str r0, [sp]
lsl r0, r1, r4
moveq ip, #0x6600000
add r1, ip, r0, lsl #5
ldr r2, [r8, #0x38]
ldr r3, [r8, #0x3c]
add r0, r8, #8
bl func_0201e360
ldr r1, [r8, #4]
add r0, r8, #8
str r0, [r8, #0x20]
str r1, [r8, #0x24]
mov r0, #1
str r0, [r8, #0x28]
str r0, [r8, #0x2c]
ldr r1, [r8, #0x38]
ldr r0, [r8, #0x3c]
lsl r1, r1, #3
add r2, r1, r1, lsr #31
lsl r0, r0, #3
add r3, r0, r0, lsr #31
ldr r0, [r8, #0xc]
ldr r1, [r8, #0x10]
asr r5, r2, #1
asr r6, r3, #1
bl func_0201e3e8
mov r1, #6
mul r1, r0, r1
add r0, r1, #8
bl func_02003a84
mov r2, r5
str r0, [r8, #0x30]
mov r5, #0
str r5, [sp]
str r5, [sp, #4]
str r5, [sp, #8]
mov r0, #0x300
str r0, [sp, #0xc]
ldr r0, [sp, #0x40]
str r5, [sp, #0x10]
str r0, [sp, #0x14]
str r5, [sp, #0x18]
str r4, [sp, #0x1c]
str r5, [sp, #0x20]
ldr r0, [r8, #0x30]
mov r3, r6
add r1, r8, #8
bl func_0201e73c
ldr r2, [r8, #0x1c]
add r0, r8, #8
ldr r2, [r2, #4]
mov r1, r5
blx r2
ldr r0, [r8, #0x30]
bl func_0200acfc
ldr r1, [sp, #0x44]
str r0, [r8, #0x34]
bl func_0200aec4
ldr r0, [r8, #0x34]
bl func_0200b2f0
ldr r0, [r8, #0x34]
mov r1, #1
bl func_0200b788
ldr r0, [r8, #0x34]
bl func_0200b908
mov r0, r8
add sp, sp, #0x24
pop {r3, r4, r5, r6, r7, r8, pc}
.align 2, 0
_02003fd4: .4byte 0x02045e14
_02003fd8: .4byte 0x04001000
_02003fdc: .4byte 0x00300010
arm_func_end func_02003e3c

arm_func_start func_02003fe0
func_02003fe0: @ 0x02003fe0
push {r4, lr}
ldr r1, _02004008 @ =0x02045e14
mov r4, r0
str r1, [r4]
ldr r0, [r4, #0x34]
bl func_0200ad44
ldr r0, [r4, #0x30]
bl func_02003ae0
mov r0, r4
pop {r4, pc}
.align 2, 0
_02004008: .4byte 0x02045e14
arm_func_end func_02003fe0

arm_func_start func_0200400c
func_0200400c: @ 0x0200400c
push {r4, lr}
ldr r1, _0200403c @ =0x02045e14
mov r4, r0
str r1, [r4]
ldr r0, [r4, #0x34]
bl func_0200ad44
ldr r0, [r4, #0x30]
bl func_02003ae0
mov r0, r4
bl _ZdlPv
mov r0, r4
pop {r4, pc}
.align 2, 0
_0200403c: .4byte 0x02045e14
arm_func_end func_0200400c
127 changes: 127 additions & 0 deletions arm9/asm/code_02003c94.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
.include "global.s"

.section .text

arm_func_start func_02003c94
func_02003c94: @ 0x02003c94
stmdb sp!, {lr}
sub sp, sp, #0xc
ldr lr, [sp, #0x10]
mov ip, #0
str lr, [sp]
str ip, [sp, #4]
str ip, [sp, #8]
bl func_02003cbc
add sp, sp, #0xc
ldm sp!, {pc}
arm_func_end func_02003c94

arm_func_start func_02003cbc
func_02003cbc: @ 0x02003cbc
push {r4, r5, r6, r7, r8, lr}
sub sp, sp, #0x10
ldr r8, [sp, #0x2c]
mov r7, r0
mov r6, r1
mov r5, r2
mov r4, r3
cmp r8, #0
bne _02003cec
mov r0, #0
bl func_0200989c
str r0, [sp, #0x2c]
_02003cec:
ldr r0, [sp, #0x30]
cmp r0, #0
bne _02003d04
mov r0, #0
bl func_020098b0
str r0, [sp, #0x30]
_02003d04:
mov r0, #0
str r0, [r5]
str r0, [r5, #4]
str r0, [r5, #8]
str r0, [r5, #0xc]
ldr r0, [r6]
cmp r0, #0
beq _02003d5c
add r1, sp, #0xc
bl func_02003910
add r1, sp, #4
mov r8, r0
bl func_02018580
ldr r0, [sp, #0x30]
ldr r2, [sp, #0x28]
str r0, [sp]
ldr r0, [sp, #0xc]
ldr r1, [sp, #4]
mov r3, r7
bl func_02019590
mov r0, r8
bl func_02003ae0
_02003d5c:
ldr r0, [r6, #4]
cmp r0, #0
beq _02003dbc
cmp r7, #0
beq _02003d8c
cmp r7, #1
cmpne r7, #2
bne _02003d9c
add r1, sp, #8
bl func_020038e8
mov r8, r0
b _02003da0
_02003d8c:
add r1, sp, #8
bl func_020038fc
mov r8, r0
b _02003da0
_02003d9c:
mov r8, #0
_02003da0:
ldr r0, [sp, #8]
ldr r3, [sp, #0x2c]
mov r1, r4
mov r2, r7
bl func_02019364
mov r0, r8
bl func_02003ae0
_02003dbc:
mov r0, #0
str r0, [r5, #0x10]
str r0, [r5, #0x14]
str r0, [r5, #0x18]
str r0, [r5, #0x1c]
ldr r0, [r6, #8]
cmp r0, #0
beq _02003de8
mov r1, r5
bl func_02003898
str r0, [r5, #0x10]
_02003de8:
ldr r0, [r6, #0xc]
cmp r0, #0
beq _02003e00
add r1, r5, #4
bl func_020038ac
str r0, [r5, #0x14]
_02003e00:
ldr r0, [r6, #0x10]
cmp r0, #0
beq _02003e18
add r1, r5, #8
bl func_020038d4
str r0, [r5, #0x18]
_02003e18:
ldr r0, [r6, #0x14]
cmp r0, #0
addeq sp, sp, #0x10
popeq {r4, r5, r6, r7, r8, pc}
add r1, r5, #0xc
bl func_020038c0
str r0, [r5, #0x1c]
add sp, sp, #0x10
pop {r4, r5, r6, r7, r8, pc}
arm_func_end func_02003cbc
2 changes: 1 addition & 1 deletion arm9/data/rest.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.section .data

.set progress, 0x3c94 @ amount of dism'd bytes!
.set progress, 0x4040 @ amount of dism'd bytes!
.set total, 0x53560 @ this excludes dtcm + itcm + autoload list

.incbin "../extract/arm9.bin", progress, total-progress
10 changes: 10 additions & 0 deletions arm9/undefined.ld
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ func_020087e4 = 0x020087e4;
func_0200989c = 0x0200989c;
func_020098b0 = 0x020098b0;
func_02009d98 = 0x02009d98;
func_02009e7c = 0x02009e7c;
func_0200a760 = 0x0200a760;
func_0200acfc = 0x0200acfc;
func_0200ad44 = 0x0200ad44;
func_0200aec4 = 0x0200aec4;
func_0200b2f0 = 0x0200b2f0;
func_0200b39c = 0x0200b39c;
func_0200b788 = 0x0200b788;
func_0200b908 = 0x0200b908;
func_0200c5ac = 0x0200c5ac;
func_0200c5bc = 0x0200c5bc;
func_0200c634 = 0x0200c634;
Expand Down Expand Up @@ -76,6 +83,9 @@ func_02019364 = 0x02019364;
func_02019590 = 0x02019590;
func_0201bfc0 = 0x0201bfc0;
func_0201d098 = 0x0201d098;
func_0201e360 = 0x0201e360;
func_0201e3e8 = 0x0201e3e8;
func_0201e73c = 0x0201e73c;
func_02022ea0 = 0x02022ea0;
func_02023598 = 0x02023598;
func_020235a8 = 0x020235a8;
Expand Down
16 changes: 12 additions & 4 deletions my notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,21 @@ memory.cpp - probably a bunch of news and deletes, plus other memory stuff. acce
- func_020039c4 - operator new[](void*)
- func_020039e4 - operator delete(void*)
- func_02003a04 - operator delete[](void*)
- func_02003axx ~ func_02003c1c
- func_02003a24 ~ func_02003c1c
end memory.cpp

func_02003c94 ~ func_02003e3c - no clue
############################################################
everything from here onwards is probably badly split
let's focus on dism first, documenting second
############################################################

func_02003e3c - constructor for OMObjText
func_02003fe0 ~ func_0200400c - virtual functions for OMObjText
func_02003c94 ~ func_02003cbc

OMObjText.cpp
func_02003e3c - constructor for OMObjText
func_02003fe0 ~ func_0200400c - virtual functions for OMObjText
(probably some more stuff)
end? OMObjText.cpp

func_020139b8 - CProc constructor
called from overlay_0::func_0227fb30 (entry function for overlay 0, CMultisceneProc constructor)
Expand Down
3 changes: 3 additions & 0 deletions tools/rhgold.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,8 @@ arm_func 0x020039c4 _ZnaPv
arm_func 0x020039e4 _ZdlPv
arm_func 0x02003a04 _ZdaPv
arm_func 0x02003bc0
arm_func 0x02003e3c
arm_func 0x02003fe0
arm_func 0x0200400c
data 0x02045dec D_02045dec
data 0xFFFF0000 ExceptionVectors
1 change: 1 addition & 0 deletions tools/undefined_gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
make 2>&1 | grep -oE "undefined reference to .*" | sort | awk '!seen[$0]++' | grep -oE "(func_|_)[0-9a-f]{8}"

0 comments on commit 47cd93c

Please sign in to comment.