logo
 drop

Main

Community

Submissions

Help

Author Topic: Chrono Trigger MusiCompanion [v1.3]  (Read 32692 times)

zarradeth

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • zarradeth.wordpress.com
Chrono Trigger MusiCompanion [v1.3]
« on: June 05, 2010, 07:53:09 pm »
Well, after about two months of work, both programming and figuring out how Chrono Trigger behaves when playing music, I present you with the Chrono Trigger MusiCompanion (CTM for short).
To start things off, I'll give you a video of CTM in action.
http://www.youtube.com/watch?v=Gte4UPbx_5I

Chrono Trigger MusiCompanion (currently v1.3) is a DLL that is injected into an emulator (ZSNES v1.51, Snes9x v1.52Fix4, Geiger's Debug Snes9x ep9r8 & ep10r2) and allows you to play Chrono Trigger using an external soundtrack. It is Windows only, and has been tested and works fine on Windows XP and Windows 7 (and should work on other versions of Windows). There are various configurable options that let you tweak some settings about CTM, giving you a little more control over how CTM works. And most notably your replacement sound track is configured with a text file, all you have to do is set a path to the replacement file for the song you wish to replace. It is possible to mix in game and out of game music, all you have to do is enable an option in the configuration file and not set a replacement track for the song. CTM does all the patching for you.

Features__
* Works with any Chrono Trigger ROM (not the pre-release though). I have tested CTM with the original Chrono Trigger, Prophet's Guile, and beta versions of Crimson Echoes. CTM has preformed perfectly with all of them.
* Supports ZSNES v1.51, Snes9x v1.52Fix4, Geiger's Debug Snes9x ep9r8 & ep10r2.
* Supports song changing, song interruptions, and volume changes.
* Supports volume changes being interrupted with new volume changes, and song changes occurring while the volume is being changed.
* Benchmarks you computer and automatically sets up volume change speeds to match the speed of the original Chrono Trigger's as closely as possible (unless you configure it differently)
* Uses irrKlang, so multiple file formats are supported, most notably MP3, FLAC, and OGG.
* Patches Chrono Trigger when it is loaded into RAM (with up to 334 bytes of changes depending on your setup).
* Custom code is patched to any available space that is found (the first song that is no longer needed) and all jumps to my code are patched to correctly jump to wherever I put my custom code.
* All patches to the ROM are in RAM and none are permanent. All are lost once the ROM is unloaded from RAM.

Unsupported Features__
* Tempo changes are not supported and probably won't ever be.
* Reloading a new ROM is not supported, hard and soft resets work, but you must quit and restart CTM to load a new ROM.
* Commands that Chrono Trigger uses to wait for the end of a song are unsupported (and can't be).
* Rewinding, Saves States, and Fast Forwarding are not officially supported, but generally don't break things too badly. They are not recommended though.
* Echo is not supported, this is due to limitations with irrKlang and with how Chrono Trigger does Echo.

The source code for the programming is included for educational purposes. CTM is my first program I've written outside of school (so go easy on me if you want to criticize my code :3), and it has been a major learning experience. I have referenced other code and examples to better understand how to do certain things, so my intent with releasing the source is for others to reference and learn from. I am not releasing the source so you can steal it, claim it as your own, or tweak it and release the program as something completely new and your own, so please respect my wishes :). Also, if you look at the changelog, please leave my version numbers alone, I know they are totally screwy :P.

This release comes with no music, as I'm not a composer/remixer myself and audio isn't a strong suit. I wish to possibly create an 'unofficial soundtrack' that could be distributed alongside CTM, but interest wasn't high enough to get anything possibly done before a release (this would be a large project). If you are interested please hop over to the OCRemix thread I started for such a project (http://ocremix.org/forums/showthread.php?t=29321) and offer to help/voice you option/whatever.

If you encounter any bugs, please report them here and I will take a look at them and get back to you, hopefully with a fix. Or if you wish to leave feedback/feature suggestion- tell me and I'll see what I can do. I'm thinking that if enough people want tempo changing support I might do it. But I really don't think the work is worth the very small reward in this case. :P

And, most importantly, a download link-
CTM V1.3 (12/4/10) - http://www.mediafire.com/?l80ei2iuqvmups8
See the changelog for updates.

Now... Who was it that said you can't use MP3s with Chrono Trigger? ;)
« Last Edit: November 20, 2012, 02:31:59 pm by zarradeth »

Asylum

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Chrono Trigger MusiCompanion
« Reply #1 on: June 05, 2010, 11:56:10 pm »
I love you.

justin3009

  • Hero Member
  • *****
  • Posts: 1438
  • Location: Wisconsin
  • Welp
    • View Profile
Re: Chrono Trigger MusiCompanion
« Reply #2 on: June 06, 2010, 12:22:31 am »
Finally released this bad boy, eh?  Very great job on this for sure.  This'll definitely change Chrono Trigger modding.
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

DarknessSavior

  • Hero Member
  • *****
  • Posts: 5059
  • Location: Hikone, Japan
  • Darkness.
    • View Profile
    • DS: No, not the Nintendo one.
Re: Chrono Trigger MusiCompanion
« Reply #3 on: June 06, 2010, 01:44:39 am »
The backing instruments aren't the greatest quality, but if you'd like to you can use my cover of the song "Chrono Trigger" with this (as long as you credit me, of course):

http://dsrh.charsisforge.org/ct.mp3

~DS
Red Comet: :'( Poor DS. Nobody loves him like RC does. :'(
Sliver-X: LET ME INFRINGE UPON IT WITH MY MOUTH
DSRH - Currently working on: Demon's Blazon, Romancing SaGa, FFIV EasyType.
http://www.youtube.com/user/DarknessSavior

Mauron

  • Sr. Member
  • ****
  • Posts: 358
  • Location: Missouri
    • View Profile
Re: Chrono Trigger MusiCompanion
« Reply #4 on: June 06, 2010, 02:04:36 am »
Sounds interesting. Remind me to check it out later. Is there a way to make permanent changes in the future?

I might poke around with the source more than the actual program though. :P
Mauron wuz here.

zarradeth

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • zarradeth.wordpress.com
Re: Chrono Trigger MusiCompanion
« Reply #5 on: June 06, 2010, 02:44:01 am »
The backing instruments aren't the greatest quality, but if you'd like to you can use my cover of the song "Chrono Trigger" with this (as long as you credit me, of course):

http://dsrh.charsisforge.org/ct.mp3

~DS
Thanks for the offer DarknessSavior. It's not so much that I'm looking for individual tracks (and I like yours), it's that there are 83 tracks in CT (including the silence track and ~24 that are sound effects). Getting enough people involved and willing to help is the problem. Because, honestly, even if the sound effect tracks aren't redone, that leaves 58 tracks that need to be replaced/remixed.

Sounds interesting. Remind me to check it out later. Is there a way to make permanent changes in the future?

I might poke around with the source more than the actual program though. :P
I could make an IPS patch that will apply all the patches to a rom. The only way to make the patches permanent are to rip a copy of the rom outta memory. And with the debug output this isn't hard. Just use a hexeditor that can edit ram (I use WinHex) and refer to the console output for where the rom is located at in memory. I have actually done this a couple times so that I could use the rom in the debug 9x to see what I was screwing up when patches weren't working right. But, I don't really do much special. I patch multiple things to jump to some code I've written so I can detect changes in an easier manner (Multiple ones for volume changes, one for all song changes), I patch all the music pointers (that are suppose to be silenced) to the silence track, and I have two patches that allow the rom to run while using silence for all the music. Both the party selection screen and the title screen will normally hang if no music is being played in game.
« Last Edit: June 06, 2010, 03:02:56 am by zarradeth »

Mauron

  • Sr. Member
  • ****
  • Posts: 358
  • Location: Missouri
    • View Profile
Re: Chrono Trigger MusiCompanion
« Reply #6 on: June 06, 2010, 03:13:58 am »
I patch all the music pointers (that are suppose to be silenced) to the silence track, and I have two patches that allow the rom to run while using silence for all the music. Both the party selection screen and the title screen will normally hang if no music is being played in game.

Based on that and a note in your code, I'd suggest doing a simple check on the silence track to make sure you're loading the right thing, and if not, load a copy of it from the DLL. Better that than having it crash, right?
Mauron wuz here.

zarradeth

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • zarradeth.wordpress.com
Re: Chrono Trigger MusiCompanion
« Reply #7 on: June 06, 2010, 03:25:10 am »
I patch all the music pointers (that are suppose to be silenced) to the silence track, and I have two patches that allow the rom to run while using silence for all the music. Both the party selection screen and the title screen will normally hang if no music is being played in game.

Based on that and a note in your code, I'd suggest doing a simple check on the silence track to make sure you're loading the right thing, and if not, load a copy of it from the DLL. Better that than having it crash, right?

Yeah, good point, that would be the best way to go about doing it. But in my defense, I don't expect anyone to ever move that track for any reason. Hell, moving it would probably only cause issues. It's one thing to insert a new song and repointer something to it, but to move the silence track, there really is no good reason to ever do that.  :P

kando

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Chrono Trigger MusiCompanion
« Reply #8 on: June 06, 2010, 10:32:33 am »
very nice, glad to see this released finally :DD

cheers zarra, great work all around!!

also i want a silence.mp3!!! xDD HI DEF SILENCE!!!

zarradeth

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • zarradeth.wordpress.com
Re: Chrono Trigger MusiCompanion
« Reply #9 on: June 06, 2010, 02:04:23 pm »
very nice, glad to see this released finally :DD

cheers zarra, great work all around!!

also i want a silence.mp3!!! xDD HI DEF SILENCE!!!
Oh, you could replace the silence track :P
It's just that right now I don't check to make 100% sure that I am patching the song pointers to the actual silence track in the rom, which is what Mauron is saying I should do (and I agree). I'll add that eventually, but I don't think it's important enough to worry about right now. Like I said, there is no reason to ever move the silence track, minus to spite me :P

--------------------
6/6/10 - V1.1
Added support for songs that are in the 400000h+ range to be correctly patched if it's needed
CTM now makes sure it's using an actual silence track when it patches songs to silence, if one is not found it attempts to make one.
CTM now terminates itself when there are errors that make it unable to run (no tracklist, no place to put code, etc.)
Song Mixing is now enabled by default

Updated the link in the first post. Now you can be happy Mauron :)
« Last Edit: June 06, 2010, 08:28:52 pm by zarradeth »

kando

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Chrono Trigger MusiCompanion
« Reply #10 on: June 06, 2010, 10:51:46 pm »
very nice, glad to see this released finally :DD

cheers zarra, great work all around!!

also i want a silence.mp3!!! xDD HI DEF SILENCE!!!
Oh, you could replace the silence track :P
It's just that right now I don't check to make 100% sure that I am patching the song pointers to the actual silence track in the rom, which is what Mauron is saying I should do (and I agree). I'll add that eventually, but I don't think it's important enough to worry about right now. Like I said, there is no reason to ever move the silence track, minus to spite me :P

Updated the link in the first post. Now you can be happy Mauron :)

LOL @ you replying to my sarcasm, it was a bad joke, wtf difference would it make xDD
<3

Mauron

  • Sr. Member
  • ****
  • Posts: 358
  • Location: Missouri
    • View Profile
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #11 on: June 07, 2010, 12:04:43 am »
Yay! That made my 10 seconds! :P
Mauron wuz here.

FaustWolf

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #12 on: June 08, 2010, 03:00:12 am »
Whoa, this is a truly jaw-dropping accomplishment! If you're collecting usability reports zarradeth, I'm on Windows 7 and I had to run your executable in compatibility mode for Windows XP, Service Pack 3, for it to load .MP3 files properly. Otherwise the program froze for me upon loading non-game music.
Verve Fanworks: We shall shew thee here the force of our arms!

zarradeth

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • zarradeth.wordpress.com
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #13 on: June 08, 2010, 12:07:07 pm »
Whoa, this is a truly jaw-dropping accomplishment! If you're collecting usability reports zarradeth, I'm on Windows 7 and I had to run your executable in compatibility mode for Windows XP, Service Pack 3, for it to load .MP3 files properly. Otherwise the program froze for me upon loading non-game music.

Hmm, that's odd- I wrote and tested this mainly on Windows 7 (and a couple others who tested it were on Windows 7 as well afaik). My guess would be to try running as admin or disabling UAC (I have UAC disabled). I never ran into an issue like that.  :-\
I'm not sure what could be doing that..... But at least it's working for you in compatibility mode.
« Last Edit: June 08, 2010, 10:42:43 pm by zarradeth »

odditude

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #14 on: June 09, 2010, 02:54:22 pm »
Whoa, this is a truly jaw-dropping accomplishment! If you're collecting usability reports zarradeth, I'm on Windows 7 and I had to run your executable in compatibility mode for Windows XP, Service Pack 3, for it to load .MP3 files properly. Otherwise the program froze for me upon loading non-game music.

Hmm, that's odd- I wrote and tested this mainly on Windows 7 (and a couple others who tested it were on Windows 7 as well afaik). My guess would be to try running as admin or disabling UAC (I have UAC disabled). I never ran into an issue like that.  :-\
I'm not sure what could be doing that..... But at least it's working for you in compatibility mode.
what are each of your paths for all related files?

FaustWolf

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #15 on: June 09, 2010, 05:14:26 pm »
I placed the MusiCompanion and ZSNES in a folder on my desktop, so that would be:

desktop/folder/Musicompanion.exe
desktop/folder/ZSNES.exe

Music was placed one level deeper, desktop/folder/music/

The only thing I didn't have directly in the Musicompanion folder structure was the copy of Chrono Trigger itself. Could that make a difference, you think?
Verve Fanworks: We shall shew thee here the force of our arms!

zarradeth

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • zarradeth.wordpress.com
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #16 on: June 09, 2010, 05:22:46 pm »
I placed the MusiCompanion and ZSNES in a folder on my desktop, so that would be:

desktop/folder/Musicompanion.exe
desktop/folder/ZSNES.exe

Music was placed one level deeper, desktop/folder/music/

The only thing I didn't have directly in the Musicompanion folder structure was the copy of Chrono Trigger itself. Could that make a difference, you think?

It shouldn't, as I also don't have my copy of Chrono Trigger in the same directory as CTM and ZSNES. I'll try moving the music around to different folders on my computer once I get a chance and see if I can reproduce the problem you are having. I haven't really tried loading music from folders other than a music folder that is in the same folder as the ZSNES and CTM file. But I know it's supported by irrKlang. They specifically do it in some of their examples that come with their code.

Was it messing up when it was trying to play the music in game? Or when it was importing the paths from your song list?

Edit:
Oh wait, you were putting the music in the folder that I recommend putting it, right? So like-
desktop/folder/Musicompanion.exe
desktop/folder/ZSNES.exe
desktop/folder/music/file.mp3

Cause that's my exact layout  ('cept mine is in the C: drive, not on my desktop) ~.~
My best guess would be, if you haven't tried. Try running as admin or with UAC disabled.

