Selsion / DSPMods

MIT License
10 stars 3 forks source link

[DSPOptimizations] An error occurred while loading the mod. #9

Closed NakiriFox closed 3 months ago

NakiriFox commented 3 months ago

[Info : BepInEx] Loading [DSPOptimizations 1.1.16] [Info :DSPOptimizations] 9 optimization sets loaded [Error : HarmonyX] Failed to patch void GameData::GameTick(long time): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. at System.ThrowHelper.ThrowArgumentException (System.ExceptionResource resource) [0x0000b] in <2fa7a6a452ca43df998f07fd1486c0df>:0 at System.Collections.Generic.List1[T].RemoveRange (System.Int32 index, System.Int32 count) [0x00023] in <2fa7a6a452ca43df998f07fd1486c0df>:0 at HarmonyLib.CodeMatcher.RemoveInstructions (System.Int32 count) [0x0000c] in <474744d65d8e460fa08cd5fd82b5d65f>:0 at DSPOptimizations.PerformanceStatsFix+Patch.StatsFixPatch (System.Collections.Generic.IEnumerable1[T] instructions, System.Reflection.Emit.ILGenerator generator) [0x000f5] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <2fa7a6a452ca43df998f07fd1486c0df>:0 --- End of inner exception stack trace --- at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004b] in <2fa7a6a452ca43df998f07fd1486c0df>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <2fa7a6a452ca43df998f07fd1486c0df>:0 at HarmonyLib.Internal.Patching.ILManipulator.ApplyTranspilers (System.Reflection.Emit.ILGenerator il, System.Reflection.MethodBase original, System.Func2[T,TResult] getLocal, System.Func1[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 [Message: BepInEx] Chainloader startup complete

NakiriFox commented 3 months ago

And it destroyed SampleAndHoldSim👇

[Info : BepInEx] Loading [SampleAndHoldSim 0.6.8] [Error : HarmonyX] Failed to patch void GameData::GameTick(long time): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. at System.ThrowHelper.ThrowArgumentException (System.ExceptionResource resource) [0x0000b] in <2fa7a6a452ca43df998f07fd1486c0df>:0 at System.Collections.Generic.List1[T].RemoveRange (System.Int32 index, System.Int32 count) [0x00023] in <2fa7a6a452ca43df998f07fd1486c0df>:0 at HarmonyLib.CodeMatcher.RemoveInstructions (System.Int32 count) [0x0000c] in <474744d65d8e460fa08cd5fd82b5d65f>:0 at DSPOptimizations.PerformanceStatsFix+Patch.StatsFixPatch (System.Collections.Generic.IEnumerable1[T] instructions, System.Reflection.Emit.ILGenerator generator) [0x000f5] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <2fa7a6a452ca43df998f07fd1486c0df>:0 --- End of inner exception stack trace --- at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004b] in <2fa7a6a452ca43df998f07fd1486c0df>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <2fa7a6a452ca43df998f07fd1486c0df>:0 at HarmonyLib.Internal.Patching.ILManipulator.ApplyTranspilers (System.Reflection.Emit.ILGenerator il, System.Reflection.MethodBase original, System.Func2[T,TResult] getLocal, System.Func1[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

Selsion commented 3 months ago

Thanks for the bug report. The error in patching was caused by the mod referencing an old value when looking for IL instructions to change. This has been fixed in v1.1.17 of DSPOptimizations by rebuilding the mod. This should also fix your error with SampleAndHoldSim.