FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   How to patch unneeded voiceovers out of Unreal Engine 4 games (https://fileforums.com/showthread.php?t=104681)

Masquerade 29-09-2021 01:58

How to patch unneeded voiceovers out of Unreal Engine 4 games
 
Hello everyone, today I am going to explain how to patch unneeded voiceovers out of Unreal Engine 4 games - particularly voiceovers contained inside *.PAK files. Some games store language files external to the main PAK, and you can easily separate them. We are not interested in this, but more complex method of removing data from the main PAK file(s). This method works for decrypted pak files, I haven't tested on encrypted paks, however it should work since the data is stored in the same location.

I will be using BIOMUTANT as an example, it has 10 voiceovers inside the main pak. We can patch out 9 voiceovers (we must leave English inside the pak since the game relies on it, if English is removed, the game will crash).

Prerequisites:
Step 1: Generating a filelist:
  1. Go to the game folder and access the following path: "<gamename>\Content\Paks\"
  2. Drag quickbms_4gb_files.exe and the BMS script we downloaded earlier into this folder.
  3. Shift + Right click to open a command prompt window. Don't see open command window? Follow this guide.
  4. In the cmd window, type the following command:
    Code:

    for %f in (*.PAK) do quickbms_4gb_files -l unreal_tournament_4_0.4.25b.bms "%f" >> "%~nf.txt"
  5. We should now have a txt file for each pak present with a full list of all the files it contains.
    https://i.ibb.co/KxqRDwL/Capture.png

Step 2: Understanding the filelist:
  • We can open the txt files in any text editor. I use Notepad++. The above command we ran redirected the QuickBMS output to a text file, otherwise it would have all been sent to the console window - not useful for us.
  • Opening the filelist, we are instantly presented with lots of information:
    Code:

      0000000000000035 3412      Biomutant\Biomutant.uproject
      0000000000001035 24559      Biomutant\Plugins\Biomutant.upluginmanifest
      0000000000007835 63926      Engine\Content\Internationalization\icudt53l\cnvalias.icu
      0000000000017835 6412      Engine\Content\Internationalization\icudt53l\res_index.res
      0000000000019835 29392      Engine\Content\Internationalization\icudt53l\plurals.res
      0000000000021035 22440      Engine\Content\Internationalization\icudt53l\lang\en.res
      0000000000026835 4016      Engine\Content\Internationalization\icudt53l\lang\pool.res
      0000000000027835 204        Engine\Content\Internationalization\icudt53l\lang\root.res
      0000000000028035 7704      Engine\Content\Internationalization\icudt53l\region\en.res
      000000000002a035 1040      Engine\Content\Internationalization\icudt53l\region\pool.res
      000000000002a47a 96        Engine\Content\Internationalization\icudt53l\region\root.res
      000000000002a835 20128      Engine\Content\Internationalization\icudt53l\windowsZones.res
      000000000002f835 149844    Engine\Content\Internationalization\icudt53l\zoneinfo64.res
      00000000000541be 1260      Engine\Content\Internationalization\icudt53l\keyTypeData.res
      0000000000054835 19504      Engine\Content\Internationalization\icudt53l\timezoneTypes.res
      000000000005949a 96        Engine\Content\Internationalization\icudt53l\en_US.res
      0000000000059835 2960      Engine\Content\Internationalization\icudt53l\pool.res
      000000000005a835 16152      Engine\Content\Internationalization\icudt53l\en.res
      000000000005e835 47856      Engine\Content\Internationalization\icudt53l\root.res
      000000000006a35a 33        Engine\Config\Base.ini
      000000000006a835 106414    Engine\Config\BaseEngine.ini
      0000000000084835 51263      Biomutant\Config\DefaultEngine.ini
      00000000000910a9 813        Engine\Config\Windows\WindowsEngine.ini

  • This is a part of the BIOMUTANT filelist.

We will use "WindowsEngine.ini" as an example for understanding what the filelist is telling us:
  • The first value (00000000000910a9) is the location in hexadecimal of the file inside the pak. We can strip away the added 0s to leave a final value of 910a9.
  • The second value (813) is the size in decimal of the file.
  • Then followed by the file name.

We can use this information to identify the position and size of any file inside the PAK. It makes patching out data siginificantly easier.

Step 3: Slimming the filelist:
  • Currently our filelist contains everything inside the pak. But we don't want everything, we only want the language files. Remove all entries that aren't related to language files. After doing this to the BIOMUTANT filelist, we go from a size of 84MB to 61MB!
  • We remove all game files that aren't voiceovers. I included removing English voiceovers since we have no need to remove them.

Step 4: Finding the data:
  1. Make a new text file, I will call it data.txt. This will be used to store the location of the data blocks of the voiceovers in the game.
  2. We will organise our text file like this:
    Code:

    <language name> - <begin offset in decimal> - <end offset in decimal>
  3. To begin, we take the first language - German - and take the first hexadecimal value present.
    Code:

      00000003d9abc835 2814828    Biomutant\Content\L10N\de\BiomutantDialogueWaveContainer.uasset
    From the beginning of this entry, we can see that the file starts at offset 3d9abc835. SFK only deals with decimal offsets, so we need to use Windows calculator to convert our hexadecimal offset to decimal.
    https://i.ibb.co/Hqm0zdd/Capture.png
    This forms the first part of our entry in data.txt:
    Code:

    de - 16536815669 - <end offset in decimal>
  4. Now we need to find the last German file in the list. It is this:
    Code:

      00000003f9a8445d 31778      Biomutant\Content\L10N\de\ImportedDialogue\de\FFF2948C43B930814682D589264E22F8_BD76FD3800000000.uexp
    Be careful! 3f9a8445d is not the end offset of the German data block! This is the start of the last file.
  5. To find the end of the file, we open the PAK with HxD. Change "hex" to "dec" in the top of the screen. Press CTRL + G to go to the offset we just copied from our calculator.
  6. Next, press CTRL+E and select length in the menu. Paste the second value (31778) and press enter. This will highlight the entire file in the pak, but you can click off the highlight because HxD has shown us the end of the file.

    From this method, we have learned that the end offset of the German data block is at 17073487998.

    Our German entry now looks like this:
    Code:

    de - 16536815669 - 17073487998
  7. Now we can press CTRL + E to select the full German block:
    https://i.ibb.co/jGHrXfS/Capture.png
  8. Press CTRL + C to copy the entire block and go to File > New in HxD and make a new file.
  9. Paste the copied content and save the file. I saved it as German.PCK

Step 5: Removing the Data:
  1. Back in the main PAK file, right click the selected block and fill the data with 00s.

Now you can repeat the above steps for the remaining 8 voiceovers. And like magic we have now removed almost 4.3GB of data from the game! That's 4.3GB less you need to compress with LOLZ etc...

To put this in perspective, a repack without removing this data will be almost 9.7GB, whereas after removing the data, we end up with a compressed archive of just under 6.4GB.

Step 6: Patching the data back in:
  1. Make a simple batch file and follow the below template:
    Code:

    sfk partcopy <temp file> -allfrom 0 <patch file> <patch offset> -yes
  2. Going with the German data we just patched out, we end up with this:
    Code:

    sfk partcopy German.PCK -allfrom 0 Biomutant-WindowsNoEditor.pak 16536815669 -yes
  3. Running this batch file will put the data back into the pak.

FAQ
  • Why does the size of the pak file remain the same? I thought we were removing data! Please read this explanation!
  • Is there an alternative to SFK? Yes, there is Raw Injector. My post only covers the use of SFK, figure out Raw Injector yourself.
  • What other games can I apply this method to? Life Is Strange True Colours is a good one to try! Only 2 voiceovers paks in that game to patch out (FR/DE).

KaktoR 29-09-2021 02:31

Nothing new for me, but for some people usefull of course :)

Good explanation.

L33THAK0R 29-09-2021 09:05

Bit unrelated but had no idea Windows had a programmer tab for its calculator! Up until now I always just used an online calculator, this is heaps more convenient!

dixen 29-09-2021 11:20

Thanks for instruction) But I need same method for Detroit Become Human..

prince55 30-09-2021 22:38

Really thanks, will try it


All times are GMT -7. The time now is 10:58.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com