More than 4 XInput controllers
Andrew Gillett

I am in the final stages of finishing my game, but it has just been reported to me that if eight Xbox One controllers are connected, only four of them can be used. What I would have thought should be happening is that the first four are recognised as XInput controllers, and the rest are recognised as DirectInput controllers. Does Allegro do this?

I don't currently have 4+ XInput controllers to test with, but I've experienced a similar issue using Steam Remote Play Together, which streams the host's screen to the clients, and their controller inputs to the host. It's supposed to emulate XInput controllers until all four slots are full, and then emulate DirectInput controllers for the rest. But in practice what I'm seeing is that four XInput controllers show up for the host, but after that clients can't connect any more controllers.

One thing I'm going to try is using the Steam Input API, bypassing Allegro for controller input.

Added as an issue on GitHub:
https://github.com/liballeg/allegro5/issues/1194

Chris Katko

Xinput, by design, only supports 4 controllers. If Allegro has a DirectInput driver, I'd use that.

https://en.wikipedia.org/wiki/DirectInput#:~:text=XInput%20supports%20a%20maximum%20of,%2C%20or%20mouse%2Dtype%20devices.

Quote:

XInput supports a maximum of four controllers at a time. This is an Xbox limit, carried over to Windows. Although as of 2010 few PC games require more than four controllers at once, DirectInput itself has no such limitation.

If there's some newer version of Xinput that removes that limitation, I haven't seen it.

The Steam API seems like a great idea, although a problem if you want to sell on alternative platforms like GOG, or port to consoles.

Andrew Gillett

I'm aware of the 4 XInput controllers limit, but as I said before: "What I would have thought should be happening is that the first four are recognised as XInput controllers, and the rest are recognised as DirectInput controllers."

One option would be to turn off XInput support in Allegro and fall back to DirectInput only, but this is not ideal because DirectInput does not allow accurate reporting of button names, which my game shows. Also I'm not sure but there might be controllers which have XInput but not DirectInput drivers.

I have implemented the Steam Input API in my game, but that has a limit of 16 controllers, fine for most games but mine supports more. Also I have found that one of my third party controllers does not work with it.

Chris Katko

"What I would have thought should be happening is that the first four are recognised as XInput controllers, and the rest are recognised as DirectInput controllers."

It's kind of odd to expect Allegro (or anyone else) to use two drivers at the same time. I've literally never seen that in any application. That would cause many problems because each driver might have different resolution / timing / scaling for analog values.

a limit of 16 controllers, fine for most games but mine supports more.

That's a very niche oddball case. How important is it to have 1) named buttons, and 2) more than 16 controllers for a single application? 16 controllers in a single room? At this point wouldn't it be better if people just brought and used their cellphones as input devices? (Which IIRC You Don't Know Jack or some other modern quiz games use.) Have them connect to Wifi, presto, done.

Quote:

DirectInput does not allow accurate reporting of button names, which my game shows.

How about 1) hard coding them for the most common controllers 2) allowing custom controller profiles if people NEED their weird controllers? That's basically what Allegro 5 does internally anyway.

So far, what you're asking seems to be so niche its beyond what any one API provides. You're really going to have to ask some Stack Overflow magician to see if there's some super-obscure hack or API that would let you do this. But I looked at Raw Input API and AFAICT, it doesn't support named buttons--the names are coming from drivers and the driver is likely interfacing at a higher level (ala Raw Input API never even sees it).

You haven't really explained what your game/product is actually trying to do, so I assume it's a quiz or other party game (or not a game at all). If S.O. can't give you help, it would look like you need to rethink your game mechanics / decisions and decide what's most important. There's probably a reason you don't see many games supporting more than 16 players on a single PC. That's the price of living on the edge.

Andrew Gillett

You're right, it probably is a bit of a niche request. When my game was using Allegro 4, it was purely using DirectInput so there was no limit on the number of controllers. When I upgraded to Allegro 5, a side benefit was the ability to show actual button names. It's a Bomberman game, and there is a "join screen" which shows every connected controller and which button you have to press to join the game with that controller. It's unlikely that any players will connect more than 16 controllers to a PC (the most players I've had playing at once is 12), but it's nice to be able to advertise support for more.

There is also Steam Remote Play Together, which turns local multiplayer games into networked games by streaming the host's screen to the clients, and streaming their control inputs to the host – the host machine sees them as additional XInput or DirectInput controllers. This mode is a more plausible way of reaching 16 players, although it does require additional upload bandwidth for each connected client. I first realised something was not quite right when I was doing an online multiplayer test but only four remote players could use their controllers. Shortly afterwards, my game (due to be released in 3 weeks) failed Steam's build review because their review team connected eight Xbox One controllers, but only four of them worked. It's now obvious why this happened, but I hadn't anticipated it or seen it before because although I own about 10 controllers, most of them are DirectInput only – I'd never tested with more than four controllers which supported both XInput and DirectInput.

I initially assumed that other games or libraries must do something like what I suggested – detecting additional XInput controllers as DirectInput ones. But perhaps they do just use DirectInput.

I have now implemented Steam Input and it mostly works, although sometimes controllers randomly disconnect for a few frames and then reconnect. The limit of 16 is something I can live with for now – later on I can look at giving players the option of using DirectInput for controllers.

I should perhaps add a note to the docs to mention this issue so that it doesn't surprise anyone else in future.

UPDATE 29th Nov
It turns out that Steam Input also doesn't support more than 4 XInput controllers, although there is supposed to be a fix in the works for this.

So now my remaining option, assuming I can't rely on the Steam Input fix to come soon, is to switch to 100% DirectInput. On the joysticks page in the docs, it says:

"On Windows there are two joystick drivers, a DirectInput one and an Xinput one. If support for XInput was compiled in, then it can be enabled by calling al_set_config_value(al_get_system_config(), “joystick”, “driver”, “xinput”) before calling al_install_joystick, or by setting the same option in the allegro5.cfg configuration file. The Xinput and DirectInput drivers are mutually exclusive. The haptics subsystem will use the same driver as the joystick system does."

This seems outdated, as XInput and DirectInput are not mutually exclusive in Allegro, and there is no need to enable XInput manually. It would be nice to be able to disable XInput through al_set_config_value, but setting the driver to directinput means that devices supporting both drivers don't appear.

So I compiled out support for XInput by undefining ALLEGRO_CFG_XINPUT. And the result is that it can recognise 5 Xbox controllers, but every single time, as I connect the controllers in sequence, one of them will fail to respond to inputs - but if I press inputs on one of the previous controllers, it's as if I pressed the input on both that controller AND the newly connected controller!

I have attached a log file which includes DEBUGMODE output from Allegro.

Edgar Reynaldo

Bump to prevent lock.

Peter Hull

(Thanks for the bump Edgar, I hadn't seen the edit to this.)

This is going to be tricky as I don't think anyone has as many troublesome joysticks as you!
First it would be handy to know what exact version of Allegro you have because the line numbers in your debug output don't match up to the 5.2.6 code.
Second if you're up for some rebuilding I would be interested to know if any or all of your joysticks need polling. It's towards the bottom of joystick_enum_callback, line 952 in the stock 5.2.6 source code. You could maybe adapt the ALLEGRO_INFO that follows a bit later to print whether they are polling or not. - just because some of the code looks a bit strange to me.
Finally it ought to be possible to select DI or XI or the combined driver just from the config file, see win_get_joystick_driver in wsystem.c. Do you think this isn't working as it should? That would be something else to fix.

Rodolfo Lam

Bumping thread in case a soul knows anything about this...

Chris Katko

great. now i'm gonna go pull all the stacks of packed boxes out of my apartment and try and find some controllers.

and re-installing MSVC for the 13-billionth-time. I had to re-install windows... again... because a windows update bricked while my HDD was full (no HDD space checks?!?) and broke Windows Updates no matter how many fixes I tried.

[edit]

Where do you get Allegro debug symbols with nuget?

It's definitely doing something strange. i have 5 joysticks, i press one button on each in same order. second time around, it freezes for awhile inside a Allegro function.

That or someone tell me where I can download (or send to me) the allegro.pdb file for this exact nuget version (newest?). Because I imagine the normal Allegro5.zip doesn't have it, and there's only MinGW windows releases on github.

FYI to devs if you don't publish them, it appears you can as of ~2016, to a separate nuget server:

https://devblogs.microsoft.com/nuget/improved-package-debugging-experience-with-the-nuget-org-symbol-server/

It's "possible" (the wording is strange) that this only works for .NET packages. Hopefully not.

[edit] So I download DirectX SDK and the Allegro source so I can at least compile my own debugging symbols.

cmake .

explodes on finding DirectX and Xinput

#SelectExpand
1-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042. 2- Guessed MSVC directory: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe 3-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 4-- Performing Test ALLEGRO_HAVE_PROCFS_ARGCV 5-- Performing Test ALLEGRO_HAVE_PROCFS_ARGCV - Failed 6-- Performing Test ALLEGRO_HAVE_SV_PROCFS_H 7-- Performing Test ALLEGRO_HAVE_SV_PROCFS_H - Failed 8Using OpenGL 9CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 10 The package name passed to `find_package_handle_standard_args` (DINPUT) 11 does not match the name of the calling package (DirectX). This can lead to 12 problems in calling code that expects `find_package` result variables 13 (e.g., `_FOUND`) to follow a certain pattern. 14Call Stack (most recent call first): 15 cmake/FindDirectX.cmake:88 (find_package_handle_standard_args) 16 cmake/FindDirectX.cmake:100 (find_component) 17 CMakeLists.txt:809 (find_package) 18This warning is for project developers. Use -Wno-dev to suppress it. 19 20-- Could NOT find DINPUT (missing: DINPUT_INCLUDE_DIR DINPUT_LIBRARY) 21CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 22 The package name passed to `find_package_handle_standard_args` (D3D9) does 23 not match the name of the calling package (DirectX). This can lead to 24 problems in calling code that expects `find_package` result variables 25 (e.g., `_FOUND`) to follow a certain pattern. 26Call Stack (most recent call first): 27 cmake/FindDirectX.cmake:88 (find_package_handle_standard_args) 28 cmake/FindDirectX.cmake:101 (find_component) 29 CMakeLists.txt:809 (find_package) 30This warning is for project developers. Use -Wno-dev to suppress it. 31 32-- Could NOT find D3D9 (missing: D3D9_INCLUDE_DIR D3D9_LIBRARY) 33CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 34 The package name passed to `find_package_handle_standard_args` (D3DX9) does 35 not match the name of the calling package (DirectX). This can lead to 36 problems in calling code that expects `find_package` result variables 37 (e.g., `_FOUND`) to follow a certain pattern. 38Call Stack (most recent call first): 39 cmake/FindDirectX.cmake:88 (find_package_handle_standard_args) 40 cmake/FindDirectX.cmake:102 (find_component) 41 CMakeLists.txt:809 (find_package) 42This warning is for project developers. Use -Wno-dev to suppress it. 43 44-- Could NOT find D3DX9 (missing: D3DX9_INCLUDE_DIR D3DX9_LIBRARY) 45CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 46 The package name passed to `find_package_handle_standard_args` (DSOUND) 47 does not match the name of the calling package (DirectX). This can lead to 48 problems in calling code that expects `find_package` result variables 49 (e.g., `_FOUND`) to follow a certain pattern. 50Call Stack (most recent call first): 51 cmake/FindDirectX.cmake:88 (find_package_handle_standard_args) 52 cmake/FindDirectX.cmake:103 (find_component) 53 CMakeLists.txt:809 (find_package) 54This warning is for project developers. Use -Wno-dev to suppress it. 55 56-- Could NOT find DSOUND (missing: DSOUND_INCLUDE_DIR DSOUND_LIBRARY) 57CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 58 The package name passed to `find_package_handle_standard_args` (XINPUT) 59 does not match the name of the calling package (DirectX). This can lead to 60 problems in calling code that expects `find_package` result variables 61 (e.g., `_FOUND`) to follow a certain pattern. 62Call Stack (most recent call first): 63 cmake/FindDirectX.cmake:88 (find_package_handle_standard_args) 64 cmake/FindDirectX.cmake:104 (find_component) 65 CMakeLists.txt:809 (find_package) 66This warning is for project developers. Use -Wno-dev to suppress it. 67 68-- Could NOT find XINPUT (missing: XINPUT_INCLUDE_DIR XINPUT_LIBRARY) 69CMake Error at CMakeLists.txt:817 (message): 70 Windows port requires DirectInput (not found). 71 72 73-- Configuring incomplete, errors occurred! 74See also "C:/Users/cmkat/Downloads/allegro-5.2.6.0/allegro/CMakeFiles/CMakeOutput.log". 75See also "C:/Users/cmkat/Downloads/allegro-5.2.6.0/allegro/CMakeFiles/CMakeError.log".

:-/:-/:-/:-/

I tried installing this SDK (550 MB)

https://www.microsoft.com/en-us/download/details.aspx?id=6812

as well as the Windows SDK in the MSVC Installer menu (though that was only 5 MB so not really).

[edit] God, downloading DX9 SDK from here... i feel so... dirty... downloading from one of those "DLL" websites. Even the URL fills me with terror.

https://directx-software-development-kit.en.lo4d.com/download/mirror-ex1

If DX9 is really a "requirement" then ya'll need to just update it. [edit] Nope, link goes back to microsoft, which is now intentionally removed so you HAVE to install the modern DirectX SDK.

[edit] Welp, I just found and compiled and ran DirectX 9 samples. So your makefile sucks. :P

Peter Hull

:-/ indeed.

I built Allegro from git using Visual Studio just yesterday and I didn't get any issues like you're seeing. I'll try and figure out if I did anything different. I don't remember having to download any 'dodgy' files.

Chris Katko

I went to releases and got the Allegro zip. It's possible you already have whatever dependencies / file paths cmake is assuming that aren't valid.

This is a 100% fresh install (1 day old) of Windows 20H0, Visual Studio newest from website, etc. No weird stuff. No old stuff either. Just installed cmake from 64-bit installer.

I'll try git next but I don't see it changing cmake dependencies.

My DirectX appears to be here:

C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64

whereas FindDirectX.cmake

check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v7.0;InstallationFolder]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v7.0A;InstallationFolder]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v7.1;InstallationFolder]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v7.1A;InstallationFolder]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\DirectX SDK\\\\Installed Roots;KitsRoot]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\DirectX SDK\\\\]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows Kits\\\\Installed Roots;KitsRoot]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows Kits\\\\Installed Roots;KitsRoot81]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows Kits\\\\10\\\\Installed Roots;KitsRoot]")

I can't decipher it exactly. Does the semicolon mean multiple end-of-directory entries? And 81? Is that 8.1 even though there's no period? Also, why on the end? (And how do you end up with quad-backslashes? )

I have a:

C:\Program Files (x86)\Windows Kits\8.1

but it's almost empty. And 8.1 shouldn't be DirectX 9, right? A quick Google doesn't appear to show that.

Google search for "Directx 9 cmake config" yields this:

https://gist.github.com/billyquith/3a509315722fc822c8e904bc903364b8

And I don't know if your registry based HKEY_LOCAL_MACHINE thing automatically yields Program Files vs Program File (x86). Mine is Program Files (x86). I wonder if that's a clue. Am I building x86 or x64 Allegro by default?

[edit] cmake-gui shows CMAKE_AR as in program files (x86) but... runs /x64/lib.exe and /x64/cl.exe. So maybe I only have x86 DirectX SDK?

[edit] https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk/

This Windows SDK (directx sdk is now inside Windows SDK) pops up an installer that lets you choose x64. Though the main page says you can just use the [Visual Studio Installer] to install DirectX... which I did previously. Maybe I never loaded an X64 project so it never "auto downloaded" those files?...no... my sample project files say Debug X64. This is so stupid. Currently proceeding with the aforementioned link installer.

[edit] NOPE. NO DICE. I really thought that was gonna fix it.

Running Cmake from a MSVC Terminal (as per docs):

