bsnes/icarus/settings.cpp

32 lines
837 B
C++
Raw Normal View History

2015-08-21 11:29:53 +00:00
struct Settings : Configuration::Document {
Settings();
~Settings();
Configuration::Node root;
string activePath;
string libraryPath;
bool createManifests = false;
bool useDatabase = true;
bool useHeuristics = true;
2015-08-21 11:29:53 +00:00
};
Settings::Settings() {
root.append(activePath, "ActivePath");
root.append(libraryPath, "LibraryPath");
root.append(createManifests, "CreateManifests");
root.append(useDatabase, "UseDatabase");
root.append(useHeuristics, "UseHeuristics");
2015-08-21 11:29:53 +00:00
append(root, "Settings");
directory::create({configpath(), "icarus/"});
load({configpath(), "icarus/settings.bml"});
save({configpath(), "icarus/settings.bml"});
if(!activePath) activePath = userpath();
if(!libraryPath) libraryPath = {userpath(), "Emulation/"};
}
Settings::~Settings() {
save({configpath(), "icarus/settings.bml"});
}