SA-Mod-Manager icon indicating copy to clipboard operation
SA-Mod-Manager copied to clipboard

[Feature Request]: DPI fix for SA2

Open pkr-sadx opened this issue 6 months ago • 0 comments

Request Details

While testing the SA2 Mod Loader I noticed that the game isn't DPI aware. This means Windowed mode and possibly Borderless Fullscreen will set an incorrect resolution and the graphics will look blurry or the game might crash on Windows 8(.1), 10 or 11 when display scaling is above 100%.

There are three ways to fix this:

  1. Patch the game EXE with a manifest that specifies DPI awareness. I used to do this with SADX, but this requires modifying the EXE so it's not a great approach.
  2. Use the SetProcessDPIAware function to set DPI awareness. This is how it's currently implemented in the SADX Mod Loader. Unfortunately the same can't be done in the SA2 Mod Loader because the game window is already created when the loader initializes. It may be possible in the future if the Mod Loader's hook is changed to start earlier. This leaves us with the last option...
  3. Make the Mod Manager add a registry key to specify the game uses the "Application" scaling setting. This can be done using the following registry key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers A new string value should be named like the full path to the game EXE file, e.g. D:\SteamLibrary\steamapps\common\Sonic Adventure 2\sonic2app.exe. Its value should be set to ~ HIGHDPIAWARE. In addition, the same string value can be used to disable "Fullscreen optimizations". I don't know how this affects SA2 but it has had problems in older games. To disable "Fullscreen optimizations" and fix DPI scaling at the same time, the value should be set to ~ DISABLEDXMAXIMIZEDWINDOWEDMODE HIGHDPIAWARE.

Example registry file:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"D:\\SteamLibrary\\steamapps\\common\\Sonic Adventure 2\\sonic2app.exe"="~ DISABLEDXMAXIMIZEDWINDOWEDMODE HIGHDPIAWARE"

Here's a comparison with the same settings in the Mod Manager. The resolution is set to 1280x720.

Before: Window size is set to 1923x1121

Image

After: Window size is set to 1284x759

Image

Additional Information

No response

pkr-sadx avatar Jun 20 '25 18:06 pkr-sadx