From bbc06d3c9a58bc901dd7620f9f2ad84ce6e29b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Thu, 23 May 2024 08:50:58 +0300 Subject: [PATCH] Warning on trying to read encrypted file content from pck --- src/pck/PckFile.cpp | 6 +++++- src/pck/PckFile.h | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pck/PckFile.cpp b/src/pck/PckFile.cpp index 941c1fa..2359109 100644 --- a/src/pck/PckFile.cpp +++ b/src/pck/PckFile.cpp @@ -94,7 +94,11 @@ bool PckFile::Load() if(FormatVersion == 2) { entry.Flags = Read32(); - // TODO: check encrypted flag + if(entry.Flags & PCK_FILE_ENCRYPTED) { + std::cout << "WARNING: pck file (" << entry.Path + << ") is marked as encrypted, decoding the encryption is not " + "implemented\n"; + } } entry.GetData = [offset = entry.Offset, size = entry.Size, this]() { diff --git a/src/pck/PckFile.h b/src/pck/PckFile.h index dc3f9cf..e653d4b 100644 --- a/src/pck/PckFile.h +++ b/src/pck/PckFile.h @@ -14,7 +14,8 @@ namespace pcktool { // Pck magic constexpr uint32_t PCK_HEADER_MAGIC = 0x43504447; -constexpr uint32_t PACK_DIR_ENCRYPTED = 1; +constexpr uint32_t PACK_DIR_ENCRYPTED = 1 << 0; +constexpr uint32_t PCK_FILE_ENCRYPTED = 1 << 0; // Highest pck version supported by this tool constexpr int MAX_SUPPORTED_PCK_VERSION_LOAD = 2; @@ -39,7 +40,7 @@ class PckFile { }; public: - explicit PckFile(std::string path); + explicit PckFile(std::string path); PckFile(PckFile&& other) = delete; PckFile(const PckFile& other) = delete;