Browse Source

fix titlescreen

ipatix 6 years ago
parent
commit
7bae74f449
3 changed files with 111 additions and 70 deletions
  1. 0
    70
      patches/hooks.asm
  2. 87
    0
      patches/music.asm
  3. 24
    0
      src/music/titlescreen.s

+ 0
- 70
patches/hooks.asm View File

@@ -1,76 +1,6 @@
1 1
 _call_via_r0 equ 0x081E3BA8
2 2
 _call_via_r1 equ 0x081E3BAC
3 3
 
4
-//----------------------
5
-// ipatix sound stuff
6
-//----------------------
7
-
8
-.org 0x080007B4
9
-    .word  0x0203E000   // new PCM work area
10
-.org 0x081DD0B4
11
-    .word  main_mixer   // new mixer ROM location
12
-    .word  0x03005F50   // new mixer RAM location (used for loading)
13
-    .halfword mixer_size
14
-    .halfword 0x400        // CpuSet, copy code by 32 bit units
15
-    .word  0x0203E000   // new PCM work area
16
-.org 0x081DD0C8
17
-     // set correct sound driver operation mode
18
-     // 12 channels at 31536 Hz samplerate
19
-    .byte  0x00, 0xCC, 0x99, 0x00
20
-.org 0x081DC094
21
-    .word  0x03005F50+1 // new mixer RAM location (used for branch)
22
-
23
-   // repoint correctly to the new cry tables
24
-.org 0x080720C8
25
-    .include "patches/disable_cry_table_blocks.s"
26
-
27
-   // cry-ID = poke-ID
28
-.org 0x08043304
29
-    LSL R0, R0, #0x10
30
-    LSR R0, R0, #0x10
31
-    BX  LR
32
-
33
-   // music overrides
34
-
35
-.org 0x0808064C // encounter music ([!] Box) song hook
36
-    LDR R1, =mhk_intro_music_id_to_song|1
37
-    BL  _call_via_r1
38
-    B   0x080806BA
39
-    .pool
40
-
41
-.org 0x08044090
42
-    LDR R1, =mhk_current_map_music_set_default_for_battle|1
43
-    BX  R1
44
-    .pool
45
-
46
-.org 0x080156FE // trainer victory music hook
47
-    LDR R0, =mhk_trainer_battle_play_defeat|1
48
-    BL  _call_via_r0
49
-    B   0x0801576E
50
-    .pool
51
-
52
-.org 0x08021D46  // wild poke defeated
53
-    BL  _call_via_r0
54
-.org 0x08021D94
55
-    .word   mhk_wild_poke_def_music|1
56
-
57
-.org 0x0807F9F8
58
-    LDR R1, =0x0807FA3E
59
-    BL  _call_via_r1
60
-    MOV R1, R0
61
-    B   0x0807FA3E
62
-    .pool
63
-
64
-.org 0x080159D0
65
-    LDR R0, =mhk_fadeout|1
66
-    BL  _call_via_r0
67
-    B   0x080159DC
68
-    .pool
69
-
70
-//---------------------
71
-// ipatix misc stuff
72
-//---------------------
73
-
74 4
 // disable help menu
75 5
 // see: https://www.pokecommunity.com/showthread.php?t=364909
76 6
 .org 0x0813B8C2

+ 87
- 0
patches/music.asm View File

@@ -1,3 +1,5 @@
1
+// songtable repointing
2
+
1 3
 .org 0x081DD11C
2 4
 .word _songtable
3 5
 
@@ -12,3 +14,88 @@
12 14
 
13 15
 .org 0x081DD224
14 16
 .word _songtable
17
+
18
+
19
+
20
+// titlescreen cry id fix
21
+
22
+.org 0x080791EE
23
+ldr r2, =titlescreen_cry_id_override+1
24
+bx  r2
25
+.pool
26
+
27
+
28
+
29
+// titlescreen music length extension
30
+.org 0x08078C1C
31
+    .word 0x18D8 // 53 seconds * 2 (loops) * 60 fps
32
+
33
+
34
+// high quality mixer installation stuff
35
+
36
+.org 0x080007B4
37
+    .word  0x0203E000   // new PCM work area
38
+
39
+.org 0x081DD0B4
40
+    .word  main_mixer   // new mixer ROM location
41
+    .word  0x03005F50   // new mixer RAM location (used for loading)
42
+    .halfword mixer_size
43
+    .halfword 0x400        // CpuSet, copy code by 32 bit units
44
+    .word  0x0203E000   // new PCM work area
45
+
46
+.org 0x081DD0C8
47
+     // set correct sound driver operation mode
48
+     // 12 channels at 31536 Hz samplerate
49
+    .byte  0x00, 0xCC, 0x99, 0x00
50
+
51
+.org 0x081DC094
52
+    .word  0x03005F50+1 // new mixer RAM location (used for branch)
53
+
54
+
55
+
56
+// new cry tables
57
+
58
+.org 0x080720C8
59
+    .include "patches/disable_cry_table_blocks.s"
60
+
61
+.org 0x08043304    // cry-ID = poke-ID
62
+    lsl r0, r0, #0x10
63
+    lsr r0, r0, #0x10
64
+    bx  lr
65
+
66
+// trainer music overrides
67
+
68
+.org 0x0808064C // encounter music ([!] Box) song hook
69
+    LDR R1, =mhk_intro_music_id_to_song|1
70
+    BL  _call_via_r1
71
+    B   0x080806BA
72
+    .pool
73
+
74
+.org 0x08044090
75
+    LDR R1, =mhk_current_map_music_set_default_for_battle|1
76
+    BX  R1
77
+    .pool
78
+
79
+.org 0x080156FE // trainer victory music hook
80
+    LDR R0, =mhk_trainer_battle_play_defeat|1
81
+    BL  _call_via_r0
82
+    B   0x0801576E
83
+    .pool
84
+
85
+.org 0x08021D46  // wild poke defeated
86
+    BL  _call_via_r0
87
+.org 0x08021D94
88
+    .word   mhk_wild_poke_def_music|1
89
+
90
+.org 0x0807F9F8
91
+    LDR R1, =0x0807FA3E
92
+    BL  _call_via_r1
93
+    MOV R1, R0
94
+    B   0x0807FA3E
95
+    .pool
96
+
97
+.org 0x080159D0
98
+    LDR R0, =mhk_fadeout|1
99
+    BL  _call_via_r0
100
+    B   0x080159DC
101
+    .pool

+ 24
- 0
src/music/titlescreen.s View File

@@ -0,0 +1,24 @@
1
+#include <constants/pkmns.h>
2
+
3
+.text
4
+.thumb
5
+
6
+.global titlescreen_cry_id_override
7
+
8
+.align 2
9
+
10
+titlescreen_cry_id_override:
11
+    //ldr     r0, =PKMN_DEOXYS
12
+    //mov     r1, #0
13
+    //ldr     r2, =0x08071DF0+1       // cry_related
14
+    //bl      _call_via_r2
15
+    mov     r0, #80
16
+    ldr     r1, =m4aSongNumStart
17
+    bl      _call_via_r1
18
+    ldrb    r0, [r4, #0xC]
19
+    ldr     r1, =0x080791F8+1       // hook return address
20
+    bx      r1
21
+
22
+.align 2
23
+_call_via_r1:
24
+    bx      r1