SPC help

View previous topic View next topic Go down

SPC help

Post by qwertymodo on Thu 16 Jun 2016 - 19:28

Time for yet another one of my endless request threads... sorry.

Ok, so in Hyrule Magic, the music editor lists some kind of offset for each channel of each "part", and then when you click on the button for that channel, it brings you to an editor at that offset.

[You must be registered and logged in to see this image.]

So, the question I have is whether or not these offsets are actually stored as pointers that can be manually changed, and whether anybody has any idea how to find them. The reason for this is that I want to alter the pointers of one song to point to a different song (so you can have 2 separate track numbers that play the same song, without actually having to duplicate the entire track in the SPC data, I get the feeling that trying to copy the whole track would end up overwriting things and cause issues...). Yes, I could achieve this in assembly, with a super hacky "if track #=x, play track y" routine, but I'd probably have to do it in the NMI routine, and I'm almost positive that adding another subroutine in there would bring back the title screen graphic glitches.


I've already done a fair bit of tracing, and I know that "Bank 1" is located from $198000-19D337 (0x0C8000-0CD337), and also I know that when you load a new track, the track number is stored at $004 inside the SPC memory. So, that's kind of where I'm at now. I can provide trace logs or disassembly, or whatever, but SPC is a whole new ballgame for me, and if I don't have to go to all of the trouble of learning a whole new asm system just to track this down, if anybody else is familiar with this stuff and willing to help track it down, I'd really appreciate it.

Thanks.
avatar
qwertymodo
                   
                   

Since : 2014-10-21

Back to top Go down

Re: SPC help

Post by  on Thu 16 Jun 2016 - 19:45

Not sure if this is what you wants, but here goes anyway.

Puzzledude wrote:Because the number of bytes needed to make music is very high, it is probably not possible to add more. For instance, you could not add old forest music and the new one. Old needs to be replaced with new.
 
Meanwhile I've decoded all sound/music in the rom. It is right after gfx:
 
87000-C3FFF = all gfx (compressed)
 
C4000-C7FFF = sound effects
 
C8000-D1CE4 = music (part A)
D1CE5-DB042 = music (part B), subject to change
DB043-DB7FF = music (part C), fixed part
 
 
Music pointers
0x914 (3 bytes), 0x932 (3 bytes), 0x936 (3 bytes), only 1 byte is relevant (subject to change)
 
 
If part A and C are matching with Alttp (like PU), change pointers + part B to insert new track. If part A is not matching (like in Gates of Time for instance), insert part A from Alttp, and part B changed + pointers. Part C must always match.
 
If all parts are inserted from Alttp, the sound and music is completely debugged (restored to default).

Puzzledude wrote:
SePH wrote:Also @ puzzledude, could you hex decode the custom zelda 1 song used in parallel worlds? as I might use it for one of my dungeons Razz
 
I was actually thinking of doing that myself. Of course the problem is to isolate one particular song, since it seems, that the changes to one song, changes the entire music B area. So what we would need is to implement all SPC's of all custom songs into original Alttp and paste the code from C8000 to DB7FF, particularly from D1CE5 to DB042.
 
If we take this from PW only, a custom music from Z1 will be included, but the Lost Woods excluded. This is because a custom music has a much wider effect to the string. So I haven't yet figured out, how to use both custom tracks in one rom.

PS
Any false or partial changing of the code, will immediately result in no-sound bug.

Puzzledude wrote:The Zelda1 Dungeon song has overwritten the old song Kill Agahnim. Smart move by Euclid, since this song appears only in second battle with Agahnim, which is not in PW. But this song is shorter, so probably they had to find some more empty space elsewhere in the rom.

PS
I can also compare Alttp + Lost Woods, and Alttp + Lost Woods + Zelda1 music. Then we can see if the tracks can be isolated. If the same section D1000-DB000 is changed again, the songs can not be isolated, since all song would function as one long code.

Found that in here: [You must be registered and logged in to see this link.]

^^I believe you have clearance to access that area of the board.

                        
                        

Since : 2012-06-19

Back to top Go down

Re: SPC help

Post by qwertymodo on Thu 16 Jun 2016 - 20:27

Hmm... there's good info there, but not what I'm looking for.  Basically I want to do the same thing as track 18/24, where both tracks use the same pointers to the same data.

[You must be registered and logged in to see this image.]
avatar
qwertymodo
                   
                   

Since : 2014-10-21

Back to top Go down

Re: SPC help

Post by qwertymodo on Fri 17 Jun 2016 - 2:12

Oh man, I think I totally lucked out. There is a single table with a 2-byte pointer per song at 0x0D1EF8 (0x0D1EF9 for LoZ3, I guess HM shifted it up 1 byte for some reason). So I don't have to copy a whole bunch of pointers, just 2 bytes per song. For example, if I want to make track 2 play for both track 2 and track 4, I copy the 2 bytes at 0x0D1EF8 + (2 * 2) to 0x0D1EF8 + (2 * 4). Done and done. I now have a nifty little surprise that I plan to add to PW with this Very Happy
avatar
qwertymodo
                   
                   

Since : 2014-10-21

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum