Release v0.4.7.2
A3DA, BLT, CCT, DEX, DFT, LIT, Mot, SprDB
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using KKdBaseLib;
|
||||
|
||||
namespace KKdMainLib.F2nd
|
||||
namespace KKdBaseLib.F2
|
||||
{
|
||||
public struct ENRS
|
||||
{
|
||||
@@ -10,22 +8,13 @@ namespace KKdMainLib.F2nd
|
||||
public int Repeat;
|
||||
public SubENRS[] Sub;
|
||||
|
||||
public struct SubENRS
|
||||
{
|
||||
public int Skip;
|
||||
public int Reverse;
|
||||
public Type Type;
|
||||
|
||||
public override string ToString() => "Skip: " + Skip + "; Reverse: " + Reverse + "; Type: " + Type;
|
||||
}
|
||||
|
||||
public static unsafe ENRS[] Read(byte[] data)
|
||||
{
|
||||
byte* ptr = data.GetPtr();
|
||||
int i, i0;
|
||||
int ENRSCount = ((int*)ptr)[1];
|
||||
ENRS[] ENRSArr = new ENRS[ENRSCount];
|
||||
ptr = ptr + 0x10;
|
||||
ptr += 0x10;
|
||||
|
||||
ENRS ENR = new ENRS();
|
||||
for (i = 0; i < ENRSCount; i++)
|
||||
@@ -98,6 +87,15 @@ namespace KKdMainLib.F2nd
|
||||
Invalid = 0b11000000,
|
||||
}
|
||||
|
||||
public struct SubENRS
|
||||
{
|
||||
public int Skip;
|
||||
public int Reverse;
|
||||
public Type Type;
|
||||
|
||||
public override string ToString() => "Skip: " + Skip + "; Reverse: " + Reverse + "; Type: " + Type;
|
||||
}
|
||||
|
||||
public override string ToString() =>
|
||||
"Offset: " + Offset + "; Count: " + Count + "; " + "Size: " + Size + "; Repeat: " + Repeat;
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using KKdBaseLib;
|
||||
|
||||
namespace KKdMainLib.F2nd
|
||||
namespace KKdBaseLib.F2
|
||||
{
|
||||
public struct Header
|
||||
{
|
||||
@@ -1,6 +1,4 @@
|
||||
using KKdBaseLib;
|
||||
|
||||
namespace KKdMainLib.F2nd
|
||||
namespace KKdBaseLib.F2
|
||||
{
|
||||
public struct POF
|
||||
{
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace KKdBaseLib.F2
|
||||
{
|
||||
public struct Struct
|
||||
{
|
||||
public Header Header;
|
||||
public byte[] Data;
|
||||
public Struct[] SubStructs;
|
||||
public bool EOFC;
|
||||
public ENRS[] ENRS;
|
||||
public KKdList<long> POF;
|
||||
|
||||
public long DataOffset;
|
||||
|
||||
public override string ToString() => Header.ToString() + (SubStructs != null ?
|
||||
"; SubStructs: " + SubStructs.Length : "") + (ENRS != null ? "; Has ENRS" : "") +
|
||||
(POF.NotNull ? "; Has POF" : "") + (EOFC ? "; Has EOFC" : "");
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ namespace KKdBaseLib
|
||||
|
||||
public static explicit operator ushort(Half bits) => bits._value;
|
||||
|
||||
public static explicit operator float(Half h) => (float)(double)h;
|
||||
|
||||
public static explicit operator double(Half h)
|
||||
{
|
||||
if (h._value == 0x0000) return +0;
|
||||
@@ -29,6 +31,8 @@ namespace KKdBaseLib
|
||||
return d;
|
||||
}
|
||||
|
||||
public static explicit operator Half( float val) => (Half)(double)val;
|
||||
|
||||
public static explicit operator Half(double val)
|
||||
{
|
||||
Half h = new Half();
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
namespace KKdBaseLib
|
||||
{
|
||||
public interface IKF<TKey, TVal>
|
||||
{
|
||||
TKey F { get; set; }
|
||||
|
||||
IKF<TKey, TVal> Check();
|
||||
string ToString();
|
||||
string ToString(bool Brackets);
|
||||
}
|
||||
|
||||
public struct KFT0<TKey, TVal> : IKF<TKey, TVal>
|
||||
{
|
||||
public TKey F { get; set; }
|
||||
|
||||
public KFT0(TKey F = default)
|
||||
{ this.F = F; }
|
||||
|
||||
public KFT0<TKey, TVal> ToT0() => this;
|
||||
public KFT1<TKey, TVal> ToT1() => new KFT1<TKey, TVal>(F);
|
||||
public KFT2<TKey, TVal> ToT2() => new KFT2<TKey, TVal>(F);
|
||||
public KFT3<TKey, TVal> ToT3() => new KFT3<TKey, TVal>(F);
|
||||
|
||||
public IKF<TKey, TVal> Check() => this;
|
||||
|
||||
public override string ToString() => ToString(true);
|
||||
public string ToString(bool Brackets = true) =>
|
||||
Extensions.ToString(F);
|
||||
}
|
||||
|
||||
public struct KFT1<TKey, TVal> : IKF<TKey, TVal>
|
||||
{
|
||||
public TKey F { get; set; }
|
||||
public TVal V;
|
||||
|
||||
public KFT1(TKey F = default, TVal V = default)
|
||||
{ this.F = F; this.V = V; }
|
||||
|
||||
public KFT0<TKey, TVal> ToT0() => new KFT0<TKey, TVal>(F);
|
||||
public KFT1<TKey, TVal> ToT1() => this;
|
||||
public KFT2<TKey, TVal> ToT2() => new KFT2<TKey, TVal>(F, V);
|
||||
public KFT3<TKey, TVal> ToT3() => new KFT3<TKey, TVal>(F, V);
|
||||
|
||||
public IKF<TKey, TVal> Check() =>
|
||||
V.Equals(default(TVal)) ? (IKF<TKey, TVal>)ToT0() : this;
|
||||
|
||||
public override string ToString() => ToString(true);
|
||||
public string ToString(bool Brackets = true) =>
|
||||
(Brackets ? "(" : "") + Extensions.ToString(F) + "," +
|
||||
Extensions.ToString(V) + (Brackets ? ")" : "");
|
||||
}
|
||||
|
||||
public struct KFT2<TKey, TVal> : IKF<TKey, TVal>
|
||||
{
|
||||
public TKey F { get; set; }
|
||||
public TVal V;
|
||||
public TVal T;
|
||||
|
||||
public KFT2(TKey F = default, TVal V = default, TVal T = default)
|
||||
{ this.F = F; this.V = V; this.T = T; }
|
||||
|
||||
public KFT0<TKey, TVal> ToT0() => new KFT0<TKey, TVal>(F);
|
||||
public KFT1<TKey, TVal> ToT1() => new KFT1<TKey, TVal>(F, V);
|
||||
public KFT2<TKey, TVal> ToT2() => this;
|
||||
public KFT3<TKey, TVal> ToT3() => new KFT3<TKey, TVal>(F, V, T, T);
|
||||
|
||||
public KFT3<TKey, TVal> ToT3(IKF<TKey, TVal> Previous) =>
|
||||
Previous is KFT2<TKey, TVal> PreviousT2 ?
|
||||
new KFT3<TKey, TVal>(F, V, PreviousT2.T, T) :
|
||||
new KFT3<TKey, TVal>(F, V, T, T);
|
||||
|
||||
public IKF<TKey, TVal> Check() =>
|
||||
T.Equals(default(TVal)) ? (V.Equals(default(TVal)) ?
|
||||
(IKF<TKey, TVal>)ToT0() : ToT1()) : this;
|
||||
|
||||
public override string ToString() => ToString(true);
|
||||
public string ToString(bool Brackets) =>
|
||||
(Brackets ? "(" : "") + Extensions.ToString(F) + "," + Extensions.
|
||||
ToString(V) + "," + Extensions.ToString(T) + (Brackets ? ")" : "");
|
||||
}
|
||||
|
||||
public struct KFT3<TKey, TVal> : IKF<TKey, TVal>
|
||||
{
|
||||
public TKey F { get; set; }
|
||||
public TVal V;
|
||||
public TVal T1;
|
||||
public TVal T2;
|
||||
|
||||
public KFT3(TKey F = default, TVal V = default, TVal T1 = default, TVal T2 = default)
|
||||
{ this.F = F; this.V = V; this.T1 = T1; this.T2 = T2; }
|
||||
|
||||
public KFT0<TKey, TVal> ToT0() => new KFT0<TKey, TVal>(F);
|
||||
public KFT1<TKey, TVal> ToT1() => new KFT1<TKey, TVal>(F, V);
|
||||
public KFT2<TKey, TVal> ToT2() => new KFT2<TKey, TVal>(F, V, T1);
|
||||
public KFT3<TKey, TVal> ToT3() => this;
|
||||
|
||||
public IKF<TKey, TVal> Check() =>
|
||||
T1.Equals(default(TVal)) && T2.Equals(default(TVal)) ?
|
||||
(V.Equals(default(TVal)) ? ToT0() : (IKF<TKey, TVal>)ToT1()) :
|
||||
T1.Equals(T2) ? (IKF<TKey, TVal>)ToT2() : this;
|
||||
|
||||
public override string ToString() => ToString(true);
|
||||
public string ToString(bool Brackets) =>
|
||||
(Brackets ? "(" : "") + Extensions.ToString(F) + "," + Extensions.ToString(V) + "," +
|
||||
Extensions.ToString(T1) + "," + Extensions.ToString(T2) + (Brackets ? ")" : "");
|
||||
|
||||
public IKF<TKey, TVal> ToT2(IKF<TKey, TVal> Previous, out IKF<TKey, TVal> Current)
|
||||
{
|
||||
Current = Previous is KFT2<TKey, TVal> PreviousT2
|
||||
? new KFT2<TKey, TVal>(PreviousT2.F, PreviousT2.V, T1)
|
||||
: new KFT2<TKey, TVal>(F, V, T1);
|
||||
return new KFT2<TKey, TVal>(F, V, T2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
namespace KKdBaseLib
|
||||
{
|
||||
public interface IKeyFrame<TKey, TVal>
|
||||
{
|
||||
TKey Frame { get; set; }
|
||||
|
||||
IKeyFrame<TKey, TVal> Check();
|
||||
IKeyFrame<TKey, TVal> ToKeyFrameT0();
|
||||
IKeyFrame<TKey, TVal> ToKeyFrameT1();
|
||||
IKeyFrame<TKey, TVal> ToKeyFrameT2();
|
||||
IKeyFrame<TKey, TVal> ToKeyFrameT3();
|
||||
string ToString();
|
||||
string ToString(bool Brackets);
|
||||
}
|
||||
|
||||
public struct KeyFrameT0<TKey, TVal> : IKeyFrame<TKey, TVal>
|
||||
{
|
||||
public TKey Frame { get; set; }
|
||||
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT0() =>
|
||||
new KeyFrameT0<TKey, TVal> { Frame = Frame };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT1() =>
|
||||
new KeyFrameT1<TKey, TVal> { Frame = Frame };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT2() =>
|
||||
new KeyFrameT2<TKey, TVal> { Frame = Frame };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT3() =>
|
||||
new KeyFrameT3<TKey, TVal> { Frame = Frame };
|
||||
|
||||
public IKeyFrame<TKey, TVal> Check() => this;
|
||||
|
||||
public override string ToString() =>
|
||||
Extensions.ToString(Frame);
|
||||
public string ToString(bool Brackets) =>
|
||||
Extensions.ToString(Frame);
|
||||
}
|
||||
|
||||
public struct KeyFrameT1<TKey, TVal> : IKeyFrame<TKey, TVal>
|
||||
{
|
||||
public TKey Frame { get; set; }
|
||||
public TVal Value;
|
||||
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT0() =>
|
||||
new KeyFrameT0<TKey, TVal> { Frame = Frame };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT1() =>
|
||||
new KeyFrameT1<TKey, TVal> { Frame = Frame, Value = Value };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT2() =>
|
||||
new KeyFrameT2<TKey, TVal> { Frame = Frame, Value = Value };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT3() =>
|
||||
new KeyFrameT3<TKey, TVal> { Frame = Frame, Value = Value };
|
||||
|
||||
public IKeyFrame<TKey, TVal> Check() =>
|
||||
Value.Equals(default(TVal)) ? ToKeyFrameT0() : (this);
|
||||
|
||||
public override string ToString() => ToString(true);
|
||||
public string ToString(bool Brackets) =>
|
||||
(Brackets ? "(" : "") + Extensions.ToString(Frame) + "," +
|
||||
Extensions.ToString(Value) + (Brackets ? ")" : "");
|
||||
}
|
||||
|
||||
public struct KeyFrameT2<TKey, TVal> : IKeyFrame<TKey, TVal>
|
||||
{
|
||||
public TKey Frame { get; set; }
|
||||
public TVal Value;
|
||||
public TVal Interpolation;
|
||||
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT0() =>
|
||||
new KeyFrameT0<TKey, TVal> { Frame = Frame };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT1() =>
|
||||
new KeyFrameT1<TKey, TVal> { Frame = Frame, Value = Value };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT2() =>
|
||||
new KeyFrameT2<TKey, TVal> { Frame = Frame, Value = Value,
|
||||
Interpolation = Interpolation};
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT3() =>
|
||||
new KeyFrameT3<TKey, TVal> { Frame = Frame, Value = Value,
|
||||
Interpolation1 = Interpolation, Interpolation2 = Interpolation };
|
||||
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT3(IKeyFrame<TKey, TVal> Previous) =>
|
||||
Previous is KeyFrameT2<TKey, TVal> PreviousT2 ?
|
||||
new KeyFrameT3<TKey, TVal> { Frame = Frame, Value = Value,
|
||||
Interpolation1 = PreviousT2.Interpolation, Interpolation2 = Interpolation } :
|
||||
new KeyFrameT3<TKey, TVal> { Frame = Frame, Value = Value,
|
||||
Interpolation1 = Interpolation, Interpolation2 = Interpolation };
|
||||
|
||||
public IKeyFrame<TKey, TVal> Check()
|
||||
{
|
||||
if (Value.Equals(default(TVal)) && Interpolation.Equals(default(TVal))) return ToKeyFrameT0();
|
||||
else if ( Interpolation.Equals(default(TVal))) return ToKeyFrameT1();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override string ToString() => ToString(true);
|
||||
public string ToString(bool Brackets) =>
|
||||
(Brackets ? "(" : "") + Extensions.ToString(Frame) + "," + Extensions.
|
||||
ToString(Value) + "," + Extensions.ToString(Interpolation) + (Brackets ? ")" : "");
|
||||
}
|
||||
|
||||
public struct KeyFrameT3<TKey, TVal> : IKeyFrame<TKey, TVal>
|
||||
{
|
||||
public TKey Frame { get; set; }
|
||||
public TVal Value;
|
||||
public TVal Interpolation1;
|
||||
public TVal Interpolation2;
|
||||
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT0() =>
|
||||
new KeyFrameT0<TKey, TVal> { Frame = Frame };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT1() =>
|
||||
new KeyFrameT1<TKey, TVal> { Frame = Frame, Value = Value };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT2() =>
|
||||
new KeyFrameT2<TKey, TVal> { Frame = Frame, Value = Value, Interpolation = Interpolation1 };
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT3() =>
|
||||
new KeyFrameT3<TKey, TVal> { Frame = Frame, Value = Value,
|
||||
Interpolation1 = Interpolation1, Interpolation2 = Interpolation2 };
|
||||
|
||||
public IKeyFrame<TKey, TVal> Check()
|
||||
{
|
||||
if (Value.Equals(default(TVal)) && Interpolation1.Equals(default(TVal)) &&
|
||||
Interpolation2.Equals(default(TVal))) return ToKeyFrameT0();
|
||||
else if (Interpolation1.Equals(default(TVal)) &&
|
||||
Interpolation2.Equals(default(TVal))) return ToKeyFrameT1();
|
||||
else if (Interpolation1.Equals(Interpolation2))
|
||||
return ToKeyFrameT2();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override string ToString() => ToString(true);
|
||||
public string ToString(bool Brackets) =>
|
||||
(Brackets ? "(" : "") + Extensions.ToString(Frame) + "," + Extensions.ToString(Value) + "," +
|
||||
Extensions.ToString(Interpolation1) + "," + Extensions.ToString(Interpolation2) + (Brackets ? ")" : "");
|
||||
|
||||
public IKeyFrame<TKey, TVal> ToKeyFrameT2(IKeyFrame<TKey, TVal>
|
||||
Previous, out IKeyFrame<TKey, TVal> Current)
|
||||
{
|
||||
Current = Previous is KeyFrameT2<TKey, TVal> PreviousT2
|
||||
? new KeyFrameT2<TKey, TVal> { Frame = PreviousT2.Frame,
|
||||
Value = PreviousT2.Value, Interpolation = Interpolation1 }
|
||||
: new KeyFrameT2<TKey, TVal> { Frame = Frame,
|
||||
Value = Value, Interpolation = Interpolation1 };
|
||||
return new KeyFrameT2<TKey, TVal> { Frame = Frame,
|
||||
Value = Value, Interpolation = Interpolation2 };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,11 +39,15 @@
|
||||
<NoWarn>IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="F2\ENRS.cs" />
|
||||
<Compile Include="F2\Header.cs" />
|
||||
<Compile Include="F2\POF.cs" />
|
||||
<Compile Include="F2\Struct.cs" />
|
||||
<Compile Include="DCC.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="Format.cs" />
|
||||
<Compile Include="Half.cs" />
|
||||
<Compile Include="IKeyFrame.cs" />
|
||||
<Compile Include="IKF.cs" />
|
||||
<Compile Include="KKdList.cs" />
|
||||
<Compile Include="MsgPack.cs" />
|
||||
<Compile Include="Pointer.cs" />
|
||||
|
||||
+120
-24
@@ -119,30 +119,126 @@ namespace KKdBaseLib
|
||||
public float ReadSingle(string Name) => ReadNSingle(Name).GetValueOrDefault();
|
||||
public double ReadDouble(string Name) => ReadNDouble(Name).GetValueOrDefault();
|
||||
|
||||
public bool? ReadNBoolean(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack.ReadNBoolean() : null;
|
||||
public sbyte? ReadNInt8(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNInt8 () : null;
|
||||
public byte? ReadNUInt8(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNUInt8 () : null;
|
||||
public short? ReadNInt16(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNInt16() : null;
|
||||
public ushort? ReadNUInt16(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNUInt16() : null;
|
||||
public int? ReadNInt32(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNInt32() : null;
|
||||
public uint? ReadNUInt32(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNUInt32() : null;
|
||||
public long? ReadNInt64(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNInt64() : null;
|
||||
public ulong? ReadNUInt64(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNUInt64() : null;
|
||||
public float? ReadNSingle(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNSingle() : null;
|
||||
public double? ReadNDouble(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadNDouble() : null;
|
||||
public string ReadString(string Name) =>
|
||||
Element(Name, out MsgPack MsgPack) ? MsgPack. ReadString() : null;
|
||||
public bool? ReadNBoolean(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is bool Boolean) return Boolean;
|
||||
return null;
|
||||
}
|
||||
public sbyte? ReadNInt8(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return ( sbyte) UInt8 ;
|
||||
return null;
|
||||
}
|
||||
public byte? ReadNUInt8(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return ( byte) Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
return null;
|
||||
}
|
||||
public short? ReadNInt16(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
else if (MsgPack.Object is short Int16) return Int16;
|
||||
else if (MsgPack.Object is ushort UInt16) return ( short) UInt16;
|
||||
return null;
|
||||
}
|
||||
public ushort? ReadNUInt16(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return (ushort) Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
else if (MsgPack.Object is short Int16) return (ushort) Int16;
|
||||
else if (MsgPack.Object is ushort UInt16) return UInt16;
|
||||
return null;
|
||||
}
|
||||
public int? ReadNInt32(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
else if (MsgPack.Object is short Int16) return Int16;
|
||||
else if (MsgPack.Object is ushort UInt16) return UInt16;
|
||||
else if (MsgPack.Object is int Int32) return Int32;
|
||||
else if (MsgPack.Object is uint UInt32) return ( int) UInt32;
|
||||
return null;
|
||||
}
|
||||
public uint? ReadNUInt32(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return ( uint) Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
else if (MsgPack.Object is short Int16) return ( uint) Int16;
|
||||
else if (MsgPack.Object is ushort UInt16) return UInt16;
|
||||
else if (MsgPack.Object is int Int32) return ( uint) Int32;
|
||||
else if (MsgPack.Object is uint UInt32) return UInt32;
|
||||
return null;
|
||||
}
|
||||
public long? ReadNInt64(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
else if (MsgPack.Object is short Int16) return Int16;
|
||||
else if (MsgPack.Object is ushort UInt16) return UInt16;
|
||||
else if (MsgPack.Object is int Int32) return Int32;
|
||||
else if (MsgPack.Object is uint UInt32) return UInt32;
|
||||
else if (MsgPack.Object is long Int64) return Int64;
|
||||
else if (MsgPack.Object is ulong UInt64) return ( long) UInt64;
|
||||
return null;
|
||||
}
|
||||
public ulong? ReadNUInt64(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return ( ulong) Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
else if (MsgPack.Object is short Int16) return ( ulong) Int16;
|
||||
else if (MsgPack.Object is ushort UInt16) return UInt16;
|
||||
else if (MsgPack.Object is int Int32) return ( ulong) Int32;
|
||||
else if (MsgPack.Object is uint UInt32) return UInt32;
|
||||
else if (MsgPack.Object is long Int64) return ( ulong) Int64;
|
||||
else if (MsgPack.Object is ulong UInt64) return UInt64;
|
||||
return null;
|
||||
}
|
||||
public float? ReadNSingle(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
else if (MsgPack.Object is short Int16) return Int16;
|
||||
else if (MsgPack.Object is ushort UInt16) return UInt16;
|
||||
else if (MsgPack.Object is int Int32) return Int32;
|
||||
else if (MsgPack.Object is uint UInt32) return UInt32;
|
||||
else if (MsgPack.Object is long Int64) return Int64;
|
||||
else if (MsgPack.Object is float Float32) return Float32;
|
||||
else if (MsgPack.Object is double Float64) return ( float)Float64;
|
||||
return null;
|
||||
}
|
||||
public double? ReadNDouble(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is sbyte Int8 ) return Int8 ;
|
||||
else if (MsgPack.Object is byte UInt8 ) return UInt8 ;
|
||||
else if (MsgPack.Object is short Int16) return Int16;
|
||||
else if (MsgPack.Object is ushort UInt16) return UInt16;
|
||||
else if (MsgPack.Object is int Int32) return Int32;
|
||||
else if (MsgPack.Object is uint UInt32) return UInt32;
|
||||
else if (MsgPack.Object is long Int64) return Int64;
|
||||
else if (MsgPack.Object is float Float32) return Float32;
|
||||
else if (MsgPack.Object is double Float64) return Float64;
|
||||
return null;
|
||||
}
|
||||
public string ReadString(string Name)
|
||||
{
|
||||
if (Element(Name, out MsgPack MsgPack))
|
||||
if (MsgPack.Object is string String) return String;
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool ReadBoolean() => ReadNBoolean().GetValueOrDefault();
|
||||
public sbyte ReadInt8() => ReadNInt8().GetValueOrDefault();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public struct CountPointer<T>
|
||||
{
|
||||
public int Count { get => Entries != null ? Entries.Length : 0;
|
||||
set => Entries = new T[value]; }
|
||||
set => Entries = value < 0 ? null : new T[value]; }
|
||||
public int Offset;
|
||||
public T[] Entries;
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("437F63F1-8C23-429E-AB14-38B85C9EDB16")]
|
||||
[assembly: AssemblyVersion("0.0.1.1")]
|
||||
[assembly: AssemblyFileVersion("0.0.1.1")]
|
||||
[assembly: AssemblyVersion("0.4.7.2")]
|
||||
[assembly: AssemblyFileVersion("0.4.7.2")]
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
public bool Equals(Vector3 other) =>
|
||||
X == other.X && Y == other.Y && Z == other.Z;
|
||||
|
||||
public override string ToString() => "X: " + X + "; Y: " + Y + "; Z: " + Z;
|
||||
public override string ToString() => $"{X},{Y},{Z}";
|
||||
public string ToString(int d) => $"{X.Round(d)},{Y.Round(d)},{Z.Round(d)}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
public bool Equals(Vector4 other) =>
|
||||
X == other.X && Y == other.Y && Z == other.Z && W == other.W;
|
||||
|
||||
public override string ToString() => "X: " + X + "; Y: " + Y + "; Z: " + Z + "; W: " + W;
|
||||
public override string ToString() => $"{X},{Y},{Z},{W}";
|
||||
public string ToString(int d) => $"{X.Round(d)},{Y.Round(d)},{Z.Round(d)},{W.Round(d)}";
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
+151
-197
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2nd;
|
||||
using Extensions = KKdBaseLib.Extensions;
|
||||
|
||||
namespace KKdMainLib.A3DA
|
||||
@@ -1252,13 +1252,13 @@ namespace KKdMainLib.A3DA
|
||||
|
||||
private void Write(ref Key Key, bool F16 = false)
|
||||
{
|
||||
if (Key == null) return;
|
||||
if (Key == null || Key.Type == null) return;
|
||||
|
||||
int i = 0;
|
||||
if (Key.Trans != null)
|
||||
{
|
||||
Key.BinOffset = IO.Position;
|
||||
int Type = Key.Type.Value;
|
||||
int Type = (int)Key.Type & 0xFF;
|
||||
if (Key.EPTypePost.HasValue) Type |= (Key.EPTypePost.Value & 0xF) << 12;
|
||||
if (Key.EPTypePre .HasValue) Type |= (Key.EPTypePre .Value & 0xF) << 8;
|
||||
IO.Write(Type);
|
||||
@@ -1267,46 +1267,15 @@ namespace KKdMainLib.A3DA
|
||||
IO.Write(Key.Trans.Length);
|
||||
for (i = 0; i < Key.Trans.Length; i++)
|
||||
{
|
||||
if (Key.Trans[i] is KeyFrameT0<double, double> TransT0)
|
||||
{
|
||||
if (F16 && CompressF16 > 0)
|
||||
{ IO.Write((ushort)TransT0.Frame); IO.Write((ushort)0); }
|
||||
else
|
||||
{ IO.Write(( float)TransT0.Frame); IO.Write(( float)0); }
|
||||
if (F16 && CompressF16 == 2) IO.Write(0 );
|
||||
else IO.Write(0L);
|
||||
}
|
||||
else if (Key.Trans[i] is KeyFrameT1<double, double> TransT1)
|
||||
{
|
||||
if (F16 && CompressF16 > 0)
|
||||
{ IO.Write((ushort)TransT1.Frame); IO.Write(( Half)TransT1.Value); }
|
||||
else
|
||||
{ IO.Write(( float)TransT1.Frame); IO.Write((float)TransT1.Value); }
|
||||
if (F16 && CompressF16 == 2) IO.Write(0 );
|
||||
else IO.Write(0L);
|
||||
}
|
||||
else if (Key.Trans[i] is KeyFrameT2<double, double> TransT2)
|
||||
{
|
||||
if (F16 && CompressF16 > 0)
|
||||
{ IO.Write((ushort)TransT2.Frame); IO.Write(( Half)TransT2.Value); }
|
||||
else
|
||||
{ IO.Write(( float)TransT2.Frame); IO.Write((float)TransT2.Value); }
|
||||
if (F16 && CompressF16 == 2)
|
||||
{ IO.Write(( Half)TransT2.Interpolation); IO.Write(( Half)TransT2.Interpolation); }
|
||||
else
|
||||
{ IO.Write(( float)TransT2.Interpolation); IO.Write((float)TransT2.Interpolation); }
|
||||
}
|
||||
else if (Key.Trans[i] is KeyFrameT3<double, double> TransT3)
|
||||
{
|
||||
if (F16 && CompressF16 > 0)
|
||||
{ IO.Write((ushort)TransT3.Frame); IO.Write(( Half)TransT3.Value); }
|
||||
else
|
||||
{ IO.Write(( float)TransT3.Frame); IO.Write((float)TransT3.Value); }
|
||||
if (F16 && CompressF16 == 2)
|
||||
{ IO.Write(( Half)TransT3.Interpolation1); IO.Write(( Half)TransT3.Interpolation2); }
|
||||
else
|
||||
{ IO.Write(( float)TransT3.Interpolation1); IO.Write((float)TransT3.Interpolation2); }
|
||||
}
|
||||
ref KFT3<double, double> KF = ref Key.Trans[i];
|
||||
if (F16 && CompressF16 > 0)
|
||||
{ IO.Write((ushort)KF.F ); IO.Write(( Half)KF.V ); }
|
||||
else
|
||||
{ IO.Write(( float)KF.F ); IO.Write((float)KF.V ); }
|
||||
if (F16 && CompressF16 == 2)
|
||||
{ IO.Write(( Half)KF.T1); IO.Write(( Half)KF.T2); }
|
||||
else
|
||||
{ IO.Write(( float)KF.T1); IO.Write((float)KF.T2); }
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1314,8 +1283,8 @@ namespace KKdMainLib.A3DA
|
||||
if (!UsedValues.ContainsValue(Key.Value) || !A3DCOpt)
|
||||
{
|
||||
Key.BinOffset = IO.Position;
|
||||
IO.Write( Key.Type );
|
||||
IO.Write((float?)Key.Value);
|
||||
IO.Write(( int)Key.Type );
|
||||
IO.Write((float)Key.Value);
|
||||
if (A3DCOpt)
|
||||
{ UsedValues.Add(Key.BinOffset, Key.Value); }
|
||||
return;
|
||||
@@ -1328,7 +1297,7 @@ namespace KKdMainLib.A3DA
|
||||
public void MsgPackReader(string file, bool JSON)
|
||||
{
|
||||
MsgPack MsgPack = file.ReadMPAllAtOnce(JSON);
|
||||
if (!MsgPack.Element("A3D", out MsgPack A3D)) { MsgPack = MsgPack.New; return; }
|
||||
if (!MsgPack.Element("A3D", out MsgPack A3D)) { MsgPack.Dispose(); return; }
|
||||
MsgPackReader(A3D);
|
||||
}
|
||||
|
||||
@@ -1989,14 +1958,13 @@ namespace KKdMainLib.A3DA
|
||||
public static Key ReadKey(this Dictionary<string, object> Dict, string Temp)
|
||||
{
|
||||
Key Key = new Key();
|
||||
Dict.FindValue(out Key.BinOffset, Temp + BO );
|
||||
Dict.FindValue(out Key.Type , Temp + "type");
|
||||
if ( Dict.FindValue(out Key.BinOffset, Temp + BO )) return Key;
|
||||
if (!Dict.FindValue(out int Type , Temp + "type")) return null;
|
||||
|
||||
if (Key.BinOffset == null && Key.Type == null) return null;
|
||||
if (Key.Type == null) return Key;
|
||||
if (Key.Type == 0x0000) return Key;
|
||||
|
||||
if (Key.Type == 0x0001) { Dict.FindValue(out Key.Value, Temp + "value"); return Key; }
|
||||
if (Key.BinOffset != null) return null;
|
||||
Key.Type = (Key.Interpolation)Type;
|
||||
if (Type == 0x0000) return Key;
|
||||
if (Type == 0x0001) { Dict.FindValue(out Key.Value, Temp + "value"); return Key; }
|
||||
|
||||
int i = 0;
|
||||
Dict.FindValue(out Key.EPTypePost, Temp + "ep_type_post");
|
||||
@@ -2006,66 +1974,60 @@ namespace KKdMainLib.A3DA
|
||||
if (Dict.StartsWith(Temp + "raw_data"))
|
||||
Dict.FindValue(out Key.RawData.KeyType, Temp + "raw_data_key_type");
|
||||
|
||||
if (Key.Length != null)
|
||||
{
|
||||
int Type;
|
||||
Key.Trans = new IKeyFrame<double, double>[(int)Key.Length];
|
||||
for (i = 0; i < Key.Length; i++)
|
||||
if (Dict.FindValue(out value, Temp + "key" + d + i + d + "data"))
|
||||
{
|
||||
dataArray = value.Replace("(", "").Replace(")", "").Split(',');
|
||||
Type = dataArray.Length - 1;
|
||||
if (Type == 0) Key.Trans[i] = new KeyFrameT0<double, double>
|
||||
{ Frame = dataArray[0].ToDouble() };
|
||||
else if (Type == 1) Key.Trans[i] = new KeyFrameT1<double, double>
|
||||
{ Frame = dataArray[0].ToDouble(), Value = dataArray[1].ToDouble() };
|
||||
else if (Type == 2) Key.Trans[i] = new KeyFrameT2<double, double>
|
||||
{ Frame = dataArray[0].ToDouble(), Value = dataArray[1].ToDouble(),
|
||||
Interpolation = dataArray[2].ToDouble() };
|
||||
else if (Type == 3) Key.Trans[i] = new KeyFrameT3<double, double>
|
||||
{ Frame = dataArray[0].ToDouble(), Value = dataArray[1].ToDouble(),
|
||||
Interpolation1 = dataArray[2].ToDouble(),
|
||||
Interpolation2 = dataArray[3].ToDouble() };
|
||||
Key.Trans[i] = Key.Trans[i].Check();
|
||||
}
|
||||
}
|
||||
else if (Key.RawData.KeyType != null)
|
||||
if (Key.RawData.KeyType != 0)
|
||||
{
|
||||
ref string[] ValueList = ref Key.RawData.ValueList;
|
||||
Dict.FindValue(out Key.RawData.ValueType, Temp + "raw_data.value_type");
|
||||
if (Dict.FindValue(out value, Temp + "raw_data.value_list"))
|
||||
Key.RawData.ValueList = value.Split(',');
|
||||
ValueList = value.Split(',');
|
||||
Dict.FindValue(out Key.RawData.ValueListSize, Temp + "raw_data.value_list_size");
|
||||
value = "";
|
||||
|
||||
int DS = (int)Key.RawData.KeyType + 1;
|
||||
int DS = Key.RawData.KeyType + 1;
|
||||
Key.Length = Key.RawData.ValueListSize / DS;
|
||||
Key.Trans = new IKeyFrame<double, double>[(int)Key.Length];
|
||||
Key.Trans = new KFT3<double, double>[Key.Length];
|
||||
if (Key.RawData.KeyType == 0)
|
||||
for (i = 0; i < Key.Length; i++)
|
||||
Key.Trans[i] = new KeyFrameT0<double, double>
|
||||
{ Frame = Key.RawData.ValueList[i * DS + 0].ToDouble() }.Check();
|
||||
Key.Trans[i] = new KFT3<double, double>
|
||||
(ValueList[i * DS + 0].ToDouble());
|
||||
else if (Key.RawData.KeyType == 1)
|
||||
for (i = 0; i < Key.Length; i++)
|
||||
Key.Trans[i] = new KeyFrameT1<double, double>
|
||||
{ Frame = Key.RawData.ValueList[i * DS + 0].ToDouble(),
|
||||
Value = Key.RawData.ValueList[i * DS + 1].ToDouble() }.Check();
|
||||
Key.Trans[i] = new KFT3<double, double>
|
||||
(ValueList[i * DS + 0].ToDouble(), ValueList[i * DS + 1].ToDouble());
|
||||
else if (Key.RawData.KeyType == 2)
|
||||
for (i = 0; i < Key.Length; i++)
|
||||
Key.Trans[i] = new KeyFrameT2<double, double>
|
||||
{ Frame = Key.RawData.ValueList[i * DS + 0].ToDouble(),
|
||||
Value = Key.RawData.ValueList[i * DS + 1].ToDouble(),
|
||||
Interpolation = Key.RawData.ValueList[i * DS + 2].ToDouble() }.Check();
|
||||
Key.Trans[i] = new KFT3<double, double>
|
||||
(ValueList[i * DS + 0].ToDouble(), ValueList[i * DS + 1].ToDouble(),
|
||||
ValueList[i * DS + 2].ToDouble(), ValueList[i * DS + 2].ToDouble());
|
||||
else if (Key.RawData.KeyType == 3)
|
||||
for (i = 0; i < Key.Length; i++)
|
||||
Key.Trans[i] = new KeyFrameT3<double, double>
|
||||
{ Frame = Key.RawData.ValueList[i * DS + 0].ToDouble(),
|
||||
Value = Key.RawData.ValueList[i * DS + 1].ToDouble(),
|
||||
Interpolation1 = Key.RawData.ValueList[i * DS + 2].ToDouble(),
|
||||
Interpolation2 = Key.RawData.ValueList[i * DS + 3].ToDouble() }.Check();
|
||||
Key.Trans[i] = new KFT3<double, double>
|
||||
(ValueList[i * DS + 0].ToDouble(), ValueList[i * DS + 1].ToDouble(),
|
||||
ValueList[i * DS + 2].ToDouble(), ValueList[i * DS + 3].ToDouble());
|
||||
|
||||
for (i = 0; i < Key.Length; i++) Key.Trans[i].Check();
|
||||
Key.RawData.ValueList = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Key.Trans = new KFT3<double, double>[Key.Length];
|
||||
for (i = 0; i < Key.Length; i++)
|
||||
{
|
||||
if (!Dict.FindValue(out value, Temp + "key" + d + i + d + "data")) continue;
|
||||
|
||||
dataArray = value.Replace("(", "").Replace(")", "").Split(',');
|
||||
Type = dataArray.Length - 1;
|
||||
if (Type == 0) Key.Trans[i] = new KFT3<double, double>
|
||||
(dataArray[0].ToDouble());
|
||||
else if (Type == 1) Key.Trans[i] = new KFT3<double, double>
|
||||
(dataArray[0].ToDouble(), dataArray[1].ToDouble());
|
||||
else if (Type == 2) Key.Trans[i] = new KFT3<double, double>
|
||||
(dataArray[0].ToDouble(), dataArray[1].ToDouble(),
|
||||
dataArray[2].ToDouble(), dataArray[2].ToDouble());
|
||||
else if (Type == 3) Key.Trans[i] = new KFT3<double, double>
|
||||
(dataArray[0].ToDouble(), dataArray[1].ToDouble(),
|
||||
dataArray[2].ToDouble(), dataArray[3].ToDouble());
|
||||
}
|
||||
}
|
||||
return Key;
|
||||
}
|
||||
|
||||
@@ -2105,7 +2067,7 @@ namespace KKdMainLib.A3DA
|
||||
|
||||
public static void Write(this Stream IO, Key Key, string Temp, bool A3DC = false)
|
||||
{
|
||||
if (Key == null) return;
|
||||
if (Key == null || Key.Type == null) return;
|
||||
|
||||
if (A3DC) { IO.Write(Temp + BO + "=", Key.BinOffset); return; }
|
||||
|
||||
@@ -2113,69 +2075,65 @@ namespace KKdMainLib.A3DA
|
||||
if (Key.Trans != null)
|
||||
if (Key.Trans.Length == 0)
|
||||
{
|
||||
IO.Write(Temp + "type=", Key.Type);
|
||||
IO.Write(Temp + "type=", (int)Key.Type);
|
||||
if (Key.Type > 0) IO.Write(Temp + "value=", Key.Value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Key.EPTypePost != null) IO.Write(Temp + "ep_type_post=", Key.EPTypePost);
|
||||
if (Key.EPTypePre != null) IO.Write(Temp + "ep_type_pre=" , Key.EPTypePre );
|
||||
if (Key.RawData.KeyType == null && Key.Trans != null)
|
||||
if (Key.RawData.KeyType == 0 && Key.Trans != null)
|
||||
{
|
||||
IKF<double, double> KF;
|
||||
SO = Key.Trans.Length.SortWriter();
|
||||
for (i = 0; i < Key.Trans.Length; i++)
|
||||
{
|
||||
SOi = SO[i];
|
||||
IO.Write(Temp + "key" + d + SOi + d + "data=", Key.Trans[SOi].ToString());
|
||||
if (Key.Trans[SOi] is KeyFrameT0<double, double>)
|
||||
IO.Write(Temp + "key" + d + SOi + d + "type=", 0);
|
||||
else if (Key.Trans[SOi] is KeyFrameT1<double, double>)
|
||||
IO.Write(Temp + "key" + d + SOi + d + "type=", 1);
|
||||
else if (Key.Trans[SOi] is KeyFrameT2<double, double>)
|
||||
IO.Write(Temp + "key" + d + SOi + d + "type=", 2);
|
||||
else if (Key.Trans[SOi] is KeyFrameT3<double, double>)
|
||||
IO.Write(Temp + "key" + d + SOi + d + "type=", 3);
|
||||
KF = Key.Trans[SOi].Check();
|
||||
IO.Write(Temp + "key" + d + SOi + d + "data=", KF.ToString());
|
||||
int Type = 0;
|
||||
if (KF is KFT0<double, double>) Type = 0;
|
||||
else if (KF is KFT1<double, double>) Type = 1;
|
||||
else if (KF is KFT2<double, double>) Type = 2;
|
||||
else if (KF is KFT3<double, double>) Type = 3;
|
||||
IO.Write(Temp + "key" + d + SOi + d + "type=", Type);
|
||||
}
|
||||
IO.Write(Temp + "key.length=", Key.Length);
|
||||
if (Key.Max != null) IO.Write(Temp + "max=", Key.Max);
|
||||
}
|
||||
else if (Key.Trans != null)
|
||||
{
|
||||
Key.RawData.KeyType = 0;
|
||||
int Length = Key.Trans.Length;
|
||||
ref int KeyType = ref Key.RawData.KeyType;
|
||||
KeyType = 0;
|
||||
IKF<double, double> KF;
|
||||
if (Key.Max != null) IO.Write(Temp + "max=", Key.Max);
|
||||
for (i = 0; i < Key.Trans.Length; i++)
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
if (Key.Trans[i] is KeyFrameT0<double, double> &&
|
||||
Key.RawData.KeyType < 0) Key.RawData.KeyType = 0;
|
||||
else if (Key.Trans[i] is KeyFrameT1<double, double> &&
|
||||
Key.RawData.KeyType < 1) Key.RawData.KeyType = 1;
|
||||
else if (Key.Trans[i] is KeyFrameT2<double, double> &&
|
||||
Key.RawData.KeyType < 2) Key.RawData.KeyType = 2;
|
||||
else if (Key.Trans[i] is KeyFrameT3<double, double> &&
|
||||
Key.RawData.KeyType < 3) break;
|
||||
KF = Key.Trans[i].Check();
|
||||
if (KF is KFT0<double, double> && KeyType < 0) KeyType = 0;
|
||||
else if (KF is KFT1<double, double> && KeyType < 1) KeyType = 1;
|
||||
else if (KF is KFT2<double, double> && KeyType < 2) KeyType = 2;
|
||||
else if (KF is KFT3<double, double> && KeyType < 3) break;
|
||||
}
|
||||
Key.RawData.ValueListSize = Key.Trans.Length * (Key.RawData.KeyType + 1);
|
||||
Key.RawData.ValueListSize = Length * KeyType + Length;
|
||||
IO.Write(Temp + "raw_data.value_list=");
|
||||
if (Key.RawData.KeyType == 0) for (i = 0; i < Key.Trans.Length; i++)
|
||||
IO.Write(Key.Trans[i].ToKeyFrameT0().ToString(false) +
|
||||
((i + 1 < Key.Trans.Length) ? "," : ""));
|
||||
else if (Key.RawData.KeyType == 1) for (i = 0; i < Key.Trans.Length; i++)
|
||||
IO.Write(Key.Trans[i].ToKeyFrameT1().ToString(false) +
|
||||
((i + 1 < Key.Trans.Length) ? "," : ""));
|
||||
else if (Key.RawData.KeyType == 2) for (i = 0; i < Key.Trans.Length; i++)
|
||||
IO.Write(Key.Trans[i].ToKeyFrameT2().ToString(false) +
|
||||
((i + 1 < Key.Trans.Length) ? "," : ""));
|
||||
else if (Key.RawData.KeyType == 3) for (i = 0; i < Key.Trans.Length; i++)
|
||||
IO.Write(Key.Trans[i].ToKeyFrameT3().ToString(false) +
|
||||
((i + 1 < Key.Trans.Length) ? "," : ""));
|
||||
if (KeyType == 0) for (i = 0; i < Length; i++)
|
||||
IO.Write(Key.Trans[i].ToT0().ToString(false) + ((i + 1 < Length) ? "," : ""));
|
||||
else if (KeyType == 1) for (i = 0; i < Length; i++)
|
||||
IO.Write(Key.Trans[i].ToT1().ToString(false) + ((i + 1 < Length) ? "," : ""));
|
||||
else if (KeyType == 2) for (i = 0; i < Length; i++)
|
||||
IO.Write(Key.Trans[i].ToT2().ToString(false) + ((i + 1 < Length) ? "," : ""));
|
||||
else if (KeyType == 3) for (i = 0; i < Length; i++)
|
||||
IO.Write(Key.Trans[i].ToT3().ToString(false) + ((i + 1 < Length) ? "," : ""));
|
||||
IO.Position--;
|
||||
IO.Write('\n');
|
||||
IO.Write(Temp + "raw_data.value_list_size=", Key.RawData.ValueListSize);
|
||||
IO.Write(Temp + "raw_data.value_type=" , Key.RawData.ValueType );
|
||||
IO.Write(Temp + "raw_data_key_type=" , Key.RawData. KeyType );
|
||||
}
|
||||
IO.Write(Temp + "type=", Key.Type & 0xFF);
|
||||
if (Key.RawData.KeyType == null && Key.Trans == null && Key.Value != null)
|
||||
IO.Write(Temp + "type=", (int)Key.Type);
|
||||
if (Key.RawData.KeyType == 0 && Key.Trans == null && Key.Value != null)
|
||||
if (Key.Value != 0) IO.Write(Temp + "value=", Key.Value);
|
||||
}
|
||||
|
||||
@@ -2213,38 +2171,36 @@ namespace KKdMainLib.A3DA
|
||||
if (Key.BinOffset == null || Key.BinOffset < 0) return;
|
||||
|
||||
IO.Position = (int)Key.BinOffset;
|
||||
Key.Type = IO.ReadInt32();
|
||||
int Type = IO.ReadInt32();
|
||||
|
||||
Key.Value = IO.ReadSingle();
|
||||
if (Key.Type == 0x0000 || Key.Type == 0x0001) return;
|
||||
Key.Type = (Key.Interpolation)(Type & 0xFF);
|
||||
if (Key.Type < Key.Interpolation.Lerp) return;
|
||||
Key.Max = IO.ReadSingle();
|
||||
Key.Length = IO.ReadInt32 ();
|
||||
if (Key.Type >> 8 != 0)
|
||||
if (Type >> 8 != 0)
|
||||
{
|
||||
Key.EPTypePost = (Key.Type >> 12) & 0xF;
|
||||
Key.EPTypePre = (Key.Type >> 8) & 0xF;
|
||||
Key.EPTypePost = (Type >> 12) & 0xF;
|
||||
Key.EPTypePre = (Type >> 8) & 0xF;
|
||||
if (Key.EPTypePost == 0) Key.EPTypePost = null;
|
||||
if (Key.EPTypePre == 0) Key.EPTypePre = null;
|
||||
}
|
||||
Key.Type &= 0xFF;
|
||||
Key.Trans = new IKeyFrame<double, double>[(int)Key.Length];
|
||||
KeyFrameT3<double, double> Temp;
|
||||
Key.Trans = new KFT3<double, double>[Key.Length];
|
||||
KFT3<double, double> Temp;
|
||||
for (int i = 0; i < Key.Length; i++)
|
||||
{
|
||||
Temp = new KeyFrameT3<double, double>();
|
||||
Temp = new KFT3<double, double>();
|
||||
if (F16 && C_F16 > 0)
|
||||
{ Temp.Frame = IO.ReadUInt16(); Temp.Value = (double)IO.ReadHalf (); }
|
||||
{ Temp.F = IO.ReadUInt16(); Temp.V = (double)IO.ReadHalf (); }
|
||||
else
|
||||
{ Temp.Frame = IO.ReadSingle(); Temp.Value = IO.ReadSingle(); }
|
||||
{ Temp.F = IO.ReadSingle(); Temp.V = IO.ReadSingle(); }
|
||||
|
||||
if (F16 && C_F16 == 2)
|
||||
{ Temp.Interpolation1 = (double)IO.ReadHalf ();
|
||||
Temp.Interpolation2 = (double)IO.ReadHalf (); }
|
||||
{ Temp.T1 = (double)IO.ReadHalf (); Temp.T2 = (double)IO.ReadHalf (); }
|
||||
else
|
||||
{ Temp.Interpolation1 = IO.ReadSingle();
|
||||
Temp.Interpolation2 = IO.ReadSingle(); }
|
||||
{ Temp.T1 = IO.ReadSingle(); Temp.T2 = IO.ReadSingle(); }
|
||||
|
||||
Key.Trans[i] = Temp.Check();
|
||||
Key.Trans[i] = Temp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2310,47 +2266,36 @@ namespace KKdMainLib.A3DA
|
||||
{
|
||||
if (k.Object == null) return null;
|
||||
|
||||
Key Key = new Key { EPTypePost = k.ReadNInt32("EPTypePost"),
|
||||
EPTypePre = k.ReadNInt32("EPTypePre"), Max = k.ReadNDouble("Max"),
|
||||
Type = k.ReadNInt32("Type"), Value = k.ReadNDouble("Value") };
|
||||
Key Key = new Key { EPTypePost = k.ReadNInt32("EPTypePost"), EPTypePre =
|
||||
k.ReadNInt32("EPTypePre"), Max = k.ReadNDouble("Max"), Value = k.ReadNDouble("Value") };
|
||||
if (!Enum.TryParse(k.ReadString("Type"), out Key.Interpolation Type)) { Key.Value = null; return Key; }
|
||||
Key.Type = Type;
|
||||
if (Key.Type == 0) { Key.Value = 0; return Key; }
|
||||
else if (Key.Type < Key.Interpolation.Lerp) return Key;
|
||||
|
||||
if (k.ReadBoolean("RawData")) Key.RawData = new Key.RawD() { KeyType = -1, ValueType = "float" };
|
||||
if (Key.Type == 0) Key.Value = 0.0;
|
||||
|
||||
if (Key.Type < 2) return Key;
|
||||
|
||||
if (!k.ElementArray("Trans", out MsgPack Trans)) return Key;
|
||||
|
||||
Key.Length = Trans.Array.Length;
|
||||
Key.Trans = new IKeyFrame<double, double>[Key.Length.Value];
|
||||
Key.Trans = new KFT3<double, double>[Key.Length];
|
||||
for (int i = 0; i < Key.Length; i++)
|
||||
{
|
||||
if (Trans[i].Array == null) continue;
|
||||
else if (Trans[i].Array.Length == 0) continue;
|
||||
else if (Trans[i].Array.Length == 1)
|
||||
Key.Trans[i] = new KeyFrameT0<double, double>
|
||||
{ Frame = Trans[i][0].ReadDouble() };
|
||||
Key.Trans[i] = new KFT3<double, double>
|
||||
(Trans[i][0].ReadDouble());
|
||||
else if (Trans[i].Array.Length == 2)
|
||||
Key.Trans[i] = new KeyFrameT1<double, double>
|
||||
{
|
||||
Frame = Trans[i][0].ReadDouble(),
|
||||
Value = Trans[i][1].ReadDouble(),
|
||||
};
|
||||
Key.Trans[i] = new KFT3<double, double>
|
||||
(Trans[i][0].ReadDouble(), Trans[i][1].ReadDouble());
|
||||
else if (Trans[i].Array.Length == 3)
|
||||
Key.Trans[i] = new KeyFrameT2<double, double>
|
||||
{
|
||||
Frame = Trans[i][0].ReadDouble(),
|
||||
Value = Trans[i][1].ReadDouble(),
|
||||
Interpolation = Trans[i][2].ReadDouble(),
|
||||
};
|
||||
Key.Trans[i] = new KFT3<double, double>
|
||||
(Trans[i][0].ReadDouble(), Trans[i][1].ReadDouble(),
|
||||
Trans[i][2].ReadDouble(), Trans[i][2].ReadDouble());
|
||||
else if (Trans[i].Array.Length == 4)
|
||||
Key.Trans[i] = new KeyFrameT3<double, double>
|
||||
{
|
||||
Frame = Trans[i][0].ReadDouble(),
|
||||
Value = Trans[i][1].ReadDouble(),
|
||||
Interpolation1 = Trans[i][2].ReadDouble(),
|
||||
Interpolation2 = Trans[i][3].ReadDouble(),
|
||||
};
|
||||
Key.Trans[i] = Key.Trans[i].Check();
|
||||
Key.Trans[i] = new KFT3<double, double>
|
||||
(Trans[i][0].ReadDouble(), Trans[i][1].ReadDouble(),
|
||||
Trans[i][2].ReadDouble(), Trans[i][3].ReadDouble());
|
||||
}
|
||||
return Key;
|
||||
}
|
||||
@@ -2381,32 +2326,32 @@ namespace KKdMainLib.A3DA
|
||||
|
||||
public static MsgPack Add(this MsgPack MsgPack, string name, Key Key)
|
||||
{
|
||||
if (Key == null) return MsgPack;
|
||||
if (Key.Type == null) return MsgPack;
|
||||
if (Key == null || Key.Type == null) return MsgPack;
|
||||
|
||||
MsgPack Keys = new MsgPack(name).Add("Type", Key.Type);
|
||||
if (Key.Trans != null)
|
||||
MsgPack Keys = new MsgPack(name).Add("Type", Key.Type.ToString());
|
||||
if (Key.Trans != null && Key.Type != Key.Interpolation.Null)
|
||||
{
|
||||
Keys = Keys.Add("Max", Key.Max).Add("EPTypePost", Key.EPTypePost).Add("EPTypePre", Key.EPTypePre);
|
||||
|
||||
if (Key.RawData.KeyType != null) Keys.Add("RawData", true);
|
||||
if (Key.RawData.KeyType != 0) Keys.Add("RawData", true);
|
||||
|
||||
MsgPack Trans = new MsgPack(Key.Trans.Length, "Trans");
|
||||
for (int i = 0; i < Key.Trans.Length; i++)
|
||||
if (Key.Trans[i] is KeyFrameT0<double, double> KeyFrameT0)
|
||||
{
|
||||
IKF<double, double> KF = Key.Trans[i].Check();
|
||||
if (KF is KFT0<double, double> KFT0)
|
||||
Trans[i] = new MsgPack(null, new MsgPack[]
|
||||
{ (MsgPack)KeyFrameT0.Frame });
|
||||
else if (Key.Trans[i] is KeyFrameT1<double, double> KeyFrameT1)
|
||||
{ (MsgPack)KFT0.F });
|
||||
else if (KF is KFT1<double, double> KFT1)
|
||||
Trans[i] = new MsgPack(null, new MsgPack[]
|
||||
{ (MsgPack)KeyFrameT1.Frame, (MsgPack)KeyFrameT1.Value });
|
||||
else if (Key.Trans[i] is KeyFrameT2<double, double> KeyFrameT2)
|
||||
{ (MsgPack)KFT1.F, (MsgPack)KFT1.V });
|
||||
else if (KF is KFT2<double, double> KFT2)
|
||||
Trans[i] = new MsgPack(null, new MsgPack[]
|
||||
{ (MsgPack)KeyFrameT2.Frame, (MsgPack)KeyFrameT2.Value,
|
||||
(MsgPack)KeyFrameT2.Interpolation });
|
||||
else if (Key.Trans[i] is KeyFrameT3<double, double> KeyFrameT3)
|
||||
{ (MsgPack)KFT2.F, (MsgPack)KFT2.V, (MsgPack)KFT2.T });
|
||||
else if (KF is KFT3<double, double> KFT3)
|
||||
Trans[i] = new MsgPack(null, new MsgPack[]
|
||||
{ (MsgPack)KeyFrameT3.Frame, (MsgPack)KeyFrameT3.Value,
|
||||
(MsgPack)KeyFrameT3.Interpolation1, (MsgPack)KeyFrameT3.Interpolation2 });
|
||||
{ (MsgPack)KFT3.F, (MsgPack)KFT3.V, (MsgPack)KFT3.T1, (MsgPack)KFT3.T2, });
|
||||
}
|
||||
Keys.Add(Trans);
|
||||
}
|
||||
else if (Key.Value != 0) Keys.Add("Value", Key.Value);
|
||||
@@ -2550,23 +2495,32 @@ namespace KKdMainLib.A3DA
|
||||
|
||||
public class Key
|
||||
{
|
||||
public int? Type;
|
||||
public int? Length;
|
||||
public Interpolation? Type;
|
||||
public int Length;
|
||||
public int? BinOffset;
|
||||
public int? EPTypePre;
|
||||
public int? EPTypePost;
|
||||
public double? Max;
|
||||
public double? Value;
|
||||
public RawD RawData;
|
||||
public IKeyFrame<double, double>[] Trans;
|
||||
public KFT3<double, double>[] Trans;
|
||||
|
||||
public struct RawD
|
||||
{
|
||||
public int? KeyType;
|
||||
public int? ValueListSize;
|
||||
public int KeyType;
|
||||
public int ValueListSize;
|
||||
public string ValueType;
|
||||
public string[] ValueList;
|
||||
}
|
||||
|
||||
public enum Interpolation
|
||||
{
|
||||
Null = 0,
|
||||
Value = 1,
|
||||
Lerp = 2,
|
||||
Hermite = 3,
|
||||
Hold = 4,
|
||||
}
|
||||
}
|
||||
|
||||
public struct Light
|
||||
|
||||
+3
-5
@@ -1,8 +1,8 @@
|
||||
//Original: AetSet.bt Version: 2.0 by samyuu
|
||||
|
||||
using KKdBaseLib;
|
||||
using KKdMainLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2nd;
|
||||
|
||||
namespace KKdMainLib.Aet
|
||||
{
|
||||
@@ -200,8 +200,7 @@ namespace KKdMainLib.Aet
|
||||
{
|
||||
IO.Align(0x10);
|
||||
Aet.Unknown.Offset = IO.Position;
|
||||
for (i = 0; i < Aet.Unknown.Count * 10; i++)
|
||||
IO.Write(0L);
|
||||
for (i = 0; i < Aet.Unknown.Count * 10; i++) IO.Write(0L);
|
||||
}
|
||||
|
||||
IO.Align(0x10);
|
||||
@@ -213,7 +212,7 @@ namespace KKdMainLib.Aet
|
||||
for (i = 0; i < NullValPointers.Count; i++)
|
||||
{
|
||||
IO.Position = NullValPointers[i];
|
||||
IO.Write(ReturnPosition + i * 4);
|
||||
IO.Write(ReturnPosition + i << 2);
|
||||
}
|
||||
|
||||
for (i = 0; i < Aet.Layers.Count; i++)
|
||||
@@ -861,7 +860,6 @@ namespace KKdMainLib.Aet
|
||||
public struct AetHeader
|
||||
{
|
||||
public Pointer<AetData>[] Data;
|
||||
public POF POF;
|
||||
}
|
||||
|
||||
public struct AetData
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace KKdMainLib.DB
|
||||
for (int i = 0; i < AetSets.Length; i++)
|
||||
AetSets[i].ReadMsgPack(AetDB[i]);
|
||||
}
|
||||
MsgPack = MsgPack.New;
|
||||
MsgPack.Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace KKdMainLib.DB
|
||||
}
|
||||
}
|
||||
}
|
||||
MsgPack = MsgPack.New;
|
||||
MsgPack.Dispose();
|
||||
}
|
||||
|
||||
public void MsgPackWriter(string file, bool JSON)
|
||||
|
||||
+16
-14
@@ -143,13 +143,13 @@ namespace KKdMainLib.DB
|
||||
if (set.Id == null) while (true)
|
||||
{ if (!SetIds.Contains(i1)) { SpriteSets[i].Id = i1; SetIds.Add(i1); break; } i1++; }
|
||||
|
||||
for (i0 = 0, i1 = 0; i0 < set. Sprites.Length; i0++)
|
||||
if (set. Sprites[i0].Id == null) while (true) { if (!Ids.Contains(i1))
|
||||
{ SpriteSets[i]. Sprites[i0].Id = i1; Ids.Add(i1); break; } i1++; }
|
||||
|
||||
for (i0 = 0, i1 = 0; i0 < set.Textures.Length; i0++)
|
||||
if (set.Textures[i0].Id == null) while (true) { if (!Ids.Contains(i1))
|
||||
{ SpriteSets[i].Textures[i0].Id = i1; Ids.Add(i1); break; } i1++; }
|
||||
while (set.Textures[i0].Id == null)
|
||||
if (!Ids.Contains(i1)) Ids.Add((int)(SpriteSets[i].Textures[i0].Id = i1)); else i1++;
|
||||
|
||||
for (i0 = 0, i1 = 0; i0 < set. Sprites.Length; i0++)
|
||||
while (set. Sprites[i0].Id == null)
|
||||
if (!Ids.Contains(i1)) Ids.Add((int)(SpriteSets[i]. Sprites[i0].Id = i1)); else i1++;
|
||||
}
|
||||
|
||||
Ids = null;
|
||||
@@ -175,18 +175,20 @@ namespace KKdMainLib.DB
|
||||
for (i = 0; i < SpriteSets.Length; i++)
|
||||
{
|
||||
if (NotAdd.Contains(i)) continue;
|
||||
SpriteSets[i]. NameOffset = IO.Position; IO.Write(SpriteSets[i]. Name + "\0");
|
||||
SpriteSets[i].FileNameOffset = IO.Position; IO.Write(SpriteSets[i].FileName + "\0");
|
||||
for (i0 = 0; i0 < SpriteSets[i].Textures.Length; i0++)
|
||||
{ SpriteSets[i].Textures[i0].NameOffset = IO.Position;
|
||||
IO.Write(SpriteSets[i].Textures[i0].Name + "\0"); }
|
||||
|
||||
for (i0 = 0; i0 < SpriteSets[i]. Sprites.Length; i0++)
|
||||
{ SpriteSets[i]. Sprites[i0].NameOffset = IO.Position;
|
||||
IO.Write(SpriteSets[i]. Sprites[i0].Name + "\0"); }
|
||||
}
|
||||
|
||||
for (i = 0; i < SpriteSets.Length; i++)
|
||||
{
|
||||
if (NotAdd.Contains(i)) continue;
|
||||
for (i0 = 0; i0 < SpriteSets[i].Textures.Length; i0++)
|
||||
{ SpriteSets[i].Textures[i0].NameOffset = IO.Position; IO.Write(SpriteSets[i].Textures[i0].Name + "\0"); }
|
||||
|
||||
for (i0 = 0; i0 < SpriteSets[i]. Sprites.Length; i0++)
|
||||
{ SpriteSets[i]. Sprites[i0].NameOffset = IO.Position; IO.Write(SpriteSets[i]. Sprites[i0].Name + "\0"); }
|
||||
SpriteSets[i]. NameOffset = IO.Position; IO.Write(SpriteSets[i]. Name + "\0");
|
||||
SpriteSets[i].FileNameOffset = IO.Position; IO.Write(SpriteSets[i].FileName + "\0");
|
||||
}
|
||||
|
||||
IO.Align(0x08, true);
|
||||
@@ -235,7 +237,7 @@ namespace KKdMainLib.DB
|
||||
for (int i = 0; i < SpriteSets.Length; i++)
|
||||
SpriteSets[i].ReadMsgPack(SprDB[i]);
|
||||
}
|
||||
MsgPack = MsgPack.New;
|
||||
MsgPack.Dispose();
|
||||
}
|
||||
|
||||
public void MsgPackWriter(string file, bool JSON)
|
||||
|
||||
+30
-30
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2nd;
|
||||
|
||||
namespace KKdMainLib
|
||||
{
|
||||
@@ -24,18 +24,16 @@ namespace KKdMainLib
|
||||
Header.Format = Format.F;
|
||||
Header.SectionSignature = IO.ReadInt32();
|
||||
if (Header.SectionSignature == 0x43505845)
|
||||
Header = IO.ReadHeader(true);
|
||||
if (Header.SectionSignature != 0x64)
|
||||
return 0;
|
||||
Header = IO.ReadHeader(true, true);
|
||||
if (Header.SectionSignature != 0x64) return 0;
|
||||
|
||||
Offset = IO.Position - 0x4;
|
||||
IO.Offset = IO.Position - 0x4;
|
||||
Dex = new EXP[IO.ReadInt32()];
|
||||
int DEXOffset = IO.ReadInt32();
|
||||
if (IO.ReadInt32() == 0x00) Header.Format = Format.X;
|
||||
int DEXNameOffset = IO.ReadInt32();
|
||||
if (Header.IsX) IO.ReadInt32();
|
||||
if (DEXNameOffset == 0x00) { Header.Format = Format.X; DEXNameOffset = (int)IO.ReadInt64(); }
|
||||
|
||||
IO.Seek(DEXOffset + Offset, 0);
|
||||
IO.Seek(DEXOffset, 0);
|
||||
for (int i0 = 0; i0 < Dex.Length; i0++)
|
||||
Dex[i0] = new EXP { Main = new List<EXPElement>(), Eyes = new List<EXPElement>() };
|
||||
|
||||
@@ -46,7 +44,7 @@ namespace KKdMainLib
|
||||
Dex[i0].EyesOffset = IO.ReadInt32();
|
||||
if (Header.IsX) IO.ReadInt32();
|
||||
}
|
||||
IO.Seek(DEXNameOffset + Offset, 0);
|
||||
IO.Seek(DEXNameOffset, 0);
|
||||
for (int i0 = 0; i0 < Dex.Length; i0++)
|
||||
{
|
||||
Dex[i0].NameOffset = IO.ReadInt32();
|
||||
@@ -70,7 +68,7 @@ namespace KKdMainLib
|
||||
break;
|
||||
}
|
||||
|
||||
IO.Seek(Dex[i0].EyesOffset + Offset, 0);
|
||||
IO.Seek(Dex[i0].EyesOffset, 0);
|
||||
while(true)
|
||||
{
|
||||
element.Frame = IO.ReadSingle();
|
||||
@@ -80,12 +78,10 @@ namespace KKdMainLib
|
||||
element.Trans = IO.ReadSingle();
|
||||
Dex[i0].Eyes.Add(element);
|
||||
|
||||
if (element.Frame == 999999 || element.Both == 0xFFFF)
|
||||
break;
|
||||
if (element.Frame == 999999 || element.Both == 0xFFFF) break;
|
||||
}
|
||||
|
||||
IO.Seek(Dex[i0].NameOffset + Offset, 0);
|
||||
Dex[i0].Name = IO.NullTerminatedUTF8();
|
||||
Dex[i0].Name = IO.ReadStringAtOffset(Dex[i0].NameOffset);
|
||||
}
|
||||
|
||||
IO.Close();
|
||||
@@ -172,7 +168,7 @@ namespace KKdMainLib
|
||||
IO.Close();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool JSON)
|
||||
public int MsgPackReader(string file, bool JSON)
|
||||
{
|
||||
int i0 = 0;
|
||||
int i1 = 0;
|
||||
@@ -180,7 +176,7 @@ namespace KKdMainLib
|
||||
Header = new Header();
|
||||
|
||||
MsgPack MsgPack = file.ReadMPAllAtOnce(JSON);
|
||||
if (!MsgPack.ElementArray("Dex", out MsgPack Dex)) return;
|
||||
if (!MsgPack.ElementArray("Dex", out MsgPack Dex)) return 0;
|
||||
|
||||
this.Dex = new EXP[Dex.Array.Length];
|
||||
for (i0 = 0; i0 < this.Dex.Length; i0++)
|
||||
@@ -191,23 +187,19 @@ namespace KKdMainLib
|
||||
{
|
||||
this.Dex[i0].Main = new List<EXPElement>();
|
||||
for (i1 = 0; i1 < Main.Array.Length; i1++)
|
||||
this.Dex[i0].Main.Add(ReadEXP(Main[i1]));
|
||||
this.Dex[i0].Main.Add(EXPElement.Read(Main[i1]));
|
||||
}
|
||||
if (Dex[i0].ElementArray("Eyes", out MsgPack Eyes))
|
||||
{
|
||||
this.Dex[i0].Eyes = new List<EXPElement>();
|
||||
for (i1 = 0; i1 < Eyes.Array.Length; i1++)
|
||||
this.Dex[i0].Eyes.Add(ReadEXP(Eyes[i1]));
|
||||
this.Dex[i0].Eyes.Add(EXPElement.Read(Eyes[i1]));
|
||||
}
|
||||
}
|
||||
MsgPack = MsgPack.New;
|
||||
MsgPack.Dispose();
|
||||
return 1;
|
||||
}
|
||||
|
||||
private EXPElement ReadEXP(MsgPack mp) =>
|
||||
new EXPElement() { Frame = mp.ReadSingle("F"), Both = mp.ReadUInt16("B"),
|
||||
ID = mp.ReadUInt16("I"), Value = mp.ReadSingle("V"),
|
||||
Trans = mp.ReadSingle("T") };
|
||||
|
||||
public void MsgPackWriter(string file, bool JSON)
|
||||
{
|
||||
int i0 = 0;
|
||||
@@ -218,12 +210,12 @@ namespace KKdMainLib
|
||||
MsgPack EXP = MsgPack.New.Add("Name", this.Dex[i0].Name);
|
||||
MsgPack Main = new MsgPack(this.Dex[i0].Main.Count, "Main");
|
||||
for (i1 = 0; i1 < this.Dex[i0].Main.Count; i1++)
|
||||
Main[i1] = WriteEXP(this.Dex[i0].Main[i1]);
|
||||
Main[i1] = this.Dex[i0].Main[i1].Write();
|
||||
EXP.Add(Main);
|
||||
|
||||
MsgPack Eyes = new MsgPack(this.Dex[i0].Eyes.Count, "Eyes");
|
||||
for (i1 = 0; i1 < this.Dex[i0].Eyes.Count; i1++)
|
||||
Eyes[i1] = WriteEXP(this.Dex[i0].Eyes[i1]);
|
||||
Eyes[i1] = this.Dex[i0].Eyes[i1].Write();
|
||||
EXP.Add(Eyes);
|
||||
Dex[i0] = EXP;
|
||||
}
|
||||
@@ -231,10 +223,6 @@ namespace KKdMainLib
|
||||
Dex.Write(true, file, JSON);
|
||||
}
|
||||
|
||||
private MsgPack WriteEXP(EXPElement element) =>
|
||||
MsgPack.New.Add("F", element.Frame).Add("B", element.Both ).Add("I", element.ID )
|
||||
.Add("V", element.Value).Add("T", element.Trans);
|
||||
|
||||
public struct EXP
|
||||
{
|
||||
public int MainOffset;
|
||||
@@ -243,6 +231,8 @@ namespace KKdMainLib
|
||||
public string Name;
|
||||
public List<EXPElement> Main;
|
||||
public List<EXPElement> Eyes;
|
||||
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
|
||||
public struct EXPElement
|
||||
@@ -252,6 +242,16 @@ namespace KKdMainLib
|
||||
public ushort ID;
|
||||
public float Value;
|
||||
public float Trans;
|
||||
|
||||
public static EXPElement Read(MsgPack msg) =>
|
||||
new EXPElement() { Frame = msg.ReadSingle("F"), Both = msg.ReadUInt16("B"),
|
||||
ID = msg.ReadUInt16("I"), Value = msg.ReadSingle("V"),
|
||||
Trans = msg.ReadSingle("T"), };
|
||||
|
||||
public MsgPack Write() =>
|
||||
MsgPack.New.Add("F", Frame).Add("B", Both )
|
||||
.Add("I", ID).Add("V", Value)
|
||||
.Add("T", Trans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace KKdMainLib
|
||||
|
||||
public static void Decrypt(this string file)
|
||||
{
|
||||
Console.Title = "DIVAFILE Decrypt - File: " + Path.GetFileName(file);
|
||||
Stream IO = File.OpenReader(file);
|
||||
if (IO.ReadInt64() != 0x454C494641564944)
|
||||
{ IO.Close(); return; }
|
||||
@@ -39,7 +38,6 @@ namespace KKdMainLib
|
||||
|
||||
public static void Encrypt(this string file)
|
||||
{
|
||||
Console.Title = "DIVAFILE Encrypt - File: " + Path.GetFileName(file);
|
||||
Stream IO = File.OpenReader(file);
|
||||
int FileLengthOrigin = IO.Length;
|
||||
int FileLength = FileLengthOrigin.Align(16);
|
||||
|
||||
+21
-21
@@ -100,13 +100,13 @@ namespace KKdMainLib
|
||||
Success = true;
|
||||
}
|
||||
|
||||
MsgPack = MsgPack.New;
|
||||
MsgPack.Dispose();
|
||||
}
|
||||
|
||||
public void MsgPackWriter(string file, bool JSON, bool Compact = true)
|
||||
{
|
||||
if (!Success) return;
|
||||
MsgPack msgPack = MsgPack.New;
|
||||
MsgPack MsgPack = MsgPack.New;
|
||||
|
||||
if (file.Contains("psrData"))
|
||||
{
|
||||
@@ -114,23 +114,23 @@ namespace KKdMainLib
|
||||
{
|
||||
MsgPack psrData = new MsgPack(psrDat.Length, "psrData");
|
||||
for (i = 0; i < psrDat.Length; i++) psrData[i] = psrDat[i].WriteMP();
|
||||
msgPack.Add(psrData);
|
||||
MsgPack.Add(psrData);
|
||||
}
|
||||
else msgPack.Add(new MsgPack("psrData", null));
|
||||
else MsgPack.Add(new MsgPack("psrData", null));
|
||||
}
|
||||
else if (file.Contains("PvList"))
|
||||
{
|
||||
if (pvList != null)
|
||||
{
|
||||
if (Compact) msgPack.Add("Compact", Compact);
|
||||
if (Compact) MsgPack.Add("Compact", Compact);
|
||||
|
||||
MsgPack PvList = new MsgPack(pvList.Length, "PvList");
|
||||
for (i = 0; i < pvList.Length; i++) PvList[i] = pvList[i].WriteMP(Compact);
|
||||
msgPack.Add(PvList);
|
||||
MsgPack.Add(PvList);
|
||||
}
|
||||
else msgPack.Add(new MsgPack("PvList", null));
|
||||
else MsgPack.Add(new MsgPack("PvList", null));
|
||||
}
|
||||
msgPack.Write(file, JSON).Dispose();
|
||||
MsgPack.Write(file, JSON).Dispose();
|
||||
}
|
||||
|
||||
public static string UrlEncode(string value) =>
|
||||
@@ -278,25 +278,25 @@ namespace KKdMainLib
|
||||
|
||||
public MsgPack WriteMP(bool Compact)
|
||||
{
|
||||
MsgPack msgPack = MsgPack.New;
|
||||
msgPack.Add("ID", PV_ID);
|
||||
if (!Enable) msgPack.Add("Enable", Enable);
|
||||
if ( Extra ) msgPack.Add("Extra" , Extra );
|
||||
MsgPack MsgPack = MsgPack.New;
|
||||
MsgPack.Add("ID", PV_ID);
|
||||
if (!Enable) MsgPack.Add("Enable", Enable);
|
||||
if ( Extra ) MsgPack.Add("Extra" , Extra );
|
||||
if (Compact)
|
||||
{
|
||||
if (AdvDemoStart.WriteLower) msgPack.Add("AdvDemoStart", AdvDemoStart.WriteInt());
|
||||
if (AdvDemoEnd .WriteLower) msgPack.Add("AdvDemoEnd" , AdvDemoEnd .WriteInt());
|
||||
if (StartShow .WriteLower) msgPack.Add("StartShow" , StartShow .WriteInt());
|
||||
if ( EndShow .WriteUpper) msgPack.Add( "EndShow" , EndShow .WriteInt());
|
||||
if (AdvDemoStart.WriteLower) MsgPack.Add("AdvDemoStart", AdvDemoStart.WriteInt());
|
||||
if (AdvDemoEnd .WriteLower) MsgPack.Add("AdvDemoEnd" , AdvDemoEnd .WriteInt());
|
||||
if (StartShow .WriteLower) MsgPack.Add("StartShow" , StartShow .WriteInt());
|
||||
if ( EndShow .WriteUpper) MsgPack.Add( "EndShow" , EndShow .WriteInt());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AdvDemoStart.WriteLower) msgPack.Add(AdvDemoStart.WriteMP("AdvDemoStart"));
|
||||
if (AdvDemoEnd .WriteLower) msgPack.Add(AdvDemoEnd .WriteMP("AdvDemoEnd" ));
|
||||
if (StartShow .WriteLower) msgPack.Add(StartShow .WriteMP("StartShow" ));
|
||||
if ( EndShow .WriteUpper) msgPack.Add( EndShow .WriteMP( "EndShow" ));
|
||||
if (AdvDemoStart.WriteLower) MsgPack.Add(AdvDemoStart.WriteMP("AdvDemoStart"));
|
||||
if (AdvDemoEnd .WriteLower) MsgPack.Add(AdvDemoEnd .WriteMP("AdvDemoEnd" ));
|
||||
if (StartShow .WriteLower) MsgPack.Add(StartShow .WriteMP("StartShow" ));
|
||||
if ( EndShow .WriteUpper) MsgPack.Add( EndShow .WriteMP( "EndShow" ));
|
||||
}
|
||||
return msgPack;
|
||||
return MsgPack;
|
||||
}
|
||||
|
||||
public override string ToString() =>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2nd;
|
||||
|
||||
namespace KKdMainLib
|
||||
{
|
||||
@@ -76,6 +76,57 @@ namespace KKdMainLib
|
||||
stream.WriteEOFC(ID);
|
||||
}
|
||||
}
|
||||
|
||||
public static class StructExtensions
|
||||
{
|
||||
public static Struct ReadStruct(byte[] Data)
|
||||
{
|
||||
Stream stream = File.OpenReader(Data);
|
||||
Struct Struct = stream.ReadStruct(stream.ReadHeader(false));
|
||||
stream.Close();
|
||||
return Struct;
|
||||
}
|
||||
|
||||
public static Struct ReadStruct(this Stream stream, Header Header)
|
||||
{
|
||||
Struct Struct = new Struct { Header = Header, DataOffset =
|
||||
stream.Position, Data = stream.ReadBytes(Header.SectionSize) };
|
||||
int ID = Header.ID;
|
||||
|
||||
KKdList<Struct> SubStructs = KKdList<Struct>.New;
|
||||
long Length = stream.Length - stream.Position;
|
||||
long Position = 0;
|
||||
while (Length > Position)
|
||||
{
|
||||
Header = stream.ReadHeader(false);
|
||||
Position += Header.Length + Header.DataSize;
|
||||
if (Header.ID == ID && Header.Signature == 0x43464F45)
|
||||
{ Struct.EOFC = true; break; }
|
||||
else if (Header.ID == 0 && (Header.Signature == 0x30464F50 ||
|
||||
Header.Signature == 0x31464F50 || Header.Signature == 0x53524E45))
|
||||
SubStructs.Add(new Struct { Header = Header, DataOffset =
|
||||
stream.Position, Data = stream.ReadBytes(Header.SectionSize) });
|
||||
else if (Header.ID <= ID)
|
||||
{ stream.LongPosition -= Header.Length; break; }
|
||||
else SubStructs.Add(stream.ReadStruct(Header));
|
||||
}
|
||||
|
||||
for (int i = 0; i < SubStructs.Capacity; i++)
|
||||
{
|
||||
string Sig = SubStructs[i].Header.ToString();
|
||||
if (Sig == "ENRS" || Sig == "EOFC" || Sig == "POF0" || Sig == "POF1")
|
||||
{
|
||||
if (Sig == "EOFC") Struct.EOFC = true;
|
||||
else if (Sig == "ENRS") Struct.ENRS = ENRS.Read(SubStructs[i].Data);
|
||||
else Struct.POF = POF .Read(SubStructs[i].Data, Sig == "POF1");
|
||||
SubStructs.RemoveAt(i); SubStructs.Capacity--; i--;
|
||||
}
|
||||
}
|
||||
|
||||
if (SubStructs.Capacity > 0) Struct.SubStructs = SubStructs.ToArray();
|
||||
return Struct;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MPExt
|
||||
{
|
||||
@@ -84,10 +135,10 @@ namespace KKdMainLib
|
||||
MsgPack MsgPack;
|
||||
if (JSON)
|
||||
{ JSON IO = new JSON(File.OpenReader(array));
|
||||
MsgPack = IO.Read(); IO.Close(); }
|
||||
MsgPack = IO.Read( ); IO.Close(); }
|
||||
else
|
||||
{ MP IO = new MP(File.OpenReader(array));
|
||||
MsgPack = IO.Read(); IO.Close(); }
|
||||
MsgPack = IO.Read(true); IO.Close(); }
|
||||
return MsgPack;
|
||||
}
|
||||
|
||||
@@ -96,10 +147,10 @@ namespace KKdMainLib
|
||||
MsgPack MsgPack;
|
||||
if (JSON)
|
||||
{ JSON IO = new JSON(File.OpenReader(file + ".json", true));
|
||||
MsgPack = IO.Read(); IO.Close(); }
|
||||
MsgPack = IO.Read( ); IO.Close(); }
|
||||
else
|
||||
{ MP IO = new MP(File.OpenReader(file + ".mp" , true));
|
||||
MsgPack = IO.Read(); IO.Close(); }
|
||||
MsgPack = IO.Read(true); IO.Close(); }
|
||||
return MsgPack;
|
||||
}
|
||||
|
||||
@@ -108,10 +159,10 @@ namespace KKdMainLib
|
||||
MsgPack MsgPack;
|
||||
if (JSON)
|
||||
{ JSON IO = new JSON(File.OpenReader(file + ".json"));
|
||||
MsgPack = IO.Read(); IO.Close(); }
|
||||
MsgPack = IO.Read( ); IO.Close(); }
|
||||
else
|
||||
{ MP IO = new MP(File.OpenReader(file + ".mp" ));
|
||||
MsgPack = IO.Read(); IO.Close(); }
|
||||
MsgPack = IO.Read(true); IO.Close(); }
|
||||
return MsgPack;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
namespace KKdMainLib.F2
|
||||
{
|
||||
public struct Bloom
|
||||
{
|
||||
public CountPointer<BLT> BLTs;
|
||||
private Stream IO;
|
||||
private Header Header;
|
||||
private int i;
|
||||
|
||||
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.Position -= 0x4;
|
||||
|
||||
BLTs = IO.ReadCountPointerEndian<BLT>();
|
||||
if (BLTs.Count < 1) { IO.Close(); BLTs.Count = -1; return; }
|
||||
|
||||
if (BLTs.Count > 0 && BLTs.Offset == 0) { IO.Close(); BLTs.Count = -1; return; }
|
||||
|
||||
IO.Position = BLTs.Offset;
|
||||
for (i = 0; i < BLTs.Count; i++)
|
||||
{
|
||||
ref BLT BLT = ref BLTs.Entries[i];
|
||||
IO.ReadInt32Endian();
|
||||
BLT.Color .X = IO.ReadSingleEndian();
|
||||
BLT.Color .Y = IO.ReadSingleEndian();
|
||||
BLT.Color .Z = IO.ReadSingleEndian();
|
||||
BLT.Brightpass.X = IO.ReadSingleEndian();
|
||||
BLT.Brightpass.Y = IO.ReadSingleEndian();
|
||||
BLT.Brightpass.Z = IO.ReadSingleEndian();
|
||||
BLT.Range = IO.ReadSingleEndian();
|
||||
}
|
||||
IO.Close();
|
||||
}
|
||||
|
||||
public void TXTWriter(string file)
|
||||
{
|
||||
if (BLTs.Count < 1) return;
|
||||
|
||||
IO = File.OpenWriter();
|
||||
IO.WriteShiftJIS("ID,ColorR,ColorG,ColorB,BrightpassR,BrightpassG,BrightpassB,Range\n");
|
||||
for (i = 0; i < BLTs.Count; i++)
|
||||
IO.Write(i + "," + BLTs[i] + "\n");
|
||||
File.WriteAllBytes(file + "_bloom.txt", IO.ToArray(true));
|
||||
}
|
||||
|
||||
public struct BLT
|
||||
{
|
||||
public Vector3 Color;
|
||||
public Vector3 Brightpass;
|
||||
public float Range;
|
||||
|
||||
public override string ToString() => Color .ToString(6) + "," +
|
||||
Brightpass.ToString(6) + "," +
|
||||
Range .ToString(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
namespace KKdMainLib.F2
|
||||
{
|
||||
public struct ColorCorrection
|
||||
{
|
||||
public CountPointer<CCT> CCTs;
|
||||
private Stream IO;
|
||||
private Header Header;
|
||||
private int i;
|
||||
|
||||
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.Position -= 0x4;
|
||||
|
||||
CCTs = IO.ReadCountPointerEndian<CCT>();
|
||||
if (CCTs.Count < 1) { IO.Close(); CCTs.Count = -1; return; }
|
||||
|
||||
if (CCTs.Count > 0 && CCTs.Offset == 0) { IO.Close(); CCTs.Count = -1; return; }
|
||||
|
||||
IO.Position = CCTs.Offset;
|
||||
for (i = 0; i < CCTs.Count; i++)
|
||||
{
|
||||
ref CCT CCT = ref CCTs.Entries[i];
|
||||
IO.ReadInt32Endian();
|
||||
CCT.Hue = IO.ReadSingleEndian();
|
||||
CCT.Saturation = IO.ReadSingleEndian();
|
||||
CCT.Lightness = IO.ReadSingleEndian();
|
||||
CCT.Exposure = IO.ReadSingleEndian();
|
||||
CCT.Gamma.X = IO.ReadSingleEndian();
|
||||
CCT.Gamma.Y = IO.ReadSingleEndian();
|
||||
CCT.Gamma.Z = IO.ReadSingleEndian();
|
||||
CCT.Contrast = IO.ReadSingleEndian();
|
||||
}
|
||||
|
||||
IO.Close();
|
||||
}
|
||||
|
||||
public void TXTWriter(string file)
|
||||
{
|
||||
if (CCTs.Count < 1) return;
|
||||
|
||||
IO = File.OpenWriter();
|
||||
IO.WriteShiftJIS("ID,Hue,Saturation,Lightness,Exposure,GammaR,GammaG,GammaB,Contrast\n");
|
||||
for (i = 0; i < CCTs.Count; i++)
|
||||
IO.Write(i + "," + CCTs[i] + "\n");
|
||||
File.WriteAllBytes(file + "_cc.txt", IO.ToArray(true));
|
||||
}
|
||||
|
||||
public struct CCT
|
||||
{
|
||||
public float Hue;
|
||||
public float Saturation;
|
||||
public float Lightness;
|
||||
public float Exposure;
|
||||
public Vector3 Gamma;
|
||||
public float Contrast;
|
||||
|
||||
public override string ToString() => Hue .ToString(6) + "," +
|
||||
Saturation.ToString(6) + "," +
|
||||
Lightness .ToString(6) + "," +
|
||||
Exposure .ToString(6) + "," +
|
||||
Gamma .ToString(6) + "," +
|
||||
Contrast .ToString(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
namespace KKdMainLib.F2
|
||||
{
|
||||
public struct DOF
|
||||
{
|
||||
public CountPointer<DFT> DFTs;
|
||||
private Stream IO;
|
||||
private Header Header;
|
||||
private int i;
|
||||
|
||||
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.Position -= 0x4;
|
||||
|
||||
DFTs = IO.ReadCountPointerEndian<DFT>();
|
||||
if (DFTs.Count < 1) { IO.Close(); DFTs.Count = -1; return; }
|
||||
|
||||
if (DFTs.Count > 0 && DFTs.Offset == 0) { IO.Close(); DFTs.Count = -1; return; }
|
||||
|
||||
IO.Position = DFTs.Offset;
|
||||
for (i = 0; i < DFTs.Count; i++)
|
||||
{
|
||||
ref DFT DFT = ref DFTs.Entries[i];
|
||||
IO.ReadInt32Endian();
|
||||
DFT. Focus = IO.ReadSingleEndian();
|
||||
DFT. FocusRange = IO.ReadSingleEndian();
|
||||
DFT.FuzzingRange = IO.ReadSingleEndian();
|
||||
DFT.Ratio = IO.ReadSingleEndian();
|
||||
DFT.Quality = IO.ReadSingleEndian();
|
||||
if (IO.IsX) IO.ReadInt32();
|
||||
}
|
||||
|
||||
IO.Close();
|
||||
}
|
||||
|
||||
public void TXTWriter(string file)
|
||||
{
|
||||
if (DFTs.Count < 1) return;
|
||||
|
||||
IO = File.OpenWriter();
|
||||
IO.WriteShiftJIS("ID,Focus,FocusRange,FuzzingRange,Ratio,Quality\n");
|
||||
for (i = 0; i < DFTs.Count; i++)
|
||||
IO.Write(i + "," + DFTs[i] + "\n");
|
||||
File.WriteAllBytes(file + "_dof.txt", IO.ToArray(true));
|
||||
}
|
||||
|
||||
public struct DFT
|
||||
{
|
||||
public float Focus;
|
||||
public float FocusRange;
|
||||
public float FuzzingRange;
|
||||
public float Ratio;
|
||||
public float Quality;
|
||||
|
||||
public override string ToString() => Focus .ToString(6) + "," +
|
||||
FocusRange.ToString(6) + "," +
|
||||
FuzzingRange.ToString(6) + "," +
|
||||
Ratio .ToString(6) + "," +
|
||||
Quality .ToString(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
namespace KKdMainLib.F2
|
||||
{
|
||||
public struct Light
|
||||
{
|
||||
public CountPointer<CountPointer<LIT>> LITs;
|
||||
private Stream IO;
|
||||
private Header Header;
|
||||
private int i, i0;
|
||||
|
||||
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.ReadCountPointerEndian<CountPointer<LIT>>();
|
||||
if (LITs.Count < 1) { IO.Close(); LITs.Count = -1; return; }
|
||||
|
||||
IO.Position = LITs.Offset;
|
||||
for (i = 0; i < LITs.Count; i++)
|
||||
{
|
||||
LITs[i] = IO.ReadCountPointerX<LIT>();
|
||||
if ((LITs[i].Count > 0 || LITs[i].Offset == 0) && !IO.IsX) { IO.Close(); LITs.Count = -1; return; }
|
||||
}
|
||||
|
||||
for (i = 0; i < LITs.Count; i++)
|
||||
{
|
||||
IO.Position = LITs[i].Offset;
|
||||
for (i0 = 0; i0 < LITs[i].Count; i0++)
|
||||
{
|
||||
ref LIT LIT = ref LITs.Entries[i].Entries[i0];
|
||||
LIT.Id = (Id )IO.ReadInt32Endian();
|
||||
LIT.Flags = (Flags)IO.ReadInt32Endian();
|
||||
LIT.Type = (Type )IO.ReadInt32Endian();
|
||||
if (IO.IsX) { IO.ReadInt64(); IO.ReadInt64(); IO.ReadInt64(); }
|
||||
LIT.Ambient .X = IO.ReadSingleEndian();
|
||||
LIT.Ambient .Y = IO.ReadSingleEndian();
|
||||
LIT.Ambient .Z = IO.ReadSingleEndian();
|
||||
LIT.Ambient .W = IO.ReadSingleEndian();
|
||||
LIT.Diffuse .X = IO.ReadSingleEndian();
|
||||
LIT.Diffuse .Y = IO.ReadSingleEndian();
|
||||
LIT.Diffuse .Z = IO.ReadSingleEndian();
|
||||
LIT.Diffuse .W = IO.ReadSingleEndian();
|
||||
LIT.Specular .X = IO.ReadSingleEndian();
|
||||
LIT.Specular .Y = IO.ReadSingleEndian();
|
||||
LIT.Specular .Z = IO.ReadSingleEndian();
|
||||
LIT.Specular .W = IO.ReadSingleEndian();
|
||||
LIT.Position .X = IO.ReadSingleEndian();
|
||||
LIT.Position .Y = IO.ReadSingleEndian();
|
||||
LIT.Position .Z = IO.ReadSingleEndian();
|
||||
LIT.ToneCurve.X = IO.ReadSingleEndian();
|
||||
LIT.ToneCurve.Y = IO.ReadSingleEndian();
|
||||
LIT.ToneCurve.Z = IO.ReadSingleEndian();
|
||||
if (IO.IsX) { IO.ReadInt64(); IO.ReadInt64(); IO.ReadInt64();
|
||||
IO.ReadInt64(); IO.ReadInt64(); IO.ReadInt32(); }
|
||||
}
|
||||
}
|
||||
IO.Close();
|
||||
}
|
||||
|
||||
public void TXTWriter(string file)
|
||||
{
|
||||
i = 0;
|
||||
if (LITs.Count < 1) return;
|
||||
|
||||
IO = File.OpenWriter();
|
||||
IO.WriteShiftJIS("Type,AmbientR,AmbientG,AmbientB,DiffuseR,DiffuseG,DiffuseB,SpecularR,SpecularG," +
|
||||
"SpecularB,SpecularA,PosX,PosY,PosZ,ToneCurveBegin,ToneCurveEnd,ToneCurveBlendRate," +
|
||||
(file.EndsWith("_chara") ? "コメント" : "ID") + "\n");
|
||||
for (i0 = 0; i0 < LITs[i].Count; i0++)
|
||||
IO.Write(LITs[i][i0] + "," + i + "\n");
|
||||
File.WriteAllBytes(file + "_light.txt", IO.ToArray(true));
|
||||
}
|
||||
|
||||
public struct LIT
|
||||
{
|
||||
public Id Id;
|
||||
public Flags Flags;
|
||||
public Type Type;
|
||||
public Vector4 Ambient;
|
||||
public Vector4 Diffuse;
|
||||
public Vector4 Specular;
|
||||
public Vector3 Position;
|
||||
public Vector3 ToneCurve;
|
||||
|
||||
public override string ToString() => Flags == 0 ? ",,,,,,,,,,,,,,,," : Type + "," +
|
||||
((Flags & Flags.Ambient ) == 0 ? ",,," : Ambient .ToString(6) + ",") +
|
||||
((Flags & Flags.Diffuse ) == 0 ? ",,," : Diffuse .ToString(6) + ",") +
|
||||
((Flags & Flags.Specular ) == 0 ? ",,,," : Specular .ToString(6) + ",") +
|
||||
((Flags & Flags.Position ) == 0 ? ",,," : Position .ToString(6) + ",") +
|
||||
((Flags & Flags.ToneCurve) == 0 ? ",,," : ToneCurve.ToString(6));
|
||||
}
|
||||
|
||||
public enum Id : int
|
||||
{
|
||||
CHARA = 0,
|
||||
STAGE = 1,
|
||||
SUN = 2,
|
||||
REFLECT = 3,
|
||||
SHADOW = 4,
|
||||
CHARA_COLOR = 5,
|
||||
CHARA_F = 6,
|
||||
PROJECTION = 7,
|
||||
}
|
||||
|
||||
public enum Type : int
|
||||
{
|
||||
OFF = 0,
|
||||
PARALLEL = 1,
|
||||
POINT = 2,
|
||||
SPOT = 3,
|
||||
}
|
||||
|
||||
public enum Flags : int
|
||||
{
|
||||
Type = 0b0000000001,
|
||||
Ambient = 0b0000000010,
|
||||
Diffuse = 0b0000000100,
|
||||
Specular = 0b0000001000,
|
||||
Position = 0b0000010000,
|
||||
ToneCurve = 0b1000000000,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
using KKdBaseLib;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
namespace KKdMainLib.F2nd
|
||||
{
|
||||
public struct Struct
|
||||
{
|
||||
public Header Header;
|
||||
public byte[] Data;
|
||||
public Struct[] SubStructs;
|
||||
public bool EOFC;
|
||||
public ENRS[] ENRS;
|
||||
public KKdList<long> POF;
|
||||
|
||||
public long DataOffset;
|
||||
|
||||
public override string ToString() => Header.ToString() + (SubStructs != null ?
|
||||
"; SubStructs: " + SubStructs.Length : "")+ (ENRS != null ? "; Has ENRS" : "") +
|
||||
(POF.NotNull ? "; Has POF" : "") + (EOFC ? "; Has EOFC" : "");
|
||||
|
||||
public static Struct ReadStruct(byte[] Data)
|
||||
{
|
||||
Stream stream = File.OpenReader(Data);
|
||||
Struct Struct = ReadStruct(ref stream, stream.ReadHeader(false));
|
||||
stream.Close();
|
||||
return Struct;
|
||||
}
|
||||
|
||||
private static Struct ReadStruct(ref Stream stream, Header Header)
|
||||
{
|
||||
Struct Struct = new Struct { Header = Header, DataOffset =
|
||||
stream.Position, Data = stream.ReadBytes(Header.SectionSize) };
|
||||
int ID = Header.ID;
|
||||
|
||||
KKdList<Struct> SubStructs = KKdList<Struct>.New;
|
||||
long Length = stream.Length - stream.Position;
|
||||
long Position = 0;
|
||||
while (Length > Position)
|
||||
{
|
||||
Header = stream.ReadHeader(false);
|
||||
Position += Header.Length + Header.DataSize;
|
||||
if (Header.ID == ID && Header.Signature == 0x43464F45)
|
||||
{ Struct.EOFC = true; break; }
|
||||
else if (Header.ID == 0 && (Header.Signature == 0x30464F50 ||
|
||||
Header.Signature == 0x31464F50 || Header.Signature == 0x53524E45))
|
||||
SubStructs.Add(new Struct { Header = Header, DataOffset =
|
||||
stream.Position, Data = stream.ReadBytes(Header.SectionSize) });
|
||||
else if (Header.ID <= ID)
|
||||
{ stream.LongPosition -= Header.Length; break; }
|
||||
else SubStructs.Add(ReadStruct(ref stream, Header));
|
||||
}
|
||||
|
||||
for (int i = 0; i < SubStructs.Capacity; i++)
|
||||
{
|
||||
string Sig = SubStructs[i].Header.ToString();
|
||||
if (Sig == "ENRS" || Sig == "EOFC" || Sig == "POF0" || Sig == "POF1")
|
||||
{
|
||||
if (Sig == "EOFC") Struct.EOFC = true;
|
||||
else if (Sig == "ENRS") Struct.ENRS = F2nd.ENRS.Read(SubStructs[i].Data);
|
||||
else Struct.POF = F2nd.POF .Read(SubStructs[i].Data, Sig == "POF1");
|
||||
SubStructs.RemoveAt(i); SubStructs.Capacity--; i--;
|
||||
}
|
||||
}
|
||||
|
||||
if (SubStructs.Capacity > 0) Struct.SubStructs = SubStructs.ToArray();
|
||||
return Struct;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,15 @@ namespace KKdMainLib.IO
|
||||
}
|
||||
return s.ToArray();
|
||||
}
|
||||
|
||||
public static byte PeekByte(this Stream stream)
|
||||
{ byte val = stream.ReadByte(); stream.LongPosition--; return val; }
|
||||
public static char PeekCharASCII(this Stream stream)
|
||||
{ byte val = stream.ReadByte(); stream.LongPosition--; return (char)val; }
|
||||
public static char PeekCharUTF8(this Stream stream)
|
||||
{ long LongPosition = stream.LongPosition; char val = stream.ReadCharUTF8();
|
||||
stream.LongPosition = LongPosition; return val; }
|
||||
|
||||
public static Stream SkipWhitespace(this Stream stream)
|
||||
{
|
||||
while (true)
|
||||
@@ -29,6 +35,25 @@ namespace KKdMainLib.IO
|
||||
else break;
|
||||
return stream;
|
||||
}
|
||||
|
||||
public static bool Assert(this Stream stream, byte next)
|
||||
{ if (stream.PeekByte() == next) { stream.PeekByte(); return true; } else return false; }
|
||||
public static bool Assert(this Stream stream, byte[] next)
|
||||
{
|
||||
for (var i = 0; i < next.Length; i++)
|
||||
if (!stream.Assert(next[i])) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool AssertASCII(this Stream stream, char next)
|
||||
{ if (stream.PeekCharUTF8() == next) { stream.ReadCharUTF8(); return true; } else return false; }
|
||||
public static bool AssertASCII(this Stream stream, string next)
|
||||
{
|
||||
for (var i = 0; i < next.Length; i++)
|
||||
if (!stream.AssertASCII(next[i])) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Assert(this Stream stream, char next)
|
||||
{ if (stream.PeekCharUTF8() == next) { stream.ReadCharUTF8(); return true; } else return false; }
|
||||
public static bool Assert(this Stream stream, string next)
|
||||
|
||||
+8
-28
@@ -173,11 +173,11 @@ namespace KKdMainLib.IO
|
||||
{ string s = ""; while (char.IsDigit(_IO.SkipWhitespace().
|
||||
PeekCharUTF8())) s += _IO.ReadCharUTF8(); return s; }
|
||||
|
||||
public JSON Write(MsgPack MsgPack, string End = "\n", string TabChar = " ")
|
||||
{ Write(MsgPack, End, TabChar, "", true); return this; }
|
||||
public JSON Write(MsgPack MsgPack, string End = "\n", string TabChar = " ") =>
|
||||
Write(MsgPack, End, TabChar, "", true);
|
||||
|
||||
public JSON Write(MsgPack MsgPack, bool Style = false)
|
||||
{ Write(MsgPack, "\n", " ", "", Style); return this; }
|
||||
public JSON Write(MsgPack MsgPack, bool Style = false) =>
|
||||
Write(MsgPack, "\n", " ", "", Style);
|
||||
|
||||
private JSON Write(MsgPack MsgPack, string End, string TabChar, string Tab, bool Style, bool IsArray = false)
|
||||
{
|
||||
@@ -185,7 +185,7 @@ namespace KKdMainLib.IO
|
||||
Tab += TabChar;
|
||||
if (MsgPack.Name != null && !IsArray) _IO.Write("\"" + MsgPack.Name + "\":" + (Style ? " " : ""));
|
||||
if (MsgPack.Object == null) { WriteNil(); return this; }
|
||||
|
||||
|
||||
if (MsgPack.List.NotNull)
|
||||
{
|
||||
WriteMap();
|
||||
@@ -228,33 +228,13 @@ namespace KKdMainLib.IO
|
||||
if (Style) _IO.Write(OldTab);
|
||||
WriteArr(true);
|
||||
}
|
||||
else if (MsgPack.Object is MsgPack msg)
|
||||
Write(msg, End, TabChar, Tab, Style);
|
||||
else Write(MsgPack.Object, End, TabChar, Tab, Style);
|
||||
else if (MsgPack.Object is MsgPack msg) Write(msg, End, TabChar, Tab, Style);
|
||||
else if (MsgPack.Object is string str) Write(str);
|
||||
else _IO.Write(BaseExtensions.ToString(MsgPack.Object));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private void Write(object obj, string End, string TabChar, string Tab, bool Style)
|
||||
{
|
||||
if (obj == null) { WriteNil(); return; }
|
||||
switch (obj)
|
||||
{
|
||||
case MsgPack val: Write(val, End, TabChar, Tab, Style); break;
|
||||
case string val: Write(val); break;
|
||||
case bool Boolean:
|
||||
case sbyte Int8 :
|
||||
case byte UInt8 :
|
||||
case short Int16:
|
||||
case ushort UInt16:
|
||||
case int Int32:
|
||||
case uint UInt32:
|
||||
case long Int64:
|
||||
case ulong UInt64:
|
||||
case float Float32:
|
||||
case double Float64: _IO.Write(BaseExtensions.ToString(obj)); break;
|
||||
}
|
||||
}
|
||||
private void Write(string val) => _IO.Write("\"" + val
|
||||
.Replace("\\", "\\\\").Replace("/" , "\\/").Replace("\"", "\\\"")
|
||||
.Replace("\0", "\\0" ).Replace("\b", "\\b").Replace("\f", "\\f" )
|
||||
|
||||
+2
-2
@@ -16,8 +16,8 @@ namespace KKdMainLib.IO
|
||||
public MsgPack Read(bool Array = false)
|
||||
{
|
||||
MsgPack MsgPack = MsgPack.New;
|
||||
if (!Array) MsgPack.Name = ReadString((Types)_IO.ReadByte());
|
||||
byte Unk = _IO.ReadByte();
|
||||
if (!Array) { MsgPack.Name = ReadString((Types)Unk); Unk = _IO.ReadByte(); }
|
||||
Types Type = (Types)Unk;
|
||||
|
||||
if (Type >= Types.FixMap && Type <= Types.FixMapMax)
|
||||
@@ -30,7 +30,7 @@ namespace KKdMainLib.IO
|
||||
MsgPack.Object = new MsgPack[Unk - (byte)Types.FixArr];
|
||||
for (int i = 0; i < Unk - (byte)Types.FixArr; i++) MsgPack[i] = Read( true);
|
||||
}
|
||||
else if (Type >= Types.FixStr && Type <= Types.FixStrMax) MsgPack.Object = ReadString( Type);
|
||||
else if (Type >= Types.FixStr && Type <= Types.FixStrMax) MsgPack.Object = ReadString(Type);
|
||||
else if (Type >= Types.PosInt && Type <= Types.PosIntMax) MsgPack.Object = Unk;
|
||||
else if (Type >= Types.NegInt && Type <= Types.NegIntMax) MsgPack.Object = (sbyte)Unk;
|
||||
else
|
||||
|
||||
@@ -368,8 +368,8 @@ namespace KKdMainLib.IO
|
||||
ValWrite &= 0xFF;
|
||||
}
|
||||
|
||||
public void CheckRead () { if (BitRead > 0) ValRead = 0; BitRead = 8; }
|
||||
public void CheckWrited() { if (BitWrite > 0) { Write(ValWrite); ValWrite = 0; BitWrite = 0; } }
|
||||
public void CheckRead () { if (BitRead > 0) ValRead = 0; BitRead = 8; }
|
||||
public void CheckWrited() { if (BitWrite > 0) { WriteByte((byte)ValWrite); ValWrite = 0; BitWrite = 0; } }
|
||||
|
||||
public byte[] ToArray(bool Close)
|
||||
{ byte[] Data = ToArray(); if (Close) this.Close(); return Data; }
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
<Compile Include="DB\Aet.cs" />
|
||||
<Compile Include="DB\Auth.cs" />
|
||||
<Compile Include="DB\Spr.cs" />
|
||||
<Compile Include="F2nd\ENRS.cs" />
|
||||
<Compile Include="F2nd\Header.cs" />
|
||||
<Compile Include="F2nd\POF.cs" />
|
||||
<Compile Include="F2nd\Struct.cs" />
|
||||
<Compile Include="F2\Bloom.cs" />
|
||||
<Compile Include="F2\ColorCorrection.cs" />
|
||||
<Compile Include="F2\DOF.cs" />
|
||||
<Compile Include="F2\Light.cs" />
|
||||
<Compile Include="IO\Directory.cs" />
|
||||
<Compile Include="IO\Extensions.cs" />
|
||||
<Compile Include="IO\File.cs" />
|
||||
@@ -61,6 +61,7 @@
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="FARC.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="Mot.cs" />
|
||||
<Compile Include="STR.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
+9
-32
@@ -82,35 +82,33 @@ namespace KKdMainLib
|
||||
Multiselect = true, Title = "Choose file(s) to open:" };
|
||||
|
||||
ofd.Filter = GetArgs("All;", false, "*");
|
||||
if (filetype == "a3da") ofd.Filter = GetArgs("A3DA", "a3da", "farc", "json", "mp") +
|
||||
GetArgs("A3DA", true, "a3da") + GetArgs("FARC", true, "farc") + JSON + MsgPack;
|
||||
if (filetype == "a3da") ofd.Filter = GetArgs("A3DA", "a3da", "farc", "json", "mp") +
|
||||
GetArgs("A3DA", true, "a3da") + GetArgs("FARC", true, "farc") + JSON + MsgPack;
|
||||
else if (filetype == "bin" ) ofd.Filter = GetArgs("BIN" , "bin", "json", "mp") +
|
||||
BIN + JSON + MsgPack;
|
||||
else if (filetype == "blt" ) ofd.Filter = GetArgs("BLT" , "blt");
|
||||
else if (filetype == "bon" ) ofd.Filter = GetArgs("BON" , "bon", "bin", "json", "mp") +
|
||||
GetArgs("BON", true, "bon") + BIN + JSON + MsgPack;
|
||||
else if (filetype == "cct" ) ofd.Filter = GetArgs("CCT" , "cct");
|
||||
else if (filetype == "databank") ofd.Filter = GetArgs("DAT", "dat", "json", "mp") +
|
||||
GetArgs("DAT", true, "dat") + JSON + MsgPack;
|
||||
else if (filetype == "dex" ) ofd.Filter = GetArgs("DEX" , "dex", "bin", "json", "mp") +
|
||||
GetArgs("DEX", true, "dex") + BIN + JSON + MsgPack;
|
||||
else if (filetype == "dft") ofd.Filter = GetArgs("DFT" , "dft");
|
||||
else if (filetype == "diva") ofd.Filter = GetArgs("DIVA", "diva", "wav") +
|
||||
GetArgs("DIVA", true, "diva") + GetArgs("WAV", true, "wav");
|
||||
else if (filetype == "dsc" ) ofd.Filter = GetArgs("DSC" , "dsc", "json", "mp") +
|
||||
GetArgs("DSC", true, "dsc") + JSON + MsgPack;
|
||||
else if (filetype == "farc") ofd.Filter = "FARC Archives (*.farc)|*.farc";
|
||||
else if (filetype == "image") ofd.Filter = GetArgs("Image", "dds", "png") +
|
||||
GetArgs("DDS", true, "dds") + GetArgs("PNG", true, "png");
|
||||
else if (filetype == "json") ofd.Filter = "JSON (*.json)|*.json";
|
||||
else if (filetype == "kki" ) ofd.Filter = GetArgs("KKI", "kki");
|
||||
else if (filetype == "mp" ) ofd.Filter = GetArgs("MessagePack", "mp");
|
||||
else if (filetype == "ppd" ) ofd.Filter = GetArgs("PPD", "ppd", "pak", "mod") +
|
||||
GetArgs("PPD", true, "ppd") + GetArgs("PAK", true, "pak") + GetArgs("MOD", true, "mod");
|
||||
else if (filetype == "str" ) ofd.Filter = GetArgs("STR", "str", "bin", "json", "mp") +
|
||||
else if (filetype == "lit") ofd.Filter = GetArgs("LIT" , "lit");
|
||||
else if (filetype == "str" ) ofd.Filter = GetArgs("STR" , "str", "bin", "json", "mp") +
|
||||
GetArgs("STR", true, "str") + BIN + JSON + MsgPack;
|
||||
else if (filetype == "vag" ) ofd.Filter = GetArgs("VAG", "vag", "wav") +
|
||||
else if (filetype == "vag" ) ofd.Filter = GetArgs("VAG" , "vag", "wav") +
|
||||
GetArgs("VAG", true, "vag") + GetArgs("WAV", true, "wav");
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
FileNames = ofd.FileNames;
|
||||
if (ofd.ShowDialog() == DialogResult.OK) FileNames = ofd.FileNames;
|
||||
ofd.Dispose();
|
||||
}
|
||||
else if (code == 2)
|
||||
@@ -126,27 +124,6 @@ namespace KKdMainLib
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void ChooseSave(string filetype,
|
||||
out string InitialDirectory, out string[] FileNames)
|
||||
{
|
||||
InitialDirectory = "";
|
||||
FileNames = new string[0];
|
||||
Console.WriteLine("Choose file to save:");
|
||||
SaveFileDialog sfd = new SaveFileDialog { InitialDirectory = Application.StartupPath };
|
||||
switch (filetype)
|
||||
{
|
||||
case "kki":
|
||||
sfd.Filter = "KKI file (*.kki)|*.kki";
|
||||
break;
|
||||
}
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
InitialDirectory = sfd.InitialDirectory.ToString();
|
||||
FileNames = sfd.FileNames;
|
||||
}
|
||||
sfd.Dispose();
|
||||
}
|
||||
|
||||
public static string NullTerminated(this string Source, ref int i, byte End)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
//Original: https://github.com/blueskythlikesclouds/MikuMikuLibrary/
|
||||
|
||||
using KKdBaseLib;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
namespace KKdMainLib
|
||||
{
|
||||
public struct Mot
|
||||
{
|
||||
private int i, i0, i1;
|
||||
private MotHeader[] MOT;
|
||||
private Stream IO;
|
||||
|
||||
public void MOTReader(string file)
|
||||
{
|
||||
IO = File.OpenReader(file + ".bin");
|
||||
|
||||
i = 0;
|
||||
while (true)
|
||||
if (IO.ReadInt64() == 0) break;
|
||||
else { IO.ReadInt64(); i++; }
|
||||
if (i == 0) return;
|
||||
|
||||
int MOTCount = i;
|
||||
MsgPack m = new MsgPack(MOTCount, "Mot");
|
||||
MOT = new MotHeader[MOTCount];
|
||||
for (i = 0; i < MOTCount; i++)
|
||||
{
|
||||
ref MotHeader Mot = ref MOT[i];
|
||||
Mot.KeySet .Offset = IO.ReadInt32();
|
||||
Mot.KeySetTypesOffset = IO.ReadInt32();
|
||||
Mot. KeySetOffset = IO.ReadInt32();
|
||||
Mot.BoneInfo .Offset = IO.ReadInt32();
|
||||
}
|
||||
|
||||
for (i = 0; i < MOTCount; i++)
|
||||
{
|
||||
ref MotHeader Mot = ref MOT[i];
|
||||
|
||||
i0 = 1;
|
||||
IO.Position = Mot.BoneInfo.Offset;
|
||||
IO.ReadUInt16();
|
||||
while (IO.ReadUInt16() != 0) 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)) & 0b11) };
|
||||
}
|
||||
|
||||
IO.Position = Mot.KeySetOffset;
|
||||
for (i0 = 0; i0 < Mot.KeySet.Value.Length; i0++)
|
||||
{
|
||||
ref KeySet Key = ref Mot.KeySet.Value[i0];
|
||||
if (Key.Type == KeySetType.Static)
|
||||
{ Key.Keys = new KFT2<ushort, float>[1];
|
||||
Key.Keys[0].V = IO.ReadSingle(); }
|
||||
else if (Key.Type == KeySetType.Linear)
|
||||
{
|
||||
Key.Keys = new KFT2<ushort, float>[IO.ReadUInt16()];
|
||||
for (i1 = 0; i1 < Key.Keys.Length; i1++)
|
||||
Key.Keys[i1].F = IO.ReadUInt16();
|
||||
IO.Align(0x4);
|
||||
for (i1 = 0; i1 < Key.Keys.Length; i1++)
|
||||
Key.Keys[i1].V = IO.ReadSingle();
|
||||
}
|
||||
else if (Key.Type == KeySetType.Interpolated)
|
||||
{
|
||||
Key.Keys = new KFT2<ushort, float>[IO.ReadUInt16()];
|
||||
for (i1 = 0; i1 < Key.Keys.Length; i1++)
|
||||
Key.Keys[i].F = IO.ReadUInt16();
|
||||
IO.Align(0x4);
|
||||
for (i1 = 0; i1 < Key.Keys.Length; i1++)
|
||||
{ Key.Keys[i1].V = IO.ReadSingle(); Key.Keys[i1].T = IO.ReadSingle(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
IO.Close();
|
||||
}
|
||||
|
||||
public void MOTWriter(string file)
|
||||
{
|
||||
if (MOT == null) return;
|
||||
IO = File.OpenWriter(file + ".bin");
|
||||
|
||||
int MOTCount = MOT.Length;
|
||||
IO.Position = (MOTCount + 1) << 4;
|
||||
for (i = 0; i < MOTCount; i++)
|
||||
{
|
||||
ref MotHeader Mot = ref MOT[i];
|
||||
Mot.KeySet.Offset = IO.Position;
|
||||
IO.Write((ushort)((Mot.HighBits << 14) | (Mot.KeySet.Value.Length & 0x3FFF)));
|
||||
IO.Write((ushort)Mot.FrameCount);
|
||||
|
||||
Mot.KeySetTypesOffset = IO.Position;
|
||||
for (i0 = 0, i1 = 0; i0 < Mot.KeySet.Value.Length; i0++)
|
||||
{
|
||||
i1 |= ((byte)Mot.KeySet.Value[i0].Type << (i0 % 8 * 2)) & (0b11 << (i0 % 8 * 2));
|
||||
|
||||
if (i0 % 8 == 7) { IO.Write((ushort)i1); i1 = 0; }
|
||||
}
|
||||
IO.Write((ushort)i1);
|
||||
|
||||
IO.Align(0x4);
|
||||
Mot.KeySetOffset = IO.Position;
|
||||
for (i0 = 0; i0 < Mot.KeySet.Value.Length; i0++)
|
||||
{
|
||||
ref KeySet Key = ref Mot.KeySet.Value[i0];
|
||||
if (Key.Type == KeySetType.Static)
|
||||
IO.Write(Key.Keys[0].V);
|
||||
else if (Key.Type == KeySetType.Linear)
|
||||
{
|
||||
IO.Write((ushort)Key.Keys.Length);
|
||||
for (i1 = 0; i1 < Key.Keys.Length; i1++)
|
||||
IO.Write(Key.Keys[i1].F);
|
||||
IO.Align(0x4);
|
||||
for (i1 = 0; i1 < Key.Keys.Length; i1++)
|
||||
IO.Write(Key.Keys[i1].V);
|
||||
}
|
||||
else if (Key.Type == KeySetType.Interpolated)
|
||||
{
|
||||
IO.Write((ushort)Key.Keys.Length);
|
||||
for (i1 = 0; i1 < Key.Keys.Length; i1++)
|
||||
IO.Write(Key.Keys[i1].F);
|
||||
IO.Align(0x4);
|
||||
for (i1 = 0; i1 < Key.Keys.Length; i1++)
|
||||
{ IO.Write(Key.Keys[i1].V); IO.Write(Key.Keys[i1].T); }
|
||||
}
|
||||
}
|
||||
IO.Align(0x4);
|
||||
|
||||
Mot.BoneInfo.Offset = IO.Position;
|
||||
for (i0 = 0; i0 < Mot.BoneInfo.Value.Length; i0++)
|
||||
IO.Write((ushort)Mot.BoneInfo.Value[i0].Id);
|
||||
IO.Write((ushort)0);
|
||||
}
|
||||
IO.Align(0x4, true);
|
||||
|
||||
IO.Position = 0;
|
||||
for (i = 0; i < MOTCount; i++)
|
||||
{
|
||||
ref MotHeader Mot = ref MOT[i];
|
||||
IO.Write(Mot.KeySet .Offset);
|
||||
IO.Write(Mot.KeySetTypesOffset);
|
||||
IO.Write(Mot. KeySetOffset);
|
||||
IO.Write(Mot.BoneInfo .Offset);
|
||||
}
|
||||
|
||||
IO.Close();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool JSON)
|
||||
{
|
||||
MOT = null;
|
||||
|
||||
MsgPack MsgPack = file.ReadMP(JSON);
|
||||
if (!MsgPack.ElementArray("MOT", out MsgPack MOTS)) { MsgPack.Dispose(); return; }
|
||||
|
||||
if (MOTS.Array != null)
|
||||
if (MOTS.Array.Length > 0)
|
||||
{
|
||||
MOT = new MotHeader[MOTS.Array.Length];
|
||||
for (int i = 0; i < MOT.Length; i++)
|
||||
MsgPackReader(MOTS.Array[i], ref MOT[i]);
|
||||
}
|
||||
|
||||
MsgPack.Dispose();
|
||||
}
|
||||
|
||||
public void MsgPackWriter(string file, bool JSON)
|
||||
{
|
||||
int MOTCount = MOT.Length;
|
||||
MsgPack MOTS = new MsgPack(MOTCount, "MOT");
|
||||
for (i = 0; i < MOTCount; i++)
|
||||
MOTS[i] = MsgPackWriter(ref MOT[i]);
|
||||
MOTS.Write(true, file, JSON);
|
||||
}
|
||||
|
||||
public void MsgPackReader(MsgPack MOT, ref MotHeader Mot)
|
||||
{
|
||||
MsgPack Temp = MsgPack.New;
|
||||
Mot.HighBits = MOT.ReadInt32("HighBits" );
|
||||
Mot.FrameCount = MOT.ReadInt32("FrameCount");
|
||||
|
||||
if (!MOT.ElementArray("KeySets", out Temp)) return;
|
||||
|
||||
Mot.KeySet.Value = new KeySet[Temp.Array.Length];
|
||||
for (i0 = 0; i0 < Mot.KeySet.Value.Length; i0++)
|
||||
{
|
||||
ref KeySet KeySet = ref Mot.KeySet.Value[i0];
|
||||
|
||||
if (Temp.Array[i0].Array == null || Temp.Array[i0].Array.Length != 2) continue;
|
||||
KeySet.Type = (KeySetType)Temp.Array[i0].Array[0].ReadInt32();
|
||||
|
||||
MsgPack keySet = Temp.Array[i0].Array[1];
|
||||
|
||||
if (keySet.Array == null) { KeySet.Type = 0; continue; }
|
||||
else if (KeySet.Type == KeySetType.None) continue;
|
||||
else if (KeySet.Type == KeySetType.Static)
|
||||
{
|
||||
KeySet.Keys = new KFT2<ushort, float>[1];
|
||||
KeySet.Keys[0].F = keySet.Array[0][0].ReadUInt16();
|
||||
KeySet.Keys[0].V = keySet.Array[0][1].ReadSingle();
|
||||
}
|
||||
else if (KeySet.Type == KeySetType.Linear)
|
||||
{
|
||||
KeySet.Keys = new KFT2<ushort, float>[keySet.Array.Length];
|
||||
for (i1 = 0; i1 < keySet.Array.Length; i1++)
|
||||
{
|
||||
KeySet.Keys[i1].F = keySet.Array[i1][0].ReadUInt16();
|
||||
KeySet.Keys[i1].V = keySet.Array[i1][1].ReadSingle();
|
||||
}
|
||||
}
|
||||
else if (KeySet.Type == KeySetType.Interpolated)
|
||||
{
|
||||
KeySet.Keys = new KFT2<ushort, float>[keySet.Array.Length];
|
||||
for (i1 = 0; i1 < keySet.Array.Length; i1++)
|
||||
{
|
||||
KeySet.Keys[i1].F = keySet.Array[i1][0].ReadUInt16();
|
||||
KeySet.Keys[i1].V = keySet.Array[i1][1].ReadSingle();
|
||||
KeySet.Keys[i1].T = keySet.Array[i1][2].ReadSingle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MOT.ElementArray("BoneInfo", out Temp))
|
||||
{
|
||||
Mot.BoneInfo.Value = new BoneInfo[Temp.Array.Length];
|
||||
for (i = 0; i < Mot.BoneInfo.Value.Length; i++)
|
||||
Mot.BoneInfo.Value[i].Id = Temp[i].ReadInt32();
|
||||
}
|
||||
else return;
|
||||
}
|
||||
|
||||
public MsgPack MsgPackWriter(ref MotHeader Mot)
|
||||
{
|
||||
MsgPack MOT = MsgPack.NewReserve(4).Add("FrameCount", Mot.FrameCount).Add("HighBits", Mot.HighBits);
|
||||
|
||||
MsgPack KeySets = new MsgPack(Mot.KeySet.Value.Length, "KeySets");
|
||||
for (i0 = 0; i0 < Mot.KeySet.Value.Length; i0++)
|
||||
{
|
||||
ref KeySet KeySet = ref Mot.KeySet.Value[i0];
|
||||
if (KeySet.Type == KeySetType.None) continue;
|
||||
|
||||
KeySets[i0] = new MsgPack(2);
|
||||
KeySets[i0].Array[0] = (MsgPack)(byte)KeySet.Type;
|
||||
KeySets[i0].Array[1] = new MsgPack(KeySet.Keys.Length);
|
||||
if (KeySet.Type == KeySetType.Static)
|
||||
{
|
||||
KeySets[i0].Array[1][0] = new MsgPack(2);
|
||||
KeySets[i0].Array[1][0].Array[0] = (MsgPack)KeySet.Keys[0].F;
|
||||
KeySets[i0].Array[1][0].Array[1] = (MsgPack)KeySet.Keys[0].V;
|
||||
}
|
||||
else if (KeySet.Type == KeySetType.Linear)
|
||||
for (i1 = 0; i1 < KeySet.Keys.Length; i1++)
|
||||
{
|
||||
KeySets[i0].Array[1][i1] = new MsgPack(2);
|
||||
KeySets[i0].Array[1][i1].Array[0] = (MsgPack)KeySet.Keys[i1].F;
|
||||
KeySets[i0].Array[1][i1].Array[1] = (MsgPack)KeySet.Keys[i1].V;
|
||||
}
|
||||
else
|
||||
for (i1 = 0; i1 < KeySet.Keys.Length; i1++)
|
||||
{
|
||||
KeySets[i0].Array[1][i1] = new MsgPack(3);
|
||||
KeySets[i0].Array[1][i1].Array[0] = (MsgPack)KeySet.Keys[i1].F;
|
||||
KeySets[i0].Array[1][i1].Array[1] = (MsgPack)KeySet.Keys[i1].V;
|
||||
KeySets[i0].Array[1][i1].Array[2] = (MsgPack)KeySet.Keys[i1].T;
|
||||
}
|
||||
}
|
||||
MOT.Add(KeySets);
|
||||
|
||||
MsgPack BoneInfo = new MsgPack(Mot.BoneInfo.Value.Length, "BoneInfo");
|
||||
for (i0 = 0; i0 < Mot.BoneInfo.Value.Length; i0++)
|
||||
BoneInfo[i0] = (MsgPack)Mot.BoneInfo.Value[i0].Id;
|
||||
MOT.Add(BoneInfo);
|
||||
|
||||
return MOT;
|
||||
}
|
||||
|
||||
public struct MotHeader
|
||||
{
|
||||
public int KeySetOffset;
|
||||
public int KeySetTypesOffset;
|
||||
public Pointer< KeySet []> KeySet ;
|
||||
public Pointer<BoneInfo[]> BoneInfo;
|
||||
|
||||
public int HighBits;
|
||||
public int FrameCount;
|
||||
}
|
||||
|
||||
public struct KeySet
|
||||
{
|
||||
public KFT2<ushort, float>[] Keys;
|
||||
public KeySetType Type;
|
||||
|
||||
public override string ToString() => $"Type: {Type}" + (Type == KeySetType.Static ?
|
||||
$"; Value: {Keys[0].Check()}" : Type > KeySetType.Static ? $"; Keys: {Keys.Length}" : "");
|
||||
}
|
||||
|
||||
public enum KeySetType : byte
|
||||
{
|
||||
None = 0b00,
|
||||
Static = 0b01,
|
||||
Linear = 0b10,
|
||||
Interpolated = 0b11,
|
||||
}
|
||||
|
||||
public struct BoneInfo
|
||||
{
|
||||
public string Name;
|
||||
public int Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("2BA7EFC6-91D1-8BBC-C487-06C7F36CC789")]
|
||||
[assembly: AssemblyVersion("0.4.7.1")]
|
||||
[assembly: AssemblyFileVersion("0.4.7.1")]
|
||||
[assembly: AssemblyVersion("0.4.7.2")]
|
||||
[assembly: AssemblyFileVersion("0.4.7.2")]
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2nd;
|
||||
|
||||
namespace KKdMainLib
|
||||
{
|
||||
@@ -183,7 +183,7 @@ namespace KKdMainLib
|
||||
if (STRs[i].Str.Value == null) STRs[i].Str.Value = "";
|
||||
}
|
||||
|
||||
MsgPack = MsgPack.New;
|
||||
MsgPack.Dispose();
|
||||
}
|
||||
|
||||
public void MsgPackWriter(string file, bool JSON)
|
||||
|
||||
@@ -89,7 +89,6 @@ namespace KKdSoundLib
|
||||
VAGData.DataPtr[i * ch + c] = temp_bufferPtr[i ];
|
||||
VAGData.DataPtr[i2 * ch + c] = temp_bufferPtr[i2];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
for (i1 = 0; i1 < VAGData.Size; i1++, VAGData.DataPtr += VBS)
|
||||
|
||||
@@ -39,14 +39,19 @@
|
||||
<NoWarn>IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="classes\DataBase.cs" />
|
||||
<Compile Include="classes\Tools\A3D.cs" />
|
||||
<Compile Include="classes\Tools\AET.cs" />
|
||||
<Compile Include="classes\Tools\BLT.cs" />
|
||||
<Compile Include="classes\Tools\CCT.cs" />
|
||||
<Compile Include="classes\Tools\DB.cs" />
|
||||
<Compile Include="classes\Tools\DEX.cs" />
|
||||
<Compile Include="classes\Tools\DFT.cs" />
|
||||
<Compile Include="classes\Tools\DIV.cs" />
|
||||
<Compile Include="classes\Tools\LIT.cs" />
|
||||
<Compile Include="classes\Tools\MOT.cs" />
|
||||
<Compile Include="classes\Tools\STR.cs" />
|
||||
<Compile Include="classes\Tools\VAG.cs" />
|
||||
<Compile Include="classes\DataBase.cs" />
|
||||
<Compile Include="classes\DIVAFILE.cs" />
|
||||
<Compile Include="classes\FARC.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
|
||||
+66
-17
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using KKdMainLib;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMain = KKdMainLib.Main;
|
||||
using KKdFARC = KKdMainLib.FARC;
|
||||
@@ -7,11 +8,16 @@ namespace PD_Tool
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
|
||||
static extern bool SetProcessDPIAware();
|
||||
|
||||
[ThreadStatic] public static string function = "";
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
SetProcessDPIAware();
|
||||
|
||||
Console.Title = "PD_Tool";
|
||||
if (args.Length == 0)
|
||||
{
|
||||
@@ -41,6 +47,9 @@ namespace PD_Tool
|
||||
|
||||
private static void MainMenu()
|
||||
{
|
||||
GC.Collect();
|
||||
Console. InputEncoding = System.Text.Encoding.Unicode;
|
||||
Console.OutputEncoding = System.Text.Encoding.Unicode;
|
||||
Console.Title = "PD_Tool";
|
||||
Console.Clear();
|
||||
|
||||
@@ -52,8 +61,9 @@ namespace PD_Tool
|
||||
KKdMain.ConsoleDesign("3. Decrypt from DIVAFILE");
|
||||
KKdMain.ConsoleDesign("4. Encrypt to DIVAFILE");
|
||||
KKdMain.ConsoleDesign("5. DB_Tools");
|
||||
KKdMain.ConsoleDesign("6. Converting Tools");
|
||||
KKdMain.ConsoleDesign(JSON ? "7. MsgPack to JSON" : "7. JSON to MsgPack");
|
||||
KKdMain.ConsoleDesign("6. AC/DT/F/AFT/FT Converting Tools");
|
||||
KKdMain.ConsoleDesign("7. F/F2/X/FT Converting Tools");
|
||||
KKdMain.ConsoleDesign(JSON ? "8. MsgPack to JSON" : "9. JSON to MsgPack");
|
||||
KKdMain.ConsoleDesign(false);
|
||||
KKdMain.ConsoleDesign(JSON ? "M. MessagePack" : "J. JSON");
|
||||
KKdMain.ConsoleDesign("Q. Quit");
|
||||
@@ -81,17 +91,17 @@ namespace PD_Tool
|
||||
else if (function == "6")
|
||||
{
|
||||
Console.Clear();
|
||||
Console.Title = "Converter Tools";
|
||||
Console.Title = "AC/DT/F/AFT/FT Converting Tools";
|
||||
KKdMain.ConsoleDesign(true);
|
||||
KKdMain.ConsoleDesign(" Choose tool:");
|
||||
KKdMain.ConsoleDesign(" Choose converter:");
|
||||
KKdMain.ConsoleDesign(false);
|
||||
KKdMain.ConsoleDesign("1. A3DA Converter");
|
||||
KKdMain.ConsoleDesign("2. AET Converter");
|
||||
KKdMain.ConsoleDesign("3. DataBank Converter");
|
||||
KKdMain.ConsoleDesign("4. DEX Converter");
|
||||
KKdMain.ConsoleDesign("5. DIVA Converter");
|
||||
KKdMain.ConsoleDesign("6. STR Converter");
|
||||
KKdMain.ConsoleDesign("7. VAG Converter");
|
||||
KKdMain.ConsoleDesign("1. A3DA" );
|
||||
KKdMain.ConsoleDesign("2. AET" );
|
||||
KKdMain.ConsoleDesign("3. DataBank");
|
||||
KKdMain.ConsoleDesign("4. DEX" );
|
||||
KKdMain.ConsoleDesign("5. DIVA" );
|
||||
KKdMain.ConsoleDesign("6. MOT" );
|
||||
KKdMain.ConsoleDesign("7. STR" );
|
||||
KKdMain.ConsoleDesign(false);
|
||||
KKdMain.ConsoleDesign("R. Return to Main Menu");
|
||||
KKdMain.ConsoleDesign(false);
|
||||
@@ -104,17 +114,56 @@ namespace PD_Tool
|
||||
else if (Function == "3") Tools.DB .Processor(JSON);
|
||||
else if (Function == "4") Tools.DEX.Processor(JSON);
|
||||
else if (Function == "5") Tools.DIV.Processor();
|
||||
else if (Function == "6") Tools.STR.Processor(JSON);
|
||||
else if (Function == "7") Tools.VAG.Processor();
|
||||
else if (Function == "6") Tools.MOT.Processor(JSON);
|
||||
else if (Function == "7") Tools.STR.Processor(JSON);
|
||||
else function = Function;
|
||||
}
|
||||
else if (function == "7")
|
||||
{
|
||||
Console.Clear();
|
||||
Console.Title = "F/F2/X/FT Converting Tools";
|
||||
KKdMain.ConsoleDesign(true);
|
||||
KKdMain.ConsoleDesign(" Choose converter:");
|
||||
KKdMain.ConsoleDesign(false);
|
||||
KKdMain.ConsoleDesign("1. A3DA" );
|
||||
KKdMain.ConsoleDesign("2. Bloom" );
|
||||
KKdMain.ConsoleDesign("3. Color Correction");
|
||||
KKdMain.ConsoleDesign("4. DEX" );
|
||||
KKdMain.ConsoleDesign("5. DOF" );
|
||||
KKdMain.ConsoleDesign("6. Light" );
|
||||
KKdMain.ConsoleDesign("7. STR" );
|
||||
KKdMain.ConsoleDesign("8. VAG" );
|
||||
KKdMain.ConsoleDesign(false);
|
||||
KKdMain.ConsoleDesign("R. Return to Main Menu");
|
||||
KKdMain.ConsoleDesign(false);
|
||||
KKdMain.ConsoleDesign(true);
|
||||
Console.WriteLine();
|
||||
string Function = Console.ReadLine();
|
||||
Console.Clear();
|
||||
if (Function == "1") Tools.A3D.Processor(JSON);
|
||||
else if (Function == "2") Tools.BLT.Processor();
|
||||
else if (Function == "3") Tools.CCT.Processor();
|
||||
else if (Function == "4") Tools.DEX.Processor(JSON);
|
||||
else if (Function == "5") Tools.DFT.Processor();
|
||||
else if (Function == "6") Tools.LIT.Processor();
|
||||
else if (Function == "7") Tools.STR.Processor(JSON);
|
||||
else if (Function == "8") Tools.VAG.Processor();
|
||||
else function = Function;
|
||||
}
|
||||
else if (function == "8")
|
||||
{
|
||||
KKdMain.Choose(1, JSON ? "mp" : "json", out string[] FileNames);
|
||||
if (JSON) foreach (string file in FileNames)
|
||||
KKdMainLib.MPExt.ToJSON (file.Replace(Path.GetExtension(file), ""));
|
||||
else foreach (string file in FileNames)
|
||||
KKdMainLib.MPExt.ToMsgPack(file.Replace(Path.GetExtension(file), ""));
|
||||
foreach (string file in FileNames)
|
||||
if (JSON)
|
||||
{
|
||||
Console.Title = "MsgPack to JSON: " + Path.GetFileNameWithoutExtension(file);
|
||||
MPExt.ToJSON (file.Replace(Path.GetExtension(file), ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Title = "JSON to MsgPack: " + Path.GetFileNameWithoutExtension(file);
|
||||
MPExt.ToMsgPack(file.Replace(Path.GetExtension(file), ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("7B5D5A3A-A6F8-4813-C97D-ACFC98F7397E")]
|
||||
[assembly: AssemblyVersion("0.4.7.1")]
|
||||
[assembly: AssemblyFileVersion("0.4.7.1")]
|
||||
[assembly: AssemblyVersion("0.4.7.2")]
|
||||
[assembly: AssemblyFileVersion("0.4.7.2")]
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using KKdMainLib;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2;
|
||||
|
||||
namespace PD_Tool.Tools
|
||||
{
|
||||
public class BLT
|
||||
{
|
||||
public static void Processor()
|
||||
{
|
||||
Console.Title = "Bloom Converter";
|
||||
Bloom Bloom;
|
||||
Main.Choose(1, "blt", out string[] FileNames);
|
||||
if (FileNames.Length < 1) return;
|
||||
string filepath = "";
|
||||
string ext = "";
|
||||
|
||||
foreach (string file in FileNames)
|
||||
{
|
||||
Bloom = new Bloom();
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "Bloom Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".blt") { Bloom.BLTReader(filepath); Bloom.TXTWriter(filepath); }
|
||||
//else if (ext == ".txt") { Bloom.TXTReader(filepath); Bloom.BLTWriter(filepath); }
|
||||
Bloom = new Bloom();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using KKdMainLib;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2;
|
||||
|
||||
namespace PD_Tool.Tools
|
||||
{
|
||||
public class CCT
|
||||
{
|
||||
public static void Processor()
|
||||
{
|
||||
Console.Title = "Color Correction Converter";
|
||||
ColorCorrection ColorCorrection;
|
||||
Main.Choose(1, "cct", out string[] FileNames);
|
||||
if (FileNames.Length < 1) return;
|
||||
string filepath = "";
|
||||
string ext = "";
|
||||
|
||||
foreach (string file in FileNames)
|
||||
{
|
||||
ColorCorrection = new ColorCorrection();
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "Color Correction Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".cct") { ColorCorrection.CCTReader(filepath); ColorCorrection.TXTWriter(filepath); }
|
||||
//else if (ext == ".txt") { ColorCorrection.TXTReader(filepath); ColorCorrection.BLTWriter(filepath); }
|
||||
ColorCorrection = new ColorCorrection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ namespace PD_Tool.Tools
|
||||
Main.ConsoleDesign(" Choose type of exporting file:");
|
||||
Main.ConsoleDesign(false);
|
||||
Main.ConsoleDesign("1. F/FT PS3/PS4/PSVita");
|
||||
Main.ConsoleDesign("2. F2nd PS3/PSVita");
|
||||
Main.ConsoleDesign("2. F2 PS3/PSVita");
|
||||
Main.ConsoleDesign("3. X PS4/PSVita");
|
||||
if ( MP && !JSON) Main.ConsoleDesign("9. MessagePack");
|
||||
if (_JSON && JSON) Main.ConsoleDesign("9. JSON");
|
||||
@@ -47,6 +47,7 @@ namespace PD_Tool.Tools
|
||||
else if (format == "9" && (MP && _JSON)) Format = Format.NULL;
|
||||
else return;
|
||||
|
||||
int state;
|
||||
foreach (string file in FileNames)
|
||||
{
|
||||
DEX = new KKdDEX();
|
||||
@@ -56,12 +57,15 @@ namespace PD_Tool.Tools
|
||||
|
||||
Console.Title = "DEX Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".bin" || ext == ".dex")
|
||||
DEX. DEXReader(filepath, ext );
|
||||
else DEX.MsgPackReader(filepath, JSON);
|
||||
state = DEX. DEXReader(filepath, ext );
|
||||
else state = DEX.MsgPackReader(filepath, JSON);
|
||||
|
||||
if (Format > Format.NULL)
|
||||
DEX. DEXWriter(filepath, Format);
|
||||
else DEX.MsgPackWriter(filepath, JSON );
|
||||
if (state == 1)
|
||||
{
|
||||
if (Format > Format.NULL)
|
||||
DEX. DEXWriter(filepath, Format);
|
||||
else DEX.MsgPackWriter(filepath, JSON);
|
||||
}
|
||||
DEX = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using KKdMainLib;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2;
|
||||
|
||||
namespace PD_Tool.Tools
|
||||
{
|
||||
public class DFT
|
||||
{
|
||||
public static void Processor()
|
||||
{
|
||||
Console.Title = "DOF Converter";
|
||||
DOF DOF;
|
||||
Main.Choose(1, "dft", out string[] FileNames);
|
||||
if (FileNames.Length < 1) return;
|
||||
string filepath = "";
|
||||
string ext = "";
|
||||
|
||||
foreach (string file in FileNames)
|
||||
{
|
||||
DOF = new DOF();
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "DOF Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".dft") { DOF.DFTReader(filepath); DOF.TXTWriter(filepath); }
|
||||
//else if (ext == ".txt") { DOF.TXTReader(filepath); DOF.DFTWriter(filepath); }
|
||||
DOF = new DOF();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using KKdMainLib;
|
||||
using KKdMainLib.IO;
|
||||
using KKdMainLib.F2;
|
||||
|
||||
namespace PD_Tool.Tools
|
||||
{
|
||||
public class LIT
|
||||
{
|
||||
public static void Processor()
|
||||
{
|
||||
Console.Title = "Light Converter";
|
||||
Light LIT;
|
||||
Main.Choose(1, "lit", out string[] FileNames);
|
||||
if (FileNames.Length < 1) return;
|
||||
string filepath = "";
|
||||
string ext = "";
|
||||
|
||||
foreach (string file in FileNames)
|
||||
{
|
||||
LIT = new Light();
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "Light Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".lit") { LIT.LITReader(filepath); LIT.TXTWriter(filepath); }
|
||||
//else if (ext == ".txt") { LIT.TXTReader(filepath); LIT.LITWriter(filepath); }
|
||||
LIT = new Light();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using KKdMainLib;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
namespace PD_Tool.Tools
|
||||
{
|
||||
public class MOT
|
||||
{
|
||||
public static void Processor(bool JSON)
|
||||
{
|
||||
Console.Title = "MOT Converter";
|
||||
Mot Mot;
|
||||
Main.Choose(1, "bin", out string[] FileNames);
|
||||
if (FileNames.Length < 1) return;
|
||||
string filepath = "";
|
||||
string ext = "";
|
||||
|
||||
foreach (string file in FileNames)
|
||||
{
|
||||
Mot = new Mot();
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "MOT Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".bin")
|
||||
{
|
||||
Mot. MOTReader(filepath);
|
||||
Mot.MsgPackWriter(filepath, JSON);
|
||||
}
|
||||
else if (ext == ".mp" || ext == ".json")
|
||||
{
|
||||
Mot.MsgPackReader(filepath, ext == ".json");
|
||||
Mot. MOTWriter(filepath);
|
||||
}
|
||||
Mot = new Mot();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user