User:Kojin/TIM2 Information
Contents
File Layout
Layout of TIM2 file.
<HEADER> <IMAGE HEADER> <IMAGE DATA> <CLUT>
Header
struct TIM2_HEADER { char fileNum[4]; uint8_t version; uint8_t format; uint16_t numImages; char padding[8]; };
Image Header
struct TM2_IMAGE_HEADER { uint32_t totalSize; uint32_t clutSize; uint32_t imageSize; uint16_t headerSize; uint16_t clutColors; uint8_t pictFormat; uint8_t mipMapTetures; uint8_t clutType; uint8_t imageType; // 1=16bbp, 2=24bpp, 3=32bbp, 4=4bbp, 5=8bpp uint16_t width; uint16_t height; uint64_t gsTex0; uint64_t gsTex1; uint32_t gsReg; uint32_t gsTexClut; };
General GS Memory Layout
GS memory is linear but accessed in 2d.
Page | Block |
---|---|
32 blocks | 4 columns |
-page - block - column - pixel - pixel - pixel - pixel - column - pixel - pixel - pixel - pixel - block - column - pixel - pixel - pixel - pixel
Page configuration is always the same
0 1 2 3 4 5 6 7 8 9 10 11 12 12 14 15 16 17 18 19 ...
Column configuration is always the same
column 0 column 1 column 2 column 3
Formats
PSMCT32
Page Size | Block Size | Column Size |
---|---|---|
64 x 32 | 8 x 8 | 8 x 2 |
Page block configuration
0 1 4 5 16 17 20 21 2 3 6 7 18 19 22 23 8 9 12 13 24 25 28 29 10 11 14 15 26 27 30 31
Column configuration in block
0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15
Color
A (8 bits) | B (8 bits) | G (8 bits) | R (8 bits) |
PSMZ32
Page Size | Block Size | Column Size |
---|---|---|
64 x 32 | 8 x 8 | 8 x 2 |
Page block configuration
24 25 28 29 8 9 12 13 26 27 30 31 10 11 14 15 16 17 20 21 0 1 4 5 18 19 22 23 2 3 6 7
Column configuration in block
0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15
PSMCT24
Page Size | Block Size | Column Size |
---|---|---|
64 x 32 | 8 x 8 | 8 x 2 |
Page block configuration
0 1 4 5 16 17 20 21 2 3 6 7 18 19 22 23 8 9 12 13 24 25 28 29 10 11 14 15 26 27 30 31
Column configuration in block
0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15
B (8 bits) | G (8 bits) | R (8 bits) |
PSMZ24
Page Size | Block Size | Column Size |
---|---|---|
64 x 32 | 8 x 8 | 8 x 2 |
Page block configuration
24 25 28 29 8 9 12 13 26 27 30 31 10 11 14 15 16 17 20 21 0 1 4 5 18 19 22 23 2 3 6 7
Column configuration in block
0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15
PSMCT16
Page Size | Block Size | Column Size |
---|---|---|
64 x 64 | 16 x 8 | 16 x 2 |
Page block configuration
0 2 8 10 1 3 9 11 4 6 12 14 5 7 13 15 16 18 24 26 17 19 25 27 20 22 28 30 21 23 29 31
Column configuration in block
0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15
A (1 bit) | B (5 bits) | G (5 bits) | R (5 bits) |
PSMZ16
Page Size | Block Size | Column Size |
---|---|---|
64 x 64 | 16 x 8 | 16 x 2 |
Page block configuration
24 26 16 18 25 27 17 19 28 30 20 22 29 31 21 23 8 10 0 2 9 11 1 3 12 14 4 6 13 15 5 7
Column configuration in block
0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15
PSMCT16S
Page Size | Block Size | Column Size |
---|---|---|
64 x 64 | 16 x 8 | 16 x 2 |
Page block configuration
0 2 16 18 1 3 17 19 8 10 24 26 9 11 25 27 4 6 20 22 5 7 21 23 12 14 28 30 13 15 29 31
Column configuration in block
0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15
PSMZ16S
Page Size | Block Size | Column Size |
---|---|---|
64 x 64 | 16 x 8 | 16 x 2 |
Page block configuration
24 26 8 10 25 27 9 11 16 18 0 2 17 19 1 3 28 30 12 14 29 31 13 15 20 22 4 6 21 23 5 7
Column configuration in block
0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15
PSMT8
Page Size | Block Size | Column Size |
---|---|---|
128 x 64 | 16 x 16 | 16 x 4 |
Page block configuration
0 1 4 5 16 17 20 21 2 3 6 7 18 19 22 23 8 9 12 13 24 25 28 29 10 11 14 15 26 27 30 31
Column bit configuration (8bit packed into 32bit).
Configuration varies by column number.
Bits 0-7 and 16-23 in column 0 and 2 Bits 8-15 and 24-31 in column 1 and 3 0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15 Bits 8-15 and 24-31 in column 0 and 2 Bits 0-7 and 16-23 in column 1 and 3 8 9 12 13 0 1 4 5 10 11 14 15 2 3 6 7
Color
index (8bits) |
PSMT4
Page Size | Block Size | Column Size |
---|---|---|
128 x 128 | 32 x 16 | 32 x 4 |
Page block configuration
0 2 8 10 1 3 9 11 4 6 12 14 5 7 13 15 16 18 24 26 17 19 25 27 20 22 28 30 21 23 29 31
Column bit configuration (4bit packed into 32bit).
Configuration varies by column number.
Bits 0-3, 8-11, 16-19, and 24-27 in column 0 and 2 Bits 4-7, 12-15, 20-23, and 28-31 in column 1 and 3 0 1 4 5 8 9 12 13 2 3 6 7 10 11 14 15 Bits 4-7, 12-15, 20-23, and 28-31 in column 0 and 2 Bits 0-3, 8-11, 16-19, and 24-27 in column 1 and 3 8 9 12 13 0 1 4 5 10 11 14 15 2 3 6 7
Color
index (4 bits) |