melonDS-emu / melonDS

DS emulator, sorta
https://melonds.kuribo64.net
GNU General Public License v3.0
3.23k stars 538 forks source link

Screen size is wrong for multiples above 1x with a screen gap #704

Open rzumer opened 4 years ago

rzumer commented 4 years ago

There are black bars to the left and right of the screen when picking 2x resolution on my end.

This seems to be an "inverse" of #553. Rather than the gap not scaling, the gap now scales and there is not enough vertical space for the screens to fill the frame.

Arisotura commented 4 years ago

I believe this is the same sort of issue as #697

tuzepoito commented 2 years ago

I have encountered the same issue on Windows 8. I don't think the problem is related to HiDPI. Rather, it seems the option "Config > Screen size" does take the screen gap (in "Config > Screen gap") into account, but incorrectly.

For instance, when the Screen gap is 0, and I set the screen size as 2x, I get a window size of 512x768, which is the expected result.

no-gap

However, when I set "Screen gap" as 8, and then "Screen size" as 2x, here is what I get:

gap8-incorrect

There are black borders on the left and the right of the screens.

More precisely, the window height is set to 776 (768 + 8) pixels. It seems "Screen size" option assumes that the screen gap is 8 pixels, but actually it is larger, because the screen gap is scaled as the viewport scales. Therefore, the actual viewport size is smaller than expected, resulting in borders on the left and the right of the window. The effect is more present as the screen gap size is larger.

To me, there are two solutions:

gap8

gap16

Personally, I get this result by setting Screen size "2x", and then manually setting the window height.