dualsense: implement player LEDs

This commit is contained in:
Megamouse 2021-02-09 02:24:33 +01:00
parent e5f95a450d
commit bc938ce630
4 changed files with 20 additions and 4 deletions

View File

@ -68,6 +68,7 @@ protected:
std::array<bool, MAX_GAMEPADS> last_connection_status{{ false, false, false, false, false, false, false }};
std::string m_name_string;
u32 m_player_id = 0;
usz m_max_devices = 0;
int m_trigger_threshold = 0;
int m_thumb_threshold = 0;
@ -145,6 +146,8 @@ public:
bool has_led() const;
bool has_battery() const;
void set_player(u32 player_id) { m_player_id = player_id; }
static std::string get_config_dir(pad_handler type, const std::string& title_id = "");
static std::string get_config_filename(int i, const std::string& title_id = "");

View File

@ -954,7 +954,19 @@ int dualsense_pad_handler::send_output_report(const std::shared_ptr<DualSenseDev
// The dualsense controller uses 5 LEDs to indicate the player ID.
// Use OR with 0x1, 0x2, 0x4, 0x8 and 0x10 to enable the LEDs (from leftmost to rightmost).
common.valid_flag_1 |= VALID_FLAG_1_PLAYER_INDICATOR_CONTROL_ENABLE;
common.player_leds = 0; // TODO: We currently don't know which player uses this pad
switch (m_player_id)
{
case 0: common.player_leds = 0b00100; break;
case 1: common.player_leds = 0b01010; break;
case 2: common.player_leds = 0b10101; break;
case 3: common.player_leds = 0b11011; break;
case 4: common.player_leds = 0b11111; break;
case 5: common.player_leds = 0b10111; break;
case 6: common.player_leds = 0b11101; break;
default:
fmt::throw_exception("Dualsense is using forbidden player id %d", m_player_id);
}
}
if (device->btCon)

View File

@ -145,6 +145,7 @@ void pad_thread::Init()
}
handlers.emplace(handler_type, cur_pad_handler);
}
cur_pad_handler->set_player(i);
cur_pad_handler->Init();
m_pads[i] = std::make_shared<Pad>(CELL_PAD_STATUS_DISCONNECTED, pad_settings[i].device_capability, pad_settings[i].device_type);

View File

@ -211,9 +211,9 @@ public:
const QString ds4_windows = tr("If you have any issues with the DualShock 4 handler, it might be caused by third-party tools such as DS4Windows. It's recommended that you disable them while using this handler.");
const QString ds4_linux = tr("In order to use the DualShock 4 handler, you might need to add udev rules to let RPCS3 access the controller.<br>See the <a href=\"https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration\">RPCS3 Wiki</a> for instructions.");
const QString ds4_other = tr("The DualShock 4 handler is recommended for official DualShock 4 controllers.");
const QString dualsense_windows = tr("The DualSense handler is recommended for official DualSense controllers.<br><br>Player LEDs and battery settings are not supported yet.");
const QString dualsense_linux = tr("The DualSense handler is recommended for official DualSense controllers.<br><br>Player LEDs and battery settings are not supported yet.");
const QString dualsense_other = tr("The DualSense handler is recommended for official DualSense controllers.<br><br>Player LEDs and battery settings are not supported yet.");
const QString dualsense_windows = tr("The DualSense handler is recommended for official DualSense controllers.<br><br>Battery settings are not supported yet.");
const QString dualsense_linux = tr("The DualSense handler is recommended for official DualSense controllers.<br><br>Battery settings are not supported yet.");
const QString dualsense_other = tr("The DualSense handler is recommended for official DualSense controllers.<br><br>Battery settings are not supported yet.");
const QString xinput = tr("The XInput handler will work with Xbox controllers and many third-party PC-compatible controllers. Pressure sensitive buttons from SCP are supported when SCP's XInput1_3.dll is placed in the main RPCS3 directory. For more details, see the <a href=\"https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration\">RPCS3 Wiki</a>.");
const QString evdev = tr("The evdev handler should work with any controller that has linux support.<br>If your joystick is not being centered properly, read the <a href=\"https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration\">RPCS3 Wiki</a> for instructions.");
const QString mmjoy = tr("The MMJoystick handler should work with almost any controller recognized by Windows. However, it is recommended that you use the more specific handlers if you have a controller that supports them.");