Skip to content

Commit 2ad94dd

Browse files
committed
Add GetVoiceConnectionState
1 parent 50a1264 commit 2ad94dd

File tree

8 files changed

+24
-7
lines changed

8 files changed

+24
-7
lines changed

api/AltV.Net.CApi/Libraries/ClientLibrary.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ public unsafe interface IClientLibrary
867867

868868
public unsafe class ClientLibrary : IClientLibrary
869869
{
870-
public readonly uint Methods = 1625;
870+
public readonly uint Methods = 1626;
871871
public delegate* unmanaged[Cdecl]<nint, nint, void> Audio_AddOutput { get; }
872872
public delegate* unmanaged[Cdecl]<nint, nint> Audio_GetBaseObject { get; }
873873
public delegate* unmanaged[Cdecl]<nint, double> Audio_GetCurrentTime { get; }
@@ -3436,7 +3436,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
34363436
public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
34373437
{
34383438
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
3439-
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 620890210989099442UL) Outdated = true;
3439+
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 9326924779181455521UL) Outdated = true;
34403440
Audio_AddOutput = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<Audio_AddOutputDelegate>(funcTable, 9914412815391408844UL, Audio_AddOutputFallback);
34413441
Audio_GetBaseObject = (delegate* unmanaged[Cdecl]<nint, nint>) GetUnmanagedPtr<Audio_GetBaseObjectDelegate>(funcTable, 6330360502401226894UL, Audio_GetBaseObjectFallback);
34423442
Audio_GetCurrentTime = (delegate* unmanaged[Cdecl]<nint, double>) GetUnmanagedPtr<Audio_GetCurrentTimeDelegate>(funcTable, 2944324482134975819UL, Audio_GetCurrentTimeFallback);

api/AltV.Net.CApi/Libraries/ServerLibrary.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ public unsafe interface IServerLibrary
434434

435435
public unsafe class ServerLibrary : IServerLibrary
436436
{
437-
public readonly uint Methods = 1625;
437+
public readonly uint Methods = 1626;
438438
public delegate* unmanaged[Cdecl]<nint, nint, void> BaseObject_DeleteSyncedMetaData { get; }
439439
public delegate* unmanaged[Cdecl]<nint, nint, nint, void> BaseObject_SetSyncedMetaData { get; }
440440
public delegate* unmanaged[Cdecl]<nint, nint, void> Blip_AddTargetPlayer { get; }
@@ -1704,7 +1704,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
17041704
public ServerLibrary(Dictionary<ulong, IntPtr> funcTable)
17051705
{
17061706
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
1707-
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 620890210989099442UL) Outdated = true;
1707+
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 9326924779181455521UL) Outdated = true;
17081708
BaseObject_DeleteSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<BaseObject_DeleteSyncedMetaDataDelegate>(funcTable, 8228424877092269355UL, BaseObject_DeleteSyncedMetaDataFallback);
17091709
BaseObject_SetSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint, nint, void>) GetUnmanagedPtr<BaseObject_SetSyncedMetaDataDelegate>(funcTable, 8002999088966424231UL, BaseObject_SetSyncedMetaDataFallback);
17101710
Blip_AddTargetPlayer = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<Blip_AddTargetPlayerDelegate>(funcTable, 12411235729553386187UL, Blip_AddTargetPlayerFallback);

api/AltV.Net.CApi/Libraries/SharedLibrary.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public unsafe interface ISharedLibrary
165165
public delegate* unmanaged[Cdecl]<nint, int*, nint> Core_GetVersion { get; }
166166
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetVirtualEntities { get; }
167167
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetVirtualEntityGroups { get; }
168+
public delegate* unmanaged[Cdecl]<nint, byte> Core_GetVoiceConnectionState { get; }
168169
public delegate* unmanaged[Cdecl]<nint, nint, byte> Core_HasMetaData { get; }
169170
public delegate* unmanaged[Cdecl]<nint, nint, byte> Core_HasSyncedMetaData { get; }
170171
public delegate* unmanaged[Cdecl]<nint, byte> Core_IsDebug { get; }
@@ -364,7 +365,7 @@ public unsafe interface ISharedLibrary
364365

