A tale of two TIMS

Graphic based area of development (Graphics Processing Unit), including the Geometry Transform Engine (GTE), TIM, STR (MDEC), etc.
Post Reply
ycelik
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: September 2nd, 2018, 10:19 am

A tale of two TIMS

Post by ycelik » September 20th, 2018, 9:07 am

Hi guys,

I have some questions. I am currently loading two TIMS into memory.
The first TIM is loaded at 0x80180000 and the second one is loaded at (0x80180000 + the file length in bytes of the first TIM). When I initialise both TIMS (set PolyFT4, tpage, and clut) and then add them to the OT, I only see the second POLY_FT4). However, when I comment the second POLY_FT4's initialisation and addition to the OT, I see the first POLY_FT4 again. I have written the code according to the samples found in the PSYQ-SDK, so I just cannot place my finger on what I am doing wrong.
My code can be found here: https://pastebin.com/gKmvQUGr

Bytheway, I use .bat file wherein I specify two pqbload commands with the TIM files and their respective addresses.

User avatar
LameGuy64
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 351
Joined: April 10th, 2013, 3:47 pm
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Skype: lameguy64
Location: Philippines

Re: A tale of two TIMS

Post by LameGuy64 » September 20th, 2018, 11:29 am

Sounds like the TIMs are getting overwritten. Have you checked if the TIMs are positioned at different coordinates in the VRAM using TIMTOOL? If they're on different positions make sure the correct TPage value using getTPage() is set on each POLY_FT4 primitive.

You may also want to check if your textures are page aligned by aligning the upper left corner of the image to the grid in TIMTOOL.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

ycelik
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: September 2nd, 2018, 10:19 am

Re: A tale of two TIMS

Post by ycelik » September 20th, 2018, 5:50 pm

LameGuy64, thanks for your very helpful reply.
Immediately when I read this after waking up, I directly ran before going to work to the P3 machine to see whether it was such a rookie mistake. Alas, I discovered that I did indeed separate the sprites properly, and it was not a case of overlapping texture pages.
However, your post got me thinking, and I soon discovered the real problem: the CLUT of the first TIM was being overwritten! The reason for this lay in the misconstruction of the double buffer in relation to the texture layout.
In other words, I thought that I was constructing the double buffer adjacently, but apparently I was doing it stacked.

Code: Select all

  
    SetDefDrawEnv(&db[0].draw, 0,   0, 320, 240);
    SetDefDrawEnv(&db[1].draw, 0, 240, 320, 240);
    SetDefDispEnv(&db[0].disp, 0, 240, 320, 240);
    SetDefDispEnv(&db[1].disp, 0,   0, 320, 240);
Now I know why I saw both sprites displayed at first instance, when I stepped through the debugger; once the page flip happened the CLUT was overwritten...
What a rookie mistake, but I am so happy that it is behind me now, because this was holding up so much.
P.s. I saw an old post of Shadow who also had an issue with multiple TIM display; was also a CLUT problem...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest