Skip to content

Commit

Permalink
ALTV-626 - add PlayerDimensionChangeModuleDelegate to client
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Jan 5, 2025
1 parent 972d0c7 commit 7c489c6
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 24 deletions.
84 changes: 66 additions & 18 deletions api/AltV.Net.CApi/Events/ClientEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,86 +8,134 @@ namespace AltV.Net.CApi.ClientEvents
public delegate void TickModuleDelegate();

public delegate void ClientEventModuleDelegate(string name, IntPtr args, ulong size);

public delegate void ServerEventModuleDelegate(string name, IntPtr args, ulong size);

public delegate void WebViewEventModuleDelegate(IntPtr webView, string name, IntPtr args, ulong size);

public delegate void RmlEventModuleDelegate(IntPtr rmlElement, string name, IntPtr args);

public delegate void WebSocketEventModuleDelegate(IntPtr webSocket, string name, IntPtr args, ulong size);

public delegate void AudioEventModuleDelegate(IntPtr audio, string name, IntPtr args, ulong size);
public delegate void ConsoleCommandModuleDelegate(string name, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] string[] args, int argsSize);

public delegate void ConsoleCommandModuleDelegate(string name,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] string[] args, int argsSize);

public delegate void PlayerSpawnModuleDelegate();

public delegate void PlayerDisconnectModuleDelegate();

public delegate void PlayerEnterVehicleModuleDelegate(IntPtr baseObject, BaseObjectType type, byte seat);

public delegate void PlayerLeaveVehicleModuleDelegate(IntPtr baseObject, BaseObjectType type, byte seat);
public delegate void PlayerChangeVehicleSeatModuleDelegate(IntPtr pointer, BaseObjectType type, byte oldSeat, byte newSeat);
public delegate void PlayerChangeAnimationModuleDelegate(IntPtr pointer, BaseObjectType type, uint oldDict, uint newDict, uint oldName, uint newName);
public delegate void PlayerChangeInteriorModuleDelegate(IntPtr pointer, BaseObjectType type, uint oldIntLoc, uint newIntLoc);

public delegate void PlayerChangeVehicleSeatModuleDelegate(IntPtr pointer, BaseObjectType type, byte oldSeat,
byte newSeat);

public delegate void PlayerChangeAnimationModuleDelegate(IntPtr pointer, BaseObjectType type, uint oldDict,
uint newDict, uint oldName, uint newName);

public delegate void PlayerChangeInteriorModuleDelegate(IntPtr pointer, BaseObjectType type, uint oldIntLoc,
uint newIntLoc);

public delegate void PlayerDimensionChangeModuleDelegate(IntPtr pointer, BaseObjectType type, int oldDim,
int newDim);

public delegate void PlayerWeaponShootModuleDelegate(uint weapon, ushort totalAmmo, ushort ammoInClip);

public delegate void PlayerWeaponChangeModuleDelegate(uint oldWeapon, uint newWeapon);

public delegate void GameEntityCreateModuleDelegate(IntPtr pointer, BaseObjectType type);

public delegate void GameEntityDestroyModuleDelegate(IntPtr pointer, BaseObjectType type);

public delegate void AnyResourceErrorModuleDelegate(string name);

public delegate void AnyResourceStartModuleDelegate(string name);

public delegate void AnyResourceStopModuleDelegate(string name);

public delegate void KeyDownModuleDelegate(uint key);

public delegate void KeyUpModuleDelegate(uint key);

public delegate void ScreenshotResultModuleDelegate(IntPtr strPtr);
public delegate void HttpResponseModuleDelegate(int statusCode, string body, IntPtr headerKeys, IntPtr headerValues, int headerSize);

public delegate void HttpResponseModuleDelegate(int statusCode, string body, IntPtr headerKeys, IntPtr headerValues,
int headerSize);

public delegate void ConnectionCompleteModuleDelegate();

public delegate void GlobalMetaChangeModuleDelegate(string key, IntPtr value, IntPtr oldValue);

public delegate void GlobalSyncedMetaChangeModuleDelegate(string key, IntPtr value, IntPtr oldValue);

public delegate void LocalMetaChangeModuleDelegate(string key, IntPtr value, IntPtr oldValue);
public delegate void StreamSyncedMetaChangeModuleDelegate(IntPtr target, BaseObjectType type, string key, IntPtr value, IntPtr oldValue);
public delegate void SyncedMetaChangeModuleDelegate(IntPtr target, BaseObjectType type, string key, IntPtr value, IntPtr oldValue);
public delegate void MetaChangeModuleDelegate(IntPtr target, BaseObjectType type, string key, IntPtr value, IntPtr oldValue);

