diff --git a/StarMap.Core/Patches/PatchManager.cs b/StarMap.Core/Patches/PatchManager.cs index c6ee34e..4edd0bc 100644 --- a/StarMap.Core/Patches/PatchManager.cs +++ b/StarMap.Core/Patches/PatchManager.cs @@ -132,9 +132,9 @@ public static bool PrefixPatchEntryPoint( MethodBase __originalMethod, object[] __args, object? __instance, - ref T __result) + ref object? __result) { - object? result = __result; + var result = __result; var outcome = _instance?.PatchEntryPoint(HarmonyPatchType.Prefix, __originalMethod, __args, __instance, ref result) ?? true; __result = IPatchCallback.CastValue(result, nameof(__result)); return outcome; @@ -154,9 +154,9 @@ public static void PostfixPatchEntryPoint( MethodBase __originalMethod, object[] __args, object? __instance, - ref T __result) + ref object? __result) { - object? result = __result; + var result = __result; _instance?.PatchEntryPoint(HarmonyPatchType.Postfix, __originalMethod, __args, __instance, ref result); __result = IPatchCallback.CastValue(result, nameof(__result)); } @@ -454,7 +454,12 @@ public void Dispose() if (Interlocked.Exchange(ref _disposed, 1) != 0) return; - _patch.UnregisterPatch(this); + try + { + _patch.UnregisterPatch(this); + } + catch { } + } } } diff --git a/StarMap/Properties/launchSettings.json b/StarMap/Properties/launchSettings.json new file mode 100644 index 0000000..80ebb9d --- /dev/null +++ b/StarMap/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "StarMap": { + "commandName": "Project", + "commandLineArgs": "-InstancePath \"C:\\Users\\klaas\\AppData\\Local\\Borea\\Instances\\6cc3f568-20c3-4592-9df6-faaf6448ea8e\"" + } + } +} \ No newline at end of file