Difference between revisions of "SDS"

From XentaxWiki
Jump to: navigation, search
(file header)
(more header details)
Line 2: Line 2:
  
 
* ''' Format Type ''': Archive
 
* ''' Format Type ''': Archive
* ''' [http://en.wikipedia.org/wiki/Endianness Endian Order] ''': Little Endian
+
* ''' [http://en.wikipedia.org/wiki/Endianness Endian Order] ''': Little Endian (for PC variant) or Big Endian (XBOX or PS3 variants); the platform type is specified in the header
  
 
SDS is an archive format used in the game Mafia II developed by 2K Czech. The page describes the SDS files as seen on the Windows version of the game. Other platform ports might use the same variant.
 
SDS is an archive format used in the game Mafia II developed by 2K Czech. The page describes the SDS files as seen on the Windows version of the game. Other platform ports might use the same variant.
 +
 +
This description of the format was reverse engineered from a set of SDS manipulation tools written in C# by [https://github.com/gibbed Rick Gibbed].
  
 
== Format Description ==  
 
== Format Description ==  
An SDS file begins with the following 68-byte header:
+
An SDS file begins with the following 8-byte header:
 +
 
 +
bytes 0-3    file signature string: 'SDS\0'
 +
bytes 4-7    total length of header in 32-bit words
 +
 
 +
The total length of the header is usually 0x13 (19 * 4 bytes = 76) since most SDS files only contain one file.
 +
 
 +
The header has the following 60-byte structure:
 +
 
 +
bytes 0-3    platform string/endian-ness indicator
 +
bytes 4-7    0x5FFB74F3
 +
bytes 8-11  resource type table offset
 +
bytes 12-15  block table offset
 +
bytes 16-19  XML offset
 +
bytes 20-23  slot RAM required
 +
bytes 24-27  slot VRAM required
 +
bytes 28-31  other RAM required
 +
bytes 32-35  other VRAM required
 +
bytes 36-39  unknown
 +
bytes 40-55  array of 16 bytes; purpose unknown
 +
bytes 56-59  file count
 +
 
 +
There are 3 known values for the platform string, and the endian-ness of multi-byte numbers keys off of this value:
 +
 
 +
* 'PC\0\0' for the PC version of Mafia II; multi-byte numbers are little-endian
 +
* 'XBOX' or 'PS3\0': multi-byte numbers are big-endian
 +
 
 +
Following this header is the resource type table offset. There is an entry for each file in the archive. Each entry is 12 bytes and has the following format:
 +
 
 +
bytes 0-3  ID
 +
bytes 4-7  name
 +
bytes 8-11  parent
  
bytes 0-3    'SDS\0'
+
Presumably, these help to link resources together.
bytes 4-7    0x00000013, possibly a signature
 
bytes 8-11  'PC\0\0'
 
bytes 12-15  0x5FFB74F3
 
bytes 16-19  resource type table offset
 
bytes 20-23  block table offset
 
bytes 24-27  XML offset
 
bytes 28-31  slot RAM required
 
bytes 32-35  slot VRAM required
 
bytes 36-39  other RAM required
 
bytes 40-43  other VRAM required
 
bytes 44-47  unknown
 
bytes 48-63  array of 16 bytes; purpose unknown
 
bytes 64-67  file count
 

Revision as of 00:11, 17 December 2017

  • Format Type : Archive
  • Endian Order : Little Endian (for PC variant) or Big Endian (XBOX or PS3 variants); the platform type is specified in the header

SDS is an archive format used in the game Mafia II developed by 2K Czech. The page describes the SDS files as seen on the Windows version of the game. Other platform ports might use the same variant.

This description of the format was reverse engineered from a set of SDS manipulation tools written in C# by Rick Gibbed.

Format Description

An SDS file begins with the following 8-byte header:

bytes 0-3    file signature string: 'SDS\0'
bytes 4-7    total length of header in 32-bit words

The total length of the header is usually 0x13 (19 * 4 bytes = 76) since most SDS files only contain one file.

The header has the following 60-byte structure:

bytes 0-3    platform string/endian-ness indicator
bytes 4-7    0x5FFB74F3
bytes 8-11   resource type table offset
bytes 12-15  block table offset
bytes 16-19  XML offset
bytes 20-23  slot RAM required
bytes 24-27  slot VRAM required
bytes 28-31  other RAM required
bytes 32-35  other VRAM required
bytes 36-39  unknown
bytes 40-55  array of 16 bytes; purpose unknown
bytes 56-59  file count

There are 3 known values for the platform string, and the endian-ness of multi-byte numbers keys off of this value:

  • 'PC\0\0' for the PC version of Mafia II; multi-byte numbers are little-endian
  • 'XBOX' or 'PS3\0': multi-byte numbers are big-endian

Following this header is the resource type table offset. There is an entry for each file in the archive. Each entry is 12 bytes and has the following format:

bytes 0-3   ID
bytes 4-7   name
bytes 8-11  parent

Presumably, these help to link resources together.