Zatarita

H2A - pct format

With the release of unpck I feel it's a good time to give a more technical update on some h2a progress being made.

 

to see these files we'll need to decompress, and extract a pck file for h2a,


The format we're looking at today is located inside of the shared.pck file. The file format pct is for textures. Unlike CEA, h2a textures are broken up into individual files. These are all dds textures with their header stripped, and a new saber specific header stitched on. The layout is very similar to the imeta/ipak format in cea. to locate these files, after extacting shared.pck, navigate to the textures folder inside the shared subdirectory. In this folder we see every texture used in the game. If we open them in a hex editor we'll see a header 0x3A bytes wide, and the rest is all pixel data.
unknown.png

The format is a sentinel based system with delimiters for file type. Before we continue, I want to touch of this a bit.
Each file is broken up into structured objects. these objects are given a number to represent what it is. When the engine encounters one of these objects, it knows to load the preceding data into that objects variables.
The contents of the sentinel can vary depending on intended use; however, there will be at lease:

short: number reference for object structure
int32: Pointer to end of chunk

...
the actual data the object holds

...


The pct format is no different. I like to think of this as an unfolded c-style class.

sentinel 0x00F0  (File header/signature)
{
    int32 end_of_block;
    string signature = "TCIP";
}
sentinel 0x0102 (bitmap shape)
{
	int32 end_of_chunk
	sint32 width, height, depth, faces;
}
sentinel 0x00f2 (dds format)
{
	int32 end_of_block;
	pck_format type; (32 bit)
}	(See below for types)
sentinel 0x00f9 (mipmap count)
{
	int32 end_of_block;
	int32 mipmap count;
}
sentinel 0x00ff (pixel data)
{
	int32 end_of_block;
	pixed_data; (the format changes depending on format type so this is pseudo-code)
}
sentinel 0x0001 (Footer)
{
	int32 end_of_block
}

 


Format types:
The header holds the dds format. From what I can tell these are the ones that are used in game, though since saber uses their engine for many different games, I wouldn't be surprised if there were more. Been researching some of their other games to see what I can find as well. for now, just h2a:

 

A8R8G8B8 - 0x00

AI88 - 0x0A

OXT1 - 0x0C

AXT1 - 0x0D

DXT3 - 0x0F

DXT5 - 0x11

X8R8G8B8 - 0x16

DXN - 0x24

DXT5A - 0x25

A16B16G16R16 0x26

R9G9B9E5_SHAREDEXP, 0x2D

 

wrapping all this together we have the entire block defined. I like to see things visually to help get a better grasp:
unknown.png
All things in green are sentinels
All things in blue are end of blocks.
Orange is the header
Yellow is bitmap dimensions, and face count
Pink is format
Purple is mipmap count
White is pixel data

here is also the footer. It is just a sentinel and end of block (or in this case end of file) with no extra data.
unknown.png

Applied looks like this:
unknown.png

Takka likes this

Specifications:

S3dpak - format - Imeta/ipak - format - Fmeta - format

Programs:

H2a-inflate - SuP

Share this post


Link to post
Share on other sites

Tiddy-bits:

  • Recently Browsing   0 members

    No registered users viewing this page.