Twilight Princess: Disable sound effects for complete OST rip? by valiant at 12:12 PM EDT on October 15, 2007
Hey hcs, I think I need some input on that. I'm trying to do a complete rip of the Twilight Princess music at the moment.
For previous recordings, I used the Action replay mute codes from Twilight Spectre (GCN Hacker87) to disable the sound effects. Unfortunately, they don't work as well as they should. They take effect only after entering a menu and sounds coming from enemies/Epona/etc. aren't affected by the codes at all. I've managed to record quite a few of the tracks, but I guess I've met my limits with that trick now.
Since I'm returning to ripping tracks again, I've been thinking of other methods. So I first tried to swap the BMS files in "Z2SoundSeqs.arc" manually, through a hex editor. I yaz0-decompressed the archive, then tried to swap the file names in the archive with a hex editor, then yaz0-encoded it back and replaced the old archive on the ISO. Unfortunately it didn't work (the same track was still loaded, although the file names were swapped).
I then tried to look at the RARC specification to figure out how to swap the BMS files but haven't gotten into it since it's very time consuming to swap files manually.
A third possibility was disabling the sound effect archives, which are "Audiores/Waves/Z2SeWave_X.aw", but replacing those files or simply renaming them locked the game up.
So my question is: 1. Can you tell me in which AW files the sound effects are and what I have to do in order to mute them (I thought you checked some of the files since you've been working on the AW format a little, lately)? OR 2. Could you provide a simple RARC file exchanger to swap the individual BMS files in the archive? The plan is to make... let's say "Lake Hylia.bms" play in place of "Shop.bms" because in shops, no sound effects are played.
I think it'd be for the collective good. I've used the file swap method before to make a complete rip of the Resident Evil remake and it worked like a charm. But this one is a lot harder to pull off, help is very much appreciated!
Assuredly possible. I'd say that you'd want to zero out the AW files you want to silence. There is a fairly good chance that some of them contain both instruments and sound effects, though, as was the case with Wind Waker. The best solution would be an AW reader like I put together for Wind Waker, which would let you decide for each sample if you want to keep it or not. I'll take a look at it tonight to see if I can do something like that.
edited 1:38 PM EDT October 15, 2007
Hmm, upon brief examination, it appears that the AW files are neatly divided into SE and BGM. If this division is accurate (and I have no verified this yet) you should be able to just zero out the SE files. I have put together a utility that fills with zeros all files on the command line. It isn't likely that I'll have anything more complex anytime soon, so you might give this a try with something like:
The sound file addresses may be referenced in "Z2SoundSeqs.arc", instead of the filenames.
If there are address references in the first part of the file(addresses that are different by the size of the blocks of sequences), then you may be able to switch them around to change the music played.
If the file is small enough, I can inspect a copy to some degree.
Dear God! It worked! I haven't been able to try it for Twilight Princess yet, since I didn't succeed in loading it with GC Simulator (I tried this before and it worked). Don't know what causes this, I'll try to work around it later. However, I was able to test the method with Four Swords Adventures and the result is amazing! I wouldn't have thought it's so easy to disable the sound effects. Many thanks, hcs! :-) I guess it will work just as good for Twilight Princess and other AW-BMS-games. Expect high quality soundrips of Four Swords Adventures, Twilight Princess and Super Mario Sunshine in the near future. :-)
I've been working on the files I have a bit, and I've figured out a little about how they work.
File identifiers start at address 0x60
Each file identifier is 0x14 bytes long. Each seems to require an endian conversion to be computer readable, but it is more human readable this way.
0x60-0x61 = Filename array number. Sequentially increases up to the end of the array. 0x62-0x63 = Chunk CRC? 0x64-0x65 = Seems to be 0x11, 0x00 in all records.. 0x66-0x67 = The byte index from 0x0DC0 where the filename starts. Name is null terminated. 0x68-0x6B = Start address(This number plus 17C0 gives you the file address) 0x6C-0x6F = Size of data 0x70-0x73 = 4 null bytes as a seperator 0x74-0x75 = Next filename array number.
With this, and potentially a little more work on the table details, you could re-arrange the file so that the preferred song takes up the position in the file that refers to the song you want it to. The same method could then also work for Wind Waker's .arc file, as I also used that in this comparison.
Since filenames aren't actually used, a lot of this should be trivial to the matter of switching around.
If anyone feels like checksuming a piece to see if my guess is correct, go ahead. It would likely be something I'd bring to the array anyways.
Just something I thought up... It may also be a matter that you could simply change the start and size locations to match up to the song you want to have play in the shop themes.
To help you figure out which arrays to use for filenames, here's a list. Just search for 00 and the hex code, and you should go right to it. Check for the null 4 bytes before the number to be sure you're at the start of a record.
another last-minute idea: for twilight princess music, why not stuff all the sound files into Wind Waker and see if the playback system will cooperate with the file structure, and not destroy the sound. If the above suggestion can be made to work, this could be a feasable long-shot to try.
The file structure is quite different between TP and WW (at least for the main control file that you've looked up). There was no question about erasing the audio working... hadn't considered it before, though. I look forward to these rips!
Tried it with Twilight Princess now. Works just as good! All the sound effects erased, wonderfully flawless music. I also figured out why the streaming didn't work, the game only supports 10MB Half/Full Duplex on GC Simulator. And that's where the problem begins: Some kind of rest data is loaded into the system memory in some areas, what makes the first few seconds of a lot of tracks either garbled (as in "test1.mp3") or cut off altogether - because data transfer and sound playback cannot be simultaneous.
Thanks for the information, ugetab. Just a request in case someone with the necessary programming knowledge can pull it off: A swapping tool for the RARC archive would be most helpful since the manual method would take one hell of a lot more time.
If the method I considered works, then I'll write the swapping tool myself.
If you can confirm that manual changes to the RARC table will work(and tell me what you did that worked), then I can program something to put the neccesary changes into place.
Okay! I'll try to swap the start point and file size of "filone_forest" and "hiding_village" to confirm if it works. I'll report later.
EDIT: So I tried that method and it... kind of worked. See the result here. I took part in the mini game in the Hidden Village because I swapped that track with the Faron Woods theme. As you can hear, the first few notes of the Faron Woods are played but then it silences. The Hidden Village minigame theme isn't played in Faron Woods at all (however, Faron Woods are now totally muted). I guess that is due to a problem with thakis's program yaz0enc.exe (well, his website states he didn't write it - as it would probably be without any bugs if it was, knowing that he is a great programmer). Because the edited and newly yaz0-compressed archive is different in more than just the edited space and it is also smaller than the original yaz0-compressed file.
I'll try to get in contact with him to get him to look into it.
In the meantime, it'd be cool if you could write a small utility for swapping the files in the RARC archive, ugetab. :-)
Thank you for both of your help, I know it's a little unnerving!