Enable BHI1001 and fix noncompliance

"Do not use anonymous delegates"
This commit is contained in:
YoshiRulz 2022-07-14 02:52:03 +10:00
parent 395aa0755b
commit 056db314d4
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
15 changed files with 61 additions and 120 deletions

View File

@ -2,7 +2,7 @@
<RuleSet Name="BizHawk Rules" Description="Applies to all projects in the solution -- or, it will eventually." ToolsVersion="14.0"> <RuleSet Name="BizHawk Rules" Description="Applies to all projects in the solution -- or, it will eventually." ToolsVersion="14.0">
<Rules AnalyzerId="BizHawk.Analyzer" RuleNamespace="BizHawk.Analyzer"> <Rules AnalyzerId="BizHawk.Analyzer" RuleNamespace="BizHawk.Analyzer">
<!-- Do not use anonymous delegates --> <!-- Do not use anonymous delegates -->
<Rule Id="BHI1001" Action="Hidden" /> <Rule Id="BHI1001" Action="Error" />
<!-- Do not use anonymous types (classes) --> <!-- Do not use anonymous types (classes) -->
<Rule Id="BHI1002" Action="Hidden" /> <Rule Id="BHI1002" Action="Hidden" />

View File

@ -156,7 +156,7 @@ namespace BizHawk.Client.Common
protected void LoadBk2Fields(ZipStateLoader bl, bool preload) protected void LoadBk2Fields(ZipStateLoader bl, bool preload)
{ {
bl.GetLump(BinaryStateLump.Movieheader, true, delegate(TextReader tr) bl.GetLump(BinaryStateLump.Movieheader, abort: true, tr =>
{ {
string line; string line;
while ((line = tr.ReadLine()) != null) while ((line = tr.ReadLine()) != null)
@ -176,7 +176,7 @@ namespace BizHawk.Client.Common
} }
}); });
bl.GetLump(BinaryStateLump.Input, true, delegate(TextReader tr) bl.GetLump(BinaryStateLump.Input, abort: true, tr =>
{ {
IsCountingRerecords = false; IsCountingRerecords = false;
ExtractInputLog(tr, out _); ExtractInputLog(tr, out _);
@ -188,7 +188,7 @@ namespace BizHawk.Client.Common
return; return;
} }
bl.GetLump(BinaryStateLump.Comments, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.Comments, abort: false, tr =>
{ {
string line; string line;
while ((line = tr.ReadLine()) != null) while ((line = tr.ReadLine()) != null)
@ -200,7 +200,7 @@ namespace BizHawk.Client.Common
} }
}); });
bl.GetLump(BinaryStateLump.Subtitles, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.Subtitles, abort: false, tr =>
{ {
string line; string line;
while ((line = tr.ReadLine()) != null) while ((line = tr.ReadLine()) != null)
@ -214,7 +214,7 @@ namespace BizHawk.Client.Common
Subtitles.Sort(); Subtitles.Sort();
}); });
bl.GetLump(BinaryStateLump.SyncSettings, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.SyncSettings, abort: false, tr =>
{ {
string line; string line;
while ((line = tr.ReadLine()) != null) while ((line = tr.ReadLine()) != null)
@ -229,16 +229,10 @@ namespace BizHawk.Client.Common
if (StartsFromSavestate) if (StartsFromSavestate)
{ {
bl.GetCoreState( bl.GetCoreState(
delegate(BinaryReader br, long length) (br, length) => BinarySavestate = br.ReadBytes((int) length),
{ tr => TextSavestate = tr.ReadToEnd());
BinarySavestate = br.ReadBytes((int)length);
},
delegate(TextReader tr)
{
TextSavestate = tr.ReadToEnd();
});
bl.GetLump(BinaryStateLump.Framebuffer, false, bl.GetLump(BinaryStateLump.Framebuffer, false,
delegate(BinaryReader br, long length) (br, length) =>
{ {
SavestateFramebuffer = new int[length / sizeof(int)]; SavestateFramebuffer = new int[length / sizeof(int)];
for (int i = 0; i < SavestateFramebuffer.Length; i++) for (int i = 0; i < SavestateFramebuffer.Length; i++)
@ -250,10 +244,7 @@ namespace BizHawk.Client.Common
else if (StartsFromSaveRam) else if (StartsFromSaveRam)
{ {
bl.GetLump(BinaryStateLump.MovieSaveRam, false, bl.GetLump(BinaryStateLump.MovieSaveRam, false,
delegate(BinaryReader br, long length) (br, length) => SaveRam = br.ReadBytes((int) length));
{
SaveRam = br.ReadBytes((int)length);
});
} }
} }
} }

View File

@ -123,7 +123,7 @@ namespace BizHawk.Client.Common
var nusertext = new IndexedStateLump(BinaryStateLump.BranchUserText); var nusertext = new IndexedStateLump(BinaryStateLump.BranchUserText);
foreach (var b in this) foreach (var b in this)
{ {
bs.PutLump(nheader, delegate(TextWriter tw) bs.PutLump(nheader, tw =>
{ {
// if this header needs more stuff in it, handle it sensibly // if this header needs more stuff in it, handle it sensibly
tw.WriteLine(JsonConvert.SerializeObject(new tw.WriteLine(JsonConvert.SerializeObject(new
@ -134,12 +134,9 @@ namespace BizHawk.Client.Common
})); }));
}); });
bs.PutLump(ncore, delegate(Stream s) bs.PutLump(ncore, (Stream s) => s.Write(b.CoreData, 0, b.CoreData.Length));
{
s.Write(b.CoreData, 0, b.CoreData.Length);
});
bs.PutLump(ninput, delegate(TextWriter tw) bs.PutLump(ninput, tw =>
{ {
int todo = b.InputLog.Count; int todo = b.InputLog.Count;
for (int i = 0; i < todo; i++) for (int i = 0; i < todo; i++)
@ -148,27 +145,21 @@ namespace BizHawk.Client.Common
} }
}); });
bs.PutLump(nframebuffer, delegate(Stream s) bs.PutLump(nframebuffer, s =>
{ {
var vp = new BitmapBufferVideoProvider(b.OSDFrameBuffer); var vp = new BitmapBufferVideoProvider(b.OSDFrameBuffer);
_quickBmpFile.Save(vp, s, b.OSDFrameBuffer.Width, b.OSDFrameBuffer.Height); _quickBmpFile.Save(vp, s, b.OSDFrameBuffer.Width, b.OSDFrameBuffer.Height);
}); });
bs.PutLump(ncoreframebuffer, delegate(Stream s) bs.PutLump(ncoreframebuffer, s =>
{ {
var vp = new BitmapBufferVideoProvider(b.CoreFrameBuffer); var vp = new BitmapBufferVideoProvider(b.CoreFrameBuffer);
_quickBmpFile.Save(vp, s, b.CoreFrameBuffer.Width, b.CoreFrameBuffer.Height); _quickBmpFile.Save(vp, s, b.CoreFrameBuffer.Width, b.CoreFrameBuffer.Height);
}); });
bs.PutLump(nmarkers, delegate(TextWriter tw) bs.PutLump(nmarkers, tw => tw.WriteLine(b.Markers.ToString()));
{
tw.WriteLine(b.Markers.ToString());
});
bs.PutLump(nusertext, delegate(TextWriter tw) bs.PutLump(nusertext, tw => tw.WriteLine(b.UserText));
{
tw.WriteLine(b.UserText);
});
nheader.Increment(); nheader.Increment();
ncore.Increment(); ncore.Increment();
@ -196,7 +187,7 @@ namespace BizHawk.Client.Common
{ {
var b = new TasBranch(); var b = new TasBranch();
if (!bl.GetLump(nheader, false, delegate(TextReader tr) if (!bl.GetLump(nheader, abort: false, tr =>
{ {
var header = (dynamic)JsonConvert.DeserializeObject(tr.ReadLine()); var header = (dynamic)JsonConvert.DeserializeObject(tr.ReadLine());
b.Frame = (int)header.Frame; b.Frame = (int)header.Frame;
@ -226,13 +217,13 @@ namespace BizHawk.Client.Common
return; return;
} }
bl.GetLump(ncore, true, delegate(Stream s, long length) bl.GetLump(ncore, abort: true, (Stream s, long length) =>
{ {
b.CoreData = new byte[length]; b.CoreData = new byte[length];
s.Read(b.CoreData, 0, b.CoreData.Length); s.Read(b.CoreData, 0, b.CoreData.Length);
}); });
bl.GetLump(ninput, true, delegate(TextReader tr) bl.GetLump(ninput, abort: true, tr =>
{ {
b.InputLog = StringLogUtil.MakeStringLog(); b.InputLog = StringLogUtil.MakeStringLog();
string line; string line;
@ -242,20 +233,20 @@ namespace BizHawk.Client.Common
} }
}); });
bl.GetLump(nframebuffer, true, delegate(Stream s, long length) bl.GetLump(nframebuffer, abort: true, (s, _) =>
{ {
_quickBmpFile.LoadAuto(s, out var vp); _quickBmpFile.LoadAuto(s, out var vp);
b.OSDFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.GetVideoBuffer()); b.OSDFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.GetVideoBuffer());
}); });
bl.GetLump(ncoreframebuffer, false, delegate(Stream s, long length) bl.GetLump(ncoreframebuffer, abort: false, (s, _) =>
{ {
_quickBmpFile.LoadAuto(s, out var vp); _quickBmpFile.LoadAuto(s, out var vp);
b.CoreFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.GetVideoBuffer()); b.CoreFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.GetVideoBuffer());
}); });
b.Markers = new TasMovieMarkerList(movie); b.Markers = new TasMovieMarkerList(movie);
bl.GetLump(nmarkers, false, delegate(TextReader tr) bl.GetLump(nmarkers, abort: false, tr =>
{ {
string line; string line;
while ((line = tr.ReadLine()) != null) while ((line = tr.ReadLine()) != null)
@ -267,7 +258,7 @@ namespace BizHawk.Client.Common
} }
}); });
bl.GetLump(nusertext, false, delegate(TextReader tr) bl.GetLump(nusertext, abort: false, tr =>
{ {
string line; string line;
if ((line = tr.ReadLine()) != null) if ((line = tr.ReadLine()) != null)

View File

@ -81,12 +81,9 @@ namespace BizHawk.Client.Common
private void LoadTasprojExtras(ZipStateLoader bl) private void LoadTasprojExtras(ZipStateLoader bl)
{ {
bl.GetLump(BinaryStateLump.LagLog, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.LagLog, abort: false, tr => LagLog.Load(tr));
{
LagLog.Load(tr);
});
bl.GetLump(BinaryStateLump.Markers, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.Markers, abort: false, tr =>
{ {
string line; string line;
while ((line = tr.ReadLine()) != null) while ((line = tr.ReadLine()) != null)
@ -101,7 +98,7 @@ namespace BizHawk.Client.Common
if (GetClientSettingsOnLoad != null) if (GetClientSettingsOnLoad != null)
{ {
string clientSettings = ""; string clientSettings = "";
bl.GetLump(BinaryStateLump.ClientSettings, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.ClientSettings, abort: false, tr =>
{ {
string line; string line;
while ((line = tr.ReadLine()) != null) while ((line = tr.ReadLine()) != null)
@ -119,7 +116,7 @@ namespace BizHawk.Client.Common
} }
} }
bl.GetLump(BinaryStateLump.VerificationLog, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.VerificationLog, abort: false, tr =>
{ {
VerificationLog.Clear(); VerificationLog.Clear();
while (true) while (true)
@ -139,7 +136,7 @@ namespace BizHawk.Client.Common
Branches.Load(bl, this); Branches.Load(bl, this);
bl.GetLump(BinaryStateLump.Session, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.Session, abort: false, tr =>
{ {
var json = tr.ReadToEnd(); var json = tr.ReadToEnd();
try try
@ -153,7 +150,7 @@ namespace BizHawk.Client.Common
}); });
ZwinderStateManagerSettings settings = new ZwinderStateManagerSettings(); ZwinderStateManagerSettings settings = new ZwinderStateManagerSettings();
bl.GetLump(BinaryStateLump.StateHistorySettings, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.StateHistorySettings, abort: false, tr =>
{ {
var json = tr.ReadToEnd(); var json = tr.ReadToEnd();
try try
@ -166,7 +163,7 @@ namespace BizHawk.Client.Common
} }
}); });
bl.GetLump(BinaryStateLump.StateHistory, false, delegate(BinaryReader br, long length) bl.GetLump(BinaryStateLump.StateHistory, abort: false, (br, _) =>
{ {
try try
{ {

View File

@ -97,7 +97,7 @@ namespace BizHawk.Client.Common
if (_movieSession.Movie.IsActive()) if (_movieSession.Movie.IsActive())
{ {
bs.PutLump(BinaryStateLump.Input, bs.PutLump(BinaryStateLump.Input,
delegate(TextWriter tw) tw =>
{ {
// this never should have been a core's responsibility // this never should have been a core's responsibility
tw.WriteLine("Frame {0}", _emulator.Frame); tw.WriteLine("Frame {0}", _emulator.Frame);
@ -108,7 +108,7 @@ namespace BizHawk.Client.Common
if (_userBag.Any()) if (_userBag.Any())
{ {
bs.PutLump(BinaryStateLump.UserData, bs.PutLump(BinaryStateLump.UserData,
delegate(TextWriter tw) tw =>
{ {
var data = ConfigService.SaveWithType(_userBag); var data = ConfigService.SaveWithType(_userBag);
tw.WriteLine(data); tw.WriteLine(data);
@ -117,11 +117,7 @@ namespace BizHawk.Client.Common
if (_movieSession.Movie.IsActive() && _movieSession.Movie is ITasMovie) if (_movieSession.Movie.IsActive() && _movieSession.Movie is ITasMovie)
{ {
bs.PutLump(BinaryStateLump.LagLog, bs.PutLump(BinaryStateLump.LagLog, tw => ((ITasMovie) _movieSession.Movie).LagLog.Save(tw));
delegate(TextWriter tw)
{
((ITasMovie)_movieSession.Movie).LagLog.Save(tw);
});
} }
} }
@ -177,7 +173,7 @@ namespace BizHawk.Client.Common
} }
string userData = ""; string userData = "";
bl.GetLump(BinaryStateLump.UserData, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.UserData, abort: false, tr =>
{ {
string line; string line;
while ((line = tr.ReadLine()) != null) while ((line = tr.ReadLine()) != null)
@ -198,10 +194,7 @@ namespace BizHawk.Client.Common
if (_movieSession.Movie.IsActive() && _movieSession.Movie is ITasMovie) if (_movieSession.Movie.IsActive() && _movieSession.Movie is ITasMovie)
{ {
bl.GetLump(BinaryStateLump.LagLog, false, delegate(TextReader tr) bl.GetLump(BinaryStateLump.LagLog, abort: false, tr => ((ITasMovie) _movieSession.Movie).LagLog.Load(tr));
{
((ITasMovie)_movieSession.Movie).LagLog.Load(tr);
});
} }
return true; return true;

View File

@ -123,31 +123,13 @@ namespace BizHawk.Client.Common
} }
public bool GetLump(BinaryStateLump lump, bool abort, Action<BinaryReader> callback) public bool GetLump(BinaryStateLump lump, bool abort, Action<BinaryReader> callback)
{ => GetLump(lump, abort, (s, _) => callback(new(s)));
return GetLump(lump, abort, delegate(Stream s, long unused)
{
var br = new BinaryReader(s);
callback(br);
});
}
public bool GetLump(BinaryStateLump lump, bool abort, Action<BinaryReader, long> callback) public bool GetLump(BinaryStateLump lump, bool abort, Action<BinaryReader, long> callback)
{ => GetLump(lump, abort, (s, length) => callback(new(s), length));
return GetLump(lump, abort, delegate(Stream s, long length)
{
var br = new BinaryReader(s);
callback(br, length);
});
}
public bool GetLump(BinaryStateLump lump, bool abort, Action<TextReader> callback) public bool GetLump(BinaryStateLump lump, bool abort, Action<TextReader> callback)
{ => GetLump(lump, abort, (s, _) => callback(new StreamReader(s)));
return GetLump(lump, abort, delegate(Stream s, long unused)
{
var tr = new StreamReader(s);
callback(tr);
});
}
/// <exception cref="Exception">couldn't find Binary or Text savestate</exception> /// <exception cref="Exception">couldn't find Binary or Text savestate</exception>
public void GetCoreState(Action<BinaryReader, long> callbackBinary, Action<TextReader> callbackText) public void GetCoreState(Action<BinaryReader, long> callbackBinary, Action<TextReader> callbackText)

View File

@ -42,7 +42,7 @@ namespace BizHawk.Client.Common
public void PutLump(BinaryStateLump lump, Action<BinaryWriter> callback) public void PutLump(BinaryStateLump lump, Action<BinaryWriter> callback)
{ {
PutLump(lump, delegate(Stream s) PutLump(lump, s =>
{ {
var bw = new BinaryWriter(s); var bw = new BinaryWriter(s);
callback(bw); callback(bw);
@ -52,7 +52,7 @@ namespace BizHawk.Client.Common
public void PutLump(BinaryStateLump lump, Action<TextWriter> callback) public void PutLump(BinaryStateLump lump, Action<TextWriter> callback)
{ {
PutLump(lump, delegate(Stream s) PutLump(lump, s =>
{ {
TextWriter tw = new StreamWriter(s); TextWriter tw = new StreamWriter(s);
callback(tw); callback(tw);

View File

@ -87,10 +87,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
var name = $"{ deviceName } : { read } : 0x{ firstOffset:X}-0x{ lastOffset:X}"; var name = $"{ deviceName } : { read } : 0x{ firstOffset:X}-0x{ lastOffset:X}";
domains.Add(new MemoryDomainDelegate(name, lastOffset - firstOffset + 1, endian, domains.Add(new MemoryDomainDelegate(name, lastOffset - firstOffset + 1, endian,
delegate (long addr) addr => _peek(addr, firstOffset, size),
{
return _peek(addr, firstOffset, size);
},
read == "rom" read == "rom"
? null ? null
: (long addr, byte val) => _poke(addr, val, firstOffset, size), : (long addr, byte val) => _poke(addr, val, firstOffset, size),
@ -99,10 +96,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
} }
domains.Add(new MemoryDomainDelegate(deviceName + " : System Bus", size, endian, domains.Add(new MemoryDomainDelegate(deviceName + " : System Bus", size, endian,
delegate (long addr) addr => _peek(addr, 0, size),
{
return _peek(addr, 0, size);
},
null, dataWidth)); null, dataWidth));
_memoryDomains = new MemoryDomainList(domains); _memoryDomains = new MemoryDomainList(domains);

View File

@ -26,15 +26,8 @@ namespace BizHawk.Emulation.Cores.Components.H6280
string dis = DisassembleExt( string dis = DisassembleExt(
0, 0,
out unused, out unused,
delegate(ushort addr) addr => md.PeekByte(addr + i),
{ addr => md.PeekUshort(addr + i, bigEndian: false));
return md.PeekByte(addr + i);
},
delegate(ushort addr)
{
return md.PeekUshort(addr + i, false);
}
);
w.WriteLine("0x{0:x8}: {1}", i, dis); w.WriteLine("0x{0:x8}: {1}", i, dis);
} }
} }

View File

@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Calculators.Emu83
CreateMemoryDomain(LibEmu83.MemoryArea_t.MEM_VRAM, "VRAM"); CreateMemoryDomain(LibEmu83.MemoryArea_t.MEM_VRAM, "VRAM");
_memoryDomains.Add(new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little, _memoryDomains.Add(new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
delegate(long addr) addr =>
{ {
if (addr < 0 || addr >= 0x10000) if (addr < 0 || addr >= 0x10000)
{ {
@ -40,7 +40,7 @@ namespace BizHawk.Emulation.Cores.Calculators.Emu83
return LibEmu83.TI83_ReadMemory(Context, (ushort)addr); return LibEmu83.TI83_ReadMemory(Context, (ushort)addr);
}, },
delegate(long addr, byte val) (addr, val) =>
{ {
if (addr < 0 || addr >= 0x10000) if (addr < 0 || addr >= 0x10000)
{ {

View File

@ -38,7 +38,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
mm.Add(_cwram = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, le, null, null, 4)); mm.Add(_cwram = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, le, null, null, 4));
mm.Add(new MemoryDomainDelegate("System Bus", 0x10000000, le, mm.Add(new MemoryDomainDelegate("System Bus", 0x10000000, le,
delegate (long addr) addr =>
{ {
var a = (uint)addr; var a = (uint)addr;
if (a >= 0x10000000) if (a >= 0x10000000)
@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
return LibmGBA.BizReadBus(Core, a); return LibmGBA.BizReadBus(Core, a);
}, },
delegate (long addr, byte val) (addr, val) =>
{ {
var a = (uint)addr; var a = (uint)addr;
if (a >= 0x10000000) if (a >= 0x10000000)

View File

@ -37,7 +37,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
// also add a special memory domain for the system bus, where calls get sent directly to the core each time // also add a special memory domain for the system bus, where calls get sent directly to the core each time
_memoryDomains.Add(new MemoryDomainDelegate("System Bus", 65536, MemoryDomain.Endian.Little, _memoryDomains.Add(new MemoryDomainDelegate("System Bus", 65536, MemoryDomain.Endian.Little,
delegate(long addr) addr =>
{ {
if (addr < 0 || addr >= 65536) if (addr < 0 || addr >= 65536)
{ {
@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
return LibGambatte.gambatte_cpuread(GambatteState, (ushort)addr); return LibGambatte.gambatte_cpuread(GambatteState, (ushort)addr);
}, },
delegate(long addr, byte val) (addr, val) =>
{ {
if (addr < 0 || addr >= 65536) if (addr < 0 || addr >= 65536)
{ {

View File

@ -32,7 +32,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
"System Bus", "System Bus",
0x10000, 0x10000,
MemoryDomain.Endian.Unknown, MemoryDomain.Endian.Unknown,
delegate(long addr) addr =>
{ {
if (addr < 0 || addr >= 0x10000) if (addr < 0 || addr >= 0x10000)
{ {
@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
return QN.qn_peek_prgbus(Context, (int)addr); return QN.qn_peek_prgbus(Context, (int)addr);
}, },
delegate(long addr, byte val) (addr, val) =>
{ {
if (addr < 0 || addr >= 0x10000) if (addr < 0 || addr >= 0x10000)
{ {

View File

@ -44,7 +44,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy
// also add a special memory domain for the system bus, where calls get sent directly to the core each time // also add a special memory domain for the system bus, where calls get sent directly to the core each time
_memoryDomains.Add(new MemoryDomainDelegate("System Bus", 65536, MemoryDomain.Endian.Little, _memoryDomains.Add(new MemoryDomainDelegate("System Bus", 65536, MemoryDomain.Endian.Little,
delegate(long addr) addr =>
{ {
if (addr < 0 || addr >= 65536) if (addr < 0 || addr >= 65536)
{ {
@ -53,7 +53,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy
return LibSameboy.sameboy_cpuread(SameboyState, (ushort)addr); return LibSameboy.sameboy_cpuread(SameboyState, (ushort)addr);
}, },
delegate(long addr, byte val) (addr, val) =>
{ {
if (addr < 0 || addr >= 65536) if (addr < 0 || addr >= 65536)
{ {

View File

@ -34,14 +34,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
// vram pokes need to go through hook which invalidates cached tiles // vram pokes need to go through hook which invalidates cached tiles
byte* p = (byte*)area; byte* p = (byte*)area;
mm.Add(new MemoryDomainDelegate(name, size, MemoryDomain.Endian.Unknown, mm.Add(new MemoryDomainDelegate(name, size, MemoryDomain.Endian.Unknown,
delegate (long addr) addr =>
{ {
if (addr < 0 || addr >= 65536) if (addr < 0 || addr >= 65536)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
using (_elf.EnterExit()) using (_elf.EnterExit())
return p[addr ^ 1]; return p[addr ^ 1];
}, },
delegate (long addr, byte val) (addr, val) =>
{ {
if (addr < 0 || addr >= 65536) if (addr < 0 || addr >= 65536)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
@ -59,14 +59,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
} }
} }
var m68Bus = new MemoryDomainDelegate("M68K BUS", 0x1000000, MemoryDomain.Endian.Big, var m68Bus = new MemoryDomainDelegate("M68K BUS", 0x1000000, MemoryDomain.Endian.Big,
delegate (long addr) addr =>
{ {
var a = (uint)addr; var a = (uint)addr;
if (a >= 0x1000000) if (a >= 0x1000000)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
return Core.gpgx_peek_m68k_bus(a); return Core.gpgx_peek_m68k_bus(a);
}, },
delegate (long addr, byte val) (addr, val) =>
{ {
var a = (uint)addr; var a = (uint)addr;
if (a >= 0x1000000) if (a >= 0x1000000)
@ -79,14 +79,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
if (IsMegaCD) if (IsMegaCD)
{ {
var s68Bus = new MemoryDomainDelegate("S68K BUS", 0x1000000, MemoryDomain.Endian.Big, var s68Bus = new MemoryDomainDelegate("S68K BUS", 0x1000000, MemoryDomain.Endian.Big,
delegate (long addr) addr =>
{ {
var a = (uint)addr; var a = (uint)addr;
if (a >= 0x1000000) if (a >= 0x1000000)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
return Core.gpgx_peek_s68k_bus(a); return Core.gpgx_peek_s68k_bus(a);
}, },
delegate (long addr, byte val) (addr, val) =>
{ {
var a = (uint)addr; var a = (uint)addr;
if (a >= 0x1000000) if (a >= 0x1000000)