add ByteSize to MemoryDomain with a default of 1, set it to not 1 on appropriate domains (I probably missed some, or got some wrong). Have RamSearch use that instead of SystemInfo, remove ByteSize from SystemInfo since it is no longer needed

This commit is contained in:
adelikat 2015-02-22 15:19:38 +00:00
parent 7155067e89
commit 36f4eff0f6
11 changed files with 93 additions and 103 deletions

View File

@ -8,7 +8,6 @@ namespace BizHawk.Client.Common
public SystemInfo() { } public SystemInfo() { }
public string DisplayName { get; set; } public string DisplayName { get; set; }
public int ByteSize { get; set; } // For Ram tools, whether it is a 8/16/32 bit system
public static SystemInfo Null public static SystemInfo Null
{ {
@ -17,7 +16,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "", DisplayName = "",
ByteSize = 1,
}; };
} }
} }
@ -29,7 +27,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "NES", DisplayName = "NES",
ByteSize = 1,
}; };
} }
} }
@ -41,7 +38,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Intellivision", DisplayName = "Intellivision",
ByteSize = 2,
}; };
} }
} }
@ -53,7 +49,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Sega Master System", DisplayName = "Sega Master System",
ByteSize = 1,
}; };
} }
} }
@ -65,7 +60,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "SG-1000", DisplayName = "SG-1000",
ByteSize = 1,
}; };
} }
} }
@ -77,7 +71,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Game Gear", DisplayName = "Game Gear",
ByteSize = 1,
}; };
} }
} }
@ -89,7 +82,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "TurboGrafx-16", DisplayName = "TurboGrafx-16",
ByteSize = 2,
}; };
} }
} }
@ -101,7 +93,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "TurboGrafx-16 (CD)", DisplayName = "TurboGrafx-16 (CD)",
ByteSize = 2,
}; };
} }
} }
@ -113,7 +104,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "SuperGrafx", DisplayName = "SuperGrafx",
ByteSize = 2,
}; };
} }
} }
@ -125,7 +115,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Genesis", DisplayName = "Genesis",
ByteSize = 2,
}; };
} }
} }
@ -137,7 +126,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "TI-83", DisplayName = "TI-83",
ByteSize = 1,
}; };
} }
} }
@ -149,7 +137,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "SNES", DisplayName = "SNES",
ByteSize = 2,
}; };
} }
} }
@ -161,7 +148,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Gameboy", DisplayName = "Gameboy",
ByteSize = 1,
}; };
} }
} }
@ -173,7 +159,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Gameboy Color", DisplayName = "Gameboy Color",
ByteSize = 1,
}; };
} }
} }
@ -185,7 +170,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Atari 2600", DisplayName = "Atari 2600",
ByteSize = 1,
}; };
} }
} }
@ -197,7 +181,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Atari 7800", DisplayName = "Atari 7800",
ByteSize = 1,
}; };
} }
} }
@ -209,7 +192,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Commodore 64", DisplayName = "Commodore 64",
ByteSize = 1,
}; };
} }
} }
@ -221,7 +203,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "ColecoVision", DisplayName = "ColecoVision",
ByteSize = 1,
}; };
} }
} }
@ -233,7 +214,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Gameboy Advance", DisplayName = "Gameboy Advance",
ByteSize = 4,
}; };
} }
} }
@ -245,7 +225,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Nintendo 64", DisplayName = "Nintendo 64",
ByteSize = 4,
}; };
} }
} }
@ -257,7 +236,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Saturn", DisplayName = "Saturn",
ByteSize = 4,
}; };
} }
} }
@ -269,7 +247,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Game Boy Link", DisplayName = "Game Boy Link",
ByteSize = 1,
}; };
} }
} }
@ -281,7 +258,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "WonderSwan", DisplayName = "WonderSwan",
ByteSize = 1,
}; };
} }
} }
@ -292,7 +268,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Lynx", DisplayName = "Lynx",
ByteSize = 2,
}; };
} }
} }
@ -303,7 +278,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "PlayStation", DisplayName = "PlayStation",
ByteSize = 4,
}; };
} }
} }
@ -314,7 +288,6 @@ namespace BizHawk.Client.Common
return new SystemInfo return new SystemInfo
{ {
DisplayName = "Apple II", DisplayName = "Apple II",
ByteSize = 1,
}; };
} }
} }

