Skip to content

Commit a9f637d

Browse files
committed
Fix some PMP reading issues.
1 parent 0a76cf7 commit a9f637d

File tree

2 files changed

+37
-22
lines changed

2 files changed

+37
-22
lines changed

xivModdingFramework/Mods/FileTypes/PMP.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,16 @@ await IOUtil.UnzipFiles(path, tempFolder, (file) =>
148148
}
149149
}
150150

151+
var defOp = pmp.DefaultMod as PmpStandardOptionJson;
152+
if(defOp != null)
153+
{
154+
foreach (var kv in defOp.Files)
155+
{
156+
var zipPath = kv.Value;
157+
allPmpFiles.Add(zipPath);
158+
}
159+
}
160+
151161
// Log the unused files that were contained in the PMP.
152162
var unusedFiles = IOUtil.GetFilesInFolder(path).Select(x => x.Substring(path.Length + 1).ToLower()).Where(x => !allPmpFiles.Contains(x) && !IsPmpJsonFile(x)).ToList();
153163
pmp.ExtraFiles = new HashSet<string>(unusedFiles);

xivModdingFramework/Mods/WizardData.cs

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,33 @@ public static async Task<WizardData> FromPmp(PMPJson pmp, string unzipPath)
10761076
data.ModPack = mp;
10771077
data.RawSource = pmp;
10781078

1079-
if (pmp.Groups.Count > 0 && pmp.Groups.Any(x => x.Options.Count > 0))
1079+
var def = pmp.DefaultMod as PmpStandardOptionJson;
1080+
if (def != null)
1081+
{
1082+
var anyData = def.Manipulations.Count > 0 || def.FileSwaps.Count > 0 || def.Files.Count > 0;
1083+
if (anyData)
1084+
{
1085+
// Just drum up a basic group containing the default option.
1086+
var fakeGroup = new PMPGroupJson();
1087+
fakeGroup.Name = "Default";
1088+
fakeGroup.Options = new List<PMPOptionJson>() { pmp.DefaultMod };
1089+
fakeGroup.SelectedSettings = 1;
1090+
fakeGroup.Type = "Single";
1091+
1092+
if (string.IsNullOrWhiteSpace(pmp.DefaultMod.Name))
1093+
{
1094+
pmp.DefaultMod.Name = "Default";
1095+
}
1096+
1097+
var page = new WizardPageEntry();
1098+
page.Name = "Page 1";
1099+
page.Groups = new List<WizardGroupEntry>();
1100+
page.Groups.Add(await WizardGroupEntry.FromPMPGroup(fakeGroup, unzipPath));
1101+
data.DataPages.Add(page);
1102+
}
1103+
}
1104+
1105+
if (pmp.Groups.Count > 0)
10801106
{
10811107
// Create sufficient pages.
10821108
var pageMax = pmp.Groups.Max(x => x.Page);
@@ -1095,27 +1121,6 @@ public static async Task<WizardData> FromPmp(PMPJson pmp, string unzipPath)
10951121
page.Groups.Add(await WizardGroupEntry.FromPMPGroup(g, unzipPath));
10961122
}
10971123
}
1098-
else
1099-
{
1100-
1101-
// Just drum up a basic group containing the default option.
1102-
var fakeGroup = new PMPGroupJson();
1103-
fakeGroup.Name = "Default";
1104-
fakeGroup.Options = new List<PMPOptionJson>() { pmp.DefaultMod };
1105-
fakeGroup.SelectedSettings = 1;
1106-
fakeGroup.Type = "Single";
1107-
1108-
if (string.IsNullOrWhiteSpace(pmp.DefaultMod.Name))
1109-
{
1110-
pmp.DefaultMod.Name = "Default";
1111-
}
1112-
1113-
var page = new WizardPageEntry();
1114-
page.Name = "Page 1";
1115-
page.Groups = new List<WizardGroupEntry>();
1116-
page.Groups.Add(await WizardGroupEntry.FromPMPGroup(fakeGroup, unzipPath));
1117-
data.DataPages.Add(page);
1118-
}
11191124
return data;
11201125
}
11211126

0 commit comments

Comments
 (0)