git » fp-git.git » commit 8bf1955

New discoveries about pop2 indexation. Defined master and slave indexes.

author ecalot
2005-06-03 11:20:41 UTC
committer ecalot
2005-06-03 11:20:41 UTC
parent a7ad5f25036178ce5a8048c19f549ab737ad3834

New discoveries about pop2 indexation. Defined master and slave indexes.

FP/doc/FormatSpecifications +67 -55
FP/doc/FormatSpecifications.tex +67 -55

diff --git a/FP/doc/FormatSpecifications b/FP/doc/FormatSpecifications
index 54cb018..4d8335a 100644
--- a/FP/doc/FormatSpecifications
+++ b/FP/doc/FormatSpecifications
@@ -5,42 +5,43 @@
 
 Table of Contents
 ~~~~~ ~~ ~~~~~~~~
-1. Preamble ............................................................ 46
-2. Introduction ........................................................ 55
-3. Primitives .......................................................... 80
-3.1. DAT reading and writing primitives ................................ 87
-3.2. DAT reading primitives ............................................ 99
-3.3. DAT writing primitives ........................................... 108
-4. DAT v1.0 Format Specifications ..................................... 117
-4.1. General file specs, index and checksums .......................... 120
-4.2. Images ........................................................... 204
-4.2.1 Headers ......................................................... 208
-4.2.2 Algorithms ...................................................... 233
-4.2.2.1 Run length encoding (RLE) ..................................... 249
-4.2.2.2 LZ variant (LZG) .............................................. 261
-4.3. Palettes ......................................................... 372
-4.4. Levels ........................................................... 379
-4.4.1 Unknown blocks .................................................. 410
-4.4.2 Room mapping .................................................... 428
-4.4.2.1 Wall drawing algorithm ........................................ 565
-4.4.3 Room linking .................................................... 633
-4.4.4 Guard handling .................................................. 649
-4.4.5 Starting Position ............................................... 696
-4.4.6 Door events ..................................................... 710
-4.5. Digital Waves .................................................... 754
-4.6. Midi music ....................................................... 771
-4.7. Internal PC Speaker .............................................. 774
-4.8. Binary files ..................................................... 779
-5. DAT v2.0 Format Specifications ..................................... 786
+1. Preamble ............................................................ 47
+2. Introduction ........................................................ 56
+3. Primitives .......................................................... 81
+3.1. DAT reading and writing primitives ................................ 88
+3.2. DAT reading primitives ........................................... 100
+3.3. DAT writing primitives ........................................... 109
+4. DAT v1.0 Format Specifications ..................................... 118
+4.1. General file specs, index and checksums .......................... 121
+4.2. Images ........................................................... 205
+4.2.1 Headers ......................................................... 209
+4.2.2 Algorithms ...................................................... 234
+4.2.2.1 Run length encoding (RLE) ..................................... 250
+4.2.2.2 LZ variant (LZG) .............................................. 262
+4.3. Palettes ......................................................... 373
+4.4. Levels ........................................................... 380
+4.4.1 Unknown blocks .................................................. 411
+4.4.2 Room mapping .................................................... 429
+4.4.2.1 Wall drawing algorithm ........................................ 566
+4.4.3 Room linking .................................................... 634
+4.4.4 Guard handling .................................................. 650
+4.4.5 Starting Position ............................................... 697
+4.4.6 Door events ..................................................... 711
+4.5. Digital Waves .................................................... 755
+4.6. Midi music ....................................................... 772
+4.7. Internal PC Speaker .............................................. 775
+4.8. Binary files ..................................................... 780
+5. DAT v2.0 Format Specifications ..................................... 787
 5.1. General file specs, index and checksums .......................... 790