365366
public unsafe class SharedLibrary : ISharedLibrary
366367
{
367-
public readonly uint Methods = 1625;
368+
public readonly uint Methods = 1626;
368369
public delegate* unmanaged[Cdecl]<nint, uint> Audio_GetID { get; }
369370
public delegate* unmanaged[Cdecl]<nint, uint> AudioAttachedOutput_GetID { get; }
370371
public delegate* unmanaged[Cdecl]<nint, uint> AudioFilter_GetID { get; }
@@ -520,6 +521,7 @@ public unsafe class SharedLibrary : ISharedLibrary
520521
public delegate* unmanaged[Cdecl]<nint, int*, nint> Core_GetVersion { get; }
521522
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetVirtualEntities { get; }
522523
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetVirtualEntityGroups { get; }
524+
public delegate* unmanaged[Cdecl]<nint, byte> Core_GetVoiceConnectionState { get; }
523525
public delegate* unmanaged[Cdecl]<nint, nint, byte> Core_HasMetaData { get; }
524526
public delegate* unmanaged[Cdecl]<nint, nint, byte> Core_HasSyncedMetaData { get; }
525527
public delegate* unmanaged[Cdecl]<nint, byte> Core_IsDebug { get; }
@@ -1025,6 +1027,8 @@ public unsafe class SharedLibrary : ISharedLibrary
10251027
private static nint Core_GetVirtualEntitiesFallback(nint _core, ulong* _size) => throw new Exceptions.OutdatedSdkException("Core_GetVirtualEntities", "Core_GetVirtualEntities SDK method is outdated. Please update your module nuget");
10261028
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetVirtualEntityGroupsDelegate(nint _core, ulong* _size);
10271029
private static nint Core_GetVirtualEntityGroupsFallback(nint _core, ulong* _size) => throw new Exceptions.OutdatedSdkException("Core_GetVirtualEntityGroups", "Core_GetVirtualEntityGroups SDK method is outdated. Please update your module nuget");
1030+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_GetVoiceConnectionStateDelegate(nint _core);
1031+
private static byte Core_GetVoiceConnectionStateFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_GetVoiceConnectionState", "Core_GetVoiceConnectionState SDK method is outdated. Please update your module nuget");
10281032
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_HasMetaDataDelegate(nint _core, nint _key);
10291033
private static byte Core_HasMetaDataFallback(nint _core, nint _key) => throw new Exceptions.OutdatedSdkException("Core_HasMetaData", "Core_HasMetaData SDK method is outdated. Please update your module nuget");
10301034
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_HasSyncedMetaDataDelegate(nint _core, nint _key);
@@ -1424,7 +1428,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
14241428
public SharedLibrary(Dictionary<ulong, IntPtr> funcTable)
14251429
{
14261430
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
1427-
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 620890210989099442UL) Outdated = true;
1431+
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 9326924779181455521UL) Outdated = true;
14281432
Audio_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<Audio_GetIDDelegate>(funcTable, 4464042055475980737UL, Audio_GetIDFallback);
14291433
AudioAttachedOutput_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<AudioAttachedOutput_GetIDDelegate>(funcTable, 17725794901805112189UL, AudioAttachedOutput_GetIDFallback);
14301434
AudioFilter_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<AudioFilter_GetIDDelegate>(funcTable, 8824535635529306325UL, AudioFilter_GetIDFallback);
@@ -1580,6 +1584,7 @@ public SharedLibrary(Dictionary<ulong, IntPtr> funcTable)
15801584
Core_GetVersion = (delegate* unmanaged[Cdecl]<nint, int*, nint>) GetUnmanagedPtr<Core_GetVersionDelegate>(funcTable, 7504892851555999456UL, Core_GetVersionFallback);
15811585
Core_GetVirtualEntities = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetVirtualEntitiesDelegate>(funcTable, 4476532196756880454UL, Core_GetVirtualEntitiesFallback);
15821586
Core_GetVirtualEntityGroups = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetVirtualEntityGroupsDelegate>(funcTable, 17770187578627250877UL, Core_GetVirtualEntityGroupsFallback);
1587+
Core_GetVoiceConnectionState = (delegate* unmanaged[Cdecl]<nint, byte>) GetUnmanagedPtr<Core_GetVoiceConnectionStateDelegate>(funcTable, 4278537667856004336UL, Core_GetVoiceConnectionStateFallback);
15831588
Core_HasMetaData = (delegate* unmanaged[Cdecl]<nint, nint, byte>) GetUnmanagedPtr<Core_HasMetaDataDelegate>(funcTable, 11163152091545864047UL, Core_HasMetaDataFallback);
15841589
Core_HasSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint, byte>) GetUnmanagedPtr<Core_HasSyncedMetaDataDelegate>(funcTable, 11681507067991184733UL, Core_HasSyncedMetaDataFallback);
15851590
Core_IsDebug = (delegate* unmanaged[Cdecl]<nint, byte>) GetUnmanagedPtr<Core_IsDebugDelegate>(funcTable, 14872081069683452488UL, Core_IsDebugFallback);

api/AltV.Net.Client/Alt.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,6 @@ public static bool GetBaseObjectById(BaseObjectType type, uint id, [MaybeNullWhe
8787
public static ICheckpoint GetCheckpointByGameID(uint gameId) => Core.GetCheckpointByGameID(gameId);
8888
public static bool IsWebViewGpuAccelerationActive => Core.IsWebViewGpuAccelerationActive;
8989
public static IWorldObject GetWorldObjectByScriptID(BaseObjectType type, uint scriptId) => Core.GetWorldObjectByScriptID(type, scriptId);
90+
public static VoiceConnectionState GetVoiceConnectionState() => Core.GetVoiceConnectionState();
9091
}
9192
}

api/AltV.Net.Shared/ISharedCore.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,7 @@ void CreateMValueDict(out MValueConst mValue, string[] keys, MValueConst[] val,
132132

133133
void TriggerLocalEvent(string eventName, params object[] args);
134134
#endregion
135+
136+
VoiceConnectionState GetVoiceConnectionState();
135137
}
136138
}

api/AltV.Net.Shared/SharedCore.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,5 +832,13 @@ public void TriggerLocalEvent(string eventName, params object[] args)
832832
}
833833
#endregion
834834

835+
836+
public VoiceConnectionState GetVoiceConnectionState()
837+
{
838+
unsafe
839+
{
840+
return (VoiceConnectionState) Library.Shared.Core_GetVoiceConnectionState(NativePointer);
841+
}
842+
}
835843
}
836844
}

api/AltV.Net/Alt.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,6 @@ public static Task ForEachColShapes(IAsyncBaseObjectCallback<IColShape> baseObje
135135
public static IMetric RegisterMetric(string name, MetricType type = MetricType.MetricTypeGauge, Dictionary<string, string> dataDict = default) => Core.RegisterMetric(name, type, dataDict);
136136
public static void UnregisterMetric(IMetric metric) => Core.UnregisterMetric(metric);
137137
public static IReadOnlyCollection<IMetric> GetAllMetrics() => Core.GetAllMetrics();
138+
public static VoiceConnectionState GetVoiceConnectionState() => Core.GetVoiceConnectionState();
138139
}
139140
}

runtime

0 commit comments

Comments
 (0)