The Forum is up for sale: XeNTaX Forum looking for new owner

How to extracting files play archive?

Coders and would-be coders alike, this is the place to talk about programming.
KorNet
VVIP member
VVIP member
Posts: 444
Joined: Tue Apr 12, 2005 11:36 am
Been thanked: 4 times

How to extracting files play archive?

Post by KorNet »

Hi all..Would be desirable to learn who as it does make in order to dismantle recreation area and to write for an example of plugins for Game Extractr or script for MultiEx Commander? For example I took play archive from game Mercedes Benz Truck Racing the play archive SYN.... it found in Watto the description of the play archive :

Code: Select all

// 4 - Header
// 4 - Number Of Files
// 8 - null
// 24 - Filename
// 4 - Data Offset
// 4 - Raw File Length
With the title and with numbers files is file everything understandably, but is not understandable why Filename = 24?
And still it would be desirable to know that it does indicate this description?

Code: Select all

// 4 - Data Offset
// 4 - Raw File Length
Watto and Mr.Mouse you will explain if you please and that in me nothing it is obtained :(
KorNet
VVIP member
VVIP member
Posts: 444
Joined: Tue Apr 12, 2005 11:36 am
Been thanked: 4 times

Post by KorNet »

This example Mercedes Benz Truck Racing archive.....

Image
KorNet
VVIP member
VVIP member
Posts: 444
Joined: Tue Apr 12, 2005 11:36 am
Been thanked: 4 times

Post by KorNet »

And this example Mercedes Benz World Racing archive.....

Image

Filename = ?
Raw offset = ?
Data offset = ?

What say guys ? :oops:
User avatar
friendsofwatto
VVIP member
VVIP member
Posts: 532
Joined: Wed Jun 30, 2004 3:01 pm
Location: Australia
Been thanked: 13 times
Contact:

Post by friendsofwatto »

OK, lets see what I can do...

Firstly - the specs from the wiki for this game... ( http://wiki.xentax.com/index.php/SYN_FNYS )

Code: Select all

char {4}     - Header (FNYS)
uint32 {4}   - Number Of Files
uint64 {8}   - null

// for each file

    char {24}    - Filename (null)
    uint32 {4}   - Data Offset
    uint32 {4}   - File Length


byte {X}     - File Data 

Now, why Filename=24? This means that the filename can be <= 24, NOT =24. In some archives, the filename is set to a maximum length, so that it is more efficient when reading the archive from the hard disk. Many of the filenames will be <24 , if this happens then the filename ends with a null (0) byte.

So, in the example image, the first filename is amatur1.tga, then there is a byte=0, then other bytes to make it have length 24. Following that is 4 bytes for the data offset, and 4 bytes for the raw file length.

What does Data Offset mean? The Data Offset tells where the file is in the archive. So, in the first example, the offset is 816. So, if you go to byte=816 in the archive, you will find the start of the file.

What does Raw File Length mean? This means the length of the file, and that the file is not compressed. I don't usually write "Raw File Length" any more, I write "File Length" or "Decompressed File Length". In this example, it is length=6064 bytes.

WATTO
watto@watto.org
http://www.watto.org
Game Extractor - Read and write thousands of game archives!
User avatar
friendsofwatto
VVIP member
VVIP member
Posts: 532
Joined: Wed Jun 30, 2004 3:01 pm
Location: Australia
Been thanked: 13 times
Contact:

Post by friendsofwatto »

OK, now for the next archive. I am not really good with Hex Editors - I can't read them well - but I think that it would go something like this...

Code: Select all

8 - Header (SYN!v2.0)
4 - Number Of Files?
52 - null

// for each file
  48 - Filename (null terminated)
  4 - Compressed File Length
  4 - Decompressed File Length
  4 - File Offset?
  4 - null
Some of these fields will be around the other way - like I said, I can't read Hex :)

Something to note when dealing with files - most fields are either 2, 4, or 8 bytes long - you don't usually see fields of 9 bytes or other numbers (note the header is 8 bytes, it would only be rare to be 9 bytes long.)

If you have any further questions, just ask and I will try to help. If you want me to write the correct specs, you can send me an archive. Also, if you do deside to write GE plugins, excellent :) - I welcome your help and can give you a template file if you want.

WATTO
watto@watto.org
http://www.watto.org
Game Extractor - Read and write thousands of game archives!
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

Well, in the archive you show Kornet, the header is 8 bytes "SYN!V2.0"
Then indeed comes the number of files probably.

The file information starts at 0x40.

It starts with the filename, that can be 48 in length (so, when we write [24] FileName we are talking about how many bytes are reserved for each filename, NOT if they are used or not. )
In your example the files are null-terminated (0 at the end of the name) strings of maximum 48 length.

Then, just guessing, there's an (un)signed integer of 32 bit (4 bytes) which is the OFFSET of the current resource in the archive. (Again, the OFFSET is the position of the resource in the archive where it begins.)

Next, another 32-bit value that is the SIZE of the resource.

Then, again a value of 32-bit that is perhaps pointing to somewhere else in the archive, I can't tell just looking at a screenshot.

And finally, there a 32-bit value of 0.

So each entry (folder entry, filelist entry, whatever you wish to call it) is 64 bytes. 48 for the filename, and 12 for the offset, size and something unknown, and one reserved 32-bit value.

You should know that OFFSET can be relative from a certain position in the archive. So, when the offset is at 40 for instance, and it's value is 32, it might be that the offset of the resource is not 32, but 40+32. Be aware of this. :D
User avatar
friendsofwatto
VVIP member
VVIP member
Posts: 532
Joined: Wed Jun 30, 2004 3:01 pm
Location: Australia
Been thanked: 13 times
Contact:

Post by friendsofwatto »

I think Mr Mouse answered this much better than I did :)

