MemoryCallbackSystem - simplify by having a single Add method with a MemoryCallbackType parameter, and some simplifying of client code as a result
This commit is contained in:
parent
ba31d7d28b
commit
2d1a43dc65
|
@ -206,7 +206,7 @@ namespace BizHawk.Client.Common
|
||||||
var nlf = new NamedLuaFunction(luaf, "OnMemoryExecute", LogOutputCallback, CurrentThread, name);
|
var nlf = new NamedLuaFunction(luaf, "OnMemoryExecute", LogOutputCallback, CurrentThread, name);
|
||||||
_luaFunctions.Add(nlf);
|
_luaFunctions.Add(nlf);
|
||||||
|
|
||||||
Global.Emulator.AsDebuggable().MemoryCallbacks.AddExecute(nlf.Callback, address);
|
Global.Emulator.AsDebuggable().MemoryCallbacks.Add(MemoryCallbackType.Execute, nlf.Callback, address);
|
||||||
return nlf.Guid.ToString();
|
return nlf.Guid.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -226,7 +226,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
var nlf = new NamedLuaFunction(luaf, "OnMemoryRead", LogOutputCallback, CurrentThread, name);
|
var nlf = new NamedLuaFunction(luaf, "OnMemoryRead", LogOutputCallback, CurrentThread, name);
|
||||||
_luaFunctions.Add(nlf);
|
_luaFunctions.Add(nlf);
|
||||||
Global.Emulator.AsDebuggable().MemoryCallbacks.AddRead(nlf.Callback, address);
|
Global.Emulator.AsDebuggable().MemoryCallbacks.Add(MemoryCallbackType.Read, nlf.Callback, address);
|
||||||
return nlf.Guid.ToString();
|
return nlf.Guid.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -246,7 +246,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
var nlf = new NamedLuaFunction(luaf, "OnMemoryWrite", LogOutputCallback, CurrentThread, name);
|
var nlf = new NamedLuaFunction(luaf, "OnMemoryWrite", LogOutputCallback, CurrentThread, name);
|
||||||
_luaFunctions.Add(nlf);
|
_luaFunctions.Add(nlf);
|
||||||
Global.Emulator.AsDebuggable().MemoryCallbacks.AddWrite(nlf.Callback, address);
|
Global.Emulator.AsDebuggable().MemoryCallbacks.Add(MemoryCallbackType.Write, nlf.Callback, address);
|
||||||
return nlf.Guid.ToString();
|
return nlf.Guid.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,6 +7,8 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class AddBreakpointDialog : Form
|
public partial class AddBreakpointDialog : Form
|
||||||
|
@ -16,26 +18,26 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BreakpointType BreakType
|
public MemoryCallbackType BreakType
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (ReadRadio.Checked)
|
if (ReadRadio.Checked)
|
||||||
{
|
{
|
||||||
return BreakpointType.Read;
|
return MemoryCallbackType.Read;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WriteRadio.Checked)
|
if (WriteRadio.Checked)
|
||||||
{
|
{
|
||||||
return BreakpointType.Write;
|
return MemoryCallbackType.Write;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExecuteRadio.Checked)
|
if (ExecuteRadio.Checked)
|
||||||
{
|
{
|
||||||
return BreakpointType.Execute;
|
return MemoryCallbackType.Execute;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BreakpointType.Read;
|
return MemoryCallbackType.Read;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +56,5 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BreakpointType { Read, Write, Execute }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,7 +446,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public Action Callback { get; set; }
|
public Action Callback { get; set; }
|
||||||
|
|
||||||
public void Add(Atari2600 core, uint address, BreakpointType type)
|
public void Add(Atari2600 core, uint address, MemoryCallbackType type)
|
||||||
{
|
{
|
||||||
Add(new AtariBreakpoint(core, Callback, address, type));
|
Add(new AtariBreakpoint(core, Callback, address, type));
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private bool _active;
|
private bool _active;
|
||||||
private readonly Atari2600 _core;
|
private readonly Atari2600 _core;
|
||||||
|
|
||||||
public AtariBreakpoint(Atari2600 core, Action callBack, uint address, BreakpointType type, bool enabled = true)
|
public AtariBreakpoint(Atari2600 core, Action callBack, uint address, MemoryCallbackType type, bool enabled = true)
|
||||||
{
|
{
|
||||||
_core = core;
|
_core = core;
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public Action Callback { get; set; }
|
public Action Callback { get; set; }
|
||||||
public uint Address { get; set; }
|
public uint Address { get; set; }
|
||||||
public BreakpointType Type { get; set; }
|
public MemoryCallbackType Type { get; set; }
|
||||||
|
|
||||||
public bool Active
|
public bool Active
|
||||||
{
|
{
|
||||||
|
@ -500,18 +500,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void AddCallback()
|
private void AddCallback()
|
||||||
{
|
{
|
||||||
switch (Type)
|
_core.MemoryCallbacks.Add(Type, Callback, Address);
|
||||||
{
|
|
||||||
case BreakpointType.Read:
|
|
||||||
_core.MemoryCallbacks.AddRead(Callback, Address);
|
|
||||||
break;
|
|
||||||
case BreakpointType.Write:
|
|
||||||
_core.MemoryCallbacks.AddWrite(Callback, Address);
|
|
||||||
break;
|
|
||||||
case BreakpointType.Execute:
|
|
||||||
_core.MemoryCallbacks.AddExecute(Callback, Address);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveCallback()
|
private void RemoveCallback()
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public Action Callback { get; set; }
|
public Action Callback { get; set; }
|
||||||
|
|
||||||
public void Add(IDebuggable core, uint address, BreakpointType type)
|
public void Add(IDebuggable core, uint address, MemoryCallbackType type)
|
||||||
{
|
{
|
||||||
Add(new Breakpoint(core, Callback, address, type));
|
Add(new Breakpoint(core, Callback, address, type));
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private bool _active;
|
private bool _active;
|
||||||
private readonly IDebuggable _core;
|
private readonly IDebuggable _core;
|
||||||
|
|
||||||
public Breakpoint(IDebuggable core, Action callBack, uint address, BreakpointType type, bool enabled = true)
|
public Breakpoint(IDebuggable core, Action callBack, uint address, MemoryCallbackType type, bool enabled = true)
|
||||||
{
|
{
|
||||||
_core = core;
|
_core = core;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public Action Callback { get; set; }
|
public Action Callback { get; set; }
|
||||||
public uint Address { get; set; }
|
public uint Address { get; set; }
|
||||||
public BreakpointType Type { get; set; }
|
public MemoryCallbackType Type { get; set; }
|
||||||
|
|
||||||
public bool Active
|
public bool Active
|
||||||
{
|
{
|
||||||
|
@ -78,14 +78,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case BreakpointType.Read:
|
case MemoryCallbackType.Read:
|
||||||
_core.MemoryCallbacks.AddRead(Callback, Address);
|
_core.MemoryCallbacks.Add(MemoryCallbackType.Read, Callback, Address);
|
||||||
break;
|
break;
|
||||||
case BreakpointType.Write:
|
case MemoryCallbackType.Write:
|
||||||
_core.MemoryCallbacks.AddWrite(Callback, Address);
|
_core.MemoryCallbacks.Add(MemoryCallbackType.Write, Callback, Address);
|
||||||
break;
|
break;
|
||||||
case BreakpointType.Execute:
|
case MemoryCallbackType.Execute:
|
||||||
_core.MemoryCallbacks.AddExecute(Callback, Address);
|
_core.MemoryCallbacks.Add(MemoryCallbackType.Execute, Callback, Address);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,31 @@ namespace BizHawk.Emulation.Common
|
||||||
private readonly List<Action> _executes = new List<Action>();
|
private readonly List<Action> _executes = new List<Action>();
|
||||||
private readonly List<uint> _execAddrs = new List<uint>();
|
private readonly List<uint> _execAddrs = new List<uint>();
|
||||||
|
|
||||||
public void AddRead(Action function, uint? addr)
|
public void Add(MemoryCallbackType type, Action function, uint? addr)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case MemoryCallbackType.Read:
|
||||||
|
AddRead(function, addr);
|
||||||
|
break;
|
||||||
|
case MemoryCallbackType.Write:
|
||||||
|
AddWrite(function, addr);
|
||||||
|
break;
|
||||||
|
case MemoryCallbackType.Execute:
|
||||||
|
if (!addr.HasValue)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("When assigning an execute callback, an address must be specified");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddExecute(function, addr.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddRead(Action function, uint? addr)
|
||||||
{
|
{
|
||||||
var hadAny = _reads.Any() || _writes.Any() || _executes.Any();
|
var hadAny = _reads.Any() || _writes.Any() || _executes.Any();
|
||||||
|
|
||||||
|
@ -27,7 +51,7 @@ namespace BizHawk.Emulation.Common
|
||||||
Changes(hadAny, hasAny);
|
Changes(hadAny, hasAny);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddWrite(Action function, uint? addr)
|
private void AddWrite(Action function, uint? addr)
|
||||||
{
|
{
|
||||||
var hadAny = _reads.Any() || _writes.Any() || _executes.Any();
|
var hadAny = _reads.Any() || _writes.Any() || _executes.Any();
|
||||||
|
|
||||||
|
@ -38,7 +62,7 @@ namespace BizHawk.Emulation.Common
|
||||||
Changes(hadAny, hasAny);
|
Changes(hadAny, hasAny);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddExecute(Action function, uint addr)
|
private void AddExecute(Action function, uint addr)
|
||||||
{
|
{
|
||||||
var hadAny = _reads.Any() || _writes.Any() || _executes.Any();
|
var hadAny = _reads.Any() || _writes.Any() || _executes.Any();
|
||||||
|
|
||||||
|
@ -49,7 +73,7 @@ namespace BizHawk.Emulation.Common
|
||||||
Changes(hadAny, hasAny);
|
Changes(hadAny, hasAny);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CallRead(uint addr)
|
public void CallReads(uint addr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _reads.Count; i++)
|
for (int i = 0; i < _reads.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +84,7 @@ namespace BizHawk.Emulation.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CallWrite(uint addr)
|
public void CallWrites(uint addr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _writes.Count; i++)
|
for (int i = 0; i < _writes.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -71,7 +95,7 @@ namespace BizHawk.Emulation.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CallExecute(uint addr)
|
public void CallExecutes(uint addr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _executes.Count; i++)
|
for (int i = 0; i < _executes.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,36 +21,26 @@ namespace BizHawk.Emulation.Common
|
||||||
bool HasExecutes { get; }
|
bool HasExecutes { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a Read callback for the given address
|
/// Adds a callback for the given type to the given address
|
||||||
/// If no address is specified the callback will be hooked to all addresses
|
/// If no address is specified the callback will be hooked to all addresses
|
||||||
|
/// Note: an execute callback can not be added without an address, else an InvalidOperationException will occur
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void AddRead(Action function, uint? addr);
|
void Add(MemoryCallbackType type, Action function, uint? addr);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a Write callback for the given address
|
|
||||||
/// If no address is specified the callback will be hooked to all addresses
|
|
||||||
/// </summary>
|
|
||||||
void AddWrite(Action function, uint? addr);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds an Execute callback for the given address
|
|
||||||
/// </summary>
|
|
||||||
void AddExecute(Action function, uint addr);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes all Read callbacks for the given addr
|
/// Executes all Read callbacks for the given addr
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void CallRead(uint addr);
|
void CallReads(uint addr);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes all Write callbacks for the given addr
|
/// Executes all Write callbacks for the given addr
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void CallWrite(uint addr);
|
void CallWrites(uint addr);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes all Execute callbacks for the given addr
|
/// Executes all Execute callbacks for the given addr
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void CallExecute(uint addr);
|
void CallExecutes(uint addr);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the given callback from the list
|
/// Removes the given callback from the list
|
||||||
|
@ -67,4 +57,6 @@ namespace BizHawk.Emulation.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Clear();
|
void Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MemoryCallbackType { Read, Write, Execute }
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
|
||||||
LagIFlag = FlagI;
|
LagIFlag = FlagI;
|
||||||
|
|
||||||
if (Debug) Logger(State());
|
if (Debug) Logger(State());
|
||||||
Core.MemoryCallbacks.CallExecute(PC);
|
Core.MemoryCallbacks.CallExecutes(PC);
|
||||||
if (CDLLoggingActive) CDLOpcode();
|
if (CDLLoggingActive) CDLOpcode();
|
||||||
|
|
||||||
byte opcode = ReadMemory(PC++);
|
byte opcode = ReadMemory(PC++);
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
ret = rom[romPage * 0x4000 + addr - 0x4000]; //other rom page
|
ret = rom[romPage * 0x4000 + addr - 0x4000]; //other rom page
|
||||||
else ret = ram[addr - 0x8000];
|
else ret = ram[addr - 0x8000];
|
||||||
|
|
||||||
MemoryCallbacks.CallRead(addr);
|
MemoryCallbacks.CallReads(addr);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
return; //other rom page
|
return; //other rom page
|
||||||
else ram[addr - 0x8000] = value;
|
else ram[addr - 0x8000] = value;
|
||||||
|
|
||||||
MemoryCallbacks.CallWrite(addr);
|
MemoryCallbacks.CallWrites(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteHardware(ushort addr, byte value)
|
public void WriteHardware(ushort addr, byte value)
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
|
|
||||||
_mapper.Bit13 = addr.Bit(13);
|
_mapper.Bit13 = addr.Bit(13);
|
||||||
var temp = _mapper.ReadMemory((ushort)(addr & 0x1FFF));
|
var temp = _mapper.ReadMemory((ushort)(addr & 0x1FFF));
|
||||||
MemoryCallbacks.CallRead(addr);
|
MemoryCallbacks.CallReads(addr);
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
|
|
||||||
_mapper.WriteMemory((ushort)(addr & 0x1FFF), value);
|
_mapper.WriteMemory((ushort)(addr & 0x1FFF), value);
|
||||||
|
|
||||||
MemoryCallbacks.CallWrite(addr);
|
MemoryCallbacks.CallWrites(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PokeMemory(ushort addr, byte value)
|
public void PokeMemory(ushort addr, byte value)
|
||||||
|
@ -140,7 +140,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
|
|
||||||
public void ExecFetch(ushort addr)
|
public void ExecFetch(ushort addr)
|
||||||
{
|
{
|
||||||
MemoryCallbacks.CallExecute(addr);
|
MemoryCallbacks.CallExecutes(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MapperBase SetMultiCartMapper(int romLength, int gameTotal)
|
private static MapperBase SetMultiCartMapper(int romLength, int gameTotal)
|
||||||
|
|
|
@ -285,9 +285,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
void InitCallbacks()
|
void InitCallbacks()
|
||||||
{
|
{
|
||||||
padcb = new LibVBANext.StandardCallback(() => InputCallbacks.Call());
|
padcb = new LibVBANext.StandardCallback(() => InputCallbacks.Call());
|
||||||
fetchcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallExecute(addr));
|
fetchcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallExecutes(addr));
|
||||||
readcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallRead(addr));
|
readcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallReads(addr));
|
||||||
writecb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallWrite(addr));
|
writecb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallWrites(addr));
|
||||||
tracecb = new LibVBANext.TraceCallback((addr, opcode) => Tracer.Put(Trace(addr, opcode)));
|
tracecb = new LibVBANext.TraceCallback((addr, opcode) => Tracer.Put(Trace(addr, opcode)));
|
||||||
_inputCallbacks.ActiveChanged += SyncPadCallback;
|
_inputCallbacks.ActiveChanged += SyncPadCallback;
|
||||||
_memorycallbacks.ActiveChanged += SyncMemoryCallbacks;
|
_memorycallbacks.ActiveChanged += SyncMemoryCallbacks;
|
||||||
|
|
|
@ -655,9 +655,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
||||||
|
|
||||||
void InitMemoryCallbacks()
|
void InitMemoryCallbacks()
|
||||||
{
|
{
|
||||||
readcb = (addr) => MemoryCallbacks.CallRead(addr);
|
readcb = (addr) => MemoryCallbacks.CallReads(addr);
|
||||||
writecb = (addr) => MemoryCallbacks.CallWrite(addr);
|
writecb = (addr) => MemoryCallbacks.CallWrites(addr);
|
||||||
execcb = (addr) => MemoryCallbacks.CallExecute(addr);
|
execcb = (addr) => MemoryCallbacks.CallExecutes(addr);
|
||||||
_memorycallbacks.ActiveChanged += RefreshMemoryCallbacks;
|
_memorycallbacks.ActiveChanged += RefreshMemoryCallbacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
||||||
// we RefreshMemoryCallbacks() after the triggers in case the trigger turns itself off at that point
|
// we RefreshMemoryCallbacks() after the triggers in case the trigger turns itself off at that point
|
||||||
if (mcs.HasReads)
|
if (mcs.HasReads)
|
||||||
{
|
{
|
||||||
_readcb = delegate(uint addr) { mcs.CallRead(addr); };
|
_readcb = delegate(uint addr) { mcs.CallReads(addr); };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
||||||
|
|
||||||
if (mcs.HasWrites)
|
if (mcs.HasWrites)
|
||||||
{
|
{
|
||||||
_writecb = delegate(uint addr) { mcs.CallWrite(addr); };
|
_writecb = delegate(uint addr) { mcs.CallWrites(addr); };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -534,7 +534,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
public void ExecFetch(ushort addr)
|
public void ExecFetch(ushort addr)
|
||||||
{
|
{
|
||||||
MemoryCallbacks.CallExecute(addr);
|
MemoryCallbacks.CallExecutes(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte ReadMemory(ushort addr)
|
public byte ReadMemory(ushort addr)
|
||||||
|
@ -579,7 +579,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
ret = sysbus_watch[addr].ApplyGameGenie(ret);
|
ret = sysbus_watch[addr].ApplyGameGenie(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryCallbacks.CallRead(addr);
|
MemoryCallbacks.CallReads(addr);
|
||||||
|
|
||||||
DB = ret;
|
DB = ret;
|
||||||
|
|
||||||
|
@ -633,7 +633,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
board.WritePRG(addr - 0x8000, value);
|
board.WritePRG(addr - 0x8000, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryCallbacks.CallWrite(addr);
|
MemoryCallbacks.CallWrites(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,7 +387,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
|
|
||||||
void ReadHook(uint addr)
|
void ReadHook(uint addr)
|
||||||
{
|
{
|
||||||
MemoryCallbacks.CallRead(addr);
|
MemoryCallbacks.CallReads(addr);
|
||||||
//we RefreshMemoryCallbacks() after the trigger in case the trigger turns itself off at that point
|
//we RefreshMemoryCallbacks() after the trigger in case the trigger turns itself off at that point
|
||||||
//EDIT: for now, theres some IPC re-entrancy problem
|
//EDIT: for now, theres some IPC re-entrancy problem
|
||||||
//RefreshMemoryCallbacks();
|
//RefreshMemoryCallbacks();
|
||||||
|
@ -395,7 +395,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
}
|
}
|
||||||
void ExecHook(uint addr)
|
void ExecHook(uint addr)
|
||||||
{
|
{
|
||||||
MemoryCallbacks.CallExecute(addr);
|
MemoryCallbacks.CallExecutes(addr);
|
||||||
//we RefreshMemoryCallbacks() after the trigger in case the trigger turns itself off at that point
|
//we RefreshMemoryCallbacks() after the trigger in case the trigger turns itself off at that point
|
||||||
//EDIT: for now, theres some IPC re-entrancy problem
|
//EDIT: for now, theres some IPC re-entrancy problem
|
||||||
//RefreshMemoryCallbacks();
|
//RefreshMemoryCallbacks();
|
||||||
|
@ -403,7 +403,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
}
|
}
|
||||||
void WriteHook(uint addr, byte val)
|
void WriteHook(uint addr, byte val)
|
||||||
{
|
{
|
||||||
MemoryCallbacks.CallWrite(addr);
|
MemoryCallbacks.CallWrites(addr);
|
||||||
//we RefreshMemoryCallbacks() after the trigger in case the trigger turns itself off at that point
|
//we RefreshMemoryCallbacks() after the trigger in case the trigger turns itself off at that point
|
||||||
//EDIT: for now, theres some IPC re-entrancy problem
|
//EDIT: for now, theres some IPC re-entrancy problem
|
||||||
//RefreshMemoryCallbacks();
|
//RefreshMemoryCallbacks();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
else
|
else
|
||||||
ret = SystemRam[address & RamSizeMask];
|
ret = SystemRam[address & RamSizeMask];
|
||||||
|
|
||||||
MemoryCallbacks.CallRead(address);
|
MemoryCallbacks.CallReads(address);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
else if (address >= 0xC000)
|
else if (address >= 0xC000)
|
||||||
SystemRam[address & RamSizeMask] = value;
|
SystemRam[address & RamSizeMask] = value;
|
||||||
|
|
||||||
MemoryCallbacks.CallWrite((uint)address);
|
MemoryCallbacks.CallWrites((uint)address);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitExt2kMapper(int size)
|
void InitExt2kMapper(int size)
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
ret = SystemRam[address & RamSizeMask];
|
ret = SystemRam[address & RamSizeMask];
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryCallbacks.CallRead(address);
|
MemoryCallbacks.CallReads(address);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
else if (address == 0xFFFF) RomBank2 = (byte)(value % RomBanks);
|
else if (address == 0xFFFF) RomBank2 = (byte)(value % RomBanks);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MemoryCallbacks.CallWrite((uint)address);
|
MemoryCallbacks.CallWrites((uint)address);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitSegaMapper()
|
void InitSegaMapper()
|
||||||
|
|
|
@ -661,9 +661,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
|
|
||||||
void InitMemCallbacks()
|
void InitMemCallbacks()
|
||||||
{
|
{
|
||||||
ExecCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallExecute(a));
|
ExecCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallExecutes(a));
|
||||||
ReadCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallRead(a));
|
ReadCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallReads(a));
|
||||||
WriteCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallWrite(a));
|
WriteCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallWrites(a));
|
||||||
_memoryCallbacks.ActiveChanged += RefreshMemCallbacks;
|
_memoryCallbacks.ActiveChanged += RefreshMemCallbacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -354,15 +354,15 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
|
|
||||||
void ReadCallback(uint addr)
|
void ReadCallback(uint addr)
|
||||||
{
|
{
|
||||||
MemoryCallbacks.CallRead(addr);
|
MemoryCallbacks.CallReads(addr);
|
||||||
}
|
}
|
||||||
void WriteCallback(uint addr)
|
void WriteCallback(uint addr)
|
||||||
{
|
{
|
||||||
MemoryCallbacks.CallWrite(addr);
|
MemoryCallbacks.CallWrites(addr);
|
||||||
}
|
}
|
||||||
void ExecCallback(uint addr)
|
void ExecCallback(uint addr)
|
||||||
{
|
{
|
||||||
MemoryCallbacks.CallExecute(addr);
|
MemoryCallbacks.CallExecutes(addr);
|
||||||
}
|
}
|
||||||
void ButtonCallback()
|
void ButtonCallback()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue