Skip to content

Commit

Permalink
fix fortnite in chroma reader
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotr7 committed Mar 2, 2024
1 parent 786f6c3 commit 8aa5c20
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="ArtemisRGB.UI.Shared" IncludeAssets="compile;build;buildTransitive" Version="1.2024.302.1" />
<PackageReference Include="RazerSdkReader" Version="1.10.0" />
<PackageReference Include="RazerSdkReader" Version="1.11.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public override void DisableLayerBrush()
_chroma.AppListUpdated -= OnAppListUpdated;
}

private void OnMatrixUpdated(object? sender, RzDeviceType deviceType)
private void OnMatrixUpdated(object? sender, MatrixUpdatedEventArgs e)
{
var (deviceType, matrix) = e;
var dict = DefaultChromaLedMap.GetDeviceMap(deviceType);
var matrix = _chroma.Matrices[(int) deviceType];

lock (_lock)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ private void OnAppListUpdated(object? sender, EventArgs args)
DataModel.PidList = _chroma.AppIds.Select(p => (int)p).ToList();
}

private void OnMatrixUpdated(object? sender, RzDeviceType deviceType)
private void OnMatrixUpdated(object? sender, MatrixUpdatedEventArgs e)
{
var colors = _chroma.Matrices[(int)deviceType];
var (deviceType, colors) = e;

var map = DefaultChromaLedMap.GetDeviceMap(deviceType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Artemis.Core;
using RazerSdkReader;
using RazerSdkReader.Structures;

namespace Artemis.Plugins.LayerBrushes.Chroma.Services;

public readonly record struct MatrixUpdatedEventArgs(RzDeviceType DeviceType, SKColor[] Matrix);

public sealed class ChromaService : IPluginService, IDisposable
{
private readonly SKColor[][] _matrices;
Expand All @@ -18,23 +19,21 @@ public sealed class ChromaService : IPluginService, IDisposable
private readonly Profiler _profiler;
private readonly object _lock;

public event EventHandler<RzDeviceType>? MatrixUpdated;
public event EventHandler<MatrixUpdatedEventArgs>? MatrixUpdated;
public event EventHandler? AppListUpdated;

public bool IsActive => !string.IsNullOrWhiteSpace(CurrentApp) && CurrentApp != "Artemis.UI.Windows.exe";
public string? CurrentApp { get; private set; }
public uint? CurrentAppId { get; private set; }
public IEnumerable<string> AppNames => _apps;
public IEnumerable<uint> AppIds => _pids;

public SKColor[][] Matrices => _matrices;

public IEnumerable<uint> AppIds => _pids;

public ChromaService(Plugin plugin)
{
_profiler = plugin.GetProfiler("Chroma Service");
_lock = new object();
_apps = new();
_pids = new();
_apps = [];
_pids = [];

var deviceTypes = Enum.GetValues<RzDeviceType>();
_matrices = new SKColor[deviceTypes.Length][];
Expand Down Expand Up @@ -85,7 +84,7 @@ private void UpdateMatrix<T>(RzDeviceType deviceType, in T data) where T : ICol
matrix[i] = new SKColor(rzColor.R, rzColor.G, rzColor.B);
}

MatrixUpdated?.Invoke(this, deviceType);
MatrixUpdated?.Invoke(this, new MatrixUpdatedEventArgs(deviceType, matrix));
}

_profiler.StopMeasurement(profilerName);
Expand Down
2 changes: 1 addition & 1 deletion src/Artemis.Plugins.LayerBrushes.Chroma/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Author": "diogotr7",
"Icon": "Snake",
"Description": "Provides a layer that displays lighting from Razer Chroma supported games on all devices Artemis supports.",
"Version": "1.1.0.0",
"Version": "1.2.0.0",
"Main": "Artemis.Plugins.LayerBrushes.Chroma.dll",
"Platforms": "Windows"
}

0 comments on commit 8aa5c20

Please sign in to comment.