Replay Mod Forums

[Question] Has the .mcpr format been changed?
    • User
    • 11 forum posts
    User791
    #1

    Mar 12 18, 07:27 PM | Last edited: Mar 15 18, 12:49 PM

    Hopefully I'm not missing something (probably I am), but I used to be able to decode packets in Replay files using the pattern described here, but for some reason it doesn't work now.
    Here's the Python code I'm using:
    import struct
    with open("recording.tmcpr") as fin:
    while True:
    t, l = struct.unpack(">ii", fin.read(8)) #reads two big-endian 4 bit integers (timestamp and length), which I what I assume Java uses.
    print t, l
    fin.read(l) #skips past the packet itself for now.

    Spoiler: Output (varies depending on replay, but ends the same)


    It basically ends early, without reading all the packets.
    It's partially based on the code from the .tmcpr recovery script. Interestingly, if I run the script on the extracted recording.tmcpr I used above, the replay is still valid and works correctly, but its duration lasts only one second. The Replay Viewer still ignores that though, so the replay carries on playing despite the timeline reaching its end. The format must have changed, then. But to what, out of curiosity?


    • Developer
    • 1883 forum posts
    User10
    #2

    Mar 13 18, 01:26 PM

    No, not recently, and the .tmcpr format not at all.
    Assuming you meant to write l instead of s in the last line, your code seems to work as expected. Looks like the replay you're using is broken.


    • User
    • 11 forum posts
    User791

    in response to User10

    #3

    Mar 15 18, 12:46 PM | Last edited: Mar 15 18, 12:48 PM


    No, not recently, and the .tmcpr format not at all.
    Assuming you meant to write l instead of s in the last line, your code seems to work as expected. Looks like the replay you're using is broken.

    Ah, yes, that was a mistake on my part, typing up the code here. I've corrected it now.
    Hmm, the replay seems fine though. It must be to do with Python. I found that either reading directly from the zip (I was extracting it manually by replacing .mcpr with .zip - might be the issue) or switching to node.js made it work again.
    Well, at least thanks for confirming the .tmcpr format hasn't changed. :)