VPK (Valve Pak) files are uncompressed archives used to package game content. Valve’s post GCF games store materials, models, particles, choreography scenes and many other file types in VPK files.
VPKs are also used to distribute mods via the the addoninstaller tool that ships with some games, such as Left 4 Dead 2.
Contents
- 1 Creation
- 1.1 Linux / Unix
- 1.2 Windows
- 2 Commands
- 2.1 Usage
- 2.2 Example
- 2.3 Create VPK/Add Files
- 2.4 Extract Files
- 2.5 Display VPK Info
- 2.6 VPK Integrity/Security
- 2.7 Misc.
- 2.8 Options
- 3 Examples
- 3.1 Making custom vpks for a mod
- 3.2 Creating A Key Value File and VPK
- 4 Response File
- 4.1 Excluded files
- 5 See Also
Creation
VPKs can be created with the command line tool vpk.exe.
The tool can be located in the bin folders for most Source games, such as the ones below. The tool is not game dependent, however it is suggested that you use the tool that corresponds to the game you are creating the vpk for. The version in one game may not be as up to date as the version in another due to game updates.
| Game | Path to VPK.exe |
|---|---|
| ..steamappscommonAlien Swarmbin | |
| ..steamappscommonTeam Fortress 2bin | |
| ..steamappscommonLeft 4 Deadbin | |
| ..steamappscommonCounter-Strike Sourcebin | |
| ..steamappscommonSource SDK Base 2013<Singleplayer or Multiplayer>bin | |
| ..steamappscommonCounter-Strike Global Offensivebin | |
| ..steamappscommonPortal 2bin |
Bug: For some reason sometimes when vpk.exe is used to extract VPKs it gives empty folders,
Portal‘s vpk.exe
(..steamappscommonPortalbin) seems to extract the files fine
(there might be a corruption when used since it is a diffrent version).
For servers installed using SteamCMD, it is located in the server’s bin directory. On Linux, it is named vpk_linux32 instead of vpk.exe.
Linux / Unix
Note: The vpk binary makes VPK files of version 2.0, which are not compatible with games like Left 4 Dead 2 that use an older version of the VPK format (in fact Left 4 Dead 2 will not even start if it detects an unsupported vpk). There is a Python package that can be installed with
which supports the older format. It is also far more convenient than using the built-in tool. Instructions can be found on the Github page.
On Linux / Unix clients, the vpk file can be found replacing «..steamappscommon» for «~/.steam/steam/steamapps/common/«. However, it is named vpk_linux32 instead of vpk.exe. Note: If you installed Steam via Flatpak, the path is slightly different. Look in ~/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common
If you are running on a 64-bit system, this binary will not work by default. You must tell it to use the 32-bit libraries located in the same directory. This can be done by setting the LD_LIBRARY_PATH variable.
The following script, if created in the above listed bin directories, will create a wrapper to properly launch the 32-bit executable; then a link (or desktop shortcut) to vpk.sh (if saved as said name) can be created, from there:
#!/bin/bash DIR=$(dirname "${BASH_SOURCE[0]}") export LD_LIBRARY_PATH=$(cd "$DIR" && pwd) exec "$DIR/vpk_linux32" "${@}"
Alternatively, if you’re running 64-bit Linux, you can use this script to execute the vpk_linux32 binary successfully. Save this script to «/usr/local/bin/vpk» and set it as an executable in the file’s properties, for ease of use:
#!/bin/bash VPK_LINUX=$(find "${HOME}/.local/share/Steam" -type f -iname "vpk_linux32" -print | head -n 1) VALVE_LIB_DIR=$(dirname "${VPK_LINUX}") LD_LIBRARY_PATH="${VALVE_LIB_DIR}:${LD_LIBRARY_PATH}" "${VPK_LINUX}" "${@}"
HELPFUL NOTE: The «${@}» is for drag-and-drop with *.desktop files and arguments when using the vpk command via console.
Windows
On Windows, you can easily drag-and-drop folders onto vpk.exe file in the bin folder and get a *.vpk file in return, and vice-versa by drag-and-dropping a *.vpk file instead.
Tip: Some users may find it easier to create a shortcut (*.lnk) linked to
vpk.exe as it can be placed anywhere, like a folder that you often are packaging files from, making packaging folders into VPKs and vice-versa quicker and easier than having to return to the bin folder to do so. A good example of this is the custom folder, where placing a shortcut there could make debugging of custom vpk files much quicker.
Commands
Usage
-
vpk [options] <command> <command arguments...>vpk [options] <directory>vpk [options] <vpkfile>
Example
-
vpk -?- Lists all of the help info, list of available arguments, and info about each argument.
Create VPK/Add Files
vpk <dirname>- Creates a pack file named <dirname>.vpk. Must be an existing location. The VPK will appear next to the directory.
Tip: Drag a folder onto the tool in Explorer to trigger this command.
vpk a <vpkfile> <filename1> <filename2> ...- Add file(s).
a <vpkfile> @<filename>- Adds the files referenced in a «response file» (not response rules). Note the
@symbol. - The added file will not be added with its file path if the default file path matches that of CMD
k vpkfile <keyvalues_filename>- Add files references in a keyvalues control file.
Bug: They will appear inside the VPK with their full path (
C:etc) intact — is there a way to avoid this? vpk <directory>- Create VPK from directory structure.
Note: This is invoked when a directory is dragged onto the VPK tool.
vpk x <vpkfile> <filename1> <filename2> ...- Extract file(s).
vpk <vpkfile>- Extract all files from VPK.
Note: This is invoked when a .VPK file is dragged onto the VPK tool.
Display VPK Info
vpk l <vpkfile>- List contents of VPK.
vpk L <vpkfile>- List Detailed contents of VPK.
VPK Integrity/Security
vpk checksig <vpkfile>- Verify signature of specified VPK file. Requires -k to specify key file to use.
Misc.
vpk generate_keypair <keybasename>- Generate public/private key file. Output files will be named <keybasename>.publickey.vdf and <keybasename>.privatekey.vdf
Note: Remember: your private key should be kept private.
Options
-
Tip: Please note the case of these options. A capital letter is different than a lowercase letter.
-v- Verbose output.
-M- Produce a multi-chunk VPK.
Note: Required if creating a VPK with key values.
- Each chunk is a file limited to around 200MB.
- To reduce patch sizes, chunks are never overwritten. New/modified files are instead written to a brand new chunk every time you run the tool.
Note: Multi-chunk generations only works when creating a VPK from a response file.
Tip: To inspect a multi-chunk VPK open the ‘_dir’ file.
-P- Use SteamPipe-friendly incremental build algorithm. Use with ‘k’ command. For optimal incremental build performance, the control file used for the previous build should exist and be named the same as theinput control file, with ‘.bak’ appended, and each file entryshould have an ‘md5’ value. The ‘md5’ field need not be theactual MD5 of the file contents, it is just a unique identifierthat will be compared to determine if the file contents has changedbetween builds.
-c <size>- Use specified chunk size (in MB). Default is 200.
-a- Align files within chunk on n-byte boundary. Default is 1.
-K- With commands ‘a’ or ‘k’: Sign VPK with specified private key.
-k- With commands ‘a’ or ‘k’: Public key that will be distributed and used by third parties to verify signatures.
- With command ‘checksig’: Check signature using specified key file.
Examples
Listed below are some examples of using the tool and what they will do.
Making custom vpks for a mod
Content must be a subdirectory under sound/materials/models in the root dir of your VPK, or else they won’t appear in hammer.
IE your sounds should be located in sound/foo/thisIsASound.wav in your custom vpk, models under models/, materials under materials/, etc.[Clarify]
VPKs must be mounted in gameinfo.txt.
Creating A Key Value File and VPK
- 1. Create a folder with the correct directory structure and files that you wish to use such as
mymod/resource/ui/<file.res> - 2. Use the command line in a prompt or a bat:
vpk generate_keypair <name>vpk -M -k <name>.publickey.vdf -K <name>.privatekey.vdf "..SteamAppscommonTeam Fortress 2binmymod"
- 3. In the folder where the vpk tool is located there will now be a public key vdf, a private key vdf, a vpk named mymod_000 and a vpk named mymod_dir.
-
Warning: Never disclose or share your private key vdf or the key. Only share the public key.
- You must distribute your mod with both the mymod_dir and mymod_000 vpks for the keyvalue to work.
-
Response File
A «response file» contains a list of files to be added to a VPK. Paths are relative to the current directory of the vpk tool.
Below is a Python script which generates a response file and then builds a multi-chunk VPK. Put it in your mod folder. You will need to edit the three variables at the top.
#What folders to look for, and pack into the pak01 vpk set. target_folders = [ "materials", "models", "resource", "media", "particles", "scripts", "maps", "expressions", "scenes" ] #What files to look for, in the aforementioned folders. file_types = [ "vmt", "vtf", "mdl", "phy", "vtx", "vvd", "ani", "pcf", "vcd", "txt", "res", "vfont", "cur", "dat" , "bik", "mov", "bsp", "nav", "lst", "lmp", "vfe" ] #which vpk.exe to use. do not use ! vpk_path = "../steamapps/common/SourceFilmmaker/game/bin/vpk.exe" # Script begins import os,subprocess from os.path import join response_path = join(os.getcwd(),"vpk_list.txt") out = open(response_path,'w') len_cd = len(os.getcwd()) + 1 for user_folder in target_folders: for root, dirs, files in os.walk(join(os.getcwd(),user_folder)): for file in files: if len(file_types) and file.rsplit(".")[-1] in file_types: out.write(os.path.join(root[len_cd:].replace("/","\"),file) + "n") out.close() #the "pak01" here specifies the multi-chunk vpk names. Could be changed to "pak02" or "hl2_textures", or whatever your mod needs. subprocess.call([vpk_path, "-M", "a", "pak01", "@" + response_path])
To handle this process for Portal 2 you can also use the P2 Multichunk Tool, to automate the response file creation and the creation of the vpk files.
-
-
Warning: The tool will probably work for other games aside Portal 2 if you change the .vpk path accordingly, I have expanded it’s functions to make it easier to experiment, but, since I haven’t tested outside Portal 2 I can’t 100% guarantee it will work with other games, feel free to test it, and please let me know if it works.
-
Excluded files
Executable and some archive files are discarded by the VPK tool:
.zip .reg .rar .msi .exe .dll .com .cmd .bat
Warning: Other VPK files are not excluded from compilation, and will be compiled into the new VPK if present in the search paths!
See Also
- VPK File Format (technical details)
- L4D Campaign Add-on Tutorial
- L4D2 Campaign Add-on Tutorial
- Releasing A Portal 2 Map
- P2 Multichunk Tool (Easy handling of mass vpk packing)
- Swarm Campaign Add-on Tutorial
- VPK Compare GUI Tool for finding conflicts between VPK files
- Source Multi-Tool (VPK Creator — GUI)
#1
Отправлено 08 Февраль 2016 — 16:17
всем привет
если способ редактировать vpk файл не распаковав его ?
хотел сделать незначительные изменения которые не повлияют на оригинальные файлы игроков а наоборот дополнят их исключительно на сервере
если кому известен способ но не хочет публично говорить о нём прошу сообщить хотя бы в л/c
Сообщение отредактировал Apocalypse 2: 08 Февраль 2016 — 16:23
- StevMype это нравится
- Наверх
#2
Santiago
Отправлено 08 Февраль 2016 — 16:32
vpk — это же архив, насколько я знаю
- Наверх
#3
Apocalypse 2
Отправлено 08 Февраль 2016 — 16:37
vpk — это же архив, насколько я знаю
верно но хотелось бы знать есть ли способ отредактировать его изнутри у архива «vpk» есть определённый лимит (кол-во файлов)
дело в том что распаковав большой объём файлов (пример pak_01dir) его уже не возможно собрать обратно не знаю как это сделали «valve» но это факт
пробовал разные компиляторы но увы попытки не увенчались успехом ругается на лимит файлов
Сообщение отредактировал Apocalypse 2: 08 Февраль 2016 — 16:38
- Наверх
#4
Apocalypse 2
Отправлено 13 Май 2016 — 22:10
удалось найти способ редактировать vpk а именно удалять его содержимое или вшивать свои файлы для этого использовал программу Dota2Slasher подходит под L4D2
тестировал в течении 3 дней
минус у данной настройки 1 после обновления придётся каждый раз загружать переписанный архив
тему можно закрыть
Сообщение отредактировал Apocalypse 2: 13 Май 2016 — 22:11
- Наверх
Автору золотую медаль я ету шнягу пол дня искал чтоб в Портале 2 звуки распечатать ))))))))))))))))
- пожаловаться
- скопировать ссылку
Описание тупое,принцип работы разрабатывал имбицил…-10000000000
- пожаловаться
- скопировать ссылку
Черное окошко открывается и сразу закрывается. Не пашет.
- пожаловаться
- скопировать ссылку
van Valdis тоже самое
- пожаловаться
- скопировать ссылку
Полезная штука.
- пожаловаться
- скопировать ссылку
- пожаловаться
- скопировать ссылку
Я так и не понял, как он работает, но как-то он работает.
- пожаловаться
- скопировать ссылку
конченное описание. нельзя ли по понятней написать что сделать?
- пожаловаться
- скопировать ссылку
Steve Gaboda Тоже не работает и ваш метод. Сами то хоть проверили что написали??? Приложение полностью консольное и работать с ним нужно только с командной строки
- пожаловаться
- скопировать ссылку
короче, нужно не запустить и кидать а просто переместить VPK на иконку приложения
- пожаловаться
- скопировать ссылку
- пожаловаться
- скопировать ссылку
Не работает.-1000000000
- пожаловаться
- скопировать ссылку
Мобильные приложения
[pvc1 в 09:27|10 Фев 2023]
Прошивки и программы для PlayStation Vita
[pvc1 в 09:10|09 Фев 2023]
Приложения для PlayStation 4
[pvc1 в 09:05|09 Фев 2023]
ПК программы для PlayStation 2
[pvc1 в 09:59|08 Фев 2023]
ПК софт для PlayStation 4
[pvc1 в 10:05|07 Фев 2023]
ПК софт для PlayStation 4
[pvc1 в 09:59|07 Фев 2023]
Прошивки и программы для PlayStation Vita
[pvc1 в 09:44|06 Фев 2023]
Прошивки и программы для PlayStation Vita
[pvc1 в 09:39|06 Фев 2023]
Железные вопросы PlayStation 2
Мобильные приложения
[pvc1 в 09:16|03 Фев 2023]
ПК программы для PlayStation 2
[pvc1 в 09:04|03 Фев 2023]
Прошивки и приложения для PlayStation 3
[pvc1 в 09:48|02 Фев 2023]
Общая дискуссия по PlayStation 5
[pvc1 в 09:04|02 Фев 2023]
ПК софт для PlayStation 4
[pvc1 в 08:52|02 Фев 2023]
Приложения для PlayStation 2
Прошивки и приложения для PlayStation 3
[pvc1 в 10:36|01 Фев 2023]
Об играх PlayStation Vita
[pvc1 в 09:29|31 Янв 2023]
Прошивки и программы для PlayStation Vita
[pvc1 в 08:36|31 Янв 2023]
ПК софт для PlayStation 4
[pvc1 в 10:04|30 Янв 2023]
Прошивки и программы для PlayStation Vita
[pvc1 в 08:59|30 Янв 2023]
Прошивки и программы для PlayStation Vita
[pvc1 в 19:29|29 Янв 2023]
Прошивки и приложения для PlayStation 3
[pvc1 в 09:06|29 Янв 2023]
Приложения для PlayStation 5
[pvc1 в 11:45|26 Янв 2023]
Прошивки и приложения для PlayStation 3
[pvc1 в 09:27|24 Янв 2023]
Приложения для PlayStation 2
Приложения для PlayStation 2
ПК софт для PlayStation 4
[pvc1 в 10:48|19 Янв 2023]
Прошивки и программы для PlayStation Vita
[pvc1 в 10:35|18 Янв 2023]
Приложения для PlayStation 2
Общая дискуссия по PlayStation 3
[m951 в 03:46|18 Янв 2023]
ПК программы для PlayStation 2
[pvc1 в 15:17|16 Янв 2023]
Прошивки и приложения для PlayStation 3
[pvc1 в 14:59|16 Янв 2023]
Общая дискуссия по PlayStation 5
[pvc1 в 10:38|13 Янв 2023]
Общая дискуссия по PlayStation 2
Эмуляторы для PlayStation Vita
[pvc1 в 12:26|11 Янв 2023]
Приложения для PlayStation 4
[pvc1 в 19:37|08 Янв 2023]
ПК программы для PlayStation 3
[pvc1 в 16:58|08 Янв 2023]
Приложения для PlayStation 2
Об играх PlayStation 2
Мобильные приложения
ПК софт для PlayStation 5
[pvc1 в 09:26|04 Янв 2023]
Программы и Приложения для PlayStation Portable
[pvc1 в 19:05|03 Янв 2023]
Программы и Приложения для PlayStation Portable
[pvc1 в 18:59|03 Янв 2023]
ПК софт для PlayStation 4
[pvc1 в 16:48|01 Янв 2023]
Общая дискуссия по PlayStation 1
[pvc1 в 09:51|23 Дек 2022]
ПК программы для PlayStation 2
[pvc1 в 09:10|17 Дек 2022]
Мобильные приложения
[pvc1 в 09:31|16 Дек 2022]
Приложения для PlayStation 2
Программы и Приложения для PlayStation Portable
[pvc1 в 08:50|13 Дек 2022]
Эмуляторы для PlayStation Vita
[pvc1 в 08:49|13 Дек 2022]








