Chrono Compendium

Kajar Laboratories - Fan Works and Submissions => Chrono Trigger Modification => Topic started by: IHBP on May 01, 2022, 05:12:11 pm

Title: Adding music?
Post by: IHBP on May 01, 2022, 05:12:11 pm
I'm working with some other hackers to add the tracks exlusive to the later versions into Chrono Trigger Plus.
This seems to work pretty easy for msu-1 but I noticed while looking for the song pointers (which I can't find) that the game has byte that sets a song limit x53 which I assume is x00 to x52. Can someone add additional songs to the native game by increasing that number and changing some pointers (if there even is any)
Title: Re: Adding music?
Post by: Mauron on May 01, 2022, 06:22:41 pm
Changing pointers, expanding data tables, etc, etc etc,

Adding new (insert thing here) to an SNES ROM is always a pain compared to replacing existing ones.
Title: Re: Adding music?
Post by: Vehek on May 01, 2022, 08:28:27 pm
There are four pieces of data associated with each song slot: Sequence data, the instrument table, the drum table, and some volume-related data.
Code: [Select]
070AE9 070AE9 DATA N Total number of songs ($53)
070D18 070E10 PTR N "SPC pointers (83 addresses), SPCs may be compressed, data doesn't match SPC files" 2003.05.08
070E11 071870 DATA N "Instrument table (83 elements, 32 bytes each)" 2003.05.27
071871 07241C DATA N "Unknown data, 0x24 bytes per song, 0x53 total" 2008.07.30
07241D 0724C2 DATA N "Unknown data, volume related? 2 bytes per song, 0x53 total" 2008.07.30

Code: (SPC Pointer table) [Select]
C7/050F:        BF180DC7        LDA $C70D18,X
C7/0513:        8512            STA $12
C7/0515:        BF190DC7        LDA $C70D19,X
C7/0519:        8513            STA $13
C7/051B:        BF1A0DC7        LDA $C70D1A,X
C7/051F:        8514            STA $14

Code: (Instrument table) [Select]
C7/01EA:        BF110EC7        LDA $C70E11,X
C7/01EE:        F01F            BEQ $020F
C7/01F0:        9212            STA ($12)
C7/01F2:        E612            INC $12
C7/01F4:        E612            INC $12

Code: (Drum table offset) [Select]
C7/05B2:        A971            LDA #$71
C7/05B4:        8512            STA $12
C7/05B6:        A918            LDA #$18
C7/05B8:        8513            STA $13
C7/05BA:        A9C7            LDA #$C7
C7/05BC:        8514            STA $14

Code: (Volume-related data) [Select]
C7/0A45:        BF1E24C7        LDA $C7241E,X
C7/0A49:        8502            STA $02
C7/0A4B:        BF1D24C7        LDA $C7241D,X
C7/0A4F:        290F            AND #$0F
The simple edit would be to change the addresses in these blocks of code to new locations and copy all the old data over to the new places and add the new data after. More complex was some Japanese RS3 hacks did to load data from a new location only when an additional song slot was used.

Even with the max-song byte edited, I don't believe Temporal Flux will allow you to select the additional song slots, so you'll have to use a workaround to insert them into events, similar to the tutorial on using the last few enemy slots (https://www.chronocompendium.com/Term/Adding_Unselectable_Enemies.html). (Unless it's something done by setting a memory address, like the overworld music or default battle music for an area.)
Title: Re: Adding music?
Post by: IHBP on May 01, 2022, 09:51:44 pm
That actually clears up quite a bit, though dealing with compression scares me a little 😳

I'll forward this to the guys helping inject the songs. I can handle getting the maps to play them with a hex editor with little inconvenience.

Thanks for the detailed response.
Title: Re: Adding music?
Post by: PowerPanda on May 28, 2022, 07:38:53 pm
This is a very helpful thread. I've been able to relocate the data tables and still have everything function the way it should. Next step is workign on expanding the tables, which I don't think will be a huge issue.

One note is that the first "unknown" data table doesn't appear to be related to the music. I zeroed it all out, and what it seemed to affect was sprite layering.
Title: Re: Adding music?
Post by: IHBP on June 01, 2022, 10:55:20 am
Discovered a bit of an annoyance. Setting the track number to anything higher than x52 in a hex editor will cause Temporal Flux to auto save  it to xFF the next time that map is opened, is there any way to turn that off?
Title: Re: Adding music?
Post by: PowerPanda on June 02, 2022, 12:58:37 am
Could you create an anti-patch? If the data is always going to be in the same place (ie - it will always be at 36/010A), then you could make your manual edits, create a patch with just the music tracks change, and then re-apply that patch to your rom after every time you save in Temporal Flux. I had to do that with my FFVI hack, because FF3usME kept trying to overwrite some of my relocated data. I created an anti-patch to put the minimap back where I intended it to be, and ran that anti-patch after every save.

I completed the music expansion hack, and as long as I was relocating data, I expanded the tables to allow for up to 101 music tracks (hex: $65). I will start a new thread for the actual patch.
Title: Re: Adding music?
Post by: Zakyrus on June 05, 2022, 09:33:56 pm
IHBP ..
I think there is a way to do that with the custom data menu option where you can actually just repoint existing data somewhere else manually. I haven't used that yet(have been eyeing it for some time though) and nobody has ot documented yet.

Probably only Geiger knows how it really works so at some point I'll have to look into it I want to make this in the tutorial video anyway.

Try it if you figure anything out with it let me know I will also do the same this could be one of those things that could save us a lot of time.

~Z