TMD file format doc.

Confidential documents, images and information by Sony and miscellaneous hackers for the PlayStation 1
Post Reply
User avatar
CosmoGuy
Serious PSXDEV User
Serious PSXDEV User
Posts: 90
Joined: May 30th, 2012, 1:22 am
I am a: Student, Programmmer, graphic 3d+2d
PlayStation Model: SCPH-7502
Skype: kamilm1222
Steam: amiga3000

TMD file format doc.

Post by CosmoGuy » June 10th, 2012, 11:52 pm

Here is the documentation i just found on the net. Just to archive it here. It can be useful for people who starts all of it. I mean beginners.

PRIMITIVE LIST'S MEMBER VARIABLES FORMAT

Code: Select all

U_CHAR FLAG - options for primitive
{
bit 0; - LGT. Light source calculation
0 - On. Light source calculation is carried out
1 - Off. Light source calculation is not carried out
bit 1; - FCE. Determines if primitive is one or two faced
0 - Primitive has one face
1 - Primitive has two faces
bit 2; - GRD. Determines single or gradient pigment
0 - Primitive has one solid pigment
1 - Primitive has different pigments at each vertex
bits 3-7; - ignored
}
Note
Most of these bits are set or cleared according to which type of primitive
is being created. Messing around with these may cause unexpected drawing or
crashes. The only bit you may want to edit manually is FCE.

Code: Select all

U_CHAR MODE - options for primitive
{
bit 0; - TGE. Brightness calculation at time of calculation
0 - On. Calculates light
1 - Off. Draws texture as is (without lighting)
bit 1; - ABE. Activates translucency when rendered
0 - Off. Primitive is rendered solid.
1 - On. Primitive is rendered semitranslucent.
bit 2; - TME. Sets whether a texture is used or not
0 - Off. No texture is rendered.
1 - On. A texture is rendered.
bit 3; - displays whether a 3 or 4 sided polygon
0 - 3 sided polygon
1 - 4 sided polygon
bit 4; - IIP. Shading mode
0 - Flat shading
1 - Gouraud shading
bits 5-7; - Code. Defines which sort of entity to draw.
0 - Polygon (3 sided or 4 sided)
1 - Straight line
2 - Sprite
}
Possible values of ABR (semitransparency method)
Note
Most of these bits are set or cleared according to which type of
primitive is being created. Messing around with these may cause
unexpected drawing or crashes. The only bit you may want to edit
manually is ABE.
For semitransparency to be used when the TMD is rendered, bit 30
of the GsDOBJ's attribute member must be set. To control the
semitransparency method, alter the ABR bits of the primitive's TSB
member (see below).

Code: Select all

U_SHORT CBA - position of CLUT in VRAM for primitives with textures
{
bits 0-5; - upper 6 bits of 10 bits of X coordinate value
for CLUT in VRAM
bits 6-14; - 9 bits of Y coordinate value for CLUT in VRAM
bit 15; - ignored
}
For example -
u_long CLUT_X_POS = 640;
u_long CLUT_Y_POS = 480;
u_short CBA = (CLUT_X_POS >> 4) + (CLUT_Y_POS << 6);
U_SHORT TSB - information about image for primitives with textures
{
bits 0-4; - texture page number of texture
bits 5-6; - ABR. Semitransparency method (see below)
bits 7-8; - TPF. Colour mode of the texture (see below)
bits 9-15; - ignored
}
Possible values of ABR (semitransparency method)
Note
For semitransparency to be used when the TMD is rendered, bit 30 of
the GsDOBJ's attribute member must be set, and the ABE bit of the
primitive's mode member must be set (see above).
0 - 50% background +50% polygon
1 - 100% background +100% polygon
2 - 100% background - 100% polygon
3 - 100% background + 25% polygon
Possible values of TPF (colour mode)
0 - 4 bit texture and CLUT
1 - 8 bit texture and CLUT
2 - 15 bit texture with no CLUT
For example -

Code: Select all

u_long IMG_X_POS = 640;
u_long IMG_Y_POS = 0;
u_long ABR = 1; // 100% back + 100% polygon
u_long TPF = 0; // 16 colour texture
u_short TXT_TPAGE;
TXT_TPAGE = GetTPage((int) TPF, (int) ABR, IMG_X_POS, IMG_Y_POS);
u_short TSB = (TXT_TPAGE) + (ABR << 5) + (TPF << 7);
4099
Image

User avatar
Gemini
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: TMD file format doc.

Post by Gemini » June 11th, 2012, 2:46 am

This barely explains a thing about the TMD format. I'd suggest people who'd actually want to use it (no idea why tho, the format's so bloated it makes little sense) to check the FILEFRMT.PDF document. It gives all the info needed for TMD and a ton other PSY-Q formats.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest