1
0
mirror of synced 2024-11-23 22:40:57 +01:00

add WMMT5DX and Crazy Taxi Steam

This commit is contained in:
Aaron M 2021-09-26 20:27:43 +13:00
parent 5cd3c5c104
commit 9b451bc49a
9 changed files with 642 additions and 12 deletions

View File

@ -390,6 +390,33 @@ FeedbackLength=80
EnableDamper=0
DamperStrength=100
[Crazy Taxi Steam]
GameId=58
FeedbackLength=100
EnableDamper=0
DamperStrength=100
EngineRumbleEffect = 1
OriginalRumbleEffect = 1
EnableGroundEffects = 1
DisableConstantEffects = 0
FFBGrassSinePeriod = 70
FFBGrassFadeSinePeriod = 0
FFBFootpathSinePeriod = 60
FFBFootpathFadeSinePeriod = 0
FFBSandSinePeriod = 90
FFBSandFadeSinePeriod = 0
FFBSandFriction = 60
FFBShorelineSinePeriod = 80
FFBShorelineFadeSinePeriod = 0
FFBShorelineFriction = 100
FFBUnderwaterSinePeriod = 75
FFBUnderwaterFadeSinePeriod = 0
FFBUnderwaterFriction = 75
FFBStairsSinePeriod = 110
FFBStairsFadeSinePeriod = 0
FFBSubwaySinePeriod = 65
FFBSubwayFadeSinePeriod = 0
[Battle Gear 4 Tuned]
GameId=13
FeedbackLength=80
@ -518,6 +545,25 @@ ForceTimeUpButton=99
EnableDamper=0
DamperStrength=100
[WMMT5DX]
GameId=57
DefaultCentering=0
FeedbackLength=80
Logging=0
SpringStrength=100
FrictionStrength=0
JointsAndStripesStrength=100
CollisionsStrength=100
TiresSlipStrength=100
HighSpeedVibrationsStrength=100
WheelSpinStrength=100
GearChangeStrength=20
GearChangeDelay=250
GearChangeLength=200
LimitBetweenHighSpeedVibrationsAndTiresSlip=75
EnableDamper=0
DamperStrength=100
[WMMT5DX+]
GameId=56
DefaultCentering=0

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\CrazyTaxi.h" />
<ClInclude Include="Game Files\D1GP.h" />
<ClInclude Include="Game Files\DirtyDrivin.h" />
<ClInclude Include="Game Files\FordRacingOther.h" />
@ -52,6 +53,7 @@
<ClInclude Include="Game Files\LGI3D.h" />
<ClInclude Include="Game Files\StormRacerG.h" />
<ClInclude Include="Game Files\SWDC2018.h" />
<ClInclude Include="Game Files\WMMT5DX+.h" />
<ClInclude Include="Game Files\WMMT5DX.h" />
<ClInclude Include="Game Files\WMMT6.h" />
<ClInclude Include="Game Files\WMMT6R.h" />
@ -66,6 +68,7 @@
<ItemGroup>
<ClCompile Include="Game Files\AliensExtermination.cpp" />
<ClCompile Include="Game Files\Batman.cpp" />
<ClCompile Include="Game Files\CrazyTaxi.cpp" />
<ClCompile Include="Game Files\D1GP.cpp" />
<ClCompile Include="Game Files\DemulATVTrackInputs.cpp" />
<ClCompile Include="Game Files\DemulFasterThanSpeedInputs.cpp" />
@ -121,6 +124,7 @@
<ClCompile Include="Game Files\WMMT5.cpp" />
<ClCompile Include="Game Files\InitialD4Japan.cpp" />
<ClCompile Include="Game Files\GTIClub3.cpp" />
<ClCompile Include="Game Files\WMMT5DX+.cpp" />
<ClCompile Include="Game Files\WMMT5DX.cpp" />
<ClCompile Include="Game Files\WMMT6.cpp" />
<ClCompile Include="Game Files\WMMT6R.cpp" />

View File

