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

Add D1GP Support

This commit is contained in:
Aaron M 2021-05-20 18:20:30 +12:00
parent 4d90c377d6
commit 211fb9f79e
9 changed files with 176 additions and 4 deletions

View File

@ -40,6 +40,9 @@ cd..
cd Chase HQ 2
rename dinput8.dll d3d9.dll
cd..
cd D1GP Arcade
rename dinput8.dll winmm.dll
cd..
cd Demul
rename dinput8.dll winmm.dll
cd..

View File

@ -31,7 +31,7 @@ TeknoParrotGame::TeknoParrotGame()
*((int*)secData + 8) = 0;
}
if (configGameId == 54)
if (configGameId == 54 || configGameId == 55)
{
ffbOffset = *((int*)secData + 6);
ffbOffset2 = *((int*)secData + 7);
@ -51,7 +51,7 @@ TeknoParrotGame::TeknoParrotGame()
int TeknoParrotGame::GetTeknoParrotFFB()
{
if (configGameId == 19 || configGameId == 54)
if (configGameId == 19 || configGameId == 54 || configGameId == 55)
{
ffbOffset = *((int*)secData + 6);
}

View File

@ -198,6 +198,19 @@ FFBRumbleStripSineStrength=55
FFBRumbleStripSinePeriod = 30;
FFBRumbleStripFadeSinePeriod = 0;
[D1GP Arcade]
GameId=55
FeedbackLength=500
EnableDamper=0
DamperStrength=100
EnableGroundEffects = 1;
FFBGrassSineStrength=40
FFBGrassSinePeriod = 40;
FFBGrassFadeSinePeriod = 0;
FFBRumbleStripSineStrength=55
FFBRumbleStripSinePeriod = 30;
FFBRumbleStripFadeSinePeriod = 0;
[Dirty Drivin']
GameId=42
FeedbackLength=500

View File

@ -24,6 +24,7 @@
<ClInclude Include="Config\PersistentValues.h" />
<ClInclude Include="Game Files\AliensExtermination.h" />
<ClInclude Include="Game Files\Batman.h" />
<ClInclude Include="Game Files\D1GP.h" />
<ClInclude Include="Game Files\DirtyDrivin.h" />
<ClInclude Include="Game Files\FordRacingOther.h" />
<ClInclude Include="Game Files\GoldenGun.h" />
@ -64,6 +65,7 @@
<ItemGroup>
<ClCompile Include="Game Files\AliensExtermination.cpp" />
<ClCompile Include="Game Files\Batman.cpp" />
<ClCompile Include="Game Files\D1GP.cpp" />
<ClCompile Include="Game Files\DemulATVTrackInputs.cpp" />
<ClCompile Include="Game Files\DemulFasterThanSpeedInputs.cpp" />
<ClCompile Include="Game Files\DemulMaximumSpeedInputs.cpp" />

View File

@ -137,6 +137,7 @@
<ClCompile Include="Game Files\WMMT6R.cpp" />
<ClCompile Include="Game Files\InitialD0v131.cpp" />
<ClCompile Include="Game Files\StormRacerG.cpp" />
<ClCompile Include="Game Files\D1GP.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\Daytona3.h">
@ -317,6 +318,9 @@
<ClInclude Include="Game Files\StormRacerG.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\D1GP.h">
<Filter>Common Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<MASM Include="DLLWrapper.asm" />

View File

@ -35,6 +35,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "Game Files/Batman.h"
#include "Game Files/BG4JP.h"
#include "Game Files/ChaseHQ2.h"
#include "Game Files/D1GP.h"
#include "Game Files/Daytona3.h"
#include "Game Files/DirtyDrivin.h"
#include "Game Files/FordRacing.h"
@ -1015,6 +1016,7 @@ const int MARIO_KART_GPDX_USA = 51;
const int WMMT_6 = 52;
const int WMMT_6_R = 53;
const int SRG = 54;
const int D1_GP = 55;
HINSTANCE Get_hInstance()
{
@ -2455,6 +2457,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case SRG:
game = new StormRacerG;
break;
case D1_GP:
game = new D1GP;
break;
case TEST_GAME_CONST:
case TEST_GAME_FRICTION:
case TEST_GAME_SINE:

124
Game Files/D1GP.cpp Normal file
View File

@ -0,0 +1,124 @@
/*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 "D1GP.h"
#include "SDL.h"
extern int EnableDamper;
extern int DamperStrength;
static bool LetsShake;
static UINT8 oldEffect;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int EnableGroundEffects = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableGroundEffects"), 0, settingsFilename);
static int FFBGrassSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBGrassSinePeriod"), 0, settingsFilename);
static int FFBGrassSineStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBGrassSineStrength"), 0, settingsFilename);
static int FFBGrassFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBGrassFadeSinePeriod"), 0, settingsFilename);
static int FFBRumbleStripSineStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBRumbleStripSineStrength"), 0, settingsFilename);
static int FFBRumbleStripSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBRumbleStripSinePeriod"), 0, settingsFilename);
static int FFBRumbleStripFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBRumbleStripFadeSinePeriod"), 0, settingsFilename);
static int ShakeThread(void* ptr)
{
Sleep(500);
LetsShake = false;
return 0;
}
void D1GP::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers)
{
float FFBConstant = GetTeknoParrotFFB() / 1000.0;
int Effect = GetTeknoParrotFFB2();
float Speedo = helpers->ReadFloat32(0x2150F4, true);
if (EnableDamper == 1)
{
triggers->Damper(DamperStrength / 100.0);
}
if (FFBConstant > 0)
{
double percentForce = FFBConstant * 5.0;
double percentLength = 100;
if (percentForce > 1.0)
percentForce = 1.0;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else if (FFBConstant < 0)
{
double percentForce = -FFBConstant * 5.0;
double percentLength = 100;
if (percentForce > 1.0)
percentForce = 1.0;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
double percentForce = Speedo / 200.0;
if (percentForce > 1.0)
percentForce = 1.0;
if (Effect != oldEffect)
{
switch (Effect)
{
case 0x01:
triggers->Spring(0.8);
break;
case 0x02:
triggers->Rumble(0.3, 0.3, 100);
triggers->Sine(35, 0, 0.3);
break;
case 0x04:
LetsShake = true;
SDL_CreateThread(ShakeThread, "ShakeThread", (void*)NULL);
break;
}
}
if (EnableGroundEffects == 1 && Speedo > 0.1)
{
switch (Effect)
{
case 0x08:
case 0x20:
case 0x80:
case 0x200:
triggers->Rumble(percentForce, percentForce, 100);
triggers->Sine(FFBGrassSinePeriod, FFBGrassFadeSinePeriod, percentForce);
break;
case 0x10:
case 0x40:
case 0x100:
case 0x400:
triggers->Rumble(percentForce, percentForce, 100);
triggers->Sine(FFBRumbleStripSinePeriod, FFBRumbleStripFadeSinePeriod, percentForce);
break;
}
}
if (LetsShake)
{
triggers->Rumble(0.6, 0.6, 100);
triggers->Sine(70, 60, 0.4);
}
oldEffect = Effect;
}

21
Game Files/D1GP.h Normal file
View File

@ -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/TeknoParrotGame.h"
class D1GP : public TeknoParrotGame {
public:
D1GP() : TeknoParrotGame() { }
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};

View File

@ -2920,14 +2920,14 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
{
double percentForce = (256 - stateFFB) / 126.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((stateFFB > 0x00) && (stateFFB < 0x80))
{
double percentForce = (stateFFB) / 126.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}