1
0
mirror of synced 2024-11-23 22:40:57 +01:00

Upgrade Daytona NSE FFB

This commit is contained in:
Boomslangnz 2023-03-19 06:09:42 +13:00
parent af94899cb2
commit 0b7865d5f8

View File

@ -19,6 +19,9 @@ extern int DamperStrength;
void Daytona3NSE::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
UINT8 FFB = helpers->ReadByte(0x1334061, true);
UINT8 GameState = helpers->ReadByte(0x15C98C4, true);
DWORD TrackSelectedBase = helpers->ReadInt32(0x11C22A0, true);
UINT8 TrackSelected = helpers->ReadByte(TrackSelectedBase + 0x4, false);
if (FFB > 0x80 && FFB <= 0x8F) // ????
{
@ -31,45 +34,64 @@ void Daytona3NSE::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTr
{
double percentForce = (160 - FFB) / 16.0;
double percentLength = 100.0;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
if ((TrackSelected == 2 || TrackSelected == 4) && GameState == 0x16)
{
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else
{
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
}
if (FFB > 0xA0 && FFB <= 0xAF) // Roll Left
{
double percentForce = (176 - FFB) / 16.0;
double percentLength = 100.0;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
if ((TrackSelected == 2 || TrackSelected == 4) && GameState == 0x16)
{
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else
{
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
if (FFB > 0xB0 && FFB <= 0xBF)
if (FFB > 0xB0 && FFB <= 0xBF) // Shaking across grass etc
{
double percentForce = (192 - FFB) / 16.0;
double percentLength = 100.0;
triggers->Sine(40, 0, percentForce);
triggers->Sine(180, 0, percentForce);
triggers->Rumble(percentForce, percentForce, percentLength);
}
if (FFB > 0xC0 && FFB <= 0xCF)
if (FFB > 0xC0 && FFB <= 0xCF) // Spring + Rumble on wheel while racing
{
double percentForce = (207 - FFB) / 16.0;
double SinepercentForce = (FFB - 192) / 96.0;
triggers->Spring(percentForce);
triggers->Sine(40, 0, SinepercentForce);
}
if (FFB > 0xD0 && FFB <= 0xDF)
if (FFB > 0xD0 && FFB <= 0xDF) // Wheel loose as tyres spin (no effect)
{
double percentForce = (224 - FFB) / 16.0;
triggers->Friction(percentForce);
}
if (FFB > 0xE0 && FFB <= 0xEF) //????
if (FFB > 0xE0 && FFB <= 0xEF) // Big crash ?
{
double percentForce = (FFB - 224) / 16.0;
triggers->Spring(percentForce);
}
if (FFB > 0xF0 && FFB <= 0xFF)
if (FFB > 0xF0 && FFB <= 0xFF) // Menu only
{
double percentForce = (FFB - 240) / 16.0;
triggers->Spring(percentForce);