mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 23:59:27 +01:00
GCKeyboard: Return input state by value
This commit is contained in:
parent
ee43820282
commit
2be2b2a4f1
@ -47,12 +47,8 @@ void LoadConfig()
|
||||
s_config.LoadConfig(true);
|
||||
}
|
||||
|
||||
void GetStatus(u8 port, KeyboardStatus* keyboard_status)
|
||||
KeyboardStatus GetStatus(u8 port)
|
||||
{
|
||||
memset(keyboard_status, 0, sizeof(*keyboard_status));
|
||||
keyboard_status->err = PAD_ERR_NONE;
|
||||
|
||||
// Get input
|
||||
static_cast<GCKeyboard*>(s_config.GetController(port))->GetInput(keyboard_status);
|
||||
return static_cast<GCKeyboard*>(s_config.GetController(port))->GetInput();
|
||||
}
|
||||
}
|
||||
|
@ -17,5 +17,5 @@ void LoadConfig();
|
||||
|
||||
InputConfig* GetConfig();
|
||||
|
||||
void GetStatus(u8 port, KeyboardStatus* keyboard_status);
|
||||
KeyboardStatus GetStatus(u8 port);
|
||||
}
|
||||
|
@ -84,15 +84,20 @@ std::string GCKeyboard::GetName() const
|
||||
return std::string("GCKeyboard") + char('1' + m_index);
|
||||
}
|
||||
|
||||
void GCKeyboard::GetInput(KeyboardStatus* const kb)
|
||||
KeyboardStatus GCKeyboard::GetInput() const
|
||||
{
|
||||
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);
|
||||
m_keys3x->GetState(&kb->key3x, keys3_bitmasks);
|
||||
m_keys4x->GetState(&kb->key4x, keys4_bitmasks);
|
||||
m_keys5x->GetState(&kb->key5x, keys5_bitmasks);
|
||||
|
||||
KeyboardStatus kb = {};
|
||||
|
||||
m_keys0x->GetState(&kb.key0x, keys0_bitmasks);
|
||||
m_keys1x->GetState(&kb.key1x, keys1_bitmasks);
|
||||
m_keys2x->GetState(&kb.key2x, keys2_bitmasks);
|
||||
m_keys3x->GetState(&kb.key3x, keys3_bitmasks);
|
||||
m_keys4x->GetState(&kb.key4x, keys4_bitmasks);
|
||||
m_keys5x->GetState(&kb.key5x, keys5_bitmasks);
|
||||
|
||||
return kb;
|
||||
}
|
||||
|
||||
void GCKeyboard::LoadDefaults(const ControllerInterface& ciface)
|
||||
|
@ -14,7 +14,7 @@ class GCKeyboard : public ControllerEmu
|
||||
{
|
||||
public:
|
||||
GCKeyboard(const unsigned int index);
|
||||
void GetInput(KeyboardStatus* const pad);
|
||||
KeyboardStatus GetInput() const;
|
||||
std::string GetName() const override;
|
||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||
|
||||
|
@ -56,9 +56,7 @@ int CSIDevice_Keyboard::RunBuffer(u8* _pBuffer, int _iLength)
|
||||
|
||||
KeyboardStatus CSIDevice_Keyboard::GetKeyboardStatus() const
|
||||
{
|
||||
KeyboardStatus KeyStatus = {};
|
||||
Keyboard::GetStatus(ISIDevice::m_iDeviceNumber, &KeyStatus);
|
||||
return KeyStatus;
|
||||
return Keyboard::GetStatus(m_iDeviceNumber);
|
||||
}
|
||||
|
||||
bool CSIDevice_Keyboard::GetData(u32& _Hi, u32& _Low)
|
||||
|
Loading…
x
Reference in New Issue
Block a user