bepinex / bepinex.utility Goto Github PK
View Code? Open in Web Editor NEWGeneric utility plugins for the BepInEx plugin loader (mono)
License: GNU General Public License v3.0
Generic utility plugins for the BepInEx plugin loader (mono)
License: GNU General Public License v3.0
And not being built and attached to the release
When nesting Vertical and Horizontal Groups, I discovered an issue with a Button with ExpandHeight(true)
inside a Horizontal Group nested inside another Vertical Group with ExpandHeight(false)
causing the Vertical Groups ExpandHeight(false)
to be negated. Screenshots of with and without BepInEx.OptimizeIMGUI and condensed sample code below.
Without BepInEx.OptimizeIMGUI (Correct):
With BepInEx.OptimizeIMGUI (Incorrect):
Condensed Sample code:
public class NewBehaviourScript : MonoBehaviour
{
private Rect uiWindow2 = new Rect(UnityEngine.Screen.width / 2 + 20, 20, 120, 400);
private void OnGUI()
{
uiWindow2 = GUILayout.Window(34566, uiWindow2, DisplayUIWindowX, "TEST");
}
private void DisplayUIWindowX(int windowId)
{
GUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
{
//Header
GUILayout.BeginVertical("box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
//Toolbar
{
GUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
{
//Header
GUILayout.Label("TEST", GUILayout.ExpandWidth(true));
//Options
if (GUILayout.Button("O", GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
{
}
}
GUILayout.EndHorizontal();
//Options
}
}
GUILayout.EndVertical();
//Content
GUILayout.BeginVertical("box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
{
//Abstract
//this.DisplayUIWindowBase();
GUILayout.FlexibleSpace();
}
GUILayout.EndVertical();
//Info
GUILayout.BeginVertical("box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
GUILayout.BeginHorizontal();
{
GUILayout.Label("Info: " + "", GUILayout.ExpandWidth(true));
if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
{
//info = "";
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
GUI.DragWindow();
}
}
When I installed the OptimizeIMGUI plugin in Rhythm Doctor, BepInEx sent an error and the plugin couldn't be patched.
Full error log:
[Info : BepInEx] Loading [Optimize IMGUI GC allocations 1.0]
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Rhythm Doctor/Rhythm Doctor_Data/MonoBleedingEdge/data-16811CC0.dll
[Error : HarmonyX] Failed to patch static void UnityEngine.GUILayoutUtility::Begin(int instanceID): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MethodAccessException: Method `HarmonyXInterop.TranspilerInterop.ApplyTranspiler(System.Reflection.MethodInfo,System.Collections.Generic.IEnumerable`1<HarmonyLib.CodeInstruction>,System.Reflection.Emit.ILGenerator,System.Reflection.MethodBase)' is inaccessible from method `DMD<>?-839127053.TranspilerWrapper<BepInEx.OptimizeIMGUI+Hooks::FixOnguiGarbageDump>(System.Collections.Generic.IEnumerable`1<HarmonyLib.CodeInstruction>,System.Reflection.Emit.ILGenerator,System.Reflection.MethodBase)'
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
at DMD<>?-839127053.TranspilerWrapper<BepInEx.OptimizeIMGUI+Hooks::FixOnguiGarbageDump> (System.Collections.Generic.IEnumerable`1[T] , System.Reflection.Emit.ILGenerator , System.Reflection.MethodBase ) [0x0000a] in <fd914e7fd4294a509c6e118a98684276>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <e40e5a8f982c4b618a930d29f9bd091c>:0
--- End of inner exception stack trace ---
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <e40e5a8f982c4b618a930d29f9bd091c>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <e40e5a8f982c4b618a930d29f9bd091c>:0
at HarmonyLib.Internal.Patching.ILManipulator.ApplyTranspilers (System.Reflection.Emit.ILGenerator il, System.Reflection.MethodBase original, System.Func`2[T,TResult] getLocal, System.Func`1[TResult] defineLabel) [0x00093] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Internal.Patching.ILManipulator.WriteTo (Mono.Cecil.Cil.MethodBody body, System.Reflection.MethodBase original) [0x00066] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Public.Patching.HarmonyManipulator.WriteTranspilers () [0x00084] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Public.Patching.HarmonyManipulator.WriteImpl () [0x0002b] in <474744d65d8e460fa08cd5fd82b5d65f>:0
MethodAccessException: Method `HarmonyXInterop.TranspilerInterop.ApplyTranspiler(System.Reflection.MethodInfo,System.Collections.Generic.IEnumerable`1<HarmonyLib.CodeInstruction>,System.Reflection.Emit.ILGenerator,System.Reflection.MethodBase)' is inaccessible from method `DMD<>?-839127053.TranspilerWrapper<BepInEx.OptimizeIMGUI+Hooks::FixOnguiGarbageDump>(System.Collections.Generic.IEnumerable`1<HarmonyLib.CodeInstruction>,System.Reflection.Emit.ILGenerator,System.Reflection.MethodBase)'
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
at DMD<>?-839127053.TranspilerWrapper<BepInEx.OptimizeIMGUI+Hooks::FixOnguiGarbageDump> (System.Collections.Generic.IEnumerable`1[T] , System.Reflection.Emit.ILGenerator , System.Reflection.MethodBase ) [0x0000a] in <fd914e7fd4294a509c6e118a98684276>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <e40e5a8f982c4b618a930d29f9bd091c>:0
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <e40e5a8f982c4b618a930d29f9bd091c>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <e40e5a8f982c4b618a930d29f9bd091c>:0
at HarmonyLib.Internal.Patching.ILManipulator.ApplyTranspilers (System.Reflection.Emit.ILGenerator il, System.Reflection.MethodBase original, System.Func`2[T,TResult] getLocal, System.Func`1[TResult] defineLabel) [0x00093] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Internal.Patching.ILManipulator.WriteTo (Mono.Cecil.Cil.MethodBody body, System.Reflection.MethodBase original) [0x00066] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Public.Patching.HarmonyManipulator.WriteTranspilers () [0x00084] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Public.Patching.HarmonyManipulator.WriteImpl () [0x0002b] in <474744d65d8e460fa08cd5fd82b5d65f>:0
Rethrow as HarmonyException: IL Compile Error (unknown location)
at HarmonyLib.Public.Patching.HarmonyManipulator.WriteImpl () [0x00378] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Public.Patching.HarmonyManipulator.Process (MonoMod.Cil.ILContext ilContext, System.Reflection.MethodBase originalMethod) [0x00042] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Public.Patching.HarmonyManipulator.Manipulate (System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo, MonoMod.Cil.ILContext ctx) [0x00006] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Public.Patching.HarmonyManipulator.Manipulate (System.Reflection.MethodBase original, MonoMod.Cil.ILContext ctx) [0x00007] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.Public.Patching.ManagedMethodPatcher.Manipulator (MonoMod.Cil.ILContext ctx) [0x00012] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at MonoMod.Cil.ILContext.Invoke (MonoMod.Cil.ILContext+Manipulator manip) [0x00087] in <6733e342b5b549bba815373898724469>:0
at MonoMod.RuntimeDetour.ILHook+Context.InvokeManipulator (Mono.Cecil.MethodDefinition def, MonoMod.Cil.ILContext+Manipulator cb) [0x00012] in <4e2760c7517c4ea79c633d67e84b319f>:0
at (wrapper dynamic-method) MonoMod.RuntimeDetour.ILHook+Context.DMD<MonoMod.RuntimeDetour.ILHook+Context::Refresh>(MonoMod.RuntimeDetour.ILHook/Context)
at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Trampoline<MonoMod.RuntimeDetour.ILHook+Context::Refresh>?860763720(object)
at HarmonyLib.Internal.RuntimeFixes.StackTraceFixes.OnILChainRefresh (System.Object self) [0x00000] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at MonoMod.RuntimeDetour.ILHook.Apply () [0x00059] in <4e2760c7517c4ea79c633d67e84b319f>:0
at HarmonyLib.Public.Patching.ManagedMethodPatcher.DetourTo (System.Reflection.MethodBase replacement) [0x00047] in <474744d65d8e460fa08cd5fd82b5d65f>:0
Rethrow as HarmonyException: IL Compile Error (unknown location)
at HarmonyLib.Public.Patching.ManagedMethodPatcher.DetourTo (System.Reflection.MethodBase replacement) [0x0005f] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyLib.PatchFunctions.UpdateWrapper (System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) [0x00033] in <474744d65d8e460fa08cd5fd82b5d65f>:0
Rethrow as HarmonyException: IL Compile Error (unknown location)
at HarmonyLib.PatchFunctions.UpdateWrapper (System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) [0x0005d] in <474744d65d8e460fa08cd5fd82b5d65f>:0
at HarmonyXInterop.HarmonyInterop.ApplyPatch (System.Reflection.MethodBase target, HarmonyXInterop.PatchInfoWrapper add, HarmonyXInterop.PatchInfoWrapper remove) [0x00096] in <6f91f4d0d9ac41feb7f307a416c33caa>:0
at HarmonyLib.Internal.MethodPatcher.Apply () [0x000f1] in <b82efbe2c5b74e3c987a02289921fc46>:0
at HarmonyLib.PatchProcessor.Patch () [0x00155] in <b82efbe2c5b74e3c987a02289921fc46>:0
at HarmonyLib.Harmony.PatchAll (System.Type type) [0x002a5] in <b82efbe2c5b74e3c987a02289921fc46>:0
at HarmonyLib.Harmony.CreateAndPatchAll (System.Type type, System.String harmonyInstanceId) [0x0001e] in <b82efbe2c5b74e3c987a02289921fc46>:0
at BepInEx.OptimizeIMGUI.Awake () [0x0000b] in <a11d3c6d58be4fbb980eaf2e50544d56>:0
UnityEngine.GameObject:Internal_AddComponentWithType(GameObject, Type)
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:Start()
UnityEngine.Application:.cctor()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.