Jump to content

Sound replacement possible?


TRekNexus

Recommended Posts

Hello everybody!

 

So I've been wanting to replace some music files within XCom EU/EW for some time since much of the original music in there frankly bugs the crap out of me. I'd *really* like something more atmospheric and suspense-building than the current techno-action we're stuck with. But before I try to wrap my head around XCom modding I wanted to check with you guys if it's even possible to do sound file replacements with the current tools available?

 

EDIT: Even swapping sound files for others would help a lot. Replacing the action tracks with some of the ambient ones would go a long way.

Edited by TRekNexus
Link to comment
Share on other sites

  • Replies 199
  • Created
  • Last Reply

Top Posters In This Topic

So far I don't think anyone has successfully replaced any sound files in XCOM. Things that have been done that indicate we're getting close :

 

  • Users have extracted sound files from the packages (which are internally stored in ogg format, apparently)
  • I've replaced some textures (internally stored in DXT1 format) with other textures
  • I've worked out how to add new textures by cooking a new package containing textures -- currently this is only the inventory and weapon panel UI texture data, not 3D model textures

 

In terms of adding/replacing sounds there are two possibilities that occur to me :

  1. Directly swapping out the hex of the sound file, which will likely involve resizing the upk
  2. Cooking a new package file with the new sound file(s), and adjusting the config data / unrealscript to play the new sounds

Unfortunately I have nothing practical working at this point. I'm not even sure if anyone has replicated my use of the September 2011 UDK for creating XCOM-compatible package files.

Link to comment
Share on other sites

Hex editing and resizing the upk sounds like something beyond my feeble technical talents right now. Bundling sound files into a new upk on the other hand, I'll give it a go. Time to look at the wiki. Thanks for the reply :)

Link to comment
Share on other sites

  • 1 month later...

Sorry for the thread necromancy, but I've just successfully patched in a custom sound file. This is for a sound effect, not music, but the steps are likely similar. I couldn't see any other recent posts that described this so if this isn't yet well-known, I'll post more detailed steps and keep working on it. I still need to experiment more with how this works because there are still a lot of unkowns to me, being an xcom modding newb. Hopefully someone else will be able to repro this too. Here are the steps I took:

 

 

  Reveal hidden contents

 

Link to comment
Share on other sites

Congrats. Nice work on a new FIRST! Unless you object, I'm going to add it to the "Sound Files" wiki article (with credit to you).

 

You should look at wghost81's UPK Format document to understand the 0x30 bytes of "stuff" after the OGG data, and how to resize an object such as a sound file.

  Quote

 

To properly resize an object, you have to edit its export table entry. Patcher[GUI] will work with any packages, not just scripts and maps, as the structure is the same. Use BEFORE_HEX/AFTER_HEX to automatically resize an object.

 

(PatcherGUI and the UPK Format document are separate downloads from the UPKUtils package on that download page.)

 

Also, don't know if you have been following the "Scripting with UDK" thread, but they have been making some great progress there as well. With wghost81's mutator config, it should now be possible to add new sound files instead of just replacing existing ones. "Just" (famous last words) needs someone interested in trying it out.

 

Edit: Added the tutorial to the "Sound Files" article. However, I have to say while I did my best to clean it up, your specific case examples left me (without having the file open in UE/HxD in front of me) confused as to which hex values belong to the object entry for your file and which for the linked chain entry for the next object. Please look over wghost's UPK Format document and then try to clear that up. (You can make those edits directly to the article or just post them here and I'll do it for you.)

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

Thanks for the links. I'll look over the documents and edit the article when I have a better understanding of it. Also I've discovered while experimenting with replacing a music file that when overwriting an existing entry with a shorter one, zeroing out the whole rest of the entry seems to be required. That will probably also make more sense to me after I read up more on the format.

Link to comment
Share on other sites

I've read the format documents, and I now understand more of the sound object format, but not all of it. I've also now successfully resized the memorial music upk to replace it with a much longer and larger track using PatchUPK. This took a little manual post-processing of the upk to get it to work, though. I need to take a look at what PatchUPK is doing and see what's going wrong, it appears to be putting the new entry under a different name in the export table rather than updating the existing one, but this could be pilot error. The sound object also contains absolute file offsets that PatchUPK doesn't appear to be aware of that need to be updated after the new object is injected into the UPK.

 

More details on the SoundNodeWave object structure:

 

 

  Reveal hidden contents

 

 

Link to comment
Share on other sites

tracktwo, when you resize an export object with PatchUPK, it doesn't delete an existing serialized data for that object, but appends a new serialized data to the end of a package and updates export table entry with new offset and size. It is useful for script packages, which consist of a thousands of objects. For sound packages with one sound object only (?) it will lead to unnecessary package bloating, but it won't affect it's functionality.

 

But, if sound object uses absolute file offset to determine data location, resizing object data by moving it can cause a problems. Although, due to varying structure of upk objects, they don't usually use absolute offsets.

 

Can you post an example of a modfile you're using?

Edited by wghost81
Link to comment
Share on other sites

Here's the modfile I used:

UPK_FILE=HQSound_MemorialMusic_SF.upk

OBJECT=SoundMissionControlMusic.MemorialScreen3

MODDED_FILE=SoundMissionControlMusic.MemorialScreen3:AUTO

I'm not sure if the OBJECT field is redundant or inferred from the MODDED_FILE filename. After I run this and open the file in UE explorer the object list appears unchanged, but there is a new entry in the export table. The old SoundNodeWave entry "MemorialScreen3" is still there, pointing to the original version. The new entry is a package called "SoundMissionControlMusic" and has the new offset and size directly inside it. If I manually patch the old export entry with the new offset and size, it works. Well, it works after I also go in with a hex editor and update the absolute offsets within the sound object to the new addresses in the modded file, that is. Am I using incorrect names here?

 

Regarding the absolute offsets, I'm still not sure exactly what those data structures in the SoundNodeWave object are, but they sure look and act like absolute file offsets. It's interesting if they aren't used elsewhere in the format, though.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...