Mouse capturing problem - cursor remains visible and is not confined to the game window #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?
Imported from TaynanGT/Vice-Tay. Originally posted by Kucharskov on 2026-11-27T10:56:42Z.
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!
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T11:08:24Z.
@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 settingsImported from TaynanGT/Vice-Tay. Originally posted by Kucharskov on 2026-11-27T11:25:27Z.
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 :)Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T11:45:51Z.
@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.Imported from TaynanGT/Vice-Tay. Originally posted by Kucharskov on 2026-11-27T12:13:31Z.
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.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T12:19:38Z.
@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.Imported from TaynanGT/Vice-Tay. Originally posted by Kucharskov on 2026-11-27T12:51:09Z.
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
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T12:53:47Z.
@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.Imported from TaynanGT/Vice-Tay. Originally posted by Kucharskov on 2026-11-27T13:04:51Z.
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
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T13:09:07Z.
@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.Imported from TaynanGT/Vice-Tay. Originally posted by Kucharskov on 2026-11-27T13:19:02Z.
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)
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T13:23:15Z.
@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.Imported from TaynanGT/Vice-Tay. Originally posted by Kucharskov on 2026-11-27T13:31:36Z.
Ican confirm that resizing works and buttons are mapped as requested. Still moving a mouse with captured pointer do not rotate ingame camera
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T13:37:21Z.
@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.Imported from TaynanGT/Vice-Tay. Originally posted by Kucharskov on 2026-11-27T13:44:31Z.
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
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T13:48:17Z.
@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.
Imported from TaynanGT/Vice-Tay. Originally posted by Kal0s-design on 2026-11-28T15:40:38Z.
I tried #256 (
c85dab2) withVICTORY_MOUSE_LOOK=1andVICTORY_MOUSE_CAPTURE=1, keyboard and mouse only. The cursor was confined, the camera didn't turn. I added a local counter on both sides (what the poll publishes, what the title reads back), summed every 2 s, and it showed a different cause than the one here, so I'm leaving it in case others hit it.Every poll counted a host pad, although nothing was plugged in. The machine has an always-present virtual XInput pad (an Xbox 360 class device from a vendor "controller emulation" driver). Because of that
any_padis always true andmouse_stickis dropped by design, so the title only ever saw that pad's resting stick:The mouse side worked, it reached full deflection. The title read
current(kind 0x40000, dev 4)about once a frame, pluscurrent/nexton the keyboard, and never got more than 0.0078 (the virtual pad's 1/128 at rest).Virtual pads like this are common (Steam Input, DS4Windows, vendor drivers), so anyone with one will see mouse look do nothing. In one-pad mode the host pads are merged with the stand-in anyway, and
mergedkeeps the larger value per axis, so letting the mouse join there seems safe:It builds, but I haven't confirmed in game yet that the camera turns with it. It also flips the expectation of
mouse_stick_has_effect_only_without_a_physical_pad. I'll report back after a run.This doesn't explain the report above, since the "reached the fallback gamepad right stick" line there only fires without a pad.
AI-assisted: yes
Imported from TaynanGT/Vice-Tay. Originally posted by Kal0s-design on 2026-11-28T16:04:11Z.
Follow-up with game runs, same machine (the always-present virtual pad), boat section at the start, keyboard and mouse only.
#256 plus the one-pad change above: the camera turns with the mouse now, but it's choppy. The counter shows why: the stick is rebuilt from each 8 ms poll's delta, so it's back at zero whenever a poll had no new motion, and the title (reading about once a frame) mostly lands on those zeros.
#377 as is (
dc2d262): it already lets the mouse join in one-pad mode (stand_in_active = one_pad || no pads), so it works on this machine without changes, and the 45 ms decay fills those gaps. It felt smoother, at a lower frame rate than the other run.Totals over the 2 s windows where the mouse was moving:
Average frame rate was about 16 fps in the first run and 12 in the second, so the difference isn't coming from a faster game. I didn't get to test the triggers on mouse buttons (no shooting in that part), and the F2/Esc lock only briefly.
So from here #377 looks like the one to take for the camera, and it covers the virtual-pad case too. I'll drop my one-line change.
AI-assisted: yes
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T11:23:48Z.
Thanks for measuring actual title reads. The 24% versus 61% result makes the decay in #377 much clearer even at lower FPS. I'll prioritize that approach for the camera; mouse-button triggers, focus loss and F2/Esc capture still need separate checks.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:02:44Z.
mainhas moved to a new line of the code and everything is now named Vice-Tay:vice-tay.exe play, andVICE_TAY_*switches instead ofVICTORY_*(details in #468). Could you check whether this still happens on the currentmainand say so here, with a log if you can?Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T20:16:33Z.
Both of these are on by default now and the switch you were using is gone.
VICTORY_GAMEPAD_MOUSEdoesn't exist. What replaced it:VICE_TAY_MNK=1- mouse and keyboard alongside the pads, on by default. The game then shows keyboard prompts; F1 > CONTROLS GAMEPAD brings the pad's back.VICE_TAY_MOUSE_CAPTURE=1- the mouse held inside the window, also on by default. F9 lets it go, and F1 > MOUSE CAPTURE turns it off for good.Default bindings are in
bindings.ini, which gets written next to your settings on first use so you can change them.So on a current
mainyou should get a captured cursor and a camera that responds without setting anything. If it doesn't, that's a live bug and worth saying here - with the log and whether the window had focus, since capture follows focus.Everything renamed on 30 November: #468.