HLLib

From Valve Developer Community
Revision as of 20:08, 28 June 2009 by Nem (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

HLLib

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.

HLExtract

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.

Screenshot

Hlextract.png

Common Options

-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 root for everything.
-t <path>
Path to a file for folder in the package to validate. Chain these for multiple items. -t root for everything.
-l[d][f]
List the contents of the package. -ld for directories. -lf for files. -ldf for everything.
-f
Defragment the package.
-c
Drop into shell-like console mode.
-s
Silent mode. Display minimal messages.
-m
Use file mapping.
-q
Use quick file mapping. (Must also specify -m.)
-v
Allow volatile access. Enable this to share file access with other processes such as Steam.
-o
Don't overwrite files when extracting.
-r
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).
Note:Dragging and dropping a package onto HLExtract.exe is equivalent to passing HLExtract.exe -p %1 -c -v
.

Examples

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

Console Commands

dir
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.
root
Change to the root directory.
status
Display information about the package.
cls
Clear the screen.
help
Display program help.
exit
Exit the current package.

External links