ps2homebrew / Open-PS2-Loader

Game and app loader for Sony PlayStation 2
https://ps2homebrew.github.io/Open-PS2-Loader/
Academic Free License v3.0
2.16k stars 270 forks source link

Weird game resolutions not cropped by GSM #206

Closed carl0sjt closed 5 years ago

carl0sjt commented 5 years ago

GSM still cant upscale these games which results in a supper letter boxed picture

image

carl0sjt commented 5 years ago

The Silent Hill from 2 to 3 Use an abnormal vertical resolution... I will post here when I have them!

gingerbeardman commented 5 years ago

I get this in SSX Tricky.

I've been using my TV settings to correct the aspect ratio. Not ideal.

sp193 commented 5 years ago

This is a GSM problem, and has nothing to do with OPL.

288px * 2 = 576px, which is greater than the height of the EDTV 480P resolution. Have you tried the EDTV 576P mode yet?

carl0sjt commented 5 years ago

I Understand you...

Yes I just tried 576p and it is... fine o_o

But I use PAL/NTSC to force higher resoltion as my TV dont support it through component, also the game has interlaced FMVs... With IGR debug help its easier to show to you...

image

carl0sjt commented 5 years ago

Silent Hill 2/3 are actually 512x448 nothing weird, but there is VRAM corruption??? at botton of screen...

image

Now those two games doesnt seem to be affected by V and H screen settings of GSM...

Tribes Aerial Assault [WTF 512x511 but its the USA release!] image

Area 51 [WTF 512x511 but its the USA release!] image

sp193 commented 5 years ago

I don't understand. You cannot increase the resolution by changing the video mode, particularly between NTSC and PAL since all games will use either by default. Internally, we use the hardware magnification functions to magnify a low-resolution frame buffer to fit the display resolution. The frame buffer's resolution is independent of the display resolution, although there is usually some relationship (usually, it is a factor of the display resolution), but there is nothing that will stop developers from wasting memory.

OPL has no V and H controls, from what I remember. If you were using the standalone GSM, its 576P mode does not work properly, as it sets the wrong display resolution, causing graphical errors in some titles.

Interlacing is a video-rendering technique for doubling the vertical height. It is usually not related to the video files in the game itself, but how the game renders. How is that relevant to what you are trying here? NTSC and PAL are interlaced video modes.

gingerbeardman commented 5 years ago

@sp193 I am playing 480p games on a 480p LCD over Component. Is this just not supported by GSM for some games?

sp193 commented 5 years ago

If your game uses 480P, your TV accepts 480P and you choose to use 480P, then it will work and you do not even need GSM.

In fact, if you can go without GSM, that would be best because it would result in less modifications to the content of EE memory.

But if you wanted to ask if there would be any consequences to using GSM for such a thing, no... at least not by design.

gingerbeardman commented 5 years ago

The game does not have native 480p, which is why I use GSM to get it. But is appears letterboxed for some games eg. SSX Tricky

sp193 commented 5 years ago

Ah, I see. It is technically not possible to have a perfect transition to 480P. The resolutions for NTSC and EDTV 480P are quite different, which is why letterboxing occurs.

NTSC: 640 x 448 EDTV 480P: 720 x 480

The acceptable frame buffer sizes are quite a few in number for NTSC and PAL, due to the actual width of the display area in VCKs (256, 512 and 640 are all factors of 2560). The vertical height can be higher than 448px, but not all TVs can display all 480 lines and the undisplayed lines are at the expense of video memory.

It gets worse when the original width is 512px, as the unused screen width becomes 28% (720-512)/720=28%.

carl0sjt commented 5 years ago

I don't understand. You cannot increase the resolution by changing the video mode, particularly between NTSC and PAL since all games will use either by default. Internally, we use the hardware magnification functions to magnify a low-resolution frame buffer to fit the display resolution. The frame buffer's resolution is independent of the display resolution, although there is usually some relationship (usually, it is a factor of the display resolution), but there is nothing that will stop developers from wasting memory.

