MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / PollEvents

Method PollEvents

pcsx2/Input/DInputSource.cpp:252–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void DInputSource::PollEvents()
253{
254 for (size_t i = 0; i < m_controllers.size();)
255 {
256 ControllerData& cd = m_controllers[i];
257 if (cd.needs_poll)
258 cd.device->Poll();
259
260 DIJOYSTATE2 js;
261 HRESULT hr = cd.device->GetDeviceState(sizeof(js), &js);
262 if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
263 {
264 hr = cd.device->Acquire();
265 if (hr == DI_OK)
266 hr = cd.device->GetDeviceState(sizeof(js), &js);
267
268 if (hr != DI_OK)
269 {
270 InputManager::OnInputDeviceDisconnected(
271 {{.source_type = InputSourceType::DInput, .source_index = static_cast<u32>(i)}},
272 GetDeviceIdentifier(static_cast<u32>(i)));
273 m_controllers.erase(m_controllers.begin() + i);
274 continue;
275 }
276 }
277 else if (hr != DI_OK)
278 {
279 Console.Warning("GetDeviceState() failed: %08X", hr);
280 i++;
281 continue;
282 }
283
284 CheckForStateChanges(i, js);
285 i++;
286 }
287}
288
289std::vector<std::pair<std::string, std::string>> DInputSource::EnumerateDevices()
290{

Callers 1

PollSourcesMethod · 0.45

Calls 6

sizeMethod · 0.45
PollMethod · 0.45
AcquireMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
WarningMethod · 0.45

Tested by

no test coverage detected