FunkyFr3sh / cnc-ddraw

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

Yuri's Revenge Inaccessible Random Map Generator and other UI Glitches #220

Closed fitdev closed 1 year ago

fitdev commented 1 year ago

I am using the latest 5.1.0.0 version on Windows 11 22H2. Everything generally works except for the fact that Random Map Generator is not working. The button in the menu is displayed, however in reality it is the other button which simply returns you back to the previous screen, and the "real" Random Map button is nowhere to be found.

Screenshot_20230604_175641b

According to a thread I found, the issue may have to do with DPI settings However my system DPI is set to standard 100%, plus I tried various compatibility settings in the DPI regard to no avail.

Additionally, there are various UI glitches which persist no matter what ddraw settings I use:

Screenshot_20230604_175454

Here the sliders overlap the values.

Any help would be appreciated.

FunkyFr3sh commented 1 year ago

That looks like a issue related to DPI settings, the window is clearly upscaled, it's supposed to be 800x600 but it isn't. Does it work in fullscreen?

fitdev commented 1 year ago

Thank you for responding so quickly. I should have posted my ini settings:

width=1600
height=900
fullscreen=false
windowed=true
maintas=true
boxing=false
maxfps=60
vsync=false
adjmouse=true
shader=Shaders\cubic\catmull-rom-bilinear.glsl
posX=32
posY=31
renderer=auto
devmode=true
border=true
savesettings=1
resizable=true
d3d9linear=true
vhack=false
configlang=auto
tshack=true
noactivateapp=true
maxgameticks=0
hook=1
minfps=-1
nonexclusive=true
singlecpu=true
; Tried 0, 1, and 2 - no difference
resolutions=0
; Tried 0, 1, and 3 too - no difference
fixchilds=2
fpupreserve=false
; Undocumented settings
d3d9_adapter=0
opengl_core=false
d3d9on12=false
guard_lines=200
max_resolutions=0
limit_bltfast=false
game_handles_close=false
accuratetimers=false
fixpitch=false
fixwndprochook=false
novidmem=false
fixnotresponding=false
locktopleft=false
lock_surfaces=false
releasealt=false
gdilinear=false
allow_wmactivate=false
dinputhook=false
flipclear=false
fixmousehook=false
bpp=0
rgb555=false
hook_peekmessage=false

Yes, it also happens in full screen. However my system DPI settings are set to 100% (standard scaling).

fitdev commented 1 year ago

BTW, if I set fixchilds=0 (disable), then such UI dialogs are properly stretched, but then the mouse cursor calculations are wrong regardless of adjmouse settings (it behaves as if the UI was anchored to top-left). This is a separate issue of course (since the UI glitch and the missing button still remain with these settings too), but thought I would mention it since basically it seems to work now apart for the mouse while in #17 you mentioned you have not yet gotten around to scaling UI.

FunkyFr3sh commented 1 year ago

Did you maybe remove the preset for the game or do you maybe use a custom named game executable?

These settings here are required for the game to work properly in the menus:

noactivateapp=true tshack=true maxfps=60 minfps=-1 maintas=false boxing=false

fitdev commented 1 year ago

I did not remove the preset. I just compressed all the settings from the ini for ease of presentation here. I have actually tried all these combinations. Changing any of these does nothing for my issue and interestingly the game works fine whether either of the booleans are true or false, but the UI glitch remains.

FunkyFr3sh commented 1 year ago

I just tested the game again here with the latest cnc-ddraw build and everything is working fine for me, so it's not a new bug. Screenshots also look like the typical DPI issues, not sure what else could be causing such bugs other than high DPI settings. Did you maybe look around your graphics card drivers and check if there's maybe a setting related to scaling?

I don't really have a solution for this bug yet (there were a few others having similar bugs) - I didn't manage to reproduce anything like this yet

fitdev commented 1 year ago

Thank you for looking into this and your suggestions.

Yes, I am pretty sure it is somehow related to high DPI, but the problem is how? I mean I am on standard 100% DPI on all monitors, and all monitors have native 1080p resolution - pretty standard setup these days. Yet, apparently the game behaves as if I had 125% or 150% scaling or some such thing.

Incidentally another UI issue is that in-game tooltips (when you hover over buildings or units on the map) are not shown, despite the Tooltips option being set. Strangely the tooltips for the construction queue items are displayed. I am sure it must be related to this issue too.

Driver-wise - they are standard latest NVidia drivers. I suspect it may have something to do with Windows 11 (presumably most people are still on 10 and so the issue has not manifested itself for them). Unfortunately I cannot test it on Windows 10 to verify this hypothesis.

One last point is perhaps there could be some option regarding DPI settings too that can be added, so that it is possible to override system defaults or present "fake" DPI settings to the game or some such thing?

fitdev commented 1 year ago

I just tested the game again here with the latest cnc-ddraw build and everything is working fine for me

Latest being 5.1.0.0 or some internal build?

Could you please share your config just in case?

FunkyFr3sh commented 1 year ago

I just tested the game again here with the latest cnc-ddraw build and everything is working fine for me

Latest being 5.1.0.0 or some internal build?

Could you please share your config just in case?

Yeah,5.1.0.0 with default settings (Also tried windowed mode as well)

fitdev commented 1 year ago

Thank you for clarifying. I guess it is something to do with Windows 11 then.

FunkyFr3sh commented 1 year ago

I got a fresh installed win11 now and managed to reproduce it (but only with High DPI enabled though)

Does seem to work with this build: ddraw.zip

Make sure you dot have any compatibility modes related to high DPI settigns enabled

FunkyFr3sh commented 1 year ago

That works too: image

fitdev commented 1 year ago

Thank you so much for looking into this!

I have tested the new version but on my end there is absolutely no difference. All the issues are still there (improperly drawn sliders, missing buttons like Random Map Generator button, and missing tooltips). Btw I am using only windowed mode, not the full screen.

I have tried with both default-for-the-game ini settings that you provided as well as a few custom settings and all produce the same results.

I also tried setting Windows High DPI compatibility flag as you showed - again this made no difference at all.

The strange part is that I do have 100% (no high DPI) scaling on all my monitors! But could multiple monitors somehow break something? All mine are identical 1080p resolution and 100% scaling though.

Belonit commented 1 year ago

@fitdev I had similar problems when I set this option in windows regional settings. Check if you have it installed

fitdev commented 1 year ago

@Belonit Thank you for the tip. I do have this set as well. But why and how would it affect DPI/graphics-related stuff? And how did you fix it - just disabled the option?

FunkyFr3sh commented 1 year ago

nice one @Belonit , I got the same issue too once I enable it

FunkyFr3sh commented 1 year ago

How to fix Red Alert 2 and Yuri's Revenge UI glitches

https://github.com/FunkyFr3sh/cnc-ddraw/wiki/How-to-fix-Red-Alert-2-and-Yuri's-Revenge-UI-glitches