Letterboxing for 2D cabs Proposal and patch
#1
Posted 15 April 2020 - 10:04 AM
One of the biggest headaches regarding legacy MSTS content is that the 2D cabs are designed with a 4:3 aspect ratio, whereas contemporary systems invariably have widescreen monitors. Open Rails handles the aspect ratio mismatch by allowing you to scroll the cab viewport up and down with the arrow keys. But this doesn't work very well whenever the cab has a small window to begin with, or when the display uses an ultra-wide (21:9) aspect ratio. In either case, you're forced to choose between keeping the controls visible or maintaining a forward view out of the window.
So, what if you wish to keep the entirety of the cab visible? Currently, this isn't possible because Open Rails always uses the current resolution of the desktop; it is not possible to select a custom resolution with, say, a 4:3 aspect ratio to match the cab. There are workarounds, like using windowed mode or changing your desktop resolution before you start the game, but these are quite inconvenient, which I think is why users have been asking for the ability to set a custom resolution in fullscreen mode.
I propose another solution: letterboxing the 2D cabs. And I have written some code to make it work.
My 1920x1080 monitor, with the feature turned off:
And turned on:
With my patch, the simulator removes the letterboxing when you switch to a 3D view, whether it be an external view or a 3D cab.
I have submitted a pull request to GitHub. However, it was brought to my attention that significant new features require discussion, approval from the developers, and a Trello card. So, with some apologies, I thought I'd get that discussion rolling. ^_^
#2
Posted 15 April 2020 - 11:58 PM
first of all, thank you for your work on this!
Some points:
1) I'd suggest that the selection between letterboxing and usual view, instead of being made through a menu option, be done with a runtime toggle command. Ctrl-1 could be a possible candidate key for that.
2) Thinking a bit more about your PR, the two features you propose, that is letterboxing and improved windows shading, seem to be quite unrelated. So maybe having two separate PRs would be a cleaner solution. And I'd be happy to get separate .diff files for them.
3) Is your PR Monogame ready?
P.S.: I can reply to my first point: yes, it's Monogame ready, see picture
However I have a question: as can be seen, the Track Monitor window is constrained within the letterboxed window, consuming precious space while there is black space at the right and at the left. Would it be possible (probably much has to be changed) to improve the code, so that the Track Monitor Window can be moved into the side black stripes?
#3
Posted 16 April 2020 - 10:34 AM
Csantucci, on 15 April 2020 - 11:58 PM, said:
I like this idea and will try implementing it!
Csantucci, on 15 April 2020 - 11:58 PM, said:
Actually, they are not independent. The window shading patch is required by the letterboxing patch because of the use of ResolveBackBuffer in the current code. To be honest, I was not sure about the best way to communicate this, hence I put them in the same PR.
Csantucci, on 15 April 2020 - 11:58 PM, said:
Define "Monogame ready." From your testing, I gather it applies cleanly against the unstable branch. It should take me a day or two to rebase against your NewYear-MG-NoWD branch.
Csantucci, on 15 April 2020 - 11:58 PM, said:
It would be nontrivial, yes; the way the letterboxing code works is that it imposes a viewport on the entire simulator, including the windows. It might be possible to set a different viewport for the window drawing so that windows can occupy the black bars. This might even remove the "dependency" on the window shading rework.
#4
Posted 16 April 2020 - 11:14 AM
good that you will provide a solution where the selection of the letterbox display is made through a key! I'll wait for this before releasing next OR NewYear MG revision.
You don't need to rebase what you have done for OR NewYear MG. The picture I have published is already taken starting from the OR NewYear MG code, after having applied your patch and adjusted some merge issues.
#5
Posted 17 April 2020 - 08:46 AM
#6
Posted 17 April 2020 - 08:39 PM
#7
Posted 18 April 2020 - 12:32 AM
Csantucci, I have submitted a pull request against your branch for this change.
#8
Posted 18 April 2020 - 01:49 AM
I have merged your PR, so that this will appear in nex OR NEwYear MG revision.
#9
Posted 20 April 2020 - 12:20 PM
#10
Posted 21 April 2020 - 07:40 PM
Windows can now be positioned over the letterboxed areas:
And the dependency on the window drawing revamp has been dropped, so the new patch is drastically simpler. (Csantucci, you have another pull request.)