Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for vpk format #488

Open
darealshinji opened this issue May 31, 2023 · 2 comments
Open

Support for vpk format #488

darealshinji opened this issue May 31, 2023 · 2 comments

Comments

@darealshinji
Copy link

darealshinji commented May 31, 2023

Is it possible to add support for extracting Valve Pak files using the vpk command line tool? https://pypi.org/project/vpk/

Listing content:

# vpk -l maps_dir.vpk
maps/bs_c0m0c.bsp
maps/bs_c0m0b.bsp
maps/bs_c0m0a.bsp

# vpk -la maps_dir.vpk
maps/bs_c0m0c.bsp CRC:611e2b87 Size:14320992
maps/bs_c0m0b.bsp CRC:2ef444a6 Size:20866336
maps/bs_c0m0a.bsp CRC:0ea73c93 Size:21933489

Extract all files: vpk -x outdir maps_dir.vpk

Extract single file without creating directories:
vpk -x outdir --filter maps/bs_c0m0a.bsp --no-directories maps_dir.vpk

On an error vpk returns a line beginning with either Error: or IOError:.

@zhuyaliang
Copy link
Member

@darealshinji How to achieve vpk compression?

@darealshinji
Copy link
Author

An archive is created with vpk -c DIR OUTFILE (vpk archives are not compressed).
The leading directory path is removed:

$ ls test_files
file1.dat  file2.dat
$ vpk -c $HOME/test_files out.vpk
$ vpk -l out.vpk 
file2.dat
file1.dat

Here's the help output:

usage: vpk [-h] [--version] [-l | -la | -t | -c DIR | -p | -x OUT_LOCATION] [-cv {1,2}] [-nd] [-pe ENC] [-f WILDCARD | -re REGEX | -name WILDCARD] [-v] file

Manage Valve Pak files

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

Main:
  file                  Input VPK file
  -l, --list            List file paths
  -la                   List file paths, crc, size
  -t, --test            Verify contents
  -c DIR, --create DIR  Create VPK file from directory
  -p, --pipe            Write file contents to stdout
  -x OUT_LOCATION, --extract OUT_LOCATION
                        Extract files to directory
  -cv {1,2}, --create-version {1,2}
                        Create VPK with this version
  -nd, --no-directories
                        Don't create directries during extraction
  -pe ENC, --path-encoding ENC
                        File paths encoding

Filters:
  -f WILDCARD, --filter WILDCARD
                        Wildcard filter for file paths
  -re REGEX, --regex REGEX
                        Regular expression filter for file paths
  -name WILDCARD        Filename wildcard filter
  -v, --invert-match    Use filters for exclusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants