diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.MainMemory.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.MainMemory.cs index 3e8f3cef3b..b69f4f1a06 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.MainMemory.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.MainMemory.cs @@ -24,7 +24,7 @@ namespace BizHawk.Client.Common { if (MemoryDomainCore != null) { - return MemoryDomainCore.MemoryDomains.MainMemory; + return MemoryDomainCore.MainMemory; } else { diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs index f4a0511159..94bdc671b1 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs @@ -19,8 +19,7 @@ namespace BizHawk.Client.Common { if (MemoryDomainCore != null) { - var domains = MemoryDomainCore.MemoryDomains; - _currentMemoryDomain = domains.MainMemory; + _currentMemoryDomain = MemoryDomainCore.MainMemory; } } @@ -29,8 +28,7 @@ namespace BizHawk.Client.Common { if (MemoryDomainCore != null) { - var domains = MemoryDomainCore.MemoryDomains; - _currentMemoryDomain = domains.MainMemory; + _currentMemoryDomain = MemoryDomainCore.MainMemory; } } diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs index 4d35627fc7..19b228fd4b 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs @@ -42,7 +42,7 @@ namespace BizHawk.Client.Common { var decoder = new NESGameGenieDecoder(code); var watch = Watch.GenerateWatch( - Global.Emulator.AsMemoryDomains().MemoryDomains["System Bus"], + Global.Emulator.AsMemoryDomains()["System Bus"], decoder.Address, Watch.WatchSize.Byte, Watch.DisplayType.Hex, diff --git a/BizHawk.Client.Common/lua/LuaMemoryBase.cs b/BizHawk.Client.Common/lua/LuaMemoryBase.cs index 045bfb233e..e785332949 100644 --- a/BizHawk.Client.Common/lua/LuaMemoryBase.cs +++ b/BizHawk.Client.Common/lua/LuaMemoryBase.cs @@ -24,13 +24,13 @@ namespace BizHawk.Client.Common protected abstract MemoryDomain Domain { get; } - protected IMemoryDomainList DomainList + protected IMemoryDomains DomainList { get { if (MemoryDomainCore != null) { - return MemoryDomainCore.MemoryDomains; + return MemoryDomainCore; } else { diff --git a/BizHawk.Client.Common/tools/CheatList.cs b/BizHawk.Client.Common/tools/CheatList.cs index ac05627548..1d2e1ca92f 100644 --- a/BizHawk.Client.Common/tools/CheatList.cs +++ b/BizHawk.Client.Common/tools/CheatList.cs @@ -457,7 +457,7 @@ namespace BizHawk.Client.Common compare = int.Parse(vals[2], NumberStyles.HexNumber); } - var domain = Global.Emulator.AsMemoryDomains().MemoryDomains[vals[3]]; + var domain = Global.Emulator.AsMemoryDomains()[vals[3]]; var enabled = vals[4] == "1"; var name = vals[5]; diff --git a/BizHawk.Client.Common/tools/RamSearchEngine.cs b/BizHawk.Client.Common/tools/RamSearchEngine.cs index 1c2c90ac13..cc34b39ca5 100644 --- a/BizHawk.Client.Common/tools/RamSearchEngine.cs +++ b/BizHawk.Client.Common/tools/RamSearchEngine.cs @@ -1174,17 +1174,17 @@ namespace BizHawk.Client.Common public class Settings { - public Settings(IMemoryDomains core) + public Settings(IMemoryDomains memoryDomains) { - BigEndian = core.MemoryDomains.MainMemory.EndianType == MemoryDomain.Endian.Big; + BigEndian = memoryDomains.MainMemory.EndianType == MemoryDomain.Endian.Big; // TODO: Fetch this default from the IMemoryDomains object when that's implemented. Size = (Watch.WatchSize)Global.SystemInfo.ByteSize; Type = Watch.DisplayType.Unsigned; - Mode = core.MemoryDomains.MainMemory.Size > (1024 * 1024) ? + Mode = memoryDomains.MainMemory.Size > (1024 * 1024) ? SearchMode.Fast : SearchMode.Detailed; - Domain = core.MemoryDomains.MainMemory; + Domain = memoryDomains.MainMemory; CheckMisAligned = false; PreviousType = Watch.PreviousType.LastSearch; } diff --git a/BizHawk.Client.Common/tools/WatchList.cs b/BizHawk.Client.Common/tools/WatchList.cs index 325440d41f..6b4ed96b63 100644 --- a/BizHawk.Client.Common/tools/WatchList.cs +++ b/BizHawk.Client.Common/tools/WatchList.cs @@ -12,7 +12,7 @@ namespace BizHawk.Client.Common { public class WatchList : IList { - private IMemoryDomains _core; + private IMemoryDomains _memoryDomains; private List _watchList = new List(); private MemoryDomain _domain; private string _currentFilename = string.Empty; @@ -28,21 +28,21 @@ namespace BizHawk.Client.Common public WatchList(IMemoryDomains core, MemoryDomain domain, string systemid) { - _core = core; + _memoryDomains = core; _domain = domain; _systemid = systemid; } public void RefreshDomans(IMemoryDomains core, MemoryDomain domain) { - _core = core; + _memoryDomains = core; _domain = domain; _watchList.ForEach(w => { if (w.Domain != null) { - w.Domain = _core.MemoryDomains[w.Domain.Name]; + w.Domain = _memoryDomains[w.Domain.Name]; } }); } @@ -489,7 +489,7 @@ namespace BizHawk.Client.Common // Temporary, rename if kept int addr; - var memDomain = _core.MemoryDomains.MainMemory; + var memDomain = _memoryDomains.MainMemory; var temp = line.Substring(0, line.IndexOf('\t')); try @@ -527,7 +527,7 @@ namespace BizHawk.Client.Common startIndex = line.IndexOf('\t') + 1; line = line.Substring(startIndex, line.Length - startIndex); // Domain temp = line.Substring(0, line.IndexOf('\t')); - memDomain = _core.MemoryDomains[temp] ?? _core.MemoryDomains.MainMemory; + memDomain = _memoryDomains[temp] ?? _memoryDomains.MainMemory; } startIndex = line.IndexOf('\t') + 1; @@ -541,10 +541,10 @@ namespace BizHawk.Client.Common type, notes, bigEndian)); - _domain = _core.MemoryDomains[domain]; + _domain = _memoryDomains[domain]; } - Domain = _core.MemoryDomains[domain] ?? _core.MemoryDomains.MainMemory; + Domain = _memoryDomains[domain] ?? _memoryDomains.MainMemory; _currentFilename = path; } diff --git a/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs b/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs index 028fa010b6..c78c2448bc 100644 --- a/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs +++ b/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs @@ -218,7 +218,7 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions Global.CheatList.RemoveRange(watches.Where(watch => !watch.IsSeparator)); } - public static IEnumerable MenuItems(this IMemoryDomainList domains, Action setCallback, string selected = "", int? maxSize = null) + public static IEnumerable MenuItems(this IMemoryDomains domains, Action setCallback, string selected = "", int? maxSize = null) { foreach (var domain in domains) { diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index bc088a0429..415ff9b45a 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -9,7 +9,7 @@ namespace BizHawk.Client.EmuHawk { public partial class CheatEdit : UserControl { - public IMemoryDomains Core { get; set; } + public IMemoryDomains MemoryDomains { get; set; } public CheatEdit() { @@ -31,20 +31,20 @@ namespace BizHawk.Client.EmuHawk private void CheatEdit_Load(object sender, EventArgs e) { - if (Core != null) // the designer needs this check + if (MemoryDomains != null) // the designer needs this check { DomainDropDown.Items.Clear(); - DomainDropDown.Items.AddRange(Core.MemoryDomains + DomainDropDown.Items.AddRange(MemoryDomains .Select(d => d.ToString()) .ToArray()); - if (Core.MemoryDomains.HasCheatDomain) + if (MemoryDomains.HasCheatDomain) { - DomainDropDown.SelectedItem = Core.MemoryDomains.CheatDomain.ToString(); + DomainDropDown.SelectedItem = MemoryDomains.CheatDomain.ToString(); } else { - DomainDropDown.SelectedItem = Core.MemoryDomains.MainMemory.ToString(); + DomainDropDown.SelectedItem = MemoryDomains.MainMemory.ToString(); } } @@ -97,9 +97,9 @@ namespace BizHawk.Client.EmuHawk NameBox.Text = string.Empty; - if (Core != null) + if (MemoryDomains != null) { - AddressBox.SetHexProperties(Core.MemoryDomains.CheatDomain.Size); + AddressBox.SetHexProperties(MemoryDomains.CheatDomain.Size); } ValueBox.ByteSize = @@ -210,7 +210,7 @@ namespace BizHawk.Client.EmuHawk { if (!_loading) { - var domain = Core.MemoryDomains[DomainDropDown.SelectedItem.ToString()]; + var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; AddressBox.SetHexProperties(domain.Size); } } @@ -286,13 +286,13 @@ namespace BizHawk.Client.EmuHawk { get { - var domain = Core.MemoryDomains[DomainDropDown.SelectedItem.ToString()]; + var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; var address = AddressBox.ToRawInt().Value; //var address = AddressBox.ToRawInt() ?? 0; if (address < domain.Size) { var watch = Watch.GenerateWatch( - Core.MemoryDomains[DomainDropDown.SelectedItem.ToString()], + MemoryDomains[DomainDropDown.SelectedItem.ToString()], AddressBox.ToRawInt().Value, GetCurrentSize(), Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()), diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs index 7dbcd81993..08a285d1e3 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs @@ -648,7 +648,7 @@ this.CheatEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.CheatEditor.Core = null; + this.CheatEditor.MemoryDomains = null; this.CheatEditor.Location = new System.Drawing.Point(6, 14); this.CheatEditor.Name = "CheatEditor"; this.CheatEditor.Size = new System.Drawing.Size(190, 264); diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index cdc6a525f1..5d58e8178c 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -79,7 +79,7 @@ namespace BizHawk.Client.EmuHawk public void Restart() { - CheatEditor.Core = Core; + CheatEditor.MemoryDomains = Core; } /// @@ -173,7 +173,7 @@ namespace BizHawk.Client.EmuHawk private void Cheats_Load(object sender, EventArgs e) { TopMost = Settings.TopMost; - CheatEditor.Core = Core; + CheatEditor.MemoryDomains = Core; LoadConfigSettings(); ToggleGameGenieButton(); CheatEditor.SetAddEvent(AddCheat); diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs index 2d9733d72a..de206196a3 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs @@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger public IDebuggable Core { get; set; } public IMemoryCallbackSystem MCS { get; set; } public GenericDebugger ParentDebugger { get; set; } - public IMemoryDomainList MemoryDomains { get; set; } + public IMemoryDomains MemoryDomains { get; set; } private readonly BreakpointList Breakpoints = new BreakpointList(); public BreakpointControl() @@ -105,7 +105,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger var b = new AddBreakpointDialog { // TODO: don't use Global.Emulator! Pass in an IMemoryDomains implementation from the parent tool - MaxAddressSize = Global.Emulator.AsMemoryDomains().MemoryDomains.CheatDomain.Size - 1 + MaxAddressSize = Global.Emulator.AsMemoryDomains().CheatDomain.Size - 1 }; if (b.ShowDialog() == DialogResult.OK) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs index c663fc6fe7..033628b873 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs @@ -11,15 +11,15 @@ namespace BizHawk.Client.EmuHawk { [RequiredService] private IDebuggable Debuggable { get; set; } + [OptionalService] private IDisassemblable Disassembler { get; set; } + [OptionalService] - private IMemoryDomains MemoryDomainSource { get; set; } + private IMemoryDomains MemoryDomains { get; set; } private IMemoryCallbackSystem MemoryCallbacks { get { return Debuggable.MemoryCallbacks; } } - private IMemoryDomainList MemoryDomains { get { return MemoryDomainSource.MemoryDomains; } } - private uint PC { // TODO: is this okay for N64? diff --git a/BizHawk.Client.EmuHawk/tools/GB/GBGameGenie.cs b/BizHawk.Client.EmuHawk/tools/GB/GBGameGenie.cs index 525052029d..64a3835d4a 100644 --- a/BizHawk.Client.EmuHawk/tools/GB/GBGameGenie.cs +++ b/BizHawk.Client.EmuHawk/tools/GB/GBGameGenie.cs @@ -17,9 +17,7 @@ namespace BizHawk.Client.EmuHawk private IEmulator Emulator { get; set; } [RequiredService] - private IMemoryDomains MemoryDomainSource { get; set; } - - private IMemoryDomainList MemoryDomains { get { return MemoryDomainSource.MemoryDomains; } } + private IMemoryDomains MemoryDomains { get; set; } private readonly Dictionary _gameGenieTable = new Dictionary(); private bool _processing; diff --git a/BizHawk.Client.EmuHawk/tools/Genesis/GenGameGenie.cs b/BizHawk.Client.EmuHawk/tools/Genesis/GenGameGenie.cs index c8d8cec4c0..698ac317c9 100644 --- a/BizHawk.Client.EmuHawk/tools/Genesis/GenGameGenie.cs +++ b/BizHawk.Client.EmuHawk/tools/Genesis/GenGameGenie.cs @@ -25,8 +25,7 @@ namespace BizHawk.Client.EmuHawk private GPGX Emulator { get; set; } [RequiredService] - private IMemoryDomains MemoryDomainService { get; set; } - private IMemoryDomainList MemoryDomains { get { return MemoryDomainService.MemoryDomains; } } + private IMemoryDomains MemoryDomains { get; set; } private readonly Dictionary _gameGenieTable = new Dictionary { diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index 94f804d000..0d2a1b4e74 100644 --- a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -23,8 +23,7 @@ namespace BizHawk.Client.EmuHawk public partial class HexEditor : Form, IToolFormAutoConfig { [RequiredService] - private IMemoryDomains MemoryDomainSource { get; set; } - private IMemoryDomainList MemoryDomains { get { return MemoryDomainSource.MemoryDomains; } } + private IMemoryDomains MemoryDomains { get; set; } [RequiredService] private IEmulator Emulator { get; set; } diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs b/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs index bdaa61351d..525db66025 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs @@ -15,8 +15,7 @@ namespace BizHawk.Client.EmuHawk private IEmulator Emulator { get; set; } [RequiredService] - private IMemoryDomains MemoryDomainService { get; set; } - private IMemoryDomainList MemoryDomains { get { return MemoryDomainService.MemoryDomains; } } + private IMemoryDomains MemoryDomains { get; set; } private readonly Dictionary _gameGenieTable = new Dictionary { diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCECDL.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCECDL.cs index 0d11f5c9d7..99d4fb2fe2 100644 --- a/BizHawk.Client.EmuHawk/tools/PCE/PCECDL.cs +++ b/BizHawk.Client.EmuHawk/tools/PCE/PCECDL.cs @@ -37,7 +37,8 @@ namespace BizHawk.Client.EmuHawk } } - private IMemoryDomainList MemoryDomains { get { return _emu.MemoryDomains; } } + [RequiredService] + private IMemoryDomains MemoryDomains { get; set; } private string _currentFileName = string.Empty; diff --git a/BizHawk.Client.EmuHawk/tools/SNES/SNESGameGenie.cs b/BizHawk.Client.EmuHawk/tools/SNES/SNESGameGenie.cs index 84425e8246..1ed8e90482 100644 --- a/BizHawk.Client.EmuHawk/tools/SNES/SNESGameGenie.cs +++ b/BizHawk.Client.EmuHawk/tools/SNES/SNESGameGenie.cs @@ -16,7 +16,8 @@ namespace BizHawk.Client.EmuHawk [RequiredService] public LibsnesCore Emulator { get; set; } - private IMemoryDomainList MemoryDomains { get { return Emulator.MemoryDomains; } } + [RequiredService] + private IMemoryDomains MemoryDomains { get; set; } // including transposition // Code: D F 4 7 0 9 1 5 6 B C 8 A 2 3 E diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs index d08fb3c678..5d06689731 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs @@ -65,7 +65,7 @@ namespace BizHawk.Client.EmuHawk } [RequiredService] - public IMemoryDomains Core { get; set; } + public IMemoryDomains MemoryDomains { get; set; } [RequiredService] public IEmulator Emu { get; set; } @@ -125,8 +125,8 @@ namespace BizHawk.Client.EmuHawk RamSearchMenu.Items.Add(Settings.Columns.GenerateColumnsMenu(ColumnToggleCallback)); - _settings = new RamSearchEngine.Settings(Core); - _searches = new RamSearchEngine(_settings, Core); + _settings = new RamSearchEngine.Settings(MemoryDomains); + _searches = new RamSearchEngine(_settings, MemoryDomains); ErrorIconButton.Visible = false; _dropdownDontfire = true; @@ -135,7 +135,7 @@ namespace BizHawk.Client.EmuHawk SpecificValueBox.Type = _settings.Type; MessageLabel.Text = string.Empty; - SpecificAddressBox.MaxLength = (Core.MemoryDomains.MainMemory.Size - 1).NumHexDigits(); + SpecificAddressBox.MaxLength = (MemoryDomains.MainMemory.Size - 1).NumHexDigits(); HardSetSizeDropDown(_settings.Size); PopulateTypeDropDown(); HardSetDisplayTypeDropDown(_settings.Type); @@ -302,8 +302,8 @@ namespace BizHawk.Client.EmuHawk public void Restart() { - _settings = new RamSearchEngine.Settings(Core); - _searches = new RamSearchEngine(_settings, Core); + _settings = new RamSearchEngine.Settings(MemoryDomains); + _searches = new RamSearchEngine(_settings, MemoryDomains); MessageLabel.Text = "Search restarted"; DoDomainSizeCheck(); NewSearch(); @@ -325,7 +325,7 @@ namespace BizHawk.Client.EmuHawk var compareVal = _searches.CompareValue; var differentBy = _searches.DifferentBy; - _searches = new RamSearchEngine(_settings, Core, compareTo, compareVal, differentBy); + _searches = new RamSearchEngine(_settings, MemoryDomains, compareTo, compareVal, differentBy); _searches.Start(); if (Settings.AlwaysExcludeRamWatch) { @@ -596,7 +596,7 @@ namespace BizHawk.Client.EmuHawk private void SetMemoryDomain(string name) { - _settings.Domain = Core.MemoryDomains[name]; + _settings.Domain = MemoryDomains[name]; SetReboot(true); SpecificAddressBox.MaxLength = (_settings.Domain.Size - 1).NumHexDigits(); DoDomainSizeCheck(); @@ -808,7 +808,7 @@ namespace BizHawk.Client.EmuHawk _currentFileName = file.FullName; } - var watches = new WatchList(Core, _settings.Domain, Emu.SystemId); + var watches = new WatchList(MemoryDomains, _settings.Domain, Emu.SystemId); watches.Load(file.FullName, append); var watchList = watches.Where(x => !x.IsSeparator); @@ -981,7 +981,7 @@ namespace BizHawk.Client.EmuHawk { if (!string.IsNullOrWhiteSpace(_currentFileName)) { - var watches = new WatchList(Core, _settings.Domain, Emu.SystemId) { CurrentFileName = _currentFileName }; + var watches = new WatchList(MemoryDomains, _settings.Domain, Emu.SystemId) { CurrentFileName = _currentFileName }; for (var i = 0; i < _searches.Count; i++) { watches.Add(_searches[i]); @@ -1009,7 +1009,7 @@ namespace BizHawk.Client.EmuHawk private void SaveAsMenuItem_Click(object sender, EventArgs e) { - var watches = new WatchList(Core, _settings.Domain, Emu.SystemId) { CurrentFileName = _currentFileName }; + var watches = new WatchList(MemoryDomains, _settings.Domain, Emu.SystemId) { CurrentFileName = _currentFileName }; for (var i = 0; i < _searches.Count; i++) { watches.Add(_searches[i]); @@ -1048,7 +1048,7 @@ namespace BizHawk.Client.EmuHawk { MemoryDomainsSubMenu.DropDownItems.Clear(); MemoryDomainsSubMenu.DropDownItems.AddRange( - Core.MemoryDomains.MenuItems(SetMemoryDomain, _searches.Domain.Name, MaxSupportedSize) + MemoryDomains.MenuItems(SetMemoryDomain, _searches.Domain.Name, MaxSupportedSize) .ToArray()); } @@ -1359,7 +1359,7 @@ namespace BizHawk.Client.EmuHawk RamSearchMenu.Items.Add(Settings.Columns.GenerateColumnsMenu(ColumnToggleCallback)); - _settings = new RamSearchEngine.Settings(Core); + _settings = new RamSearchEngine.Settings(MemoryDomains); if (_settings.Mode == RamSearchEngine.Settings.SearchMode.Fast) { SetToFastMode(); diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index f63866fd33..4e3ea0e509 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk private bool _paused = false; [RequiredService] - private IMemoryDomains _core { get; set; } + private IMemoryDomains _memoryDomains { get; set; } [RequiredService] private IEmulator _emu { get; set; } @@ -210,14 +210,14 @@ namespace BizHawk.Client.EmuHawk if (_watches != null && !string.IsNullOrWhiteSpace(_watches.CurrentFileName)) { - _watches.RefreshDomans(_core, _core.MemoryDomains.MainMemory); + _watches.RefreshDomans(_memoryDomains, _memoryDomains.MainMemory); _watches.Reload(); SetPlatformAndMemoryDomainLabel(); UpdateStatusBar(); } else { - _watches = new WatchList(_core, _core.MemoryDomains.MainMemory, _emu.SystemId); + _watches = new WatchList(_memoryDomains, _memoryDomains.MainMemory, _emu.SystemId); NewWatchList(true); } } @@ -370,7 +370,7 @@ namespace BizHawk.Client.EmuHawk var we = new WatchEditor { InitialLocation = this.ChildPointToScreen(WatchListView), - Core = _core + MemoryDomains = _memoryDomains }; we.SetWatch(_watches.Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit); @@ -517,7 +517,7 @@ namespace BizHawk.Client.EmuHawk private void SetMemoryDomain(string name) { - _watches.Domain = _core.MemoryDomains[name]; + _watches.Domain = _memoryDomains[name]; SetPlatformAndMemoryDomainLabel(); Update(); } @@ -698,7 +698,7 @@ namespace BizHawk.Client.EmuHawk { MemoryDomainsSubMenu.DropDownItems.Clear(); MemoryDomainsSubMenu.DropDownItems.AddRange( - _core.MemoryDomains.MenuItems(SetMemoryDomain, _watches.Domain.Name) + _memoryDomains.MenuItems(SetMemoryDomain, _watches.Domain.Name) .ToArray()); } @@ -707,7 +707,7 @@ namespace BizHawk.Client.EmuHawk var we = new WatchEditor { InitialLocation = this.ChildPointToScreen(WatchListView), - Core = _core + MemoryDomains = _memoryDomains }; we.SetWatch(_watches.Domain); we.ShowHawkDialog(); @@ -955,7 +955,7 @@ namespace BizHawk.Client.EmuHawk private void NewRamWatch_Load(object sender, EventArgs e) { TopMost = Settings.TopMost; - _watches = new WatchList(_core, _core.MemoryDomains.MainMemory, _emu.SystemId); + _watches = new WatchList(_memoryDomains, _memoryDomains.MainMemory, _emu.SystemId); LoadConfigSettings(); RamWatchMenu.Items.Add(Settings.Columns.GenerateColumnsMenu(ColumnToggleCallback)); UpdateStatusBar(); diff --git a/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs b/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs index 6f6c887d63..f937668fa6 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/WatchEditor.cs @@ -14,7 +14,8 @@ namespace BizHawk.Client.EmuHawk public enum Mode { New, Duplicate, Edit }; private readonly List _watchList = new List(); - public IMemoryDomains Core { get; set; } + + public IMemoryDomains MemoryDomains { get; set; } private Mode _mode = Mode.New; private bool _loading = true; @@ -102,10 +103,10 @@ namespace BizHawk.Client.EmuHawk _mode = mode; DomainDropDown.Items.Clear(); - DomainDropDown.Items.AddRange(Core.MemoryDomains + DomainDropDown.Items.AddRange(MemoryDomains .Select(d => d.ToString()) .ToArray()); - DomainDropDown.SelectedItem = Core.MemoryDomains.MainMemory.ToString(); + DomainDropDown.SelectedItem = MemoryDomains.MainMemory.ToString(); SetTitle(); } @@ -131,7 +132,7 @@ namespace BizHawk.Client.EmuHawk { if (!_loading) { - var domain = Core.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); + var domain = MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); if (domain != null) { AddressBox.SetHexProperties(domain.Size); @@ -190,8 +191,8 @@ namespace BizHawk.Client.EmuHawk } } - var domain = Core.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()) ?? - Core.MemoryDomains.MainMemory; + var domain = MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()) ?? + MemoryDomains.MainMemory; BigEndianCheckBox.Checked = domain.EndianType == MemoryDomain.Endian.Big; } @@ -211,7 +212,7 @@ namespace BizHawk.Client.EmuHawk { default: case Mode.New: - var domain = Core.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); + var domain = MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); var address = AddressBox.ToRawInt() ?? 0; var notes = NotesBox.Text; var type = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()); diff --git a/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs b/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs index cfb910a06a..2814ba972f 100644 --- a/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs +++ b/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs @@ -184,7 +184,7 @@ namespace BizHawk.Emulation.Common } } - public class MemoryDomainList : ReadOnlyCollection, IMemoryDomainList + public class MemoryDomainList : ReadOnlyCollection, IMemoryDomains { private readonly int _mainMemoryIndex; diff --git a/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs b/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs index 0a7997db44..c1ebe7b8ee 100644 --- a/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs +++ b/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs @@ -1,20 +1,15 @@ using System.Collections.Generic; + namespace BizHawk.Emulation.Common { - public interface IMemoryDomains : IEmulatorService - { - ///The list of all avaialble memory domains - /// A memory domain is a byte array that respresents a distinct part of the emulated system. - /// By convention the Main Memory is the 1st domain in the list - // All cores sould implement a System Bus domain that represents the standard cpu bus range for that system, - /// and a Main Memory which is typically the WRAM space (for instance, on NES - 0000-07FF), - /// Other chips, and ram spaces can be added as well. - /// Subdomains of another domain are also welcome. - /// The MainMemory identifier will be 0 if not set - IMemoryDomainList MemoryDomains { get; } - } - - public interface IMemoryDomainList : IEnumerable + /// + /// The list of all avaialble memory domains + /// A memory domain is a byte array that respresents a distinct part of the emulated system. + /// All cores sould implement a CheatDomain that represents the standard cpu bus range used for cheats for that system, + /// In order to have a cheat system available for the core + /// All domains should implement both peek and poke. However, if something isn't developed it should throw NotImplementedException rather than silently fail + /// + public interface IMemoryDomains : IEnumerable, IEmulatorService { MemoryDomain this[string name] { get; } diff --git a/BizHawk.Emulation.Cores/CPUs/HuC6280/CDL.cs b/BizHawk.Emulation.Cores/CPUs/HuC6280/CDL.cs index 826c606e90..9aac4e1f53 100644 --- a/BizHawk.Emulation.Cores/CPUs/HuC6280/CDL.cs +++ b/BizHawk.Emulation.Cores/CPUs/HuC6280/CDL.cs @@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 w.Flush(); } - public void Disassemble(Stream s, IMemoryDomainList mem) + public void Disassemble(Stream s, IMemoryDomains mem) { var w = new StreamWriter(s); w.WriteLine("; Bizhawk CDL Disassembly"); diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs index 362c82077a..a7394b810b 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs @@ -3,13 +3,8 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Calculators { - public partial class TI83 : IMemoryDomains + public partial class TI83 { - public IMemoryDomainList MemoryDomains - { - get { return _memoryDomains; } - } - private void SetupMemoryDomains() { var domains = new List @@ -24,8 +19,9 @@ namespace BizHawk.Emulation.Cores.Calculators }; _memoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); } - private MemoryDomainList _memoryDomains; + private IMemoryDomains _memoryDomains; } } diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.cs b/BizHawk.Emulation.Cores/Calculator/TI83.cs index 672dcce075..3cab20838e 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.cs @@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Calculators isReleased: true )] [ServiceNotApplicable(typeof(ISaveRam))] - public partial class TI83 : IEmulator, IMemoryDomains, IStatable, IDebuggable, IInputPollable, ISettable + public partial class TI83 : IEmulator, IStatable, IDebuggable, IInputPollable, ISettable { //hardware private readonly Z80A cpu = new Z80A(); diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IMemoryDomains.cs index 1235e0b407..072e97bb1f 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IMemoryDomains.cs @@ -3,14 +3,9 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Computers.Commodore64 { - public partial class C64 : IMemoryDomains + public partial class C64 { - public IMemoryDomainList MemoryDomains - { - get { return memoryDomains; } - } - - private MemoryDomainList memoryDomains; + private IMemoryDomains memoryDomains; private void SetupMemoryDomains() { @@ -28,6 +23,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 //domains.Add(new MemoryDomain("1541 VIA1", 0x10, MemoryDomain.Endian.Little, new Func(disk.PeekVia1), new Action(disk.PokeVia1))); //domains.Add(new MemoryDomain("1541 RAM", 0x1000, MemoryDomain.Endian.Little, new Func(disk.PeekRam), new Action(disk.PokeRam))); memoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(memoryDomains); } } } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs index fdb873f771..10c9a80145 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs @@ -21,7 +21,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 isReleased: false )] [ServiceNotApplicable(typeof(ISettable<,>))] - sealed public partial class C64 : IEmulator, IMemoryDomains, IStatable, IInputPollable, IDriveLight, IDebuggable + sealed public partial class C64 : IEmulator, IStatable, IInputPollable, IDriveLight, IDebuggable { // framework public C64(CoreComm comm, GameInfo game, byte[] rom, string romextension) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IMemoryDomains.cs index cf7b898679..18f7b2e1ba 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IMemoryDomains.cs @@ -3,9 +3,9 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Atari.Atari2600 { - public partial class Atari2600 : IMemoryDomains + public partial class Atari2600 { - public IMemoryDomainList MemoryDomains { get; private set; } + internal IMemoryDomains MemoryDomains; private void SetupMemoryDomains() { @@ -58,6 +58,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } MemoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs index a173c00762..b4e0866775 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs @@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 isReleased: true )] [ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))] - public partial class Atari2600 : IEmulator, IMemoryDomains, IStatable, IDebuggable, IInputPollable, ISettable + public partial class Atari2600 : IEmulator, IStatable, IDebuggable, IInputPollable, ISettable { private readonly GameInfo _game; private int _frame; diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.IMemoryDomains.cs index c2f92b9527..0b3bae3fd3 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.IMemoryDomains.cs @@ -6,11 +6,11 @@ using EMU7800.Core; namespace BizHawk.Emulation.Cores.Atari.Atari7800 { - public partial class Atari7800 : IMemoryDomains + public partial class Atari7800 { private List _MemoryDomains; - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains MemoryDomains; public void SetupMemoryDomains(HSC7800 hsc7800) { @@ -97,7 +97,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800 else // todo 2600? { } + MemoryDomains = new MemoryDomainList(_MemoryDomains); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs index 389a9b11e9..704953266f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs @@ -17,7 +17,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800 portedUrl: "http://emu7800.sourceforge.net/" )] [ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight))] - public partial class Atari7800 : IEmulator, IMemoryDomains, ISaveRam, IDebuggable, IStatable, IInputPollable + public partial class Atari7800 : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable { // TODO: // some things don't work when you try to plug in a 2600 game @@ -31,6 +31,46 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800 TIATables.PALPalette[i] |= unchecked((int)0xff000000); } + public Atari7800(CoreComm comm, GameInfo game, byte[] rom, string GameDBfn) + { + ServiceProvider = new BasicServiceProvider(this); + InputCallbacks = new InputCallbackSystem(); + CoreComm = comm; + byte[] highscoreBIOS = comm.CoreFileProvider.GetFirmware("A78", "Bios_HSC", false, "Some functions may not work without the high score BIOS."); + byte[] pal_bios = comm.CoreFileProvider.GetFirmware("A78", "Bios_PAL", false, "The game will not run if the correct region BIOS is not available."); + byte[] ntsc_bios = comm.CoreFileProvider.GetFirmware("A78", "Bios_NTSC", false, "The game will not run if the correct region BIOS is not available."); + + if (EMU7800.Win.GameProgramLibrary.EMU7800DB == null) + { + EMU7800.Win.GameProgramLibrary.EMU7800DB = new EMU7800.Win.GameProgramLibrary(new StreamReader(GameDBfn)); + } + + if (rom.Length % 1024 == 128) + { + Console.WriteLine("Trimming 128 byte .a78 header..."); + byte[] newrom = new byte[rom.Length - 128]; + Buffer.BlockCopy(rom, 128, newrom, 0, newrom.Length); + rom = newrom; + } + GameInfo = EMU7800.Win.GameProgramLibrary.EMU7800DB.TryRecognizeRom(rom); + CoreComm.RomStatusDetails = GameInfo.ToString(); + Console.WriteLine("Rom Determiniation from 7800DB:"); + Console.WriteLine(GameInfo.ToString()); + + this.rom = rom; + this.game = game; + this.hsbios = highscoreBIOS; + this.bios = GameInfo.MachineType == MachineType.A7800PAL ? pal_bios : ntsc_bios; + _pal = GameInfo.MachineType == MachineType.A7800PAL || GameInfo.MachineType == MachineType.A2600PAL; + + if (bios == null) + { + throw new MissingFirmwareException("The BIOS corresponding to the region of the game you loaded is required to run Atari 7800 games."); + } + + HardReset(); + } + public IEmulatorServiceProvider ServiceProvider { get; private set; } public byte[] rom; @@ -122,46 +162,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800 } } - public Atari7800(CoreComm comm, GameInfo game, byte[] rom, string GameDBfn) - { - ServiceProvider = new BasicServiceProvider(this); - InputCallbacks = new InputCallbackSystem(); - CoreComm = comm; - byte[] highscoreBIOS = comm.CoreFileProvider.GetFirmware("A78", "Bios_HSC", false, "Some functions may not work without the high score BIOS."); - byte[] pal_bios = comm.CoreFileProvider.GetFirmware("A78", "Bios_PAL", false, "The game will not run if the correct region BIOS is not available."); - byte[] ntsc_bios = comm.CoreFileProvider.GetFirmware("A78", "Bios_NTSC", false, "The game will not run if the correct region BIOS is not available."); - - if (EMU7800.Win.GameProgramLibrary.EMU7800DB == null) - { - EMU7800.Win.GameProgramLibrary.EMU7800DB = new EMU7800.Win.GameProgramLibrary(new StreamReader(GameDBfn)); - } - - if (rom.Length % 1024 == 128) - { - Console.WriteLine("Trimming 128 byte .a78 header..."); - byte[] newrom = new byte[rom.Length - 128]; - Buffer.BlockCopy(rom, 128, newrom, 0, newrom.Length); - rom = newrom; - } - GameInfo = EMU7800.Win.GameProgramLibrary.EMU7800DB.TryRecognizeRom(rom); - CoreComm.RomStatusDetails = GameInfo.ToString(); - Console.WriteLine("Rom Determiniation from 7800DB:"); - Console.WriteLine(GameInfo.ToString()); - - this.rom = rom; - this.game = game; - this.hsbios = highscoreBIOS; - this.bios = GameInfo.MachineType == MachineType.A7800PAL ? pal_bios : ntsc_bios; - _pal = GameInfo.MachineType == MachineType.A7800PAL || GameInfo.MachineType == MachineType.A2600PAL; - - if (bios == null) - { - throw new MissingFirmwareException("The BIOS corresponding to the region of the game you loaded is required to run Atari 7800 games."); - } - - HardReset(); - } - private bool _pal; public DisplayType DisplayType { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.cs b/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.cs index 7a91cb5ce6..ae974284c5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.cs @@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx { [CoreAttributes("Handy", "K. Wilkins", true, true, "mednafen 0-9-34-1", "http://mednafen.sourceforge.net/")] [ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight))] - public class Lynx : IEmulator, IVideoProvider, ISyncSoundProvider, IMemoryDomains, ISaveRam, IStatable, IInputPollable + public class Lynx : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IStatable, IInputPollable { IntPtr Core; @@ -386,11 +386,11 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx if (s1 > 0 && p1 != IntPtr.Zero) mms.Add(MemoryDomain.FromIntPtr("Cart B", s1, MemoryDomain.Endian.Little, p1, false)); - MemoryDomains = new MemoryDomainList(mms, 0); + _memoryDomains = new MemoryDomainList(mms, 0); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); } - - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains _memoryDomains; #endregion } diff --git a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.IMemoryDomains.cs index 071880958a..c68529649f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.IMemoryDomains.cs @@ -5,13 +5,8 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.ColecoVision { - public partial class ColecoVision : IMemoryDomains + public partial class ColecoVision { - public IMemoryDomainList MemoryDomains - { - get { return memoryDomains; } - } - private MemoryDomainList memoryDomains; private void SetupMemoryDomains() @@ -47,6 +42,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision domains.Add(VRamDomain); domains.Add(SystemBusDomain); memoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(memoryDomains); } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs index ce41ec9023..23c9b84620 100644 --- a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs +++ b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs @@ -18,7 +18,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision isReleased: true )] [ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))] - public sealed partial class ColecoVision : IEmulator, IMemoryDomains, IDebuggable, IInputPollable, IStatable, ISettable + public sealed partial class ColecoVision : IEmulator, IDebuggable, IInputPollable, IStatable, ISettable { // ROM public byte[] RomData; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs index e1f9ab264b..3adcfc5349 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs @@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA isReleased: false )] [ServiceNotApplicable(typeof(IDriveLight))] - public class GBA : IEmulator, IVideoProvider, ISyncSoundProvider, IGBAGPUViewable, IMemoryDomains, ISaveRam, IStatable, IInputPollable + public class GBA : IEmulator, IVideoProvider, ISyncSoundProvider, IGBAGPUViewable, ISaveRam, IStatable, IInputPollable { [CoreConstructor("GBA")] public GBA(CoreComm comm, byte[] file) @@ -235,7 +235,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA #region memorydomains List _MemoryDomains = new List(); - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains _memoryDomains; void AddMemoryDomain(LibMeteor.MemoryArea which, int size, string name) { @@ -303,7 +303,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA _MemoryDomains.Add(cr); } - MemoryDomains = new MemoryDomainList(_MemoryDomains); + _memoryDomains = new MemoryDomainList(_MemoryDomains); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); } #endregion diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs index 7e7aa51035..5cf1f3c6f7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs @@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA [CoreAttributes("VBA-Next", "many authors", true, true, "cd508312a29ed8c29dacac1b11c2dce56c338a54", "https://github.com/libretro/vba-next")] [ServiceNotApplicable(typeof(IDriveLight))] public class VBANext : IEmulator, IVideoProvider, ISyncSoundProvider, IInputPollable, - IGBAGPUViewable, IMemoryDomains, ISaveRam, IStatable, IDebuggable, ISettable + IGBAGPUViewable, ISaveRam, IStatable, IDebuggable, ISettable { IntPtr Core; @@ -400,10 +400,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA }); mm.Add(cr); } - MemoryDomains = new MemoryDomainList(mm, 0); + + _memoryDomains = new MemoryDomainList(mm, 0); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); } - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains _memoryDomains; VBARegisterHelper regs; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index ffcbbeb541..f68cb59868 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -24,7 +24,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy )] [ServiceNotApplicable(typeof(IDriveLight))] public class Gameboy : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IStatable, IInputPollable, - IMemoryDomains, IDebuggable, ISettable + IDebuggable, ISettable { #region ALL SAVESTATEABLE STATE GOES HERE @@ -753,7 +753,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy _MemoryDomains.Add(MemoryDomain.FromIntPtr(name, length, MemoryDomain.Endian.Little, data)); } - void InitMemoryDomains() + private void InitMemoryDomains() { CreateMemoryDomain(LibGambatte.MemoryAreas.wram, "WRAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.rom, "ROM"); @@ -779,10 +779,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy })); MemoryDomains = new MemoryDomainList(_MemoryDomains); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); } private List _MemoryDomains = new List(); - public IMemoryDomainList MemoryDomains { get; private set; } + internal IMemoryDomains MemoryDomains { get; set; } #endregion diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs index faad9e03da..faca014127 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs @@ -18,7 +18,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy isReleased: true )] [ServiceNotApplicable(typeof(IDriveLight))] - public class GambatteLink : IEmulator, IVideoProvider, ISyncSoundProvider, IInputPollable, ISaveRam, IStatable, IMemoryDomains, + public class GambatteLink : IEmulator, IVideoProvider, ISyncSoundProvider, IInputPollable, ISaveRam, IStatable, IDebuggable, ISettable { bool disposed = false; @@ -405,7 +405,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy #region debugging - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains _memoryDomains; public IDictionary GetCpuFlagsAndRegisters() { @@ -439,7 +439,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy foreach (var md in R.MemoryDomains) mm.Add(new MemoryDomain("R " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); - MemoryDomains = new MemoryDomainList(mm); + _memoryDomains = new MemoryDomainList(mm); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); } public bool CanStep(StepType type) { return false; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs index f8176dbeb2..6f0416df72 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs @@ -7,11 +7,11 @@ using BizHawk.Emulation.Cores.Nintendo.N64.NativeApi; namespace BizHawk.Emulation.Cores.Nintendo.N64 { - public partial class N64 : IMemoryDomains + public partial class N64 { private List _memoryDomains = new List(); - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains MemoryDomains; private void MakeMemoryDomain(string name, mupen64plusApi.N64_MEMORY id, MemoryDomain.Endian endian, bool swizzled = false) { @@ -132,13 +132,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 _memoryDomains.Add(new MemoryDomain ( name: "System Bus", - size: 0, //special case for full 32bit memorydomain + size: 0, // special case for full 32bit memorydomain endian: MemoryDomain.Endian.Big, peekByte: peekByte, pokeByte: pokeByte )); MemoryDomains = new MemoryDomainList(_memoryDomains); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs index 046e75e0f2..e3e7085491 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs @@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 portedUrl: "https://code.google.com/p/mupen64plus/" )] [ServiceNotApplicable(typeof(IDriveLight))] - public partial class N64 : IEmulator, IMemoryDomains, ISaveRam, IDebuggable, IStatable, IInputPollable, + public partial class N64 : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, ISettable { private readonly N64Input _inputProvider; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.INESPPUViewable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.INESPPUViewable.cs index f367aabd14..474ff5dd8b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.INESPPUViewable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.INESPPUViewable.cs @@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public MemoryDomain GetCHRROM() { - return MemoryDomains["CHR VROM"]; + return memoryDomains["CHR VROM"]; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs index 86d7a8810c..e0a4fdf5c8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs @@ -17,7 +17,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES isPorted: false, isReleased: true )] - public partial class NES : IEmulator, IMemoryDomains, ISaveRam, IDebuggable, IStatable, IInputPollable, + public partial class NES : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, ISettable { static readonly bool USE_DATABASE = true; @@ -443,10 +443,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES domains.Add((board as ExROM).GetExRAM()); memoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(memoryDomains); } public string SystemId { get { return "NES"; } } - public IMemoryDomainList MemoryDomains { get { return memoryDomains; } } public string GameName { get { return game_name; } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs index b354e76741..98f4274da4 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs @@ -23,7 +23,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES portedUrl: "https://github.com/kode54/QuickNES" )] [ServiceNotApplicable(typeof(IDriveLight))] - public class QuickNES : IEmulator, IVideoProvider, ISyncSoundProvider, IMemoryDomains, ISaveRam, IInputPollable, + public class QuickNES : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IInputPollable, IStatable, IDebuggable, ISettable, Cores.Nintendo.NES.INESPPUViewable { #region FPU precision @@ -378,10 +378,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES LibQuickNES.qn_poke_prgbus(Context, addr, val); } )); - MemoryDomains = new MemoryDomainList(mm, 0); + + _memoryDomains = new MemoryDomainList(mm, 0); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); } - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains _memoryDomains; public IDictionary GetCpuFlagsAndRegisters() { @@ -427,8 +429,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES { // inefficient, sloppy, etc etc Emulation.Cores.Nintendo.NES.NES.BootGodDB.Initialize(); - var chrrom = MemoryDomains["CHR VROM"]; - var prgrom = MemoryDomains["PRG ROM"]; + var chrrom = _memoryDomains["CHR VROM"]; + var prgrom = _memoryDomains["PRG ROM"]; var ms = new System.IO.MemoryStream(); for (int i = 0; i < prgrom.Size; i++) @@ -798,7 +800,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES public MemoryDomain GetCHRROM() { - return MemoryDomains["CHR VROM"]; + return _memoryDomains["CHR VROM"]; } public void InstallCallback1(Action cb, int sl) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index 7c1d69ac9a..e42ded3016 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES portedUrl: "http://byuu.org/" )] [ServiceNotApplicable(typeof(IDriveLight))] - public unsafe class LibsnesCore : IEmulator, IVideoProvider, IMemoryDomains, ISaveRam, IStatable, IInputPollable, + public unsafe class LibsnesCore : IEmulator, IVideoProvider, ISaveRam, IStatable, IInputPollable, IDebuggable, ISettable { public LibsnesCore(GameInfo game, byte[] romData, bool deterministicEmulation, byte[] xmlData, CoreComm comm, object Settings, object SyncSettings) @@ -1141,11 +1141,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES } MemoryDomains = new MemoryDomainList(_memoryDomains); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); } private MemoryDomain MainMemory; private List _memoryDomains = new List(); - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains MemoryDomains; #region audio stuff diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index 7609df61c8..ef432127bc 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -22,7 +22,7 @@ namespace BizHawk.Emulation.Cores.PCEngine isPorted: false, isReleased: true )] - public sealed partial class PCEngine : IEmulator, IMemoryDomains, ISaveRam, IStatable, IInputPollable, + public sealed partial class PCEngine : IEmulator, ISaveRam, IStatable, IInputPollable, IDebuggable, ISettable, IDriveLight { // ROM @@ -563,10 +563,10 @@ namespace BizHawk.Emulation.Cores.PCEngine } memoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(memoryDomains); } MemoryDomainList memoryDomains; - public IMemoryDomainList MemoryDomains { get { return memoryDomains; } } public IDictionary GetCpuFlagsAndRegisters() { diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs index c9e9309e40..e21d9f8190 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs @@ -21,7 +21,7 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis isPorted: false, isReleased: false )] - public sealed partial class Genesis : IEmulator, IMemoryDomains, ISaveRam, IStatable, IInputPollable + public sealed partial class Genesis : IEmulator, ISaveRam, IStatable, IInputPollable { private int _lagcount = 0; private bool lagged = true; @@ -487,10 +487,9 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis domains.Add(RomDomain); domains.Add(SystemBusDomain); memoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(memoryDomains); } - public IMemoryDomainList MemoryDomains { get { return memoryDomains; } } - public void Dispose() { } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 3a761a355d..2302dd7230 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem isReleased: true )] [ServiceNotApplicable(typeof(IDriveLight))] - public sealed partial class SMS : IEmulator, IMemoryDomains, ISaveRam, IStatable, IInputPollable, + public sealed partial class SMS : IEmulator, ISaveRam, IStatable, IInputPollable, IDebuggable, ISettable { // Constants @@ -485,10 +485,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem domains.Add(ExtRamDomain); } memoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(memoryDomains); } - public IMemoryDomainList MemoryDomains { get { return memoryDomains; } } - public IDictionary GetCpuFlagsAndRegisters() { return new Dictionary diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.IMemoryDomains.cs index 12b8ebe240..01ae88b578 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.IMemoryDomains.cs @@ -6,9 +6,9 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Sega.Saturn { - public partial class Yabause : IMemoryDomains + public partial class Yabause { - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains _memoryDomains; private void InitMemoryDomains() { @@ -22,7 +22,8 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn } // main memory is in position 2 - MemoryDomains = new MemoryDomainList(ret, 2); + _memoryDomains = new MemoryDomainList(ret, 2); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs index 05139c3d43..2b3990200a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs @@ -23,7 +23,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn portedVersion: "9.12", portedUrl: "http://yabause.org" )] - public partial class Yabause : IEmulator, IVideoProvider, ISyncSoundProvider, IMemoryDomains, ISaveRam, IStatable, IInputPollable, + public partial class Yabause : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IStatable, IInputPollable, ISettable, IDriveLight { public static ControllerDefinition SaturnController = new ControllerDefinition diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs index c71e1f94f9..2acc665e97 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs @@ -24,7 +24,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx portedVersion: "r874", portedUrl: "https://code.google.com/p/genplus-gx/" )] - public class GPGX : IEmulator, ISyncSoundProvider, IVideoProvider, IMemoryDomains, ISaveRam, IStatable, + public class GPGX : IEmulator, ISyncSoundProvider, IVideoProvider, ISaveRam, IStatable, IInputPollable, IDebuggable, ISettable, IDriveLight { static GPGX AttachedCore = null; @@ -583,7 +583,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx #region debugging tools - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains MemoryDomains; unsafe void SetMemoryDomains() { @@ -619,6 +619,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx } } MemoryDomains = new MemoryDomainList(mm, 0); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); } public IDictionary GetCpuFlagsAndRegisters() diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index 2b34890891..13bc4a4687 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX isPorted: true, isReleased: false )] - public unsafe class Octoshock : IEmulator, IVideoProvider, ISyncSoundProvider, IMemoryDomains, ISaveRam, IStatable, IDriveLight, IInputPollable, ISettable, IDebuggable + public unsafe class Octoshock : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IStatable, IDriveLight, IInputPollable, ISettable, IDebuggable { public string SystemId { get { return "PSX"; } } @@ -620,9 +620,10 @@ namespace BizHawk.Emulation.Cores.Sony.PSX mmd.Add(MemoryDomain.FromIntPtr("DCache", size, MemoryDomain.Endian.Little, ptr, true)); MemoryDomains = new MemoryDomainList(mmd, 0); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); } - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains MemoryDomains; #endregion diff --git a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs index 41ae4ff1a0..fc89a0159d 100644 --- a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs +++ b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs @@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan { [CoreAttributes("Cygne/Mednafen", "Dox", true, true, "0.9.36.5", "http://mednafen.sourceforge.net/")] [ServiceNotApplicable(typeof(IDriveLight))] - public partial class WonderSwan : IEmulator, IVideoProvider, ISyncSoundProvider, IMemoryDomains, ISaveRam, + public partial class WonderSwan : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IInputPollable, IDebuggable { [CoreConstructor("WSWAN")] @@ -150,7 +150,9 @@ namespace BizHawk.Emulation.Cores.WonderSwan string sname = Marshal.PtrToStringAnsi(name); mmd.Add(MemoryDomain.FromIntPtr(sname, size, MemoryDomain.Endian.Little, data)); } + MemoryDomains = new MemoryDomainList(mmd, 0); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); } private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem(); @@ -159,7 +161,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan private readonly MemoryCallbackSystem _memorycallbacks = new MemoryCallbackSystem(); public IMemoryCallbackSystem MemoryCallbacks { get { return _memorycallbacks; } } - public IMemoryDomainList MemoryDomains { get; private set; } + private IMemoryDomains MemoryDomains; public IDictionary GetCpuFlagsAndRegisters() {