예제 #1
0
파일: Bundle.cs 프로젝트: tmt01/KOAR-Tools
        public override void Load(Stream stream)
        {
            KOARBinaryReader br = new KOARBinaryReader(stream);

            br.ReadInt(); // Always 0
            br.ReadInt(); // Always 0
            Int32 count1 = br.ReadInt();
            Int32 count2 = br.ReadInt();

            _records = new List <BundleRecord>();

            for (int i = 0; i < count1; i++)
            {
                UInt32 fileID = br.ReadUInt();
                _records.Add(new BundleRecord(fileID));
            }
            for (int i = 0; i < count1; i++)
            {
                _records[i].type = (byte)br.ReadInt(1);
            }
            for (int i = 0; i < count1; i++)
            {
                _records[i].unknown = (byte)br.ReadInt(1);
            }
            for (int i = 0; i < count1; i++)
            {
                _records[i].bundle = br.ReadInt(1) == 1;
            }

            // TODO: add second list

            br.Close();
        }
예제 #2
0
파일: Init.cs 프로젝트: tmt01/KOAR-Tools
        public override void Load(Stream stream)
        {
            KOARBinaryReader br = new KOARBinaryReader(stream);

            br.ReadUInt(); // Always 1
            Int32 count = br.ReadInt();

            _fileIDs = new List <uint>();

            // First list - fileIDs
            for (int i = 0; i < count; i++)
            {
                _fileIDs.Add(br.ReadUInt());
            }

            // Second list - hashes
            if (br.IsEOF())
            {
                _hashes = null;
            }
            else
            {
                _hashes = new List <uint>();

                for (int i = 0; i < count; i++)
                {
                    _hashes.Add(br.ReadUInt());
                }
            }

            br.Close();
        }
예제 #3
0
        public override void Load(Stream stream)
        {
            KOARBinaryReader br = new KOARBinaryReader(stream);

            _fileIDs      = new List <uint>();
            _symbol_names = new List <string>();
            _name_hashes  = new List <uint>();

            var count = br.ReadInt();

            Int32 char_array_offset = 8 + count * 12;

            for (int i = 0; i < count; i++)
            {
                _fileIDs.Add(br.ReadUInt());

                Int32 str_start = br.ReadInt();
                Int32 str_end   = br.ReadInt();

                br.SavePosition();
                br.SetOffset(char_array_offset + str_start);

                string s = br.ReadString(str_end - str_start);

                _symbol_names.Add(s);
                _name_hashes.Add(Utils.SH(s));

                br.LoadPosition();
            }

            br.Close();
        }
예제 #4
0
        public override void Load(Stream stream)
        {
            KOARBinaryReader br = new KOARBinaryReader(stream);

            Load(br);
            br.Close();
        }
예제 #5
0
        public override void Load(Stream stream)
        {
            KOARBinaryReader br = new KOARBinaryReader(stream);

            // Metadata

            Module             = br.ReadString();
            PrehashedFunctions = new List <string>();

            var count = br.ReadInt();

            for (int i = 0; i < count; i++)
            {
                PrehashedFunctions.Add(br.ReadString());
            }

            br.ReadInt(); // Size of Lua chunk

            // Lua
            // header

            _header                   = new LuaHeader();
            _header.Singature         = br.ReadUInt();
            _header.Version           = (byte)br.ReadInt(1);
            _header.Format            = (byte)br.ReadInt(1);
            _header.Endian            = (LuaHeader.ChunkEndian)br.ReadInt(1);
            _header.SizeOfInt         = (byte)br.ReadInt(1);
            _header.SizeOfSize_T      = (byte)br.ReadInt(1);
            _header.SizeOfInstruction = (byte)br.ReadInt(1);
            _header.SizeOfLuaNumber   = (byte)br.ReadInt(1);
            _header.IntegralFlag      = (byte)br.ReadInt(1);
            _header.Unknown1          = (byte)br.ReadInt(1);
            _header.Unknown2          = (byte)br.ReadInt(1);

            if (_header.Endian == LuaHeader.ChunkEndian.big)
            {
                br.SetLittleEndian(false);
            }

            // value types

            br.Read(224);

            // main function

            Root = LuaFunction.ReadFunction(br);

            // KoreVM footer

            _footer = br.Read(8);

            br.Close();
        }