bsnes/icarus/settings.cpp

25 lines
689 B
C++
Raw Normal View History

struct Settings : Markup::Node {
2015-08-21 11:29:53 +00:00
Settings();
auto save() -> void;
2015-08-21 11:29:53 +00:00
};
Settings::Settings() {
Markup::Node::operator=(BML::unserialize(string::read(locate("settings.bml"))));
auto set = [&](const string& name, const string& value) {
//create node and set to default value only if it does not already exist
if(!operator[](name)) operator()(name).setValue(value);
};
2015-08-21 11:29:53 +00:00
set("Library/Location", {Path::user(), "Emulation/"});
2015-08-21 11:29:53 +00:00
set("icarus/Path", Path::user());
set("icarus/CreateManifests", false);
set("icarus/UseDatabase", true);
set("icarus/UseHeuristics", true);
2015-08-21 11:29:53 +00:00
}
auto Settings::save() -> void {
file::write(locate("settings.bml"), BML::serialize(*this));
2015-08-21 11:29:53 +00:00
}