[OGC] Add support for Custom Aspect Ratios#91
[OGC] Add support for Custom Aspect Ratios#91Fancy2209 wants to merge 33 commits intodevkitPro:ogc-sdl-2.28from
Conversation
|
I believe this is now ready for review |
Stuff was setting the viewport and scissor to 854 Renderer now only adjusts projection if it's trying to set the viewport to 640*480 (this feels like not the intended way but I haven't found a better one)
Co-authored-by: Alberto Mardegan <mardy@users.sourceforge.net>
Fix 4:3 Make mouse actually unstreched on 16:9 Fix SDL_DisplayMode 16:9 width (for real this time)
|
Btw there's something wrong with the code for centering the window, on widescreen VVVVVVV is setting the window x pos to 207, seems related to SDL_WINDOWPOS_CENTERED_DISPLAY (the x was smaller when I sent the picture above but it changed and I haven't found out why ) |
| { | ||
| SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; | ||
|
|
||
| // TODO: Should I make this only happen if the aspect ratio isn't 4:3? |
There was a problem hiding this comment.
To simplify things I suggest forgetting about the VI changes for now (have them in a separate PR later), because handing of the CONF_GetAspectRatio() is a bit orthogonal to setting the best video mode. It will make testing and reviewing easier, if we tackle one issue at a time.
|
I just tested Wii screen on my TV |
|
So since I can't just correct all viewports, what changes do I need to do appart from aspect ratio caching? |
I've been quiet on the last few days because I've got several conflicting thoughts, and I'm not even sure what the original problem is (or maybe, there's more than one). I've wanted to test this myself, but I'm busy with some other stuff now, so I've to wait a few more days to get my hands on this. Meanwhile, if you have time, you might be able to answer this question: how does the TV detects aspect ratio? If the TV is set to auto-detect the aspect ratio, is it possible from the Wii to set the mode in such a way that the TV detects it with the aspect ratio we want (4:3 and 16:9 only, obviously)? As for the cursor being cut, well, that is because you are shrinking the image in order to compensate for the stretching operated by the TV set. I think that your change which sets the interpolation mode to linear should fix it, doesn't it? |
|
It's understandable to not have time The cursor being set to linear made it be less noticeable but not 100% like it should, the homebrew channel cursor behaves much less weirdly |
|
Any chance for a new review of this? |
that should be depended @mardy i think. they are basically the sdl->ogc expert here i think :p |
Oh, actually now I would have some time to test this, so thanks for the ping :-) By the way do you have some tests apps for this, or did you only try with VVVVVV? |
I used Neverball and had a Raylib Hello World sample working with it |
|
Should I make a test app? |
That would be helpful indeed! |
How would I allow the aspect ratio to be changed if that has to happen before init though? |
Just hardcode an aspect ratio, build the app, save it under a different name, change the aspect ratio in the code, build again :-) So we get two apps we can test. |
ah I see |
I would only care about 4:3 and 16:9, personally. |
Fair |
|
@mardy Sorry for the wait, I got the code to not crash anymore, had done some mistakes when rebasing (that I'm not sure how they didn't throw a compiler error) Pretty simple test, renders a Red Square at 0,0, Square maintains ratio but can be drawn in the right place when accounting the ratio I think the slight strech in 16:9 is probably from me forcing 720 VI Width if the ratio is not 4/3, I guess it's not really worth it to keep that if we don't account for it anywhere? Here's the Zip with the Dol's and Source |
Thanks @Fancy2209, that was useful! I modified it slightly, to actually draw a square, and not on the corner (where it could be cut), and also added a background color and a thin border (to understand whether the TV is cutting some rows / columns). Here's the modified main.c, in case you want to test it as well. Unfortunately my TV is really awful, and it cuts a few rows off the top and the bottom (both if I set it to 4:3 or 16:9), so it's really hard to test this stuff with it. One thing I can definitely confirm, is that your fix to for the cursor distortion is correct :-) But setting the VI width to the maximum causes several columns to be cut off the margins (on my TV, at least) and I don't even see the yellow border that I added, on the sides. It would be nice if you could take a couple of pictures from your TV, one where you set the TV to 16:9, one to 4:3 (and change the aspect ratio environment variable in main.c accordingly). My TV is unfortunately useless to test this :-( |
|
I'll hook up my Wii this weekend, I should definitely add some sort of Overscan adjustment though |
|
@mardy did you distort the Square? |
|
@mardy I think you are right 720 isn't right. I think the actual value should be max 704, would love to know what you think the solution could be. The idea with the example was that, for 4:3 you do #define RATIO_STRING "4:3"
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480and for 16:9 #define RATIO_STRING "16:9"
#define SCREEN_WIDTH 854
#define SCREEN_HEIGHT 480 |







Description
Adds a video mode for widescreen
Existing Issue(s)
Fixes #73