diff --git a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs index af709cf31..94c786699 100644 --- a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs @@ -463,7 +463,7 @@ public unsafe interface IClientLibrary public delegate* unmanaged[Cdecl] LocalObject_AttachToEntity_ScriptId { get; } public delegate* unmanaged[Cdecl] LocalObject_Detach { get; } public delegate* unmanaged[Cdecl] LocalObject_GetComponentTintIndex { get; } - public delegate* unmanaged[Cdecl] LocalObject_GetID { get; } + public delegate* unmanaged[Cdecl] LocalObject_GetID { get; } public delegate* unmanaged[Cdecl] LocalObject_GetObject { get; } public delegate* unmanaged[Cdecl] LocalObject_GetStreamingDistance { get; } public delegate* unmanaged[Cdecl] LocalObject_GetTintIndex { get; } @@ -1340,7 +1340,7 @@ public unsafe class ClientLibrary : IClientLibrary public delegate* unmanaged[Cdecl] LocalObject_AttachToEntity_ScriptId { get; } public delegate* unmanaged[Cdecl] LocalObject_Detach { get; } public delegate* unmanaged[Cdecl] LocalObject_GetComponentTintIndex { get; } - public delegate* unmanaged[Cdecl] LocalObject_GetID { get; } + public delegate* unmanaged[Cdecl] LocalObject_GetID { get; } public delegate* unmanaged[Cdecl] LocalObject_GetObject { get; } public delegate* unmanaged[Cdecl] LocalObject_GetStreamingDistance { get; } public delegate* unmanaged[Cdecl] LocalObject_GetTintIndex { get; } @@ -2665,8 +2665,8 @@ public unsafe class ClientLibrary : IClientLibrary private static void LocalObject_DetachFallback(nint _localObject, byte _dynamic) => throw new Exceptions.OutdatedSdkException("LocalObject_Detach", "LocalObject_Detach SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate int LocalObject_GetComponentTintIndexDelegate(nint _localObject, int _componentType); private static int LocalObject_GetComponentTintIndexFallback(nint _localObject, int _componentType) => throw new Exceptions.OutdatedSdkException("LocalObject_GetComponentTintIndex", "LocalObject_GetComponentTintIndex SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort LocalObject_GetIDDelegate(nint _localObject); - private static ushort LocalObject_GetIDFallback(nint _localObject) => throw new Exceptions.OutdatedSdkException("LocalObject_GetID", "LocalObject_GetID SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint LocalObject_GetIDDelegate(nint _localObject); + private static uint LocalObject_GetIDFallback(nint _localObject) => throw new Exceptions.OutdatedSdkException("LocalObject_GetID", "LocalObject_GetID SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint LocalObject_GetObjectDelegate(nint _localObject); private static nint LocalObject_GetObjectFallback(nint _localObject) => throw new Exceptions.OutdatedSdkException("LocalObject_GetObject", "LocalObject_GetObject SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint LocalObject_GetStreamingDistanceDelegate(nint _localObject); @@ -3512,7 +3512,7 @@ private IntPtr GetUnmanagedPtr(IDictionary funcTable, ulong ha public ClientLibrary(Dictionary funcTable) { if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true; - else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 14520310097856707558UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 4677548953854785821UL) Outdated = true; Audio_AddOutput = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 9914412815391408844UL, Audio_AddOutputFallback); Audio_GetBaseObject = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6330360502401226894UL, Audio_GetBaseObjectFallback); Audio_GetCurrentTime = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2944324482134975819UL, Audio_GetCurrentTimeFallback); @@ -3966,7 +3966,7 @@ public ClientLibrary(Dictionary funcTable) LocalObject_AttachToEntity_ScriptId = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8482470825689546294UL, LocalObject_AttachToEntity_ScriptIdFallback); LocalObject_Detach = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6719251755255314299UL, LocalObject_DetachFallback); LocalObject_GetComponentTintIndex = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15889022995396061331UL, LocalObject_GetComponentTintIndexFallback); - LocalObject_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 11677534497960574507UL, LocalObject_GetIDFallback); + LocalObject_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15103894139399401453UL, LocalObject_GetIDFallback); LocalObject_GetObject = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 872653086987800810UL, LocalObject_GetObjectFallback); LocalObject_GetStreamingDistance = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12256606847122365951UL, LocalObject_GetStreamingDistanceFallback); LocalObject_GetTintIndex = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 9339331434227951252UL, LocalObject_GetTintIndexFallback); diff --git a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs index 8e8e23e39..8962e612c 100644 --- a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs @@ -64,13 +64,13 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] Core_DestroyColShape { get; } public delegate* unmanaged[Cdecl] Core_DestroyVehicle { get; } public delegate* unmanaged[Cdecl] Core_DestroyVoiceChannel { get; } - public delegate* unmanaged[Cdecl] Core_GetClosestEntities { get; } + public delegate* unmanaged[Cdecl] Core_GetClosestEntities { get; } public delegate* unmanaged[Cdecl] Core_GetClosestEntitiesCount { get; } public delegate* unmanaged[Cdecl] Core_GetColShapeTickRate { get; } public delegate* unmanaged[Cdecl] Core_GetConnectionInfos { get; } - public delegate* unmanaged[Cdecl] Core_GetEntitiesInDimension { get; } + public delegate* unmanaged[Cdecl] Core_GetEntitiesInDimension { get; } public delegate* unmanaged[Cdecl] Core_GetEntitiesInDimensionCount { get; } - public delegate* unmanaged[Cdecl] Core_GetEntitiesInRange { get; } + public delegate* unmanaged[Cdecl] Core_GetEntitiesInRange { get; } public delegate* unmanaged[Cdecl] Core_GetEntitiesInRangeCount { get; } public delegate* unmanaged[Cdecl] Core_GetLoadedVehicleModels { get; } public delegate* unmanaged[Cdecl] Core_GetMaxStreamingObjects { get; } @@ -283,7 +283,7 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] Vehicle_GetDirtLevel { get; } public delegate* unmanaged[Cdecl] Vehicle_GetDoorState { get; } public delegate* unmanaged[Cdecl] Vehicle_GetDriver { get; } - public delegate* unmanaged[Cdecl] Vehicle_GetDriverID { get; } + public delegate* unmanaged[Cdecl] Vehicle_GetDriverID { get; } public delegate* unmanaged[Cdecl] Vehicle_GetEngineHealth { get; } public delegate* unmanaged[Cdecl] Vehicle_GetGameStateBase64 { get; } public delegate* unmanaged[Cdecl] Vehicle_GetHeadlightColor { get; } @@ -534,13 +534,13 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] Core_DestroyColShape { get; } public delegate* unmanaged[Cdecl] Core_DestroyVehicle { get; } public delegate* unmanaged[Cdecl] Core_DestroyVoiceChannel { get; } - public delegate* unmanaged[Cdecl] Core_GetClosestEntities { get; } + public delegate* unmanaged[Cdecl] Core_GetClosestEntities { get; } public delegate* unmanaged[Cdecl] Core_GetClosestEntitiesCount { get; } public delegate* unmanaged[Cdecl] Core_GetColShapeTickRate { get; } public delegate* unmanaged[Cdecl] Core_GetConnectionInfos { get; } - public delegate* unmanaged[Cdecl] Core_GetEntitiesInDimension { get; } + public delegate* unmanaged[Cdecl] Core_GetEntitiesInDimension { get; } public delegate* unmanaged[Cdecl] Core_GetEntitiesInDimensionCount { get; } - public delegate* unmanaged[Cdecl] Core_GetEntitiesInRange { get; } + public delegate* unmanaged[Cdecl] Core_GetEntitiesInRange { get; } public delegate* unmanaged[Cdecl] Core_GetEntitiesInRangeCount { get; } public delegate* unmanaged[Cdecl] Core_GetLoadedVehicleModels { get; } public delegate* unmanaged[Cdecl] Core_GetMaxStreamingObjects { get; } @@ -753,7 +753,7 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] Vehicle_GetDirtLevel { get; } public delegate* unmanaged[Cdecl] Vehicle_GetDoorState { get; } public delegate* unmanaged[Cdecl] Vehicle_GetDriver { get; } - public delegate* unmanaged[Cdecl] Vehicle_GetDriverID { get; } + public delegate* unmanaged[Cdecl] Vehicle_GetDriverID { get; } public delegate* unmanaged[Cdecl] Vehicle_GetEngineHealth { get; } public delegate* unmanaged[Cdecl] Vehicle_GetGameStateBase64 { get; } public delegate* unmanaged[Cdecl] Vehicle_GetHeadlightColor { get; } @@ -1053,20 +1053,20 @@ public unsafe class ServerLibrary : IServerLibrary private static void Core_DestroyVehicleFallback(nint _core, nint _baseObject) => throw new Exceptions.OutdatedSdkException("Core_DestroyVehicle", "Core_DestroyVehicle SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_DestroyVoiceChannelDelegate(nint _core, nint _baseObject); private static void Core_DestroyVoiceChannelFallback(nint _core, nint _baseObject) => throw new Exceptions.OutdatedSdkException("Core_DestroyVoiceChannel", "Core_DestroyVoiceChannel SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetClosestEntitiesDelegate(nint _core, Vector3 _position, int _range, int _dimension, int _limit, ulong _allowedTypes, nint[] entities, byte[] types, ulong _size); - private static void Core_GetClosestEntitiesFallback(nint _core, Vector3 _position, int _range, int _dimension, int _limit, ulong _allowedTypes, nint[] entities, byte[] types, ulong _size) => throw new Exceptions.OutdatedSdkException("Core_GetClosestEntities", "Core_GetClosestEntities SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetClosestEntitiesDelegate(nint _core, Vector3 _position, int _range, int _dimension, int _limit, ulong _allowedTypes, nint* _entities, byte[] types, ulong _size); + private static void Core_GetClosestEntitiesFallback(nint _core, Vector3 _position, int _range, int _dimension, int _limit, ulong _allowedTypes, nint* _entities, byte[] types, ulong _size) => throw new Exceptions.OutdatedSdkException("Core_GetClosestEntities", "Core_GetClosestEntities SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Core_GetClosestEntitiesCountDelegate(nint _core, Vector3 _position, int _range, int _dimension, int _limit, ulong _allowedTypes); private static ulong Core_GetClosestEntitiesCountFallback(nint _core, Vector3 _position, int _range, int _dimension, int _limit, ulong _allowedTypes) => throw new Exceptions.OutdatedSdkException("Core_GetClosestEntitiesCount", "Core_GetClosestEntitiesCount SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint Core_GetColShapeTickRateDelegate(nint _core); private static uint Core_GetColShapeTickRateFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_GetColShapeTickRate", "Core_GetColShapeTickRate SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetConnectionInfosDelegate(nint _core, ulong* _size); private static nint Core_GetConnectionInfosFallback(nint _core, ulong* _size) => throw new Exceptions.OutdatedSdkException("Core_GetConnectionInfos", "Core_GetConnectionInfos SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetEntitiesInDimensionDelegate(nint _core, int _dimension, ulong _allowedTypes, nint[] entities, byte[] types, ulong _size); - private static void Core_GetEntitiesInDimensionFallback(nint _core, int _dimension, ulong _allowedTypes, nint[] entities, byte[] types, ulong _size) => throw new Exceptions.OutdatedSdkException("Core_GetEntitiesInDimension", "Core_GetEntitiesInDimension SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetEntitiesInDimensionDelegate(nint _core, int _dimension, ulong _allowedTypes, nint* _entities, byte[] types, ulong _size); + private static void Core_GetEntitiesInDimensionFallback(nint _core, int _dimension, ulong _allowedTypes, nint* _entities, byte[] types, ulong _size) => throw new Exceptions.OutdatedSdkException("Core_GetEntitiesInDimension", "Core_GetEntitiesInDimension SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Core_GetEntitiesInDimensionCountDelegate(nint _core, int _dimension, ulong _allowedTypes); private static ulong Core_GetEntitiesInDimensionCountFallback(nint _core, int _dimension, ulong _allowedTypes) => throw new Exceptions.OutdatedSdkException("Core_GetEntitiesInDimensionCount", "Core_GetEntitiesInDimensionCount SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetEntitiesInRangeDelegate(nint _core, Vector3 _position, int _range, int _dimension, ulong _allowedTypes, nint[] entities, byte[] types, ulong _size); - private static void Core_GetEntitiesInRangeFallback(nint _core, Vector3 _position, int _range, int _dimension, ulong _allowedTypes, nint[] entities, byte[] types, ulong _size) => throw new Exceptions.OutdatedSdkException("Core_GetEntitiesInRange", "Core_GetEntitiesInRange SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetEntitiesInRangeDelegate(nint _core, Vector3 _position, int _range, int _dimension, ulong _allowedTypes, nint* _entities, byte[] types, ulong _size); + private static void Core_GetEntitiesInRangeFallback(nint _core, Vector3 _position, int _range, int _dimension, ulong _allowedTypes, nint* _entities, byte[] types, ulong _size) => throw new Exceptions.OutdatedSdkException("Core_GetEntitiesInRange", "Core_GetEntitiesInRange SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Core_GetEntitiesInRangeCountDelegate(nint _core, Vector3 _position, int _range, int _dimension, ulong _allowedTypes); private static ulong Core_GetEntitiesInRangeCountFallback(nint _core, Vector3 _position, int _range, int _dimension, ulong _allowedTypes) => throw new Exceptions.OutdatedSdkException("Core_GetEntitiesInRangeCount", "Core_GetEntitiesInRangeCount SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetLoadedVehicleModelsDelegate(nint _core, nint* _loadedVehicleModelsOut, ulong* _size); @@ -1491,8 +1491,8 @@ public unsafe class ServerLibrary : IServerLibrary private static byte Vehicle_GetDoorStateFallback(nint _vehicle, byte _doorId) => throw new Exceptions.OutdatedSdkException("Vehicle_GetDoorState", "Vehicle_GetDoorState SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Vehicle_GetDriverDelegate(nint _vehicle); private static nint Vehicle_GetDriverFallback(nint _vehicle) => throw new Exceptions.OutdatedSdkException("Vehicle_GetDriver", "Vehicle_GetDriver SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Vehicle_GetDriverIDDelegate(nint _vehicle, ushort* _id); - private static byte Vehicle_GetDriverIDFallback(nint _vehicle, ushort* _id) => throw new Exceptions.OutdatedSdkException("Vehicle_GetDriverID", "Vehicle_GetDriverID SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Vehicle_GetDriverIDDelegate(nint _vehicle, uint* _id); + private static byte Vehicle_GetDriverIDFallback(nint _vehicle, uint* _id) => throw new Exceptions.OutdatedSdkException("Vehicle_GetDriverID", "Vehicle_GetDriverID SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate int Vehicle_GetEngineHealthDelegate(nint _vehicle); private static int Vehicle_GetEngineHealthFallback(nint _vehicle) => throw new Exceptions.OutdatedSdkException("Vehicle_GetEngineHealth", "Vehicle_GetEngineHealth SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Vehicle_GetGameStateBase64Delegate(nint _vehicle, int* _size); @@ -1884,7 +1884,7 @@ private IntPtr GetUnmanagedPtr(IDictionary funcTable, ulong ha public ServerLibrary(Dictionary funcTable) { if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true; - else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 14520310097856707558UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 4677548953854785821UL) Outdated = true; BaseObject_DeleteSyncedMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8228424877092269355UL, BaseObject_DeleteSyncedMetaDataFallback); BaseObject_SetMultipleSyncedMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 1390762125822890831UL, BaseObject_SetMultipleSyncedMetaDataFallback); BaseObject_SetSyncedMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8002999088966424231UL, BaseObject_SetSyncedMetaDataFallback); @@ -1939,13 +1939,13 @@ public ServerLibrary(Dictionary funcTable) Core_DestroyColShape = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16312284234900575747UL, Core_DestroyColShapeFallback); Core_DestroyVehicle = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 14452794280175707515UL, Core_DestroyVehicleFallback); Core_DestroyVoiceChannel = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10333270135403224879UL, Core_DestroyVoiceChannelFallback); - Core_GetClosestEntities = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4559218685940666205UL, Core_GetClosestEntitiesFallback); + Core_GetClosestEntities = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12057843286905322939UL, Core_GetClosestEntitiesFallback); Core_GetClosestEntitiesCount = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 419502286495548608UL, Core_GetClosestEntitiesCountFallback); Core_GetColShapeTickRate = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12193205314801108926UL, Core_GetColShapeTickRateFallback); Core_GetConnectionInfos = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 13972691773502904173UL, Core_GetConnectionInfosFallback); - Core_GetEntitiesInDimension = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4124119004202747553UL, Core_GetEntitiesInDimensionFallback); + Core_GetEntitiesInDimension = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 11709139263193592519UL, Core_GetEntitiesInDimensionFallback); Core_GetEntitiesInDimensionCount = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12784287737200780200UL, Core_GetEntitiesInDimensionCountFallback); - Core_GetEntitiesInRange = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12414549446254212526UL, Core_GetEntitiesInRangeFallback); + Core_GetEntitiesInRange = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4074854033126410216UL, Core_GetEntitiesInRangeFallback); Core_GetEntitiesInRangeCount = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6795936790869684439UL, Core_GetEntitiesInRangeCountFallback); Core_GetLoadedVehicleModels = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 5931751806478777368UL, Core_GetLoadedVehicleModelsFallback); Core_GetMaxStreamingObjects = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3581368898059030296UL, Core_GetMaxStreamingObjectsFallback); @@ -2158,7 +2158,7 @@ public ServerLibrary(Dictionary funcTable) Vehicle_GetDirtLevel = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 1312826368700331414UL, Vehicle_GetDirtLevelFallback); Vehicle_GetDoorState = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3655237348473428026UL, Vehicle_GetDoorStateFallback); Vehicle_GetDriver = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8554773347420139463UL, Vehicle_GetDriverFallback); - Vehicle_GetDriverID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6476166832678215577UL, Vehicle_GetDriverIDFallback); + Vehicle_GetDriverID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 1447949168829725163UL, Vehicle_GetDriverIDFallback); Vehicle_GetEngineHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8002690258276396481UL, Vehicle_GetEngineHealthFallback); Vehicle_GetGameStateBase64 = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4097244648501164820UL, Vehicle_GetGameStateBase64Fallback); Vehicle_GetHeadlightColor = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10761034670704244318UL, Vehicle_GetHeadlightColorFallback); diff --git a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs index cc8f5d71f..1fa312190 100644 --- a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs @@ -212,7 +212,7 @@ public unsafe interface ISharedLibrary public delegate* unmanaged[Cdecl] Core_SetMetaData { get; } public delegate* unmanaged[Cdecl] Core_ToggleEvent { get; } public delegate* unmanaged[Cdecl] Core_TriggerLocalEvent { get; } - public delegate* unmanaged[Cdecl] Entity_GetID { get; } + public delegate* unmanaged[Cdecl] Entity_GetID { get; } public delegate* unmanaged[Cdecl] Entity_GetModel { get; } public delegate* unmanaged[Cdecl] Entity_GetNetOwner { get; } public delegate* unmanaged[Cdecl] Entity_GetNetOwnerID { get; } @@ -306,14 +306,14 @@ public unsafe interface ISharedLibrary public delegate* unmanaged[Cdecl] MValueConst_RemoveRef { get; } public delegate* unmanaged[Cdecl] Object_GetAlpha { get; } public delegate* unmanaged[Cdecl] Object_GetEntity { get; } - public delegate* unmanaged[Cdecl] Object_GetID { get; } + public delegate* unmanaged[Cdecl] Object_GetID { get; } public delegate* unmanaged[Cdecl] Object_GetLodDistance { get; } public delegate* unmanaged[Cdecl] Object_GetTextureVariation { get; } public delegate* unmanaged[Cdecl] Ped_GetArmour { get; } public delegate* unmanaged[Cdecl] Ped_GetCurrentWeapon { get; } public delegate* unmanaged[Cdecl] Ped_GetEntity { get; } public delegate* unmanaged[Cdecl] Ped_GetHealth { get; } - public delegate* unmanaged[Cdecl] Ped_GetID { get; } + public delegate* unmanaged[Cdecl] Ped_GetID { get; } public delegate* unmanaged[Cdecl] Ped_GetMaxHealth { get; } public delegate* unmanaged[Cdecl] Player_GetAimPos { get; } public delegate* unmanaged[Cdecl] Player_GetArmor { get; } @@ -327,7 +327,7 @@ public unsafe interface ISharedLibrary public delegate* unmanaged[Cdecl] Player_GetForwardSpeed { get; } public delegate* unmanaged[Cdecl] Player_GetHeadRotation { get; } public delegate* unmanaged[Cdecl] Player_GetHealth { get; } - public delegate* unmanaged[Cdecl] Player_GetID { get; } + public delegate* unmanaged[Cdecl] Player_GetID { get; } public delegate* unmanaged[Cdecl] Player_GetMaxArmor { get; } public delegate* unmanaged[Cdecl] Player_GetMaxHealth { get; } public delegate* unmanaged[Cdecl] Player_GetMoveSpeed { get; } @@ -383,7 +383,7 @@ public unsafe interface ISharedLibrary public delegate* unmanaged[Cdecl] TextLabel_SetScale { get; } public delegate* unmanaged[Cdecl] TextLabel_SetVisible { get; } public delegate* unmanaged[Cdecl] Vehicle_GetEntity { get; } - public delegate* unmanaged[Cdecl] Vehicle_GetID { get; } + public delegate* unmanaged[Cdecl] Vehicle_GetID { get; } public delegate* unmanaged[Cdecl] Vehicle_GetPetrolTankHealth { get; } public delegate* unmanaged[Cdecl] Vehicle_GetSteeringAngle { get; } public delegate* unmanaged[Cdecl] Vehicle_GetWheelsCount { get; } @@ -613,7 +613,7 @@ public unsafe class SharedLibrary : ISharedLibrary public delegate* unmanaged[Cdecl] Core_SetMetaData { get; } public delegate* unmanaged[Cdecl] Core_ToggleEvent { get; } public delegate* unmanaged[Cdecl] Core_TriggerLocalEvent { get; } - public delegate* unmanaged[Cdecl] Entity_GetID { get; } + public delegate* unmanaged[Cdecl] Entity_GetID { get; } public delegate* unmanaged[Cdecl] Entity_GetModel { get; } public delegate* unmanaged[Cdecl] Entity_GetNetOwner { get; } public delegate* unmanaged[Cdecl] Entity_GetNetOwnerID { get; } @@ -707,14 +707,14 @@ public unsafe class SharedLibrary : ISharedLibrary public delegate* unmanaged[Cdecl] MValueConst_RemoveRef { get; } public delegate* unmanaged[Cdecl] Object_GetAlpha { get; } public delegate* unmanaged[Cdecl] Object_GetEntity { get; } - public delegate* unmanaged[Cdecl] Object_GetID { get; } + public delegate* unmanaged[Cdecl] Object_GetID { get; } public delegate* unmanaged[Cdecl] Object_GetLodDistance { get; } public delegate* unmanaged[Cdecl] Object_GetTextureVariation { get; } public delegate* unmanaged[Cdecl] Ped_GetArmour { get; } public delegate* unmanaged[Cdecl] Ped_GetCurrentWeapon { get; } public delegate* unmanaged[Cdecl] Ped_GetEntity { get; } public delegate* unmanaged[Cdecl] Ped_GetHealth { get; } - public delegate* unmanaged[Cdecl] Ped_GetID { get; } + public delegate* unmanaged[Cdecl] Ped_GetID { get; } public delegate* unmanaged[Cdecl] Ped_GetMaxHealth { get; } public delegate* unmanaged[Cdecl] Player_GetAimPos { get; } public delegate* unmanaged[Cdecl] Player_GetArmor { get; } @@ -728,7 +728,7 @@ public unsafe class SharedLibrary : ISharedLibrary public delegate* unmanaged[Cdecl] Player_GetForwardSpeed { get; } public delegate* unmanaged[Cdecl] Player_GetHeadRotation { get; } public delegate* unmanaged[Cdecl] Player_GetHealth { get; } - public delegate* unmanaged[Cdecl] Player_GetID { get; } + public delegate* unmanaged[Cdecl] Player_GetID { get; } public delegate* unmanaged[Cdecl] Player_GetMaxArmor { get; } public delegate* unmanaged[Cdecl] Player_GetMaxHealth { get; } public delegate* unmanaged[Cdecl] Player_GetMoveSpeed { get; } @@ -784,7 +784,7 @@ public unsafe class SharedLibrary : ISharedLibrary public delegate* unmanaged[Cdecl] TextLabel_SetScale { get; } public delegate* unmanaged[Cdecl] TextLabel_SetVisible { get; } public delegate* unmanaged[Cdecl] Vehicle_GetEntity { get; } - public delegate* unmanaged[Cdecl] Vehicle_GetID { get; } + public delegate* unmanaged[Cdecl] Vehicle_GetID { get; } public delegate* unmanaged[Cdecl] Vehicle_GetPetrolTankHealth { get; } public delegate* unmanaged[Cdecl] Vehicle_GetSteeringAngle { get; } public delegate* unmanaged[Cdecl] Vehicle_GetWheelsCount { get; } @@ -1211,8 +1211,8 @@ public unsafe class SharedLibrary : ISharedLibrary private static void Core_ToggleEventFallback(nint _core, byte _event, byte _state) => throw new Exceptions.OutdatedSdkException("Core_ToggleEvent", "Core_ToggleEvent SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_TriggerLocalEventDelegate(nint _core, nint _event, nint[] args, int _size); private static void Core_TriggerLocalEventFallback(nint _core, nint _event, nint[] args, int _size) => throw new Exceptions.OutdatedSdkException("Core_TriggerLocalEvent", "Core_TriggerLocalEvent SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Entity_GetIDDelegate(nint _entity); - private static ushort Entity_GetIDFallback(nint _entity) => throw new Exceptions.OutdatedSdkException("Entity_GetID", "Entity_GetID SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint Entity_GetIDDelegate(nint _entity); + private static uint Entity_GetIDFallback(nint _entity) => throw new Exceptions.OutdatedSdkException("Entity_GetID", "Entity_GetID SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint Entity_GetModelDelegate(nint _entity); private static uint Entity_GetModelFallback(nint _entity) => throw new Exceptions.OutdatedSdkException("Entity_GetModel", "Entity_GetModel SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Entity_GetNetOwnerDelegate(nint _entity); @@ -1399,8 +1399,8 @@ public unsafe class SharedLibrary : ISharedLibrary private static byte Object_GetAlphaFallback(nint _object) => throw new Exceptions.OutdatedSdkException("Object_GetAlpha", "Object_GetAlpha SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Object_GetEntityDelegate(nint _object); private static nint Object_GetEntityFallback(nint _object) => throw new Exceptions.OutdatedSdkException("Object_GetEntity", "Object_GetEntity SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Object_GetIDDelegate(nint _object); - private static ushort Object_GetIDFallback(nint _object) => throw new Exceptions.OutdatedSdkException("Object_GetID", "Object_GetID SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint Object_GetIDDelegate(nint _object); + private static uint Object_GetIDFallback(nint _object) => throw new Exceptions.OutdatedSdkException("Object_GetID", "Object_GetID SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Object_GetLodDistanceDelegate(nint _object); private static ushort Object_GetLodDistanceFallback(nint _object) => throw new Exceptions.OutdatedSdkException("Object_GetLodDistance", "Object_GetLodDistance SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Object_GetTextureVariationDelegate(nint _object); @@ -1413,8 +1413,8 @@ public unsafe class SharedLibrary : ISharedLibrary private static nint Ped_GetEntityFallback(nint _ped) => throw new Exceptions.OutdatedSdkException("Ped_GetEntity", "Ped_GetEntity SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Ped_GetHealthDelegate(nint _ped); private static ushort Ped_GetHealthFallback(nint _ped) => throw new Exceptions.OutdatedSdkException("Ped_GetHealth", "Ped_GetHealth SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Ped_GetIDDelegate(nint _ped); - private static ushort Ped_GetIDFallback(nint _ped) => throw new Exceptions.OutdatedSdkException("Ped_GetID", "Ped_GetID SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint Ped_GetIDDelegate(nint _ped); + private static uint Ped_GetIDFallback(nint _ped) => throw new Exceptions.OutdatedSdkException("Ped_GetID", "Ped_GetID SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Ped_GetMaxHealthDelegate(nint _ped); private static ushort Ped_GetMaxHealthFallback(nint _ped) => throw new Exceptions.OutdatedSdkException("Ped_GetMaxHealth", "Ped_GetMaxHealth SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_GetAimPosDelegate(nint _player, Vector3* _aimPosition); @@ -1441,8 +1441,8 @@ public unsafe class SharedLibrary : ISharedLibrary private static void Player_GetHeadRotationFallback(nint _player, Rotation* _headRotation) => throw new Exceptions.OutdatedSdkException("Player_GetHeadRotation", "Player_GetHeadRotation SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Player_GetHealthDelegate(nint _player); private static ushort Player_GetHealthFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_GetHealth", "Player_GetHealth SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Player_GetIDDelegate(nint _player); - private static ushort Player_GetIDFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_GetID", "Player_GetID SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint Player_GetIDDelegate(nint _player); + private static uint Player_GetIDFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_GetID", "Player_GetID SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Player_GetMaxArmorDelegate(nint _player); private static ushort Player_GetMaxArmorFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_GetMaxArmor", "Player_GetMaxArmor SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Player_GetMaxHealthDelegate(nint _player); @@ -1553,8 +1553,8 @@ public unsafe class SharedLibrary : ISharedLibrary private static void TextLabel_SetVisibleFallback(nint _textLabel, byte _visible) => throw new Exceptions.OutdatedSdkException("TextLabel_SetVisible", "TextLabel_SetVisible SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Vehicle_GetEntityDelegate(nint _vehicle); private static nint Vehicle_GetEntityFallback(nint _vehicle) => throw new Exceptions.OutdatedSdkException("Vehicle_GetEntity", "Vehicle_GetEntity SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort Vehicle_GetIDDelegate(nint _vehicle); - private static ushort Vehicle_GetIDFallback(nint _vehicle) => throw new Exceptions.OutdatedSdkException("Vehicle_GetID", "Vehicle_GetID SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint Vehicle_GetIDDelegate(nint _vehicle); + private static uint Vehicle_GetIDFallback(nint _vehicle) => throw new Exceptions.OutdatedSdkException("Vehicle_GetID", "Vehicle_GetID SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate int Vehicle_GetPetrolTankHealthDelegate(nint _vehicle); private static int Vehicle_GetPetrolTankHealthFallback(nint _vehicle) => throw new Exceptions.OutdatedSdkException("Vehicle_GetPetrolTankHealth", "Vehicle_GetPetrolTankHealth SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate float Vehicle_GetSteeringAngleDelegate(nint _vehicle); @@ -1608,7 +1608,7 @@ private IntPtr GetUnmanagedPtr(IDictionary funcTable, ulong ha public SharedLibrary(Dictionary funcTable) { if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true; - else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 14520310097856707558UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 4677548953854785821UL) Outdated = true; Audio_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4464042055475980737UL, Audio_GetIDFallback); AudioAttachedOutput_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17725794901805112189UL, AudioAttachedOutput_GetIDFallback); AudioFilter_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8824535635529306325UL, AudioFilter_GetIDFallback); @@ -1811,7 +1811,7 @@ public SharedLibrary(Dictionary funcTable) Core_SetMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4905441971289102819UL, Core_SetMetaDataFallback); Core_ToggleEvent = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17798706175912111294UL, Core_ToggleEventFallback); Core_TriggerLocalEvent = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2095655564565809781UL, Core_TriggerLocalEventFallback); - Entity_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12913447266302910987UL, Entity_GetIDFallback); + Entity_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10233629489933073997UL, Entity_GetIDFallback); Entity_GetModel = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6111944054700936115UL, Entity_GetModelFallback); Entity_GetNetOwner = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7130354370478174789UL, Entity_GetNetOwnerFallback); Entity_GetNetOwnerID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10262653550309861069UL, Entity_GetNetOwnerIDFallback); @@ -1905,14 +1905,14 @@ public SharedLibrary(Dictionary funcTable) MValueConst_RemoveRef = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2951895109234703784UL, MValueConst_RemoveRefFallback); Object_GetAlpha = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4782965940294523501UL, Object_GetAlphaFallback); Object_GetEntity = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4934471410579771998UL, Object_GetEntityFallback); - Object_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12916172794746864343UL, Object_GetIDFallback); + Object_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6815264172955104609UL, Object_GetIDFallback); Object_GetLodDistance = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 9053583879265260950UL, Object_GetLodDistanceFallback); Object_GetTextureVariation = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4660664364773957039UL, Object_GetTextureVariationFallback); Ped_GetArmour = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4106400780828488738UL, Ped_GetArmourFallback); Ped_GetCurrentWeapon = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 446737373633343515UL, Ped_GetCurrentWeaponFallback); Ped_GetEntity = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17974792644403470118UL, Ped_GetEntityFallback); Ped_GetHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7104729899977702888UL, Ped_GetHealthFallback); - Ped_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4733988892192620155UL, Ped_GetIDFallback); + Ped_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8160348533631447101UL, Ped_GetIDFallback); Ped_GetMaxHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 18375756057324289044UL, Ped_GetMaxHealthFallback); Player_GetAimPos = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6124580830261182834UL, Player_GetAimPosFallback); Player_GetArmor = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 343339663996265887UL, Player_GetArmorFallback); @@ -1926,7 +1926,7 @@ public SharedLibrary(Dictionary funcTable) Player_GetForwardSpeed = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12498998920879213674UL, Player_GetForwardSpeedFallback); Player_GetHeadRotation = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17222204554789096264UL, Player_GetHeadRotationFallback); Player_GetHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 14695407730559477910UL, Player_GetHealthFallback); - Player_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2649376720891219187UL, Player_GetIDFallback); + Player_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 18416303018230933813UL, Player_GetIDFallback); Player_GetMaxArmor = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4693803817659874615UL, Player_GetMaxArmorFallback); Player_GetMaxHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4164549052335308174UL, Player_GetMaxHealthFallback); Player_GetMoveSpeed = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10963946276172720740UL, Player_GetMoveSpeedFallback); @@ -1982,7 +1982,7 @@ public SharedLibrary(Dictionary funcTable) TextLabel_SetScale = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3918260719528326415UL, TextLabel_SetScaleFallback); TextLabel_SetVisible = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2302278843105157392UL, TextLabel_SetVisibleFallback); Vehicle_GetEntity = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8318093389193375258UL, Vehicle_GetEntityFallback); - Vehicle_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17687301249122992283UL, Vehicle_GetIDFallback); + Vehicle_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15007201997776333277UL, Vehicle_GetIDFallback); Vehicle_GetPetrolTankHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 18440829979133890169UL, Vehicle_GetPetrolTankHealthFallback); Vehicle_GetSteeringAngle = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7918377113203812466UL, Vehicle_GetSteeringAngleFallback); Vehicle_GetWheelsCount = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6954962557541059864UL, Vehicle_GetWheelsCountFallback); diff --git a/api/AltV.Net/Core.cs b/api/AltV.Net/Core.cs index 8530e898e..a255aa575 100644 --- a/api/AltV.Net/Core.cs +++ b/api/AltV.Net/Core.cs @@ -1276,13 +1276,18 @@ public IBaseObject[] GetClosestEntities(Position position, int range, int dimens { CheckIfCallIsValid(); var entitiesCount = Library.Server.Core_GetClosestEntitiesCount(NativePointer, position, range, dimension, limit, (ulong)allowedTypes); - var pointers = new IntPtr[entitiesCount]; + var pointers = IntPtr.Zero; var types = new byte[entitiesCount]; - Library.Server.Core_GetClosestEntities(NativePointer,position, range, dimension, limit, (ulong)allowedTypes, pointers, types, entitiesCount); + Library.Server.Core_GetClosestEntities(NativePointer,position, range, dimension, limit, (ulong)allowedTypes, &pointers, types, entitiesCount); + + var entityPtrArray = new IntPtr[entitiesCount]; + Marshal.Copy(pointers, entityPtrArray, 0, (int) entitiesCount); + Library.Shared.FreeVoidPointerArray(pointers); + var baseObjects = new IBaseObject[entitiesCount]; for (ulong i = 0; i < entitiesCount; i++) { - var basePointer = pointers[i]; + var basePointer = entityPtrArray[i]; baseObjects[i] = PoolManager.GetOrCreate(this, basePointer, (BaseObjectType)types[i]); } @@ -1296,13 +1301,17 @@ public IBaseObject[] GetEntitiesInDimension(int dimension, EntityType allowedTyp { CheckIfCallIsValid(); var entitiesCount = Library.Server.Core_GetEntitiesInDimensionCount(NativePointer, dimension, (ulong)allowedTypes); - var pointers = new IntPtr[entitiesCount]; + var pointers = IntPtr.Zero; var types = new byte[entitiesCount]; - Library.Server.Core_GetEntitiesInDimension(NativePointer, dimension, (ulong)allowedTypes, pointers, types, entitiesCount); + Library.Server.Core_GetEntitiesInDimension(NativePointer, dimension, (ulong)allowedTypes, &pointers, types, entitiesCount); + + var entityPtrArray = new IntPtr[entitiesCount]; + Marshal.Copy(pointers, entityPtrArray, 0, (int) entitiesCount); + Library.Shared.FreeVoidPointerArray(pointers); var baseObjects = new IBaseObject[entitiesCount]; for (ulong i = 0; i < entitiesCount; i++) { - var basePointer = pointers[i]; + var basePointer = entityPtrArray[i]; baseObjects[i] = PoolManager.GetOrCreate(this, basePointer, (BaseObjectType)types[i]); } @@ -1316,13 +1325,18 @@ public IBaseObject[] GetEntitiesInRange(Position position, int range, int dimens { CheckIfCallIsValid(); var entitiesCount = Library.Server.Core_GetEntitiesInRangeCount(NativePointer, position, range, dimension, (ulong)allowedTypes); - var pointers = new IntPtr[entitiesCount]; + var pointers = IntPtr.Zero; var types = new byte[entitiesCount]; - Library.Server.Core_GetEntitiesInRange(NativePointer, position, range, dimension, (ulong)allowedTypes, pointers, types, entitiesCount); + Library.Server.Core_GetEntitiesInRange(NativePointer, position, range, dimension, (ulong)allowedTypes, &pointers, types, entitiesCount); + + var entityPtrArray = new IntPtr[entitiesCount]; + Marshal.Copy(pointers, entityPtrArray, 0, (int) entitiesCount); + Library.Shared.FreeVoidPointerArray(pointers); + var baseObjects = new IBaseObject[entitiesCount]; for (ulong i = 0; i < entitiesCount; i++) { - var basePointer = pointers[i]; + var basePointer = entityPtrArray[i]; baseObjects[i] = PoolManager.GetOrCreate(this, basePointer, (BaseObjectType)types[i]); } diff --git a/runtime b/runtime index 1b61599fd..d91cedf66 160000 --- a/runtime +++ b/runtime @@ -1 +1 @@ -Subproject commit 1b61599fd9b11787fad963c24922860ebfe9c93a +Subproject commit d91cedf66fde5f1b57e6532f03ce85e2667cd086