import struct import enum import os # --- 1. Enumeration Equivalent --- # Defines the PlayerActions flags from the C# code for easy interpretation. @enum.unique class PlayerActions(enum.Flag): """ Represents the bit flags for player actions/states in a frame. """ None_ = 0 Jump = 1 Forward = 2 Backward = 4 Left = 8 Right = 0x10 TakeFlag = 0x20 Collision = 0x80 # --- 2. Constants and Struct Formats --- # The magic number used to identify the file format (72848253210177uL) EXPECTED_MAGIC_NUMBER = 72848253210177 # Structure of the file header (16 bytes): # < : Little-endian # Q : unsigned long long (8 bytes, for Magic Number) # H : unsigned short (2 bytes, for Version) # I : unsigned int (4 bytes, for Level ID) # H : unsigned short (2 bytes, for Frame Count) HEADER_FORMAT = "