コード例 #1
0
        public void UpdateEntries()
        {
            VoidPtr addr = _workingSource.Address;

            addr += 0x08;

            for (int i = 0; i < _entryCount; i++)
            {
                LSEntryObject lsobj = Entries.Values[i];
                if (Version == 1)
                {
                    LSEntry_v1 *entry = (LSEntry_v1 *)(addr + (i * 0x0C));
                    *           entry = new LSEntry_v1()
                    {
                        _crc   = lsobj.FileNameCRC,
                        _start = lsobj.DTOffset,
                        _size  = lsobj.Size
                    };
                    LSEntry_v1 *entry2 = (LSEntry_v1 *)(addr + (i * 0x0C));
                }
                else if (Version == 2)
                {
                    LSEntry_v2 *entry = (LSEntry_v2 *)(addr + (i * 0x10));
                    *           entry = new LSEntry_v2()
                    {
                        _crc     = lsobj.FileNameCRC,
                        _start   = lsobj.DTOffset,
                        _size    = lsobj.Size,
                        _dtIndex = lsobj.DTIndex,
                        _padlen  = lsobj.PaddingLength
                    };
                }
            }
        }
コード例 #2
0
ファイル: LSFile.cs プロジェクト: soneek/Sm4sh-Tools
        public void UpdateEntries()
        {
            VoidPtr addr = _workingSource.Address;
            addr += 0x08;

            for (int i = 0; i < _entryCount; i++)
            {
                LSEntryObject lsobj = Entries.Values[i];
                if (Version == 1)
                {
                    LSEntry_v1* entry = (LSEntry_v1*)(addr + (i * 0x0C));
                    *entry = new LSEntry_v1()
                    {
                        _crc = lsobj.FileNameCRC,
                        _start = lsobj.DTOffset,
                        _size = lsobj.Size
                    };
                    LSEntry_v1* entry2 = (LSEntry_v1*)(addr + (i * 0x0C));
                }
                else if (Version == 2)
                {
                    LSEntry_v2* entry = (LSEntry_v2*)(addr + (i * 0x10));
                    *entry = new LSEntry_v2()
                    {
                        _crc = lsobj.FileNameCRC,
                        _start = lsobj.DTOffset,
                        _size = lsobj.Size,
                        _dtIndex = lsobj.DTIndex,
                        _padlen = lsobj.PaddingLength
                    };
                }
            }
        }
コード例 #3
0
        public void Parse(string path)
        {
            _workingSource = new DataSource(FileMap.FromFile(path));

            short tag = *(short *)_workingSource.Address;

            if (tag != 0x666f)
            {
                return;
            }
            _version    = *(short *)(_workingSource.Address + 0x02);
            _entryCount = *(int *)(_workingSource.Address + 0x04);
            Entries     = new SortedList <uint, LSEntryObject>(_entryCount);

            for (int i = 0; i < _entryCount; i++)
            {
                LSEntryObject lsobj = new LSEntryObject();
                if (Version == 1)
                {
                    LSEntry_v1 entry = *(LSEntry_v1 *)(_workingSource.Address + 0x08 + (i * 0x0C));
                    lsobj.FileNameCRC = entry._crc;
                    lsobj.DTOffset    = entry._start;
                    lsobj.Size        = entry._size;
                }
                else if (Version == 2)
                {
                    LSEntry_v2 entry = *(LSEntry_v2 *)(_workingSource.Address + 0x08 + (i * 0x10));
                    lsobj.FileNameCRC   = entry._crc;
                    lsobj.DTOffset      = entry._start;
                    lsobj.Size          = entry._size;
                    lsobj.DTIndex       = entry._dtIndex;
                    lsobj.PaddingLength = entry._padlen;
                }
                Entries.Add(lsobj.FileNameCRC, lsobj);
            }
        }