microsoft / Xbox-GDK-Samples

Game development samples published by the Xbox Advanced Technology Group using the Microsoft GDK.
http://aka.ms/gamedevdocs
MIT License
218 stars 32 forks source link

[Sample - Gamepad] m_reading->GetGamepadState always returns empty state #26

Closed luqiming666 closed 1 year ago

luqiming666 commented 1 year ago

I was running the sample project: Samples\System\Gamepad. It didn't work as expected. I'm sure I've connected a Xbox Series X/S console to my Win11 PC, and "GameInput Service" is running.

But no matter which key I press on the gamepad, m_reading->GetGamepadState always returns empty state and state.buttons equals to 0 all the time. A bit weird... Any clue?

BrianPeek commented 1 year ago

Nothing comes to mind...the sample is running here for me on Win11 with an Xbox controller. What version of GameInputRedist.dll is installed? You'll find this in \windows\system32. How was GameInput installed, from the GDK or some other way? What version of the GDK are you building against? Any failure HRESULTs coming back from any of the APIs like GameInputCreate or GetCurrentReading?

luqiming666 commented 1 year ago

I installed GDK-October_2022_Update_2.

GameInputRedist.dll,File version 0.2210.22621.1863 (Code signature 2022/11/11) GameInput.dll,File version 0.2204.22621.1265 (Code signature 2023/1/31)

GameInputCreate and GetCurrentReading are both successful. Actually I didn't see any HRESULT failures.

BTW, I tested XInput Sample: RumbleController. It works perfectly well on the same PC.

BrianPeek commented 1 year ago

Those look correct. Are you connecting over USB or Bluetooth?

luqiming666 commented 1 year ago

Those look correct. Are you connecting over USB or Bluetooth?

Bluetooth. Is there any debugging mechnism we can use to figure out the problem? I can capture necessary logs and hand over to you.

BrianPeek commented 1 year ago

Unfortunately, GameInput currently does not support an Xbox One/Series controller connected via Bluetooth on PC. It will only work when connected via USB. There is a known issue and will be rectified in a future version of GameInput. For now, you will need to connect your controller via USB for it to function on PC with GameInput.

luqiming666 commented 1 year ago

Thank you for your quick reply. Look forward to the GameInput update...

uhdcc commented 1 year ago

if anybody comes across this problem, you have to call Release() on the reading at some point, otherwise it stops reading.

like this:

m_reading->GetGamepadState(&state)

m_reading->Release();

mennovu commented 9 months ago

Ran into this as well. Still not fixed as of this moment.