summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAetias <aetias@outlook.com>2024-04-07 15:04:51 +0200
committerAetias <aetias@outlook.com>2024-04-07 15:04:51 +0200
commit392ccb357e8b9bf5d12eae74577b5778bff7c9cd (patch)
tree0ffad327db6bd3395529636681393af469a35cf2
parentc628010c04d156d3795a6b998c5dccce608e664d (diff)
Mangle `ActorRupee` actor type and resource
-rw-r--r--asm/ov06.inc2
-rw-r--r--asm/ov06.s2
-rw-r--r--asm/ov14/Actor/ActorRupee.s30
-rw-r--r--include/Actor/ActorRupee.hpp5
-rw-r--r--include/Actor/ActorType.hpp17
-rw-r--r--include/System/Resource.hpp13
-rw-r--r--src/14_Land/Actor/ActorRupee.cpp3
-rw-r--r--tools/mangle.py20
8 files changed, 70 insertions, 22 deletions
diff --git a/asm/ov06.inc b/asm/ov06.inc
index 866efd86..1738f036 100644
--- a/asm/ov06.inc
+++ b/asm/ov06.inc
@@ -93,7 +93,7 @@
.extern data_ov14_0215b1a0
.extern data_ov14_0215b1c0
.extern data_ov14_0215b1e0
-.extern data_ov14_0215b200
+.extern _ZN10ActorRupee5gTypeE
.extern data_ov14_0215b220
.extern data_ov14_0215b240
.extern data_ov14_0215b258
diff --git a/asm/ov06.s b/asm/ov06.s
index e8ecabb6..d99cb448 100644
--- a/asm/ov06.s
+++ b/asm/ov06.s
@@ -3515,7 +3515,7 @@ data_ov06_021031ac: ; 0x021031ac
.word data_ov14_0215b1c0
.global data_ov06_021031b0
data_ov06_021031b0: ; 0x021031b0
- .word data_ov14_0215b200
+ .word _ZN10ActorRupee5gTypeE
.global data_ov06_021031b4
data_ov06_021031b4: ; 0x021031b4
.word data_ov17_0216cf0c ; data_ov18_0216cf0c
diff --git a/asm/ov14/Actor/ActorRupee.s b/asm/ov14/Actor/ActorRupee.s
index 49fd2a4c..c5126d23 100644
--- a/asm/ov14/Actor/ActorRupee.s
+++ b/asm/ov14/Actor/ActorRupee.s
@@ -26,7 +26,7 @@ _ZN10ActorRupeeC2Ev: ; 0x0213ae98
stmdb sp!, {r4, lr}
mov r4, r0
bl func_ov00_020c1554
- ldr r1, _0213aec8 ; =data_ov14_021589e4
+ ldr r1, _0213aec8 ; =_ZTV10ActorRupee
mov r0, #8
str r1, [r4]
str r0, [r4, #0x158]
@@ -37,7 +37,7 @@ _ZN10ActorRupeeC2Ev: ; 0x0213ae98
ldmia sp!, {r4, pc}
.align 2, 0
arm_func_end _ZN10ActorRupeeC2Ev
-_0213aec8: .word data_ov14_021589e4
+_0213aec8: .word _ZTV10ActorRupee
.global _ZN10ActorRupee8vfunc_08Ev
arm_func_start _ZN10ActorRupee8vfunc_08Ev
@@ -736,14 +736,14 @@ data_ov14_02153e28: ; 0x02153e28
arm_func_start func_ov14_0215517c
func_ov14_0215517c: ; 0x0215517c
stmdb sp!, {r3, lr}
- ldr r0, _021551bc ; =data_ov14_0215b200
+ ldr r0, _021551bc ; =_ZN10ActorRupee5gTypeE
ldr r1, _021551c0 ; =0x52555059
ldr r2, _021551c4 ; =_ZN10ActorRupee6CreateEv
mov r3, #0
bl func_0203e784
- ldr r0, _021551bc ; =data_ov14_0215b200
+ ldr r0, _021551bc ; =_ZN10ActorRupee5gTypeE
ldr r1, _021551c8 ; =func_0203e7b4
- ldr r2, _021551cc ; =data_ov14_0215b1f4
+ ldr r2, _021551cc ; =_ZN10ActorRupee9gResourceE
bl func_0204f8d4
ldr r2, _021551d0 ; =0x000003bb
ldr r0, _021551d4 ; =data_ov14_021589b4
@@ -753,11 +753,11 @@ func_ov14_0215517c: ; 0x0215517c
ldmia sp!, {r3, pc}
.align 2, 0
arm_func_end func_ov14_0215517c
-_021551bc: .word data_ov14_0215b200
+_021551bc: .word _ZN10ActorRupee5gTypeE
_021551c0: .word 0x52555059
_021551c4: .word _ZN10ActorRupee6CreateEv
_021551c8: .word func_0203e7b4
-_021551cc: .word data_ov14_0215b1f4
+_021551cc: .word _ZN10ActorRupee9gResourceE
_021551d0: .word 0x000003bb
_021551d4: .word data_ov14_021589b4
@@ -829,14 +829,10 @@ data_ov14_021589d4: ; 0x021589d4
.global data_ov14_021589d8
data_ov14_021589d8: ; 0x021589d8
.byte 0x00, 0x00, 0x00, 0x00
- .global data_ov14_021589dc
-data_ov14_021589dc: ; 0x021589dc
.byte 0x00, 0x00, 0x00, 0x00
- .global data_ov14_021589e0
-data_ov14_021589e0: ; 0x021589e0
.byte 0x00, 0x00, 0x00, 0x00
- .global data_ov14_021589e4
-data_ov14_021589e4: ; 0x021589e4
+ .global _ZTV10ActorRupee
+_ZTV10ActorRupee: ; 0x021589e4
.word _ZN10ActorRupeeD2Ev
.global data_ov14_021589e8
data_ov14_021589e8: ; 0x021589e8
@@ -972,9 +968,9 @@ data_ov14_02158a94: ; 0x02158a94
.word func_ov00_020c322c
.bss
- .global data_ov14_0215b1f4
-data_ov14_0215b1f4:
+ .global _ZN10ActorRupee9gResourceE
+_ZN10ActorRupee9gResourceE:
.space 0xc
- .global data_ov14_0215b200
-data_ov14_0215b200:
+ .global _ZN10ActorRupee5gTypeE
+_ZN10ActorRupee5gTypeE:
.space 0x14
diff --git a/include/Actor/ActorRupee.hpp b/include/Actor/ActorRupee.hpp
index 93205035..93c3082c 100644
--- a/include/Actor/ActorRupee.hpp
+++ b/include/Actor/ActorRupee.hpp
@@ -4,7 +4,9 @@
#include "types.h"
#include "lib/math.h"
+#include "System/Resource.hpp"
#include "Actor/Actor.hpp"
+#include "Actor/ActorType.hpp"
#include "Item/Item.hpp"
typedef u32 RupeeId;
@@ -22,6 +24,9 @@ enum RupeeId_ {
class ActorRupee : public Actor {
public:
+ static Resource gResource;
+ static ActorType gType;
+
/* 000 (base) */
/* 158 */ RupeeId mRupeeId;
/* 15c */ unk16 mUnk_15c;
diff --git a/include/Actor/ActorType.hpp b/include/Actor/ActorType.hpp
new file mode 100644
index 00000000..b004a044
--- /dev/null
+++ b/include/Actor/ActorType.hpp
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "global.h"
+#include "types.h"
+
+#include "Actor/Actor.hpp"
+
+typedef Actor* (*ActorCreateFunc)();
+
+struct ActorType {
+ /* 00 */ char type[4];
+ /* 04 */ ActorCreateFunc create;
+ /* 08 */ unk32 unk_08;
+ /* 0c */ unk32 unk_0c;
+ /* 10 */ ActorType *next;
+ /* 14 */
+};
diff --git a/include/System/Resource.hpp b/include/System/Resource.hpp
new file mode 100644
index 00000000..757ccba0
--- /dev/null
+++ b/include/System/Resource.hpp
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "global.h"
+#include "types.h"
+
+typedef void (*ResourceCleanupFunc)(void *object);
+
+struct Resource {
+ /* 0 */ Resource *next;
+ /* 4 */ ResourceCleanupFunc cleanup;
+ /* 8 */ void *object;
+ /* c */
+};
diff --git a/src/14_Land/Actor/ActorRupee.cpp b/src/14_Land/Actor/ActorRupee.cpp
index 3ca07d3b..20d98de4 100644
--- a/src/14_Land/Actor/ActorRupee.cpp
+++ b/src/14_Land/Actor/ActorRupee.cpp
@@ -2,6 +2,9 @@
#ifdef STUBS
+Resource ActorRupee::gResource;
+ActorType ActorRupee::gType;
+
ActorRupee* ActorRupee::Create() {}
ActorRupee::ActorRupee() {}
bool ActorRupee::vfunc_08() {}
diff --git a/tools/mangle.py b/tools/mangle.py
index 1bdecbdc..fc2c5826 100644
--- a/tools/mangle.py
+++ b/tools/mangle.py
@@ -40,6 +40,20 @@ output = output.decode()
# print(output)
-mangled_names: list[str] = re.findall(r'.text +(_Z\S+)', output)
-for name in mangled_names:
- print(name)
+mangled_funcs: list[str] = re.findall(r'.text +(_Z\S+)', output)
+mangled_data: list[str] = re.findall(r'(?:.data|.bss) +(_Z\S+)', output)
+
+if len(mangled_funcs) > 0:
+ print('Functions:')
+ print()
+ for func in mangled_funcs:
+ print(func)
+ print()
+ print()
+if len(mangled_data) > 0:
+ print('Data:')
+ print()
+ for data in mangled_data:
+ print(data)
+ print()
+ print()