| 453 | }; |
| 454 | |
| 455 | input_t input() { |
| 456 | input_t result {new input_raw_t {}}; |
| 457 | auto &raw = *(input_raw_t *) result.get(); |
| 458 | |
| 459 | raw.vigem = new vigem_t {}; |
| 460 | if (raw.vigem->init()) { |
| 461 | delete raw.vigem; |
| 462 | raw.vigem = nullptr; |
| 463 | } |
| 464 | |
| 465 | // Get pointers to virtual touch/pen input functions (Win10 1809+) |
| 466 | raw.fnCreateSyntheticPointerDevice = (decltype(CreateSyntheticPointerDevice) *) GetProcAddress(GetModuleHandleA("user32.dll"), "CreateSyntheticPointerDevice"); |
| 467 | raw.fnInjectSyntheticPointerInput = (decltype(InjectSyntheticPointerInput) *) GetProcAddress(GetModuleHandleA("user32.dll"), "InjectSyntheticPointerInput"); |
| 468 | raw.fnDestroySyntheticPointerDevice = (decltype(DestroySyntheticPointerDevice) *) GetProcAddress(GetModuleHandleA("user32.dll"), "DestroySyntheticPointerDevice"); |
| 469 | |
| 470 | return result; |
| 471 | } |
| 472 | |
| 473 | /** |
| 474 | * @brief Calls SendInput() and switches input desktops if required. |