From 1f2d4462d3168059f4e02c315f9a10599e227931 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 14 Jan 2024 22:56:52 +0100 Subject: [PATCH] VpkLib: fix bug when parsing directory tree base name After the regex update in commit 5266a2e9, this function had to be updated as well since the underscore is no longer returned. --- src/vpklib/packedstore.cpp | 10 +++++----- src/vpklib/packedstore.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vpklib/packedstore.cpp b/src/vpklib/packedstore.cpp index 638a5aab..e195af99 100644 --- a/src/vpklib/packedstore.cpp +++ b/src/vpklib/packedstore.cpp @@ -91,9 +91,9 @@ void CPackedStoreBuilder::InitLzDecoder(void) //----------------------------------------------------------------------------- // Purpose: gets the level name from the directory file name // Input : &dirFileName - -// Output : level name as string (e.g. "mp_rr_box") +// Output : level name as string (e.g. "englishclient_mp_rr_box") //----------------------------------------------------------------------------- -CUtlString PackedStore_GetDirLevelName(const CUtlString& dirFileName) +CUtlString PackedStore_GetDirBaseName(const CUtlString& dirFileName) { const char* baseFileName = V_UnqualifiedFileName(dirFileName.String()); @@ -101,7 +101,7 @@ CUtlString PackedStore_GetDirLevelName(const CUtlString& dirFileName) std::regex_search(baseFileName, regexMatches, s_DirFileRegex); CUtlString result; - result.Format("%s%s", regexMatches[1].str().c_str(), regexMatches[2].str().c_str()); + result.Format("%s_%s", regexMatches[1].str().c_str(), regexMatches[2].str().c_str()); return result; } @@ -296,7 +296,7 @@ static void GetEntryBlocks(CUtlVector& entryBlocks, FileHandle_ static bool GetEntryValues(CUtlVector& entryValues, const CUtlString& workspacePath, const CUtlString& dirFileName) { - KeyValues* pManifestKV = GetManifest(workspacePath, PackedStore_GetDirLevelName(dirFileName)); + KeyValues* pManifestKV = GetManifest(workspacePath, PackedStore_GetDirBaseName(dirFileName)); if (!pManifestKV) { @@ -596,7 +596,7 @@ void CPackedStoreBuilder::UnpackStore(const VPKDir_t& vpkDir, const char* worksp return; } - BuildManifest(vpkDir.m_EntryBlocks, workspacePath, PackedStore_GetDirLevelName(vpkDir.m_DirFilePath)); + BuildManifest(vpkDir.m_EntryBlocks, workspacePath, PackedStore_GetDirBaseName(vpkDir.m_DirFilePath)); const CUtlString basePath = vpkDir.m_DirFilePath.StripFilename(false); for (uint16_t packFileIndex : vpkDir.m_PakFileIndices) diff --git a/src/vpklib/packedstore.h b/src/vpklib/packedstore.h index da14321a..d065f24a 100644 --- a/src/vpklib/packedstore.h +++ b/src/vpklib/packedstore.h @@ -212,7 +212,7 @@ private: std::unordered_map m_ChunkHashMap; }; -CUtlString PackedStore_GetDirLevelName(const CUtlString& dirFileName); +CUtlString PackedStore_GetDirBaseName(const CUtlString& dirFileName); CUtlString PackedStore_GetDirNameParts(const CUtlString& dirFileName, const int nCaptureGroup); ///////////////////////////////////////////////////////////////////////////////