mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +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">
|
||||
<dependentAssembly>
|
||||
<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>
|
||||
<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">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</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">
|
||||
<HintPath>..\packages\NAudio.1.7.3\lib\net35\NAudio.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -363,7 +358,6 @@
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="MyMemory-x64.dll" />
|
||||
<None Include="packages.config" />
|
||||
<AppDesigner Include="Properties\" />
|
||||
<None Include="Resources\playerWitcher.ws" />
|
||||
|
||||
@ -197,6 +197,8 @@ namespace Artemis.Models
|
||||
var process = MemoryHelpers.GetProcessIfRunning(effectModel.ProcessName);
|
||||
if (process == null)
|
||||
continue;
|
||||
if (process.HasExited)
|
||||
continue;
|
||||
|
||||
ChangeEffect(effectModel);
|
||||
foundProcess = true;
|
||||
|
||||
@ -92,7 +92,9 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
|
||||
if (device == null || SpectrumData == null)
|
||||
return;
|
||||
|
||||
if (!SpectrumData.Any())
|
||||
return;
|
||||
|
||||
// Start filling the model
|
||||
_generating = true;
|
||||
|
||||
|
||||
@ -1,44 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Games.RocketLeague;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.Utilities.Memory;
|
||||
using Binarysharp.MemoryManagement;
|
||||
using MyMemory;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public class Witcher3Model : GameModel
|
||||
{
|
||||
private IntPtr _baseAddress;
|
||||
private GamePointersCollectionModel _pointer;
|
||||
private RemoteProcess _process;
|
||||
private readonly Regex _signRegex;
|
||||
private readonly Stopwatch _updateSw;
|
||||
private KeyboardRectangle _signRect;
|
||||
private MemorySharp _mem;
|
||||
private string _witcherSettings;
|
||||
|
||||
public Witcher3Model(MainModel mainModel, RocketLeagueSettings settings) : base(mainModel)
|
||||
{
|
||||
Name = "Witcher3";
|
||||
ProcessName = "witcher3";
|
||||
Scale = 4;
|
||||
|
||||
_updateSw = new Stopwatch();
|
||||
_signRegex = new Regex("ActiveSign=(.*)", RegexOptions.Compiled);
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
|
||||
public override bool Enabled()
|
||||
{
|
||||
return true;
|
||||
return true; // TODO
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_process = null;
|
||||
_witcherSettings = null;
|
||||
|
||||
_updateSw.Reset();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
@ -49,94 +50,61 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
Rotate = true,
|
||||
LoopSpeed = 0.5
|
||||
};
|
||||
MemoryHelpers.GetPointers();
|
||||
_pointer = JsonConvert
|
||||
.DeserializeObject<GamePointersCollectionModel>(Offsets.Default.Witcher3);
|
||||
|
||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||
_baseAddress = tempProcess.MainModule.BaseAddress;
|
||||
_process = new RemoteProcess((uint) tempProcess.Id);
|
||||
_mem = new MemorySharp(tempProcess);
|
||||
// Ensure the config file is found
|
||||
var witcherSettings = Environment.GetFolderPath(Environment.SpecialFolder.Personal) +
|
||||
@"\The Witcher 3\user.settings";
|
||||
if (File.Exists(witcherSettings))
|
||||
_witcherSettings = witcherSettings;
|
||||
|
||||
_updateSw.Start();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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 reader = new StreamReader(File.Open(_witcherSettings,
|
||||
FileMode.Open,
|
||||
FileAccess.Read,
|
||||
FileShare.ReadWrite));
|
||||
var configContent = reader.ReadToEnd();
|
||||
reader.Close();
|
||||
|
||||
var test =
|
||||
_mem.Modules.MainModule.FindPattern(
|
||||
new byte[]
|
||||
{
|
||||
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);
|
||||
var signRes = _signRegex.Match(configContent);
|
||||
if (signRes.Groups.Count < 2)
|
||||
return;
|
||||
var sign = signRes.Groups[1].Value;
|
||||
|
||||
switch (result)
|
||||
switch (sign)
|
||||
{
|
||||
case 0:
|
||||
// Aard
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.DeepSkyBlue,
|
||||
Color.Blue,
|
||||
Color.DeepSkyBlue,
|
||||
Color.Blue
|
||||
};
|
||||
case "ST_Aard\r":
|
||||
_signRect.Colors = new List<Color> {Color.DeepSkyBlue, Color.Blue};
|
||||
break;
|
||||
case 1:
|
||||
// Yrden
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.Purple,
|
||||
Color.DeepPink,
|
||||
Color.Purple,
|
||||
Color.DeepPink
|
||||
};
|
||||
case "ST_Yrden\r":
|
||||
_signRect.Colors = new List<Color> {Color.Purple, Color.DeepPink};
|
||||
break;
|
||||
case 2:
|
||||
// Igni
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.DarkOrange,
|
||||
Color.Red,
|
||||
Color.DarkOrange,
|
||||
Color.Red
|
||||
};
|
||||
case "ST_Igni\r":
|
||||
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.Red};
|
||||
break;
|
||||
case 3:
|
||||
// Quen
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.DarkOrange,
|
||||
Color.Yellow,
|
||||
Color.DarkOrange,
|
||||
Color.Yellow
|
||||
};
|
||||
case "ST_Quen\r":
|
||||
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.FromArgb(232, 193, 0)};
|
||||
break;
|
||||
case 4:
|
||||
// Axii
|
||||
_signRect.Colors = new List<Color>
|
||||
{
|
||||
Color.LawnGreen,
|
||||
Color.DarkGreen,
|
||||
Color.LawnGreen,
|
||||
Color.DarkGreen
|
||||
};
|
||||
case "ST_Axii\r":
|
||||
_signRect.Colors = new List<Color> {Color.LawnGreen, Color.DarkGreen};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override Bitmap GenerateBitmap()
|
||||
{
|
||||
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap();
|
||||
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
g.Clear(Color.Transparent);
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user