diff options
author | german77 <juangerman-13@hotmail.com> | 2022-11-13 17:56:01 +0100 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2022-11-13 17:56:54 +0100 |
commit | b193d40d2275fc59600268e2622ae25aab2bba64 (patch) | |
tree | 8c075b5a5806dbf3650bf96b9a53c2a6f8057544 | |
parent | service: nfc: fix tagprotocol and implement GetApplicationAreaId (diff) | |
download | yuzu-b193d40d2275fc59600268e2622ae25aab2bba64.tar yuzu-b193d40d2275fc59600268e2622ae25aab2bba64.tar.gz yuzu-b193d40d2275fc59600268e2622ae25aab2bba64.tar.bz2 yuzu-b193d40d2275fc59600268e2622ae25aab2bba64.tar.lz yuzu-b193d40d2275fc59600268e2622ae25aab2bba64.tar.xz yuzu-b193d40d2275fc59600268e2622ae25aab2bba64.tar.zst yuzu-b193d40d2275fc59600268e2622ae25aab2bba64.zip |
-rw-r--r-- | src/input_common/drivers/virtual_amiibo.cpp | 15 | ||||
-rw-r--r-- | src/input_common/drivers/virtual_amiibo.h | 3 | ||||
-rw-r--r-- | src/input_common/input_engine.h | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/input_common/drivers/virtual_amiibo.cpp b/src/input_common/drivers/virtual_amiibo.cpp index 0cd5129da..252c660d8 100644 --- a/src/input_common/drivers/virtual_amiibo.cpp +++ b/src/input_common/drivers/virtual_amiibo.cpp @@ -60,6 +60,8 @@ Common::Input::NfcState VirtualAmiibo::WriteNfcData( return Common::Input::NfcState::WriteFailed; } + amiibo_data = data; + return Common::Input::NfcState::Success; } @@ -91,6 +93,15 @@ VirtualAmiibo::Info VirtualAmiibo::LoadAmiibo(const std::string& filename) { return Info::Success; } +VirtualAmiibo::Info VirtualAmiibo::ReloadAmiibo() { + if (state == State::AmiiboIsOpen) { + SetNfc(identifier, {Common::Input::NfcState::NewAmiibo, amiibo_data}); + return Info::Success; + } + + return LoadAmiibo(file_path); +} + VirtualAmiibo::Info VirtualAmiibo::CloseAmiibo() { state = polling_mode == Common::Input::PollingMode::NFC ? State::WaitingForAmiibo : State::Initialized; @@ -98,4 +109,8 @@ VirtualAmiibo::Info VirtualAmiibo::CloseAmiibo() { return Info::Success; } +std::string VirtualAmiibo::GetLastFilePath() { + return file_path; +} + } // namespace InputCommon diff --git a/src/input_common/drivers/virtual_amiibo.h b/src/input_common/drivers/virtual_amiibo.h index 9eac07544..f2294b8b0 100644 --- a/src/input_common/drivers/virtual_amiibo.h +++ b/src/input_common/drivers/virtual_amiibo.h @@ -47,8 +47,11 @@ public: State GetCurrentState() const; Info LoadAmiibo(const std::string& amiibo_file); + Info ReloadAmiibo(); Info CloseAmiibo(); + std::string GetLastFilePath(); + private: static constexpr std::size_t amiibo_size = 0x21C; static constexpr std::size_t amiibo_size_without_password = amiibo_size - 0x8; diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index d4c264a8e..6cbcf5207 100644 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h @@ -133,7 +133,7 @@ public: return Common::Input::CameraError::NotSupported; } - // Request nfc data from a controller + // Returns success if nfc is supported virtual Common::Input::NfcState SupportsNfc( [[maybe_unused]] const PadIdentifier& identifier) const { return Common::Input::NfcState::NotSupported; |