add TotalExecutedCycles as an IDebuggable property, and implement it in cores with the information readily available (and throw NotImplementedExecptions in the remaining). wire the property up to lua with emu.totalexecutedcycles(). Stil todo - wire it up to the Debugger gui

This commit is contained in:
adelikat 2017-01-09 19:23:05 -06:00
parent d0b0946229
commit ab1a22bf31
23 changed files with 140 additions and 0 deletions

View File

@ -188,6 +188,31 @@ namespace BizHawk.Client.Common
}
}
[LuaMethodAttributes(
"totalexecutedcycles",
"gets the total number of executed cpu cycles"
)]
public int TotalExecutedycles()
{
try
{
if (DebuggableCore == null)
{
throw new NotImplementedException();
}
return DebuggableCore.TotalExecutedCycles;
}
catch (NotImplementedException)
{
Log(string.Format(
"Error: {0} does not yet implement totalexecutedcycles()",
Emulator.Attributes().CoreName));
return 0;
}
}
[LuaMethodAttributes(
"getsystemid",
"Returns the ID string of the current core loaded. Note: No ROM loaded will return the string NULL"

View File

@ -36,6 +36,12 @@ namespace BizHawk.Emulation.Common
/// Advances the core based on the given Step type
/// </summary>
void Step(StepType type);
/// <summary>
/// Total number of cpu cycles since the beginning of the core's lifecycle
/// Note that the cpu in this case is the "main" cpu, for some cores that may be somewhat subjective
/// </summary>
int TotalExecutedCycles { get; } // TODO: this should probably be a long, but most cores were using int, oh well
}
public class RegisterValue

View File

@ -126,5 +126,10 @@ namespace BizHawk.Emulation.Cores.Calculators
public void Step(StepType type) { throw new NotImplementedException(); }
public bool CanStep(StepType type) { return false; }
public int TotalExecutedCycles
{
get { return Cpu.TotalExecutedCycles; }
}
}
}

View File

@ -120,6 +120,11 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
}
}
public int TotalExecutedCycles
{
get { return (int)_machine.Cpu.Cycles; }
}
private void StepInto()
{
if (Tracer.Enabled)

View File

@ -60,6 +60,12 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
_selectedDebuggable.Step(type);
}
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { return _selectedDebuggable.TotalExecutedCycles; }
}
[SaveState.DoNotSave]
private readonly IMemoryCallbackSystem _memoryCallbacks;

View File

@ -82,6 +82,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
}
}
int IDebuggable.TotalExecutedCycles
{
get { return _cpu.TotalExecutedCycles; }
}
private void StepInto()
{
while (_cpu.AtInstructionStart())

View File

@ -82,6 +82,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
}
}
int IDebuggable.TotalExecutedCycles
{
get { return _cpu.TotalExecutedCycles; }
}
private void StepInto()
{
while (_cpu.AtInstructionStart())

View File

@ -88,6 +88,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
}
public int TotalExecutedCycles
{
get { return Cpu.TotalExecutedCycles; }
}
private void StepInto()
{
do

View File

@ -64,5 +64,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
public int TotalExecutedCycles
{
get { return (int)theMachine.CPU.Clock; }
}
}
}

View File

@ -127,5 +127,10 @@ namespace BizHawk.Emulation.Cores.ColecoVision
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
public int TotalExecutedCycles
{
get { return Cpu.TotalExecutedCycles; }
}
}
}

View File

@ -30,5 +30,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
[FeatureNotImplemented]
public int TotalExecutedCycles { get { throw new NotImplementedException(); } }
}
}

View File

@ -42,6 +42,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { throw new NotImplementedException(); }
}
public IMemoryCallbackSystem MemoryCallbacks
{
get { return _memorycallbacks; }

View File

@ -44,6 +44,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { throw new NotImplementedException(); }
}
private readonly MemoryCallbackSystem _memorycallbacks = new MemoryCallbackSystem();
}
}

View File

@ -89,6 +89,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { throw new NotImplementedException(); }
}
private mupen64plusApi.MemoryCallback _readcb;
private mupen64plusApi.MemoryCallback _writecb;
private mupen64plusApi.MemoryCallback _executecb;

View File

@ -63,5 +63,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
public int TotalExecutedCycles
{
get { return cpu.TotalExecutedCycles; }
}
}
}

View File

@ -37,5 +37,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
[FeatureNotImplemented]
get { throw new NotImplementedException(); }
}
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { throw new NotImplementedException(); }
}
}
}

View File

@ -304,6 +304,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
throw new NotImplementedException();
}
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { throw new NotImplementedException(); }
}
public class MyScanlineHookManager : ScanlineHookManager
{
public MyScanlineHookManager(LibsnesCore core)

View File

@ -39,5 +39,10 @@ namespace BizHawk.Emulation.Cores.PCEngine
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
public int TotalExecutedCycles
{
get { return (int)Cpu.TotalExecutedCycles; }
}
}
}

View File

@ -129,5 +129,10 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
throw new NotImplementedException();
}
public int TotalExecutedCycles
{
get { return Cpu.TotalExecutedCycles; }
}
}
}

View File

@ -46,6 +46,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { throw new NotImplementedException(); }
}
private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem();
private LibGPGX.mem_cb ExecCallback;

View File

@ -46,6 +46,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { throw new NotImplementedException(); }
}
private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem();
private LibGPGX.mem_cb ExecCallback;

View File

@ -87,5 +87,11 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { throw new NotImplementedException(); }
}
}
}

View File

@ -138,6 +138,9 @@ namespace BizHawk.Emulation.Cores.WonderSwan
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
[FeatureNotImplemented]
public int TotalExecutedCycles { get { throw new NotImplementedException(); } }
BizSwan.MemoryCallback ReadCallbackD;
BizSwan.MemoryCallback WriteCallbackD;
BizSwan.MemoryCallback ExecCallbackD;