68 enum class Type : uint8_t {
106 const uint16_t*
data =
nullptr;
123 bool parse(
const uint8_t* data, uint32_t
size);
182 unsigned width()
const;
189 Error m_error = Error::None;
190 bool m_hasCLUT =
false;
The singleton GPU class.
Definition gpu.hh:83
Error
The error codes returned by every memory card operation.
Definition memory-card.hh:75
static int size
Definition string.h:149
A primitive's CLUT command.
Definition common.hh:121
A primitive's tpage attribute.
Definition common.hh:188
The Rect struct.
Definition common.hh:74
Vertex size
Definition common.hh:79
One CLUT or pixel section.
Definition tim.hh:105
const uint16_t * data
Definition tim.hh:106
Rect rect
Definition tim.hh:107
bool aligned
Whether data sits on a four byte boundary, as DMA requires.
Definition tim.hh:108
A reader for Sony's TIM texture container.
Definition tim.hh:59
Error error() const
Definition tim.hh:171
unsigned width() const
The width of the image in texels rather than in VRAM units.
Definition tim.cpp:146
bool parse(const uint8_t *data, uint32_t size)
Parses a TIM out of a buffer, without copying or taking ownership.
Definition tim.cpp:47
Type type() const
Definition tim.hh:170
PrimPieces::TPageAttr tpage(Vertex texturePosition) const
Builds the texture page attribute describing where the pixels landed, with the colour mode taken from...
Definition tim.cpp:218
Error
Why a TIM was rejected.
Definition tim.hh:88
@ Truncated
A section claims to extend past the end of the buffer.
@ Compressed
The reserved field is set, which marks a compressed TIM.
@ BadSectionSize
A section's declared size disagrees with its dimensions.
@ BadType
The type field is outside the range the format defines.
@ BadMagic
The file does not start with 0x10, 0x00.
@ TooSmall
The buffer cannot hold even a file header.
bool hasCLUT() const
Definition tim.hh:169
void upload(GPU &gpu) const
Uploads the texture, and its palette if it has one, to the VRAM coordinates the file itself asks for.
Definition tim.cpp:208
const Section & pixels() const
Definition tim.hh:173
Type
The pixel format of the data, as declared by the file.
Definition tim.hh:68
unsigned height() const
Definition tim.hh:183
PrimPieces::ClutIndex clutIndex(Vertex clutPosition) const
Builds the CLUT index for a palette uploaded at the given VRAM position. Meaningless when the file ha...
Definition tim.cpp:241
const Section & clut() const
Definition tim.hh:174
The Vertex struct.
Definition common.hh:47
int16_t h
Definition common.hh:53