mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-27 06:07:51 -05:00
GC Adapter Implementation
This commit is contained in:
@ -13,7 +13,8 @@ namespace InputCommon {
|
||||
class KeyButton final : public Input::ButtonDevice {
|
||||
public:
|
||||
explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_)
|
||||
: key_button_list(std::move(key_button_list_)) {}
|
||||
: key_button_list(std::move(key_button_list_)) {
|
||||
}
|
||||
|
||||
~KeyButton() override;
|
||||
|
||||
@ -49,8 +50,10 @@ public:
|
||||
void ChangeKeyStatus(int key_code, bool pressed) {
|
||||
std::lock_guard guard{mutex};
|
||||
for (const KeyButtonPair& pair : list) {
|
||||
if (pair.key_code == key_code)
|
||||
if (pair.key_code == key_code) {
|
||||
pair.key_button->status.store(pressed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +69,9 @@ private:
|
||||
std::list<KeyButtonPair> list;
|
||||
};
|
||||
|
||||
Keyboard::Keyboard() : key_button_list{std::make_shared<KeyButtonList>()} {}
|
||||
Keyboard::Keyboard()
|
||||
: key_button_list{std::make_shared<KeyButtonList>()} {
|
||||
}
|
||||
|
||||
KeyButton::~KeyButton() {
|
||||
key_button_list->RemoveKeyButton(this);
|
||||
@ -76,7 +81,7 @@ std::unique_ptr<Input::ButtonDevice> Keyboard::Create(const Common::ParamPackage
|
||||
int key_code = params.Get("code", 0);
|
||||
std::unique_ptr<KeyButton> button = std::make_unique<KeyButton>(key_button_list);
|
||||
key_button_list->AddKeyButton(key_code, button.get());
|
||||
return button;
|
||||
return std::move(button);
|
||||
}
|
||||
|
||||
void Keyboard::PressKey(int key_code) {
|
||||
|
Reference in New Issue
Block a user