summaryrefslogtreecommitdiffstats
path: root/src/input_common
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2022-11-13 17:56:01 +0100
committergerman77 <juangerman-13@hotmail.com>2022-11-13 17:56:54 +0100
commitb193d40d2275fc59600268e2622ae25aab2bba64 (patch)
tree8c075b5a5806dbf3650bf96b9a53c2a6f8057544 /src/input_common
parentservice: nfc: fix tagprotocol and implement GetApplicationAreaId (diff)
downloadyuzu-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
Diffstat (limited to 'src/input_common')
-rw-r--r--src/input_common/drivers/virtual_amiibo.cpp15
-rw-r--r--src/input_common/drivers/virtual_amiibo.h3
-rw-r--r--src/input_common/input_engine.h2
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;