Beispiel #1
0
def load(filename: str) -> GameDataFile:
    with open(filename, 'rb') as f:
        # Read entire file
        data = ScnDataReader(f.read())
        data.decompress()
        # Decompress only!
        # open("Empires_uncompressed.dat", 'wb').write(data.read())
        # exit(0)
        game_data_file = GameDataFile.read(data)
        data.done()
    return game_data_file
    def read(data: ScnDataReader):
        # Not sure how to walk through this trailing data yet.
        # Fails on both of the Multiplayer Border Patrol maps bundled with ROR and DE.
        # This data seems to be either 1320 or 708 bytes long.

        # Some kind of per-player data structure here
        player_count = data.uint32(debug="unknown field")  # Only seen 9.
        player_unknown_structure_list = []
        for i in range(1, 9):
            player_unknown_structure = UnknownPlayerDataStructure.read(data)
            player_unknown_structure_list.append(player_unknown_structure)
        data.done()
        return UnknownDataStructure(player_count,
                                    player_unknown_structure_list)
Beispiel #3
0
 def read(data: ScnDataReader, count: int):
     rows = [data.uint32() for _ in range(0, count)]
     data.done()
     return SlpCommandOffset(rows)
Beispiel #4
0
 def read(data: ScnDataReader, count: int):
     rows = [SlpOutlineRow.read(data) for _ in range(0, count)]
     data.done()
     return SlpOutline(rows)