Skip to content

Commit

Permalink
add wasteland racers and update version
Browse files Browse the repository at this point in the history
  • Loading branch information
Boomslangnz committed Jul 20, 2024
1 parent 71ef119 commit dd522f6
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Config/FFBPlugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified DInput8Wrapper.aps
Binary file not shown.
Binary file modified DInput8Wrapper.rc
Binary file not shown.
2 changes: 2 additions & 0 deletions Dinput8Wrapper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<ClInclude Include="Game Files\StormRacerG.h" />
<ClInclude Include="Game Files\SWDC2018.h" />
<ClInclude Include="Game Files\TokyoCop.h" />
<ClInclude Include="Game Files\WastelandRacers2071.h" />
<ClInclude Include="Game Files\WMMT3.h" />
<ClInclude Include="Game Files\WMMT5DX+.h" />
<ClInclude Include="Game Files\WMMT5DX.h" />
Expand Down Expand Up @@ -167,6 +168,7 @@
<ClCompile Include="Game Files\TokyoCop.cpp" />
<ClCompile Include="Game Files\Transformers.cpp" />
<ClCompile Include="Game Files\WackyRaces.cpp" />
<ClCompile Include="Game Files\WastelandRacers2071.cpp" />
<ClCompile Include="Game Files\WMMT3.cpp" />
<ClCompile Include="Game Files\WMMT5.cpp" />
<ClCompile Include="Game Files\InitialD4Japan.cpp" />
Expand Down
4 changes: 4 additions & 0 deletions Dinput8Wrapper.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
<ClCompile Include="Game Files\SegaRaceTV.cpp" />
<ClCompile Include="Game Files\IDTAv231.cpp" />
<ClCompile Include="Game Files\HummerExtreme.cpp" />
<ClCompile Include="Game Files\WastelandRacers2071.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\Daytona3.h">
Expand Down Expand Up @@ -431,6 +432,9 @@
<ClInclude Include="Game Files\HummerExtreme.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\WastelandRacers2071.h">
<Filter>Common Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<MASM Include="DLLWrapper.asm" />
Expand Down
5 changes: 5 additions & 0 deletions DllMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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:
Expand Down
78 changes: 78 additions & 0 deletions Game Files/WastelandRacers2071.cpp
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <sstream>
#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;
}
21 changes: 21 additions & 0 deletions Game Files/WastelandRacers2071.h
Original file line number Diff line number Diff line change
@@ -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);
};
2 changes: 1 addition & 1 deletion Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.0.0.50
v2.0.0.51

0 comments on commit dd522f6

Please sign in to comment.