Edit 2:
I absolutely can't reproduce this. I have tried loading CTM from other hard/flash drives, weird/long directories, using deeper folders, using folders that are levels above CTM, reenabling UAC. I think I had something happen like this once during development, I fixed it by overwriting the track list with another one (that was exactly the same) that I had. I dunno what is causing this...
And the location of the music shouldn't matter, as it doesn't actually check that the songs exist, it just loads the paths as strings to be passed to irrKlang, so I really have no idea :S
Does it tell you that it can't open the Track list file or that all your tracks have no replacement? 'Cause the first would mean that CTM cannot (obviously) open the file, the later means that it can open the file, but can't read it correctly for some reason.
« Last Edit: June 10, 2010, 01:37:50 am by zarradeth »

FaustWolf

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #17 on: June 10, 2010, 02:24:40 am »
Curious! I re-downloaded everything just now and I'm not experiencing the problem anymore. I did disable my Winamp agent first as a test, but it's even running normally with the Winamp agent back in place. No need to run in compatibility mode anymore. Maybe something was funky with my system when I first tried it out, because everything seems to check out now!
Verve Fanworks: We shall shew thee here the force of our arms!

odditude

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #18 on: June 10, 2010, 08:09:12 pm »
I placed the MusiCompanion and ZSNES in a folder on my desktop, so that would be:

