diff --git a/Artemis/Artemis/DeviceProviders/Logitech/LogitechKeyboard.cs b/Artemis/Artemis/DeviceProviders/Logitech/LogitechKeyboard.cs index 3fb2bfd0f..80491a1b1 100644 --- a/Artemis/Artemis/DeviceProviders/Logitech/LogitechKeyboard.cs +++ b/Artemis/Artemis/DeviceProviders/Logitech/LogitechKeyboard.cs @@ -2,7 +2,6 @@ using System.Threading; using System.Windows; using Artemis.DeviceProviders.Logitech.Utilities; -using Artemis.Utilities; using Artemis.Utilities.DataReaders; using Microsoft.Win32; @@ -14,7 +13,7 @@ namespace Artemis.DeviceProviders.Logitech { // Check to see if VC++ 2012 x64 is installed. if (Registry.LocalMachine.OpenSubKey( - @"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null) + @"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null) { CantEnableText = "Couldn't connect to your Logitech keyboard.\n" + "The Visual C++ 2012 Redistributable v11.0.61030.0 could not be found, which is required.\n" + diff --git a/Artemis/Artemis/Profiles/Lua/LuaLayerWrapper.cs b/Artemis/Artemis/Profiles/Lua/LuaLayerWrapper.cs index 0ac4cd5af..661bf928f 100644 --- a/Artemis/Artemis/Profiles/Lua/LuaLayerWrapper.cs +++ b/Artemis/Artemis/Profiles/Lua/LuaLayerWrapper.cs @@ -127,7 +127,7 @@ namespace Artemis.Profiles.Lua return new LuaRadialGradientBrush(_layerModel.AppliedProperties.Brush); return null; } - set { _layerModel.AppliedProperties.Brush = value.Brush; } + set { _layerModel.AppliedProperties.Brush = value?.Brush; } } #endregion diff --git a/Artemis/Artemis/Resources/LogitechLED.dll b/Artemis/Artemis/Resources/LogitechLED.dll index 7fb78369b..47ade51fc 100644 Binary files a/Artemis/Artemis/Resources/LogitechLED.dll and b/Artemis/Artemis/Resources/LogitechLED.dll differ diff --git a/Artemis/LogiLed2Artemis/LogiLed2Artemis.def b/Artemis/LogiLed2Artemis/LogiLed2Artemis.def index ef38be3f1..890fbfc44 100644 --- a/Artemis/LogiLed2Artemis/LogiLed2Artemis.def +++ b/Artemis/LogiLed2Artemis/LogiLed2Artemis.def @@ -1,27 +1,27 @@ -// Original work by VRocker https://github.com/VRocker/LogiLed2Corsair -// I'm mainly a C# developer, and these modification aren't a piece of art, but it suits our needs. - -// The MIT License (MIT) -// -// Copyright (c) 2015 VRocker -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. +; Original work by VRocker https://github.com/VRocker/LogiLed2Corsair +; I'm mainly a C# developer, and these modification aren't a piece of art, but it suits our needs. +; +; The MIT License (MIT) +; +; Copyright (c) 2015 VRocker +; +; Permission is hereby granted, free of charge, to any person obtaining a copy +; of this software and associated documentation files (the "Software"), to deal +; in the Software without restriction, including without limitation the rights +; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the Software is +; furnished to do so, subject to the following conditions: +; +; The above copyright notice and this permission notice shall be included in all +; copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +; SOFTWARE. LIBRARY LogiLed2Artemis.dll diff --git a/Artemis/LogiLed2Artemis/main.cpp b/Artemis/LogiLed2Artemis/main.cpp index 23e25b587..8181302bf 100644 --- a/Artemis/LogiLed2Artemis/main.cpp +++ b/Artemis/LogiLed2Artemis/main.cpp @@ -37,29 +37,40 @@ using namespace std; static bool g_hasInitialised = false; static bool mustLog = false; +static int throttle = 0; const char* game = ""; +const char* GetGame() +{ + CHAR divisionFind[] = ("Division"); + CHAR gtaFind[] = ("GTA"); + CHAR szPath[MAX_PATH]; + + GetModuleFileNameA(NULL, szPath, MAX_PATH); + char *output; + + output = strstr(szPath, divisionFind); + if (output) + return "division"; + output = strstr(szPath, gtaFind); + if (output) + return "gta"; + + return "bf1"; +}; + BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID) { if (fdwReason == DLL_PROCESS_ATTACH) - { - // Get the process that loaded the DLL - TCHAR divisionFind[] = _T("Division"); - TCHAR gtaFind[] = _T("GTA"); - TCHAR szPath[MAX_PATH]; - GetModuleFileName(NULL, szPath, MAX_PATH); - - if (_tcscmp(szPath, divisionFind) != 0) - game = "division"; - else if (_tcscmp(szPath, gtaFind) != 0) - game = "gta"; + { + game = GetGame(); if (mustLog) { ofstream myfile; myfile.open("log.txt", ios::out | ios::app); - myfile << "Main called, DLL loaded into " << szPath << "\n"; + myfile << "Main called, DLL loaded into " << game << "\n"; myfile.close(); } } @@ -120,6 +131,16 @@ void Transmit(const char* msg) // LogiLedSetLighting appears to have an undocumented extra argument bool LogiLedSetLighting(int redPercentage, int greenPercentage, int bluePercentage, int custom = 0) { + // GTA goes mental on the SetLighting calls, lets only send one in every 20 + if (game == "gta") + { + throttle++; + if (throttle > 20) + throttle = 0; + else + return true; + } + if (mustLog) { ofstream myfile;