diff --git a/Config/FFBPlugin.ini b/Config/FFBPlugin.ini index d2be6c9..48cfde0 100644 --- a/Config/FFBPlugin.ini +++ b/Config/FFBPlugin.ini @@ -383,6 +383,12 @@ DefaultCentering=15 EnableDamper=0 DamperStrength=100 +[Wasteland Racers 2071] +GameId=83 +FeedbackLength=500 +EnableDamper=0 +DamperStrength=100 + [KODrive] GameId=39 PowerMode=0 diff --git a/DInput8Wrapper.aps b/DInput8Wrapper.aps index bd89ce2..44f5a0e 100644 Binary files a/DInput8Wrapper.aps and b/DInput8Wrapper.aps differ diff --git a/DInput8Wrapper.rc b/DInput8Wrapper.rc index 70c68ab..85f4579 100644 Binary files a/DInput8Wrapper.rc and b/DInput8Wrapper.rc differ diff --git a/Dinput8Wrapper.vcxproj b/Dinput8Wrapper.vcxproj index f9d9936..b2fd9a1 100644 --- a/Dinput8Wrapper.vcxproj +++ b/Dinput8Wrapper.vcxproj @@ -76,6 +76,7 @@ + @@ -167,6 +168,7 @@ + diff --git a/Dinput8Wrapper.vcxproj.filters b/Dinput8Wrapper.vcxproj.filters index 69e342d..00f1681 100644 --- a/Dinput8Wrapper.vcxproj.filters +++ b/Dinput8Wrapper.vcxproj.filters @@ -167,6 +167,7 @@ + @@ -431,6 +432,9 @@ Common Header Files + + Common Header Files + diff --git a/DllMain.cpp b/DllMain.cpp index 591b725..693c78e 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -81,6 +81,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/Showdown.h" #include "Game Files/SnoCross.h" #include "Game Files/WackyRaces.h" +#include "Game Files/WastelandRacers2071.h" #include "Game Files/WMMT3.h" #include "Game Files/WMMT5.h" #include "Game Files/WMMT5DX.h" @@ -1082,6 +1083,7 @@ const int FNF_SUPERCARS = 79; const int SEGA_RACE_TV = 80; const int HUMMER_EXTREME = 81; const int INITIAL_D_THEARCADE_V231 = 82; +const int WASTELAND_RACERS_2071 = 83; HINSTANCE Get_hInstance() { @@ -2630,6 +2632,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) case INITIAL_D_THEARCADE_V231: game = new InitialDTA231; break; + case WASTELAND_RACERS_2071: + game = new WasteLandRacers2071; + break; case TEST_GAME_CONST: case TEST_GAME_FRICTION: case TEST_GAME_SINE: diff --git a/Game Files/WastelandRacers2071.cpp b/Game Files/WastelandRacers2071.cpp new file mode 100644 index 0000000..acf3662 --- /dev/null +++ b/Game Files/WastelandRacers2071.cpp @@ -0,0 +1,78 @@ +/*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 "WasteLandRacers2071.h" +#include +#include +#include "SDL.h" + +static EffectTriggers* myTriggers; +static EffectConstants* myConstants; +static Helpers* myHelpers; + +extern int EnableDamper; +extern int DamperStrength; + +static bool init; +static double ffb = 1; + +static int(__cdecl* SetForceOrig)(int param_1, int param_2, int param_3, int param_4); +static int __cdecl SetForce(int param_1, int param_2, int param_3, int param_4) { + + ffb = (double)param_1 / 32768.0; + + return 0; +} + +static int(__cdecl* SetSteeringPosOrig)(int param_1, int param_2, int param_3, int param_4); +static int __cdecl SetSteeringPos(int param_1, int param_2, int param_3, int param_4) { + + double wheelPos = (double)param_1 / 128000.0; + + if (wheelPos >= 0) { + myTriggers->Rumble(0, param_1, 100.0); + myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, wheelPos); + } + else if (wheelPos <= 0) { + myTriggers->Rumble(0, param_1 * -1, 100.0); + myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, wheelPos * -1); + } + return 0; +} + +static int(__cdecl* SetDigitalOutOrig)(int param_1, int param_2, int param_3, int param_4); +static int __cdecl SetDigitalOut(int param_1, int param_2, int param_3, int param_4) { + return 0; +} + +void WasteLandRacers2071::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { + + //check a DLL has been loaded + if (GetModuleHandleA("sdc2.dll") != NULL && !init) { + init = true; + MH_Initialize(); + MH_CreateHookApi(L"sdc2.dll", "SetForce", SetForce, (void**)&SetForceOrig); + MH_CreateHookApi(L"sdc2.dll", "SetSteeringPos", SetSteeringPos, (void**)&SetSteeringPosOrig); + MH_CreateHookApi(L"sdc2.dll", "SetDigitalOut", SetDigitalOut, (void**)&SetDigitalOutOrig); + MH_EnableHook(MH_ALL_HOOKS); + } + + if (EnableDamper) + triggers->Damper(DamperStrength / 100.0); + + triggers->Spring(ffb); + + myTriggers = triggers; + myConstants = constants; + myHelpers = helpers; +} \ No newline at end of file diff --git a/Game Files/WastelandRacers2071.h b/Game Files/WastelandRacers2071.h new file mode 100644 index 0000000..10a2f34 --- /dev/null +++ b/Game Files/WastelandRacers2071.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/Game.h" + +class WasteLandRacers2071 : public Game { + +public: + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Version.txt b/Version.txt index ca87fc4..ee73eee 100644 --- a/Version.txt +++ b/Version.txt @@ -1 +1 @@ -v2.0.0.50 \ No newline at end of file +v2.0.0.51 \ No newline at end of file