From 84e5fbc0899bb838ae2c813edee30b32735f4a5f Mon Sep 17 00:00:00 2001 From: Zephyron Date: Fri, 28 Feb 2025 16:15:10 +1000 Subject: feat: Make firmware mandatory for title launching This commit implements a requirement for firmware to be installed before titles can be launched, similar to how keys are required. Changes include: - Add IsFirmwareAvailable method to KeyManager to check for essential keys - Add CheckFirmwarePresence method to verify actual firmware files (NCAs) - Add firmware checks in game loading process for both desktop and Android - Add error messages when firmware is missing - Add strings for firmware-related error messages The implementation checks for both essential keys and the presence of system applets like Mii Edit and Home Menu to ensure proper firmware is installed. Games will not launch if firmware is missing, and users will be shown an appropriate error message. --- src/core/file_sys/content_manager.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/core/file_sys/content_manager.cpp (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/content_manager.cpp b/src/core/file_sys/content_manager.cpp new file mode 100644 index 000000000..fd53978fc --- /dev/null +++ b/src/core/file_sys/content_manager.cpp @@ -0,0 +1,25 @@ +#include "core/system.h" +#include "core/file_sys/registered_cache.h" +#include "core/file_sys/content_archive.h" +#include "core/crypto/key_manager.h" + +bool ContentManager::IsFirmwareAvailable() { + constexpr u64 MiiEditId = 0x0100000000001009; // Mii Edit applet ID + constexpr u64 QLaunchId = 0x0100000000001000; // Home Menu applet ID + + auto& system = Core::System::GetInstance(); + auto bis_system = system.GetFileSystemController().GetSystemNANDContents(); + if (!bis_system) { + return false; + } + + auto mii_applet_nca = bis_system->GetEntry(MiiEditId, FileSys::ContentRecordType::Program); + auto qlaunch_nca = bis_system->GetEntry(QLaunchId, FileSys::ContentRecordType::Program); + + if (!mii_applet_nca || !qlaunch_nca) { + return false; + } + + // Also check for essential keys + return Core::Crypto::KeyManager::Instance().IsFirmwareAvailable(); +} \ No newline at end of file -- cgit v1.2.3