v1.00.00
This commit is contained in:
@@ -74,4 +74,48 @@ namespace ACLLibs
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class DBACL
|
||||
{
|
||||
private const string DLL_NAME = "acldb";
|
||||
static DBACL()
|
||||
{
|
||||
DllLoader.PreloadDll(DLL_NAME);
|
||||
}
|
||||
public static void DecompressTracks(byte[] data, byte[] db, out float[] values, out float[] times)
|
||||
{
|
||||
var decompressedClip = new DecompressedClip();
|
||||
|
||||
var dataPtr = Marshal.AllocHGlobal(data.Length + 8);
|
||||
var dataAligned = new IntPtr(16 * (((long)dataPtr + 15) / 16));
|
||||
Marshal.Copy(data, 0, dataPtr, data.Length);
|
||||
|
||||
var dbPtr = Marshal.AllocHGlobal(db.Length + 8);
|
||||
var dbAligned = new IntPtr(16 * (((long)dbPtr + 15) / 16));
|
||||
Marshal.Copy(db, 0, dbAligned, db.Length);
|
||||
|
||||
DecompressTracks(dataAligned, dbAligned, ref decompressedClip);
|
||||
|
||||
Marshal.FreeHGlobal(dataPtr);
|
||||
Marshal.FreeHGlobal(dbPtr);
|
||||
|
||||
values = new float[decompressedClip.ValuesCount];
|
||||
Marshal.Copy(decompressedClip.Values, values, 0, decompressedClip.ValuesCount);
|
||||
|
||||
times = new float[decompressedClip.TimesCount];
|
||||
Marshal.Copy(decompressedClip.Times, times, 0, decompressedClip.TimesCount);
|
||||
|
||||
Dispose(ref decompressedClip);
|
||||
}
|
||||
|
||||
#region importfunctions
|
||||
|
||||
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void DecompressTracks(nint data, nint db, ref DecompressedClip decompressedClip);
|
||||
|
||||
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void Dispose(ref DecompressedClip decompressedClip);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,23 @@ namespace AssetStudio
|
||||
{
|
||||
public static class ACLExtensions
|
||||
{
|
||||
public static void Process(this ACLClip m_ACLClip, out float[] values, out float[] times) => ACL.DecompressAll(m_ACLClip.m_ClipData, out values, out times);
|
||||
public static void ProcessSR(this ACLClip m_ACLClip, out float[] values, out float[] times) => SRACL.DecompressAll(m_ACLClip.m_ClipData, out values, out times);
|
||||
public static void Process(this ACLClip m_ACLClip, Game game, out float[] values, out float[] times)
|
||||
{
|
||||
if (game.Type.IsSRGroup())
|
||||
{
|
||||
SRACL.DecompressAll(m_ACLClip.m_ClipData, out values, out times);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_ACLClip.m_DatabaseData.IsNullOrEmpty())
|
||||
{
|
||||
DBACL.DecompressTracks(m_ACLClip.m_ClipData, m_ACLClip.m_DatabaseData, out values, out times);
|
||||
}
|
||||
else
|
||||
{
|
||||
ACL.DecompressAll(m_ACLClip.m_ClipData, out values, out times);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user