- Converted the program from using CreamAPI to SmokeAPI (it's recommended to uninstall CreamAPI with v3.4 of this program before updating, but not required)
- Removed RimWorld from excluded games (it should work fine with SmokeAPI)
This commit is contained in:
pointfeev 2022-05-16 04:23:19 -05:00
parent c33cf1371b
commit 81e73a2449
13 changed files with 54 additions and 49 deletions

View file

@ -5,7 +5,7 @@
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>3.4.3.2</Version>
<Version>3.5.0.0</Version>
<PackageIcon>Resources\ini.ico</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
@ -15,7 +15,7 @@
<RepositoryType>git</RepositoryType>
<AssemblyName>CreamInstaller</AssemblyName>
<Company>CreamInstaller</Company>
<Product>CreamAPI/ScreamAPI Installer &amp; Configuration Generator</Product>
<Product>SmokeAPI/ScreamAPI Installer &amp; Configuration Generator</Product>
<Authors>pointfeev</Authors>
<PackageId>pointfeev.creaminstaller</PackageId>
<StartupObject>CreamInstaller.Program</StartupObject>

View file

@ -56,30 +56,38 @@ internal partial class InstallForm : CustomForm
}
}
internal static void WriteCreamConfiguration(StreamWriter writer, string appId, string name, SortedList<string, (DlcType type, string name, string icon)> dlc, InstallForm installForm = null)
internal static void WriteSmokeConfiguration(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)
{
Thread.Sleep(0);
writer.WriteLine($"; {name}");
writer.WriteLine("[steam]");
writer.WriteLine($"appid = {appId}");
writer.WriteLine();
writer.WriteLine("[dlc]");
if (installForm is not null)
installForm.UpdateUser($"Added game to cream_api.ini with appid {appId} ({name})", InstallationLog.Action, info: false);
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in dlc)
writer.WriteLine("{");
writer.WriteLine(" \"$version\": 1,");
writer.WriteLine(" \"logging\": false,");
writer.WriteLine(" \"hook_steamclient\": true,");
writer.WriteLine(" \"unlock_all\": true,");
writer.WriteLine(" \"override\": [],");
writer.WriteLine(" \"dlc_ids\": [");
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> dlcs = dlc.ToList();
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> _dlc) in extraDlc)
dlcs = dlcs.Concat(_dlc);
KeyValuePair<string, (DlcType type, string name, string icon)> lastDlc = dlcs.Last();
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in dlcs)
{
Thread.Sleep(0);
string dlcId = pair.Key;
(_, string dlcName, _) = pair.Value;
writer.WriteLine($"{dlcId} = {dlcName}");
writer.WriteLine($" {dlcId}{(pair.Equals(lastDlc) ? "" : ",")}");
if (installForm is not null)
installForm.UpdateUser($"Added DLC to cream_api.ini with appid {dlcId} ({dlcName})", InstallationLog.Action, info: false);
installForm.UpdateUser($"Added DLC to SmokeAPI.json with appid {dlcId} ({dlcName})", InstallationLog.Action, info: false);
}
writer.WriteLine(" ],");
writer.WriteLine(" \"auto_inject_inventory\": true,");
writer.WriteLine(" \"inventory_items\": []");
writer.WriteLine("}");
}
internal static async Task UninstallCreamAPI(string directory, InstallForm installForm = null) => await Task.Run(() =>
internal static async Task UninstallSmokeAPI(string directory, InstallForm installForm = null) => await Task.Run(() =>
{
directory.GetCreamApiComponents(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_o))
{
if (File.Exists(sdk32))
@ -112,9 +120,9 @@ internal partial class InstallForm : CustomForm
}
});
internal static async Task InstallCreamAPI(string directory, ProgramSelection selection, InstallForm installForm = null) => await Task.Run(() =>
internal static async Task InstallSmokeAPI(string directory, ProgramSelection selection, InstallForm installForm = null) => await Task.Run(() =>
{
directory.GetCreamApiComponents(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.Move(sdk32, sdk32_o);
@ -140,13 +148,10 @@ internal partial class InstallForm : CustomForm
installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(sdk64)}", InstallationLog.Action, info: false);
}
if (installForm is not null)
installForm.UpdateUser("Generating CreamAPI 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();
StreamWriter writer = new(config, true, Encoding.UTF8);
if (selection.Id != "ParadoxLauncher")
WriteCreamConfiguration(writer, selection.Id, selection.Name, selection.SelectedDlc, installForm);
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> dlc) in selection.ExtraDlc)
WriteCreamConfiguration(writer, id, name, dlc, installForm);
WriteSmokeConfiguration(writer, selection.SelectedDlc, selection.ExtraDlc, installForm);
writer.Flush();
writer.Close();
});
@ -320,15 +325,15 @@ internal partial class InstallForm : CustomForm
if (selection.IsSteam && selection.SelectedDlc.Any(d => d.Value.type is DlcType.Steam)
|| selection.ExtraDlc.Any(item => item.dlc.Any(dlc => dlc.Value.type is DlcType.Steam)))
{
directory.GetCreamApiComponents(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))
{
UpdateUser($"{(Uninstalling ? "Uninstalling" : "Installing")} CreamAPI" +
UpdateUser($"{(Uninstalling ? "Uninstalling" : "Installing")} SmokeAPI" +
$" {(Uninstalling ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
if (Uninstalling)
await UninstallCreamAPI(directory, this);
await UninstallSmokeAPI(directory, this);
else
await InstallCreamAPI(directory, selection, this);
await InstallSmokeAPI(directory, selection, this);
}
}
if (selection.IsEpic && selection.SelectedDlc.Any(d => d.Value.type is DlcType.EpicCatalogItem or DlcType.EpicEntitlement)
@ -394,11 +399,11 @@ internal partial class InstallForm : CustomForm
try
{
await Operate();
UpdateUser($"CreamAPI/ScreamAPI successfully {(Uninstalling ? "uninstalled" : "installed and generated")} for " + ProgramCount + " program(s).", InstallationLog.Success);
UpdateUser($"SmokeAPI/ScreamAPI successfully {(Uninstalling ? "uninstalled" : "installed and generated")} for " + ProgramCount + " program(s).", InstallationLog.Success);
}
catch (Exception exception)
{
UpdateUser($"CreamAPI/ScreamAPI {(Uninstalling ? "uninstallation" : "installation and/or generation")} failed: " + exception.ToString(), InstallationLog.Error);
UpdateUser($"SmokeAPI/ScreamAPI {(Uninstalling ? "uninstallation" : "installation and/or generation")} failed: " + exception.ToString(), InstallationLog.Error);
retryButton.Enabled = true;
}
userProgressBar.Value = userProgressBar.Maximum;

View file

@ -109,7 +109,7 @@ namespace CreamInstaller
this.noneFoundLabel.Name = "noneFoundLabel";
this.noneFoundLabel.Size = new System.Drawing.Size(554, 218);
this.noneFoundLabel.TabIndex = 1002;
this.noneFoundLabel.Text = "No CreamAPI-applicable or ScreamAPI-applicable programs were found on your comput" +
this.noneFoundLabel.Text = "No SmokeAPI-applicable or ScreamAPI-applicable programs were found on your comput" +
"er!";
this.noneFoundLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.noneFoundLabel.Visible = false;

View file

@ -433,13 +433,13 @@ internal partial class SelectForm : CustomForm
if (scan)
{
ProgramsToScan = choices;
noneFoundLabel.Text = "None of the chosen programs/games were CreamAPI-applicable or ScreamAPI-applicable!" + retry;
noneFoundLabel.Text = "None of the chosen programs/games were SmokeAPI-applicable or ScreamAPI-applicable!" + retry;
}
else
noneFoundLabel.Text = "You didn't choose any programs/games!" + retry;
}
else
noneFoundLabel.Text = "No CreamAPI-applicable or ScreamAPI-applicable programs/games were found on your computer!";
noneFoundLabel.Text = "No SmokeAPI-applicable or ScreamAPI-applicable programs/games were found on your computer!";
}
if (scan)
@ -667,7 +667,7 @@ internal partial class SelectForm : CustomForm
for (int i = 0; i < directories.Count; i++)
{
string directory = directories[i];
directory.GetCreamApiComponents(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))
{
contextMenuStrip.Items.Add(new ContextMenuItem($"Open Steamworks SDK Directory #{i + 1}", "File Explorer",
@ -795,7 +795,7 @@ internal partial class SelectForm : CustomForm
using DialogForm form = new(this);
form.Show(SystemIcons.Information,
"Blocks the program from caching and displaying games protected by DLL checks," +
"\nanti-cheats, or that are confirmed not to be working with CreamAPI or ScreamAPI." +
"\nanti-cheats, or that are confirmed not to be working with SmokeAPI or ScreamAPI." +
"\n\nBlocked games:" + blockedGames +
"\n\nBlocked game sub-directories:" + blockedDirectories +
"\n\nBlocked game sub-directory exceptions (not blocked):" + blockedDirectoryExceptions,

View file

@ -54,7 +54,7 @@ internal static class ParadoxLauncher
using DialogForm dialogForm = new(form);
return dialogForm.Show(SystemIcons.Warning,
$"WARNING: There are no installed games with DLC that can be added to the Paradox Launcher!" +
"\n\nInstalling CreamAPI/ScreamAPI for the Paradox Launcher is pointless, since no DLC will be added to the configuration!",
"\n\nInstalling SmokeAPI/ScreamAPI for the Paradox Launcher is pointless, since no DLC will be added to the configuration!",
"Ignore", "Cancel", customFormText: "Paradox Launcher") != DialogResult.OK;
}
}
@ -72,10 +72,10 @@ internal static class ParadoxLauncher
byte[] epicOriginalSdk64 = null;
foreach (string directory in selection.DllDirectories)
{
directory.GetCreamApiComponents(out string sdk32, out string _, out string sdk64, out string _, out string config);
directory.GetSmokeApiComponents(out string sdk32, out string _, out string sdk64, out string _, out string config);
if (creamConfig is null && File.Exists(config))
creamConfig = File.ReadAllBytes(config);
await InstallForm.UninstallCreamAPI(directory);
await InstallForm.UninstallSmokeAPI(directory);
if (steamOriginalSdk32 is null && File.Exists(sdk32) && !Properties.Resources.Steamworks32.EqualsFile(sdk32))
steamOriginalSdk32 = File.ReadAllBytes(sdk32);
if (steamOriginalSdk64 is null && File.Exists(sdk64) && !Properties.Resources.Steamworks64.EqualsFile(sdk64))
@ -95,7 +95,7 @@ internal static class ParadoxLauncher
bool neededRepair = false;
foreach (string directory in selection.DllDirectories)
{
directory.GetCreamApiComponents(out string sdk32, out string _, out string sdk64, out string _, out string config);
directory.GetSmokeApiComponents(out string sdk32, out string _, out string sdk64, out string _, out string config);
if (steamOriginalSdk32 is not null && Properties.Resources.Steamworks32.EqualsFile(sdk32))
{
steamOriginalSdk32.Write(sdk32);
@ -108,7 +108,7 @@ internal static class ParadoxLauncher
}
if (creamConfig is not null)
{
await InstallForm.InstallCreamAPI(directory, selection);
await InstallForm.InstallSmokeAPI(directory, selection);
creamConfig.Write(config);
}

View file

@ -22,7 +22,7 @@ internal static class Program
internal static readonly string CurrentProcessFilePath = CurrentProcess.MainModule.FileName;
internal static bool BlockProtectedGames = true;
internal static readonly string[] ProtectedGames = { "PAYDAY 2", "Call to Arms", "RimWorld" }; // non-functioning CreamAPI/ScreamAPI or DLL detections
internal static readonly string[] ProtectedGames = { "PAYDAY 2", "Call to Arms" }; // non-functioning SmokeAPI/ScreamAPI or DLL detections
internal static readonly string[] ProtectedGameDirectories = { @"\EasyAntiCheat", @"\BattlEye" }; // DLL detections
internal static readonly string[] ProtectedGameDirectoryExceptions = { "Arma 3" }; // Arma 3's BattlEye doesn't detect DLL changes?
@ -59,13 +59,13 @@ internal static class Program
return false;
}
internal static void GetCreamApiComponents(this string directory, out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config)
internal static void GetSmokeApiComponents(this string directory, out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config)
{
sdk32 = directory + @"\steam_api.dll";
sdk32_o = directory + @"\steam_api_o.dll";
sdk64 = directory + @"\steam_api64.dll";
sdk64_o = directory + @"\steam_api64_o.dll";
config = directory + @"\cream_api.ini";
config = directory + @"\SmokeAPI.json";
}
internal static void GetScreamApiComponents(this string directory, out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config)

View file

@ -42,7 +42,7 @@ internal class ProgramSelection
{
foreach (string directory in DllDirectories)
{
directory.GetCreamApiComponents(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 (sdk32.IsFilePathLocked()
|| sdk32_o.IsFilePathLocked()
|| sdk64.IsFilePathLocked()

View file

@ -121,16 +121,16 @@
<data name="Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\ini.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Steamworks32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\creamapi\steam_api.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Steamworks64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\creamapi\steam_api64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="EpicOnlineServices32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\screamapi\eossdk-win32-shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="EpicOnlineServices64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\screamapi\eossdk-win64-shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Steamworks32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\smokeapi\steam_api.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Steamworks64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\smokeapi\steam_api64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

Binary file not shown.

View file

@ -45,7 +45,7 @@ internal static class SteamLibrary
{
List<string> dllDirectories = new();
if (Program.Canceled || !Directory.Exists(gameDirectory)) return null;
gameDirectory.GetCreamApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi);
gameDirectory.GetSmokeApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi);
if (File.Exists(api)
|| File.Exists(api_o)
|| File.Exists(api64)