OPL has no V and H controls, from what I remember. If you were using the standalone GSM, its 576P mode does not work properly, as it sets the wrong display resolution, causing graphical errors in some titles.

Interlacing is a video-rendering technique for doubling the vertical height. It is usually not related to the video files in the game itself, but how the game renders. How is that relevant to what you are trying here? NTSC and PAL are interlaced video modes.

I force NTSC/PAL because if dont my TV will display Unsupported format while playing this game, ICO, POPS emulator (In POPS I use the $HDTVFIX command). So yes, by Forcing PAL/NTSC with GSM I can get the picture to show in my TV, so I assume GSM is forcing a higher resolution than 640x288.

The V and H commands I said is the Y and X pos adjustment (Below VMODE and ABOVE Emulate FIELD flipping in GSM setting of OPL)

If I use 576p/480p the FMVs will stutter/audio out of sync with emulate FIELD flipping, without emulate flipping they not even play and the game hangs. Thats why i preffer NTSC/PAL over 576/480p with games like this.

---//---- Sometimes GSM Is better than the game built-in progressive scan... some games downgrade to 16bit color or use some ugly video filter and make it blurrier like SOCOM 2/3 and a Star War game that i dont remember the name!

gingerbeardman commented 5 years ago

Here's what SSX Tricky looks like when running at EDTV 480p.

I'd expect to see bars above and below, but instead here they are left and right?

vftCwU8

zappepappe commented 5 years ago

Here's what SSX Tricky looks like when running at EDTV 480p.

I'd expect to see bars above and below, but instead here they are left and right?

vftCwU8

That's because the console is sending a 512 or 640 wide image in a 720 wide frame. It's completely normal for a digital television to react like that.

carl0sjt commented 5 years ago

Here is a better picture of I wanted to show about Silent Hill 2.

image

Damn in silent hill 2 you cant adjust X and Y screen position

gingerbeardman commented 5 years ago

That's because the console is sending a 512 or 640 wide image in a 720 wide frame. It's completely normal for a digital television to react like that.

I'm not sure I follow @zappepappe?

I am using a 640x480p TV. The game displays fine in 480i, it's just when i force 480p using GSM that it is displayed squished in the middle

sp193 commented 5 years ago

Your TV is capable of displaying video in various modes. Each dot does not have the same size across all display modes.

Otherwise, how does a TV display video in NTSC, PAL, 480P, 720P etc?

Our 480P mode (720x480) is wider than NTSC, as it does not share the same aspect ratio. The smaller the video width (e.g. 512px), the greater the number of columns that will not be used. The NTSC resolution is something like 2560x448, which would allow for a lot of factors (256, 512, 640 are possible, but all of them will not nicely fill out 720px). I read that it's because NTSC is analog and a CRT TV renders in lines, so any arbitrary number of pixels can be encoded within a line.

Even though NTSC tends to be associated with 480I, it does not share the same resolution as our 480P mode.

gingerbeardman commented 5 years ago

Sure, I understand how a panel of one native resolution can display numerous other non-native resolutions.

I've only encountered SSX Tricky behaving oddly in the way this issue is describing. Most game I force into 480p display just fine across the whole 640x480. Why is there a difference?

TnA-Plastic commented 5 years ago

Like multiple people tried to explain to you already...

Because the horizontal resolution is different and because the 'magnification' in integers (full numbers) only allow for doubling/tripling/quadrupling and so on...

If you would use a magnification which is one higher than the current value, it would stretch the left and right border to the extent, that they are not within the shown frame...

You have to differentiate between the 'rendered resolution' and the 'output-resolution' and regardless if your TVs Panel has a resolution of 640 480 or 2134 234, that has NOTHING to do with either of both resolutions (rendered res. and output res.)!

