Skip to content

Commit

Permalink
Removed redundant code from the GC Adapter interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
skidau committed Dec 19, 2014
1 parent 9eecfca commit f913cb6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 48 deletions.
46 changes: 0 additions & 46 deletions Source/Core/Core/HW/SI_GCAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/HW/SI_GCAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit f913cb6

Please sign in to comment.