Music Pointer Fixer
Revision as of 14:47, 24 June 2008 by PicklePower
From Sonic Retro
The Music Pointer Fixer by Erik JS helps music and sound porting between two Sonic games by fixing pointers from coordination flags. Furthermore, voice conversion is possible if you're dealing with Sonic 2 format, or if you have a Ristar song ready to be put in Sonic 1 (while you'll need to fix PSG and other things on your own, header and coordination flags will be arranged to work within the Sonic 1 engine).
First, you need to have a copy of the desired music as a bin or dat file and open it in the program. You can get music locations here. Only music with channel setup defined as 0603 or 0703 is supported.
Next, you'll need to choose which kind of conversion you want to do. All five options there should be self-explanatory (S2B/S2F/S3K fix has such a name because the pointers for those engines are in the same format).
The last step is filling the list of addresses with locations of pointers pertaining to coordination flags F6, F7 and F8. You can use the buttons ADD and REMOVE for this, or you can load and save text files with the respective buttons. When you use SCAN, the program attempts to recognize valid coordination flags by itself, but the results CAN be inaccurate. Once this step is done, you're ready to click the FIX button, then choose a filename for saving.
Where it's applicable, you can consider S3K as S3D or SC.
S1 to S2F and S2F to S1
Select "S2F voice conversion" to convert the voice from one format to another. If you don't do this, you'll still get the music working, but it won't be sounding like it sounds in its original game. If you want new voices, you'll have to do them yourself.
If you select "Tempo fix", the program will fix tempo in order to have the music playing at its original speed in the new engine. However you can do manual editing through a hex editor (byte 5) to suit your taste.
S1 to S2B/S3K and S2B/S3K to S1
You'll be asked for the location you want to put the music in (when Sonic 1 is the source), or the location you got the music from (when Sonic 1 is the destination). The program will calculate the Z80 bank position for the location you typed, and change S1 relative pointers to S2B/S3K absolute pointers, or vice-versa.
The program will ask you for flag conversion if the music is from/for S3K. It'll replace flags E3 and E9 (S1, S2B, S2F) with F9 and FB (SC, S3K, S3D, Ristar). It seems to be some kind of rule for games released after 1993, to stop music porting 10 years later or whatever. =P
Everything here is nothing but adjustment for various pointer format differences. Big change here, guys. Now you have SEVEN types of conversions for all your needs (I hope). Let's split 'em up:
S2B to S2F and S2F to S2B
Put the value corresponding to S2B original or intended location, and the program will assign $1380 to the one in S2F.
The program will calculate Z80 bank position for the location you typed for S2B, as well as the difference between S2B and S2F positions in Z80.
With the difference, the program will be adding it to the pointers (S2F to S2B), or subtracting (S2B to S2F). The "S2F voice conversion" works just like as explained in S1 to S2F.
S2F to S3K and S3K to S2F
It works just like what was said above, just replace S2B with S3K. It saves me some copy & paste. =P
S3K flag fix is available, for the same purpose which was explained for S1 to S3K. When converting from S3K to S2F, you'll also have the option of converting S3K DAC notes to their nearest matches with S2F's. The program will ask you for alternate DAC conversion. Only reply YES if the music is from SC instead of from S3K.
S2B to S3K and S3K to S2B
Insert original and intended locations. The program will calculate Z80 bank positions for the locations you typed, as well as the difference between them. It'll add to or subtract from the pointers in order to make the music fit the new location.
Just like as explained with S2F, the flag conversion will be available, and DAC conversion just for S3K to S2B.
S3K to S3K
As explained for S2B, S3K uses the same pointer format, so nothing that big but adding or subtracting to them in order to make the music fit the new location. No special options available.
The "Only fix the header" option will ignore the address list, it's supposed to be used with music which does not have any coordination flag that holds pointers. It is valid even for S2B/S2F/S3K fix.
Ristar to S1
The "Ristar to S1" option won't produce a fully working port. It'll only convert the header, fix the pointers from coordination flags F6/F7/F8 and replace coordination flags F9 and FB with E3 and E9 respectively. You are supposed to manually change PSG data and other segments in order to have it sounding like it sounds in Ristar. Otherwise, bizarre things like repeated SEGA sound may occur, so be wise. =P
Special thanks to
Please give me credit when using this tool for your hacks. Thanks.