Mouse capturing problem - cursor remains visible and is not confined to the game window #220

Open
opened 2026-11-27 11:01:39 +00:00 by github-bot · 15 comments
Owner

@⁠Kucharskov on GitHub · 2026-11-27 10:56 UTC · original

Description

I'm trying to use VICTORY_GAMEPAD_MOUSE to 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

  • Windows 11 + AMD Ryzen 7 5800X + RTX 3060 Ti
  • Target: x86_64-pc-windows-msvc
  • Rust toolchain: 1.98.1
  • Build profile: diag
  • Console: series-s
  • Window mode: -Windowed
  • No physical gamepad connected (keyboard and mouse only).

What I've tried

  1. Installed the required Rust toolchain
  2. Built and ran the project using the diag profile.
  3. Enabled VICTORY_GAMEPAD_MOUSE=1.
  4. Explicitly enabled VICTORY_MOUSE_CAPTURE=1.
  5. Explicitly disabled VICTORY_MOUSE_WARP=0.
  6. Used the merged changes from PR #17, which were supposed to address mouse capture and cursor handling.

Actual behavior

  • The game launches and its window can receive focus.
  • The mouse cursor remains visible.
  • The cursor is not confined to the emulator window.
  • I can move the cursor freely across the entire desktop, even when the game is focused.
  • Mouse movement does not control the game camera.

Expected behavior

When the game window is focused and VICTORY_GAMEPAD_MOUSE=1 and VICTORY_MOUSE_CAPTURE=1 are enabled:

  • The mouse cursor should become hidden.
  • The cursor should be confined to the game window.
  • Mouse movement should be captured and passed to the emulated gamepad.
  • When the window loses focus, mouse capture should be released.

Question

Could someone help identify why mouse capture is not being activated?

Is there an additional configuration option or prerequisite required for VICTORY_MOUSE_CAPTURE to work, or could there be an issue in the window focus / mouse input handling implementation?

Thanks!

**@⁠Kucharskov** on GitHub · 2026-11-27 10:56 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220) ### Description I'm trying to use `VICTORY_GAMEPAD_MOUSE` to 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 - Windows 11 + AMD Ryzen 7 5800X + RTX 3060 Ti - Target: `x86_64-pc-windows-msvc` - Rust toolchain: `1.98.1` - Build profile: `diag` - Console: `series-s` - Window mode: `-Windowed` - No physical gamepad connected (keyboard and mouse only). ### What I've tried 1. Installed the required Rust toolchain 2. Built and ran the project using the `diag` profile. 3. Enabled `VICTORY_GAMEPAD_MOUSE=1`. 4. Explicitly enabled `VICTORY_MOUSE_CAPTURE=1`. 5. Explicitly disabled `VICTORY_MOUSE_WARP=0`. 6. Used the merged changes from PR #17, which were supposed to address mouse capture and cursor handling. ### Actual behavior - The game launches and its window can receive focus. - The mouse cursor remains visible. - The cursor is not confined to the emulator window. - I can move the cursor freely across the entire desktop, even when the game is focused. - Mouse movement does not control the game camera. ### Expected behavior When the game window is focused and `VICTORY_GAMEPAD_MOUSE=1` and `VICTORY_MOUSE_CAPTURE=1` are enabled: - The mouse cursor should become hidden. - The cursor should be confined to the game window. - Mouse movement should be captured and passed to the emulated gamepad. - When the window loses focus, mouse capture should be released. ### Question Could someone help identify why mouse capture is not being activated? Is there an additional configuration option or prerequisite required for `VICTORY_MOUSE_CAPTURE` to work, or could there be an issue in the window focus / mouse input handling implementation? Thanks!
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 11:01:39 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 11:08 UTC · original

@⁠Kucharskov This build reads VICTORY_GAMEPAD_MOUSE=1 for 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 says the process already receives mouse Raw Input; keeping its registration. That would identify the existing-registration path. Mouse settings

**@⁠TaynanGT** on GitHub · 2026-11-27 11:08 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7216725219) @⁠Kucharskov This build reads `VICTORY_GAMEPAD_MOUSE=1` for 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 says `the process already receives mouse Raw Input; keeping its registration`. That would identify the existing-registration path. [Mouse settings](https://github.com/TaynanGT/Vice-Tay/blob/main/docs/victory-nvidia.md)
Author
Owner

@⁠Kucharskov on GitHub · 2026-11-27 11:25 UTC · original

Heres a log from my game boot: vice-tay-run.log
I found these:

11:17:56.290  GameInputCreate
11:17:56.290  input device device=4 connected=true
11:17:56.290  input device device=5 connected=true
11:17:56.395  input device device=6 connected=true

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 Input which 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 :)

**@⁠Kucharskov** on GitHub · 2026-11-27 11:25 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7217056634) Heres a log from my game boot: [vice-tay-run.log](https://github.com/user-attachments/files/35510144/vice-tay-run.log) I found these: ``` 11:17:56.290 GameInputCreate 11:17:56.290 input device device=4 connected=true 11:17:56.290 input device device=5 connected=true 11:17:56.395 input device device=6 connected=true ``` 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 Input`` which 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 :)
Author
Owner

@⁠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 calls GetMouseState successfully. In that diagnostics build, move the mouse for a few seconds with the in-game camera active and check which lines appear.

**@⁠TaynanGT** on GitHub · 2026-11-27 11:45 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7217446913) · 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 calls `GetMouseState` successfully. In that diagnostics build, move the mouse for a few seconds with the in-game camera active and check which lines appear.
Author
Owner

@⁠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

  1. Pullthe latest version of the Vice-Tay repository.
  2. Reuilt the project.
  3. Launched the game with the following environment variables:
    • VICTORY_GAMEPAD_MOUSE=1
    • VICTORY_MOUSE_CAPTURE=1
    • VICTORY_MOUSE_WARP=1
  4. Waited until the first interactive scene to test mouse input.
  5. Checked the logs for the new mouse diagnostic messages.

Result

Mouse input is still not working.

  • The game does not capture the mouse cursor.
  • Moving the mouse does not rotate the in-game camera.
  • The logs contain received relative mouse movement in the title window
  • However, I cannot find the title read a GameInput mouse state message in the logs

The issue persists with all three mouse-related environment variables enabled.

**@⁠Kucharskov** on GitHub · 2026-11-27 12:13 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7217986122) · edited 2026-11-27 12:15 UTC So theres a logfile: [vice-tay-runmouse.log](https://github.com/user-attachments/files/35511848/vice-tay-runmouse.log) ### Steps I took 1. Pullthe latest version of the Vice-Tay repository. 2. Reuilt the project. 3. Launched the game with the following environment variables: - `VICTORY_GAMEPAD_MOUSE=1` - `VICTORY_MOUSE_CAPTURE=1` - `VICTORY_MOUSE_WARP=1` 4. Waited until the first interactive scene to test mouse input. 5. Checked the logs for the new mouse diagnostic messages. ### Result **Mouse input is still not working.** - The game does not capture the mouse cursor. - Moving the mouse does not rotate the in-game camera. - The logs contain `received relative mouse movement in the title window` - However, I cannot find the `title read a GameInput mouse state` message in the logs The issue persists with all three mouse-related environment variables enabled.
Author
Owner

@⁠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 GetMouseState markers. Raw Input reaches the foreground window. I added #256 at 9aa8e0d to 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.

**@⁠TaynanGT** on GitHub · 2026-11-27 12:19 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7218109644) · edited 2026-11-27 12:43 UTC @⁠Kucharskov The log has one relative-motion marker and zero successful `GetMouseState` markers. Raw Input reaches the foreground window. I added [#256](https://git.gtahub.st/github/TaynanGT--Vice-Tay/pulls/256) at `9aa8e0d` to 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.
Author
Owner

@⁠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

**@⁠Kucharskov** on GitHub · 2026-11-27 12:51 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7218751942) 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](https://github.com/user-attachments/files/35513245/vice-tay-runmouse2.log)
Author
Owner

@⁠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.

**@⁠TaynanGT** on GitHub · 2026-11-27 12:53 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7218806109) · edited 2026-11-27 13:05 UTC @⁠Kucharskov I added cursor confinement to [#256](https://git.gtahub.st/github/TaynanGT--Vice-Tay/pulls/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.
Author
Owner

@⁠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.

image

As you can see, the camera has shifted slightly downward.
image

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

**@⁠Kucharskov** on GitHub · 2026-11-27 13:04 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7219031860) · 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. <img width="821" height="451" alt="image" src="https://github.com/user-attachments/assets/32c60509-ec1d-484b-a076-44e226641866" /> As you can see, the camera has shifted slightly downward. <img width="817" height="450" alt="image" src="https://github.com/user-attachments/assets/3340cb51-04aa-4b54-9291-5fb582058c33" /> 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
Author
Owner

@⁠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 c4978e4 build adds VICTORY_MOUSE_CAPTURE=1 to 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.

**@⁠TaynanGT** on GitHub · 2026-11-27 13:09 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7219122104) @⁠Kucharskov The camera movement as the pointer re-enters the client area confirms the fallback stick can turn the view. The new `c4978e4` build adds `VICTORY_MOUSE_CAPTURE=1` to 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.
Author
Owner

@⁠Kucharskov on GitHub · 2026-11-27 13:19 UTC · original

I rebuild c4978e4 and 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)

**@⁠Kucharskov** on GitHub · 2026-11-27 13:19 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7219326870) I rebuild c4978e4 and 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)
Author
Owner

@⁠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 logs mouse motion reached the fallback gamepad right stick once, which will tell us whether movement gets that far.

**@⁠TaynanGT** on GitHub · 2026-11-27 13:23 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7219414789) · edited 2026-11-27 13:26 UTC @⁠Kucharskov The resize fix and button mapping are in [#256](https://git.gtahub.st/github/TaynanGT--Vice-Tay/pulls/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 logs `mouse motion reached the fallback gamepad right stick` once, which will tell us whether movement gets that far.
Author
Owner

@⁠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

**@⁠Kucharskov** on GitHub · 2026-11-27 13:31 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7219589027) Ican confirm that resizing works and buttons are mapped as requested. Still moving a mouse with captured pointer do not rotate ingame camera
Author
Owner

@⁠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 stick on c85dab2? 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.

**@⁠TaynanGT** on GitHub · 2026-11-27 13:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7219726429) @⁠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 stick` on `c85dab2`? 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.
Author
Owner

@⁠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'} -Windowed
I checked logs and i got these two:

2026-11-27T13:41:25.843566Z  INFO victory_hle::modules::gameinput::mouse[
2m: received relative mouse movement in the title window
2026-11-27T13:41:25.847966Z  INFO victory_hle::modules::gameinput:
 mouse motion reached the fallback gamepad right stick

Isnt it strange that it occurs one after another? Anyway fix it asap pls

**@⁠Kucharskov** on GitHub · 2026-11-27 13:44 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7219886759) I ran game with ``-Console series-s -More @{VICTORY_MOUSE_LOOK='1'; VICTORY_MOUSE_CAPTURE='1'} -Windowed`` I checked logs and i got these two: ``` 2026-11-27T13:41:25.843566Z  INFO victory_hle::modules::gameinput::mouse[ 2m: received relative mouse movement in the title window 2026-11-27T13:41:25.847966Z  INFO victory_hle::modules::gameinput: mouse motion reached the fallback gamepad right stick ``` Isnt it strange that it occurs one after another? Anyway fix it asap pls
Author
Owner

@⁠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.

**@⁠TaynanGT** on GitHub · 2026-11-27 13:48 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/220#issuecomment-7219964567) @⁠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.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/TaynanGT--Vice-Tay#220
No description provided.