public delegate void StreamSyncedMetaChangeModuleDelegate(IntPtr target, BaseObjectType type, string key,
IntPtr value, IntPtr oldValue);

public delegate void SyncedMetaChangeModuleDelegate(IntPtr target, BaseObjectType type, string key, IntPtr value,
IntPtr oldValue);

public delegate void MetaChangeModuleDelegate(IntPtr target, BaseObjectType type, string key, IntPtr value,
IntPtr oldValue);

public delegate void TaskChangeModuleDelegate(int oldTask, int newTask);

public delegate void WindowFocusChangeModuleDelegate(byte state);

public delegate void WindowResolutionChangeModuleDelegate(Vector2 oldResolution, Vector2 newResolution);

public delegate void WorldObjectPositionChangeModuleDelegate(IntPtr target, BaseObjectType type, Position oldPosition);
public delegate void WorldObjectPositionChangeModuleDelegate(IntPtr target, BaseObjectType type,
Position oldPosition);

public delegate void WorldObjectStreamInModuleDelegate(IntPtr target, BaseObjectType type);

public delegate void WorldObjectStreamOutModuleDelegate(IntPtr target, BaseObjectType type);


public delegate void NetOwnerChangeModuleDelegate(IntPtr target, BaseObjectType type, IntPtr newOwner, IntPtr oldOwner);
public delegate void NetOwnerChangeModuleDelegate(IntPtr target, BaseObjectType type, IntPtr newOwner,
IntPtr oldOwner);

public delegate void DiscordOAuth2TokenResultModuleDelegate(byte success, string token);

public delegate void WeaponDamageModuleDelegate(IntPtr eventPointer, IntPtr entityPointer,
BaseObjectType entityType, uint weapon, ushort damage, Position shotOffset, BodyPart bodyPart, IntPtr sourceEntityPointer,
BaseObjectType entityType, uint weapon, ushort damage, Position shotOffset, BodyPart bodyPart,
IntPtr sourceEntityPointer,
BaseObjectType sourceEntityType);

public delegate void CreateBaseObjectModuleDelegate(IntPtr baseObject, BaseObjectType type, uint id);

public delegate void RemoveBaseObjectModuleDelegate(IntPtr baseObject, BaseObjectType type);

