fivem icon indicating copy to clipboard operation
fivem copied to clipboard

tweak(natives-decl): add SET_VEHICLE_CURRENT_GEAR and NEXT_GEAR declarations

Open RickyB505 opened this issue 11 months ago • 9 comments

Goal of this PR

This will allow developers to create manual transmissions more easily with in FiveM.

How is this PR achieving the goal

Adds two natives SetVehicleCurrentGear(vehicle, gear) and SetVehicleNextGear(vehicle, nextGear) that exist with in VehicleExtraNatives.cpp but were never added.

This PR applies to the following area(s)

FiveM, Vehicles

Successfully tested on

Should work on any build.

Checklist

  • [ ] Code compiles and has been tested successfully.
  • [x] Code explains itself well and/or is documented.
  • [x] My commit message explains what the changes do and what they are for.
  • [x] No extra compilation warnings are added by these changes.

RickyB505 avatar Feb 27 '24 16:02 RickyB505

Can you change the commit title to something like: tweak(natives-decl): add SET_VEHICLE_CURRENT_GEAR and NEXT_GEAR declarations? For the rest I've assigned @4mmonium, he's good at checking these

thorium-cfx avatar Feb 27 '24 18:02 thorium-cfx

Can you change the commit title to something like: tweak(natives-decl): add SET_VEHICLE_CURRENT_GEAR and NEXT_GEAR declarations? For the rest I've assigned @4mmonium, he's good at checking these fixed

RickyB505 avatar Feb 27 '24 18:02 RickyB505

I'll handle this, as it partially relates to: https://github.com/citizenfx/fivem/issues/2003#issuecomment-1921695915

gottfriedleibniz avatar Feb 27 '24 18:02 gottfriedleibniz

i dont think it relates to that this is a separate thing

RickyB505 avatar Feb 27 '24 18:02 RickyB505

Much of CTransmission changed in 3095 and it is likely required to sanitize those setters against 0x61F02E4E9A7A61EA (nInitialDriveGears in CHandling iirc). It would be nice to ensure that is validated/handled prior to native declarations being provided.

gottfriedleibniz avatar Feb 27 '24 18:02 gottfriedleibniz

well i can tell you they do work , because i tested them

RickyB505 avatar Feb 27 '24 19:02 RickyB505

Can you change the commit title to something like: tweak(natives-decl): add SET_VEHICLE_CURRENT_GEAR and NEXT_GEAR declarations? For the rest I've assigned @4mmonium, he's good at checking these

Doc implementation seems fine, now for underlying implementation @gottfriedleibniz might know better than I do; so as they stated, they should handle the rest 🙂

well i can tell you they do work , because i tested them

That's great, but structure changes between builds can cause memory related issues nonetheless (such as invalid data, crashes from invalid pointer access, etc), offsets that were valid in the past, might no longer be. So it's important to check the underlying implementation to make sure these things don't happen.

4mmonium avatar Mar 01 '24 05:03 4mmonium

any updates on this has anyone checked the natives

RickyB505 avatar Apr 30 '24 01:04 RickyB505

whats going on with this PR

RickyB505 avatar Jun 14 '24 02:06 RickyB505

Can you change the git commit text to

tweak(natives-decl): add SET_VEHICLE_CURRENT_GEAR and NEXT_GEAR declarations

?

Otherwise we have to do that manually.

FabianTerhorst avatar Aug 15 '24 18:08 FabianTerhorst

We will do it manually.

FabianTerhorst avatar Aug 19 '24 15:08 FabianTerhorst

Merged https://github.com/citizenfx/fivem/commit/0a85132958c5b380b7e0648ebdabb10fa1203bed

FabianTerhorst avatar Aug 20 '24 12:08 FabianTerhorst