Compare commits

...
4 Commits
Author SHA1 Message Date
korenkonder 2b46e0f4bd Release v0.4.10.3
A3DA
2021-05-24 04:02:18 +03:00
korenkonder f1547f78b2 Release v0.4.10.2.1
A3DA
2021-05-23 21:11:34 +03:00
korenkonder 6c35326dda v0.4.10.2
A3DA
2021-05-22 14:13:54 +03:00
korenkonder 30a51f6bc4 Release v0.4.10.1
A3DA
2021-04-30 03:10:49 +03:00
12 changed files with 653 additions and 627 deletions
+4 -4
View File
@@ -27,15 +27,15 @@ namespace KKdBaseLib
Length = DataOffset = 0; Keys = null;
MaxFrames = k.Max ?? 0;
if (k.Type > KeyType.Static && k.Length > 1)
if (k.Type > KeyType.Static && k.Keys != null && k.Keys.Length > 1)
{
Type = k.Type;
Length = k.Length;
Length = k.Keys.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;
FrameDelta = k.Keys[Length - 1].F - k.Keys[0].F;
ValueDelta = k.Keys[Length - 1].V - k.Keys[0].V;
}
else
{
+16 -16
View File
@@ -36,8 +36,8 @@ namespace KKdBaseLib.Auth3D
public struct Ambient
{
public string Name;
public Vec3<Key>? LightDiffuse;
public Vec3<Key>? RimLightDiffuse;
public Vec4<Key?>? LightDiffuse;
public Vec4<Key?>? RimLightDiffuse;
}
public struct CameraAuxiliary
@@ -46,6 +46,7 @@ namespace KKdBaseLib.Auth3D
public Key? Exposure;
public Key? Saturate;
public Key? GammaRate;
public Key? ExposureRate;
public Key? AutoExposure;
}
@@ -99,7 +100,7 @@ namespace KKdBaseLib.Auth3D
public Key? End;
public Key? Start;
public Key? Density;
public Vec3<Key>? Diffuse;
public Vec4<Key?>? Diffuse;
}
public enum CompressF16 : int
@@ -129,7 +130,6 @@ namespace KKdBaseLib.Auth3D
public struct Key
{
public KeyType Type;
public int Length;
public int? BinOffset;
public EPType EPTypePre;
public EPType EPTypePost;
@@ -142,7 +142,6 @@ namespace KKdBaseLib.Auth3D
{
Type = 0;
Value = 0;
Length = 0;
BinOffset = null;
RawData = default;
Keys = null;
@@ -153,7 +152,6 @@ namespace KKdBaseLib.Auth3D
if (k.Length > 1)
{
Type = k.Type;
Length = (int)k.Length;
Keys = k.Keys;
}
else if (k.Length == 1)
@@ -184,10 +182,10 @@ namespace KKdBaseLib.Auth3D
public Key? Intensity;
public Key? Linear;
public Key? Quadratic;
public Vec3<Key>? Ambient;
public Vec3<Key>? Diffuse;
public Vec4<Key>? Specular;
public Vec3<Key>? Incandescence;
public Vec4<Key?>? Ambient;
public Vec4<Key?>? Diffuse;
public Vec4<Key?>? Specular;
public Vec4<Key?>? Incandescence;
public ModelTransform Position;
public ModelTransform SpotDirection;
}
@@ -197,8 +195,8 @@ namespace KKdBaseLib.Auth3D
public ulong HashName;
public string Name;
public Key GlowIntensity;
public Vec4<Key>? BlendColor;
public Vec3<Key>? Incandescence;
public Vec4<Key?>? BlendColor;
public Vec4<Key?>? Incandescence;
}
public struct MObjectHRC
@@ -237,8 +235,10 @@ namespace KKdBaseLib.Auth3D
public struct Object
{
public int? MorphOffset;
public float? PatOffset;
public float? MorphOffset;
public string Name;
public string Pat;
public string Morph;
public string UIDName;
public string ParentName;
@@ -292,8 +292,8 @@ namespace KKdBaseLib.Auth3D
public Key? LensFlare;
public Key? LensGhost;
public Key? LensShaft;
public Vec3<Key>? Ambient;
public Vec3<Key>? Diffuse;
public Vec4<Key>? Specular;
public Vec4<Key?>? Ambient;
public Vec4<Key?>? Diffuse;
public Vec4<Key?>? Specular;
}
}
+2 -2
View File
@@ -33,10 +33,10 @@ namespace KKdBaseLib.Interpolation
f = -df;
ResetFrameCount();
if (key.Keys != null && key.Length > 0)
if (key.Keys != null && key.Keys.Length > 0)
{
firstKey = key.Keys[0];
lastKey = key.Keys[key.Length - 1];
lastKey = key.Keys[key.Keys.Length - 1];
}
}
+5 -3
View File
@@ -70,7 +70,7 @@ namespace KKdBaseLib
new KFT3(F, V);
public IKF Check() =>
V == 0 ? (KFT0)this : (IKF)this;
V.ToU32() == 0x00000000 ? (KFT0)this : (IKF)this;
public override string ToString() => ToString(true, 7);
public string ToString(int round = 7, bool brackets = true) =>
@@ -135,7 +135,7 @@ namespace KKdBaseLib
new KFT3(F, V, T, T);
public IKF Check() =>
T == 0 ? (V == 0 ? (IKF)ToT0() : ToT1()) : this;
T.ToU32() == 0x00000000 ? (V.ToU32() == 0x00000000 ? (IKF)ToT0() : ToT1()) : this;
public override string ToString() => ToString(true, 7);
public string ToString(int round = 7, bool brackets = true) =>
@@ -199,7 +199,9 @@ namespace KKdBaseLib
public KFT3 ToT3() => this;
public IKF Check() =>
T1 == 0 && T2 == 0 ? (V == 0 ? (IKF)(KFT0)this : (KFT1)this) : T1 == T2 ? (KFT2)this : (IKF)this;
T1.ToU32() == 0x00000000 && T2.ToU32() == 0x00000000
? (V.ToU32() == 0x00000000 ? (IKF)(KFT0)this : (KFT1)this)
: T1.ToU32() == T2.ToU32() ? (KFT2)this : (IKF)this;
public override string ToString() => ToString(true, 7);
public string ToString(int round = 7, bool brackets = true) =>
+2 -2
View File
@@ -6,12 +6,12 @@
<Configuration></Configuration>
<Copyright>korenkonder (C) 2019-2021</Copyright>
<Description>A base library</Description>
<FileVersion>0.4.10.0</FileVersion>
<FileVersion>0.4.10.3</FileVersion>
<PackageId>KKdBaseLib</PackageId>
<Product>KKdBaseLib</Product>
<TargetFramework>net461</TargetFramework>
<Title>KKdBaseLib</Title>
<Version>0.4.10.0</Version>
<Version>0.4.10.3</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
+41 -5
View File
@@ -59,7 +59,16 @@ namespace KKdBaseLib
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);
dict.FV(out string val, args.Split(split)) && int.TryParse(val, out value);
public static bool FV (this A3DADict dict, ref uint value, char split, string args) =>
dict.FV(out string val, args.Split(split)) && uint.TryParse(val, out value);
public static bool FV (this A3DADict dict, ref long value, char split, string args) =>
dict.FV(out string val, args.Split(split)) && long.TryParse(val, out value);
public static bool FV (this A3DADict dict, ref ulong value, char split, string args) =>
dict.FV(out string val, args.Split(split)) && ulong.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);
@@ -73,11 +82,23 @@ namespace KKdBaseLib
public static bool FV (this A3DADict dict, out bool value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return bool.TryParse(val, out value); value = false; return false; }
return bool.TryParse(val, out value); value = false; return false; }
public static bool FV (this A3DADict dict, out int value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return int.TryParse(val, out value); value = 0; return false; }
return int.TryParse(val, out value); value = 0; return false; }
public static bool FV (this A3DADict dict, out uint value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return uint.TryParse(val, out value); value = 0; return false; }
public static bool FV (this A3DADict dict, out long value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return long.TryParse(val, out value); value = 0; return false; }
public static bool FV (this A3DADict dict, out ulong value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return ulong.TryParse(val, out value); value = 0; return false; }
public static bool FV (this A3DADict dict, out float value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
@@ -87,14 +108,29 @@ namespace KKdBaseLib
{ if (dict.FV(out string val , args.Split('.' )))
return val.ToF64(out value); value = 0; return false; }
public static bool FV<T>(this A3DADict dict, out T value, string args) where T : struct
public static bool FV<T>(this A3DADict dict, out T value, string args) where T : struct, Enum
{ if (dict.FV(out string val , args.Split('.' )))
{ bool Val = Enum.TryParse(val, out T _value); value = _value; return Val; }
value = default; return false; }
public static bool FV (this A3DADict dict, out int? value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
{ bool Val = int.TryParse(val, out int _value); value = _value; return Val; }
{ bool Val = int.TryParse(val, out int _value); value = _value; return Val; }
value = null; return false; }
public static bool FV (this A3DADict dict, out uint? value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
{ bool Val = uint.TryParse(val, out uint _value); value = _value; return Val; }
value = null; return false; }
public static bool FV (this A3DADict dict, out long? value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
{ bool Val = long.TryParse(val, out long _value); value = _value; return Val; }
value = null; return false; }
public static bool FV (this A3DADict dict, out ulong? value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
{ bool Val = ulong.TryParse(val, out ulong _value); value = _value; return Val; }
value = null; return false; }
public static bool FV (this A3DADict dict, out float? value, string args)
+520 -557
View File
File diff suppressed because it is too large Load Diff
+10 -3
View File
@@ -131,15 +131,19 @@ namespace KKdMainLib.IO
private object RF()
{
string s = " ";
string s = "";
_IO.SW();
if (_IO.PCUTF8() == '-') s += _IO.RCUTF8();
bool negative = false;
if (_IO.PCUTF8() == '-') { _IO.RCUTF8(); negative = true; }
if (_IO.PCUTF8() == '0') s += _IO.RCUTF8();
else s += RD ();
char c = _IO.PCUTF8();
if (c == '.') s += _IO.RCUTF8() + RD();
else if (negative && s == "0")
return (float)-0.0f;
else if (c != 'e' && c != 'E')
{
if (negative) s = "-" + s;
long val;
try { val = long.Parse(s); }
catch { return ulong.Parse(s); }
@@ -161,7 +165,10 @@ namespace KKdMainLib.IO
s += RD();
}
double d = s.ToF64();
return (float)d == d ? (float)d : d;
if ((float)d == d)
return negative ? (((float)d).ToU32() | 0x80000000).ToF32() : (float)d;
else
return negative ? (d.ToU64() | 0x8000000000000000).ToF64() : d;
}
private bool RBo()
+2 -2
View File
@@ -6,12 +6,12 @@
<Configuration></Configuration>
<Copyright>korenkonder (C) 2018-2021</Copyright>
<Description>A simple library for working with Project Diva AC/DT/F/AFT/F2/X/FT/M39 files</Description>
<FileVersion>0.4.10.0</FileVersion>
<FileVersion>0.4.10.3</FileVersion>
<PackageId>KKdMainLib</PackageId>
<Product>KKdMainLib</Product>
<TargetFramework>net461</TargetFramework>
<Title>KKdMainLib</Title>
<Version>0.4.10.0</Version>
<Version>0.4.10.3</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
+4 -4
View File
@@ -350,15 +350,15 @@ namespace PD_Tool
else if (filetype == "vag" ) Filter = GetArgs("VAG" , "vag", "wav") +
GetArgs("VAG", true, "vag") + wav;
using OpenFileDialog ofd = new OpenFileDialog { InitialDirectory = Application.StartupPath,
Filter = Filter, Multiselect = true, Title = "Choose file(s) to open:" };
using OpenFileDialog ofd = new OpenFileDialog { Filter = Filter,
Multiselect = true, Title = "Choose file(s) to open:" };
if (ofd.ShowDialog() == DialogResult.OK) FileNames = ofd.FileNames;
}
else if (code == 2)
{
string Return = "";
using (OpenFileDialog ofd = new OpenFileDialog { InitialDirectory = Application.StartupPath,
ValidateNames = false, CheckFileExists = false, Filter = " | ", CheckPathExists = true,
using (OpenFileDialog ofd = new OpenFileDialog { ValidateNames = false,
CheckFileExists = false, Filter = " | ", CheckPathExists = true,
Title = "Choose any file in folder:", FileName = "Folder Selection." })
if (ofd.ShowDialog() == DialogResult.OK) Return = Path.GetDirectoryName(ofd.FileName);
return Return;
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("7B5D5A3A-A6F8-4813-C97D-ACFC98F7397E")]
[assembly: AssemblyVersion("0.4.10.0")]
[assembly: AssemblyFileVersion("0.4.10.0")]
[assembly: AssemblyVersion("0.4.10.3")]
[assembly: AssemblyFileVersion("0.4.10.3")]
+45 -27
View File
@@ -18,34 +18,50 @@ namespace PD_Tool
foreach (string file in fileNames)
if (file.EndsWith(".mp") || file.EndsWith(".json") || file.EndsWith(".farc")) { mp = true; break; }
bool a3dcOpt = false;
Format format = Format.NULL;
string choose = "";
Console.Clear();
Program.ConsoleDesign(true);
Program.ConsoleDesign(" Choose type of format to export:");
Program.ConsoleDesign(false);
Program.ConsoleDesign(" Tip: A3DC Opt - A3DC Optimization");
Program.ConsoleDesign(" WARNING! CHECK RESULTS AFTER CONVERTING ");
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("8. A3DC [XHD]");
if (!mp) Program.ConsoleDesign($"9. {(json ? "JSON" : "MsgPack")}");
Program.ConsoleDesign("3. A3DC [DT/AC/F] (A3DC Opt)");
Program.ConsoleDesign("4. A3DA [AFT/FT/M39]");
Program.ConsoleDesign("5. A3DC [AFT/FT/M39]");
Program.ConsoleDesign("6. A3DC [AFT/FT/M39] (A3DC Opt)");
Program.ConsoleDesign("7. A3DC [F2]");
Program.ConsoleDesign("8. A3DC [F2] (A3DC Opt)");
Program.ConsoleDesign("9. A3DC [MGF]");
Program.ConsoleDesign("A. A3DC [MGF] (A3DC Opt)");
Program.ConsoleDesign("B. A3DC [X]");
Program.ConsoleDesign("C. A3DC [X] (A3DC Opt)");
Program.ConsoleDesign("D. A3DC [XHD]");
Program.ConsoleDesign("E. A3DC [XHD] (A3DC Opt)");
if (!mp) Program.ConsoleDesign($"F. {(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.XHD;
else if (choose == "9") format = Format.NULL;
if (choose == "1") format = Format.DT ;
else if (choose == "2") format = Format.F ;
else if (choose == "3") { format = Format.F ; a3dcOpt = true; }
else if (choose == "4") format = Format.AFT;
else if (choose == "5") format = Format.AFT;
else if (choose == "6") { format = Format.AFT; a3dcOpt = true; }
else if (choose == "7") format = Format.F2 ;
else if (choose == "8") { format = Format.F2 ; a3dcOpt = true; }
else if (choose == "9") format = Format.MGF;
else if (choose == "A") { format = Format.MGF; a3dcOpt = true; }
else if (choose == "B") format = Format.X ;
else if (choose == "C") { format = Format.X ; a3dcOpt = true; }
else if (choose == "D") format = Format.XHD;
else if (choose == "E") { format = Format.XHD; a3dcOpt = true; }
else if (choose == "F") format = Format.NULL;
else return;
int state;
@@ -60,9 +76,9 @@ namespace PD_Tool
Console.Title = "A3DA Converter: " + Path.GetFileNameWithoutExtension(file);
if (ext == ".farc")
using (farc = new KKdFARC(file))
FARCProcessor(farc, choose, format);
FARCProcessor(farc, choose, format, a3dcOpt);
else if (ext == ".a3da")
using (a3da = new KKdA3DA(true))
using (a3da = new KKdA3DA(a3dcOpt))
{
state = a3da.A3DAReader(filepath);
if (state == 1)
@@ -71,22 +87,22 @@ namespace PD_Tool
{
a3da.Head.Format = format;
File.WriteAllBytes(filepath + ".a3da", (choose == "1" ||
choose == "3") ? a3da.A3DAWriter() : a3da.A3DCWriter());
choose == "4") ? a3da.A3DAWriter() : a3da.A3DCWriter());
}
}
else if (ext == ".mp" || ext == ".json")
using (a3da = new KKdA3DA(true))
using (a3da = new KKdA3DA(a3dcOpt))
{
a3da.MsgPackReader(filepath, ext == ".json");
a3da.Head.Format = format;
File.WriteAllBytes(filepath + ".a3da", (choose == "1" ||
choose == "3") ? a3da.A3DAWriter() : a3da.A3DCWriter());
choose == "4") ? a3da.A3DAWriter() : a3da.A3DCWriter());
}
}
}
private static void FARCProcessor(KKdFARC farc, string choose, Format format)
private static void FARCProcessor(KKdFARC farc, string choose, Format format, bool a3dcOpt)
{
if (!farc.HeaderReader() || !farc.HasFiles) return;
@@ -107,7 +123,7 @@ namespace PD_Tool
{
KKdA3DA a3da;
for (int i = 0; i < A3DAlist.Count; i++)
using (a3da = new KKdA3DA(true))
using (a3da = new KKdA3DA(a3dcOpt))
{
data = farc.FileReader(A3DAlist[i]);
int state = a3da.A3DAReader(data);
@@ -115,7 +131,8 @@ namespace PD_Tool
{
KKdFARC.FARCFile file = farc.Files[i];
a3da.Head.Format = format;
file.Data = (choose == "1"|| choose == "3") ? a3da.A3DAWriter() : a3da.A3DCWriter();
file.Data = (choose == "1"|| choose == "4")
? a3da.A3DAWriter() : a3da.A3DCWriter();
farc.Files[i] = file;
}
}
@@ -129,7 +146,7 @@ namespace PD_Tool
for (int i = 0; i < list.Count; i++)
{
KKdA3DA a3da;
using (a3da = new KKdA3DA(true))
using (a3da = new KKdA3DA(a3dcOpt))
{
data = farc.FileReader(list[i]);
int state = a3da.A3DAReader(data);
@@ -147,7 +164,7 @@ namespace PD_Tool
string ext = Path.GetExtension(list[i]).ToLower();
KKdA3DA a3da;
for (int i1 = 1; i1 < div; i1++)
using (a3da = new KKdA3DA(true))
using (a3da = new KKdA3DA(a3dcOpt))
{
string file = filename + "_div_" + i1 + ext;
data = farc.FileReader(file);
@@ -164,7 +181,8 @@ namespace PD_Tool
KKdFARC.FARCFile file = default;
file.Name = list[i];
a3daArray[i].Head.Format = format;
file.Data = (choose == "1" || choose == "3") ? a3daArray[i].A3DAWriter() : a3daArray[i].A3DCWriter();
file.Data = (choose == "1" || choose == "4")
? a3daArray[i].A3DAWriter() : a3daArray[i].A3DCWriter();
farc.Files.Add(file);
}
farc.Save();