mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 15:55:31 +01:00
ForceFeedback: Fixed scoping bug
Previous code relied on a destroyed variable to still be valid.
This commit is contained in:
parent
992b91c082
commit
2063eddfa3
@ -70,10 +70,11 @@ bool ForceFeedbackDevice::InitForceFeedback(const LPDIRECTINPUTDEVICE8 device, i
|
|||||||
eff.rgdwAxes = rgdwAxes;
|
eff.rgdwAxes = rgdwAxes;
|
||||||
eff.rglDirection = rglDirection;
|
eff.rglDirection = rglDirection;
|
||||||
|
|
||||||
// DIPERIODIC is the largest, so we'll use that
|
// initialize parameters
|
||||||
DIPERIODIC ff;
|
DICONSTANTFORCE diCF = { -10000 };
|
||||||
eff.lpvTypeSpecificParams = &ff;
|
diCF.lMagnitude = DI_FFNOMINALMAX;
|
||||||
memset(&ff, 0, sizeof(ff));
|
DIRAMPFORCE diRF = { 0 };
|
||||||
|
DIPERIODIC diPE = { 0 };
|
||||||
|
|
||||||
// doesn't seem needed
|
// doesn't seem needed
|
||||||
//DIENVELOPE env;
|
//DIENVELOPE env;
|
||||||
@ -85,18 +86,19 @@ bool ForceFeedbackDevice::InitForceFeedback(const LPDIRECTINPUTDEVICE8 device, i
|
|||||||
{
|
{
|
||||||
if (f.guid == GUID_ConstantForce)
|
if (f.guid == GUID_ConstantForce)
|
||||||
{
|
{
|
||||||
DICONSTANTFORCE diCF = {-10000};
|
|
||||||
diCF.lMagnitude = DI_FFNOMINALMAX;
|
|
||||||
eff.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
|
eff.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
|
||||||
eff.lpvTypeSpecificParams = &diCF;
|
eff.lpvTypeSpecificParams = &diCF;
|
||||||
}
|
}
|
||||||
else if (f.guid == GUID_RampForce)
|
else if (f.guid == GUID_RampForce)
|
||||||
{
|
{
|
||||||
eff.cbTypeSpecificParams = sizeof(DIRAMPFORCE);
|
eff.cbTypeSpecificParams = sizeof(DIRAMPFORCE);
|
||||||
|
eff.lpvTypeSpecificParams = &diRF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// all other forces need periodic parameters
|
||||||
eff.cbTypeSpecificParams = sizeof(DIPERIODIC);
|
eff.cbTypeSpecificParams = sizeof(DIPERIODIC);
|
||||||
|
eff.lpvTypeSpecificParams = &diPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LPDIRECTINPUTEFFECT pEffect;
|
LPDIRECTINPUTEFFECT pEffect;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user