Skip to content
Permalink
Browse files

Replace magic disconnect channel number with a constant

  • Loading branch information
Pokechu22 committed Nov 10, 2019
1 parent 5477409 commit a23609562dde3fba5d39406d5eb2c2e470a8866d
@@ -63,6 +63,8 @@ enum class InitializeMode

// The Real Wii Remote sends report every ~5ms (200 Hz).
constexpr int UPDATE_FREQ = 200;
// Custom channel ID used in ControlChannel to indicate disconnects
constexpr int DOLPHIN_DISCONNET_CONTROL_CHANNEL = 99;

void Shutdown();
void Initialize(InitializeMode init_mode);
@@ -572,7 +572,7 @@ void Wiimote::SendDataReport()
void Wiimote::ControlChannel(const u16 channel_id, const void* data, u32 size)
{
// Check for custom communication
if (99 == channel_id)
if (channel_id == ::Wiimote::DOLPHIN_DISCONNET_CONTROL_CHANNEL)
{
// Wii Remote disconnected.
Reset();
@@ -143,7 +143,7 @@ void Wiimote::ClearReadQueue()
void Wiimote::ControlChannel(const u16 channel, const void* const data, const u32 size)
{
// Check for custom communication
if (channel == 99)
if (channel == ::Wiimote::DOLPHIN_DISCONNET_CONTROL_CHANNEL)
{
if (m_really_disconnect)
{
@@ -218,7 +218,8 @@ void WiimoteDevice::EventConnectionAccepted()
void WiimoteDevice::EventDisconnect()
{
// Send disconnect message to plugin
Wiimote::ControlChannel(m_connection_handle & 0xFF, 99, nullptr, 0);
Wiimote::ControlChannel(m_connection_handle & 0xFF, Wiimote::DOLPHIN_DISCONNET_CONTROL_CHANNEL,
nullptr, 0);

m_connection_state = ConnectionState::Inactive;

0 comments on commit a236095

Please sign in to comment.
You can’t perform that action at this time.