Exemple #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);
        }