diff --git a/Qwilight/Assets/AMD64/MysticLight_SDK_x64.dll b/Qwilight/Assets/AMD64/MysticLight_SDK_x64.dll new file mode 100644 index 0000000..58460c2 --- /dev/null +++ b/Qwilight/Assets/AMD64/MysticLight_SDK_x64.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad1bd5a464c120f086839631cf9cb7a56e8e7373209158e66c628a89be06d166 +size 411960 diff --git a/Qwilight/Assets/AMD64/SDKDLL.dll b/Qwilight/Assets/AMD64/SDKDLL.dll new file mode 100644 index 0000000..e8c7e8d --- /dev/null +++ b/Qwilight/Assets/AMD64/SDKDLL.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68c109c0f9a8ff83d5f7cf7be50d05f22ab4ed8a26949c2d68eba81ddb3d775f +size 1446904 diff --git a/Qwilight/Assets/Language.json b/Qwilight/Assets/Language.json index 35c315e..3ff9a47 100644 --- a/Qwilight/Assets/Language.json +++ b/Qwilight/Assets/Language.json @@ -591,6 +591,14 @@ "ko-KR": "클리어 정보", "en-US": "Clear Information" }, + "CMContents": { + "ko-KR": "Cooler Master® RGB를 사용합니다.", + "en-US": "Use Cooler Master® RGB" + }, + "CMText": { + "ko-KR": "Cooler Master® RGB 활성화", + "en-US": "Enable Cooler Master® RGB" + }, "ColorText": { "ko-KR": "색상 선택", "en-US": "Select Color" @@ -2187,6 +2195,14 @@ "ko-KR": "▲, ▼ 키와 DEL 키로 순서를 설정하거나 삭제하세요", "en-US": "▲, Set or delete the order with the ▼ and DEL keys" }, + "MSIContents": { + "ko-KR": "MSI® Mystic Light™를 사용합니다.", + "en-US": "Use MSI® Mystic Light™" + }, + "MSIText": { + "ko-KR": "MSI® Mystic Light™ 활성화", + "en-US": "Enable MSI® Mystic Light™" + }, "MultiplierContents": { "ko-KR": "스크롤 속도", "en-US": "Scroll Speed" @@ -2371,6 +2387,10 @@ "ko-KR": "RAZER® Chroma™ 비활성화", "en-US": "Disable RAZER® Chroma™" }, + "NotCMText": { + "ko-KR": "Cooler Master® RGB 비활성화", + "en-US": "Disable Cooler Master® RGB" + }, "NotDataCount3Text": { "ko-KR": "삼중 버퍼링 비활성화", "en-US": "Disable triple buffering" @@ -2611,6 +2631,10 @@ "ko-KR": "BGA 비활성화", "en-US": "Disable BGA" }, + "NotMSIText": { + "ko-KR": "MSI® Mythic Light™ 비활성화", + "en-US": "Disable MSI® Mythic Light™" + }, "NotNotifyUbuntuContents": { "ko-KR": "친구 접속시 알림을 받지 않음", "en-US": "Don't get notified when friends log in" diff --git a/Qwilight/Compiler/BMSCompiler.cs b/Qwilight/Compiler/BMSCompiler.cs index 1503913..214a487 100644 --- a/Qwilight/Compiler/BMSCompiler.cs +++ b/Qwilight/Compiler/BMSCompiler.cs @@ -730,7 +730,7 @@ public override void CompileImpl(DefaultCompute defaultComputer, byte[] noteFileContents, bool loadParallelItems) { var bmsIDAudioItemMap = new ConcurrentDictionary(); - var bmsIDHandledItemMap = new ConcurrentDictionary(); + var bmsIDHandrgbItemMap = new ConcurrentDictionary(); var parallelItems = new ConcurrentBag(); try { @@ -778,7 +778,7 @@ var mediaFilePath = Utility.GetFilePath(Path.Combine(NoteFile.EntryItem.EntryPath, data), Utility.FileFormatFlag.Drawing | Utility.FileFormatFlag.Media); if (!string.IsNullOrEmpty(mediaFilePath)) { - bmsIDHandledItemMap[property] = Utility.GetFileFormat(mediaFilePath) switch + bmsIDHandrgbItemMap[property] = Utility.GetFileFormat(mediaFilePath) switch { Utility.FileFormatFlag.Drawing => new HandledDrawingItem { @@ -788,7 +788,7 @@ Utility.FileFormatFlag.Media => MediaSystem.Instance.Load(Utility.GetFiles(Path.GetDirectoryName(mediaFilePath), $"{Path.GetFileNameWithoutExtension(mediaFilePath)}.*") .Where(targetFile => targetFile.IsTailCaselsss(".mp4")) .FirstOrDefault() ?? mediaFilePath, defaultComputer, false), - _ => null as IHandledItem, + _ => null as IHandrgbItem, }; } } @@ -831,7 +831,7 @@ }, SetCancelCompiler?.Token); } - if (bmsIDHandledItemMap.TryGetValue("00", out var mediaItem)) + if (bmsIDHandrgbItemMap.TryGetValue("00", out var mediaItem)) { defaultComputer.WaitMediaNoteMap.NewValue(0.0, new MediaNote { @@ -888,7 +888,7 @@ AudioItem = audioItem, BMSID = bmsID }; - bmsIDHandledItemMap.TryGetValue(bmsID, out mediaItem); + bmsIDHandrgbItemMap.TryGetValue(bmsID, out mediaItem); var hasContents = defaultComputer.LoadedMedia; switch (noteVariety0) { diff --git a/Qwilight/Compiler/BMSONCompiler.cs b/Qwilight/Compiler/BMSONCompiler.cs index 76c1a8e..2c891ed 100644 --- a/Qwilight/Compiler/BMSONCompiler.cs +++ b/Qwilight/Compiler/BMSONCompiler.cs @@ -505,7 +505,7 @@ public override void CompileImpl(DefaultCompute defaultComputer, byte[] noteFileContents, bool loadParallelItems) { var audioFileNameAudioItemMap = new ConcurrentDictionary(); - var mediaIDHandledItemMap = new ConcurrentDictionary(); + var mediaIDHandrgbItemMap = new ConcurrentDictionary(); var parallelItems = new ConcurrentBag(); try { @@ -552,7 +552,7 @@ var mediaFilePath = Path.IsPathFullyQualified(paint.name) ? paint.name : Utility.GetFilePath(Path.Combine(NoteFile.EntryItem.EntryPath, paint.name), Utility.FileFormatFlag.Drawing | Utility.FileFormatFlag.Media); if (!string.IsNullOrEmpty(mediaFilePath)) { - mediaIDHandledItemMap[Utility.ToInt64(paint.id.ToString())] = (Utility.GetFileFormat(mediaFilePath)) switch + mediaIDHandrgbItemMap[Utility.ToInt64(paint.id.ToString())] = (Utility.GetFileFormat(mediaFilePath)) switch { Utility.FileFormatFlag.Drawing => new HandledDrawingItem { @@ -566,7 +566,7 @@ } catch { - mediaIDHandledItemMap[Utility.ToInt64(paint.id.ToString())] = null; + mediaIDHandrgbItemMap[Utility.ToInt64(paint.id.ToString())] = null; } }); } @@ -592,7 +592,7 @@ defaultComputer.WaitMediaNoteMap.NewValue(_bmsonPositionWaitMap[bmsonPosition], new MediaNote { MediaMode = MediaNote.Mode.Default, - MediaItem = mediaIDHandledItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), + MediaItem = mediaIDHandrgbItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), HasContents = hasContents }); } @@ -602,7 +602,7 @@ defaultComputer.WaitMediaNoteMap.NewValue(_bmsonPositionWaitMap[bmsonPosition], new MediaNote { MediaMode = MediaNote.Mode.Layer, - MediaItem = mediaIDHandledItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), + MediaItem = mediaIDHandrgbItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), HasContents = hasContents }); } @@ -612,7 +612,7 @@ defaultComputer.WaitMediaNoteMap.NewValue(_bmsonPositionWaitMap[bmsonPosition], new MediaNote { MediaMode = MediaNote.Mode.Failed, - MediaItem = mediaIDHandledItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), + MediaItem = mediaIDHandrgbItemMap.GetValueOrDefault(Utility.ToInt64(mediaEvent.id.ToString())), HasContents = hasContents }); } diff --git a/Qwilight/Compute/DefaultCompute.cs b/Qwilight/Compute/DefaultCompute.cs index fb5ac23..b785ebc 100644 --- a/Qwilight/Compute/DefaultCompute.cs +++ b/Qwilight/Compute/DefaultCompute.cs @@ -1311,9 +1311,9 @@ public int ValidatedTotalNotes { get; set; } - public IHandledItem LoopingBanalMedia { get; set; } + public IHandrgbItem LoopingBanalMedia { get; set; } - public IHandledItem LoopingBanalFailedMedia { get; set; } + public IHandrgbItem LoopingBanalFailedMedia { get; set; } void SendPostItem(PostableItem postableItem) { diff --git a/Qwilight/JSON.cs b/Qwilight/JSON.cs index 0807d9e..3fc6729 100644 --- a/Qwilight/JSON.cs +++ b/Qwilight/JSON.cs @@ -843,9 +843,9 @@ public int handledClearCount; public int handledAssistClearCount; public int noteIDCount; - public Dictionary> avatarHandledItems; + public Dictionary> avatarHandrgbItems; - public sealed class HandledItem : Computing + public sealed class HandrgbItem : Computing { public int stand; } diff --git a/Qwilight/Qwilight.csproj b/Qwilight/Qwilight.csproj index 223205a..153aa3e 100644 --- a/Qwilight/Qwilight.csproj +++ b/Qwilight/Qwilight.csproj @@ -10,7 +10,7 @@ Qwilight.ico Taehui 불로그 - 1.16.28 + 1.16.29 true enable false @@ -55,7 +55,9 @@ + + @@ -269,9 +271,15 @@ Always + + Always + Always + + Always + Always diff --git a/Qwilight/System/Configure/Configure.cs b/Qwilight/System/Configure/Configure.cs index 5558e49..4c2f340 100644 --- a/Qwilight/System/Configure/Configure.cs +++ b/Qwilight/System/Configure/Configure.cs @@ -179,6 +179,8 @@ bool _valueK70; bool _valueGS; bool _wooting; + bool _valueMSI; + bool _valueCM; bool _mediaInput; bool _loadedMedia; bool _media; @@ -1490,7 +1492,7 @@ } } - public Brush BWPaint => Paints.PointPaints[BW ? 1 : 0]; + public Brush BWPaint => BW ? BWSystem.Instance.GroupPaint.Value : Paints.PointPaints[0]; public string BWText => BW ? LanguageSystem.Instance.BWText : LanguageSystem.Instance.NotBWText; @@ -1508,7 +1510,7 @@ } } - public Brush LSPaint => Paints.PointPaints[LS ? 1 : 0]; + public Brush LSPaint => LS ? LSSystem.Instance.GroupPaint.Value : Paints.PointPaints[0]; public string LSText => LS ? LanguageSystem.Instance.LSText : LanguageSystem.Instance.NotLSText; @@ -1526,7 +1528,7 @@ } } - public Brush AuraPaint => Paints.PointPaints[Aura ? 1 : 0]; + public Brush AuraPaint => Aura ? AuraSystem.Instance.GroupPaint.Value : Paints.PointPaints[0]; public string AuraText => Aura ? LanguageSystem.Instance.AuraText : LanguageSystem.Instance.NotAuraText; @@ -1544,7 +1546,7 @@ } } - public Brush K70Paint => Paints.PointPaints[K70 ? 1 : 0]; + public Brush K70Paint => K70 ? K70System.Instance.GroupPaint.Value : Paints.PointPaints[0]; public string K70Text => K70 ? LanguageSystem.Instance.K70Text : LanguageSystem.Instance.NotK70Text; @@ -1562,7 +1564,7 @@ } } - public Brush GSPaint => Paints.PointPaints[GS ? 1 : 0]; + public Brush GSPaint => GS ? GSSystem.Instance.GroupPaint.Value : Paints.PointPaints[0]; public string GSText => GS ? LanguageSystem.Instance.GSText : LanguageSystem.Instance.NotGSText; @@ -1580,10 +1582,46 @@ } } - public Brush WootingPaint => Paints.PointPaints[Wooting ? 1 : 0]; + public Brush WootingPaint => Wooting ? WootingSystem.Instance.GroupPaint.Value : Paints.PointPaints[0]; public string WootingText => Wooting ? LanguageSystem.Instance.WootingText : LanguageSystem.Instance.NotWootingText; + public bool MSI + { + get => _valueMSI; + + set + { + if (SetProperty(ref _valueMSI, value)) + { + OnPropertyChanged(nameof(MSIPaint)); + OnPropertyChanged(nameof(MSIText)); + } + } + } + + public Brush MSIPaint => MSI ? MSISystem.Instance.GroupPaint.Value : Paints.PointPaints[0]; + + public string MSIText => MSI ? LanguageSystem.Instance.MSIText : LanguageSystem.Instance.NotMSIText; + + public bool CM + { + get => _valueCM; + + set + { + if (SetProperty(ref _valueCM, value)) + { + OnPropertyChanged(nameof(CMPaint)); + OnPropertyChanged(nameof(CMText)); + } + } + } + + public Brush CMPaint => CM ? CMSystem.Instance.GroupPaint.Value : Paints.PointPaints[0]; + + public string CMText => CM ? LanguageSystem.Instance.CMText : LanguageSystem.Instance.NotCMText; + public bool MediaInput { get => _mediaInput; @@ -3505,6 +3543,11 @@ { string.Empty, new() } }; } + if (isInit || Utility.IsLowerDate(Date, 1, 16, 29)) + { + MSI = false; + CM = false; + } if (!UIConfigureValuesV2.ContainsKey(UIItemValue.Title)) { UIConfigureValuesV2[UIItemValue.Title] = new(); diff --git a/Qwilight/System/DrawingSystem/HandledDrawingItem.cs b/Qwilight/System/DrawingSystem/HandledDrawingItem.cs index f6fe4f4..bed267c 100644 --- a/Qwilight/System/DrawingSystem/HandledDrawingItem.cs +++ b/Qwilight/System/DrawingSystem/HandledDrawingItem.cs @@ -2,7 +2,7 @@ namespace Qwilight { - public struct HandledDrawingItem : IHandledItem, IDisposable + public struct HandledDrawingItem : IHandrgbItem, IDisposable { public double Length => double.PositiveInfinity; diff --git a/Qwilight/System/IHandledItem.cs b/Qwilight/System/IHandledItem.cs index 4315668..9f66aae 100644 --- a/Qwilight/System/IHandledItem.cs +++ b/Qwilight/System/IHandledItem.cs @@ -1,6 +1,6 @@ namespace Qwilight { - public interface IHandledItem + public interface IHandrgbItem { double Length { get; } diff --git a/Qwilight/System/LanguageSystem/LanguageSystem.g.cs b/Qwilight/System/LanguageSystem/LanguageSystem.g.cs index 04e5b70..ebdda85 100644 --- a/Qwilight/System/LanguageSystem/LanguageSystem.g.cs +++ b/Qwilight/System/LanguageSystem/LanguageSystem.g.cs @@ -150,6 +150,8 @@ public string CannotIOContents { get; set; } public string CenterLimiterVariety { get; set; } public string ClearedTabText { get; set; } + public string CMContents { get; set; } + public string CMText { get; set; } public string ColorText { get; set; } public string CommentAssist { get; set; } public string CommentComputingSituationContents { get; set; } @@ -549,6 +551,8 @@ public string ModifyFrontEntry { get; set; } public string ModifyModeComponentText { get; set; } public string ModifyPositionAssist { get; set; } + public string MSIContents { get; set; } + public string MSIText { get; set; } public string MultiplierContents { get; set; } public string NegativePostedItemText { get; set; } public string NegativeStopFault { get; set; } @@ -595,6 +599,7 @@ public string NotBanalMediaText { get; set; } public string NotBPMModeContents { get; set; } public string NotBWText { get; set; } + public string NotCMText { get; set; } public string NotDataCount3Text { get; set; } public string NotDefaultAudioVarietyText { get; set; } public string NoteDrawingCountText { get; set; } @@ -655,6 +660,7 @@ public string NotMediaFillContents { get; set; } public string NotMediaFillText { get; set; } public string NotMediaText { get; set; } + public string NotMSIText { get; set; } public string NotNotifyUbuntuContents { get; set; } public string NotQwilightFillContents { get; set; } public string NotQwilightFillText { get; set; } diff --git a/Qwilight/System/MediaSystem/HandledMediaItem.cs b/Qwilight/System/MediaSystem/HandledMediaItem.cs index efa29ad..269150c 100644 --- a/Qwilight/System/MediaSystem/HandledMediaItem.cs +++ b/Qwilight/System/MediaSystem/HandledMediaItem.cs @@ -2,7 +2,7 @@ namespace Qwilight { - public sealed class HandledMediaItem : IHandledItem, IDisposable + public sealed class HandledMediaItem : IHandrgbItem, IDisposable { public MediaPlayer Media { get; init; } diff --git a/Qwilight/System/MediaSystem/MediaNote.cs b/Qwilight/System/MediaSystem/MediaNote.cs index 216f86c..0625fa9 100644 --- a/Qwilight/System/MediaSystem/MediaNote.cs +++ b/Qwilight/System/MediaSystem/MediaNote.cs @@ -11,7 +11,7 @@ public Mode MediaMode { get; set; } - public IHandledItem MediaItem { get; set; } + public IHandrgbItem MediaItem { get; set; } public bool HasContents { get; set; } diff --git a/Qwilight/System/RGBSystem/AuraSystem.cs b/Qwilight/System/RGBSystem/AuraSystem.cs index 6d0eb7b..ac3db38 100644 --- a/Qwilight/System/RGBSystem/AuraSystem.cs +++ b/Qwilight/System/RGBSystem/AuraSystem.cs @@ -142,18 +142,18 @@ _rgbItems.Clear(); foreach (IAuraSyncDevice auraItem in _auraItems) { - foreach (IAuraRgbLight ledItem in auraItem.Lights) + foreach (IAuraRgbLight rgbItem in auraItem.Lights) { - _rgbItems.Add(ledItem); + _rgbItems.Add(rgbItem); } if (auraItem is IAuraSyncKeyboard auraInput) { - foreach (IAuraRgbKey ledItem in auraInput.Keys) + foreach (IAuraRgbKey rgbItem in auraInput.Keys) { - var input = GetInput(ledItem.Code); + var input = GetInput(rgbItem.Code); if (input != VirtualKey.None) { - Utility.NewValue(_inputItems, input, auraInput.Key[ledItem.Code]); + Utility.NewValue(_inputItems, input, auraInput.Key[rgbItem.Code]); } } } @@ -168,9 +168,9 @@ } else { - foreach (IAuraRgbLight ledItem in auraItem.Lights) + foreach (IAuraRgbLight rgbItem in auraItem.Lights) { - _etcItems.Add(ledItem); + _etcItems.Add(rgbItem); } } } @@ -233,9 +233,9 @@ public override void OnBeforeHandle() { - foreach (IAuraRgbLight ledItem in _rgbItems) + foreach (IAuraRgbLight rgbItem in _rgbItems) { - ledItem.Color = 0; + rgbItem.Color = 0; } } @@ -247,7 +247,7 @@ } } - public override Color GetMeterColor() => Colors.Red; + public override Color GetGroupColor() => Colors.Red; public override void Dispose() { diff --git a/Qwilight/System/RGBSystem/BWSystem.cs b/Qwilight/System/RGBSystem/BWSystem.cs index de0bced..c0bdd66 100644 --- a/Qwilight/System/RGBSystem/BWSystem.cs +++ b/Qwilight/System/RGBSystem/BWSystem.cs @@ -211,7 +211,7 @@ ChromaAnimationAPI.SetEffectCustom1D((int)ChromaAnimationAPI.Device1D.Mousepad, _dataPanel); } - public override Color GetMeterColor() => Colors.Green; + public override Color GetGroupColor() => Colors.Green; public override void Dispose() { diff --git a/Qwilight/System/RGBSystem/BaseRGBSystem.cs b/Qwilight/System/RGBSystem/BaseRGBSystem.cs index 99a24c9..69ffdb2 100644 --- a/Qwilight/System/RGBSystem/BaseRGBSystem.cs +++ b/Qwilight/System/RGBSystem/BaseRGBSystem.cs @@ -1,10 +1,16 @@ using Windows.System; using Windows.UI; +using Brush = System.Windows.Media.Brush; namespace Qwilight { public abstract class BaseRGBSystem : IDisposable { + public BaseRGBSystem() + { + GroupPaint = new Lazy(() => DrawingSystem.Instance.GetDefaultPaint(GetGroupColor())); + } + public abstract bool IsAvailable { get; } public abstract bool Init(); @@ -21,7 +27,9 @@ public abstract void OnHandled(); - public abstract Color GetMeterColor(); + public abstract Color GetGroupColor(); + + public Lazy GroupPaint { get; } public abstract void Dispose(); diff --git a/Qwilight/System/RGBSystem/CMSystem.cs b/Qwilight/System/RGBSystem/CMSystem.cs new file mode 100644 index 0000000..7c10d4f --- /dev/null +++ b/Qwilight/System/RGBSystem/CMSystem.cs @@ -0,0 +1,38 @@ +using Microsoft.UI; +using Qwilight.Utilities; +using RGB.NET.Core; +using RGB.NET.Devices.CoolerMaster; +using RGB.NET.Devices.Corsair; +using RGB.NET.Devices.Msi; +using System.IO; +using Color = Windows.UI.Color; + +namespace Qwilight +{ + public sealed class CMSystem : DefaultRGBSystem + { + public static readonly CMSystem Instance = new(); + + CMSystem() + { +#if X64 + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "SDKDLL.dll"), Path.Combine(AppContext.BaseDirectory, "x64", "CMSDK.dll")); +#endif + } + + public override void Load(RGBSurface rgbSystem) + { + rgbSystem.Load(CoolerMasterDeviceProvider.Instance); + } + + public override bool IsAvailable => Configure.Instance.CM; + + public override Color GetGroupColor() => Colors.Purple; + + public override void Toggle() + { + Configure.Instance.CM = !Configure.Instance.CM; + base.Toggle(); + } + } +} diff --git a/Qwilight/System/RGBSystem/DefaultRGBSystem.cs b/Qwilight/System/RGBSystem/DefaultRGBSystem.cs index 2002b5f..afb7485 100644 --- a/Qwilight/System/RGBSystem/DefaultRGBSystem.cs +++ b/Qwilight/System/RGBSystem/DefaultRGBSystem.cs @@ -113,7 +113,7 @@ RGBSurface _rgbSystem; FrozenDictionary _rgbs; - TimerUpdateTrigger _trigger; + FrozenDictionary _rgbEtcs; public abstract void Load(RGBSurface rgbSystem); @@ -125,10 +125,110 @@ Load(_rgbSystem); _rgbSystem.AlignDevices(); _rgbs = _rgbSystem.Leds.ToFrozenDictionary(rgb => rgb.Id, rgb => rgb); - _trigger = new(); - _trigger.Start(); - _rgbSystem.RegisterUpdateTrigger(_trigger); - return true; + _rgbEtcs = _rgbs.Where(rgb => + { + var rgbID = rgb.Key; + for (var i = LedId.Keyboard_Custom1; i <= LedId.Keyboard_Custom128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.Mouse1; i <= LedId.Mouse128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.Headset1; i <= LedId.Headset128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.Mousepad1; i <= LedId.Mousepad128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.LedStripe1; i <= LedId.LedStripe2048; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.LedMatrix1; i <= LedId.LedMatrix2048; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.Mainboard1; i <= LedId.Mainboard512; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.GraphicsCard1; i <= LedId.GraphicsCard128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.DRAM1; i <= LedId.DRAM128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.HeadsetStand1; i <= LedId.HeadsetStand128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.Fan1; i <= LedId.Fan128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.Speaker1; i <= LedId.Speaker128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.Cooler1; i <= LedId.Cooler128; ++i) + { + if (i == rgbID) + { + return true; + } + } + for (var i = LedId.Custom1; i <= LedId.Custom1024; ++i) + { + if (i == rgbID) + { + return true; + } + } + return false; + }).ToFrozenDictionary(); + return _rgbSystem.Devices.Count > 0; } catch { @@ -151,6 +251,10 @@ public override void SetEtcColor(uint value) { + foreach (var rgbEtc in _rgbEtcs.Values) + { + rgbEtc.Color = GetColor(value); + } } public override void OnBeforeHandle() @@ -173,8 +277,6 @@ if (IsHandling) { IsHandling = false; - _rgbSystem.UnregisterUpdateTrigger(_trigger); - _trigger.Dispose(); _rgbSystem.Dispose(); } } diff --git a/Qwilight/System/RGBSystem/GSSystem.cs b/Qwilight/System/RGBSystem/GSSystem.cs index 3c62228..019cac2 100644 --- a/Qwilight/System/RGBSystem/GSSystem.cs +++ b/Qwilight/System/RGBSystem/GSSystem.cs @@ -16,7 +16,7 @@ public override bool IsAvailable => Configure.Instance.GS; - public override Color GetMeterColor() => Colors.White; + public override Color GetGroupColor() => Colors.White; public override void Toggle() { diff --git a/Qwilight/System/RGBSystem/K70System.cs b/Qwilight/System/RGBSystem/K70System.cs index bb4dc13..096bedd 100644 --- a/Qwilight/System/RGBSystem/K70System.cs +++ b/Qwilight/System/RGBSystem/K70System.cs @@ -25,7 +25,7 @@ public override bool IsAvailable => Configure.Instance.K70; - public override Color GetMeterColor() => Colors.Red; + public override Color GetGroupColor() => Colors.Red; public override void Toggle() { diff --git a/Qwilight/System/RGBSystem/LSSystem.cs b/Qwilight/System/RGBSystem/LSSystem.cs index 9be7d9d..2133375 100644 --- a/Qwilight/System/RGBSystem/LSSystem.cs +++ b/Qwilight/System/RGBSystem/LSSystem.cs @@ -175,7 +175,7 @@ } } - public override Color GetMeterColor() => Colors.Cyan; + public override Color GetGroupColor() => Colors.Cyan; public override void Dispose() { diff --git a/Qwilight/System/RGBSystem/MSISystem.cs b/Qwilight/System/RGBSystem/MSISystem.cs new file mode 100644 index 0000000..2c1660f --- /dev/null +++ b/Qwilight/System/RGBSystem/MSISystem.cs @@ -0,0 +1,37 @@ +using Microsoft.UI; +using Qwilight.Utilities; +using RGB.NET.Core; +using RGB.NET.Devices.Corsair; +using RGB.NET.Devices.Msi; +using System.IO; +using Color = Windows.UI.Color; + +namespace Qwilight +{ + public sealed class MSISystem : DefaultRGBSystem + { + public static readonly MSISystem Instance = new(); + + MSISystem() + { +#if X64 + Utility.CopyFile(Path.Combine(QwilightComponent.CPUAssetsEntryPath, "MysticLight_SDK_x64.dll"), Path.Combine(AppContext.BaseDirectory, "x64", "MysticLight_SDK.dll")); +#endif + } + + public override void Load(RGBSurface rgbSystem) + { + rgbSystem.Load(MsiDeviceProvider.Instance); + } + + public override bool IsAvailable => Configure.Instance.MSI; + + public override Color GetGroupColor() => Colors.Red; + + public override void Toggle() + { + Configure.Instance.MSI = !Configure.Instance.MSI; + base.Toggle(); + } + } +} diff --git a/Qwilight/System/RGBSystem/RGBSystem.cs b/Qwilight/System/RGBSystem/RGBSystem.cs index 0754cb0..8446043 100644 --- a/Qwilight/System/RGBSystem/RGBSystem.cs +++ b/Qwilight/System/RGBSystem/RGBSystem.cs @@ -17,7 +17,7 @@ readonly BaseRGBSystem[] _targetSystems = new BaseRGBSystem[] { - BWSystem.Instance, AuraSystem.Instance, K70System.Instance, LSSystem.Instance, GSSystem.Instance, WootingSystem.Instance + BWSystem.Instance, AuraSystem.Instance, K70System.Instance, LSSystem.Instance, GSSystem.Instance, WootingSystem.Instance, MSISystem.Instance, CMSystem.Instance }; readonly object _availableCSX = new(); @@ -78,7 +78,7 @@ } else if (meterValue > 0.0) { - targetSystem.SetEtcColor(GetValueColor(targetSystem.GetMeterColor(), meterValue)); + targetSystem.SetEtcColor(GetValueColor(targetSystem.GetGroupColor(), meterValue)); } } } diff --git a/Qwilight/System/RGBSystem/WootingSystem.cs b/Qwilight/System/RGBSystem/WootingSystem.cs index fe25396..21538e6 100644 --- a/Qwilight/System/RGBSystem/WootingSystem.cs +++ b/Qwilight/System/RGBSystem/WootingSystem.cs @@ -193,7 +193,7 @@ } } - public override Color GetMeterColor() => Colors.Yellow; + public override Color GetGroupColor() => Colors.Yellow; public override void Dispose() { diff --git a/Qwilight/View/Assets/UIAssets.xaml b/Qwilight/View/Assets/UIAssets.xaml index f19511b..4c24e12 100644 --- a/Qwilight/View/Assets/UIAssets.xaml +++ b/Qwilight/View/Assets/UIAssets.xaml @@ -17,7 +17,7 @@ 12.0 20.0 - DeepPink + Gray DeepSkyBlue diff --git a/Qwilight/View/ConfigureWindow/InputConfigureWindow.xaml b/Qwilight/View/ConfigureWindow/InputConfigureWindow.xaml index b3fb936..da6775b 100644 --- a/Qwilight/View/ConfigureWindow/InputConfigureWindow.xaml +++ b/Qwilight/View/ConfigureWindow/InputConfigureWindow.xaml @@ -98,6 +98,22 @@