@ -141,7 +141,9 @@
<ClCompile Include="Game Files\M2EmulatorDaytonaInputs.cpp" />
<ClCompile Include="Game Files\M2EmulatorSegaRallyInputs.cpp" />
<ClCompile Include="Game Files\M2EmulatorIndy500Inputs.cpp" />
<ClCompile Include="Game Files\WMMT5DX+.cpp" />
<ClCompile Include="Game Files\WMMT5DX.cpp" />
<ClCompile Include="Game Files\CrazyTaxi.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\Daytona3.h">
@ -325,9 +327,15 @@
<ClInclude Include="Game Files\D1GP.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\WMMT5DX+.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\WMMT5DX.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\CrazyTaxi.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/CrazyTaxi.h"
#include "Game Files/D1GP.h"
#include "Game Files/Daytona3.h"
#include "Game Files/DirtyDrivin.h"
@ -63,6 +64,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "Game Files/WackyRaces.h"
#include "Game Files/WMMT5.h"
#include "Game Files/WMMT5DX.h"
#include "Game Files/WMMT5DX+.h"
#include "Game Files/WMMT6.h"
#include "Game Files/WMMT6R.h"
#include "Game Files/Machstorm.h"
@ -1018,7 +1020,9 @@ const int WMMT_6 = 52;
const int WMMT_6_R = 53;
const int SRG = 54;
const int D1_GP = 55;
const int WMMT_5DX = 56;
const int WMMT_5DXPlus = 56;
const int WMMT_5DX = 57;
const int Crazy_Taxi = 58;
HINSTANCE Get_hInstance()
{
@ -2375,6 +2379,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case WMMT_5DX:
game = new WMMT5DX;
break;
case WMMT_5DXPlus:
game = new WMMT5DXPlus;
break;
case MARIO_KART_GPDX:
game = new MarioKartGPDX100;
break;
@ -2465,6 +2472,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case D1_GP:
game = new D1GP;
break;
case Crazy_Taxi:
game = new CrazyTaxi;
break;
case TEST_GAME_CONST:
case TEST_GAME_FRICTION:
case TEST_GAME_SINE:

201
Game Files/CrazyTaxi.cpp Normal file
View File

@ -0,0 +1,201 @@
/*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 "CrazyTaxi.h"
extern int EnableDamper;
extern int DamperStrength;
static UINT8 oldGroundEffect;
static bool Collision;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 0, settingsFilename);
static int DisableConstantEffects = GetPrivateProfileInt(TEXT("Settings"), TEXT("DisableConstantEffects"), 0, settingsFilename);
static int EngineRumbleEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EngineRumbleEffect"), 0, settingsFilename);
static int OriginalRumbleEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("OriginalRumbleEffect"), 0, settingsFilename);
static int EnableGroundEffects = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableGroundEffects"), 0, settingsFilename);
static int FFBGrassSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBGrassSinePeriod"), 0, settingsFilename);
static int FFBUnderwaterSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBUnderwaterSinePeriod"), 0, settingsFilename);
static int FFBShorelineSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBShorelineSinePeriod"), 0, settingsFilename);
static int FFBGrassFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBGrassFadeSinePeriod"), 0, settingsFilename);
static int FFBUnderwaterFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBUnderwaterFadeSinePeriod"), 0, settingsFilename);
static int FFBShorelineFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBShorelineFadeSinePeriod"), 0, settingsFilename);
static int FFBFootpathSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBFootpathSinePeriod"), 0, settingsFilename);
static int FFBFootpathFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBFootpathFadeSinePeriod"), 0, settingsFilename);
static int FFBSandSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBSandSinePeriod"), 0, settingsFilename);
static int FFBSandFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBSandFadeSinePeriod"), 0, settingsFilename);
static int FFBStairsSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBStairsSinePeriod"), 0, settingsFilename);
static int FFBStairsFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBStairsFadeSinePeriod"), 0, settingsFilename);
static int FFBSubwaySinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBSubwaySinePeriod"), 0, settingsFilename);
static int FFBSubwayFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBSubwayFadeSinePeriod"), 0, settingsFilename);
static int FFBSandFriction = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBSandFriction"), 0, settingsFilename);
static int FFBUnderwaterFriction = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBUnderwaterFriction"), 0, settingsFilename);
static int FFBShorelineFriction = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBShorelineFriction"), 0, settingsFilename);
void CrazyTaxi::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
UINT8 InGame = helpers->ReadByte(0x12AA314, true);
DWORD Timer = helpers->ReadIntPtr(0x12A41A4, true);
UINT8 GroundEffect = helpers->ReadByte(0x1AB0D74, true);
UINT8 OriginalRumble = helpers->ReadByte(0x12EF93B, true);
UINT8 CrazyMoves1 = helpers->ReadByte(0x12EF892, true);
UINT8 CrazyMoves2 = helpers->ReadByte(0x12EF893, true);
float Speed = helpers->ReadFloat32(0x106A010, true);
float LeftWall = helpers->ReadFloat32(0x126214C, true);
float RightWall = helpers->ReadFloat32(0x12621D0, true);
helpers->log("got value: ");
std::string ffs = std::to_string(GroundEffect);
helpers->log((char*)ffs.c_str());
if (EnableDamper)
triggers->Damper(DamperStrength / 100.0);
if (!InGame && Timer)
{
double percentForce = Speed / 10.0;
if (percentForce > 1.0)
percentForce = 1.0;
double percentForceGround = percentForce / 2.0;
helpers->WriteByte(0x1C363A, 0x00, true);
triggers->Springi(SpringStrength / 100.0);
if (EngineRumbleEffect)
{
if (Speed < 0.001)
triggers->Rumble(0, 0.012, 100.0);
else
triggers->Rumble(0, 0.012 + percentForceGround / 7.0, 100.0);
}
if (OriginalRumbleEffect)
{
if (OriginalRumble)
triggers->Rumble(0, percentForce, 100.0);
if (CrazyMoves1 & 0x10)
triggers->Rumble(0, 1.0, 100.0);
if (CrazyMoves2)
triggers->Rumble(0, 1.0, 100.0);
}
if (OriginalRumbleEffect && CrazyMoves1 & 0x10 || OriginalRumbleEffect && CrazyMoves2) {}
else
{
switch (GroundEffect)
{
case 0x00: //Driving on road
break;
case 0x03: //Driving on grass
if (EnableGroundEffects && Speed > 0.001)
{
triggers->Rumble(percentForceGround, percentForceGround, 100.0);
triggers->Sine(FFBGrassSinePeriod, FFBGrassFadeSinePeriod, percentForceGround);
}
break;
case 0x05: //Driving on shoreline
if (EnableGroundEffects && Speed > 0.001)
{
triggers->Rumble(percentForceGround, percentForceGround, 100.0);
triggers->Sine(FFBShorelineSinePeriod, FFBShorelineFadeSinePeriod, percentForceGround);
triggers->Friction(FFBShorelineFriction / 100.0);
}
break;
case 0x09: //Driving on sand
if (EnableGroundEffects && Speed > 0.001)
{
triggers->Rumble(percentForceGround, percentForceGround, 100.0);
triggers->Sine(FFBSandSinePeriod, FFBSandFadeSinePeriod, percentForceGround);
triggers->Friction(FFBSandFriction / 100.0);
}
break;
case 0x0A: //Driving on footpath
if (EnableGroundEffects && Speed > 0.001)
{
triggers->Rumble(percentForceGround, percentForceGround, 100.0);
triggers->Sine(FFBFootpathSinePeriod, FFBFootpathFadeSinePeriod, percentForceGround);
}
break;
case 0x0E: //Driving underwater
if (EnableGroundEffects && Speed > 0.001)
{
triggers->Rumble(percentForceGround, percentForceGround, 100.0);
triggers->Sine(FFBUnderwaterSinePeriod, FFBUnderwaterFadeSinePeriod, percentForceGround);
triggers->Friction(FFBUnderwaterFriction / 100.0);
}
break;
case 0x11: //Driving stairs
case 0x13:
if (EnableGroundEffects && Speed > 0.001)
{
triggers->Rumble(0, percentForceGround, 100.0);
triggers->Sine(FFBStairsSinePeriod, FFBStairsFadeSinePeriod, percentForceGround);
}
break;
case 0x12: //Driving stairs
case 0x14:
if (EnableGroundEffects && Speed > 0.001)
{
triggers->Rumble(percentForceGround, 0, 100.0);
triggers->Sine(FFBStairsSinePeriod, FFBStairsFadeSinePeriod, percentForceGround);
}
break;
case 0x15: //Driving subway indoors
if (EnableGroundEffects && Speed > 0.001)
{
triggers->Rumble(percentForceGround, 0, 100.0);
triggers->Sine(FFBSubwaySinePeriod, FFBSubwayFadeSinePeriod, percentForceGround);
}
break;
case 0xFF: //Colliding with cars/walls
if (RightWall > 0)
{
triggers->Rumble(0, percentForce, 100.0);
if (!DisableConstantEffects)
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else if (LeftWall > 0)
{
triggers->Rumble(percentForce, 0, 100.0);
if (!DisableConstantEffects)
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else
{
if (GroundEffect != oldGroundEffect)
{
if (!Collision)
Collision = true;
}
}
break;
}
}
if (Collision)
{
triggers->Sine(150.0, 0, percentForce);
triggers->Rumble(percentForce, percentForce, 100.0);
Collision = false;
}
oldGroundEffect = GroundEffect;
}
}

20
Game Files/CrazyTaxi.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 CrazyTaxi : public Game {
public:
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};

321
Game Files/WMMT5DX+.cpp Normal file
View File

@ -0,0 +1,321 @@
/*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 "WMMT5DX+.h"
#include "SDL.h"
extern int EnableDamper;
extern int DamperStrength;
static EffectTriggers* myTriggers;
static EffectConstants* myConstants;
static Helpers* myHelpers;
extern SDL_Event e;
static UINT8 oldgear = 0;
static bool init = false;
static bool gameFfbStarted = false;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 100, settingsFilename);
static int FrictionStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FrictionStrength"), 0, settingsFilename);
static int JointsAndStripesStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("JointsAndStripesStrength"), 100, settingsFilename);
static int CollisionsStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("CollisionsStrength"), 100, settingsFilename);
static int TiresSlipStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("TiresSlipStrength"), 100, settingsFilename);
static int HighSpeedVibrationsStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("HighSpeedVibrationsStrength"), 100, settingsFilename);
static int LimitBetweenHighSpeedVibrationsAndTiresSlip = GetPrivateProfileInt(TEXT("Settings"), TEXT("LimitBetweenHighSpeedVibrationsAndTiresSlip"), 75, settingsFilename);
static int GearChangeStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearChangeStrength"), 20, settingsFilename);
static int GearChangeDelay = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearChangeDelay"), 250, settingsFilename);
static int GearChangeLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearChangeLength"), 200, settingsFilename);
static int WheelSpinStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("WheelSpinStrength"), 100, settingsFilename);
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
//static int ForceFullTune = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceFullTune"), 0, settingsFilename);
//static int DisableRaceTimer = GetPrivateProfileInt(TEXT("Settings"), TEXT("DisableRaceTimer"), 0, settingsFilename);
//static int EnableForceFinish = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceFinish"), 0, settingsFilename);
//static int EnableForceTimeUp = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceTimeUp"), 0, settingsFilename);
//static int ForceFinishButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceFinishButton"), 99, settingsFilename);
//static int ForceTimeUpButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceTimeUpButton"), 99, settingsFilename);
//static int InputThread(void* ptr)
//{
// if (1 != EnableForceFinish && 1 != EnableForceTimeUp)
// {
// return 0;
// }
//
// myHelpers->log("starting input thread");
// while (SDL_WaitEvent(&e) != 0)
// {
// if (e.type == SDL_JOYBUTTONDOWN)
// {
// myHelpers->log("button pressed");
// if (1 == EnableForceFinish && e.jbutton.button == ForceFinishButton)
// {
// INT_PTR ptr1 = myHelpers->ReadIntPtr(0x199A468, true);
// myHelpers->WriteByte(ptr1 + 0x28, 8, false);
// }
// else if (1 == EnableForceTimeUp && e.jbutton.button == ForceTimeUpButton)
// {
// int tempDisableRaceTimer = DisableRaceTimer;
// DisableRaceTimer = 0;
// myHelpers->WriteFloat32(0x199AE18, 0, true);
// if (1 == tempDisableRaceTimer)
// {
// Sleep(10000);
// DisableRaceTimer = tempDisableRaceTimer;
// }
// }
// }
// }
// myHelpers->log("input thread stopped");
// return 0;
//}
//
//static int SpamThread(void* ptr)
//{
// if (1 != ForceFullTune && 1 != DisableRaceTimer)
// {
// return 0;
// }
//
// Sleep(5000); // To avoid crashes
// myHelpers->log("starting spam thread");
// while (1)
// {
// if (1 == ForceFullTune)
// {
// INT_PTR ptr1 = myHelpers->ReadIntPtr(0x1948F10, true);
// INT_PTR ptr2 = myHelpers->ReadIntPtr(ptr1 + 0x180 + 0xa8 + 0x18, false);
// UINT8 car = myHelpers->ReadByte(ptr2 + 0x2C, false);
// std::string msg = "car: " + std::to_string(car);
// myHelpers->log((char*)msg.c_str());
//
// if (0x00 < car)
// {
// UINT8 power = myHelpers->ReadByte(ptr2 + 0x98, false);
// UINT8 handling = myHelpers->ReadByte(ptr2 + 0x9C, false);
// msg = "power: " + std::to_string(power) + " | handling: " + std::to_string(handling);
// myHelpers->log((char*)msg.c_str());
//
// if (0x20 != (power + handling))
// {
// myHelpers->log("forcing full tune");
// myHelpers->WriteByte(ptr2 + 0x98, 0x10, false);
// myHelpers->WriteByte(ptr2 + 0x9C, 0x10, false);
// }
// }
// }
//
// if (1 == DisableRaceTimer)
// {
// myHelpers->WriteFloat32(0x199AE18, 999.99, true);
// }
//
// Sleep(500); // We don't need to spam too much
// }
// myHelpers->log("spam thread stopped");
// return 0;
//}
static int GearChangeThread(void* ptr)
{
if (GearChangeDelay > 0)
{
Sleep(GearChangeDelay);
}
myHelpers->log("gear change");
double percentForce = GearChangeStrength / 100.0;
myTriggers->Sine(GearChangeLength, GearChangeLength, percentForce);
myTriggers->Rumble(0, percentForce, 150);
return 0;
}
void WMMT5DXPlus::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers)
{
if (!init)
{
init = true;
myTriggers = triggers;
myConstants = constants;
myHelpers = helpers;
//SDL_CreateThread(InputThread, "InputThread", (void*)NULL);
//SDL_CreateThread(SpamThread, "SpamThread", (void*)NULL);
}
float spring = helpers->ReadFloat32(0x1FA6F44, true);
float friction = helpers->ReadFloat32(0x1FA6F48, true);
float collisions = helpers->ReadFloat32(0x1FA6F4C, true);
float tiresSlip = helpers->ReadFloat32(0x1FA6F40, true);
int speed = helpers->ReadInt32(0x1FA7C7C, true);
std::string msg = "spring: " + std::to_string(spring) + " | friction: " + std::to_string(friction)
+ " | collisions: " + std::to_string(collisions) + " | tires slip: " + std::to_string(tiresSlip)
+ " | speed: " + std::to_string(speed);
helpers->log((char*)msg.c_str());
if (EnableDamper == 1)
{
triggers->Damper(DamperStrength / 100.0);
}
double percentForce;
if (0.001 > spring && !gameFfbStarted)
{
helpers->log("fake spring+friction until game's FFB starts");
percentForce = 0.3 * SpringStrength / 100.0;
triggers->Spring(percentForce);
percentForce = 0.5 * FrictionStrength / 100.0;
triggers->Friction(percentForce);
}
else
{
if (!gameFfbStarted)
{
helpers->log("game's FFB started");
gameFfbStarted = true;
}
percentForce = (1.0 * spring) * SpringStrength / 100.0;
triggers->Spring(percentForce);
percentForce = (1.0 * friction) * FrictionStrength / 100.0;
triggers->Friction(percentForce);
}
if (0 < collisions)
{
if (0.209 <= collisions && 0.311 >= collisions)
{
helpers->log("joint/stripe on the right");
percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0;
triggers->Sine(80, 80, percentForce);
triggers->Rumble(0, percentForce, 150);
}
else
{
helpers->log("collision on the right");
percentForce = (1.0 * collisions) * CollisionsStrength / 100.0;
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
triggers->Rumble(0, percentForce, 150);
}
}
else if (0 > collisions)
{
if (-0.209 >= collisions && -0.311 <= collisions)
{
helpers->log("joint/stripe on the left");
percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0;
triggers->Sine(80, 80, percentForce);
triggers->Rumble(0, -1.0 * percentForce, 150);
}
else
{
helpers->log("collision on the left");
percentForce = (-1.0 * collisions) * CollisionsStrength / 100.0;
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
triggers->Rumble(0, percentForce, 150);
}
}
else
{
helpers->log("resetting collision");
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0);
}
if (0 < tiresSlip)
{
helpers->log("tires slip left");
bool highSpeedVibrations = (294 <= speed) && (1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0);
percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0;
triggers->Sine(100, 100, percentForce);
if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions)))
{
triggers->Rumble(0, -1.0 * percentForce, 150);
}
}
else if (0 > tiresSlip)
{
helpers->log("tires slip right");
bool highSpeedVibrations = (294 <= speed) && (-1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0);
percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0;
triggers->Sine(100, 100, percentForce);
if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions)))
{
triggers->Rumble(0, percentForce, 150);
}
}
INT_PTR ptr1 = helpers->ReadIntPtr(0x1FD11B0, true);
UINT8 gear = helpers->ReadByte(ptr1 + 0x398, false);
if (0 < WheelSpinStrength)
{
INT_PTR ptr1 = myHelpers->ReadIntPtr(0x1F7D578, true);
INT_PTR ptr2 = myHelpers->ReadIntPtr(ptr1 + 0x268, false);
UINT8 power = myHelpers->ReadByte(ptr2 + 0xAC, false);
int rpm = helpers->ReadInt32(0x1FA7DEC, true);
int diff = 0x0A <= power ? 0 : 20;
if (
1 == gear && 10 < speed && (
((30 - diff) > speed && 3500 < rpm)
|| ((55 - diff) > speed && 5500 < rpm)
|| ((75 - diff) > speed && 7000 < rpm)
|| ((100 - diff) > speed && 7800 < rpm)
)
)
{
percentForce = (((100.0 - speed) / 100.0) * ((rpm * 100.0 / 8500.0) / 100.0)) * WheelSpinStrength / 100.0;
triggers->Sine(120, 120, percentForce);
triggers->Rumble(0, percentForce, 150);
msg = "tires spin: gear: " + std::to_string(gear) + " | speed: " + std::to_string(speed)
+ " | rpm: " + std::to_string(rpm) + " | force: " + std::to_string(percentForce);
helpers->log((char*)msg.c_str());
}
else if (
2 == gear && 10 < speed && (
((110 - (2 * diff)) > speed && 5000 < rpm)
|| ((130 - (2 * diff)) > speed && 6000 < rpm)
|| ((145 - (2 * diff)) > speed && 6500 < rpm)
|| ((160 - (2 * diff)) > speed && 7000 < rpm)
)
)
{
percentForce = (((160.0 - speed) / 150.0) * ((rpm * 100.0 / 8500.0) / 100.0)) * WheelSpinStrength / 100.0;
triggers->Sine(120, 120, percentForce);
triggers->Rumble(0, percentForce, 150);
msg = "tires spin: gear: " + std::to_string(gear) + " | speed: " + std::to_string(speed)
+ " | rpm: " + std::to_string(rpm) + " | force: " + std::to_string(percentForce);
helpers->log((char*)msg.c_str());
}
}
if (0 < GearChangeStrength)
{
ptr1 = helpers->ReadIntPtr(0x1FD11C8, true);
float time = helpers->ReadFloat32(ptr1 + 0x18, false);
if (oldgear != gear && 0 < gear && 0 < time)
{
msg = "oldgear: " + std::to_string(oldgear) + " | gear: " + std::to_string(gear)
+ " | time: " + std::to_string(time) + " | speed: " + std::to_string(speed);
helpers->log((char*)msg.c_str());
}
if (oldgear != gear && 0 < gear && 0.5 < time && 0.1 <= speed)
{
SDL_CreateThread(GearChangeThread, "GearChangeThread", (void*)NULL);
}
oldgear = gear;
}
}

20
Game Files/WMMT5DX+.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 WMMT5DXPlus : public Game {
public:
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};

View File

@ -150,11 +150,11 @@ void WMMT5DX::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
//SDL_CreateThread(SpamThread, "SpamThread", (void*)NULL);
}
float spring = helpers->ReadFloat32(0x1FA6F44, true);
float friction = helpers->ReadFloat32(0x1FA6F48, true);
float collisions = helpers->ReadFloat32(0x1FA6F4C, true);
float tiresSlip = helpers->ReadFloat32(0x1FA6F40, true);
int speed = helpers->ReadInt32(0x1FA7C7C, true);
float spring = helpers->ReadFloat32(0x1C02754, true);
float friction = helpers->ReadFloat32(0x1C02758, true);
float collisions = helpers->ReadFloat32(0x1C0275C, true);
float tiresSlip = helpers->ReadFloat32(0x1C02750, true);
int speed = helpers->ReadInt32(0x1C0342C, true);
std::string msg = "spring: " + std::to_string(spring) + " | friction: " + std::to_string(friction)
+ " | collisions: " + std::to_string(collisions) + " | tires slip: " + std::to_string(tiresSlip)
@ -253,15 +253,15 @@ void WMMT5DX::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
}
}
INT_PTR ptr1 = helpers->ReadIntPtr(0x1FD11B0, true);
INT_PTR ptr1 = helpers->ReadIntPtr(0x1C2C040, true);
UINT8 gear = helpers->ReadByte(ptr1 + 0x398, false);
if (0 < WheelSpinStrength)
{
INT_PTR ptr1 = myHelpers->ReadIntPtr(0x1F7D578, true);
INT_PTR ptr2 = myHelpers->ReadIntPtr(ptr1 + 0x268, false);
UINT8 power = myHelpers->ReadByte(ptr2 + 0xAC, false);
int rpm = helpers->ReadInt32(0x1FA7DEC, true);
//INT_PTR ptr1 = myHelpers->ReadIntPtr(0x1F7D578, true);
//INT_PTR ptr2 = myHelpers->ReadIntPtr(ptr1 + 0x268, false);
UINT8 power = 16;
int rpm = helpers->ReadInt32(0x1C0359C, true);
int diff = 0x0A <= power ? 0 : 20;
if (
@ -302,7 +302,7 @@ void WMMT5DX::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
if (0 < GearChangeStrength)
{
ptr1 = helpers->ReadIntPtr(0x1FD11C8, true);
ptr1 = helpers->ReadIntPtr(0x1C2C058, true);
float time = helpers->ReadFloat32(ptr1 + 0x18, false);
if (oldgear != gear && 0 < gear && 0 < time)