Join also our Discord channel! Click here.

Decompress .x files

Read or post about compression. And decompression. Or ask questions how to decompress your files.
Post Reply
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 297 times

Decompress .x files

Post by finale00 » Thu Dec 29, 2011 4:20 am

I tried writing a bms script for this but am not getting it right.

According to some docs, if the header says bzip then it's a "MSZip Compressed Binary File"
The header is 16 bytes long, followed by a long that represents the decompressed size.

I don't know what compression that is though.
Some samples
You do not have the required permissions to view the files attached to this post.

User avatar
chrrox
Moderator
Posts: 2564
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1307 times

Re: Decompress .x files

Post by chrrox » Thu Dec 29, 2011 4:58 am

you have the size wrong.
the format goes
0x10 Header
0x4 Total Uncompressed size
then you have chunks till you fill the size
0x2 uncompressed size
0x2 compressed size
data
this repeats till you fill the first size

finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 297 times

Re: Decompress .x files

Post by finale00 » Thu Dec 29, 2011 5:03 am

OH. Hmm. That's pretty complicated.
I wonder if this applies to all bzip formats or whether this is proprietary as well, since the company provided their own converter. I'll have to look at more files from other games.

What's the compression?
Last edited by finale00 on Thu Dec 29, 2011 5:05 am, edited 1 time in total.

User avatar
chrrox
Moderator
Posts: 2564
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1307 times

Re: Decompress .x files

Post by chrrox » Thu Dec 29, 2011 5:05 am

you can just try these tools here
http://openbve.freeforums.org/compresse ... -t125.html
then the next 2 bytes are ignored and you use the inflate compression.

just use offzip.exe -a -z -15 to see where it starts and stuff.

if you need help with a script let me know but it should be easy now.

finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 297 times

Re: Decompress .x files

Post by finale00 » Thu Dec 29, 2011 5:36 am

Offzip worked for the small files but it prints a lot of errors for this one:
You do not have the required permissions to view the files attached to this post.

User avatar
aluigi
VVIP member
VVIP member
Posts: 1917
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 645 times
Contact:

Re: Decompress .x files

Post by aluigi » Sat Dec 31, 2011 12:42 pm

this type of file has been already discussed here on xentax, use google with the following keywords:
"xof" site:xentax.com

finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 297 times

Re: Decompress .x files

Post by finale00 » Sat Dec 31, 2011 3:23 pm

4 topics came up, but none of them seem to talk about how the compression works.

User avatar
chrrox
Moderator
Posts: 2564
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1307 times

Re: Decompress .x files

Post by chrrox » Sat Dec 31, 2011 6:54 pm


User avatar
chrrox
Moderator
Posts: 2564
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1307 times

Re: Decompress .x files

Post by chrrox » Sun Jun 10, 2012 6:40 pm

these files load into deep exploration after they are decompressed with this script.
viewtopic.php?f=21&t=9064
Image
what game is it?

User avatar
shekofte
mega-veteran
mega-veteran
Posts: 218
Joined: Sun Jan 18, 2009 1:45 pm
Location: Sagittarius
Has thanked: 247 times
Been thanked: 16 times
Contact:

Re: Decompress .x files

Post by shekofte » Tue Jun 19, 2012 5:03 pm

I am very interested in this subject too

so i wrote a 010 editor binary template for standard .cab files :

Code: Select all

struct CFHEADER {
byte signature[4];
ulong reserved1;
ulong cbCabinet;
ulong reserved2;
ulong coffFiles;
ulong reserved3;
ubyte versionMinor;
ubyte versionMajor;
ushort cFolders;
ushort cFiles;
ushort flags;
ushort setID;
ushort iCabinet;
}check;

struct CFFOLDER {
ulong coffCabStart;
ushort cCFData;
ushort typeCompress;
}check;

struct CFFILE {
ulong cbFile;
ulong uoffFolderStart;
ushort iFolder;
DOSDATE date;
DOSTIME time;
ushort attribs;
byte szName[];
}check;

struct CFDATA {
ulong csum;
ushort cbData;
ushort cbUncomp;
byte ab[cbData];
}check;

reference : http://msdn.microsoft.com/en-us/library/bb417343


OUTPUT :

Code: Select all

         NAME                            value                start           size
======================================================================================                                                                             
byte signature[4]                        MSCF                 0               4
ulong reserved1                          0                    4               4
ulong cbCabinet                          356                  8               4
ulong reserved2                          0                    12              4
ulong coffFiles                          44                   16              4
ulong reserved3                          0                    20              4
ubyte versionMinor                       3                    24              1
ubyte versionMajor                       1                    25              1
ushort cFolders                          1                    26              2
ushort cFiles                            1                    28              2
ushort flags                             0                    30              2
ushort setID                             0                    32              2
ushort iCabinet                          0                    34              2
                                                                             
ulong coffCabStart                       67                   36              4
ushort cCFData                           1                    40              2
ushort typeCompress                      1                    42              2
                                                                             
ulong cbFile                             1024                 44              4
ulong uoffFolderStart                    0                    48              4
ushort iFolder                           0                    52              2
DOSDATE date                             06/19/2012           54              2
DOSTIME time                             19:18:34             56              2
ushort attribs                           32                   58              2
byte szName[7]                           sparse               60              7
                                                                             
ulong csum                               360354650            67              4
ushort cbData                            281                  71              2
ushort cbUncomp                          1024                 73              2
byte ab[281]                             CK...                75              281

but when i tried to write its corresponding QUICKBMS script for extraction of compressed date , i can't use "comtype command" of QUICKBMS !
even by testing lzxcab , cabextract , ... compression algorithms !
PLEASE HELP ME ?

also the attachment contains : makecab.exe and expand.exe , 010 editor binary template , samples .

DirectX File Format Architecture :
http://local.wasp.uwa.edu.au/~pbourke/d ... s/directx/
You do not have the required permissions to view the files attached to this post.
ILLUSORY VIDEO GAMES ARE MORE IMPORTANT THAN PRECIOUS INTERNATIONAL FOOTBALLs

User avatar
shekofte
mega-veteran
mega-veteran
Posts: 218
Joined: Sun Jan 18, 2009 1:45 pm
Location: Sagittarius
Has thanked: 247 times
Been thanked: 16 times
Contact:

Re: Decompress .x files

Post by shekofte » Tue Mar 12, 2013 9:52 pm

very good news ! now quickbms supports decompression of mszip ... I hope Luigi Auriemma live a thousand years !
by this way i wrote the equivalent BMS script of my previous 010 binary template for cabinet files:

Code: Select all

comtype mszip

idstring "MSCF"
get signature long
get reserved1 long
get cbCabinet long
get reserved2 long
get coffFiles long
get reserved3 long
get versionMinor byte
get versionMajor byte
get cFolders short
get cFiles short
get flags short
get setID short
get iCabinet short
get coffCabStart long
get cCFData short
get typeCompress short
get cbFile long
get uoffFolderStart long
get iFolder short
get date short
get time short
get attribs short

get szName string

get csum long
get cbData short
get cbUncomp short

savepos offset
clog UNCAB offset cbData cbUncomp 
and this is my quick and dirty script for decompressing (demoting degree of) .x files
wonderful that we can use it in batch processing of many .x files simultaneously

Code: Select all

comtype mszip

idstring "xof "
getdstring major 2
getdstring minor 2
getdstring type 4
getdstring floatsize 4
get skip 4
get unzip short
get zip short

savepos offset
clog demote offset zip unzip
ILLUSORY VIDEO GAMES ARE MORE IMPORTANT THAN PRECIOUS INTERNATIONAL FOOTBALLs

Post Reply