SavannahLion of HLPD has ported my HLLib library to Linux. The port has been dubbed libhl and + contains a HLExtract clone Slatch.
+ + Download: + +-
+
- HLPD + +
+
+
+
+
+ http://twoday.tuwien.ac.at/pub/files/hllib-cmake
+
+ Usage:
+ unzip hllib242.zip
+ unzip hllib-cmake.zip
+ mkdir HLLib-build
+ cd HLLib-build
+ cmake -DCMAKE_INSTALL_PREFIX=/usr ../HLLib
+ make -j2 && sudo make install
+ sudo ldconfig # <- don't know if this is really needed
+ mkdir HLExtract-build
+ cmake -DCMAKE_INSTALL_PREFIX=/usr ../HLExtract
+ make -j2 && sudo make install
+
+ If you install HLLib somewhere else than /usr also pass -DCMAKE_MODULE_PATH=$PREFIX/cmake/modules to the + second cmake call.
+
+ This installs following files into your $CMAKE_INSTALL_PATH:
+ lib/libhllib.so
+ lib/libhllib.so.2.3.0
+ include/hllib/hl.h
+ bin/hlextract
+
+ Note: There are many warnings when compiling HLLib. Some of them seem to me potentially serious (using + uninitialized variables, crazy casts and such). Maybe someone should take a look at that. Maybe they + aren't really serious.
+
When I ran 'make -j2 && sudo make install' I got the + error:
CMake Error at cmake_install.cmake:56 (FILE):
file INSTALL cannot find + "/Users/acidking/HLLib/../lib/HLLib.h
So I tried to edit 'HLLib-build/cmake_install.cmake', + to correct the path:
HLLib/../lib/HLLib.h
to
HLLib/HLLib.h
It worked, + and then when I ran 'cmake -DCMAKE_INSTALL_PREFIX=/usr ../HLExtract', I got this error:
CMake + Error: The source "/Users/acidking/HLExtract/CMakeLists.txt" does not match the source + "/Users/acidking/HLLib/CMakeLists.txt" used to generate cache. Re-run cmake with a different source + directory.
+
+ What could be the problem?
+
+
+ We are currently using hlextract to get bsp's from both the
+ half-life.gcf and the opposing force.gcf
+ hlextract is called from two batch files in the svencoop folder
+ Install_HLSP_Support.bat
+ Install_OpFor_Support
+
+ We released a beta Linux server for svencoop 4.6
+ Would like to write a shell script that will help server operators install HLSP and OpFor support in + Linux
+
+ HLExtract using HLLib v2.3.0
+ Is there a newer version?
+ Is there a Linux version of HLExtract?
+
+ Thank You,
+
+
I made a git mirror here and started fixing compile errors you get when + you compile with -Wall -Wextra -pedantic -Werror:
https://github.com/panzi/HLLib
Summary + of my fixes so far:
lpOffsets[i] cannot be -1, did you want to compare to the maximum value (i.e. + (hlULongLong)-1)?:
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/BSPFile.cpp#L111
uiLength + cannot be less than 0:
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/Error.cpp#L142
iMode + might be used uninitialized:
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/FileMapping.cpp#L152
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/FileStream.cpp#L102
there + is no long long type in standard C++ (I changed it to int64_t):
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/stdafx.h#L43
'SGAHeader' + was not declared in this scope:
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/SGAFile.cpp#L304
Should + it be CSGASpecializedDirectory::SGAHeader or TSGAHeader?
standard C++ can't cast between data and + function pointers, but there is a trick how to do it anyway:
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/HLLib.cpp#L432
+
+ Also I added "default: break;" to every switch statement that does not enumerate all enum values (or + else it won't compile with the given flags).
+
+ The flags also disallow unused parameters. I explicitly silenced those by adding "(void)param;" (creates + no extra binary code).
+
+
+ The error about SGAHeader is a bit concerning and kinda stops me from fixing more errors. What was meant + here?
+
dereferencing type-punned pointer will break strict-aliasing + rules:
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/VBSPFile.cpp#L444
Also + I think it's not endian-safe. So I do this instead:
+
#define HL_FOURCC_TO_UINT(FOURCC) (hlUInt)(FOURCC[0] | FOURCC[1] << 8 | + FOURCC[2] << 16 | FOURCC[3] << 24)
const hlChar *lpFourCC = + this->pHeader->lpLumps[uiID].lpFourCC;
hlAttributeSetUnsignedInteger(&Attribute, + this->lpItemAttributeNames[eAttribute], HL_FOURCC_TO_UINT(lpFourCC), hlTrue);
+
+
+ I also do a similar thing for sprintf => snprintf.
+
+
+ I could change it to some hlSSize type that has the appropriate size on all platforms (hlULong would not + be fine on 32bit Linux plus -D_FILE_OFFSET_BITS=64). Shall I? It would break binary (and I guess also + source) compatibility with existing Linux code using HLLib (I wouldn't change it for Windows because I + can't test it under Windows).
+
https://github.com/panzi/HLLib/blob/ba88548a1d3b0b32a89370e7e477eeb4ca245530/HLLib/NCFFile.cpp#L582 +
+
+
static CPackage *CPackage::AutoOpen(Streams::IStream &Stream, hlUInt + uiMode);
static CPackage *CPackage::AutoOpen(Mapping::CMapping &Mapping, hlUInt + uiMode);
static CPackage *CPackage::AutoOpen(const hlChar *lpFileName, hlUInt uiMode);
static + CPackage *CPackage::AutoOpen(hlVoid *lpData, hlUInt uiBufferSize, hlUInt uiMode);
static CPackage + *CPackage::AutoOpen(hlVoid *pUserData, hlUInt uiMode);
Don't know about the + name.
diff:
https://github.com/panzi/HLLib/commit/755dc105ce5d0a28b353590671e9077141d5d3bc +
+
+
static CPackage *CPackage::Open(Streams::IStream &Stream, hlUInt uiMode, + HLPackageType ePackageType);
static CPackage *CPackage::Open(Mapping::CMapping &Mapping, hlUInt + uiMode, HLPackageType ePackageType);
static CPackage *CPackage::Open(const hlChar *lpFileName, + hlUInt uiMode, HLPackageType ePackageType);
static CPackage *CPackage::Open(hlVoid *lpData, hlUInt + uiBufferSize, hlUInt uiMode, HLPackageType ePackageType);
static CPackage *CPackage::Open(hlVoid + *pUserData, hlUInt uiMode, HLPackageType ePackageType);
I use one of them in hlfs, a fuse file + system that uses HLLib. :) +
+
Tried to build HLLib on my Ubuntu box, but gcc or g++ compiler thingy + or whatever... (just to give you an idea of how well I understand C and derivatives) complains about one + of the files> SGAFile.h
So I run the following from /opt/HLLibTools where extracted and I + get:
+
$ sudo make -C HLLib Makefile install
make: Entering directory + `/opt/HLLibTools/HLLib'
make: Nothing to be done for `Makefile'.
g++ -c -O2 -g -fpic + -funroll-loops -fvisibility=hidden -o Wrapper.o Wrapper.cpp
In file included from + Packages.h:17:0,
from Wrapper.cpp:16:
SGAFile.h:279:3: error: a class-key must be used when + declaring a friend
SGAFile.h:279:3: error: friend declaration does not name a class or + function
SGAFile.h:280:3: error: a class-key must be used when declaring a + friend
SGAFile.h:280:3: error: friend declaration does not name a class or + function
SGAFile.h:281:3: error: a class-key must be used when declaring a + friend
SGAFile.h:281:3: error: friend declaration does not name a class or + function
SGAFile.h:282:3: error: a class-key must be used when declaring a + friend
SGAFile.h:282:3: error: friend declaration does not name a class or function
make: *** + [Wrapper.o] Error 1
make: Leaving directory `/opt/HLLibTools/HLLib'
$
Some + reading suggests that while this will get by most C++ compilers, GCC or G++ or whatever will not allow + it and requires class to be declared, but if I add the line
Checked some other *File.h files for reference but none + seem to have any friends ;) pun!
I'm probably doing something wrong, but if someone could take a + look I would much appreciate it. Have included the culprits here:
+
typedef CSGADirectory<SGAHeader4, SGADirectoryHeader4, SGASection4, + SGAFolder4, SGAFile4> CSGADirectory4;
typedef CSGADirectory<SGAHeader4, SGADirectoryHeader5, + SGASection5, SGAFolder5, SGAFile4> CSGADirectory5;
typedef CSGADirectory<SGAHeader6, + SGADirectoryHeader5, SGASection5, SGAFolder5, SGAFile6> CSGADirectory6;
typedef + CSGADirectory<SGAHeader6, SGADirectoryHeader7, SGASection5, SGAFolder5, SGAFile7> + CSGADirectory7;
friend CSGADirectory4;
friend CSGADirectory5;
friend + CSGADirectory6;
friend CSGADirectory7;
+
+ cheers guys, I'm of to bed. +
+
+ My version compiles with very strict compiler flags without warnings (last time I checked). I hoped my + changes would be merged some day, but I didn't get an answer.
+ +