desktop/folder/Musicompanion.exe
desktop/folder/ZSNES.exe

Music was placed one level deeper, desktop/folder/music/

The only thing I didn't have directly in the Musicompanion folder structure was the copy of Chrono Trigger itself. Could that make a difference, you think?
it most definitely could have been the difference.  it wouldn't surprise me if the app likely needed elevation to access the location of the CT rom.

zarradeth

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • zarradeth.wordpress.com
Re: Chrono Trigger MusiCompanion [v1.1]
« Reply #19 on: June 10, 2010, 10:37:23 pm »
I placed the MusiCompanion and ZSNES in a folder on my desktop, so that would be:

desktop/folder/Musicompanion.exe
desktop/folder/ZSNES.exe

Music was placed one level deeper, desktop/folder/music/

The only thing I didn't have directly in the Musicompanion folder structure was the copy of Chrono Trigger itself. Could that make a difference, you think?
it most definitely could have been the difference.  it wouldn't surprise me if the app likely needed elevation to access the location of the CT rom.

Actually, CTM doesn't even know the location of the ROM :P

All patches are done in memory after the emulator has loaded the ROM. This makes the changes temporary (since there are zero reasons to want them to be permanent), and it allows me to patch each ROM differently as needed.
One of my goals with CTM was to support any CT ROM, and this could not be done with something like an IPS patch, as different ROMs may/will need to be patched differently. CTM should be compatable with all current and future CT hacks--
As long as nobody starts moving subroutines for music and stuff around in their hack, but for some reason I get the feeling this won't be an issue.