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

Function LoadMod

RSDKv4/ModAPI.cpp:147–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145 ReadUserdata();
146}
147bool 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;

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