#SelectExpand
1CMake Error: The source directory "C:/Users/cmkat/Downloads/allegro-5.2.6.0/allegro/Build" does not appear to contain CMakeLists.txt. 2Specify --help for usage, or press the help button on the CMake GUI. 3 4C:\Users\cmkat\Downloads\allegro-5.2.6.0\allegro\Build>cmake .. 5-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042. 6-- Guessed MSVC directory: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe 7-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 8-- Performing Test ALLEGRO_HAVE_PROCFS_ARGCV 9-- Performing Test ALLEGRO_HAVE_PROCFS_ARGCV - Failed 10-- Performing Test ALLEGRO_HAVE_SV_PROCFS_H 11-- Performing Test ALLEGRO_HAVE_SV_PROCFS_H - Failed 12Using OpenGL 13CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 14 The package name passed to `find_package_handle_standard_args` (DINPUT) 15 does not match the name of the calling package (DirectX). This can lead to 16 problems in calling code that expects `find_package` result variables 17 (e.g., `_FOUND`) to follow a certain pattern. 18Call Stack (most recent call first): 19 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 20 cmake/FindDirectX.cmake:106 (find_component) 21 CMakeLists.txt:809 (find_package) 22This warning is for project developers. Use -Wno-dev to suppress it. 23 24CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 25 The package name passed to `find_package_handle_standard_args` (D3D9) does 26 not match the name of the calling package (DirectX). This can lead to 27 problems in calling code that expects `find_package` result variables 28 (e.g., `_FOUND`) to follow a certain pattern. 29Call Stack (most recent call first): 30 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 31 cmake/FindDirectX.cmake:107 (find_component) 32 CMakeLists.txt:809 (find_package) 33This warning is for project developers. Use -Wno-dev to suppress it. 34 35CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 36 The package name passed to `find_package_handle_standard_args` (D3DX9) does 37 not match the name of the calling package (DirectX). This can lead to 38 problems in calling code that expects `find_package` result variables 39 (e.g., `_FOUND`) to follow a certain pattern. 40Call Stack (most recent call first): 41 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 42 cmake/FindDirectX.cmake:108 (find_component) 43 CMakeLists.txt:809 (find_package) 44This warning is for project developers. Use -Wno-dev to suppress it. 45 46CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 47 The package name passed to `find_package_handle_standard_args` (DSOUND) 48 does not match the name of the calling package (DirectX). This can lead to 49 problems in calling code that expects `find_package` result variables 50 (e.g., `_FOUND`) to follow a certain pattern. 51Call Stack (most recent call first): 52 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 53 cmake/FindDirectX.cmake:109 (find_component) 54 CMakeLists.txt:809 (find_package) 55This warning is for project developers. Use -Wno-dev to suppress it. 56 57CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 58 The package name passed to `find_package_handle_standard_args` (XINPUT) 59 does not match the name of the calling package (DirectX). This can lead to 60 problems in calling code that expects `find_package` result variables 61 (e.g., `_FOUND`) to follow a certain pattern. 62Call Stack (most recent call first): 63 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 64 cmake/FindDirectX.cmake:110 (find_component) 65 CMakeLists.txt:809 (find_package) 66This warning is for project developers. Use -Wno-dev to suppress it. 67 68WARNING: FreeImage not found, disabling support 69-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 70-- Could NOT find WebP (missing: WEBP_INCLUDE_DIRS WEBP_LIBRARIES) 71WARNING: libwebp not found, disabling support 72CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 73 The package name passed to `find_package_handle_standard_args` (DINPUT) 74 does not match the name of the calling package (DirectX). This can lead to 75 problems in calling code that expects `find_package` result variables 76 (e.g., `_FOUND`) to follow a certain pattern. 77Call Stack (most recent call first): 78 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 79 cmake/FindDirectX.cmake:106 (find_component) 80 addons/audio/CMakeLists.txt:92 (find_package) 81This warning is for project developers. Use -Wno-dev to suppress it. 82 83CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 84 The package name passed to `find_package_handle_standard_args` (D3D9) does 85 not match the name of the calling package (DirectX). This can lead to 86 problems in calling code that expects `find_package` result variables 87 (e.g., `_FOUND`) to follow a certain pattern. 88Call Stack (most recent call first): 89 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 90 cmake/FindDirectX.cmake:107 (find_component) 91 addons/audio/CMakeLists.txt:92 (find_package) 92This warning is for project developers. Use -Wno-dev to suppress it. 93 94CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 95 The package name passed to `find_package_handle_standard_args` (D3DX9) does 96 not match the name of the calling package (DirectX). This can lead to 97 problems in calling code that expects `find_package` result variables 98 (e.g., `_FOUND`) to follow a certain pattern. 99Call Stack (most recent call first): 100 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 101 cmake/FindDirectX.cmake:108 (find_component) 102 addons/audio/CMakeLists.txt:92 (find_package) 103This warning is for project developers. Use -Wno-dev to suppress it. 104 105CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 106 The package name passed to `find_package_handle_standard_args` (DSOUND) 107 does not match the name of the calling package (DirectX). This can lead to 108 problems in calling code that expects `find_package` result variables 109 (e.g., `_FOUND`) to follow a certain pattern. 110Call Stack (most recent call first): 111 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 112 cmake/FindDirectX.cmake:109 (find_component) 113 addons/audio/CMakeLists.txt:92 (find_package) 114This warning is for project developers. Use -Wno-dev to suppress it. 115 116CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 117 The package name passed to `find_package_handle_standard_args` (XINPUT) 118 does not match the name of the calling package (DirectX). This can lead to 119 problems in calling code that expects `find_package` result variables 120 (e.g., `_FOUND`) to follow a certain pattern. 121Call Stack (most recent call first): 122 cmake/FindDirectX.cmake:94 (find_package_handle_standard_args) 123 cmake/FindDirectX.cmake:110 (find_component) 124 addons/audio/CMakeLists.txt:92 (find_package) 125This warning is for project developers. Use -Wno-dev to suppress it. 126 127-- Could NOT find OpenAL (missing: OPENAL_LIBRARY OPENAL_INCLUDE_DIR) 128CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 129 The package name passed to `find_package_handle_standard_args` (OPENSL) 130 does not match the name of the calling package (OpenSL). This can lead to 131 problems in calling code that expects `find_package` result variables 132 (e.g., `_FOUND`) to follow a certain pattern. 133Call Stack (most recent call first): 134 cmake/FindOpenSL.cmake:20 (find_package_handle_standard_args) 135 addons/audio/CMakeLists.txt:145 (find_package) 136This warning is for project developers. Use -Wno-dev to suppress it. 137 138-- Could NOT find OPENSL (missing: OPENSL_INCLUDE_DIR OPENSL_LIBRARY) 139-- Could NOT find FLAC (missing: FLAC_INCLUDE_DIR OGG_LIBRARY FLAC_LIBRARY) 140WARNING: libFLAC not found or compile test failed, disabling support. 141-- Could NOT find DUMB (missing: DUMB_INCLUDE_DIR DUMB_LIBRARY) 142WARNING: libdumb >= 2.0 or <= 0.9.3 not found or compile test failed, disabling support. See <https://github.com/kode54/dumb> for 2.0 or <http://dumb.sourceforge.net/> for 0.9.3. 143CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 144 The package name passed to `find_package_handle_standard_args` (OGG) does 145 not match the name of the calling package (Ogg). This can lead to problems 146 in calling code that expects `find_package` result variables (e.g., 147 `_FOUND`) to follow a certain pattern. 148Call Stack (most recent call first): 149 cmake/FindOgg.cmake:19 (find_package_handle_standard_args) 150 cmake/FindVorbis.cmake:13 (find_package) 151 addons/acodec/CMakeLists.txt:225 (find_package) 152This warning is for project developers. Use -Wno-dev to suppress it. 153 154-- Could NOT find OGG (missing: OGG_INCLUDE_DIR OGG_LIBRARY) 155WARNING: libvorbis not found or compile test failed, disabling support. 156CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 157 The package name passed to `find_package_handle_standard_args` (OGG) does 158 not match the name of the calling package (Ogg). This can lead to problems 159 in calling code that expects `find_package` result variables (e.g., 160 `_FOUND`) to follow a certain pattern. 161Call Stack (most recent call first): 162 cmake/FindOgg.cmake:19 (find_package_handle_standard_args) 163 cmake/FindOpus.cmake:13 (find_package) 164 addons/acodec/CMakeLists.txt:284 (find_package) 165This warning is for project developers. Use -Wno-dev to suppress it. 166 167-- Could NOT find OGG (missing: OGG_INCLUDE_DIR OGG_LIBRARY) 168WARNING: libopus not found or compile test failed, disabling support. 169-- Could NOT find MiniMP3 (missing: MINIMP3_INCLUDE_DIRS) 170WARNING: minimp3 was not found 171-- Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS) 172WARNING: FreeType not found, disabling support. 173-- Could NOT find PhysFS (missing: PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) 174-- Could NOT find PHYSFS (missing: PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) 175-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 176CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 177 The package name passed to `find_package_handle_standard_args` (OGG) does 178 not match the name of the calling package (Ogg). This can lead to problems 179 in calling code that expects `find_package` result variables (e.g., 180 `_FOUND`) to follow a certain pattern. 181Call Stack (most recent call first): 182 cmake/FindOgg.cmake:19 (find_package_handle_standard_args) 183 cmake/FindTheora.cmake:13 (find_package) 184 addons/video/CMakeLists.txt:17 (find_package) 185This warning is for project developers. Use -Wno-dev to suppress it. 186 187-- Could NOT find OGG (missing: OGG_INCLUDE_DIR OGG_LIBRARY) 188CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 189 The package name passed to `find_package_handle_standard_args` (OGG) does 190 not match the name of the calling package (Ogg). This can lead to problems 191 in calling code that expects `find_package` result variables (e.g., 192 `_FOUND`) to follow a certain pattern. 193Call Stack (most recent call first): 194 cmake/FindOgg.cmake:19 (find_package_handle_standard_args) 195 cmake/FindVorbis.cmake:13 (find_package) 196 addons/video/CMakeLists.txt:18 (find_package) 197This warning is for project developers. Use -Wno-dev to suppress it. 198 199-- Could NOT find OGG (missing: OGG_INCLUDE_DIR OGG_LIBRARY) 200WARNING: allegro_video wanted but no supported backend found 201-- Not building ex_color 202-- Not building ex_depth_mask 203-- Not building ex_haptic2 204-- Not building ex_physfs 205-- Not building ex_video 206-- Not building ex_font_justify 207-- Not building ex_font_multiline 208-- Not building ex_logo 209-- Not building ex_projection 210-- Not building ex_ttf 211-- Not building ex_audio_chain 212-- Not building ex_synth 213CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:424 (message): 214 The package name passed to `find_package_handle_standard_args` (ENET) does 215 not match the name of the calling package (ENet). This can lead to 216 problems in calling code that expects `find_package` result variables 217 (e.g., `_FOUND`) to follow a certain pattern. 218Call Stack (most recent call first): 219 cmake/FindENet.cmake:20 (find_package_handle_standard_args) 220 examples/CMakeLists.txt:258 (find_package) 221This warning is for project developers. Use -Wno-dev to suppress it. 222 223-- Could NOT find ENET (missing: ENET_INCLUDE_DIR ENET_LIBRARY) 224-- Not building tests due to missing library. Have: allegro allegro_main allegro_image allegro_color allegro_font allegro_primitives 225-- Could NOT find LATEX (missing: LATEX_COMPILER) 226-- Could NOT find Git (missing: GIT_EXECUTABLE) 227-- Using master as the git ref for source links in the documentation. 228-- Configuring done 229CMake Warning (dev) at demos/cosmic_protector/CMakeLists.txt:136 (add_dependencies): 230 Policy CMP0046 is not set: Error on non-existent dependency in 231 add_dependencies. Run "cmake --help-policy CMP0046" for policy details. 232 Use the cmake_policy command to set the policy and suppress this warning. 233 234 The dependency target "copy_demo_data" of target "cosmic_protector" does 235 not exist. 236This warning is for project developers. Use -Wno-dev to suppress it. 237 238CMake Warning (dev) at demos/skater/CMakeLists.txt:144 (add_dependencies): 239 Policy CMP0046 is not set: Error on non-existent dependency in 240 add_dependencies. Run "cmake --help-policy CMP0046" for policy details. 241 Use the cmake_policy command to set the policy and suppress this warning. 242 243 The dependency target "copy_example_data" of target "skater" does not 244 exist. 245This warning is for project developers. Use -Wno-dev to suppress it. 246 247CMake Warning (dev) at demos/skater/CMakeLists.txt:144 (add_dependencies): 248 Policy CMP0046 is not set: Error on non-existent dependency in 249 add_dependencies. Run "cmake --help-policy CMP0046" for policy details. 250 Use the cmake_policy command to set the policy and suppress this warning. 251 252 The dependency target "copy_skater_data" of target "skater" does not exist. 253This warning is for project developers. Use -Wno-dev to suppress it. 254 255-- Generating done 256-- Build files have been written to: C:/Users/cmkat/Downloads/allegro-5.2.6.0/allegro

