Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Zexia
Posts: 5
Joined: Mon Mar 16, 2020 2:31 am

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by Zexia »

Khrn wrote:I'm trying to translate Kingdom Hearts III (PC) and need some help. I successfully exported the files using QuickBMS and the unreal_tournament_4_0.4.25b.bms file. I then used this tool to convert the .locres files to .txt. I tried translating half of the kh3_settings.locres file to test, and then tried to import back using both the reimport.bat and reimport2.bat files. Neither worked, and I got this error:
Image
I then noticed the suggestion to delete any unchanged files before importing (keeping the folder structure), but that gave me another similar error. I'm not really sure what to do. This is my first time translating a UE4 game, so I'm sorry if this has been answered before. I tried looking around but couldn't find anything. How can I do this?

I don't think you can reimport files into a .pak from Unreal. You have to paste the folders and everything extracted from the .pak into the game installation folder. Let's say the extracted folders are called KH3 and Engine. Copy them, go to the folder where the game is installed, and replace the originals by the same name. Then delete the original .pak from the game folder, or else it will read the files from the .pak and the translation won't work. I hope this helps!
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@Zexia: It's inconvenient in terms of distribution and many games will refuse to work this way.

@Khrn: Check the very bottom of my base post, you can find some useful links there, related to your question.
Khrn
Posts: 3
Joined: Wed Mar 31, 2021 9:55 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by Khrn »

Zexia wrote:
Khrn wrote:I'm trying to translate Kingdom Hearts III (PC) and need some help. I successfully exported the files using QuickBMS and the unreal_tournament_4_0.4.25b.bms file. I then used this tool to convert the .locres files to .txt. I tried translating half of the kh3_settings.locres file to test, and then tried to import back using both the reimport.bat and reimport2.bat files. Neither worked, and I got this error:
Image
I then noticed the suggestion to delete any unchanged files before importing (keeping the folder structure), but that gave me another similar error. I'm not really sure what to do. This is my first time translating a UE4 game, so I'm sorry if this has been answered before. I tried looking around but couldn't find anything. How can I do this?

I don't think you can reimport files into a .pak from Unreal. You have to paste the folders and everything extracted from the .pak into the game installation folder. Let's say the extracted folders are called KH3 and Engine. Copy them, go to the folder where the game is installed, and replace the originals by the same name. Then delete the original .pak from the game folder, or else it will read the files from the .pak and the translation won't work. I hope this helps!

I tried that and the game launched with a bunch of errors - like things were missing. It launched okay when I put the .pak file back in.
spiritovod wrote:@Zexia: It's inconvenient in terms of distribution and many games will refuse to work this way.

@Khrn: Check the very bottom of my base post, you can find some useful links there, related to your question.

They mention I need to download a specific version of UE4 (the one the game uses), but I can't find that anywhere. The Details tab only shows the File Version as 1.0.0.0. Any idea which one I should install?
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@Khrn: Kingdom Hearts 3 is using UE 4.17, but u4pak and unrealpak from fluffyquack's workflow (which is 4.12) should be fine too through backward compatibility - if the game supports side paks in the first place.
Khrn
Posts: 3
Joined: Wed Mar 31, 2021 9:55 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by Khrn »

spiritovod wrote:@Khrn: Kingdom Hearts 3 is using UE 4.17, but u4pak and unrealpak from fluffyquack's workflow (which is 4.12) should be fine too through backward compatibility - if the game supports side paks in the first place.

Awesome, I got it working! Thank you!
TsukiMoon
Posts: 2
Joined: Sat Apr 03, 2021 2:00 am

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by TsukiMoon »

Greetings, I am curious of digging into an encrypted PAK file I managed to extract from a Nintendo Switch demo but I am currently stuck in trying to figure out how I can currently pull out the AES Keys.

At the moment I cannot share a screenshot or anything along those lines but in my attempt to follow masagrater's guide for decrypting these from the Nintendo Switch, I was able to dig into the "main" file with Ghidra and the Switch Loader and was able to find the intended search result that was mentioned. However, from here, I see no "offsets" but I do see addresses I can go to but there is only one place to go to as the hexadecimal values I have pulled out from the nearby areas have not seemed to work.

For context, the demo that was released is R-Type Final 2 and I would love to have any help or guidance possible to find the AES Key to unpack the PAK files.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@TsukiMoon: I wonder why you're asking it here and not at GBAtemp, where masagrator's guide resides. The guide is pretty good, though if you understand how offsets works, you don't even need to disassemble whole nso to obtain key from it. I've added that key to the list (available via my signature).
TsukiMoon
Posts: 2
Joined: Sat Apr 03, 2021 2:00 am

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by TsukiMoon »

