From e6e2972e3d83e34a78113d00ded79318848ec277 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 23 Nov 2014 16:03:04 +0000 Subject: [PATCH] Make IMemoryDomains inherit IEmulator and simplify some code slightly as a result --- BizHawk.Client.Common/tools/WatchList.cs | 2 +- BizHawk.Client.EmuHawk/MainForm.cs | 2 +- BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs | 4 ++-- BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs | 16 ++++++++-------- BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs | 2 +- .../Interfaces/IMemoryDomains.cs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/BizHawk.Client.Common/tools/WatchList.cs b/BizHawk.Client.Common/tools/WatchList.cs index f9ecd3069b..26eab6b70b 100644 --- a/BizHawk.Client.Common/tools/WatchList.cs +++ b/BizHawk.Client.Common/tools/WatchList.cs @@ -384,7 +384,7 @@ namespace BizHawk.Client.Common var sb = new StringBuilder(); sb .Append("Domain ").AppendLine(_domain.Name) - .Append("SystemID ").AppendLine(Global.Emulator.SystemId); + .Append("SystemID ").AppendLine(_core.SystemId); foreach (var watch in _watchList) { diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index ac18933bd0..6136551715 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -355,7 +355,7 @@ namespace BizHawk.Client.EmuHawk //can't do this unless we are autoloading a rom too... if (Global.Config.RecentWatches.AutoLoad - && Global.Emulator is IMemoryDomains) + && Global.Emulator.HasMemoryDomains()) { GlobalWin.Tools.LoadRamWatch(!Global.Config.DisplayRamWatch); } diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index 78e6abf776..77c344328f 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk ValueHexIndLabel.Text = CompareHexIndLabel.Text = - _cheat.Type == Watch.DisplayType.Hex ? HexInd : String.Empty; + _cheat.Type == Watch.DisplayType.Hex ? HexInd : string.Empty; BigEndianCheckBox.Checked = _cheat.BigEndian.Value; @@ -95,7 +95,7 @@ namespace BizHawk.Client.EmuHawk SetSizeSelected(Watch.WatchSize.Byte); PopulateTypeDropdown(); - NameBox.Text = String.Empty; + NameBox.Text = string.Empty; if (Global.Emulator != null) { diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index daff9a81fd..77b0bd9067 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -199,11 +199,11 @@ namespace BizHawk.Client.EmuHawk { GameGenieToolbarSeparator.Visible = LoadGameGenieToolbarItem.Visible = - (Global.Emulator.SystemId == "NES") - || (Global.Emulator.SystemId == "GEN" && VersionInfo.DeveloperBuild) - || (Global.Emulator.SystemId == "GB") + (Core.SystemId == "NES") + || (Core.SystemId == "GEN" && VersionInfo.DeveloperBuild) + || (Core.SystemId == "GB") || (Global.Game.System == "GG") - || (Global.Emulator is LibsnesCore); + || (Core is LibsnesCore); } private void AddCheat() @@ -540,11 +540,11 @@ namespace BizHawk.Client.EmuHawk GameGenieSeparator.Visible = OpenGameGenieEncoderDecoderMenuItem.Visible = - (Global.Emulator.SystemId == "NES") - || (Global.Emulator is Genesis) - || (Global.Emulator.SystemId == "GB") + (Core.SystemId == "NES") + || (Core is Genesis) + || (Core.SystemId == "GB") || (Global.Game.System == "GG") - || (Global.Emulator is LibsnesCore); + || (Core is LibsnesCore); } private void RemoveCheatMenuItem_Click(object sender, EventArgs e) diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index bba321b3ad..2bc7dd230e 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -580,7 +580,7 @@ namespace BizHawk.Client.EmuHawk private void SetPlatformAndMemoryDomainLabel() { - MemDomainLabel.Text = Global.Emulator.SystemId + " " + _watches.Domain.Name; + MemDomainLabel.Text = _core.SystemId + " " + _watches.Domain.Name; } private void UpdateStatusBar(bool saved = false) diff --git a/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs b/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs index 62f1d0ef92..89e1a80d1a 100644 --- a/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs +++ b/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs @@ -1,6 +1,6 @@ namespace BizHawk.Emulation.Common { - public interface IMemoryDomains + public interface IMemoryDomains : IEmulator { ///The list of all avaialble memory domains /// A memory domain is a byte array that respresents a distinct part of the emulated system.