From 1479468730874f6ac87ed663e3c58ceb7280f64a Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 12 Feb 2021 02:44:26 +0100 Subject: [PATCH] Input: fix build --- rpcs3/Input/ds3_pad_handler.cpp | 2 +- rpcs3/Input/ds3_pad_handler.h | 6 +++--- rpcs3/Input/ds4_pad_handler.h | 8 ++++---- rpcs3/Input/dualsense_pad_handler.h | 7 ++++--- rpcs3/Input/hid_pad_handler.cpp | 12 ++++++------ 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/rpcs3/Input/ds3_pad_handler.cpp b/rpcs3/Input/ds3_pad_handler.cpp index cdd1fc3fd7..32498364e7 100644 --- a/rpcs3/Input/ds3_pad_handler.cpp +++ b/rpcs3/Input/ds3_pad_handler.cpp @@ -222,6 +222,7 @@ void ds3_pad_handler::check_add_device(hid_device* hidDevice, std::string_view p hid_close(hidDevice); return; } + device->report_id = buf[0]; #endif { @@ -236,7 +237,6 @@ void ds3_pad_handler::check_add_device(hid_device* hidDevice, std::string_view p return; } - device->report_id = buf[0]; device->path = path; device->hidDevice = hidDevice; diff --git a/rpcs3/Input/ds3_pad_handler.h b/rpcs3/Input/ds3_pad_handler.h index 604f154df3..c05f174fa1 100644 --- a/rpcs3/Input/ds3_pad_handler.h +++ b/rpcs3/Input/ds3_pad_handler.h @@ -84,9 +84,9 @@ public: void init_config(pad_config* cfg, const std::string& name) override; private: - ds3_pad_handler::DataStatus get_data(ds3_device* ds3dev); - int send_output_report(ds3_device* ds3dev); - void check_add_device(hid_device* hidDevice, std::string_view path, std::wstring_view serial); + ds3_pad_handler::DataStatus get_data(ds3_device* ds3dev) override; + int send_output_report(ds3_device* ds3dev) override; + void check_add_device(hid_device* hidDevice, std::string_view path, std::wstring_view serial) override; bool get_is_left_trigger(u64 keyCode) override; bool get_is_right_trigger(u64 keyCode) override; diff --git a/rpcs3/Input/ds4_pad_handler.h b/rpcs3/Input/ds4_pad_handler.h index 7cde470cb3..ea441fa7be 100644 --- a/rpcs3/Input/ds4_pad_handler.h +++ b/rpcs3/Input/ds4_pad_handler.h @@ -67,13 +67,13 @@ public: private: u32 get_battery_color(u8 battery_level, int brightness); - // Copies data into padData if status is NewData, otherwise buffer is untouched - DataStatus get_data(DS4Device* ds4Device); // This function gets us usuable buffer from the rawbuffer of padData bool GetCalibrationData(DS4Device* ds4Device); - int send_output_report(DS4Device* device); - void check_add_device(hid_device* hidDevice, std::string_view path, std::wstring_view serial); + // Copies data into padData if status is NewData, otherwise buffer is untouched + DataStatus get_data(DS4Device* ds4Device) override; + int send_output_report(DS4Device* device) override; + void check_add_device(hid_device* hidDevice, std::string_view path, std::wstring_view serial) override; bool get_is_left_trigger(u64 keyCode) override; bool get_is_right_trigger(u64 keyCode) override; diff --git a/rpcs3/Input/dualsense_pad_handler.h b/rpcs3/Input/dualsense_pad_handler.h index 549e4cab9e..e51c87b24d 100644 --- a/rpcs3/Input/dualsense_pad_handler.h +++ b/rpcs3/Input/dualsense_pad_handler.h @@ -69,11 +69,12 @@ public: void init_config(pad_config* cfg, const std::string& name) override; private: - DataStatus get_data(DualSenseDevice* dualsenseDevice); bool get_calibration_data(DualSenseDevice* dualsense_device); - void check_add_device(hid_device* hidDevice, std::string_view path, std::wstring_view wide_serial); - int send_output_report(DualSenseDevice* device); + DataStatus get_data(DualSenseDevice* dualsenseDevice) override; + void check_add_device(hid_device* hidDevice, std::string_view path, std::wstring_view wide_serial) override; + int send_output_report(DualSenseDevice* device) override; + bool get_is_left_trigger(u64 keyCode) override; bool get_is_right_trigger(u64 keyCode) override; bool get_is_left_stick(u64 keyCode) override; diff --git a/rpcs3/Input/hid_pad_handler.cpp b/rpcs3/Input/hid_pad_handler.cpp index 3b32d4677f..56b00d6ed1 100644 --- a/rpcs3/Input/hid_pad_handler.cpp +++ b/rpcs3/Input/hid_pad_handler.cpp @@ -28,7 +28,7 @@ hid_pad_handler::~hid_pad_handler() if (hid_exit() != 0) { - hid_log.error("hid_exit failed!"); + hid_log.error("%s hid_exit failed!", m_type); } } @@ -40,7 +40,7 @@ bool hid_pad_handler::Init() const int res = hid_init(); if (res != 0) - fmt::throw_exception("hidapi-init error.threadproc"); + fmt::throw_exception("%s hidapi-init error.threadproc", m_type); for (size_t i = 1; i <= MAX_GAMEPADS; i++) // Controllers 1-n in GUI { @@ -146,7 +146,7 @@ void hid_pad_handler::enumerate_devices() } else { - hid_log.error("hid_open_path failed! Reason: %s", hid_error(dev)); + hid_log.error("%s hid_open_path failed! Reason: %s", m_type, hid_error(dev)); warn_about_drivers = true; } } @@ -154,7 +154,7 @@ void hid_pad_handler::enumerate_devices() if (warn_about_drivers) { - hid_log.error("One or more pads were detected but couldn't be interacted with directly"); + hid_log.error("One or more %s pads were detected but couldn't be interacted with directly", m_type); #if defined(_WIN32) || defined(__linux__) hid_log.error("Check https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration for intructions on how to solve this issue"); #endif @@ -164,11 +164,11 @@ void hid_pad_handler::enumerate_devices() const size_t count = std::count_if(m_controllers.cbegin(), m_controllers.cend(), [](const auto& c) { return c.second && c.second->hidDevice; }); if (count > 0) { - hid_log.success("Controllers found: %d", count); + hid_log.success("%s Controllers found: %d", m_type, count); } else { - hid_log.warning("No controllers found!"); + hid_log.warning("No %s controllers found!", m_type); } } }