From 9eecfca71d45b02274d891746baea624f9f2779f Mon Sep 17 00:00:00 2001 From: skidau Date: Thu, 18 Dec 2014 09:10:22 +1100 Subject: [PATCH 1/2] Corrected the buffer that is used by the GCAdapter thread. --- Source/Core/Core/HW/SI_GCAdapter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/HW/SI_GCAdapter.cpp b/Source/Core/Core/HW/SI_GCAdapter.cpp index 269219ac7f..0958db0bd2 100644 --- a/Source/Core/Core/HW/SI_GCAdapter.cpp +++ b/Source/Core/Core/HW/SI_GCAdapter.cpp @@ -38,7 +38,7 @@ static void Read() { u8 controller_payload_swap[37]; - libusb_interrupt_transfer(s_handle, s_endpoint_in, s_controller_payload, sizeof(controller_payload_swap), &s_controller_payload_size, 0); + libusb_interrupt_transfer(s_handle, s_endpoint_in, controller_payload_swap, sizeof(controller_payload_swap), &s_controller_payload_size, 0); { std::lock_guard lk(s_mutex); From f913cb6ab6845d55d2fad3068bc25d8ac2f6924a Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 20 Dec 2014 09:43:42 +1100 Subject: [PATCH 2/2] Removed redundant code from the GC Adapter interface. --- Source/Core/Core/HW/SI_GCAdapter.cpp | 46 ---------------------------- Source/Core/Core/HW/SI_GCAdapter.h | 2 -- 2 files changed, 48 deletions(-) diff --git a/Source/Core/Core/HW/SI_GCAdapter.cpp b/Source/Core/Core/HW/SI_GCAdapter.cpp index 0958db0bd2..ca1cb8e3fe 100644 --- a/Source/Core/Core/HW/SI_GCAdapter.cpp +++ b/Source/Core/Core/HW/SI_GCAdapter.cpp @@ -164,8 +164,6 @@ void Init() unsigned char payload = 0x13; libusb_interrupt_transfer(s_handle, s_endpoint_out, &payload, sizeof(payload), &tmp, 0); - RefreshConnectedDevices(); - s_adapter_thread_running.Set(true); s_adapter_thread = std::thread(Read); } @@ -271,50 +269,6 @@ void Output(int chan, u8 rumble_command) } } -SIDevices GetDeviceType(int channel) -{ - if (s_handle == nullptr || !SConfig::GetInstance().m_GameCubeAdapter) - return SIDEVICE_NONE; - - switch (s_controller_type[channel]) - { - case CONTROLLER_WIRED: - return SIDEVICE_GC_CONTROLLER; - case CONTROLLER_WIRELESS: - return SIDEVICE_GC_CONTROLLER; - default: - return SIDEVICE_NONE; - } -} - -void RefreshConnectedDevices() -{ - if (s_handle == nullptr || !SConfig::GetInstance().m_GameCubeAdapter) - return; - - int size = 0; - u8 refresh_controller_payload[37]; - - libusb_interrupt_transfer(s_handle, s_endpoint_in, refresh_controller_payload, sizeof(refresh_controller_payload), &size, 0); - - if (size != sizeof(refresh_controller_payload) || refresh_controller_payload[0] != LIBUSB_DT_HID) - { - WARN_LOG(SERIALINTERFACE, "error reading payload (size: %d)", size); - Shutdown(); - } - else - { - for (int chan = 0; chan < MAX_SI_CHANNELS; chan++) - { - u8 type = refresh_controller_payload[1 + (9 * chan)] >> 4; - if (type != CONTROLLER_NONE && s_controller_type[chan] == CONTROLLER_NONE) - NOTICE_LOG(SERIALINTERFACE, "New device connected to Port %d of Type: %02x", chan + 1, refresh_controller_payload[1 + (9 * chan)]); - - s_controller_type[chan] = type; - } - } -} - bool IsDetected() { return s_handle != nullptr; diff --git a/Source/Core/Core/HW/SI_GCAdapter.h b/Source/Core/Core/HW/SI_GCAdapter.h index b47afdaec2..4e11dd6636 100644 --- a/Source/Core/Core/HW/SI_GCAdapter.h +++ b/Source/Core/Core/HW/SI_GCAdapter.h @@ -15,8 +15,6 @@ void Init(); void Shutdown(); void Input(int chan, GCPadStatus* pad); void Output(int chan, u8 rumble_command); -SIDevices GetDeviceType(int channel); -void RefreshConnectedDevices(); bool IsDetected(); bool IsDriverDetected();