Skip to content

Commit

Permalink
wait a bit before trying to dismount a stalled virtual controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed Aug 9, 2024
1 parent 27da1a7 commit e4f3566
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion HandheldCompanion/Targets/DualShock4Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Nefarius.ViGEm.Client.Targets;
using Nefarius.ViGEm.Client.Targets.DualShock4;
using System;
using System.Threading;

namespace HandheldCompanion.Targets
{
Expand Down Expand Up @@ -41,8 +42,12 @@ public override bool Connect()
}
catch(Exception ex)
{
virtualController?.Disconnect();
LogManager.LogWarning("Failed to connect {0}. {1}", this.ToString(), ex.Message);

// give controller manager enough time to mount the controller
Thread.Sleep(2000);

virtualController?.Disconnect();
return false;
}
}
Expand Down
7 changes: 6 additions & 1 deletion HandheldCompanion/Targets/Xbox360Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Nefarius.ViGEm.Client.Targets;
using Nefarius.ViGEm.Client.Targets.Xbox360;
using System;
using System.Threading;

namespace HandheldCompanion.Targets
{
Expand Down Expand Up @@ -38,8 +39,12 @@ public override bool Connect()
}
catch (Exception ex)
{
virtualController?.Disconnect();
LogManager.LogWarning("Failed to connect {0}. {1}", this.ToString(), ex.Message);

// give controller manager enough time to mount the controller
Thread.Sleep(2000);

virtualController?.Disconnect();
return false;
}
}
Expand Down

0 comments on commit e4f3566

Please sign in to comment.