void Init() { if (attachedcore != null) { attachedcore.Dispose(); } messagecallback = PrintMessage; inputcallback = GetInput; tracecallback = Trace; // don't set this callback now, only set if enabled LibMeteor.libmeteor_setmessagecallback(messagecallback); LibMeteor.libmeteor_setkeycallback(inputcallback); LibMeteor.libmeteor_init(); videobuffer = new int[240 * 160]; videohandle = GCHandle.Alloc(videobuffer, GCHandleType.Pinned); soundbuffer = new short[2048]; // nominal length of one frame is something like 1480 shorts? soundhandle = GCHandle.Alloc(soundbuffer, GCHandleType.Pinned); if (!LibMeteor.libmeteor_setbuffers (videohandle.AddrOfPinnedObject(), (uint)(sizeof(int) * videobuffer.Length), soundhandle.AddrOfPinnedObject(), (uint)(sizeof(short) * soundbuffer.Length))) { throw new Exception("libmeteor_setbuffers() returned false??"); } attachedcore = this; }
public void Dispose() { if (!disposed) { disposed = true; videohandle.Free(); soundhandle.Free(); // guarantee crash if it gets accessed LibMeteor.libmeteor_setbuffers(IntPtr.Zero, 240 * 160 * 4, IntPtr.Zero, 4); messagecallback = null; inputcallback = null; tracecallback = null; LibMeteor.libmeteor_setmessagecallback(messagecallback); LibMeteor.libmeteor_setkeycallback(inputcallback); LibMeteor.libmeteor_settracecallback(tracecallback); _MemoryDomains.Clear(); } }
public void Dispose() { if (!disposed) { disposed = true; videohandle.Free(); soundhandle.Free(); // guarantee crash if it gets accessed LibMeteor.libmeteor_setbuffers(IntPtr.Zero, 240 * 160 * 4, IntPtr.Zero, 4); messagecallback = null; inputcallback = null; tracecallback = null; LibMeteor.libmeteor_setmessagecallback(messagecallback); LibMeteor.libmeteor_setkeycallback(inputcallback); LibMeteor.libmeteor_settracecallback(tracecallback); _domainList.Clear(); } }
private void Init() { if (attachedcore != null) attachedcore.Dispose(); messagecallback = PrintMessage; inputcallback = GetInput; tracecallback = Trace; // don't set this callback now, only set if enabled LibMeteor.libmeteor_setmessagecallback(messagecallback); LibMeteor.libmeteor_setkeycallback(inputcallback); LibMeteor.libmeteor_init(); videobuffer = new int[240 * 160]; videohandle = GCHandle.Alloc(videobuffer, GCHandleType.Pinned); soundbuffer = new short[2048]; // nominal length of one frame is something like 1480 shorts? soundhandle = GCHandle.Alloc(soundbuffer, GCHandleType.Pinned); if (!LibMeteor.libmeteor_setbuffers (videohandle.AddrOfPinnedObject(), (uint)(sizeof(int) * videobuffer.Length), soundhandle.AddrOfPinnedObject(), (uint)(sizeof(short) * soundbuffer.Length))) throw new Exception("libmeteor_setbuffers() returned false??"); attachedcore = this; }