Somewhere in the past few days (from around 2018-05-20) a few titles stopped responding to input.
Test cases:
EDIT: Convert unordered list into task list for status report.
Source of cause:
https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/2b52b6f91832a26bc74afa7c394f424d2c7af632/src/CxbxKrnl/EmuXapi.cpp#L756
For some reason device info internally with variable named subType from XID_TYPE_INFORMATION could be wrong.
Value obtained from source:
https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/2b52b6f91832a26bc74afa7c394f424d2c7af632/src/CxbxKrnl/EmuXapi.h#L179
It might be possible to obtain the value directly from hardware device or some sort of switch/conversion in the official xdk.
Real sample obtain from kotor:
DeviceTable[0]->ucType = 1, ucSubType = 4
DeviceTable[0]->XppType = 0x003DEF8C (XDEVICE_TYPE_GAMEPAD)
----------------------------------------
DeviceTable[1]->ucType = 3, ucSubType = 1
DeviceTable[1]->XppType = 0x003DEFF0 (Unknown device type)
Gamepad's SubType for XAPI level is 0x01, not 0x04 by the way.
Here's controller research branch I made to investigate the source of cause with workaround fix.
I personally doubt it will fix other hardware device for xbox anyway as I am not sure which device type binds to specific subtype.
UPDATE:
Correct fixes are in master branch from pull request https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/pull/1235. This issue is resolved for both Star Wars: Knights of the Old Republic 1 & 2. Others are still remain unchange.
The subtype shall be 0x04 for gamepad.
In my previous code change I might use wrong value. It could be my fault. I am it for a meeting won鈥檛 be available for a while. If using subtype 0x04 fix the problem, that should be it.
https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/2b52b6f91832a26bc74afa7c394f424d2c7af632/src/CxbxKrnl/EmuXapi.h#L363
This subtype is correct. In fact, all of subtype list from there are correct.
The problem is strict titles are rejecting controller with SubType = 0x04 inside XInputGetCapabilities function. What it should be is SubType = 0x01.
XID_TYPE_INFORMATION struct layout appears to be wrong. Investigating the correct struct layout: Here we go. XID_TYPE_INFORMATON does NOT have a ucSubType Field. The field we thought was a subtype is actually a handle counter, to keep track of the maximum number of that device type that can be connected!
That's why it was 4
At least the LensFlare demo doesn't seem to even have XInputSetState, so #1194 probably isn't the culprit.
I changed the layout by packing XINPUT_FEEDBACK_HEADER as part of #680.
See: https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/commit/2fb4ea73de37e4c678a48ae59c52c4645e60d097
Which I suspect is the structure changed in one of the XDKs and my change doesn't consider it.
Edit: scratch this, the code has changed a lot since then
In Lensflare, XInput keyboard input is detected in XBController::ListenPoll (easily proven by putting a breakpoint below if(bKey & 0x80)) - it's just that there's no response to the input.
Currently in develop branch, these titles are responding input.
However, untested in master branch.
Base on Voxel's report input is responding from https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/pull/1244#issuecomment-394109774 for Sonic Riders.
I believe we can go ahead close this issue.
EDIT: Updated my comment
Last fix is in #1380
In my opinion, the real last fix is #1333. Since Star Wars: KotOR was reported as fix. So basically other titles should work fine as well.
Most helpful comment
XID_TYPE_INFORMATION struct layout appears to be wrong. Investigating the correct struct layout: Here we go. XID_TYPE_INFORMATON does NOT have a ucSubType Field. The field we thought was a subtype is actually a handle counter, to keep track of the maximum number of that device type that can be connected!
That's why it was 4