1
0
Fork 0
forked from suyu/suyu

Merge pull request #3058 from FearlessTobi/port-4948

Port citra-emu/citra#4948: "citra_qt: add amiibo drag and drop support"
This commit is contained in:
bunnei 2019-11-03 01:55:21 -04:00 committed by GitHub
commit bec7e3b7d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View file

@ -1839,6 +1839,10 @@ void GMainWindow::OnLoadAmiibo() {
return; return;
} }
LoadAmiibo(filename);
}
void GMainWindow::LoadAmiibo(const QString& filename) {
Core::System& system{Core::System::GetInstance()}; Core::System& system{Core::System::GetInstance()};
Service::SM::ServiceManager& sm = system.ServiceManager(); Service::SM::ServiceManager& sm = system.ServiceManager();
auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
@ -2189,10 +2193,19 @@ static bool IsSingleFileDropEvent(QDropEvent* event) {
} }
void GMainWindow::dropEvent(QDropEvent* event) { void GMainWindow::dropEvent(QDropEvent* event) {
if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) { if (!IsSingleFileDropEvent(event)) {
const QMimeData* mimeData = event->mimeData(); return;
QString filename = mimeData->urls().at(0).toLocalFile(); }
BootGame(filename);
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);
}
} }
} }

View file

@ -142,6 +142,7 @@ private:
void ShowTelemetryCallout(); void ShowTelemetryCallout();
void SetDiscordEnabled(bool state); void SetDiscordEnabled(bool state);
void LoadAmiibo(const QString& filename);
void SelectAndSetCurrentUser(); void SelectAndSetCurrentUser();