Пример #1
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            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();

            ConfigManager.ApplyChanges();

            if (_loggingEnabled)
            {
                DebugApi.StopTraceLogger();
            }
        }
Пример #2
0
        public frmTraceLogger()
        {
            InitializeComponent();

            TraceLoggerInfo config = ConfigManager.Config.Debug.TraceLogger;

            RestoreLocation(config.WindowLocation, config.WindowSize);

            txtTraceLog.BaseFont = new Font(config.FontFamily, config.FontSize, config.FontStyle);
            txtTraceLog.TextZoom = config.TextZoom;

            mnuAutoRefresh.Checked = config.AutoRefresh;
            _lineCount             = config.LineCount;

            _entityBinder.Entity = config.LogOptions;

            _entityBinder.AddBinding(nameof(TraceLoggerOptions.LogCpu), chkLogCpu);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.LogSpc), chkLogSpc);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.LogNecDsp), chkLogNecDsp);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.LogSa1), chkLogSa1);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.LogGsu), chkLogGsu);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.LogCx4), chkLogCx4);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.LogGameboy), chkLogGameboy);

            _entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowByteCode), chkShowByteCode);
            //_entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowCpuCycles), chkShowCpuCycles);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowEffectiveAddresses), chkShowEffectiveAddresses);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowMemoryValues), chkShowMemoryValues);
            //_entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowExtraInfo), chkShowExtraInfo);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowPpuFrames), chkShowFrameCount);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowPpuCycles), chkShowPpuCycles);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowPpuScanline), chkShowPpuScanline);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.ShowRegisters), chkShowRegisters);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.IndentCode), chkIndentCode);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.UseLabels), chkUseLabels);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.ExtendZeroPage), chkExtendZeroPage);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.UseWindowsEol), chkUseWindowsEol);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.StatusFormat), cboStatusFlagFormat);
            _entityBinder.AddBinding(nameof(TraceLoggerOptions.OverrideFormat), chkOverrideFormat);
            _entityBinder.UpdateUI();

            this.toolTip.SetToolTip(this.picExpressionWarning, "Condition contains invalid syntax or symbols.");
            //this.toolTip.SetToolTip(this.picHelp, "When a condition is given, instructions will only be logged by the trace logger if the condition returns a value not equal to 0 or false." + Environment.NewLine + Environment.NewLine + frmBreakpoint.GetConditionTooltip(false));
            this.toolTip.SetToolTip(this.picFormatHelp,
                                    "You can customize the trace logger's output by enabling the 'Override' option and altering the format." + Environment.NewLine + Environment.NewLine +
                                    "The following tags are available: " + Environment.NewLine +
                                    "[ByteCode]: The byte code for the instruction (1 to 3 bytes)." + Environment.NewLine +
                                    "[Disassembly]: The disassembly for the current instruction." + Environment.NewLine +
                                    "[EffectiveAddress]: The effective address used for indirect addressing modes." + Environment.NewLine +
                                    "[MemoryValue]: The value stored at the memory location referred to by the instruction." + Environment.NewLine +
                                    "[PC]: Program Counter" + Environment.NewLine +
                                    "[A]: A register" + Environment.NewLine +
                                    "[X]: X register" + Environment.NewLine +
                                    "[Y]: Y register" + Environment.NewLine +
                                    "[SP]: Stack Pointer" + Environment.NewLine +
                                    "[P]: Processor Flags" + Environment.NewLine +
                                    "[Cycle]: The current PPU cycle (H)" + Environment.NewLine +
                                    "[HClock]: The PPU's current H-clock position (H, in terms of master clocks)" + Environment.NewLine +
                                    "[Scanline]: The current PPU scanline (V)" + Environment.NewLine +
                                    "[FrameCount]: The current PPU frame." + Environment.NewLine +
                                    "[CycleCount]: The current CPU cycle (32-bit signed value, resets to 0 at power on)" + Environment.NewLine + Environment.NewLine +
                                    "You can also specify some options by using a comma. e.g:" + Environment.NewLine +
                                    "[Cycle,3] will display the cycle and pad out the output to always be 3 characters wide." + Environment.NewLine +
                                    "[Scanline,h] will display the scanline in hexadecimal." + Environment.NewLine +
                                    "[Align,50]: Align is a special tag that is useful when trying to align some content. [Align,50] will make the next tag start on column 50."
                                    );

            UpdateAvailableOptions();

            _notifListener = new NotificationListener();
            _notifListener.OnNotification += OnNotificationReceived;

            this._initialized = true;
        }