public delegate void ColShapeModuleDelegate(IntPtr colShapePointer, IntPtr targetEntityPointer, BaseObjectType entityType,
public delegate void ColShapeModuleDelegate(IntPtr colShapePointer, IntPtr targetEntityPointer,
BaseObjectType entityType,
byte state);
public delegate void CheckpointModuleDelegate(IntPtr colShapePointer, IntPtr targetEntityPointer, BaseObjectType entityType,

public delegate void CheckpointModuleDelegate(IntPtr colShapePointer, IntPtr targetEntityPointer,
BaseObjectType entityType,
byte state);

public delegate void EntityHitEntityModuleDelegate(IntPtr targetPointer, BaseObjectType targetType, IntPtr damagerPointer,
public delegate void EntityHitEntityModuleDelegate(IntPtr targetPointer, BaseObjectType targetType,
IntPtr damagerPointer,
BaseObjectType damagerType, uint weaponHash);

public delegate void PlayerStartEnterVehicleModuleDelegate(IntPtr targetPointer, BaseObjectType type, IntPtr player, BaseObjectType playerType, byte seat);
public delegate void PlayerStartLeaveVehicleModuleDelegate(IntPtr targetPointer, BaseObjectType type, IntPtr player, BaseObjectType playerType, byte seat);
public delegate void PlayerStartEnterVehicleModuleDelegate(IntPtr targetPointer, BaseObjectType type, IntPtr player,
BaseObjectType playerType, byte seat);

public delegate void PlayerStartLeaveVehicleModuleDelegate(IntPtr targetPointer, BaseObjectType type, IntPtr player,
BaseObjectType playerType, byte seat);

public delegate void PlayerBulletHitModuleDelegate(uint weapon, IntPtr victimPointer, BaseObjectType victimType,
Position pos);

public delegate void VoiceConnectionModuleDelegate(VoiceConnectionState state);

public delegate void ScriptRPCModuleDelegate(IntPtr eventPointer, string name, IntPtr args, ulong size, ushort answerId);
public delegate void ScriptRPCModuleDelegate(IntPtr eventPointer, string name, IntPtr args, ulong size,
ushort answerId);

public delegate void ScriptRPCAnswerModuleDelegate(ushort answerId, IntPtr answer,
string answerError);
}
}
9 changes: 7 additions & 2 deletions api/AltV.Net.CApi/Libraries/ClientLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ public unsafe interface IClientLibrary
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeAnimationModuleDelegate, void> Event_SetPlayerChangeAnimationDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeInteriorModuleDelegate, void> Event_SetPlayerChangeInteriorDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeVehicleSeatModuleDelegate, void> Event_SetPlayerChangeVehicleSeatDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerDimensionChangeModuleDelegate, void> Event_SetPlayerDimensionChangeDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerDisconnectModuleDelegate, void> Event_SetPlayerDisconnectDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerEnterVehicleModuleDelegate, void> Event_SetPlayerEnterVehicleDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerLeaveVehicleModuleDelegate, void> Event_SetPlayerLeaveVehicleDelegate { get; }
Expand Down Expand Up @@ -938,7 +939,7 @@ public unsafe interface IClientLibrary

public unsafe class ClientLibrary : IClientLibrary
{
public readonly uint Methods = 1811;
public readonly uint Methods = 1812;
public delegate* unmanaged[Cdecl]<nint, nint, void> Audio_AddOutput { get; }
public delegate* unmanaged[Cdecl]<nint, nint> Audio_GetBaseObject { get; }
public delegate* unmanaged[Cdecl]<nint, double> Audio_GetCurrentTime { get; }
Expand Down Expand Up @@ -1228,6 +1229,7 @@ public unsafe class ClientLibrary : IClientLibrary
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeAnimationModuleDelegate, void> Event_SetPlayerChangeAnimationDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeInteriorModuleDelegate, void> Event_SetPlayerChangeInteriorDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeVehicleSeatModuleDelegate, void> Event_SetPlayerChangeVehicleSeatDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerDimensionChangeModuleDelegate, void> Event_SetPlayerDimensionChangeDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerDisconnectModuleDelegate, void> Event_SetPlayerDisconnectDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerEnterVehicleModuleDelegate, void> Event_SetPlayerEnterVehicleDelegate { get; }
public delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerLeaveVehicleModuleDelegate, void> Event_SetPlayerLeaveVehicleDelegate { get; }
Expand Down Expand Up @@ -2440,6 +2442,8 @@ public unsafe class ClientLibrary : IClientLibrary
private static void Event_SetPlayerChangeInteriorDelegateFallback(nint _resource, ClientEvents.PlayerChangeInteriorModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerChangeInteriorDelegate", "Event_SetPlayerChangeInteriorDelegate SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerChangeVehicleSeatDelegateDelegate(nint _resource, ClientEvents.PlayerChangeVehicleSeatModuleDelegate _delegate);
private static void Event_SetPlayerChangeVehicleSeatDelegateFallback(nint _resource, ClientEvents.PlayerChangeVehicleSeatModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerChangeVehicleSeatDelegate", "Event_SetPlayerChangeVehicleSeatDelegate SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerDimensionChangeDelegateDelegate(nint _resource, ClientEvents.PlayerDimensionChangeModuleDelegate _delegate);
private static void Event_SetPlayerDimensionChangeDelegateFallback(nint _resource, ClientEvents.PlayerDimensionChangeModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerDimensionChangeDelegate", "Event_SetPlayerDimensionChangeDelegate SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerDisconnectDelegateDelegate(nint _resource, ClientEvents.PlayerDisconnectModuleDelegate _delegate);
private static void Event_SetPlayerDisconnectDelegateFallback(nint _resource, ClientEvents.PlayerDisconnectModuleDelegate _delegate) => throw new Exceptions.OutdatedSdkException("Event_SetPlayerDisconnectDelegate", "Event_SetPlayerDisconnectDelegate SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_SetPlayerEnterVehicleDelegateDelegate(nint _resource, ClientEvents.PlayerEnterVehicleModuleDelegate _delegate);
Expand Down Expand Up @@ -3717,7 +3721,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
{
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 2737407539021183714UL) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13628227844990757996UL) Outdated = true;
Audio_AddOutput = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<Audio_AddOutputDelegate>(funcTable, 9914412815391408844UL, Audio_AddOutputFallback);
Audio_GetBaseObject = (delegate* unmanaged[Cdecl]<nint, nint>) GetUnmanagedPtr<Audio_GetBaseObjectDelegate>(funcTable, 6330360502401226894UL, Audio_GetBaseObjectFallback);
Audio_GetCurrentTime = (delegate* unmanaged[Cdecl]<nint, double>) GetUnmanagedPtr<Audio_GetCurrentTimeDelegate>(funcTable, 2944324482134975819UL, Audio_GetCurrentTimeFallback);
Expand Down Expand Up @@ -4007,6 +4011,7 @@ public ClientLibrary(Dictionary<ulong, IntPtr> funcTable)
Event_SetPlayerChangeAnimationDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeAnimationModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerChangeAnimationDelegateDelegate>(funcTable, 1013031841840963141UL, Event_SetPlayerChangeAnimationDelegateFallback);
Event_SetPlayerChangeInteriorDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeInteriorModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerChangeInteriorDelegateDelegate>(funcTable, 10641081887455190199UL, Event_SetPlayerChangeInteriorDelegateFallback);
Event_SetPlayerChangeVehicleSeatDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerChangeVehicleSeatModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerChangeVehicleSeatDelegateDelegate>(funcTable, 2849447755791784577UL, Event_SetPlayerChangeVehicleSeatDelegateFallback);
Event_SetPlayerDimensionChangeDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerDimensionChangeModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerDimensionChangeDelegateDelegate>(funcTable, 12559962844846581925UL, Event_SetPlayerDimensionChangeDelegateFallback);
Event_SetPlayerDisconnectDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerDisconnectModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerDisconnectDelegateDelegate>(funcTable, 11526105887646755055UL, Event_SetPlayerDisconnectDelegateFallback);
Event_SetPlayerEnterVehicleDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerEnterVehicleModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerEnterVehicleDelegateDelegate>(funcTable, 16259534399403863387UL, Event_SetPlayerEnterVehicleDelegateFallback);
Event_SetPlayerLeaveVehicleDelegate = (delegate* unmanaged[Cdecl]<nint, ClientEvents.PlayerLeaveVehicleModuleDelegate, void>) GetUnmanagedPtr<Event_SetPlayerLeaveVehicleDelegateDelegate>(funcTable, 10354256863799375649UL, Event_SetPlayerLeaveVehicleDelegateFallback);
Expand Down
4 changes: 2 additions & 2 deletions api/AltV.Net.CApi/Libraries/ServerLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public unsafe interface IServerLibrary

public unsafe class ServerLibrary : IServerLibrary
{
public readonly uint Methods = 1811;
public readonly uint Methods = 1812;
public delegate* unmanaged[Cdecl]<nint, nint, void> BaseObject_DeleteSyncedMetaData { get; }
public delegate* unmanaged[Cdecl]<nint, nint[], nint[], ulong, void> BaseObject_SetMultipleSyncedMetaData { get; }
public delegate* unmanaged[Cdecl]<nint, nint, nint, void> BaseObject_SetSyncedMetaData { get; }
Expand Down Expand Up @@ -1925,7 +1925,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
public ServerLibrary(Dictionary<ulong, IntPtr> funcTable)
{
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 2737407539021183714UL) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13628227844990757996UL) Outdated = true;
BaseObject_DeleteSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint, void>) GetUnmanagedPtr<BaseObject_DeleteSyncedMetaDataDelegate>(funcTable, 8228424877092269355UL, BaseObject_DeleteSyncedMetaDataFallback);
BaseObject_SetMultipleSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint[], nint[], ulong, void>) GetUnmanagedPtr<BaseObject_SetMultipleSyncedMetaDataDelegate>(funcTable, 1390762125822890831UL, BaseObject_SetMultipleSyncedMetaDataFallback);
BaseObject_SetSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint, nint, void>) GetUnmanagedPtr<BaseObject_SetSyncedMetaDataDelegate>(funcTable, 8002999088966424231UL, BaseObject_SetSyncedMetaDataFallback);
Expand Down
4 changes: 2 additions & 2 deletions api/AltV.Net.CApi/Libraries/SharedLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public unsafe interface ISharedLibrary

public unsafe class SharedLibrary : ISharedLibrary
{
public readonly uint Methods = 1811;
public readonly uint Methods = 1812;
public delegate* unmanaged[Cdecl]<nint, uint> Audio_GetID { get; }
public delegate* unmanaged[Cdecl]<nint, uint> AudioAttachedOutput_GetID { get; }
public delegate* unmanaged[Cdecl]<nint, uint> AudioFilter_GetID { get; }
Expand Down Expand Up @@ -1669,7 +1669,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
public SharedLibrary(Dictionary<ulong, IntPtr> funcTable)
{
if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 2737407539021183714UL) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13628227844990757996UL) Outdated = true;
Audio_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<Audio_GetIDDelegate>(funcTable, 4464042055475980737UL, Audio_GetIDFallback);
AudioAttachedOutput_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<AudioAttachedOutput_GetIDDelegate>(funcTable, 17725794901805112189UL, AudioAttachedOutput_GetIDFallback);
AudioFilter_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<AudioFilter_GetIDDelegate>(funcTable, 8824535635529306325UL, AudioFilter_GetIDFallback);
Expand Down
Loading

0 comments on commit 7c489c6

Please sign in to comment.