-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- attempt to add Corsair CUE support (untested) - update .gitignore - UpdateColor(): convert COLORREF to RGB once, instead of once per API
- Loading branch information
HunterZ
committed
Nov 25, 2017
1 parent
a8cbdc9
commit b73d062
Showing
5 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
*.TMP | ||
*.VC.* | ||
*.aps | ||
*.dll | ||
*.lib | ||
*.obj | ||
*.tlog | ||
*.user | ||
.vs | ||
CUESDK* | ||
Corsair*.h | ||
Debug/ | ||
LFX2.h | ||
LogitechLEDLib.* | ||
Release/ | ||
ipch/ | ||
UniLight.exe | ||
UniLight*.zip | ||
UniLight.exe | ||
ipch/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// UniLight by HunterZ | ||
|
||
#include "CUEUtil.h" | ||
|
||
#include "CUESDK.h" | ||
|
||
#include <vector> | ||
|
||
namespace CUEUtil | ||
{ | ||
CUEUtilC::CUEUtilC() | ||
{ | ||
CorsairProtocolDetails cpd(CorsairPerformProtocolHandshake()); | ||
// bool CorsairSetLayerPriority(int priority) | ||
} | ||
|
||
CUEUtilC::~CUEUtilC() | ||
{ | ||
} | ||
|
||
bool CUEUtilC::SetCUEColor(unsigned char red, unsigned char green, unsigned char blue) | ||
{ | ||
// scoop up desired LED IDs and associated colors into a vector | ||
std::vector<CorsairLedColor> ledVector; | ||
|
||
// try adding all CorsairLedId types, since they're not in the context | ||
// of a specific device anyway | ||
for (int i(1); i < CLI_Last; ++i) | ||
{ | ||
ledVector.push_back(CorsairLedColor{ static_cast<CorsairLedId>(i), red, green, blue }); | ||
} | ||
|
||
/* | ||
// get number of Corsair devices | ||
// need to enumerate devices on every call, in case of hot swapping | ||
const int deviceCount(CorsairGetDeviceCount()); | ||
// loop over list of devices | ||
for (int i(0); i < deviceCount; ++i) | ||
{ | ||
CorsairDeviceInfo* deviceInfoPtr(CorsairGetDeviceInfo(i)); | ||
switch (deviceInfoPtr->type) | ||
{ | ||
case CDT_Unknown: | ||
// obviously this is unsupported | ||
break; | ||
case CDT_Mouse: | ||
break; | ||
case CDT_Keyboard: | ||
case CDT_MouseMat: | ||
{ | ||
// keyboards and mousemats support CorsairGetLedPositionsByDeviceIndex() | ||
CorsairLedPositions* ledPositionsPtr(CorsairGetLedPositionsByDeviceIndex(i)); | ||
for (int j(0); j < ledPositionsPtr->numberOfLed; ++j) | ||
{ | ||
ledVector.push_back(CorsairLedColor{ ledPositionsPtr->pLedPosition[j].ledId, red, green, blue }); | ||
} | ||
} | ||
break; | ||
case CDT_Headset: | ||
break; | ||
case CDT_HeadsetStand: | ||
break; | ||
} | ||
} | ||
*/ | ||
|
||
if (ledVector.empty()) return false; | ||
|
||
// don't really care if it fully succeeds, so call async with NULL | ||
return CorsairSetLedsColorsAsync(ledVector.size(), ledVector.data(), 0, 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// UniLight by HunterZ | ||
|
||
#pragma once | ||
|
||
// utilities for working with Corsair Utility Engine (CUE) API | ||
namespace CUEUtil | ||
{ | ||
class CUEUtilC | ||
{ | ||
public: | ||
|
||
explicit CUEUtilC(); | ||
|
||
virtual ~CUEUtilC(); | ||
|
||
bool SetCUEColor(unsigned char red, unsigned char green, unsigned char blue); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters