Memory callbacks - check the HasReads/Writes/Executes flags during the call methods so that the responsibility does not fall on the core, remove the check in the PCE core

This commit is contained in:
adelikat 2015-01-24 14:52:20 +00:00
parent 3c5348eb86
commit e194c9f0c4
3 changed files with 14 additions and 5 deletions

View File

@ -51,17 +51,26 @@ namespace BizHawk.Emulation.Common
public void CallReads(uint addr)
{
Call(Reads, addr);
if (_hasReads)
{
Call(Reads, addr);
}
}
public void CallWrites(uint addr)
{
Call(Writes, addr);
if (_hasWrites)
{
Call(Writes, addr);
}
}
public void CallExecutes(uint addr)
{
Call(Execs, addr);
if (_hasExecutes)
{
Call(Execs, addr);
}
}
public bool HasReads

View File

@ -59,7 +59,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
LagIFlag = FlagI;
if (Debug) Logger(State());
if (Core.MemoryCallbacks.HasExecutes) { Core.MemoryCallbacks.CallExecutes(PC); }
Core.MemoryCallbacks.CallExecutes(PC);
if (CDLLoggingActive) CDLOpcode();

View File

@ -494,7 +494,7 @@ namespace HuC6280
w.WriteLine(" LagIFlag = FlagI;");
w.WriteLine();
w.WriteLine(" if (Debug) Logger(State());");
w.WriteLine(" if (Core.MemoryCallbacks.HasExecutes) { Core.MemoryCallbacks.CallExecutes(PC); }");
w.WriteLine(" Core.MemoryCallbacks.CallExecutes(PC);");
w.WriteLine(" if (CDLLoggingActive) CDLOpcode();");
w.WriteLine();
w.WriteLine(" byte opcode = ReadMemory(PC++);");