protected override void OnFormClosing(FormClosingEventArgs e)
        {
            tmrUpdateLog.Stop();
            while (_refreshRunning)
            {
                System.Threading.Thread.Sleep(50);
            }

            base.OnFormClosing(e);

            DebugInfo debugInfo = ConfigManager.Config.DebugInfo;

            debugInfo.TraceAutoRefresh    = mnuAutoRefresh.Checked;
            debugInfo.TraceLineCount      = _lineCount;
            debugInfo.TraceLoggerSize     = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            debugInfo.TraceLoggerLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;

            debugInfo.TraceFontFamily = txtTraceLog.BaseFont.FontFamily.Name;
            debugInfo.TraceFontSize   = txtTraceLog.BaseFont.Size;
            debugInfo.TraceFontStyle  = txtTraceLog.BaseFont.Style;
            debugInfo.TraceTextZoom   = txtTraceLog.TextZoom;

            _entityBinder.UpdateObject();

            ConfigManager.ApplyChanges();

            if (_loggingEnabled)
            {
                InteropEmu.DebugStopTraceLogger();
            }
        }
예제 #2
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            tmrUpdateLog.Stop();
            while (_refreshRunning)
            {
                System.Threading.Thread.Sleep(50);
            }

            base.OnFormClosing(e);

            DebugInfo debugInfo = ConfigManager.Config.DebugInfo;

            debugInfo.TraceAutoRefresh = mnuAutoRefresh.Checked;
            debugInfo.TraceLineCount   = _lineCount;
            debugInfo.TraceIndentCode  = chkIndentCode.Checked;
            debugInfo.TraceLoggerSize  = this.WindowState == FormWindowState.Maximized ? this.RestoreBounds.Size : this.Size;
            _entityBinder.Entity       = debugInfo.TraceLoggerOptions;
            _entityBinder.UpdateObject();
            debugInfo.TraceLoggerOptions = (TraceLoggerOptions)_entityBinder.Entity;

            ConfigManager.ApplyChanges();

            if (_loggingEnabled)
            {
                InteropEmu.DebugStopTraceLogger();
            }
        }
예제 #3
0
        public void ApplyChanges()
        {
            if (this._dirty)
            {
                _cpuBinder.UpdateObject();
                _ppuControlBinder.UpdateObject();
                _ppuStatusBinder.UpdateObject();

                DebugState state = _lastState;
                state.CPU = (CPUState)_cpuBinder.Entity;

                if (chkExternal.Checked)
                {
                    state.CPU.IRQFlag |= IRQSource.External;
                }
                if (chkFrameCounter.Checked)
                {
                    state.CPU.IRQFlag |= IRQSource.FrameCounter;
                }
                if (chkDMC.Checked)
                {
                    state.CPU.IRQFlag |= IRQSource.DMC;
                }

                state.PPU.ControlFlags = (PPUControlFlags)_ppuControlBinder.Entity;
                state.PPU.StatusFlags  = (PPUStatusFlags)_ppuStatusBinder.Entity;

                state.PPU.State.Mask    = state.PPU.ControlFlags.GetMask();
                state.PPU.State.Control = state.PPU.ControlFlags.GetControl();
                state.PPU.State.Status  = state.PPU.StatusFlags.GetStatus();

                UInt32 cycle = 0;
                UInt32.TryParse(txtCycle.Text, out cycle);
                state.PPU.Cycle = cycle;

                Int32 scanline = 0;
                Int32.TryParse(txtScanline.Text, out scanline);
                state.PPU.Scanline = scanline;

                Int32 xScroll = 0;
                Int32.TryParse(txtXScroll.Text, out xScroll);
                state.PPU.State.XScroll = (byte)Math.Max(0, Math.Min(xScroll, 7));

                UInt16 vramAddr = 0;
                UInt16.TryParse(txtVRAMAddr.Text, System.Globalization.NumberStyles.HexNumber, null, out vramAddr);
                state.PPU.State.VideoRamAddr = vramAddr;

                UInt16 tmpVramAddr = 0;
                UInt16.TryParse(txtTmpAddr.Text, System.Globalization.NumberStyles.HexNumber, null, out tmpVramAddr);
                state.PPU.State.TmpVideoRamAddr = tmpVramAddr;

                state.PPU.State.WriteToggle = chkWriteToggle.Checked;

                InteropEmu.DebugSetState(state);
                _lastState      = state;
                _dirty          = false;
                btnUndo.Enabled = false;
                OnStateChanged?.Invoke(null, null);
            }
        }
