diff --git a/DllMain.cpp b/DllMain.cpp index b3196aa..f3e2a6c 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -37,12 +37,16 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/BG4JP.h" #include "Game Files/ChaseHQ2.h" #include "Game Files/CrazyTaxi.h" +#include "Game Files/CruisnBlast.h" #include "Game Files/D1GP.h" #include "Game Files/Daytona3.h" #include "Game Files/Daytona3NSE.h" #include "Game Files/DeadHeat.h" #include "Game Files/DeadHeatRiders.h" #include "Game Files/DirtyDrivin.h" +#include "Game Files/FnF.h" +#include "Game Files/FnFDrift.h" +#include "Game Files/FnFSuperCars.h" #include "Game Files/FordRacing.h" #include "Game Files/FordRacingOther.h" #include "Game Files/GaelcoTuningRace.h" @@ -68,6 +72,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/MAMESupermodel.h" #include "Game Files/OutRun2Fake.h" #include "Game Files/OutRun2Real.h" +#include "Game Files/SegaRaceTV.h" #include "Game Files/SegaRacingClassic.h" #include "Game Files/SegaRally3.h" #include "Game Files/SegaRally3Other.h" @@ -1068,6 +1073,11 @@ const int MARIO_KART_GPDX_118_CUSTOM = 72; const int SEGA_SHOWDOWN = 73; const int SPRING_EFFECT = 74; const int ARCTIC_THUNDER = 75; +const int CRUISN_BLAST = 76; +const int FNF = 77; +const int FNF_DRIFT = 78; +const int FNF_SUPERCARS = 79; +const int SEGA_RACE_TV = 80; HINSTANCE Get_hInstance() { @@ -2595,6 +2605,21 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) case ARCTIC_THUNDER: game = new ArcticThunder; break; + case CRUISN_BLAST: + game = new CruisnBlast; + break; + case FNF: + game = new FnF; + break; + case FNF_DRIFT: + game = new FnFDrift; + break; + case FNF_SUPERCARS: + game = new FnFSuperCars; + break; + case SEGA_RACE_TV: + game = new SegaRaceTV; + break; case TEST_GAME_CONST: case TEST_GAME_FRICTION: case TEST_GAME_SINE: diff --git a/Game Files/FnF.cpp b/Game Files/FnF.cpp new file mode 100644 index 0000000..4f9b7f8 --- /dev/null +++ b/Game Files/FnF.cpp @@ -0,0 +1,80 @@ + +/*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 "FnF.h" + +static bool init; +static EffectTriggers* myTriggers; +static EffectConstants* myConstants; +static Helpers* myHelpers; +extern int EnableDamper; +extern int DamperStrength; + +static int(__cdecl* FnFSendToLptOrig)(uint16_t addr, uint8_t FFB); +static int __cdecl FnFSendToLpt(uint16_t addr, uint8_t FFB) +{ + if (addr == 0x378) + { + bool isLeft = FFB < 0x80; + float percentForce; + if (isLeft) { + + percentForce = static_cast(FFB) / 0x7F; + myTriggers->Rumble(0, percentForce, 100.0); + myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); + } + else { + + percentForce = static_cast(FFB - 0x80) / 0x7F; + myTriggers->Rumble(0, percentForce, 100.0); + myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); + } + } + + return 0; +} + +static void(__cdecl* FnFIgnoreLPTOrig)(); +static void __cdecl FnFignoreLPT() { + return; +} + + +void FnF::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { + if (!init) + { + //enable IO calls + myHelpers->WriteIntPtr(0x05b2ed4, 1, false); + + MH_Initialize(); + MH_CreateHook((LPVOID)0x046da10, FnFSendToLpt, (LPVOID*)&FnFSendToLptOrig); + //null all the other functions IO functions + MH_CreateHook((LPVOID)0x046dd60, FnFignoreLPT, (LPVOID*)&FnFIgnoreLPTOrig); + MH_CreateHook((LPVOID)0x046dda0, FnFignoreLPT, (LPVOID*)&FnFIgnoreLPTOrig); + MH_CreateHook((LPVOID)0x046dec0, FnFignoreLPT, (LPVOID*)&FnFIgnoreLPTOrig); + MH_CreateHook((LPVOID)0x046df70, FnFignoreLPT, (LPVOID*)&FnFIgnoreLPTOrig); + + MH_EnableHook(MH_ALL_HOOKS); + + init = true; + } + + if (EnableDamper) + triggers->Damper(DamperStrength / 100.0); + + myTriggers = triggers; + myConstants = constants; + myHelpers = helpers; +} \ No newline at end of file diff --git a/Game Files/FnF.h b/Game Files/FnF.h new file mode 100644 index 0000000..db4efdf --- /dev/null +++ b/Game Files/FnF.h @@ -0,0 +1,20 @@ +/*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/Game.h" +class FnF : public Game { + +public: + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/FnFDrift.cpp b/Game Files/FnFDrift.cpp new file mode 100644 index 0000000..a27c931 --- /dev/null +++ b/Game Files/FnFDrift.cpp @@ -0,0 +1,79 @@ + +/*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 "FnFDrift.h" + + +static bool init; +static EffectTriggers* myTriggers; +static EffectConstants* myConstants; +static Helpers* myHelpers; +extern int EnableDamper; +extern int DamperStrength; + +static int(__cdecl* FnFSendToLptOrig)(uint16_t addr, uint8_t FFB); +static int __cdecl FnFSendToLpt(uint16_t addr, uint8_t FFB) +{ + if (addr == 0x378) + { + bool isLeft = FFB < 0x80; + float percentForce; + if (isLeft) { + + percentForce = static_cast(FFB) / 0x7F; + myTriggers->Rumble(0, percentForce, 100.0); + myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); + } + else { + + percentForce = static_cast(FFB - 0x80) / 0x7F; + myTriggers->Rumble(0, percentForce, 100.0); + myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); + } + } + + return 0; + +} + + +static void(__cdecl* FnFIgnoreLPTOrig)(); +static void __cdecl FnFignoreLPT() { + return; +} + +void FnFDrift::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { + if (!init) + { + //enable IO calls + myHelpers->WriteIntPtr(0x05a3ca4, 1, false); + MH_Initialize(); + MH_CreateHook((LPVOID)0x048a410, FnFSendToLpt, (LPVOID*)&FnFSendToLptOrig); + + MH_CreateHook((LPVOID)0x048a760, FnFignoreLPT, (LPVOID*)&FnFIgnoreLPTOrig); + MH_CreateHook((LPVOID)0x048a7b0, FnFignoreLPT, (LPVOID*)&FnFIgnoreLPTOrig); + MH_CreateHook((LPVOID)0x048a8f0, FnFignoreLPT, (LPVOID*)&FnFIgnoreLPTOrig); + MH_CreateHook((LPVOID)0x048aa20, FnFignoreLPT, (LPVOID*)&FnFIgnoreLPTOrig); + MH_EnableHook(MH_ALL_HOOKS); + init = true; + } + + if (EnableDamper) + triggers->Damper(DamperStrength / 100.0); + + myTriggers = triggers; + myConstants = constants; + myHelpers = helpers; +} \ No newline at end of file diff --git a/Game Files/FnFDrift.h b/Game Files/FnFDrift.h new file mode 100644 index 0000000..545a8de --- /dev/null +++ b/Game Files/FnFDrift.h @@ -0,0 +1,21 @@ +#pragma once +/*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/Game.h" +class FnFDrift : public Game { + +public: + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/FnFSuperCars.cpp b/Game Files/FnFSuperCars.cpp new file mode 100644 index 0000000..da28577 --- /dev/null +++ b/Game Files/FnFSuperCars.cpp @@ -0,0 +1,72 @@ + +/*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 "FnFSuperCars.h" + +static bool init; +static EffectTriggers* myTriggers; +static EffectConstants* myConstants; +static Helpers* myHelpers; +extern int EnableDamper; +extern int DamperStrength; + +static void(__cdecl* FUN_00402cf0Orig)(float param_1); +static void __cdecl FUN_00402cf0(float param_1) { + + + if (param_1 >= 0) { + + myTriggers->Rumble(0, param_1, 100.0); + myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, param_1 ); + } + if (param_1 <= 0) { + myTriggers->Rumble(0, param_1 * -1, 100.0); + myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, param_1 * -1); + } + return; +} + + + +static void(__cdecl* FnFSCIgnoreLPTOrig)(); +static void __cdecl FnFSCignoreLPT() { + return ; +} + +void FnFSuperCars::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { + if (!init) + { + OutputDebugStringA("FnFSuperCars::FFBLoop"); + + + MH_Initialize(); + MH_CreateHook((LPVOID)0x0402cf0, FUN_00402cf0, (LPVOID*)&FUN_00402cf0Orig); + + //remove unwanted instances + MH_CreateHook((LPVOID)0x0402ca0, FnFSCignoreLPT, (LPVOID*)&FnFSCIgnoreLPTOrig); + MH_CreateHook((LPVOID)0x0402c50, FnFSCignoreLPT, (LPVOID*)&FnFSCIgnoreLPTOrig); + MH_CreateHook((LPVOID)0x0402bc0, FnFSCignoreLPT, (LPVOID*)&FnFSCIgnoreLPTOrig); + MH_EnableHook(MH_ALL_HOOKS); + + init = true; + } + + if (EnableDamper) + triggers->Damper(DamperStrength / 100.0); + + myTriggers = triggers; + myConstants = constants; + myHelpers = helpers; + +} \ No newline at end of file diff --git a/Game Files/FnFSuperCars.h b/Game Files/FnFSuperCars.h new file mode 100644 index 0000000..2278915 --- /dev/null +++ b/Game Files/FnFSuperCars.h @@ -0,0 +1,22 @@ +#pragma once +#pragma once +/*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/Game.h" +class FnFSuperCars : public Game { + +public: + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file