Modding rundown: Sound

Started by Noelemahc, December 05, 2006, 11:53PM

Previous topic - Next topic
Not the same ZSM files actually, those are known as Zipped Script Modules.  Good try though.

Quote from: Teancum on November 09, 2007, 05:20AM
As far as new voiceovers are concerned the best bet we have is splitting up x_voice.zss so we could at least have the XML2 characters without multiple 133mb files.

you dont need to have multiple 133mb files, you can make links to the files, as Dark_Mark said, although i havent tried it for this particular case myself, i know that this kind of thing works for linux boxes

Quote from: idrinkdrpepper on November 08, 2007, 09:50PM
Actually, the game does find the sound file well enough. You can create a custom sound file by starting with an existing one "drstr_m", for example and then renaming it to [character name]_m and putting it in the appropriate folder based on the first 2 letters.  In the herostat file, you would reference the sound file as [character name]_m.  But in the powerstyle file, you would still reference the power sounds using the char/drstr_m filename.  The file extension name seems to be coded (not in ascii) onto the sound file itself.

I'm not 100% sure, but I imagine the game would then run into problems when you are loading both the edited sound file and drstr_m at the same time.


Either way, I think 2 things that it would be awesome to get would be a "Wav Replacer" program and XML2's x_voice split up into pieces. At the very least, coloss_m/_v, sabre_m/_v, pyro_m/_v, and darkp_v could be used to give 4 characters their voice sets. My votes would be Hawkeye, Hulk, Captain Marvel, and Magma (frost/beast both have partial sound sets, psylocke has a boss sound set, and Jubilee's voice is very similar to Invisible Woman's). We could also use an unused boss set, like deadpl_m/_v, as a house for the XML1 Avalanche boss sounds.

Yeah, a x_voice splitter would be swank.  If we could split the archives up then we'd have a better variety.  That'd give us all of the PC XML2 characters, plus Beast (but with no Xtreme sound) and a few others.  Once that's all extracted some characters can get generic XML2 baddies for soundsets.

Replacing the sounds with new ones isn't a problem.  I could write a tutorial on that.  But we need something to break up x_voice for XML2 because, trust me on this, it's a major pain to do that all by hand.

Hey Norrin, if we put our heads together on this could you write something?  I can match up HASHIDs, wav info, etc. to a particular entry.  It sucks and takes tons of time, but it's possible.

Another side option is to write a MUA-remover for XML2's x_voice.  Characters that appear in both (like Deadpool & Wolverine) have the exact same HASHIDs, so we know exactly what needs to be pulled.  From there we're removing around 400 files.  That'd be a start.

i would be possibly willing to work on it, depending on how much time i have, and how difficult the project may be, and if i feel it is worth it (meaning whether or not it will have a significant impact)

Separating x_voice would give us easy access to the complete sound sets that are going to no use (coloss_v, pyro_v, darkp_v and sabre_v), essentially giving 4 characters with no sound full soundsets for us to use by overwriting the sounds. I'd say it is worth it, but I really have no idea how much work it is. I know it is a lot, but how much exactly I have no idea.

November 10, 2007, 06:41PM #171 Last Edit: November 10, 2007, 08:13PM by idrinkdrpepper
Quote from: Noelemahc on April 04, 2007, 10:26PM
No, that's something I still CAN'T figure out. My guess is that the 'hash' sections have something to do with it, but HOW to fix it, or how to decode them - that's still a mystery.

The 2nd and 3rd hash sections are not important.  I was playing around with Dr. Strange's sound file (drstr_m) and I was able to overwrite the last two hash sections with "00 00 00 ..." and all of the sounds were left intact.  It is the first hash section which contains the file directory as well as the pointers that lead to the location of the sound files.  For example, in Dr Strange's powerstyle file, the command "sound = char/drstr_m/p7_power" will access the p7_power sound.  However, the file extension name is first converted into a 4 byte hash code and appears as "D2 7F 75 04 1B" in the ZSM file.  The first 8 hex numbers (4 bytes) are the hash of the file name and the last 2 hex numbers (1B) are the index of the sound file.  You can easily change "1B" to any other index number in order to identify the p7_power with a different sound clip.  Meanwhile, the hash of the file name "char/drstr_m/p7_power" was generated by some unknown hash function.

I was able to edit this particular hashID so that it read "char/ddevil_m/p7_power".  This can be done by identifying the hashID in ddevil_m corresponding to p7_power and then using that hashID in the drstr_m file.  In making this replacement, you only need to take care that the ordering convention is preserved - namely that the hashIDs are ordered according to the value of the 4th byte.

