From fa0f177e51e027f3f944c04a5b78bfc3002d6898 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 17 Dec 2020 01:12:56 +1000 Subject: [PATCH] HostInterface: Move PauseSystem from common to base --- src/core/host_interface.cpp | 18 ++++++++++++++++++ src/core/host_interface.h | 3 ++- src/frontend-common/common_host_interface.cpp | 19 +------------------ src/frontend-common/common_host_interface.h | 2 -- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/core/host_interface.cpp b/src/core/host_interface.cpp index a3a1f7dc2..54d246855 100644 --- a/src/core/host_interface.cpp +++ b/src/core/host_interface.cpp @@ -130,6 +130,22 @@ void HostInterface::PowerOffSystem() DestroySystem(); } +void HostInterface::PauseSystem(bool paused) +{ + if (paused == System::IsPaused() || System::IsShutdown()) + return; + + System::SetState(paused ? System::State::Paused : System::State::Running); + if (!paused) + m_audio_stream->EmptyBuffers(); + m_audio_stream->PauseOutput(paused); + + OnSystemPaused(paused); + + if (!paused) + System::ResetPerformanceCounters(); +} + void HostInterface::DestroySystem() { if (System::IsShutdown()) @@ -399,6 +415,8 @@ bool HostInterface::SaveState(const char* filename) void HostInterface::OnSystemCreated() {} +void HostInterface::OnSystemPaused(bool paused) {} + void HostInterface::OnSystemDestroyed() {} void HostInterface::OnSystemPerformanceCountersUpdated() {} diff --git a/src/core/host_interface.h b/src/core/host_interface.h index 3233041ea..f4b24ced6 100644 --- a/src/core/host_interface.h +++ b/src/core/host_interface.h @@ -53,7 +53,7 @@ public: virtual bool BootSystem(const SystemBootParameters& parameters); virtual void PowerOffSystem(); - + virtual void PauseSystem(bool paused); virtual void ResetSystem(); virtual void DestroySystem(); @@ -147,6 +147,7 @@ protected: virtual s32 GetAudioOutputVolume() const; virtual void OnSystemCreated(); + virtual void OnSystemPaused(bool paused); virtual void OnSystemDestroyed(); virtual void OnSystemStateSaved(bool global, s32 slot); virtual void OnControllerTypeChanged(u32 slot); diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index 49703aacd..61473e574 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -157,23 +157,6 @@ bool CommonHostInterface::BootSystem(const SystemBootParameters& parameters) return true; } -void CommonHostInterface::PauseSystem(bool paused) -{ - if (paused == System::IsPaused() || System::IsShutdown()) - return; - - System::SetState(paused ? System::State::Paused : System::State::Running); - if (!paused) - m_audio_stream->EmptyBuffers(); - m_audio_stream->PauseOutput(paused); - - OnSystemPaused(paused); - UpdateSpeedLimiterState(); - - if (!paused) - System::ResetPerformanceCounters(); -} - void CommonHostInterface::DestroySystem() { SetTimerResolutionIncreased(false); @@ -748,7 +731,7 @@ void CommonHostInterface::OnSystemPaused(bool paused) StopControllerRumble(); } - m_audio_stream->PauseOutput(paused); + UpdateSpeedLimiterState(); } void CommonHostInterface::OnSystemDestroyed() diff --git a/src/frontend-common/common_host_interface.h b/src/frontend-common/common_host_interface.h index f95461da5..d520487d8 100644 --- a/src/frontend-common/common_host_interface.h +++ b/src/frontend-common/common_host_interface.h @@ -96,8 +96,6 @@ public: /// Returns true if running in batch mode, i.e. exit after emulation. ALWAYS_INLINE bool InBatchMode() const { return m_batch_mode; } - void PauseSystem(bool paused); - /// Parses command line parameters for all frontends. bool ParseCommandLineParameters(int argc, char* argv[], std::unique_ptr* out_boot_params);