early-access version 3334

This commit is contained in:
pineappleEA 2023-01-26 21:30:18 +01:00
parent b4a3b45fcb
commit aa61145552
6 changed files with 24 additions and 9 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3333. This is the source code for early-access 3334.
## Legal Notice ## Legal Notice

View file

@ -86,6 +86,7 @@ DriverResult JoyconDriver::InitializeDevice() {
// Get fixed joycon info // Get fixed joycon info
generic_protocol->GetVersionNumber(version); generic_protocol->GetVersionNumber(version);
generic_protocol->SetLowPowerMode(false);
generic_protocol->GetColor(color); generic_protocol->GetColor(color);
if (handle_device_type == ControllerType::Pro) { if (handle_device_type == ControllerType::Pro) {
// Some 3rd party controllers aren't pro controllers // Some 3rd party controllers aren't pro controllers
@ -324,6 +325,8 @@ DriverResult JoyconDriver::SetPollingMode() {
if (result != DriverResult::Success) { if (result != DriverResult::Success) {
LOG_ERROR(Input, "Error enabling active mode"); LOG_ERROR(Input, "Error enabling active mode");
} }
// Switch calls this function after enabling active mode
generic_protocol->TriggersElapsed();
disable_input_thread = false; disable_input_thread = false;
return result; return result;

View file

@ -19,6 +19,17 @@ DriverResult GenericProtocol::EnableActiveMode() {
return SetReportMode(ReportMode::STANDARD_FULL_60HZ); return SetReportMode(ReportMode::STANDARD_FULL_60HZ);
} }
DriverResult GenericProtocol::SetLowPowerMode(bool enable) {
ScopedSetBlocking sb(this);
const std::array<u8, 1> buffer{static_cast<u8>(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) { DriverResult GenericProtocol::GetDeviceInfo(DeviceInfo& device_info) {
ScopedSetBlocking sb(this); ScopedSetBlocking sb(this);
std::vector<u8> output; std::vector<u8> output;

View file

@ -25,6 +25,12 @@ public:
/// Enables active mode. This mode will return the current status every 5-15ms /// Enables active mode. This mode will return the current status every 5-15ms
DriverResult EnableActiveMode(); 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 * Sends a request to obtain the joycon firmware and mac from handle
* @returns controller device info * @returns controller device info

View file

@ -129,6 +129,7 @@ enum class SubCommand : u8 {
LOW_POWER_MODE = 0x08, LOW_POWER_MODE = 0x08,
SPI_FLASH_READ = 0x10, SPI_FLASH_READ = 0x10,
SPI_FLASH_WRITE = 0x11, SPI_FLASH_WRITE = 0x11,
SPI_SECTOR_ERASE = 0x12,
RESET_MCU = 0x20, RESET_MCU = 0x20,
SET_MCU_CONFIG = 0x21, SET_MCU_CONFIG = 0x21,
SET_MCU_STATE = 0x22, SET_MCU_STATE = 0x22,

View file

@ -76,16 +76,10 @@
<property name="placeholderText"> <property name="placeholderText">
<string notr="true" extracomment="placeholder string that tells user default port">24872</string> <string notr="true" extracomment="placeholder string that tells user default port">24872</string>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>65</width> <width>65</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
</widget> </widget>