Now I have 10.0.18362.0 and 10.0.19041.0. Both have X86 and X64 libraries in:

C:\Program Files (x86)\Windows Kits\10\Lib\10.0.###.0\um\x86
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.###.0\um\x64

Alright, so I'm officially exhausted for the night... err morning, since it's nearing 4 AM. So when someone tells me "building Allegro 5 on Windows is broken" I'm inclined to believe them. ... All this and all I wanted was some debug symbols! :o

[edit] WHY AM I STILL DOING THIS

Throwing

check_winsdk_root_dir("C:\\\\Program Files (x86)\\\\Windows Kits\\\\10\\\\Lib\\\\10.0.18362.0\\\\um\\\\x64")
 // my install directory (note the build number will be different for anyone reading this days later)

at the end of this set of lines in FindDirectX.cmake

check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v7.0;InstallationFolder]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v7.0A;InstallationFolder]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v7.1;InstallationFolder]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v7.1A;InstallationFolder]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\DirectX SDK\\\\Installed Roots;KitsRoot]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\DirectX SDK\\\\]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows Kits\\\\Installed Roots;KitsRoot]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows Kits\\\\Installed Roots;KitsRoot81]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows Kits\\\\Installed Roots;KitsRoot10]")
check_winsdk_root_dir("[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows Kits\\\\10\\\\Installed Roots;KitsRoot]")
// then add it here

