Poll time! Click here: Are you interested in the chiptune scene? If so, which?. Let's see what our community thinks of the chiptune scene. :) !

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: 300 times

DX Archive Unpacker

Post by finale00 » Thu Feb 21, 2013 1:28 am

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: 300 times

Re: DX Archive Unpacker

Post by finale00 » Mon Mar 04, 2013 5:32 am

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: 300 times

Re: DX Archive Unpacker

Post by finale00 » Mon Jul 08, 2013 4:22 am

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 » Mon Jul 08, 2013 1:53 pm

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: 300 times

Re: DX Archive Unpacker

Post by finale00 » Wed Jul 10, 2013 12:45 am

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 » Wed Jul 10, 2013 4:15 pm

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: 300 times

Re: DX Archive Unpacker

Post by finale00 » Sun Aug 18, 2013 6:20 pm

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
ultra-n00b
Posts: 9
Joined: Sun Mar 14, 2010 12:51 pm
Has thanked: 3 times
Been thanked: 1 time

Re: DX Archive Unpacker

Post by newby » Mon Jan 27, 2014 2:57 pm

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: 300 times

Re: DX Archive Unpacker

Post by finale00 » Sat Feb 01, 2014 4:35 pm

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: 995
Joined: Thu Jul 26, 2012 5:06 pm
Location: Poland, Łódź
Has thanked: 514 times
Been thanked: 247 times
Contact:

Re: DX Archive Unpacker

Post by ikskoks » Wed Aug 04, 2021 7:16 pm

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