mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 07:39:45 -06:00
ControllerInterface: Add RemoveDevice()
This adds RemoveDevice() to ControllerInterface, fixes ExpressionParser and some other code to support device removals without crashing, and adds an IsValid() method to Device, to prepare for hotplugging.
This commit is contained in:
@ -86,6 +86,7 @@ std::string GCKeyboard::GetName() const
|
||||
|
||||
void GCKeyboard::GetInput(KeyboardStatus* const kb)
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
m_keys0x->GetState(&kb->key0x, keys0_bitmasks);
|
||||
m_keys1x->GetState(&kb->key1x, keys1_bitmasks);
|
||||
m_keys2x->GetState(&kb->key2x, keys2_bitmasks);
|
||||
|
@ -81,6 +81,8 @@ std::string GCPad::GetName() const
|
||||
|
||||
void GCPad::GetInput(GCPadStatus* const pad)
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
|
||||
ControlState x, y, triggers[2];
|
||||
|
||||
// buttons
|
||||
@ -116,6 +118,7 @@ void GCPad::GetInput(GCPadStatus* const pad)
|
||||
|
||||
void GCPad::SetOutput(const ControlState strength)
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
m_rumble->controls[0]->control_ref->State(strength);
|
||||
}
|
||||
|
||||
@ -190,5 +193,6 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
|
||||
|
||||
bool GCPad::GetMicButton() const
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
return (0.0f != m_buttons->controls.back()->control_ref->State());
|
||||
}
|
||||
|
@ -623,8 +623,11 @@ void Wiimote::Update()
|
||||
return;
|
||||
|
||||
// returns true if a report was sent
|
||||
if (Step())
|
||||
return;
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
if (Step())
|
||||
return;
|
||||
}
|
||||
|
||||
u8 data[MAX_PAYLOAD];
|
||||
memset(data, 0, sizeof(data));
|
||||
@ -646,6 +649,8 @@ void Wiimote::Update()
|
||||
data[0] = 0xA1;
|
||||
data[1] = m_reporting_mode;
|
||||
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
|
||||
// core buttons
|
||||
if (rptf.core)
|
||||
GetButtonData(data + rptf.core);
|
||||
@ -876,6 +881,7 @@ void Wiimote::ConnectOnInput()
|
||||
}
|
||||
|
||||
u16 buttons = 0;
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
m_buttons->GetState(&buttons, button_bitmasks);
|
||||
m_dpad->GetState(&buttons, dpad_bitmasks);
|
||||
|
||||
|
@ -240,6 +240,7 @@ std::string HotkeyManager::GetName() const
|
||||
|
||||
void HotkeyManager::GetInput(HotkeyStatus* const kb)
|
||||
{
|
||||
auto lock = ControllerEmu::GetStateLock();
|
||||
for (int set = 0; set < (NUM_HOTKEYS + 31) / 32; set++)
|
||||
{
|
||||
std::vector<u32> bitmasks;
|
||||
|
Reference in New Issue
Block a user