mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-29 20:44:20 +01:00
Merge branch 'jay' of https://github.com/Ryochan7/DS4Windows into jay
This commit is contained in:
commit
7da6b3434a
@ -2,10 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using static DS4Windows.Global;
|
||||
|
||||
|
||||
namespace DS4Windows
|
||||
{
|
||||
public class Mapping
|
||||
@ -77,6 +79,8 @@ namespace DS4Windows
|
||||
new Queue<ControlToXInput>(), new Queue<ControlToXInput>()
|
||||
};
|
||||
|
||||
static ReaderWriterLockSlim syncStateLock = new ReaderWriterLockSlim();
|
||||
|
||||
public static SyntheticState globalState = new SyntheticState();
|
||||
public static SyntheticState[] deviceState = new SyntheticState[4]
|
||||
{ new SyntheticState(), new SyntheticState(), new SyntheticState(),
|
||||
@ -190,8 +194,8 @@ namespace DS4Windows
|
||||
public static void Commit(int device)
|
||||
{
|
||||
SyntheticState state = deviceState[device];
|
||||
lock (globalState)
|
||||
{
|
||||
syncStateLock.EnterWriteLock();
|
||||
|
||||
globalState.currentClicks.leftCount += state.currentClicks.leftCount - state.previousClicks.leftCount;
|
||||
globalState.currentClicks.middleCount += state.currentClicks.middleCount - state.previousClicks.middleCount;
|
||||
globalState.currentClicks.rightCount += state.currentClicks.rightCount - state.previousClicks.rightCount;
|
||||
@ -389,7 +393,8 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
globalState.SaveToPrevious(false);
|
||||
}
|
||||
|
||||
syncStateLock.ExitWriteLock();
|
||||
state.SaveToPrevious(true);
|
||||
}
|
||||
|
||||
|
@ -43,12 +43,12 @@ namespace DS4Windows
|
||||
{
|
||||
byte alphacolor = Math.Max(red, Math.Max(green, blue));
|
||||
Color reg = Color.FromArgb(red, green, blue);
|
||||
Color full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
|
||||
Color full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), ref reg);
|
||||
return Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
}
|
||||
}
|
||||
|
||||
private Color HuetoRGB(float hue, float light, Color rgb)
|
||||
private Color HuetoRGB(float hue, float light, ref Color rgb)
|
||||
{
|
||||
float L = (float)Math.Max(.5, light);
|
||||
float C = (1 - Math.Abs(2 * L - 1));
|
||||
|
Loading…
Reference in New Issue
Block a user