spiritovod wrote:@TsukiMoon: I wonder why you're asking it here and not at GBAtemp, where masagrator's guide resides. The guide is pretty good, though if you understand how offsets works, you don't even need to disassemble whole nso to obtain key from it. I've added that key to the list (available via my signature).


I do not believe I fully understood the offsets because I was looking at what was similar on the screenshots provided and what I saw on my end and could not make head or tails on "where" the end-result was or how you managed to get the end-result you did on the link in your signature. I would love to straighten it out on my end so I can dig around on future searches on my end.

Out of curiosity, is the version of Unreal Engine 4 also hidden in there somewhere that I could also search for?

Thank you for your response as well.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@TsukiMoon: In this particular case your result should be pretty identical to the one from the guide (in terms of what you see), at least in IDA, but for Ghidra representation may be quite different. Maybe you didn't analyze file enough, maybe you copied wrong string around correct one, etc. Though this topic is rather for quickbms scripts for UE4 games and general questions about pak format.
The game is built with 4.26, you can understand it from pak version. In the code you may look for "build" or "release", but many games are using project names instead of engine version, so pak version is more reliable.

------------------------------------------------------

"unreal_tournament_4_0.4.26_paks_only" script updated to support unicode filenames properly (like in case with all other UE4 scripts).
TheDarkness1994
Posts: 15
Joined: Thu Jul 11, 2019 3:04 am

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by TheDarkness1994 »

