Started out simple enough, the FE8 routine is exactly the same as the FE7 routine and a quick search showed that the routine is at 0x08072D80 and the table is at 0x0875A60. So I just swapped the values in, giving me:
FILE_ST:
@ Offset of routine - 0x080728D0
.align 2
.long 0x08000000
.set PCTH_ORG, 0x080728D0
.set PCTH_SIZE, (PCTH_END - PCTH_ST) + 4
@.org PCTH_ORG
.long PCTH_ORG
.long 0x00000000
.long PCTH_SIZE
.thumb
@ R0 -
PCTH_ST:
push {r4, r5} @ Store necessary values.
ldr r0, [r0] @ Load enemy data.
ldrb r2, [r0,#0x4] @ R2 = character number
ldr r0, =0x8758A60 @ 0x08758A60 = offset of music table
mov r4, #0x0 @ Set R4 equal to our "null" pointer (0x00)
mov r5, r0 @ Store data in R5, I suppose.
ldrb r0, [r2, r5] @ Load music byte for enemy.
cmp r0, r4 @ If our result is 0x00, then check for player music (allows for boss music to override)
bne FIN
mov r0, r6 @ Replace enemy memory slot with player.
ldr r0, [r0] @ Load player data.
ldrb r2, [r0,#0x4] @ R2 = player number
ldrb r0, [r5, r2] @ Load music byte for player.
cmp r0, r4 @ Check for null pointer again
bne FIN
mov r4, #0x1
neg r4, r4
mov r0, r4 @ If it is the null pointer, replace it with negative 1.
FIN:
pop {r4, r5} @ Clean up.
bx lr @ Return.
lsl r0, #0x0 @ Padding.
PCTH_END:
I assembled that and got:
0000 0008 d028 0708
0000 0000 2e00 0000
30b4 0068 0279 0948
0024 051c 505d a042
08d1 301c 0068 0279
a85c a042 02d1 0124
6442 201c 30bc 7047
0000 0000 608a 7508
So the first line looks like a pointer to the routine’s offset, the second line I don’t know, and the rest is the routine. So I insert the routine, and test it. Instead of battle music, I get random sounds like Fimbulvetr and Beep(confirm). So I went to the table and replaced everything with 00, and everyone gets default music, as expected.
But when I try to use the Character Music Editor.nmm (updated with FE8 offsets and lists), it only works for enemies. I did some messing around and found that changing 0x80 (0x00758AE0) will change the music of the generic Fighter on the right, while 0x82 (0x00758AE2) changes the music for the generic fighter on the right. 0x68 changes the boss (O’Neill) music. But setting these to 00 gives the default music whether or not Eirika and Seth have set music.
What did I do wrong?