Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 4 – Windows DPI scaling

This thread is locked; no one can reply to it. rss feed Print
Allegro 4 – Windows DPI scaling
Andrew Gillett
Member #15,868
January 2015

I am planning to rerelease an old Allegro 4 game on Steam. The first time user starts the game, I enumerate the available video modes and get the desktop resolution, which I use as the default resolution. However, this doesn't work if Windows display scaling is in effect. In this case the desktop resolution will be reported as a resolution which isn't actually valid. My initial solution to this was to detect if the reported desktop resolution is valid, and if not, use the maximum available valid resolution as the default. However, I then end up only being able to see part of the game, with the right and bottom of the screen being cut off. This happens in all fullscreen resolutions (except those around 1024×768 and below) when scaling is enabled.

I realise this problem is not specific to Allegro 4 – presumably it's an issue with any 'true' fullscreen game (I've confirmed it's an issue with the Windows version of Quake). The problem is fixed by going to the compatibility tab for the EXE, choosing "change high DPI settings" and then selecting "override high DPI scaling behaviour". Is anyone aware of any programmatic workaround so that this is not necessary? My "plan B" is to detect an invalid desktop resolution and ask the user to find the EXE and apply the aforementioned compatibility option.

And is anyone aware of any other compatibility issues that might occur in releasing an Allegro 4 game in 2019?

ZoriaRPG
Member #16,714
July 2017
avatar

One major issue, is that support for DirectX is minimal in Windows 10--really, WIndows 8 and above, or more specifically, with newer graphics cards. While AG4 games still work, there are numerous possible bugs caused by graphics drivers not fully implementing the DX spec.

Most graphics cards, and drivers, are designed around OGL and newer libraries, so, old 2D libs such as DX7 and DX8 have the short end of it. While it isn't that technically challenging for companies such as Intel, and nVidia to incorporate full support, they have opted not to do that, until enough people bitch at them.

As for video mode, perhaps you should initialise it in a window, and allow the user to toggle a fullscreen setting?

If the user can manually enter a resolution, then you can always create a bitmap of that size, do a stretched blit to it, and then blit that to SCREEN.

What you may want to do, is to bundle your software with DXGL (https://www.dxgl.org/), and write a configuration utility for that as some kind of a hook. This may help with both of your issues, as it converts the DX7/8 calls to OGL calls, and supports proper fullscreen scaling.

Please keep me informed on your progress. I've considered eventually putting ZC (with a non-infringing content set) on Steam, but I'm not sure what the ramifications are of doing that. Moreover, I wasn't sure that Steam would be able to support Ag4 stuff, at all; and I'm curious how it turns out for you.

Andrew Gillett
Member #15,868
January 2015

Solution to the DPI scaling issue in MSVC:

Project properties -> Manifest Tool -> Input and Output -> DPI Awareness: Per Monitor High DPI Aware

ZoriaRPG
Member #16,714
July 2017
avatar

Project properties -> Manifest Tool -> Input and Output -> DPI Awareness: Per Monitor High DPI Aware

Where do you see this? I can't find it in either MSVC2008, or MSVC2017. Is it Pro-only and only in 2015+?

--Edit

Never mind: I found it in MSVC17.

Go to: