dhewm / dhewm3

dhewm 3 main repository
https://dhewm3.org/
GNU General Public License v3.0
1.8k stars 346 forks source link

Open windows are moved when launching the game on dual-monitor setup #325

Closed darkcharmander closed 3 years ago

darkcharmander commented 3 years ago

OS: Windows 10 x64 dhewm3: 1.5.1RC2

I have a system with two monitors: Primary monitor: 2560x1440 Secondary monitor: 1920x1080 (Temporarily a different monitor than the primary one)

After I launch the game, almost all open windows are moved to the secondary monitor, and are left/right aligned. This is very annoying, because I need to rearrange everything after closing the game.

I suspect that it is some SDL limitation, because Smokin' Guns has the same problem. It could also be a Windows issue, or because I have two different monitors now. Maybe someone else can confirm this problem. I think that the menu may not be using the correct screen resolution also.

I wanted to report it anyways. I hope that there is a fix for this. Good port regardless!

darkcharmander commented 3 years ago

I just got my regular second monitor back, which is identical to the primary monitor: same bug.

DanielGibson commented 3 years ago

What resolution are you running dhewm3 in? Do you also have these kind of problems when running dhewm3 in windowed mode?

darkcharmander commented 3 years ago

What resolution are you running dhewm3 in?

2560x1440, at least that should be the resolution that I'm running in.

Do you also have these kind of problems when running dhewm3 in windowed mode?

No, but the game refuses to display a window in 1440p in windowed mode. I discovered that in both full screen and windowed mode, the game always reverts back to 1366x768. I checked it in the settings file, and it just changes back to 720p every time, after changing it back to 1440p via the menu.

Changing the configuration file by hand doesn't work either: the game flat out defaults back to 720p.

This would also explain why the graphics look pretty funky... running 720p on a 1440p monitor.

DanielGibson commented 3 years ago

A regular window with 2560x1440 wouldn't fit on your screen because of its title bar and also the taskbar. OTOH, still weird it doesn't work, I don't think SDL or Windows usually prevent you from doing that anyway..

What GPU and driver version are you using?

darkcharmander commented 3 years ago

GPU0: Nvidia 1650 Ti, driver version: 451.67 GPU1: AMD Renoir (Ryzen 4000 APU), driver: (Unsure what to put here for AMD)

I've tested the game on both GPUs (I did verify whether the game was really running on the selected GPU), and the same problem kept occurring.

DanielGibson commented 3 years ago

Thanks! :)

One more thing: Do other resolutions (that are smaller than the actual screen resolution) work for windowed mode, like 1920x1080 or 1980x1200? Or does only 720p work at all?

darkcharmander commented 3 years ago

One more thing: Do other resolutions (that are smaller than the actual screen resolution) work for windowed mode, like 1920x1080 or 1980x1200? Or does only 720p work at all?

I've tried this, and it still defaults back to 720p.

It could be a driver issue, or it's because M$ has messed something up with the October (20H2) update. Starting the game on my described system takes a long time, no idea why. It takes like 10+ seconds or so.

I tried to run the game on my other system with Windows 10 v2004, with an Nvidia 1070 Ti: The game started up instantly, and it did 'seem' like the window issue wasn't there. I did run the game through a remote session, so that could influence the experience. I did have both monitors active tough.

Do note that by 'window issue' I main the initial problems of windows moving around. It still has the problem of refusing to run in anything beyond 720p, which is an entirely different problem that has surfaced a little bit ago.

darkcharmander commented 3 years ago

I think that the 720p problem might actually be causing this. I believe that in the past, I've seen windows jump around when a game incorrectly sets the resolution, or to a very low resolution.

DanielGibson commented 3 years ago

Yeah, it seems plausible that Win10 moves your windows around if the screen resolution changes (so the window wouldn't fit on the current screen anymore). It's still stupid of course (who cares about the window size of windows not currently visible because an exclusive-fullscreen window is on top of them?), but quite possible.

My Windows PC just got updated to v2004, I won't update to 20H2 until MS forces me to (those big updates tend to be totally broken on release, makes sense to wait until most of the issues are found and hopefully fixed).

Can you configure a different resolution (like 1920x1080) and windowed mode in the options -> system menu, click "apply settings", quit the game, start the game (make sure it's really running at 720p or 1366x768 or whatever), exit it again and then post your Documents/My Games/dhewm3/stdout.txt here (just attach it to a post)? Hopefully that file contains some information on why setting the desired resolution failed.

BTW: Does the "game will only start in 720p" problem also happen if only one screen is connected?

darkcharmander commented 3 years ago

My Windows PC just got updated to v2004, I won't update to 20H2 until MS forces me to

I had problems with v2004, so I wanted to reinstall Windows, and I wanted the most recent update, even although they only add more bloatware.

BTW: Does the "game will only start in 720p" problem also happen if only one screen is connected?

I disconnected the monitor prior to running the test below. Same story.

Can you configure a different resolution (like 1920x1080) and windowed mode in the options -> system menu, click "apply settings", quit the game, start the game (make sure it's really running at 720p or 1366x768 or whatever), exit it again and then post your Documents/My Games/dhewm3/stdout.txt here (just attach it to a post)? Hopefully that file contains some information on why setting the desired resolution failed.

I've tried different resolution configurations, but it all defaults back to 720p. I've inspected the stdout file, and I don't see anything that looks out of the ordinary, unfortunately. Maybe you will spot something strange. stderr always remains empty. stdout.txt

I did pretty much already say it, but the game always edits the config file back to 720p! Even after changing it by hand, then launching the game. It almost looks like it completely ignores the whole file.

DanielGibson commented 3 years ago

Apparently an "autoexec.cfg" is executed - after dhewm.cfg (which should contain your resolution settings). That file is always loaded last, and it's not written by dhewm3 - it can be used to set things (or execute commands) when the game starts, regardless of settings from other configs. Next time dhewm.cfg is written, the settings changed by autoexec.cfg will be written with those new values, which would explain why your setting in the dhewm.cfg gets reverted. I assume it contains an entry like seta r_mode 9 which would override your setting.

Could you check where that file is (probably either the installation directory or Documents/My Games/dhewm3/base/) and maybe delete it (or at least reduce it to lines you're sure you want)?

darkcharmander commented 3 years ago

Apparently an "autoexec.cfg" is executed - after dhewm.cfg

I can't believe it, that's it! That stupid file literally messed up all graphics settings! It all works perfectly now! 👍 The 720p problem is thus gone, and so is the 'window moving' problem. I know that often games like Counter Strike and Urban Terror have an autoexec.cfg for servers to be configured properly, but not for regular gameplay. I did not edit this file, it was there from the start... strange.

The config's file resolution is really strange. I suspect that the r_mode variable somehow scales it up to 1440p, because the game is now definitely running in 1440p. Can you confirm that the r_mode variable does this? These are the related settings:

seta r_customHeight "486"
seta r_customWidth "720"
seta r_fullscreen "1"
seta r_mode "23"
DanielGibson commented 3 years ago

r_customWidth/Height are only used if r_mode is set to -1 (R_CUSTOM * in the system options menu). r_mode 23 indeed is 2560x1440 - you can see the list of available default modes by entering listModes in the console (which can be opened with Shift+Esc). No idea where your autoexec.cfg was coming from, but I'm glad the game now works as expected :)