Esempio n. 1
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            tmrCdlRatios.Stop();

            LabelManager.OnLabelUpdated          -= LabelManager_OnLabelUpdated;
            BreakpointManager.BreakpointsChanged -= BreakpointManager_BreakpointsChanged;
            ctrlConsoleStatus.OnStateChanged     -= ctrlConsoleStatus_OnStateChanged;
            ctrlProfiler.OnFunctionSelected      -= ctrlProfiler_OnFunctionSelected;

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

            InteropEmu.DebugSetFlags(0);
            InteropEmu.SetFlag(EmulationFlags.DebuggerWindowEnabled, false);
            InteropEmu.DebugSetBreakpoints(new InteropBreakpoint[0], 0);
            InteropEmu.DebugRun();

            ConfigManager.Config.DebugInfo.WindowWidth    = this.WindowState == FormWindowState.Maximized ? this.RestoreBounds.Width : this.Width;
            ConfigManager.Config.DebugInfo.WindowHeight   = this.WindowState == FormWindowState.Maximized ? this.RestoreBounds.Height : this.Height;
            ConfigManager.Config.DebugInfo.TopPanelHeight = this.splitContainer.GetSplitterDistance();
            ConfigManager.Config.DebugInfo.LeftPanelWidth = this.ctrlSplitContainerTop.GetSplitterDistance();
            ConfigManager.ApplyChanges();

            DebugWorkspaceManager.SaveWorkspace();
        }
Esempio n. 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.DesignMode)
            {
                this._charMappings = new ConcurrentDictionary <string, string>();

                foreach (KeyValuePair <string, string> kvp in _defaultCharMappings)
                {
                    this._charMappings[kvp.Key] = kvp.Value;
                }

                foreach (CharMap mapping in ConfigManager.Config.DebugInfo.TextHookerCharMappings)
                {
                    this._charMappings[mapping.Key] = mapping.Value;
                }

                this.ctrlScanlineCycle.Initialize(_ppuViewerId, ConfigManager.Config.DebugInfo.TextHookerDisplayScanline, ConfigManager.Config.DebugInfo.TextHookerDisplayCycle);
                this.ctrlTextHooker.SetCharacterMappings(_charMappings);
                this.ctrlCharacterMappings.SetCharacterMappings(_charMappings);

                this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
                this._notifListener.OnNotification += this._notifListener_OnNotification;

                this.ctrlTextHooker.GetData();
                this.ctrlCharacterMappings.GetData();

                this.ctrlTextHooker.RefreshViewer();
                this.ctrlCharacterMappings.RefreshViewer();

                this.InitShortcuts();
            }
        }
Esempio n. 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.DesignMode)
            {
                this._notifListener = new InteropEmu.NotificationListener();
                this._notifListener.OnNotification += this._notifListener_OnNotification;

                this.nudScanline.Value = ConfigManager.Config.DebugInfo.PpuDisplayScanline;
                this.nudCycle.Value    = ConfigManager.Config.DebugInfo.PpuDisplayCycle;

                InteropEmu.DebugSetPpuViewerScanlineCycle((int)this.nudScanline.Value, (int)this.nudCycle.Value);

                this.ctrlNametableViewer.GetData();
                this.ctrlChrViewer.GetData();
                this.ctrlSpriteViewer.GetData();
                this.ctrlPaletteViewer.GetData();

                this.ctrlNametableViewer.RefreshViewer();
                this.ctrlChrViewer.RefreshViewer();
                this.ctrlSpriteViewer.RefreshViewer();
                this.ctrlPaletteViewer.RefreshViewer();
            }
        }
Esempio n. 4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            DebugInfo config = ConfigManager.Config.DebugInfo;

            this.mnuAutoRefresh.Checked             = config.RamAutoRefresh;
            this.mnuHighDensityMode.Checked         = config.RamHighDensityTextMode;
            this.mnuByteEditingMode.Checked         = config.RamByteEditingMode;
            this.mnuEnablePerByteNavigation.Checked = config.RamEnablePerByteNavigation;
            UpdateRefreshSpeedMenu();

            this.mnuIgnoreRedundantWrites.Checked = config.RamIgnoreRedundantWrites;
            this.UpdateFlags();

            this.mnuShowCharacters.Checked           = config.RamShowCharacters;
            this.mnuShowLabelInfoOnMouseOver.Checked = config.RamShowLabelInfo;

            this.ctrlHexViewer.TextZoom = config.RamTextZoom;
            this.ctrlHexViewer.BaseFont = new Font(config.RamFontFamily, config.RamFontSize, config.RamFontStyle);

            this.ctrlMemoryAccessCounters.BaseFont = new Font(config.RamFontFamily, config.RamFontSize, config.RamFontStyle);
            this.ctrlMemoryAccessCounters.TextZoom = config.RamTextZoom;

            this.mnuHighlightExecution.Checked = config.RamHighlightExecution;
            this.mnuHightlightReads.Checked    = config.RamHighlightReads;
            this.mnuHighlightWrites.Checked    = config.RamHighlightWrites;
            this.mnuHideUnusedBytes.Checked    = config.RamHideUnusedBytes;
            this.mnuHideReadBytes.Checked      = config.RamHideReadBytes;
            this.mnuHideWrittenBytes.Checked   = config.RamHideWrittenBytes;
            this.mnuHideExecutedBytes.Checked  = config.RamHideExecutedBytes;

            this.mnuHighlightLabelledBytes.Checked = config.RamHighlightLabelledBytes;
            this.mnuHighlightChrDrawnBytes.Checked = config.RamHighlightChrDrawnBytes;
            this.mnuHighlightChrReadBytes.Checked  = config.RamHighlightChrReadBytes;
            this.mnuHighlightCodeBytes.Checked     = config.RamHighlightCodeBytes;
            this.mnuHighlightDataBytes.Checked     = config.RamHighlightDataBytes;
            this.mnuHighlightDmcDataBytes.Checked  = config.RamHighlightDmcDataBytes;

            this.UpdateFadeOptions();

            this.InitTblMappings();

            this.ctrlHexViewer.StringViewVisible = mnuShowCharacters.Checked;

            UpdateImportButton();
            InitMemoryTypeDropdown();

            _notifListener = new InteropEmu.NotificationListener();
            _notifListener.OnNotification += _notifListener_OnNotification;

            this.mnuShowCharacters.CheckedChanged        += this.mnuShowCharacters_CheckedChanged;
            this.mnuIgnoreRedundantWrites.CheckedChanged += mnuIgnoreRedundantWrites_CheckedChanged;

            if (!ConfigManager.Config.DebugInfo.MemoryViewerSize.IsEmpty)
            {
                this.Size = ConfigManager.Config.DebugInfo.MemoryViewerSize;
            }
        }
