VPKEdit icon indicating copy to clipboard operation
VPKEdit copied to clipboard

Add Titanfall VPK support

Open craftablescience opened this issue 2 years ago • 10 comments

Describe Your Suggestion

Not actually sure how feasible this is, but they don't seem too different from regular Source VPKs

craftablescience avatar Jan 29 '24 10:01 craftablescience

There is a titanfall vpk reader software tou can take a look at here

https://github.com/barnabwhy/TFVPKTool

It is write in javascript/typescript

But the basic priciples still apply here and can be looked at to see how they read the file

Nbc66 avatar Jan 31 '24 00:01 Nbc66

Already have that tab open in my browser :p

Thanks for the tip though!

craftablescience avatar Jan 31 '24 00:01 craftablescience

There's also this commit I did to add some basic support to ValvePak C# library if you want more inspiration from another language: https://github.com/p0358/ValvePak/commit/bbca23818dc27b1981b7168539c4fa5edab5c98d

Main differences from Source VPK are:

  • files stored can be split into parts (but not sure if any actually are, fun)
  • index files are split into languages, they can contain different files (Titanfall 1 was split by languages, but thankfully they didn't do same files with different contents, but rather the different languages would just miss the other r1_%language%.txt files)
  • compression with LZHAM of some files
  • 64-bit integers instead of 32-bit
  • embedded audio is absolute hellhole and only the linked TS library above handles it, audio comes as OGG and then the game unpacks it in-place into headerless WAV as install step in Titanfall 1, you need to parse the wav.acache file to reconstruct wav headers to unpack/play audio

With Titanfall 2 and Apex, Respawn stopped embedding audio in VPK (and textures) and they shipped everything in english index files...

p0358 avatar Feb 04 '24 13:02 p0358

audio comes as OGG and then the game unpacks it in-place into headerless WAV

i knew audio was messed up looking at tfvpktool but what the fuck

craftablescience avatar Feb 04 '24 14:02 craftablescience

Yeah audio in that game was one big scam: https://twitter.com/p0358/status/1545216883472977922

Basically they convinced people they get uncompressed aka lossless audio. But no, they just inflate OGG for no reason and you only waste your disk space for a game that could weigh 30 GB with all languages included instead of 60 GB xD

Allegedly they did this to lower the minimum CPU requirements (plus Xbox used hardware accelerated audio compression so they didn't care). Nowadays you can download game files in 5 minutes and then wait few times longer for single-threaded audio inflation job to finish afterwards.

p0358 avatar Feb 04 '24 15:02 p0358

Here is another program to deal with Respawn VPKs: https://github.com/harmonytf/HarmonyVPKTool

Jan200101 avatar Feb 04 '24 16:02 Jan200101

I've checked it, that program uses TFVPKTool internally

craftablescience avatar Feb 04 '24 16:02 craftablescience

There's also a Go implementation for dealing with VPKs, not sure how useful that is for you though ^^" https://github.com/pg9182/tf2vpk

GeckoEidechse avatar Feb 04 '24 16:02 GeckoEidechse

r5r has an early apex vpk implementation, should work for titanfall 2 as well https://github.com/Mauler125/r5sdk/tree/p4sync/src/vpklib

uniboi avatar Feb 04 '24 16:02 uniboi

https://github.com/taskinoz/RSPNVPK

begin-theadventure avatar Feb 04 '24 23:02 begin-theadventure