Page 1 of 1

Trouble with screen resolution

Posted: November 20th, 2019, 7:53 am
by Jaberwocky
I recently started to get into PSX development and I use the wonderfull NO$PSX emulator to test my iso files. However, I now started with the basic rendering.

I setup the display and draw enviroment like this:

Code: Select all

#define ScreenWidth  320
#define ScreenHeight 240

SetDefDrawEnv(&displayEnv[0].draw, 0,            0, ScreenWidth, ScreenHeight);
SetDefDrawEnv(&displayEnv[1].draw, 0, ScreenHeight, ScreenWidth, ScreenHeight);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetDefDispEnv(&displayEnv[0].disp, 0, ScreenHeight, ScreenWidth, ScreenHeight);
SetDefDispEnv(&displayEnv[1].disp, 0,            0, ScreenWidth, ScreenHeight);
And then I render a simple blue triangle, cutting the screen in half. Running my ISO with NO$PSX I get a resolution of 320x224px for some reason oO The scene itself is centered so the screen is not actually cut a half. I also tried the PSXeven emulator - there I get the right scene and a resolution of 320x240.
Is my NO$PSX configurated incorrectly?

I made screenshots of the output and attach them to this post.

Re: Trouble with screen resolution

Posted: November 21st, 2019, 1:35 am
by Shadow
You're missing a bunch of other functions to setup the GPU correctly. Best to check the Sony examples :)

Re: Trouble with screen resolution

Posted: November 21st, 2019, 6:58 am
by Jaberwocky
Shadow wrote: November 21st, 2019, 1:35 am You're missing a bunch of other functions to setup the GPU correctly. Best to check the Sony examples :)
I was missing some functions in my short code snippet - however, I followed your advice and looked into one of the examples, explicit at:
C:\psyq\cdemu\Sample\Basic\main.c

I simply copied that code, removed the CD related stuff and I still have the problem :/ And again, PSXEVEN uses the correct height.

Edit:
I also tried the HIWORLD example from the website - if I go for PAL with a height of 256, I will end with a height of 264, but rendering will take place in a rect with height of 240 @_@
Going for NTSC with 240, I will have the old behaviour again...

Re: Trouble with screen resolution

Posted: November 21st, 2019, 9:59 pm
by Shadow
Make sure you're setting interlaced and progressive scan modes correctly per region. You might also need to adjust the offset position.

IE:

Code: Select all

PAL
GsDISPENV.screen.x = -2;
GsDISPENV.screen.y = 16;

NTSC
GsDISPENV.screen.x = 0;
GsDISPENV.screen.y = 6;

Re: Trouble with screen resolution

Posted: November 22nd, 2019, 8:39 am
by Jaberwocky
I kept looking into this issue and noticed something... If I go for NTSC and have a height of 240, I noticed that NO$PSX uses a height of 224 instead - well I read in a function description, that monitors do not show the first 8 pixel at the top and the last 8 at the bottom... that would make 16px.
Now... 224px + 16px => 240px
I guess NO$PSX simulates that effect?

But I still don't get 264px when I go for PAL - that makes additional 8px...