VOGONS


First post, by Joshhhuaaa

User metadata
Rank Newbie
Rank
Newbie

Some people who use dgVoodoo2 would sometimes run into a mouse problem where if they move their mouse and click, it would tab them out of the game. I think this issue might only apply to Unreal Engine 2, it happens on the original Splinter Cell, Splinter Cell: Chaos Theory Versus, and UT 2004. I tried some other games outside of Unreal Engine 2, and couldn't seem to find a game with the issue yet.

To reproduce this mouse problem, the game starts at a resolution lower than the one you decide to play the game on. For example, you open a game and it plays a cinematic video in 640x480, but then once you reach the main menu / in-game, you will be playing at full native resolution. Another example, some games store their resolution to a profile save, so the game starts on a lower resolution until you select your profile.

After a resolution switch has been done, and your starting resolution was lower (like the examples above), if you Alt+Tab out of the game once and return, dgVoodoo2 incorrectly perceives the game window as the initial lower resolution. As a result, clicking outside the initial screen resolution will cause you to be tabbed out of the game.

To help visualize it better, this game was started on 640x480, and I selected my profile which switched my resolution to 1920x1440. I also have performed at least 1 Alt+Tab to start the bug. If I click while my mouse cursor is not in the red box, the game will tab out to desktop. You can usually start to see the Windows cursor appear over your game when you start to leave the red box.

This is not an issue natively in Unreal Engine 2, you will not get this mouse issue if dgVoodoo2 is not present. And, certain wrappers don't have the issue at all either.

KOQfHDC.png

Reply 1 of 4, by Joshhhuaaa

User metadata
Rank Newbie
Rank
Newbie

Just some additional notes about this issue:

It doesn't seem to be an issue for Unreal Engine 1 games as far as I can tell, so it is probably exclusively Unreal Engine 2 games affected. I tested Unreal Gold with no issues when doing the same method: start game with lower resolution, switch to higher resolution and doing atleast 1 Alt+Tab while playing. No issues at all on latest.


Older versions of dgVoodoo2, such as v2.54, share the same behavior on Unreal Engine 2 games with some differences:

If your scaling mode is set to Unspecified, Centered, or Stretched on v2.54, when switching from a lower resolution to a higher resolution, the game will shrink into a 640x480 window and display your desktop (though the game is still rendering at the higher resolution). This is unlike the latest version of dgVoodoo2, where it remains in fullscreen. Despite the latest version of dgVoodoo2 fixing it visually so the game isn't shrunk, the mouse behaves identically to v2.54 as if it is restricted to that 640x480 window, and clicking outside of it will tab you out of the game.

Also, if your scaling mode is set to stretched_ar or stretched_4_3, the issue appears to be fixed only on v2.54. You can swap resolutions and use Alt+Tab all you want. However, this workaround is exclusive to v2.54, using stretched_ar on the latest version of dgVoodoo still has the bug.

Reply 2 of 4, by Dege

User metadata
Rank l33t
Rank
l33t

Does this cursor problem come when scaling mode is not done by the wrapper (unspecified, centered, stretched) and the resolution is unforced?

Because in any other case the physical size of the game window is different to what is expected and that brings in a lot of problems (which is apparently cannot be a problem natively, and probably also with "other certain wrappers").
A lot of games resize the window to the expected size, which either results in a shrinked window in the corner if the DX presentation model is FLIP_DISCARD (d3d12) or the presentation remains full screen but the window beneath is shrinked if the presentation model is DISCARD (d3d11).

But anyway, dgVoodoo does not detect clicking out of the window, it's detected by Windows itself. Unreal Engine makes the mouse be stuck in the center of the screen, so if the window is shrinked, you'll just click outside of it with the first click.

What is the simplest way to reproduce it? Which game, what dgv config options?

Reply 3 of 4, by Joshhhuaaa

User metadata
Rank Newbie
Rank
Newbie
Dege wrote on 2024-03-19, 12:54:

Does this cursor problem come when scaling mode is not done by the wrapper (unspecified, centered, stretched) and the resolution is unforced?

Yeah, If I use unspecified, center, or stretched scaling and unforced resolution, I get the cursor bug.
Scaling methods that rely on the wrapper such as centered_ar and stretched_ar do not have the issue.

Dege wrote on 2024-03-19, 12:54:

What is the simplest way to reproduce it? Which game, what dgv config options?

I can reproduce it on Splinter Cell 1, Splinter Cell: Chaos Theory Versus Mode and Unreal Tournament 2004, I have a feeling it will happen on most Unreal Engine 2 games.

Config options:
ScalingMode = unspecified
VideoCard = geforce_ti_4800 (The bug also happens on other video cards.)
FastVideoMemoryAccess = true (Setting this to false will still have the bug. This is only enabled for performance improvement if I ever need to use UnrealEd).

To reproduce:
1. Start the game at a low resolution like 640x480.
2. Change your resolution in-game to something higher than the resolution in step 1.
3. Alt+Tab out of the game once, then tab back into focus. Alt+Tabs prior to switching the resolution higher do not count. You have to do atleast 1 tab out once after step 2.
4. Move your mouse down and into the right, and you will eventually see the Windows cursor appear on screen. When it appears, clicking will tab you out of the game.

This sounds like a very specific bug to trigger, but it is something that can happen pretty commonly. Consider that Splinter Cell 1 plays an intro video cutscene when opening the game that is hardcoded to run at 640x480. Then after that cutscene, you begin playing the game at something higher like 1600x1200. While playing the game, you decide to alt+tab out and back into the game once, and you'll have the bug as explained above.

The "other wrapper" that does not have this cursor issue is ancient 3D Analyze from like 2002-2003. Many people previously used to use 3D Analyze because it could fix the dynamic lighting in Splinter Cell: Chaos Theory Versus. Regardless, 3D Analyze does not have this cursor problem.

Reply 4 of 4, by Dege

User metadata
Rank l33t
Rank
l33t

Thanks, I was able to reproduce it. The thing is, when the focus is gained back then the game always creates a new D3D8 device, involving setting the phyiscal resolution. The difference with dgVoodoo compared to native and other wrappers is that DXGI (doing the resolution switch) always resizes the window to the phyiscal resolution. However, and this is the point, the game window proc is notified and it sets the window size back to the previous resolution in response. For some reason... (the windowproc probably isn't prepared to get called inside a device creation).

Natively there is no automatic window resizing, so the window proc is not notified either. In fact this is the very same problem when the game runs in a small window in the top-left corner.
Recently I experimented with some solutions to mitigate this but did not work out very well. I'll only try to come up with a solution in a subsequent WIP, I don't want to fix it in a patch version, it should be extensively tested.