コード例 #1
0
ファイル: Meteor.cs プロジェクト: stuff2600/RAEmus
        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;
        }
コード例 #2
0
ファイル: Meteor.cs プロジェクト: stuff2600/RAEmus
 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();
     }
 }
コード例 #3
0
ファイル: Meteor.cs プロジェクト: rjb8682/BizHawk-1
		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();
			}
		}
コード例 #4
0
ファイル: Meteor.cs プロジェクト: rjb8682/BizHawk-1
		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;
		}