Merge branch 'mika-n-jay' into jay

This commit is contained in:
Travis Nickles 2019-04-09 22:52:05 -05:00
commit 085db3cf76
5 changed files with 40 additions and 19 deletions

View File

@ -426,11 +426,11 @@ namespace DS4Windows
useDInputOnly[i] = false;
x360controls[i] = new Xbox360Controller(vigemTestClient);
int devIndex = i;
/*x360controls[i].FeedbackReceived += (sender, args) =>
x360controls[i].FeedbackReceived += (sender, args) =>
{
SetDevRumble(device, args.LargeMotor, args.SmallMotor, devIndex);
};
*/
x360controls[i].Connect();
LogDebug("X360 Controller #" + (i + 1) + " connected");
}
@ -683,11 +683,11 @@ namespace DS4Windows
useDInputOnly[Index] = false;
x360controls[Index] = new Xbox360Controller(vigemTestClient);
int devIndex = Index;
/*x360controls[Index].FeedbackReceived += (sender, args) =>
x360controls[Index].FeedbackReceived += (sender, args) =>
{
SetDevRumble(device, args.LargeMotor, args.SmallMotor, devIndex);
};
*/
x360controls[Index].Connect();
LogDebug("X360 Controller #" + (Index + 1) + " connected");
}
@ -1060,11 +1060,11 @@ namespace DS4Windows
{
LogDebug("Plugging in X360 Controller #" + (ind + 1));
x360controls[ind] = new Xbox360Controller(vigemTestClient);
/*x360controls[ind].FeedbackReceived += (eventsender, args) =>
x360controls[ind].FeedbackReceived += (eventsender, args) =>
{
SetDevRumble(device, args.LargeMotor, args.SmallMotor, ind);
};
*/
x360controls[ind].Connect();
useDInputOnly[ind] = false;
LogDebug("X360 Controller #" + (ind + 1) + " connected");

View File

@ -1896,11 +1896,15 @@ namespace DS4Windows
{
actionFound = true;
if (!actionDone[index].dev[device] && !useTempProfile[device])
if (!actionDone[index].dev[device] && (!useTempProfile[device] || untriggeraction[device] == null || untriggeraction[device].typeID != SpecialAction.ActionTypeId.Profile) )
{
actionDone[index].dev[device] = true;
untriggeraction[device] = action;
untriggerindex[device] = index;
// If Loadprofile special action doesn't have unload trigger then don't set untrigger status. This way the new loaded profile allows yet another loadProfile action key events)
if (action.uTrigger.Count > 0)
{
untriggeraction[device] = action;
untriggerindex[device] = index;
}
//foreach (DS4Controls dc in action.trigger)
for (int i = 0, arlen = action.trigger.Count; i < arlen; i++)
{

View File

@ -3064,11 +3064,11 @@ namespace DS4Windows
if (xinputStatus && xinputPlug)
{
control.x360controls[device] = new Nefarius.ViGEm.Client.Targets.Xbox360Controller(control.vigemTestClient);
/*control.x360controls[device].FeedbackReceived += (eventsender, args) =>
control.x360controls[device].FeedbackReceived += (eventsender, args) =>
{
control.SetDevRumble(tempDev, args.LargeMotor, args.SmallMotor, device);
};
*/
control.x360controls[device].Connect();
Global.useDInputOnly[device] = false;
AppLogger.LogToGui("X360 Controller #" + (device + 1) + " connected", false);

View File

@ -92,13 +92,16 @@ namespace DS4Windows
case "Profile":
cBActions.SelectedIndex = 3;
cBProfiles.Text = act.details;
foreach (string s in act.ucontrols.Split('/'))
foreach (ListViewItem lvi in lVUnloadTrigger.Items)
if (lvi.Text == s)
{
lvi.Checked = true;
break;
}
if (act.ucontrols != null)
{
foreach (string s in act.ucontrols.Split('/'))
foreach (ListViewItem lvi in lVUnloadTrigger.Items)
if (lvi.Text == s)
{
lvi.Checked = true;
break;
}
}
break;
case "Key":
cBActions.SelectedIndex = 4;
@ -261,7 +264,7 @@ namespace DS4Windows
}
break;
case 3:
if (cBProfiles.SelectedIndex > 0 && ucontrols.Count > 0)
if (cBProfiles.SelectedIndex > 0 /*&& ucontrols.Count > 0*/)
{
action = Properties.Resources.LoadProfile.Replace("*profile*", cBProfiles.Text);
actRe = true;

View File

@ -611,6 +611,8 @@ namespace DS4Windows
}
}
private readonly Stopwatch rumbleAutostopTimer = new Stopwatch(); // Autostop timer to stop rumble motors if those are stuck in a rumble state
private byte outputPendCount = 0;
private readonly Stopwatch standbySw = new Stopwatch();
private unsafe void performDs4Output()
@ -1210,6 +1212,13 @@ namespace DS4Windows
}
}
if (rumbleAutostopTimer.IsRunning)
{
// Workaround to a bug in ViGem driver. Force stop potentially stuck rumble motor on the next output report if there haven't been new rumble events within X seconds
if (rumbleAutostopTimer.ElapsedMilliseconds >= 2000L)
setRumble(0, 0);
}
if (synchronous)
{
if (output || haptime)
@ -1399,6 +1408,11 @@ namespace DS4Windows
testRumble.RumbleMotorStrengthRightLightFast = rightLightFastMotor;
testRumble.RumbleMotorStrengthLeftHeavySlow = leftHeavySlowMotor;
testRumble.RumbleMotorsExplicitlyOff = rightLightFastMotor == 0 && leftHeavySlowMotor == 0;
if (testRumble.RumbleMotorsExplicitlyOff)
rumbleAutostopTimer.Reset(); // Stop an autostop timer because ViGem driver sent properly a zero rumble notification
else
rumbleAutostopTimer.Restart(); // Start an autostop timer to stop potentially stuck rumble motor because of lost rumble notification events from ViGem driver
}
private void MergeStates()