From 88a325f520051a9a057c42a8d4fc9f82ff1af9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Tue, 28 May 2019 15:34:30 +0200 Subject: [PATCH] Trying to generalize and tidy up this mess --- src/NotificationRequestPool.cpp | 6 +++--- src/NotificationRequestPool.h | 6 +++--- src/ViGEmClient.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/NotificationRequestPool.cpp b/src/NotificationRequestPool.cpp index 6bcf909..bd79adc 100644 --- a/src/NotificationRequestPool.cpp +++ b/src/NotificationRequestPool.cpp @@ -8,7 +8,7 @@ void NotificationRequestPool::strand_dispatch_worker() const NotificationRequestPool::NotificationRequestPool( PVIGEM_CLIENT client, PVIGEM_TARGET target, - PFN_VIGEM_X360_NOTIFICATION callback + FARPROC callback ) : client_(client), target_(target), @@ -44,7 +44,7 @@ NotificationRequestPool::NotificationRequestPool( request->request_async(); } -NotificationRequestPool::~NotificationRequestPool() +NotificationRequestPool::~NotificationRequestPool() noexcept(false) { for (auto& wait_handle : wait_handles_) CloseHandle(wait_handle); @@ -94,7 +94,7 @@ void NotificationRequestPool::operator()() PVIGEM_TARGET, UCHAR, UCHAR, - UCHAR)> pfn = callback_; + UCHAR)> pfn = PFN_VIGEM_X360_NOTIFICATION(callback_); // submit callback for async yet ordered invocation strand.post(boost::bind(pfn, diff --git a/src/NotificationRequestPool.h b/src/NotificationRequestPool.h index c544cb9..af0d3eb 100644 --- a/src/NotificationRequestPool.h +++ b/src/NotificationRequestPool.h @@ -17,7 +17,7 @@ class NotificationRequestPool PVIGEM_CLIENT client_; PVIGEM_TARGET target_; - PFN_VIGEM_X360_NOTIFICATION callback_; + FARPROC callback_; std::vector> requests_; std::shared_ptr thread_; @@ -35,9 +35,9 @@ public: NotificationRequestPool( PVIGEM_CLIENT client, PVIGEM_TARGET target, - PFN_VIGEM_X360_NOTIFICATION callback + FARPROC callback ); - ~NotificationRequestPool(); + ~NotificationRequestPool() noexcept(false); void operator()(); void terminate(); diff --git a/src/ViGEmClient.cpp b/src/ViGEmClient.cpp index f2a37e5..60d673e 100644 --- a/src/ViGEmClient.cpp +++ b/src/ViGEmClient.cpp @@ -500,7 +500,7 @@ VIGEM_ERROR vigem_target_x360_register_notification( target->pool = std::make_shared( vigem, target, - PFN_VIGEM_X360_NOTIFICATION(target->Notification) + reinterpret_cast(target->Notification) ); return VIGEM_ERROR_NONE;