-
-
Notifications
You must be signed in to change notification settings - Fork 17
[OGC] Add support for Custom Aspect Ratios #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ogc-sdl-2.28
Are you sure you want to change the base?
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 <[email protected]>
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 ) |
|
By the way, something that is really bothering me is that when I set the window to widescreen the mouse starts having pixels jitter, like depending where it is some pixels get cut off in one of the sides |
SDL is trying to be as portable as possible, so it redefines these functions to allow platforms to reimplement them, if needed. But for us it just introduces a slow-down, since while the stdlib functions can be optimized away from the compiler, the SDL equivalent can not (that's my guess, at least, since it does not know them). I would suggest avoiding them, unless you are writing code in the SDL common modules and you plan to submit it upstream. |
src/video/ogc/SDL_ogcvideo.c
Outdated
| { | ||
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
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 |





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