diff --git a/PDTools.Compression/PDTools.Compression.csproj b/PDTools.Compression/PDTools.Compression.csproj index 540b54d..8e50dba 100644 --- a/PDTools.Compression/PDTools.Compression.csproj +++ b/PDTools.Compression/PDTools.Compression.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -14,7 +14,7 @@ - + diff --git a/PDTools.Crypto/PDTools.Crypto.csproj b/PDTools.Crypto/PDTools.Crypto.csproj index 4fbfd47..678a3c7 100644 --- a/PDTools.Crypto/PDTools.Crypto.csproj +++ b/PDTools.Crypto/PDTools.Crypto.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp3.0 + netstandard2.0;net6.0 diff --git a/PDTools.Files/Fonts/Glyph.cs b/PDTools.Files/Fonts/Glyph.cs index b8de778..b4a5441 100644 --- a/PDTools.Files/Fonts/Glyph.cs +++ b/PDTools.Files/Fonts/Glyph.cs @@ -65,7 +65,7 @@ public Image 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]; @@ -123,7 +123,7 @@ public Image 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), }); diff --git a/PDTools.Files/PDTools.Files.csproj b/PDTools.Files/PDTools.Files.csproj index 4a8b36b..61e27a0 100644 --- a/PDTools.Files/PDTools.Files.csproj +++ b/PDTools.Files/PDTools.Files.csproj @@ -9,9 +9,9 @@ - - - + + + diff --git a/PDTools.Files/Textures/PS3/CellTexture.cs b/PDTools.Files/Textures/PS3/CellTexture.cs index 40ae97a..a98a402 100644 --- a/PDTools.Files/Textures/PS3/CellTexture.cs +++ b/PDTools.Files/Textures/PS3/CellTexture.cs @@ -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 ddsData = File.ReadAllBytes(ddsFileName).AsMemory(0x80); @@ -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) { diff --git a/PDTools.GT4ElfBuilderTool/PDTools.GT4ElfBuilderTool.csproj b/PDTools.GT4ElfBuilderTool/PDTools.GT4ElfBuilderTool.csproj index b99eca8..2fbcd5e 100644 --- a/PDTools.GT4ElfBuilderTool/PDTools.GT4ElfBuilderTool.csproj +++ b/PDTools.GT4ElfBuilderTool/PDTools.GT4ElfBuilderTool.csproj @@ -8,7 +8,7 @@ - + diff --git a/PDTools.Hashing/PDTools.Hashing.csproj b/PDTools.Hashing/PDTools.Hashing.csproj index c3af656..12b5c98 100644 --- a/PDTools.Hashing/PDTools.Hashing.csproj +++ b/PDTools.Hashing/PDTools.Hashing.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp3.0 + netstandard2.0;net6.0 disable diff --git a/PDTools.LiveTimingApi/PDTools.LiveTimingApi.csproj b/PDTools.LiveTimingApi/PDTools.LiveTimingApi.csproj index 7372d93..16e218d 100644 --- a/PDTools.LiveTimingApi/PDTools.LiveTimingApi.csproj +++ b/PDTools.LiveTimingApi/PDTools.LiveTimingApi.csproj @@ -1,11 +1,12 @@  - netstandard2.0;netcoreapp3.1 + netstandard2.0;net6.0 + disable true Library - + diff --git a/PDTools.SimulatorInterface/SimulatorPacket.cs b/PDTools.SimulatorInterface/SimulatorPacket.cs index 7e3ac34..03a7eef 100644 --- a/PDTools.SimulatorInterface/SimulatorPacket.cs +++ b/PDTools.SimulatorInterface/SimulatorPacket.cs @@ -8,6 +8,7 @@ using System.Numerics; using Syroot.BinaryData.Memory; +using System.Net.Sockets; namespace PDTools.SimulatorInterface { @@ -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) diff --git a/PDTools.SimulatorInterfaceTestTool/Properties/launchSettings.json b/PDTools.SimulatorInterfaceTestTool/Properties/launchSettings.json new file mode 100644 index 0000000..cf14675 --- /dev/null +++ b/PDTools.SimulatorInterfaceTestTool/Properties/launchSettings.json @@ -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" + } + } +} \ No newline at end of file diff --git a/PDTools.SpecDB/PDTools.SpecDB.csproj b/PDTools.SpecDB/PDTools.SpecDB.csproj index 905de5c..43cbc51 100644 --- a/PDTools.SpecDB/PDTools.SpecDB.csproj +++ b/PDTools.SpecDB/PDTools.SpecDB.csproj @@ -5,7 +5,7 @@ - + diff --git a/PDTools.Utils/PDTools.Utils.csproj b/PDTools.Utils/PDTools.Utils.csproj index 835e917..65b1cc1 100644 --- a/PDTools.Utils/PDTools.Utils.csproj +++ b/PDTools.Utils/PDTools.Utils.csproj @@ -1,7 +1,7 @@ - + - netstandard2.0;netcoreapp3.0; + netstandard2.0;net6.0; @@ -14,7 +14,7 @@ - +