From 615ff08d1a75a3354ee20dfffd2171ddddba4763 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 22 Oct 2022 01:58:45 +0200 Subject: [PATCH] Dualsense: Release LEDs on when the handler is destroyed --- rpcs3/Input/dualsense_pad_handler.cpp | 8 +++++++- rpcs3/Input/dualsense_pad_handler.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/rpcs3/Input/dualsense_pad_handler.cpp b/rpcs3/Input/dualsense_pad_handler.cpp index d4ce1bc4b0..e9a1046f44 100644 --- a/rpcs3/Input/dualsense_pad_handler.cpp +++ b/rpcs3/Input/dualsense_pad_handler.cpp @@ -913,6 +913,7 @@ dualsense_pad_handler::~dualsense_pad_handler() // Disable vibration controller.second->small_motor = 0; controller.second->large_motor = 0; + controller.second->release_leds = true; send_output_report(controller.second.get()); } } @@ -939,6 +940,11 @@ int dualsense_pad_handler::send_output_report(DualSenseDevice* device) common.valid_flag_2 |= VALID_FLAG_2_LIGHTBAR_SETUP_CONTROL_ENABLE; common.lightbar_setup = LIGHTBAR_SETUP_LIGHT_OUT; // Fade light out. } + else if (device->release_leds) + { + common.valid_flag_1 |= VALID_FLAG_1_RELEASE_LEDS; + device->release_leds = false; + } else { common.valid_flag_0 |= VALID_FLAG_0_COMPATIBLE_VIBRATION; @@ -1109,7 +1115,7 @@ void dualsense_pad_handler::apply_pad_data(const pad_ensemble& binding) dualsense_dev->update_player_leds = true; } - dualsense_dev->new_output_data |= dualsense_dev->update_player_leds || dualsense_dev->update_lightbar || dualsense_dev->large_motor != speed_large || dualsense_dev->small_motor != speed_small; + dualsense_dev->new_output_data |= dualsense_dev->release_leds || dualsense_dev->update_player_leds || dualsense_dev->update_lightbar || dualsense_dev->large_motor != speed_large || dualsense_dev->small_motor != speed_small; dualsense_dev->large_motor = speed_large; dualsense_dev->small_motor = speed_small; diff --git a/rpcs3/Input/dualsense_pad_handler.h b/rpcs3/Input/dualsense_pad_handler.h index 541f3ab6a4..cc26700099 100644 --- a/rpcs3/Input/dualsense_pad_handler.h +++ b/rpcs3/Input/dualsense_pad_handler.h @@ -21,6 +21,7 @@ public: bool init_lightbar{true}; bool update_lightbar{true}; bool update_player_leds{true}; + bool release_leds{false}; // Controls for lightbar pulse. This seems somewhat hacky for now, as I haven't found out a nicer way. bool lightbar_on{false};