Beispiel #1
0
        public frmGoToAll(bool allowOutOfScope, bool showFilesAndConstants)
        {
            InitializeComponent();

            _symbolProvider        = DebugWorkspaceManager.SymbolProvider;
            _allowOutOfScope       = allowOutOfScope;
            _showFilesAndConstants = showFilesAndConstants;

            tlpResults.SuspendLayout();
            for (int i = 0; i < MaxResultCount; i++)
            {
                ctrlSearchResult searchResult = new ctrlSearchResult();
                searchResult.Dock         = DockStyle.Top;
                searchResult.BackColor    = i % 2 == 0 ? SystemColors.ControlLight : SystemColors.ControlLightLight;
                searchResult.Visible      = false;
                searchResult.Click       += SearchResult_Click;
                searchResult.DoubleClick += SearchResult_DoubleClick;
                tlpResults.Controls.Add(searchResult, 0, i);
                tlpResults.RowStyles.Add(new RowStyle(SizeType.AutoSize));

                _results.Add(searchResult);
            }
            tlpResults.ResumeLayout();

            UpdateResults();
        }
Beispiel #2
0
 public static void Clear()
 {
     lock (_lock) {
         _workspace     = null;
         _romName       = null;
         SymbolProvider = null;
     }
 }
 public frmCodePreviewTooltip(int lineIndex, string code = null, Ld65DbgImporter symbolProvider = null, Ld65DbgImporter.FileInfo selectedFile = null)
 {
     _code           = code;
     _symbolProvider = symbolProvider;
     _lineIndex      = lineIndex;
     _selectedFile   = selectedFile;
     InitializeComponent();
 }
Beispiel #4
0
 public frmCodeTooltip(Dictionary <string, string> values, AddressTypeInfo?previewAddress = null, string code = null, Ld65DbgImporter symbolProvider = null)
 {
     _values         = values;
     _previewAddress = previewAddress;
     _code           = code;
     _symbolProvider = symbolProvider;
     InitializeComponent();
 }
Beispiel #5
0
 public frmCodeTooltip(Form parent, Dictionary <string, string> values, AddressTypeInfo previewAddress = null, CodeInfo code = null, Ld65DbgImporter symbolProvider = null)
 {
     _parentForm     = parent;
     _values         = values;
     _previewAddress = previewAddress;
     _code           = code;
     _symbolProvider = symbolProvider;
     InitializeComponent();
     this.TopLevel = false;
     this.Parent   = _parentForm;
     _parentForm.Controls.Add(this);
 }
Beispiel #6
0
        public frmCodePreviewTooltip(Form parent, int lineIndex, string code = null, Ld65DbgImporter symbolProvider = null, Ld65DbgImporter.FileInfo selectedFile = null)
        {
            _parentForm     = parent;
            _code           = code;
            _symbolProvider = symbolProvider;
            _lineIndex      = lineIndex;
            _selectedFile   = selectedFile;
            InitializeComponent();

            this.TopLevel = false;
            this.Parent   = _parentForm;
            _parentForm.Controls.Add(this);
        }
Beispiel #7
0
        public static void ImportDbgFile(string dbgPath, bool silent)
        {
            if (ConfigManager.Config.DebugInfo.ImportConfig.ResetLabelsOnImport)
            {
                ResetLabels();
            }

            Ld65DbgImporter dbgImporter = new Ld65DbgImporter();

            dbgImporter.Import(dbgPath, silent);

            DebugWorkspaceManager.SymbolProvider = dbgImporter;
        }
Beispiel #8
0
        public static void AutoLoadDbgFiles(bool silent)
        {
            Ld65DbgImporter oldSymbolProvider = SymbolProvider;

            if (ConfigManager.Config.DebugInfo.AutoLoadDbgFiles)
            {
                RomInfo info    = InteropEmu.GetRomInfo();
                string  dbgPath = Path.Combine(info.RomFile.Folder, info.GetRomName() + ".dbg");
                if (File.Exists(dbgPath))
                {
                    DateTime lastDbgUpdate = File.GetLastWriteTime(dbgPath);
                    if (lastDbgUpdate != oldSymbolProvider?.DbgFileStamp)
                    {
                        ImportDbgFile(dbgPath, silent);
                    }
                    else
                    {
                        //Currently loaded symbol provider is still valid
                        return;
                    }
                }
                else
                {
                    string mlbPath = Path.Combine(info.RomFile.Folder, info.GetRomName() + ".mlb");
                    if (File.Exists(mlbPath))
                    {
                        ImportMlbFile(mlbPath, silent);
                    }
                    else
                    {
                        string fnsPath = Path.Combine(info.RomFile.Folder, info.GetRomName() + ".fns");
                        if (File.Exists(fnsPath))
                        {
                            ImportNesasmFnsFile(fnsPath, silent);
                        }
                    }
                }
            }

            if (oldSymbolProvider == SymbolProvider)
            {
                SymbolProvider = null;
            }
        }
