pleonex/tinke

Decompress with auto-detected formats

MetLob opened this issue · 0 comments

Hi!
I implemented import image of an "arc" files of the Pr. Layton. For one of this files reading/decompressing is wrong:
http://file.qip.ru/file/7W6WBBd4/wifimenu_sub.html

This is russian version of file and created by another tools, but it correctly opening in the game.

Go to LAYTON/Bg.cs in method Read() to line pluginHost.Decompress(temp);

after execution of this line decompressed file has contain compressed data in first and valid decompressed in last.

But i include in dependences DSdecmp dll and change this line to:

        fileIn = Path.GetDirectoryName(temp) + Path.DirectorySeparatorChar + "de" + Path.DirectorySeparatorChar + Path.GetFileName(temp);
        Directory.CreateDirectory(Path.GetDirectoryName(fileIn));
        DSDecmp.Main.Decompress(temp, fileIn, DSDecmp.Main.Get_Format(temp));

Then result is correct.

I see, that pluginHost.Decompress(temp) using Decompress method (public static void Decompress(string input, string output)) in DSdecmp.Main class, which may be return invalid decompressed stream or detected invalid format?

DecompressEvent in Tinke project use DSDecmp.Main.Get_Format(temp) to detect invalid format but not using this in later:

          FormatCompress compressFormat = DSDecmp.Main.Get_Format(arg);
            if (compressFormat != FormatCompress.Invalid)
                DSDecmp.Main.Decompress(arg, dec_file, compressFormat);

May be better it will be so DSDecmp.Main.Decompress(arg, dec_file, compressFormat); ?

Or replace code with detection of compress formats in DSDecmp.Main.Decompress() method by DSDecmp.Main.GetFormat() ? Or both changes is better?

Or my file is invalid? But if I decompressing this by Tinke GUI from combo box "Open As" with action "Compress" from 0x4 offset - all correct.