Jump to content

Locating the byte(s) that controls battle music


Agro
 Share

Recommended Posts

Notice: currently being worked on by Blazer

I need to find the bytes in FE7 that control the battle music--specifically those for the following:

Player phase battle

Enemy phase battle

Staff music (both healing and status)

Play/Dance music

And also the battle preparations music

(don't need boss music)

I have tried looking through docs but none of them specifically pinpoint an address to change, and since I have no idea what to make of assembly routines I'm really struggling. The routines themselves are documented in Cam's notes, but due to poor documentation very few actual addresses are known. I have also tried using Cam's generic battle music hack to no avail. It doesn't seem to work the way it should and the problem of staff/dance music remains regardless.

original post:

Hey guys, so I'm just trying to make sense of some of Cam's docs so that I can change the bytes of battle music that's played. This is from the doc:

0x08067E48

@ Make no mistake: I stole most of this from Nintenlord. - Cam

@ decides battle music
@ call to 0x6768c sets battle music

@ Memory offset 0x20200A0 seems to contain a flag that determines whether to reload map music?

@ Experiments resulted in this:
@    
push {r4-r8,lr} ldr r0, =$203e094 @ Combatant unit data pointers ldr r1, =$203e098 ldr r5, [r0, #0x0] ldr r6, [r1, #0x0] ldr r1, =$202bbb8 mov r0, #0x20 ldrb r1, [r1, #0x4] and r0, r1 cmp r0, #0x0 beq label1 b label2 label1: ldr r1, =$20200a0 mov r0, #0x1 str r0, [r1, #0x0] ldr r1, =$203e020 ldr r0, =$203e00c mov r2, #0x0 ldsh r0, [r0, r2] lsl r0, r0, #0x1 add r0, r0, r1 mov r1, #0x20 mov r8, r1 ldrh r0, [r0, #0x0] cmp r0, #0x1 @ Check if enemy phase? beq label3 mov r2, #0x1f mov r8, r2 label3: bl $554f0 cmp r0, #0x1 bne label4 bl $3f6c b label5 label4: bl $4b1a0 cmp r0, #0x1 bne IsPromotion label5: mov r1, #0x80 lsl r1, r1, #0x1 mov r0, #0x48 @Arena music bl $6768c b end IsPromotion: ldr r0, =$203e02c ldrh r0, [r0, #0x0] cmp r0, #0x4 bne label7 mov r1, #0x80 lsl r1, r1, #0x1 mov r0, #0x1b @Promotion music bl $6768c b end @Legendary weapon music label7: ldr r7, =$203e010 mov r1, #0x0 ldsh r0, [r7, r1] neg r1, r0 orr r1, r0 lsr r4, r1, #0x1f ldr r0, =$202bbf8 ldrb r0, [r0, #0xe] cmp r0, #0x3e @Ninians Death event chapter? beq label8 mov r4, #0x0 label8: ldr r0, [r5, #0x0] ldrb r0, [r0, #0x4] cmp r0, #0x44 @Nergal beq label9 mov r4, #0x0 label9: ldr r0, [r6, #0x0] ldrb r0, [r0, #0x4] cmp r0, #0x27 @Athos beq label10 mov r4, #0x0 label10: cmp r4, #0x1 beq useLegendMusic mov r4, #0x0 add r0, r6, #0x0 add r0, #0x4a ldrh r0, [r0, #0x0] bl $533b0 @Checks if equipped item is legendary lsl r0, r0, #0x10 asr r0, r0, #0x10 cmp r0, #0x1 bne label12 mov r4, #0x1 label12: mov r0, #0x1 bl $533ec @Checks class/character? lsl r0, r0, #0x18 cmp r0, #0x0 bne label13 mov r4, #0x0 label13: mov r2, #0x0 ldsh r0, [r7, r2] cmp r0, #0x0 bne label14 mov r4, #0x0 label14: ldr r0, [r5, #0x0] ldrb r0, [r0, #0x4] cmp r0, #0x44 @Nergal bne label15 mov r4, #0x0 label15: cmp r0, #0x86 @Dragon bne label16 mov r4, #0x0 label16: cmp r4, #0x1 bne label17 useLegendMusic: mov r1, #0x80 lsl r1, r1, #0x1 mov r0, #0x1c @Blessing of the 8 generals bl $6768c b end @Enemy bosses label17: cmp r0, #0x86 bne label18 bl $79a9c lsl r0, r0, #0x18 asr r0, r0, #0x18 cmp r0, #0x1 bne label19 mov r1, #0x80 lsl r1, r1, #0x1 mov r0, #0x6F @Campaing of fire no intro bl $6768c b end label19: bl $79a90 label18: add r0, r5, #0x0 bl $68110 @loads boss music ID add r4, r0, #0x0 ldr r0, [r5, #0x0] ldrb r0, [r0, #0x4] bl $17d34 mov r1, #0xc0 ldrb r0, [r0, #0xb] and r1, r0 cmp r1, #0x0 bne label191 mov r4, #0x1 neg r4, r4 label191: ldr r0, =$203e010 mov r1, #0x0 ldsh r0, [r0, r1] cmp r0, #0x0 bne label20 mov r4, #0x1 neg r4, r4 label20: mov r0, #0x1 neg r0, r0 cmp r4, r0 beq label21 mov r1, #0x80 lsl r1, r1, #0x1 add r0, r4, #0x0 bl $6768c b end label21: mov r4, #0x0 @Load class & character abilities ldr r0, [r5, #0x0] ldr r1, [r5, #0x4] ldr r0, [r0, #0x28] ldr r1, [r1, #0x28] orr r0, r1 @Check if All Morphs, Boss Vaida ability is set mov r1, #0x80 lsl r1, r1, #0xc and r0, r1 cmp r0, #0x0 beq label22 ldr r0, =$202bbf8 ldrb r0, [r0, #0xe] @Load chapter ID lsl r0, r0, #0x18 asr r0, r0, #0x18 cmp r0, #0x2e @Final_pt1 bne label23 mov r4, #0x1 label23: cmp r0, #0x2f @Final_pt2 bne label22 mov r4, #0x1 label22: cmp r4, #0x1 bne IsDancer mov r1, #0x80 lsl r1, r1, #0x1 mov r0, #0x14 @Victory Now! bl $6768c b end IsDancer: mov r4, #0x0 ldr r0, [r6, #0x4] ldrb r1, [r0, #0x4] add r3, r0, #0x0 cmp r1, #0x40 @Dancer class ID bne label25 ldr r0, =$203a3d8 ldrh r2, [r0, #0x0] and r1, r2 neg r0, r1 orr r0, r1 lsr r4, r0, #0x1f mov r0, #0x80 lsl r0, r0, #0x2 and r0, r2 cmp r0, #0x0 beq label25 mov r4, #0x1 label25: cmp r4, #0x1 bne IsBard mov r1, #0x80 lsl r1, r1, #0x1 mov r0, #0x1d @Dancer music bl $6768c b end IsBard: mov r4, #0x0 ldrb r3, [r3, #0x4] cmp r3, #0x41 @Bard class ID bne label27 ldr r0, =$203a3d8 ldrh r1, [r0, #0x0] mov r0, #0x40 and r0, r1 lsl r0, r0, #0x10 lsr r0, r0, #0x10 neg r0, r0 lsr r4, r0, #0x1f mov r0, #0x80 lsl r0, r0, #0x2 and r0, r1 cmp r0, #0x0 beq label27 mov r4, #0x1 label27: cmp r4, #0x1 bne label28 mov r1, #0x80 lsl r1, r1, #0x1 mov r0, #0x1e @Bard music bl $6768c b end @Using staff label28: mov r0, #0x0 bl $67dbc cmp r0, #0x1 bne label29 ldr r0, =$203a3f0 @Attacker battle unit data b label30 label29: mov r0, #0x1 bl $67dbc cmp r0, #0x1 bne label31 ldr r0, =$203a470 @Defender battle unit data label30: add r0, #0x4a ldrh r0, [r0, #0x0] bl $67ddc b label32 label31: mov r0, #0x0 label32: cmp r0, #0x1 beq label33 cmp r0, #0x2 bne label34 mov r2, #0x1a @Curing mov r8, r2 b label34 label33: mov r0, #0x19 @Healing mov r8, r0 label34: mov r0, #0x1 neg r0, r0 cmp r8, r0 beq label2 mov r1, #0x80 lsl r1, r1, #0x1 mov r0, r8 bl $6768c b end label2: ldr r1, =$20200a0 mov r0, #0x0 str r0, [r1, #0x0] end: pop {r4-r8,pc}

The question is, how can I find which bytes match up to what? Since I basically have no idea how assembly works I'm a little out of my depth here. Obviously the routine starts at 0x08067E48 and this area:

label1:
    ldr r1, =$20200a0
    mov r0, #0x1
    str r0, [r1, #0x0]
    ldr r1, =$203e020
    ldr r0, =$203e00c
    mov r2, #0x0
    ldsh r0, [r0, r2]
    lsl r0, r0, #0x1
    add r0, r0, r1
    mov r1, #0x20
    mov r8, r1
    ldrh r0, [r0, #0x0]
    cmp r0, #0x1    @ Check if enemy phase?
    beq label3

    mov r2, #0x1f
    mov r8, r2

is probably the area of interest (specifically the 0x20 and 0x1F bytes) but how can I find those in a hex editor?

Edited by Agro
Link to comment
Share on other sites

tbh if i'd actually known what i was doing when i wrote those notes things would be better

if you can somehow find the offset of label1 (which i don't actually know offhand) the commands you're looking for are 01 20 (mov r1, #0x20) and 02 1F (mov r2, #x01F)

Link to comment
Share on other sites

you should totally just use my custom theme patch

which i really should finish redoing

Yep, I cannot find it.

h-heeeeeeeeeeelp

that's actually because i lied and the codes you're looking for are 20 21 and 1F 22 (im gud at asm guiz i sware)

enemy phase attack theme 08067E76

player phase attack theme 08067E80

Edited by CT075
Link to comment
Share on other sites

I just applied it, and all it did was disable battle music altogether. Instead it just plays the map theme straight through, which is kind of cool in and of itself because it's Showdown in Doluna Keep but this isn't what's meant to happen!!!!

thanks cam

Edited by Agro
Link to comment
Share on other sites

did you do th einstructions properly and fill out the table

(psst this is why that patch is on my bucket list of "things that need to be redone")

Edited by CT075
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

no, actually, it's not. The game decides that it only wants to play 7 tracks instead of 8 when playing any song between 0x00 and 0x7F and will continue to play 8 if only songs from 0x80 and onwards. Thus, it's quite crucial to my hack that the game never plays any song there. The pointer doesn't make a lick of difference D:

Edited by Agro
Link to comment
Share on other sites

buuuuuuuurrrnnnnneeeed

kidding, but just so no one else tries to do this, this is on my to-do list. well, you can do it, but make a post here saying it at least so that I don't do it as well since having 2 people trying to do the same thing is lame/a waste of time IMO. (And by all means get started and don't wait for me since I could be a few weeks...)

Link to comment
Share on other sites

Seem to have found everything, for the most part. Still missing battle preparations and Ride the Wind, as well as less important ones like Blessing of the 8 Generals. Boss music can be manually controlled, so no issues there. It just occurred to me that I need to find the vendor and armory songs, but I might be able to do that on my own. Here's the list:

0x3116C - 0x49 Prepare to Charge
0x680AA - 0x19 Healing
0x680B0 - 0x1A Curing
0x67ECC - 0x1B To the Heights
0x6802C - 0x1D Receive the Blessings of Water
0x67E76 - 0x1F Safeguard (battle version, not BGM version)
0x67E80 - 0x20 Strike
0x7965C - 0x2B Game Over
0x79690 - 0x2C Within Sadness 
0x68060 - 0x80 "Droplet" (some sound effect, not sure why Blazer wrote this down honestly)
0xB1368 - 0x4D Armory
0xB1372 - 0x46 Shop

So if you want music from another index to play, just change those bytes. Please note that these are 1-byte entries only, so you can't use songs in indices after 0xFF.

Edited by Agro
Link to comment
Share on other sites

if you do want to use them be prepared to do an extraordinarily tedious ASM hack given that all you want to do is increase the range of possible values lol

and idk why I wrote down the last one either I know I didn't SEARCH for the droplet SFX... maybe I wrote down the wrong offset? did you test them all?

again, sorry I couldn't find them all, I tried

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...