diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index f7da4b322d..50945eee91 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -41,7 +41,7 @@ namespace Core::Crypto { namespace { -constexpr u64 CURRENT_CRYPTO_REVISION = 0x15; +constexpr u64 CURRENT_CRYPTO_REVISION = 0x5; using Common::AsArray; diff --git a/src/frontend_common/firmware_manager.h b/src/frontend_common/firmware_manager.h index 5e02ad52f6..94469e9295 100644 --- a/src/frontend_common/firmware_manager.h +++ b/src/frontend_common/firmware_manager.h @@ -53,21 +53,12 @@ inline constexpr bool GameRequiresFirmware(u64 program_id) != FIRMWARE_REQUIRED_GAMES.end(); } - enum FirmwareCheckResult { FirmwareGood, ErrorFirmwareMissing, ErrorFirmwareCorrupted, }; -static constexpr std::array FIRMWARE_CHECK_STRINGS = { - "", - "Firmware missing. Firmware is required to run certain games and use the Home Menu. " - "Eden only works with firmware 19.0.1 and earlier.", - "Firmware reported as present, but was unable to be read. Check for decryption keys and " - "redump firmware if necessary." -}; - /** * \brief Checks for installed firmware within the system. * \param system The system to check for firmware. @@ -98,16 +89,6 @@ inline bool CheckFirmwarePresence(Core::System &system) */ FirmwareCheckResult VerifyFirmware(Core::System &system); -/** - * \brief Get a string representation of a result from CheckFirmwareVersion. - * \param result The result code. - * \return A string representation of the passed result code. - */ -inline constexpr const char *GetFirmwareCheckString(FirmwareCheckResult result) -{ - return FIRMWARE_CHECK_STRINGS.at(static_cast(result)); -} - /** * @brief Get the currently installed firmware version. * @param system The system to check firmware on. diff --git a/src/qt_common/qt_string_lookup.h b/src/qt_common/qt_string_lookup.h index b33bd044c2..94048e8d94 100644 --- a/src/qt_common/qt_string_lookup.h +++ b/src/qt_common/qt_string_lookup.h @@ -11,8 +11,8 @@ /// Small helper to look up enums. /// res = the result code /// base = the base matching value in the StringKey table -#define LOOKUP_ENUM(res, base) StringLookup::Lookup( \ - static_cast((int) res + (int) StringLookup::base)) +#define LOOKUP_ENUM(res, base) QtCommon::StringLookup::Lookup( \ + QtCommon::StringLookup::StringKey((int) res + (int) QtCommon::StringLookup::base)) namespace QtCommon::StringLookup { @@ -40,6 +40,10 @@ enum StringKey { FwInstallFailedCopy, FwInstallFailedCorrupted, + // Firmware Check results + FwCheckErrorFirmwareMissing, + FwCheckErrorFirmwareCorrupted, + // user data migrator MigrationPromptPrefix, MigrationPrompt, @@ -55,10 +59,11 @@ enum StringKey { KvdbMisaligned, KvdbNoImens, RyujinxNoSaveId, - }; -static const constexpr frozen::map strings = { +// NB: the constexpr check always succeeds (in clangd at least) if size arg < size +// always triple-check the size arg +static const constexpr frozen::map strings = { // 0-4 {SavesTooltip, QT_TR_NOOP("Contains game save data. DO NOT REMOVE UNLESS YOU KNOW WHAT YOU'RE DOING!")}, @@ -91,8 +96,17 @@ static const constexpr frozen::map strings = { "Firmware installation cancelled, firmware may be in a bad state or corrupted. Restart " "Eden or re-install firmware.")}, + {FwCheckErrorFirmwareMissing, + QT_TR_NOOP( + "Firmware missing. Firmware is required to run certain games and use the Home Menu. " + "Versions 19.0.1 or earlier are recommended, as 20.0.0+ is currently experimental.")}, + {FwCheckErrorFirmwareCorrupted, + QT_TR_NOOP( + "Firmware reported as present, but was unable to be read. Check for decryption keys and " + "redump firmware if necessary.")}, + // migrator - // 15-20 + // 17-22 {MigrationPromptPrefix, QT_TR_NOOP("Eden has detected user data for the following emulators:")}, {MigrationPrompt, QT_TR_NOOP("Would you like to migrate your data for use in Eden?\n" @@ -113,7 +127,7 @@ static const constexpr frozen::map strings = { "This is recommended if you want to share data between emulators.")}, // why am I writing these comments again - // 21-26 + // 23-28 {KvdbNonexistent, QT_TR_NOOP("Ryujinx title database does not exist.")}, {KvdbNoHeader, QT_TR_NOOP("Invalid header on Ryujinx title database.")}, {KvdbInvalidMagic, QT_TR_NOOP("Invalid magic header on Ryujinx title database.")}, diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index 01397241eb..a6e284856f 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Qt on macOS doesn't define VMA shit +#include "qt_common/qt_string_lookup.h" #if defined(QT_STATICPLUGIN) && !defined(__APPLE__) #undef VMA_IMPLEMENTATION #endif @@ -4058,14 +4059,16 @@ void MainWindow::OnOpenControllerMenu() { void MainWindow::OnHomeMenu() { auto result = FirmwareManager::VerifyFirmware(*QtCommon::system.get()); + using namespace QtCommon::StringLookup; + switch (result) { case FirmwareManager::ErrorFirmwareMissing: QMessageBox::warning(this, tr("No firmware available"), - tr("Please install firmware to use the Home Menu.")); + Lookup(FwCheckErrorFirmwareMissing)); return; case FirmwareManager::ErrorFirmwareCorrupted: QMessageBox::warning(this, tr("Firmware Corrupted"), - tr(FirmwareManager::GetFirmwareCheckString(result))); + Lookup(FwCheckErrorFirmwareCorrupted)); return; default: break;