This isn't so much a mod API request as it is a save file format request. I am writing a CLI mod manager, and the next feature I'm working on is sync-mods-with-save. I have found many previous posts on this subject, but they're all pretty outdated.
Work was progressing, and I was slowly learning how to parse level-init.dat to get the mods, but ran into a wall: level-init.dat is created with the save, and is never updated after that point. The mod list and game version contained therein stay as they were when the save was first made. This obviously doesn't work for sync-mods-with-save, because it will not have the expected result of syncing with the currently active mods.
I looked at all of the other files, but the other `.dat` files do not have this information. `level.dat0` might have it, but it appears to be fairly aggressively compressed, and is therefore not readable by external tools without knowing the exact compression method so we can decompress it.
This all leads me to this: It would be amazing if a mod-list.json file was included with saves, so external tools like mine can easily read it. It could match the existing mod-list.json syntax, or could just be name -> version pairs, either would work. Deserializing json is infinitely easier than decompressing and reverse-engineering binary data.
Turns out decompressing level.dat0 was really straightforward, and I had just given up too early. Running zlib-flate -uncompress < level.dat0 > uncompressed.dat0 did the trick. Having a json file would still be nice though!
Place to ask discuss and request the modding support of Factorio. Don't request mods here.
1 post • Page 1 of 1