TM2 TIM2 Image: Difference between revisions
Jump to navigation
Jump to search
imported>Ikskoks No edit summary |
imported>Ikskoks No edit summary |
(No difference)
| |
Revision as of 12:59, 17 January 2021
Contents: GRAFs page - All - 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - Edit
Format Type: Image
Extensions: tm2 tim2 tim
Platforms: PS2, PSP
Endian Order: Little Endian
Format Specifications
// Specs based off "Rainbow" from https://github.com/marco-calautti/Rainbow/
// IMAGE HEADER
4 - Header (TIM2)
2 - Version
2 - Number of Images
// IMAGE DATA
// for each Image
4 - Total Image Length
4 - Palette Length
4 - Image Data Length
2 - Header Length
2 - Color Entries
1 - Image Format (0=8bpp paletted?)
1 - Mipmap Count
1 - CLUT Format
1 - Bits Per Pixel (1=16bbp, 2=24bpp, 3=32bbp, 4=4bbp, 5=8bpp)
2 - Image Width
2 - Image Height
8 - GsTEX0
8 - GsTEX1
4 - GsRegs
4 - GsTexClut
X - User Data (optional) (length = HeaderLength-48)
parameters.linearPalette = (clutFormat & 0x80) != 0;
clutFormat &= 0x7F;
parameters.colorSize = parameters.bpp > 8 ? parameters.bpp / 8 : (clutFormat & 0x07) + 1;
X - Image Data (length = ImageDataLength){
if (bitsPerPixel <= 8){
// indexed colors
}
else {
if (colorSize == 2){
// 16BITLE_ABGR_5551 Format
}
else if (colorSize == 3){
// 24BIT_RGB Format
}
else if (colorSize == 4){
// 32BIT_RGBA Format
}
}
}
X - Palette Data (length = PaletteLength) (only if Bits Per Pixel <= 8?){
int numberOfPalettes = paletteData.Length / ((int)colorEntries * parameters.colorSize);
int singlePaletteSize = paletteData.Length / numberOfPalettes;
// for each palette
if (colorSize == 2){
// 16BITLE_ABGR_5551 Format
numColors = singlePaletteSize/2;
}
else if (colorSize == 3){
// 24BIT_RGB Format
numColors = singlePaletteSize/3;
}
else if (colorSize == 4){
// 32BIT_RGBA Format
numColors = singlePaletteSize/4;
}
if (!linearPalette && bitsPerPixel != 8){
// read the palette then apply the following...
int parts = thisPaletteLength / 32;
int stripes=2;
int colors = 8;
int blocks = 2;
int i = 0;
for (int part = 0; part < parts; part++){
for (int block = 0; block < blocks; block++){
for (int stripe = 0; stripe < stripes; stripe++){
for (int color = 0; color < colors; color++){
newPalette[i++] = oldPalette[ part * colors * stripes * blocks + block * colors + stripe * stripes * colors + color ];
}
}
}
}
}
else {
// color palette is OK as is
}
}
MultiEx BMS Script
No BMS script
Supported Programs
Notes
No additional notes
Games
- LMA Manager 2007
- PlayStation 2 (PS2)
- PlayStation Portable (PSP)
- Rule of Rose [PS2]