Skip to content

Commit

Permalink
led effects: added target device calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Nov 11, 2023
1 parent 4e99fdf commit dbe08f0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ResX = 0
ResY = 0
ForceLL = 1 // Fixes startup crash, same thing as -ll shortcut switch.
SingleCoreAffinity = 1 // Experimental, attempt to avoid mid-loading hang.
SingleCoreAffinity = 0 // Experimental, attempt to avoid mid-loading hang.

[GRAPHICS]
;ShadowMapResolution = 2048 // Do not use, causes bugs. Default is 1024, max is 8192
Expand Down
21 changes: 21 additions & 0 deletions includes/LED/LEDEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ class LEDEffects

static inline void SetLightingLeftSide(int redPercentage, int greenPercentage, int bluePercentage, bool ignoreCardiogram = false, bool ignoreCardiogramDead = false, bool ignoreFSide = false)
{
LogiLedSetTargetDevice(LOGI_DEVICETYPE_PERKEY_RGB);
for (auto key : leftSide)
{
if (ignoreCardiogram && std::any_of(std::begin(keysCardiogram), std::end(keysCardiogram), [key](auto i) { return i == key; }))
Expand All @@ -367,10 +368,15 @@ class LEDEffects

LogiLedSetLightingForKeyWithKeyName(key, redPercentage, greenPercentage, bluePercentage);
}

LogiLedSetTargetDevice(LOGI_DEVICETYPE_RGB);
LogiLedSetLighting(redPercentage, greenPercentage, bluePercentage);
LogiLedSetTargetDevice(LOGI_DEVICETYPE_ALL);
}

static inline void SetLightingRightSide(int redPercentage, int greenPercentage, int bluePercentage, bool ignoreCardiogram = false, bool ignoreCardiogramDead = false, bool ignoreFSide = false)
{
LogiLedSetTargetDevice(LOGI_DEVICETYPE_PERKEY_RGB);
for (auto key : rightSide)
{
if (ignoreCardiogram && std::any_of(std::begin(keysCardiogramNumpad), std::end(keysCardiogramNumpad), [key](auto i) { return i == key; }))
Expand All @@ -384,10 +390,15 @@ class LEDEffects

LogiLedSetLightingForKeyWithKeyName(key, redPercentage, greenPercentage, bluePercentage);
}

LogiLedSetTargetDevice(LOGI_DEVICETYPE_RGB);
LogiLedSetLighting(redPercentage, greenPercentage, bluePercentage);
LogiLedSetTargetDevice(LOGI_DEVICETYPE_ALL);
}

static inline void SetLighting(int redPercentage, int greenPercentage, int bluePercentage, bool ignoreCardiogram = false, bool ignoreCardiogramDead = false, bool ignoreFSide = false)
{
LogiLedSetTargetDevice(LOGI_DEVICETYPE_PERKEY_RGB);
SetLightingLeftSide(redPercentage, greenPercentage, bluePercentage, ignoreCardiogram, ignoreCardiogramDead, ignoreFSide);
for (auto key : rightSide)
{
Expand All @@ -396,10 +407,15 @@ class LEDEffects

LogiLedSetLightingForKeyWithKeyName(key, redPercentage, greenPercentage, bluePercentage);
}

LogiLedSetTargetDevice(LOGI_DEVICETYPE_RGB);
LogiLedSetLighting(redPercentage, greenPercentage, bluePercentage);
LogiLedSetTargetDevice(LOGI_DEVICETYPE_ALL);
}

static inline void DrawCardiogram(int startRedPercentage, int startGreenPercentage, int startBluePercentage, int finishRedPercentage, int finishGreenPercentage, int finishBluePercentage, bool dead = false)
{
LogiLedSetTargetDevice(LOGI_DEVICETYPE_PERKEY_RGB);
auto& arr = dead ? keysCardiogramDead : keysCardiogram;
static auto TIMERA = Timer();
static auto counter = 0;
Expand All @@ -413,10 +429,12 @@ class LEDEffects
counter++;
TIMERA.reset();
}
LogiLedSetTargetDevice(LOGI_DEVICETYPE_ALL);
}

static inline void DrawCardiogramNumpad(int startRedPercentage, int startGreenPercentage, int startBluePercentage, int finishRedPercentage, int finishGreenPercentage, int finishBluePercentage, bool dead = false)
{
LogiLedSetTargetDevice(LOGI_DEVICETYPE_PERKEY_RGB);
auto& arr = dead ? keysCardiogramNumpadDead : keysCardiogramNumpad;
static auto TIMERB = Timer();
static auto counter = 0;
Expand All @@ -430,6 +448,7 @@ class LEDEffects
counter++;
TIMERB.reset();
}
LogiLedSetTargetDevice(LOGI_DEVICETYPE_ALL);
}

static inline void DrawPoliceSirenMouse()
Expand Down Expand Up @@ -461,6 +480,7 @@ class LEDEffects

static void DrawPoliceSirenKeyboard(bool withWhiteStrip = false, int duration = 1200, bool isInfinite = true)
{
LogiLedSetTargetDevice(LOGI_DEVICETYPE_PERKEY_RGB);
static auto TIMERD = Timer();

if (TIMERD >= duration || isInfinite)
Expand Down Expand Up @@ -503,5 +523,6 @@ class LEDEffects
else
TIMERD.reset();
}
LogiLedSetTargetDevice(LOGI_DEVICETYPE_ALL);
}
};
6 changes: 4 additions & 2 deletions source/SplinterCellDoubleAgent.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ void Init()
{
static auto fPlayerVisibility = gVisibility;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
auto gVisCmp = static_cast<float>(static_cast<int>(gVisibility * 10.0f)) / 10.0f;
auto fPlVisCmp = static_cast<float>(static_cast<int>(fPlayerVisibility * 10.0f)) / 10.0f;

if (fPlayerVisibility > gVisibility)
if (fPlVisCmp > gVisCmp)
fPlayerVisibility -= 0.05f;
else if (fPlayerVisibility < gVisibility)
else if (fPlVisCmp < gVisCmp)
fPlayerVisibility += 0.05f;

fPlayerVisibility = std::clamp(fPlayerVisibility, 0.0f, 1.0f);
Expand Down

0 comments on commit dbe08f0

Please sign in to comment.