aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/zfsArchive.h
diff options
context:
space:
mode:
authorrichiesams2013-06-12 22:06:05 -0500
committerrichiesams2013-08-04 13:31:42 -0500
commitef37f14d539d417a1a4506c5c09df1409700aa30 (patch)
tree5aece099c5ef8cfbc3e0d23daa1f310e865696a5 /engines/zvision/zfsArchive.h
parent179f5de49897a723b2605a0fed18980ce144f68c (diff)
downloadscummvm-rg350-ef37f14d539d417a1a4506c5c09df1409700aa30.tar.gz
scummvm-rg350-ef37f14d539d417a1a4506c5c09df1409700aa30.tar.bz2
scummvm-rg350-ef37f14d539d417a1a4506c5c09df1409700aa30.zip
ZVISION: Add xor encryption handling to ZfsArchive class
Diffstat (limited to 'engines/zvision/zfsArchive.h')
-rw-r--r--engines/zvision/zfsArchive.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/engines/zvision/zfsArchive.h b/engines/zvision/zfsArchive.h
index 96c002f815..718b26c836 100644
--- a/engines/zvision/zfsArchive.h
+++ b/engines/zvision/zfsArchive.h
@@ -32,10 +32,10 @@ namespace ZVision {
struct ZfsHeader {
uint32 magic;
uint32 unknown1;
- uint32 unknown2;
+ uint32 maxNameLength;
uint32 filesPerBlock;
uint32 fileCount;
- uint32 xorKey;
+ byte xorKey[4];
uint32 fileSectionOffset;
};
@@ -85,10 +85,34 @@ public:
private:
const Common::String _fileName;
+ ZfsHeader _header;
ZfsEntryHeaderMap _entryHeaders;
+ /**
+ * Parses the zfs file into file entry headers that can be used later
+ * to get the entry data.
+ *
+ * @param stream The contents of the zfs file
+ */
void readHeaders(Common::SeekableReadStream *stream);
+
+ /**
+ * Entry names are contained within a 16 byte block. This reads the block
+ * and converts it the name to a Common::String
+ *
+ * @param stream The zfs file stream
+ * @return The entry file name
+ */
Common::String readEntryName(Common::SeekableReadStream *stream) const;
+
+ /**
+ * ZFS file entries can be encrypted using XOR encoding. This method
+ * decodes the buffer in place using the supplied xorKey.
+ *
+ * @param buffer The data to decode
+ * @param length Length of buffer
+ */
+ void unXor(byte *buffer, int length, const byte *xorKey) const;
};
} // End of namespace Common