[TLAC] Fix crash when an Xinput is connected, the slider emulator is disabled, and rumble is enabled

This commit is contained in:
nastys
2020-12-26 22:48:59 +01:00
parent 62b693943d
commit 66e439cce0
3 changed files with 5 additions and 1 deletions
@@ -47,6 +47,8 @@ namespace TLAC::Components
componentsManager = manager;
sliderState = (TouchSliderState*)SLIDER_CTRL_TASK_ADDRESS;
touchSliderEmulatorIsEnabled = true;
LeftSideSlideLeft = new Binding();
LeftSideSlideRight = new Binding();
@@ -60,5 +60,7 @@ namespace TLAC::Components
void ApplyContactPoint(ContactPoint &contactPoint, int section);
void ApplyBitfieldState(uint32_t state);
};
inline bool touchSliderEmulatorIsEnabled = false;
}
@@ -252,7 +252,7 @@ namespace TLAC::Input
SetTapStates(i, elapsed);
}
if (rumble && TLAC::Components::TouchSliderEmulator::LatestInstance->isSliderTouched() && TLAC::Components::TargetInspector::ShouldVibrate)
if (rumble && TLAC::Components::touchSliderEmulatorIsEnabled && TLAC::Components::TouchSliderEmulator::LatestInstance->isSliderTouched() && TLAC::Components::TargetInspector::ShouldVibrate)
{
XINPUT_VIBRATION vibration;
ZeroMemory(&vibration, sizeof(XINPUT_VIBRATION));