summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/alignment.h4
-rw-r--r--src/core/crypto/key_manager.cpp12
-rw-r--r--src/core/file_sys/vfs_real.cpp27
-rw-r--r--src/core/hle/service/am/am.cpp14
-rw-r--r--src/core/hle/service/nim/nim.cpp88
-rw-r--r--src/core/hle/service/npns/npns.cpp1
-rw-r--r--src/core/hle/service/ns/ns.cpp22
-rw-r--r--src/core/hle/service/ns/ns.h6
-rw-r--r--src/core/hle/service/ns/pl_u.cpp2
-rw-r--r--src/core/hle/service/nvdrv/interface.cpp11
-rw-r--r--src/core/hle/service/nvdrv/interface.h4
-rw-r--r--src/core/hle/service/nvdrv/nvmemp.cpp8
-rw-r--r--src/core/hle/service/nvdrv/nvmemp.h4
-rw-r--r--src/core/hle/service/pcie/pcie.cpp3
-rw-r--r--src/core/hle/service/pcv/pcv.cpp3
-rw-r--r--src/core/hle/service/pm/pm.cpp34
-rw-r--r--src/core/hle/service/prepo/prepo.cpp5
-rw-r--r--src/core/hle/service/psc/psc.cpp2
-rw-r--r--src/core/hle/service/ptm/psm.cpp1
-rw-r--r--src/core/hle/service/sm/controller.cpp21
-rw-r--r--src/core/hle/service/sm/controller.h6
-rw-r--r--src/core/hle/service/sockets/nsd.cpp6
-rw-r--r--src/core/hle/service/sockets/sfdnsres.cpp25
-rw-r--r--src/core/hle/service/sockets/sfdnsres.h2
-rw-r--r--src/core/hle/service/spl/spl.cpp39
-rw-r--r--src/core/hle/service/time/time.cpp7
-rw-r--r--src/core/hle/service/usb/usb.cpp31
-rw-r--r--src/core/hle/service/vi/vi.cpp2
-rw-r--r--src/core/hle/service/vi/vi_u.cpp1
-rw-r--r--src/core/hle/service/wlan/wlan.cpp102
-rw-r--r--src/input_common/CMakeLists.txt3
-rw-r--r--src/input_common/gcadapter/gc_adapter.cpp1
-rw-r--r--src/input_common/gcadapter/gc_adapter.h5
-rw-r--r--src/input_common/main.cpp1
-rw-r--r--src/input_common/udp/client.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp12
-rw-r--r--src/yuzu/CMakeLists.txt6
-rw-r--r--src/yuzu/configuration/configure_general.cpp2
-rw-r--r--src/yuzu/game_list.cpp4
-rw-r--r--src/yuzu/install_dialog.cpp72
-rw-r--r--src/yuzu/install_dialog.h36
-rw-r--r--src/yuzu/main.cpp358
-rw-r--r--src/yuzu/main.h15
-rw-r--r--src/yuzu/main.ui2
44 files changed, 684 insertions, 328 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index f8c49e079..b37044bb6 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -11,7 +11,9 @@ namespace Common {
11template <typename T> 11template <typename T>
12constexpr T AlignUp(T value, std::size_t size) { 12constexpr T AlignUp(T value, std::size_t size) {
13 static_assert(std::is_unsigned_v<T>, "T must be an unsigned value."); 13 static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
14 return static_cast<T>(value + (size - value % size) % size); 14 auto mod{static_cast<T>(value % size)};
15 value -= mod;
16 return static_cast<T>(mod == T{0} ? value : value + size);
15} 17}
16 18
17template <typename T> 19template <typename T>
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index 8997c7082..f87fe0abc 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -695,8 +695,9 @@ void KeyManager::WriteKeyToFile(KeyCategory category, std::string_view keyname,
695} 695}
696 696
697void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) { 697void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) {
698 if (s128_keys.find({id, field1, field2}) != s128_keys.end()) 698 if (s128_keys.find({id, field1, field2}) != s128_keys.end() || key == Key128{}) {
699 return; 699 return;
700 }
700 if (id == S128KeyType::Titlekey) { 701 if (id == S128KeyType::Titlekey) {
701 Key128 rights_id; 702 Key128 rights_id;
702 std::memcpy(rights_id.data(), &field2, sizeof(u64)); 703 std::memcpy(rights_id.data(), &field2, sizeof(u64));
@@ -716,8 +717,9 @@ void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) {
716 return std::tie(elem.second.type, elem.second.field1, elem.second.field2) == 717 return std::tie(elem.second.type, elem.second.field1, elem.second.field2) ==
717 std::tie(id, field1, field2); 718 std::tie(id, field1, field2);
718 }); 719 });
719 if (iter2 != s128_file_id.end()) 720 if (iter2 != s128_file_id.end()) {
720 WriteKeyToFile(category, iter2->first, key); 721 WriteKeyToFile(category, iter2->first, key);
722 }
721 723
722 // Variable cases 724 // Variable cases
723 if (id == S128KeyType::KeyArea) { 725 if (id == S128KeyType::KeyArea) {
@@ -745,16 +747,18 @@ void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) {
745} 747}
746 748
747void KeyManager::SetKey(S256KeyType id, Key256 key, u64 field1, u64 field2) { 749void KeyManager::SetKey(S256KeyType id, Key256 key, u64 field1, u64 field2) {
748 if (s256_keys.find({id, field1, field2}) != s256_keys.end()) 750 if (s256_keys.find({id, field1, field2}) != s256_keys.end() || key == Key256{}) {
749 return; 751 return;
752 }
750 const auto iter = std::find_if( 753 const auto iter = std::find_if(
751 s256_file_id.begin(), s256_file_id.end(), 754 s256_file_id.begin(), s256_file_id.end(),
752 [&id, &field1, &field2](const std::pair<std::string, KeyIndex<S256KeyType>> elem) { 755 [&id, &field1, &field2](const std::pair<std::string, KeyIndex<S256KeyType>> elem) {
753 return std::tie(elem.second.type, elem.second.field1, elem.second.field2) == 756 return std::tie(elem.second.type, elem.second.field1, elem.second.field2) ==
754 std::tie(id, field1, field2); 757 std::tie(id, field1, field2);
755 }); 758 });
756 if (iter != s256_file_id.end()) 759 if (iter != s256_file_id.end()) {
757 WriteKeyToFile(KeyCategory::Standard, iter->first, key); 760 WriteKeyToFile(KeyCategory::Standard, iter->first, key);
761 }
758 s256_keys[{id, field1, field2}] = key; 762 s256_keys[{id, field1, field2}] = key;
759} 763}
760 764
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index e21300a7c..96ce5957c 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -112,19 +112,26 @@ VirtualFile RealVfsFilesystem::MoveFile(std::string_view old_path_, std::string_
112 const auto new_path = 112 const auto new_path =
113 FileUtil::SanitizePath(new_path_, FileUtil::DirectorySeparator::PlatformDefault); 113 FileUtil::SanitizePath(new_path_, FileUtil::DirectorySeparator::PlatformDefault);
114 114
115 if (!FileUtil::Exists(old_path) || FileUtil::Exists(new_path) ||
116 FileUtil::IsDirectory(old_path) || !FileUtil::Rename(old_path, new_path))
117 return nullptr;
118
119 if (cache.find(old_path) != cache.end()) { 115 if (cache.find(old_path) != cache.end()) {
120 auto cached = cache[old_path]; 116 auto file = cache[old_path].lock();
121 if (!cached.expired()) { 117
122 auto file = cached.lock(); 118 if (!cache[old_path].expired()) {
123 file->Open(new_path, "r+b"); 119 file->Close();
124 cache.erase(old_path); 120 }
125 cache[new_path] = file; 121
122 if (!FileUtil::Exists(old_path) || FileUtil::Exists(new_path) ||
123 FileUtil::IsDirectory(old_path) || !FileUtil::Rename(old_path, new_path)) {
124 return nullptr;
126 } 125 }
126
127 cache.erase(old_path);
128 file->Open(new_path, "r+b");
129 cache[new_path] = file;
130 } else {
131 UNREACHABLE();
132 return nullptr;
127 } 133 }
134
128 return OpenFile(new_path, Mode::ReadWrite); 135 return OpenFile(new_path, Mode::ReadWrite);
129} 136}
130 137
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 256449aa7..4e7a0bec9 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1407,7 +1407,19 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
1407 u32 supported_languages = 0; 1407 u32 supported_languages = 0;
1408 FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()}; 1408 FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()};
1409 1409
1410 const auto res = pm.GetControlMetadata(); 1410 const auto res = [this] {
1411 const auto title_id = system.CurrentProcess()->GetTitleID();
1412
1413 FileSys::PatchManager pm{title_id};
1414 auto res = pm.GetControlMetadata();
1415 if (res.first != nullptr) {
1416 return res;
1417 }
1418
1419 FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id)};
1420 return pm_update.GetControlMetadata();
1421 }();
1422
1411 if (res.first != nullptr) { 1423 if (res.first != nullptr) {
1412 supported_languages = res.first->GetSupportedLanguages(); 1424 supported_languages = res.first->GetSupportedLanguages();
1413 } 1425 }
diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp
index f19affce7..11aa74828 100644
--- a/src/core/hle/service/nim/nim.cpp
+++ b/src/core/hle/service/nim/nim.cpp
@@ -121,11 +121,83 @@ public:
121 {39, nullptr, "PrepareShutdown"}, 121 {39, nullptr, "PrepareShutdown"},
122 {40, nullptr, "ListApplyDeltaTask"}, 122 {40, nullptr, "ListApplyDeltaTask"},
123 {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"}, 123 {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"},
124 {42, nullptr, "Unknown1"}, 124 {42, nullptr, "Unknown42"},
125 {43, nullptr, "Unknown2"}, 125 {43, nullptr, "Unknown43"},
126 {44, nullptr, "Unknown3"}, 126 {44, nullptr, "Unknown44"},
127 {45, nullptr, "Unknown4"}, 127 {45, nullptr, "Unknown45"},
128 {46, nullptr, "Unknown5"}, 128 {46, nullptr, "Unknown46"},
129 {47, nullptr, "Unknown47"},
130 {48, nullptr, "Unknown48"},
131 {49, nullptr, "Unknown49"},
132 {50, nullptr, "Unknown50"},
133 {51, nullptr, "Unknown51"},
134 {52, nullptr, "Unknown52"},
135 {53, nullptr, "Unknown53"},
136 {54, nullptr, "Unknown54"},
137 {55, nullptr, "Unknown55"},
138 {56, nullptr, "Unknown56"},
139 {57, nullptr, "Unknown57"},
140 {58, nullptr, "Unknown58"},
141 {59, nullptr, "Unknown59"},
142 {60, nullptr, "Unknown60"},
143 {61, nullptr, "Unknown61"},
144 {62, nullptr, "Unknown62"},
145 {63, nullptr, "Unknown63"},
146 {64, nullptr, "Unknown64"},
147 {65, nullptr, "Unknown65"},
148 {66, nullptr, "Unknown66"},
149 {67, nullptr, "Unknown67"},
150 {68, nullptr, "Unknown68"},
151 {69, nullptr, "Unknown69"},
152 {70, nullptr, "Unknown70"},
153 {71, nullptr, "Unknown71"},
154 {72, nullptr, "Unknown72"},
155 {73, nullptr, "Unknown73"},
156 {74, nullptr, "Unknown74"},
157 {75, nullptr, "Unknown75"},
158 {76, nullptr, "Unknown76"},
159 {77, nullptr, "Unknown77"},
160 {78, nullptr, "Unknown78"},
161 {79, nullptr, "Unknown79"},
162 {80, nullptr, "Unknown80"},
163 {81, nullptr, "Unknown81"},
164 {82, nullptr, "Unknown82"},
165 {83, nullptr, "Unknown83"},
166 {84, nullptr, "Unknown84"},
167 {85, nullptr, "Unknown85"},
168 {86, nullptr, "Unknown86"},
169 {87, nullptr, "Unknown87"},
170 {88, nullptr, "Unknown88"},
171 {89, nullptr, "Unknown89"},
172 {90, nullptr, "Unknown90"},
173 {91, nullptr, "Unknown91"},
174 {92, nullptr, "Unknown92"},
175 {93, nullptr, "Unknown93"},
176 {94, nullptr, "Unknown94"},
177 {95, nullptr, "Unknown95"},
178 {96, nullptr, "Unknown96"},
179 {97, nullptr, "Unknown97"},
180 {98, nullptr, "Unknown98"},
181 {99, nullptr, "Unknown99"},
182 {100, nullptr, "Unknown100"},
183 {101, nullptr, "Unknown101"},
184 {102, nullptr, "Unknown102"},
185 {103, nullptr, "Unknown103"},
186 {104, nullptr, "Unknown104"},
187 {105, nullptr, "Unknown105"},
188 {106, nullptr, "Unknown106"},
189 {107, nullptr, "Unknown107"},
190 {108, nullptr, "Unknown108"},
191 {109, nullptr, "Unknown109"},
192 {110, nullptr, "Unknown110"},
193 {111, nullptr, "Unknown111"},
194 {112, nullptr, "Unknown112"},
195 {113, nullptr, "Unknown113"},
196 {114, nullptr, "Unknown114"},
197 {115, nullptr, "Unknown115"},
198 {116, nullptr, "Unknown116"},
199 {117, nullptr, "Unknown117"},
200 {118, nullptr, "Unknown118"},
129 }; 201 };
130 // clang-format on 202 // clang-format on
131 203
@@ -142,6 +214,7 @@ public:
142 {1, nullptr, "RefreshDebugAvailability"}, 214 {1, nullptr, "RefreshDebugAvailability"},
143 {2, nullptr, "ClearDebugResponse"}, 215 {2, nullptr, "ClearDebugResponse"},
144 {3, nullptr, "RegisterDebugResponse"}, 216 {3, nullptr, "RegisterDebugResponse"},
217 {4, nullptr, "IsLargeResourceAvailable"},
145 }; 218 };
146 // clang-format on 219 // clang-format on
147 220
@@ -164,6 +237,8 @@ public:
164 static const FunctionInfo functions[] = { 237 static const FunctionInfo functions[] = {
165 {0, nullptr, "RequestDeviceAuthenticationToken"}, 238 {0, nullptr, "RequestDeviceAuthenticationToken"},
166 {1, nullptr, "RequestCachedDeviceAuthenticationToken"}, 239 {1, nullptr, "RequestCachedDeviceAuthenticationToken"},
240 {2, nullptr, "RequestEdgeToken"},
241 {3, nullptr, "RequestCachedEdgeToken"},
167 {100, nullptr, "RequestRegisterDeviceAccount"}, 242 {100, nullptr, "RequestRegisterDeviceAccount"},
168 {101, nullptr, "RequestUnregisterDeviceAccount"}, 243 {101, nullptr, "RequestUnregisterDeviceAccount"},
169 {102, nullptr, "RequestDeviceAccountStatus"}, 244 {102, nullptr, "RequestDeviceAccountStatus"},
@@ -181,7 +256,8 @@ public:
181 {305, nullptr, "RequestCreateVirtualAccount"}, 256 {305, nullptr, "RequestCreateVirtualAccount"},
182 {306, nullptr, "RequestDeviceLinkStatus"}, 257 {306, nullptr, "RequestDeviceLinkStatus"},
183 {400, nullptr, "GetAccountByVirtualAccount"}, 258 {400, nullptr, "GetAccountByVirtualAccount"},
184 {500, nullptr, "RequestSyncTicket"}, 259 {401, nullptr, "GetVirtualAccount"},
260 {500, nullptr, "RequestSyncTicketLegacy"},
185 {501, nullptr, "RequestDownloadTicket"}, 261 {501, nullptr, "RequestDownloadTicket"},
186 {502, nullptr, "RequestDownloadTicketForPrepurchasedContents"}, 262 {502, nullptr, "RequestDownloadTicketForPrepurchasedContents"},
187 {503, nullptr, "RequestSyncTicket"}, 263 {503, nullptr, "RequestSyncTicket"},
diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp
index f38d01084..8fa16fb08 100644
--- a/src/core/hle/service/npns/npns.cpp
+++ b/src/core/hle/service/npns/npns.cpp
@@ -30,6 +30,7 @@ public:
30 {23, nullptr, "DestroyToken"}, 30 {23, nullptr, "DestroyToken"},
31 {24, nullptr, "DestroyTokenWithApplicationId"}, 31 {24, nullptr, "DestroyTokenWithApplicationId"},
32 {25, nullptr, "QueryIsTokenValid"}, 32 {25, nullptr, "QueryIsTokenValid"},
33 {26, nullptr, "ListenToMyApplicationId"},
33 {31, nullptr, "UploadTokenToBaaS"}, 34 {31, nullptr, "UploadTokenToBaaS"},
34 {32, nullptr, "DestroyTokenForBaaS"}, 35 {32, nullptr, "DestroyTokenForBaaS"},
35 {33, nullptr, "CreateTokenForBaaS"}, 36 {33, nullptr, "CreateTokenForBaaS"},
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index 6cfa9666d..886450be2 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -104,7 +104,7 @@ IApplicationManagerInterface::IApplicationManagerInterface()
104 {94, nullptr, "LaunchApplication"}, 104 {94, nullptr, "LaunchApplication"},
105 {95, nullptr, "GetApplicationLaunchInfo"}, 105 {95, nullptr, "GetApplicationLaunchInfo"},
106 {96, nullptr, "AcquireApplicationLaunchInfo"}, 106 {96, nullptr, "AcquireApplicationLaunchInfo"},
107 {97, nullptr, "GetMainApplicationProgramIndex2"}, 107 {97, nullptr, "GetMainApplicationProgramIndexByApplicationLaunchInfo"},
108 {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, 108 {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"},
109 {99, nullptr, "LaunchDevMenu"}, 109 {99, nullptr, "LaunchDevMenu"},
110 {100, nullptr, "ResetToFactorySettings"}, 110 {100, nullptr, "ResetToFactorySettings"},
@@ -254,7 +254,7 @@ IApplicationManagerInterface::IApplicationManagerInterface()
254 {2170, nullptr, "GetRightsEnvironmentStatus"}, 254 {2170, nullptr, "GetRightsEnvironmentStatus"},
255 {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"}, 255 {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"},
256 {2180, nullptr, "RequestExtendRightsInRightsEnvironment"}, 256 {2180, nullptr, "RequestExtendRightsInRightsEnvironment"},
257 {2181, nullptr, "GetLastResultOfExtendRightsInRightsEnvironment"}, 257 {2181, nullptr, "GetResultOfExtendRightsInRightsEnvironment"},
258 {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"}, 258 {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"},
259 {2190, nullptr, "GetRightsEnvironmentHandleForApplication"}, 259 {2190, nullptr, "GetRightsEnvironmentHandleForApplication"},
260 {2199, nullptr, "GetRightsEnvironmentCountForDebug"}, 260 {2199, nullptr, "GetRightsEnvironmentCountForDebug"},
@@ -446,8 +446,8 @@ IApplicationVersionInterface::IApplicationVersionInterface()
446 446
447IApplicationVersionInterface::~IApplicationVersionInterface() = default; 447IApplicationVersionInterface::~IApplicationVersionInterface() = default;
448 448
449IContentManagerInterface::IContentManagerInterface() 449IContentManagementInterface::IContentManagementInterface()
450 : ServiceFramework{"IContentManagerInterface"} { 450 : ServiceFramework{"IContentManagementInterface"} {
451 // clang-format off 451 // clang-format off
452 static const FunctionInfo functions[] = { 452 static const FunctionInfo functions[] = {
453 {11, nullptr, "CalculateApplicationOccupiedSize"}, 453 {11, nullptr, "CalculateApplicationOccupiedSize"},
@@ -464,7 +464,7 @@ IContentManagerInterface::IContentManagerInterface()
464 RegisterHandlers(functions); 464 RegisterHandlers(functions);
465} 465}
466 466
467IContentManagerInterface::~IContentManagerInterface() = default; 467IContentManagementInterface::~IContentManagementInterface() = default;
468 468
469IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"} { 469IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"} {
470 // clang-format off 470 // clang-format off
@@ -546,7 +546,7 @@ NS::NS(const char* name) : ServiceFramework{name} {
546 {7995, &NS::PushInterface<IAccountProxyInterface>, "GetAccountProxyInterface"}, 546 {7995, &NS::PushInterface<IAccountProxyInterface>, "GetAccountProxyInterface"},
547 {7996, &NS::PushInterface<IApplicationManagerInterface>, "GetApplicationManagerInterface"}, 547 {7996, &NS::PushInterface<IApplicationManagerInterface>, "GetApplicationManagerInterface"},
548 {7997, &NS::PushInterface<IDownloadTaskInterface>, "GetDownloadTaskInterface"}, 548 {7997, &NS::PushInterface<IDownloadTaskInterface>, "GetDownloadTaskInterface"},
549 {7998, &NS::PushInterface<IContentManagerInterface>, "GetContentManagementInterface"}, 549 {7998, &NS::PushInterface<IContentManagementInterface>, "GetContentManagementInterface"},
550 {7999, &NS::PushInterface<IDocumentInterface>, "GetDocumentInterface"}, 550 {7999, &NS::PushInterface<IDocumentInterface>, "GetDocumentInterface"},
551 }; 551 };
552 // clang-format on 552 // clang-format on
@@ -573,9 +573,9 @@ public:
573 {6, nullptr, "TerminateApplication"}, 573 {6, nullptr, "TerminateApplication"},
574 {7, nullptr, "PrepareLaunchProgramFromHost"}, 574 {7, nullptr, "PrepareLaunchProgramFromHost"},
575 {8, nullptr, "LaunchApplication"}, 575 {8, nullptr, "LaunchApplication"},
576 {9, nullptr, "LaunchApplicationWithStorageId"}, 576 {9, nullptr, "LaunchApplicationWithStorageIdForDevelop"},
577 {10, nullptr, "TerminateApplication2"}, 577 {10, nullptr, "IsSystemMemoryResourceLimitBoosted"},
578 {11, nullptr, "GetRunningApplicationProcessId"}, 578 {11, nullptr, "GetRunningApplicationProcessIdForDevelop"},
579 {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActive"}, 579 {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActive"},
580 {13, nullptr, "CreateApplicationResourceForDevelop"}, 580 {13, nullptr, "CreateApplicationResourceForDevelop"},
581 {14, nullptr, "IsPreomiaForDevelop"}, 581 {14, nullptr, "IsPreomiaForDevelop"},
@@ -637,6 +637,10 @@ public:
637 {9, nullptr, "GetSystemUpdateNotificationEventForContentDelivery"}, 637 {9, nullptr, "GetSystemUpdateNotificationEventForContentDelivery"},
638 {10, nullptr, "NotifySystemUpdateForContentDelivery"}, 638 {10, nullptr, "NotifySystemUpdateForContentDelivery"},
639 {11, nullptr, "PrepareShutdown"}, 639 {11, nullptr, "PrepareShutdown"},
640 {12, nullptr, "Unknown12"},
641 {13, nullptr, "Unknown13"},
642 {14, nullptr, "Unknown14"},
643 {15, nullptr, "Unknown15"},
640 {16, nullptr, "DestroySystemUpdateTask"}, 644 {16, nullptr, "DestroySystemUpdateTask"},
641 {17, nullptr, "RequestSendSystemUpdate"}, 645 {17, nullptr, "RequestSendSystemUpdate"},
642 {18, nullptr, "GetSendSystemUpdateProgress"}, 646 {18, nullptr, "GetSendSystemUpdateProgress"},
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h
index 13a64ad88..c2554b878 100644
--- a/src/core/hle/service/ns/ns.h
+++ b/src/core/hle/service/ns/ns.h
@@ -40,10 +40,10 @@ public:
40 ~IApplicationVersionInterface() override; 40 ~IApplicationVersionInterface() override;
41}; 41};
42 42
43class IContentManagerInterface final : public ServiceFramework<IContentManagerInterface> { 43class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> {
44public: 44public:
45 explicit IContentManagerInterface(); 45 explicit IContentManagementInterface();
46 ~IContentManagerInterface() override; 46 ~IContentManagementInterface() override;
47}; 47};
48 48
49class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { 49class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp
index 6efdf1606..40838a225 100644
--- a/src/core/hle/service/ns/pl_u.cpp
+++ b/src/core/hle/service/ns/pl_u.cpp
@@ -163,7 +163,7 @@ PL_U::PL_U(Core::System& system)
163 {5, &PL_U::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"}, 163 {5, &PL_U::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"},
164 {6, nullptr, "GetSharedFontInOrderOfPriorityForSystem"}, 164 {6, nullptr, "GetSharedFontInOrderOfPriorityForSystem"},
165 {100, nullptr, "RequestApplicationFunctionAuthorization"}, 165 {100, nullptr, "RequestApplicationFunctionAuthorization"},
166 {101, nullptr, "RequestApplicationFunctionAuthorizationForSystem"}, 166 {101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"},
167 {102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"}, 167 {102, nullptr, "RequestApplicationFunctionAuthorizationByApplicationId"},
168 {1000, nullptr, "LoadNgWordDataForPlatformRegionChina"}, 168 {1000, nullptr, "LoadNgWordDataForPlatformRegionChina"},
169 {1001, nullptr, "GetNgWordDataSizeForPlatformRegionChina"}, 169 {1001, nullptr, "GetNgWordDataSizeForPlatformRegionChina"},
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp
index c8ea6c661..deaf0808b 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/interface.cpp
@@ -144,7 +144,7 @@ void NVDRV::QueryEvent(Kernel::HLERequestContext& ctx) {
144 } 144 }
145} 145}
146 146
147void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) { 147void NVDRV::SetAruid(Kernel::HLERequestContext& ctx) {
148 IPC::RequestParser rp{ctx}; 148 IPC::RequestParser rp{ctx};
149 pid = rp.Pop<u64>(); 149 pid = rp.Pop<u64>();
150 LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid); 150 LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid);
@@ -154,7 +154,7 @@ void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) {
154 rb.Push<u32>(0); 154 rb.Push<u32>(0);
155} 155}
156 156
157void NVDRV::FinishInitialize(Kernel::HLERequestContext& ctx) { 157void NVDRV::SetGraphicsFirmwareMemoryMarginEnabled(Kernel::HLERequestContext& ctx) {
158 LOG_WARNING(Service_NVDRV, "(STUBBED) called"); 158 LOG_WARNING(Service_NVDRV, "(STUBBED) called");
159 159
160 IPC::ResponseBuilder rb{ctx, 2}; 160 IPC::ResponseBuilder rb{ctx, 2};
@@ -187,13 +187,14 @@ NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name)
187 {4, &NVDRV::QueryEvent, "QueryEvent"}, 187 {4, &NVDRV::QueryEvent, "QueryEvent"},
188 {5, nullptr, "MapSharedMem"}, 188 {5, nullptr, "MapSharedMem"},
189 {6, &NVDRV::GetStatus, "GetStatus"}, 189 {6, &NVDRV::GetStatus, "GetStatus"},
190 {7, nullptr, "ForceSetClientPID"}, 190 {7, nullptr, "SetAruidForTest"},
191 {8, &NVDRV::SetClientPID, "SetClientPID"}, 191 {8, &NVDRV::SetAruid, "SetAruid"},
192 {9, &NVDRV::DumpGraphicsMemoryInfo, "DumpGraphicsMemoryInfo"}, 192 {9, &NVDRV::DumpGraphicsMemoryInfo, "DumpGraphicsMemoryInfo"},
193 {10, nullptr, "InitializeDevtools"}, 193 {10, nullptr, "InitializeDevtools"},
194 {11, &NVDRV::Ioctl2, "Ioctl2"}, 194 {11, &NVDRV::Ioctl2, "Ioctl2"},
195 {12, &NVDRV::Ioctl3, "Ioctl3"}, 195 {12, &NVDRV::Ioctl3, "Ioctl3"},
196 {13, &NVDRV::FinishInitialize, "FinishInitialize"}, 196 {13, &NVDRV::SetGraphicsFirmwareMemoryMarginEnabled,
197 "SetGraphicsFirmwareMemoryMarginEnabled"},
197 }; 198 };
198 RegisterHandlers(functions); 199 RegisterHandlers(functions);
199} 200}
diff --git a/src/core/hle/service/nvdrv/interface.h b/src/core/hle/service/nvdrv/interface.h
index 9269ce00c..72e17a728 100644
--- a/src/core/hle/service/nvdrv/interface.h
+++ b/src/core/hle/service/nvdrv/interface.h
@@ -29,8 +29,8 @@ private:
29 void Close(Kernel::HLERequestContext& ctx); 29 void Close(Kernel::HLERequestContext& ctx);
30 void Initialize(Kernel::HLERequestContext& ctx); 30 void Initialize(Kernel::HLERequestContext& ctx);
31 void QueryEvent(Kernel::HLERequestContext& ctx); 31 void QueryEvent(Kernel::HLERequestContext& ctx);
32 void SetClientPID(Kernel::HLERequestContext& ctx); 32 void SetAruid(Kernel::HLERequestContext& ctx);
33 void FinishInitialize(Kernel::HLERequestContext& ctx); 33 void SetGraphicsFirmwareMemoryMarginEnabled(Kernel::HLERequestContext& ctx);
34 void GetStatus(Kernel::HLERequestContext& ctx); 34 void GetStatus(Kernel::HLERequestContext& ctx);
35 void DumpGraphicsMemoryInfo(Kernel::HLERequestContext& ctx); 35 void DumpGraphicsMemoryInfo(Kernel::HLERequestContext& ctx);
36 void IoctlBase(Kernel::HLERequestContext& ctx, IoctlVersion version); 36 void IoctlBase(Kernel::HLERequestContext& ctx, IoctlVersion version);
diff --git a/src/core/hle/service/nvdrv/nvmemp.cpp b/src/core/hle/service/nvdrv/nvmemp.cpp
index b7b8b7a1b..73b37e805 100644
--- a/src/core/hle/service/nvdrv/nvmemp.cpp
+++ b/src/core/hle/service/nvdrv/nvmemp.cpp
@@ -10,19 +10,19 @@ namespace Service::Nvidia {
10 10
11NVMEMP::NVMEMP() : ServiceFramework("nvmemp") { 11NVMEMP::NVMEMP() : ServiceFramework("nvmemp") {
12 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
13 {0, &NVMEMP::Cmd0, "Cmd0"}, 13 {0, &NVMEMP::Open, "Open"},
14 {1, &NVMEMP::Cmd1, "Cmd1"}, 14 {1, &NVMEMP::GetAruid, "GetAruid"},
15 }; 15 };
16 RegisterHandlers(functions); 16 RegisterHandlers(functions);
17} 17}
18 18
19NVMEMP::~NVMEMP() = default; 19NVMEMP::~NVMEMP() = default;
20 20
21void NVMEMP::Cmd0(Kernel::HLERequestContext& ctx) { 21void NVMEMP::Open(Kernel::HLERequestContext& ctx) {
22 UNIMPLEMENTED(); 22 UNIMPLEMENTED();
23} 23}
24 24
25void NVMEMP::Cmd1(Kernel::HLERequestContext& ctx) { 25void NVMEMP::GetAruid(Kernel::HLERequestContext& ctx) {
26 UNIMPLEMENTED(); 26 UNIMPLEMENTED();
27} 27}
28 28
diff --git a/src/core/hle/service/nvdrv/nvmemp.h b/src/core/hle/service/nvdrv/nvmemp.h
index 6eafb1346..c453ee4db 100644
--- a/src/core/hle/service/nvdrv/nvmemp.h
+++ b/src/core/hle/service/nvdrv/nvmemp.h
@@ -14,8 +14,8 @@ public:
14 ~NVMEMP() override; 14 ~NVMEMP() override;
15 15
16private: 16private:
17 void Cmd0(Kernel::HLERequestContext& ctx); 17 void Open(Kernel::HLERequestContext& ctx);
18 void Cmd1(Kernel::HLERequestContext& ctx); 18 void GetAruid(Kernel::HLERequestContext& ctx);
19}; 19};
20 20
21} // namespace Service::Nvidia 21} // namespace Service::Nvidia
diff --git a/src/core/hle/service/pcie/pcie.cpp b/src/core/hle/service/pcie/pcie.cpp
index 39cf05eba..c568a0adc 100644
--- a/src/core/hle/service/pcie/pcie.cpp
+++ b/src/core/hle/service/pcie/pcie.cpp
@@ -36,6 +36,9 @@ public:
36 {18, nullptr, "ReleaseIrq"}, 36 {18, nullptr, "ReleaseIrq"},
37 {19, nullptr, "SetIrqEnable"}, 37 {19, nullptr, "SetIrqEnable"},
38 {20, nullptr, "SetAspmEnable"}, 38 {20, nullptr, "SetAspmEnable"},
39 {21, nullptr, "SetResetUponResumeEnable"},
40 {22, nullptr, "Unknown22"},
41 {23, nullptr, "Unknown23"},
39 }; 42 };
40 // clang-format on 43 // clang-format on
41 44
diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp
index d6891a659..8bfc0276e 100644
--- a/src/core/hle/service/pcv/pcv.cpp
+++ b/src/core/hle/service/pcv/pcv.cpp
@@ -42,6 +42,9 @@ public:
42 {24, nullptr, "GetModuleStateTable"}, 42 {24, nullptr, "GetModuleStateTable"},
43 {25, nullptr, "GetPowerDomainStateTable"}, 43 {25, nullptr, "GetPowerDomainStateTable"},
44 {26, nullptr, "GetFuseInfo"}, 44 {26, nullptr, "GetFuseInfo"},
45 {27, nullptr, "GetDramId"},
46 {28, nullptr, "IsPoweredOn"},
47 {29, nullptr, "GetVoltage"},
45 }; 48 };
46 // clang-format on 49 // clang-format on
47 50
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp
index 809eca0ab..f43122ad2 100644
--- a/src/core/hle/service/pm/pm.cpp
+++ b/src/core/hle/service/pm/pm.cpp
@@ -78,13 +78,13 @@ public:
78 : ServiceFramework{"pm:dmnt"}, kernel(kernel) { 78 : ServiceFramework{"pm:dmnt"}, kernel(kernel) {
79 // clang-format off 79 // clang-format off
80 static const FunctionInfo functions[] = { 80 static const FunctionInfo functions[] = {
81 {0, nullptr, "GetDebugProcesses"}, 81 {0, nullptr, "GetJitDebugProcessIdList"},
82 {1, nullptr, "StartDebugProcess"}, 82 {1, nullptr, "StartProcess"},
83 {2, &DebugMonitor::GetTitlePid, "GetTitlePid"}, 83 {2, &DebugMonitor::GetProcessId, "GetProcessId"},
84 {3, nullptr, "EnableDebugForTitleId"}, 84 {3, nullptr, "HookToCreateProcess"},
85 {4, &DebugMonitor::GetApplicationPid, "GetApplicationPid"}, 85 {4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"},
86 {5, nullptr, "EnableDebugForApplication"}, 86 {5, nullptr, "HookToCreateApplicationProgress"},
87 {6, nullptr, "DisableDebug"}, 87 {6, nullptr, "ClearHook"},
88 }; 88 };
89 // clang-format on 89 // clang-format on
90 90
@@ -92,7 +92,7 @@ public:
92 } 92 }
93 93
94private: 94private:
95 void GetTitlePid(Kernel::HLERequestContext& ctx) { 95 void GetProcessId(Kernel::HLERequestContext& ctx) {
96 IPC::RequestParser rp{ctx}; 96 IPC::RequestParser rp{ctx};
97 const auto title_id = rp.PopRaw<u64>(); 97 const auto title_id = rp.PopRaw<u64>();
98 98
@@ -114,7 +114,7 @@ private:
114 rb.Push((*process)->GetProcessID()); 114 rb.Push((*process)->GetProcessID());
115 } 115 }
116 116
117 void GetApplicationPid(Kernel::HLERequestContext& ctx) { 117 void GetApplicationProcessId(Kernel::HLERequestContext& ctx) {
118 LOG_DEBUG(Service_PM, "called"); 118 LOG_DEBUG(Service_PM, "called");
119 GetApplicationPidGeneric(ctx, kernel.GetProcessList()); 119 GetApplicationPidGeneric(ctx, kernel.GetProcessList());
120 } 120 }
@@ -163,15 +163,15 @@ public:
163 : ServiceFramework{"pm:shell"}, kernel(kernel) { 163 : ServiceFramework{"pm:shell"}, kernel(kernel) {
164 // clang-format off 164 // clang-format off
165 static const FunctionInfo functions[] = { 165 static const FunctionInfo functions[] = {
166 {0, nullptr, "LaunchProcess"}, 166 {0, nullptr, "LaunchProgram"},
167 {1, nullptr, "TerminateProcessByPid"}, 167 {1, nullptr, "TerminateProcess"},
168 {2, nullptr, "TerminateProcessByTitleId"}, 168 {2, nullptr, "TerminateProgram"},
169 {3, nullptr, "GetProcessEventWaiter"}, 169 {3, nullptr, "GetProcessEventHandle"},
170 {4, nullptr, "GetProcessEventType"}, 170 {4, nullptr, "GetProcessEventInfo"},
171 {5, nullptr, "NotifyBootFinished"}, 171 {5, nullptr, "NotifyBootFinished"},
172 {6, &Shell::GetApplicationPid, "GetApplicationPid"}, 172 {6, &Shell::GetApplicationProcessIdForShell, "GetApplicationProcessIdForShell"},
173 {7, nullptr, "BoostSystemMemoryResourceLimit"}, 173 {7, nullptr, "BoostSystemMemoryResourceLimit"},
174 {8, nullptr, "EnableAdditionalSystemThreads"}, 174 {8, nullptr, "BoostApplicationThreadResourceLimit"},
175 {9, nullptr, "GetBootFinishedEventHandle"}, 175 {9, nullptr, "GetBootFinishedEventHandle"},
176 }; 176 };
177 // clang-format on 177 // clang-format on
@@ -180,7 +180,7 @@ public:
180 } 180 }
181 181
182private: 182private:
183 void GetApplicationPid(Kernel::HLERequestContext& ctx) { 183 void GetApplicationProcessIdForShell(Kernel::HLERequestContext& ctx) {
184 LOG_DEBUG(Service_PM, "called"); 184 LOG_DEBUG(Service_PM, "called");
185 GetApplicationPidGeneric(ctx, kernel.GetProcessList()); 185 GetApplicationPidGeneric(ctx, kernel.GetProcessList());
186 } 186 }
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp
index 67833d9af..cde3312da 100644
--- a/src/core/hle/service/prepo/prepo.cpp
+++ b/src/core/hle/service/prepo/prepo.cpp
@@ -42,6 +42,11 @@ public:
42 {40101, nullptr, "SetUserAgreementCheckEnabled"}, 42 {40101, nullptr, "SetUserAgreementCheckEnabled"},
43 {50100, nullptr, "ReadAllApplicationReportFiles"}, 43 {50100, nullptr, "ReadAllApplicationReportFiles"},
44 {90100, nullptr, "ReadAllReportFiles"}, 44 {90100, nullptr, "ReadAllReportFiles"},
45 {90101, nullptr, "Unknown90101"},
46 {90102, nullptr, "Unknown90102"},
47 {90200, nullptr, "GetStatistics"},
48 {90201, nullptr, "GetThroughputHistory"},
49 {90300, nullptr, "GetLastUploadError"},
45 }; 50 };
46 // clang-format on 51 // clang-format on
47 52
diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp
index 53ec6b031..99e1c9042 100644
--- a/src/core/hle/service/psc/psc.cpp
+++ b/src/core/hle/service/psc/psc.cpp
@@ -24,6 +24,8 @@ public:
24 {4, nullptr, "Cancel"}, 24 {4, nullptr, "Cancel"},
25 {5, nullptr, "PrintModuleInformation"}, 25 {5, nullptr, "PrintModuleInformation"},
26 {6, nullptr, "GetModuleInformation"}, 26 {6, nullptr, "GetModuleInformation"},
27 {10, nullptr, "Unknown10"},
28 {11, nullptr, "Unknown11"},
27 }; 29 };
28 // clang-format on 30 // clang-format on
29 31
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp
index 12d154ecf..6d9e6bd09 100644
--- a/src/core/hle/service/ptm/psm.cpp
+++ b/src/core/hle/service/ptm/psm.cpp
@@ -35,6 +35,7 @@ public:
35 {15, nullptr, "GetBatteryAgePercentage"}, 35 {15, nullptr, "GetBatteryAgePercentage"},
36 {16, nullptr, "GetBatteryChargeInfoEvent"}, 36 {16, nullptr, "GetBatteryChargeInfoEvent"},
37 {17, nullptr, "GetBatteryChargeInfoFields"}, 37 {17, nullptr, "GetBatteryChargeInfoFields"},
38 {18, nullptr, "GetBatteryChargeCalibratedEvent"},
38 }; 39 };
39 // clang-format on 40 // clang-format on
40 41
diff --git a/src/core/hle/service/sm/controller.cpp b/src/core/hle/service/sm/controller.cpp
index 9cca84b31..972aaa6d9 100644
--- a/src/core/hle/service/sm/controller.cpp
+++ b/src/core/hle/service/sm/controller.cpp
@@ -12,7 +12,7 @@
12 12
13namespace Service::SM { 13namespace Service::SM {
14 14
15void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) { 15void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) {
16 ASSERT_MSG(ctx.Session()->IsSession(), "Session is already a domain"); 16 ASSERT_MSG(ctx.Session()->IsSession(), "Session is already a domain");
17 LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetObjectId()); 17 LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetObjectId());
18 ctx.Session()->ConvertToDomain(); 18 ctx.Session()->ConvertToDomain();
@@ -22,7 +22,7 @@ void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
22 rb.Push<u32>(1); // Converted sessions start with 1 request handler 22 rb.Push<u32>(1); // Converted sessions start with 1 request handler
23} 23}
24 24
25void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) { 25void Controller::CloneCurrentObject(Kernel::HLERequestContext& ctx) {
26 // TODO(bunnei): This is just creating a new handle to the same Session. I assume this is wrong 26 // TODO(bunnei): This is just creating a new handle to the same Session. I assume this is wrong
27 // and that we probably want to actually make an entirely new Session, but we still need to 27 // and that we probably want to actually make an entirely new Session, but we still need to
28 // verify this on hardware. 28 // verify this on hardware.
@@ -33,10 +33,10 @@ void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
33 rb.PushMoveObjects(ctx.Session()->GetParent()->Client()); 33 rb.PushMoveObjects(ctx.Session()->GetParent()->Client());
34} 34}
35 35
36void Controller::DuplicateSessionEx(Kernel::HLERequestContext& ctx) { 36void Controller::CloneCurrentObjectEx(Kernel::HLERequestContext& ctx) {
37 LOG_WARNING(Service, "(STUBBED) called, using DuplicateSession"); 37 LOG_WARNING(Service, "(STUBBED) called, using CloneCurrentObject");
38 38
39 DuplicateSession(ctx); 39 CloneCurrentObject(ctx);
40} 40}
41 41
42void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) { 42void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
@@ -47,13 +47,14 @@ void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
47 rb.Push<u16>(0x1000); 47 rb.Push<u16>(0x1000);
48} 48}
49 49
50// https://switchbrew.org/wiki/IPC_Marshalling
50Controller::Controller() : ServiceFramework("IpcController") { 51Controller::Controller() : ServiceFramework("IpcController") {
51 static const FunctionInfo functions[] = { 52 static const FunctionInfo functions[] = {
52 {0x00000000, &Controller::ConvertSessionToDomain, "ConvertSessionToDomain"}, 53 {0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"},
53 {0x00000001, nullptr, "ConvertDomainToSession"}, 54 {1, nullptr, "CopyFromCurrentDomain"},
54 {0x00000002, &Controller::DuplicateSession, "DuplicateSession"}, 55 {2, &Controller::CloneCurrentObject, "CloneCurrentObject"},
55 {0x00000003, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"}, 56 {3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
56 {0x00000004, &Controller::DuplicateSessionEx, "DuplicateSessionEx"}, 57 {4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"},
57 }; 58 };
58 RegisterHandlers(functions); 59 RegisterHandlers(functions);
59} 60}
diff --git a/src/core/hle/service/sm/controller.h b/src/core/hle/service/sm/controller.h
index dc66c9e37..180c6da50 100644
--- a/src/core/hle/service/sm/controller.h
+++ b/src/core/hle/service/sm/controller.h
@@ -14,9 +14,9 @@ public:
14 ~Controller() override; 14 ~Controller() override;
15 15
16private: 16private:
17 void ConvertSessionToDomain(Kernel::HLERequestContext& ctx); 17 void ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx);
18 void DuplicateSession(Kernel::HLERequestContext& ctx); 18 void CloneCurrentObject(Kernel::HLERequestContext& ctx);
19 void DuplicateSessionEx(Kernel::HLERequestContext& ctx); 19 void CloneCurrentObjectEx(Kernel::HLERequestContext& ctx);
20 void QueryPointerBufferSize(Kernel::HLERequestContext& ctx); 20 void QueryPointerBufferSize(Kernel::HLERequestContext& ctx);
21}; 21};
22 22
diff --git a/src/core/hle/service/sockets/nsd.cpp b/src/core/hle/service/sockets/nsd.cpp
index dc70fd6fe..40d781124 100644
--- a/src/core/hle/service/sockets/nsd.cpp
+++ b/src/core/hle/service/sockets/nsd.cpp
@@ -14,6 +14,7 @@ NSD::NSD(const char* name) : ServiceFramework(name) {
14 {12, nullptr, "GetDeviceId"}, 14 {12, nullptr, "GetDeviceId"},
15 {13, nullptr, "DeleteSettings"}, 15 {13, nullptr, "DeleteSettings"},
16 {14, nullptr, "ImportSettings"}, 16 {14, nullptr, "ImportSettings"},
17 {15, nullptr, "SetChangeEnvironmentIdentifierDisabled"},
17 {20, nullptr, "Resolve"}, 18 {20, nullptr, "Resolve"},
18 {21, nullptr, "ResolveEx"}, 19 {21, nullptr, "ResolveEx"},
19 {30, nullptr, "GetNasServiceSetting"}, 20 {30, nullptr, "GetNasServiceSetting"},
@@ -28,6 +29,11 @@ NSD::NSD(const char* name) : ServiceFramework(name) {
28 {60, nullptr, "ReadSaveDataFromFsForTest"}, 29 {60, nullptr, "ReadSaveDataFromFsForTest"},
29 {61, nullptr, "WriteSaveDataToFsForTest"}, 30 {61, nullptr, "WriteSaveDataToFsForTest"},
30 {62, nullptr, "DeleteSaveDataOfFsForTest"}, 31 {62, nullptr, "DeleteSaveDataOfFsForTest"},
32 {63, nullptr, "IsChangeEnvironmentIdentifierDisabled"},
33 {64, nullptr, "SetWithoutDomainExchangeFqdns"},
34 {100, nullptr, "GetApplicationServerEnvironmentType"},
35 {101, nullptr, "SetApplicationServerEnvironmentType"},
36 {102, nullptr, "DeleteApplicationServerEnvironmentType"},
31 }; 37 };
32 // clang-format on 38 // clang-format on
33 39
diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp
index 852e71e4b..e3017451f 100644
--- a/src/core/hle/service/sockets/sfdnsres.cpp
+++ b/src/core/hle/service/sockets/sfdnsres.cpp
@@ -7,7 +7,7 @@
7 7
8namespace Service::Sockets { 8namespace Service::Sockets {
9 9
10void SFDNSRES::GetAddrInfo(Kernel::HLERequestContext& ctx) { 10void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) {
11 struct Parameters { 11 struct Parameters {
12 u8 use_nsd_resolve; 12 u8 use_nsd_resolve;
13 u32 unknown; 13 u32 unknown;
@@ -29,15 +29,20 @@ SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") {
29 static const FunctionInfo functions[] = { 29 static const FunctionInfo functions[] = {
30 {0, nullptr, "SetDnsAddressesPrivate"}, 30 {0, nullptr, "SetDnsAddressesPrivate"},
31 {1, nullptr, "GetDnsAddressPrivate"}, 31 {1, nullptr, "GetDnsAddressPrivate"},
32 {2, nullptr, "GetHostByName"}, 32 {2, nullptr, "GetHostByNameRequest"},
33 {3, nullptr, "GetHostByAddr"}, 33 {3, nullptr, "GetHostByAddrRequest"},
34 {4, nullptr, "GetHostStringError"}, 34 {4, nullptr, "GetHostStringErrorRequest"},
35 {5, nullptr, "GetGaiStringError"}, 35 {5, nullptr, "GetGaiStringErrorRequest"},
36 {6, &SFDNSRES::GetAddrInfo, "GetAddrInfo"}, 36 {6, &SFDNSRES::GetAddrInfoRequest, "GetAddrInfoRequest"},
37 {7, nullptr, "GetNameInfo"}, 37 {7, nullptr, "GetNameInfoRequest"},
38 {8, nullptr, "RequestCancelHandle"}, 38 {8, nullptr, "RequestCancelHandleRequest"},
39 {9, nullptr, "CancelSocketCall"}, 39 {9, nullptr, "CancelRequest"},
40 {11, nullptr, "ClearDnsIpServerAddressArray"}, 40 {10, nullptr, "GetHostByNameRequestWithOptions"},
41 {11, nullptr, "GetHostByAddrRequestWithOptions"},
42 {12, nullptr, "GetAddrInfoRequestWithOptions"},
43 {13, nullptr, "GetNameInfoRequestWithOptions"},
44 {14, nullptr, "ResolverSetOptionRequest"},
45 {15, nullptr, "ResolverGetOptionRequest"},
41 }; 46 };
42 RegisterHandlers(functions); 47 RegisterHandlers(functions);
43} 48}
diff --git a/src/core/hle/service/sockets/sfdnsres.h b/src/core/hle/service/sockets/sfdnsres.h
index eda432903..acd3647bb 100644
--- a/src/core/hle/service/sockets/sfdnsres.h
+++ b/src/core/hle/service/sockets/sfdnsres.h
@@ -15,7 +15,7 @@ public:
15 ~SFDNSRES() override; 15 ~SFDNSRES() override;
16 16
17private: 17private:
18 void GetAddrInfo(Kernel::HLERequestContext& ctx); 18 void GetAddrInfoRequest(Kernel::HLERequestContext& ctx);
19}; 19};
20 20
21} // namespace Service::Sockets 21} // namespace Service::Sockets
diff --git a/src/core/hle/service/spl/spl.cpp b/src/core/hle/service/spl/spl.cpp
index 70cb41905..773551464 100644
--- a/src/core/hle/service/spl/spl.cpp
+++ b/src/core/hle/service/spl/spl.cpp
@@ -9,35 +9,36 @@ namespace Service::SPL {
9SPL::SPL(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "spl:") { 9SPL::SPL(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "spl:") {
10 static const FunctionInfo functions[] = { 10 static const FunctionInfo functions[] = {
11 {0, nullptr, "GetConfig"}, 11 {0, nullptr, "GetConfig"},
12 {1, nullptr, "UserExpMod"}, 12 {1, nullptr, "ModularExponentiate"},
13 {2, nullptr, "GenerateAesKek"}, 13 {2, nullptr, "GenerateAesKek"},
14 {3, nullptr, "LoadAesKey"}, 14 {3, nullptr, "LoadAesKey"},
15 {4, nullptr, "GenerateAesKey"}, 15 {4, nullptr, "GenerateAesKey"},
16 {5, nullptr, "SetConfig"}, 16 {5, nullptr, "SetConfig"},
17 {7, &SPL::GetRandomBytes, "GetRandomBytes"}, 17 {7, &SPL::GetRandomBytes, "GetRandomBytes"},
18 {9, nullptr, "LoadSecureExpModKey"}, 18 {9, nullptr, "ImportLotusKey"},
19 {10, nullptr, "SecureExpMod"}, 19 {10, nullptr, "DecryptLotusMessage"},
20 {11, nullptr, "IsDevelopment"}, 20 {11, nullptr, "IsDevelopment"},
21 {12, nullptr, "GenerateSpecificAesKey"}, 21 {12, nullptr, "GenerateSpecificAesKey"},
22 {13, nullptr, "DecryptPrivk"}, 22 {13, nullptr, "DecryptDeviceUniqueData"},
23 {14, nullptr, "DecryptAesKey"}, 23 {14, nullptr, "DecryptAesKey"},
24 {15, nullptr, "DecryptAesCtr"}, 24 {15, nullptr, "CryptAesCtr"},
25 {16, nullptr, "ComputeCmac"}, 25 {16, nullptr, "ComputeCmac"},
26 {17, nullptr, "LoadRsaOaepKey"}, 26 {17, nullptr, "ImportEsKey"},
27 {18, nullptr, "UnwrapRsaOaepWrappedTitleKey"}, 27 {18, nullptr, "UnwrapTitleKey"},
28 {19, nullptr, "LoadTitleKey"}, 28 {19, nullptr, "LoadTitleKey"},
29 {20, nullptr, "UnwrapAesWrappedTitleKey"}, 29 {20, nullptr, "PrepareEsCommonKey"},
30 {21, nullptr, "LockAesEngine"}, 30 {21, nullptr, "AllocateAesKeyslot"},
31 {22, nullptr, "UnlockAesEngine"}, 31 {22, nullptr, "DeallocateAesKeySlot"},
32 {23, nullptr, "GetSplWaitEvent"}, 32 {23, nullptr, "GetAesKeyslotAvailableEvent"},
33 {24, nullptr, "SetSharedData"}, 33 {24, nullptr, "SetBootReason"},
34 {25, nullptr, "GetSharedData"}, 34 {25, nullptr, "GetBootReason"},
35 {26, nullptr, "ImportSslRsaKey"}, 35 {26, nullptr, "DecryptAndStoreSslClientCertKey"},
36 {27, nullptr, "SecureExpModWithSslKey"}, 36 {27, nullptr, "ModularExponentiateWithSslClientCertKey"},
37 {28, nullptr, "ImportEsRsaKey"}, 37 {28, nullptr, "DecryptAndStoreDrmDeviceCertKey"},
38 {29, nullptr, "SecureExpModWithEsKey"}, 38 {29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"},
39 {30, nullptr, "EncryptManuRsaKeyForImport"}, 39 {30, nullptr, "ReencryptDeviceUniqueData "},
40 {31, nullptr, "GetPackage2Hash"}, 40 {31, nullptr, "PrepareEsArchiveKey"}, // This is also GetPackage2Hash?
41 {32, nullptr, "LoadPreparedAesKey"},
41 }; 42 };
42 RegisterHandlers(functions); 43 RegisterHandlers(functions);
43} 44}
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 4cf58a61a..13e4b3818 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -90,6 +90,13 @@ public:
90 : ServiceFramework("ISteadyClock"), clock_core{clock_core}, system{system} { 90 : ServiceFramework("ISteadyClock"), clock_core{clock_core}, system{system} {
91 static const FunctionInfo functions[] = { 91 static const FunctionInfo functions[] = {
92 {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"}, 92 {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"},
93 {2, nullptr, "GetTestOffset"},
94 {3, nullptr, "SetTestOffset"},
95 {100, nullptr, "GetRtcValue"},
96 {101, nullptr, "IsRtcResetDetected"},
97 {102, nullptr, "GetSetupResultValue"},
98 {200, nullptr, "GetInternalOffset"},
99 {201, nullptr, "SetInternalOffset"},
93 }; 100 };
94 RegisterHandlers(functions); 101 RegisterHandlers(functions);
95 } 102 }
diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp
index 58a9845fc..d033f8603 100644
--- a/src/core/hle/service/usb/usb.cpp
+++ b/src/core/hle/service/usb/usb.cpp
@@ -20,7 +20,7 @@ public:
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, nullptr, "GetDsEndpoint"}, 21 {0, nullptr, "GetDsEndpoint"},
22 {1, nullptr, "GetSetupEvent"}, 22 {1, nullptr, "GetSetupEvent"},
23 {2, nullptr, "Unknown"}, 23 {2, nullptr, "Unknown2"},
24 {3, nullptr, "EnableInterface"}, 24 {3, nullptr, "EnableInterface"},
25 {4, nullptr, "DisableInterface"}, 25 {4, nullptr, "DisableInterface"},
26 {5, nullptr, "CtrlInPostBufferAsync"}, 26 {5, nullptr, "CtrlInPostBufferAsync"},
@@ -55,6 +55,7 @@ public:
55 {9, nullptr, "SetBinaryObjectStore"}, 55 {9, nullptr, "SetBinaryObjectStore"},
56 {10, nullptr, "Enable"}, 56 {10, nullptr, "Enable"},
57 {11, nullptr, "Disable"}, 57 {11, nullptr, "Disable"},
58 {12, nullptr, "Unknown12"},
58 }; 59 };
59 // clang-format on 60 // clang-format on
60 61
@@ -69,13 +70,13 @@ public:
69 static const FunctionInfo functions[] = { 70 static const FunctionInfo functions[] = {
70 {0, nullptr, "Open"}, 71 {0, nullptr, "Open"},
71 {1, nullptr, "Close"}, 72 {1, nullptr, "Close"},
72 {2, nullptr, "Unknown1"}, 73 {2, nullptr, "Unknown2"},
73 {3, nullptr, "Populate"}, 74 {3, nullptr, "Populate"},
74 {4, nullptr, "PostBufferAsync"}, 75 {4, nullptr, "PostBufferAsync"},
75 {5, nullptr, "GetXferReport"}, 76 {5, nullptr, "GetXferReport"},
76 {6, nullptr, "PostBufferMultiAsync"}, 77 {6, nullptr, "PostBufferMultiAsync"},
77 {7, nullptr, "Unknown3"}, 78 {7, nullptr, "Unknown7"},
78 {8, nullptr, "Unknown4"}, 79 {8, nullptr, "Unknown8"},
79 }; 80 };
80 // clang-format on 81 // clang-format on
81 82
@@ -88,13 +89,13 @@ public:
88 explicit IClientIfSession() : ServiceFramework{"IClientIfSession"} { 89 explicit IClientIfSession() : ServiceFramework{"IClientIfSession"} {
89 // clang-format off 90 // clang-format off
90 static const FunctionInfo functions[] = { 91 static const FunctionInfo functions[] = {
91 {0, nullptr, "Unknown1"}, 92 {0, nullptr, "Unknown0"},
92 {1, nullptr, "SetInterface"}, 93 {1, nullptr, "SetInterface"},
93 {2, nullptr, "GetInterface"}, 94 {2, nullptr, "GetInterface"},
94 {3, nullptr, "GetAlternateInterface"}, 95 {3, nullptr, "GetAlternateInterface"},
95 {4, nullptr, "GetCurrentFrame"}, 96 {4, nullptr, "GetCurrentFrame"},
96 {5, nullptr, "CtrlXferAsync"}, 97 {5, nullptr, "CtrlXferAsync"},
97 {6, nullptr, "Unknown2"}, 98 {6, nullptr, "Unknown6"},
98 {7, nullptr, "GetCtrlXferReport"}, 99 {7, nullptr, "GetCtrlXferReport"},
99 {8, nullptr, "ResetDevice"}, 100 {8, nullptr, "ResetDevice"},
100 {9, nullptr, "OpenUsbEp"}, 101 {9, nullptr, "OpenUsbEp"},
@@ -118,7 +119,7 @@ public:
118 {5, nullptr, "DestroyInterfaceAvailableEvent"}, 119 {5, nullptr, "DestroyInterfaceAvailableEvent"},
119 {6, nullptr, "GetInterfaceStateChangeEvent"}, 120 {6, nullptr, "GetInterfaceStateChangeEvent"},
120 {7, nullptr, "AcquireUsbIf"}, 121 {7, nullptr, "AcquireUsbIf"},
121 {8, nullptr, "Unknown1"}, 122 {8, nullptr, "Unknown8"},
122 }; 123 };
123 // clang-format on 124 // clang-format on
124 125
@@ -179,8 +180,8 @@ public:
179 {4, nullptr, "GetFwRevision"}, 180 {4, nullptr, "GetFwRevision"},
180 {5, nullptr, "GetManufacturerId"}, 181 {5, nullptr, "GetManufacturerId"},
181 {6, nullptr, "GetDeviceId"}, 182 {6, nullptr, "GetDeviceId"},
182 {7, nullptr, "Unknown1"}, 183 {7, nullptr, "Unknown7"},
183 {8, nullptr, "Unknown2"}, 184 {8, nullptr, "Unknown8"},
184 }; 185 };
185 // clang-format on 186 // clang-format on
186 187
@@ -215,12 +216,12 @@ public:
215 explicit USB_PM() : ServiceFramework{"usb:pm"} { 216 explicit USB_PM() : ServiceFramework{"usb:pm"} {
216 // clang-format off 217 // clang-format off
217 static const FunctionInfo functions[] = { 218 static const FunctionInfo functions[] = {
218 {0, nullptr, "Unknown1"}, 219 {0, nullptr, "Unknown0"},
219 {1, nullptr, "Unknown2"}, 220 {1, nullptr, "Unknown1"},
220 {2, nullptr, "Unknown3"}, 221 {2, nullptr, "Unknown2"},
221 {3, nullptr, "Unknown4"}, 222 {3, nullptr, "Unknown3"},
222 {4, nullptr, "Unknown5"}, 223 {4, nullptr, "Unknown4"},
223 {5, nullptr, "Unknown6"}, 224 {5, nullptr, "Unknown5"},
224 }; 225 };
225 // clang-format on 226 // clang-format on
226 227
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 552a5e4ef..ea7b4ae13 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -700,6 +700,7 @@ public:
700 {3215, nullptr, "SetDisplayGamma"}, 700 {3215, nullptr, "SetDisplayGamma"},
701 {3216, nullptr, "GetDisplayCmuLuma"}, 701 {3216, nullptr, "GetDisplayCmuLuma"},
702 {3217, nullptr, "SetDisplayCmuLuma"}, 702 {3217, nullptr, "SetDisplayCmuLuma"},
703 {6013, nullptr, "GetLayerPresentationSubmissionTimestamps"},
703 {8225, nullptr, "GetSharedBufferMemoryHandleId"}, 704 {8225, nullptr, "GetSharedBufferMemoryHandleId"},
704 {8250, nullptr, "OpenSharedLayer"}, 705 {8250, nullptr, "OpenSharedLayer"},
705 {8251, nullptr, "CloseSharedLayer"}, 706 {8251, nullptr, "CloseSharedLayer"},
@@ -785,6 +786,7 @@ public:
785 {2300, nullptr, "AcquireLayerTexturePresentingEvent"}, 786 {2300, nullptr, "AcquireLayerTexturePresentingEvent"},
786 {2301, nullptr, "ReleaseLayerTexturePresentingEvent"}, 787 {2301, nullptr, "ReleaseLayerTexturePresentingEvent"},
787 {2302, nullptr, "GetDisplayHotplugEvent"}, 788 {2302, nullptr, "GetDisplayHotplugEvent"},
789 {2303, nullptr, "GetDisplayModeChangedEvent"},
788 {2402, nullptr, "GetDisplayHotplugState"}, 790 {2402, nullptr, "GetDisplayHotplugState"},
789 {2501, nullptr, "GetCompositorErrorInfo"}, 791 {2501, nullptr, "GetCompositorErrorInfo"},
790 {2601, nullptr, "GetDisplayErrorEvent"}, 792 {2601, nullptr, "GetDisplayErrorEvent"},
diff --git a/src/core/hle/service/vi/vi_u.cpp b/src/core/hle/service/vi/vi_u.cpp
index 9d5ceb608..6b7329345 100644
--- a/src/core/hle/service/vi/vi_u.cpp
+++ b/src/core/hle/service/vi/vi_u.cpp
@@ -12,6 +12,7 @@ VI_U::VI_U(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger)
12 : ServiceFramework{"vi:u"}, nv_flinger{std::move(nv_flinger)} { 12 : ServiceFramework{"vi:u"}, nv_flinger{std::move(nv_flinger)} {
13 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
14 {0, &VI_U::GetDisplayService, "GetDisplayService"}, 14 {0, &VI_U::GetDisplayService, "GetDisplayService"},
15 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
15 }; 16 };
16 RegisterHandlers(functions); 17 RegisterHandlers(functions);
17} 18}
diff --git a/src/core/hle/service/wlan/wlan.cpp b/src/core/hle/service/wlan/wlan.cpp
index 2654594c1..0260d7dcf 100644
--- a/src/core/hle/service/wlan/wlan.cpp
+++ b/src/core/hle/service/wlan/wlan.cpp
@@ -15,34 +15,37 @@ public:
15 explicit WLANInfra() : ServiceFramework{"wlan:inf"} { 15 explicit WLANInfra() : ServiceFramework{"wlan:inf"} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "Unknown1"}, 18 {0, nullptr, "OpenMode"},
19 {1, nullptr, "Unknown2"}, 19 {1, nullptr, "CloseMode"},
20 {2, nullptr, "GetMacAddress"}, 20 {2, nullptr, "GetMacAddress"},
21 {3, nullptr, "StartScan"}, 21 {3, nullptr, "StartScan"},
22 {4, nullptr, "StopScan"}, 22 {4, nullptr, "StopScan"},
23 {5, nullptr, "Connect"}, 23 {5, nullptr, "Connect"},
24 {6, nullptr, "CancelConnect"}, 24 {6, nullptr, "CancelConnect"},
25 {7, nullptr, "Disconnect"}, 25 {7, nullptr, "Disconnect"},
26 {8, nullptr, "Unknown3"}, 26 {8, nullptr, "GetConnectionEvent"},
27 {9, nullptr, "Unknown4"}, 27 {9, nullptr, "GetConnectionStatus"},
28 {10, nullptr, "GetState"}, 28 {10, nullptr, "GetState"},
29 {11, nullptr, "GetScanResult"}, 29 {11, nullptr, "GetScanResult"},
30 {12, nullptr, "GetRssi"}, 30 {12, nullptr, "GetRssi"},
31 {13, nullptr, "ChangeRxAntenna"}, 31 {13, nullptr, "ChangeRxAntenna"},
32 {14, nullptr, "Unknown5"}, 32 {14, nullptr, "GetFwVersion"},
33 {15, nullptr, "Unknown6"}, 33 {15, nullptr, "RequestSleep"},
34 {16, nullptr, "RequestWakeUp"}, 34 {16, nullptr, "RequestWakeUp"},
35 {17, nullptr, "RequestIfUpDown"}, 35 {17, nullptr, "RequestIfUpDown"},
36 {18, nullptr, "Unknown7"}, 36 {18, nullptr, "Unknown18"},
37 {19, nullptr, "Unknown8"}, 37 {19, nullptr, "Unknown19"},
38 {20, nullptr, "Unknown9"}, 38 {20, nullptr, "Unknown20"},
39 {21, nullptr, "Unknown10"}, 39 {21, nullptr, "Unknown21"},
40 {22, nullptr, "Unknown11"}, 40 {22, nullptr, "Unknown22"},
41 {23, nullptr, "Unknown12"}, 41 {23, nullptr, "Unknown23"},
42 {24, nullptr, "Unknown13"}, 42 {24, nullptr, "Unknown24"},
43 {25, nullptr, "Unknown14"}, 43 {25, nullptr, "Unknown25"},
44 {26, nullptr, "Unknown15"}, 44 {26, nullptr, "Unknown26"},
45 {27, nullptr, "Unknown16"}, 45 {27, nullptr, "Unknown27"},
46 {28, nullptr, "Unknown28"},
47 {29, nullptr, "Unknown29"},
48 {30, nullptr, "Unknown30"},
46 }; 49 };
47 // clang-format on 50 // clang-format on
48 51
@@ -55,12 +58,12 @@ public:
55 explicit WLANLocal() : ServiceFramework{"wlan:lcl"} { 58 explicit WLANLocal() : ServiceFramework{"wlan:lcl"} {
56 // clang-format off 59 // clang-format off
57 static const FunctionInfo functions[] = { 60 static const FunctionInfo functions[] = {
58 {0, nullptr, "Unknown1"}, 61 {0, nullptr, "Unknown0"},
59 {1, nullptr, "Unknown2"}, 62 {1, nullptr, "Unknown1"},
60 {2, nullptr, "Unknown3"}, 63 {2, nullptr, "Unknown2"},
61 {3, nullptr, "Unknown4"}, 64 {3, nullptr, "Unknown3"},
62 {4, nullptr, "Unknown5"}, 65 {4, nullptr, "Unknown4"},
63 {5, nullptr, "Unknown6"}, 66 {5, nullptr, "Unknown5"},
64 {6, nullptr, "GetMacAddress"}, 67 {6, nullptr, "GetMacAddress"},
65 {7, nullptr, "CreateBss"}, 68 {7, nullptr, "CreateBss"},
66 {8, nullptr, "DestroyBss"}, 69 {8, nullptr, "DestroyBss"},
@@ -72,38 +75,42 @@ public:
72 {14, nullptr, "CancelJoin"}, 75 {14, nullptr, "CancelJoin"},
73 {15, nullptr, "Disconnect"}, 76 {15, nullptr, "Disconnect"},
74 {16, nullptr, "SetBeaconLostCount"}, 77 {16, nullptr, "SetBeaconLostCount"},
75 {17, nullptr, "Unknown7"}, 78 {17, nullptr, "Unknown17"},
76 {18, nullptr, "Unknown8"}, 79 {18, nullptr, "Unknown18"},
77 {19, nullptr, "Unknown9"}, 80 {19, nullptr, "Unknown19"},
78 {20, nullptr, "GetBssIndicationEvent"}, 81 {20, nullptr, "GetBssIndicationEvent"},
79 {21, nullptr, "GetBssIndicationInfo"}, 82 {21, nullptr, "GetBssIndicationInfo"},
80 {22, nullptr, "GetState"}, 83 {22, nullptr, "GetState"},
81 {23, nullptr, "GetAllowedChannels"}, 84 {23, nullptr, "GetAllowedChannels"},
82 {24, nullptr, "AddIe"}, 85 {24, nullptr, "AddIe"},
83 {25, nullptr, "DeleteIe"}, 86 {25, nullptr, "DeleteIe"},
84 {26, nullptr, "Unknown10"}, 87 {26, nullptr, "Unknown26"},
85 {27, nullptr, "Unknown11"}, 88 {27, nullptr, "Unknown27"},
86 {28, nullptr, "CreateRxEntry"}, 89 {28, nullptr, "CreateRxEntry"},
87 {29, nullptr, "DeleteRxEntry"}, 90 {29, nullptr, "DeleteRxEntry"},
88 {30, nullptr, "Unknown12"}, 91 {30, nullptr, "Unknown30"},
89 {31, nullptr, "Unknown13"}, 92 {31, nullptr, "Unknown31"},
90 {32, nullptr, "AddMatchingDataToRxEntry"}, 93 {32, nullptr, "AddMatchingDataToRxEntry"},
91 {33, nullptr, "RemoveMatchingDataFromRxEntry"}, 94 {33, nullptr, "RemoveMatchingDataFromRxEntry"},
92 {34, nullptr, "GetScanResult"}, 95 {34, nullptr, "GetScanResult"},
93 {35, nullptr, "Unknown14"}, 96 {35, nullptr, "Unknown35"},
94 {36, nullptr, "SetActionFrameWithBeacon"}, 97 {36, nullptr, "SetActionFrameWithBeacon"},
95 {37, nullptr, "CancelActionFrameWithBeacon"}, 98 {37, nullptr, "CancelActionFrameWithBeacon"},
96 {38, nullptr, "CreateRxEntryForActionFrame"}, 99 {38, nullptr, "CreateRxEntryForActionFrame"},
97 {39, nullptr, "DeleteRxEntryForActionFrame"}, 100 {39, nullptr, "DeleteRxEntryForActionFrame"},
98 {40, nullptr, "Unknown15"}, 101 {40, nullptr, "Unknown40"},
99 {41, nullptr, "Unknown16"}, 102 {41, nullptr, "Unknown41"},
100 {42, nullptr, "CancelGetActionFrame"}, 103 {42, nullptr, "CancelGetActionFrame"},
101 {43, nullptr, "GetRssi"}, 104 {43, nullptr, "GetRssi"},
102 {44, nullptr, "Unknown17"}, 105 {44, nullptr, "Unknown44"},
103 {45, nullptr, "Unknown18"}, 106 {45, nullptr, "Unknown45"},
104 {46, nullptr, "Unknown19"}, 107 {46, nullptr, "Unknown46"},
105 {47, nullptr, "Unknown20"}, 108 {47, nullptr, "Unknown47"},
106 {48, nullptr, "Unknown21"}, 109 {48, nullptr, "Unknown48"},
110 {49, nullptr, "Unknown49"},
111 {50, nullptr, "Unknown50"},
112 {51, nullptr, "Unknown51"},
113 {52, nullptr, "Unknown52"},
107 }; 114 };
108 // clang-format on 115 // clang-format on
109 116
@@ -142,18 +149,19 @@ public:
142 explicit WLANSocketManager() : ServiceFramework{"wlan:soc"} { 149 explicit WLANSocketManager() : ServiceFramework{"wlan:soc"} {
143 // clang-format off 150 // clang-format off
144 static const FunctionInfo functions[] = { 151 static const FunctionInfo functions[] = {
145 {0, nullptr, "Unknown1"}, 152 {0, nullptr, "Unknown0"},
146 {1, nullptr, "Unknown2"}, 153 {1, nullptr, "Unknown1"},
147 {2, nullptr, "Unknown3"}, 154 {2, nullptr, "Unknown2"},
148 {3, nullptr, "Unknown4"}, 155 {3, nullptr, "Unknown3"},
149 {4, nullptr, "Unknown5"}, 156 {4, nullptr, "Unknown4"},
150 {5, nullptr, "Unknown6"}, 157 {5, nullptr, "Unknown5"},
151 {6, nullptr, "GetMacAddress"}, 158 {6, nullptr, "GetMacAddress"},
152 {7, nullptr, "SwitchTsfTimerFunction"}, 159 {7, nullptr, "SwitchTsfTimerFunction"},
153 {8, nullptr, "Unknown7"}, 160 {8, nullptr, "Unknown8"},
154 {9, nullptr, "Unknown8"}, 161 {9, nullptr, "Unknown9"},
155 {10, nullptr, "Unknown9"}, 162 {10, nullptr, "Unknown10"},
156 {11, nullptr, "Unknown10"}, 163 {11, nullptr, "Unknown11"},
164 {12, nullptr, "Unknown12"},
157 }; 165 };
158 // clang-format on 166 // clang-format on
159 167
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index 3bd76dd23..317c25bad 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -30,7 +30,8 @@ if(SDL2_FOUND)
30 target_compile_definitions(input_common PRIVATE HAVE_SDL2) 30 target_compile_definitions(input_common PRIVATE HAVE_SDL2)
31endif() 31endif()
32 32
33target_link_libraries(input_common PUBLIC ${LIBUSB_LIBRARIES}) 33target_include_directories(input_common SYSTEM PRIVATE ${LIBUSB_INCLUDE_DIR})
34target_link_libraries(input_common PRIVATE ${LIBUSB_LIBRARIES})
34 35
35create_target_directory_groups(input_common) 36create_target_directory_groups(input_common)
36target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost) 37target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost)
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp
index 70d382bcf..38210ffcb 100644
--- a/src/input_common/gcadapter/gc_adapter.cpp
+++ b/src/input_common/gcadapter/gc_adapter.cpp
@@ -4,6 +4,7 @@
4 4
5#include <chrono> 5#include <chrono>
6#include <thread> 6#include <thread>
7#include <libusb.h>
7#include "common/logging/log.h" 8#include "common/logging/log.h"
8#include "input_common/gcadapter/gc_adapter.h" 9#include "input_common/gcadapter/gc_adapter.h"
9 10
diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h
index 250c2275a..120ce4c02 100644
--- a/src/input_common/gcadapter/gc_adapter.h
+++ b/src/input_common/gcadapter/gc_adapter.h
@@ -8,10 +8,13 @@
8#include <mutex> 8#include <mutex>
9#include <thread> 9#include <thread>
10#include <unordered_map> 10#include <unordered_map>
11#include <libusb.h>
12#include "common/common_types.h" 11#include "common/common_types.h"
13#include "common/threadsafe_queue.h" 12#include "common/threadsafe_queue.h"
14 13
14struct libusb_context;
15struct libusb_device;
16struct libusb_device_handle;
17
15namespace GCAdapter { 18namespace GCAdapter {
16 19
17enum { 20enum {
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index fd0af1019..b9d5d0ec3 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -4,7 +4,6 @@
4 4
5#include <memory> 5#include <memory>
6#include <thread> 6#include <thread>
7#include <libusb.h>
8#include "common/param_package.h" 7#include "common/param_package.h"
9#include "input_common/analog_from_button.h" 8#include "input_common/analog_from_button.h"
10#include "input_common/gcadapter/gc_adapter.h" 9#include "input_common/gcadapter/gc_adapter.h"
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp
index da5227058..e63c73c4f 100644
--- a/src/input_common/udp/client.cpp
+++ b/src/input_common/udp/client.cpp
@@ -234,7 +234,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
234 std::function<void(Status)> status_callback, 234 std::function<void(Status)> status_callback,
235 std::function<void(u16, u16, u16, u16)> data_callback) { 235 std::function<void(u16, u16, u16, u16)> data_callback) {
236 236
237 std::thread([=] { 237 std::thread([=, this] {
238 constexpr u16 CALIBRATION_THRESHOLD = 100; 238 constexpr u16 CALIBRATION_THRESHOLD = 100;
239 239
240 u16 min_x{UINT16_MAX}; 240 u16 min_x{UINT16_MAX};
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 380ed532b..7625871c2 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -332,23 +332,23 @@ private:
332 332
333 if constexpr (has_extended_dynamic_state) { 333 if constexpr (has_extended_dynamic_state) {
334 // With extended dynamic states we can specify the length and stride of a vertex buffer 334 // With extended dynamic states we can specify the length and stride of a vertex buffer
335 // std::array<VkDeviceSize, N> sizes; 335 std::array<VkDeviceSize, N> sizes;
336 std::array<u16, N> strides; 336 std::array<u16, N> strides;
337 // std::copy(vertex.sizes.begin(), vertex.sizes.begin() + N, sizes.begin()); 337 std::copy(vertex.sizes.begin(), vertex.sizes.begin() + N, sizes.begin());
338 std::copy(vertex.strides.begin(), vertex.strides.begin() + N, strides.begin()); 338 std::copy(vertex.strides.begin(), vertex.strides.begin() + N, strides.begin());
339 339
340 if constexpr (is_indexed) { 340 if constexpr (is_indexed) {
341 scheduler.Record( 341 scheduler.Record(
342 [buffers, offsets, strides, index = index](vk::CommandBuffer cmdbuf) { 342 [buffers, offsets, sizes, strides, index = index](vk::CommandBuffer cmdbuf) {
343 cmdbuf.BindIndexBuffer(index.buffer, index.offset, index.type); 343 cmdbuf.BindIndexBuffer(index.buffer, index.offset, index.type);
344 cmdbuf.BindVertexBuffers2EXT(0, static_cast<u32>(N), buffers.data(), 344 cmdbuf.BindVertexBuffers2EXT(0, static_cast<u32>(N), buffers.data(),
345 offsets.data(), nullptr, 345 offsets.data(), sizes.data(),
346 ExpandStrides(strides).data()); 346 ExpandStrides(strides).data());
347 }); 347 });
348 } else { 348 } else {
349 scheduler.Record([buffers, offsets, strides](vk::CommandBuffer cmdbuf) { 349 scheduler.Record([buffers, offsets, sizes, strides](vk::CommandBuffer cmdbuf) {
350 cmdbuf.BindVertexBuffers2EXT(0, static_cast<u32>(N), buffers.data(), 350 cmdbuf.BindVertexBuffers2EXT(0, static_cast<u32>(N), buffers.data(),
351 offsets.data(), nullptr, 351 offsets.data(), sizes.data(),
352 ExpandStrides(strides).data()); 352 ExpandStrides(strides).data());
353 }); 353 });
354 } 354 }
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 6b25a7fa0..ff7d9c1fa 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -98,11 +98,13 @@ add_executable(yuzu
98 game_list_p.h 98 game_list_p.h
99 game_list_worker.cpp 99 game_list_worker.cpp
100 game_list_worker.h 100 game_list_worker.h
101 hotkeys.cpp
102 hotkeys.h
103 install_dialog.cpp
104 install_dialog.h
101 loading_screen.cpp 105 loading_screen.cpp
102 loading_screen.h 106 loading_screen.h
103 loading_screen.ui 107 loading_screen.ui
104 hotkeys.cpp
105 hotkeys.h
106 main.cpp 108 main.cpp
107 main.h 109 main.h
108 main.ui 110 main.ui
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index 1fb62d1cf..20316c9cc 100644
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -65,6 +65,8 @@ void ConfigureGeneral::ApplyConfiguration() {
65 Settings::values.use_frame_limit.SetValue(ui->toggle_frame_limit->checkState() == 65 Settings::values.use_frame_limit.SetValue(ui->toggle_frame_limit->checkState() ==
66 Qt::Checked); 66 Qt::Checked);
67 Settings::values.frame_limit.SetValue(ui->frame_limit->value()); 67 Settings::values.frame_limit.SetValue(ui->frame_limit->value());
68 }
69 if (Settings::values.use_multi_core.UsingGlobal()) {
68 Settings::values.use_multi_core.SetValue(ui->use_multi_core->isChecked()); 70 Settings::values.use_multi_core.SetValue(ui->use_multi_core->isChecked());
69 } 71 }
70 } else { 72 } else {
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index bfb600df0..ab7fc7a24 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -531,8 +531,8 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) {
531 UISettings::GameDir& game_dir = 531 UISettings::GameDir& game_dir =
532 *selected.data(GameListDir::GameDirRole).value<UISettings::GameDir*>(); 532 *selected.data(GameListDir::GameDirRole).value<UISettings::GameDir*>();
533 533
534 QAction* move_up = context_menu.addAction(tr(u8"\U000025b2 Move Up")); 534 QAction* move_up = context_menu.addAction(tr("\u25B2 Move Up"));
535 QAction* move_down = context_menu.addAction(tr(u8"\U000025bc Move Down ")); 535 QAction* move_down = context_menu.addAction(tr("\u25bc Move Down"));
536 QAction* open_directory_location = context_menu.addAction(tr("Open Directory Location")); 536 QAction* open_directory_location = context_menu.addAction(tr("Open Directory Location"));
537 537
538 const int row = selected.row(); 538 const int row = selected.row();
diff --git a/src/yuzu/install_dialog.cpp b/src/yuzu/install_dialog.cpp
new file mode 100644
index 000000000..06b0b1874
--- /dev/null
+++ b/src/yuzu/install_dialog.cpp
@@ -0,0 +1,72 @@
1// Copyright 2020 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <QCheckBox>
6#include <QDialogButtonBox>
7#include <QFileInfo>
8#include <QHBoxLayout>
9#include <QLabel>
10#include <QListWidget>
11#include <QVBoxLayout>
12#include "yuzu/install_dialog.h"
13#include "yuzu/uisettings.h"
14
15InstallDialog::InstallDialog(QWidget* parent, const QStringList& files) : QDialog(parent) {
16 file_list = new QListWidget(this);
17
18 for (const QString& file : files) {
19 QListWidgetItem* item = new QListWidgetItem(QFileInfo(file).fileName(), file_list);
20 item->setData(Qt::UserRole, file);
21 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
22 item->setCheckState(Qt::Checked);
23 }
24
25 file_list->setMinimumWidth((file_list->sizeHintForColumn(0) * 11) / 10);
26
27 vbox_layout = new QVBoxLayout;
28
29 hbox_layout = new QHBoxLayout;
30
31 description = new QLabel(tr("Please confirm these are the files you wish to install."));
32
33 update_description =
34 new QLabel(tr("Installing an Update or DLC will overwrite the previously installed one."));
35
36 buttons = new QDialogButtonBox;
37 buttons->addButton(QDialogButtonBox::Cancel);
38 buttons->addButton(tr("Install"), QDialogButtonBox::AcceptRole);
39
40 connect(buttons, &QDialogButtonBox::accepted, this, &InstallDialog::accept);
41 connect(buttons, &QDialogButtonBox::rejected, this, &InstallDialog::reject);
42
43 hbox_layout->addWidget(buttons);
44
45 vbox_layout->addWidget(description);
46 vbox_layout->addWidget(update_description);
47 vbox_layout->addWidget(file_list);
48 vbox_layout->addLayout(hbox_layout);
49
50 setLayout(vbox_layout);
51 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
52 setWindowTitle(tr("Install Files to NAND"));
53}
54
55InstallDialog::~InstallDialog() = default;
56
57QStringList InstallDialog::GetFiles() const {
58 QStringList files;
59
60 for (int i = 0; i < file_list->count(); ++i) {
61 const QListWidgetItem* item = file_list->item(i);
62 if (item->checkState() == Qt::Checked) {
63 files.append(item->data(Qt::UserRole).toString());
64 }
65 }
66
67 return files;
68}
69
70int InstallDialog::GetMinimumWidth() const {
71 return file_list->width();
72}
diff --git a/src/yuzu/install_dialog.h b/src/yuzu/install_dialog.h
new file mode 100644
index 000000000..e4aba1b06
--- /dev/null
+++ b/src/yuzu/install_dialog.h
@@ -0,0 +1,36 @@
1// Copyright 2020 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <QDialog>
8
9class QCheckBox;
10class QDialogButtonBox;
11class QHBoxLayout;
12class QLabel;
13class QListWidget;
14class QVBoxLayout;
15
16class InstallDialog : public QDialog {
17 Q_OBJECT
18
19public:
20 explicit InstallDialog(QWidget* parent, const QStringList& files);
21 ~InstallDialog() override;
22
23 QStringList GetFiles() const;
24 bool ShouldOverwriteFiles() const;
25 int GetMinimumWidth() const;
26
27private:
28 QListWidget* file_list;
29
30 QVBoxLayout* vbox_layout;
31 QHBoxLayout* hbox_layout;
32
33 QLabel* description;
34 QLabel* update_description;
35 QDialogButtonBox* buttons;
36};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 4d501a8f9..432379705 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -107,6 +107,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
107#include "yuzu/game_list.h" 107#include "yuzu/game_list.h"
108#include "yuzu/game_list_p.h" 108#include "yuzu/game_list_p.h"
109#include "yuzu/hotkeys.h" 109#include "yuzu/hotkeys.h"
110#include "yuzu/install_dialog.h"
110#include "yuzu/loading_screen.h" 111#include "yuzu/loading_screen.h"
111#include "yuzu/main.h" 112#include "yuzu/main.h"
112#include "yuzu/uisettings.h" 113#include "yuzu/uisettings.h"
@@ -847,6 +848,9 @@ void GMainWindow::ConnectWidgetEvents() {
847 connect(game_list, &GameList::OpenPerGameGeneralRequested, this, 848 connect(game_list, &GameList::OpenPerGameGeneralRequested, this,
848 &GMainWindow::OnGameListOpenPerGameProperties); 849 &GMainWindow::OnGameListOpenPerGameProperties);
849 850
851 connect(this, &GMainWindow::UpdateInstallProgress, this,
852 &GMainWindow::IncrementInstallProgress);
853
850 connect(this, &GMainWindow::EmulationStarting, render_window, 854 connect(this, &GMainWindow::EmulationStarting, render_window,
851 &GRenderWindow::OnEmulationStarting); 855 &GRenderWindow::OnEmulationStarting);
852 connect(this, &GMainWindow::EmulationStopping, render_window, 856 connect(this, &GMainWindow::EmulationStopping, render_window,
@@ -1593,187 +1597,255 @@ void GMainWindow::OnMenuLoadFolder() {
1593 } 1597 }
1594} 1598}
1595 1599
1600void GMainWindow::IncrementInstallProgress() {
1601 install_progress->setValue(install_progress->value() + 1);
1602}
1603
1596void GMainWindow::OnMenuInstallToNAND() { 1604void GMainWindow::OnMenuInstallToNAND() {
1597 const QString file_filter = 1605 const QString file_filter =
1598 tr("Installable Switch File (*.nca *.nsp *.xci);;Nintendo Content Archive " 1606 tr("Installable Switch File (*.nca *.nsp *.xci);;Nintendo Content Archive "
1599 "(*.nca);;Nintendo Submissions Package (*.nsp);;NX Cartridge " 1607 "(*.nca);;Nintendo Submission Package (*.nsp);;NX Cartridge "
1600 "Image (*.xci)"); 1608 "Image (*.xci)");
1601 QString filename = QFileDialog::getOpenFileName(this, tr("Install File"),
1602 UISettings::values.roms_path, file_filter);
1603 1609
1604 if (filename.isEmpty()) { 1610 QStringList filenames = QFileDialog::getOpenFileNames(
1611 this, tr("Install Files"), UISettings::values.roms_path, file_filter);
1612
1613 if (filenames.isEmpty()) {
1605 return; 1614 return;
1606 } 1615 }
1607 1616
1617 InstallDialog installDialog(this, filenames);
1618 if (installDialog.exec() == QDialog::Rejected) {
1619 return;
1620 }
1621
1622 const QStringList files = installDialog.GetFiles();
1623
1624 if (files.isEmpty()) {
1625 return;
1626 }
1627
1628 int remaining = filenames.size();
1629
1630 // This would only overflow above 2^43 bytes (8.796 TB)
1631 int total_size = 0;
1632 for (const QString& file : files) {
1633 total_size += static_cast<int>(QFile(file).size() / 0x1000);
1634 }
1635 if (total_size < 0) {
1636 LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting.");
1637 return;
1638 }
1639
1640 QStringList new_files{}; // Newly installed files that do not yet exist in the NAND
1641 QStringList overwritten_files{}; // Files that overwrote those existing in the NAND
1642 QStringList failed_files{}; // Files that failed to install due to errors
1643
1644 ui.action_Install_File_NAND->setEnabled(false);
1645
1646 install_progress = new QProgressDialog(QStringLiteral(""), tr("Cancel"), 0, total_size, this);
1647 install_progress->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint &
1648 ~Qt::WindowMaximizeButtonHint);
1649 install_progress->setAttribute(Qt::WA_DeleteOnClose, true);
1650 install_progress->setFixedWidth(installDialog.GetMinimumWidth() + 40);
1651 install_progress->show();
1652
1653 for (const QString& file : files) {
1654 install_progress->setWindowTitle(tr("%n file(s) remaining", "", remaining));
1655 install_progress->setLabelText(
1656 tr("Installing file \"%1\"...").arg(QFileInfo(file).fileName()));
1657
1658 QFuture<InstallResult> future;
1659 InstallResult result;
1660
1661 if (file.endsWith(QStringLiteral("xci"), Qt::CaseInsensitive) ||
1662 file.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
1663
1664 future = QtConcurrent::run([this, &file] { return InstallNSPXCI(file); });
1665
1666 while (!future.isFinished()) {
1667 QCoreApplication::processEvents();
1668 }
1669
1670 result = future.result();
1671
1672 } else {
1673 result = InstallNCA(file);
1674 }
1675
1676 std::this_thread::sleep_for(std::chrono::milliseconds(10));
1677
1678 switch (result) {
1679 case InstallResult::Success:
1680 new_files.append(QFileInfo(file).fileName());
1681 break;
1682 case InstallResult::Overwrite:
1683 overwritten_files.append(QFileInfo(file).fileName());
1684 break;
1685 case InstallResult::Failure:
1686 failed_files.append(QFileInfo(file).fileName());
1687 break;
1688 }
1689
1690 --remaining;
1691 }
1692
1693 install_progress->close();
1694
1695 const QString install_results =
1696 (new_files.isEmpty() ? QStringLiteral("")
1697 : tr("%n file(s) were newly installed\n", "", new_files.size())) +
1698 (overwritten_files.isEmpty()
1699 ? QStringLiteral("")
1700 : tr("%n file(s) were overwritten\n", "", overwritten_files.size())) +
1701 (failed_files.isEmpty() ? QStringLiteral("")
1702 : tr("%n file(s) failed to install\n", "", failed_files.size()));
1703
1704 QMessageBox::information(this, tr("Install Results"), install_results);
1705 game_list->PopulateAsync(UISettings::values.game_dirs);
1706 FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + DIR_SEP +
1707 "game_list");
1708 ui.action_Install_File_NAND->setEnabled(true);
1709}
1710
1711InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
1608 const auto qt_raw_copy = [this](const FileSys::VirtualFile& src, 1712 const auto qt_raw_copy = [this](const FileSys::VirtualFile& src,
1609 const FileSys::VirtualFile& dest, std::size_t block_size) { 1713 const FileSys::VirtualFile& dest, std::size_t block_size) {
1610 if (src == nullptr || dest == nullptr) 1714 if (src == nullptr || dest == nullptr) {
1611 return false; 1715 return false;
1612 if (!dest->Resize(src->GetSize())) 1716 }
1717 if (!dest->Resize(src->GetSize())) {
1613 return false; 1718 return false;
1719 }
1614 1720
1615 std::array<u8, 0x1000> buffer{}; 1721 std::array<u8, 0x1000> buffer{};
1616 const int progress_maximum = static_cast<int>(src->GetSize() / buffer.size());
1617
1618 QProgressDialog progress(
1619 tr("Installing file \"%1\"...").arg(QString::fromStdString(src->GetName())),
1620 tr("Cancel"), 0, progress_maximum, this);
1621 progress.setWindowModality(Qt::WindowModal);
1622 1722
1623 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { 1723 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
1624 if (progress.wasCanceled()) { 1724 if (install_progress->wasCanceled()) {
1625 dest->Resize(0); 1725 dest->Resize(0);
1626 return false; 1726 return false;
1627 } 1727 }
1628 1728
1629 const int progress_value = static_cast<int>(i / buffer.size()); 1729 emit UpdateInstallProgress();
1630 progress.setValue(progress_value);
1631 1730
1632 const auto read = src->Read(buffer.data(), buffer.size(), i); 1731 const auto read = src->Read(buffer.data(), buffer.size(), i);
1633 dest->Write(buffer.data(), read, i); 1732 dest->Write(buffer.data(), read, i);
1634 } 1733 }
1635
1636 return true; 1734 return true;
1637 }; 1735 };
1638 1736
1639 const auto success = [this]() { 1737 std::shared_ptr<FileSys::NSP> nsp;
1640 QMessageBox::information(this, tr("Successfully Installed"), 1738 if (filename.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
1641 tr("The file was successfully installed.")); 1739 nsp = std::make_shared<FileSys::NSP>(
1642 game_list->PopulateAsync(UISettings::values.game_dirs); 1740 vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
1643 FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir) + 1741 if (nsp->IsExtractedType()) {
1644 DIR_SEP + "game_list"); 1742 return InstallResult::Failure;
1645 };
1646
1647 const auto failed = [this]() {
1648 QMessageBox::warning(
1649 this, tr("Failed to Install"),
1650 tr("There was an error while attempting to install the provided file. It "
1651 "could have an incorrect format or be missing metadata. Please "
1652 "double-check your file and try again."));
1653 };
1654
1655 const auto overwrite = [this]() {
1656 return QMessageBox::question(this, tr("Failed to Install"),
1657 tr("The file you are attempting to install already exists "
1658 "in the cache. Would you like to overwrite it?")) ==
1659 QMessageBox::Yes;
1660 };
1661
1662 if (filename.endsWith(QStringLiteral("xci"), Qt::CaseInsensitive) ||
1663 filename.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
1664 std::shared_ptr<FileSys::NSP> nsp;
1665 if (filename.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
1666 nsp = std::make_shared<FileSys::NSP>(
1667 vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
1668 if (nsp->IsExtractedType())
1669 failed();
1670 } else {
1671 const auto xci = std::make_shared<FileSys::XCI>(
1672 vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
1673 nsp = xci->GetSecurePartitionNSP();
1674 }
1675
1676 if (nsp->GetStatus() != Loader::ResultStatus::Success) {
1677 failed();
1678 return;
1679 }
1680 const auto res = Core::System::GetInstance()
1681 .GetFileSystemController()
1682 .GetUserNANDContents()
1683 ->InstallEntry(*nsp, false, qt_raw_copy);
1684 if (res == FileSys::InstallResult::Success) {
1685 success();
1686 } else {
1687 if (res == FileSys::InstallResult::ErrorAlreadyExists) {
1688 if (overwrite()) {
1689 const auto res2 = Core::System::GetInstance()
1690 .GetFileSystemController()
1691 .GetUserNANDContents()
1692 ->InstallEntry(*nsp, true, qt_raw_copy);
1693 if (res2 == FileSys::InstallResult::Success) {
1694 success();
1695 } else {
1696 failed();
1697 }
1698 }
1699 } else {
1700 failed();
1701 }
1702 } 1743 }
1703 } else { 1744 } else {
1704 const auto nca = std::make_shared<FileSys::NCA>( 1745 const auto xci = std::make_shared<FileSys::XCI>(
1705 vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read)); 1746 vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
1706 const auto id = nca->GetStatus(); 1747 nsp = xci->GetSecurePartitionNSP();
1748 }
1707 1749
1708 // Game updates necessary are missing base RomFS 1750 if (nsp->GetStatus() != Loader::ResultStatus::Success) {
1709 if (id != Loader::ResultStatus::Success && 1751 return InstallResult::Failure;
1710 id != Loader::ResultStatus::ErrorMissingBKTRBaseRomFS) { 1752 }
1711 failed(); 1753 const auto res =
1712 return; 1754 Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->InstallEntry(
1713 } 1755 *nsp, true, qt_raw_copy);
1756 if (res == FileSys::InstallResult::Success) {
1757 return InstallResult::Success;
1758 } else if (res == FileSys::InstallResult::ErrorAlreadyExists) {
1759 return InstallResult::Overwrite;
1760 } else {
1761 return InstallResult::Failure;
1762 }
1763}
1714 1764
1715 const QStringList tt_options{tr("System Application"), 1765InstallResult GMainWindow::InstallNCA(const QString& filename) {
1716 tr("System Archive"), 1766 const auto qt_raw_copy = [this](const FileSys::VirtualFile& src,
1717 tr("System Application Update"), 1767 const FileSys::VirtualFile& dest, std::size_t block_size) {
1718 tr("Firmware Package (Type A)"), 1768 if (src == nullptr || dest == nullptr) {
1719 tr("Firmware Package (Type B)"), 1769 return false;
1720 tr("Game"),
1721 tr("Game Update"),
1722 tr("Game DLC"),
1723 tr("Delta Title")};
1724 bool ok;
1725 const auto item = QInputDialog::getItem(
1726 this, tr("Select NCA Install Type..."),
1727 tr("Please select the type of title you would like to install this NCA as:\n(In "
1728 "most instances, the default 'Game' is fine.)"),
1729 tt_options, 5, false, &ok);
1730
1731 auto index = tt_options.indexOf(item);
1732 if (!ok || index == -1) {
1733 QMessageBox::warning(this, tr("Failed to Install"),
1734 tr("The title type you selected for the NCA is invalid."));
1735 return;
1736 } 1770 }
1737 1771 if (!dest->Resize(src->GetSize())) {
1738 // If index is equal to or past Game, add the jump in TitleType. 1772 return false;
1739 if (index >= 5) {
1740 index += static_cast<size_t>(FileSys::TitleType::Application) -
1741 static_cast<size_t>(FileSys::TitleType::FirmwarePackageB);
1742 } 1773 }
1743 1774
1744 FileSys::InstallResult res; 1775 std::array<u8, 0x1000> buffer{};
1745 if (index >= static_cast<s32>(FileSys::TitleType::Application)) {
1746 res = Core::System::GetInstance()
1747 .GetFileSystemController()
1748 .GetUserNANDContents()
1749 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), false,
1750 qt_raw_copy);
1751 } else {
1752 res = Core::System::GetInstance()
1753 .GetFileSystemController()
1754 .GetSystemNANDContents()
1755 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), false,
1756 qt_raw_copy);
1757 }
1758 1776
1759 if (res == FileSys::InstallResult::Success) { 1777 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
1760 success(); 1778 if (install_progress->wasCanceled()) {
1761 } else if (res == FileSys::InstallResult::ErrorAlreadyExists) { 1779 dest->Resize(0);
1762 if (overwrite()) { 1780 return false;
1763 const auto res2 = Core::System::GetInstance()
1764 .GetFileSystemController()
1765 .GetUserNANDContents()
1766 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index),
1767 true, qt_raw_copy);
1768 if (res2 == FileSys::InstallResult::Success) {
1769 success();
1770 } else {
1771 failed();
1772 }
1773 } 1781 }
1774 } else { 1782
1775 failed(); 1783 emit UpdateInstallProgress();
1784
1785 const auto read = src->Read(buffer.data(), buffer.size(), i);
1786 dest->Write(buffer.data(), read, i);
1776 } 1787 }
1788 return true;
1789 };
1790
1791 const auto nca =
1792 std::make_shared<FileSys::NCA>(vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
1793 const auto id = nca->GetStatus();
1794
1795 // Game updates necessary are missing base RomFS
1796 if (id != Loader::ResultStatus::Success &&
1797 id != Loader::ResultStatus::ErrorMissingBKTRBaseRomFS) {
1798 return InstallResult::Failure;
1799 }
1800
1801 const QStringList tt_options{tr("System Application"),
1802 tr("System Archive"),
1803 tr("System Application Update"),
1804 tr("Firmware Package (Type A)"),
1805 tr("Firmware Package (Type B)"),
1806 tr("Game"),
1807 tr("Game Update"),
1808 tr("Game DLC"),
1809 tr("Delta Title")};
1810 bool ok;
1811 const auto item = QInputDialog::getItem(
1812 this, tr("Select NCA Install Type..."),
1813 tr("Please select the type of title you would like to install this NCA as:\n(In "
1814 "most instances, the default 'Game' is fine.)"),
1815 tt_options, 5, false, &ok);
1816
1817 auto index = tt_options.indexOf(item);
1818 if (!ok || index == -1) {
1819 QMessageBox::warning(this, tr("Failed to Install"),
1820 tr("The title type you selected for the NCA is invalid."));
1821 return InstallResult::Failure;
1822 }
1823
1824 // If index is equal to or past Game, add the jump in TitleType.
1825 if (index >= 5) {
1826 index += static_cast<size_t>(FileSys::TitleType::Application) -
1827 static_cast<size_t>(FileSys::TitleType::FirmwarePackageB);
1828 }
1829
1830 FileSys::InstallResult res;
1831 if (index >= static_cast<s32>(FileSys::TitleType::Application)) {
1832 res = Core::System::GetInstance()
1833 .GetFileSystemController()
1834 .GetUserNANDContents()
1835 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
1836 } else {
1837 res = Core::System::GetInstance()
1838 .GetFileSystemController()
1839 .GetSystemNANDContents()
1840 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
1841 }
1842
1843 if (res == FileSys::InstallResult::Success) {
1844 return InstallResult::Success;
1845 } else if (res == FileSys::InstallResult::ErrorAlreadyExists) {
1846 return InstallResult::Overwrite;
1847 } else {
1848 return InstallResult::Failure;
1777 } 1849 }
1778} 1850}
1779 1851
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 8e3d39c38..adff65fb5 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -28,6 +28,7 @@ class MicroProfileDialog;
28class ProfilerWidget; 28class ProfilerWidget;
29class QLabel; 29class QLabel;
30class QPushButton; 30class QPushButton;
31class QProgressDialog;
31class WaitTreeWidget; 32class WaitTreeWidget;
32enum class GameListOpenTarget; 33enum class GameListOpenTarget;
33class GameListPlaceholder; 34class GameListPlaceholder;
@@ -47,6 +48,12 @@ enum class EmulatedDirectoryTarget {
47 SDMC, 48 SDMC,
48}; 49};
49 50
51enum class InstallResult {
52 Success,
53 Overwrite,
54 Failure,
55};
56
50enum class ReinitializeKeyBehavior { 57enum class ReinitializeKeyBehavior {
51 NoWarning, 58 NoWarning,
52 Warning, 59 Warning,
@@ -102,6 +109,8 @@ signals:
102 // Signal that tells widgets to update icons to use the current theme 109 // Signal that tells widgets to update icons to use the current theme
103 void UpdateThemedIcons(); 110 void UpdateThemedIcons();
104 111
112 void UpdateInstallProgress();
113
105 void ErrorDisplayFinished(); 114 void ErrorDisplayFinished();
106 115
107 void ProfileSelectorFinishedSelection(std::optional<Common::UUID> uuid); 116 void ProfileSelectorFinishedSelection(std::optional<Common::UUID> uuid);
@@ -198,6 +207,7 @@ private slots:
198 void OnGameListOpenPerGameProperties(const std::string& file); 207 void OnGameListOpenPerGameProperties(const std::string& file);
199 void OnMenuLoadFile(); 208 void OnMenuLoadFile();
200 void OnMenuLoadFolder(); 209 void OnMenuLoadFolder();
210 void IncrementInstallProgress();
201 void OnMenuInstallToNAND(); 211 void OnMenuInstallToNAND();
202 void OnMenuRecentFile(); 212 void OnMenuRecentFile();
203 void OnConfigure(); 213 void OnConfigure();
@@ -218,6 +228,8 @@ private slots:
218 228
219private: 229private:
220 std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); 230 std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id);
231 InstallResult InstallNSPXCI(const QString& filename);
232 InstallResult InstallNCA(const QString& filename);
221 void UpdateWindowTitle(const std::string& title_name = {}, 233 void UpdateWindowTitle(const std::string& title_name = {},
222 const std::string& title_version = {}); 234 const std::string& title_version = {});
223 void UpdateStatusBar(); 235 void UpdateStatusBar();
@@ -272,6 +284,9 @@ private:
272 284
273 HotkeyRegistry hotkey_registry; 285 HotkeyRegistry hotkey_registry;
274 286
287 // Install progress dialog
288 QProgressDialog* install_progress;
289
275protected: 290protected:
276 void dropEvent(QDropEvent* event) override; 291 void dropEvent(QDropEvent* event) override;
277 void dragEnterEvent(QDragEnterEvent* event) override; 292 void dragEnterEvent(QDragEnterEvent* event) override;
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui
index bee6e107e..c3a1d715e 100644
--- a/src/yuzu/main.ui
+++ b/src/yuzu/main.ui
@@ -130,7 +130,7 @@
130 <bool>true</bool> 130 <bool>true</bool>
131 </property> 131 </property>
132 <property name="text"> 132 <property name="text">
133 <string>Install File to NAND...</string> 133 <string>Install Files to NAND...</string>
134 </property> 134 </property>
135 </action> 135 </action>
136 <action name="action_Load_File"> 136 <action name="action_Load_File">