HLLib is a LGPL open source programming library, created by Ryan "Nemesis" Gregg, which abstracts several Half-Life and Half-Life 2 package formats and provides a simple interface for all of them. HLLib is written in native C++ but exposes both a C and C++ interface which can be used in any C or C++ application (additional languages may also use the library with Win32 imports). HLLib works natively in both Windows and Linux. BSP, GCF, NCF, PAK, VPK, WAD, XZP and uncompressed ZIP package formats are supported.
HLLib contains a example application called HLExtract. HLExtract is a GPL command-line utility written in C that can browse, extract, validate and defragment all supported packages. It provides a lean and mean shell-like interface for browsing as well as a command-line interface for automating tasks. HLExtract works natively in both Windows and Linux.
- -p <path>
- Package file to open.
- -d <path>
- Directory to extract content to (defaults to the package's directory).
- -e <path>
- Path to a file for folder in the package to extract. Chain these for multiple items.
-e rootfor everything.
- -t <path>
- Path to a file for folder in the package to validate. Chain these for multiple items.
-t rootfor everything.
- List the contents of the package.
- Defragment the package.
- Drop into shell-like console mode.
- Silent mode. Display minimal messages.
- Use file mapping.
- Use quick file mapping. (Must also specify -m.)
- Allow volatile access. Enable this to share file access with other processes such as Steam.
- Don't overwrite files when extracting.
- Force complete lexicographical reordering of files during defragment even if there is no fragmentation.
- -n <path>
- The directory to find a NCF file's data in (for validation for example).
HLExtract.exe -p %1 -c -v
HLExtract.exe -p "half-life.gcf" -d "backup" -e "root\valve\models" -e "root\valve\config.cfg" HLExtract.exe -p "half-life.gcf" -c -m -v HLExtract.exe -p "half-life.gcf" -lf "half-life.txt" HLExtract.exe -p "half-life.gcf" -m -f
- List the current directory's contents.
- cd <name>
- Change directory to <name>. Type
cd ..to go up one level.
- info <name>
- Display information about <name>.
- extract <name>
- Extract <name> to destination directory (specified by -d).
- validate <name>
- Validate <name> and its subdirectories.
- find <string>
- Search for <string> if the current directory and its subdirectories.
- type <name>
- Type the contents of <name> to the console.
- open <name>
- Open the package <name> within the current package.
- Change to the root directory.
- Display information about the package.
- Clear the screen.
- Display program help.
- Exit the current package.