Source 2 Decompiler

edited November 2015 in Tools

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.

Windows Executable(x64)

Windows Executable(x86)

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.

Special Thanks

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



  • edited May 2015 Posts: 1,669

    :surprised: This is sick! I'll be an essential tool for all of us

    I didn't know of any .vmat decompiler, is this the first of its kind?

    Now we just need .vmap, when the :shittywizard: @penguinwizzard manages to crack it

    Edited the Tools page on the navbar with this link now.

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited May 2015 Posts: 36

    its more of just penguin and/or hmfd writing code to generate the vmap, as the underlying code of this program is penguins SVF (Stupid Valve Format) parser which can read a compiled s2dota map.

  • Reborn changes some internal format on texture and model. Here's what I currently found:


    1. signature change from 0x0000000C to 0x0001000C
    2. NTRO block is gone (I suspect it's moved somewhere so it's shared between all of textures)
    3. Format enum changed to VTEX specific (1 for DXT1, 2 for DXT5, 4 for RGBA)
    4. Data is moved around, flags, reflectivity is moved up, takes first 20 bytes. Followed by w,h,d,f,m and other thing I still don't know what it is
    5. Actual image data may or may not start at end of filesize (first byte of file) anymore, preview image also missing in some of them. Image data size changed too.
    6. Output from resourceinfo


    1. Still same as old one, but haven't try comparing them


    1. thanks god it's still the same


    1. each animation seems to have its own file instead of being merged in 1 big file, make this easier to works with?


    1. NTRO gone
    2. there's new block called VBIB, which point to where the actual vertex and index data is. It has this format (the number after colon is sample data) which is nearly the same as the old one
    Main block
    4 bytes: 16 - offset to vertex header array
    4 bytes: 1 - vertex header count
    4 bytes: 32 - offset to index header array (offset from this address, not start of file/block)
    4 bytes: 1 - index header array count
    Vertex Header block
    4 bytes: 2582 - vertex count?  <- 16
    4 bytes: 28 - vertex size?
    4 bytes: 40 - format related array offset
    4 bytes: 5 - format related array count
    4 bytes: 312 - seem to be offset to vertex data
    4 bytes: 72296 - seem to be vertex data size (28 * 2583)
    Index header block
    4 bytes: 12288 - index count?    <-32
    4 bytes: 2 - index size , 2 = short
    4 bytes: 0
    4 bytes: 0
    4 bytes: 72584 - offset to index data
    4 bytes: 24576 - seem to be index data size
    1. vertex size sometimes is not 28, not sure what they strip off that
  • Sorry but after few days of trying, I still haven't figured out exactly how to use this decompiler. I am mainly doing art and I am a total idiot when it comes to code and stuff.

    Can anyone tell me how to run this decompiler properly?

    Thank you for making this tool anyway.

  • @Noya Plz help?

  • You need to open command prompt and navigate to the directory using DOS command. In that directory, put the executable files and resource you want to decompile. Run the command as shown in OP post.

    If that files is vtex (image) files, you could also try this

  • Can you give an example plz?

  • hi i tested this version of s2dc and it cant decompile vmat_c from overthrom nor other my vmat_c. will s2dc be upgraded?

  • Posts: 1

    I have crash when I write s2dc -d path :pensive: Can you help me??

  • Posts: 29

    Sorry for the lack of updates everybody; I've been rather busy with real life for the past few months. Anyways, I've just pushed a new update and updated the links. It should work with the new .vtex_c files now. As always, let me know if something goes wrong. I'll look into the other file formats if I have some more free time in the future.

    @Krab Could you be more specific as to what you typed? Usually you will also want to specify a filename or a search pattern, like *.vpcf_c for all particle files, etc.

    @russia_nekto Which file(s) did you try to decompile? I'll take a look at what's going on when I can.

  • Right so its not crashing now. But the decompiling seems to get stuck when doing .vtex_c folders are created but they are empty.

    [S2DC]: Searching for matching files...
    [S2DC]: Please be patient, as this may take a while.
    [S2DC]: Decompiling bamboo_leaves001_color_tga_13950274.vtex_c...

    .vmat_c files still cause the program to crash.

    Working on The Black Road 3 - Persistent RPG

  • edited September 2015 Posts: 29

    @Aleteh Do you have a copy of the vtex_c you are trying to decompile? My GCFScape can't seem to extract it from the vpk.

    Edit: Nevermind, that's what I get for leaving GCFScape open while Dota 2 is patching. It seems like the Release version can't read the files properly. I'm looking into it at the moment.

    Edit2: I've fixed the x64 debug version, but the release versions are still bugging out for some reason. I've updated the links to the debug versions. Those should hopefully work.

  • edited September 2015 Posts: 3

    Thanks for your work on this @HMFD! I've tried your x64 binary but it seems to hang around the decompiling step for league images:

    [S2DC]: Searching for matching files...
    [S2DC]: Please be patient, as this may take a while.
    [S2DC]: Decompiling subscriptions_mlg_world_finals_2015_ingame_png.vtex_c...

    The league images can be found in panorama/images/econ/leagues. I've tried a variety of league images but they all seem to give the same (non) result. The filename of the league images hints that they are in fact PNGs, but I'm not sure about that part.

    resourceinfo.exe -i <filename> -debug tga -mip gets us:

            VTEX Version = 1
            Width        = 256
            Height       = 128
            Depth        = 1
            Reflectivity = ( 0.664329, 0.486304, 0.0849865, 0.171853 )
            NumMipLevels = 1
            Picmip0Res   = 0
            Format       = 2 (VTEX_FORMAT_DXT5)
            Flags        = 0x0000000F
                         | 0x00000001 = VTEX_FLAG_SUGGEST_CLAMPS
                         | 0x00000002 = VTEX_FLAG_SUGGEST_CLAMPT
                         | 0x00000004 = VTEX_FLAG_SUGGEST_CLAMPU
                         | 0x00000008 = VTEX_FLAG_NO_LOD
            Extra Data   = 1 entries:
                           [ Entry 0: VTEX_EXTRA_DATA_FALLBACK_BITS - 1024 bytes ]
                           (Run in verbose mode to see raw bytes.)
  • Working on The Black Road 3 - Persistent RPG

  • Thanks @Aleteh, that works like a treat. Is this based on the current source in master?

  • @watbe i had the same problem as you. After some trial and error i asked HMFD to send his exes since it was working for him and it worked lol

    Working on The Black Road 3 - Persistent RPG

  • edited October 2015 Posts: 146
    1. I downloaded s2dc via the windows executable (x64)
    2. As per the instructions on the website I created the ntro/vtex_c.ntro folder in the root s2dc directory
    3. I ran s2dc using the following command: s2dc -d D:\dev\dota\input\ -o D:\dev\dota\output\ *.vtex_c

    It got stuck on the first vtex_c file it was supposed to decompile:

    [S2DC]: Decompiling addoninfo.txt... [S2DC]: Encountered invalid block type
    [S2DC]: Decompiling materials\particle\basic_glow.vtex_c...

    In fact it incrementally ate up all my 16GB of Ram while trying to decompile the aforementioend file - i'm guessing its not up to date anymore with the latest dota patch?

  • Posts: 74

    Read the comments above

    Working on The Black Road 3 - Persistent RPG

  • edited October 2015 Posts: 146

    The exe's provided at this link did not work:!pxpVRYjT!NVyZ6OqDtwYJ9qobuwbHO2u4FuK4xYRBYEQ_02qBr2Y

    The 86x one crashes with an "invalid allocation size". The other exe basically eats my 16 GB of ram in 5 seconds nearly crashing my comp. The first vtex_c file does not get decompiled.

    NOTE: the allocation size number for the 86x is through the roof; it seems that its reading the file wrong and allocating an astronomical number of memory. Thats clearly whats happening ot the second exe as well, only it does not assert, it just allocates all your pc's memory.

  • Posts: 74

    It works fine for me

    Working on The Black Road 3 - Persistent RPG

  • I'm trying to convert .vtex_c files and none of these solutions are working for me.

    The executables on the download page gets stuck:

    [S2DC]: Decompiling fall_majors_2015_trophy_comp_completed_2_png.vtex_c...

    The ones from!pxpVRYjT!NVyZ6OqDtwYJ9qobuwbHO2u4FuK4xYRBYEQ_02qBr2Y gives me this error:

    [S2DC]: Unsupported image format: "16".

    Just a few weeks ago I was able to decompile them with resourceinfo.exe -i <filename> -debug tga -mip, but after yesterday's patch the .tga files extracted with this method all look corrupted/scrambled in Photoshop. Are these problems related? Please help!

  • Posts: 29

    Thanks for all of the bug reports guys. I've been really busy with job hunting as of late but I'll try to keep fixing the program when I can.

    Particles are also still broken atm. Valve changed the format to a compressed KV3 system, and I'm still trying to figure out how to decompress it. Why a bunch of 2~4kb files need compression is beyond me though...

    @Arkatakor Send me the files you're trying to decompile, and I'll take a look into it.

    @Lemoncake It's really strange that you would get that. As you already know, 16 isn't a valid file format in the new vtex_c format (in the old vtex_c format, it would be equal to IMAGE_FORMAT_BGRX8888, which is equally strange, since pretty much every texture is DXT1/5 or RGBA). If resourceinfo is also giving you weird results, then it could be that your file is corrupted or otherwise damaged. Try verifying the game cache and see if that helps. Make sure you aren't running GCFScape or anything else that tampers with vpk's while you're doing this.

  • edited October 2015 Posts: 146


    In the following link I have a .rar file that you can download. In the top (middle) there is an option to download the file. You will need winrar in order to be able to extract it:

    In this rar are all the files that came out of Valves 10v10 VPK. I used GCFScape to extract the VPK.

    I have observed that none of the following extensions can be decompiled: *.vtex_c, *.vxml_c, *.vjs_c, *.vcss_c (I have tried compiling them independantly).

    My suggestion would be to run s2dc -d inpputDir -o outputDir * on the extracted folder and see which files work for you and which do not. I wish you all the best in your job hunting :) God knows i've been there more times then I care to remember.

  • edited October 2015 Posts: 29

    @Arkatakor .vxml_c, .vjs_c, and .vcss_c aren't currently supported. That being said, those files are mostly just wrappers around the .xml, .js, and .css files in the Panorama code so you can probably just open it up with a text editor or hex editor and get the source (unless they changed it again). As for .vtex_c, everything decompiles fine on my end, which unfortunately doesn't tell me very much. What's your operating system? I'll try making a VM copy of it and running it there.

  • Update: Turns out a small number of .vtex_c files decompiled with the command line displays properly in Photohop. The vast majority of .tga files extracted still look corrupted though. Did Valve do something to the format?


    I've tried verifying game cache and closing all related programs, it didn't work. Are you saying you can extract the .vtex_c files on your end? Do the .tga files come out looking normal? I am using Windows 8.

  • Posts: 29

    The Reborn update changed some of the file structures around. I think the decompiler should still work for legacy files though, since they provide their own NTRO information. Not 100% sure about that though.

    I can extract the .vtex_c's from my end, yes. However, many people have had problems with it on their end, so there might be something on my computer that I forgot about. I'll try making some VMs and see if I can reproduce the results. If you would, also send me the files that you are trying to decompile.

  • I posted about this on the dev forums:

    I can extract them, they just appear scrambled in Photoshop. Got a few friends to try it, and they see the same thing. The file in the .vpk is:


  • edited October 2015 Posts: 29

    Okay so, I tried it, and it turns out that the image format is indeed 16, which is currently not mentioned anywhere in the resource system. That being said, I took a quick look at the actual data, and it looks like it's just raw PNG data. I'll implement something for that tomorrow, but for right now, what you can do is this:

    1. Open up the .vtex_c in a hex editor preferably, or a text editor if you don't have one
    2. Look for the hex string 89 50 4E 47 (the last three letters spell out PNG; this is the start of the PNG header)
    3. Delete everything from the start of the file up to this hex string. Make sure you have the full header intact (including the leading 0x89 character)
    4. Save it as a .png file. You should be able to view/edit it with any image editor now.
    5. fall_majors_2015_trophy_comp_completed_1.png
  • Thanks, it works!

    ...but not for all of them. There seems to be several types of files compiled as vtex_c. Try:


    This one seems to be a real .tga file when extracted, but when opened in Photoshop it looks weirdly colored, distended, with ugly block artifacts (and I dont think its the alpha channel). Any ideas?

    Sorry if this is going a bit off topic, I'm not very good with this kind of technical stuff :c

  • Posts: 146


    Thanks for the update and your continued efforts to look into this. I am using Windows 10, if thats of any help.