diff options
Diffstat (limited to 'src')
24 files changed, 144 insertions, 37 deletions
diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index bf3434e1c..9269a73f2 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h | |||
| @@ -223,13 +223,16 @@ bool operator<(const KeyIndex<KeyType>& lhs, const KeyIndex<KeyType>& rhs) { | |||
| 223 | 223 | ||
| 224 | class KeyManager { | 224 | class KeyManager { |
| 225 | public: | 225 | public: |
| 226 | static KeyManager& instance() { | 226 | static KeyManager& Instance() { |
| 227 | static KeyManager instance; | 227 | static KeyManager instance; |
| 228 | return instance; | 228 | return instance; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | KeyManager(KeyManager const&) = delete; | 231 | KeyManager(const KeyManager&) = delete; |
| 232 | void operator=(KeyManager const&) = delete; | 232 | KeyManager& operator=(const KeyManager&) = delete; |
| 233 | |||
| 234 | KeyManager(KeyManager&&) = delete; | ||
| 235 | KeyManager& operator=(KeyManager&&) = delete; | ||
| 233 | 236 | ||
| 234 | bool HasKey(S128KeyType id, u64 field1 = 0, u64 field2 = 0) const; | 237 | bool HasKey(S128KeyType id, u64 field1 = 0, u64 field2 = 0) const; |
| 235 | bool HasKey(S256KeyType id, u64 field1 = 0, u64 field2 = 0) const; | 238 | bool HasKey(S256KeyType id, u64 field1 = 0, u64 field2 = 0) const; |
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp index 464ca6503..8935a62c3 100644 --- a/src/core/file_sys/bis_factory.cpp +++ b/src/core/file_sys/bis_factory.cpp | |||
| @@ -79,7 +79,7 @@ VirtualDir BISFactory::OpenPartition(BisPartitionId id) const { | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | VirtualFile BISFactory::OpenPartitionStorage(BisPartitionId id) const { | 81 | VirtualFile BISFactory::OpenPartitionStorage(BisPartitionId id) const { |
| 82 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 82 | auto& keys = Core::Crypto::KeyManager::Instance(); |
| 83 | Core::Crypto::PartitionDataManager pdm{ | 83 | Core::Crypto::PartitionDataManager pdm{ |
| 84 | Core::System::GetInstance().GetFilesystem()->OpenDirectory( | 84 | Core::System::GetInstance().GetFilesystem()->OpenDirectory( |
| 85 | FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir), Mode::Read)}; | 85 | FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir), Mode::Read)}; |
diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h index a09d504ae..e1b136426 100644 --- a/src/core/file_sys/card_image.h +++ b/src/core/file_sys/card_image.h | |||
| @@ -140,6 +140,6 @@ private: | |||
| 140 | 140 | ||
| 141 | u64 update_normal_partition_end; | 141 | u64 update_normal_partition_end; |
| 142 | 142 | ||
| 143 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 143 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); |
| 144 | }; | 144 | }; |
| 145 | } // namespace FileSys | 145 | } // namespace FileSys |
diff --git a/src/core/file_sys/content_archive.h b/src/core/file_sys/content_archive.h index e6c887b32..d25cbcf91 100644 --- a/src/core/file_sys/content_archive.h +++ b/src/core/file_sys/content_archive.h | |||
| @@ -158,7 +158,7 @@ private: | |||
| 158 | bool encrypted = false; | 158 | bool encrypted = false; |
| 159 | bool is_update = false; | 159 | bool is_update = false; |
| 160 | 160 | ||
| 161 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 161 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); |
| 162 | }; | 162 | }; |
| 163 | 163 | ||
| 164 | } // namespace FileSys | 164 | } // namespace FileSys |
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index 4b2fb08cb..f339cd17b 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h | |||
| @@ -88,7 +88,7 @@ public: | |||
| 88 | 88 | ||
| 89 | protected: | 89 | protected: |
| 90 | // A single instance of KeyManager to be used by GetEntry() | 90 | // A single instance of KeyManager to be used by GetEntry() |
| 91 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 91 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | class PlaceholderCache { | 94 | class PlaceholderCache { |
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index c35a0d10b..175a8266a 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | namespace FileSys { | 21 | namespace FileSys { |
| 22 | namespace { | 22 | namespace { |
| 23 | void SetTicketKeys(const std::vector<VirtualFile>& files) { | 23 | void SetTicketKeys(const std::vector<VirtualFile>& files) { |
| 24 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 24 | auto& keys = Core::Crypto::KeyManager::Instance(); |
| 25 | 25 | ||
| 26 | for (const auto& ticket_file : files) { | 26 | for (const auto& ticket_file : files) { |
| 27 | if (ticket_file == nullptr) { | 27 | if (ticket_file == nullptr) { |
diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h index bd577f6e5..cf89de6a9 100644 --- a/src/core/file_sys/submission_package.h +++ b/src/core/file_sys/submission_package.h | |||
| @@ -73,7 +73,7 @@ private: | |||
| 73 | std::map<u64, std::map<std::pair<TitleType, ContentRecordType>, std::shared_ptr<NCA>>> ncas; | 73 | std::map<u64, std::map<std::pair<TitleType, ContentRecordType>, std::shared_ptr<NCA>>> ncas; |
| 74 | std::vector<VirtualFile> ticket_files; | 74 | std::vector<VirtualFile> ticket_files; |
| 75 | 75 | ||
| 76 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 76 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); |
| 77 | 77 | ||
| 78 | VirtualFile romfs; | 78 | VirtualFile romfs; |
| 79 | VirtualDir exefs; | 79 | VirtualDir exefs; |
diff --git a/src/core/file_sys/xts_archive.h b/src/core/file_sys/xts_archive.h index 95da907bc..563531bb6 100644 --- a/src/core/file_sys/xts_archive.h +++ b/src/core/file_sys/xts_archive.h | |||
| @@ -62,6 +62,6 @@ private: | |||
| 62 | 62 | ||
| 63 | VirtualFile dec_file; | 63 | VirtualFile dec_file; |
| 64 | 64 | ||
| 65 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 65 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); |
| 66 | }; | 66 | }; |
| 67 | } // namespace FileSys | 67 | } // namespace FileSys |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 94d8c1fc6..8ac856ec3 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -776,6 +776,15 @@ void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) { | |||
| 776 | rb.Push(RESULT_SUCCESS); | 776 | rb.Push(RESULT_SUCCESS); |
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) { | ||
| 780 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | ||
| 781 | |||
| 782 | // TODO(ogniK): Handle open contexts | ||
| 783 | ctx.WriteBuffer(profile_manager->GetOpenUsers()); | ||
| 784 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 785 | rb.Push(RESULT_SUCCESS); | ||
| 786 | } | ||
| 787 | |||
| 779 | void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { | 788 | void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { |
| 780 | LOG_DEBUG(Service_ACC, "called"); | 789 | LOG_DEBUG(Service_ACC, "called"); |
| 781 | // A u8 is passed into this function which we can safely ignore. It's to determine if we have | 790 | // A u8 is passed into this function which we can safely ignore. It's to determine if we have |
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index 74ca39d6e..d4c6395c6 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h | |||
| @@ -34,6 +34,7 @@ public: | |||
| 34 | void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx); | 34 | void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx); |
| 35 | void GetProfileEditor(Kernel::HLERequestContext& ctx); | 35 | void GetProfileEditor(Kernel::HLERequestContext& ctx); |
| 36 | void ListQualifiedUsers(Kernel::HLERequestContext& ctx); | 36 | void ListQualifiedUsers(Kernel::HLERequestContext& ctx); |
| 37 | void ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx); | ||
| 37 | 38 | ||
| 38 | private: | 39 | private: |
| 39 | ResultCode InitializeApplicationInfoBase(); | 40 | ResultCode InitializeApplicationInfoBase(); |
diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp index 85620bde3..d2bb8c2c8 100644 --- a/src/core/hle/service/acc/acc_su.cpp +++ b/src/core/hle/service/acc/acc_su.cpp | |||
| @@ -20,7 +20,7 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p | |||
| 20 | {6, nullptr, "GetProfileDigest"}, // 3.0.0+ | 20 | {6, nullptr, "GetProfileDigest"}, // 3.0.0+ |
| 21 | {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, | 21 | {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, |
| 22 | {51, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, | 22 | {51, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, |
| 23 | {60, nullptr, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 | 23 | {60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 |
| 24 | {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ | 24 | {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ |
| 25 | {100, nullptr, "GetUserRegistrationNotifier"}, | 25 | {100, nullptr, "GetUserRegistrationNotifier"}, |
| 26 | {101, nullptr, "GetUserStateChangeNotifier"}, | 26 | {101, nullptr, "GetUserStateChangeNotifier"}, |
diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp index 49f6e20f1..cb44e06b7 100644 --- a/src/core/hle/service/acc/acc_u0.cpp +++ b/src/core/hle/service/acc/acc_u0.cpp | |||
| @@ -20,7 +20,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p | |||
| 20 | {6, nullptr, "GetProfileDigest"}, // 3.0.0+ | 20 | {6, nullptr, "GetProfileDigest"}, // 3.0.0+ |
| 21 | {50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, | 21 | {50, &ACC_U0::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, |
| 22 | {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, | 22 | {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, |
| 23 | {60, nullptr, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 | 23 | {60, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 |
| 24 | {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ | 24 | {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ |
| 25 | {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, | 25 | {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, |
| 26 | {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, | 26 | {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, |
| @@ -30,7 +30,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p | |||
| 30 | {111, nullptr, "ClearSaveDataThumbnail"}, | 30 | {111, nullptr, "ClearSaveDataThumbnail"}, |
| 31 | {120, nullptr, "CreateGuestLoginRequest"}, | 31 | {120, nullptr, "CreateGuestLoginRequest"}, |
| 32 | {130, nullptr, "LoadOpenContext"}, // 5.0.0+ | 32 | {130, nullptr, "LoadOpenContext"}, // 5.0.0+ |
| 33 | {131, nullptr, "ListOpenContextStoredUsers"}, // 6.0.0+ | 33 | {131, &ACC_U0::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 6.0.0+ |
| 34 | {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ | 34 | {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ |
| 35 | {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ | 35 | {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ |
| 36 | {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+ | 36 | {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+ |
diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp index f47004f84..a4aa5316a 100644 --- a/src/core/hle/service/acc/acc_u1.cpp +++ b/src/core/hle/service/acc/acc_u1.cpp | |||
| @@ -20,7 +20,7 @@ ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p | |||
| 20 | {6, nullptr, "GetProfileDigest"}, // 3.0.0+ | 20 | {6, nullptr, "GetProfileDigest"}, // 3.0.0+ |
| 21 | {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, | 21 | {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, |
| 22 | {51, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, | 22 | {51, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, |
| 23 | {60, nullptr, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 | 23 | {60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 |
| 24 | {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ | 24 | {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ |
| 25 | {100, nullptr, "GetUserRegistrationNotifier"}, | 25 | {100, nullptr, "GetUserRegistrationNotifier"}, |
| 26 | {101, nullptr, "GetUserStateChangeNotifier"}, | 26 | {101, nullptr, "GetUserStateChangeNotifier"}, |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 20f366635..1bb544dd8 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -841,7 +841,7 @@ public: | |||
| 841 | {110, nullptr, "NeedsToExitProcess"}, | 841 | {110, nullptr, "NeedsToExitProcess"}, |
| 842 | {120, nullptr, "GetLibraryAppletInfo"}, | 842 | {120, nullptr, "GetLibraryAppletInfo"}, |
| 843 | {150, nullptr, "RequestForAppletToGetForeground"}, | 843 | {150, nullptr, "RequestForAppletToGetForeground"}, |
| 844 | {160, nullptr, "GetIndirectLayerConsumerHandle"}, | 844 | {160, &ILibraryAppletAccessor::GetIndirectLayerConsumerHandle, "GetIndirectLayerConsumerHandle"}, |
| 845 | }; | 845 | }; |
| 846 | // clang-format on | 846 | // clang-format on |
| 847 | 847 | ||
| @@ -960,6 +960,18 @@ private: | |||
| 960 | rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()); | 960 | rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()); |
| 961 | } | 961 | } |
| 962 | 962 | ||
| 963 | void GetIndirectLayerConsumerHandle(Kernel::HLERequestContext& ctx) { | ||
| 964 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 965 | |||
| 966 | // We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is | ||
| 967 | // actually used anywhere | ||
| 968 | constexpr u64 handle = 0xdeadbeef; | ||
| 969 | |||
| 970 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 971 | rb.Push(RESULT_SUCCESS); | ||
| 972 | rb.Push(handle); | ||
| 973 | } | ||
| 974 | |||
| 963 | std::shared_ptr<Applets::Applet> applet; | 975 | std::shared_ptr<Applets::Applet> applet; |
| 964 | }; | 976 | }; |
| 965 | 977 | ||
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index da6b74a22..a41c73c48 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp | |||
| @@ -302,7 +302,7 @@ private: | |||
| 302 | rb.Push<u64>(write_size); | 302 | rb.Push<u64>(write_size); |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 305 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); |
| 306 | }; | 306 | }; |
| 307 | 307 | ||
| 308 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 308 | void InstallInterfaces(SM::ServiceManager& service_manager) { |
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index f3b4b286c..e5cfd2101 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <array> | ||
| 6 | #include <chrono> | 7 | #include <chrono> |
| 7 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 8 | #include "core/hle/ipc_helpers.h" | 9 | #include "core/hle/ipc_helpers.h" |
| @@ -31,6 +32,44 @@ constexpr std::array<LanguageCode, 17> available_language_codes = {{ | |||
| 31 | LanguageCode::ZH_HANT, | 32 | LanguageCode::ZH_HANT, |
| 32 | }}; | 33 | }}; |
| 33 | 34 | ||
| 35 | enum class KeyboardLayout : u64 { | ||
| 36 | Japanese = 0, | ||
| 37 | EnglishUs = 1, | ||
| 38 | EnglishUsInternational = 2, | ||
| 39 | EnglishUk = 3, | ||
| 40 | French = 4, | ||
| 41 | FrenchCa = 5, | ||
| 42 | Spanish = 6, | ||
| 43 | SpanishLatin = 7, | ||
| 44 | German = 8, | ||
| 45 | Italian = 9, | ||
| 46 | Portuguese = 10, | ||
| 47 | Russian = 11, | ||
| 48 | Korean = 12, | ||
| 49 | ChineseSimplified = 13, | ||
| 50 | ChineseTraditional = 14, | ||
| 51 | }; | ||
| 52 | |||
| 53 | constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 17> language_to_layout{{ | ||
| 54 | {LanguageCode::JA, KeyboardLayout::Japanese}, | ||
| 55 | {LanguageCode::EN_US, KeyboardLayout::EnglishUs}, | ||
| 56 | {LanguageCode::FR, KeyboardLayout::French}, | ||
| 57 | {LanguageCode::DE, KeyboardLayout::German}, | ||
| 58 | {LanguageCode::IT, KeyboardLayout::Italian}, | ||
| 59 | {LanguageCode::ES, KeyboardLayout::Spanish}, | ||
| 60 | {LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified}, | ||
| 61 | {LanguageCode::KO, KeyboardLayout::Korean}, | ||
| 62 | {LanguageCode::NL, KeyboardLayout::EnglishUsInternational}, | ||
| 63 | {LanguageCode::PT, KeyboardLayout::Portuguese}, | ||
| 64 | {LanguageCode::RU, KeyboardLayout::Russian}, | ||
| 65 | {LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional}, | ||
| 66 | {LanguageCode::EN_GB, KeyboardLayout::EnglishUk}, | ||
| 67 | {LanguageCode::FR_CA, KeyboardLayout::FrenchCa}, | ||
| 68 | {LanguageCode::ES_419, KeyboardLayout::SpanishLatin}, | ||
| 69 | {LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified}, | ||
| 70 | {LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional}, | ||
| 71 | }}; | ||
| 72 | |||
| 34 | constexpr std::size_t pre4_0_0_max_entries = 15; | 73 | constexpr std::size_t pre4_0_0_max_entries = 15; |
| 35 | constexpr std::size_t post4_0_0_max_entries = 17; | 74 | constexpr std::size_t post4_0_0_max_entries = 17; |
| 36 | 75 | ||
| @@ -50,6 +89,25 @@ void GetAvailableLanguageCodesImpl(Kernel::HLERequestContext& ctx, std::size_t m | |||
| 50 | ctx.WriteBuffer(available_language_codes.data(), copy_size); | 89 | ctx.WriteBuffer(available_language_codes.data(), copy_size); |
| 51 | PushResponseLanguageCode(ctx, copy_amount); | 90 | PushResponseLanguageCode(ctx, copy_amount); |
| 52 | } | 91 | } |
| 92 | |||
| 93 | void GetKeyCodeMapImpl(Kernel::HLERequestContext& ctx) { | ||
| 94 | const auto language_code = available_language_codes[Settings::values.language_index]; | ||
| 95 | const auto key_code = | ||
| 96 | std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), | ||
| 97 | [=](const auto& element) { return element.first == language_code; }); | ||
| 98 | KeyboardLayout layout = KeyboardLayout::EnglishUs; | ||
| 99 | if (key_code == language_to_layout.cend()) { | ||
| 100 | LOG_ERROR(Service_SET, | ||
| 101 | "Could not find keyboard layout for language index {}, defaulting to English us", | ||
| 102 | Settings::values.language_index); | ||
| 103 | } else { | ||
| 104 | layout = key_code->second; | ||
| 105 | } | ||
| 106 | |||
| 107 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 108 | rb.Push(RESULT_SUCCESS); | ||
| 109 | ctx.WriteBuffer(&layout, sizeof(KeyboardLayout)); | ||
| 110 | } | ||
| 53 | } // Anonymous namespace | 111 | } // Anonymous namespace |
| 54 | 112 | ||
| 55 | LanguageCode GetLanguageCodeFromIndex(std::size_t index) { | 113 | LanguageCode GetLanguageCodeFromIndex(std::size_t index) { |
| @@ -120,6 +178,16 @@ void SET::GetRegionCode(Kernel::HLERequestContext& ctx) { | |||
| 120 | rb.Push(Settings::values.region_index); | 178 | rb.Push(Settings::values.region_index); |
| 121 | } | 179 | } |
| 122 | 180 | ||
| 181 | void SET::GetKeyCodeMap(Kernel::HLERequestContext& ctx) { | ||
| 182 | LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); | ||
| 183 | GetKeyCodeMapImpl(ctx); | ||
| 184 | } | ||
| 185 | |||
| 186 | void SET::GetKeyCodeMap2(Kernel::HLERequestContext& ctx) { | ||
| 187 | LOG_DEBUG(Service_SET, "Called {}", ctx.Description()); | ||
| 188 | GetKeyCodeMapImpl(ctx); | ||
| 189 | } | ||
| 190 | |||
| 123 | SET::SET() : ServiceFramework("set") { | 191 | SET::SET() : ServiceFramework("set") { |
| 124 | // clang-format off | 192 | // clang-format off |
| 125 | static const FunctionInfo functions[] = { | 193 | static const FunctionInfo functions[] = { |
| @@ -130,9 +198,9 @@ SET::SET() : ServiceFramework("set") { | |||
| 130 | {4, &SET::GetRegionCode, "GetRegionCode"}, | 198 | {4, &SET::GetRegionCode, "GetRegionCode"}, |
| 131 | {5, &SET::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"}, | 199 | {5, &SET::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"}, |
| 132 | {6, &SET::GetAvailableLanguageCodeCount2, "GetAvailableLanguageCodeCount2"}, | 200 | {6, &SET::GetAvailableLanguageCodeCount2, "GetAvailableLanguageCodeCount2"}, |
| 133 | {7, nullptr, "GetKeyCodeMap"}, | 201 | {7, &SET::GetKeyCodeMap, "GetKeyCodeMap"}, |
| 134 | {8, &SET::GetQuestFlag, "GetQuestFlag"}, | 202 | {8, &SET::GetQuestFlag, "GetQuestFlag"}, |
| 135 | {9, nullptr, "GetKeyCodeMap2"}, | 203 | {9, &SET::GetKeyCodeMap2, "GetKeyCodeMap2"}, |
| 136 | {10, nullptr, "GetFirmwareVersionForDebug"}, | 204 | {10, nullptr, "GetFirmwareVersionForDebug"}, |
| 137 | }; | 205 | }; |
| 138 | // clang-format on | 206 | // clang-format on |
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h index 6084b345d..8ac9c169d 100644 --- a/src/core/hle/service/set/set.h +++ b/src/core/hle/service/set/set.h | |||
| @@ -44,6 +44,8 @@ private: | |||
| 44 | void GetAvailableLanguageCodeCount2(Kernel::HLERequestContext& ctx); | 44 | void GetAvailableLanguageCodeCount2(Kernel::HLERequestContext& ctx); |
| 45 | void GetQuestFlag(Kernel::HLERequestContext& ctx); | 45 | void GetQuestFlag(Kernel::HLERequestContext& ctx); |
| 46 | void GetRegionCode(Kernel::HLERequestContext& ctx); | 46 | void GetRegionCode(Kernel::HLERequestContext& ctx); |
| 47 | void GetKeyCodeMap(Kernel::HLERequestContext& ctx); | ||
| 48 | void GetKeyCodeMap2(Kernel::HLERequestContext& ctx); | ||
| 47 | }; | 49 | }; |
| 48 | 50 | ||
| 49 | } // namespace Service::Set | 51 | } // namespace Service::Set |
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index cf8bdd021..c6479af9f 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -322,8 +322,7 @@ protected: | |||
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | private: | 324 | private: |
| 325 | MapInterval* MapAddress(const Buffer* block, GPUVAddr gpu_addr, VAddr cpu_addr, | 325 | MapInterval* MapAddress(Buffer* block, GPUVAddr gpu_addr, VAddr cpu_addr, std::size_t size) { |
| 326 | std::size_t size) { | ||
| 327 | const VectorMapInterval overlaps = GetMapsInRange(cpu_addr, size); | 326 | const VectorMapInterval overlaps = GetMapsInRange(cpu_addr, size); |
| 328 | if (overlaps.empty()) { | 327 | if (overlaps.empty()) { |
| 329 | auto& memory_manager = system.GPU().MemoryManager(); | 328 | auto& memory_manager = system.GPU().MemoryManager(); |
| @@ -377,8 +376,7 @@ private: | |||
| 377 | return map; | 376 | return map; |
| 378 | } | 377 | } |
| 379 | 378 | ||
| 380 | void UpdateBlock(const Buffer* block, VAddr start, VAddr end, | 379 | void UpdateBlock(Buffer* block, VAddr start, VAddr end, const VectorMapInterval& overlaps) { |
| 381 | const VectorMapInterval& overlaps) { | ||
| 382 | const IntervalType base_interval{start, end}; | 380 | const IntervalType base_interval{start, end}; |
| 383 | IntervalSet interval_set{}; | 381 | IntervalSet interval_set{}; |
| 384 | interval_set.add(base_interval); | 382 | interval_set.add(base_interval); |
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index d9f7b4cc6..e461e4c70 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp | |||
| @@ -34,20 +34,27 @@ Buffer::Buffer(const Device& device, VAddr cpu_addr, std::size_t size) | |||
| 34 | 34 | ||
| 35 | Buffer::~Buffer() = default; | 35 | Buffer::~Buffer() = default; |
| 36 | 36 | ||
| 37 | void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) const { | 37 | void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) { |
| 38 | glNamedBufferSubData(Handle(), static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size), | 38 | glNamedBufferSubData(Handle(), static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size), |
| 39 | data); | 39 | data); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | void Buffer::Download(std::size_t offset, std::size_t size, u8* data) const { | 42 | void Buffer::Download(std::size_t offset, std::size_t size, u8* data) { |
| 43 | MICROPROFILE_SCOPE(OpenGL_Buffer_Download); | 43 | MICROPROFILE_SCOPE(OpenGL_Buffer_Download); |
| 44 | const GLsizeiptr gl_size = static_cast<GLsizeiptr>(size); | ||
| 45 | const GLintptr gl_offset = static_cast<GLintptr>(offset); | ||
| 46 | if (read_buffer.handle == 0) { | ||
| 47 | read_buffer.Create(); | ||
| 48 | glNamedBufferData(read_buffer.handle, static_cast<GLsizeiptr>(Size()), nullptr, | ||
| 49 | GL_STREAM_READ); | ||
| 50 | } | ||
| 44 | glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT); | 51 | glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT); |
| 45 | glGetNamedBufferSubData(Handle(), static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size), | 52 | glCopyNamedBufferSubData(gl_buffer.handle, read_buffer.handle, gl_offset, gl_offset, gl_size); |
| 46 | data); | 53 | glGetNamedBufferSubData(read_buffer.handle, gl_offset, gl_size, data); |
| 47 | } | 54 | } |
| 48 | 55 | ||
| 49 | void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, | 56 | void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, |
| 50 | std::size_t size) const { | 57 | std::size_t size) { |
| 51 | glCopyNamedBufferSubData(src.Handle(), Handle(), static_cast<GLintptr>(src_offset), | 58 | glCopyNamedBufferSubData(src.Handle(), Handle(), static_cast<GLintptr>(src_offset), |
| 52 | static_cast<GLintptr>(dst_offset), static_cast<GLsizeiptr>(size)); | 59 | static_cast<GLintptr>(dst_offset), static_cast<GLsizeiptr>(size)); |
| 53 | } | 60 | } |
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index 59d95adbc..88fdc0536 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h | |||
| @@ -28,12 +28,12 @@ public: | |||
| 28 | explicit Buffer(const Device& device, VAddr cpu_addr, std::size_t size); | 28 | explicit Buffer(const Device& device, VAddr cpu_addr, std::size_t size); |
| 29 | ~Buffer(); | 29 | ~Buffer(); |
| 30 | 30 | ||
| 31 | void Upload(std::size_t offset, std::size_t size, const u8* data) const; | 31 | void Upload(std::size_t offset, std::size_t size, const u8* data); |
| 32 | 32 | ||
| 33 | void Download(std::size_t offset, std::size_t size, u8* data) const; | 33 | void Download(std::size_t offset, std::size_t size, u8* data); |
| 34 | 34 | ||
| 35 | void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, | 35 | void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, |
| 36 | std::size_t size) const; | 36 | std::size_t size); |
| 37 | 37 | ||
| 38 | GLuint Handle() const noexcept { | 38 | GLuint Handle() const noexcept { |
| 39 | return gl_buffer.handle; | 39 | return gl_buffer.handle; |
| @@ -45,6 +45,7 @@ public: | |||
| 45 | 45 | ||
| 46 | private: | 46 | private: |
| 47 | OGLBuffer gl_buffer; | 47 | OGLBuffer gl_buffer; |
| 48 | OGLBuffer read_buffer; | ||
| 48 | u64 gpu_address = 0; | 49 | u64 gpu_address = 0; |
| 49 | }; | 50 | }; |
| 50 | 51 | ||
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 774e70a5b..fe9bd4b5a 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -191,6 +191,12 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { | |||
| 191 | } else { | 191 | } else { |
| 192 | return GL_MIRROR_CLAMP_TO_EDGE; | 192 | return GL_MIRROR_CLAMP_TO_EDGE; |
| 193 | } | 193 | } |
| 194 | case Tegra::Texture::WrapMode::MirrorOnceClampOGL: | ||
| 195 | if (GL_EXT_texture_mirror_clamp) { | ||
| 196 | return GL_MIRROR_CLAMP_EXT; | ||
| 197 | } else { | ||
| 198 | return GL_MIRROR_CLAMP_TO_EDGE; | ||
| 199 | } | ||
| 194 | } | 200 | } |
| 195 | UNIMPLEMENTED_MSG("Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode)); | 201 | UNIMPLEMENTED_MSG("Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode)); |
| 196 | return GL_REPEAT; | 202 | return GL_REPEAT; |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index f10f96cd8..2be38d419 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |||
| @@ -56,7 +56,7 @@ Buffer::Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKSchedu | |||
| 56 | 56 | ||
| 57 | Buffer::~Buffer() = default; | 57 | Buffer::~Buffer() = default; |
| 58 | 58 | ||
| 59 | void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) const { | 59 | void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) { |
| 60 | const auto& staging = staging_pool.GetUnusedBuffer(size, true); | 60 | const auto& staging = staging_pool.GetUnusedBuffer(size, true); |
| 61 | std::memcpy(staging.commit->Map(size), data, size); | 61 | std::memcpy(staging.commit->Map(size), data, size); |
| 62 | 62 | ||
| @@ -81,7 +81,7 @@ void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) const | |||
| 81 | }); | 81 | }); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | void Buffer::Download(std::size_t offset, std::size_t size, u8* data) const { | 84 | void Buffer::Download(std::size_t offset, std::size_t size, u8* data) { |
| 85 | const auto& staging = staging_pool.GetUnusedBuffer(size, true); | 85 | const auto& staging = staging_pool.GetUnusedBuffer(size, true); |
| 86 | scheduler.RequestOutsideRenderPassOperationContext(); | 86 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 87 | 87 | ||
| @@ -110,7 +110,7 @@ void Buffer::Download(std::size_t offset, std::size_t size, u8* data) const { | |||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, | 112 | void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, |
| 113 | std::size_t size) const { | 113 | std::size_t size) { |
| 114 | scheduler.RequestOutsideRenderPassOperationContext(); | 114 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 115 | 115 | ||
| 116 | const VkBuffer dst_buffer = Handle(); | 116 | const VkBuffer dst_buffer = Handle(); |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index 3630aca77..991ee451c 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -29,12 +29,12 @@ public: | |||
| 29 | VKStagingBufferPool& staging_pool, VAddr cpu_addr, std::size_t size); | 29 | VKStagingBufferPool& staging_pool, VAddr cpu_addr, std::size_t size); |
| 30 | ~Buffer(); | 30 | ~Buffer(); |
| 31 | 31 | ||
| 32 | void Upload(std::size_t offset, std::size_t size, const u8* data) const; | 32 | void Upload(std::size_t offset, std::size_t size, const u8* data); |
| 33 | 33 | ||
| 34 | void Download(std::size_t offset, std::size_t size, u8* data) const; | 34 | void Download(std::size_t offset, std::size_t size, u8* data); |
| 35 | 35 | ||
| 36 | void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, | 36 | void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, |
| 37 | std::size_t size) const; | 37 | std::size_t size); |
| 38 | 38 | ||
| 39 | VkBuffer Handle() const { | 39 | VkBuffer Handle() const { |
| 40 | return *buffer.handle; | 40 | return *buffer.handle; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f586950e7..fb299a39b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2226,7 +2226,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) { | |||
| 2226 | "title.keys_autogenerated"); | 2226 | "title.keys_autogenerated"); |
| 2227 | } | 2227 | } |
| 2228 | 2228 | ||
| 2229 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); | 2229 | Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); |
| 2230 | if (keys.BaseDeriveNecessary()) { | 2230 | if (keys.BaseDeriveNecessary()) { |
| 2231 | Core::Crypto::PartitionDataManager pdm{vfs->OpenDirectory( | 2231 | Core::Crypto::PartitionDataManager pdm{vfs->OpenDirectory( |
| 2232 | FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir), FileSys::Mode::Read)}; | 2232 | FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir), FileSys::Mode::Read)}; |