From e0ff7d0a6ef9e901c7fed5c7fd4c293a0b010509 Mon Sep 17 00:00:00 2001 From: Levi Akatsuki Date: Mon, 18 Mar 2024 22:13:59 +0000 Subject: [PATCH 1/3] Fixed broken code in dev branch --- src/core/crypto/key_manager.cpp | 38 ++++++++++----------------------- src/core/crypto/key_manager.h | 2 +- src/suyu/main.cpp | 9 ++++---- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index d849ac43d7..e9896c7b6f 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -648,14 +648,14 @@ void KeyManager::ReloadKeys() { if (Settings::values.use_dev_keys) { dev_mode = true; - LoadFromFile(suyu_keys_dir / "dev.keys", 1); + LoadFromFile(suyu_keys_dir / "dev.keys", false); } else { dev_mode = false; - LoadFromFile(suyu_keys_dir / "prod.keys", 2); + LoadFromFile(suyu_keys_dir / "prod.keys", false); } - LoadFromFile(suyu_keys_dir / "title.keys", 3); - LoadFromFile(suyu_keys_dir / "console.keys", 4); + LoadFromFile(suyu_keys_dir / "title.keys", true); + LoadFromFile(suyu_keys_dir / "console.keys", false); } static bool ValidCryptoRevisionString(std::string_view base, size_t begin, size_t length) { @@ -666,26 +666,11 @@ static bool ValidCryptoRevisionString(std::string_view base, size_t begin, size_ [](u8 c) { return std::isxdigit(c); }); } -void KeyManager::LoadFromFile(const std::filesystem::path& file_path, int key_type) { +void KeyManager::LoadFromFile(const std::filesystem::path& file_path, bool is_title_keys) { if (!Common::FS::Exists(file_path)) { - switch (key_type) { - case 1: - LOG_ERROR(Crypto, "Issue with Development key file at '{}': File not found", - file_path.generic_string()); - return; - case 2: - LOG_ERROR(Crypto, "Issue with Production key file at '{}': File not found", - file_path.generic_string()); - return; - case 3: - LOG_INFO(Crypto, "Issue with Title key file at '{}': File not found", - file_path.generic_string()); - case 4: - LOG_INFO(Crypto, "Issue with Console key file at '{}': File not found", - file_path.generic_string()); - default: - LOG_ERROR(Crypto, "Unknown Key Type"); - } + LOG_ERROR(Crypto, "Cannot handle key file '{}': File not found", + file_path.generic_string()); + return; } std::ifstream file; @@ -718,7 +703,7 @@ void KeyManager::LoadFromFile(const std::filesystem::path& file_path, int key_ty continue; } - if (key_type == 3) { + if (is_title_keys) { auto rights_id_raw = Common::HexStringToArray<16>(out[0]); u128 rights_id{}; std::memcpy(rights_id.data(), rights_id_raw.data(), rights_id_raw.size()); @@ -818,8 +803,7 @@ bool KeyManager::BaseDeriveNecessary() const { } if (!Common::FS::Exists(suyu_keys_dir / "title.keys")) { - LOG_ERROR(Crypto, "No title.keys found"); - return true; + LOG_WARNING(Crypto, "Could not locate a title.keys file"); } if (check_key_existence(S256KeyType::Header)) { @@ -1322,4 +1306,4 @@ bool KeyManager::AddTicket(const Ticket& ticket) { SetKey(S128KeyType::Titlekey, key.value(), rights_id[1], rights_id[0]); return true; } -} // namespace Core::Crypto \ No newline at end of file +} // namespace Core::Crypto diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index 0d4cfe72af..005062345e 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h @@ -312,7 +312,7 @@ private: RSAKeyPair<2048> eticket_rsa_keypair{}; bool dev_mode; - void LoadFromFile(const std::filesystem::path& file_path, int key_type); + void LoadFromFile(const std::filesystem::path& file_path, bool is_title_keys); void DeriveGeneralPurposeKeys(std::size_t crypto_revision); diff --git a/src/suyu/main.cpp b/src/suyu/main.cpp index 92615564d9..0d07c8d6d0 100644 --- a/src/suyu/main.cpp +++ b/src/suyu/main.cpp @@ -1756,8 +1756,7 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa QMessageBox::warning(this, tr("Derivation Components Missing"), tr("Encryption keys are missing. " "In order to use this emulator" - "you need to provide your own prod.keys" - "Some games might also require your own title.keys as well" + "you need to provide your own encryption keys" "in order to play them.")); return false; } @@ -4631,9 +4630,9 @@ void GMainWindow::OnCheckFirmwareDecryption() { if (!ContentManager::AreKeysPresent()) { QMessageBox::warning(this, tr("Derivation Components Missing"), tr("Encryption keys are missing. " - "You need to provide both your own title.keys " - "and your own prod.keys " - "in order to play games")); + "In order to use this emulator" + "you need to provide your own encryption keys" + "in order to play them.")); } SetFirmwareVersion(); From 93dc7fb6b2bb1df8c6ee9fbb5d37b7727f77f762 Mon Sep 17 00:00:00 2001 From: Exverge Date: Mon, 18 Mar 2024 23:11:32 +0000 Subject: [PATCH 2/3] fix: Fixes compiling to non-Apple OSes on arm64 --- src/core/arm/nce/visitor_base.h | 2 ++ src/video_core/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/arm/nce/visitor_base.h b/src/core/arm/nce/visitor_base.h index 6a2be3d9bc..c885ac47f4 100644 --- a/src/core/arm/nce/visitor_base.h +++ b/src/core/arm/nce/visitor_base.h @@ -11,6 +11,8 @@ #include #include +#include "common/common_types.h" + #pragma GCC diagnostic pop namespace Core { diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index de28bf92ba..36affdf4f0 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -408,7 +408,7 @@ if (MSVC) /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data ) else() - if (APPLE) + if (APPLE OR ARCHITECTURE_arm64) # error: declaration shadows a typedef in 'interval_base_set' # error: implicit conversion loses integer precision: 'int' to 'boost::icl::bound_type' (aka 'unsigned char') target_compile_options(video_core PRIVATE -Wno-shadow -Wno-unused-local-typedef) From 460b6be75f25b974632c84fe511346f1c3d1dfab Mon Sep 17 00:00:00 2001 From: Alessio Date: Mon, 18 Mar 2024 23:23:57 +0000 Subject: [PATCH 3/3] Radeon gpu profiler detection support --- src/video_core/vulkan_common/vulkan_device.cpp | 1 + src/video_core/vulkan_common/vulkan_device.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 5d2e684441..fda4465a95 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -1364,6 +1364,7 @@ void Device::CollectToolingInfo() { LOG_INFO(Render_Vulkan, "Attached debugging tool: {}", name); has_renderdoc = has_renderdoc || name == "RenderDoc"; has_nsight_graphics = has_nsight_graphics || name == "NVIDIA Nsight Graphics"; + has_radeon_gpu_profiler = has_radeon_gpu_profiler || name == "Radeon GPU Profiler"; } } diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 25c2a9f406..79f62b9241 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h @@ -592,7 +592,7 @@ public: /// Returns true when a known debugging tool is attached. bool HasDebuggingToolAttached() const { - return has_renderdoc || has_nsight_graphics; + return has_renderdoc || has_nsight_graphics || has_radeon_gpu_profiler; } /// @returns True if compute pipelines can cause crashing. @@ -821,6 +821,7 @@ private: bool has_broken_parallel_compiling{}; ///< Has broken parallel shader compiling. bool has_renderdoc{}; ///< Has RenderDoc attached bool has_nsight_graphics{}; ///< Has Nsight Graphics attached + bool has_radeon_gpu_profiler{}; ///< Has Radeon GPU Profiler attached. bool supports_d24_depth{}; ///< Supports D24 depth buffers. bool cant_blit_msaa{}; ///< Does not support MSAA<->MSAA blitting. bool must_emulate_scaled_formats{}; ///< Requires scaled vertex format emulation