Path: chuka.playstation.co.uk!news From: Developer Support Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: TIM Files Date: Tue, 27 May 1997 13:51:39 +0100 Organization: Sony Computer Entertainment Europe Lines: 113 Message-ID: <338AD8DA.575C@interactive.sony.com> References: <01bc6a20$ed0421e0$98a1cdcd@default> <338AAA1C.634F1584@micronetics.com> <01bc6a97$8048ec80$7ab113cc@default> Reply-To: N/A-Use-Newsgroup NNTP-Posting-Host: 194.203.13.10 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (Win95; I) Nelson Santos wrote: > > > Hi Nelson, > > > > It doesn't look like you are skipping the header of the tim. > > It is four bytes past the start of the file. If the tim is loaded at > > 0x80110000 try pasing 0x80110004 to GsGetTimInfo or do > > > > GsGetTimInfo(((u_long *)PICTURE)+1,&Image); > > > > Regards > > > > Jim > > Yes, I realized that after I posted my message. Here are the new values > after skipping the program header. (I also added the .pw and .ph to the > list, they look correct). > > Pixel Mode: 2 > Pixel X: 513 > Pixel Y: 0 > Pixel W: 320 > Pixel H: 240 > Pixel *: 80110014 > CLUT CX: 17 > CLUT CY: 4294963200 > CLUT CW: 8192 > CLUT CH: 0 > CLUT *: 2000 > > As you can see, the pixel mode is now 2 instead of the 16 I got before. > The pixel width and height are perfect at 320 and 240. The address of the > pixel data of 80110014 seems ok. But the rest of the numbers still don't > make any sense. I ran this exact same program with the MASCOTS2.TIM (those > little cartoon girlies from the 2D demos) and this is what I got: > > Pixel Mode: 9 > Pixel X: 640 > Pixel Y: 320 > Pixel W: 102 > Pixel H: 120 > Pixel *: 80110220 > CLUT CX: 0 > CLUT CY: 481 > CLUT CW: 256 > CLUT CH: 1 > CLUT *: 80110014 > > Which looks perfect to me (except maybe the pixel mode of 9?). So maybe > something is wrong with my PICTURE? I looked into this possibility and > wrong this small program: > > #include > #include "d:\yaroze\lib\pad.h" > > #define PICTURE 0x80110000 > > void main(void) > { > GsIMAGE Image; > RECT Rect; > GsOT OT[2]; > GsOT_TAG OTTags[2][2]; > PACKET Packet[2][24]; > int Buffer; > > PadInit(); > GsInitGraph(320,240,4,0,0); > GsDefDispBuff(0,0,0,240); > GsGetTimInfo((u_long *)(PICTURE+1),&Image); > > OT[0].length=1; > OT[0].org=OTTags[0]; > OT[1].length=1; > OT[1].org=OTTags[1]; > GsClearOt(0,0,&OT[0]); > GsClearOt(0,0,&OT[1]); > > Rect.x = 0; > Rect.y = 0; > Rect.w = 320; > Rect.h = 240; > LoadImage(&Rect,Image.pixel); > Rect.y = 240; > LoadImage(&Rect,Image.pixel); > > while(PadRead(1) != PadSelect) > { > Buffer = GsGetActiveBuff(); > GsSetWorkBase((PACKET *)Packet[Buffer]); > GsClearOt(0,0,&OT[Buffer]); > DrawSync(0); > VSync(0); > GsSwapDispBuff(); > GsDrawOt(&OT[Buffer]); > } > } > > And it displays the PICTURE 100% perfectly. So, what's going on? > (The picture by the way is the WIPEOUT title screen found on the > "Playstation Picks" demo disk that originally came with the PSX.) > > Help! > > Nelson. Mode 2 is 16bit so there is no CLUT, hence the garbage info. Mode 9 is 8bit and mode 8 is 4bit. The modes are 0,1,2 but in the TIM info bit 3 is set if there is a CLUT. So to get the actual mode use pixel_mode & 7, and to find out if there is a CLUT use pixel_mode & 8. Hope this explains everything. Stuart