RiddleTime/Race-Element

Some GT4 cars have non-default settings

Closed this issue · 1 comments

So far (can add more cars as i find more issues);

Audi - Dampers lowest values are 1, so ACCM value is ingame -1. Ignore fast bump/rebound as GT4s cant be changed.
image

How was it solved?

I added a new member called IDamperSetup to the ISetupConversion interface.

In your car setup conversion class which implements the ISetupConversion interface, you need to implement this new member called IDamperSetup. I did that for all the existing cars.

When the damper settings all start from 0, this is an easy thing to do since we statically use the ACCSetupApp.SetupParser.SetupConverter class. The SetupConverter contains a class called DefaultDamperSetupImplementation, it is put into a variable/member called DefaultDamperSetup, this damper setup translates the raw values from the json to the same values in the setup viewer/comparison.

The solution to your problem:

When the dampers start from 0, easy, you can use the DefaultDamperSetup

IDamperSetup ICarSetupConversion.DamperSetup => DefaultDamperSetup;

Though here comes the trick when things are different like above.

We can create out own IDamperSetup in the car setup conversion class. Same like the AeroSetup, MechSetup and TyreSetup for about every existing conversion, you need to make your own.

IDamperSetup ICarSetupConversion.DamperSetup => new CustomDamperSetup();
private class CustomDamperSetup : IDamperSetup
{
    int IDamperSetup.BumpFast(List<int> rawValue, Wheel wheel)
    {
        return rawValue[(int)wheel];
    }

    int IDamperSetup.BumpSlow(List<int> rawValue, Wheel wheel)
    {
        return rawValue[(int)wheel] + 1;
    }

    int IDamperSetup.ReboundFast(List<int> rawValue, Wheel wheel)
    {
        return rawValue[(int)wheel];
    }

    int IDamperSetup.ReboundSlow(List<int> rawValue, Wheel wheel)
    {
        return rawValue[(int)wheel] + 1;
    }
}