summaryrefslogtreecommitdiffstats
path: root/core/io/file_access_pack.h
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2020-04-28 20:51:29 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2020-09-05 14:53:39 +0300
commitf043eabdd84a509abf5266bb444d19af3e26b7c6 (patch)
treeb919d337e8edce9be6b1403b29b58707eee478be /core/io/file_access_pack.h
parent52f6ac81be14fe3f7dacb2e2b75d9bf9a668b628 (diff)
downloadredot-engine-f043eabdd84a509abf5266bb444d19af3e26b7c6.tar.gz
Adds PCK encryption support (using script encryption key for export).
Change default encryption mode from ECB to CFB.
Diffstat (limited to 'core/io/file_access_pack.h')
-rw-r--r--core/io/file_access_pack.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 6e316119cb..d934b0deb5 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -40,7 +40,15 @@
// Godot's packed file magic header ("GDPC" in ASCII).
#define PACK_HEADER_MAGIC 0x43504447
// The current packed file format version number.
-#define PACK_FORMAT_VERSION 1
+#define PACK_FORMAT_VERSION 2
+
+enum PackFlags {
+ PACK_DIR_ENCRYPTED = 1 << 0
+};
+
+enum PackFileFlags {
+ PACK_FILE_ENCRYPTED = 1 << 0
+};
class PackSource;
@@ -56,6 +64,7 @@ public:
uint64_t size;
uint8_t md5[16];
PackSource *src;
+ bool encrypted;
};
private:
@@ -102,7 +111,7 @@ private:
public:
void add_pack_source(PackSource *p_source);
- void add_path(const String &pkg_path, const String &path, uint64_t ofs, uint64_t size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files); // for PackSource
+ void add_path(const String &pkg_path, const String &path, uint64_t ofs, uint64_t size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files, bool p_encrypted = false); // for PackSource
void set_disabled(bool p_disabled) { disabled = p_disabled; }
_FORCE_INLINE_ bool is_disabled() const { return disabled; }
@@ -135,6 +144,7 @@ class FileAccessPack : public FileAccess {
mutable size_t pos;
mutable bool eof;
+ uint64_t off;
FileAccess *f;
virtual Error _open(const String &p_path, int p_mode_flags);