Call mem callbacks with addr, value

This commit is contained in:
Brian Armstrong 2019-01-24 03:11:25 -08:00
parent 766de68e18
commit a8f293eec8
32 changed files with 109 additions and 102 deletions

View File

@ -13,28 +13,28 @@ namespace BizHawk.Client.ApiHawk
public MemEventsApi () : base() public MemEventsApi () : base()
{ } { }
public void AddReadCallback(Action cb, uint address, string domain) public void AddReadCallback(Action<uint, uint> cb, uint? address, string domain)
{ {
if (DebuggableCore.MemoryCallbacksAvailable()) if (DebuggableCore.MemoryCallbacksAvailable())
{ {
DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Read, "Plugin Hook", cb, address, null)); DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Read, "Plugin Hook", cb, address, null));
} }
} }
public void AddWriteCallback(Action cb, uint address, string domain) public void AddWriteCallback(Action<uint, uint> cb, uint? address, string domain)
{ {
if (DebuggableCore.MemoryCallbacksAvailable()) if (DebuggableCore.MemoryCallbacksAvailable())
{ {
DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Write, "Plugin Hook", cb, address, null)); DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Write, "Plugin Hook", cb, address, null));
} }
} }
public void AddExecCallback(Action cb, uint address, string domain) public void AddExecCallback(Action<uint, uint> cb, uint? address, string domain)
{ {
if (DebuggableCore.MemoryCallbacksAvailable() && DebuggableCore.MemoryCallbacks.ExecuteCallbacksAvailable) if (DebuggableCore.MemoryCallbacksAvailable() && DebuggableCore.MemoryCallbacks.ExecuteCallbacksAvailable)
{ {
DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Execute, "Plugin Hook", cb, address, null)); DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Execute, "Plugin Hook", cb, address, null));
} }
} }
public void RemoveMemoryCallback(Action cb) public void RemoveMemoryCallback(Action<uint, uint> cb)
{ {
if (DebuggableCore.MemoryCallbacksAvailable()) if (DebuggableCore.MemoryCallbacksAvailable())
{ {

View File

@ -4,9 +4,9 @@ namespace BizHawk.Client.ApiHawk
{ {
public interface IMemEvents : IExternalApi public interface IMemEvents : IExternalApi
{ {
void AddReadCallback(Action cb, uint address, string domain); void AddReadCallback(Action<uint, uint> cb, uint? address, string domain);
void AddWriteCallback(Action cb, uint address, string domain); void AddWriteCallback(Action<uint, uint> cb, uint? address, string domain);
void AddExecCallback(Action cb, uint address, string domain); void AddExecCallback(Action<uint, uint> cb, uint? address, string domain);
void RemoveMemoryCallback(Action cb); void RemoveMemoryCallback(Action<uint, uint> cb);
} }
} }

View File

@ -243,7 +243,7 @@ namespace BizHawk.Client.Common
} }
DebuggableCore.MemoryCallbacks.Add( DebuggableCore.MemoryCallbacks.Add(
new MemoryCallback(domain, MemoryCallbackType.Execute, "Lua Hook", nlf.Callback, address, null)); new MemoryCallback(domain, MemoryCallbackType.Execute, "Lua Hook", nlf.MemCallback, address, null));
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
} }
@ -282,7 +282,7 @@ namespace BizHawk.Client.Common
} }
DebuggableCore.MemoryCallbacks.Add( DebuggableCore.MemoryCallbacks.Add(
new MemoryCallback(domain, MemoryCallbackType.Read, "Lua Hook", nlf.Callback, address, null)); new MemoryCallback(domain, MemoryCallbackType.Read, "Lua Hook", nlf.MemCallback, address, null));
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
} }
@ -321,7 +321,7 @@ namespace BizHawk.Client.Common
} }
DebuggableCore.MemoryCallbacks.Add( DebuggableCore.MemoryCallbacks.Add(
new MemoryCallback(domain, MemoryCallbackType.Write, "Lua Hook", nlf.Callback, address, null)); new MemoryCallback(domain, MemoryCallbackType.Write, "Lua Hook", nlf.MemCallback, address, null));
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
} }

