diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2023-05-17 22:17:16 -0600 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2023-05-21 21:09:20 -0600 |
commit | fdb2002f77de6af19cc7f526b2e7540c329161c3 (patch) | |
tree | 6bcb2ca55810c05d15a561e2fa0bc0a6c1a9175a /src/input_common/helpers/joycon_driver.cpp | |
parent | 1e398e6c36bf8839ca530497fee3772f51d62126 (diff) |
input_common: Implement amiibo writting
Diffstat (limited to 'src/input_common/helpers/joycon_driver.cpp')
-rw-r--r-- | src/input_common/helpers/joycon_driver.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp index 83429a3368..95106f16d8 100644 --- a/src/input_common/helpers/joycon_driver.cpp +++ b/src/input_common/helpers/joycon_driver.cpp @@ -492,6 +492,26 @@ DriverResult JoyconDriver::SetRingConMode() { return result; } +DriverResult JoyconDriver::WriteNfcData(std::span<const u8> data) { + std::scoped_lock lock{mutex}; + disable_input_thread = true; + + if (!supported_features.nfc) { + return DriverResult::NotSupported; + } + if (!nfc_protocol->IsEnabled()) { + return DriverResult::Disabled; + } + if (!amiibo_detected) { + return DriverResult::ErrorWritingData; + } + + const auto result = nfc_protocol->WriteAmiibo(data); + + disable_input_thread = false; + return result; +} + bool JoyconDriver::IsConnected() const { std::scoped_lock lock{mutex}; return is_connected.load(); |