Exemple #1
0
        public void InternalReset(bool resetComponents)
        {
            // NOTE(Cristian): It's responsability of the view (or the calling audio code) to
            //                 handling and re-hooking correctly the audio on reset
            if (_state.Run)
            {
                this.Stop();
            }

            if (resetComponents)
            {
                _memory.Reset();
                _cpu.Reset();
                _interruptController.Reset();
                _display.Reset();
                _apu.Reset();
                _disassembler.Reset();
                //this.serial = new SerialSpace.SerialController(this.interruptController, this.memory);
            }

            // We re-hook information
            if (this._cartridge != null)
            {
                _apu.CartridgeFilename = this.CartridgeFilename;
                _memory.SetMemoryHandler(GBSharp.MemorySpace.MemoryHandlers.
                                         MemoryHandlerFactory.CreateMemoryHandler(this));
            }

            _buttons          = Keypad.None;
            _pauseEvent       = new ManualResetEvent(true);
            _manualResetEvent = new ManualResetEventSlim(false);

            _state.InBreakpoint = false;
            ReleaseButtons      = true;

            var disDef = _display.GetDisplayDefinition();

#if TIMING
            _timingSamples = new long[_sampleAmount * _maxSamples];
            _swCPU         = new Stopwatch();
            _swDisplay     = new Stopwatch();
            _swBlit        = new Stopwatch();
            _swClockMem    = new Stopwatch();
#endif
        }