Add project files.

This commit is contained in:
Razmoth
2022-09-27 17:40:31 +04:00
parent 871d908948
commit a476ace7d7
305 changed files with 71340 additions and 84 deletions

View File

@@ -0,0 +1,35 @@
using System;
using System.Runtime.InteropServices;
using AssetStudio.PInvoke;
namespace ACL
{
public static class ACL
{
private const string DLL_NAME = "acl";
static ACL()
{
DllLoader.PreloadDll(DLL_NAME);
}
public static void DecompressAll(byte[] data, out float[] values, out float[] times)
{
var pinned = GCHandle.Alloc(data, GCHandleType.Pinned);
var pData = pinned.AddrOfPinnedObject();
DecompressAll(pData, out var pValues, out var numValues, out var pTimes, out var numTimes);
pinned.Free();
values = new float[numValues];
Marshal.Copy(pValues, values, 0, numValues);
times = new float[numTimes];
Marshal.Copy(pTimes, times, 0, numTimes);
}
#region importfunctions
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
private static extern void DecompressAll(IntPtr data, out IntPtr pValues, out int numValues, out IntPtr pTimes, out int numTimes);
#endregion
}
}

View File

@@ -0,0 +1,8 @@
namespace AssetStudio
{
public static class ACLExtensions
{
public static void Process(this ACLClip m_ACLClip, out float[] values, out float[] times) => ACL.ACL.DecompressAll(m_ACLClip.m_ClipData, out values, out times);
public static void ProcessSR(this ACLClip m_ACLClip, out float[] values, out float[] times) => ACL.SRACL.DecompressAll(m_ACLClip.m_ClipDataUint, out values, out times);
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Runtime.InteropServices;
using AssetStudio.PInvoke;
namespace ACL
{
public static class SRACL
{
private const string DLL_NAME = "sracl";
static SRACL()
{
DllLoader.PreloadDll(DLL_NAME);
}
public static void DecompressAll(uint[] data, out float[] values, out float[] times)
{
var pinned = GCHandle.Alloc(data, GCHandleType.Pinned);
var pData = pinned.AddrOfPinnedObject();
DecompressAll(pData, out var pValues, out var numValues, out var pTimes, out var numTimes);
pinned.Free();
values = new float[numValues];
Marshal.Copy(pValues, values, 0, numValues);
times = new float[numTimes];
Marshal.Copy(pTimes, times, 0, numTimes);
}
#region importfunctions
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
private static extern void DecompressAll(IntPtr data, out IntPtr pValues, out int numValues, out IntPtr pTimes, out int numTimes);
#endregion
}
}