Beispiel #1
0
        void AddRawFiles(byte[] extension)
        {
            int offset = ByteHandling.FindBytes(zd.DecompressedData, extension);

            while (offset != -1)
            {
                int    startOfNameOffset = ByteHandling.FindByteBackward(zd.DecompressedData, 0xFF, offset + 1) + 1;
                int    endOfNameOffset   = ByteHandling.FindByte(zd.DecompressedData, 0x00, offset + 1);
                int    assetSize         = ByteHandling.GetDword(zd.DecompressedData, startOfNameOffset - 8);
                string assetName         = ByteHandling.GetString(zd.DecompressedData, startOfNameOffset, endOfNameOffset);
                int    startOfContents   = endOfNameOffset + 1;
                int    endOfContents     = ByteHandling.FindByte(zd.DecompressedData, 0x00, startOfContents);
                string contents          = ByteHandling.GetString(zd.DecompressedData, startOfContents, endOfContents);

                rawFiles.Add(new RawFileData(rawfileIndex, assetName, startOfNameOffset, contents, assetSize, startOfContents));
                ++rawfileIndex;
                offset = ByteHandling.FindBytes(zd.DecompressedData, extension, offset + 1);
            }
        }
Beispiel #2
0
        public void ParseZoneHeader()
        {
            g_streamOutSize = ByteHandling.GetDword(decompressedData, 0);
            for (int i = 0; i < 9; ++i)
            {
                g_streamBlockSize[i] = ByteHandling.GetDword(decompressedData, 4 * (i + 1));
            }

            listStringCount  = ByteHandling.GetDword(decompressedData, 0x2C);
            assetsCount      = ByteHandling.GetDword(decompressedData, 0x34);
            listStringOffset = 0x3C + listStringCount * 4;
            listStrings      = new string[listStringCount];

            //Getting the strings from list
            int listStringStrStartOffset = listStringOffset;
            int listStringStrEndOffset   = listStringOffset;

            for (int i = 0; i < listStringCount; ++i)
            {
                if ((uint)ByteHandling.GetDword(decompressedData, 0x3C + 4 * i) == 0xFFFFFFFF)
                {
                    listStringStrEndOffset   = ByteHandling.FindByte(decompressedData, 0x00, listStringStrStartOffset);
                    listStrings[i]           = ByteHandling.GetString(decompressedData, listStringStrStartOffset, listStringStrEndOffset);
                    listStringStrStartOffset = listStringStrEndOffset + 1;
                }
            }

            assetsListOffset = listStringCount > 0 ? listStringStrEndOffset + 1 : listStringStrEndOffset;

            //Getting the assets' count from assets list
            for (int i = 0; i < assetsCount; ++i)
            {
                int assetType = ByteHandling.GetDword(decompressedData, assetsListOffset + 8 * i);
                assetsTypesCount[assetType]++;
            }

            assetsDataOffset = assetsListOffset + assetsCount * 8;
        }