summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bugfixes.yaml5
-rw-r--r--kamek_pal.x2
-rw-r--r--src/randomcrap.S148
3 files changed, 155 insertions, 0 deletions
diff --git a/bugfixes.yaml b/bugfixes.yaml
index 9c6c46a..4b1e4e4 100644
--- a/bugfixes.yaml
+++ b/bugfixes.yaml
@@ -21,6 +21,11 @@ hooks:
# branch_type: bl
# target_func: 'mpPauseFix2'
# src_addr_pal: 0x801410DC
+# - name: MPPauseFix3
+# type: branch_insn
+# branch_type: b
+# target_func: 'mpPauseFix3'
+# src_addr_pal: 0x801412A0
# - name: MPPauseFix4
# type: branch_insn
# branch_type: bl
diff --git a/kamek_pal.x b/kamek_pal.x
index f4472a4..d79db85 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -7,6 +7,7 @@ SECTIONS {
continueFromMpPauseFix1 = 0x8004E050;
continueFromMpPauseFix2 = 0x801415A0;
+ continueFromMpPauseFix3 = 0x801412A4;
CheckIfSinglePlayer = 0x800FCAD0;
TextWriterCrapContinue = 0x800E598C;
@@ -28,6 +29,7 @@ SECTIONS {
m2d__AnmResHandler_c__Load = 0x80163FA0;
RealAcPyDtor = 0x80144820;
+ RealWm2dPlayerDtor = 0x808C5500;
InsertIntIntoTextBox1 = 0x800B3BE0;
WriteNumberToTextBox__FPiPCiPQ34nw4r3lyt7TextBoxb = 0x800B3B60;
diff --git a/src/randomcrap.S b/src/randomcrap.S
index e0530c8..0983763 100644
--- a/src/randomcrap.S
+++ b/src/randomcrap.S
@@ -52,8 +52,21 @@ isntWorld1_1:
.global mpPauseFix1
.global mpPauseFix2
+.global mpPauseFix3
.extern continueFromMpPauseFix1
.extern continueFromMpPauseFix2
+.extern continueFromMpPauseFix3
+
+mpPauseFix3:
+ bl CheckIfSinglePlayer
+ cmpwi r3, 1
+ li r0, 30
+ beq isSingle
+ li r0, 1
+isSingle:
+ stb r0, 0x153E(r29)
+ mr r3, r29
+ b continueFromMpPauseFix3
mpPauseFix1:
lis r5, continueFromMpPauseFix1@h
@@ -210,6 +223,141 @@ UniversalFunctionLog:
addi r1, r1, 0x10
blr
+
+#AllocLog:
+# stwu r1, -0x20(r1)
+# mflr r0
+# stw r0, 0x24(r1)
+# stw r31, 0x1C(r1)
+# stw r30, 0x18(r1)
+# stw r29, 0x14(r1)
+# stw r28, 0x10(r1)
+# mr r31, r5
+# mr r30, r4
+# mr r29, r3
+#
+#.extern ArchiveHeap
+# lis r3, ArchiveHeap@h
+# ori r3, r3, ArchiveHeap@l
+# lwz r3, 0(r3)
+# lwz r3, 0x10(r3)
+# cmpw r3, r29
+# bne dontLogMe
+#
+# lis r3, WillAlloc@h
+# ori r3, r3, WillAlloc@l
+# crclr 4*cr1+eq
+# bl OSReport
+#
+# mr r3, r29
+# mr r4, r30
+# mr r5, r31
+# bl RealAlloc
+# mr r28, r3
+#
+# lis r3, Alloced@h
+# ori r3, r3, Alloced@l
+# mr r4, r28
+# crclr 4*cr1+eq
+# bl OSReport
+#
+# mr r3, r28
+#
+# b doneHere
+#dontLogMe:
+# mr r3, r29
+# mr r4, r30
+# mr r5, r31
+# bl RealAlloc
+#doneHere:
+# lwz r28, 0x10(r1)
+# lwz r29, 0x14(r1)
+# lwz r30, 0x18(r1)
+# lwz r31, 0x1C(r1)
+# lwz r0, 0x24(r1)
+# mtlr r0
+# addi r1, r1, 0x20
+# blr
+#
+#FreeLog:
+# stwu r1, -0x20(r1)
+# mflr r0
+# stw r0, 0x24(r1)
+# stw r30, 0x18(r1)
+# stw r29, 0x14(r1)
+# mr r30, r4
+# mr r29, r3
+#
+# lis r3, ArchiveHeap@h
+# ori r3, r3, ArchiveHeap@l
+# lwz r3, 0(r3)
+# lwz r3, 0x10(r3)
+# lwz r5, -0xC(r4)
+# cmpw r3, r29
+# bne dontLogMe2
+# lis r3, WillFree@h
+# ori r3, r3, WillFree@l
+# crclr 4*cr1+eq
+# bl OSReport
+#dontLogMe2:
+#
+# mr r3, r29
+# mr r4, r30
+# bl RealFree
+#
+# lwz r29, 0x14(r1)
+# lwz r30, 0x18(r1)
+# lwz r0, 0x24(r1)
+# mtlr r0
+# addi r1, r1, 0x20
+# blr
+#
+#RealAlloc:
+# stwu r1, -0x20(r1)
+# lis r12, 0x801D
+# ori r12, r12, 0x45A4
+# mtctr r12
+# bctr
+#
+#RealFree:
+# stwu r1, -0x20(r1)
+# lis r12, 0x801D
+# ori r12, r12, 0x4854
+# mtctr r12
+# bctr
+#
+#CRAPPYALLOC:
+# lis r3, 0x801D
+# ori r3, r3, 0x45A0
+# lis r4, AllocLog@h
+# ori r4, r4, AllocLog@l
+# lis r5, 0x4800
+# sub r6, r4, r3
+# clrlwi r6, r6, 6
+# or r5, r5, r6
+# stw r5, 0(r3)
+# dcbst r0, r3
+# sync
+# icbi r0, r3
+# lis r3, 0x801D
+# ori r3, r3, 0x4850
+# lis r4, FreeLog@h
+# ori r4, r4, FreeLog@l
+# lis r5, 0x4800
+# sub r6, r4, r3
+# clrlwi r6, r6, 6
+# or r5, r5, r6
+# stw r5, 0(r3)
+# dcbst r0, r3
+# sync
+# icbi r0, r3
+# blr
+
+#.section .ctors,4
+#.long CRAPPYALLOC
.data
UniLogStr: .string "[ULog] returning %8x to: %x > %x > %x > %x > %x > %x\n"
+#WillAlloc: .string "[AH] Will allocate %x bytes aligned by %x\n"
+#Alloced: .string "[AH] Allocated %p\n"
+#WillFree: .string "[AH] Freeing %p which is %x bytes\n"