View File

@ -1177,8 +1177,7 @@ namespace BizHawk.Client.Common
public Settings(IMemoryDomains memoryDomains) public Settings(IMemoryDomains memoryDomains)
{ {
BigEndian = 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)memoryDomains.MainMemory.ByteSize;
Size = (Watch.WatchSize)Global.SystemInfo.ByteSize;
Type = Watch.DisplayType.Unsigned; Type = Watch.DisplayType.Unsigned;
Mode = memoryDomains.MainMemory.Size > (1024 * 1024) ? Mode = memoryDomains.MainMemory.Size > (1024 * 1024) ?
SearchMode.Fast : SearchMode.Fast :

View File

@ -9,10 +9,11 @@ namespace BizHawk.Emulation.Common
{ {
public enum Endian { Big, Little, Unknown } public enum Endian { Big, Little, Unknown }
public MemoryDomain(string name, long size, Endian endian, Func<long, byte> peekByte, Action<long, byte> pokeByte) public MemoryDomain(string name, long size, Endian endian, Func<long, byte> peekByte, Action<long, byte> pokeByte, int byteSize = 1)
{ {
Name = name; Name = name;
Size = size; Size = size;
ByteSize = byteSize;
EndianType = endian; EndianType = endian;
PeekByte = peekByte; PeekByte = peekByte;
PokeByte = pokeByte; PokeByte = pokeByte;
@ -22,6 +23,8 @@ namespace BizHawk.Emulation.Common
public long Size { get; private set; } public long Size { get; private set; }
public int ByteSize { get; private set; }
public Endian EndianType { get; private set; } public Endian EndianType { get; private set; }
public Func<long, byte> PeekByte { get; private set; } public Func<long, byte> PeekByte { get; private set; }
@ -36,7 +39,7 @@ namespace BizHawk.Emulation.Common
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="writable">if false, writes will be ignored</param> /// <param name="writable">if false, writes will be ignored</param>
/// <returns></returns> /// <returns></returns>
public static MemoryDomain FromByteArray(string name, Endian endian, byte[] data, bool writable = true) public static MemoryDomain FromByteArray(string name, Endian endian, byte[] data, bool writable = true, int byteSize = 1)
{ {
if (data == null) if (data == null)
throw new ArgumentNullException("data"); throw new ArgumentNullException("data");
@ -54,7 +57,8 @@ namespace BizHawk.Emulation.Common
{ {
data[addr] = val; data[addr] = val;
} }
: (Action<long, byte>)null : (Action<long, byte>)null,
byteSize
); );
} }
@ -64,7 +68,7 @@ namespace BizHawk.Emulation.Common
/// <param name="data">must remain valid as long as the MemoryDomain exists!</param> /// <param name="data">must remain valid as long as the MemoryDomain exists!</param>
/// <param name="writable">if false, writes will be ignored</param> /// <param name="writable">if false, writes will be ignored</param>
/// <returns></returns> /// <returns></returns>
public unsafe static MemoryDomain FromIntPtr(string name, long size, Endian endian, IntPtr data, bool writable = true) public unsafe static MemoryDomain FromIntPtr(string name, long size, Endian endian, IntPtr data, bool writable = true, int byteSize = 1)
{ {
if (data == IntPtr.Zero) if (data == IntPtr.Zero)
throw new ArgumentNullException("data"); throw new ArgumentNullException("data");
@ -90,7 +94,8 @@ namespace BizHawk.Emulation.Common
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
p[addr] = val; p[addr] = val;
} }
: (Action<long, byte>)null : (Action<long, byte>)null,
byteSize
); );
} }
@ -100,7 +105,7 @@ namespace BizHawk.Emulation.Common
/// <param name="data">must remain valid as long as the MemoryDomain exists!</param> /// <param name="data">must remain valid as long as the MemoryDomain exists!</param>
/// <param name="writable">if false, writes will be ignored</param> /// <param name="writable">if false, writes will be ignored</param>
/// <returns></returns> /// <returns></returns>
public unsafe static MemoryDomain FromIntPtrSwap16(string name, long size, Endian endian, IntPtr data, bool writable = true) public unsafe static MemoryDomain FromIntPtrSwap16(string name, long size, Endian endian, IntPtr data, bool writable = true, int byteSize = 1)
{ {
if (data == IntPtr.Zero) if (data == IntPtr.Zero)
throw new ArgumentNullException("data"); throw new ArgumentNullException("data");
@ -126,7 +131,8 @@ namespace BizHawk.Emulation.Common
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
p[addr ^ 1] = val; p[addr ^ 1] = val;
} }
: (Action<long, byte>)null : (Action<long, byte>)null,
byteSize
); );
} }

