Ejemplo n.º 1
0
        /// <summary>
        /// Cleanup the debugger after an instance has been destroyed.
        /// </summary>
        public void OnInstanceStopped()
        {
            _hooks = null;
            this.BiosHook = null;
            this.CpuHook = null;
            this.VideoHook = null;

            if( _isAttached == false )
                return;

            _client.OnStopped();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Setup the debugger after an instance has been started.
        /// </summary>
        public void OnInstanceStarted()
        {
            this.Emulator.AttachDebugger();

            IEmulationInstance emu = this.Emulator.CurrentInstance;
            List<IHook> hooks = new List<IHook>();
            foreach( IComponentInstance instance in emu.Components )
            {
                IDebuggable debuggable = instance as IDebuggable;
                if( debuggable == null )
                    continue;
                if( debuggable.SupportsDebugging == false )
                {
                    Debug.WriteLine( string.Format( "Debugger: {0} does not support debugging", instance.Factory.Name ) );
                    continue;
                }
                debuggable.EnableDebugging();
                hooks.Add( debuggable.DebugHook );

                if( debuggable.DebugHook is IBiosHook )
                    this.BiosHook = ( IBiosHook )debuggable.DebugHook;
                else if( debuggable.DebugHook is ICpuHook )
                    this.CpuHook = ( ICpuHook )debuggable.DebugHook;
                else if( debuggable.DebugHook is IVideoHook )
                    this.VideoHook = ( IVideoHook )debuggable.DebugHook;
            }
            _hooks = hooks.ToArray();

            this.Controller = emu.Cpu.DebugController;

            if( _isAttached == false )
                return;

            _client.OnStarted( emu.Bios.Game, emu.Bios.BootStream );
        }