Page 1 of 2

Help with 15 days resource.xxx unpacking and repacking

Posted: Thu Jun 24, 2010 2:09 pm
by stevenx
The contents of this post was deleted because of possible forum rules violation.

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Thu Jun 24, 2010 7:50 pm
by bacter
I's possible, that the game uses the same method, just like the other games from that company.
(Mistery of the Druids, The Moment of Silence, Overclocked)
Here is a XeNTaXviki link: http://wiki.xentax.com/index.php/The_Moment_Of_Silence
So, there must be a descriptor file, named RESOURCE.MAP

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Thu Jun 24, 2010 10:51 pm
by stevenx
But no this kind of resource.map in game.

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Sat Jun 26, 2010 11:21 pm
by bacter
I managed to create a simple unpacker. Works with resource.000 and resource.907. Tested with the german version of the game.
Important #1: The resoure.000 file also contains the file informations of these files:
resource.100; resource.101 and resource.200, so if you want to unpack, you need more than 3,5 GigaBytes of free disk space.
Important #2: The resource.907 is a standalone archive, contains only its own information.
Important #3: There are no file extensions in the file information tables, so I gave the '.dat' extension to most of the files, except some '.wav'; '.dds' and '.tga' files.

Updated! Now I see, that you don't have the resource.907 file!!! You have resource.909!
Could you send me a little piece of that file? The important part is about the last 256 kilobyte of the file.
Here is a file cutter tool:http://www.xentax.com/downloads/tools/filecutter.zip

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Sun Jun 27, 2010 1:17 am
by stevenx
The contents of this post was deleted because of possible forum rules violation.

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Sun Jun 27, 2010 6:50 am
by bacter
No luck.
Could you give me one more information? What is the exact size (in bytes) of that resource.909 file?

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Sun Jun 27, 2010 9:31 am
by stevenx
The contents of this post was deleted because of possible forum rules violation.

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Sun Jun 27, 2010 2:27 pm
by bacter
O.K. I successfully updated the extractor!
Now it supports these languages: german (resource.907), english (resource.909) and french (resource.912).
(And of course also supports the general, resource.000 file.)
Little modification: The unknown extensions are marked with _01, _02 ... instead of .dat extension.

[The atteched file deleted. Please check my latest post for the most recent version.]

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Sun Jun 27, 2010 4:22 pm
by stevenx
bacter wrote:O.K. The extractor program now handles the resource.909 file too!
Little modification: The unknown extensions are marked with _01, _02 ... instead of .dat extension
Wow, thanks very much for your good work!
And can you post a file format of resource.000 and resource.90X here?
May be useful later.

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Sun Jun 27, 2010 7:00 pm
by bacter
Here is some pseudo-code of those files:

Code: Select all

-> Open the file "resource.000" or "resource.9xx"
-> Seek to FILE_END - 4
-> Read: int32, this is the DATASTARTPOS
-> Seek to DATASTARTPOS
-> The DATA_size = RESOURCEFILE_SIZE - DATASTARTPOS - 4
-> Read the DATA (DATA_size)

-> Now we have the DATA, which is a zlib compressed block, with a little trick: it contains 4+4=8 plus bytes,
   in the middle of the DATA, so first we have to remove these bytes.
   So this is the structure of the DATA:
     First part: SOME_AMOUNT of bytes
     Number1 : 4 bytes
     Second part: SOME_AMOUNT of bytes
     Number2 : 4 bytes
     Last part : the rest of the bytes (DATA_size - 2 * SOME_AMOUNT - 8)
   The value of SOME_AMOUNT is: "resource.000" = 100 "resource.907" = 14
   (The formula for "resource.9XX" files: SOME_AMOUNT = XX * 2)
-> If we deleted the Number1 and Number2, we can decompress the ZLIB_compressed DATA
-> No we have the decompressed directory data, so let's go on.

-> the next step is only for the "resource.000":
   - There is an information table of the resource.xxx files:
      REPEAT
        Read RESOURCE_FILE_INFO: (112 bytes)
               ExtensionNumber : Int32 // 0=resource.000 100=resource.100 200=resource.200 201=resource.201
               UnknownNumber : Int32
               Dummy : Array[0..103] Of Byte // zero bytes
        IF (ExtensionNumber==0) AND (UnknownNumber==0) THEN THIS_IS_THE_END
      UNTIL THIS_IS_THE_END

-> now comes the information of the stored files:
      REPEAT
        Read EXT_id : Int32 // this means the extensions of the following files. 5=.tga 11=.wav 13=.dds and so on.
        Read NrOfFiles : Int32
        IF (EXT_id==0) AND (NrOfFiles==0) THEN THIS_IS_THE_END

        IF NOT THIS_IS_THE_END THEN:
            FOR 1 TO NrOfFiles
              Read FILE_INFO (76 bytes for each file)
                      FileName : Array[0..62] Of Char // with padding zero chars
                      FlagByte : Byte // this means the containing resource.XXX file -> see note #1
                      StartPos : Int32
                      OriginalSize : Int32
                      ZlibCompressedSize : Int32 // 0, if not compressed
        ENDIF
      UNTIL THIS_IS_THE_END
-> the next step is only for the "resource.907":
        Read RESOURCE_FILE_INFO: (112 bytes)
               ExtensionNumber : Int32 // 907=resource.907
               UnknownNumber : Int32
               Dummy : Array[0..103] Of Byte // zero bytes

-> the next step is only for the "resource.000":
   There are some unkown bytes at the end, maybe some useless, unimportant junk.

note #1:
The FlagByte: If we have the "resource.907" then this is 0, so no problem.
but if have the "resource.000" then this is 1,2,3 or 4, see the previously read RESOURCE_FILE_INFO blocks,
take the appropriate ExtensionNumber, and that means the correct resource.XXX file.

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Mon Jun 28, 2010 3:41 pm
by stevenx
Very very thanks!
Can you figure out which file is the dialog subtitle file in these files?

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Wed Jul 14, 2010 8:20 am
by emirdar
thank you :keke:

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Sat Jul 24, 2010 6:00 pm
by duktom
thanks .:)...

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Tue Sep 07, 2010 10:44 am
by Sheen
Hi bacter, I need your help.

I have this game in two languages: English and spanish, but spanish language is blocked into resource.910 I guess.

Can you help me to get the spanish subtitles from .910? Your actually extractor works wonderful with all files less with 910 one, of course.

This is the head and tail of that file. If you need the full file tell me and I'll upload this one to megaupload or hotfile.

resource.910

Thanks a lot in advance.

Regards.

Re: Help with 15 days resource.xxx unpacking and repacking

Posted: Tue Sep 07, 2010 11:40 am
by bacter
I updated my tool. Please check if it works.
Theoretically it has to work, but if not, then first I need one more information to test your file: the exact size of
the pak file, in bytes. (So I can make a fake file and try to load the file information table)