Jump to content
IGNORED

Virtual Jaguar HiDPI Scaling Issue


BitJag

Recommended Posts

I have ran into this problem a few times running VJ in Linux, specifically Kubuntu 18.04 and later over the last few years, where the image of the game being played doesn't fill the window size or fullscreen properly.  I have found a solution modifying the source for VJ, but I wanted to ask if there might be a simpler way of altering the code to achieve the same fix.  I also wanted to make this post with the solution I have been using in case anyone else out there might be running into the same problem, and there isn't a better way to do this currently.  Below is an image of what I am experiencing when opening VJ, and it holds true when playing a game windowed or in full screen.  I am using version 2.1.3(final) source from the git repository.

Screenshot_20210206_102834.thumb.png.102c69a5423ede9386746550f6712528.png

 

Here is a solution I am currently using to fix this. Before building Virtual Jaguar perform the following modifications to the source code:

 

/src/gui/mainwin.cpp - Add the following line in the function MainWin::SetFullScreen, below the line where int newWidth is initialized.  The line looks like this "int newWidth = (int)(aspectRatio * (double)r.height());".

 

newWidth *= 2.2;

 

Then alter the line just below, that looks like this "videoWidget->offset = (r.width() - newWidth) / 2;", multiplying r.width() by 2.2.  It should now look like the line below.

 

videoWidget->offset = ((r.width() * 2.2) - newWidth) / 2;

 

/src/gui/glwidget.cpp - Now we need to multiply width() and hieght() function calls by 2.2, do this by altering the following lines.

 

outputWidth = width(); --> changes to --> outputWidth = width() * 2.2;

 

unsigned outputHeight = height(); --> changes to --> unsigned outputHeight = height() * 2.2;

 

 

EDIT: I forgot to mention that the value 2.2 is a bit arbitrary according the the global scaling on your desktop.  I actually don't know how to find the exact value you need according to a specific global desktop scaling.  But raising and lowering the value should get what you are looking for.  For example, 2.2 is scales the image a bit beyond the window and fullscreen borders, so I dropped it down to 1.75, and if fits great now.

 

Link to comment
Share on other sites

21 hours ago, BitJag said:

EDIT: I forgot to mention that the value 2.2 is a bit arbitrary according the the global scaling on your desktop.  I actually don't know how to find the exact value you need according to a specific global desktop scaling.  But raising and lowering the value should get what you are looking for.  For example, 2.2 is scales the image a bit beyond the window and fullscreen borders, so I dropped it down to 1.75, and if fits great now.

 

Thank you for the information.

Just in case of, Qt has functions to handle the Scalability.

  • Like 1
Link to comment
Share on other sites

@dilinger It seems like adjusting the source for variable DPI scaling would be the good long term solution. I dug into the Qt environment variables in the past, and recently in case of Qt changes, to see if there might be some possibility that some global option could be adjusted to fix it.  There doesn't seem to be a quick fix when it comes to environment variables at the moment.  I used this documentation as a resource.  https://doc.qt.io/qt-5/highdpi.html .  With the exception of the hack suggested above, adding in the functions to handle scaling is beyond me at this point.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...