Changes

Jump to navigation Jump to search

PSX/TIM format

997 bytes added, 21:11, 3 March 2005
no edit summary
== File layout ==
A TIM file is made up of three conceptual blocks; the header, the color lookup table (CLUT) and the image data. The CLUT block and the image data block have the same basic layout and are also treated the same way when loading a TIM file into the PlayStation frame buffer. Also, the CLUT block is optional and technically does not need to be present, even when the image data consists of color indices. Such image data is assumed to refer to ''some'' color lookup table, but not necessarily one stored in the same TIM file -- on the PlayStation, the actual CLUT used for a set of image data is referred to only by its frame buffer coordinates, not by the file it comes from. In almost all cases though, the CLUT is included in the same TIM file as the image data using it and can thus be assumed to be applicable.
<br/><center>[[Image:PSX_TIM_file_layout.png]]</center><br/>
== Header ==
The header starts with a 'tag' byte; this value is constant for all TIM files and must be 0x10. The immediately following byte denotes the version of the file format. At present, only version '0' TIM files are known to exist.
 
The next 32-bit word contains specific flags denoting the basic properties of the TIM file. The BPP (Bits Per Pixel) value denotes the bit depth of the image data, according to the following values:
<pre>
00 4-bit
01 8-bit
10 16-bit
11 24-bit
</pre>
The CLP (Color Lookup table Present) flag simply denotes if the CLUT block is present in the TIM file. This flag is typically set when BPP is 00 or 01, and cleared otherwise.
== CLUT (color lookup table) ==
== Image data ==
 
 
 
<cpp>
// C++ code:
#include <stdio.h>
#include "tim.h"
 
class TIMFile {
public:
TIMFile() { return; }
~TIMFile() { return; }
 
/* Multi
line
comment */
 
protected:
int m_data;
};
</cpp>
Anonymous user

Navigation menu