mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed LUA drawing scale on preview
Fixed LUA conditions when not using hotkeys Added Assetto Corsa module
This commit is contained in:
parent
b53e08fdcb
commit
e8e6e084a7
@ -131,6 +131,10 @@
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AssettoCorsaSharedMemory, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>lib\AssettoCorsaSharedMemory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Betwixt, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Betwixt.1.4.1\lib\net35\Betwixt.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -371,6 +375,13 @@
|
||||
<Compile Include="Modules\Abstract\ModuleModel.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleSettings.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleViewModel.cs" />
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaDataModel.cs" />
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaModel.cs" />
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaSettings.cs" />
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaView.xaml.cs">
|
||||
<DependentUpon>AssettoCorsaView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Games\AssettoCorsa\AssettoCorsaViewModel.cs" />
|
||||
<Compile Include="Modules\General\GeneralProfile\PerformanceInfo.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\Data\Ets2TelemetryData.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\Data\Ets2TelemetryDataReader.cs" />
|
||||
@ -784,7 +795,7 @@
|
||||
<AppDesigner Include="Properties\" />
|
||||
<Resource Include="Resources\slkscr.ttf" />
|
||||
<Resource Include="Resources\bow.png" />
|
||||
<Content Include="lib\CUE.NET.dll" />
|
||||
<Content Include="lib\AssettoCorsaSharedMemory.dll" />
|
||||
<Content Include="lib\Ets2SdkClient.dll" />
|
||||
<Content Include="lib\SDKDLL.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
@ -831,6 +842,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Modules\Games\AssettoCorsa\AssettoCorsaView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Modules\General\Bubbles\BubblesView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@ -0,0 +1,164 @@
|
||||
using Artemis.Modules.Abstract;
|
||||
using AssettoCorsaSharedMemory;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class AssettoCorsaDataModel : ModuleDataModel
|
||||
{
|
||||
public AssettoCorsaDataModel()
|
||||
{
|
||||
Physics = new Physics();
|
||||
Interface = new Graphics();
|
||||
StaticInfo = new StaticInfo();
|
||||
}
|
||||
|
||||
public Physics Physics { get; set; }
|
||||
public Graphics Interface { get; set; }
|
||||
public StaticInfo StaticInfo { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Physics
|
||||
{
|
||||
public float Abs { get; set; }
|
||||
public float Gas { get; set; }
|
||||
public float Brake { get; set; }
|
||||
public float Fuel { get; set; }
|
||||
public int Gear { get; set; }
|
||||
public int Rpms { get; set; }
|
||||
public float SteerAngle { get; set; }
|
||||
public float SpeedKmh { get; set; }
|
||||
public float[] Velocity { get; set; }
|
||||
public float[] AccG { get; set; }
|
||||
public float[] WheelSlip { get; set; }
|
||||
public float[] WheelLoad { get; set; }
|
||||
public float[] WheelsPressure { get; set; }
|
||||
public float[] WheelAngularSpeed { get; set; }
|
||||
public float[] TyreWear { get; set; }
|
||||
public float[] TyreDirtyLevel { get; set; }
|
||||
public float[] TyreCoreTemperature { get; set; }
|
||||
public float[] CamberRad { get; set; }
|
||||
public float[] SuspensionTravel { get; set; }
|
||||
public float Drs { get; set; }
|
||||
public float TC { get; set; }
|
||||
public float Heading { get; set; }
|
||||
public float Pitch { get; set; }
|
||||
public float Roll { get; set; }
|
||||
public float CgHeight { get; set; }
|
||||
public float[] CarDamage { get; set; }
|
||||
public int NumberOfTyresOut { get; set; }
|
||||
public int PitLimiterOn { get; set; }
|
||||
public float KersCharge { get; set; }
|
||||
public float KersInput { get; set; }
|
||||
public int AutoShifterOn { get; set; }
|
||||
public float[] RideHeight { get; set; }
|
||||
public float TurboBoost { get; set; }
|
||||
public float Ballast { get; set; }
|
||||
public float AirDensity { get; set; }
|
||||
public float AirTemp { get; set; }
|
||||
public float RoadTemp { get; set; }
|
||||
public float[] LocalAngularVelocity { get; set; }
|
||||
public float FinalFF { get; set; }
|
||||
public float PerformanceMeter { get; set; }
|
||||
public int EngineBrake { get; set; }
|
||||
public int ErsRecoveryLevel { get; set; }
|
||||
public int ErsPowerLevel { get; set; }
|
||||
public int ErsHeatCharging { get; set; }
|
||||
public int ErsisCharging { get; set; }
|
||||
public float KersCurrentKJ { get; set; }
|
||||
public int DrsAvailable { get; set; }
|
||||
public int DrsEnabled { get; set; }
|
||||
public float[] BrakeTemp { get; set; }
|
||||
public float Clutch { get; set; }
|
||||
public float[] TyreTempI { get; set; }
|
||||
public float[] TyreTempM { get; set; }
|
||||
public float[] TyreTempO { get; set; }
|
||||
public int IsAIControlled { get; set; }
|
||||
public Coordinates[] TyreContactPoint { get; set; }
|
||||
public Coordinates[] TyreContactNormal { get; set; }
|
||||
public Coordinates[] TyreContactHeading { get; set; }
|
||||
public float BrakeBias { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Graphics
|
||||
{
|
||||
public AC_STATUS Status { get; set; }
|
||||
public AC_SESSION_TYPE Session { get; set; }
|
||||
public string CurrentTime { get; set; }
|
||||
public string LastTime { get; set; }
|
||||
public string BestTime { get; set; }
|
||||
public string Split { get; set; }
|
||||
public int Position { get; set; }
|
||||
public int iCurrentTime { get; set; }
|
||||
public int iBestTime { get; set; }
|
||||
public int iLastTime { get; set; }
|
||||
public float SessionTimeLeft { get; set; }
|
||||
public float DistanceTraveled { get; set; }
|
||||
public int IsInPit { get; set; }
|
||||
public int CurrentSectorIndex { get; set; }
|
||||
public int LastSectorTime { get; set; }
|
||||
public int NumberOfLaps { get; set; }
|
||||
public string TyreCompound { get; set; }
|
||||
public float ReplayTimeMultiplier { get; set; }
|
||||
public float NormalizedCarPosition { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class StaticInfo
|
||||
{
|
||||
public StaticInfo()
|
||||
{
|
||||
Session = new Session();
|
||||
Car = new Car();
|
||||
}
|
||||
|
||||
public string SMVersion { get; set; }
|
||||
public string ACVersion { get; set; }
|
||||
public Session Session { get; set; }
|
||||
public Car Car { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Session
|
||||
{
|
||||
public int NumberOfSessions { get; set; }
|
||||
public int NumCars { get; set; }
|
||||
public string Track { get; set; }
|
||||
public string TrackConfiguration { get; set; }
|
||||
public float TrackSPlineLength { get; set; }
|
||||
public string PlayerName { get; set; }
|
||||
public string PlayerSurname { get; set; }
|
||||
public string PlayerNick { get; set; }
|
||||
public int SectorCount { get; set; }
|
||||
public int PenaltiesEnabled { get; set; }
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Car
|
||||
{
|
||||
public string CarModel { get; set; }
|
||||
public float MaxTorque { get; set; }
|
||||
public float MaxPower { get; set; }
|
||||
public int MaxRpm { get; set; }
|
||||
public float MaxFuel { get; set; }
|
||||
public float[] SuspensionMaxTravel { get; set; }
|
||||
public float[] TyreRadius { get; set; }
|
||||
public float MaxTurboBoost { get; set; }
|
||||
public float AidFuelRate { get; set; }
|
||||
public float AidTireRate { get; set; }
|
||||
public float AidMechanicalDamage { get; set; }
|
||||
public int AidAllowTyreBlankets { get; set; }
|
||||
public float AidStability { get; set; }
|
||||
public int AidAutoClutch { get; set; }
|
||||
public int AidAutoBlip { get; set; }
|
||||
public int HasDRS { get; set; }
|
||||
public int HasERS { get; set; }
|
||||
public int HasKERS { get; set; }
|
||||
public float KersMaxJoules { get; set; }
|
||||
public int EngineBrakeSettingsCount { get; set; }
|
||||
public int ErsPowerControllerCount { get; set; }
|
||||
}
|
||||
}
|
||||
173
Artemis/Artemis/Modules/Games/AssettoCorsa/AssettoCorsaModel.cs
Normal file
173
Artemis/Artemis/Modules/Games/AssettoCorsa/AssettoCorsaModel.cs
Normal file
@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using AssettoCorsaSharedMemory;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
public class AssettoCorsaModel : ModuleModel
|
||||
{
|
||||
private AssettoCorsaSharedMemory.AssettoCorsa _ac;
|
||||
|
||||
public AssettoCorsaModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
|
||||
{
|
||||
Settings = SettingsProvider.Load<AssettoCorsaSettings>();
|
||||
DataModel = new AssettoCorsaDataModel();
|
||||
ProcessNames.Add("AssettoCorsa");
|
||||
}
|
||||
|
||||
public override string Name => "AssettoCorsa";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
_ac = new AssettoCorsaSharedMemory.AssettoCorsa {PhysicsInterval = 40};
|
||||
// The event handlers map their respecive enums to the datamodel, not pretty but fastest way possible
|
||||
_ac.StaticInfoUpdated += AcOnStaticInfoUpdated;
|
||||
_ac.GraphicsUpdated += AcOnGraphicsUpdated;
|
||||
_ac.PhysicsUpdated += AcOnPhysicsUpdated;
|
||||
_ac.Start();
|
||||
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
_ac.Stop();
|
||||
_ac = null;
|
||||
}
|
||||
|
||||
private void AcOnStaticInfoUpdated(object sender, StaticInfoEventArgs e)
|
||||
{
|
||||
var dataModel = (AssettoCorsaDataModel)DataModel;
|
||||
dataModel.StaticInfo.SMVersion = e.StaticInfo.SMVersion;
|
||||
dataModel.StaticInfo.ACVersion = e.StaticInfo.ACVersion;
|
||||
dataModel.StaticInfo.Session.NumberOfSessions = e.StaticInfo.NumberOfSessions;
|
||||
dataModel.StaticInfo.Session.NumCars = e.StaticInfo.NumCars;
|
||||
dataModel.StaticInfo.Session.Track = e.StaticInfo.Track;
|
||||
dataModel.StaticInfo.Session.TrackConfiguration = e.StaticInfo.TrackConfiguration;
|
||||
dataModel.StaticInfo.Session.TrackSPlineLength = e.StaticInfo.TrackSPlineLength;
|
||||
dataModel.StaticInfo.Session.PlayerName = e.StaticInfo.PlayerName;
|
||||
dataModel.StaticInfo.Session.PlayerSurname = e.StaticInfo.PlayerSurname;
|
||||
dataModel.StaticInfo.Session.PlayerNick = e.StaticInfo.PlayerNick;
|
||||
dataModel.StaticInfo.Session.SectorCount = e.StaticInfo.SectorCount;
|
||||
dataModel.StaticInfo.Session.PenaltiesEnabled = e.StaticInfo.PenaltiesEnabled;
|
||||
dataModel.StaticInfo.Car.CarModel = e.StaticInfo.CarModel;
|
||||
dataModel.StaticInfo.Car.MaxTorque = e.StaticInfo.MaxTorque;
|
||||
dataModel.StaticInfo.Car.MaxPower = e.StaticInfo.MaxPower;
|
||||
dataModel.StaticInfo.Car.MaxRpm = e.StaticInfo.MaxRpm;
|
||||
dataModel.StaticInfo.Car.MaxFuel = e.StaticInfo.MaxFuel;
|
||||
dataModel.StaticInfo.Car.SuspensionMaxTravel = e.StaticInfo.SuspensionMaxTravel;
|
||||
dataModel.StaticInfo.Car.TyreRadius = e.StaticInfo.TyreRadius;
|
||||
dataModel.StaticInfo.Car.MaxTurboBoost = e.StaticInfo.MaxTurboBoost;
|
||||
dataModel.StaticInfo.Car.AidFuelRate = e.StaticInfo.AidFuelRate;
|
||||
dataModel.StaticInfo.Car.AidTireRate = e.StaticInfo.AidTireRate;
|
||||
dataModel.StaticInfo.Car.AidMechanicalDamage = e.StaticInfo.AidMechanicalDamage;
|
||||
dataModel.StaticInfo.Car.AidAllowTyreBlankets = e.StaticInfo.AidAllowTyreBlankets;
|
||||
dataModel.StaticInfo.Car.AidStability = e.StaticInfo.AidStability;
|
||||
dataModel.StaticInfo.Car.AidAutoClutch = e.StaticInfo.AidAutoClutch;
|
||||
dataModel.StaticInfo.Car.AidAutoBlip = e.StaticInfo.AidAutoBlip;
|
||||
dataModel.StaticInfo.Car.HasDRS = e.StaticInfo.HasDRS;
|
||||
dataModel.StaticInfo.Car.HasERS = e.StaticInfo.HasERS;
|
||||
dataModel.StaticInfo.Car.HasKERS = e.StaticInfo.HasKERS;
|
||||
dataModel.StaticInfo.Car.KersMaxJoules = e.StaticInfo.KersMaxJoules;
|
||||
dataModel.StaticInfo.Car.EngineBrakeSettingsCount = e.StaticInfo.EngineBrakeSettingsCount;
|
||||
dataModel.StaticInfo.Car.ErsPowerControllerCount = e.StaticInfo.ErsPowerControllerCount;
|
||||
}
|
||||
|
||||
private void AcOnGraphicsUpdated(object sender, GraphicsEventArgs e)
|
||||
{
|
||||
var dataModel = (AssettoCorsaDataModel)DataModel;
|
||||
dataModel.Interface.Status = e.Graphics.Status;
|
||||
dataModel.Interface.Session = e.Graphics.Session;
|
||||
dataModel.Interface.CurrentTime = e.Graphics.CurrentTime;
|
||||
dataModel.Interface.LastTime = e.Graphics.LastTime;
|
||||
dataModel.Interface.BestTime = e.Graphics.BestTime;
|
||||
dataModel.Interface.Split = e.Graphics.Split;
|
||||
dataModel.Interface.Position = e.Graphics.Position;
|
||||
dataModel.Interface.iCurrentTime = e.Graphics.iCurrentTime;
|
||||
dataModel.Interface.iLastTime = e.Graphics.iLastTime;
|
||||
dataModel.Interface.iBestTime = e.Graphics.iBestTime;
|
||||
dataModel.Interface.SessionTimeLeft = e.Graphics.SessionTimeLeft;
|
||||
dataModel.Interface.DistanceTraveled = e.Graphics.DistanceTraveled;
|
||||
dataModel.Interface.IsInPit = e.Graphics.IsInPit;
|
||||
dataModel.Interface.CurrentSectorIndex = e.Graphics.CurrentSectorIndex;
|
||||
dataModel.Interface.LastSectorTime = e.Graphics.LastSectorTime;
|
||||
dataModel.Interface.NumberOfLaps = e.Graphics.NumberOfLaps;
|
||||
dataModel.Interface.TyreCompound = e.Graphics.TyreCompound;
|
||||
dataModel.Interface.ReplayTimeMultiplier = e.Graphics.ReplayTimeMultiplier;
|
||||
dataModel.Interface.NormalizedCarPosition = e.Graphics.NormalizedCarPosition;
|
||||
}
|
||||
|
||||
private void AcOnPhysicsUpdated(object sender, PhysicsEventArgs e)
|
||||
{
|
||||
var dataModel = (AssettoCorsaDataModel)DataModel;
|
||||
dataModel.Physics.Abs = e.Physics.Abs;
|
||||
dataModel.Physics.Gas = e.Physics.Gas;
|
||||
dataModel.Physics.Brake = e.Physics.Brake;
|
||||
dataModel.Physics.Fuel = e.Physics.Fuel;
|
||||
dataModel.Physics.Gear = e.Physics.Gear;
|
||||
dataModel.Physics.Rpms = e.Physics.Rpms;
|
||||
dataModel.Physics.SteerAngle = e.Physics.SteerAngle;
|
||||
dataModel.Physics.SpeedKmh = e.Physics.SpeedKmh;
|
||||
dataModel.Physics.Velocity = e.Physics.Velocity;
|
||||
dataModel.Physics.AccG = e.Physics.AccG;
|
||||
dataModel.Physics.WheelSlip = e.Physics.WheelSlip;
|
||||
dataModel.Physics.WheelLoad = e.Physics.WheelLoad;
|
||||
dataModel.Physics.WheelsPressure = e.Physics.WheelsPressure;
|
||||
dataModel.Physics.WheelAngularSpeed = e.Physics.WheelAngularSpeed;
|
||||
dataModel.Physics.TyreWear = e.Physics.TyreWear;
|
||||
dataModel.Physics.TyreDirtyLevel = e.Physics.TyreDirtyLevel;
|
||||
dataModel.Physics.TyreCoreTemperature = e.Physics.TyreCoreTemperature;
|
||||
dataModel.Physics.CamberRad = e.Physics.CamberRad;
|
||||
dataModel.Physics.SuspensionTravel = e.Physics.SuspensionTravel;
|
||||
dataModel.Physics.Drs = e.Physics.Drs;
|
||||
dataModel.Physics.TC = e.Physics.TC;
|
||||
dataModel.Physics.Heading = e.Physics.Heading;
|
||||
dataModel.Physics.Pitch = e.Physics.Pitch;
|
||||
dataModel.Physics.Roll = e.Physics.Roll;
|
||||
dataModel.Physics.CgHeight = e.Physics.CgHeight;
|
||||
dataModel.Physics.CarDamage = e.Physics.CarDamage;
|
||||
dataModel.Physics.NumberOfTyresOut = e.Physics.NumberOfTyresOut;
|
||||
dataModel.Physics.PitLimiterOn = e.Physics.PitLimiterOn;
|
||||
dataModel.Physics.KersCharge = e.Physics.KersCharge;
|
||||
dataModel.Physics.KersInput = e.Physics.KersInput;
|
||||
dataModel.Physics.AutoShifterOn = e.Physics.AutoShifterOn;
|
||||
dataModel.Physics.RideHeight = e.Physics.RideHeight;
|
||||
dataModel.Physics.TurboBoost = e.Physics.TurboBoost;
|
||||
dataModel.Physics.Ballast = e.Physics.Ballast;
|
||||
dataModel.Physics.AirDensity = e.Physics.AirDensity;
|
||||
dataModel.Physics.AirTemp = e.Physics.AirTemp;
|
||||
dataModel.Physics.RoadTemp = e.Physics.RoadTemp;
|
||||
dataModel.Physics.LocalAngularVelocity = e.Physics.LocalAngularVelocity;
|
||||
dataModel.Physics.FinalFF = e.Physics.FinalFF;
|
||||
dataModel.Physics.PerformanceMeter = e.Physics.PerformanceMeter;
|
||||
dataModel.Physics.EngineBrake = e.Physics.EngineBrake;
|
||||
dataModel.Physics.ErsRecoveryLevel = e.Physics.ErsRecoveryLevel;
|
||||
dataModel.Physics.ErsPowerLevel = e.Physics.ErsPowerLevel;
|
||||
dataModel.Physics.ErsHeatCharging = e.Physics.ErsHeatCharging;
|
||||
dataModel.Physics.ErsisCharging = e.Physics.ErsisCharging;
|
||||
dataModel.Physics.KersCurrentKJ = e.Physics.KersCurrentKJ;
|
||||
dataModel.Physics.DrsAvailable = e.Physics.DrsAvailable;
|
||||
dataModel.Physics.DrsEnabled = e.Physics.DrsEnabled;
|
||||
dataModel.Physics.BrakeTemp = e.Physics.BrakeTemp;
|
||||
dataModel.Physics.Clutch = e.Physics.Clutch;
|
||||
dataModel.Physics.TyreTempI = e.Physics.TyreTempI;
|
||||
dataModel.Physics.TyreTempM = e.Physics.TyreTempM;
|
||||
dataModel.Physics.TyreTempO = e.Physics.TyreTempO;
|
||||
dataModel.Physics.IsAIControlled = e.Physics.IsAIControlled;
|
||||
dataModel.Physics.TyreContactPoint = e.Physics.TyreContactPoint;
|
||||
dataModel.Physics.TyreContactNormal = e.Physics.TyreContactNormal;
|
||||
dataModel.Physics.TyreContactHeading = e.Physics.TyreContactHeading;
|
||||
dataModel.Physics.BrakeBias = e.Physics.BrakeBias;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Updating is done by the events
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
public class AssettoCorsaSettings : ModuleSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.AssettoCorsa.AssettoCorsaView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="559.725" d:DesignWidth="882.696">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15,5,5,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default shows RPM on the F-keys, gear on the other keys and track flags on the numpad." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
||||
TextAlignment="Justify" Margin="5,0,0,10">
|
||||
The Assetto Corsa module uses the
|
||||
<Hyperlink RequestNavigate="Hyperlink_RequestNavigate"
|
||||
NavigateUri="https://github.com/mdjarv/assettocorsasharedmemory">
|
||||
Assetto Corsa Shared Memory Library
|
||||
</Hyperlink>
|
||||
project by mdjarv
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right">
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=IsModuleEnabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@ -0,0 +1,18 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
public partial class AssettoCorsaView : UserControl
|
||||
{
|
||||
public AssettoCorsaView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start(e.Uri.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.AssettoCorsa
|
||||
{
|
||||
public sealed class AssettoCorsaViewModel : ModuleViewModel
|
||||
{
|
||||
public AssettoCorsaViewModel(MainManager mainManager, [Named(nameof(AssettoCorsaModel))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Assetto Corsa";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
}
|
||||
}
|
||||
@ -1,33 +1,33 @@
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.EurotruckSimulator2.Data;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class EurotruckSimulator2DataModel : ModuleDataModel
|
||||
{
|
||||
public EurotruckSimulator2DataModel()
|
||||
{
|
||||
// Register types for LUA
|
||||
UserData.RegisterType<IEts2Game>();
|
||||
UserData.RegisterType<IEts2Job>();
|
||||
UserData.RegisterType<IEts2Navigation>();
|
||||
UserData.RegisterType<IEts2Trailer>();
|
||||
UserData.RegisterType<IEts2Truck>();
|
||||
}
|
||||
|
||||
public TruckSimulatorGameName GameName { get; set; }
|
||||
public IEts2Game Game { get; set; }
|
||||
public IEts2Job Job { get; set; }
|
||||
public IEts2Navigation Navigation { get; set; }
|
||||
public IEts2Trailer Trailer { get; set; }
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.EurotruckSimulator2.Data;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class EurotruckSimulator2DataModel : ModuleDataModel
|
||||
{
|
||||
public EurotruckSimulator2DataModel()
|
||||
{
|
||||
// Register types for LUA
|
||||
UserData.RegisterType<IEts2Game>();
|
||||
UserData.RegisterType<IEts2Job>();
|
||||
UserData.RegisterType<IEts2Navigation>();
|
||||
UserData.RegisterType<IEts2Trailer>();
|
||||
UserData.RegisterType<IEts2Truck>();
|
||||
}
|
||||
|
||||
public TruckSimulatorGameName GameName { get; set; }
|
||||
public IEts2Game Game { get; set; }
|
||||
public IEts2Job Job { get; set; }
|
||||
public IEts2Navigation Navigation { get; set; }
|
||||
public IEts2Trailer Trailer { get; set; }
|
||||
public IEts2Truck Truck { get; set; }
|
||||
|
||||
public enum TruckSimulatorGameName
|
||||
{
|
||||
EuroTruckSimulator2,
|
||||
AmericanTruckSimulator
|
||||
}
|
||||
}
|
||||
public enum TruckSimulatorGameName
|
||||
{
|
||||
EuroTruckSimulator2,
|
||||
AmericanTruckSimulator
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
@ -10,15 +10,18 @@ namespace Artemis.Profiles.Layers.Conditions
|
||||
{
|
||||
public class DataModelCondition : ILayerCondition
|
||||
{
|
||||
private static readonly TimeSpan Delay = TimeSpan.FromMilliseconds((SystemParameters.KeyboardDelay + 1) * 250);
|
||||
private DateTime _lastKeypress;
|
||||
public bool HotKeyMet { get; set; }
|
||||
private static readonly TimeSpan Delay = TimeSpan.FromMilliseconds((SystemParameters.KeyboardDelay + 1) * 250);
|
||||
|
||||
public bool ConditionsMet(LayerModel layerModel, ModuleDataModel dataModel)
|
||||
{
|
||||
lock (layerModel.Properties.Conditions)
|
||||
{
|
||||
var checkConditions = layerModel.Properties.Conditions.Where(c => !c.Field.Contains("hotkey"));
|
||||
var checkConditions = layerModel.Properties.Conditions.Where(c => !c.Field.Contains("hotkey")).ToList();
|
||||
if (checkConditions.Count == layerModel.Properties.Conditions.Count)
|
||||
return SimpleConditionsMet(layerModel, dataModel, checkConditions);
|
||||
|
||||
var conditionMet = false;
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
@ -34,14 +37,16 @@ namespace Artemis.Profiles.Layers.Conditions
|
||||
}
|
||||
|
||||
// If there is a held down keybind on it, reset every 2 frames, after 500 ms
|
||||
if (layerModel.Properties.Conditions.Any(c => c.Operator == "held") && DateTime.Now - _lastKeypress > Delay)
|
||||
if (layerModel.Properties.Conditions.Any(c => c.Operator == "held") &&
|
||||
DateTime.Now - _lastKeypress > Delay)
|
||||
{
|
||||
HotKeyMet = false;
|
||||
}
|
||||
|
||||
return conditionMet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void KeybindTask(LayerConditionModel condition)
|
||||
{
|
||||
_lastKeypress = DateTime.Now;
|
||||
@ -58,5 +63,21 @@ namespace Artemis.Profiles.Layers.Conditions
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool SimpleConditionsMet(LayerModel layerModel, ModuleDataModel dataModel,
|
||||
IEnumerable<LayerConditionModel> checkConditions)
|
||||
{
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
case ConditionType.AnyMet:
|
||||
return checkConditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
case ConditionType.AllMet:
|
||||
return checkConditions.All(cm => cm.ConditionMet(dataModel));
|
||||
case ConditionType.NoneMet:
|
||||
return !checkConditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
@ -9,13 +10,16 @@ namespace Artemis.Profiles.Layers.Conditions
|
||||
public class EventCondition : ILayerCondition
|
||||
{
|
||||
[JsonIgnore]
|
||||
public bool HotKeyMet { get;set; }
|
||||
public bool HotKeyMet { get; set; }
|
||||
|
||||
public bool ConditionsMet(LayerModel layerModel, ModuleDataModel dataModel)
|
||||
{
|
||||
lock (layerModel.Properties.Conditions)
|
||||
{
|
||||
var checkConditions = layerModel.Properties.Conditions.Where(c => !c.Field.Contains("hotkey"));
|
||||
var checkConditions = layerModel.Properties.Conditions.Where(c => !c.Field.Contains("hotkey")).ToList();
|
||||
if (checkConditions.Count == layerModel.Properties.Conditions.Count)
|
||||
return SimpleConditionsMet(layerModel, dataModel, checkConditions);
|
||||
|
||||
var conditionsMet = false;
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
@ -56,5 +60,21 @@ namespace Artemis.Profiles.Layers.Conditions
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool SimpleConditionsMet(LayerModel layerModel, ModuleDataModel dataModel,
|
||||
IEnumerable<LayerConditionModel> checkConditions)
|
||||
{
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
case ConditionType.AnyMet:
|
||||
return checkConditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
case ConditionType.AllMet:
|
||||
return checkConditions.All(cm => cm.ConditionMet(dataModel));
|
||||
case ConditionType.NoneMet:
|
||||
return !checkConditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,7 +22,7 @@ namespace Artemis.Profiles.Lua.Wrappers
|
||||
public LuaDrawWrapper(DrawingContext ctx, string updateType)
|
||||
{
|
||||
_ctx = ctx;
|
||||
_scale = updateType == "keyboard" ? 4 : 2;
|
||||
_scale = updateType == "keyboard" || updateType == "preview" ? 4 : 2;
|
||||
}
|
||||
|
||||
public void DrawEllipse(LuaBrush luaBrush, double x, double y, double height, double width)
|
||||
|
||||
BIN
Artemis/Artemis/lib/AssettoCorsaSharedMemory.dll
Normal file
BIN
Artemis/Artemis/lib/AssettoCorsaSharedMemory.dll
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user