コード例 #1
0
ファイル: ARM9.cs プロジェクト: LoveLeAnon/EveryFileExplorer
        public ARM9(byte[] Data, UInt32 RamAddress, UInt32 _start_ModuleParamsOffset)
        {
            //Unimportant static footer! Use it for _start_ModuleParamsOffset and remove it.
            if (IOUtil.ReadU32LE(Data, Data.Length - 12) == 0xDEC00621)
            {
                _start_ModuleParamsOffset = IOUtil.ReadU32LE(Data, Data.Length - 8);
                byte[] data_tmp = new byte[Data.Length - 12];
                Array.Copy(Data, data_tmp, Data.Length - 12);
                Data = data_tmp;
            }

            this.RamAddress = RamAddress;
            this._start_ModuleParamsOffset = _start_ModuleParamsOffset;
            _start_ModuleParams = new CRT0.ModuleParams(Data, _start_ModuleParamsOffset);
            if (_start_ModuleParams.CompressedStaticEnd != 0)
            {
                Data = Decompress(Data, _start_ModuleParamsOffset);
                _start_ModuleParams = new CRT0.ModuleParams(Data, _start_ModuleParamsOffset);
            }

            StaticData = new byte[_start_ModuleParams.AutoLoadStart - RamAddress];
            Array.Copy(Data, StaticData, _start_ModuleParams.AutoLoadStart - RamAddress);

            AutoLoadList = new List<CRT0.AutoLoadEntry>();
            uint nr = (_start_ModuleParams.AutoLoadListEnd - _start_ModuleParams.AutoLoadListOffset) / 0xC;
            uint Offset = _start_ModuleParams.AutoLoadStart - RamAddress;
            for (int i = 0; i < nr; i++)
            {
                var entry = new CRT0.AutoLoadEntry(Data, _start_ModuleParams.AutoLoadListOffset - RamAddress + (uint)i * 0xC);
                entry.Data = new byte[entry.Size];
                Array.Copy(Data, Offset, entry.Data, 0, entry.Size);
                AutoLoadList.Add(entry);
                Offset += entry.Size;
            }
        }
コード例 #2
0
ファイル: ARM9.cs プロジェクト: clienthax/EveryFileExplorer
        public ARM9(byte[] Data, UInt32 RamAddress, UInt32 _start_ModuleParamsOffset)
        {
            //Unimportant static footer! Use it for _start_ModuleParamsOffset and remove it.
            if (IOUtil.ReadU32LE(Data, Data.Length - 12) == 0xDEC00621)
            {
                _start_ModuleParamsOffset = IOUtil.ReadU32LE(Data, Data.Length - 8);
                byte[] data_tmp = new byte[Data.Length - 12];
                Array.Copy(Data, data_tmp, Data.Length - 12);
                Data = data_tmp;
            }

            this.RamAddress = RamAddress;
            this._start_ModuleParamsOffset = _start_ModuleParamsOffset;
            _start_ModuleParams            = new CRT0.ModuleParams(Data, _start_ModuleParamsOffset);
            if (_start_ModuleParams.CompressedStaticEnd != 0)
            {
                Data = Decompress(Data, _start_ModuleParamsOffset);
                _start_ModuleParams = new CRT0.ModuleParams(Data, _start_ModuleParamsOffset);
            }

            StaticData = new byte[_start_ModuleParams.AutoLoadStart - RamAddress];
            Array.Copy(Data, StaticData, _start_ModuleParams.AutoLoadStart - RamAddress);

            AutoLoadList = new List <CRT0.AutoLoadEntry>();
            uint nr     = (_start_ModuleParams.AutoLoadListEnd - _start_ModuleParams.AutoLoadListOffset) / 0xC;
            uint Offset = _start_ModuleParams.AutoLoadStart - RamAddress;

            for (int i = 0; i < nr; i++)
            {
                var entry = new CRT0.AutoLoadEntry(Data, _start_ModuleParams.AutoLoadListOffset - RamAddress + (uint)i * 0xC);
                entry.Data = new byte[entry.Size];
                Array.Copy(Data, Offset, entry.Data, 0, entry.Size);
                AutoLoadList.Add(entry);
                Offset += entry.Size;
            }
        }