MemoryCallbackSystem - implement IEnumerable, Debugger - use it to pre-populate the breakpoint dialog with pre-existing breakpoints

This commit is contained in:
adelikat 2014-12-07 19:38:42 +00:00
parent be8563469c
commit 68e1eae014
3 changed files with 18 additions and 2 deletions

View File

@ -63,7 +63,12 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
{
if (Core.MemoryCallbacksAvailable())
{
// TODO: need a way to populate existing breakpoints
foreach (var callback in Core.MemoryCallbacks)
{
Breakpoints.Add(new Breakpoint(Core, callback.Callback, callback.Address ?? 0 /*TODO*/,callback.Type, true));
}
BreakpointView.Refresh();
}
else
{

View File

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -9,6 +10,16 @@ namespace BizHawk.Emulation.Common
{
private readonly List<IMemoryCallback> Callbacks = new List<IMemoryCallback>();
public IEnumerator<IMemoryCallback> GetEnumerator()
{
return Callbacks.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Add(IMemoryCallback callback)
{
var hadAny = Callbacks.Any();

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace BizHawk.Emulation.Common
{
public interface IMemoryCallbackSystem
public interface IMemoryCallbackSystem : IEnumerable<IMemoryCallback>
{
/// <summary>
/// Returns whether or not there are currently any read hooks