From a8f293eec8ae4e9a5008912fed57bd3586e90e91 Mon Sep 17 00:00:00 2001 From: Brian Armstrong Date: Thu, 24 Jan 2019 03:11:25 -0800 Subject: [PATCH] Call mem callbacks with addr, value --- .../Classes/Api/MemEventsApi.cs | 8 +++--- .../Interfaces/Api/IMemEvents.cs | 24 ++++++++--------- .../lua/EmuLuaLibrary.Events.cs | 6 ++--- BizHawk.Client.Common/lua/LuaFunctionList.cs | 4 +-- BizHawk.Client.Common/lua/NamedLuaFunction.cs | 7 +++++ .../tools/Debugger/Breakpoint.cs | 10 +++---- .../tools/Debugger/BreakpointControl.cs | 6 ++--- .../CallbackBasedTraceBuffer.cs | 6 ++--- .../MemoryCallbackSystem.cs | 26 +++++++++---------- .../Interfaces/IMemoryCallbackSystem.cs | 12 ++++----- .../CPUs/CP1610/CP1610.Execute.cs | 2 +- BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs | 4 +-- .../CPUs/HuC6280/Execute.cs | 2 +- .../CPUs/HuC6280/HuC6280.cs | 4 +-- .../Computers/AppleII/AppleII.cs | 6 ++--- .../Consoles/Atari/2600/Atari2600.Core.cs | 6 ++--- .../Consoles/Atari/A7800Hawk/A7800Hawk.cs | 2 +- .../Consoles/Atari/A7800Hawk/MemoryMap.cs | 4 +-- .../Consoles/Nintendo/GBA/VBANext.cs | 6 ++--- .../Consoles/Nintendo/GBHawk/GBHawk.cs | 2 +- .../Consoles/Nintendo/GBHawk/MemoryMap.cs | 4 +-- .../Nintendo/GBHawkLink/GBHawkLink.cs | 2 +- .../Nintendo/Gameboy/Gambatte.IDebuggable.cs | 6 ++--- .../N64/NativeApi/mupen64plusCoreApi.cs | 6 ++--- .../Consoles/Nintendo/NES/NES.Core.cs | 6 ++--- .../Consoles/Nintendo/SNES/LibsnesCore.cs | 12 ++++----- .../Nintendo/SubNESHawk/SubNESHawk.cs | 2 +- .../Consoles/Sega/SMS/SMS.cs | 6 ++--- .../Consoles/Sega/gpgx64/GPGX.IDebuggable.cs | 6 ++--- .../Consoles/Sega/gpgx64/GPGX.ITraceable.cs | 2 +- .../Consoles/Sony/PSX/Octoshock.cs | 6 ++--- .../Consoles/WonderSwan/WonderSwan.cs | 6 ++--- 32 files changed, 109 insertions(+), 102 deletions(-) diff --git a/BizHawk.Client.ApiHawk/Classes/Api/MemEventsApi.cs b/BizHawk.Client.ApiHawk/Classes/Api/MemEventsApi.cs index 5848df5fc3..8db4c5223f 100644 --- a/BizHawk.Client.ApiHawk/Classes/Api/MemEventsApi.cs +++ b/BizHawk.Client.ApiHawk/Classes/Api/MemEventsApi.cs @@ -13,28 +13,28 @@ namespace BizHawk.Client.ApiHawk public MemEventsApi () : base() { } - public void AddReadCallback(Action cb, uint address, string domain) + public void AddReadCallback(Action cb, uint? address, string domain) { if (DebuggableCore.MemoryCallbacksAvailable()) { 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 cb, uint? address, string domain) { if (DebuggableCore.MemoryCallbacksAvailable()) { 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 cb, uint? address, string domain) { if (DebuggableCore.MemoryCallbacksAvailable() && DebuggableCore.MemoryCallbacks.ExecuteCallbacksAvailable) { DebuggableCore.MemoryCallbacks.Add(new MemoryCallback(domain, MemoryCallbackType.Execute, "Plugin Hook", cb, address, null)); } } - public void RemoveMemoryCallback(Action cb) + public void RemoveMemoryCallback(Action cb) { if (DebuggableCore.MemoryCallbacksAvailable()) { diff --git a/BizHawk.Client.ApiHawk/Interfaces/Api/IMemEvents.cs b/BizHawk.Client.ApiHawk/Interfaces/Api/IMemEvents.cs index b8650a9139..2b497ea11c 100644 --- a/BizHawk.Client.ApiHawk/Interfaces/Api/IMemEvents.cs +++ b/BizHawk.Client.ApiHawk/Interfaces/Api/IMemEvents.cs @@ -1,12 +1,12 @@ -using System; - -namespace BizHawk.Client.ApiHawk -{ - public interface IMemEvents : IExternalApi - { - void AddReadCallback(Action cb, uint address, string domain); - void AddWriteCallback(Action cb, uint address, string domain); - void AddExecCallback(Action cb, uint address, string domain); - void RemoveMemoryCallback(Action cb); - } -} +using System; + +namespace BizHawk.Client.ApiHawk +{ + public interface IMemEvents : IExternalApi + { + void AddReadCallback(Action cb, uint? address, string domain); + void AddWriteCallback(Action cb, uint? address, string domain); + void AddExecCallback(Action cb, uint? address, string domain); + void RemoveMemoryCallback(Action cb); + } +} diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs index f8d94f10e8..594ae78d2e 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs @@ -243,7 +243,7 @@ namespace BizHawk.Client.Common } 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(); } } @@ -282,7 +282,7 @@ namespace BizHawk.Client.Common } 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(); } } @@ -321,7 +321,7 @@ namespace BizHawk.Client.Common } 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(); } } diff --git a/BizHawk.Client.Common/lua/LuaFunctionList.cs b/BizHawk.Client.Common/lua/LuaFunctionList.cs index 45ec368722..87d36e9d3b 100644 --- a/BizHawk.Client.Common/lua/LuaFunctionList.cs +++ b/BizHawk.Client.Common/lua/LuaFunctionList.cs @@ -24,7 +24,7 @@ namespace BizHawk.Client.Common if (Global.Emulator.MemoryCallbacksAvailable()) { - Global.Emulator.AsDebuggable().MemoryCallbacks.Remove(function.Callback); + Global.Emulator.AsDebuggable().MemoryCallbacks.Remove(function.MemCallback); } return base.Remove(function); @@ -40,7 +40,7 @@ namespace BizHawk.Client.Common if (Global.Emulator.MemoryCallbacksAvailable()) { var memoryCallbacks = Global.Emulator.AsDebuggable().MemoryCallbacks; - memoryCallbacks.RemoveAll(this.Select(w => w.Callback)); + memoryCallbacks.RemoveAll(this.Select(w => w.MemCallback)); } Clear(); diff --git a/BizHawk.Client.Common/lua/NamedLuaFunction.cs b/BizHawk.Client.Common/lua/NamedLuaFunction.cs index d10d2eb0b3..2bdb677ed9 100644 --- a/BizHawk.Client.Common/lua/NamedLuaFunction.cs +++ b/BizHawk.Client.Common/lua/NamedLuaFunction.cs @@ -30,6 +30,11 @@ namespace BizHawk.Client.Common ex.Message); } }; + + MemCallback = delegate + { + Callback(); + }; } public Guid Guid { get; private set; } @@ -42,6 +47,8 @@ namespace BizHawk.Client.Common public Action Callback { get; } + public Action MemCallback { get; } + public void Call(string name = null) { LuaSandbox.Sandbox(Lua, () => diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs b/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs index 3f4aca4106..3d9ea3b08b 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs @@ -7,7 +7,7 @@ namespace BizHawk.Client.EmuHawk { public class BreakpointList : List { - public Action Callback { get; set; } + public Action Callback { get; set; } 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 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 callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true) { Scope = scope; _core = core; @@ -83,7 +83,7 @@ namespace BizHawk.Client.EmuHawk 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 callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true) { Scope = scope; _core = core; @@ -96,7 +96,7 @@ namespace BizHawk.Client.EmuHawk 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 callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true) { Scope = scope; _core = core; @@ -111,7 +111,7 @@ namespace BizHawk.Client.EmuHawk } public string Scope { get; } - public Action Callback { get; } + public Action Callback { get; } public uint? Address { get; set; } public uint? AddressMask { get; set; } public MemoryCallbackType Type { get; set; } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs index 17428ebc77..2224cb3e56 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs @@ -60,16 +60,16 @@ namespace BizHawk.Client.EmuHawk : Color.White; } - private void BreakpointCallback() + private void BreakpointCallback(uint addr, uint value) { GlobalWin.MainForm.PauseEmulator(); UpdateValues(); 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)); diff --git a/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs b/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs index 4a93abc213..b37479fd36 100644 --- a/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs +++ b/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs @@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Common protected readonly List Buffer = new List(); - protected abstract void TraceFromCallback(); + protected abstract void TraceFromCallback(uint addr, uint value); private ITraceSink _sink; @@ -80,7 +80,7 @@ namespace BizHawk.Emulation.Common public class TracingMemoryCallback : IMemoryCallback { - public TracingMemoryCallback(Action callback) + public TracingMemoryCallback(Action callback) { Callback = callback; } @@ -89,7 +89,7 @@ namespace BizHawk.Emulation.Common public string Name => "Trace Logging"; - public Action Callback { get; } + public Action Callback { get; } public uint? Address => null; diff --git a/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs b/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs index 0df3232a4a..24edf2dde6 100644 --- a/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs +++ b/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs @@ -67,38 +67,38 @@ namespace BizHawk.Emulation.Common } } - private static void Call(ObservableCollection cbs, uint addr, string scope) + private static void Call(ObservableCollection cbs, uint addr, uint value, string scope) { for (int i = 0; i < cbs.Count; i++) { 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) { - 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) { - 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) { - Call(_execs, addr, scope); + Call(_execs, addr, value, scope); } } @@ -136,7 +136,7 @@ namespace BizHawk.Emulation.Common return (_hasReads != hadReads || _hasWrites != hadWrites || _hasExecutes != hadExecutes); } - private int RemoveInternal(Action action) + private int RemoveInternal(Action action) { var readsToRemove = _reads.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; } - public void Remove(Action action) + public void Remove(Action action) { if (RemoveInternal(action) > 0) { @@ -171,7 +171,7 @@ namespace BizHawk.Emulation.Common } } - public void RemoveAll(IEnumerable actions) + public void RemoveAll(IEnumerable> actions) { bool changed = false; foreach (var action in actions) @@ -286,7 +286,7 @@ namespace BizHawk.Emulation.Common 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 callback, uint? address, uint? mask) { if (type == MemoryCallbackType.Execute && !address.HasValue) { @@ -303,7 +303,7 @@ namespace BizHawk.Emulation.Common public MemoryCallbackType Type { get; } public string Name { get; } - public Action Callback { get; } + public Action Callback { get; } public uint? Address { get; } public uint? AddressMask { get; } public string Scope { get; } diff --git a/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs b/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs index f87a8e492d..24cee31137 100644 --- a/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs +++ b/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs @@ -65,31 +65,31 @@ namespace BizHawk.Emulation.Common /// /// The address to check for callbacks /// The scope that the address pertains to. Must be a value in - void CallReads(uint addr, string scope); + void CallReads(uint addr, uint value, string scope); /// /// Executes all Write callbacks for the given address and domain /// /// The address to check for callbacks /// The scope that the address pertains to. Must be a value in - void CallWrites(uint addr, string scope); + void CallWrites(uint addr, uint value, string scope); /// /// Executes all Execute callbacks for the given address and domain /// /// The address to check for callbacks /// The scope that the address pertains to. Must be a value in - void CallExecutes(uint addr, string scope); + void CallExecutes(uint addr, uint value, string scope); /// /// Removes the given callback from the list /// - void Remove(Action action); + void Remove(Action action); /// /// Removes the given callbacks from the list /// - void RemoveAll(IEnumerable actions); + void RemoveAll(IEnumerable> actions); /// /// Removes all read,write, and execute callbacks @@ -111,7 +111,7 @@ namespace BizHawk.Emulation.Common { MemoryCallbackType Type { get; } string Name { get; } - Action Callback { get; } + Action Callback { get; } uint? Address { get; } uint? AddressMask { get; } string Scope { get; } diff --git a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs index c30c140bff..8d36295e3f 100644 --- a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs +++ b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs @@ -192,7 +192,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610 if (MemoryCallbacks != null) { - MemoryCallbacks.CallExecutes(RegisterPC, "System Bus"); + MemoryCallbacks.CallExecutes(RegisterPC, 0, "System Bus"); } switch (opcode) diff --git a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs index 8a4ced6fa0..5f6c87ef66 100644 --- a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs +++ b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs @@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610 { if (MemoryCallbacks != null && !peek) { - MemoryCallbacks.CallReads(addr, "System Bus"); + MemoryCallbacks.CallReads(addr, 0, "System Bus"); } return ReadMemory(addr, peek); @@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610 { if (MemoryCallbacks != null && !poke) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + MemoryCallbacks.CallWrites(addr, value, "System Bus"); } WriteMemory(addr, value, poke); diff --git a/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs b/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs index e86edcc297..09328c92df 100644 --- a/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs +++ b/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs @@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 LagIFlag = FlagI; if (Debug) Logger(State()); - MemoryCallbacks.CallExecutes(PC, "System Bus"); + MemoryCallbacks.CallExecutes(PC, 0, "System Bus"); if (CDL != null && CDL.Active) CDLOpcode(); diff --git a/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs b/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs index 9e2e8ad470..6f95f789ae 100644 --- a/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs +++ b/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs @@ -230,7 +230,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 { byte page = MPR[address >> 13]; var result = ReadMemory21((page << 13) | (address & 0x1FFF)); - MemoryCallbacks.CallReads(address, "System Bus"); + MemoryCallbacks.CallReads(address, result, "System Bus"); return result; } @@ -238,7 +238,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 { byte page = MPR[address >> 13]; WriteMemory21((page << 13) | (address & 0x1FFF), value); - MemoryCallbacks.CallWrites(address, "System Bus"); + MemoryCallbacks.CallWrites(address, value, "System Bus"); } private ushort ReadWord(ushort address) diff --git a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs index e67abf06ef..9d35c23ea2 100644 --- a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs +++ b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs @@ -183,9 +183,9 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII private void SetCallbacks() { - _machine.Memory.ReadCallback = (addr) => MemoryCallbacks.CallReads(addr, "System Bus"); - _machine.Memory.WriteCallback = (addr) => MemoryCallbacks.CallWrites(addr, "System Bus"); - _machine.Memory.ExecuteCallback = (addr) => MemoryCallbacks.CallExecutes(addr, "System Bus"); + _machine.Memory.ReadCallback = (addr) => MemoryCallbacks.CallReads(addr, 0, "System Bus"); + _machine.Memory.WriteCallback = (addr) => MemoryCallbacks.CallWrites(addr, 0, "System Bus"); + _machine.Memory.ExecuteCallback = (addr) => MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); _machine.Memory.InputCallback = InputCallbacks.Call; } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs index 4d9bb84286..199a2ea393 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs @@ -160,7 +160,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _mapper.Bit13 = addr.Bit(13); var temp = _mapper.ReadMemory((ushort)(addr & 0x1FFF)); _tia.BusState = temp; - MemoryCallbacks.CallReads(addr, "System Bus"); + MemoryCallbacks.CallReads(addr, 0, "System Bus"); return temp; } @@ -181,7 +181,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _mapper.WriteMemory((ushort)(addr & 0x1FFF), value); - MemoryCallbacks.CallWrites(addr, "System Bus"); + MemoryCallbacks.CallWrites(addr, value, "System Bus"); } internal void PokeMemory(ushort addr, byte value) @@ -191,7 +191,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); } private void RebootCore() diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs index 7d64189dca..cdf8024739 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs @@ -291,7 +291,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); } private void Reset_Mapper(string m) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs index 6f3e76aba5..fc8108ce99 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs @@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk { public byte ReadMemory(ushort addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + MemoryCallbacks.CallReads(addr, 0, "System Bus"); if ((addr & 0xFCE0) == 0) { @@ -98,7 +98,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk public void WriteMemory(ushort addr, byte value) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + MemoryCallbacks.CallWrites(addr, value, "System Bus"); if ((addr & 0xFCE0) == 0) { diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs index 247d7fd68d..3e9493c92b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs @@ -168,9 +168,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA void InitCallbacks() { padcb = new LibVBANext.StandardCallback(() => InputCallbacks.Call()); - fetchcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallExecutes(addr, "System Bus")); - readcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallReads(addr, "System Bus")); - writecb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallWrites(addr, "System Bus")); + fetchcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallExecutes(addr, 0, "System Bus")); + readcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallReads(addr, 0, "System Bus")); + writecb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallWrites(addr, 0, "System Bus")); tracecb = new LibVBANext.TraceCallback((addr, opcode) => Tracer.Put(Trace(addr, opcode))); _inputCallbacks.ActiveChanged += SyncPadCallback; _memorycallbacks.ActiveChanged += SyncMemoryCallbacks; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs index 00e89a039e..efe4d40e05 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs @@ -296,7 +296,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); } private void Setup_Mapper() diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/MemoryMap.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/MemoryMap.cs index fdeafdc9e3..fa546bb745 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/MemoryMap.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/MemoryMap.cs @@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { public byte ReadMemory(ushort addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + MemoryCallbacks.CallReads(addr, 0, "System Bus"); addr_access = addr; if (ppu.DMA_start) @@ -157,7 +157,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk public void WriteMemory(ushort addr, byte value) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + MemoryCallbacks.CallWrites(addr, value, "System Bus"); addr_access = addr; if (ppu.DMA_start) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs index 619a17c479..6b6382d4b6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs @@ -96,7 +96,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs index 075ee71d27..1006903e43 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs @@ -59,19 +59,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy private void ReadCallback(uint address, ulong cycleOffset) { callbackCycleCount = _cycleCount + cycleOffset; - MemoryCallbacks.CallReads(address, "System Bus"); + MemoryCallbacks.CallReads(address, 0, "System Bus"); } private void WriteCallback(uint address, ulong cycleOffset) { callbackCycleCount = _cycleCount + cycleOffset; - MemoryCallbacks.CallWrites(address, "System Bus"); + MemoryCallbacks.CallWrites(address, 0, "System Bus"); } private void ExecCallback(uint address, ulong cycleOffset) { callbackCycleCount = _cycleCount + cycleOffset; - MemoryCallbacks.CallExecutes(address, "System Bus"); + MemoryCallbacks.CallExecutes(address, 0, "System Bus"); } /// diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs index c499855ae5..1f89a92ece 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs @@ -755,13 +755,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi switch (_breakparams._type) { case BreakType.Read: - _breakparams._mcs.CallReads(_breakparams._addr, "System Bus"); + _breakparams._mcs.CallReads(_breakparams._addr, 0, "System Bus"); break; case BreakType.Write: - _breakparams._mcs.CallWrites(_breakparams._addr, "System Bus"); + _breakparams._mcs.CallWrites(_breakparams._addr, 0, "System Bus"); break; case BreakType.Execute: - _breakparams._mcs.CallExecutes(_breakparams._addr, "System Bus"); + _breakparams._mcs.CallExecutes(_breakparams._addr, 0, "System Bus"); break; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs index ac9f0d3b26..72fa925abd 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs @@ -916,7 +916,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); } 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; return ret; @@ -1013,7 +1013,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES 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. diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index 94e6335b79..dbd655cc9a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -364,7 +364,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES 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 // EDIT: for now, theres some IPC re-entrancy problem // RefreshMemoryCallbacks(); @@ -372,7 +372,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES 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 // EDIT: for now, theres some IPC re-entrancy problem // RefreshMemoryCallbacks(); @@ -380,7 +380,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES 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 // EDIT: for now, theres some IPC re-entrancy problem // RefreshMemoryCallbacks(); @@ -388,17 +388,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES private void ReadHook_SMP(uint addr) { - MemoryCallbacks.CallReads(addr, "SMP"); + MemoryCallbacks.CallReads(addr, 0, "SMP"); } private void ExecHook_SMP(uint addr) { - MemoryCallbacks.CallExecutes(addr, "SMP"); + MemoryCallbacks.CallExecutes(addr, 0, "SMP"); } private void WriteHook_SMP(uint addr, byte val) { - MemoryCallbacks.CallWrites(addr, "SMP"); + MemoryCallbacks.CallWrites(addr, val, "SMP"); } private enum LoadParamType diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs index bc20055601..6ae3dc1d52 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs @@ -73,7 +73,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); } #region ISettable diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index bba177d817..5430c859de 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -283,7 +283,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem private byte ReadMemory(ushort addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + MemoryCallbacks.CallReads(addr, 0, "System Bus"); return ReadMemoryMapper(addr); } @@ -292,7 +292,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem { WriteMemoryMapper(addr, value); - MemoryCallbacks.CallWrites(addr, "System Bus"); + MemoryCallbacks.CallWrites(addr, value, "System Bus"); } private byte FetchMemory(ushort addr) @@ -302,7 +302,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem private void OnExecMemory(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); } /// diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs index 9b5e7363d9..dd895b4cb4 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs @@ -61,9 +61,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx private void InitMemCallbacks() { - ExecCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallExecutes(a, "M68K BUS")); - ReadCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallReads(a, "M68K BUS")); - WriteCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallWrites(a, "M68K BUS")); + ExecCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallExecutes(a, 0, "M68K BUS")); + ReadCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallReads(a, 0, "M68K BUS")); + WriteCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallWrites(a, 0, "M68K BUS")); _memoryCallbacks.ActiveChanged += RefreshMemCallbacks; } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.ITraceable.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.ITraceable.cs index c8d8dab662..7c6717e04c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.ITraceable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.ITraceable.cs @@ -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)"; } - protected override void TraceFromCallback() + protected override void TraceFromCallback(uint addr, uint value) { var regs = DebuggableCore.GetCpuFlagsAndRegisters(); uint pc = (uint)regs["M68K PC"].Value; diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index eca318a577..06f3145933 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -883,13 +883,13 @@ namespace BizHawk.Emulation.Cores.Sony.PSX switch (type) { case OctoshockDll.eShockMemCb.Read: - MemoryCallbacks.CallReads(address, "System Bus"); + MemoryCallbacks.CallReads(address, value, "System Bus"); break; case OctoshockDll.eShockMemCb.Write: - MemoryCallbacks.CallWrites(address, "System Bus"); + MemoryCallbacks.CallWrites(address, value, "System Bus"); break; case OctoshockDll.eShockMemCb.Execute: - MemoryCallbacks.CallExecutes(address, "System Bus"); + MemoryCallbacks.CallExecutes(address, value, "System Bus"); break; } } diff --git a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs index b5224065ea..5fcb14f2a8 100644 --- a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs +++ b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs @@ -142,15 +142,15 @@ namespace BizHawk.Emulation.Cores.WonderSwan void ReadCallback(uint addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + MemoryCallbacks.CallReads(addr, 0, "System Bus"); } void WriteCallback(uint addr) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + MemoryCallbacks.CallWrites(addr, 0, "System Bus"); } void ExecCallback(uint addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + MemoryCallbacks.CallExecutes(addr, 0, "System Bus"); } void ButtonCallback() {