Make it optional

This commit is contained in:
nastys
2019-09-11 02:48:37 +02:00
parent 8d02025254
commit 41dbcf87ae
3 changed files with 11 additions and 6 deletions
+7 -4
View File
@@ -8,15 +8,18 @@
# Options: # Options:
# allows the user to mouse wheel scroll through the PV selection list # Allow the user to mouse wheel scroll through the PV selection list
mouse_scroll_pv_selection = true mouse_scroll_pv_selection = true
# the interval it takes for the emulated slider touch points to move from one contact point to another. # The interval it takes for the emulated slider touch points to move from one contact point to another.
# in most cases this does not need editing. # In most cases, this does not need editing.
touch_slider_emulation_speed = 750.0 touch_slider_emulation_speed = 750.0
# preferred Xinput controller (0-3) # Preferred Xinput controller (0-3)
xinput_preferred = 0 xinput_preferred = 0
# Rumble (Xinput)
rumble = true
# JVS Buttons: # JVS Buttons:
JVS_TEST = F1 JVS_TEST = F1
JVS_SERVICE = F2 JVS_SERVICE = F2
@@ -15,6 +15,7 @@ namespace TLAC::Input
TLAC::FileSystem::ConfigFile config(TLAC::framework::GetModuleDirectory(), "keyconfig.ini"); TLAC::FileSystem::ConfigFile config(TLAC::framework::GetModuleDirectory(), "keyconfig.ini");
config.OpenRead(); config.OpenRead();
xinput_num = config.GetIntegerValue("xinput_preferred"); xinput_num = config.GetIntegerValue("xinput_preferred");
rumble = config.GetBooleanValue("rumble");
} }
Xinput* Xinput::GetInstance() Xinput* Xinput::GetInstance()
@@ -227,13 +228,13 @@ namespace TLAC::Input
SetTapStates(i, elapsed); SetTapStates(i, elapsed);
} }
if (TLAC::Components::TargetInspector::ShouldVibrate) if (rumble && TLAC::Components::TouchSliderEmulator::LatestInstance->isSliderTouched() && TLAC::Components::TargetInspector::ShouldVibrate)
{ {
XINPUT_VIBRATION vibration; XINPUT_VIBRATION vibration;
ZeroMemory(&vibration, sizeof(XINPUT_VIBRATION)); ZeroMemory(&vibration, sizeof(XINPUT_VIBRATION));
vibration.wLeftMotorSpeed = 8000; // use any value between 0-65535 here vibration.wLeftMotorSpeed = 8000; // use any value between 0-65535 here
vibration.wRightMotorSpeed = 4000; // use any value between 0-65535 here vibration.wRightMotorSpeed = 4000; // use any value between 0-65535 here
if (TLAC::Components::TouchSliderEmulator::LatestInstance->isSliderTouched()) XInputSetState(xc_pref, &vibration); XInputSetState(xc_pref, &vibration);
} }
else else
{ {
@@ -49,5 +49,6 @@ namespace TLAC::Input
void SetTapStates(BYTE keycode, float elapsed); void SetTapStates(BYTE keycode, float elapsed);
int xinput_num; int xinput_num;
bool rumble;
}; };
} }