mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-29 09:05:41 +00:00
System: Purge unused RecreateSystem()
This commit is contained in:
parent
154a5b35b8
commit
fee888758f
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue