Jump to content

Bannish

Members
  • Content Count

    26
  • Joined

  • Last visited

Posts posted by Bannish


  1. 15 minutes ago, Lopensky said:

    Really sorry man, i was taling about the trackLength field, but copied the wrong one. Is this a  2 bytes data? Cause i have some problems reading the data.

    About the calculation i have this:

    20 bytes Header +

    21 bytes (other data in Session Packet) +

    21 * 5 = 105 bytes (marshal zones)

    = 146 bytes

     

    I'm quite sure thre is something i'm missing.. but can't sort it out.

     

    trackLengh is in fact a 2 byte data. your problem is your Header size. The Header struct has 23 bytes in total.

     

    struct PacketHeader
    {
        uint16    m_packetFormat;         // 2 bytes
        uint8     m_gameMajorVersion;     // 1 byte
        uint8     m_gameMinorVersion;     // 1 byte
        uint8     m_packetVersion;        // 1 byte
        uint8     m_packetId;             // 1 byte
        uint64    m_sessionUID;           // 8 bytes
        float     m_sessionTime;          // 4 bytes
        uint      m_frameIdentifier;      // 4 bytes (a normal int or uint are always 32 bits 😉 )
        uint8     m_playerCarIndex;       // 1 byte
    }; // Total 23 bytes

    Adding these 3 bytes to the size you calculated, we have 149 bytes in total for the package 😉 


  2. 28 minutes ago, Lopensky said:

     

    Con someone please explain me how this field works?

    Reading this field as stated just wreaks the sequence, wrecking out all next read data.

    I made a try with a field size of 4bytes (float) and this ust made all next data came out corrrectly, but still have a wrong read value in this field.

     

    I noticed also that the session packet is reported with a size of size: 149 bytes , but looking at the documentation you provided i find it out of 146 bytes.

     

    Can someone tell me what is wrong in the struct or in my tests? Thank you.. :classic_blink:

    So, m_totalLaps is a 1 byte whole number. in C# it would correspond to the "byte" data type. notice, that it's an unsigned type 😉 

    about your packet size, you must have an calculation error somewhere.

    the MarshalZone struct has a size of 5, and the array has a size of 21, so you have 105 bytes there alone. the rest of the session struct, i counted 44 bytes, so with my math, the 149 bytes are correct 😉 maybe you forgot to add the additional bytes of the header struct 😉

     

    Edit, just for clarification

     

    struct MarshalZone // 5 bytes in total
    {
        float  m_zoneStart;   // 4 bytes
        int8   m_zoneFlag;    // 1 byte
    };
    
    struct PacketSessionData
    {
        PacketHeader    m_header;               	// 23 bytes
    
        uint8           m_weather;              	// 1 byte - 24 total
        int8	    m_trackTemperature;    	// 1 byte - 25 total
        int8	    m_airTemperature;      	// 1 byte - 26 total
        uint8           m_totalLaps;           	// 1 byte - 27 total
        uint16          m_trackLength;           	// 2 bytes - 29 total
        uint8           m_sessionType;         	// 1 byte - 30 total
        int8            m_trackId;         		// 1 byte - 31 total
        uint8           m_formula;                  // 1 byte - 32 total
        uint16          m_sessionTimeLeft;    	// 2 bytes - 34 total
        uint16          m_sessionDuration;     	// 2 bytes - 36 total
        uint8           m_pitSpeedLimit;      	// 1 byte - 37 total
        uint8           m_gamePaused;               // 1 byte - 38 total
        uint8           m_isSpectating;        	// 1 byte - 39 total
        uint8           m_spectatorCarIndex;  	// 1 byte - 40 total
        uint8           m_sliProNativeSupport;	// 1 byte - 41 total
        uint8           m_numMarshalZones;         	// 1 byte - 42 total
        MarshalZone     m_marshalZones[21];         // 5 bytes * 21 = 105 bytes - 147 total
        uint8           m_safetyCarStatus;          // 1 byte - 148 total
        uint8           m_networkGame;              // 1 byte - 149 total

  3. 10 minutes ago, Poulpus said:

    OK, it goes beyond my remaining knowledge of C# 🙂

    Maybe just one suggestion: you are using struct annotations for PacketEventData and EventDataDetails, but not for the FastestLap struct. Could it be that the compiler arranges things on its own without any instructions, and messes it up? Maybe you could try to add StructLayout annotations to the FastestLap struct and see if it changes anything?

    Otherwise I would also advise to debug-print bit-by-bit what you receive in UDP and make sure you did not shift an index or two and read the wrong data at the wrong place (I had that kind of problems in Swift, and it can happen pretty quickly when you do things too fast...).

    you are my hero: i hadn't noticed, that i forgot to add the sequential StructLayout to those structs. after adding them, these are my outputs for the first lap on paul ricard on rain

    23:18:10,974 [F1Telemetry.DataCollector] [15] INFO - 121,696 - method SelectEventType - line 161
    23:18:10,975 [F1Telemetry.DataCollector] [15] INFO - 02:01.696 - method SelectEventType - line 162

    thank you again, it works like a charm now. sometimes i am so blind when i work with my own code 😂

    • Like 1

  4. 2 hours ago, Poulpus said:

    Hey @Bannish, it's been a while since I wrote my last line of C#, but looking at your code, is it normal that you cast the fastes lap time into a double (line 160)? As far as I remember, a float is 32 bits in size whereas double is 64 bits. From the UDP specs in this topic, it looks like the lap time is expressed in 32 bits-precision, so float would be the way to go here?

     

    40 minutes ago, RichardWh said:

    Yeah @Poulpus is exactly right @Bannish.

    In C#, I've used the following conversions from the feed:

    float=float
    uint16=ushort
    uint8=byte
    int8=sbyte
    uint64=ulong
    int16=short

    you guys are both right in that, that a float would be enough. i just saw, that i did forget to remove that cast, but when i last checked, that cast did not make a difference.

    case "ftlp":
    	log.Info("Fastest Lap");
        log.Info(evnt.m_eventDetails.ftlp.vehicleIdx);
        TimeSpan laptime = TimeSpan.FromSeconds(evnt.m_eventDetails.ftlp.lapTime);
        log.Info(evnt.m_eventDetails.ftlp.lapTime);
        log.Info(laptime.ToString("mm':'ss'.'fff"));

    these are the outputs without the cast to doulbe (first and second round on paul ricard, one round withflashback, the second without)

    22:17:01,649 [F1Telemetry.DataCollector] [4] INFO - System.Byte[] - method SelectPacket - line 128
    22:17:01,649 [F1Telemetry.DataCollector] [4] INFO - Fastest Lap - method SelectEventType - line 158
    22:17:01,650 [F1Telemetry.DataCollector] [4] INFO - 19 - method SelectEventType - line 159
    22:17:01,669 [F1Telemetry.DataCollector] [4] INFO - 9,24857E-44 - method SelectEventType - line 161
    22:17:01,677 [F1Telemetry.DataCollector] [4] INFO - 00:00.000 - method SelectEventType - line 162
    22:18:55,861 [F1Telemetry.DataCollector] [5] INFO - System.Byte[] - method SelectPacket - line 128
    22:18:55,862 [F1Telemetry.DataCollector] [5] INFO - Fastest Lap - method SelectEventType - line 158
    22:18:55,863 [F1Telemetry.DataCollector] [5] INFO - 19 - method SelectEventType - line 159
    22:18:55,864 [F1Telemetry.DataCollector] [5] INFO - 9,24857E-44 - method SelectEventType - line 161
    22:18:55,868 [F1Telemetry.DataCollector] [5] INFO - 00:00.000 - method SelectEventType - line 162

    I would like to note the "9,24857E-44" unformated output. i think, that this number is a bit small, don't you think too? i have a feeling, that i made a mistake in there. this is the code of my EventDataPacket

        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        public struct PacketEventData
        {
            public PacketHeader m_header;
    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
            public byte[] m_eventStringCode;
            public EventDataDetails m_eventDetails;
        }
    
        [StructLayout(LayoutKind.Explicit, Pack = 1)]
        public struct EventDataDetails
        {
            [FieldOffset(0)]
            public FastestLap ftlp;
    
            [FieldOffset(0)]
            public Retirement rtmt;
    
            [FieldOffset(0)]
            public TeamMateInPits tmpt;
    
            [FieldOffset(0)]
            public RaceWinner rcwn;
        }
    
        public struct FastestLap
        {
            public byte vehicleIdx; // Vehicle index of car achieving fastest lap
            public float lapTime;    // Lap time is in seconds
        }
    
        public struct Retirement
        {
            public byte vehicleIdx; // Vehicle index of car retiring
        }
    
        public struct TeamMateInPits
        {
            public byte vehicleIdx; // Vehicle index of team mate
        } 
    
        public struct RaceWinner
        {
            public byte vehicleIdx; // Vehicle index of the race winner
        }

    sorry for the long post guys. but i hope, that you can make some sense out of this


  5. Hello Guys, I just tried to catch the Event Packets and it seems, i did a good job with that. every event is recognized, but i have a problem with the "fastest lap" event. I am writing my program in c#.

    for the lap time, i am using the TimeSpan datatype and this is how i try to debug the info right now (using log4net)

    case "ftlp":
    	log.Info("Fastest Lap");
    	log.Info(evnt.m_eventDetails.ftlp.vehicleIdx);
    	TimeSpan laptime = TimeSpan.FromSeconds((double)evnt.m_eventDetails.ftlp.lapTime);
    	log.Info(evnt.m_eventDetails.ftlp.lapTime);
    	log.Info(laptime.ToString("mm':'ss'.'fff"));
    	break;
    <...>

    This is the log output i am getting from this:
     

    00:01:14,891 [F1Telemetry.DataCollector] [9] INFO - Fastest Lap - method SelectEventType - line 158
    00:01:14,891 [F1Telemetry.DataCollector] [9] INFO - 17 - method SelectEventType - line 159
    00:01:14,891 [F1Telemetry.DataCollector] [9] INFO - 9,24857E-44 - method SelectEventType - line 161
    00:01:14,891 [F1Telemetry.DataCollector] [9] INFO - 00:00:00 - method SelectEventType - line 162

    Even when i try to leave the formatting in the ToString method empty, i am still getting the 00:00:00 reading. I have a feeling, that I am missing something very obvious.


  6. 35 minutes ago, RichardWh said:

    If Packets can contain multiple types, then what is the point in the packet identifier?

    I used to check on the byte size, but now Lap Data and Car Setup are both 843.
    I can't check on the packet id, as packet id 6 is very often a different type.

    Am I missing something here?

    Maybe i am missing your point, but your aproach about the packet size couldn't have worked last year as well, since Lap Data and Car Setups had the same size last year as well.
    I am checking the packets, by taking the first few bytes, the first 21 to be precise, and convert them to the PacketHeader struct. this way, i can use the m_packetId to check, which packet i am receiving. 

    and why can't you check packet id 6? car telemetry is always the same structure

     

    edit: by the way, is there a way to set the sorting in topics to "sort by date" to default?


  7. 2 hours ago, Faya said:

    Hi all,

    I've merged another thread in with this one about the same issue. Thanks for your patience while we continue to investigate.

    In the meantime, can you try completely shutting down and rebooting your PC/Console and restarting to see if that helps? Let me know how you get on, thanks.

    It has been Several days since the first post of most of us. I'd say, that most of us shut down ther PC, when they go to sleep/work/etc. I personally do that and I tried MP every day since my original post and it still says, that i am banned under DX11, but i could play under DX12, if it wasn't so unstable on my system.

     

    tl,dr: No, Rebooting does not fix the issue!


  8. 22 hours ago, Faya said:

    Hi all,

    I've merged a few threads together to keep all the responses in the same place. For those who haven't already done so, please can you do/confirm the following;

    • Your Steam name
    • A picture of the error that you’re are getting
    • Are you running any UDP telemetry tools?

    To try to fix it while we do some investigating, could you try making sure you have any mods removed and verifying your files and seeing if that helps at all?

    Validating F1 2019 downloaded correctly

    • Open Steam and go to the Library tab
    • Right click on F1 2019 and select Properties
    • Go to the Local Files tab and click Verify Integrity Of Game Files

    Steam Name: Bannish (https://steamcommunity.com/id/bannishzertak/) ID:76561197982161101

    Pictures: See below

    Running UDP: No

    File Verification said no errors.

    DX Mode: DX11 i get these messages, DX12 Works

    Anmerkung 2019-07-26 023844.png

    Anmerkung 2019-07-26 023916.png


  9. On 6/20/2019 at 5:29 PM, Faya said:

    union EventDataDetails { struct { uint8 vehicleIdx; // Vehicle index of car achieving fastest lap float lapTime; // Lap time is in seconds } FastestLap; struct { uint8 vehicleIdx; // Vehicle index of car retiring } Retirement; struct { uint8 vehicleIdx; // Vehicle index of team mate } TeamMateInPits; struct { uint8 vehicleIdx; // Vehicle index of the race winner } RaceWinner; };

    This might be a nooby question, but I am writing a Telemetry app in c# and afaik, there is no "union" type. What do I have to do in C# to get this to work?

     

    Edit:

    After some searching, I found out that people say to use the Explicit LayoutKind. so now i wanted to know, if this would work, or if I can make this easier

        [StructLayout(LayoutKind.Explicit, Pack = 1)]
        public struct EventDataDetails
        {
            [FieldOffset(0)]
            public FastestLap ftlp;
    
            [FieldOffset(0)]
            public Retirement rtmt;
    
            [FieldOffset(0)]
            public TeamMateInPits tmpt;
    
            [FieldOffset(0)]
            public RaceWinner rcwn;
        }
    
        public struct FastestLap
        {
            byte vehicleIdx; // Vehicle index of car achieving fastest lap
            float lapTime;    // Lap time is in seconds
        }
    
        public struct Retirement
        {
            byte vehicleIdx; // Vehicle index of car retiring
        }
    
        public struct TeamMateInPits
        {
            byte vehicleIdx; // Vehicle index of team mate
        } 
    
        public struct RaceWinner
        {
            byte vehicleIdx; // Vehicle index of the race winner
        }

     

×