Tl;dr @zappepappe and @SP193 explained it as easy as it gets... '480p' is 720 480... 'NTSC' is technically the same resolution, but since a console (and so on), usually renders in SQUARE PIXELS, the expected resolution is like 640480 in that case...

You want to stretch it more, via using an/one integer-MAGH higher? Fine... But that will chop off, left and right of the picture...

Most importantly to know... We can only MAGNIFY the RENDERED resolution, along integers (full numbers)... We can NOT (with the current code) manually 'stretch' the RENDERED picture to any shape, form, or size...

For example: A 512 * 240 RENDERED resolution... 512=X; 240=Y

Let's say we want to use 1080p as OUTPUT-RESOLUTION... 512 4=2048 or 512 3=1536 240 4=960 or 240 5=1200

A MAGV/MAGH of 4/4 would be a 2048 * 960 picture, which means 120 lines are black (60 on top and bottom) and 128 pixels are not shown... These 128 are (divided by the mag-value 4) 32... 16 pixels are not shown left&right in this example, even tho' they are rendered.

gingerbeardman commented 5 years ago

As I mentioned above, I understand.

...but I don't think you're seeing my question:

When forcing 480p in GSM why does the output vary (squished/not) between games?

Is it because they are rendering at different resolutions?

sp193 commented 5 years ago

Yes. Developers were not restricted to use any one resolution. The magic of math (whereby 512 and 640 are both factors of 2560) allows a frame buffer of 512x448 to equally fill out a NTSC screen as much as a 640x448 frame buffer. But the latter will waste more screen space on the 480P display area, compared to the former.

(720-512)/720=28% is nearly a third of the width getting wasted, which is why it is so noticeable. On the other hand, (720-640)/720=11% is much more marginal.

So as the answer to the question of this thread, there is no fix for widths/heights that do not divide the display area's width/height. Without changing how the game does rendering, there is no way to actually change the frame buffer resolution (and hence aspect ratio).

carl0sjt commented 5 years ago

Cant GSM magnify PAL 640x228 to 640x576 and even NTSC 640x576?

NTSC I know we will get cut off screen at botton and top but would be better than nothing...

Or at least bring POPS SetGsCrt hack to allow us to play this shitty game over component?

zappepappe commented 5 years ago

@gingerbeardman I don't know if you're satisfied with your answer, but I'll try to clear it up with my novice understanding of the issue.

First of all the PS2 outputs analog video. Analog video doesn't have the concept of pixels, it works with lines and timing. Every line starts and ends with a blanking area called horizontal blank to give the display time to move to the next line. The signal will hold for a certain amount of time on each line to represent a pixel on screen.

This does not translate well to a digital signal where the image is represented by distinct pixels. To do this conversion most analog-to-digital converters will assume the most common resolution for the specific number of lines in the signal on the specific input the signal comes from. The PS2 usually communicates with CVBS (composit), S-Video, SCART or YPbPr (component), so the converter will assume it's a TV signal. And it mostly use 525i, 625i or 525p lines which all most commonly have a line timing equal to 858. Of these 525 or 625 lines the centre 480 or 576 lines are used for picture and the rest is vertical blanking area. Horizontally the centre 720 pixels of the 858 lines are used for picture, the rest is horizontal blanking.

The issue you are seeing is that the PS2 doesn't use this common line structure. While 640x448 and 640x512 does have a samplerate of 858, it doesn't use 720 but 640 of the pixels. This means that the image will be slightly squished to fit in a 4:3 aspect ratio, but the blank sides will likely be hidden by the TVs overscan.

With 512 wide interlaced games however, the line samplerate should be around 686.4. This will cause all the converted pixels to miss the correct timing on the line and the image to look a bit blurry. But because it takes those 858 samples and extracts the 720 centre pixels you will at least get a relatively close to correct aspect ratio.

