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

Merge pull request #76 from PairRoc/master

Fix FFB bug in wmmt6rr
This commit is contained in:
Boomslangnz 2024-08-01 06:45:19 +12:00 committed by GitHub
commit cf47dcb823
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 65 additions and 73 deletions

View File

@ -23,7 +23,7 @@ static Helpers* myHelpers;
extern SDL_Event e; extern SDL_Event e;
static UINT8 oldgear = 0; static UINT8 oldgear = 0;
static bool init = false; static bool init = false;
static bool gameFfbStarted = false; // static bool gameFfbStarted = false;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 100, settingsFilename); static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 100, settingsFilename);
static int FrictionStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FrictionStrength"), 0, settingsFilename); static int FrictionStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FrictionStrength"), 0, settingsFilename);
@ -158,9 +158,10 @@ void WMMT6RR::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
float collisions = helpers->ReadFloat32(0x1F2526C, true); float collisions = helpers->ReadFloat32(0x1F2526C, true);
float tiresSlip = helpers->ReadFloat32(0x1F25260, true); float tiresSlip = helpers->ReadFloat32(0x1F25260, true);
int speed = helpers->ReadInt32(0x1F2612C, true); int speed = helpers->ReadInt32(0x1F2612C, true);
int rpm = helpers->ReadInt32(0x1F2629C, true);
std::string msg = "spring: " + std::to_string(spring) + " | friction: " + std::to_string(friction) std::string msg = "spring: " + std::to_string(spring) + " | friction: " + std::to_string(friction)
+ " | collisions: " + std::to_string(collisions) + " | tires slip: " + std::to_string(tiresSlip) + " | collisions: " + std::to_string(collisions) + " | tires slip: " + std::to_string(tiresSlip)
+ " | speed: " + std::to_string(speed); + " | speed: " + std::to_string(speed)+ " | rpm: " +std::to_string(rpm);
helpers->log((char*)msg.c_str()); helpers->log((char*)msg.c_str());
if(ReverseCollision) if(ReverseCollision)
{ {
@ -177,7 +178,7 @@ void WMMT6RR::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
} }
double percentForce; double percentForce;
if (0.001 > spring && !gameFfbStarted) if (!rpm && !speed)
{ {
helpers->log("fake spring+friction until game's FFB starts"); helpers->log("fake spring+friction until game's FFB starts");
percentForce = 0.3 * SpringStrength / 100.0; percentForce = 0.3 * SpringStrength / 100.0;
@ -187,81 +188,78 @@ void WMMT6RR::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
} }
else else
{ {
if (!gameFfbStarted) helpers->log("game's FFB started");
{
helpers->log("game's FFB started");
gameFfbStarted = true;
}
percentForce = (1.0 * spring) * SpringStrength / 100.0; percentForce = (1.0 * spring) * SpringStrength / 100.0;
triggers->Spring(percentForce); triggers->Spring(percentForce);
percentForce = (1.0 * friction) * FrictionStrength / 100.0; percentForce = (1.0 * friction) * FrictionStrength / 100.0;
triggers->Friction(percentForce); triggers->Friction(percentForce);
} if (0 < collisions)
if (0 < collisions)
{
if (0.209 <= collisions && 0.311 >= collisions)
{ {
helpers->log("joint/stripe on the right"); if (0.209 <= collisions && 0.311 >= collisions)
percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; {
triggers->Sine(80, 80, percentForce); helpers->log("joint/stripe on the right");
triggers->Rumble(0, percentForce, 150); 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 else
{ {
helpers->log("collision on the right"); helpers->log("resetting collision");
percentForce = (1.0 * collisions) * CollisionsStrength / 100.0; triggers->Constant(constants->DIRECTION_FROM_LEFT, 0);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
triggers->Rumble(0, percentForce, 150);
} }
}
else if (0 > collisions) if (0 < tiresSlip)
{
if (-0.209 >= collisions && -0.311 <= collisions)
{ {
helpers->log("joint/stripe on the left"); helpers->log("tires slip left");
percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; bool highSpeedVibrations = (294 <= speed) && (1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0);
triggers->Sine(80, 80, percentForce); percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0;
triggers->Rumble(0, -1.0 * percentForce, 150); 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 else if (0 > tiresSlip)
{ {
helpers->log("collision on the left"); helpers->log("tires slip right");
percentForce = (-1.0 * collisions) * CollisionsStrength / 100.0; bool highSpeedVibrations = (294 <= speed) && (-1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0;
triggers->Rumble(0, percentForce, 150); triggers->Sine(100, 100, percentForce);
if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions)))
{
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);
}
}
/* TODO /* TODO
INT_PTR ptr1 = helpers->ReadIntPtr(0x20681C0, true); //Wg6Enma_Release_IDL0.dll+29B3E0 INT_PTR ptr1 = helpers->ReadIntPtr(0x20681C0, true); //Wg6Enma_Release_IDL0.dll+29B3E0
UINT8 gear = helpers->ReadByte(ptr1 + 0x3AC, false); //ptr1 + 0x3A8 UINT8 gear = helpers->ReadByte(ptr1 + 0x3AC, false); //ptr1 + 0x3A8

View File

@ -1,17 +1,9 @@
# FFB Arcade Plugin - WMMT6RR # FFB Arcade Plugin
Brought to you by Boomslangnz, Ducon2016, Spazzy, Adam_, jpb & pinkimo. Brought to you by Boomslangnz, Ducon2016, Spazzy, Adam_, jpb & pinkimo.
6RR version brought to you by Rocco. This is a plugin to provide Force Feedback and Rumble to various arcade games.
This is a plugin to provide Force Feedback and Rumble to various arcade games, including WMMT6RR.
## Changelog in 6RR ver:
- Temporarily removed Additional Fake Effects from 6R due to DLL memory access issue
- Add Reverse Collision option
- Add Reverse Tires Slip option
- Have fun ;)
## Requirements ## Requirements
@ -91,6 +83,8 @@ extremely generous.
- headkaze for making MAMEInterOp SDK - headkaze for making MAMEInterOp SDK
- Rocco for WMMT6RR FFB.
- Everyone who helps and gives back to this awesome scene. Thanks for everything! - Everyone who helps and gives back to this awesome scene. Thanks for everything!