Simcity 2000 Special Edition DAT IDX: Difference between revisions
Jump to navigation
Jump to search
imported>WATTO No edit summary |
imported>Tgp1994 (Beginning documentation of SC2 format. Whew!) |
||
| Line 11: | Line 11: | ||
=== Format Specifications === | === Format Specifications === | ||
< | <code><b> | ||
<font color="blue"> ''' // for each file ''' </font> <br> | <font color="blue"> ''' // for each file ''' </font> <br> | ||
: uint32 {4} - ID <br> | : uint32 {4} - ID <br> | ||
: uint32 {4} - File Offset <br> | : uint32 {4} - File Offset <br> | ||
<br> | <br> | ||
</b></ | </b> | ||
</code> | |||
=== MultiEx BMS Script === | === MultiEx BMS Script === | ||
| Line 29: | Line 30: | ||
* [[Game Extractor|Game Extractor]]<br> | * [[Game Extractor|Game Extractor]]<br> | ||
== SC2 == | |||
* '''Format Type:''' [https://en.wikipedia.org/wiki/Interchange_File_Format Interchange File Format (IFF)] | |||
* '''[http://en.wikipedia.org/wiki/Endianness Endian Order]''': Big Endian | |||
=== Format Specifications === | |||
<code><b> | |||
<span style="color:blue">// HEADER </span> | |||
{| style="margin-left:1em" | |||
|- | |||
| char {4} | |||
| - Chunk Type ID (<span style="color:purple">'FORM'</span>) | |||
|- | |||
| int32 {4} | |||
| - Total count of bytes in file minus first 8 in the header | |||
|- | |||
| char {4} | |||
| - File type (always <span style="color:purple">'SCDH'</span> for SimCity 2000) | |||
|} | |||
<p style="color:blue">// Begin segments/nested chunks. For each nested chunk:</p> | |||
<span style="color:blue; margin-left:1em">// Segment header</span> | |||
{| style="margin-left:2em" | |||
|- | |||
| char {4} | |||
| - Segment type | |||
|- | |||
| int32 {4} | |||
| - Byte count of this segment minus this header (-8 bytes) | |||
|} | |||
<p style="color:blue; margin-left:1em">// Segment data, begin sub-segment bytes (let <span style="color:red">x</span> = the byte's value)</p> | |||
:: byte {1} | |||
:: <span style="color:blue">// If 1 <= <span style="color:red">x</span> <= 127:</span> | |||
::: byte {<span style="color:red">x</span>} - Raw, uncompressed data | |||
:: <span style="color:blue">// If 129 <= <span style="color:red">x</span> <= 255:</span> | |||
::: byte {1} - This byte repeats <span style="color:red">x</span> times. | |||
: <span style="color:blue">// Repeat for the rest of this segment's data length.</span> | |||
</b></code> | |||
=== Notes and Comments === | |||
* This is the file format in which cities are stored. See the IFF page on Wikipedia (linked above) for more information on the format, although it is essentially a generic container file format. | |||
* All of this information is thanks to the research done by David Moews, with a document [http://djm.cc/simcity-2000-info.txt here]. | |||
* After the header, the rest of the file is made up of chunks containing an 8 byte header followed by its data. Almost all segment data is compressed using a run-length algorithm. Specifically: | |||
** The compressed data is a series of two kinds of chunks | |||
** In the first kind, the first byte equates to an integer 1 to 127. This means the byte is counting ''how many'' data bytes follow. | |||
** In the second kind, the first byte equates to an integer 129 to 255. If you subtract 127 from it, you end up with a count of how many times the '''following byte''' is repeated. | |||
** '''Chunks with a first byte of 0 or 128 never seem to occur.''' | |||
** Therefor, the maximum size of an uncompressed ''sub-''chunk can be 127 bytes. | |||
=== Segment Types === | |||
* The following table is a list of segment types in the order they typically appear. Unless noted, they are compressed using the above algorithm. The lengths given are their '''uncompressed''' lengths. | |||
{| class="wikitable" | |||
! Seg. type | |||
! Length (bytes) | |||
|- | |||
|CNAM | |||
|32 (Uncompressed) | |||
|- | |||
|MISC | |||
|4800 | |||
|- | |||
|ALTM | |||
|32768 (Uncompressed) | |||
|- | |||
|XTER | |||
|16384 | |||
|- | |||
|XBLD | |||
|16384 | |||
|- | |||
|XZON | |||
|16384 | |||
|- | |||
|XUND | |||
|16384 | |||
|- | |||
|XTXT | |||
|16384 | |||
|- | |||
|XLAB | |||
|6400 | |||
|- | |||
|XMIC | |||
|1200 | |||
|- | |||
|XTHG | |||
|480 | |||
|- | |||
|XBIT | |||
|16384 | |||
|- | |||
|XTRF | |||
|4096 | |||
|- | |||
|XPLT | |||
|4096 | |||
|- | |||
|XVAL | |||
|4096 | |||
|- | |||
|XCRM | |||
|4096 | |||
|- | |||
|XPLC | |||
|1024 | |||
|- | |||
|XFIR | |||
|1024 | |||
|- | |||
|XPOP | |||
|1024 | |||
|- | |||
|XROG | |||
|1024 | |||
|- | |||
|XGRP | |||
|3328 | |||
|} | |||
'''Additional notes on segment types:''' | |||
{| | |||
|- | |||
|CNAM | |||
|The name of the city, uncompressed, and also optional it seems. When it's present, the length byte is a number 0 to 31, with that many bytes of city name. It's padded to 32 bytes with zeroes. | |||
|} | |||
Revision as of 06:23, 17 February 2016
Choose archive extension:
IDX + DAT
- Format Type : Archive
- Endian Order : Little Endian
Format Specifications
// for each file
- uint32 {4} - ID
- uint32 {4} - File Offset
MultiEx BMS Script
Not written yet
Notes and Comments
- The *.idx file contains the directory, the *.dat file contains the file data
Compatible Programs
SC2
- Format Type: Interchange File Format (IFF)
- Endian Order: Big Endian
Format Specifications
// HEADER
char {4}
- Chunk Type ID ('FORM')
int32 {4}
- Total count of bytes in file minus first 8 in the header
char {4}
- File type (always 'SCDH' for SimCity 2000)
// Begin segments/nested chunks. For each nested chunk:
// Segment header
char {4}
- Segment type
int32 {4}
- Byte count of this segment minus this header (-8 bytes)
// Segment data, begin sub-segment bytes (let x = the byte's value)
- byte {1}
- // If 1 <= x <= 127:
- byte {x} - Raw, uncompressed data
- // If 129 <= x <= 255:
- byte {1} - This byte repeats x times.
- // Repeat for the rest of this segment's data length.
Notes and Comments
- This is the file format in which cities are stored. See the IFF page on Wikipedia (linked above) for more information on the format, although it is essentially a generic container file format.
- All of this information is thanks to the research done by David Moews, with a document here.
- After the header, the rest of the file is made up of chunks containing an 8 byte header followed by its data. Almost all segment data is compressed using a run-length algorithm. Specifically:
- The compressed data is a series of two kinds of chunks
- In the first kind, the first byte equates to an integer 1 to 127. This means the byte is counting how many data bytes follow.
- In the second kind, the first byte equates to an integer 129 to 255. If you subtract 127 from it, you end up with a count of how many times the following byte is repeated.
- Chunks with a first byte of 0 or 128 never seem to occur.
- Therefor, the maximum size of an uncompressed sub-chunk can be 127 bytes.
Segment Types
- The following table is a list of segment types in the order they typically appear. Unless noted, they are compressed using the above algorithm. The lengths given are their uncompressed lengths.
| Seg. type | Length (bytes) |
|---|---|
| CNAM | 32 (Uncompressed) |
| MISC | 4800 |
| ALTM | 32768 (Uncompressed) |
| XTER | 16384 |
| XBLD | 16384 |
| XZON | 16384 |
| XUND | 16384 |
| XTXT | 16384 |
| XLAB | 6400 |
| XMIC | 1200 |
| XTHG | 480 |
| XBIT | 16384 |
| XTRF | 4096 |
| XPLT | 4096 |
| XVAL | 4096 |
| XCRM | 4096 |
| XPLC | 1024 |
| XFIR | 1024 |
| XPOP | 1024 |
| XROG | 1024 |
| XGRP | 3328 |
Additional notes on segment types:
| CNAM | The name of the city, uncompressed, and also optional it seems. When it's present, the length byte is a number 0 to 31, with that many bytes of city name. It's padded to 32 bytes with zeroes. |