diff --git a/BizHawk.Client.ApiHawk/Classes/Api/MemEventsApi.cs b/BizHawk.Client.ApiHawk/Classes/Api/MemEventsApi.cs index 5848df5fc3..05993e866a 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(MemoryCallbackDelegate 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(MemoryCallbackDelegate 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(MemoryCallbackDelegate 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(MemoryCallbackDelegate cb) { if (DebuggableCore.MemoryCallbacksAvailable()) { diff --git a/BizHawk.Client.ApiHawk/Interfaces/Api/IMemEvents.cs b/BizHawk.Client.ApiHawk/Interfaces/Api/IMemEvents.cs index b8650a9139..ef0f5ef0bc 100644 --- a/BizHawk.Client.ApiHawk/Interfaces/Api/IMemEvents.cs +++ b/BizHawk.Client.ApiHawk/Interfaces/Api/IMemEvents.cs @@ -1,12 +1,14 @@ -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; + +using BizHawk.Emulation.Common; + +namespace BizHawk.Client.ApiHawk +{ + public interface IMemEvents : IExternalApi + { + void AddReadCallback(MemoryCallbackDelegate cb, uint? address, string domain); + void AddWriteCallback(MemoryCallbackDelegate cb, uint? address, string domain); + void AddExecCallback(MemoryCallbackDelegate cb, uint? address, string domain); + void RemoveMemoryCallback(MemoryCallbackDelegate cb); + } +} diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs index 7038915c81..1ec246820e 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs @@ -231,7 +231,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(); } } @@ -270,7 +270,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(); } } @@ -309,7 +309,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 828f97968a..bb602e8f62 100644 --- a/BizHawk.Client.Common/lua/NamedLuaFunction.cs +++ b/BizHawk.Client.Common/lua/NamedLuaFunction.cs @@ -1,6 +1,8 @@ using System; using NLua; +using BizHawk.Emulation.Common; + namespace BizHawk.Client.Common { public class NamedLuaFunction @@ -26,6 +28,11 @@ namespace BizHawk.Client.Common logCallback($"error running function attached by the event {Event}\nError message: {ex.Message}"); } }; + + MemCallback = delegate + { + Callback(); + }; } public Guid Guid { get; private set; } @@ -38,6 +45,8 @@ namespace BizHawk.Client.Common public Action Callback { get; } + public MemoryCallbackDelegate 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..b296f0d821 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 MemoryCallbackDelegate 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, MemoryCallbackDelegate 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, MemoryCallbackDelegate 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, MemoryCallbackDelegate 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 MemoryCallbackDelegate 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..5d8dfc5bc9 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, uint flags) { GlobalWin.MainForm.PauseEmulator(); UpdateValues(); GlobalWin.OSD.AddMessage("Breakpoint hit"); } - private void SeekCallback() + private void SeekCallback(uint addr, uint value, uint flags) { - BreakpointCallback(); + BreakpointCallback(addr, value, flags); 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 29ae44e902..97cb1f1e7d 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, uint flags); private ITraceSink _sink; @@ -80,7 +80,7 @@ namespace BizHawk.Emulation.Common public class TracingMemoryCallback : IMemoryCallback { - public TracingMemoryCallback(Action callback) + public TracingMemoryCallback(MemoryCallbackDelegate callback) { Callback = callback; } @@ -89,7 +89,7 @@ namespace BizHawk.Emulation.Common public string Name => "Trace Logging"; - public Action Callback { get; } + public MemoryCallbackDelegate 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..cc08a8bcea 100644 --- a/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs +++ b/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs @@ -67,38 +67,57 @@ namespace BizHawk.Emulation.Common } } - private static void Call(ObservableCollection cbs, uint addr, string scope) + private static void Call(ObservableCollection cbs, uint addr, uint value, uint flags, 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, value, flags); } } } - public void CallReads(uint addr, string scope) + public void CallMemoryCallbacks(uint addr, uint value, uint flags, string scope) + { + var flagEnum = (MemoryCallbackFlags)flags; + if (flagEnum.HasFlag(MemoryCallbackFlags.AccessRead) && _hasReads) + { + Call(_reads, addr, value, flags, scope); + } + + if (flagEnum.HasFlag(MemoryCallbackFlags.AccessWrite) && _hasWrites) + { + Call(_writes, addr, value, flags, scope); + } + + if (flagEnum.HasFlag(MemoryCallbackFlags.AccessExecute) && _hasExecutes) + { + Call(_execs, addr, value, flags, scope); + } + } + + public void CallReads(uint addr, uint value, uint flags, string scope) { if (_hasReads) { - Call(_reads, addr, scope); + Call(_reads, addr, value, flags, scope); } } - public void CallWrites(uint addr, string scope) + public void CallWrites(uint addr, uint value, uint flags, string scope) { if (_hasWrites) { - Call(_writes, addr, scope); + Call(_writes, addr, value, flags, scope); } } - public void CallExecutes(uint addr, string scope) + public void CallExecutes(uint addr, uint value, uint flags, string scope) { if (_hasExecutes) { - Call(_execs, addr, scope); + Call(_execs, addr, value, flags, scope); } } @@ -136,7 +155,7 @@ namespace BizHawk.Emulation.Common return (_hasReads != hadReads || _hasWrites != hadWrites || _hasExecutes != hadExecutes); } - private int RemoveInternal(Action action) + private int RemoveInternal(MemoryCallbackDelegate action) { var readsToRemove = _reads.Where(imc => imc.Callback == action).ToList(); var writesToRemove = _writes.Where(imc => imc.Callback == action).ToList(); @@ -160,7 +179,7 @@ namespace BizHawk.Emulation.Common return readsToRemove.Count + writesToRemove.Count + execsToRemove.Count; } - public void Remove(Action action) + public void Remove(MemoryCallbackDelegate action) { if (RemoveInternal(action) > 0) { @@ -171,7 +190,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 +305,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, MemoryCallbackDelegate callback, uint? address, uint? mask) { if (type == MemoryCallbackType.Execute && !address.HasValue) { @@ -303,7 +322,7 @@ namespace BizHawk.Emulation.Common public MemoryCallbackType Type { get; } public string Name { get; } - public Action Callback { get; } + public MemoryCallbackDelegate 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..90d1b36369 100644 --- a/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs +++ b/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs @@ -3,6 +3,9 @@ using System.Collections.Generic; namespace BizHawk.Emulation.Common { + + public delegate void MemoryCallbackDelegate(uint address, uint value, uint flags); + /// /// This is a property of , and defines the means by which a client /// gets and sets memory callbacks in the core. A memory callback should fire any time memory is @@ -61,35 +64,23 @@ namespace BizHawk.Emulation.Common void Add(IMemoryCallback callback); /// - /// Executes all Read callbacks for the given address and domain + /// Executes all matching callbacks for the given address and domain /// /// The address to check for callbacks + /// The value contained (or written to) addr + /// The callback flags relevant to this access /// The scope that the address pertains to. Must be a value in - void CallReads(uint addr, 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); - - /// - /// 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 CallMemoryCallbacks(uint addr, uint value, uint flags, string scope); /// /// Removes the given callback from the list /// - void Remove(Action action); + void Remove(MemoryCallbackDelegate 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 +102,7 @@ namespace BizHawk.Emulation.Common { MemoryCallbackType Type { get; } string Name { get; } - Action Callback { get; } + MemoryCallbackDelegate Callback { get; } uint? Address { get; } uint? AddressMask { get; } string Scope { get; } @@ -121,4 +112,20 @@ namespace BizHawk.Emulation.Common { Read, Write, Execute } + + [Flags] + public enum MemoryCallbackFlags : uint + { + SizeUnknown = 0x00 << 16, + SizeByte = 0x01 << 16, + SizeWord = 0x02 << 16, + SizeLong = 0x03 << 16, + AccessUnknown = 0x00 << 12, + AccessRead = 0x01 << 12, + AccessWrite = 0x02 << 12, + AccessExecute = 0x04 << 12, + CPUUnknown = 0x00 << 8, + CPUZero = 0x01 << 8, + DomainUnknown = 0x00, + } } diff --git a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs index c30c140bff..dcaa1b7cc7 100644 --- a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs +++ b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs @@ -192,7 +192,8 @@ namespace BizHawk.Emulation.Cores.Components.CP1610 if (MemoryCallbacks != null) { - MemoryCallbacks.CallExecutes(RegisterPC, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(RegisterPC, 0, flags, "System Bus"); } switch (opcode) diff --git a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs index f1b795f1b8..fd4ccf623d 100644 --- a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs +++ b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs @@ -31,7 +31,8 @@ namespace BizHawk.Emulation.Cores.Components.CP1610 { if (MemoryCallbacks != null && !peek) { - MemoryCallbacks.CallReads(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); } return ReadMemory(addr, peek); @@ -41,7 +42,8 @@ namespace BizHawk.Emulation.Cores.Components.CP1610 { if (MemoryCallbacks != null && !poke) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "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..cfc1db3d95 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.CallMemoryCallbacks(PC, 0, (uint)MemoryCallbackFlags.AccessExecute, "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 27a93c5d2d..406e3730d7 100644 --- a/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs +++ b/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs @@ -230,7 +230,8 @@ namespace BizHawk.Emulation.Cores.Components.H6280 { byte page = MPR[address >> 13]; var result = ReadMemory21((page << 13) | (address & 0x1FFF)); - MemoryCallbacks.CallReads(address, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(address, result, flags, "System Bus"); return result; } @@ -238,7 +239,8 @@ namespace BizHawk.Emulation.Cores.Components.H6280 { byte page = MPR[address >> 13]; WriteMemory21((page << 13) | (address & 0x1FFF), value); - MemoryCallbacks.CallWrites(address, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(address, value, flags, "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 330d669ef8..938e521207 100644 --- a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs +++ b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs @@ -183,9 +183,21 @@ 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) => + { + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); + }; + _machine.Memory.WriteCallback = (addr) => + { + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); + }; + _machine.Memory.ExecuteCallback = (addr) => + { + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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..bef82b1590 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs @@ -160,7 +160,8 @@ 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"); + var flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); return temp; } @@ -180,8 +181,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } _mapper.WriteMemory((ushort)(addr & 0x1FFF), value); - - MemoryCallbacks.CallWrites(addr, "System Bus"); + var flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus"); } internal void PokeMemory(ushort addr, byte value) @@ -191,7 +192,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + var flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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 2651c1f893..bf70777b4a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs @@ -291,7 +291,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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..7f871dc7a4 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs @@ -20,7 +20,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk { public byte ReadMemory(ushort addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + uint flags = (uint)(Common.MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); if ((addr & 0xFCE0) == 0) { @@ -98,7 +99,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk public void WriteMemory(ushort addr, byte value) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + uint flags = (uint)(Common.MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus"); if ((addr & 0xFCE0) == 0) { diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/MemoryMap.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/MemoryMap.cs index dc94847b60..3d28d0d5e6 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/MemoryMap.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/MemoryMap.cs @@ -20,7 +20,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex { public byte ReadMemory(ushort addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + uint flags = (uint)MemoryCallbackFlags.AccessRead; + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); if (addr < 0x8000) { @@ -54,7 +55,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex public void WriteMemory(ushort addr, byte value) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + uint flags = (uint)MemoryCallbackFlags.AccessWrite; + MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus"); if (addr < 0x8000) { diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.cs index 442924488f..6e297f9b6a 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.cs @@ -123,7 +123,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + uint flags = (uint)MemoryCallbackFlags.AccessExecute; + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); } private void Setup_Mapper() diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs index 72cb7af7ca..843377bcc7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs @@ -168,9 +168,20 @@ 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) => { + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); + }); + readcb = new LibVBANext.AddressCallback((addr) => + { + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); + }); + writecb = new LibVBANext.AddressCallback((addr) => + { + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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 cf3a5123f2..5a7d688cd9 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs @@ -294,7 +294,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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..a3a4d1b2db 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/MemoryMap.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/MemoryMap.cs @@ -29,7 +29,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { public byte ReadMemory(ushort addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); addr_access = addr; if (ppu.DMA_start) @@ -157,7 +158,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk public void WriteMemory(ushort addr, byte value) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "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 4900fca9b9..4192c9bece 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs @@ -93,8 +93,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink } private void ExecFetch(ushort addr) - { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + { + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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..17e1041253 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs @@ -59,19 +59,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy private void ReadCallback(uint address, ulong cycleOffset) { callbackCycleCount = _cycleCount + cycleOffset; - MemoryCallbacks.CallReads(address, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(address, 0, flags, "System Bus"); } private void WriteCallback(uint address, ulong cycleOffset) { callbackCycleCount = _cycleCount + cycleOffset; - MemoryCallbacks.CallWrites(address, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(address, 0, flags,"System Bus"); } private void ExecCallback(uint address, ulong cycleOffset) { callbackCycleCount = _cycleCount + cycleOffset; - MemoryCallbacks.CallExecutes(address, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(address, 0, flags, "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 3547d5459c..f1cba049bc 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeApi/mupen64plusCoreApi.cs @@ -752,19 +752,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi break; if (event_breakpoint) { + MemoryCallbackFlags flags = 0; switch (_breakparams._type) { case BreakType.Read: - _breakparams._mcs.CallReads(_breakparams._addr, "System Bus"); + flags |= MemoryCallbackFlags.AccessRead; break; case BreakType.Write: - _breakparams._mcs.CallWrites(_breakparams._addr, "System Bus"); + flags |= MemoryCallbackFlags.AccessWrite; break; case BreakType.Execute: - _breakparams._mcs.CallExecutes(_breakparams._addr, "System Bus"); + flags |= MemoryCallbackFlags.AccessExecute; break; } + _breakparams._mcs.CallMemoryCallbacks(_breakparams._addr, 0, (uint)flags, "System Bus"); + event_breakpoint = false; Resume(); continue; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs index 676279ec21..3fc666b556 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs @@ -898,7 +898,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.CPUZero | MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); } public byte ReadMemory(ushort addr) @@ -948,7 +949,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES } } - MemoryCallbacks.CallReads(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.CPUZero | MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, ret, flags, "System Bus"); DB = ret; return ret; @@ -995,7 +997,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES Board.WritePRG(addr - 0x8000, value); } - MemoryCallbacks.CallWrites(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.CPUZero | MemoryCallbackFlags.AccessWrite | MemoryCallbackFlags.SizeByte); + MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "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..c65360f4dd 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -364,7 +364,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES private void ReadHook(uint addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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 +373,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES private void ExecHook(uint addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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 +382,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES private void WriteHook(uint addr, byte val) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, val, flags, "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 +391,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES private void ReadHook_SMP(uint addr) { - MemoryCallbacks.CallReads(addr, "SMP"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "SMP"); } private void ExecHook_SMP(uint addr) { - MemoryCallbacks.CallExecutes(addr, "SMP"); + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "SMP"); } private void WriteHook_SMP(uint addr, byte val) { - MemoryCallbacks.CallWrites(addr, "SMP"); + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, val, flags, "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 6abdd61162..a6de84103b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs @@ -72,8 +72,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk private readonly ITraceable _tracer; private void ExecFetch(ushort addr) - { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + { + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); } #region ISettable diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs index 1401820939..9f58497577 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs @@ -90,7 +90,8 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + uint flags = (uint)MemoryCallbackFlags.AccessExecute; + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 68d48916a4..941851b72d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -298,7 +298,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem public byte ReadMemory(ushort addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); return ReadMemoryMapper(addr); } @@ -307,7 +308,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem { WriteMemoryMapper(addr, value); - MemoryCallbacks.CallWrites(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus"); } public byte FetchMemory(ushort addr) @@ -317,7 +319,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem private void OnExecMemory(ushort addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "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..ea17bf2374 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs @@ -61,9 +61,21 @@ 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 => + { + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS"); + }); + ReadCallback = new LibGPGX.mem_cb(a => + { + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS"); + }); + WriteCallback = new LibGPGX.mem_cb(a => + { + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "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..29bdbab675 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, uint flags) { 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 0b2931de02..30f3bd3cac 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -880,18 +880,20 @@ namespace BizHawk.Emulation.Cores.Sony.PSX void ShockMemCallback(uint address, OctoshockDll.eShockMemCb type, uint size, uint value) { + MemoryCallbackFlags flags = 0; switch (type) { - case OctoshockDll.eShockMemCb.Read: - MemoryCallbacks.CallReads(address, "System Bus"); + case OctoshockDll.eShockMemCb.Read: + flags |= MemoryCallbackFlags.AccessRead; break; case OctoshockDll.eShockMemCb.Write: - MemoryCallbacks.CallWrites(address, "System Bus"); + flags |= MemoryCallbackFlags.AccessWrite; break; case OctoshockDll.eShockMemCb.Execute: - MemoryCallbacks.CallExecutes(address, "System Bus"); + flags |= MemoryCallbackFlags.AccessExecute; break; } + MemoryCallbacks.CallMemoryCallbacks(address, value, (uint)flags, "System Bus"); } void InitMemCallbacks() diff --git a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs index 4068514676..8ef12ba934 100644 --- a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs +++ b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs @@ -142,15 +142,18 @@ namespace BizHawk.Emulation.Cores.WonderSwan void ReadCallback(uint addr) { - MemoryCallbacks.CallReads(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessRead); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); } void WriteCallback(uint addr) { - MemoryCallbacks.CallWrites(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessWrite); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); } void ExecCallback(uint addr) { - MemoryCallbacks.CallExecutes(addr, "System Bus"); + uint flags = (uint)(MemoryCallbackFlags.AccessExecute); + MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus"); } void ButtonCallback() {