From bb803992f06be8ff2c5ff77d9146ffd33c99d28d Mon Sep 17 00:00:00 2001 From: Aaron M Date: Wed, 25 Dec 2019 11:33:42 +1300 Subject: [PATCH] Added H2Overdrive --- Config/FFBPlugin.ini | 4 ++++ Dinput8Wrapper.vcxproj | 2 ++ Dinput8Wrapper.vcxproj.filters | 4 ++++ DllMain.cpp | 5 +++++ Game Files/H2Overdrive.cpp | 39 ++++++++++++++++++++++++++++++++++ Game Files/H2Overdrive.h | 20 +++++++++++++++++ 6 files changed, 74 insertions(+) create mode 100644 Game Files/H2Overdrive.cpp create mode 100644 Game Files/H2Overdrive.h diff --git a/Config/FFBPlugin.ini b/Config/FFBPlugin.ini index f555ca7..ae9b0a1 100644 --- a/Config/FFBPlugin.ini +++ b/Config/FFBPlugin.ini @@ -148,6 +148,10 @@ HowtoRumbleHealthEffect=0 GameId=42 FeedbackLength=500 +[H2Overdrive] +GameId=43 +FeedbackLength=500 + [Sega Racing Classic] GameId=5 FeedbackLength=500 diff --git a/Dinput8Wrapper.vcxproj b/Dinput8Wrapper.vcxproj index 5a355c5..f4e6b92 100644 --- a/Dinput8Wrapper.vcxproj +++ b/Dinput8Wrapper.vcxproj @@ -24,6 +24,7 @@ + @@ -55,6 +56,7 @@ + diff --git a/Dinput8Wrapper.vcxproj.filters b/Dinput8Wrapper.vcxproj.filters index 93d0aca..3f36493 100644 --- a/Dinput8Wrapper.vcxproj.filters +++ b/Dinput8Wrapper.vcxproj.filters @@ -121,6 +121,7 @@ + @@ -259,6 +260,9 @@ Common Header Files + + Common Header Files + diff --git a/DllMain.cpp b/DllMain.cpp index 369575a..4fc1c9e 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -69,6 +69,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/HOTD4.h" #include "Game Files/Rambo.h" #include "Game Files/Transformers.h" +#include "Game Files/H2Overdrive.h" // typedefs typedef unsigned char U8; @@ -955,6 +956,7 @@ const int KO_Drive = 39; const int Transformers_ = 40; const int Golden_Gun = 41; const int Dirty_Drivin = 42; +const int H2_Overdrive = 43; HINSTANCE Get_hInstance() { @@ -2082,6 +2084,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) case Dirty_Drivin: game = new DirtyDrivin; break; + case H2_Overdrive: + game = new H2Overdrive; + break; case TEST_GAME_CONST: case TEST_GAME_FRICTION: case TEST_GAME_SINE: diff --git a/Game Files/H2Overdrive.cpp b/Game Files/H2Overdrive.cpp new file mode 100644 index 0000000..7a6cd29 --- /dev/null +++ b/Game Files/H2Overdrive.cpp @@ -0,0 +1,39 @@ +/*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 "H2Overdrive.h" + +void H2Overdrive::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { + + float ff = helpers->ReadFloat32(0x392C58, true); + + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char*)ffs.c_str()); + + if (ff > 0) + { + double percentForce = ff; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if (ff < 0) + { + double percentForce = -ff; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } +} \ No newline at end of file diff --git a/Game Files/H2Overdrive.h b/Game Files/H2Overdrive.h new file mode 100644 index 0000000..259b181 --- /dev/null +++ b/Game Files/H2Overdrive.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 H2Overdrive : public Game { + +public: + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file