Skip to content
Open

Net6 #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PDTools.Compression/PDTools.Compression.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
Expand All @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="ImpromptuNinjas.ZStd" Version="1.4.5.5" />
<PackageReference Include="SharpZipLib" Version="1.3.2" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="Syroot.BinaryData" Version="5.2.2" />
<PackageReference Include="Syroot.BinaryData.Memory" Version="5.2.2" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion PDTools.Crypto/PDTools.Crypto.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions PDTools.Files/Fonts/Glyph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Image<Rgba32> GetAsImage()

PathBuilder path = new PathBuilder();

var pen = new Pen(new SolidBrush(Color.Black), 2);
var pen = new SolidPen(new SolidBrush(Color.Black), 2);
for (int i1 = 0; i1 < Points.Data.Count; i1++)
{
IGlyphShapeData i = Points.Data[i1];
Expand Down Expand Up @@ -123,7 +123,7 @@ public Image<Rgba32> GetAsImage()
ctx.Draw(Color.Red, 5, path.Build());
}

ctx.DrawLines(Color.Red, 1f, new PointF[]
ctx.DrawLine(Color.Red, 1f, new PointF[]
{
new PointF(Points.XMin, Points.YMin),
});
Expand Down
6 changes: 3 additions & 3 deletions PDTools.Files/PDTools.Files.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

<ItemGroup>
<PackageReference Include="BCnEncoder.Net" Version="2.1.0" />
<PackageReference Include="Pfim" Version="0.10.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.0" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15" />
<PackageReference Include="Pfim" Version="0.11.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.3" />
<PackageReference Include="Syroot.BinaryData" Version="5.2.2" />
<PackageReference Include="Syroot.BinaryData.Memory" Version="5.2.2" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions PDTools.Files/Textures/PS3/CellTexture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public bool FromStandardImage(string path, CELL_GCM_TEXTURE_FORMAT format)
if (!File.Exists(ddsFileName))
return false;

var dds = Pfim.Pfim.FromFile(ddsFileName);
var dds = Pfimage.FromFile(ddsFileName);
InitFromDDSImage(dds, format);

Memory<byte> ddsData = File.ReadAllBytes(ddsFileName).AsMemory(0x80);
Expand Down Expand Up @@ -130,7 +130,7 @@ public override void ConvertTextureToStandardFormat(string outputFileName)
}
else
{
var dds = Pfim.Pfim.FromStream(ms);
var dds = Pfimage.FromStream(ms);

if (dds.Format == ImageFormat.Rgb24)
{
Expand Down
2 changes: 1 addition & 1 deletion PDTools.GT4ElfBuilderTool/PDTools.GT4ElfBuilderTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SharpZipLib" Version="1.4.0" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="Syroot.BinaryData" Version="5.2.2" />
<PackageReference Include="Syroot.BinaryData.Memory" Version="5.2.2" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion PDTools.Hashing/PDTools.Hashing.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<Nullable>disable</Nullable>
</PropertyGroup>

Expand Down
5 changes: 3 additions & 2 deletions PDTools.LiveTimingApi/PDTools.LiveTimingApi.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<Nullable>disable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Text.Json" Version="6.0.6" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
</Project>
109 changes: 73 additions & 36 deletions PDTools.SimulatorInterface/SimulatorPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

using System.Numerics;
using Syroot.BinaryData.Memory;
using System.Net.Sockets;

namespace PDTools.SimulatorInterface
{
Expand Down Expand Up @@ -400,67 +401,103 @@ public void SetPacketInfo(SimulatorInterfaceGameType gameType, IPEndPoint remote
DateReceived = dateReceived;
}

public void PrintPacket(bool debug = false)
public bool IsPaused { get => Flags.HasFlag(SimulatorFlags.Paused);}

public bool IsCarOnTrack { get => Flags.HasFlag(SimulatorFlags.CarOnTrack); }

public bool IsLoadingOrProcessing { get => Flags.HasFlag(SimulatorFlags.LoadingOrProcessing); }

private static Vector3 _maxAngularVelocity = Vector3.Zero;

public void PrintPacket(bool debug = false, bool motionOnly = true)
{
if (!IsCarOnTrack || IsPaused || IsLoadingOrProcessing)
{
Console.Clear();
Console.SetCursorPosition(0, 0);
Console.WriteLine($"On Track: {this.Flags.HasFlag(SimulatorFlags.CarOnTrack)} Paused: {IsPaused} IsLoading: {IsLoadingOrProcessing}");

return;
}
Console.SetCursorPosition(0, 0);
Console.WriteLine($"[{DateReceived} - ID {PacketId}] Simulator Interface Packet ");

Console.WriteLine("[Car Data] ");
Console.WriteLine($"- Car Code: {CarCode} ");
Console.WriteLine($"- Throttle: {Throttle} ");
Console.WriteLine($"- Brake: {Brake} ");
Console.WriteLine($"- RPM: {EngineRPM} - KPH: {Math.Round(MetersPerSecond * 3.6, 2)} ");
Console.WriteLine($"- Turbo Boost: {((TurboBoost - 1.0) * 100.0):F2}kPa ");
Console.WriteLine($"- Fuel Level: {GasLevel:F2} ");
Console.WriteLine($"- Max Fuel Capacity: {GasCapacity:F2} ");

Console.WriteLine($"- Oil Pressure: {OilPressure:F2} ");
Console.WriteLine($"- Body Height: {BodyHeight:F2} ");
Console.WriteLine($"- Clutch Pedal: {ClutchPedal:F2} ");
Console.WriteLine($"- Clutch Engagement: {ClutchEngagement:F2} ");
Console.WriteLine($"- RPM From Clutch To Gearbox: {RPMFromClutchToGearbox:F2} ");

if (!motionOnly)
{
Console.WriteLine($"- Turbo Boost: {((TurboBoost - 1.0) * 100.0):F2}kPa ");
Console.WriteLine($"- Fuel Level: {GasLevel:F2} ");
Console.WriteLine($"- Max Fuel Capacity: {GasCapacity:F2} ");

Console.WriteLine($"- Oil Pressure: {OilPressure:F2} ");
Console.WriteLine($"- Body Height: {BodyHeight:F2} ");
Console.WriteLine($"- Clutch Pedal: {ClutchPedal:F2} ");
Console.WriteLine($"- Clutch Engagement: {ClutchEngagement:F2} ");
Console.WriteLine($"- RPM From Clutch To Gearbox: {RPMFromClutchToGearbox:F2} ");
}

if (SuggestedGear == 15)
Console.WriteLine($"- Gear: {CurrentGear} ");
else
Console.WriteLine($"- Gear: {CurrentGear} (Suggested: {SuggestedGear})");
Console.WriteLine($"- Calculated Max Speed: {CalculatedMaxSpeed}kph ");
Console.WriteLine($"- Min/Max RPM Alerts: {MinAlertRPM} - {MaxAlertRPM} ");

Console.WriteLine($"- Flags: {Flags,-100}");
Console.WriteLine($"- Gear Ratios: {string.Join(", ", GearRatios)}");
Console.WriteLine($"- Tire Height / FL:{TireFL_SusHeight:F2} FR:{TireFR_SusHeight:F2} RL:{TireRL_SusHeight:F2} RR:{TireRR_SusHeight:F2} ");
Console.WriteLine($"- Tire RPS / FL:{WheelFL_RevPerSecond:F2} FR:{WheelFR_RevPerSecond:F2} RL:{WheelRL_RevPerSecond:F2} RR:{WheelRR_RevPerSecond:F2} ");
Console.WriteLine($"- Tire Radius / FL:{TireFL_TireRadius:F2} FR:{TireFR_TireRadius:F2} RL:{TireRL_TireRadius:F2} RR:{TireRR_TireRadius:F2} ");
if (!motionOnly)
{
Console.WriteLine($"- Calculated Max Speed: {CalculatedMaxSpeed}kph ");
Console.WriteLine($"- Min/Max RPM Alerts: {MinAlertRPM} - {MaxAlertRPM} ");

Console.WriteLine($"- Flags: {Flags,-100}");
Console.WriteLine($"- Gear Ratios: {string.Join(", ", GearRatios)}");
}
Console.WriteLine($"- Tire Height / FL:{TireFL_SusHeight:F2} FR:{TireFR_SusHeight:F2} RL:{TireRL_SusHeight:F2} RR:{TireRR_SusHeight:F2} ");

Console.WriteLine($"- Tire Temperature");
Console.WriteLine($" FL: {TireFL_SurfaceTemperature:F2}°C | FR: {TireFR_SurfaceTemperature:F2}°C ");
Console.WriteLine($" RL: {TireRL_SurfaceTemperature:F2}°C | RR: {TireRR_SurfaceTemperature:F2}°C ");
if (!motionOnly)
{
Console.WriteLine($"- Tire RPS / FL:{WheelFL_RevPerSecond:F2} FR:{WheelFR_RevPerSecond:F2} RL:{WheelRL_RevPerSecond:F2} RR:{WheelRR_RevPerSecond:F2} ");
Console.WriteLine($"- Tire Radius / FL:{TireFL_TireRadius:F2} FR:{TireFR_TireRadius:F2} RL:{TireRL_TireRadius:F2} RR:{TireRR_TireRadius:F2} ");

Console.WriteLine();
Console.WriteLine("[Race Data]");
Console.WriteLine($"- Current Lap: {LapCount} ");
Console.WriteLine($"- Tire Temperature");
Console.WriteLine($" FL: {TireFL_SurfaceTemperature:F2}°C | FR: {TireFR_SurfaceTemperature:F2}°C ");
Console.WriteLine($" RL: {TireRL_SurfaceTemperature:F2}°C | RR: {TireRR_SurfaceTemperature:F2}°C ");

if (BestLapTime.TotalMilliseconds == -1)
Console.WriteLine($"- Best: N/A ");
else
Console.WriteLine($"- Best: {BestLapTime:mm\\:ss\\.fff} ");
Console.WriteLine();
Console.WriteLine("[Race Data]");
Console.WriteLine($"- Current Lap: {LapCount} ");

if (LastLapTime.TotalMilliseconds == -1)
Console.WriteLine($"- Last: N/A ");
else
Console.WriteLine($"- Last: {LastLapTime:mm\\:ss\\.fff} ");
if (BestLapTime.TotalMilliseconds == -1)
Console.WriteLine($"- Best: N/A ");
else
Console.WriteLine($"- Best: {BestLapTime:mm\\:ss\\.fff} ");

if (LastLapTime.TotalMilliseconds == -1)
Console.WriteLine($"- Last: N/A ");
else
Console.WriteLine($"- Last: {LastLapTime:mm\\:ss\\.fff} ");

Console.WriteLine($"- Time of Day: {TimeOfDayProgression:hh\\:mm\\:ss} ");
Console.WriteLine($"- PreRaceStartPositionOrQualiPos: {PreRaceStartPositionOrQualiPos}");
Console.WriteLine($"- NumCarsAtPreRace: {NumCarsAtPreRace}");
Console.WriteLine($"- Time of Day: {TimeOfDayProgression:hh\\:mm\\:ss} ");
Console.WriteLine($"- PreRaceStartPositionOrQualiPos: {PreRaceStartPositionOrQualiPos}");
Console.WriteLine($"- NumCarsAtPreRace: {NumCarsAtPreRace}");

}
Console.WriteLine();

var ava = Vector3.Multiply((float)(180 / Math.PI) , AngularVelocity) ;

_maxAngularVelocity.X = Math.Max(Math.Abs(_maxAngularVelocity.X), Math.Abs(ava.X));
_maxAngularVelocity.Y = Math.Max(Math.Abs(_maxAngularVelocity.Y), Math.Abs(ava.Y));
_maxAngularVelocity.Z = Math.Max(Math.Abs(_maxAngularVelocity.Z), Math.Abs(ava.Z));

Console.WriteLine("[Positional Information]");
Console.WriteLine($"- Position: {Position:F3} ");
Console.WriteLine($"- Velocity: {Velocity:F3} ");
Console.WriteLine($"- Rotation: {Rotation:F3} ");
Console.WriteLine($"- Angular Velocity: {AngularVelocity:F2} ");
Console.WriteLine($"- Rotation: {Rotation:F3} w: {RelativeOrientationToNorth:F2} ");
Console.WriteLine($"- Angular Velocity: {ava:F2} ");
Console.WriteLine($"- Max Angular Velocity: {_maxAngularVelocity:F2} ");
Console.WriteLine($"- Road Plane: {RoadPlane:F2} ");

if (debug)
Expand Down
16 changes: 16 additions & 0 deletions PDTools.SimulatorInterfaceTestTool/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"profiles": {
"gt6": {
"commandName": "Project",
"commandLineArgs": "0.0.0.0 --gt6"
},
"gtsport": {
"commandName": "Project",
"commandLineArgs": "0.0.0.0 --gtsport"
},
"gt7": {
"commandName": "Project",
"commandLineArgs": "0.0.0.0"
}
}
}
2 changes: 1 addition & 1 deletion PDTools.SpecDB/PDTools.SpecDB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.6" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.7" />
<PackageReference Include="Syroot.BinaryData" Version="5.2.2" />
<PackageReference Include="Syroot.BinaryData.Memory" Version="5.2.2" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions PDTools.Utils/PDTools.Utils.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.0;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SharpZipLib" Version="1.3.2" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="Syroot.BinaryData" Version="5.2.2" />
<PackageReference Include="Syroot.BinaryData.Memory" Version="5.2.2" />
</ItemGroup>
Expand Down