Esempio n. 5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this._notifListener = new InteropEmu.NotificationListener();
            this._notifListener.OnNotification += this._notifListener_OnNotification;

            this.InitShortcuts();
        }
Esempio n. 6
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
            this._notifListener.OnNotification += this._notifListener_OnNotification;

            this.InitShortcuts();
        }
Esempio n. 7
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.DesignMode)
            {
                this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
                this._notifListener.OnNotification += this._notifListener_OnNotification;

                this.ctrlScanlineCycle.Initialize(_ppuViewerId, ConfigManager.Config.DebugInfo.PpuDisplayScanline, ConfigManager.Config.DebugInfo.PpuDisplayCycle);

                GetData();

                this.ctrlNametableViewer.RefreshViewer();
                this.ctrlChrViewer.RefreshViewer();
                this.ctrlSpriteViewer.RefreshViewer();
                this.ctrlPaletteViewer.RefreshViewer();

                this.InitShortcuts();
                this.UpdateRefreshSpeedMenu();

                string toggleViewTooltip = "Toggle Compact/Normal View";
                if (ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleView != Keys.None)
                {
                    toggleViewTooltip += " (" + DebuggerShortcutsConfig.GetShortcutDisplay(ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleView) + ")";
                }
                this.toolTip.SetToolTip(this.btnToggleView, toggleViewTooltip);

                string toggleZoomTooltip = "Toggle 2x Zoom";
                if (ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleZoom != Keys.None)
                {
                    toggleZoomTooltip += " (" + DebuggerShortcutsConfig.GetShortcutDisplay(ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleZoom) + ")";
                }
                this.toolTip.SetToolTip(this.chkToggleZoom, toggleZoomTooltip);

                _selectedTab = tabMain.SelectedTab;
                if (_mode != PpuViewerMode.Combined)
                {
                    TabPage page = _selectedTab;
                    switch (_mode)
                    {
                    case PpuViewerMode.NametableViewer: page = tpgNametableViewer; break;

                    case PpuViewerMode.ChrViewer: page = tpgChrViewer; break;

                    case PpuViewerMode.SpriteViewer: page = tpgSpriteViewer; break;

                    case PpuViewerMode.PaletteViewer: page = tpgPaletteViewer; break;
                    }

                    _selectedTab = page;
                    tabMain.SelectTab(page);
                    ToggleView();
                }
            }
        }
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            base.OnFormClosed(e);

            if (_notifListener != null)
            {
                _notifListener.Dispose();
                _notifListener = null;
            }
        }
Esempio n. 9
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!DesignMode)
            {
                _notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
                _notifListener.OnNotification += _notifListener_OnNotification;
                ctrlWatch.UpdateWatch(true);
            }
        }
Esempio n. 10
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.mnuAutoRefresh.Checked = ConfigManager.Config.DebugInfo.RamAutoRefresh;
            UpdateRefreshSpeedMenu();

            this.mnuIgnoreRedundantWrites.Checked = ConfigManager.Config.DebugInfo.RamIgnoreRedundantWrites;
            this.UpdateFlags();

            this.mnuShowCharacters.Checked           = ConfigManager.Config.DebugInfo.RamShowCharacters;
            this.mnuShowLabelInfoOnMouseOver.Checked = ConfigManager.Config.DebugInfo.RamShowLabelInfo;

            this.ctrlHexViewer.SetFontSize((int)ConfigManager.Config.DebugInfo.RamFontSize);

            this.mnuHighlightExecution.Checked = ConfigManager.Config.DebugInfo.RamHighlightExecution;
            this.mnuHightlightReads.Checked    = ConfigManager.Config.DebugInfo.RamHighlightReads;
            this.mnuHighlightWrites.Checked    = ConfigManager.Config.DebugInfo.RamHighlightWrites;
            this.mnuHideUnusedBytes.Checked    = ConfigManager.Config.DebugInfo.RamHideUnusedBytes;
            this.mnuHideReadBytes.Checked      = ConfigManager.Config.DebugInfo.RamHideReadBytes;
            this.mnuHideWrittenBytes.Checked   = ConfigManager.Config.DebugInfo.RamHideWrittenBytes;
            this.mnuHideExecutedBytes.Checked  = ConfigManager.Config.DebugInfo.RamHideExecutedBytes;

            this.mnuHighlightLabelledBytes.Checked = ConfigManager.Config.DebugInfo.RamHighlightLabelledBytes;
            this.mnuHighlightChrDrawnBytes.Checked = ConfigManager.Config.DebugInfo.RamHighlightChrDrawnBytes;
            this.mnuHighlightChrReadBytes.Checked  = ConfigManager.Config.DebugInfo.RamHighlightChrReadBytes;
            this.mnuHighlightCodeBytes.Checked     = ConfigManager.Config.DebugInfo.RamHighlightCodeBytes;
            this.mnuHighlightDataBytes.Checked     = ConfigManager.Config.DebugInfo.RamHighlightDataBytes;
            this.mnuHighlightDmcDataBytes.Checked  = ConfigManager.Config.DebugInfo.RamHighlightDmcDataBytes;

            this.UpdateFadeOptions();

            this.InitTblMappings();

            this.ctrlHexViewer.StringViewVisible = mnuShowCharacters.Checked;

            UpdateImportButton();

            this.cboMemoryType.SelectedIndex = 0;

            _notifListener = new InteropEmu.NotificationListener();
            _notifListener.OnNotification += _notifListener_OnNotification;

            this.mnuShowCharacters.CheckedChanged        += this.mnuShowCharacters_CheckedChanged;
            this.mnuIgnoreRedundantWrites.CheckedChanged += mnuIgnoreRedundantWrites_CheckedChanged;

            if (!ConfigManager.Config.DebugInfo.MemoryViewerSize.IsEmpty)
            {
                this.Size = ConfigManager.Config.DebugInfo.MemoryViewerSize;
            }
        }
Esempio n. 11
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.mnuAutoRefresh.Checked = ConfigManager.Config.DebugInfo.RamAutoRefresh;
            this.ctrlHexViewer.FontSize = ConfigManager.Config.DebugInfo.RamFontSize;

            UpdateImportButton();

            this.cboMemoryType.SelectedIndex = 0;
            this.Size = new Size(this.ctrlHexViewer.IdealWidth, this.Height);

            _notifListener = new InteropEmu.NotificationListener();
            _notifListener.OnNotification += _notifListener_OnNotification;
        }
Esempio n. 12
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.DesignMode)
            {
                this._notifListener = new InteropEmu.NotificationListener();
                this._notifListener.OnNotification += this._notifListener_OnNotification;

                this.ctrlNametableViewer.RefreshViewer();
                this.ctrlChrViewer.RefreshViewer();
                this.ctrlSpriteViewer.RefreshViewer();
                this.ctrlPaletteViewer.RefreshViewer();
            }
        }
Esempio n. 13
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.DesignMode)
            {
                this.mnuRefreshOnBreak.Checked        = ConfigManager.Config.DebugInfo.EventViewerRefreshOnBreak;
                this.chkShowPpuRegisterWrites.Checked = ConfigManager.Config.DebugInfo.EventViewerShowPpuRegisterWrites;
                this.chkShowPpuRegisterReads.Checked  = ConfigManager.Config.DebugInfo.EventViewerShowPpuRegisterReads;
                this.chkShowIrq.Checked                  = ConfigManager.Config.DebugInfo.EventViewerShowIrq;
                this.chkShowNmi.Checked                  = ConfigManager.Config.DebugInfo.EventViewerShowNmi;
                this.chkShowSpriteZero.Checked           = ConfigManager.Config.DebugInfo.EventViewerShowSpriteZeroHit;
                this.chkShowMapperRegisterWrites.Checked = ConfigManager.Config.DebugInfo.EventViewerShowMapperRegisterWrites;
                this.chkShowMapperRegisterReads.Checked  = ConfigManager.Config.DebugInfo.EventViewerShowMapperRegisterReads;
                this.chkBreakpoints.Checked              = ConfigManager.Config.DebugInfo.EventViewerShowMarkedBreakpoints;
                this.chkShowPreviousFrameEvents.Checked  = ConfigManager.Config.DebugInfo.EventViewerShowPreviousFrameEvents;

                string toggleViewTooltip = "Toggle Compact/Normal View";
                if (ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleView != Keys.None)
                {
                    toggleViewTooltip += " (" + DebuggerShortcutsConfig.GetShortcutDisplay(ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleView) + ")";
                }
                this.toolTip.SetToolTip(this.btnToggleView, toggleViewTooltip);

                string toggleZoomTooltip = "Toggle 2x Zoom";
                if (ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleZoom != Keys.None)
                {
                    toggleZoomTooltip += " (" + DebuggerShortcutsConfig.GetShortcutDisplay(ConfigManager.Config.DebugInfo.Shortcuts.PpuViewer_ToggleZoom) + ")";
                }
                this.toolTip.SetToolTip(this.chkToggleZoom, toggleZoomTooltip);

                _previousPictureSize = ctrlEventViewerPpuView.Size;

                this.GetData();
                this.RefreshViewer();

                DebugWorkspaceManager.GetWorkspace();

                if (!ConfigManager.Config.DebugInfo.EventViewerLocation.IsEmpty)
                {
                    this.StartPosition = FormStartPosition.Manual;
                    this.Location      = ConfigManager.Config.DebugInfo.EventViewerLocation;
                }

                this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
                this._notifListener.OnNotification += this._notifListener_OnNotification;
            }
        }
Esempio n. 14
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.mnuSplitView.Checked            = ConfigManager.Config.DebugInfo.SplitView;
            this.mnuPpuPartialDraw.Checked       = ConfigManager.Config.DebugInfo.PpuPartialDraw;
            this.mnuShowCpuMemoryMapping.Checked = ConfigManager.Config.DebugInfo.ShowCpuMemoryMapping;
            this.mnuShowPpuMemoryMapping.Checked = ConfigManager.Config.DebugInfo.ShowPpuMemoryMapping;

            _lastCodeWindow = ctrlDebuggerCode;

            this.ctrlDebuggerCode.SetConfig(ConfigManager.Config.DebugInfo.LeftView);
            this.ctrlDebuggerCodeSplit.SetConfig(ConfigManager.Config.DebugInfo.RightView);

            BreakpointManager.Breakpoints.Clear();
            BreakpointManager.Breakpoints.AddRange(ConfigManager.Config.DebugInfo.Breakpoints);
            BreakpointManager.BreakpointsChanged += BreakpointManager_BreakpointsChanged;
            this.ctrlBreakpoints.RefreshList();
            RefreshBreakpoints();

            this.toolTip.SetToolTip(this.picWatchHelp,
                                    "Most expressions/operators are accepted (C++ syntax)." + Environment.NewLine +
                                    "Note: Use the $ prefix to denote hexadecimal values." + Environment.NewLine + Environment.NewLine +
                                    "A/X/Y/PS/SP: Value of registers" + Environment.NewLine +
                                    "Irq/Nmi: True if the Irq/Nmi flags are set" + Environment.NewLine +
                                    "Cycle/Scanline: Current cycle (0-340)/scanline(-1 to 260) of the PPU" + Environment.NewLine +
                                    "Value: Current value being read/written from/to memory" + Environment.NewLine +
                                    "[<address>]: Value at address (CPU)" + Environment.NewLine + Environment.NewLine +

                                    "Examples:" + Environment.NewLine +
                                    "a == 10 || x == $23" + Environment.NewLine +
                                    "scanline == 10 && (cycle >= 55 && cycle <= 100)" + Environment.NewLine +
                                    "x == [$150] || y == [10]" + Environment.NewLine +
                                    "[[$15] + y]   -> Reads the value at address $15, adds Y to it and reads the value at the resulting address."
                                    );

            _notifListener = new InteropEmu.NotificationListener();
            _notifListener.OnNotification += _notifListener_OnNotification;

            InteropEmu.DebugInitialize();

            //Pause a few frames later to give the debugger a chance to disassemble some code
            InteropEmu.DebugStep(30000);

            UpdateCdlRatios();
            tmrCdlRatios.Start();
        }
