Skip to content

Commit

Permalink
System: Purge unused RecreateSystem()
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jul 14, 2024
1 parent 154a5b3 commit fee8887
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
38 changes: 0 additions & 38 deletions src/core/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/core/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fee8887

Please sign in to comment.