mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 11:45:18 +02:00
Windows: Check for devices on Windows events only.
A user reported stuttering after the periodic checks, and devices failing until unplug/replug. Presumably, this is caused by poor drivers reacting badly to periodic DirectInput queries, so less queries should help.
This commit is contained in:
committed by
Henrik Rydgård
parent
fdb07323e0
commit
c9aa039695
@@ -39,6 +39,7 @@
|
||||
unsigned int DinputDevice::pInstances = 0;
|
||||
LPDIRECTINPUT8 DinputDevice::pDI = NULL;
|
||||
std::vector<DIDEVICEINSTANCE> DinputDevice::devices;
|
||||
bool DinputDevice::needsCheck_ = true;
|
||||
|
||||
// In order from 0. There can be 128, but most controllers do not have that many.
|
||||
static const int dinput_buttons[] = {
|
||||
@@ -120,7 +121,7 @@ BOOL CALLBACK DinputDevice::DevicesCallback(
|
||||
|
||||
void DinputDevice::getDevices(bool refresh)
|
||||
{
|
||||
if (devices.empty() || refresh)
|
||||
if (refresh)
|
||||
{
|
||||
getPDI()->EnumDevices(DI8DEVCLASS_GAMECTRL, &DinputDevice::DevicesCallback, NULL, DIEDFL_ATTACHEDONLY);
|
||||
}
|
||||
@@ -368,6 +369,7 @@ void DinputDevice::ApplyButtons(DIJOYSTATE2 &state) {
|
||||
|
||||
size_t DinputDevice::getNumPads()
|
||||
{
|
||||
getDevices(true);
|
||||
getDevices(needsCheck_);
|
||||
needsCheck_ = false;
|
||||
return devices.size();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user