m64p: setup CallbackBasedTraceBuffer
This commit is contained in:
parent
d5ac190bdc
commit
49176b28bd
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.N64
|
||||
{
|
||||
public partial class N64
|
||||
{
|
||||
private readonly ITraceable Tracer;
|
||||
|
||||
public class m64pTraceBuffer : CallbackBasedTraceBuffer
|
||||
{
|
||||
public m64pTraceBuffer(IDebuggable debuggableCore, IMemoryDomains memoryDomains, IDisassemblable disassembler)
|
||||
: base(debuggableCore, memoryDomains, disassembler)
|
||||
{
|
||||
Header = "r3400: PC, mnemonic, arguments";
|
||||
}
|
||||
|
||||
public override void TraceFromCallback()
|
||||
{
|
||||
var regs = DebuggableCore.GetCpuFlagsAndRegisters();
|
||||
uint pc = (uint)regs["PC"].Value;
|
||||
var length = 0;
|
||||
var disasm = Disassembler.Disassemble(MemoryDomains.SystemBus, pc, out length);
|
||||
|
||||
var traceInfo = new TraceInfo
|
||||
{
|
||||
Disassembly = string.Format("{0:X}: {1}", pc, disasm),
|
||||
RegisterInfo = ""
|
||||
};
|
||||
|
||||
Buffer.Add(traceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -140,6 +140,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
InitMemoryDomains();
|
||||
RefreshMemoryCallbacks();
|
||||
|
||||
Tracer = new m64pTraceBuffer(this, MemoryDomains, this);
|
||||
(ServiceProvider as BasicServiceProvider).Register<ITraceable>(Tracer);
|
||||
|
||||
api.AsyncExecuteEmulator();
|
||||
|
||||
// Hack: Saving a state on frame 0 has been shown to not be sync stable. Advance past that frame to avoid the problem.
|
||||
|
|
Loading…
Reference in New Issue