diff --git a/README.md b/README.md index 5f0570316..42694ef1f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Artemis 2 adds highly configurable support for several games to a range of RGB keyboards, mice and headsets. Artemis 1 is no longer supported and Artemis 2 is in active development. This entire readme and all websites/documents refer to Artemis 2. -### Check out our [Wiki](https://wiki.artemis-rgb.com) and more specifically, the [getting started guide](https://wiki.artemis-rgb.com/en/guides/user/introduction). +### Check out our [Wiki](https://wiki.artemis-rgb.com) and more specifically, the [getting started guide](https://wiki.artemis-rgb.com/en/guides/user). **Pre-release download**: https://github.com/SpoinkyNL/Artemis/releases (pre-release means your profiles may break at any given time!) **Plugin documentation**: https://artemis-rgb.com/docs/ @@ -19,12 +19,20 @@ Artemis 1 is no longer supported and Artemis 2 is in active development. This en #### Want to build? Follow these instructions 1. Create a central folder like ```C:\Repos``` -2. Clone RGB.NET's development branch into ```\RGB.NET``` +2. Clone RGB.NET's [development branch](https://github.com/DarthAffe/RGB.NET/tree/Development) into ```\RGB.NET``` 3. Clone Artemis into ```\Artemis``` 5. Open ```\RGB.NET\RGB.NET.sln``` and build with the default config 4. Open ```\Artemis\src\Artemis.sln``` 5. Restore Nuget packages +##### Alternatively in PowerShell +```powershell +git clone https://github.com/DarthAffe/RGB.NET -b Development RGB.NET +git clone https://github.com/Artemis-RGB/Artemis Artemis +dotnet build .\RGB.NET\RGB.NET.sln +dotnet build .\Artemis\src\Artemis.sln +``` + For an up-to-date overview of what's currently being worked on, see the [Projects](https://github.com/SpoinkyNL/Artemis/projects) page ## Plugin development diff --git a/src/Artemis.Core/Plugins/TimedUpdateRegistration.cs b/src/Artemis.Core/Plugins/TimedUpdateRegistration.cs index 0131f8a58..f93225481 100644 --- a/src/Artemis.Core/Plugins/TimedUpdateRegistration.cs +++ b/src/Artemis.Core/Plugins/TimedUpdateRegistration.cs @@ -2,6 +2,9 @@ using System.Threading.Tasks; using System.Timers; using Artemis.Core.Modules; +using Artemis.Core.Services; +using Ninject; +using Serilog; namespace Artemis.Core { @@ -14,9 +17,12 @@ namespace Artemis.Core private Timer? _timer; private bool _disposed; private readonly object _lock = new(); + private ILogger _logger; internal TimedUpdateRegistration(PluginFeature feature, TimeSpan interval, Action action) { + _logger = CoreService.Kernel.Get(); + Feature = feature; Interval = interval; Action = action; @@ -29,6 +35,8 @@ namespace Artemis.Core internal TimedUpdateRegistration(PluginFeature feature, TimeSpan interval, Func asyncAction) { + _logger = CoreService.Kernel.Get(); + Feature = feature; Interval = interval; AsyncAction = asyncAction; @@ -119,12 +127,19 @@ namespace Artemis.Core if (Feature is Module module && !module.IsUpdateAllowed) return; - if (Action != null) - Action(interval.TotalSeconds); - else if (AsyncAction != null) + try { - Task task = AsyncAction(interval.TotalSeconds); - task.Wait(); + if (Action != null) + Action(interval.TotalSeconds); + else if (AsyncAction != null) + { + Task task = AsyncAction(interval.TotalSeconds); + task.Wait(); + } + } + catch (Exception exception) + { + _logger.Error(exception, "Timed update uncaught exception in plugin {plugin}", Feature.Plugin); } } } diff --git a/src/Artemis.Core/Services/Input/InputService.cs b/src/Artemis.Core/Services/Input/InputService.cs index 7a03343a3..dff8d7d91 100644 --- a/src/Artemis.Core/Services/Input/InputService.cs +++ b/src/Artemis.Core/Services/Input/InputService.cs @@ -47,7 +47,7 @@ namespace Artemis.Core.Services inputProvider.MouseScrollDataReceived += InputProviderOnMouseScrollDataReceived; inputProvider.MouseMoveDataReceived += InputProviderOnMouseMoveDataReceived; _inputProviders.Add(inputProvider); - + inputProvider.OnKeyboardToggleStatusRequested(); } @@ -296,6 +296,17 @@ namespace Artemis.Core.Services return modifiers; } + public void ReleaseAll() + { + foreach (var (device, keys) in _pressedKeys.ToList()) + { + foreach (KeyboardKey keyboardKey in keys) + { + InputProviderOnKeyboardDataReceived(this, new InputProviderKeyboardEventArgs(device, keyboardKey, false)); + } + } + } + #endregion #region Mouse diff --git a/src/Artemis.Core/Services/Input/Interfaces/IInputService.cs b/src/Artemis.Core/Services/Input/Interfaces/IInputService.cs index 46c042e1f..3c2936354 100644 --- a/src/Artemis.Core/Services/Input/Interfaces/IInputService.cs +++ b/src/Artemis.Core/Services/Input/Interfaces/IInputService.cs @@ -35,6 +35,11 @@ namespace Artemis.Core.Services /// void StopIdentify(); + /// + /// Flush all currently pressed buttons/keys + /// + void ReleaseAll(); + #region Events /// diff --git a/src/Artemis.Core/Utilities/CurrentProcessUtilities.cs b/src/Artemis.Core/Utilities/Utilities.cs similarity index 100% rename from src/Artemis.Core/Utilities/CurrentProcessUtilities.cs rename to src/Artemis.Core/Utilities/Utilities.cs diff --git a/src/Artemis.UI/InputProviders/NativeWindowInputProvider.cs b/src/Artemis.UI/InputProviders/NativeWindowInputProvider.cs index 38da46058..c2dfd8c6c 100644 --- a/src/Artemis.UI/InputProviders/NativeWindowInputProvider.cs +++ b/src/Artemis.UI/InputProviders/NativeWindowInputProvider.cs @@ -1,9 +1,14 @@ using System; +using System.Diagnostics; +using System.Linq; using System.Runtime.InteropServices; +using System.Timers; using System.Windows.Forms; using System.Windows.Input; +using System.Windows.Interop; using Artemis.Core; using Artemis.Core.Services; +using Artemis.UI.Utilities; using Linearstar.Windows.RawInput; using Linearstar.Windows.RawInput.Native; using Serilog; @@ -14,11 +19,12 @@ namespace Artemis.UI.InputProviders public class NativeWindowInputProvider : InputProvider { private const int WM_INPUT = 0x00FF; + private readonly IInputService _inputService; - private readonly ILogger _logger; private DateTime _lastMouseUpdate; private SpongeWindow _sponge; + private System.Timers.Timer _taskManagerTimer; public NativeWindowInputProvider(ILogger logger, IInputService inputService) { @@ -28,10 +34,15 @@ namespace Artemis.UI.InputProviders _sponge = new SpongeWindow(); _sponge.WndProcCalled += SpongeOnWndProcCalled; + _taskManagerTimer = new System.Timers.Timer(500); + _taskManagerTimer.Elapsed += TaskManagerTimerOnElapsed; + _taskManagerTimer.Start(); + RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, _sponge.Handle); RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, _sponge.Handle); } + #region Overrides of InputProvider /// @@ -51,6 +62,8 @@ namespace Artemis.UI.InputProviders { _sponge?.DestroyHandle(); _sponge = null; + _taskManagerTimer?.Dispose(); + _taskManagerTimer = null; } base.Dispose(disposing); @@ -75,6 +88,15 @@ namespace Artemis.UI.InputProviders } } + private void TaskManagerTimerOnElapsed(object sender, ElapsedEventArgs e) + { + // If task manager has focus then we can't track keys properly, release everything to avoid them getting stuck + // Same goes for Idle which is what you get when you press Ctrl+Alt+Del + Process active = Process.GetProcessById(WindowUtilities.GetActiveProcessId()); + if (active?.ProcessName == "Taskmgr" || active?.ProcessName == "Idle") + _inputService.ReleaseAll(); + } + #region Keyboard private void HandleKeyboardData(RawInputData data, RawInputKeyboardData keyboardData) diff --git a/src/Artemis.UI/Screens/Settings/Dialogs/UpdateDialogView.xaml b/src/Artemis.UI/Screens/Settings/Dialogs/UpdateDialogView.xaml new file mode 100644 index 000000000..be9bacf79 --- /dev/null +++ b/src/Artemis.UI/Screens/Settings/Dialogs/UpdateDialogView.xaml @@ -0,0 +1,37 @@ + + + + Update available + + + A new Artemis update is available! 🥳 + You are currently running build while the latest build is . + Updating Artemis will give you the latest bug(fixes), features and improvements. + + + +