Esempio n. 15
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsDesignMode)
            {
                _isNsf         = InteropEmu.IsNsf();
                _notifListener = new InteropEmu.NotificationListener(InteropEmu.ConsoleId.Master);
                _notifListener.OnNotification += notifListener_OnNotification;

                this.btnNext.KeyUp     += Child_KeyUp;
                this.btnPause.KeyUp    += Child_KeyUp;
                this.btnPrevious.KeyUp += Child_KeyUp;
                this.cboTrack.KeyUp    += Child_KeyUp;
                this.trkVolume.KeyUp   += Child_KeyUp;
            }
        }
Esempio n. 16
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.DesignMode)
            {
                this.GetData();
                this.RefreshViewer();

                DebugWorkspaceManager.GetWorkspace();

                if (!ConfigManager.Config.DebugInfo.EventViewerSize.IsEmpty)
                {
                    this.Size = ConfigManager.Config.DebugInfo.EventViewerSize;
                }

                this._notifListener = new InteropEmu.NotificationListener();
                this._notifListener.OnNotification += this._notifListener_OnNotification;
            }
        }
Esempio n. 17
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);
            UpdateConfig();
            ConfigManager.Config.DebugInfo.RamFontFamily        = ctrlHexViewer.BaseFont.FontFamily.Name;
            ConfigManager.Config.DebugInfo.RamFontStyle         = ctrlHexViewer.BaseFont.Style;
            ConfigManager.Config.DebugInfo.RamFontSize          = ctrlHexViewer.BaseFont.Size;
            ConfigManager.Config.DebugInfo.MemoryViewerSize     = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            ConfigManager.Config.DebugInfo.MemoryViewerLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            ConfigManager.Config.DebugInfo.RamMemoryType        = cboMemoryType.GetEnumValue <DebugMemoryType>();
            ConfigManager.ApplyChanges();
            DebugWorkspaceManager.SaveWorkspace();

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

            _formClosed = true;
        }
Esempio n. 18
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.DesignMode)
            {
                this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
                this._notifListener.OnNotification += this._notifListener_OnNotification;

                this.ctrlScanlineCycle.Initialize(_ppuViewerId, ConfigManager.Config.DebugInfo.PpuDisplayScanline, ConfigManager.Config.DebugInfo.PpuDisplayCycle);

                GetData();

                this.ctrlNametableViewer.RefreshViewer();
                this.ctrlChrViewer.RefreshViewer();
                this.ctrlSpriteViewer.RefreshViewer();
                this.ctrlPaletteViewer.RefreshViewer();

                this.InitShortcuts();
            }
        }
Esempio n. 19
0
        private void StartEmulatorProcess(string baseDir)
        {
            /*
             * var process = new Process();
             * process.StartInfo.WorkingDirectory = Environment.CurrentDirectory + @"\fceux";
             * process.StartInfo.FileName = "fceux.exe";
             * process.StartInfo.Arguments = cartridgeFile;
             * process.EnableRaisingEvents = true;
             * process.Exited += (sender, args) => { _emulatorProcess = null; };
             *
             * process.Start();
             * _emulatorProcess = process;
             */
            var test    = InteropEmu.TestDll();
            var version = InteropEmu.GetMesenVersion();

            InteropEmu.SetDisplayLanguage(Language.English);
            InteropEmu.InitDll();

            _notifListener = new InteropEmu.NotificationListener(InteropEmu.ConsoleId.Master);
            _notifListener.OnNotification += HandleNotification;

            ApplyConfig();
            InteropEmu.ScreenSize size = InteropEmu.GetScreenSize(false);
            _renderControl.Size = new Size(size.Width, size.Height);
            InteropEmu.InitializeEmu(baseDir, _mainWindow.Handle, _renderControl.Handle, false, false, false);



            InteropEmu.AddKnownGameFolder(@"C:\Users\dkmrs\Documents\NesDev\sc");
            ApplyInputConfig();
            ApplyAudioConfig();
            ApplyPreferenceConfig();
            ApplyEmulationConfig();

            InteropEmu.SetNesModel(NesModel.Auto);
            InteropEmu.DebugSetDebuggerConsole(InteropEmu.ConsoleId.Master);
        }
