Jump to content
LaunchBox Community Forums
twobucks

marquee monitor problem in bigbox

Recommended Posts

On 9/20/2020 at 4:19 AM, Mr. RetroLust said:

What if you turn off (uncheck boxes) all windows dpi override settings and only make sure both screens are set to the same dpi percentage < This worked for me in the past to be able to have 4K running plus marquee monitor.

So your answer has the key. What I discovered is Windows 10 sets hard limits on the DPI scaling for low resolution marquee monitors and will ignore the custom DPIs even when you set it. I noticed this when I thought about it more closely. My monitor is the 14.9” LTA149B780F and it supports a native resolution of 1280x390. DPI scaling is grayed out in the settings app with 100% preselected. This is likely a safeguard in Windows 10 so users still access the UI on the secondary display, or else setting a 200% scaling would render the start menu useless on that display. How do I know this? When I attempt to change to a custom scaling setting in the Settings app (it is supposed to apply to both monitors), the size or scale of screen elements do not change on the marquee display. That means Windows is only applying DPI settings to displays it deems large enough to still display its UI. The workaround to this whole mess is ugly: it means setting the DPI for both monitors to 100%. That may not be much of a big deal on a 1080p screen, but it means on my 4K 15.6” tabletop cabinet’s screen, everything becomes an eye exam and next to impossibly hard to read. However, BigBox with its 10-foot interface ignores the DPI settings and works just fine with nice large font. I really wish there was a way to set the DPI settings to switch to 100% scaling but only when I am running BigBox.

  • Like 1

Share this post


Link to post
Share on other sites

