PoP1 DAT specification

About PR usage and development, and about the POP format.
Post Reply
ikazrima
Efendi
Efendi
Posts: 12
Joined: February 21st, 2014, 6:01 am

PoP1 DAT specification

Post by ikazrima »

Hello guys :)

This is my first post, please be nice to me :D
A tiny bit of my background; I have experience in programming in the .NET environment and I've made some games before in Unity3D. This is my first time working with binary files.

I'm making a program to read the PoP1 DAT files (specifically, the LEVELS.DAT). I'm working with the 1.4v of PoP1.
I've read the formatspecifications.pdf and managed to read some part of the data.

The result of reading levels.dat :

Code: Select all

Index Specification
File size = 37B
Index Offset = 36901
Index Size = 130
Number of Items = 16
Index = 395216
Entry = 0
Item ID = 0
Absolute Offset = 0
Size of Item = 0

Dump all
[1] {0:X6} 190-00-00-82-00-B5-33-21-00-00-21-21-33-33-2F-23 ......3!..!!33/#
[17] {0:X6} 1734-34-00-00-14-34-34-34-34-34-34-34-22-22-00-34 44...4444444"".4
[33] {0:X6} 3334-34-34-34-33-33-21-00-00-00-21-0B-0B-24-34-34 444433!...!..$44
[49] {0:X6} 4934-00-00-22-34-00-00-34-34-34-34-22-00-34-34-00 4.."4..4444".44.
[65] {0:X6} 6500-34-24-00-00-00-00-0B-33-32-33-24-34-00-00-00 .4$.....323$4...
[81] {0:X6} 8122-21-34-34-34-34-34-00-00-00-14-14-34-34-34-34 "!44444.....4444
[97] {0:X6} 9723-21-21-33-21-33-21-0B-0B-24-34-34-34-34-34-34 #!!3!3!..$444444
[113] {0:X6} 11334-00-00-34-34-34-34-34-34-34-34-00-00-14-34-34 4..44444444...44
[129] {0:X6} 12934-34-00-34-34-00-00-34-34-34-34-34-21-34-34-00 44.44..44444!44.
[145] {0:X6} 14500-34-14-14-14-14-14-14-14-01-01-14-34-14-14-14 .4..........4...
[161] {0:X6} 16114-14-34-00-00-34-09-00-00-00-00-00-09-00-00-34 ..4..4.........4
[177] {0:X6} 17708-13-10-11-13-0F-08-01-01-14-34-34-34-34-00-34 ..........4444.4
[193] {0:X6} 19334-34-34-34-34-34-34-34-00-34-34-34-34-34-14-14 44444444.44444..
[209] {0:X6} 20914-14-01-14-14-14-14-14-14-14-14-14-14-14-14-14 ................
[225] {0:X6} 22514-14-00-00-00-00-00-00-00-00-00-00-00-00-00-01 ................
[241] {0:X6} 24101-01-01-01-01-01-00-00-00-00-00-00-00-21-21-23 .............!!#

and so on.
*results are casted to some type of int.

Index = 395216
Entry = 0
Item ID = 0
Absolute Offset = 0
Size of Item = 0


I'm confused with the bolded part. Was it supposed to return 0? Because when I open other .dat files it comes out with huge numbers (way more that the file size?) Is this normal?

Reading the format specification, it states that the pop1_foretable has an offset of 0. But doesn't the first 6 bytes contains the header information?

Really appreciate if someone could clear this up for me. Thanks. ;)
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: PoP1 DAT specification

Post by David »

ikazrima wrote: Index = 395216
Entry = 0
Index and Entry are not integers.
Entry is a record (struct) that contains id, offset and size.
Index is an array of Entry structs.
Therefore, you don't have to read these two as integers.
ikazrima wrote:Reading the format specification, it states that the pop1_foretable has an offset of 0. But doesn't the first 6 bytes contains the header information?
Those offsets are counted from the "Absolute Offset" of the resource, plus one (because of the checksum byte).
The first resource starts at offset 6. The problem is that you read the index incorrectly.

Also, the dump under "Dump all" is a bit incorrect:
- I suppose the {0:X6} is not meant to be there?
- The number at the beginning of the line (in []) is repeated before the first byte.

EDIT: Wait, I see that you already solved these: viewtopic.php?p=14392#p14392
Oh well...
Post Reply