From 9b13ae596b73c05d4ea5976af68d00cb9a49670d Mon Sep 17 00:00:00 2001 From: Elliot Woods Date: Sun, 11 Apr 2021 22:52:20 +0900 Subject: [PATCH 1/2] Implement Touch ID and down --- .../include/DualSenseWindows/DS5State.h | 10 ++++++++++ .../src/DualSenseWindows/DS5_Input.cpp | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/VS19_Solution/DualSenseWindows/include/DualSenseWindows/DS5State.h b/VS19_Solution/DualSenseWindows/include/DualSenseWindows/DS5State.h index a26604e..375bfa9 100644 --- a/VS19_Solution/DualSenseWindows/include/DualSenseWindows/DS5State.h +++ b/VS19_Solution/DualSenseWindows/include/DualSenseWindows/DS5State.h @@ -85,6 +85,16 @@ namespace DS5W { /// Y position of finger (~ 0 - 2048) /// unsigned int y; + + /// + /// Touch is down + /// + bool down; + + /// + /// 7-bit ID for touch + /// + uint8_t id; } Touch; typedef struct _Battery { diff --git a/VS19_Solution/DualSenseWindows/src/DualSenseWindows/DS5_Input.cpp b/VS19_Solution/DualSenseWindows/src/DualSenseWindows/DS5_Input.cpp index 2ec1a51..eef4be4 100644 --- a/VS19_Solution/DualSenseWindows/src/DualSenseWindows/DS5_Input.cpp +++ b/VS19_Solution/DualSenseWindows/src/DualSenseWindows/DS5_Input.cpp @@ -62,11 +62,15 @@ void __DS5W::Input::evaluateHidInputBuffer(unsigned char* hidInBuffer, DS5W::DS5 UINT32 touchpad1Raw = *(UINT32*)(&hidInBuffer[0x20]); ptrInputState->touchPoint1.y = (touchpad1Raw & 0xFFF00000) >> 20; ptrInputState->touchPoint1.x = (touchpad1Raw & 0x000FFF00) >> 8; + ptrInputState->touchPoint1.down = (touchpad1Raw & (1 << 7)) == 0; + ptrInputState->touchPoint1.id = (touchpad1Raw & 127); // Evaluate touch state 2 UINT32 touchpad2Raw = *(UINT32*)(&hidInBuffer[0x24]); ptrInputState->touchPoint2.y = (touchpad2Raw & 0xFFF00000) >> 20; ptrInputState->touchPoint2.x = (touchpad2Raw & 0x000FFF00) >> 8; + ptrInputState->touchPoint2.down = (touchpad2Raw & (1 << 7)) == 0; + ptrInputState->touchPoint2.id = (touchpad2Raw & 127); // Evaluate headphone input ptrInputState->headPhoneConnected = hidInBuffer[0x35] & 0x01; From e4051872ab590cab7975e9d8a4a5eafb199d5ed7 Mon Sep 17 00:00:00 2001 From: Elliot Woods Date: Sun, 11 Apr 2021 22:56:41 +0900 Subject: [PATCH 2/2] for Touch ID don't use uint8_t, use unsigned char --- .../DualSenseWindows/include/DualSenseWindows/DS5State.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VS19_Solution/DualSenseWindows/include/DualSenseWindows/DS5State.h b/VS19_Solution/DualSenseWindows/include/DualSenseWindows/DS5State.h index 375bfa9..dd6a21c 100644 --- a/VS19_Solution/DualSenseWindows/include/DualSenseWindows/DS5State.h +++ b/VS19_Solution/DualSenseWindows/include/DualSenseWindows/DS5State.h @@ -94,7 +94,7 @@ namespace DS5W { /// /// 7-bit ID for touch /// - uint8_t id; + unsigned char id; } Touch; typedef struct _Battery {