diff --git a/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs b/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs index d2e85e6f96..3ec926a27a 100644 --- a/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs +++ b/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs @@ -74,38 +74,38 @@ namespace BizHawk.Emulation.Common _empty = false; } - private static void Call(ObservableCollection cbs, uint addr) + private static void Call(ObservableCollection cbs, uint addr, string domain) { for (int i = 0; i < cbs.Count; i++) { - if (!cbs[i].Address.HasValue || cbs[i].Address == (addr & cbs[i].AddressMask)) + if (!cbs[i].Address.HasValue || (cbs[i].Domain == domain && cbs[i].Address == (addr & cbs[i].AddressMask))) { cbs[i].Callback(); } } } - public void CallReads(uint addr) + public void CallReads(uint addr, string domain) { if (_hasReads) { - Call(_reads, addr); + Call(_reads, addr, domain); } } - public void CallWrites(uint addr) + public void CallWrites(uint addr, string domain) { if (_hasWrites) { - Call(_writes, addr); + Call(_writes, addr, domain); } } - public void CallExecutes(uint addr) + public void CallExecutes(uint addr, string domain) { if (_hasExecutes) { - Call(_execs, addr); + Call(_execs, addr, domain); } } diff --git a/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs b/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs index 8a911a77de..c196795e6e 100644 --- a/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs +++ b/BizHawk.Emulation.Common/Interfaces/IMemoryCallbackSystem.cs @@ -46,19 +46,19 @@ namespace BizHawk.Emulation.Common void Add(IMemoryCallback callback); /// - /// Executes all Read callbacks for the given address + /// Executes all Read callbacks for the given address and domain /// - void CallReads(uint addr); + void CallReads(uint addr, string domain); /// - /// Executes all Write callbacks for the given address + /// Executes all Write callbacks for the given address and domain /// - void CallWrites(uint addr); + void CallWrites(uint addr, string domain); /// - /// Executes all Execute callbacks for the given address + /// Executes all Execute callbacks for the given address and domain /// - void CallExecutes(uint addr); + void CallExecutes(uint addr, string domain); /// /// Removes the given callback from the list diff --git a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.Execute.cs index cffb04037c..c4f3db942d 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); + MemoryCallbacks.CallExecutes(RegisterPC, "System Bus"); } switch (opcode) diff --git a/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs b/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs index 29c2ea6524..8a4ced6fa0 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); + MemoryCallbacks.CallReads(addr, "System Bus"); } return ReadMemory(addr, peek); @@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610 { if (MemoryCallbacks != null && !poke) { - MemoryCallbacks.CallWrites(addr); + MemoryCallbacks.CallWrites(addr, "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 d151dd15a8..e86edcc297 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); + MemoryCallbacks.CallExecutes(PC, "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 a6e0c63b47..9e2e8ad470 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); + MemoryCallbacks.CallReads(address, "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); + MemoryCallbacks.CallWrites(address, "System Bus"); } private ushort ReadWord(ushort address) diff --git a/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs b/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs index c89d1a7aa4..996ed875e1 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs @@ -55,7 +55,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80 if (MemoryCallbacks != null) { - MemoryCallbacks.CallExecutes(RegPC.Word); + MemoryCallbacks.CallExecutes(RegPC.Word, "System Bus"); } ++RegR; diff --git a/BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs b/BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs index 35b7d7038c..3f53e2ee23 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs @@ -45,7 +45,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80 { if (MemoryCallbacks != null) { - MemoryCallbacks.CallReads(addr); + MemoryCallbacks.CallReads(addr, "System Bus"); } return ReadMemory(addr); @@ -55,7 +55,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80 { if (MemoryCallbacks != null) { - MemoryCallbacks.CallReads(addr); + MemoryCallbacks.CallReads(addr, "System Bus"); } if (FetchMemory != null) @@ -70,7 +70,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80 { if (MemoryCallbacks != null) { - MemoryCallbacks.CallReads(addr); + MemoryCallbacks.CallReads(addr, "System Bus"); } if (FetchMemory != null) @@ -85,7 +85,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80 { if (MemoryCallbacks != null) { - MemoryCallbacks.CallWrites(addr); + MemoryCallbacks.CallWrites(addr, "System Bus"); } WriteMemory(addr, value); diff --git a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs index 7c86c1e8eb..e67abf06ef 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 = MemoryCallbacks.CallReads; - _machine.Memory.WriteCallback = MemoryCallbacks.CallWrites; - _machine.Memory.ExecuteCallback = MemoryCallbacks.CallExecutes; + _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.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 bbfdb5e569..65b06c3e1f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs @@ -134,7 +134,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); + MemoryCallbacks.CallReads(addr, "System Bus"); return temp; } @@ -155,7 +155,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _mapper.WriteMemory((ushort)(addr & 0x1FFF), value); - MemoryCallbacks.CallWrites(addr); + MemoryCallbacks.CallWrites(addr, "System Bus"); } internal void PokeMemory(ushort addr, byte value) @@ -165,7 +165,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr); + MemoryCallbacks.CallExecutes(addr, "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 62c478b1d0..3221192b71 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs @@ -259,7 +259,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk private void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr); + MemoryCallbacks.CallExecutes(addr, "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 553613d004..94f9f476c4 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs @@ -23,7 +23,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk { public byte ReadMemory(ushort addr) { - MemoryCallbacks.CallReads(addr); + MemoryCallbacks.CallReads(addr, "System Bus"); if ((addr & 0xFCE0) == 0) { @@ -100,7 +100,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk public void WriteMemory(ushort addr, byte value) { - MemoryCallbacks.CallWrites(addr); + MemoryCallbacks.CallWrites(addr, "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 23af5c9a48..676210608f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.cs @@ -166,9 +166,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA void InitCallbacks() { padcb = new LibVBANext.StandardCallback(() => InputCallbacks.Call()); - fetchcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallExecutes(addr)); - readcb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallReads(addr)); - writecb = new LibVBANext.AddressCallback((addr) => MemoryCallbacks.CallWrites(addr)); + 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")); 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/Gameboy/Gambatte.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs index bca2f77c6a..8423fd437b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs @@ -68,9 +68,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy private void InitMemoryCallbacks() { - _readcb = addr => MemoryCallbacks.CallReads(addr); - _writecb = addr => MemoryCallbacks.CallWrites(addr); - _execcb = addr => MemoryCallbacks.CallExecutes(addr); + _readcb = addr => MemoryCallbacks.CallReads(addr, "System Bus"); + _writecb = addr => MemoryCallbacks.CallWrites(addr, "System Bus"); + _execcb = addr => MemoryCallbacks.CallExecutes(addr, "System Bus"); _memorycallbacks.ActiveChanged += RefreshMemoryCallbacks; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs index bdda7421fe..bda67a2da4 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs @@ -759,13 +759,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi switch (_breakparams._type) { case BreakType.Read: - _breakparams._mcs.CallReads(_breakparams._addr); + _breakparams._mcs.CallReads(_breakparams._addr, "System Bus"); break; case BreakType.Write: - _breakparams._mcs.CallWrites(_breakparams._addr); + _breakparams._mcs.CallWrites(_breakparams._addr, "System Bus"); break; case BreakType.Execute: - _breakparams._mcs.CallExecutes(_breakparams._addr); + _breakparams._mcs.CallExecutes(_breakparams._addr, "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 e8f52c27b2..b23e5a55b8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs @@ -828,7 +828,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public void ExecFetch(ushort addr) { - MemoryCallbacks.CallExecutes(addr); + MemoryCallbacks.CallExecutes(addr, "System Bus"); } public byte ReadMemory(ushort addr) @@ -873,7 +873,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES ret = sysbus_watch[addr].ApplyGameGenie(ret); } - MemoryCallbacks.CallReads(addr); + MemoryCallbacks.CallReads(addr, "System Bus"); DB = ret; return ret; @@ -928,7 +928,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES Board.WritePRG(addr - 0x8000, value); } - MemoryCallbacks.CallWrites(addr); + MemoryCallbacks.CallWrites(addr, "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 3b82b711bf..01c3e5758c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -361,7 +361,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES private void ReadHook(uint addr) { - MemoryCallbacks.CallReads(addr); + MemoryCallbacks.CallReads(addr, "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(); @@ -369,7 +369,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES private void ExecHook(uint addr) { - MemoryCallbacks.CallExecutes(addr); + MemoryCallbacks.CallExecutes(addr, "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(); @@ -377,7 +377,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES private void WriteHook(uint addr, byte val) { - MemoryCallbacks.CallWrites(addr); + MemoryCallbacks.CallWrites(addr, "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(); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs index 44b210946a..b619d2c85c 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)); - ReadCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallReads(a)); - WriteCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallWrites(a)); + 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")); _memoryCallbacks.ActiveChanged += RefreshMemCallbacks; } diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index fdf3057a1f..1352035a7b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -881,13 +881,13 @@ namespace BizHawk.Emulation.Cores.Sony.PSX switch (type) { case OctoshockDll.eShockMemCb.Read: - MemoryCallbacks.CallReads(address); + MemoryCallbacks.CallReads(address, "System Bus"); break; case OctoshockDll.eShockMemCb.Write: - MemoryCallbacks.CallWrites(address); + MemoryCallbacks.CallWrites(address, "System Bus"); break; case OctoshockDll.eShockMemCb.Execute: - MemoryCallbacks.CallExecutes(address); + MemoryCallbacks.CallExecutes(address, "System Bus"); break; } } diff --git a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs index c4467ffdcb..e1defde253 100644 --- a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs +++ b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs @@ -140,15 +140,15 @@ namespace BizHawk.Emulation.Cores.WonderSwan void ReadCallback(uint addr) { - MemoryCallbacks.CallReads(addr); + MemoryCallbacks.CallReads(addr, "System Bus"); } void WriteCallback(uint addr) { - MemoryCallbacks.CallWrites(addr); + MemoryCallbacks.CallWrites(addr, "System Bus"); } void ExecCallback(uint addr) { - MemoryCallbacks.CallExecutes(addr); + MemoryCallbacks.CallExecutes(addr, "System Bus"); } void ButtonCallback() {