MCPcopy Create free account
hub / github.com/SpecialKO/SpecialK / SK_Input_GetDeviceFileAndState

Function SK_Input_GetDeviceFileAndState

src/input/hid.cpp:391–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389static concurrency::concurrent_unordered_set <HANDLE> SK_Input_DeviceFiles;
390
391std::tuple <SK_Input_DeviceFileType, void*, bool>
392SK_Input_GetDeviceFileAndState (HANDLE hFile)
393{
394 // Unnecessary for now, since we only use a single list of HID
395 // devices...
396#ifdef SK_HAS_DIFFERENT_DEVICE_CLASSES
397 // Bloom filter since most file reads -are not- for input devices
398 if ( SK_Input_DeviceFiles.find (hFile) ==
399 SK_Input_DeviceFiles.cend ( ) )
400 {
401 return
402 { SK_Input_DeviceFileType::None, nullptr, true };
403 }
404#endif
405
406 //
407 // Figure out device type
408 //
409 if ( const auto hid_iter = SK_HID_DeviceFiles.find (hFile);
410 hid_iter != SK_HID_DeviceFiles.cend ( ) )
411 {
412 auto& hid_device =
413 hid_iter->second;
414
415 if (hid_device.device_type != sk_input_dev_type::Other)
416 {
417 return
418 { SK_Input_DeviceFileType::HID, &hid_device, hid_device.isInputAllowed () };
419 }
420 }
421
422#ifdef SK_HAS_DIFFERENT_DEVICE_CLASSES
423 else if ( const auto nv_iter = SK_NVIDIA_DeviceFiles.find (hFile);
424 nv_iter != SK_NVIDIA_DeviceFiles.cend ( ) )
425 {
426 return
427 { SK_Input_DeviceFileType::NVIDIA, &nv_iter->second, true };
428 }
429#endif
430
431 return
432 { SK_Input_DeviceFileType::Invalid, nullptr, true };
433}
434
435SetupDiGetClassDevsW_pfn SK_SetupDiGetClassDevsW = nullptr;
436SetupDiGetClassDevsExW_pfn SK_SetupDiGetClassDevsExW = nullptr;

Callers 5

WriteFile_DetourFunction · 0.85
ReadFile_DetourFunction · 0.85
ReadFileEx_DetourFunction · 0.85

Calls 3

isInputAllowedMethod · 0.80
findMethod · 0.45
cendMethod · 0.45

Tested by

no test coverage detected