mirror of https://github.com/PCSX2/pcsx2.git
DInputSource: Ignore devices with no buttons
This commit is contained in:
parent
0a8f71e76e
commit
f61bb99d3a
|
@ -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<u32>(cd.axis_offsets.size()), cd.num_hats);
|
||||
|
||||
|
|
Loading…
Reference in New Issue