FunkyFr3sh / cnc-ddraw

GDI, OpenGL and Direct3D 9 re-implementation of the DirectDraw API for classic 2D games for better compatibility with Windows 2000, XP, Vista, 7, 8, 10, 11, Wine (Linux/macOS/Android) and Virtual Machines
https://discord.gg/afWXJNDDF5
MIT License
2.12k stars 143 forks source link

Submarine Titans custom resolution issue #329

Closed eierfrucht closed 1 day ago

eierfrucht commented 4 days ago

The unofficial patch for Submarine Titans explicitly allows for custom ddraw wrappers:

https://github.com/UnknownException/SubTitans

; Override the detected screen width (0: Ignore).
Width=1366
; Override the detected screen height (0: Ignore).
Height=768
; Provides widescreen support with propper scaling of the GUI.
; This patch overrides the in-game resolution of 1280x1024.
NativeResolution=true
; Provides an alternative for the obsolete DirectDraw renderer (0: Automatic, 1: DirectDraw, 2: OpenGL, 3: Software).
; Set the value to 1 when using a custom DirectDraw wrapper.
Renderer=1

However, with cnc-ddraw custom resolution (with scaling, shaders and all) is correctly applied only in the main game menu. After starting a campaign / skirmish battle, the viewport resets to the display's native resolution, e.g. 1920x1080, and everything becomes tiny. Exiting to the main menu has the game rendering stuff as expected per the current cnc-ddraw settings once again.

Engaging the built-in software and OpenGL renderers gives me correct scaling in missions but the performance is really sad and the picture is scaled using just Nearest Neighbor.

Setting NativeResolution to 'false' in subtitans.ini removes all and any widescreen support (which is expected behavior).

Possible solution: add an option to spoof the display's native resolution the hard way.

FunkyFr3sh commented 3 days ago

Don't have that game installed, but had a quick look into the source code of the patch and found this here:

https://github.com/UnknownException/SubTitans/blob/master/subtitans/ddrawreplacementpatch.cpp#L53

It does override the window size here, not sure why it's doing that.

Here's a test build with that window message hidden for the game: cnc-ddraw_Submarine-Titans.zip

eierfrucht commented 2 days ago

No dice, once you are in a mission the scaling resets to the display's native resolution. I've tried this on 768p, 900p and 1080p displays and get 1366x768, 1600x900 and 1920x1080 accordingly. The rest of cnc-ddraw features seem to work, and anything outside of a mission is scaling properly.

Should I open a bug over there with maybe a link to this issue here? It looks more like something that should be addressed by the patch itself, not cnc-ddraw.

not sure why it's doing that.

A long forgotten workaround for some other wrapper? Given how well the game performs with cnc-ddraw (save for this bummer!), the fanpatch should probably be targeting cnc-ddraw as the preferred third party wrapper.

Their github says:

Support for any resolution in-game (tested up to 3840x2160)

Should be unplayable on a 4K laptop display with 1:1 pixel scaling in a mission.

FunkyFr3sh commented 2 days ago

Yeah, you may have to report it there. But I think I found the issue

https://github.com/UnknownException/SubTitans/blob/3a1c2e4721b46e6c274c7b0200d1c1538f67a803/subtitans/gogpatcher.cpp#L36

If renderer is set to DirectDraw or Automatic in their settings file it will NOT read the width/height settings