mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 21:51:09 +01:00
Use plain for loop instead of foreach.
There is a noticeable speed difference.
This commit is contained in:
parent
51dfa8b91b
commit
d363257205
@ -804,13 +804,14 @@ namespace DS4Windows
|
|||||||
// Use the "most recently set" haptic state for each of light bar/motor.
|
// Use the "most recently set" haptic state for each of light bar/motor.
|
||||||
private void setHapticState()
|
private void setHapticState()
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
DS4Color lightBarColor = LightBarColor;
|
DS4Color lightBarColor = LightBarColor;
|
||||||
byte lightBarFlashDurationOn = LightBarOnDuration, lightBarFlashDurationOff = LightBarOffDuration;
|
byte lightBarFlashDurationOn = LightBarOnDuration, lightBarFlashDurationOff = LightBarOffDuration;
|
||||||
byte rumbleMotorStrengthLeftHeavySlow = LeftHeavySlowRumble, rumbleMotorStrengthRightLightFast = rightLightFastRumble;
|
byte rumbleMotorStrengthLeftHeavySlow = LeftHeavySlowRumble, rumbleMotorStrengthRightLightFast = rightLightFastRumble;
|
||||||
foreach (DS4HapticState haptic in hapticState)
|
int hapticLen = hapticState.Length;
|
||||||
|
for (int i=0; i < hapticLen; i++)
|
||||||
{
|
{
|
||||||
if (i++ == hapticStackIndex)
|
DS4HapticState haptic = hapticState[i];
|
||||||
|
if (i == hapticStackIndex)
|
||||||
break; // rest haven't been used this time
|
break; // rest haven't been used this time
|
||||||
if (haptic.IsLightBarSet())
|
if (haptic.IsLightBarSet())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user