From 172211040555df7a3fa45c7cbae3dd02a58bb0da Mon Sep 17 00:00:00 2001 From: pointfeev Date: Sat, 24 Sep 2022 05:29:21 -0400 Subject: [PATCH] v4.2.0.1 - Fixed dll directories being incorrectly added if a koaloader-specific config/cache existed - Fixed paradox launcher repair sometimes leaving behind an incorrect installation --- CreamInstaller/Paradox/ParadoxLauncher.cs | 9 +++++++-- CreamInstaller/Resources/Resources.cs | 13 ++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CreamInstaller/Paradox/ParadoxLauncher.cs b/CreamInstaller/Paradox/ParadoxLauncher.cs index 8b50823..116c85c 100644 --- a/CreamInstaller/Paradox/ParadoxLauncher.cs +++ b/CreamInstaller/Paradox/ParadoxLauncher.cs @@ -93,9 +93,13 @@ internal static class ParadoxLauncher byte[] epicOriginalSdk64 = null; foreach (string directory in selection.DllDirectories) { + bool koaloaderInstalled = Koaloader.AutoLoadDlls + .Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll)) + .Any(pair => File.Exists(pair.path) && pair.path.IsResourceFile()); directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out _); smokeInstalled = smokeInstalled - || File.Exists(api32_o) || File.Exists(api64_o) || File.Exists(config) + || File.Exists(api32_o) || File.Exists(api64_o) + || File.Exists(config) && !koaloaderInstalled || File.Exists(api32) && api32.IsResourceFile(ResourceIdentifier.Steamworks32) || File.Exists(api64) && api64.IsResourceFile(ResourceIdentifier.Steamworks64); await SmokeAPI.Uninstall(directory, deleteConfig: false); @@ -105,7 +109,8 @@ internal static class ParadoxLauncher steamOriginalSdk64 = File.ReadAllBytes(api64); directory.GetScreamApiComponents(out api32, out api32_o, out api64, out api64_o, out config); screamInstalled = screamInstalled - || File.Exists(api32_o) || File.Exists(api64_o) || File.Exists(config) + || File.Exists(api32_o) || File.Exists(api64_o) + || File.Exists(config) && !koaloaderInstalled || File.Exists(api32) && api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32) || File.Exists(api64) && api64.IsResourceFile(ResourceIdentifier.EpicOnlineServices64); await ScreamAPI.Uninstall(directory, deleteConfig: false); diff --git a/CreamInstaller/Resources/Resources.cs b/CreamInstaller/Resources/Resources.cs index 81ca600..12f445f 100644 --- a/CreamInstaller/Resources/Resources.cs +++ b/CreamInstaller/Resources/Resources.cs @@ -128,6 +128,9 @@ internal static class Resources string subDirectory = directory.BeautifyPath(); if (!dllDirectories.Contains(subDirectory)) { + bool koaloaderInstalled = Koaloader.AutoLoadDlls + .Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll)) + .Any(pair => File.Exists(pair.path) && pair.path.IsResourceFile()); if (platform is Platform.Steam or Platform.Paradox) { subDirectory.GetSmokeApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string config, out string cache); @@ -135,8 +138,8 @@ internal static class Resources || File.Exists(api_o) || File.Exists(api64) || File.Exists(api64_o) - || File.Exists(config) - || File.Exists(cache)) + || File.Exists(config) && !koaloaderInstalled + || File.Exists(cache) && !koaloaderInstalled) dllDirectories.Add(subDirectory); } if (platform is Platform.Epic or Platform.Paradox) @@ -146,7 +149,7 @@ internal static class Resources || File.Exists(api32_o) || File.Exists(api64) || File.Exists(api64_o) - || File.Exists(config)) + || File.Exists(config) && !koaloaderInstalled) dllDirectories.Add(subDirectory); } if (platform is Platform.Ubisoft) @@ -156,7 +159,7 @@ internal static class Resources || File.Exists(api32_o) || File.Exists(api64) || File.Exists(api64_o) - || File.Exists(config)) + || File.Exists(config) && !koaloaderInstalled) dllDirectories.Add(subDirectory); subDirectory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config); if (File.Exists(old_api32) @@ -165,7 +168,7 @@ internal static class Resources || File.Exists(api32_o) || File.Exists(api64) || File.Exists(api64_o) - || File.Exists(config)) + || File.Exists(config) && !koaloaderInstalled) dllDirectories.Add(subDirectory); } }