1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
.nds
.thumb
.open "pkmndiamond.bin", "pkmndiamond_musicfix.bin", 0x02000000
NEW_INDEX_TO_MUSIC_SUBR_HOOK equ 0x02047678
OLD_INDEX_TO_MUSIC_SUBR_END equ 0x020476C6
ITCM_SRC_START equ 0x02106FA0
ITCM_DEST_START equ 0x01FF8000
ITCM_OLD_SIZE equ 0x700
NEW_INDEX_TO_MUSIC_SUBR equ ITCM_SRC_START + ITCM_OLD_SIZE
NEW_INDEX_TO_MUSIC_SUBR_ITCM equ ITCM_DEST_START + ITCM_OLD_SIZE
; Hook that jumps to our new subroutine
.org NEW_INDEX_TO_MUSIC_SUBR_HOOK
mov r1,r4
bl org() + 6
b OLD_INDEX_TO_MUSIC_SUBR_END
ldr r2,=#(NEW_INDEX_TO_MUSIC_SUBR_ITCM + 1)
bx r2
.pool
; New subroutine. Checks each relevant index one-by-one and picks the correct music+intro
.org NEW_INDEX_TO_MUSIC_SUBR
.area 168
push r14
ldr r2,=#0x1DF ; Rotom
cmp r0,r2
beq @@music_legendary
ldr r2,=#0x1E0 ; Uxie
cmp r0,r2
beq @@music_lake_trio
ldr r2,=#0x1E1 ; Mesprit
cmp r0,r2
beq @@music_mesprit
ldr r2,=#0x1E2 ; Azelf
cmp r0,r2
beq @@music_lake_trio
ldr r2,=#0x1E3 ; Dialga
cmp r0,r2
beq @@music_dialga_palkia
ldr r2,=#0x1E4 ; Palkia
cmp r0,r2
beq @@music_dialga_palkia
ldr r2,=#0x1E5 ; Heatran
cmp r0,r2
beq @@music_legendary
ldr r2,=#0x1E6 ; Regigigas
cmp r0,r2
beq @@music_legendary
ldr r2,=#0x1E7 ; Giratina
cmp r0,r2
beq @@music_legendary
ldr r2,=#0x1E8 ; Cresselia
cmp r0,r2
beq @@music_cresselia
ldr r2,=#0x1EB ; Darkrai
cmp r0,r2
beq @@music_legendary
ldr r2,=#0x1EC ; Shaymin
cmp r0,r2
beq @@music_shaymin
ldr r2,=#0x1ED ; Arceus
cmp r0,r2
beq @@music_arceus
@@music_regular:
mov r0,r1
b @@subr_end
@@music_legendary:
mov r0,#0x13
b @@subr_end
@@music_lake_trio:
mov r0,#0x10
b @@subr_end
@@music_mesprit:
mov r0,#0x11
b @@subr_end
@@music_dialga_palkia:
mov r0,#0xF
b @@subr_end
@@music_cresselia:
mov r0,#0x14
b @@subr_end
@@music_shaymin:
mov r0,#0xE
b @@subr_end
@@music_arceus:
mov r0,#0x12
b @@subr_end
@@subr_end:
pop r1
bx r1
.pool
.endarea
.close
|