Source 2 Decompiler
This is a little project that I've been working on for a while which aims to provide a painless way to decompile Source 2 file formats (.vpcf_c, .vmat_c, etc.).
The code for this project can be found here:
To compile, you will also need to install the latest version of the Boost C++ libraries. If you don't feel like compiling it yourself however, I've also included pre-built Windows binaries. Be aware that these may not be the most recent version, which will always be found on GitHub.
Important: Due to changes in the file structure, the decompiler now requires external structure files (.ntro files) to decompile .vtex_c files, .vpcf_c files, and all files which depend on them. These file can be found on the GitHub page above, and should be placed in the ./ntro folder, where ./ is the directory that the decompiler is found in.
The Source 2 Decompiler (s2dc) currently supports the following file formats. More will likely be added in the future.
- Should produce correct results for all of the .vtex_c files. If it doesn't, let me know and I'll try to figure it out.
- Supports normal textures, cube maps, and sequenced textures.
- Outputs a .tga image and a .vtex file. If the texture has sheet data, then a .mks is created and a .tga image is created for each frame.
- Should produce close results for most of the .vmat_c files. The lighting may be a bit off for some materials. Water/ice and other refractive materials not fully supported yet.
- Outputs a .vmat file and all required textures as .tga images in the same directory.
- Should produce identical results for most of the .vpcf_c files.
- Outputs only the decompiled .vpcf file. Children particles and rendered sprites/models are NOT decompiled for redundancy's sake.
Before you begin, you need to extract the compiled resource files from the .vpk archives using a tool such as GCFScape. By default, s2dc looks for files in your dota_ugc/game/dota_imported folder, so I recommend extracting the files there. If you choose to extract the files elsewhere, you will have to specify that path manually (more on that below).
Once you're all set up with the files and the executable, the rest should be pretty simple. Open up your command prompt/terminal and fill in the following:
s2dc [-d <input path>] [-o <output path>] <input(s)>
Here, the input path specifies the directory that s2dc should search for the compiled resources (dota_ugc/game/dota_imported by default, as mentioned previously), and the output path is the directory that the decompiled resources will be saved to (by default, the same directory s2dc is in). Inputs can be any path(s) to a file, absolute or relative. The wildcard character (*) can also be used in the input.
Once the files have been decompiled, simply copy them to your mod's content folder. For file formats that have dependencies (.vmat_c), the decompiler assumes that you will be placing them in the root directory (that is, dota_ugc/content/dota_addons/yourmodname/). If this is not the case, open up the files with a text editor or the Workshop Tools and change the resource paths to match your configuration.
ReMixx - For providing some insight onto the .vtex_c file format
bongikairu - For providing information regarding the changes brought on by Reborn
penguinwizzard - For his work towards reverse engineering the "Stupid Valve Format"
The ModDota Community - For being a shining beacon of knowledge blazing across a sea of no tools updates