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; }
bool Config::createGameConfig(const std::string &pGameId) { std::string fullIniFilePath = getGameConfigFile(pGameId); if (hasGameConfig(pGameId)) { return false; } File::CreateEmptyFile(fullIniFilePath); return true; }
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; }