Cxbx-reloaded: Unresponsive to controller input

Created on 29 May 2018  路  13Comments  路  Source: Cxbx-Reloaded/Cxbx-Reloaded

Somewhere in the past few days (from around 2018-05-20) a few titles stopped responding to input.

Test cases:

  • [x] Crazy Taxi 3 - High Roller
  • [x] Lensflare xdk sample
  • [ ] [Sonic Riders](https://github.com/Cxbx-Reloaded/game-compatibility/issues/451#issuecomment-392906305)
  • [x] [Star Wars: Knights of the Old Republic](https://github.com/Cxbx-Reloaded/game-compatibility/issues/428#issuecomment-392844117)
  • [x] [Star Wars Knights of the Old Republic II](https://github.com/Cxbx-Reloaded/game-compatibility/issues/96#issuecomment-392869872)

EDIT: Convert unordered list into task list for status report.

bug input needs-verification regression

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

All 13 comments

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.

  • Crazy Taxi 3 - High Roller
  • Lensflare xdk sample (Might be due to render screen wasn't update properly.)
  • Star Wars: Knights of the Old Republic
  • Star Wars Knights of the Old Republic II

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gandalfthewhite19890404 picture gandalfthewhite19890404  路  3Comments

Margen67 picture Margen67  路  3Comments

LukeUsher picture LukeUsher  路  4Comments

childishbeat picture childishbeat  路  4Comments

Kumoashi picture Kumoashi  路  3Comments