diff --git a/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs b/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs index f8093331eb..78288e59ea 100644 --- a/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs +++ b/src/BizHawk.Client.Common/tools/RamSearchEngine/RamSearchEngine.cs @@ -21,7 +21,7 @@ namespace BizHawk.Client.Common.RamSearchEngine public RamSearchEngine(SearchEngineSettings settings, IMemoryDomains memoryDomains) { - _settings = new SearchEngineSettings(memoryDomains) + _settings = new SearchEngineSettings(memoryDomains, settings.UseUndoHistory) { Mode = settings.Mode, Domain = settings.Domain, @@ -29,7 +29,7 @@ namespace BizHawk.Client.Common.RamSearchEngine CheckMisAligned = settings.CheckMisAligned, Type = settings.Type, BigEndian = settings.BigEndian, - PreviousType = settings.PreviousType + PreviousType = settings.PreviousType, }; } @@ -316,7 +316,11 @@ namespace BizHawk.Client.Common.RamSearchEngine } } - public bool UndoEnabled { get; set; } + public bool UndoEnabled + { + get => _settings.UseUndoHistory; + set => _settings.UseUndoHistory = value; + } public bool CanUndo => UndoEnabled && _history.CanUndo; diff --git a/src/BizHawk.Client.Common/tools/RamSearchEngine/SearchEngineSettings.cs b/src/BizHawk.Client.Common/tools/RamSearchEngine/SearchEngineSettings.cs index 2771941be1..9c5b559c2a 100644 --- a/src/BizHawk.Client.Common/tools/RamSearchEngine/SearchEngineSettings.cs +++ b/src/BizHawk.Client.Common/tools/RamSearchEngine/SearchEngineSettings.cs @@ -4,7 +4,7 @@ namespace BizHawk.Client.Common.RamSearchEngine { public class SearchEngineSettings { - public SearchEngineSettings(IMemoryDomains memoryDomains) + public SearchEngineSettings(IMemoryDomains memoryDomains, bool useUndoHistory) { BigEndian = memoryDomains.MainMemory.EndianType == MemoryDomain.Endian.Big; Size = (WatchSize)memoryDomains.MainMemory.WordSize; @@ -16,6 +16,7 @@ namespace BizHawk.Client.Common.RamSearchEngine Domain = memoryDomains.MainMemory; CheckMisAligned = false; PreviousType = PreviousType.LastSearch; + UseUndoHistory = useUndoHistory; } /*Require restart*/ @@ -28,6 +29,7 @@ namespace BizHawk.Client.Common.RamSearchEngine public DisplayType Type { get; set; } public bool BigEndian { get; set; } public PreviousType PreviousType { get; set; } + public bool UseUndoHistory { get; set; } } public static class SearchEngineSettingsExtensions diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs index cc74961de3..56ef111337 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs @@ -144,7 +144,7 @@ namespace BizHawk.Client.EmuHawk RamSearchMenu.Items.Add(WatchListView.ToColumnsMenu(ColumnToggleCallback)); - _settings = new SearchEngineSettings(MemoryDomains); + _settings = new SearchEngineSettings(MemoryDomains, Settings.UseUndoHistory); _searches = new RamSearchEngine(_settings, MemoryDomains); ErrorIconButton.Visible = false; @@ -308,7 +308,7 @@ namespace BizHawk.Client.EmuHawk public override void Restart() { - _settings = new SearchEngineSettings(MemoryDomains); + _settings = new SearchEngineSettings(MemoryDomains, Settings.UseUndoHistory); _searches = new RamSearchEngine(_settings, MemoryDomains); MessageLabel.Text = "Search restarted"; DoDomainSizeCheck(); @@ -944,12 +944,14 @@ namespace BizHawk.Client.EmuHawk PreviewMode = true; RecentSearches = new RecentFiles(8); AutoSearchTakeLagFramesIntoAccount = true; + } public List Columns { get; set; } public bool PreviewMode { get; set; } public bool AlwaysExcludeRamWatch { get; set; } public bool AutoSearchTakeLagFramesIntoAccount { get; set; } + public bool UseUndoHistory { get; set; } = true; public RecentFiles RecentSearches { get; set; } } @@ -1270,7 +1272,7 @@ namespace BizHawk.Client.EmuHawk private void SettingsSubMenu_DropDownOpened(object sender, EventArgs e) { ExcludeRamWatchMenuItem.Checked = Settings.AlwaysExcludeRamWatch; - UseUndoHistoryMenuItem.Checked = _searches.UndoEnabled; + UseUndoHistoryMenuItem.Checked = Settings.UseUndoHistory; PreviewModeMenuItem.Checked = Settings.PreviewMode; AutoSearchMenuItem.Checked = _autoSearch; AutoSearchAccountForLagMenuItem.Checked = Settings.AutoSearchTakeLagFramesIntoAccount; @@ -1307,6 +1309,7 @@ namespace BizHawk.Client.EmuHawk private void UseUndoHistoryMenuItem_Click(object sender, EventArgs e) { _searches.UndoEnabled ^= true; + Settings.UseUndoHistory = _searches.UndoEnabled; } [RestoreDefaults] @@ -1323,7 +1326,7 @@ namespace BizHawk.Client.EmuHawk RamSearchMenu.Items.Add(WatchListView.ToColumnsMenu(ColumnToggleCallback)); - _settings = new SearchEngineSettings(MemoryDomains); + _settings = new SearchEngineSettings(MemoryDomains, Settings.UseUndoHistory); if (_settings.IsFastMode()) { SetToFastMode();