update HLLib to 2.4.3

This commit is contained in:
Ondřej Hošek 2012-12-11 03:02:11 +01:00
parent ad62011f36
commit 8473d547ed
20 changed files with 1498 additions and 148 deletions

View File

@ -1,6 +1,6 @@
/* /*
* HLExtract.Net * HLExtract.Net
* Copyright (C) 2008-2010 Ryan Gregg * Copyright (C) 2008-2012 Ryan Gregg
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -19,8 +19,8 @@ using System.Runtime.InteropServices;
public sealed class HLLib public sealed class HLLib
{ {
#region Constants #region Constants
public const int HL_VERSION_NUMBER = ((2 << 24) | (4 << 16) | (2 << 8) | 0); public const int HL_VERSION_NUMBER = ((2 << 24) | (4 << 16) | (3 << 8) | 0);
public const string HL_VERSION_STRING = "2.4.2"; public const string HL_VERSION_STRING = "2.4.3";
public const uint HL_ID_INVALID = 0xffffffff; public const uint HL_ID_INVALID = 0xffffffff;
@ -143,7 +143,8 @@ public sealed class HLLib
HL_PACKAGE_XZP, HL_PACKAGE_XZP,
HL_PACKAGE_ZIP, HL_PACKAGE_ZIP,
HL_PACKAGE_NCF, HL_PACKAGE_NCF,
HL_PACKAGE_VPK HL_PACKAGE_VPK,
HL_PACKAGE_SGA
} }
public enum HLAttributeType : uint public enum HLAttributeType : uint
@ -194,6 +195,19 @@ public sealed class HLLib
HL_PAK_PACKAGE_COUNT = 0, HL_PAK_PACKAGE_COUNT = 0,
HL_PAK_ITEM_COUNT = 0, HL_PAK_ITEM_COUNT = 0,
HL_SGA_PACKAGE_VERSION_MAJOR = 0,
HL_SGA_PACKAGE_VERSION_MINOR,
HL_SGA_PACKAGE_MD5_FILE,
HL_SGA_PACKAGE_NAME,
HL_SGA_PACKAGE_MD5_HEADER,
HL_SGA_PACKAGE_COUNT,
HL_SGA_ITEM_SECTION_ALIAS = 0,
HL_SGA_ITEM_SECTION_NAME,
HL_SGA_ITEM_MODIFIED,
HL_SGA_ITEM_TYPE,
HL_SGA_ITEM_CRC,
HL_SGA_ITEM_COUNT,
HL_VBSP_PACKAGE_VERSION = 0, HL_VBSP_PACKAGE_VERSION = 0,
HL_VBSP_PACKAGE_MAP_REVISION, HL_VBSP_PACKAGE_MAP_REVISION,
HL_VBSP_PACKAGE_COUNT, HL_VBSP_PACKAGE_COUNT,

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HLExtract.Net")] [assembly: AssemblyProduct("HLExtract.Net")]
[assembly: AssemblyCopyright("Copyright (C) 2008-2011 Ryan Gregg")] [assembly: AssemblyCopyright("Copyright (C) 2008-2012 Ryan Gregg")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.4.2.0")] [assembly: AssemblyVersion("2.4.3.0")]
[assembly: AssemblyFileVersion("2.4.2.0")] [assembly: AssemblyFileVersion("2.4.3.0")]

View File

@ -13,13 +13,11 @@
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252) #pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -53,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,4,2,0 FILEVERSION 2,4,3,0
PRODUCTVERSION 2,4,2,0 PRODUCTVERSION 2,4,3,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -71,12 +69,12 @@ BEGIN
BEGIN BEGIN
VALUE "Comments", "Half-Life Package Extraction Utility" VALUE "Comments", "Half-Life Package Extraction Utility"
VALUE "FileDescription", "HLExtract Application" VALUE "FileDescription", "HLExtract Application"
VALUE "FileVersion", "2.4.2" VALUE "FileVersion", "2.4.3"
VALUE "InternalName", "HLExtract" VALUE "InternalName", "HLExtract"
VALUE "LegalCopyright", "Copyright (C) 2006-2011 Ryan Gregg" VALUE "LegalCopyright", "Copyright (C) 2006-2012 Ryan Gregg"
VALUE "OriginalFilename", "HLExtract.exe" VALUE "OriginalFilename", "HLExtract.exe"
VALUE "ProductName", " HLExtract Application" VALUE "ProductName", " HLExtract Application"
VALUE "ProductVersion", "2.4.2" VALUE "ProductVersion", "2.4.3"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -85,7 +83,7 @@ BEGIN
END END
END END
#endif // English (U.S.) resources #endif // English (United States) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -678,7 +678,11 @@ hlBool CDirectoryFolder::Extract(const hlChar *lpPath) const
for(hlUInt i = 0; i < this->pDirectoryItemVector->size(); i++) for(hlUInt i = 0; i < this->pDirectoryItemVector->size(); i++)
{ {
bResult &= (*this->pDirectoryItemVector)[i]->Extract(lpFolderName); const CDirectoryItem *pItem = (*this->pDirectoryItemVector)[i];
if(pItem->GetType() != HL_ITEM_FILE || static_cast<const CDirectoryFile *>(pItem)->GetExtractable())
{
bResult &= pItem->Extract(lpFolderName);
}
} }
} }

View File

@ -13,13 +13,11 @@
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252) #pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -53,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,4,2,0 FILEVERSION 2,4,3,0
PRODUCTVERSION 2,4,2,0 PRODUCTVERSION 2,4,3,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -71,12 +69,12 @@ BEGIN
BEGIN BEGIN
VALUE "Comments", "Half-Life Package Library" VALUE "Comments", "Half-Life Package Library"
VALUE "FileDescription", "HLLib Dynamic Link Library" VALUE "FileDescription", "HLLib Dynamic Link Library"
VALUE "FileVersion", "2.4.2" VALUE "FileVersion", "2.4.3"
VALUE "InternalName", "HLLib" VALUE "InternalName", "HLLib"
VALUE "LegalCopyright", "Copyright (C) 2006-2011 Ryan Gregg" VALUE "LegalCopyright", "Copyright (C) 2006-2012 Ryan Gregg"
VALUE "OriginalFilename", "HLLib.dll" VALUE "OriginalFilename", "HLLib.dll"
VALUE "ProductName", " HLLib Dynamic Link Library" VALUE "ProductName", " HLLib Dynamic Link Library"
VALUE "ProductVersion", "2.4.2" VALUE "ProductVersion", "2.4.3"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -85,7 +83,7 @@ BEGIN
END END
END END
#endif // English (U.S.) resources #endif // English (United States) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -14,6 +14,7 @@
#include "GCFFile.h" #include "GCFFile.h"
#include "NCFFile.h" #include "NCFFile.h"
#include "PAKFile.h" #include "PAKFile.h"
#include "SGAFile.h"
#include "VBSPFile.h" #include "VBSPFile.h"
#include "VPKFile.h" #include "VPKFile.h"
#include "WADFile.h" #include "WADFile.h"

627
HLLib/SGAFile.cpp Normal file
View File

@ -0,0 +1,627 @@
/*
* HLLib
* Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later
* version.
*/
#include "HLLib.h"
#include "SGAFile.h"
#include "Streams.h"
#include "Checksum.h"
#include "Utility.h"
#if USE_ZLIB
# ifdef _WIN32
# define ZLIB_WINAPI
# endif
# include <zlib.h>
#endif
using namespace HLLib;
#define HL_SGA_CHECKSUM_LENGTH 0x00008000
const char *CSGAFile::lpAttributeNames[] = { "Major Version", "Minor Version", "File MD5", "Name", "Header MD5" };
const char *CSGAFile::lpItemAttributeNames[] = { "Section Alias", "Section Name", "Modified", "Type", "CRC" };
CSGAFile::CSGAFile() : CPackage(), pHeaderView(0), pHeader(0), pDirectory(0)
{
}
CSGAFile::~CSGAFile()
{
this->Close();
}
HLPackageType CSGAFile::GetType() const
{
return HL_PACKAGE_SGA;
}
const hlChar *CSGAFile::GetExtension() const
{
return "sga";
}
const hlChar *CSGAFile::GetDescription() const
{
return "Archive File";
}
hlBool CSGAFile::MapDataStructures()
{
if(sizeof(SGAHeader) > this->pMapping->GetMappingSize())
{
LastError.SetErrorMessage("Invalid file: the file map is too small for it's header.");
return hlFalse;
}
if(!this->pMapping->Map(this->pHeaderView, 0, sizeof(SGAHeader)))
{
return hlFalse;
}
this->pHeader = static_cast<const SGAHeader *>(this->pHeaderView->GetView());
if(memcmp(this->pHeader->lpSignature, "_ARCHIVE", 8) != 0)
{
LastError.SetErrorMessage("Invalid file: the file's signature does not match.");
return hlFalse;
}
if((this->pHeader->uiMajorVersion != 4 || this->pHeader->uiMinorVersion != 0) && (this->pHeader->uiMajorVersion != 5 || this->pHeader->uiMinorVersion != 0))
{
LastError.SetErrorMessageFormated("Invalid SGA version (v%hu.%hu): you have a version of a SGA file that HLLib does not know how to read. Check for product updates.", this->pHeader->uiMajorVersion, this->pHeader->uiMinorVersion);
return hlFalse;
}
if(this->pHeader->uiHeaderLength > this->pMapping->GetMappingSize())
{
LastError.SetErrorMessage("Invalid file: the file map is too small for it's extended header.");
return hlFalse;
}
switch(this->pHeader->uiMajorVersion)
{
case 4:
this->pDirectory = new CSGADirectory4(*this);
break;
case 5:
this->pDirectory = new CSGADirectory5(*this);
break;
default:
assert(false);
return hlFalse;
}
if(!this->pDirectory->MapDataStructures())
{
return hlFalse;
}
return hlTrue;
}
hlVoid CSGAFile::UnmapDataStructures()
{
delete this->pDirectory;
this->pDirectory = 0;
this->pHeader = 0;
this->pMapping->Unmap(this->pHeaderView);
}
CDirectoryFolder *CSGAFile::CreateRoot()
{
return this->pDirectory->CreateRoot();
}
hlBool CSGAFile::GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackageAttribute eAttribute, HLAttribute &Attribute) const
{
return this->pDirectory->GetItemAttributeInternal(pItem, eAttribute, Attribute);
}
hlBool CSGAFile::GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool &bExtractable) const
{
return this->pDirectory->GetFileExtractableInternal(pFile, bExtractable);
}
hlBool CSGAFile::GetFileValidationInternal(const CDirectoryFile *pFile, HLValidation &eValidation) const
{
return this->pDirectory->GetFileValidationInternal(pFile, eValidation);
}
hlBool CSGAFile::GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const
{
return this->pDirectory->GetFileSizeInternal(pFile, uiSize);
}
hlBool CSGAFile::GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const
{
return this->pDirectory->GetFileSizeOnDiskInternal(pFile, uiSize);
}
hlBool CSGAFile::CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const
{
return this->pDirectory->CreateStreamInternal(pFile, pStream);
}
hlVoid CSGAFile::ReleaseStreamInternal(Streams::IStream &Stream) const
{
return this->pDirectory->ReleaseStreamInternal(Stream);
}
hlUInt CSGAFile::GetAttributeCountInternal() const
{
return HL_SGA_PACKAGE_COUNT;
}
const hlChar *CSGAFile::GetAttributeNameInternal(HLPackageAttribute eAttribute) const
{
if(eAttribute < HL_SGA_PACKAGE_COUNT)
{
return this->lpAttributeNames[eAttribute];
}
return 0;
}
hlBool CSGAFile::GetAttributeInternal(HLPackageAttribute eAttribute, HLAttribute &Attribute) const
{
hlChar lpBuffer[64];
switch(eAttribute)
{
case HL_SGA_PACKAGE_VERSION_MAJOR:
hlAttributeSetUnsignedInteger(&Attribute, this->lpAttributeNames[eAttribute], this->pHeader->uiMajorVersion, hlFalse);
return hlTrue;
case HL_SGA_PACKAGE_VERSION_MINOR:
hlAttributeSetUnsignedInteger(&Attribute, this->lpAttributeNames[eAttribute], this->pHeader->uiMinorVersion, hlFalse);
return hlTrue;
case HL_SGA_PACKAGE_MD5_FILE:
BufferToHexString(this->pHeader->lpFileMD5, 16, lpBuffer, sizeof(lpBuffer));
hlAttributeSetString(&Attribute, this->lpAttributeNames[eAttribute], lpBuffer);
return hlTrue;
case HL_SGA_PACKAGE_NAME:
WStringToString(this->pHeader->lpName, lpBuffer, sizeof(lpBuffer));
hlAttributeSetString(&Attribute, this->lpAttributeNames[eAttribute], lpBuffer);
return hlTrue;
case HL_SGA_PACKAGE_MD5_HEADER:
BufferToHexString(this->pHeader->lpHeaderMD5, 16, lpBuffer, sizeof(lpBuffer));
hlAttributeSetString(&Attribute, this->lpAttributeNames[eAttribute], lpBuffer);
return hlTrue;
default:
return hlFalse;
}
}
hlUInt CSGAFile::GetItemAttributeCountInternal() const
{
return HL_SGA_ITEM_COUNT;
}
const hlChar *CSGAFile::GetItemAttributeNameInternal(HLPackageAttribute eAttribute) const
{
if(eAttribute < HL_SGA_ITEM_COUNT)
{
return this->lpItemAttributeNames[eAttribute];
}
return 0;
}
CSGAFile::ISGADirectory::~ISGADirectory()
{
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::CSGADirectory(CSGAFile& File) : File(File), pHeaderDirectoryView(0), pDirectoryHeader(0), lpSections(0), lpFolders(0), lpFiles(0), lpStringTable(0)
{
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::~CSGADirectory()
{
this->UnmapDataStructures();
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlBool CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::MapDataStructures()
{
if(!this->File.pMapping->Map(this->pHeaderDirectoryView, sizeof(SGAHeader), this->File.pHeader->uiHeaderLength))
{
return hlFalse;
}
this->pDirectoryHeader = static_cast<const TSGADirectoryHeader *>(this->pHeaderDirectoryView->GetView());
if(this->pDirectoryHeader->uiSectionCount > 0 && this->pDirectoryHeader->uiSectionOffset + sizeof(TSGASection) * this->pDirectoryHeader->uiSectionCount > this->File.pHeader->uiHeaderLength)
{
LastError.SetErrorMessage("Invalid file: the file map is too small for section data.");
return hlFalse;
}
if(this->pDirectoryHeader->uiFolderCount > 0 && this->pDirectoryHeader->uiFolderOffset + sizeof(TSGAFolder) * this->pDirectoryHeader->uiFolderCount > this->File.pHeader->uiHeaderLength)
{
LastError.SetErrorMessage("Invalid file: the file map is too small for folder data.");
return hlFalse;
}
if(this->pDirectoryHeader->uiFileCount > 0 && this->pDirectoryHeader->uiFileOffset + sizeof(TSGAFile) * this->pDirectoryHeader->uiFileCount > this->File.pHeader->uiHeaderLength)
{
LastError.SetErrorMessage("Invalid file: the file map is too small for file data.");
return hlFalse;
}
if(this->pDirectoryHeader->uiStringTableOffset > this->File.pHeader->uiHeaderLength)
{
LastError.SetErrorMessage("Invalid file: the file map is too small for string table data.");
return hlFalse;
}
this->lpSections = reinterpret_cast<const TSGASection *>(reinterpret_cast<const hlByte *>(this->pDirectoryHeader) + this->pDirectoryHeader->uiSectionOffset);
this->lpFolders = reinterpret_cast<const TSGAFolder *>(reinterpret_cast<const hlByte *>(this->pDirectoryHeader) + this->pDirectoryHeader->uiFolderOffset);
this->lpFiles = reinterpret_cast<const TSGAFile *>(reinterpret_cast<const hlByte *>(this->pDirectoryHeader) + this->pDirectoryHeader->uiFileOffset);
this->lpStringTable = reinterpret_cast<const hlChar *>(reinterpret_cast<const hlByte *>(this->pDirectoryHeader) + this->pDirectoryHeader->uiStringTableOffset);
return hlTrue;
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlVoid CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::UnmapDataStructures()
{
this->pDirectoryHeader = 0;
this->lpSections = 0;
this->lpFolders = 0;
this->lpFiles = 0;
this->lpStringTable = 0;
this->File.pMapping->Unmap(this->pHeaderDirectoryView);
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
CDirectoryFolder *CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::CreateRoot()
{
CDirectoryFolder *pRoot = new CDirectoryFolder(&File);
for(hlUInt i = 0; i < this->pDirectoryHeader->uiSectionCount; i++)
{
CDirectoryFolder* pSection;
// Check if folder exists.
CDirectoryItem *pItem = pRoot->GetItem(this->lpSections[i].lpAlias);
if(pItem == 0 || pItem->GetType() == HL_ITEM_FILE)
{
// It doesn't, create it.
pSection = pRoot->AddFolder(this->lpSections[i].lpAlias);
}
else
{
// It does, use it.
pSection = static_cast<CDirectoryFolder *>(pItem);
}
this->CreateFolder(pSection, this->lpSections[i].uiFolderRootIndex);
}
return pRoot;
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlVoid CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::CreateFolder(CDirectoryFolder *pParent, hlUInt uiFolderIndex)
{
const hlChar* lpName = this->lpStringTable + this->lpFolders[uiFolderIndex].uiNameOffset;
if(*lpName != '\0')
{
// Strip parent folder names.
const hlChar* lpTemp = strrchr(lpName, '/');
if(lpTemp != 0)
{
lpName = lpTemp + 1;
}
lpTemp = strrchr(lpName, '\\');
if(lpTemp != 0)
{
lpName = lpTemp + 1;
}
// Check if folder exists.
CDirectoryItem *pItem = pParent->GetItem(lpName);
if(pItem == 0 || pItem->GetType() == HL_ITEM_FILE)
{
// It doesn't, create it.
pParent = pParent->AddFolder(lpName);
}
else
{
// It does, use it.
pParent = static_cast<CDirectoryFolder *>(pItem);
}
}
for(hlUInt i = this->lpFolders[uiFolderIndex].uiFolderStartIndex; i < this->lpFolders[uiFolderIndex].uiFolderEndIndex; i++)
{
CreateFolder(pParent, i);
}
for(hlUInt i = this->lpFolders[uiFolderIndex].uiFileStartIndex; i < this->lpFolders[uiFolderIndex].uiFileEndIndex; i++)
{
const hlChar* lpName = this->lpStringTable + this->lpFiles[i].uiNameOffset;
pParent->AddFile(lpName, i);
}
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlBool CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackageAttribute eAttribute, HLAttribute &Attribute) const
{
if(pItem->GetID() != HL_ID_INVALID)
{
switch(pItem->GetType())
{
case HL_ITEM_FOLDER:
{
const CDirectoryFolder *pFolder = static_cast<const CDirectoryFolder *>(pItem);
switch(eAttribute)
{
case HL_SGA_ITEM_SECTION_ALIAS:
{
for(hlUInt i = 0; i < this->pDirectoryHeader->uiSectionCount; i++)
{
if(pFolder->GetID() >= this->lpSections[i].uiFolderStartIndex && pFolder->GetID() < this->lpSections[i].uiFolderEndIndex)
{
hlAttributeSetString(&Attribute, CSGAFile::lpItemAttributeNames[eAttribute], this->lpSections[i].lpAlias);
return hlTrue;
}
}
return hlFalse;
}
case HL_SGA_ITEM_SECTION_NAME:
{
for(hlUInt i = 0; i < this->pDirectoryHeader->uiSectionCount; i++)
{
if(pFolder->GetID() >= this->lpSections[i].uiFolderStartIndex && pFolder->GetID() < this->lpSections[i].uiFolderEndIndex)
{
hlAttributeSetString(&Attribute, CSGAFile::lpItemAttributeNames[eAttribute], this->lpSections[i].lpName);
return hlTrue;
}
}
return hlFalse;
}
}
break;
}
case HL_ITEM_FILE:
{
const CDirectoryFile *pFile = static_cast<const CDirectoryFile *>(pItem);
const TSGAFile &File = this->lpFiles[pFile->GetID()];
switch(eAttribute)
{
case HL_SGA_ITEM_SECTION_ALIAS:
{
for(hlUInt i = 0; i < this->pDirectoryHeader->uiSectionCount; i++)
{
if(pFile->GetID() >= this->lpSections[i].uiFileStartIndex && pFile->GetID() < this->lpSections[i].uiFileEndIndex)
{
hlAttributeSetString(&Attribute, CSGAFile::lpItemAttributeNames[eAttribute], this->lpSections[i].lpAlias);
return hlTrue;
}
}
return hlFalse;
}
case HL_SGA_ITEM_SECTION_NAME:
{
for(hlUInt i = 0; i < this->pDirectoryHeader->uiSectionCount; i++)
{
if(pFile->GetID() >= this->lpSections[i].uiFileStartIndex && pFile->GetID() < this->lpSections[i].uiFileEndIndex)
{
hlAttributeSetString(&Attribute, CSGAFile::lpItemAttributeNames[eAttribute], this->lpSections[i].lpName);
return hlTrue;
}
}
return hlFalse;
}
case HL_SGA_ITEM_MODIFIED:
{
time_t Time = (time_t)File.uiTimeModified;
tm *pTime = localtime(&Time);
hlChar lpTime[128];
strftime(lpTime, sizeof(lpTime), "%c", pTime);
hlAttributeSetString(&Attribute, CSGAFile::lpItemAttributeNames[eAttribute], lpTime);
return hlTrue;
}
case HL_SGA_ITEM_TYPE:
{
hlAttributeSetUnsignedInteger(&Attribute, CSGAFile::lpItemAttributeNames[eAttribute], File.uiType, hlFalse);
return hlTrue;
}
case HL_SGA_ITEM_CRC:
{
Mapping::CView *pFileHeaderView = 0;
if(this->File.pMapping->Map(pFileHeaderView, this->File.pHeader->uiFileDataOffset + File.uiOffset - sizeof(TSGAFileHeader), sizeof(TSGAFileHeader)))
{
const TSGAFileHeader* pFileHeader = static_cast<const TSGAFileHeader *>(pFileHeaderView->GetView());
hlAttributeSetUnsignedInteger(&Attribute, CSGAFile::lpItemAttributeNames[eAttribute], pFileHeader->uiCRC32, hlTrue);
this->File.pMapping->Unmap(pFileHeaderView);
return hlTrue;
}
return hlFalse;
}
}
break;
}
}
}
return hlFalse;
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlBool CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool &bExtractable) const
{
#if !USE_ZLIB
const TSGAFile &File = this->lpFiles[pFile->GetID()];
bExtractable = File.uiType == 0;
#else
bExtractable = true;
#endif
return hlTrue;
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlBool CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::GetFileValidationInternal(const CDirectoryFile *pFile, HLValidation &eValidation) const
{
const TSGAFile &File = this->lpFiles[pFile->GetID()];
#if !USE_ZLIB
if(File.uiType != 0)
{
eValidation = HL_VALIDATES_ASSUMED_OK;
return hlTrue;
}
#endif
Mapping::CView *pFileHeaderDataView = 0;
if(this->File.pMapping->Map(pFileHeaderDataView, this->File.pHeader->uiFileDataOffset + File.uiOffset - sizeof(TSGAFileHeader), File.uiSizeOnDisk + sizeof(TSGAFileHeader)))
{
hlULong uiChecksum = 0;
const TSGAFileHeader* pFileHeader = static_cast<const TSGAFileHeader*>(pFileHeaderDataView->GetView());
const hlByte* lpBuffer = reinterpret_cast<const hlByte *>(pFileHeader) + sizeof(TSGAFileHeader);
#if USE_ZLIB
hlByte *lpInflateBuffer = 0;
if(File.uiType != 0)
{
lpInflateBuffer = new hlByte[File.uiSize];
uLongf iInflateSize = File.uiSize;
switch(uncompress(lpInflateBuffer, &iInflateSize, lpBuffer, static_cast<uLong>(File.uiSizeOnDisk)))
{
case Z_OK:
lpBuffer = lpInflateBuffer;
break;
default:
delete []lpInflateBuffer;
lpInflateBuffer = 0;
eValidation = HL_VALIDATES_ERROR;
break;
}
}
if(File.uiType == 0 || lpInflateBuffer != 0)
#endif
{
hlULongLong uiTotalBytes = 0, uiFileBytes = File.uiSize;
hlBool bCancel = hlFalse;
hlValidateFileProgress(const_cast<CDirectoryFile *>(pFile), uiTotalBytes, uiFileBytes, &bCancel);
while(uiTotalBytes < uiFileBytes)
{
if(bCancel)
{
eValidation = HL_VALIDATES_CANCELED;
break;
}
hlUInt uiBufferSize = static_cast<hlUInt>(uiTotalBytes + HL_SGA_CHECKSUM_LENGTH <= uiFileBytes ? HL_SGA_CHECKSUM_LENGTH : uiFileBytes - uiTotalBytes);
uiChecksum = CRC32(lpBuffer, uiBufferSize, uiChecksum);
lpBuffer += uiBufferSize;
uiTotalBytes += static_cast<hlULongLong>(uiBufferSize);
hlValidateFileProgress(const_cast<CDirectoryFile *>(pFile), uiTotalBytes, uiFileBytes, &bCancel);
}
}
#if USE_ZLIB
delete []lpInflateBuffer;
#endif
eValidation = static_cast<hlULong>(pFileHeader->uiCRC32) == uiChecksum ? HL_VALIDATES_OK : HL_VALIDATES_CORRUPT;
this->File.pMapping->Unmap(pFileHeaderDataView);
}
else
{
eValidation = HL_VALIDATES_ERROR;
}
return hlTrue;
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlBool CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const
{
const TSGAFile &File = this->lpFiles[pFile->GetID()];
uiSize = File.uiSize;
return hlTrue;
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlBool CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const
{
const TSGAFile &File = this->lpFiles[pFile->GetID()];
uiSize = File.uiSizeOnDisk;
return hlTrue;
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlBool CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const
{
const TSGAFile &File = this->lpFiles[pFile->GetID()];
if(File.uiType == 0)
{
pStream = new Streams::CMappingStream(*this->File.pMapping, this->File.pHeader->uiFileDataOffset + File.uiOffset, File.uiSizeOnDisk);
return hlTrue;
}
else
{
#if USE_ZLIB
Mapping::CView *pFileDataView = 0;
if(this->File.pMapping->Map(pFileDataView, this->File.pHeader->uiFileDataOffset + File.uiOffset, File.uiSizeOnDisk))
{
hlBool bResult = hlFalse;
hlByte *lpInflateBuffer = new hlByte[File.uiSize];
uLongf iInflateSize = File.uiSize;
switch(uncompress(lpInflateBuffer, &iInflateSize, static_cast<const hlByte *>(pFileDataView->GetView()), (uLong)File.uiSizeOnDisk))
{
case Z_OK:
pStream = new Streams::CMemoryStream(lpInflateBuffer, iInflateSize);
bResult = hlTrue;
break;
case Z_MEM_ERROR:
delete []lpInflateBuffer;
LastError.SetErrorMessage("Deflate Error: Z_MEM_ERROR.");
break;
case Z_BUF_ERROR:
delete []lpInflateBuffer;
LastError.SetErrorMessage("Deflate Error: Z_BUF_ERROR.");
break;
case Z_DATA_ERROR:
delete []lpInflateBuffer;
LastError.SetErrorMessage("Deflate Error: Z_DATA_ERROR.");
break;
default:
delete []lpInflateBuffer;
LastError.SetErrorMessage("Deflate Error: Unknown.");
break;
}
this->File.pMapping->Unmap(pFileDataView);
return bResult;
}
#endif
return hlFalse;
}
}
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
hlVoid CSGAFile::CSGADirectory<TSGADirectoryHeader, TSGASection, TSGAFolder, TSGAFile, TSGAFileHeader>::ReleaseStreamInternal(Streams::IStream &Stream) const
{
if(Stream.GetType() == HL_STREAM_MEMORY)
{
delete []static_cast<const hlByte *>(static_cast<Streams::CMemoryStream &>(Stream).GetBuffer());
}
}

207
HLLib/SGAFile.h Normal file
View File

@ -0,0 +1,207 @@
/*
* HLLib
* Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later
* version.
*/
#ifndef SGAFILE_H
#define SGAFILE_H
#include "stdafx.h"
#include "Package.h"
namespace HLLib
{
class HLLIB_API CSGAFile : public CPackage
{
private:
#pragma pack(1)
struct SGAHeader
{
hlChar lpSignature[8];
hlUShort uiMajorVersion;
hlUShort uiMinorVersion;
hlByte lpFileMD5[16];
hlWChar lpName[64];
hlByte lpHeaderMD5[16];
hlUInt uiHeaderLength;
hlUInt uiFileDataOffset;
hlUInt uiDummy0;
};
template<typename T>
struct SGADirectoryHeader
{
hlUInt uiSectionOffset;
T uiSectionCount;
hlUInt uiFolderOffset;
T uiFolderCount;
hlUInt uiFileOffset;
T uiFileCount;
hlUInt uiStringTableOffset;
T uiStringTableCount;
};
typedef SGADirectoryHeader<hlUShort> SGADirectoryHeader4;
typedef SGADirectoryHeader<hlUInt> SGADirectoryHeader5;
template<typename T>
struct SGASection
{
hlChar lpAlias[64];
hlChar lpName[64];
T uiFolderStartIndex;
T uiFolderEndIndex;
T uiFileStartIndex;
T uiFileEndIndex;
T uiFolderRootIndex;
};
typedef SGASection<hlUShort> SGASection4;
typedef SGASection<hlUInt> SGASection5;
template<typename T>
struct SGAFolder
{
hlUInt uiNameOffset;
T uiFolderStartIndex;
T uiFolderEndIndex;
T uiFileStartIndex;
T uiFileEndIndex;
};
typedef SGAFolder<hlUShort> SGAFolder4;
typedef SGAFolder<hlUInt> SGAFolder5;
struct SGAFile
{
hlUInt uiNameOffset;
hlUInt uiOffset;
hlUInt uiSizeOnDisk;
hlUInt uiSize;
hlUInt uiTimeModified;
hlByte uiDummy0;
hlByte uiType;
};
struct SGAFileHeader
{
hlChar lpName[256];
hlUInt uiCRC32;
};
#pragma pack()
class ISGADirectory
{
public:
virtual ~ISGADirectory() = 0;
public:
virtual hlBool MapDataStructures() = 0;
virtual hlVoid UnmapDataStructures() = 0;
virtual CDirectoryFolder *CreateRoot() = 0;
virtual hlBool GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackageAttribute eAttribute, HLAttribute &Attribute) const = 0;
virtual hlBool GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool &bExtractable) const = 0;
virtual hlBool GetFileValidationInternal(const CDirectoryFile *pFile, HLValidation &eValidation) const = 0;
virtual hlBool GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const = 0;
virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const = 0;
virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const = 0;
virtual hlVoid ReleaseStreamInternal(Streams::IStream &Stream) const = 0;
};
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
class CSGADirectory : public ISGADirectory
{
public:
CSGADirectory(CSGAFile& File);
virtual ~CSGADirectory();
private:
CSGAFile& File;
Mapping::CView *pHeaderDirectoryView;
const TSGADirectoryHeader *pDirectoryHeader;
const TSGASection *lpSections;
const TSGAFolder *lpFolders;
const TSGAFile *lpFiles;
const hlChar *lpStringTable;
public:
virtual hlBool MapDataStructures();
virtual hlVoid UnmapDataStructures();
virtual CDirectoryFolder *CreateRoot();
virtual hlBool GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackageAttribute eAttribute, HLAttribute &Attribute) const;
virtual hlBool GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool &bExtractable) const;
virtual hlBool GetFileValidationInternal(const CDirectoryFile *pFile, HLValidation &eValidation) const;
virtual hlBool GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const;
virtual hlVoid ReleaseStreamInternal(Streams::IStream &Stream) const;
private:
hlVoid CreateFolder(CDirectoryFolder *pParent, hlUInt uiFolderIndex);
};
typedef CSGADirectory<SGADirectoryHeader4, SGASection4, SGAFolder4, SGAFile, SGAFileHeader> CSGADirectory4;
typedef CSGADirectory<SGADirectoryHeader5, SGASection5, SGAFolder5, SGAFile, SGAFileHeader> CSGADirectory5;
friend CSGADirectory4;
friend CSGADirectory5;
private:
static const char *lpAttributeNames[];
static const char *lpItemAttributeNames[];
Mapping::CView *pHeaderView;
const SGAHeader *pHeader;
ISGADirectory* pDirectory;
public:
CSGAFile();
virtual ~CSGAFile();
virtual HLPackageType GetType() const;
virtual const hlChar *GetExtension() const;
virtual const hlChar *GetDescription() const;
protected:
virtual hlBool MapDataStructures();
virtual hlVoid UnmapDataStructures();
virtual CDirectoryFolder *CreateRoot();
virtual hlUInt GetAttributeCountInternal() const;
virtual const hlChar *GetAttributeNameInternal(HLPackageAttribute eAttribute) const;
virtual hlBool GetAttributeInternal(HLPackageAttribute eAttribute, HLAttribute &Attribute) const;
virtual hlUInt GetItemAttributeCountInternal() const;
virtual const hlChar *GetItemAttributeNameInternal(HLPackageAttribute eAttribute) const;
virtual hlBool GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackageAttribute eAttribute, HLAttribute &Attribute) const;
virtual hlBool GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool &bExtractable) const;
virtual hlBool GetFileValidationInternal(const CDirectoryFile *pFile, HLValidation &eValidation) const;
virtual hlBool GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const;
virtual hlVoid ReleaseStreamInternal(Streams::IStream &Stream) const;
};
}
#endif

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -157,3 +157,61 @@ hlVoid HLLib::RemoveIllegalCharacters(hlChar *lpName)
} }
} }
} }
hlChar HLLib::NibbleToChar(hlByte uiNibble)
{
uiNibble &= 0x0F;
return uiNibble <= 9 ? '0' + static_cast<hlChar>(uiNibble) : 'A' + static_cast<hlChar>(uiNibble) - ('9' - '0' + 1);
}
hlUInt HLLib::BufferToHexString(const hlByte *lpBuffer, hlUInt uiBufferSize, hlChar* lpString, hlUInt uiStringSize)
{
hlUInt uiCharsWritten = (uiStringSize + 1) / 2;
for(hlUInt i = 0; i < uiBufferSize && uiStringSize > 2; i++)
{
*lpString++ = NibbleToChar(lpBuffer[i] >> 4);
uiStringSize--;
*lpString++ = NibbleToChar(lpBuffer[i]);
uiStringSize--;
}
if(uiStringSize > 0)
{
*lpString = '\0';
}
return uiCharsWritten;
}
hlUInt HLLib::WStringToString(const hlWChar *lpSource, hlChar* lpDest, hlUInt uiDestSize)
{
#ifdef _WIN32
int iResult = WideCharToMultiByte(CP_ACP, 0, lpSource, -1, lpDest, static_cast<int>(uiDestSize), NULL, NULL);
if(iResult > 0)
{
return static_cast<hlUInt>(iResult);
}
else if(uiDestSize > 0)
{
*lpDest = '\0';
return 1;
}
return 0;
#else
hlUInt uiCharsWritten = 0;
while(*lpSource != L'\0' && uiDestSize > 1)
{
if(*lpSource >= L' ' && *lpSource <= L'~')
{
*lpDest++ = static_cast<hlChar>(*lpSource++);
uiDestSize--;
uiCharsWritten++;
}
}
if(uiDestSize > 0)
{
*lpDest = '\0';
uiCharsWritten++;
}
return uiCharsWritten;
#endif
}

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -17,15 +17,19 @@
namespace HLLib namespace HLLib
{ {
hlBool GetFileExists(const hlChar *lpPath); extern hlBool GetFileExists(const hlChar *lpPath);
hlBool GetFolderExists(const hlChar *lpPath); extern hlBool GetFolderExists(const hlChar *lpPath);
hlBool GetFileSize(const hlChar *lpPath, hlUInt &uiFileSize); extern hlBool GetFileSize(const hlChar *lpPath, hlUInt &uiFileSize);
hlBool CreateFolder(const hlChar *lpPath); extern hlBool CreateFolder(const hlChar *lpPath);
hlVoid FixupIllegalCharacters(hlChar *lpName); extern hlVoid FixupIllegalCharacters(hlChar *lpName);
hlVoid RemoveIllegalCharacters(hlChar *lpName); extern hlVoid RemoveIllegalCharacters(hlChar *lpName);
extern hlChar NibbleToChar(hlByte uiNibble);
extern hlUInt BufferToHexString(const hlByte *lpBuffer, hlUInt uiBufferSize, hlChar* lpString, hlUInt uiStringSize);
extern hlUInt WStringToString(const hlWChar *lpSource, hlChar* lpDest, hlUInt uiDestSize);
} }
#endif #endif

View File

@ -97,7 +97,19 @@ hlBool CVPKFile::MapDataStructures()
} }
else else
{ {
if(this->pHeader->uiVersion > 2)
{
LastError.SetErrorMessageFormated("Invalid VPK version (v%u): you have a version of a VPK file that HLLib does not know how to read. Check for product updates.", this->pHeader->uiVersion);
return hlFalse;
}
lpViewData += sizeof(VPKHeader); lpViewData += sizeof(VPKHeader);
switch(this->pHeader->uiVersion)
{
case 2:
// Version two includes 4 more double words.
lpViewData += 4 * sizeof(hlUInt);
break;
}
lpViewDirectoryDataEnd = lpViewData + this->pHeader->uiDirectoryLength; lpViewDirectoryDataEnd = lpViewData + this->pHeader->uiDirectoryLength;
} }

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -513,6 +513,7 @@ HLPackageTest lpPackageTests[] =
{ HL_PACKAGE_GCF, 8, { 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 } }, { HL_PACKAGE_GCF, 8, { 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 } },
{ HL_PACKAGE_NCF, 8, { 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 } }, { HL_PACKAGE_NCF, 8, { 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 } },
{ HL_PACKAGE_PAK, 4, { 'P', 'A', 'C', 'K' } }, { HL_PACKAGE_PAK, 4, { 'P', 'A', 'C', 'K' } },
{ HL_PACKAGE_SGA, 8, { '_', 'A', 'R', 'C', 'H', 'I', 'V', 'E' } },
{ HL_PACKAGE_VBSP, 4, { 'V', 'B', 'S', 'P' } }, { HL_PACKAGE_VBSP, 4, { 'V', 'B', 'S', 'P' } },
{ HL_PACKAGE_VPK, 4, { 0x34, 0x12, 0xaa, 0x55 } }, { HL_PACKAGE_VPK, 4, { 0x34, 0x12, 0xaa, 0x55 } },
{ HL_PACKAGE_WAD, 4, { 'W', 'A', 'D', '3' } }, { HL_PACKAGE_WAD, 4, { 'W', 'A', 'D', '3' } },
@ -596,6 +597,9 @@ HLLIB_API hlBool hlCreatePackage(HLPackageType ePackageType, hlUInt *uiPackage)
case HL_PACKAGE_PAK: case HL_PACKAGE_PAK:
pNewPackage = new CPAKFile(); pNewPackage = new CPAKFile();
break; break;
case HL_PACKAGE_SGA:
pNewPackage = new CSGAFile();
break;
case HL_PACKAGE_VBSP: case HL_PACKAGE_VBSP:
pNewPackage = new CVBSPFile(); pNewPackage = new CVBSPFile();
break; break;

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -14,6 +14,69 @@
#include "Streams.h" #include "Streams.h"
#include "Checksum.h" #include "Checksum.h"
#if USE_ZLIB
# ifdef _WIN32
# define ZLIB_WINAPI
# endif
# include <zlib.h>
struct OutDesc
{
Bytef *dest;
uLongf destLen;
};
static unsigned in(void FAR *in_desc, unsigned char FAR * FAR *input)
{
return 0;
}
static int out(void FAR *out_desc, unsigned char FAR *ouput, unsigned len)
{
if(len <= ((OutDesc*)(out_desc))->destLen)
{
memcpy(((OutDesc*)(out_desc))->dest, ouput, len);
((OutDesc*)(out_desc))->dest += len;
((OutDesc*)(out_desc))->destLen -= len;
return 0;
}
return 1;
}
static int uncompressBack(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
{
z_stream stream;
int err;
stream.next_in = (Bytef*)source;
stream.avail_in = (uInt)sourceLen;
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
unsigned char window[32768];
err = inflateBackInit(&stream, 15, window);
if (err != Z_OK) return err;
OutDesc out_desc = { dest, *destLen };
err = inflateBack(&stream, in, 0, out, &out_desc);
if (err != Z_STREAM_END) {
inflateBackEnd(&stream);
if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
return Z_DATA_ERROR;
return err;
}
*destLen = *destLen - out_desc.destLen;
err = inflateBackEnd(&stream);
return err;
}
#endif
using namespace HLLib; using namespace HLLib;
#define HL_ZIP_LOCAL_FILE_HEADER_SIGNATURE 0x04034b50 #define HL_ZIP_LOCAL_FILE_HEADER_SIGNATURE 0x04034b50
@ -342,7 +405,18 @@ hlBool CZIPFile::GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool
{ {
const ZIPFileHeader *pDirectoryItem = static_cast<const ZIPFileHeader *>(pFile->GetData()); const ZIPFileHeader *pDirectoryItem = static_cast<const ZIPFileHeader *>(pFile->GetData());
bExtractable = pDirectoryItem->uiCompressionMethod == 0 && pDirectoryItem->uiDiskNumberStart == this->pEndOfCentralDirectoryRecord->uiNumberOfThisDisk; switch(pDirectoryItem->uiCompressionMethod)
{
case 0: // None.
#if USE_ZLIB
case 8: // Deflate.
#endif
bExtractable = (pDirectoryItem->uiFlags & 0x01u) == 0 && pDirectoryItem->uiDiskNumberStart == this->pEndOfCentralDirectoryRecord->uiNumberOfThisDisk;
break;
default:
bExtractable = hlFalse;
break;
}
return hlTrue; return hlTrue;
} }
@ -351,7 +425,8 @@ hlBool CZIPFile::GetFileValidationInternal(const CDirectoryFile *pFile, HLValida
{ {
const ZIPFileHeader *pDirectoryItem = static_cast<const ZIPFileHeader *>(pFile->GetData()); const ZIPFileHeader *pDirectoryItem = static_cast<const ZIPFileHeader *>(pFile->GetData());
if(pDirectoryItem->uiCompressionMethod != 0 || pDirectoryItem->uiDiskNumberStart != this->pEndOfCentralDirectoryRecord->uiNumberOfThisDisk) hlBool bExtractable = false;
if(!GetFileExtractableInternal(pFile, bExtractable) || !bExtractable)
{ {
eValidation = HL_VALIDATES_ASSUMED_OK; eValidation = HL_VALIDATES_ASSUMED_OK;
return hlTrue; return hlTrue;
@ -419,12 +494,24 @@ hlBool CZIPFile::CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStr
{ {
const ZIPFileHeader *pDirectoryItem = static_cast<const ZIPFileHeader *>(pFile->GetData()); const ZIPFileHeader *pDirectoryItem = static_cast<const ZIPFileHeader *>(pFile->GetData());
if(pDirectoryItem->uiCompressionMethod != 0) switch(pDirectoryItem->uiCompressionMethod)
{ {
case 0: // None.
#if USE_ZLIB
case 8: // Deflate.
#endif
break;
default:
LastError.SetErrorMessageFormated("Compression format %#.2x not supported.", pDirectoryItem->uiCompressionMethod); LastError.SetErrorMessageFormated("Compression format %#.2x not supported.", pDirectoryItem->uiCompressionMethod);
return hlFalse; return hlFalse;
} }
if((pDirectoryItem->uiFlags & 0x01u) != 0)
{
LastError.SetErrorMessageFormated("File is encrypted.");
return hlFalse;
}
if(pDirectoryItem->uiDiskNumberStart != this->pEndOfCentralDirectoryRecord->uiNumberOfThisDisk) if(pDirectoryItem->uiDiskNumberStart != this->pEndOfCentralDirectoryRecord->uiNumberOfThisDisk)
{ {
LastError.SetErrorMessageFormated("File resides on disk %u.", pDirectoryItem->uiDiskNumberStart); LastError.SetErrorMessageFormated("File resides on disk %u.", pDirectoryItem->uiDiskNumberStart);
@ -438,17 +525,77 @@ hlBool CZIPFile::CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStr
return hlFalse; return hlFalse;
} }
const ZIPLocalFileHeader DirectoryEntry = *static_cast<const ZIPLocalFileHeader *>(pDirectoryEnrtyView->GetView()); ZIPLocalFileHeader DirectoryEntry = *static_cast<const ZIPLocalFileHeader *>(pDirectoryEnrtyView->GetView());
this->pMapping->Unmap(pDirectoryEnrtyView); this->pMapping->Unmap(pDirectoryEnrtyView);
if((DirectoryEntry.uiFlags & 0x08u) != 0)
{
DirectoryEntry.uiCRC32 = pDirectoryItem->uiCRC32;
DirectoryEntry.uiUncompressedSize = pDirectoryItem->uiUncompressedSize;
DirectoryEntry.uiCompressedSize = pDirectoryItem->uiCompressedSize;
}
if(DirectoryEntry.uiSignature != HL_ZIP_LOCAL_FILE_HEADER_SIGNATURE) if(DirectoryEntry.uiSignature != HL_ZIP_LOCAL_FILE_HEADER_SIGNATURE)
{ {
LastError.SetErrorMessageFormated("Invalid file data offset.", pDirectoryItem->uiDiskNumberStart); LastError.SetErrorMessageFormated("Invalid file data offset.");
return hlFalse; return hlFalse;
} }
switch(pDirectoryItem->uiCompressionMethod)
{
case 0: // None.
{
pStream = new Streams::CMappingStream(*this->pMapping, pDirectoryItem->uiRelativeOffsetOfLocalHeader + sizeof(ZIPLocalFileHeader) + DirectoryEntry.uiFileNameLength + DirectoryEntry.uiExtraFieldLength, DirectoryEntry.uiUncompressedSize); pStream = new Streams::CMappingStream(*this->pMapping, pDirectoryItem->uiRelativeOffsetOfLocalHeader + sizeof(ZIPLocalFileHeader) + DirectoryEntry.uiFileNameLength + DirectoryEntry.uiExtraFieldLength, DirectoryEntry.uiUncompressedSize);
return hlTrue; return hlTrue;
}
#if USE_ZLIB
case 8: // Deflate.
{
Mapping::CView *pFileDataView = 0;
if(this->pMapping->Map(pFileDataView, pDirectoryItem->uiRelativeOffsetOfLocalHeader + sizeof(ZIPLocalFileHeader) + DirectoryEntry.uiFileNameLength + DirectoryEntry.uiExtraFieldLength, DirectoryEntry.uiCompressedSize))
{
hlBool bResult = hlFalse;
hlByte *lpInflateBuffer = new hlByte[DirectoryEntry.uiUncompressedSize];
uLongf iInflateSize = DirectoryEntry.uiUncompressedSize;
switch(uncompressBack(lpInflateBuffer, &iInflateSize, static_cast<const hlByte *>(pFileDataView->GetView()), (uLong)DirectoryEntry.uiCompressedSize))
{
case Z_OK:
pStream = new Streams::CMemoryStream(lpInflateBuffer, iInflateSize);
bResult = hlTrue;
break;
case Z_MEM_ERROR:
delete []lpInflateBuffer;
LastError.SetErrorMessage("Deflate Error: Z_MEM_ERROR.");
break;
case Z_BUF_ERROR:
delete []lpInflateBuffer;
LastError.SetErrorMessage("Deflate Error: Z_BUF_ERROR.");
break;
case Z_DATA_ERROR:
delete []lpInflateBuffer;
LastError.SetErrorMessage("Deflate Error: Z_DATA_ERROR.");
break;
default:
delete []lpInflateBuffer;
LastError.SetErrorMessage("Deflate Error: Unknown.");
break;
}
this->pMapping->Unmap(pFileDataView);
return bResult;
}
return hlFalse;
}
#endif
default:
return hlFalse;
}
}
hlVoid CZIPFile::ReleaseStreamInternal(Streams::IStream &Stream) const
{
if(Stream.GetType() == HL_STREAM_MEMORY)
{
delete []static_cast<const hlByte *>(static_cast<Streams::CMemoryStream &>(Stream).GetBuffer());
}
} }

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -116,6 +116,7 @@ namespace HLLib
virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const; virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const; virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const;
virtual hlVoid ReleaseStreamInternal(Streams::IStream &Stream) const;
}; };
} }

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -28,6 +28,11 @@
typedef unsigned char hlBool; typedef unsigned char hlBool;
typedef char hlChar; typedef char hlChar;
#ifdef __cplusplus
typedef wchar_t hlWChar;
#else
typedef unsigned short hlWChar;
#endif
typedef unsigned char hlByte; typedef unsigned char hlByte;
typedef signed short hlShort; typedef signed short hlShort;
typedef unsigned short hlUShort; typedef unsigned short hlUShort;
@ -60,8 +65,8 @@ typedef hlSingle hlFloat;
#define hlFalse 0 #define hlFalse 0
#define hlTrue 1 #define hlTrue 1
#define HL_VERSION_NUMBER ((2 << 24) | (4 << 16) | (2 << 8) | 0) #define HL_VERSION_NUMBER ((2 << 24) | (4 << 16) | (3 << 8) | 0)
#define HL_VERSION_STRING "2.4.2" #define HL_VERSION_STRING "2.4.3"
#define HL_ID_INVALID 0xffffffff #define HL_ID_INVALID 0xffffffff
@ -186,7 +191,8 @@ typedef enum
HL_PACKAGE_XZP, HL_PACKAGE_XZP,
HL_PACKAGE_ZIP, HL_PACKAGE_ZIP,
HL_PACKAGE_NCF, HL_PACKAGE_NCF,
HL_PACKAGE_VPK HL_PACKAGE_VPK,
HL_PACKAGE_SGA
} HLPackageType; } HLPackageType;
typedef enum typedef enum
@ -237,6 +243,19 @@ typedef enum
HL_PAK_PACKAGE_COUNT = 0, HL_PAK_PACKAGE_COUNT = 0,
HL_PAK_ITEM_COUNT = 0, HL_PAK_ITEM_COUNT = 0,
HL_SGA_PACKAGE_VERSION_MAJOR = 0,
HL_SGA_PACKAGE_VERSION_MINOR,
HL_SGA_PACKAGE_MD5_FILE,
HL_SGA_PACKAGE_NAME,
HL_SGA_PACKAGE_MD5_HEADER,
HL_SGA_PACKAGE_COUNT,
HL_SGA_ITEM_SECTION_ALIAS = 0,
HL_SGA_ITEM_SECTION_NAME,
HL_SGA_ITEM_MODIFIED,
HL_SGA_ITEM_TYPE,
HL_SGA_ITEM_CRC,
HL_SGA_ITEM_COUNT,
HL_VBSP_PACKAGE_VERSION = 0, HL_VBSP_PACKAGE_VERSION = 0,
HL_VBSP_PACKAGE_MAP_REVISION, HL_VBSP_PACKAGE_MAP_REVISION,
HL_VBSP_PACKAGE_COUNT, HL_VBSP_PACKAGE_COUNT,

