Beispiel #1
0
        public void SetTarget(List <PPCOpCode> relocations, int sectionOffset, RelocationManager manager)
        {
            if (_codes != null)
            {
                int startIndex = _sectionOffset / 4;
                for (int i = 0; i < _codes.Count; i++)
                {
                    _manager.ClearColor(startIndex + i);
                }
            }

            _codes         = relocations;
            _sectionOffset = sectionOffset;
            _manager       = manager;

            if (_codes != null)
            {
                Color c          = Color.FromArgb(255, 155, 200, 200);
                int   startIndex = _sectionOffset / 4;
                for (int i = 0; i < _codes.Count; i++)
                {
                    _manager.SetColor(startIndex + i, c);
                }
            }

            Display();
        }
        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;
        }
Beispiel #3
0
        public void SetTarget(RELMethodNode node)
        {
            if (node.ResourceType == ResourceType.RELExternalMethod)
            {
                _codes         = null;
                _sectionOffset = 0;
                _baseOffset    = 0;
                _manager       = null;
            }
            else
            {
                _codes = new List <PPCOpCode>();
                for (int i = 0; i < node._codeLen / 4; i++)
                {
                    _codes.Add(node._manager.GetCode(i));
                }

                _sectionOffset = 0;
                _baseOffset    = (int)node._cmd._addend;
                _manager       = node._manager;
            }

            Display();
        }