SGA V2 - Table Of Contents Block

Table Of Contents Header

Table Of contents Header

Start

Stop

Size

Type

Name

0

3

4

UInt-32

Root Folder Definition Offset

4

5

2

UInt-16

Root Folder Count

6

9

4

UInt-32

Folder Definition Offset

10

11

2

UInt-16

Folder Count

12

15

4

UInt-32

File Offset Definition Offset

16

17

2

UInt-16

File Count

18

21

4

UInt-32

Name Buffer Offset

22

23

2

UInt-16

Name Buffer Count

Folder/File/Name Offset

Offsets are relative to the TOC start; at position 180

Folder/File/Name Count

Counts are the number of entries in the block

Root Folder Definition

Root Folder Definition

Start

Stop

Size

Type

Name

0

63

64

String [2]_

Path

64

127

64

String [2]_

Alias

128

129

2

UInt-16

First Folder

130

131

2

UInt-16

Last Folder

132

133

2

UInt-16

First File

134

135

2

UInt-16

Last File

136

137

2

UInt-16

Root Folder

Path

Alias

First Folder/File

Inclusive index into the Table Of Content’s folder/file array

Last Folder/File

Exclusive index into the Table Of Content’s folder/file array

Root Folder

Index into the Table Of Content’s folder array which servers as the root folder

Folder Definition

Folder Definition

Start

Stop

Size

Type

Name

0

3

4

UInt-32

Name Offset

4

5

2

UInt-16

First Child Folder

6

7

2

UInt-16

Last Child Folder

8

9

2

UInt-16

First File

10

11

2

UInt-16

Last File

Name Offset

First Child Folder

Last Child Folder

First File

Last File

File Definition

Dawn Of War and Impossible Creatures use two slightly different schemas for files

File Definition (Dawn Of War)

Start

Stop

Size

Type

Name

0

3

4

UInt-32

Name Offset

4

7

4

UInt-32

Storage Flag

8

11

4

UInt-32

Relative Data Offset

12

15

4

UInt-32

Compressed Size

16

19

4

UInt-32

Decompressed Size

File Definition (Impossible Creatures)

Start

Stop

Size

Type

Name

0

3

4

UInt-32

Name Offset

4

4

1

UInt-8

Storage Flag

5

8

4

UInt-32

Relative Data Offset

9

12

4

UInt-32

Compressed Size

13

16

4

UInt-32

Decompressed Size

Name Offset

Storage Flag

The only difference between the two schemas is the size of the storage flag; Dawn Of War uses 4 bytes, where as Impossible Creatures uses only 1 byte.

Storage Flag

Name

Value

Raw

0

Buffer Compressed

16

Stream Compressed

32

Data Offset

Offset to the file data relative to the data offset defined in the SGA header. See :doc:data.rst for more information

Compressed Size

Size of the packed file in the archive

This is the size used to read data from the archive.

Decompressed Size

Size of the unpacked file on disk

This size is used to verify the file was not corrupted after unpacking.