public static CountPointer <T> ReadCountPointer <T>(this Stream IO) { CountPointer <T> val = new CountPointer <T> { Count = IO.ReadInt32(), Offset = IO.ReadInt32() }; val.Entries = new T[val.Count]; return(val); }
public void DFTReader(string file) { IsX = false; DFTs = default; byte[] dftData = File.ReadAllBytes(file + ".dft"); Struct _DOFT = dftData.RSt(); dftData = null; if (_DOFT.Header.Signature != 0x54464F44) { return; } s = File.OpenReader(_DOFT.Data); s.IsBE = _DOFT.Header.UseBigEndian; DFTs = s.RCPE <DFT>(); if (DFTs.C < 1) { s.C(); DFTs.C = -1; return; } if (!(DFTs.C > 0 && DFTs.O == 0)) { s.PI64 = DFTs.O - _DOFT.Header.Length; for (i = 0; i < DFTs.C; i++) { ref DFT dft = ref DFTs.E[i]; dft.Flags = (Flags)s.RI32E(); dft.Focus = s.RF32E(); dft.FocusRange = s.RF32E(); dft.FuzzingRange = s.RF32E(); dft.Ratio = s.RF32E(); dft.Quality = s.RF32E(); } }
public static Pointer <Eff> ReadEff(this Stream IO, ref Dictionary <int, AetObject> ObjectsDict) { Pointer <Eff> Eff = new Pointer <Eff> { Offset = IO.Position, Value = new Eff { LayerID = IO.ReadInt32(), ParentObjectID = IO.ReadInt32(), Marker = IO.ReadCountPointer <Marker>() } }; Eff.Value.Data.Offset = IO.ReadInt32(); IO.Position = Eff.Value.LayerID; CountPointer <AetObject> AetObjEntry = IO.ReadCountPointer <AetObject>(); IO.Position = AetObjEntry.Offset; for (int i = 0; i < AetObjEntry.Count; i++) { IO.ReadAetObject(ref ObjectsDict); } IO.Position = Eff.Value.Marker.Offset; for (int i = 0; i < Eff.Value.Marker.Count; i++) { Eff.Value.Marker.Entries[i].Frame = IO.ReadSingle(); Eff.Value.Marker.Entries[i].Name = IO.ReadPointerStringShiftJIS(); } IO.ReadAnimData(ref Eff.Value.Data); return(Eff); }
public static MsgPack Add(this MsgPack MsgPack, string Name, CountPointer <float> val) { if (val.Count == 1) { return(MsgPack.Add(new MsgPack(Name, val.Entries[0]))); } else if (val.Count > 1) { MsgPack Val = new MsgPack(val.Count, Name); for (int i = 0; i < val.Count; i++) { Val[i] = val.Entries[i]; } return(MsgPack.Add(Val)); } return(MsgPack); }
public void DFTReader(string file) { DFTs = default; _IO = File.OpenReader(file + ".dft", true); header = _IO.ReadHeader(); if (header.Signature != 0x54464F44 || header.InnerSignature != 0x3) { return; } _IO.P -= 0x4; DFTs = _IO.RCPE <DFT>(); if (DFTs.C < 1) { _IO.C(); DFTs.C = -1; return; } if (DFTs.C > 0 && DFTs.O == 0) { _IO.C(); DFTs.C = -1; return; } /*{ * _IO.Format = Header.Format = Format.X; * _IO.Offset = Header.Length; * _IO.Position = DFTs.Offset; * DFTs = _IO.ReadCountPointerX<DFT>(); * }*/ _IO.P = DFTs.O; for (i = 0; i < DFTs.C; i++) { ref DFT DFT = ref DFTs.E[i]; _IO.RI32E(); DFT.Focus = _IO.RF32E(); DFT.FocusRange = _IO.RF32E(); DFT.FuzzingRange = _IO.RF32E(); DFT.Ratio = _IO.RF32E(); DFT.Quality = _IO.RF32E(); if (_IO.IsX) { _IO.RI32(); } }
public void CCTReader(string file) { CCTs = default; _IO = File.OpenReader(file + ".cct", true); header = _IO.ReadHeader(); if (header.Signature != 0x54524343 || header.InnerSignature != 0x3) { return; } _IO.P -= 0x4; CCTs = _IO.RCPE <CCT>(); if (CCTs.C < 1) { _IO.C(); CCTs.C = -1; return; } if (CCTs.C > 0 && CCTs.O == 0) { _IO.C(); CCTs.C = -1; return; } /*{ * _IO.Format = Header.Format = Format.X; * _IO.Offset = Header.Length; * _IO.Position = CCTs.Offset; * CCTs = _IO.ReadCountPointerX<CCT>(); * }*/ _IO.P = CCTs.O; for (i = 0; i < CCTs.C; i++) { ref CCT cct = ref CCTs.E[i]; _IO.RI32E(); cct.Hue = _IO.RF32E(); cct.Saturation = _IO.RF32E(); cct.Lightness = _IO.RF32E(); cct.Exposure = _IO.RF32E(); cct.Gamma.X = _IO.RF32E(); cct.Gamma.Y = _IO.RF32E(); cct.Gamma.Z = _IO.RF32E(); cct.Contrast = _IO.RF32E(); }
public static MsgPack ReadMP(this MsgPack msg, ref CountPointer <float> val, string Name) { val.Offset = 0; val.Entries = null; if (msg.ContainsKey(Name)) { val.Count = 1; val[0] = msg.ReadSingle(Name); } else if (msg.ElementArray(Name, out MsgPack Temp)) { val.Count = Temp.Array.Length; for (int i = 0; i < val.Count; i++) { val[i] = Temp[i].ReadSingle(); } } return(msg); }
public void BLTReader(string file) { BLTs = default; _IO = File.OpenReader(file + ".blt", true); header = _IO.ReadHeader(); if (header.Signature != 0x544D4C42 || header.InnerSignature != 0x3) { return; } _IO.P -= 0x4; BLTs = _IO.RCPE <BLT>(); if (BLTs.C < 1) { _IO.C(); BLTs.C = -1; return; } if (BLTs.C > 0 && BLTs.O == 0) { _IO.C(); BLTs.C = -1; return; } /*{ * _IO.Format = Header.Format = Format.X; * _IO.Offset = Header.Length; * _IO.Position = BLTs.Offset; * BLTs = _IO.ReadCountPointerX<BLT>(); * }*/ _IO.P = BLTs.O; for (i = 0; i < BLTs.C; i++) { ref BLT blt = ref BLTs.E[i]; _IO.RI32E(); blt.Color.X = _IO.RF32E(); blt.Color.Y = _IO.RF32E(); blt.Color.Z = _IO.RF32E(); blt.Brightpass.X = _IO.RF32E(); blt.Brightpass.Y = _IO.RF32E(); blt.Brightpass.Z = _IO.RF32E(); blt.Range = _IO.RF32E(); }
public static void ReadMP(this MsgPack msg, ref CountPointer <float> val, string Name) { val.Offset = 0; val.Entries = null; if (msg.ContainsKey(Name)) { val.Count = 1; val.Entries[0] = msg.ReadSingle(Name); } else if (msg.Element <MsgPack>(Name, out MsgPack Temp)) { val.Count = Temp.Array.Length; for (int i = 0; i < val.Count; i++) { if (Temp[i] is MsgPack temp) { val.Entries[i] = temp.ReadSingle(); } } } }
public void CCTReader(string file) { IsX = false; CCTs = default; byte[] ccData = File.ReadAllBytes(file + ".cct"); Struct _CCRT = ccData.RSt(); ccData = null; if (_CCRT.Header.Signature != 0x54524343) { return; } s = File.OpenReader(_CCRT.Data); s.IsBE = _CCRT.Header.UseBigEndian; CCTs = s.RCPE <CCT>(); if (CCTs.C < 1) { s.C(); CCTs.C = -1; return; } if (!(CCTs.C > 0 && CCTs.O == 0)) { s.PI64 = CCTs.O - _CCRT.Header.Length; for (i = 0; i < CCTs.C; i++) { ref CCT cct = ref CCTs.E[i]; cct.Flags = (Flags)s.RI32E(); cct.Hue = s.RF32E(); cct.Saturation = s.RF32E(); cct.Lightness = s.RF32E(); cct.Exposure = s.RF32E(); cct.Gamma.X = s.RF32E(); cct.Gamma.Y = s.RF32E(); cct.Gamma.Z = s.RF32E(); cct.Contrast = s.RF32E(); } }
public void BLTReader(string file) { IsX = false; BLTs = default; byte[] bltData = File.ReadAllBytes(file + ".blt"); Struct _BLMT = bltData.RSt(); bltData = null; if (_BLMT.Header.Signature != 0x544D4C42) { return; } s = File.OpenReader(_BLMT.Data); s.IsBE = _BLMT.Header.UseBigEndian; BLTs = s.RCPE <BLT>(); if (BLTs.C < 1) { s.C(); BLTs.C = -1; return; } if (!(BLTs.C > 0 && BLTs.O == 0)) { s.PI64 = BLTs.O - _BLMT.Header.Length; for (i = 0; i < BLTs.C; i++) { ref BLT blt = ref BLTs.E[i]; blt.Flags = (Flags)s.RI32E(); blt.Color.X = s.RF32E(); blt.Color.Y = s.RF32E(); blt.Color.Z = s.RF32E(); blt.Brightpass.X = s.RF32E(); blt.Brightpass.Y = s.RF32E(); blt.Brightpass.Z = s.RF32E(); blt.Range = s.RF32E(); } }
public static void WX <T>(this Stream stream, CountPointer <T> val) { stream.WX(val.C); stream.WX(val.O); }
public void LITReader(string file) { LITs = default; _IO = File.OpenReader(file + ".lit", true); header = _IO.ReadHeader(); if (header.Signature != 0x4354494C || header.InnerSignature != 0x2 || header.SectionSignature != 0x2) { return; } LITs = _IO.RCPE <CountPointer <LIT> >(); if (LITs.C < 1) { _IO.C(); LITs.C = -1; return; } _IO.P = LITs.O; for (i = 0; i < LITs.C; i++) { LITs[i] = _IO.RCPX <LIT>(); if ((LITs[i].C > 0 || LITs[i].O == 0) && !_IO.IsX) { _IO.C(); LITs.C = -1; return; } /*{ * _IO.Format = Header.Format = Format.X; * _IO.Offset = Header.Length; * _IO.Position = LITs.Offset; * LITs[i] = _IO.ReadCountPointerX<LIT>(); * } * if (_IO.IsX) IO.ReadInt64();*/ } for (i = 0; i < LITs.C; i++) { _IO.P = LITs[i].O; for (i0 = 0; i0 < LITs[i].C; i0++) { ref LIT lit = ref LITs.E[i].E[i0]; lit.Id = (Id )_IO.RI32E(); lit.Flags = (Flags)_IO.RI32E(); lit.Type = (Type )_IO.RI32E(); if (_IO.IsX) { _IO.RI64(); _IO.RI64(); _IO.RI64(); } lit.Ambient.X = _IO.RF32E(); lit.Ambient.Y = _IO.RF32E(); lit.Ambient.Z = _IO.RF32E(); lit.Ambient.W = _IO.RF32E(); lit.Diffuse.X = _IO.RF32E(); lit.Diffuse.Y = _IO.RF32E(); lit.Diffuse.Z = _IO.RF32E(); lit.Diffuse.W = _IO.RF32E(); lit.Specular.X = _IO.RF32E(); lit.Specular.Y = _IO.RF32E(); lit.Specular.Z = _IO.RF32E(); lit.Specular.W = _IO.RF32E(); lit.Position.X = _IO.RF32E(); lit.Position.Y = _IO.RF32E(); lit.Position.Z = _IO.RF32E(); lit.ToneCurve.X = _IO.RF32E(); lit.ToneCurve.Y = _IO.RF32E(); lit.ToneCurve.Z = _IO.RF32E(); if (_IO.IsX) { _IO.RI64(); _IO.RI64(); _IO.RI64(); _IO.RI64(); _IO.RI64(); _IO.RI32(); } } }
public void LITReader(string file) { IsX = false; LITs = default; byte[] litData = File.ReadAllBytes(file + ".lit"); Struct _LITC = litData.RSt(); litData = null; if (_LITC.Header.Signature != 0x4354494C) { return; } s = File.OpenReader(_LITC.Data); s.IsBE = _LITC.Header.UseBigEndian; s.RI32(); LITs = s.RCPE <LightStruct>(); if (LITs.C < 1) { s.C(); LITs.C = -1; return; } s.PI64 = LITs.O - _LITC.Header.Length; if (s.RI32() != 0) { s.PI64 = LITs.O - _LITC.Header.Length; for (i = 0; i < LITs.C; i++) { LITs.E[i] = new LightStruct { C0 = s.RI32E(), O0 = s.RI32E() } } ; for (i = 0; i < LITs.C; i++) { s.PI64 = LITs.E[i].O0 - _LITC.Header.Length; for (i0 = 0; i0 < LITs.E[i].C0; i0++) { ref LIT lit = ref LITs.E[i].E0[i0]; lit.Id = s.RI32E(); lit.Flags = (Flags)s.RI32E(); lit.Type = (Type )s.RI32E(); lit.Ambient.X = s.RF32E(); lit.Ambient.Y = s.RF32E(); lit.Ambient.Z = s.RF32E(); lit.Ambient.W = s.RF32E(); lit.Diffuse.X = s.RF32E(); lit.Diffuse.Y = s.RF32E(); lit.Diffuse.Z = s.RF32E(); lit.Diffuse.W = s.RF32E(); lit.Specular.X = s.RF32E(); lit.Specular.Y = s.RF32E(); lit.Specular.Z = s.RF32E(); lit.Specular.W = s.RF32E(); lit.Position.X = s.RF32E(); lit.Position.Y = s.RF32E(); lit.Position.Z = s.RF32E(); lit.ToneCurve.X = s.RF32E(); lit.ToneCurve.Y = s.RF32E(); lit.ToneCurve.Z = s.RF32E(); } } } else { IsX = true; s.PI64 = LITs.O; for (i = 0; i < LITs.C; i++) { LITs.E[i] = new LightStruct { C0 = s.RI32E(), C1 = s.RI32E(), O0 = (int)s.RI64E(), O1 = (int)s.RI64E() } } ; for (i = 0; i < LITs.C; i++) { s.P = LITs.E[i].O0; for (i0 = 0; i0 < LITs.E[i].C0; i0++) { ref LIT lit = ref LITs.E[i].E0[i0]; lit.Id = s.RI32E(); lit.Flags = (Flags)s.RI32E(); lit.Type = (Type )s.RI32E(); s.RI32(); long off = s.RI64(); lit.HasStr = s.RI64() != 0; lit.Unk10 = s.RI32(); lit.Ambient.X = s.RF32E(); lit.Ambient.Y = s.RF32E(); lit.Ambient.Z = s.RF32E(); lit.Ambient.W = s.RF32E(); lit.Diffuse.X = s.RF32E(); lit.Diffuse.Y = s.RF32E(); lit.Diffuse.Z = s.RF32E(); lit.Diffuse.W = s.RF32E(); lit.Specular.X = s.RF32E(); lit.Specular.Y = s.RF32E(); lit.Specular.Z = s.RF32E(); lit.Specular.W = s.RF32E(); lit.Position.X = s.RF32E(); lit.Position.Y = s.RF32E(); lit.Position.Z = s.RF32E(); lit.Unk01 = s.RF32(); lit.Unk02 = s.RF32(); lit.Unk03 = s.RF32(); lit.Unk04 = s.RF32(); lit.Unk05.X = s.RF32(); lit.Unk05.Y = s.RF32(); lit.Unk05.Z = s.RF32(); lit.ToneCurve.X = s.RF32E(); lit.ToneCurve.Y = s.RF32E(); lit.ToneCurve.Z = s.RF32E(); lit.Unk = s.RF32(); lit.Unk06 = s.RF32(); lit.Unk07 = s.RF32(); lit.Unk08 = s.RF32(); lit.Str = off > 0 ? s.RaO(off).ToSJIS() : ""; } s.P = LITs.E[i].O1; for (i0 = 0; i0 < LITs.E[i].C1; i0++) { ref LITX lit = ref LITs.E[i].E1[i0]; lit.C = s.RI32E(); s.RI32E(); lit.O = (int)s.RI64E(); } for (i0 = 0; i0 < LITs.E[i].C1; i0++) { ref LITX lit = ref LITs.E[i].E1[i0]; ref KeyValuePair <int, int>[] data = ref lit.E; data = new KeyValuePair <int, int> [lit.C]; s.P = lit.O; for (int i1 = 0; i1 < lit.C; i1++) { data[i1] = new KeyValuePair <int, int>(s.RI32E(), s.RI32E()); } }