From 145ee2d8910e4c7b63d7dd50e66d7616f2b41480 Mon Sep 17 00:00:00 2001 From: mpzmail1 Date: Sun, 7 Jul 2024 10:38:58 +0100 Subject: [PATCH] Added Hummer Extreme --- Config/FFBPlugin.ini | 7 ++++ DllMain.cpp | 5 +++ Game Files/HummerExtreme.cpp | 73 ++++++++++++++++++++++++++++++++++++ Game Files/HummerExtreme.h | 20 ++++++++++ 4 files changed, 105 insertions(+) create mode 100644 Game Files/HummerExtreme.cpp create mode 100644 Game Files/HummerExtreme.h diff --git a/Config/FFBPlugin.ini b/Config/FFBPlugin.ini index d407635..d5e02ee 100644 --- a/Config/FFBPlugin.ini +++ b/Config/FFBPlugin.ini @@ -376,6 +376,13 @@ DefaultCentering=15 EnableDamper=0 DamperStrength=100 +[Hummer Extreme] +GameId=81 +FeedbackLength=500 +DefaultCentering=15 +EnableDamper=0 +DamperStrength=100 + [KODrive] GameId=39 PowerMode=0 diff --git a/DllMain.cpp b/DllMain.cpp index f3e2a6c..9eafa99 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -53,6 +53,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/GRIDReal.h" #include "Game Files/GRIDCustom.h" #include "Game Files/GoldenGun.h" +#include "Game Files/HummerExtreme.h" #include "Game Files/InitialD0v131.h" #include "Game Files/InitialD0v211.h" #include "Game Files/InitialD0v230.h" @@ -1078,6 +1079,7 @@ const int FNF = 77; const int FNF_DRIFT = 78; const int FNF_SUPERCARS = 79; const int SEGA_RACE_TV = 80; +const int HUMMER_EXTREME = 81; HINSTANCE Get_hInstance() { @@ -2620,6 +2622,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) case SEGA_RACE_TV: game = new SegaRaceTV; break; + case HUMMER_EXTREME: + game = new HummerExtreme; + break; case TEST_GAME_CONST: case TEST_GAME_FRICTION: case TEST_GAME_SINE: diff --git a/Game Files/HummerExtreme.cpp b/Game Files/HummerExtreme.cpp new file mode 100644 index 0000000..90e5293 --- /dev/null +++ b/Game Files/HummerExtreme.cpp @@ -0,0 +1,73 @@ +/*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 "HummerExtreme.h" + +static EffectTriggers* myTriggers; +static EffectConstants* myConstants; +static Helpers* myHelpers; + +extern int EnableDamper; +extern int DamperStrength; + +bool init = false; +extern int EnableDamper; +extern int DamperStrength; + +static void(__cdecl* clSteerDualDeviceSetTRQCurveHalfPointOrig)(void* thisParam, int param_1, float param_2, float param_3); +static void __cdecl clSteerDualDeviceSetTRQCurveHalfPoint(void* thisParam, int param_1, float param_2, float param_3) { + return clSteerDualDeviceSetTRQCurveHalfPointOrig(thisParam, param_1, param_2, param_3); +} + +static void(__cdecl* clSteerDualDeviceSetVibrateOrig)(void* thisParam, int param_1, float param_2, float param_3); +static void __cdecl clSteerDualDeviceSetVibrate(void* thisParam, int param_1, float param_2, float param_3) { + myTriggers->Sine(param_3 * 100, 1, param_2 * 60); + return clSteerDualDeviceSetVibrateOrig(thisParam, param_1, param_2, param_3); +} + +static void(__cdecl* clSteerDualDeviceSetViscosityOrig)(void* thisParam, int param_1, float param_2, float param_3); +static void __cdecl clSteerDualDeviceSetViscosity(void* thisParam, int param_1, float param_2, float param_3) { + myTriggers->Friction((double)param_2); + return clSteerDualDeviceSetViscosityOrig(thisParam, param_1, param_2, param_3); +} + +static void(__cdecl* clSteerDualDeviceInitCenterOrig)(void* thisParam, int param_1, unsigned char param_2); +static void __cdecl clSteerDualDeviceInitCenter(void* thisParam, int param_1, unsigned char param_2) { + myTriggers->Springi(param_2); + return clSteerDualDeviceInitCenterOrig(thisParam, param_1, param_2); +} + +static int(__cdecl* clSteerDualDeviceWaitOrig)(int param_1); +static int __cdecl clSteerDualDeviceWait(int param_1) { + return 0; +} +void HummerExtreme::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { + + if (!init) + { + init = true; + myTriggers = triggers; + myConstants = constants; + myHelpers = helpers; + MH_Initialize(); + //checking wheel is cool for an update + MH_CreateHook((LPVOID)0x80cffb4, clSteerDualDeviceWait, (LPVOID*)&clSteerDualDeviceWaitOrig); + //Ingame effects + MH_CreateHook((LPVOID)0x80d01aa, clSteerDualDeviceSetTRQCurveHalfPoint, (LPVOID*)&clSteerDualDeviceSetTRQCurveHalfPointOrig); + MH_CreateHook((LPVOID)0x80d004a, clSteerDualDeviceSetVibrate, (LPVOID*)&clSteerDualDeviceSetVibrateOrig); + MH_CreateHook((LPVOID)0x80d00fa, clSteerDualDeviceSetViscosity, (LPVOID*)&clSteerDualDeviceSetViscosityOrig); + MH_CreateHook((LPVOID)0x80d0302, clSteerDualDeviceInitCenter, (LPVOID*)&clSteerDualDeviceInitCenterOrig); + MH_EnableHook(MH_ALL_HOOKS); + } +} \ No newline at end of file diff --git a/Game Files/HummerExtreme.h b/Game Files/HummerExtreme.h new file mode 100644 index 0000000..6b22517 --- /dev/null +++ b/Game Files/HummerExtreme.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 HummerExtreme : public Game { +public: + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +};