Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
036863a5a6 | ||
|
|
b6017d1d70 | ||
|
|
5de5d23e94 | ||
|
|
df0cb255fc | ||
|
|
89c9afd0c5 |
+32
-7
@@ -11,16 +11,41 @@ namespace KKdBaseLib
|
||||
public EPType EPTypePost;
|
||||
public float FrameDelta;
|
||||
public float ValueDelta;
|
||||
public int Unk1C;
|
||||
public int Unk20;
|
||||
public int Unk24;
|
||||
public int Unk28;
|
||||
public int Unk2C;
|
||||
public int Unk30;
|
||||
public int Unk34;
|
||||
public int Padding;
|
||||
public long FirstKey;
|
||||
public long SecondKey;
|
||||
public long AfterLastKey;
|
||||
public long Length;
|
||||
public long DataOffset; //Used only in-game and points to KFT3 Array
|
||||
|
||||
public KFT3[] Keys;
|
||||
|
||||
public A3DAKey(Key k)
|
||||
{
|
||||
Type = 0; Value = MaxFrames = FrameDelta = ValueDelta = 0; EPTypePre = EPTypePost = 0;
|
||||
FirstKey = SecondKey = AfterLastKey = Padding = 0;
|
||||
Length = DataOffset = 0; Keys = null;
|
||||
|
||||
MaxFrames = k.Max ?? 0;
|
||||
if (k.Type > KeyType.Static && k.Length > 1)
|
||||
{
|
||||
Type = k.Type;
|
||||
Length = k.Length;
|
||||
Keys = k.Keys;
|
||||
EPTypePost = k.EPTypePost;
|
||||
EPTypePre = k.EPTypePre;
|
||||
FrameDelta = k.Keys[k.Length - 1].F - k.Keys[0].F;
|
||||
ValueDelta = k.Keys[k.Length - 1].V - k.Keys[0].V;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = k.Type;
|
||||
Value = k.Type > 0 ? k.Value : 0.0f;
|
||||
EPTypePost = 0;
|
||||
EPTypePre = 0;
|
||||
FrameDelta = 0;
|
||||
ValueDelta = Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+64
-91
@@ -36,17 +36,17 @@ namespace KKdBaseLib.Auth3D
|
||||
public struct Ambient
|
||||
{
|
||||
public string Name;
|
||||
public Vec4<Key> LightDiffuse;
|
||||
public Vec4<Key> RimLightDiffuse;
|
||||
public Vec4<Key>? LightDiffuse;
|
||||
public Vec4<Key>? RimLightDiffuse;
|
||||
}
|
||||
|
||||
public struct CameraAuxiliary
|
||||
{
|
||||
public Key Gamma;
|
||||
public Key Exposure;
|
||||
public Key Saturate;
|
||||
public Key GammaRate;
|
||||
public Key AutoExposure;
|
||||
public Key? Gamma;
|
||||
public Key? Exposure;
|
||||
public Key? Saturate;
|
||||
public Key? GammaRate;
|
||||
public Key? AutoExposure;
|
||||
}
|
||||
|
||||
public struct CameraRoot
|
||||
@@ -99,44 +99,69 @@ namespace KKdBaseLib.Auth3D
|
||||
public Key End;
|
||||
public Key Start;
|
||||
public Key Density;
|
||||
public Vec4<Key> Diffuse;
|
||||
public Vec4<Key>? Diffuse;
|
||||
}
|
||||
|
||||
public enum CompressF16 : int
|
||||
{
|
||||
F32F32F32F32 = 0,
|
||||
I16F16F32F32 = 1,
|
||||
I16F16F16F16 = 2,
|
||||
Type0 = 0,
|
||||
Type1 = 1,
|
||||
Type2 = 2,
|
||||
}
|
||||
|
||||
public enum EPType : int
|
||||
public enum EPType : int // Pre/Post Infinity
|
||||
{
|
||||
EP_1 = 1,
|
||||
EP_2 = 2,
|
||||
EP_3 = 3,
|
||||
Linear = 1,
|
||||
Cycle = 2,
|
||||
CycleOffset = 3,
|
||||
}
|
||||
|
||||
public enum KeyType : int
|
||||
{
|
||||
Null = 0,
|
||||
Value = 1,
|
||||
Lerp = 2,
|
||||
None = 0,
|
||||
Static = 1,
|
||||
Linear = 2,
|
||||
Hermite = 3,
|
||||
Hold = 4,
|
||||
}
|
||||
|
||||
public struct Key
|
||||
{
|
||||
public KeyType? Type;
|
||||
public KeyType Type;
|
||||
public int Length;
|
||||
public int? BinOffset;
|
||||
public EPType EPTypePre;
|
||||
public EPType EPTypePost;
|
||||
public float? Max;
|
||||
public float? Value;
|
||||
public float Value;
|
||||
public RawD RawData;
|
||||
public KFT3[] Keys;
|
||||
|
||||
public Key(A3DAKey k)
|
||||
{
|
||||
Type = 0;
|
||||
Value = 0;
|
||||
Length = 0;
|
||||
BinOffset = null;
|
||||
RawData = default;
|
||||
Keys = null;
|
||||
|
||||
EPTypePost = k.EPTypePost;
|
||||
EPTypePre = k.EPTypePre;
|
||||
Max = k.MaxFrames;
|
||||
if (k.Length > 1)
|
||||
{
|
||||
Type = k.Type;
|
||||
Length = (int)k.Length;
|
||||
Keys = k.Keys;
|
||||
}
|
||||
else if (k.Length == 1)
|
||||
{
|
||||
Type = KeyType.Static;
|
||||
Value = k.Keys[0].V;
|
||||
}
|
||||
}
|
||||
|
||||
public struct RawD
|
||||
{
|
||||
public int KeyType;
|
||||
@@ -144,58 +169,6 @@ namespace KKdBaseLib.Auth3D
|
||||
public string ValueType;
|
||||
public string[] ValueList;
|
||||
}
|
||||
|
||||
public static Vec3<A3DAKey> ToA3DAKey(Vec3< Key> k) =>
|
||||
new Vec3<A3DAKey> { X = (A3DAKey)k.X, Y = (A3DAKey)k.Y, Z = (A3DAKey)k.Z };
|
||||
public static Vec3< Key> ToKey (Vec3<A3DAKey> k) =>
|
||||
new Vec3< Key> { X = ( Key)k.X, Y = ( Key)k.Y, Z = ( Key)k.Z };
|
||||
|
||||
public static explicit operator Key(A3DAKey k)
|
||||
{
|
||||
Key key = default;
|
||||
key.EPTypePost = k.EPTypePost;
|
||||
key.EPTypePre = k.EPTypePre;
|
||||
key.Max = k.MaxFrames;
|
||||
if (k.Length > 1)
|
||||
{
|
||||
key.Type = k.Type;
|
||||
key.Length = (int)k.Length;
|
||||
key.Keys = k.Keys;
|
||||
}
|
||||
else if (k.Length == 1)
|
||||
{
|
||||
key.Type = KeyType.Value;
|
||||
key.Value = k.Keys[0].V;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
public static explicit operator A3DAKey(Key k)
|
||||
{
|
||||
A3DAKey key = default;
|
||||
key.EPTypePost = k.EPTypePost;
|
||||
key.EPTypePre = k.EPTypePre;
|
||||
key.MaxFrames = k.Max ?? 0;
|
||||
if (k.Type != null && k.Length > 1)
|
||||
{
|
||||
key.Type = k.Type.Value;
|
||||
key.Length = k.Length;
|
||||
key.Keys = k.Keys;
|
||||
key.FrameDelta = k.Keys[k.Length - 1].F - k.Keys[0].F;
|
||||
key.ValueDelta = k.Keys[k.Length - 1].V - k.Keys[0].V;
|
||||
}
|
||||
else
|
||||
{
|
||||
key.Type = 0;
|
||||
key.Value = 0.0f;
|
||||
if (k.Type.HasValue && k.Value.HasValue)
|
||||
{
|
||||
key.Type = k.Type.Value;
|
||||
key.Value = k.Value.Value;
|
||||
}
|
||||
}
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
public struct Light
|
||||
@@ -203,10 +176,10 @@ namespace KKdBaseLib.Auth3D
|
||||
public int? Id;
|
||||
public string Name;
|
||||
public string Type;
|
||||
public Vec4<Key> Ambient;
|
||||
public Vec4<Key> Diffuse;
|
||||
public Vec4<Key> Specular;
|
||||
public Vec4<Key> Incandescence;
|
||||
public Vec4<Key>? Ambient;
|
||||
public Vec4<Key>? Diffuse;
|
||||
public Vec4<Key>? Specular;
|
||||
public Vec4<Key>? Incandescence;
|
||||
public ModelTransform Position;
|
||||
public ModelTransform SpotDirection;
|
||||
}
|
||||
@@ -216,8 +189,8 @@ namespace KKdBaseLib.Auth3D
|
||||
public string Name;
|
||||
public string HashName;
|
||||
public Key GlowIntensity;
|
||||
public Vec4<Key> BlendColor;
|
||||
public Vec4<Key> Incandescence;
|
||||
public Vec4<Key>? BlendColor;
|
||||
public Vec4<Key>? Incandescence;
|
||||
}
|
||||
|
||||
public struct MObjectHRC
|
||||
@@ -275,18 +248,18 @@ namespace KKdBaseLib.Auth3D
|
||||
public struct TextureTransform
|
||||
{
|
||||
public string Name;
|
||||
public Key Rotate;
|
||||
public Key RotateFrame;
|
||||
public Vec2<Key> Offset;
|
||||
public Vec2<Key> Repeat;
|
||||
public Vec2<Key> Coverage;
|
||||
public Vec2<Key> TranslateFrame;
|
||||
public Key? Rotate;
|
||||
public Key? RotateFrame;
|
||||
public Vec2<Key?> Offset;
|
||||
public Vec2<Key?> Repeat;
|
||||
public Vec2<Key?> Coverage;
|
||||
public Vec2<Key?> TranslateFrame;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ObjectHRC
|
||||
{
|
||||
public int? Shadow;
|
||||
public bool? Shadow;
|
||||
public string Name;
|
||||
public string UIDName;
|
||||
public Node[] Node;
|
||||
@@ -304,11 +277,11 @@ namespace KKdBaseLib.Auth3D
|
||||
|
||||
public struct PostProcess
|
||||
{
|
||||
public Key LensFlare;
|
||||
public Key LensGhost;
|
||||
public Key LensShaft;
|
||||
public Vec4<Key> Ambient;
|
||||
public Vec4<Key> Diffuse;
|
||||
public Vec4<Key> Specular;
|
||||
public Key? LensFlare;
|
||||
public Key? LensGhost;
|
||||
public Key? LensShaft;
|
||||
public Vec4<Key>? Ambient;
|
||||
public Vec4<Key>? Diffuse;
|
||||
public Vec4<Key>? Specular;
|
||||
}
|
||||
}
|
||||
|
||||
+31
-28
@@ -159,32 +159,32 @@ namespace KKdBaseLib
|
||||
public static Quat TQ (this byte[] arr, int offset = 0)
|
||||
{ Quat val; fixed (byte* ptr = arr) val = *( Quat*)(ptr + offset); return val; }
|
||||
|
||||
public static void GBy(this byte[] arr, short val)
|
||||
{ fixed (byte* ptr = arr) *( short*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, ushort val)
|
||||
{ fixed (byte* ptr = arr) *(ushort*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, int val)
|
||||
{ fixed (byte* ptr = arr) *( int*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, uint val)
|
||||
{ fixed (byte* ptr = arr) *( uint*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, long val)
|
||||
{ fixed (byte* ptr = arr) *( long*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, ulong val)
|
||||
{ fixed (byte* ptr = arr) *( ulong*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, Half val)
|
||||
{ fixed (byte* ptr = arr) *( Half*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, float val)
|
||||
{ fixed (byte* ptr = arr) *( float*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, double val)
|
||||
{ fixed (byte* ptr = arr) *(double*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, Vec2 val)
|
||||
{ fixed (byte* ptr = arr) *( Vec2*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, Vec3 val)
|
||||
{ fixed (byte* ptr = arr) *( Vec3*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, Vec4 val)
|
||||
{ fixed (byte* ptr = arr) *( Vec4*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, Quat val)
|
||||
{ fixed (byte* ptr = arr) *( Quat*)ptr = val; }
|
||||
public static void GBy(this byte[] arr, short val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( short*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, ushort val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *(ushort*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, int val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( int*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, uint val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( uint*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, long val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( long*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, ulong val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( ulong*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, Half val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( Half*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, float val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( float*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, double val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *(double*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, Vec2 val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( Vec2*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, Vec3 val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( Vec3*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, Vec4 val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( Vec4*)(ptr + offset) = val; }
|
||||
public static void GBy(this byte[] arr, Quat val, int offset = 0)
|
||||
{ fixed (byte* ptr = arr) *( Quat*)(ptr + offset) = val; }
|
||||
|
||||
public static sbyte CITSB(this int c)
|
||||
{ return ( sbyte)(c > 0x0000007F ?
|
||||
@@ -239,7 +239,10 @@ namespace KKdBaseLib
|
||||
public static double ToF64(this long i) => *(double*)&i;
|
||||
public static double ToF64(this ulong i) => *(double*)&i;
|
||||
|
||||
public static string ToString(this int d, bool BE) =>
|
||||
public static string ToS(this int d, bool BE) =>
|
||||
BitConverter.GetBytes(d.E(BE)).ToASCII();
|
||||
|
||||
public static string ToS(this uint d, bool BE) =>
|
||||
BitConverter.GetBytes(d.E(BE)).ToASCII();
|
||||
|
||||
public static string ToS(this object d)
|
||||
@@ -273,7 +276,7 @@ namespace KKdBaseLib
|
||||
public static string ToS(this ulong? d) => (d ?? default).ToString();
|
||||
public static string ToS(this ulong d) => d.ToString();
|
||||
public static string ToS(this float? d, int round) => (d ?? default).ToS(round);
|
||||
public static string ToS(this float? d) => (d ?? default).ToS();
|
||||
public static string ToS(this float? d) => (d ?? default).ToS(15);
|
||||
public static string ToS(this float d, int round)
|
||||
{ string s = (d.ToU32() & 0x80000000) != 0 ? "-" : ""; d = (d.ToU32() & 0x7FFFFFFF).ToF32();
|
||||
return s + Math.Round(d, round).ToString().ToLower().Replace(NDS, "."); }
|
||||
|
||||
+83
-77
@@ -24,12 +24,10 @@ namespace KKdBaseLib.F2
|
||||
for (i = 0; i < ENRSCount; i++)
|
||||
{
|
||||
enrsEntry = default;
|
||||
enrsEntry.Offset = ReadENRSValue(ref localPtr);
|
||||
enrsEntry.Count = ReadENRSValue(ref localPtr);
|
||||
enrsEntry.Size = ReadENRSValue(ref localPtr);
|
||||
enrsEntry.Repeat = ReadENRSValue(ref localPtr);
|
||||
|
||||
if (i > 0) enrsEntry.Offset += Array[i - 1].Offset;
|
||||
if (ReadENRSValue(ref localPtr, out enrsEntry.Offset)) return;
|
||||
if (ReadENRSValue(ref localPtr, out enrsEntry.Count )) return;
|
||||
if (ReadENRSValue(ref localPtr, out enrsEntry.Size )) return;
|
||||
if (ReadENRSValue(ref localPtr, out enrsEntry.Repeat)) return;
|
||||
|
||||
if (enrsEntry.Repeat < 1) { enrsEntry.Sub = null; Array[i] = enrsEntry; continue; }
|
||||
|
||||
@@ -37,9 +35,8 @@ namespace KKdBaseLib.F2
|
||||
for (i0 = 0; i0 < enrsEntry.Count; i0++)
|
||||
{
|
||||
sub = default;
|
||||
sub.Skip = ReadENRSValue(ref localPtr, out sub.Type);
|
||||
sub.Reverse = ReadENRSValue(ref localPtr);
|
||||
if (i0 > 0) sub.Skip += enrsEntry.Sub[i0 - 1].SizeSkip;
|
||||
if (ReadENRSValue(ref localPtr, out sub.Skip, out sub.Type)) return;
|
||||
if (ReadENRSValue(ref localPtr, out sub.Reverse )) return;
|
||||
enrsEntry.Sub[i0] = sub;
|
||||
|
||||
if (enrsEntry.Sub[i0].Type == ENRSEntry.Type.Invalid) { Array = null; return; }
|
||||
@@ -65,27 +62,24 @@ namespace KKdBaseLib.F2
|
||||
for (i = 0; i < Array.Length; i++)
|
||||
{
|
||||
ENRSEntry enrsEntry = Array[i];
|
||||
WriteENRSValue(ref localPtr, i > 0 ? enrsEntry.Offset -
|
||||
Array[i - 1].Offset : enrsEntry.Offset);
|
||||
WriteENRSValue(ref localPtr, enrsEntry.Count > enrsEntry.Sub.Length ?
|
||||
enrsEntry.Sub.Length : enrsEntry.Count);
|
||||
WriteENRSValue(ref localPtr, enrsEntry.Size );
|
||||
WriteENRSValue(ref localPtr, enrsEntry.Repeat);
|
||||
if (WriteENRSValue(ref localPtr, enrsEntry.Offset)) goto End;
|
||||
if (WriteENRSValue(ref localPtr, enrsEntry.Count )) goto End;
|
||||
if (WriteENRSValue(ref localPtr, enrsEntry.Size )) goto End;
|
||||
if (WriteENRSValue(ref localPtr, enrsEntry.Repeat)) goto End;
|
||||
|
||||
if (enrsEntry.Repeat < 1) continue;
|
||||
|
||||
for (i0 = 0; i0 < enrsEntry.Count && i0 < enrsEntry.Sub.Length; i0++)
|
||||
{
|
||||
if (enrsEntry.Sub[i0].Type < ENRSEntry.Type. WORD ||
|
||||
enrsEntry.Sub[i0].Type > ENRSEntry.Type.QWORD)
|
||||
if (enrsEntry.Sub[i0].Type > ENRSEntry.Type.QWORD)
|
||||
return data;
|
||||
|
||||
WriteENRSValue(ref localPtr, i0 > 0 ? enrsEntry.Sub[i0].Skip -
|
||||
enrsEntry.Sub[i0 - 1].SizeSkip : enrsEntry.Sub[i0].Skip, enrsEntry.Sub[i0].Type);
|
||||
WriteENRSValue(ref localPtr, enrsEntry.Sub[i0].Reverse);
|
||||
if (WriteENRSValue(ref localPtr, enrsEntry.Sub[i0].Skip, enrsEntry.Sub[i0].Type)) goto End;
|
||||
if (WriteENRSValue(ref localPtr, enrsEntry.Sub[i0].Reverse )) goto End;
|
||||
}
|
||||
}
|
||||
}
|
||||
End:
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -96,10 +90,10 @@ namespace KKdBaseLib.F2
|
||||
for (i = 0; i < Array.Length; i++)
|
||||
{
|
||||
ENRSEntry enrs = Array[i];
|
||||
length += GetSize(i > 0 ? enrs.Offset - Array[i - 1].Offset : enrs.Offset);
|
||||
length += GetSize(enrs.Count );
|
||||
length += GetSize(enrs.Size );
|
||||
length += GetSize(enrs.Repeat);
|
||||
if (GetSize(enrs.Offset, ref length)) goto End;
|
||||
if (GetSize(enrs.Count , ref length)) goto End;
|
||||
if (GetSize(enrs.Size , ref length)) goto End;
|
||||
if (GetSize(enrs.Repeat, ref length)) goto End;
|
||||
|
||||
if (enrs.Repeat < 1) continue;
|
||||
|
||||
@@ -108,15 +102,24 @@ namespace KKdBaseLib.F2
|
||||
if (enrs.Sub[i0].Type < ENRSEntry.Type. WORD ||
|
||||
enrs.Sub[i0].Type > ENRSEntry.Type.QWORD) return length.A(0x10);
|
||||
|
||||
length += GetSizeType(i0 > 0 ? enrs.Sub[i0].Skip -
|
||||
enrs.Sub[i0 - 1].SizeSkip : enrs.Sub[i0].Skip);
|
||||
length += GetSize(enrs.Sub[i0].Reverse);
|
||||
if (GetSizeType(enrs.Sub[i0].Skip , ref length)) goto End;
|
||||
if (GetSize (enrs.Sub[i0].Reverse, ref length)) goto End;
|
||||
}
|
||||
}
|
||||
End:
|
||||
return length.A(0x10);
|
||||
|
||||
static int GetSizeType(int val) => val < 0x00000010 ? 1 : val < 0x00001000 ? 2 : 4;
|
||||
static int GetSize (int val) => val < 0x00000040 ? 1 : val < 0x00004000 ? 2 : 4;
|
||||
static bool GetSizeType(int val, ref int length)
|
||||
{
|
||||
length += val < 0x00000010 ? 1 : val < 0x00001000 ? 2 : val < 0x10000000 ? 4 : 1;
|
||||
return val >= 0x10000000;
|
||||
}
|
||||
|
||||
static bool GetSize (int val, ref int length)
|
||||
{
|
||||
length += val < 0x00000040 ? 1 : val < 0x00004000 ? 2 : val < 0x40000000 ? 4 : 1;
|
||||
return val >= 0x40000000;
|
||||
}
|
||||
}
|
||||
|
||||
/*private static KKdList<ENRS.SubENRS> Optimize(KKdList<ENRS.SubENRS> Sub)
|
||||
@@ -138,73 +141,76 @@ namespace KKdBaseLib.F2
|
||||
|
||||
[System.ThreadStatic] private static ENRSEntry.Value value;
|
||||
|
||||
private unsafe static int ReadENRSValue(ref byte* ptr, out ENRSEntry.Type type)
|
||||
private unsafe static bool ReadENRSValue(ref byte* ptr, out int v, out ENRSEntry.Type type)
|
||||
{
|
||||
int V = *ptr & 0xF;
|
||||
v = *ptr & 0xF;
|
||||
type = (ENRSEntry. Type)((*ptr & 0x30) >> 4);
|
||||
value = (ENRSEntry.Value)((*ptr & 0xC0) >> 6);
|
||||
ptr++;
|
||||
if (value == ENRSEntry.Value.Int32 )
|
||||
{ V = (V << 24) | (ptr[0] << 16) | (ptr[1] << 8) | ptr[2]; ptr += 3; }
|
||||
else if (value == ENRSEntry.Value.Int16 )
|
||||
{ V = (V << 8) | ptr[0]; ptr += 1; }
|
||||
else if (value == ENRSEntry.Value.Invalid) V = 0;
|
||||
return V;
|
||||
if (value == ENRSEntry.Value.Int32 ) v = (((((v << 8) | *ptr++) << 8) | *ptr++) << 8) | *ptr++;
|
||||
else if (value == ENRSEntry.Value.Int16 ) v = (v << 8) | *ptr++;
|
||||
else if (value == ENRSEntry.Value.Invalid) { v = 0; return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
private unsafe static int ReadENRSValue(ref byte* ptr)
|
||||
private unsafe static bool ReadENRSValue(ref byte* ptr, out int v)
|
||||
{
|
||||
int V = *ptr & 0x3F;
|
||||
v = *ptr & 0x3F;
|
||||
value = (ENRSEntry.Value)((*ptr & 0xC0) >> 6);
|
||||
ptr++;
|
||||
if (value == ENRSEntry.Value.Int32 )
|
||||
{ V = (V << 24) | (ptr[0] << 16) | (ptr[1] << 8) | ptr[2]; ptr += 3; }
|
||||
else if (value == ENRSEntry.Value.Int16 )
|
||||
{ V = (V << 8) | ptr[0]; ptr += 1; }
|
||||
else if (value == ENRSEntry.Value.Invalid) V = 0;
|
||||
return V;
|
||||
if (value == ENRSEntry.Value.Int32 ) v = (((((v << 8) | *ptr++) << 8) | *ptr++) << 8) | *ptr++;
|
||||
else if (value == ENRSEntry.Value.Int16 ) v = (v << 8) | *ptr++;
|
||||
else if (value == ENRSEntry.Value.Invalid) { v = 0; return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
private unsafe static void WriteENRSValue(ref byte* ptr, int val, ENRSEntry.Type type)
|
||||
private unsafe static bool WriteENRSValue(ref byte* ptr, int val, ENRSEntry.Type type)
|
||||
{
|
||||
value = ENRSEntry.Value.Invalid;
|
||||
if (val < 0x00000040) value = ENRSEntry.Value.Int8 ;
|
||||
else if (val < 0x00004000) value = ENRSEntry.Value.Int16;
|
||||
else if (val < 0x40000000) value = ENRSEntry.Value.Int32;
|
||||
*ptr = (byte)((((byte)value << 6) & 0xC0) | (((byte)type << 4) & 0x30));
|
||||
|
||||
if (val < 0x00000010)
|
||||
{ *ptr |= (byte)( val & 0x0F); }
|
||||
byte t = (byte)(((byte)type & 0x3) << 4);
|
||||
if (val < 0x00000010)
|
||||
*ptr++ = (byte)(((byte)ENRSEntry.Value.Int8 << 6) | t | ( val & 0xF));
|
||||
else if (val < 0x00001000)
|
||||
{ *ptr |= (byte)((val >> 8) & 0x0F); ptr++;
|
||||
*ptr = (byte)( val & 0xFF); }
|
||||
{
|
||||
*ptr++ = (byte)(((byte)ENRSEntry.Value.Int16 << 6) | t | ((val >> 8) & 0xF));
|
||||
*ptr++ = (byte)(val & 0xFF);
|
||||
}
|
||||
else if (val < 0x10000000)
|
||||
{ *ptr |= (byte)((val >> 24) & 0x0F); ptr++;
|
||||
*ptr = (byte)((val >> 16) & 0xFF); ptr++;
|
||||
*ptr = (byte)((val >> 8) & 0xFF); ptr++;
|
||||
*ptr = (byte)( val & 0xFF); }
|
||||
ptr++;
|
||||
{
|
||||
*ptr++ = (byte)(((byte)ENRSEntry.Value.Int32 << 6) | t | ((val >> 24) & 0xF));
|
||||
*ptr++ = (byte)((val >> 16) & 0xFF);
|
||||
*ptr++ = (byte)((val >> 8) & 0xFF);
|
||||
*ptr++ = (byte)( val & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr++ = (byte)ENRSEntry.Value.Invalid << 6;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private unsafe static void WriteENRSValue(ref byte* ptr, int val)
|
||||
private unsafe static bool WriteENRSValue(ref byte* ptr, int val)
|
||||
{
|
||||
value = ENRSEntry.Value.Invalid;
|
||||
if (val < 0x00000040) value = ENRSEntry.Value.Int8 ;
|
||||
else if (val < 0x00004000) value = ENRSEntry.Value.Int16;
|
||||
else if (val < 0x40000000) value = ENRSEntry.Value.Int32;
|
||||
*ptr = (byte)(((byte)value << 6) & 0xC0);
|
||||
|
||||
if (val < 0x00000040)
|
||||
{ *ptr |= (byte)( val & 0x3F); }
|
||||
if (val < 0x00000040)
|
||||
*ptr++ = (byte)(((byte)ENRSEntry.Value.Int8 << 6) | ( val & 0x3F));
|
||||
else if (val < 0x00004000)
|
||||
{ *ptr |= (byte)((val >> 8) & 0x3F); ptr++;
|
||||
*ptr = (byte)( val & 0xFF); }
|
||||
{
|
||||
*ptr++ = (byte)(((byte)ENRSEntry.Value.Int16 << 6) | ((val >> 8) & 0x3F));
|
||||
*ptr++ = (byte)(val & 0xFF);
|
||||
}
|
||||
else if (val < 0x40000000)
|
||||
{ *ptr |= (byte)((val >> 24) & 0x3F); ptr++;
|
||||
*ptr = (byte)((val >> 16) & 0xFF); ptr++;
|
||||
*ptr = (byte)((val >> 8) & 0xFF); ptr++;
|
||||
*ptr = (byte)( val & 0xFF); }
|
||||
ptr++;
|
||||
{
|
||||
*ptr++ = (byte)(((byte)ENRSEntry.Value.Int32 << 6) | ((val >> 24) & 0x3F));
|
||||
*ptr++ = (byte)((val >> 16) & 0xFF);
|
||||
*ptr++ = (byte)((val >> 8) & 0xFF);
|
||||
*ptr++ = (byte)( val & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr++ = (byte)ENRSEntry.Value.Invalid << 6;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public struct ENRSEntry
|
||||
|
||||
+10
-10
@@ -2,15 +2,15 @@ namespace KKdBaseLib.F2
|
||||
{
|
||||
public struct Header
|
||||
{
|
||||
public int Signature;
|
||||
public int DataSize;
|
||||
public int Length;
|
||||
public int Flags;
|
||||
public int Depth;
|
||||
public int SectionSize;
|
||||
public int Mode;
|
||||
public int InnerSignature;
|
||||
public int SectionSignature;
|
||||
public uint Signature; // 0x00
|
||||
public uint DataSize; // 0x04
|
||||
public uint Length; // 0x08
|
||||
public uint Flags; // 0x0C
|
||||
public uint Depth; // 0x10
|
||||
public uint SectionSize; // 0x14
|
||||
public uint Version; // 0x18
|
||||
public uint InnerSignature; // 0x30
|
||||
public uint SectionSignature; // 0x40
|
||||
|
||||
public Format Format;
|
||||
public bool UseBigEndian;
|
||||
@@ -18,6 +18,6 @@ namespace KKdBaseLib.F2
|
||||
|
||||
public bool IsX => Format == Format.X || Format == Format.XHD;
|
||||
|
||||
public override string ToString() => Signature.ToString(false);
|
||||
public override string ToString() => Signature.ToS(false);
|
||||
}
|
||||
}
|
||||
|
||||
+66
-35
@@ -12,7 +12,6 @@ namespace KKdBaseLib.F2
|
||||
|
||||
public unsafe void Read(byte[] data, bool shiftX)
|
||||
{
|
||||
Value Val = 0;
|
||||
Offsets = KKdList<long>.New;
|
||||
fixed (byte* ptr = data)
|
||||
{
|
||||
@@ -25,14 +24,7 @@ namespace KKdBaseLib.F2
|
||||
Offsets.Capacity = length;
|
||||
while (length > i)
|
||||
{
|
||||
v = *l & 0x3F;
|
||||
Val = (Value)(*l & 0xC0);
|
||||
if (Val == Value.Int32)
|
||||
{ v = (v << 24) | (l[1] << 16) | (l[2] << 8) | l[3]; l += 4; i += 4; }
|
||||
else if (Val == Value.Int16)
|
||||
{ v = (v << 8) | l[1]; l += 2; i += 2; }
|
||||
else if (Val == Value.Int8 ) { l ++ ; i ++ ; }
|
||||
else break;
|
||||
if (ReadPOFValue(ref l, out v)) break;
|
||||
j++;
|
||||
offset += v;
|
||||
Offsets.Add(offset << bitShift);
|
||||
@@ -44,44 +36,82 @@ namespace KKdBaseLib.F2
|
||||
public unsafe byte[] Write(bool shiftX)
|
||||
{
|
||||
Offsets.Sort();
|
||||
long offset = 0;
|
||||
byte bitShift = (byte)(shiftX ? 3 : 2);
|
||||
int max1 = 0x00100 >> bitShift;
|
||||
int max2 = 0x10000 >> bitShift;
|
||||
long j, k, o;
|
||||
byte bitShift, v;
|
||||
bitShift = (byte)(shiftX ? 3 : 2);
|
||||
v = (byte)((1 << bitShift) - 1);
|
||||
|
||||
j = 0;
|
||||
byte[] data = new byte[length(shiftX)];
|
||||
fixed (byte* ptr = data)
|
||||
{
|
||||
byte Val = 0;
|
||||
*(int*)ptr = length(shiftX);
|
||||
byte* localPtr = ptr + 4;
|
||||
byte* l = ptr + 4;
|
||||
for (int i = 0; i < Offsets.Count; i++)
|
||||
{
|
||||
offset = Offsets[i];
|
||||
if (i > 0) { offset -= Offsets[i - 1]; if (offset == 0) continue; }
|
||||
o = Offsets[i];
|
||||
if ((o & v) != 0)
|
||||
{
|
||||
WritePOFValue(ref l, 0x7FFFFFFF);
|
||||
break;
|
||||
}
|
||||
|
||||
offset >>= bitShift;
|
||||
Val = (byte)(offset > max2 ? Value.Int32 : offset > max1 ? Value.Int16 : Value.Int8);
|
||||
if (offset < max1) *localPtr = (byte)(Val | offset );
|
||||
else if (offset < max2) { *localPtr = (byte)(Val | (offset >> 8)); localPtr++;
|
||||
*localPtr = (byte) offset ; }
|
||||
else { *localPtr = (byte)(Val | (offset >> 24)); localPtr++;
|
||||
*localPtr = (byte) (offset >> 16) ; localPtr++;
|
||||
*localPtr = (byte) (offset >> 8) ; localPtr++;
|
||||
*localPtr = (byte) offset ; }
|
||||
localPtr++;
|
||||
k = o - j;
|
||||
if (i > 0 & k == 0)
|
||||
continue;
|
||||
j = o;
|
||||
o = k;
|
||||
WritePOFValue(ref l, o >> bitShift);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
[System.ThreadStatic] private static Value value;
|
||||
|
||||
private unsafe static bool ReadPOFValue(ref byte* ptr, out int v)
|
||||
{
|
||||
v = *ptr & 0x3F;
|
||||
value = (Value)((*ptr & 0xC0) >> 6);
|
||||
ptr++;
|
||||
if (value == Value.Int32 ) v = (((((v << 8) | *ptr++) << 8) | *ptr++) << 8) | *ptr++;
|
||||
else if (value == Value.Int16 ) v = (v << 8) | *ptr++;
|
||||
else if (value == Value.Invalid) { v = 0; return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
private unsafe static bool WritePOFValue(ref byte* ptr, long val)
|
||||
{
|
||||
if (val < 0x00000040)
|
||||
*ptr++ = (byte)(((byte)Value.Int8 << 6) | ( val & 0x3F));
|
||||
else if (val < 0x00004000)
|
||||
{
|
||||
*ptr++ = (byte)(((byte)Value.Int16 << 6) | ((val >> 8) & 0x3F));
|
||||
*ptr++ = (byte)(val & 0xFF);
|
||||
}
|
||||
else if (val < 0x40000000)
|
||||
{
|
||||
*ptr++ = (byte)(((byte)Value.Int32 << 6) | ((val >> 24) & 0x3F));
|
||||
*ptr++ = (byte)((val >> 16) & 0xFF);
|
||||
*ptr++ = (byte)((val >> 8) & 0xFF);
|
||||
*ptr++ = (byte)( val & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr++ = (byte)Value.Invalid << 6;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int length(bool shiftX = false)
|
||||
{
|
||||
int length = 6;
|
||||
int length = 4;
|
||||
long offset = 0;
|
||||
byte bitShift = (byte)(shiftX ? 3 : 2);
|
||||
int max1 = 0x00100 >> bitShift;
|
||||
int max2 = 0x10000 >> bitShift;
|
||||
int max1 = 0x00000040;
|
||||
int max2 = 0x00004000;
|
||||
int max3 = 0x40000000;
|
||||
for (int i = 0; i < Offsets.Count; i++)
|
||||
{
|
||||
offset = Offsets[i];
|
||||
@@ -90,17 +120,18 @@ namespace KKdBaseLib.F2
|
||||
offset >>= bitShift;
|
||||
if (offset < max1) length += 1;
|
||||
else if (offset < max2) length += 2;
|
||||
else length += 4;
|
||||
else if (offset < max3) length += 4;
|
||||
else length += 1;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
public enum Value : byte
|
||||
{
|
||||
Invalid = 0b00000000,
|
||||
Int8 = 0b01000000,
|
||||
Int16 = 0b10000000,
|
||||
Int32 = 0b11000000,
|
||||
Invalid = 0b00,
|
||||
Int8 = 0b01,
|
||||
Int16 = 0b10,
|
||||
Int32 = 0b11,
|
||||
}
|
||||
|
||||
public override string ToString() =>
|
||||
|
||||
+18
-19
@@ -9,10 +9,10 @@ namespace KKdBaseLib.F2
|
||||
public ENRS ENRS;
|
||||
public POF POF;
|
||||
|
||||
public int Length => length(false);
|
||||
public int LengthX => length( true);
|
||||
public uint Length => length(false);
|
||||
public uint LengthX => length( true);
|
||||
|
||||
public int Depth => Header.Depth;
|
||||
public uint Depth => Header.Depth;
|
||||
|
||||
public bool HasPOF => POF .NotNull;
|
||||
public bool HasENRS => ENRS.NotNull;
|
||||
@@ -20,29 +20,28 @@ namespace KKdBaseLib.F2
|
||||
|
||||
public long DataOffset;
|
||||
|
||||
public override string ToString() => $"{Header.ToString()}" +
|
||||
$"{(HasSubStructs ? $"; SubStructs: {SubStructs.Length}" : "")}" +
|
||||
$"{(HasENRS ? "; Has ENRS" : "")}{(HasPOF ? "; Has POF" : "")}";
|
||||
|
||||
private int length(bool shiftX = false)
|
||||
public void Update(bool ShiftX = false)
|
||||
{
|
||||
int length = Data != null ? Data.Length : 0;
|
||||
if (HasPOF ) length += 0x20 + (shiftX ? POF.LengthX : POF.Length);
|
||||
if (HasENRS) length += 0x20 + ENRS.Length;
|
||||
Header.SectionSize = Data != null ? (uint)Data.Length : 0;
|
||||
Header.DataSize = length(ShiftX);
|
||||
}
|
||||
|
||||
private uint length(bool shiftX = false)
|
||||
{
|
||||
uint length = Data != null ? (uint)Data.Length : 0;
|
||||
if (HasPOF ) length += 0x20 + (uint)(shiftX ? POF.LengthX : POF.Length);
|
||||
if (HasENRS) length += 0x20 + (uint)ENRS.Length;
|
||||
if (HasSubStructs)
|
||||
{
|
||||
for (int i = 0; i < SubStructs.Length; i++)
|
||||
length += (shiftX ? SubStructs[i].LengthX : SubStructs[i].Length) + SubStructs[i].Header.Length;
|
||||
length += (uint)(shiftX ? SubStructs[i].LengthX : SubStructs[i].Length)
|
||||
+ SubStructs[i].Header.Length;
|
||||
if (HasPOF || HasENRS || HasSubStructs)
|
||||
length += 0x20;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
public void Update(bool ShiftX = false)
|
||||
{
|
||||
Header.SectionSize = Data != null ? Data.Length : 0;
|
||||
Header.DataSize = length(ShiftX);
|
||||
}
|
||||
public override string ToString() => $"{Header}" +
|
||||
$"{(HasSubStructs ? $"; SubStructs: {SubStructs.Length}" : "")}" +
|
||||
$"{(HasENRS ? "; Has ENRS" : "")}{(HasPOF ? "; Has POF" : "")}";
|
||||
}
|
||||
}
|
||||
|
||||
+49
-32
@@ -4,67 +4,84 @@ namespace KKdBaseLib
|
||||
{
|
||||
public struct Half : IFormattable
|
||||
{
|
||||
private ushort _value;
|
||||
private ushort value;
|
||||
|
||||
public static Half NaN => new Half { _value = 0x7FFF };
|
||||
public static Half PositiveNaN => new Half { _value = 0x7FFF };
|
||||
public static Half NegativeNaN => new Half { _value = 0xFFFF };
|
||||
public static Half PositiveZero => new Half { _value = 0x0000 };
|
||||
public static Half NegativeZero => new Half { _value = 0x8000 };
|
||||
public static Half PositiveInfinity => new Half { _value = 0x7C00 };
|
||||
public static Half NegativeInfinity => new Half { _value = 0xFC00 };
|
||||
public static Half NaN => new Half { value = 0x7FFF };
|
||||
public static Half PositiveNaN => new Half { value = 0x7FFF };
|
||||
public static Half NegativeNaN => new Half { value = 0xFFFF };
|
||||
public static Half PositiveZero => new Half { value = 0x0000 };
|
||||
public static Half NegativeZero => new Half { value = 0x8000 };
|
||||
public static Half PositiveInfinity => new Half { value = 0x7C00 };
|
||||
public static Half NegativeInfinity => new Half { value = 0xFC00 };
|
||||
|
||||
public static explicit operator Half(ushort bits) => new Half() { _value = bits };
|
||||
public static explicit operator Half(ushort bits) => new Half() { value = bits };
|
||||
|
||||
public static explicit operator ushort(Half bits) => bits._value;
|
||||
public static explicit operator ushort(Half bits) => bits.value;
|
||||
|
||||
public static unsafe implicit operator float(Half h)
|
||||
{
|
||||
int sign = (h._value >> 15) & 0x001;
|
||||
int exponent = ((h._value >> 10) & 0x01F) + 127 - 15;
|
||||
int mantissa = h._value & 0x3FF;
|
||||
int si32;
|
||||
int sign = (h.value >> 15) & 0x001;
|
||||
int exponent = (h.value >> 10) & 0x01F;
|
||||
int mantissa = h.value & 0x3FF;
|
||||
unchecked { si32 = sign != 0 ? (int)0x80000000 : 0x00000000; }
|
||||
|
||||
int si32 = (sign << 31) | (exponent << 23) | (mantissa << 13);
|
||||
if (exponent == 0x1F) si32 |= 0x7F800000;
|
||||
else if (exponent != 0x00) si32 |= (exponent - 15 + 127) << 23;
|
||||
si32 |= mantissa << 13;
|
||||
return *(float*)&si32;
|
||||
}
|
||||
|
||||
public static unsafe explicit operator Half(float val)
|
||||
{
|
||||
int si32 = *(int*)&val;
|
||||
ushort sign = (ushort)( (si32 >> 16) & 0x8000);
|
||||
short exponent = ( short)(((si32 >> 23) & 0x00FF) - 127 + 15);
|
||||
ushort mantissa = (ushort)( (si32 >> 13) & 0x03FF);
|
||||
int sign = (si32 >> 31) & 0x001;
|
||||
int exponent = (si32 >> 23) & 0x0FF;
|
||||
int mantissa = si32 & 0x3FF;
|
||||
if ( si32 == 0x00000000) return new Half { value = 0x0000 };
|
||||
else if ((uint)si32 == 0x80000000) return new Half { value = 0x8000 };
|
||||
else
|
||||
{
|
||||
if (exponent < 0) { exponent = 0; mantissa = 0; }
|
||||
else if (exponent > 30) exponent = 31;
|
||||
return new Half { value = (ushort)(sign | (exponent << 10) | mantissa) };
|
||||
}
|
||||
|
||||
if (exponent < 0) { exponent = 0; mantissa = 0; }
|
||||
else if (exponent > 30) exponent = 31;
|
||||
|
||||
return new Half { _value = (ushort)(sign | (exponent << 10) | mantissa) };
|
||||
}
|
||||
|
||||
public static unsafe implicit operator double(Half h)
|
||||
{
|
||||
int sign = (h._value >> 15) & 0x001;
|
||||
int exponent = ((h._value >> 10) & 0x01F) + 1023 - 15;
|
||||
int mantissa = h._value & 0x3FF;
|
||||
long si64;
|
||||
long sign = (h.value >> 15) & 0x001;
|
||||
long exponent = (h.value >> 10) & 0x01F;
|
||||
long mantissa = h.value & 0x3FF;
|
||||
unchecked { si64 = sign != 0 ? (long)0x8000000000000000 : 0x0000000000000000; }
|
||||
|
||||
long si64 = ((long)sign << 63) | ((long)exponent << 52) | ((long)mantissa << 42);
|
||||
if (exponent == 0x1F) si64 |= 0x7FF0000000000000;
|
||||
else if (exponent != 0x00) si64 |= (exponent - 15 + 1023) << 52;
|
||||
si64 |= mantissa << 42;
|
||||
return *(double*)&si64;
|
||||
}
|
||||
|
||||
public static unsafe explicit operator Half(double val)
|
||||
{
|
||||
long si64 = *(long*)&val;
|
||||
ushort sign = (ushort) ((si64 >> 48) & 0x8000);
|
||||
short exponent = ( short)(((si64 >> 52) & 0x07FF) - 1023 + 15);
|
||||
ushort mantissa = (ushort) ((si64 >> 42) & 0x03FF);
|
||||
if ( si64 == 0x0000000000000000) return new Half { value = 0x0000 };
|
||||
else if ((ulong)si64 == 0x8000000000000000) return new Half { value = 0x8000 };
|
||||
else
|
||||
{
|
||||
ushort sign = (ushort) ((si64 >> 63) & 0x8000);
|
||||
short exponent = ( short)(((si64 >> 52) & 0x07FF) - 1023 + 15);
|
||||
ushort mantissa = (ushort) ((si64 >> 42) & 0x03FF);
|
||||
|
||||
if (exponent < 0) { exponent = 0; mantissa = 0; }
|
||||
else if (exponent > 30) exponent = 31;
|
||||
if (exponent < 0) { exponent = 0; mantissa = 0; }
|
||||
else if (exponent > 30) exponent = 31;
|
||||
|
||||
return new Half { _value = (ushort)(sign | (exponent << 10) | mantissa) };
|
||||
return new Half { value = (ushort)(sign | (exponent << 10) | mantissa) };
|
||||
}
|
||||
}
|
||||
|
||||
public static Half operator - (Half a ) => new Half() { _value = (ushort)(a._value ^ 0x8000) };
|
||||
public static Half operator - (Half a ) => new Half() { value = (ushort)(a.value ^ 0x8000) };
|
||||
public static Half operator + (Half a, Half b) => (Half)((float)a + (float)b);
|
||||
public static Half operator - (Half a, Half b) => (Half)((float)a - (float)b);
|
||||
public static Half operator * (Half a, Half b) => (Half)((float)a * (float)b);
|
||||
|
||||
@@ -2,7 +2,7 @@ using KKdBaseLib.Auth3D;
|
||||
|
||||
namespace KKdBaseLib.Interpolation
|
||||
{
|
||||
public class A3DAI : IInterpolation<float> //A3DA Interpolation
|
||||
public class A3DAI : IInterpolation<float>, System.IDisposable //A3DA Interpolation
|
||||
{
|
||||
private A3DAKey a3daKey;
|
||||
|
||||
@@ -16,17 +16,17 @@ namespace KKdBaseLib.Interpolation
|
||||
private KFT3 firstKey;
|
||||
private KFT3 lastKey;
|
||||
|
||||
public float RequestedFramerate { get => rf; set { rf = value; df = @if / rf; } }
|
||||
public float RequestedFramerate { get => rf; set { rf = value; df = @if / rf; } }
|
||||
|
||||
public float Frame => f;
|
||||
public float Time => t;
|
||||
public float Value => v;
|
||||
public bool IsNull => a3daKey.Keys == null ? true : a3daKey.Length < 1;
|
||||
public bool NotNull => a3daKey.Keys == null ? false : a3daKey.Length > 0;
|
||||
public bool IsNull => a3daKey.Keys == null || a3daKey.Length < 1;
|
||||
public bool NotNull => a3daKey.Keys != null && a3daKey.Length > 0;
|
||||
|
||||
public A3DAI(Key key, float a3daFramerate = 60, float requestedFramerate = 60)
|
||||
{
|
||||
a3daKey = (A3DAKey)key; f = -1; df = @if = rf = t = v = 0;
|
||||
a3daKey = new A3DAKey(key); f = -1; df = @if = rf = t = v = 0;
|
||||
@if = a3daFramerate;
|
||||
firstKey = lastKey = default;
|
||||
RequestedFramerate = requestedFramerate;
|
||||
@@ -113,54 +113,44 @@ namespace KKdBaseLib.Interpolation
|
||||
{
|
||||
float df = 0;
|
||||
float ep = 0;
|
||||
float f = (int)frame;
|
||||
|
||||
if (f < firstKey.F)
|
||||
if (frame < firstKey.F)
|
||||
{
|
||||
if (a3daKey.EPTypePost < EPType.EP_1 || a3daKey.EPTypePost > EPType.EP_3) return firstKey.V;
|
||||
if (a3daKey.EPTypePost < EPType.Linear || a3daKey.EPTypePost > EPType.CycleOffset)
|
||||
return firstKey.V;
|
||||
|
||||
df = firstKey.F - frame;
|
||||
if (a3daKey.EPTypePre == EPType.EP_1) return firstKey.V - df * firstKey.T1;
|
||||
if (a3daKey.EPTypePre == EPType.Linear)
|
||||
return firstKey.V - df * firstKey.T1;
|
||||
|
||||
frame = lastKey.F - df % a3daKey.FrameDelta;
|
||||
f = (int)frame;
|
||||
if (a3daKey.EPTypePre == EPType.EP_3)
|
||||
{
|
||||
ep = df / a3daKey.FrameDelta;
|
||||
ep = (ep > 0 && ep != (int)ep) ? (ep - (int)ep > 0 ? 1 : 0) : ep;
|
||||
ep = -(ep + 1) * a3daKey.ValueDelta;
|
||||
}
|
||||
if (a3daKey.EPTypePre == EPType.CycleOffset)
|
||||
ep = -(float)((int)(df / a3daKey.FrameDelta) + 1) * a3daKey.ValueDelta;
|
||||
}
|
||||
else if (f >= lastKey.F)
|
||||
else if (frame >= lastKey.F)
|
||||
{
|
||||
if (a3daKey.EPTypePost < EPType.EP_1 || a3daKey.EPTypePost > EPType.EP_3) return lastKey.V;
|
||||
if (a3daKey.EPTypePost < EPType.Linear || a3daKey.EPTypePost > EPType.CycleOffset)
|
||||
return lastKey.V;
|
||||
|
||||
df = frame - lastKey.F;
|
||||
if (a3daKey.EPTypePost == EPType.EP_1) return lastKey.V + df * lastKey.T2;
|
||||
if (a3daKey.EPTypePost == EPType.Linear)
|
||||
return lastKey.V + df * lastKey.T2;
|
||||
|
||||
frame = firstKey.F + df % a3daKey.FrameDelta;
|
||||
f = (int)frame;
|
||||
if (a3daKey.EPTypePost == EPType.EP_3)
|
||||
{
|
||||
ep = df / a3daKey.FrameDelta;
|
||||
ep = (ep > 0 && ep != (int)ep) ? (ep - (int)ep > 0 ? 1 : 0) : ep;
|
||||
ep = (ep + 1) * a3daKey.ValueDelta;
|
||||
}
|
||||
if (a3daKey.EPTypePost == EPType.CycleOffset)
|
||||
ep = (float)((int)(df / a3daKey.FrameDelta) + 1) * a3daKey.ValueDelta;
|
||||
}
|
||||
|
||||
if (f <= firstKey.F) return firstKey.V + ep;
|
||||
else if (f >= lastKey.F) return lastKey.V + ep;
|
||||
|
||||
KFT3 c, n;
|
||||
long key = 0;
|
||||
unsafe
|
||||
{
|
||||
fixed (KFT3* ptr = a3daKey.Keys)
|
||||
{
|
||||
long key = 0;
|
||||
long length = a3daKey.Length;
|
||||
long temp;
|
||||
while (length > 0)
|
||||
if (f > a3daKey.Keys[key + (temp = length >> 1)].F)
|
||||
if (frame >= ptr[key + (temp = length >> 1)].F)
|
||||
{
|
||||
key += temp + 1;
|
||||
length -= temp + 1;
|
||||
@@ -172,29 +162,35 @@ namespace KKdBaseLib.Interpolation
|
||||
}
|
||||
}
|
||||
|
||||
float result;
|
||||
if (frame > c.F && frame < n.F)
|
||||
float v;
|
||||
if (frame <= c.F || frame >= n.F)
|
||||
v = frame > c.F ? n.V : c.V;
|
||||
else if (a3daKey.Type == KeyType.Linear || (a3daKey.Type == KeyType.Hermite && n.T1 == c.T2 && n.T1 == 0.0f))
|
||||
{
|
||||
if (a3daKey.Type == KeyType.Lerp)
|
||||
{
|
||||
float t = (frame - c.F) / (n.F - c.F);
|
||||
result = (1 - t) * c.V + t * n.V;
|
||||
}
|
||||
else if (a3daKey.Type == KeyType.Hermite)
|
||||
{
|
||||
float t = (frame - c.F) / (n.F - c.F);
|
||||
float t_2 = (1 - t) * (1 - t);
|
||||
result = t_2 * c.V * (1 + 2 * t) + (t * n.V * (3 - 2 * t) +
|
||||
(t_2 * c.T2 + t * (t - 1) * n.T1) * (n.F - c.F)) * t;
|
||||
}
|
||||
else result = c.V;
|
||||
float t = (frame - c.F) / (n.F - c.F);
|
||||
v = (1.0f - t) * c.V + t * n.V;
|
||||
}
|
||||
else result = frame > c.F ? n.V : c.V;
|
||||
return result + ep;
|
||||
else if (a3daKey.Type == KeyType.Hermite)
|
||||
{
|
||||
float t = (frame - c.F) / (n.F - c.F);
|
||||
float t_2 = (1.0f - t) * (1.0f - t);
|
||||
v = t_2 * c.V * (1.0f + 2.0f * t) + (t * n.V * (3.0f - 2.0f * t) +
|
||||
(t_2 * c.T2 + t * (t - 1.0f) * n.T1) * (n.F - c.F)) * t;
|
||||
}
|
||||
else v = c.V;
|
||||
return v + ep;
|
||||
}
|
||||
|
||||
public void ResetFrameCount() { f = -df; t = f / rf; }
|
||||
|
||||
public override string ToString() => $"F: {f}; T: {t}; V: {v}";
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
a3daKey.Keys = null;
|
||||
a3daKey = default;
|
||||
f = t = v = df = @if = rf = default;
|
||||
firstKey = lastKey = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace KKdBaseLib.Interpolation
|
||||
public float Frame => f;
|
||||
public float Time => t;
|
||||
public float Value => v;
|
||||
public bool IsNull => array == null ? true : array.Length < 1;
|
||||
public bool NotNull => array == null ? false : array.Length > 0;
|
||||
public bool IsNull => array == null || array.Length < 1;
|
||||
public bool NotNull => array != null && array.Length > 0;
|
||||
|
||||
public PDI(KFT2[] array, float interpolationFramerate = 60, float requestedFramerate = 60)
|
||||
{
|
||||
@@ -87,10 +87,8 @@ namespace KKdBaseLib.Interpolation
|
||||
|
||||
private float Interpolate(float frame)
|
||||
{
|
||||
float f = (int)frame;
|
||||
|
||||
if (f <= firstKey.F) return firstKey.V;
|
||||
else if (f >= lastKey.F) return lastKey.V;
|
||||
if (frame <= firstKey.F) return firstKey.V;
|
||||
else if (frame >= lastKey.F) return lastKey.V;
|
||||
|
||||
KFT2 c, n;
|
||||
unsafe
|
||||
@@ -101,7 +99,7 @@ namespace KKdBaseLib.Interpolation
|
||||
long length = this.length;
|
||||
long temp;
|
||||
while (length > 0)
|
||||
if (f > array[key + (temp = length >> 1)].F)
|
||||
if (frame >= ptr[key + (temp = length >> 1)].F)
|
||||
{
|
||||
key += temp + 1;
|
||||
length -= temp + 1;
|
||||
@@ -113,16 +111,22 @@ namespace KKdBaseLib.Interpolation
|
||||
}
|
||||
}
|
||||
|
||||
float result;
|
||||
if (frame > c.F && frame < n.F)
|
||||
float v;
|
||||
if (frame <= c.F || frame >= n.F)
|
||||
v = frame > c.F ? n.V : c.V;
|
||||
else if (n.T == c.T && n.T == 0.0f)
|
||||
{
|
||||
float t = (this.f - c.F) / (n.F - c.F);
|
||||
float t_1 = t - 1;
|
||||
result = (t_1 * 2 - 1) * (c.V - n.V) * t * t +
|
||||
(t_1 * c.T + t * n.T) * t_1 * (this.f - c.F) + c.V;
|
||||
float t = (frame - c.F) / (n.F - c.F);
|
||||
v = (1.0f - t) * c.V + t * n.V;
|
||||
}
|
||||
else result = frame > c.F ? n.V : c.V;
|
||||
return result;
|
||||
else
|
||||
{
|
||||
float t = (frame - c.F) / (n.F - c.F);
|
||||
float t_1 = t - 1.0f;
|
||||
v = (t_1 * 2.0f - 1.0f) * (c.V - n.V) * t * t +
|
||||
(t_1 * c.T + t * n.T) * t_1 * (frame - c.F) + c.V;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public void ResetFrameCount() { f = -df; t = f / rf; }
|
||||
|
||||
+23
-5
@@ -4,7 +4,7 @@ namespace KKdBaseLib
|
||||
{
|
||||
public float F;
|
||||
|
||||
public KFT0(float F = 0)
|
||||
public KFT0(float F)
|
||||
{ this.F = F; }
|
||||
|
||||
public KFT0 ToT0() => this;
|
||||
@@ -55,7 +55,10 @@ namespace KKdBaseLib
|
||||
public float F;
|
||||
public float V;
|
||||
|
||||
public KFT1(float F = 0, float V = 0)
|
||||
public KFT1(float F)
|
||||
{ this.F = F; V = 0; }
|
||||
|
||||
public KFT1(float F, float V)
|
||||
{ this.F = F; this.V = V; }
|
||||
|
||||
public KFT0 ToT0() =>
|
||||
@@ -109,7 +112,13 @@ namespace KKdBaseLib
|
||||
public float V;
|
||||
public float T;
|
||||
|
||||
public KFT2(float F = 0, float V = 0, float T = 0)
|
||||
public KFT2(float F)
|
||||
{ this.F = F; V = T = 0; }
|
||||
|
||||
public KFT2(float F, float V)
|
||||
{ this.F = F; this.V = V; T = 0; }
|
||||
|
||||
public KFT2(float F, float V, float T)
|
||||
{ this.F = F; this.V = V; this.T = T; }
|
||||
|
||||
public KFT0 ToT0() =>
|
||||
@@ -118,7 +127,7 @@ namespace KKdBaseLib
|
||||
new KFT1(F, V);
|
||||
public KFT2 ToT2() => this;
|
||||
public KFT3 ToT3() =>
|
||||
new KFT3(F, V, T, T);
|
||||
new KFT3(F, V, T);
|
||||
|
||||
public KFT3 ToT3(IKF Previous) =>
|
||||
Previous is KFT2 PreviousT2 ?
|
||||
@@ -169,7 +178,16 @@ namespace KKdBaseLib
|
||||
public float T1;
|
||||
public float T2;
|
||||
|
||||
public KFT3(float F = 0, float V = 0, float T1 = 0, float T2 = 0)
|
||||
public KFT3(float F)
|
||||
{ this.F = F; V = T1 = T2 = 0; }
|
||||
|
||||
public KFT3(float F, float V)
|
||||
{ this.F = F; this.V = V; T1 = T2 = 0; }
|
||||
|
||||
public KFT3(float F, float V, float T)
|
||||
{ this.F = F; this.V = V; T1 = T2 = T; }
|
||||
|
||||
public KFT3(float F, float V, float T1, float T2)
|
||||
{ this.F = F; this.V = V; this.T1 = T1; this.T2 = T2; }
|
||||
|
||||
public KFT0 ToT0() =>
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<Authors>korenkonder</Authors>
|
||||
<Company></Company>
|
||||
<Configuration></Configuration>
|
||||
<Copyright>korenkonder © 2019-2020</Copyright>
|
||||
<Copyright>korenkonder (C) 2019-2020</Copyright>
|
||||
<Description>A base library</Description>
|
||||
<FileVersion>0.4.9.4</FileVersion>
|
||||
<FileVersion>0.4.9.8</FileVersion>
|
||||
<PackageId>KKdBaseLib</PackageId>
|
||||
<Product>KKdBaseLib</Product>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
<Title>KKdBaseLib</Title>
|
||||
<Version>0.4.9.4</Version>
|
||||
<Version>0.4.9.8</Version>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -24,7 +24,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
|
||||
<NoWarn>IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -37,7 +37,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
|
||||
<NoWarn>IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
|
||||
+15
-15
@@ -4,8 +4,8 @@ namespace KKdBaseLib
|
||||
{
|
||||
public static KKdDict<TKey, TValue> Null => new KKdDict<TKey, TValue>();
|
||||
public static KKdDict<TKey, TValue> New => new KKdDict<TKey, TValue>() { count = 0, Capacity = 0 };
|
||||
public static KKdDict<TKey, TValue> NewReserve(int Capacity) =>
|
||||
new KKdDict<TKey, TValue>() { count = 0, Capacity = Capacity };
|
||||
public static KKdDict<TKey, TValue> NewReserve(int capacity) =>
|
||||
new KKdDict<TKey, TValue>() { count = 0, Capacity = capacity };
|
||||
|
||||
private int count;
|
||||
private int index;
|
||||
@@ -76,8 +76,8 @@ namespace KKdBaseLib
|
||||
if (IsNull || ContainsKey(pair.Key)) return;
|
||||
|
||||
count++;
|
||||
if (keyArray.Length < count) System.Array.Resize(ref keyArray, count);
|
||||
if (valArray.Length < count) System.Array.Resize(ref valArray, count);
|
||||
if (keyArray.Length < count) System.Array.Resize(ref keyArray, keyArray.Length * 2 + 1);
|
||||
if (valArray.Length < count) System.Array.Resize(ref valArray, valArray.Length * 2 + 1);
|
||||
keyArray[count - 1] = pair.Key;
|
||||
valArray[count - 1] = pair.Value;
|
||||
}
|
||||
@@ -87,8 +87,8 @@ namespace KKdBaseLib
|
||||
if (IsNull || ContainsKey(key)) return;
|
||||
|
||||
count++;
|
||||
if (keyArray.Length < count) System.Array.Resize(ref keyArray, count);
|
||||
if (valArray.Length < count) System.Array.Resize(ref valArray, count);
|
||||
if (keyArray.Length < count) System.Array.Resize(ref keyArray, keyArray.Length * 2 + 1);
|
||||
if (valArray.Length < count) System.Array.Resize(ref valArray, valArray.Length * 2 + 1);
|
||||
keyArray[count - 1] = key;
|
||||
valArray[count - 1] = val;
|
||||
}
|
||||
@@ -101,8 +101,8 @@ namespace KKdBaseLib
|
||||
if (index == -1) return false;
|
||||
|
||||
if (index + 1 < count)
|
||||
{ System.Array.Copy(keyArray, index + 1, keyArray, index, count - index);
|
||||
System.Array.Copy(valArray, index + 1, valArray, index, count - index); }
|
||||
{ System.Array.Copy(keyArray, index + 1, keyArray, index, count - index - 1);
|
||||
System.Array.Copy(valArray, index + 1, valArray, index, count - index - 1); }
|
||||
count--;
|
||||
return true;
|
||||
}
|
||||
@@ -115,8 +115,8 @@ namespace KKdBaseLib
|
||||
if (index == -1) return false;
|
||||
|
||||
if (index + 1 < count)
|
||||
{ System.Array.Copy(keyArray, index + 1, keyArray, index, count - index);
|
||||
System.Array.Copy(valArray, index + 1, valArray, index, count - index); }
|
||||
{ System.Array.Copy(keyArray, index + 1, keyArray, index, count - index - 1);
|
||||
System.Array.Copy(valArray, index + 1, valArray, index, count - index - 1); }
|
||||
count--;
|
||||
return true;
|
||||
}
|
||||
@@ -126,8 +126,8 @@ namespace KKdBaseLib
|
||||
if (IsNull || index < 0 || index >= count) return;
|
||||
|
||||
if (index + 1 < count)
|
||||
{ System.Array.Copy(keyArray, index + 1, keyArray, index, count - index);
|
||||
System.Array.Copy(valArray, index + 1, valArray, index, count - index); }
|
||||
{ System.Array.Copy(keyArray, index + 1, keyArray, index, count - index - 1);
|
||||
System.Array.Copy(valArray, index + 1, valArray, index, count - index - 1); }
|
||||
count--;
|
||||
}
|
||||
|
||||
@@ -192,9 +192,9 @@ namespace KKdBaseLib
|
||||
{
|
||||
if (IsNull) return default;
|
||||
for (int i = 0; i < count; i++)
|
||||
if (keyArray[i] == null && val == null) return keyArray[i];
|
||||
else if (keyArray[i] == null || val == null) continue;
|
||||
else if (keyArray[i].Equals(val)) return keyArray[i];
|
||||
if (valArray[i] == null && val == null) return keyArray[i];
|
||||
else if (valArray[i] == null || val == null) continue;
|
||||
else if (valArray[i].Equals(val)) return keyArray[i];
|
||||
return default;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace KKdBaseLib
|
||||
{
|
||||
public static KKdList<T> Null => new KKdList<T>();
|
||||
public static KKdList<T> New => new KKdList<T>() { count = 0, Capacity = 0 };
|
||||
public static KKdList<T> NewReserve(int Capacity) => new KKdList<T>() { count = 0, Capacity = Capacity };
|
||||
public static KKdList<T> NewReserve(int capacity) => new KKdList<T>() { count = 0, Capacity = capacity };
|
||||
|
||||
private int count;
|
||||
private int index;
|
||||
@@ -61,7 +61,7 @@ namespace KKdBaseLib
|
||||
|
||||
count++;
|
||||
if (array.Length < count)
|
||||
System.Array.Resize(ref array, count);
|
||||
System.Array.Resize(ref array, array.Length * 2 + 1);
|
||||
array[count - 1] = item;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace KKdBaseLib
|
||||
if (IsNull || index < 0 || index >= count) return;
|
||||
|
||||
if (index + 1 < count)
|
||||
System.Array.Copy(array, index + 1, array, index, count - index);
|
||||
System.Array.Copy(array, index + 1, array, index, count - index - 1);
|
||||
count--;
|
||||
}
|
||||
|
||||
@@ -107,13 +107,15 @@ namespace KKdBaseLib
|
||||
}
|
||||
|
||||
public void Sort()
|
||||
{ List<T> List = (List<T>)this; List.Sort(); array = List.ToArray(); count = List.Count; }
|
||||
{ Capacity = Count; List<T> List = (List<T>)this; List.Sort();
|
||||
array = List.ToArray(); count = List.Count; }
|
||||
|
||||
public static explicit operator KKdList<T>( List<T> list) =>
|
||||
new KKdList<T> { array = list.ToArray(), count = list.Count };
|
||||
|
||||
public static explicit operator List<T>(KKdList<T> list)
|
||||
{ List<T> outList = new List<T>(); for (int i = 0; i < list.Count; i++) outList.Add(list[i]); return outList; }
|
||||
{ list.Capacity = list.Count; List<T> outList = new List<T>();
|
||||
for (int i = 0; i < list.Count; i++) outList.Add(list[i]); return outList; }
|
||||
|
||||
public override string ToString() =>
|
||||
$"(Count: {Count}; Capacity: {Capacity}; Current: {Current})";
|
||||
|
||||
+52
-12
@@ -51,22 +51,22 @@ namespace KKdBaseLib
|
||||
string[] newArgs = new string[args.Length - 1];
|
||||
for (int i = 0; i < args.Length - 1; i++)
|
||||
newArgs[i] = args[i + 1];
|
||||
return dict.ContainsKey(args[0]) ? SW((A3DADict)dict[args[0]], newArgs) : false;
|
||||
return dict.ContainsKey(args[0]) && SW((A3DADict)dict[args[0]], newArgs);
|
||||
}
|
||||
return dict.ContainsKey(args[0]);
|
||||
}
|
||||
|
||||
public static bool FV (this A3DADict dict, ref bool value, char split, string args) =>
|
||||
dict.FV(out string val, args.Split(split)) ? bool.TryParse(val, out value) : false;
|
||||
dict.FV(out string val, args.Split(split)) && bool.TryParse(val, out value);
|
||||
|
||||
public static bool FV (this A3DADict dict, ref int value, char split, string args) =>
|
||||
dict.FV(out string val, args.Split(split)) ? int.TryParse(val, out value) : false;
|
||||
dict.FV(out string val, args.Split(split)) && int.TryParse(val, out value);
|
||||
|
||||
public static bool FV (this A3DADict dict, ref float value, char split, string args) =>
|
||||
dict.FV(out string val, args.Split(split)) ? val.ToF32(out value) : false;
|
||||
dict.FV(out string val, args.Split(split)) && val.ToF32(out value);
|
||||
|
||||
public static bool FV (this A3DADict dict, ref double value, char split, string args) =>
|
||||
dict.FV(out string val, args.Split(split)) ? val.ToF64(out value) : false;
|
||||
dict.FV(out string val, args.Split(split)) && val.ToF64(out value);
|
||||
|
||||
public static bool FV (this A3DADict dict, ref string value, char split, string args)
|
||||
{ if (dict.FV(out string val , args.Split(split)))
|
||||
@@ -199,13 +199,53 @@ namespace KKdBaseLib
|
||||
|
||||
public static int[] SW(this int length)
|
||||
{
|
||||
int i = 0;
|
||||
List<string> A = new List<string>();
|
||||
for (i = 0; i < length; i++) A.Add(i.ToString());
|
||||
A.Sort();
|
||||
int[] B = new int[length];
|
||||
for (i = 0; i < length; i++) B[i] = int.Parse(A[i]);
|
||||
return B;
|
||||
int i, j, m;
|
||||
|
||||
if (length <= 0) return new int[0];
|
||||
if (length == 1) return new int[1] { 0 };
|
||||
|
||||
int[] sort = new int[length];
|
||||
sort[0] = 0;
|
||||
i = 1;
|
||||
j = 1;
|
||||
|
||||
m = 1;
|
||||
while (m < length)
|
||||
m *= 10;
|
||||
while (i < length)
|
||||
{
|
||||
if (j * 10 < m)
|
||||
{
|
||||
sort[i++] = j;
|
||||
j *= 10;
|
||||
}
|
||||
else if (j >= length)
|
||||
{
|
||||
m /= 10;
|
||||
j /= 10;
|
||||
sort[i++] = ++j;
|
||||
if (j * 10 >= length)
|
||||
j++;
|
||||
}
|
||||
else if (j % 10 != 9)
|
||||
sort[i++] = j++;
|
||||
|
||||
if (i < length)
|
||||
if (j == length && j % 10 != 9)
|
||||
{
|
||||
m /= 10;
|
||||
j /= 10;
|
||||
while (j % 10 == 9) j /= 10;
|
||||
j++;
|
||||
}
|
||||
else if (j < length && j % 10 == 9)
|
||||
{
|
||||
sort[i++] = j;
|
||||
while (j % 10 == 9) j /= 10;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
return sort;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ namespace KKdBaseLib
|
||||
|
||||
public Vec2 Column0 { get => new Vec2(Row0.X, Row1.X);
|
||||
set { Row0.X = value.X; Row1.X = value.Y; } }
|
||||
public Vec2 Column1 { get => new Vec2(Row0.Y, Row1.X);
|
||||
public Vec2 Column1 { get => new Vec2(Row0.Y, Row1.Y);
|
||||
set { Row0.Y = value.X; Row1.Y = value.Y; } }
|
||||
|
||||
public static Mat2 Identity => new Mat2(new Vec2(1.0f, 0.0f),
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ namespace KKdBaseLib
|
||||
|
||||
public Vec3 Column0 { get => new Vec3(Row0.X, Row1.X, Row2.X);
|
||||
set { Row0.X = value.X; Row1.X = value.Y; Row2.X = value.Z; } }
|
||||
public Vec3 Column1 { get => new Vec3(Row0.Y, Row1.X, Row2.Y);
|
||||
public Vec3 Column1 { get => new Vec3(Row0.Y, Row1.Y, Row2.Y);
|
||||
set { Row0.Y = value.X; Row1.Y = value.Y; Row2.Y = value.Z; } }
|
||||
public Vec3 Column2 { get => new Vec3(Row0.Z, Row1.Z, Row2.Z);
|
||||
set { Row0.Z = value.X; Row1.Z = value.Y; Row2.Z = value.Z;} }
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ namespace KKdBaseLib
|
||||
|
||||
public Vec4 Column0 { get => new Vec4(Row0.X, Row1.X, Row2.X, Row3.X);
|
||||
set { Row0.X = value.X; Row1.X = value.Y; Row2.X = value.Z; Row3.X = value.W; } }
|
||||
public Vec4 Column1 { get => new Vec4(Row0.Y, Row1.X, Row2.Y, Row3.Y);
|
||||
public Vec4 Column1 { get => new Vec4(Row0.Y, Row1.Y, Row2.Y, Row3.Y);
|
||||
set { Row0.Y = value.X; Row1.Y = value.Y; Row2.Y = value.Z; Row3.Y = value.W; } }
|
||||
public Vec4 Column2 { get => new Vec4(Row0.Z, Row1.Z, Row2.Z, Row3.Z);
|
||||
set { Row0.Z = value.X; Row1.Z = value.Y; Row2.Z = value.Z; Row3.Z = value.W; } }
|
||||
|
||||
+45
-54
@@ -12,33 +12,33 @@ namespace KKdBaseLib
|
||||
|
||||
public static Quat Identity => new Quat(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
public Quat(float X, float Y, float Z)
|
||||
public Quat(float x, float y, float z)
|
||||
{
|
||||
X *= 0.5f;
|
||||
Y *= 0.5f;
|
||||
Z *= 0.5f;
|
||||
x *= 0.5f;
|
||||
y *= 0.5f;
|
||||
z *= 0.5f;
|
||||
|
||||
var c1 = (float)System.Math.Cos(X);
|
||||
var c2 = (float)System.Math.Cos(Y);
|
||||
var c3 = (float)System.Math.Cos(Z);
|
||||
var s1 = (float)System.Math.Sin(X);
|
||||
var s2 = (float)System.Math.Sin(Y);
|
||||
var s3 = (float)System.Math.Sin(Z);
|
||||
var c1 = (float)System.Math.Cos(x);
|
||||
var c2 = (float)System.Math.Cos(y);
|
||||
var c3 = (float)System.Math.Cos(z);
|
||||
var s1 = (float)System.Math.Sin(x);
|
||||
var s2 = (float)System.Math.Sin(y);
|
||||
var s3 = (float)System.Math.Sin(z);
|
||||
|
||||
this.X = s1 * c2 * c3 + c1 * s2 * s3;
|
||||
this.Y = c1 * s2 * c3 - s1 * c2 * s3;
|
||||
this.Z = c1 * c2 * s3 + s1 * s2 * c3;
|
||||
W = c1 * c2 * c3 - s1 * s2 * s3;
|
||||
X = s1 * c2 * c3 + c1 * s2 * s3;
|
||||
Y = c1 * s2 * c3 - s1 * c2 * s3;
|
||||
Z = c1 * c2 * s3 + s1 * s2 * c3;
|
||||
W = c1 * c2 * c3 - s1 * s2 * s3;
|
||||
}
|
||||
|
||||
public Quat(Vec3 vec) : this(vec.X, vec.Y, vec.Z)
|
||||
{ }
|
||||
|
||||
public Quat(float X, float Y, float Z, float W)
|
||||
{ this.X = X; this.Y = Y; this.Z = Z; this.W = W; }
|
||||
public Quat(float x, float y, float z, float w)
|
||||
{ X = x; Y = y; Z = z; W = w; }
|
||||
|
||||
public Quat(Vec3 vec, float W)
|
||||
{ X = vec.X; Y = vec.Y; Z = vec.Z; this.W = W; }
|
||||
public Quat(Vec3 vec, float w)
|
||||
{ X = vec.X; Y = vec.Y; Z = vec.Z; W = w; }
|
||||
|
||||
public Quat(Vec4 vec)
|
||||
{ X = vec.X; Y = vec.Y; Z = vec.Z; W = vec.W; }
|
||||
@@ -97,7 +97,7 @@ namespace KKdBaseLib
|
||||
public static Quat operator -(Quat left, Quat right)
|
||||
{ left.X -= right.X; left.Y -= right.Y; left.Z -= right.Z; left.W -= right.W; return left; }
|
||||
public static Quat operator -(Quat quat) =>
|
||||
new Quat(-quat.X, -quat.Y, -quat.Z, quat.W);
|
||||
new Quat(-quat.X, -quat.Y, -quat.Z, -quat.W);
|
||||
public static Quat operator *( Quat quat, float scale)
|
||||
{ quat.X *= scale ; quat.Y *= scale ; quat.Z *= scale ; quat.W *= scale ; return quat; }
|
||||
public static Quat operator *(float scale, Quat quat)
|
||||
@@ -112,55 +112,46 @@ namespace KKdBaseLib
|
||||
public static bool operator ==(Quat A, Quat B) => A.Equals(B);
|
||||
public static bool operator !=(Quat A, Quat B) => !A.Equals(B);
|
||||
|
||||
public static float Distance (Vec4 left, Vec4 right) =>
|
||||
public static float Distance (Quat left, Quat right) =>
|
||||
((right.X - left.X) * (right.X - left.X) + (right.Y - left.Y) * (right.Y - left.Y) +
|
||||
(right.Z - left.Z) * (right.Z - left.Z) + (right.W - left.W) * (right.W - left.W)).Sqrt();
|
||||
public static float DistanceSquared(Vec4 left, Vec4 right) =>
|
||||
public static float DistanceSquared(Quat left, Quat right) =>
|
||||
(right.X - left.X) * (right.X - left.X) + (right.Y - left.Y) * (right.Y - left.Y) +
|
||||
(right.Z - left.Z) * (right.Z - left.Z) + (right.W - left.W) * (right.W - left.W);
|
||||
public static float Dot(Vec4 left, Vec4 right) =>
|
||||
public static float Dot(Quat left, Quat right) =>
|
||||
left.X * right.X + left.Y * right.Y + left.Z * right.Z + left.W * right.W;
|
||||
public Vec4 Round( ) =>
|
||||
new Vec4 { X = X.Round( ), Y = Y.Round( ), Z = Z.Round( ), W = W.Round( ) };
|
||||
public Vec4 Round(int d) =>
|
||||
new Vec4 { X = X.Round(d), Y = Y.Round(d), Z = Z.Round(d), W = W.Round(d) };
|
||||
public Quat Round( ) =>
|
||||
new Quat { X = X.Round( ), Y = Y.Round( ), Z = Z.Round( ), W = W.Round( ) };
|
||||
public Quat Round(int d) =>
|
||||
new Quat { X = X.Round(d), Y = Y.Round(d), Z = Z.Round(d), W = W.Round(d) };
|
||||
|
||||
public static Quat Slerp(Quat q1, Quat q2, float blend)
|
||||
{
|
||||
if (q1.LengthSquared == 0.0f)
|
||||
return q2.LengthSquared == 0.0f ? Identity : q2;
|
||||
else if (q2.LengthSquared == 0.0f)
|
||||
return q1;
|
||||
q1 = q1.Normalized;
|
||||
q2 = q2.Normalized;
|
||||
|
||||
float cosHalfAngle = Vec4.Dot((Vec4)q1, (Vec4)q2);
|
||||
|
||||
if (cosHalfAngle >= 1.0f || cosHalfAngle <= -1.0f)
|
||||
return q1;
|
||||
|
||||
if (cosHalfAngle < 0.0f)
|
||||
float dot = Dot(q1, q2);
|
||||
if (dot < 0.0f)
|
||||
{
|
||||
q2.XYZ = -q2.XYZ;
|
||||
q2.W = -q2.W;
|
||||
cosHalfAngle = -cosHalfAngle;
|
||||
q2 = -q2;
|
||||
dot = -dot;
|
||||
}
|
||||
|
||||
float blendA;
|
||||
float blendB;
|
||||
if (cosHalfAngle < 0.99f)
|
||||
Quat result;
|
||||
const float DOT_THRESHOLD = 0.9995f;
|
||||
if (dot <= DOT_THRESHOLD)
|
||||
{
|
||||
float halfAngle = (float)System.Math.Acos(cosHalfAngle);
|
||||
float sinHalfAngle = (float)System.Math.Sin(halfAngle);
|
||||
float oneOverSinHalfAngle = 1.0f / sinHalfAngle;
|
||||
blendA = (float)System.Math.Sin(halfAngle * (1.0f - blend)) * oneOverSinHalfAngle;
|
||||
blendB = (float)System.Math.Sin(halfAngle * blend) * oneOverSinHalfAngle;
|
||||
float theta_0 = (float)System.Math.Acos(dot);
|
||||
float theta = theta_0 * blend;
|
||||
float sin_theta = (float)System.Math.Sin(theta);
|
||||
float sin_theta_0 = (float)System.Math.Sin(theta_0);
|
||||
|
||||
float s0 = (float)System.Math.Cos(theta) - dot * sin_theta / sin_theta_0;
|
||||
float s1 = sin_theta / sin_theta_0;
|
||||
result = s0 * q1 + s1 * q2;
|
||||
}
|
||||
else
|
||||
{
|
||||
blendA = 1.0f - blend;
|
||||
blendB = blend;
|
||||
}
|
||||
|
||||
Quat result = new Quat(blendA * q1.XYZ + blendB * q2.XYZ, blendA * q1.W + blendB * q2.W);
|
||||
result = (1.0f - blend) * q1 + blend * q2;
|
||||
return result.Normalized;
|
||||
}
|
||||
|
||||
@@ -169,7 +160,7 @@ namespace KKdBaseLib
|
||||
public static explicit operator Quat(Vec4 vec) =>
|
||||
new Quat( vec.XYZ, vec.W);
|
||||
|
||||
public bool Equals(Vec4 other) =>
|
||||
public bool Equals(Quat other) =>
|
||||
X == other.X && Y == other.Y && Z == other.Z && W == other.W;
|
||||
|
||||
public override bool Equals(object obj) => base.Equals(obj);
|
||||
|
||||
@@ -190,6 +190,6 @@ namespace KKdBaseLib.Tables
|
||||
}
|
||||
|
||||
public override string ToString() =>
|
||||
$"{Year.ToString("d4")}-{Month.ToString("d2")}-{Day.ToString("d2")}";
|
||||
$"{Year:d4}-{Month:d2}-{Day:d2}";
|
||||
}
|
||||
}
|
||||
|
||||
+329
-281
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -6,7 +6,7 @@ namespace KKdMainLib
|
||||
public unsafe struct AddParam : System.IDisposable
|
||||
{
|
||||
private long i;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
|
||||
public HeaderData Header;
|
||||
|
||||
@@ -14,17 +14,17 @@ namespace KKdMainLib
|
||||
{
|
||||
Header = new HeaderData();
|
||||
|
||||
_IO = File.OpenReader(file + ".adp");
|
||||
Header.Count = _IO.RI64();
|
||||
Header.DataLength = _IO.RI64();
|
||||
Header.DataOffset = _IO.RI64();
|
||||
s = File.OpenReader(file + ".adp");
|
||||
Header.Count = s.RI64();
|
||||
Header.DataLength = s.RI64();
|
||||
Header.DataOffset = s.RI64();
|
||||
|
||||
if (Header.Count < 1 || Header.DataOffset > _IO.P || Header.DataLength > _IO.LI64
|
||||
- Header.DataOffset || Header.Count * 0x20 > _IO.LI64 - Header.DataOffset) { _IO.C(); return; }
|
||||
if (Header.Count < 1 || Header.DataOffset > s.P || Header.DataLength > s.LI64
|
||||
- Header.DataOffset || Header.Count * 0x20 > s.LI64 - Header.DataOffset) { s.C(); return; }
|
||||
|
||||
Header.Data = new HeaderData.Sub[Header.Count];
|
||||
byte[] data = _IO.RBy(Header.DataLength, Header.DataOffset);
|
||||
_IO.C();
|
||||
byte[] data = s.RBy(Header.DataLength, Header.DataOffset);
|
||||
s.C();
|
||||
|
||||
fixed (byte* ptr = data)
|
||||
{
|
||||
@@ -52,12 +52,12 @@ namespace KKdMainLib
|
||||
hPtr[i] = Header.Data[i];
|
||||
}
|
||||
|
||||
_IO = File.OpenWriter(file + ".adp", true);
|
||||
_IO.W(Header.Count);
|
||||
_IO.W(Header.DataLength);
|
||||
_IO.W(Header.DataOffset);
|
||||
_IO.W(data);
|
||||
_IO.C();
|
||||
s = File.OpenWriter(file + ".adp", true);
|
||||
s.W(Header.Count);
|
||||
s.W(Header.DataLength);
|
||||
s.W(Header.DataOffset);
|
||||
s.W(data);
|
||||
s.C();
|
||||
data = null;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace KKdMainLib
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{ if (_IO != null) _IO.D(); _IO = null; Header = default; }
|
||||
{ if (s != null) s.D(); s = null; Header = default; }
|
||||
|
||||
public struct HeaderData
|
||||
{
|
||||
|
||||
+238
-236
@@ -8,8 +8,8 @@ namespace KKdMainLib
|
||||
{
|
||||
public struct Aet : System.IDisposable
|
||||
{
|
||||
private Stream _IO;
|
||||
private int i, i0, i1, i2;
|
||||
private Stream s;
|
||||
private const string x00 = "\0";
|
||||
|
||||
public Header AET;
|
||||
@@ -17,98 +17,98 @@ namespace KKdMainLib
|
||||
public void AETReader(string file)
|
||||
{
|
||||
AET = default;
|
||||
_IO = File.OpenReader(file + ".bin", true);
|
||||
s = File.OpenReader(file + ".bin", true);
|
||||
|
||||
int i = 0;
|
||||
int Pos = -1;
|
||||
while (true) { Pos = _IO.RI32(); if (Pos != 0 && Pos < _IO.L) i++; else break; }
|
||||
while (true) { Pos = s.RI32(); if (Pos != 0 && Pos < s.L) i++; else break; }
|
||||
|
||||
_IO.P = 0;
|
||||
s.P = 0;
|
||||
AET.Scenes = new Pointer<Scene>[i];
|
||||
for (i = 0; i < AET.Scenes.Length; i++) AET.Scenes[i] = _IO.RP<Scene>();
|
||||
for (i = 0; i < AET.Scenes.Length; i++) AET.Scenes[i] = s.RP<Scene>();
|
||||
for (i = 0; i < AET.Scenes.Length; i++) AETReader(ref AET.Scenes[i]);
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void AETWriter(string file)
|
||||
{
|
||||
if (AET.Scenes == null || AET.Scenes.Length == 0) return;
|
||||
_IO = File.OpenWriter();
|
||||
s = File.OpenWriter();
|
||||
|
||||
for (int i = 0; i < AET.Scenes.Length; i++)
|
||||
{
|
||||
_IO.P = _IO.L + 0x20;
|
||||
s.P = s.L + 0x20;
|
||||
AETWriter(ref AET.Scenes[i]);
|
||||
}
|
||||
|
||||
_IO.P = 0;
|
||||
s.P = 0;
|
||||
for (int i = 0; i < AET.Scenes.Length; i++)
|
||||
if (AET.Scenes[i].O > 0) _IO.W(AET.Scenes[i].O);
|
||||
byte[] data = _IO.ToArray();
|
||||
_IO.Dispose();
|
||||
if (AET.Scenes[i].O > 0) s.W(AET.Scenes[i].O);
|
||||
byte[] data = s.ToArray();
|
||||
s.Dispose();
|
||||
|
||||
using (_IO = File.OpenWriter(file + ".bin", true))
|
||||
_IO.W(data);
|
||||
using (s = File.OpenWriter(file + ".bin", true))
|
||||
s.W(data);
|
||||
data = null;
|
||||
}
|
||||
|
||||
private void AETReader(ref Pointer<Scene> aetData)
|
||||
{
|
||||
_IO.P = aetData.O;
|
||||
s.P = aetData.O;
|
||||
ref Scene aet = ref aetData.V;
|
||||
|
||||
aet.Name = _IO.RPS();
|
||||
aet.StartFrame = _IO.RF32();
|
||||
aet.EndFrame = _IO.RF32();
|
||||
aet.FrameRate = _IO.RF32();
|
||||
aet.BackColor = _IO.RU32();
|
||||
aet.Width = _IO.RU32();
|
||||
aet.Height = _IO.RU32();
|
||||
aet.Camera = _IO.RP<Vec2<CountPointer<KFT2>>>();
|
||||
aet.Composition = _IO.ReadCountPointer<Composition>();
|
||||
aet.Video = _IO.ReadCountPointer<Video >();
|
||||
aet.Audio = _IO.ReadCountPointer<Audio >();
|
||||
aet.Name = s.RPS();
|
||||
aet.StartFrame = s.RF32();
|
||||
aet.EndFrame = s.RF32();
|
||||
aet.FrameRate = s.RF32();
|
||||
aet.BackColor = s.RU32();
|
||||
aet.Width = s.RU32();
|
||||
aet.Height = s.RU32();
|
||||
aet.Camera = s.RP<Vec2<CountPointer<KFT2>>>();
|
||||
aet.Composition = s.ReadCountPointer<Composition>();
|
||||
aet.Video = s.ReadCountPointer<Video >();
|
||||
aet.Audio = s.ReadCountPointer<Audio >();
|
||||
|
||||
if (aet.Camera.O > 0)
|
||||
{
|
||||
_IO.P = aet.Camera.O;
|
||||
aet.Camera.V.X.O = _IO.RI32();
|
||||
aet.Camera.V.Y.O = _IO.RI32();
|
||||
s.P = aet.Camera.O;
|
||||
aet.Camera.V.X.O = s.RI32();
|
||||
aet.Camera.V.Y.O = s.RI32();
|
||||
RKF(ref aet.Camera.V.X);
|
||||
RKF(ref aet.Camera.V.Y);
|
||||
}
|
||||
|
||||
if (aet.Audio.O > 0)
|
||||
{
|
||||
_IO.P = aet.Audio.O;
|
||||
s.P = aet.Audio.O;
|
||||
for (i = 0; i < aet.Audio.C; i++)
|
||||
{
|
||||
ref Audio aif = ref aet.Audio.E[i];
|
||||
aif.O = _IO.P;
|
||||
aif.SoundID = _IO.RU32();
|
||||
aif.O = s.P;
|
||||
aif.SoundID = s.RU32();
|
||||
}
|
||||
}
|
||||
|
||||
_IO.P = aet.Composition.O;
|
||||
s.P = aet.Composition.O;
|
||||
for (i = 0; i < aet.Composition.C; i++)
|
||||
aet.Composition[i] = new Composition() { P = _IO.P, C = _IO.RI32(), O = _IO.RI32()};
|
||||
aet.Composition[i] = new Composition() { P = s.P, C = s.RI32(), O = s.RI32()};
|
||||
|
||||
i1 = 0;
|
||||
RAL(ref aet.Composition.E[aet.Composition.C - 1]);
|
||||
for (i = 0; i < aet.Composition.C - 1; i++)
|
||||
RAL(ref aet.Composition.E[i]);
|
||||
|
||||
_IO.P = aet.Video.O;
|
||||
s.P = aet.Video.O;
|
||||
for (i = 0; i < aet.Video.C; i++)
|
||||
aet.Video[i] = new Video { O = _IO.P, Color = _IO.RU32(), Width = _IO.RU16(),
|
||||
Height = _IO.RU16(), Frames = _IO.RF32(), Identifiers = _IO.ReadCountPointer<Video.Identifier>() };
|
||||
aet.Video[i] = new Video { O = s.P, Color = s.RU32(), Width = s.RU16(),
|
||||
Height = s.RU16(), Frames = s.RF32(), Identifiers = s.ReadCountPointer<Video.Identifier>() };
|
||||
|
||||
for (i = 0; i < aet.Video.C; i++)
|
||||
{
|
||||
_IO.P = aet.Video[i].Identifiers.O;
|
||||
s.P = aet.Video[i].Identifiers.O;
|
||||
for (i0 = 0; i0 < aet.Video[i].Identifiers.C; i0++)
|
||||
aet.Video.E[i].Identifiers[i0] = new Video.Identifier { Name = _IO.RPS(), ID = _IO.RU32() };
|
||||
aet.Video.E[i].Identifiers[i0] = new Video.Identifier { Name = s.RPS(), ID = s.RU32() };
|
||||
}
|
||||
|
||||
for (i = 0; i < aet.Composition.C; i++)
|
||||
@@ -151,30 +151,30 @@ namespace KKdMainLib
|
||||
{
|
||||
ref Video region = ref aet.Video.E[i];
|
||||
if (region.Identifiers.C == 0) { region.Identifiers.O = 0; continue; }
|
||||
if (region.Identifiers.C > 1) _IO.A(0x20);
|
||||
region.Identifiers.O = _IO.P;
|
||||
for (i0 = 0; i0 < region.Identifiers.C; i0++) _IO.W(0L);
|
||||
if (region.Identifiers.C > 1) s.A(0x20);
|
||||
region.Identifiers.O = s.P;
|
||||
for (i0 = 0; i0 < region.Identifiers.C; i0++) s.W(0L);
|
||||
}
|
||||
|
||||
_IO.A(0x20);
|
||||
aet.Video.O = _IO.P;
|
||||
s.A(0x20);
|
||||
aet.Video.O = s.P;
|
||||
for (i = 0; i < aet.Video.C; i++)
|
||||
{
|
||||
ref Video region = ref aet.Video.E[i];
|
||||
region.O = _IO.P;
|
||||
_IO.W(region.Color );
|
||||
_IO.W(region.Width );
|
||||
_IO.W(region.Height );
|
||||
_IO.W(region.Frames );
|
||||
_IO.W(region.Identifiers);
|
||||
region.O = s.P;
|
||||
s.W(region.Color );
|
||||
s.W(region.Width );
|
||||
s.W(region.Height );
|
||||
s.W(region.Frames );
|
||||
s.W(region.Identifiers);
|
||||
}
|
||||
|
||||
_IO.A(0x20);
|
||||
aet.Composition.O = _IO.P;
|
||||
s.A(0x20);
|
||||
aet.Composition.O = s.P;
|
||||
for (i = 0; i < aet.Composition.C; i++)
|
||||
{
|
||||
aet.Composition.E[i].O = _IO.P;
|
||||
_IO.W(0L);
|
||||
aet.Composition.E[i].O = s.P;
|
||||
s.W(0L);
|
||||
}
|
||||
|
||||
for (i = 0; i < aet.Composition.C; i++)
|
||||
@@ -189,10 +189,10 @@ namespace KKdMainLib
|
||||
ref AudioData audio = ref obj.Audio.V;
|
||||
if (obj.Marker.C > 0)
|
||||
{
|
||||
if (obj.Marker.C > 3) _IO.A(0x20);
|
||||
obj.Marker.O = _IO.P;
|
||||
if (obj.Marker.C > 3) s.A(0x20);
|
||||
obj.Marker.O = s.P;
|
||||
for (i1 = 0; i1 < obj.Marker.C; i1++)
|
||||
_IO.W(0L);
|
||||
s.W(0L);
|
||||
}
|
||||
|
||||
if (obj.Video.V.Video3D.O > 0)
|
||||
@@ -221,10 +221,10 @@ namespace KKdMainLib
|
||||
|
||||
if (obj.Video.V.Video3D.O > 0)
|
||||
{
|
||||
_IO.A(0x20);
|
||||
video.Video3D.O = _IO.P;
|
||||
_IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L);
|
||||
_IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L);
|
||||
s.A(0x20);
|
||||
video.Video3D.O = s.P;
|
||||
s.W(0L); s.W(0L); s.W(0L); s.W(0L);
|
||||
s.W(0L); s.W(0L); s.W(0L); s.W(0L);
|
||||
}
|
||||
|
||||
if (obj.Audio.O > 0)
|
||||
@@ -237,52 +237,52 @@ namespace KKdMainLib
|
||||
|
||||
if (obj.Video.O > 0)
|
||||
{
|
||||
_IO.A(0x20);
|
||||
obj.Video.O = _IO.P;
|
||||
_IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L);
|
||||
_IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L);
|
||||
s.A(0x20);
|
||||
obj.Video.O = s.P;
|
||||
s.W(0L); s.W(0L); s.W(0L); s.W(0L);
|
||||
s.W(0L); s.W(0L); s.W(0L); s.W(0L); s.W(0L);
|
||||
}
|
||||
|
||||
if (obj.Audio.O > 0)
|
||||
{
|
||||
_IO.A(0x20);
|
||||
obj.Audio.O = _IO.P;
|
||||
_IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L);
|
||||
s.A(0x20);
|
||||
obj.Audio.O = s.P;
|
||||
s.W(0L); s.W(0L); s.W(0L); s.W(0L);
|
||||
}
|
||||
}
|
||||
|
||||
_IO.A(0x20);
|
||||
aet.Composition.E[i].E[0].Offset = _IO.P;
|
||||
s.A(0x20);
|
||||
aet.Composition.E[i].E[0].Offset = s.P;
|
||||
for (i0 = 0; i0 < aet.Composition.E[i].C; i0++)
|
||||
{
|
||||
ref Layer obj = ref aet.Composition.E[i].E[i0];
|
||||
obj.Offset = _IO.P;
|
||||
_IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L);
|
||||
obj.Offset = s.P;
|
||||
s.W(0L); s.W(0L); s.W(0L); s.W(0L); s.W(0L); s.W(0L);
|
||||
}
|
||||
}
|
||||
|
||||
if (aet.Camera.O > 0)
|
||||
{
|
||||
ref Vec2<CountPointer<KFT2>> pos = ref aet.Camera.V;
|
||||
_IO.A(0x10);
|
||||
s.A(0x10);
|
||||
W(ref pos.X);
|
||||
W(ref pos.Y);
|
||||
|
||||
_IO.A(0x20);
|
||||
aet.Camera.O = _IO.P;
|
||||
_IO.W(pos.X);
|
||||
_IO.W(pos.Y);
|
||||
s.A(0x20);
|
||||
aet.Camera.O = s.P;
|
||||
s.W(pos.X);
|
||||
s.W(pos.Y);
|
||||
|
||||
W(ref pos.X);
|
||||
W(ref pos.Y);
|
||||
}
|
||||
|
||||
_IO.A(0x20);
|
||||
aetData.O = _IO.P;
|
||||
_IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L);
|
||||
_IO.W(0L); _IO.W(0L); _IO.W(0L); _IO.W(0L);
|
||||
s.A(0x20);
|
||||
aetData.O = s.P;
|
||||
s.W(0L); s.W(0L); s.W(0L); s.W(0L);
|
||||
s.W(0L); s.W(0L); s.W(0L); s.W(0L);
|
||||
|
||||
_IO.A(0x10);
|
||||
s.A(0x10);
|
||||
{
|
||||
System.Collections.Generic.Dictionary<string, int> usedValues =
|
||||
new System.Collections.Generic.Dictionary<string, int>();
|
||||
@@ -309,20 +309,20 @@ namespace KKdMainLib
|
||||
}
|
||||
|
||||
//_IO.Align(0x4);
|
||||
aet.Name.O = _IO.P;
|
||||
_IO.W(aet.Name.V + x00);
|
||||
_IO.SL(_IO.P);
|
||||
aet.Name.O = s.P;
|
||||
s.W(aet.Name.V + x00);
|
||||
s.SL(s.P);
|
||||
}
|
||||
|
||||
aet.Audio.O = 0;
|
||||
if (aet.Audio.C > 0)
|
||||
{
|
||||
_IO.A(0x10);
|
||||
aet.Audio.O = _IO.P;
|
||||
s.A(0x10);
|
||||
aet.Audio.O = s.P;
|
||||
for (i = 0; i < aet.Audio.C; i++)
|
||||
{
|
||||
aet.Audio.E[i].O = _IO.P;
|
||||
_IO.W(aet.Audio[i].SoundID);
|
||||
aet.Audio.E[i].O = s.P;
|
||||
s.W(aet.Audio[i].SoundID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,11 +340,11 @@ namespace KKdMainLib
|
||||
}
|
||||
}
|
||||
|
||||
_IO.A(0x4);
|
||||
int returnPos = _IO.P;
|
||||
s.A(0x4);
|
||||
int returnPos = s.P;
|
||||
int nvp = 0;
|
||||
|
||||
_IO.F();
|
||||
s.F();
|
||||
|
||||
for (i = 0; i < aet.Composition.C; i++)
|
||||
{
|
||||
@@ -359,76 +359,77 @@ namespace KKdMainLib
|
||||
|
||||
if (obj.Video.V.Video3D.O > 0)
|
||||
{
|
||||
_IO.P = video.Video3D.O;
|
||||
W(ref _IO, ref video3DData. AnchorZ);
|
||||
W(ref _IO, ref video3DData. PositionZ);
|
||||
W(ref _IO, ref video3DData.DirectionX);
|
||||
W(ref _IO, ref video3DData.DirectionY);
|
||||
W(ref _IO, ref video3DData.DirectionZ);
|
||||
W(ref _IO, ref video3DData. RotationX);
|
||||
W(ref _IO, ref video3DData. RotationY);
|
||||
W(ref _IO, ref video3DData. ScaleZ);
|
||||
s.P = video.Video3D.O;
|
||||
W(ref s, ref video3DData. AnchorZ);
|
||||
W(ref s, ref video3DData. PositionZ);
|
||||
W(ref s, ref video3DData.DirectionX);
|
||||
W(ref s, ref video3DData.DirectionY);
|
||||
W(ref s, ref video3DData.DirectionZ);
|
||||
W(ref s, ref video3DData. RotationX);
|
||||
W(ref s, ref video3DData. RotationY);
|
||||
W(ref s, ref video3DData. ScaleZ);
|
||||
}
|
||||
|
||||
if (obj.Video.O > 0)
|
||||
{
|
||||
_IO.P = obj.Video.O;
|
||||
_IO.W((byte)video.TransferMode.BlendMode );
|
||||
_IO.W((byte)video.TransferMode.Flags );
|
||||
_IO.W((byte)video.TransferMode.TrackMatte);
|
||||
_IO.W((byte)0);
|
||||
s.P = obj.Video.O;
|
||||
s.W((byte)video.TransferMode.BlendMode );
|
||||
s.W((byte)video.TransferMode.Flags );
|
||||
s.W((byte)video.TransferMode.TrackMatte);
|
||||
s.W((byte)0);
|
||||
|
||||
W(ref _IO, ref video. AnchorX);
|
||||
W(ref _IO, ref video. AnchorY);
|
||||
W(ref _IO, ref video.PositionX);
|
||||
W(ref _IO, ref video.PositionY);
|
||||
W(ref _IO, ref video.Rotation );
|
||||
W(ref _IO, ref video. ScaleX);
|
||||
W(ref _IO, ref video. ScaleY);
|
||||
W(ref _IO, ref video. Opacity );
|
||||
_IO.W(video.Video3D.O);
|
||||
W(ref s, ref video. AnchorX);
|
||||
W(ref s, ref video. AnchorY);
|
||||
W(ref s, ref video.PositionX);
|
||||
W(ref s, ref video.PositionY);
|
||||
W(ref s, ref video.Rotation );
|
||||
W(ref s, ref video. ScaleX);
|
||||
W(ref s, ref video. ScaleY);
|
||||
W(ref s, ref video. Opacity );
|
||||
s.W(video.Video3D.O);
|
||||
}
|
||||
|
||||
if (obj.Audio.O > 0)
|
||||
{
|
||||
_IO.P = obj.Audio.O;
|
||||
W(ref _IO, ref audio.VolumeL);
|
||||
W(ref _IO, ref audio.VolumeR);
|
||||
W(ref _IO, ref audio. PanL);
|
||||
W(ref _IO, ref audio. PanR);
|
||||
s.P = obj.Audio.O;
|
||||
W(ref s, ref audio.VolumeL);
|
||||
W(ref s, ref audio.VolumeR);
|
||||
W(ref s, ref audio. PanL);
|
||||
W(ref s, ref audio. PanR);
|
||||
}
|
||||
|
||||
void W(ref Stream _IO, ref CountPointer<KFT2> keys)
|
||||
{
|
||||
if (keys.C < 1) _IO.W(0L);
|
||||
else { if (keys.C > 0 && keys.O == 0) { keys.O = returnPos + (nvp << 2); nvp++; } _IO.W(keys); }
|
||||
else { if (keys.C > 0 && keys.O == 0)
|
||||
{ keys.O = returnPos + (nvp << 2); nvp++; } _IO.W(keys); }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_IO.P = returnPos;
|
||||
s.P = returnPos;
|
||||
for (i = 0; i < nvp; i++)
|
||||
_IO.W(0);
|
||||
_IO.A(0x10, true);
|
||||
s.W(0);
|
||||
s.A(0x10, true);
|
||||
|
||||
_IO.F();
|
||||
s.F();
|
||||
|
||||
for (i = 0; i < aet.Composition.C; i++)
|
||||
for (i0 = 0; i0 < aet.Composition.E[i].C; i0++)
|
||||
{
|
||||
ref Layer obj = ref aet.Composition.E[i].E[i0];
|
||||
|
||||
_IO.P = obj.Offset;
|
||||
_IO.W(obj.Name.O);
|
||||
_IO.W(obj.StartFrame);
|
||||
_IO.W(obj.EndFrame);
|
||||
_IO.W(obj.OffsetFrame);
|
||||
_IO.W(obj.TimeScale);
|
||||
_IO.W((ushort)obj.Flags );
|
||||
_IO.W(( byte)obj.Quality);
|
||||
_IO.W(( byte)obj.Type );
|
||||
_IO.W(obj.VidItmOff);
|
||||
s.P = obj.Offset;
|
||||
s.W(obj.Name.O);
|
||||
s.W(obj.StartFrame);
|
||||
s.W(obj.EndFrame);
|
||||
s.W(obj.OffsetFrame);
|
||||
s.W(obj.TimeScale);
|
||||
s.W((ushort)obj.Flags );
|
||||
s.W(( byte)obj.Quality);
|
||||
s.W(( byte)obj.Type );
|
||||
s.W(obj.VidItmOff);
|
||||
|
||||
if (obj.ParentLayer > -1)
|
||||
{
|
||||
@@ -436,61 +437,61 @@ namespace KKdMainLib
|
||||
for (i1 = 0; i1 < aet.Composition.C; i1++)
|
||||
for (i2 = 0; i2 < aet.Composition.E[i1].C; i2++)
|
||||
if (aet.Composition[i1].E[i2].ID == obj.ParentLayer)
|
||||
{ Found = true; _IO.W(aet.Composition.E[i1].E[i2].Offset); break; }
|
||||
if (!Found) _IO.W(0);
|
||||
{ Found = true; s.W(aet.Composition.E[i1].E[i2].Offset); break; }
|
||||
if (!Found) s.W(0);
|
||||
}
|
||||
else _IO.W(0);
|
||||
_IO.W(obj.Marker);
|
||||
_IO.W(obj.Video.O);
|
||||
_IO.W(obj.Audio.O);
|
||||
else s.W(0);
|
||||
s.W(obj.Marker);
|
||||
s.W(obj.Video.O);
|
||||
s.W(obj.Audio.O);
|
||||
|
||||
ref CountPointer<Marker> Marker = ref obj.Marker;
|
||||
_IO.P = Marker.O;
|
||||
s.P = Marker.O;
|
||||
for (i1 = 0; i1 < Marker.C; i1++)
|
||||
{
|
||||
_IO.W(Marker[i1].Frame);
|
||||
_IO.W(Marker[i1].Name.O);
|
||||
s.W(Marker[i1].Frame);
|
||||
s.W(Marker[i1].Name.O);
|
||||
}
|
||||
}
|
||||
|
||||
_IO.F();
|
||||
s.F();
|
||||
|
||||
for (i = 0; i < aet.Video.C; i++)
|
||||
{
|
||||
ref Video region = ref aet.Video.E[i];
|
||||
if (region.Identifiers.C == 0) continue;
|
||||
_IO.P = region.Identifiers.O;
|
||||
s.P = region.Identifiers.O;
|
||||
for (i0 = 0; i0 < region.Identifiers.C; i0++)
|
||||
{
|
||||
_IO.W(region.Identifiers[i0].Name.O);
|
||||
_IO.W(region.Identifiers[i0].ID);
|
||||
s.W(region.Identifiers[i0].Name.O);
|
||||
s.W(region.Identifiers[i0].ID);
|
||||
}
|
||||
}
|
||||
|
||||
_IO.P = aet.Composition.O;
|
||||
s.P = aet.Composition.O;
|
||||
for (i = 0; i < aet.Composition.C; i++)
|
||||
{
|
||||
if (aet.Composition[i].C > 0)
|
||||
{
|
||||
_IO.W(aet.Composition[i].C);
|
||||
_IO.W(aet.Composition[i].E[0].Offset);
|
||||
s.W(aet.Composition[i].C);
|
||||
s.W(aet.Composition[i].E[0].Offset);
|
||||
}
|
||||
else _IO.W(0L);
|
||||
else s.W(0L);
|
||||
}
|
||||
|
||||
_IO.P = aetData.O;
|
||||
_IO.W(aet.Name.O);
|
||||
_IO.W(aet.StartFrame);
|
||||
_IO.W(aet.EndFrame);
|
||||
_IO.W(aet.FrameRate);
|
||||
_IO.W(aet.BackColor);
|
||||
_IO.W(aet.Width);
|
||||
_IO.W(aet.Height);
|
||||
_IO.W(aet.Camera.O);
|
||||
_IO.W(aet.Composition);
|
||||
_IO.W(aet.Video);
|
||||
_IO.W(aet.Audio);
|
||||
_IO.W(0L);
|
||||
s.P = aetData.O;
|
||||
s.W(aet.Name.O);
|
||||
s.W(aet.StartFrame);
|
||||
s.W(aet.EndFrame);
|
||||
s.W(aet.FrameRate);
|
||||
s.W(aet.BackColor);
|
||||
s.W(aet.Width);
|
||||
s.W(aet.Height);
|
||||
s.W(aet.Camera.O);
|
||||
s.W(aet.Composition);
|
||||
s.W(aet.Video);
|
||||
s.W(aet.Audio);
|
||||
s.W(0L);
|
||||
}
|
||||
|
||||
private void RAL(ref Composition layer)
|
||||
@@ -499,38 +500,38 @@ namespace KKdMainLib
|
||||
{
|
||||
layer.E[i0].ID = i1;
|
||||
ref Layer obj = ref layer.E[i0];
|
||||
_IO.P = obj.Offset = layer.O + i0 * 0x30;
|
||||
obj.Name = _IO.RPS();
|
||||
obj.StartFrame = _IO.RF32();
|
||||
obj. EndFrame = _IO.RF32();
|
||||
obj.OffsetFrame = _IO.RF32();
|
||||
obj.TimeScale = _IO.RF32();
|
||||
obj.Flags = (Layer.AetLayerFlags )_IO.RU16();
|
||||
obj.Quality = (Layer.AetLayerQuality)_IO.RU8 ();
|
||||
obj.Type = (Layer.AetLayerType )_IO.RU8 ();
|
||||
obj.VidItmOff = _IO.RI32();
|
||||
obj.ParentLayer = _IO.RI32();
|
||||
obj.Marker = _IO.ReadCountPointer<Marker>();
|
||||
obj.Video = _IO.RP<VideoData>();
|
||||
obj.Audio = _IO.RP<AudioData>();
|
||||
s.P = obj.Offset = layer.O + i0 * 0x30;
|
||||
obj.Name = s.RPS();
|
||||
obj.StartFrame = s.RF32();
|
||||
obj. EndFrame = s.RF32();
|
||||
obj.OffsetFrame = s.RF32();
|
||||
obj.TimeScale = s.RF32();
|
||||
obj.Flags = (Layer.AetLayerFlags )s.RU16();
|
||||
obj.Quality = (Layer.AetLayerQuality)s.RU8 ();
|
||||
obj.Type = (Layer.AetLayerType )s.RU8 ();
|
||||
obj.VidItmOff = s.RI32();
|
||||
obj.ParentLayer = s.RI32();
|
||||
obj.Marker = s.ReadCountPointer<Marker>();
|
||||
obj.Video = s.RP<VideoData>();
|
||||
obj.Audio = s.RP<AudioData>();
|
||||
|
||||
if (obj.Video.O > 0)
|
||||
{
|
||||
ref VideoData video = ref obj.Video.V;
|
||||
_IO.P = obj.Video.O;
|
||||
video.TransferMode.BlendMode = (VideoData.VideoTransferMode.TransferBlendMode )_IO.RU8();
|
||||
video.TransferMode.Flags = (VideoData.VideoTransferMode.TransferFlags )_IO.RU8();
|
||||
video.TransferMode.TrackMatte = (VideoData.VideoTransferMode.TransferTrackMatte)_IO.RU8();
|
||||
video.Padding = _IO.RU8();
|
||||
video. AnchorX = _IO.ReadCountPointer<KFT2>();
|
||||
video. AnchorY = _IO.ReadCountPointer<KFT2>();
|
||||
video.PositionX = _IO.ReadCountPointer<KFT2>();
|
||||
video.PositionY = _IO.ReadCountPointer<KFT2>();
|
||||
video.Rotation = _IO.ReadCountPointer<KFT2>();
|
||||
video. ScaleX = _IO.ReadCountPointer<KFT2>();
|
||||
video. ScaleY = _IO.ReadCountPointer<KFT2>();
|
||||
video.Opacity = _IO.ReadCountPointer<KFT2>();
|
||||
video.Video3D = _IO.RP<VideoData.Video3DData>();
|
||||
s.P = obj.Video.O;
|
||||
video.TransferMode.BlendMode = (VideoData.VideoTransferMode.TransferBlendMode )s.RU8();
|
||||
video.TransferMode.Flags = (VideoData.VideoTransferMode.TransferFlags )s.RU8();
|
||||
video.TransferMode.TrackMatte = (VideoData.VideoTransferMode.TransferTrackMatte)s.RU8();
|
||||
video.Padding = s.RU8();
|
||||
video. AnchorX = s.ReadCountPointer<KFT2>();
|
||||
video. AnchorY = s.ReadCountPointer<KFT2>();
|
||||
video.PositionX = s.ReadCountPointer<KFT2>();
|
||||
video.PositionY = s.ReadCountPointer<KFT2>();
|
||||
video.Rotation = s.ReadCountPointer<KFT2>();
|
||||
video. ScaleX = s.ReadCountPointer<KFT2>();
|
||||
video. ScaleY = s.ReadCountPointer<KFT2>();
|
||||
video.Opacity = s.ReadCountPointer<KFT2>();
|
||||
video.Video3D = s.RP<VideoData.Video3DData>();
|
||||
|
||||
RKF(ref video. AnchorX);
|
||||
RKF(ref video. AnchorY);
|
||||
@@ -544,15 +545,15 @@ namespace KKdMainLib
|
||||
if (video.Video3D.O > 0)
|
||||
{
|
||||
ref VideoData.Video3DData video3DData = ref video.Video3D.V;
|
||||
_IO.P = video.Video3D.O;
|
||||
video3DData. AnchorZ = _IO.ReadCountPointer<KFT2>();
|
||||
video3DData. PositionZ = _IO.ReadCountPointer<KFT2>();
|
||||
video3DData.DirectionX = _IO.ReadCountPointer<KFT2>();
|
||||
video3DData.DirectionY = _IO.ReadCountPointer<KFT2>();
|
||||
video3DData.DirectionZ = _IO.ReadCountPointer<KFT2>();
|
||||
video3DData. RotationX = _IO.ReadCountPointer<KFT2>();
|
||||
video3DData. RotationY = _IO.ReadCountPointer<KFT2>();
|
||||
video3DData. ScaleZ = _IO.ReadCountPointer<KFT2>();
|
||||
s.P = video.Video3D.O;
|
||||
video3DData. AnchorZ = s.ReadCountPointer<KFT2>();
|
||||
video3DData. PositionZ = s.ReadCountPointer<KFT2>();
|
||||
video3DData.DirectionX = s.ReadCountPointer<KFT2>();
|
||||
video3DData.DirectionY = s.ReadCountPointer<KFT2>();
|
||||
video3DData.DirectionZ = s.ReadCountPointer<KFT2>();
|
||||
video3DData. RotationX = s.ReadCountPointer<KFT2>();
|
||||
video3DData. RotationY = s.ReadCountPointer<KFT2>();
|
||||
video3DData. ScaleZ = s.ReadCountPointer<KFT2>();
|
||||
|
||||
RKF(ref video3DData. AnchorZ);
|
||||
RKF(ref video3DData. PositionZ);
|
||||
@@ -568,11 +569,11 @@ namespace KKdMainLib
|
||||
if (obj.Audio.O > 0)
|
||||
{
|
||||
ref AudioData audio = ref obj.Audio.V;
|
||||
_IO.P = obj.Audio.O;
|
||||
audio.VolumeL = _IO.ReadCountPointer<KFT2>();
|
||||
audio.VolumeR = _IO.ReadCountPointer<KFT2>();
|
||||
audio. PanL = _IO.ReadCountPointer<KFT2>();
|
||||
audio. PanR = _IO.ReadCountPointer<KFT2>();
|
||||
s.P = obj.Audio.O;
|
||||
audio.VolumeL = s.ReadCountPointer<KFT2>();
|
||||
audio.VolumeR = s.ReadCountPointer<KFT2>();
|
||||
audio. PanL = s.ReadCountPointer<KFT2>();
|
||||
audio. PanR = s.ReadCountPointer<KFT2>();
|
||||
|
||||
RKF(ref audio.VolumeL);
|
||||
RKF(ref audio.VolumeR);
|
||||
@@ -580,22 +581,22 @@ namespace KKdMainLib
|
||||
RKF(ref audio. PanR);
|
||||
}
|
||||
|
||||
_IO.P = obj.Marker.O;
|
||||
s.P = obj.Marker.O;
|
||||
for (i2 = 0; i2 < obj.Marker.C; i2++)
|
||||
obj.Marker[i2] = new Marker() { Frame = _IO.RF32(), Name = _IO.RPSSJIS() };
|
||||
obj.Marker[i2] = new Marker() { Frame = s.RF32(), Name = s.RPSSJIS() };
|
||||
}
|
||||
}
|
||||
|
||||
private void RKF(ref CountPointer<KFT2> keys)
|
||||
{
|
||||
if (keys.C < 1) return;
|
||||
_IO.P = keys.O;
|
||||
if (keys.C == 1) { keys.E[0].V = _IO.RF32(); return; }
|
||||
s.P = keys.O;
|
||||
if (keys.C == 1) { keys.E[0].V = s.RF32(); return; }
|
||||
|
||||
keys.E = new KFT2[keys.C];
|
||||
for (uint i = 0; i < keys.C; i++) keys.E[i].F = _IO.RF32();
|
||||
for (uint i = 0; i < keys.C; i++) keys.E[i].F = s.RF32();
|
||||
for (uint i = 0; i < keys.C; i++)
|
||||
{ keys.E[i].V = _IO.RF32(); keys.E[i].T = _IO.RF32(); }
|
||||
{ keys.E[i].V = s.RF32(); keys.E[i].T = s.RF32(); }
|
||||
}
|
||||
|
||||
private void W(ref CountPointer<KFT2> keys)
|
||||
@@ -604,22 +605,22 @@ namespace KKdMainLib
|
||||
if (keys.C < 1) return;
|
||||
if (keys.C == 1)
|
||||
{
|
||||
if (keys.E[0].V != 0) { keys.O = _IO.P; _IO.W(keys.E[0].V); }
|
||||
if (keys.E[0].V != 0) { keys.O = s.P; s.W(keys.E[0].V); }
|
||||
return;
|
||||
}
|
||||
|
||||
if (keys.C > 2) _IO.A(0x20);
|
||||
keys.O = _IO.P;
|
||||
if (keys.C > 2) s.A(0x20);
|
||||
keys.O = s.P;
|
||||
|
||||
for (uint i = 0; i < keys.C; i++) _IO.W(keys.E[i].F);
|
||||
for (uint i = 0; i < keys.C; i++) s.W(keys.E[i].F);
|
||||
for (uint i = 0; i < keys.C; i++)
|
||||
{ _IO.W(keys.E[i].V); _IO.W(keys.E[i].T); }
|
||||
{ s.W(keys.E[i].V); s.W(keys.E[i].T); }
|
||||
}
|
||||
|
||||
private void WPS(ref System.Collections.Generic.Dictionary<string, int> dict, ref Pointer<string> str)
|
||||
{
|
||||
if (dict.ContainsKey(str.V)) str.O = dict[str.V];
|
||||
else { str.O = _IO.P; dict.Add(str.V, str.O); _IO.WPSSJIS(str.V + "\0"); }
|
||||
else { str.O = s.P; dict.Add(str.V, str.O); s.WPSSJIS(str.V + "\0"); }
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool json)
|
||||
@@ -690,14 +691,14 @@ namespace KKdMainLib
|
||||
region.Height = temp[i].RU16("Height");
|
||||
region.Frames = temp[i].RF32("Frames");
|
||||
|
||||
using (MsgPack identifiers = temp[i]["Identifiers", true])
|
||||
if (identifiers.NotNull)
|
||||
{
|
||||
region.Identifiers.C = identifiers.Array.Length;
|
||||
for (i0 = 0; i0 < region.Identifiers.C; i0++)
|
||||
region.Identifiers[i0] = new Video.Identifier() { Name = new Pointer<string>()
|
||||
{ V = identifiers[i0].RS("Name") }, ID = identifiers[i0].RU32("ID") };
|
||||
}
|
||||
MsgPack identifiers = temp[i]["Identifiers", true];
|
||||
if (identifiers.NotNull)
|
||||
{
|
||||
region.Identifiers.C = identifiers.Array.Length;
|
||||
for (i0 = 0; i0 < region.Identifiers.C; i0++)
|
||||
region.Identifiers[i0] = new Video.Identifier() { Name = new Pointer<string>()
|
||||
{ V = identifiers[i0].RS("Name") }, ID = identifiers[i0].RU32("ID") };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -708,13 +709,13 @@ namespace KKdMainLib
|
||||
{
|
||||
ref Composition l = ref aet.Composition.E[i];
|
||||
l = default;
|
||||
using (MsgPack layer = temp[i]["Layer", true])
|
||||
if (layer.NotNull)
|
||||
{
|
||||
l.C = layer.Array.Length;
|
||||
for (i0 = 0; i0 < l.C; i0++)
|
||||
RL(ref l.E[i0], layer[i0]);
|
||||
}
|
||||
MsgPack layer = temp[i]["Layer", true];
|
||||
if (layer.NotNull)
|
||||
{
|
||||
l.C = layer.Array.Length;
|
||||
for (i0 = 0; i0 < l.C; i0++)
|
||||
RL(ref l.E[i0], layer[i0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else aet.Composition.C = 1;
|
||||
@@ -782,7 +783,8 @@ namespace KKdMainLib
|
||||
entry.Add("Frames", v.Frames);
|
||||
MsgPack identifiers = new MsgPack(v.Identifiers.C, "Identifiers");
|
||||
for (i0 = 0; i0 < v.Identifiers.C; i0++)
|
||||
identifiers[i0] = MsgPack.New.Add("Name", v.Identifiers[i0].Name.V).Add("ID", v.Identifiers[i0].ID);
|
||||
identifiers[i0] = MsgPack.New.Add("Name", v.Identifiers[i0].Name.V)
|
||||
.Add("ID" , v.Identifiers[i0].ID);
|
||||
entry.Add(identifiers);
|
||||
}
|
||||
video[i] = entry;
|
||||
@@ -979,6 +981,6 @@ namespace KKdMainLib
|
||||
|
||||
private bool disposed;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; AET = default; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; AET = default; disposed = true; } }
|
||||
}
|
||||
}
|
||||
|
||||
+77
-77
@@ -1,6 +1,5 @@
|
||||
//Original: https://github.com/blueskythlikesclouds/MikuMikuLibrary/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using KKdBaseLib;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
@@ -9,39 +8,39 @@ namespace KKdMainLib.DB
|
||||
public class Aet : System.IDisposable
|
||||
{
|
||||
private int i, i0, i1, i2;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
|
||||
public AetSet[] AetSets;
|
||||
|
||||
public void BINReader(string file)
|
||||
{
|
||||
_IO = File.OpenReader(file + ".bin");
|
||||
s = File.OpenReader(file + ".bin");
|
||||
|
||||
int aetSetsLength = _IO.RI32();
|
||||
int aetSetsOffset = _IO.RI32();
|
||||
int aetsLength = _IO.RI32();
|
||||
int aetsOffset = _IO.RI32();
|
||||
int aetSetsLength = s.RI32();
|
||||
int aetSetsOffset = s.RI32();
|
||||
int aetsLength = s.RI32();
|
||||
int aetsOffset = s.RI32();
|
||||
|
||||
_IO.P = aetSetsOffset;
|
||||
s.P = aetSetsOffset;
|
||||
AetSets = new AetSet[aetSetsLength];
|
||||
for (i = 0; i < aetSetsLength; i++)
|
||||
{
|
||||
AetSets[i].Id = _IO.RI32();
|
||||
AetSets[i].Name = _IO.RSaO();
|
||||
AetSets[i].FileName = _IO.RSaO();
|
||||
_IO.RI32();
|
||||
AetSets[i].SpriteSetId = _IO.RI32();
|
||||
AetSets[i].Id = s.RI32();
|
||||
AetSets[i].Name = s.RSaO();
|
||||
AetSets[i].FileName = s.RSaO();
|
||||
s.RI32();
|
||||
AetSets[i].SpriteSetId = s.RI32();
|
||||
}
|
||||
|
||||
int setIndex;
|
||||
AET aet = new AET();
|
||||
int[] AetCount = new int[aetSetsLength];
|
||||
|
||||
_IO.P = aetsOffset;
|
||||
s.P = aetsOffset;
|
||||
for (i = 0; i < aetsLength; i++)
|
||||
{
|
||||
_IO.PI64 += 10;
|
||||
setIndex = _IO.RI16();
|
||||
s.PI64 += 10;
|
||||
setIndex = s.RI16();
|
||||
AetCount[setIndex]++;
|
||||
}
|
||||
|
||||
@@ -51,18 +50,18 @@ namespace KKdMainLib.DB
|
||||
AetCount[i] = 0;
|
||||
}
|
||||
|
||||
_IO.P = aetsOffset;
|
||||
s.P = aetsOffset;
|
||||
for (i = 0; i < aetsLength; i++)
|
||||
{
|
||||
aet.Id = _IO.RI32();
|
||||
aet.Name = _IO.RSaO();
|
||||
_IO.RI16();
|
||||
setIndex = _IO.RI16();
|
||||
aet.Id = s.RI32();
|
||||
aet.Name = s.RSaO();
|
||||
s.RI16();
|
||||
setIndex = s.RI16();
|
||||
|
||||
AetSets[setIndex].Aets[AetCount[setIndex]] = aet; AetCount[setIndex]++;
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
|
||||
@@ -71,13 +70,13 @@ namespace KKdMainLib.DB
|
||||
if (AetSets == null) return;
|
||||
if (AetSets.Length == 0) return;
|
||||
|
||||
List<string> SetName = new List<string>();
|
||||
List<string> SetFileName = new List<string>();
|
||||
KKdList<string> setName = KKdList<string>.New;
|
||||
KKdList<string> setFileName = KKdList<string>.New;
|
||||
|
||||
List<int> Ids = new List<int>();
|
||||
List<int> SetIds = new List<int>();
|
||||
KKdList<int> ids = KKdList<int>.New;
|
||||
KKdList<int> setIds = KKdList<int>.New;
|
||||
|
||||
List<int> NotAdd = new List<int>();
|
||||
KKdList<int> notAdd = KKdList<int>.New;
|
||||
AET temp;
|
||||
AetSet set;
|
||||
|
||||
@@ -85,11 +84,11 @@ namespace KKdMainLib.DB
|
||||
{
|
||||
set = AetSets[i];
|
||||
if (set. Name != null)
|
||||
if (SetName .Contains(set. Name)) { NotAdd.Add(i); continue; }
|
||||
else SetName .Add (set. Name);
|
||||
if (setName .Contains(set. Name)) { notAdd.Add(i); continue; }
|
||||
else setName .Add (set. Name);
|
||||
if (set.FileName != null)
|
||||
if (SetFileName.Contains(set.FileName)) { NotAdd.Add(i); continue; }
|
||||
else SetFileName.Add (set.FileName);
|
||||
if (setFileName.Contains(set.FileName)) { notAdd.Add(i); continue; }
|
||||
else setFileName.Add (set.FileName);
|
||||
|
||||
if (set.NewId)
|
||||
{
|
||||
@@ -99,93 +98,94 @@ namespace KKdMainLib.DB
|
||||
}
|
||||
|
||||
if (set.Id != null)
|
||||
if (SetIds.Contains((int)set.Id)) { NotAdd.Add(i); continue; }
|
||||
else SetIds.Add ((int)set.Id);
|
||||
if (setIds.Contains((int)set.Id)) { notAdd.Add(i); continue; }
|
||||
else setIds.Add ((int)set.Id);
|
||||
|
||||
for (i0 = 0; i0 < set.Aets.Length; i0++)
|
||||
{
|
||||
temp = set.Aets[i0];
|
||||
if (temp.Id != null)
|
||||
if ( Ids.Contains((int)temp.Id)) { NotAdd.Add(i); break; }
|
||||
else Ids.Add ((int)temp.Id);
|
||||
if ( ids.Contains((int)temp.Id)) { notAdd.Add(i); break; }
|
||||
else ids.Add ((int)temp.Id);
|
||||
}
|
||||
}
|
||||
SetName = null;
|
||||
SetFileName = null;
|
||||
setName .Dispose();
|
||||
setFileName.Dispose();
|
||||
|
||||
for (i = 0; i < AetSets.Length; i++)
|
||||
{
|
||||
set = AetSets[i];
|
||||
if (NotAdd.Contains(i)) continue;
|
||||
if (notAdd.Contains(i)) continue;
|
||||
if (!set.NewId) continue;
|
||||
|
||||
i1 = 0;
|
||||
if (set.Id == null) while (true)
|
||||
{ if (!SetIds.Contains(i1)) { AetSets[i].Id = i1; SetIds.Add(i1); break; } i1++; }
|
||||
{ if (!setIds.Contains(i1)) { AetSets[i].Id = i1; setIds.Add(i1); break; } i1++; }
|
||||
|
||||
for (i0 = 0, i1 = 0; i0 < set.Aets.Length; i0++)
|
||||
if (set.Aets[i0].Id == null) while (true) { if (!Ids.Contains(i1))
|
||||
{ AetSets[i].Aets[i0].Id = i1; Ids.Add(i1); break; } i1++; }
|
||||
if (set.Aets[i0].Id == null) while (true) { if (!ids.Contains(i1))
|
||||
{ AetSets[i].Aets[i0].Id = i1; ids.Add(i1); break; } i1++; }
|
||||
}
|
||||
|
||||
Ids = null;
|
||||
SetIds = null;
|
||||
ids.Dispose();
|
||||
setIds.Dispose();
|
||||
|
||||
for (i = 0, i0 = 0, i2 = 0; i < AetSets.Length; i++)
|
||||
if (!NotAdd.Contains(i)) { i0 += AetSets[i].Aets.Length; i2++; }
|
||||
if (!notAdd.Contains(i)) { i0 += AetSets[i].Aets.Length; i2++; }
|
||||
|
||||
i1 = i0 * 12;
|
||||
i1 = i1.A(0x20) + 0x20;
|
||||
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
_IO.W(i2);
|
||||
_IO.W(i1);
|
||||
_IO.W(i0);
|
||||
_IO.W(0x20);
|
||||
_IO.W(0x9066906690669066);
|
||||
_IO.W(0x9066906690669066);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
s.W(i2);
|
||||
s.W(i1);
|
||||
s.W(i0);
|
||||
s.W(0x20);
|
||||
s.W(0x9066906690669066);
|
||||
s.W(0x9066906690669066);
|
||||
|
||||
_IO.P = (i1 + i2 * 0x14).A(0x20);
|
||||
s.P = (i1 + i2 * 0x14).A(0x20);
|
||||
for (i = 0; i < AetSets.Length; i++)
|
||||
{
|
||||
if (NotAdd.Contains(i)) continue;
|
||||
AetSets[i]. NameOffset = _IO.P; _IO.W(AetSets[i]. Name + "\0");
|
||||
AetSets[i].FileNameOffset = _IO.P; _IO.W(AetSets[i].FileName + "\0");
|
||||
if (notAdd.Contains(i)) continue;
|
||||
AetSets[i]. NameOffset = s.P; s.W(AetSets[i]. Name + "\0");
|
||||
AetSets[i].FileNameOffset = s.P; s.W(AetSets[i].FileName + "\0");
|
||||
}
|
||||
|
||||
for (i = 0; i < AetSets.Length; i++)
|
||||
{
|
||||
if (NotAdd.Contains(i)) continue;
|
||||
if (notAdd.Contains(i)) continue;
|
||||
for (i0 = 0; i0 < AetSets[i].Aets.Length; i0++)
|
||||
{ AetSets[i].Aets[i0].NameOffset = _IO.P; _IO.W(AetSets[i].Aets[i0].Name + "\0"); }
|
||||
{ AetSets[i].Aets[i0].NameOffset = s.P; s.W(AetSets[i].Aets[i0].Name + "\0"); }
|
||||
}
|
||||
_IO.A(0x08, true);
|
||||
s.A(0x08, true);
|
||||
|
||||
_IO.P = 0x20;
|
||||
s.P = 0x20;
|
||||
for (i = 0, i2 = 0; i < AetSets.Length; i++)
|
||||
{
|
||||
if (NotAdd.Contains(i)) { i2++; continue; }
|
||||
if (notAdd.Contains(i)) { i2++; continue; }
|
||||
|
||||
for (i0 = 0; i0 < AetSets[i].Aets.Length; i0++)
|
||||
{
|
||||
_IO.W(AetSets[i].Aets[i0].Id );
|
||||
_IO.W(AetSets[i].Aets[i0].NameOffset);
|
||||
_IO.W((ushort) i0 );
|
||||
_IO.W((ushort)(i - i2));
|
||||
s.W(AetSets[i].Aets[i0].Id );
|
||||
s.W(AetSets[i].Aets[i0].NameOffset);
|
||||
s.W((ushort) i0 );
|
||||
s.W((ushort)(i - i2));
|
||||
}
|
||||
}
|
||||
_IO.A(0x20);
|
||||
s.A(0x20);
|
||||
|
||||
for (i = 0, i2 = 0; i < AetSets.Length; i++)
|
||||
{
|
||||
if (NotAdd.Contains(i)) { i2++; continue; }
|
||||
if (notAdd.Contains(i)) { i2++; continue; }
|
||||
|
||||
_IO.W(AetSets[i].Id );
|
||||
_IO.W(AetSets[i]. NameOffset);
|
||||
_IO.W(AetSets[i].FileNameOffset);
|
||||
_IO.W(i - i2);
|
||||
_IO.W(AetSets[i].SpriteSetId );
|
||||
s.W(AetSets[i].Id );
|
||||
s.W(AetSets[i]. NameOffset);
|
||||
s.W(AetSets[i].FileNameOffset);
|
||||
s.W(i - i2);
|
||||
s.W(AetSets[i].SpriteSetId );
|
||||
}
|
||||
_IO.C();
|
||||
notAdd.Dispose();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool json)
|
||||
@@ -218,7 +218,7 @@ namespace KKdMainLib.DB
|
||||
|
||||
private bool disposed = false;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; AetSets = null; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; AetSets = null; disposed = true; } }
|
||||
|
||||
public struct AET
|
||||
{
|
||||
@@ -246,10 +246,10 @@ namespace KKdMainLib.DB
|
||||
|
||||
public void ReadMsgPack(MsgPack msg)
|
||||
{
|
||||
FileName = msg.RS ("FileName" );
|
||||
FileName = msg.RS ("FileName" );
|
||||
Id = msg.RnU16( "Id");
|
||||
Name = msg.RS ( "Name" );
|
||||
NewId = msg.RB("NewId" );
|
||||
Name = msg.RS ( "Name" );
|
||||
NewId = msg.RB ("NewId" );
|
||||
SpriteSetId = msg.RnU16("SpriteSetId");
|
||||
|
||||
MsgPack Temp;
|
||||
|
||||
+20
-20
@@ -8,7 +8,7 @@ namespace KKdMainLib.DB
|
||||
public class Auth : IDisposable
|
||||
{
|
||||
private int i;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
|
||||
public string[] Category;
|
||||
public UID[] UIDs;
|
||||
@@ -17,16 +17,16 @@ namespace KKdMainLib.DB
|
||||
{
|
||||
A3DADict dict = new A3DADict();
|
||||
|
||||
_IO = File.OpenReader(file + ".bin");
|
||||
s = File.OpenReader(file + ".bin");
|
||||
|
||||
_IO.Format = Format.F;
|
||||
int signature = _IO.RI32();
|
||||
s.Format = Format.F;
|
||||
int signature = s.RI32();
|
||||
if (signature != 0x44334123) return;
|
||||
signature = _IO.RI32();
|
||||
signature = s.RI32();
|
||||
if (signature != 0x5F5F5F41) return;
|
||||
_IO.RI64();
|
||||
s.RI64();
|
||||
|
||||
string[] strData = _IO.RS(_IO.L - _IO.P).Replace("\r\n", "\n").Replace("\r", "\n").Split('\n');
|
||||
string[] strData = s.RS(s.L - s.P).Replace("\r\n", "\n").Replace("\r", "\n").Split('\n');
|
||||
for (i = 0; i < strData.Length; i++)
|
||||
dict.GD(strData[i]);
|
||||
strData = null;
|
||||
@@ -51,25 +51,25 @@ namespace KKdMainLib.DB
|
||||
}
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
dict.Clear();
|
||||
dict = null;
|
||||
}
|
||||
|
||||
public void BINWriter(string file)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
|
||||
_IO.W("#A3DA__________\n");
|
||||
_IO.W("#" + DateTime.UtcNow.ToString("ddd MMM dd HH:mm:ss yyyy",
|
||||
s.W("#A3DA__________\n");
|
||||
s.W("#" + DateTime.UtcNow.ToString("ddd MMM dd HH:mm:ss yyyy",
|
||||
System.Globalization.CultureInfo.InvariantCulture) + "\n");
|
||||
|
||||
if (Category != null)
|
||||
{
|
||||
int[] so = Category.Length.SW();
|
||||
for (i = 0; i < Category.Length; i++)
|
||||
_IO.W($"category.{so[i]}.value={ Category[so[i]]}\n");
|
||||
_IO.W($"category.length={Category.Length}\n");
|
||||
s.W($"category.{so[i]}.value={ Category[so[i]]}\n");
|
||||
s.W($"category.length={Category.Length}\n");
|
||||
}
|
||||
|
||||
if (UIDs != null)
|
||||
@@ -78,18 +78,18 @@ namespace KKdMainLib.DB
|
||||
for (i = 0; i < UIDs.Length; i++)
|
||||
{
|
||||
if (UIDs[so[i]].Category != null && UIDs[so[i]].Category != "")
|
||||
_IO.W($"uid.{so[i]}.category=" + UIDs[so[i]].Category + "\n");
|
||||
s.W($"uid.{so[i]}.category=" + UIDs[so[i]].Category + "\n");
|
||||
if (UIDs[so[i]].OrgUid != null)
|
||||
_IO.W($"uid.{so[i]}.org_uid=" + UIDs[so[i]].OrgUid + "\n");
|
||||
s.W($"uid.{so[i]}.org_uid=" + UIDs[so[i]].OrgUid + "\n");
|
||||
if (UIDs[so[i]].Size != null)
|
||||
_IO.W($"uid.{so[i]}.size=" + UIDs[so[i]].Size + "\n");
|
||||
s.W($"uid.{so[i]}.size=" + UIDs[so[i]].Size + "\n");
|
||||
if (UIDs[so[i]].Value != null && UIDs[so[i]].Value != "")
|
||||
_IO.W($"uid.{so[i]}.value=" + UIDs[so[i]].Value + "\n");
|
||||
s.W($"uid.{so[i]}.value=" + UIDs[so[i]].Value + "\n");
|
||||
}
|
||||
_IO.W($"uid.length={UIDs.Length}\n");
|
||||
s.W($"uid.length={UIDs.Length}\n");
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool json)
|
||||
@@ -151,7 +151,7 @@ namespace KKdMainLib.DB
|
||||
|
||||
private bool disposed = false;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; Category = null; UIDs = null; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; Category = null; UIDs = null; disposed = true; } }
|
||||
|
||||
public struct UID
|
||||
{
|
||||
|
||||
+62
-65
@@ -1,6 +1,5 @@
|
||||
//Original: https://github.com/blueskythlikesclouds/MikuMikuLibrary/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using KKdBaseLib;
|
||||
using KKdMainLib.IO;
|
||||
|
||||
@@ -9,27 +8,27 @@ namespace KKdMainLib.DB
|
||||
public class Spr : System.IDisposable
|
||||
{
|
||||
private int i, i0, i1, i2;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
|
||||
public SpriteSet[] SpriteSets;
|
||||
|
||||
public void BINReader(string file)
|
||||
{
|
||||
_IO = File.OpenReader(file + ".bin");
|
||||
s = File.OpenReader(file + ".bin");
|
||||
|
||||
int spriteSetsLength = _IO.RI32();
|
||||
int spriteSetsOffset = _IO.RI32();
|
||||
int spritesLength = _IO.RI32();
|
||||
int spritesOffset = _IO.RI32();
|
||||
int spriteSetsLength = s.RI32();
|
||||
int spriteSetsOffset = s.RI32();
|
||||
int spritesLength = s.RI32();
|
||||
int spritesOffset = s.RI32();
|
||||
|
||||
_IO.P = spriteSetsOffset;
|
||||
s.P = spriteSetsOffset;
|
||||
SpriteSets = new SpriteSet[spriteSetsLength];
|
||||
for (i = 0; i < spriteSetsLength; i++)
|
||||
{
|
||||
SpriteSets[i].Id = _IO.RI32();
|
||||
SpriteSets[i].Name = _IO.RSaO();
|
||||
SpriteSets[i].FileName = _IO.RSaO();
|
||||
_IO.RI32();
|
||||
SpriteSets[i].Id = s.RI32();
|
||||
SpriteSets[i].Name = s.RSaO();
|
||||
SpriteSets[i].FileName = s.RSaO();
|
||||
s.RI32();
|
||||
}
|
||||
|
||||
int setIndex;
|
||||
@@ -38,11 +37,11 @@ namespace KKdMainLib.DB
|
||||
int[] sprCount = new int[spriteSetsLength];
|
||||
int[] texCount = new int[spriteSetsLength];
|
||||
|
||||
_IO.P = spritesOffset;
|
||||
s.P = spritesOffset;
|
||||
for (i = 0; i < spritesLength; i++)
|
||||
{
|
||||
_IO.PI64 += 10;
|
||||
setIndex = _IO.RI16();
|
||||
s.PI64 += 10;
|
||||
setIndex = s.RI16();
|
||||
isTexture = (setIndex & 0x1000) == 0x1000;
|
||||
setIndex &= 0xFFF;
|
||||
|
||||
@@ -59,13 +58,13 @@ namespace KKdMainLib.DB
|
||||
texCount[i] = 0;
|
||||
}
|
||||
|
||||
_IO.P = spritesOffset;
|
||||
s.P = spritesOffset;
|
||||
for (i = 0; i < spritesLength; i++)
|
||||
{
|
||||
st.Id = _IO.RI32();
|
||||
st.Name = _IO.RSaO();
|
||||
_IO.RI16();
|
||||
setIndex = _IO.RI16();
|
||||
st.Id = s.RI32();
|
||||
st.Name = s.RSaO();
|
||||
s.RI16();
|
||||
setIndex = s.RI16();
|
||||
isTexture = (setIndex & 0x1000) == 0x1000;
|
||||
setIndex &= 0xFFF;
|
||||
|
||||
@@ -73,7 +72,7 @@ namespace KKdMainLib.DB
|
||||
else { SpriteSets[setIndex]. Sprites[sprCount[setIndex]] = st; sprCount[setIndex]++; }
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void BINWriter(string file)
|
||||
@@ -81,13 +80,13 @@ namespace KKdMainLib.DB
|
||||
if (SpriteSets == null) return;
|
||||
if (SpriteSets.Length == 0) return;
|
||||
|
||||
List<string> setName = new List<string>();
|
||||
List<string> setFileName = new List<string>();
|
||||
KKdList<string> setName = KKdList<string>.New;
|
||||
KKdList<string> setFileName = KKdList<string>.New;
|
||||
|
||||
List<int> ids = new List<int>();
|
||||
List<int> setIds = new List<int>();
|
||||
KKdList<int> ids = KKdList<int>.New;
|
||||
KKdList<int> setIds = KKdList<int>.New;
|
||||
|
||||
List<int> notAdd = new List<int>();
|
||||
KKdList<int> notAdd = KKdList<int>.New;
|
||||
SpriteTexture temp;
|
||||
SpriteSet set;
|
||||
|
||||
@@ -130,8 +129,8 @@ namespace KKdMainLib.DB
|
||||
else ids.Add ((int)temp.Id);
|
||||
}
|
||||
}
|
||||
setName = null;
|
||||
setFileName = null;
|
||||
setName .Dispose();
|
||||
setFileName.Dispose();
|
||||
|
||||
for (i = 0; i < SpriteSets.Length; i++)
|
||||
{
|
||||
@@ -151,11 +150,8 @@ namespace KKdMainLib.DB
|
||||
while (set. Sprites[i0].Id == null)
|
||||
if (!ids.Contains(i1)) ids.Add((int)(SpriteSets[i]. Sprites[i0].Id = i1)); else i1++;
|
||||
}
|
||||
|
||||
ids = null;
|
||||
setIds = null;
|
||||
|
||||
|
||||
ids.Dispose();
|
||||
setIds.Dispose();
|
||||
|
||||
for (i = 0, i0 = 0, i2 = 0; i < SpriteSets.Length; i++)
|
||||
if (!notAdd.Contains(i)) { i0 += SpriteSets[i].Sprites.Length + SpriteSets[i].Textures.Length; i2++; }
|
||||
@@ -163,68 +159,69 @@ namespace KKdMainLib.DB
|
||||
i1 = i0 * 12;
|
||||
i1 = i1.A(0x20) + 0x20;
|
||||
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
_IO.W(i2);
|
||||
_IO.W(i1);
|
||||
_IO.W(i0);
|
||||
_IO.W(0x20);
|
||||
_IO.W(0x9066906690669066);
|
||||
_IO.W(0x9066906690669066);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
s.W(i2);
|
||||
s.W(i1);
|
||||
s.W(i0);
|
||||
s.W(0x20);
|
||||
s.W(0x9066906690669066);
|
||||
s.W(0x9066906690669066);
|
||||
|
||||
_IO.P = (i1 + i2 * 0x10).A(0x20);
|
||||
s.P = (i1 + i2 * 0x10).A(0x20);
|
||||
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.P;
|
||||
_IO.W(SpriteSets[i].Textures[i0].Name + "\0"); }
|
||||
{ SpriteSets[i].Textures[i0].NameOffset = s.P;
|
||||
s.W(SpriteSets[i].Textures[i0].Name + "\0"); }
|
||||
|
||||
for (i0 = 0; i0 < SpriteSets[i]. Sprites.Length; i0++)
|
||||
{ SpriteSets[i]. Sprites[i0].NameOffset = _IO.P;
|
||||
_IO.W(SpriteSets[i]. Sprites[i0].Name + "\0"); }
|
||||
{ SpriteSets[i]. Sprites[i0].NameOffset = s.P;
|
||||
s.W(SpriteSets[i]. Sprites[i0].Name + "\0"); }
|
||||
}
|
||||
|
||||
for (i = 0; i < SpriteSets.Length; i++)
|
||||
{
|
||||
if (notAdd.Contains(i)) continue;
|
||||
SpriteSets[i]. NameOffset = _IO.P; _IO.W(SpriteSets[i]. Name + "\0");
|
||||
SpriteSets[i].FileNameOffset = _IO.P; _IO.W(SpriteSets[i].FileName + "\0");
|
||||
SpriteSets[i]. NameOffset = s.P; s.W(SpriteSets[i]. Name + "\0");
|
||||
SpriteSets[i].FileNameOffset = s.P; s.W(SpriteSets[i].FileName + "\0");
|
||||
}
|
||||
s.A(0x08, true);
|
||||
|
||||
_IO.A(0x08, true);
|
||||
_IO.P = 0x20;
|
||||
s.P = 0x20;
|
||||
for (i = 0, i2 = 0; i < SpriteSets.Length; i++)
|
||||
{
|
||||
if (notAdd.Contains(i)) { i2++; continue; }
|
||||
|
||||
for (i0 = 0; i0 < SpriteSets[i].Textures.Length; i0++)
|
||||
{
|
||||
_IO.W(SpriteSets[i].Textures[i0].Id );
|
||||
_IO.W(SpriteSets[i].Textures[i0].NameOffset);
|
||||
_IO.W((ushort) i0 );
|
||||
_IO.W((ushort)(0x1000 | (i - i2)));
|
||||
s.W(SpriteSets[i].Textures[i0].Id );
|
||||
s.W(SpriteSets[i].Textures[i0].NameOffset);
|
||||
s.W((ushort) i0 );
|
||||
s.W((ushort)(0x1000 | (i - i2)));
|
||||
}
|
||||
|
||||
for (i0 = 0; i0 < SpriteSets[i]. Sprites.Length; i0++)
|
||||
{
|
||||
_IO.W(SpriteSets[i]. Sprites[i0].Id );
|
||||
_IO.W(SpriteSets[i]. Sprites[i0].NameOffset);
|
||||
_IO.W((ushort) i0 );
|
||||
_IO.W((ushort)(i - i2));
|
||||
s.W(SpriteSets[i]. Sprites[i0].Id );
|
||||
s.W(SpriteSets[i]. Sprites[i0].NameOffset);
|
||||
s.W((ushort) i0 );
|
||||
s.W((ushort)(i - i2));
|
||||
}
|
||||
}
|
||||
_IO.A(0x20);
|
||||
s.A(0x20);
|
||||
|
||||
for (i = 0, i2 = 0; i < SpriteSets.Length; i++)
|
||||
{
|
||||
if (notAdd.Contains(i)) { i2++; continue; }
|
||||
|
||||
_IO.W(SpriteSets[i].Id );
|
||||
_IO.W(SpriteSets[i]. NameOffset);
|
||||
_IO.W(SpriteSets[i].FileNameOffset);
|
||||
_IO.W(i - i2);
|
||||
s.W(SpriteSets[i].Id );
|
||||
s.W(SpriteSets[i]. NameOffset);
|
||||
s.W(SpriteSets[i].FileNameOffset);
|
||||
s.W(i - i2);
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
notAdd.Dispose();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool json = false)
|
||||
@@ -256,7 +253,7 @@ namespace KKdMainLib.DB
|
||||
|
||||
private bool disposed = false;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; SpriteSets = null; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; SpriteSets = null; disposed = true; } }
|
||||
|
||||
public struct SpriteTexture
|
||||
{
|
||||
|
||||
+83
-81
@@ -8,7 +8,7 @@ namespace KKdMainLib
|
||||
{
|
||||
private int i, i0, i1;
|
||||
private Header header;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
|
||||
public EXP[] Dex;
|
||||
|
||||
@@ -16,63 +16,65 @@ namespace KKdMainLib
|
||||
{
|
||||
Dex = null;
|
||||
header = new Header();
|
||||
_IO = File.OpenReader(filepath + ext);
|
||||
s = File.OpenReader(filepath + ext);
|
||||
|
||||
header.Format = Format.F;
|
||||
header.SectionSignature = _IO.RI32();
|
||||
header.SectionSignature = s.RU32();
|
||||
if (header.SectionSignature == 0x43505845)
|
||||
header = _IO.ReadHeader(true, true);
|
||||
header = s.ReadHeader(true, true);
|
||||
if (header.SectionSignature != 0x64) return;
|
||||
|
||||
_IO.O = _IO.P - 0x4;
|
||||
Dex = new EXP[_IO.RI32()];
|
||||
int DEXOffset = _IO.RI32();
|
||||
int DEXNameOffset = _IO.RI32();
|
||||
if (DEXNameOffset == 0x00) { _IO.Format = header.Format = Format.X; DEXNameOffset = (int)_IO.RIX(); }
|
||||
s.O = s.P - 0x4;
|
||||
Dex = new EXP[s.RI32()];
|
||||
int DEXOffset = s.RI32();
|
||||
int DEXNameOffset = s.RI32();
|
||||
if (DEXNameOffset == 0x00) { s.Format = header.Format = Format.X; DEXNameOffset = (int)s.RIX(); }
|
||||
|
||||
_IO.P = DEXOffset;
|
||||
s.P = DEXOffset;
|
||||
for (i = 0; i < Dex.Length; i++)
|
||||
{
|
||||
Dex[i].MainOffset = (int)_IO.RIX();
|
||||
Dex[i].EyesOffset = (int)_IO.RIX();
|
||||
Dex[i].MainOffset = (int)s.RIX();
|
||||
Dex[i].EyesOffset = (int)s.RIX();
|
||||
}
|
||||
_IO.P = DEXNameOffset;
|
||||
s.P = DEXNameOffset;
|
||||
for (i = 0; i < Dex.Length; i++)
|
||||
Dex[i].NameOffset = (int)_IO.RIX();
|
||||
Dex[i].NameOffset = (int)s.RIX();
|
||||
|
||||
for (i = 0; i < Dex.Length; i++)
|
||||
{
|
||||
EXPElement element = new EXPElement();
|
||||
Dex[i].Main = KKdList<EXPElement>.New;
|
||||
_IO.P = Dex[i].MainOffset;
|
||||
s.P = Dex[i].MainOffset;
|
||||
while (true)
|
||||
{
|
||||
element.Frame = _IO.RF32();
|
||||
element.Both = _IO.RU16();
|
||||
element.ID = _IO.RU16();
|
||||
element.Value = _IO.RF32();
|
||||
element.Trans = _IO.RF32();
|
||||
element.Frame = s.RF32();
|
||||
element.Both = s.RU16();
|
||||
element.ID = s.RU16();
|
||||
element.Value = s.RF32();
|
||||
element.Trans = s.RF32();
|
||||
if (element.Frame == 999999 || element.Both == 0xFFFF) break;
|
||||
Dex[i].Main.Add(element);
|
||||
}
|
||||
Dex[i].Main.Capacity = Dex[i].Main.Count;
|
||||
|
||||
Dex[i].Eyes = KKdList<EXPElement>.New;
|
||||
_IO.P = Dex[i].EyesOffset;
|
||||
s.P = Dex[i].EyesOffset;
|
||||
while(true)
|
||||
{
|
||||
element.Frame = _IO.RF32();
|
||||
element.Both = _IO.RU16();
|
||||
element.ID = _IO.RU16();
|
||||
element.Value = _IO.RF32();
|
||||
element.Trans = _IO.RF32();
|
||||
element.Frame = s.RF32();
|
||||
element.Both = s.RU16();
|
||||
element.ID = s.RU16();
|
||||
element.Value = s.RF32();
|
||||
element.Trans = s.RF32();
|
||||
if (element.Frame == 999999 || element.Both == 0xFFFF) break;
|
||||
Dex[i].Eyes.Add(element);
|
||||
}
|
||||
Dex[i].Eyes.Capacity = Dex[i].Eyes.Count;
|
||||
|
||||
Dex[i].Name = _IO.RSaO(Dex[i].NameOffset);
|
||||
Dex[i].Name = s.RSaO(Dex[i].NameOffset);
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void DEXWriter(string filepath, Format format)
|
||||
@@ -80,89 +82,89 @@ namespace KKdMainLib
|
||||
if (Dex == null || Dex.Length < 1) return;
|
||||
|
||||
header = new Header();
|
||||
_IO = File.OpenWriter(filepath + (format > Format.F && format < Format.FT ? ".dex" : ".bin"), true);
|
||||
header.Format = _IO.Format = format;
|
||||
s = File.OpenWriter(filepath + (format > Format.F && format < Format.FT ? ".dex" : ".bin"), true);
|
||||
header.Format = s.Format = format;
|
||||
|
||||
_IO.Format = format;
|
||||
_IO.O = format > Format.F ? 0x20 : 0;
|
||||
_IO.P = 0;
|
||||
_IO.W(0x64);
|
||||
_IO.W(Dex.Length);
|
||||
s.Format = format;
|
||||
s.O = format > Format.F ? 0x20 : 0;
|
||||
s.P = 0;
|
||||
s.W(0x64);
|
||||
s.W(Dex.Length);
|
||||
|
||||
_IO.WX(header.IsX ? 0x28 : 0x20);
|
||||
_IO.WX(0x00);
|
||||
s.WX(header.IsX ? 0x28 : 0x20);
|
||||
s.WX(0x00);
|
||||
|
||||
int Position0 = _IO.P;
|
||||
_IO.W(0x00L);
|
||||
_IO.W(0x00L);
|
||||
int Position0 = s.P;
|
||||
s.W(0x00L);
|
||||
s.W(0x00L);
|
||||
|
||||
for (i = 0; i < Dex.Length * 3; i++) _IO.WX(0x00);
|
||||
_IO.A(0x20);
|
||||
for (i = 0; i < Dex.Length * 3; i++) s.WX(0x00);
|
||||
s.A(0x20);
|
||||
|
||||
for (i0 = 0; i0 < Dex.Length; i0++)
|
||||
{
|
||||
Dex[i0].MainOffset = _IO.P;
|
||||
Dex[i0].MainOffset = s.P;
|
||||
for (i1 = 0; i1 < Dex[i0].Main.Count; i1++)
|
||||
{
|
||||
_IO.W(Dex[i0].Main[i1].Frame);
|
||||
_IO.W(Dex[i0].Main[i1].Both );
|
||||
_IO.W(Dex[i0].Main[i1].ID );
|
||||
_IO.W(Dex[i0].Main[i1].Value);
|
||||
_IO.W(Dex[i0].Main[i1].Trans);
|
||||
s.W(Dex[i0].Main[i1].Frame);
|
||||
s.W(Dex[i0].Main[i1].Both );
|
||||
s.W(Dex[i0].Main[i1].ID );
|
||||
s.W(Dex[i0].Main[i1].Value);
|
||||
s.W(Dex[i0].Main[i1].Trans);
|
||||
}
|
||||
_IO.W(999999f);
|
||||
_IO.W(0xFFFF);
|
||||
_IO.W(0x0L);
|
||||
_IO.A(0x20);
|
||||
s.W(999999f);
|
||||
s.W(0xFFFF);
|
||||
s.W(0x0L);
|
||||
s.A(0x20);
|
||||
|
||||
Dex[i0].EyesOffset = _IO.P;
|
||||
Dex[i0].EyesOffset = s.P;
|
||||
for (i1 = 0; i1 < Dex[i0].Eyes.Count; i1++)
|
||||
{
|
||||
_IO.W(Dex[i0].Eyes[i1].Frame);
|
||||
_IO.W(Dex[i0].Eyes[i1].Both );
|
||||
_IO.W(Dex[i0].Eyes[i1].ID );
|
||||
_IO.W(Dex[i0].Eyes[i1].Value);
|
||||
_IO.W(Dex[i0].Eyes[i1].Trans);
|
||||
s.W(Dex[i0].Eyes[i1].Frame);
|
||||
s.W(Dex[i0].Eyes[i1].Both );
|
||||
s.W(Dex[i0].Eyes[i1].ID );
|
||||
s.W(Dex[i0].Eyes[i1].Value);
|
||||
s.W(Dex[i0].Eyes[i1].Trans);
|
||||
}
|
||||
_IO.W(999999f);
|
||||
_IO.W(0xFFFF);
|
||||
_IO.W(0x0L);
|
||||
_IO.A(0x20);
|
||||
s.W(999999f);
|
||||
s.W(0xFFFF);
|
||||
s.W(0x0L);
|
||||
s.A(0x20);
|
||||
}
|
||||
for (i = 0; i < Dex.Length; i++)
|
||||
{
|
||||
Dex[i].NameOffset = _IO.P;
|
||||
_IO.W(Dex[i].Name + "\0");
|
||||
Dex[i].NameOffset = s.P;
|
||||
s.W(Dex[i].Name + "\0");
|
||||
}
|
||||
_IO.A(0x10, true);
|
||||
s.A(0x10, true);
|
||||
|
||||
_IO.P = header.IsX ? 0x28 : 0x20;
|
||||
s.P = header.IsX ? 0x28 : 0x20;
|
||||
for (i = 0; i < Dex.Length; i++)
|
||||
{
|
||||
_IO.WX(Dex[i].MainOffset);
|
||||
_IO.WX(Dex[i].EyesOffset);
|
||||
s.WX(Dex[i].MainOffset);
|
||||
s.WX(Dex[i].EyesOffset);
|
||||
}
|
||||
int namesPosition = _IO.P;
|
||||
int namesPosition = s.P;
|
||||
for (i = 0; i < Dex.Length; i++)
|
||||
_IO.WX(Dex[i].NameOffset);
|
||||
s.WX(Dex[i].NameOffset);
|
||||
|
||||
_IO.P = Position0 - (header.IsX ? 8 : 4);
|
||||
_IO.W(namesPosition);
|
||||
s.P = Position0 - (header.IsX ? 8 : 4);
|
||||
s.W(namesPosition);
|
||||
|
||||
if (format > Format.F)
|
||||
{
|
||||
int offset = _IO.L;
|
||||
_IO.O = 0;
|
||||
_IO.P = _IO.L;
|
||||
_IO.WEOFC(0);
|
||||
_IO.P = 0;
|
||||
uint offset = s.LU32;
|
||||
s.O = 0;
|
||||
s.P = s.L;
|
||||
s.WEOFC(0);
|
||||
s.P = 0;
|
||||
header.DataSize = offset;
|
||||
header.SectionSize = offset;
|
||||
header.Signature = 0x43505845;
|
||||
header.UseSectionSize = true;
|
||||
_IO.W(header);
|
||||
s.W(header);
|
||||
}
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool json)
|
||||
@@ -191,7 +193,7 @@ namespace KKdMainLib
|
||||
{
|
||||
Dex[i0].Eyes = KKdList<EXPElement>.New;
|
||||
Dex[i0].Eyes.Capacity = temp.Array.Length;
|
||||
for (i1 = 0; i1 < this.Dex[i0].Eyes.Capacity; i1++)
|
||||
for (i1 = 0; i1 < Dex[i0].Eyes.Capacity; i1++)
|
||||
Dex[i0].Eyes.Add(EXPElement.Read(temp[i1]));
|
||||
}
|
||||
temp.Dispose();
|
||||
@@ -226,7 +228,7 @@ namespace KKdMainLib
|
||||
|
||||
private bool disposed;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; Dex = null; header = default; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; Dex = null; header = default; disposed = true; } }
|
||||
|
||||
public struct EXP
|
||||
{
|
||||
|
||||
@@ -8,9 +8,7 @@ namespace KKdMainLib
|
||||
{
|
||||
public static class DIVAFILE
|
||||
{
|
||||
private static readonly byte[] Key = new byte[]
|
||||
{ 0x66, 0x69, 0x6C, 0x65, 0x20, 0x61, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x20, 0x64, 0x65, 0x6E, 0x79 };
|
||||
private static readonly byte[] Key = "file access deny".ToASCII();
|
||||
|
||||
public static void Decrypt(this string file)
|
||||
{
|
||||
|
||||
+56
-43
@@ -7,8 +7,8 @@ namespace KKdMainLib
|
||||
{
|
||||
public struct DataBank : IDisposable
|
||||
{
|
||||
private Stream _IO;
|
||||
private int i;
|
||||
private Stream s;
|
||||
|
||||
public PvList[] pvList;
|
||||
public PsrData[] psrData;
|
||||
@@ -44,29 +44,41 @@ namespace KKdMainLib
|
||||
else if (file.Contains("PvList")) Success = true;
|
||||
}
|
||||
|
||||
public void DBWriter(string file, uint num2)
|
||||
public byte[] DBWriter(string file)
|
||||
{
|
||||
if (!Success) return;
|
||||
if (!Success) return null;
|
||||
|
||||
_IO = File.OpenWriter();
|
||||
s = File.OpenWriter();
|
||||
if (file.Contains("psrData"))
|
||||
{
|
||||
if (psrData != null && psrData.Length > 0)
|
||||
for (i = 0; i < psrData.Length; i++)
|
||||
_IO.W(psrData[i].ToString() + c);
|
||||
if (psrData[i].PV_ID == 92)
|
||||
s.W(psrData[i].ToString() + c);
|
||||
else
|
||||
s.W(psrData[i].ToString() + c);
|
||||
}
|
||||
else if (file.Contains("PvList"))
|
||||
{
|
||||
if (pvList != null && pvList.Length > 0)
|
||||
{
|
||||
for (i = 0; i < pvList.Length - 1; i++)
|
||||
_IO.W(UrlEncode(pvList[i].ToString() + c));
|
||||
_IO.W(UrlEncode(pvList[i].ToString()));
|
||||
s.W(UrlEncode(pvList[i].ToString() + c));
|
||||
s.W(UrlEncode(pvList[i].ToString()));
|
||||
}
|
||||
else _IO.W("%2A%2A%2A");
|
||||
else s.W("%2A%2A%2A");
|
||||
}
|
||||
|
||||
byte[] data = _IO.ToArray(true);
|
||||
return s.ToArray(true);
|
||||
}
|
||||
|
||||
public void DBWriter(string file, uint num2)
|
||||
{
|
||||
if (!Success) return;
|
||||
|
||||
byte[] data = DBWriter(file);
|
||||
if (data == null) return;
|
||||
|
||||
ushort num = DCC.CalculateChecksum(data);
|
||||
File.WriteAllBytes(file + "_" + num + "_" + num2 + ".dat", data);
|
||||
}
|
||||
@@ -137,11 +149,11 @@ namespace KKdMainLib
|
||||
}
|
||||
|
||||
public static string UrlEncode(string value) =>
|
||||
WebUtility.UrlEncode(value).Replace("+", "%20");
|
||||
WebUtility.UrlEncode(value).Replace("+", "%20").Replace("!", "%21").Replace("*", "%2A");
|
||||
|
||||
private bool disposed;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; psrData = null;
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; psrData = null;
|
||||
pvList = null; Success = false; disposed = true; } }
|
||||
|
||||
public struct PsrData
|
||||
@@ -166,9 +178,9 @@ namespace KKdMainLib
|
||||
else { id = msg.RnI32("ID"); if (id != null) PV_ID = (int)id; }
|
||||
|
||||
MsgPack temp;
|
||||
if ((temp = msg["P1", true]).NotNull) p1.SetValue(temp);
|
||||
if ((temp = msg["P2", true]).NotNull) p2.SetValue(temp);
|
||||
if ((temp = msg["P3", true]).NotNull) p3.SetValue(temp);
|
||||
if ((temp = msg["P1"]).NotNull) p1.SetValue(temp);
|
||||
if ((temp = msg["P2"]).NotNull) p2.SetValue(temp);
|
||||
if ((temp = msg["P3"]).NotNull) p3.SetValue(temp);
|
||||
temp.Dispose();
|
||||
}
|
||||
|
||||
@@ -182,30 +194,30 @@ namespace KKdMainLib
|
||||
|
||||
public struct Player
|
||||
{
|
||||
public int Score0;
|
||||
public int Score1;
|
||||
public string Name0;
|
||||
public string Name1;
|
||||
public string Name;
|
||||
public string NameExtra;
|
||||
public int Score;
|
||||
public int ScoreExtra;
|
||||
public Difficulty Diff;
|
||||
public bool Has2P => Name1 != null;
|
||||
public bool HasExtra => NameExtra != null;
|
||||
|
||||
public void SetValue(string[] data, int i = 0, int offset = 0)
|
||||
{
|
||||
string[] array = data[i * 13 + offset * 4].Split('.');
|
||||
Score0 = int.Parse(array[0]);
|
||||
if (array.Length > 1) Score1 = int.Parse(array[1]);
|
||||
Score = int.Parse(array[0]);
|
||||
if (array.Length > 1) ScoreExtra = int.Parse(array[1]);
|
||||
string text = "";
|
||||
for (int j = 0; j < data[i * 13 + 1 + offset * 4].Length; j++)
|
||||
{
|
||||
text += data[i * 13 + 1 + offset * 4][j].ToString();
|
||||
if (text.EndsWith("xxx"))
|
||||
{
|
||||
Name0 = text.Remove(text.Length - 3);
|
||||
Name = text.Remove(text.Length - 3);
|
||||
text = "";
|
||||
}
|
||||
}
|
||||
if (array.Length == 1) Name0 = text;
|
||||
else Name1 = text;
|
||||
if (array.Length == 1) Name = text;
|
||||
else NameExtra = text;
|
||||
if (int.TryParse(data[i * 13 + 2 + offset * 4], out int Diff))
|
||||
this.Diff = (Difficulty)Diff;
|
||||
else
|
||||
@@ -215,28 +227,29 @@ namespace KKdMainLib
|
||||
public void SetValue(MsgPack msg)
|
||||
{
|
||||
Diff = (Difficulty)msg.RI32("Diff");
|
||||
Score0 = msg.RI32 ("Score");
|
||||
Name0 = msg.RS( "Name");
|
||||
if (Name0 == null)
|
||||
Name = msg.RS ( "Name");
|
||||
NameExtra = msg.RS ( "NameExtra");
|
||||
Score = msg.RI32("Score");
|
||||
ScoreExtra = msg.RI32("ScoreExtra");
|
||||
|
||||
if (Name == null)
|
||||
{
|
||||
Score0 = msg.RI32("Score0");
|
||||
Score1 = msg.RI32("Score1");
|
||||
Name0 = msg.RS ( "Name0");
|
||||
Name1 = msg.RS ( "Name1");
|
||||
Name = msg.RS ( "Name0");
|
||||
NameExtra = msg.RS ( "Name1");
|
||||
Score = msg.RI32("Score0");
|
||||
ScoreExtra = msg.RI32("Score1");
|
||||
}
|
||||
else Name1 = null;
|
||||
}
|
||||
|
||||
public MsgPack WriteMP(string name) =>
|
||||
Has2P ? new MsgPack(name).Add("Diff", (int)Diff).Add("Score0", Score0)
|
||||
.Add("Score1", Score1).Add("Name0", Name0).Add("Name1", Name1) :
|
||||
new MsgPack(name).Add("Diff", (int)Diff)
|
||||
.Add("Score" , Score0).Add("Name" , Name0);
|
||||
HasExtra ? new MsgPack(name).Add("Diff", (int)Diff).Add("Name", Name)
|
||||
.Add("NameExtra", NameExtra).Add("Score", Score).Add("ScoreExtra", ScoreExtra) :
|
||||
new MsgPack(name).Add("Diff", (int)Diff).Add("Name" , Name) .Add("Score" , Score);
|
||||
|
||||
public override string ToString() =>
|
||||
(Score0 + (Has2P ? (d + Score1) : "") + c + UrlEncode(Name0) +
|
||||
(Has2P ? ("xxx" + UrlEncode(Name1)) : "") + c +
|
||||
Diff + c + (Has2P ? "0.1" : "0")).Replace("*", "%2A");
|
||||
Score + (HasExtra ? (d + ScoreExtra) : "") + c + UrlEncode(Name) +
|
||||
(HasExtra ? ("xxx" + UrlEncode(NameExtra)) : "") + c +
|
||||
(int)Diff + c + (HasExtra ? "0.1" : "0");
|
||||
}
|
||||
|
||||
public struct PvList
|
||||
@@ -290,9 +303,9 @@ namespace KKdMainLib
|
||||
|
||||
public MsgPack WriteMP()
|
||||
{
|
||||
MsgPack msgPack = MsgPack.New.Add("ID" , PV_ID )
|
||||
.Add("Version", Version)
|
||||
.Add("Edition", Edition);
|
||||
MsgPack msgPack = MsgPack.New.Add("ID" , PV_ID );
|
||||
if (Version != 1) msgPack.Add("Version", Version);
|
||||
if (Edition != 0) msgPack.Add("Edition", Edition);
|
||||
if (AdvDemoStart.WU) msgPack.Add("AdvDemoStart", AdvDemoStart.Int);
|
||||
if (AdvDemoEnd .WL) msgPack.Add("AdvDemoEnd" , AdvDemoEnd .Int);
|
||||
if (StartShow .WL) msgPack.Add("StartShow" , StartShow .Int);
|
||||
@@ -375,7 +388,7 @@ namespace KKdMainLib
|
||||
}
|
||||
|
||||
public override string ToString() =>
|
||||
$"{Year.ToString("d4")}-{Month.ToString("d2")}-{Day.ToString("d2")}";
|
||||
$"{Year:d4}-{Month:d2}-{Day:d2}";
|
||||
}
|
||||
|
||||
public enum Difficulty
|
||||
|
||||
+32
-33
@@ -16,9 +16,14 @@ namespace KKdMainLib
|
||||
|
||||
public static Header ReadHeader(this Stream stream, bool readSectionSignature = true)
|
||||
{
|
||||
Header header = new Header { Format = Format.F2, Signature = stream.RI32(),
|
||||
DataSize = stream.RI32(), Length = stream.RI32(), Flags = stream.RI32(),
|
||||
Depth = stream.RI32(), SectionSize = stream.RI32(), Mode = stream.RI32() };
|
||||
Header header = new Header { Format = Format.F2 };
|
||||
header.Signature = stream.RU32();
|
||||
header.DataSize = stream.RU32();
|
||||
header.Length = stream.RU32();
|
||||
header.Flags = stream.RU32();
|
||||
header.Depth = stream.RU32();
|
||||
header.SectionSize = stream.RU32();
|
||||
header.Version = stream.RU32();
|
||||
stream.RI32();
|
||||
header.UseBigEndian = (header.Flags & 0x08000000) != 0;
|
||||
header.UseSectionSize = (header.Flags & 0x10000000) != 0;
|
||||
@@ -26,20 +31,20 @@ namespace KKdMainLib
|
||||
{
|
||||
stream.RI64();
|
||||
stream.RI64();
|
||||
header.InnerSignature = stream.RI32();
|
||||
header.InnerSignature = stream.RU32();
|
||||
stream.RI32();
|
||||
stream.RI64();
|
||||
}
|
||||
stream.Format = header.Format;
|
||||
if (readSectionSignature) header.SectionSignature = stream.RI32E();
|
||||
if (readSectionSignature) header.SectionSignature = stream.RU32E();
|
||||
return header;
|
||||
}
|
||||
|
||||
public static void W(this Stream stream, Header header, bool extended = false)
|
||||
{
|
||||
header.Length = (header.Format < Format.X && extended) ? 0x40 : 0x20;
|
||||
header.Flags = (header.UseSectionSize ? 0x10000000 : 0) |
|
||||
(header.UseBigEndian ? 0x08000000 : 0);
|
||||
header.Length = (header.Format < Format.X && extended) ? 0x40u : 0x20u;
|
||||
header.Flags = (header.UseSectionSize ? 0x10000000 : 0u) |
|
||||
(header.UseBigEndian ? 0x08000000 : 0u);
|
||||
|
||||
stream.W(header.Signature);
|
||||
stream.W(header.DataSize);
|
||||
@@ -47,7 +52,7 @@ namespace KKdMainLib
|
||||
stream.W(header.Flags);
|
||||
stream.W(header.Depth);
|
||||
stream.W(header.SectionSize);
|
||||
stream.W(header.Mode);
|
||||
stream.W(header.Version);
|
||||
stream.W(0x00);
|
||||
if (header.Length == 0x40)
|
||||
{
|
||||
@@ -59,18 +64,18 @@ namespace KKdMainLib
|
||||
}
|
||||
}
|
||||
|
||||
public static void WEOFC(this Stream stream, int depth = 0) =>
|
||||
public static void WEOFC(this Stream stream, uint depth = 0) =>
|
||||
stream.W(new Header { Depth = depth, Length = 0x20, Signature = 0x43464F45, UseSectionSize = true });
|
||||
}
|
||||
|
||||
public static class POFExtensions
|
||||
{
|
||||
public static void W(this Stream stream, POF pof, bool shiftX = false, int depth = 0)
|
||||
public static void W(this Stream stream, POF pof, bool shiftX = false, uint depth = 0)
|
||||
{
|
||||
byte[] data = pof.Write(shiftX);
|
||||
Header header = new Header { Depth = depth, Format = Format.F2, Length = 0x20,
|
||||
Signature = shiftX ? 0x31464F50 : 0x30464F50, UseSectionSize = true };
|
||||
header.DataSize = header.SectionSize = data.Length.A(0x10);
|
||||
Signature = shiftX ? 0x31464F50u : 0x30464F50u, UseSectionSize = true };
|
||||
header.DataSize = header.SectionSize = (uint)data.Length.A(0x10);
|
||||
stream.W(header);
|
||||
stream.W(data);
|
||||
for (int c = data.Length.A(0x10) - data.Length; c > 0; c--)
|
||||
@@ -80,12 +85,12 @@ namespace KKdMainLib
|
||||
|
||||
public static class ENRSExtensions
|
||||
{
|
||||
public static void W(this Stream stream, ENRS enrs, int depth = 0)
|
||||
public static void W(this Stream stream, ENRS enrs, uint depth = 0)
|
||||
{
|
||||
byte[] data = enrs.Write();
|
||||
Header header = new Header { Depth = depth, Format = Format.F2,
|
||||
Length = 0x20, Signature = 0x53524E45, UseSectionSize = true };
|
||||
header.DataSize = header.SectionSize = data.Length;
|
||||
header.DataSize = header.SectionSize = (uint)data.Length;
|
||||
stream.W(header);
|
||||
stream.W(data);
|
||||
}
|
||||
@@ -104,12 +109,12 @@ namespace KKdMainLib
|
||||
|
||||
public static Struct RSt(this Stream stream, Header header)
|
||||
{
|
||||
int l = header.UseSectionSize ? header.SectionSize : header.DataSize;
|
||||
uint l = header.UseSectionSize ? header.SectionSize : header.DataSize;
|
||||
Struct @struct = new Struct { Header = header, DataOffset =
|
||||
stream.P, Data = stream.RBy(l) };
|
||||
int depth = header.Depth;
|
||||
uint depth = header.Depth;
|
||||
|
||||
int lastSig = 0, sig;
|
||||
uint lastSig = 0, sig;
|
||||
long length = stream.L - stream.P;
|
||||
long position = 0;
|
||||
KKdList<Struct> subStructs = KKdList<Struct>.New;
|
||||
@@ -132,25 +137,28 @@ namespace KKdMainLib
|
||||
else { stream.PI64 -= header.Length; break; }
|
||||
lastSig = sig;
|
||||
}
|
||||
subStructs.Capacity = subStructs.Count;
|
||||
|
||||
if (subStructs.Capacity > 0) @struct.SubStructs = subStructs.ToArray();
|
||||
return @struct;
|
||||
}
|
||||
|
||||
public static byte[] W(this Struct Struct, bool shiftX = false, bool useDepth = true)
|
||||
public static byte[] W(this Struct @struct, bool shiftX = false, bool useDepth = true)
|
||||
{
|
||||
byte[] Data;
|
||||
using (Stream stream = File.OpenWriter()) { Struct.Update(shiftX);
|
||||
stream.W(Struct, shiftX, useDepth); stream.WEOFC(); Data = stream.ToArray(); }
|
||||
using (Stream stream = File.OpenWriter())
|
||||
{ stream.W(@struct, shiftX, useDepth); stream.WEOFC(); Data = stream.ToArray(); }
|
||||
return Data;
|
||||
}
|
||||
|
||||
public static void W(this Stream stream, Struct @struct, bool shiftX = false, bool useDepth = true)
|
||||
{
|
||||
@struct.Update(shiftX);
|
||||
|
||||
stream.W(@struct.Header);
|
||||
stream.W(@struct.Data );
|
||||
if (@struct.HasPOF ) stream.W(@struct.POF , shiftX, useDepth ? @struct.Depth + 1 : 0);
|
||||
if (@struct.HasENRS) stream.W(@struct.ENRS, useDepth ? @struct.Depth + 1 : 0);
|
||||
if (@struct.Data != null) stream.W(@struct.Data);
|
||||
if (@struct.HasPOF ) stream.W(@struct.POF , shiftX, useDepth ? @struct.Depth + 1 : 0u);
|
||||
if (@struct.HasENRS) stream.W(@struct.ENRS, useDepth ? @struct.Depth + 1 : 0u);
|
||||
if (@struct.HasSubStructs)
|
||||
{
|
||||
for (int i = 0; i < @struct.SubStructs.Length; i++)
|
||||
@@ -230,13 +238,4 @@ namespace KKdMainLib
|
||||
return kf;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LibDeflate
|
||||
{
|
||||
public static void Extract()
|
||||
{
|
||||
if (!File.Exists("libdeflate.dll"))
|
||||
File.WriteAllBytes("libdeflate.dll", Properties.Resources.libdeflate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-31
@@ -7,7 +7,7 @@ namespace KKdMainLib.F2
|
||||
public struct Bloom : System.IDisposable
|
||||
{
|
||||
private int i;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
private Header header;
|
||||
|
||||
public CountPointer<BLT> BLTs;
|
||||
@@ -15,52 +15,46 @@ namespace KKdMainLib.F2
|
||||
public void BLTReader(string file)
|
||||
{
|
||||
BLTs = default;
|
||||
_IO = File.OpenReader(file + ".blt", true);
|
||||
header = _IO.ReadHeader();
|
||||
s = File.OpenReader(file + ".blt", true);
|
||||
header = s.ReadHeader();
|
||||
if (header.Signature != 0x544D4C42 || header.InnerSignature != 0x3) return;
|
||||
_IO.P -= 0x4;
|
||||
s.P -= 0x4;
|
||||
|
||||
BLTs = _IO.RCPE<BLT>();
|
||||
if (BLTs.C < 1) { _IO.C(); BLTs.C = -1; return; }
|
||||
BLTs = s.RCPE<BLT>();
|
||||
if (BLTs.C < 1) { s.C(); BLTs.C = -1; return; }
|
||||
|
||||
if (BLTs.C > 0 && BLTs.O == 0) { _IO.C(); BLTs.C = -1; return; }
|
||||
/*{
|
||||
_IO.Format = Header.Format = Format.X;
|
||||
_IO.Offset = Header.Length;
|
||||
_IO.Position = BLTs.Offset;
|
||||
BLTs = _IO.ReadCountPointerX<BLT>();
|
||||
}*/
|
||||
if (BLTs.C > 0 && BLTs.O == 0) { s.C(); BLTs.C = -1; return; }
|
||||
|
||||
_IO.P = BLTs.O;
|
||||
s.P = BLTs.O;
|
||||
for (i = 0; i < BLTs.C; i++)
|
||||
{
|
||||
ref BLT blt = ref BLTs.E[i];
|
||||
_IO.RI32E();
|
||||
blt.Color .X = _IO.RF32E();
|
||||
blt.Color .Y = _IO.RF32E();
|
||||
blt.Color .Z = _IO.RF32E();
|
||||
blt.Brightpass.X = _IO.RF32E();
|
||||
blt.Brightpass.Y = _IO.RF32E();
|
||||
blt.Brightpass.Z = _IO.RF32E();
|
||||
blt.Range = _IO.RF32E();
|
||||
s.RI32E();
|
||||
blt.Color .X = s.RF32E();
|
||||
blt.Color .Y = s.RF32E();
|
||||
blt.Color .Z = s.RF32E();
|
||||
blt.Brightpass.X = s.RF32E();
|
||||
blt.Brightpass.Y = s.RF32E();
|
||||
blt.Brightpass.Z = s.RF32E();
|
||||
blt.Range = s.RF32E();
|
||||
}
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void TXTWriter(string file)
|
||||
{
|
||||
if (BLTs.C < 1) return;
|
||||
|
||||
_IO = File.OpenWriter();
|
||||
_IO.WPSSJIS("ID,ColorR,ColorG,ColorB,BrightpassR,BrightpassG,BrightpassB,Range\n");
|
||||
s = File.OpenWriter();
|
||||
s.WPSSJIS("ID,ColorR,ColorG,ColorB,BrightpassR,BrightpassG,BrightpassB,Range\n");
|
||||
for (i = 0; i < BLTs.C; i++)
|
||||
_IO.W(i + "," + BLTs[i] + "\n");
|
||||
File.WriteAllBytes(file + "_bloom.txt", _IO.ToArray(true));
|
||||
s.W($"{i},{ BLTs[i]}\n");
|
||||
File.WriteAllBytes($"{file}_bloom.txt", s.ToArray(true));
|
||||
}
|
||||
|
||||
private bool disposed;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; BLTs = default; header = default; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; BLTs = default; header = default; disposed = true; } }
|
||||
|
||||
public struct BLT
|
||||
{
|
||||
@@ -68,9 +62,9 @@ namespace KKdMainLib.F2
|
||||
public Vec3 Brightpass;
|
||||
public float Range;
|
||||
|
||||
public override string ToString() => Color .ToString(6) + "," +
|
||||
Brightpass.ToString(6) + "," +
|
||||
Range .ToS(6);
|
||||
public override string ToString() =>
|
||||
$"{Color.X.ToS(6)},{Color.Y.ToS(6)},{Color.Z.ToS(6)},{Brightpass.X.ToS(6)}" +
|
||||
$",{Brightpass.Y.ToS(6)},{Brightpass.Z.ToS(6)},{Range.ToS(6)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace KKdMainLib.F2
|
||||
public struct ColorCorrection : System.IDisposable
|
||||
{
|
||||
private int i;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
private Header header;
|
||||
|
||||
public CountPointer<CCT> CCTs;
|
||||
@@ -15,54 +15,48 @@ namespace KKdMainLib.F2
|
||||
public void CCTReader(string file)
|
||||
{
|
||||
CCTs = default;
|
||||
_IO = File.OpenReader(file + ".cct", true);
|
||||
header = _IO.ReadHeader();
|
||||
s = File.OpenReader(file + ".cct", true);
|
||||
header = s.ReadHeader();
|
||||
if (header.Signature != 0x54524343 || header.InnerSignature != 0x3) return;
|
||||
_IO.P -= 0x4;
|
||||
s.P -= 0x4;
|
||||
|
||||
CCTs = _IO.RCPE<CCT>();
|
||||
if (CCTs.C < 1) { _IO.C(); CCTs.C = -1; return; }
|
||||
CCTs = s.RCPE<CCT>();
|
||||
if (CCTs.C < 1) { s.C(); CCTs.C = -1; return; }
|
||||
|
||||
if (CCTs.C > 0 && CCTs.O == 0) { _IO.C(); CCTs.C = -1; return; }
|
||||
/*{
|
||||
_IO.Format = Header.Format = Format.X;
|
||||
_IO.Offset = Header.Length;
|
||||
_IO.Position = CCTs.Offset;
|
||||
CCTs = _IO.ReadCountPointerX<CCT>();
|
||||
}*/
|
||||
if (CCTs.C > 0 && CCTs.O == 0) { s.C(); CCTs.C = -1; return; }
|
||||
|
||||
_IO.P = CCTs.O;
|
||||
s.P = CCTs.O;
|
||||
for (i = 0; i < CCTs.C; i++)
|
||||
{
|
||||
ref CCT cct = ref CCTs.E[i];
|
||||
_IO.RI32E();
|
||||
cct.Hue = _IO.RF32E();
|
||||
cct.Saturation = _IO.RF32E();
|
||||
cct.Lightness = _IO.RF32E();
|
||||
cct.Exposure = _IO.RF32E();
|
||||
cct.Gamma.X = _IO.RF32E();
|
||||
cct.Gamma.Y = _IO.RF32E();
|
||||
cct.Gamma.Z = _IO.RF32E();
|
||||
cct.Contrast = _IO.RF32E();
|
||||
s.RI32E();
|
||||
cct.Hue = s.RF32E();
|
||||
cct.Saturation = s.RF32E();
|
||||
cct.Lightness = s.RF32E();
|
||||
cct.Exposure = s.RF32E();
|
||||
cct.Gamma.X = s.RF32E();
|
||||
cct.Gamma.Y = s.RF32E();
|
||||
cct.Gamma.Z = s.RF32E();
|
||||
cct.Contrast = s.RF32E();
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void TXTWriter(string file)
|
||||
{
|
||||
if (CCTs.C < 1) return;
|
||||
|
||||
_IO = File.OpenWriter();
|
||||
_IO.WPSSJIS("ID,Hue,Saturation,Lightness,Exposure,GammaR,GammaG,GammaB,Contrast\n");
|
||||
s = File.OpenWriter();
|
||||
s.WPSSJIS("ID,Hue,Saturation,Lightness,Exposure,GammaR,GammaG,GammaB,Contrast\n");
|
||||
for (i = 0; i < CCTs.C; i++)
|
||||
_IO.W(i + "," + CCTs[i] + "\n");
|
||||
File.WriteAllBytes(file + "_cc.txt", _IO.ToArray(true));
|
||||
s.W($"{i},{CCTs[i]}\n");
|
||||
File.WriteAllBytes($"{file}_cc.txt", s.ToArray(true));
|
||||
}
|
||||
|
||||
private bool disposed;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; CCTs = default; header = default; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; CCTs = default; header = default; disposed = true; } }
|
||||
|
||||
public struct CCT
|
||||
{
|
||||
@@ -73,12 +67,9 @@ namespace KKdMainLib.F2
|
||||
public Vec3 Gamma;
|
||||
public float Contrast;
|
||||
|
||||
public override string ToString() => Hue .ToS(6) + "," +
|
||||
Saturation.ToS(6) + "," +
|
||||
Lightness .ToS(6) + "," +
|
||||
Exposure .ToS(6) + "," +
|
||||
Gamma .ToString(6) + "," +
|
||||
Contrast .ToS(6);
|
||||
public override string ToString() =>
|
||||
$"{Hue.ToS(6)},{Saturation.ToS(6)},{Lightness.ToS(6)},{Exposure.ToS(6)}" +
|
||||
$",{Gamma.X.ToS(6)},{Gamma.Y.ToS(6)},{Gamma.Z.ToS(6)},{Contrast.ToS(6)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-32
@@ -7,7 +7,7 @@ namespace KKdMainLib.F2
|
||||
public struct DOF : System.IDisposable
|
||||
{
|
||||
private int i;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
private Header header;
|
||||
|
||||
public CountPointer<DFT> DFTs;
|
||||
@@ -15,52 +15,45 @@ namespace KKdMainLib.F2
|
||||
public void DFTReader(string file)
|
||||
{
|
||||
DFTs = default;
|
||||
_IO = File.OpenReader(file + ".dft", true);
|
||||
header = _IO.ReadHeader();
|
||||
s = File.OpenReader(file + ".dft", true);
|
||||
header = s.ReadHeader();
|
||||
if (header.Signature != 0x54464F44 || header.InnerSignature != 0x3) return;
|
||||
_IO.P -= 0x4;
|
||||
s.P -= 0x4;
|
||||
|
||||
DFTs = _IO.RCPE<DFT>();
|
||||
if (DFTs.C < 1) { _IO.C(); DFTs.C = -1; return; }
|
||||
DFTs = s.RCPE<DFT>();
|
||||
if (DFTs.C < 1) { s.C(); DFTs.C = -1; return; }
|
||||
|
||||
if (DFTs.C > 0 && DFTs.O == 0) { _IO.C(); DFTs.C = -1; return; }
|
||||
/*{
|
||||
_IO.Format = Header.Format = Format.X;
|
||||
_IO.Offset = Header.Length;
|
||||
_IO.Position = DFTs.Offset;
|
||||
DFTs = _IO.ReadCountPointerX<DFT>();
|
||||
}*/
|
||||
if (DFTs.C > 0 && DFTs.O == 0) { s.C(); DFTs.C = -1; return; }
|
||||
|
||||
_IO.P = DFTs.O;
|
||||
s.P = DFTs.O;
|
||||
for (i = 0; i < DFTs.C; i++)
|
||||
{
|
||||
ref DFT DFT = ref DFTs.E[i];
|
||||
_IO.RI32E();
|
||||
DFT. Focus = _IO.RF32E();
|
||||
DFT. FocusRange = _IO.RF32E();
|
||||
DFT.FuzzingRange = _IO.RF32E();
|
||||
DFT.Ratio = _IO.RF32E();
|
||||
DFT.Quality = _IO.RF32E();
|
||||
if (_IO.IsX) _IO.RI32();
|
||||
s.RI32E();
|
||||
DFT. Focus = s.RF32E();
|
||||
DFT. FocusRange = s.RF32E();
|
||||
DFT.FuzzingRange = s.RF32E();
|
||||
DFT.Ratio = s.RF32E();
|
||||
DFT.Quality = s.RF32E();
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void TXTWriter(string file)
|
||||
{
|
||||
if (DFTs.C < 1) return;
|
||||
|
||||
_IO = File.OpenWriter();
|
||||
_IO.WPSSJIS("ID,Focus,FocusRange,FuzzingRange,Ratio,Quality\n");
|
||||
s = File.OpenWriter();
|
||||
s.WPSSJIS("ID,Focus,FocusRange,FuzzingRange,Ratio,Quality\n");
|
||||
for (i = 0; i < DFTs.C; i++)
|
||||
_IO.W(i + "," + DFTs[i] + "\n");
|
||||
File.WriteAllBytes(file + "_dof.txt", _IO.ToArray(true));
|
||||
s.W($"{i},{DFTs[i]}\n");
|
||||
File.WriteAllBytes($"{file}_dof.txt", s.ToArray(true));
|
||||
}
|
||||
|
||||
private bool disposed;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; DFTs = default; header = default; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; DFTs = default; header = default; disposed = true; } }
|
||||
|
||||
public struct DFT
|
||||
{
|
||||
@@ -70,11 +63,8 @@ namespace KKdMainLib.F2
|
||||
public float Ratio;
|
||||
public float Quality;
|
||||
|
||||
public override string ToString() => Focus .ToS(6) + "," +
|
||||
FocusRange.ToS(6) + "," +
|
||||
FuzzingRange.ToS(6) + "," +
|
||||
Ratio .ToS(6) + "," +
|
||||
Quality .ToS(6);
|
||||
public override string ToString() =>
|
||||
$"{Focus.ToS(6)},{FocusRange.ToS(6)},{FuzzingRange.ToS(6)},{Ratio.ToS(6)},{Quality.ToS(6)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+47
-52
@@ -7,7 +7,7 @@ namespace KKdMainLib.F2
|
||||
public struct Light : System.IDisposable
|
||||
{
|
||||
private int i, i0;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
private Header header;
|
||||
|
||||
public CountPointer<CountPointer<LIT>> LITs;
|
||||
@@ -15,61 +15,51 @@ namespace KKdMainLib.F2
|
||||
public void LITReader(string file)
|
||||
{
|
||||
LITs = default;
|
||||
_IO = File.OpenReader(file + ".lit", true);
|
||||
header = _IO.ReadHeader();
|
||||
s = File.OpenReader(file + ".lit", true);
|
||||
header = s.ReadHeader();
|
||||
if (header.Signature != 0x4354494C || header.InnerSignature != 0x2 ||
|
||||
header.SectionSignature != 0x2) return;
|
||||
|
||||
LITs = _IO.RCPE<CountPointer<LIT>>();
|
||||
if (LITs.C < 1) { _IO.C(); LITs.C = -1; return; }
|
||||
LITs = s.RCPE<CountPointer<LIT>>();
|
||||
if (LITs.C < 1) { s.C(); LITs.C = -1; return; }
|
||||
|
||||
_IO.P = LITs.O;
|
||||
s.P = LITs.O;
|
||||
for (i = 0; i < LITs.C; i++)
|
||||
{
|
||||
LITs[i] = _IO.RCPX<LIT>();
|
||||
if ((LITs[i].C > 0 || LITs[i].O == 0) && !_IO.IsX) { _IO.C(); LITs.C = -1; return; }
|
||||
/*{
|
||||
_IO.Format = Header.Format = Format.X;
|
||||
_IO.Offset = Header.Length;
|
||||
_IO.Position = LITs.Offset;
|
||||
LITs[i] = _IO.ReadCountPointerX<LIT>();
|
||||
}
|
||||
if (_IO.IsX) IO.ReadInt64();*/
|
||||
LITs[i] = s.RCPX<LIT>();
|
||||
if ((LITs[i].C > 0 || LITs[i].O == 0) && !s.IsX) { s.C(); LITs.C = -1; return; }
|
||||
}
|
||||
|
||||
for (i = 0; i < LITs.C; i++)
|
||||
{
|
||||
_IO.P = LITs[i].O;
|
||||
s.P = LITs[i].O;
|
||||
for (i0 = 0; i0 < LITs[i].C; i0++)
|
||||
{
|
||||
ref LIT lit = ref LITs.E[i].E[i0];
|
||||
lit.Id = (Id )_IO.RI32E();
|
||||
lit.Flags = (Flags)_IO.RI32E();
|
||||
lit.Type = (Type )_IO.RI32E();
|
||||
if (_IO.IsX) { _IO.RI64(); _IO.RI64(); _IO.RI64(); }
|
||||
lit.Ambient .X = _IO.RF32E();
|
||||
lit.Ambient .Y = _IO.RF32E();
|
||||
lit.Ambient .Z = _IO.RF32E();
|
||||
lit.Ambient .W = _IO.RF32E();
|
||||
lit.Diffuse .X = _IO.RF32E();
|
||||
lit.Diffuse .Y = _IO.RF32E();
|
||||
lit.Diffuse .Z = _IO.RF32E();
|
||||
lit.Diffuse .W = _IO.RF32E();
|
||||
lit.Specular .X = _IO.RF32E();
|
||||
lit.Specular .Y = _IO.RF32E();
|
||||
lit.Specular .Z = _IO.RF32E();
|
||||
lit.Specular .W = _IO.RF32E();
|
||||
lit.Position .X = _IO.RF32E();
|
||||
lit.Position .Y = _IO.RF32E();
|
||||
lit.Position .Z = _IO.RF32E();
|
||||
lit.ToneCurve.X = _IO.RF32E();
|
||||
lit.ToneCurve.Y = _IO.RF32E();
|
||||
lit.ToneCurve.Z = _IO.RF32E();
|
||||
if (_IO.IsX) { _IO.RI64(); _IO.RI64(); _IO.RI64();
|
||||
_IO.RI64(); _IO.RI64(); _IO.RI32(); }
|
||||
lit.Id = (Id )s.RI32E();
|
||||
lit.Flags = (Flags)s.RI32E();
|
||||
lit.Type = (Type )s.RI32E();
|
||||
lit.Ambient .X = s.RF32E();
|
||||
lit.Ambient .Y = s.RF32E();
|
||||
lit.Ambient .Z = s.RF32E();
|
||||
lit.Ambient .W = s.RF32E();
|
||||
lit.Diffuse .X = s.RF32E();
|
||||
lit.Diffuse .Y = s.RF32E();
|
||||
lit.Diffuse .Z = s.RF32E();
|
||||
lit.Diffuse .W = s.RF32E();
|
||||
lit.Specular .X = s.RF32E();
|
||||
lit.Specular .Y = s.RF32E();
|
||||
lit.Specular .Z = s.RF32E();
|
||||
lit.Specular .W = s.RF32E();
|
||||
lit.Position .X = s.RF32E();
|
||||
lit.Position .Y = s.RF32E();
|
||||
lit.Position .Z = s.RF32E();
|
||||
lit.ToneCurve.X = s.RF32E();
|
||||
lit.ToneCurve.Y = s.RF32E();
|
||||
lit.ToneCurve.Z = s.RF32E();
|
||||
}
|
||||
}
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void TXTWriter(string file)
|
||||
@@ -77,13 +67,13 @@ namespace KKdMainLib.F2
|
||||
i = 0;
|
||||
if (LITs.C < 1) return;
|
||||
|
||||
_IO = File.OpenWriter();
|
||||
_IO.WPSSJIS("Type,AmbientR,AmbientG,AmbientB,DiffuseR,DiffuseG,DiffuseB,SpecularR,SpecularG," +
|
||||
s = File.OpenWriter();
|
||||
s.WPSSJIS("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].C; i0++)
|
||||
_IO.W(LITs[i][i0] + "," + i + "\n");
|
||||
File.WriteAllBytes(file + "_light.txt", _IO.ToArray(true));
|
||||
s.W($"{LITs[i][i0]},{i}\n");
|
||||
File.WriteAllBytes($"{file}_light.txt", s.ToArray(true));
|
||||
}
|
||||
|
||||
public struct LIT
|
||||
@@ -97,17 +87,22 @@ namespace KKdMainLib.F2
|
||||
public Vec3 Position;
|
||||
public Vec3 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 override string ToString() => Flags == 0 ? ",,,,,,,,,,,,,,,," : $"{Type}," +
|
||||
((Flags & Flags.Ambient ) != 0
|
||||
? $"{Ambient .X.ToS(6)},{Ambient .Y.ToS(6)},{Ambient .Z.ToS(6)}," : ",,,") +
|
||||
((Flags & Flags.Diffuse ) != 0
|
||||
? $"{Diffuse .X.ToS(6)},{Diffuse .Y.ToS(6)},{Diffuse .Z.ToS(6)}," : ",,,") +
|
||||
((Flags & Flags.Specular ) != 0
|
||||
? $"{Specular .X.ToS(6)},{Specular .Y.ToS(6)},{Specular .Z.ToS(6)},{Specular .W.ToS(6)}," : ",,,,") +
|
||||
((Flags & Flags.Position ) != 0
|
||||
? $"{Position .X.ToS(6)},{Position .Y.ToS(6)},{Position .Z.ToS(6)}," : ",,,") +
|
||||
((Flags & Flags.ToneCurve) != 0
|
||||
? $"{ToneCurve.X.ToS(6)},{ToneCurve.Y.ToS(6)},{ToneCurve.Z.ToS(6)}" : ",,");
|
||||
}
|
||||
|
||||
private bool disposed;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; LITs = default; header = default; disposed = true; } }
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; LITs = default; header = default; disposed = true; } }
|
||||
|
||||
public enum Id : int
|
||||
{
|
||||
|
||||
+2
-4
@@ -14,9 +14,7 @@ namespace KKdMainLib
|
||||
public FARC(string file, bool isDirectory = false)
|
||||
{ if (isDirectory) DirectoryPath = file; else FilePath = file; NewFARC(); }
|
||||
|
||||
private void NewFARC() { if (!MSIO.File.Exists("libdeflate.dll"))
|
||||
File.WriteAllBytes("libdeflate.dll", Properties.Resources.libdeflate);
|
||||
Files = KKdList<FARCFile>.New; Signature = Farc.FArC; Format = Format.DT; }
|
||||
private void NewFARC() { Files = KKdList<FARCFile>.New; Signature = Farc.FArC; Format = Format.DT; }
|
||||
|
||||
public KKdList<FARCFile> Files = KKdList<FARCFile>.New;
|
||||
public Type FARCType;
|
||||
@@ -26,7 +24,7 @@ namespace KKdMainLib
|
||||
public bool HasFiles => Files.IsNull ? false : Files.Count > 0;
|
||||
public int CompressionLevel = 12;
|
||||
|
||||
private readonly byte[] key = Text.ToASCII("project_diva.bin");
|
||||
private readonly byte[] key = "project_diva.bin".ToASCII();
|
||||
|
||||
private readonly byte[] keyFT = { 0x13, 0x72, 0xD5, 0x7B, 0x6E, 0x9E,
|
||||
0x31, 0xEB, 0xA2, 0x39, 0xB8, 0x3C, 0x15, 0x57, 0xC6, 0xBB };
|
||||
|
||||
@@ -8,8 +8,17 @@ namespace KKdMainLib.IO
|
||||
|
||||
private const string libDeflateString = "libdeflate.dll";
|
||||
|
||||
public static void CheckLib()
|
||||
{
|
||||
if (!File.Exists(libDeflateString))
|
||||
File.WriteAllBytes(libDeflateString, Properties.Resources.libdeflate);
|
||||
HasFile = true;
|
||||
}
|
||||
|
||||
public static byte[] Deflate(this byte[] data, long compressionLevel)
|
||||
{
|
||||
CheckLib();
|
||||
|
||||
void* c = libdeflate_alloc_compressor((int)compressionLevel);
|
||||
int maxOutBytes = libdeflate_deflate_compress_bound(c, data.Length);
|
||||
byte[] outData = new byte[maxOutBytes];
|
||||
@@ -24,18 +33,19 @@ namespace KKdMainLib.IO
|
||||
|
||||
public static byte[] Inflate(this byte[] data, long length)
|
||||
{
|
||||
CheckLib();
|
||||
|
||||
byte[] outData = new byte[length];
|
||||
|
||||
int actualOut = 0;
|
||||
void* d = libdeflate_alloc_decompressor();
|
||||
fixed (byte* inPtr = data)
|
||||
fixed (byte* outPtr = outData)
|
||||
libdeflate_deflate_decompress(d, inPtr, data.Length, outPtr, (int)length, (byte*)&actualOut);
|
||||
libdeflate_deflate_decompress(d, inPtr, data.Length, outPtr, (int)length, &actualOut);
|
||||
libdeflate_free_decompressor(d);
|
||||
|
||||
if (actualOut == 0 || actualOut > length)
|
||||
throw new System.Exception("DeflateInflate Error: specified input length" +
|
||||
" is less than it should be for current Deflate data");
|
||||
return data.Inflate(length * 2);
|
||||
else if (actualOut < length)
|
||||
System.Array.Resize(ref outData, (int)actualOut);
|
||||
return outData;
|
||||
@@ -43,8 +53,10 @@ namespace KKdMainLib.IO
|
||||
|
||||
public static byte[] DeflateGZip(this byte[] data, long compressionLevel)
|
||||
{
|
||||
CheckLib();
|
||||
|
||||
void* c = libdeflate_alloc_compressor((int)compressionLevel);
|
||||
int maxOutBytes = libdeflate_deflate_compress_bound(c, data.Length);
|
||||
int maxOutBytes = libdeflate_gzip_compress_bound(c, data.Length);
|
||||
byte[] outData = new byte[maxOutBytes];
|
||||
int actualOut = 0;
|
||||
fixed (byte* inPtr = data)
|
||||
@@ -57,18 +69,19 @@ namespace KKdMainLib.IO
|
||||
|
||||
public static byte[] InflateGZip(this byte[] data, long length)
|
||||
{
|
||||
CheckLib();
|
||||
|
||||
byte[] outData = new byte[length];
|
||||
|
||||
int actualOut = 0;
|
||||
void* d = libdeflate_alloc_decompressor();
|
||||
fixed (byte* inPtr = data)
|
||||
fixed (byte* outPtr = outData)
|
||||
libdeflate_gzip_decompress(d, inPtr, data.Length, outPtr, (int)length, (byte*)&actualOut);
|
||||
libdeflate_gzip_decompress(d, inPtr, data.Length, outPtr, (int)length, &actualOut);
|
||||
libdeflate_free_decompressor(d);
|
||||
|
||||
if (actualOut == 0 || actualOut > length)
|
||||
throw new System.Exception("DeflateInflate Error: specified input length" +
|
||||
" is less than it should be for current Deflate data");
|
||||
return data.InflateGZip(length * 2);
|
||||
else if (actualOut < length)
|
||||
System.Array.Resize(ref outData, (int)actualOut);
|
||||
return outData;
|
||||
@@ -76,8 +89,10 @@ namespace KKdMainLib.IO
|
||||
|
||||
public static byte[] DeflateZLib(this byte[] data, long compressionLevel)
|
||||
{
|
||||
CheckLib();
|
||||
|
||||
void* c = libdeflate_alloc_compressor((int)compressionLevel);
|
||||
int maxOutBytes = libdeflate_deflate_compress_bound(c, data.Length);
|
||||
int maxOutBytes = libdeflate_zlib_compress_bound(c, data.Length);
|
||||
byte[] outData = new byte[maxOutBytes];
|
||||
int actualOut = 0;
|
||||
fixed (byte* inPtr = data)
|
||||
@@ -90,18 +105,19 @@ namespace KKdMainLib.IO
|
||||
|
||||
public static byte[] InflateZLib(this byte[] data, long length)
|
||||
{
|
||||
CheckLib();
|
||||
|
||||
byte[] outData = new byte[length];
|
||||
|
||||
int actualOut = 0;
|
||||
void* d = libdeflate_alloc_decompressor();
|
||||
fixed (byte* inPtr = data)
|
||||
fixed (byte* outPtr = outData)
|
||||
libdeflate_zlib_decompress(d, inPtr, data.Length, outPtr, (int)length, (byte*)&actualOut);
|
||||
libdeflate_zlib_decompress(d, inPtr, data.Length, outPtr, (int)length, &actualOut);
|
||||
libdeflate_free_decompressor(d);
|
||||
|
||||
if (actualOut == 0 || actualOut > length)
|
||||
throw new System.Exception("DeflateInflate Error: specified input length" +
|
||||
" is less than it should be for current Deflate data");
|
||||
return data.InflateZLib(length * 2);
|
||||
else if (actualOut < length)
|
||||
System.Array.Resize(ref outData, (int)actualOut);
|
||||
return outData;
|
||||
@@ -122,11 +138,11 @@ namespace KKdMainLib.IO
|
||||
|
||||
[DllImport(libDeflateString)]
|
||||
private static extern void libdeflate_deflate_decompress(void* d, byte* inData, int inBytes,
|
||||
byte* outData, int outBytesAvail, byte* actualOutBytes);
|
||||
byte* outData, int outBytesAvail, int* actualOutBytes);
|
||||
|
||||
[DllImport(libDeflateString)]
|
||||
private static extern void libdeflate_deflate_decompress_ex(void* d, byte* inData, int inBytes,
|
||||
byte* outData, int outBytesAvail, byte* actualInBytes, byte* actualOutBytes);
|
||||
byte* outData, int outBytesAvail, int* actualInBytes, int* actualOutBytes);
|
||||
|
||||
[DllImport(libDeflateString)]
|
||||
private static extern int libdeflate_gzip_compress_bound(void* c, int length);
|
||||
@@ -137,11 +153,11 @@ namespace KKdMainLib.IO
|
||||
|
||||
[DllImport(libDeflateString)]
|
||||
private static extern void libdeflate_gzip_decompress(void* d, byte* inData, int inBytes,
|
||||
byte* outData, int outBytesAvail, byte* actualOutBytes);
|
||||
byte* outData, int outBytesAvail, int* actualOutBytes);
|
||||
|
||||
[DllImport(libDeflateString)]
|
||||
private static extern void libdeflate_gzip_decompress_ex(void* d, byte* inData, int inBytes,
|
||||
byte* outData, int outBytesAvail, byte* actualInBytes, byte* actualOutBytes);
|
||||
byte* outData, int outBytesAvail, int* actualInBytes, int* actualOutBytes);
|
||||
|
||||
[DllImport(libDeflateString)]
|
||||
private static extern int libdeflate_zlib_compress_bound(void* c, int length);
|
||||
@@ -152,7 +168,7 @@ namespace KKdMainLib.IO
|
||||
|
||||
[DllImport(libDeflateString)]
|
||||
private static extern void libdeflate_zlib_decompress(void* d, byte* inData, int inBytes,
|
||||
byte* outData, int outBytesAvail, byte* actualOutBytes);
|
||||
byte* outData, int outBytesAvail, int* actualOutBytes);
|
||||
|
||||
[DllImport(libDeflateString)]
|
||||
private static extern void libdeflate_free_compressor(void* c);
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace KKdMainLib.IO
|
||||
if (a == end) break;
|
||||
else s.Add(a);
|
||||
}
|
||||
s.Capacity = s.Count;
|
||||
return s.ToArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace KKdMainLib.IO
|
||||
|
||||
public static void WriteAllLines(string file, string[] data)
|
||||
{ using Stream _IO = OpenWriter(file, true);
|
||||
if (data != null) for (int i = 0; i < data.Length; i++)
|
||||
{ if (data[i] != null) _IO.W(data[i]); } _IO.W("\r\n"); }
|
||||
if (data != null) { int c = data.Length; for (int i = 0; i < c; i++)
|
||||
{ if (data[i] != null) _IO.W(data[i]); if (i + 1 < c) _IO.W("\n"); } } }
|
||||
|
||||
public static void WriteAllBytes(string file, byte[] data, long length)
|
||||
{ using Stream _IO = OpenWriter(file, true); if (data != null) { _IO.W(data); _IO.LI64 = length; } }
|
||||
@@ -70,8 +70,8 @@ namespace KKdMainLib.IO
|
||||
|
||||
public static void WriteAllLines(string file, string[] data, long length)
|
||||
{ using Stream _IO = OpenWriter(file, true);
|
||||
if (data != null) for (int i = 0; i < data.Length; i++)
|
||||
{ if (data[i] != null) _IO.W(data[i]); _IO.W("\r\n"); } _IO.LI64 = length; }
|
||||
if (data != null) { int c = data.Length; for (int i = 0; i < c; i++)
|
||||
{ if (data[i] != null) _IO.W(data[i]); if (i + 1 < c) _IO.W("\n"); } _IO.LI64 = length; } }
|
||||
|
||||
public static bool Exists(string file) =>
|
||||
MSIOF.Exists(file);
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace KKdMainLib.IO
|
||||
else if (c == ',') { _IO.RCUTF8(); continue; }
|
||||
else return KKdList<MsgPack>.Null;
|
||||
}
|
||||
|
||||
obj.Capacity = obj.Count;
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ namespace KKdMainLib.IO
|
||||
else if (c == ',') { _IO.RCUTF8(); continue; }
|
||||
else return null;
|
||||
}
|
||||
obj.Capacity = obj.Count;
|
||||
return obj.ToArray();
|
||||
}
|
||||
|
||||
|
||||
+55
-81
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using KKdBaseLib;
|
||||
using MSIO = System.IO;
|
||||
using ENRSDict = System.Collections.Generic.Dictionary<long, int>;
|
||||
using ENRSDict = System.Collections.Generic.Dictionary<long, byte>;
|
||||
|
||||
namespace KKdMainLib.IO
|
||||
{
|
||||
@@ -95,12 +95,12 @@ namespace KKdMainLib.IO
|
||||
if (P % align != 0) s.Seek(P + O + Al, 0);
|
||||
}
|
||||
|
||||
public void A(long align, bool SetLength)
|
||||
public void A(long align, bool setLength)
|
||||
{
|
||||
if (SetLength) s.SetLength(P + O);
|
||||
if (setLength) s.SetLength(P + O);
|
||||
long Al = align - P % align;
|
||||
if (P % align != 0) s.Seek(P + O + Al, 0);
|
||||
if (SetLength) s.SetLength(P + O);
|
||||
if (setLength) s.SetLength(P + O);
|
||||
}
|
||||
|
||||
public void A(long align, bool setLength0, bool setLength1)
|
||||
@@ -199,65 +199,65 @@ namespace KKdMainLib.IO
|
||||
public void WE( float val, bool isBE) { cW(); b.GBy(val); b.E(4, isBE); s.Write(b, 0, 4); }
|
||||
public void WE(double val, bool isBE) { cW(); b.GBy(val); b.E(8, isBE); s.Write(b, 0, 8); }
|
||||
|
||||
private void RENRS(byte[] b, int c)
|
||||
private void RENRS(byte c)
|
||||
{ cR(); if (getENRS) ENRSDict.Add(P, c); s.Read(b, 0, c); }
|
||||
|
||||
public short RI16ENRS() { RENRS(b, 2); return b.TI16(); }
|
||||
public ushort RU16ENRS() { RENRS(b, 2); return b.TU16(); }
|
||||
public int RI32ENRS() { RENRS(b, 4); return b.TI32(); }
|
||||
public uint RU32ENRS() { RENRS(b, 4); return b.TU32(); }
|
||||
public long RI64ENRS() { RENRS(b, 8); return b.TI64(); }
|
||||
public ulong RU64ENRS() { RENRS(b, 8); return b.TU64(); }
|
||||
public float RF32ENRS() { RENRS(b, 4); return b.TF32(); }
|
||||
public double RF64ENRS() { RENRS(b, 8); return b.TF64(); }
|
||||
public short RI16ENRS() { RENRS((byte)2); return b.TI16(); }
|
||||
public ushort RU16ENRS() { RENRS((byte)2); return b.TU16(); }
|
||||
public int RI32ENRS() { RENRS((byte)4); return b.TI32(); }
|
||||
public uint RU32ENRS() { RENRS((byte)4); return b.TU32(); }
|
||||
public long RI64ENRS() { RENRS((byte)8); return b.TI64(); }
|
||||
public ulong RU64ENRS() { RENRS((byte)8); return b.TU64(); }
|
||||
public float RF32ENRS() { RENRS((byte)4); return b.TF32(); }
|
||||
public double RF64ENRS() { RENRS((byte)8); return b.TF64(); }
|
||||
|
||||
public short RI16ENRSE() { RENRS(b, 2); b.E(2, IsBE); return b.TI16(); }
|
||||
public ushort RU16ENRSE() { RENRS(b, 2); b.E(2, IsBE); return b.TU16(); }
|
||||
public int RI32ENRSE() { RENRS(b, 4); b.E(4, IsBE); return b.TI32(); }
|
||||
public uint RU32ENRSE() { RENRS(b, 4); b.E(4, IsBE); return b.TU32(); }
|
||||
public long RI64ENRSE() { RENRS(b, 8); b.E(8, IsBE); return b.TI64(); }
|
||||
public ulong RU64ENRSE() { RENRS(b, 8); b.E(8, IsBE); return b.TU64(); }
|
||||
public float RF32ENRSE() { RENRS(b, 4); b.E(4, IsBE); return b.TF32(); }
|
||||
public double RF64ENRSE() { RENRS(b, 8); b.E(8, IsBE); return b.TF64(); }
|
||||
public short RI16ENRSE() { RENRS((byte)2); b.E(2, IsBE); return b.TI16(); }
|
||||
public ushort RU16ENRSE() { RENRS((byte)2); b.E(2, IsBE); return b.TU16(); }
|
||||
public int RI32ENRSE() { RENRS((byte)4); b.E(4, IsBE); return b.TI32(); }
|
||||
public uint RU32ENRSE() { RENRS((byte)4); b.E(4, IsBE); return b.TU32(); }
|
||||
public long RI64ENRSE() { RENRS((byte)8); b.E(8, IsBE); return b.TI64(); }
|
||||
public ulong RU64ENRSE() { RENRS((byte)8); b.E(8, IsBE); return b.TU64(); }
|
||||
public float RF32ENRSE() { RENRS((byte)4); b.E(4, IsBE); return b.TF32(); }
|
||||
public double RF64ENRSE() { RENRS((byte)8); b.E(8, IsBE); return b.TF64(); }
|
||||
|
||||
public short RI16ENRSE(bool isBE) { RENRS(b, 2); b.E(2, isBE); return b.TI16(); }
|
||||
public ushort RU16ENRSE(bool isBE) { RENRS(b, 2); b.E(2, isBE); return b.TU16(); }
|
||||
public int RI32ENRSE(bool isBE) { RENRS(b, 4); b.E(4, isBE); return b.TI32(); }
|
||||
public uint RU32ENRSE(bool isBE) { RENRS(b, 4); b.E(4, isBE); return b.TU32(); }
|
||||
public long RI64ENRSE(bool isBE) { RENRS(b, 8); b.E(8, isBE); return b.TI64(); }
|
||||
public ulong RU64ENRSE(bool isBE) { RENRS(b, 8); b.E(8, isBE); return b.TU64(); }
|
||||
public float RF32ENRSE(bool isBE) { RENRS(b, 4); b.E(4, isBE); return b.TF32(); }
|
||||
public double RF64ENRSE(bool isBE) { RENRS(b, 8); b.E(8, isBE); return b.TF64(); }
|
||||
public short RI16ENRSE(bool isBE) { RENRS((byte)2); b.E(2, isBE); return b.TI16(); }
|
||||
public ushort RU16ENRSE(bool isBE) { RENRS((byte)2); b.E(2, isBE); return b.TU16(); }
|
||||
public int RI32ENRSE(bool isBE) { RENRS((byte)4); b.E(4, isBE); return b.TI32(); }
|
||||
public uint RU32ENRSE(bool isBE) { RENRS((byte)4); b.E(4, isBE); return b.TU32(); }
|
||||
public long RI64ENRSE(bool isBE) { RENRS((byte)8); b.E(8, isBE); return b.TI64(); }
|
||||
public ulong RU64ENRSE(bool isBE) { RENRS((byte)8); b.E(8, isBE); return b.TU64(); }
|
||||
public float RF32ENRSE(bool isBE) { RENRS((byte)4); b.E(4, isBE); return b.TF32(); }
|
||||
public double RF64ENRSE(bool isBE) { RENRS((byte)8); b.E(8, isBE); return b.TF64(); }
|
||||
|
||||
private void WENRS(byte[] b, int c)
|
||||
{ if (getENRS) ENRSDict.Add(P, c); cR(); s.Write(b, 0, c); }
|
||||
private void WENRS(byte c)
|
||||
{ if (getENRS) ENRSDict.Add(P, c); cW(); s.Write(b, 0, c); }
|
||||
|
||||
public void WENRS( short val) { b.GBy(val); WENRS(b, 2); }
|
||||
public void WENRS(ushort val) { b.GBy(val); WENRS(b, 2); }
|
||||
public void WENRS( int val) { b.GBy(val); WENRS(b, 4); }
|
||||
public void WENRS( uint val) { b.GBy(val); WENRS(b, 4); }
|
||||
public void WENRS( long val) { b.GBy(val); WENRS(b, 8); }
|
||||
public void WENRS( ulong val) { b.GBy(val); WENRS(b, 8); }
|
||||
public void WENRS( float val) { b.GBy(val); WENRS(b, 4); }
|
||||
public void WENRS(double val) { b.GBy(val); WENRS(b, 8); }
|
||||
public void WENRS( short val) { b.GBy(val); WENRS((byte)2); }
|
||||
public void WENRS(ushort val) { b.GBy(val); WENRS((byte)2); }
|
||||
public void WENRS( int val) { b.GBy(val); WENRS((byte)4); }
|
||||
public void WENRS( uint val) { b.GBy(val); WENRS((byte)4); }
|
||||
public void WENRS( long val) { b.GBy(val); WENRS((byte)8); }
|
||||
public void WENRS( ulong val) { b.GBy(val); WENRS((byte)8); }
|
||||
public void WENRS( float val) { b.GBy(val); WENRS((byte)4); }
|
||||
public void WENRS(double val) { b.GBy(val); WENRS((byte)8); }
|
||||
|
||||
public void WENRSE( short val) { b.GBy(val); b.E(2, IsBE); WENRS(b, 2); }
|
||||
public void WENRSE(ushort val) { b.GBy(val); b.E(2, IsBE); WENRS(b, 2); }
|
||||
public void WENRSE( int val) { b.GBy(val); b.E(4, IsBE); WENRS(b, 4); }
|
||||
public void WENRSE( uint val) { b.GBy(val); b.E(4, IsBE); WENRS(b, 4); }
|
||||
public void WENRSE( long val) { b.GBy(val); b.E(8, IsBE); WENRS(b, 8); }
|
||||
public void WENRSE( ulong val) { b.GBy(val); b.E(8, IsBE); WENRS(b, 8); }
|
||||
public void WENRSE( float val) { b.GBy(val); b.E(4, IsBE); WENRS(b, 4); }
|
||||
public void WENRSE(double val) { b.GBy(val); b.E(8, IsBE); WENRS(b, 8); }
|
||||
public void WENRSE( short val) { b.GBy(val); b.E(2, IsBE); WENRS((byte)2); }
|
||||
public void WENRSE(ushort val) { b.GBy(val); b.E(2, IsBE); WENRS((byte)2); }
|
||||
public void WENRSE( int val) { b.GBy(val); b.E(4, IsBE); WENRS((byte)4); }
|
||||
public void WENRSE( uint val) { b.GBy(val); b.E(4, IsBE); WENRS((byte)4); }
|
||||
public void WENRSE( long val) { b.GBy(val); b.E(8, IsBE); WENRS((byte)8); }
|
||||
public void WENRSE( ulong val) { b.GBy(val); b.E(8, IsBE); WENRS((byte)8); }
|
||||
public void WENRSE( float val) { b.GBy(val); b.E(4, IsBE); WENRS((byte)4); }
|
||||
public void WENRSE(double val) { b.GBy(val); b.E(8, IsBE); WENRS((byte)8); }
|
||||
|
||||
public void WENRSE( short val, bool isBE) { b.GBy(val); b.E(2, isBE); WENRS(b, 2); }
|
||||
public void WENRSE(ushort val, bool isBE) { b.GBy(val); b.E(2, isBE); WENRS(b, 2); }
|
||||
public void WENRSE( int val, bool isBE) { b.GBy(val); b.E(4, isBE); WENRS(b, 4); }
|
||||
public void WENRSE( uint val, bool isBE) { b.GBy(val); b.E(4, isBE); WENRS(b, 4); }
|
||||
public void WENRSE( long val, bool isBE) { b.GBy(val); b.E(8, isBE); WENRS(b, 8); }
|
||||
public void WENRSE( ulong val, bool isBE) { b.GBy(val); b.E(8, isBE); WENRS(b, 8); }
|
||||
public void WENRSE( float val, bool isBE) { b.GBy(val); b.E(4, isBE); WENRS(b, 4); }
|
||||
public void WENRSE(double val, bool isBE) { b.GBy(val); b.E(8, isBE); WENRS(b, 8); }
|
||||
public void WENRSE( short val, bool isBE) { b.GBy(val); b.E(2, isBE); WENRS((byte)2); }
|
||||
public void WENRSE(ushort val, bool isBE) { b.GBy(val); b.E(2, isBE); WENRS((byte)2); }
|
||||
public void WENRSE( int val, bool isBE) { b.GBy(val); b.E(4, isBE); WENRS((byte)4); }
|
||||
public void WENRSE( uint val, bool isBE) { b.GBy(val); b.E(4, isBE); WENRS((byte)4); }
|
||||
public void WENRSE( long val, bool isBE) { b.GBy(val); b.E(8, isBE); WENRS((byte)8); }
|
||||
public void WENRSE( ulong val, bool isBE) { b.GBy(val); b.E(8, isBE); WENRS((byte)8); }
|
||||
public void WENRSE( float val, bool isBE) { b.GBy(val); b.E(4, isBE); WENRS((byte)4); }
|
||||
public void WENRSE(double val, bool isBE) { b.GBy(val); b.E(8, isBE); WENRS((byte)8); }
|
||||
|
||||
public int RI24 ( ) { cR(); s.Read(b, 0, 3); return b.TI24(); }
|
||||
public uint RU24 ( ) { cR(); s.Read(b, 0, 3); return b.TU24(); }
|
||||
@@ -301,32 +301,6 @@ namespace KKdMainLib.IO
|
||||
public void WE(Quat val ) { cW(); b.GBy(val); b.E(16, IsBE); s.Write(b, 0, 16); }
|
||||
public void WE(Quat val, bool isBE) { cW(); b.GBy(val); b.E(16, isBE); s.Write(b, 0, 16); }
|
||||
|
||||
public T RT<T>(long offset = -1) where T : unmanaged
|
||||
{
|
||||
cR();
|
||||
int sizeOfT = sizeof(T);
|
||||
if (offset > -1) s.Position = offset;
|
||||
byte[] buf = new byte[sizeOfT];
|
||||
fixed (byte* ptr = buf)
|
||||
{
|
||||
cR(); s.Read(buf, 0, sizeOfT);
|
||||
return *(T*)ptr;
|
||||
}
|
||||
}
|
||||
|
||||
public void WT<T>(T val, long offset = -1) where T : unmanaged
|
||||
{
|
||||
cR();
|
||||
int sizeOfT = sizeof(T);
|
||||
if (offset > -1) s.Position = offset;
|
||||
byte[] buf = new byte[sizeOfT];
|
||||
fixed (byte* ptr = buf)
|
||||
{
|
||||
*(T*)ptr = val;
|
||||
s.Write(buf, 0, sizeOfT);
|
||||
}
|
||||
}
|
||||
|
||||
public T[] RA<T>(long length, long offset = -1) where T : unmanaged
|
||||
{
|
||||
cR();
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<Authors>korenkonder</Authors>
|
||||
<Company></Company>
|
||||
<Configuration></Configuration>
|
||||
<Copyright>korenkonder © 2018-2020</Copyright>
|
||||
<Copyright>korenkonder (C) 2018-2020</Copyright>
|
||||
<Description>A simple library for working with Project Diva AC/DT/F/AFT/F2/X/FT/M39 files</Description>
|
||||
<FileVersion>0.4.9.4</FileVersion>
|
||||
<FileVersion>0.4.9.8</FileVersion>
|
||||
<PackageId>KKdMainLib</PackageId>
|
||||
<Product>KKdMainLib</Product>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
<Title>KKdMainLib</Title>
|
||||
<Version>0.4.9.4</Version>
|
||||
<Version>0.4.9.8</Version>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -24,7 +24,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
|
||||
<NoWarn>IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -37,7 +37,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
|
||||
<NoWarn>IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KKdBaseLib\KKdBaseLib.csproj" />
|
||||
|
||||
+130
-106
@@ -9,28 +9,30 @@ namespace KKdMainLib
|
||||
{
|
||||
private int i, i0, i1;
|
||||
public MotHeader[] MOT;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
|
||||
[System.ThreadStatic] public bool Modern;
|
||||
|
||||
public void MOTReader(string file)
|
||||
{
|
||||
_IO = File.OpenReader(file + ".bin");
|
||||
s = File.OpenReader(file + ".bin");
|
||||
|
||||
i = 0;
|
||||
while (true)
|
||||
if (_IO.RI64() == 0) break;
|
||||
else { _IO.RI64(); i++; }
|
||||
if (s.RI64() == 0) break;
|
||||
else { s.RI64(); i++; }
|
||||
if (i == 0) return;
|
||||
|
||||
_IO.P = 0;
|
||||
s.P = 0;
|
||||
int motCount = i;
|
||||
MOT = new MotHeader[motCount];
|
||||
for (i = 0; i < motCount; i++)
|
||||
{
|
||||
ref MotHeader mot = ref MOT[i];
|
||||
mot.KeySet .O = _IO.RI32();
|
||||
mot.KeySetTypesOffset = _IO.RI32();
|
||||
mot. KeySetOffset = _IO.RI32();
|
||||
mot.BoneInfo .O = _IO.RI32();
|
||||
mot.KeySet .O = s.RI32();
|
||||
mot.KeySetTypesOffset = s.RI32();
|
||||
mot. KeySetOffset = s.RI32();
|
||||
mot.BoneInfo .O = s.RI32();
|
||||
}
|
||||
|
||||
for (i = 0; i < motCount; i++)
|
||||
@@ -38,128 +40,158 @@ namespace KKdMainLib
|
||||
ref MotHeader mot = ref MOT[i];
|
||||
|
||||
i0 = 1;
|
||||
_IO.P = mot.BoneInfo.O;
|
||||
_IO.RU16();
|
||||
while (_IO.RU16() != 0) i0++;
|
||||
s.P = mot.BoneInfo.O;
|
||||
s.RU16();
|
||||
while (s.P < s.L && s.RU16() != 0) i0++;
|
||||
|
||||
mot.BoneInfo.V = new BoneInfo[i0];
|
||||
_IO.P = mot.BoneInfo.O;
|
||||
mot.BoneInfo.V = new int[i0];
|
||||
s.P = mot.BoneInfo.O;
|
||||
for (i0 = 0; i0 < mot.BoneInfo.V.Length; i0++)
|
||||
mot.BoneInfo.V[i0].Id = _IO.RU16();
|
||||
mot.BoneInfo.V[i0] = s.RU16();
|
||||
|
||||
_IO.P = mot.KeySet.O;
|
||||
int info = _IO.RU16();
|
||||
s.P = mot.KeySet.O;
|
||||
int info = s.RU16();
|
||||
mot.HighBits = info >> 14;
|
||||
mot.FrameCount = _IO.RU16();
|
||||
mot.FrameCount = s.RU16();
|
||||
|
||||
mot.KeySet.V = new KeySet[info & 0x3FFF];
|
||||
_IO.P = mot.KeySetTypesOffset;
|
||||
s.P = mot.KeySetTypesOffset;
|
||||
for (i0 = 0; i0 < mot.KeySet.V.Length; i0++)
|
||||
{
|
||||
if (i0 % 8 == 0) i1 = _IO.RU16();
|
||||
if (i0 % 8 == 0) i1 = s.RU16();
|
||||
mot.KeySet.V[i0] = new KeySet { Type = (KeySetType)((i1 >> (i0 % 8 * 2)) & 0b11) };
|
||||
}
|
||||
|
||||
_IO.P = mot.KeySetOffset;
|
||||
s.P = mot.KeySetOffset;
|
||||
for (i0 = 0; i0 < mot.KeySet.V.Length; i0++)
|
||||
{
|
||||
ref KeySet key = ref mot.KeySet.V[i0];
|
||||
if (key.Type == KeySetType.Static)
|
||||
{ key.Keys = new KFT2[1];
|
||||
key.Keys[0].V = _IO.RF32(); }
|
||||
else if (key.Type == KeySetType.Linear)
|
||||
key.Keys[0].V = s.RF32(); }
|
||||
else if (key.Type == KeySetType.Linear && !Modern)
|
||||
{
|
||||
key.Keys = new KFT2[_IO.RU16()];
|
||||
key.Keys = new KFT2[s.RU16()];
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
key.Keys[i1].F = _IO.RU16();
|
||||
_IO.A(0x4);
|
||||
key.Keys[i1].F = s.RU16();
|
||||
s.A(0x4);
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
key.Keys[i1].V = _IO.RF32();
|
||||
key.Keys[i1].V = s.RF32();
|
||||
}
|
||||
else if (key.Type == KeySetType.Interpolated)
|
||||
else if (key.Type == KeySetType.Tangent && !Modern)
|
||||
{
|
||||
key.Keys = new KFT2[_IO.RU16()];
|
||||
key.Keys = new KFT2[s.RU16()];
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
key.Keys[i1].F = _IO.RU16();
|
||||
_IO.A(0x4);
|
||||
key.Keys[i1].F = s.RU16();
|
||||
s.A(0x4);
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
{ key.Keys[i1].V = _IO.RF32(); key.Keys[i1].T = _IO.RF32(); }
|
||||
{ key.Keys[i1].V = s.RF32(); key.Keys[i1].T = s.RF32(); }
|
||||
}
|
||||
else if (key.Type != KeySetType.None)
|
||||
{
|
||||
key.Keys = new KFT2[s.RU16()];
|
||||
ushort type = s.RU16();
|
||||
if (key.Type == KeySetType.Tangent)
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
key.Keys[i1].T = s.RF32();
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
key.Keys[i1].V = s.RF16();
|
||||
s.A(0x4);
|
||||
}
|
||||
else
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
key.Keys[i1].V = s.RF32();
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
key.Keys[i1].F = s.RU16();
|
||||
s.A(0x4);
|
||||
}
|
||||
}
|
||||
}
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MOTWriter(string file)
|
||||
{
|
||||
if (MOT == null) return;
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
|
||||
int MOTCount = MOT.Length;
|
||||
_IO.P = (MOTCount + 1) << 4;
|
||||
s.P = (MOTCount + 1) << 4;
|
||||
for (i = 0; i < MOTCount; i++)
|
||||
{
|
||||
ref MotHeader mot = ref MOT[i];
|
||||
mot.KeySet.O = _IO.P;
|
||||
_IO.W((ushort)((mot.HighBits << 14) | (mot.KeySet.V.Length & 0x3FFF)));
|
||||
_IO.W((ushort)mot.FrameCount);
|
||||
mot.KeySet.O = s.P;
|
||||
s.W((ushort)((mot.HighBits << 14) | (mot.KeySet.V.Length & 0x3FFF)));
|
||||
s.W((ushort)mot.FrameCount);
|
||||
|
||||
mot.KeySetTypesOffset = _IO.P;
|
||||
mot.KeySetTypesOffset = s.P;
|
||||
for (i0 = 0, i1 = 0; i0 < mot.KeySet.V.Length; i0++)
|
||||
{
|
||||
i1 |= ((byte)mot.KeySet.V[i0].Type << (i0 % 8 * 2)) & (0b11 << (i0 % 8 * 2));
|
||||
|
||||
if (i0 % 8 == 7) { _IO.W((ushort)i1); i1 = 0; }
|
||||
if (i0 % 8 == 7) { s.W((ushort)i1); i1 = 0; }
|
||||
}
|
||||
_IO.W((ushort)i1);
|
||||
if (_IO.P % 4 != 0) _IO.W((ushort)0x00);
|
||||
s.W((ushort)i1);
|
||||
if (s.P % 4 != 0) s.W((ushort)0x00);
|
||||
|
||||
mot.KeySetOffset = _IO.P;
|
||||
mot.KeySetOffset = s.P;
|
||||
for (i0 = 0; i0 < mot.KeySet.V.Length; i0++)
|
||||
{
|
||||
ref KeySet key = ref mot.KeySet.V[i0];
|
||||
if (key.Type == KeySetType.Static)
|
||||
_IO.W(key.Keys[0].V);
|
||||
else if (key.Type == KeySetType.Linear)
|
||||
s.W(key.Keys[0].V);
|
||||
else if ((key.Type == KeySetType.Linear
|
||||
|| key.Type == KeySetType.Tangent) && !Modern)
|
||||
{
|
||||
_IO.W((ushort)key.Keys.Length);
|
||||
s.W((ushort)key.Keys.Length);
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
_IO.W((ushort)key.Keys[i1].F);
|
||||
if (_IO.P % 4 != 0) _IO.W((ushort)0x00);
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
_IO.W(key.Keys[i1].V);
|
||||
s.W((ushort)key.Keys[i1].F);
|
||||
if (s.P % 4 != 0) s.W((ushort)0x00);
|
||||
if (key.Type == KeySetType.Tangent)
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
{ s.W(key.Keys[i1].V); s.W(key.Keys[i1].T); }
|
||||
else
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
s.W(key.Keys[i1].V);
|
||||
}
|
||||
else if (key.Type == KeySetType.Interpolated)
|
||||
else if (key.Type != KeySetType.None)
|
||||
{
|
||||
_IO.W((ushort)key.Keys.Length);
|
||||
s.W((ushort)key.Keys.Length);
|
||||
s.W((ushort)0);
|
||||
if (key.Type == KeySetType.Tangent)
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
s.W(key.Keys[i1].T);
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
_IO.W((ushort)key.Keys[i1].F);
|
||||
if (_IO.P % 4 != 0) _IO.W((ushort)0x00);
|
||||
s.W(key.Keys[i1].V);
|
||||
for (i1 = 0; i1 < key.Keys.Length; i1++)
|
||||
{ _IO.W(key.Keys[i1].V); _IO.W(key.Keys[i1].T); }
|
||||
s.W((ushort)key.Keys[i1].F);
|
||||
s.A(0x4);
|
||||
}
|
||||
}
|
||||
if (_IO.P % 4 != 0) _IO.W((ushort)0x00);
|
||||
if (s.P % 4 != 0) s.W((ushort)0x00);
|
||||
|
||||
mot.BoneInfo.O = _IO.P;
|
||||
mot.BoneInfo.O = s.P;
|
||||
for (i0 = 0; i0 < mot.BoneInfo.V.Length; i0++)
|
||||
_IO.W((ushort)mot.BoneInfo.V[i0].Id);
|
||||
_IO.W((ushort)0);
|
||||
s.W((ushort)mot.BoneInfo.V[i0]);
|
||||
s.W((ushort)0);
|
||||
}
|
||||
if (_IO.P % 4 != 0) _IO.W((ushort)0x00);
|
||||
_IO.A(0x4, true);
|
||||
if (s.P % 4 != 0) s.W((ushort)0x00);
|
||||
s.A(0x4, true);
|
||||
|
||||
_IO.P = 0;
|
||||
s.P = 0;
|
||||
for (i = 0; i < MOTCount; i++)
|
||||
{
|
||||
ref MotHeader mot = ref MOT[i];
|
||||
_IO.W(mot.KeySet .O );
|
||||
_IO.W(mot.KeySetTypesOffset);
|
||||
_IO.W(mot. KeySetOffset);
|
||||
_IO.W(mot.BoneInfo .O );
|
||||
s.W(mot.KeySet .O );
|
||||
s.W(mot.KeySetTypesOffset);
|
||||
s.W(mot. KeySetOffset);
|
||||
s.W(mot.BoneInfo .O );
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool json)
|
||||
@@ -210,14 +242,9 @@ namespace KKdMainLib
|
||||
else if (keySet.Type == KeySetType.Static)
|
||||
{
|
||||
keySet.Keys = new KFT2[1];
|
||||
if (temp1.Array == null) continue;
|
||||
else if (temp1.Array.Length == 0) continue;
|
||||
else if (temp1.Array[0].Array == null) continue;
|
||||
else if (temp1.Array[0].Array.Length == 0) continue;
|
||||
else if (temp1.Array[0].Array.Length == 1)
|
||||
keySet.Keys[0] = new KFT2(temp1.Array[0][0].RF32());
|
||||
else if (temp1.Array[0].Array.Length > 1)
|
||||
keySet.Keys[0] = new KFT2(temp1.Array[0][0].RF32(), temp1.Array[0][1].RF32());
|
||||
if (temp1.Array == null) continue;
|
||||
else if (temp1.Array.Length == 0) continue;
|
||||
else keySet.Keys[0] = new KFT2(0.0f, temp1.Array[0].RF32());
|
||||
}
|
||||
else if (keySet.Type == KeySetType.Linear)
|
||||
{
|
||||
@@ -233,7 +260,7 @@ namespace KKdMainLib
|
||||
keySet.Keys[i1] = new KFT2(array[0].RF32(), array[1].RF32());
|
||||
}
|
||||
}
|
||||
else if (keySet.Type == KeySetType.Interpolated)
|
||||
else if (keySet.Type == KeySetType.Tangent)
|
||||
{
|
||||
keySet.Keys = new KFT2[temp1.Array.Length];
|
||||
for (i1 = 0; i1 < temp1.Array.Length; i1++)
|
||||
@@ -254,9 +281,9 @@ namespace KKdMainLib
|
||||
|
||||
if ((temp = msgPack["BoneInfo", true]).NotNull)
|
||||
{
|
||||
mot.BoneInfo.V = new BoneInfo[temp.Array.Length];
|
||||
mot.BoneInfo.V = new int[temp.Array.Length];
|
||||
for (i = 0; i < mot.BoneInfo.V.Length; i++)
|
||||
mot.BoneInfo.V[i].Id = temp[i].RI32();
|
||||
mot.BoneInfo.V[i] = temp[i].RI32();
|
||||
}
|
||||
temp.Dispose();
|
||||
}
|
||||
@@ -273,41 +300,43 @@ namespace KKdMainLib
|
||||
|
||||
keySets[i0] = new MsgPack(2);
|
||||
keySets[i0].Array[0] = (byte)keySet.Type;
|
||||
keySets[i0].Array[1] = new MsgPack(keySet.Keys.Length);
|
||||
if (keySet.Type == KeySetType.Static)
|
||||
{
|
||||
IKF kf = keySet.Keys[0].Check();
|
||||
if (kf is KFT0 KFT0) keySets[i0].Array[1][0] =
|
||||
new MsgPack(null, new MsgPack[] { KFT0.F });
|
||||
else if (kf is KFT1 KFT1) keySets[i0].Array[1][0] =
|
||||
new MsgPack(null, new MsgPack[] { KFT1.F, KFT1.V });
|
||||
MsgPack k = default;
|
||||
if (kf is KFT0 KFT0) k = new MsgPack(null, new MsgPack[] { 0.0f });
|
||||
else if (kf is KFT1 KFT1) k = new MsgPack(null, new MsgPack[] { KFT1.V });
|
||||
keySets[i0].Array[1] = k;
|
||||
}
|
||||
else if (keySet.Type == KeySetType.Linear)
|
||||
{
|
||||
MsgPack k = new MsgPack(keySet.Keys.Length);
|
||||
for (i1 = 0; i1 < keySet.Keys.Length; i1++)
|
||||
{
|
||||
IKF kf = keySet.Keys[i1].Check();
|
||||
if (kf is KFT0 KFT0) keySets[i0].Array[1][i1] =
|
||||
new MsgPack(null, new MsgPack[] { KFT0.F });
|
||||
else if (kf is KFT1 KFT1) keySets[i0].Array[1][i1] =
|
||||
new MsgPack(null, new MsgPack[] { KFT1.F, KFT1.V });
|
||||
if (kf is KFT0 KFT0) k[i1] = new MsgPack(null, new MsgPack[] { KFT0.F });
|
||||
else if (kf is KFT1 KFT1) k[i1] = new MsgPack(null, new MsgPack[] { KFT1.F, KFT1.V });
|
||||
}
|
||||
keySets[i0].Array[1] = k;
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgPack k = new MsgPack(keySet.Keys.Length);
|
||||
for (i1 = 0; i1 < keySet.Keys.Length; i1++)
|
||||
{
|
||||
IKF kf = keySet.Keys[i1].Check();
|
||||
if (kf is KFT0 KFT0) keySets[i0].Array[1][i1] =
|
||||
new MsgPack(null, new MsgPack[] { KFT0.F });
|
||||
else if (kf is KFT1 KFT1) keySets[i0].Array[1][i1] =
|
||||
new MsgPack(null, new MsgPack[] { KFT1.F, KFT1.V });
|
||||
else if (kf is KFT2 KFT2) keySets[i0].Array[1][i1] =
|
||||
new MsgPack(null, new MsgPack[] { KFT2.F, KFT2.V, KFT2.T });
|
||||
if (kf is KFT0 KFT0) k[i1] = new MsgPack(null, new MsgPack[] { KFT0.F });
|
||||
else if (kf is KFT1 KFT1) k[i1] = new MsgPack(null, new MsgPack[] { KFT1.F, KFT1.V });
|
||||
else if (kf is KFT2 KFT2) k[i1] = new MsgPack(null, new MsgPack[] { KFT2.F, KFT2.V, KFT2.T });
|
||||
}
|
||||
keySets[i0].Array[1] = k;
|
||||
}
|
||||
}
|
||||
mot.Add(keySets);
|
||||
|
||||
MsgPack boneInfo = new MsgPack(Mot.BoneInfo.V.Length, "BoneInfo");
|
||||
for (i0 = 0; i0 < Mot.BoneInfo.V.Length; i0++)
|
||||
boneInfo[i0] = Mot.BoneInfo.V[i0].Id;
|
||||
boneInfo[i0] = Mot.BoneInfo.V[i0];
|
||||
mot.Add(boneInfo);
|
||||
|
||||
return mot;
|
||||
@@ -315,7 +344,7 @@ namespace KKdMainLib
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_IO = null;
|
||||
s = null;
|
||||
MOT = null;
|
||||
}
|
||||
|
||||
@@ -323,8 +352,8 @@ namespace KKdMainLib
|
||||
{
|
||||
public int KeySetOffset;
|
||||
public int KeySetTypesOffset;
|
||||
public Pointer< KeySet []> KeySet ;
|
||||
public Pointer<BoneInfo[]> BoneInfo;
|
||||
public Pointer<KeySet[]> KeySet ;
|
||||
public Pointer< int[]> BoneInfo;
|
||||
|
||||
public int HighBits;
|
||||
public int FrameCount;
|
||||
@@ -335,8 +364,9 @@ namespace KKdMainLib
|
||||
public KFT2[] Keys;
|
||||
public KeySetType Type;
|
||||
|
||||
public override string ToString() => $"Type: {Type}" + (Type == KeySetType.Static ?
|
||||
$"; Value: {Keys[0].V}" : Type > KeySetType.Static ? $"; Keys: {Keys.Length}" : "");
|
||||
public override string ToString() =>
|
||||
$"Type: {Type}" + (Type == KeySetType.Static ? $"; Value: {Keys[0].V}"
|
||||
: Type > KeySetType.Static ? $"; Keys: {Keys.Length}; First Key: {Keys[0]}" : "");
|
||||
}
|
||||
|
||||
public enum KeySetType : byte
|
||||
@@ -344,13 +374,7 @@ namespace KKdMainLib
|
||||
None = 0b00,
|
||||
Static = 0b01,
|
||||
Linear = 0b10,
|
||||
Interpolated = 0b11,
|
||||
}
|
||||
|
||||
public struct BoneInfo
|
||||
{
|
||||
public string Name;
|
||||
public int Id;
|
||||
Tangent = 0b11,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+91
-91
@@ -6,58 +6,58 @@ namespace KKdMainLib
|
||||
public struct MotHead : System.IDisposable
|
||||
{
|
||||
private int i, i0, i1;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
|
||||
public HeaderData Header;
|
||||
|
||||
public void MotHeadReader(string file)
|
||||
{
|
||||
_IO = File.OpenReader(file + ".bin");
|
||||
_IO.RI32();
|
||||
s = File.OpenReader(file + ".bin");
|
||||
s.RI32();
|
||||
Header = new HeaderData();
|
||||
|
||||
int offset = _IO.RI32();
|
||||
int offset = s.RI32();
|
||||
if (offset < 0x10) goto RETURN;
|
||||
_IO.O = offset;
|
||||
_IO.P = 0;
|
||||
s.O = offset;
|
||||
s.P = 0;
|
||||
|
||||
Header. MotionSetID = _IO.RI32();
|
||||
Header.StartMotionID = _IO.RI32();
|
||||
Header. EndMotionID = _IO.RI32();
|
||||
Header.SubHeaderOffset = _IO.RI32();
|
||||
Header. MotionSetID = s.RI32();
|
||||
Header.StartMotionID = s.RI32();
|
||||
Header. EndMotionID = s.RI32();
|
||||
Header.SubHeaderOffset = s.RI32();
|
||||
|
||||
if (Header.SubHeaderOffset < 0x10) goto RETURN;
|
||||
i0 = Header.EndMotionID - Header.StartMotionID;
|
||||
if (i0 < 0) goto RETURN;
|
||||
|
||||
_IO.P = Header.SubHeaderOffset;
|
||||
s.P = Header.SubHeaderOffset;
|
||||
Header.Data = new HeaderData.Sub[++i0];
|
||||
for (i = 0; i < Header.Data.Length; i++) Header.Data[i].Offset = _IO.RI32();
|
||||
for (i = 0; i < Header.Data.Length; i++) Header.Data[i].Offset = s.RI32();
|
||||
for (i = 0; i < Header.Data.Length; i++)
|
||||
{
|
||||
if (Header.Data[i].Offset < 0x10) continue;
|
||||
|
||||
_IO.P = Header.Data[i].Offset;
|
||||
s.P = Header.Data[i].Offset;
|
||||
|
||||
Header.Data[i].MotionID = Header.StartMotionID + i;
|
||||
Header.Data[i].SomeData = _IO.RI32();
|
||||
_IO.RI64();
|
||||
_IO.RI64();
|
||||
Header.Data[i].Offset2 = _IO.RI32();
|
||||
Header.Data[i].DataHeaderOffset = _IO.RI32();
|
||||
Header.Data[i].SomeData = s.RI32();
|
||||
s.RI64();
|
||||
s.RI64();
|
||||
Header.Data[i].Offset2 = s.RI32();
|
||||
Header.Data[i].DataHeaderOffset = s.RI32();
|
||||
|
||||
if (Header.Data[i].DataHeaderOffset < 0x10) goto RETURN;
|
||||
_IO.P = Header.Data[i].DataHeaderOffset;
|
||||
s.P = Header.Data[i].DataHeaderOffset;
|
||||
i0 = 0;
|
||||
while (_IO.RI32() != -1) { _IO.RI32(); _IO.RI32(); i0++; }
|
||||
_IO.P = Header.Data[i].DataHeaderOffset;
|
||||
while (s.RI32() != -1) { s.RI32(); s.RI32(); i0++; }
|
||||
s.P = Header.Data[i].DataHeaderOffset;
|
||||
|
||||
Header.Data[i].Array = new HeaderData.Sub.Data[i0];
|
||||
for (i0 = 0; i0 < Header.Data[i].Array.Length; i0++)
|
||||
{
|
||||
Header.Data[i].Array[i0].Type = _IO.RI32();
|
||||
Header.Data[i].Array[i0].Frame = _IO.RI32();
|
||||
Header.Data[i].Array[i0].Offset = _IO.RI32();
|
||||
Header.Data[i].Array[i0].Type = s.RI32();
|
||||
Header.Data[i].Array[i0].Frame = s.RI32();
|
||||
Header.Data[i].Array[i0].Offset = s.RI32();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,25 +65,25 @@ namespace KKdMainLib
|
||||
{
|
||||
if (Header.Data[i].Offset2 > 0x10)
|
||||
{
|
||||
_IO.P = Header.Data[i].Offset2;
|
||||
s.P = Header.Data[i].Offset2;
|
||||
i0 = 0;
|
||||
while (_IO.RI32() != -1) { _IO.RI32(); i0++; }
|
||||
_IO.P = Header.Data[i].Offset2;
|
||||
while (s.RI32() != -1) { s.RI32(); i0++; }
|
||||
s.P = Header.Data[i].Offset2;
|
||||
|
||||
Header.Data[i].Array2 = new HeaderData.Sub.Data2[i0];
|
||||
for (i0 = 0; i0 < Header.Data[i].Array2.Length; i0++)
|
||||
{
|
||||
Header.Data[i].Array2[i0].Frame = _IO.RI32();
|
||||
Header.Data[i].Array2[i0].Offset = _IO.RI32();
|
||||
Header.Data[i].Array2[i0].Frame = s.RI32();
|
||||
Header.Data[i].Array2[i0].Offset = s.RI32();
|
||||
}
|
||||
|
||||
for (i0 = 0; i0 < Header.Data[i].Array2.Length; i0++)
|
||||
{
|
||||
if (Header.Data[i].Array2[i0].Offset < 0x10) goto RETURN;
|
||||
_IO.P = Header.Data[i].Array2[i0].Offset;
|
||||
s.P = Header.Data[i].Array2[i0].Offset;
|
||||
Header.Data[i].Array2[i0].Array = new int[7];
|
||||
for (i1 = 0; i1 < Header.Data[i].Array2[i0].Array.Length; i1++)
|
||||
Header.Data[i].Array2[i0].Array[i1] = _IO.RI32();
|
||||
Header.Data[i].Array2[i0].Array[i1] = s.RI32();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,20 +97,20 @@ namespace KKdMainLib
|
||||
|
||||
if (Data.Offset > 0)
|
||||
{
|
||||
_IO.P = Data.Offset;
|
||||
if (i1 == 0x01) Data.Array = new int[] { _IO.RU8 () };
|
||||
else if (i1 == 0x02) Data.Array = new int[] { _IO.RU16() };
|
||||
s.P = Data.Offset;
|
||||
if (i1 == 0x01) Data.Array = new int[] { s.RU8 () };
|
||||
else if (i1 == 0x02) Data.Array = new int[] { s.RU16() };
|
||||
else
|
||||
{
|
||||
Data.Array = new int[i1 / 4];
|
||||
for (i1 = 0; i1 < Data.Array.Length; i1++) Data.Array[i1] = _IO.RI32();
|
||||
for (i1 = 0; i1 < Data.Array.Length; i1++) Data.Array[i1] = s.RI32();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RETURN:
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MotHeadWriter(string file)
|
||||
@@ -127,28 +127,28 @@ RETURN:
|
||||
Header. EndMotionID = Header.Data[i].MotionID;
|
||||
}
|
||||
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
_IO.W(0x01);
|
||||
_IO.W(0x20);
|
||||
_IO.A(0x20, true);
|
||||
_IO.O = 0x20;
|
||||
_IO.P = 0;
|
||||
_IO.W(0);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
s.W(0x01);
|
||||
s.W(0x20);
|
||||
s.A(0x20, true);
|
||||
s.O = 0x20;
|
||||
s.P = 0;
|
||||
s.W(0);
|
||||
for (int I = Header.EndMotionID - Header.StartMotionID; I > -1; I--)
|
||||
for (i = 0; i < Header.Data.Length; i++)
|
||||
if (Header.StartMotionID + I == Header.Data[i].MotionID)
|
||||
{
|
||||
_IO.A(0x20, true);
|
||||
Header.Data[i].Offset = _IO.P;
|
||||
s.A(0x20, true);
|
||||
Header.Data[i].Offset = s.P;
|
||||
Header.Data[i].DataHeaderOffset = Header.Data[i].Offset + 0x20;
|
||||
_IO.W(0L);
|
||||
_IO.W(0L);
|
||||
_IO.W(0L);
|
||||
_IO.W(0L);
|
||||
s.W(0L);
|
||||
s.W(0L);
|
||||
s.W(0L);
|
||||
s.W(0L);
|
||||
|
||||
for (i0 = 0; i0 < Header.Data[i].Array.Length; i0++)
|
||||
{ _IO.W( 0); _IO.W( 0); _IO.W(0); }
|
||||
_IO.W(-1); _IO.W(-1); _IO.W(0);
|
||||
{ s.W( 0); s.W( 0); s.W(0); }
|
||||
s.W(-1); s.W(-1); s.W(0);
|
||||
|
||||
for (i0 = Header.Data[i].Array.Length - 1; i0 > -1; i0--)
|
||||
{
|
||||
@@ -156,46 +156,46 @@ RETURN:
|
||||
int Size = GetSize(data.Type);
|
||||
if (data.Array == null || data.Array.Length < 1 || Size < 1) continue;
|
||||
|
||||
if (data.Type == 0x3E) _IO.A(0x20, true);
|
||||
data.Offset = _IO.P;
|
||||
if (data.Type == 0x3E) s.A(0x20, true);
|
||||
data.Offset = s.P;
|
||||
|
||||
if (Size == 0x01) _IO.W(( byte)data.Array[0]);
|
||||
else if (Size == 0x02) _IO.W((short)data.Array[0]);
|
||||
if (Size == 0x01) s.W(( byte)data.Array[0]);
|
||||
else if (Size == 0x02) s.W((short)data.Array[0]);
|
||||
else
|
||||
{
|
||||
if (_IO.P % 0x4 != 0) _IO.A(0x04, true);
|
||||
if (s.P % 0x4 != 0) s.A(0x04, true);
|
||||
Size /= 4;
|
||||
|
||||
data.Offset = _IO.P;
|
||||
data.Offset = s.P;
|
||||
for (i1 = 0; i1 < data.Array.Length && i1 < Size; i1++)
|
||||
_IO.W(data.Array[i1]);
|
||||
s.W(data.Array[i1]);
|
||||
|
||||
for (; i1 < Size; i1++) _IO.W(0);
|
||||
for (; i1 < Size; i1++) s.W(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (Header.Data[i].Array2 != null)
|
||||
if (Header.Data[i].Array2.Length > 0)
|
||||
{
|
||||
Header.Data[i].Offset2 = _IO.P;
|
||||
Header.Data[i].Offset2 = s.P;
|
||||
|
||||
for (i0 = 0; i0 < Header.Data[i].Array2.Length; i0++)
|
||||
{ _IO.W( 0); _IO.W(0); }
|
||||
_IO.W(-1); _IO.W(0);
|
||||
{ s.W( 0); s.W(0); }
|
||||
s.W(-1); s.W(0);
|
||||
|
||||
for (i0 = Header.Data[i].Array2.Length - 1; i0 > -1; i0--)
|
||||
{
|
||||
Header.Data[i].Array2[i0].Offset = _IO.P;
|
||||
Header.Data[i].Array2[i0].Offset = s.P;
|
||||
for (i1 = 0; i1 < Header.Data[i].Array2[i0].Array.Length && i1 < 7; i1++)
|
||||
_IO.W(Header.Data[i].Array2[i0].Array[i1]);
|
||||
s.W(Header.Data[i].Array2[i0].Array[i1]);
|
||||
|
||||
for (; i1 < 7; i1++) _IO.W(0);
|
||||
for (; i1 < 7; i1++) s.W(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
_IO.A(0x20, true);
|
||||
Header.SubHeaderOffset = _IO.P;
|
||||
s.A(0x20, true);
|
||||
Header.SubHeaderOffset = s.P;
|
||||
i1 = Header.EndMotionID - Header.StartMotionID;
|
||||
|
||||
int offset = 0;
|
||||
@@ -205,44 +205,44 @@ RETURN:
|
||||
for (i0 = 0; i0 < Header.Data.Length; i0++)
|
||||
if (Header.StartMotionID + i == Header.Data[i0].MotionID)
|
||||
{ offset = Header.Data[i0].Offset; break; }
|
||||
_IO.W(offset);
|
||||
s.W(offset);
|
||||
}
|
||||
_IO.A(0x20, true);
|
||||
s.A(0x20, true);
|
||||
|
||||
for (i = 0; i < Header.Data.Length; i++)
|
||||
{
|
||||
_IO.P = Header.Data[i].Offset;
|
||||
_IO.W(Header.Data[i].SomeData);
|
||||
_IO.W(0);
|
||||
_IO.W(0L);
|
||||
_IO.W(0x040004);
|
||||
_IO.W(Header.Data[i].Offset2);
|
||||
_IO.W(Header.Data[i].DataHeaderOffset);
|
||||
_IO.W(0);
|
||||
s.P = Header.Data[i].Offset;
|
||||
s.W(Header.Data[i].SomeData);
|
||||
s.W(0);
|
||||
s.W(0L);
|
||||
s.W(0x040004);
|
||||
s.W(Header.Data[i].Offset2);
|
||||
s.W(Header.Data[i].DataHeaderOffset);
|
||||
s.W(0);
|
||||
|
||||
_IO.P = Header.Data[i].DataHeaderOffset;
|
||||
s.P = Header.Data[i].DataHeaderOffset;
|
||||
for (i0 = 0; i0 < Header.Data[i].Array.Length; i0++)
|
||||
{
|
||||
_IO.W(Header.Data[i].Array[i0].Type );
|
||||
_IO.W(Header.Data[i].Array[i0].Frame );
|
||||
_IO.W(Header.Data[i].Array[i0].Offset);
|
||||
s.W(Header.Data[i].Array[i0].Type );
|
||||
s.W(Header.Data[i].Array[i0].Frame );
|
||||
s.W(Header.Data[i].Array[i0].Offset);
|
||||
}
|
||||
|
||||
_IO.P = Header.Data[i].Offset2;
|
||||
s.P = Header.Data[i].Offset2;
|
||||
if (Header.Data[i].Array2 != null)
|
||||
for (i0 = 0; i0 < Header.Data[i].Array2.Length; i0++)
|
||||
{
|
||||
_IO.W(Header.Data[i].Array2[i0].Frame );
|
||||
_IO.W(Header.Data[i].Array2[i0].Offset);
|
||||
s.W(Header.Data[i].Array2[i0].Frame );
|
||||
s.W(Header.Data[i].Array2[i0].Offset);
|
||||
}
|
||||
}
|
||||
|
||||
_IO.P = 0;
|
||||
_IO.W(Header.MotionSetID );
|
||||
_IO.W(Header.StartMotionID );
|
||||
_IO.W(Header. EndMotionID );
|
||||
_IO.W(Header.SubHeaderOffset);
|
||||
_IO.C();
|
||||
s.P = 0;
|
||||
s.W(Header.MotionSetID );
|
||||
s.W(Header.StartMotionID );
|
||||
s.W(Header. EndMotionID );
|
||||
s.W(Header.SubHeaderOffset);
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool json)
|
||||
@@ -721,7 +721,7 @@ RETURN:
|
||||
};
|
||||
|
||||
public void Dispose()
|
||||
{ if (_IO != null) _IO.D(); _IO = null; Header = default; }
|
||||
{ if (s != null) s.D(); s = null; Header = default; }
|
||||
|
||||
public struct HeaderData
|
||||
{
|
||||
|
||||
+58
-58
@@ -8,57 +8,57 @@ namespace KKdMainLib
|
||||
{
|
||||
private POF pof;
|
||||
private Header header;
|
||||
private Stream _IO;
|
||||
private Stream s;
|
||||
|
||||
public String[] Strings;
|
||||
|
||||
public int STRReader(string filepath, string ext)
|
||||
{
|
||||
_IO = File.OpenReader(filepath + ext);
|
||||
s = File.OpenReader(filepath + ext);
|
||||
|
||||
header = new Header();
|
||||
_IO.Format = Format.F;
|
||||
header.Signature = _IO.RI32();
|
||||
s.Format = Format.F;
|
||||
header.Signature = s.RU32();
|
||||
if (header.Signature == 0x41525453)
|
||||
{
|
||||
header = _IO.ReadHeader(true, false);
|
||||
_IO.IsBE = header.UseBigEndian;
|
||||
_IO.Format = header.Format;
|
||||
header = s.ReadHeader(true, false);
|
||||
s.IsBE = header.UseBigEndian;
|
||||
s.Format = header.Format;
|
||||
|
||||
int count = _IO.RI32E();
|
||||
int offset = _IO.RI32E();
|
||||
int count = s.RI32E();
|
||||
int offset = s.RI32E();
|
||||
|
||||
_IO.P = offset;
|
||||
s.P = offset;
|
||||
Strings = new String[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Strings[i].Str.O = _IO.RI32E();
|
||||
Strings[i].ID = _IO.RI32E();
|
||||
Strings[i].Str.O = s.RI32E();
|
||||
Strings[i].ID = s.RI32E();
|
||||
}
|
||||
|
||||
_IO.O = 0;
|
||||
s.O = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
Strings[i].Str.V = Strings[i].Str.O > 0 ?
|
||||
_IO.RSaO(Strings[i].Str.O) : null;
|
||||
s.RSaO(Strings[i].Str.O) : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((header.Signature >> 24) > 0) { header.Format = Format.DT; _IO.IsBE = true; }
|
||||
if ((header.Signature >> 24) > 0) { header.Format = Format.DT; s.IsBE = true; }
|
||||
else header.Format = Format.F;
|
||||
int count = 0;
|
||||
for (int i = header.Signature; i != 0 && _IO.P >= 0 && _IO.P < _IO.L; count++)
|
||||
i = _IO.RI32();
|
||||
for (uint i = header.Signature; i != 0 && s.P >= 0 && s.P < s.L; count++)
|
||||
i = s.RU32();
|
||||
Strings = new String[count];
|
||||
|
||||
_IO.P = 0;
|
||||
s.P = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Strings[i].ID = i;
|
||||
Strings[i].Str.V = _IO.RSaO();
|
||||
Strings[i].Str.V = s.RSaO();
|
||||
}
|
||||
}
|
||||
|
||||
_IO.C();
|
||||
s.C();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -68,24 +68,24 @@ namespace KKdMainLib
|
||||
uint offset = 0;
|
||||
uint currentOffset = 0;
|
||||
Format format = header.Format;
|
||||
_IO = File.OpenWriter(filepath + (header.Format > Format.AFT &&
|
||||
s = File.OpenWriter(filepath + (header.Format > Format.AFT &&
|
||||
header.Format < Format.FT ? ".str" : ".bin"), true);
|
||||
_IO.Format = header.Format;
|
||||
_IO.IsBE = header.UseBigEndian;
|
||||
s.Format = header.Format;
|
||||
s.IsBE = header.UseBigEndian;
|
||||
pof.Offsets = KKdList<long>.New;
|
||||
|
||||
long count = Strings.LongLength;
|
||||
if (_IO.Format > Format.AFT && _IO.Format < Format.FT)
|
||||
if (s.Format > Format.AFT && s.Format < Format.FT)
|
||||
{
|
||||
_IO.P = 0x40;
|
||||
_IO.WX(count, ref pof);
|
||||
_IO.WX(0x80);
|
||||
_IO.P = 0x80;
|
||||
for (int i = 0; i < count; i++) _IO.W(0x00L);
|
||||
s.P = 0x40;
|
||||
s.WX(count, ref pof);
|
||||
s.WX(0x80);
|
||||
s.P = 0x80;
|
||||
for (int i = 0; i < count; i++) s.W(0x00L);
|
||||
}
|
||||
else
|
||||
for (int i = 0; i < count; i++) _IO.W(0x00);
|
||||
_IO.A(0x10);
|
||||
for (int i = 0; i < count; i++) s.W(0x00);
|
||||
s.A(0x10);
|
||||
|
||||
KKdList<string> usedSTR = KKdList<string>.New;
|
||||
KKdList<int> usedSTRPos = KKdList<int>.New;
|
||||
@@ -101,47 +101,47 @@ namespace KKdMainLib
|
||||
}
|
||||
else
|
||||
{
|
||||
usedSTRPos.Add(STRPos[i] = _IO.P);
|
||||
usedSTRPos.Add(STRPos[i] = s.P);
|
||||
usedSTR.Add(Strings[i].Str.V);
|
||||
_IO.W(Strings[i].Str.V);
|
||||
_IO.W((byte)0);
|
||||
if (format < Format.F) _IO.A(0x8);
|
||||
s.W(Strings[i].Str.V);
|
||||
s.W((byte)0);
|
||||
if (format < Format.F) s.A(0x8);
|
||||
}
|
||||
}
|
||||
_IO.A(0x4);
|
||||
_IO.L = _IO.P;
|
||||
s.A(0x4);
|
||||
s.L = s.P;
|
||||
|
||||
if (_IO.Format > Format.AFT)
|
||||
if (s.Format > Format.AFT)
|
||||
{
|
||||
_IO.A(0x10);
|
||||
offset = _IO.PU32;
|
||||
_IO.P = 0x80;
|
||||
s.A(0x10);
|
||||
offset = s.PU32;
|
||||
s.P = 0x80;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
pof.Offsets.Add(_IO.P);
|
||||
_IO.WE(STRPos[i]);
|
||||
_IO.WE(Strings[i].ID);
|
||||
pof.Offsets.Add(s.P);
|
||||
s.WE(STRPos[i]);
|
||||
s.WE(Strings[i].ID);
|
||||
}
|
||||
|
||||
_IO.PU32 = offset;
|
||||
_IO.W(pof, false, 1);
|
||||
_IO.WEOFC(1);
|
||||
currentOffset = _IO.PU32;
|
||||
_IO.WEOFC();
|
||||
header.DataSize = (int)(currentOffset - 0x40);
|
||||
s.PU32 = offset;
|
||||
s.W(pof, false, 1);
|
||||
s.WEOFC(1);
|
||||
currentOffset = s.PU32;
|
||||
s.WEOFC();
|
||||
header.DataSize = currentOffset - 0x40;
|
||||
header.Signature = 0x41525453;
|
||||
header.SectionSize = (int)(offset - 0x40);
|
||||
header.SectionSize = offset - 0x40;
|
||||
header.UseSectionSize = true;
|
||||
_IO.P = 0;
|
||||
_IO.W(header, true);
|
||||
s.P = 0;
|
||||
s.W(header, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_IO.P = 0;
|
||||
_IO.IsBE = header.Format < Format.F;
|
||||
for (int i = 0; i < count; i++) _IO.WE(STRPos[i]);
|
||||
s.P = 0;
|
||||
s.IsBE = header.Format < Format.F;
|
||||
for (int i = 0; i < count; i++) s.WE(STRPos[i]);
|
||||
}
|
||||
_IO.C();
|
||||
s.C();
|
||||
}
|
||||
|
||||
public void MsgPackReader(string file, bool json)
|
||||
@@ -190,7 +190,7 @@ namespace KKdMainLib
|
||||
|
||||
private bool disposed;
|
||||
public void Dispose()
|
||||
{ if (!disposed) { if (_IO != null) _IO.D(); _IO = null; Strings = default;
|
||||
{ if (!disposed) { if (s != null) s.D(); s = null; Strings = default;
|
||||
pof = default; header = default; disposed = true; } }
|
||||
|
||||
public struct String
|
||||
|
||||
+76
-87
@@ -8,8 +8,8 @@ namespace KKdMainLib
|
||||
public struct Tables : System.IDisposable
|
||||
{
|
||||
private int i0;
|
||||
private Stream _IO;
|
||||
private TableDict dict;
|
||||
private Stream s;
|
||||
|
||||
public ButtonSE[] ButtonSETable;
|
||||
public ChainSlideSE[] ChainSlideSETable;
|
||||
@@ -20,21 +20,10 @@ namespace KKdMainLib
|
||||
public CustomizeItem[] CustomizeItemTable;
|
||||
public Module[] ModuleTable;
|
||||
public Plate[] PlateTable;
|
||||
public PV[] PVList;
|
||||
public PV[] PVListTable;
|
||||
|
||||
private const string c = ".";
|
||||
|
||||
public Tables(bool def = true)
|
||||
{
|
||||
i0 = 0;
|
||||
_IO = null;
|
||||
dict = null;
|
||||
disposed = false;
|
||||
ButtonSETable = null; ChainSlideSETable = null; SlideSETable = null; SliderTouchSETable = null;
|
||||
CollectionCardTable = null; CustomizeItemTable = null;
|
||||
ModuleTable = null; PlateTable = null; PVList = null;
|
||||
}
|
||||
|
||||
public void BINReader(string file) =>
|
||||
BINReader(File.ReadAllBytes(file + ".bin"));
|
||||
|
||||
@@ -42,7 +31,7 @@ namespace KKdMainLib
|
||||
{
|
||||
ButtonSETable = null; ChainSlideSETable = null; SlideSETable = null; SliderTouchSETable = null;
|
||||
CollectionCardTable = null; CustomizeItemTable = null;
|
||||
ModuleTable = null; PlateTable = null; PVList = null;
|
||||
ModuleTable = null; PlateTable = null; PVListTable = null;
|
||||
|
||||
dict = new TableDict();
|
||||
string[] strData = data.ToUTF8().Replace("\r\n", "\n").Replace("\r", "\n").Split('\n');
|
||||
@@ -182,12 +171,12 @@ namespace KKdMainLib
|
||||
}
|
||||
else if (dict.FV(out length, "pv_list.data_list.length"))
|
||||
{
|
||||
PVList = new PV[length];
|
||||
PVListTable = new PV[length];
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "pv_list" + c + i0 + c;
|
||||
|
||||
ref PV pv = ref PVList[i0];
|
||||
ref PV pv = ref PVListTable[i0];
|
||||
dict.FV(out pv.ID , name + "id" );
|
||||
dict.FV(out pv.Ignore, name + "ignore");
|
||||
dict.FV(out pv.Name , name + "name" );
|
||||
@@ -281,57 +270,57 @@ namespace KKdMainLib
|
||||
|
||||
if (ButtonSETable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = ButtonSETable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
WriteEmptyLines(s, length);
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "btn_se" + c + so[i0] + c;
|
||||
|
||||
ref ButtonSE btn = ref ButtonSETable[so[i0]];
|
||||
WriteEndTableDate(_IO, name, btn.End);
|
||||
WriteEndTableDate(s, name, btn.End);
|
||||
W(name + "id" , btn. ID );
|
||||
W(name + "name" , btn. Name );
|
||||
W(name + "se_name" , btn. SEName );
|
||||
W(name + "sort_index", btn.SortIndex);
|
||||
WriteStartTableDate(_IO, name, btn.Start);
|
||||
WriteStartTableDate(s, name, btn.Start);
|
||||
}
|
||||
W("btn_se.data_list.length", length);
|
||||
_IO.W("kind=0\n");
|
||||
_IO.D();
|
||||
s.W("kind=0\n");
|
||||
s.D();
|
||||
}
|
||||
else if (ChainSlideSETable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = ChainSlideSETable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
WriteEmptyLines(s, length);
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "chainslide_se" + c + so[i0] + c;
|
||||
|
||||
ref ChainSlideSE csld = ref ChainSlideSETable[so[i0]];
|
||||
WriteEndTableDate(_IO, name, csld.End);
|
||||
WriteEndTableDate(s, name, csld.End);
|
||||
W(name + "failure_se_name" , csld.FailureSEName );
|
||||
W(name + "first_se_name" , csld. FirstSEName );
|
||||
W(name + "id" , csld. ID );
|
||||
W(name + "name" , csld. Name );
|
||||
W(name + "sort_index", csld. SortIndex);
|
||||
WriteStartTableDate(_IO, name, csld.Start);
|
||||
WriteStartTableDate(s, name, csld.Start);
|
||||
W(name + "sub_se_name" , csld. SubSEName );
|
||||
W(name + "success_se_name" , csld.SuccessSEName );
|
||||
}
|
||||
W("chainslide_se.data_list.length", length);
|
||||
_IO.W("kind=2\n");
|
||||
_IO.D();
|
||||
s.W("kind=2\n");
|
||||
s.D();
|
||||
}
|
||||
else if (CollectionCardTable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = CollectionCardTable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
WriteEmptyLines(s, length);
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "collection_card" + c + so[i0] + c;
|
||||
@@ -340,29 +329,29 @@ namespace KKdMainLib
|
||||
W(name + "chara" , clcrd.Chara );
|
||||
W(name + "disp_num" , clcrd.DispNum );
|
||||
W(name + "divapro_param", clcrd.DivaProParam);
|
||||
WriteEndTableDate(_IO, name, clcrd.End);
|
||||
WriteEndTableDate(s, name, clcrd.End);
|
||||
W(name + "id" , clcrd.ID );
|
||||
W(name + "module_author", clcrd.ModuleAuthor);
|
||||
W(name + "name" , clcrd.Name );
|
||||
W(name + "name_reading" , clcrd.NameReading );
|
||||
W(name + "ng" , clcrd.NG );
|
||||
W(name + "sort_idx" , clcrd.SortIndex );
|
||||
WriteStartTableDate(_IO, name, clcrd.Start);
|
||||
WriteStartTableDate(s, name, clcrd.Start);
|
||||
W(name + "type" , clcrd.Type );
|
||||
W(name + "type_param" , clcrd.TypeParam );
|
||||
W(name + "wall_param" , clcrd.WallParam );
|
||||
}
|
||||
W("collection_card.data_list.length", length);
|
||||
_IO.W("patch=0\n");
|
||||
_IO.W("version=0\n");
|
||||
_IO.D();
|
||||
s.W("patch=0\n");
|
||||
s.W("version=0\n");
|
||||
s.D();
|
||||
}
|
||||
else if (CustomizeItemTable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = CustomizeItemTable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
WriteEmptyLines(s, length);
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "cstm_item" + c + so[i0] + c;
|
||||
@@ -375,22 +364,22 @@ namespace KKdMainLib
|
||||
W(name + "obj_id" , czitm.ObjID );
|
||||
W(name + "parts" , czitm.Parts );
|
||||
W(name + "sell_type" , czitm.SellType );
|
||||
WriteEndTableDate(_IO, name + "shop_", czitm.ShopEnd);
|
||||
WriteEndTableDate(s, name + "shop_", czitm.ShopEnd);
|
||||
W(name + "shop_price", czitm.ShopPrice);
|
||||
WriteStartTableDate(_IO, name + "shop_", czitm.ShopStart);
|
||||
WriteStartTableDate(s, name + "shop_", czitm.ShopStart);
|
||||
W(name + "sort_index", czitm.SortIndex);
|
||||
}
|
||||
W("cstm_item.data_list.length", length);
|
||||
_IO.W("patch=0\n");
|
||||
_IO.W("version=0\n");
|
||||
_IO.D();
|
||||
s.W("patch=0\n");
|
||||
s.W("version=0\n");
|
||||
s.D();
|
||||
}
|
||||
else if (ModuleTable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = ModuleTable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
WriteEmptyLines(s, length);
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "module" + c + so[i0] + c;
|
||||
@@ -402,20 +391,20 @@ namespace KKdMainLib
|
||||
W(name + "id" , mdl.ID );
|
||||
W(name + "name" , mdl.Name );
|
||||
W(name + "ng" , mdl.NG );
|
||||
WriteEndTableDate(_IO, name + "shop_", mdl.ShopEnd);
|
||||
WriteEndTableDate(s, name + "shop_", mdl.ShopEnd);
|
||||
W(name + "shop_price", mdl.ShopPrice);
|
||||
WriteStartTableDate(_IO, name + "shop_", mdl.ShopStart);
|
||||
WriteStartTableDate(s, name + "shop_", mdl.ShopStart);
|
||||
W(name + "sort_index", mdl.SortIndex);
|
||||
}
|
||||
W("module.data_list.length", length);
|
||||
_IO.D();
|
||||
s.D();
|
||||
}
|
||||
else if (PlateTable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = PlateTable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
WriteEmptyLines(s, length);
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "plate" + c + so[i0] + c;
|
||||
@@ -436,33 +425,33 @@ namespace KKdMainLib
|
||||
W(name + "shadow_color_r", plt.ShadowColorR);
|
||||
}
|
||||
W("plate.data_list.length", length);
|
||||
_IO.D();
|
||||
s.D();
|
||||
}
|
||||
else if (PVList != null)
|
||||
else if (PVListTable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
length = PVList.Length;
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = PVListTable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
WriteEmptyLines(s, length);
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "pv_list" + c + so[i0] + c;
|
||||
|
||||
ref PV pv = ref PVList[so[i0]];
|
||||
WriteEndTableDate(_IO, name + "adv_demo_", pv.AdvEnd );
|
||||
WriteStartTableDate(_IO, name + "adv_demo_", pv.AdvStart);
|
||||
ref PV pv = ref PVListTable[so[i0]];
|
||||
WriteEndTableDate(s, name + "adv_demo_", pv.AdvEnd );
|
||||
WriteStartTableDate(s, name + "adv_demo_", pv.AdvStart);
|
||||
|
||||
WriteDifficulty(_IO, name + "easy.", pv.Easy );
|
||||
WriteDifficulty(_IO, name + "encore.", pv.Encore );
|
||||
WriteDifficulty(_IO, name + "extreme.", pv.Extreme);
|
||||
WriteDifficulty(_IO, name + "hard.", pv.Hard );
|
||||
WriteDifficulty(s, name + "easy.", pv.Easy );
|
||||
WriteDifficulty(s, name + "encore.", pv.Encore );
|
||||
WriteDifficulty(s, name + "extreme.", pv.Extreme);
|
||||
WriteDifficulty(s, name + "hard.", pv.Hard );
|
||||
W(name + "id" , pv.ID );
|
||||
W(name + "ignore", pv.Ignore);
|
||||
W(name + "name" , pv.Name );
|
||||
WriteDifficulty(_IO, name + "normal.", pv.Normal );
|
||||
WriteDifficulty(s, name + "normal.", pv.Normal );
|
||||
}
|
||||
W("pv_list.data_list.length", length);
|
||||
_IO.D();
|
||||
s.D();
|
||||
|
||||
static void WriteDifficulty(Stream _IO, string name, PV.Difficulty[] arr)
|
||||
{
|
||||
@@ -484,47 +473,47 @@ namespace KKdMainLib
|
||||
}
|
||||
else if (SlideSETable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = SlideSETable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
_IO.W("kind=1\n");
|
||||
WriteEmptyLines(s, length);
|
||||
s.W("kind=1\n");
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "slide_se" + c + so[i0] + c;
|
||||
|
||||
ref SlideSE sld = ref SlideSETable[so[i0]];
|
||||
WriteEndTableDate(_IO, name, sld.End);
|
||||
WriteEndTableDate(s, name, sld.End);
|
||||
W(name + "id" , sld. ID );
|
||||
W(name + "name" , sld. Name );
|
||||
W(name + "se_name" , sld. SEName );
|
||||
W(name + "sort_index", sld.SortIndex);
|
||||
WriteStartTableDate(_IO, name, sld.Start);
|
||||
WriteStartTableDate(s, name, sld.Start);
|
||||
}
|
||||
W("slide_se.data_list.length", length);
|
||||
_IO.D();
|
||||
s.D();
|
||||
}
|
||||
else if (SliderTouchSETable != null)
|
||||
{
|
||||
_IO = File.OpenWriter(file + ".bin", true);
|
||||
s = File.OpenWriter(file + ".bin", true);
|
||||
length = SliderTouchSETable.Length;
|
||||
so = length.SW();
|
||||
WriteEmptyLines(_IO, length);
|
||||
_IO.W("kind=3\n");
|
||||
WriteEmptyLines(s, length);
|
||||
s.W("kind=3\n");
|
||||
for (i0 = 0; i0 < length; i0++)
|
||||
{
|
||||
name = "slidertouch_se" + c + so[i0] + c;
|
||||
|
||||
ref SliderTouchSE sldt = ref SliderTouchSETable[so[i0]];
|
||||
WriteEndTableDate(_IO, name, sldt.End);
|
||||
WriteEndTableDate(s, name, sldt.End);
|
||||
W(name + "id" , sldt. ID );
|
||||
W(name + "name" , sldt. Name );
|
||||
W(name + "se_name" , sldt. SEName );
|
||||
W(name + "sort_index", sldt.SortIndex);
|
||||
WriteStartTableDate(_IO, name, sldt.Start);
|
||||
WriteStartTableDate(s, name, sldt.Start);
|
||||
}
|
||||
W("slidertouch_se.data_list.length", length);
|
||||
_IO.D();
|
||||
s.D();
|
||||
}
|
||||
|
||||
static void WriteEmptyLines(Stream _IO, int count)
|
||||
@@ -546,15 +535,15 @@ namespace KKdMainLib
|
||||
}
|
||||
|
||||
private void W(string Data, long val) =>
|
||||
_IO.W(Data + "=" + val + "\n");
|
||||
s.W(Data + "=" + val + "\n");
|
||||
private void W(string Data, string val)
|
||||
{ if (val != null) _IO.W(Data + "=" + val + "\n"); }
|
||||
{ if (val != null) s.W(Data + "=" + val + "\n"); }
|
||||
|
||||
public void MsgPackReader(string file, bool json)
|
||||
{
|
||||
ButtonSETable = null; ChainSlideSETable = null; SlideSETable = null; SliderTouchSETable = null;
|
||||
CollectionCardTable = null; CustomizeItemTable = null;
|
||||
ModuleTable = null; PlateTable = null; PVList = null;
|
||||
ModuleTable = null; PlateTable = null; PVListTable = null;
|
||||
|
||||
MsgPack msgPack = file.ReadMPAllAtOnce(json);
|
||||
MsgPack temp;
|
||||
@@ -682,11 +671,11 @@ namespace KKdMainLib
|
||||
}
|
||||
else if ((temp = msgPack["PVList", true]).NotNull)
|
||||
{
|
||||
PVList = new PV[temp.Array.Length];
|
||||
for (i0 = 0; i0 < PVList.Length; i0++)
|
||||
PVListTable = new PV[temp.Array.Length];
|
||||
for (i0 = 0; i0 < PVListTable.Length; i0++)
|
||||
{
|
||||
MsgPack pvMP = temp[i0];
|
||||
ref PV pv = ref PVList[i0];
|
||||
ref PV pv = ref PVListTable[i0];
|
||||
pv.AdvEnd .SV(pvMP.RnI32("AdvEnd" ), true);
|
||||
pv.AdvStart.SV(pvMP.RnI32("AdvStart"), false);
|
||||
|
||||
@@ -876,12 +865,12 @@ namespace KKdMainLib
|
||||
}
|
||||
msgPack.Add(plateTable);
|
||||
}
|
||||
else if (PVList != null)
|
||||
else if (PVListTable != null)
|
||||
{
|
||||
MsgPack pvList = new MsgPack(PVList.Length, "PVList");
|
||||
for (i0 = 0; i0 < PVList.Length; i0++)
|
||||
MsgPack pvList = new MsgPack(PVListTable.Length, "PVList");
|
||||
for (i0 = 0; i0 < PVListTable.Length; i0++)
|
||||
{
|
||||
ref PV pv = ref PVList[i0];
|
||||
ref PV pv = ref PVListTable[i0];
|
||||
MsgPack mp = MsgPack.New.Add("AdvEnd" , pv.AdvEnd .Int)
|
||||
.Add("AdvStart", pv.AdvStart.Int);
|
||||
|
||||
@@ -950,11 +939,11 @@ namespace KKdMainLib
|
||||
public void Dispose()
|
||||
{
|
||||
if (disposed) return;
|
||||
if (_IO != null) _IO.D(); _IO = null;
|
||||
if (s != null) s.D(); s = null;
|
||||
if (dict != null) { dict.Clear(); dict = null; }
|
||||
ButtonSETable = null; ChainSlideSETable = null; SlideSETable = null; SliderTouchSETable = null;
|
||||
CollectionCardTable = null; CustomizeItemTable = null;
|
||||
ModuleTable = null; PlateTable = null; PVList = null;
|
||||
ModuleTable = null; PlateTable = null; PVListTable = null; disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<Authors>korenkonder</Authors>
|
||||
<Company></Company>
|
||||
<Configuration></Configuration>
|
||||
<Copyright>korenkonder © 2019-2020</Copyright>
|
||||
<Copyright>korenkonder (C) 2019-2020</Copyright>
|
||||
<Description>A simple library for working with Project Diva F/AFT/F2/X/FT audio files</Description>
|
||||
<FileVersion>0.1.2.0</FileVersion>
|
||||
<PackageId>KKdSoundLib</PackageId>
|
||||
@@ -24,7 +24,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
|
||||
<NoWarn>IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -37,7 +37,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
|
||||
<NoWarn>IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KKdBaseLib\KKdBaseLib.csproj" />
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
@@ -24,7 +23,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
|
||||
<NoWarn>IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -37,7 +36,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
|
||||
<NoWarn>IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="classes\A3D.cs" />
|
||||
|
||||
+22
-14
@@ -47,21 +47,22 @@ namespace PD_Tool
|
||||
|
||||
private static void MainMenu()
|
||||
{
|
||||
Console.Title = "PD_Tool v0.4.9.4";
|
||||
Console.Title = "PD_Tool v0.4.9.8";
|
||||
Console.Clear();
|
||||
|
||||
ConsoleDesign(true);
|
||||
ConsoleDesign(" Choose action:");
|
||||
ConsoleDesign(false);
|
||||
ConsoleDesign("1. Extract FARC Archive");
|
||||
ConsoleDesign("2. Create FARC Archive");
|
||||
ConsoleDesign("3. Decrypt/Encrypt from/to DIVAFILE");
|
||||
ConsoleDesign("4. DB_Tools");
|
||||
ConsoleDesign("5. AC/DT/F/AFT Converting Tools");
|
||||
ConsoleDesign("6. F/F2/FT Converting Tools");
|
||||
ConsoleDesign("7. X/XHD Converting Tools");
|
||||
ConsoleDesign("8. FT/M39 Converting Tools");
|
||||
ConsoleDesign(json ? "9. MsgPack to JSON" : "9. JSON to MsgPack");
|
||||
ConsoleDesign("2. Create FARC Archive");
|
||||
ConsoleDesign("3. Decrypt from DIVAFILE");
|
||||
ConsoleDesign("4. Encrypt to DIVAFILE");
|
||||
ConsoleDesign("5. DB_Tools");
|
||||
ConsoleDesign("6. AC/DT/F/AFT Converting Tools");
|
||||
ConsoleDesign("7. F/F2/FT Converting Tools");
|
||||
ConsoleDesign("8. X/XHD Converting Tools");
|
||||
ConsoleDesign("9. FT/M39 Converting Tools");
|
||||
ConsoleDesign(json ? "A. MsgPack to JSON" : "A. JSON to MsgPack");
|
||||
ConsoleDesign(false);
|
||||
ConsoleDesign(json ? "M. MessagePack" : "J. JSON");
|
||||
ConsoleDesign("Q. Quit");
|
||||
@@ -76,6 +77,7 @@ namespace PD_Tool
|
||||
if (choose == null || choose == "") return;
|
||||
if (choose[0] == 'M') json = false;
|
||||
else if (choose[0] == 'J') json = true ;
|
||||
else if (choose[0] >= 'A' && choose[0] <= 'A') Functions();
|
||||
}
|
||||
|
||||
private static void Functions()
|
||||
@@ -89,8 +91,14 @@ namespace PD_Tool
|
||||
Choose(1, "", out string[] FileNames);
|
||||
foreach (string FileName in FileNames) DIVAFILE.Decrypt(FileName);
|
||||
}
|
||||
else if (choose[0] == '4') DataBase.Processor(json);
|
||||
else if (choose[0] == '4')
|
||||
{
|
||||
Choose(1, "", out string[] FileNames);
|
||||
foreach (string FileName in FileNames) DIVAFILE.Encrypt(FileName);
|
||||
}
|
||||
else if (choose[0] == '5')
|
||||
DataBase.Processor(json, choose.Length > 1 ? choose[1] : '\0');
|
||||
else if (choose[0] == '6')
|
||||
{
|
||||
string localChoose = "";
|
||||
if (choose.Length == 1)
|
||||
@@ -128,7 +136,7 @@ namespace PD_Tool
|
||||
else if (localChoose == "9") TBL.Processor(json);
|
||||
else choose = localChoose;
|
||||
}
|
||||
else if (choose[0] == '6')
|
||||
else if (choose[0] == '7')
|
||||
{
|
||||
string localChoose = "";
|
||||
if (choose.Length == 1)
|
||||
@@ -164,7 +172,7 @@ namespace PD_Tool
|
||||
else if (localChoose == "8") VAG.Processor();
|
||||
else choose = localChoose;
|
||||
}
|
||||
else if (choose[0] == '7')
|
||||
else if (choose[0] == '8')
|
||||
{
|
||||
string localChoose = "";
|
||||
if (choose.Length == 1)
|
||||
@@ -190,7 +198,7 @@ namespace PD_Tool
|
||||
else if (localChoose == "3") VAG.Processor();
|
||||
else choose = localChoose;
|
||||
}
|
||||
else if (choose[0] == '8')
|
||||
else if (choose[0] == '9')
|
||||
{
|
||||
string localChoose = "";
|
||||
if (choose.Length == 1)
|
||||
@@ -228,7 +236,7 @@ namespace PD_Tool
|
||||
else if (localChoose == "9") TBL.Processor(json);
|
||||
else choose = localChoose;
|
||||
}
|
||||
else if (choose == "9")
|
||||
else if (choose[0] == 'A')
|
||||
{
|
||||
Console.Title = json ? "MsgPack to JSON" : "JSON to MsgPack";
|
||||
Choose(1, json ? "mp" : "json", out string[] fileNames);
|
||||
|
||||
@@ -6,10 +6,10 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PD_Tool")]
|
||||
[assembly: AssemblyCopyright("korenkonder © 2017-2020")]
|
||||
[assembly: AssemblyCopyright("korenkonder (C) 2017-2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("7B5D5A3A-A6F8-4813-C97D-ACFC98F7397E")]
|
||||
[assembly: AssemblyVersion("0.4.9.4")]
|
||||
[assembly: AssemblyFileVersion("0.4.9.4")]
|
||||
[assembly: AssemblyVersion("0.4.9.8")]
|
||||
[assembly: AssemblyFileVersion("0.4.9.8")]
|
||||
|
||||
+49
-45
@@ -20,36 +20,36 @@ namespace PD_Tool
|
||||
|
||||
Format format = Format.NULL;
|
||||
string choose = "";
|
||||
if (mp)
|
||||
{
|
||||
Console.Clear();
|
||||
Program.ConsoleDesign(true);
|
||||
Program.ConsoleDesign(" Choose type of format to export:");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign("1. A3DA [DT/AC/F]");
|
||||
Program.ConsoleDesign("2. A3DC [DT/AC/F]");
|
||||
Program.ConsoleDesign("3. A3DA [AFT/FT/M39]");
|
||||
Program.ConsoleDesign("4. A3DC [AFT/FT/M39]");
|
||||
Program.ConsoleDesign("5. A3DC [F2]");
|
||||
Program.ConsoleDesign("6. A3DC [MGF]");
|
||||
Program.ConsoleDesign("7. A3DC [X]");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign(true);
|
||||
Console.WriteLine();
|
||||
choose = Console.ReadLine().ToUpper();
|
||||
if (choose == "1") format = Format.DT ;
|
||||
else if (choose == "2") format = Format.F ;
|
||||
else if (choose == "3") format = Format.AFT;
|
||||
else if (choose == "4") format = Format.AFT;
|
||||
else if (choose == "5") format = Format.F2;
|
||||
else if (choose == "6") format = Format.MGF;
|
||||
else if (choose == "7") format = Format.X ;
|
||||
else return;
|
||||
}
|
||||
Console.Clear();
|
||||
Program.ConsoleDesign(true);
|
||||
Program.ConsoleDesign(" Choose type of format to export:");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign("1. A3DA [DT/AC/F]");
|
||||
Program.ConsoleDesign("2. A3DC [DT/AC/F]");
|
||||
Program.ConsoleDesign("3. A3DA [AFT/FT/M39]");
|
||||
Program.ConsoleDesign("4. A3DC [AFT/FT/M39]");
|
||||
Program.ConsoleDesign("5. A3DC [F2]");
|
||||
Program.ConsoleDesign("6. A3DC [MGF]");
|
||||
Program.ConsoleDesign("7. A3DC [X]");
|
||||
if (!mp) Program.ConsoleDesign($"8. {(json ? "JSON" : "MsgPack")}");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign(true);
|
||||
Console.WriteLine();
|
||||
choose = Console.ReadLine().ToUpper();
|
||||
if (choose == "1") format = Format.DT ;
|
||||
else if (choose == "2") format = Format.F ;
|
||||
else if (choose == "3") format = Format.AFT;
|
||||
else if (choose == "4") format = Format.AFT;
|
||||
else if (choose == "5") format = Format.F2;
|
||||
else if (choose == "6") format = Format.MGF;
|
||||
else if (choose == "7") format = Format.X ;
|
||||
else if (choose == "8") format = Format.NULL;
|
||||
else return;
|
||||
|
||||
int state;
|
||||
string filepath, ext;
|
||||
KKdA3DA a3da;
|
||||
KKdFARC farc;
|
||||
foreach (string file in fileNames)
|
||||
{
|
||||
ext = Path.GetExtension(file);
|
||||
@@ -58,13 +58,20 @@ namespace PD_Tool
|
||||
|
||||
Console.Title = "A3DA Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".farc")
|
||||
using (KKdFARC farc = new KKdFARC(file))
|
||||
using (farc = new KKdFARC(file))
|
||||
FARCProcessor(farc, choose, format);
|
||||
else if (ext == ".a3da")
|
||||
using (a3da = new KKdA3DA(true))
|
||||
{
|
||||
state = a3da.A3DAReader(filepath);
|
||||
if (state == 1) a3da.MsgPackWriter(filepath, json);
|
||||
if (state == 1)
|
||||
if (choose == "8") a3da.MsgPackWriter(filepath, json);
|
||||
else
|
||||
{
|
||||
a3da.Head.Format = format;
|
||||
File.WriteAllBytes(filepath + ".a3da", (choose == "1" ||
|
||||
choose == "3") ? a3da.A3DAWriter() : a3da.A3DCWriter());
|
||||
}
|
||||
}
|
||||
else if (ext == ".mp" || ext == ".json")
|
||||
using (a3da = new KKdA3DA(true))
|
||||
@@ -72,26 +79,21 @@ namespace PD_Tool
|
||||
a3da.MsgPackReader(filepath, ext == ".json");
|
||||
a3da.Head.Format = format;
|
||||
|
||||
File.WriteAllBytes(filepath + ".a3da", (choose != "1" &&
|
||||
choose != "3") ? a3da.A3DCWriter() : a3da.A3DAWriter());
|
||||
File.WriteAllBytes(filepath + ".a3da", (choose == "1" ||
|
||||
choose == "3") ? a3da.A3DAWriter() : a3da.A3DCWriter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void FARCProcessor(KKdFARC farc, string choose, Format format)
|
||||
{
|
||||
if (!farc.HeaderReader()) return;
|
||||
if (!farc.HasFiles) return;
|
||||
if (!farc.HeaderReader() || !farc.HasFiles) return;
|
||||
|
||||
KKdList<string> list = KKdList<string>.New;
|
||||
for (int i = 0; i < farc.Files.Count; i++)
|
||||
{
|
||||
string file = farc.Files[i].Name.ToLower();
|
||||
bool div = false;
|
||||
for (int i0 = 0; i0 < 159 && !div; i0++)
|
||||
if (file.Contains("div_" + i0)) div = true;
|
||||
|
||||
if (!div && file.EndsWith(".a3da")) list.Add(file);
|
||||
if (!file.Contains("_div_") && file.EndsWith(".a3da")) list.Add(file);
|
||||
}
|
||||
|
||||
KKdList<string> A3DAlist = KKdList<string>.New;
|
||||
@@ -100,7 +102,7 @@ namespace PD_Tool
|
||||
A3DAlist.Add(farc.Files[i].Name);
|
||||
|
||||
byte[] data = null;
|
||||
if (list.Count == A3DAlist.Count || (format > Format.AFT && format < Format.FT))
|
||||
if (list.Count == A3DAlist.Count)
|
||||
{
|
||||
KKdA3DA a3da;
|
||||
for (int i = 0; i < A3DAlist.Count; i++)
|
||||
@@ -112,7 +114,7 @@ namespace PD_Tool
|
||||
{
|
||||
KKdFARC.FARCFile file = farc.Files[i];
|
||||
a3da.Head.Format = format;
|
||||
file.Data = (choose != "1" && choose != "3") ? a3da.A3DCWriter() : a3da.A3DAWriter();
|
||||
file.Data = (choose == "1"|| choose == "3") ? a3da.A3DAWriter() : a3da.A3DCWriter();
|
||||
farc.Files[i] = file;
|
||||
}
|
||||
}
|
||||
@@ -121,7 +123,7 @@ namespace PD_Tool
|
||||
}
|
||||
|
||||
KKdA3DA[] a3daArray;
|
||||
using (KKdList<KKdA3DA> a3daList = KKdList<KKdA3DA>.New)
|
||||
using (KKdList<KKdA3DA> a3daList = KKdList<KKdA3DA>.NewReserve(list.Count))
|
||||
{
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
@@ -139,13 +141,14 @@ namespace PD_Tool
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (a3daArray[i].Data.PlayControl.Div == null) continue;
|
||||
float Div = a3daArray[i].Data.PlayControl.Div.Value;
|
||||
int div = a3daArray[i].Data.PlayControl.Div.Value;
|
||||
string filename = Path.GetFileNameWithoutExtension(list[i]);
|
||||
string ext = Path.GetExtension(list[i]);
|
||||
KKdA3DA a3da;
|
||||
for (int i1 = 1; i1 < Div; i1++)
|
||||
for (int i1 = 1; i1 < div; i1++)
|
||||
using (a3da = new KKdA3DA(true))
|
||||
{
|
||||
string file = Path.GetFileNameWithoutExtension(list[i]) +
|
||||
"_div_" + i1 + Path.GetExtension(list[i]);
|
||||
string file = filename + "_div_" + i1 + ext;
|
||||
data = farc.FileReader(file);
|
||||
int state = a3da.A3DAReader(data);
|
||||
if (state == 1) a3daArray[i].A3DAMerger(ref a3da.Data);
|
||||
@@ -153,13 +156,14 @@ namespace PD_Tool
|
||||
a3daArray[i].Data.PlayControl.Div = null;
|
||||
}
|
||||
|
||||
farc.Files.Capacity = 0;
|
||||
farc.Files.Capacity = list.Count;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
KKdFARC.FARCFile file = default;
|
||||
file.Name = list[i];
|
||||
a3daArray[i].Head.Format = format;
|
||||
file.Data = (choose != "1" && choose != "3") ? a3daArray[i].A3DCWriter() : a3daArray[i].A3DAWriter();
|
||||
file.Data = (choose == "1" || choose == "3") ? a3daArray[i].A3DAWriter() : a3daArray[i].A3DCWriter();
|
||||
farc.Files.Add(file);
|
||||
}
|
||||
farc.Save();
|
||||
|
||||
+16
-17
@@ -15,25 +15,24 @@ namespace PD_Tool
|
||||
string filepath, ext;
|
||||
AddParam adp;
|
||||
foreach (string file in fileNames)
|
||||
{
|
||||
adp = new AddParam();
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
using (adp = new AddParam())
|
||||
{
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "Add Param Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".adp")
|
||||
{
|
||||
adp.AddParamReader(filepath);
|
||||
adp. MsgPackWriter(filepath, json);
|
||||
Console.Title = "Add Param Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".adp")
|
||||
{
|
||||
adp.AddParamReader(filepath);
|
||||
adp. MsgPackWriter(filepath, json);
|
||||
}
|
||||
else if (ext == ".mp" || ext == ".json")
|
||||
{
|
||||
adp. MsgPackReader(filepath, ext == ".json");
|
||||
adp.AddParamWriter(filepath);
|
||||
}
|
||||
}
|
||||
else if (ext == ".mp" || ext == ".json")
|
||||
{
|
||||
adp. MsgPackReader(filepath, ext == ".json");
|
||||
adp.AddParamWriter(filepath);
|
||||
}
|
||||
adp.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -22,8 +22,16 @@ namespace PD_Tool
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "Bloom Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".blt") { blt.BLTReader(filepath); blt.TXTWriter(filepath); }
|
||||
//else if (ext == ".txt") { blt.TXTReader(filepath); blt.BLTWriter(filepath); }
|
||||
if (ext == ".blt")
|
||||
{
|
||||
blt.BLTReader(filepath);
|
||||
blt.TXTWriter(filepath);
|
||||
}
|
||||
/*else if (ext == ".txt")
|
||||
{
|
||||
blt.TXTReader(filepath);
|
||||
blt.BLTWriter(filepath);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -22,8 +22,16 @@ namespace PD_Tool
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "Color Correction Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".cct") { cct.CCTReader(filepath); cct.TXTWriter(filepath); }
|
||||
//else if (ext == ".txt") { cct.TXTReader(filepath); cct.BLTWriter(filepath); }
|
||||
if (ext == ".cct")
|
||||
{
|
||||
cct.CCTReader(filepath);
|
||||
cct.TXTWriter(filepath);
|
||||
}
|
||||
/*else if (ext == ".txt")
|
||||
{
|
||||
blt.TXTReader(filepath);
|
||||
blt.CCTWriter(filepath);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace PD_Tool
|
||||
if (file.EndsWith(".mp" )) { mp = false; break; }
|
||||
else if (file.EndsWith(".json")) { mp = false; break; }
|
||||
|
||||
uint num2 = (uint)(DateTime.Now.Ticks / 10000000);
|
||||
uint num2 = (uint)((DateTime.Now.Ticks - 621355968000000000) / 10000000);
|
||||
string[] file_split;
|
||||
string filepath, ext;
|
||||
KKdMainLib.DataBank db;
|
||||
|
||||
+10
-2
@@ -22,8 +22,16 @@ namespace PD_Tool
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "DOF Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".dft") { dft.DFTReader(filepath); dft.TXTWriter(filepath); }
|
||||
//else if (ext == ".txt") { dft.TXTReader(filepath); dft.DFTWriter(filepath); }
|
||||
if (ext == ".dft")
|
||||
{
|
||||
dft.DFTReader(filepath);
|
||||
dft.TXTWriter(filepath);
|
||||
}
|
||||
/*else if (ext == ".txt")
|
||||
{
|
||||
dft.TXTReader(filepath);
|
||||
dft.DFTWriter(filepath);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-18
@@ -8,25 +8,29 @@ namespace PD_Tool
|
||||
{
|
||||
public class DataBase
|
||||
{
|
||||
public static void Processor(bool json)
|
||||
public static void Processor(bool json, char choose)
|
||||
{
|
||||
Console.Title = "DB Converter";
|
||||
Console.Clear();
|
||||
Program.ConsoleDesign(true);
|
||||
Program.ConsoleDesign(" Choose type of DataBase file:");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign("1. Auth DB Converter");
|
||||
Program.ConsoleDesign("2. AET DB Converter");
|
||||
Program.ConsoleDesign("3. SPR DB Converter");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign("R. Return to Main Menu");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign(true);
|
||||
Console.WriteLine();
|
||||
string format = Console.ReadLine().ToUpper();
|
||||
if (format == "1") AuthDBProcessor(json);
|
||||
if (format == "2") AETDBProcessor(json);
|
||||
if (format == "3") SPRDBProcessor(json);
|
||||
if (choose == '\0')
|
||||
{
|
||||
Console.Title = "DB Converter";
|
||||
Console.Clear();
|
||||
Program.ConsoleDesign(true);
|
||||
Program.ConsoleDesign(" Choose type of DataBase file:");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign("1. Auth DB Converter");
|
||||
Program.ConsoleDesign("2. AET DB Converter");
|
||||
Program.ConsoleDesign("3. SPR DB Converter");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign("R. Return to Main Menu");
|
||||
Program.ConsoleDesign(false);
|
||||
Program.ConsoleDesign(true);
|
||||
Console.WriteLine();
|
||||
string format = Console.ReadLine().ToUpper();
|
||||
if (format.Length > 0) choose = format[0];
|
||||
}
|
||||
if (choose == '1') AuthDBProcessor(json);
|
||||
if (choose == '2') AETDBProcessor(json);
|
||||
if (choose == '3') SPRDBProcessor(json);
|
||||
}
|
||||
|
||||
public static void AuthDBProcessor(bool JSON)
|
||||
|
||||
+10
-2
@@ -22,8 +22,16 @@ namespace PD_Tool
|
||||
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); }
|
||||
if (ext == ".lit")
|
||||
{
|
||||
lit.LITReader(filepath);
|
||||
lit.TXTWriter(filepath);
|
||||
}
|
||||
/*else if (ext == ".txt")
|
||||
{
|
||||
lit.TXTReader(filepath);
|
||||
lit.LITWriter(filepath);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-17
@@ -15,25 +15,24 @@ namespace PD_Tool
|
||||
string filepath, ext;
|
||||
MotHead mhd;
|
||||
foreach (string file in fileNames)
|
||||
{
|
||||
mhd = new MotHead();
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
using (mhd = new MotHead())
|
||||
{
|
||||
ext = Path.GetExtension(file);
|
||||
filepath = file.Replace(ext, "");
|
||||
ext = ext.ToLower();
|
||||
|
||||
Console.Title = "MotHead Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".bin")
|
||||
{
|
||||
mhd.MotHeadReader(filepath);
|
||||
mhd.MsgPackWriter(filepath, json);
|
||||
Console.Title = "MotHead Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".bin")
|
||||
{
|
||||
mhd.MotHeadReader(filepath);
|
||||
mhd.MsgPackWriter(filepath, json);
|
||||
}
|
||||
else if (ext == ".mp" || ext == ".json")
|
||||
{
|
||||
mhd.MsgPackReader(filepath, ext == ".json");
|
||||
mhd.MotHeadWriter(filepath);
|
||||
}
|
||||
}
|
||||
else if (ext == ".mp" || ext == ".json")
|
||||
{
|
||||
mhd.MsgPackReader(filepath, ext == ".json");
|
||||
mhd.MotHeadWriter(filepath);
|
||||
}
|
||||
mhd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,78 @@ namespace PD_Tool
|
||||
Console.Title = "MOT Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".bin")
|
||||
{
|
||||
/*KKdBaseLib.KKdDict<int, int> a = KKdBaseLib.KKdDict<int, int>.New;
|
||||
while (true)
|
||||
{
|
||||
string b = Console.ReadLine();
|
||||
if (b == "") break;
|
||||
string[] c = b.Split(' ');
|
||||
if (c.Length == 2)
|
||||
a.Add(int.Parse(c[0]), int.Parse(c[1]));
|
||||
}
|
||||
a.Add(0, 1);
|
||||
a.Add(1648, 3);
|
||||
a.Add(2139, 2);
|
||||
a.Add(5416, 4);
|
||||
a.Add(6589, 5);
|
||||
a.Add(7783, 1);
|
||||
mot.MOTReader(filepath);
|
||||
|
||||
Mot.KeySet[] oks = mot.MOT[1].KeySet.V;
|
||||
Mot.MotHeader mh = mot.MOT[1];
|
||||
mh.KeySet.V = new Mot.KeySet[mh.KeySet.V.Length];
|
||||
Mot.KeySet[] ok = mh.KeySet.V;
|
||||
for (int i = 0; i < mh.KeySet.V.Length; i++)
|
||||
{
|
||||
KKdBaseLib.Interpolation.PDI[] pdi = new KKdBaseLib.Interpolation.PDI[mot.MOT.Length];
|
||||
for (int h = 0; h < mot.MOT.Length; h++)
|
||||
pdi[h] = new KKdBaseLib.Interpolation.PDI(mot.MOT[h].KeySet.V[i].Keys);
|
||||
|
||||
KKdBaseLib.KKdList<KKdBaseLib.KFT2> kf = KKdBaseLib.KKdList<KKdBaseLib.KFT2>.New;
|
||||
|
||||
bool old = false;
|
||||
KKdBaseLib.KFT2 v = default;
|
||||
KKdBaseLib.KFT2 ov = default;
|
||||
int k = -1;
|
||||
for (int h = 0; h < mh.FrameCount; h++)
|
||||
{
|
||||
if (a.ContainsKey(h))
|
||||
k = a[h];
|
||||
else if (k == -1) continue;
|
||||
|
||||
ref KKdBaseLib.Interpolation.PDI pdil = ref pdi[k];
|
||||
|
||||
v.F = h;
|
||||
v.V = pdil.SetFrame(h);
|
||||
if (h == 0 || ov.V != v.V)
|
||||
{
|
||||
if (old) { old = false; kf.Add(ov); }
|
||||
kf.Add(v);
|
||||
}
|
||||
else old = true;
|
||||
ov = v;
|
||||
}
|
||||
kf.Capacity = kf.Count;
|
||||
ok[i].Keys = kf.ToArray();
|
||||
ok[i].Type = Mot.KeySetType.Linear;
|
||||
|
||||
for (int h = 0; h < mot.MOT.Length; h++)
|
||||
pdi[h] = default;
|
||||
}
|
||||
for (int i = 0; i < mh.KeySet.V.Length; i++)
|
||||
{
|
||||
if (ok[i].Keys.Length != 1) continue;
|
||||
|
||||
if (ok[i].Keys[0].V == 0)
|
||||
{
|
||||
ok[i].Keys[0].F = 0;
|
||||
ok[i].Type = Mot.KeySetType.None;
|
||||
}
|
||||
else ok[i].Type = Mot.KeySetType.Static;
|
||||
}
|
||||
mot.MOT[1].KeySet.V = ok;
|
||||
Array.Resize(ref mot.MOT, 2);
|
||||
mot.MOTWriter(filepath + "_mod");*/
|
||||
mot. MOTReader(filepath);
|
||||
mot.MsgPackWriter(filepath, json);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace PD_Tool
|
||||
Console.Title = "STR Converter: " + Path.GetFileNameWithoutExtension(file);
|
||||
if (ext == ".str" || ext == ".bin")
|
||||
{
|
||||
str.STRReader (filepath, ext);
|
||||
str.STRReader (filepath, ext);
|
||||
str.MsgPackWriter(filepath, json);
|
||||
}
|
||||
else if (ext == ".json" || ext == ".mp")
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
A simple tool for working with Project Diva AC/DT/F/AFT/F2/X/FT/M39 files
|
||||
|
||||
# Dependencies:
|
||||
+ `.NET Standard 2.0`: Required to build KKdBaseLib, KKdMainLib and KKdSoundLib C# projects.
|
||||
+ `.NET Framework 4.6.1`: Required to run/build PD_Tool C# project.
|
||||
+ `.NET Framework 4.6.1`: Required to build KKdBaseLib, KKdMainLib and KKdSoundLib C# projects and to run/build PD_Tool C# project.
|
||||
|
||||
# Tools:
|
||||
- `FARC Extract/Create`
|
||||
@@ -20,8 +19,8 @@ A simple tool for working with Project Diva AC/DT/F/AFT/F2/X/FT/M39 files
|
||||
- `DIVA Converter`
|
||||
- `MotHead Converter`
|
||||
- `MOT Converter`
|
||||
- `Table Converter`
|
||||
- `STR Converter`
|
||||
- `Table Converter`
|
||||
- `F/F2/FT Converting Tools`
|
||||
- `A3DA Converter`
|
||||
- `Bloom Converter`
|
||||
@@ -43,5 +42,5 @@ A simple tool for working with Project Diva AC/DT/F/AFT/F2/X/FT/M39 files
|
||||
- `DIVA Converter`
|
||||
- `MotHead Converter`
|
||||
- `MOT Converter`
|
||||
- `Table Converter`
|
||||
- `STR Converter`
|
||||
- `Table Converter`
|
||||
|
||||
Reference in New Issue
Block a user