Publish LumaOps source

This commit is contained in:
LumaOps release export
2026-09-03 01:18:36 +02:00
commit 7f1c0e5f71
2363 changed files with 501543 additions and 0 deletions
@@ -0,0 +1,187 @@
/*---------------------------------------------------------*\
| RGBController_RoccatBurst.cpp |
| |
| RGBController for Roccat Burst |
| |
| Morgan Guimard (morg) 01 Jun 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_RoccatBurst.h"
/**------------------------------------------------------------------*\
@name Roccat Burst Mouse
@category Mouse
@type USB
@save :robot:
@direct :white_check_mark:
@effects :white_check_mark:
@detectors DetectRoccatBurstCoreControllers,DetectRoccatBurstProControllers
@comment
\*-------------------------------------------------------------------*/
RGBController_RoccatBurst::RGBController_RoccatBurst(RoccatBurstController* controller_ptr, unsigned int leds_count):
leds_count(leds_count)
{
controller = controller_ptr;
name = controller->GetNameString();
vendor = "Roccat";
type = DEVICE_TYPE_MOUSE;
description = "Roccat Burst Mouse Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = ROCCAT_BURST_DIRECT_MODE_VALUE;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = ROCCAT_BURST_STATIC_MODE_VALUE;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.brightness = ROCCAT_BURST_BRIGHTNESS_MAX;
Static.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN;
Static.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX;
Static.colors.resize(leds_count);
modes.push_back(Static);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = ROCCAT_BURST_WAVE_MODE_VALUE;
Rainbow.flags = MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.brightness = ROCCAT_BURST_BRIGHTNESS_MAX;
Rainbow.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN;
Rainbow.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX;
Rainbow.speed = ROCCAT_BURST_SPEED_MIN;
Rainbow.speed_min = ROCCAT_BURST_SPEED_MIN;
Rainbow.speed_max = ROCCAT_BURST_SPEED_MAX;
modes.push_back(Rainbow);
mode HeartBeat;
HeartBeat.name = "HeartBeat";
HeartBeat.value = ROCCAT_BURST_HEARTBEAT_MODE_VALUE;
HeartBeat.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
HeartBeat.color_mode = MODE_COLORS_MODE_SPECIFIC;
HeartBeat.brightness = ROCCAT_BURST_BRIGHTNESS_MAX;
HeartBeat.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN;
HeartBeat.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX;
HeartBeat.speed = ROCCAT_BURST_SPEED_MIN;
HeartBeat.speed_min = ROCCAT_BURST_SPEED_MIN;
HeartBeat.speed_max = ROCCAT_BURST_SPEED_MAX;
HeartBeat.colors.resize(leds_count);
modes.push_back(HeartBeat);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = ROCCAT_BURST_BREATHING_MODE_VALUE;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.brightness = ROCCAT_BURST_BRIGHTNESS_MAX;
Breathing.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN;
Breathing.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX;
Breathing.speed = ROCCAT_BURST_SPEED_MIN;
Breathing.speed_min = ROCCAT_BURST_SPEED_MIN;
Breathing.speed_max = ROCCAT_BURST_SPEED_MAX;
Breathing.colors.resize(leds_count);
modes.push_back(Breathing);
mode Blinking;
Blinking.name = "Blinking";
Blinking.value = ROCCAT_BURST_BLINKING_MODE_VALUE;
Blinking.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC;
Blinking.brightness = ROCCAT_BURST_BRIGHTNESS_MAX;
Blinking.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN;
Blinking.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX;
Blinking.speed = ROCCAT_BURST_SPEED_MIN;
Blinking.speed_min = ROCCAT_BURST_SPEED_MIN;
Blinking.speed_max = ROCCAT_BURST_SPEED_MAX;
Blinking.colors.resize(leds_count);
modes.push_back(Blinking);
SetupZones();
}
RGBController_RoccatBurst::~RGBController_RoccatBurst()
{
delete controller;
}
void RGBController_RoccatBurst::SetupZones()
{
zone new_zone;
new_zone.name = "Mouse";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = leds_count;
new_zone.leds_max = leds_count;
new_zone.leds_count = leds_count;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
std::string led_names[2] =
{
"Scroll Wheel",
"Logo"
};
for(unsigned int i = 0; i < leds_count; i++)
{
led new_led;
new_led.name = led_names[i];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_RoccatBurst::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatBurst::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
}
void RGBController_RoccatBurst::UpdateZoneLEDs(int /*zone_idx*/)
{
const mode& active = modes[active_mode];
if(active.value == ROCCAT_BURST_DIRECT_MODE_VALUE)
{
controller->SendDirect(colors);
}
else
{
controller->SetMode(active.colors, active.value, active.speed, active.brightness, active.color_mode, active.flags);
}
}
void RGBController_RoccatBurst::UpdateSingleLED(int /*led_idx*/)
{
UpdateZoneLEDs(0);
}
void RGBController_RoccatBurst::DeviceUpdateMode()
{
if(modes[active_mode].value == ROCCAT_BURST_DIRECT_MODE_VALUE)
{
controller->SetupDirectMode();
}
else
{
DeviceUpdateLEDs();
}
}
@@ -0,0 +1,35 @@
/*---------------------------------------------------------*\
| RGBController_RoccatBurst.h |
| |
| RGBController for Roccat Burst |
| |
| Morgan Guimard (morg) 01 Jun 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "RoccatBurstController.h"
class RGBController_RoccatBurst : public RGBController
{
public:
RGBController_RoccatBurst(RoccatBurstController* controller_ptr, unsigned int leds_count);
~RGBController_RoccatBurst();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
RoccatBurstController* controller;
unsigned int leds_count;
};
@@ -0,0 +1,166 @@
/*---------------------------------------------------------*\
| RoccatBurstController.cpp |
| |
| Driver for Roccat Burst |
| |
| Morgan Guimard (morg) 24 Feb 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include "RoccatBurstController.h"
#include "StringUtils.h"
RoccatBurstController::RoccatBurstController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
{
dev = dev_handle;
location = info.path;
name = dev_name;
SetupDirectMode();
}
RoccatBurstController::~RoccatBurstController()
{
hid_close(dev);
}
std::string RoccatBurstController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string RoccatBurstController::GetNameString()
{
return(name);
}
std::string RoccatBurstController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
return(StringUtils::wstring_to_string(serial_string));
}
void RoccatBurstController::SetupDirectMode()
{
SwitchControl(true);
}
void RoccatBurstController::SwitchControl(bool direct)
{
unsigned char usb_buf[ROCCAT_BURST_CONTROL_MODE_PACKET_LENGTH];
usb_buf[0x00] = 0x0E;
usb_buf[0x01] = 0x06;
usb_buf[0x02] = 0x01;
usb_buf[0x03] = direct ? 0x01 : 0x00;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = 0xFF;
hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_CONTROL_MODE_PACKET_LENGTH);
}
void RoccatBurstController::SendDirect(std::vector<RGBColor> colors)
{
unsigned char usb_buf[ROCCAT_BURST_DIRECT_MODE_PACKET_LENGTH];
memset(usb_buf, 0x00, ROCCAT_BURST_DIRECT_MODE_PACKET_LENGTH);
usb_buf[0x00] = ROCCAT_BURST_DIRECT_MODE_REPORT_ID;
usb_buf[0x01] = ROCCAT_BURST_DIRECT_MODE_BYTE;
for(unsigned int i = 0; i < colors.size(); i++)
{
usb_buf[0x02 + 3 * i] = RGBGetRValue(colors[i]);
usb_buf[0x03 + 3 * i] = RGBGetGValue(colors[i]);
usb_buf[0x04 + 3 * i] = RGBGetBValue(colors[i]);
}
hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_DIRECT_MODE_PACKET_LENGTH);
}
void RoccatBurstController::SetMode(std::vector<RGBColor> colors, unsigned char mode_value, unsigned char speed, unsigned char brightness, unsigned int color_mode, unsigned int mode_flags)
{
/*---------------------------------------------------------*\
| 1. Read from flash |
\*---------------------------------------------------------*/
unsigned char usb_buf[ROCCAT_BURST_FLASH_PACKET_LENGTH];
memset(usb_buf, 0x00, ROCCAT_BURST_FLASH_PACKET_LENGTH);
usb_buf[0x00] = 0x06;
hid_get_feature_report(dev, usb_buf, ROCCAT_BURST_FLASH_PACKET_LENGTH);
/*---------------------------------------------------------*\
| 2. Update needed bytes |
\*---------------------------------------------------------*/
usb_buf[0x01] = 0x3F;
usb_buf[0x03] = 0x06;
usb_buf[0x04] = 0x06;
usb_buf[0x05] = 0x1F;
usb_buf[30] = mode_value;
usb_buf[31] = mode_flags & MODE_FLAG_HAS_SPEED ? speed : 0xFF;
usb_buf[32] = brightness;
usb_buf[34] = 0xFF;
if(color_mode & MODE_COLORS_MODE_SPECIFIC)
{
usb_buf[36] = 0x14;
usb_buf[37] = 0xFF;
for(unsigned int i = 0; i < colors.size(); i++)
{
usb_buf[38 + 10 * i] = RGBGetRValue(colors[i]);
usb_buf[39 + 10 * i] = RGBGetGValue(colors[i]);
usb_buf[40 + 10 * i] = RGBGetBValue(colors[i]);
}
}
else if (color_mode & MODE_COLORS_NONE)
{
for(unsigned int i = 0; i < colors.size(); i++)
{
usb_buf[38 + 10 * i] = 0xF4;
usb_buf[39 + 10 * i] = 0x00;
usb_buf[40 + 10 * i] = 0x00;
}
}
unsigned int crc = CalculateCRC(&usb_buf[0]);
usb_buf[61] = (unsigned char) crc;
usb_buf[62] = crc >> 8;
/*---------------------------------------------------------*\
| 3. Send to flash |
\*---------------------------------------------------------*/
hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_FLASH_PACKET_LENGTH);
std::this_thread::sleep_for(std::chrono::milliseconds(10));
/*---------------------------------------------------------*\
| 4. Switch to built-in mode |
\*---------------------------------------------------------*/
SwitchControl(false);
}
unsigned int RoccatBurstController::CalculateCRC(unsigned char* bytes)
{
unsigned int crc = 0;
for(unsigned int i = 0; i < ROCCAT_BURST_FLASH_PACKET_LENGTH - 2; i++)
{
crc += bytes[i];
}
return crc;
}
@@ -0,0 +1,70 @@
/*---------------------------------------------------------*\
| RoccatBurstController.h |
| |
| Driver for Roccat Burst |
| |
| Morgan Guimard (morg) 01 Jun 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include <hidapi.h>
#define ROCCAT_BURST_CONTROL_MODE_PACKET_LENGTH 6
#define ROCCAT_BURST_DIRECT_MODE_PACKET_LENGTH 11
#define ROCCAT_BURST_FLASH_PACKET_LENGTH 63
#define ROCCAT_BURST_FLASH_REPORT_ID 0x06
#define ROCCAT_BURST_DIRECT_MODE_REPORT_ID 0x0D
#define ROCCAT_BURST_DIRECT_MODE_BYTE 0x0B
#define ROCCAT_BURST_CORE_NUMBER_OF_LEDS 1
#define ROCCAT_BURST_PRO_NUMBER_OF_LEDS 2
enum
{
ROCCAT_BURST_DIRECT_MODE_VALUE = 0x00,
ROCCAT_BURST_STATIC_MODE_VALUE = 0x01,
ROCCAT_BURST_WAVE_MODE_VALUE = 0x0A,
ROCCAT_BURST_HEARTBEAT_MODE_VALUE = 0x04,
ROCCAT_BURST_BREATHING_MODE_VALUE = 0x03,
ROCCAT_BURST_BLINKING_MODE_VALUE = 0x02
};
enum
{
ROCCAT_BURST_SPEED_MIN = 0x01,
ROCCAT_BURST_SPEED_MAX = 0x0B,
ROCCAT_BURST_BRIGHTNESS_MIN = 0x00,
ROCCAT_BURST_BRIGHTNESS_MAX = 0xFF
};
class RoccatBurstController
{
public:
RoccatBurstController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~RoccatBurstController();
std::string GetDeviceLocation();
std::string GetNameString();
std::string GetSerialString();
void SetupDirectMode();
void SendDirect(std::vector<RGBColor> colors);
void SetMode(std::vector<RGBColor> colors,
unsigned char mode_value,
unsigned char speed,
unsigned char brightness,
unsigned int color_mode,
unsigned int mode_flags
);
private:
hid_device* dev;
std::string location;
std::string name;
unsigned int CalculateCRC(unsigned char* bytes);
void SwitchControl(bool direct);
};