Skip to content

Commit 5979f11

Browse files
committed
Add IsWebViewGpuAccelerationActive getter
1 parent 59a6424 commit 5979f11

File tree

7 files changed

+43
-7
lines changed

7 files changed

+43
-7
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public unsafe interface IClientLibrary
8888
public delegate* unmanaged[Cdecl]<nint, nint[], ulong, void> Core_GetAudios { get; }
8989
public delegate* unmanaged[Cdecl]<nint, uint, nint> Core_GetBlipByGameID { get; }
9090
public delegate* unmanaged[Cdecl]<nint, Vector3*, void> Core_GetCamPos { get; }
91+
public delegate* unmanaged[Cdecl]<nint, uint, nint> Core_GetCheckpointByGameID { get; }
9192
public delegate* unmanaged[Cdecl]<nint, int*, nint> Core_GetClientPath { get; }
9293
public delegate* unmanaged[Cdecl]<nint, nint, byte> Core_GetConfigFlag { get; }
9394
public delegate* unmanaged[Cdecl]<nint, Vector2*, byte, void> Core_GetCursorPos { get; }
@@ -146,6 +147,7 @@ public unsafe interface IClientLibrary
146147
public delegate* unmanaged[Cdecl]<nint, Vector3, byte> Core_IsPointOnScreen { get; }
147148
public delegate* unmanaged[Cdecl]<nint, uint, nint, byte> Core_IsTextureExistInArchetype { get; }
148149
public delegate* unmanaged[Cdecl]<nint, byte> Core_IsVoiceActivityInputEnabled { get; }
150+
public delegate* unmanaged[Cdecl]<nint, byte> Core_IsWebViewGpuAccelerationActive { get; }
149151
public delegate* unmanaged[Cdecl]<nint, void> Core_LoadDefaultIpls { get; }
150152
public delegate* unmanaged[Cdecl]<nint, uint, void> Core_LoadModel { get; }
151153
public delegate* unmanaged[Cdecl]<nint, uint, void> Core_LoadModelAsync { get; }
@@ -814,7 +816,7 @@ public unsafe interface IClientLibrary
814816