View File

@ -6,32 +6,32 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Atari.Lynx namespace BizHawk.Emulation.Cores.Atari.Lynx
{ {
public partial class Lynx public partial class Lynx
{ {
private void SetupMemoryDomains() private void SetupMemoryDomains()
{ {
var mms = new List<MemoryDomain>(); var mms = new List<MemoryDomain>();
mms.Add(MemoryDomain.FromIntPtr("RAM", 65536, MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), true)); mms.Add(MemoryDomain.FromIntPtr("RAM", 65536, MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), true, 2));
IntPtr p; IntPtr p;
int s; int s;
if (LibLynx.GetSaveRamPtr(Core, out s, out p)) if (LibLynx.GetSaveRamPtr(Core, out s, out p))
{ {
mms.Add(MemoryDomain.FromIntPtr("Save RAM", s, MemoryDomain.Endian.Little, p, true)); mms.Add(MemoryDomain.FromIntPtr("Save RAM", s, MemoryDomain.Endian.Little, p, true, 2));
} }
IntPtr p0, p1; IntPtr p0, p1;
int s0, s1; int s0, s1;
LibLynx.GetReadOnlyCartPtrs(Core, out s0, out p0, out s1, out p1); LibLynx.GetReadOnlyCartPtrs(Core, out s0, out p0, out s1, out p1);
if (s0 > 0 && p0 != IntPtr.Zero) if (s0 > 0 && p0 != IntPtr.Zero)
mms.Add(MemoryDomain.FromIntPtr("Cart A", s0, MemoryDomain.Endian.Little, p0, false)); mms.Add(MemoryDomain.FromIntPtr("Cart A", s0, MemoryDomain.Endian.Little, p0, false, 2));
if (s1 > 0 && p1 != IntPtr.Zero) if (s1 > 0 && p1 != IntPtr.Zero)
mms.Add(MemoryDomain.FromIntPtr("Cart B", s1, MemoryDomain.Endian.Little, p1, false)); mms.Add(MemoryDomain.FromIntPtr("Cart B", s1, MemoryDomain.Endian.Little, p1, false, 2));
_memoryDomains = new MemoryDomainList(mms); _memoryDomains = new MemoryDomainList(mms);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
} }
private IMemoryDomains _memoryDomains; private IMemoryDomains _memoryDomains;
} }
} }

View File

