diff --git a/Common Files/TeknoParrotGame.cpp b/Common Files/TeknoParrotGame.cpp index 24bf2db..0b03b08 100644 --- a/Common Files/TeknoParrotGame.cpp +++ b/Common Files/TeknoParrotGame.cpp @@ -12,26 +12,28 @@ TeknoParrotGame::TeknoParrotGame() if (secData) { if (*((int*)secData + 2) > 0) - { *((int*)secData + 2) = 0; - } if (*((int*)secData + 6) > 0) - { *((int*)secData + 6) = 0; - } if (*((int*)secData + 7) > 0) - { *((int*)secData + 7) = 0; - } if (*((int*)secData + 8) > 0) - { *((int*)secData + 8) = 0; - } - if (configGameId == 54 || configGameId == 55) + if (*((int*)secData + 9) > 0) + *((int*)secData + 9) = 0; + + if (configGameId == 61) + { + ffbOffset = *((int*)secData + 6); + ffbOffset2 = *((int*)secData + 7); + ffbOffset3 = *((int*)secData + 8); + ffbOffset4 = *((int*)secData + 9); + } + else if (configGameId == 54 || configGameId == 55) { ffbOffset = *((int*)secData + 6); ffbOffset2 = *((int*)secData + 7); @@ -42,23 +44,19 @@ TeknoParrotGame::TeknoParrotGame() ffbOffset = *((int*)secData + 6); ffbOffset2 = *((int*)secData + 7); } + else if (configGameId == 62) + ffbOffset = *((int*)secData + 6); else - { ffbOffset = *((int*)secData + 2); - } } } int TeknoParrotGame::GetTeknoParrotFFB() { - if (configGameId == 19 || configGameId == 54 || configGameId == 55) - { + if (configGameId == 19 || configGameId == 54 || configGameId == 55 || configGameId == 61 || configGameId == 62) ffbOffset = *((int*)secData + 6); - } else - { ffbOffset = *((int*)secData + 2); - } return ffbOffset; } @@ -75,6 +73,12 @@ int TeknoParrotGame::GetTeknoParrotFFB3() return ffbOffset3; } +int TeknoParrotGame::GetTeknoParrotFFB4() +{ + ffbOffset4 = *((int*)secData + 9); + return ffbOffset4; +} + void TeknoParrotGame::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { helpers->log("TeknoParrot game not implemented"); } \ No newline at end of file diff --git a/Common Files/TeknoParrotGame.h b/Common Files/TeknoParrotGame.h index 3134662..8e557e9 100644 --- a/Common Files/TeknoParrotGame.h +++ b/Common Files/TeknoParrotGame.h @@ -11,9 +11,11 @@ protected: int ffbOffset = 0; int ffbOffset2 = 0; int ffbOffset3 = 0; + int ffbOffset4 = 0; int GetTeknoParrotFFB(); int GetTeknoParrotFFB2(); int GetTeknoParrotFFB3(); + int GetTeknoParrotFFB4(); TeknoParrotGame(); public: diff --git a/Config/FFBPlugin.ini b/Config/FFBPlugin.ini index fd940e8..144a272 100644 --- a/Config/FFBPlugin.ini +++ b/Config/FFBPlugin.ini @@ -224,6 +224,18 @@ FeedbackLength=500 EnableDamper=0 DamperStrength=100 +[WMMT3] +GameId=61 +FeedbackLength=500 +EnableDamper=0 +DamperStrength=100 + +[Dead Heat] +GameId=62 +FeedbackLength=500 +EnableDamper=0 +DamperStrength=100 + [Winter X Games SnoCross] GameId=44 FeedbackLength=500 diff --git a/Dinput8Wrapper.vcxproj b/Dinput8Wrapper.vcxproj index 8a6914a..e9bbcd9 100644 --- a/Dinput8Wrapper.vcxproj +++ b/Dinput8Wrapper.vcxproj @@ -27,6 +27,7 @@ + @@ -55,6 +56,7 @@ + @@ -73,6 +75,7 @@ + @@ -125,6 +128,7 @@ + diff --git a/Dinput8Wrapper.vcxproj.filters b/Dinput8Wrapper.vcxproj.filters index 41822f6..270c89d 100644 --- a/Dinput8Wrapper.vcxproj.filters +++ b/Dinput8Wrapper.vcxproj.filters @@ -146,6 +146,8 @@ + + @@ -344,6 +346,12 @@ Common Header Files + + Common Header Files + + + Common Header Files + diff --git a/DllMain.cpp b/DllMain.cpp index 6a25132..190d09a 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -39,6 +39,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/D1GP.h" #include "Game Files/Daytona3.h" #include "Game Files/Daytona3NSE.h" +#include "Game Files/DeadHeat.h" #include "Game Files/DirtyDrivin.h" #include "Game Files/FordRacing.h" #include "Game Files/FordRacingOther.h" @@ -64,6 +65,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/SegaRally3Other.h" #include "Game Files/SnoCross.h" #include "Game Files/WackyRaces.h" +#include "Game Files/WMMT3.h" #include "Game Files/WMMT5.h" #include "Game Files/WMMT5DX.h" #include "Game Files/WMMT5DX+.h" @@ -1028,6 +1030,8 @@ const int WMMT_5DX = 57; const int Crazy_Taxi = 58; const int DAYTONA_3_NSE = 59; const int FLYCAST = 60; +const int WMMT_3 = 61; +const int DEAD_HEAT = 62; HINSTANCE Get_hInstance() { @@ -2492,6 +2496,12 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) case FLYCAST: game = new Flycast; break; + case WMMT_3: + game = new WMMT3; + break; + case DEAD_HEAT: + game = new DeadHeat; + break; case TEST_GAME_CONST: case TEST_GAME_FRICTION: case TEST_GAME_SINE: diff --git a/Game Files/DeadHeat.cpp b/Game Files/DeadHeat.cpp new file mode 100644 index 0000000..afb9675 --- /dev/null +++ b/Game Files/DeadHeat.cpp @@ -0,0 +1,109 @@ +/*This file is part of FFB Arcade Plugin. +FFB Arcade Plugin is free software : you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +FFB Arcade Plugin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. +*/ + +#include +#include "DeadHeat.h" +#include "../Common Files/Game.h" + +extern int EnableDamper; +extern int DamperStrength; + +static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); +static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename); +static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename); + +static int OldsetSpring; +static int OldsetViosity; +static int OldsetCenterOffset; +static int OldsetReflect; + +void DeadHeat::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) +{ + int setSpring = GetTeknoParrotFFB(); + int setViosity = GetTeknoParrotFFB2(); + int setCenterOffset = GetTeknoParrotFFB3(); + int setReflect = GetTeknoParrotFFB4(); + + if (EnableDamper) + triggers->Damper(DamperStrength / 100.0); + + if (EnableForceSpringEffect) + triggers->Springi(ForceSpringStrength / 100.0); + + if (setSpring != OldsetSpring) + { + if (!setSpring) + triggers->Spring(0); + + double percentForce = setSpring / 63.0; + triggers->Spring(percentForce); + } + + if (setViosity) + { + double percentForce = setViosity / 63.0; + triggers->Friction(percentForce); + } + + if (setReflect != OldsetReflect) + { + if (setReflect == 0x00) + { + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); + } + else if (setReflect > 0x00 && setReflect <= 0x3F) + { + double percentForce = setReflect / 63.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else + { + double percentForce = (0xFF - setReflect) / 63.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + + if (setCenterOffset != OldsetCenterOffset) + { + if (setCenterOffset == 0x00) + { + triggers->Rumble(0, 0, 0); + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); + } + else if (setCenterOffset > 0x00 && setCenterOffset <= 0x3F) + { + double percentForce = setCenterOffset / 63.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else + { + double percentForce = ((0xFFFFFFFF - setCenterOffset) + 1) / 63.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + 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/DeadHeat.h b/Game Files/DeadHeat.h new file mode 100644 index 0000000..8f38d5a --- /dev/null +++ b/Game Files/DeadHeat.h @@ -0,0 +1,21 @@ +/*This file is part of FFB Arcade Plugin. +FFB Arcade Plugin is free software : you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +FFB Arcade Plugin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. +*/ + +#pragma once +#include "../Common Files/TeknoParrotGame.h" + +class DeadHeat : public TeknoParrotGame { +public: + DeadHeat() : TeknoParrotGame() { } + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/WMMT3.cpp b/Game Files/WMMT3.cpp new file mode 100644 index 0000000..3cc1ca1 --- /dev/null +++ b/Game Files/WMMT3.cpp @@ -0,0 +1,113 @@ +/*This file is part of FFB Arcade Plugin. +FFB Arcade Plugin is free software : you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +FFB Arcade Plugin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. +*/ + +#include +#include "WMMT3.h" +#include "../Common Files/Game.h" + +extern int EnableDamper; +extern int DamperStrength; + +static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); +static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename); +static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename); + +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(); + int setViosity = GetTeknoParrotFFB2(); + int setCenterOffset = GetTeknoParrotFFB3(); + int setReflect = GetTeknoParrotFFB4(); + + if (EnableDamper) + triggers->Damper(DamperStrength / 100.0); + + if (EnableForceSpringEffect) + triggers->Springi(ForceSpringStrength / 100.0); + + if (setSpring != OldsetSpring) + { + if (!setSpring) + triggers->Spring(0); + + double percentForce = setSpring / 63.0; + triggers->Spring(percentForce); + } + + if (setViosity) + { + double percentForce = setViosity / 63.0; + triggers->Friction(percentForce); + } + + if (setReflect != OldsetReflect) + { + //if (setReflect == 0x00) + //{ + // triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + // triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); + //} + //else + if (setReflect > 0x00 && setReflect <= 0x3F) + { + double percentForce = setReflect / 63.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else + { + 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) + { +/* if (setCenterOffset == 0x00) + { + triggers->Rumble(0, 0, 0); + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); + } + else*/ + if (setCenterOffset > 0x00 && setCenterOffset <= 0x3F) + { + double percentForce = setCenterOffset / 63.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else + { + double percentForce = ((0xFFFFFFFF - setCenterOffset) + 1) / 63.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + 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.h b/Game Files/WMMT3.h new file mode 100644 index 0000000..0eb4ae6 --- /dev/null +++ b/Game Files/WMMT3.h @@ -0,0 +1,21 @@ +/*This file is part of FFB Arcade Plugin. +FFB Arcade Plugin is free software : you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +FFB Arcade Plugin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. +*/ + +#pragma once +#include "../Common Files/TeknoParrotGame.h" + +class WMMT3 : public TeknoParrotGame { +public: + WMMT3() : TeknoParrotGame() { } + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Includes/FFBPluginReadme.txt b/Includes/FFBPluginReadme.txt index 533b83f..feea592 100644 --- a/Includes/FFBPluginReadme.txt +++ b/Includes/FFBPluginReadme.txt @@ -105,6 +105,7 @@ extremely generous. -Daytona USA 2 - Battle on the Edge -Daytona Championship USA -Daytona Championship USA New Season Edition +-Dead Heat -Dirt Devils -Dirty Drivin -Emergency Call Ambulance @@ -184,6 +185,7 @@ extremely generous. -Vapor TRX -Virtua Racing (CHANGE TO UPRIGHT CABINET) -Wacky Races +-Wangan Midnight Maximum Tune 3 -Wangan Midnight Maximum Tune 5 -Wangan Midnight Maximum Tune 5DX -Wangan Midnight Maximum Tune 5DX+