v3.5.4.0
- SmokeAPI's dlc_ids parameter is now properly utilized (should fix Arma 3 launcher issues) - Overhauled the ScreamAPI config creation to utilize unlock_all and auto_inject with proper overrides
This commit is contained in:
parent
dba497c574
commit
22e7e9ec46
4 changed files with 44 additions and 40 deletions
|
@ -5,7 +5,7 @@
|
||||||
<UseWindowsForms>True</UseWindowsForms>
|
<UseWindowsForms>True</UseWindowsForms>
|
||||||
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
||||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||||
<Version>3.5.3.1</Version>
|
<Version>3.5.4.0</Version>
|
||||||
<PackageIcon>Resources\ini.ico</PackageIcon>
|
<PackageIcon>Resources\ini.ico</PackageIcon>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
||||||
|
|
|
@ -56,7 +56,7 @@ internal partial class InstallForm : CustomForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void WriteSmokeConfiguration(StreamWriter writer, SortedList<string, (DlcType type, string name, string icon)> overrideDlc, SortedList<string, (DlcType type, string name, string icon)> allDlc, InstallForm installForm = null)
|
internal static void WriteSmokeConfiguration(StreamWriter writer, SortedList<string, (DlcType type, string name, string icon)> overrideDlc, SortedList<string, (DlcType type, string name, string icon)> injectDlc, InstallForm installForm = null)
|
||||||
{
|
{
|
||||||
Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
writer.WriteLine("{");
|
writer.WriteLine("{");
|
||||||
|
@ -81,18 +81,18 @@ internal partial class InstallForm : CustomForm
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
writer.WriteLine(" \"override\": [],");
|
writer.WriteLine(" \"override\": [],");
|
||||||
if (allDlc.Count > 0)
|
if (injectDlc.Count > 0)
|
||||||
{
|
{
|
||||||
writer.WriteLine(" \"dlc_ids\": [");
|
writer.WriteLine(" \"dlc_ids\": [");
|
||||||
KeyValuePair<string, (DlcType type, string name, string icon)> lastAllDlc = allDlc.Last();
|
KeyValuePair<string, (DlcType type, string name, string icon)> lastInjectDlc = injectDlc.Last();
|
||||||
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in allDlc)
|
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in injectDlc)
|
||||||
{
|
{
|
||||||
Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
string dlcId = pair.Key;
|
string dlcId = pair.Key;
|
||||||
(_, string dlcName, _) = pair.Value;
|
(_, string dlcName, _) = pair.Value;
|
||||||
writer.WriteLine($" {dlcId}{(pair.Equals(lastAllDlc) ? "" : ",")}");
|
writer.WriteLine($" {dlcId}{(pair.Equals(lastInjectDlc) ? "" : ",")}");
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser($"Added DLC to SmokeAPI.json with appid {dlcId} ({dlcName})", InstallationLog.Action, info: false);
|
installForm.UpdateUser($"Added injected DLC to SmokeAPI.json with appid {dlcId} ({dlcName})", InstallationLog.Action, info: false);
|
||||||
}
|
}
|
||||||
writer.WriteLine(" ],");
|
writer.WriteLine(" ],");
|
||||||
}
|
}
|
||||||
|
@ -176,21 +176,26 @@ internal partial class InstallForm : CustomForm
|
||||||
installForm.UpdateUser("Generating SmokeAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
installForm.UpdateUser("Generating SmokeAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||||
File.Create(config).Close();
|
File.Create(config).Close();
|
||||||
StreamWriter writer = new(config, true, Encoding.UTF8);
|
StreamWriter writer = new(config, true, Encoding.UTF8);
|
||||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> allDlc = selection.AllDlc.AsEnumerable();
|
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> overrideDlc = selection.AllDlc.Except(selection.SelectedDlc);
|
||||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraDlc)
|
|
||||||
allDlc = allDlc.Concat(extraDlc);
|
|
||||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> overrideDlc = allDlc.Except(selection.SelectedDlc);
|
|
||||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||||
overrideDlc = overrideDlc.Except(extraDlc);
|
overrideDlc = overrideDlc.Except(extraDlc);
|
||||||
|
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> injectDlc = new List<KeyValuePair<string, (DlcType type, string name, string icon)>>();
|
||||||
|
if (selection.AllDlc.Count > 64 || selection.ExtraDlc.Any(e => e.dlc.Count > 64))
|
||||||
|
{
|
||||||
|
injectDlc = injectDlc.Concat(selection.SelectedDlc.Where(pair => pair.Value.type is DlcType.SteamHidden));
|
||||||
|
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||||
|
if (selection.ExtraDlc.Where(e => e.id == id).Single().dlc.Count > 64)
|
||||||
|
injectDlc = injectDlc.Concat(extraDlc.Where(pair => pair.Value.type is DlcType.SteamHidden));
|
||||||
|
}
|
||||||
WriteSmokeConfiguration(writer,
|
WriteSmokeConfiguration(writer,
|
||||||
new(overrideDlc.ToDictionary(pair => pair.Key, pair => pair.Value), AppIdComparer.Comparer),
|
new(overrideDlc.ToDictionary(pair => pair.Key, pair => pair.Value), AppIdComparer.Comparer),
|
||||||
new(allDlc.ToDictionary(pair => pair.Key, pair => pair.Value), AppIdComparer.Comparer),
|
new(injectDlc.ToDictionary(pair => pair.Key, pair => pair.Value), AppIdComparer.Comparer),
|
||||||
installForm);
|
installForm);
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
});
|
});
|
||||||
|
|
||||||
internal static void WriteScreamConfiguration(StreamWriter writer, SortedList<string, (DlcType type, string name, string icon)> dlc, List<(string id, string name, SortedList<string, (DlcType type, string name, string icon)> dlc)> extraDlc, InstallForm installForm = null)
|
internal static void WriteScreamConfiguration(StreamWriter writer, SortedList<string, (DlcType type, string name, string icon)> overrideCatalogItems, SortedList<string, (DlcType type, string name, string icon)> entitlements, InstallForm installForm = null)
|
||||||
{
|
{
|
||||||
Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
writer.WriteLine("{");
|
writer.WriteLine("{");
|
||||||
|
@ -199,39 +204,30 @@ internal partial class InstallForm : CustomForm
|
||||||
writer.WriteLine(" \"eos_logging\": false,");
|
writer.WriteLine(" \"eos_logging\": false,");
|
||||||
writer.WriteLine(" \"block_metrics\": false,");
|
writer.WriteLine(" \"block_metrics\": false,");
|
||||||
writer.WriteLine(" \"catalog_items\": {");
|
writer.WriteLine(" \"catalog_items\": {");
|
||||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> catalogItems = dlc.Where(pair => pair.Value.type == DlcType.EpicCatalogItem);
|
writer.WriteLine(" \"unlock_all\": true,");
|
||||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> _dlc) in extraDlc)
|
if (overrideCatalogItems.Any())
|
||||||
catalogItems = catalogItems.Concat(_dlc.Where(pair => pair.Value.type == DlcType.EpicCatalogItem));
|
|
||||||
if (catalogItems.Any())
|
|
||||||
{
|
{
|
||||||
writer.WriteLine(" \"unlock_all\": false,");
|
|
||||||
writer.WriteLine(" \"override\": [");
|
writer.WriteLine(" \"override\": [");
|
||||||
KeyValuePair<string, (DlcType type, string name, string icon)> lastCatalogItem = catalogItems.Last();
|
KeyValuePair<string, (DlcType type, string name, string icon)> lastOverrideCatalogItem = overrideCatalogItems.Last();
|
||||||
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in catalogItems)
|
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in overrideCatalogItems)
|
||||||
{
|
{
|
||||||
Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
string id = pair.Key;
|
string id = pair.Key;
|
||||||
(_, string name, _) = pair.Value;
|
(_, string name, _) = pair.Value;
|
||||||
writer.WriteLine($" \"{id}\"{(pair.Equals(lastCatalogItem) ? "" : ",")}");
|
writer.WriteLine($" \"{id}\"{(pair.Equals(lastOverrideCatalogItem) ? "" : ",")}");
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser($"Added catalog item to ScreamAPI.json with id {id} ({name})", InstallationLog.Action, info: false);
|
installForm.UpdateUser($"Added override catalog item to ScreamAPI.json with id {id} ({name})", InstallationLog.Action, info: false);
|
||||||
}
|
}
|
||||||
writer.WriteLine(" ]");
|
writer.WriteLine(" ]");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
writer.WriteLine(" \"unlock_all\": true,");
|
|
||||||
writer.WriteLine(" \"override\": []");
|
writer.WriteLine(" \"override\": []");
|
||||||
}
|
|
||||||
writer.WriteLine(" },");
|
writer.WriteLine(" },");
|
||||||
writer.WriteLine(" \"entitlements\": {");
|
writer.WriteLine(" \"entitlements\": {");
|
||||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> entitlements = dlc.Where(pair => pair.Value.type == DlcType.EpicEntitlement);
|
writer.WriteLine(" \"unlock_all\": true,");
|
||||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> _dlc) in extraDlc)
|
writer.WriteLine(" \"auto_inject\": true,");
|
||||||
entitlements = entitlements.Concat(_dlc.Where(pair => pair.Value.type == DlcType.EpicEntitlement));
|
|
||||||
if (entitlements.Any())
|
if (entitlements.Any())
|
||||||
{
|
{
|
||||||
writer.WriteLine(" \"unlock_all\": false,");
|
|
||||||
writer.WriteLine(" \"auto_inject\": false,");
|
|
||||||
writer.WriteLine(" \"inject\": [");
|
writer.WriteLine(" \"inject\": [");
|
||||||
KeyValuePair<string, (DlcType type, string name, string icon)> lastEntitlement = entitlements.Last();
|
KeyValuePair<string, (DlcType type, string name, string icon)> lastEntitlement = entitlements.Last();
|
||||||
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in entitlements)
|
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in entitlements)
|
||||||
|
@ -246,11 +242,7 @@ internal partial class InstallForm : CustomForm
|
||||||
writer.WriteLine(" ]");
|
writer.WriteLine(" ]");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
writer.WriteLine(" \"unlock_all\": true,");
|
|
||||||
writer.WriteLine(" \"auto_inject\": true,");
|
|
||||||
writer.WriteLine(" \"inject\": []");
|
writer.WriteLine(" \"inject\": []");
|
||||||
}
|
|
||||||
writer.WriteLine(" }");
|
writer.WriteLine(" }");
|
||||||
writer.WriteLine("}");
|
writer.WriteLine("}");
|
||||||
}
|
}
|
||||||
|
@ -321,7 +313,16 @@ internal partial class InstallForm : CustomForm
|
||||||
installForm.UpdateUser("Generating ScreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
installForm.UpdateUser("Generating ScreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||||
File.Create(config).Close();
|
File.Create(config).Close();
|
||||||
StreamWriter writer = new(config, true, Encoding.UTF8);
|
StreamWriter writer = new(config, true, Encoding.UTF8);
|
||||||
WriteScreamConfiguration(writer, selection.SelectedDlc, selection.ExtraSelectedDlc, installForm);
|
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> overrideCatalogItems = selection.AllDlc.Where(pair => pair.Value.type is DlcType.EpicCatalogItem).Except(selection.SelectedDlc);
|
||||||
|
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||||
|
overrideCatalogItems = overrideCatalogItems.Except(extraDlc);
|
||||||
|
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> entitlements = selection.SelectedDlc.Where(pair => pair.Value.type == DlcType.EpicEntitlement);
|
||||||
|
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> _dlc) in selection.ExtraSelectedDlc)
|
||||||
|
entitlements = entitlements.Concat(_dlc.Where(pair => pair.Value.type == DlcType.EpicEntitlement));
|
||||||
|
WriteScreamConfiguration(writer,
|
||||||
|
new(overrideCatalogItems.ToDictionary(pair => pair.Key, pair => pair.Value), AppIdComparer.Comparer),
|
||||||
|
new(entitlements.ToDictionary(pair => pair.Key, pair => pair.Value), AppIdComparer.Comparer),
|
||||||
|
installForm);
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
});
|
});
|
||||||
|
@ -356,8 +357,8 @@ internal partial class InstallForm : CustomForm
|
||||||
foreach (string directory in selection.DllDirectories)
|
foreach (string directory in selection.DllDirectories)
|
||||||
{
|
{
|
||||||
Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
if (selection.IsSteam && selection.SelectedDlc.Any(d => d.Value.type is DlcType.Steam)
|
if (selection.IsSteam && selection.SelectedDlc.Any(d => d.Value.type is DlcType.Steam or DlcType.SteamHidden)
|
||||||
|| selection.ExtraSelectedDlc.Any(item => item.dlc.Any(dlc => dlc.Value.type is DlcType.Steam)))
|
|| selection.ExtraSelectedDlc.Any(item => item.dlc.Any(dlc => dlc.Value.type is DlcType.Steam or DlcType.SteamHidden)))
|
||||||
{
|
{
|
||||||
directory.GetSmokeApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
|
directory.GetSmokeApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
|
||||||
if (File.Exists(sdk32) || File.Exists(sdk32_o) || File.Exists(sdk64) || File.Exists(sdk64_o) || File.Exists(config))
|
if (File.Exists(sdk32) || File.Exists(sdk32_o) || File.Exists(sdk64) || File.Exists(sdk64_o) || File.Exists(config))
|
||||||
|
|
|
@ -180,11 +180,13 @@ internal partial class SelectForm : CustomForm
|
||||||
if (Program.Canceled) return;
|
if (Program.Canceled) return;
|
||||||
string dlcName = null;
|
string dlcName = null;
|
||||||
string dlcIcon = null;
|
string dlcIcon = null;
|
||||||
|
bool onSteamStore = false;
|
||||||
AppData dlcAppData = await SteamStore.QueryStoreAPI(dlcAppId, true);
|
AppData dlcAppData = await SteamStore.QueryStoreAPI(dlcAppId, true);
|
||||||
if (dlcAppData is not null)
|
if (dlcAppData is not null)
|
||||||
{
|
{
|
||||||
dlcName = dlcAppData.name;
|
dlcName = dlcAppData.name;
|
||||||
dlcIcon = dlcAppData.header_image;
|
dlcIcon = dlcAppData.header_image;
|
||||||
|
onSteamStore = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -201,7 +203,7 @@ internal partial class SelectForm : CustomForm
|
||||||
}
|
}
|
||||||
if (Program.Canceled) return;
|
if (Program.Canceled) return;
|
||||||
if (!string.IsNullOrWhiteSpace(dlcName))
|
if (!string.IsNullOrWhiteSpace(dlcName))
|
||||||
dlc[dlcAppId] = (DlcType.Steam, dlcName, dlcIcon);
|
dlc[dlcAppId] = (onSteamStore ? DlcType.Steam : DlcType.SteamHidden, dlcName, dlcIcon);
|
||||||
RemoveFromRemainingDLCs(dlcAppId);
|
RemoveFromRemainingDLCs(dlcAppId);
|
||||||
});
|
});
|
||||||
dlcTasks.Add(task);
|
dlcTasks.Add(task);
|
||||||
|
|
|
@ -10,8 +10,9 @@ namespace CreamInstaller;
|
||||||
public enum DlcType
|
public enum DlcType
|
||||||
{
|
{
|
||||||
Steam = 0,
|
Steam = 0,
|
||||||
EpicCatalogItem = 1,
|
SteamHidden = 1,
|
||||||
EpicEntitlement = 2
|
EpicCatalogItem = 2,
|
||||||
|
EpicEntitlement = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ProgramSelection
|
internal class ProgramSelection
|
||||||
|
|
Loading…
Reference in a new issue