Ejemplo n.º 1
0
 public void Disconnect(bool stop)
 {
     device.Report -= Device_Report;
     state.LightBarExplicitlyOff = sendColor.R == 0 && sendColor.G == 0 && sendColor.B == 0;
     state.LightBarColor         = new DS4Color(RestoreColor);
     device.pushHapticState(state);
     if (stop)
     {
         device.DisconnectBT();
         device.DisconnectDongle();
     }
     device.StopUpdate();
 }
Ejemplo n.º 2
0
 public void Disconnect(bool stop)
 {
     sendColor = RestoreColor;
     Thread.Sleep(10);//HACK: this is terrible, but it works reliably so i'll leave it like this :(
     //this is needed so that OnDeviceReport has time to send the color once the device sends a report.
     device.Report -= OnDeviceReport;
     if (stop)
     {
         device.DisconnectBT();
         device.DisconnectDongle();
     }
     device.StopUpdate();
 }
Ejemplo n.º 3
0
 public void Shutdown()
 {
     try
     {
         if (isInitialized)
         {
             if (Global.Configuration.VarRegistry.GetVariable <bool>($"{devicename}_disconnect_when_stop"))
             {
                 device.DisconnectBT();
                 device.DisconnectDongle();
             }
             RestoreColor();
             device.StopUpdate();
             DS4Devices.stopControllers();
             isInitialized = false;
         }
     }
     catch (Exception e)
     {
         Global.logger.Error("There was an error shutting down DualShock: " + e);
         isInitialized = true;
     }
 }