rFactor2 Replay format needed

Discussion in 'Technical & Support' started by Gerald Jacobson, Feb 15, 2014.

  1. Gerald Jacobson

    Gerald Jacobson Registered

    Joined:
    Jan 26, 2013
    Messages:
    827
    Likes Received:
    18
    Sorry Terence, i'm still stuck.

    I still read successfully until the driver list, but i can find how many byte to skip after the driver list to reach your four 32-bit values. (this part seems different from rf1, as if i put the rf1 code atfer the driver list, i cannot find any correct data)

    On rF1, the code that worked, just after the driver list, was
    Code:
    // bis -> file input stream 
    // info -> my own replay object
    collectDrivers(bis, numberOfDrivers, handler); // work fine on rf2 too
    
    			readFloat(bis); // replay playback position
    			readInt(bis); // unknown
    			int camera_flag = readInt(bis);
    			if (camera_flag != 0) {
    				collectReplayCameras(bis, handler);
    			}
    
    
    			readInt(bis); // eventGroupCount
    			readInt(bis); // eventCount
    
    			readFloat(bis); // unknown
    
    			info.setStartAt(readFloat(bis));
    			info.setEndAt(readFloat(bis));
    			info.setDuration(readFloat(bis));
    
     
  2. Gerald Jacobson

    Gerald Jacobson Registered

    Joined:
    Jan 26, 2013
    Messages:
    827
    Likes Received:
    18
    i do more test and find a bug in my collectDriver method. Now i retreive all driver correctly, and i think i have found the four 32-bit (indeed if i substract the two last 32 bit, the result is the duration of the replay).
    But if i put directly after that my code to collect events like in rF1, it does not work.

    In rF1 from now i would find:

    32 bits -> time of the event (OK in rf2 too)
    16 bits -> the event group count
    Then i made a loop for "event group count" iteration
    For each iteration, i find the header (an unsigned long) where i can extract "driverId", "eventClass", "eventSize", etc...

    But, with an rF2 replay, at the end of the "event group count" loop, i'm desynchronized (so the eventSize extracted from the header) seems wrong . Indeed the next 32 bits shoud be the new time event, but it is not.
    Code:
        long header = readUnsignedLong(bis);
        // System.out.println("Header=" + header);
        long eventSize = header >> 8 & 0x03ff;
        long eventClass = header >> 29;
        long eventType = header >> 18 & 0x03f;
        long driverId = header & 0x0ff;
    
    it seems that the data format, just after the 4 byte "time of the event", have changed compare to rF1.
     
    Last edited by a moderator: Apr 27, 2014

Share This Page