mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-02-05 07:04:25 +01:00
The X360.Beep() cycles currently connected device
This commit is contained in:
parent
c5ab033186
commit
381f940d8b
|
|
@ -20,3 +20,4 @@ It does help this project on being supported.
|
|||
- Reduce hold for `Toggle desktop mode` to 2s
|
||||
- Fix `Process Kill` action (STEAM+B for 3s)
|
||||
- Go back to `Startup Profile` on `Toggle deskptop mode`
|
||||
- The `X360.Beep()` cycles currently connected device (fixes Playnite error)
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ namespace SteamController.Devices
|
|||
Connected = false;
|
||||
}
|
||||
|
||||
private void UpdateConnected()
|
||||
private void SetConnected(bool connected)
|
||||
{
|
||||
if (Connected == isConnected)
|
||||
return;
|
||||
|
||||
if (Connected)
|
||||
if (connected)
|
||||
{
|
||||
device?.Connect();
|
||||
TraceLine("Connected X360 Controller.");
|
||||
|
|
@ -82,31 +82,28 @@ namespace SteamController.Devices
|
|||
isConnected = Connected;
|
||||
}
|
||||
|
||||
internal void Disconnect()
|
||||
{
|
||||
if (!isConnected)
|
||||
return;
|
||||
|
||||
device?.Disconnect();
|
||||
isConnected = false;
|
||||
}
|
||||
|
||||
internal void Beep()
|
||||
{
|
||||
var client = this.client;
|
||||
if (client is null)
|
||||
if (device is null)
|
||||
return;
|
||||
|
||||
// Generate dummy xbox360 controller to generate notification
|
||||
var device = client.CreateXbox360Controller();
|
||||
device.Connect();
|
||||
Thread.Sleep(100);
|
||||
device.Disconnect();
|
||||
lock (this)
|
||||
{
|
||||
// cycle currently connected device
|
||||
SetConnected(!isConnected);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
internal void Update()
|
||||
{
|
||||
UpdateConnected();
|
||||
if (device is not null && Connected != isConnected)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
SetConnected(Connected);
|
||||
}
|
||||
}
|
||||
|
||||
if (isConnected && submitReport)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue