mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-26 16:41:50 +01:00
Merged Electrobrain's beta 10: this tool now uses ScpVBus devices 11-14, so other vitrual xinput tools don't have conflict
Also slight reorganization for context menu
This commit is contained in:
parent
335a411230
commit
b2aef9a984
@ -77,7 +77,7 @@ namespace DS4Control
|
|||||||
touchPad[ind] = new Mouse(ind, device);
|
touchPad[ind] = new Mouse(ind, device);
|
||||||
DS4Color color = Global.loadColor(ind);
|
DS4Color color = Global.loadColor(ind);
|
||||||
device.LightBarColor = color;
|
device.LightBarColor = color;
|
||||||
x360Bus.Plugin(ind + 1);
|
x360Bus.Plugin(ind);
|
||||||
device.Report += this.On_Report;
|
device.Report += this.On_Report;
|
||||||
//m_switcher.setMode(Global.getInitialMode(ind));
|
//m_switcher.setMode(Global.getInitialMode(ind));
|
||||||
TouchPadOn(ind, device);
|
TouchPadOn(ind, device);
|
||||||
@ -111,10 +111,9 @@ namespace DS4Control
|
|||||||
if (DS4Controllers[i] != null)
|
if (DS4Controllers[i] != null)
|
||||||
{
|
{
|
||||||
CurrentState[i].Battery = PreviousState[i].Battery = 0; // Reset for the next connection's initial status change.
|
CurrentState[i].Battery = PreviousState[i].Battery = 0; // Reset for the next connection's initial status change.
|
||||||
x360Bus.Unplug(i + 1);
|
x360Bus.Unplug(i);
|
||||||
anyUnplugged = true;
|
anyUnplugged = true;
|
||||||
DS4Controllers[i] = null;
|
DS4Controllers[i] = null;
|
||||||
//modeSwitcher[i] = null;
|
|
||||||
touchPad[i] = null;
|
touchPad[i] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +163,7 @@ namespace DS4Control
|
|||||||
touchPad[Index] = new Mouse(Index, device);
|
touchPad[Index] = new Mouse(Index, device);
|
||||||
device.LightBarColor = Global.loadColor(Index);
|
device.LightBarColor = Global.loadColor(Index);
|
||||||
device.Report += this.On_Report;
|
device.Report += this.On_Report;
|
||||||
x360Bus.Plugin(Index + 1);
|
x360Bus.Plugin(Index);
|
||||||
//m_switcher.setMode(Global.getInitialMode(Index));
|
//m_switcher.setMode(Global.getInitialMode(Index));
|
||||||
TouchPadOn(Index, device);
|
TouchPadOn(Index, device);
|
||||||
LogDebug("Controller: " + device.MacAddress + " is ready to use");
|
LogDebug("Controller: " + device.MacAddress + " is ready to use");
|
||||||
@ -253,7 +252,7 @@ namespace DS4Control
|
|||||||
if (ind != -1)
|
if (ind != -1)
|
||||||
{
|
{
|
||||||
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.
|
||||||
x360Bus.Unplug(ind + 1);
|
x360Bus.Unplug(ind);
|
||||||
LogDebug("Controller " + device.MacAddress + " was removed or lost connection");
|
LogDebug("Controller " + device.MacAddress + " was removed or lost connection");
|
||||||
Log.LogToTray("Controller " + device.MacAddress + " was removed or lost connection");
|
Log.LogToTray("Controller " + device.MacAddress + " was removed or lost connection");
|
||||||
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
|
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
|
||||||
|
@ -10,9 +10,18 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
public partial class X360Device : ScpDevice
|
public partial class X360Device : ScpDevice
|
||||||
{
|
{
|
||||||
public const String DS3_BUS_CLASS_GUID = "{F679F562-3164-42CE-A4DB-E7DDBE723909}";
|
private const String DS3_BUS_CLASS_GUID = "{F679F562-3164-42CE-A4DB-E7DDBE723909}";
|
||||||
|
private const int CONTROLLER_OFFSET = 1 + 10; // Device 0 is the virtual USB hub itself, and we leave devices 1-10 available for other software (like the Scarlet.Crush DualShock driver itself)
|
||||||
|
|
||||||
protected virtual Int32 Scale(Int32 Value, Boolean Flip)
|
private int firstController = 1 + 10;
|
||||||
|
// Device 0 is the virtual USB hub itself, and we can leave more available for other software (like the Scarlet.Crush DualShock driver)
|
||||||
|
public int FirstController
|
||||||
|
{
|
||||||
|
get { return firstController; }
|
||||||
|
set { firstController = value > 0 ? value : 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Int32 Scale(Int32 Value, Boolean Flip)
|
||||||
{
|
{
|
||||||
Value -= 0x80;
|
Value -= 0x80;
|
||||||
|
|
||||||
@ -38,14 +47,14 @@ namespace DS4Control
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override Boolean Open(int Instance = 0)
|
/* public override Boolean Open(int Instance = 0)
|
||||||
{
|
{
|
||||||
if (base.Open(Instance))
|
if (base.Open(Instance))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} */
|
||||||
|
|
||||||
public override Boolean Open(String DevicePath)
|
public override Boolean Open(String DevicePath)
|
||||||
{
|
{
|
||||||
@ -90,10 +99,10 @@ namespace DS4Control
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void Parse(DS4State state, Byte[] Output, int device)
|
public void Parse(DS4State state, Byte[] Output, int device)
|
||||||
{
|
{
|
||||||
Output[0] = 0x1C;
|
Output[0] = 0x1C;
|
||||||
Output[4] = (Byte)(device + 1);
|
Output[4] = (Byte)(device + firstController);
|
||||||
Output[9] = 0x14;
|
Output[9] = 0x14;
|
||||||
|
|
||||||
for (int i = 10; i < Output.Length; i++)
|
for (int i = 10; i < Output.Length; i++)
|
||||||
@ -141,7 +150,7 @@ namespace DS4Control
|
|||||||
Output[21] = (Byte)((ThumbRY >> 8) & 0xFF);
|
Output[21] = (Byte)((ThumbRY >> 8) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Boolean Plugin(Int32 Serial)
|
public Boolean Plugin(Int32 Serial)
|
||||||
{
|
{
|
||||||
if (IsActive)
|
if (IsActive)
|
||||||
{
|
{
|
||||||
@ -153,6 +162,7 @@ namespace DS4Control
|
|||||||
Buffer[2] = 0x00;
|
Buffer[2] = 0x00;
|
||||||
Buffer[3] = 0x00;
|
Buffer[3] = 0x00;
|
||||||
|
|
||||||
|
Serial += firstController;
|
||||||
Buffer[4] = (Byte)((Serial >> 0) & 0xFF);
|
Buffer[4] = (Byte)((Serial >> 0) & 0xFF);
|
||||||
Buffer[5] = (Byte)((Serial >> 8) & 0xFF);
|
Buffer[5] = (Byte)((Serial >> 8) & 0xFF);
|
||||||
Buffer[6] = (Byte)((Serial >> 16) & 0xFF);
|
Buffer[6] = (Byte)((Serial >> 16) & 0xFF);
|
||||||
@ -164,7 +174,7 @@ namespace DS4Control
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Boolean Unplug(Int32 Serial)
|
public Boolean Unplug(Int32 Serial)
|
||||||
{
|
{
|
||||||
if (IsActive)
|
if (IsActive)
|
||||||
{
|
{
|
||||||
@ -176,6 +186,7 @@ namespace DS4Control
|
|||||||
Buffer[2] = 0x00;
|
Buffer[2] = 0x00;
|
||||||
Buffer[3] = 0x00;
|
Buffer[3] = 0x00;
|
||||||
|
|
||||||
|
Serial += firstController;
|
||||||
Buffer[4] = (Byte)((Serial >> 0) & 0xFF);
|
Buffer[4] = (Byte)((Serial >> 0) & 0xFF);
|
||||||
Buffer[5] = (Byte)((Serial >> 8) & 0xFF);
|
Buffer[5] = (Byte)((Serial >> 8) & 0xFF);
|
||||||
Buffer[6] = (Byte)((Serial >> 16) & 0xFF);
|
Buffer[6] = (Byte)((Serial >> 16) & 0xFF);
|
||||||
@ -187,8 +198,26 @@ namespace DS4Control
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean UnplugAll() //not yet implemented, not sure if will
|
||||||
|
{
|
||||||
|
if (IsActive)
|
||||||
|
{
|
||||||
|
Int32 Transfered = 0;
|
||||||
|
Byte[] Buffer = new Byte[16];
|
||||||
|
|
||||||
public virtual Boolean Report(Byte[] Input, Byte[] Output)
|
Buffer[0] = 0x10;
|
||||||
|
Buffer[1] = 0x00;
|
||||||
|
Buffer[2] = 0x00;
|
||||||
|
Buffer[3] = 0x00;
|
||||||
|
|
||||||
|
return DeviceIoControl(m_FileHandle, 0x2A4004, Buffer, Buffer.Length, null, 0, ref Transfered, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Boolean Report(Byte[] Input, Byte[] Output)
|
||||||
{
|
{
|
||||||
if (IsActive)
|
if (IsActive)
|
||||||
{
|
{
|
||||||
|
@ -656,7 +656,8 @@ namespace ScpServer
|
|||||||
|
|
||||||
private void Options_Closed(object sender, FormClosedEventArgs e)
|
private void Options_Closed(object sender, FormClosedEventArgs e)
|
||||||
{
|
{
|
||||||
Global.LoadProfile(device);
|
for (int i = 0; i < 4; i++)
|
||||||
|
Global.LoadProfile(i); //Refreshes all profiles in case other controllers are using the same profile
|
||||||
mainWin.RefreshProfiles();
|
mainWin.RefreshProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
DS4Tool/ScpForm.Designer.cs
generated
6
DS4Tool/ScpForm.Designer.cs
generated
@ -524,15 +524,15 @@
|
|||||||
// cMTaskbar
|
// cMTaskbar
|
||||||
//
|
//
|
||||||
this.cMTaskbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.cMTaskbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.openToolStripMenuItem,
|
|
||||||
this.toolStripSeparator1,
|
|
||||||
this.editProfileForController1ToolStripMenuItem,
|
this.editProfileForController1ToolStripMenuItem,
|
||||||
this.editProfileForController2ToolStripMenuItem,
|
this.editProfileForController2ToolStripMenuItem,
|
||||||
this.editProfileForController3ToolStripMenuItem,
|
this.editProfileForController3ToolStripMenuItem,
|
||||||
this.editProfileForController4ToolStripMenuItem,
|
this.editProfileForController4ToolStripMenuItem,
|
||||||
|
this.toolStripSeparator1,
|
||||||
|
this.openToolStripMenuItem,
|
||||||
this.exitToolStripMenuItem});
|
this.exitToolStripMenuItem});
|
||||||
this.cMTaskbar.Name = "cMTaskbar";
|
this.cMTaskbar.Name = "cMTaskbar";
|
||||||
this.cMTaskbar.Size = new System.Drawing.Size(215, 142);
|
this.cMTaskbar.Size = new System.Drawing.Size(215, 164);
|
||||||
this.cMTaskbar.Tag = "25";
|
this.cMTaskbar.Tag = "25";
|
||||||
//
|
//
|
||||||
// openToolStripMenuItem
|
// openToolStripMenuItem
|
||||||
|
@ -86,10 +86,10 @@ namespace ScpServer
|
|||||||
dbns = new Button[4] { bnDeleteC1, bnDeleteC2, bnDeleteC3, bnDeleteC4 };
|
dbns = new Button[4] { bnDeleteC1, bnDeleteC2, bnDeleteC3, bnDeleteC4 };
|
||||||
protexts = new Label[4] { lbSelPro1, lbSelPro2, lbSelPro3, lbSelPro4 };
|
protexts = new Label[4] { lbSelPro1, lbSelPro2, lbSelPro3, lbSelPro4 };
|
||||||
|
|
||||||
shortcuts = new ToolStripMenuItem[4] { (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[2],
|
shortcuts = new ToolStripMenuItem[4] { (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[0],
|
||||||
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3],
|
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[1],
|
||||||
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[4],
|
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[2],
|
||||||
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[5] };
|
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3] };
|
||||||
foreach (ToolStripMenuItem t in shortcuts)
|
foreach (ToolStripMenuItem t in shortcuts)
|
||||||
t.DropDownItemClicked += Profile_Changed_Menu;
|
t.DropDownItemClicked += Profile_Changed_Menu;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user