Add mod-list.json to save files

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 451
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Add mod-list.json to save files

Post by raiguard »

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.

UPDATE:

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!
Don't forget, you're here forever.

User avatar
Hares
Fast Inserter
Fast Inserter
Posts: 127
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Add mod-list.json to save files

Post by Hares »

raiguard wrote:
Sat Nov 06, 2021 12:35 am
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!
The method you mentioned no longer works, unfortunately.
I was using

Code: Select all

zlib-flate version 1.0
Update #1
Added quotation.

Post Reply

Return to “Modding interface requests”