+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Breath of Fire 2 SPC music hacking
Pages: [1]
Author Topic: Breath of Fire 2 SPC music hacking  (Read 1 times)
nintendo_nerd85
Guest
« on: November 21, 2010, 08:10:57 pm »

Hi  Grin  So, I'd like to start off by mentioning that Breath of Fire 2 is one of my all time favorite RPGs on the SNES.  But there's just one problem....the game changes the battle theme roughly halfway through the story. Now, I'v e  seen multiple videos on youtube that show hacking people have done to SNES games by injecting SPC data into certain points. One example is using the Battle Theme 2 in Chrono Trigger as the main battle theme. Another example is people playing a Final Fantasy song in Secret of Mana. Normally, something like this would most likely require extensive hexadecimal hacking and a heck of a lot of patience. So, this leads me to my question: In Breath of Fire 2, is it possible to change the SPC700 song data so that instead of having the plot change the battle theme, have the battle theme stay the same throughout the entire storyline? Does this make any sense. I just don't like the second battle theme later on in the game and want to keep the same one. Please let me know. Thanks  Cool
Ryusui
Guest
« Reply #1 on: November 21, 2010, 08:15:34 pm »

It should be possible without tinkering with the SPC data at all. Just find the flag which trips, setting the battle theme to the alternate version, and make sure it never gets tripped. Better still, disable the check altogether, or "jam" it so that it always finds in favor of the regular battle theme.

The most you'd probably have to do is find the routine that loads the music data into the SPC processor and work backwards from there.
nintendo_nerd85
Guest
« Reply #2 on: November 21, 2010, 08:28:01 pm »

What's the best way to get started? Something like this could give me a good challenge.
Ryusui
Guest
« Reply #3 on: November 21, 2010, 09:27:50 pm »

Start with Geiger's SNES9x Tracer and Anomie's register doc. Find the SPC registers and set breakpoints for them - this will catch the SNES in the act of writing music data to the SPC. From there, work backwards and identify the function call. Once you know how the game decides which music data to load into the SPC, the rest is simple.
nintendo_nerd85
Guest
« Reply #4 on: November 21, 2010, 11:02:16 pm »

Cool. Went ahead and downloaded the necessary files (easy enough to find). Gonna do some experimenting and see what happens.  Grin

Edit 11/22/10 9:30AM: Perhaps I'm missing something here, but when I was looking through Anomie's document, I didn't find anything related to altering/locating the  SPC700 registers.....Perhaps if someone could give me some hints as to where I can locate it.
« Last Edit: November 22, 2010, 11:31:38 am by nintendo_nerd85 »
Ryusui
Guest
« Reply #5 on: November 22, 2010, 02:36:24 pm »

Here:

Quote
2140 rwb++++ APUIO0 - APU I/O register 0
2141 rwb++++ APUIO1 - APU I/O register 1
2142 rwb++++ APUIO2 - APU I/O register 2
2143 rwb++++ APUIO3 - APU I/O register 3
        xxxxxxxx

        These registers are used in communication with the SPC700. Note that
        the value written here is not the value read back. Rather, the value
        written shows up in the SPC700's registers $f4-7, and the values
        written to those registers by the SPC700 are what you read here.

        If the SPC700 writes the register during a read, the value read will
        be the logical OR of the old and new values. The exact cycles during
        which the 'read' actually occurs is not known, although a good guess
        would be some portion of the final 3 master cycles of the 6-cycle
        memory access.
       
        Note that these registers are mirrored throughout the range
        $2140-$217f.

Anomie also has an SPC700 doc. This part in particular seems to be useful:

Quote
To properly manipulate this into uploading your data, the following procedure
seems to work:
 1. Wait for a 16-bit read on $2140-1 to return $BBAA.
 2. Write the target address to $2142-3.
 3. Write non-zero to $2141.
 4. Write $CC to $2140.
 5. Wait until reading $2140 returns $CC.
 6. Set your first byte to $2141.
 7. Set your byte index ($00 for the first byte) to $2140.
 8. Wait for $2140 to echo your byte index.
 9. Go back to step 6 with your next byte and ++index until you're done.
10. If you want to write another block, write the next address to $2142-3,
    non-zero to $2141, and index+2 (or +3 if that would be zero, otherwise
    it'll screw up the next transfer) to $2140 and wait for the echo. Then go
    to step 6 with index=0.
11. Otherwise, you can jump to some code you've just uploaded. Put the target
    address in $2142-3, $00 in $2141, and index+2 in $2140 and wait for the
    echo. Shortly afterwards, your code will be executing.

So you'll want to set a read breakpoint for $2140. The game will check for when the value it loads from that register equals $BBAA, and when that happens, it'll begin the SPC load process as described. You don't need to understand it so much as recognize when it's taking place: you won't be modifying this code, you'll be modifying the code that ultimately calls this code.
nintendo_nerd85
Guest
« Reply #6 on: November 22, 2010, 08:03:37 pm »

*Whew* I'm gonna need to study this before I even ATTEMPT to tackle it.  Grin
« Last Edit: November 22, 2010, 08:39:05 pm by nintendo_nerd85 »
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC