diff options
author | bunnei <bunneidev@gmail.com> | 2022-11-20 09:48:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-20 09:48:39 +0100 |
commit | 57a05b1653b316412492b7cf83738b702865b47e (patch) | |
tree | cb76a9aead5f545250301eb7928ecfb03e706931 /src/input_common | |
parent | Merge pull request #9249 from goldenx86/available-vram (diff) | |
parent | general: Address review comments (diff) | |
download | yuzu-57a05b1653b316412492b7cf83738b702865b47e.tar yuzu-57a05b1653b316412492b7cf83738b702865b47e.tar.gz yuzu-57a05b1653b316412492b7cf83738b702865b47e.tar.bz2 yuzu-57a05b1653b316412492b7cf83738b702865b47e.tar.lz yuzu-57a05b1653b316412492b7cf83738b702865b47e.tar.xz yuzu-57a05b1653b316412492b7cf83738b702865b47e.tar.zst yuzu-57a05b1653b316412492b7cf83738b702865b47e.zip |
Diffstat (limited to '')
-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..564a188e5 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() const { + 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..9baeb3997 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() const; + 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; |