Jump to content

Tutorial: Custom music import for WWE 2K22


SaintChristian

Recommended Posts

We don't have any convenient tools for 2K22 just yet, but if case you don't want to sit and wait for Sound Editor update, here's how to do its job manually. It's a lot more tedious but whatever works for now. Sure, this guide could pretty soon become irrelevant but still...


You'll need:

Just like with 2K19, you can' t add new music, only replace the existing one. But hey, that's why we have a load of generic crap in the game, right?
So, let's begin.

  1. First, decide what music you want to replace. For example, I want to replace Jeff Hardy's No More Words theme (with what, exactly? More on that later).

    Open the Ravioli Game Tools archive and then - click on "RExtractor.exe". Entrance themes are spread across 8 pck files (from "music_1.pck" to "music_8.pck). Hardy's theme is located in "music_2.pck". So we set this file as input file and then select the location where you want to extract it (Output directory). Next, check the "Convert sounds to" mark and choose "Wave". Click "Start" and wait for the pck file to extract.

    Your output directory will be filled with WAV filed each named with a set of numbers (we'll get to that). What you need to do next is...well, simply play each file one after the other until you find out which one of them is No More Words. In this case, this file should be named "984064816". Remember these numbers and then...delete everything you've just extracted. We needed to do all that just to locate the file we need, and now that we've done it, there's no need in these WAV files anymore.

    //If you don't know what "music_x.pck" contains the file you need, then you just have to unpack the "music_x" files one after another and check the uncompressed WAV files until you find what you need//

Close RExtractor and now open "RExplorer.exe". Open the pck that contains the file you're aiming to replace (in our case, music_2.pck). Click on an "sfx" folder in the left part of the window
Screenshot-1.png

You'll see a list of files in this pack but in WEM, compressed. Right-click our file (the name is the same number from before - 984064816) end extract it somewhere you don't lose it. Do not convert it. It should be a WEM file, as it is in the pck file.

//Now, you may ask, "why the hell do I need the entire thing with RExtractor, when RExplorer can playback the WEM files? Why waste all this time with extracting pck, converting to WAV?". It's because there's a size limit in RExplorer and it cannot playback files that are too big for it. 

Close RExplorer and Ravioli archive. It has done its job.

Now before the next step, right-click our extracted 984064816.WEM and select "Properties". Check the file size (actual size, not "on disk") and compare it with the size of your custom music WEM file that you want to import. Depending on whether it's bigger or smaller, there are different steps you should do.

A) IF YOUR CUSTOM MUSIC FILE IS SMALLER:

So let's say I want to replace Hardy's No More Words with the Hardy Boyz theme straight from 2K19 (it's smaller in size).

You need to open 3 files in HeX editor:

- Go to "Sound" directory and open the source pck file (in our case it's music_2.pck).
- Our extracted No More Words theme (984064816.WEM)
- Your custom music file (in our case, it's the hardy boyz theme)

Once you have opened all three in HeX Editor, switch to the extracted theme (984064816.WEM) and highlight a portion of the file's header.

Screenshot-2.png

 

Now copy the selected part (Ctrl+C or through right-click menu) and switch to the source pck tab (music_2). Once there, go to "Search -> Find" (or Ctrl+F). Click "Hex-values" and paste that portion of the header you copied. Check Search Direction "All" (in fact, always pick "All").


Screenshot-3.png


Click OK.  You'll see that the header of Hardy's theme is found within music_2.pck file. This is where that file begins and is starts at offset 08AB7000. You'll need that starting offset number soon.
 

Screenshot-4.png
 

Now that we know where the file begins, we need to find its end. Go to "Search -> Find" once more, but this time click on "Text-string" tab and type "RIFF" in search bar. Click "Search All" instead of OK.
That way the search results below will display the beginning of every single WEM file in the pck. There you need to find an excerpt that tied to your offset you acquired earlier (08AB7000). 
Screenshot-5.png


Aside from pointing out Hardy's theme offset I also highlited in green an offset of the file that goes right after the one we seek to replace. It's starting offset is 08E42000. That means if you subtract 1 from this value then you'll get on offset of the very last bite that belongs to No More Words.
8E42000 - 1 = 8E41FFF (if you're having a problem with understanding that hex math, you can simply use windows calculator in programmer mode).

Now what you need to do is go to "Edit -> Select Block.." (or Ctrl+E). Type in Start-offset which is the one where the Hardy's theme starts (8AB7000) and select an End-offset which is that last byte (8E41FFF). Click OK and the Hardy's theme in its entirety will be selected. Look at the lower border of the Hex Editor window - there you'll see of a length of the segment you've selected, and it's value is 38B000. You'll need that for the next step.

Screenshot-6.png


Keep that selection active and switch to the tab of your custom music file (in our case, The Hardy Boyz.wem) then scroll down to the very end of this file.
Screenshot-7.png

Due to our custom file being smaller than Jeff Hardy's in-game theme, we need to simply add some empty bytes at the end of the file so that its lenght would be equal. Press Ctrl+A to Select All and the length of your custom file will be displayed at the lower border of the window. For example, my Hardy Boyz theme's length is 357D0D. What we need to do now is take the length of Jeff Hardy's theme from before (38B000) and subtract 357D0D. That will be the difference that we're going to add at the end of our custom file.

38B000-357D0D=332F3
That is the number of bytes we need to add. Go to "Edit -> Insert Bytes" and type the difference in the bytecount (don't forget to set the typing cursor right after the last byte of your file so that you won't insert bytes in the wrong place).

Screenshot-8.png

Now your custom file is of the exact length as Hardy's theme in the game's pck. Press Ctrl+A to compare the lengths (Select All in your custom file and then switch to music_2.pck. You should still have the selection of the entire in-game No More Words active). If it's all equal, then simply Select All in your custom file and paste over the selection in music_2.pck tab (in our case, click "Copy" in "The Hardy Boyz.wem" tab and "Paste Write" over the active selection in "music_2.pck" tab)
Screenshot-9.png

Screenshot-10.png

Save the pck file, and don't forget to make a back up. All should be good to go.

B) IF YOUR CUSTOM MUSIC FILE IS LARGER:
Now there you need to be a bit more careful.
Let's say that I want to replace Jeff Hardy's theme with, for example, Test's theme from 2002. I used it in 2K19 and it's almost twice the size of 2k22's no more words.

You need to open 3 files in HeX editor:

- Go to "Sound" directory and open the source pck file (in our case it's music_2.pck).
- Our extracted No More Words theme (984064816.WEM)
- Your custom music file (in our case, it's the 2002 Test theme)

Once you have opened all three in HeX Editor, switch to the pck file and scroll down at the very end.

Screenshot-11.png

What we need to do is to add some empty bytes at the end of the file. Why? You may notice that every WEM that is stored in the pck has a Starting Offset that ends in three zeroes (000). Since our file is a lot bigger than the one we're trying to replace, you can't just copy and paste it over without messing up the entire pck. So we're going to add our custom file at the end of the pck without touching other audio. And just like all the other WEMs in the pck, it needs to have a Starting Offset with 000 at the end. In order to provide it, just keep adding null bytes until you reach an offset that ends with three zeroes.

Screenshot-12.png

Once you have done that, simply switch to the custom file tab (in our case, Test.wem) Select All, Copy, and Paste it in the pck at the offset with three zeroes you've provided.

Screenshot-13.png

Ok, we've added Test's theme to the pack. Now we need to tell the game that this is the file it needs to address as Jeff Hardy's theme.
As you remember, our extracted No More Words has numbers in its name. It's 984064816. This is an audio ID. And our job is to, well, "steal" it from Hardy's theme for our custom file.
Open the calculator in programmer mode and enter this number in DEC. After that you'll see that 984064816 is 3AA7A330 in HEX. What we need next is to find that audio ID in pck file. In order to successfully find it in HeX editor, we need to take our audio id in HEX, present it as four bytes and type them backwards. So it goes like this: 
3AA7A330 -> 3A A7 A3 30 -> 30 A3 A7 3A. 
That is what we need to find.
Go to "Search -> Find", click on "Hex-Values" and look for the numbers above.
Screenshot-14.png

You'll find one string almost at the top of the file.

Screenshot-15.png

That is Audio ID and it's currently assigned to Jeff Hardy's theme.
Here we're interested not just in these four bytes that we've just found, but also the 12 bytes that follow it:

30 A3 A7 3A 00 10 00 00 89 A7 38 00 B7 8A 00 00

The bytes that are in red are our audio ID, as we've just figured out. Leave it as it is. We don't need to change it, just re-direct it.
Same goes for the four bytes in white. You can leave them be.
The four bytes in yellow is the file size. Since audio ID is currently assinged to Jeff Hardy's theme, these bytes show the size of the corresponding WEM file. What you need to do is go to where your custom WEM music file is located (on your hdd, not in HeX😁), right-click it and select "properties". Look for the file size of your file (actual size, not "on disk"). In our case, for example, Test.wem's size is 7 413 209 bytes.  Now you need to do the same thing you did with Audio Id with this number. Type it in DEC and look for the value in HEX. Then convert it to the format that HeX Editor understands:

7 413 209 -> 711DD9 -> 00 71 1D D9 (you need to add two zeroes in front as an empty fourth byte in case your number takes less space) -> D9 1D 71 00.

And then i simply replace the necessary bytes with my value.
Screenshot-16.png

Finally, the last four bytes that are in green are addressing the Starting Offset of the WEM file that currently has our audio ID attached to it, i.e. Hardy's theme. We just need to replace it with the offset where out Test's theme takes its start. Look at that offset with three zeroes that we made for our file earlier by adding bytes. It's 09B5E000. Currently the last four bytes are B7 8A 00 00. It means that Hardy's music has a starting offset 08AB7000. As every single audio file HAS to have 000 at the end of its offset, those are not specified in the green offset bytes. And just like the previous values, offset number should be typed backwards as bytes. That means that our "selfmade" offset should be presented like this:

09B5E000 -> 09B5E -> 00 00 9B 5E -> 5E 9B 00 00.

And that is what we're typing in over the Hardy's offset bytes.

Screenshot-17.png

And that's done. Our custom file has taken over No More Words. Save your pck file. All should be good now.

  • Like 1
  • Too Sweet 3
  • Thanks 2
Link to comment
Share on other sites

So everything worked fine up until I began trying to search for hex codes. I got the warning message that some characters were not able to be viewed, and it replaced them with the question mark inside of a diamond. Because of that, I cannot search for the hex code for the theme I want to replace. It shouldn't be an error on my part, because I had just literally installed HxD. So not sure how to work around that.

Link to comment
Share on other sites

2 minutes ago, Thy_Revolution said:

From what I've gathered, a good majority of the generic themes are located in Pack 8

That's good to know because I took a guess that might be where all the generic ones were. 

I haven't started on mine yet (still working) but does anyone know how long this would take for one song alone? I've got to upload multiple. If it'll take me too long, I may only do a few for now.

Link to comment
Share on other sites

Many thanks for this but is there a Chance to make a Tool or something else to make it easyer?

"Type it in DEC and look for the value in HEX. Then convert it to the format that HeX Editor understands"

How do I convert this?

Link to comment
Share on other sites

8 minutes ago, AlexG said:

Many thanks for this but is there a Chance to make a Tool or something else to make it easyer?

"Type it in DEC and look for the value in HEX. Then convert it to the format that HeX Editor understands"

How do I convert this?

Sound Editor 2022 will be available for 2K22 soon.

  • Like 1
  • Too Sweet 1
  • Thanks 4
Link to comment
Share on other sites

Thank you, great explanation!! 

 

I converted your instructions into a Python script that can automate a bit of the process. If anyone is interested:

https://gist.github.com/autumnmm/c70fd142c33283f4fd85ec22d274a4a8

(To download it, you can right click "Raw" and select "Save link as", or else click "Download ZIP")

I've tested it with both larger files (where it appends the data like you instruct) and smaller files (where it replaces the data like you instruct) and it's been working for me.

----

How to use it:

(This requires having Python installed, it can be downloaded from https://www.python.org)

You need 3 things:

  1. the .wem file you're trying to inject (The Hardy Boyz.wem)
  2. the id of the track you're replacing (984064816)
  3. the .pck file you're changing (music_2.pck)

Place the python script, wem file, and pck file in the same folder together.

Open cmd prompt/powershell or whatever command line program you use.

Change your current directory to the folder containing the files.

Type the following command and hit enter:

python replace.py --source-track "The Hardy Boyz.wem" --destination-id 984064816 --pck-file music_2.pck

This creates a new file called "music_2(Modified).pck" in the same folder which contains the updated .pck file.

 

Screenshots:

Folder before:

Va8YufU.png

Running replace.py script in PowerShell:

WwpX1Yp.png

Folder afterwards:

P9fupru.png

  • Like 1
  • Too Sweet 1
Link to comment
Share on other sites

20 hours ago, autumn said:

Thank you, great explanation!! 

 

I converted your instructions into a Python script that can automate a bit of the process. If anyone is interested:

https://gist.github.com/autumnmm/c70fd142c33283f4fd85ec22d274a4a8

(To download it, you can right click "Raw" and select "Save link as", or else click "Download ZIP")

I've tested it with both larger files (where it appends the data like you instruct) and smaller files (where it replaces the data like you instruct) and it's been working for me.

----

How to use it:

(This requires having Python installed, it can be downloaded from https://www.python.org)

You need 3 things:

  1. the .wem file you're trying to inject (The Hardy Boyz.wem)
  2. the id of the track you're replacing (984064816)
  3. the .pck file you're changing (music_2.pck)

Place the python script, wem file, and pck file in the same folder together.

Open cmd prompt/powershell or whatever command line program you use.

Change your current directory to the folder containing the files.

Type the following command and hit enter:

python replace.py --source-track "The Hardy Boyz.wem" --destination-id 984064816 --pck-file music_2.pck

This creates a new file called "music_2(Modified).pck" in the same folder which contains the updated .pck file.

 

Screenshots:

Folder before:

Va8YufU.png

Running replace.py script in PowerShell:

WwpX1Yp.png

Folder afterwards:

P9fupru.png

Unless I am doing something wrong I tried this method and received the following error after the file was modified in the pack, "end of stream reached too early while extracting file"

Link to comment
Share on other sites

  • Cave Waverider pinned this topic
  • Cave Waverider unpinned this topic
On 3/9/2022 at 4:52 PM, autumn said:

Thank you, great explanation!! 

 

I converted your instructions into a Python script that can automate a bit of the process. If anyone is interested:

https://gist.github.com/autumnmm/c70fd142c33283f4fd85ec22d274a4a8

(To download it, you can right click "Raw" and select "Save link as", or else click "Download ZIP")

I've tested it with both larger files (where it appends the data like you instruct) and smaller files (where it replaces the data like you instruct) and it's been working for me.

----

How to use it:

(This requires having Python installed, it can be downloaded from https://www.python.org)

You need 3 things:

  1. the .wem file you're trying to inject (The Hardy Boyz.wem)
  2. the id of the track you're replacing (984064816)
  3. the .pck file you're changing (music_2.pck)

Place the python script, wem file, and pck file in the same folder together.

Open cmd prompt/powershell or whatever command line program you use.

Change your current directory to the folder containing the files.

Type the following command and hit enter:

python replace.py --source-track "The Hardy Boyz.wem" --destination-id 984064816 --pck-file music_2.pck

This creates a new file called "music_2(Modified).pck" in the same folder which contains the updated .pck file.

 

Screenshots:

Folder before:

Va8YufU.png

Running replace.py script in PowerShell:

WwpX1Yp.png

Folder afterwards:

P9fupru.png

I did all of your steps correctly but when I go to select to song in game it crashes.  After I get the modified pack am I supposed to replace the original music pck? Because that’s what I did

Link to comment
Share on other sites

  • 2 months later...

Thanks! this is exactly what I was looking for! I personally didn't feel comfortable with installing the sound editor because I'm no programmer but I cant think of a reason why you would create a tool like that, that requires admin access and access to my registry. I'm just not comfortable with that.

At first this didn't work , the song I replaced was just silent in game, because when I created the new offset (the one that ends with 000). I left the first two blocks as 00 and pasted the song after that. but I went back in and deleted that block and everything's working now!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...