Forgot to add these files
This commit is contained in:
parent
d7f88ecbf9
commit
cda9203ca5
|
@ -0,0 +1,39 @@
|
|||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public class TraceBuffer : ITracer
|
||||
{
|
||||
private readonly StringBuilder buffer;
|
||||
|
||||
public TraceBuffer()
|
||||
{
|
||||
buffer = new StringBuilder();
|
||||
Header = "Instructions";
|
||||
}
|
||||
|
||||
public string TakeContents()
|
||||
{
|
||||
string s = buffer.ToString();
|
||||
buffer.Clear();
|
||||
return s;
|
||||
}
|
||||
|
||||
public string Contents
|
||||
{
|
||||
get { return buffer.ToString(); }
|
||||
}
|
||||
|
||||
public void Put(string content)
|
||||
{
|
||||
if (Enabled)
|
||||
{
|
||||
buffer.AppendLine(content);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public string Header { get; set; }
|
||||
}
|
||||
}
|
|
@ -22,6 +22,11 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
|||
return core != null && core.ServiceProvider.HasService<IMemoryDomains>();
|
||||
}
|
||||
|
||||
public static IMemoryDomains GetMemoryDomains(this IEmulator core)
|
||||
{
|
||||
return (IMemoryDomains)core.ServiceProvider.GetService<IMemoryDomains>();
|
||||
}
|
||||
|
||||
public static bool HasSaveRam(this IEmulator core)
|
||||
{
|
||||
return core != null && core.ServiceProvider.HasService<ISaveRam>();
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows the cpu to dump trace info to a trace stream
|
||||
/// </summary>
|
||||
public interface ITracer
|
||||
{
|
||||
bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The header that would be used by a trace logger
|
||||
/// </summary>
|
||||
string Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current log of cpu instructions
|
||||
/// </summary>
|
||||
string Contents { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Takes the current log of cpu instructions, when doing so, it will clear the contents from the buffer
|
||||
/// </summary>
|
||||
string TakeContents();
|
||||
|
||||
/// <summary>
|
||||
/// Adds contents to the log of cpu instructions
|
||||
/// </summary>
|
||||
void Put(string content);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue