From aa6114555267ff29472d9bf2f2bc4a625365af9c Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 26 Jan 2023 21:30:18 +0100 Subject: [PATCH] early-access version 3334 --- README.md | 2 +- src/input_common/helpers/joycon_driver.cpp | 3 +++ .../helpers/joycon_protocol/generic_functions.cpp | 11 +++++++++++ .../helpers/joycon_protocol/generic_functions.h | 6 ++++++ .../helpers/joycon_protocol/joycon_types.h | 1 + src/yuzu/multiplayer/direct_connect.ui | 10 ++-------- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 650e7b902..d4ddfe26f 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3333. +This is the source code for early-access 3334. ## Legal Notice diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp index 4159e5717..3775e2d35 100755 --- a/src/input_common/helpers/joycon_driver.cpp +++ b/src/input_common/helpers/joycon_driver.cpp @@ -86,6 +86,7 @@ DriverResult JoyconDriver::InitializeDevice() { // Get fixed joycon info generic_protocol->GetVersionNumber(version); + generic_protocol->SetLowPowerMode(false); generic_protocol->GetColor(color); if (handle_device_type == ControllerType::Pro) { // Some 3rd party controllers aren't pro controllers @@ -324,6 +325,8 @@ DriverResult JoyconDriver::SetPollingMode() { if (result != DriverResult::Success) { LOG_ERROR(Input, "Error enabling active mode"); } + // Switch calls this function after enabling active mode + generic_protocol->TriggersElapsed(); disable_input_thread = false; return result; diff --git a/src/input_common/helpers/joycon_protocol/generic_functions.cpp b/src/input_common/helpers/joycon_protocol/generic_functions.cpp index 52bb8b61a..63cfb1369 100755 --- a/src/input_common/helpers/joycon_protocol/generic_functions.cpp +++ b/src/input_common/helpers/joycon_protocol/generic_functions.cpp @@ -19,6 +19,17 @@ DriverResult GenericProtocol::EnableActiveMode() { return SetReportMode(ReportMode::STANDARD_FULL_60HZ); } +DriverResult GenericProtocol::SetLowPowerMode(bool enable) { + ScopedSetBlocking sb(this); + const std::array buffer{static_cast(enable ? 1 : 0)}; + return SendSubCommand(SubCommand::LOW_POWER_MODE, buffer); +} + +DriverResult GenericProtocol::TriggersElapsed() { + ScopedSetBlocking sb(this); + return SendSubCommand(SubCommand::TRIGGERS_ELAPSED, {}); +} + DriverResult GenericProtocol::GetDeviceInfo(DeviceInfo& device_info) { ScopedSetBlocking sb(this); std::vector output; diff --git a/src/input_common/helpers/joycon_protocol/generic_functions.h b/src/input_common/helpers/joycon_protocol/generic_functions.h index 239bb7dbf..424831e81 100755 --- a/src/input_common/helpers/joycon_protocol/generic_functions.h +++ b/src/input_common/helpers/joycon_protocol/generic_functions.h @@ -25,6 +25,12 @@ public: /// Enables active mode. This mode will return the current status every 5-15ms DriverResult EnableActiveMode(); + /// Enables or disables the low power mode + DriverResult SetLowPowerMode(bool enable); + + /// Unknown function used by the switch + DriverResult TriggersElapsed(); + /** * Sends a request to obtain the joycon firmware and mac from handle * @returns controller device info diff --git a/src/input_common/helpers/joycon_protocol/joycon_types.h b/src/input_common/helpers/joycon_protocol/joycon_types.h index e2d47349f..182d2c15b 100755 --- a/src/input_common/helpers/joycon_protocol/joycon_types.h +++ b/src/input_common/helpers/joycon_protocol/joycon_types.h @@ -129,6 +129,7 @@ enum class SubCommand : u8 { LOW_POWER_MODE = 0x08, SPI_FLASH_READ = 0x10, SPI_FLASH_WRITE = 0x11, + SPI_SECTOR_ERASE = 0x12, RESET_MCU = 0x20, SET_MCU_CONFIG = 0x21, SET_MCU_STATE = 0x22, diff --git a/src/yuzu/multiplayer/direct_connect.ui b/src/yuzu/multiplayer/direct_connect.ui index fa3309ef2..966d6a593 100755 --- a/src/yuzu/multiplayer/direct_connect.ui +++ b/src/yuzu/multiplayer/direct_connect.ui @@ -76,16 +76,10 @@ 24872 - - - 0 - 0 - - - 65 - 50 + 65 + 50