diff --git a/UXAssist/Patches/PersistPatch.cs b/UXAssist/Patches/PersistPatch.cs index 5539ad0..212678b 100644 --- a/UXAssist/Patches/PersistPatch.cs +++ b/UXAssist/Patches/PersistPatch.cs @@ -69,14 +69,15 @@ public class PersistPatch : PatchImpl { var matcher = new CodeMatcher(instructions, generator); matcher.MatchForward(false, - new CodeMatch(OpCodes.Ldloc_2), + new CodeMatch(ci => ci.opcode == OpCodes.Ldloc || ci.opcode == OpCodes.Ldloc_S), new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Component), nameof(Component.gameObject))), new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(GameObject), nameof(GameObject.activeSelf))) ); + var ldLocOpr = matcher.Operand; var labels = matcher.Labels; matcher.Labels = null; matcher.Insert( - new CodeInstruction(OpCodes.Ldloc_2).WithLabels(labels), + new CodeInstruction(OpCodes.Ldloc_S, ldLocOpr).WithLabels(labels), new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Component), nameof(Component.transform))), new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Transform), nameof(Transform.parent))), new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Transform), nameof(Transform.parent))), diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs index 9811387..980e904 100644 --- a/UXAssist/UXAssist.cs +++ b/UXAssist/UXAssist.cs @@ -273,7 +273,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave var src = mainMenu.newGameButton; var parent = src.transform.parent; var btn = Instantiate(src, parent); - btn.name = "button-cheatenabler-config"; + btn.name = "button-uxassist-config"; var l = btn.text.GetComponent(); if (l != null) {