Esempio n. 20
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.mnuAutoRefresh.Checked    = ConfigManager.Config.DebugInfo.RamAutoRefresh;
            this.mnuShowCharacters.Checked = ConfigManager.Config.DebugInfo.RamShowCharacters;
            this.ctrlHexViewer.SetFontSize((int)ConfigManager.Config.DebugInfo.RamFontSize);

            this.mnuHighlightExecution.Checked = ConfigManager.Config.DebugInfo.RamHighlightExecution;
            this.mnuHightlightReads.Checked    = ConfigManager.Config.DebugInfo.RamHighlightReads;
            this.mnuHighlightWrites.Checked    = ConfigManager.Config.DebugInfo.RamHighlightWrites;
            this.mnuHideUnusedBytes.Checked    = ConfigManager.Config.DebugInfo.RamHideUnusedBytes;
            this.mnuHideReadBytes.Checked      = ConfigManager.Config.DebugInfo.RamHideReadBytes;
            this.mnuHideWrittenBytes.Checked   = ConfigManager.Config.DebugInfo.RamHideWrittenBytes;
            this.mnuHideExecutedBytes.Checked  = ConfigManager.Config.DebugInfo.RamHideExecutedBytes;

            this.UpdateFadeOptions();

            this.InitTblMappings();

            this.ctrlHexViewer.StringViewVisible = mnuShowCharacters.Checked;

            UpdateImportButton();

            this.cboMemoryType.SelectedIndex = 0;

            _notifListener = new InteropEmu.NotificationListener();
            _notifListener.OnNotification += _notifListener_OnNotification;

            this.mnuShowCharacters.CheckedChanged += new EventHandler(this.mnuShowCharacters_CheckedChanged);

            if (!ConfigManager.Config.DebugInfo.MemoryViewerSize.IsEmpty)
            {
                this.Size = ConfigManager.Config.DebugInfo.MemoryViewerSize;
            }
        }
Esempio n. 21
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _minimumSize = this.MinimumSize;

            if (Program.IsMono)
            {
                //This doesn't work in Mono (menu is blank) - hide it for now
                mnuCode.Visible = false;
            }

            bool debuggerAlreadyRunning = InteropEmu.DebugIsDebuggerRunning();

            ctrlConsoleStatus.OnStateChanged     += ctrlConsoleStatus_OnStateChanged;
            LabelManager.OnLabelUpdated          += LabelManager_OnLabelUpdated;
            BreakpointManager.BreakpointsChanged += BreakpointManager_BreakpointsChanged;
            ctrlProfiler.OnFunctionSelected      += ctrlProfiler_OnFunctionSelected;

            this.InitToolbar();

            this.UpdateWorkspace();
            this.AutoLoadCdlFiles();
            this.AutoLoadDbgFiles(true);

            this.mnuSplitView.Checked                 = ConfigManager.Config.DebugInfo.SplitView;
            this.mnuPpuPartialDraw.Checked            = ConfigManager.Config.DebugInfo.PpuPartialDraw;
            this.mnuPpuShowPreviousFrame.Checked      = ConfigManager.Config.DebugInfo.PpuShowPreviousFrame;
            this.mnuShowEffectiveAddresses.Checked    = ConfigManager.Config.DebugInfo.ShowEffectiveAddresses;
            this.mnuShowCodePreview.Checked           = ConfigManager.Config.DebugInfo.ShowCodePreview;
            this.mnuShowToolbar.Checked               = ConfigManager.Config.DebugInfo.ShowToolbar;
            this.mnuShowCpuMemoryMapping.Checked      = ConfigManager.Config.DebugInfo.ShowCpuMemoryMapping;
            this.mnuShowPpuMemoryMapping.Checked      = ConfigManager.Config.DebugInfo.ShowPpuMemoryMapping;
            this.mnuAutoLoadDbgFiles.Checked          = ConfigManager.Config.DebugInfo.AutoLoadDbgFiles;
            this.mnuAutoLoadCdlFiles.Checked          = ConfigManager.Config.DebugInfo.AutoLoadCdlFiles;
            this.mnuBreakOnReset.Checked              = ConfigManager.Config.DebugInfo.BreakOnReset;
            this.mnuBreakOnOpen.Checked               = ConfigManager.Config.DebugInfo.BreakOnOpen;
            this.mnuBreakOnUnofficialOpcodes.Checked  = ConfigManager.Config.DebugInfo.BreakOnUnofficialOpcodes;
            this.mnuBreakOnBrk.Checked                = ConfigManager.Config.DebugInfo.BreakOnBrk;
            this.mnuBreakOnDebuggerFocus.Checked      = ConfigManager.Config.DebugInfo.BreakOnDebuggerFocus;
            this.mnuDisplayOpCodesInLowerCase.Checked = ConfigManager.Config.DebugInfo.DisplayOpCodesInLowerCase;

            this.mnuDisassembleVerifiedData.Checked     = ConfigManager.Config.DebugInfo.DisassembleVerifiedData;
            this.mnuDisassembleUnidentifiedData.Checked = ConfigManager.Config.DebugInfo.DisassembleUnidentifiedData;

            this.mnuShowVerifiedData.Checked     = ConfigManager.Config.DebugInfo.ShowVerifiedData;
            this.mnuShowUnidentifiedData.Checked = ConfigManager.Config.DebugInfo.ShowUnidentifiedData;

            this.mnuRefreshWatchWhileRunning.Checked = ConfigManager.Config.DebugInfo.RefreshWatchWhileRunning;
            this.mnuShowMemoryValues.Checked         = ConfigManager.Config.DebugInfo.ShowMemoryValuesInCodeWindow;
            ctrlDebuggerCode.ShowMemoryValues        = mnuShowMemoryValues.Checked;
            ctrlDebuggerCodeSplit.ShowMemoryValues   = mnuShowMemoryValues.Checked;

            if (ConfigManager.Config.DebugInfo.WindowWidth > -1)
            {
                this.Width  = ConfigManager.Config.DebugInfo.WindowWidth;
                this.Height = ConfigManager.Config.DebugInfo.WindowHeight;
            }

            tsToolbar.Visible            = mnuShowToolbar.Checked;
            ctrlCpuMemoryMapping.Visible = mnuShowCpuMemoryMapping.Checked;
            ctrlPpuMemoryMapping.Visible = mnuShowPpuMemoryMapping.Checked;

            if (ConfigManager.Config.DebugInfo.LeftPanelWidth > 0)
            {
                this.ctrlSplitContainerTop.SplitterDistance = ConfigManager.Config.DebugInfo.LeftPanelWidth;
            }
            if (ConfigManager.Config.DebugInfo.TopPanelHeight > 0)
            {
                this.splitContainer.SplitterDistance = ConfigManager.Config.DebugInfo.TopPanelHeight;
            }

            if (!ConfigManager.Config.DebugInfo.ShowRightPanel)
            {
                ctrlSplitContainerTop.CollapsePanel();
            }
            else
            {
                mnuShowFunctionLabelLists.Checked = true;
            }

            if (!ConfigManager.Config.DebugInfo.ShowBottomPanel)
            {
                splitContainer.CollapsePanel();
            }
            else
            {
                mnuShowBottomPanel.Checked = true;
            }

            _lastCodeWindow = ctrlDebuggerCode;

            this.ctrlDebuggerCode.SetConfig(ConfigManager.Config.DebugInfo.LeftView);
            this.ctrlDebuggerCodeSplit.SetConfig(ConfigManager.Config.DebugInfo.RightView);

            this.toolTip.SetToolTip(this.picWatchHelp, frmBreakpoint.GetConditionTooltip(true));

            _notifListener = new InteropEmu.NotificationListener();
            _notifListener.OnNotification += _notifListener_OnNotification;

            InteropEmu.DebugInitialize();

            _debuggerInitialized = true;

            DebugState state = new DebugState();

            InteropEmu.DebugGetState(ref state);
            _previousCycle = state.CPU.CycleCount;

            //Pause a few frames later to give the debugger a chance to disassemble some code
            _firstBreak = true;
            if (!debuggerAlreadyRunning)
            {
                InteropEmu.SetFlag(EmulationFlags.ForceMaxSpeed, true);
                InteropEmu.DebugStep(5000);
            }
            else
            {
                //Break once to show code and then resume execution
                InteropEmu.DebugStep(1);
            }
            InteropEmu.SetFlag(EmulationFlags.Paused, false);

            UpdateDebuggerFlags();
            UpdateCdlRatios();
            UpdateFileOptions();

            tmrCdlRatios.Start();
        }
