mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-29 20:44:20 +01:00
Merge branch 'mika-n-jay' into jay
This commit is contained in:
commit
66321306f3
@ -35,16 +35,19 @@ namespace DS4Windows
|
|||||||
internal const int NACON_VID = 0x146B;
|
internal const int NACON_VID = 0x146B;
|
||||||
internal const int HORI_VID = 0x0F0D;
|
internal const int HORI_VID = 0x0F0D;
|
||||||
|
|
||||||
|
// https://support.steampowered.com/kb_article.php?ref=5199-TOKV-4426&l=english web site has a list of other PS4 compatible device VID/PID values and brand names.
|
||||||
|
// However, not all those are guaranteed to work with DS4Windows app so support is added case by case when users of DS4Windows app tests non-official DS4 gamepads.
|
||||||
|
|
||||||
private static VidPidInfo[] knownDevices =
|
private static VidPidInfo[] knownDevices =
|
||||||
{
|
{
|
||||||
new VidPidInfo(SONY_VID, 0xBA0, "Sony WA"),
|
new VidPidInfo(SONY_VID, 0xBA0, "Sony WA"),
|
||||||
new VidPidInfo(SONY_VID, 0x5C4, "DS4 v.1"),
|
new VidPidInfo(SONY_VID, 0x5C4, "DS4 v.1"),
|
||||||
new VidPidInfo(SONY_VID, 0x09CC, "DS4 v.2"),
|
new VidPidInfo(SONY_VID, 0x09CC, "DS4 v.2"),
|
||||||
new VidPidInfo(RAZER_VID, 0x1000),
|
new VidPidInfo(RAZER_VID, 0x1000, "Razer Raiju PS4"),
|
||||||
new VidPidInfo(NACON_VID, 0x0D01),
|
new VidPidInfo(NACON_VID, 0x0D01, "Nacon Revol Pro v.1"),
|
||||||
new VidPidInfo(NACON_VID, 0x0D02),
|
new VidPidInfo(NACON_VID, 0x0D02, "Nacon Revol Pro v.2"),
|
||||||
new VidPidInfo(HORI_VID, 0x00EE, "Hori PS4 Mini"), // Hori PS4 Mini Wired Gamepad
|
new VidPidInfo(HORI_VID, 0x00EE, "Hori PS4 Mini"), // Hori PS4 Mini Wired Gamepad
|
||||||
new VidPidInfo(0x7545, 0x0104),
|
new VidPidInfo(0x7545, 0x0104, "Armor 3 LU Cobra"), // Armor 3 Level Up Cobra
|
||||||
new VidPidInfo(0x2E95, 0x7725, "Scuf Vantage"), // Scuf Vantage gamepad
|
new VidPidInfo(0x2E95, 0x7725, "Scuf Vantage"), // Scuf Vantage gamepad
|
||||||
new VidPidInfo(0x11C0, 0x4001, "PS4 Fun"), // PS4 Fun Controller
|
new VidPidInfo(0x11C0, 0x4001, "PS4 Fun"), // PS4 Fun Controller
|
||||||
new VidPidInfo(RAZER_VID, 0x1007, "Razer Raiju TE"), // Razer Raiju Tournament Edition
|
new VidPidInfo(RAZER_VID, 0x1007, "Razer Raiju TE"), // Razer Raiju Tournament Edition
|
||||||
@ -53,6 +56,8 @@ namespace DS4Windows
|
|||||||
new VidPidInfo(SONY_VID, 0x05C5, "CronusMax (PS4 Mode)"), // CronusMax (PS4 Output Mode)
|
new VidPidInfo(SONY_VID, 0x05C5, "CronusMax (PS4 Mode)"), // CronusMax (PS4 Output Mode)
|
||||||
new VidPidInfo(0x0C12, 0x57AB, "Warrior Joypad JS083"), // Warrior Joypad JS083 (wired). Custom lightbar color doesn't work, but everything else works OK (except touchpad and gyro because the gamepad doesnt have those).
|
new VidPidInfo(0x0C12, 0x57AB, "Warrior Joypad JS083"), // Warrior Joypad JS083 (wired). Custom lightbar color doesn't work, but everything else works OK (except touchpad and gyro because the gamepad doesnt have those).
|
||||||
new VidPidInfo(0x0C12, 0x0E16, "Steel Play MetalTech"), // Steel Play Metaltech P4 (wired)
|
new VidPidInfo(0x0C12, 0x0E16, "Steel Play MetalTech"), // Steel Play Metaltech P4 (wired)
|
||||||
|
new VidPidInfo(NACON_VID, 0x0D08, "Nacon Revol U Pro"), // Nacon Revolution Unlimited Pro
|
||||||
|
new VidPidInfo(HORI_VID, 0x0084, "Hori Fighting Cmd"), // Hori Fighting Commander (special kind of gamepad without touchpad or sticks. There is a hardware switch to alter d-pad type between dpad and LS/RS)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static string devicePathToInstanceId(string devicePath)
|
private static string devicePathToInstanceId(string devicePath)
|
||||||
|
@ -475,12 +475,19 @@ namespace DS4Windows
|
|||||||
if (serial != null)
|
if (serial != null)
|
||||||
return serial;
|
return serial;
|
||||||
|
|
||||||
|
// Some devices don't have MAC address (especially gamepads with USB only suports in PC). If the serial number reading fails
|
||||||
|
// then use dummy zero MAC address, because there is a good chance the gamepad stll works in DS4Windows app (the code would throw
|
||||||
|
// an index out of bounds exception anyway without IF-THEN-ELSE checks after trying to read a serial number).
|
||||||
|
|
||||||
if (Capabilities.InputReportByteLength == 64)
|
if (Capabilities.InputReportByteLength == 64)
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[16];
|
byte[] buffer = new byte[16];
|
||||||
buffer[0] = 18;
|
buffer[0] = 18;
|
||||||
readFeatureData(buffer);
|
if (readFeatureData(buffer))
|
||||||
serial = String.Format("{0:X02}:{1:X02}:{2:X02}:{3:X02}:{4:X02}:{5:X02}", buffer[6], buffer[5], buffer[4], buffer[3], buffer[2], buffer[1]);
|
serial = String.Format("{0:X02}:{1:X02}:{2:X02}:{3:X02}:{4:X02}:{5:X02}", buffer[6], buffer[5], buffer[4], buffer[3], buffer[2], buffer[1]);
|
||||||
|
else
|
||||||
|
serial = "00:00:00:00:00:00";
|
||||||
|
|
||||||
return serial;
|
return serial;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -491,10 +498,15 @@ namespace DS4Windows
|
|||||||
#else
|
#else
|
||||||
uint bufferLen = 126;
|
uint bufferLen = 126;
|
||||||
#endif
|
#endif
|
||||||
NativeMethods.HidD_GetSerialNumberString(safeReadHandle.DangerousGetHandle(), buffer, bufferLen);
|
if (NativeMethods.HidD_GetSerialNumberString(safeReadHandle.DangerousGetHandle(), buffer, bufferLen))
|
||||||
|
{
|
||||||
string MACAddr = System.Text.Encoding.Unicode.GetString(buffer).Replace("\0", string.Empty).ToUpper();
|
string MACAddr = System.Text.Encoding.Unicode.GetString(buffer).Replace("\0", string.Empty).ToUpper();
|
||||||
MACAddr = $"{MACAddr[0]}{MACAddr[1]}:{MACAddr[2]}{MACAddr[3]}:{MACAddr[4]}{MACAddr[5]}:{MACAddr[6]}{MACAddr[7]}:{MACAddr[8]}{MACAddr[9]}:{MACAddr[10]}{MACAddr[11]}";
|
MACAddr = $"{MACAddr[0]}{MACAddr[1]}:{MACAddr[2]}{MACAddr[3]}:{MACAddr[4]}{MACAddr[5]}:{MACAddr[6]}{MACAddr[7]}:{MACAddr[8]}{MACAddr[9]}:{MACAddr[10]}{MACAddr[11]}";
|
||||||
serial = MACAddr;
|
serial = MACAddr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
serial = "00:00:00:00:00:00";
|
||||||
|
|
||||||
return serial;
|
return serial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user