Basically, I just gave it the exact directory. But I know there's a way to do some sort of regex/template substitution for the build number as this one here:

https://gist.github.com/billyquith/3a509315722fc822c8e904bc903364b8

Uses asterisks and some sort of file globbing rules.

Anyhow, I got it to spit out a MSVC project file (minus all my other missing dependencies like OpenAL/OGG/etc) which succeeded in compiling in MSVC. That's a good stopping point for now.

I'll look into making a proper solution for cmake and submit a pull request tomorrow. Also gonna build full allegro and try to debug joysticks.

GullRaDriel

I awakened the great Christ Katko. I'm happy ;D

Peter Hull

I awakened the great Christ Katko.

He's not the messiah, he's a very naughty boy!

I've not done one of those "no sleep until this is sorted out" for years, but it sounds like you're making progress.

Still weird though, I downloaded a new allegro 5.2.6 zip and I still didn't see any errors. I got my Windows SDK from the Visual Studio Installer, is that what you did in the end?

I tried it two ways, first by opening the directory in the VS IDE, then using the built-in CMake support to open CMakeLists.txt, second by running cmake in the shell and building the generated project with MSBuild. Both were OK.

If I had to guess, it looks like your SDK installation has not put the correct entries in the registry so that FindDirectX.cmake can find it. But I don't know what the entries should be (I will check my installation when I get time)

[edit]
Interesting, my system doesn't have any of the registry keys mentioned in FindDirectX.cmake
It does have the equivalent of [HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows Kits\\\\Installed Roots;KitsRoot10] though. That points to C:\Program Files (x86)\Windows Kits\10\.
The DirectX libs are found in, for example, C:/Program Files (x86)/Windows Kits/10/Lib/10.0.17763.0/um/x64/dinput8.lib

Also (this may be where it actually gets the locations from) because I am using the "x64 Native Command Tools Prompt" from VS, the following environment variables are defined:

WindowsLibPath=C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17763.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0
WindowsSdkBinPath=C:\Program Files (x86)\Windows Kits\10\bin\
WindowsSdkDir=C:\Program Files (x86)\Windows Kits\10\
WindowsSDKLibVersion=10.0.17763.0\
WindowsSdkVerBinPath=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\
WindowsSDKVersion=10.0.17763.0\
WindowsSDK_ExecutablePath_x64=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\
WindowsSDK_ExecutablePath_x86=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\

So (if you didn't already) can you try running cmake from one of those Command Tools prompts?
In any case, seems like FindDirectX.cmake needs a little maintenance.

GullRaDriel

@Peter and who said I worship the good ? ;-p

Chris Katko

This is so stupid. I can't get allegro 5 cmake to detect other installed dependencies, so I compile with just the gfx and input. So I have to use a local compiled allegro instead of installing it to my normal DLL folder (since it's a half empty Allegro). Too bad MSVC can't find it. And I setup C++ and linker folders. Nope. So I copy all that crap to the root folder of the project (not the EXE which would actually make sense). Except it can only find allegro.h, not all the allegro includes in the same folder.

You want me to debug this crap, release a debug nuget package. ::)

Edgar Reynaldo

Chris - instead of struggling with garbage like VS, why don't you just use MinGW-W64 and CB? 3 downloads and you would have been up and running already. Just sayin.

Chris Katko


instead of struggling with garbage like [the one of the most popular, supported compilers in the world]

really??? ::)

Edgar Reynaldo

Yes. Really.

VS is a heaping pile of garbage. Sure it's a great compiler if you can figure out how it works from the command line, but VS "Solutions" and "Projects" and the whole IDE is just shite.

We shouldn't derail this further though, but you could have been debugging the first day if you had used CB and my binaries.

Chris Katko

I have no words.

Peter Hull

Tryin' to stay positive :)

I wrote down what I did, maybe Chris if you have a look you will see if there's a difference between your setup and mine.

https://gist.github.com/pedro-w/83372cf27c0a09ab289d3ab3590806fb

