Added mic button to gcpad 1 and 2 diags. Both mic slots use gcpad 1 currently. Totally untested.
This commit is contained in:
parent
3790a16ece
commit
ceef98b882
|
@ -208,9 +208,7 @@ void CEXIMic::TransferByte(u8 &byte)
|
||||||
case cmdGetStatus:
|
case cmdGetStatus:
|
||||||
if (pos == 0)
|
if (pos == 0)
|
||||||
{
|
{
|
||||||
SPADStatus silly;
|
status.button = Pad::GetMicButton(0); // TODO: slot A/B -> 0/1
|
||||||
Pad::GetStatus(0, &silly);
|
|
||||||
status.button = !!(silly.button & PAD_BUTTON_A);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte = status.U8[pos ^ 1];
|
byte = status.U8[pos ^ 1];
|
||||||
|
|
|
@ -107,4 +107,15 @@ void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetMicButton(u8 pad)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::unique_lock<std::recursive_mutex> lk(g_plugin.controls_lock, std::try_to_lock);
|
||||||
|
|
||||||
|
if (!lk.owns_lock())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return ((GCPad*)g_plugin.controllers[pad])->GetMicButton();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ InputPlugin *GetPlugin();
|
||||||
void GetStatus(u8 _numPAD, SPADStatus* _pPADStatus);
|
void GetStatus(u8 _numPAD, SPADStatus* _pPADStatus);
|
||||||
void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength);
|
void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength);
|
||||||
|
|
||||||
|
bool GetMicButton(u8 pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,8 @@ const u16 button_bitmasks[] =
|
||||||
PAD_BUTTON_X,
|
PAD_BUTTON_X,
|
||||||
PAD_BUTTON_Y,
|
PAD_BUTTON_Y,
|
||||||
PAD_TRIGGER_Z,
|
PAD_TRIGGER_Z,
|
||||||
PAD_BUTTON_START
|
PAD_BUTTON_START,
|
||||||
|
0 // MIC HAX
|
||||||
};
|
};
|
||||||
|
|
||||||
const u16 trigger_bitmasks[] =
|
const u16 trigger_bitmasks[] =
|
||||||
|
@ -47,6 +48,7 @@ const char* const named_buttons[] =
|
||||||
"Y",
|
"Y",
|
||||||
"Z",
|
"Z",
|
||||||
_trans("Start"),
|
_trans("Start"),
|
||||||
|
"Mic"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* const named_triggers[] =
|
const char* const named_triggers[] =
|
||||||
|
@ -63,10 +65,11 @@ const char* const named_triggers[] =
|
||||||
|
|
||||||
GCPad::GCPad(const unsigned int index) : m_index(index)
|
GCPad::GCPad(const unsigned int index) : m_index(index)
|
||||||
{
|
{
|
||||||
|
int const mic_hax = index > 1;
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
groups.push_back(m_buttons = new Buttons(_trans("Buttons")));
|
groups.push_back(m_buttons = new Buttons(_trans("Buttons")));
|
||||||
for (unsigned int i=0; i < sizeof(named_buttons)/sizeof(*named_buttons); ++i)
|
for (unsigned int i=0; i < sizeof(named_buttons)/sizeof(*named_buttons) - mic_hax; ++i)
|
||||||
m_buttons->controls.push_back(new ControlGroup::Input(named_buttons[i]));
|
m_buttons->controls.push_back(new ControlGroup::Input(named_buttons[i]));
|
||||||
|
|
||||||
// sticks
|
// sticks
|
||||||
|
@ -203,3 +206,8 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
|
||||||
set_control(m_triggers, 0, "Q"); // L
|
set_control(m_triggers, 0, "Q"); // L
|
||||||
set_control(m_triggers, 1, "W"); // R
|
set_control(m_triggers, 1, "W"); // R
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GCPad::GetMicButton() const
|
||||||
|
{
|
||||||
|
return m_buttons->controls.back()->control_ref->State();
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ public:
|
||||||
void GetInput(SPADStatus* const pad);
|
void GetInput(SPADStatus* const pad);
|
||||||
void SetOutput(const bool on);
|
void SetOutput(const bool on);
|
||||||
|
|
||||||
|
bool GetMicButton() const;
|
||||||
|
|
||||||
std::string GetName() const;
|
std::string GetName() const;
|
||||||
|
|
||||||
void LoadDefaults(const ControllerInterface& ciface);
|
void LoadDefaults(const ControllerInterface& ciface);
|
||||||
|
|
Loading…
Reference in New Issue