mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Merge pull request #4948 from vvanelslande/amiibo-dad
citra_qt: add amiibo drag and drop support
This commit is contained in:
		
						commit
						35690e3ac7
					
				
					 2 changed files with 20 additions and 4 deletions
				
			
		|  | @ -1461,6 +1461,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::NFC::Module::Interface>("nfc:u"); |     auto nfc = sm.GetService<Service::NFC::Module::Interface>("nfc:u"); | ||||||
|  | @ -1857,12 +1861,23 @@ 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(); |     } | ||||||
|  | 
 | ||||||
|  |     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); |             BootGame(filename); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| void GMainWindow::dragEnterEvent(QDragEnterEvent* event) { | void GMainWindow::dragEnterEvent(QDragEnterEvent* event) { | ||||||
|     if (IsSingleFileDropEvent(event)) { |     if (IsSingleFileDropEvent(event)) { | ||||||
|  |  | ||||||
|  | @ -120,6 +120,7 @@ private: | ||||||
|     void ShowNoUpdatePrompt(); |     void ShowNoUpdatePrompt(); | ||||||
|     void CheckForUpdates(); |     void CheckForUpdates(); | ||||||
|     void SetDiscordEnabled(bool state); |     void SetDiscordEnabled(bool state); | ||||||
|  |     void LoadAmiibo(const QString& filename); | ||||||
| 
 | 
 | ||||||
|     /**
 |     /**
 | ||||||
|      * Stores the filename in the recently loaded files list. |      * Stores the filename in the recently loaded files list. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue