Important information: this site is currently scheduled to go offline indefinitely by end of the year.

DX Archive Unpacker

General game file tools that are useful for more than one game
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: 307 times

DX Archive Unpacker

Post by finale00 »

Here is a general tool that I wrote for unpacking DX archives (don't know what they are called, but they start with DX so I just took that).

These archives are used in various programs/games, such as
Wolf RPG Editor (basically all games using this program) - viewtopic.php?f=21&t=7981
Gensokyo Shiki - viewtopic.php?f=21&t=9468

Image

http://www.himeworks.com/tools/dxextract/

All DX archives I have come across use a 12-byte key.
This tool uses a key.ini keystore that stores all keys that the program should try before giving up. The keystore must be placed in the same location as the exe.

The exe supports GUI and command-line. If no arguments are supplied it will automatically load the GUI.
.NET 2.0 or above required.
Last edited by finale00 on Tue Mar 11, 2014 5:07 pm, edited 10 times in total.
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: 307 times

Re: DX Archive Unpacker

Post by finale00 »

Labyrinth of Touhou added to the keystore.
Key: 9DF6E8099CC39999914DF0A3
You do not have the required permissions to view the files attached to this post.
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: 307 times

Re: DX Archive Unpacker

Post by finale00 »

Added key for Rosenkreuzstilette Freudenstachel
http://www.dlsite.com/eng/work/=/produc ... 02971.html

Unfortunately, I have not gotten around to implementing the decompression routine so it can't read any of the bmp's...
CheloXL
beginner
Posts: 20
Joined: Sat Apr 09, 2011 6:41 pm
Has thanked: 2 times
Been thanked: 2 times

Re: DX Archive Unpacker

Post by CheloXL »

I really didn't took the time to try to understand the compression scheme, but it looks like some kind of pattern compression. In any case, since you are using c#, it would be pretty straightforward to convert that code to c#... you can almost copy/paste the code.

I did a really quick conversion, can't warranty this will work :)

Code: Select all

public byte[] decompress(byte[] src, int srclen, int destlen) {
		byte[] dest = new byte[destlen];
		byte m = src[8];

		int ps = 9, pd = 0;

		while (ps < srclen && pd < destlen) {
			if (src[ps] == m) {
				ps++;

				if (src[ps] == m) {
					dest[pd++] = src[ps++];

				} else {
					if (src[ps] >= m) {
						src[ps]--;
					}

					int pos, len = (src[ps] >> 3) + 4;

					byte type1 = (byte)(src[ps++] & 7);
					byte type2 = (byte)(type1 >> 2);

					type1 &= 3;

					if (type2 != 0) {
						len += src[ps++] << 5;
					}
						
					switch (type1) {
						case 0:
							pos = src[ps++] + 1;
							break;

						case 1:
							pos = src[ps] + (src[ps + 1] << 8) + 1;
							ps += 2;
							break;

						case 2:
							pos = src[ps] + (src[ps + 1] << 8) + (src[ps + 2] << 16) + 1;
							ps += 3;
							break;

						default:
							pos = 0;

							Debug.Fail("This should never happen!");
							break;
					} 

					for (int k = 0; k < len; ++k) {
						dest[pd + k] = dest[pd - pos + k];
					}

					pd += len;
				}
			} else {
				dest[pd++] = src[ps++];
			}
		}

		return dest;
	}
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: 307 times

Re: DX Archive Unpacker

Post by finale00 »

Thanks a lot. Now it decompresses things :)
File has been updated. I have also uploaded the source.
You do not have the required permissions to view the files attached to this post.
CheloXL
beginner
Posts: 20
Joined: Sat Apr 09, 2011 6:41 pm
Has thanked: 2 times
Been thanked: 2 times

Re: DX Archive Unpacker

Post by CheloXL »

Excellent!, glad to help!
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: 307 times

Re: DX Archive Unpacker

Post by finale00 »

Labyrinth of Touhou 2 added to keystore.

http://www.dlsite.com/home/work/=/produ ... 18525.html

I should really try to find a way to automatically derive the key rather than manually figuring out the key by hand. However that requires me to first assume the input is a valid DX archive...
You do not have the required permissions to view the files attached to this post.
newby
n00b
Posts: 10
Joined: Sun Mar 14, 2010 12:51 pm
Has thanked: 3 times
Been thanked: 1 time

Re: DX Archive Unpacker

Post by newby »

Hello, can you help me with something?
I have tried your program to unpack the SmokingWOLF RPG One Way Heroics, but it did not work.

One Way Heroics can be purchased on PlayISM for 1.99$ (or more if you want):

Code: Select all

http://playism-games.com/games/onewayheroics/
I just want to extract the resources (for translation to my language)
Here are the sample file and exe:

Code: Select all

http://www.sendspace.com/file/kelhp9
Thank you for your time and for your help.
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: 307 times

Re: DX Archive Unpacker

Post by finale00 »

I don't understand the problem. It looks like a regular wolf RPG game, and I can export the sound files without any issues.
User avatar
ikskoks
Moderator
Posts: 1666
Joined: Thu Jul 26, 2012 5:06 pm
Location: Poland, Łódź
Has thanked: 647 times
Been thanked: 431 times
Contact:

Re: DX Archive Unpacker

Post by ikskoks »

Hi all, I just wanted to point out that this tool and whole keystore for it is heavily outdated.
Tool was not updated since 2014 and it doesn't really support newer archives (like version 6, 7 and 8 ).

For now, it's better to use DXADecode.exe from DXLibrary which is dealing great with unpacking data.
Also, more recent information about file format can be found on our wiki http://wiki.xentax.com/index.php/DX_Archive
Post Reply