-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for multiple Game Types. Support for DiRT 1/2.
- Loading branch information
1 parent
b9ffe2f
commit 0e8a803
Showing
8 changed files
with
234 additions
and
71 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ForzaDSX.GameParsers | ||
{ | ||
internal class DirtParser : Parser | ||
{ | ||
public DirtParser(Config.Config settings) : base(settings) | ||
{ | ||
} | ||
|
||
public override void ParsePacket(byte[] packet) | ||
{ | ||
data = new DataPacket(); | ||
//data.AccelerationX | ||
|
||
data.IsRaceOn = true; | ||
data.Power = 1; | ||
data.CurrentEngineRpm = PacketParse.GetSingle(packet, 148) * 10.0f; | ||
data.Speed = PacketParse.GetSingle(packet, 28); | ||
data.frontLeftContactPatchV = PacketParse.GetSingle(packet, 108); | ||
data.TireCombinedSlipFrontLeft = calcTireSlip(PacketParse.GetSingle(packet, 108), data.Speed); | ||
data.TireCombinedSlipFrontRight = calcTireSlip(PacketParse.GetSingle(packet, 112), data.Speed); | ||
data.TireCombinedSlipRearLeft = calcTireSlip(PacketParse.GetSingle(packet, 100), data.Speed); | ||
data.TireCombinedSlipRearRight = calcTireSlip(PacketParse.GetSingle(packet, 104), data.Speed); | ||
|
||
|
||
data.CarClass = 0; | ||
|
||
data.CarPerformanceIndex = 0; | ||
|
||
data.AccelerationX = PacketParse.GetSingle(packet, 136); | ||
|
||
data.AccelerationZ = PacketParse.GetSingle(packet, 140); | ||
|
||
data.Accelerator = (uint)(PacketParse.GetSingle(packet, 116) * 255.0f); | ||
|
||
data.Brake = (uint)(PacketParse.GetSingle(packet, 120) * 255.0f); | ||
|
||
data.EngineMaxRpm = PacketParse.GetSingle(packet, 252) * 10.0f; | ||
data.EngineIdleRpm = 0; | ||
data.FourWheelCombinedTireSlip = (Math.Abs(data.TireCombinedSlipFrontLeft) + Math.Abs(data.TireCombinedSlipFrontRight) + Math.Abs(data.TireCombinedSlipRearLeft) + Math.Abs(data.TireCombinedSlipRearRight)) / 4; | ||
data.FrontWheelsCombinedTireSlip = (Math.Abs(data.TireCombinedSlipFrontLeft) + Math.Abs(data.TireCombinedSlipFrontRight)) / 2; | ||
data.RearWheelsCombinedTireSlip = (Math.Abs(data.TireCombinedSlipRearLeft) + Math.Abs(data.TireCombinedSlipRearRight)) / 2; | ||
} | ||
static float calcTireSlip(float contactPatchSpeed, float vehicleSpeed) | ||
{ | ||
if (Math.Abs(vehicleSpeed) < 0.1f) | ||
{ | ||
return 0; | ||
} | ||
return 3.0f * (Math.Abs(Math.Abs(contactPatchSpeed) - vehicleSpeed) / vehicleSpeed); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ForzaDSX.GameParsers | ||
{ | ||
internal class NullParser : Parser | ||
{ | ||
public NullParser(Config.Config settings) : base(settings) | ||
{ | ||
} | ||
|
||
public override void ParsePacket(byte[] packet) | ||
{ | ||
data = new DataPacket(); | ||
//data.AccelerationX | ||
|
||
data.IsRaceOn = true; | ||
data.Power = 1; | ||
data.CurrentEngineRpm = 0; | ||
data.Speed = 0; | ||
data.TireCombinedSlipFrontLeft = 0; | ||
data.TireCombinedSlipFrontRight = 0; | ||
data.TireCombinedSlipRearLeft = 0; | ||
data.TireCombinedSlipRearRight = 0; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.