From 1693a2a1edd90c9340a3af60ae78aa33e51a56e0 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 13 Sep 2014 14:21:08 +0000 Subject: [PATCH] Cheats dialog - default to System Bus domain --- BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs | 10 +++++++++- BizHawk.Emulation.Common/MemoryDomain.cs | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index 0d1e2b8c84..78e6abf776 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -37,7 +37,15 @@ namespace BizHawk.Client.EmuHawk DomainDropDown.Items.AddRange(Core.MemoryDomains .Select(d => d.ToString()) .ToArray()); - DomainDropDown.SelectedItem = Core.MemoryDomains.MainMemory.ToString(); + + if (Core.MemoryDomains.HasSystemBus) + { + DomainDropDown.SelectedItem = Core.MemoryDomains.SystemBus.ToString(); + } + else + { + DomainDropDown.SelectedItem = Core.MemoryDomains.MainMemory.ToString(); + } } SetFormToDefault(); diff --git a/BizHawk.Emulation.Common/MemoryDomain.cs b/BizHawk.Emulation.Common/MemoryDomain.cs index ffb978a23d..387933306a 100644 --- a/BizHawk.Emulation.Common/MemoryDomain.cs +++ b/BizHawk.Emulation.Common/MemoryDomain.cs @@ -214,5 +214,21 @@ namespace BizHawk.Emulation.Common return this[_mainMemoryIndex]; } } + + public bool HasSystemBus + { + get + { + return this.Any(x => x.Name == "System Bus" || x.Name == "BUS"); // Have to account for "BUS" because some developers don't like consistency! + } + } + + public MemoryDomain SystemBus + { + get + { + return this.FirstOrDefault(x => x.Name == "System Bus" || x.Name == "BUS"); + } + } } }