From a60f04af1a8cebf16fa862e2f8470abbb7153474 Mon Sep 17 00:00:00 2001 From: Till Schreiber Date: Thu, 31 Oct 2024 13:05:04 +0100 Subject: [PATCH] ALTV-469 - add new hwid --- .../Elements/Entities/AsyncConnectionInfo.cs | 14 +++++++++++++ .../Elements/Entities/AsyncPlayer.cs | 12 +++++++++++ api/AltV.Net.CApi/Libraries/ClientLibrary.cs | 4 ++-- api/AltV.Net.CApi/Libraries/ServerLibrary.cs | 14 +++++++++++-- api/AltV.Net.CApi/Libraries/SharedLibrary.cs | 4 ++-- .../Elements/Entities/ConnectionInfo.cs | 20 ++++++++++++++++--- .../Elements/Entities/IConnectionInfo.cs | 1 + api/AltV.Net/Elements/Entities/IPlayer.cs | 2 ++ api/AltV.Net/Elements/Entities/Player.cs | 14 +++++++++++++ runtime | 2 +- 10 files changed, 77 insertions(+), 10 deletions(-) diff --git a/api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs b/api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs index b5e732b6f..a10907eb7 100644 --- a/api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs +++ b/api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs @@ -63,6 +63,19 @@ public ulong HardwareIdExHash } } } + + public string HardwareId3 + { + get + { + lock (ConnectionInfo) + { + if (!AsyncContext.CheckIfExistsOrCachedNullable(ConnectionInfo)) return default; + return ConnectionInfo.HardwareId3; + } + } + } + public string AuthToken { get @@ -74,6 +87,7 @@ public string AuthToken } } } + public bool IsDebug { get diff --git a/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs b/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs index 1ef1cef3e..c5ef79853 100644 --- a/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs +++ b/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs @@ -100,6 +100,18 @@ public ulong HardwareIdExHash } } + public string HardwareId3 + { + get + { + lock (Player) + { + if (!AsyncContext.CheckIfExistsOrCachedNullable(Player)) return default; + return Player.HardwareId3; + } + } + } + public string AuthToken { get diff --git a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs index a01ac036d..643568c6c 100644 --- a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs @@ -938,7 +938,7 @@ public unsafe interface IClientLibrary public unsafe class ClientLibrary : IClientLibrary { - public readonly uint Methods = 1809; + public readonly uint Methods = 1811; public delegate* unmanaged[Cdecl] Audio_AddOutput { get; } public delegate* unmanaged[Cdecl] Audio_GetBaseObject { get; } public delegate* unmanaged[Cdecl] Audio_GetCurrentTime { get; } @@ -3717,7 +3717,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 != 10075699596264467259UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 2737407539021183714UL) 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); diff --git a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs index d58cebb15..40c34383f 100644 --- a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs @@ -35,6 +35,7 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] ConnectionInfo_GetCloudAuthResult { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetCloudID { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetDiscordUserID { get; } + public delegate* unmanaged[Cdecl] ConnectionInfo_GetHwid3 { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetHwIdExHash { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetHwIdHash { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetID { get; } @@ -194,6 +195,7 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] Player_GetHeadBlendData { get; } public delegate* unmanaged[Cdecl] Player_GetHeadBlendPaletteColor { get; } public delegate* unmanaged[Cdecl] Player_GetHeadOverlay { get; } + public delegate* unmanaged[Cdecl] Player_GetHwid3 { get; } public delegate* unmanaged[Cdecl] Player_GetHwidExHash { get; } public delegate* unmanaged[Cdecl] Player_GetHwidHash { get; } public delegate* unmanaged[Cdecl] Player_GetInteriorLocation { get; } @@ -488,7 +490,7 @@ public unsafe interface IServerLibrary public unsafe class ServerLibrary : IServerLibrary { - public readonly uint Methods = 1809; + public readonly uint Methods = 1811; public delegate* unmanaged[Cdecl] BaseObject_DeleteSyncedMetaData { get; } public delegate* unmanaged[Cdecl] BaseObject_SetMultipleSyncedMetaData { get; } public delegate* unmanaged[Cdecl] BaseObject_SetSyncedMetaData { get; } @@ -513,6 +515,7 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] ConnectionInfo_GetCloudAuthResult { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetCloudID { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetDiscordUserID { get; } + public delegate* unmanaged[Cdecl] ConnectionInfo_GetHwid3 { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetHwIdExHash { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetHwIdHash { get; } public delegate* unmanaged[Cdecl] ConnectionInfo_GetID { get; } @@ -672,6 +675,7 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] Player_GetHeadBlendData { get; } public delegate* unmanaged[Cdecl] Player_GetHeadBlendPaletteColor { get; } public delegate* unmanaged[Cdecl] Player_GetHeadOverlay { get; } + public delegate* unmanaged[Cdecl] Player_GetHwid3 { get; } public delegate* unmanaged[Cdecl] Player_GetHwidExHash { get; } public delegate* unmanaged[Cdecl] Player_GetHwidHash { get; } public delegate* unmanaged[Cdecl] Player_GetInteriorLocation { get; } @@ -1010,6 +1014,8 @@ public unsafe class ServerLibrary : IServerLibrary private static nint ConnectionInfo_GetCloudIDFallback(IntPtr _connectionInfo, int* _size) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetCloudID", "ConnectionInfo_GetCloudID SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate long ConnectionInfo_GetDiscordUserIDDelegate(IntPtr _connectionInfo); private static long ConnectionInfo_GetDiscordUserIDFallback(IntPtr _connectionInfo) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetDiscordUserID", "ConnectionInfo_GetDiscordUserID SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint ConnectionInfo_GetHwid3Delegate(IntPtr _connectionInfo, int* _size); + private static nint ConnectionInfo_GetHwid3Fallback(IntPtr _connectionInfo, int* _size) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetHwid3", "ConnectionInfo_GetHwid3 SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong ConnectionInfo_GetHwIdExHashDelegate(IntPtr _connectionInfo); private static ulong ConnectionInfo_GetHwIdExHashFallback(IntPtr _connectionInfo) => throw new Exceptions.OutdatedSdkException("ConnectionInfo_GetHwIdExHash", "ConnectionInfo_GetHwIdExHash SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong ConnectionInfo_GetHwIdHashDelegate(IntPtr _connectionInfo); @@ -1328,6 +1334,8 @@ public unsafe class ServerLibrary : IServerLibrary private static void Player_GetHeadBlendPaletteColorFallback(nint _player, byte _id, Rgba* _headBlendPaletteColor) => throw new Exceptions.OutdatedSdkException("Player_GetHeadBlendPaletteColor", "Player_GetHeadBlendPaletteColor SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_GetHeadOverlayDelegate(nint _player, byte _overlayID, HeadOverlay* _headOverlay); private static void Player_GetHeadOverlayFallback(nint _player, byte _overlayID, HeadOverlay* _headOverlay) => throw new Exceptions.OutdatedSdkException("Player_GetHeadOverlay", "Player_GetHeadOverlay SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Player_GetHwid3Delegate(nint _player, int* _size); + private static nint Player_GetHwid3Fallback(nint _player, int* _size) => throw new Exceptions.OutdatedSdkException("Player_GetHwid3", "Player_GetHwid3 SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Player_GetHwidExHashDelegate(nint _player); private static ulong Player_GetHwidExHashFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_GetHwidExHash", "Player_GetHwidExHash SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Player_GetHwidHashDelegate(nint _player); @@ -1917,7 +1925,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 != 10075699596264467259UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 2737407539021183714UL) 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); @@ -1942,6 +1950,7 @@ public ServerLibrary(Dictionary funcTable) ConnectionInfo_GetCloudAuthResult = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7415605567391116903UL, ConnectionInfo_GetCloudAuthResultFallback); ConnectionInfo_GetCloudID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 7998061229071288348UL, ConnectionInfo_GetCloudIDFallback); ConnectionInfo_GetDiscordUserID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4175744399917476392UL, ConnectionInfo_GetDiscordUserIDFallback); + ConnectionInfo_GetHwid3 = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3230557606089997547UL, ConnectionInfo_GetHwid3Fallback); ConnectionInfo_GetHwIdExHash = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 3151831504154255688UL, ConnectionInfo_GetHwIdExHashFallback); ConnectionInfo_GetHwIdHash = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 11409383581668438027UL, ConnectionInfo_GetHwIdHashFallback); ConnectionInfo_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8080268107975854795UL, ConnectionInfo_GetIDFallback); @@ -2101,6 +2110,7 @@ public ServerLibrary(Dictionary funcTable) Player_GetHeadBlendData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12996031514192232278UL, Player_GetHeadBlendDataFallback); Player_GetHeadBlendPaletteColor = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6875264309357036667UL, Player_GetHeadBlendPaletteColorFallback); Player_GetHeadOverlay = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 18242810182906526031UL, Player_GetHeadOverlayFallback); + Player_GetHwid3 = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 13686597780873033455UL, Player_GetHwid3Fallback); Player_GetHwidExHash = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 424368865670330442UL, Player_GetHwidExHashFallback); Player_GetHwidHash = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 9546723288515311389UL, Player_GetHwidHashFallback); Player_GetInteriorLocation = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16961931856292652951UL, Player_GetInteriorLocationFallback); diff --git a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs index 40a28e93b..c503b1121 100644 --- a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs @@ -426,7 +426,7 @@ public unsafe interface ISharedLibrary public unsafe class SharedLibrary : ISharedLibrary { - public readonly uint Methods = 1809; + public readonly uint Methods = 1811; public delegate* unmanaged[Cdecl] Audio_GetID { get; } public delegate* unmanaged[Cdecl] AudioAttachedOutput_GetID { get; } public delegate* unmanaged[Cdecl] AudioFilter_GetID { get; } @@ -1669,7 +1669,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 != 10075699596264467259UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 2737407539021183714UL) 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/Elements/Entities/ConnectionInfo.cs b/api/AltV.Net/Elements/Entities/ConnectionInfo.cs index caffd25cb..72b89d7e6 100644 --- a/api/AltV.Net/Elements/Entities/ConnectionInfo.cs +++ b/api/AltV.Net/Elements/Entities/ConnectionInfo.cs @@ -11,7 +11,6 @@ namespace AltV.Net.Elements.Entities; public class ConnectionInfo : BaseObject, IConnectionInfo { - public IntPtr ConnectionInfoNativePointer { get; } public override IntPtr NativePointer => ConnectionInfoNativePointer; @@ -32,7 +31,8 @@ public static uint GetId(IntPtr pointer) } - public ConnectionInfo(ICore core, IntPtr nativePointer, uint id) : base(core, GetBaseObjectPointer(core, nativePointer), BaseObjectType.ConnectionInfo, id) + public ConnectionInfo(ICore core, IntPtr nativePointer, uint id) : base(core, + GetBaseObjectPointer(core, nativePointer), BaseObjectType.ConnectionInfo, id) { ConnectionInfoNativePointer = nativePointer; } @@ -83,6 +83,19 @@ public ulong HardwareIdExHash } } + public string HardwareId3 + { + get + { + unsafe + { + var size = 0; + return Core.PtrToStringUtf8AndFree( + Core.Library.Server.ConnectionInfo_GetHwid3(ConnectionInfoNativePointer, &size), size); + } + } + } + public string AuthToken { get @@ -274,7 +287,8 @@ public CloudAuthResult CloudAuthResult { unsafe { - return (CloudAuthResult)Core.Library.Server.ConnectionInfo_GetCloudAuthResult(ConnectionInfoNativePointer); + return (CloudAuthResult)Core.Library.Server.ConnectionInfo_GetCloudAuthResult( + ConnectionInfoNativePointer); } } } diff --git a/api/AltV.Net/Elements/Entities/IConnectionInfo.cs b/api/AltV.Net/Elements/Entities/IConnectionInfo.cs index bceb3b01a..1ca0d477f 100644 --- a/api/AltV.Net/Elements/Entities/IConnectionInfo.cs +++ b/api/AltV.Net/Elements/Entities/IConnectionInfo.cs @@ -12,6 +12,7 @@ public interface IConnectionInfo : IBaseObject ulong SocialId { get; } ulong HardwareIdHash { get; } ulong HardwareIdExHash { get; } + string HardwareId3 { get; } string AuthToken { get; } bool IsDebug { get; } string Branch { get; } diff --git a/api/AltV.Net/Elements/Entities/IPlayer.cs b/api/AltV.Net/Elements/Entities/IPlayer.cs index d3eff7a78..43c374e9e 100644 --- a/api/AltV.Net/Elements/Entities/IPlayer.cs +++ b/api/AltV.Net/Elements/Entities/IPlayer.cs @@ -36,6 +36,8 @@ public interface IPlayer : ISharedPlayer, IEntity ulong HardwareIdExHash { get; } + string HardwareId3 { get; } + string AuthToken { get; } long DiscordId { get; } diff --git a/api/AltV.Net/Elements/Entities/Player.cs b/api/AltV.Net/Elements/Entities/Player.cs index ba8fd7459..df148ff2c 100644 --- a/api/AltV.Net/Elements/Entities/Player.cs +++ b/api/AltV.Net/Elements/Entities/Player.cs @@ -536,6 +536,20 @@ public ulong HardwareIdExHash } } + public string HardwareId3 + { + get + { + unsafe + { + CheckIfEntityExistsOrCached(); + var size = 0; + return Core.PtrToStringUtf8AndFree( + Core.Library.Server.Player_GetHwid3(PlayerNativePointer, &size), size); + } + } + } + public string AuthToken { get diff --git a/runtime b/runtime index edb6ab0a6..96c808e0a 160000 --- a/runtime +++ b/runtime @@ -1 +1 @@ -Subproject commit edb6ab0a60f0115831492147b9621f7cebd1e2eb +Subproject commit 96c808e0adc34c5bdf8b17f36aa26f1592022bc8