Since the hashID is only 4 bytes, it isn't large enough to accommodate the number of possible ascii strings that are >10 characters long.  This means that the hash function is not one-to-one (i.e. it's an irreversible or one-way function). Given a hash code, you can't go backwards from it to recover the generating ascii string.  However, for our purposes, we would like to generate the hash code for an arbitrary (custom) filename.  This would require us to know the hash function.

It is no easy task to figure out a hash function.  Maybe there are programs that can do it, but it's an exercise in cryptography.  Our best bet would be to guess at the hash function by trying a few likely candidates and seeing which one generates the correct hash code.  In the Game.exe file there are a couple of references to hash - one of them being "m_uiHash", which I googled and it only resulted in a few hits off of a game programmer's web page.  There seems to be a HashString function from NeoEngine which may or may not be related to the one MUA uses.



a lot of the focus seems to be using sounds for character mods. Has anyone tried to use level sounds/music from XML2?

in MUA, the level music/sounds are taken from this line at the start of the level eng:
Quotesoundfile = omega1 ;

Yes, music/conversations wor. However, npc sounds don't, because in XML2 all NPCs use sounds from individual directories, whereas in MUA all the NPCs for a map have their sounds shoved into that map's sound files.

Quote from: BliZZ on November 11, 2007, 09:10AM
whereas in MUA all the NPCs for a map have their sounds shoved into that map's sound files.

yes, thats why it sucks when you add different npcs to a map, even if they are packaged with MUA, you will only hear their punch and some melee moves, but not their power moves :(

Quote from: BliZZ on November 09, 2007, 09:33AM
I'm not 100% sure, but I imagine the game would then run into problems when you are loading both the edited sound file and drstr_m at the same time.

This problem can be solved by making small changes to the HashID in order to generate a unique file extension name that isn't used by any other file.  For example, I said in my previous post that the file name "drstr_m/p7_power" gets hashed into "D2 7F 75 04".  Or schematically,

drstr_m/p7_power (input) ----> [Unknown Hash Function] ----> 04757FD2 (output)

where I wrote the hex code in reverse order.  While, I wasn't able to find the hash function yet, I did find a similar one and I noticed that changing the last character of the filename by 1 increment, will have the same effect on the hash output. So,

drstr_m/p7_powes (input) ----> [Unknown Hash Function] ----> 04757FD3 (output)
drstr_m/p7_powet (input) ----> [Unknown Hash Function] ----> 04757FD4 (output)
and so on ...

Changing other characters will also have a small effect on the hash function and if you want you could go character by character until you get a filename you're happy with.  However, changing just one character is sufficient to allow custom file extension names with zero conflicts.

This is actually really relevant to ripping XML2's x_voice into individual files as well.  Luckily we know the HASHIDs for Deadpool, Storm, Iceman, Iron Man and Wolverine (they're the same in both games).  So as far as ripping goes we can grab all the HASHIDs from their MUA counterparts.  That way when it comes to ripping we know that those particular IDs are irrelevant.  It makes life much easier that way.

Now, that being said, we can then slowly work to find out each of the other character's HASHIDs.  As we do, we store them in a database (Excel or Access would work best) along with the offset to the file, filesize, etc.  Then theoretically we should be able to take, say captam_v, and paste over the original hashes and sound bytes.  Finally we rename to the new xml2char_v to test.

As I recall, Noel got Xbox sounds to work in PC just fine by changing the wave type from 6A (vox) to 01 (standard wav).  XBADPCM is pretty close to ADPCM (PC) so we could probably rip all the Xbox files with GameExtractor to build new ones, rather than manually hex ripping each PC version.

Quote from: Teancum on November 11, 2007, 01:34PM
As I recall, Noel got Xbox sounds to work in PC just fine by changing the wave type from 6A (vox) to 01 (standard wav).  XBADPCM is pretty close to ADPCM (PC) so we could probably rip all the Xbox files with GameExtractor to build new ones, rather than manually hex ripping each PC version.

do you think this could work for both xml1 and xml2 sounds?

I would assume so.  I'll tinker with a wav replacement after this weekend.  Ripping them is no problem at all with GameExtractor (they come out as .xbadpcm, but they're wav files).  It's just a matter of re-injecting and changing the wav type from there.

November 11, 2007, 06:05PM #179 Last Edit: November 11, 2007, 06:32PM by winstrol
i just wrote this small prog for spliting the x_voice.zss
Worked fine with magneto and juggernaut.
Informations in the readme.txt

http://rapidshare.com/files/69094899/xml2split.zip.html

hope it helps.
[]'s