From fee888758fb1ddd81d9e6c358e867c3f48236596 Mon Sep 17 00:00:00 2001
From: Stenzek <stenzek@gmail.com>
Date: Sun, 14 Jul 2024 21:30:52 +1000
Subject: [PATCH] System: Purge unused RecreateSystem()

---
 src/core/system.cpp | 38 --------------------------------------
 src/core/system.h   |  3 ---
 2 files changed, 41 deletions(-)

diff --git a/src/core/system.cpp b/src/core/system.cpp
index 0e140a95e..5ce1741ec 100644
--- a/src/core/system.cpp
+++ b/src/core/system.cpp
@@ -2255,44 +2255,6 @@ void System::IncrementInternalFrameNumber()
   s_internal_frame_number++;
 }
 
-void System::RecreateSystem()
-{
-  Error error;
-  Assert(!IsShutdown());
-
-  const bool was_paused = System::IsPaused();
-  std::unique_ptr<ByteStream> stream = ByteStream::CreateGrowableMemoryStream(nullptr, 8 * 1024);
-  if (!System::SaveStateToStream(stream.get(), &error, 0, SAVE_STATE_HEADER::COMPRESSION_TYPE_NONE) ||
-      !stream->SeekAbsolute(0))
-  {
-    Host::ReportErrorAsync(
-      "Error", fmt::format("Failed to save state before system recreation. Shutting down:\n", error.GetDescription()));
-    DestroySystem();
-    return;
-  }
-
-  DestroySystem();
-
-  SystemBootParameters boot_params;
-  if (!BootSystem(std::move(boot_params), &error))
-  {
-    Host::ReportErrorAsync("Error", fmt::format("Failed to boot system after recreation:\n{}", error.GetDescription()));
-    return;
-  }
-
-  if (!LoadStateFromStream(stream.get(), &error, false))
-  {
-    DestroySystem();
-    return;
-  }
-
-  ResetPerformanceCounters();
-  ResetThrottler();
-
-  if (was_paused)
-    PauseSystem(true);
-}
-
 bool System::CreateGPU(GPURenderer renderer, bool is_switching, Error* error)
 {
   const RenderAPI api = Settings::GetRenderAPIForRenderer(renderer);
diff --git a/src/core/system.h b/src/core/system.h
index 695260571..f8ba9e22c 100644
--- a/src/core/system.h
+++ b/src/core/system.h
@@ -280,9 +280,6 @@ bool SaveStateToStream(ByteStream* state, Error* error, u32 screenshot_size = 25
 /// Runs the VM until the CPU execution is canceled.
 void Execute();
 
-/// Switches the GPU renderer by saving state, recreating the display window, and restoring state (if needed).
-void RecreateSystem();
-
 /// Recreates the GPU component, saving/loading the state so it is preserved. Call when the GPU renderer changes.
 bool RecreateGPU(GPURenderer renderer, bool force_recreate_device = false, bool update_display = true);