1
0
mirror of synced 2024-11-27 16:10:52 +01:00

Add FFB to Gaelco games

This commit is contained in:
Boomslangnz 2022-06-10 22:41:25 +12:00
parent d30d703d67
commit 5f065a7b9c
14 changed files with 402 additions and 1 deletions

View File

@ -52,6 +52,18 @@ cd..
cd Dead Heat
rename dinput8.dll opengl32.dll
cd..
cd Dead Heat Riders
rename dinput8.dll opengl32.dll
cd..
cd Gaelco Tuning Race
rename dinput8.dll opengl32.dll
cd..
cd Tokyo Cop
rename dinput8.dll opengl32.dll
cd..
cd Ring Riders
rename dinput8.dll opengl32.dll
cd..
cd D1GP Arcade
rename dinput8.dll winmm.dll
cd..

View File

@ -242,6 +242,24 @@ FeedbackLength=500
EnableDamper=0
DamperStrength=100
[Gaelco Tuning Race]
GameId=64
FeedbackLength=500
EnableDamper=0
DamperStrength=100
[Tokyo Cop]
GameId=65
FeedbackLength=500
EnableDamper=0
DamperStrength=100
[Ring Riders]
GameId=66
FeedbackLength=500
EnableDamper=0
DamperStrength=100
[Winter X Games SnoCross]
GameId=44
FeedbackLength=500

Binary file not shown.

Binary file not shown.

View File

@ -32,6 +32,7 @@
<ClInclude Include="Game Files\DirtyDrivin.h" />
<ClInclude Include="Game Files\Flycast.h" />
<ClInclude Include="Game Files\FordRacingOther.h" />
<ClInclude Include="Game Files\GaelcoTuningRace.h" />
<ClInclude Include="Game Files\GoldenGun.h" />
<ClInclude Include="Game Files\GRID.h" />
<ClInclude Include="Game Files\H2Overdrive.h" />
@ -52,11 +53,13 @@
<ClInclude Include="Game Files\M2Emulator.h" />
<ClInclude Include="Game Files\R-Tuned.h" />
<ClInclude Include="Game Files\Rambo.h" />
<ClInclude Include="Game Files\RingRiders.h" />
<ClInclude Include="Game Files\RoadFighters3D.h" />
<ClInclude Include="Game Files\LGI.h" />
<ClInclude Include="Game Files\LGI3D.h" />
<ClInclude Include="Game Files\StormRacerG.h" />
<ClInclude Include="Game Files\SWDC2018.h" />
<ClInclude Include="Game Files\TokyoCop.h" />
<ClInclude Include="Game Files\WMMT3.h" />
<ClInclude Include="Game Files\WMMT5DX+.h" />
<ClInclude Include="Game Files\WMMT5DX.h" />
@ -86,6 +89,7 @@
<ClCompile Include="Game Files\DirtyDrivin.cpp" />
<ClCompile Include="Game Files\Flycast.cpp" />
<ClCompile Include="Game Files\FordRacingOther.cpp" />
<ClCompile Include="Game Files\GaelcoTuningRace.cpp" />
<ClCompile Include="Game Files\GoldenGun.cpp" />
<ClCompile Include="Game Files\GRID.cpp" />
<ClCompile Include="Game Files\H2Overdrive.cpp" />
@ -118,6 +122,7 @@
<ClCompile Include="Game Files\PokkenTournament.cpp" />
<ClCompile Include="Game Files\R-Tuned.cpp" />
<ClCompile Include="Game Files\Rambo.cpp" />
<ClCompile Include="Game Files\RingRiders.cpp" />
<ClCompile Include="Game Files\SegaRally3.cpp" />
<ClCompile Include="Game Files\SegaRacingClassic.cpp" />
<ClCompile Include="Game Files\FordRacing.cpp" />
@ -128,6 +133,7 @@
<ClCompile Include="Game Files\StormRacerG.cpp" />
<ClCompile Include="Game Files\SWDC2018.cpp" />
<ClCompile Include="Game Files\TestGame.cpp" />
<ClCompile Include="Game Files\TokyoCop.cpp" />
<ClCompile Include="Game Files\Transformers.cpp" />
<ClCompile Include="Game Files\WackyRaces.cpp" />
<ClCompile Include="Game Files\WMMT3.cpp" />

View File

@ -149,6 +149,9 @@
<ClCompile Include="Game Files\WMMT3.cpp" />
<ClCompile Include="Game Files\DeadHeat.cpp" />
<ClCompile Include="Game Files\DeadHeatRiders.cpp" />
<ClCompile Include="Game Files\GaelcoTuningRace.cpp" />
<ClCompile Include="Game Files\TokyoCop.cpp" />
<ClCompile Include="Game Files\RingRiders.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\Daytona3.h">
@ -356,6 +359,15 @@
<ClInclude Include="Game Files\DeadHeatRiders.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\GaelcoTuningRace.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\TokyoCop.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\RingRiders.h">
<Filter>Common Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<MASM Include="DLLWrapper.asm" />

View File

@ -45,6 +45,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "Game Files/FordRacing.h"
#include "Game Files/FordRacingOther.h"
#include "Game Files/Flycast.h"
#include "Game Files/GaelcoTuningRace.h"
#include "Game Files/GRID.h"
#include "Game Files/GoldenGun.h"
#include "Game Files/InitialD0v131.h"
@ -80,6 +81,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "Game Files/GTIClub3.h"
#include "Game Files/Demul.h"
#include "Game Files/ButtonRumble.h"
#include "Game Files/RingRiders.h"
#include "Game Files/RoadFighters3D.h"
#include "Game Files/LGI3D.h"
#include "Game Files/LGI.h"
@ -88,6 +90,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "Game Files/Rambo.h"
#include "Game Files/R-Tuned.h"
#include "Game Files/SWDC2018.h"
#include "Game Files/TokyoCop.h"
#include "Game Files/Transformers.h"
#include "Game Files/H2Overdrive.h"
#include "Game Files/StormRacerG.h"
@ -1034,6 +1037,9 @@ const int FLYCAST = 60;
const int WMMT_3 = 61;
const int DEAD_HEAT = 62;
const int DEAD_HEAT_RIDERS = 63;
const int GAELCO_TUNING_RACE = 64;
const int TOKYO_COP = 65;
const int RING_RIDERS = 66;
HINSTANCE Get_hInstance()
{
@ -2507,6 +2513,15 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case DEAD_HEAT_RIDERS:
game = new DeadHeatRiders;
break;
case GAELCO_TUNING_RACE:
game = new GaelcoTuningRace;
break;
case TOKYO_COP:
game = new TokyoCop;
break;
case RING_RIDERS:
game = new RingRiders;
break;
case TEST_GAME_CONST:
case TEST_GAME_FRICTION:
case TEST_GAME_SINE:

View File

@ -0,0 +1,94 @@
/*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 <string>
#include "GaelcoTuningRace.h"
static EffectTriggers* myTriggers;
static EffectConstants* myConstants;
static Helpers* myHelpers;
extern int EnableDamper;
extern int DamperStrength;
static bool init;
static int __stdcall SetMotor(DWORD* a1)
{
long double v1 = *(float*)&a1;
if (v1 > 0)
{
double percentForce = v1;
double percentLength = 100;
if (percentForce > 1.0)
percentForce = 1.0;
myTriggers->Rumble(percentForce, 0, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
}
else if (v1 < 0)
{
double percentForce = -v1;
double percentLength = 100;
if (percentForce > 1.0)
percentForce = 1.0;
myTriggers->Rumble(0, percentForce, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
}
return 0;
}
static bool Hook(void* toHook, void* ourFunct, int len) {
if (len < 5) {
return false;
}
DWORD curProtection;
VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
memset(toHook, 0x90, len);
DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5;
*(BYTE*)toHook = 0xE9;
*(DWORD*)((DWORD)toHook + 1) = relativeAddress;
DWORD temp;
VirtualProtect(toHook, len, curProtection, &temp);
return true;
}
static DWORD jmpBackAddy;
void GaelcoTuningRace::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (!init)
{
int hookLength = 6;
DWORD hookAddress = 0x8188ABC;
if (hookAddress)
{
jmpBackAddy = hookAddress + hookLength;
Hook((void*)hookAddress, SetMotor, hookLength);
init = true;
}
}
if (EnableDamper == 1)
triggers->Damper(DamperStrength / 100.0);
myTriggers = triggers;
myConstants = constants;
myHelpers = helpers;
}

View File

@ -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 GaelcoTuningRace : public Game {
public:
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};

92
Game Files/RingRiders.cpp Normal file
View File

@ -0,0 +1,92 @@
/*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 <string>
#include "RingRiders.h"
static EffectTriggers* myTriggers;
static EffectConstants* myConstants;
static Helpers* myHelpers;
extern int EnableDamper;
extern int DamperStrength;
static bool init;
static int __stdcall SetMotor(DWORD* a1, float a2)
{
if (a2 > 0)
{
double percentForce = a2;
double percentLength = 100;
if (percentForce > 1.0)
percentForce = 1.0;
myTriggers->Rumble(percentForce, 0, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
}
else if (a2 < 0)
{
double percentForce = -a2;
double percentLength = 100;
if (percentForce > 1.0)
percentForce = 1.0;
myTriggers->Rumble(0, percentForce, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
}
return 0;
}
static bool Hook(void* toHook, void* ourFunct, int len) {
if (len < 5) {
return false;
}
DWORD curProtection;
VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
memset(toHook, 0x90, len);
DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5;
*(BYTE*)toHook = 0xE9;
*(DWORD*)((DWORD)toHook + 1) = relativeAddress;
DWORD temp;
VirtualProtect(toHook, len, curProtection, &temp);
return true;
}
static DWORD jmpBackAddy;
void RingRiders::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (!init)
{
int hookLength = 6;
DWORD hookAddress = 0x8107568;
if (hookAddress)
{
jmpBackAddy = hookAddress + hookLength;
Hook((void*)hookAddress, SetMotor, hookLength);
init = true;
}
}
if (EnableDamper == 1)
triggers->Damper(DamperStrength / 100.0);
myTriggers = triggers;
myConstants = constants;
myHelpers = helpers;
}

20
Game Files/RingRiders.h Normal file
View File

@ -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 RingRiders : public Game {
public:
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};

92
Game Files/TokyoCop.cpp Normal file
View File

@ -0,0 +1,92 @@
/*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 <string>
#include "TokyoCop.h"
static EffectTriggers* myTriggers;
static EffectConstants* myConstants;
static Helpers* myHelpers;
extern int EnableDamper;
extern int DamperStrength;
static bool init;
static int __stdcall SetMotor(DWORD* a1, float a2)
{
if (a2 > 0)
{
double percentForce = a2;
double percentLength = 100;
if (percentForce > 1.0)
percentForce = 1.0;
myTriggers->Rumble(percentForce, 0, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
}
else if (a2 < 0)
{
double percentForce = -a2;
double percentLength = 100;
if (percentForce > 1.0)
percentForce = 1.0;
myTriggers->Rumble(0, percentForce, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
}
return 0;
}
static bool Hook(void* toHook, void* ourFunct, int len) {
if (len < 5) {
return false;
}
DWORD curProtection;
VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
memset(toHook, 0x90, len);
DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5;
*(BYTE*)toHook = 0xE9;
*(DWORD*)((DWORD)toHook + 1) = relativeAddress;
DWORD temp;
VirtualProtect(toHook, len, curProtection, &temp);
return true;
}
static DWORD jmpBackAddy;
void TokyoCop::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (!init)
{
int hookLength = 6;
DWORD hookAddress = 0x80E6FA4;
if (hookAddress)
{
jmpBackAddy = hookAddress + hookLength;
Hook((void*)hookAddress, SetMotor, hookLength);
init = true;
}
}
if (EnableDamper == 1)
triggers->Damper(DamperStrength / 100.0);
myTriggers = triggers;
myConstants = constants;
myHelpers = helpers;
}

20
Game Files/TokyoCop.h Normal file
View File

@ -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 TokyoCop : public Game {
public:
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};

View File

@ -1 +1 @@
v2.0.0.12
v2.0.0.13