summaryrefslogtreecommitdiffstats
path: root/src/input_common/drivers/virtual_amiibo.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-10-02 23:28:43 +0200
committerGitHub <noreply@github.com>2022-10-02 23:28:43 +0200
commit61399de5dbc64ada1c9e5ec3d84be76c215fdc0c (patch)
tree72313f1b749d0771e38dbfcf539121a02d4b9ae0 /src/input_common/drivers/virtual_amiibo.h
parentMerge pull request #8992 from Morph1984/vi-vsync-event (diff)
parentservice: mii: Copy only valid name bytes (diff)
downloadyuzu-61399de5dbc64ada1c9e5ec3d84be76c215fdc0c.tar
yuzu-61399de5dbc64ada1c9e5ec3d84be76c215fdc0c.tar.gz
yuzu-61399de5dbc64ada1c9e5ec3d84be76c215fdc0c.tar.bz2
yuzu-61399de5dbc64ada1c9e5ec3d84be76c215fdc0c.tar.lz
yuzu-61399de5dbc64ada1c9e5ec3d84be76c215fdc0c.tar.xz
yuzu-61399de5dbc64ada1c9e5ec3d84be76c215fdc0c.tar.zst
yuzu-61399de5dbc64ada1c9e5ec3d84be76c215fdc0c.zip
Diffstat (limited to 'src/input_common/drivers/virtual_amiibo.h')
-rw-r--r--src/input_common/drivers/virtual_amiibo.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/input_common/drivers/virtual_amiibo.h b/src/input_common/drivers/virtual_amiibo.h
new file mode 100644
index 000000000..9eac07544
--- /dev/null
+++ b/src/input_common/drivers/virtual_amiibo.h
@@ -0,0 +1,61 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#pragma once
+
+#include <array>
+#include <string>
+#include <vector>
+
+#include "common/common_types.h"
+#include "input_common/input_engine.h"
+
+namespace Common::FS {
+class IOFile;
+}
+
+namespace InputCommon {
+
+class VirtualAmiibo final : public InputEngine {
+public:
+ enum class State {
+ Initialized,
+ WaitingForAmiibo,
+ AmiiboIsOpen,
+ };
+
+ enum class Info {
+ Success,
+ UnableToLoad,
+ NotAnAmiibo,
+ WrongDeviceState,
+ Unknown,
+ };
+
+ explicit VirtualAmiibo(std::string input_engine_);
+ ~VirtualAmiibo() override;
+
+ // Sets polling mode to a controller
+ Common::Input::PollingError SetPollingMode(
+ const PadIdentifier& identifier_, const Common::Input::PollingMode polling_mode_) override;
+
+ Common::Input::NfcState SupportsNfc(const PadIdentifier& identifier_) const override;
+
+ Common::Input::NfcState WriteNfcData(const PadIdentifier& identifier_,
+ const std::vector<u8>& data) override;
+
+ State GetCurrentState() const;
+
+ Info LoadAmiibo(const std::string& amiibo_file);
+ Info CloseAmiibo();
+
+private:
+ static constexpr std::size_t amiibo_size = 0x21C;
+ static constexpr std::size_t amiibo_size_without_password = amiibo_size - 0x8;
+
+ std::string file_path{};
+ State state{State::Initialized};
+ std::vector<u8> amiibo_data;
+ Common::Input::PollingMode polling_mode{Common::Input::PollingMode::Pasive};
+};
+} // namespace InputCommon