aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2022-02-07 21:39:39 -0600
committerNarr the Reg <juangerman-13@hotmail.com>2022-02-08 10:08:04 -0600
commit41b65d38fa57dcfefa9e944ef90c66bb5aa5d254 (patch)
tree8bbe3b47535f45a7e1ac6f45b435bd83c1123c6b /src/yuzu/main.cpp
parentfc9abd3c625c3eb8b7cc9445eef1291744ee52f6 (diff)
yuzu: Allow to open and remove the amiibo
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c788db12dc..3955276074 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -980,7 +980,7 @@ void GMainWindow::InitializeHotkeys() {
hotkey_registry.LoadHotkeys();
LinkActionShortcut(ui->action_Load_File, QStringLiteral("Load File"));
- LinkActionShortcut(ui->action_Load_Amiibo, QStringLiteral("Load Amiibo"));
+ LinkActionShortcut(ui->action_Load_Amiibo, QStringLiteral("Load/Remove Amiibo"));
LinkActionShortcut(ui->action_Exit, QStringLiteral("Exit yuzu"));
LinkActionShortcut(ui->action_Restart, QStringLiteral("Restart Emulation"));
LinkActionShortcut(ui->action_Pause, QStringLiteral("Continue/Pause Emulation"));
@@ -2912,6 +2912,25 @@ void GMainWindow::OnLoadAmiibo() {
return;
}
+ Service::SM::ServiceManager& sm = system->ServiceManager();
+ auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
+ if (nfc == nullptr) {
+ QMessageBox::warning(this, tr("Error"),
+ tr("The current game is not looking for amiibos"));
+ return;
+ }
+ const auto nfc_state = nfc->GetCurrentState();
+ if (nfc_state == Service::NFP::DeviceState::TagFound ||
+ nfc_state == Service::NFP::DeviceState::TagMounted) {
+ nfc->CloseAmiibo();
+ return;
+ }
+
+ if (nfc_state != Service::NFP::DeviceState::SearchingForTag) {
+ QMessageBox::warning(this, tr("Error"), tr("The current game is not looking for amiibos"));
+ return;
+ }
+
is_amiibo_file_select_active = true;
const QString extensions{QStringLiteral("*.bin")};
const QString file_filter = tr("Amiibo File (%1);; All Files (*.*)").arg(extensions);