-5.2. The PAHS encapsulated section .................................... 847
-6. PLV v1.0 Format Specifications ..................................... 852
-6.1. User data ........................................................ 878
-6.2. Allowed Date format .............................................. 908
-7. The SAV v1.0 format ................................................ 922
-8. The HOF v1.0 format ................................................ 968
-9. Credits ............................................................ 991
-10. License ........................................................... 1011
+5.2. The master index ................................................. 817
+5.3. The slave indexes ................................................ 854
+6. PLV v1.0 Format Specifications ..................................... 864
+6.1. User data ........................................................ 890
+6.2. Allowed Date format .............................................. 920
+7. The SAV v1.0 format ................................................ 934
+8. The HOF v1.0 format ................................................ 980
+9. Credits ........................................................... 1003
+10. License .......................................................... 1023
 
 
 1. Preamble
@@ -786,11 +787,12 @@ Table of Contents
 5. DAT v2.0 Format Specifications
    ~~~ ~~~~ ~~~~~~ ~~~~~~~~~~~~~~
 
-
 5.1. General file specs, index and checksums
- POP2 DAT files aren't much different from their predecessors from POP1. The
- format is simmilar in almost each way. The main difference is in the index.
- DAT v2.0 indexes are encapsulated inside a high data.
+ POP2 DAT files aren't much different from their predecessors from POP1.
+ The format is simmilar in almost each way. The main difference is in the
+ index. As DAT v1.0 used an index in the high data, the DAT v2.0 indexes
+ are two level encapsulated inside a high data. So there is an index of
+ indexes.
 
  We will use the same conventions than in the prior chapter.
  The checksum validations are still the same.
@@ -804,28 +806,34 @@ Table of Contents
            (the number of bytes the highData has)
            Note that HighDataOffset+HighDataSize=file size
 
- This is simmilar to DAT v1.0 format, except that the index is now called
- high data.
+ This is simmilar to DAT v1.0 format, except that the index area is now
+ called high data.
 
- The high data part of the file contains multiple encapsulated sections. Each
- of those section is indexed in a high data index. The file contents index
- may be only a section encapsulated in the high data.
+ The high data part of the file contains multiple encapsulated indexes.
+ Each of those index is indexed in a high data index of indexes. We will
+ call this index the \xabmaster index\xbb and the sub index the \xabslave indexes\xbb.
+ Slave indexes are the real file contents index.
 
- The DAT High Data index: Size = HighDataSize bytes
+5.2. The master index
+ The master index:
   - Offset HighDataOffset,   size 2, type US: NumberOfSections
            (the number of the high data sections)
-  - Offset HighDataOffset+2, size NumberOfItems*6: The high data sections index
-           (a list of NumberOfSections blocks of 6-bytes-length index record)
+  - Offset HighDataOffset+2, size NumberOfItems*6: The master index record
+           (a list of NumberOfSections blocks of 6-bytes-length index record
+           each corresponding to one slave index)
 
  The 6-bytes-length index record (one per item): Size = 6 bytes
   - Relative offset 0, size 4, type sting: 4 ASCII characters denoting the section ID
   - Relative offset 4, size 2, type US: Section offset
            (section offset relative to HighDataOffset)
 
- From the end of the DAT High Data index to the end of the file there is the High Data
- section contents (where the HighDataOffset relative offsets points to).
+ From the end of the DAT High Data index to the end of the file there is
+ the High Data section contents (where the HighDataOffset relative offsets
+ points to).
 
- There are different 4 bytes ASCII strings section IDs.
+ There are different 4 bytes ASCII strings section IDs. When the string is
+ less than 4 bytes, the hex 0x00 is used. We will denote it with the
+ cardinal # symbol.
 
                    Table 5.1: Section IDs strings
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -842,11 +850,15 @@ Table of Contents
    SQES 2576            Used in the midi sequence file
    TSUC 24 to 123
    #### 13
