Added DirectInputConstForceLeftMax and DirectInputConstForceRightMax options to allow different force feedback strengths in each direction. DirectInputConstForceMax still works as before but these new options will override it for the given direction if they are specified.

This commit is contained in:
Nik Henson 2011-10-02 20:53:12 +00:00
parent 46211fdcbd
commit e6fd2e2240
3 changed files with 46 additions and 33 deletions

View file

@ -397,7 +397,10 @@ static void ApplySettings(CINIFile *INI, const char *section)
#ifdef SUPERMODEL_WIN32 #ifdef SUPERMODEL_WIN32
// DirectInput ForceFeedback // DirectInput ForceFeedback
INI->Get(section, "DirectInputConstForceMax", g_Config.dInputConstForceMax); INI->Get(section, "DirectInputConstForceMax", g_Config.dInputConstForceLeftMax);
INI->Get(section, "DirectInputConstForceMax", g_Config.dInputConstForceRightMax);
INI->Get(section, "DirectInputConstForceLeftMax", g_Config.dInputConstForceLeftMax);
INI->Get(section, "DirectInputConstForceRightMax", g_Config.dInputConstForceRightMax);
INI->Get(section, "DirectInputSelfCenterMax", g_Config.dInputSelfCenterMax); INI->Get(section, "DirectInputSelfCenterMax", g_Config.dInputSelfCenterMax);
INI->Get(section, "DirectInputFrictionMax", g_Config.dInputFrictionMax); INI->Get(section, "DirectInputFrictionMax", g_Config.dInputFrictionMax);
INI->Get(section, "DirectInputVibrateMax", g_Config.dInputVibrateMax); INI->Get(section, "DirectInputVibrateMax", g_Config.dInputVibrateMax);
@ -427,50 +430,51 @@ static void LogConfig(void)
InfoLog("Program settings:"); InfoLog("Program settings:");
// COSDConfig // COSDConfig
InfoLog("\tXResolution = %d", g_Config.xRes); InfoLog("\tXResolution = %d", g_Config.xRes);
InfoLog("\tYResolution = %d", g_Config.yRes); InfoLog("\tYResolution = %d", g_Config.yRes);
InfoLog("\tFullScreen = %d", g_Config.fullScreen); InfoLog("\tFullScreen = %d", g_Config.fullScreen);
InfoLog("\tThrottle = %d", g_Config.throttle); InfoLog("\tThrottle = %d", g_Config.throttle);
InfoLog("\tShowFrameRate = %d", g_Config.showFPS); InfoLog("\tShowFrameRate = %d", g_Config.showFPS);
#ifdef SUPERMODEL_DEBUGGER #ifdef SUPERMODEL_DEBUGGER
InfoLog("\tDisableDebugger = %d", g_Config.disableDebugger); InfoLog("\tDisableDebugger = %d", g_Config.disableDebugger);
#endif #endif
InfoLog("\tInputSystem = %s", g_Config.GetInputSystem()); InfoLog("\tInputSystem = %s", g_Config.GetInputSystem());
InfoLog("\tFlipStereo = %d", g_Config.flipStereo); InfoLog("\tFlipStereo = %d", g_Config.flipStereo);
#ifdef SUPERMODEL_WIN32 #ifdef SUPERMODEL_WIN32
// DirectInput ForceFeedback // DirectInput ForceFeedback
InfoLog("\tDirectInputConstForceMax = %u", g_Config.dInputConstForceMax); InfoLog("\tDirectInputConstForceLeftMax = %u", g_Config.dInputConstForceLeftMax);
InfoLog("\tDirectInputSelfCenterMax = %u", g_Config.dInputSelfCenterMax); InfoLog("\tDirectInputConstForceRightMax = %u", g_Config.dInputConstForceRightMax);
InfoLog("\tDirectInputFrictionMax = %u", g_Config.dInputFrictionMax); InfoLog("\tDirectInputSelfCenterMax = %u", g_Config.dInputSelfCenterMax);
InfoLog("\tDirectInputVibrateMax = %u", g_Config.dInputVibrateMax); InfoLog("\tDirectInputFrictionMax = %u", g_Config.dInputFrictionMax);
InfoLog("\tDirectInputVibrateMax = %u", g_Config.dInputVibrateMax);
// XInput ForceFeedback // XInput ForceFeedback
InfoLog("\tXInputConstForceThreshold = %u", g_Config.xInputConstForceThreshold); InfoLog("\tXInputConstForceThreshold = %u", g_Config.xInputConstForceThreshold);
InfoLog("\tXInputConstForceMax = %u", g_Config.xInputConstForceMax); InfoLog("\tXInputConstForceMax = %u", g_Config.xInputConstForceMax);
InfoLog("\tXInputVibrateMax = %u", g_Config.xInputVibrateMax); InfoLog("\tXInputVibrateMax = %u", g_Config.xInputVibrateMax);
#endif // SUPERMODEL_WIN32 #endif // SUPERMODEL_WIN32
// CModel3Config // CModel3Config
InfoLog("\tMultiThreaded = %d", g_Config.multiThreaded); InfoLog("\tMultiThreaded = %d", g_Config.multiThreaded);
InfoLog("\tPowerPCFrequency = %d", g_Config.GetPowerPCFrequency()); InfoLog("\tPowerPCFrequency = %d", g_Config.GetPowerPCFrequency());
// CSoundBoardConfig // CSoundBoardConfig
InfoLog("\tEmulateSound = %d", g_Config.emulateSound); InfoLog("\tEmulateSound = %d", g_Config.emulateSound);
// CDSBConfig // CDSBConfig
InfoLog("\tEmulateDSB = %d", g_Config.emulateDSB); InfoLog("\tEmulateDSB = %d", g_Config.emulateDSB);
InfoLog("\tSoundVolume = %d", g_Config.GetSoundVolume()); InfoLog("\tSoundVolume = %d", g_Config.GetSoundVolume());
InfoLog("\tMusicVolume = %d", g_Config.GetMusicVolume()); InfoLog("\tMusicVolume = %d", g_Config.GetMusicVolume());
// CDriveBoardConfig // CDriveBoardConfig
#ifdef SUPERMODEL_WIN32 #ifdef SUPERMODEL_WIN32
InfoLog("\tForceFeedback = %d", g_Config.forceFeedback); InfoLog("\tForceFeedback = %d", g_Config.forceFeedback);
#endif #endif
// CRender3DConfig // CRender3DConfig
InfoLog("\tVertexShader = %s", g_Config.vertexShaderFile.c_str()); InfoLog("\tVertexShader = %s", g_Config.vertexShaderFile.c_str());
InfoLog("\tFragmentShader = %s", g_Config.fragmentShaderFile.c_str()); InfoLog("\tFragmentShader = %s", g_Config.fragmentShaderFile.c_str());
InfoLog(""); InfoLog("");
} }

