Psy-Q TIM EXAMPLE

Programming examples for the Psy-Q SDK
Post Reply
User avatar
t0rxe
C Programming Expert
C Programming Expert
Posts: 139
Joined: Dec 19, 2012
Motto: /\OX[]
PlayStation Model: SCPH-5502
Location: Australia

Psy-Q TIM EXAMPLE

Post by t0rxe » June 3rd, 2013, 4:30 pm


PlayStation 1 Psy-Q TIM EXAMPLE

Username: PSXDEV.net
Project Title: TIM EXAMPLE
Time to Complete: 30 minutes
SDK: PSY-Q
Genre: Example
Latest Release: Version 1.2
In Development: No
Initial Release Date: 26-JANUARY-2013
Last Date Updated: 02-JUNE-2013
Controller: N/A
Players: N/A
Memory Card: N/A
Languages: Eng
Region: Auto
Burn and Play: No
Executable Included: Yes
Source Included: Yes

A simple TIM demo for Psy-Q. Draws in 320x256 at 16-bits PAL and 320x240 NTSC.
Read the comments carefully in the main.c file for information.

Image

PS-EXE and Source Code:
timexample.zip

You do not have the required permissions to view the files attached to this post.
"Nostalgia isn't a big enough word to describe the PlayStation from my eyes"

Chris
Active PSXDEV User
Active PSXDEV User
Posts: 47
Joined: Jul 03, 2013
Location: USA
Contact:

Post by Chris » July 3rd, 2013, 5:37 pm

I tried to put my own image in here, but I get this error:
Image
You do not have the required permissions to view the files attached to this post.

User avatar
t0rxe
C Programming Expert
C Programming Expert
Posts: 139
Joined: Dec 19, 2012
Motto: /\OX[]
PlayStation Model: SCPH-5502
Location: Australia

Post by t0rxe » July 3rd, 2013, 5:56 pm

That is because the file 'image.h' contains the character to parse through into the linker.
In this case, I named it 'image' IE: unsigned char image[] = { 0x00 ... }
If you make a new header/binary, make sure you rename the u_char to the one that matches the extern u_char (unsigned char).

You make a TIM using TIMTOOL. Import your image (BMP, PNG, etc) and make it 16-BIT while placing it at 320x0, as those are the coordinates I programmed it to use.

Then you convert your TIM to a binary by using BIN2H (included) naming the u_char 'image'.

I didn't have to make the example like this. I could have just loaded the TIM directly, but for simplistic example reasons this way works fine.
"Nostalgia isn't a big enough word to describe the PlayStation from my eyes"

Chris
Active PSXDEV User
Active PSXDEV User
Posts: 47
Joined: Jul 03, 2013
Location: USA
Contact:

Post by Chris » July 3rd, 2013, 7:55 pm

OK, I drew a 320x240 picture, and I put it in the tim making tool, and this is what I got when I ran it on a PSX emulator. What's going on?
Image
You do not have the required permissions to view the files attached to this post.

User avatar
t0rxe
C Programming Expert
C Programming Expert
Posts: 139
Joined: Dec 19, 2012
Motto: /\OX[]
PlayStation Model: SCPH-5502
Location: Australia

Post by t0rxe » July 3rd, 2013, 8:08 pm

Ah! Sorry, there is a small mistake in my code :(
Change it to this: image1[1].tpage=GetTPage(1, 2, 576, 0);

Before it was at 320 which is why it was messing up. My apologies.
I have updated the code to Version 1.2 above :)
"Nostalgia isn't a big enough word to describe the PlayStation from my eyes"

Chris
Active PSXDEV User
Active PSXDEV User
Posts: 47
Joined: Jul 03, 2013
Location: USA
Contact:

Post by Chris » July 3rd, 2013, 8:33 pm

Hurrah! It works! Thank you.

atm959
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Apr 16, 2016
I am a: Programmer
PlayStation Model: SCPH-9001
Contact:

Post by atm959 » April 16th, 2016, 12:50 pm

I am having trouble. When I use bin2h, it crashes. I followed the steps leading up to it. I am running Windows 7 32 bit.

atm959
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Apr 16, 2016
I am a: Programmer
PlayStation Model: SCPH-9001
Contact:

Post by atm959 » April 16th, 2016, 1:09 pm

Here are some images. I don't know what I did wrong.

Image

Image

Image
You do not have the required permissions to view the files attached to this post.

User avatar
Administrator
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2689
Joined: Dec 31, 2012
I am a: Shadow
PlayStation Model: H2000/5502

Post by Administrator » April 16th, 2016, 1:49 pm

Use a different binary conversion program. Preferably a command line based one.
http://psxdev.net/tools/bin2h.exe
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

atm959
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Apr 16, 2016
I am a: Programmer
PlayStation Model: SCPH-9001
Contact:

Post by atm959 » April 16th, 2016, 2:33 pm

Thanks for the reply! I found out what was wrong.

atm959
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Apr 16, 2016
I am a: Programmer
PlayStation Model: SCPH-9001
Contact:

Post by atm959 » August 1st, 2018, 7:13 pm

I wish that I could delete these old comments lol. I didn't know what I was doing back then, but I've learned since then.

User avatar
Administrator
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2689
Joined: Dec 31, 2012
I am a: Shadow
PlayStation Model: H2000/5502

Post by Administrator » August 1st, 2018, 7:25 pm

atm959 wrote: August 1st, 2018, 7:13 pm I wish that I could delete these old comments lol. I didn't know what I was doing back then, but I've learned since then.
It's good because if others have the same issue, they might find it useful :)
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
MrQuetch
Active PSXDEV User
Active PSXDEV User
Posts: 42
Joined: Apr 01, 2018
I am a: Programmer and artist.
Motto: You can accomplish anything.
Location: United States

Post by MrQuetch » December 20th, 2018, 4:51 pm

Forgive me if this question is absurd... I'm sure I've asked this somewhere before... But, it's been awhile...

Is it possible to manually manipulate the pixels in those texture sheets?

I'm not referring to the actual texture sheets themselves, but rather the program that edits them.

Is there another method to get textures working besides the TIM editor?

I was thinking I could just have an array of colors in my project, and somehow tell a textured primitive to take that data and use it. Is this possible?

Thank you.

User avatar
gwald
Verified
Net Yaroze Enthusiast
Net Yaroze Enthusiast
Posts: 313
Joined: Sep 18, 2013
I am a: programmer/DBA
PlayStation Model: Net Yaroze
Contact:

Post by gwald » December 21st, 2018, 8:18 am

Not sure what you mean by 'TIM editor'.
If you want to create TIM's in PS1 RAM dynamically, you can, the 16bit format was the easiest for me anyway :roll:
MrQuetch wrote: December 20th, 2018, 4:51 pm I was thinking I could just have an array of colors in my project, and somehow tell a textured primitive to take that data and use it. Is this possible?
"textured primitive" I'm assuming you're talking about 3D polygons.
If you want a solid or gradient colours then just use the RGB polygon values and don't bother with UV's coords?
If want a small text sample, you can too, you just set the UV's and if you want to colour the textures with RGB that's also possible, to give you that N64 look :lol:

Maybe saying what you want to achieve would help? ie easiest way to make a 3D textured object flash in a solid colour.

User avatar
MrQuetch
Active PSXDEV User
Active PSXDEV User
Posts: 42
Joined: Apr 01, 2018
I am a: Programmer and artist.
Motto: You can accomplish anything.
Location: United States

Post by MrQuetch » February 11th, 2020, 9:18 am

gwald wrote: December 21st, 2018, 8:18 am Not sure what you mean by 'TIM editor'.
If you want to create TIM's in PS1 RAM dynamically, you can, the 16bit format was the easiest for me anyway :roll:
MrQuetch wrote: December 20th, 2018, 4:51 pm I was thinking I could just have an array of colors in my project, and somehow tell a textured primitive to take that data and use it. Is this possible?
"textured primitive" I'm assuming you're talking about 3D polygons.
If you want a solid or gradient colours then just use the RGB polygon values and don't bother with UV's coords?
If want a small text sample, you can too, you just set the UV's and if you want to colour the textures with RGB that's also possible, to give you that N64 look :lol:

Maybe saying what you want to achieve would help? ie easiest way to make a 3D textured object flash in a solid colour.
This is an awfully late reply... But, I ended up using the 'ClearImage' function to draw squares and pixels in the PS1 texture buffer. So far, it's working perfectly for polygons that use textures. I've also studied the *.TIM file format for a 16-bit image and will be making my own program to convert 24-color bitmaps to that exact file format in a C++ program. Unfortunately, your post didn't help that much as I asked about making arrays of colors and sending them to the buffer - you didn't provide any way of how I could do that. But, I appreciate the attempt.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests