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
infogram
Posts: 20
Joined: Fri Nov 03, 2017 8:31 pm

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

Post by infogram »

infogram wrote:(also just realised it's not only the BGMs that have that weird NOT stuff applied, since that "JackGame\Content\Sounds\SE\CM_Battle\SWAV_btl014_add_doku.uexp" definitely isn't a BGM.. dunno how I missed that earlier :roll:
I didn't see any indicator in the pak to say whether it has that NOT stuff applied though, so doesn't look like there's any way to automatically de-NOT them all :/ Maybe someone with more experience with UE4 paks can find something about it?)


Edit: oops I was wrong, disregard this post, the NOT stuff is still here :(

Ah found the problem here, turned out only compressed files have their data NOT'd, uncompressed files don't - but the bms script would still apply the NOT anyway, which then turned the uexps which aren't compressed into NOT'd versions, so no wonder there wasn't any indicator for it in the pak :lol:

Made a quick fix so that it only applies the NOT to compressed files, and now everything seems to extract perfectly, no need to NOT files manually anymore :)

Download DragonQuest_XI.bms v3, now extracts uncompressed files properly: https://pastebin.com/RePzSkST

On another note I just tried testing some things, and it seems that files inside paks override any loose files in the game folder :( (UE4 code also seems to confirm this)

Looks like only way to get modded data in is either repacking the Data.pak (not really possible atm since there's no packers that use the weird XOR stuff that DQXI uses), or to unpack your Data.pak file into the games folder, move/delete the pak, and then apply your mods.
Running the game off unpacked data does seem to work, I was trying that out but ran into problems with those NOT'd files, which led me to fixing up that script... now I just need to wait for the files to extract so I can test it out again :)
sade1212
Posts: 4
Joined: Mon Sep 10, 2018 10:05 pm

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

Post by sade1212 »

infogram wrote:Edit: oops I was wrong, disregard this post, the NOT stuff is still here :(

I had no idea you could run UE4 games entirely off unpacked assets - that seems very promising. Are the only two problems left to solve a) which files need to be NOTed after extraction to load correctly and b) injecting data into the BGM files?
I had resorted in the meantime to an alternate approach, prototyping some kind of cheat engine script that would monitor the game's memory and play appropriate music from a folder - but turning in game volume to zero also gets rid of musical cues when you save or someone joins the party...
arachnus
Posts: 4
Joined: Fri Sep 14, 2018 1:39 pm

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

Post by arachnus »

Any progress on Assetto Corsa Competizione key? can i help in anyway?
infogram
Posts: 20
Joined: Fri Nov 03, 2017 8:31 pm

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

Post by infogram »

sade1212 wrote:I had no idea you could run UE4 games entirely off unpacked assets - that seems very promising. Are the only two problems left to solve a) which files need to be NOTed after extraction to load correctly and b) injecting data into the BGM files?
I had resorted in the meantime to an alternate approach, prototyping some kind of cheat engine script that would monitor the game's memory and play appropriate music from a folder - but turning in game volume to zero also gets rid of musical cues when you save or someone joins the party...

Yeah looks like those are the only main problems, I was getting somewhere with loading it unpacked last night, but having to de-NOT every file it was throwing an error about was getting a bit tiring.

I have an idea on automatically fixing them though, it looks like non-NOT'd .uexps all have a positive int at 0x0, but the NOT'd ones have a negative int instead, it should be pretty easy to fix up Notter so it can detect that.
I'd really prefer to figure out how the game itself knows when to de-NOT it though, but I get the feeling it might be similar to what I just described.

About BGMs, I'm thinking maybe we could try replacing the encrypted BGM .uexps with non-encrypted sound .uexps, then use the FighterZ tools to swap out the Ogg inside it, seems like that might work, since afaik all of the encrypted BGMs have a "ciph" string inside (probably meaning cipher) and I'm guessing that's a kind of flag which tells the game to decrypt the Ogg data inside.
If we swap the .uexp out for one that doesn't have "ciph", hopefully the game will realize it's not encrypted and won't try to decrypt it (since decrypting already decrypted data wouldn't end well :P)
Of course the problem then is figuring out what music belongs to which BGM file, I guess we could probably just replace every BGM file with a certain track, then go ingame, listen to it, then you'd know what to replace it with, a little tedious though.

Anyway I'll try some experiments with it later, still need to extract the pak again (takes so long on my machine >.>)
Last edited by infogram on Fri Sep 14, 2018 2:17 pm, edited 1 time in total.
Manoa
Posts: 15
Joined: Sun Sep 09, 2018 1:16 pm

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

Post by Manoa »

killing floor 2 is technically a UE 3.5, how do I know if the script is even compatible ? is there a separate script for UE 3.5 ?
romaFC
Posts: 9
Joined: Thu Sep 13, 2018 7:01 pm

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

Post by romaFC »

arachnus wrote:Any progress on Assetto Corsa Competizione key? can i help in anyway?



Nothing so far.

The game just got updated today.

Not sure if that means there will be new AES key.

I guess even if pak files are extracted.

How would they be inserted back in when it requires digital signature to repack.
arachnus
Posts: 4
Joined: Fri Sep 14, 2018 1:39 pm

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

Post by arachnus »

romaFC wrote:
arachnus wrote:Any progress on Assetto Corsa Competizione key? can i help in anyway?



Nothing so far.

The game just got updated today.

Not sure if that means there will be new AES key.

I guess even if pak files are extracted.

How would they be inserted back in when it requires digital signature to repack.


Only minor files were touched , the acc.exe got updated, but the .pak, .sig and the bigger exe don´t

It´ll be a long way to even after extracting, we can add new content, i´m interested on studying the possibilities to add new scratch made tracks primarily, then maybe we need a way to repack or run the sim unpacked in any way, i´m too noob at programming to start this on my own, but i already have some tracks in Unreal Engine 4, just waiting for the structure come to light and prepare them. I remember when NFS Shift was launched we could run the game unpacked, hope we can sort this in a similar way.
Last edited by arachnus on Fri Sep 14, 2018 8:48 pm, edited 1 time in total.
infogram
Posts: 20
Joined: Fri Nov 03, 2017 8:31 pm

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

Post by infogram »

infogram wrote:Anyway I'll try some experiments with it later, still need to extract the pak again (takes so long on my machine >.>)

Well I've made some great progress!
Decided to try looking into getting loose files to load, a couple hooks later and now the game happily overrides any files in the pak with loose ones if they exist :D

That was the easy part, after that I tried looking into replacing the BGMs, and that's literally taken around the last 4 hours to work out...
To make a long story short though, I eventually managed to replace one of the BGMs with an unencrypted .uexp, and the .uexp I replaced it with actually played in-game 8-)
(It was kinda like how I guessed it could work, replacing the encrypted uexp with a decrypted one, but there was a ton more work needed to fix up the .uasset for it)

Anyway now I just need to figure out how to replace the Ogg inside the .uexp properly, fix up the duration etc. The uasset/uexp I replaced it with also doesn't loop yet neither, so I'll have to try looking into that soon.

If anyone has any Ogg files I can test with please PM me!
FranticFred
Posts: 1
Joined: Fri Sep 14, 2018 8:35 pm

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

Post by FranticFred »

infogram wrote:If anyone has any Ogg files I can test with please PM me!



Someone literally just posted on this thread the other day that they just finished looping all the orchestral tracks. Their username is preta. I'm sure they'd be more than willing to share the tracks if you asked.
romaFC
Posts: 9
Joined: Thu Sep 13, 2018 7:01 pm

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

Post by romaFC »

arachnus wrote:
romaFC wrote:
arachnus wrote:Any progress on Assetto Corsa Competizione key? can i help in anyway?



Nothing so far.

The game just got updated today.

Not sure if that means there will be new AES key.

I guess even if pak files are extracted.

How would they be inserted back in when it requires digital signature to repack.


Only minor files were touched , the acc.exe got updated, but the .pak, .sig and the bigger exe don´t

It´ll be a long way to even after extracting, we can add new content, i´m interested on studying the possibilities to add new scratch made tracks primarily, then maybe we need a way to repack or run the sim unpacked in any way, i´m too noob at programming to start this on my own, but i already have some tracks in Unreal Engine 4, just waiting for the structure come to light and prepare them. I remember when NFS Shift was launched we could run the game unpacked, hope we can sort this in a similar way.



Same.
Just want to add tracks and cars.
GT3 just doesn't interest me much.

I was examining Moto GP 2018 and Monster energy Motorcross both are unreal engine 4 games.

They work with standard unrealpacker tool.

Modders exporting and importing mods in/out no problem.

Granted I have no clue if those games require AES keys.


Hoping aluigi would look at exe of AC competizione.
sade1212
Posts: 4
Joined: Mon Sep 10, 2018 10:05 pm

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

Post by sade1212 »

infogram wrote:Well I've made some great progress!

Amazing, you're single-handedly making this mod more realistic every day. Any chance of a detailed run down of the steps you've figured out so far (fixing up the .uasset and so on) or, if it's what you used to fix all the files, the updated version of NOTter?
infogram
Posts: 20
Joined: Fri Nov 03, 2017 8:31 pm

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

Post by infogram »

sade1212 wrote:
infogram wrote:Well I've made some great progress!

Amazing, you're single-handedly making this mod more realistic every day. Any chance of a detailed run down of the steps you've figured out so far (fixing up the .uasset and so on) or, if it's what you used to fix all the files, the updated version of NOTter?


Well it's actually not that difficult now I know how it works, might a bit difficult to explain all the steps in detail though, but basically all you really need to do is hex edit the .uasset of the sound you're replacing it with, and change the paths inside to match the path of the BGM you're replacing... well I wish it was that easy, but just a few bytes after the path is a hash the engine uses to ID the path, you also need to change that hash to the same hash that's inside the .uasset you're replacing.
I wasted literally hours because I didn't figure that out sooner >.>, without the updated hash the game won't be able to find the sound and you'll just get stuck with a black screen.

Maybe tomorrow I'll write a more detailed guide about it since I'm a little tired atm... but there might not actually be much point now, since I just figured out how the BGM is actually encoded too :)

It uses a codec called HCA, which is a Criware custom thing, completely different to the Ogg codec the other sounds use, that HCA is wrapped in a "SQEXSEAD" container, which gives all the info about the sample rate/channel count/etc.
Luckily for us there's a tool that can decode these into .wav: https://github.com/bnnm/vgmstream-build ... test-u.zip

To decode with that you need to extract it from the .uexp first, then run vgmstream like "test.exe -o output.wav input.sab", and you should get a .wav file with the BGM all decrypted :)
(attached a quick app which will extract the SQEXSEAD stuff from a .uexp, just drag+drop a non-Ogg .uexp into it)

There's a HCA encoder at https://github.com/OpenCGSS/DereTore/wiki/HCA-Encoder too, which I'm hoping will work to put new sounds back in, since I think this HCA stuff is the only way to get looped music working... I'll have a play around with that tomorrow.

Also did make an update for Notter to detect NOT'd files too, but it's really really slow, took around 2 hours to go through an unpacked data.pak and fix everything :/
It did do a pretty decent job though, found ~17,000 NOT'd files and fixed them, there's probably some it missed though, but that doesn't really matter much since we don't have to run it unpacked now :P
I'll post that up tomorrow though since I still need to clean it up a little.
arachnus
Posts: 4
Joined: Fri Sep 14, 2018 1:39 pm

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

Post by arachnus »

romaFC wrote:...cut by aluigi...


Yes i´m hoping too.

i tried UnrealPack, Umodel, quickbms too, tried to find a key on exe´s with hex editor, nothing worked on Acc files, the other games you´ve mentioned probably doesn´t have encryption.

I just bought ACC for the base, hoping for modding capabilities; it has a lot of potential, one of the best physics, now with a nice and almost complete graphics engine, much better than the in house they used before, awesome sounds, i simply don´t like racing GT3 cars too, i would prefer other categories within this environment, it would be great if we could create whole modules, with cars/tracks/rules from many other series, i´m really thinking there wil not be an AC2, with road cars, mixxed classes, open racing, and so on, like AC1, probably they will stick to launching separate series for the future as whole new sims, i hope i´m wrong at this last idea heheh.
kickstart
Posts: 43
Joined: Fri Dec 19, 2014 7:45 am

Assetto Corsa Competizione

Post by kickstart »

Hello guys,
are there any way to decrypt ACC?
Will be fine.

Best wishes, Kickstart
preta
Posts: 2
Joined: Wed Sep 12, 2018 8:09 am

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

Post by preta »

infogram wrote:...cut by aluigi...


I've sent you a PM. As stated above, I have all the music looped and ready to go for insertion.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

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

Post by aluigi »

Please try to not quote big posts. I have edited a couple of posts to make the topic more readable.
aspec7878
Posts: 8
Joined: Fri Sep 22, 2017 10:36 am

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

Post by aspec7878 »

I'm ready to donates some amount. to be able to unpacked AСС files) ;)
omarrrio
Posts: 2
Joined: Sat Sep 15, 2018 11:07 pm

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

Post by omarrrio »

infogram wrote:Download DragonQuest_XI.bms v3, now extracts uncompressed files properly: https://pastebin.com/RePzSkST

This does not work completely fine, as i have to rename almost 500 files to get it to extract the entire thing, can you please fix this, it keeps interrupting my extraction, know that i don't intend to mod DQ11 i just want the text files, thank you again.
infogram
Posts: 20
Joined: Fri Nov 03, 2017 8:31 pm

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

Post by infogram »

omarrrio wrote:
infogram wrote:Download DragonQuest_XI.bms v3, now extracts uncompressed files properly: https://pastebin.com/RePzSkST

This does not work completely fine, as i have to rename almost 500 files to get it to extract the entire thing, can you please fix this, it keeps interrupting my extraction, know that i don't intend to mod DQ11 i just want the text files, thank you again.

Try using the older v2 version from viewtopic.php?p=38235#p38235, also try extracting it into a folder on the root of one of your drives, otherwise QuickBMS might start hitting the 255 character path limit.