From 2c09c10721f8ee10dfe8ceb5f5b3f0948316bc08 Mon Sep 17 00:00:00 2001 From: goyuken Date: Sun, 25 Jan 2015 20:10:19 +0000 Subject: [PATCH] memory domain: silent pokes --- .../Base Implementations/MemoryDomain.cs | 33 ++++++++----------- .../Consoles/Nintendo/NES/Boards/ExROM.cs | 2 +- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs b/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs index 67f9ca0a93..b9a30f2ebe 100644 --- a/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs +++ b/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs @@ -49,17 +49,12 @@ namespace BizHawk.Emulation.Common { return data[addr]; }, + writable ? delegate(long addr, byte val) { - if (writable) - { - data[addr] = val; - } - else - { - throw new NotImplementedException(); - } + data[addr] = val; } + : (Action)null ); } @@ -88,15 +83,14 @@ namespace BizHawk.Emulation.Common throw new ArgumentOutOfRangeException(); return p[addr]; }, + writable ? delegate(long addr, byte val) { - if (writable) - { - if ((uint)addr >= l) - throw new ArgumentOutOfRangeException(); - p[addr] = val; - } + if ((uint)addr >= l) + throw new ArgumentOutOfRangeException(); + p[addr] = val; } + : (Action)null ); } @@ -125,15 +119,14 @@ namespace BizHawk.Emulation.Common throw new ArgumentOutOfRangeException(); return p[addr ^ 1]; }, + writable ? delegate(long addr, byte val) { - if (writable) - { - if ((uint)addr >= l) - throw new ArgumentOutOfRangeException(); - p[addr ^ 1] = val; - } + if ((uint)addr >= l) + throw new ArgumentOutOfRangeException(); + p[addr ^ 1] = val; } + : (Action)null ); } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs index 1080dc4032..811c857057 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs @@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public MemoryDomain GetExRAM() { - return new MemoryDomain("ExRAM", EXRAM.Length, MemoryDomain.Endian.Little, (addr) => EXRAM[addr], (addr, val) => EXRAM[addr] = val); + return MemoryDomain.FromByteArray("ExRAM", MemoryDomain.Endian.Little, EXRAM); } ///