1
0
mirror of synced 2024-11-28 00:20:52 +01:00

Added Hyper Drive ffb

This commit is contained in:
Aaron M 2019-12-26 22:35:36 +13:00
parent bb803992f0
commit ed848ec002
2 changed files with 77 additions and 0 deletions

View File

@ -1021,6 +1021,16 @@ RumbleStrengthLeftMotorF1GpStar2=100
RumbleStrengthRightMotorF1GpStar2=100
EnableForceSpringEffectF1GpStar2=0
ForceSpringStrengthF1GpStar2=80
MinForceHyperDrive=0
MaxForceHyperDrive=100
AlternativeMinForceLeftHyperDrive=0
AlternativeMaxForceLeftHyperDrive=-100
AlternativeMinForceRightHyperDrive=0
AlternativeMaxForceRightHyperDrive=100
RumbleStrengthLeftMotorHyperDrive=100
RumbleStrengthRightMotorHyperDrive=100
EnableForceSpringEffectHyperDrive=0
ForceSpringStrengthHyperDrive=80
[MAME 64bit Outputs]
GameId=22
@ -1349,6 +1359,16 @@ RumbleStrengthLeftMotorF1GpStar2=100
RumbleStrengthRightMotorF1GpStar2=100
EnableForceSpringEffectF1GpStar2=0
ForceSpringStrengthF1GpStar2=80
MinForceHyperDrive=0
MaxForceHyperDrive=100
AlternativeMinForceLeftHyperDrive=0
AlternativeMaxForceLeftHyperDrive=-100
AlternativeMinForceRightHyperDrive=0
AlternativeMaxForceRightHyperDrive=100
RumbleStrengthLeftMotorHyperDrive=100
RumbleStrengthRightMotorHyperDrive=100
EnableForceSpringEffectHyperDrive=0
ForceSpringStrengthHyperDrive=80
; ***********************************************************************************************************************************
; ************************************************* Test cases are established below ************************************************

View File

@ -468,6 +468,16 @@ static int SinePeriodF1GpStar2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Si
static int SineFadePeriodF1GpStar2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineFadePeriodF1GpStar2"), 0, settingsFilename);
static int SineStrengthF1GpStar2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineStrengthF1GpStar2"), 0, settingsFilename);
static int configMinForceHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceHyperDrive"), 0, settingsFilename);
static int configMaxForceHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceHyperDrive"), 100, settingsFilename);
static int configAlternativeMinForceLeftHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftHyperDrive"), 0, settingsFilename);
static int configAlternativeMaxForceLeftHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftHyperDrive"), 100, settingsFilename);
static int configAlternativeMinForceRightHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightHyperDrive"), 0, settingsFilename);
static int configAlternativeMaxForceRightHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightHyperDrive"), 100, settingsFilename);
static int configFeedbackLengthHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthHyperDrive"), 120, settingsFilename);
static int EnableForceSpringEffectHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectHyperDrive"), 0, settingsFilename);
static int ForceSpringStrengthHyperDrive = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthHyperDrive"), 0, settingsFilename);
static bool init = false;
static bool initSpring = false;
static bool EmuName = false;
@ -967,6 +977,7 @@ std::string undrfirej("undrfirej");
std::string cbombers("cbombers");
std::string cbombersj("cbombersj");
std::string cbombersp("cbombersp");
std::string hyprdriv("hyprdriv");
//Our string to load game from
std::string Daytona2Active("Daytona2Active");
@ -987,6 +998,7 @@ std::string RacingActive2("RacingActive2");
std::string AfterburnerActive("AfterburnerActive");
std::string OutrunActive("OutrunActive");
std::string PDriftActive("PDriftActive");
std::string HyperDriveActive("HyperDriveActive");
//Names of FFB Outputs
std::string RawDrive("RawDrive");
@ -1749,6 +1761,21 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
RunningFFB = "RacingActive2";
}
if (romname == hyprdriv)
{
configMinForce = configMinForceHyperDrive;
configMaxForce = configMaxForceHyperDrive;
configAlternativeMinForceLeft = configAlternativeMinForceLeftHyperDrive;
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftHyperDrive;
configAlternativeMinForceRight = configAlternativeMinForceRightHyperDrive;
configAlternativeMaxForceRight = configAlternativeMaxForceRightHyperDrive;
configFeedbackLength = configFeedbackLengthHyperDrive;
EnableForceSpringEffect = EnableForceSpringEffectHyperDrive;
ForceSpringStrength = ForceSpringStrengthHyperDrive;
RunningFFB = "HyperDriveActive";
}
if ((RunningFFB != NULL) && (RunningFFB[0] != '\0'))
{
RomGameName = true;
@ -2691,6 +2718,36 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
}
}
if (RunningFFB == HyperDriveActive) //Hyper Drive
{
if (Emulator == MAME)
{
if (name == wheel)
{
helpers->log("got value: ");
std::string ffs = std::to_string(newstateFFB);
helpers->log((char*)ffs.c_str());
stateFFB = newstateFFB;
}
if ((stateFFB > 0x80) && (stateFFB < 0x100))
{
double percentForce = (256 - stateFFB) / 127.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((stateFFB > 0x00) && (stateFFB < 0x80))
{
double percentForce = (stateFFB) / 127.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
}
if (RunningFFB == HardDrivinActive) //Hard Drivin
{
if (Emulator == MAME)