devinacker/bsnes-plus

macos: emulated screen is only 1/4 of the viewport window

Opened this issue · 6 comments

image

Built using my instructions i commented at the end of issue #214 against Qt 5.15.2 installed via HomeBrew qt@5.

Using MacBook 15-inch 2018 model with Mojave 10.14.6. Display is builtin retina screen.

The screenshot/issue above is with the Qt-OpenGL video driver. The Qt-Raster driver looks normal.

image

I'll see if I can repro/investigate this on my MacBook. Thanks for confirming that the Qt-Raster backend still works okay, at least.

Maybe I'm wrong, but I swear this used to work fine in the past - might just be down to something that changed in a Qt update w/r/t retina displays or something.

No problem. Also, I spoke too soon on the Qt-Raster driver. That one creates a weird ghost image after a while which is hard to explain. I can't resolve it until I quit and restart.

image

This is what I see for Qt-Raster. Lots of previous frames ghosting into the current one and it looks like it's over-exposed.

I recall encountering both of these problems on my end, though I use OpenGL, and actually don't play a lot of games through bsnes-plus yet (it's more of a substitute while I'm on standby for SNES9X to catch up on the Mac port). The quarter-screen case has a couple of known fixes, but they either involve a flag in an app bundle config file or some Cocoa-side programming. This emulator has no Cocoa-side files.

This patch resolves the issue for me:

diff --git a/bsnes/ruby/video/qtopengl.cpp b/bsnes/ruby/video/qtopengl.cpp
index c357c40..c484163 100644
--- a/bsnes/ruby/video/qtopengl.cpp
+++ b/bsnes/ruby/video/qtopengl.cpp
@@ -52,6 +52,8 @@ public:
     void paintGL() {
       unsigned outputWidth  = width();
       unsigned outputHeight = height();
+      outputWidth *= QApplication::desktop()->devicePixelRatio();
+      outputHeight *= QApplication::desktop()->devicePixelRatio();

       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();