Compare commits
3
Commits
v0.4.10.18
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
797d0f9467 | ||
|
|
8b46fbbe03 | ||
|
|
b66b3b01d0 |
+18
-1
@@ -16,12 +16,29 @@ namespace KKdBaseLib.Auth2D
|
||||
public uint BackColor;
|
||||
public uint Width;
|
||||
public uint Height;
|
||||
public Pointer<Vec2<CountPointer<KFT2>>> Camera;
|
||||
public Pointer<Camera> Camera;
|
||||
public CountPointer<Composition> Composition;
|
||||
public CountPointer<Video > Video;
|
||||
public CountPointer<Audio > Audio;
|
||||
}
|
||||
|
||||
public struct Camera
|
||||
{
|
||||
public CountPointer<KFT2> EyeX;
|
||||
public CountPointer<KFT2> EyeY;
|
||||
public CountPointer<KFT2> EyeZ;
|
||||
public CountPointer<KFT2> PositionX;
|
||||
public CountPointer<KFT2> PositionY;
|
||||
public CountPointer<KFT2> PositionZ;
|
||||
public CountPointer<KFT2> DirectionX;
|
||||
public CountPointer<KFT2> DirectionY;
|
||||
public CountPointer<KFT2> DirectionZ;
|
||||
public CountPointer<KFT2> RotationX;
|
||||
public CountPointer<KFT2> RotationY;
|
||||
public CountPointer<KFT2> RotationZ;
|
||||
public CountPointer<KFT2> Zoom ;
|
||||
}
|
||||
|
||||
public struct Composition
|
||||
{
|
||||
public int P;
|
||||
|
||||
@@ -142,6 +142,9 @@ namespace KKdBaseLib.Auth3D
|
||||
public float? Max;
|
||||
public float Value;
|
||||
public bool RawData;
|
||||
public bool RawDataBinary;
|
||||
public int? RawDataValueListSize;
|
||||
public int? RawDataValueListOffset;
|
||||
public KFT3[] Keys;
|
||||
|
||||
public Key(A3DAKey k)
|
||||
@@ -150,6 +153,9 @@ namespace KKdBaseLib.Auth3D
|
||||
Value = 0;
|
||||
BinOffset = null;
|
||||
RawData = default;
|
||||
RawDataBinary = default;
|
||||
RawDataValueListSize = null;
|
||||
RawDataValueListOffset = null;
|
||||
Keys = null;
|
||||
|
||||
EPTypePost = k.EPTypePost;
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<Authors>korenkonder</Authors>
|
||||
<Company></Company>
|
||||
<Configuration></Configuration>
|
||||
<Copyright>korenkonder (C) 2019-2022</Copyright>
|
||||
<Copyright>korenkonder (C) 2019-2025</Copyright>
|
||||
<Description>A base library</Description>
|
||||
<FileVersion>0.4.10.12</FileVersion>
|
||||
<FileVersion>0.5.0.0</FileVersion>
|
||||
<PackageId>KKdBaseLib</PackageId>
|
||||
<Product>KKdBaseLib</Product>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
<Title>KKdBaseLib</Title>
|
||||
<Version>0.4.10.12</Version>
|
||||
<Version>0.5.0.0</Version>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
||||
+39
-5
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace KKdBaseLib
|
||||
@@ -79,7 +80,7 @@ namespace KKdBaseLib
|
||||
|
||||
if (trace > 0)
|
||||
{
|
||||
double sq = System.Math.Sqrt(trace);
|
||||
double sq = Math.Sqrt(trace);
|
||||
|
||||
q.W = (float)sq;
|
||||
sq = 1.0 / (4.0 * sq);
|
||||
@@ -89,7 +90,7 @@ namespace KKdBaseLib
|
||||
}
|
||||
else if (row0.X > row1.Y && row0.X > row2.Z)
|
||||
{
|
||||
double sq = 2.0 * System.Math.Sqrt(1.0 + row0.X - row1.Y - row2.Z);
|
||||
double sq = 2.0 * Math.Sqrt(1.0 + row0.X - row1.Y - row2.Z);
|
||||
|
||||
q.X = (float)(0.25 * sq);
|
||||
sq = 1.0 / sq;
|
||||
@@ -99,7 +100,7 @@ namespace KKdBaseLib
|
||||
}
|
||||
else if (row1.Y > row2.Z)
|
||||
{
|
||||
double sq = 2.0 * System.Math.Sqrt(1.0 + row1.Y - row0.X - row2.Z);
|
||||
double sq = 2.0 * Math.Sqrt(1.0 + row1.Y - row0.X - row2.Z);
|
||||
|
||||
q.Y = (float)(0.25 * sq);
|
||||
sq = 1.0 / sq;
|
||||
@@ -109,7 +110,7 @@ namespace KKdBaseLib
|
||||
}
|
||||
else
|
||||
{
|
||||
double sq = 2.0 * System.Math.Sqrt(1.0 + row2.Z - row0.X - row1.Y);
|
||||
double sq = 2.0 * Math.Sqrt(1.0 + row2.Z - row0.X - row1.Y);
|
||||
|
||||
q.Z = (float)(0.25 * sq);
|
||||
sq = 1.0 / sq;
|
||||
@@ -121,6 +122,33 @@ namespace KKdBaseLib
|
||||
return q.Normalized;
|
||||
}
|
||||
|
||||
public Vec3 GetRotation()
|
||||
{
|
||||
Vec3 rotation;
|
||||
if (-Row0.Z >= 1.0f)
|
||||
rotation.Y = (float)(Math.PI / 2.0);
|
||||
else if (-Row0.Z <= -1.0f)
|
||||
rotation.Y = (float)(-Math.PI / 2.0);
|
||||
else
|
||||
rotation.Y = (float)Math.Asin(-Row0.Z);
|
||||
|
||||
if (Math.Abs(Row0.Z) < 0.99999899f) {
|
||||
rotation.X = (float)Math.Atan2(Row1.Z, Row2.Z);
|
||||
rotation.Z = (float)Math.Atan2(Row0.Y, Row0.X);
|
||||
}
|
||||
else {
|
||||
rotation.X = 0.0f;
|
||||
rotation.Z = (float)Math.Atan2(Row2.Y, Row1.Y);
|
||||
if (Row0.Z > 0.0f)
|
||||
rotation.Z = -rotation.Z;
|
||||
}
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public Vec3 GetScale() => new Vec3(Row0.Length, Row1.Length, Row2.Length);
|
||||
|
||||
public Vec3 GetTranslation() => Row3.XYZ;
|
||||
|
||||
public Mat4 Invert() => -this;
|
||||
|
||||
public Mat4 Translate(Vec3 vec)
|
||||
@@ -129,7 +157,13 @@ namespace KKdBaseLib
|
||||
public Mat4 Translate(Vec4 vec)
|
||||
{ Row3 = vec * this; return this; }
|
||||
|
||||
public static Mat4 operator +(Mat4 left, Mat4 right)
|
||||
public void TransformVector(in Vec3 normal, out Vec3 normalOut) {
|
||||
normalOut = (Row0 * new Vec4(normal.X) +
|
||||
Row1 * new Vec4(normal.Y) +
|
||||
Row2 * new Vec4(normal.Z)).XYZ;
|
||||
}
|
||||
|
||||
public static Mat4 operator +(Mat4 left, Mat4 right)
|
||||
{ left.Row0 += right.Row0; left.Row1 += right.Row1;
|
||||
left.Row2 += right.Row2; left.Row3 += right.Row3; return left; }
|
||||
|
||||
|
||||
+35
-67
@@ -45,52 +45,9 @@ namespace KKdBaseLib
|
||||
|
||||
public Vec3 XYZ { get => new Vec3(X, Y, Z); set { X = value.X; Y = value.Y; Z = value.Z; } }
|
||||
|
||||
public float Length => (X * X + Y * Y + Z * Z + W * W).Sqrt();
|
||||
public float LengthSquared => X * X + Y * Y + Z * Z + W * W;
|
||||
public Quat Normalized => new Quat(X, Y, Z, W) * (Length == 0.0f ? 1.0f : (1.0f / Length));
|
||||
public Vec3 Euler { get
|
||||
{
|
||||
if (LengthSquared == 0) return default;
|
||||
|
||||
const float SINGULARITY_THRESHOLD = 0.4999995f;
|
||||
const float HalfPI = (float)(System.Math.PI * 0.5);
|
||||
|
||||
float sqx = X * X, sqy = Y * Y, sqz = Z * Z, sqw = W * W;
|
||||
float unit = sqx + sqy + sqz + sqw;
|
||||
float singularityTest = X * Z + Y * W;
|
||||
|
||||
if (singularityTest > SINGULARITY_THRESHOLD * unit)
|
||||
return new Vec3(0.0f, HalfPI, (float)(System.Math.Atan2(X, W) * 2.0));
|
||||
else if (singularityTest < -SINGULARITY_THRESHOLD * unit)
|
||||
return new Vec3(0.0f, -HalfPI, -(float)(System.Math.Atan2(X, W) * 2.0));
|
||||
else
|
||||
return new Vec3((float)System.Math.Atan2(2 * (X * W - Y * Z), sqw - sqx - sqy + sqz),
|
||||
(float)System.Math.Asin (2 * singularityTest / unit),
|
||||
(float)System.Math.Atan2(2 * (Z * W - X * Y), sqw + sqx - sqy - sqz));
|
||||
}
|
||||
}
|
||||
public Vec3 EulerDeg { get
|
||||
{
|
||||
if (LengthSquared == 0) return default;
|
||||
|
||||
const float SINGULARITY_THRESHOLD = 0.4999995f;
|
||||
const float HalfPI = (float)(System.Math.PI * 0.5);
|
||||
|
||||
float sqx = X * X, sqy = Y * Y, sqz = Z * Z, sqw = W * W;
|
||||
float unit = sqx + sqy + sqz + sqw;
|
||||
float singularityTest = X * Z + Y * W;
|
||||
|
||||
if (singularityTest > SINGULARITY_THRESHOLD * unit)
|
||||
return new Vec3(0.0f, HalfPI, (float)(System.Math.Atan2(X, W) * 2.0));
|
||||
else if (singularityTest < -SINGULARITY_THRESHOLD * unit)
|
||||
return new Vec3(0.0f, -HalfPI, -(float)(System.Math.Atan2(X, W) * 2.0));
|
||||
else
|
||||
return new Vec3((float)System.Math.Atan2(2 * (X * W - Y * Z), sqw - sqx - sqy + sqz),
|
||||
(float)System.Math.Asin (2 * singularityTest / unit),
|
||||
(float)System.Math.Atan2(2 * (Z * W - X * Y), sqw + sqx - sqy - sqz))
|
||||
* (float)(180.0 / System.Math.PI);
|
||||
}
|
||||
}
|
||||
public readonly float Length => (X * X + Y * Y + Z * Z + W * W).Sqrt();
|
||||
public readonly float LengthSquared => X * X + Y * Y + Z * Z + W * W;
|
||||
public readonly Quat Normalized => this * (Length == 0.0f ? 1.0f : (1.0f / Length));
|
||||
|
||||
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; }
|
||||
@@ -125,34 +82,45 @@ namespace KKdBaseLib
|
||||
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)
|
||||
{
|
||||
q1 = q1.Normalized;
|
||||
q2 = q2.Normalized;
|
||||
public static Quat Lerp(Quat left, Quat right, float blend) {
|
||||
Quat x_t;
|
||||
Quat y_t;
|
||||
x_t = left;
|
||||
y_t = right;
|
||||
|
||||
float dot = Dot(q1, q2);
|
||||
if (Dot(x_t, y_t) < 0.0f)
|
||||
x_t = -x_t;
|
||||
|
||||
return (x_t * (1.0f - blend) + y_t * blend).Normalized;
|
||||
}
|
||||
|
||||
public static Quat Slerp(Quat left, Quat right, float blend)
|
||||
{
|
||||
Quat x_t;
|
||||
Quat y_t;
|
||||
x_t = left;
|
||||
y_t = right;
|
||||
|
||||
float dot = Dot(x_t, y_t);
|
||||
if (dot < 0.0f)
|
||||
{
|
||||
q2 = -q2;
|
||||
dot = -dot;
|
||||
y_t = -y_t;
|
||||
}
|
||||
|
||||
Quat result;
|
||||
const float DOT_THRESHOLD = 0.9995f;
|
||||
if (dot <= DOT_THRESHOLD)
|
||||
{
|
||||
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);
|
||||
if (1.0 - dot <= 0.08f)
|
||||
return Lerp(x_t, y_t, blend);
|
||||
|
||||
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
|
||||
result = (1.0f - blend) * q1 + blend * q2;
|
||||
return result.Normalized;
|
||||
dot = System.Math.Min(dot, 1.0f);
|
||||
|
||||
float theta = (float)System.Math.Acos(dot);
|
||||
if (theta == 0.0f)
|
||||
return x_t;
|
||||
|
||||
float st = 1.0f / (float)System.Math.Sin(theta);
|
||||
float s0 = (float)System.Math.Sin((1.0f - blend) * theta) * st;
|
||||
float s1 = (float)System.Math.Sin(theta * blend) * st;
|
||||
return (x_t * s0 + y_t * s1).Normalized;
|
||||
}
|
||||
|
||||
public static explicit operator Vec4(Quat quat) =>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ namespace KKdBaseLib
|
||||
[FieldOffset(0x0C)] public float W;
|
||||
|
||||
public Vec4(float val)
|
||||
{ X = val; Y = val; Z = val; W = 0.0f; }
|
||||
{ X = val; Y = val; Z = val; W = val; }
|
||||
|
||||
public Vec4(float X, float Y)
|
||||
{ this.X = X; this.Y = Y; Z = 0.0f; W = 0.0f; }
|
||||
|
||||
+88
-38
@@ -5,7 +5,6 @@ using KKdBaseLib.Auth3D;
|
||||
using KKdMainLib.IO;
|
||||
using Object = KKdBaseLib.Auth3D.Object;
|
||||
using A3DADict = System.Collections.Generic.Dictionary<string, object>;
|
||||
using UsedDict = System.Collections.Generic.Dictionary< int, KKdBaseLib.KeyValuePair<int, float>>;
|
||||
|
||||
namespace KKdMainLib
|
||||
{
|
||||
@@ -1075,7 +1074,7 @@ namespace KKdMainLib
|
||||
private Key RK(string str)
|
||||
{
|
||||
Key key = new Key();
|
||||
if ( dict.FV(out key.BinOffset, str + BO )) return key;
|
||||
if ( dict.FV(out key.BinOffset, str + BO )) return key;
|
||||
if (!dict.FV(out int type , str + ".type")) return default;
|
||||
|
||||
key.Type = (KeyType)type;
|
||||
@@ -1095,11 +1094,24 @@ namespace KKdMainLib
|
||||
|
||||
if (keyType != 0)
|
||||
{
|
||||
dict.FV(out string valueType, str + ".raw_data.value_type");
|
||||
dict.FV(out int valueListSize, str + ".raw_data.value_list_size");
|
||||
|
||||
if (dict.FV(out int valueListOffset, str + ".raw_data.value_list_offset"))
|
||||
{
|
||||
if (keyType != 3)
|
||||
return default;
|
||||
|
||||
key.RawData = true;
|
||||
key.RawDataBinary = true;
|
||||
key.RawDataValueListSize = valueListSize;
|
||||
key.RawDataValueListOffset = valueListOffset;
|
||||
return key;
|
||||
}
|
||||
|
||||
string[] VL = null;
|
||||
dict.FV(out string value_type, str + ".raw_data.value_type");
|
||||
if (dict.FV(out value, str + ".raw_data.value_list"))
|
||||
VL = value.Split(',');
|
||||
dict.FV(out int valueListSize, str + ".raw_data.value_list_size");
|
||||
value = "";
|
||||
|
||||
int ds = keyType + 1;
|
||||
@@ -1180,7 +1192,7 @@ namespace KKdMainLib
|
||||
|
||||
private void W(ref Key key, string str, bool a3dc)
|
||||
{
|
||||
if (a3dc) { W(str + BO, key.BinOffset); return; }
|
||||
if (a3dc && !(key.RawData && key.RawDataBinary)) { W(str + BO, key.BinOffset); return; }
|
||||
|
||||
int i = 0;
|
||||
if (key.Type < KeyType.Linear || key.Keys == null || (key.Keys != null && key.Keys.Length == 0))
|
||||
@@ -1216,30 +1228,37 @@ namespace KKdMainLib
|
||||
else if (key.Keys != null)
|
||||
{
|
||||
int length = key.Keys.Length;
|
||||
int keyType = 0;
|
||||
IKF kf;
|
||||
W(str + ".max", (float)(key.Max ?? Data.PlayControl.Size));
|
||||
for (i = 0; i < length && keyType < 3; i++)
|
||||
int keyType = 0;
|
||||
if (key.RawDataBinary)
|
||||
{
|
||||
kf = key.Keys[i].Check();
|
||||
if (kf is KFT0 && keyType < 0) keyType = 0;
|
||||
else if (kf is KFT1 && keyType < 1) keyType = 1;
|
||||
else if (kf is KFT2 && keyType < 2) keyType = 2;
|
||||
else if (kf is KFT3 && keyType < 3) keyType = 3;
|
||||
W(str + ".raw_data.value_list_offset", key.RawDataValueListOffset);
|
||||
keyType = 3;
|
||||
}
|
||||
int valueListSize = length * keyType + length;
|
||||
s.W(str + ".raw_data.value_list=");
|
||||
if (keyType == 0) for (i = 0; i < length; i++)
|
||||
s.W(key.Keys[i].ToT0().ToString(false) + (i + 1 < length ? "," : ""));
|
||||
else if (keyType == 1) for (i = 0; i < length; i++)
|
||||
s.W(key.Keys[i].ToT1().ToString(false) + (i + 1 < length ? "," : ""));
|
||||
else if (keyType == 2) for (i = 0; i < length; i++)
|
||||
s.W(key.Keys[i].ToT2().ToString(false) + (i + 1 < length ? "," : ""));
|
||||
else if (keyType == 3) for (i = 0; i < length; i++)
|
||||
s.W(key.Keys[i] .ToString(false) + (i + 1 < length ? "," : ""));
|
||||
s.P--;
|
||||
s.W('\n');
|
||||
W(str + ".raw_data.value_list_size", valueListSize);
|
||||
else
|
||||
{
|
||||
for (i = 0; i < length && keyType < 3; i++)
|
||||
{
|
||||
IKF kf = key.Keys[i].Check();
|
||||
if (kf is KFT0 && keyType < 0) keyType = 0;
|
||||
else if (kf is KFT1 && keyType < 1) keyType = 1;
|
||||
else if (kf is KFT2 && keyType < 2) keyType = 2;
|
||||
else if (kf is KFT3 && keyType < 3) keyType = 3;
|
||||
}
|
||||
|
||||
s.W(str + ".raw_data.value_list=");
|
||||
if (keyType == 0) for (i = 0; i < length; i++)
|
||||
s.W(key.Keys[i].ToT0().ToString(false) + (i + 1 < length ? "," : ""));
|
||||
else if (keyType == 1) for (i = 0; i < length; i++)
|
||||
s.W(key.Keys[i].ToT1().ToString(false) + (i + 1 < length ? "," : ""));
|
||||
else if (keyType == 2) for (i = 0; i < length; i++)
|
||||
s.W(key.Keys[i].ToT2().ToString(false) + (i + 1 < length ? "," : ""));
|
||||
else if (keyType == 3) for (i = 0; i < length; i++)
|
||||
s.W(key.Keys[i] .ToString(false) + (i + 1 < length ? "," : ""));
|
||||
s.P--;
|
||||
s.W('\n');
|
||||
}
|
||||
W(str + ".raw_data.value_list_size", length * keyType + length);
|
||||
W(str + ".raw_data.value_type" , "float" );
|
||||
W(str + ".raw_data_key_type" , keyType );
|
||||
W(str + ".type", (int)key.Type);
|
||||
@@ -1673,14 +1692,15 @@ namespace KKdMainLib
|
||||
|
||||
private void RMT(ref ModelTransform mt)
|
||||
{
|
||||
if (mt.BinOffset == null) return;
|
||||
if (mt.BinOffset.HasValue)
|
||||
{
|
||||
s.P = (int)mt.BinOffset;
|
||||
|
||||
s.P = (int)mt.BinOffset;
|
||||
|
||||
ReadOffset(out mt.Scale);
|
||||
ReadOffset(out mt.Rot );
|
||||
ReadOffset(out mt.Trans);
|
||||
mt.Visibility = new Key { BinOffset = s.RI32() };
|
||||
ReadOffset(out mt.Scale);
|
||||
ReadOffset(out mt.Rot);
|
||||
ReadOffset(out mt.Trans);
|
||||
mt.Visibility = new Key { BinOffset = s.RI32() };
|
||||
}
|
||||
|
||||
RV3(ref mt.Scale );
|
||||
RV3(ref mt.Rot , true);
|
||||
@@ -1705,15 +1725,32 @@ namespace KKdMainLib
|
||||
|
||||
private void RK(ref Key key, bool f16 = false)
|
||||
{
|
||||
int length;
|
||||
if (key.RawData)
|
||||
{
|
||||
if (!key.RawDataBinary)
|
||||
return;
|
||||
|
||||
s.P = (int)key.RawDataValueListOffset;
|
||||
key.RawDataValueListOffset = 0;
|
||||
|
||||
length = (int)key.RawDataValueListSize / 4;
|
||||
key.Keys = new KFT3[length];
|
||||
for (int i = 0; i < key.Keys.Length; i++)
|
||||
{ ref KFT3 kf = ref key.Keys[i]; Vec4 v = s.RV4(); kf.F = v.X; kf.V = v.Y;
|
||||
kf.T1 = v.Z; kf.T2 = v.W; }
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.BinOffset == null || key.BinOffset < 0) return;
|
||||
|
||||
s.P = (int)key.BinOffset;
|
||||
int Type = s.RI32();
|
||||
int Type = s.RI32();
|
||||
key.Value = s.RF32();
|
||||
key.Type = (KeyType)(Type & 0xFF);
|
||||
if (key.Type < KeyType.Linear) return;
|
||||
key.Max = s.RF32();
|
||||
int length = s.RI32();
|
||||
key.Max = s.RF32();
|
||||
length = s.RI32();
|
||||
key.EPTypePost = (EPType)((Type >> 12) & 0xF);
|
||||
key.EPTypePre = (EPType)((Type >> 8) & 0xF);
|
||||
key.Keys = new KFT3[length];
|
||||
@@ -1774,6 +1811,17 @@ namespace KKdMainLib
|
||||
|
||||
private void W(ref Key key, bool f16 = false)
|
||||
{
|
||||
if (key.RawData) {
|
||||
if (!key.RawDataBinary)
|
||||
return;
|
||||
|
||||
key.RawDataValueListOffset = s.P;
|
||||
key.RawDataValueListSize = key.Keys.Length * 4;
|
||||
for (i = 0; i < key.Keys.Length; i++)
|
||||
{ ref KFT3 kf = ref key.Keys[i]; s.W(new Vec4(kf.F, kf.V, kf.T1, kf.T2)); }
|
||||
return;
|
||||
}
|
||||
|
||||
key.BinOffset = s.P;
|
||||
if (key.Type > KeyType.Static && key.Keys != null)
|
||||
{
|
||||
@@ -2906,7 +2954,8 @@ namespace KKdMainLib
|
||||
if (key.Type == 0) { key.Value = 0; return key; }
|
||||
else if (key.Type < KeyType.Linear) return key;
|
||||
|
||||
key.RawData = msgPack.RB("RawData");
|
||||
key.RawData = msgPack.RB("RawData");
|
||||
key.RawDataBinary = msgPack.RB("RawDataBinary");
|
||||
MsgPack trans;
|
||||
if ((trans = msgPack["Keys", true]).IsNull && (trans = msgPack["Trans", true]).IsNull) return key;
|
||||
|
||||
@@ -2982,7 +3031,8 @@ namespace KKdMainLib
|
||||
if (key.EPTypePre != EPType.None)
|
||||
keys.Add("EPTypePre", key.EPTypePre.ToString());
|
||||
|
||||
if (key.RawData) keys.Add("RawData", true);
|
||||
if (key.RawData ) keys.Add("RawData" , true);
|
||||
if (key.RawDataBinary) keys.Add("RawDataBinary", true);
|
||||
|
||||
int length = key.Keys.Length;
|
||||
MsgPack Keys = new MsgPack(length, "Keys");
|
||||
|
||||
+575
-488
File diff suppressed because it is too large
Load Diff
+131
-38
@@ -1,6 +1,5 @@
|
||||
//Original: https://github.com/blueskythlikesclouds/MikuMikuLibrary/
|
||||
|
||||
using System.IO.Compression;
|
||||
using System.Security.Cryptography;
|
||||
using KKdBaseLib;
|
||||
using KKdMainLib.IO;
|
||||
@@ -14,7 +13,7 @@ namespace KKdMainLib
|
||||
public FARC(string file, bool isDirectory = false)
|
||||
{ if (isDirectory) DirectoryPath = file; else FilePath = file; NewFARC(); }
|
||||
|
||||
private void NewFARC() { Files = KKdList<FARCFile>.New; Signature = Farc.FArC; FT = false; }
|
||||
private void NewFARC() { Files = KKdList<FARCFile>.New; FT = false; }
|
||||
|
||||
public KKdList<FARCFile> Files = KKdList<FARCFile>.New;
|
||||
public Flags FARCFlags;
|
||||
@@ -139,7 +138,17 @@ namespace KKdMainLib
|
||||
file.Size = reader.RI32E(true);
|
||||
Flags Flags = (Flags)reader.RI32E(true);
|
||||
|
||||
file.Compressed = file.Size != 0 || (FARCFlags & Flags.GZip) != 0;
|
||||
if (file.Size != 0)
|
||||
{
|
||||
file.Compressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
file.Size = file.SizeComp;
|
||||
file.SizeComp = 0;
|
||||
file.Compressed = false;
|
||||
}
|
||||
|
||||
file.Encrypted = ((FARCFlags | Flags) & Flags.AES) != 0;
|
||||
Files.Add(file);
|
||||
}
|
||||
@@ -152,7 +161,17 @@ namespace KKdMainLib
|
||||
file.SizeComp = reader.RI32E(true);
|
||||
file.Size = reader.RI32E(true);
|
||||
|
||||
file.Compressed = file.Size != 0;
|
||||
if (file.Size != 0)
|
||||
{
|
||||
file.Compressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
file.Size = file.SizeComp;
|
||||
file.SizeComp = 0;
|
||||
file.Compressed = false;
|
||||
}
|
||||
|
||||
file.Encrypted = (FARCFlags & Flags.AES) != 0;
|
||||
Files.Add(file);
|
||||
}
|
||||
@@ -227,10 +246,18 @@ namespace KKdMainLib
|
||||
}
|
||||
else if (Signature == Farc.FArC)
|
||||
{
|
||||
file.DataComp = reader.RBy(file.SizeComp);
|
||||
file.Data = file.DataComp.InflateGZip(file.Size);
|
||||
if (file.Compressed)
|
||||
{
|
||||
file.DataComp = reader.RBy(file.SizeComp);
|
||||
file.Data = file.DataComp.InflateGZip(file.Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
file.DataComp = null;
|
||||
file.Data = reader.RBy(file.Size);
|
||||
}
|
||||
}
|
||||
else if (file.Encrypted || file.Compressed)
|
||||
else if (file.Compressed || file.Encrypted)
|
||||
{
|
||||
int tempSize = file.Encrypted ? file.SizeComp.A(0x10) : file.SizeComp;
|
||||
|
||||
@@ -266,16 +293,16 @@ namespace KKdMainLib
|
||||
else
|
||||
temp = reader.RBy(tempSize);
|
||||
|
||||
if (!file.Compressed)
|
||||
{
|
||||
file.DataComp = null;
|
||||
file.Data = temp;
|
||||
}
|
||||
else
|
||||
if (file.Compressed)
|
||||
{
|
||||
file.DataComp = temp;
|
||||
file.Data = file.DataComp.InflateGZip(file.Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
file.DataComp = null;
|
||||
file.Data = temp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -294,15 +321,33 @@ namespace KKdMainLib
|
||||
return Files[i].Data;
|
||||
}
|
||||
|
||||
public void Pack(Farc signature = Farc.FArC)
|
||||
public void Pack()
|
||||
{
|
||||
NewFARC();
|
||||
string[] files = Directory.GetFiles(DirectoryPath);
|
||||
Files.Capacity = files.Length;
|
||||
|
||||
bool compressed = false;
|
||||
bool encrypted = false;
|
||||
switch (Signature)
|
||||
{
|
||||
case Farc.FARC:
|
||||
compressed = (FARCFlags & Flags.GZip) != 0;
|
||||
encrypted = (FARCFlags & Flags.AES) != 0;
|
||||
break;
|
||||
case Farc.FArC:
|
||||
FARCFlags = Flags.None;
|
||||
compressed = true;
|
||||
break;
|
||||
default:
|
||||
FARCFlags = Flags.None;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
Files.Add(new FARCFile { Name = Path.GetFileName(files[i]), Data = File.ReadAllBytes(files[i]) });
|
||||
Files.Add(new FARCFile { Name = Path.GetFileName(files[i]),
|
||||
Data = File.ReadAllBytes(files[i]), Compressed = compressed, Encrypted = encrypted });
|
||||
files = null;
|
||||
Signature = signature;
|
||||
Save();
|
||||
}
|
||||
|
||||
@@ -322,22 +367,28 @@ namespace KKdMainLib
|
||||
|
||||
using (Stream headerWriter = File.OpenWriter())
|
||||
{
|
||||
if (Signature == Farc.FArc) headerWriter.WE(0x01, true);
|
||||
else if (Signature == Farc.FArC) headerWriter.WE(0x01, true);
|
||||
else if (Signature == Farc.FARC)
|
||||
switch (Signature)
|
||||
{
|
||||
headerWriter.WE((int)FARCFlags, true);
|
||||
headerWriter.W (0x00);
|
||||
headerWriter.WE(0x40, true);
|
||||
headerWriter.W (0x00);
|
||||
headerWriter.W (0x00);
|
||||
case Farc.FArc:
|
||||
headerWriter.WE(0x01, true);
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{ headerWriter.W(Files[i].Name + "\0"); headerWriter.W(0x00L); }
|
||||
break;
|
||||
case Farc.FArC:
|
||||
headerWriter.WE(0x01, true);
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{ headerWriter.W(Files[i].Name + "\0"); headerWriter.W(0x00L); headerWriter.W(0x00); }
|
||||
break;
|
||||
case Farc.FARC:
|
||||
headerWriter.WE((int)FARCFlags, true);
|
||||
headerWriter.W (0x00);
|
||||
headerWriter.WE(0x40, true);
|
||||
headerWriter.W (0x00);
|
||||
headerWriter.W (0x00);
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{ headerWriter.W(Files[i].Name + "\0"); headerWriter.W(0x00L); headerWriter.W(0x00L); }
|
||||
break;
|
||||
}
|
||||
if (Signature != Farc.FArc)
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{ headerWriter.W(Files[i].Name + "\0"); headerWriter.W(0x00L); headerWriter.W(0x00); }
|
||||
else
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{ headerWriter.W(Files[i].Name + "\0"); headerWriter.W(0x00L); }
|
||||
writer.WE(headerWriter.L, true);
|
||||
writer.W (headerWriter.ToArray(true));
|
||||
}
|
||||
@@ -351,13 +402,55 @@ namespace KKdMainLib
|
||||
CompressStuff(i, ref writer);
|
||||
|
||||
writer.P = Signature == Farc.FARC ? 0x1C : 0x0C;
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
switch (Signature)
|
||||
{
|
||||
FARCFile file = Files[i];
|
||||
writer.W (file.Name + "\0");
|
||||
writer.WE(file.Offset, true);
|
||||
if (Signature != Farc.FArc) writer.WE(file.SizeComp, true);
|
||||
writer.WE(file.Size, true);
|
||||
case Farc.FArc:
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{
|
||||
FARCFile file = Files[i];
|
||||
writer.W (file.Name + "\0");
|
||||
writer.WE(file.Offset, true);
|
||||
writer.WE(file.Size , true);
|
||||
}
|
||||
break;
|
||||
case Farc.FArC:
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{
|
||||
FARCFile file = Files[i];
|
||||
writer.W (file.Name + "\0");
|
||||
writer.WE(file.Offset , true);
|
||||
if (file.Compressed)
|
||||
{
|
||||
writer.WE(file.SizeComp, true);
|
||||
writer.WE(file.Size , true);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WE(file.Size , true);
|
||||
writer.WE(0x00 , true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Farc.FARC:
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{
|
||||
FARCFile file = Files[i];
|
||||
writer.W (file.Name + "\0");
|
||||
writer.WE(file.Offset , true);
|
||||
if (file.Compressed)
|
||||
{
|
||||
writer.WE(file.SizeComp, true);
|
||||
writer.WE(file.Size , true);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WE(file.Size , true);
|
||||
writer.WE(0x00 , true);
|
||||
}
|
||||
writer.WE((uint)((file.Compressed ? Flags.GZip : 0x00)
|
||||
| (file.Encrypted ? Flags.AES : 0x00)), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
writer.Dispose();
|
||||
}
|
||||
@@ -369,11 +462,11 @@ namespace KKdMainLib
|
||||
file.Size = file.Data.Length;
|
||||
|
||||
byte[] data = file.Data;
|
||||
if (Signature == Farc.FArC || (Signature == Farc.FARC && (FARCFlags & Flags.GZip) != 0))
|
||||
if (file.Compressed)
|
||||
data = file.Data.DeflateGZip(CompressionLevel);
|
||||
file.SizeComp = data.Length;
|
||||
|
||||
if (Signature == Farc.FARC && (FARCFlags & Flags.AES) != 0)
|
||||
if (file.Encrypted)
|
||||
{
|
||||
int alignLength = data.Length.A(0x40);
|
||||
byte[] tempData = new byte[alignLength];
|
||||
|
||||
+342
-342
@@ -1,342 +1,342 @@
|
||||
using KKdBaseLib;
|
||||
|
||||
namespace KKdMainLib.IO
|
||||
{
|
||||
public struct MP : System.IDisposable
|
||||
{
|
||||
public MP(Stream _IO) => this._IO = _IO;
|
||||
|
||||
private Stream _IO;
|
||||
|
||||
public void Close() => _IO.C();
|
||||
|
||||
public byte[] ToArray(bool Close = false) => _IO.ToArray(Close);
|
||||
|
||||
public MsgPack Read(bool array = false)
|
||||
{
|
||||
MsgPack msgPack = MsgPack.New;
|
||||
byte unk = _IO.RU8();
|
||||
if (!array) { msgPack.Name = RS((Types)unk); unk = _IO.RU8(); }
|
||||
Types type = (Types)unk;
|
||||
|
||||
if (type >= Types.FixMap && type <= Types.FixMapMax)
|
||||
{
|
||||
msgPack.Object = KKdList<MsgPack>.New;
|
||||
for (int i = 0; i < unk - (byte)Types.FixMap; i++) msgPack.Add( Read(false));
|
||||
}
|
||||
else if (type >= Types.FixArr && type <= Types.FixArrMax)
|
||||
{
|
||||
msgPack.Object = new MsgPack[unk - (byte)Types.FixArr];
|
||||
for (int i = 0; i < unk - (byte)Types.FixArr; i++) msgPack[i] = Read( true);
|
||||
}
|
||||
else if (type >= Types.FixStr && type <= Types.FixStrMax) msgPack.Object = RS(type);
|
||||
else if (type >= Types.PosInt && type <= Types.PosIntMax) msgPack.Object = unk;
|
||||
else if (type >= Types.NegInt && type <= Types.NegIntMax) msgPack.Object = (sbyte)unk;
|
||||
else
|
||||
while (true)
|
||||
{
|
||||
if (RN (ref msgPack, ref type)) break;
|
||||
if (RBy(ref msgPack, ref type)) break;
|
||||
if (RM (ref msgPack, ref type)) break;
|
||||
if (RE (ref msgPack, ref type)) break;
|
||||
if (RS (ref msgPack, ref type)) break;
|
||||
if (RBo(ref msgPack, ref type)) break;
|
||||
if (RA (ref msgPack, ref type)) break;
|
||||
if (RI (ref msgPack, ref type)) break;
|
||||
if (RU (ref msgPack, ref type)) break;
|
||||
if (RF (ref msgPack, ref type)) break;
|
||||
break;
|
||||
}
|
||||
return msgPack;
|
||||
}
|
||||
|
||||
private bool RI(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.Int8 ) msgPack.Object = _IO.RI8();
|
||||
else if (type == Types.Int16) msgPack.Object = _IO.RI16E(true);
|
||||
else if (type == Types.Int32) msgPack.Object = _IO.RI32E(true);
|
||||
else if (type == Types.Int64) msgPack.Object = _IO.RI64E(true);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RU(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.UInt8 ) msgPack.Object = _IO.RU8();
|
||||
else if (type == Types.UInt16) msgPack.Object = _IO.RU16E(true);
|
||||
else if (type == Types.UInt32) msgPack.Object = _IO.RU32E(true);
|
||||
else if (type == Types.UInt64) msgPack.Object = _IO.RU64E(true);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RF(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.Float32) msgPack.Object = _IO.RF32E(true);
|
||||
else if (type == Types.Float64) msgPack.Object = _IO.RF64E(true);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RBo(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.False) msgPack.Object = false;
|
||||
else if (type == Types.True ) msgPack.Object = true ;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RBy(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
int Length = 0;
|
||||
if (type == Types.Bin8 ) Length = _IO.RU8();
|
||||
else if (type == Types.Bin16) Length = _IO.RI16E(true);
|
||||
else if (type == Types.Bin32) Length = _IO.RI32E(true);
|
||||
else return false;
|
||||
msgPack.Object = _IO.RBy(Length);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RS(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
string val = RS(type);
|
||||
if (val != null) msgPack.Object = val;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private string RS(Types val)
|
||||
{
|
||||
if (val >= Types.FixStr && val <= Types.FixStrMax)
|
||||
return _IO.RS(val - Types.FixStr);
|
||||
else if (val >= Types. Str8 && val <= Types. Str32 )
|
||||
{
|
||||
System.Enum.TryParse(val.ToString(), out Types type);
|
||||
int Length = 0;
|
||||
if (type == Types.Str8 ) Length = _IO.RU8();
|
||||
else if (type == Types.Str16) Length = _IO.RI16E(true);
|
||||
else Length = _IO.RI32E(true);
|
||||
return _IO.RS(Length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool RN(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.Nil) msgPack.Object = null;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RA(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
int Length = 0;
|
||||
if (type == Types.Arr16) Length = _IO.RI16E(true);
|
||||
else if (type == Types.Arr32) Length = _IO.RI32E(true);
|
||||
else return false;
|
||||
msgPack.Object = new MsgPack[Length];
|
||||
for (int i = 0; i < Length; i++) msgPack[i] = Read(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RM(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
int Length = 0;
|
||||
if (type == Types.Map16) Length = _IO.RI16E(true);
|
||||
else if (type == Types.Map32) Length = _IO.RI32E(true);
|
||||
else return false;
|
||||
msgPack.Object = KKdList<MsgPack>.New;
|
||||
for (int i = 0; i < Length; i++) msgPack.Add(Read());
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RE(ref MsgPack MsgPack, ref Types type)
|
||||
{
|
||||
int Length = 0;
|
||||
if (type == Types.FixExt1 ) Length = 1 ;
|
||||
else if (type == Types.FixExt2 ) Length = 2 ;
|
||||
else if (type == Types.FixExt4 ) Length = 4 ;
|
||||
else if (type == Types.FixExt8 ) Length = 8 ;
|
||||
else if (type == Types.FixExt16) Length = 16;
|
||||
else if (type == Types. Ext8 ) Length = _IO.RU8();
|
||||
else if (type == Types. Ext16) Length = _IO.RI16E(true);
|
||||
else if (type == Types. Ext32) Length = _IO.RI32E(true);
|
||||
else return false;
|
||||
MsgPack.Object = new MsgPack.Ext { Type = _IO.RI8(), Data = _IO.RBy(Length) };
|
||||
return true;
|
||||
}
|
||||
|
||||
public MP W(MsgPack msgPack, bool ignoreNull, bool IsArray = false)
|
||||
{
|
||||
if (msgPack.Name != null && !IsArray) W(msgPack.Name);
|
||||
Write(msgPack.Object, ignoreNull);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void Write(object obj, bool ignoreNull)
|
||||
{
|
||||
if (obj == null) { if (!ignoreNull) WN(); return; }
|
||||
switch (obj)
|
||||
{
|
||||
case KKdList<MsgPack> val: WM(val.Count );
|
||||
for (int i = 0; i < val.Count ; i++) W(val[i], ignoreNull); break;
|
||||
case MsgPack[] val: WA(val.Length);
|
||||
for (int i = 0; i < val.Length; i++) W(val[i], ignoreNull); break;
|
||||
case MsgPack val: W(val, ignoreNull); break;
|
||||
case byte[] val: W(val); break;
|
||||
case bool val: W(val); break;
|
||||
case sbyte val: W(val); break;
|
||||
case byte val: W(val); break;
|
||||
case short val: W(val); break;
|
||||
case ushort val: W(val); break;
|
||||
case int val: W(val); break;
|
||||
case uint val: W(val); break;
|
||||
case long val: W(val); break;
|
||||
case ulong val: W(val); break;
|
||||
case float val: W(val); break;
|
||||
case double val: W(val); break;
|
||||
case string val: W(val); break;
|
||||
case MsgPack.Ext val: W(val); break;
|
||||
}
|
||||
}
|
||||
|
||||
private void W( sbyte val) { if (val < -0x20) _IO.W((byte)0xD0); _IO.W(val); }
|
||||
private void W( byte val) { if (val >= 0x80) _IO.W((byte)0xCC); _IO.W(val); }
|
||||
private void W( short val) { if (( sbyte)val == val) W(( sbyte)val);
|
||||
else if (( byte)val == val) W(( byte)val);
|
||||
else { _IO.W((byte)0xD1); _IO.WE(val, true); } }
|
||||
private void W(ushort val) { if (( byte)val == val) W(( byte)val);
|
||||
else { _IO.W((byte)0xCD); _IO.WE(val, true); } }
|
||||
private void W( int val) { if (( short)val == val) W(( short)val);
|
||||
else if ((ushort)val == val) W((ushort)val);
|
||||
else { _IO.W((byte)0xD2); _IO.WE(val, true); } }
|
||||
private void W( uint val) { if ((ushort)val == val) W((ushort)val);
|
||||
else { _IO.W((byte)0xCE); _IO.WE(val, true); } }
|
||||
private void W( long val) { if (( int)val == val) W(( int)val);
|
||||
else if (( uint)val == val) W(( uint)val);
|
||||
else { _IO.W((byte)0xD3); _IO.WE(val, true); } }
|
||||
private void W( ulong val) { if (( uint)val == val) W(( uint)val);
|
||||
else { _IO.W((byte)0xCF); _IO.WE(val, true); } }
|
||||
private void W( float val) { if (( long)val == val) W(( long)val);
|
||||
else { _IO.W((byte)0xCA); _IO.WE(val, true); } }
|
||||
private void W(double val) { if (( long)val == val) W(( long)val);
|
||||
else if (( float)val == val) W(( float)val);
|
||||
else { _IO.W((byte)0xCB); _IO.WE(val, true); } }
|
||||
|
||||
private void W( bool val) =>
|
||||
_IO.W((byte)(val ? 0xC3 : 0xC2));
|
||||
|
||||
private void W(byte[] val)
|
||||
{
|
||||
if (val == null) { WN(); return; }
|
||||
|
||||
if (val.Length < 0x100) { _IO.W((byte)0xC4); _IO.W (( byte)val.Length ); }
|
||||
else if (val.Length < 0x10000) { _IO.W((byte)0xC5); _IO.WE((ushort)val.Length, true); }
|
||||
else { _IO.W((byte)0xC6); _IO.WE( val.Length, true); }
|
||||
_IO.W(val);
|
||||
}
|
||||
|
||||
private void W(string val)
|
||||
{
|
||||
if (val == null) { WN(); return; }
|
||||
|
||||
byte[] array = Text.ToUTF8(val);
|
||||
if (array.Length < 0x20) _IO.W((byte)(0xA0 | (array.Length & 0x1F)));
|
||||
else if (array.Length < 0x100) { _IO.W((byte)0xD9); _IO.W (( byte)array.Length); }
|
||||
else if (array.Length < 0x10000) { _IO.W((byte)0xDA); _IO.WE((ushort)array.Length, true); }
|
||||
else { _IO.W((byte)0xDB); _IO.WE( array.Length, true); }
|
||||
_IO.W(array);
|
||||
}
|
||||
|
||||
private void WN() => _IO.W((byte)0xC0);
|
||||
|
||||
private void WA(int val)
|
||||
{
|
||||
if (val == 0) { WN(); return; }
|
||||
else if (val < 0x10) _IO.W((byte)(0x90 | (val & 0x0F)));
|
||||
else if (val < 0x10000) { _IO.W((byte)0xDC); _IO.WE((ushort)val, true); }
|
||||
else { _IO.W((byte)0xDD); _IO.WE( val, true); }
|
||||
}
|
||||
|
||||
private void WM(int val)
|
||||
{
|
||||
if (val == 0) { WN(); return; }
|
||||
else if (val < 0x10) _IO.W((byte)(0x80 | (val & 0x0F)));
|
||||
else if (val < 0x10000) { _IO.W((byte)0xDE); _IO.WE((ushort)val, true); }
|
||||
else { _IO.W((byte)0xDF); _IO.WE( val, true); }
|
||||
}
|
||||
|
||||
private void W(MsgPack.Ext val) => WE(val);
|
||||
|
||||
private void WE(MsgPack.Ext val)
|
||||
{
|
||||
if (val.Data == null) { WN(); return; }
|
||||
|
||||
if (val.Data.Length < 1 ) { WN(); return; }
|
||||
else if (val.Data.Length == 1 ) _IO.W((byte)0xD4);
|
||||
else if (val.Data.Length == 2 ) _IO.W((byte)0xD5);
|
||||
else if (val.Data.Length == 4 ) _IO.W((byte)0xD6);
|
||||
else if (val.Data.Length == 8 ) _IO.W((byte)0xD7);
|
||||
else if (val.Data.Length == 16) _IO.W((byte)0xD8);
|
||||
else
|
||||
{
|
||||
if (val.Data.Length < 0x100)
|
||||
{ _IO.W((byte)0xC7); _IO.W (( byte)val.Data.Length); }
|
||||
else if (val.Data.Length < 0x10000)
|
||||
{ _IO.W((byte)0xC8); _IO.WE((ushort)val.Data.Length, true); }
|
||||
else
|
||||
{ _IO.W((byte)0xC9); _IO.WE( val.Data.Length, true); }
|
||||
}
|
||||
_IO.W(val.Type);
|
||||
_IO.W(val.Data);
|
||||
}
|
||||
|
||||
public void Dispose() => _IO.C();
|
||||
}
|
||||
|
||||
public enum Types : byte
|
||||
{
|
||||
PosInt = 0b00000000,
|
||||
FixMap = 0b10000000,
|
||||
FixArr = 0b10010000,
|
||||
FixStr = 0b10100000,
|
||||
Nil = 0b11000000,
|
||||
NeverUsed = 0b11000001,
|
||||
False = 0b11000010,
|
||||
True = 0b11000011,
|
||||
Bin8 = 0b11000100,
|
||||
Bin16 = 0b11000101,
|
||||
Bin32 = 0b11000110,
|
||||
Ext8 = 0b11000111,
|
||||
Ext16 = 0b11001000,
|
||||
Ext32 = 0b11001001,
|
||||
Float32 = 0b11001010,
|
||||
Float64 = 0b11001011,
|
||||
UInt8 = 0b11001100,
|
||||
UInt16 = 0b11001101,
|
||||
UInt32 = 0b11001110,
|
||||
UInt64 = 0b11001111,
|
||||
Int8 = 0b11010000,
|
||||
Int16 = 0b11010001,
|
||||
Int32 = 0b11010010,
|
||||
Int64 = 0b11010011,
|
||||
FixExt1 = 0b11010100,
|
||||
FixExt2 = 0b11010101,
|
||||
FixExt4 = 0b11010110,
|
||||
FixExt8 = 0b11010111,
|
||||
FixExt16 = 0b11011000,
|
||||
Str8 = 0b11011001,
|
||||
Str16 = 0b11011010,
|
||||
Str32 = 0b11011011,
|
||||
Arr16 = 0b11011100,
|
||||
Arr32 = 0b11011101,
|
||||
Map16 = 0b11011110,
|
||||
Map32 = 0b11011111,
|
||||
NegInt = 0b11100000,
|
||||
PosIntMax = 0b01111111,
|
||||
FixMapMax = 0b10001111,
|
||||
FixArrMax = 0b10011111,
|
||||
FixStrMax = 0b10111111,
|
||||
NegIntMax = 0b11111111,
|
||||
}
|
||||
}
|
||||
using KKdBaseLib;
|
||||
|
||||
namespace KKdMainLib.IO
|
||||
{
|
||||
public struct MP : System.IDisposable
|
||||
{
|
||||
public MP(Stream _IO) => this._IO = _IO;
|
||||
|
||||
private Stream _IO;
|
||||
|
||||
public void Close() => _IO.C();
|
||||
|
||||
public byte[] ToArray(bool Close = false) => _IO.ToArray(Close);
|
||||
|
||||
public MsgPack Read(bool array = false)
|
||||
{
|
||||
MsgPack msgPack = MsgPack.New;
|
||||
byte unk = _IO.RU8();
|
||||
if (!array) { msgPack.Name = RS((Types)unk); unk = _IO.RU8(); }
|
||||
Types type = (Types)unk;
|
||||
|
||||
if (type >= Types.FixMap && type <= Types.FixMapMax)
|
||||
{
|
||||
msgPack.Object = KKdList<MsgPack>.New;
|
||||
for (int i = 0; i < unk - (byte)Types.FixMap; i++) msgPack.Add( Read(false));
|
||||
}
|
||||
else if (type >= Types.FixArr && type <= Types.FixArrMax)
|
||||
{
|
||||
msgPack.Object = new MsgPack[unk - (byte)Types.FixArr];
|
||||
for (int i = 0; i < unk - (byte)Types.FixArr; i++) msgPack[i] = Read( true);
|
||||
}
|
||||
else if (type >= Types.FixStr && type <= Types.FixStrMax) msgPack.Object = RS(type);
|
||||
else if (type >= Types.PosInt && type <= Types.PosIntMax) msgPack.Object = unk;
|
||||
else if (type >= Types.NegInt && type <= Types.NegIntMax) msgPack.Object = (sbyte)unk;
|
||||
else
|
||||
while (true)
|
||||
{
|
||||
if (RN (ref msgPack, ref type)) break;
|
||||
if (RBy(ref msgPack, ref type)) break;
|
||||
if (RM (ref msgPack, ref type)) break;
|
||||
if (RE (ref msgPack, ref type)) break;
|
||||
if (RS (ref msgPack, ref type)) break;
|
||||
if (RBo(ref msgPack, ref type)) break;
|
||||
if (RA (ref msgPack, ref type)) break;
|
||||
if (RI (ref msgPack, ref type)) break;
|
||||
if (RU (ref msgPack, ref type)) break;
|
||||
if (RF (ref msgPack, ref type)) break;
|
||||
break;
|
||||
}
|
||||
return msgPack;
|
||||
}
|
||||
|
||||
private bool RI(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.Int8 ) msgPack.Object = _IO.RI8();
|
||||
else if (type == Types.Int16) msgPack.Object = _IO.RI16E(true);
|
||||
else if (type == Types.Int32) msgPack.Object = _IO.RI32E(true);
|
||||
else if (type == Types.Int64) msgPack.Object = _IO.RI64E(true);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RU(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.UInt8 ) msgPack.Object = _IO.RU8();
|
||||
else if (type == Types.UInt16) msgPack.Object = _IO.RU16E(true);
|
||||
else if (type == Types.UInt32) msgPack.Object = _IO.RU32E(true);
|
||||
else if (type == Types.UInt64) msgPack.Object = _IO.RU64E(true);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RF(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.Float32) msgPack.Object = _IO.RF32E(true);
|
||||
else if (type == Types.Float64) msgPack.Object = _IO.RF64E(true);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RBo(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.False) msgPack.Object = false;
|
||||
else if (type == Types.True ) msgPack.Object = true ;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RBy(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
int Length = 0;
|
||||
if (type == Types.Bin8 ) Length = _IO.RU8();
|
||||
else if (type == Types.Bin16) Length = _IO.RI16E(true);
|
||||
else if (type == Types.Bin32) Length = _IO.RI32E(true);
|
||||
else return false;
|
||||
msgPack.Object = _IO.RBy(Length);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RS(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
string val = RS(type);
|
||||
if (val != null) msgPack.Object = val;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private string RS(Types val)
|
||||
{
|
||||
if (val >= Types.FixStr && val <= Types.FixStrMax)
|
||||
return _IO.RS(val - Types.FixStr);
|
||||
else if (val >= Types. Str8 && val <= Types. Str32 )
|
||||
{
|
||||
System.Enum.TryParse(val.ToString(), out Types type);
|
||||
int Length = 0;
|
||||
if (type == Types.Str8 ) Length = _IO.RU8();
|
||||
else if (type == Types.Str16) Length = _IO.RI16E(true);
|
||||
else Length = _IO.RI32E(true);
|
||||
return _IO.RS(Length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool RN(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
if (type == Types.Nil) msgPack.Object = null;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RA(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
int Length = 0;
|
||||
if (type == Types.Arr16) Length = _IO.RI16E(true);
|
||||
else if (type == Types.Arr32) Length = _IO.RI32E(true);
|
||||
else return false;
|
||||
msgPack.Object = new MsgPack[Length];
|
||||
for (int i = 0; i < Length; i++) msgPack[i] = Read(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RM(ref MsgPack msgPack, ref Types type)
|
||||
{
|
||||
int Length = 0;
|
||||
if (type == Types.Map16) Length = _IO.RI16E(true);
|
||||
else if (type == Types.Map32) Length = _IO.RI32E(true);
|
||||
else return false;
|
||||
msgPack.Object = KKdList<MsgPack>.New;
|
||||
for (int i = 0; i < Length; i++) msgPack.Add(Read());
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool RE(ref MsgPack MsgPack, ref Types type)
|
||||
{
|
||||
int Length = 0;
|
||||
if (type == Types.FixExt1 ) Length = 1 ;
|
||||
else if (type == Types.FixExt2 ) Length = 2 ;
|
||||
else if (type == Types.FixExt4 ) Length = 4 ;
|
||||
else if (type == Types.FixExt8 ) Length = 8 ;
|
||||
else if (type == Types.FixExt16) Length = 16;
|
||||
else if (type == Types. Ext8 ) Length = _IO.RU8();
|
||||
else if (type == Types. Ext16) Length = _IO.RI16E(true);
|
||||
else if (type == Types. Ext32) Length = _IO.RI32E(true);
|
||||
else return false;
|
||||
MsgPack.Object = new MsgPack.Ext { Type = _IO.RI8(), Data = _IO.RBy(Length) };
|
||||
return true;
|
||||
}
|
||||
|
||||
public MP W(MsgPack msgPack, bool ignoreNull, bool IsArray = false)
|
||||
{
|
||||
if (msgPack.Name != null && !IsArray) W(msgPack.Name);
|
||||
Write(msgPack.Object, ignoreNull);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void Write(object obj, bool ignoreNull)
|
||||
{
|
||||
if (obj == null) { if (!ignoreNull) WN(); return; }
|
||||
switch (obj)
|
||||
{
|
||||
case KKdList<MsgPack> val: WM(val.Count );
|
||||
for (int i = 0; i < val.Count ; i++) W(val[i], ignoreNull); break;
|
||||
case MsgPack[] val: WA(val.Length);
|
||||
for (int i = 0; i < val.Length; i++) W(val[i], ignoreNull); break;
|
||||
case MsgPack val: W(val, ignoreNull); break;
|
||||
case byte[] val: W(val); break;
|
||||
case bool val: W(val); break;
|
||||
case sbyte val: W(val); break;
|
||||
case byte val: W(val); break;
|
||||
case short val: W(val); break;
|
||||
case ushort val: W(val); break;
|
||||
case int val: W(val); break;
|
||||
case uint val: W(val); break;
|
||||
case long val: W(val); break;
|
||||
case ulong val: W(val); break;
|
||||
case float val: W(val); break;
|
||||
case double val: W(val); break;
|
||||
case string val: W(val); break;
|
||||
case MsgPack.Ext val: W(val); break;
|
||||
}
|
||||
}
|
||||
|
||||
private void W( sbyte val) { if (val < -0x20) _IO.W((byte)0xD0); _IO.W(val); }
|
||||
private void W( byte val) { if (val >= 0x80) _IO.W((byte)0xCC); _IO.W(val); }
|
||||
private void W( short val) { if (( sbyte)val == val) W(( sbyte)val);
|
||||
else if (( byte)val == val) W(( byte)val);
|
||||
else { _IO.W((byte)0xD1); _IO.WE(val, true); } }
|
||||
private void W(ushort val) { if (( byte)val == val) W(( byte)val);
|
||||
else { _IO.W((byte)0xCD); _IO.WE(val, true); } }
|
||||
private void W( int val) { if (( short)val == val) W(( short)val);
|
||||
else if ((ushort)val == val) W((ushort)val);
|
||||
else { _IO.W((byte)0xD2); _IO.WE(val, true); } }
|
||||
private void W( uint val) { if ((ushort)val == val) W((ushort)val);
|
||||
else { _IO.W((byte)0xCE); _IO.WE(val, true); } }
|
||||
private void W( long val) { if (( int)val == val) W(( int)val);
|
||||
else if (( uint)val == val) W(( uint)val);
|
||||
else { _IO.W((byte)0xD3); _IO.WE(val, true); } }
|
||||
private void W( ulong val) { if (( uint)val == val) W(( uint)val);
|
||||
else { _IO.W((byte)0xCF); _IO.WE(val, true); } }
|
||||
private void W( float val) { if (( long)val == val) W(( long)val);
|
||||
else { _IO.W((byte)0xCA); _IO.WE(val, true); } }
|
||||
private void W(double val) { if (( long)val == val) W(( long)val);
|
||||
else if (( float)val == val) W(( float)val);
|
||||
else { _IO.W((byte)0xCB); _IO.WE(val, true); } }
|
||||
|
||||
private void W( bool val) =>
|
||||
_IO.W((byte)(val ? 0xC3 : 0xC2));
|
||||
|
||||
private void W(byte[] val)
|
||||
{
|
||||
if (val == null) { WN(); return; }
|
||||
|
||||
if (val.Length < 0x100) { _IO.W((byte)0xC4); _IO.W (( byte)val.Length ); }
|
||||
else if (val.Length < 0x10000) { _IO.W((byte)0xC5); _IO.WE((ushort)val.Length, true); }
|
||||
else { _IO.W((byte)0xC6); _IO.WE( val.Length, true); }
|
||||
_IO.W(val);
|
||||
}
|
||||
|
||||
private void W(string val)
|
||||
{
|
||||
if (val == null) { WN(); return; }
|
||||
|
||||
byte[] array = Text.ToUTF8(val);
|
||||
if (array.Length < 0x20) _IO.W((byte)(0xA0 | (array.Length & 0x1F)));
|
||||
else if (array.Length < 0x100) { _IO.W((byte)0xD9); _IO.W (( byte)array.Length); }
|
||||
else if (array.Length < 0x10000) { _IO.W((byte)0xDA); _IO.WE((ushort)array.Length, true); }
|
||||
else { _IO.W((byte)0xDB); _IO.WE( array.Length, true); }
|
||||
_IO.W(array);
|
||||
}
|
||||
|
||||
private void WN() => _IO.W((byte)0xC0);
|
||||
|
||||
private void WA(int val)
|
||||
{
|
||||
if (val == 0) { WN(); return; }
|
||||
else if (val < 0x10) _IO.W((byte)(0x90 | (val & 0x0F)));
|
||||
else if (val < 0x10000) { _IO.W((byte)0xDC); _IO.WE((ushort)val, true); }
|
||||
else { _IO.W((byte)0xDD); _IO.WE( val, true); }
|
||||
}
|
||||
|
||||
private void WM(int val)
|
||||
{
|
||||
if (val == 0) { WN(); return; }
|
||||
else if (val < 0x10) _IO.W((byte)(0x80 | (val & 0x0F)));
|
||||
else if (val < 0x10000) { _IO.W((byte)0xDE); _IO.WE((ushort)val, true); }
|
||||
else { _IO.W((byte)0xDF); _IO.WE( val, true); }
|
||||
}
|
||||
|
||||
private void W(MsgPack.Ext val) => WE(val);
|
||||
|
||||
private void WE(MsgPack.Ext val)
|
||||
{
|
||||
if (val.Data == null) { WN(); return; }
|
||||
|
||||
if (val.Data.Length < 1 ) { WN(); return; }
|
||||
else if (val.Data.Length == 1 ) _IO.W((byte)0xD4);
|
||||
else if (val.Data.Length == 2 ) _IO.W((byte)0xD5);
|
||||
else if (val.Data.Length == 4 ) _IO.W((byte)0xD6);
|
||||
else if (val.Data.Length == 8 ) _IO.W((byte)0xD7);
|
||||
else if (val.Data.Length == 16) _IO.W((byte)0xD8);
|
||||
else
|
||||
{
|
||||
if (val.Data.Length < 0x100)
|
||||
{ _IO.W((byte)0xC7); _IO.W (( byte)val.Data.Length); }
|
||||
else if (val.Data.Length < 0x10000)
|
||||
{ _IO.W((byte)0xC8); _IO.WE((ushort)val.Data.Length, true); }
|
||||
else
|
||||
{ _IO.W((byte)0xC9); _IO.WE( val.Data.Length, true); }
|
||||
}
|
||||
_IO.W(val.Type);
|
||||
_IO.W(val.Data);
|
||||
}
|
||||
|
||||
public void Dispose() => _IO.C();
|
||||
}
|
||||
|
||||
public enum Types : byte
|
||||
{
|
||||
PosInt = 0b00000000,
|
||||
FixMap = 0b10000000,
|
||||
FixArr = 0b10010000,
|
||||
FixStr = 0b10100000,
|
||||
Nil = 0b11000000,
|
||||
NeverUsed = 0b11000001,
|
||||
False = 0b11000010,
|
||||
True = 0b11000011,
|
||||
Bin8 = 0b11000100,
|
||||
Bin16 = 0b11000101,
|
||||
Bin32 = 0b11000110,
|
||||
Ext8 = 0b11000111,
|
||||
Ext16 = 0b11001000,
|
||||
Ext32 = 0b11001001,
|
||||
Float32 = 0b11001010,
|
||||
Float64 = 0b11001011,
|
||||
UInt8 = 0b11001100,
|
||||
UInt16 = 0b11001101,
|
||||
UInt32 = 0b11001110,
|
||||
UInt64 = 0b11001111,
|
||||
Int8 = 0b11010000,
|
||||
Int16 = 0b11010001,
|
||||
Int32 = 0b11010010,
|
||||
Int64 = 0b11010011,
|
||||
FixExt1 = 0b11010100,
|
||||
FixExt2 = 0b11010101,
|
||||
FixExt4 = 0b11010110,
|
||||
FixExt8 = 0b11010111,
|
||||
FixExt16 = 0b11011000,
|
||||
Str8 = 0b11011001,
|
||||
Str16 = 0b11011010,
|
||||
Str32 = 0b11011011,
|
||||
Arr16 = 0b11011100,
|
||||
Arr32 = 0b11011101,
|
||||
Map16 = 0b11011110,
|
||||
Map32 = 0b11011111,
|
||||
NegInt = 0b11100000,
|
||||
PosIntMax = 0b01111111,
|
||||
FixMapMax = 0b10001111,
|
||||
FixArrMax = 0b10011111,
|
||||
FixStrMax = 0b10111111,
|
||||
NegIntMax = 0b11111111,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<Authors>korenkonder</Authors>
|
||||
<Company></Company>
|
||||
<Configuration></Configuration>
|
||||
<Copyright>korenkonder (C) 2018-2023</Copyright>
|
||||
<Copyright>korenkonder (C) 2018-2024</Copyright>
|
||||
<Description>A simple library for working with Project Diva AC/DT/F/AFT/F2/X/XHD/FT/VRFL/M39 files</Description>
|
||||
<FileVersion>0.4.10.18</FileVersion>
|
||||
<FileVersion>0.5.0.0</FileVersion>
|
||||
<PackageId>KKdMainLib</PackageId>
|
||||
<Product>KKdMainLib</Product>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
<Title>KKdMainLib</Title>
|
||||
<Version>0.4.10.18</Version>
|
||||
<Version>0.5.0.0</Version>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
||||
+57
-49
@@ -1,6 +1,7 @@
|
||||
using KKdBaseLib;
|
||||
using KKdBaseLib.F2;
|
||||
using KKdMainLib.IO;
|
||||
using static KKdMainLib.FARC;
|
||||
|
||||
namespace KKdMainLib
|
||||
{
|
||||
@@ -200,15 +201,15 @@ RETURN:
|
||||
{
|
||||
ref HeaderData.Sub.Data data = ref Header.Data[i].Array[i0];
|
||||
int Size = GetSize(data.Type);
|
||||
if (data.Array == null || data.Array.Length < 1 || Size < 1) continue;
|
||||
|
||||
switch ((int)data.Type)
|
||||
{
|
||||
case 0x3E:
|
||||
case 0x49:
|
||||
case 0x4B:
|
||||
s.A(0x20, true);
|
||||
break;
|
||||
if (data.Array == null || data.Array.Length < 1 || Size < 1) continue;
|
||||
|
||||
switch ((int)data.Type)
|
||||
{
|
||||
case 0x3E:
|
||||
case 0x49:
|
||||
case 0x4B:
|
||||
s.A(0x20, true);
|
||||
break;
|
||||
}
|
||||
|
||||
if (data.Array.Length >= 4 && s.P % 0x4 != 0)
|
||||
@@ -487,11 +488,11 @@ RETURN:
|
||||
case 0x3B: // SetRobCharaHeadObject
|
||||
data.Array.GBy(temp.RI32("Index"), 0x00);
|
||||
break;
|
||||
case 0x3C:
|
||||
data.Array.GBy(temp.RI32("i00"), 0x00);
|
||||
data.Array.GBy(temp.RF32("f04"), 0x04);
|
||||
data.Array.GBy(temp.RF32("f08"), 0x08);
|
||||
data.Array.GBy(temp.RF32("f0C"), 0x0C);
|
||||
case 0x3C: // SetLookCamera
|
||||
data.Array.GBy(temp.RI32("Enable"), 0x00);
|
||||
data.Array.GBy(temp.RF32("HeadRotStrength"), 0x04);
|
||||
data.Array.GBy(temp.RF32("EyesRotStrength"), 0x08);
|
||||
data.Array.GBy(temp.RF32("BlendDuration"), 0x0C);
|
||||
break;
|
||||
case 0x3D: // SetEyelidMotionFromFace
|
||||
data.Array.GBy(temp.RI32("i00"), 0x00);
|
||||
@@ -518,13 +519,15 @@ RETURN:
|
||||
data.Array.GBy(temp.RF32("Strength"), 0x38);
|
||||
data.Array.GBy(temp.RI32("StrengthTransition"), 0x3C);
|
||||
break;
|
||||
case 0x41: // OsageReset
|
||||
case 0x40: // OsageReset
|
||||
break;
|
||||
case 0x41: // MotionSkinParam
|
||||
data.Array.GBy(temp.RI32("Iterations"), 0x00);
|
||||
break;
|
||||
case 0x42: // OsageStep
|
||||
data.Array.GBy(temp.RF32("Value"), 0x00);
|
||||
break;
|
||||
case 0x43:
|
||||
case 0x43: // SleeveAdjust
|
||||
data.Array.GBy(temp.RI32("i00"), 0x00);
|
||||
data.Array.GBy(temp.RF32("f04"), 0x04);
|
||||
break;
|
||||
@@ -532,11 +535,11 @@ RETURN:
|
||||
data.Array.GBy(temp.RI32("i00"), 0x00);
|
||||
data.Array.GBy(temp.RF32("f04"), 0x04);
|
||||
break;
|
||||
case 0x45:
|
||||
data.Array.GBy(temp.RI32("i00"), 0x00);
|
||||
case 0x45: // MotionMaxFrame
|
||||
data.Array.GBy(temp.RI32("MaxFrame"), 0x00);
|
||||
break;
|
||||
case 0x46:
|
||||
data.Array.GBy(temp.RI32("i00"), 0x00);
|
||||
case 0x46: // CameraMaxFrame
|
||||
data.Array.GBy(temp.RI32("MaxFrame"), 0x00);
|
||||
break;
|
||||
case 0x47: // OsageMoveCancel
|
||||
data.Array.GBy(temp.RU8("ID"), 0x00); // 0 - All, 1 - Kami, 2 - Outer
|
||||
@@ -571,9 +574,9 @@ RETURN:
|
||||
data.Array.GBy(temp.RF32("ArmLength"), 0x28);
|
||||
data.Array.GBy(temp.RI32("i2C"), 0x2C);
|
||||
break;
|
||||
case 0x4A:
|
||||
data.Array.GBy(temp.RU8("i00_8"), 0x00);
|
||||
data.Array.GBy(temp.RU8("i01_8"), 0x01);
|
||||
case 0x4A: // DisableCollision
|
||||
data.Array.GBy(temp.RU8("Parts"), 0x00);
|
||||
data.Array.GBy(temp.RU8("Disable"), 0x01);
|
||||
break;
|
||||
case 0x4B: // RobAdjustGlobal
|
||||
data.Array.GBy(temp.RI32("TransitionDuration"), 0x00);
|
||||
@@ -616,7 +619,6 @@ RETURN:
|
||||
case 0x50: // AdjustGetGlobalTrans
|
||||
data.Array.GBy((byte)(temp.RB("Value") ? 1 : 0), 0x00);
|
||||
break;
|
||||
case 0x40: // WindReset
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -790,12 +792,12 @@ RETURN:
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("Index", data.Array.TI32(0x00)));
|
||||
break;
|
||||
case 0x3C:
|
||||
case 0x3C: // SetLookCamera
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("i00", data.Array.TI32(0x00))
|
||||
.Add("f04", data.Array.TF32(0x04))
|
||||
.Add("f08", data.Array.TF32(0x08))
|
||||
.Add("f0C", data.Array.TF32(0x0C)));
|
||||
.Add("Enable", data.Array.TI32(0x00))
|
||||
.Add("HeadRotStrength", data.Array.TF32(0x04))
|
||||
.Add("EyesRotStrength", data.Array.TF32(0x08))
|
||||
.Add("BlendDuration", data.Array.TF32(0x0C)));
|
||||
break;
|
||||
case 0x3D: // SetEyelidMotionFromFace
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
@@ -824,7 +826,9 @@ RETURN:
|
||||
.Add("Strength", data.Array.TF32(0x38))
|
||||
.Add("StrengthTransition", data.Array.TI32(0x3C)));
|
||||
break;
|
||||
case 0x41: // OsageReset
|
||||
case 0x40: // OsageReset
|
||||
break;
|
||||
case 0x41: // MotionSkinParam
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("Iterations", data.Array.TI32(0x00)));
|
||||
break;
|
||||
@@ -832,7 +836,7 @@ RETURN:
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("Value", data.Array.TF32(0x00)));
|
||||
break;
|
||||
case 0x43:
|
||||
case 0x43: // SleeveAdjust
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("i00", data.Array.TI32(0x00))
|
||||
.Add("f04", data.Array.TF32(0x04)));
|
||||
@@ -842,13 +846,13 @@ RETURN:
|
||||
.Add("i00", data.Array.TI32(0x00))
|
||||
.Add("f04", data.Array.TF32(0x04)));
|
||||
break;
|
||||
case 0x45:
|
||||
case 0x45: // MotionMaxFrame
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("i00", data.Array.TI32(0x00)));
|
||||
.Add("MaxFrame", data.Array.TI32(0x00)));
|
||||
break;
|
||||
case 0x46:
|
||||
case 0x46: // CameraMaxFrame
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("i00", data.Array.TI32(0x00)));
|
||||
.Add("MaxFrame", data.Array.TI32(0x00)));
|
||||
break;
|
||||
case 0x47: // OsageMoveCancel
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
@@ -886,10 +890,10 @@ RETURN:
|
||||
.Add("ArmLength", data.Array.TF32(0x28))
|
||||
.Add("i2C", data.Array.TI32(0x2C)));
|
||||
break;
|
||||
case 0x4A:
|
||||
case 0x4A: // DisableCollision
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("i00_8", data.Array.TU8(0x00))
|
||||
.Add("i01_8", data.Array.TU8(0x01)));
|
||||
.Add("Parts", data.Array.TU8(0x00))
|
||||
.Add("Disable", data.Array.TU8(0x01)));
|
||||
break;
|
||||
case 0x4B: // RobAdjustGlobal
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
@@ -938,7 +942,6 @@ RETURN:
|
||||
arrayEntry.Add(new MsgPack("Data")
|
||||
.Add("Value", data.Array.TU8(0) != 0));
|
||||
break;
|
||||
case 0x40: // WindReset
|
||||
default:
|
||||
if (data.Array != null && data.Array.Length > 0)
|
||||
{
|
||||
@@ -1001,20 +1004,20 @@ RETURN:
|
||||
0x39 => 0x14, // SetEyesMottblMotion
|
||||
0x3A => 0x14, // SetEyelidMottblMotion
|
||||
0x3B => 0x04, // SetRobCharaHeadObject
|
||||
0x3C => 0x10,
|
||||
0x3C => 0x10, // SetLookCamera
|
||||
0x3D => 0x08, // SetEyelidMotionFromFace
|
||||
0x3E => 0x40, // RobPartsAdjust
|
||||
0x40 => 0x00, // WindReset
|
||||
0x41 => 0x04, // OsageReset
|
||||
0x40 => 0x00, // OsageReset
|
||||
0x41 => 0x04, // MotionSkinParam
|
||||
0x42 => 0x04, // OsageStep
|
||||
0x43 => 0x08,
|
||||
0x43 => 0x08, // SleeveAdjust
|
||||
0x44 => 0x08,
|
||||
0x45 => 0x04,
|
||||
0x46 => 0x04,
|
||||
0x45 => 0x04, // MotionMaxFrame
|
||||
0x46 => 0x04, // CameraMaxFrame
|
||||
0x47 => 0x08, // OsageMoveCancel
|
||||
0x48 => 0x1C,
|
||||
0x49 => 0x30, // RobHandAdjust
|
||||
0x4A => 0x02,
|
||||
0x4A => 0x02, // DisableCollision
|
||||
0x4B => 0x34, // RobAdjustGlobal
|
||||
0x4C => 0x0C, // RobArmAdjust
|
||||
0x4D => 0x01, // DisableEyeMotion
|
||||
@@ -1039,7 +1042,7 @@ RETURN:
|
||||
_ => 0x00,
|
||||
};
|
||||
|
||||
public void Dispose()
|
||||
public void Dispose()
|
||||
{ if (s != null) s.D(); s = null; Header = default; }
|
||||
|
||||
public struct HeaderData
|
||||
@@ -1097,13 +1100,18 @@ RETURN:
|
||||
SetEyesMottblMotion = 0x39,
|
||||
SetEyelidMottblMotion = 0x3A,
|
||||
SetRobCharaHeadObject = 0x3B,
|
||||
SetLookCamera = 0x3C,
|
||||
SetEyelidMotionFromFace = 0x3D,
|
||||
RobPartsAdjust = 0x3E,
|
||||
WindReset = 0x40,
|
||||
OsageReset = 0x41,
|
||||
OsageReset = 0x40,
|
||||
MotionSkinParam = 0x41,
|
||||
OsageStep = 0x42,
|
||||
SleeveAdjust = 0x43,
|
||||
MotionMaxFrame = 0x45,
|
||||
CameraMaxFrame = 0x46,
|
||||
OsageMoveCancel = 0x47,
|
||||
RobHandAdjust = 0x49,
|
||||
DisableCollision = 0x4A,
|
||||
RobAdjustGlobal = 0x4B,
|
||||
RobArmAdjust = 0x4C,
|
||||
DisableEyeMotion = 0x4D,
|
||||
|
||||
Binary file not shown.
+828
-828
File diff suppressed because it is too large
Load Diff
@@ -6,10 +6,10 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PD_Tool")]
|
||||
[assembly: AssemblyCopyright("korenkonder (C) 2017-2023")]
|
||||
[assembly: AssemblyCopyright("korenkonder (C) 2017-2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("7B5D5A3A-A6F8-4813-C97D-ACFC98F7397E")]
|
||||
[assembly: AssemblyVersion("0.4.10.18")]
|
||||
[assembly: AssemblyFileVersion("0.4.10.18")]
|
||||
[assembly: AssemblyVersion("0.5.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.5.0.0")]
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace PD_Tool
|
||||
}
|
||||
else if (choose == "R") return;
|
||||
else farc.Signature = KKdFARC.Farc.FArC;
|
||||
farc.Pack(farc.Signature);
|
||||
farc.Pack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user