narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11
BSD Zero Clause License
885 stars 67 forks source link

Mouse cursor switching problem in Rich4 game (not a problem introduced in the new version) #338

Closed horxd33 closed 8 hours ago

horxd33 commented 3 days ago

Tested using DDrawCompat v0.5.3 & DDrawCompat v0.4.0 versions

When the player is stationary in the game, open the configuration menu (shift+f11) without making any settings and close it. The mouse cursor in the game can be moved and used normally.

But when the player is moving in the game, open the configuration menu (shift+f11) without making any settings and close it. The mouse cursor in the game can be moved, but cannot be used (the game is not frozen and there is still background music)

Turning on the statistics column (shift+f12) will not cause the above problem

Also not sure if this is a problem with DDrawCompat If it is not a problem with DDrawCompat, I will close this issue myself. Thank you for your support for old games.

Attached are relevant logs and videos https://mega.nz/folder/wHZQRIxK#j5rg_rbfiFKp82lrWD4u6Q

horxd33 commented 3 days ago

Second test, using another desktop computer for testing The first test was conducted using a laptop computer

When the player is stationary or moving in the game, and after opening the configuration menu (shift+f11) without making any settings and closing it, the mouse cursor in the game will not be unusable.

The second test also uses DDrawCompat v0.5.3 & DDrawCompat v0.4.0 versions for testing.

Logs and videos related to the second test have been updated

narzoul commented 1 day ago

When you open the config overlay, a low level mouse hook is installed in order to make sure mouse events are not processed by the game, and are processed be the overlay instead. When you close the overlay, the hook is uninstalled, so your game can start processing mouse events again. This is why you can't move your in-game cursor while the config overlay is open, and clicks will go to the overlay only and won't affect the game.

Since you can move your in-game cursor again after closing the overlay, this proves that the hook was uninstalled successfully. And since the issue only happens on your laptop, it's unlikely to be a bug in the game or DDrawCompat itself. The game also doesn't install any similar low level hooks, though it does install a normal keyboard hook (WH_KEYBOARD).

My best guess is that your laptop has some other 3rd party software running that's interfering here. Perhaps something that also installs mouse or keyboard hooks. From your logs, I can only see that at some point the game window stops receiving WM_MOUSEMOVE and similar mouse event messages, as if it somehow got deactivated or lost focus. But there is no log to indicate that anything like that happened.

Try closing all background processes until you find the one that might be responsible. Also, try changing the keyboard shortcut for the config overlay to something much simpler (preferably also without any modifier keys), in case the issue is caused by the F12 key being intercepted by some other app too or something.

Also, doesn't alt-tabbing out and back into the game restore the focus?

horxd33 commented 1 day ago

Thanks for pointing out the possible cause of the problem, I will test again

Testing while the player is moving After trying to set the configuration menu to single button f1, the mouse cursor can move and can be used normally. Then test that after setting the configuration menu to shift+f5, the mouse cursor can move but cannot be used. After testing in the game, if the player presses the shift key once while moving (both left and right shift keys have been tested), the mouse cursor can move but cannot be used. So it seems that the shift key (left and right shift keys) is indeed triggering (occurring) the problem in the game (I have not found any third-party interfering software yet) But it is true that this problem only occurs on my laptop, because I subsequently did the same test on two other laptops, and the results were that the mouse cursor can move and can be used normally.

Tested while the player is stationary Pressing the shift key alone once or several times will not cause the problem that the mouse cursor can move but cannot be used (only occurs when the player moves)

Rich4 does not support the function of pressing alt+tab to return to the game because Rich4 is an old game for Win95. The game was originally designed for full-screen play and does not support window mode. I have tried pressing alt+tab in the game and it will jump out of the game directly. Afterwards, use cnc-ddraw to press the alt+tab keys in the game and then return to the game to restore the mouse cursor function.

Also, I would like to ask if DDrawCompat supports simulating the keyboard configuration of Win95? (I remember that Microsoft changed the keyboard bottom layer after WinXP) Because the keyboard configuration of the Rich4 game cannot be used in Win10 and Win11

narzoul commented 18 hours ago

Rich4 does not support the function of pressing alt+tab to return to the game because Rich4 is an old game for Win95.

Have you tried if any of the AltTabFix settings help?

Also, I would like to ask if DDrawCompat supports simulating the keyboard configuration of Win95? (I remember that Microsoft changed the keyboard bottom layer after WinXP) Because the keyboard configuration of the Rich4 game cannot be used in Win10 and Win11

I don't really understand the problem or what changed after XP, but solving keyboard issues doesn't really belong in DDrawCompat (unless the issue is caused by DDrawCompat).

horxd33 commented 8 hours ago

@narzoul Try setting AltTabFix to keepvidmem(0) or keepvidmem(1) and noactivateapp(1) Pressing alt+tab in the game will jump out of the game. Press alt+tab again to bring up the switching window. After that, the switching window of Rich4 cannot be found, but Rich4.exe is still running in the resource manager.

If AltTabFix is ​​set to noactivateapp(0) When entering the game's initial menu screen, there will be a delay when moving the mouse cursor After entering the game menu screen, the game screen display will be out of sync (the display screen will freeze) After that, pressing alt+tab in the game will jump out of the game, but the background music will still play. After pressing alt+tab again to call out the switching window, the switching window of Rich4 cannot be found, but Rich4.exe can be seen in the resource manager. still running

In addition, without using DDrawCompat, I tested the problem of pressing the shift key once when the player moves in the game, resulting in the mouse cursor being able to move but unusable. As a result, the mouse cursor can be moved but cannot be used, so the test results show that it is not a problem with DDrawCompat. Combined with the test results I did on three other computers, it is more like what you said, the problem is caused by interference from third-party software. So I will close this question myself, thanks again for your help, thank you