Example #1
0
        public void Open()
        {
            RELMethodNode     r       = _resource as RELMethodNode;
            ModuleSectionNode section = r.Root.Children[(int)r.TargetSection] as ModuleSectionNode;

            foreach (SectionEditor l in SectionEditor._openedSections)
            {
                if (l._section == section)
                {
                    if (l.Position != r.RootOffset - section.RootOffset)
                    {
                        l.Position = r.RootOffset - section.RootOffset;
                    }

                    l.Focus();
                    return;
                }
            }

            SectionEditor x = new SectionEditor(section);

            x.Show();
            x.Text = String.Format("Module Section Editor - {0}->{1}", r.Object._name, r._name);

            x.Position = r.RootOffset - section.RootOffset;
            x.hexBox1.Focus();
        }
        public void OpenRelocation(RelocationTarget target)
        {
            if (target == null)
            {
                return;
            }

            if (target._sectionID != _section.Index)
            {
                foreach (SectionEditor r in _openedSections)
                {
                    if (r._section.Index == target._sectionID)
                    {
                        r.Position = target._index * 4;
                        r.Focus();
                        r.hexBox1.Focus();
                        return;
                    }
                }

                //TODO: use target module id here
                ModuleSectionNode section = ((ModuleNode)_section.Root).Sections[target._sectionID];
                SectionEditor     x       = new SectionEditor(section);
                x.Show();

                x.Position = target._index * 4;
                x.hexBox1.Focus();
            }
            else
            {
                Position = target._index * 4;
                hexBox1.Focus();
            }
        }
        public SectionEditor(ModuleSectionNode section)
        {
            _startIndex = int.MaxValue;
            _endIndex   = int.MinValue;

            InitializeComponent();

            ppcDisassembler1._editor = this;
            ppcDisassembler1.ppcOpCodeEditControl1._canFollowBranch  = true;
            ppcDisassembler1.ppcOpCodeEditControl1.OnBranchFollowed += ppcOpCodeEditControl1_OnBranchFollowed;

            if ((_section = section) != null)
            {
                _section._linkedEditor = this;
                _manager = new RelocationManager(_section);
            }

            _openedSections.Add(this);

            Text = string.Format("Module Section Editor - {0}", _section.Name);

            hexBox1.SectionEditor  = this;
            chkCodeSection.Checked = _section._isCodeSection;
            chkBSSSection.Checked  = _section._isBSSSection;

            if (section.Root is RELNode)
            {
                RELNode r = (RELNode)section.Root;
                if (r.PrologSection == section.Index)
                {
                    _manager._constructorIndex = (int)r._prologOffset / 4;
                }

                if (r.EpilogSection == section.Index)
                {
                    _manager._destructorIndex = (int)r._epilogOffset / 4;
                }

                if (r.UnresolvedSection == section.Index)
                {
                    _manager._unresolvedIndex = (int)r._unresolvedOffset / 4;
                }

                //if (r._nameReloc != null && r._nameReloc._section == section)
                //    _nameReloc = r._nameReloc;
            }

            panel5.Enabled = true;
        }
Example #4
0
        public void Open()
        {
            ModuleSectionNode r = _resource as ModuleSectionNode;

            foreach (SectionEditor l in SectionEditor._openedSections)
            {
                if (l._section == r)
                {
                    l.Focus();
                    return;
                }
            }

            new SectionEditor(r).Show();
        }
        public SectionEditor(ModuleSectionNode section)
        {
            InitializeComponent();

            ppcDisassembler1._editor = this;

            if ((_section = section) != null)
            {
                _section._linkedEditor = this;

                Relocation[] temp = new Relocation[_section._relocations.Count];
                _section._relocations.CopyTo(temp);
                _relocations  = temp.ToList();
                _firstCommand = _section._firstCommand;
            }
            _openedSections.Add(this);

            Text = String.Format("Module Section Editor - {0}", _section.Name);

            hexBox1.SectionEditor  = this;
            chkCodeSection.Checked = _section._isCodeSection;
            chkBSSSection.Checked  = _section._isBSSSection;

            if (section.Root is RELNode)
            {
                RELNode r = (RELNode)section.Root;
                if (r._prologReloc != null && r._prologReloc._section == section)
                {
                    _prologReloc = r._prologReloc;
                }
                if (r._epilogReloc != null && r._epilogReloc._section == section)
                {
                    _epilogReloc = r._epilogReloc;
                }
                if (r._unresReloc != null && r._unresReloc._section == section)
                {
                    _unresReloc = r._unresReloc;
                }
                //if (r._nameReloc != null && r._nameReloc._section == section)
                //    _nameReloc = r._nameReloc;
            }

            panel5.Enabled = true;
        }
Example #6
0
        public void Open()
        {
            InheritanceItemNode r       = _resource as InheritanceItemNode;
            ModuleSectionNode   section = r.Root.Children[5] as ModuleSectionNode;


            foreach (SectionEditor l in SectionEditor._openedSections)
            {
                if (l._section == section)
                {
                    l.Focus();
                    return;
                }
            }

            SectionEditor x = new SectionEditor(section);

            x.Show();
            x.Text     = $"Module Section Editor - {section._name}";
            x.Position = r.RootOffset;
            x.hexBox1.Focus();
        }