@ -16,13 +16,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
var s = new LibVBANext.MemoryAreas(); var s = new LibVBANext.MemoryAreas();
var l = MemoryDomain.Endian.Little; var l = MemoryDomain.Endian.Little;
LibVBANext.GetMemoryAreas(Core, s); LibVBANext.GetMemoryAreas(Core, s);
mm.Add(MemoryDomain.FromIntPtr("IWRAM", 32 * 1024, l, s.iwram)); mm.Add(MemoryDomain.FromIntPtr("IWRAM", 32 * 1024, l, s.iwram, true, 4));
mm.Add(MemoryDomain.FromIntPtr("EWRAM", 256 * 1024, l, s.ewram)); mm.Add(MemoryDomain.FromIntPtr("EWRAM", 256 * 1024, l, s.ewram, true, 4));
mm.Add(MemoryDomain.FromIntPtr("BIOS", 16 * 1024, l, s.bios, false)); mm.Add(MemoryDomain.FromIntPtr("BIOS", 16 * 1024, l, s.bios, false, 4));
mm.Add(MemoryDomain.FromIntPtr("PALRAM", 1024, l, s.palram, false)); mm.Add(MemoryDomain.FromIntPtr("PALRAM", 1024, l, s.palram, false, 4));
mm.Add(MemoryDomain.FromIntPtr("VRAM", 96 * 1024, l, s.vram)); mm.Add(MemoryDomain.FromIntPtr("VRAM", 96 * 1024, l, s.vram, true, 4));
mm.Add(MemoryDomain.FromIntPtr("OAM", 1024, l, s.oam)); mm.Add(MemoryDomain.FromIntPtr("OAM", 1024, l, s.oam, true, 4));
mm.Add(MemoryDomain.FromIntPtr("ROM", 32 * 1024 * 1024, l, s.rom)); mm.Add(MemoryDomain.FromIntPtr("ROM", 32 * 1024 * 1024, l, s.rom, true, 4));
mm.Add(new MemoryDomain("System Bus", 0x10000000, l, mm.Add(new MemoryDomain("System Bus", 0x10000000, l,
delegate(long addr) delegate(long addr)
@ -36,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
if (addr < 0 || addr >= 0x10000000) if (addr < 0 || addr >= 0x10000000)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
LibVBANext.SystemBusWrite(Core, (int)addr, val); LibVBANext.SystemBusWrite(Core, (int)addr, val);
})); }, 4));
// special combined ram memory domain // special combined ram memory domain
{ {
var ew = mm[1]; var ew = mm[1];
@ -59,7 +59,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
iw.PokeByte(addr & 32767, val); iw.PokeByte(addr & 32767, val);
else else
ew.PokeByte(addr, val); ew.PokeByte(addr, val);
}); }, 4);
mm.Add(cr); mm.Add(cr);
} }

View File

@ -71,7 +71,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
}; };
} }
var md = new MemoryDomain(name, size, endian, peekByte, pokeByte); var md = new MemoryDomain(name, size, endian, peekByte, pokeByte, 4);
_memoryDomains.Add(md); _memoryDomains.Add(md);
} }

View File