WATTO
watto@watto.org
http://www.watto.org
Game Extractor - Read and write thousands of game archives!
KorNet
VVIP member
VVIP member
Posts: 444
Joined: Tue Apr 12, 2005 11:36 am
Been thanked: 4 times

Post by KorNet »

Ok thanks guys .... this example archive Mercedes Benz World Racing

SYN!v2.0

Wattooooo you can write plugin ? :D

Download here :)
http://rapidshare.de/files/9756550/MBWR.ZIP.html
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

Code: Select all

ImpType Standard ;
IDString 0 SYN!v2.0 ;
Get FN Long 0 ;
Set D Long 64 ;
GoTo D 0 ;
For T = 1 To FN ;
GetDString FNAME 48 0 ;
SavePos FOO 0 ;
Get FO Long 0 ;
SavePos FSO 0 ;
Get FS Long 0 ;
SavePos UKO 0 ;
Get UK Long 0 ;
Get UK2 Long 0 ;
Log FNAME FO FS FOO FSO ;
Next T ;
MultiEx Commander BMS script.

The resources are compressed/encrypted. Let's put them on the Compressed Files list. Or, does Watto know the method? I noticed on the WIKI page for the other SYN format that Alexander sais Dragon Unpacker does not support decryption, while GE says nothing like that, so I assume Michael might know the answer?
You do not have the required permissions to view the files attached to this post.
KorNet
VVIP member
VVIP member
Posts: 444
Joined: Tue Apr 12, 2005 11:36 am
Been thanked: 4 times

Post by KorNet »

:eek: Excellent :D

Mr.Mouse this example Mercedes Benz Truck Racing
http://rapidshare.de/files/9763972/MBTR.ZIP.html

Set D Long 64 ; - Mr.Mouse what this does indicate? :oops:
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 680 times
Contact:

Post by Mr.Mouse »

The

Code: Select all

Set D Long 64 ; 
means I asign the value 64 to the 32-bit (long) variable I gave the name 'D' , so: D=64.

I do this so I can use the variable in the GoTo command. Because I wish to jump to position 64 in the archive, as the resource information starts there.
KorNet
VVIP member
VVIP member
Posts: 444
Joined: Tue Apr 12, 2005 11:36 am
Been thanked: 4 times

Post by KorNet »

Yes which that to me is with difficulty given to write the scripts for MultiEx Commander :(
User avatar
friendsofwatto
VVIP member
VVIP member
Posts: 532
Joined: Wed Jun 30, 2004 3:01 pm
Location: Australia
Been thanked: 13 times
Contact:

Post by friendsofwatto »

Thanks for the files, I will write a plugin soon - I can send you the source code for it too since you are interested.

Re: the compression - no I don't know what the compression is - actually I looked at this format a long time ago (when I was only new to this) and I don't think I noted any compression - might have to go back and take a look at it. As for the "decompression not supported" on the wiki - no Game Extractor doesn't support decompression either - its just that I havn't written it on there (partly due to the point I just raised about me not knowing about compression) - I havn't written many decompression methods so most of the formats with compression are not fully supported.

WATTO
watto@watto.org
http://www.watto.org
Game Extractor - Read and write thousands of game archives!
KorNet
VVIP member
VVIP member
Posts: 444
Joined: Tue Apr 12, 2005 11:36 am
Been thanked: 4 times

Post by KorNet »

You guys fine people that still it is possible to say... Professionals in its matter

Mr.Mouse , Watto - Respect :)
User avatar
friendsofwatto
VVIP member
VVIP member
Posts: 532
Joined: Wed Jun 30, 2004 3:01 pm
Location: Australia
Been thanked: 13 times
Contact:

Post by friendsofwatto »

:) many thanks! We are always here to help.

WATTO
watto@watto.org
http://www.watto.org
Game Extractor - Read and write thousands of game archives!
Post Reply