so, I stumbled upon the TNM 1.0.5 thread where someone suggested to make savegames smaller — which reminded me that I still had some code lying around from when I was convinced saving and loading in Deus Ex was disk-bound and could be made faster by writing less data (hint: saving and loading in Deus Ex is not disk-bound and can not be made faster by writing less data). I kinda dropped it at the time because it didn't do what I wanted, but it does make savegames smaller so I decided to polish it up some and publish it.
Code: https://bitbucket.org/fk/dx-savegamecompression
Binaries: https://bitbucket.org/fk/dx-savegamecom ... on-0.1.zip
In short, it decreases on-disk size of savegames simply by:
- transparently compressing the files using Deflate (it's actually a bit more effective than NTFS compression
- creating hard links instead of copying files. Deus Ex happily copies and duplicates files when loading and saving, so by not actually copying them, you can reduce the amount of non-shared disk space per savegame (and in an optimistic scenario, that's actually quite a lot).
Let's have an example: I had a savegame in Hong Kong with an uncompressed size of ~24.4 MB. Fully compressed, that same savegame had a size of ~7.7 MB — just about a third of the normal size. But wait, it gets better: That savegame is on the Canals map, the file for which is ~1.5 MB big. Let's assume you'd load that savegame, then immediately quicksave. In this case, the only files that need to be changed for that quicksave are 06_HongKong_WanChai_Canal.dxs — the state of the Canals map — and SaveInfo.dxs (compressed about 13 kB); all other files are shared with the original savegame, so ultimately the new quicksave only uses about 1.5 MB of unique diskspace instead of ~24 MB. So in short, you get a ~66% reduction for free and potentially additional savings. It's quite neat, if I may say so.
There are some additional caveats that aren't (yet?) mentioned in the readme:
- Hardlinking will probably not work if you use Kentie's launcher (because of how it actually stores savegame files in a different location); I didn't test it yet but I think it'll crash when you try to save or load.
- I did some non-reliable speed tests — loading a compressed savegame seems to be as fast as loading a normal one; saving times /seem/ to be slower however (though saving just took 1-2 seconds instead of <1 in my test scenario). I have an idea why that might be and how it could be fixed.
Feedback and bug reports are welcome. I hope somebody finds this stuff useful