MCPcopy Create free account
hub / github.com/RSDKModding/RSDKv3-Decompilation / LoadMod

Function LoadMod

RSDKv3/ModAPI.cpp:146–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

InitModsFunction · 0.85

Calls 6

StrCopyFunction · 0.85
StrCompFunction · 0.85
ScanModFolderFunction · 0.85
GetStringMethod · 0.80
GetBoolMethod · 0.80
GetIntegerMethod · 0.80

Tested by

no test coverage detected