예제 #4
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;

            cfg.WindowSize       = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            cfg.WindowLocation   = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            cfg.SplitterDistance = ctrlSplitContainer.SplitterDistance;

            _entityBinder.UpdateObject();
            ConfigManager.ApplyChanges();

            switch (_cpuType)
            {
            case CpuType.Cpu: ConfigApi.SetDebuggerFlag(DebuggerFlags.CpuDebuggerEnabled, false); break;

            case CpuType.Spc: ConfigApi.SetDebuggerFlag(DebuggerFlags.SpcDebuggerEnabled, false); break;

            case CpuType.Sa1: ConfigApi.SetDebuggerFlag(DebuggerFlags.Sa1DebuggerEnabled, false); break;

            case CpuType.Gsu: ConfigApi.SetDebuggerFlag(DebuggerFlags.GsuDebuggerEnabled, false); break;

            case CpuType.NecDsp: ConfigApi.SetDebuggerFlag(DebuggerFlags.NecDspDebuggerEnabled, false); break;
            }

            BreakpointManager.RemoveCpuType(_cpuType);

            if (this._notifListener != null)
            {
                this._notifListener.Dispose();
                this._notifListener = null;
            }
        }
예제 #5
0
        protected override void OnHandleDestroyed(EventArgs e)
        {
            if (!IsDesignMode)
            {
                _entityBinder.UpdateObject();
                ConfigManager.ApplyChanges();
            }

            base.OnHandleDestroyed(e);
        }
예제 #6
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);

            this._notifListener.OnNotification -= this._notifListener_OnNotification;
            _notifListener?.Dispose();
            _refreshManager?.Dispose();

            _binder.UpdateObject();
            _config.EventViewerAutoRefresh      = _refreshManager.AutoRefresh;
            _config.EventViewerAutoRefreshSpeed = _refreshManager.AutoRefreshSpeed;
            _config.EventViewerLocation         = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            _config.EventViewerSize             = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            ConfigManager.Config.DebugInfo      = _config;
            ConfigManager.ApplyChanges();
        }
예제 #7
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            _notifListener?.Dispose();

            tmrUpdateLog.Stop();
            while (_refreshRunning)
            {
                System.Threading.Thread.Sleep(50);
            }

            base.OnFormClosing(e);

            TraceLoggerInfo config = ConfigManager.Config.Debug.TraceLogger;

            config.AutoRefresh    = mnuAutoRefresh.Checked;
            config.LineCount      = _lineCount;
            config.WindowSize     = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            config.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;

            config.FontFamily = txtTraceLog.BaseFont.FontFamily.Name;
            config.FontSize   = txtTraceLog.BaseFont.Size;
            config.FontStyle  = txtTraceLog.BaseFont.Style;
            config.TextZoom   = txtTraceLog.TextZoom;

            _entityBinder.UpdateObject();

            //Disable logging when we close the trace logger
            _interopOptions = GetInteropOptions(true);
            SetCoreOptions();

            ConfigManager.ApplyChanges();

            if (_loggingEnabled)
            {
                DebugApi.StopTraceLogger();
            }
        }
예제 #8
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;

            cfg.WindowSize     = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            cfg.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            _entityBinder.UpdateObject();
            ConfigManager.ApplyChanges();

            BreakpointManager.BreakpointsEnabled = false;
            if (this._notifListener != null)
            {
                this._notifListener.Dispose();
                this._notifListener = null;
            }
        }
예제 #9
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);


            DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;

            cfg.WindowSize     = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            cfg.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            _entityBinder.UpdateObject();
            ConfigManager.ApplyChanges();

            ConfigApi.SetDebuggerFlag(_cpuType == CpuType.Cpu ? DebuggerFlags.CpuDebuggerEnabled : DebuggerFlags.SpcDebuggerEnabled, false);
            BreakpointManager.RemoveCpuType(_cpuType);

            if (this._notifListener != null)
            {
                this._notifListener.Dispose();
                this._notifListener = null;
            }
        }
예제 #10
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);

            HexEditorInfo config = ConfigManager.Config.Debug.HexEditor;

            config.TextZoom       = this.ctrlHexViewer.TextZoom;
            config.FontFamily     = ctrlHexViewer.BaseFont.FontFamily.Name;
            config.FontStyle      = ctrlHexViewer.BaseFont.Style;
            config.FontSize       = ctrlHexViewer.BaseFont.Size;
            config.WindowSize     = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            config.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            config.MemoryType     = cboMemoryType.GetEnumValue <SnesMemoryType>();
            _entityBinder.UpdateObject();
            ConfigManager.ApplyChanges();

            if (this._notifListener != null)
            {
                this._notifListener.Dispose();
                this._notifListener = null;
            }

            _formClosed = true;
        }