Exemplo n.º 1
0
        public Config()
        {
            _saveFile = ConfigurationManager.AppSettings["save"] ?? "save.json";

            InitializeComponent();

            WatchManager.Init();

            Settings = AppSettings.Load(_saveFile);

            locations.DataSource    = Settings.Locations;
            locations.DisplayMember = "FriendlyName";

            LogList.DataSource = WatchManager.Logs;

            variables.DataSource    = Settings.Variables;
            variables.DisplayMember = "Name";

            friendlyName.DataBindings.Add("Text", locations.DataSource, "FriendlyName", true, DataSourceUpdateMode.OnPropertyChanged);
            watchFolder.DataBindings.Add("Text", locations.DataSource, "WatchFolder", true, DataSourceUpdateMode.OnPropertyChanged);
            watchSubdirectories.DataBindings.Add("Checked", locations.DataSource, "WatchSubdirectories", true, DataSourceUpdateMode.OnPropertyChanged);
            copyToFolder.DataBindings.Add("Text", locations.DataSource, "CopyToFolder", true, DataSourceUpdateMode.OnPropertyChanged);
            pattern.DataBindings.Add("Text", locations.DataSource, "Pattern", true, DataSourceUpdateMode.OnPropertyChanged);
            selfGeneratedId.DataBindings.Add("Text", locations.DataSource, "Id", true, DataSourceUpdateMode.OnPropertyChanged);

            variableName.DataBindings.Add("Text", variables.DataSource, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
            variableValue.DataBindings.Add("Text", variables.DataSource, "Value", true, DataSourceUpdateMode.OnPropertyChanged);

            Resize += Config_Resize;
            notifyIcon.MouseClick += notifyIcon_MouseClick;
        }
Exemplo n.º 2
0
        public static DebugWorkspace GetWorkspace()
        {
            string romName = EmuApi.GetRomInfo().GetRomName();

            if (_workspace == null || _romName != romName)
            {
                if (_workspace != null)
                {
                    SaveWorkspace();
                }
                _romName   = romName;
                _workspace = DebugWorkspace.GetWorkspace();

                //Load watch entries
                WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries = _workspace.WatchValues;
                WatchManager.GetWatchManager(CpuType.Spc).WatchEntries = _workspace.SpcWatchValues;
                WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries = _workspace.Sa1WatchValues;
                WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries = _workspace.GsuWatchValues;

                LabelManager.ResetLabels();
                LabelManager.SetLabels(_workspace.CpuLabels);
                LabelManager.SetLabels(_workspace.SpcLabels);
                LabelManager.SetDefaultLabels();

                ImportDbgFile();
                LabelManager.RefreshLabels();

                //Load breakpoints
                BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
            }
            return(_workspace);
        }
Exemplo n.º 3
0
 private void mnuAddToWatch_Click(object sender, EventArgs e)
 {
     if (lstLabels.SelectedIndices.Count > 0)
     {
         WatchManager.GetWatchManager(_cpuType).AddWatch("[" + GetSelectedLabel().Label + "]");
     }
 }
Exemplo n.º 4
0
 public static void ResetWorkspace()
 {
     if (_workspace != null)
     {
         _workspace.Breakpoints       = new List <Breakpoint>();
         _workspace.WatchValues       = new List <string>();
         _workspace.SpcWatchValues    = new List <string>();
         _workspace.Sa1WatchValues    = new List <string>();
         _workspace.GsuWatchValues    = new List <string>();
         _workspace.NecDspWatchValues = new List <string>();
         _workspace.GbWatchValues     = new List <string>();
         _workspace.CpuLabels         = new List <CodeLabel>();
         _workspace.SpcLabels         = new List <CodeLabel>();
         _workspace.NecDspLabels      = new List <CodeLabel>();
         _workspace.GbLabels          = new List <CodeLabel>();
         WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries     = _workspace.WatchValues;
         WatchManager.GetWatchManager(CpuType.Spc).WatchEntries     = _workspace.SpcWatchValues;
         WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries     = _workspace.Sa1WatchValues;
         WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries     = _workspace.GsuWatchValues;
         WatchManager.GetWatchManager(CpuType.NecDsp).WatchEntries  = _workspace.NecDspWatchValues;
         WatchManager.GetWatchManager(CpuType.Gameboy).WatchEntries = _workspace.GbWatchValues;
         BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
         LabelManager.SetDefaultLabels();
         LabelManager.RefreshLabels();
         _workspace.Save();
         Clear();
     }
 }
Exemplo n.º 5
0
        private static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            try
            {
                var culture = new CultureInfo(ConfigurationManager.AppSettings["Culture"]);

                CultureInfo.DefaultThreadCurrentCulture   = culture;
                CultureInfo.DefaultThreadCurrentUICulture = culture;
            }
            catch
            {
                // Ignored
            }


            var config = WatchManagerConfig.GetConfiguration();
            var logger = new ConsoleLogger();

            IWatchManager watchManager = new WatchManager(config, logger);

            watchManager.EnableWatching();

            while (true)
            {
                Console.ReadKey();
            }
        }
Exemplo n.º 6
0
 private void mnuAddToWatch_Click(object sender, EventArgs e)
 {
     if (_memoryType.SupportsWatch())
     {
         string[] toAdd = Enumerable.Range(SelectionStartAddress, SelectionEndAddress - SelectionStartAddress + 1).Select((num) => $"[${num.ToString("X6")}]").ToArray();
         WatchManager.GetWatchManager(_memoryType.ToCpuType()).AddWatch(toAdd);
     }
 }
Exemplo n.º 7
0
 private void mnuAddToWatch_Click(object sender, EventArgs e)
 {
     if (lstLabels.SelectedIndices.Count > 0)
     {
         CodeLabel label = (CodeLabel)GetSelectedItem().SubItems[1].Tag;
         WatchManager.AddWatch("[" + label.Label + "]");
     }
 }
Exemplo n.º 8
0
 public static void SaveWorkspace()
 {
     if (_workspace != null)
     {
         _workspace.WatchValues    = new List <string>(WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries);
         _workspace.SpcWatchValues = new List <string>(WatchManager.GetWatchManager(CpuType.Spc).WatchEntries);
         _workspace.Breakpoints    = new List <Breakpoint>(BreakpointManager.Breakpoints);
         _workspace.Save();
     }
 }
Exemplo n.º 9
0
 public static void SaveWorkspace()
 {
     if (_workspace != null)
     {
         _workspace.WatchValues    = new List <string>(WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries);
         _workspace.SpcWatchValues = new List <string>(WatchManager.GetWatchManager(CpuType.Spc).WatchEntries);
         _workspace.Sa1WatchValues = new List <string>(WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries);
         _workspace.GsuWatchValues = new List <string>(WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries);
         _workspace.Breakpoints    = new List <Breakpoint>(BreakpointManager.Breakpoints);
         _workspace.CpuLabels      = new List <CodeLabel>(LabelManager.GetLabels(CpuType.Cpu));
         _workspace.SpcLabels      = new List <CodeLabel>(LabelManager.GetLabels(CpuType.Spc));
         _workspace.Save();
     }
 }
Exemplo n.º 10
0
 public static void ResetWorkspace()
 {
     if (_workspace != null)
     {
         _workspace.Breakpoints    = new List <Breakpoint>();
         _workspace.WatchValues    = new List <string>();
         _workspace.SpcWatchValues = new List <string>();
         WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries = _workspace.WatchValues;
         WatchManager.GetWatchManager(CpuType.Spc).WatchEntries = _workspace.SpcWatchValues;
         BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
         _workspace.Save();
         Clear();
     }
 }
Exemplo n.º 11
0
        private void metroToggle1_CheckedChanged(object sender, System.EventArgs e)
        {
            var checkedState = (sender as MetroToggle).CheckState;

            if (checkedState == CheckState.Checked)
            {
                watchStatus.Text = "(Running)";
                WatchManager.Start(Settings.Locations, Settings.Variables);
            }
            else
            {
                watchStatus.Text = "(Not Running)";
                WatchManager.Stop();
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Initializes important variables
        /// </summary>
        private void InitBasics()
        {
            String dataPath = Path.Combine(PathHelper.DataDir, "FlashDebugger");

            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }
            this.settingFilename = Path.Combine(dataPath, "Settings.fdb");
            this.pluginImage     = PluginBase.MainForm.FindImage("54|23|5|4");
            breakPointManager    = new BreakPointManager();
            watchManager         = new WatchManager();
            debugManager         = new DebuggerManager();
            liveDataTip          = new LiveDataTip();
        }
Exemplo n.º 13
0
        public WatchUI(WatchManager watchManager)
        {
            this.AutoKeyHandling = true;
            this.treeControl     = new DataTreeControl(true);
            this.treeControl.Tree.BorderStyle = BorderStyle.None;
            this.treeControl.Resize          += new EventHandler(this.TreeControlResize);
            this.treeControl.Tree.Font        = PluginBase.Settings.DefaultFont;
            this.treeControl.Dock             = DockStyle.Fill;
            this.AutoScaleDimensions          = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.treeControl);

            this.watchManager = watchManager;
            this.watchManager.ExpressionAdded    += WatchManager_ExpressionAdded;
            this.watchManager.ExpressionRemoved  += WatchManager_ExpressionRemoved;
            this.watchManager.ExpressionReplaced += WatchManager_ExpressionReplaced;
            this.watchManager.ExpressionsCleared += WatchManager_ExpressionsCleared;
            this.watchManager.ExpressionsLoaded  += WatchManager_ExpressionsLoaded;
        }
Exemplo n.º 14
0
        private void mnuAddToWatch_Click(object sender, EventArgs e)
        {
            LocationInfo location = GetActionTarget();

            if (location.Symbol != null)
            {
                WatchManager.GetWatchManager(_manager.CpuType).AddWatch("[" + location.Symbol.Name + "]");
            }
            else if (location.Label != null)
            {
                string label = location.Label.Label;
                if (location.ArrayIndex.HasValue)
                {
                    label += "+" + location.ArrayIndex.Value.ToString();
                }
                WatchManager.GetWatchManager(_manager.CpuType).AddWatch("[" + label + "]");
            }
            else if (location.Address >= 0)
            {
                WatchManager.GetWatchManager(_manager.CpuType).AddWatch("[$" + location.Address.ToString("X" + _manager.AddressSize.ToString()) + "]");
            }
        }
Exemplo n.º 15
0
        public static DebugWorkspace GetWorkspace()
        {
            string romName = EmuApi.GetRomInfo().GetRomName();

            if (_workspace == null || _romName != romName)
            {
                if (_workspace != null)
                {
                    SaveWorkspace();
                }
                _romName   = romName;
                _workspace = DebugWorkspace.GetWorkspace();

                //Load watch entries
                WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries = _workspace.WatchValues;
                WatchManager.GetWatchManager(CpuType.Spc).WatchEntries = _workspace.SpcWatchValues;

                //Load breakpoints
                BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
            }
            return(_workspace);
        }
Exemplo n.º 16
0
        public static DebugWorkspace GetWorkspace()
        {
            string romName = EmuApi.GetRomInfo().GetRomName();

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

            if (_workspace == null || _romName != romName)
            {
                _romName   = romName;
                _workspace = DebugWorkspace.GetWorkspace();

                //Load watch entries
                WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries     = _workspace.WatchValues;
                WatchManager.GetWatchManager(CpuType.Spc).WatchEntries     = _workspace.SpcWatchValues;
                WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries     = _workspace.Sa1WatchValues;
                WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries     = _workspace.GsuWatchValues;
                WatchManager.GetWatchManager(CpuType.NecDsp).WatchEntries  = _workspace.NecDspWatchValues;
                WatchManager.GetWatchManager(CpuType.Gameboy).WatchEntries = _workspace.GbWatchValues;

                LabelManager.ResetLabels();
                LabelManager.SetLabels(_workspace.CpuLabels);
                LabelManager.SetLabels(_workspace.SpcLabels);
                LabelManager.SetLabels(_workspace.NecDspLabels);
                LabelManager.SetLabels(_workspace.GbLabels);
                LabelManager.SetDefaultLabels();

                AutoImportSymbols();
            }

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

            return(_workspace);
        }
Exemplo n.º 17
0
 private void AddWatch()
 {
     WatchManager.AddWatch(_newWatchValue);
 }
Exemplo n.º 18
0
 private void mnuAddToWatch_Click(object sender, EventArgs e)
 {
     string[] toAdd = Enumerable.Range(SelectionStartAddress, SelectionEndAddress - SelectionStartAddress + 1).Select((num) => $"[${num.ToString("X4")}]").ToArray();
     WatchManager.AddWatch(toAdd);
 }