diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj index fd4a53d..55721e7 100644 --- a/CreamInstaller/CreamInstaller.csproj +++ b/CreamInstaller/CreamInstaller.csproj @@ -5,7 +5,7 @@ True Resources\ini.ico true - 3.4.3.2 + 3.5.0.0 Resources\ini.ico LICENSE 2021, pointfeev (https://github.com/pointfeev) @@ -15,7 +15,7 @@ git CreamInstaller CreamInstaller - CreamAPI/ScreamAPI Installer & Configuration Generator + SmokeAPI/ScreamAPI Installer & Configuration Generator pointfeev pointfeev.creaminstaller CreamInstaller.Program diff --git a/CreamInstaller/Forms/InstallForm.cs b/CreamInstaller/Forms/InstallForm.cs index c5d6d59..77eca09 100644 --- a/CreamInstaller/Forms/InstallForm.cs +++ b/CreamInstaller/Forms/InstallForm.cs @@ -56,30 +56,38 @@ internal partial class InstallForm : CustomForm } } - internal static void WriteCreamConfiguration(StreamWriter writer, string appId, string name, SortedList dlc, InstallForm installForm = null) + internal static void WriteSmokeConfiguration(StreamWriter writer, SortedList dlc, List<(string id, string name, SortedList 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 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> dlcs = dlc.ToList(); + foreach ((string id, string name, SortedList _dlc) in extraDlc) + dlcs = dlcs.Concat(_dlc); + KeyValuePair lastDlc = dlcs.Last(); + foreach (KeyValuePair 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 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; diff --git a/CreamInstaller/Forms/SelectForm.Designer.cs b/CreamInstaller/Forms/SelectForm.Designer.cs index 279bc02..20e60e5 100644 --- a/CreamInstaller/Forms/SelectForm.Designer.cs +++ b/CreamInstaller/Forms/SelectForm.Designer.cs @@ -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; diff --git a/CreamInstaller/Forms/SelectForm.cs b/CreamInstaller/Forms/SelectForm.cs index 74fa8b9..46077af 100644 --- a/CreamInstaller/Forms/SelectForm.cs +++ b/CreamInstaller/Forms/SelectForm.cs @@ -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, diff --git a/CreamInstaller/Paradox/ParadoxLauncher.cs b/CreamInstaller/Paradox/ParadoxLauncher.cs index 165f736..866d312 100644 --- a/CreamInstaller/Paradox/ParadoxLauncher.cs +++ b/CreamInstaller/Paradox/ParadoxLauncher.cs @@ -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); } diff --git a/CreamInstaller/Program.cs b/CreamInstaller/Program.cs index 7a0287d..4e8290f 100644 --- a/CreamInstaller/Program.cs +++ b/CreamInstaller/Program.cs @@ -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) diff --git a/CreamInstaller/ProgramSelection.cs b/CreamInstaller/ProgramSelection.cs index e3ebcce..00b0fc0 100644 --- a/CreamInstaller/ProgramSelection.cs +++ b/CreamInstaller/ProgramSelection.cs @@ -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() diff --git a/CreamInstaller/Properties/Resources.resx b/CreamInstaller/Properties/Resources.resx index 0989eea..56a3421 100644 --- a/CreamInstaller/Properties/Resources.resx +++ b/CreamInstaller/Properties/Resources.resx @@ -121,16 +121,16 @@ ..\resources\ini.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\resources\creamapi\steam_api.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\resources\creamapi\steam_api64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - ..\resources\screamapi\eossdk-win32-shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\resources\screamapi\eossdk-win64-shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\resources\smokeapi\steam_api.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\resources\smokeapi\steam_api64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/CreamInstaller/Resources/CreamAPI/steam_api.dll b/CreamInstaller/Resources/CreamAPI/steam_api.dll deleted file mode 100644 index 7babc7a..0000000 Binary files a/CreamInstaller/Resources/CreamAPI/steam_api.dll and /dev/null differ diff --git a/CreamInstaller/Resources/CreamAPI/steam_api64.dll b/CreamInstaller/Resources/CreamAPI/steam_api64.dll deleted file mode 100644 index 6ed8437..0000000 Binary files a/CreamInstaller/Resources/CreamAPI/steam_api64.dll and /dev/null differ diff --git a/CreamInstaller/Resources/SmokeAPI/steam_api.dll b/CreamInstaller/Resources/SmokeAPI/steam_api.dll new file mode 100644 index 0000000..7f8ed78 Binary files /dev/null and b/CreamInstaller/Resources/SmokeAPI/steam_api.dll differ diff --git a/CreamInstaller/Resources/SmokeAPI/steam_api64.dll b/CreamInstaller/Resources/SmokeAPI/steam_api64.dll new file mode 100644 index 0000000..c82e871 Binary files /dev/null and b/CreamInstaller/Resources/SmokeAPI/steam_api64.dll differ diff --git a/CreamInstaller/Steam/SteamLibrary.cs b/CreamInstaller/Steam/SteamLibrary.cs index 01e577b..0b04b85 100644 --- a/CreamInstaller/Steam/SteamLibrary.cs +++ b/CreamInstaller/Steam/SteamLibrary.cs @@ -45,7 +45,7 @@ internal static class SteamLibrary { List 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)