schadocalex / gbx-py

7 stars 2 forks source link

parsing and saving a map results in: 'Couldn't load map!' #4

Open XertroV opened 1 year ago

XertroV commented 1 year ago

script to reproduce:

import sys
from src.parser import parse_node, generate_node

def main(filepath: str):
    data, nb_nodes, raw_bytes = parse_node(filepath)
    print(f"Parsed nb nodes: {nb_nodes}, bytes len: {len(raw_bytes)}")
    print("Generating gbx")
    gbx_bs = generate_node(data)
    print(f"Generated len: {len(gbx_bs)}")
    with open(filepath[:-8] + "_resaved.Map.gbx", "wb") as f:
        f.write(gbx_bs)
    print("done")

if __name__ == "__main__":
    file = sys.argv[1]
    main(file)
schadocalex commented 1 year ago

I will add MT chunks soon, you could try without. You may add a GUI (for dev) to see if something is wrong.