anno-mods / FileDBReader

A command line tool for working with a proprietary bluebyte file compression used in Anno 2205 and 1800.
15 stars 4 forks source link

Can not unpack savegame data.a7s/data.bin #45

Closed Serpens66 closed 6 months ago

Serpens66 commented 6 months ago

The unpacking from data.bin to xml simply does not continue after:

PS C:\Users\WDAGUtilityAccount\Desktop\FDB TEST> .\FileDBReader.exe decompress -f savegames/Scenario04/data.bin -i FileFormats/a7s_all.xml -y
[READER]: Autodetected FileVersion = Version3
FILEDB Deserialization took 394.4068 ms
FILEDB to XML conversion took: 1254.1961 ms
Started interpreting savegames/Scenario04/data.bin
[READER]: Autodetected FileVersion = Version3
FILEDB Deserialization took 85.1243 ms
FILEDB to XML conversion took: 767.4832 ms

it does nothing for minutes on a small savegame and taskmanager shows no workload. And the xml file stays empty. Tested with FileDBReader.exe version 2.42 and 2.43. The other files in savegame: meta, gamesetup and header, work fine by the way.

BUT: With FileDBReader.exe 2.3 it continues and shows some errors with Wrong Bytesize at None, Bytesize according to Interpreter: 4, Found in File: 8. The node is ignored for that reason. and after they are skipped the xml file is successfully filled.

Python code based on AnnoSavegameVisualizer to reprocude from a savegame:

import zlib
import pathlib
import subprocess

path = pathlib.Path("savegames/Autosave 0.a7s")
out_path = pathlib.Path("savegames/rdaunpacked")
out_path.mkdir(parents=True, exist_ok=True) # create folder if not exist
subprocess.call(f"..\RDAConsole.exe extract -f \"{path}\" -o \"{out_path}\" -y -n")
files = list(out_path.glob("*.a7s"))
for file in files:
  content = open(file, 'rb').read()
  content = zlib.decompress(content)
  with open(file.with_suffix(".bin"), 'wb') as f:
      f.write(content)
  subprocess.call(f".\FileDBReader.exe decompress -i \"FileFormats/a7s_all.xml\" -f \"{str(file.with_suffix('.bin'))}\" -y")
taubenangriff commented 6 months ago

Okay, the document markings seem to screw performance big time. Lemme upload a fix