summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-11-03 06:55:21 +0100
committerGitHub <noreply@github.com>2019-11-03 06:55:21 +0100
commitbec7e3b7d97afc4251421b18792444f6904931fb (patch)
tree71c2d63fa0ea63aa29033102ace5a2b91d15ed79
parentMerge pull request #3054 from FernandoS27/fix-tld4-2 (diff)
parentcitra_qt: add amiibo drag and drop support (diff)
downloadyuzu-bec7e3b7d97afc4251421b18792444f6904931fb.tar
yuzu-bec7e3b7d97afc4251421b18792444f6904931fb.tar.gz
yuzu-bec7e3b7d97afc4251421b18792444f6904931fb.tar.bz2
yuzu-bec7e3b7d97afc4251421b18792444f6904931fb.tar.lz
yuzu-bec7e3b7d97afc4251421b18792444f6904931fb.tar.xz
yuzu-bec7e3b7d97afc4251421b18792444f6904931fb.tar.zst
yuzu-bec7e3b7d97afc4251421b18792444f6904931fb.zip
-rw-r--r--src/yuzu/main.cpp21
-rw-r--r--src/yuzu/main.h1
2 files changed, 18 insertions, 4 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index d6bb18d24..160613ee1 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1839,6 +1839,10 @@ void GMainWindow::OnLoadAmiibo() {
return;
}
+ LoadAmiibo(filename);
+}
+
+void GMainWindow::LoadAmiibo(const QString& filename) {
Core::System& system{Core::System::GetInstance()};
Service::SM::ServiceManager& sm = system.ServiceManager();
auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
@@ -2189,10 +2193,19 @@ static bool IsSingleFileDropEvent(QDropEvent* event) {
}
void GMainWindow::dropEvent(QDropEvent* event) {
- if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) {
- const QMimeData* mimeData = event->mimeData();
- QString filename = mimeData->urls().at(0).toLocalFile();
- BootGame(filename);
+ if (!IsSingleFileDropEvent(event)) {
+ return;
+ }
+
+ const QMimeData* mime_data = event->mimeData();
+ const QString filename = mime_data->urls().at(0).toLocalFile();
+
+ if (emulation_running && QFileInfo(filename).suffix() == QStringLiteral("bin")) {
+ LoadAmiibo(filename);
+ } else {
+ if (ConfirmChangeGame()) {
+ BootGame(filename);
+ }
}
}
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index fd4b9ccf5..7f46bea2b 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -142,6 +142,7 @@ private:
void ShowTelemetryCallout();
void SetDiscordEnabled(bool state);
+ void LoadAmiibo(const QString& filename);
void SelectAndSetCurrentUser();