Exemplo n.º 1
0
        public LRIM(GTFS fs)
        {
            flip           = false;
            this.fs        = fs;
            FileName       = fs.FilePath;
            SafeFileName   = Path.GetFileName(FileName);
            listPackFrames = new List <Pack>();

            //--

            int magicheader = GT.ReadInt32(fs, 4, flip);
            int num         = GT.ReadInt32(fs, 4, flip);
            int sixteen     = GT.ReadInt32(fs, 4, flip);
            int unk1        = GT.ReadInt32(fs, 4, flip);

            int[] offset = new int[num];
            for (int i = 0; i < num; i++)
            {
                offset[i] = GT.ReadInt32(fs, 4, flip);
            }

            int[] size = new int[num];
            for (int i = 0; i < num; i++)
            {
                size[i] = GT.ReadInt32(fs, 4, flip);

                string name = "LRIM " + i + ".lrim";
                listPackFrames.Add(new Pack(name, offset[i], size[i]));
            }

            foreach (Pack pack in listPackFrames)
            {
                pack.WriteOut(fs, "GT-HD-LRIM-" + SafeFileName.Replace(".bin", ""));
            }

            Console.WriteLine("Offsets: " + string.Join(", ", offset));
            Console.WriteLine("Sizes: " + string.Join(", ", size));

            Console.WriteLine();
        }
Exemplo n.º 2
0
        public void DumpPackFramesCompressed()
        {
            //This was Stage 1 in working out the format, it should no longer be required.

            string extract_path = @"C:\Users\jas2o\Desktop\GT-HotelDusk\Extract";

            string toFolder = SafeFileName.Replace('.', '_');

            if (!Directory.Exists(extract_path))
            {
                Directory.CreateDirectory(extract_path);
            }

            if (!Directory.Exists(extract_path + "\\" + toFolder))
            {
                Directory.CreateDirectory(extract_path + "\\" + toFolder);
            }

            foreach (Pack frame in listPackFrames)
            {
                string newfile = extract_path + "\\" + toFolder + "\\" + frame.Filename;
                GT.WriteSubFile(fs, newfile, frame.Size, frame.Offset);
            }
        }