View file

@ -54,7 +54,8 @@ public:
#endif #endif
#ifdef SUPERMODEL_WIN32 #ifdef SUPERMODEL_WIN32
unsigned dInputConstForceMax; unsigned dInputConstForceLeftMax;
unsigned dInputConstForceRightMax;
unsigned dInputSelfCenterMax; unsigned dInputSelfCenterMax;
unsigned dInputFrictionMax; unsigned dInputFrictionMax;
unsigned dInputVibrateMax; unsigned dInputVibrateMax;
@ -114,7 +115,8 @@ public:
#endif #endif
#ifdef SUPERMODEL_WIN32 #ifdef SUPERMODEL_WIN32
inputSystem = "dinput"; inputSystem = "dinput";
dInputConstForceMax = 100; dInputConstForceLeftMax = 100;
dInputConstForceRightMax = 100;
dInputSelfCenterMax = 100; dInputSelfCenterMax = 100;
dInputFrictionMax = 100; dInputFrictionMax = 100;
dInputVibrateMax = 100; dInputVibrateMax = 100;

View file

@ -1817,13 +1817,20 @@ bool CDirectInputSystem::ProcessForceFeedbackCmd(int joyNum, int axisNum, ForceF
{ {
case FFConstantForce: case FFConstantForce:
//printf("FFConstantForce %0.2f\n", 100.0f * ffCmd.force); //printf("FFConstantForce %0.2f\n", 100.0f * ffCmd.force);
if (g_Config.dInputConstForceMax == 0) if (ffCmd.force >= 0.0f)
return false; {
lFFMag = (LONG)(-ffCmd.force * (float)(g_Config.dInputConstForceMax * DI_EFFECTS_SCALE)); // Invert sign for DirectInput effect if (g_Config.dInputConstForceRightMax == 0)
if (lFFMag >= 0) return false;
dicf.lMagnitude = min<LONG>(lFFMag, DI_EFFECTS_MAX); lFFMag = (LONG)(-ffCmd.force * (float)(g_Config.dInputConstForceRightMax * DI_EFFECTS_SCALE)); // Invert sign for DirectInput effect
else
dicf.lMagnitude = max<LONG>(lFFMag, -DI_EFFECTS_MAX); dicf.lMagnitude = max<LONG>(lFFMag, -DI_EFFECTS_MAX);
}
else
{
if (g_Config.dInputConstForceLeftMax == 0)
return false;
lFFMag = (LONG)(-ffCmd.force * (float)(g_Config.dInputConstForceLeftMax * DI_EFFECTS_SCALE)); // Invert sign for DirectInput effect
dicf.lMagnitude = min<LONG>(lFFMag, DI_EFFECTS_MAX);
}
eff.cbTypeSpecificParams = sizeof(DICONSTANTFORCE); eff.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
eff.lpvTypeSpecificParams = &dicf; eff.lpvTypeSpecificParams = &dicf;