diff --git a/Artemis/Artemis/App.xaml.cs b/Artemis/Artemis/App.xaml.cs index e2b94fb9c..8b35c5e93 100644 --- a/Artemis/Artemis/App.xaml.cs +++ b/Artemis/Artemis/App.xaml.cs @@ -15,8 +15,8 @@ namespace Artemis { public App() { - if (!IsRunAsAdministrator()) - GeneralHelpers.RunAsAdministrator(); + //if (!IsRunAsAdministrator()) + // GeneralHelpers.RunAsAdministrator(); InitializeComponent(); } diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj index 955cc87d2..632701d8b 100644 --- a/Artemis/Artemis/Artemis.csproj +++ b/Artemis/Artemis/Artemis.csproj @@ -359,6 +359,9 @@ + + OverwatchView.xaml + RocketLeague.settings True @@ -378,6 +381,15 @@ TheDivisionView.xaml + + + Overwatch.settings + True + True + + + + @@ -582,6 +594,10 @@ SettingsSingleFileGenerator TheDivision.Designer.cs + + SettingsSingleFileGenerator + Overwatch.Designer.cs + SettingsSingleFileGenerator Witcher3.Designer.cs @@ -637,6 +653,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Artemis/Artemis/ArtemisBootstrapper.cs b/Artemis/Artemis/ArtemisBootstrapper.cs index 52719ec46..116221d3c 100644 --- a/Artemis/Artemis/ArtemisBootstrapper.cs +++ b/Artemis/Artemis/ArtemisBootstrapper.cs @@ -20,7 +20,7 @@ namespace Artemis public ArtemisBootstrapper() { - CheckDuplicateInstances(); + //CheckDuplicateInstances(); Initialize(); BindSpecialValues(); } diff --git a/Artemis/Artemis/InjectionModules/ArtemisModules.cs b/Artemis/Artemis/InjectionModules/ArtemisModules.cs index 4f013698d..13f0c3772 100644 --- a/Artemis/Artemis/InjectionModules/ArtemisModules.cs +++ b/Artemis/Artemis/InjectionModules/ArtemisModules.cs @@ -7,6 +7,7 @@ using Artemis.Modules.Effects.Debug; using Artemis.Modules.Effects.TypeWave; using Artemis.Modules.Games.CounterStrike; using Artemis.Modules.Games.Dota2; +using Artemis.Modules.Games.Overwatch; using Artemis.Modules.Games.RocketLeague; using Artemis.Modules.Games.TheDivision; using Artemis.Modules.Games.Witcher3; @@ -34,6 +35,7 @@ namespace Artemis.InjectionModules Bind().To().InSingletonScope(); Bind().To().InSingletonScope(); Bind().To().InSingletonScope(); + Bind().To().InSingletonScope(); // Overlays Bind().To().InSingletonScope(); diff --git a/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.Designer.cs b/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.Designer.cs new file mode 100644 index 000000000..48ef16045 --- /dev/null +++ b/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.Designer.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Artemis.Modules.Games.Overwatch { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Overwatch : global::System.Configuration.ApplicationSettingsBase { + + private static Overwatch defaultInstance = ((Overwatch)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Overwatch()))); + + public static Overwatch Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool Enabled { + get { + return ((bool)(this["Enabled"])); + } + set { + this["Enabled"] = value; + } + } + } +} diff --git a/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.settings b/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.settings new file mode 100644 index 000000000..adbc00bca --- /dev/null +++ b/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.settings @@ -0,0 +1,11 @@ + + + + + + + True + + + \ No newline at end of file diff --git a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchDataModel.cs b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchDataModel.cs new file mode 100644 index 000000000..12b9c2879 --- /dev/null +++ b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchDataModel.cs @@ -0,0 +1,8 @@ +using Artemis.Models.Interfaces; + +namespace Artemis.Modules.Games.Overwatch +{ + public class OverwatchDataModel : IGameDataModel + { + } +} \ No newline at end of file diff --git a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs new file mode 100644 index 000000000..cbcab9824 --- /dev/null +++ b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs @@ -0,0 +1,94 @@ +using System.Drawing; +using System.IO; +using System.IO.MemoryMappedFiles; +using Artemis.Managers; +using Artemis.Models; +using Artemis.Models.Profiles; +using Brush = System.Windows.Media.Brush; + +namespace Artemis.Modules.Games.Overwatch +{ + public class OverwatchModel : GameModel + { + public OverwatchModel(MainManager mainManager, OverwatchSettings settings) + : base(mainManager, settings, new OverwatchDataModel()) + { + Name = "Overwatch"; + ProcessName = "notepad"; + Scale = 4; + Enabled = Settings.Enabled; + Initialized = false; + } + + public int Scale { get; set; } + + public override void Dispose() + { + Initialized = false; + } + + public override void Enable() + { + Initialized = true; + } + + public override void Update() + { + var gameDataModel = (OverwatchDataModel) GameDataModel; + var mffData = ReadMmf("overwatchMmf"); + if (mffData == null) + return; + var data = mffData.Split(' '); + } + + private string ReadMmf(string overwatchmff) + { + try + { + // opening not-persistent, pagefile-based memory-mapped file + using (var mmf = MemoryMappedFile.OpenExisting(overwatchmff)) + { + // open the stream to read from the file + using (var stream = mmf.CreateViewStream()) + { + // Read from the shared memory, just for this example we know there is a string + var reader = new BinaryReader(stream); + var res = string.Empty; + string str; + do + { + str = reader.ReadString(); + if (!string.IsNullOrEmpty(str) && str[0] != 0) + res = res + str; + } while (!string.IsNullOrEmpty(str)); + return res; + } + } + } + catch (FileNotFoundException) + { + return null; + //ignored + } + } + + public override Bitmap GenerateBitmap() + { + if (Profile == null || GameDataModel == null) + return null; + + var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(Scale); + return Profile.GenerateBitmap(keyboardRect, GameDataModel, false, true); + } + + public override Brush GenerateMouseBrush() + { + return Profile?.GenerateBrush(GameDataModel, LayerType.Mouse, false, true); + } + + public override Brush GenerateHeadsetBrush() + { + return Profile?.GenerateBrush(GameDataModel, LayerType.Headset, false, true); + } + } +} \ No newline at end of file diff --git a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchSettings.cs b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchSettings.cs new file mode 100644 index 000000000..bb21734fb --- /dev/null +++ b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchSettings.cs @@ -0,0 +1,29 @@ +using Artemis.Models; + +namespace Artemis.Modules.Games.Overwatch +{ + public class OverwatchSettings : GameSettings + { + public OverwatchSettings() + { + Load(); + } + + public sealed override void Load() + { + Enabled = Overwatch.Default.Enabled; + } + + public sealed override void Save() + { + Overwatch.Default.Enabled = Enabled; + + Overwatch.Default.Save(); + } + + public sealed override void ToDefault() + { + Enabled = true; + } + } +} \ No newline at end of file diff --git a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchView.xaml b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchView.xaml new file mode 100644 index 000000000..c999b204f --- /dev/null +++ b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchView.xaml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +