bool Config::loadGameConfig(const std::string &pGameId) { std::string iniFileNameFull = getGameConfigFile(pGameId); if (!hasGameConfig(pGameId)) { INFO_LOG(LOADER, "Failed to read %s. No game-specific settings found, using global defaults.", iniFileNameFull.c_str()); return false; } changeGameSpecific(pGameId); IniFile iniFile; iniFile.Load(iniFileNameFull); for (size_t i = 0; i < ARRAY_SIZE(sections); ++i) { IniFile::Section *section = iniFile.GetOrCreateSection(sections[i].section); for (auto setting = sections[i].settings; setting->HasMore(); ++setting) { if (setting->perGame_){ setting->Get(section); } } } KeyMap::LoadFromIni(iniFile); return true; }
void Config::unloadGameConfig() { if (bGameSpecific) { changeGameSpecific(); Load(iniFilename_.c_str(), controllerIniFilename_.c_str()); } }
void Config::unloadGameConfig() { if (bGameSpecific){ changeGameSpecific(); IniFile iniFile; iniFile.Load(iniFilename_); // Reload game specific settings back to standard. IterateSettings(iniFile, [](IniFile::Section *section, ConfigSetting *setting) { if (setting->perGame_) { setting->Get(section); } }); LoadStandardControllerIni(); } }
bool Config::loadGameConfig(const std::string &pGameId) { std::string iniFileNameFull = getGameConfigFile(pGameId); if (!hasGameConfig(pGameId)) { INFO_LOG(LOADER, "Failed to read %s. No game-specific settings found, using global defaults.", iniFileNameFull.c_str()); return false; } changeGameSpecific(pGameId); IniFile iniFile; iniFile.Load(iniFileNameFull); IterateSettings(iniFile, [](IniFile::Section *section, ConfigSetting *setting) { if (setting->perGame_) { setting->Get(section); } }); KeyMap::LoadFromIni(iniFile); return true; }