@ -1039,13 +1039,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
var a = FakeBusMap((int)addr); var a = FakeBusMap((int)addr);
if (a.HasValue) if (a.HasValue)
blockptr[a.Value] = val; blockptr[a.Value] = val;
}); }, byteSize: 2);
_memoryDomains.Add(md); _memoryDomains.Add(md);
} }
// ----- Client Debugging API stuff ----- // ----- Client Debugging API stuff -----
unsafe MemoryDomain MakeMemoryDomain(string name, LibsnesApi.SNES_MEMORY id, MemoryDomain.Endian endian) unsafe MemoryDomain MakeMemoryDomain(string name, LibsnesApi.SNES_MEMORY id, MemoryDomain.Endian endian, int byteSize = 1)
{ {
int size = api.QUERY_get_memory_size(id); int size = api.QUERY_get_memory_size(id);
int mask = size - 1; int mask = size - 1;
@ -1067,17 +1067,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
if (size != 544) throw new InvalidOperationException("oam size isnt 544 bytes.. wtf?"); if (size != 544) throw new InvalidOperationException("oam size isnt 544 bytes.. wtf?");
md = new MemoryDomain(name, size, endian, md = new MemoryDomain(name, size, endian,
(addr) => (addr < 544) ? blockptr[addr] : (byte)0x00, (addr) => (addr < 544) ? blockptr[addr] : (byte)0x00,
(addr, value) => { if (addr < 544) blockptr[addr] = value; } (addr, value) => { if (addr < 544) blockptr[addr] = value; },
); byteSize);
} }
else if(pow2) else if(pow2)
md = new MemoryDomain(name, size, endian, md = new MemoryDomain(name, size, endian,
(addr) => blockptr[addr & mask], (addr) => blockptr[addr & mask],
(addr, value) => blockptr[addr & mask] = value); (addr, value) => blockptr[addr & mask] = value, byteSize);
else else
md = new MemoryDomain(name, size, endian, md = new MemoryDomain(name, size, endian,
(addr) => blockptr[addr % size], (addr) => blockptr[addr % size],
(addr, value) => blockptr[addr % size] = value); (addr, value) => blockptr[addr % size] = value, byteSize);
_memoryDomains.Add(md); _memoryDomains.Add(md);
@ -1120,18 +1120,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little); MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little);
MakeMemoryDomain("CARTROM", LibsnesApi.SNES_MEMORY.CARTRIDGE_ROM, MemoryDomain.Endian.Little); MakeMemoryDomain("CARTROM", LibsnesApi.SNES_MEMORY.CARTRIDGE_ROM, MemoryDomain.Endian.Little, byteSize: 2);
MakeMemoryDomain("CARTRAM", LibsnesApi.SNES_MEMORY.CARTRIDGE_RAM, MemoryDomain.Endian.Little); MakeMemoryDomain("CARTRAM", LibsnesApi.SNES_MEMORY.CARTRIDGE_RAM, MemoryDomain.Endian.Little, byteSize: 2);
MakeMemoryDomain("VRAM", LibsnesApi.SNES_MEMORY.VRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("VRAM", LibsnesApi.SNES_MEMORY.VRAM, MemoryDomain.Endian.Little, byteSize: 2);
MakeMemoryDomain("OAM", LibsnesApi.SNES_MEMORY.OAM, MemoryDomain.Endian.Little); MakeMemoryDomain("OAM", LibsnesApi.SNES_MEMORY.OAM, MemoryDomain.Endian.Little, byteSize: 2);
MakeMemoryDomain("CGRAM", LibsnesApi.SNES_MEMORY.CGRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("CGRAM", LibsnesApi.SNES_MEMORY.CGRAM, MemoryDomain.Endian.Little, byteSize: 2);
MakeMemoryDomain("APURAM", LibsnesApi.SNES_MEMORY.APURAM, MemoryDomain.Endian.Little); MakeMemoryDomain("APURAM", LibsnesApi.SNES_MEMORY.APURAM, MemoryDomain.Endian.Little, byteSize: 2);
if (!DeterministicEmulation) if (!DeterministicEmulation)
{ {
_memoryDomains.Add(new MemoryDomain("System Bus", 0x1000000, MemoryDomain.Endian.Little, _memoryDomains.Add(new MemoryDomain("System Bus", 0x1000000, MemoryDomain.Endian.Little,
(addr) => api.QUERY_peek(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr), (addr) => api.QUERY_peek(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr),
(addr, val) => api.QUERY_poke(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr, val))); (addr, val) => api.QUERY_poke(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr, val), byteSize: 2));
} }
else else
{ {

View File

@ -471,7 +471,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
int mainmemorymask = Ram.Length - 1; int mainmemorymask = Ram.Length - 1;
var MainMemoryDomain = new MemoryDomain("Main Memory", Ram.Length, MemoryDomain.Endian.Little, var MainMemoryDomain = new MemoryDomain("Main Memory", Ram.Length, MemoryDomain.Endian.Little,
addr => Ram[addr], addr => Ram[addr],
(addr, value) => Ram[addr] = value); (addr, value) => Ram[addr] = value,
byteSize: 2);
domains.Add(MainMemoryDomain); domains.Add(MainMemoryDomain);
var SystemBusDomain = new MemoryDomain("System Bus (21 bit)", 0x200000, MemoryDomain.Endian.Little, var SystemBusDomain = new MemoryDomain("System Bus (21 bit)", 0x200000, MemoryDomain.Endian.Little,
@ -486,7 +487,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
if (addr < 0 || addr >= 0x200000) if (addr < 0 || addr >= 0x200000)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
Cpu.WriteMemory21((int)addr, value); Cpu.WriteMemory21((int)addr, value);
}); },
byteSize: 2);
domains.Add(SystemBusDomain); domains.Add(SystemBusDomain);
var CpuBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little, var CpuBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little,
@ -501,20 +503,22 @@ namespace BizHawk.Emulation.Cores.PCEngine
if (addr < 0 || addr >= 0x10000) if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
Cpu.WriteMemory((ushort)addr, value); Cpu.WriteMemory((ushort)addr, value);
}); },
byteSize: 2);
domains.Add(CpuBusDomain); domains.Add(CpuBusDomain);
var RomDomain = new MemoryDomain("ROM", RomLength, MemoryDomain.Endian.Little, var RomDomain = new MemoryDomain("ROM", RomLength, MemoryDomain.Endian.Little,
addr => RomData[addr], addr => RomData[addr],
(addr, value) => RomData[addr] = value); (addr, value) => RomData[addr] = value,
byteSize: 2);
domains.Add(RomDomain); domains.Add(RomDomain);
if (BRAM != null) if (BRAM != null)
{ {
var BRAMMemoryDomain = new MemoryDomain("Battery RAM", Ram.Length, MemoryDomain.Endian.Little, var BRAMMemoryDomain = new MemoryDomain("Battery RAM", Ram.Length, MemoryDomain.Endian.Little,
addr => BRAM[addr], addr => BRAM[addr],
(addr, value) => BRAM[addr] = value); (addr, value) => BRAM[addr] = value,
byteSize: 2);
domains.Add(BRAMMemoryDomain); domains.Add(BRAMMemoryDomain);
} }
@ -522,19 +526,22 @@ namespace BizHawk.Emulation.Cores.PCEngine
{ {
var CDRamMemoryDomain = new MemoryDomain("TurboCD RAM", CDRam.Length, MemoryDomain.Endian.Little, var CDRamMemoryDomain = new MemoryDomain("TurboCD RAM", CDRam.Length, MemoryDomain.Endian.Little,
addr => CDRam[addr], addr => CDRam[addr],
(addr, value) => CDRam[addr] = value); (addr, value) => CDRam[addr] = value,
byteSize: 2);
domains.Add(CDRamMemoryDomain); domains.Add(CDRamMemoryDomain);
var AdpcmMemoryDomain = new MemoryDomain("ADPCM RAM", ADPCM.RAM.Length, MemoryDomain.Endian.Little, var AdpcmMemoryDomain = new MemoryDomain("ADPCM RAM", ADPCM.RAM.Length, MemoryDomain.Endian.Little,
addr => ADPCM.RAM[addr], addr => ADPCM.RAM[addr],
(addr, value) => ADPCM.RAM[addr] = value); (addr, value) => ADPCM.RAM[addr] = value,
byteSize: 2);
domains.Add(AdpcmMemoryDomain); domains.Add(AdpcmMemoryDomain);
if (SuperRam != null) if (SuperRam != null)
{ {
var SuperRamMemoryDomain = new MemoryDomain("Super System Card RAM", SuperRam.Length, MemoryDomain.Endian.Little, var SuperRamMemoryDomain = new MemoryDomain("Super System Card RAM", SuperRam.Length, MemoryDomain.Endian.Little,
addr => SuperRam[addr], addr => SuperRam[addr],
(addr, value) => SuperRam[addr] = value); (addr, value) => SuperRam[addr] = value,
byteSize: 2);
domains.Add(SuperRamMemoryDomain); domains.Add(SuperRamMemoryDomain);
} }
} }
@ -543,7 +550,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
{ {
var ArcadeRamMemoryDomain = new MemoryDomain("Arcade Card RAM", ArcadeRam.Length, MemoryDomain.Endian.Little, var ArcadeRamMemoryDomain = new MemoryDomain("Arcade Card RAM", ArcadeRam.Length, MemoryDomain.Endian.Little,
addr => ArcadeRam[addr], addr => ArcadeRam[addr],
(addr, value) => ArcadeRam[addr] = value); (addr, value) => ArcadeRam[addr] = value,
byteSize: 2);
domains.Add(ArcadeRamMemoryDomain); domains.Add(ArcadeRamMemoryDomain);
} }
@ -551,7 +559,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
{ {
var PopulusRAMDomain = new MemoryDomain("Cart Battery RAM", PopulousRAM.Length, MemoryDomain.Endian.Little, var PopulusRAMDomain = new MemoryDomain("Cart Battery RAM", PopulousRAM.Length, MemoryDomain.Endian.Little,
addr => PopulousRAM[addr], addr => PopulousRAM[addr],
(addr, value) => PopulousRAM[addr] = value); (addr, value) => PopulousRAM[addr] = value,
byteSize: 2);
domains.Add(PopulusRAMDomain); domains.Add(PopulusRAMDomain);
} }

View File

@ -18,7 +18,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
{ {
int l = nmd.length; int l = nmd.length;
IntPtr d = nmd.data; IntPtr d = nmd.data;
ret.Add(MemoryDomain.FromIntPtr(nmd.name, nmd.length, MemoryDomain.Endian.Little, nmd.data)); ret.Add(MemoryDomain.FromIntPtr(nmd.name, nmd.length, MemoryDomain.Endian.Little, nmd.data, true, 4));
} }
// main memory is in position 2 // main memory is in position 2

View File

@ -612,11 +612,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
if (addr < 0 || addr >= 65536) if (addr < 0 || addr >= 65536)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
LibGPGX.gpgx_poke_vram(((int)addr) ^ 1, val); LibGPGX.gpgx_poke_vram(((int)addr) ^ 1, val);
})); },
byteSize: 2));
} }
else else
{ {
mm.Add(MemoryDomain.FromIntPtrSwap16(name, size, MemoryDomain.Endian.Big, area)); var byteSize = name.Contains("Z80") ? 1 : 2;
mm.Add(MemoryDomain.FromIntPtrSwap16(name, size, MemoryDomain.Endian.Big, area, writable: true, byteSize: byteSize));
} }
} }
MemoryDomains = new MemoryDomainList(mm); MemoryDomains = new MemoryDomainList(mm);

View File

@ -681,22 +681,22 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
int size; int size;
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.MainRAM); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.MainRAM);
mmd.Add(MemoryDomain.FromIntPtr("MainRAM", size, MemoryDomain.Endian.Little, ptr, true)); mmd.Add(MemoryDomain.FromIntPtr("MainRAM", size, MemoryDomain.Endian.Little, ptr, true, 4));
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.GPURAM); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.GPURAM);
mmd.Add(MemoryDomain.FromIntPtr("GPURAM", size, MemoryDomain.Endian.Little, ptr, true)); mmd.Add(MemoryDomain.FromIntPtr("GPURAM", size, MemoryDomain.Endian.Little, ptr, true, 4));
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.SPURAM); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.SPURAM);
mmd.Add(MemoryDomain.FromIntPtr("SPURAM", size, MemoryDomain.Endian.Little, ptr, true)); mmd.Add(MemoryDomain.FromIntPtr("SPURAM", size, MemoryDomain.Endian.Little, ptr, true, 4));
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.BiosROM); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.BiosROM);
mmd.Add(MemoryDomain.FromIntPtr("BiosROM", size, MemoryDomain.Endian.Little, ptr, true)); mmd.Add(MemoryDomain.FromIntPtr("BiosROM", size, MemoryDomain.Endian.Little, ptr, true, 4));
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.PIOMem); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.PIOMem);
mmd.Add(MemoryDomain.FromIntPtr("PIOMem", size, MemoryDomain.Endian.Little, ptr, true)); mmd.Add(MemoryDomain.FromIntPtr("PIOMem", size, MemoryDomain.Endian.Little, ptr, true, 4));
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.DCache); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.DCache);
mmd.Add(MemoryDomain.FromIntPtr("DCache", size, MemoryDomain.Endian.Little, ptr, true)); mmd.Add(MemoryDomain.FromIntPtr("DCache", size, MemoryDomain.Endian.Little, ptr, true, 4));
MemoryDomains = new MemoryDomainList(mmd); MemoryDomains = new MemoryDomainList(mmd);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains);