1
0
mirror of synced 2024-11-24 06:50:11 +01:00

Modify FFB Effects for bunch of games etc

This commit is contained in:
Boomslangnz 2023-03-05 16:27:08 +13:00
parent 95b2485260
commit 9d6ec66f6d
24 changed files with 820 additions and 998 deletions

View File

@ -510,6 +510,30 @@ AlternativeMinForceLeftMaximumSpeed=0
AlternativeMaxForceLeftMaximumSpeed=-100 AlternativeMaxForceLeftMaximumSpeed=-100
AlternativeMinForceRightMaximumSpeed=0 AlternativeMinForceRightMaximumSpeed=0
AlternativeMaxForceRightMaximumSpeed=100 AlternativeMaxForceRightMaximumSpeed=100
EnableDamperClubKart=0
DamperStrengthClubKart=100
FeedbackLengthClubKart=500
PowerModeClubKart=0
EnableForceSpringEffectClubKart=0
ForceSpringStrengthClubKart=80
MinForceClubKart=0
MaxForceClubKart=100
AlternativeMinForceLeftClubKart=0
AlternativeMaxForceLeftClubKart=-100
AlternativeMinForceRightClubKart=0
AlternativeMaxForceRightClubKart=100
EnableDamperKingOfRoute66=0
DamperStrengthKingOfRoute66=100
FeedbackLengthKingOfRoute66=500
PowerModeKingOfRoute66=0
EnableForceSpringEffectKingOfRoute66=0
ForceSpringStrengthKingOfRoute66=80
MinForceKingOfRoute66=0
MaxForceKingOfRoute66=100
AlternativeMinForceLeftKingOfRoute66=0
AlternativeMaxForceLeftKingOfRoute66=-100
AlternativeMinForceRightKingOfRoute66=0
AlternativeMaxForceRightKingOfRoute66=100
[Crazy Taxi Steam] [Crazy Taxi Steam]
GameId=58 GameId=58

View File

@ -94,6 +94,9 @@ extern int AutoCloseWindowError;
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static bool IncreaseSine;
static int InputDeviceWheelEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelEnable"), 0, settingsFilename); static int InputDeviceWheelEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelEnable"), 0, settingsFilename);
static int configMinForceInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceInitialDDemul"), 0, settingsFilename); static int configMinForceInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceInitialDDemul"), 0, settingsFilename);
@ -108,6 +111,7 @@ static int EnableForceSpringEffectInitialDDemul = GetPrivateProfileInt(TEXT("Set
static int ForceSpringStrengthInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthInitialDDemul"), 0, settingsFilename); static int ForceSpringStrengthInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthInitialDDemul"), 0, settingsFilename);
static int EnableDamperInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperInitialDDemul"), 0, settingsFilename); static int EnableDamperInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperInitialDDemul"), 0, settingsFilename);
static int DamperStrengthInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthInitialDDemul"), 100, settingsFilename); static int DamperStrengthInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthInitialDDemul"), 100, settingsFilename);
static int IncreaseSineInitialDDemul = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSineInitialDDemul"), 0, settingsFilename);
static int configMinForceNascarRacing = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceNascarRacing"), 0, settingsFilename); static int configMinForceNascarRacing = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceNascarRacing"), 0, settingsFilename);
static int configMaxForceNascarRacing = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceNascarRacing"), 100, settingsFilename); static int configMaxForceNascarRacing = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceNascarRacing"), 100, settingsFilename);
@ -317,45 +321,58 @@ int fasterspeed(int ffspeed) {
static int InitialDFFBLoop() static int InitialDFFBLoop()
{ {
UINT8 ff1 = myHelpers->ReadByte(FFBAddress, false); DWORD FFB = myHelpers->ReadInt32(FFBAddress, false);
UINT8 ff2 = myHelpers->ReadByte(FFBAddress + 0x01, false);
UINT8 ff3 = myHelpers->ReadByte(FFBAddress + 0x02, false); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (KickStartWait) if (KickStartWait)
{ {
if ((ff1 == 0x80) && (ff3 == 0x01)) if (ffb[0] == 0x80 && ffb[2] == 0x01)
{ {
myTriggers->Spring(1.0); myTriggers->Spring(1.0);
} }
if ((ff1 == 0x85) && (ff2 == 0x3F) && (ff3 > 0x00) && (ff3 < 0x30)) if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
double percentForce = ff3 / 47.0; double percentForce = ffb[2] / 127.0;
if (IncreaseSine)
{
percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
}
double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
myTriggers->Rumble(percentForce, percentForce, percentLength); myTriggers->Rumble(percentForce, percentForce, percentLength);
myTriggers->Sine(40, 0, percentForce); myTriggers->Sine(static_cast<int>(Period), 0, percentForce);
} }
if ((ff1 == 0x86) && (ff2 == 0x02) && (ff3 > 0x09) && (ff3 < 0x3C)) if (ffb[0] == 0x86 && ffb[2] > 0x00)
{ {
double percentForce = (60 - ff3) / 43.0; double percentForce = ffb[2] / 127.0;
double percentLength = 100; double percentLength = 100;
myTriggers->Spring(percentForce); myTriggers->Spring(percentForce);
} }
if ((ff1 == 0x84) && (ff2 == 0x00) && (ff3 > 0x37) && (ff3 < 0x80)) if (ffb[0] == 0x84 && ffb[2] > 0x00)
{ {
double percentForce = (128 - ff3) / 72.0; if (ffb[1] == 0x00)
double percentLength = 100; {
myTriggers->Rumble(percentForce, 0, percentLength); double percentForce = (128 - ffb[0]) / 127.0;
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); double percentLength = 100;
} myTriggers->Rumble(percentForce, 0, percentLength);
else if ((ff1 == 0x84) && (ff2 == 0x01) && (ff3 > 0x00) && (ff3 < 0x49)) myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
{ }
double percentForce = (ff3 / 72.0); else
double percentLength = 100; {
myTriggers->Rumble(0, percentForce, percentLength); double percentForce = (ffb[0] / 127.0);
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); double percentLength = 100;
myTriggers->Rumble(0, percentForce, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
}
} }
} }
return 0; return 0;

View File

@ -32,27 +32,29 @@ void GTIClub3::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
} }
if ((ff1 > 0x00)& (ff1 < 0x40)& (menu == 0)) if (!menu)
{ {
double percentForce = (ff1) / 63.0; if (ff1 > 0x00 && ff1 < 0x40)
double percentLength = 100; {
triggers->Rumble(percentForce, percentForce, percentLength); double percentForce = ff1 / 63.0;
triggers->Sine(120, 120, percentForce); double percentLength = 100;
} triggers->Rumble(percentForce, percentForce, percentLength);
if ((ff > 0x80)& (ff < 0x101)& (menu == 0)) triggers->Sine(120, 0, percentForce);
{ }
helpers->log("moving wheel right");
double percentForce = (257 - ff) / 128.0; if (ff > 0x80 && ff < 0x101)
double percentLength = 100; {
triggers->Rumble(percentForce, 0, percentLength); double percentForce = (257 - ff) / 128.0;
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); double percentLength = 100;
} triggers->Rumble(percentForce, 0, percentLength);
else if ((ff > 0x00)& (ff < 0x80)& (menu == 0)) triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
{ }
helpers->log("moving wheel left"); else if (ff > 0x00 && ff < 0x80)
double percentForce = (ff) / 127.0; {
double percentLength = 100; double percentForce = (ff) / 127.0;
triggers->Rumble(0, percentForce, percentLength); double percentLength = 100;
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
} }
} }

View File

