VitaSmith / gust_tools

A set of utilities for dealing with Gust (Koei Tecmo) PC games files
Other
215 stars 24 forks source link

Gust_Enc decodes files fine, but won't encode #21

Closed vedaxi52 closed 4 years ago

vedaxi52 commented 4 years ago

Running Gust_enc.exe on Atelier Ryza, I have the JSON file set to A21 for the seed, yet it won't encode files properly, it will only decode them. When I attempt to encode a file, it spits out a file of the same size as the unencoded XML, this file it spits out also can't be decoded and throws the issue "Glaze decompression buffer is too small"

VitaSmith commented 4 years ago

Thanks for the report.

It's possible I introduced a regression with the latest version of the tools, as I had to modify gust_enc extensively to add support for Fairy Tail.

While I investigate the issue, you may want to use the 1.19 version of gust_enc as you may find that it works better...

vedaxi52 commented 4 years ago

Using 1.19 resolved the issue, though the file size is larger than the base encoded one. Thank you!

VitaSmith commented 4 years ago

The "recompressed" file size being larger than the uncompressed one is absolutely normal.

There's very little point in adding actual compression for modding, and I just don't have time to spare to reengineer a whole compression algorithm (since we don't have a source for that, even from the disassembly) just to be on par with what Gust does, as it doesn't affect our ability to create files that the engine will accept. So we just shove the whole uncompressed file into a dictionary and then add a bunch of "copy from dictionary" commands for our decompression as a very efficient shortcut

Now, if someone can point me to a public source for the compression algorithm that Gust use, I'll be more than happy to improve on the compression. But until then, files "compressed" by gust_enc will always be larger than the uncompressed version.

Outside of this, I'll fix the regression from 1.19 when I get a chance.

VitaSmith commented 4 years ago

This should be fixed in the latest release. Thanks again for reporting the issue!