I this PowerShell script (link: https://www.reddit.com/r/PowerShell/comments/9ukhye/runezoom_a_simple_script_to_automatically_scale/) and adapted it below. I gave it a whirl but still no dice. :(

 

# VARIABLES

# You can find the registry setting we are targeting in regedit under HKCU\Control Panel\Desktop\PerMonitorSettings
#  
# - This is not in the registry until you have run it at least once already.
# - It defines which monitor are you targeting if there is more than one.
# - In versions of Windows prior to Windows 10, it appears that the DPI value is stored in HKCU:\Control Panel\Desktop with the value LogPixels.
# - Versions of Windows prior to Windows 10 also require a restart.
# - There is useful information here: https://www.reddit.com/r/Batch/comments/4665jq/how_to_change_windows_10_display_scaling_via/d03gt72/
#
# To find the MonitorID for your marquee display, go to Device Manager and under Monitors, right click the Monitor You Want to Change the DPI on.
# Select "Properties" under the dropdown menu. Go the Details tab and under properties, select "Hardware Ids". Note the 7 digit alphanumeric code (e.g.
# ROW00000). You will need this later on.
# Now run regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\ScaleFactors. Under this section, find the key/folder
# that begins with the same 7-digit alphanumeric code you noted earlier. Copy that entire MonitorID and replace it with the one below.
$MonitorID = "ROW00000_19_07E0_E1^9AEC406B952C6F1BB1AD2DC261E55418"  

# Restart the video driver
function Restart-VideoDriver
{
    param
    (
        [Parameter(Mandatory)][string]$GPUID
    )

    # Enables then disables GPU driver.
    Get-PnpDevice -FriendlyName $GPUID | Disable-PnpDevice -Confirm:$False
    Get-PnpDevice -FriendlyName $GPUID | Enable-PnpDevice -Confirm:$False
}

# Set the DPI scaling
function Set-DPIScaling
{
    param
    (
        [Parameter(Mandatory)][string]$MonitorID,
        [Parameter(Mandatory)][int]$ScalingLevel
    )

    <#
        Scaling levels:

        These change dependent on the screen. My Surface Pro 7's built-in screen has its default or recommended scaling level as 200%.
        0 is the default or recommended setting. Whole number increments correspond with 25% increases in scaling level. In the case of my Surface,
		this would be some of the scaling levels:
		0 = 200%
		1 = 225%
		2 = 250%
		3 = 275%
		4 = 300%

        This article has interesting information on DPI: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/dn528846(v=win.10)#Anchor_3
		
		For a standard monitor with a default scaling factor of 100%, this would be some of the scaling levels:
		
        0 = 100%
        1 = 125%
        2 = 150%
        3 = 175%
		4 = 200%

    #>

    Set-ItemProperty -Path "HKCU:Control Panel\Desktop\PerMonitorSettings\$MonitorID" -Name "DpiValue" -Value $ScalingLevel
}

function Get-VideoCard {
    
    $videoDevices = Get-PnpDevice -Class Display

    if ($videoDevices.Count -gt 1) {

        # From my testing, additional GPU's show up first in the object
        return $videoDevices[0].Name

    } else { return $videoDevices.Name }

}

function Main
{
    $GPUID = Get-VideoCard

    # Set scaling to 200%.
    Set-DPIScaling -MonitorID $MonitorID -ScalingLevel 4

    # Restart device driver.
    Restart-VideoDriver -GPUID $GPUID

}

Main

This PowerShell script should work in theory but it does not because of some hard limitation in Windows 10 that prevents increasing the DPI scaling on low resolution monitors (e.g. 1280x390 resolution as in my case).  I changed the MonitorID to match my monitor's, which I found under HardwareIds in the device properties in Device Manager as I describe in the code comments. It still refuses to work. Maybe @Jason Carr might have some ideas.

Edited by Hifihedgehog

Share this post


Link to post
Share on other sites

OK. This updated version of the script does the trick! Save it as a .ps1 file (call it BigBox.ps1). It switches the DPI scaling on the primary display to 100%, matching the marquee's 100% setting that Windows 10 vigorously enforces. This does everything you should need to get a marquee to work and will automatically activate and deactivate, enabling the DPI right before launching BigBox and disabling itself after closing BigBox. You will need to modify a few things in line in the script, but it is pretty self explanatory.

# VARIABLES

# You can find the registry setting we are targetting in regedit under HKCU\Control Panel\Desktop\PerMonitorSettings
#  
# - This is not in the registry until you have run it at least once already.
# - It defines which monitor are you targeting if there is more than one.
# - In versions of Windows prior to Windows 10, it appears that the DPI value is stored in HKCU:\Control Panel\Desktop with the value LogPixels.
# - Versions of Windows prior to Windows 10 also require a restart.
# - There is useful information here: https://www.reddit.com/r/Batch/comments/4665jq/how_to_change_windows_10_display_scaling_via/d03gt72/
#
# To find the MonitorID for your primary display, go to Device Manager and under Monitors, right click the Monitor You Want to Change the DPI on.
# Select "Properties" under the dropdown menu. Go the Details tab and under properties, select "Hardware Ids". Note the 7 digit alphanumeric code (e.g.
# ROW00000). You will need this later on.
# Now run regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\ScaleFactors. Under this section, find the key/folder
# that begins with the same 7-digit alphanumeric code you noted earlier. Copy that entire MonitorID and replace it with the one below.
$MonitorID = "LGD0555268435617_00_07E3_3C^09AE1E606A1EC8EDE92BB1BEA71708CE" 

# Location on your computer of BigBox.exe
$EXEPath = "C:\Users\sonic\LaunchBox\Core\BigBox.exe"

# Restart the video driver
function Restart-VideoDriver
{
    param
    (
        [Parameter(Mandatory)][string]$GPUID
    )

    # Enables then disables GPU driver.
    Get-PnpDevice -FriendlyName $GPUID | Disable-PnpDevice -Confirm:$False
    Get-PnpDevice -FriendlyName $GPUID | Enable-PnpDevice -Confirm:$False
}

# Set the DPI scaling
function Set-DPIScaling
{
    param
    (
        [Parameter(Mandatory)][string]$MonitorID,
        [Parameter(Mandatory)][int]$ScalingLevel
    )

    <#
        Scaling levels:

        These change dependent on the screen. My Surface Pro 7's built-in screen has its default or recommended scaling level as 200%.
        0 is the default or recommended setting. Whole number increments correspond with 25% increases in scaling level. In the case of my Surface,
		this would be some of the scaling levels:
		-4 = 100%
		-3 = 125%
		-2 = 150%
		-1 = 175%
		0 = 200%
		1 = 225%
		2 = 250%
		3 = 275%
		4 = 300%

        This article has interesting information on DPI: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/dn528846(v=win.10)#Anchor_3
		
		For a standard monitor with a default scaling factor of 100%, this would be some of the scaling levels:
		
        0 = 100%
        1 = 125%
        2 = 150%
        3 = 175%
		4 = 200%

    #>

    Set-ItemProperty -Path "HKCU:Control Panel\Desktop\PerMonitorSettings\$MonitorID" -Name "DpiValue" -Value $ScalingLevel
}

function Get-VideoCard {
    
    $videoDevices = Get-PnpDevice -Class Display

    if ($videoDevices.Count -gt 1) {

        # From my testing, additional GPU's show up first in the object
        return $videoDevices[0].Name

    } else { return $videoDevices.Name }

}

function Main
{
    $GPUID = Get-VideoCard

    # Set scaling to 100%.
    Set-DPIScaling -MonitorID $MonitorID -ScalingLevel -4

    # Restart device driver.
    Restart-VideoDriver -GPUID $GPUID
	
	# Launch game.
    # Added wait instead of while loop - untested but should work?
    Start-Process -FilePath $EXEPath -ArgumentList "oldschool" -Wait
    Start-Sleep 1

  
    # Wait for game to exit.
    while(Get-Process -Name "BigBox" -ErrorAction SilentlyContinue)
    {
        Start-Sleep 1
    }
  

    # Set scaling to 100%.
    Set-DPIScaling -MonitorID $MonitorID -ScalingLevel 0

    # Restart device driver.
    Restart-VideoDriver -GPUID $GPUID

}

Main

To run this script, you will need to do two things:

1. Open Windows Powershell (admin) and then run the following:

 Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

...and close PowerShell.

 

2. Create a shortcut by right clicking on the .ps1 file you created (i.e. BigBox.ps1). Right click on that shortcut you now created and select Properties. Go to the Shortcut tab and in the target add the following before file path (be sure to have a trailing space after the "-f"):

powershell.exe -f 

image.thumb.png.b7c5bbd67f7463bfe7380663283f496b.pngNow, go to "Advanced..." and check "Run as administrator." Hit OK there and in the shortcut window because you are all set and ready to go. Incidentally, as a security precaution against malicious PowerShell scripts, Windows will not allow you to check the "Run as administrator" option (it is grayed out for all .ps1 files) unless you previously added the "powershell.exe -f " in the target box.

Try running your script. It should now work!

---

@Jason Carr, if you could somehow decouple the marquee window from the main window in a future release, this would make life so much easier on everyone. Based on what other devs are telling me, because BigBox's application windows (main and marquee) are tied to a single executable, Windows applies DPI to both unilaterally. If the marquee and the primary display have different DPI settings, the marquee window gets stuck on the primary display. Some marquee monitors have especially low resolutions (e.g. 1280x390 is commonplace) so changing the scaling on the marquee (ideal) isn't possible because Windows forcibly hard sets them to 100%. This forces you to change the primary display's scaling to 100%. This is absolutely undesirable especially with high resolution 4K displays becoming the norm because that means dealing with reading teeny tiny text on your display. That said, this PowerScript script above overcomes this issue in the interim by allowing users to only switch the DPI for their primary display when running BigBox via this script, thereby avoiding to have to strain their eyes to read a miniaturized UI. For Kodi users who use the Launchbox plugin to launch BigBox, this script workaround is a non-option, of course, making this issue all the more important to be attended to.

Edited by Hifihedgehog

Share this post


Link to post
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.

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.


×
×
  • Create New...