From 2bd4c0b327aa7031dba009307df6bf2bcc59e2a1 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sun, 23 Sep 2018 17:03:53 -0500 Subject: [PATCH] Fixed backups to bacup files that will be patched, even if they aren't initially --- Doorstop | 2 +- IPA.Injector/Injector.cs | 4 +++- IPA.Injector/Virtualizer.cs | 5 ++++- IPA/Program.cs | 3 +++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Doorstop b/Doorstop index 04d29898..b45c8415 160000 --- a/Doorstop +++ b/Doorstop @@ -1 +1 @@ -Subproject commit 04d2989813eaec3d98859333d0ad563ac292c714 +Subproject commit b45c8415cd3cfe59c6e79f90955bfc7a07204e13 diff --git a/IPA.Injector/Injector.cs b/IPA.Injector/Injector.cs index c6ae0eb3..4c0d7fe0 100644 --- a/IPA.Injector/Injector.cs +++ b/IPA.Injector/Injector.cs @@ -109,13 +109,15 @@ namespace IPA.Injector } if (modified) + { unityAsmDef.Write(unityPath); + } #endregion loader.Debug("Ensuring Assembly-CSharp is virtualized"); #region Virtualize Assembly-CSharp.dll var ascPath = Path.Combine(Environment.CurrentDirectory, "Beat Saber_Data", "Managed", "Assembly-CSharp.dll"); - + var ascModule = VirtualizedModule.Load(ascPath); ascModule.Virtualize(cAsmName); #endregion diff --git a/IPA.Injector/Virtualizer.cs b/IPA.Injector/Virtualizer.cs index d80c65dc..21daec52 100644 --- a/IPA.Injector/Virtualizer.cs +++ b/IPA.Injector/Virtualizer.cs @@ -36,7 +36,7 @@ namespace IPA.Injector /// /// /// - public void Virtualize(AssemblyName selfName) + public void Virtualize(AssemblyName selfName, Action beforeChangeCallback = null) { bool changed = false; bool virtualize = true; @@ -65,7 +65,10 @@ namespace IPA.Injector } if (changed) + { + beforeChangeCallback?.Invoke(); module.Write(file.FullName); + } } private void VirtualizeType(TypeDefinition type) diff --git a/IPA/Program.cs b/IPA/Program.cs index 415c0511..e6edc75b 100644 --- a/IPA/Program.cs +++ b/IPA/Program.cs @@ -254,6 +254,9 @@ namespace IPA CopyAll(new DirectoryInfo(context.IPARoot), new DirectoryInfo(context.ProjectRoot), force, backup, null, false); + + backup.Add(context.AssemblyFile); + backup.Add(context.EngineFile); } #region Create Plugin Folder