mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Set VPK compression level through ConVar
This commit is contained in:
parent
66f7e96413
commit
705b81a9e3
@ -178,10 +178,11 @@ void ConVar::Init(void) const
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
fs_warning_level_sdk = ConVar::Create("fs_warning_level_sdk" , "0", FCVAR_DEVELOPMENTONLY, "Set the SDK filesystem warning level.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_show_warning_output = ConVar::Create("fs_show_warning_output" , "0", FCVAR_DEVELOPMENTONLY, "Logs the filesystem warnings to the console, filtered by 'fs_warning_level_native' ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_packedstore_entryblock_stats = ConVar::Create("fs_packedstore_entryblock_stats" , "0", FCVAR_DEVELOPMENTONLY, "If set to 1, prints the stats of each file entry in the VPK during decompression ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_packedstore_workspace = ConVar::Create("fs_packedstore_workspace", "platform/vpk/", FCVAR_DEVELOPMENTONLY, "Determines the current VPK workspace.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_warning_level_sdk = ConVar::Create("fs_warning_level_sdk" , "0", FCVAR_DEVELOPMENTONLY, "Set the SDK filesystem warning level.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_show_warning_output = ConVar::Create("fs_show_warning_output" , "0", FCVAR_DEVELOPMENTONLY, "Logs the filesystem warnings to the console, filtered by 'fs_warning_level_native' ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_packedstore_entryblock_stats = ConVar::Create("fs_packedstore_entryblock_stats" , "0", FCVAR_DEVELOPMENTONLY, "If set to 1, prints the stats of each file entry in the VPK during decompression ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_packedstore_workspace = ConVar::Create("fs_packedstore_workspace" , "platform/vpk/", FCVAR_DEVELOPMENTONLY, "Determines the current VPK workspace.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
fs_packedstore_compression_level = ConVar::Create("fs_packedstore_compression_level", "default", FCVAR_DEVELOPMENTONLY, "Determines the VPK compression level.", false, 0.f, false, 0.f, nullptr, "fastest faster default better uber");
|
||||
//-------------------------------------------------------------------------
|
||||
// MATERIALSYSTEM |
|
||||
#ifndef DEDICATED
|
||||
|
@ -149,6 +149,7 @@ ConVar* fs_warning_level_sdk = nullptr;
|
||||
ConVar* fs_show_warning_output = nullptr;
|
||||
ConVar* fs_packedstore_entryblock_stats = nullptr;
|
||||
ConVar* fs_packedstore_workspace = nullptr;
|
||||
ConVar* fs_packedstore_compression_level = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// MATERIALSYSTEM |
|
||||
#ifndef DEDICATED
|
||||
|
@ -144,6 +144,7 @@ extern ConVar* fs_warning_level_sdk;
|
||||
extern ConVar* fs_show_warning_output;
|
||||
extern ConVar* fs_packedstore_entryblock_stats;
|
||||
extern ConVar* fs_packedstore_workspace;
|
||||
extern ConVar* fs_packedstore_compression_level;
|
||||
//-------------------------------------------------------------------------
|
||||
// MATERIALSYSTEM |
|
||||
#ifndef DEDICATED
|
||||
|
@ -20,8 +20,8 @@ void CPackedStore::InitLzCompParams(void)
|
||||
{
|
||||
/*| PARAMETERS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
|
||||
m_lzCompParams.m_dict_size_log2 = VPK_DICT_SIZE;
|
||||
m_lzCompParams.m_level = lzham_compress_level::LZHAM_COMP_LEVEL_UBER;
|
||||
m_lzCompParams.m_compress_flags = lzham_compress_flags::LZHAM_COMP_FLAG_DETERMINISTIC_PARSING | lzham_compress_flags::LZHAM_COMP_FLAG_TRADEOFF_DECOMPRESSION_RATE_FOR_COMP_RATIO;
|
||||
m_lzCompParams.m_level = GetCompressionLevel();
|
||||
m_lzCompParams.m_compress_flags = lzham_compress_flags::LZHAM_COMP_FLAG_DETERMINISTIC_PARSING;
|
||||
m_lzCompParams.m_max_helper_threads = -1;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ VPKDir_t CPackedStore::GetDirectoryFile(string svPackDirFile) const
|
||||
{
|
||||
if (svPackDirFile.find(DIR_CONTEXT[j]) != string::npos)
|
||||
{
|
||||
string svPackDirPrefix = DIR_LOCALE[i] + DIR_LOCALE[i];
|
||||
const string svPackDirPrefix = DIR_LOCALE[i] + DIR_LOCALE[i];
|
||||
StringReplace(svPackDirFile, DIR_LOCALE[i], svPackDirPrefix);
|
||||
goto escape;
|
||||
}
|
||||
@ -93,6 +93,28 @@ string CPackedStore::GetPackFile(const string& svPackDirFile, uint16_t iArchiveI
|
||||
return svPackChunkFile;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: gets the LZHAM compression level
|
||||
// output : lzham_compress_level
|
||||
//-----------------------------------------------------------------------------
|
||||
lzham_compress_level CPackedStore::GetCompressionLevel(void) const
|
||||
{
|
||||
const char* pszLevel = fs_packedstore_compression_level->GetString();
|
||||
|
||||
if(strcmp(pszLevel, "fastest") == NULL)
|
||||
return lzham_compress_level::LZHAM_COMP_LEVEL_FASTEST;
|
||||
else if (strcmp(pszLevel, "faster") == NULL)
|
||||
return lzham_compress_level::LZHAM_COMP_LEVEL_FASTER;
|
||||
else if (strcmp(pszLevel, "default") == NULL)
|
||||
return lzham_compress_level::LZHAM_COMP_LEVEL_DEFAULT;
|
||||
else if (strcmp(pszLevel, "better") == NULL)
|
||||
return lzham_compress_level::LZHAM_COMP_LEVEL_BETTER;
|
||||
else if (strcmp(pszLevel, "uber") == NULL)
|
||||
return lzham_compress_level::LZHAM_COMP_LEVEL_UBER;
|
||||
else
|
||||
return lzham_compress_level::LZHAM_COMP_LEVEL_DEFAULT;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: obtains and returns the entry block to the vector
|
||||
// Input : *pReader -
|
||||
@ -109,7 +131,7 @@ vector<VPKEntryBlock_t> CPackedStore::GetEntryBlocks(CIOStream* pReader) const
|
||||
{
|
||||
while (!(svName = pReader->ReadString()).empty())
|
||||
{
|
||||
string svFilePath = FormatEntryPath(svPath, svName, svExtension);
|
||||
const string svFilePath = FormatEntryPath(svPath, svName, svExtension);
|
||||
vBlocks.push_back(VPKEntryBlock_t(pReader, svFilePath));
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
|
||||
VPKDir_t GetDirectoryFile(string svDirectoryFile) const;
|
||||
string GetPackFile(const string& svPackDirFile, uint16_t iArchiveIndex) const;
|
||||
lzham_compress_level GetCompressionLevel(void) const;
|
||||
|
||||
vector<VPKEntryBlock_t> GetEntryBlocks(CIOStream* pReader) const;
|
||||
vector<string> GetEntryPaths(const string& svPathIn) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user