| 145 | ReadUserdata(); |
| 146 | } |
| 147 | bool LoadMod(ModInfo *info, std::string modsPath, std::string folder, bool active) |
| 148 | { |
| 149 | if (!info) |
| 150 | return false; |
| 151 | |
| 152 | info->fileMap.clear(); |
| 153 | info->name = ""; |
| 154 | info->desc = ""; |
| 155 | info->author = ""; |
| 156 | info->version = ""; |
| 157 | info->folder = ""; |
| 158 | info->active = false; |
| 159 | |
| 160 | const std::string modDir = modsPath + "/" + folder; |
| 161 | |
| 162 | FileIO *f = fOpen((modDir + "/mod.ini").c_str(), "r"); |
| 163 | if (f) { |
| 164 | fClose(f); |
| 165 | IniParser modSettings((modDir + "/mod.ini").c_str(), false); |
| 166 | |
| 167 | info->name = "Unnamed Mod"; |
| 168 | info->desc = ""; |
| 169 | info->author = "Unknown Author"; |
| 170 | info->version = "1.0.0"; |
| 171 | info->folder = folder; |
| 172 | |
| 173 | char infoBuf[0x100]; |
| 174 | // Name |
| 175 | StrCopy(infoBuf, ""); |
| 176 | modSettings.GetString("", "Name", infoBuf); |
| 177 | if (!StrComp(infoBuf, "")) |
| 178 | info->name = infoBuf; |
| 179 | // Desc |
| 180 | StrCopy(infoBuf, ""); |
| 181 | modSettings.GetString("", "Description", infoBuf); |
| 182 | if (!StrComp(infoBuf, "")) |
| 183 | info->desc = infoBuf; |
| 184 | // Author |
| 185 | StrCopy(infoBuf, ""); |
| 186 | modSettings.GetString("", "Author", infoBuf); |
| 187 | if (!StrComp(infoBuf, "")) |
| 188 | info->author = infoBuf; |
| 189 | // Version |
| 190 | StrCopy(infoBuf, ""); |
| 191 | modSettings.GetString("", "Version", infoBuf); |
| 192 | if (!StrComp(infoBuf, "")) |
| 193 | info->version = infoBuf; |
| 194 | |
| 195 | info->active = active; |
| 196 | |
| 197 | ScanModFolder(info); |
| 198 | |
| 199 | info->useScripts = false; |
| 200 | modSettings.GetBool("", "TxtScripts", &info->useScripts); |
| 201 | if (info->useScripts && info->active) |
| 202 | forceUseScripts = true; |
| 203 | |
| 204 | info->skipStartMenu = false; |
no test coverage detected