Example #1
0
        public void UpdateLabelList()
        {
            List <CodeLabel>    labels = LabelManager.GetLabels();
            List <ListViewItem> items  = new List <ListViewItem>(labels.Count);

            foreach (CodeLabel label in labels)
            {
                if (label.Label.Length > 0 || ConfigManager.Config.DebugInfo.ShowCommentsInLabelList)
                {
                    ListViewItem item = new ListViewItem(label.Label);

                    Int32 relativeAddress = label.GetRelativeAddress();
                    if (relativeAddress >= 0)
                    {
                        item.SubItems.Add("$" + relativeAddress.ToString("X4"));
                    }
                    else
                    {
                        item.SubItems.Add("[n/a]");
                        item.ForeColor = Color.Gray;
                        item.Font      = new Font(item.Font, FontStyle.Italic);
                    }
                    string absAddress = string.Empty;
                    switch (label.AddressType)
                    {
                    case AddressType.InternalRam: absAddress += "RAM: "; break;

                    case AddressType.PrgRom: absAddress += "PRG: "; break;

                    case AddressType.Register: absAddress += "REG: "; break;

                    case AddressType.SaveRam: absAddress += "SRAM: "; break;

                    case AddressType.WorkRam: absAddress += "WRAM: "; break;
                    }
                    absAddress += "$" + label.Address.ToString("X4");
                    item.SubItems.Add(absAddress);
                    item.SubItems.Add(ConfigManager.Config.DebugInfo.ShowCommentsInLabelList ? label.Comment : "");
                    item.SubItems[1].Tag = label;

                    item.Tag = relativeAddress;
                    items.Add(item);
                }
            }

            lstLabels.BeginUpdate();
            lstLabels.Items.Clear();
            lstLabels.Items.AddRange(items.ToArray());
            lstLabels.Sort();

            colComment.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            if (!ConfigManager.Config.DebugInfo.ShowCommentsInLabelList)
            {
                colComment.Width = 0;
            }

            lstLabels.EndUpdate();

            _listItems = items;
        }
Example #2
0
        public void UpdateLabelList()
        {
            List <CodeLabel>    labels = LabelManager.GetLabels(_cpuType);
            List <ListViewItem> items  = new List <ListViewItem>(labels.Count);

            foreach (CodeLabel label in labels)
            {
                if ((label.Label.Length > 0 || ConfigManager.Config.Debug.Debugger.ShowCommentsInLabelList))
                {
                    ListViewItem item = new ListViewItem(label.Label);

                    string prefix = string.Empty;
                    switch (label.MemoryType)
                    {
                    case SnesMemoryType.PrgRom: prefix = "PRG: $"; break;

                    case SnesMemoryType.Register: prefix = "REG: $"; break;

                    case SnesMemoryType.SaveRam: prefix = "SRAM: $"; break;

                    case SnesMemoryType.WorkRam: prefix = "WRAM: $"; break;

                    case SnesMemoryType.SpcRam: prefix = "RAM: $"; break;

                    case SnesMemoryType.SpcRom: prefix = "ROM: $"; break;

                    case SnesMemoryType.Sa1InternalRam: prefix = "IRAM: $"; break;

                    default: throw new Exception("Unsupported type");
                    }
                    int relAddress = label.GetRelativeAddress().Address;
                    item.SubItems.Add(relAddress >= 0 ? "$" + relAddress.ToString("X4") : "-");
                    item.SubItems.Add(prefix + label.Address.ToString("X4"));
                    item.SubItems.Add(ConfigManager.Config.Debug.Debugger.ShowCommentsInLabelList ? label.Comment : "");
                    item.Tag = label;

                    items.Add(item);
                }
            }

            _listItems = items;
            SortItems();

            lstLabels.BeginUpdate();
            lstLabels.VirtualMode     = true;
            lstLabels.VirtualListSize = items.Count;
            lstLabels.EndUpdate();

            colComment.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            if (!ConfigManager.Config.Debug.Debugger.ShowCommentsInLabelList)
            {
                colComment.Width = 0;
            }
        }
Example #3
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.CpuLabels      = new List <CodeLabel>(LabelManager.GetLabels(CpuType.Cpu));
         _workspace.SpcLabels      = new List <CodeLabel>(LabelManager.GetLabels(CpuType.Spc));
         _workspace.Save();
     }
 }
Example #4
0
        public void UpdateLabelList()
        {
            List <CodeLabel>    labels = LabelManager.GetLabels();
            List <ListViewItem> items  = new List <ListViewItem>(labels.Count);
            Font italicFont            = null;

            foreach (CodeLabel label in labels)
            {
                if ((label.Label.Length > 0 || ConfigManager.Config.DebugInfo.ShowCommentsInLabelList) && (!label.Flags.HasFlag(CodeLabelFlags.AutoJumpLabel) || ConfigManager.Config.DebugInfo.ShowJumpLabels))
                {
                    ListViewItem item = new ListViewItem(label.Label);

                    Int32 relativeAddress = label.GetRelativeAddress();
                    if (relativeAddress >= 0)
                    {
                        item.SubItems.Add("$" + relativeAddress.ToString("X4"));
                    }
                    else
                    {
                        item.SubItems.Add("[n/a]");
                        item.ForeColor = ThemeHelper.Theme.LabelDisabledForeColor;
                        if (italicFont == null)
                        {
                            italicFont = new Font(item.Font, FontStyle.Italic);
                        }
                        item.Font = italicFont;
                    }
                    string prefix = string.Empty;
                    switch (label.AddressType)
                    {
                    case AddressType.InternalRam: prefix = "RAM: $"; break;

                    case AddressType.PrgRom: prefix = "PRG: $"; break;

                    case AddressType.Register: prefix = "REG: $"; break;

                    case AddressType.SaveRam: prefix = "SRAM: $"; break;

                    case AddressType.WorkRam: prefix = "WRAM: $"; break;
                    }
                    item.SubItems.Add(prefix + label.Address.ToString("X4"));
                    item.SubItems.Add(ConfigManager.Config.DebugInfo.ShowCommentsInLabelList ? label.Comment : "");
                    item.SubItems[1].Tag = label;

                    item.Tag = relativeAddress;
                    items.Add(item);
                }
            }

            _listItems = items;
            SortItems();

            lstLabels.BeginUpdate();
            lstLabels.VirtualMode     = true;
            lstLabels.VirtualListSize = items.Count;
            lstLabels.EndUpdate();

            colComment.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            if (!ConfigManager.Config.DebugInfo.ShowCommentsInLabelList)
            {
                colComment.Width = 0;
            }
        }