diff --git a/Config/FFBPlugin.ini b/Config/FFBPlugin.ini index a82b30a..d35faf7 100644 --- a/Config/FFBPlugin.ini +++ b/Config/FFBPlugin.ini @@ -160,6 +160,11 @@ FeedbackLength=500 GameId=45 FeedbackLength=500 +[R-Tuned] +GameId=46 +SpringStrength=100 +FeedbackLength=500 + [Sega Racing Classic] GameId=5 FeedbackLength=500 diff --git a/Dinput8Wrapper.vcxproj b/Dinput8Wrapper.vcxproj index 4c2c96c..ab9dc24 100644 --- a/Dinput8Wrapper.vcxproj +++ b/Dinput8Wrapper.vcxproj @@ -40,6 +40,7 @@ + @@ -81,6 +82,7 @@ + diff --git a/Dinput8Wrapper.vcxproj.filters b/Dinput8Wrapper.vcxproj.filters index c309926..586220e 100644 --- a/Dinput8Wrapper.vcxproj.filters +++ b/Dinput8Wrapper.vcxproj.filters @@ -124,6 +124,7 @@ + @@ -271,6 +272,9 @@ Common Header Files + + Common Header Files + diff --git a/DllMain.cpp b/DllMain.cpp index 0c505fa..c20da0f 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -70,6 +70,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/KODrive.h" #include "Game Files/HOTD4.h" #include "Game Files/Rambo.h" +#include "Game Files/R-Tuned.h" #include "Game Files/Transformers.h" #include "Game Files/H2Overdrive.h" @@ -961,6 +962,7 @@ const int Dirty_Drivin = 42; const int H2_Overdrive = 43; const int Sno_Cross = 44; const int Bat_man = 45; +const int R_Tuned = 46; HINSTANCE Get_hInstance() { @@ -2097,6 +2099,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) case Bat_man: game = new Batman; break; + case R_Tuned: + game = new RTuned; + break; case TEST_GAME_CONST: case TEST_GAME_FRICTION: case TEST_GAME_SINE: diff --git a/Game Files/R-Tuned.cpp b/Game Files/R-Tuned.cpp new file mode 100644 index 0000000..a349d86 --- /dev/null +++ b/Game Files/R-Tuned.cpp @@ -0,0 +1,61 @@ +/*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 "R-Tuned.h" +static bool EnableFFB = false; +static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); +static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 0, settingsFilename); + +void RTuned::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { + + UINT8 SpringCrash = helpers->ReadByte(0x8519D18, /* isRelativeOffset */ false); + UINT8 BoostEffect = helpers->ReadByte(0x8519D10, /* isRelativeOffset */ false); + UINT8 WhenBoost = helpers->ReadByte(0x8519D20, /* isRelativeOffset */ false); + + helpers->log("got value: "); + std::string ffs = std::to_string(BoostEffect); + helpers->log((char*)ffs.c_str()); + + if (!EnableFFB) + { + UINT8 LetsEnableFFB = helpers->ReadByte(0x8519C58, /* isRelativeOffset */ false); + + if (LetsEnableFFB == 0x0C) + { + helpers->WriteIntPtr(0x8519C60, 0xFFFFFFFF, false); + helpers->WriteIntPtr(0x8519C64, 0xFFFFFFFF, false); + EnableFFB = true; + } + } + + if (SpringCrash == 0xFF) + { + double percentForce = 1.0; + triggers->Sine(300, 300, percentForce); + triggers->Rumble(percentForce, percentForce, 100); + } + else if (SpringCrash == 0x04) + { + double percentForce = SpringStrength / 100.0; + triggers->Spring(percentForce); + } + + if (WhenBoost == 0x7F) + { + double percentForce = (BoostEffect / 400.0); + double percentLength = (100); + triggers->Rumble(percentForce, percentForce, percentLength); + triggers->Sine(60, 60, percentForce); + } +} \ No newline at end of file diff --git a/Game Files/R-Tuned.h b/Game Files/R-Tuned.h new file mode 100644 index 0000000..171c42b --- /dev/null +++ b/Game Files/R-Tuned.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 RTuned : public Game { + +public: + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file