diff --git a/pcsx2/Input/DInputSource.cpp b/pcsx2/Input/DInputSource.cpp index 3e42eb98c1d38..d85c3e4743ffe 100644 --- a/pcsx2/Input/DInputSource.cpp +++ b/pcsx2/Input/DInputSource.cpp @@ -210,7 +210,11 @@ bool DInputSource::AddDevice(ControllerData& cd, const std::string& name) return false; } - cd.num_buttons = caps.dwButtons; + if (caps.dwButtons == 0) + { + Console.Error("Ignoring device '%s' because it has no buttons (%u axes, %u POVs).", name.c_str(), caps.dwAxes, caps.dwPOVs); + return false; + } static constexpr const u32 axis_offsets[] = {offsetof(DIJOYSTATE2, lX), offsetof(DIJOYSTATE2, lY), offsetof(DIJOYSTATE2, lZ), offsetof(DIJOYSTATE2, lRz), offsetof(DIJOYSTATE2, lRx), offsetof(DIJOYSTATE2, lRy), offsetof(DIJOYSTATE2, rglSlider[0]), @@ -232,8 +236,6 @@ bool DInputSource::AddDevice(ControllerData& cd, const std::string& name) cd.axis_offsets.push_back(offset); } - cd.num_hats = caps.dwPOVs; - hr = cd.device->Poll(); if (hr == DI_NOEFFECT) cd.needs_poll = false; @@ -244,6 +246,9 @@ bool DInputSource::AddDevice(ControllerData& cd, const std::string& name) if (hr != DI_OK) Console.Warning("GetDeviceState() for '%s' failed: %08X", name.c_str(), hr); + cd.num_buttons = caps.dwButtons; + cd.num_hats = caps.dwPOVs; + Console.WriteLn( "%s has %u buttons, %u axes, %u hats", name.c_str(), cd.num_buttons, static_cast(cd.axis_offsets.size()), cd.num_hats);