Exemplo n.º 1
0
        public static BSTWaveInfo readStream(BeBinaryReader br, int fmt)
        {
            var newWI = new BSTWaveInfo();

            newWI.format = fmt;
            switch (fmt & 0xF0)
            {
            case 0x40:
                break;

            case 0x50:
                // Console.WriteLine($"{br.BaseStream.Position:X}");
                newWI.wSoundID = br.ReadInt16();
                // Console.WriteLine(newWI.wSoundID);
                break;

            case 0x60:
                break;

            case 0x70:
                newWI.streamFormat = br.ReadByte();
                newWI.unk1         = br.ReadByte();
                newWI.flags        = br.ReadUInt16();
                var namePointer = br.ReadInt32();
                br.BaseStream.Position = namePointer;
                newWI.streamFilePath   = JBST.readTerminated(br, 0x00);
                break;
            }
            return(newWI);
        }
Exemplo n.º 2
0
        public static JBSC readStream(BeBinaryReader br, JBST jbst)
        {
            br.ReadInt32(); // skip head lol
            var newBSC = new JBSC();

            newBSC.size   = br.ReadInt32();
            newBSC.groups = new JBSCGroup[jbst.sections[0].groups.Length];
            var sectionPointers = Helpers.readInt32Array(br, jbst.sections[0].groups.Length);

            for (int i = 0; i < newBSC.groups.Length; i++)
            {
                br.BaseStream.Position = sectionPointers[i];
                Console.WriteLine(sectionPointers[i]);
                newBSC.groups[i] = JBSCGroup.readStream(br);
            }
            return(newBSC);
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        public static BSTNSection readStream(BeBinaryReader br)
        {
            var newSect = new BSTNSection();

            newSect.count = br.ReadInt32();
            var nameOffset = br.ReadInt32();

            newSect.groups = new BSTNGroup[newSect.count];
            var groupPointers = Helpers.readInt32Array(br, newSect.count);

            br.BaseStream.Position = nameOffset;
            newSect.name           = JBST.readTerminated(br, 0x00);
            //Console.WriteLine(newSect.name);
            for (int i = 0; i < groupPointers.Length; i++)
            {
                br.BaseStream.Position = groupPointers[i];
                newSect.groups[i]      = BSTNGroup.readStream(br);
            }
            return(newSect);
        }
Exemplo n.º 5
0
        public static JBST readStream(BeBinaryReader br)
        {
            var newBST = new JBST();
            var head   = br.ReadInt32();

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

            if (version != 0x01000000)
            {
                throw new InvalidDataException($"Version is not 0x01000000! ({version})");
            }
            newBST.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);

            newBST.sections = new BSTSection[sectionCount];

            var anch = br.BaseStream.Position;

            for (int i = 0; i < sectionPointers.Length; i++)
            {
                br.BaseStream.Position = sectionPointers[i];
                newBST.sections[i]     = BSTSection.readStream(br);
            }
            return(newBST);
        }
Exemplo n.º 6
0
        public static BSTNGroup readStream(BeBinaryReader br)
        {
            var newSect    = new BSTNGroup();
            var count      = br.ReadInt32();
            var nameOffset = br.ReadInt32();

            var banch = br.BaseStream.Position;

            br.BaseStream.Position = nameOffset;
            newSect.name           = JBST.readTerminated(br, 0x00);
            // Console.WriteLine($"->\t{newSect.name}");
            br.BaseStream.Position = banch;
            newSect.waves          = new string[count];
            for (int i = 0; i < count; i++)
            {
                var anch = br.BaseStream.Position + 4;
                var ofs  = br.ReadInt32();
                br.BaseStream.Position = ofs;
                newSect.waves[i]       = JBST.readTerminated(br, 0x00);
                //Console.WriteLine($"\t->\t{newSect.waves[i]}");
                br.BaseStream.Position = anch;
            }
            return(newSect);
        }