mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Implemented pointer updating from remote JSON file
This commit is contained in:
parent
bceee63cb4
commit
126b73ec4e
@ -4,6 +4,8 @@
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings"
|
||||
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="Artemis.Settings.Offsets" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.Witcher3.Witcher3" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Settings.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
@ -25,10 +27,24 @@
|
||||
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<connectionStrings />
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<Artemis.Settings.Offsets>
|
||||
<setting name="RocketLeague" serializeAs="String">
|
||||
<value>{"Game":"RocketLeague","GameVersion":"1.10","GameAddresses":[{"Description":"Boost","BasePointer":{"value":21998084},"Offsets":[88,1452,1780,540]}]}</value>
|
||||
</setting>
|
||||
<setting name="Witcher3" serializeAs="String">
|
||||
<value>{"Game":"Witcher3","GameVersion":"1.11","GameAddresses":[{"Description":"Sign","BasePointer":{"value":42942304},"Offsets":[40,16,32,3008]}]}</value>
|
||||
</setting>
|
||||
</Artemis.Settings.Offsets>
|
||||
<Artemis.Modules.Games.Witcher3.Witcher3>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.Witcher3.Witcher3>
|
||||
<Artemis.Modules.Effects.AudioVisualizer.AudioVisualization>
|
||||
<setting name="Sensitivity" serializeAs="String">
|
||||
<value>4</value>
|
||||
@ -74,6 +90,9 @@
|
||||
<setting name="LowHpEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.CounterStrike.CounterStrike>
|
||||
<Artemis.Settings.CounterStrike>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
@ -175,6 +194,9 @@
|
||||
<setting name="LastKeyboard" serializeAs="String">
|
||||
<value>Logitech G910 Orion Spark RGB</value>
|
||||
</setting>
|
||||
<setting name="EnablePointersUpdate" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Settings.General>
|
||||
</userSettings>
|
||||
<runtime>
|
||||
|
||||
@ -84,7 +84,11 @@
|
||||
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MyMemory-x64">
|
||||
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="MyMemory-x64, Version=1.0.5741.3998, Culture=neutral, processorArchitecture=AMD64">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>E:\Downloads\Chome Downloads\MyMemory-x64.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NAudio, Version=1.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@ -168,6 +172,7 @@
|
||||
<Compile Include="KeyboardProviders\Logitech\Utilities\OrionUtilities.cs" />
|
||||
<Compile Include="KeyboardProviders\ProviderHelper.cs" />
|
||||
<Compile Include="Models\EffectModel.cs" />
|
||||
<Compile Include="Models\GamePointersCollectionModel.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualization.Designer.cs">
|
||||
<DependentUpon>AudioVisualization.settings</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
@ -196,6 +201,11 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Witcher3.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3Model.cs" />
|
||||
<Compile Include="Models\MainModel.cs" />
|
||||
<Compile Include="Models\OverlayModel.cs" />
|
||||
@ -218,6 +228,11 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>General.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Settings\Offsets.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Offsets.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\Audio\FftEventArgs.cs" />
|
||||
<Compile Include="Utilities\Audio\SampleAggregator.cs" />
|
||||
<Compile Include="Utilities\ColorHelpers.cs" />
|
||||
@ -310,12 +325,20 @@
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>RocketLeague.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Modules\Games\Witcher3\Witcher3.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Witcher3.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Modules\Overlays\VolumeDisplay\VolumeDisplay.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<AppDesigner Include="Properties\" />
|
||||
<None Include="Settings\Offsets.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Offsets.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Resource Include="Resources\Entypo.ttf" />
|
||||
<None Include="Settings\General.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
|
||||
24
Artemis/Artemis/Models/GamePointersCollectionModel.cs
Normal file
24
Artemis/Artemis/Models/GamePointersCollectionModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
public class GamePointersCollectionModel
|
||||
{
|
||||
public string Game { get; set; }
|
||||
public string GameVersion { get; set; }
|
||||
public List<GamePointer> GameAddresses { get; set; }
|
||||
}
|
||||
|
||||
public class GamePointer
|
||||
{
|
||||
public string Description { get; set; }
|
||||
public IntPtr BasePointer { get; set; }
|
||||
public int[] Offsets { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return Offsets.Aggregate(BasePointer.ToString("X"), (current, offset) => current + $"+{offset.ToString("X")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Events;
|
||||
using Artemis.KeyboardProviders;
|
||||
using Artemis.Settings;
|
||||
@ -34,8 +35,8 @@ namespace Artemis.Models
|
||||
}
|
||||
|
||||
public EffectModel ActiveEffect { get; set; }
|
||||
public List<EffectModel> EffectModels { get; set; }
|
||||
public KeyboardProvider ActiveKeyboard { get; set; }
|
||||
public List<EffectModel> EffectModels { get; set; }
|
||||
public List<KeyboardProvider> KeyboardProviders { get; set; }
|
||||
|
||||
public GameStateWebServer GameStateWebServer { get; set; }
|
||||
@ -104,6 +105,11 @@ namespace Artemis.Models
|
||||
if (effectModel is OverlayModel)
|
||||
throw new ArgumentException("Can't set an Overlay effect as the active effect");
|
||||
|
||||
// Game models are only used if they are enabled
|
||||
var gameModel = effectModel as GameModel;
|
||||
if (gameModel != null)
|
||||
if (!gameModel.Enabled)
|
||||
return;
|
||||
|
||||
if (ActiveEffect != null && effectModel.Name == ActiveEffect.Name)
|
||||
return;
|
||||
|
||||
@ -23,6 +23,18 @@ namespace Artemis.Modules.Games.CounterStrike {
|
||||
}
|
||||
}
|
||||
|
||||
[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;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
|
||||
@ -54,13 +54,13 @@
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.AmmoEnabled, Mode=TwoWay}"
|
||||
Header="Ammo display"
|
||||
OnLabel="Yes" OffLabel="No"
|
||||
Margin="5,3,0,0" Width="125" />
|
||||
Margin="5,3,0,0" Width="180" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Left">
|
||||
<Label FontSize="16" Content="Ammo main color" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="181" />
|
||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="180" />
|
||||
<xctk:ColorPicker x:Name="MainColor"
|
||||
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoMainColor, Mode=TwoWay}" Margin="5,0,0,0" />
|
||||
</StackPanel>
|
||||
@ -68,7 +68,7 @@
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left">
|
||||
<Label FontSize="16" Content="Ammo secondary color" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="181" />
|
||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="180" />
|
||||
<xctk:ColorPicker x:Name="SecondaryColor"
|
||||
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoSecondaryColor, Mode=TwoWay}" Margin="5,0,0,0" />
|
||||
</StackPanel>
|
||||
@ -78,7 +78,7 @@
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.SmokeEnabled, Mode=TwoWay}"
|
||||
Header="Smoked effect"
|
||||
OnLabel="Yes" OffLabel="No"
|
||||
Margin="5,3,0,0" Width="125" />
|
||||
Margin="5,3,0,0" Width="180" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
@ -86,7 +86,7 @@
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.FlashEnabled, Mode=TwoWay}"
|
||||
Header="Flashed effect"
|
||||
OnLabel="Yes" OffLabel="No"
|
||||
Margin="5,3,0,0" Width="125" />
|
||||
Margin="5,3,0,0" Width="180" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="5"
|
||||
Grid.Column="0"
|
||||
@ -94,7 +94,7 @@
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.TeamColorEnabled, Mode=TwoWay}"
|
||||
Header="Team colors"
|
||||
OnLabel="Yes" OffLabel="No"
|
||||
Margin="5,3,0,0" Width="125" />
|
||||
Margin="5,3,0,0" Width="180" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
@ -102,7 +102,7 @@
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.LowHpEnabled, Mode=TwoWay}"
|
||||
Header="Low HP effect"
|
||||
OnLabel="Yes" OffLabel="No"
|
||||
Margin="5,3,0,0" Width="125" />
|
||||
Margin="5,3,0,0" Width="180" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="0" Grid.Row="6" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
|
||||
@ -1,118 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Models;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.Utilities.Memory;
|
||||
using MyMemory;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
public class RocketLeagueModel : GameModel
|
||||
{
|
||||
private readonly KeyboardRectangle _boostRect;
|
||||
|
||||
private int _boostAmount;
|
||||
private bool _boostGrowing;
|
||||
private int _previousBoost;
|
||||
|
||||
private Memory _memory;
|
||||
private GamePointersCollectionModel _pointer;
|
||||
|
||||
public RocketLeagueModel(RocketLeagueSettings settings)
|
||||
{
|
||||
Name = "RocketLeague";
|
||||
ProcessName = "RocketLeague";
|
||||
Scale = 4;
|
||||
|
||||
Settings = settings;
|
||||
BoostRectangle = new KeyboardRectangle(Scale, 0, 0, Scale*21, Scale*8,
|
||||
_boostRect = new KeyboardRectangle(Scale, 0, 0, Scale*21, Scale*8,
|
||||
new List<Color>
|
||||
{
|
||||
ColorHelpers.MediaColorToDrawingColor(Settings.MainColor),
|
||||
ColorHelpers.MediaColorToDrawingColor(Settings.SecondaryColor)
|
||||
ColorHelpers.MediaColorToDrawingColor(settings.MainColor),
|
||||
ColorHelpers.MediaColorToDrawingColor(settings.SecondaryColor)
|
||||
}, LinearGradientMode.Horizontal);
|
||||
|
||||
Enabled = Settings.Enabled;
|
||||
Enabled = settings.Enabled;
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
|
||||
public RocketLeagueSettings Settings { get; set; }
|
||||
|
||||
private int BoostAmount { get; set; }
|
||||
private KeyboardRectangle BoostRectangle { get; }
|
||||
|
||||
private Process Process { get; set; }
|
||||
|
||||
private int PreviousBoost { get; set; }
|
||||
|
||||
|
||||
private bool BoostGrowing { get; set; }
|
||||
|
||||
private Memory Memory { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Process = null;
|
||||
Memory = null;
|
||||
_memory = null;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Process = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||
Memory = new Memory(Process);
|
||||
MemoryHelpers.GetPointers();
|
||||
_pointer = JsonConvert
|
||||
.DeserializeObject<GamePointersCollectionModel>(Offsets.Default.RocketLeague);
|
||||
|
||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||
_memory = new Memory(tempProcess);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (BoostGrowing)
|
||||
if (_boostGrowing)
|
||||
return;
|
||||
if (Memory == null)
|
||||
if (_memory == null)
|
||||
return;
|
||||
|
||||
// TODO: Get address from web on startup
|
||||
var boostAddress = Memory.GetAddress("\"RocketLeague.exe\"+014FAA04+58+5ac+6f4+21c");
|
||||
var boostFloat = Memory.ReadFloat(boostAddress)*100/3;
|
||||
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
|
||||
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
|
||||
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;
|
||||
|
||||
PreviousBoost = BoostAmount;
|
||||
BoostAmount = (int) Math.Ceiling(boostFloat);
|
||||
_previousBoost = _boostAmount;
|
||||
_boostAmount = (int) Math.Ceiling(boostFloat);
|
||||
|
||||
// Take care of any reading errors resulting in an OutOfMemory on draw
|
||||
if (BoostAmount < 0)
|
||||
BoostAmount = 0;
|
||||
if (BoostAmount > 100)
|
||||
BoostAmount = 100;
|
||||
if (_boostAmount < 0)
|
||||
_boostAmount = 0;
|
||||
if (_boostAmount > 100)
|
||||
_boostAmount = 100;
|
||||
|
||||
BoostRectangle.Width = (int) Math.Ceiling(((Scale*21)/100.00)*BoostAmount);
|
||||
_boostRect.Width = (int) Math.Ceiling(((Scale*21)/100.00)*_boostAmount);
|
||||
|
||||
Task.Run(() => GrowIfHigher());
|
||||
}
|
||||
|
||||
private void GrowIfHigher()
|
||||
{
|
||||
if (BoostAmount <= PreviousBoost || BoostGrowing)
|
||||
if (_boostAmount <= _previousBoost || _boostGrowing)
|
||||
return;
|
||||
|
||||
BoostGrowing = true;
|
||||
_boostGrowing = true;
|
||||
const int amountOfSteps = 6;
|
||||
|
||||
var difference = BoostAmount - PreviousBoost;
|
||||
var difference = _boostAmount - _previousBoost;
|
||||
var differenceStep = difference/amountOfSteps;
|
||||
var differenceStepRest = difference%amountOfSteps;
|
||||
BoostAmount = PreviousBoost;
|
||||
BoostRectangle.Width = (int) Math.Ceiling(((Scale*21)/100.00)*BoostAmount);
|
||||
_boostAmount = _previousBoost;
|
||||
_boostRect.Width = (int) Math.Ceiling(((Scale*21)/100.00)*_boostAmount);
|
||||
|
||||
for (var i = 0; i < amountOfSteps; i++)
|
||||
{
|
||||
if (differenceStepRest > 0)
|
||||
{
|
||||
differenceStepRest -= 1;
|
||||
BoostAmount += 1;
|
||||
BoostRectangle.Width = (int) Math.Ceiling(((Scale*21)/100.00)*BoostAmount);
|
||||
_boostAmount += 1;
|
||||
_boostRect.Width = (int) Math.Ceiling(((Scale*21)/100.00)*_boostAmount);
|
||||
}
|
||||
BoostAmount += differenceStep;
|
||||
BoostRectangle.Width = (int) Math.Ceiling(((Scale*21)/100.00)*BoostAmount);
|
||||
_boostAmount += differenceStep;
|
||||
_boostRect.Width = (int) Math.Ceiling(((Scale*21)/100.00)*_boostAmount);
|
||||
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
|
||||
BoostGrowing = false;
|
||||
_boostGrowing = false;
|
||||
}
|
||||
|
||||
public override Bitmap GenerateBitmap()
|
||||
@ -122,7 +122,7 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
g.Clear(Color.Transparent);
|
||||
BoostRectangle.Draw(g);
|
||||
_boostRect.Draw(g);
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
38
Artemis/Artemis/Modules/Games/Witcher3/Witcher3.Designer.cs
generated
Normal file
38
Artemis/Artemis/Modules/Games/Witcher3/Witcher3.Designer.cs
generated
Normal file
@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3 {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Witcher3 : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Witcher3 defaultInstance = ((Witcher3)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Witcher3())));
|
||||
|
||||
public static Witcher3 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Artemis/Artemis/Modules/Games/Witcher3/Witcher3.settings
Normal file
9
Artemis/Artemis/Modules/Games/Witcher3/Witcher3.settings
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -2,74 +2,75 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Games.RocketLeague;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.Utilities.Memory;
|
||||
using MyMemory;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public class Witcher3Model : GameModel
|
||||
{
|
||||
// TODO: Update for 1.12
|
||||
private readonly KeyboardRectangle _signRect;
|
||||
|
||||
private IntPtr _baseAddress;
|
||||
private GamePointersCollectionModel _pointer;
|
||||
private RemoteProcess _process;
|
||||
|
||||
public Witcher3Model(RocketLeagueSettings settings)
|
||||
{
|
||||
Name = "Witcher3";
|
||||
ProcessName = "witcher3";
|
||||
Scale = 4;
|
||||
|
||||
Settings = settings;
|
||||
SignRect = new KeyboardRectangle(Scale, 0, 0, 84, 24, new List<Color>(), LinearGradientMode.Horizontal)
|
||||
_signRect = new KeyboardRectangle(Scale, 0, 0, 84, 24, new List<Color>(), LinearGradientMode.Horizontal)
|
||||
{
|
||||
Rotate = true,
|
||||
LoopSpeed = 0.5
|
||||
};
|
||||
|
||||
Enabled = Settings.Enabled;
|
||||
Enabled = settings.Enabled;
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public RocketLeagueSettings Settings { get; set; }
|
||||
|
||||
public KeyboardRectangle SignRect { get; set; }
|
||||
|
||||
private RemoteProcess Process { get; set; }
|
||||
private Memory Memory { get; set; }
|
||||
|
||||
public IntPtr BaseAddress { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Process = null;
|
||||
Memory = null;
|
||||
_process = null;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
MemoryHelpers.GetPointers();
|
||||
_pointer = JsonConvert
|
||||
.DeserializeObject<GamePointersCollectionModel>(Offsets.Default.Witcher3);
|
||||
|
||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||
BaseAddress = tempProcess.MainModule.BaseAddress;
|
||||
Process = new RemoteProcess((uint) tempProcess.Id);
|
||||
_baseAddress = tempProcess.MainModule.BaseAddress;
|
||||
_process = new RemoteProcess((uint) tempProcess.Id);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (Process == null)
|
||||
if (_process == null)
|
||||
return;
|
||||
|
||||
// TODO: Get address from web on startup
|
||||
var processHandle = Process.ProcessHandle;
|
||||
var baseAddress = (IntPtr) 0x028F3F60;
|
||||
int[] offsets = {0x28, 0x10, 0x20, 0xbc0};
|
||||
var processHandle = _process.ProcessHandle;
|
||||
var addr = MemoryHelpers.FindAddress(processHandle, _baseAddress,
|
||||
_pointer.GameAddresses.First(ga => ga.Description == "Sign").BasePointer,
|
||||
_pointer.GameAddresses.First(ga => ga.Description == "Sign").Offsets);
|
||||
|
||||
var addr = MemoryHelpers.FindAddress(processHandle, BaseAddress, baseAddress, offsets);
|
||||
var result = Process.MemoryManager.Read<byte>(addr);
|
||||
var result = _process.MemoryManager.Read<byte>(addr);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case 0:
|
||||
// Aard
|
||||
SignRect.Colors = new List<Color>
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.DeepSkyBlue,
|
||||
Color.Blue,
|
||||
@ -79,7 +80,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
break;
|
||||
case 1:
|
||||
// Yrden
|
||||
SignRect.Colors = new List<Color>
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.Purple,
|
||||
Color.DeepPink,
|
||||
@ -89,7 +90,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
break;
|
||||
case 2:
|
||||
// Igni
|
||||
SignRect.Colors = new List<Color>
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.DarkOrange,
|
||||
Color.Red,
|
||||
@ -99,7 +100,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
break;
|
||||
case 3:
|
||||
// Quen
|
||||
SignRect.Colors = new List<Color>
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.DarkOrange,
|
||||
Color.Yellow,
|
||||
@ -109,7 +110,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
break;
|
||||
case 4:
|
||||
// Axii
|
||||
SignRect.Colors = new List<Color>
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.LawnGreen,
|
||||
Color.DarkGreen,
|
||||
@ -126,7 +127,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
g.Clear(Color.Transparent);
|
||||
SignRect.Draw(g);
|
||||
_signRect.Draw(g);
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@ -5,7 +5,39 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<TextBlock Text="{Binding Content}" />
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
||||
<Label FontSize="20" Style="{DynamicResource DescriptionHeaderStyle}" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Colors the keyboard according to the sign Gerald is using." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" VerticalAlignment="Top">
|
||||
<Label FontSize="16"
|
||||
Style="{DynamicResource DescriptionHeaderStyle}"
|
||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Height="79" Margin="0,10,0,0">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Note: Requires patch 1.12. When a new patch is released Artemis will automatically be adjusted for the latest version."
|
||||
FontStyle="Italic" FontSize="12" />
|
||||
|
||||
</Label.Content>
|
||||
</Label>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
12
Artemis/Artemis/Settings/General.Designer.cs
generated
12
Artemis/Artemis/Settings/General.Designer.cs
generated
@ -46,5 +46,17 @@ namespace Artemis.Settings {
|
||||
this["LastKeyboard"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool EnablePointersUpdate {
|
||||
get {
|
||||
return ((bool)(this["EnablePointersUpdate"]));
|
||||
}
|
||||
set {
|
||||
this["EnablePointersUpdate"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LastEffect" Type="System.String" Scope="User">
|
||||
@ -10,5 +8,8 @@
|
||||
<Setting Name="LastKeyboard" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Logitech G910 Orion Spark RGB</Value>
|
||||
</Setting>
|
||||
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
52
Artemis/Artemis/Settings/Offsets.Designer.cs
generated
Normal file
52
Artemis/Artemis/Settings/Offsets.Designer.cs
generated
Normal file
@ -0,0 +1,52 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Settings {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Offsets : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Offsets defaultInstance = ((Offsets)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Offsets())));
|
||||
|
||||
public static Offsets Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("{\"Game\":\"RocketLeague\",\"GameVersion\":\"1.10\",\"GameAddresses\":[{\"Description\":\"Boos" +
|
||||
"t\",\"BasePointer\":{\"value\":21998084},\"Offsets\":[88,1452,1780,540]}]}")]
|
||||
public string RocketLeague {
|
||||
get {
|
||||
return ((string)(this["RocketLeague"]));
|
||||
}
|
||||
set {
|
||||
this["RocketLeague"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("{\"Game\":\"Witcher3\",\"GameVersion\":\"1.11\",\"GameAddresses\":[{\"Description\":\"Sign\",\"B" +
|
||||
"asePointer\":{\"value\":42942304},\"Offsets\":[40,16,32,3008]}]}")]
|
||||
public string Witcher3 {
|
||||
get {
|
||||
return ((string)(this["Witcher3"]));
|
||||
}
|
||||
set {
|
||||
this["Witcher3"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Artemis/Artemis/Settings/Offsets.settings
Normal file
12
Artemis/Artemis/Settings/Offsets.settings
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="Offsets">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="RocketLeague" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">{"Game":"RocketLeague","GameVersion":"1.10","GameAddresses":[{"Description":"Boost","BasePointer":{"value":21998084},"Offsets":[88,1452,1780,540]}]}</Value>
|
||||
</Setting>
|
||||
<Setting Name="Witcher3" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">{"Game":"Witcher3","GameVersion":"1.11","GameAddresses":[{"Description":"Sign","BasePointer":{"value":42942304},"Offsets":[40,16,32,3008]}]}</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -1,6 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using Artemis.Models;
|
||||
using Artemis.Settings;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Utilities.Memory
|
||||
{
|
||||
@ -37,5 +43,40 @@ namespace Artemis.Utilities.Memory
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
public static void GetPointers()
|
||||
{
|
||||
if (!General.Default.EnablePointersUpdate)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
var jsonClient = new WebClient();
|
||||
var json = jsonClient
|
||||
.DownloadString("https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json");
|
||||
|
||||
// Get a list of pointers
|
||||
var pointers = JsonConvert.DeserializeObject<List<GamePointersCollectionModel>>(json);
|
||||
|
||||
// Assign each pointer to the settings file
|
||||
var rlPointers = JsonConvert.SerializeObject(pointers.FirstOrDefault(p => p.Game == "RocketLeague"));
|
||||
if (rlPointers != null)
|
||||
{
|
||||
Offsets.Default.RocketLeague = rlPointers;
|
||||
Offsets.Default.Save();
|
||||
}
|
||||
|
||||
var witcherPointers = JsonConvert.SerializeObject(pointers.FirstOrDefault(p => p.Game == "Witcher3"));
|
||||
if (witcherPointers != null)
|
||||
{
|
||||
Offsets.Default.Witcher3 = witcherPointers;
|
||||
Offsets.Default.Save();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user