Skip to content

Commit

Permalink
Merge pull request #4948 from vvanelslande/amiibo-dad
Browse files Browse the repository at this point in the history
citra_qt: add amiibo drag and drop support
  • Loading branch information
wwylele authored Oct 5, 2019
2 parents a7b18ef + 07eb89c commit 35690e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/citra_qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,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::NFC::Module::Interface>("nfc:u");
Expand Down Expand Up @@ -1857,10 +1861,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);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/citra_qt/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public slots:
void ShowNoUpdatePrompt();
void CheckForUpdates();
void SetDiscordEnabled(bool state);
void LoadAmiibo(const QString& filename);

/**
* Stores the filename in the recently loaded files list.
Expand Down

0 comments on commit 35690e3

Please sign in to comment.