From 8fd3a83ea835c101b677ef9b82acb0743334cbb1 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 17 May 2020 14:12:23 +1000 Subject: [PATCH] Settings: Save DMA timing hacks to ini --- src/core/settings.cpp | 13 +++++++++---- src/core/settings.h | 8 ++++++++ src/duckstation-sdl/sdl_host_interface.cpp | 11 +++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 6dd646c35..1df322756 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -58,10 +58,10 @@ void Settings::Load(SettingsInterface& si) audio_sync_enabled = si.GetBoolValue("Audio", "Sync", true); audio_dump_on_boot = si.GetBoolValue("Audio", "DumpOnBoot", false); - dma_max_slice_ticks = si.GetIntValue("Hacks", "DMAMaxSliceTicks", 1000); - dma_halt_ticks = si.GetIntValue("Hacks", "DMAHaltTicks", 100); - gpu_fifo_size = static_cast(si.GetIntValue("Hacks", "GPUFIFOSize", 128)); - gpu_max_run_ahead = si.GetIntValue("Hacks", "GPUMaxRunAhead", 128); + dma_max_slice_ticks = si.GetIntValue("Hacks", "DMAMaxSliceTicks", DEFAULT_DMA_MAX_SLICE_TICKS); + dma_halt_ticks = si.GetIntValue("Hacks", "DMAHaltTicks", DEFAULT_DMA_HALT_TICKS); + gpu_fifo_size = static_cast(si.GetIntValue("Hacks", "GPUFIFOSize", DEFAULT_GPU_FIFO_SIZE)); + gpu_max_run_ahead = si.GetIntValue("Hacks", "GPUMaxRunAhead", DEFAULT_GPU_MAX_RUN_AHEAD); bios_path = si.GetStringValue("BIOS", "Path", "bios/scph1001.bin"); bios_patch_tty_enable = si.GetBoolValue("BIOS", "PatchTTYEnable", true); @@ -147,6 +147,11 @@ void Settings::Save(SettingsInterface& si) const si.SetBoolValue("Audio", "Sync", audio_sync_enabled); si.SetBoolValue("Audio", "DumpOnBoot", audio_dump_on_boot); + si.SetIntValue("Hacks", "DMAMaxSliceTicks", dma_max_slice_ticks); + si.SetIntValue("Hacks", "DMAHaltTicks", dma_halt_ticks); + si.SetIntValue("Hacks", "GPUFIFOSize", gpu_fifo_size); + si.SetIntValue("Hacks", "GPUMaxRunAhead", gpu_max_run_ahead); + si.SetStringValue("BIOS", "Path", bios_path.c_str()); si.SetBoolValue("BIOS", "PatchTTYEnable", bios_patch_tty_enable); si.SetBoolValue("BIOS", "PatchFastBoot", bios_patch_fast_boot); diff --git a/src/core/settings.h b/src/core/settings.h index e0196042b..78f9ea5df 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -117,6 +117,14 @@ struct Settings return (memory_card_types[0] == MemoryCardType::PerGame || memory_card_types[1] == MemoryCardType::PerGame); } + enum : u32 + { + DEFAULT_DMA_MAX_SLICE_TICKS = 1000, + DEFAULT_DMA_HALT_TICKS = 100, + DEFAULT_GPU_FIFO_SIZE = 128, + DEFAULT_GPU_MAX_RUN_AHEAD = 128 + }; + void Load(SettingsInterface& si); void Save(SettingsInterface& si) const; diff --git a/src/duckstation-sdl/sdl_host_interface.cpp b/src/duckstation-sdl/sdl_host_interface.cpp index 4dbca0678..a02647667 100644 --- a/src/duckstation-sdl/sdl_host_interface.cpp +++ b/src/duckstation-sdl/sdl_host_interface.cpp @@ -1260,6 +1260,17 @@ void SDLHostInterface::DrawSettingsWindow() m_settings_copy.gpu_max_run_ahead = gpu_max_run_ahead; settings_changed = true; } + + if (ImGui::Button("Reset")) + { + m_settings_copy.dma_max_slice_ticks = static_cast(Settings::DEFAULT_DMA_MAX_SLICE_TICKS); + m_settings_copy.dma_halt_ticks = static_cast(Settings::DEFAULT_DMA_HALT_TICKS); + m_settings_copy.gpu_fifo_size = Settings::DEFAULT_GPU_FIFO_SIZE; + m_settings_copy.gpu_max_run_ahead = static_cast(Settings::DEFAULT_GPU_MAX_RUN_AHEAD); + settings_changed = true; + } + + ImGui::EndTabItem(); } ImGui::EndTabBar();