815817
public unsafe class ClientLibrary : IClientLibrary
816818
{
817-
public readonly uint Methods = 1535;
819+
public readonly uint Methods = 1537;
818820
public delegate* unmanaged[Cdecl]<nint, nint, void> Audio_AddOutput_Entity { get; }
819821
public delegate* unmanaged[Cdecl]<nint, uint, void> Audio_AddOutput_ScriptId { get; }
820822
public delegate* unmanaged[Cdecl]<nint, nint> Audio_GetBaseObject { get; }
@@ -893,6 +895,7 @@ public unsafe class ClientLibrary : IClientLibrary
893895
public delegate* unmanaged[Cdecl]<nint, nint[], ulong, void> Core_GetAudios { get; }
894896
public delegate* unmanaged[Cdecl]<nint, uint, nint> Core_GetBlipByGameID { get; }
895897
public delegate* unmanaged[Cdecl]<nint, Vector3*, void> Core_GetCamPos { get; }
898+
public delegate* unmanaged[Cdecl]<nint, uint, nint> Core_GetCheckpointByGameID { get; }
896899
public delegate* unmanaged[Cdecl]<nint, int*, nint> Core_GetClientPath { get; }
897900
public delegate* unmanaged[Cdecl]<nint, nint, byte> Core_GetConfigFlag { get; }
898901
public delegate* unmanaged[Cdecl]<nint, Vector2*, byte, void> Core_GetCursorPos { get; }
@@ -951,6 +954,7 @@ public unsafe class ClientLibrary : IClientLibrary
951954
public delegate* unmanaged[Cdecl]<nint, Vector3, byte> Core_IsPointOnScreen { get; }
952955
public delegate* unmanaged[Cdecl]<nint, uint, nint, byte> Core_IsTextureExistInArchetype { get; }
953956
public delegate* unmanaged[Cdecl]<nint, byte> Core_IsVoiceActivityInputEnabled { get; }
957+
public delegate* unmanaged[Cdecl]<nint, byte> Core_IsWebViewGpuAccelerationActive { get; }
954958
public delegate* unmanaged[Cdecl]<nint, void> Core_LoadDefaultIpls { get; }
955959
public delegate* unmanaged[Cdecl]<nint, uint, void> Core_LoadModel { get; }
956960
public delegate* unmanaged[Cdecl]<nint, uint, void> Core_LoadModelAsync { get; }
@@ -1771,6 +1775,8 @@ public unsafe class ClientLibrary : IClientLibrary
17711775
private static nint Core_GetBlipByGameIDFallback(nint _core, uint _gameId) => throw new Exceptions.OutdatedSdkException("Core_GetBlipByGameID", "Core_GetBlipByGameID SDK method is outdated. Please update your module nuget");
17721776
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_GetCamPosDelegate(nint _core, Vector3* _out);
17731777
private static void Core_GetCamPosFallback(nint _core, Vector3* _out) => throw new Exceptions.OutdatedSdkException("Core_GetCamPos", "Core_GetCamPos SDK method is outdated. Please update your module nuget");
1778+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetCheckpointByGameIDDelegate(nint _core, uint _gameId);
1779+
private static nint Core_GetCheckpointByGameIDFallback(nint _core, uint _gameId) => throw new Exceptions.OutdatedSdkException("Core_GetCheckpointByGameID", "Core_GetCheckpointByGameID SDK method is outdated. Please update your module nuget");
17741780
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetClientPathDelegate(nint _core, int* _size);
17751781
private static nint Core_GetClientPathFallback(nint _core, int* _size) => throw new Exceptions.OutdatedSdkException("Core_GetClientPath", "Core_GetClientPath SDK method is outdated. Please update your module nuget");
17761782
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_GetConfigFlagDelegate(nint _core, nint _flag);
@@ -1887,6 +1893,8 @@ public unsafe class ClientLibrary : IClientLibrary
18871893
private static byte Core_IsTextureExistInArchetypeFallback(nint _core, uint _modelHash, nint _targetTextureName) => throw new Exceptions.OutdatedSdkException("Core_IsTextureExistInArchetype", "Core_IsTextureExistInArchetype SDK method is outdated. Please update your module nuget");
18881894
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_IsVoiceActivityInputEnabledDelegate(nint _core);
18891895
private static byte Core_IsVoiceActivityInputEnabledFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_IsVoiceActivityInputEnabled", "Core_IsVoiceActivityInputEnabled SDK method is outdated. Please update your module nuget");
1896+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Core_IsWebViewGpuAccelerationActiveDelegate(nint _core);
1897+
private static byte Core_IsWebViewGpuAccelerationActiveFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_IsWebViewGpuAccelerationActive", "Core_IsWebViewGpuAccelerationActive SDK method is outdated. Please update your module nuget");
18901898
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_LoadDefaultIplsDelegate(nint _core);
18911899
private static void Core_LoadDefaultIplsFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_LoadDefaultIpls", "Core_LoadDefaultIpls SDK method is outdated. Please update your module nuget");
18921900
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Core_LoadModelDelegate(nint _core, uint _modelHash);
@@ -3224,7 +3232,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
32243232
public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
32253233
{
32263234
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
3227-
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13533382576204472374UL) Outdated = true;
3235+
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 16481579865703525811UL) Outdated = true;
32283236
Audio_AddOutput_Entity = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<Audio_AddOutput_EntityDelegate>(funcTable, 9879036518735269522UL, Audio_AddOutput_EntityFallback);
32293237
Audio_AddOutput_ScriptId = (delegate* unmanaged[Cdecl]<nint, uint, void>) GetUnmanagedPtr<Audio_AddOutput_ScriptIdDelegate>(funcTable, 14116998947805478300UL, Audio_AddOutput_ScriptIdFallback);
32303238
Audio_GetBaseObject = (delegate* unmanaged[Cdecl]<nint, nint>) GetUnmanagedPtr<Audio_GetBaseObjectDelegate>(funcTable, 6330360502401226894UL, Audio_GetBaseObjectFallback);
@@ -3303,6 +3311,7 @@ public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
33033311
Core_GetAudios = (delegate* unmanaged[Cdecl]<nint, nint[], ulong, void>) GetUnmanagedPtr<Core_GetAudiosDelegate>(funcTable, 4570431726496627488UL, Core_GetAudiosFallback);
33043312
Core_GetBlipByGameID = (delegate* unmanaged[Cdecl]<nint, uint, nint>) GetUnmanagedPtr<Core_GetBlipByGameIDDelegate>(funcTable, 18078473099666119995UL, Core_GetBlipByGameIDFallback);
33053313
Core_GetCamPos = (delegate* unmanaged[Cdecl]<nint, Vector3*, void>) GetUnmanagedPtr<Core_GetCamPosDelegate>(funcTable, 13815274607564352429UL, Core_GetCamPosFallback);
3314+
Core_GetCheckpointByGameID = (delegate* unmanaged[Cdecl]<nint, uint, nint>) GetUnmanagedPtr<Core_GetCheckpointByGameIDDelegate>(funcTable, 17443733140958323295UL, Core_GetCheckpointByGameIDFallback);
33063315
Core_GetClientPath = (delegate* unmanaged[Cdecl]<nint, int*, nint>) GetUnmanagedPtr<Core_GetClientPathDelegate>(funcTable, 10032718746164771334UL, Core_GetClientPathFallback);
33073316
Core_GetConfigFlag = (delegate* unmanaged[Cdecl]<nint, nint, byte>) GetUnmanagedPtr<Core_GetConfigFlagDelegate>(funcTable, 9388016697579829930UL, Core_GetConfigFlagFallback);
33083317
Core_GetCursorPos = (delegate* unmanaged[Cdecl]<nint, Vector2*, byte, void>) GetUnmanagedPtr<Core_GetCursorPosDelegate>(funcTable, 15134150969197995835UL, Core_GetCursorPosFallback);
@@ -3361,6 +3370,7 @@ public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
33613370
Core_IsPointOnScreen = (delegate* unmanaged[Cdecl]<nint, Vector3, byte>) GetUnmanagedPtr<Core_IsPointOnScreenDelegate>(funcTable, 9053921873104901604UL, Core_IsPointOnScreenFallback);
33623371
Core_IsTextureExistInArchetype = (delegate* unmanaged[Cdecl]<nint, uint, nint, byte>) GetUnmanagedPtr<Core_IsTextureExistInArchetypeDelegate>(funcTable, 5487028108265672799UL, Core_IsTextureExistInArchetypeFallback);
33633372
Core_IsVoiceActivityInputEnabled = (delegate* unmanaged[Cdecl]<nint, byte>) GetUnmanagedPtr<Core_IsVoiceActivityInputEnabledDelegate>(funcTable, 4433142925114007365UL, Core_IsVoiceActivityInputEnabledFallback);
3373+
Core_IsWebViewGpuAccelerationActive = (delegate* unmanaged[Cdecl]<nint, byte>) GetUnmanagedPtr<Core_IsWebViewGpuAccelerationActiveDelegate>(funcTable, 4577141218762914496UL, Core_IsWebViewGpuAccelerationActiveFallback);
33643374
Core_LoadDefaultIpls = (delegate* unmanaged[Cdecl]<nint, void>) GetUnmanagedPtr<Core_LoadDefaultIplsDelegate>(funcTable, 17184217455720907957UL, Core_LoadDefaultIplsFallback);
33653375
Core_LoadModel = (delegate* unmanaged[Cdecl]<nint, uint, void>) GetUnmanagedPtr<Core_LoadModelDelegate>(funcTable, 12272171669941913364UL, Core_LoadModelFallback);
33663376
Core_LoadModelAsync = (delegate* unmanaged[Cdecl]<nint, uint, void>) GetUnmanagedPtr<Core_LoadModelAsyncDelegate>(funcTable, 9589250181503294824UL, Core_LoadModelAsyncFallback);

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

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

