-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get joypad's vendor ID, product ID and name on Windows for XInput devices. #98861
Get joypad's vendor ID, product ID and name on Windows for XInput devices. #98861
Conversation
195dddc
to
949f572
Compare
OK, so the Godot build artifact for Windows crashes on startup. As it's not a debug build, there's no stacktrace. And I can't get Godot to build on Windows, because it just can't find mingw (yes, I followed Godot's build instructions). |
@MJacred 64-bit Windows editor binary of this PR with MinGW debug symbols (in a separate file): https://fromsmash.com/Godot-PR-test-GH-98861 |
949f572
to
924d72b
Compare
@Calinou: I think I found something: "3221225477", which is apparently an access violation.. As Godot only crashes when I plugin an XInput device, I suspect the issue lies in This is the command I used gdb --symbols=godot.windows.editor.x86_64.exe.debugsymbols --exec=godot.windows.editor.x86_64.exe but I got
Starting Godot with XInput device plugged infound info on error code Starting program: C:...\godot.windows.editor.x86_64.console.exe
[New Thread 14628.0x315c]
[New Thread 14628.0x170c]
[New Thread 14628.0x3bc4]
Godot Engine v4.4.dev.custom_build.949f572c7 (2024-11-05 20:27:39 UTC) - https://godotengine.org
================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.4.dev.custom_build (949f572c70cfc15b0711ba23bd745874d8038d2f)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================
[Thread 14628.0x170c exited with code 3221225477]
[Thread 14628.0x3bc4 exited with code 3221225477]
[Thread 14628.0x315c exited with code 3221225477]
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists. Starting Godot, then plugging in XInput devicemeaning of error code unknown Starting program: C:...\godot.windows.editor.x86_64.console.exe
[New Thread 6944.0x2ba0]
[New Thread 6944.0x2a88]
[New Thread 6944.0x920]
Godot Engine v4.4.dev.custom_build.949f572c7 (2024-11-05 20:27:39 UTC) - https://godotengine.org
OpenGL API 3.3.0 NVIDIA 560.94 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce GTX 970
================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.4.dev.custom_build (949f572c70cfc15b0711ba23bd745874d8038d2f)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================
[Thread 6944.0x920 exited with code 3221226525]
[Thread 6944.0x2a88 exited with code 3221226525]
[Thread 6944.0x2ba0 exited with code 3221226525]
[Inferior 1 (process 6944) exited with code 030000002035] |
OK, the good news: I fixed my compiling on windows. The bad news is: Apart from that, I get this warning (even if no XInput device gets plugged in), currently I don't think that is caused by me (but I'll check later): warning: clientcore\windows\dwm\dwmapi\attribute.cpp(185)\dwmapi.dll!00007FFC17C53647: (caller: 00007FF73D6FE436) ReturnHr(1) tid(1864) 80070057 The parameter is incorrect.
warning: clientcore\windows\dwm\dwmapi\attribute.cpp(185)\dwmapi.dll!00007FFC17C53647: (caller: 00007FF73D707AF4) ReturnHr(2) tid(1864) 80070057 The parameter is incorrect. |
d6583d6
to
417b029
Compare
417b029
to
db42a30
Compare
Switched to fetching the func I'll tackle getting the name next |
b463a9a
to
e0f24c2
Compare
OK, I got the name - ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected on Windows 11 23H2.
Testing project: test-joypad-vendor.zip
Format for the results below:
Name { Info }
Xbox Elite Series 2 (wired):
XInput Gamepad: { "xinput_index": 0, "vendor_id": "1118", "product_id": "767", "xinput_name": "Xbox One For Windows" }
DualSense (wired):
PS5 Controller: { "vendor_id": "19461", "product_id": "58892" }
Switch Pro Controller (wired):
Nintendo Switch Pro Controller: { "vendor_id": "32261", "product_id": "2336" }
Nyxi Warrior (wired):
XInput Gamepad: { "xinput_index": 1, "vendor_id": "1118", "product_id": "2850", "xinput_name": "XBOX 360 For Windows" }
e0f24c2
to
e5e1c80
Compare
Applied all requested changes. Thanks for the feedback, everybody! What do you all think about the change I mentioned in the issue's description regarding changing the joy name for XInput devices? I.e. not adding As an example, for "Xbox Elite Series 2 (wired)", you would get
instead of
This would make the whole thing more coherent not only with DirectInput joypads, but also with the other OS. |
c058d7b
to
91b4f5f
Compare
91b4f5f
to
eb3c0b9
Compare
Fully agree with it, |
eb3c0b9
to
7f80d24
Compare
7f80d24
to
01f9878
Compare
01f9878
to
01a2726
Compare
Regarding testing the PR: I replaced the test project in the issue description with one that reflects the latest change (i.e. XInput joypad name). I also noticed just now that the name set in the mapping db replaces the name coming from the OS/driver in |
Thanks! |
Currently, XInput devices (Windows only) lack info on vendor, product and its name. DirectInput also does not provide vendor and product. This PR is to fix that.
TODO
NOTES
XInput Gamepad
, now they have proper namesIdeas for alternative implementation
joyGetDevCapsW
, therefore loading Winmm.dllGetRawInputDeviceInfoA
orDIDEVICEINSTANCE
, basically making loading Winmm.dll obsolete. If I should check it out, I will. I'm not doing that right now, because I'm lacking background logic of the whole device mess (these APIs are all deprecated anyway...)sprintf_s(uid, "%04x%04x%04x%04x%04x%04x%04x%04x", BSWAP16(0x03), 0, jc.wMid, 0, jc.wPid, 0, 0, 0);
generated03000000045e0000028e000000000000
and03000000046d0000c21f000000000000
Testproject for this PR:
xinput_info.zip
output of Testproject on Windows