diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/crypto/key_manager.cpp | 10 | ||||
| -rw-r--r-- | src/core/crypto/key_manager.h | 7 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 678ac5752..45e7e8545 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp | |||
| @@ -66,8 +66,7 @@ KeyManager::KeyManager() { | |||
| 66 | AttemptLoadKeyFile(yuzu_keys_dir, hactool_keys_dir, "title.keys", true); | 66 | AttemptLoadKeyFile(yuzu_keys_dir, hactool_keys_dir, "title.keys", true); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | void KeyManager::LoadFromFile(std::string_view filename_, bool is_title_keys) { | 69 | void KeyManager::LoadFromFile(const std::string& filename, bool is_title_keys) { |
| 70 | const auto filename = std::string(filename_); | ||
| 71 | std::ifstream file(filename); | 70 | std::ifstream file(filename); |
| 72 | if (!file.is_open()) | 71 | if (!file.is_open()) |
| 73 | return; | 72 | return; |
| @@ -107,11 +106,8 @@ void KeyManager::LoadFromFile(std::string_view filename_, bool is_title_keys) { | |||
| 107 | } | 106 | } |
| 108 | } | 107 | } |
| 109 | 108 | ||
| 110 | void KeyManager::AttemptLoadKeyFile(std::string_view dir1_, std::string_view dir2_, | 109 | void KeyManager::AttemptLoadKeyFile(const std::string& dir1, const std::string& dir2, |
| 111 | std::string_view filename_, bool title) { | 110 | const std::string& filename, bool title) { |
| 112 | const std::string dir1(dir1_); | ||
| 113 | const std::string dir2(dir2_); | ||
| 114 | const std::string filename(filename_); | ||
| 115 | if (FileUtil::Exists(dir1 + DIR_SEP + filename)) | 111 | if (FileUtil::Exists(dir1 + DIR_SEP + filename)) |
| 116 | LoadFromFile(dir1 + DIR_SEP + filename, title); | 112 | LoadFromFile(dir1 + DIR_SEP + filename, title); |
| 117 | else if (FileUtil::Exists(dir2 + DIR_SEP + filename)) | 113 | else if (FileUtil::Exists(dir2 + DIR_SEP + filename)) |
diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index 03152a12c..c4c53cefc 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <string> | ||
| 8 | #include <type_traits> | 9 | #include <type_traits> |
| 9 | #include <unordered_map> | 10 | #include <unordered_map> |
| 10 | #include <vector> | 11 | #include <vector> |
| @@ -109,9 +110,9 @@ private: | |||
| 109 | std::unordered_map<KeyIndex<S256KeyType>, Key256> s256_keys; | 110 | std::unordered_map<KeyIndex<S256KeyType>, Key256> s256_keys; |
| 110 | 111 | ||
| 111 | bool dev_mode; | 112 | bool dev_mode; |
| 112 | void LoadFromFile(std::string_view filename, bool is_title_keys); | 113 | void LoadFromFile(const std::string& filename, bool is_title_keys); |
| 113 | void AttemptLoadKeyFile(std::string_view dir1, std::string_view dir2, std::string_view filename, | 114 | void AttemptLoadKeyFile(const std::string& dir1, const std::string& dir2, |
| 114 | bool title); | 115 | const std::string& filename, bool title); |
| 115 | 116 | ||
| 116 | static const std::unordered_map<std::string, KeyIndex<S128KeyType>> s128_file_id; | 117 | static const std::unordered_map<std::string, KeyIndex<S128KeyType>> s128_file_id; |
| 117 | static const std::unordered_map<std::string, KeyIndex<S256KeyType>> s256_file_id; | 118 | static const std::unordered_map<std::string, KeyIndex<S256KeyType>> s256_file_id; |