From db4f49bbbab48367a513409c16dccba790308ee4 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 31 May 2026 17:38:57 +0000 Subject: [PATCH] Implement Direct mode support for Roccat Vulcan TKL (non-Pro) --- .../RoccatVulcanKeyboardController.cpp | 26 ++++++++++++++++--- .../RoccatVulcanKeyboardController.h | 5 ++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Controllers/RoccatController/RoccatVulcanKeyboardController/RoccatVulcanKeyboardController.cpp b/Controllers/RoccatController/RoccatVulcanKeyboardController/RoccatVulcanKeyboardController.cpp index 3073fd268..576270024 100644 --- a/Controllers/RoccatController/RoccatVulcanKeyboardController/RoccatVulcanKeyboardController.cpp +++ b/Controllers/RoccatController/RoccatVulcanKeyboardController/RoccatVulcanKeyboardController.cpp @@ -86,9 +86,14 @@ device_info RoccatVulcanKeyboardController::InitDeviceInfo() buf[0] = report_id; hid_get_feature_report(dev_ctrl, buf, packet_length); - char version[5]; - snprintf(version, 5, "%d.%02d", buf[2] / 100, buf[2] % 100); + /*-------------------------------------------------------------*\ + | buf[2] is version e.g. 103 means v1.03 | + \*-------------------------------------------------------------*/ + dev_info.version_major = buf[2] / 100; + dev_info.version_minor = buf[2] % 100; + char version[5]; + snprintf(version, 5, "%d.%02d", dev_info.version_major, dev_info.version_minor); dev_info.version = version; if(device_pid == ROCCAT_MAGMA_PID || device_pid == ROCCAT_MAGMA_MINI_PID) @@ -116,6 +121,11 @@ device_info RoccatVulcanKeyboardController::GetDeviceInfo() return dev_info; } +bool RoccatVulcanKeyboardController::IsBigEndianDirectMode() +{ + return (dev_info.version_major >= 1 && dev_info.version_minor >= 16); +} + void RoccatVulcanKeyboardController::EnableDirect(bool on_off_switch) { uint8_t* buf; @@ -218,8 +228,16 @@ void RoccatVulcanKeyboardController::SendColors(std::vector colors) } else { - bufs[0][3] = packet_length & 0xFF; - bufs[0][4] = (packet_length >> 8) & 0xFF; + if(IsBigEndianDirectMode()) + { + bufs[0][3] = (packet_length >> 8) & 0xFF; + bufs[0][4] = packet_length & 0xFF; + } + else + { + bufs[0][3] = packet_length & 0xFF; + bufs[0][4] = (packet_length >> 8) & 0xFF; + } } unsigned int data_length_packet = 64 - header_length_first; diff --git a/Controllers/RoccatController/RoccatVulcanKeyboardController/RoccatVulcanKeyboardController.h b/Controllers/RoccatController/RoccatVulcanKeyboardController/RoccatVulcanKeyboardController.h index 485030e0e..a27135a0c 100644 --- a/Controllers/RoccatController/RoccatVulcanKeyboardController/RoccatVulcanKeyboardController.h +++ b/Controllers/RoccatController/RoccatVulcanKeyboardController/RoccatVulcanKeyboardController.h @@ -61,6 +61,8 @@ enum struct device_info { std::string version; + int version_major; + int version_minor; int layout_type; }; @@ -89,6 +91,7 @@ public: void AwaitResponse(int ms); void ClearResponses(); + uint16_t device_pid; private: @@ -97,4 +100,6 @@ private: device_info dev_info; std::string location; std::string name; + + bool IsBigEndianDirectMode(); };