@spiritovod Hello.
Game Subverse UE 4.22.3
Use Google Translate
I succeeded and is able to translate the text of the game (Russian), if the text format is of such a plan (screenshot below) in which there are "Key" and "SourceString".
(У меня получилось и получается перевести текст игры (на Русский), если формат текста такого плана (скриншот ниже) в котором присутствует "Key" и "SourceString")
Image
But the other text (screenshot below) is mainly located in dialogs, it is impossible to translate in any way. The question is whether this text can be translated (so that the letters from the Cyrillic alphabet are present) in any way, by changing the uasset and uexp files.
(А вот другой текст (скриншот ниже) в основном он расположен в диалогах, не получается никак перевести. Вопрос можно ли этот текст перевести (чтобы присутствовали буквы из кириллицы) каким либо способом, изменением в файлах uasset и uexp)
Image
I think the problem may be that the developers of this game turned off the ability to localize it (Also, the structure of the text could be different or another plugin was used, a widget that includes this text)
(Я вот думаю проблема может быть в том, что разработчики этой игры по отключали возможность для его локализации (Также структура текста могла быть другой или использовался другой плагин, виджет включающий этот текст)
An example in my mini project

(Пример в моём мини проекте)
Image
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@TheDarkness1994: Um, like it was already said above, this topic is more for general questions about pak format and related scripts. I suggest you to wait for answers in "Game Localization" subforum (since you've already asked for the same thing there) or even create separate topic in that subforum. Note that the game developer is planning to add many official localizations, including russian one, after the game will be out of early access.
Kagachi377
Posts: 1
Joined: Tue Apr 06, 2021 2:16 am

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by Kagachi377 »

Khrn wrote:I'm trying to translate Kingdom Hearts III (PC) and need some help. I successfully exported the files using QuickBMS and the unreal_tournament_4_0.4.25b.bms file. I then used this tool to convert the .locres files to .txt. I tried translating half of the kh3_settings.locres file to test, and then tried to import back using both the reimport.bat and reimport2.bat files. Neither worked, and I got this error:
Image
I then noticed the suggestion to delete any unchanged files before importing (keeping the folder structure), but that gave me another similar error. I'm not really sure what to do. This is my first time translating a UE4 game, so I'm sorry if this has been answered before. I tried looking around but couldn't find anything. How can I do this?


where did you get that bms file? I can't find it anywhere. Please, I've been trying to unpack kh3 with no success at all...
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@Kagachi377: Both official UE4 script and "latest" one from my signature should work with Kingdom Hearts 3, required key also available via my signature.

------------------------------------------------------

Script for extracting audio from latest Satisfactory version in the attachment. Apply it on extracted FactoryGame\Content\WwiseAudio\Media folder, it will create proper wem files, which can be played and converted with vgmstream. The script is not required for older game versions, where audio files has wem format out of the box.
Update: I've decided to merge scripts for sound extraction into respective bundle, which is now available in my base post. Currently it includes scripts for Satisfactory and R-Type Final 2, but some more will be added later.

------------------------------------------------------

Script for Century: Age of Ashes added to specific scripts bundle. It's applied only to latest CBT version of the game, previous versions are using default UE4 format.
CriticalError
Posts: 204
Joined: Thu Aug 14, 2014 8:52 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by CriticalError »

spiritovod wrote:@Kagachi377: Both official UE4 script and "latest" one from my signature should work with Kingdom Hearts 3, required key also available via my signature.

------------------------------------------------------

Script for extracting audio from latest Satisfactory version in the attachment. Apply it on extracted FactoryGame\Content\WwiseAudio\Media folder, it will create proper wem files, which can be played and converted with vgmstream. The script is not required for older game versions, where audio files has wem format out of the box.
Update: I've decided to merge scripts for sound extraction into respective bundle, which is now available in my base post. Currently it includes scripts for Satisfactory and R-Type Final 2, but some more will be added later.

------------------------------------------------------

Script for Century: Age of Ashes added to specific scripts bundle. It's applied only to latest CBT version of the game, previous versions are using default UE4 format.

Hello and thanks for the last update, I have a question, you mention script was updated to latest client of Miracles 2, but I get error.

Image
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@CriticalError: I don't have any problems with all of my samples and respective script. Though I didn't download the whole game, so some exceptions are quite possible. Without more samples it's hard to tell anything.
Asciigdl
Posts: 7
Joined: Sun Jun 21, 2020 9:19 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by Asciigdl »

spiritovod wrote:@CriticalError: I don't have any problems with all of my samples and respective script. Though I didn't download the whole game, so some exceptions are quite possible. Without more samples it's hard to tell anything.


In my case it fails with the third one (pak_11 and a couple others), directly from the android version, the first 2 files extract just fine with the "specific" script, however, funny thing, it only works if I use the 4gb version of qbms (and each file is just a few hundred MB in size), with the other one the first 2 files fail with the same message . . . so it's probably just a memory allocation issue.

Pak_07_BFG-Android_ASTC.pak
Pak_08_Equip-Android_ASTC.pak
Pak_11_Fashion-Android_ASTC.pak
Pak_14_PVEScene-Android_ASTC.pak
Pak_15_PVEScene-Android_ASTC.pak
Pak_16_YTLDS-Android_ASTC.pak
Pak_17_PVPScene-Android_ASTC.pak
Pak_18_YASL-Android_ASTC.pak
Pak_19_SWSM-Android_ASTC.pak
Pak_20_KTLFX-Android_ASTC.pak
Pak_21_KTLYJ-Android_ASTC.pak
Pak_22_TKZC-Android_ASTC.pak
Ship_01_Equip-Android_ASTC.pak
Update_Android_XML.pak
Update_Android_XML02.pak
Update_DLL.pak
Update_Loading.pak
Update_XML01.pak

Let me know if you need specific samples so I can upload them.

Also, there is a trick to get "some" version of all the files, looking for the app's apk and extracting it you get a 1.9GB file called main.obb.png (which is just a zip file), extract that and look for another file called pakchunk0-Android_ASTC.pak which is also nearly 1.9 GB; that one will work with the AES key, the 4GB version of qbms and it contains ALL the files (except recent updates I think).
Last edited by Asciigdl on Fri Apr 09, 2021 9:14 pm, edited 1 time in total.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@Asciigdl: You can start with uploading those paks you have problem with, I'll check them.

Update: Thanks for the samples, Miracle 2 script updated in the specific scripts bundle.
Drawing
Posts: 112
Joined: Fri Aug 05, 2016 6:17 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by Drawing »

Asciigdl wrote:In my case it fails with the third one (pak_11 and a couple others), directly from the android version, the first 2 files extract just fine with the "specific" script, however, funny thing, it only works if I use the 4gb version of qbms (and each file is just a few hundred MB in size), with the other one the first 2 files fail with the same message . . . the 4GB version of qbms and it contains ALL the files (except recent updates I think).


From which version belongs al those paks? because I got only 1 big Pak and not different one as in your case.

Anyway I confirm, using quickbms it works very well ( on big pak )
cyberspeed
Posts: 104
Joined: Wed Mar 23, 2016 5:11 am

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by cyberspeed »

Hey guys, there was few days a Beta for Racing Master and this is a Android smaller PAK of the beta, i cant seem to be bale to extract it, or tell if its encrypted, can anyone please take a look?
pakchunk5-Android_ASTC.pak


EDIT: It seems is packed using Zlib? Still not sure how to extract it, might not be encrypted at all.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Unreal Engine 4 pak-file Unpacker / unreal_tournament_4.bms [UE4 global topic]

Post by spiritovod »

@cyberspeed: The format itself is quite simple, I can easily modify existing script for it, but index and presumably all uassets are encrypted, while game library is protected with NetHTProtect, so you can't simply analyze or dump it. There is also possibility that the key is stored in non-usual format or encryption itself if non-standard. Unless someone is willing to provide proper key or properly dumped library, I'm not going to dig into it further.
Complementary files (uexp/ubulk) are not encrypted though, but considering engine specifics you can only extract raw textures data from them at best.