Beispiel #1
0
        public override bool OnInitialize()
        {
            ModuleSectionNode section = Location;

            if (section == null || !Header)
            {
                return(false);
            }

            //Don't make a copy buffer here.
            //Use the original buffer to save memory

            buint * sPtr = (buint *)Header;
            VoidPtr ceil = section.Header + section._dataSize;

            while (!(PowerPC.Disassemble(*sPtr++) is PPCblr) && (int)sPtr < (int)ceil)
            {
                ;
            }

            _codeStart = (int)Header - (int)section.Header;
            _codeLen   = (int)sPtr - (int)Header;

            _manager = new RelocationManager(null);
            _manager.UseReference(section, _codeStart);

            if (_codeLen > 0)
            {
                _manager.AddTag(0, FullName + " Start");
                _manager.AddTag(_codeLen / 4 - 1, FullName + " End");
            }

            return(false);
        }
        public override bool OnInitialize()
        {
            ModuleSectionNode section = Location;

            if ((TargetSection == 1 || TargetModule.Equals("main.dol")) && ModuleMapLoader.MapFiles.ContainsKey(TargetModule))
            {
                if (ModuleMapLoader.MapFiles[TargetModule].ContainsKey(TargetOffset))
                {
                    _name = ModuleMapLoader.MapFiles[TargetModule][TargetOffset];
                }
            }

            if (section == null || !Header)
            {
                return(false);
            }

            //Don't make a copy buffer here.
            //Use the original buffer to save memory

            buint * sPtr = (buint *)Header;
            VoidPtr ceil = section.Header + section._dataSize;

            while (!(PowerPC.Disassemble(*sPtr++) is PPCblr) && (int)sPtr < (int)ceil)
            {
                ;
            }

            _codeStart = (int)Header - (int)section.Header;
            _codeLen   = (int)sPtr - (int)Header;

            _manager = new RelocationManager(null);
            _manager.UseReference(section, _codeStart);

            if (_codeLen > 0)
            {
                _manager.AddTag(0, FullName + " Start");
                _manager.AddTag(_codeLen / 4 - 1, FullName + " End");
            }

            return(false);
        }
Beispiel #3
0
 /// <summary>
 /// Fills the data buffer with the specified amount of zerobytes.
 /// </summary>
 public void InitBuffer(uint size)
 {
     _dataBuffer = new UnsafeBuffer((int)size.RoundUp(4));
     Memory.Fill(_dataBuffer.Address, size, 0);
     _manager = new RelocationManager(this);
 }
Beispiel #4
0
        //public Relocation this[int index]
        //{
        //    get
        //    {
        //        List<Relocation> l = _linkedEditor != null ? _linkedEditor._relocations : _relocations;

        //        if (index < l.Count && index >= 0)
        //            return l[index];
        //        return null;
        //    }
        //    set
        //    {
        //        List<Relocation> l = _linkedEditor != null ? _linkedEditor._relocations : _relocations;

        //        if (index < l.Count && index >= 0)
        //            l[index] = value;
        //    }
        //}

        /// <summary>
        /// Fills the data buffer with the specified amount of data from an address.
        /// </summary>
        public void InitBuffer(uint size, VoidPtr address)
        {
            _dataBuffer = new UnsafeBuffer((int)size.RoundUp(4));
            Memory.Move(_dataBuffer.Address, address, size);
            _manager = new RelocationManager(this);
        }