Moved the Mic button of the GCPad to its own group.

This is needed to separate it from the GCPad input configuration dialog as it would be moved to its own dialog.
This commit is contained in:
aldelaro5 2016-12-04 14:17:27 -05:00
parent d1c89db8c8
commit 431929fa1d
2 changed files with 11 additions and 6 deletions

View file

@ -24,8 +24,7 @@ static const u16 trigger_bitmasks[] = {
static const u16 dpad_bitmasks[] = {PAD_BUTTON_UP, PAD_BUTTON_DOWN, PAD_BUTTON_LEFT,
PAD_BUTTON_RIGHT};
static const char* const named_buttons[] = {"A", "B", "X", "Y", "Z", _trans("Start"),
_trans("Mic")};
static const char* const named_buttons[] = {"A", "B", "X", "Y", "Z", _trans("Start")};
static const char* const named_triggers[] = {
// i18n: The left trigger button (labeled L on real controllers)
@ -39,11 +38,9 @@ static const char* const named_triggers[] = {
GCPad::GCPad(const unsigned int index) : m_index(index)
{
int const mic_hax = index > 1;
// buttons
groups.emplace_back(m_buttons = new Buttons(_trans("Buttons")));
for (unsigned int i = 0; i < sizeof(named_buttons) / sizeof(*named_buttons) - mic_hax; ++i)
for (unsigned int i = 0; i < sizeof(named_buttons) / sizeof(*named_buttons); ++i)
m_buttons->controls.emplace_back(new ControlGroup::Input(named_buttons[i]));
// sticks
@ -61,6 +58,10 @@ GCPad::GCPad(const unsigned int index) : m_index(index)
groups.emplace_back(m_rumble = new ControlGroup(_trans("Rumble")));
m_rumble->controls.emplace_back(new ControlGroup::Output(_trans("Motor")));
// Microphone
groups.emplace_back(m_mic = new Buttons(_trans("Microphone")));
m_mic->controls.emplace_back(new ControlGroup::Input(_trans("Button")));
// dpad
groups.emplace_back(m_dpad = new Buttons(_trans("D-Pad")));
for (auto& named_direction : named_directions)
@ -95,6 +96,8 @@ ControllerEmu::ControlGroup* GCPad::GetGroup(PadGroup group)
return m_triggers;
case PadGroup::Rumble:
return m_rumble;
case PadGroup::Mic:
return m_mic;
case PadGroup::Options:
return m_options;
default:
@ -220,5 +223,5 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
bool GCPad::GetMicButton() const
{
auto lock = ControllerEmu::GetStateLock();
return (0.0f != m_buttons->controls.back()->control_ref->State());
return (0.0f != m_mic->controls.back()->control_ref->State());
}

View file

@ -18,6 +18,7 @@ enum class PadGroup
DPad,
Triggers,
Rumble,
Mic,
Options
};
@ -43,6 +44,7 @@ private:
Buttons* m_dpad;
MixedTriggers* m_triggers;
ControlGroup* m_rumble;
Buttons* m_mic;
ControlGroup* m_options;
const unsigned int m_index;