mirror of
https://github.com/Maschell/HIDtoVPADNetworkClient.git
synced 2024-06-02 07:28:51 +02:00
25e8bc6faf
Alternative: buttons for scanning manually. - Change the OSX implementation. You need to scan for controller manually to get it working. - OSX doesn’t check is a connection is still open when sending. Added a PING response to check if the client is still connected. !!!!!!!!! - Changed the protocol! For this network client, you’ll need the newest nighty of HIDtoVPAD! !!!!!!!!!
35 lines
1.0 KiB
Java
35 lines
1.0 KiB
Java
package net.ash.HIDToVPADNetworkClient.controller;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import net.ash.HIDToVPADNetworkClient.exeption.ControllerInitializationFailedException;
|
|
import net.ash.HIDToVPADNetworkClient.util.Settings;
|
|
|
|
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);
|
|
if (Settings.isMacOSX()) {
|
|
this.PACKET_LENGTH = 7;
|
|
} else {
|
|
this.PACKET_LENGTH = 6;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public byte[] pollLatestData() {
|
|
if (Settings.isMacOSX()) { // for some reason the controller has one extra byte at the beginning under OSX
|
|
return Arrays.copyOfRange(currentData, 1, 7);
|
|
}
|
|
|
|
return currentData.clone();
|
|
}
|
|
|
|
@Override
|
|
public String getInfoText() {
|
|
return "DS4 on " + getIdentifier();
|
|
}
|
|
}
|