Settings: Add audio sync and additional cleanup
This commit is contained in:
parent
3673c6e33c
commit
8fb4f73d17
|
@ -206,11 +206,11 @@ void HostInterface::UpdateSpeedLimiterState()
|
|||
{
|
||||
m_speed_limiter_enabled = m_settings.speed_limiter_enabled && !m_speed_limiter_temp_disabled;
|
||||
|
||||
const bool audio_sync_enabled = !m_system || m_paused || m_speed_limiter_enabled;
|
||||
const bool vsync_enabled = !m_system || m_paused || (m_speed_limiter_enabled && m_settings.gpu_vsync);
|
||||
const bool audio_sync_enabled = !m_system || m_paused || (m_speed_limiter_enabled && m_settings.audio_sync_enabled);
|
||||
const bool video_sync_enabled = !m_system || m_paused || (m_speed_limiter_enabled && m_settings.video_sync_enabled);
|
||||
Log_InfoPrintf("Syncing to %s%s", audio_sync_enabled ? "audio" : "",
|
||||
(m_speed_limiter_enabled && vsync_enabled) ? " and video" : "");
|
||||
(audio_sync_enabled && video_sync_enabled) ? " and video" : (video_sync_enabled ? "video" : ""));
|
||||
|
||||
m_audio_stream->SetSync(audio_sync_enabled);
|
||||
m_display->SetVSync(vsync_enabled);
|
||||
m_display->SetVSync(video_sync_enabled);
|
||||
}
|
||||
|
|
|
@ -13,9 +13,15 @@ Settings::Settings() = default;
|
|||
|
||||
void Settings::SetDefaults()
|
||||
{
|
||||
region = ConsoleRegion::Auto;
|
||||
|
||||
audio_sync_enabled = true;
|
||||
video_sync_enabled = true;
|
||||
speed_limiter_enabled = true;
|
||||
start_paused = false;
|
||||
|
||||
gpu_renderer = GPURenderer::HardwareOpenGL;
|
||||
gpu_resolution_scale = 1;
|
||||
gpu_vsync = true;
|
||||
gpu_true_color = true;
|
||||
|
||||
display_linear_filtering = true;
|
||||
|
@ -39,9 +45,13 @@ void Settings::Load(const char* filename)
|
|||
|
||||
region = ParseConsoleRegionName(ini.GetValue("Console", "Region", "NTSC-U")).value_or(ConsoleRegion::NTSC_U);
|
||||
|
||||
audio_sync_enabled = ini.GetBoolValue("General", "SyncToAudio", true);
|
||||
video_sync_enabled = ini.GetBoolValue("General", "SyncToVideo", true);
|
||||
speed_limiter_enabled = ini.GetBoolValue("General", "SpeedLimiterEnabled", true);
|
||||
start_paused = ini.GetBoolValue("General", "StartPaused", false);
|
||||
|
||||
gpu_renderer = ParseRendererName(ini.GetValue("GPU", "Renderer", "OpenGL")).value_or(GPURenderer::HardwareOpenGL);
|
||||
gpu_resolution_scale = static_cast<u32>(ini.GetLongValue("GPU", "ResolutionScale", 1));
|
||||
gpu_vsync = static_cast<u32>(ini.GetBoolValue("GPU", "VSync", true));
|
||||
gpu_true_color = ini.GetBoolValue("GPU", "TrueColor", false);
|
||||
|
||||
display_linear_filtering = ini.GetBoolValue("Display", "LinearFiltering", true);
|
||||
|
@ -64,9 +74,14 @@ bool Settings::Save(const char* filename) const
|
|||
|
||||
ini.SetValue("Console", "Region", GetConsoleRegionName(region));
|
||||
|
||||
ini.SetBoolValue("General", "SyncToAudio", audio_sync_enabled);
|
||||
ini.SetBoolValue("General", "SyncToVideo", video_sync_enabled);
|
||||
ini.SetBoolValue("General", "SpeedLimiterEnabled", speed_limiter_enabled);
|
||||
ini.SetBoolValue("General", "StartPaused", start_paused);
|
||||
|
||||
ini.SetValue("GPU", "Renderer", GetRendererName(gpu_renderer));
|
||||
ini.SetLongValue("GPU", "ResolutionScale", static_cast<long>(gpu_resolution_scale));
|
||||
ini.SetBoolValue("GPU", "VSync", gpu_vsync);
|
||||
ini.SetBoolValue("GPU", "VSync", video_sync_enabled);
|
||||
ini.SetBoolValue("GPU", "TrueColor", gpu_true_color);
|
||||
|
||||
ini.SetBoolValue("Display", "LinearFiltering", display_linear_filtering);
|
||||
|
|
|
@ -6,15 +6,16 @@ struct Settings
|
|||
{
|
||||
Settings();
|
||||
|
||||
ConsoleRegion region = ConsoleRegion::NTSC_U;
|
||||
ConsoleRegion region = ConsoleRegion::Auto;
|
||||
|
||||
bool start_paused = false;
|
||||
bool speed_limiter_enabled = true;
|
||||
bool audio_sync_enabled = true;
|
||||
bool video_sync_enabled = true;
|
||||
|
||||
GPURenderer gpu_renderer = GPURenderer::Software;
|
||||
u32 gpu_resolution_scale = 1;
|
||||
mutable u32 max_gpu_resolution_scale = 1;
|
||||
bool gpu_vsync = true;
|
||||
bool gpu_true_color = false;
|
||||
bool display_linear_filtering = true;
|
||||
bool display_fullscreen = false;
|
||||
|
|
|
@ -743,9 +743,12 @@ void SDLHostInterface::DrawQuickSettingsMenu()
|
|||
}
|
||||
|
||||
if (ImGui::MenuItem("Fullscreen", nullptr, &m_settings.display_fullscreen))
|
||||
{
|
||||
settings_changed = true;
|
||||
UpdateFullscreen();
|
||||
}
|
||||
|
||||
if (ImGui::MenuItem("VSync", nullptr, &m_settings.gpu_vsync))
|
||||
if (ImGui::MenuItem("VSync", nullptr, &m_settings.video_sync_enabled))
|
||||
{
|
||||
settings_changed = true;
|
||||
UpdateSpeedLimiterState();
|
||||
|
@ -914,13 +917,6 @@ void SDLHostInterface::DrawSettingsWindow()
|
|||
|
||||
if (ImGui::BeginTabItem("General"))
|
||||
{
|
||||
if (DrawSettingsSectionHeader("Behavior"))
|
||||
{
|
||||
settings_changed |= ImGui::Checkbox("Enable Speed Limiter", &m_settings.speed_limiter_enabled);
|
||||
settings_changed |= ImGui::Checkbox("Pause On Start", &m_settings.start_paused);
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
if (DrawSettingsSectionHeader("Console"))
|
||||
{
|
||||
ImGui::Text("Region:");
|
||||
|
@ -940,6 +936,33 @@ void SDLHostInterface::DrawSettingsWindow()
|
|||
}
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
if (DrawSettingsSectionHeader("Behavior"))
|
||||
{
|
||||
if (ImGui::Checkbox("Enable Speed Limiter", &m_settings.speed_limiter_enabled))
|
||||
{
|
||||
settings_changed = true;
|
||||
UpdateSpeedLimiterState();
|
||||
}
|
||||
|
||||
settings_changed |= ImGui::Checkbox("Pause On Start", &m_settings.start_paused);
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
if (DrawSettingsSectionHeader("Host Synchronization"))
|
||||
{
|
||||
if (ImGui::Checkbox("Sync To Audio", &m_settings.audio_sync_enabled))
|
||||
{
|
||||
settings_changed = true;
|
||||
UpdateSpeedLimiterState();
|
||||
}
|
||||
if (ImGui::Checkbox("Sync To Video", &m_settings.video_sync_enabled))
|
||||
{
|
||||
settings_changed = true;
|
||||
UpdateSpeedLimiterState();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::NewLine();
|
||||
if (DrawSettingsSectionHeader("BIOS"))
|
||||
{
|
||||
|
@ -1017,11 +1040,6 @@ void SDLHostInterface::DrawSettingsWindow()
|
|||
if (ImGui::Checkbox("Fullscreen", &m_settings.display_fullscreen))
|
||||
UpdateFullscreen();
|
||||
|
||||
if (ImGui::Checkbox("VSync", &m_settings.gpu_vsync))
|
||||
{
|
||||
UpdateSpeedLimiterState();
|
||||
settings_changed = true;
|
||||
}
|
||||
if (ImGui::Checkbox("Linear Filtering", &m_settings.display_linear_filtering))
|
||||
{
|
||||
m_display->SetDisplayLinearFiltering(m_settings.display_linear_filtering);
|
||||
|
|
Loading…
Reference in New Issue