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

RaiderZ filesystem

Read or post about compression. And decompression. Or ask questions how to decompress your files.
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: RaiderZ filesystem

Post by chrrox »

This is the same compression used in tales of xillia
iaw
advanced
Posts: 52
Joined: Wed Oct 21, 2009 12:52 pm
Has thanked: 9 times
Been thanked: 10 times

Re: RaiderZ filesystem

Post by iaw »

update!

The new version fileindex.msf ,can't unpack them :(


<link removed due forum rules violation>
Last edited by iaw on Fri Jun 08, 2012 6:49 am, edited 1 time in total.
kudpro
ultra-n00b
Posts: 1
Joined: Sun Feb 12, 2012 9:40 am

Re: RaiderZ filesystem

Post by kudpro »

How to pack back? :roll:
Jesemo
Banned
Posts: 3
Joined: Thu Apr 12, 2012 7:05 pm
Has thanked: 1 time

Re: RaiderZ filesystem

Post by Jesemo »

Could someone make an mrf unpacker for the Alpha Test NA client? I will provide the fileindex.msf.
Jesemo
Banned
Posts: 3
Joined: Thu Apr 12, 2012 7:05 pm
Has thanked: 1 time

Re: RaiderZ filesystem

Post by Jesemo »

Could someone please help?
Jesemo
Banned
Posts: 3
Joined: Thu Apr 12, 2012 7:05 pm
Has thanked: 1 time

Re: RaiderZ filesystem

Post by Jesemo »

NO LINKS TO ORIGINAL FILES ALLOWED. Ban.

These files are from the Alpha Test of RaiderZ PWE.
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 137 times

Re: RaiderZ filesystem

Post by WRS »

tiny status update, but I will find time to work on the new clients.

only the initial scrambling has changed (same filelist formats, compression algos)
Useful tool links:
Raider
ultra-n00b
Posts: 3
Joined: Thu May 31, 2012 1:30 pm
Has thanked: 2 times

Re: RaiderZ filesystem

Post by Raider »

This is great! Thanks for working on it WRS.
Raider
ultra-n00b
Posts: 3
Joined: Thu May 31, 2012 1:30 pm
Has thanked: 2 times

Re: RaiderZ filesystem

Post by Raider »

WRS, do you have a new status update for us? :)
Raider
ultra-n00b
Posts: 3
Joined: Thu May 31, 2012 1:30 pm
Has thanked: 2 times

Re: RaiderZ filesystem

Post by Raider »

I hope you can help us, like making a guide to let the script unpack the new files.
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 137 times

Re: RaiderZ filesystem

Post by WRS »

so after nearly a month of idle progress, i've got something that has dumped the filesystem for me.

i've had to think about to how to package it for XeNTaX, so I'm using aluigi's self-described 'lame patcher' - http://aluigi.org/mytoolz.htm#lpatch

you need to read the instructions, and make sure you make a copy of your client's exe before you patch it!

NOTE
if you want to check individual progress, download a debug message viewer like http://technet.microsoft.com/en-us/sysi ... 96647.aspx

edit 4

had the pmang and pwe clients mixed up. hopefully this fixes everything. download: http://www.sendspace.com/file/ddtsr7


FS Changes

