From 07eb89c6ee59d7faef1ee6f02508851c20b9cef0 Mon Sep 17 00:00:00 2001 From: vvanelslande Date: Sat, 21 Sep 2019 17:02:42 -0500 Subject: [PATCH] citra_qt: add amiibo drag and drop support --- src/citra_qt/main.cpp | 23 +++++++++++++++++++---- src/citra_qt/main.h | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 599420fae..49365f2c7 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1463,6 +1463,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("nfc:u"); @@ -1859,10 +1863,21 @@ 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() == "bin") { + // Amiibo + LoadAmiibo(filename); + } else { + // Game + if (ConfirmChangeGame()) { + BootGame(filename); + } } } diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 3ff40f976..870ed40ff 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -120,6 +120,7 @@ private: void ShowNoUpdatePrompt(); void CheckForUpdates(); void SetDiscordEnabled(bool state); + void LoadAmiibo(const QString& filename); /** * Stores the filename in the recently loaded files list.