Decompilation toolchain
Question
What tool turns Source 2 compiled resources (*_c) into readable data, and what is the exact invocation for the files we care about?
Summary
- ValveResourceFormat (VRF / Source 2 Viewer) is the tool. Open source, actively maintained, explicitly supports Deadlock. Version 19.2 was used here.
- Use the CLI (
cli-windows-x64.zipand equivalents), not the GUI, for anything repeatable. - Extracting + decompiling all 77
scripts/*.vdata_ctakes seconds and produces readable KV3 text. - VRF is not vendored in this repo — it is a 48 MB download and its own project.
tools/vendor/is gitignored for this purpose. - Reading the VPK index needs no tooling at all —
tools/vpk_list.pyis stdlib Python.
Findings
Obtaining the CLI
Release assets at https://github.com/ValveResourceFormat/ValveResourceFormat/releases/latest:
| asset | size |
|---|---|
cli-windows-x64.zip | 48.5 MB |
cli-linux-x64.zip | 48.9 MB |
cli-macos-arm64.zip | 49.7 MB |
Source2Viewer.exe (GUI) | 94.1 MB |
ValveResourceFormat.nupkg (library) | 0.8 MB |
Unzipping cli-windows-x64.zip gives Source2Viewer-CLI.exe plus four native dependencies (libSkiaSharp.dll, spirv-cross.dll, TinyEXRNative.dll, blake3_dotnet.dll). Keep them together.
The .nupkg is the library — relevant if we ever want to call VRF in-process from C# instead of shelling out.
Flags that matter
| flag | purpose |
|---|---|
-i | input file, folder, or VPK |
-o | output folder |
-d / --decompile | decompile rather than dump raw |
-f / --vpk_filepath | path filter, e.g. scripts/ |
-e / --vpk_extensions | extension filter, e.g. vdata_c |
-l / --vpk_list | list matching resources |
--vpk_dir | print the VPK file table |
--threads | parallelism |
--vpk_cache | only write files changed since last run — useful across patches |
-b DATA | print one resource block instead of writing files |
Verified invocation
Source2Viewer-CLI.exe \
-i "<game>/citadel/pak01_dir.vpk" \
-o out \
-f "scripts/" -e "vdata_c" -d --threads 4
Produces out/scripts/*.vdata as KV3 text. Sizes at build 6679:
| file | decompiled |
|---|---|
abilities.vdata | 7.0 MB |
heroes.vdata | 2.1 MB |
npc_units.vdata | 179.5 KB |
misc.vdata | 122.4 KB |
Output begins with a KV3 header line naming the encoding and format GUIDs:
<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
Reproduce
# 1. Fetch the CLI into the gitignored vendor dir (adjust asset for your OS)
mkdir -p tools/vendor
curl -L -o tools/vendor/cli.zip \
https://github.com/ValveResourceFormat/ValveResourceFormat/releases/download/19.2/cli-windows-x64.zip
unzip -o tools/vendor/cli.zip -d tools/vendor/vrf
# 2. Confirm the install and build stamp
python tools/find_game.py
# 3. Extract + decompile gameplay data
tools/vendor/vrf/Source2Viewer-CLI.exe \
-i "$(python tools/find_game.py --json | python -c 'import json,sys;print(json.load(sys.stdin)["game_dir"])')/citadel/pak01_dir.vpk" \
-o out -f "scripts/" -e "vdata_c" -d --threads 4
# 4. Sanity check
ls -la out/scripts/heroes.vdata out/scripts/abilities.vdata
head -3 out/scripts/heroes.vdata
On Windows PowerShell, invoke the exe with & and quote the path.
Gotchas
- Pin the VRF version in notes. VRF output format has changed across major versions; a note that does not say which version produced its output is hard to re-verify.
out/is gitignored — decompiled game data must not be committed.- The GUI and CLI are separate downloads. The GUI is fine for exploration but useless for a reproducible pipeline.
-e vdata_cis the compiled extension, but the output files are.vdata(no_c). Filters apply to input names, not output names.- Texture extraction is a different order of magnitude.
.vtex_cis 24 GB packed; do not run an unfiltered extract casually. - VRF is third-party. It can lag a Deadlock patch that changes a format. If decompilation suddenly fails after a patch, check for a VRF release before assuming the game changed something fundamental.
Open questions
- Not tested:
--vpk_cachebehaviour across an actual game patch. - Not tested: the
.nupkglibrary path (in-process C# usage). - Not tested:
--vpk_verifyon this install. - Not tested: whether VRF resolves KV3
_multibaseinheritance in any mode. Observed output suggests it does not, but no flag was searched for specifically. - Not tested:
.vtex_c→ PNG for item/hero icons.