I have defined the fileindex.msf structure (which hasn't changed) as:

Code: Select all

//
//	fileindex.msf structure
//	20-bytes
//	
//	NOTE: FILEINDEX_ENTRY records follows a 1-byte compression flag
//
//		3 known types (RaiderZ only uses type 0)
//		
//		0	Compressed		Data should be fed through XorData() before decompressing
//		1	Compressed++	Data needs unscrambling, which converts it to type 0
//		2	Uncompressed	(GUNZ2 FSB) Raw data - BUT the values have been scrambled (TODO)
//
struct FILEINDEX_ENTRY
{
	DWORD size;		// Uncompressed filesize
	DWORD offset;	// MRF file position
	DWORD zsize;	// Size of compressed data
	DWORD xorkey;	// 
	short lenMRFN;	// MRF container name length
	short lenName;	// Filename length
};
Files with a compression byte of 0x0:
  • Are first read into a memory buffer (from their container)
  • Using the '.xorkey' attribute are xor'd in 32-bit chunks:

    Code: Select all

    	DWORD dBlocks = srcSize >> 2;
    	while( dBlocks )
    	{
    		DWORD tmp;
    		tmp = *(DWORD *)srcBuffer; // read 32-bit value
    		
    		xorkey += tmp;
    		tmp ^= xorkey;
    		
    		*(DWORD *)srcBuffer = tmp; // write 32-bit value
    		srcBuffer += 4;
    		--dBlocks;
    	}
    
    ( the remaining bytes are converted to a 32-bit integer then xor'd in the same way )
  • The data is then decompressed. I haven't looked any further (http://aluigi.altervista.org/quickbms.htm# comtype scanner) - but some of the xml data is fairly legible after this early step

Files with a compression byte of 0x1 are handled in a similar manner to the fileindex in that the data is sent through a function which does some additional decryption which can alter the expected zsize

The uncompressed files (0x2) in GunZ2 scramble their size values somehow. I've not looked any further into this.


My Z3 module defines 4 functions which are called within the various clients:
  • GetValues - which returns 2 values that are somehow related to RSA (?)
  • PartialDec - the function which uses the keys to partial decrypt the data - used by the filelist (any 0x1 comtypes?)
  • XorData - a very simple xor function (code above) which xors based on the fileindex record
  • Uncompress - the decompression function
Once the filelist is decrypted (my code does this separately from the client) the 'regular' compressed files (0x0) are xor'ed and decrypted, before saved.

(:
Useful tool links:
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 137 times

Re: RaiderZ filesystem

Post by WRS »

Useful tool links:
skyflox
ultra-n00b
Posts: 2
Joined: Tue Jul 31, 2012 9:55 pm
Been thanked: 2 times

Re: RaiderZ filesystem

Post by skyflox »

filesystem.msf uses a simple XOR-encrypted key (AD C3 C8 A0 D2 D1 B5 31 ...), which is generated by the program based on the Raiderz.exe arrays, and possibly, the first bytes of filesystem.msf. In the version what I have, the data begin at byte 29h.
Image
Next, the file is decompressed and get a standard structure filesystem.msf described by WRM.

All files are archived as before, are archived. Let us unpack a simple example (rel_const.lua - first file in Script.mrf).
Image
Use XOR = 0x42CFD1B6 (From filesystem.msf)
Image
Important elements I've highlighted in color.
FE 77 - Encrypted file size control.

Code: Select all

	int a = 0;
	int b = 0;
	int len = fileLen;
	while(a<0x20){
	 BYTE bl = data[0];
	 src++;
	 len--;
	 int c = bl & 0x7F;
	 byte cl = a;
	 c = c << cl;
         b = b | c;
	 a +=7;
	 if(bl<0x80) break;
	};
As a result, we obtain the value of 3B FF (equal to the value of filesystem.msf), and the Data pointer moves to the top of the archival data.

F0 42 - control code, in this case, "write the 42h byte to uncompressed data."
Image
OD 29 - back to 29h bytes and copy out 7h bytes ("\0x0aCONST_")
Image
64 - write the 1Ah bytes to the uncompressed data
Image
Thus, using the simple instructions step by step we restore the original file.
Image

Code: Select all

	BYTE a = data[0];
	LPBYTE ldic = dic;
	LPBYTE ldic2 = dic2;
	ldic +=a*2;
	BYTE cl = *(BYTE *)ldic;
	WORD b = *(WORD *)ldic;
	WORD edx = (b >> 11);
	data++;dataLen--;
	DWORD ebp = *(DWORD *)data;
	ldic2 +=edx*4;
	DWORD edi = *(DWORD *)ldic2;
	data+=edx;dataLen-=edx;
	edi &=ebp;
	edx = cl;
	if(a & 3 ){
	 //Insert text from buffer
	}else{
	 //Copy text from archive
	}
dic,dic2- dictionary from Raiderz.exe

Extracting the data - easy enough, but here is the creation of the packer can be difficult.
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 137 times

Re: RaiderZ filesystem

Post by WRS »

hi skyflox, i appreciate your input!

can you tell me which version of raiderz is this from? (EU?)

edit
just discovered the 34991 download links..
http://download.frogster-online.com/FOG ... etup-1.bin
http://download.frogster-online.com/FOG ... etup-2.bin
Useful tool links:
skyflox
ultra-n00b
Posts: 2
Joined: Tue Jul 31, 2012 9:55 pm
Been thanked: 2 times

Re: RaiderZ filesystem

Post by skyflox »

I'm not sure, but I think that the EU.

Fileindex from this version (Size = 898328b)
http://dl.dropbox.com/u/96128597/fileindex.msf

Unpacked
http://dl.dropbox.com/u/96128597/fileindex_up.msf
Post Reply