Users browsing this thread: 1 Guest(s)
Make "The Veldt" jungle theme play everywhere on the overworld Map.

#1
Posts: 464
Threads: 39
Thanks Received: 16
Thanks Given: 15
Joined: Aug 2010
Reputation: 3
Status
Runic
Is there any way to make the jungle music that plays when the party is on the Veldt play everywhere on the World of Balance map, basically replacing the regular World of Balance Theme? Any knowledge of coding would be helpful because I usually mess something up and my rom goes black.
  Find
Quote  

#2
Posts: 3,856
Threads: 271
Thanks Received: 782
Thanks Given: 444
Joined: Oct 2011
Reputation: 63
Status
Tissue-aware
Here's the relevant code concerning the world maps song loading:

Code:
EE/8A0D:    AD641F      LDA $1F64      (Map number from SRAM, low byte)
EE/8A10:    2903        AND #$03       (We only care about world maps... and the Serpent Trench)
EE/8A12:    0A          ASL A          (Multiply by 2)
EE/8A13:    AA          TAX            (Set as song index)
EE/8A14:    ADB71E      LDA $1EB7      (Event bits)
EE/8A17:    8901        BIT #$01       (Is the "alternate overworld music" bit set?)
EE/8A19:    F001        BEQ $8A1C      (Branch if not) (LSR A, BCC...)
EE/8A1B:    E8          INX            (Increase song index)
EE/8A1C:    BF9183EE    LDA $EE8391,X  (Song number)
EE/8A20:    8D801F      STA $1F80      (Save in SRAM)


You have some free space in bank EE. You could jump to that free space and insert the following code:

Code:
first:
EE/8A0D: JSR $EE/B000

Now at EE/B0000:
01) LDA $1F64     (Map number from SRAM, low byte)
02) AND #$03      (We only care about world maps... and the Serpent Trench)
03) CMP #$01      (Check if in WOB)
04) BNE $????     (jump to step 7)
05) LDA #$19      (Veldt song ID)
06) JMP $????     (Jump to step 14)    
07) ASL A         (Multiply by 2)
08) TAX           (Set as song index)
09) LDA $1EB7     (Event bits)
10) BIT #$01      (Is the "alternate overworld music" bit set?)
11) BEQ           (Branch to step 13)
12) INX           (Increase song index)
13) LDA $EE8391,X (song number)
14) STA $1F80     (Save in SRAM)
15) RTS

Finally, NOP everything up to EE/8A20 (except your first JSL instruction).

With this code, the Veldt music would play in the WOB but the WOR would still have its 2 different map songs. I haven't tested this but I think my logic is good even if my coding is more than lazy :P
  Find
Quote  

#3
Posts: 464
Threads: 39
Thanks Received: 16
Thanks Given: 15
Joined: Aug 2010
Reputation: 3
Status
Runic
Don't care about WOR, that's OK the way it is. I'm talking WOB, because I want to do a Donkey Kong hack where Donkey Kong replaces Terra and the World of Balance is the jungle. Also any hex editing tutorials on here so I can find the perameters I need to change on a hex editor? I've tried it many times but I often change something important because my Rom fails to start or crashes after I try to hex edit it.
  Find
Quote  

#4
Posts: 3,856
Threads: 271
Thanks Received: 782
Thanks Given: 444
Joined: Oct 2011
Reputation: 63
Status
Tissue-aware
Here's the hex values for the new code. I changed the JMP for a BRA which has the same result. The rest remains the same:

Code:
03) C901    CMP #$01      (Check if in WOB)
04) D004    BNE $????     (jump to step 7)
05) A919    LDA #$19      (Veldt song ID)
06) 800E    BRA $????     (Jump to step 14)

The last instruction, RTS, is 60. The parameter of a BRA and BNE instruction is the number of bytes between the instruction and the instruction it jumps to. You can find an instruction list here. Some instructions have a different hex value and variables numbers of parameters depending of the context they are use into.
  Find
Quote  

#5
Posts: 95
Threads: 3
Thanks Received: 3
Thanks Given: 5
Joined: Dec 2011
Reputation: 1
Status
None
Shouldn't this be a simple pointer change?
  Find
Quote  

#6
Posts: 3,856
Threads: 271
Thanks Received: 782
Thanks Given: 444
Joined: Oct 2011
Reputation: 63
Status
Tissue-aware
(01-03-2014, 03:45 AM)Vanya Wrote: Shouldn't this be a simple pointer change?

I thought of this quickly and tbh, I just assume my solution would leave open the possibility to use the overwold theme for something else.

A pointer change is in fact a simpler solution for someone who never coded. You could also opt for a solution similar to mine, but with an optimized approach. I'm sure there's a more elegant to do this than my coding.
  Find
Quote  

#7
Posts: 95
Threads: 3
Thanks Received: 3
Thanks Given: 5
Joined: Dec 2011
Reputation: 1
Status
None
OK. I thought as much. I was just wondering if there was a technical reason for your solution. Thanks. Smile
  Find
Quote  

#8
Posts: 94
Threads: 22
Thanks Received: 2
Thanks Given: 9
Joined: Oct 2017
Reputation: 0
Status
Auto-life
I recall there was a topic that had the pointers listed because I was able to replace the veldt music with the WoB if you were to return. i also got to change the WoR theme, but it has been a long time that I cannot remember the topic.
  Find
Quote  

#9
Posts: 3,856
Threads: 271
Thanks Received: 782
Thanks Given: 444
Joined: Oct 2011
Reputation: 63
Status
Tissue-aware
(07-27-2019, 05:03 AM)CzarMalboro Wrote: I recall there was a topic that had the pointers listed because I was able to replace the veldt music with the WoB if you were to return. i also got to change the WoR theme, but it has been a long time that I cannot remember the topic.

It's this list:

Code:
EE/8389:    35          (Blackjack; for the Blackjack)
EE/838A:    35          (Blackjack; normally unused)
EE/838B:    4C          (Searching for Friends; normally unused)
EE/838C:    4C          (Searching for Friends; when flying the WoR)
EE/838D:    13          (Techno de Chocobo; chocobo stables for WoB)
EE/838E:    13          (Techno de Chocobo; normally unused)
EE/838F:    13          (Techno de Chocobo; chocobo stables for WoR before finding the airship)
EE/8390:    13          (Techno de Chocobo; chocobo stables for WoR after finding the airship)
EE/8391:    06          (Terra; WoB overworld, excluding the Veldt)
EE/8392:    19          (Wild West; normally unused)
EE/8393:    4F          (Dark World; WoR before finding the airship)
EE/8394:    4C          (Searching for Friends; WoR after finding the airship)
EE/8395:    1A          (Save Them!; for mine-cart sequence)
EE/8396:    1A          (Save Them!; unused)
EE/8397:    28          (The Serpent Trench; for the Serpent Trench)
EE/8398:    28          (The Serpent Trench; normally unused)
  Find
Quote  

#10
Posts: 94
Threads: 22
Thanks Received: 2
Thanks Given: 9
Joined: Oct 2017
Reputation: 0
Status
Auto-life
Thank you.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite