Refactor MemoryDomains in IEmulator, make a MemoryDomainsList object rather than IList<MemoryDomain>, remove MainMemory from IEmulator and make it a property of this new collection object, also add indexing by name. Refactor cores and tools as needed
This commit is contained in:
parent
6f29976e9d
commit
1061add64f
|
@ -123,21 +123,19 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private uint MM_R_U8(int addr)
|
||||
{
|
||||
return Global.Emulator.MainMemory.PeekByte(addr);
|
||||
return Global.Emulator.MemoryDomains.MainMemory.PeekByte(addr);
|
||||
}
|
||||
|
||||
private void MM_W_U8(int addr, uint v)
|
||||
{
|
||||
Global.Emulator.MainMemory.PokeByte(addr, (byte)v);
|
||||
Global.Emulator.MemoryDomains.MainMemory.PokeByte(addr, (byte)v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public string mainmemory_getname()
|
||||
{
|
||||
return Global.Emulator.MainMemory.Name;
|
||||
return Global.Emulator.MemoryDomains.MainMemory.Name;
|
||||
}
|
||||
|
||||
public uint mainmemory_readbyte(object lua_addr)
|
||||
|
@ -155,7 +153,7 @@ namespace BizHawk.Client.Common
|
|||
for (int i = addr; i <= last_addr; i++)
|
||||
{
|
||||
string a = String.Format("{0:X2}", i);
|
||||
byte v = Global.Emulator.MainMemory.PeekByte(i);
|
||||
byte v = Global.Emulator.MemoryDomains.MainMemory.PeekByte(i);
|
||||
string vs = String.Format("{0:X2}", (int)v);
|
||||
table[a] = vs;
|
||||
}
|
||||
|
@ -165,7 +163,7 @@ namespace BizHawk.Client.Common
|
|||
public float mainmemory_readfloat(object lua_addr, bool bigendian)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint val = Global.Emulator.MainMemory.PeekDWord(addr, bigendian);
|
||||
uint val = Global.Emulator.MemoryDomains.MainMemory.PeekDWord(addr, bigendian);
|
||||
|
||||
byte[] bytes = BitConverter.GetBytes(val);
|
||||
float _float = BitConverter.ToSingle(bytes, 0);
|
||||
|
@ -186,7 +184,7 @@ namespace BizHawk.Client.Common
|
|||
int a = LuaInt(address);
|
||||
int v = LuaInt(memoryblock[address]);
|
||||
|
||||
Global.Emulator.MainMemory.PokeByte(a, (byte)v);
|
||||
Global.Emulator.MemoryDomains.MainMemory.PokeByte(a, (byte)v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,7 +194,7 @@ namespace BizHawk.Client.Common
|
|||
float dv = (float)(double)lua_v;
|
||||
byte[] bytes = BitConverter.GetBytes(dv);
|
||||
uint v = BitConverter.ToUInt32(bytes, 0);
|
||||
Global.Emulator.MainMemory.PokeDWord(addr, v, bigendian);
|
||||
Global.Emulator.MemoryDomains.MainMemory.PokeDWord(addr, v, bigendian);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -566,7 +566,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
return Global.Emulator.MainMemory;
|
||||
return Global.Emulator.MemoryDomains.MainMemory;
|
||||
}
|
||||
|
||||
private void CheatChanged(object sender)
|
||||
|
|
|
@ -1027,7 +1027,7 @@ namespace BizHawk.Client.Common
|
|||
break;
|
||||
}
|
||||
|
||||
Domain = Global.Emulator.MainMemory;
|
||||
Domain = Global.Emulator.MemoryDomains.MainMemory;
|
||||
CheckMisAligned = false;
|
||||
PreviousType = Watch.PreviousType.LastSearch;
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace BizHawk.Client.Common
|
|||
//Temporary, rename if kept
|
||||
int addr;
|
||||
bool bigEndian;
|
||||
MemoryDomain memDomain = Global.Emulator.MainMemory;
|
||||
MemoryDomain memDomain = Global.Emulator.MemoryDomains.MainMemory;
|
||||
|
||||
string temp = line.Substring(0, line.IndexOf('\t'));
|
||||
try
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Global.Emulator != null)
|
||||
{
|
||||
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, Global.Emulator.MainMemory);
|
||||
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, Global.Emulator.MemoryDomains.MainMemory);
|
||||
}
|
||||
SetFormToDefault();
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (Global.Emulator != null)
|
||||
{
|
||||
AddressBox.SetHexProperties(Global.Emulator.MainMemory.Size);
|
||||
AddressBox.SetHexProperties(Global.Emulator.MemoryDomains.MainMemory.Size);
|
||||
}
|
||||
|
||||
ValueBox.ByteSize =
|
||||
|
@ -199,7 +199,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!_loading)
|
||||
{
|
||||
var domain = ToolHelpers.DomainByName(DomainDropDown.SelectedItem.ToString());
|
||||
var domain = Global.Emulator.MemoryDomains[DomainDropDown.SelectedItem.ToString()];
|
||||
AddressBox.SetHexProperties(domain.Size);
|
||||
}
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
get
|
||||
{
|
||||
Watch watch = Watch.GenerateWatch(
|
||||
ToolHelpers.DomainByName(DomainDropDown.SelectedItem.ToString()),
|
||||
Global.Emulator.MemoryDomains[DomainDropDown.SelectedItem.ToString()],
|
||||
AddressBox.ToRawInt(),
|
||||
GetCurrentSize(),
|
||||
Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()),
|
||||
|
|
|
@ -245,20 +245,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Tools.HexEditor.SetToAddresses(addresses.ToList());
|
||||
}
|
||||
|
||||
public static MemoryDomain DomainByName(string name)
|
||||
{
|
||||
//Attempts to find the memory domain by name, if it fails, it defaults to index 0
|
||||
foreach (MemoryDomain domain in Global.Emulator.MemoryDomains)
|
||||
{
|
||||
if (domain.Name == name)
|
||||
{
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
|
||||
return Global.Emulator.MainMemory;
|
||||
}
|
||||
|
||||
public static void AddColumn(ListView listView, string columnName, bool enabled, int columnWidth)
|
||||
{
|
||||
if (enabled)
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
SpecificValueBox.Type = Settings.Type;
|
||||
|
||||
MessageLabel.Text = String.Empty;
|
||||
SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(Global.Emulator.MainMemory.Size);
|
||||
SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(Global.Emulator.MemoryDomains.MainMemory.Size);
|
||||
HardSetSizeDropDown(Settings.Size);
|
||||
PopulateTypeDropDown();
|
||||
HardSetDisplayTypeDropDown(Settings.Type);
|
||||
|
@ -235,8 +235,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void Restart()
|
||||
{
|
||||
if (!IsHandleCreated || IsDisposed) return;
|
||||
|
||||
Settings.Domain = Global.Emulator.MainMemory;
|
||||
|
||||
Settings.Domain = Global.Emulator.MemoryDomains.MainMemory;
|
||||
MessageLabel.Text = "Search restarted";
|
||||
DoDomainSizeCheck();
|
||||
NewSearch();
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private int defaultWidth;
|
||||
private int defaultHeight;
|
||||
private readonly WatchList Watches = new WatchList(Global.Emulator.MainMemory);
|
||||
private string _sortedColumn = "";
|
||||
private readonly WatchList Watches = new WatchList(Global.Emulator.MemoryDomains.MainMemory);
|
||||
private string _sortedColumn = String.Empty;
|
||||
private bool _sortReverse = false;
|
||||
|
||||
public bool UpdateBefore { get { return true; } }
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_watchList.AddRange(watches);
|
||||
}
|
||||
_mode = mode;
|
||||
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, domain ?? Global.Emulator.MainMemory);
|
||||
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, domain ?? Global.Emulator.MemoryDomains.MainMemory);
|
||||
SetTitle();
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
var domain = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()) ??
|
||||
Global.Emulator.MainMemory;
|
||||
Global.Emulator.MemoryDomains.MainMemory;
|
||||
BigEndianCheckBox.Checked = domain.EndianType == MemoryDomain.Endian.Big;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ namespace BizHawk.Emulation.Common
|
|||
public NullEmulator(CoreComm comm)
|
||||
{
|
||||
CoreComm = comm;
|
||||
var domains = new List<MemoryDomain>(1)
|
||||
var domains = new MemoryDomainList(
|
||||
new List<MemoryDomain>
|
||||
{
|
||||
new MemoryDomain("Main RAM", 1, MemoryDomain.Endian.Little, addr => 0, (a, v) => { })
|
||||
};
|
||||
memoryDomains = domains.AsReadOnly();
|
||||
});
|
||||
}
|
||||
public void ResetCounters()
|
||||
{
|
||||
|
@ -63,16 +63,15 @@ namespace BizHawk.Emulation.Common
|
|||
public byte[] SaveStateBinary() { return new byte[1]; }
|
||||
public bool BinarySaveStatesPreferred { get { return false; } }
|
||||
public int[] GetVideoBuffer() { return frameBuffer; }
|
||||
public int VirtualWidth { get { return 256; } }
|
||||
public int BufferWidth { get { return 256; } }
|
||||
public int VirtualWidth { get { return 256; } }
|
||||
public int BufferWidth { get { return 256; } }
|
||||
public int BufferHeight { get { return 192; } }
|
||||
public int BackgroundColor { get { return 0; } }
|
||||
public void GetSamples(short[] samples) { }
|
||||
public void DiscardSamples() { }
|
||||
public int MaxVolume { get; set; }
|
||||
private readonly IList<MemoryDomain> memoryDomains;
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
private readonly MemoryDomainList memoryDomains;
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
||||
|
|
|
@ -6,15 +6,21 @@ namespace BizHawk.Emulation.Common
|
|||
{
|
||||
public interface IEmulator : IDisposable
|
||||
{
|
||||
IVideoProvider VideoProvider { get; }
|
||||
/// <summary>
|
||||
/// sound provider for async operation. this is optional, and is only required after StartAsyncSound() is called and returns true
|
||||
/// Video provider to the client
|
||||
/// </summary>
|
||||
IVideoProvider VideoProvider { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sound provider for async operation. this is optional, and is only required after StartAsyncSound() is called and returns true
|
||||
/// </summary>
|
||||
ISoundProvider SoundProvider { get; }
|
||||
|
||||
/// <summary>
|
||||
/// sound provider for sync operation. this is manditory
|
||||
/// </summary>
|
||||
ISyncSoundProvider SyncSoundProvider { get; }
|
||||
|
||||
/// <summary>start async operation. (on construct, sync operation is assumed).</summary>
|
||||
/// <returns>false if core doesn't support async sound; SyncSoundProvider will continue to be used in that case</returns>
|
||||
bool StartAsyncSound();
|
||||
|
@ -23,18 +29,48 @@ namespace BizHawk.Emulation.Common
|
|||
/// </summary>
|
||||
void EndAsyncSound();
|
||||
|
||||
/// <summary>
|
||||
/// Defines all the possible inputs and types that the core can receive
|
||||
/// </summary>
|
||||
ControllerDefinition ControllerDefinition { get; }
|
||||
IController Controller { get; set; }
|
||||
|
||||
// note that some? cores expect you to call SoundProvider.GetSamples() after each FrameAdvance()
|
||||
/// <summary>
|
||||
// note that (some?) cores expect you to call SoundProvider.GetSamples() after each FrameAdvance()
|
||||
// please do this, even when rendersound = false
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
void FrameAdvance(bool render, bool rendersound = true);
|
||||
|
||||
/// <summary>
|
||||
/// The frame count
|
||||
/// </summary>
|
||||
int Frame { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The lag count.
|
||||
/// </summary>
|
||||
int LagCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the current frame is a lag frame.
|
||||
/// All cores should define it the same, a lag frame is a frame in which input was not polled.
|
||||
/// </summary>
|
||||
bool IsLagFrame { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique Id of the given core, for instance "NES"
|
||||
/// </summary>
|
||||
string SystemId { get; }
|
||||
/// <summary>if you want to set this, look in the emulator's constructor or Load() method</summary>
|
||||
|
||||
/// <summary>
|
||||
/// This flag is a contract with the client.
|
||||
/// If true, the core agrees to behave in a completely deterministic manner,
|
||||
/// Features like movie recording depend on this.
|
||||
/// It is the client's responsibility to manage this flag.
|
||||
/// If a core wants to implement non-deterministic features (like speed hacks, frame-skipping), it must be done only when this flag is false
|
||||
/// if you want to set this, look in the emulator's constructor or Load() method
|
||||
/// </summary>
|
||||
bool DeterministicEmulation { get; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -57,10 +93,20 @@ namespace BizHawk.Emulation.Common
|
|||
/// </summary>
|
||||
void ClearSaveRam();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not Save ram has been modified since the last save
|
||||
/// </summary>
|
||||
bool SaveRamModified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Resets the Frame and Lag counters, and any other similar counters a core might implement
|
||||
/// </summary>
|
||||
void ResetCounters();
|
||||
|
||||
/// <summary>
|
||||
/// Savestate handling methods
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
void SaveStateText(TextWriter writer);
|
||||
void LoadStateText(TextReader reader);
|
||||
void SaveStateBinary(BinaryWriter writer);
|
||||
|
@ -77,10 +123,19 @@ namespace BizHawk.Emulation.Common
|
|||
/// </summary>
|
||||
CoreComm CoreComm { get; }
|
||||
|
||||
// ----- Client Debugging API stuff -----
|
||||
IList<MemoryDomain> MemoryDomains { get; }
|
||||
|
||||
// this MUST BE the same as MemoryDomains[0], else DRAGONS
|
||||
MemoryDomain MainMemory { get; }
|
||||
/// <summary>
|
||||
|
||||
///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 "Open 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
|
||||
MemoryDomainList MemoryDomains { get; }
|
||||
}
|
||||
|
||||
public enum DisplayType { NTSC, PAL, DENDY }
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
|
@ -100,4 +103,35 @@ namespace BizHawk.Emulation.Common
|
|||
}
|
||||
}
|
||||
|
||||
public class MemoryDomainList : ReadOnlyCollection<MemoryDomain>
|
||||
{
|
||||
private int _mainMemoryIndex = 0;
|
||||
|
||||
public MemoryDomainList(IList<MemoryDomain> domains)
|
||||
: base(domains)
|
||||
{
|
||||
}
|
||||
|
||||
public MemoryDomainList(IList<MemoryDomain> domains, int mainMemoryIndex)
|
||||
: this(domains)
|
||||
{
|
||||
_mainMemoryIndex = mainMemoryIndex;
|
||||
}
|
||||
|
||||
public MemoryDomain this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.FirstOrDefault(x => x.Name == name);
|
||||
}
|
||||
}
|
||||
|
||||
public MemoryDomain MainMemory
|
||||
{
|
||||
get
|
||||
{
|
||||
return this[_mainMemoryIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
|
||||
// bizhawk I/O
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
||||
|
||||
// game/rom specific
|
||||
public GameInfo game;
|
||||
public string SystemId { get { return "C64"; } }
|
||||
|
@ -25,9 +25,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
public string BoardName { get { return null; } }
|
||||
|
||||
// memory domains
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
private IList<MemoryDomain> memoryDomains;
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
private MemoryDomainList memoryDomains;
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
|
||||
// running state
|
||||
public bool DeterministicEmulation { get { return true; } set { ; } }
|
||||
|
@ -71,19 +70,19 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
};
|
||||
|
||||
// framework
|
||||
public C64(CoreComm comm, GameInfo game, byte[] rom, string romextension)
|
||||
{
|
||||
inputFileInfo = new InputFileInfo();
|
||||
inputFileInfo.Data = rom;
|
||||
inputFileInfo.Extension = romextension;
|
||||
CoreComm = comm;
|
||||
Init(Region.PAL);
|
||||
cyclesPerFrame = board.vic.CyclesPerFrame;
|
||||
CoreComm.UsesDriveLed = true;
|
||||
SetupMemoryDomains();
|
||||
}
|
||||
public C64(CoreComm comm, GameInfo game, byte[] rom, string romextension)
|
||||
{
|
||||
inputFileInfo = new InputFileInfo();
|
||||
inputFileInfo.Data = rom;
|
||||
inputFileInfo.Extension = romextension;
|
||||
CoreComm = comm;
|
||||
Init(Region.PAL);
|
||||
cyclesPerFrame = board.vic.CyclesPerFrame;
|
||||
CoreComm.UsesDriveLed = true;
|
||||
SetupMemoryDomains();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public void Dispose()
|
||||
{
|
||||
if (board.sid != null)
|
||||
{
|
||||
|
@ -95,37 +94,37 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
// process frame
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
board.inputRead = false;
|
||||
board.inputRead = false;
|
||||
board.PollInput();
|
||||
|
||||
for (int count = 0; count < cyclesPerFrame; count++)
|
||||
for (int count = 0; count < cyclesPerFrame; count++)
|
||||
{
|
||||
//disk.Execute();
|
||||
board.Execute();
|
||||
|
||||
// load PRG file if needed
|
||||
if (loadPrg)
|
||||
{
|
||||
// check to see if cpu PC is at the BASIC warm start vector
|
||||
if (board.cpu.PC == ((board.ram.Peek(0x0303) << 8) | board.ram.Peek(0x0302)))
|
||||
{
|
||||
//board.ram.Poke(0x0302, 0xAE);
|
||||
//board.ram.Poke(0x0303, 0xA7);
|
||||
////board.ram.Poke(0x0302, board.ram.Peek(0x0308));
|
||||
////board.ram.Poke(0x0303, board.ram.Peek(0x0309));
|
||||
// load PRG file if needed
|
||||
if (loadPrg)
|
||||
{
|
||||
// check to see if cpu PC is at the BASIC warm start vector
|
||||
if (board.cpu.PC == ((board.ram.Peek(0x0303) << 8) | board.ram.Peek(0x0302)))
|
||||
{
|
||||
//board.ram.Poke(0x0302, 0xAE);
|
||||
//board.ram.Poke(0x0303, 0xA7);
|
||||
////board.ram.Poke(0x0302, board.ram.Peek(0x0308));
|
||||
////board.ram.Poke(0x0303, board.ram.Peek(0x0309));
|
||||
|
||||
//if (inputFileInfo.Data.Length >= 6)
|
||||
//{
|
||||
// board.ram.Poke(0x0039, inputFileInfo.Data[4]);
|
||||
// board.ram.Poke(0x003A, inputFileInfo.Data[5]);
|
||||
//}
|
||||
Media.PRG.Load(board.pla, inputFileInfo.Data);
|
||||
loadPrg = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (inputFileInfo.Data.Length >= 6)
|
||||
//{
|
||||
// board.ram.Poke(0x0039, inputFileInfo.Data[4]);
|
||||
// board.ram.Poke(0x003A, inputFileInfo.Data[5]);
|
||||
//}
|
||||
Media.PRG.Load(board.pla, inputFileInfo.Data);
|
||||
loadPrg = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
board.Flush();
|
||||
board.Flush();
|
||||
_islag = !board.inputRead;
|
||||
|
||||
if (_islag)
|
||||
|
@ -168,7 +167,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
//domains.Add(new MemoryDomain("1541 VIA0", 0x10, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekVia0), new Action<int, byte>(disk.PokeVia0)));
|
||||
//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 = domains.AsReadOnly();
|
||||
memoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace BizHawk
|
|||
(addr, value) => m6532.WriteMemory((ushort) addr, value)),
|
||||
new MemoryDomain("System Bus", 8192, MemoryDomain.Endian.Little, addr => mapper.PeekMemory((ushort) addr), (addr, value) => { })
|
||||
};
|
||||
memoryDomains = domains.AsReadOnly();
|
||||
memoryDomains = new MemoryDomainList(domains);
|
||||
CoreComm.CpuTraceAvailable = true;
|
||||
this.rom = rom;
|
||||
this.game = game;
|
||||
|
@ -106,9 +106,8 @@ namespace BizHawk
|
|||
|
||||
public bool BinarySaveStatesPreferred { get { return false; } }
|
||||
|
||||
private readonly IList<MemoryDomain> memoryDomains;
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
private readonly MemoryDomainList memoryDomains;
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,7 @@ namespace BizHawk.Emulation
|
|||
public CoreComm CoreComm { get; private set; }
|
||||
public bool DeterministicEmulation { get; set; }
|
||||
private List<MemoryDomain> _MemoryDomains;
|
||||
public IList<MemoryDomain> MemoryDomains { get; private set; }
|
||||
public MemoryDomain MainMemory { get { return MemoryDomains[0]; } }
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
public int Frame { get { return _frame; } set { _frame = value; } }
|
||||
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
|
||||
|
@ -314,7 +313,7 @@ namespace BizHawk.Emulation
|
|||
else // todo 2600?
|
||||
{
|
||||
}
|
||||
MemoryDomains = _MemoryDomains.AsReadOnly();
|
||||
MemoryDomains = new MemoryDomainList(_MemoryDomains);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -612,21 +612,26 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
|||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
private IList<MemoryDomain> memoryDomains;
|
||||
private MemoryDomainList _memoryDomains;
|
||||
private const ushort RamSizeMask = 0x7FFF;
|
||||
|
||||
private void SetupMemoryDomains()
|
||||
{
|
||||
var domains = new List<MemoryDomain>();
|
||||
var MainMemoryDomain = new MemoryDomain("Main RAM", ram.Length, MemoryDomain.Endian.Little,
|
||||
addr => ram[addr & RamSizeMask],
|
||||
(addr, value) => ram[addr & RamSizeMask] = value);
|
||||
domains.Add(MainMemoryDomain);
|
||||
memoryDomains = domains.AsReadOnly();
|
||||
var domains = new List<MemoryDomain>
|
||||
{
|
||||
new MemoryDomain(
|
||||
"Main RAM",
|
||||
ram.Length,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => ram[addr & RamSizeMask],
|
||||
(addr, value) => ram[addr & RamSizeMask] = value
|
||||
)
|
||||
};
|
||||
|
||||
_memoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
public MemoryDomainList MemoryDomains { get { return _memoryDomains; } }
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
|
|
|
@ -46,9 +46,8 @@ namespace BizHawk.Emulation.Consoles.Coleco
|
|||
SetupMemoryDomains();
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
IList<MemoryDomain> memoryDomains;
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
MemoryDomainList memoryDomains;
|
||||
const ushort RamSizeMask = 0x03FF;
|
||||
void SetupMemoryDomains()
|
||||
{
|
||||
|
@ -66,7 +65,7 @@ namespace BizHawk.Emulation.Consoles.Coleco
|
|||
domains.Add(MainMemoryDomain);
|
||||
domains.Add(VRamDomain);
|
||||
domains.Add(SystemBusDomain);
|
||||
memoryDomains = domains.AsReadOnly();
|
||||
memoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
|
||||
public void FrameAdvance(bool render, bool renderSound)
|
||||
|
|
|
@ -187,12 +187,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision
|
|||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public MemoryDomain MainMemory
|
||||
public MemoryDomainList MemoryDomains
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
|
|
@ -206,12 +206,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
|
|||
#region memorydomains
|
||||
|
||||
List<MemoryDomain> _MemoryDomains = new List<MemoryDomain>();
|
||||
public IList<MemoryDomain> MemoryDomains { get { return _MemoryDomains; } }
|
||||
public MemoryDomain MainMemory
|
||||
{
|
||||
// some core tools assume MainMemory == MemoryDomains[0], so do that anyway
|
||||
get { return MemoryDomains[0]; }
|
||||
}
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
void AddMemoryDomain(LibMeteor.MemoryArea which, int size, string name)
|
||||
{
|
||||
|
@ -290,6 +285,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
|
|||
});
|
||||
_MemoryDomains.Add(cr);
|
||||
}
|
||||
|
||||
MemoryDomains = new MemoryDomainList(_MemoryDomains);
|
||||
}
|
||||
|
||||
public void GetGPUMemoryAreas(out IntPtr vram, out IntPtr palram, out IntPtr oam, out IntPtr mmio)
|
||||
|
|
|
@ -608,12 +608,11 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
|
||||
MemoryRefreshers.Add(refresher);
|
||||
|
||||
MemoryDomains.Add(new MemoryDomain(name, length, MemoryDomain.Endian.Little, refresher.Peek, refresher.Poke));
|
||||
_MemoryDomains.Add(new MemoryDomain(name, length, MemoryDomain.Endian.Little, refresher.Peek, refresher.Poke));
|
||||
}
|
||||
|
||||
void InitMemoryDomains()
|
||||
{
|
||||
MemoryDomains = new List<MemoryDomain>();
|
||||
MemoryRefreshers = new List<MemoryRefresher>();
|
||||
|
||||
CreateMemoryDomain(LibGambatte.MemoryAreas.wram, "WRAM");
|
||||
|
@ -625,7 +624,7 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
|
||||
// also add a special memory domain for the system bus, where calls get sent directly to the core each time
|
||||
|
||||
MemoryDomains.Add(new MemoryDomain("System Bus", 65536, MemoryDomain.Endian.Little,
|
||||
_MemoryDomains.Add(new MemoryDomain("System Bus", 65536, MemoryDomain.Endian.Little,
|
||||
delegate(int addr)
|
||||
{
|
||||
return LibGambatte.gambatte_cpuread(GambatteState, (ushort)addr);
|
||||
|
@ -635,13 +634,12 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
LibGambatte.gambatte_cpuwrite(GambatteState, (ushort)addr, val);
|
||||
}));
|
||||
|
||||
// this is the wram area and matches the bizhawk convention for what MainMemory means
|
||||
MainMemory = MemoryDomains[0];
|
||||
MemoryDomains = new MemoryDomainList(_MemoryDomains);
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get; private set; }
|
||||
private List<MemoryDomain> _MemoryDomains = new List<MemoryDomain>();
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
public MemoryDomain MainMemory { get; private set; }
|
||||
|
||||
List<MemoryRefresher> MemoryRefreshers;
|
||||
|
||||
|
|
|
@ -307,8 +307,7 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get; private set; }
|
||||
public MemoryDomain MainMemory { get { return MemoryDomains[0]; } }
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
void SetMemoryDomains()
|
||||
{
|
||||
|
@ -319,7 +318,7 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
foreach (var md in R.MemoryDomains)
|
||||
mm.Add(new MemoryDomain("R " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte));
|
||||
|
||||
MemoryDomains = mm.AsReadOnly();
|
||||
MemoryDomains = new MemoryDomainList(mm);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -284,14 +284,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
Marshal.WriteByte(memPtr + addr, val);
|
||||
});
|
||||
|
||||
MemoryDomains.Add(md);
|
||||
memoryDomains.Add(md);
|
||||
|
||||
return md;
|
||||
}
|
||||
|
||||
void InitMemoryDomains()
|
||||
{
|
||||
MemoryDomains = new List<MemoryDomain>();
|
||||
MakeMemoryDomain("RDRAM", mupen64plusApi.N64_MEMORY.RDRAM, MemoryDomain.Endian.Little);
|
||||
MakeMemoryDomain("PI Register", mupen64plusApi.N64_MEMORY.PI_REG, MemoryDomain.Endian.Little);
|
||||
MakeMemoryDomain("SI Register", mupen64plusApi.N64_MEMORY.SI_REG, MemoryDomain.Endian.Little);
|
||||
|
@ -304,10 +303,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
MakeMemoryDomain("Mempak 2", mupen64plusApi.N64_MEMORY.MEMPAK2, MemoryDomain.Endian.Little);
|
||||
MakeMemoryDomain("Mempak 3", mupen64plusApi.N64_MEMORY.MEMPAK3, MemoryDomain.Endian.Little);
|
||||
MakeMemoryDomain("Mempak 4", mupen64plusApi.N64_MEMORY.MEMPAK4, MemoryDomain.Endian.Little);
|
||||
|
||||
MemoryDomains = new MemoryDomainList(memoryDomains);
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get; private set; }
|
||||
public MemoryDomain MainMemory { get { return MemoryDomains[0]; } }
|
||||
private List<MemoryDomain> memoryDomains = new List<MemoryDomain>();
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
set { }
|
||||
}
|
||||
|
||||
private IList<MemoryDomain> memoryDomains;
|
||||
private MemoryDomainList memoryDomains;
|
||||
|
||||
private void SetupMemoryDomains()
|
||||
{
|
||||
|
@ -472,7 +472,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
var RAM = new MemoryDomain("RAM", 0x800, MemoryDomain.Endian.Little,
|
||||
addr => ram[addr & 0x07FF], (addr, value) => ram[addr & 0x07FF] = value);
|
||||
var SystemBus = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little,
|
||||
addr => ReadMemory((ushort)addr), (addr, value) => ApplySystemBusPoke(addr, value)); //WriteMemory((ushort)addr, value));
|
||||
addr => ReadMemory((ushort)addr), (addr, value) => ApplySystemBusPoke(addr, value));
|
||||
var PPUBus = new MemoryDomain("PPU Bus", 0x4000, MemoryDomain.Endian.Little,
|
||||
addr => ppu.ppubus_peek(addr), (addr, value) => ppu.ppubus_write(addr, value));
|
||||
var CIRAMdomain = new MemoryDomain("CIRAM (nametables)", 0x800, MemoryDomain.Endian.Little,
|
||||
|
@ -524,12 +524,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
else if (board is ExROM)
|
||||
domains.Add((board as ExROM).GetExRAM());
|
||||
|
||||
memoryDomains = domains.AsReadOnly();
|
||||
memoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
|
||||
public string SystemId { get { return "NES"; } }
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
|
||||
public string GameName { get { return game_name; } }
|
||||
|
||||
|
|
|
@ -864,14 +864,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
(addr) => blockptr[addr & mask],
|
||||
(addr, value) => blockptr[addr & mask] = value);
|
||||
|
||||
MemoryDomains.Add(md);
|
||||
_memoryDomains.Add(md);
|
||||
|
||||
return md;
|
||||
}
|
||||
|
||||
void SetupMemoryDomains(byte[] romData, byte[] sgbRomData)
|
||||
{
|
||||
MemoryDomains = new List<MemoryDomain>();
|
||||
// remember, MainMemory must always be the same as MemoryDomains[0], else GIANT DRAGONS
|
||||
//<zeromus> - this is stupid.
|
||||
|
||||
|
@ -886,7 +885,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
var romDomain = new MemoryDomain("SGB CARTROM", romData.Length, MemoryDomain.Endian.Little,
|
||||
(addr) => romData[addr],
|
||||
(addr, value) => romData[addr] = value);
|
||||
MemoryDomains.Add(romDomain);
|
||||
_memoryDomains.Add(romDomain);
|
||||
|
||||
|
||||
//the last 1 byte of this is special.. its an interrupt enable register, instead of ram. weird. maybe its actually ram and just getting specially used?
|
||||
|
@ -899,7 +898,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
var sgbromDomain = new MemoryDomain("SGB.SFC ROM", sgbRomData.Length, MemoryDomain.Endian.Little,
|
||||
(addr) => sgbRomData[addr],
|
||||
(addr, value) => sgbRomData[addr] = value);
|
||||
MemoryDomains.Add(sgbromDomain);
|
||||
_memoryDomains.Add(sgbromDomain);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -908,7 +907,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
var romDomain = new MemoryDomain("CARTROM", romData.Length, MemoryDomain.Endian.Little,
|
||||
(addr) => romData[addr],
|
||||
(addr, value) => romData[addr] = value);
|
||||
MemoryDomains.Add(romDomain);
|
||||
_memoryDomains.Add(romDomain);
|
||||
|
||||
MakeMemoryDomain("CARTRAM", LibsnesApi.SNES_MEMORY.CARTRIDGE_RAM, MemoryDomain.Endian.Little);
|
||||
MakeMemoryDomain("VRAM", LibsnesApi.SNES_MEMORY.VRAM, MemoryDomain.Endian.Little);
|
||||
|
@ -917,15 +916,18 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
MakeMemoryDomain("APURAM", LibsnesApi.SNES_MEMORY.APURAM, MemoryDomain.Endian.Little);
|
||||
|
||||
if (!DeterministicEmulation)
|
||||
MemoryDomains.Add(new MemoryDomain("BUS", 0x1000000, MemoryDomain.Endian.Little,
|
||||
_memoryDomains.Add(new MemoryDomain("BUS", 0x1000000, MemoryDomain.Endian.Little,
|
||||
(addr) => api.peek(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr),
|
||||
(addr, val) => api.poke(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr, val)));
|
||||
|
||||
}
|
||||
|
||||
MemoryDomains = new MemoryDomainList(_memoryDomains);
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get; private set; }
|
||||
public MemoryDomain MainMemory { get; private set; }
|
||||
private MemoryDomain MainMemory;
|
||||
private List<MemoryDomain> _memoryDomains = new List<MemoryDomain>();
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
#region audio stuff
|
||||
|
||||
|
|
|
@ -592,12 +592,11 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
domains.Add(ArcadeRamMemoryDomain);
|
||||
}
|
||||
|
||||
memoryDomains = domains.AsReadOnly();
|
||||
memoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
|
||||
IList<MemoryDomain> memoryDomains;
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
MemoryDomainList memoryDomains;
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
@ -59,6 +59,8 @@ namespace BizHawk.Emulation.Consoles.PSX
|
|||
CoreComm = comm;
|
||||
VirtualWidth = BufferWidth = 256;
|
||||
BufferHeight = 192;
|
||||
|
||||
MemoryDomains = new MemoryDomainList(memoryDomains);
|
||||
}
|
||||
|
||||
void Attach()
|
||||
|
@ -267,9 +269,8 @@ namespace BizHawk.Emulation.Consoles.PSX
|
|||
public void GetSamples(short[] samples) { }
|
||||
public void DiscardSamples() { }
|
||||
public int MaxVolume { get; set; }
|
||||
private IList<MemoryDomain> memoryDomains;
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
private List<MemoryDomain> memoryDomains = new List<MemoryDomain>();
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -414,7 +414,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
|
||||
public bool BinarySaveStatesPreferred { get { return false; } }
|
||||
|
||||
IList<MemoryDomain> memoryDomains;
|
||||
MemoryDomainList memoryDomains;
|
||||
|
||||
void SetupMemoryDomains()
|
||||
{
|
||||
|
@ -443,11 +443,10 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
domains.Add(VRamDomain);
|
||||
domains.Add(RomDomain);
|
||||
domains.Add(SystemBusDomain);
|
||||
memoryDomains = domains.AsReadOnly();
|
||||
memoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
|
|
@ -393,7 +393,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
|
||||
readonly string[] validRegions = { "Export", "Japan" };
|
||||
|
||||
IList<MemoryDomain> memoryDomains;
|
||||
MemoryDomainList memoryDomains;
|
||||
|
||||
void SetupMemoryDomains()
|
||||
{
|
||||
|
@ -415,11 +415,10 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
domains.Add(VRamDomain);
|
||||
domains.Add(SaveRamDomain);
|
||||
domains.Add(SystemBusDomain);
|
||||
memoryDomains = domains.AsReadOnly();
|
||||
memoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
|
|
@ -469,11 +469,10 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
var tmp = ret[2];
|
||||
ret[2] = ret[0];
|
||||
ret[0] = tmp;
|
||||
MemoryDomains = ret.AsReadOnly();
|
||||
MemoryDomains = new MemoryDomainList(ret);
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains { get; private set; }
|
||||
public MemoryDomain MainMemory { get { return MemoryDomains[0]; } }
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -183,18 +183,11 @@ namespace BizHawk.Emulation.Consoles.Sony.PSP
|
|||
return new byte[0];
|
||||
}
|
||||
|
||||
public IList<MemoryDomain> MemoryDomains
|
||||
public MemoryDomainList MemoryDomains
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public MemoryDomain MainMemory
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
const int screenwidth = 480;
|
||||
const int screenheight = 272;
|
||||
readonly int[] screenbuffer = new int[screenwidth * screenheight];
|
||||
|
|
Loading…
Reference in New Issue