HostInterface: Move PauseSystem from common to base

This commit is contained in:
Connor McLaughlin 2020-12-17 01:12:56 +10:00
parent e044858953
commit fa0f177e51
4 changed files with 21 additions and 21 deletions

View File

@ -130,6 +130,22 @@ void HostInterface::PowerOffSystem()
DestroySystem(); 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() void HostInterface::DestroySystem()
{ {
if (System::IsShutdown()) if (System::IsShutdown())
@ -399,6 +415,8 @@ bool HostInterface::SaveState(const char* filename)
void HostInterface::OnSystemCreated() {} void HostInterface::OnSystemCreated() {}
void HostInterface::OnSystemPaused(bool paused) {}
void HostInterface::OnSystemDestroyed() {} void HostInterface::OnSystemDestroyed() {}
void HostInterface::OnSystemPerformanceCountersUpdated() {} void HostInterface::OnSystemPerformanceCountersUpdated() {}

View File

@ -53,7 +53,7 @@ public:
virtual bool BootSystem(const SystemBootParameters& parameters); virtual bool BootSystem(const SystemBootParameters& parameters);
virtual void PowerOffSystem(); virtual void PowerOffSystem();
virtual void PauseSystem(bool paused);
virtual void ResetSystem(); virtual void ResetSystem();
virtual void DestroySystem(); virtual void DestroySystem();
@ -147,6 +147,7 @@ protected:
virtual s32 GetAudioOutputVolume() const; virtual s32 GetAudioOutputVolume() const;
virtual void OnSystemCreated(); virtual void OnSystemCreated();
virtual void OnSystemPaused(bool paused);
virtual void OnSystemDestroyed(); virtual void OnSystemDestroyed();
virtual void OnSystemStateSaved(bool global, s32 slot); virtual void OnSystemStateSaved(bool global, s32 slot);
virtual void OnControllerTypeChanged(u32 slot); virtual void OnControllerTypeChanged(u32 slot);

View File

@ -157,23 +157,6 @@ bool CommonHostInterface::BootSystem(const SystemBootParameters& parameters)
return true; 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() void CommonHostInterface::DestroySystem()
{ {
SetTimerResolutionIncreased(false); SetTimerResolutionIncreased(false);
@ -748,7 +731,7 @@ void CommonHostInterface::OnSystemPaused(bool paused)
StopControllerRumble(); StopControllerRumble();
} }
m_audio_stream->PauseOutput(paused); UpdateSpeedLimiterState();
} }
void CommonHostInterface::OnSystemDestroyed() void CommonHostInterface::OnSystemDestroyed()

View File

@ -96,8 +96,6 @@ public:
/// Returns true if running in batch mode, i.e. exit after emulation. /// Returns true if running in batch mode, i.e. exit after emulation.
ALWAYS_INLINE bool InBatchMode() const { return m_batch_mode; } ALWAYS_INLINE bool InBatchMode() const { return m_batch_mode; }
void PauseSystem(bool paused);
/// Parses command line parameters for all frontends. /// Parses command line parameters for all frontends.
bool ParseCommandLineParameters(int argc, char* argv[], std::unique_ptr<SystemBootParameters>* out_boot_params); bool ParseCommandLineParameters(int argc, char* argv[], std::unique_ptr<SystemBootParameters>* out_boot_params);