Merge pull request #7644 from jordan-woyak/dk-bongos-fix
HW: DK Bongos clap fix and cleanup
This commit is contained in:
commit
dd1fc70d70
|
@ -60,6 +60,18 @@ int CSIDevice_GCAdapter::RunBuffer(u8* buffer, int length)
|
||||||
return CSIDevice_GCController::RunBuffer(buffer, length);
|
return CSIDevice_GCController::RunBuffer(buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSIDevice_GCAdapter::GetData(u32& hi, u32& low)
|
||||||
|
{
|
||||||
|
CSIDevice_GCController::GetData(hi, low);
|
||||||
|
|
||||||
|
if (m_simulate_konga)
|
||||||
|
{
|
||||||
|
hi &= CSIDevice_TaruKonga::BUTTON_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CSIDevice_GCController::Rumble(int pad_num, ControlState strength)
|
void CSIDevice_GCController::Rumble(int pad_num, ControlState strength)
|
||||||
{
|
{
|
||||||
SIDevices device = SConfig::GetInstance().m_SIDevice[pad_num];
|
SIDevices device = SConfig::GetInstance().m_SIDevice[pad_num];
|
||||||
|
|
|
@ -17,5 +17,10 @@ public:
|
||||||
|
|
||||||
GCPadStatus GetPadStatus() override;
|
GCPadStatus GetPadStatus() override;
|
||||||
int RunBuffer(u8* buffer, int length) override;
|
int RunBuffer(u8* buffer, int length) override;
|
||||||
|
|
||||||
|
bool GetData(u32& hi, u32& low) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_simulate_konga{};
|
||||||
};
|
};
|
||||||
} // namespace SerialInterface
|
} // namespace SerialInterface
|
||||||
|
|
|
@ -231,12 +231,6 @@ bool CSIDevice_GCController::GetData(u32& hi, u32& low)
|
||||||
low |= pad_status.substickX << 24; // All 8 bits
|
low |= pad_status.substickX << 24; // All 8 bits
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unset all bits except those that represent
|
|
||||||
// A, B, X, Y, Start and the error bits, as they
|
|
||||||
// are not used.
|
|
||||||
if (m_simulate_konga)
|
|
||||||
hi &= ~0x20FFFFFF;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,4 +343,21 @@ void CSIDevice_GCController::DoState(PointerWrap& p)
|
||||||
p.Do(m_timer_button_combo);
|
p.Do(m_timer_button_combo);
|
||||||
p.Do(m_last_button_combo);
|
p.Do(m_last_button_combo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSIDevice_TaruKonga::CSIDevice_TaruKonga(SIDevices device, int device_number)
|
||||||
|
: CSIDevice_GCController(device, device_number)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSIDevice_TaruKonga::GetData(u32& hi, u32& low)
|
||||||
|
{
|
||||||
|
CSIDevice_GCController::GetData(hi, low);
|
||||||
|
|
||||||
|
// Unsets the first 16 bits (StickX/Y), PAD_USE_ORIGIN,
|
||||||
|
// and all buttons except: A, B, X, Y, Start, R
|
||||||
|
hi &= BUTTON_MASK;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace SerialInterface
|
} // namespace SerialInterface
|
||||||
|
|
|
@ -83,9 +83,6 @@ protected:
|
||||||
// Type of button combo from the last/current poll
|
// Type of button combo from the last/current poll
|
||||||
EButtonCombo m_last_button_combo = COMBO_NONE;
|
EButtonCombo m_last_button_combo = COMBO_NONE;
|
||||||
|
|
||||||
// Set this if we want to simulate the "TaruKonga" DK Bongo controller
|
|
||||||
bool m_simulate_konga = false;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
CSIDevice_GCController(SIDevices device, int device_number);
|
CSIDevice_GCController(SIDevices device, int device_number);
|
||||||
|
@ -122,10 +119,11 @@ protected:
|
||||||
class CSIDevice_TaruKonga : public CSIDevice_GCController
|
class CSIDevice_TaruKonga : public CSIDevice_GCController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSIDevice_TaruKonga(SIDevices device, int device_number)
|
CSIDevice_TaruKonga(SIDevices device, int device_number);
|
||||||
: CSIDevice_GCController(device, device_number)
|
|
||||||
{
|
bool GetData(u32& hi, u32& low) override;
|
||||||
m_simulate_konga = true;
|
|
||||||
}
|
static const u32 BUTTON_MASK = (PAD_BUTTON_A | PAD_BUTTON_B | PAD_BUTTON_X | PAD_BUTTON_Y |
|
||||||
|
PAD_BUTTON_START | PAD_TRIGGER_R);
|
||||||
};
|
};
|
||||||
} // namespace SerialInterface
|
} // namespace SerialInterface
|
||||||
|
|
Loading…
Reference in New Issue