- 	
-
-5.2. The PAHS encapsulated section
-
-TODO
+   
+5.3. The slave indexes
+ All encapsulated sections are indexes. The first 2 bytes are an US
+ indicating the number of items in this index.
+ Each record has 11 bytes length:
+  2 for the ID
+  4 for the file absolute offset
+  2 for the size
+  3 bytes are: 40 00 00 for PAHS
 
 
 6. PLV v1.0 Format Specifications
diff --git a/FP/doc/FormatSpecifications.tex b/FP/doc/FormatSpecifications.tex
index 54cb018..4d8335a 100644
--- a/FP/doc/FormatSpecifications.tex
+++ b/FP/doc/FormatSpecifications.tex
@@ -5,42 +5,43 @@
 
 Table of Contents
 ~~~~~ ~~ ~~~~~~~~
-1. Preamble ............................................................ 46
-2. Introduction ........................................................ 55
-3. Primitives .......................................................... 80
-3.1. DAT reading and writing primitives ................................ 87
-3.2. DAT reading primitives ............................................ 99
-3.3. DAT writing primitives ........................................... 108
-4. DAT v1.0 Format Specifications ..................................... 117
-4.1. General file specs, index and checksums .......................... 120
-4.2. Images ........................................................... 204
-4.2.1 Headers ......................................................... 208
-4.2.2 Algorithms ...................................................... 233
-4.2.2.1 Run length encoding (RLE) ..................................... 249
-4.2.2.2 LZ variant (LZG) .............................................. 261
-4.3. Palettes ......................................................... 372
-4.4. Levels ........................................................... 379
-4.4.1 Unknown blocks .................................................. 410
-4.4.2 Room mapping .................................................... 428
-4.4.2.1 Wall drawing algorithm ........................................ 565
-4.4.3 Room linking .................................................... 633
-4.4.4 Guard handling .................................................. 649
-4.4.5 Starting Position ............................................... 696
-4.4.6 Door events ..................................................... 710
-4.5. Digital Waves .................................................... 754
-4.6. Midi music ....................................................... 771
-4.7. Internal PC Speaker .............................................. 774
-4.8. Binary files ..................................................... 779
-5. DAT v2.0 Format Specifications ..................................... 786
+1. Preamble ............................................................ 47
+2. Introduction ........................................................ 56
+3. Primitives .......................................................... 81
+3.1. DAT reading and writing primitives ................................ 88
+3.2. DAT reading primitives ........................................... 100
+3.3. DAT writing primitives ........................................... 109
+4. DAT v1.0 Format Specifications ..................................... 118
+4.1. General file specs, index and checksums .......................... 121
+4.2. Images ........................................................... 205
+4.2.1 Headers ......................................................... 209
+4.2.2 Algorithms ...................................................... 234
+4.2.2.1 Run length encoding (RLE) ..................................... 250
+4.2.2.2 LZ variant (LZG) .............................................. 262
+4.3. Palettes ......................................................... 373
+4.4. Levels ........................................................... 380
+4.4.1 Unknown blocks .................................................. 411
+4.4.2 Room mapping .................................................... 429
+4.4.2.1 Wall drawing algorithm ........................................ 566
+4.4.3 Room linking .................................................... 634
+4.4.4 Guard handling .................................................. 650
+4.4.5 Starting Position ............................................... 697
+4.4.6 Door events ..................................................... 711
+4.5. Digital Waves .................................................... 755
+4.6. Midi music ....................................................... 772
+4.7. Internal PC Speaker .............................................. 775
+4.8. Binary files ..................................................... 780
+5. DAT v2.0 Format Specifications ..................................... 787
 5.1. General file specs, index and checksums .......................... 790
-5.2. The PAHS encapsulated section .................................... 847
-6. PLV v1.0 Format Specifications ..................................... 852
-6.1. User data ........................................................ 878
-6.2. Allowed Date format .............................................. 908
-7. The SAV v1.0 format ................................................ 922
-8. The HOF v1.0 format ................................................ 968
-9. Credits ............................................................ 991
-10. License ........................................................... 1011
+5.2. The master index ................................................. 817
+5.3. The slave indexes ................................................ 854
+6. PLV v1.0 Format Specifications ..................................... 864
+6.1. User data ........................................................ 890
+6.2. Allowed Date format .............................................. 920
+7. The SAV v1.0 format ................................................ 934
+8. The HOF v1.0 format ................................................ 980
+9. Credits ........................................................... 1003
+10. License .......................................................... 1023
 
 
 1. Preamble
