mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Implemented Witcher 3 mod support (installation of mod tbd)
This commit is contained in:
parent
d42aea85cc
commit
9c70a8a4e2
@ -210,7 +210,7 @@
|
|||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
|
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
|
||||||
|
|||||||
@ -107,11 +107,6 @@
|
|||||||
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MyMemory-x64, Version=1.0.5741.3998, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>.\MyMemory-x64.dll</HintPath>
|
|
||||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="NAudio, Version=1.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="NAudio, Version=1.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NAudio.1.7.3\lib\net35\NAudio.dll</HintPath>
|
<HintPath>..\packages\NAudio.1.7.3\lib\net35\NAudio.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@ -363,7 +358,6 @@
|
|||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput>
|
<LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
<None Include="MyMemory-x64.dll" />
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<AppDesigner Include="Properties\" />
|
<AppDesigner Include="Properties\" />
|
||||||
<None Include="Resources\playerWitcher.ws" />
|
<None Include="Resources\playerWitcher.ws" />
|
||||||
|
|||||||
@ -197,6 +197,8 @@ namespace Artemis.Models
|
|||||||
var process = MemoryHelpers.GetProcessIfRunning(effectModel.ProcessName);
|
var process = MemoryHelpers.GetProcessIfRunning(effectModel.ProcessName);
|
||||||
if (process == null)
|
if (process == null)
|
||||||
continue;
|
continue;
|
||||||
|
if (process.HasExited)
|
||||||
|
continue;
|
||||||
|
|
||||||
ChangeEffect(effectModel);
|
ChangeEffect(effectModel);
|
||||||
foundProcess = true;
|
foundProcess = true;
|
||||||
|
|||||||
@ -92,6 +92,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
|
|
||||||
if (device == null || SpectrumData == null)
|
if (device == null || SpectrumData == null)
|
||||||
return;
|
return;
|
||||||
|
if (!SpectrumData.Any())
|
||||||
|
return;
|
||||||
|
|
||||||
// Start filling the model
|
// Start filling the model
|
||||||
_generating = true;
|
_generating = true;
|
||||||
|
|||||||
@ -1,44 +1,45 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
using System.IO;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Modules.Games.RocketLeague;
|
using Artemis.Modules.Games.RocketLeague;
|
||||||
using Artemis.Settings;
|
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
using Artemis.Utilities.Memory;
|
|
||||||
using Binarysharp.MemoryManagement;
|
|
||||||
using MyMemory;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Witcher3
|
namespace Artemis.Modules.Games.Witcher3
|
||||||
{
|
{
|
||||||
public class Witcher3Model : GameModel
|
public class Witcher3Model : GameModel
|
||||||
{
|
{
|
||||||
private IntPtr _baseAddress;
|
private readonly Regex _signRegex;
|
||||||
private GamePointersCollectionModel _pointer;
|
private readonly Stopwatch _updateSw;
|
||||||
private RemoteProcess _process;
|
|
||||||
private KeyboardRectangle _signRect;
|
private KeyboardRectangle _signRect;
|
||||||
private MemorySharp _mem;
|
private string _witcherSettings;
|
||||||
|
|
||||||
public Witcher3Model(MainModel mainModel, RocketLeagueSettings settings) : base(mainModel)
|
public Witcher3Model(MainModel mainModel, RocketLeagueSettings settings) : base(mainModel)
|
||||||
{
|
{
|
||||||
Name = "Witcher3";
|
Name = "Witcher3";
|
||||||
ProcessName = "witcher3";
|
ProcessName = "witcher3";
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
|
|
||||||
|
_updateSw = new Stopwatch();
|
||||||
|
_signRegex = new Regex("ActiveSign=(.*)", RegexOptions.Compiled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public override bool Enabled()
|
public override bool Enabled()
|
||||||
{
|
{
|
||||||
return true;
|
return true; // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
_process = null;
|
_witcherSettings = null;
|
||||||
|
|
||||||
|
_updateSw.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
@ -49,94 +50,61 @@ namespace Artemis.Modules.Games.Witcher3
|
|||||||
Rotate = true,
|
Rotate = true,
|
||||||
LoopSpeed = 0.5
|
LoopSpeed = 0.5
|
||||||
};
|
};
|
||||||
MemoryHelpers.GetPointers();
|
|
||||||
_pointer = JsonConvert
|
|
||||||
.DeserializeObject<GamePointersCollectionModel>(Offsets.Default.Witcher3);
|
|
||||||
|
|
||||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
// Ensure the config file is found
|
||||||
_baseAddress = tempProcess.MainModule.BaseAddress;
|
var witcherSettings = Environment.GetFolderPath(Environment.SpecialFolder.Personal) +
|
||||||
_process = new RemoteProcess((uint) tempProcess.Id);
|
@"\The Witcher 3\user.settings";
|
||||||
_mem = new MemorySharp(tempProcess);
|
if (File.Exists(witcherSettings))
|
||||||
|
_witcherSettings = witcherSettings;
|
||||||
|
|
||||||
|
_updateSw.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (_process == null)
|
// Witcher effect is very static and reads from disk, don't want to update too often.
|
||||||
|
if (_updateSw.ElapsedMilliseconds < 500)
|
||||||
|
return;
|
||||||
|
_updateSw.Restart();
|
||||||
|
|
||||||
|
if (_witcherSettings == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var processHandle = _process.ProcessHandle;
|
var reader = new StreamReader(File.Open(_witcherSettings,
|
||||||
var addr = MemoryHelpers.FindAddress(processHandle, _baseAddress,
|
FileMode.Open,
|
||||||
_pointer.GameAddresses.First(ga => ga.Description == "Sign").BasePointer,
|
FileAccess.Read,
|
||||||
_pointer.GameAddresses.First(ga => ga.Description == "Sign").Offsets);
|
FileShare.ReadWrite));
|
||||||
|
var configContent = reader.ReadToEnd();
|
||||||
|
reader.Close();
|
||||||
|
|
||||||
var test =
|
var signRes = _signRegex.Match(configContent);
|
||||||
_mem.Modules.MainModule.FindPattern(
|
if (signRes.Groups.Count < 2)
|
||||||
new byte[]
|
return;
|
||||||
{
|
var sign = signRes.Groups[1].Value;
|
||||||
0x88, 0x07, 0x48, 0x8B, 0x5C, 0x24, 0x30, 0x48, 0x83, 0xC4, 0x20, 0x5F, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC2, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x48
|
|
||||||
},
|
|
||||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 0, true);
|
|
||||||
var tessst = _process.MemoryManager.Read<byte>(test.Address);
|
|
||||||
var result = _process.MemoryManager.Read<byte>(addr);
|
|
||||||
|
|
||||||
switch (result)
|
switch (sign)
|
||||||
{
|
{
|
||||||
case 0:
|
case "ST_Aard\r":
|
||||||
// Aard
|
_signRect.Colors = new List<Color> {Color.DeepSkyBlue, Color.Blue};
|
||||||
_signRect.Colors = new List<Color>
|
|
||||||
{
|
|
||||||
Color.DeepSkyBlue,
|
|
||||||
Color.Blue,
|
|
||||||
Color.DeepSkyBlue,
|
|
||||||
Color.Blue
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case "ST_Yrden\r":
|
||||||
// Yrden
|
_signRect.Colors = new List<Color> {Color.Purple, Color.DeepPink};
|
||||||
_signRect.Colors = new List<Color>
|
|
||||||
{
|
|
||||||
Color.Purple,
|
|
||||||
Color.DeepPink,
|
|
||||||
Color.Purple,
|
|
||||||
Color.DeepPink
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case "ST_Igni\r":
|
||||||
// Igni
|
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.Red};
|
||||||
_signRect.Colors = new List<Color>
|
|
||||||
{
|
|
||||||
Color.DarkOrange,
|
|
||||||
Color.Red,
|
|
||||||
Color.DarkOrange,
|
|
||||||
Color.Red
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case "ST_Quen\r":
|
||||||
// Quen
|
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.FromArgb(232, 193, 0)};
|
||||||
_signRect.Colors = new List<Color>
|
|
||||||
{
|
|
||||||
Color.DarkOrange,
|
|
||||||
Color.Yellow,
|
|
||||||
Color.DarkOrange,
|
|
||||||
Color.Yellow
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case "ST_Axii\r":
|
||||||
// Axii
|
_signRect.Colors = new List<Color> {Color.LawnGreen, Color.DarkGreen};
|
||||||
_signRect.Colors = new List<Color>
|
|
||||||
{
|
|
||||||
Color.LawnGreen,
|
|
||||||
Color.DarkGreen,
|
|
||||||
Color.LawnGreen,
|
|
||||||
Color.DarkGreen
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap();
|
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user