Rodolfo Lam

Try using VCPKG to build and use Allegro on Visual Studio

Edgar Reynaldo

I have no words.

I believe your words were...

[edit] WHY AM I STILL DOING THIS

8-)

Tell you what Chris Katko. I'll make you lib files from latest git, with all the dependencies.

Guess what, I'll make it super simple for you. You can use my binaries, and use MSVC. Happy now? Just run the included dllfolder2lib.bat file on the command line. Read it first so you know what it does. It has to be run from a VS prompt so take note.

https://github.com/EdgarReynaldo/EagleGUI/releases/tag/0pt8pt1

;D

Peter Hull

Just to recap, Andrew Gillett is on the verge of releasing a game, and is having trouble with Allegro. Chris has made a sincere offer to help with debugging.

So, pissing contests about whose compiler is better ARE NOT HELPFUL. More practically, precompiled symbol databases (whether downloaded from vcpkg or no) are not helpful because they become invalid as soon as any changes are made.

I think it would be great if we could work together and fix this.

Peter

Andrew Gillett

Sorry, I didn't see the recent posts on this thread until now. Steam are currently in the process of adding support for 5+ XInput controllers to their Steam Input API. I understand they're writing a custom driver for this, which will be an optional install for users. So I've scheduled my game's release for the end of the month, on the understanding that the update should be ready by then.

Regarding the issue with two DirectInput controllers becoming entangled with each other, I posted some logs to the mailing list earlier in the month, although I couldn't see a cause within the logs. I have attached the emails to this post.

You can watch my game's trailer and wishlist it here!
https://store.steampowered.com/app/1068720/Partition_Sector/

EDIT
"First it would be handy to know what exact version of Allegro you have because the line numbers in your debug output don't match up to the 5.2.6 code."
I am using a custom build. My main branch is https://github.com/arganoid/allegro5/tree/psector and the DirectInput debugging branch is https://github.com/arganoid/allegro5/tree/psectorDInputDebug

Edgar Reynaldo

Let's be realistic here. He could have easily recompiled allegro using my custom dependencies. It's liballeg's fault there is no debugging nuget package. VS is notoriously hard to configure for beginners, mingw is a tiny download compared to VS, CB code completion competes with VS IntelliSense. VS UX is trash and so is their UI. It's entirely too convoluted compared to CB to be of any use to me. CB has integration with the GDB debugger. It works fine. Not to mention compiling the dependencies for VS is dubious at best, and not all deps provide cmake scripts, some only provide MSYS, or *NIX, so you have to use auto tools, and auto tools and VS don't work together.

The whole point is, Chris could have been debugging this a week ago. I only have one joystick, so, too bad.

