Mod settings file format: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "mod-settings.dat is a binary stream file format. The data is read from start of file until there is no more data. If there is no data and you are at a point where there should...")
 
(Removed {{Languages}})
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
mod-settings.dat is a binary stream file format. The data is read from start of file until there is no more data. If there is no data and you are at a point where there should be data then the file is malformed. If you're at a point when you expect no more data but there is data then the file is malformed.
mod-settings.dat is a binary stream file format. The data is read from start of file until there is no more data. If there is no data and you are at a point where there should be data then the file is malformed. If you're at a point when you expect no more data but there is data then the file is malformed.
A C# example on how to parse the file format can be found here: https://forums.factorio.com/59851


== The file format ==
== The file format ==
The first 8 bytes are the [[Version_string_format|version]] of the game the file was created in. After these 8 bytes there is one bool (1 byte), always set to false.


The first 8 bytes are the [[Version_string_format|version]] of the game the file was created in.
Next is a single [[Property tree]]
 
Next is a single [[Property_tree]]


== Sections ==
== Sections ==
 
The loaded [[Property tree]] is expected to be of the [[Property_tree#Dictionary|Dictionary]] type with the following 3 sections:
The loaded [[Property_tree]] is expected to be of the [[Property_tree#Dictionary|Dictionary]] type with the following 3 sections:


=== Startup ===
=== Startup ===
 
This section is a [[Property tree]] with a key value of "startup" and a [[Property_tree#Dictionary|Dictionary]] value of mod settings.
This section is a [[Property_tree]] with a key value of "startup" and a [[Property_tree#Dictionary|Dictionary]] value of mod settings.


=== Runtime Global ===
=== Runtime Global ===
 
This section is a [[Property tree]] with a key value of "runtime-global" and a [[Property_tree#Dictionary|Dictionary]] value of mod settings.
This section is a [[Property_tree]] with a key value of "runtime-global" and a [[Property_tree#Dictionary|Dictionary]] value of mod settings.


=== Runtime Per User ===
=== Runtime Per User ===
This section is a [[Property tree]] with a key value of "runtime-per-user" and a [[Property_tree#Dictionary|Dictionary]] value of mod settings.


This section is a [[Property_tree]] with a key value of "runtime-per-user" and a [[Property_tree#Dictionary|Dictionary]] value of mod settings.
[[Category:Technical]]

Latest revision as of 09:07, 12 November 2023

mod-settings.dat is a binary stream file format. The data is read from start of file until there is no more data. If there is no data and you are at a point where there should be data then the file is malformed. If you're at a point when you expect no more data but there is data then the file is malformed.

A C# example on how to parse the file format can be found here: https://forums.factorio.com/59851

The file format

The first 8 bytes are the version of the game the file was created in. After these 8 bytes there is one bool (1 byte), always set to false.

Next is a single Property tree

Sections

The loaded Property tree is expected to be of the Dictionary type with the following 3 sections:

Startup

This section is a Property tree with a key value of "startup" and a Dictionary value of mod settings.

Runtime Global

This section is a Property tree with a key value of "runtime-global" and a Dictionary value of mod settings.

Runtime Per User

This section is a Property tree with a key value of "runtime-per-user" and a Dictionary value of mod settings.