libretro / dosbox-libretro

Port of DOSBox (upstream) to the libretro API.
GNU General Public License v2.0
61 stars 40 forks source link

Some issues when it comes to screen scaling in the dosbox libretro core #60

Closed Gagert closed 5 years ago

Gagert commented 7 years ago

It seems like it's a bit harder to get the MS DOS games image to fill the entire screen (integer scaling-wise) in libretro dosbox than in other libretro cores. I think I may know the reason to that.

A very large amount of the MS DOS library of games run at a resolution of 320x200. However, since that is a "resolution for ants" these days, there is a standard scaler included in dosbox that's named normal2x. Normal2x is enabled by default in dosbox libretro (I found out by making dosbox libretro generate a *.conf file in System/Dosbox folder by typing config -wcd in the dosbox command window).

Normal2x is pixel doubling within dosbox. Thereby RetroArch thinks that the actual native resolution of many dos games in dosbox libretro are 640x400 instead of 320x200 because of that scaler, and the RetroArch scaler then scales the games by the multiple of 640x400.

Since I'm using a 1920x1080 monitor, the highest resolution I can use for maintaining square pixels is 1600x1000 in games that run in 320x200. That's five times bigger than 320x200, but if 640x400 is used as the base resolution in dosbox libretro for the same game, I can only expand the native resolution four times instead of five (thereby 1280x800, a tad to small for my taste).

I tried to edit the dosbox-libretro.conf file I generated and set the scaler to none instead of normal2x, and in RetroArch having Video/Aspect Ratio set to Core Provided and Integer Scale On. In theory I thought this would fix this, but the Core Provided scaler in dosbox libretro miscalculates the actual width of the image, making the resolution while scaling Keen1 (originally 320x200) to 1366x1000 instead of 1600x1000 when the image is scaled 5 times.

My solution to this has been to making the calculations myself in the retroarch.cfg, in this case if a game natively runs at 320x200 applying those values in the retroarch.cfg:

custom_viewport_width = "1600" custom_viewport_height = "1000" custom_viewport_x = "160" custom_viewport_y = "40" video_scale_integer = "false"

When using RetroArch, I have to set Video/Aspect to Custom for applying those values above. The custom viewport commands are for centering the image.

This is the only way I have got the screen scaling to work optimal in the libretro dosbox core as of today, but this sure is a hard workaround for getting them square pixels.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/43913548-some-issues-when-it-comes-to-screen-scaling-in-the-dosbox-libretro-core?utm_campaign=plugin&utm_content=tracker%2F2175333&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F2175333&utm_medium=issues&utm_source=github).
bidinou commented 6 years ago

Hi ! Thanks for figuring this out ! I noticed that applying pixel shaders to dosbox wouldn't give a satisfying result because indeed they are applied to the already 2 times upscaled picture. This raises yet another issue, as resolution changed are bound to occur. It seems although I'm not sure the duganchen fork of dosbox handles those : the shader is correctly applied to both hires and lores screens.

bidinou commented 6 years ago

Hmm, BTW, I couldn't find where RA reads the dosbox config file. I tried several combinations in ~/.config/retroarch/config config -wcd failed ; I had to use config -wcp instead ; which saved a file in my homedir (I had to choose its name).

Gagert commented 5 years ago

This seems to be fixed with newer DosBox SVN libretro builds