mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-10 18:05:47 -04:00
HostInterface: Move setting update logic to base class
This commit is contained in:
@ -442,6 +442,8 @@ void HostInterface::UpdateSpeedLimiterState()
|
||||
m_last_throttle_time = 0;
|
||||
}
|
||||
|
||||
void HostInterface::SwitchGPURenderer() {}
|
||||
|
||||
void HostInterface::OnPerformanceCountersUpdated() {}
|
||||
|
||||
void HostInterface::OnRunningGameChanged() {}
|
||||
@ -511,6 +513,42 @@ std::string HostInterface::GetGameListDatabaseFileName() const
|
||||
return GetUserDirectoryRelativePath("cache/redump.dat");
|
||||
}
|
||||
|
||||
void HostInterface::UpdateSettings(const std::function<void()>& apply_callback)
|
||||
{
|
||||
// TODO: Should we move this to the base class?
|
||||
const GPURenderer old_gpu_renderer = m_settings.gpu_renderer;
|
||||
const u32 old_gpu_resolution_scale = m_settings.gpu_resolution_scale;
|
||||
const bool old_gpu_true_color = m_settings.gpu_true_color;
|
||||
const bool old_gpu_texture_filtering = m_settings.gpu_texture_filtering;
|
||||
const bool old_gpu_force_progressive_scan = m_settings.gpu_force_progressive_scan;
|
||||
const bool old_vsync_enabled = m_settings.video_sync_enabled;
|
||||
const bool old_audio_sync_enabled = m_settings.audio_sync_enabled;
|
||||
const bool old_speed_limiter_enabled = m_settings.speed_limiter_enabled;
|
||||
const bool old_display_linear_filtering = m_settings.display_linear_filtering;
|
||||
|
||||
apply_callback();
|
||||
|
||||
// TODO: Fast path for hardware->software switches
|
||||
if (m_settings.gpu_renderer != old_gpu_renderer)
|
||||
SwitchGPURenderer();
|
||||
|
||||
if (m_settings.video_sync_enabled != old_vsync_enabled || m_settings.audio_sync_enabled != old_audio_sync_enabled ||
|
||||
m_settings.speed_limiter_enabled != old_speed_limiter_enabled)
|
||||
{
|
||||
UpdateSpeedLimiterState();
|
||||
}
|
||||
|
||||
if (m_settings.gpu_resolution_scale != old_gpu_resolution_scale || m_settings.gpu_true_color != old_gpu_true_color ||
|
||||
m_settings.gpu_texture_filtering != old_gpu_texture_filtering ||
|
||||
m_settings.gpu_force_progressive_scan != old_gpu_force_progressive_scan)
|
||||
{
|
||||
m_system->UpdateGPUSettings();
|
||||
}
|
||||
|
||||
if (m_settings.display_linear_filtering != old_display_linear_filtering)
|
||||
m_display->SetDisplayLinearFiltering(m_settings.display_linear_filtering);
|
||||
}
|
||||
|
||||
void HostInterface::RunFrame()
|
||||
{
|
||||
m_frame_timer.Reset();
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "types.h"
|
||||
#include <chrono>
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
@ -85,6 +86,7 @@ protected:
|
||||
float duration;
|
||||
};
|
||||
|
||||
virtual void SwitchGPURenderer();
|
||||
virtual void OnPerformanceCountersUpdated();
|
||||
virtual void OnRunningGameChanged();
|
||||
|
||||
@ -102,6 +104,8 @@ protected:
|
||||
/// Returns the path of the game database cache file.
|
||||
std::string GetGameListDatabaseFileName() const;
|
||||
|
||||
void UpdateSettings(const std::function<void()>& apply_callback);
|
||||
|
||||
void RunFrame();
|
||||
|
||||
/// Throttles the system, i.e. sleeps until it's time to execute the next frame.
|
||||
|
Reference in New Issue
Block a user