How to decompress the compressed DirectX file format #332

Closed
opened 2026-01-29 22:10:15 +00:00 by claunia · 1 comment
Owner

Originally created by @s520 on GitHub (Nov 16, 2018).

I am trying to load a compressed DirectX file format.

The structure of this compressed X file is as follows.

First, the first 16 bytes are the header.

The next 4 bytes represent the size of the decompressed X file including the header.

After that one or more data blocks are arranged.

The structure of the data block is as follows.

The first two bytes represent the size after decompression of that compressed block.

The next two bytes represent the size of that compressed block.

After that, it is compressed block in MSZIP format.

Currently I succeeded in decompressing the first data block, but I have failed to decompress after the second one.

I attach a sample file and a sample program that performs decompression.
DecompressedXFileTest.zip

First, "test1.x" is a file which succeeds in decompression.

The result after the extension "test1.result.x" matches the expected result "test1.expectedResult.x".

Next, "test2.x" is a file that fails to decompress.

"test2.result.x" which is the result after elongation does not match the expected result "test2.expectedResult.x".

The difference between "test1.x" and "test2.x" is whether the number of data blocks is one or more.

How can I properly decompress "test2.x"?

(This issue is related to #418 .)

Originally created by @s520 on GitHub (Nov 16, 2018). I am trying to load a compressed DirectX file format. The structure of this compressed X file is as follows. First, the first 16 bytes are the header. The next 4 bytes represent the size of the decompressed X file including the header. After that one or more data blocks are arranged. The structure of the data block is as follows. The first two bytes represent the size after decompression of that compressed block. The next two bytes represent the size of that compressed block. After that, it is compressed block in MSZIP format. Currently I succeeded in decompressing the first data block, but I have failed to decompress after the second one. I attach a sample file and a sample program that performs decompression. [DecompressedXFileTest.zip](https://github.com/adamhathcock/sharpcompress/files/2589996/DecompressedXFileTest.zip) First, "test1.x" is a file which succeeds in decompression. The result after the extension "test1.result.x" matches the expected result "test1.expectedResult.x". Next, "test2.x" is a file that fails to decompress. "test2.result.x" which is the result after elongation does not match the expected result "test2.expectedResult.x". The difference between "test1.x" and "test2.x" is whether the number of data blocks is one or more. How can I properly decompress "test2.x"? (This issue is related to #418 .)
Author
Owner

@s520 commented on GitHub (Nov 22, 2018):

This problem was resolved with the following pull request.
https://github.com/leezer3/OpenBVE/pull/291

@s520 commented on GitHub (Nov 22, 2018): This problem was resolved with the following pull request. https://github.com/leezer3/OpenBVE/pull/291
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#332