ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Dec 10, 2018 4:56 am

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Oct 04, 2018 12:08 am 

Joined: Fri May 27, 2016 2:28 pm
Posts: 53
Hello

DDS image compressed with lzma86dechead and can be successfully decompressed by suitable comtype.

Header when its compressed is:
Code:
00 5D 00 00   80 00 80 00   04 00 00 00 ...


OK. Now it should be compressed back. But with comptype lzma_86dechead_compress, output file have header:
Code:
2C 00 00 00   08 00 80 00   04 00 00 00 ...


Obviously, that is not the result what needed.

Maybe should be some right dictionary for this?

Thanks in advance.
Samples of compressed and source image in attach.


Attachments:
lzma.zip [91.72 KiB]
Downloaded 7 times
Top
   
PostPosted: Thu Oct 04, 2018 12:29 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9414
Why not? The first byte is a set of flags and both 0x5d and 0x2c are perfectly valid.


Top
   
PostPosted: Thu Oct 04, 2018 12:46 am 

Joined: Fri May 27, 2016 2:28 pm
Posts: 53
IDK, that's just doesn't work. I tryed change flag from 0x2c to 0x5d, but game engine is crash anyway.
That's game is Far Cry Instincts Predator, if important. I writing a packing script for it.

Script is working, packing correct without compression. So, all problem in that compression method. CryEngine is so capricious )

Well, maybe it's still possible packing with "old' lzma_86dechead_compress method, with 0x5d and so on?


Last edited by StreamThread on Thu Oct 04, 2018 5:03 pm, edited 1 time in total.

Top
   
PostPosted: Thu Oct 04, 2018 1:19 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 9414
I doubt the crash is caused by the properties used by quickbms for better compressing the data (necessary for the original reimport mode), because the compression is just that one and the only difference is a setting supported by the algorithm itself.

This is what quickbms uses for the settings, in lzma_set_properties() in unz.c:
Code:
        props->level = 9;            /*  0 <= level <= 9 */
        props->dictSize = 1<<dictsz; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
                                       (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
                                       default = (1 << 24) */
        // xz wants lc+lp <= 4
        //props->lc = 1;               /* 0 <= lc <= 8, default = 3 */
        //props->lp = 3;               /* 0 <= lp <= 4, default = 0 */
        props->lc = 8;               /* 0 <= lc <= 8, default = 3 */
        props->lp = 4;               /* 0 <= lp <= 4, default = 0 */

        props->pb = 0; /* yeah 0!*/  /* 0 <= pb <= 4, default = 2 */
        //props->algo = 1;             /* 0 - fast, 1 - normal, default = 1 */
        props->fb = 273;             /* 5 <= fb <= 273, default = 32 */
        //props->btMode = 1;           /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
        props->numHashBytes = 4;     /* 2, 3 or 4, default = 4 */
        //props->mc = (1 << 30);       /* 1 <= mc <= (1 << 30), default = 32 */
If I remember correctly the "pb" field set to zero provided better results during my tests and it's the one that probably resulting in 0x5d->0x2c (which is NOT a constant magic, it's a set of flags).

Some info about these fields:
https://stackoverflow.com/questions/305 ... gs-details


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited