Пример #1
0
        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
		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;
		}
Пример #3
0
		private void GBAGPUView_FormClosed(object sender, FormClosedEventArgs e)
		{
			if (gba != null)
			{
				gba.SetScanlineCallback(null, null);
				gba = null;
			}
		}
Пример #4
0
		public void Restart()
		{
			gba = Global.Emulator as GBA;
			if (gba != null)
			{
				gba.GetGPUMemoryAreas(out vram, out palram, out oam, out mmio);
			}
			else
			{
				if (Visible)
					Close();
			}
		}