refactor IMemorydomains to be a domain list instead of having a domain property, refactor cores to register an IMemoryDomains instead of being one

This commit is contained in:
adelikat 2015-01-14 21:55:48 +00:00
parent c1bb613ab4
commit fbdb29b64c
54 changed files with 208 additions and 214 deletions

View File

@ -24,7 +24,7 @@ namespace BizHawk.Client.Common
{
if (MemoryDomainCore != null)
{
return MemoryDomainCore.MemoryDomains.MainMemory;
return MemoryDomainCore.MainMemory;
}
else
{

View File

@ -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;
}
}

View File

@ -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,

View File

@ -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
{

View File

@ -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];

View File

@ -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;
}

View File

@ -12,7 +12,7 @@ namespace BizHawk.Client.Common
{
public class WatchList : IList<Watch>
{
private IMemoryDomains _core;
private IMemoryDomains _memoryDomains;
private List<Watch> _watchList = new List<Watch>();
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;
}

View File

@ -218,7 +218,7 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
Global.CheatList.RemoveRange(watches.Where(watch => !watch.IsSeparator));
}
public static IEnumerable<ToolStripItem> MenuItems(this IMemoryDomainList domains, Action<string> setCallback, string selected = "", int? maxSize = null)
public static IEnumerable<ToolStripItem> MenuItems(this IMemoryDomains domains, Action<string> setCallback, string selected = "", int? maxSize = null)
{
foreach (var domain in domains)
{

View File

@ -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()),

View File

@ -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);

View File

@ -79,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
public void Restart()
{
CheatEditor.Core = Core;
CheatEditor.MemoryDomains = Core;
}
/// <summary>
@ -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);

View File

@ -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)

View File

@ -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?

View File

@ -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<char, int> _gameGenieTable = new Dictionary<char, int>();
private bool _processing;

View File

@ -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<char, int> _gameGenieTable = new Dictionary<char, int>
{

View File

@ -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; }

View File

@ -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<char, int> _gameGenieTable = new Dictionary<char, int>
{

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -14,7 +14,8 @@ namespace BizHawk.Client.EmuHawk
public enum Mode { New, Duplicate, Edit };
private readonly List<Watch> _watchList = new List<Watch>();
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());

View File

@ -184,7 +184,7 @@ namespace BizHawk.Emulation.Common
}
}
public class MemoryDomainList : ReadOnlyCollection<MemoryDomain>, IMemoryDomainList
public class MemoryDomainList : ReadOnlyCollection<MemoryDomain>, IMemoryDomains
{
private readonly int _mainMemoryIndex;

View File

@ -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<MemoryDomain>
/// <summary>
/// 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
/// </summary>
public interface IMemoryDomains : IEnumerable<MemoryDomain>, IEmulatorService
{
MemoryDomain this[string name] { get; }

View File

@ -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");

View File

@ -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<MemoryDomain>
@ -24,8 +19,9 @@ namespace BizHawk.Emulation.Cores.Calculators
};
_memoryDomains = new MemoryDomainList(domains);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
}
private MemoryDomainList _memoryDomains;
private IMemoryDomains _memoryDomains;
}
}

View File

@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Calculators
isReleased: true
)]
[ServiceNotApplicable(typeof(ISaveRam))]
public partial class TI83 : IEmulator, IMemoryDomains, IStatable, IDebuggable, IInputPollable, ISettable<TI83.TI83Settings, object>
public partial class TI83 : IEmulator, IStatable, IDebuggable, IInputPollable, ISettable<TI83.TI83Settings, object>
{
//hardware
private readonly Z80A cpu = new Z80A();

View File

@ -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<int, byte>(disk.PeekVia1), new Action<int, byte>(disk.PokeVia1)));
//domains.Add(new MemoryDomain("1541 RAM", 0x1000, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekRam), new Action<int, byte>(disk.PokeRam)));
memoryDomains = new MemoryDomainList(domains);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(memoryDomains);
}
}
}

View File

@ -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)

View File

@ -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<IMemoryDomains>(MemoryDomains);
}
}
}

View File

@ -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<Atari2600.A2600Settings, Atari2600.A2600SyncSettings>
public partial class Atari2600 : IEmulator, IStatable, IDebuggable, IInputPollable, ISettable<Atari2600.A2600Settings, Atari2600.A2600SyncSettings>
{
private readonly GameInfo _game;
private int _frame;

View File

@ -6,11 +6,11 @@ using EMU7800.Core;
namespace BizHawk.Emulation.Cores.Atari.Atari7800
{
public partial class Atari7800 : IMemoryDomains
public partial class Atari7800
{
private List<MemoryDomain> _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<IMemoryDomains>(MemoryDomains);
}
}
}

View File

@ -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
{

View File

@ -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<IMemoryDomains>(_memoryDomains);
}
public IMemoryDomainList MemoryDomains { get; private set; }
private IMemoryDomains _memoryDomains;
#endregion
}

View File

@ -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<IMemoryDomains>(memoryDomains);
}
}
}

View File

@ -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<object, ColecoVision.ColecoSyncSettings>
public sealed partial class ColecoVision : IEmulator, IDebuggable, IInputPollable, IStatable, ISettable<object, ColecoVision.ColecoSyncSettings>
{
// ROM
public byte[] RomData;

View File

@ -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<MemoryDomain> _MemoryDomains = new List<MemoryDomain>();
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<IMemoryDomains>(_memoryDomains);
}
#endregion

View File

@ -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<object, VBANext.SyncSettings>
IGBAGPUViewable, ISaveRam, IStatable, IDebuggable, ISettable<object, VBANext.SyncSettings>
{
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<IMemoryDomains>(_memoryDomains);
}
public IMemoryDomainList MemoryDomains { get; private set; }
private IMemoryDomains _memoryDomains;
VBARegisterHelper regs;

View File

@ -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<Gameboy.GambatteSettings, Gameboy.GambatteSyncSettings>
IDebuggable, ISettable<Gameboy.GambatteSettings, Gameboy.GambatteSyncSettings>
{
#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<IMemoryDomains>(MemoryDomains);
}
private List<MemoryDomain> _MemoryDomains = new List<MemoryDomain>();
public IMemoryDomainList MemoryDomains { get; private set; }
internal IMemoryDomains MemoryDomains { get; set; }
#endregion

View File

@ -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<GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings>
{
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<string, RegisterValue> 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<IMemoryDomains>(_memoryDomains);
}
public bool CanStep(StepType type) { return false; }

View File

@ -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<MemoryDomain> _memoryDomains = new List<MemoryDomain>();
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<IMemoryDomains>(MemoryDomains);
}
}
}

View File

@ -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<N64Settings, N64SyncSettings>
{
private readonly N64Input _inputProvider;

View File

@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public MemoryDomain GetCHRROM()
{
return MemoryDomains["CHR VROM"];
return memoryDomains["CHR VROM"];
}

View File

@ -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<NES.NESSettings, NES.NESSyncSettings>
{
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<IMemoryDomains>(memoryDomains);
}
public string SystemId { get { return "NES"; } }
public IMemoryDomainList MemoryDomains { get { return memoryDomains; } }
public string GameName { get { return game_name; } }

View File

@ -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<QuickNES.QuickNESSettings, QuickNES.QuickNESSyncSettings>, 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<IMemoryDomains>(_memoryDomains);
}
public IMemoryDomainList MemoryDomains { get; private set; }
private IMemoryDomains _memoryDomains;
public IDictionary<string, RegisterValue> 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)

View File

@ -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<LibsnesCore.SnesSettings, LibsnesCore.SnesSyncSettings>
{
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<IMemoryDomains>(MemoryDomains);
}
private MemoryDomain MainMemory;
private List<MemoryDomain> _memoryDomains = new List<MemoryDomain>();
public IMemoryDomainList MemoryDomains { get; private set; }
private IMemoryDomains MemoryDomains;
#region audio stuff

View File

@ -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<PCEngine.PCESettings, PCEngine.PCESyncSettings>, IDriveLight
{
// ROM
@ -563,10 +563,10 @@ namespace BizHawk.Emulation.Cores.PCEngine
}
memoryDomains = new MemoryDomainList(domains);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(memoryDomains);
}
MemoryDomainList memoryDomains;
public IMemoryDomainList MemoryDomains { get { return memoryDomains; } }
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
{

View File

@ -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<IMemoryDomains>(memoryDomains);
}
public IMemoryDomainList MemoryDomains { get { return memoryDomains; } }
public void Dispose() { }
}
}

View File

@ -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<SMS.SMSSettings, SMS.SMSSyncSettings>
{
// Constants
@ -485,10 +485,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
domains.Add(ExtRamDomain);
}
memoryDomains = new MemoryDomainList(domains);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(memoryDomains);
}
public IMemoryDomainList MemoryDomains { get { return memoryDomains; } }
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
{
return new Dictionary<string, RegisterValue>

View File

@ -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<IMemoryDomains>(_memoryDomains);
}
}
}

View File

@ -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<object, Yabause.SaturnSyncSettings>, IDriveLight
{
public static ControllerDefinition SaturnController = new ControllerDefinition

View File

@ -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<GPGX.GPGXSettings, GPGX.GPGXSyncSettings>, 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<IMemoryDomains>(MemoryDomains);
}
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()

View File

@ -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<Octoshock.Settings, Octoshock.SyncSettings>, IDebuggable
public unsafe class Octoshock : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IStatable, IDriveLight, IInputPollable, ISettable<Octoshock.Settings, Octoshock.SyncSettings>, 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<IMemoryDomains>(MemoryDomains);
}
public IMemoryDomainList MemoryDomains { get; private set; }
private IMemoryDomains MemoryDomains;
#endregion

View File

@ -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<IMemoryDomains>(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<string, RegisterValue> GetCpuFlagsAndRegisters()
{