summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bugfixes.yaml13
-rw-r--r--kamek_pal.x2
-rw-r--r--src/music.S53
3 files changed, 67 insertions, 1 deletions
diff --git a/bugfixes.yaml b/bugfixes.yaml
index 5923671..3f91729 100644
--- a/bugfixes.yaml
+++ b/bugfixes.yaml
@@ -1,6 +1,17 @@
---
-source_files: [../src/randomcrap.S]
+source_files: [../src/randomcrap.S, ../src/music.S]
hooks:
+ - name: MusicHax1
+ type: patch
+ addr_pal: 0x8019BA78
+ data: '60000000 60000000' # disables limit
+
+ - name: MusicHax2
+ type: branch_insn
+ src_addr_pal: 0x8008E5E4
+ branch_type: b
+ target_func: 'HaxMusic'
+
- name: FixCoinJump
type: patch
addr_ntsc: 0x809E75F0
diff --git a/kamek_pal.x b/kamek_pal.x
index b21866a..2f05e6e 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -45,6 +45,8 @@ SECTIONS {
CheckIfPlayingSound = 0x80196740;
RelatedToPlayingSoundsAlongsideAnims = 0x80105350;
+ SoundRelatedClass = 0x8042A768;
+
ExitStage__Fiiii = 0x80102370;
diff --git a/src/music.S b/src/music.S
new file mode 100644
index 0000000..59c86a0
--- /dev/null
+++ b/src/music.S
@@ -0,0 +1,53 @@
+.text
+
+# An Epic Music Hack
+
+.extern SoundRelatedClass
+.extern sprintf
+.global HaxMusic
+
+HaxMusic:
+ cmpwi r3, 100
+ bltlr
+
+ stwu r1, -0x10(r1)
+ mflr r0
+ stw r0, 0x14(r1)
+ stw r31, 0xC(r1)
+ stw r30, 0x8(r1)
+
+ mr r31, r3
+
+ lis r3, SoundRelatedClass@h
+ ori r3, r3, SoundRelatedClass@l
+ lwz r3, 0(r3)
+ lwz r30, 0x5CC(r3)
+ addis r30, r30, 3
+
+ subi r3, r30, 0x6A84
+ lis r4, RegularMusic@h
+ ori r4, r4, RegularMusic@l
+ mr r5, r31
+ bl sprintf
+
+ subi r3, r30, 0x6A0C
+ lis r4, FastMusic@h
+ ori r4, r4, FastMusic@l
+ mr r5, r31
+ bl sprintf
+
+ li r3, 1
+
+ lwz r0, 0x14(r1)
+ lwz r31, 0xC(r1)
+ lwz r30, 0x8(r1)
+ mtlr r0
+ addi r1, r1, 0x10
+ blr
+
+
+.data
+RegularMusic: .string "stream/theme%03d.brstm"
+FastMusic: .string "stream/theme%03d_fast.brstm"
+
+