|
17 | 17 | // Equivalent to the lastmodid used in XMLData.cpp, except empty for basegame.
|
18 | 18 | std::string lastModIdButCooler = "";
|
19 | 19 |
|
20 |
| -void UpdateLastModId(ModEntry* modentry) { |
21 |
| - lastModIdButCooler = ""; |
22 |
| - if (modentry != nullptr) { |
23 |
| - if (std::string(modentry->GetId()).length() > 0) { |
24 |
| - lastModIdButCooler = modentry->GetId(); |
| 20 | +//this is now basically just a copypaste of void ProcessModEntry(char* xmlpath,ModEntry* mod) from XMLData.cpp with minor changes |
| 21 | +void UpdateLastModId( ModEntry* mod, char* xmlpath) { |
| 22 | + bool iscontent = false; |
| 23 | + if (mod != NULL) { //it is null when its loading vanilla stuff |
| 24 | + lastModIdButCooler = mod->GetId(); |
| 25 | + } |
| 26 | + else { |
| 27 | + lastModIdButCooler = "BaseGame"; |
| 28 | + } |
| 29 | + if ((stringlower(xmlpath).find("/content/") != string::npos) || (stringlower(xmlpath).find("/content-dlc3/") != string::npos)) { |
| 30 | + iscontent = true; |
| 31 | + } |
| 32 | + else { |
| 33 | + iscontent = false; |
| 34 | + } |
| 35 | + if ((string(lastModIdButCooler).length() == 0) || ((lastModIdButCooler == "BaseGame") && iscontent)) { |
| 36 | + string path = string(xmlpath); |
| 37 | + int first = path.find("/mods/") + 6; |
| 38 | + int last = path.find("/content"); |
| 39 | + if (!iscontent) { |
| 40 | + last = path.find("/resources"); |
25 | 41 | }
|
26 |
| - else if (modentry->GetDir().length() > 0) { |
27 |
| - lastModIdButCooler = modentry->GetDir(); |
| 42 | + else if (last <= 0) { |
| 43 | + last = path.find("/content-dlc3"); |
28 | 44 | }
|
| 45 | + path = path.substr(first, last - first); //when the id is null(which it can fucking be) just use the folder name as ID... |
| 46 | + lastModIdButCooler = path; |
| 47 | + } |
| 48 | + //printf("path: %s (mod:%s iscontent:%d) \n", xmlpath,lastmodid,iscontent); |
| 49 | + //logViewer.AddLog("[REPENTOGON]", "Mod ID: %s \n", lastmodid); |
| 50 | + if (lastModIdButCooler == "BaseGame") { |
| 51 | + lastModIdButCooler = ""; |
29 | 52 | }
|
30 | 53 | }
|
31 | 54 |
|
32 | 55 | HOOK_METHOD(ItemConfig, Load, (char* xmlpath, ModEntry* modentry)->void) {
|
33 |
| - UpdateLastModId(modentry); |
| 56 | + UpdateLastModId(modentry, xmlpath); |
34 | 57 | super(xmlpath, modentry);
|
35 | 58 | }
|
36 | 59 |
|
37 | 60 | HOOK_METHOD(ItemConfig, LoadCostumes, (char* xmlpath, ModEntry* modentry)->void) {
|
38 |
| - UpdateLastModId(modentry); |
| 61 | + UpdateLastModId(modentry, xmlpath); |
39 | 62 | super(xmlpath, modentry);
|
40 | 63 | }
|
41 | 64 |
|
@@ -161,7 +184,7 @@ void ASMPatchTieModdedCostumesToModdedNullItems() {
|
161 | 184 | * This allows the costume to be permanantly applied to the player, including during the mineshaft sequence, like the hair of vanilla characters.
|
162 | 185 | */
|
163 | 186 | HOOK_METHOD(EntityConfig, LoadPlayers, (char* xmlpath, ModEntry* modentry)->void) {
|
164 |
| - UpdateLastModId(modentry); |
| 187 | + UpdateLastModId(modentry, xmlpath); |
165 | 188 |
|
166 | 189 | super(xmlpath, modentry);
|
167 | 190 |
|
|
0 commit comments