Exemplo n.º 1
0
 private void RunNESBackGroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     while (PlayLoop && !e.Cancel)
     {
         bitmapData = NESBMP.LockBits(new Rectangle(0, 0, 256, 240), ImageLockMode.WriteOnly, NESBMP.PixelFormat);
         Iptr       = bitmapData.Scan0;
         Marshal.Copy(Iptr, PPU.Pixels, 0, 245760);
         while (!DrawFrame && PlayLoop)
         {
             if (Trace && (CPU.CycleNumber == 0))
             {
                 Debugger.GetTracedata();
             }
             CPU.RunCPU();
             APU.RunAPU(1);
             PPU.RunPPU(1);
         }
         Marshal.Copy(PPU.Pixels, 0, Iptr, 245760);
         try
         {
             if (bitmapData != null)
             {
                 NESBMP.UnlockBits(bitmapData);
                 RunNESBackGroundWorker.ReportProgress(0);
             }
         }
         finally
         {
             DrawFrame = false;
         }
     }
 }
Exemplo n.º 2
0
 public static void Reset()
 {
     DrawFrame  = false;
     bitmapData = null;
     nes.OutputPictureBox.Image = null;
     NESBMP = new Bitmap(256, 240, PixelFormat.Format32bppPArgb);
     DebuggerForm.Reset();
     APU.Reset();
     CPU.Reset();
     GAME.Reset();
     PPU.Reset();
     FramesPerSecond = 0;
     Debugger.Initialize();
     GC.Collect();
 }