Registrarse

[ASM] Legendary Battle Music Hack for Firered

Hello! Today I'm going to share an exclusive ASM routine of Jambo51, "Legendary Battle Music Hack."

If you use this routine, don't forget to give credits to Jambo51!

Código:
.text
.align 2
.thumb
.thumb_func
.global battlemusichackleg
main: push {r2,r3}
ldr r0, tableloc
there: ldrh r2, [r0, #0x0]
cmp r1, r2
beq loadmusic
ldr r3, end
cmp r2, r3
beq loadnormal
add r0, #0x4
b there
loadnormal: mov r1, #0xAA
lsl r1, r1, #0x1
add r1, #0x1
return: pop {r2,r3}
ldr r0, goback
bx r0
loadmusic: ldrh r1, [r0, #0x2]
b return
.align
end: .word 0x0000FEFE
goback: .word 0x0807FA3F
tableloc: .word 0xFFFFFFFF
Where to Insert: Navigate to 0x7F9F4 and change the bytes to 01 1C 00 00 00 48 00 47 XX XX XX 08.
Where the XX's stand for the pointer to the new routine plus 1.

Explanation: This routine reads what Pokémon species you are fighting, and searches a created table for that species. When it finds that species, it loads the associated music slot to modify what battle music you hear. If it doesn't find a matching species, it loads music slot 0x155 as standard.

The table should be set out as such:
Let's say you wanted Mewtwo to have slot 0x154, Mew to have slot 0x12B and Ho-oh to have slot 0x153. The table would be laid out like so:
9600 5401 9700 2B01 FA00 5301 FEFE 0000
In otherwords, you repeat this pattern until you want the table to end, which is were you put the "killing" half word. The number the routine looks for to mark the end of the table.

[Pokémon ID - Half word - in little endian (reverse hex)] [Music slot to load - Half word - little endian mode]

This table will only affect legendary battles which are run through special 0x138!
 
Arriba