Added device type strings to output devices

This commit is contained in:
Travis Nickles 2019-04-23 21:53:41 -05:00
parent ab8dbd29f9
commit 8a6c05bce7
5 changed files with 12 additions and 7 deletions

View File

@ -1094,10 +1094,11 @@ namespace DS4Windows
{ {
if (!useDInputOnly[ind]) if (!useDInputOnly[ind])
{ {
string tempType = outputDevices[ind].GetDeviceType();
outputDevices[ind].Disconnect(); outputDevices[ind].Disconnect();
outputDevices[ind] = null; outputDevices[ind] = null;
useDInputOnly[ind] = true; useDInputOnly[ind] = true;
LogDebug("Controller #" + (ind + 1) + " unplugged"); LogDebug(tempType + " Controller #" + (ind + 1) + " unplugged");
} }
} }
else else
@ -1167,11 +1168,12 @@ namespace DS4Windows
CurrentState[ind].Battery = PreviousState[ind].Battery = 0; // Reset for the next connection's initial status change. CurrentState[ind].Battery = PreviousState[ind].Battery = 0; // Reset for the next connection's initial status change.
if (!useDInputOnly[ind]) if (!useDInputOnly[ind])
{ {
string tempType = outputDevices[ind].GetDeviceType();
outputDevices[ind].Disconnect(); outputDevices[ind].Disconnect();
outputDevices[ind] = null; outputDevices[ind] = null;
//x360controls[ind].Disconnect(); //x360controls[ind].Disconnect();
//x360controls[ind] = null; //x360controls[ind] = null;
LogDebug("X360 Controller # " + (ind + 1) + " unplugged"); LogDebug(tempType + " Controller # " + (ind + 1) + " unplugged");
} }
// Use Task to reset device synth state and commit it // Use Task to reset device synth state and commit it

View File

@ -11,6 +11,8 @@ namespace DS4Windows
{ {
class DS4OutDevice : OutputDevice class DS4OutDevice : OutputDevice
{ {
public const string devtype = "DS4";
public DualShock4Controller cont; public DualShock4Controller cont;
private DualShock4Report report; private DualShock4Report report;
@ -79,5 +81,6 @@ namespace DS4Windows
public override void Connect() => cont.Connect(); public override void Connect() => cont.Connect();
public override void Disconnect() => cont.Disconnect(); public override void Disconnect() => cont.Disconnect();
public override string GetDeviceType() => devtype;
} }
} }

View File

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS4Windows namespace DS4Windows
{ {
@ -11,5 +7,6 @@ namespace DS4Windows
public abstract void ConvertandSendReport(DS4State state, int device); public abstract void ConvertandSendReport(DS4State state, int device);
public abstract void Connect(); public abstract void Connect();
public abstract void Disconnect(); public abstract void Disconnect();
public abstract string GetDeviceType();
} }
} }

View File

@ -3214,10 +3214,11 @@ namespace DS4Windows
} }
else if (xinputStatus && !xinputPlug) else if (xinputStatus && !xinputPlug)
{ {
string tempType = control.outputDevices[device].GetDeviceType();
control.outputDevices[device].Disconnect(); control.outputDevices[device].Disconnect();
control.outputDevices[device] = null; control.outputDevices[device] = null;
Global.useDInputOnly[device] = true; Global.useDInputOnly[device] = true;
AppLogger.LogToGui("Controller #" + (device + 1) + " unplugged", false); AppLogger.LogToGui(tempType + " Controller #" + (device + 1) + " unplugged", false);
} }
tempDev.setRumble(0, 0); tempDev.setRumble(0, 0);

View File

@ -14,6 +14,7 @@ namespace DS4Windows
private const int inputResolution = 127 - (-128); private const int inputResolution = 127 - (-128);
private const float reciprocalInputResolution = 1 / (float)inputResolution; private const float reciprocalInputResolution = 1 / (float)inputResolution;
private const int outputResolution = 32767 - (-32768); private const int outputResolution = 32767 - (-32768);
public const string devType = "X360";
public Xbox360Controller cont; public Xbox360Controller cont;
private Xbox360Report report; private Xbox360Report report;
@ -137,5 +138,6 @@ namespace DS4Windows
public override void Connect() => cont.Connect(); public override void Connect() => cont.Connect();
public override void Disconnect() => cont.Disconnect(); public override void Disconnect() => cont.Disconnect();
public override string GetDeviceType() => devType;
} }
} }