Skip to content

Commit

Permalink
Revert previous optimization that slow down controller in the switch …
Browse files Browse the repository at this point in the history
…menus
  • Loading branch information
o0Zz committed Jun 21, 2024
1 parent d9d6381 commit 89452d8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
11 changes: 0 additions & 11 deletions source/ControllerLib/Controllers/GenericHIDController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ GenericHIDController::GenericHIDController(std::unique_ptr<IUSBDevice> &&device,
m_joystick_count(0)
{
LogPrint(LogLevelDebug, "GenericHIDController[%04x-%04x] Created !", m_device->GetVendor(), m_device->GetProduct());
for (int i = 0; i < CONTROLLER_MAX_INPUTS; i++)
memset(m_last_input_bytes[i], 0, sizeof(m_last_input_bytes[i]));
}

GenericHIDController::~GenericHIDController()
Expand Down Expand Up @@ -75,15 +73,6 @@ ams::Result GenericHIDController::ReadInput(RawInputData *rawData, uint16_t *inp
if (joystick_data.index >= GetInputCount())
R_RETURN(CONTROL_ERR_UNEXPECTED_DATA);

// Do nothing if the controller input didn't changed
if (memcmp(m_last_input_bytes[joystick_data.index], input_bytes, size) == 0)
{
// LogPrint(LogLevelDebug, "GenericHIDController[%04x-%04x] No new input data", m_device->GetVendor(), m_device->GetProduct());
R_RETURN(CONTROL_ERR_NOTHING_TODO);
}

memcpy(m_last_input_bytes[joystick_data.index], input_bytes, size);

*input_idx = joystick_data.index;

for (int i = 0; i < MAX_CONTROLLER_BUTTONS; i++)
Expand Down
1 change: 0 additions & 1 deletion source/ControllerLib/Controllers/GenericHIDController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class GenericHIDController : public BaseController
private:
std::shared_ptr<HIDJoystick> m_joystick;
uint8_t m_joystick_count = 0;
alignas(0x40) uint8_t m_last_input_bytes[CONTROLLER_MAX_INPUTS][CONTROLLER_INPUT_BUFFER_SIZE];

public:
GenericHIDController(std::unique_ptr<IUSBDevice> &&device, const ControllerConfig &config, std::unique_ptr<ILogger> &&logger);
Expand Down

0 comments on commit 89452d8

Please sign in to comment.