3
0
Fork 0
forked from suyu/suyu

input_common: Add amiibo applet functions

This commit is contained in:
german77 2022-11-13 10:56:01 -06:00
parent 6c045c9beb
commit b193d40d22
3 changed files with 19 additions and 1 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;