1
0
mirror of synced 2025-02-20 20:20:59 +01:00

Add Dirt Dash FFB Support to MAME

This commit is contained in:
Aaron M 2020-06-01 15:00:05 +12:00
parent 34a1c0794b
commit c2aaf63ee1
2 changed files with 153 additions and 63 deletions

View File

@ -65,69 +65,6 @@ GearUp=99
GearDown=99
HideCursor=0
[Demul]
GameId=26
PowerModeInitialDDemul=0
FeedbackLengthInitialDDemul=500
MinForceInitialDDemul=0
MaxForceInitialDDemul=100
AlternativeMinForceLeftInitialDDemul=0
AlternativeMaxForceLeftInitialDDemul=-100
AlternativeMinForceRightInitialDDemul=0
AlternativeMaxForceRightInitialDDemul=100
EnableForceSpringEffectInitialDDemul=0
ForceSpringStrengthInitialDDemul=80
PowerModeNascarRacing=0
FeedbackLengthNascarRacing=500
MinForceNascarRacing=0
MaxForceNascarRacing=100
AlternativeMinForceLeftNascarRacing=0
AlternativeMaxForceLeftNascarRacing=-100
AlternativeMinForceRightNascarRacing=0
AlternativeMaxForceRightNascarRacing=100
EnableForceSpringEffectNascarRacing=0
ForceSpringStrengthNascarRacing=80
PowerModeSmashingDrive=0
FeedbackLengthSmashingDrive=500
MinForceSmashingDrive=0
MaxForceSmashingDrive=100
AlternativeMinForceLeftSmashingDrive=0
AlternativeMaxForceLeftSmashingDrive=-100
AlternativeMinForceRightSmashingDrive=0
AlternativeMaxForceRightSmashingDrive=100
EnableForceSpringEffectSmashingDrive=0
ForceSpringStrengthSmashingDrive=80
PowerModeMaximumSpeed=0
FeedbackLengthMaximumSpeed=500
MinForceMaximumSpeed=0
MaxForceMaximumSpeed=100
AlternativeMinForceLeftMaximumSpeed=0
AlternativeMaxForceLeftMaximumSpeed=-100
AlternativeMinForceRightMaximumSpeed=0
AlternativeMaxForceRightMaximumSpeed=100
EnableForceSpringEffectMaximumSpeed=0
ForceSpringStrengthMaximumSpeed=80
PowerModeFasterSpeed=0
FeedbackLengthFasterSpeed=500
MinForceFasterSpeed=0
MaxForceFasterSpeed=100
AlternativeMinForceLeftFasterSpeed=0
AlternativeMaxForceLeftFasterSpeed=-100
AlternativeMinForceRightFasterSpeed=0
AlternativeMaxForceRightFasterSpeed=100
EnableForceSpringEffectFasterSpeed=0
ForceSpringStrengthFasterSpeed=80
PowerModeATVTrack=0
FeedbackLengthATVTrack=500
MinForceATVTrack=0
MaxForceATVTrack=100
AlternativeMinForceLeftATVTrack=0
AlternativeMaxForceLeftATVTrack=-100
AlternativeMinForceRightATVTrack=0
AlternativeMaxForceRightATVTrack=100
EnableForceSpringEffectATVTrack=0
ForceSpringStrengthATVTrack=80
[Wacky Races]
GameId=2
MinForce=0
@ -614,6 +551,69 @@ BridgeRumble=1
BridgeRumbleStrength=40
HideCursor=0
[Demul]
GameId=26
PowerModeInitialDDemul=0
FeedbackLengthInitialDDemul=500
MinForceInitialDDemul=0
MaxForceInitialDDemul=100
AlternativeMinForceLeftInitialDDemul=0
AlternativeMaxForceLeftInitialDDemul=-100
AlternativeMinForceRightInitialDDemul=0
AlternativeMaxForceRightInitialDDemul=100
EnableForceSpringEffectInitialDDemul=0
ForceSpringStrengthInitialDDemul=80
PowerModeNascarRacing=0
FeedbackLengthNascarRacing=500
MinForceNascarRacing=0
MaxForceNascarRacing=100
AlternativeMinForceLeftNascarRacing=0
AlternativeMaxForceLeftNascarRacing=-100
AlternativeMinForceRightNascarRacing=0
AlternativeMaxForceRightNascarRacing=100
EnableForceSpringEffectNascarRacing=0
ForceSpringStrengthNascarRacing=80
PowerModeSmashingDrive=0
FeedbackLengthSmashingDrive=500
MinForceSmashingDrive=0
MaxForceSmashingDrive=100
AlternativeMinForceLeftSmashingDrive=0
AlternativeMaxForceLeftSmashingDrive=-100
AlternativeMinForceRightSmashingDrive=0
AlternativeMaxForceRightSmashingDrive=100
EnableForceSpringEffectSmashingDrive=0
ForceSpringStrengthSmashingDrive=80
PowerModeMaximumSpeed=0
FeedbackLengthMaximumSpeed=500
MinForceMaximumSpeed=0
MaxForceMaximumSpeed=100
AlternativeMinForceLeftMaximumSpeed=0
AlternativeMaxForceLeftMaximumSpeed=-100
AlternativeMinForceRightMaximumSpeed=0
AlternativeMaxForceRightMaximumSpeed=100
EnableForceSpringEffectMaximumSpeed=0
ForceSpringStrengthMaximumSpeed=80
PowerModeFasterSpeed=0
FeedbackLengthFasterSpeed=500
MinForceFasterSpeed=0
MaxForceFasterSpeed=100
AlternativeMinForceLeftFasterSpeed=0
AlternativeMaxForceLeftFasterSpeed=-100
AlternativeMinForceRightFasterSpeed=0
AlternativeMaxForceRightFasterSpeed=100
EnableForceSpringEffectFasterSpeed=0
ForceSpringStrengthFasterSpeed=80
PowerModeATVTrack=0
FeedbackLengthATVTrack=500
MinForceATVTrack=0
MaxForceATVTrack=100
AlternativeMinForceLeftATVTrack=0
AlternativeMaxForceLeftATVTrack=-100
AlternativeMinForceRightATVTrack=0
AlternativeMaxForceRightATVTrack=100
EnableForceSpringEffectATVTrack=0
ForceSpringStrengthATVTrack=80
[M2Emulator]
GameId=25
DaytonaAIMultiplayerHack=0
@ -1213,6 +1213,16 @@ AlternativeMinForceRightSuperChase=0
AlternativeMaxForceRightSuperChase=40
EnableForceSpringEffectSuperChase=0
ForceSpringStrengthSuperChase=80
PowerModeDirtDash=0
FeedbackLengthDirtDash=500
MinForceDirtDash=0
MaxForceDirtDash=100
AlternativeMinForceLeftDirtDash=0
AlternativeMaxForceLeftDirtDash=-100
AlternativeMinForceRightDirtDash=0
AlternativeMaxForceRightDirtDash=100
EnableForceSpringEffectDirtDash=0
ForceSpringStrengthDirtDash=80
[MAME 64bit Outputs]
GameId=22
@ -1633,6 +1643,16 @@ AlternativeMinForceRightSuperChase=0
AlternativeMaxForceRightSuperChase=40
EnableForceSpringEffectSuperChase=0
ForceSpringStrengthSuperChase=80
PowerModeDirtDash=0
FeedbackLengthDirtDash=500
MinForceDirtDash=0
MaxForceDirtDash=100
AlternativeMinForceLeftDirtDash=0
AlternativeMaxForceLeftDirtDash=-100
AlternativeMinForceRightDirtDash=0
AlternativeMaxForceRightDirtDash=100
EnableForceSpringEffectDirtDash=0
ForceSpringStrengthDirtDash=80
; ***********************************************************************************************************************************
; ************************************************* Test cases are established below ************************************************

View File

@ -577,6 +577,17 @@ static int configFeedbackLengthSuperChase = GetPrivateProfileInt(TEXT("Settings"
static int EnableForceSpringEffectSuperChase = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectSuperChase"), 0, settingsFilename);
static int ForceSpringStrengthSuperChase = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthSuperChase"), 0, settingsFilename);
static int configMinForceDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceDirtDash"), 0, settingsFilename);
static int configMaxForceDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceDirtDash"), 100, settingsFilename);
static int configAlternativeMinForceLeftDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftDirtDash"), 0, settingsFilename);
static int configAlternativeMaxForceLeftDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftDirtDash"), 100, settingsFilename);
static int configAlternativeMinForceRightDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightDirtDash"), 0, settingsFilename);
static int configAlternativeMaxForceRightDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightDirtDash"), 100, settingsFilename);
static int PowerModeDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerModeDirtDash"), 0, settingsFilename);
static int configFeedbackLengthDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLengthDirtDash"), 120, settingsFilename);
static int EnableForceSpringEffectDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffectDirtDash"), 0, settingsFilename);
static int ForceSpringStrengthDirtDash = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrengthDirtDash"), 0, settingsFilename);
static bool init = false;
static bool initSpring = false;
static bool EmuName = false;
@ -1230,6 +1241,7 @@ std::string crusnwld13("crusnwld13");
std::string daytona("daytona");
std::string daytonas("daytonas");
std::string daytonase("daytonase");
std::string dirtdash("dirtdash");
std::string offroadc("offroadc");
std::string offroadc4("offroadc4");
std::string offroadc3("offroadc3");
@ -1378,6 +1390,7 @@ std::string vaportrp("vaportrp");
//Our string to load game from
std::string DaytonaActive("DaytonaActive");
std::string Daytona2Active("Daytona2Active");
std::string DirtDashActive("DirtDashActive");
std::string DirtDevilsActive("DirtDevilsActive");
std::string SrallyActive("SrallyActive");
std::string Srally2Active("Srally2Active");
@ -2305,6 +2318,22 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
RunningFFB = "SrallyActive";
}
if (romname == dirtdash)
{
configMinForce = configMinForceDirtDash;
configMaxForce = configMaxForceDirtDash;
configAlternativeMinForceLeft = configAlternativeMinForceLeftDirtDash;
configAlternativeMaxForceLeft = configAlternativeMaxForceLeftDirtDash;
configAlternativeMinForceRight = configAlternativeMinForceRightDirtDash;
configAlternativeMaxForceRight = configAlternativeMaxForceRightDirtDash;
configFeedbackLength = configFeedbackLengthDirtDash;
PowerMode = PowerModeDirtDash;
EnableForceSpringEffect = EnableForceSpringEffectDirtDash;
ForceSpringStrength = ForceSpringStrengthDirtDash;
RunningFFB = "DirtDashActive";
}
if ((RunningFFB != NULL) && (RunningFFB[0] != '\0'))
{
RomGameName = true;
@ -3382,6 +3411,47 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
}
}
if (RunningFFB == DirtDashActive)
{
if (Emulator == MAME)
{
if (!PatternFind)
{
aAddy2 = PatternScan("\x28\x00\x28\x00\x00\x00\x28", "xxxxxxx");
UINT8 CheckAddy2 = helpers->ReadByte((int)aAddy2 + 0x12, false);
if (CheckAddy2 == 0x01)
{
FFBAddress = (int)aAddy2 + 0x132;
PatternFind = true;
}
}
else
{
DWORD FFBDirtDash = helpers->ReadInt32(FFBAddress, false);
helpers->log("got value: ");
std::string ffs = std::to_string(FFBDirtDash);
helpers->log((char*)ffs.c_str());
if ((FFBDirtDash > 0x00) && (FFBDirtDash < 0x77A))
{
double percentForce = (FFBDirtDash / 1913.0);
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else if ((FFBDirtDash > 0xF9F3) && (FFBDirtDash < 0xFFFF))
{
double percentForce = ((65535 - FFBDirtDash) / 1547.0);
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
}
}
}
if (RunningFFB == HardDrivinActive) //Hard Drivin
{
if (Emulator == MAME)