Esempio n. 22
0
        public frmScript(bool forceBlank = false)
        {
            InitializeComponent();

            DebugInfo config = ConfigManager.Config.DebugInfo;

            _popupMenu           = new AutocompleteMenu(txtScriptContent, this);
            _popupMenu.ImageList = new ImageList();
            _popupMenu.ImageList.Images.Add(Resources.Enum);
            _popupMenu.ImageList.Images.Add(Resources.Function);
            _popupMenu.SelectedColor = Color.LightBlue;
            _popupMenu.SearchPattern = @"[\w\.]";

            List <AutocompleteItem> items = new List <AutocompleteItem>();

            _availableFunctions.Sort((a, b) => {
                int type = a[0].CompareTo(b[0]);
                if (type == 0)
                {
                    return(a[1].CompareTo(b[1]));
                }
                else
                {
                    return(-type);
                }
            });

            foreach (List <string> item in _availableFunctions)
            {
                MethodAutocompleteItem autocompleteItem = new MethodAutocompleteItem(item[1]);
                autocompleteItem.ImageIndex   = item[0] == "func" ? 1 : 0;
                autocompleteItem.ToolTipTitle = item[2];
                if (!string.IsNullOrWhiteSpace(item[3]))
                {
                    autocompleteItem.ToolTipText = "Parameters" + Environment.NewLine + item[3] + Environment.NewLine + Environment.NewLine;
                }
                if (!string.IsNullOrWhiteSpace(item[4]))
                {
                    autocompleteItem.ToolTipText += "Return Value" + Environment.NewLine + item[4] + Environment.NewLine + Environment.NewLine;
                }
                if (!string.IsNullOrWhiteSpace(item[5]))
                {
                    autocompleteItem.ToolTipText += "Description" + Environment.NewLine + item[5] + Environment.NewLine + Environment.NewLine;
                }
                items.Add(autocompleteItem);
            }

            _popupMenu.Items.SetAutocompleteItems(items);

            UpdateRecentScripts();

            mnuTutorialScript.Checked     = config.ScriptStartupBehavior == ScriptStartupBehavior.ShowTutorial;
            mnuBlankWindow.Checked        = config.ScriptStartupBehavior == ScriptStartupBehavior.ShowBlankWindow;
            mnuAutoLoadLastScript.Checked = config.ScriptStartupBehavior == ScriptStartupBehavior.LoadLastScript;

            if (!forceBlank)
            {
                if (mnuAutoLoadLastScript.Checked && mnuRecentScripts.DropDownItems.Count > 0)
                {
                    string scriptToLoad = config.RecentScripts.Where((s) => File.Exists(s)).FirstOrDefault();
                    if (scriptToLoad != null)
                    {
                        LoadScriptFile(scriptToLoad, false);
                    }
                }
                else if (mnuTutorialScript.Checked)
                {
                    using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Mesen.GUI.Debugger.Example.lua")) {
                        using (StreamReader reader = new StreamReader(stream)) {
                            txtScriptContent.Text = reader.ReadToEnd();
                            _originalText         = txtScriptContent.Text;
                            txtScriptContent.ClearUndo();
                        }
                    }
                }
            }

            if (!config.ScriptWindowSize.IsEmpty)
            {
                this.Size = config.ScriptWindowSize;
            }
            mnuSaveBeforeRun.Checked = config.SaveScriptBeforeRun;

            if (config.ScriptCodeWindowHeight >= ctrlSplit.Panel1MinSize)
            {
                if (config.ScriptCodeWindowHeight == Int32.MaxValue)
                {
                    ctrlSplit.CollapsePanel();
                }
                else
                {
                    ctrlSplit.SplitterDistance = config.ScriptCodeWindowHeight;
                }
            }

            txtScriptContent.Font = new Font(config.ScriptFontFamily, config.ScriptFontSize, config.ScriptFontStyle);
            txtScriptContent.Zoom = config.ScriptZoom;

            if (!this.DesignMode)
            {
                this._notifListener = new InteropEmu.NotificationListener();
                this._notifListener.OnNotification += this._notifListener_OnNotification;

                this.InitShortcuts();
            }
        }
Esempio n. 23
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this._selectedTab = this.tabMain.SelectedTab;

            DebugInfo config = ConfigManager.Config.DebugInfo;

            this.mnuAutoRefresh.Checked             = config.RamAutoRefresh;
            this.mnuHighDensityMode.Checked         = config.RamHighDensityTextMode;
            this.mnuByteEditingMode.Checked         = config.RamByteEditingMode;
            this.mnuEnablePerByteNavigation.Checked = config.RamEnablePerByteNavigation;
            UpdateRefreshSpeedMenu();

            this.mnuIgnoreRedundantWrites.Checked = config.RamIgnoreRedundantWrites;
            this.UpdateFlags();

            this.mnuHighlightCurrentRowColumn.Checked    = config.RamHighlightCurrentRowColumn;
            this.ctrlHexViewer.HighlightCurrentRowColumn = config.RamHighlightCurrentRowColumn;

            this.mnuShowCharacters.Checked           = config.RamShowCharacters;
            this.mnuShowLabelInfoOnMouseOver.Checked = config.RamShowLabelInfo;

            this.ctrlHexViewer.TextZoom = config.RamTextZoom;
            this.ctrlHexViewer.BaseFont = new Font(config.RamFontFamily, config.RamFontSize, config.RamFontStyle);

            this.mnuHighlightExecution.Checked = config.RamHighlightExecution;
            this.mnuHightlightReads.Checked    = config.RamHighlightReads;
            this.mnuHighlightWrites.Checked    = config.RamHighlightWrites;
            this.mnuHideUnusedBytes.Checked    = config.RamHideUnusedBytes;
            this.mnuHideReadBytes.Checked      = config.RamHideReadBytes;
            this.mnuHideWrittenBytes.Checked   = config.RamHideWrittenBytes;
            this.mnuHideExecutedBytes.Checked  = config.RamHideExecutedBytes;

            this.mnuHighlightLabelledBytes.Checked = config.RamHighlightLabelledBytes;
            this.mnuHighlightBreakpoints.Checked   = config.RamHighlightBreakpoints;
            this.mnuHighlightChrDrawnBytes.Checked = config.RamHighlightChrDrawnBytes;
            this.mnuHighlightChrReadBytes.Checked  = config.RamHighlightChrReadBytes;
            this.mnuHighlightCodeBytes.Checked     = config.RamHighlightCodeBytes;
            this.mnuHighlightDataBytes.Checked     = config.RamHighlightDataBytes;
            this.mnuHighlightDmcDataBytes.Checked  = config.RamHighlightDmcDataBytes;

            this.UpdateFadeOptions();

            this.InitTblMappings();

            this.ctrlHexViewer.StringViewVisible = mnuShowCharacters.Checked;
            this.ctrlHexViewer.MemoryViewer      = this;

            UpdateImportButton();
            InitMemoryTypeDropdown(true);

            _notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
            _notifListener.OnNotification += _notifListener_OnNotification;

            this.mnuShowCharacters.CheckedChanged        += this.mnuShowCharacters_CheckedChanged;
            this.mnuIgnoreRedundantWrites.CheckedChanged += mnuIgnoreRedundantWrites_CheckedChanged;

            RestoreLocation(ConfigManager.Config.DebugInfo.MemoryViewerLocation, ConfigManager.Config.DebugInfo.MemoryViewerSize);

            this.InitShortcuts();
        }
Esempio n. 24
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!this.DesignMode)
            {
                _binder.Entity = _config;

                mnuRefreshOnBreak.Checked = _config.EventViewerRefreshOnBreak;

                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuWrite2000), chkWrite2000);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuWrite2001), chkWrite2001);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuWrite2003), chkWrite2003);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuWrite2004), chkWrite2004);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuWrite2005), chkWrite2005);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuWrite2006), chkWrite2006);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuWrite2007), chkWrite2007);

                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuRead2002), chkRead2002);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuRead2004), chkRead2004);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPpuRead2007), chkRead2007);

                _binder.AddBinding(nameof(DebugInfo.EventViewerShowIrq), chkShowIrq);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowNmi), chkShowNmi);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowSpriteZeroHit), chkShowSpriteZero);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowMapperRegisterWrites), chkShowMapperRegisterWrites);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowMapperRegisterReads), chkShowMapperRegisterReads);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowDmcDmaReads), chkShowDmcDmaRead);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowMarkedBreakpoints), chkBreakpoints);

                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterWrite2000Color), picWrite2000);
                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterWrite2001Color), picWrite2001);
                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterWrite2003Color), picWrite2003);
                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterWrite2004Color), picWrite2004);
                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterWrite2005Color), picWrite2005);
                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterWrite2006Color), picWrite2006);
                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterWrite2007Color), picWrite2007);

                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterRead2002Color), picRead2002);
                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterRead2004Color), picRead2004);
                _binder.AddBinding(nameof(DebugInfo.EventViewerPpuRegisterRead2007Color), picRead2007);

                _binder.AddBinding(nameof(DebugInfo.EventViewerMapperRegisterWriteColor), picMapperWrite);
                _binder.AddBinding(nameof(DebugInfo.EventViewerMapperRegisterReadColor), picMapperRead);
                _binder.AddBinding(nameof(DebugInfo.EventViewerNmiColor), picNmi);
                _binder.AddBinding(nameof(DebugInfo.EventViewerIrqColor), picIrq);
                _binder.AddBinding(nameof(DebugInfo.EventViewerSpriteZeroHitColor), picSpriteZeroHit);
                _binder.AddBinding(nameof(DebugInfo.EventViewerBreakpointColor), picBreakpoint);
                _binder.AddBinding(nameof(DebugInfo.EventViewerDmcDmaReadColor), picDmcDmaRead);

                _binder.AddBinding(nameof(DebugInfo.EventViewerShowPreviousFrameEvents), chkShowPreviousFrameEvents);
                _binder.AddBinding(nameof(DebugInfo.EventViewerShowNtscBorders), chkShowNtscBorders);

                DebugWorkspaceManager.GetWorkspace();

                RestoreLocation(_config.EventViewerLocation, _config.EventViewerSize);

                mnuAutoRefresh.Checked               = _config.EventViewerAutoRefresh;
                mnuAutoRefreshLow.Click             += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.Low;
                mnuAutoRefreshNormal.Click          += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.Normal;
                mnuAutoRefreshHigh.Click            += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.High;
                mnuAutoRefreshSpeed.DropDownOpening += (s, evt) => UpdateRefreshSpeedMenu();

                this.RefreshData();
                _binder.UpdateUI();
                this.RefreshViewer();

                _refreshManager                  = new WindowRefreshManager(this);
                _refreshManager.AutoRefresh      = _config.EventViewerAutoRefresh;
                _refreshManager.AutoRefreshSpeed = _config.EventViewerAutoRefreshSpeed;

                this._notifListener = new InteropEmu.NotificationListener(_config.DebugConsoleId);
                this._notifListener.OnNotification += this._notifListener_OnNotification;

                InitShortcuts();
            }
        }
