mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Light CPackedStore cleanup
This commit is contained in:
parent
e9e323f9d4
commit
29b0bc389e
@ -433,13 +433,13 @@ void CPackedStore::PackWorkspace(const VPKPair_t& vPair, const string& svWorkspa
|
||||
|
||||
if (vEntryValue.m_bUseCompression)
|
||||
{
|
||||
m_lzCompStatus = lzham_compress_memory(&m_lzCompParams, s_EntryBuf, &vDescriptor.m_nCompressedSize, s_EntryBuf,
|
||||
lzham_compress_status_t lzCompStatus = lzham_compress_memory(&m_lzCompParams, s_EntryBuf, &vDescriptor.m_nCompressedSize, s_EntryBuf,
|
||||
vDescriptor.m_nUncompressedSize, nullptr);
|
||||
|
||||
if (m_lzCompStatus != lzham_compress_status_t::LZHAM_COMP_STATUS_SUCCESS)
|
||||
if (lzCompStatus != lzham_compress_status_t::LZHAM_COMP_STATUS_SUCCESS)
|
||||
{
|
||||
Warning(eDLL_T::FS, "Status '%d' for chunk '%zu' within entry '%zu' in block '%hu' (chunk packed without compression)\n",
|
||||
m_lzCompStatus, j, i, vEntryBlocks[i].m_iPackFileIndex);
|
||||
lzCompStatus, j, i, vEntryBlocks[i].m_iPackFileIndex);
|
||||
|
||||
vDescriptor.m_nCompressedSize = vDescriptor.m_nUncompressedSize;
|
||||
}
|
||||
@ -532,13 +532,13 @@ void CPackedStore::UnpackWorkspace(const VPKDir_t& vDirectory, const string& svW
|
||||
if (vChunk.m_nCompressedSize > nDstLen)
|
||||
break; // Corrupt or invalid chunk descriptor.
|
||||
|
||||
m_lzDecompStatus = lzham_decompress_memory(&m_lzDecompParams, s_DecompBuf,
|
||||
lzham_decompress_status_t lzDecompStatus = lzham_decompress_memory(&m_lzDecompParams, s_DecompBuf,
|
||||
&nDstLen, s_EntryBuf, vChunk.m_nCompressedSize, nullptr);
|
||||
|
||||
if (m_lzDecompStatus != lzham_decompress_status_t::LZHAM_DECOMP_STATUS_SUCCESS)
|
||||
if (lzDecompStatus != lzham_decompress_status_t::LZHAM_DECOMP_STATUS_SUCCESS)
|
||||
{
|
||||
Error(eDLL_T::FS, NO_ERROR, "Status '%d' for chunk '%zu' within entry '%zu' in block '%hu' (chunk not decompressed)\n",
|
||||
m_lzDecompStatus, m_nChunkCount, i, vEntryBlock.m_iPackFileIndex);
|
||||
lzDecompStatus, m_nChunkCount, i, vEntryBlock.m_iPackFileIndex);
|
||||
}
|
||||
else // If successfully decompressed, write to file.
|
||||
{
|
||||
@ -674,6 +674,8 @@ VPKChunkDescriptor_t::VPKChunkDescriptor_t(uint32_t nLoadFlags, uint16_t nTextur
|
||||
|
||||
m_nCompressedSize = nCompressedSize;
|
||||
m_nUncompressedSize = nUncompressedSize;
|
||||
|
||||
m_bIsCompressed = (m_nCompressedSize != m_nUncompressedSize);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -68,7 +68,6 @@ struct VPKChunkDescriptor_t
|
||||
uint64_t m_nUncompressedSize; // Uncompressed size of chunk.
|
||||
bool m_bIsCompressed = false;
|
||||
|
||||
VPKChunkDescriptor_t(){};
|
||||
VPKChunkDescriptor_t(FileHandle_t hDirectoryFile);
|
||||
VPKChunkDescriptor_t(uint32_t nLoadFlags, uint16_t nTextureFlags, uint64_t nPackFileOffset, uint64_t nCompressedSize, uint64_t nUncompressedSize);
|
||||
};
|
||||
@ -115,6 +114,7 @@ struct VPKDir_t
|
||||
{
|
||||
m_vHeader.m_nHeaderMarker = VPK_HEADER_MARKER; m_vHeader.m_nMajorVersion = VPK_MAJOR_VERSION;
|
||||
m_vHeader.m_nMinorVersion = VPK_MINOR_VERSION; m_vHeader.m_nDirectorySize = NULL, m_vHeader.m_nSignatureSize = NULL;
|
||||
m_nPackFileCount = NULL;
|
||||
};
|
||||
VPKDir_t(const string& svDirectoryFile);
|
||||
VPKDir_t(const string& svDirectoryFile, bool bSanitizeName);
|
||||
@ -160,10 +160,8 @@ public:
|
||||
|
||||
private:
|
||||
size_t m_nChunkCount; // The number of fragments for this asset.
|
||||
lzham_compress_params m_lzCompParams; // LZham decompression parameters.
|
||||
lzham_compress_status_t m_lzCompStatus; // LZham compression status.
|
||||
lzham_compress_params m_lzCompParams; // LZham compression parameters.
|
||||
lzham_decompress_params m_lzDecompParams; // LZham decompression parameters.
|
||||
lzham_decompress_status_t m_lzDecompStatus; // LZham decompression status.
|
||||
std::unordered_map<string, VPKChunkDescriptor_t&> m_mChunkHashMap;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user