From 15ca12c0ec644867b1e6b797a4ba02e4035c7a75 Mon Sep 17 00:00:00 2001
From: nullequal <nullequal@noreply.localhost>
Date: Sat, 23 Mar 2024 16:31:28 +0100
Subject: [PATCH] Allow NRO files to skip FW and keys' presence checks (#11)

doing an old suggestion from the now-deleted "emulator-suggestions" channel on the discord
Co-authored-by: nullequal <nullequal@noreply.localhost>
Co-committed-by: nullequal <nullequal@noreply.localhost>
---
 src/suyu/main.cpp | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/suyu/main.cpp b/src/suyu/main.cpp
index e7354e8fa5..b1a3211823 100644
--- a/src/suyu/main.cpp
+++ b/src/suyu/main.cpp
@@ -1747,18 +1747,21 @@ void GMainWindow::AllowOSSleep() {
 }
 
 bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletParameters params) {
-    if (!CheckFirmwarePresence()) {
-        QMessageBox::critical(this, tr("Component Missing"), tr("Missing Firmware."));
-        return false;
-    }
+    if (Loader::IdentifyType(Core::GetGameFileFromPath(vfs, filename.toStdString())) !=
+        Loader::FileType::NRO) {
+        if (!CheckFirmwarePresence()) {
+            QMessageBox::critical(this, tr("Component Missing"), tr("Missing Firmware."));
+            return false;
+        }
 
-    if (!ContentManager::AreKeysPresent()) {
-        QMessageBox::warning(this, tr("Derivation Components Missing"),
-                             tr("Encryption keys are missing. "
-                                "In order to use this emulator, "
-                                "you need to provide your own encryption keys "
-                                "in order to play them."));
-        return false;
+        if (!ContentManager::AreKeysPresent()) {
+            QMessageBox::warning(this, tr("Derivation Components Missing"),
+                                tr("Encryption keys are missing. "
+                                    "In order to use this emulator, "
+                                    "you need to provide your own encryption keys "
+                                    "in order to play them."));
+            return false;
+        }
     }
 
     // Shutdown previous session if the emu thread is still active...
-- 
GitLab