Exemplo n.º 1
0
        public virtual void RunEmulator()
        {
            Thread.CurrentThread.Name = "Run Emulator";
            Debug.WriteLine("Run Emulator Thread Started");

            _cycleCount = 0;
            var cyclesSinceEvent = 0;

            while (EmulationRunning)
            {
                RunEmulationCycle();
                _cycleCount++;

                if (cyclesSinceEvent++ == CycleTickEventInterval)
                {
                    cyclesSinceEvent = 0;
                    if (CycleTick != null)
                    {
                        CycleTick.Invoke(null, null);
                    }
                }

                if (CycleDelay > 0)
                {
                    Thread.Sleep(CycleDelay);
                }
            }

            if (EmulationStopped != null)
            {
                EmulationStopped.Invoke(null, null);
            }

            Console.WriteLine("Run Emulator Thread Exited");
        }
 private void OnEmulationStopped(EventArgs e) => EmulationStopped?.Invoke(this, e);