コード例 #1
0
ファイル: Program.cs プロジェクト: XAYRGA/bstParser
        public void map_bstn(JBSTN bstn)
        {
            var w = this;

            for (int sid = 0; sid < w.sections.Length; sid++)
            {
                w.sections[sid].name = bstn.sections[sid].name;
                for (int gid = 0; gid < w.sections[sid].groups.Length; gid++)
                {
                    w.sections[sid].groups[gid].name = bstn.sections[sid].groups[gid].name;
                    for (int wid = 0; wid < w.sections[sid].groups[gid].waves.Length; wid++)
                    {
                        w.sections[sid].groups[gid].waves[wid].name = bstn.sections[sid].groups[gid].waves[wid];
                    }
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: XAYRGA/bstParser
        static void Main(string[] args)
        {
            var mFile   = File.OpenRead("1.bstn");
            var bstRead = new BeBinaryReader(mFile);
            var bstn    = JBSTN.readStream(bstRead);

            mFile.Close();
            mFile   = File.OpenRead("0.bst");
            bstRead = new BeBinaryReader(mFile);
            var w = JBST.readStream(bstRead);

            var bscFile = File.OpenRead("12.bsc");

            bstRead = new BeBinaryReader(bscFile);
            var bsc = JBSC.readStream(bstRead, w);

            w.map_bstn(bstn);

            var bst1 = w.sections[0];

            Console.WriteLine($"Section name {bst1.name}");
            for (int b = 0; b < bsc.groups.Length; b++)
            {
                Console.WriteLine(b);
                var currentGrpBsc = bsc.groups[b];
                var currentGrpBst = bst1.groups[b];
                Console.WriteLine(currentGrpBst.name);

                Directory.CreateDirectory(currentGrpBst.name);
                for (int ixb = 0; ixb < currentGrpBsc.sequences.Count; ixb++)
                {
                    var name = currentGrpBst.waves[ixb].name;
                    var dat  = currentGrpBsc.sequences[ixb];
                    File.WriteAllBytes($"{currentGrpBst.name}/{name}.minibms", dat);
                }
            }


            mFile.Close();
            // ObjectDumper.Dumper.Dump(w, "BST", Console.Out);
            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: XAYRGA/bstParser
        public static JBSTN readStream(BeBinaryReader br)
        {
            var newBSTN = new JBSTN();
            var head    = br.ReadInt32();

            if (head != HEAD)
            {
                throw new InvalidDataException($"Unexpected BSTN header! {head} != {HEAD}");
            }
            br.ReadInt32(); // Skip, alignment.
            var version = br.ReadInt32();

            if (version != 0x01000000)
            {
                throw new InvalidDataException($"Version is not 0x01000000! ({version})");
            }
            newBSTN.version = version;

            var sectionTableOffset = br.ReadInt32();

            br.BaseStream.Position = sectionTableOffset;  // seek to group table position

            var sectionCount    = br.ReadInt32();
            var sectionPointers = Helpers.readInt32Array(br, sectionCount);

            newBSTN.sections = new BSTNSection[sectionCount];

            var anch = br.BaseStream.Position;

            for (int i = 0; i < sectionPointers.Length; i++)
            {
                var sectLocation = sectionPointers[i];
                br.BaseStream.Position = sectLocation;
                newBSTN.sections[i]    = BSTNSection.readStream(br);
            }
            return(newBSTN);
        }