public void MOTReader(string file) { _IO = File.OpenReader(file + ".bin"); i = 0; while (true) { if (_IO.RI64() == 0) { break; } else { _IO.RI64(); i++; } } if (i == 0) { return; } _IO.P = 0; int motCount = i; MOT = new MotHeader[motCount]; for (i = 0; i < motCount; i++) { ref MotHeader mot = ref MOT[i]; mot.KeySet.O = _IO.RI32(); mot.KeySetTypesOffset = _IO.RI32(); mot.KeySetOffset = _IO.RI32(); mot.BoneInfo.O = _IO.RI32(); }
public void MOTReader(string file, bool JSON) { IO = File.OpenReader(file + ".bin"); i = 0; while (true) { if (IO.ReadInt32() == 0) { break; } IO.ReadInt32(); IO.ReadInt32(); IO.ReadInt32(); i++; } if (i == 0) { return; } int MOTCount = i; MsgPack m = new MsgPack(MOTCount, "Mot"); MotHeader[] MMOT = new MotHeader[MOTCount]; for (i = 0; i < MOTCount; i++) { ref MotHeader Mot = ref MMOT[i]; IO.Position = 0x10 * i; Mot.KeySet.Offset = IO.ReadInt32(); Mot.KeySetTypesOffset = IO.ReadInt32(); Mot.KeySetOffset = IO.ReadInt32(); Mot.BoneInfo.Offset = IO.ReadInt32(); i0 = 1; IO.Position = Mot.BoneInfo.Offset; IO.ReadUInt16(); while (true) { if (IO.ReadUInt16() == 0) { break; } i0++; } Mot.BoneInfo.Value = new BoneInfo[i0]; IO.Position = Mot.BoneInfo.Offset; for (i0 = 0; i0 < Mot.BoneInfo.Value.Length; i0++) { Mot.BoneInfo.Value[i0].Id = IO.ReadUInt16(); } IO.Position = Mot.KeySet.Offset; int info = IO.ReadUInt16(); Mot.HighBits = info >> 14; Mot.FrameCount = IO.ReadUInt16(); Mot.KeySet.Value = new KeySet[info & 0x3FFF]; IO.Position = Mot.KeySetTypesOffset; for (i0 = 0; i0 < Mot.KeySet.Value.Length; i0++) { if (i0 % 8 == 0) { i1 = IO.ReadUInt16(); } Mot.KeySet.Value[i0] = new KeySet { Type = (KeySetType)((i1 >> (i0 % 8 * 2)) & 3) }; } IO.Position = Mot.KeySetOffset; for (i0 = 0; i0 < Mot.KeySet.Value.Length; i0++) { Mot.KeySet.Value[i0].Read(IO); } m[i] = MsgPackWriter(ref MMOT[i]); ((MsgPack)m[i]).Write(true, file + "." + i.ToString("d2"), JSON); }