View File

@ -9,11 +9,11 @@ Library/Author Information:
=========================== ===========================
---- General Library Information ---- ---- General Library Information ----
Date : May 22nd, 2011 Date : September 18th, 2012
Author : Ryan Gregg Author : Ryan Gregg
Michael Mohr (Linux Port) Michael Mohr (Linux Port)
Title : HLLib Title : HLLib
Build : 2.4.2 Build : 2.4.3
Email address : ryansgregg@hotmail.com (Ryan Gregg) Email address : ryansgregg@hotmail.com (Ryan Gregg)
m.mohr@laposte.net (Michael Mohr) m.mohr@laposte.net (Michael Mohr)
Home page / Website : http://nemesis.thewavelength.net/ Home page / Website : http://nemesis.thewavelength.net/
@ -93,6 +93,11 @@ Console Commands (Interactive console mode):
Library Changelog: Library Changelog:
================== ==================
v2.4.3
- Added support for new VPK file format (v2).
- Added SGA file support.
- Added ZIP deflate support.
v2.4.2 v2.4.2
- Fixed crash when opening VBSP files with no pak file lump. - Fixed crash when opening VBSP files with no pak file lump.
@ -117,7 +122,7 @@ Library Changelog:
- Added support for new VBSP file format. - Added support for new VBSP file format.
v2.1.1 v2.1.1
- Added support for new VPK file format. - Added support for new VPK file format (v1).
- Added VPK file validation. - Added VPK file validation.
- Fixed crash when closing VPK files. - Fixed crash when closing VPK files.

View File

@ -1,6 +1,6 @@
/* /*
* HLLib * HLLib
* Copyright (C) 2006-2010 Ryan Gregg * Copyright (C) 2006-2012 Ryan Gregg
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -28,6 +28,11 @@
typedef unsigned char hlBool; typedef unsigned char hlBool;
typedef char hlChar; typedef char hlChar;
#ifdef __cplusplus
typedef wchar_t hlWChar;
#else
typedef unsigned short hlWChar;
#endif
typedef unsigned char hlByte; typedef unsigned char hlByte;
typedef signed short hlShort; typedef signed short hlShort;
typedef unsigned short hlUShort; typedef unsigned short hlUShort;
@ -60,8 +65,8 @@ typedef hlSingle hlFloat;
#define hlFalse 0 #define hlFalse 0
#define hlTrue 1 #define hlTrue 1
#define HL_VERSION_NUMBER ((2 << 24) | (4 << 16) | (2 << 8) | 0) #define HL_VERSION_NUMBER ((2 << 24) | (4 << 16) | (3 << 8) | 0)
#define HL_VERSION_STRING "2.4.2" #define HL_VERSION_STRING "2.4.3"
#define HL_ID_INVALID 0xffffffff #define HL_ID_INVALID 0xffffffff
@ -190,7 +195,8 @@ typedef enum
HL_PACKAGE_XZP, HL_PACKAGE_XZP,
HL_PACKAGE_ZIP, HL_PACKAGE_ZIP,
HL_PACKAGE_NCF, HL_PACKAGE_NCF,
HL_PACKAGE_VPK HL_PACKAGE_VPK,
HL_PACKAGE_SGA
} HLPackageType; } HLPackageType;
typedef enum typedef enum
@ -241,6 +247,19 @@ typedef enum
HL_PAK_PACKAGE_COUNT = 0, HL_PAK_PACKAGE_COUNT = 0,
HL_PAK_ITEM_COUNT = 0, HL_PAK_ITEM_COUNT = 0,
HL_SGA_PACKAGE_VERSION_MAJOR = 0,
HL_SGA_PACKAGE_VERSION_MINOR,
HL_SGA_PACKAGE_MD5_FILE,
HL_SGA_PACKAGE_NAME,
HL_SGA_PACKAGE_MD5_HEADER,
HL_SGA_PACKAGE_COUNT,
HL_SGA_ITEM_SECTION_ALIAS = 0,
HL_SGA_ITEM_SECTION_NAME,
HL_SGA_ITEM_MODIFIED,
HL_SGA_ITEM_TYPE,
HL_SGA_ITEM_CRC,
HL_SGA_ITEM_COUNT,
HL_VBSP_PACKAGE_VERSION = 0, HL_VBSP_PACKAGE_VERSION = 0,
HL_VBSP_PACKAGE_MAP_REVISION, HL_VBSP_PACKAGE_MAP_REVISION,
HL_VBSP_PACKAGE_COUNT, HL_VBSP_PACKAGE_COUNT,
@ -1858,6 +1877,196 @@ namespace HLLib
virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const; virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const;
}; };
//
// CSGAFile
//
class HLLIB_API CSGAFile : public CPackage
{
private:
#pragma pack(1)
struct SGAHeader
{
hlChar lpSignature[8];
hlUShort uiMajorVersion;
hlUShort uiMinorVersion;
hlByte lpFileMD5[16];
hlWChar lpName[64];
hlByte lpHeaderMD5[16];
hlUInt uiHeaderLength;
hlUInt uiFileDataOffset;
hlUInt uiDummy0;
};
template<typename T>
struct SGADirectoryHeader
{
hlUInt uiSectionOffset;
T uiSectionCount;
hlUInt uiFolderOffset;
T uiFolderCount;
hlUInt uiFileOffset;
T uiFileCount;
hlUInt uiStringTableOffset;
T uiStringTableCount;
};
typedef SGADirectoryHeader<hlUShort> SGADirectoryHeader4;
typedef SGADirectoryHeader<hlUInt> SGADirectoryHeader5;
template<typename T>
struct SGASection
{
hlChar lpAlias[64];
hlChar lpName[64];
T uiFolderStartIndex;
T uiFolderEndIndex;
T uiFileStartIndex;
T uiFileEndIndex;
T uiFolderRootIndex;
};
typedef SGASection<hlUShort> SGASection4;
typedef SGASection<hlUInt> SGASection5;
template<typename T>
struct SGAFolder
{
hlUInt uiNameOffset;
T uiFolderStartIndex;
T uiFolderEndIndex;
T uiFileStartIndex;
T uiFileEndIndex;
};
typedef SGAFolder<hlUShort> SGAFolder4;
typedef SGAFolder<hlUInt> SGAFolder5;
struct SGAFile
{
hlUInt uiNameOffset;
hlUInt uiOffset;
hlUInt uiSizeOnDisk;
hlUInt uiSize;
hlUInt uiTimeModified;
hlByte uiDummy0;
hlByte uiType;
};
struct SGAFileHeader
{
hlChar lpName[256];
hlUInt uiCRC32;
};
#pragma pack()
class ISGADirectory
{
public:
virtual ~ISGADirectory() = 0;
public:
virtual hlBool MapDataStructures() = 0;
virtual hlVoid UnmapDataStructures() = 0;
virtual CDirectoryFolder *CreateRoot() = 0;
virtual hlBool GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackageAttribute eAttribute, HLAttribute &Attribute) const = 0;
virtual hlBool GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool &bExtractable) const = 0;
virtual hlBool GetFileValidationInternal(const CDirectoryFile *pFile, HLValidation &eValidation) const = 0;
virtual hlBool GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const = 0;
virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const = 0;
virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const = 0;
virtual hlVoid ReleaseStreamInternal(Streams::IStream &Stream) const = 0;
};
template<typename TSGADirectoryHeader, typename TSGASection, typename TSGAFolder, typename TSGAFile, typename TSGAFileHeader>
class CSGADirectory : public ISGADirectory
{
public:
CSGADirectory(CSGAFile& File);
virtual ~CSGADirectory();
private:
CSGAFile& File;
Mapping::CView *pHeaderDirectoryView;
const TSGADirectoryHeader *pDirectoryHeader;
const TSGASection *lpSections;
const TSGAFolder *lpFolders;
const TSGAFile *lpFiles;
const hlChar *lpStringTable;
public:
virtual hlBool MapDataStructures();
virtual hlVoid UnmapDataStructures();
virtual CDirectoryFolder *CreateRoot();
virtual hlBool GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackageAttribute eAttribute, HLAttribute &Attribute) const;
virtual hlBool GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool &bExtractable) const;
virtual hlBool GetFileValidationInternal(const CDirectoryFile *pFile, HLValidation &eValidation) const;
virtual hlBool GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const;
virtual hlVoid ReleaseStreamInternal(Streams::IStream &Stream) const;
private:
hlVoid CreateFolder(CDirectoryFolder *pParent, hlUInt uiFolderIndex);
};
typedef CSGADirectory<SGADirectoryHeader4, SGASection4, SGAFolder4, SGAFile, SGAFileHeader> CSGADirectory4;
typedef CSGADirectory<SGADirectoryHeader5, SGASection5, SGAFolder5, SGAFile, SGAFileHeader> CSGADirectory5;
friend CSGADirectory4;
friend CSGADirectory5;
private:
static const char *lpAttributeNames[];
static const char *lpItemAttributeNames[];
Mapping::CView *pHeaderView;
const SGAHeader *pHeader;
ISGADirectory* pDirectory;
public:
CSGAFile();
virtual ~CSGAFile();
virtual HLPackageType GetType() const;
virtual const hlChar *GetExtension() const;
virtual const hlChar *GetDescription() const;
protected:
virtual hlBool MapDataStructures();
virtual hlVoid UnmapDataStructures();
virtual CDirectoryFolder *CreateRoot();
virtual hlUInt GetAttributeCountInternal() const;
virtual const hlChar *GetAttributeNameInternal(HLPackageAttribute eAttribute) const;
virtual hlBool GetAttributeInternal(HLPackageAttribute eAttribute, HLAttribute &Attribute) const;
virtual hlUInt GetItemAttributeCountInternal() const;
virtual const hlChar *GetItemAttributeNameInternal(HLPackageAttribute eAttribute) const;
virtual hlBool GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackageAttribute eAttribute, HLAttribute &Attribute) const;
virtual hlBool GetFileExtractableInternal(const CDirectoryFile *pFile, hlBool &bExtractable) const;
virtual hlBool GetFileValidationInternal(const CDirectoryFile *pFile, HLValidation &eValidation) const;
virtual hlBool GetFileSizeInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool GetFileSizeOnDiskInternal(const CDirectoryFile *pFile, hlUInt &uiSize) const;
virtual hlBool CreateStreamInternal(const CDirectoryFile *pFile, Streams::IStream *&pStream) const;
virtual hlVoid ReleaseStreamInternal(Streams::IStream &Stream) const;
};
// //
// CVBSPFile // CVBSPFile
// //

View File

@ -80,7 +80,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS;USE_ZLIB=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling>Sync</ExceptionHandling> <ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -90,6 +90,7 @@
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>E:\Projects\Utilities\ZLib</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<OutputFile>$(OutDir)HLLib.dll</OutputFile> <OutputFile>$(OutDir)HLLib.dll</OutputFile>
@ -101,6 +102,8 @@
</DataExecutionPrevention> </DataExecutionPrevention>
<ImportLibrary>$(OutDir)HLLib.lib</ImportLibrary> <ImportLibrary>$(OutDir)HLLib.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>E:\Projects\Utilities\ZLib\contrib\vstudio\vc10\x86\ZlibStatDebug</AdditionalLibraryDirectories>
<AdditionalDependencies>zlibstat.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -109,7 +112,7 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS;USE_ZLIB=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling>Sync</ExceptionHandling> <ExceptionHandling>Sync</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -119,6 +122,7 @@
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>E:\Projects\Utilities\ZLib</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<OutputFile>$(OutDir)HLLib.dll</OutputFile> <OutputFile>$(OutDir)HLLib.dll</OutputFile>
@ -130,6 +134,8 @@
</DataExecutionPrevention> </DataExecutionPrevention>
<ImportLibrary>$(OutDir)HLLib.lib</ImportLibrary> <ImportLibrary>$(OutDir)HLLib.lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
<AdditionalDependencies>zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>E:\Projects\Utilities\ZLib\contrib\vstudio\vc10\x64\ZlibStatDebug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -139,7 +145,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HLLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HLLIB_EXPORTS;USE_ZLIB=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling> <ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
@ -147,6 +153,7 @@
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>E:\Projects\Utilities\ZLib</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<OutputFile>$(OutDir)HLLib.dll</OutputFile> <OutputFile>$(OutDir)HLLib.dll</OutputFile>
@ -159,6 +166,8 @@
</DataExecutionPrevention> </DataExecutionPrevention>
<ImportLibrary>$(OutDir)HLLib.lib</ImportLibrary> <ImportLibrary>$(OutDir)HLLib.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>E:\Projects\Utilities\ZLib\contrib\vstudio\vc10\x86\ZlibStatRelease</AdditionalLibraryDirectories>
<AdditionalDependencies>zlibstat.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -171,7 +180,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HLLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HLLIB_EXPORTS;USE_ZLIB=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling> <ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
@ -179,6 +188,7 @@
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>E:\Projects\Utilities\ZLib</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<OutputFile>$(OutDir)HLLib.dll</OutputFile> <OutputFile>$(OutDir)HLLib.dll</OutputFile>
@ -191,6 +201,8 @@
</DataExecutionPrevention> </DataExecutionPrevention>
<ImportLibrary>$(OutDir)HLLib.lib</ImportLibrary> <ImportLibrary>$(OutDir)HLLib.lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
<AdditionalLibraryDirectories>E:\Projects\Utilities\ZLib\contrib\vstudio\vc10\x64\ZlibStatRelease;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@ -198,6 +210,7 @@
<ClCompile Include="..\..\..\HLLib\DebugMemory.cpp" /> <ClCompile Include="..\..\..\HLLib\DebugMemory.cpp" />
<ClCompile Include="..\..\..\HLLib\Error.cpp" /> <ClCompile Include="..\..\..\HLLib\Error.cpp" />
<ClCompile Include="..\..\..\HLLib\HLLib.cpp" /> <ClCompile Include="..\..\..\HLLib\HLLib.cpp" />
<ClCompile Include="..\..\..\HLLib\SGAFile.cpp" />
<ClCompile Include="..\..\..\HLLib\Utility.cpp" /> <ClCompile Include="..\..\..\HLLib\Utility.cpp" />
<ClCompile Include="..\..\..\HLLib\Wrapper.cpp" /> <ClCompile Include="..\..\..\HLLib\Wrapper.cpp" />
<ClCompile Include="..\..\..\HLLib\DirectoryFile.cpp" /> <ClCompile Include="..\..\..\HLLib\DirectoryFile.cpp" />
@ -231,6 +244,7 @@
<ClInclude Include="..\..\..\HLLib\Error.h" /> <ClInclude Include="..\..\..\HLLib\Error.h" />
<ClInclude Include="..\..\..\HLLib\HLLib.h" /> <ClInclude Include="..\..\..\HLLib\HLLib.h" />
<ClInclude Include="..\..\..\HLLib\resource.h" /> <ClInclude Include="..\..\..\HLLib\resource.h" />
<ClInclude Include="..\..\..\HLLib\SGAFile.h" />
<ClInclude Include="..\..\..\HLLib\stdafx.h" /> <ClInclude Include="..\..\..\HLLib\stdafx.h" />
<ClInclude Include="..\..\..\HLLib\Utility.h" /> <ClInclude Include="..\..\..\HLLib\Utility.h" />
<ClInclude Include="..\..\..\HLLib\Wrapper.h" /> <ClInclude Include="..\..\..\HLLib\Wrapper.h" />

View File

@ -99,6 +99,88 @@
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_WIN64;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS"
MinimalRebuild="true"
ExceptionHandling="1"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/HLLib.dll"
LinkIncremental="2"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/HLLib.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/HLLib.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)" OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -184,88 +266,6 @@
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_WIN64;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS"
MinimalRebuild="true"
ExceptionHandling="1"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/HLLib.dll"
LinkIncremental="2"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/HLLib.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/HLLib.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration <Configuration
Name="Release|x64" Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)" OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -424,6 +424,10 @@
RelativePath="..\..\..\HLLib\PAKFile.cpp" RelativePath="..\..\..\HLLib\PAKFile.cpp"
> >
</File> </File>
<File
RelativePath="..\..\..\HLLib\SGAFile.cpp"
>
</File>
<File <File
RelativePath="..\..\..\HLLib\VBSPFile.cpp" RelativePath="..\..\..\HLLib\VBSPFile.cpp"
> >
@ -582,6 +586,10 @@
RelativePath="..\..\..\HLLib\PAKFile.h" RelativePath="..\..\..\HLLib\PAKFile.h"
> >
</File> </File>
<File
RelativePath="..\..\..\HLLib\SGAFile.h"
>
</File>
<File <File
RelativePath="..\..\..\HLLib\VBSPFile.h" RelativePath="..\..\..\HLLib\VBSPFile.h"
> >

View File

@ -45,7 +45,8 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS" AdditionalIncludeDirectories="E:\Projects\Utilities\ZLib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS;USE_ZLIB=1"
MinimalRebuild="true" MinimalRebuild="true"
ExceptionHandling="1" ExceptionHandling="1"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -66,8 +67,10 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zlibstat.lib"
OutputFile="$(OutDir)/HLLib.dll" OutputFile="$(OutDir)/HLLib.dll"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="E:\Projects\Utilities\ZLib\contrib\vstudio\vc9\x86\ZlibStatDebug"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/HLLib.pdb" ProgramDatabaseFile="$(OutDir)/HLLib.pdb"
SubSystem="2" SubSystem="2"
@ -125,7 +128,8 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS" AdditionalIncludeDirectories="E:\Projects\Utilities\ZLib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_USE_RTM_VERSION;HLLIB_EXPORTS;USE_ZLIB=1"
MinimalRebuild="true" MinimalRebuild="true"
ExceptionHandling="1" ExceptionHandling="1"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -146,8 +150,10 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zlibstat.lib"
OutputFile="$(OutDir)/HLLib.dll" OutputFile="$(OutDir)/HLLib.dll"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="E:\Projects\Utilities\ZLib\contrib\vstudio\vc9\x64\ZlibStatDebug"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/HLLib.pdb" ProgramDatabaseFile="$(OutDir)/HLLib.pdb"
SubSystem="2" SubSystem="2"
@ -209,7 +215,8 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
WholeProgramOptimization="true" WholeProgramOptimization="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;HLLIB_EXPORTS" AdditionalIncludeDirectories="E:\Projects\Utilities\ZLib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;HLLIB_EXPORTS;USE_ZLIB=1"
ExceptionHandling="1" ExceptionHandling="1"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="false" BufferSecurityCheck="false"
@ -228,8 +235,10 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zlibstat.lib"
OutputFile="$(OutDir)/HLLib.dll" OutputFile="$(OutDir)/HLLib.dll"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="E:\Projects\Utilities\ZLib\contrib\vstudio\vc9\x86\ZlibStatRelease"
GenerateDebugInformation="false" GenerateDebugInformation="false"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
@ -293,7 +302,8 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
WholeProgramOptimization="true" WholeProgramOptimization="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;HLLIB_EXPORTS" AdditionalIncludeDirectories="E:\Projects\Utilities\ZLib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;HLLIB_EXPORTS;USE_ZLIB=1"
ExceptionHandling="1" ExceptionHandling="1"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="false" BufferSecurityCheck="false"
@ -312,8 +322,10 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zlibstat.lib"
OutputFile="$(OutDir)/HLLib.dll" OutputFile="$(OutDir)/HLLib.dll"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="E:\Projects\Utilities\ZLib\contrib\vstudio\vc9\x64\ZlibStatRelease"
GenerateDebugInformation="false" GenerateDebugInformation="false"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
@ -417,6 +429,10 @@
RelativePath="..\..\..\HLLib\PAKFile.cpp" RelativePath="..\..\..\HLLib\PAKFile.cpp"
> >
</File> </File>
<File
RelativePath="..\..\..\HLLib\SGAFile.cpp"
>
</File>
<File <File
RelativePath="..\..\..\HLLib\VBSPFile.cpp" RelativePath="..\..\..\HLLib\VBSPFile.cpp"
> >
@ -575,6 +591,10 @@
RelativePath="..\..\..\HLLib\PAKFile.h" RelativePath="..\..\..\HLLib\PAKFile.h"
> >
</File> </File>
<File
RelativePath="..\..\..\HLLib\SGAFile.h"
>
</File>
<File <File
RelativePath="..\..\..\HLLib\VBSPFile.h" RelativePath="..\..\..\HLLib\VBSPFile.h"
> >