diff --git a/buildJar.bat b/buildJar.bat
new file mode 100644
index 0000000..7e7c322
--- /dev/null
+++ b/buildJar.bat
@@ -0,0 +1 @@
+mvn clean compile assembly:single
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 7fff789..8303696 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,6 +14,21 @@
1.8
+
+ maven-assembly-plugin
+
+
+
+
+ net.ash.HIDToVPADNetworkClient.Main
+
+
+
+ jar-with-dependencies
+
+
+
+
diff --git a/src/net/ash/HIDToVPADNetworkClient/controller/DS4NewController.java b/src/net/ash/HIDToVPADNetworkClient/controller/DS4NewController.java
new file mode 100644
index 0000000..2b3060f
--- /dev/null
+++ b/src/net/ash/HIDToVPADNetworkClient/controller/DS4NewController.java
@@ -0,0 +1,24 @@
+package net.ash.HIDToVPADNetworkClient.controller;
+
+import net.ash.HIDToVPADNetworkClient.exeption.ControllerInitializationFailedException;
+
+public class DS4NewController extends PureJavaHidController {
+ public static final short DS4_NEW_CONTROLLER_VID = 0x54C;
+ public static final short DS4_NEW_CONTROLLER_PID = 0x09CC;
+
+ public DS4NewController(String identifier) throws ControllerInitializationFailedException {
+ super(identifier);
+ //truncate package to 6;
+ this.PACKET_LENGTH = 6;
+ }
+
+ @Override
+ public byte[] pollLatestData() {
+ return currentData.clone();
+ }
+
+ @Override
+ public String getInfoText(){
+ return "DS4 on " + getIdentifier();
+ }
+}
diff --git a/src/net/ash/HIDToVPADNetworkClient/controller/PureJavaHidController.java b/src/net/ash/HIDToVPADNetworkClient/controller/PureJavaHidController.java
index 74a8caa..fef68cc 100644
--- a/src/net/ash/HIDToVPADNetworkClient/controller/PureJavaHidController.java
+++ b/src/net/ash/HIDToVPADNetworkClient/controller/PureJavaHidController.java
@@ -40,7 +40,10 @@ public class PureJavaHidController extends Controller implements InputReportList
if(device.getHidDeviceInfo().getVendorId() == SwitchProController.SWITCH_PRO_CONTROLLER_VID &&
device.getHidDeviceInfo().getProductId() == SwitchProController.SWITCH_PRO_CONTROLLER_PID){
return new SwitchProController(deviceIdentifier);
- }else{
+ }else if(device.getHidDeviceInfo().getVendorId() == DS4NewController.DS4_NEW_CONTROLLER_VID &&
+ device.getHidDeviceInfo().getProductId() == DS4NewController.DS4_NEW_CONTROLLER_PID){
+ return new DS4NewController(deviceIdentifier);
+ }else {
return new PureJavaHidController(deviceIdentifier);
}
}
diff --git a/src/net/ash/HIDToVPADNetworkClient/controller/SwitchProController.java b/src/net/ash/HIDToVPADNetworkClient/controller/SwitchProController.java
index f8fa377..d8485f8 100644
--- a/src/net/ash/HIDToVPADNetworkClient/controller/SwitchProController.java
+++ b/src/net/ash/HIDToVPADNetworkClient/controller/SwitchProController.java
@@ -27,7 +27,6 @@ public class SwitchProController extends PureJavaHidController {
public static final short SWITCH_PRO_CONTROLLER_VID = 0x57e;
public static final short SWITCH_PRO_CONTROLLER_PID = 0x2009;
-
public SwitchProController(String identifier) throws ControllerInitializationFailedException {
super(identifier);
//truncate package to 11;
diff --git a/src/net/ash/HIDToVPADNetworkClient/manager/ControllerManager.java b/src/net/ash/HIDToVPADNetworkClient/manager/ControllerManager.java
index 931b529..9c1c96f 100644
--- a/src/net/ash/HIDToVPADNetworkClient/manager/ControllerManager.java
+++ b/src/net/ash/HIDToVPADNetworkClient/manager/ControllerManager.java
@@ -142,7 +142,7 @@ public class ControllerManager{
Map connectedDevices = new HashMap<>();
for (HidDeviceInfo info : PureJavaHidApi.enumerateDevices()) {
- if(info.getUsagePage() == 0x05 || info.getUsagePage() == 0x04 || (info.getVendorId() == 0x57e)){
+ if(info.getUsagePage() == 0x05 || info.getUsagePage() == 0x04 || (info.getVendorId() == 0x57e) || (info.getVendorId() == 0x054c) ){
connectedDevices.put(info.getPath(),ControllerType.PureJAVAHid);
}
}
diff --git a/src/net/ash/HIDToVPADNetworkClient/network/NetworkHIDDevice.java b/src/net/ash/HIDToVPADNetworkClient/network/NetworkHIDDevice.java
index c9a3af4..1cbe99f 100644
--- a/src/net/ash/HIDToVPADNetworkClient/network/NetworkHIDDevice.java
+++ b/src/net/ash/HIDToVPADNetworkClient/network/NetworkHIDDevice.java
@@ -35,6 +35,7 @@ import net.ash.HIDToVPADNetworkClient.network.commands.DetachCommand;
import net.ash.HIDToVPADNetworkClient.network.commands.DeviceCommand;
import net.ash.HIDToVPADNetworkClient.network.commands.ReadCommand;
import net.ash.HIDToVPADNetworkClient.util.HandleFoundry;
+import net.ash.HIDToVPADNetworkClient.util.Utilities;
public class NetworkHIDDevice {
@Getter private final short vid;
diff --git a/src/net/ash/HIDToVPADNetworkClient/network/NetworkManager.java b/src/net/ash/HIDToVPADNetworkClient/network/NetworkManager.java
index 46c6ea6..be8a661 100644
--- a/src/net/ash/HIDToVPADNetworkClient/network/NetworkManager.java
+++ b/src/net/ash/HIDToVPADNetworkClient/network/NetworkManager.java
@@ -270,8 +270,9 @@ public class NetworkManager implements Runnable{
byte[] rawCommand;
try {
rawCommand = Protocol.getRawReadDataToSend(readCommands);
- System.out.println("UDP Packet: "+ Utilities.ByteArrayToString(rawCommand));
- sendUDP(rawCommand);
+ if(sendUDP(rawCommand) == true){
+ System.out.println("UDP Packet sent: "+ Utilities.ByteArrayToString(rawCommand));
+ }
} catch (IOException e) {
System.out.println("Sending read data failed.");
}
@@ -279,7 +280,7 @@ public class NetworkManager implements Runnable{
private boolean sendUDP(byte[] rawCommand) {
boolean result = false;
- if(udpClient != null){
+ if(udpClient != null && isConnected()){
try {
udpClient.send(rawCommand);
result = true;