So, finally to the issue you are seeing. When you tell the PS2 to output a 512 wide game in progressive mode, it will take those 512 pixels and put them in a 720 wide frame, adding blank space on the sides. This will then be sent as a 858 signal and correctly sampled by the converter (sharp pixels, yay!). But it will display the extra blanking area as part of the actual picture (boo!) and squees the picture even more than with a 640 game.

Hope that at least clears some of it up.

EDIT: Clarification and grammar.

gingerbeardman commented 5 years ago

More than satisfied — thanks all!

TnA-Plastic commented 5 years ago

@gingerbeardman: Well, you did not understand it completely (before).

I see, understand and honestly tried to answer your questions.

Regarding your last 2 sentences: YES! EXACTLY!

Just for example:

GT4 uses a(n) '(internal) render-resolution' of 640(H/X) 540(V/Y), when 1080i is chosen as 'output-resolution'... thus '640' is 'magnifyed' to 1920 via a Magnification-Integer (for the horizontal resolution [referred to as 'MAGH']) of '3' (3 640 = 1920) and either the vertical resolution is magnifyed by an integer value [referred to as 'MAGV'] of '2' (2 * 540 = 1080), or the interlace-framebuffer-switching-trick (or how to call it), is used to render the alternating half-frames and switch every half-frame (which would result in a true 1080px vertically resolution, contrary to the 'magnification-method').

Edit: Dang... 3 new answers since my last refresh... ^^6

The last answer @zappepappe wrote is also correct and PART OF the problem, but is rather related to what is referred to as 'dx' and 'dy' (or was it something with h and v?)!

You can still 'magnify' your RENDERED 'resolution' or 'picture' to fill the screen (output-resolution or 'frame' where the rendered picture is in) completely, but it will magnify it to the extent that some parts of the rendered picture will be 'outside' of the frame/output-resolution/'what's shown on screen'...

To put it short...

We could also set the output-resolution to i.e. 1080i for every game and let the render-resolution + game's usual/normal magnification on default and not recalculate it and you would get a mini-picture (black borders all around) in a big 'frame'.

The MAG-values are 'integers' (a Data-type to store a 'full number) and thus, using these we can only MULTIPLY the given render-resolution... i.e. 512 240 becomes 1024 720 (MAGH=2, MAGV=3)!

If we could use' floats' (floating point numbers/values) [those with a point or decimal], we could multiply by i.e. '1.36'...

BUT... I think we theoretically can do that screen-stretching in 'smaller steps', although that probably would need manual tweaking of other values than MAGH&MAGV.

TnA-Plastic commented 5 years ago

Tl;dr

To understand the problem, you need to understand these things.

-Render-Resolution (512 288, 640480, or whatever...) [imagine it as painted... erm... drawn 'picture'] -output-resolution/frame (480p, 720p, 1080i or whatever, which GSM 'sets') [imagine it as 'frame' for the 'picture'] -magnification (multiplying of the render-resolution) -'frame-composition' (which is the thing SP193 and zappepappe explained [the 2560-value and the other numerical values or 'Divisions' of that value])

Btw.: Me requesting if you understood it, wasn't meant mean. I removed it anyway, because I see it might 'sound' weird or harsh.

I appreciate people asking questions (which are intended to gather knowledge)!

gingerbeardman commented 5 years ago

Not at all, I took it as intended 👍

TnA-Plastic commented 5 years ago

Whuat? :-3

What exactly are you referring to?

gingerbeardman commented 5 years ago

Btw.: Me requesting if you understood it, wasn't meant mean.

I did not see it as being mean — don't worry

Tupakaveli commented 5 years ago

@ElPatas1 can this be closed too since an answer was provided?

ElPatas1 commented 5 years ago

Closed.

Best regards.

invaderlex commented 3 years ago

Here is a better picture of I wanted to show about Silent Hill 2.

image

Damn in silent hill 2 you cant adjust X and Y screen position

In GSM there is a H V position setting, put the Vertical setting in 40 and it will move the image down. In progressive mode all the 'in game' screen positioning do not work.