diff --git a/rpcs3/Input/ds4_pad_handler.cpp b/rpcs3/Input/ds4_pad_handler.cpp index d255fa85058c..3f459a81ad6d 100644 --- a/rpcs3/Input/ds4_pad_handler.cpp +++ b/rpcs3/Input/ds4_pad_handler.cpp @@ -18,6 +18,7 @@ namespace constexpr u32 DS4_FEATURE_REPORT_0x05_SIZE = 41; constexpr u32 DS4_FEATURE_REPORT_0x12_SIZE = 16; constexpr u32 DS4_FEATURE_REPORT_0x81_SIZE = 7; + constexpr u32 DS4_FEATURE_REPORT_0xA3_SIZE = 49; constexpr u32 DS4_INPUT_REPORT_0x11_SIZE = 78; constexpr u32 DS4_OUTPUT_REPORT_0x05_SIZE = 32; constexpr u32 DS4_OUTPUT_REPORT_0x11_SIZE = 78; @@ -568,6 +569,22 @@ void ds4_pad_handler::check_add_device(hid_device* hidDevice, std::string_view p return; } + u32 hw_version{}; + u32 fw_version{}; + + buf[0] = 0xA3; + + res = hid_get_feature_report(hidDevice, buf.data(), DS4_FEATURE_REPORT_0xA3_SIZE); + if (res <= 0) + { + ds4_log.error("check_add_device: hid_get_feature_report 0xA3 failed! Could not retrieve firmware version! result=%d, error=%s", res, hid_error(hidDevice)); + } + else + { + hw_version = read_u32(&buf[35]); + fw_version = read_u32(&buf[41]); + } + if (hid_set_nonblocking(hidDevice, 1) == -1) { ds4_log.error("check_add_device: hid_set_nonblocking failed! Reason: %s", hid_error(hidDevice)); @@ -581,7 +598,7 @@ void ds4_pad_handler::check_add_device(hid_device* hidDevice, std::string_view p send_output_report(device); - ds4_log.notice("Added device: bluetooth=%d, serial='%s', path='%s'", device->bt_controller, serial, device->path); + ds4_log.notice("Added device: bluetooth=%d, serial='%s', hw_version: 0x%x, fw_version: 0x%x, path='%s'", device->bt_controller, serial, hw_version, fw_version, device->path); } ds4_pad_handler::~ds4_pad_handler() diff --git a/rpcs3/Input/dualsense_pad_handler.cpp b/rpcs3/Input/dualsense_pad_handler.cpp index 93a90b00af4b..e86eb14aa710 100644 --- a/rpcs3/Input/dualsense_pad_handler.cpp +++ b/rpcs3/Input/dualsense_pad_handler.cpp @@ -24,6 +24,7 @@ namespace constexpr u32 DUALSENSE_ACC_RES_PER_G = 8192; constexpr u32 DUALSENSE_GYRO_RES_PER_DEG_S = 1024; constexpr u32 DUALSENSE_CALIBRATION_REPORT_SIZE = 41; + constexpr u32 DUALSENSE_VERSION_REPORT_SIZE = 64; constexpr u32 DUALSENSE_BLUETOOTH_REPORT_SIZE = 78; constexpr u32 DUALSENSE_USB_REPORT_SIZE = 63; constexpr u32 DUALSENSE_COMMON_REPORT_SIZE = 47; @@ -219,7 +220,7 @@ void dualsense_pad_handler::check_add_device(hid_device* hidDevice, std::string_ buf[0] = 0x20; - res = hid_get_feature_report(hidDevice, buf.data(), 64); + res = hid_get_feature_report(hidDevice, buf.data(), DUALSENSE_VERSION_REPORT_SIZE); if (res == 65) { hw_version = read_u32(&buf[24]); diff --git a/rpcs3/Input/mm_joystick_handler.cpp b/rpcs3/Input/mm_joystick_handler.cpp index 8438aa9e4f7c..b421a3f07e00 100644 --- a/rpcs3/Input/mm_joystick_handler.cpp +++ b/rpcs3/Input/mm_joystick_handler.cpp @@ -179,7 +179,7 @@ std::array mm_joystick_handler::get_m void mm_joystick_handler::get_next_button_press(const std::string& padId, const pad_callback& callback, const pad_fail_callback& fail_callback, bool get_blacklist, const std::vector& buttons) { if (get_blacklist) - blacklist.clear(); + m_blacklist.clear(); if (!Init()) { @@ -234,14 +234,14 @@ void mm_joystick_handler::get_next_button_press(const std::string& padId, const u64 keycode = button.first; u16 value = data[keycode]; - if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), keycode) != blacklist.end()) + if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), keycode) != m_blacklist.end()) continue; if (value > m_thumb_threshold) { if (get_blacklist) { - blacklist.emplace_back(keycode); + m_blacklist.emplace_back(keycode); input_log.error("MMJOY Calibration: Added axis [ %d = %s ] to blacklist. Value = %d", keycode, button.second, value); } else if (value > pressed_button.first) @@ -254,14 +254,14 @@ void mm_joystick_handler::get_next_button_press(const std::string& padId, const u64 keycode = button.first; u16 value = data[keycode]; - if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), keycode) != blacklist.end()) + if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), keycode) != m_blacklist.end()) continue; if (value > 0) { if (get_blacklist) { - blacklist.emplace_back(keycode); + m_blacklist.emplace_back(keycode); input_log.error("MMJOY Calibration: Added pov [ %d = %s ] to blacklist. Value = %d", keycode, button.second, value); } else if (value > pressed_button.first) @@ -276,7 +276,7 @@ void mm_joystick_handler::get_next_button_press(const std::string& padId, const if (keycode == NO_BUTTON) continue; - if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), keycode) != blacklist.end()) + if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), keycode) != m_blacklist.end()) continue; const u16 value = data[keycode]; @@ -285,7 +285,7 @@ void mm_joystick_handler::get_next_button_press(const std::string& padId, const { if (get_blacklist) { - blacklist.emplace_back(keycode); + m_blacklist.emplace_back(keycode); input_log.error("MMJOY Calibration: Added button [ %d = %s ] to blacklist. Value = %d", keycode, button.second, value); } else if (value > pressed_button.first) @@ -295,7 +295,7 @@ void mm_joystick_handler::get_next_button_press(const std::string& padId, const if (get_blacklist) { - if (blacklist.empty()) + if (m_blacklist.empty()) input_log.success("MMJOY Calibration: Blacklist is clear. No input spam detected"); return; } diff --git a/rpcs3/Input/mm_joystick_handler.h b/rpcs3/Input/mm_joystick_handler.h index ebd2bdc7ffbd..87a1dcb9d451 100644 --- a/rpcs3/Input/mm_joystick_handler.h +++ b/rpcs3/Input/mm_joystick_handler.h @@ -127,7 +127,7 @@ class mm_joystick_handler final : public PadHandlerBase bool is_init = false; - std::vector blacklist; + std::vector m_blacklist; std::shared_ptr m_dev; std::unordered_map m_devices;