I offered up my help, but if you think I'm here to compete for biggest dick then you're wrong.
:(

Peter Hull

I looked back at my previous posts. I got annoyed, and that wasn't helpful either. A friendly apology to anyone offended, please can we move on?

On the logging data, I am interested in this chunk (edited to simplify)

(PRESSED BUTTON ON ONE CONTROLLER - handle_button_event CALLED FOR BOTH)

[  27.00212] joydx_thread_proc, waker_num = 1, waker handle = 77c
[  27.00230] update 1
[  27.00237] update_joystick 3f0d2748
[  27.00245] handle_button_event 3f0d2748, 0
[  27.00254] joydx_thread_proc, waker_num = 0, waker handle = 6cc
[  27.00264] update 0
[  27.00279] update_joystick 3f0d1fa0
[  27.00286] handle_button_event 3f0d1fa0, 0

In the joystick thread we have an array of event objects, one per joystick, which we're waiting on for events. (here)
Using WaitForMultipleObjects it should return the first (i.e. lowest index) event that was signalled, and, if there is more than one signalled, our code should loop round quickly and pick off each one successively.

Given that, it seems strange that, in the log, we're getting waker_num = 1 and then straight after, waker_num = 0. If joystick 0 had an event, that should have been picked first. I can't figure out why this is.

Andrew, you said (I think) if all joysticks were ready plugged in when the program starts, everything works OK. Can you post the log for that case?

William Labbett

I can't compile allegro and I wouldn't understand the code much. Good luck guys.
Peace.

Edgar Reynaldo

Peter, there is a one second delay between device scans for new joysticks. Perhaps that is leading to a race condition?

EDIT
Welp. I'm not sure. From the logs Andrew posted, two joysticks are already connected correctly. But pressing a button on one of them causes two joystick button events. Same with release.

Andrew, how are you connecting your joysticks? USB Hub? XBox radio set? Have you tried updating your drivers?

Peter Hull

Peter, there is a one second delay between device scans for new joysticks. Perhaps that is leading to a race condition?

Right, windows sends a WM_DEVICECHANGE but this only sets a flag on the Allegro side here. It is the joystick thread that does the enumeration and this happens at most 1 second later, when WaitForMultipleObjects times out, or maybe earlier if an event from another joystick comes along. Do you agree?
So there may be a race if a joystick is added or removed during an enumeration caused by another event ... maybe ... it makes my head spin.

As I mentioned, the fact that one button press is causing two different event objects to fire is puzzling, especially as they're in the 'wrong' order. Possibly we've set up DirectInput wrong. It would be useful to get a few more data points on the conditions for which it works or doesn't work. For example, does the order matter? Is it 100% repeatable? Is it specific devices or any device? Does it do the same on a different PC?

Edgar Reynaldo

Andrew - when you receive an ALLEGRO_EVENT_JOYSTICK_CONFIGURATION upon a hotplug, do you also call al_reconfigure_joysticks to acknowledge it?

Andrew Gillett

Sorry, again I didn't get an email notification about the new posts. I always call al_reconfigure_joysticks after receiving ALLEGRO_EVENT_JOYSTICK_CONFIGURATION.

I haven't looked at this issue for a while, but as I recall it was always fine if both controllers were connected simultaneously (or already connected on startup). If the two controllers were connected several seconds apart, the problem would occur, regardless of which was connected first. I don't remember if one of the two controllers would consistently steal the input of the other, or if it was sometimes the other way around.

The controllers were usually both connected through a hub, although I don't think it made a difference if they were connected to other ports.

The situation regarding my game has changed, in that the Steam Input fix for 5+ XInput controller is now not due until January. So what I'm currently trying to do is getting it to work with DirectInput, while hoping the bug under discussion is a freak event which is just specific to one type of 3rd party Xbox controller. The next problem is that, running in DirectInput mode, my game does not see remote controllers connected through Remote Play Together. Steam have sent me some guidance on this - they said their software sends the game a WM_INPUT_DEVICE_CHANGE message when a remote controller is connected. I added a check for that alongside the WM_DEVICECHANGE check, but the message never seems to be received. The other thing they told me to try is to periodically rescan controllers regardless of any messages receieved. When I did that, the first time the game completely froze the host's PC (no idea if this is an Allegro or Steam issue), the second time it didn't crash and I saw stuff like this in the log:

dinput   D         wjoydxnu.cpp:1078 joydx_scan                       [ 152.06037] 
dinput   D         wjoydxnu.cpp:1085 joydx_scan                       [ 152.06047] Calling IDirectInput8_EnumDevices
dinput   D         wjoydxnu.cpp:827  joystick_enum_callback           [ 152.06050] joystick_enum_callback
dinput   D         wjoydxnu.cpp:967  joystick_enum_callback           [ 152.06059] waker_event: 560
dinput   E         wjoydxnu.cpp:975  joystick_enum_callback           [ 152.06062] SetEventNotification failed for joystick 0: unknown error
dinput   D         wjoydxnu.cpp:1095 joydx_scan                       [ 152.43871] Completed IDirectInput8_EnumDevices
dinput   D         wjoydxnu.cpp:1078 joydx_scan                       [ 153.43842] 
dinput   D         wjoydxnu.cpp:1085 joydx_scan                       [ 153.43850] Calling IDirectInput8_EnumDevices
dinput   D         wjoydxnu.cpp:827  joystick_enum_callback           [ 153.43854] joystick_enum_callback
dinput   D         wjoydxnu.cpp:967  joystick_enum_callback           [ 153.43862] waker_event: 544
dinput   E         wjoydxnu.cpp:975  joystick_enum_callback           [ 153.43864] SetEventNotification failed for joystick 0: unknown error
dinput   D         wjoydxnu.cpp:1095 joydx_scan                       [ 153.60105] Completed IDirectInput8_EnumDevices
dinput   D         wjoydxnu.cpp:1078 joydx_scan                       [ 154.60045] 
dinput   D         wjoydxnu.cpp:1085 joydx_scan                       [ 154.60054] Calling IDirectInput8_EnumDevices
dinput   D         wjoydxnu.cpp:827  joystick_enum_callback           [ 154.60057] joystick_enum_callback
dinput   D         wjoydxnu.cpp:967  joystick_enum_callback           [ 154.60065] waker_event: 568
dinput   E         wjoydxnu.cpp:975  joystick_enum_callback           [ 154.60068] SetEventNotification failed for joystick 0: unknown error
dinput   D         wjoydxnu.cpp:1095 joydx_scan                       [ 154.66114] Completed IDirectInput8_EnumDevices

I will message Steam about the SetEventNotification failure, but is looks unlikely it will be possible to fix this within the next 24 hours which is what would be necessary to release on time. So I expect to have to wait for Steam to fix the issues with Steam Input, and my game will be delayed by several weeks. This isn't a disaster for me, especially as I don't expect the game to sell many copies either way.

UPDATE

I got the following response from Steam:

Quote:

The overlay will only generate WM_INPUT and WM_INPUT_DEVICE_CHANGED callbacks when you've called RegisterRawInputDevices.

It doesn't look like we implement the IDirectInputDevice8_SetEventNotification function in the overlay. I believe you'd have to either poll the device state or key off of WM_INPUT messages instead.

I added a call to RegisterRawInputDevices - wasn't sure where to put it, so I put it in _al_win_init_window. I used the code from Example 1 here https://docs.microsoft.com/en-us/windows/win32/inputdev/using-raw-input - but without including the second two device categories and using RIDEV_DEVNOTIFY as the flags. I then hacked joystick_enum_callback to assume that a device which triggers "unknown error" from IDirectInputDevice8_SetEventNotification is a Steam emulated controller, and therefore set it to act as a polled device. This probably isn't a very safe assumption but I wanted to see if this would allow it to work. What I found is that Remote Play Together can now see XBox 360 controllers, but not 3rd party DirectInput controllers. And I found that not all of the connected XBox 360 controllers actually worked, ie the game did not receive their control inputs.

Edgar Reynaldo

That's progress at least. Bump for more.

Andrew Gillett

The Steam client beta now has an option (Xbox Extended Feature Support) to install a driver which provides support for 5+ XInput controllers. There are still some teething problems but it generally seems to work for me. It's not clear when it will come out of beta, but my game will be releasing on Jan 29 regardless. One of the nice things about using the Steam Input API is that it supports PS3/4 and Switch Pro controllers. So people doing games to be released on Steam should certainly consider it.

My game's store page:
https://store.steampowered.com/app/1068720/Partition_Sector/

Peter Hull

Any more updates on this?

Andrew Gillett

The game is out now. Steam Input support for 5+ XInput controllers remains in beta. Steam uses SDL, there is a discussion on the issue here although it is quite old so may not be fully up-to-date.
https://discourse.libsdl.org/t/supporting-more-than-4-xinput-capable-devices-on-windows-rfc/25666/13

Thread #618290. Printed from Allegro.cc