summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-07-23 18:22:36 +0200
committerTreeki <treeki@gmail.com>2011-07-23 18:22:36 +0200
commit77d7cadea5d8762a0e2a7d9a1a40f314748a6dcf (patch)
tree1c44ed2db0bc58f30940ebb4f04995069d60a2bd
parent936381ae2d0e8bdde0b0847ca20de30f2b69e8bc (diff)
downloadkamek-77d7cadea5d8762a0e2a7d9a1a40f314748a6dcf.tar.gz
kamek-77d7cadea5d8762a0e2a7d9a1a40f314748a6dcf.zip
fixed crap
-rw-r--r--NewerProject.yaml1
-rw-r--r--compression.yaml2
-rw-r--r--prolog.yaml9
-rw-r--r--src/prolog.S71
4 files changed, 82 insertions, 1 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml
index e1f0881..c4bece4 100644
--- a/NewerProject.yaml
+++ b/NewerProject.yaml
@@ -2,6 +2,7 @@
output_dir: "NewerASM"
code_address: 0x808D9000
modules:
+ - processed/prolog.yaml
- processed/bugfixes.yaml
- processed/worldmap.yaml
- processed/levelnames.yaml
diff --git a/compression.yaml b/compression.yaml
index 9d3a058..542ee6a 100644
--- a/compression.yaml
+++ b/compression.yaml
@@ -4,7 +4,7 @@ hooks:
- name: InitialiseEverything
type: branch_insn
branch_type: b
- src_addr_pal: 0x8015BC70
+ src_addr_pal: 0x8015BCA0
target_func: 'InitCompression'
- name: GetFileEntrynumNew
diff --git a/prolog.yaml b/prolog.yaml
new file mode 100644
index 0000000..ce7200d
--- /dev/null
+++ b/prolog.yaml
@@ -0,0 +1,9 @@
+---
+source_files: [../src/prolog.S]
+hooks:
+ - name: Prolog
+ type: branch_insn
+ branch_type: b
+ src_addr_pal: 0x8015BC70
+ target_func: 'Prolog'
+
diff --git a/src/prolog.S b/src/prolog.S
new file mode 100644
index 0000000..38bcb6b
--- /dev/null
+++ b/src/prolog.S
@@ -0,0 +1,71 @@
+.text
+.align 4
+.set sp, 1
+
+.extern __ctor_loc
+.extern __ctor_end
+.extern OSReport
+
+.global Prolog
+Prolog:
+ stwu sp, -0x20(sp)
+ mflr r0
+ stw r0, 0x24(sp)
+ stw r31, 0x1C(sp)
+ stw r30, 0x18(sp)
+ stw r29, 0x14(sp)
+ # -- Go!
+
+ li r30, 0
+
+ lis r31, __ctor_loc@h
+ ori r31, r31, __ctor_loc@l
+ lis r29, __ctor_end@h
+ ori r29, r29, __ctor_end@l
+
+ lis r3, PMsg@h
+ ori r3, r3, PMsg@l
+ mr r4, r31
+ mr r5, r29
+ crclr 4*cr1+eq
+ bl OSReport
+
+ b startLoop
+
+loop:
+ mtctr r12
+ bctrl
+ addi r31, r31, 4
+ addi r30, r30, 1
+startLoop:
+ lwz r12, 0(r31)
+ cmpw r31, r29
+ bne loop
+
+ lis r3, PMsg2@h
+ ori r3, r3, PMsg2@l
+ mr r4, r30
+ crclr 4*cr1+eq
+ bl OSReport
+
+ # -- Done
+ li r3, 1
+ lwz r31, 0x1C(sp)
+ lwz r30, 0x18(sp)
+ lwz r29, 0x14(sp)
+ lwz r0, 0x24(sp)
+ mtlr r0
+ addi sp, sp, 0x20
+ blr
+
+
+.data
+PMsg:
+ .string "Newer Super Mario Bros. Wii - Hacks by Treeki and Tempus 2009-2011\n.ctors: %p - %p\n"
+
+PMsg2:
+ .string "%d inits called\n"
+
+.align 4
+
+