diff --git a/CringeLauncher/ImGuiHandler.cs b/CringeLauncher/ImGuiHandler.cs index c8efbee..4b3e30a 100644 --- a/CringeLauncher/ImGuiHandler.cs +++ b/CringeLauncher/ImGuiHandler.cs @@ -52,7 +52,7 @@ internal class ImGuiHandler : IDisposable public void DoRender() { if (Rtv is null) - throw new InvalidOperationException("Rtv is null"); + return; ImGui_ImplDX11_NewFrame(); ImGui_ImplWin32_NewFrame(); diff --git a/CringeLauncher/Patches/SwapChainPatch.cs b/CringeLauncher/Patches/SwapChainPatch.cs index df5238d..996a9a9 100644 --- a/CringeLauncher/Patches/SwapChainPatch.cs +++ b/CringeLauncher/Patches/SwapChainPatch.cs @@ -82,4 +82,13 @@ public static class SwapChainPatch return false; } + + [HarmonyPrefix, HarmonyPatch(typeof(MyBackbuffer), nameof(MyBackbuffer.Release))] + private static void SwapChainBBReleasePrefix(MyBackbuffer __instance) + { + if (ImGuiHandler.Rtv is null) return; + + ImGuiHandler.Rtv.Dispose(); + ImGuiHandler.Rtv = null; + } } \ No newline at end of file