diff options
author | Treeki <treeki@gmail.com> | 2011-08-01 16:34:03 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-08-01 16:34:03 +0200 |
commit | 56bfafbdfba08332164d72f84b2105aa1123cb07 (patch) | |
tree | e81dda95ab6af0b9d91d1fed8ae639ad01b8f438 | |
parent | 803c43cce9a5494d842856dd2e2aeb40666fe48a (diff) | |
download | kamek-56bfafbdfba08332164d72f84b2105aa1123cb07.tar.gz kamek-56bfafbdfba08332164d72f84b2105aa1123cb07.zip |
added actor logging
-rw-r--r-- | actorlog.yaml | 9 | ||||
-rwxr-xr-x | destroy_tracker.yaml | 9 | ||||
-rw-r--r-- | src/actorlog.S | 41 | ||||
-rwxr-xr-x | src/destroy_tracker.cpp | 19 |
4 files changed, 78 insertions, 0 deletions
diff --git a/actorlog.yaml b/actorlog.yaml new file mode 100644 index 0000000..3e4adb2 --- /dev/null +++ b/actorlog.yaml @@ -0,0 +1,9 @@ +--- +source_files: [../src/actorlog.S] +hooks: + - name: ActorLogHook + type: branch_insn + branch_type: bl + src_addr_pal: 0x80162BC0 + target_func: 'ActorLogHook' + diff --git a/destroy_tracker.yaml b/destroy_tracker.yaml new file mode 100755 index 0000000..6af40a9 --- /dev/null +++ b/destroy_tracker.yaml @@ -0,0 +1,9 @@ +---
+source_files: [../src/destroy_tracker.cpp]
+hooks:
+ - name: CallDestroyTracker
+ type: branch_insn
+ branch_type: b
+ src_addr_pal: 0x801626C0
+ target_func: 'trackDestroy(int)'
+
diff --git a/src/actorlog.S b/src/actorlog.S new file mode 100644 index 0000000..f4e7205 --- /dev/null +++ b/src/actorlog.S @@ -0,0 +1,41 @@ +.text + +.set sp, 1 + +.align 4 +.extern OSReport + +.global ActorLogHook +ActorLogHook: + stwu sp, -0x20(sp) + mflr r0 + stw r0, 0x24(sp) + stw r3, 0x1C(sp) + stw r4, 0x18(sp) + stw r5, 0x14(sp) + stw r6, 0x10(sp) + + lis r8, 0x8032 + ori r8, r8, 0xB58 + slwi r7, r3, 2 + lwzx r7, r8, r7 + + lis r3, M@h + ori r3, r3, M@l + crclr 4*cr1+eq + bl OSReport + + lwz r6, 0x10(sp) + lwz r5, 0x14(sp) + lwz r4, 0x18(sp) + lwz r3, 0x1C(sp) + lwz r0, 0x24(sp) + mtlr r0 + addi sp, sp, 0x20 + + # Return to __objCreate + clrlslwi r31, r3, 16, 2 + blr + +.data +M: .string "P:%p S:%08x T:%d N:%s\n" diff --git a/src/destroy_tracker.cpp b/src/destroy_tracker.cpp new file mode 100755 index 0000000..15bace9 --- /dev/null +++ b/src/destroy_tracker.cpp @@ -0,0 +1,19 @@ +#include <common.h>
+
+// @@ %SET_OFFSET 817F4000
+
+// @@ %IFREGION pal
+// @@ %PATCH 801626C0 %b:817F4000
+// @@ %ENDIF
+
+int trackDestroy(int objptr) {
+ int oldLR;
+ __asm__ __volatile__ (
+ "mflr %0"
+ : "=r" (oldLR)
+ );
+ OSReport("D%x @%x", objptr, oldLR);
+ return objptr;
+}
+
+
|