citra_qt: add amiibo drag and drop support
This commit is contained in:
parent
223bfc9a2a
commit
07eb89c6ee
2 changed files with 20 additions and 4 deletions
|
@ -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<Service::NFC::Module::Interface>("nfc:u");
|
||||
|
@ -1859,12 +1863,23 @@ 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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::dragEnterEvent(QDragEnterEvent* event) {
|
||||
if (IsSingleFileDropEvent(event)) {
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue