I have some problems with the IS_LAP structure in my C# InSim-Application.
I get wrong laptimes from LFS.
For the 1st lap of a race i get for LTime and ETime a value around 16100 to 16800 (or so)
for each racer. On the other Laps there are the values for LTime not much different but for
ETime they look correct (ex. 1st Lap was 50 secs and the 2nd around 46, i think around 96000
look ok).
I tried it on several tracks, only with AI, as singleplayer with and without AI ... it's still
the same wrong values.
I also tried on my both machines ... XP32 and Vista64 ... still the same.
The IS_SPX structure works fine and i cant find the error in my implementation .
Can somebody please check out if this is reproduceable in his InSim app?
I'm using TCP connection ... to complete.
Thanks a lot.
//struct IS_LAP // LAP time
//{
// byte Size; // 20
// byte Type; // ISP_LAP
// byte ReqI; // 0
// byte PLID; // player's unique id
// unsigned LTime; // lap time (ms)
// unsigned ETime; // total time (ms)
// word LapsDone; // laps completed
// word Flags; // player flags
// byte Sp0;
// byte Penalty; // current penalty value
// byte NumStops; // number of pit stops
// byte Sp3;
//}
[StructLayout(LayoutKind.Explicit, Size = 20)]public struct LAP
{
[FieldOffset(0)]byte Size;
[FieldOffset(1)]byte Type;
[FieldOffset(2)]byte ReqI;
[FieldOffset(3)]public byte PLID;
[FieldOffset(4), CLSCompliantAttribute(false)]public uint LTime;
[FieldOffset(8), CLSCompliantAttribute(false)]public uint ETime;
[FieldOffset(12), CLSCompliantAttribute(false)]public ushort LapsDone;
[FieldOffset(14), CLSCompliantAttribute(false)]public ushort Flags;
[FieldOffset(16)]byte Sp0;
[FieldOffset(17)]public byte Penalty;
[FieldOffset(18)]public byte NumStops;
[FieldOffset(19)]byte Sp3;
public override string ToString() {
return String.Format(
"PLID={0}, LTime={1}, ETime={2}, LapsDone={3}, Flags={4}, Penalty={5}, NumStops={6}",
PLID, LTime, ETime, LapsDone, Flags, Penalty,NumStops);
}
}
[StructLayout(LayoutKind.Explicit, Size = 16)]public struct SPX
{
[FieldOffset(0)]byte Size;
[FieldOffset(1)]byte Type;
[FieldOffset(2)]byte ReqI;
[FieldOffset(3)]public byte PLID;
[FieldOffset(4), CLSCompliantAttribute(false)]public uint STime;
[FieldOffset(8), CLSCompliantAttribute(false)]public uint ETime;
[FieldOffset(12)]public byte Split;
[FieldOffset(13)]public byte Penalty;
[FieldOffset(14)]public byte NumStops;
[FieldOffset(15)]byte Sp3;
public override string ToString() {
return String.Format(
"PLID={0}, STime={1}, ETime={2}, Split={3}, Penalty={4}, NumStops={5}",
PLID, STime, ETime, Split, Penalty, NumStops);
}
}
I get wrong laptimes from LFS.
For the 1st lap of a race i get for LTime and ETime a value around 16100 to 16800 (or so)
for each racer. On the other Laps there are the values for LTime not much different but for
ETime they look correct (ex. 1st Lap was 50 secs and the 2nd around 46, i think around 96000
look ok).
I tried it on several tracks, only with AI, as singleplayer with and without AI ... it's still
the same wrong values.
I also tried on my both machines ... XP32 and Vista64 ... still the same.
The IS_SPX structure works fine and i cant find the error in my implementation .
Can somebody please check out if this is reproduceable in his InSim app?
I'm using TCP connection ... to complete.
Thanks a lot.
//struct IS_LAP // LAP time
//{
// byte Size; // 20
// byte Type; // ISP_LAP
// byte ReqI; // 0
// byte PLID; // player's unique id
// unsigned LTime; // lap time (ms)
// unsigned ETime; // total time (ms)
// word LapsDone; // laps completed
// word Flags; // player flags
// byte Sp0;
// byte Penalty; // current penalty value
// byte NumStops; // number of pit stops
// byte Sp3;
//}
[StructLayout(LayoutKind.Explicit, Size = 20)]public struct LAP
{
[FieldOffset(0)]byte Size;
[FieldOffset(1)]byte Type;
[FieldOffset(2)]byte ReqI;
[FieldOffset(3)]public byte PLID;
[FieldOffset(4), CLSCompliantAttribute(false)]public uint LTime;
[FieldOffset(8), CLSCompliantAttribute(false)]public uint ETime;
[FieldOffset(12), CLSCompliantAttribute(false)]public ushort LapsDone;
[FieldOffset(14), CLSCompliantAttribute(false)]public ushort Flags;
[FieldOffset(16)]byte Sp0;
[FieldOffset(17)]public byte Penalty;
[FieldOffset(18)]public byte NumStops;
[FieldOffset(19)]byte Sp3;
public override string ToString() {
return String.Format(
"PLID={0}, LTime={1}, ETime={2}, LapsDone={3}, Flags={4}, Penalty={5}, NumStops={6}",
PLID, LTime, ETime, LapsDone, Flags, Penalty,NumStops);
}
}
[StructLayout(LayoutKind.Explicit, Size = 16)]public struct SPX
{
[FieldOffset(0)]byte Size;
[FieldOffset(1)]byte Type;
[FieldOffset(2)]byte ReqI;
[FieldOffset(3)]public byte PLID;
[FieldOffset(4), CLSCompliantAttribute(false)]public uint STime;
[FieldOffset(8), CLSCompliantAttribute(false)]public uint ETime;
[FieldOffset(12)]public byte Split;
[FieldOffset(13)]public byte Penalty;
[FieldOffset(14)]public byte NumStops;
[FieldOffset(15)]byte Sp3;
public override string ToString() {
return String.Format(
"PLID={0}, STime={1}, ETime={2}, Split={3}, Penalty={4}, NumStops={5}",
PLID, STime, ETime, Split, Penalty, NumStops);
}
}