Page 1 of 3

RaiderZ filesystem

Posted: Mon Jan 24, 2011 3:45 pm
by WRS
The second closed beta test of RaiderZ revealed a new filesystem. I wanted to take a quick look at what's new!

Note: This isn't a request or a solution, but definitely falls under the 'compression methods' category!


Previously
Previously, the MRS format was used to store files.

This same format (and version) was used in another game by this developer (MAIET) - GunZ - and uses a modified ZIP format to compress the headers. See: viewtopic.php?f=21&t=4871

MRS files were loaded from hard-coded names in the RaiderZ executable.. not anymore!

A File List!
In the installation directory is the new filesystem's file list - meet fileindex.msf!

This MSF file is the very first file read as it contains everything about the filesystem that's needed to load all the right files, and, naturally, there is some protection..

I should first say that 'fileindex.msf' is slightly different from other MSF files in that the uncompressed size is added to the MSF data like so:

Code: Select all

uint32 uSize;
uint8 Data[ .. ]
When reading the file list, RaiderZ first reads the data into it's own file so uSize doesn't interfere with the MSF reading (see below).

MSF files
Each MSF has a corresponding uncompressed size value from the file list (or, with the case of filelist.msf, the value preceeding the data - see above).

The MSF data is fed through an XOR table function (pseudo-code):

Code: Select all

// data != null and filesize > 0

EAX = FileSize -1;

while(EAX)
{
  CL = data[EAX -1]
  CL >>= 1;
  EBX = EAX & 0xFFFF;
  CL ^= table[EBX]
  data[EAX] ^= CL
  EAX--;
}

AL = data[FileSize -1]
AL >>= 1;
AL ^= table[0]
AL ^= data[0] // AL is now 0x00
data[0] = AL
The XOR table is 64 KB, which I've dumped for reference purposes. It could be dynamically calculated at runtime, but I've not followed this up!

See attachment

The next step is the decompression. Now I'm not interested in following all that as it's sure to change before release! For the purposes of exploring the file list, I just dumped the result.

A File List! Decrypted!
Now decrypted, the file list takes the following format:

Code: Select all

while (!EoF())
{
  uint32 uSize
  uint32 Pos // relative to the MRF file
  uint32 PackedSize
  uint16 MRFNameLen
  uint16 FileNameLen
  uint32 UNKNOWN
  char MRFName[ MRFNameLen ]
  char FileName[ FileNameLen ]
}
Files can now be read from the filesystem using this table structure - the Pos and PackedSize values point to the size and position within the MRF file (see MRF file notes below).

MRF files
MRS files are literally just MSF files which have been joined together :eek: The MSF files can be read off using the decrypted file list!

Once the MSF is read off the MRF package, it's processed like I've already described! That's everything!

Edits Formatting!

Re: RaiderZ filesystem

Posted: Sun Jul 03, 2011 8:07 pm
by WRS
Updates!

In response to a request, aluigi has added the msf compression algorithm to quickbms (from 0.5.2)!

So here is how I've made use of it:
  • I wrote up the xor table (which i dumped above) into bms - i'm now generating it as the clients are
  • I wrote up the fileindex parsing into bms (i described this format above)
  • The final script dumps the entire file system
So the script works for both existing RealSpace3 games - GunZ 2 and RaiderZ.

It does take a while to run - and it uses a few memory_file (including the ~400kb fileindex)

5617 files in 489 seconds (8 minutes)

Again, thanks to aluigi - for his dedication to updating quickbms

Re: RaiderZ filesystem

Posted: Tue Jul 26, 2011 7:51 pm
by elmon
well, i guess this script is useless without client :D
So... Please, could you upload last cbt korean client? As i've understood you have it:)
P.s. Good uploader (for such a big files): http://filedropper.com
P.p.s Biiig thanks for a quickbms script:)

Re: RaiderZ filesystem

Posted: Wed Jul 27, 2011 6:01 am
by finale00
Google it. It's circulating since people have set up private servers already.

Re: RaiderZ filesystem

Posted: Wed Jul 27, 2011 8:02 am
by elmon
I found it after posting, but that is a client from E3 expo, bause some maps,models,animation etc are missing, and there are some specific maps like SomeLocation(E3)
Im trying to get into korean beta, but i don't have an account on pmang.com, because of lack of kssn's :(

Re: RaiderZ filesystem

Posted: Wed Jul 27, 2011 10:20 am
by Cain142
Client can be found here

http://www.cultureandchaosmmo.com/downl ... taller.exe

And what i can see there is no date set for CBT3 korean version yet.
I been browsing their site every day now to get the new client once they release it ill upload it to a host.

Re: RaiderZ filesystem

Posted: Wed Jul 27, 2011 3:01 pm
by elmon
wow) guess we got too offtopic :D
Ive got a question on fs structure:
Mrf is a all files packed and merged into one big file?

off:@cain142 do you have login at pmang.com? :eek:

Re: RaiderZ filesystem

Posted: Fri Jul 29, 2011 3:02 am
by finale00
Yes. WRS has also written a bms script for the MRF archives. Search the forums for it :)

Re: RaiderZ filesystem

Posted: Fri Jul 29, 2011 8:38 am
by elmon
It is in this topic >.> (it opens all files mrs and mrf)

Re: RaiderZ filesystem

Posted: Fri Jul 29, 2011 2:52 pm
by finale00
Didn't notice :D

Re: RaiderZ filesystem

Posted: Fri Jul 29, 2011 4:31 pm
by elmon
nice) now all we need - is to create a packer:)

p.s. whats with korean client? our build date is 31.05, thats good, but not enough for us i guess)

Re: RaiderZ filesystem

Posted: Wed Aug 03, 2011 11:10 am
by Cain142
elmon wrote:wow) guess we got too offtopic :D
Ive got a question on fs structure:
Mrf is a all files packed and merged into one big file?

off:@cain142 do you have login at pmang.com? :eek:
Yes i have a account on pmang

Anyone know why i get error -1 when i try use that BMS unpacker with the unpacking script.
I select script to use "The script posted on this forum" Then file to unpack like system.mrf then folder.
After that i get error and it refuses to unpack anything.

Re: RaiderZ filesystem

Posted: Sun Aug 07, 2011 5:54 pm
by WRS
Cain142 wrote:Anyone know why i get error -1 when i try use that BMS unpacker with the unpacking script.
I select script to use "The script posted on this forum" Then file to unpack like system.mrf then folder.
After that i get error and it refuses to unpack anything.
use the script on the fileindex.msf index (because it dumps the entire filesystem)

Re: RaiderZ filesystem

Posted: Sun Aug 14, 2011 12:13 pm
by rising
Hello:
Nice to meet you,I have seen your topic about RaiderZ filesystem,fllowing your description,I write some code,but it does work fine.
So execuse me,you meant that fileindex.msf xor lookup_table by your algorithm,right?
Or lookup_table has a new version?

Re: RaiderZ filesystem

Posted: Sun Aug 14, 2011 7:58 pm
by WRS
rising wrote:you meant that fileindex.msf xor lookup_table by your algorithm,right?
Or lookup_table has a new version?
with the fileindex it reads off 4 bytes for the uncompressed size
then a lookup data is made (see my bms script to generate that, or use my dump)
the remaining fileindex data is then run through the function i call the "xor" function (it isn't just an xor though)
then it is decompressed - and the code for that is in quickbms sourcecode (msf.h)

if you're stuck, check the bms version :)