Open tjhorner opened 9 years ago
Yeah i just looked into this and adapted the code. It seems that Logitech updated their SDK and made it use LogiLedSetTargetDevice instead. Rockstar had also updated GTA to use the latest SDK and now uses LogiLedSetLighting instead of setting the bitmap, i guess this is a bit less resource intense. Unfortunately now i can't see how police lights work as no other function seems to be called as LogiLedSetLighting sets the entire keyboard lighting and not individual keys
I looked even closer, and it looks like besides the RGB percentages, a special number is being sent depending on what character you are and if you're wanted or not. Here's what my code looks like for GTA, it's a bit hacky but it works:
(This is DEFINITELY not a solution, since it's GTA-only)
bool LogiLedSetLighting(int redPercentage, int greenPercentage, int bluePercentage, int specialMode)
{
CLogger::OutputLog("LogiLedSetLighting called (%i %i %i - %i)", LogLevel::Information, redPercentage, greenPercentage, bluePercentage, specialMode);
redPercentage = 255 * (redPercentage / 100);
greenPercentage = 255 * (greenPercentage / 100);
bluePercentage = 255 * (bluePercentage / 100);
for (unsigned char key = 0; key < 144; key++) {
CorsairRGB::Keyboard::SetKey((CorsairRGB::Keys)key, redPercentage, greenPercentage, bluePercentage);
}
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::backslash, redPercentage, greenPercentage, bluePercentage); // fix US layout
if (specialMode == 16776191 || specialMode == 16711936){
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f1, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f2, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f3, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f4, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f5, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f6, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f7, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f8, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f9, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f10, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f11, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f12, 0, 0, 255);
}
else if (specialMode == 16712191 || specialMode == 16775936){
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f1, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f2, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f3, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f4, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f5, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f6, 0, 0, 255);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f7, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f8, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f9, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f10, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f11, 255, 0, 0);
CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::f12, 255, 0, 0);
}
else if (specialMode == 16711939){ // online
for (unsigned char key = 0; key < 144; key++) {
CorsairRGB::Keyboard::SetKey((CorsairRGB::Keys)key, 255, 0, 0);
}
}
else if (specialMode == 16775939){ // online
for (unsigned char key = 0; key < 144; key++) {
CorsairRGB::Keyboard::SetKey((CorsairRGB::Keys)key, 0, 0, 255);
}
}
CorsairRGB::Keyboard::FlushLightBuffer();
return true;
}
It looks like in GTA V
LogiLedSetLighting
is being called, but this won't handle it.How would this work? It's not sending any specific key...
EDIT: According to the official docs,
deviceType
isn't used any more: