HLLib - NemPosted: May 23rd, 2005 - 6:32:20 pm

HLLib is a package library for Half-Life that abstracts several 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 standard C imports). HLLib works natively in both Windows (x86 and x64) and Linux. BSP, GCF, NCF, PAK, VPK, WAD, XZP and uncompressed ZIP package formats are supported.

HLLib is an open source library licensed under the LGPL. It comes with the source code and binaries necessary to use it. An example application called HLExtract, which is licensed under the GPL, is also included. HLExtract is a command line utility written in C that can load all HLLib supported packages and extract multiple items from them while maintaining their directory structure. Also included is a C# HLExtract port called HLExtract.Net.

Download: GridMount:

A MacFUSE file system handler called GridMount is available for those looking to run HLLib on a Mac.

Java Wrapper:

A Java wrapper is available for those looking to use HLLib in Java. It can be found on SourceForge.

Revision History:

  • Modified VPF file support to handle the removal of a null terminator from the end of the directory.
  • Added support for new SGA file format (v6).
  • Added support for new SGA file format (v7).
  • Fixed support for VPK file format (v1).
  • Added support for new VPK file format (v2).
  • Added SGA file support.
  • Added ZIP deflate support.
  • Fixed crash when opening VBSP files with no pak file lump.
  • Fixed crash in CProcStream.
  • Fixed VPK signature check.
  • Workaround for crash in .Net wrapper.
  • Added support for GCF files larger than 4 GB.
  • Added support for x64.
  • Added Visual Studio 2010 solution.
  • Added Visual Studio 2008 solution..
  • Removed Visual Studio 2003 solution.
  • Added support for packages larger than 4 GB.
  • Added support for new VBSP file format.
  • Added support for new VPK file format.
  • Added VPK file validation.
  • Fixed crash when closing VPK files.
  • Added VPK file support.
  • Added VBSP .lmp support.
  • Fixed support for files over 2 GB.
  • Added Last Version Played attribute to NCF file.
  • Fixed change to directory entry folder terminator.
  • Added Last Version Played attribute to GCF file.
  • Improved GCF version check.
  • Fixed fragmentation header checksum after defragment.
  • Added different search string comparisons.
  • Added Visual Studio 2005 solution.
  • Improved package type tests.
  • Added generic write support to mapping interface.
  • Added no recurse option to FindFirst()/FindNext().
  • Improved package item attribute consistency.
  • Fixed GCC visibility support.
  • Fixed unnecessary GCF bounds check.
  • Fixed BSP unused lump check.
  • Added Linux support.
  • Fixed near infinite find next recursion.
  • Fixed bug in GCF file defragmentation progress.
  • Added NCF file support.
  • Added GCF file defragmentation.
  • Added fragmentation property to GCF files.
  • Added Dark Messiah VBSP support.
  • Fixed hlPackageCreateStream() bug.
  • Fixed CMapping::GetTotalMemoryUsed() calculation.
  • Fixed PAK file path parsing.
  • Improved error messages.
  • Improved file mapping performance.
  • Added memory tracking.
  • Improved view management.
  • Fixed memory mapping bug.
  • Fixed user data bug in proc reader.
  • Fixed WAD file GetImageData() bug.
  • Fixed default mapping stream view size.
  • Fixed a minor memory leak.
  • Rewrote entire library.
  • Open packages from anywhere (files, memory, abstract streams).
  • Get package and item attributes.
  • Stream package data.
  • Validate package data.
  • Added a C wrapper.
  • Improved and optimized package loading code.
  • Improved package detection.
  • Added XZP file support.
  • Added Source engine BSP support.
  • Added mipmap level option to CWADFile.
  • Improved WAD file support.
  • Improved detection of corrupt packages.
  • Extended CGCFFile.
  • Extended CFileMapping and CPrimitiveFileMapping to allow for volatile access.
  • Fixed CPackageUtility::Extract() bug caused by illegal characters.
  • Files of size 0 B are now treated as valid files.
  • Extended CPackage.
  • Extended CMappedPackage.
  • Improved error messages for system calls.
  • Fixed last error not being set in CMappedPackage::Open().
  • Rewrote mapping code to be more flexible.
  • Packages located on disk or in memory can now be loaded.
  • Optimized file mapping.
  • Fixed CPackage::Root bug.
  • Fixed CGCFFile::GetFileSizeOnDisk() bug.
  • Fixed CPackage memory leak.
  • Fixed CMappedPackage initialization bug.
  • Fixed CMappedPackage deinitialization bug.
  • Changed CDirectoryItem::Parent to a CDirectoryFolder.
  • Extended CWADFile.
  • Added CBSPFile which acts like CWADFile on a BSP's textures.
  • Extended CWADFile.
  • Changed GetFileSizeEx() to GetFileSize() (Not all versions of Windows supported the former).
  • Extended CPackage.
  • Extended CGCFFile.
  • Converted from bool to BOOL.
  • HLLib now used by GCFScape.
  • Added callback functionality to CPackageUtility::Extract().
  • Extended CGCFFile.
  • Minor bug fixes.
  • Original build.
Modified: Jan 22nd, 2017 - 6:09:30 pm[ 163599 Views ]

[ 1 2 3 ]

31. kevincoxModified: Feb 14th, 2013 - 10:05:20 pm
Thanks, all that was missing was that file. I'm not too familiar with make but there is a way to pattern match all of your source files so you don't forget to add any in the future.

Here are my results:
- Here is my final Makefile (just added that file) http://pastebin.com/bFQcbMaj
- Here is a patch for the Makefile http://pastebin.com/Fb6RAzzs
- Here is the AUR package, it's PKGBUILD is essentially a shell script that can be used as a reference on how to build it. https://aur.archlinux.org/packages/hllib/

Thanks again for the help. HLExtract worked perfectly.

32. sl1pkn07Posted: Feb 14th, 2013 - 11:32:35 pm
ive upload hllib(named hlextract) in AUR [1] since 2010, i use the patchset from OpenSuse Game repository [2](before from etamPL repository [3])

the patchet:


and little fix to change Win to unix EOL (end of line) to apply the patchset

find -type f -exec perl -pi -e 's/\r\n?/\n/g' "{}" \;

only have a little trouble with certain warning


(sorry, im not coder)


[1] https://aur.archlinux.org/packages/hlextract/
[2] http://download.opensuse.org/repositories/games/openSUSE_12.2/src/libhl2-2.4.3-1.1.src.rpm
[3] http://nemesis.thewavelength.net/index.php?c=108&o=0#c3261

33. sl1pkn07Posted: Nov 4th, 2013 - 12:48:50 am

Nem, can you update the linux makefililes?

missing SGAFile.cpp into hllib/Makefile

but with add the make fail:


and still have this warnings:



34. NemPosted: Nov 6th, 2013 - 5:40:12 am
Try going to SGAfile.h and adding typename to the template parameter typedefs. E.g.:

typedef TSGAHeader SGAHeader;
typedef typename TSGAHeader SGAHeader;

Except for the SGAFile typedefs that don't use a template parameter.

35. sl1pkn07Posted: Nov 9th, 2013 - 11:21:36 pm

what change need exactly? im not coder :S


36. Ravu al HemioPosted: Nov 22nd, 2013 - 1:09:46 am

I have a HLLib version that successfully compiles under Linux on Github. I try to keep it in sync with HLLib releases. (If I miss a release, open an issue there!)


37. sl1pkn07Posted: Nov 27th, 2013 - 10:30:12 pm
@Ravu al Hemio



38. sl1pkn07Posted: Sep 28th, 2014 - 3:42:54 pm
Hi. you change any in the zip?

stop build with the @Ravu al Hemio patchset for linux


39. tgnottinghamModified: Sep 21st, 2015 - 8:59:40 am
I've created a Python binding for HLLib, available at https://github.com/tgnottingham/hllib.py.

- The Python binding as a module, hllib.py.
- A Python version of HLExtract, hlextract.py.
- A modest amount of documentation.
- Works under Linux and Windows.

40. 4LTPosted: Sep 20th, 2018 - 3:10:16 am

I can't seem to list files I've bspzipped into a BSP (created with the source filmmaker engine tools) with either HLExtract or GCFScape. All I see are lumps; no cubemaps, and nothing I explicitly added with bspzip. I can however extract the files with bspzip. I was hoping the files would be extractable, because I'm trying to make my map source available through distributing it in the BSP on the Steam workshop (a shame Valve won't allow us to upload the VMF) and GCFscape is the easiest way to get at the file.

[ 1 2 3 ]

You must be logged in to post a comment.
New users can register here.
Nem's Tools v2.0 © 2006 Ryan Gregg.
Execution time: 0.031368s; Queries: 17.
dishes served.
Powered by The Wavelength.

Valid XHTML 1.0 Transitional Valid CSS