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 from Web Archive: + + + + + Download from unofficial Github mirror: + + + + 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: + ++ + v2.4.6 +
-
+
- 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. +
+
+
+ Well, this looks like a pretty spiffy library... but you should create dsw and dsp files for people who + are jacked with VC++6. But I'm not one of them (I have neither--I compile them all by hand using .NET + toolkit and lots of microsoft SDK's
+
+
If I had Visual Studio 6.0 I would have but I don't. That said, there is no + reason to need to compile the library (as the binaries are included) unless you want to make changes to + it and if a Visual Studio 6.0 user does want to make changes, it is not to hard for them to convert (or + recreate) the project files.
Visual Studio 6.0 users might also be interested in the free build + of Visual + C++ .NET 2005 Express Beta from Microsoft.
+
+
+
+
+
+
+
// Original class
class CExample
{
public:
CExample()
{
+ string = 0;
}
~CExample()
{
delete []string;
}
char *GetString()
+ {
return string;
}
void SetString(const char *newString)
{
delete + []string;
string = new char[strlen(newString) + 1];
strcpy(string, newString);
+ }
private:
char *string;
};
using namespace + System::Runtime::InteropServices;
// Wrapper class
__gc class Example
{
public:
+ System::String *GetString()
{
return new System::String(example.GetString());
}
+ void SetString(System::String *newString)
{
char *string = (char + *)(Marshal::StringToHGlobalAnsi(newString)).ToPointer();
example.SetString(string);
+ Marshal::FreeHGlobal((System::IntPtr)string);
}
private:
CExample example;
};
+
+ However, I will be completing HLLib 2.0 soon which will have a C wrapper which you should be able to + directly import into any C# project (in fact almost any project in any language). +
+
+ Oh thats great :D
+
+

+
+ Is there anything I can do to fix this?
+
+ Oh and all the other GCF's defragged fine.
+
I created rpm packages for openSuSE 11.1 (and 11.0)
here + are repos: http://download.opensuse.org/repositories/home:/etamPL/
+
+ I separated this in 3 packages: libhl2, libhl2-devel, HLExtract
+
I try to use HLLib with MinGW compiler, but I have this + error:
C:\...\HLLib.h|740|error: 'HANDLE' does not name a type
Where is normally defined + HANDLE ?
EDIT 1: I have added this lines at the begin of HLLib.h, and now HANDLE is + ok:
#ifdef _WIN32
# include <windows.h>
#endif
EDIT 2: Now I've several + error with linker such as:
undefined reference to `HLLib::CPackage::GetRoot()'
The linker + finds HLLib.lib, but the c++ function are unknown (I use directly the c++ class and + functions)
EDIT 3: A solution, but it's ugly, it's to include all files from source in my + project. It compiles and links correctly :)
+ ============================================
+
+ Another problem : in the main.c of HLExtract, it's hl.h that is included (line 20), but it doesn't + exist. What is hl.h ?
+
+ Thank.
+
+
# include "..\lib\HLLib.h"
# ifdef _MSC_VER
# pragma + comment(lib, "../../../lib/HLLib.lib")
# endif
#else
# include <hl.h>
#endif
+ Including Windows.h before HLLib.h should work fine without modifying any HLLib files.
+
+ If you aren't using Visual Studio, you should build your own .lib and .dll. +
+
+
+
+
+ +