xerpi / vita-udcd-uvc

PSVita UDCD USB Video Class plugin
468 stars 23 forks source link

PS1 games being stretched to fullscreen #59

Open yossariano opened 4 years ago

yossariano commented 4 years ago

I'm using the latest build of the udcd-uvc plugin (thanks for a great utility, btw) and mplayer- and whenever I open a PS1 game (using adrenaline + adrenaline bubble manager), it stretches the image to fullscreen no matter what the vita screen looks like (in my case I prefer 1:1 pixels as much as possible).

Image being stretched to fullscreen, differing from vita display: image

I can see in the code where we are treating PS1 framebuffers differently: https://github.com/xerpi/vita-udcd-uvc/blob/master/src/main.c#L532

I pulled the repo and tried tweaking the values of SceIftuPixelformat being used here, but without better knowledge of the vita sdk I was just guessing and checking. As far as I can tell your settings are the only ones which at least give the proper color and don't duplicate the image.

However- if you open the official settings overlay while playing a PS1 game, you can actually see the image behind the transparent overlay shrinks to the proper scaling. It blows back up to fullscreen when you close the settings overlay. Opening this issue to see if anyone has had any luck in getting an unstretched PS1 image / if this is just on my machine. Example images below.

Settings menu making image correct aspect ratio: image

Invictaz commented 4 years ago

The stretch should be optional. I like it though.

ghost commented 4 years ago

What you need to do is add a 4:3 frame descriptor in usb_descriptors.h and select that on the video player when you play PS1 games.

TheIronUniverse commented 4 years ago

this happened to me as well, what worked for me was loading up my PS1 game, going into Adrenaline settings, and changing Graphics Filtering to anything, bilinear is probably best though.

TheIronUniverse commented 4 years ago

you will have to do this with every PS1 game you want to display properly

Invictaz commented 4 years ago

@cuevavirus maybe you can add this?

xerpi commented 4 years ago

The stretching is being done here: https://github.com/xerpi/vita-udcd-uvc/blob/master/src/main.c#L620 To center the image you have to do something like: src.dst_x = 960/2 - src_width/2 and (convert it to 8.8 fixed point format). I had in mind to change the code so that it keeps the original resolution/offsets but in the end, I didn't...

Emiougus commented 4 years ago

The stretching is being done here: https://github.com/xerpi/vita-udcd-uvc/blob/master/src/main.c#L620 To center the image you have to do something like: src.dst_x = 960/2 - src_width/2 and (convert it to 8.8 fixed point format). I had in mind to change the code so that it keeps the original resolution/offsets but in the end, I didn't...

Tried doing this but it just offset the image and cut off half of it

This is the edit I made:

src.dst_x = 245760/512 - src_width/512; src.dst_y = 139264/512 - src_height/512;

Dunno if that's what you meant to do, also tried just altering the src.dst_x value and not the src.dst_y and but as expected after seeing the result of my first attempt it just got rid of the vertical offset and the horizontal offset stayed. Did manage to add a 4:3 Frame descriptor as Cuevavirus suggested and it works well, though there seems to be some smoothing of sorts going on as the image is perfect on the vita but on my screen the pixels are somewhat smoothed, dunno if that's an intentional feature of the plugin or not

ghost commented 4 years ago

I had in mind to change the code so that it keeps the original resolution/offsets but in the end, I didn't...

PS1 games have variable resolution or resolution that doesn't match the intended aspect ratio. I had the same problem in Sharpscale and what I ended up doing is having an option to force the AR.

though there seems to be some smoothing of sorts going on as the image is perfect on the vita but on my screen the pixels are somewhat smoothed

SceIftuConvParams.unk4 is the flag for bilinear filtering if you want to remove that

Invictaz commented 4 years ago

I hope someone will fix this with a "PS1 mode" or something like that.

RuiOrey commented 3 years ago

it would be nice to be able to disable/toggle bilinear filtering in some way, specially using sharpscale. And relative to the scale, isn't possible to make the ps games to keep the ps1 settings overlay scaling when it's not visible?

QUAKEULUS commented 3 years ago

Thanks, confirmed enabling bilinear under graphics filtering in adrenaline menu fixed the stretch (smooth graphics: yes, however, does not)

proposed fix: adding another resolution mode for 4:3 content instead of worrying about what is or isn't a ps1 game

xerpi commented 3 years ago

Ideally, we could have a config file with per-game options saying whether you want it to expand to full-screen or to keep the game's resolution. Unfortunately, I'm not available these days. So if any developer wants to help, I'll provide the info necessary to do that.