2014-12-05 01:56:45 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Common
|
|
|
|
|
{
|
|
|
|
|
public interface IMemoryCallbackSystem
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns whether or not there are currently any read hooks
|
|
|
|
|
/// </summary>
|
|
|
|
|
bool HasReads { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns whether or not there are currently any write hooks
|
|
|
|
|
/// </summary>
|
|
|
|
|
bool HasWrites { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns whether or not there are currently any execute hooks
|
|
|
|
|
/// </summary>
|
|
|
|
|
bool HasExecutes { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2014-12-07 18:53:56 +00:00
|
|
|
|
/// Adds a callback for the given type to the given address
|
2014-12-05 01:56:45 +00:00
|
|
|
|
/// If no address is specified the callback will be hooked to all addresses
|
2014-12-07 18:53:56 +00:00
|
|
|
|
/// Note: an execute callback can not be added without an address, else an InvalidOperationException will occur
|
2014-12-05 01:56:45 +00:00
|
|
|
|
/// </summary>
|
2014-12-07 18:53:56 +00:00
|
|
|
|
void Add(MemoryCallbackType type, Action function, uint? addr);
|
2014-12-05 01:56:45 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Executes all Read callbacks for the given addr
|
|
|
|
|
/// </summary>
|
2014-12-07 18:53:56 +00:00
|
|
|
|
void CallReads(uint addr);
|
2014-12-05 01:56:45 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Executes all Write callbacks for the given addr
|
|
|
|
|
/// </summary>
|
2014-12-07 18:53:56 +00:00
|
|
|
|
void CallWrites(uint addr);
|
2014-12-05 01:56:45 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Executes all Execute callbacks for the given addr
|
|
|
|
|
/// </summary>
|
2014-12-07 18:53:56 +00:00
|
|
|
|
void CallExecutes(uint addr);
|
2014-12-05 01:56:45 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes the given callback from the list
|
|
|
|
|
/// </summary>
|
|
|
|
|
void Remove(Action action);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes the given callbacks from the list
|
|
|
|
|
/// </summary>
|
|
|
|
|
void RemoveAll(IEnumerable<Action> actions);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes all read,write, and execute callbacks
|
|
|
|
|
/// </summary>
|
|
|
|
|
void Clear();
|
|
|
|
|
}
|
2014-12-07 18:53:56 +00:00
|
|
|
|
|
|
|
|
|
public enum MemoryCallbackType { Read, Write, Execute }
|
2014-12-05 01:56:45 +00:00
|
|
|
|
}
|