Esempio n. 25
0
        public frmScript(bool forceBlank = false)
        {
            InitializeComponent();

            List <string> builtInScripts = new List <string> {
                "DmcCapture.lua", "DrawMode.lua", "GameBoyMode.lua", "Grid.lua", "ReverseMode.lua", "SpriteBox.lua"
            };

            foreach (string script in builtInScripts)
            {
                ToolStripItem item = mnuBuiltInScripts.DropDownItems.Add(script);
                item.Click += (s, e) => {
                    LoadBuiltInScript(item.Text);
                };
            }

            tsToolbar.AddItemsToToolbar(
                mnuOpen, mnuSave, null,
                mnuRun, mnuStop, null,
                mnuBuiltInScripts
                );

            DebugInfo config = ConfigManager.Config.DebugInfo;

            _popupMenu           = new AutocompleteMenu(txtScriptContent, this);
            _popupMenu.ImageList = new ImageList();
            _popupMenu.ImageList.Images.Add(Resources.Enum);
            _popupMenu.ImageList.Images.Add(Resources.Function);
            _popupMenu.SelectedColor = Color.LightBlue;
            _popupMenu.SearchPattern = @"[\w\.]";

            List <AutocompleteItem> items = new List <AutocompleteItem>();

            _availableFunctions.Sort((a, b) => {
                int type = a[0].CompareTo(b[0]);
                if (type == 0)
                {
                    return(a[1].CompareTo(b[1]));
                }
                else
                {
                    return(-type);
                }
            });

            foreach (List <string> item in _availableFunctions)
            {
                MethodAutocompleteItem autocompleteItem = new MethodAutocompleteItem(item[1]);
                autocompleteItem.ImageIndex   = item[0] == "func" ? 1 : 0;
                autocompleteItem.ToolTipTitle = item[2];
                if (!string.IsNullOrWhiteSpace(item[3]))
                {
                    autocompleteItem.ToolTipText = "Parameters" + Environment.NewLine + item[3] + Environment.NewLine + Environment.NewLine;
                }
                if (!string.IsNullOrWhiteSpace(item[4]))
                {
                    autocompleteItem.ToolTipText += "Return Value" + Environment.NewLine + item[4] + Environment.NewLine + Environment.NewLine;
                }
                if (!string.IsNullOrWhiteSpace(item[5]))
                {
                    autocompleteItem.ToolTipText += "Description" + Environment.NewLine + item[5] + Environment.NewLine + Environment.NewLine;
                }
                items.Add(autocompleteItem);
            }

            _popupMenu.Items.SetAutocompleteItems(items);

            UpdateRecentScripts();

            mnuTutorialScript.Checked     = config.ScriptStartupBehavior == ScriptStartupBehavior.ShowTutorial;
            mnuBlankWindow.Checked        = config.ScriptStartupBehavior == ScriptStartupBehavior.ShowBlankWindow;
            mnuAutoLoadLastScript.Checked = config.ScriptStartupBehavior == ScriptStartupBehavior.LoadLastScript;

            if (!forceBlank)
            {
                if (mnuAutoLoadLastScript.Checked && mnuRecentScripts.DropDownItems.Count > 0)
                {
                    string scriptToLoad = config.RecentScripts.Where((s) => File.Exists(s)).FirstOrDefault();
                    if (scriptToLoad != null)
                    {
                        LoadScriptFile(scriptToLoad, false);
                    }
                }
                else if (mnuTutorialScript.Checked)
                {
                    LoadBuiltInScript("Example.lua");
                }
            }

            if (!config.ScriptWindowSize.IsEmpty)
            {
                this.Size = config.ScriptWindowSize;
            }
            mnuSaveBeforeRun.Checked = config.SaveScriptBeforeRun;

            if (config.ScriptCodeWindowHeight >= ctrlSplit.Panel1MinSize)
            {
                if (config.ScriptCodeWindowHeight == Int32.MaxValue)
                {
                    ctrlSplit.CollapsePanel();
                }
                else
                {
                    ctrlSplit.SplitterDistance = config.ScriptCodeWindowHeight;
                }
            }

            txtScriptContent.Font = new Font(config.ScriptFontFamily, config.ScriptFontSize, config.ScriptFontStyle);
            txtScriptContent.Zoom = config.ScriptZoom;

            if (!this.DesignMode)
            {
                this._notifListener = new InteropEmu.NotificationListener();
                this._notifListener.OnNotification += this._notifListener_OnNotification;

                this.InitShortcuts();
            }
        }