From 71aaf349b51653ec5ca57b3f4e8a9768962790c2 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 15 Dec 2019 12:12:52 -0600 Subject: [PATCH] Fix GPGX one off hack to fix trace logger, and instead do a less bad hack in CallbackBasedTraceBuffer --- .../Base Implementations/CallbackBasedTraceBuffer.cs | 10 ++++++---- .../Consoles/Sega/gpgx64/GPGX.IDebuggable.cs | 12 +++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs b/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs index 97cb1f1e7d..8fd7086a88 100644 --- a/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs +++ b/BizHawk.Emulation.Common/Base Implementations/CallbackBasedTraceBuffer.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; - +using System.Linq; using BizHawk.Emulation.Common.IEmulatorExtensions; namespace BizHawk.Emulation.Common @@ -71,7 +71,8 @@ namespace BizHawk.Emulation.Common if (_sink != null) { - DebuggableCore.MemoryCallbacks.Add(new TracingMemoryCallback(TraceFromCallback)); + var scope = DebuggableCore.MemoryCallbacks.AvailableScopes.First(); // This will be an issue when cores use this trace buffer and utilize multiple scopes + DebuggableCore.MemoryCallbacks.Add(new TracingMemoryCallback(TraceFromCallback, scope)); } } } @@ -80,9 +81,10 @@ namespace BizHawk.Emulation.Common public class TracingMemoryCallback : IMemoryCallback { - public TracingMemoryCallback(MemoryCallbackDelegate callback) + public TracingMemoryCallback(MemoryCallbackDelegate callback, string scope) { Callback = callback; + Scope = scope; } public MemoryCallbackType Type => MemoryCallbackType.Execute; @@ -95,7 +97,7 @@ namespace BizHawk.Emulation.Common public uint? AddressMask => null; - public string Scope => ""; // This will be relevant if/when the trace logger can trace anything other than the system bus + public string Scope { get; } } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs index 913ba15a86..00ab8b4dea 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDebuggable.cs @@ -36,10 +36,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx throw new NotImplementedException(); } - public IMemoryCallbackSystem MemoryCallbacks - { - get { return _memoryCallbacks; } - } + public IMemoryCallbackSystem MemoryCallbacks => _memoryCallbacks; public bool CanStep(StepType type) { return false; } @@ -47,12 +44,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx public void Step(StepType type) { throw new NotImplementedException(); } [FeatureNotImplemented] - public long TotalExecutedCycles - { - get { throw new NotImplementedException(); } - } + public long TotalExecutedCycles => throw new NotImplementedException(); - private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem(new[] { "M68K BUS", "" }); + private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem(new[] { "M68K BUS" }); private LibGPGX.mem_cb ExecCallback; private LibGPGX.mem_cb ReadCallback;