Mouse capturing problem - cursor remains visible and is not confined to the game window #220
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay#220
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Kucharskov on GitHub · 2026-11-27 10:56 UTC · original
Description
I'm trying to use
VICTORY_GAMEPAD_MOUSEto control the game with a keyboard and mouse, without a physical controller.However, the mouse does not seem to be captured by the emulator window. The cursor remains visible and can freely move across the entire desktop, even while the game window is focused.
As a result, mouse movement is not properly captured and the game camera does not respond.
Environment
x86_64-pc-windows-msvc1.98.1diagseries-s-WindowedWhat I've tried
diagprofile.VICTORY_GAMEPAD_MOUSE=1.VICTORY_MOUSE_CAPTURE=1.VICTORY_MOUSE_WARP=0.Actual behavior
Expected behavior
When the game window is focused and
VICTORY_GAMEPAD_MOUSE=1andVICTORY_MOUSE_CAPTURE=1are enabled:Question
Could someone help identify why mouse capture is not being activated?
Is there an additional configuration option or prerequisite required for
VICTORY_MOUSE_CAPTUREto work, or could there be an issue in the window focus / mouse input handling implementation?Thanks!
@TaynanGT on GitHub · 2026-11-27 11:08 UTC · original
@Kucharskov This build reads
VICTORY_GAMEPAD_MOUSE=1for the foreground Raw Input mouse. It exposes a separate GameInput device and leaves the Windows pointer visible and free to move. Camera motion requires the title to consume that mouse device in its input mode. If movement still has no effect when the window is focused, check whether the log saysthe process already receives mouse Raw Input; keeping its registration. That would identify the existing-registration path. Mouse settings@Kucharskov on GitHub · 2026-11-27 11:25 UTC · original
Heres a log from my game boot: vice-tay-run.log
I found these:
So it looks like GameInput device is properely created but game do not cosume that. I also cannot find
the process already receives mouse Raw Inputwhich assume is good. Im not as advanced to solve by it myself but during playing with several emulators and I got few runs with working mouse but not with Vice Tay. Let me know if I can help you with any way or just should buy controller :)@TaynanGT on GitHub · 2026-11-27 11:45 UTC · original · edited 2026-11-27 11:54 UTC
@Kucharskov Device 6 is the foreground mouse exposed by our GameInput bridge. A mouse-only test is enough. Main now includes #241 at
3c66032, with two one-time messages: one when relative motion reaches the title window and one when the title callsGetMouseStatesuccessfully. In that diagnostics build, move the mouse for a few seconds with the in-game camera active and check which lines appear.@Kucharskov on GitHub · 2026-11-27 12:13 UTC · original · edited 2026-11-27 12:15 UTC
So theres a logfile: vice-tay-runmouse.log
Steps I took
VICTORY_GAMEPAD_MOUSE=1VICTORY_MOUSE_CAPTURE=1VICTORY_MOUSE_WARP=1Result
Mouse input is still not working.
received relative mouse movement in the title windowtitle read a GameInput mouse statemessage in the logsThe issue persists with all three mouse-related environment variables enabled.
@TaynanGT on GitHub · 2026-11-27 12:19 UTC · original · edited 2026-11-27 12:43 UTC
@Kucharskov The log has one relative-motion marker and zero successful
GetMouseStatemarkers. Raw Input reaches the foreground window. I added #256 at9aa8e0dto map that movement to the fallback gamepad’s right stick.Windows CI passed on this head. Test the diagnostics build with
-More @{VICTORY_MOUSE_LOOK='1'}, no physical controller connected, and the camera active. The isolated test covers the delta, clamping and focus reset. A game run will tell us whether this path turns the camera as expected.@Kucharskov on GitHub · 2026-11-27 12:51 UTC · original
So I recompile project from "feat/fallback-mouse-look-220" brach and ran a title with
-More @{VICTORY_MOUSE_LOOK='1'}.But still cursor isn't captured by the game. In fact, it lets me move the cursor outside the game area to a second monitor or outside the window in windowed mode.
Logs from run (if neccesary): vice-tay-runmouse2.log
@TaynanGT on GitHub · 2026-11-27 12:53 UTC · original · edited 2026-11-27 13:05 UTC
@Kucharskov I added cursor confinement to #256 at
c4978e4. Use-More @{VICTORY_MOUSE_LOOK='1'; VICTORY_MOUSE_CAPTURE='1'}after the Windows checks finish. The cursor stays in the focused title window and releases on Alt+Tab. I tested the bounds and release logic with a simulated window. The in-game check is whether both camera rotation and moving to another monitor work as expected when you switch focus.@Kucharskov on GitHub · 2026-11-27 13:04 UTC · original · edited 2026-11-27 13:05 UTC
I managed to get the camera to move in this build. I had to use a little trick to do it. I launched the game in windowed mode and minimized the window significantly.
When I held the window by the title bar and moved it down, the camera moved slightly after I released the mouse button—the moment the cursor, once released, entered the game window.
As you can see, the camera has shifted slightly downward.

This isn't a permanent solution to the problem - the game still doesn't respond to the mouse properly, and it registers movement a few milliseconds after you release the window's title bar, if the cursor is inside the game window. I think the problem is that the mouse isn't anchored to or linked with the window
@TaynanGT on GitHub · 2026-11-27 13:09 UTC · original
@Kucharskov The camera movement as the pointer re-enters the client area confirms the fallback stick can turn the view. The new
c4978e4build addsVICTORY_MOUSE_CAPTURE=1to the focused window. Once its CI finishes, a normal windowed launch with both options will let us check continuous movement and Alt+Tab release without dragging the title bar.@Kucharskov on GitHub · 2026-11-27 13:19 UTC · original
I rebuild
c4978e4and ran game with-More @{VICTORY_MOUSE_LOOK='1'; VICTORY_MOUSE_CAPTURE='1'} -Windowed. I can confirm that cursor is captured by window but moving mouse sill do not rotate the camera.Additionally when im trying to resize window from top its rapidly moving my cursor down. When im trying from bottom, then cursor is moving rapidly up. Move is caused in system with resized window (causing 0px height of drawable area), without rotation of camera.
At lest you can map LPM to Right trigger (shooting) and RPM to Left trigger (action)
@TaynanGT on GitHub · 2026-11-27 13:23 UTC · original · edited 2026-11-27 13:26 UTC
@Kucharskov The resize fix and button mapping are in #256 at
c85dab2. The clip releases during the Windows move/resize loop and returns when it ends. Left and right click are mapped to the right and left triggers on the fallback gamepad. The simulated clip test and input test passed. After CI, a diagnostics build also logsmouse motion reached the fallback gamepad right stickonce, which will tell us whether movement gets that far.@Kucharskov on GitHub · 2026-11-27 13:31 UTC · original
Ican confirm that resizing works and buttons are mapped as requested. Still moving a mouse with captured pointer do not rotate ingame camera
@TaynanGT on GitHub · 2026-11-27 13:37 UTC · original
@Kucharskov That confirms the resize and trigger paths. For the remaining camera issue, does the diagnostics log contain
mouse motion reached the fallback gamepad right stickonc85dab2? That tells us whether to look at Raw Input delivery or at the title’s gamepad read. The clip and button results give us two working controls.@Kucharskov on GitHub · 2026-11-27 13:44 UTC · original
I ran game with
-Console series-s -More @{VICTORY_MOUSE_LOOK='1'; VICTORY_MOUSE_CAPTURE='1'} -WindowedI checked logs and i got these two:
Isnt it strange that it occurs one after another? Anyway fix it asap pls
@TaynanGT on GitHub · 2026-11-27 13:48 UTC · original
@Kucharskov The two lines are 4.4 ms apart, which fits the 8 ms input poll. Together they show the window received motion and the fallback pad published a right-stick value. That narrows the remaining camera issue to how the title reads that pad state. I’m adding a read-side marker so we can see whether it consumes the nonzero value.