From bbaa65dc5440fbd0999c95d2d300704c2d22fc4d Mon Sep 17 00:00:00 2001 From: Boomslangnz Date: Tue, 14 Jun 2022 15:18:46 +1200 Subject: [PATCH] Modify WMMT3 and Dead Heat etc --- Config/FFBPlugin.ini | 6 +++--- Game Files/DeadHeat.cpp | 27 ++++++++++----------------- Game Files/DeadHeatRiders.cpp | 25 +++++++++---------------- Game Files/WMMT3.cpp | 29 ++++++++++------------------- 4 files changed, 32 insertions(+), 55 deletions(-) diff --git a/Config/FFBPlugin.ini b/Config/FFBPlugin.ini index 00ad5e1..077d6c3 100644 --- a/Config/FFBPlugin.ini +++ b/Config/FFBPlugin.ini @@ -226,19 +226,19 @@ DamperStrength=100 [WMMT3] GameId=61 -FeedbackLength=500 +FeedbackLength=80 EnableDamper=0 DamperStrength=100 [Dead Heat] GameId=62 -FeedbackLength=500 +FeedbackLength=80 EnableDamper=0 DamperStrength=100 [Dead Heat Riders] GameId=63 -FeedbackLength=500 +FeedbackLength=80 EnableDamper=0 DamperStrength=100 diff --git a/Game Files/DeadHeat.cpp b/Game Files/DeadHeat.cpp index 20fe5c1..09d29b5 100644 --- a/Game Files/DeadHeat.cpp +++ b/Game Files/DeadHeat.cpp @@ -18,11 +18,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. extern int EnableDamper; extern int DamperStrength; -static int OldsetSpring; -static int OldsetViosity; -static int OldsetCenterOffset; -static int OldsetReflect; - void DeadHeat::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { int setSpring = GetTeknoParrotFFB(); @@ -33,7 +28,7 @@ void DeadHeat::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg if (EnableDamper) triggers->Damper(DamperStrength / 100.0); - if (setSpring != OldsetSpring && setSpring) + if (setSpring) { double percentForce = setSpring / 63.0; triggers->Spring(percentForce); @@ -45,7 +40,13 @@ void DeadHeat::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg triggers->Friction(percentForce); } - if (setReflect != OldsetReflect && setReflect) + if (setReflect == 0x00 && setCenterOffset == 0x00) + { + triggers->Rumble(0, 0, 0); + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); + } + else { if (setReflect > 0x00 && setReflect <= 0x3F) { @@ -54,17 +55,14 @@ void DeadHeat::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg triggers->Rumble(percentForce, 0, percentLength); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); } - else + else if (setReflect > 0x3F) { double percentForce = (0xFF - setReflect) / 63.0; double percentLength = 100; triggers->Rumble(0, percentForce, percentLength); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - } - if (setCenterOffset != OldsetCenterOffset && setCenterOffset) - { if (setCenterOffset > 0x00 && setCenterOffset <= 0x3F) { double percentForce = setCenterOffset / 63.0; @@ -72,7 +70,7 @@ void DeadHeat::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg triggers->Rumble(percentForce, 0, percentLength); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - else + else if (setCenterOffset < 0x00) { double percentForce = ((0xFFFFFFFF - setCenterOffset) + 1) / 63.0; double percentLength = 100; @@ -80,9 +78,4 @@ void DeadHeat::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); } } - - OldsetSpring = setSpring; - OldsetViosity = setViosity; - OldsetCenterOffset = setCenterOffset; - OldsetReflect = setReflect; } \ No newline at end of file diff --git a/Game Files/DeadHeatRiders.cpp b/Game Files/DeadHeatRiders.cpp index 17fba6c..d0f830f 100644 --- a/Game Files/DeadHeatRiders.cpp +++ b/Game Files/DeadHeatRiders.cpp @@ -18,11 +18,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. extern int EnableDamper; extern int DamperStrength; -static int OldsetSpring; -static int OldsetViosity; -static int OldsetCenterOffset; -static int OldsetReflect; - void DeadHeatRiders::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { int setSpring = GetTeknoParrotFFB(); @@ -45,7 +40,13 @@ void DeadHeatRiders::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec triggers->Friction(percentForce); } - if (setReflect != OldsetReflect && setReflect) + if (setReflect == 0x00 && setCenterOffset == 0x00) + { + triggers->Rumble(0, 0, 0); + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); + } + else { if (setReflect > 0x00 && setReflect <= 0x3F) { @@ -54,17 +55,14 @@ void DeadHeatRiders::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec triggers->Rumble(percentForce, 0, percentLength); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); } - else + else if (setReflect > 0x3F) { double percentForce = (0xFF - setReflect) / 63.0; double percentLength = 100; triggers->Rumble(0, percentForce, percentLength); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - } - if (setCenterOffset != OldsetCenterOffset && setCenterOffset) - { if (setCenterOffset > 0x00 && setCenterOffset <= 0x3F) { double percentForce = setCenterOffset / 63.0; @@ -72,7 +70,7 @@ void DeadHeatRiders::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec triggers->Rumble(percentForce, 0, percentLength); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - else + else if (setCenterOffset < 0x00) { double percentForce = ((0xFFFFFFFF - setCenterOffset) + 1) / 63.0; double percentLength = 100; @@ -80,9 +78,4 @@ void DeadHeatRiders::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); } } - - OldsetSpring = setSpring; - OldsetViosity = setViosity; - OldsetCenterOffset = setCenterOffset; - OldsetReflect = setReflect; } \ No newline at end of file diff --git a/Game Files/WMMT3.cpp b/Game Files/WMMT3.cpp index c4bbad3..afe1e40 100644 --- a/Game Files/WMMT3.cpp +++ b/Game Files/WMMT3.cpp @@ -18,13 +18,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. extern int EnableDamper; extern int DamperStrength; -static int OldsetSpring; -static int OldsetViosity; -static int OldsetCenterOffset; -static int OldsetReflect; - -static bool init; - void WMMT3::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { int setSpring = GetTeknoParrotFFB(); @@ -35,7 +28,7 @@ void WMMT3::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers if (EnableDamper) triggers->Damper(DamperStrength / 100.0); - if (setSpring != OldsetSpring && setSpring) + if (setSpring) { double percentForce = setSpring / 63.0; triggers->Spring(percentForce); @@ -47,7 +40,13 @@ void WMMT3::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers triggers->Friction(percentForce); } - if (setReflect != OldsetReflect && setReflect) + if (setReflect == 0x00 && setCenterOffset == 0x00) + { + triggers->Rumble(0, 0, 0); + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); + } + else { if (setReflect > 0x00 && setReflect <= 0x3F) { @@ -56,17 +55,14 @@ void WMMT3::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers triggers->Rumble(percentForce, 0, percentLength); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); } - else + else if (setReflect < 0x00) { double percentForce = ((0xFFFFFFFF - setReflect) + 1) / 63.0; double percentLength = 100; triggers->Rumble(0, percentForce, percentLength); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - } - if (setCenterOffset != OldsetCenterOffset && setCenterOffset) - { if (setCenterOffset > 0x00 && setCenterOffset <= 0x3F) { double percentForce = setCenterOffset / 63.0; @@ -74,7 +70,7 @@ void WMMT3::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers triggers->Rumble(percentForce, 0, percentLength); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - else + else if (setCenterOffset < 0x00) { double percentForce = ((0xFFFFFFFF - setCenterOffset) + 1) / 63.0; double percentLength = 100; @@ -82,9 +78,4 @@ void WMMT3::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); } } - - OldsetSpring = setSpring; - OldsetViosity = setViosity; - OldsetCenterOffset = setCenterOffset; - OldsetReflect = setReflect; } \ No newline at end of file