@ -18,27 +18,20 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static bool outputinit = false; static bool outputinit;
static UINT8 ff;
static UINT8 oldff;
static UINT8 newff;
static UINT8 ff1;
static UINT8 ff2;
static UINT8 ff3;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename); static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename);
static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename); static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename);
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename); static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
static int IDZMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("IDZMode"), 0, settingsFilename);
static int EnableOutputs = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableOutputs"), 0, settingsFilename); static int EnableOutputs = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableOutputs"), 0, settingsFilename);
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
void InitialD0::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void InitialD0::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (!outputinit) if (!outputinit)
{ {
if (EnableOutputs == 1) if (EnableOutputs)
{ {
outputinit = true; outputinit = true;
LoadLibraryA("OutputBlaster.dll"); LoadLibraryA("OutputBlaster.dll");
@ -46,127 +39,60 @@ void InitialD0::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
} }
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1)) if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
{
ExitProcess(0); ExitProcess(0);
}
if (EnableDamper == 1) if (EnableDamper)
{
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x168317C, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (ffb[0] == 0x80 && ffb[2] == 0x01)
{
triggers->Spring(1.0);
} }
if (IDZMode == 0) if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
ff = helpers->ReadByte(0x168317F, true); double percentForce = ffb[2] / 127.0;
oldff = 0;
newff = ff;
helpers->log("got value: "); if (IncreaseSine)
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
if (EnableForceSpringEffect == 1)
{ {
triggers->Springi(ForceSpringStrength / 100.0); percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
} }
if (oldff != newff) double Period = ffb[1] / 127.0 * 120.0;
{ double percentLength = 100;
if ((ff > 0x37) && (ff < 0x80)) triggers->Rumble(percentForce, percentForce, percentLength);
{ triggers->Sine(static_cast<int>(Period), 0, percentForce);
helpers->log("moving wheel right");
double percentForce = (128 - ff) / 72.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff > 0x00) && (ff < 0x49))
{
helpers->log("moving wheel left");
double percentForce = (ff) / 72.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
oldff = newff;
} }
else
{
ff1 = helpers->ReadByte(0x168317C, true);
ff2 = helpers->ReadByte(0x168317D, true);
if (IDZMode == 1)
{
ff3 = helpers->ReadByte(0x168317E, true);
}
else if (IDZMode == 2)
{
ff3 = helpers->ReadByte(0x168317F, true);
}
if (ff1 == 80) if (ffb[0] == 0x86 && ffb[2] > 0x00)
{
double percentForce = ffb[2] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{
if (ffb[1] == 0x00)
{ {
helpers->log("Spring"); double percentForce = (128 - ffb[0]) / 127.0;
triggers->Spring(1.0); double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if (ff1 == 0x85) else
{ {
if ((ff2 > 0x00) && (ff2 < 0x30)) double percentForce = (ffb[0] / 127.0);
{ double percentLength = 100;
helpers->log("Sine"); triggers->Rumble(0, percentForce, percentLength);
double percentForce = ff2 / 47.0; triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(40, 0, percentForce);
}
}
else if (ff1 == 0x86)
{
if ((ff3 > 0x00) && (ff3 < 0x4E))
{
helpers->log("Spring");
double percentForce = ff3 / 77.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
}
else if (ff1 == 0x84)
{
if ((ff2 == 0x00) && (ff3 > 0x37) && (ff3 < 0x80))
{
helpers->log("moving wheel right");
double percentForce = (128 - ff3) / 72.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x00) && (ff3 < 0x49))
{
helpers->log("moving wheel left");
double percentForce = (ff3 / 72.0);
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else
{
if ((ff2 == 0x00) && (ff3 > 0x00) && (ff3 < 0x38))
{
helpers->log("moving wheel right");
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x48))
{
helpers->log("moving wheel left");
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
} }
} }
} }

View File

@ -15,24 +15,17 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "InitialD0v211.h" #include "InitialD0v211.h"
#include "math.h" #include "math.h"
static UINT8 ff;
static UINT8 oldff;
static UINT8 newff;
static UINT8 ff1;
static UINT8 ff2;
static UINT8 ff3;
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static bool outputinit = false; static bool outputinit;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename); static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename);
static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename); static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename);
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename); static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
static int IDZMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("IDZMode"), 0, settingsFilename);
static int EnableOutputs = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableOutputs"), 0, settingsFilename); static int EnableOutputs = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableOutputs"), 0, settingsFilename);
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
void InitialD0v211::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void InitialD0v211::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
@ -46,127 +39,60 @@ void InitialD0v211::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
} }
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1)) if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
{
ExitProcess(0); ExitProcess(0);
}
if (EnableDamper == 1) if (EnableDamper)
{
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x18A720C, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (ffb[0] == 0x80 && ffb[2] == 0x01)
{
triggers->Spring(1.0);
} }
if (IDZMode == 0) if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
ff = helpers->ReadByte(0x18A720F, true); double percentForce = ffb[2] / 127.0;
oldff = 0;
newff = ff;
helpers->log("got value: "); if (IncreaseSine)
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
if (EnableForceSpringEffect == 1)
{ {
triggers->Springi(ForceSpringStrength / 100.0); percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
} }
if (oldff != newff) double Period = ffb[1] / 127.0 * 120.0;
{ double percentLength = 100;
if ((ff > 0x37) && (ff < 0x80)) triggers->Rumble(percentForce, percentForce, percentLength);
{ triggers->Sine(static_cast<int>(Period), 0, percentForce);
helpers->log("moving wheel right");
double percentForce = (128 - ff) / 72.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff > 0x00) && (ff < 0x49))
{
helpers->log("moving wheel left");
double percentForce = (ff) / 72.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
oldff = newff;
} }
else
{
ff1 = helpers->ReadByte(0x18A720C, true);
ff2 = helpers->ReadByte(0x18A720D, true);
if (IDZMode == 1)
{
ff3 = helpers->ReadByte(0x18A720E, true);
}
else if (IDZMode == 2)
{
ff3 = helpers->ReadByte(0x18A720F, true);
}
if (ff1 == 80) if (ffb[0] == 0x86 && ffb[2] > 0x00)
{
double percentForce = ffb[2] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{
if (ffb[1] == 0x00)
{ {
helpers->log("Spring"); double percentForce = (128 - ffb[0]) / 127.0;
triggers->Spring(1.0); double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if (ff1 == 0x85) else
{ {
if ((ff2 > 0x00) && (ff2 < 0x30)) double percentForce = (ffb[0] / 127.0);
{ double percentLength = 100;
helpers->log("Sine"); triggers->Rumble(0, percentForce, percentLength);
double percentForce = ff2 / 47.0; triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(40, 0, percentForce);
}
}
else if (ff1 == 0x86)
{
if ((ff3 > 0x00) && (ff3 < 0x4E))
{
helpers->log("Spring");
double percentForce = ff3 / 77.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
}
else if (ff1 == 0x84)
{
if ((ff2 == 0x00) && (ff3 > 0x37) && (ff3 < 0x80))
{
helpers->log("moving wheel right");
double percentForce = (128 - ff3) / 72.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x00) && (ff3 < 0x49))
{
helpers->log("moving wheel left");
double percentForce = (ff3 / 72.0);
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else
{
if ((ff2 == 0x00) && (ff3 > 0x00) && (ff3 < 0x38))
{
helpers->log("moving wheel right");
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x48))
{
helpers->log("moving wheel left");
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
} }
} }
} }

View File

@ -15,30 +15,23 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "InitialD0v230.h" #include "InitialD0v230.h"
#include "math.h" #include "math.h"
static UINT8 ff;
static UINT8 oldff;
static UINT8 newff;
static UINT8 ff1;
static UINT8 ff2;
static UINT8 ff3;
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static bool outputinit = false; static bool outputinit;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename); static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename);
static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename); static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename);
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename); static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
static int IDZMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("IDZMode"), 0, settingsFilename);
static int EnableOutputs = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableOutputs"), 0, settingsFilename); static int EnableOutputs = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableOutputs"), 0, settingsFilename);
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
void InitialD0v230::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void InitialD0v230::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (!outputinit) if (!outputinit)
{ {
if (EnableOutputs == 1) if (EnableOutputs)
{ {
outputinit = true; outputinit = true;
LoadLibraryA("OutputBlaster.dll"); LoadLibraryA("OutputBlaster.dll");
@ -46,127 +39,60 @@ void InitialD0v230::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
} }
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1)) if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
{
ExitProcess(0); ExitProcess(0);
}
if (EnableDamper == 1) if (EnableDamper)
{
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x18B54DC, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (ffb[0] == 0x80 && ffb[2] == 0x01)
{
triggers->Spring(1.0);
} }
if (IDZMode == 0) if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
ff = helpers->ReadByte(0x18B54DF, true); double percentForce = ffb[2] / 127.0;
oldff = 0;
newff = ff;
helpers->log("got value: "); if (IncreaseSine)
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
if (EnableForceSpringEffect == 1)
{ {
triggers->Springi(ForceSpringStrength / 100.0); percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
} }
if (oldff != newff) double Period = ffb[1] / 127.0 * 120.0;
{ double percentLength = 100;
if ((ff > 0x37) && (ff < 0x80)) triggers->Rumble(percentForce, percentForce, percentLength);
{ triggers->Sine(static_cast<int>(Period), 0, percentForce);
helpers->log("moving wheel right");
double percentForce = (128 - ff) / 72.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff > 0x00) && (ff < 0x49))
{
helpers->log("moving wheel left");
double percentForce = (ff) / 72.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
oldff = newff;
} }
else
{
ff1 = helpers->ReadByte(0x18B54DC, true);
ff2 = helpers->ReadByte(0x18B54DD, true);
if (IDZMode == 1)
{
ff3 = helpers->ReadByte(0x18B54DE, true);
}
else if (IDZMode == 2)
{
ff3 = helpers->ReadByte(0x18B54DF, true);
}
if (ff1 == 80) if (ffb[0] == 0x86 && ffb[2] > 0x00)
{
double percentForce = ffb[2] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{
if (ffb[1] == 0x00)
{ {
helpers->log("Spring"); double percentForce = (128 - ffb[0]) / 127.0;
triggers->Spring(1.0); double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if (ff1 == 0x85) else
{ {
if ((ff2 > 0x00) && (ff2 < 0x30)) double percentForce = (ffb[0] / 127.0);
{ double percentLength = 100;
helpers->log("Sine"); triggers->Rumble(0, percentForce, percentLength);
double percentForce = ff2 / 47.0; triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(40, 0, percentForce);
}
}
else if (ff1 == 0x86)
{
if ((ff3 > 0x00) && (ff3 < 0x4E))
{
helpers->log("Spring");
double percentForce = ff3 / 77.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
}
else if (ff1 == 0x84)
{
if ((ff2 == 0x00) && (ff3 > 0x37) && (ff3 < 0x80))
{
helpers->log("moving wheel right");
double percentForce = (128 - ff3) / 72.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x00) && (ff3 < 0x49))
{
helpers->log("moving wheel left");
double percentForce = (ff3 / 72.0);
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else
{
if ((ff2 == 0x00) && (ff3 > 0x00) && (ff3 < 0x38))
{
helpers->log("moving wheel right");
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x48))
{
helpers->log("moving wheel left");
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
} }
} }
} }

View File

@ -18,48 +18,56 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
void InitialD4::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void InitialD4::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
DWORD FFB = helpers->ReadInt32(0x089AE898, true);
UINT8 ff = helpers->ReadByte(0x089AE89A, /* isRelativeOffset */ false); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
UINT8 ff1 = helpers->ReadByte(0x089AE899, /* isRelativeOffset */ false);
UINT8 ff2 = helpers->ReadByte(0x089AE898, /* isRelativeOffset */ false);
helpers->log("got value: ");
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
if (EnableDamper == 1) if (ffb[0] == 0x80 && ffb[2] == 0x01)
{ {
triggers->Damper(DamperStrength / 100.0); triggers->Spring(1.0);
} }
if (ff2 == 0x86) if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
triggers->Spring(0.8); double percentForce = ffb[2] / 127.0;
}
if (ff2 == 0x85) //cars colliding or rubbing against wall etc if (IncreaseSine)
{
if (ff1 > 0)
{ {
double percentLength = 200; percentForce = percentForce * 2.0;
double percentForce = (0.6);
triggers->Friction(percentForce); if (percentForce > 1.0)
triggers->Rumble(percentForce, percentForce, percentLength); percentForce = 1.0;
} }
double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce);
} }
if (ff2 == 0x84)
if (ffb[0] == 0x86 && ffb[2] > 0x00)
{ {
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) double percentForce = ffb[2] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{
if (ffb[1] == 0x00)
{ {
helpers->log("moving wheel right"); double percentForce = (128 - ffb[0]) / 127.0;
double percentForce = (128 - ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) else
{ {
helpers->log("moving wheel left"); double percentForce = (ffb[0] / 127.0);
double percentForce = (ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -18,48 +18,60 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
void InitialD4Japan::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void InitialD4Japan::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
UINT8 ff = helpers->ReadByte(0x0898985A, /* isRelativeOffset */ false); if (EnableDamper)
UINT8 ff1 = helpers->ReadByte(0x08989859, /* isRelativeOffset */ false);
UINT8 ff2 = helpers->ReadByte(0x08989858, /* isRelativeOffset */ false);
helpers->log("got value: ");
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
if (EnableDamper == 1)
{
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x08989858, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (ffb[0] == 0x80 && ffb[2] == 0x01)
{
triggers->Spring(1.0);
} }
if (ff2 == 0x86) if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
triggers->Spring(0.8); double percentForce = ffb[2] / 127.0;
}
if (ff2 == 0x85) //cars colliding or rubbing against wall etc if (IncreaseSine)
{
if (ff1 > 0)
{ {
double percentLength = 200; percentForce = percentForce * 2.0;
double percentForce = (0.6);
triggers->Friction(percentForce); if (percentForce > 1.0)
triggers->Rumble(percentForce, percentForce, percentLength); percentForce = 1.0;
} }
double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce);
} }
if (ff2 == 0x84)
if (ffb[0] == 0x86 && ffb[2] > 0x00)
{ {
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) double percentForce = ffb[2] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{
if (ffb[1] == 0x00)
{ {
helpers->log("moving wheel right"); double percentForce = (128 - ffb[0]) / 127.0;
double percentForce = (128 - ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) else
{ {
helpers->log("moving wheel left"); double percentForce = (ffb[0] / 127.0);
double percentForce = (ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -18,48 +18,60 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
void InitialD5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void InitialD5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
UINT8 ff = helpers->ReadByte(0x08CB6122, /* isRelativeOffset */ false); if (EnableDamper)
UINT8 ff1 = helpers->ReadByte(0x08CB6121, /* isRelativeOffset */ false);
UINT8 ff2 = helpers->ReadByte(0x08CB6120, /* isRelativeOffset */ false);
helpers->log("got value: ");
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
if (EnableDamper == 1)
{
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x8CB6120, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (ffb[0] == 0x80 && ffb[2] == 0x01)
{
triggers->Spring(1.0);
} }
if (ff2 == 0x86) if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
triggers->Spring(0.8); double percentForce = ffb[2] / 127.0;
}
if (ff2 == 0x85) //cars colliding or rubbing against wall etc if (IncreaseSine)
{
if (ff1 > 0)
{ {
double percentLength = 200; percentForce = percentForce * 2.0;
double percentForce = (0.6);
triggers->Friction(percentForce); if (percentForce > 1.0)
triggers->Rumble(percentForce, percentForce, percentLength); percentForce = 1.0;
} }
double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce);
} }
if (ff2 == 0x84)
if (ffb[0] == 0x86 && ffb[2] > 0x00)
{ {
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) double percentForce = ffb[2] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{
if (ffb[1] == 0x00)
{ {
helpers->log("moving wheel right"); double percentForce = (128 - ffb[0]) / 127.0;
double percentForce = (128 - ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) else
{ {
helpers->log("moving wheel left"); double percentForce = (ffb[0] / 127.0);
double percentForce = (ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -17,6 +17,9 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
static int carscollide(int ffcollide) { static int carscollide(int ffcollide) {
switch (ffcollide) { switch (ffcollide) {
case 0x50F05: case 0x50F05:
@ -127,49 +130,55 @@ static int rubbingwalls(int ffwalls) {
void InitialD6::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) void InitialD6::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers)
{ {
int ffrubbingwalls = 0; DWORD FFB = GetTeknoParrotFFB();
int ffcarcollision = 0;
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (EnableDamper)
triggers->Damper(DamperStrength / 100.0);
if (ffb[2] == 0x00 && ffb[0] == 0x01)
{ {
helpers->log("in ID6 Ffbloop"); triggers->Spring(1.0);
const int ff = GetTeknoParrotFFB(); }
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
ffcarcollision = carscollide(ff);
ffrubbingwalls = rubbingwalls(ff);
if (EnableDamper == 1) if (ffb[2] == 0x05 && ffb[1] > 0x00 && ffb[0] > 0x00)
{
double percentForce = ffb[0] / 127.0;
if (IncreaseSine)
{ {
triggers->Damper(DamperStrength / 100.0); percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
} }
if (ff == 0x60000) double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce);
}
if (ffb[2] == 0x06 && ffb[0] > 0x00 && ffb[0] < 0x80)
{
double percentForce = ffb[0] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[2] == 0x04 && ffb[0] > 0x00 && ffb[0] < 0x80)
{
if (ffb[1] == 0x00)
{ {
triggers->Spring(0.8); double percentForce = (128 - ffb[0]) / 127.0;
}
if (ffrubbingwalls > 0) // car rubbing against wall
{
double percentLength = 200;
double percentForce = (ffrubbingwalls / 31.0);
triggers->Friction(percentForce);
triggers->Rumble(percentForce, percentForce, percentLength);
}
if (ffcarcollision > 0) //cars colliding or rubbing with each other
{
double percentLength = 200;
double percentForce = (ffcarcollision / 16.0);
triggers->Friction(percentForce);
triggers->Rumble(percentForce, percentForce, percentLength);
}
if ((ff > 0x40037) && (ff < 0x40080))
{
double percentForce = (262272 - ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((ff > 0x40100) && (ff < 0x40149)) else
{ {
double percentForce = (ff - 262400) / 72.0; double percentForce = (ffb[0] / 127.0);
double percentLength = 100; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -17,159 +17,60 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static int carscollide(int ffcollide) { static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
switch (ffcollide) { static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
case 0x50F05:
return 16;
case 0x50E05:
return 15;
case 0x50D05:
return 14;
case 0x50C05:
return 13;
case 0x50B05:
return 12;
case 0x50A05:
return 11;
case 0x50905:
return 10;
case 0x50805:
return 9;
case 0x50705:
return 8;
case 0x50605:
return 7;
case 0x050505:
return 6;
case 0x050405:
return 5;
case 0x050305:
return 4;
case 0x50205:
return 3;
case 0x50105:
return 2;
case 0x50005:
return 1;
default:
return 0;
}
}
static int rubbingwalls(int ffwalls) {
switch (ffwalls) {
case 0x51F08:
return 31;
case 0x51E08:
return 30;
case 0x51D08:
return 29;
case 0x51C08:
return 28;
case 0x51B08:
return 27;
case 0x51A08:
return 26;
case 0x51908:
return 25;
case 0x51808:
return 24;
case 0x51708:
return 23;
case 0x51608:
return 22;
case 0x51508:
return 21;
case 0x51408:
return 20;
case 0x51308:
return 19;
case 0x51208:
return 18;
case 0x51108:
return 17;
case 0x50F08:
return 16;
case 0x50E08:
return 15;
case 0x50D08:
return 14;
case 0x50C08:
return 13;
case 0x50B08:
return 12;
case 0x50A08:
return 11;
case 0x50908:
return 10;
case 0x50808:
return 9;
case 0x50708:
return 8;
case 0x50608:
return 7;
case 0x50508:
return 6;
case 0x50408:
return 5;
case 0x50308:
return 4;
case 0x50208:
return 3;
case 0x50108:
return 2;
case 0x50008:
return 1;
default:
return 0;
}
}
void InitialD7::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) void InitialD7::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers)
{ {
int ffrubbingwalls = 0; DWORD FFB = GetTeknoParrotFFB();
int ffcarcollision = 0;
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (EnableDamper)
triggers->Damper(DamperStrength / 100.0);
if (ffb[2] == 0x00 && ffb[0] == 0x01)
{ {
helpers->log("in ID7 Ffbloop"); triggers->Spring(1.0);
const int ff = GetTeknoParrotFFB(); }
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
ffcarcollision = carscollide(ff);
ffrubbingwalls = rubbingwalls(ff);
if (EnableDamper == 1) if (ffb[2] == 0x05 && ffb[1] > 0x00 && ffb[0] > 0x00)
{
double percentForce = ffb[0] / 127.0;
if (IncreaseSine)
{ {
triggers->Damper(DamperStrength / 100.0); percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
} }
if (ff == 0x60000) double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce);
}
if (ffb[2] == 0x06 && ffb[0] > 0x00 && ffb[0] < 0x80)
{
double percentForce = ffb[0] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[2] == 0x04 && ffb[0] > 0x00 && ffb[0] < 0x80)
{
if (ffb[1] == 0x00)
{ {
triggers->Spring(0.8); double percentForce = (128 - ffb[0]) / 127.0;
}
if (ffrubbingwalls > 0) // car rubbing against wall
{
double percentLength = 200;
double percentForce = (ffrubbingwalls / 31.0);
triggers->Friction(percentForce);
triggers->Rumble(percentForce, percentForce, percentLength);
}
if (ffcarcollision > 0) //cars colliding or rubbing with each other
{
double percentLength = 200;
double percentForce = (ffcarcollision / 16.0);
triggers->Friction(percentForce);
triggers->Rumble(percentForce, percentForce, percentLength);
}
if ((ff > 0x40037) && (ff < 0x40080))
{
double percentForce = (262272 - ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((ff > 0x40100) && (ff < 0x40149)) else
{ {
double percentForce = (ff - 262400) / 72.0; double percentForce = (ffb[0] / 127.0);
double percentLength = 100; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -17,159 +17,60 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static int carscollide(int ffcollide) { static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
switch (ffcollide) { static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
case 0x50F05:
return 16;
case 0x50E05:
return 15;
case 0x50D05:
return 14;
case 0x50C05:
return 13;
case 0x50B05:
return 12;
case 0x50A05:
return 11;
case 0x50905:
return 10;
case 0x50805:
return 9;
case 0x50705:
return 8;
case 0x50605:
return 7;
case 0x050505:
return 6;
case 0x050405:
return 5;
case 0x050305:
return 4;
case 0x50205:
return 3;
case 0x50105:
return 2;
case 0x50005:
return 1;
default:
return 0;
}
}
static int rubbingwalls(int ffwalls) {
switch (ffwalls) {
case 0x51F08:
return 31;
case 0x51E08:
return 30;
case 0x51D08:
return 29;
case 0x51C08:
return 28;
case 0x51B08:
return 27;
case 0x51A08:
return 26;
case 0x51908:
return 25;
case 0x51808:
return 24;
case 0x51708:
return 23;
case 0x51608:
return 22;
case 0x51508:
return 21;
case 0x51408:
return 20;
case 0x51308:
return 19;
case 0x51208:
return 18;
case 0x51108:
return 17;
case 0x50F08:
return 16;
case 0x50E08:
return 15;
case 0x50D08:
return 14;
case 0x50C08:
return 13;
case 0x50B08:
return 12;
case 0x50A08:
return 11;
case 0x50908:
return 10;
case 0x50808:
return 9;
case 0x50708:
return 8;
case 0x50608:
return 7;
case 0x50508:
return 6;
case 0x50408:
return 5;
case 0x50308:
return 4;
case 0x50208:
return 3;
case 0x50108:
return 2;
case 0x50008:
return 1;
default:
return 0;
}
}
void InitialD8::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) void InitialD8::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers)
{ {
int ffrubbingwalls = 0; DWORD FFB = GetTeknoParrotFFB();
int ffcarcollision = 0;
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (EnableDamper)
triggers->Damper(DamperStrength / 100.0);
if (ffb[2] == 0x00 && ffb[0] == 0x01)
{ {
helpers->log("in ID8 Ffbloop"); triggers->Spring(1.0);
const int ff = GetTeknoParrotFFB(); }
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
ffcarcollision = carscollide(ff);
ffrubbingwalls = rubbingwalls(ff);
if (EnableDamper == 1) if (ffb[2] == 0x05 && ffb[1] > 0x00 && ffb[0] > 0x00)
{
double percentForce = ffb[0] / 127.0;
if (IncreaseSine)
{ {
triggers->Damper(DamperStrength / 100.0); percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
} }
if (ff == 0x60000) double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce);
}
if (ffb[2] == 0x06 && ffb[0] > 0x00 && ffb[0] < 0x80)
{
double percentForce = ffb[0] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[2] == 0x04 && ffb[0] > 0x00 && ffb[0] < 0x80)
{
if (ffb[1] == 0x00)
{ {
triggers->Spring(0.8); double percentForce = (128 - ffb[0]) / 127.0;
}
if (ffrubbingwalls > 0) // car rubbing against wall
{
double percentLength = 200;
double percentForce = (ffrubbingwalls / 31.0);
triggers->Friction(percentForce);
triggers->Rumble(percentForce, percentForce, percentLength);
}
if (ffcarcollision > 0) //cars colliding or rubbing with each other
{
double percentLength = 200;
double percentForce = (ffcarcollision / 16.0);
triggers->Friction(percentForce);
triggers->Rumble(percentForce, percentForce, percentLength);
}
if ((ff > 0x40037) && (ff < 0x40080))
{
double percentForce = (262272 - ff) / 72.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((ff > 0x40100) && (ff < 0x40149)) else
{ {
double percentForce = (ff - 262400) / 72.0; double percentForce = (ffb[0] / 127.0);
double percentLength = 100; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -17,41 +17,63 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
void KODrive::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void KODrive::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
UINT8 ff = helpers->ReadByte(0x00B261F6, /* isRelativeOffset */ false);
UINT8 ff1 = helpers->ReadByte(0x00B261F5, /* isRelativeOffset */ false);
helpers->log("got value: ");
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
if (EnableDamper == 1) if (EnableDamper)
{
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x7261F4, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (ffb[0] == 0x80 && ffb[2] == 0x01)
{
triggers->Spring(1.0);
} }
if ((ff == 10) & (ff1 == 30)) if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
double percentForce = 0.4; double percentForce = ffb[2] / 24.0;
double percentForce1 = 2.7;
if (IncreaseSine)
{
percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
}
double Period = ffb[1] / 128.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce1, percentForce1, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(80, 80, percentForce); triggers->Sine(static_cast<int>(Period), 0, percentForce);
} }
if ((ff > 0x66)& (ff < 0x80)& (ff1 == 0)) if (ffb[0] == 0x86 && ffb[2] > 0x00)
{ {
helpers->log("moving wheel right"); double percentForce = ffb[2] / 24.0;
double percentForce = (128 - ff) / 24.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Spring(percentForce);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((ff > 0x00)& (ff < 0x19)& (ff1 == 1))
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{ {
helpers->log("moving wheel left"); if (ffb[1] == 0x00)
double percentForce = (ff) / 24.0; {
double percentLength = 100; double percentForce = (128 - ffb[2]) / 24.0;
triggers->Rumble(0, percentForce, percentLength); double percentLength = 100;
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else
{
double percentForce = (ffb[2] / 24.0);
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
} }
} }

View File

@ -627,7 +627,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
Sleep(150); Sleep(150);
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
@ -637,7 +637,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -649,19 +649,19 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
} }
else if (linkID == 0x01) else if (linkID == 0x01)
{ {
if ((gamestate == 0x1A) & (gamestatetimer < 100)) if ((gamestate == 0x1A) && (gamestatetimer < 100))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
} }
else if ((gamestate == 0x1A) & (gamestatetimer > 100)) else if ((gamestate == 0x1A) && (gamestatetimer > 100))
{ {
Sleep(100); Sleep(100);
helpers->WriteNop(0xC2130, 3, true); helpers->WriteNop(0xC2130, 3, true);
} }
if ((gamestate > 0x1A)& (gamestate < 0x1A)) if ((gamestate > 0x1A) && (gamestate < 0x1A))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
@ -681,11 +681,11 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
{ {
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -694,7 +694,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -724,7 +724,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
Sleep(250); Sleep(250);
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
@ -734,7 +734,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -744,26 +744,26 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false);
} }
if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
{ {
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
} }
} }
else if (linkID == 0x02) else if (linkID == 0x02)
{ {
if ((gamestate == 0x1A) & (gamestatetimer < 100)) if ((gamestate == 0x1A) && (gamestatetimer < 100))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
} }
else if ((gamestate == 0x1A) & (gamestatetimer > 100)) else if ((gamestate == 0x1A) && (gamestatetimer > 100))
{ {
Sleep(100); Sleep(100);
helpers->WriteNop(0xC2130, 3, true); helpers->WriteNop(0xC2130, 3, true);
} }
if ((gamestate > 0x1A)& (gamestate < 0x1A)) if ((gamestate > 0x1A) && (gamestate < 0x1A))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
@ -782,7 +782,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
Sleep(150); Sleep(150);
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
@ -792,7 +792,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -801,26 +801,26 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
} }
if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
{ {
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
} }
} }
else if (linkID == 0x01) else if (linkID == 0x01)
{ {
if ((gamestate == 0x1A) & (gamestatetimer < 100)) if ((gamestate == 0x1A) && (gamestatetimer < 100))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
} }
else if ((gamestate == 0x1A) & (gamestatetimer > 100)) else if ((gamestate == 0x1A) && (gamestatetimer > 100))
{ {
Sleep(100); Sleep(100);
helpers->WriteNop(0xC2130, 3, true); helpers->WriteNop(0xC2130, 3, true);
} }
if ((gamestate > 0x1A)& (gamestate < 0x1A)) if ((gamestate > 0x1A) && (gamestate < 0x1A))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
@ -840,11 +840,11 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
{ {
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -853,7 +853,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -864,7 +864,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false);
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -894,7 +894,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
Sleep(250); Sleep(250);
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
@ -904,7 +904,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -915,7 +915,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false);
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -927,26 +927,26 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false);
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
} }
if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
{ {
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
} }
} }
if (linkID == 0x03) if (linkID == 0x03)
{ {
if ((gamestate == 0x1A) & (gamestatetimer < 100)) if ((gamestate == 0x1A) && (gamestatetimer < 100))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
} }
else if ((gamestate == 0x1A) & (gamestatetimer > 100)) else if ((gamestate == 0x1A) && (gamestatetimer > 100))
{ {
Sleep(100); Sleep(100);
helpers->WriteNop(0xC2130, 3, true); helpers->WriteNop(0xC2130, 3, true);
} }
if ((gamestate > 0x1A)& (gamestate < 0x1A)) if ((gamestate > 0x1A) && (gamestate < 0x1A))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
@ -966,7 +966,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
Sleep(350); Sleep(350);
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
@ -976,7 +976,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -988,7 +988,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
Sleep(50); Sleep(50);
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -998,26 +998,26 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false);
} }
if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
{ {
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
} }
} }
else if (linkID == 0x02) else if (linkID == 0x02)
{ {
if ((gamestate == 0x1A) & (gamestatetimer < 100)) if ((gamestate == 0x1A) && (gamestatetimer < 100))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
} }
else if ((gamestate == 0x1A) & (gamestatetimer > 100)) else if ((gamestate == 0x1A) && (gamestatetimer > 100))
{ {
Sleep(100); Sleep(100);
helpers->WriteNop(0xC2130, 3, true); helpers->WriteNop(0xC2130, 3, true);
} }
if ((gamestate > 0x1A)& (gamestate < 0x1A)) if ((gamestate > 0x1A) && (gamestate < 0x1A))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
@ -1036,7 +1036,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
Sleep(150); Sleep(150);
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
@ -1046,7 +1046,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02 || track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -1055,26 +1055,26 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
} }
if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
{ {
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
} }
} }
else if (linkID == 0x01) else if (linkID == 0x01)
{ {
if ((gamestate == 0x1A) & (gamestatetimer < 100)) if ((gamestate == 0x1A) && (gamestatetimer < 100))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true);
} }
else if ((gamestate == 0x1A) & (gamestatetimer > 100)) else if ((gamestate == 0x1A) && (gamestatetimer > 100))
{ {
Sleep(100); Sleep(100);
helpers->WriteNop(0xC2130, 3, true); helpers->WriteNop(0xC2130, 3, true);
} }
if ((gamestate > 0x1A)& (gamestate < 0x1A)) if ((gamestate > 0x1A) && (gamestate < 0x1A))
{ {
helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true);
helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true);
@ -1094,11 +1094,11 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false);
helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false);
} }
if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) if ((gamestatetimer > 4294964133) && (gamestate == 0x12))
{ {
helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false);
} }
if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) if ((gamestate == 0x16) && (countdown == 0x00) && (track == 0x00))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -1107,7 +1107,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1
helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x01))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);
@ -1118,7 +1118,7 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false);
helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false);
} }
else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) else if ((gamestate == 0x14) && (trackselect == 0x00) && (track == 0x02))
{ {
helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99
Sleep(50); Sleep(50);

View File

@ -258,7 +258,7 @@ void M2EmulatorDaytonaUSAInputsEnabled(Helpers* helpers)
INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, false); INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, false);
GearValue = helpers->ReadByte(Rambase1 + 0x52CC, false); GearValue = helpers->ReadByte(Rambase1 + 0x52CC, false);
if ((e.type == SDL_JOYAXISMOTION) & (ShowAxisForSetup == 0)) if ((e.type == SDL_JOYAXISMOTION) && (ShowAxisForSetup == 0))
{ {
if (e.jaxis.which == joystick_index1) if (e.jaxis.which == joystick_index1)
{ {
@ -348,7 +348,7 @@ void M2EmulatorDaytonaUSAInputsEnabled(Helpers* helpers)
e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE; e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE;
BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128; BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128;
} }
else if ((e.jaxis.value < ACCL_DEAD_ZONE) & (e.jaxis.value > -ACCL_DEAD_ZONE)) else if ((e.jaxis.value < ACCL_DEAD_ZONE) && (e.jaxis.value > -ACCL_DEAD_ZONE))
{ {
AcclValue = 0xFF; AcclValue = 0xFF;
BrakeValue = 0xFF; BrakeValue = 0xFF;
@ -477,7 +477,7 @@ void M2EmulatorDaytonaUSAInputsEnabled(Helpers* helpers)
e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE; e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE;
BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128; BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128;
} }
else if ((e.jaxis.value < ACCL_DEAD_ZONE) & (e.jaxis.value > -ACCL_DEAD_ZONE)) else if ((e.jaxis.value < ACCL_DEAD_ZONE) && (e.jaxis.value > -ACCL_DEAD_ZONE))
{ {
AcclValue = 0xFF; AcclValue = 0xFF;
BrakeValue = 0xFF; BrakeValue = 0xFF;

View File

@ -221,7 +221,7 @@ void M2EmulatorIndy500InputsEnabled(Helpers* helpers)
UINT8 button1read = helpers->ReadByte(Button1Address, false); UINT8 button1read = helpers->ReadByte(Button1Address, false);
UINT8 button2read = helpers->ReadByte(Button2Address, false); UINT8 button2read = helpers->ReadByte(Button2Address, false);
if ((e.type == SDL_JOYAXISMOTION) & (ShowAxisForSetup == 0)) if ((e.type == SDL_JOYAXISMOTION) && (ShowAxisForSetup == 0))
{ {
if (e.jaxis.which == joystick_index1) if (e.jaxis.which == joystick_index1)
{ {
@ -311,7 +311,7 @@ void M2EmulatorIndy500InputsEnabled(Helpers* helpers)
e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE; e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE;
BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128; BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128;
} }
else if ((e.jaxis.value < ACCL_DEAD_ZONE) & (e.jaxis.value > -ACCL_DEAD_ZONE)) else if ((e.jaxis.value < ACCL_DEAD_ZONE) && (e.jaxis.value > -ACCL_DEAD_ZONE))
{ {
AcclValue = 0xFF; AcclValue = 0xFF;
BrakeValue = 0xFF; BrakeValue = 0xFF;
@ -440,7 +440,7 @@ void M2EmulatorIndy500InputsEnabled(Helpers* helpers)
e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE; e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE;
BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128; BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128;
} }
else if ((e.jaxis.value < ACCL_DEAD_ZONE) & (e.jaxis.value > -ACCL_DEAD_ZONE)) else if ((e.jaxis.value < ACCL_DEAD_ZONE) && (e.jaxis.value > -ACCL_DEAD_ZONE))
{ {
AcclValue = 0xFF; AcclValue = 0xFF;
BrakeValue = 0xFF; BrakeValue = 0xFF;

View File

@ -239,7 +239,7 @@ void M2EmulatorSegaRallyInputsEnabled(Helpers* helpers)
UINT8 button1read = helpers->ReadByte(Button1Address, false); UINT8 button1read = helpers->ReadByte(Button1Address, false);
UINT8 button2read = helpers->ReadByte(Button2Address, false); UINT8 button2read = helpers->ReadByte(Button2Address, false);
if ((e.type == SDL_JOYAXISMOTION) & (ShowAxisForSetup == 0)) if ((e.type == SDL_JOYAXISMOTION) && (ShowAxisForSetup == 0))
{ {
if (e.jaxis.which == joystick_index1) if (e.jaxis.which == joystick_index1)
{ {
@ -329,7 +329,7 @@ void M2EmulatorSegaRallyInputsEnabled(Helpers* helpers)
e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE; e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE;
BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128; BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128;
} }
else if ((e.jaxis.value < ACCL_DEAD_ZONE) & (e.jaxis.value > -ACCL_DEAD_ZONE)) else if ((e.jaxis.value < ACCL_DEAD_ZONE) && (e.jaxis.value > -ACCL_DEAD_ZONE))
{ {
AcclValue = 0xFF; AcclValue = 0xFF;
BrakeValue = 0xFF; BrakeValue = 0xFF;
@ -459,7 +459,7 @@ void M2EmulatorSegaRallyInputsEnabled(Helpers* helpers)
e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE; e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE;
BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128; BrakeValue = (-e.jaxis.value + ACCL_DEAD_ZONE) / 128;
} }
else if ((e.jaxis.value < ACCL_DEAD_ZONE) & (e.jaxis.value > -ACCL_DEAD_ZONE)) else if ((e.jaxis.value < ACCL_DEAD_ZONE) && (e.jaxis.value > -ACCL_DEAD_ZONE))
{ {
AcclValue = 0xFF; AcclValue = 0xFF;
BrakeValue = 0xFF; BrakeValue = 0xFF;

View File

@ -221,11 +221,15 @@ std::string victlap("victlap");
std::string dblaxle("dblaxle"); std::string dblaxle("dblaxle");
std::string dblaxleu("dblaxleu"); std::string dblaxleu("dblaxleu");
//Flycast Below //Flycast Below
std::string INITIAL("INITIAL"); std::string InitialDVer1("INITIAL D\n");
std::string EIGHTEENWHEELER("18WHEELER\n"); std::string InitialDVer2("INITIAL D Ver.2\n");
std::string MAXIMUM("MAXIMUM"); std::string InitialDVer3("INITIAL D Ver.3\n");
std::string FASTER("FASTER"); std::string EighteenWheeler("18WHEELER\n");
std::string F355("F355"); std::string MaximumSPEED("MAXIMUM SPEED\n");
std::string FasterThanSPEED("FASTER THAN SPEED\n");
std::string F355ChallengeJapan("F355 CHALLENGE JAPAN\n");
std::string ClubKartInJapan("CLUB KART IN JAPAN\n");
std::string TheKingOfRoute66("THE KING OF ROUTE66\n");
//Our string to load game from //Our string to load game from
std::string M2Active("M2Active"); std::string M2Active("M2Active");
@ -341,6 +345,8 @@ extern int ForceSpringStrength;
extern int EnableDamper; extern int EnableDamper;
extern int DamperStrength; extern int DamperStrength;
static bool IncreaseSine;
static int configMinForceDaytona2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceDaytona2"), 0, settingsFilename); static int configMinForceDaytona2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceDaytona2"), 0, settingsFilename);
static int configMaxForceDaytona2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceDaytona2"), 100, settingsFilename); static int configMaxForceDaytona2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceDaytona2"), 100, settingsFilename);
static int configAlternativeMinForceLeftDaytona2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftDaytona2"), 0, settingsFilename); static int configAlternativeMinForceLeftDaytona2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftDaytona2"), 0, settingsFilename);
@ -960,6 +966,7 @@ static int EnableForceSpringEffectInitialD = GetPrivateProfileInt(TEXT("Settings
static int ForceSpringStrengthInitialD = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthInitialD"), 0, settingsFilename); static int ForceSpringStrengthInitialD = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthInitialD"), 0, settingsFilename);
static int EnableDamperInitialD = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperInitialD"), 0, settingsFilename); static int EnableDamperInitialD = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperInitialD"), 0, settingsFilename);
static int DamperStrengthInitialD = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthInitialD"), 100, settingsFilename); static int DamperStrengthInitialD = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthInitialD"), 100, settingsFilename);
static int IncreaseSineInitialD = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSineInitialD"), 0, settingsFilename);
static int configMinForceF355 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceF355"), 0, settingsFilename); static int configMinForceF355 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceF355"), 0, settingsFilename);
static int configMaxForceF355 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceF355"), 100, settingsFilename); static int configMaxForceF355 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceF355"), 100, settingsFilename);
@ -1013,6 +1020,34 @@ static int ForceSpringStrengthMaximumSpeed = GetPrivateProfileInt(TEXT("Settings
static int EnableDamperMaximumSpeed = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperMaximumSpeed"), 0, settingsFilename); static int EnableDamperMaximumSpeed = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperMaximumSpeed"), 0, settingsFilename);
static int DamperStrengthMaximumSpeed = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthMaximumSpeed"), 100, settingsFilename); static int DamperStrengthMaximumSpeed = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthMaximumSpeed"), 100, settingsFilename);
static int configMinForceClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceClubKart"), 0, settingsFilename);
static int configMaxForceClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceClubKart"), 100, settingsFilename);
static int configAlternativeMinForceLeftClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftClubKart"), 0, settingsFilename);
static int configAlternativeMaxForceLeftClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftClubKart"), 100, settingsFilename);
static int configAlternativeMinForceRightClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightClubKart"), 0, settingsFilename);
static int configAlternativeMaxForceRightClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightClubKart"), 100, settingsFilename);
static int configFeedbackLengthClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthClubKart"), 120, settingsFilename);
static int PowerModeClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeClubKart"), 0, settingsFilename);
static int EnableForceSpringEffectClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectClubKart"), 0, settingsFilename);
static int ForceSpringStrengthClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthClubKart"), 0, settingsFilename);
static int EnableDamperClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperClubKart"), 0, settingsFilename);
static int DamperStrengthClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthClubKart"), 100, settingsFilename);
static int IncreaseSineClubKart = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSineClubKart"), 0, settingsFilename);
static int configMinForceKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceKingOfRoute66"), 0, settingsFilename);
static int configMaxForceKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceKingOfRoute66"), 100, settingsFilename);
static int configAlternativeMinForceLeftKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftKingOfRoute66"), 0, settingsFilename);
static int configAlternativeMaxForceLeftKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftKingOfRoute66"), 100, settingsFilename);
static int configAlternativeMinForceRightKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightKingOfRoute66"), 0, settingsFilename);
static int configAlternativeMaxForceRightKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightKingOfRoute66"), 100, settingsFilename);
static int configFeedbackLengthKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthKingOfRoute66"), 120, settingsFilename);
static int PowerModeKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeKingOfRoute66"), 0, settingsFilename);
static int EnableForceSpringEffectKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectKingOfRoute66"), 0, settingsFilename);
static int ForceSpringStrengthKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthKingOfRoute66"), 0, settingsFilename);
static int EnableDamperKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamperKingOfRoute66"), 0, settingsFilename);
static int DamperStrengthKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrengthKingOfRoute66"), 100, settingsFilename);
static int IncreaseSineKingOfRoute66 = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSineKingOfRoute66"), 0, settingsFilename);
static bool init = false; static bool init = false;
static bool initSpring = false; static bool initSpring = false;
static bool EmuName = false; static bool EmuName = false;
@ -1273,6 +1308,47 @@ int __stdcall mame_stop(void)
return 1; return 1;
} }
static void removeWord(char* str, char* toRemove)
{
int i, j, stringLen, toRemoveLen;
int found;
stringLen = strlen(str);
toRemoveLen = strlen(toRemove);
for (i = 0; i <= stringLen - toRemoveLen; i++)
{
found = 1;
for (j = 0; j < toRemoveLen; j++)
{
if (str[i + j] != toRemove[j])
{
found = 0;
break;
}
}
if (str[i + j] != ' ' && str[i + j] != '\t' && str[i + j] != '\n' && str[i + j] != '\0')
{
found = 0;
}
if (found == 1)
{
for (j = i; j <= stringLen - toRemoveLen; j++)
{
str[j] = str[j + toRemoveLen];
}
stringLen = stringLen - toRemoveLen;
i--;
}
}
}
static void CurrentGameName(Helpers* helpers) static void CurrentGameName(Helpers* helpers)
{ {
helpers->info("Game = %s", GameName); helpers->info("Game = %s", GameName);
@ -1286,8 +1362,30 @@ int __stdcall mame_copydata(int id, const char* name)
if (id == 0) if (id == 0)
{ {
//romFFB = name; char RomName[256];
sprintf(GameName, "%s", name); sprintf(RomName, "%s", name);
removeWord(RomName, "game =");
int whitespace = 0;
for (int i = 0; i < strlen(RomName); i++)
{
if (RomName[i] == ' ' || RomName[i] == '\t')
whitespace++;
else
break;
}
for (int i = 0; i < strlen(RomName); i++)
{
if (i + whitespace < strlen(RomName))
RomName[i] = RomName[i + whitespace];
else
RomName[i] = 0;
}
sprintf(GameName, "%s", RomName);
CurrentGameName(0); CurrentGameName(0);
} }
@ -2727,7 +2825,7 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
RunningFFB = "NamcoFFBActive"; RunningFFB = "NamcoFFBActive";
} }
if (romname == INITIAL) if (romname == InitialDVer1 || romname == InitialDVer2 || romname == InitialDVer3)
{ {
configMinForce = configMinForceInitialD; configMinForce = configMinForceInitialD;
configMaxForce = configMaxForceInitialD; configMaxForce = configMaxForceInitialD;
@ -2741,11 +2839,50 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
DamperStrength = DamperStrengthInitialD; DamperStrength = DamperStrengthInitialD;
EnableForceSpringEffect = EnableForceSpringEffectInitialD; EnableForceSpringEffect = EnableForceSpringEffectInitialD;
ForceSpringStrength = ForceSpringStrengthInitialD; ForceSpringStrength = ForceSpringStrengthInitialD;
IncreaseSine = IncreaseSineInitialD;
RunningFFB = "InitialDActive"; RunningFFB = "InitialDActive";
} }
if (romname == MAXIMUM) if (romname == TheKingOfRoute66)
{
configMinForce = configMinForceKingOfRoute66;
configMaxForce = configMaxForceKingOfRoute66;
configAlternativeMinForceLeft = configAlternativeMinForceLeftKingOfRoute66;
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftKingOfRoute66;
configAlternativeMinForceRight = configAlternativeMinForceRightKingOfRoute66;
configAlternativeMaxForceRight = configAlternativeMaxForceRightKingOfRoute66;
configFeedbackLength = configFeedbackLengthKingOfRoute66;
PowerMode = PowerModeKingOfRoute66;
EnableDamper = EnableDamperKingOfRoute66;
DamperStrength = DamperStrengthKingOfRoute66;
EnableForceSpringEffect = EnableForceSpringEffectKingOfRoute66;
ForceSpringStrength = ForceSpringStrengthKingOfRoute66;
IncreaseSine = IncreaseSineKingOfRoute66;
RunningFFB = "InitialDActive";
}
if (romname == ClubKartInJapan)
{
configMinForce = configMinForceClubKart;
configMaxForce = configMaxForceClubKart;
configAlternativeMinForceLeft = configAlternativeMinForceLeftClubKart;
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftClubKart;
configAlternativeMinForceRight = configAlternativeMinForceRightClubKart;
configAlternativeMaxForceRight = configAlternativeMaxForceRightClubKart;
configFeedbackLength = configFeedbackLengthClubKart;
PowerMode = PowerModeClubKart;
EnableDamper = EnableDamperClubKart;
DamperStrength = DamperStrengthClubKart;
EnableForceSpringEffect = EnableForceSpringEffectClubKart;
ForceSpringStrength = ForceSpringStrengthClubKart;
IncreaseSine = IncreaseSineClubKart;
RunningFFB = "InitialDActive";
}
if (romname == MaximumSPEED)
{ {
configMinForce = configMinForceMaximumSpeed; configMinForce = configMinForceMaximumSpeed;
configMaxForce = configMaxForceMaximumSpeed; configMaxForce = configMaxForceMaximumSpeed;
@ -2763,7 +2900,7 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
RunningFFB = "MaximumSpeedActive"; RunningFFB = "MaximumSpeedActive";
} }
if (romname == FASTER) if (romname == FasterThanSPEED)
{ {
configMinForce = configMinForceFasterThanSpeed; configMinForce = configMinForceFasterThanSpeed;
configMaxForce = configMaxForceFasterThanSpeed; configMaxForce = configMaxForceFasterThanSpeed;
@ -2781,7 +2918,7 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
RunningFFB = "MaximumSpeedActive"; RunningFFB = "MaximumSpeedActive";
} }
if (romname == F355) if (romname == F355ChallengeJapan)
{ {
configMinForce = configMinForceF355; configMinForce = configMinForceF355;
configMaxForce = configMaxForceF355; configMaxForce = configMaxForceF355;
@ -2800,7 +2937,7 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
NaomiFFBGo = true; NaomiFFBGo = true;
} }
if (romname == EIGHTEENWHEELER) if (romname == EighteenWheeler)
{ {
configMinForce = configMinForce18Wheeler; configMinForce = configMinForce18Wheeler;
configMaxForce = configMaxForce18Wheeler; configMaxForce = configMaxForce18Wheeler;
@ -3816,39 +3953,52 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
BYTE* ffb = reinterpret_cast<BYTE*>(&stateFFB); BYTE* ffb = reinterpret_cast<BYTE*>(&stateFFB);
if ((ffb[2] == 0x80) && (ffb[0] == 0x01)) if (ffb[2] == 0x80 && ffb[0] == 0x01)
{ {
triggers->Spring(1.0); triggers->Spring(1.0);
} }
if ((ffb[2] == 0x85) && (ffb[1] == 0x3F) && (ffb[0] > 0x00) && (ffb[0] < 0x30)) if (ffb[2] == 0x85 && ffb[1] > 0x00 && ffb[0] > 0x00)
{ {
double percentForce = ffb[0] / 47.0; double percentForce = ffb[0] / 127.0;
if (IncreaseSine)
{
percentForce = percentForce * 2.0;
if (percentForce > 1.0)
percentForce = 1.0;
}
double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(40, 0, percentForce); triggers->Sine(static_cast<int>(Period), 0, percentForce);
} }
if ((ffb[2] == 0x86) && (ffb[1] == 0x02) && (ffb[0] > 0x09) && (ffb[0] < 0x3C)) if (ffb[2] == 0x86 && ffb[0] > 0x00 && ffb[0] < 0x80)
{ {
double percentForce = (60 - ffb[0]) / 43.0; double percentForce = ffb[0] / 127.0;
double percentLength = 100; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if ((ffb[2] == 0x84) && (ffb[1] == 0x00) && (ffb[0] > 0x37) && (ffb[0] < 0x80)) if (ffb[2] == 0x84 && ffb[0] > 0x00 && ffb[0] < 0x80)
{ {
double percentForce = (128 - ffb[0]) / 72.0; if (ffb[1] == 0x00)
double percentLength = 100; {
triggers->Rumble(percentForce, 0, percentLength); double percentForce = (128 - ffb[0]) / 127.0;
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); double percentLength = 100;
} triggers->Rumble(percentForce, 0, percentLength);
else if ((ffb[2] == 0x84) && (ffb[1] == 0x01) && (ffb[0] > 0x00) && (ffb[0] < 0x49)) triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
{ }
double percentForce = (ffb[0] / 72.0); else
double percentLength = 100; {
triggers->Rumble(0, percentForce, percentLength); double percentForce = (ffb[0] / 127.0);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
} }
} }
} }

View File

@ -41,7 +41,7 @@ void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
} }
// Large Shake when hitting walls, other karts or getting hit by items // Large Shake when hitting walls, other karts or getting hit by items
if ((4194308 == ff1) & (ff10 == 1)) if ((4194308 == ff1) && (ff10 == 1))
{ {
double percentForce = 1.0; double percentForce = 1.0;
double percentForce1 = 3.5; double percentForce1 = 3.5;
@ -51,7 +51,7 @@ void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
} }
// small friction when driving on dirt while moving // small friction when driving on dirt while moving
if ((3 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) if ((3 == ff3) && (ff10 == 1) && (ff5 == 1) && (ff11 == 1065353216))
{ {
double percentForce = (0.3); double percentForce = (0.3);
double percentLength = (100); double percentLength = (100);
@ -59,7 +59,7 @@ void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
// Small constant when hitting bumps // Small constant when hitting bumps
if ((10 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) if ((10 == ff3) && (ff10 == 1) && (ff5 == 1) && (ff11 == 1065353216))
{ {
double percentForce = (0.2); double percentForce = (0.2);
double percentLength = (50); double percentLength = (50);
@ -68,7 +68,7 @@ void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
} }
// Wheel rumbles while driving on grass // Wheel rumbles while driving on grass
if ((4 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) if ((4 == ff3) && (ff10 == 1) && (ff5 == 1) && (ff11 == 1065353216))
{ {
double percentForce = 0.2; double percentForce = 0.2;
double percentLength = (50); double percentLength = (50);
@ -76,13 +76,13 @@ void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(50, 50, percentForce); triggers->Sine(50, 50, percentForce);
} }
//wheel hard to turn while driving through water //wheel hard to turn while driving through water
if ((7 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) if ((7 == ff3) && (ff10 == 1) && (ff5 == 1) && (ff11 == 1065353216))
{ {
double percentForce = (0.65); double percentForce = (0.65);
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
//Wheel rumbles lightly when driving over tiles //Wheel rumbles lightly when driving over tiles
if ((12 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) if ((12 == ff3) && (ff10 == 1) && (ff5 == 1) && (ff11 == 1065353216))
{ {
double percentForce = 0.1; double percentForce = 0.1;
double percentForce1 = 0.2; double percentForce1 = 0.2;
@ -91,7 +91,7 @@ void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(70, 70, percentForce); triggers->Sine(70, 70, percentForce);
} }
//Wheel rumbles lightly when driving over sand //Wheel rumbles lightly when driving over sand
if ((14 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) if ((14 == ff3) && (ff10 == 1) && (ff5 == 1) && (ff11 == 1065353216))
{ {
double percentForce = 0.1; double percentForce = 0.1;
double percentForce1 = 0.2; double percentForce1 = 0.2;
@ -100,7 +100,7 @@ void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(70, 70, percentForce); triggers->Sine(70, 70, percentForce);
} }
//Wheel rumbles lightly when driving over rough part of track //Wheel rumbles lightly when driving over rough part of track
if ((11 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) if ((11 == ff3) && (ff10 == 1) && (ff5 == 1) && (ff11 == 1065353216))
{ {
double percentForce = 0.1; double percentForce = 0.1;
double percentForce1 = 0.2; double percentForce1 = 0.2;
@ -109,7 +109,7 @@ void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(40, 50, percentForce); triggers->Sine(40, 50, percentForce);
} }
//Wheel rumbles moderately when driving over wooden bridges //Wheel rumbles moderately when driving over wooden bridges
if ((8 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) if ((8 == ff3) && (ff10 == 1) && (ff5 == 1) && (ff11 == 1065353216))
{ {
double percentForce = 0.4; double percentForce = 0.4;
double percentLength = (100); double percentLength = (100);

View File

@ -89,14 +89,14 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
if ((ConstantEffectForSteering == 1) && (ff11 == 1)) if ((ConstantEffectForSteering == 1) && (ff11 == 1))
{ {
if ((Wheel >= 0) & (Wheel < 128)) if ((Wheel >= 0) && (Wheel < 128))
{ {
double percentForce = ((128 - Wheel) / (ConstantEffectForSteeringStrength / 1.0)); double percentForce = ((128 - Wheel) / (ConstantEffectForSteeringStrength / 1.0));
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((Wheel > 127) & (Wheel < 256)) else if ((Wheel > 127) && (Wheel < 256))
{ {
double percentForce = ((Wheel - 127) / (ConstantEffectForSteeringStrength / 1.0)); double percentForce = ((Wheel - 127) / (ConstantEffectForSteeringStrength / 1.0));
double percentLength = 100; double percentLength = 100;
@ -104,7 +104,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
} }
} }
if ((MainShakeRumble == 1) & (4194308 == ff1) & (ff11 == 1)) if ((MainShakeRumble == 1) && (4194308 == ff1) && (ff11 == 1))
{ {
// Large Shake when hitting walls, other karts or getting hit by items // Large Shake when hitting walls, other karts or getting hit by items
double percentForce = ((MainShakeRumbleStrength) / 100.0); double percentForce = ((MainShakeRumbleStrength) / 100.0);
@ -113,7 +113,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(200, 200, percentForce); triggers->Sine(200, 200, percentForce);
} }
if ((BoostRumble == 1) & (ff18 == 1) & (ff11 == 1)) if ((BoostRumble == 1) && (ff18 == 1) && (ff11 == 1))
{ {
// Shake when Boost // Shake when Boost
double percentForce = ((BoostRumbleStrength) / 100.0); double percentForce = ((BoostRumbleStrength) / 100.0);
@ -122,7 +122,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(60, 60, percentForce); triggers->Sine(60, 60, percentForce);
} }
if ((DriftRumble == 1) & (ff17 == 1) & (Wheel >= 0) & (Wheel < 128) & (ff11 == 1)) if ((DriftRumble == 1) && (ff17 == 1) && (Wheel >= 0) && (Wheel < 128) && (ff11 == 1))
{ {
// Drift Effect including steering left // Drift Effect including steering left
double percentForce = (((128 - Wheel) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0)); double percentForce = (((128 - Wheel) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0));
@ -131,7 +131,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
if ((DriftRumble == 1) & (ff17 == 1) & (Wheel > 127) & (Wheel < 256) & (ff11 == 1)) if ((DriftRumble == 1) && (ff17 == 1) && (Wheel > 127) && (Wheel < 256) && (ff11 == 1))
{ {
// Drift Effect including steering right // Drift Effect including steering right
double percentForce = (((Wheel - 127) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0)); double percentForce = (((Wheel - 127) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0));
@ -140,7 +140,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
if ((HitGroundRumble == 1) & (oldhitground != newhitground) & (ff5 == 1) & (ff11 == 1)) if ((HitGroundRumble == 1) && (oldhitground != newhitground) && (ff5 == 1) && (ff11 == 1))
{ {
// Shake when hitting ground // Shake when hitting ground
double percentForce = ((HitGroundRumbleStrength) / 100.0); double percentForce = ((HitGroundRumbleStrength) / 100.0);
@ -151,7 +151,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
} }
if ((WeaponRumble == 1) & (oldweapon != newweapon) & (ff11 == 1)) if ((WeaponRumble == 1) && (oldweapon != newweapon) && (ff11 == 1))
{ {
// Shake when picking up new weapons or using them // Shake when picking up new weapons or using them
double percentForce = ((WeaponRumbleStrength) / 100.0); double percentForce = ((WeaponRumbleStrength) / 100.0);
@ -160,7 +160,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(80, 50, percentForce); triggers->Sine(80, 50, percentForce);
} }
if ((CoinRumble == 1) & (oldcoins != newcoins) & (ff11 == 1)) if ((CoinRumble == 1) && (oldcoins != newcoins) && (ff11 == 1))
{ {
// Shake when picking up coins // Shake when picking up coins
double percentForce = ((CoinRumbleStrength) / 100.0); double percentForce = ((CoinRumbleStrength) / 100.0);
@ -169,7 +169,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(50, 50, percentForce); triggers->Sine(50, 50, percentForce);
} }
if ((DirtRumble == 1) & (3 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) if ((DirtRumble == 1) && (3 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
// small friction when driving on dirt while moving // small friction when driving on dirt while moving
double percentForce = ((DirtRumbleStrength) / 100.0); double percentForce = ((DirtRumbleStrength) / 100.0);
@ -178,7 +178,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
if ((SpeedBumpRumble == 1) & (10 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) if ((SpeedBumpRumble == 1) && (10 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
// Small constant when hitting bumps // Small constant when hitting bumps
double percentForce = ((SpeedBumpRumbleStrength) / 100.0); double percentForce = ((SpeedBumpRumbleStrength) / 100.0);
@ -188,7 +188,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0);
} }
if ((GrassRumble == 1) & (4 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) if ((GrassRumble == 1) && (4 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
// Wheel rumbles while driving on grass // Wheel rumbles while driving on grass
double percentForce = ((GrassRumbleStrength) / 100.0); double percentForce = ((GrassRumbleStrength) / 100.0);
@ -197,7 +197,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(50, 50, percentForce); triggers->Sine(50, 50, percentForce);
} }
if ((CarpetRumble == 1) & (9 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) if ((CarpetRumble == 1) && (9 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
// Wheel rumbles while driving on carpet // Wheel rumbles while driving on carpet
double percentForce = ((CarpetRumbleStrength) / 100.0); double percentForce = ((CarpetRumbleStrength) / 100.0);
@ -206,7 +206,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(50, 50, percentForce); triggers->Sine(50, 50, percentForce);
} }
if ((WaterRumble == 1) & (7 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1) & (Wheel >= 0) & (Wheel < 128)) if ((WaterRumble == 1) && (7 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1) && (Wheel >= 0) && (Wheel < 128))
{ {
//wheel hard to turn while driving through water //wheel hard to turn while driving through water
double percentForce = ((WaterRumbleWheelStrength) / 100.0); double percentForce = ((WaterRumbleWheelStrength) / 100.0);
@ -216,7 +216,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
if ((WaterRumble == 1) & (7 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1) & (Wheel > 127)) if ((WaterRumble == 1) && (7 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1) && (Wheel > 127))
{ {
double percentForce = ((WaterRumbleWheelStrength) / 100.0); double percentForce = ((WaterRumbleWheelStrength) / 100.0);
double percentForce1 = ((Wheel - 127 / 128.0) * (WaterRumbleControllerStrengthMultiplier / 100.0)); double percentForce1 = ((Wheel - 127 / 128.0) * (WaterRumbleControllerStrengthMultiplier / 100.0));
@ -225,7 +225,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
if ((TileRumble == 1) & (12 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) if ((TileRumble == 1) && (12 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
//Wheel rumbles lightly when driving over tiles //Wheel rumbles lightly when driving over tiles
double percentForce = ((TileRumbleStrength) / 100.0); double percentForce = ((TileRumbleStrength) / 100.0);
@ -234,7 +234,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
if ((SandRumble == 1) & (14 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) if ((SandRumble == 1) && (14 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
//Wheel rumbles lightly when driving over sand //Wheel rumbles lightly when driving over sand
double percentForce = ((SandRumbleStrength) / 100.0); double percentForce = ((SandRumbleStrength) / 100.0);
@ -243,7 +243,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(70, 70, percentForce); triggers->Sine(70, 70, percentForce);
} }
if ((RoughTrackRumble == 1) & (11 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) if ((RoughTrackRumble == 1) && (11 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
//Wheel rumbles lightly when driving over rough part of track //Wheel rumbles lightly when driving over rough part of track
double percentForce = ((RoughTrackRumbleStrength) / 100.0); double percentForce = ((RoughTrackRumbleStrength) / 100.0);
@ -252,7 +252,7 @@ void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Sine(40, 50, percentForce); triggers->Sine(40, 50, percentForce);
} }
if ((BridgeRumble == 1) & (8 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) if ((BridgeRumble == 1) && (8 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
//Wheel rumbles moderately when driving over wooden bridges //Wheel rumbles moderately when driving over wooden bridges
double percentForce = ((BridgeRumbleStrength) / 100.0); double percentForce = ((BridgeRumbleStrength) / 100.0);

View File

@ -87,14 +87,14 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
if ((ConstantEffectForSteering == 1) && (ff11 == 1)) if ((ConstantEffectForSteering == 1) && (ff11 == 1))
{ {
if ((Wheel >= 0) & (Wheel < 128)) if ((Wheel >= 0) && (Wheel < 128))
{ {
double percentForce = ((128 - Wheel) / (ConstantEffectForSteeringStrength / 1.0)); double percentForce = ((128 - Wheel) / (ConstantEffectForSteeringStrength / 1.0));
double percentLength = 100; double percentLength = 100;
triggers->LeftRight(percentForce, 0, percentLength); triggers->LeftRight(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((Wheel > 127) & (Wheel < 256)) else if ((Wheel > 127) && (Wheel < 256))
{ {
double percentForce = ((Wheel - 127) / (ConstantEffectForSteeringStrength / 1.0)); double percentForce = ((Wheel - 127) / (ConstantEffectForSteeringStrength / 1.0));
double percentLength = 100; double percentLength = 100;
@ -102,7 +102,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
} }
} }
if ((MainShakeRumble == 1) & (4194308 == ff1) & (ff11 == 1)) if ((MainShakeRumble == 1) && (4194308 == ff1) && (ff11 == 1))
{ {
// Large Shake when hitting walls, other karts or getting hit by items // Large Shake when hitting walls, other karts or getting hit by items
double percentForce = ((MainShakeRumbleStrength) / 100.0); double percentForce = ((MainShakeRumbleStrength) / 100.0);
@ -110,7 +110,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(percentForce, percentForce, percentLength); triggers->LeftRight(percentForce, percentForce, percentLength);
triggers->Sine(200, 200, percentForce); triggers->Sine(200, 200, percentForce);
} }
else if ((BoostRumble == 1) & (ff18 == 1) & (ff11 == 1)) else if ((BoostRumble == 1) && (ff18 == 1) && (ff11 == 1))
{ {
// Shake when Boost // Shake when Boost
double percentForce = ((BoostRumbleStrength) / 100.0); double percentForce = ((BoostRumbleStrength) / 100.0);
@ -118,7 +118,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(percentForce, percentForce, percentLength); triggers->LeftRight(percentForce, percentForce, percentLength);
triggers->Sine(60, 60, percentForce); triggers->Sine(60, 60, percentForce);
} }
else if ((DriftRumble == 1) & (ff17 == 1) & (Wheel >= 0) & (Wheel < 128) & (ff11 == 1)) else if ((DriftRumble == 1) && (ff17 == 1) && (Wheel >= 0) && (Wheel < 128) && (ff11 == 1))
{ {
// Drift Effect including steering left // Drift Effect including steering left
double percentForce = (((128 - Wheel) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0)); double percentForce = (((128 - Wheel) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0));
@ -126,7 +126,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(percentForce, 0, percentLength); triggers->LeftRight(percentForce, 0, percentLength);
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
else if ((DriftRumble == 1) & (ff17 == 1) & (Wheel > 127) & (Wheel < 256) & (ff11 == 1)) else if ((DriftRumble == 1) && (ff17 == 1) && (Wheel > 127) && (Wheel < 256) && (ff11 == 1))
{ {
// Drift Effect including steering right // Drift Effect including steering right
double percentForce = (((Wheel - 127) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0)); double percentForce = (((Wheel - 127) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0));
@ -134,7 +134,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(0, percentForce, percentLength); triggers->LeftRight(0, percentForce, percentLength);
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
else if ((HitGroundRumble == 1) & (oldhitground != newhitground) & (ff5 == 1) & (ff11 == 1)) else if ((HitGroundRumble == 1) && (oldhitground != newhitground) && (ff5 == 1) && (ff11 == 1))
{ {
// Shake when hitting ground // Shake when hitting ground
double percentForce = ((HitGroundRumbleStrength) / 100.0); double percentForce = ((HitGroundRumbleStrength) / 100.0);
@ -144,7 +144,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
Sleep(50); Sleep(50);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
} }
else if ((WeaponRumble == 1) & (oldweapon != newweapon) & (ff11 == 1)) else if ((WeaponRumble == 1) && (oldweapon != newweapon) && (ff11 == 1))
{ {
// Shake when picking up new weapons or using them // Shake when picking up new weapons or using them
double percentForce = ((WeaponRumbleStrength) / 100.0); double percentForce = ((WeaponRumbleStrength) / 100.0);
@ -152,7 +152,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(percentForce, percentForce, percentLength); triggers->LeftRight(percentForce, percentForce, percentLength);
triggers->Sine(80, 50, percentForce); triggers->Sine(80, 50, percentForce);
} }
else if ((CoinRumble == 1) & (oldcoins != newcoins) & (ff11 == 1)) else if ((CoinRumble == 1) && (oldcoins != newcoins) && (ff11 == 1))
{ {
// Shake when picking up coins // Shake when picking up coins
double percentForce = ((CoinRumbleStrength) / 100.0); double percentForce = ((CoinRumbleStrength) / 100.0);
@ -160,7 +160,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(percentForce, percentForce, percentLength); triggers->LeftRight(percentForce, percentForce, percentLength);
triggers->Sine(50, 50, percentForce); triggers->Sine(50, 50, percentForce);
} }
else if ((DirtRumble == 1) & (3 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) else if ((DirtRumble == 1) && (3 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
// small friction when driving on dirt while moving // small friction when driving on dirt while moving
double percentForce = ((DirtRumbleStrength) / 100.0); double percentForce = ((DirtRumbleStrength) / 100.0);
@ -168,7 +168,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(percentForce, 0, percentLength); triggers->LeftRight(percentForce, 0, percentLength);
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
else if ((SpeedBumpRumble == 1) & (10 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) else if ((SpeedBumpRumble == 1) && (10 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
// Small constant when hitting bumps // Small constant when hitting bumps
double percentForce = ((SpeedBumpRumbleStrength) / 100.0); double percentForce = ((SpeedBumpRumbleStrength) / 100.0);
@ -177,7 +177,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0); triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0);
} }
else if ((GrassRumble == 1) & (4 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) else if ((GrassRumble == 1) && (4 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
// Wheel rumbles while driving on grass // Wheel rumbles while driving on grass
double percentForce = ((GrassRumbleStrength) / 100.0); double percentForce = ((GrassRumbleStrength) / 100.0);
@ -185,7 +185,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(0, percentForce, percentLength); triggers->LeftRight(0, percentForce, percentLength);
triggers->Sine(50, 50, percentForce); triggers->Sine(50, 50, percentForce);
} }
else if ((CarpetRumble == 1) & (9 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) else if ((CarpetRumble == 1) && (9 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
// Wheel rumbles while driving on carpet // Wheel rumbles while driving on carpet
double percentForce = ((CarpetRumbleStrength) / 100.0); double percentForce = ((CarpetRumbleStrength) / 100.0);
@ -193,7 +193,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(0, percentForce, percentLength); triggers->LeftRight(0, percentForce, percentLength);
triggers->Sine(50, 50, percentForce); triggers->Sine(50, 50, percentForce);
} }
else if ((WaterRumble == 1) & (7 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1) & (Wheel >= 0) & (Wheel < 128)) else if ((WaterRumble == 1) && (7 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1) && (Wheel >= 0) && (Wheel < 128))
{ {
//wheel hard to turn while driving through water //wheel hard to turn while driving through water
double percentForce = ((WaterRumbleWheelStrength) / 100.0); double percentForce = ((WaterRumbleWheelStrength) / 100.0);
@ -202,7 +202,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(percentForce1, 0, percentLength); triggers->LeftRight(percentForce1, 0, percentLength);
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
else if ((WaterRumble == 1) & (7 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1) & (Wheel > 127)) else if ((WaterRumble == 1) && (7 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1) && (Wheel > 127))
{ {
double percentForce = ((WaterRumbleWheelStrength) / 100.0); double percentForce = ((WaterRumbleWheelStrength) / 100.0);
double percentForce1 = ((Wheel - 127 / 128.0) * (WaterRumbleControllerStrengthMultiplier / 100.0)); double percentForce1 = ((Wheel - 127 / 128.0) * (WaterRumbleControllerStrengthMultiplier / 100.0));
@ -210,7 +210,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(0, percentForce1, percentLength); triggers->LeftRight(0, percentForce1, percentLength);
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
else if ((TileRumble == 1) & (12 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) else if ((TileRumble == 1) && (12 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
//Wheel rumbles lightly when driving over tiles //Wheel rumbles lightly when driving over tiles
double percentForce = ((TileRumbleStrength) / 100.0); double percentForce = ((TileRumbleStrength) / 100.0);
@ -218,7 +218,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(0, percentForce, percentLength); triggers->LeftRight(0, percentForce, percentLength);
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
else if ((SandRumble == 1) & (14 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) else if ((SandRumble == 1) && (14 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
//Wheel rumbles lightly when driving over sand //Wheel rumbles lightly when driving over sand
double percentForce = ((SandRumbleStrength) / 100.0); double percentForce = ((SandRumbleStrength) / 100.0);
@ -226,7 +226,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(percentForce, 0, percentLength); triggers->LeftRight(percentForce, 0, percentLength);
triggers->Sine(70, 70, percentForce); triggers->Sine(70, 70, percentForce);
} }
else if ((RoughTrackRumble == 1) & (11 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) else if ((RoughTrackRumble == 1) && (11 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
//Wheel rumbles lightly when driving over rough part of track //Wheel rumbles lightly when driving over rough part of track
double percentForce = ((RoughTrackRumbleStrength) / 100.0); double percentForce = ((RoughTrackRumbleStrength) / 100.0);
@ -234,7 +234,7 @@ void MarioKartGPDXUSA::FFBLoop(EffectConstants *constants, Helpers *helpers, Eff
triggers->LeftRight(0, percentForce, percentLength); triggers->LeftRight(0, percentForce, percentLength);
triggers->Sine(40, 50, percentForce); triggers->Sine(40, 50, percentForce);
} }
else if ((BridgeRumble == 1) & (8 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)) else if ((BridgeRumble == 1) && (8 == ff3) && (ff11 == 1) && (ff5 == 1) && (Speed > 0.1))
{ {
//Wheel rumbles moderately when driving over wooden bridges //Wheel rumbles moderately when driving over wooden bridges
double percentForce = ((BridgeRumbleStrength) / 100.0); double percentForce = ((BridgeRumbleStrength) / 100.0);

View File

@ -105,14 +105,14 @@ static int ThreadLoop()
if (ff8 == 1) if (ff8 == 1)
{ {
if ((ff6 >= 0x00) & (ff6 < 0x7F)) if ((ff6 >= 0x00) && (ff6 < 0x7F))
{ {
double percentForce = ((127 - ff6) / 127.0); double percentForce = ((127 - ff6) / 127.0);
double percentLength = 100; double percentLength = 100;
myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Rumble(percentForce, 0, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
} }
if ((ff6 > 0x7F)& (ff6 < 0x100)) if ((ff6 > 0x7F) && (ff6 < 0x100))
{ {
double percentForce = ((ff6 - 127) / 128.0); double percentForce = ((ff6 - 127) / 128.0);
double percentLength = 100; double percentLength = 100;
@ -122,14 +122,14 @@ static int ThreadLoop()
} }
if (ff9 == 1) if (ff9 == 1)
{ {
if ((ff6 >= 0x00) & (ff6 < 0x7F)) if ((ff6 >= 0x00) && (ff6 < 0x7F))
{ {
double percentForce = ((127 - ff6) / 127.0); double percentForce = ((127 - ff6) / 127.0);
double percentLength = 100; double percentLength = 100;
myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Rumble(percentForce, 0, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
} }
if ((ff6 > 0x7F)& (ff6 < 0x100)) if ((ff6 > 0x7F) && (ff6 < 0x100))
{ {
double percentForce = ((ff6 - 127) / 128.0); double percentForce = ((ff6 - 127) / 128.0);
double percentLength = 100; double percentLength = 100;

View File

@ -21,12 +21,11 @@ static bool VersionFound;
static bool Version103; static bool Version103;
static bool Version230; static bool Version230;
static DWORD FFB;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename); static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
static int IncreaseSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseSine"), 0, settingsFilename);
static UINT8 ff1;
static UINT8 ff2;
static UINT8 ff3;
static const char* SDDS = "SDDS"; static const char* SDDS = "SDDS";
@ -51,9 +50,7 @@ static void getSDDS230(char* Name)
void SWDC::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void SWDC::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1)) if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
{
ExitProcess(0); ExitProcess(0);
}
if (!VersionFound) if (!VersionFound)
{ {
@ -74,80 +71,65 @@ void SWDC::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
else else
{ {
if (Version103) if (Version103)
{ FFB = helpers->ReadInt32(0x8E5CCF4, true);
ff1 = helpers->ReadByte(0x8E5CCF4, true);
ff2 = helpers->ReadByte(0x8E5CCF5, true);
ff3 = helpers->ReadByte(0x8E5CCF6, true);
}
if (Version230) if (Version230)
{ FFB = helpers->ReadInt32(0x9BC7B18, true);
ff1 = helpers->ReadByte(0x9BC7B18, true);
ff2 = helpers->ReadByte(0x9BC7B19, true);
ff3 = helpers->ReadByte(0x9BC7B1A, true);
}
if (EnableDamper == 1) if (EnableDamper)
{
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
}
if (ff1 == 80) BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
if (EnableDamper)
triggers->Damper(DamperStrength / 100.0);
if (ffb[0] == 0x80 && ffb[2] == 0x01)
{ {
triggers->Spring(1.0); triggers->Spring(1.0);
} }
else if (ff1 == 0x85)
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
{ {
if ((ff2 > 0x00) && (ff2 < 0x30)) double percentForce = ffb[2] / 127.0;
if (IncreaseSine)
{ {
double percentForce = ff2 / 47.0; percentForce = percentForce * 2.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); if (percentForce > 1.0)
triggers->Sine(40, 0, percentForce); percentForce = 1.0;
} }
double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce);
} }
else if (ff1 == 0x86)
if (ffb[0] == 0x86 && ffb[2] > 0x00)
{ {
if ((ff3 > 0x00) && (ff3 < 0x4E)) double percentForce = ffb[2] / 127.0;
{ double percentLength = 100;
double percentForce = ff3 / 77.0; triggers->Spring(percentForce);
double percentLength = 100;
triggers->Spring(percentForce);
}
} }
else if (ff1 == 0x84)
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{ {
if ((ff2 == 0x00) && (ff3 > 0x37) && (ff3 < 0x80)) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ff3) / 72.0; double percentForce = (128 - ffb[0]) / 127.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if ((ff2 == 0x01) && (ff3 > 0x00) && (ff3 < 0x49)) else
{ {
double percentForce = (ff3 / 72.0); double percentForce = (ffb[0] / 127.0);
double percentLength = 100; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
} }
else
{
if ((ff2 == 0x00) && (ff3 > 0x00) && (ff3 < 0x38))
{
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x48))
{
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
} }
} }
} }

View File

@ -35,6 +35,7 @@ void SegaRacingClassic::FFBLoop(EffectConstants* constants, Helpers* helpers, Ef
double percentLength = 100; double percentLength = 100;
triggers->Friction(percentForce); triggers->Friction(percentForce);
} }
if ((ff > 0xBF) && (ff < 0xC8)) if ((ff > 0xBF) && (ff < 0xC8))
{ {
//Centering //Centering
@ -42,6 +43,7 @@ void SegaRacingClassic::FFBLoop(EffectConstants* constants, Helpers* helpers, Ef
double percentLength = 100; double percentLength = 100;
triggers->Spring(pow(percentForce, 0.1)); triggers->Spring(pow(percentForce, 0.1));
} }
if ((ff > 0xB7) && (ff < 0xC0)) if ((ff > 0xB7) && (ff < 0xC0))
{ {
//Uncentering //Uncentering
@ -50,6 +52,7 @@ void SegaRacingClassic::FFBLoop(EffectConstants* constants, Helpers* helpers, Ef
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(70, 80, percentForce); triggers->Sine(70, 80, percentForce);
} }
if ((ff > 0xA7) && (ff < 0xB0)) if ((ff > 0xA7) && (ff < 0xB0))
{ {
//Roll Left //Roll Left
@ -58,6 +61,7 @@ void SegaRacingClassic::FFBLoop(EffectConstants* constants, Helpers* helpers, Ef
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
} }
if ((ff > 0x97) && (ff < 0xA0)) if ((ff > 0x97) && (ff < 0xA0))
{ {
//Roll Right //Roll Right