diff options
author | FearlessTobi <thm.frey@gmail.com> | 2019-11-02 19:22:36 +0100 |
---|---|---|
committer | FearlessTobi <thm.frey@gmail.com> | 2019-11-03 05:24:47 +0100 |
commit | 727ba2f2d05967cc5934c340587a9d4fd5ec550c (patch) | |
tree | 71c2d63fa0ea63aa29033102ace5a2b91d15ed79 /src/yuzu/main.cpp | |
parent | 11e39da02bec92fe4a332bfb737323ccb8087626 (diff) |
citra_qt: add amiibo drag and drop support
Co-Authored-By: Valentin Vanelslande <vvanelslandedev@gmail.com>
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index d6bb18d24a..160613ee15 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); + } } } |