Beispiel #9
0
        private void mnuImportLabels_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.SetFilter("All supported files (*.dbg, *.mlb)|*.dbg;*.mlb");
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string ext = Path.GetExtension(ofd.FileName).ToLower();
                if (ext == ".mlb")
                {
                    MesenLabelFile.Import(ofd.FileName);
                }
                else
                {
                    Ld65DbgImporter dbgImporter = new Ld65DbgImporter();
                    dbgImporter.Import(ofd.FileName);
                }
            }
        }
Beispiel #10
0
        public static DebugWorkspace GetWorkspace()
        {
            string romName = InteropEmu.GetRomInfo().GetRomName();

            if (_workspace == null || _romName != romName)
            {
                SymbolProvider = null;
                lock (_lock) {
                    if (_workspace == null || _romName != romName)
                    {
                        if (_workspace != null)
                        {
                            SaveWorkspace();
                        }
                        _romName   = InteropEmu.GetRomInfo().GetRomName();
                        _workspace = DebugWorkspace.GetWorkspace();

                        //Setup labels
                        if (_workspace.Labels.Count == 0)
                        {
                            LabelManager.ResetLabels();
                            if (!ConfigManager.Config.DebugInfo.DisableDefaultLabels)
                            {
                                LabelManager.SetDefaultLabels(InteropEmu.GetRomInfo().MapperId);
                            }
                        }
                        else
                        {
                            LabelManager.ResetLabels();
                            LabelManager.SetLabels(_workspace.Labels, true);
                        }

                        //Load watch entries
                        WatchManager.WatchEntries = _workspace.WatchValues;

                        //Load breakpoints
                        BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
                    }
                }
            }
            return(_workspace);
        }
Beispiel #11
0
 private void AutoLoadDbgFiles(bool silent)
 {
     if (ConfigManager.Config.DebugInfo.AutoLoadDbgFiles)
     {
         RomInfo info    = InteropEmu.GetRomInfo();
         string  dbgPath = Path.Combine(info.RomFile.Folder, info.GetRomName() + ".dbg");
         if (File.Exists(dbgPath))
         {
             Ld65DbgImporter dbgImporter = new Ld65DbgImporter();
             dbgImporter.Import(dbgPath, silent);
         }
         else
         {
             string mlbPath = Path.Combine(info.RomFile.Folder, info.GetRomName() + ".mlb");
             if (File.Exists(mlbPath))
             {
                 MesenLabelFile.Import(mlbPath, silent);
             }
         }
     }
 }
Beispiel #12
0
        public static DebugWorkspace GetWorkspace()
        {
            string romName = InteropEmu.GetRomInfo().GetRomName();

            if (_workspace != null)
            {
                SaveWorkspace();
            }

            if (_workspace == null || _romName != romName)
            {
                SymbolProvider = null;
                lock (_lock) {
                    if (_workspace == null || _romName != romName)
                    {
                        _romName   = InteropEmu.GetRomInfo().GetRomName();
                        _workspace = DebugWorkspace.GetWorkspace();

                        //Load watch entries
                        WatchManager.WatchEntries = _workspace.WatchValues;

                        //Setup labels
                        if (_workspace.Labels.Count == 0 && !ConfigManager.Config.DebugInfo.DisableDefaultLabels)
                        {
                            LabelManager.SetDefaultLabels(InteropEmu.GetRomInfo().MapperId);
                        }
                    }
                }
            }

            //Send breakpoints & labels to emulation core (even if the same game is running)
            BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
            LabelManager.RefreshLabels();

            return(_workspace);
        }
Beispiel #13
0
 private void UpdateSymbolProvider(Ld65DbgImporter symbolProvider)
 {
     this.SymbolProvider = symbolProvider;
 }