Difference between revisions of "ZiPatch File Structure"
(→ADIR) |
(→History) |
||
Line 1: | Line 1: | ||
=== History === | === History === | ||
− | ZiPatch (.patch) files are a compressed file format for FINAL FANTASY XIV. This file format was later modified in 2012 for DRAGON QUEST X and FINAL FANTASY XIV: A Realm Reborn, which are more similar in their DAT structure to each other than to FINAL FANTASY XIV. As such, many of the block types found in this version have been deprecated | + | ZiPatch (.patch) files are a compressed file format for FINAL FANTASY XIV. This file format was later modified in 2012 for DRAGON QUEST X and FINAL FANTASY XIV: A Realm Reborn, which are more similar in their DAT structure to each other than to FINAL FANTASY XIV. As such, many of the block types that are found in this version have been deprecated. Static analysis of the A Realm Reborn executables indicate that they may still be able to read this version. |
+ | |||
+ | Initial, minimal research of the ZiPatch file format was made publically available by Jean-Philip Desjardins for the SeventhUmbral FINAL FANTASY XIV 1.23b server emulator here: [https://github.com/jpd002/SeventhUmbral/blob/master/launcher/PatchFile.cpp] | ||
=== File Header === | === File Header === |
Revision as of 17:17, 6 June 2019
History
ZiPatch (.patch) files are a compressed file format for FINAL FANTASY XIV. This file format was later modified in 2012 for DRAGON QUEST X and FINAL FANTASY XIV: A Realm Reborn, which are more similar in their DAT structure to each other than to FINAL FANTASY XIV. As such, many of the block types that are found in this version have been deprecated. Static analysis of the A Realm Reborn executables indicate that they may still be able to read this version.
Initial, minimal research of the ZiPatch file format was made publically available by Jean-Philip Desjardins for the SeventhUmbral FINAL FANTASY XIV 1.23b server emulator here: [1]
File Header
ZiPatch files have a unique file header, which is used to identify the file format. The ZiPatch File Header is immediately followed by n blocks, each of which carry specific instructions.
91 5A 49 50 41 54 43 48 0D 0A 1A 0A ‘ZIPATCH....
Block Structure
[StructLayout(LayoutKind.Sequential, Pack=4)] struct Block { int _dataSize; // Little Endian byte[] _data; // data.Length is dataSize + 4 (inclusive of block type identifier) [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)] byte[] _crc; // crc is a standard CRC32 checksum (RFC 1952) of data }
The slice of data[0..3] is a string used to identify the block type. Static analysis of ffxivupdater.exe indicates the following block types as valid.
FHDR APLY APFS ETRY ADIR DELD
FHDR
FHDR (File Header) blocks are an abstract of the changes that will take place as a result of applying the ZiPatch in terms of the type and count of the changes to be made.
[StructLayout(LayoutKind.Sequential, Pack=4, Size=20)] struct FileHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)] byte[] _version; // version format is unknown, but may be major/minor. Analysis of ffxivupdater.exe indicates the string FileHeaderV2. [00 00 02 00] observed [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)] byte[] _result; // DIFF or HIST observed int _numEntryFile; // Little Endian int _numAddDirectory; // Little Endian int _numDeleteDirectory; // Little Endian }
APLY
APFS
ETRY
ADIR
ADIR blocks provide instructions to make changes directly to the filesystem by creating a new directory for the specified path, relative to the installation directory, if it does not already exist.
[StructLayout(LayoutKind.Sequential)] struct ADIR { }