diff --git a/BizHawk.Client.Common/SystemInfo.cs b/BizHawk.Client.Common/SystemInfo.cs index 675d2b946c..4915307d60 100644 --- a/BizHawk.Client.Common/SystemInfo.cs +++ b/BizHawk.Client.Common/SystemInfo.cs @@ -8,7 +8,6 @@ namespace BizHawk.Client.Common public SystemInfo() { } 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 { @@ -17,7 +16,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "", - ByteSize = 1, }; } } @@ -29,7 +27,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "NES", - ByteSize = 1, }; } } @@ -41,7 +38,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Intellivision", - ByteSize = 2, }; } } @@ -53,7 +49,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Sega Master System", - ByteSize = 1, }; } } @@ -65,7 +60,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "SG-1000", - ByteSize = 1, }; } } @@ -77,7 +71,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Game Gear", - ByteSize = 1, }; } } @@ -89,7 +82,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "TurboGrafx-16", - ByteSize = 2, }; } } @@ -101,7 +93,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "TurboGrafx-16 (CD)", - ByteSize = 2, }; } } @@ -113,7 +104,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "SuperGrafx", - ByteSize = 2, }; } } @@ -125,7 +115,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Genesis", - ByteSize = 2, }; } } @@ -137,7 +126,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "TI-83", - ByteSize = 1, }; } } @@ -149,7 +137,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "SNES", - ByteSize = 2, }; } } @@ -161,7 +148,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Gameboy", - ByteSize = 1, }; } } @@ -173,7 +159,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Gameboy Color", - ByteSize = 1, }; } } @@ -185,7 +170,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Atari 2600", - ByteSize = 1, }; } } @@ -197,7 +181,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Atari 7800", - ByteSize = 1, }; } } @@ -209,7 +192,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Commodore 64", - ByteSize = 1, }; } } @@ -221,7 +203,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "ColecoVision", - ByteSize = 1, }; } } @@ -233,7 +214,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Gameboy Advance", - ByteSize = 4, }; } } @@ -245,7 +225,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Nintendo 64", - ByteSize = 4, }; } } @@ -257,7 +236,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Saturn", - ByteSize = 4, }; } } @@ -269,7 +247,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Game Boy Link", - ByteSize = 1, }; } } @@ -281,7 +258,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "WonderSwan", - ByteSize = 1, }; } } @@ -292,7 +268,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Lynx", - ByteSize = 2, }; } } @@ -303,7 +278,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "PlayStation", - ByteSize = 4, }; } } @@ -314,7 +288,6 @@ namespace BizHawk.Client.Common return new SystemInfo { DisplayName = "Apple II", - ByteSize = 1, }; } } diff --git a/BizHawk.Client.Common/tools/RamSearchEngine.cs b/BizHawk.Client.Common/tools/RamSearchEngine.cs index 4e6332ca3e..e35ae7527b 100644 --- a/BizHawk.Client.Common/tools/RamSearchEngine.cs +++ b/BizHawk.Client.Common/tools/RamSearchEngine.cs @@ -1177,8 +1177,7 @@ namespace BizHawk.Client.Common public Settings(IMemoryDomains memoryDomains) { 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; + Size = (Watch.WatchSize)memoryDomains.MainMemory.ByteSize; Type = Watch.DisplayType.Unsigned; Mode = memoryDomains.MainMemory.Size > (1024 * 1024) ? SearchMode.Fast : diff --git a/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs b/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs index b9a30f2ebe..f95d29992d 100644 --- a/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs +++ b/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs @@ -9,10 +9,11 @@ namespace BizHawk.Emulation.Common { public enum Endian { Big, Little, Unknown } - public MemoryDomain(string name, long size, Endian endian, Func peekByte, Action pokeByte) + public MemoryDomain(string name, long size, Endian endian, Func peekByte, Action pokeByte, int byteSize = 1) { Name = name; Size = size; + ByteSize = byteSize; EndianType = endian; PeekByte = peekByte; PokeByte = pokeByte; @@ -22,6 +23,8 @@ namespace BizHawk.Emulation.Common public long Size { get; private set; } + public int ByteSize { get; private set; } + public Endian EndianType { get; private set; } public Func PeekByte { get; private set; } @@ -36,7 +39,7 @@ namespace BizHawk.Emulation.Common /// /// if false, writes will be ignored /// - 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) throw new ArgumentNullException("data"); @@ -54,7 +57,8 @@ namespace BizHawk.Emulation.Common { data[addr] = val; } - : (Action)null + : (Action)null, + byteSize ); } @@ -64,7 +68,7 @@ namespace BizHawk.Emulation.Common /// must remain valid as long as the MemoryDomain exists! /// if false, writes will be ignored /// - 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) throw new ArgumentNullException("data"); @@ -90,7 +94,8 @@ namespace BizHawk.Emulation.Common throw new ArgumentOutOfRangeException(); p[addr] = val; } - : (Action)null + : (Action)null, + byteSize ); } @@ -100,7 +105,7 @@ namespace BizHawk.Emulation.Common /// must remain valid as long as the MemoryDomain exists! /// if false, writes will be ignored /// - 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) throw new ArgumentNullException("data"); @@ -126,7 +131,8 @@ namespace BizHawk.Emulation.Common throw new ArgumentOutOfRangeException(); p[addr ^ 1] = val; } - : (Action)null + : (Action)null, + byteSize ); } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.IMemoryDomains.cs index 9762d27c3e..160d3a0db0 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.IMemoryDomains.cs @@ -6,32 +6,32 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Atari.Lynx { - public partial class Lynx - { - private void SetupMemoryDomains() - { - var mms = new List(); - mms.Add(MemoryDomain.FromIntPtr("RAM", 65536, MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), true)); + public partial class Lynx + { + private void SetupMemoryDomains() + { + var mms = new List(); + mms.Add(MemoryDomain.FromIntPtr("RAM", 65536, MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), true, 2)); - IntPtr p; - int s; - if (LibLynx.GetSaveRamPtr(Core, out s, out p)) - { - mms.Add(MemoryDomain.FromIntPtr("Save RAM", s, MemoryDomain.Endian.Little, p, true)); - } + IntPtr p; + int s; + if (LibLynx.GetSaveRamPtr(Core, out s, out p)) + { + mms.Add(MemoryDomain.FromIntPtr("Save RAM", s, MemoryDomain.Endian.Little, p, true, 2)); + } - IntPtr p0, p1; - int s0, s1; - LibLynx.GetReadOnlyCartPtrs(Core, out s0, out p0, out s1, out p1); - if (s0 > 0 && p0 != IntPtr.Zero) - mms.Add(MemoryDomain.FromIntPtr("Cart A", s0, MemoryDomain.Endian.Little, p0, false)); - if (s1 > 0 && p1 != IntPtr.Zero) - mms.Add(MemoryDomain.FromIntPtr("Cart B", s1, MemoryDomain.Endian.Little, p1, false)); + IntPtr p0, p1; + int s0, s1; + LibLynx.GetReadOnlyCartPtrs(Core, out s0, out p0, out s1, out p1); + if (s0 > 0 && p0 != IntPtr.Zero) + mms.Add(MemoryDomain.FromIntPtr("Cart A", s0, MemoryDomain.Endian.Little, p0, false, 2)); + if (s1 > 0 && p1 != IntPtr.Zero) + mms.Add(MemoryDomain.FromIntPtr("Cart B", s1, MemoryDomain.Endian.Little, p1, false, 2)); - _memoryDomains = new MemoryDomainList(mms); - (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); - } + _memoryDomains = new MemoryDomainList(mms); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); + } - private IMemoryDomains _memoryDomains; - } + private IMemoryDomains _memoryDomains; + } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IMemoryDomains.cs index 65370ed051..56caabac7f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IMemoryDomains.cs @@ -16,13 +16,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA var s = new LibVBANext.MemoryAreas(); var l = MemoryDomain.Endian.Little; LibVBANext.GetMemoryAreas(Core, s); - mm.Add(MemoryDomain.FromIntPtr("IWRAM", 32 * 1024, l, s.iwram)); - mm.Add(MemoryDomain.FromIntPtr("EWRAM", 256 * 1024, l, s.ewram)); - mm.Add(MemoryDomain.FromIntPtr("BIOS", 16 * 1024, l, s.bios, false)); - mm.Add(MemoryDomain.FromIntPtr("PALRAM", 1024, l, s.palram, false)); - mm.Add(MemoryDomain.FromIntPtr("VRAM", 96 * 1024, l, s.vram)); - mm.Add(MemoryDomain.FromIntPtr("OAM", 1024, l, s.oam)); - mm.Add(MemoryDomain.FromIntPtr("ROM", 32 * 1024 * 1024, l, s.rom)); + mm.Add(MemoryDomain.FromIntPtr("IWRAM", 32 * 1024, l, s.iwram, true, 4)); + mm.Add(MemoryDomain.FromIntPtr("EWRAM", 256 * 1024, l, s.ewram, true, 4)); + mm.Add(MemoryDomain.FromIntPtr("BIOS", 16 * 1024, l, s.bios, false, 4)); + mm.Add(MemoryDomain.FromIntPtr("PALRAM", 1024, l, s.palram, false, 4)); + mm.Add(MemoryDomain.FromIntPtr("VRAM", 96 * 1024, l, s.vram, true, 4)); + mm.Add(MemoryDomain.FromIntPtr("OAM", 1024, l, s.oam, true, 4)); + mm.Add(MemoryDomain.FromIntPtr("ROM", 32 * 1024 * 1024, l, s.rom, true, 4)); mm.Add(new MemoryDomain("System Bus", 0x10000000, l, delegate(long addr) @@ -36,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA if (addr < 0 || addr >= 0x10000000) throw new ArgumentOutOfRangeException(); LibVBANext.SystemBusWrite(Core, (int)addr, val); - })); + }, 4)); // special combined ram memory domain { var ew = mm[1]; @@ -59,7 +59,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA iw.PokeByte(addr & 32767, val); else ew.PokeByte(addr, val); - }); + }, 4); mm.Add(cr); } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs index 6cb5db3f9c..499fbbaec7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs @@ -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); } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index 650cc33159..a60e6c21d5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -1039,13 +1039,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES var a = FakeBusMap((int)addr); if (a.HasValue) blockptr[a.Value] = val; - }); + }, byteSize: 2); _memoryDomains.Add(md); } // ----- 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 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?"); md = new MemoryDomain(name, size, endian, (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) md = new MemoryDomain(name, size, endian, (addr) => blockptr[addr & mask], - (addr, value) => blockptr[addr & mask] = value); + (addr, value) => blockptr[addr & mask] = value, byteSize); else md = new MemoryDomain(name, size, endian, (addr) => blockptr[addr % size], - (addr, value) => blockptr[addr % size] = value); + (addr, value) => blockptr[addr % size] = value, byteSize); _memoryDomains.Add(md); @@ -1120,18 +1120,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little); - MakeMemoryDomain("CARTROM", LibsnesApi.SNES_MEMORY.CARTRIDGE_ROM, MemoryDomain.Endian.Little); - MakeMemoryDomain("CARTRAM", LibsnesApi.SNES_MEMORY.CARTRIDGE_RAM, MemoryDomain.Endian.Little); - MakeMemoryDomain("VRAM", LibsnesApi.SNES_MEMORY.VRAM, MemoryDomain.Endian.Little); - MakeMemoryDomain("OAM", LibsnesApi.SNES_MEMORY.OAM, MemoryDomain.Endian.Little); - MakeMemoryDomain("CGRAM", LibsnesApi.SNES_MEMORY.CGRAM, MemoryDomain.Endian.Little); - MakeMemoryDomain("APURAM", LibsnesApi.SNES_MEMORY.APURAM, 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, byteSize: 2); + MakeMemoryDomain("VRAM", LibsnesApi.SNES_MEMORY.VRAM, MemoryDomain.Endian.Little, byteSize: 2); + MakeMemoryDomain("OAM", LibsnesApi.SNES_MEMORY.OAM, MemoryDomain.Endian.Little, byteSize: 2); + MakeMemoryDomain("CGRAM", LibsnesApi.SNES_MEMORY.CGRAM, MemoryDomain.Endian.Little, byteSize: 2); + MakeMemoryDomain("APURAM", LibsnesApi.SNES_MEMORY.APURAM, MemoryDomain.Endian.Little, byteSize: 2); if (!DeterministicEmulation) { _memoryDomains.Add(new MemoryDomain("System Bus", 0x1000000, MemoryDomain.Endian.Little, (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 { diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index 69d0c69e40..e47b1a1020 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -471,7 +471,8 @@ namespace BizHawk.Emulation.Cores.PCEngine int mainmemorymask = Ram.Length - 1; var MainMemoryDomain = new MemoryDomain("Main Memory", Ram.Length, MemoryDomain.Endian.Little, addr => Ram[addr], - (addr, value) => Ram[addr] = value); + (addr, value) => Ram[addr] = value, + byteSize: 2); domains.Add(MainMemoryDomain); 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) throw new ArgumentOutOfRangeException(); Cpu.WriteMemory21((int)addr, value); - }); + }, + byteSize: 2); domains.Add(SystemBusDomain); var CpuBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little, @@ -501,20 +503,22 @@ namespace BizHawk.Emulation.Cores.PCEngine if (addr < 0 || addr >= 0x10000) throw new ArgumentOutOfRangeException(); Cpu.WriteMemory((ushort)addr, value); - }); + }, + byteSize: 2); domains.Add(CpuBusDomain); var RomDomain = new MemoryDomain("ROM", RomLength, MemoryDomain.Endian.Little, addr => RomData[addr], - (addr, value) => RomData[addr] = value); + (addr, value) => RomData[addr] = value, + byteSize: 2); domains.Add(RomDomain); - if (BRAM != null) { var BRAMMemoryDomain = new MemoryDomain("Battery RAM", Ram.Length, MemoryDomain.Endian.Little, addr => BRAM[addr], - (addr, value) => BRAM[addr] = value); + (addr, value) => BRAM[addr] = value, + byteSize: 2); domains.Add(BRAMMemoryDomain); } @@ -522,19 +526,22 @@ namespace BizHawk.Emulation.Cores.PCEngine { var CDRamMemoryDomain = new MemoryDomain("TurboCD RAM", CDRam.Length, MemoryDomain.Endian.Little, addr => CDRam[addr], - (addr, value) => CDRam[addr] = value); + (addr, value) => CDRam[addr] = value, + byteSize: 2); domains.Add(CDRamMemoryDomain); var AdpcmMemoryDomain = new MemoryDomain("ADPCM RAM", ADPCM.RAM.Length, MemoryDomain.Endian.Little, addr => ADPCM.RAM[addr], - (addr, value) => ADPCM.RAM[addr] = value); + (addr, value) => ADPCM.RAM[addr] = value, + byteSize: 2); domains.Add(AdpcmMemoryDomain); if (SuperRam != null) { var SuperRamMemoryDomain = new MemoryDomain("Super System Card RAM", SuperRam.Length, MemoryDomain.Endian.Little, addr => SuperRam[addr], - (addr, value) => SuperRam[addr] = value); + (addr, value) => SuperRam[addr] = value, + byteSize: 2); domains.Add(SuperRamMemoryDomain); } } @@ -543,7 +550,8 @@ namespace BizHawk.Emulation.Cores.PCEngine { var ArcadeRamMemoryDomain = new MemoryDomain("Arcade Card RAM", ArcadeRam.Length, MemoryDomain.Endian.Little, addr => ArcadeRam[addr], - (addr, value) => ArcadeRam[addr] = value); + (addr, value) => ArcadeRam[addr] = value, + byteSize: 2); domains.Add(ArcadeRamMemoryDomain); } @@ -551,7 +559,8 @@ namespace BizHawk.Emulation.Cores.PCEngine { var PopulusRAMDomain = new MemoryDomain("Cart Battery RAM", PopulousRAM.Length, MemoryDomain.Endian.Little, addr => PopulousRAM[addr], - (addr, value) => PopulousRAM[addr] = value); + (addr, value) => PopulousRAM[addr] = value, + byteSize: 2); domains.Add(PopulusRAMDomain); } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.IMemoryDomains.cs index 01800d115b..61ee04ce76 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.IMemoryDomains.cs @@ -18,7 +18,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn { int l = nmd.length; 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 diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs index afc7c1542c..a20cbe29b3 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs @@ -612,11 +612,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); LibGPGX.gpgx_poke_vram(((int)addr) ^ 1, val); - })); + }, + byteSize: 2)); } + 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); diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index 2f8da831fe..30a3868de3 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -681,22 +681,22 @@ namespace BizHawk.Emulation.Cores.Sony.PSX int size; 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); - 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); - 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); - 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); - 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); - 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); (ServiceProvider as BasicServiceProvider).Register(MemoryDomains);