Emulator Issues #11702
Dolphin not reading Keyboard/Mouse inputs
Game ID? (right click the game in the game list, Properties, Info tab)
MD5 Hash? (right click the game in the game list, Properties, Verify tab, Verify Integrity button)
What's the problem? Describe what went wrong.
Dolphin is not recognizing inputs from Keyboard or Mouse. Gamepad reads correctly. Applies to menus, key config, and in-game.
What steps will reproduce the problem?
Attempt to use keyboard or Mouse input
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Is the issue present in the latest stable version?
If the issue isn't present in the latest stable version, which is the first broken version? (You can find the first broken version by bisecting. Windows users can use the tool https://forums.dolphin-emu.org/Thread-green-notice-development-thread-unofficial-dolphin-bisection-tool-for-finding-broken-builds and anyone who is building Dolphin on their own can use git bisect.)
First broken in 9876 [InputCommon: Fix Win32 init race. (PR #7951 from jordan-woyak)]
If your issue is a graphical issue, please attach screenshots and record a three frame fifolog of the issue if possible. Screenshots showing what it is supposed to look like from either console or older builds of Dolphin will help too. For more information on how to use the fifoplayer, please check here: https://wiki.dolphin-emu.org/index.php?title=FifoPlayer
What are your PC specifications? (CPU, GPU, Operating System, more)
Keyboard: Logitech G19s
Mouse: Logitech G502 (latest revision)
Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)
#8 Updated by tossapon over 1 year ago
There's the screenshot if you want to look.
Also in the 5.0-9874, the configuration dialog is working after the program started, the input itself is not actually working ingame. The latest version I confirmed to be working is 5.0-9865.
#10 Updated by tossapon over 1 year ago
After more testing in 9874, the input seems to be working if I enter the game right away after open the emulator.
But there are cases where it stopped working...
- Start the emulator then open the configuration dialog work then closes the dialog then open again and it now stopped working.
- Start the emulator then run the game, the input is working but then closes the game and open the configuration dialog then it stopped working.
- Start the emulator then run the game, the input is working but after closes the game and run the game again, now it stopped working.
The cases above seems to point that the input only work once then broke after next time it used. This does not seems to be the case in 9865.
#12 Updated by tossapon over 1 year ago
That screenshot is actually from 10086 and the previous comment is from 9874 where I tested the cases when it only working once per startup(I have to completely closes the emulator then reopen for the input to be working again).
I tested past revision from 9876-10086 and all of them seems to be broken and never working even once.
The one that is working once are 9869-9874 from the situation I stated in the previous comment.
For more information, revision 9869 change log is "Add hotplug support to DInput and XInput controller backends" which I suspect to be the problem. Then from 9876 onward(something about win32 racing), it seems to be completely broken for me.
#13 Updated by gamerk2 over 1 year ago
Confirmed, last version that works reliably is 9865. Starting from 9869 you can sometimes map inputs but they don't seem to work once you open the config or quit a game. Starting from 9876 you can't map inputs period.
I have a suspicion what the problem is. I looked at all my keyboard and mouse devices and I have several duplicate entries for both listed in device manager and other utilities I have that check for directinput devices (ditool). I'm wondering if that's causing a problem as of release 9869. I've attached a screenshot for what devices I'm picking up; you can see the duplicate keyboard and mouse devices.
#16 Updated by gamerk2 over 1 year ago
Suspicion confirmed. I think I've got a brute force workaround as well.
First off, I'm using 10132 as a base. In this version, input assignment works until the refresh button is clicked or a game is launched, in which case inputs stop working again.
What I'm seeing is this: My Keyboard/Mouse is definitely being picked up as multiple devices, and post PR7776 it looks like the code isn't accounting that multiple keyboard/mice as a possibility. Inputs work on Dolphin Init by accident; Dinput::PopulateDevices() is getting invoked twice and picks up the second device input the second time through. Once a game is started OR the refresh button is hit, Dinput::PopulateDevices() only gets invoked once and the second keyboard/mouse device never gets detected again.
I revoked some of the PR changes, and initial testing shows the problem is resolved, though likely breaking the intent of the PR for DirectInput devices in the process. I made the following changes:
ControllerInterface.ccp: Remove the entirety of PR7776.
DinputKeyboardMouse.ccp: Remove the check for duplicate devices (all instances of the use of bool s_keyboard_mouse_exists).
Note there is still a difference between an init and device refresh; on init two separate Dinput device entries are listed (Dinput/0/Keyboard Mouse and Dinput/1/Keyboard Mouse), but after a refresh only the first is listed. Inputs still work though, but I dislike an init and refresh are giving different results.
Someone smarter then me is going to have to come up with a proper solution. I can test whatever they come up with to confirm it works.
#21 Updated by darkl3ad3r 12 months ago
This is still happening for me on the latest builds as of 12/21/2019 5:00 AM. I have to refresh my hotkeys page or my keyboard does not work and I cannot use my ALT + ENTER combo to switch to fullscreen or press ESC to end emulation like I always have for the last 12 years. Is there anything being looked at to resolve this issue? I'm just glad I thought to search the Dolphin bug tracker because I was really starting to think it was my computer/keyboard that were failing and it turns out to be a hard bug in Dolphin instead. At least there's some relief there.
This PR seems to have improved the situation (at least on my machine) https://github.com/dolphin-emu/dolphin/pull/8795
but the issue is still present. I've been investigating with no success. The keyboard and mouse device is created correctly but calls like:
HRESULT mo_hr = m_mo_device->GetDeviceState(sizeof(tmp_mouse), &tmp_mouse);
return a blank input, so there is a small chance the problem is with DInput, though the person that opened the bug said it didn't happen before https://github.com/dolphin-emu/dolphin/pull/7951
Can't really comment since I haven't used Dolphin in a few months; I'll take a look sometime in the next few days and see if the issue is happening to me again.
It might also be worth noting what input devices you are using; in my case both devices at issue were Logitech devices; there might be some commonality there.
#27 Updated by darkl3ad3r 9 days ago
I've been keeping tabs on this problem and I can positively say I have not had to manually refresh the device list under the Hotkeys menu in at least a couple/few months. I wish I had something specific to point to as when it became resolved, but I can only state that it is 100% Dolphin that broke it and Dolphin that resolved it. There have been virtually no changes to my PC's hardware setup in nearly 4 years, and very limited software changes (a fresh OS install back in April with monthly patches from Microsoft, and driver updates to my graphics card exclusively) along the way.
I think it might be safe to close this one. Can anyone chime in if they're still getting this issue?
#28 Updated by traviskaufman 1 day ago
I can confirm this issue is still occurring for me. I am trying to add a new keyboard shortcut, and that's how I ran into this issue.
I'm compiling Dolphin from source and running from the Release version of the build.
I've experienced multiple issues. Namely:
Most hotkeys don't seem to work. Notable exceptions are open (CTRL+O), as well as the Save Register
Some hotkeys work the "Escape" hotkey works except it pauses the game, even though it's mapped to "Stop".
If I go to Options -> Controller Settings -> Gamecube Controllers and change "Port 1" to Keyboard, the Game window does not receive any input whatsoever. I have to leave it on "Standard Controller" for it to work.
I've tried cold-booting my PC and trying again, didn't do anything.
CPU - AMD Ryzen 5 3600 6-Core
GPU - NVIDIA GeForce RTX 2070
OS - Windows 10 (x64) v1909 (OS Build 18363.1198)
Keyboard - Skytech K-1000 Gaming Keyboard
Mouse - Skytech M-1000 Gaming Mouse
I'm happy to look into a fix for this, but I'd need someone with more experience in the codebase to point me in the right direction. I don't have the bandwidth to hunt through PRs to identify the issue and the Dolphin codebase seems very large and has undergone a lot of evolution so it's hard to pin down where one might make the change :)
#29 Updated by traviskaufman 1 day ago
Log from starting up Super Smash Bros. Melee, and trying to do a few keyboard shortcuts, all of which failed and/or behaved erratically:
15:33:829 Core\ConfigManager.cpp:694 N[CORE]: Active title: Super Smash Bros. Melee (GALE01) 15:33:832 Core\Core.cpp:998 N[COMMON]: Want determinism <- false 15:33:838 InputCommon\ControllerInterface\ControllerInterface.cpp:225 N[SI]: Added device: DInput/0/Keyboard Mouse 15:37:347 beb\src\cubeb_wasapi.cpp:1332 N[Audio]: default device period: 100000 15:37:347 beb\src\cubeb_wasapi.cpp:1340 N[Audio]: Minimum latency in frames: 480 15:37:347 beb\src\cubeb_wasapi.cpp:1679 N[Audio]: (000002916E76E740) Setup render: device=0000000000000000 15:37:349 beb\src\cubeb_wasapi.cpp:1587 N[Audio]: Setup requested=[f=0 r=48000 c=2 l=stereo] mix=[f=0 r=48000 c=2 l=stereo] 15:37:381 beb\src\cubeb_wasapi.cpp:1730 N[Audio]: Target sample rate: 48000 15:37:385 beb\src\cubeb_wasapi.cpp:151 N[Audio]: COM was already initialized in MTA 15:37:390 beb\src\cubeb_wasapi.cpp:1190 N[Audio]: Stop and join render thread. 15:37:390 beb\src\cubeb_wasapi.cpp:1233 N[Audio]: Closing thread. 15:37:390 Core\Boot\Boot.cpp:420 N[BOOT]: Booting from disc: C:/Users/Travis/true3d/Data/dolphin-games/Super Smash Bros. Melee (USA) (En,Ja) (v1.02).iso 15:37:398 Core\HLE\HLE_OS.cpp:85 N[OSREPORT]: 81200308->81300000| 15:37:398 Core\HLE\HLE_OS.cpp:85 N[OSREPORT]: 81200324->81300000| This Apploader built Nov 14 2001 02:04:39 15:37:521 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: 15:37:522 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: Dolphin OS $Revision: 47 $. 15:37:523 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: Kernel built : Nov 12 2001 01:46:17 15:37:524 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: Console Type : Development HW3 15:37:524 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: Memory 24 MB 15:37:525 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: Arena : 0x804eec00 - 0x817f8ac0 15:37:547 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: app booted from bootrom 15:38:379 beb\src\cubeb_wasapi.cpp:377 N[Audio]: Audio device property value changed. 15:39:696 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # --------------------------------------------- 15:39:696 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # Super Smash Bros. Melee 15:39:696 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # 15:39:697 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # Distribution 1 15:39:697 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # Language 1 15:39:697 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # DbLevel 0 15:39:697 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # Arena Size 19 MB 15:39:697 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # ARAM Free Size 9 MB 15:39:698 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # DATE Feb 13 2002 TIME 22:06:27 15:39:699 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # GC Calendar Year 2020 Month 12 Day 1 15:39:699 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # Hour 18 Min 15 Sec 34 15:39:699 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: # 15:39:700 Core\HW\EXI\EXI_DeviceIPL.cpp:308 N[OSREPORT]: 15:53:882 beb\src\cubeb_wasapi.cpp:1190 N[Audio]: Stop and join render thread. 15:53:883 beb\src\cubeb_wasapi.cpp:1233 N[Audio]: Closing thread. 15:56:940 beb\src\cubeb_wasapi.cpp:1190 N[Audio]: Stop and join render thread. 15:56:941 beb\src\cubeb_wasapi.cpp:1233 N[Audio]: Closing thread. 15:58:063 beb\src\cubeb_wasapi.cpp:1190 N[Audio]: Stop and join render thread. 15:58:063 beb\src\cubeb_wasapi.cpp:1192 N[Audio]: No thread present. 15:58:063 beb\src\cubeb_wasapi.cpp:1190 N[Audio]: Stop and join render thread. 15:58:063 beb\src\cubeb_wasapi.cpp:1192 N[Audio]: No thread present. 15:58:091 VideoBackends\D3D\D3DBase.cpp:161 N[Video]: Successfully released all device references! 15:58:201 InputCommon\ControllerInterface\ControllerInterface.cpp:225 N[SI]: Added device: DInput/0/Keyboard Mouse