Skip to content

Commit

Permalink
ALTV-278 update runtime changes for client vehicle and handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Aug 4, 2024
1 parent 29f97f1 commit a3c6515
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 59 deletions.
109 changes: 67 additions & 42 deletions api/AltV.Net.CApi/Libraries/ClientLibrary.cs

Large diffs are not rendered by default.

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 @@ -488,7 +488,7 @@ public unsafe interface IServerLibrary

public unsafe class ServerLibrary : IServerLibrary
{
public readonly uint Methods = 1774;
public readonly uint Methods = 1779;
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 @@ -1917,7 +1917,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 != 4464148992254491289UL) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 8028889173226987673UL) 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 = 1774;
public readonly uint Methods = 1779;
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 != 4464148992254491289UL) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 8028889173226987673UL) 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
26 changes: 20 additions & 6 deletions api/AltV.Net.Client/Elements/Data/Handling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,24 +228,31 @@ public float DriveBiasFront
}
}

public float Acceleration
public float DriveBiasRear
{
get
{
unsafe
{
return core.Library.Client.Vehicle_Handling_GetAcceleration(vehiclePointer);
return core.Library.Client.Vehicle_Handling_GetDriveBiasRear(vehiclePointer);
}
}
set
{
unsafe
{
core.Library.Client.Vehicle_Handling_SetAcceleration(vehiclePointer, value);
core.Library.Client.Vehicle_Handling_SetDriveBiasRear(vehiclePointer, value);
}
}
}

[Obsolete("Use DriveBiasRear instead")]
public float Acceleration
{
get => this.DriveBiasRear;
set => this.DriveBiasRear = value;
}

public uint InitialDriveGears
{
get
Expand Down Expand Up @@ -336,24 +343,31 @@ public float InitialDriveForce
}
}

public float DriveMaxFlatVel
public float InitialDriveMaxVel
{
get
{
unsafe
{
return core.Library.Client.Vehicle_Handling_GetDriveMaxFlatVel(vehiclePointer);
return core.Library.Client.Vehicle_Handling_GetInitialDriveMaxVel(vehiclePointer);
}
}
set
{
unsafe
{
core.Library.Client.Vehicle_Handling_SetDriveMaxFlatVel(vehiclePointer, value);
core.Library.Client.Vehicle_Handling_SetInitialDriveMaxVel(vehiclePointer, value);
}
}
}

[Obsolete("Use InitialDriveMaxVel instead")]
public float DriveMaxFlatVel
{
get => this.InitialDriveMaxVel;
set => this.InitialDriveMaxVel = value;
}

public float InitialDriveMaxFlatVel
{
get
Expand Down
26 changes: 20 additions & 6 deletions api/AltV.Net.Client/Elements/Data/HandlingData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,24 +208,31 @@ public float DriveBiasFront
}
}

public float Acceleration
public float DriveBiasRear
{
get
{
unsafe
{
return core.Library.Client.Handling_GetAcceleration(modelHash);
return core.Library.Client.Handling_GetDriveBiasRear(modelHash);
}
}
set
{
unsafe
{
core.Library.Client.Handling_SetAcceleration(modelHash, value);
core.Library.Client.Handling_SetDriveBiasRear(modelHash, value);
}
}
}

[Obsolete("Use DriveBiasRear instead")]
public float Acceleration
{
get => this.DriveBiasRear;
set => this.DriveBiasRear = value;
}

public uint InitialDriveGears
{
get
Expand Down Expand Up @@ -316,24 +323,31 @@ public float InitialDriveForce
}
}

public float DriveMaxFlatVel
public float InitialDriveMaxVel
{
get
{
unsafe
{
return core.Library.Client.Handling_GetDriveMaxFlatVel(modelHash);
return core.Library.Client.Handling_GetInitialDriveMaxVel(modelHash);
}
}
set
{
unsafe
{
core.Library.Client.Handling_SetDriveMaxFlatVel(modelHash, value);
core.Library.Client.Handling_SetInitialDriveMaxVel(modelHash, value);
}
}
}

[Obsolete("Use InitialDriveMaxVel instead")]
public float DriveMaxFlatVel
{
get => this.InitialDriveMaxVel;
set => this.InitialDriveMaxVel = value;
}

public float InitialDriveMaxFlatVel
{
get
Expand Down
4 changes: 4 additions & 0 deletions api/AltV.Net.Client/Elements/Data/IHandlingData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ public interface IHandlingData
float PercentSubmerged { get; set; }
float PercentSubmergedRatio { get; set; }
float DriveBiasFront { get; set; }
float DriveBiasRear { get; set; }
[Obsolete("Use DriveBiasRear instead")]
float Acceleration { get; set; }
uint InitialDriveGears { get; set; }
float DriveInertia { get; set; }
float ClutchChangeRateScaleUpShift { get; set; }
float ClutchChangeRateScaleDownShift { get; set; }
float InitialDriveForce { get; set; }
float InitialDriveMaxVel { get; set; }
[Obsolete("Use InitialDriveMaxVel instead")]
float DriveMaxFlatVel { get; set; }
float InitialDriveMaxFlatVel { get; set; }
float BrakeForce { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion runtime

0 comments on commit a3c6515

Please sign in to comment.