This commit is contained in:
FluorescentCIAAfricanAmerican
2020-04-22 12:56:21 -04:00
commit 3bf9df6b27
15370 changed files with 5489726 additions and 0 deletions
+112
View File
@@ -0,0 +1,112 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "bsplib.h"
#include "ibsppack.h"
#include "cmdlib.h"
#include "zip_utils.h"
class CBSPPack : public IBSPPack
{
public:
void LoadBSPFile( IFileSystem *pFileSystem, char *filename );
void WriteBSPFile( char *filename );
void ClearPackFile( void );
void AddFileToPack( const char *relativename, const char *fullpath );
void AddBufferToPack( const char *relativename, void *data, int length, bool bTextMode );
void SetHDRMode( bool bHDR );
bool SwapBSPFile( IFileSystem *pFileSystem, const char *filename, const char *swapFilename, bool bSwapOnLoad, VTFConvertFunc_t pVTFConvertFunc, VHVFixupFunc_t pVHVFixupFunc, CompressFunc_t pCompressFunc );
bool RepackBSP( CUtlBuffer &inputBuffer, CUtlBuffer &outputBuffer, eRepackBSPFlags repackFlags );
bool GetPakFileLump( IFileSystem *pFileSystem, const char *pBSPFilename, void **pPakData, int *pPakSize );
bool SetPakFileLump( IFileSystem *pFileSystem, const char *pBSPFilename, const char *pNewFilename, void *pPakData, int pakSize );
bool GetBSPDependants( IFileSystem *pFileSystem, const char *pBSPFilename, CUtlVector< CUtlString > *pList );
};
void CBSPPack::LoadBSPFile( IFileSystem *pFileSystem, char *filename )
{
MathLib_Init( 2.2f, 2.2f, 0.0f, 2.0f );
// This is shady, but the engine is the only client here and we want the same search paths it has.
g_pFileSystem = g_pFullFileSystem = pFileSystem;
::LoadBSPFile( filename );
}
void CBSPPack::WriteBSPFile( char *filename )
{
::WriteBSPFile( filename );
}
void CBSPPack::ClearPackFile( void )
{
::ClearPakFile( GetPakFile() );
}
void CBSPPack::AddFileToPack( const char *relativename, const char *fullpath )
{
// Compressing at this point would work, but the usual usage is creating a BSP and using RepackBSP() to apply lump
// and pack compression as a final pass
::AddFileToPak( GetPakFile(), relativename, fullpath, IZip::eCompressionType_None );
}
void CBSPPack::AddBufferToPack( const char *relativename, void *data, int length, bool bTextMode )
{
// Compressing at this point would work, but the usual usage is creating a BSP and using RepackBSP() to apply lump
// and pack compression as a final pass
::AddBufferToPak( GetPakFile(), relativename, data, length, bTextMode, IZip::eCompressionType_None );
}
void CBSPPack::SetHDRMode( bool bHDR )
{
::SetHDRMode( bHDR );
}
bool CBSPPack::SwapBSPFile(
IFileSystem *pFileSystem,
const char *filename,
const char *swapFilename,
bool bSwapOnLoad,
VTFConvertFunc_t pVTFConvertFunc,
VHVFixupFunc_t pVHVFixupFunc,
CompressFunc_t pCompressFunc )
{
// This is shady, but the engine is the only client here and we want the same search paths it has.
g_pFileSystem = g_pFullFileSystem = pFileSystem;
return ::SwapBSPFile( filename, swapFilename, bSwapOnLoad, pVTFConvertFunc, pVHVFixupFunc, pCompressFunc );
}
bool CBSPPack::RepackBSP( CUtlBuffer &inputBuffer, CUtlBuffer &outputBuffer, eRepackBSPFlags repackFlags )
{
return ::RepackBSP( inputBuffer, outputBuffer,
( repackFlags & eRepackBSP_CompressLumps ) ? RepackBSPCallback_LZMA : NULL,
( repackFlags & eRepackBSP_CompressPackfile ) ? IZip::eCompressionType_LZMA : IZip::eCompressionType_None );
}
bool CBSPPack::GetPakFileLump( IFileSystem *pFileSystem, const char *pBSPFilename, void **pPakData, int *pPakSize )
{
g_pFileSystem = g_pFullFileSystem = pFileSystem;
return ::GetPakFileLump( pBSPFilename, pPakData, pPakSize );
}
bool CBSPPack::SetPakFileLump( IFileSystem *pFileSystem, const char *pBSPFilename, const char *pNewFilename, void *pPakData, int pakSize )
{
g_pFileSystem = g_pFullFileSystem = pFileSystem;
return ::SetPakFileLump( pBSPFilename, pNewFilename, pPakData, pakSize );
}
bool CBSPPack::GetBSPDependants( IFileSystem *pFileSystem, const char *pBSPFilename, CUtlVector< CUtlString > *pList )
{
g_pFileSystem = g_pFullFileSystem = pFileSystem;
return ::GetBSPDependants( pBSPFilename, pList );
}
EXPOSE_SINGLE_INTERFACE( CBSPPack, IBSPPack, IBSPPACK_VERSION_STRING );
+57
View File
@@ -0,0 +1,57 @@
//-----------------------------------------------------------------------------
// BSPPACK.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$macro SRCDIR "..\.."
$Macro OUTBINDIR "$SRCDIR\..\game\bin"
$include "$SRCDIR\vpc_scripts\source_dll_base.vpc"
$Configuration
{
$Compiler
{
$PreprocessorDefinitions "$BASE;BSPPACK_EXPORTS;ZIP_SUPPORT_LZMA_ENCODE"
$PreprocessorDefinitions "$BASE;WIN_ERROR;_USRDLL" [$WIN32]
$PreprocessorDefinitions "$BASE;WIN_ERROR;_USRDLL;BSP_USE_LESS_MEMORY" [$X360]
$AdditionalIncludeDirectories "..\common;$BASE"
}
$Linker
{
$SystemLibraries "iconv" [$OSXALL]
}
}
$Project "bsppack"
{
$Folder "Source Files"
{
$File "..\common\bsplib.cpp"
$File "bsppack.cpp"
$File "..\common\cmdlib.cpp"
$File "$SRCDIR\public\filesystem_helpers.cpp"
$File "$SRCDIR\public\filesystem_helpers.h"
$File "$SRCDIR\public\filesystem_init.cpp"
$File "..\common\filesystem_tools.cpp"
$File "..\common\filesystem_tools.h"
$File "$SRCDIR\public\lumpfiles.cpp"
$File "..\common\scriplib.cpp"
$File "$SRCDIR\public\zip_utils.cpp"
$File "$SRCDIR\filesystem\linux_support.cpp" [$POSIX]
}
$Folder "Public Header Files"
{
$File "$SRCDIR\public\ibsppack.h"
$File "$SRCDIR\public\bspfile.h"
}
$Folder "Link Libraries"
{
$Lib mathlib
$Lib tier2
$Lib "$LIBCOMMON/lzma"
}
}
+3
View File
@@ -0,0 +1,3 @@
LIBRARY bsppack_360.dll
EXPORTS
CreateInterface @1