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); }
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(); }