GTA V Handling Replacement
==========================

A library that helps scripts change a vehicles' handling without affecting unrelated vehicles of the same model.

## Installation

Grand Theft Auto V (v1868+) required.
Extract HandlingReplacement.asi to GTA V's main folder. 

## Development

Check `HandlingReplacement.h` for the three functions. The asi loader should already have loaded and initialized things, so one can just start using it right away.

Usage example:

```cpp
void MyFeature::Update() {
    void* handlingDataOrig = nullptr;
    void* handlingDataReplace = nullptr;
    
    if (!HR_GetHandlingData(g_playerVehicle, &handlingDataOrig, &handlingDataReplace)) {
        HR_Enable(g_playerVehicle, &handlingDataReplace);
        return;
    }

    // Write whatever field is needed
    *(float*)((uint8_t*)handlingDataReplace + fInitialDriveForceOffset) = 1.0f;
}
```

## Acknowledgements

FiveM - On some bits on how to properly replace/clone subhandlingdata, and the rage alloc/free.
