public void Add(IMemoryCallback callback) { if (!AvailableScopes.Contains(callback.Scope)) { throw new InvalidOperationException($"{callback.Scope} is not currently supported for callbacks"); } if (!callback.Address.HasValue) { throw new NotImplementedException("Wildcard callbacks (no address specified) not currently implemented."); } var container = new CallbackContainer(callback); if (container.Callback.Type == MemoryCallbackType.Execute) { _executeCallback = RunExecCallback; _execPcs[callback.Address.Value] = callback; LibmGBA.BizSetExecCallback(_executeCallback); } else { LibmGBA.BizSetMemCallback(container.CallDelegate); container.ID = LibmGBA.BizSetWatchpoint(_mgba.Core, callback.Address.Value, container.WatchPointType); } _callbacks.Add(container); }