From dc0fba931985dd24cf7c676d51bf7efec7da8c5f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 3 Apr 2023 20:08:36 +0200 Subject: [PATCH] CPackedStore: Rename 'useDataSharing' to 'deDuplicate' More descriptive in what it does (deduplication of existing copies). --- r5dev/vpklib/packedstore.cpp | 14 +++++++------- r5dev/vpklib/packedstore.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/r5dev/vpklib/packedstore.cpp b/r5dev/vpklib/packedstore.cpp index 6b8372d8..0cc2d71c 100644 --- a/r5dev/vpklib/packedstore.cpp +++ b/r5dev/vpklib/packedstore.cpp @@ -171,7 +171,7 @@ vector CPackedStore::GetEntryValues(const string& svWorkspace, K pEntryKV->GetInt("loadFlags", static_cast(EPackedLoadFlags::LOAD_VISIBLE) | static_cast(EPackedLoadFlags::LOAD_CACHE)), int16_t(pEntryKV->GetInt("textureFlags", static_cast(EPackedTextureFlags::TEXTURE_DEFAULT))), pEntryKV->GetBool("useCompression", true), - pEntryKV->GetBool("useDataSharing", true)) + pEntryKV->GetBool("deDuplicate", true)) ); } } @@ -304,7 +304,7 @@ void CPackedStore::BuildManifest(const vector& vBlock, const st pEntryKV->SetInt("loadFlags", vDescriptor.m_nLoadFlags); pEntryKV->SetInt("textureFlags", vDescriptor.m_nTextureFlags); pEntryKV->SetBool("useCompression", vDescriptor.m_nCompressedSize != vDescriptor.m_nUncompressedSize); - pEntryKV->SetBool("useDataSharing", true); + pEntryKV->SetBool("deDuplicate", true); } string svPathOut = Format("%s%s%s.txt", svWorkspace.c_str(), "manifest/", svManifestName.c_str()); @@ -355,8 +355,8 @@ void CPackedStore::ValidateCRC32PostDecomp(const string& svAssetPath, const uint void CPackedStore::PackWorkspace(const VPKPair_t& vPair, const string& svWorkspace, const string& svBuildPath, bool bManifestOnly) { const string svPackFilePath = string(svBuildPath + vPair.m_svPackName); - FileHandle_t hPackFile = FileSystem()->Open(svPackFilePath.c_str(), "wb", "GAME"); + FileHandle_t hPackFile = FileSystem()->Open(svPackFilePath.c_str(), "wb", "GAME"); if (!hPackFile) { Error(eDLL_T::FS, NO_ERROR, "%s - Unable to write to '%s' (read-only?)\n", __FUNCTION__, svPackFilePath.c_str()); @@ -420,7 +420,7 @@ void CPackedStore::PackWorkspace(const VPKPair_t& vPair, const string& svWorkspa FileSystem()->Read(pEntryBuffer, int(vDescriptor.m_nCompressedSize), hAsset); vDescriptor.m_nPackFileOffset = FileSystem()->Tell(hPackFile); - if (vEntryValue.m_bUseDataSharing) + if (vEntryValue.m_bDeduplicate) { string svEntryHash = sha1(string(reinterpret_cast(pEntryBuffer), vDescriptor.m_nUncompressedSize)); auto p = m_mChunkHashMap.insert({ svEntryHash, vDescriptor }); @@ -588,16 +588,16 @@ void CPackedStore::UnpackWorkspace(const VPKDir_t& vDirectory, const string& svW // nLoadFlags - // nTextureFlags - // bUseCompression - -// bUseDataSharing - +// bDeduplicate - //----------------------------------------------------------------------------- -VPKKeyValues_t::VPKKeyValues_t(const string& svEntryPath, uint16_t iPreloadSize, uint32_t nLoadFlags, uint16_t nTextureFlags, bool bUseCompression, bool bUseDataSharing) +VPKKeyValues_t::VPKKeyValues_t(const string& svEntryPath, uint16_t iPreloadSize, uint32_t nLoadFlags, uint16_t nTextureFlags, bool bUseCompression, bool bDeduplicate) { m_svEntryPath = svEntryPath; m_iPreloadSize = iPreloadSize; m_nLoadFlags = nLoadFlags; m_nTextureFlags = nTextureFlags; m_bUseCompression = bUseCompression; - m_bUseDataSharing = bUseDataSharing; + m_bDeduplicate = bDeduplicate; } //----------------------------------------------------------------------------- diff --git a/r5dev/vpklib/packedstore.h b/r5dev/vpklib/packedstore.h index 662e421e..7fb45590 100644 --- a/r5dev/vpklib/packedstore.h +++ b/r5dev/vpklib/packedstore.h @@ -53,10 +53,10 @@ struct VPKKeyValues_t uint32_t m_nLoadFlags; uint16_t m_nTextureFlags; bool m_bUseCompression; - bool m_bUseDataSharing; + bool m_bDeduplicate; VPKKeyValues_t(const string& svEntryPath = "", uint16_t iPreloadSize = NULL, uint32_t nLoadFlags = LOAD_FLAGS_DEFAULT, - uint16_t nTextureFlags = TEXTURE_FLAGS_DEFAULT, bool bUseCompression = true, bool bUseDataSharing = true); + uint16_t nTextureFlags = TEXTURE_FLAGS_DEFAULT, bool bUseCompression = true, bool bDeduplicate = true); }; struct VPKChunkDescriptor_t