Add new rumble code inplace of old simple rumble
never used so no need to keep it
This commit is contained in:
parent
b11f3507c1
commit
7714a7ccd9
@ -6,7 +6,7 @@ struct EffectTriggers {
|
||||
void(*Spring)(double strength);
|
||||
void(*Friction)(double strength);
|
||||
void(*Sine)(UINT16 period, UINT16 fadePeriod, double strength);
|
||||
void(*Rumble)(double strength, double length);
|
||||
void(*Rumble)(double lowfrequency, double highfrequency, double length);
|
||||
void(*LeftRight)(double smallstrength, double largestrength, double length);
|
||||
void(*LeftRightDevice2)(double smallstrength, double largestrength, double length);
|
||||
void(*Springi)(double strength);
|
||||
|
12
DllMain.cpp
12
DllMain.cpp
@ -1566,11 +1566,19 @@ void TriggerLeftRightDevice2Effect(double smallstrength, double largestrength, d
|
||||
}
|
||||
}
|
||||
|
||||
void TriggerRumbleEffect(double strength, double length)
|
||||
void TriggerRumbleEffect(double lowfrequency, double highfrequency, double length)
|
||||
{
|
||||
if (EnableRumble == 1)
|
||||
{
|
||||
SDL_HapticRumblePlay(haptic, strength, length);
|
||||
DWORD minForceLow = (DWORD)(lowfrequency > 0.001 ? (configMinForce / 100.0 * 65535.0) : 0);
|
||||
DWORD minForceHigh = (DWORD)(highfrequency > 0.001 ? (configMinForce / 100.0 * 65535.0) : 0);
|
||||
DWORD maxForce = (DWORD)(configMaxForce / 100.0 * 65535.0);
|
||||
DWORD rangeLow = maxForce - minForceLow;
|
||||
DWORD rangeHigh = maxForce - minForceHigh;
|
||||
DWORD LowMotor = (DWORD)(lowfrequency * rangeLow + minForceLow);
|
||||
DWORD HighMotor = (DWORD)(highfrequency * rangeHigh + minForceHigh);
|
||||
|
||||
SDL_JoystickRumble(GameController, LowMotor, HighMotor, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user