412412
public unsafe class ServerLibrary : IServerLibrary
413413
{
414-
public readonly uint Methods = 1535;
414+
public readonly uint Methods = 1537;
415415
public delegate* unmanaged[Cdecl]<nint, nint, void> BaseObject_DeleteSyncedMetaData { get; }
416416
public delegate* unmanaged[Cdecl]<nint, nint, nint, void> BaseObject_SetSyncedMetaData { get; }
417417
public delegate* unmanaged[Cdecl]<nint, BaseObjectType*, nint> Blip_AttachedTo { get; }
@@ -1612,7 +1612,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
16121612
public ServerLibrary(Dictionary<ulong, IntPtr> funcTable)
16131613
{
16141614
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
1615-
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13533382576204472374UL) Outdated = true;
1615+
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 16481579865703525811UL) Outdated = true;
16161616
BaseObject_DeleteSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<BaseObject_DeleteSyncedMetaDataDelegate>(funcTable, 8228424877092269355UL, BaseObject_DeleteSyncedMetaDataFallback);
16171617
BaseObject_SetSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint, nint, void>) GetUnmanagedPtr<BaseObject_SetSyncedMetaDataDelegate>(funcTable, 8002999088966424231UL, BaseObject_SetSyncedMetaDataFallback);
16181618
Blip_AttachedTo = (delegate* unmanaged[Cdecl]<nint, BaseObjectType*, nint>) GetUnmanagedPtr<Blip_AttachedToDelegate>(funcTable, 15602966080933483258UL, Blip_AttachedToFallback);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public unsafe interface ISharedLibrary
350350

351351
public unsafe class SharedLibrary : ISharedLibrary
352352
{
353-
public readonly uint Methods = 1535;
353+
public readonly uint Methods = 1537;
354354
public delegate* unmanaged[Cdecl]<nint, uint> Audio_GetID { get; }
355355
public delegate* unmanaged[Cdecl]<nint, nint, void> BaseObject_DeleteMetaData { get; }
356356
public delegate* unmanaged[Cdecl]<nint, void> BaseObject_DestructCache { get; }
@@ -1368,7 +1368,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
13681368
public SharedLibrary(Dictionary<ulong, IntPtr> funcTable)
13691369
{
13701370
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
1371-
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13533382576204472374UL) Outdated = true;
1371+
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 16481579865703525811UL) Outdated = true;
13721372
Audio_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<Audio_GetIDDelegate>(funcTable, 4464042055475980737UL, Audio_GetIDFallback);
13731373
BaseObject_DeleteMetaData = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<BaseObject_DeleteMetaDataDelegate>(funcTable, 8032676411671743849UL, BaseObject_DeleteMetaDataFallback);
13741374
BaseObject_DestructCache = (delegate* unmanaged[Cdecl]<nint, void>) GetUnmanagedPtr<BaseObject_DestructCacheDelegate>(funcTable, 6691163275156255752UL, BaseObject_DestructCacheFallback);

api/AltV.Net.Client/Alt.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public static bool GetBaseObjectById(BaseObjectType type, uint id, [MaybeNullWhe
8484
public static byte[] ReadFileBinary(string path) => Core.FileReadBinary(path);
8585
public static Vector3 PedBonesPosition(int scriptId, ushort boneId) => Core.PedBonesPosition(scriptId, boneId);
8686
public static IBlip GetBlipByGameId(uint gameId) => Core.GetBlipByGameId(gameId);
87+
public static ICheckpoint GetCheckpointByGameID(uint gameId) => Core.GetCheckpointByGameID(gameId);
88+
public static bool IsWebViewGpuAccelerationActive => Core.IsWebViewGpuAccelerationActive;
8789
public static IWorldObject GetWorldObjectByScriptID(BaseObjectType type, uint scriptId) => Core.GetWorldObjectByScriptID(type, scriptId);
8890
}
8991
}

api/AltV.Net.Client/Core.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,28 @@ public IBlip GetBlipByGameId(uint gameId)
665665
}
666666
}
667667

668+
public ICheckpoint GetCheckpointByGameID(uint gameId)
669+
{
670+
unsafe
671+
{
672+
var checkpointPtr = Library.Client.Core_GetCheckpointByGameID(NativePointer, gameId);
673+
674+
if (checkpointPtr == IntPtr.Zero) return null;
675+
return PoolManager.Checkpoint.GetOrCreate(this, checkpointPtr);
676+
}
677+
}
678+
679+
public bool IsWebViewGpuAccelerationActive
680+
{
681+
get
682+
{
683+
unsafe
684+
{
685+
return Library.Client.Core_IsWebViewGpuAccelerationActive(NativePointer) == 1;
686+
}
687+
}
688+
}
689+
668690
public IWorldObject GetWorldObjectByScriptID(BaseObjectType type, uint scriptId)
669691
{
670692
unsafe

api/AltV.Net.Client/ICore.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ IObject CreateObject(uint modelHash, Position position, Rotation rotation, bool
165165
IReadOnlyCollection<IObject> GetAllObjects();
166166
bool IsFullScreen { get; }
167167
IBlip GetBlipByGameId(uint gameId);
168+
ICheckpoint GetCheckpointByGameID(uint gameId);
169+
bool IsWebViewGpuAccelerationActive { get; }
168170
IWorldObject GetWorldObjectByScriptID(BaseObjectType type, uint scriptId);
169171
IVirtualEntityGroup CreateVirtualEntityGroup(uint streamingDistance);
170172
IVirtualEntity CreateVirtualEntity(IVirtualEntityGroup group, Position position, uint streamingDistance, Dictionary<string, object> dataDict);

runtime

0 commit comments

Comments
 (0)