From 5ab710ea2f11fbb84dfdb012886cfed74603c709 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Mon, 31 May 2021 23:59:12 +0100 Subject: [PATCH 01/24] Add BepInEx.MultiFolderLoader, bringing support for mod authors to author and distribute BepInEx plugins/patchers as part of their mods. --- .../patchers/BepInEx.MultiFolderLoader.dll | Bin 0 -> 14848 bytes Dependencies/BepInEx/doorstop_config.ini | 5 ++- QModPluginEmulator/QModPluginGenerator.cs | 38 ++++++++++-------- 3 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 Dependencies/BepInEx/BepInEx/patchers/BepInEx.MultiFolderLoader.dll diff --git a/Dependencies/BepInEx/BepInEx/patchers/BepInEx.MultiFolderLoader.dll b/Dependencies/BepInEx/BepInEx/patchers/BepInEx.MultiFolderLoader.dll new file mode 100644 index 0000000000000000000000000000000000000000..138e5768af6a0a6b3ee1e13d67336001b8073281 GIT binary patch literal 14848 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 literal 0 HcmV?d00001 diff --git a/Dependencies/BepInEx/doorstop_config.ini b/Dependencies/BepInEx/doorstop_config.ini index a68f30f1..2e860502 100644 --- a/Dependencies/BepInEx/doorstop_config.ini +++ b/Dependencies/BepInEx/doorstop_config.ini @@ -13,4 +13,7 @@ ignoreDisableSwitch=false # (e.g. mscorlib is stripped in original game) # This option causes Mono to seek mscorlib and core libraries from a different folder before Managed # Original Managed folder is added as a secondary folder in the search path -dllSearchPathOverride= \ No newline at end of file +dllSearchPathOverride= + +[MultiFolderLoader] +baseDir=.\QMods \ No newline at end of file diff --git a/QModPluginEmulator/QModPluginGenerator.cs b/QModPluginEmulator/QModPluginGenerator.cs index da803e2f..77cbfac3 100644 --- a/QModPluginEmulator/QModPluginGenerator.cs +++ b/QModPluginEmulator/QModPluginGenerator.cs @@ -6,7 +6,7 @@ #if SUBNAUTICA_STABLE using Oculus.Newtonsoft.Json; #else - using Newtonsoft.Json; +using Newtonsoft.Json; #endif using QModManager.API; using QModManager.Patching; @@ -57,14 +57,14 @@ public static void Finish() { PluginCache = GetPluginCache(); Harmony = new Harmony("QModManager.QModPluginGenerator"); - foreach(Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) + foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { - if(assembly?.GetName()?.Name?.Contains("MirrorInternalLogs") ?? false) + if (assembly?.GetName()?.Name?.Contains("MirrorInternalLogs") ?? false) { Type type = AccessTools.TypeByName("MirrorInternalLogs.Util.LibcHelper"); var method = type?.GetMethod("Format"); - if(method != null) + if (method != null) Harmony.Patch(method, postfix: new HarmonyMethod(typeof(QModPluginGenerator), nameof(QModPluginGenerator.LibcHelper_Format_Postfix))); break; } @@ -90,24 +90,24 @@ public static void Finish() public static List DirtyMidStrings = new List() { - "\n(Filename", + "\n(Filename", }; private static void LibcHelper_Format_Postfix(ref string __result) { - foreach(string dirtyString in DirtyStartStrings) + foreach (string dirtyString in DirtyStartStrings) { - if(__result.StartsWith(dirtyString)) + if (__result.StartsWith(dirtyString)) { __result = ""; return; } } - foreach(string dirtyString in DirtyMidStrings) + foreach (string dirtyString in DirtyMidStrings) { int i = __result.IndexOf(dirtyString); - if(i >= 0) + if (i >= 0) { __result = __result.Remove(i); return; @@ -115,6 +115,8 @@ private static void LibcHelper_Format_Postfix(ref string __result) } } + private static bool initialized = false; + #if SUBNAUTICA_STABLE [HarmonyPatch(typeof(SystemsSpawner), nameof(SystemsSpawner.Awake))] #else @@ -123,7 +125,11 @@ private static void LibcHelper_Format_Postfix(ref string __result) [HarmonyPrefix] private static void PreInitializeQMM() { - + if (initialized) + { + return; + } + initialized = true; Patcher.Patch(); // Run QModManager patch @@ -145,7 +151,7 @@ private static void PreInitializeQMM() #if SUBNAUTICA private static IEnumerator InitializeQMM(IEnumerator result) { - if(ModsToLoad != null) + if (ModsToLoad != null) { yield return result; @@ -155,7 +161,7 @@ private static IEnumerator InitializeQMM(IEnumerator result) SummaryLogger.ReportIssues(ModsToLoad); SummaryLogger.LogSummaries(ModsToLoad); - foreach(Dialog dialog in Patcher.Dialogs) + foreach (Dialog dialog in Patcher.Dialogs) { dialog.Show(); } @@ -165,7 +171,7 @@ private static IEnumerator InitializeQMM(IEnumerator result) #elif BELOWZERO private static void InitializeQMM() { - if(ModsToLoad != null) + if (ModsToLoad != null) { Initializer.InitializeMods(ModsToLoad, PatchingOrder.NormalInitialize); Initializer.InitializeMods(ModsToLoad, PatchingOrder.PostInitialize); @@ -174,7 +180,7 @@ private static void InitializeQMM() SummaryLogger.ReportIssues(ModsToLoad); SummaryLogger.LogSummaries(ModsToLoad); - foreach(Dialog dialog in Patcher.Dialogs) + foreach (Dialog dialog in Patcher.Dialogs) { dialog.Show(); } @@ -254,7 +260,7 @@ private static void SaveQMMAssemblyCache() using (var ms = new MemoryStream()) using (var writer = new StreamWriter(ms)) - using(var jsreader = new JsonTextWriter(writer)) + using (var jsreader = new JsonTextWriter(writer)) { var serializer = new JsonSerializer(); serializer.Serialize(jsreader, QMMAssemblyCache); @@ -283,7 +289,7 @@ private static void ClearBepInExCache() { Directory.Delete(BepInExCachePath, true); } - catch(IOException e) + catch (IOException e) { Logger.LogDebug($"Clearing BepInEx cache failed with exception. \n{e}"); } From cc1d22a51e0da2d66d68a6804c2e6a674ee9bfa7 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 02:58:29 +0100 Subject: [PATCH 02/24] whoops, still need this using statement ^^' --- QModPluginEmulator/QModPluginGenerator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/QModPluginEmulator/QModPluginGenerator.cs b/QModPluginEmulator/QModPluginGenerator.cs index bd7a01c2..dda94140 100644 --- a/QModPluginEmulator/QModPluginGenerator.cs +++ b/QModPluginEmulator/QModPluginGenerator.cs @@ -12,6 +12,7 @@ using QModManager.Patching; using QModManager.Utility; using System; +using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; From b2e483dc68ec69ff7940c8493bda07a8a124479b Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 16:22:47 +0100 Subject: [PATCH 03/24] Only need `System.Collections` namespace for SN.STABLE currently. --- QModPluginEmulator/QModPluginGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QModPluginEmulator/QModPluginGenerator.cs b/QModPluginEmulator/QModPluginGenerator.cs index 3ea1978b..d0ae036a 100644 --- a/QModPluginEmulator/QModPluginGenerator.cs +++ b/QModPluginEmulator/QModPluginGenerator.cs @@ -4,6 +4,7 @@ using HarmonyLib; using Mono.Cecil; #if SUBNAUTICA_STABLE +using System.Collections; using Oculus.Newtonsoft.Json; #else using Newtonsoft.Json; @@ -12,7 +13,6 @@ using QModManager.Patching; using QModManager.Utility; using System; -using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; From d63e88efa5626e4c41458da8647dac34fa8eab3f Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 17:00:51 +0100 Subject: [PATCH 04/24] Update to AssetsTools.NET v2.0.9 --- Installer/BZ.EXP.iss | 2 +- Installer/BZ.STABLE.iss | 2 +- Installer/SN.EXP.iss | 2 +- Installer/SN.STABLE.iss | 2 +- UnityAudioFixer/QModManager.UnityAudioFixer.csproj | 5 ++--- UnityAudioFixer/UnityAudioFixer.cs | 2 +- UnityAudioFixer/packages.config | 2 +- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Installer/BZ.EXP.iss b/Installer/BZ.EXP.iss index 8e53f360..069eff7e 100644 --- a/Installer/BZ.EXP.iss +++ b/Installer/BZ.EXP.iss @@ -59,7 +59,7 @@ Source: "InstallerExtensions.dll"; Flags: DontCopy ; Files required by QModManager itself ; Dependencies -Source: "..\..\packages\AssetsTools.NET.2.0.3\lib\net35\AssetsTools.NET.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; +Source: "..\..\packages\AssetsTools.NET.2.0.9\lib\net40\AssetsTools.NET.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; Source: "..\..\Dependencies\cldb.dat"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; Source: "..\..\Dependencies\Oculus.Newtonsoft.Json.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; diff --git a/Installer/BZ.STABLE.iss b/Installer/BZ.STABLE.iss index 21ffb3ea..191d03fb 100644 --- a/Installer/BZ.STABLE.iss +++ b/Installer/BZ.STABLE.iss @@ -59,7 +59,7 @@ Source: "InstallerExtensions.dll"; Flags: DontCopy ; Files required by QModManager itself ; Dependencies -Source: "..\..\packages\AssetsTools.NET.2.0.3\lib\net35\AssetsTools.NET.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; +Source: "..\..\packages\AssetsTools.NET.2.0.9\lib\net40\AssetsTools.NET.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; Source: "..\..\Dependencies\cldb.dat"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; Source: "..\..\Dependencies\Oculus.Newtonsoft.Json.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; diff --git a/Installer/SN.EXP.iss b/Installer/SN.EXP.iss index 4abd8e00..eb5fd3aa 100644 --- a/Installer/SN.EXP.iss +++ b/Installer/SN.EXP.iss @@ -59,7 +59,7 @@ Source: "InstallerExtensions.dll"; Flags: DontCopy ; Files required by QModManager itself ; Dependencies -Source: "..\..\packages\AssetsTools.NET.2.0.3\lib\net35\AssetsTools.NET.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; +Source: "..\..\packages\AssetsTools.NET.2.0.9\lib\net40\AssetsTools.NET.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; Source: "..\..\Dependencies\cldb.dat"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; Source: "..\..\Dependencies\Oculus.Newtonsoft.Json.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; diff --git a/Installer/SN.STABLE.iss b/Installer/SN.STABLE.iss index 9639659b..553765b1 100644 --- a/Installer/SN.STABLE.iss +++ b/Installer/SN.STABLE.iss @@ -59,7 +59,7 @@ Source: "InstallerExtensions.dll"; Flags: DontCopy ; Files required by QModManager itself ; Dependencies -Source: "..\..\packages\AssetsTools.NET.2.0.3\lib\net35\AssetsTools.NET.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; +Source: "..\..\packages\AssetsTools.NET.2.0.9\lib\net40\AssetsTools.NET.dll"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; Source: "..\..\Dependencies\cldb.dat"; DestDir: "{app}\BepInEx\patchers\QModManager"; Flags: ignoreversion; ; QMM diff --git a/UnityAudioFixer/QModManager.UnityAudioFixer.csproj b/UnityAudioFixer/QModManager.UnityAudioFixer.csproj index bf5eb61e..004ccd32 100644 --- a/UnityAudioFixer/QModManager.UnityAudioFixer.csproj +++ b/UnityAudioFixer/QModManager.UnityAudioFixer.csproj @@ -55,9 +55,8 @@ prompt - - ..\packages\AssetsTools.NET.2.0.3\lib\net35\AssetsTools.NET.dll - False + + ..\packages\AssetsTools.NET.2.0.9\lib\net40\AssetsTools.NET.dll ..\Dependencies\BepInEx\BepInEx\core\BepInEx.dll diff --git a/UnityAudioFixer/UnityAudioFixer.cs b/UnityAudioFixer/UnityAudioFixer.cs index 6ec0e4c2..c9fa666d 100644 --- a/UnityAudioFixer/UnityAudioFixer.cs +++ b/UnityAudioFixer/UnityAudioFixer.cs @@ -90,7 +90,7 @@ private static void ChangeDisableUnityAudio(string path, bool newValue, QModGame AssetsFileInstance afi = am.LoadAssetsFile(path, false); am.LoadClassDatabase(Path.Combine(UnityAudioFixerPath, "cldb.dat")); AssetFileInfoEx audioInfo = afi.table.GetAssetInfo(4); - AssetTypeInstance audioAti = am.GetATI(afi.file, audioInfo); + AssetTypeInstance audioAti = am.GetTypeInstance(afi.file, audioInfo); AssetTypeValueField audioBaseField = audioAti.GetBaseField(); audioBaseField.Get("m_DisableAudio").GetValue().Set(newValue); byte[] audioAsset; diff --git a/UnityAudioFixer/packages.config b/UnityAudioFixer/packages.config index 76f7717a..e70d9e05 100644 --- a/UnityAudioFixer/packages.config +++ b/UnityAudioFixer/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file From 9b19f855911164d23f3c0b451ed511ba63f1a7b4 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 17:06:45 +0100 Subject: [PATCH 05/24] Only conditionally include Sentry.dll in the references --- QModManager/QModManager.csproj | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/QModManager/QModManager.csproj b/QModManager/QModManager.csproj index 697fdd42..c2c980ed 100644 --- a/QModManager/QModManager.csproj +++ b/QModManager/QModManager.csproj @@ -78,10 +78,6 @@ ..\Dependencies\$(Configuration)\Newtonsoft.Json.dll False - - ..\Dependencies\$(Configuration)\Sentry.dll - False - ..\Dependencies\$(Configuration)\UnityEngine.dll @@ -112,6 +108,12 @@ False + + + ..\Dependencies\$(Configuration)\Sentry.dll + False + + From 0dfc23beaec385b03de0029a1564392afd036405 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 17:09:25 +0100 Subject: [PATCH 06/24] Add an empty QMods folder to the Vortex builds to emulate ISS install. --- QModPluginEmulator/QModManager.QModPluginGenerator.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj index ce9c8d23..e87ae3bc 100644 --- a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj +++ b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj @@ -104,6 +104,7 @@ rmdir "$(SolutionDir)VortexBuild\$(Configuration)" /q /s xcopy "$(SolutionDir)Dependencies\BepInEx" "$(SolutionDir)VortexBuild\$(Configuration)" /E /H /I /Q /Y +mkdir "$(SolutionDir)VortexBuild\$(Configuration)\QMods" xcopy "$(SolutionDir)Dependencies\cldb.dat" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y xcopy "$(SolutionDir)packages\AssetsTools.NET.2.0.3\lib\net35\AssetsTools.NET.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y xcopy "$(TargetDir)QModManager.exe" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y From eb78d24249f76209ca0820fbd8d5457563af52b2 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 20:02:00 +0100 Subject: [PATCH 07/24] Fix for BepInEx plugins getting destroyed in all builds except SN.STABLE --- Dependencies/BZ.EXP/BepInEx.cfg | 16 ++++++++++++++++ Dependencies/BZ.STABLE/BepInEx.cfg | 16 ++++++++++++++++ Dependencies/SN.EXP/BepInEx.cfg | 16 ++++++++++++++++ .../QModManager.QModPluginGenerator.csproj | 1 + 4 files changed, 49 insertions(+) create mode 100644 Dependencies/BZ.EXP/BepInEx.cfg create mode 100644 Dependencies/BZ.STABLE/BepInEx.cfg create mode 100644 Dependencies/SN.EXP/BepInEx.cfg diff --git a/Dependencies/BZ.EXP/BepInEx.cfg b/Dependencies/BZ.EXP/BepInEx.cfg new file mode 100644 index 00000000..2903c4cd --- /dev/null +++ b/Dependencies/BZ.EXP/BepInEx.cfg @@ -0,0 +1,16 @@ +[Preloader.Entrypoint] + +## The local filename of the assembly to target. +# Setting type: String +# Default value: UnityEngine.CoreModule.dll +Assembly = Assembly-CSharp.dll + +## The name of the type in the entrypoint assembly to search for the entrypoint method. +# Setting type: String +# Default value: Application +Type = PreStartScreen + +## The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from. +# Setting type: String +# Default value: .cctor +Method = .cctor diff --git a/Dependencies/BZ.STABLE/BepInEx.cfg b/Dependencies/BZ.STABLE/BepInEx.cfg new file mode 100644 index 00000000..2903c4cd --- /dev/null +++ b/Dependencies/BZ.STABLE/BepInEx.cfg @@ -0,0 +1,16 @@ +[Preloader.Entrypoint] + +## The local filename of the assembly to target. +# Setting type: String +# Default value: UnityEngine.CoreModule.dll +Assembly = Assembly-CSharp.dll + +## The name of the type in the entrypoint assembly to search for the entrypoint method. +# Setting type: String +# Default value: Application +Type = PreStartScreen + +## The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from. +# Setting type: String +# Default value: .cctor +Method = .cctor diff --git a/Dependencies/SN.EXP/BepInEx.cfg b/Dependencies/SN.EXP/BepInEx.cfg new file mode 100644 index 00000000..2903c4cd --- /dev/null +++ b/Dependencies/SN.EXP/BepInEx.cfg @@ -0,0 +1,16 @@ +[Preloader.Entrypoint] + +## The local filename of the assembly to target. +# Setting type: String +# Default value: UnityEngine.CoreModule.dll +Assembly = Assembly-CSharp.dll + +## The name of the type in the entrypoint assembly to search for the entrypoint method. +# Setting type: String +# Default value: Application +Type = PreStartScreen + +## The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from. +# Setting type: String +# Default value: .cctor +Method = .cctor diff --git a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj index e87ae3bc..6d21b30d 100644 --- a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj +++ b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj @@ -104,6 +104,7 @@ rmdir "$(SolutionDir)VortexBuild\$(Configuration)" /q /s xcopy "$(SolutionDir)Dependencies\BepInEx" "$(SolutionDir)VortexBuild\$(Configuration)" /E /H /I /Q /Y +xcopy "$(SolutionDir)Dependencies\$(Configuration)\BepInEx.cfg" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\config\" /I /Q /Y mkdir "$(SolutionDir)VortexBuild\$(Configuration)\QMods" xcopy "$(SolutionDir)Dependencies\cldb.dat" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y xcopy "$(SolutionDir)packages\AssetsTools.NET.2.0.3\lib\net35\AssetsTools.NET.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y From 785dd47b8e1c33960ede36c53756a2fce3488cf6 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 21:38:21 +0100 Subject: [PATCH 08/24] Moved QMMLoader into appropriate namespace --- .../{ => BepInex/Plugins}/QMMLoader.cs | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) rename QModManager/{ => BepInex/Plugins}/QMMLoader.cs (58%) diff --git a/QModManager/QMMLoader.cs b/QModManager/BepInex/Plugins/QMMLoader.cs similarity index 58% rename from QModManager/QMMLoader.cs rename to QModManager/BepInex/Plugins/QMMLoader.cs index 737d483c..2935d6b8 100644 --- a/QModManager/QMMLoader.cs +++ b/QModManager/BepInex/Plugins/QMMLoader.cs @@ -1,34 +1,29 @@ -namespace QModInstaller -{ - using BepInEx; - using System; - using UnityEngine; +using BepInEx; +using System; +using UnityEngine; +namespace QModInstaller.BepInEx.Plugins +{ /// /// QMMLoader - simply fires up the QModManager entry point. /// [BepInPlugin(PluginGuid, PluginName, PluginVersion)] - [BepInProcess(SubnauticaProcessName)] - [BepInProcess(SubnauticaZeroProcessName)] - public class QMMLoader: BaseUnityPlugin + [BepInProcess("Subnautica"), BepInProcess("SubnauticaZero")] + public class QMMLoader : BaseUnityPlugin { internal const string PluginGuid = "QModManager.QMMLoader"; internal const string PluginName = "QMMLoader"; - internal const string PluginVersion = "1.0.2"; - - internal const string SubnauticaProcessName = "Subnautica"; - internal const string SubnauticaZeroProcessName = "SubnauticaZero"; + internal const string PluginVersion = "4.1.4"; /// /// Prevents a default instance of the class from being created /// Also ensures the root bepinex object does not get destroyed if the game reloads for steam. /// - [Obsolete("DO NOT USE!", true)] - private QMMLoader() + private void Awake() { GameObject obj = gameObject; - while(obj.transform.parent?.gameObject != null) + while (obj.transform.parent?.gameObject != null) obj = obj.transform.parent.gameObject; obj.EnsureComponent(); From 1f6f3ebe3f2f62e020a7649d06fa890ed213f02d Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 21:39:34 +0100 Subject: [PATCH 09/24] Moved log filtering into a discrete BepInEx plugin --- QModManager.sln | 84 +++++++++++++++++++ QModManager/BepInex/Plugins/LogFilter.cs | 45 ++++++++++ QModManager/QModManager.csproj | 4 +- .../QModManager.QModPluginGenerator.csproj | 23 +---- QModPluginEmulator/QModPluginGenerator.cs | 33 -------- 5 files changed, 136 insertions(+), 53 deletions(-) create mode 100644 QModManager/BepInex/Plugins/LogFilter.cs diff --git a/QModManager.sln b/QModManager.sln index d4623aec..d559c84d 100644 --- a/QModManager.sln +++ b/QModManager.sln @@ -44,6 +44,12 @@ Global BZ.STABLE|Any CPU = BZ.STABLE|Any CPU BZ.STABLE|x64 = BZ.STABLE|x64 BZ.STABLE|x86 = BZ.STABLE|x86 + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 SN.EXP|Any CPU = SN.EXP|Any CPU SN.EXP|x64 = SN.EXP|x64 SN.EXP|x86 = SN.EXP|x86 @@ -64,6 +70,18 @@ Global {DA63F59D-4676-4726-AFEC-BD9D3682733F}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|x64.Build.0 = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|x86.Build.0 = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|x64.ActiveCfg = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|x64.Build.0 = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|x86.ActiveCfg = SN.STABLE|Any CPU + {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|x86.Build.0 = SN.STABLE|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -88,6 +106,12 @@ Global {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU + {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU + {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU + {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Release|x64.ActiveCfg = SN.STABLE|Any CPU + {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Release|x86.ActiveCfg = SN.STABLE|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -112,6 +136,18 @@ Global {92726127-A08F-4843-BF96-4989CE1BF422}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|x64.Build.0 = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|x86.Build.0 = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Release|x64.ActiveCfg = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Release|x64.Build.0 = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Release|x86.ActiveCfg = SN.STABLE|Any CPU + {92726127-A08F-4843-BF96-4989CE1BF422}.Release|x86.Build.0 = SN.STABLE|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -136,6 +172,18 @@ Global {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|x64.Build.0 = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|x86.Build.0 = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|x64.ActiveCfg = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|x64.Build.0 = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|x86.ActiveCfg = SN.STABLE|Any CPU + {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|x86.Build.0 = SN.STABLE|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -160,6 +208,18 @@ Global {CA99F076-7459-4682-A41D-2850AEE28566}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|x64.Build.0 = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|x86.Build.0 = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Release|x64.ActiveCfg = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Release|x64.Build.0 = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Release|x86.ActiveCfg = SN.STABLE|Any CPU + {CA99F076-7459-4682-A41D-2850AEE28566}.Release|x86.Build.0 = SN.STABLE|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -184,6 +244,18 @@ Global {EA496DDF-D775-4E17-9EAE-C570C5F50701}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|x64.Build.0 = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|x86.Build.0 = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|x64.ActiveCfg = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|x64.Build.0 = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|x86.ActiveCfg = SN.STABLE|Any CPU + {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|x86.Build.0 = SN.STABLE|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -208,6 +280,18 @@ Global {25558450-FF33-4FDF-91C7-0C5C00A94A57}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|x64.Build.0 = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|x86.Build.0 = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|x64.ActiveCfg = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|x64.Build.0 = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|x86.ActiveCfg = SN.STABLE|Any CPU + {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|x86.Build.0 = SN.STABLE|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU diff --git a/QModManager/BepInex/Plugins/LogFilter.cs b/QModManager/BepInex/Plugins/LogFilter.cs new file mode 100644 index 00000000..3a29f99a --- /dev/null +++ b/QModManager/BepInex/Plugins/LogFilter.cs @@ -0,0 +1,45 @@ +using BepInEx; +using HarmonyLib; +using System.Text.RegularExpressions; + +namespace QModInstaller.BepInEx.Plugins +{ + /// + /// Handles filtering noisy logs from the QModManager logs. + /// + [BepInPlugin(PluginGuid, PluginName, PluginVersion)] + [BepInProcess("Subnautica"), BepInProcess("SubnauticaZero")] + internal class LogFilter : BaseUnityPlugin + { + internal const string PluginGuid = "QModManager.LogFilter"; + internal const string PluginName = PluginGuid; + internal const string PluginVersion = "4.1.4"; + + private void Awake() + { + var harmony = new Harmony(PluginGuid); + harmony.Patch(AccessTools.Method("MirrorInternalLogs.Util.LibcHelper:Format"), + postfix: new HarmonyMethod(AccessTools.Method(typeof(LogFilter), nameof(LogFilter.LibcHelper_Format_Postfix)))); + } + + private readonly static Regex[] DirtyRegexPatterns = new Regex[] { + new Regex(@"([\r\n]+)?(\(Filename: .*\))$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"^(Replacing cell.*)$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"^(Resetting cell with.*)$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"^(PerformGarbage.*)$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"^(Fallback handler could not load.*)$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"^(Heartbeat CSV.*,[0-9])$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"^(L0: PerformGarbageCollection ->.*)$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"^(L0: CellManager::EstimateBytes.*)$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"^(Kinematic body only supports Speculative Continuous collision detection.*)$", RegexOptions.Compiled | RegexOptions.Multiline), + }; + + private static void LibcHelper_Format_Postfix(ref string __result) + { + foreach (Regex pattern in DirtyRegexPatterns) + { + __result = pattern.Replace(__result, string.Empty).Trim(); + } + } + } +} diff --git a/QModManager/QModManager.csproj b/QModManager/QModManager.csproj index 697fdd42..37436a7c 100644 --- a/QModManager/QModManager.csproj +++ b/QModManager/QModManager.csproj @@ -116,6 +116,7 @@ + @@ -131,7 +132,7 @@ - + @@ -167,6 +168,7 @@ + diff --git a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj index ce9c8d23..4ec31582 100644 --- a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj +++ b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj @@ -13,42 +13,27 @@ 512 true - - - ..\Build\$(Configuration)\ - SUBNAUTICA;SUBNAUTICA_STABLE true pdbonly AnyCPU 7.3 prompt + + ..\Build\$(Configuration)\ + SUBNAUTICA;SUBNAUTICA_STABLE + ..\Build\$(Configuration)\ SUBNAUTICA;SUBNAUTICA_EXP - true - pdbonly - AnyCPU - 7.3 - prompt ..\Build\$(Configuration)\ BELOWZERO;BELOWZERO_STABLE - true - pdbonly - AnyCPU - 7.3 - prompt ..\Build\$(Configuration)\ BELOWZERO;BELOWZERO_EXP - true - pdbonly - AnyCPU - 7.3 - prompt OnBuildSuccess diff --git a/QModPluginEmulator/QModPluginGenerator.cs b/QModPluginEmulator/QModPluginGenerator.cs index 3ea1978b..1da806af 100644 --- a/QModPluginEmulator/QModPluginGenerator.cs +++ b/QModPluginEmulator/QModPluginGenerator.cs @@ -18,7 +18,6 @@ using System.IO; using System.Linq; using System.Reflection; -using System.Text.RegularExpressions; using QModManager.API.ModLoading; using TypeloaderCache = System.Collections.Generic.Dictionary>; using QMMAssemblyCache = System.Collections.Generic.Dictionary; @@ -58,18 +57,6 @@ public static void Finish() { PluginCache = GetPluginCache(); Harmony = new Harmony("QModManager.QModPluginGenerator"); - foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) - { - if (assembly?.GetName()?.Name?.Contains("MirrorInternalLogs") ?? false) - { - Type type = AccessTools.TypeByName("MirrorInternalLogs.Util.LibcHelper"); - var method = type?.GetMethod("Format"); - - if (method != null) - Harmony.Patch(method, postfix: new HarmonyMethod(typeof(QModPluginGenerator), nameof(QModPluginGenerator.LibcHelper_Format_Postfix))); - break; - } - } Harmony.Patch( typeof(TypeLoader).GetMethod(nameof(TypeLoader.FindPluginTypes)).MakeGenericMethod(typeof(PluginInfo)), postfix: new HarmonyMethod(typeof(QModPluginGenerator).GetMethod(nameof(TypeLoaderFindPluginTypesPostfix)))); @@ -83,26 +70,6 @@ public static void Finish() } } - private readonly static List DirtyRegexPatterns = new List() { - new Regex(@"([\r\n]+)?(\(Filename: .*\))$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Replacing cell.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Resetting cell with.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(PerformGarbage.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Fallback handler could not load.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Heartbeat CSV.*,[0-9])$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(L0: PerformGarbageCollection ->.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(L0: CellManager::EstimateBytes.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Kinematic body only supports Speculative Continuous collision detection.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - }; - - private static void LibcHelper_Format_Postfix(ref string __result) - { - foreach (Regex pattern in DirtyRegexPatterns) - { - __result = pattern.Replace(__result, string.Empty).Trim(); - } - } - #if SUBNAUTICA_STABLE [HarmonyPatch(typeof(SystemsSpawner), nameof(SystemsSpawner.Awake))] [HarmonyPrefix] From 6a62628be0779916463d01ac0fe6f91334351e21 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 21:47:26 +0100 Subject: [PATCH 10/24] Revert debug/release configurations from solution. --- QModManager.sln | 84 ------------------------------------------------- 1 file changed, 84 deletions(-) diff --git a/QModManager.sln b/QModManager.sln index d559c84d..d4623aec 100644 --- a/QModManager.sln +++ b/QModManager.sln @@ -44,12 +44,6 @@ Global BZ.STABLE|Any CPU = BZ.STABLE|Any CPU BZ.STABLE|x64 = BZ.STABLE|x64 BZ.STABLE|x86 = BZ.STABLE|x86 - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 SN.EXP|Any CPU = SN.EXP|Any CPU SN.EXP|x64 = SN.EXP|x64 SN.EXP|x86 = SN.EXP|x86 @@ -70,18 +64,6 @@ Global {DA63F59D-4676-4726-AFEC-BD9D3682733F}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|x64.Build.0 = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Debug|x86.Build.0 = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|x64.ActiveCfg = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|x64.Build.0 = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|x86.ActiveCfg = SN.STABLE|Any CPU - {DA63F59D-4676-4726-AFEC-BD9D3682733F}.Release|x86.Build.0 = SN.STABLE|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {DA63F59D-4676-4726-AFEC-BD9D3682733F}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -106,12 +88,6 @@ Global {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU - {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU - {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU - {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Release|x64.ActiveCfg = SN.STABLE|Any CPU - {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.Release|x86.ActiveCfg = SN.STABLE|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {D433A819-73DB-4E6C-AE73-D3DED793BD4E}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -136,18 +112,6 @@ Global {92726127-A08F-4843-BF96-4989CE1BF422}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|x64.Build.0 = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Debug|x86.Build.0 = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Release|x64.ActiveCfg = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Release|x64.Build.0 = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Release|x86.ActiveCfg = SN.STABLE|Any CPU - {92726127-A08F-4843-BF96-4989CE1BF422}.Release|x86.Build.0 = SN.STABLE|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {92726127-A08F-4843-BF96-4989CE1BF422}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -172,18 +136,6 @@ Global {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|x64.Build.0 = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Debug|x86.Build.0 = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|x64.ActiveCfg = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|x64.Build.0 = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|x86.ActiveCfg = SN.STABLE|Any CPU - {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.Release|x86.Build.0 = SN.STABLE|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {E00B7FE8-0F1D-4AE6-9E47-4BFD81537F14}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -208,18 +160,6 @@ Global {CA99F076-7459-4682-A41D-2850AEE28566}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|x64.Build.0 = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Debug|x86.Build.0 = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Release|x64.ActiveCfg = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Release|x64.Build.0 = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Release|x86.ActiveCfg = SN.STABLE|Any CPU - {CA99F076-7459-4682-A41D-2850AEE28566}.Release|x86.Build.0 = SN.STABLE|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {CA99F076-7459-4682-A41D-2850AEE28566}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -244,18 +184,6 @@ Global {EA496DDF-D775-4E17-9EAE-C570C5F50701}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|x64.Build.0 = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Debug|x86.Build.0 = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|x64.ActiveCfg = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|x64.Build.0 = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|x86.ActiveCfg = SN.STABLE|Any CPU - {EA496DDF-D775-4E17-9EAE-C570C5F50701}.Release|x86.Build.0 = SN.STABLE|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {EA496DDF-D775-4E17-9EAE-C570C5F50701}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU @@ -280,18 +208,6 @@ Global {25558450-FF33-4FDF-91C7-0C5C00A94A57}.BZ.STABLE|x64.Build.0 = BZ.STABLE|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.BZ.STABLE|x86.ActiveCfg = BZ.STABLE|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.BZ.STABLE|x86.Build.0 = BZ.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|x64.ActiveCfg = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|x64.Build.0 = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|x86.ActiveCfg = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Debug|x86.Build.0 = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|x64.ActiveCfg = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|x64.Build.0 = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|x86.ActiveCfg = SN.STABLE|Any CPU - {25558450-FF33-4FDF-91C7-0C5C00A94A57}.Release|x86.Build.0 = SN.STABLE|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.SN.EXP|Any CPU.ActiveCfg = SN.EXP|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.SN.EXP|Any CPU.Build.0 = SN.EXP|Any CPU {25558450-FF33-4FDF-91C7-0C5C00A94A57}.SN.EXP|x64.ActiveCfg = SN.EXP|Any CPU From af1c3ef8208c4a2f55e080719813330e86a03cb8 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 23:29:00 +0100 Subject: [PATCH 11/24] SN.STABLE config should point to SystemsSpawner.Awake for init --- Dependencies/SN.STABLE/BepInEx.cfg | 16 ++++++++++++++++ Installer/BZ.EXP.iss | 1 + Installer/BZ.STABLE.iss | 1 + Installer/SN.EXP.iss | 1 + Installer/SN.STABLE.iss | 1 + 5 files changed, 20 insertions(+) create mode 100644 Dependencies/SN.STABLE/BepInEx.cfg diff --git a/Dependencies/SN.STABLE/BepInEx.cfg b/Dependencies/SN.STABLE/BepInEx.cfg new file mode 100644 index 00000000..40ed9366 --- /dev/null +++ b/Dependencies/SN.STABLE/BepInEx.cfg @@ -0,0 +1,16 @@ +[Preloader.Entrypoint] + +## The local filename of the assembly to target. +# Setting type: String +# Default value: UnityEngine.CoreModule.dll +Assembly = Assembly-CSharp.dll + +## The name of the type in the entrypoint assembly to search for the entrypoint method. +# Setting type: String +# Default value: Application +Type = SystemsSpawner + +## The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from. +# Setting type: String +# Default value: .cctor +Method = Awake diff --git a/Installer/BZ.EXP.iss b/Installer/BZ.EXP.iss index 8e53f360..ff6d05b5 100644 --- a/Installer/BZ.EXP.iss +++ b/Installer/BZ.EXP.iss @@ -76,6 +76,7 @@ Source: "QModManager.UnityAudioFixer.xml"; DestDir: "{app}\BepInEx\patchers\QMod ; BepInEx Source: "..\..\Dependencies\BepInEx\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs replacesameversion sharedfile uninsnosharedfileprompt; +Source: "..\..\Dependencies\BZ.EXP\BepInEx.cfg"; DestDir: "{app}\BepInEx\config"; Flags: ignoreversion sharedfile uninsnosharedfileprompt; [Dirs] Name: "{app}\QMods" diff --git a/Installer/BZ.STABLE.iss b/Installer/BZ.STABLE.iss index 21ffb3ea..f84ff133 100644 --- a/Installer/BZ.STABLE.iss +++ b/Installer/BZ.STABLE.iss @@ -76,6 +76,7 @@ Source: "QModManager.UnityAudioFixer.xml"; DestDir: "{app}\BepInEx\patchers\QMod ; BepInEx Source: "..\..\Dependencies\BepInEx\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs replacesameversion sharedfile uninsnosharedfileprompt; +Source: "..\..\Dependencies\BZ.STABLE\BepInEx.cfg"; DestDir: "{app}\BepInEx\config"; Flags: ignoreversion sharedfile uninsnosharedfileprompt; [Dirs] Name: "{app}\QMods" diff --git a/Installer/SN.EXP.iss b/Installer/SN.EXP.iss index 4abd8e00..5f3070ea 100644 --- a/Installer/SN.EXP.iss +++ b/Installer/SN.EXP.iss @@ -76,6 +76,7 @@ Source: "QModManager.UnityAudioFixer.xml"; DestDir: "{app}\BepInEx\patchers\QMod ; BepInEx Source: "..\..\Dependencies\BepInEx\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs replacesameversion sharedfile uninsnosharedfileprompt; +Source: "..\..\Dependencies\SN.EXP\BepInEx.cfg"; DestDir: "{app}\BepInEx\config"; Flags: ignoreversion sharedfile uninsnosharedfileprompt; [Dirs] Name: "{app}\QMods" diff --git a/Installer/SN.STABLE.iss b/Installer/SN.STABLE.iss index 9639659b..92ca5343 100644 --- a/Installer/SN.STABLE.iss +++ b/Installer/SN.STABLE.iss @@ -74,6 +74,7 @@ Source: "QModManager.UnityAudioFixer.xml"; DestDir: "{app}\BepInEx\patchers\QMod ; BepInEx Source: "..\..\Dependencies\BepInEx\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs replacesameversion sharedfile uninsnosharedfileprompt; +Source: "..\..\Dependencies\SN.STABLE\BepInEx.cfg"; DestDir: "{app}\BepInEx\config"; Flags: ignoreversion sharedfile uninsnosharedfileprompt; [Dirs] Name: "{app}\QMods" From ca80aeb9e4a48448029df570189b6bbbbdfc0964 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 23:31:36 +0100 Subject: [PATCH 12/24] Moved QMod loading back into QMMLoader as BepInEx plugins now work as expected --- QModManager/QMMLoader.cs | 52 +++++++++-- QModPluginEmulator/QModPluginGenerator.cs | 104 ++-------------------- 2 files changed, 52 insertions(+), 104 deletions(-) diff --git a/QModManager/QMMLoader.cs b/QModManager/QMMLoader.cs index 737d483c..26859d9f 100644 --- a/QModManager/QMMLoader.cs +++ b/QModManager/QMMLoader.cs @@ -1,8 +1,12 @@ -namespace QModInstaller +using BepInEx; +using System.Collections.Generic; +using UnityEngine; + +namespace QModInstaller { - using BepInEx; - using System; - using UnityEngine; + using QModManager.API.ModLoading; + using QModManager.Patching; + using QModManager.Utility; /// /// QMMLoader - simply fires up the QModManager entry point. @@ -10,7 +14,7 @@ [BepInPlugin(PluginGuid, PluginName, PluginVersion)] [BepInProcess(SubnauticaProcessName)] [BepInProcess(SubnauticaZeroProcessName)] - public class QMMLoader: BaseUnityPlugin + public class QMMLoader : BaseUnityPlugin { internal const string PluginGuid = "QModManager.QMMLoader"; internal const string PluginName = "QMMLoader"; @@ -19,20 +23,52 @@ public class QMMLoader: BaseUnityPlugin internal const string SubnauticaProcessName = "Subnautica"; internal const string SubnauticaZeroProcessName = "SubnauticaZero"; + [System.NonSerialized] + internal static List QModsToLoad; + private static Initializer Initializer; + /// /// Prevents a default instance of the class from being created /// Also ensures the root bepinex object does not get destroyed if the game reloads for steam. /// - [Obsolete("DO NOT USE!", true)] - private QMMLoader() + private void Awake() { GameObject obj = gameObject; - while(obj.transform.parent?.gameObject != null) + while (obj.transform.parent?.gameObject != null) + { obj = obj.transform.parent.gameObject; + } obj.EnsureComponent(); DontDestroyOnLoad(obj); + + InitializeQMods(); + } + + private void InitializeQMods() + { + if (QModsToLoad is null) + { + Logger.LogWarning("QModsToLoad is null!"); + return; + } + + Patcher.Patch(); // Run QModManager patch + + Initializer = new Initializer(Patcher.CurrentlyRunningGame); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPreInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.PreInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.NormalInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.PostInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPostInitialize); + + SummaryLogger.ReportIssues(QModsToLoad); + SummaryLogger.LogSummaries(QModsToLoad); + foreach (Dialog dialog in Patcher.Dialogs) + { + dialog.Show(); + } } } } \ No newline at end of file diff --git a/QModPluginEmulator/QModPluginGenerator.cs b/QModPluginEmulator/QModPluginGenerator.cs index d0ae036a..5cbcf0fc 100644 --- a/QModPluginEmulator/QModPluginGenerator.cs +++ b/QModPluginEmulator/QModPluginGenerator.cs @@ -19,7 +19,6 @@ using System.Linq; using System.Reflection; using System.Text.RegularExpressions; -using QModManager.API.ModLoading; using TypeloaderCache = System.Collections.Generic.Dictionary>; using QMMAssemblyCache = System.Collections.Generic.Dictionary; @@ -44,15 +43,13 @@ public static class QModPluginGenerator internal static Dictionary QModsToLoadById; internal static Dictionary QModPluginInfos; internal static List InitialisedQModPlugins; - private static Initializer Initializer; - private static List ModsToLoad; private static Harmony Harmony; internal static IVersionParser VersionParserService { get; set; } = new VersionParser(); private static TypeloaderCache PluginCache; [Obsolete("Should not be used!", true)] - public static void Finish() + public static void Initialize() { try { @@ -74,6 +71,9 @@ public static void Finish() typeof(TypeLoader).GetMethod(nameof(TypeLoader.FindPluginTypes)).MakeGenericMethod(typeof(PluginInfo)), postfix: new HarmonyMethod(typeof(QModPluginGenerator).GetMethod(nameof(TypeLoaderFindPluginTypesPostfix)))); + Harmony.Patch( + typeof(MetadataHelper).GetMethod(nameof(MetadataHelper.GetMetadata), new Type[] { typeof(object) }), + prefix: new HarmonyMethod(AccessTools.Method(typeof(QModPluginGenerator), nameof(QModPluginGenerator.MetadataHelperGetMetadataPrefix)))); } catch (Exception ex) { @@ -103,94 +103,6 @@ private static void LibcHelper_Format_Postfix(ref string __result) } } -#if SUBNAUTICA_STABLE - [HarmonyPatch(typeof(SystemsSpawner), nameof(SystemsSpawner.Awake))] - [HarmonyPrefix] - private static void PreInitializeQMM() - { - Patcher.Patch(); // Run QModManager patch - - ModsToLoad = QModsToLoad.ToList(); - Initializer = new Initializer(Patcher.CurrentlyRunningGame); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.MetaPreInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.PreInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.NormalInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.PostInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.MetaPostInitialize); - - SummaryLogger.ReportIssues(ModsToLoad); - SummaryLogger.LogSummaries(ModsToLoad); - foreach(Dialog dialog in Patcher.Dialogs) - { - dialog.Show(); - } - - } -#else - [HarmonyPatch(typeof(PreStartScreen), nameof(PreStartScreen.Start))] - [HarmonyPrefix] - private static void PreInitializeQMM() - { - - - Patcher.Patch(); // Run QModManager patch - - ModsToLoad = QModsToLoad.ToList(); - Initializer = new Initializer(Patcher.CurrentlyRunningGame); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.MetaPreInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.PreInitialize); - - Harmony.Patch( - AccessTools.Method( -#if SUBNAUTICA - typeof(PlatformUtils), nameof(PlatformUtils.PlatformInitAsync) -#elif BELOWZERO - typeof(SpriteManager), nameof(SpriteManager.OnLoadedSpriteAtlases) -#endif - ), postfix: new HarmonyMethod(AccessTools.Method(typeof(QModPluginGenerator), nameof(QModPluginGenerator.InitializeQMM)))); - } - -#if SUBNAUTICA_EXP - private static IEnumerator InitializeQMM(IEnumerator result) - { - if (ModsToLoad != null) - { - yield return result; - - Initializer.InitializeMods(ModsToLoad, PatchingOrder.NormalInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.PostInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.MetaPostInitialize); - - SummaryLogger.ReportIssues(ModsToLoad); - SummaryLogger.LogSummaries(ModsToLoad); - foreach (Dialog dialog in Patcher.Dialogs) - { - dialog.Show(); - } - } - yield break; - } -#elif BELOWZERO - private static void InitializeQMM() - { - if (ModsToLoad != null) - { - Initializer.InitializeMods(ModsToLoad, PatchingOrder.NormalInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.PostInitialize); - Initializer.InitializeMods(ModsToLoad, PatchingOrder.MetaPostInitialize); - - SummaryLogger.ReportIssues(ModsToLoad); - SummaryLogger.LogSummaries(ModsToLoad); - - foreach (Dialog dialog in Patcher.Dialogs) - { - dialog.Show(); - } - } - } -#endif -#endif - private static string[] QMMKnownAssemblyPaths = new[] { #if !SUBNAUTICA_STABLE Path.Combine(QMMPatchersPath, "QModManager.OculusNewtonsoftRedirect.dll"), @@ -328,7 +240,6 @@ private static TypeloaderCache GetPluginCache() [Obsolete("Should not be used!", true)] public static void TypeLoaderFindPluginTypesPostfix(ref Dictionary> __result, string directory) { - Harmony.PatchAll(typeof(QModPluginGenerator)); if (directory != Paths.PluginPath) return; @@ -418,17 +329,18 @@ public static void TypeLoaderFindPluginTypesPostfix(ref Dictionary Date: Tue, 1 Jun 2021 23:38:31 +0100 Subject: [PATCH 13/24] NonSerialized decorator not necessary --- QModManager/QMMLoader.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/QModManager/QMMLoader.cs b/QModManager/QMMLoader.cs index 26859d9f..599c73df 100644 --- a/QModManager/QMMLoader.cs +++ b/QModManager/QMMLoader.cs @@ -23,7 +23,6 @@ public class QMMLoader : BaseUnityPlugin internal const string SubnauticaProcessName = "Subnautica"; internal const string SubnauticaZeroProcessName = "SubnauticaZero"; - [System.NonSerialized] internal static List QModsToLoad; private static Initializer Initializer; From 17f4067ccaf764c27c4856614cc8822db8f61f57 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Tue, 1 Jun 2021 23:51:07 +0100 Subject: [PATCH 14/24] Await correct patch time for non-pre patches as per previous implementation --- QModManager/QMMLoader.cs | 62 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/QModManager/QMMLoader.cs b/QModManager/QMMLoader.cs index 599c73df..a84615a8 100644 --- a/QModManager/QMMLoader.cs +++ b/QModManager/QMMLoader.cs @@ -1,4 +1,6 @@ using BepInEx; +using HarmonyLib; +using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -42,10 +44,10 @@ private void Awake() obj.EnsureComponent(); DontDestroyOnLoad(obj); - InitializeQMods(); + PreInitializeQMods(); } - private void InitializeQMods() + private void PreInitializeQMods() { if (QModsToLoad is null) { @@ -58,16 +60,72 @@ private void InitializeQMods() Initializer = new Initializer(Patcher.CurrentlyRunningGame); Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPreInitialize); Initializer.InitializeMods(QModsToLoad, PatchingOrder.PreInitialize); + +#if SUBNAUTICA_STABLE + Initializer.InitializeMods(QModsToLoad, PatchingOrder.NormalInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.PostInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPostInitialize); + + SummaryLogger.ReportIssues(QModsToLoad); + SummaryLogger.LogSummaries(QModsToLoad); + foreach (Dialog dialog in Patcher.Dialogs) + { + dialog.Show(); + } +#else + var harmony = new Harmony(PluginGuid); + harmony.Patch( + AccessTools.Method( +#if SUBNAUTICA + typeof(PlatformUtils), nameof(PlatformUtils.PlatformInitAsync) +#elif BELOWZERO + typeof(SpriteManager), nameof(SpriteManager.OnLoadedSpriteAtlases) +#endif + ), + postfix: new HarmonyMethod(AccessTools.Method(typeof(QMMLoader), nameof(QMMLoader.InitializeQMods))) + ); +#endif + } + +#if SUBNAUTICA_EXP + private static IEnumerator InitializeQMods(IEnumerator result) + { + yield return result; + + if (QModsToLoad != null) + { + Initializer.InitializeMods(QModsToLoad, PatchingOrder.NormalInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.PostInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPostInitialize); + + SummaryLogger.ReportIssues(QModsToLoad); + SummaryLogger.LogSummaries(QModsToLoad); + foreach (Dialog dialog in Patcher.Dialogs) + { + dialog.Show(); + } + } + } +#elif BELOWZERO + private static void InitializeQMods() + { + if (QModsToLoad is null) + { + return; + } + Initializer.InitializeMods(QModsToLoad, PatchingOrder.NormalInitialize); Initializer.InitializeMods(QModsToLoad, PatchingOrder.PostInitialize); Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPostInitialize); SummaryLogger.ReportIssues(QModsToLoad); SummaryLogger.LogSummaries(QModsToLoad); + foreach (Dialog dialog in Patcher.Dialogs) { dialog.Show(); } } +#endif } } \ No newline at end of file From 1135b7e7878c351c350329dd01c461d5ec039627 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Wed, 2 Jun 2021 00:34:33 +0100 Subject: [PATCH 15/24] Improved log filters --- QModManager/BepInex/Plugins/LogFilter.cs | 29 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/QModManager/BepInex/Plugins/LogFilter.cs b/QModManager/BepInex/Plugins/LogFilter.cs index 3a29f99a..328b8c57 100644 --- a/QModManager/BepInex/Plugins/LogFilter.cs +++ b/QModManager/BepInex/Plugins/LogFilter.cs @@ -23,22 +23,31 @@ private void Awake() } private readonly static Regex[] DirtyRegexPatterns = new Regex[] { - new Regex(@"([\r\n]+)?(\(Filename: .*\))$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Replacing cell.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Resetting cell with.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(PerformGarbage.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Fallback handler could not load.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Heartbeat CSV.*,[0-9])$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(L0: PerformGarbageCollection ->.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(L0: CellManager::EstimateBytes.*)$", RegexOptions.Compiled | RegexOptions.Multiline), - new Regex(@"^(Kinematic body only supports Speculative Continuous collision detection.*)$", RegexOptions.Compiled | RegexOptions.Multiline), + new Regex(@"([\r\n]+)?(\(Filename: .*\))", RegexOptions.Compiled), + new Regex(@"([\r\n]+)?(Replacing cell.*)", RegexOptions.Compiled), + new Regex(@"([\r\n]+)?(Resetting cell with.*)", RegexOptions.Compiled), + new Regex(@"([\r\n]+)?(Fallback handler could not load.*)", RegexOptions.Compiled), + new Regex(@"([\r\n]+)?(Heartbeat CSV.*,[0-9])", RegexOptions.Compiled), + new Regex(@"([\r\n]+)?(L[0-9]: .*)", RegexOptions.Compiled), + new Regex(@"([\r\n]+)?(Kinematic body only supports Speculative Continuous collision detection)", RegexOptions.Compiled) }; private static void LibcHelper_Format_Postfix(ref string __result) { + bool match = false; foreach (Regex pattern in DirtyRegexPatterns) { - __result = pattern.Replace(__result, string.Empty).Trim(); + if (pattern.IsMatch(__result)) + { + __result = pattern.Replace(__result, string.Empty).Trim(); + match = true; + } + } + + // if our filtering resulted in an empty string, return null so that MirrorInternalLogs will skip the line + if (match && string.IsNullOrWhiteSpace(__result)) + { + __result = null; } } } From ec255a4f38700e5c1361614b53a1a408791e6b18 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Wed, 2 Jun 2021 00:41:15 +0100 Subject: [PATCH 16/24] No need to check of QModsToLoad is null multiple times. --- QModManager/BepInex/Plugins/QMMLoader.cs | 28 +++++++++--------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/QModManager/BepInex/Plugins/QMMLoader.cs b/QModManager/BepInex/Plugins/QMMLoader.cs index 9f95a6a7..66864c8e 100644 --- a/QModManager/BepInex/Plugins/QMMLoader.cs +++ b/QModManager/BepInex/Plugins/QMMLoader.cs @@ -49,14 +49,14 @@ private void Awake() private void PreInitializeQMods() { + Patcher.Patch(); // Run QModManager patch + if (QModsToLoad is null) { Logger.LogWarning("QModsToLoad is null!"); return; } - Patcher.Patch(); // Run QModManager patch - Initializer = new Initializer(Patcher.CurrentlyRunningGame); Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPreInitialize); Initializer.InitializeMods(QModsToLoad, PatchingOrder.PreInitialize); @@ -92,28 +92,20 @@ private static IEnumerator InitializeQMods(IEnumerator result) { yield return result; - if (QModsToLoad != null) + Initializer.InitializeMods(QModsToLoad, PatchingOrder.NormalInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.PostInitialize); + Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPostInitialize); + + SummaryLogger.ReportIssues(QModsToLoad); + SummaryLogger.LogSummaries(QModsToLoad); + foreach (Dialog dialog in Patcher.Dialogs) { - Initializer.InitializeMods(QModsToLoad, PatchingOrder.NormalInitialize); - Initializer.InitializeMods(QModsToLoad, PatchingOrder.PostInitialize); - Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPostInitialize); - - SummaryLogger.ReportIssues(QModsToLoad); - SummaryLogger.LogSummaries(QModsToLoad); - foreach (Dialog dialog in Patcher.Dialogs) - { - dialog.Show(); - } + dialog.Show(); } } #elif BELOWZERO private static void InitializeQMods() { - if (QModsToLoad is null) - { - return; - } - Initializer.InitializeMods(QModsToLoad, PatchingOrder.NormalInitialize); Initializer.InitializeMods(QModsToLoad, PatchingOrder.PostInitialize); Initializer.InitializeMods(QModsToLoad, PatchingOrder.MetaPostInitialize); From 1b8543c97374a3b627ae36964eb63c20c59fb726 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Wed, 2 Jun 2021 01:06:22 +0100 Subject: [PATCH 17/24] Removed unnecessary platform check --- QModManager/QModManager.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QModManager/QModManager.csproj b/QModManager/QModManager.csproj index 1b7c7cb5..9c85c1d1 100644 --- a/QModManager/QModManager.csproj +++ b/QModManager/QModManager.csproj @@ -108,7 +108,7 @@ False - + ..\Dependencies\$(Configuration)\Sentry.dll False From 9d88fda1eb3fae35b0b63635a924d0d01bca2b5b Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Wed, 2 Jun 2021 01:14:13 +0100 Subject: [PATCH 18/24] `Bepinex` -> `BepInEx` in the Vortex build path to alleviate some issues UNIX users have. --- QModPluginEmulator/QModManager.QModPluginGenerator.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj index b262b3dd..70a26f2b 100644 --- a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj +++ b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj @@ -107,7 +107,7 @@ xcopy "$(TargetDir)QModManager.OculusNewtonsoftRedirect.dll" "$(SolutionDir)Vort xcopy "$(TargetDir)QModInstaller.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\plugins\QModManager\" /I /Q /Y xcopy "$(TargetDir)QModInstaller.xml" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\plugins\QModManager\" /I /Q /Y -powershell Compress-Archive -Path '$(SolutionDir)VortexBuild\$(Configuration)\Bepinex' -DestinationPath '$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip' -Force +powershell Compress-Archive -Path '$(SolutionDir)VortexBuild\$(Configuration)\BepInEx' -DestinationPath '$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip' -Force powershell Compress-Archive -LiteralPath '$(SolutionDir)VortexBuild\$(Configuration)\doorstop_config.ini', '$(SolutionDir)VortexBuild\$(Configuration)\winhttp.dll' -DestinationPath '$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip' -Update echo F|xcopy /S /Q /Y /F "$(SolutionDir)Installer\$(Configuration).iss" "$(TargetDir)\QModsInstallerScript.iss" From 43421710043b7260f9db489c53accfe99509af5f Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Wed, 2 Jun 2021 01:51:50 +0100 Subject: [PATCH 19/24] Move to PreStartScreen.Start entrypoint for all versions except SN.STABLE, retaining QMod init time parity with QMM 4.1.4 --- Dependencies/BZ.EXP/BepInEx.cfg | 2 +- Dependencies/BZ.STABLE/BepInEx.cfg | 2 +- Dependencies/SN.EXP/BepInEx.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dependencies/BZ.EXP/BepInEx.cfg b/Dependencies/BZ.EXP/BepInEx.cfg index 2903c4cd..e15c9378 100644 --- a/Dependencies/BZ.EXP/BepInEx.cfg +++ b/Dependencies/BZ.EXP/BepInEx.cfg @@ -13,4 +13,4 @@ Type = PreStartScreen ## The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from. # Setting type: String # Default value: .cctor -Method = .cctor +Method = Start diff --git a/Dependencies/BZ.STABLE/BepInEx.cfg b/Dependencies/BZ.STABLE/BepInEx.cfg index 2903c4cd..e15c9378 100644 --- a/Dependencies/BZ.STABLE/BepInEx.cfg +++ b/Dependencies/BZ.STABLE/BepInEx.cfg @@ -13,4 +13,4 @@ Type = PreStartScreen ## The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from. # Setting type: String # Default value: .cctor -Method = .cctor +Method = Start diff --git a/Dependencies/SN.EXP/BepInEx.cfg b/Dependencies/SN.EXP/BepInEx.cfg index 2903c4cd..e15c9378 100644 --- a/Dependencies/SN.EXP/BepInEx.cfg +++ b/Dependencies/SN.EXP/BepInEx.cfg @@ -13,4 +13,4 @@ Type = PreStartScreen ## The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from. # Setting type: String # Default value: .cctor -Method = .cctor +Method = Start From 85f76f78483a9695e77dc15bce136b1255f4ccc2 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Sat, 12 Jun 2021 03:56:24 +0100 Subject: [PATCH 20/24] Update AssetsTools.NET path for QModPluginGenerator's post-build event --- QModPluginEmulator/QModManager.QModPluginGenerator.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj index ce9c8d23..39917d7c 100644 --- a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj +++ b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj @@ -105,7 +105,7 @@ rmdir "$(SolutionDir)VortexBuild\$(Configuration)" /q /s xcopy "$(SolutionDir)Dependencies\BepInEx" "$(SolutionDir)VortexBuild\$(Configuration)" /E /H /I /Q /Y xcopy "$(SolutionDir)Dependencies\cldb.dat" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y -xcopy "$(SolutionDir)packages\AssetsTools.NET.2.0.3\lib\net35\AssetsTools.NET.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y +xcopy "$(SolutionDir)packages\AssetsTools.NET.2.0.9\lib\net40\AssetsTools.NET.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y xcopy "$(TargetDir)QModManager.exe" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y xcopy "$(TargetDir)QModManager.QModPluginGenerator.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y xcopy "$(TargetDir)QModManager.UnityAudioFixer.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y From 0f66ba602ad52c26d623a54921983cda92e095c0 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Sat, 12 Jun 2021 04:46:11 +0100 Subject: [PATCH 21/24] Version bump 4.1.4 -> 4.2 --- Data/latest-version.txt | 2 +- Executable/Properties/AssemblyInfo.cs | 4 ++-- Installer/BZ.EXP.iss | 2 +- Installer/BZ.STABLE.iss | 2 +- Installer/Properties/AssemblyInfo.cs | 4 ++-- Installer/SN.EXP.iss | 2 +- Installer/SN.STABLE.iss | 2 +- OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs | 4 ++-- QModManager/BepInex/Plugins/LogFilter.cs | 2 +- QModManager/BepInex/Plugins/QMMLoader.cs | 2 +- QModManager/Properties/AssemblyInfo.cs | 4 ++-- QModPluginEmulator/Properties/AssemblyInfo.cs | 4 ++-- UnityAudioFixer/Properties/AssemblyInfo.cs | 4 ++-- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Data/latest-version.txt b/Data/latest-version.txt index fc931ed3..094c9526 100644 --- a/Data/latest-version.txt +++ b/Data/latest-version.txt @@ -1 +1 @@ -4.1.4.0 \ No newline at end of file +4.2.0.0 \ No newline at end of file diff --git a/Executable/Properties/AssemblyInfo.cs b/Executable/Properties/AssemblyInfo.cs index d74be537..d9e46dd6 100644 --- a/Executable/Properties/AssemblyInfo.cs +++ b/Executable/Properties/AssemblyInfo.cs @@ -12,5 +12,5 @@ [assembly: ComVisible(false)] -[assembly: AssemblyVersion("4.1.4")] -[assembly: AssemblyFileVersion("4.1.4")] +[assembly: AssemblyVersion("4.2")] +[assembly: AssemblyFileVersion("4.2")] diff --git a/Installer/BZ.EXP.iss b/Installer/BZ.EXP.iss index 37dc58e9..3fa94a28 100644 --- a/Installer/BZ.EXP.iss +++ b/Installer/BZ.EXP.iss @@ -5,7 +5,7 @@ #endif #define Name "QModManager" ; The name of the game will be added after it -#define Version "4.1.4" +#define Version "4.2" #define Author "QModManager" #define URL "https://github.com/QModManager/QModManager" #define SupportURL "https://discord.gg/UpWuWwq" diff --git a/Installer/BZ.STABLE.iss b/Installer/BZ.STABLE.iss index fa149777..64fcb3e8 100644 --- a/Installer/BZ.STABLE.iss +++ b/Installer/BZ.STABLE.iss @@ -5,7 +5,7 @@ #endif #define Name "QModManager" ; The name of the game will be added after it -#define Version "4.1.4" +#define Version "4.2" #define Author "QModManager" #define URL "https://github.com/QModManager/QModManager" #define SupportURL "https://discord.gg/UpWuWwq" diff --git a/Installer/Properties/AssemblyInfo.cs b/Installer/Properties/AssemblyInfo.cs index 7d03deec..842baa71 100644 --- a/Installer/Properties/AssemblyInfo.cs +++ b/Installer/Properties/AssemblyInfo.cs @@ -14,5 +14,5 @@ [assembly: Guid("8c6c9a0b-80c4-43d2-89f2-749e6f09fdda")] -[assembly: AssemblyVersion("4.1.4")] -[assembly: AssemblyFileVersion("4.1.4")] +[assembly: AssemblyVersion("4.2")] +[assembly: AssemblyFileVersion("4.2")] diff --git a/Installer/SN.EXP.iss b/Installer/SN.EXP.iss index 7171aab4..5ff504b7 100644 --- a/Installer/SN.EXP.iss +++ b/Installer/SN.EXP.iss @@ -5,7 +5,7 @@ #endif #define Name "QModManager" ; The name of the game will be added after it -#define Version "4.1.4" +#define Version "4.2" #define Author "QModManager" #define URL "https://github.com/QModManager/QModManager" #define SupportURL "https://discord.gg/UpWuWwq" diff --git a/Installer/SN.STABLE.iss b/Installer/SN.STABLE.iss index 350b2e51..c8a57150 100644 --- a/Installer/SN.STABLE.iss +++ b/Installer/SN.STABLE.iss @@ -5,7 +5,7 @@ #endif #define Name "QModManager" ; The name of the game will be added after it -#define Version "4.1.4" +#define Version "4.2" #define Author "QModManager" #define URL "https://github.com/QModManager/QModManager" #define SupportURL "https://discord.gg/UpWuWwq" diff --git a/OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs b/OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs index 308f449b..ddd3cc07 100644 --- a/OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs +++ b/OculusNewtonsoftRedirect/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.1.4")] -[assembly: AssemblyFileVersion("4.1.4")] +[assembly: AssemblyVersion("4.2")] +[assembly: AssemblyFileVersion("4.2")] diff --git a/QModManager/BepInex/Plugins/LogFilter.cs b/QModManager/BepInex/Plugins/LogFilter.cs index 328b8c57..9281deef 100644 --- a/QModManager/BepInex/Plugins/LogFilter.cs +++ b/QModManager/BepInex/Plugins/LogFilter.cs @@ -13,7 +13,7 @@ internal class LogFilter : BaseUnityPlugin { internal const string PluginGuid = "QModManager.LogFilter"; internal const string PluginName = PluginGuid; - internal const string PluginVersion = "4.1.4"; + internal const string PluginVersion = "4.2"; private void Awake() { diff --git a/QModManager/BepInex/Plugins/QMMLoader.cs b/QModManager/BepInex/Plugins/QMMLoader.cs index 66864c8e..7e3e57bd 100644 --- a/QModManager/BepInex/Plugins/QMMLoader.cs +++ b/QModManager/BepInex/Plugins/QMMLoader.cs @@ -23,7 +23,7 @@ public class QMMLoader : BaseUnityPlugin { internal const string PluginGuid = "QModManager.QMMLoader"; internal const string PluginName = "QMMLoader"; - internal const string PluginVersion = "4.1.4"; + internal const string PluginVersion = "4.2"; internal static List QModsToLoad; private static Initializer Initializer; diff --git a/QModManager/Properties/AssemblyInfo.cs b/QModManager/Properties/AssemblyInfo.cs index 911d7312..6396d299 100644 --- a/QModManager/Properties/AssemblyInfo.cs +++ b/QModManager/Properties/AssemblyInfo.cs @@ -13,8 +13,8 @@ [assembly: ComVisible(false)] -[assembly: AssemblyVersion("4.1.4")] -[assembly: AssemblyFileVersion("4.1.4")] +[assembly: AssemblyVersion("4.2")] +[assembly: AssemblyFileVersion("4.2")] [assembly: InternalsVisibleTo("QMMTests")] [assembly: InternalsVisibleTo("QModManager")] diff --git a/QModPluginEmulator/Properties/AssemblyInfo.cs b/QModPluginEmulator/Properties/AssemblyInfo.cs index f9692a53..65db3109 100644 --- a/QModPluginEmulator/Properties/AssemblyInfo.cs +++ b/QModPluginEmulator/Properties/AssemblyInfo.cs @@ -33,8 +33,8 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.1.4")] -[assembly: AssemblyFileVersion("4.1.4")] +[assembly: AssemblyVersion("4.2")] +[assembly: AssemblyFileVersion("4.2")] [assembly: NeutralResourcesLanguage("en")] [assembly: InternalsVisibleTo("QModManager.QMMLoader")] diff --git a/UnityAudioFixer/Properties/AssemblyInfo.cs b/UnityAudioFixer/Properties/AssemblyInfo.cs index 3572587f..8ac3042a 100644 --- a/UnityAudioFixer/Properties/AssemblyInfo.cs +++ b/UnityAudioFixer/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.1.4")] -[assembly: AssemblyFileVersion("4.1.4")] +[assembly: AssemblyVersion("4.2")] +[assembly: AssemblyFileVersion("4.2")] From ccc4bbe77c16575989556059afeb5e89b4e2aed7 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Thu, 17 Jun 2021 07:38:27 +0100 Subject: [PATCH 22/24] Switch to 7z instead of using PowerShell's `Compress-Archive` cmdlet for automation of .zip file creation. --- QModPluginEmulator/QModManager.QModPluginGenerator.csproj | 7 +++++-- QModPluginEmulator/packages.config | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 QModPluginEmulator/packages.config diff --git a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj index 44d59f8d..48a56ec5 100644 --- a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj +++ b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj @@ -85,6 +85,9 @@ QModManager + + + rmdir "$(SolutionDir)VortexBuild\$(Configuration)" /q /s @@ -107,8 +110,8 @@ xcopy "$(TargetDir)QModManager.OculusNewtonsoftRedirect.dll" "$(SolutionDir)Vort xcopy "$(TargetDir)QModInstaller.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\plugins\QModManager\" /I /Q /Y xcopy "$(TargetDir)QModInstaller.xml" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\plugins\QModManager\" /I /Q /Y -powershell Compress-Archive -Path '$(SolutionDir)VortexBuild\$(Configuration)\BepInEx' -DestinationPath '$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip' -Force -powershell Compress-Archive -LiteralPath '$(SolutionDir)VortexBuild\$(Configuration)\doorstop_config.ini', '$(SolutionDir)VortexBuild\$(Configuration)\winhttp.dll' -DestinationPath '$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip' -Update +$(SolutionDir)packages\7-Zip.CommandLine.18.1.0\tools\7za.exe a "$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx" -r +$(SolutionDir)packages\7-Zip.CommandLine.18.1.0\tools\7za.exe a "$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip" "$(SolutionDir)VortexBuild\$(Configuration)\doorstop_config.ini" "$(SolutionDir)VortexBuild\$(Configuration)\winhttp.dll" echo F|xcopy /S /Q /Y /F "$(SolutionDir)Installer\$(Configuration).iss" "$(TargetDir)\QModsInstallerScript.iss" "$(SolutionDir)Dependencies\Inno\ISCC.exe" "$(TargetDir)QModsInstallerScript.iss" diff --git a/QModPluginEmulator/packages.config b/QModPluginEmulator/packages.config new file mode 100644 index 00000000..09dc1015 --- /dev/null +++ b/QModPluginEmulator/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From ea0f8334f190a34d17953ed50af2e362a1945ec1 Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Thu, 17 Jun 2021 08:10:40 +0100 Subject: [PATCH 23/24] Only need to run 7za once. No need for -r switch. --- QModPluginEmulator/QModManager.QModPluginGenerator.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj index 48a56ec5..cde2ad3e 100644 --- a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj +++ b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj @@ -110,8 +110,7 @@ xcopy "$(TargetDir)QModManager.OculusNewtonsoftRedirect.dll" "$(SolutionDir)Vort xcopy "$(TargetDir)QModInstaller.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\plugins\QModManager\" /I /Q /Y xcopy "$(TargetDir)QModInstaller.xml" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\plugins\QModManager\" /I /Q /Y -$(SolutionDir)packages\7-Zip.CommandLine.18.1.0\tools\7za.exe a "$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx" -r -$(SolutionDir)packages\7-Zip.CommandLine.18.1.0\tools\7za.exe a "$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip" "$(SolutionDir)VortexBuild\$(Configuration)\doorstop_config.ini" "$(SolutionDir)VortexBuild\$(Configuration)\winhttp.dll" +$(SolutionDir)packages\7-Zip.CommandLine.18.1.0\tools\7za.exe a "$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip" "$(SolutionDir)VortexBuild\$(Configuration)\*" echo F|xcopy /S /Q /Y /F "$(SolutionDir)Installer\$(Configuration).iss" "$(TargetDir)\QModsInstallerScript.iss" "$(SolutionDir)Dependencies\Inno\ISCC.exe" "$(TargetDir)QModsInstallerScript.iss" From f8a3d826df5f74c41e91d270acac67bdfff6bd9d Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Fri, 18 Jun 2021 06:23:13 +0100 Subject: [PATCH 24/24] At the request of @zorgesho, moved the post-build script into a .cmd script. --- QModManager.sln | 8 ++++++ .../QModManager.QModPluginGenerator.csproj | 25 +---------------- Scripts/QModPluginGenerator-post-build.cmd | 27 +++++++++++++++++++ 3 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 Scripts/QModPluginGenerator-post-build.cmd diff --git a/QModManager.sln b/QModManager.sln index d4623aec..bb32a167 100644 --- a/QModManager.sln +++ b/QModManager.sln @@ -36,6 +36,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QModManager.QModPluginGener EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QModManager.OculusNewtonsoftRedirect", "OculusNewtonsoftRedirect\QModManager.OculusNewtonsoftRedirect.csproj", "{25558450-FF33-4FDF-91C7-0C5C00A94A57}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build Scripts", "Build Scripts", "{075884D3-CC6F-4B56-B050-C31A8E11FA52}" + ProjectSection(SolutionItems) = preProject + Scripts\QModPluginGenerator-post-build.cmd = Scripts\QModPluginGenerator-post-build.cmd + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution BZ.EXP|Any CPU = BZ.EXP|Any CPU @@ -224,6 +229,9 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {075884D3-CC6F-4B56-B050-C31A8E11FA52} = {5A8D179E-C749-4346-AD81-05F11C082A1C} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {54A73C4F-4981-48CC-AD91-27D3D090D5D4} EndGlobalSection diff --git a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj index cde2ad3e..91da93a4 100644 --- a/QModPluginEmulator/QModManager.QModPluginGenerator.csproj +++ b/QModPluginEmulator/QModManager.QModPluginGenerator.csproj @@ -90,29 +90,6 @@ - rmdir "$(SolutionDir)VortexBuild\$(Configuration)" /q /s -xcopy "$(SolutionDir)Dependencies\BepInEx" "$(SolutionDir)VortexBuild\$(Configuration)" /E /H /I /Q /Y -xcopy "$(SolutionDir)Dependencies\$(Configuration)\BepInEx.cfg" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\config\" /I /Q /Y -mkdir "$(SolutionDir)VortexBuild\$(Configuration)\QMods" -xcopy "$(SolutionDir)Dependencies\cldb.dat" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y -xcopy "$(SolutionDir)packages\AssetsTools.NET.2.0.9\lib\net40\AssetsTools.NET.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y -xcopy "$(TargetDir)QModManager.exe" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y -xcopy "$(TargetDir)QModManager.QModPluginGenerator.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y -xcopy "$(TargetDir)QModManager.UnityAudioFixer.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y -xcopy "$(TargetDir)QModManager.UnityAudioFixer.xml" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y - -if NOT "$(ConfigurationName)" =="SN.STABLE" ( - -xcopy "$(SolutionDir)Dependencies\Oculus.Newtonsoft.Json.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y -xcopy "$(TargetDir)QModManager.OculusNewtonsoftRedirect.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\patchers\QModManager\" /I /Q /Y -) - -xcopy "$(TargetDir)QModInstaller.dll" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\plugins\QModManager\" /I /Q /Y -xcopy "$(TargetDir)QModInstaller.xml" "$(SolutionDir)VortexBuild\$(Configuration)\BepInEx\plugins\QModManager\" /I /Q /Y - -$(SolutionDir)packages\7-Zip.CommandLine.18.1.0\tools\7za.exe a "$(SolutionDir)VortexBuild\QModManager_$(Configuration).zip" "$(SolutionDir)VortexBuild\$(Configuration)\*" - -echo F|xcopy /S /Q /Y /F "$(SolutionDir)Installer\$(Configuration).iss" "$(TargetDir)\QModsInstallerScript.iss" -"$(SolutionDir)Dependencies\Inno\ISCC.exe" "$(TargetDir)QModsInstallerScript.iss" + call "$(SolutionDir)\Scripts\QModPluginGenerator-post-build.cmd" "$(SolutionDir)" "$(TargetDir)" "$(ConfigurationName)" \ No newline at end of file diff --git a/Scripts/QModPluginGenerator-post-build.cmd b/Scripts/QModPluginGenerator-post-build.cmd new file mode 100644 index 00000000..e9e22b18 --- /dev/null +++ b/Scripts/QModPluginGenerator-post-build.cmd @@ -0,0 +1,27 @@ +set solutionDir=%~f1 +set targetDir=%~f2 +set configName=%3 + +rmdir "%solutionDir%VortexBuild\%configName%" /q /s +xcopy "%solutionDir%Dependencies\BepInEx" "%solutionDir%VortexBuild\%configName%" /E /H /I /Q /Y +xcopy "%solutionDir%Dependencies\%configName%\BepInEx.cfg" "%solutionDir%VortexBuild\%configName%\BepInEx\config\" /I /Q /Y +mkdir "%solutionDir%VortexBuild\%configName%\QMods" +xcopy "%solutionDir%Dependencies\cldb.dat" "%solutionDir%VortexBuild\%configName%\BepInEx\patchers\QModManager\" /I /Q /Y +xcopy "%solutionDir%packages\AssetsTools.NET.2.0.9\lib\net40\AssetsTools.NET.dll" "%solutionDir%VortexBuild\%configName%\BepInEx\patchers\QModManager\" /I /Q /Y +xcopy "%targetDir%QModManager.exe" "%solutionDir%VortexBuild\%configName%\BepInEx\patchers\QModManager\" /I /Q /Y +xcopy "%targetDir%QModManager.QModPluginGenerator.dll" "%solutionDir%VortexBuild\%configName%\BepInEx\patchers\QModManager\" /I /Q /Y +xcopy "%targetDir%QModManager.UnityAudioFixer.dll" "%solutionDir%VortexBuild\%configName%\BepInEx\patchers\QModManager\" /I /Q /Y +xcopy "%targetDir%QModManager.UnityAudioFixer.xml" "%solutionDir%VortexBuild\%configName%\BepInEx\patchers\QModManager\" /I /Q /Y + +if NOT "%configName%" =="SN.STABLE" ( + xcopy "%solutionDir%Dependencies\Oculus.Newtonsoft.Json.dll" "%solutionDir%VortexBuild\%configName%\BepInEx\patchers\QModManager\" /I /Q /Y + xcopy "%targetDir%QModManager.OculusNewtonsoftRedirect.dll" "%solutionDir%VortexBuild\%configName%\BepInEx\patchers\QModManager\" /I /Q /Y +) + +xcopy "%targetDir%QModInstaller.dll" "%solutionDir%VortexBuild\%configName%\BepInEx\plugins\QModManager\" /I /Q /Y +xcopy "%targetDir%QModInstaller.xml" "%solutionDir%VortexBuild\%configName%\BepInEx\plugins\QModManager\" /I /Q /Y + +%solutionDir%packages\7-Zip.CommandLine.18.1.0\tools\7za.exe a "%solutionDir%VortexBuild\QModManager_%configName%.zip" "%solutionDir%VortexBuild\%configName%\*" + +echo F|xcopy /S /Q /Y /F "%solutionDir%Installer\%configName%.iss" "%targetDir%\QModsInstallerScript.iss" +"%solutionDir%Dependencies\Inno\ISCC.exe" "%targetDir%QModsInstallerScript.iss" \ No newline at end of file