Added net6 back.

This commit is contained in:
Razmoth
2023-01-07 20:58:12 +04:00
parent 94d73398ca
commit 37f816f800
19 changed files with 219 additions and 225 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>0.80.30</Version>
<AssemblyVersion>0.80.30</AssemblyVersion>

View File

@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
namespace AssetStudio.PInvoke
{
public static partial class DllLoader
public static class DllLoader
{
public static void PreloadDll(string dllName)
@@ -46,9 +46,9 @@ namespace AssetStudio.PInvoke
var directedDllPath = Path.Combine(dllDir, dllFileName);
// Specify SEARCH_DLL_LOAD_DIR to load dependent libraries located in the same platform-specific directory.
var hLibrary = LoadLibraryEx(directedDllPath, nint.Zero, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
var hLibrary = LoadLibraryEx(directedDllPath, IntPtr.Zero, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
if (hLibrary == nint.Zero)
if (hLibrary == IntPtr.Zero)
{
var errorCode = Marshal.GetLastWin32Error();
var exception = new Win32Exception(errorCode);
@@ -59,15 +59,15 @@ namespace AssetStudio.PInvoke
// HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
// HMODULE LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
[LibraryImport("kernel32.dll", EntryPoint = "LoadLibraryExA", SetLastError = true, StringMarshalling = StringMarshalling.Utf8)]
private static partial IntPtr LoadLibraryEx(string lpLibFileName, IntPtr hFile, uint dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr LoadLibraryEx(string lpLibFileName, IntPtr hFile, uint dwFlags);
private const uint LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x1000;
private const uint LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x100;
}
private static partial class Posix
private static class Posix
{
internal static void LoadDll(string dllDir, string dllName)
@@ -93,7 +93,7 @@ namespace AssetStudio.PInvoke
const int ldFlags = RTLD_NOW | RTLD_GLOBAL;
var hLibrary = DlOpen(directedDllPath, ldFlags);
if (hLibrary == nint.Zero)
if (hLibrary == IntPtr.Zero)
{
var pErrStr = DlError();
// `PtrToStringAnsi` always uses the specific constructor of `String` (see dotnet/core#2325),
@@ -107,12 +107,12 @@ namespace AssetStudio.PInvoke
// OSX and most Linux OS use LP64 so `int` is still 32-bit even on 64-bit platforms.
// void *dlopen(const char *filename, int flag);
[LibraryImport("libdl", EntryPoint = "dlopen", StringMarshalling = StringMarshalling.Utf8)]
private static partial nint DlOpen(string fileName, int flags);
[DllImport("libdl", EntryPoint = "dlopen")]
private static extern IntPtr DlOpen([MarshalAs(UnmanagedType.LPStr)] string fileName, int flags);
// char *dlerror(void);
[LibraryImport("libdl", EntryPoint = "dlerror")]
private static partial nint DlError();
[DllImport("libdl", EntryPoint = "dlerror")]
private static extern IntPtr DlError();
private const int RTLD_LAZY = 0x1;
private const int RTLD_NOW = 0x2;

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<Version>0.80.30</Version>
<AssemblyVersion>0.80.30</AssemblyVersion>
<FileVersion>0.80.30</FileVersion>

View File

@@ -488,8 +488,6 @@ namespace AssetStudio
m_ConstCurveCount = reader.ReadUInt32();
}
}
public bool IsSet => m_CurveCount > 0;
}
public class StreamedClip

View File

@@ -12,8 +12,10 @@ namespace AssetStudio
Bytes,
JSON
}
public sealed partial class MiHoYoBinData : Object
public sealed class MiHoYoBinData : Object
{
private static Regex ASCII = new Regex("[^\u0020-\u007E]", RegexOptions.Compiled);
public static bool Exportable;
public static bool Encrypted;
public static byte Key;
@@ -29,7 +31,7 @@ namespace AssetStudio
public string AsString => Type switch
{
MiHoYoBinDataType.JSON => JToken.Parse(DataStr).ToString(Formatting.Indented),
MiHoYoBinDataType.Bytes => Chars().Replace(DataStr, string.Empty),
MiHoYoBinDataType.Bytes => ASCII.Replace(DataStr, string.Empty),
_ => "",
};
public new object Dump() => Type switch
@@ -74,8 +76,5 @@ namespace AssetStudio
else return RawData;
}
}
[GeneratedRegex("[^\\u0020-\\u007E]")]
private static partial Regex Chars();
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFrameworks>net7.0-windows;net6.0-windows</TargetFrameworks>
<ApplicationIcon>Resources\as.ico</ApplicationIcon>
<Version>0.80.30</Version>
<AssemblyVersion>0.80.30</AssemblyVersion>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>0.80.30</Version>
<AssemblyVersion>0.80.30</AssemblyVersion>

View File

@@ -6,11 +6,11 @@ namespace AssetStudio
partial class Fbx
{
[LibraryImport(FbxDll.DllName)]
private static partial void AsUtilQuaternionToEuler(float qx, float qy, float qz, float qw, out float vx, out float vy, out float vz);
[DllImport(FbxDll.DllName)]
private static extern void AsUtilQuaternionToEuler(float qx, float qy, float qz, float qw, out float vx, out float vy, out float vz);
[LibraryImport(FbxDll.DllName)]
private static partial void AsUtilEulerToQuaternion(float vx, float vy, float vz, out float qx, out float qy, out float qz, out float qw);
[DllImport(FbxDll.DllName)]
private static extern void AsUtilEulerToQuaternion(float vx, float vy, float vz, out float qx, out float qy, out float qz, out float qw);
}
}

View File

@@ -1,100 +1,101 @@
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
namespace AssetStudio.FbxInterop
{
partial class FbxExporterContext
{
[LibraryImport(FbxDll.DllName)]
private static partial nint AsFbxCreateContext();
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxCreateContext();
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
[DllImport(FbxDll.DllName)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool AsFbxInitializeContext(nint context, string fileName, float scaleFactor, int versionIndex, [MarshalAs(UnmanagedType.Bool)] bool isAscii, [MarshalAs(UnmanagedType.Bool)] bool is60Fps, out string errorMessage);
private static extern bool AsFbxInitializeContext(IntPtr context, [MarshalAs(UnmanagedType.LPUTF8Str)] string fileName, float scaleFactor, int versionIndex, [MarshalAs(UnmanagedType.Bool)] bool isAscii, [MarshalAs(UnmanagedType.Bool)] bool is60Fps, out string errorMessage);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxDisposeContext(ref nint ppContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxDisposeContext(ref IntPtr ppContext);
private static void AsFbxSetFramePaths(nint context, string[] framePaths) => AsFbxSetFramePaths(context, framePaths, framePaths.Length);
private static void AsFbxSetFramePaths(IntPtr context, string[] framePaths) => AsFbxSetFramePaths(context, framePaths, framePaths.Length);
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
private static partial void AsFbxSetFramePaths(nint context, string[] framePaths, int count);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxSetFramePaths(IntPtr context, [MarshalAs(UnmanagedType.LPUTF8Str)] string[] framePaths, int count);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxExportScene(nint context);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxExportScene(IntPtr context);
[LibraryImport(FbxDll.DllName)]
private static partial nint AsFbxGetSceneRootNode(nint context);
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxGetSceneRootNode(IntPtr context);
private static nint AsFbxExportSingleFrame(nint context, nint parentNode, string framePath, string frameName, in Vector3 localPosition, in Vector3 localRotation, in Vector3 localScale)
private static IntPtr AsFbxExportSingleFrame(IntPtr context, IntPtr parentNode, string framePath, string frameName, in Vector3 localPosition, in Vector3 localRotation, in Vector3 localScale)
{
return AsFbxExportSingleFrame(context, parentNode, framePath, frameName, localPosition.X, localPosition.Y, localPosition.Z, localRotation.X, localRotation.Y, localRotation.Z, localScale.X, localScale.Y, localScale.Z);
}
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
private static partial nint AsFbxExportSingleFrame(nint context, nint parentNode, string strFramePath, string strFrameName, float localPositionX, float localPositionY, float localPositionZ, float localRotationX, float localRotationY, float localRotationZ, float localScaleX, float localScaleY, float localScaleZ);
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxExportSingleFrame(IntPtr context, IntPtr parentNode, [MarshalAs(UnmanagedType.LPUTF8Str)] string strFramePath, [MarshalAs(UnmanagedType.LPUTF8Str)] string strFrameName, float localPositionX, float localPositionY, float localPositionZ, float localRotationX, float localRotationY, float localRotationZ, float localScaleX, float localScaleY, float localScaleZ);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxSetJointsNode_CastToBone(nint context, nint node, float boneSize);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxSetJointsNode_CastToBone(IntPtr context, IntPtr node, float boneSize);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxSetJointsNode_BoneInPath(nint context, nint node, float boneSize);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxSetJointsNode_BoneInPath(IntPtr context, IntPtr node, float boneSize);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxSetJointsNode_Generic(nint context, nint node);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxSetJointsNode_Generic(IntPtr context, IntPtr node);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxPrepareMaterials(nint context, int materialCount, int textureCount);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxPrepareMaterials(IntPtr context, int materialCount, int textureCount);
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
private static partial nint AsFbxCreateTexture(nint context, string matTexName);
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxCreateTexture(IntPtr context, [MarshalAs(UnmanagedType.LPUTF8Str)] string matTexName);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxLinkTexture(int dest, nint texture, nint material, float offsetX, float offsetY, float scaleX, float scaleY);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxLinkTexture(int dest, IntPtr texture, IntPtr material, float offsetX, float offsetY, float scaleX, float scaleY);
[LibraryImport(FbxDll.DllName)]
private static partial nint AsFbxMeshCreateClusterArray(int boneCount);
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxMeshCreateClusterArray(int boneCount);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshDisposeClusterArray(ref nint ppArray);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshDisposeClusterArray(ref IntPtr ppArray);
[LibraryImport(FbxDll.DllName)]
private static partial nint AsFbxMeshCreateCluster(nint context, nint boneNode);
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxMeshCreateCluster(IntPtr context, IntPtr boneNode);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshAddCluster(nint array, nint cluster);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshAddCluster(IntPtr array, IntPtr cluster);
[LibraryImport(FbxDll.DllName)]
private static partial nint AsFbxMeshCreateMesh(nint context, nint frameNode);
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxMeshCreateMesh(IntPtr context, IntPtr frameNode);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshInitControlPoints(nint mesh, int vertexCount);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshInitControlPoints(IntPtr mesh, int vertexCount);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshCreateElementNormal(nint mesh);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshCreateElementNormal(IntPtr mesh);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshCreateDiffuseUV(nint mesh, int uv);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshCreateDiffuseUV(IntPtr mesh, int uv);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshCreateNormalMapUV(nint mesh, int uv);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshCreateNormalMapUV(IntPtr mesh, int uv);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshCreateElementTangent(nint mesh);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshCreateElementTangent(IntPtr mesh);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshCreateElementVertexColor(nint mesh);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshCreateElementVertexColor(IntPtr mesh);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshCreateElementMaterial(nint mesh);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshCreateElementMaterial(IntPtr mesh);
private static nint AsFbxCreateMaterial(nint pContext, string matName, in Color diffuse, in Color ambient, in Color emissive, in Color specular, in Color reflection, float shininess, float transparency)
private static IntPtr AsFbxCreateMaterial(IntPtr pContext, string matName, in Color diffuse, in Color ambient, in Color emissive, in Color specular, in Color reflection, float shininess, float transparency)
{
return AsFbxCreateMaterial(pContext, matName, diffuse.R, diffuse.G, diffuse.B, ambient.R, ambient.G, ambient.B, emissive.R, emissive.G, emissive.B, specular.R, specular.G, specular.B, reflection.R, reflection.G, reflection.B, shininess, transparency);
}
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
private static partial nint AsFbxCreateMaterial(nint pContext, string pMatName,
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxCreateMaterial(IntPtr pContext, [MarshalAs(UnmanagedType.LPUTF8Str)] string pMatName,
float diffuseR, float diffuseG, float diffuseB,
float ambientR, float ambientG, float ambientB,
float emissiveR, float emissiveG, float emissiveB,
@@ -102,121 +103,121 @@ namespace AssetStudio.FbxInterop
float reflectR, float reflectG, float reflectB,
float shininess, float transparency);
[LibraryImport(FbxDll.DllName)]
private static partial int AsFbxAddMaterialToFrame(nint frameNode, nint material);
[DllImport(FbxDll.DllName)]
private static extern int AsFbxAddMaterialToFrame(IntPtr frameNode, IntPtr material);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxSetFrameShadingModeToTextureShading(nint frameNode);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxSetFrameShadingModeToTextureShading(IntPtr frameNode);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshSetControlPoint(nint mesh, int index, float x, float y, float z);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshSetControlPoint(IntPtr mesh, int index, float x, float y, float z);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshAddPolygon(nint mesh, int materialIndex, int index0, int index1, int index2);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshAddPolygon(IntPtr mesh, int materialIndex, int index0, int index1, int index2);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshElementNormalAdd(nint mesh, int elementIndex, float x, float y, float z);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshElementNormalAdd(IntPtr mesh, int elementIndex, float x, float y, float z);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshElementUVAdd(nint mesh, int elementIndex, float u, float v);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshElementUVAdd(IntPtr mesh, int elementIndex, float u, float v);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshElementTangentAdd(nint mesh, int elementIndex, float x, float y, float z, float w);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshElementTangentAdd(IntPtr mesh, int elementIndex, float x, float y, float z, float w);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshElementVertexColorAdd(nint mesh, int elementIndex, float r, float g, float b, float a);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshElementVertexColorAdd(IntPtr mesh, int elementIndex, float r, float g, float b, float a);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshSetBoneWeight(nint pClusterArray, int boneIndex, int vertexIndex, float weight);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshSetBoneWeight(IntPtr pClusterArray, int boneIndex, int vertexIndex, float weight);
[LibraryImport(FbxDll.DllName)]
private static partial nint AsFbxMeshCreateSkinContext(nint context, nint frameNode);
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxMeshCreateSkinContext(IntPtr context, IntPtr frameNode);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshDisposeSkinContext(ref nint ppSkinContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshDisposeSkinContext(ref IntPtr ppSkinContext);
[LibraryImport(FbxDll.DllName)]
[DllImport(FbxDll.DllName)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool FbxClusterArray_HasItemAt(nint pClusterArray, int index);
private static extern bool FbxClusterArray_HasItemAt(IntPtr pClusterArray, int index);
[LibraryImport(FbxDll.DllName)]
private static unsafe partial void AsFbxMeshSkinAddCluster(nint pSkinContext, nint pClusterArray, int index, float* pBoneMatrix);
[DllImport(FbxDll.DllName)]
private static unsafe extern void AsFbxMeshSkinAddCluster(IntPtr pSkinContext, IntPtr pClusterArray, int index, float* pBoneMatrix);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMeshAddDeformer(nint pSkinContext, nint pMesh);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMeshAddDeformer(IntPtr pSkinContext, IntPtr pMesh);
[LibraryImport(FbxDll.DllName)]
private static partial nint AsFbxAnimCreateContext([MarshalAs(UnmanagedType.Bool)] bool eulerFilter);
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxAnimCreateContext([MarshalAs(UnmanagedType.Bool)] bool eulerFilter);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimDisposeContext(ref nint ppAnimContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimDisposeContext(ref IntPtr ppAnimContext);
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
private static partial void AsFbxAnimPrepareStackAndLayer(nint pContext, nint pAnimContext, string takeName);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimPrepareStackAndLayer(IntPtr pContext, IntPtr pAnimContext, [MarshalAs(UnmanagedType.LPUTF8Str)] string takeName);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimLoadCurves(nint pNode, nint pAnimContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimLoadCurves(IntPtr pNode, IntPtr pAnimContext);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimBeginKeyModify(nint pAnimContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimBeginKeyModify(IntPtr pAnimContext);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimEndKeyModify(nint pAnimContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimEndKeyModify(IntPtr pAnimContext);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimAddScalingKey(nint pAnimContext, float time, float x, float y, float z);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimAddScalingKey(IntPtr pAnimContext, float time, float x, float y, float z);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimAddRotationKey(nint pAnimContext, float time, float x, float y, float z);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimAddRotationKey(IntPtr pAnimContext, float time, float x, float y, float z);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimAddTranslationKey(nint pAnimContext, float time, float x, float y, float z);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimAddTranslationKey(IntPtr pAnimContext, float time, float x, float y, float z);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimApplyEulerFilter(nint pAnimContext, float filterPrecision);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimApplyEulerFilter(IntPtr pAnimContext, float filterPrecision);
[LibraryImport(FbxDll.DllName)]
private static partial int AsFbxAnimGetCurrentBlendShapeChannelCount(nint pAnimContext, nint pNode);
[DllImport(FbxDll.DllName)]
private static extern int AsFbxAnimGetCurrentBlendShapeChannelCount(IntPtr pAnimContext, IntPtr pNode);
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
[DllImport(FbxDll.DllName)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool AsFbxAnimIsBlendShapeChannelMatch(nint pAnimContext, int channelIndex, string channelName);
private static extern bool AsFbxAnimIsBlendShapeChannelMatch(IntPtr pAnimContext, int channelIndex, [MarshalAs(UnmanagedType.LPUTF8Str)] string channelName);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimBeginBlendShapeAnimCurve(nint pAnimContext, int channelIndex);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimBeginBlendShapeAnimCurve(IntPtr pAnimContext, int channelIndex);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimEndBlendShapeAnimCurve(nint pAnimContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimEndBlendShapeAnimCurve(IntPtr pAnimContext);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxAnimAddBlendShapeKeyframe(nint pAnimContext, float time, float value);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxAnimAddBlendShapeKeyframe(IntPtr pAnimContext, float time, float value);
[LibraryImport(FbxDll.DllName)]
private static partial nint AsFbxMorphCreateContext();
[DllImport(FbxDll.DllName)]
private static extern IntPtr AsFbxMorphCreateContext();
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMorphInitializeContext(nint pContext, nint pMorphContext, nint pNode);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMorphInitializeContext(IntPtr pContext, IntPtr pMorphContext, IntPtr pNode);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMorphDisposeContext(ref nint ppMorphContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMorphDisposeContext(ref IntPtr ppMorphContext);
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
private static partial void AsFbxMorphAddBlendShapeChannel(nint pContext, nint pMorphContext, string channelName);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMorphAddBlendShapeChannel(IntPtr pContext, IntPtr pMorphContext, [MarshalAs(UnmanagedType.LPUTF8Str)] string channelName);
[LibraryImport(FbxDll.DllName, StringMarshalling = StringMarshalling.Utf8)]
private static partial void AsFbxMorphAddBlendShapeChannelShape(nint pContext, nint pMorphContext, float weight, string shapeName);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMorphAddBlendShapeChannelShape(IntPtr pContext, IntPtr pMorphContext, float weight, [MarshalAs(UnmanagedType.LPUTF8Str)] string shapeName);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMorphCopyBlendShapeControlPoints(nint pMorphContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMorphCopyBlendShapeControlPoints(IntPtr pMorphContext);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMorphSetBlendShapeVertex(nint pMorphContext, uint index, float x, float y, float z);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMorphSetBlendShapeVertex(IntPtr pMorphContext, uint index, float x, float y, float z);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMorphCopyBlendShapeControlPointsNormal(nint pMorphContext);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMorphCopyBlendShapeControlPointsNormal(IntPtr pMorphContext);
[LibraryImport(FbxDll.DllName)]
private static partial void AsFbxMorphSetBlendShapeVertexNormal(nint pMorphContext, uint index, float x, float y, float z);
[DllImport(FbxDll.DllName)]
private static extern void AsFbxMorphSetBlendShapeVertexNormal(IntPtr pMorphContext, uint index, float x, float y, float z);
}
}

View File

@@ -9,17 +9,17 @@ namespace AssetStudio.FbxInterop
internal sealed partial class FbxExporterContext : IDisposable
{
private nint _pContext;
private readonly Dictionary<ImportedFrame, nint> _frameToNode;
private readonly List<KeyValuePair<string, nint>> _createdMaterials;
private readonly Dictionary<string, nint> _createdTextures;
private IntPtr _pContext;
private readonly Dictionary<ImportedFrame, IntPtr> _frameToNode;
private readonly List<KeyValuePair<string, IntPtr>> _createdMaterials;
private readonly Dictionary<string, IntPtr> _createdTextures;
public FbxExporterContext()
{
_pContext = AsFbxCreateContext();
_frameToNode = new Dictionary<ImportedFrame, nint>();
_createdMaterials = new List<KeyValuePair<string, nint>>();
_createdTextures = new Dictionary<string, nint>();
_frameToNode = new Dictionary<ImportedFrame, IntPtr>();
_createdMaterials = new List<KeyValuePair<string, IntPtr>>();
_createdTextures = new Dictionary<string, IntPtr>();
}
~FbxExporterContext()
@@ -98,9 +98,9 @@ namespace AssetStudio.FbxInterop
{
var rootNode = AsFbxGetSceneRootNode(_pContext);
Debug.Assert(rootNode != nint.Zero);
Debug.Assert(rootNode != IntPtr.Zero);
var nodeStack = new Stack<nint>();
var nodeStack = new Stack<IntPtr>();
var frameStack = new Stack<ImportedFrame>();
nodeStack.Push(rootNode);
@@ -140,7 +140,7 @@ namespace AssetStudio.FbxInterop
if (_frameToNode.TryGetValue(frame, out var node))
{
Debug.Assert(node != nint.Zero);
Debug.Assert(node != IntPtr.Zero);
if (castToBone)
{
@@ -181,11 +181,11 @@ namespace AssetStudio.FbxInterop
ExportMesh(rootFrame, materialList, textureList, meshNode, mesh, exportSkins, exportAllUvsAsDiffuseMaps);
}
private nint ExportTexture(ImportedTexture texture)
private IntPtr ExportTexture(ImportedTexture texture)
{
if (texture == null)
{
return nint.Zero;
return IntPtr.Zero;
}
if (_createdTextures.ContainsKey(texture.Name))
@@ -207,7 +207,7 @@ namespace AssetStudio.FbxInterop
return pTex;
}
private void ExportMesh(ImportedFrame rootFrame, List<ImportedMaterial> materialList, List<ImportedTexture> textureList, nint frameNode, ImportedMesh importedMesh, bool exportSkins, bool exportAllUvsAsDiffuseMaps)
private void ExportMesh(ImportedFrame rootFrame, List<ImportedMaterial> materialList, List<ImportedTexture> textureList, IntPtr frameNode, ImportedMesh importedMesh, bool exportSkins, bool exportAllUvsAsDiffuseMaps)
{
var boneList = importedMesh.BoneList;
var totalBoneCount = 0;
@@ -218,7 +218,7 @@ namespace AssetStudio.FbxInterop
hasBones = true;
}
var pClusterArray = nint.Zero;
var pClusterArray = IntPtr.Zero;
try
{
@@ -239,7 +239,7 @@ namespace AssetStudio.FbxInterop
}
else
{
AsFbxMeshAddCluster(pClusterArray, nint.Zero);
AsFbxMeshAddCluster(pClusterArray, IntPtr.Zero);
}
}
}
@@ -287,7 +287,7 @@ namespace AssetStudio.FbxInterop
if (mat != null)
{
var foundMat = _createdMaterials.FindIndex(kv => kv.Key == mat.Name);
nint pMat;
IntPtr pMat;
if (foundMat >= 0)
{
@@ -303,7 +303,7 @@ namespace AssetStudio.FbxInterop
pMat = AsFbxCreateMaterial(_pContext, mat.Name, in diffuse, in ambient, in emissive, in specular, in reflection, mat.Shininess, mat.Transparency);
_createdMaterials.Add(new KeyValuePair<string, nint>(mat.Name, pMat));
_createdMaterials.Add(new KeyValuePair<string, IntPtr>(mat.Name, pMat));
}
materialIndex = AsFbxAddMaterialToFrame(frameNode, pMat);
@@ -315,7 +315,7 @@ namespace AssetStudio.FbxInterop
var tex = ImportedHelpers.FindTexture(texture.Name, textureList);
var pTexture = ExportTexture(tex);
if (pTexture != nint.Zero)
if (pTexture != IntPtr.Zero)
{
switch (texture.Dest)
{
@@ -406,7 +406,7 @@ namespace AssetStudio.FbxInterop
if (hasBones)
{
nint pSkinContext = nint.Zero;
IntPtr pSkinContext = IntPtr.Zero;
try
{
@@ -471,7 +471,7 @@ namespace AssetStudio.FbxInterop
return;
}
var pAnimContext = nint.Zero;
var pAnimContext = IntPtr.Zero;
try
{
@@ -502,7 +502,7 @@ namespace AssetStudio.FbxInterop
}
}
private void ExportKeyframedAnimation(ImportedFrame rootFrame, ImportedKeyframedAnimation parser, nint pAnimContext, float filterPrecision)
private void ExportKeyframedAnimation(ImportedFrame rootFrame, ImportedKeyframedAnimation parser, IntPtr pAnimContext, float filterPrecision)
{
foreach (var track in parser.TrackList)
{
@@ -593,7 +593,7 @@ namespace AssetStudio.FbxInterop
var pNode = _frameToNode[frame];
var pMorphContext = nint.Zero;
var pMorphContext = IntPtr.Zero;
try
{

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFrameworks>net7.0-windows;net6.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>Resources\as.ico</ApplicationIcon>
<Version>0.80.30</Version>

View File

@@ -1045,8 +1045,8 @@ namespace AssetStudioGUI
Marshal.Copy(m_Font.m_FontData, 0, data, m_Font.m_FontData.Length);
uint cFonts = 0;
var re = FontHelper.AddFontMemResourceEx(data, (uint)m_Font.m_FontData.Length, nint.Zero, ref cFonts);
if (re != nint.Zero)
var re = FontHelper.AddFontMemResourceEx(data, (uint)m_Font.m_FontData.Length, IntPtr.Zero, ref cFonts);
if (re != IntPtr.Zero)
{
using (var pfc = new PrivateFontCollection())
{
@@ -2048,7 +2048,7 @@ namespace AssetStudioGUI
Application.Exit();
}
result = system.init(2, FMOD.INITFLAGS.NORMAL, nint.Zero);
result = system.init(2, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
if (ERRCHECK(result)) { return; }
result = system.getMasterSoundGroup(out masterSoundGroup);

View File

@@ -34,7 +34,7 @@ namespace AssetStudioGUI
if (!string.IsNullOrEmpty(InitialFolder))
{
var riid = new Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"); //IShellItem
if (NativeMethods.SHCreateItemFromParsingName(InitialFolder, nint.Zero, ref riid, out var directoryShellItem) == NativeMethods.S_OK)
if (NativeMethods.SHCreateItemFromParsingName(InitialFolder, IntPtr.Zero, ref riid, out var directoryShellItem) == NativeMethods.S_OK)
{
frm.SetFolder(directoryShellItem);
}
@@ -42,7 +42,7 @@ namespace AssetStudioGUI
if (!string.IsNullOrEmpty(DefaultFolder))
{
var riid = new Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"); //IShellItem
if (NativeMethods.SHCreateItemFromParsingName(DefaultFolder, nint.Zero, ref riid, out var directoryShellItem) == NativeMethods.S_OK)
if (NativeMethods.SHCreateItemFromParsingName(DefaultFolder, IntPtr.Zero, ref riid, out var directoryShellItem) == NativeMethods.S_OK)
{
frm.SetDefaultFolder(directoryShellItem);
}
@@ -54,7 +54,7 @@ namespace AssetStudioGUI
{
if (shellItem.GetDisplayName(NativeMethods.SIGDN_FILESYSPATH, out var pszString) == NativeMethods.S_OK)
{
if (pszString != nint.Zero)
if (pszString != IntPtr.Zero)
{
try
{
@@ -127,11 +127,11 @@ namespace AssetStudioGUI
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
[PreserveSig()]
uint Show([In, Optional] nint hwndOwner); //IModalWindow
uint Show([In, Optional] IntPtr hwndOwner); //IModalWindow
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFileTypes([In] uint cFileTypes, [In, MarshalAs(UnmanagedType.LPArray)] nint rgFilterSpec);
uint SetFileTypes([In] uint cFileTypes, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr rgFilterSpec);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFileTypeIndex([In] uint iFileType);
@@ -140,7 +140,7 @@ namespace AssetStudioGUI
uint GetFileTypeIndex(out uint piFileType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint Advise([In, MarshalAs(UnmanagedType.Interface)] nint pfde, out uint pdwCookie);
uint Advise([In, MarshalAs(UnmanagedType.Interface)] IntPtr pfde, out uint pdwCookie);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint Unadvise([In] uint dwCookie);
@@ -197,7 +197,7 @@ namespace AssetStudioGUI
uint ClearClientData();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFilter([MarshalAs(UnmanagedType.Interface)] nint pFilter);
uint SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
}
@@ -205,13 +205,13 @@ namespace AssetStudioGUI
internal interface IShellItem
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint BindToHandler([In] nint pbc, [In] ref Guid rbhid, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out nint ppvOut);
uint BindToHandler([In] IntPtr pbc, [In] ref Guid rbhid, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IntPtr ppvOut);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetDisplayName([In] uint sigdnName, out nint ppszName);
uint GetDisplayName([In] uint sigdnName, out IntPtr ppszName);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs);
@@ -224,6 +224,6 @@ namespace AssetStudioGUI
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string pszPath, nint pbc, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
internal static extern int SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IntPtr pbc, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
}
}

View File

@@ -4,7 +4,7 @@ using AssetStudio.PInvoke;
namespace ACLLibs
{
public static partial class ACL
public static class ACL
{
private const string DLL_NAME = "acl";
static ACL()
@@ -27,8 +27,8 @@ namespace ACLLibs
#region importfunctions
[LibraryImport(DLL_NAME)]
private static partial void DecompressAll(IntPtr data, out IntPtr pValues, out int numValues, out IntPtr pTimes, out int numTimes);
[DllImport(DLL_NAME)]
private static extern void DecompressAll(IntPtr data, out IntPtr pValues, out int numValues, out IntPtr pTimes, out int numTimes);
#endregion
}
@@ -56,8 +56,8 @@ namespace ACLLibs
#region importfunctions
[LibraryImport(DLL_NAME)]
private static partial void DecompressAll(IntPtr data, out IntPtr pValues, out int numValues, out IntPtr pTimes, out int numTimes);
[DllImport(DLL_NAME)]
private static extern void DecompressAll(IntPtr data, out IntPtr pValues, out int numValues, out IntPtr pTimes, out int numTimes);
#endregion
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<Version>0.80.30</Version>
<AssemblyVersion>0.80.30</AssemblyVersion>
<FileVersion>0.80.30</FileVersion>

View File

@@ -23,7 +23,7 @@ namespace AssetStudio
var result = Factory.System_Create(out var system);
if (result != RESULT.OK)
return null;
result = system.init(1, INITFLAGS.NORMAL, nint.Zero);
result = system.init(1, INITFLAGS.NORMAL, IntPtr.Zero);
if (result != RESULT.OK)
return null;
exinfo.cbsize = Marshal.SizeOf(exinfo);

View File

@@ -1,23 +1,24 @@
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
namespace AssetStudio
{
public static partial class ConsoleHelper
public static class ConsoleHelper
{
[LibraryImport("kernel32.dll", SetLastError = true)]
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool AllocConsole();
public static extern bool AllocConsole();
[LibraryImport("kernel32.dll", EntryPoint = "SetConsoleTitleA", SetLastError = true, StringMarshalling = StringMarshalling.Utf8)]
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool SetConsoleTitle(string lpConsoleTitle);
public static extern bool SetConsoleTitle([MarshalAs(UnmanagedType.LPUTF8Str)] string lpConsoleTitle);
[LibraryImport("kernel32.dll", SetLastError = true)]
public static partial nint GetConsoleWindow();
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetConsoleWindow();
[LibraryImport("user32.dll", SetLastError = true)]
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool ShowWindow(nint hWnd, int nCmdShow);
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public const int SW_HIDE = 0;
public const int SW_SHOW = 5;

View File

@@ -1,10 +1,11 @@
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
namespace AssetStudio
{
public static partial class FontHelper
public static class FontHelper
{
[LibraryImport("gdi32.dll")]
public static partial nint AddFontMemResourceEx(nint pbFont, uint cbFont, nint pdv, ref uint pcFonts);
[DllImport("gdi32.dll")]
public static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, ref uint pcFonts);
}
}

View File

@@ -8,8 +8,6 @@ cache:
environment:
FBX_SDK: https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-3-2/fbx202032_fbxsdk_vs2019_win.exe
File_NAME: Studio
File_Format: zip
install:
- pwsh: appveyor DownloadFile $env:FBX_SDK && Start (Get-ChildItem ./'fbx*'.exe -Name) /S -Wait
@@ -18,11 +16,7 @@ build_script:
- msbuild -m -t:AssetStudioGUI:publish -t:AssetStudioCLI:publish -r -p:Configuration=Release -v:minimal AssetStudio.sln
after_build:
- ps: $env:TIME_STRING=(Get-Date -UFormat "%Y%m%d%H%M%S%a").ToString()
- 7z a -y -mx9 %File_NAME%-%TIME_STRING%.%File_Format% %APPVEYOR_BUILD_FOLDER%\AssetStudioGUI\bin\Release\net7.0-windows\publish\
- appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\%File_NAME%-%TIME_STRING%.%File_Format%
# artifacts:
# - path: AssetStudioGUI\bin\Release\net6.0-windows\publish\
# name: "%File_NAME%-%TIME_STRING%.%File_Format%"
# type: zip
- 7z a -y -mx9 net6.0-windows.zip %APPVEYOR_BUILD_FOLDER%\AssetStudioGUI\bin\Release\net6.0-windows\publish\
- appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\net6.0-windows.zip
- 7z a -y -mx9 net7.0-windows.zip %APPVEYOR_BUILD_FOLDER%\AssetStudioGUI\bin\Release\net7.0-windows\publish\
- appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\net7.0-windows.zip