@@ -786,11 +787,12 @@ Table of Contents
 5. DAT v2.0 Format Specifications
    ~~~ ~~~~ ~~~~~~ ~~~~~~~~~~~~~~
 
-
 5.1. General file specs, index and checksums
- POP2 DAT files aren't much different from their predecessors from POP1. The
- format is simmilar in almost each way. The main difference is in the index.
- DAT v2.0 indexes are encapsulated inside a high data.
+ POP2 DAT files aren't much different from their predecessors from POP1.
+ The format is simmilar in almost each way. The main difference is in the
+ index. As DAT v1.0 used an index in the high data, the DAT v2.0 indexes
+ are two level encapsulated inside a high data. So there is an index of
+ indexes.
 
  We will use the same conventions than in the prior chapter.
  The checksum validations are still the same.
@@ -804,28 +806,34 @@ Table of Contents
            (the number of bytes the highData has)
            Note that HighDataOffset+HighDataSize=file size
 
- This is simmilar to DAT v1.0 format, except that the index is now called
- high data.
+ This is simmilar to DAT v1.0 format, except that the index area is now
+ called high data.
 
- The high data part of the file contains multiple encapsulated sections. Each
- of those section is indexed in a high data index. The file contents index
- may be only a section encapsulated in the high data.
+ The high data part of the file contains multiple encapsulated indexes.
+ Each of those index is indexed in a high data index of indexes. We will
+ call this index the \xabmaster index\xbb and the sub index the \xabslave indexes\xbb.
+ Slave indexes are the real file contents index.
 
- The DAT High Data index: Size = HighDataSize bytes
+5.2. The master index
+ The master index:
   - Offset HighDataOffset,   size 2, type US: NumberOfSections
            (the number of the high data sections)
-  - Offset HighDataOffset+2, size NumberOfItems*6: The high data sections index
-           (a list of NumberOfSections blocks of 6-bytes-length index record)
+  - Offset HighDataOffset+2, size NumberOfItems*6: The master index record
+           (a list of NumberOfSections blocks of 6-bytes-length index record
+           each corresponding to one slave index)
 
  The 6-bytes-length index record (one per item): Size = 6 bytes
   - Relative offset 0, size 4, type sting: 4 ASCII characters denoting the section ID
   - Relative offset 4, size 2, type US: Section offset
            (section offset relative to HighDataOffset)
 
- From the end of the DAT High Data index to the end of the file there is the High Data
- section contents (where the HighDataOffset relative offsets points to).
+ From the end of the DAT High Data index to the end of the file there is
+ the High Data section contents (where the HighDataOffset relative offsets
+ points to).
 
- There are different 4 bytes ASCII strings section IDs.
+ There are different 4 bytes ASCII strings section IDs. When the string is
+ less than 4 bytes, the hex 0x00 is used. We will denote it with the
+ cardinal # symbol.
 
                    Table 5.1: Section IDs strings
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -842,11 +850,15 @@ Table of Contents
    SQES 2576            Used in the midi sequence file
    TSUC 24 to 123
    #### 13
- 	
-
-5.2. The PAHS encapsulated section
-
-TODO
+   
+5.3. The slave indexes
+ All encapsulated sections are indexes. The first 2 bytes are an US
+ indicating the number of items in this index.
+ Each record has 11 bytes length:
+  2 for the ID
+  4 for the file absolute offset
+  2 for the size
+  3 bytes are: 40 00 00 for PAHS
 
 
 6. PLV v1.0 Format Specifications