public LinkInterop(NeoGeoPort core, BlockingCollection <LinkRequest> push, BlockingCollection <LinkResult> pull) { _core = core; _push = push; _pull = pull; _exporter = BizExvoker.GetExvoker(this, CallingConventionAdapters.Waterbox); _readcb = _exporter.SafeResolve("CommsReadCallback"); _pollcb = _exporter.SafeResolve("CommsPollCallback"); _writecb = _exporter.SafeResolve("CommsWriteCallback"); ConnectPointers(); }
public void ConnectImports(string moduleName, IImportResolver module) { // this is called once internally when bootstrapping, and externally // when we need to restore a savestate from another run. so imports might or might not be sealed if (_everythingSealed && _imports != null) { Memory.Protect(_imports.Start, _imports.Size, MemoryBlock.Protection.RW); } Dictionary <string, IntPtr> imports; if (ImportsByModule.TryGetValue(moduleName, out imports)) { foreach (var kvp in imports) { var valueArray = new IntPtr[] { module.SafeResolve(kvp.Key) }; Marshal.Copy(valueArray, 0, kvp.Value, 1); } } if (_everythingSealed && _imports != null) { Memory.Protect(_imports.Start, _imports.Size, _imports.Prot); } }