diff options
author | Zephyron <zephyron@citron-emu.orgq> | 2025-02-28 16:15:10 +1000 |
---|---|---|
committer | Zephyron <zephyron@citron-emu.orgq> | 2025-02-28 16:15:10 +1000 |
commit | 84e5fbc0899bb838ae2c813edee30b32735f4a5f (patch) | |
tree | 82b19cd571cf314a50bf132d36821ac15c860e4c /src/core/crypto | |
parent | a442078ee4c257e8c013a6edeec72de2267eb9da (diff) |
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.
Diffstat (limited to 'src/core/crypto')
-rw-r--r-- | src/core/crypto/key_manager.cpp | 27 | ||||
-rw-r--r-- | src/core/crypto/key_manager.h | 3 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index e61a59fc9..eb5dd8cb1 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -1290,4 +1290,31 @@ bool KeyManager::AddTicket(const Ticket& ticket) { SetKey(S128KeyType::Titlekey, key.value(), rights_id[1], rights_id[0]); return true; } + +bool KeyManager::IsFirmwareAvailable() const { + // Check for essential keys that would only be present with firmware + if (!HasKey(S128KeyType::Master, 0)) { + return false; + } + + // Check for at least one titlekek + bool has_titlekek = false; + for (size_t i = 0; i < CURRENT_CRYPTO_REVISION; ++i) { + if (HasKey(S128KeyType::Titlekek, i)) { + has_titlekek = true; + break; + } + } + + if (!has_titlekek) { + return false; + } + + // Check for header key + if (!HasKey(S256KeyType::Header)) { + return false; + } + + return true; +} } // namespace Core::Crypto diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index 0adf3701f..2a5f0c093 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h @@ -296,6 +296,9 @@ public: void ReloadKeys(); bool AreKeysLoaded() const; + // Check if firmware is installed by verifying essential keys + bool IsFirmwareAvailable() const; + private: KeyManager(); |