Skip to content

Commit

Permalink
0.5.1d version
Browse files Browse the repository at this point in the history
=General=
* Fixed issues with foreign Logitech Layouts
* Fixed skype integration crash
* Updated Razer sdk

=Grand Theft Auto 5=
* Fixed police siren effect
  • Loading branch information
antonpup committed Oct 8, 2016
1 parent 3d38de8 commit f3123a5
Show file tree
Hide file tree
Showing 49 changed files with 1,508 additions and 448 deletions.
4 changes: 2 additions & 2 deletions Aurora-SkypeIntegration/Aurora-SkypeIntegration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion Aurora-SkypeIntegration/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
</packages>
4 changes: 2 additions & 2 deletions Aurora-Updater/Aurora-Updater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
<HintPath>..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion Aurora-Updater/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetZip.Reduced" version="1.9.1.8" targetFramework="net452" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
</packages>
535 changes: 287 additions & 248 deletions Project-Aurora/Devices/Corsair/CorsairDevice.cs

Large diffs are not rendered by default.

188 changes: 142 additions & 46 deletions Project-Aurora/Devices/Logitech/LogitechDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ class LogitechDevice : Device
private bool keyboard_updated = false;
private bool peripheral_updated = false;

private readonly object action_lock = new object();

//Keyboard stuff
private Logitech_keyboardBitmapKeys[] allKeys = Enum.GetValues(typeof(Logitech_keyboardBitmapKeys)).Cast<Logitech_keyboardBitmapKeys>().ToArray();
private byte[] bitmap = new byte[LogitechGSDK.LOGI_LED_BITMAP_SIZE];
Expand All @@ -162,59 +164,66 @@ class LogitechDevice : Device

public bool Initialize()
{
if(!isInitialized)
lock (action_lock)
{
try
if (!isInitialized)
{
if (!LogitechGSDK.LogiLedInit())
try
{
Global.logger.LogLine("Logitech LED SDK could not be initialized.", Logging_Level.Error);
if (!LogitechGSDK.LogiLedInit())
{
Global.logger.LogLine("Logitech LED SDK could not be initialized.", Logging_Level.Error);

isInitialized = false;
return false;
}
isInitialized = false;
return false;
}

if (LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_RGB | LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB | LogitechGSDK.LOGI_DEVICETYPE_MONOCHROME) && LogitechGSDK.LogiLedSaveCurrentLighting())
{
if (Global.Configuration.logitech_first_time)
if (LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_RGB | LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB | LogitechGSDK.LOGI_DEVICETYPE_MONOCHROME) && LogitechGSDK.LogiLedSaveCurrentLighting())
{
LogitechInstallInstructions instructions = new LogitechInstallInstructions();
instructions.ShowDialog();
if (Global.Configuration.logitech_first_time)
{
LogitechInstallInstructions instructions = new LogitechInstallInstructions();
instructions.ShowDialog();

Global.Configuration.logitech_first_time = false;
Settings.ConfigManager.Save(Global.Configuration);
}

Global.Configuration.logitech_first_time = false;
Settings.ConfigManager.Save(Global.Configuration);
isInitialized = true;
return true;
}
else
{
Global.logger.LogLine("Logitech LED SDK could not be initialized. (LogiLedSetTargetDevice or LogiLedSaveCurrentLighting failed)", Logging_Level.Error);

isInitialized = false;
return false;
}

isInitialized = true;
return true;

}
else
catch (Exception exc)
{
Global.logger.LogLine("Logitech LED SDK could not be initialized. (LogiLedSetTargetDevice or LogiLedSaveCurrentLighting failed)", Logging_Level.Error);
Global.logger.LogLine("There was an error initializing Logitech LED SDK.\r\n" + exc.Message, Logging_Level.Error);

isInitialized = false;
return false;
}


}
catch (Exception exc)
{
Global.logger.LogLine("There was an error initializing Logitech LED SDK.\r\n" + exc.Message, Logging_Level.Error);

return false;
}
return isInitialized;
}

return isInitialized;
}

public void Shutdown()
{
if (isInitialized)
lock (action_lock)
{
this.Reset();
LogitechGSDK.LogiLedShutdown();
if (isInitialized)
{
this.Reset();
LogitechGSDK.LogiLedShutdown();
isInitialized = false;
}
}
}

Expand Down Expand Up @@ -258,18 +267,6 @@ public bool IsConnected()

private void SetOneKey(Logitech_keyboardBitmapKeys key, Color color)
{
if (Global.Configuration.logitech_enhance_brightness)
{
float boost_amount = 0.0f;
boost_amount += 3.0f - (color.R / 30.0f);
boost_amount += 3.0f - (color.G / 30.0f);
boost_amount += 3.0f - (color.B / 30.0f);
boost_amount /= 3.0f;
boost_amount = boost_amount <= 1.0f ? 1.0f : boost_amount;

color = Utils.ColorUtils.MultiplyColorByScalar(color, boost_amount);
}

bitmap[(int)key] = color.B;
bitmap[(int)key + 1] = color.G;
bitmap[(int)key + 2] = color.R;
Expand Down Expand Up @@ -334,9 +331,9 @@ public bool UpdateDevice(Dictionary<DeviceKeys, Color> keyColors, bool forced =

if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.Peripheral)
{
SendColorToPeripheral((Color)key.Value, forced);
SendColorToPeripheral((Color)key.Value, forced || !peripheral_updated);
}
if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.OEM8)
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.OEM8)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
Expand All @@ -345,13 +342,112 @@ public bool UpdateDevice(Dictionary<DeviceKeys, Color> keyColors, bool forced =

LogitechGSDK.LogiLedSetLightingForKeyWithHidCode(220, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G1)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_1, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G2)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_2, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G3)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_3, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G4)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_4, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G5)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_5, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G6)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_6, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G7)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_7, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G8)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_8, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.G9)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_9, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.LOGO)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_LOGO, red_amt, green_amt, blue_amt);
}
else if (localKey == Logitech_keyboardBitmapKeys.UNKNOWN && key.Key == DeviceKeys.LOGO2)
{
double alpha_amt = (key.Value.A / 255.0);
int red_amt = (int)(((key.Value.R * alpha_amt) / 255.0) * 100.0);
int green_amt = (int)(((key.Value.G * alpha_amt) / 255.0) * 100.0);
int blue_amt = (int)(((key.Value.B * alpha_amt) / 255.0) * 100.0);

LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyboardNames.G_BADGE, red_amt, green_amt, blue_amt);
}
else if (localKey != Logitech_keyboardBitmapKeys.UNKNOWN)
{
SetOneKey(localKey, (Color)key.Value);
}
}

SendColorsToKeyboard(forced);
SendColorsToKeyboard(forced || !keyboard_updated);
return true;
}
catch (Exception e)
Expand Down
34 changes: 32 additions & 2 deletions Project-Aurora/Devices/Logitech/LogitechGSDK.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Runtime.InteropServices;
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Text;

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
namespace LedCSharp
Expand Down Expand Up @@ -109,7 +112,17 @@ public enum keyboardNames
ARROW_RIGHT = 0x14D,
NUM_ZERO = 0x52,
NUM_PERIOD = 0x53,

G_1 = 0xFFF1,
G_2 = 0xFFF2,
G_3 = 0xFFF3,
G_4 = 0xFFF4,
G_5 = 0xFFF5,
G_6 = 0xFFF6,
G_7 = 0xFFF7,
G_8 = 0xFFF8,
G_9 = 0xFFF9,
G_LOGO = 0xFFFF1,
G_BADGE = 0xFFFF2
};

public class LogitechGSDK
Expand All @@ -132,6 +145,20 @@ public class LogitechGSDK
[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedInit();

//Config option functions
[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedGetConfigOptionNumber([MarshalAs(UnmanagedType.LPWStr)]String configPath, ref double defaultNumber);

[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedGetConfigOptionBool([MarshalAs(UnmanagedType.LPWStr)]String configPath, ref bool defaultRed);

[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedGetConfigOptionColor([MarshalAs(UnmanagedType.LPWStr)]String configPath, ref int defaultRed, ref int defaultGreen, ref int defaultBlue);

[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedGetConfigOptionKeyInput([MarshalAs(UnmanagedType.LPWStr)]String configPath, StringBuilder buffer, int bufsize);
/////////////////////

[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedSetTargetDevice(int targetDevice);

Expand All @@ -156,6 +183,9 @@ public class LogitechGSDK
[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedStopEffects();

[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedExcludeKeysFromBitmap(keyboardNames[] keyList, int listCount);

[DllImport("LogitechLed ", CallingConvention = CallingConvention.Cdecl)]
public static extern bool LogiLedSetLightingFromBitmap(byte[] bitmap);

Expand Down
12 changes: 6 additions & 6 deletions Project-Aurora/Devices/Razer/RazerDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public bool Initialize()
{
try
{
if (!Chroma.IsSdkAvailable())
if (!Chroma.SdkAvailable)
{
Global.logger.LogLine("No Chroma SDK available", Logging_Level.Info);
throw new Exception("No Chroma SDK available");
Expand Down Expand Up @@ -171,7 +171,7 @@ private void SendColorsToKeyboard(bool forced = false)
private void SetOneKey(Key localKey, System.Drawing.Color color)
{
if (keyboard != null && keyboard[localKey] != null)
keyboard.SetKey(localKey, color);
keyboard.SetKey(localKey, new Corale.Colore.Core.Color(color.R, color.G, color.B));
}

private void SendColorToPeripheral(System.Drawing.Color color, bool forced = false)
Expand All @@ -181,16 +181,16 @@ private void SendColorToPeripheral(System.Drawing.Color color, bool forced = fal
if (Global.Configuration.allow_peripheral_devices)
{
if (mouse != null)
mouse.SetAll(color);
mouse.SetAll(new Corale.Colore.Core.Color(color.R, color.G, color.B));

if (mousepad != null)
mousepad.SetAll(color);
mousepad.SetAll(new Corale.Colore.Core.Color(color.R, color.G, color.B));

if (headset != null)
headset.SetAll(color);
headset.SetAll(new Corale.Colore.Core.Color(color.R, color.G, color.B));

if (keypad != null)
keypad.SetAll(color);
keypad.SetAll(new Corale.Colore.Core.Color(color.R, color.G, color.B));

previous_peripheral_Color = color;
peripheral_updated = true;
Expand Down
Binary file added Project-Aurora/LogitechLed.dll
Binary file not shown.
Binary file removed Project-Aurora/LogitechLedEnginesWrapper.dll
Binary file not shown.
Loading

0 comments on commit f3123a5

Please sign in to comment.