View File

@ -24,7 +24,7 @@ namespace BizHawk.Client.Common
if (Global.Emulator.MemoryCallbacksAvailable()) if (Global.Emulator.MemoryCallbacksAvailable())
{ {
Global.Emulator.AsDebuggable().MemoryCallbacks.Remove(function.Callback); Global.Emulator.AsDebuggable().MemoryCallbacks.Remove(function.MemCallback);
} }
return base.Remove(function); return base.Remove(function);
@ -40,7 +40,7 @@ namespace BizHawk.Client.Common
if (Global.Emulator.MemoryCallbacksAvailable()) if (Global.Emulator.MemoryCallbacksAvailable())
{ {
var memoryCallbacks = Global.Emulator.AsDebuggable().MemoryCallbacks; var memoryCallbacks = Global.Emulator.AsDebuggable().MemoryCallbacks;
memoryCallbacks.RemoveAll(this.Select(w => w.Callback)); memoryCallbacks.RemoveAll(this.Select(w => w.MemCallback));
} }
Clear(); Clear();

View File

@ -30,6 +30,11 @@ namespace BizHawk.Client.Common
ex.Message); ex.Message);
} }
}; };
MemCallback = delegate
{
Callback();
};
} }
public Guid Guid { get; private set; } public Guid Guid { get; private set; }
@ -42,6 +47,8 @@ namespace BizHawk.Client.Common
public Action Callback { get; } public Action Callback { get; }
public Action<uint, uint> MemCallback { get; }
public void Call(string name = null) public void Call(string name = null)
{ {
LuaSandbox.Sandbox(Lua, () => LuaSandbox.Sandbox(Lua, () =>

View File

@ -7,7 +7,7 @@ namespace BizHawk.Client.EmuHawk
{ {
public class BreakpointList : List<Breakpoint> public class BreakpointList : List<Breakpoint>
{ {
public Action Callback { get; set; } public Action<uint, uint> Callback { get; set; }
public void Add(IDebuggable core, string scope, uint address, uint mask, MemoryCallbackType type) public void Add(IDebuggable core, string scope, uint address, uint mask, MemoryCallbackType type)
{ {
@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk
private bool _active; private bool _active;
private readonly IDebuggable _core; private readonly IDebuggable _core;
public Breakpoint(bool readOnly, IDebuggable core, string scope, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true) public Breakpoint(bool readOnly, IDebuggable core, string scope, Action<uint, uint> callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
{ {
Scope = scope; Scope = scope;
_core = core; _core = core;
@ -83,7 +83,7 @@ namespace BizHawk.Client.EmuHawk
ReadOnly = readOnly; ReadOnly = readOnly;
} }
public Breakpoint(IDebuggable core, string scope, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true) public Breakpoint(IDebuggable core, string scope, Action<uint, uint> callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
{ {
Scope = scope; Scope = scope;
_core = core; _core = core;
@ -96,7 +96,7 @@ namespace BizHawk.Client.EmuHawk
Active = enabled; Active = enabled;
} }
public Breakpoint(string name, bool readOnly, IDebuggable core, string scope, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true) public Breakpoint(string name, bool readOnly, IDebuggable core, string scope, Action<uint, uint> callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
{ {
Scope = scope; Scope = scope;
_core = core; _core = core;
@ -111,7 +111,7 @@ namespace BizHawk.Client.EmuHawk
} }
public string Scope { get; } public string Scope { get; }
public Action Callback { get; } public Action<uint, uint> Callback { get; }
public uint? Address { get; set; } public uint? Address { get; set; }
public uint? AddressMask { get; set; } public uint? AddressMask { get; set; }
public MemoryCallbackType Type { get; set; } public MemoryCallbackType Type { get; set; }

View File

@ -60,16 +60,16 @@ namespace BizHawk.Client.EmuHawk
: Color.White; : Color.White;
} }
private void BreakpointCallback() private void BreakpointCallback(uint addr, uint value)
{ {
GlobalWin.MainForm.PauseEmulator(); GlobalWin.MainForm.PauseEmulator();
UpdateValues(); UpdateValues();
GlobalWin.OSD.AddMessage("Breakpoint hit"); GlobalWin.OSD.AddMessage("Breakpoint hit");
} }
private void SeekCallback() private void SeekCallback(uint addr, uint value)
{ {
BreakpointCallback(); BreakpointCallback(addr, value);
var seekBreakpoint = _breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName)); var seekBreakpoint = _breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName));

View File

@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Common
protected readonly List<TraceInfo> Buffer = new List<TraceInfo>(); protected readonly List<TraceInfo> Buffer = new List<TraceInfo>();
protected abstract void TraceFromCallback(); protected abstract void TraceFromCallback(uint addr, uint value);
private ITraceSink _sink; private ITraceSink _sink;
@ -80,7 +80,7 @@ namespace BizHawk.Emulation.Common
public class TracingMemoryCallback : IMemoryCallback public class TracingMemoryCallback : IMemoryCallback
{ {
public TracingMemoryCallback(Action callback) public TracingMemoryCallback(Action<uint, uint> callback)
{ {
Callback = callback; Callback = callback;
} }
@ -89,7 +89,7 @@ namespace BizHawk.Emulation.Common
public string Name => "Trace Logging"; public string Name => "Trace Logging";
public Action Callback { get; } public Action<uint, uint> Callback { get; }
public uint? Address => null; public uint? Address => null;

View File

@ -67,38 +67,38 @@ namespace BizHawk.Emulation.Common
} }
} }
private static void Call(ObservableCollection<IMemoryCallback> cbs, uint addr, string scope) private static void Call(ObservableCollection<IMemoryCallback> cbs, uint addr, uint value, string scope)
{ {
for (int i = 0; i < cbs.Count; i++) for (int i = 0; i < cbs.Count; i++)
{ {
if (!cbs[i].Address.HasValue || (cbs[i].Scope == scope && cbs[i].Address == (addr & cbs[i].AddressMask))) if (!cbs[i].Address.HasValue || (cbs[i].Scope == scope && cbs[i].Address == (addr & cbs[i].AddressMask)))
{ {
cbs[i].Callback(); cbs[i].Callback(addr, 0);
} }
} }
} }
public void CallReads(uint addr, string scope) public void CallReads(uint addr, uint value, string scope)
{ {
if (_hasReads) if (_hasReads)
{ {
Call(_reads, addr, scope); Call(_reads, addr, value, scope);
} }
} }
public void CallWrites(uint addr, string scope) public void CallWrites(uint addr, uint value, string scope)
{ {
if (_hasWrites) if (_hasWrites)
{ {
Call(_writes, addr, scope); Call(_writes, addr, value, scope);
} }
} }
public void CallExecutes(uint addr, string scope) public void CallExecutes(uint addr, uint value, string scope)
{ {
if (_hasExecutes) if (_hasExecutes)
{ {
Call(_execs, addr, scope); Call(_execs, addr, value, scope);
} }
} }
@ -136,7 +136,7 @@ namespace BizHawk.Emulation.Common
return (_hasReads != hadReads || _hasWrites != hadWrites || _hasExecutes != hadExecutes); return (_hasReads != hadReads || _hasWrites != hadWrites || _hasExecutes != hadExecutes);
} }
private int RemoveInternal(Action action) private int RemoveInternal(Action<uint, uint> action)
{ {
var readsToRemove = _reads.Where(imc => imc.Callback == action).ToList(); var readsToRemove = _reads.Where(imc => imc.Callback == action).ToList();
var writesToRemove = _writes.Where(imc => imc.Callback == action).ToList(); var writesToRemove = _writes.Where(imc => imc.Callback == action).ToList();
@ -160,7 +160,7 @@ namespace BizHawk.Emulation.Common
return readsToRemove.Count + writesToRemove.Count + execsToRemove.Count; return readsToRemove.Count + writesToRemove.Count + execsToRemove.Count;
} }
public void Remove(Action action) public void Remove(Action<uint, uint> action)
{ {
if (RemoveInternal(action) > 0) if (RemoveInternal(action) > 0)
{ {
@ -171,7 +171,7 @@ namespace BizHawk.Emulation.Common
} }
} }
public void RemoveAll(IEnumerable<Action> actions) public void RemoveAll(IEnumerable<Action<uint, uint>> actions)
{ {
bool changed = false; bool changed = false;
foreach (var action in actions) foreach (var action in actions)
@ -286,7 +286,7 @@ namespace BizHawk.Emulation.Common
public class MemoryCallback : IMemoryCallback public class MemoryCallback : IMemoryCallback
{ {
public MemoryCallback(string scope, MemoryCallbackType type, string name, Action callback, uint? address, uint? mask) public MemoryCallback(string scope, MemoryCallbackType type, string name, Action<uint, uint> callback, uint? address, uint? mask)
{ {
if (type == MemoryCallbackType.Execute && !address.HasValue) if (type == MemoryCallbackType.Execute && !address.HasValue)
{ {
@ -303,7 +303,7 @@ namespace BizHawk.Emulation.Common
public MemoryCallbackType Type { get; } public MemoryCallbackType Type { get; }
public string Name { get; } public string Name { get; }
public Action Callback { get; } public Action<uint, uint> Callback { get; }
public uint? Address { get; } public uint? Address { get; }
public uint? AddressMask { get; } public uint? AddressMask { get; }
public string Scope { get; } public string Scope { get; }

View File

@ -65,31 +65,31 @@ namespace BizHawk.Emulation.Common
/// </summary> /// </summary>
/// <param name="addr">The address to check for callbacks</param> /// <param name="addr">The address to check for callbacks</param>
/// <param name="scope">The scope that the address pertains to. Must be a value in <see cref="AvailableScopes"></param> /// <param name="scope">The scope that the address pertains to. Must be a value in <see cref="AvailableScopes"></param>
void CallReads(uint addr, string scope); void CallReads(uint addr, uint value, string scope);
/// <summary> /// <summary>
/// Executes all Write callbacks for the given address and domain /// Executes all Write callbacks for the given address and domain
/// </summary> /// </summary>
/// <param name="addr">The address to check for callbacks</param> /// <param name="addr">The address to check for callbacks</param>
/// <param name="scope">The scope that the address pertains to. Must be a value in <see cref="AvailableScopes"></param> /// <param name="scope">The scope that the address pertains to. Must be a value in <see cref="AvailableScopes"></param>
void CallWrites(uint addr, string scope); void CallWrites(uint addr, uint value, string scope);
/// <summary> /// <summary>
/// Executes all Execute callbacks for the given address and domain /// Executes all Execute callbacks for the given address and domain
/// </summary> /// </summary>
/// <param name="addr">The address to check for callbacks</param> /// <param name="addr">The address to check for callbacks</param>
/// <param name="scope">The scope that the address pertains to. Must be a value in <see cref="AvailableScopes"></param> /// <param name="scope">The scope that the address pertains to. Must be a value in <see cref="AvailableScopes"></param>
void CallExecutes(uint addr, string scope); void CallExecutes(uint addr, uint value, string scope);
/// <summary> /// <summary>
/// Removes the given callback from the list /// Removes the given callback from the list
/// </summary> /// </summary>
void Remove(Action action); void Remove(Action<uint, uint> action);
/// <summary> /// <summary>
/// Removes the given callbacks from the list /// Removes the given callbacks from the list
/// </summary> /// </summary>
void RemoveAll(IEnumerable<Action> actions); void RemoveAll(IEnumerable<Action<uint, uint>> actions);
/// <summary> /// <summary>
/// Removes all read,write, and execute callbacks /// Removes all read,write, and execute callbacks
@ -111,7 +111,7 @@ namespace BizHawk.Emulation.Common
{ {
MemoryCallbackType Type { get; } MemoryCallbackType Type { get; }
string Name { get; } string Name { get; }
Action Callback { get; } Action<uint, uint> Callback { get; }
uint? Address { get; } uint? Address { get; }
uint? AddressMask { get; } uint? AddressMask { get; }
string Scope { get; } string Scope { get; }

View File

@ -192,7 +192,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
if (MemoryCallbacks != null) if (MemoryCallbacks != null)
{ {
MemoryCallbacks.CallExecutes(RegisterPC, "System Bus"); MemoryCallbacks.CallExecutes(RegisterPC, 0, "System Bus");
} }
switch (opcode) switch (opcode)

View File

@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
{ {
if (MemoryCallbacks != null && !peek) if (MemoryCallbacks != null && !peek)
{ {
MemoryCallbacks.CallReads(addr, "System Bus"); MemoryCallbacks.CallReads(addr, 0, "System Bus");
} }
return ReadMemory(addr, peek); return ReadMemory(addr, peek);
@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
{ {
if (MemoryCallbacks != null && !poke) if (MemoryCallbacks != null && !poke)
{ {
MemoryCallbacks.CallWrites(addr, "System Bus"); MemoryCallbacks.CallWrites(addr, value, "System Bus");
} }
WriteMemory(addr, value, poke); WriteMemory(addr, value, poke);

View File

@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
LagIFlag = FlagI; LagIFlag = FlagI;
if (Debug) Logger(State()); if (Debug) Logger(State());
MemoryCallbacks.CallExecutes(PC, "System Bus"); MemoryCallbacks.CallExecutes(PC, 0, "System Bus");
if (CDL != null && CDL.Active) CDLOpcode(); if (CDL != null && CDL.Active) CDLOpcode();

View File

@ -230,7 +230,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
{ {
byte page = MPR[address >> 13]; byte page = MPR[address >> 13];
var result = ReadMemory21((page << 13) | (address & 0x1FFF)); var result = ReadMemory21((page << 13) | (address & 0x1FFF));
MemoryCallbacks.CallReads(address, "System Bus"); MemoryCallbacks.CallReads(address, result, "System Bus");
return result; return result;
} }
@ -238,7 +238,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
{ {
byte page = MPR[address >> 13]; byte page = MPR[address >> 13];
WriteMemory21((page << 13) | (address & 0x1FFF), value); WriteMemory21((page << 13) | (address & 0x1FFF), value);
MemoryCallbacks.CallWrites(address, "System Bus"); MemoryCallbacks.CallWrites(address, value, "System Bus");
} }
private ushort ReadWord(ushort address) private ushort ReadWord(ushort address)

View File

@ -183,9 +183,9 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
private void SetCallbacks() private void SetCallbacks()
{ {
_machine.Memory.ReadCallback = (addr) => MemoryCallbacks.CallReads(addr, "System Bus"); _machine.Memory.ReadCallback = (addr) => MemoryCallbacks.CallReads(addr, 0, "System Bus");
_machine.Memory.WriteCallback = (addr) => MemoryCallbacks.CallWrites(addr, "System Bus"); _machine.Memory.WriteCallback = (addr) => MemoryCallbacks.CallWrites(addr, 0, "System Bus");
_machine.Memory.ExecuteCallback = (addr) => MemoryCallbacks.CallExecutes(addr, "System Bus"); _machine.Memory.ExecuteCallback = (addr) => MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
_machine.Memory.InputCallback = InputCallbacks.Call; _machine.Memory.InputCallback = InputCallbacks.Call;
} }
} }

View File

@ -160,7 +160,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));
_tia.BusState = temp; _tia.BusState = temp;
MemoryCallbacks.CallReads(addr, "System Bus"); MemoryCallbacks.CallReads(addr, 0, "System Bus");
return temp; return temp;
} }
@ -181,7 +181,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_mapper.WriteMemory((ushort)(addr & 0x1FFF), value); _mapper.WriteMemory((ushort)(addr & 0x1FFF), value);
MemoryCallbacks.CallWrites(addr, "System Bus"); MemoryCallbacks.CallWrites(addr, value, "System Bus");
} }
internal void PokeMemory(ushort addr, byte value) internal void PokeMemory(ushort addr, byte value)
@ -191,7 +191,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private void ExecFetch(ushort addr) private void ExecFetch(ushort addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
} }
private void RebootCore() private void RebootCore()

View File

@ -291,7 +291,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
private void ExecFetch(ushort addr) private void ExecFetch(ushort addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
} }
private void Reset_Mapper(string m) private void Reset_Mapper(string m)

View File

@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{ {
public byte ReadMemory(ushort addr) public byte ReadMemory(ushort addr)
{ {
MemoryCallbacks.CallReads(addr, "System Bus"); MemoryCallbacks.CallReads(addr, 0, "System Bus");
if ((addr & 0xFCE0) == 0) if ((addr & 0xFCE0) == 0)
{ {
@ -98,7 +98,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
public void WriteMemory(ushort addr, byte value) public void WriteMemory(ushort addr, byte value)
{ {
MemoryCallbacks.CallWrites(addr, "System Bus"); MemoryCallbacks.CallWrites(addr, value, "System Bus");
if ((addr & 0xFCE0) == 0) if ((addr & 0xFCE0) == 0)
{ {

View File

@ -168,9 +168,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.CallExecutes(addr, "System Bus")); fetchcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallExecutes(addr, 0, "System Bus"));
readcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallReads(addr, "System Bus")); readcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallReads(addr, 0, "System Bus"));
writecb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallWrites(addr, "System Bus")); writecb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallWrites(addr, 0, "System Bus"));
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;

View File

@ -296,7 +296,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
private void ExecFetch(ushort addr) private void ExecFetch(ushort addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
} }
private void Setup_Mapper() private void Setup_Mapper()

View File

@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{ {
public byte ReadMemory(ushort addr) public byte ReadMemory(ushort addr)
{ {
MemoryCallbacks.CallReads(addr, "System Bus"); MemoryCallbacks.CallReads(addr, 0, "System Bus");
addr_access = addr; addr_access = addr;
if (ppu.DMA_start) if (ppu.DMA_start)
@ -157,7 +157,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public void WriteMemory(ushort addr, byte value) public void WriteMemory(ushort addr, byte value)
{ {
MemoryCallbacks.CallWrites(addr, "System Bus"); MemoryCallbacks.CallWrites(addr, value, "System Bus");
addr_access = addr; addr_access = addr;
if (ppu.DMA_start) if (ppu.DMA_start)

View File

@ -96,7 +96,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
private void ExecFetch(ushort addr) private void ExecFetch(ushort addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
} }
} }
} }

View File

@ -59,19 +59,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
private void ReadCallback(uint address, ulong cycleOffset) private void ReadCallback(uint address, ulong cycleOffset)
{ {
callbackCycleCount = _cycleCount + cycleOffset; callbackCycleCount = _cycleCount + cycleOffset;
MemoryCallbacks.CallReads(address, "System Bus"); MemoryCallbacks.CallReads(address, 0, "System Bus");
} }
private void WriteCallback(uint address, ulong cycleOffset) private void WriteCallback(uint address, ulong cycleOffset)
{ {
callbackCycleCount = _cycleCount + cycleOffset; callbackCycleCount = _cycleCount + cycleOffset;
MemoryCallbacks.CallWrites(address, "System Bus"); MemoryCallbacks.CallWrites(address, 0, "System Bus");
} }
private void ExecCallback(uint address, ulong cycleOffset) private void ExecCallback(uint address, ulong cycleOffset)
{ {
callbackCycleCount = _cycleCount + cycleOffset; callbackCycleCount = _cycleCount + cycleOffset;
MemoryCallbacks.CallExecutes(address, "System Bus"); MemoryCallbacks.CallExecutes(address, 0, "System Bus");
} }
/// <summary> /// <summary>

View File

@ -755,13 +755,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
switch (_breakparams._type) switch (_breakparams._type)
{ {
case BreakType.Read: case BreakType.Read:
_breakparams._mcs.CallReads(_breakparams._addr, "System Bus"); _breakparams._mcs.CallReads(_breakparams._addr, 0, "System Bus");
break; break;
case BreakType.Write: case BreakType.Write:
_breakparams._mcs.CallWrites(_breakparams._addr, "System Bus"); _breakparams._mcs.CallWrites(_breakparams._addr, 0, "System Bus");
break; break;
case BreakType.Execute: case BreakType.Execute:
_breakparams._mcs.CallExecutes(_breakparams._addr, "System Bus"); _breakparams._mcs.CallExecutes(_breakparams._addr, 0, "System Bus");
break; break;
} }

View File

@ -916,7 +916,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public void ExecFetch(ushort addr) public void ExecFetch(ushort addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
} }
public byte ReadMemory(ushort addr) public byte ReadMemory(ushort addr)
@ -966,7 +966,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
} }
} }
MemoryCallbacks.CallReads(addr, "System Bus"); MemoryCallbacks.CallReads(addr, ret, "System Bus");
DB = ret; DB = ret;
return ret; return ret;
@ -1013,7 +1013,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Board.WritePRG(addr - 0x8000, value); Board.WritePRG(addr - 0x8000, value);
} }
MemoryCallbacks.CallWrites(addr, "System Bus"); MemoryCallbacks.CallWrites(addr, value, "System Bus");
} }
// the palette for each VS game needs to be chosen explicitly since there are 6 different ones. // the palette for each VS game needs to be chosen explicitly since there are 6 different ones.

View File

@ -364,7 +364,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
private void ReadHook(uint addr) private void ReadHook(uint addr)
{ {
MemoryCallbacks.CallReads(addr, "System Bus"); MemoryCallbacks.CallReads(addr, 0, "System Bus");
// 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();
@ -372,7 +372,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
private void ExecHook(uint addr) private void ExecHook(uint addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
// 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();
@ -380,7 +380,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
private void WriteHook(uint addr, byte val) private void WriteHook(uint addr, byte val)
{ {
MemoryCallbacks.CallWrites(addr, "System Bus"); MemoryCallbacks.CallWrites(addr, val, "System Bus");
// 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();
@ -388,17 +388,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
private void ReadHook_SMP(uint addr) private void ReadHook_SMP(uint addr)
{ {
MemoryCallbacks.CallReads(addr, "SMP"); MemoryCallbacks.CallReads(addr, 0, "SMP");
} }
private void ExecHook_SMP(uint addr) private void ExecHook_SMP(uint addr)
{ {
MemoryCallbacks.CallExecutes(addr, "SMP"); MemoryCallbacks.CallExecutes(addr, 0, "SMP");
} }
private void WriteHook_SMP(uint addr, byte val) private void WriteHook_SMP(uint addr, byte val)
{ {
MemoryCallbacks.CallWrites(addr, "SMP"); MemoryCallbacks.CallWrites(addr, val, "SMP");
} }
private enum LoadParamType private enum LoadParamType

View File

@ -73,7 +73,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
private void ExecFetch(ushort addr) private void ExecFetch(ushort addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
} }
#region ISettable #region ISettable

View File

@ -283,7 +283,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
private byte ReadMemory(ushort addr) private byte ReadMemory(ushort addr)
{ {
MemoryCallbacks.CallReads(addr, "System Bus"); MemoryCallbacks.CallReads(addr, 0, "System Bus");
return ReadMemoryMapper(addr); return ReadMemoryMapper(addr);
} }
@ -292,7 +292,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{ {
WriteMemoryMapper(addr, value); WriteMemoryMapper(addr, value);
MemoryCallbacks.CallWrites(addr, "System Bus"); MemoryCallbacks.CallWrites(addr, value, "System Bus");
} }
private byte FetchMemory(ushort addr) private byte FetchMemory(ushort addr)
@ -302,7 +302,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
private void OnExecMemory(ushort addr) private void OnExecMemory(ushort addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
} }
/// <summary> /// <summary>

View File

@ -61,9 +61,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
private void InitMemCallbacks() private void InitMemCallbacks()
{ {
ExecCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallExecutes(a, "M68K BUS")); ExecCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallExecutes(a, 0, "M68K BUS"));
ReadCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallReads(a, "M68K BUS")); ReadCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallReads(a, 0, "M68K BUS"));
WriteCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallWrites(a, "M68K BUS")); WriteCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallWrites(a, 0, "M68K BUS"));
_memoryCallbacks.ActiveChanged += RefreshMemCallbacks; _memoryCallbacks.ActiveChanged += RefreshMemCallbacks;
} }

View File

@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
Header = "M68K: PC, machine code, mnemonic, operands, registers (D0-D7, A0-A7, SR, USP), flags (XNZVC)"; Header = "M68K: PC, machine code, mnemonic, operands, registers (D0-D7, A0-A7, SR, USP), flags (XNZVC)";
} }
protected override void TraceFromCallback() protected override void TraceFromCallback(uint addr, uint value)
{ {
var regs = DebuggableCore.GetCpuFlagsAndRegisters(); var regs = DebuggableCore.GetCpuFlagsAndRegisters();
uint pc = (uint)regs["M68K PC"].Value; uint pc = (uint)regs["M68K PC"].Value;

View File

@ -883,13 +883,13 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
switch (type) switch (type)
{ {
case OctoshockDll.eShockMemCb.Read: case OctoshockDll.eShockMemCb.Read:
MemoryCallbacks.CallReads(address, "System Bus"); MemoryCallbacks.CallReads(address, value, "System Bus");
break; break;
case OctoshockDll.eShockMemCb.Write: case OctoshockDll.eShockMemCb.Write:
MemoryCallbacks.CallWrites(address, "System Bus"); MemoryCallbacks.CallWrites(address, value, "System Bus");
break; break;
case OctoshockDll.eShockMemCb.Execute: case OctoshockDll.eShockMemCb.Execute:
MemoryCallbacks.CallExecutes(address, "System Bus"); MemoryCallbacks.CallExecutes(address, value, "System Bus");
break; break;
} }
} }

View File

@ -142,15 +142,15 @@ namespace BizHawk.Emulation.Cores.WonderSwan
void ReadCallback(uint addr) void ReadCallback(uint addr)
{ {
MemoryCallbacks.CallReads(addr, "System Bus"); MemoryCallbacks.CallReads(addr, 0, "System Bus");
} }
void WriteCallback(uint addr) void WriteCallback(uint addr)
{ {
MemoryCallbacks.CallWrites(addr, "System Bus"); MemoryCallbacks.CallWrites(addr, 0, "System Bus");
} }
void ExecCallback(uint addr) void ExecCallback(uint addr)
{ {
MemoryCallbacks.CallExecutes(addr, "System Bus"); MemoryCallbacks.CallExecutes(addr, 0, "System Bus");
} }
void ButtonCallback() void ButtonCallback()
{ {