Required for full support for Traditional Chinese FFXIV ( TexTools/FFXIV_TexTools_UI#357 )
Currently modded game files are only written out to brand new dat files (i.e. 040000.win32.dat7) . This was always possible in the past, but the recent Traditional Chinese version of FFXIV has allocated all 8 possible dat files from 040000.win32.dat0 to 040000.win32.dat7
The maximum size of a dat file is 32GB.
Current plan is to implement a mechanism where a dat file can be chosen to write in to, we make it sparse, and then mod files are written at some deeper offset in to the file.
- A fixed 16GB offset for mods was proposed, however this would cause significant disk space wastage in the cases where the sparseness is lost. This could be caused by something like copying the files across drives/network, zipping and unzipping, etc.
- Personally I think an offset of 4GB, on the highest numbered dat file under 4GB, might be preferable?
- There's not much worry about Linux, as I think files generally will be sparse by default anyway
Generated dat files are currently marked with a magic number, so we know when they are safe to write in to or delete. It is still possible to mark the vanilla game files with a unique mark -- I believe that it is relatively safe when it comes to patching -- however it possible for an update to replace the dat file header data.
Instead of only marking the dat file header, I propose writing a magic signature to the start of the modded data offset, i.e., 4GB in to the file, followed by some metadata (such as the original file length).
All of the other worries come from what will happen if someone patches the game without doing a "Start Over" to remove all of their mods, while also being unable to query back the sparse ranges of the file...
We need to remember the original file size, so the dat file can be reverted back to its original size for "Start Over". Ideally we want to be able to do this without a risk of corrupting the dat file by over-truncating it if it were patched to a larger size.
- It is possible to query back the sparse range, however it is not great to rely on the file remaining sparse (it probably also doesn't work under WINE)
- Scanning for a very long sequence of zeroes doesn't seem reliable as a fallback, either.
I propose writing a magic signature not only 4GB in to the file, but also a large portion beginning what was previously the end of the file as well, to act as a canary to detect if a patch added data.
There is slim chance that a patch writes around these magic sections, and then of course we will have a corrupted dat file as well. Again, though, this can still be detected, as long as the sparse ranges in the file can be queried back.
Here's a pretty picture of how the dat files would look vanilla vs modded
Finally any advice about deleting dat7 needs to be purged from existence. :)
Required for full support for Traditional Chinese FFXIV ( TexTools/FFXIV_TexTools_UI#357 )
Currently modded game files are only written out to brand new dat files (i.e. 040000.win32.dat7) . This was always possible in the past, but the recent Traditional Chinese version of FFXIV has allocated all 8 possible dat files from 040000.win32.dat0 to 040000.win32.dat7
The maximum size of a dat file is 32GB.
Current plan is to implement a mechanism where a dat file can be chosen to write in to, we make it sparse, and then mod files are written at some deeper offset in to the file.
Generated dat files are currently marked with a magic number, so we know when they are safe to write in to or delete. It is still possible to mark the vanilla game files with a unique mark -- I believe that it is relatively safe when it comes to patching -- however it possible for an update to replace the dat file header data.
Instead of only marking the dat file header, I propose writing a magic signature to the start of the modded data offset, i.e., 4GB in to the file, followed by some metadata (such as the original file length).
All of the other worries come from what will happen if someone patches the game without doing a "Start Over" to remove all of their mods, while also being unable to query back the sparse ranges of the file...
We need to remember the original file size, so the dat file can be reverted back to its original size for "Start Over". Ideally we want to be able to do this without a risk of corrupting the dat file by over-truncating it if it were patched to a larger size.
I propose writing a magic signature not only 4GB in to the file, but also a large portion beginning what was previously the end of the file as well, to act as a canary to detect if a patch added data.
There is slim chance that a patch writes around these magic sections, and then of course we will have a corrupted dat file as well. Again, though, this can still be detected, as long as the sparse ranges in the file can be queried back.
Here's a pretty picture of how the dat files would look vanilla vs modded
Finally any advice about deleting dat7 needs to be purged from existence. :)