diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8cbd648c..e7ca8d6dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ on: push: tags: - '*.*.*' - - '*.*.*-*' + - '*.*.*-*.*' jobs: fetch-nethost-linux: runs-on: ubuntu-22.04 diff --git a/api/AltV.Net.Async/AsyncCore.cs b/api/AltV.Net.Async/AsyncCore.cs index 9a10a4b36..84305b97c 100644 --- a/api/AltV.Net.Async/AsyncCore.cs +++ b/api/AltV.Net.Async/AsyncCore.cs @@ -869,14 +869,14 @@ public override void OnGivePedScriptedTaskEvent(IntPtr eventPointer, IPlayer sou } public override void OnPlayerConnectDeniedEvent(PlayerConnectDeniedReason reason, string name, string ip, ulong passwordHash, - bool isDebug, string branch, uint majorVersion, string cdnUrl, long discordId) + bool isDebug, string branch, ushort versionMajor, ushort versionMinor, string cdnUrl, long discordId) { - base.OnPlayerConnectDeniedEvent(reason, name, ip, passwordHash, isDebug, branch, majorVersion, cdnUrl, discordId); + base.OnPlayerConnectDeniedEvent(reason, name, ip, passwordHash, isDebug, branch, versionMajor, versionMinor, cdnUrl, discordId); if (!PlayerConnectDeniedAsyncEventHandler.HasEvents()) return; Task.Run(async () => { - await PlayerConnectDeniedAsyncEventHandler.CallAsync(@delegate => @delegate(reason, name, ip, passwordHash, isDebug, branch, majorVersion, cdnUrl, discordId)); + await PlayerConnectDeniedAsyncEventHandler.CallAsync(@delegate => @delegate(reason, name, ip, passwordHash, isDebug, branch, versionMajor, versionMinor, cdnUrl, discordId)); }); } diff --git a/api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs b/api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs index 141fd738f..b5e732b6f 100644 --- a/api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs +++ b/api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs @@ -96,17 +96,31 @@ public string Branch } } } - public uint Build + + public ushort VersionMajor + { + get + { + lock (ConnectionInfo) + { + if (!AsyncContext.CheckIfExistsOrCachedNullable(ConnectionInfo)) return default; + return ConnectionInfo.VersionMajor; + } + } + } + + public ushort VersionMinor { get { lock (ConnectionInfo) { if (!AsyncContext.CheckIfExistsOrCachedNullable(ConnectionInfo)) return default; - return ConnectionInfo.Build; + return ConnectionInfo.VersionMinor; } } } + public string CdnUrl { get diff --git a/api/AltV.Net.Async/Elements/Entities/AsyncVehicle.cs b/api/AltV.Net.Async/Elements/Entities/AsyncVehicle.cs index 59ddf12a3..61ee51e9d 100644 --- a/api/AltV.Net.Async/Elements/Entities/AsyncVehicle.cs +++ b/api/AltV.Net.Async/Elements/Entities/AsyncVehicle.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Numerics; +using AltV.Net.CApi.Data; using AltV.Net.Data; using AltV.Net.Elements.Entities; using AltV.Net.Enums; @@ -1993,6 +1994,24 @@ public List Passengers } } + public void SetBage(string textureDictionary, string texture, VehicleBadgePosition[] vehicleBadgePosition) + { + lock (Vehicle) + { + if (!AsyncContext.CheckIfExistsOrCachedNullable(Vehicle)) return; + Vehicle.SetBage(textureDictionary, texture, vehicleBadgePosition); + } + } + + public void SetBage(uint textureDictionary, uint texture, VehicleBadgePosition[] vehicleBadgePosition) + { + lock (Vehicle) + { + if (!AsyncContext.CheckIfExistsOrCachedNullable(Vehicle)) return; + Vehicle.SetBage(textureDictionary, texture, vehicleBadgePosition); + } + } + [Obsolete("Use new async API instead")] public IVehicle ToAsync(IAsyncContext asyncContext) { diff --git a/api/AltV.Net.Async/Events/Events.cs b/api/AltV.Net.Async/Events/Events.cs index 8a2765639..6314681ac 100644 --- a/api/AltV.Net.Async/Events/Events.cs +++ b/api/AltV.Net.Async/Events/Events.cs @@ -14,7 +14,7 @@ namespace AltV.Net.Async.Events public delegate Task PlayerConnectAsyncDelegate(IPlayer player, string reason); public delegate Task PlayerConnectDeniedAsyncDelegate(PlayerConnectDeniedReason reason, string name, string ip, - ulong passwordHash, bool isDebug, string branch, uint majorVersion, string cdnUrl, long discordId); + ulong passwordHash, bool isDebug, string branch, ushort versionMajor, ushort versionMinor, string cdnUrl, long discordId); public delegate Task ResourceEventAsyncDelegate(INativeResource resource); diff --git a/api/AltV.Net.CApi.Generator/Program.cs b/api/AltV.Net.CApi.Generator/Program.cs index a1ee8a2d9..f9b55b2b8 100644 --- a/api/AltV.Net.CApi.Generator/Program.cs +++ b/api/AltV.Net.CApi.Generator/Program.cs @@ -15,7 +15,7 @@ private static string GetCMethodDelegateType(CMethod method) var args = string.Join("", method.Params.Select(p => p.Type + ", ")); return $"delegate* unmanaged[Cdecl{noGc}]<{args}{method.ReturnType}>"; } - + private static string GetCMethodArgs(CMethod method) { return string.Join(", ", method.Params.Select(p => p.Type + " " + p.Name)); @@ -23,7 +23,7 @@ private static string GetCMethodArgs(CMethod method) public static void Generate() { - var libOutputPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)!, "../../../../AltV.Net.CApi/Libraries"); + var libOutputPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)!, "../../../../AltV.Net.CApi/Libraries"); var tableOutputPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)!, "../../../../../runtime/c-api/func_table.cpp"); var tableHashes = new StringBuilder(); @@ -40,31 +40,32 @@ public static void Generate() collisionFound = true; Console.WriteLine("Colliding methods: " + string.Join(",", collision.Select(e => e.Name))); } - + if (collisionFound) throw new Exception("Collision found!"); var capiHash = FnvHash.Generate(string.Join(";", parsedMethods.Select(e => e.Hash))); - + foreach (var group in parsedMethods.OrderBy(e => e.Name).GroupBy(e => e.Target)) { #region C# bindings var target = group.Key.ForceCapitalize(); - + var methods = string.Join("\n", group.Where(e => !e.OnlyManual) .Select(e => $" public {GetCMethodDelegateType(e)} {e.Name} {{ get; }}")); - + // todo add docs link to the exception var fallbacks = string.Join("\n", group.Where(e => !e.OnlyManual) .Select(e => $" [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate {e.ReturnType} {e.Name}Delegate({GetCMethodArgs(e)});\n" + $" private static {e.ReturnType} {e.Name}Fallback({GetCMethodArgs(e)}) => throw new Exceptions.OutdatedSdkException(\"{e.Name}\", \"{e.Name} SDK method is outdated. Please update your module nuget\");")); - + var loads = string.Join("\n", group.Where(e => !e.OnlyManual) .Select(e => $" {e.Name} = ({GetCMethodDelegateType(e)}) GetUnmanagedPtr<{e.Name}Delegate>(funcTable, {e.Hash}UL, {e.Name}Fallback);")); - + var output = new StringBuilder(); output.Append("// ReSharper disable InconsistentNaming\n"); output.Append("using AltV.Net.Data;\n"); + output.Append("using AltV.Net.CApi.Data;\n"); output.Append("using System.Numerics;\n"); output.Append("using System.Runtime.InteropServices;\n"); output.Append("using AltV.Net.Elements.Args;\n"); @@ -100,7 +101,7 @@ public static void Generate() File.WriteAllText(Path.Combine(libOutputPath, $"{target}Library.cs"), output.ToString()); #endregion - + #region Func table if (group.Key != "SHARED") @@ -108,13 +109,13 @@ public static void Generate() tableHashes.Append($" #ifdef ALT_{group.Key}_API\n"); tablePointers.Append($" #ifdef ALT_{group.Key}_API\n"); } - + foreach (var e in group) { tableHashes.Append($" {e.Hash}UL,\n"); tablePointers.Append($" (void*) {e.Name},\n"); } - + if (group.Key != "SHARED") { tableHashes.Append($" #endif\n"); @@ -125,13 +126,13 @@ public static void Generate() var table = new StringBuilder(); table.Append("#include \"func_table.h\"\n\n"); - + table.Append($"inline uint64_t capiHash = {capiHash}UL;\n"); table.Append("inline uint64_t capiHashes[] = {\n"); table.Append(" 0,\n"); table.Append(tableHashes); table.Append("};\n\n"); - + table.Append("inline void* capiPointers[] = {\n"); table.Append(" (void*) &capiHash,\n"); table.Append(tablePointers); @@ -145,10 +146,10 @@ public static void Generate() table.Append(" };\n"); table.Append(" return &data;\n"); table.Append("}"); - + File.WriteAllText(tableOutputPath, table.ToString()); - } - + } + public static void Main() { Generate(); diff --git a/api/AltV.Net.CApi.Generator/TypeRegistry.cs b/api/AltV.Net.CApi.Generator/TypeRegistry.cs index 8c5dfe064..6191fd304 100644 --- a/api/AltV.Net.CApi.Generator/TypeRegistry.cs +++ b/api/AltV.Net.CApi.Generator/TypeRegistry.cs @@ -123,6 +123,8 @@ public static class TypeRegistry { "rotation_t", "Rotation" }, { "alt::Rotation", "Rotation" }, + { "vehicleBadgePosition_t[]", "VehicleBadgePosition[]" }, + { "cloth_t&", "Cloth*" }, { "cloth_t", "Cloth" }, { "dlccloth_t&", "DlcCloth*" }, diff --git a/api/AltV.Net.CApi/Data/VehicleBadgePosition.cs b/api/AltV.Net.CApi/Data/VehicleBadgePosition.cs new file mode 100644 index 000000000..7e84a7aa7 --- /dev/null +++ b/api/AltV.Net.CApi/Data/VehicleBadgePosition.cs @@ -0,0 +1,39 @@ +using System.Numerics; +using System.Runtime.InteropServices; + +namespace AltV.Net.CApi.Data; + +[StructLayout(LayoutKind.Sequential)] +public struct VehicleBadgePosition : IEquatable +{ + public VehicleBadgePosition(bool active, byte alpha, float size, short boneIndex, Vector3 offset, Vector3 direction, Vector3 side) + { + Active = active ? (byte)1 : (byte)0; + Alpha = alpha; + Size = size; + BoneIndex = boneIndex; + Offset = offset; + Direction = direction; + Side = side; + } + + public byte Active { get; set; } = 0; + public byte Alpha { get; set; } = 255; + public float Size { get; set; } = 1f; + public short BoneIndex { get; set; } = 0; + public Vector3 Offset { get; set; } = new(0, 0, 0); + public Vector3 Direction { get; set; } = new(0, 0, 0); + public Vector3 Side { get; set; } = new(0, 0, 0); + + public bool Equals(VehicleBadgePosition other) + { + return Active == other.Active && Alpha == other.Alpha && Size.Equals(other.Size) && BoneIndex == other.BoneIndex && Offset.Equals(other.Offset) && Direction.Equals(other.Direction) && Side.Equals(other.Side); + } + + public override bool Equals(object? obj) + { + return obj is VehicleBadgePosition other && Equals(other); + } + + public override int GetHashCode() => HashCode.Combine(Active.GetHashCode(), Alpha.GetHashCode(), Size.GetHashCode(), BoneIndex.GetHashCode(), Offset.GetHashCode(), Direction.GetHashCode(), Side.GetHashCode()); +} \ No newline at end of file diff --git a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs index 71b07e0ce..b1ea92999 100644 --- a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs @@ -1,5 +1,6 @@ // ReSharper disable InconsistentNaming using AltV.Net.Data; +using AltV.Net.CApi.Data; using System.Numerics; using System.Runtime.InteropServices; using AltV.Net.Elements.Args; @@ -99,6 +100,7 @@ public unsafe interface IClientLibrary public delegate* unmanaged[Cdecl] Checkpoint_GetGameID { get; } public delegate* unmanaged[Cdecl] Checkpoint_IsStreamedIn { get; } public delegate* unmanaged[Cdecl] Core_AddGXTText { get; } + public delegate* unmanaged[Cdecl] Core_AddVoiceFilter { get; } public delegate* unmanaged[Cdecl] Core_AreGameControlsEnabled { get; } public delegate* unmanaged[Cdecl] Core_AreRmlControlsEnabled { get; } public delegate* unmanaged[Cdecl] Core_AreVoiceControlsEnabled { get; } @@ -181,7 +183,11 @@ public unsafe interface IClientLibrary public delegate* unmanaged[Cdecl] Core_GetTotalPacketsSent { get; } public delegate* unmanaged[Cdecl] Core_GetVoiceActivationKey { get; } public delegate* unmanaged[Cdecl] Core_GetVoiceActivationLevel { get; } + public delegate* unmanaged[Cdecl] Core_GetVoiceFilter { get; } public delegate* unmanaged[Cdecl] Core_GetVoiceInputMuted { get; } + public delegate* unmanaged[Cdecl] Core_GetVoiceNonSpatialVolume { get; } + public delegate* unmanaged[Cdecl] Core_GetVoicePlayers { get; } + public delegate* unmanaged[Cdecl] Core_GetVoiceSpatialVolume { get; } public delegate* unmanaged[Cdecl] Core_GetWeaponObjects { get; } public delegate* unmanaged[Cdecl] Core_GetWebViewCount { get; } public delegate* unmanaged[Cdecl] Core_GetWebViews { get; } @@ -213,6 +219,8 @@ public unsafe interface IClientLibrary public delegate* unmanaged[Cdecl] Core_RegisterFont { get; } public delegate* unmanaged[Cdecl] Core_RemoveGXTText { get; } public delegate* unmanaged[Cdecl] Core_RemoveIpl { get; } + public delegate* unmanaged[Cdecl] Core_RemoveVoiceFilter { get; } + public delegate* unmanaged[Cdecl] Core_RemoveVoicePlayer { get; } public delegate* unmanaged[Cdecl] Core_RequestIpl { get; } public delegate* unmanaged[Cdecl] Core_ResetAllMapZoomData { get; } public delegate* unmanaged[Cdecl] Core_ResetMapZoomData { get; } @@ -239,6 +247,8 @@ public unsafe interface IClientLibrary public delegate* unmanaged[Cdecl] Core_SetStatUInt8 { get; } public delegate* unmanaged[Cdecl] Core_SetVoiceActivationLevel { get; } public delegate* unmanaged[Cdecl] Core_SetVoiceInputMuted { get; } + public delegate* unmanaged[Cdecl] Core_SetVoiceNonSpatialVolume { get; } + public delegate* unmanaged[Cdecl] Core_SetVoiceSpatialVolume { get; } public delegate* unmanaged[Cdecl] Core_SetWatermarkPosition { get; } public delegate* unmanaged[Cdecl] Core_SetWeatherCycle { get; } public delegate* unmanaged[Cdecl] Core_SetWeatherSyncActive { get; } @@ -258,6 +268,7 @@ public unsafe interface IClientLibrary public delegate* unmanaged[Cdecl] Core_TriggerServerRPCEvent { get; } public delegate* unmanaged[Cdecl] Core_TriggerWebViewEvent { get; } public delegate* unmanaged[Cdecl] Core_UnloadYtyp { get; } + public delegate* unmanaged[Cdecl] Core_UpdateClipContext { get; } public delegate* unmanaged[Cdecl] Core_WorldToScreen { get; } public delegate* unmanaged[Cdecl] CustomTexture_GetBaseObject { get; } public delegate* unmanaged[Cdecl] CustomTexture_GetID { get; } @@ -889,7 +900,7 @@ public unsafe interface IClientLibrary public unsafe class ClientLibrary : IClientLibrary { - public readonly uint Methods = 1755; + public readonly uint Methods = 1767; public delegate* unmanaged[Cdecl] Audio_AddOutput { get; } public delegate* unmanaged[Cdecl] Audio_GetBaseObject { get; } public delegate* unmanaged[Cdecl] Audio_GetCurrentTime { get; } @@ -979,6 +990,7 @@ public unsafe class ClientLibrary : IClientLibrary public delegate* unmanaged[Cdecl] Checkpoint_GetGameID { get; } public delegate* unmanaged[Cdecl] Checkpoint_IsStreamedIn { get; } public delegate* unmanaged[Cdecl] Core_AddGXTText { get; } + public delegate* unmanaged[Cdecl] Core_AddVoiceFilter { get; } public delegate* unmanaged[Cdecl] Core_AreGameControlsEnabled { get; } public delegate* unmanaged[Cdecl] Core_AreRmlControlsEnabled { get; } public delegate* unmanaged[Cdecl] Core_AreVoiceControlsEnabled { get; } @@ -1061,7 +1073,11 @@ public unsafe class ClientLibrary : IClientLibrary public delegate* unmanaged[Cdecl] Core_GetTotalPacketsSent { get; } public delegate* unmanaged[Cdecl] Core_GetVoiceActivationKey { get; } public delegate* unmanaged[Cdecl] Core_GetVoiceActivationLevel { get; } + public delegate* unmanaged[Cdecl] Core_GetVoiceFilter { get; } public delegate* unmanaged[Cdecl] Core_GetVoiceInputMuted { get; } + public delegate* unmanaged[Cdecl] Core_GetVoiceNonSpatialVolume { get; } + public delegate* unmanaged[Cdecl] Core_GetVoicePlayers { get; } + public delegate* unmanaged[Cdecl] Core_GetVoiceSpatialVolume { get; } public delegate* unmanaged[Cdecl] Core_GetWeaponObjects { get; } public delegate* unmanaged[Cdecl] Core_GetWebViewCount { get; } public delegate* unmanaged[Cdecl] Core_GetWebViews { get; } @@ -1093,6 +1109,8 @@ public unsafe class ClientLibrary : IClientLibrary public delegate* unmanaged[Cdecl] Core_RegisterFont { get; } public delegate* unmanaged[Cdecl] Core_RemoveGXTText { get; } public delegate* unmanaged[Cdecl] Core_RemoveIpl { get; } + public delegate* unmanaged[Cdecl] Core_RemoveVoiceFilter { get; } + public delegate* unmanaged[Cdecl] Core_RemoveVoicePlayer { get; } public delegate* unmanaged[Cdecl] Core_RequestIpl { get; } public delegate* unmanaged[Cdecl] Core_ResetAllMapZoomData { get; } public delegate* unmanaged[Cdecl] Core_ResetMapZoomData { get; } @@ -1119,6 +1137,8 @@ public unsafe class ClientLibrary : IClientLibrary public delegate* unmanaged[Cdecl] Core_SetStatUInt8 { get; } public delegate* unmanaged[Cdecl] Core_SetVoiceActivationLevel { get; } public delegate* unmanaged[Cdecl] Core_SetVoiceInputMuted { get; } + public delegate* unmanaged[Cdecl] Core_SetVoiceNonSpatialVolume { get; } + public delegate* unmanaged[Cdecl] Core_SetVoiceSpatialVolume { get; } public delegate* unmanaged[Cdecl] Core_SetWatermarkPosition { get; } public delegate* unmanaged[Cdecl] Core_SetWeatherCycle { get; } public delegate* unmanaged[Cdecl] Core_SetWeatherSyncActive { get; } @@ -1138,6 +1158,7 @@ public unsafe class ClientLibrary : IClientLibrary public delegate* unmanaged[Cdecl] Core_TriggerServerRPCEvent { get; } public delegate* unmanaged[Cdecl] Core_TriggerWebViewEvent { get; } public delegate* unmanaged[Cdecl] Core_UnloadYtyp { get; } + public delegate* unmanaged[Cdecl] Core_UpdateClipContext { get; } public delegate* unmanaged[Cdecl] Core_WorldToScreen { get; } public delegate* unmanaged[Cdecl] CustomTexture_GetBaseObject { get; } public delegate* unmanaged[Cdecl] CustomTexture_GetID { get; } @@ -1943,6 +1964,8 @@ public unsafe class ClientLibrary : IClientLibrary private static byte Checkpoint_IsStreamedInFallback(nint _checkpoint) => throw new Exceptions.OutdatedSdkException("Checkpoint_IsStreamedIn", "Checkpoint_IsStreamedIn SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_AddGXTTextDelegate(nint _core, nint _resource, uint _key, nint _value); private static void Core_AddGXTTextFallback(nint _core, nint _resource, uint _key, nint _value) => throw new Exceptions.OutdatedSdkException("Core_AddGXTText", "Core_AddGXTText SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_AddVoiceFilterDelegate(nint _core, uint _playerRemodeId, nint _filter); + private static void Core_AddVoiceFilterFallback(nint _core, uint _playerRemodeId, nint _filter) => throw new Exceptions.OutdatedSdkException("Core_AddVoiceFilter", "Core_AddVoiceFilter SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_AreGameControlsEnabledDelegate(nint _core); private static byte Core_AreGameControlsEnabledFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_AreGameControlsEnabled", "Core_AreGameControlsEnabled SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_AreRmlControlsEnabledDelegate(nint _core); @@ -2107,8 +2130,16 @@ public unsafe class ClientLibrary : IClientLibrary private static uint Core_GetVoiceActivationKeyFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_GetVoiceActivationKey", "Core_GetVoiceActivationKey SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate float Core_GetVoiceActivationLevelDelegate(nint _core); private static float Core_GetVoiceActivationLevelFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_GetVoiceActivationLevel", "Core_GetVoiceActivationLevel SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetVoiceFilterDelegate(nint _core, uint _playerRemodeId); + private static nint Core_GetVoiceFilterFallback(nint _core, uint _playerRemodeId) => throw new Exceptions.OutdatedSdkException("Core_GetVoiceFilter", "Core_GetVoiceFilter SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_GetVoiceInputMutedDelegate(nint _core); private static byte Core_GetVoiceInputMutedFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_GetVoiceInputMuted", "Core_GetVoiceInputMuted SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate float Core_GetVoiceNonSpatialVolumeDelegate(nint _core, uint _playerRemodeId); + private static float Core_GetVoiceNonSpatialVolumeFallback(nint _core, uint _playerRemodeId) => throw new Exceptions.OutdatedSdkException("Core_GetVoiceNonSpatialVolume", "Core_GetVoiceNonSpatialVolume SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetVoicePlayersDelegate(nint _core, nint* _voicePlayers, uint* _size); + private static void Core_GetVoicePlayersFallback(nint _core, nint* _voicePlayers, uint* _size) => throw new Exceptions.OutdatedSdkException("Core_GetVoicePlayers", "Core_GetVoicePlayers SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate float Core_GetVoiceSpatialVolumeDelegate(nint _core, uint _playerRemodeId); + private static float Core_GetVoiceSpatialVolumeFallback(nint _core, uint _playerRemodeId) => throw new Exceptions.OutdatedSdkException("Core_GetVoiceSpatialVolume", "Core_GetVoiceSpatialVolume SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetWeaponObjectsDelegate(nint _core, uint* _size); private static nint Core_GetWeaponObjectsFallback(nint _core, uint* _size) => throw new Exceptions.OutdatedSdkException("Core_GetWeaponObjects", "Core_GetWeaponObjects SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Core_GetWebViewCountDelegate(nint _core); @@ -2171,6 +2202,10 @@ public unsafe class ClientLibrary : IClientLibrary private static void Core_RemoveGXTTextFallback(nint _core, nint _resource, uint _key) => throw new Exceptions.OutdatedSdkException("Core_RemoveGXTText", "Core_RemoveGXTText SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_RemoveIplDelegate(nint _core, nint _path); private static void Core_RemoveIplFallback(nint _core, nint _path) => throw new Exceptions.OutdatedSdkException("Core_RemoveIpl", "Core_RemoveIpl SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_RemoveVoiceFilterDelegate(nint _core, uint _playerRemodeId); + private static void Core_RemoveVoiceFilterFallback(nint _core, uint _playerRemodeId) => throw new Exceptions.OutdatedSdkException("Core_RemoveVoiceFilter", "Core_RemoveVoiceFilter SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_RemoveVoicePlayerDelegate(nint _core, uint _playerRemodeId); + private static void Core_RemoveVoicePlayerFallback(nint _core, uint _playerRemodeId) => throw new Exceptions.OutdatedSdkException("Core_RemoveVoicePlayer", "Core_RemoveVoicePlayer SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_RequestIplDelegate(nint _core, nint _path); private static void Core_RequestIplFallback(nint _core, nint _path) => throw new Exceptions.OutdatedSdkException("Core_RequestIpl", "Core_RequestIpl SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_ResetAllMapZoomDataDelegate(nint _core); @@ -2223,6 +2258,10 @@ public unsafe class ClientLibrary : IClientLibrary private static byte Core_SetVoiceActivationLevelFallback(nint _core, float _level) => throw new Exceptions.OutdatedSdkException("Core_SetVoiceActivationLevel", "Core_SetVoiceActivationLevel SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_SetVoiceInputMutedDelegate(nint _core, byte _value); private static void Core_SetVoiceInputMutedFallback(nint _core, byte _value) => throw new Exceptions.OutdatedSdkException("Core_SetVoiceInputMuted", "Core_SetVoiceInputMuted SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_SetVoiceNonSpatialVolumeDelegate(nint _core, uint _playerRemodeId, float _volume); + private static void Core_SetVoiceNonSpatialVolumeFallback(nint _core, uint _playerRemodeId, float _volume) => throw new Exceptions.OutdatedSdkException("Core_SetVoiceNonSpatialVolume", "Core_SetVoiceNonSpatialVolume SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_SetVoiceSpatialVolumeDelegate(nint _core, uint _playerRemodeId, float _volume); + private static void Core_SetVoiceSpatialVolumeFallback(nint _core, uint _playerRemodeId, float _volume) => throw new Exceptions.OutdatedSdkException("Core_SetVoiceSpatialVolume", "Core_SetVoiceSpatialVolume SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_SetWatermarkPositionDelegate(nint _core, byte _position); private static void Core_SetWatermarkPositionFallback(nint _core, byte _position) => throw new Exceptions.OutdatedSdkException("Core_SetWatermarkPosition", "Core_SetWatermarkPosition SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_SetWeatherCycleDelegate(nint _core, byte[] weathers, int _weathersSize, byte[] multipliers, int _multipliersSize); @@ -2261,6 +2300,8 @@ public unsafe class ClientLibrary : IClientLibrary private static void Core_TriggerWebViewEventFallback(nint _core, nint _webview, nint _event, nint[] args, int _size) => throw new Exceptions.OutdatedSdkException("Core_TriggerWebViewEvent", "Core_TriggerWebViewEvent SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_UnloadYtypDelegate(nint _core, nint _path); private static byte Core_UnloadYtypFallback(nint _core, nint _path) => throw new Exceptions.OutdatedSdkException("Core_UnloadYtyp", "Core_UnloadYtyp SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_UpdateClipContextDelegate(nint _core, nint[] keys, nint[] values, ulong _size); + private static void Core_UpdateClipContextFallback(nint _core, nint[] keys, nint[] values, ulong _size) => throw new Exceptions.OutdatedSdkException("Core_UpdateClipContext", "Core_UpdateClipContext SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_WorldToScreenDelegate(nint _core, Vector3 _in, Vector2* _out); private static void Core_WorldToScreenFallback(nint _core, Vector3 _in, Vector2* _out) => throw new Exceptions.OutdatedSdkException("Core_WorldToScreen", "Core_WorldToScreen SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint CustomTexture_GetBaseObjectDelegate(nint _costumTexture); @@ -3524,7 +3565,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 != 554522947139118248UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13630124142623987997UL) 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); @@ -3614,6 +3655,7 @@ public ClientLibrary(Dictionary funcTable) Checkpoint_GetGameID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10807368225937279665UL, Checkpoint_GetGameIDFallback); Checkpoint_IsStreamedIn = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 11169437175796680635UL, Checkpoint_IsStreamedInFallback); Core_AddGXTText = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15861482869617048160UL, Core_AddGXTTextFallback); + Core_AddVoiceFilter = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16092557757480797995UL, Core_AddVoiceFilterFallback); Core_AreGameControlsEnabled = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 332214446285856938UL, Core_AreGameControlsEnabledFallback); Core_AreRmlControlsEnabled = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6617672605820539119UL, Core_AreRmlControlsEnabledFallback); Core_AreVoiceControlsEnabled = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 787373906810962396UL, Core_AreVoiceControlsEnabledFallback); @@ -3696,7 +3738,11 @@ public ClientLibrary(Dictionary funcTable) Core_GetTotalPacketsSent = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16154816553672886942UL, Core_GetTotalPacketsSentFallback); Core_GetVoiceActivationKey = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2249875648683273533UL, Core_GetVoiceActivationKeyFallback); Core_GetVoiceActivationLevel = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 14311678038566163090UL, Core_GetVoiceActivationLevelFallback); + Core_GetVoiceFilter = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15381961310249968205UL, Core_GetVoiceFilterFallback); Core_GetVoiceInputMuted = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 14294729290243559040UL, Core_GetVoiceInputMutedFallback); + Core_GetVoiceNonSpatialVolume = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 14180673522110201914UL, Core_GetVoiceNonSpatialVolumeFallback); + Core_GetVoicePlayers = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 759879643372796676UL, Core_GetVoicePlayersFallback); + Core_GetVoiceSpatialVolume = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10827389293122297015UL, Core_GetVoiceSpatialVolumeFallback); Core_GetWeaponObjects = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 18342201422886872407UL, Core_GetWeaponObjectsFallback); Core_GetWebViewCount = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 5500487167100623739UL, Core_GetWebViewCountFallback); Core_GetWebViews = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8710938014357466262UL, Core_GetWebViewsFallback); @@ -3728,6 +3774,8 @@ public ClientLibrary(Dictionary funcTable) Core_RegisterFont = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 84574382701044016UL, Core_RegisterFontFallback); Core_RemoveGXTText = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2950682702415179672UL, Core_RemoveGXTTextFallback); Core_RemoveIpl = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3186817815537256556UL, Core_RemoveIplFallback); + Core_RemoveVoiceFilter = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4203146524234440953UL, Core_RemoveVoiceFilterFallback); + Core_RemoveVoicePlayer = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15949102402945152498UL, Core_RemoveVoicePlayerFallback); Core_RequestIpl = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6993510006268976715UL, Core_RequestIplFallback); Core_ResetAllMapZoomData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 664982279299386907UL, Core_ResetAllMapZoomDataFallback); Core_ResetMapZoomData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12948735896839739671UL, Core_ResetMapZoomDataFallback); @@ -3754,6 +3802,8 @@ public ClientLibrary(Dictionary funcTable) Core_SetStatUInt8 = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15051718600062446893UL, Core_SetStatUInt8Fallback); Core_SetVoiceActivationLevel = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6366517826241888414UL, Core_SetVoiceActivationLevelFallback); Core_SetVoiceInputMuted = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7814638701493567231UL, Core_SetVoiceInputMutedFallback); + Core_SetVoiceNonSpatialVolume = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8870406345125653689UL, Core_SetVoiceNonSpatialVolumeFallback); + Core_SetVoiceSpatialVolume = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8791822899861925122UL, Core_SetVoiceSpatialVolumeFallback); Core_SetWatermarkPosition = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7934747004301392615UL, Core_SetWatermarkPositionFallback); Core_SetWeatherCycle = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16585286735482336540UL, Core_SetWeatherCycleFallback); Core_SetWeatherSyncActive = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 13045279996168078519UL, Core_SetWeatherSyncActiveFallback); @@ -3773,6 +3823,7 @@ public ClientLibrary(Dictionary funcTable) Core_TriggerServerRPCEvent = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 5920144219377072122UL, Core_TriggerServerRPCEventFallback); Core_TriggerWebViewEvent = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3268039739443301173UL, Core_TriggerWebViewEventFallback); Core_UnloadYtyp = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17753040748478874447UL, Core_UnloadYtypFallback); + Core_UpdateClipContext = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17801058509158105354UL, Core_UpdateClipContextFallback); Core_WorldToScreen = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 5389506501733691988UL, Core_WorldToScreenFallback); CustomTexture_GetBaseObject = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4168880360490742954UL, CustomTexture_GetBaseObjectFallback); CustomTexture_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12755828446518747613UL, CustomTexture_GetIDFallback); diff --git a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs index 84ad8f657..5ef506840 100644 --- a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs @@ -1,5 +1,6 @@ // ReSharper disable InconsistentNaming using AltV.Net.Data; +using AltV.Net.CApi.Data; using System.Numerics; using System.Runtime.InteropServices; using AltV.Net.Elements.Args; @@ -30,7 +31,6 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] ConnectionInfo_GetAuthToken { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetBaseObject { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetBranch { get; } - public delegate* unmanaged[Cdecl] ConnectionInfo_GetBuild { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetCdnUrl { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetCloudAuthResult { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetCloudID { get; } @@ -45,6 +45,8 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] ConnectionInfo_GetSocialId { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetSocialName { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetText { get; } + public delegate* unmanaged[Cdecl] ConnectionInfo_GetVersionMajor { get; } + public delegate* unmanaged[Cdecl] ConnectionInfo_GetVersionMinor { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_IsAccepted { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_SetText { get; } public delegate* unmanaged[Cdecl] Core_AddClientConfigKey { get; } @@ -163,7 +165,7 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] Player_ClearProps { get; } public delegate* unmanaged[Cdecl] Player_ClearTasks { get; } public delegate* unmanaged[Cdecl] Player_DeallocAmmoFlags { get; } - public delegate* unmanaged[Cdecl] Player_DeallocVehicleModelInfo { get; } + public delegate* unmanaged[Cdecl] Player_DeallocDecoration { get; } public delegate* unmanaged[Cdecl] Player_DeleteLocalMetaData { get; } public delegate* unmanaged[Cdecl] Player_Despawn { get; } public delegate* unmanaged[Cdecl] Player_GetAmmo { get; } @@ -381,6 +383,7 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] Vehicle_Repair { get; } public delegate* unmanaged[Cdecl] Vehicle_SetArmoredWindowHealth { get; } public delegate* unmanaged[Cdecl] Vehicle_SetArmoredWindowShootCount { get; } + public delegate* unmanaged[Cdecl] Vehicle_SetBadge { get; } public delegate* unmanaged[Cdecl] Vehicle_SetBoatAnchor { get; } public delegate* unmanaged[Cdecl] Vehicle_SetBodyAdditionalHealth { get; } public delegate* unmanaged[Cdecl] Vehicle_SetBodyHealth { get; } @@ -482,7 +485,7 @@ public unsafe interface IServerLibrary public unsafe class ServerLibrary : IServerLibrary { - public readonly uint Methods = 1755; + public readonly uint Methods = 1767; public delegate* unmanaged[Cdecl] BaseObject_DeleteSyncedMetaData { get; } public delegate* unmanaged[Cdecl] BaseObject_SetMultipleSyncedMetaData { get; } public delegate* unmanaged[Cdecl] BaseObject_SetSyncedMetaData { get; } @@ -503,7 +506,6 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] ConnectionInfo_GetAuthToken { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetBaseObject { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetBranch { get; } - public delegate* unmanaged[Cdecl] ConnectionInfo_GetBuild { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetCdnUrl { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetCloudAuthResult { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetCloudID { get; } @@ -518,6 +520,8 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] ConnectionInfo_GetSocialId { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetSocialName { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetText { get; } + public delegate* unmanaged[Cdecl] ConnectionInfo_GetVersionMajor { get; } + public delegate* unmanaged[Cdecl] ConnectionInfo_GetVersionMinor { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_IsAccepted { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_SetText { get; } public delegate* unmanaged[Cdecl] Core_AddClientConfigKey { get; } @@ -636,7 +640,7 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] Player_ClearProps { get; } public delegate* unmanaged[Cdecl] Player_ClearTasks { get; } public delegate* unmanaged[Cdecl] Player_DeallocAmmoFlags { get; } - public delegate* unmanaged[Cdecl] Player_DeallocVehicleModelInfo { get; } + public delegate* unmanaged[Cdecl] Player_DeallocDecoration { get; } public delegate* unmanaged[Cdecl] Player_DeleteLocalMetaData { get; } public delegate* unmanaged[Cdecl] Player_Despawn { get; } public delegate* unmanaged[Cdecl] Player_GetAmmo { get; } @@ -854,6 +858,7 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] Vehicle_Repair { get; } public delegate* unmanaged[Cdecl] Vehicle_SetArmoredWindowHealth { get; } public delegate* unmanaged[Cdecl] Vehicle_SetArmoredWindowShootCount { get; } + public delegate* unmanaged[Cdecl] Vehicle_SetBadge { get; } public delegate* unmanaged[Cdecl] Vehicle_SetBoatAnchor { get; } public delegate* unmanaged[Cdecl] Vehicle_SetBodyAdditionalHealth { get; } public delegate* unmanaged[Cdecl] Vehicle_SetBodyHealth { get; } @@ -991,8 +996,6 @@ public unsafe class ServerLibrary : IServerLibrary private static nint ConnectionInfo_GetBaseObjectFallback(IntPtr _connectionInfo) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetBaseObject", "ConnectionInfo_GetBaseObject SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint ConnectionInfo_GetBranchDelegate(IntPtr _connectionInfo, int* _size); private static nint ConnectionInfo_GetBranchFallback(IntPtr _connectionInfo, int* _size) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetBranch", "ConnectionInfo_GetBranch SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate uint ConnectionInfo_GetBuildDelegate(IntPtr _connectionInfo); - private static uint ConnectionInfo_GetBuildFallback(IntPtr _connectionInfo) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetBuild", "ConnectionInfo_GetBuild SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint ConnectionInfo_GetCdnUrlDelegate(IntPtr _connectionInfo, int* _size); private static nint ConnectionInfo_GetCdnUrlFallback(IntPtr _connectionInfo, int* _size) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetCdnUrl", "ConnectionInfo_GetCdnUrl SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte ConnectionInfo_GetCloudAuthResultDelegate(IntPtr _connectionInfo); @@ -1021,6 +1024,10 @@ public unsafe class ServerLibrary : IServerLibrary private static nint ConnectionInfo_GetSocialNameFallback(IntPtr _connectionInfo, int* _size) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetSocialName", "ConnectionInfo_GetSocialName SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint ConnectionInfo_GetTextDelegate(IntPtr _connectionInfo, int* _size); private static nint ConnectionInfo_GetTextFallback(IntPtr _connectionInfo, int* _size) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetText", "ConnectionInfo_GetText SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort ConnectionInfo_GetVersionMajorDelegate(IntPtr _connectionInfo); + private static ushort ConnectionInfo_GetVersionMajorFallback(IntPtr _connectionInfo) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetVersionMajor", "ConnectionInfo_GetVersionMajor SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ushort ConnectionInfo_GetVersionMinorDelegate(IntPtr _connectionInfo); + private static ushort ConnectionInfo_GetVersionMinorFallback(IntPtr _connectionInfo) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetVersionMinor", "ConnectionInfo_GetVersionMinor SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte ConnectionInfo_IsAcceptedDelegate(IntPtr _connectionInfo); private static byte ConnectionInfo_IsAcceptedFallback(IntPtr _connectionInfo) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_IsAccepted", "ConnectionInfo_IsAccepted SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void ConnectionInfo_SetTextDelegate(IntPtr _connectionInfo, nint _text); @@ -1257,8 +1264,8 @@ public unsafe class ServerLibrary : IServerLibrary private static void Player_ClearTasksFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_ClearTasks", "Player_ClearTasks SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_DeallocAmmoFlagsDelegate(nint _ammoFlags); private static void Player_DeallocAmmoFlagsFallback(nint _ammoFlags) => throw new Exceptions.OutdatedSdkException("Player_DeallocAmmoFlags", "Player_DeallocAmmoFlags SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_DeallocVehicleModelInfoDelegate(nint _decoInfo); - private static void Player_DeallocVehicleModelInfoFallback(nint _decoInfo) => throw new Exceptions.OutdatedSdkException("Player_DeallocVehicleModelInfo", "Player_DeallocVehicleModelInfo SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_DeallocDecorationDelegate(nint _decoInfo); + private static void Player_DeallocDecorationFallback(nint _decoInfo) => throw new Exceptions.OutdatedSdkException("Player_DeallocDecoration", "Player_DeallocDecoration SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_DeleteLocalMetaDataDelegate(nint _player, nint _key); private static void Player_DeleteLocalMetaDataFallback(nint _player, nint _key) => throw new Exceptions.OutdatedSdkException("Player_DeleteLocalMetaData", "Player_DeleteLocalMetaData SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_DespawnDelegate(nint _player); @@ -1693,6 +1700,8 @@ public unsafe class ServerLibrary : IServerLibrary private static void Vehicle_SetArmoredWindowHealthFallback(nint _vehicle, byte _windowId, float _health) => throw new Exceptions.OutdatedSdkException("Vehicle_SetArmoredWindowHealth", "Vehicle_SetArmoredWindowHealth SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Vehicle_SetArmoredWindowShootCountDelegate(nint _vehicle, byte _windowId, byte _count); private static void Vehicle_SetArmoredWindowShootCountFallback(nint _vehicle, byte _windowId, byte _count) => throw new Exceptions.OutdatedSdkException("Vehicle_SetArmoredWindowShootCount", "Vehicle_SetArmoredWindowShootCount SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Vehicle_SetBadgeDelegate(nint _vehicle, uint _textureDictionary, uint _texture, VehicleBadgePosition[] vehicleBadgePosition, ushort _size); + private static void Vehicle_SetBadgeFallback(nint _vehicle, uint _textureDictionary, uint _texture, VehicleBadgePosition[] vehicleBadgePosition, ushort _size) => throw new Exceptions.OutdatedSdkException("Vehicle_SetBadge", "Vehicle_SetBadge SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Vehicle_SetBoatAnchorDelegate(nint _vehicle, byte _state); private static void Vehicle_SetBoatAnchorFallback(nint _vehicle, byte _state) => throw new Exceptions.OutdatedSdkException("Vehicle_SetBoatAnchor", "Vehicle_SetBoatAnchor SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Vehicle_SetBodyAdditionalHealthDelegate(nint _vehicle, uint _health); @@ -1896,7 +1905,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 != 554522947139118248UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13630124142623987997UL) 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); @@ -1917,7 +1926,6 @@ public ServerLibrary(Dictionary funcTable) ConnectionInfo_GetAuthToken = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8194004283135524333UL, ConnectionInfo_GetAuthTokenFallback); ConnectionInfo_GetBaseObject = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12397496971801767822UL, ConnectionInfo_GetBaseObjectFallback); ConnectionInfo_GetBranch = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 1577439110274874884UL, ConnectionInfo_GetBranchFallback); - ConnectionInfo_GetBuild = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 14204191833155309704UL, ConnectionInfo_GetBuildFallback); ConnectionInfo_GetCdnUrl = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 5988681596904693572UL, ConnectionInfo_GetCdnUrlFallback); ConnectionInfo_GetCloudAuthResult = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7415605567391116903UL, ConnectionInfo_GetCloudAuthResultFallback); ConnectionInfo_GetCloudID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7998061229071288348UL, ConnectionInfo_GetCloudIDFallback); @@ -1932,6 +1940,8 @@ public ServerLibrary(Dictionary funcTable) ConnectionInfo_GetSocialId = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10464338232675126241UL, ConnectionInfo_GetSocialIdFallback); ConnectionInfo_GetSocialName = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12079559810042444284UL, ConnectionInfo_GetSocialNameFallback); ConnectionInfo_GetText = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15232547943166326905UL, ConnectionInfo_GetTextFallback); + ConnectionInfo_GetVersionMajor = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17632900701407653009UL, ConnectionInfo_GetVersionMajorFallback); + ConnectionInfo_GetVersionMinor = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 5117935778920368749UL, ConnectionInfo_GetVersionMinorFallback); ConnectionInfo_IsAccepted = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8806505177995284480UL, ConnectionInfo_IsAcceptedFallback); ConnectionInfo_SetText = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 13680172646316204766UL, ConnectionInfo_SetTextFallback); Core_AddClientConfigKey = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17282535440709139868UL, Core_AddClientConfigKeyFallback); @@ -2050,7 +2060,7 @@ public ServerLibrary(Dictionary funcTable) Player_ClearProps = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 14293729102633233291UL, Player_ClearPropsFallback); Player_ClearTasks = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2394928316223850939UL, Player_ClearTasksFallback); Player_DeallocAmmoFlags = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17674808600712417948UL, Player_DeallocAmmoFlagsFallback); - Player_DeallocVehicleModelInfo = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10260708090721922895UL, Player_DeallocVehicleModelInfoFallback); + Player_DeallocDecoration = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 11055092498025975234UL, Player_DeallocDecorationFallback); Player_DeleteLocalMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 18350138927152444768UL, Player_DeleteLocalMetaDataFallback); Player_Despawn = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 10068978925729858744UL, Player_DespawnFallback); Player_GetAmmo = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6890209545812653225UL, Player_GetAmmoFallback); @@ -2268,6 +2278,7 @@ public ServerLibrary(Dictionary funcTable) Vehicle_Repair = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 277481303661922113UL, Vehicle_RepairFallback); Vehicle_SetArmoredWindowHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 1070345202824576095UL, Vehicle_SetArmoredWindowHealthFallback); Vehicle_SetArmoredWindowShootCount = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4149223353503655708UL, Vehicle_SetArmoredWindowShootCountFallback); + Vehicle_SetBadge = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15010482901293452804UL, Vehicle_SetBadgeFallback); Vehicle_SetBoatAnchor = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16890059088943800731UL, Vehicle_SetBoatAnchorFallback); Vehicle_SetBodyAdditionalHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 5545167983491514394UL, Vehicle_SetBodyAdditionalHealthFallback); Vehicle_SetBodyHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 13734895793996634557UL, Vehicle_SetBodyHealthFallback); diff --git a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs index 5cc08ebd5..ac99219f9 100644 --- a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs @@ -1,5 +1,6 @@ // ReSharper disable InconsistentNaming using AltV.Net.Data; +using AltV.Net.CApi.Data; using System.Numerics; using System.Runtime.InteropServices; using AltV.Net.Elements.Args; @@ -424,7 +425,7 @@ public unsafe interface ISharedLibrary public unsafe class SharedLibrary : ISharedLibrary { - public readonly uint Methods = 1755; + public readonly uint Methods = 1767; public delegate* unmanaged[Cdecl] Audio_GetID { get; } public delegate* unmanaged[Cdecl] AudioAttachedOutput_GetID { get; } public delegate* unmanaged[Cdecl] AudioFilter_GetID { get; } @@ -1664,7 +1665,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 != 554522947139118248UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13630124142623987997UL) 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); diff --git a/api/AltV.Net.CApi/Native/AltV.Resource.cs b/api/AltV.Net.CApi/Native/AltV.Resource.cs index 1d64a5db9..f3cf4dac4 100644 --- a/api/AltV.Net.CApi/Native/AltV.Resource.cs +++ b/api/AltV.Net.CApi/Native/AltV.Resource.cs @@ -27,7 +27,7 @@ internal delegate void CheckpointDelegate(IntPtr checkpointPointer, IntPtr entit internal delegate void PlayerConnectDelegate(IntPtr playerPointer, string reason); internal delegate void PlayerConnectDeniedDelegate(PlayerConnectDeniedReason reason, string name, string ip, - ulong passwordHash, byte isDebug, string branch, uint majorVersion, string cdnUrl, long discordId); + ulong passwordHash, byte isDebug, string branch, ushort versionMajor, ushort versionMinor, string cdnUrl, long discordId); internal delegate void ResourceEventDelegate(IntPtr resourcePointer); diff --git a/api/AltV.Net.Client/Alt.Globals.cs b/api/AltV.Net.Client/Alt.Globals.cs index dd48c46be..583bf43ed 100644 --- a/api/AltV.Net.Client/Alt.Globals.cs +++ b/api/AltV.Net.Client/Alt.Globals.cs @@ -1,5 +1,6 @@ using System.Numerics; using AltV.Net.Client.Elements.Data; +using AltV.Net.Client.Elements.Interfaces; using AltV.Net.Data; namespace AltV.Net.Client @@ -80,6 +81,19 @@ public static partial class Alt public static uint GetPoolCount(string pool) => Core.GetPoolCount(pool); public static uint[] GetPoolEntities(string pool) => Core.GetPoolEntities(pool); + public static uint[] GetVoicePlayers() => Core.GetVoicePlayers(); + public static void RemoveVoicePlayer(uint playerRemoteId) => Core.RemoveVoicePlayer(playerRemoteId); + public static float GetVoiceSpatialVolume(uint playerRemoteId) => Core.GetVoiceSpatialVolume(playerRemoteId); + public static void SetVoiceSpatialVolume(uint playerRemoteId, float volume) => Core.SetVoiceSpatialVolume(playerRemoteId, volume); + public static float GetVoiceNonSpatialVolume(uint playerRemoteId) => Core.GetVoiceNonSpatialVolume(playerRemoteId); + public static void SetVoiceNonSpatialVolume(uint playerRemoteId, float volume) => Core.SetVoiceNonSpatialVolume(playerRemoteId, volume); + + public static void AddVoiceFilter(uint playerRemoteId, IAudioFilter filter) => Core.AddVoiceFilter(playerRemoteId, filter); + public static void RemoveVoiceFilter(uint playerRemoteId) => Core.RemoveVoiceFilter(playerRemoteId); + public static IAudioFilter GetVoiceFilter(uint playerRemoteId) => Core.GetVoiceFilter(playerRemoteId); + + public static void UpdateClipContext(Dictionary context) => Core.UpdateClipContext(context); + public static MapZoomData GetMapZoomData(uint id) => Core.GetMapZoomData(id); public static MapZoomData GetMapZoomData(string alias) => Core.GetMapZoomData(alias); public static void ResetAllMapZoomData() => Core.ResetAllMapZoomData(); diff --git a/api/AltV.Net.Client/Core.Globals.cs b/api/AltV.Net.Client/Core.Globals.cs index 7f175f151..bf50b5b79 100644 --- a/api/AltV.Net.Client/Core.Globals.cs +++ b/api/AltV.Net.Client/Core.Globals.cs @@ -585,6 +585,94 @@ public uint[] GetPoolEntities(string pool) } } + public uint[] GetVoicePlayers() + { + unsafe + { + uint size = 0; + var voicePlayersPtr = IntPtr.Zero; + Library.Client.Core_GetVoicePlayers(NativePointer, &voicePlayersPtr, &size); + + var uintArray = new UIntArray + { + data = voicePlayersPtr, + size = size, + capacity = size + }; + + var result = uintArray.ToArray(); + + Library.Shared.FreeUInt32Array(voicePlayersPtr); + return result; + } + } + + public void RemoveVoicePlayer(uint playerRemoteId) + { + unsafe + { + Library.Client.Core_RemoveVoicePlayer(NativePointer, playerRemoteId); + } + } + + public float GetVoiceSpatialVolume(uint playerRemoteId) + { + unsafe + { + return Library.Client.Core_GetVoiceSpatialVolume(NativePointer, playerRemoteId); + } + } + + public void SetVoiceSpatialVolume(uint playerRemoteId, float volume) + { + unsafe + { + Library.Client.Core_SetVoiceSpatialVolume(NativePointer, playerRemoteId, volume); + } + } + + public float GetVoiceNonSpatialVolume(uint playerRemoteId) + { + unsafe + { + return Library.Client.Core_GetVoiceNonSpatialVolume(NativePointer, playerRemoteId); + } + } + + public void SetVoiceNonSpatialVolume(uint playerRemoteId, float volume) + { + unsafe + { + Library.Client.Core_SetVoiceNonSpatialVolume(NativePointer, playerRemoteId, volume); + } + } + + public void AddVoiceFilter(uint playerRemoteId, IAudioFilter filter) + { + unsafe + { + Library.Client.Core_AddVoiceFilter(NativePointer, playerRemoteId, filter.AudioFilterNativePointer); + } + } + + public void RemoveVoiceFilter(uint playerRemoteId) + { + unsafe + { + Library.Client.Core_RemoveVoiceFilter(NativePointer, playerRemoteId); + } + } + + public IAudioFilter GetVoiceFilter(uint playerRemoteId) + { + unsafe + { + uint pId = default; + var ptr = Library.Client.Core_GetVoiceFilter(NativePointer, playerRemoteId); + return PoolManager.AudioFilter.GetOrCreate(this, ptr, pId); + } + } + public int MsPerGameMinute { get diff --git a/api/AltV.Net.Client/Core.cs b/api/AltV.Net.Client/Core.cs index 71e1bb461..0f571b97e 100644 --- a/api/AltV.Net.Client/Core.cs +++ b/api/AltV.Net.Client/Core.cs @@ -704,6 +704,34 @@ public IColShape CreateColShapeSphere(Vector3 position, float radius) return PoolManager.ColShape.Create(this, ptr, id); } + public void UpdateClipContext(Dictionary context) + { + unsafe + { + var data = new Dictionary(); + + var keys = new IntPtr[context.Count]; + var values = new IntPtr[context.Count]; + + for (var i = 0; i < context.Count; i++) + { + var keyptr = MemoryUtils.StringToHGlobalUtf8(context.ElementAt(i).Key); + var valueptr = MemoryUtils.StringToHGlobalUtf8(context.ElementAt(i).Value); + keys[i] = keyptr; + values[i] = valueptr; + data.Add(keyptr, valueptr); + } + + Library.Client.Core_UpdateClipContext(NativePointer, keys, values,(uint)data.Count); + + foreach (var dataValue in data) + { + Marshal.FreeHGlobal(dataValue.Key); + Marshal.FreeHGlobal(dataValue.Value); + } + } + } + #endregion #region TriggerServerEvent diff --git a/api/AltV.Net.Client/ICore.cs b/api/AltV.Net.Client/ICore.cs index 1c430793a..7029d7ec3 100644 --- a/api/AltV.Net.Client/ICore.cs +++ b/api/AltV.Net.Client/ICore.cs @@ -216,5 +216,18 @@ ILocalObject CreateLocalObject(uint modelHash, Position position, Rotation rotat uint GetPoolSize(string pool); uint GetPoolCount(string pool); uint[] GetPoolEntities(string pool); + uint[] GetVoicePlayers(); + void RemoveVoicePlayer(uint playerRemoteId); + + float GetVoiceSpatialVolume(uint playerRemoteId); + void SetVoiceSpatialVolume(uint playerRemoteId, float volume); + float GetVoiceNonSpatialVolume(uint playerRemoteId); + void SetVoiceNonSpatialVolume(uint playerRemoteId, float volume); + + void AddVoiceFilter(uint playerRemoteId, IAudioFilter filter); + void RemoveVoiceFilter(uint playerRemoteId); + IAudioFilter GetVoiceFilter(uint playerRemoteId); + + void UpdateClipContext(Dictionary context); } } \ No newline at end of file diff --git a/api/AltV.Net.Mock/MockConnectionInfo.cs b/api/AltV.Net.Mock/MockConnectionInfo.cs index 4113ce9fc..b3769f7c5 100644 --- a/api/AltV.Net.Mock/MockConnectionInfo.cs +++ b/api/AltV.Net.Mock/MockConnectionInfo.cs @@ -22,7 +22,8 @@ public MockConnectionInfo(ICore core, IntPtr nativePointer, uint id) : base(core public string AuthToken { get; } public bool IsDebug { get; } public string Branch { get; } - public uint Build { get; } + public ushort VersionMajor { get; } + public ushort VersionMinor { get; } public string CdnUrl { get; } public ulong PasswordHash { get; } public string Ip { get; } diff --git a/api/AltV.Net.Shared/Elements/Args/MValueObjectReader.cs b/api/AltV.Net.Shared/Elements/Args/MValueObjectReader.cs index 82178f30d..2ec7d6496 100644 --- a/api/AltV.Net.Shared/Elements/Args/MValueObjectReader.cs +++ b/api/AltV.Net.Shared/Elements/Args/MValueObjectReader.cs @@ -19,7 +19,7 @@ private interface IReadableMValue object Peek(); } - private struct MValueArrayReader : IReadableMValue + private class MValueArrayReader : IReadableMValue { private readonly object[] values; @@ -53,7 +53,7 @@ public object Peek() } } - private struct MValueDictionaryReader : IReadableMValue + private class MValueDictionaryReader : IReadableMValue { private readonly object[] values; @@ -102,14 +102,14 @@ public int GetNameSize() { return names.Length - nameIndex; } - + public object Peek() { return values[index]; } } - private struct MValueStartReader : IReadableMValue + private class MValueStartReader : IReadableMValue { private object obj; @@ -136,7 +136,7 @@ public void SkipValue() obj = null; size = 0; } - + public object Peek() { return obj; @@ -207,7 +207,7 @@ private void CheckObject() throw new InvalidDataException("Not inside a object or array"); } } - + private void CheckArray() { if (!insideObject && readableMValue.Peek().GetType() != typeof(object[])) @@ -352,7 +352,7 @@ public ulong NextULong() return value; } - + public Position NextPosition() { CheckObjectOrArray(); @@ -366,7 +366,7 @@ public Position NextPosition() return value; } - + public Rgba NextRgba() { CheckObjectOrArray(); diff --git a/api/AltV.Net/Alt.RegisterEvents.cs b/api/AltV.Net/Alt.RegisterEvents.cs index 7c833e2ad..e38127c8e 100644 --- a/api/AltV.Net/Alt.RegisterEvents.cs +++ b/api/AltV.Net/Alt.RegisterEvents.cs @@ -338,14 +338,9 @@ public static void RegisterEvents(object target) scriptFunction.Set(damage); scriptFunction.Set(shotOffset); scriptFunction.Set(damageOffset); - if (scriptFunction.Call() is uint uintValue) + if (scriptFunction.Call() is WeaponDamageResponse response) { - return uintValue; - } - - if (scriptFunction.Call() is bool boolValue) - { - return boolValue; + return response; } return 0; diff --git a/api/AltV.Net/Core.Events.cs b/api/AltV.Net/Core.Events.cs index 4b8c3949b..b55ce03b6 100644 --- a/api/AltV.Net/Core.Events.cs +++ b/api/AltV.Net/Core.Events.cs @@ -255,21 +255,21 @@ public virtual void OnPlayerConnectEvent(IPlayer player, string reason) } public void OnPlayerConnectDenied(PlayerConnectDeniedReason reason, string name, string ip, ulong passwordHash, - bool isDebug, string branch, uint majorVersion, string cdnUrl, long discordId) + bool isDebug, string branch, ushort versionMajor, ushort versionMinor, string cdnUrl, long discordId) { - OnPlayerConnectDeniedEvent(reason, name, ip, passwordHash, isDebug, branch, majorVersion, cdnUrl, + OnPlayerConnectDeniedEvent(reason, name, ip, passwordHash, isDebug, branch, versionMajor, versionMinor, cdnUrl, discordId); } public virtual void OnPlayerConnectDeniedEvent(PlayerConnectDeniedReason reason, string name, string ip, - ulong passwordHash, bool isDebug, string branch, uint majorVersion, string cdnUrl, long discordId) + ulong passwordHash, bool isDebug, string branch, ushort versionMajor, ushort versionMinor, string cdnUrl, long discordId) { foreach (var @delegate in PlayerConnectDeniedEventHandler.GetEvents()) { try { - @delegate(reason, name, ip, passwordHash, isDebug, branch, majorVersion, cdnUrl, discordId); + @delegate(reason, name, ip, passwordHash, isDebug, branch, versionMajor, versionMinor, cdnUrl, discordId); } catch (TargetInvocationException exception) { diff --git a/api/AltV.Net/Data/Decoration.cs b/api/AltV.Net/Data/Decoration.cs index 78f700ef0..15ef7935c 100644 --- a/api/AltV.Net/Data/Decoration.cs +++ b/api/AltV.Net/Data/Decoration.cs @@ -7,13 +7,15 @@ internal readonly struct DecorationInternal { private readonly uint Collection; private readonly uint Overlay; + private readonly byte Count; public Decoration ToPublic() { return new Decoration { Collection = Collection, - Overlay = Overlay + Overlay = Overlay, + Count = Count }; } } @@ -22,4 +24,5 @@ public struct Decoration { public uint Collection; public uint Overlay; + public byte Count; } \ No newline at end of file diff --git a/api/AltV.Net/Elements/Entities/ConnectionInfo.cs b/api/AltV.Net/Elements/Entities/ConnectionInfo.cs index df2598e47..701ceb890 100644 --- a/api/AltV.Net/Elements/Entities/ConnectionInfo.cs +++ b/api/AltV.Net/Elements/Entities/ConnectionInfo.cs @@ -120,13 +120,24 @@ public string Branch } } - public uint Build + public ushort VersionMajor { get { unsafe { - return Core.Library.Server.ConnectionInfo_GetBuild(ConnectionInfoNativePointer); + return Core.Library.Server.ConnectionInfo_GetVersionMajor(ConnectionInfoNativePointer); + } + } + } + + public ushort VersionMinor + { + get + { + unsafe + { + return Core.Library.Server.ConnectionInfo_GetVersionMinor(ConnectionInfoNativePointer); } } } diff --git a/api/AltV.Net/Elements/Entities/IConnectionInfo.cs b/api/AltV.Net/Elements/Entities/IConnectionInfo.cs index c539f37c2..bceb3b01a 100644 --- a/api/AltV.Net/Elements/Entities/IConnectionInfo.cs +++ b/api/AltV.Net/Elements/Entities/IConnectionInfo.cs @@ -15,7 +15,8 @@ public interface IConnectionInfo : IBaseObject string AuthToken { get; } bool IsDebug { get; } string Branch { get; } - uint Build { get; } + ushort VersionMajor { get; } + ushort VersionMinor { get; } string CdnUrl { get; } ulong PasswordHash { get; } string Ip { get; } diff --git a/api/AltV.Net/Elements/Entities/IVehicle.cs b/api/AltV.Net/Elements/Entities/IVehicle.cs index b0f721704..3a215a3ea 100644 --- a/api/AltV.Net/Elements/Entities/IVehicle.cs +++ b/api/AltV.Net/Elements/Entities/IVehicle.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Numerics; +using AltV.Net.CApi.Data; using AltV.Net.Data; using AltV.Net.Enums; using AltV.Net.Shared.Elements.Entities; @@ -854,5 +855,23 @@ NumberPlateStyle GetNumberPlateStyleExt() => float BrakeLevel { get; } List Passengers { get; } + + /// + /// Set badges to vehicle + /// + /// The hash of textureDictionary + /// The hash of texture + /// The array of badge position. Maximum is 4 + /// When badge postion is more the 4 + void SetBage(string textureDictionary, string texture, VehicleBadgePosition[] vehicleBadgePosition); + + /// + /// Set badges to vehicle + /// + /// The hash of textureDictionary + /// The hash of texture + /// The array of badge position. Maximum is 4 + /// When badge postion is more the 4 + void SetBage(uint textureDictionary, uint texture, VehicleBadgePosition[] vehicleBadgePosition); } } \ No newline at end of file diff --git a/api/AltV.Net/Elements/Entities/Player.cs b/api/AltV.Net/Elements/Entities/Player.cs index 5c813e750..4e3f5e68c 100644 --- a/api/AltV.Net/Elements/Entities/Player.cs +++ b/api/AltV.Net/Elements/Entities/Player.cs @@ -365,13 +365,12 @@ public Decoration[] GetDecorations() var decorations = new Decoration[size]; var data = new IntPtr[size]; Marshal.Copy(ptr, data, 0, (int) size); - for (ulong i = 0; i < size; i++) { - var structure = Marshal.PtrToStructure(ptr); + var structure = Marshal.PtrToStructure(data[i]); decorations[i] = structure.ToPublic(); } - Core.Library.Shared.FreePlayerArray(ptr); + Core.Library.Server.Player_DeallocDecoration(ptr); return decorations; } } diff --git a/api/AltV.Net/Elements/Entities/Vehicle.cs b/api/AltV.Net/Elements/Entities/Vehicle.cs index 912f26586..4a931c54e 100644 --- a/api/AltV.Net/Elements/Entities/Vehicle.cs +++ b/api/AltV.Net/Elements/Entities/Vehicle.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Numerics; using System.Runtime.InteropServices; +using AltV.Net.CApi.Data; using AltV.Net.Data; using AltV.Net.Enums; using AltV.Net.Native; @@ -2085,6 +2086,24 @@ public List Passengers } } + public void SetBage(string textureDictionary, string texture, VehicleBadgePosition[] vehicleBadgePosition) + { + SetBage(Alt.Hash(textureDictionary), Alt.Hash(texture), vehicleBadgePosition); + } + + public void SetBage(uint textureDictionary, uint texture, VehicleBadgePosition[] vehicleBadgePosition) + { + if (vehicleBadgePosition.Length > 4) + { + throw new ArgumentOutOfRangeException( + $"{nameof(vehicleBadgePosition)} should be have maximum 4 badge positions"); + } + unsafe + { + Core.Library.Server.Vehicle_SetBadge(VehicleNativePointer, textureDictionary, texture, vehicleBadgePosition, (ushort)vehicleBadgePosition.Length); + } + } + public override void SetCached(IntPtr cachedVehicle) { this.VehicleNativePointer = cachedVehicle; diff --git a/api/AltV.Net/Events/Events.cs b/api/AltV.Net/Events/Events.cs index 84cc5eb2a..85e0245ce 100644 --- a/api/AltV.Net/Events/Events.cs +++ b/api/AltV.Net/Events/Events.cs @@ -14,7 +14,7 @@ namespace AltV.Net.Events public delegate void PlayerConnectDelegate(IPlayer player, string reason); public delegate void PlayerConnectDeniedDelegate(PlayerConnectDeniedReason reason, string name, string ip, - ulong passwordHash, bool isDebug, string branch, uint majorVersion, string cdnUrl, long discordId); + ulong passwordHash, bool isDebug, string branch, ushort versionMajor, ushort versionMinor, string cdnUrl, long discordId); public delegate void ResourceEventDelegate(INativeResource resource); diff --git a/api/AltV.Net/ModuleWrapper.cs b/api/AltV.Net/ModuleWrapper.cs index 1fe63a5e4..0b57cbb32 100644 --- a/api/AltV.Net/ModuleWrapper.cs +++ b/api/AltV.Net/ModuleWrapper.cs @@ -418,9 +418,9 @@ public static void OnPlayerDimensionChange(IntPtr player, int oldDimension, int _core.OnPlayerDimensionChange(player, oldDimension, newDimension); } - public static void OnPlayerConnectDenied(PlayerConnectDeniedReason reason, string name, string ip, ulong passwordHash, byte isDebug, string branch, uint majorVersion, string cdnUrl, long discordId) + public static void OnPlayerConnectDenied(PlayerConnectDeniedReason reason, string name, string ip, ulong passwordHash, byte isDebug, string branch, ushort versionMajor, ushort versionMinor, string cdnUrl, long discordId) { - _core.OnPlayerConnectDenied(reason, name, ip, passwordHash, isDebug == 1, branch, majorVersion, cdnUrl, + _core.OnPlayerConnectDenied(reason, name, ip, passwordHash, isDebug == 1, branch, versionMajor, versionMinor, cdnUrl, discordId); } diff --git a/runtime b/runtime index d8a3a7e32..b6fda801c 160000 --- a/runtime +++ b/runtime @@ -1 +1 @@ -Subproject commit d8a3a7e32654be5409ce9ccdb0b21474243e46d2 +Subproject commit b6fda801c5f6ddba921903aa87877f45e62c52c3