summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/logging/backend.cpp1
-rw-r--r--src/common/logging/log.h1
-rw-r--r--src/common/threadsafe_queue.h10
-rw-r--r--src/core/core.cpp2
-rw-r--r--src/core/hle/kernel/k_scheduler.h4
-rw-r--r--src/core/hle/kernel/k_scoped_lock.h13
-rw-r--r--src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h4
-rw-r--r--src/core/hle/kernel/kernel.cpp4
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp2
-rw-r--r--src/core/hle/service/btdrv/btdrv.cpp19
-rw-r--r--src/core/hle/service/btm/btm.cpp1
-rw-r--r--src/core/hle/service/erpt/erpt.cpp7
-rw-r--r--src/core/hle/service/friend/friend.cpp14
-rw-r--r--src/core/hle/service/glue/bgtc.cpp27
-rw-r--r--src/core/hle/service/glue/bgtc.h8
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp4
-rw-r--r--src/core/hle/service/hid/controllers/npad.h2
-rw-r--r--src/core/hle/service/hid/hid.cpp106
-rw-r--r--src/core/hle/service/hid/hid.h1
-rw-r--r--src/core/hle/service/hid/xcd.cpp2
-rw-r--r--src/core/hle/service/nim/nim.cpp99
-rw-r--r--src/core/hle/service/npns/npns.cpp3
-rw-r--r--src/core/hle/service/ns/ns.cpp41
-rw-r--r--src/core/hle/service/vi/vi.cpp8
-rw-r--r--src/video_core/gpu.cpp4
-rw-r--r--src/video_core/gpu.h4
-rw-r--r--src/video_core/gpu_thread.cpp62
-rw-r--r--src/video_core/gpu_thread.h15
28 files changed, 373 insertions, 95 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 2d4d2e9e7..4575df24d 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -212,6 +212,7 @@ void DebuggerBackend::Write(const Entry& entry) {
212 SUB(Service, ARP) \ 212 SUB(Service, ARP) \
213 SUB(Service, BCAT) \ 213 SUB(Service, BCAT) \
214 SUB(Service, BPC) \ 214 SUB(Service, BPC) \
215 SUB(Service, BGTC) \
215 SUB(Service, BTDRV) \ 216 SUB(Service, BTDRV) \
216 SUB(Service, BTM) \ 217 SUB(Service, BTM) \
217 SUB(Service, Capture) \ 218 SUB(Service, Capture) \
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 835894918..3d7b7dab7 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -66,6 +66,7 @@ enum class Class : ClassType {
66 Service_ARP, ///< The ARP service 66 Service_ARP, ///< The ARP service
67 Service_Audio, ///< The Audio (Audio control) service 67 Service_Audio, ///< The Audio (Audio control) service
68 Service_BCAT, ///< The BCAT service 68 Service_BCAT, ///< The BCAT service
69 Service_BGTC, ///< The BGTC (Background Task Controller) service
69 Service_BPC, ///< The BPC service 70 Service_BPC, ///< The BPC service
70 Service_BTDRV, ///< The Bluetooth driver service 71 Service_BTDRV, ///< The Bluetooth driver service
71 Service_BTM, ///< The BTM service 72 Service_BTM, ///< The BTM service
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h
index a4647314a..ad04df8ca 100644
--- a/src/common/threadsafe_queue.h
+++ b/src/common/threadsafe_queue.h
@@ -83,11 +83,15 @@ public:
83 return true; 83 return true;
84 } 84 }
85 85
86 T PopWait() { 86 void Wait() {
87 if (Empty()) { 87 if (Empty()) {
88 std::unique_lock lock{cv_mutex}; 88 std::unique_lock lock{cv_mutex};
89 cv.wait(lock, [this]() { return !Empty(); }); 89 cv.wait(lock, [this]() { return !Empty(); });
90 } 90 }
91 }
92
93 T PopWait() {
94 Wait();
91 T t; 95 T t;
92 Pop(t); 96 Pop(t);
93 return t; 97 return t;
@@ -156,6 +160,10 @@ public:
156 return spsc_queue.Pop(t); 160 return spsc_queue.Pop(t);
157 } 161 }
158 162
163 void Wait() {
164 spsc_queue.Wait();
165 }
166
159 T PopWait() { 167 T PopWait() {
160 return spsc_queue.PopWait(); 168 return spsc_queue.PopWait();
161 } 169 }
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 305f56ff1..56b47e671 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -296,7 +296,7 @@ struct System::Impl {
296 exit_lock = false; 296 exit_lock = false;
297 297
298 if (gpu_core) { 298 if (gpu_core) {
299 gpu_core->WaitIdle(); 299 gpu_core->ShutDown();
300 } 300 }
301 301
302 services.reset(); 302 services.reset();
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h
index f595b9a5c..70d6bfcee 100644
--- a/src/core/hle/kernel/k_scheduler.h
+++ b/src/core/hle/kernel/k_scheduler.h
@@ -198,9 +198,9 @@ private:
198 Common::SpinLock guard{}; 198 Common::SpinLock guard{};
199}; 199};
200 200
201class KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { 201class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> {
202public: 202public:
203 explicit KScopedSchedulerLock(KernelCore& kernel); 203 explicit KScopedSchedulerLock(KernelCore & kernel);
204 ~KScopedSchedulerLock(); 204 ~KScopedSchedulerLock();
205}; 205};
206 206
diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h
index d7cc557b2..72c3b0252 100644
--- a/src/core/hle/kernel/k_scoped_lock.h
+++ b/src/core/hle/kernel/k_scoped_lock.h
@@ -20,19 +20,22 @@ concept KLockable = !std::is_reference_v<T> && requires(T & t) {
20}; 20};
21 21
22template <typename T> 22template <typename T>
23requires KLockable<T> class KScopedLock { 23requires KLockable<T> class [[nodiscard]] KScopedLock {
24public: 24public:
25 explicit KScopedLock(T* l) : lock_ptr(l) { 25 explicit KScopedLock(T * l) : lock_ptr(l) {
26 this->lock_ptr->Lock(); 26 this->lock_ptr->Lock();
27 } 27 }
28 explicit KScopedLock(T& l) : KScopedLock(std::addressof(l)) { /* ... */ 28 explicit KScopedLock(T & l) : KScopedLock(std::addressof(l)) {}
29 } 29
30 ~KScopedLock() { 30 ~KScopedLock() {
31 this->lock_ptr->Unlock(); 31 this->lock_ptr->Unlock();
32 } 32 }
33 33
34 KScopedLock(const KScopedLock&) = delete; 34 KScopedLock(const KScopedLock&) = delete;
35 KScopedLock(KScopedLock&&) = delete; 35 KScopedLock& operator=(const KScopedLock&) = delete;
36
37 KScopedLock(KScopedLock &&) = delete;
38 KScopedLock& operator=(KScopedLock&&) = delete;
36 39
37private: 40private:
38 T* lock_ptr; 41 T* lock_ptr;
diff --git a/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h b/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h
index f8189e107..ebecf0c77 100644
--- a/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h
+++ b/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h
@@ -15,9 +15,9 @@
15 15
16namespace Kernel { 16namespace Kernel {
17 17
18class KScopedSchedulerLockAndSleep { 18class [[nodiscard]] KScopedSchedulerLockAndSleep {
19public: 19public:
20 explicit KScopedSchedulerLockAndSleep(KernelCore& kernel, KThread* t, s64 timeout) 20 explicit KScopedSchedulerLockAndSleep(KernelCore & kernel, KThread * t, s64 timeout)
21 : kernel(kernel), thread(t), timeout_tick(timeout) { 21 : kernel(kernel), thread(t), timeout_tick(timeout) {
22 // Lock the scheduler. 22 // Lock the scheduler.
23 kernel.GlobalSchedulerContext().scheduler_lock.Lock(); 23 kernel.GlobalSchedulerContext().scheduler_lock.Lock();
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 5b6c7792e..a1520e147 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -143,10 +143,10 @@ struct KernelCore::Impl {
143 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::PhysicalMemory, 0x100000000) 143 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::PhysicalMemory, 0x100000000)
144 .IsSuccess()); 144 .IsSuccess());
145 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Threads, 800).IsSuccess()); 145 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Threads, 800).IsSuccess());
146 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Events, 700).IsSuccess()); 146 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Events, 900).IsSuccess());
147 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::TransferMemory, 200) 147 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::TransferMemory, 200)
148 .IsSuccess()); 148 .IsSuccess());
149 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Sessions, 933).IsSuccess()); 149 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Sessions, 1133).IsSuccess());
150 150
151 // Derived from recent software updates. The kernel reserves 27MB 151 // Derived from recent software updates. The kernel reserves 27MB
152 constexpr u64 kernel_size{0x1b00000}; 152 constexpr u64 kernel_size{0x1b00000};
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index 8d657c0bf..0f51e5871 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -118,8 +118,10 @@ AOC_U::AOC_U(Core::System& system_)
118 {7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"}, 118 {7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"},
119 {8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"}, 119 {8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"},
120 {9, nullptr, "GetAddOnContentLostErrorCode"}, 120 {9, nullptr, "GetAddOnContentLostErrorCode"},
121 {10, nullptr, "GetAddOnContentListChangedEventWithProcessId"},
121 {100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"}, 122 {100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"},
122 {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, 123 {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"},
124 {110, nullptr, "CreateContentsServiceManager"},
123 }; 125 };
124 // clang-format on 126 // clang-format on
125 127
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp
index 17a2ac899..af3a5842d 100644
--- a/src/core/hle/service/btdrv/btdrv.cpp
+++ b/src/core/hle/service/btdrv/btdrv.cpp
@@ -156,6 +156,25 @@ public:
156 {97, nullptr, "RegisterBleHidEvent"}, 156 {97, nullptr, "RegisterBleHidEvent"},
157 {98, nullptr, "SetBleScanParameter"}, 157 {98, nullptr, "SetBleScanParameter"},
158 {99, nullptr, "MoveToSecondaryPiconet"}, 158 {99, nullptr, "MoveToSecondaryPiconet"},
159 {100, nullptr, "IsBluetoothEnabled"},
160 {128, nullptr, "AcquireAudioEvent"},
161 {129, nullptr, "GetAudioEventInfo"},
162 {130, nullptr, "OpenAudioConnection"},
163 {131, nullptr, "CloseAudioConnection"},
164 {132, nullptr, "OpenAudioOut"},
165 {133, nullptr, "CloseAudioOut"},
166 {134, nullptr, "AcquireAudioOutStateChangedEvent"},
167 {135, nullptr, "StartAudioOut"},
168 {136, nullptr, "StopAudioOut"},
169 {137, nullptr, "GetAudioOutState"},
170 {138, nullptr, "GetAudioOutFeedingCodec"},
171 {139, nullptr, "GetAudioOutFeedingParameter"},
172 {140, nullptr, "AcquireAudioOutBufferAvailableEvent"},
173 {141, nullptr, "SendAudioData"},
174 {142, nullptr, "AcquireAudioControlInputStateChangedEvent"},
175 {143, nullptr, "GetAudioControlInputState"},
176 {144, nullptr, "AcquireAudioConnectionStateChangedEvent"},
177 {145, nullptr, "GetConnectedAudioDevice"},
159 {256, nullptr, "IsManufacturingMode"}, 178 {256, nullptr, "IsManufacturingMode"},
160 {257, nullptr, "EmulateBluetoothCrash"}, 179 {257, nullptr, "EmulateBluetoothCrash"},
161 {258, nullptr, "GetBleChannelMap"}, 180 {258, nullptr, "GetBleChannelMap"},
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp
index 9cf2ee92a..d1ebc2388 100644
--- a/src/core/hle/service/btm/btm.cpp
+++ b/src/core/hle/service/btm/btm.cpp
@@ -223,6 +223,7 @@ public:
223 {10, nullptr, "GetGattClientDisconnectionReason"}, 223 {10, nullptr, "GetGattClientDisconnectionReason"},
224 {11, nullptr, "GetBleConnectionParameter"}, 224 {11, nullptr, "GetBleConnectionParameter"},
225 {12, nullptr, "GetBleConnectionParameterRequest"}, 225 {12, nullptr, "GetBleConnectionParameterRequest"},
226 {13, nullptr, "Unknown13"},
226 }; 227 };
227 // clang-format on 228 // clang-format on
228 229
diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp
index 4924c61c3..c767926a4 100644
--- a/src/core/hle/service/erpt/erpt.cpp
+++ b/src/core/hle/service/erpt/erpt.cpp
@@ -16,7 +16,7 @@ public:
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "SubmitContext"}, 18 {0, nullptr, "SubmitContext"},
19 {1, nullptr, "CreateReport"}, 19 {1, nullptr, "CreateReportV0"},
20 {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, 20 {2, nullptr, "SetInitialLaunchSettingsCompletionTime"},
21 {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, 21 {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"},
22 {4, nullptr, "UpdatePowerOnTime"}, 22 {4, nullptr, "UpdatePowerOnTime"},
@@ -26,6 +26,11 @@ public:
26 {8, nullptr, "ClearApplicationLaunchTime"}, 26 {8, nullptr, "ClearApplicationLaunchTime"},
27 {9, nullptr, "SubmitAttachment"}, 27 {9, nullptr, "SubmitAttachment"},
28 {10, nullptr, "CreateReportWithAttachments"}, 28 {10, nullptr, "CreateReportWithAttachments"},
29 {11, nullptr, "CreateReport"},
30 {20, nullptr, "RegisterRunningApplet"},
31 {21, nullptr, "UnregisterRunningApplet"},
32 {22, nullptr, "UpdateAppletSuspendedDuration"},
33 {30, nullptr, "InvalidateForcedShutdownDetection"},
29 }; 34 };
30 // clang-format on 35 // clang-format on
31 36
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index 0a6621ef2..a35979053 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -38,7 +38,7 @@ public:
38 {10600, nullptr, "DeclareOpenOnlinePlaySession"}, 38 {10600, nullptr, "DeclareOpenOnlinePlaySession"},
39 {10601, &IFriendService::DeclareCloseOnlinePlaySession, "DeclareCloseOnlinePlaySession"}, 39 {10601, &IFriendService::DeclareCloseOnlinePlaySession, "DeclareCloseOnlinePlaySession"},
40 {10610, &IFriendService::UpdateUserPresence, "UpdateUserPresence"}, 40 {10610, &IFriendService::UpdateUserPresence, "UpdateUserPresence"},
41 {10700, nullptr, "GetPlayHistoryRegistrationKey"}, 41 {10700, &IFriendService::GetPlayHistoryRegistrationKey, "GetPlayHistoryRegistrationKey"},
42 {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"}, 42 {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"},
43 {10702, nullptr, "AddPlayHistory"}, 43 {10702, nullptr, "AddPlayHistory"},
44 {11000, nullptr, "GetProfileImageUrl"}, 44 {11000, nullptr, "GetProfileImageUrl"},
@@ -153,6 +153,18 @@ private:
153 rb.Push(RESULT_SUCCESS); 153 rb.Push(RESULT_SUCCESS);
154 } 154 }
155 155
156 void GetPlayHistoryRegistrationKey(Kernel::HLERequestContext& ctx) {
157 IPC::RequestParser rp{ctx};
158 const auto local_play = rp.Pop<bool>();
159 const auto uuid = rp.PopRaw<Common::UUID>();
160
161 LOG_WARNING(Service_Friend, "(STUBBED) called local_play={} uuid={}", local_play,
162 uuid.Format());
163
164 IPC::ResponseBuilder rb{ctx, 2};
165 rb.Push(RESULT_SUCCESS);
166 }
167
156 void GetFriendList(Kernel::HLERequestContext& ctx) { 168 void GetFriendList(Kernel::HLERequestContext& ctx) {
157 IPC::RequestParser rp{ctx}; 169 IPC::RequestParser rp{ctx};
158 const auto friend_offset = rp.Pop<u32>(); 170 const auto friend_offset = rp.Pop<u32>();
diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp
index a478b68e1..daecfff15 100644
--- a/src/core/hle/service/glue/bgtc.cpp
+++ b/src/core/hle/service/glue/bgtc.cpp
@@ -2,6 +2,9 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "common/logging/log.h"
6#include "core/core.h"
7#include "core/hle/ipc_helpers.h"
5#include "core/hle/service/glue/bgtc.h" 8#include "core/hle/service/glue/bgtc.h"
6 9
7namespace Service::Glue { 10namespace Service::Glue {
@@ -9,6 +12,26 @@ namespace Service::Glue {
9BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} { 12BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {
10 // clang-format off 13 // clang-format off
11 static const FunctionInfo functions[] = { 14 static const FunctionInfo functions[] = {
15 {100, &BGTC_T::OpenTaskService, "OpenTaskService"},
16 };
17 // clang-format on
18
19 RegisterHandlers(functions);
20}
21
22BGTC_T::~BGTC_T() = default;
23
24void BGTC_T::OpenTaskService(Kernel::HLERequestContext& ctx) {
25 LOG_DEBUG(Service_BGTC, "called");
26
27 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
28 rb.Push(RESULT_SUCCESS);
29 rb.PushIpcInterface<ITaskService>(system);
30}
31
32ITaskService::ITaskService(Core::System& system_) : ServiceFramework{system_, "ITaskService"} {
33 // clang-format off
34 static const FunctionInfo functions[] = {
12 {1, nullptr, "NotifyTaskStarting"}, 35 {1, nullptr, "NotifyTaskStarting"},
13 {2, nullptr, "NotifyTaskFinished"}, 36 {2, nullptr, "NotifyTaskFinished"},
14 {3, nullptr, "GetTriggerEvent"}, 37 {3, nullptr, "GetTriggerEvent"},
@@ -20,16 +43,18 @@ BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {
20 {13, nullptr, "UnscheduleTask"}, 43 {13, nullptr, "UnscheduleTask"},
21 {14, nullptr, "GetScheduleEvent"}, 44 {14, nullptr, "GetScheduleEvent"},
22 {15, nullptr, "SchedulePeriodicTask"}, 45 {15, nullptr, "SchedulePeriodicTask"},
46 {16, nullptr, "Unknown16"},
23 {101, nullptr, "GetOperationMode"}, 47 {101, nullptr, "GetOperationMode"},
24 {102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"}, 48 {102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"},
25 {103, nullptr, "WillStayHalfAwakeInsteadSleep"}, 49 {103, nullptr, "WillStayHalfAwakeInsteadSleep"},
50 {200, nullptr, "Unknown200"},
26 }; 51 };
27 // clang-format on 52 // clang-format on
28 53
29 RegisterHandlers(functions); 54 RegisterHandlers(functions);
30} 55}
31 56
32BGTC_T::~BGTC_T() = default; 57ITaskService::~ITaskService() = default;
33 58
34BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} { 59BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} {
35 // clang-format off 60 // clang-format off
diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h
index 906116ba6..4c0142fd5 100644
--- a/src/core/hle/service/glue/bgtc.h
+++ b/src/core/hle/service/glue/bgtc.h
@@ -16,6 +16,14 @@ class BGTC_T final : public ServiceFramework<BGTC_T> {
16public: 16public:
17 explicit BGTC_T(Core::System& system_); 17 explicit BGTC_T(Core::System& system_);
18 ~BGTC_T() override; 18 ~BGTC_T() override;
19
20 void OpenTaskService(Kernel::HLERequestContext& ctx);
21};
22
23class ITaskService final : public ServiceFramework<ITaskService> {
24public:
25 explicit ITaskService(Core::System& system_);
26 ~ITaskService() override;
19}; 27};
20 28
21class BGTC_SC final : public ServiceFramework<BGTC_SC> { 29class BGTC_SC final : public ServiceFramework<BGTC_SC> {
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 1df62f98e..673db68c7 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -1138,6 +1138,10 @@ void Controller_NPad::SetUnintendedHomeButtonInputProtectionEnabled(bool is_prot
1138 unintended_home_button_input_protection[NPadIdToIndex(npad_id)] = is_protection_enabled; 1138 unintended_home_button_input_protection[NPadIdToIndex(npad_id)] = is_protection_enabled;
1139} 1139}
1140 1140
1141void Controller_NPad::SetAnalogStickUseCenterClamp(bool use_center_clamp) {
1142 analog_stick_use_center_clamp = use_center_clamp;
1143}
1144
1141void Controller_NPad::ClearAllConnectedControllers() { 1145void Controller_NPad::ClearAllConnectedControllers() {
1142 for (auto& controller : connected_controllers) { 1146 for (auto& controller : connected_controllers) {
1143 if (controller.is_connected && controller.type != NPadControllerType::None) { 1147 if (controller.is_connected && controller.type != NPadControllerType::None) {
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index bc2e6779d..873a0a1e2 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -219,6 +219,7 @@ public:
219 LedPattern GetLedPattern(u32 npad_id); 219 LedPattern GetLedPattern(u32 npad_id);
220 bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const; 220 bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const;
221 void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id); 221 void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id);
222 void SetAnalogStickUseCenterClamp(bool use_center_clamp);
222 void ClearAllConnectedControllers(); 223 void ClearAllConnectedControllers();
223 void DisconnectAllConnectedControllers(); 224 void DisconnectAllConnectedControllers();
224 void ConnectAllDisconnectedControllers(); 225 void ConnectAllDisconnectedControllers();
@@ -577,6 +578,7 @@ private:
577 std::array<std::array<bool, 2>, 10> vibration_devices_mounted{}; 578 std::array<std::array<bool, 2>, 10> vibration_devices_mounted{};
578 std::array<ControllerHolder, 10> connected_controllers{}; 579 std::array<ControllerHolder, 10> connected_controllers{};
579 std::array<bool, 10> unintended_home_button_input_protection{}; 580 std::array<bool, 10> unintended_home_button_input_protection{};
581 bool analog_stick_use_center_clamp{};
580 GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard}; 582 GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard};
581 bool sixaxis_sensors_enabled{true}; 583 bool sixaxis_sensors_enabled{true};
582 f32 sixaxis_fusion_parameter1{}; 584 f32 sixaxis_fusion_parameter1{};
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index ba27bbb05..a1a779cc0 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -263,7 +263,7 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} {
263 {131, &Hid::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"}, 263 {131, &Hid::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"},
264 {132, &Hid::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"}, 264 {132, &Hid::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"},
265 {133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"}, 265 {133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"},
266 {134, nullptr, "SetNpadAnalogStickUseCenterClamp"}, 266 {134, &Hid::SetNpadAnalogStickUseCenterClamp, "SetNpadAnalogStickUseCenterClamp"},
267 {135, nullptr, "SetNpadCaptureButtonAssignment"}, 267 {135, nullptr, "SetNpadCaptureButtonAssignment"},
268 {136, nullptr, "ClearNpadCaptureButtonAssignment"}, 268 {136, nullptr, "ClearNpadCaptureButtonAssignment"},
269 {200, &Hid::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"}, 269 {200, &Hid::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"},
@@ -278,6 +278,7 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} {
278 {209, &Hid::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, 278 {209, &Hid::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
279 {210, &Hid::EndPermitVibrationSession, "EndPermitVibrationSession"}, 279 {210, &Hid::EndPermitVibrationSession, "EndPermitVibrationSession"},
280 {211, &Hid::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"}, 280 {211, &Hid::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"},
281 {212, nullptr, "SendVibrationValueInBool"},
281 {300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"}, 282 {300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},
282 {301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"}, 283 {301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"},
283 {302, &Hid::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"}, 284 {302, &Hid::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"},
@@ -1087,6 +1088,27 @@ void Hid::EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& c
1087 rb.Push(RESULT_SUCCESS); 1088 rb.Push(RESULT_SUCCESS);
1088} 1089}
1089 1090
1091void Hid::SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx) {
1092 IPC::RequestParser rp{ctx};
1093 struct Parameters {
1094 bool analog_stick_use_center_clamp;
1095 u64 applet_resource_user_id;
1096 };
1097 static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
1098
1099 const auto parameters{rp.PopRaw<Parameters>()};
1100
1101 applet_resource->GetController<Controller_NPad>(HidController::NPad)
1102 .SetAnalogStickUseCenterClamp(parameters.analog_stick_use_center_clamp);
1103
1104 LOG_WARNING(Service_HID,
1105 "(STUBBED) called, analog_stick_use_center_clamp={}, applet_resource_user_id={}",
1106 parameters.analog_stick_use_center_clamp, parameters.applet_resource_user_id);
1107
1108 IPC::ResponseBuilder rb{ctx, 2};
1109 rb.Push(RESULT_SUCCESS);
1110}
1111
1090void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) { 1112void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
1091 IPC::RequestParser rp{ctx}; 1113 IPC::RequestParser rp{ctx};
1092 const auto vibration_device_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()}; 1114 const auto vibration_device_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()};
@@ -1553,6 +1575,7 @@ public:
1553 {11, nullptr, "SetTouchScreenAutoPilotState"}, 1575 {11, nullptr, "SetTouchScreenAutoPilotState"},
1554 {12, nullptr, "UnsetTouchScreenAutoPilotState"}, 1576 {12, nullptr, "UnsetTouchScreenAutoPilotState"},
1555 {13, nullptr, "GetTouchScreenConfiguration"}, 1577 {13, nullptr, "GetTouchScreenConfiguration"},
1578 {14, nullptr, "ProcessTouchScreenAutoTune"},
1556 {20, nullptr, "DeactivateMouse"}, 1579 {20, nullptr, "DeactivateMouse"},
1557 {21, nullptr, "SetMouseAutoPilotState"}, 1580 {21, nullptr, "SetMouseAutoPilotState"},
1558 {22, nullptr, "UnsetMouseAutoPilotState"}, 1581 {22, nullptr, "UnsetMouseAutoPilotState"},
@@ -1562,6 +1585,7 @@ public:
1562 {50, nullptr, "DeactivateXpad"}, 1585 {50, nullptr, "DeactivateXpad"},
1563 {51, nullptr, "SetXpadAutoPilotState"}, 1586 {51, nullptr, "SetXpadAutoPilotState"},
1564 {52, nullptr, "UnsetXpadAutoPilotState"}, 1587 {52, nullptr, "UnsetXpadAutoPilotState"},
1588 {53, nullptr, "DeactivateJoyXpad"},
1565 {60, nullptr, "ClearNpadSystemCommonPolicy"}, 1589 {60, nullptr, "ClearNpadSystemCommonPolicy"},
1566 {61, nullptr, "DeactivateNpad"}, 1590 {61, nullptr, "DeactivateNpad"},
1567 {62, nullptr, "ForceDisconnectNpad"}, 1591 {62, nullptr, "ForceDisconnectNpad"},
@@ -1632,6 +1656,11 @@ public:
1632 {244, nullptr, "RequestKuinaFirmwareVersion"}, 1656 {244, nullptr, "RequestKuinaFirmwareVersion"},
1633 {245, nullptr, "GetKuinaFirmwareVersion"}, 1657 {245, nullptr, "GetKuinaFirmwareVersion"},
1634 {246, nullptr, "GetVidPid"}, 1658 {246, nullptr, "GetVidPid"},
1659 {247, nullptr, "GetAnalogStickCalibrationValue"},
1660 {248, nullptr, "GetUniquePadIdsFull"},
1661 {249, nullptr, "ConnectUniquePad"},
1662 {250, nullptr, "IsVirtual"},
1663 {251, nullptr, "GetAnalogStickModuleParam"},
1635 {301, nullptr, "GetAbstractedPadHandles"}, 1664 {301, nullptr, "GetAbstractedPadHandles"},
1636 {302, nullptr, "GetAbstractedPadState"}, 1665 {302, nullptr, "GetAbstractedPadState"},
1637 {303, nullptr, "GetAbstractedPadsState"}, 1666 {303, nullptr, "GetAbstractedPadsState"},
@@ -1652,12 +1681,16 @@ public:
1652 {401, nullptr, "DisableRailDeviceFiltering"}, 1681 {401, nullptr, "DisableRailDeviceFiltering"},
1653 {402, nullptr, "EnableWiredPairing"}, 1682 {402, nullptr, "EnableWiredPairing"},
1654 {403, nullptr, "EnableShipmentModeAutoClear"}, 1683 {403, nullptr, "EnableShipmentModeAutoClear"},
1684 {404, nullptr, "SetRailEnabled"},
1655 {500, nullptr, "SetFactoryInt"}, 1685 {500, nullptr, "SetFactoryInt"},
1656 {501, nullptr, "IsFactoryBootEnabled"}, 1686 {501, nullptr, "IsFactoryBootEnabled"},
1657 {550, nullptr, "SetAnalogStickModelDataTemporarily"}, 1687 {550, nullptr, "SetAnalogStickModelDataTemporarily"},
1658 {551, nullptr, "GetAnalogStickModelData"}, 1688 {551, nullptr, "GetAnalogStickModelData"},
1659 {552, nullptr, "ResetAnalogStickModelData"}, 1689 {552, nullptr, "ResetAnalogStickModelData"},
1660 {600, nullptr, "ConvertPadState"}, 1690 {600, nullptr, "ConvertPadState"},
1691 {650, nullptr, "AddButtonPlayData"},
1692 {651, nullptr, "StartButtonPlayData"},
1693 {652, nullptr, "StopButtonPlayData"},
1661 {2000, nullptr, "DeactivateDigitizer"}, 1694 {2000, nullptr, "DeactivateDigitizer"},
1662 {2001, nullptr, "SetDigitizerAutoPilotState"}, 1695 {2001, nullptr, "SetDigitizerAutoPilotState"},
1663 {2002, nullptr, "UnsetDigitizerAutoPilotState"}, 1696 {2002, nullptr, "UnsetDigitizerAutoPilotState"},
@@ -1689,6 +1722,8 @@ public:
1689 {215, nullptr, "IsNfcActivated"}, 1722 {215, nullptr, "IsNfcActivated"},
1690 {230, nullptr, "AcquireIrSensorEventHandle"}, 1723 {230, nullptr, "AcquireIrSensorEventHandle"},
1691 {231, nullptr, "ActivateIrSensor"}, 1724 {231, nullptr, "ActivateIrSensor"},
1725 {232, nullptr, "GetIrSensorState"},
1726 {233, nullptr, "GetXcdHandleForNpadWithIrSensor"},
1692 {301, nullptr, "ActivateNpadSystem"}, 1727 {301, nullptr, "ActivateNpadSystem"},
1693 {303, nullptr, "ApplyNpadSystemCommonPolicy"}, 1728 {303, nullptr, "ApplyNpadSystemCommonPolicy"},
1694 {304, nullptr, "EnableAssigningSingleOnSlSrPress"}, 1729 {304, nullptr, "EnableAssigningSingleOnSlSrPress"},
@@ -1703,9 +1738,16 @@ public:
1703 {313, nullptr, "GetNpadCaptureButtonAssignment"}, 1738 {313, nullptr, "GetNpadCaptureButtonAssignment"},
1704 {314, nullptr, "GetAppletFooterUiType"}, 1739 {314, nullptr, "GetAppletFooterUiType"},
1705 {315, nullptr, "GetAppletDetailedUiType"}, 1740 {315, nullptr, "GetAppletDetailedUiType"},
1741 {316, nullptr, "GetNpadInterfaceType"},
1742 {317, nullptr, "GetNpadLeftRightInterfaceType"},
1743 {318, nullptr, "HasBattery"},
1744 {319, nullptr, "HasLeftRightBattery"},
1706 {321, nullptr, "GetUniquePadsFromNpad"}, 1745 {321, nullptr, "GetUniquePadsFromNpad"},
1707 {322, nullptr, "GetIrSensorState"}, 1746 {322, nullptr, "GetIrSensorState"},
1708 {323, nullptr, "GetXcdHandleForNpadWithIrSensor"}, 1747 {323, nullptr, "GetXcdHandleForNpadWithIrSensor"},
1748 {324, nullptr, "GetUniquePadButtonSet"},
1749 {325, nullptr, "GetUniquePadColor"},
1750 {326, nullptr, "GetUniquePadAppletDetailedUiType"},
1709 {500, nullptr, "SetAppletResourceUserId"}, 1751 {500, nullptr, "SetAppletResourceUserId"},
1710 {501, nullptr, "RegisterAppletResourceUserId"}, 1752 {501, nullptr, "RegisterAppletResourceUserId"},
1711 {502, nullptr, "UnregisterAppletResourceUserId"}, 1753 {502, nullptr, "UnregisterAppletResourceUserId"},
@@ -1716,10 +1758,13 @@ public:
1716 {511, nullptr, "GetVibrationMasterVolume"}, 1758 {511, nullptr, "GetVibrationMasterVolume"},
1717 {512, nullptr, "BeginPermitVibrationSession"}, 1759 {512, nullptr, "BeginPermitVibrationSession"},
1718 {513, nullptr, "EndPermitVibrationSession"}, 1760 {513, nullptr, "EndPermitVibrationSession"},
1761 {514, nullptr, "Unknown514"},
1719 {520, nullptr, "EnableHandheldHids"}, 1762 {520, nullptr, "EnableHandheldHids"},
1720 {521, nullptr, "DisableHandheldHids"}, 1763 {521, nullptr, "DisableHandheldHids"},
1721 {522, nullptr, "SetJoyConRailEnabled"}, 1764 {522, nullptr, "SetJoyConRailEnabled"},
1722 {523, nullptr, "IsJoyConRailEnabled"}, 1765 {523, nullptr, "IsJoyConRailEnabled"},
1766 {524, nullptr, "IsHandheldHidsEnabled"},
1767 {525, nullptr, "IsJoyConAttachedOnAllRail"},
1723 {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, 1768 {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"},
1724 {541, nullptr, "GetPlayReportControllerUsages"}, 1769 {541, nullptr, "GetPlayReportControllerUsages"},
1725 {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, 1770 {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"},
@@ -1795,6 +1840,65 @@ public:
1795 {1154, nullptr, "IsFirmwareAvailableForNotification"}, 1840 {1154, nullptr, "IsFirmwareAvailableForNotification"},
1796 {1155, nullptr, "SetForceHandheldStyleVibration"}, 1841 {1155, nullptr, "SetForceHandheldStyleVibration"},
1797 {1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, 1842 {1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"},
1843 {1157, nullptr, "CancelConnectionTrigger"},
1844 {1200, nullptr, "IsButtonConfigSupported"},
1845 {1201, nullptr, "IsButtonConfigEmbeddedSupported"},
1846 {1202, nullptr, "DeleteButtonConfig"},
1847 {1203, nullptr, "DeleteButtonConfigEmbedded"},
1848 {1204, nullptr, "SetButtonConfigEnabled"},
1849 {1205, nullptr, "SetButtonConfigEmbeddedEnabled"},
1850 {1206, nullptr, "IsButtonConfigEnabled"},
1851 {1207, nullptr, "IsButtonConfigEmbeddedEnabled"},
1852 {1208, nullptr, "SetButtonConfigEmbedded"},
1853 {1209, nullptr, "SetButtonConfigFull"},
1854 {1210, nullptr, "SetButtonConfigLeft"},
1855 {1211, nullptr, "SetButtonConfigRight"},
1856 {1212, nullptr, "GetButtonConfigEmbedded"},
1857 {1213, nullptr, "GetButtonConfigFull"},
1858 {1214, nullptr, "GetButtonConfigLeft"},
1859 {1215, nullptr, "GetButtonConfigRight"},
1860 {1250, nullptr, "IsCustomButtonConfigSupported"},
1861 {1251, nullptr, "IsDefaultButtonConfigEmbedded"},
1862 {1252, nullptr, "IsDefaultButtonConfigFull"},
1863 {1253, nullptr, "IsDefaultButtonConfigLeft"},
1864 {1254, nullptr, "IsDefaultButtonConfigRight"},
1865 {1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"},
1866 {1256, nullptr, "IsButtonConfigStorageFullEmpty"},
1867 {1257, nullptr, "IsButtonConfigStorageLeftEmpty"},
1868 {1258, nullptr, "IsButtonConfigStorageRightEmpty"},
1869 {1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"},
1870 {1260, nullptr, "GetButtonConfigStorageFullDeprecated"},
1871 {1261, nullptr, "GetButtonConfigStorageLeftDeprecated"},
1872 {1262, nullptr, "GetButtonConfigStorageRightDeprecated"},
1873 {1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"},
1874 {1264, nullptr, "SetButtonConfigStorageFullDeprecated"},
1875 {1265, nullptr, "SetButtonConfigStorageLeftDeprecated"},
1876 {1266, nullptr, "SetButtonConfigStorageRightDeprecated"},
1877 {1267, nullptr, "DeleteButtonConfigStorageEmbedded"},
1878 {1268, nullptr, "DeleteButtonConfigStorageFull"},
1879 {1269, nullptr, "DeleteButtonConfigStorageLeft"},
1880 {1270, nullptr, "DeleteButtonConfigStorageRight"},
1881 {1271, nullptr, "IsUsingCustomButtonConfig"},
1882 {1272, nullptr, "IsAnyCustomButtonConfigEnabled"},
1883 {1273, nullptr, "SetAllCustomButtonConfigEnabled"},
1884 {1274, nullptr, "SetDefaultButtonConfig"},
1885 {1275, nullptr, "SetAllDefaultButtonConfig"},
1886 {1276, nullptr, "SetHidButtonConfigEmbedded"},
1887 {1277, nullptr, "SetHidButtonConfigFull"},
1888 {1278, nullptr, "SetHidButtonConfigLeft"},
1889 {1279, nullptr, "SetHidButtonConfigRight"},
1890 {1280, nullptr, "GetHidButtonConfigEmbedded"},
1891 {1281, nullptr, "GetHidButtonConfigFull"},
1892 {1282, nullptr, "GetHidButtonConfigLeft"},
1893 {1283, nullptr, "GetHidButtonConfigRight"},
1894 {1284, nullptr, "GetButtonConfigStorageEmbedded"},
1895 {1285, nullptr, "GetButtonConfigStorageFull"},
1896 {1286, nullptr, "GetButtonConfigStorageLeft"},
1897 {1287, nullptr, "GetButtonConfigStorageRight"},
1898 {1288, nullptr, "SetButtonConfigStorageEmbedded"},
1899 {1289, nullptr, "SetButtonConfigStorageFull"},
1900 {1290, nullptr, "DeleteButtonConfigStorageRight"},
1901 {1291, nullptr, "DeleteButtonConfigStorageRight"},
1798 }; 1902 };
1799 // clang-format on 1903 // clang-format on
1800 1904
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index 36ed228c8..c2bdd39a3 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -129,6 +129,7 @@ private:
129 void SwapNpadAssignment(Kernel::HLERequestContext& ctx); 129 void SwapNpadAssignment(Kernel::HLERequestContext& ctx);
130 void IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext& ctx); 130 void IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext& ctx);
131 void EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& ctx); 131 void EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& ctx);
132 void SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx);
132 void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx); 133 void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx);
133 void SendVibrationValue(Kernel::HLERequestContext& ctx); 134 void SendVibrationValue(Kernel::HLERequestContext& ctx);
134 void GetActualVibrationValue(Kernel::HLERequestContext& ctx); 135 void GetActualVibrationValue(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/hid/xcd.cpp b/src/core/hle/service/hid/xcd.cpp
index 43a8840d0..b1efa3d05 100644
--- a/src/core/hle/service/hid/xcd.cpp
+++ b/src/core/hle/service/hid/xcd.cpp
@@ -28,6 +28,8 @@ XCD_SYS::XCD_SYS(Core::System& system_) : ServiceFramework{system_, "xcd:sys"} {
28 {20, nullptr, "StartMifareWrite"}, 28 {20, nullptr, "StartMifareWrite"},
29 {101, nullptr, "GetAwakeTriggerReasonForLeftRail"}, 29 {101, nullptr, "GetAwakeTriggerReasonForLeftRail"},
30 {102, nullptr, "GetAwakeTriggerReasonForRightRail"}, 30 {102, nullptr, "GetAwakeTriggerReasonForRightRail"},
31 {103, nullptr, "GetAwakeTriggerBatteryLevelTransitionForLeftRail"},
32 {104, nullptr, "GetAwakeTriggerBatteryLevelTransitionForRightRail"},
31 }; 33 };
32 // clang-format on 34 // clang-format on
33 35
diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp
index f3be0b878..fee360ab9 100644
--- a/src/core/hle/service/nim/nim.cpp
+++ b/src/core/hle/service/nim/nim.cpp
@@ -125,51 +125,51 @@ public:
125 {39, nullptr, "PrepareShutdown"}, 125 {39, nullptr, "PrepareShutdown"},
126 {40, nullptr, "ListApplyDeltaTask"}, 126 {40, nullptr, "ListApplyDeltaTask"},
127 {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"}, 127 {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"},
128 {42, nullptr, "Unknown42"}, 128 {42, nullptr, "CreateApplyDeltaTaskFromDownloadTask"},
129 {43, nullptr, "Unknown43"}, 129 {43, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"},
130 {44, nullptr, "Unknown44"}, 130 {44, nullptr, "GetApplyDeltaTaskRequiredStorage"},
131 {45, nullptr, "Unknown45"}, 131 {45, nullptr, "CalculateNetworkInstallTaskContentsSize"},
132 {46, nullptr, "Unknown46"}, 132 {46, nullptr, "PrepareShutdownForSystemUpdate"},
133 {47, nullptr, "Unknown47"}, 133 {47, nullptr, "FindMaxRequiredApplicationVersionOfTask"},
134 {48, nullptr, "Unknown48"}, 134 {48, nullptr, "CommitNetworkInstallTaskPartially"},
135 {49, nullptr, "Unknown49"}, 135 {49, nullptr, "ListNetworkInstallTaskCommittedContentMeta"},
136 {50, nullptr, "Unknown50"}, 136 {50, nullptr, "ListNetworkInstallTaskNotCommittedContentMeta"},
137 {51, nullptr, "Unknown51"}, 137 {51, nullptr, "FindMaxRequiredSystemVersionOfTask"},
138 {52, nullptr, "Unknown52"}, 138 {52, nullptr, "GetNetworkInstallTaskErrorContext"},
139 {53, nullptr, "Unknown53"}, 139 {53, nullptr, "CreateLocalCommunicationReceiveApplicationTask"},
140 {54, nullptr, "Unknown54"}, 140 {54, nullptr, "DestroyLocalCommunicationReceiveApplicationTask"},
141 {55, nullptr, "Unknown55"}, 141 {55, nullptr, "ListLocalCommunicationReceiveApplicationTask"},
142 {56, nullptr, "Unknown56"}, 142 {56, nullptr, "RequestLocalCommunicationReceiveApplicationTaskRun"},
143 {57, nullptr, "Unknown57"}, 143 {57, nullptr, "GetLocalCommunicationReceiveApplicationTaskInfo"},
144 {58, nullptr, "Unknown58"}, 144 {58, nullptr, "CommitLocalCommunicationReceiveApplicationTask"},
145 {59, nullptr, "Unknown59"}, 145 {59, nullptr, "ListLocalCommunicationReceiveApplicationTaskContentMeta"},
146 {60, nullptr, "Unknown60"}, 146 {60, nullptr, "CreateLocalCommunicationSendApplicationTask"},
147 {61, nullptr, "Unknown61"}, 147 {61, nullptr, "RequestLocalCommunicationSendApplicationTaskRun"},
148 {62, nullptr, "Unknown62"}, 148 {62, nullptr, "GetLocalCommunicationReceiveApplicationTaskErrorContext"},
149 {63, nullptr, "Unknown63"}, 149 {63, nullptr, "GetLocalCommunicationSendApplicationTaskInfo"},
150 {64, nullptr, "Unknown64"}, 150 {64, nullptr, "DestroyLocalCommunicationSendApplicationTask"},
151 {65, nullptr, "Unknown65"}, 151 {65, nullptr, "GetLocalCommunicationSendApplicationTaskErrorContext"},
152 {66, nullptr, "Unknown66"}, 152 {66, nullptr, "CalculateLocalCommunicationReceiveApplicationTaskRequiredSize"},
153 {67, nullptr, "Unknown67"}, 153 {67, nullptr, "ListApplicationLocalCommunicationReceiveApplicationTask"},
154 {68, nullptr, "Unknown68"}, 154 {68, nullptr, "ListApplicationLocalCommunicationSendApplicationTask"},
155 {69, nullptr, "Unknown69"}, 155 {69, nullptr, "CreateLocalCommunicationReceiveSystemUpdateTask"},
156 {70, nullptr, "Unknown70"}, 156 {70, nullptr, "DestroyLocalCommunicationReceiveSystemUpdateTask"},
157 {71, nullptr, "Unknown71"}, 157 {71, nullptr, "ListLocalCommunicationReceiveSystemUpdateTask"},
158 {72, nullptr, "Unknown72"}, 158 {72, nullptr, "RequestLocalCommunicationReceiveSystemUpdateTaskRun"},
159 {73, nullptr, "Unknown73"}, 159 {73, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskInfo"},
160 {74, nullptr, "Unknown74"}, 160 {74, nullptr, "CommitLocalCommunicationReceiveSystemUpdateTask"},
161 {75, nullptr, "Unknown75"}, 161 {75, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskErrorContext"},
162 {76, nullptr, "Unknown76"}, 162 {76, nullptr, "CreateLocalCommunicationSendSystemUpdateTask"},
163 {77, nullptr, "Unknown77"}, 163 {77, nullptr, "RequestLocalCommunicationSendSystemUpdateTaskRun"},
164 {78, nullptr, "Unknown78"}, 164 {78, nullptr, "GetLocalCommunicationSendSystemUpdateTaskInfo"},
165 {79, nullptr, "Unknown79"}, 165 {79, nullptr, "DestroyLocalCommunicationSendSystemUpdateTask"},
166 {80, nullptr, "Unknown80"}, 166 {80, nullptr, "GetLocalCommunicationSendSystemUpdateTaskErrorContext"},
167 {81, nullptr, "Unknown81"}, 167 {81, nullptr, "ListLocalCommunicationSendSystemUpdateTask"},
168 {82, nullptr, "Unknown82"}, 168 {82, nullptr, "GetReceivedSystemDataPath"},
169 {83, nullptr, "Unknown83"}, 169 {83, nullptr, "CalculateApplyDeltaTaskOccupiedSize"},
170 {84, nullptr, "Unknown84"}, 170 {84, nullptr, "Unknown84"},
171 {85, nullptr, "Unknown85"}, 171 {85, nullptr, "ListNetworkInstallTaskContentMetaFromInstallMeta"},
172 {86, nullptr, "Unknown86"}, 172 {86, nullptr, "ListNetworkInstallTaskOccupiedSize"},
173 {87, nullptr, "Unknown87"}, 173 {87, nullptr, "Unknown87"},
174 {88, nullptr, "Unknown88"}, 174 {88, nullptr, "Unknown88"},
175 {89, nullptr, "Unknown89"}, 175 {89, nullptr, "Unknown89"},
@@ -202,6 +202,17 @@ public:
202 {116, nullptr, "Unknown116"}, 202 {116, nullptr, "Unknown116"},
203 {117, nullptr, "Unknown117"}, 203 {117, nullptr, "Unknown117"},
204 {118, nullptr, "Unknown118"}, 204 {118, nullptr, "Unknown118"},
205 {119, nullptr, "Unknown119"},
206 {120, nullptr, "Unknown120"},
207 {121, nullptr, "Unknown121"},
208 {122, nullptr, "Unknown122"},
209 {123, nullptr, "Unknown123"},
210 {124, nullptr, "Unknown124"},
211 {125, nullptr, "Unknown125"},
212 {126, nullptr, "Unknown126"},
213 {127, nullptr, "Unknown127"},
214 {128, nullptr, "Unknown128"},
215 {129, nullptr, "Unknown129"},
205 }; 216 };
206 // clang-format on 217 // clang-format on
207 218
diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp
index f7a58f659..e4c703da4 100644
--- a/src/core/hle/service/npns/npns.cpp
+++ b/src/core/hle/service/npns/npns.cpp
@@ -49,6 +49,8 @@ public:
49 {151, nullptr, "GetStateWithHandover"}, 49 {151, nullptr, "GetStateWithHandover"},
50 {152, nullptr, "GetStateChangeEventWithHandover"}, 50 {152, nullptr, "GetStateChangeEventWithHandover"},
51 {153, nullptr, "GetDropEventWithHandover"}, 51 {153, nullptr, "GetDropEventWithHandover"},
52 {154, nullptr, "CreateTokenAsync"},
53 {155, nullptr, "CreateTokenAsyncWithApplicationId"},
52 {161, nullptr, "GetRequestChangeStateCancelEvent"}, 54 {161, nullptr, "GetRequestChangeStateCancelEvent"},
53 {162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"}, 55 {162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"},
54 {201, nullptr, "RequestChangeStateForceTimed"}, 56 {201, nullptr, "RequestChangeStateForceTimed"},
@@ -84,6 +86,7 @@ public:
84 {151, nullptr, "GetStateWithHandover"}, 86 {151, nullptr, "GetStateWithHandover"},
85 {152, nullptr, "GetStateChangeEventWithHandover"}, 87 {152, nullptr, "GetStateChangeEventWithHandover"},
86 {153, nullptr, "GetDropEventWithHandover"}, 88 {153, nullptr, "GetDropEventWithHandover"},
89 {154, nullptr, "CreateTokenAsync"},
87 }; 90 };
88 // clang-format on 91 // clang-format on
89 92
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index 6ccf8995c..5fe7a9189 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -55,6 +55,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
55 {26, nullptr, "BeginInstallApplication"}, 55 {26, nullptr, "BeginInstallApplication"},
56 {27, nullptr, "DeleteApplicationRecord"}, 56 {27, nullptr, "DeleteApplicationRecord"},
57 {30, nullptr, "RequestApplicationUpdateInfo"}, 57 {30, nullptr, "RequestApplicationUpdateInfo"},
58 {31, nullptr, "Unknown31"},
58 {32, nullptr, "CancelApplicationDownload"}, 59 {32, nullptr, "CancelApplicationDownload"},
59 {33, nullptr, "ResumeApplicationDownload"}, 60 {33, nullptr, "ResumeApplicationDownload"},
60 {35, nullptr, "UpdateVersionList"}, 61 {35, nullptr, "UpdateVersionList"},
@@ -182,6 +183,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
182 {913, nullptr, "ListAllApplicationRecord"}, 183 {913, nullptr, "ListAllApplicationRecord"},
183 {914, nullptr, "HideApplicationRecord"}, 184 {914, nullptr, "HideApplicationRecord"},
184 {915, nullptr, "ShowApplicationRecord"}, 185 {915, nullptr, "ShowApplicationRecord"},
186 {916, nullptr, "IsApplicationAutoDeleteDisabled"},
185 {1000, nullptr, "RequestVerifyApplicationDeprecated"}, 187 {1000, nullptr, "RequestVerifyApplicationDeprecated"},
186 {1001, nullptr, "CorruptApplicationForDebug"}, 188 {1001, nullptr, "CorruptApplicationForDebug"},
187 {1002, nullptr, "RequestVerifyAddOnContentsRights"}, 189 {1002, nullptr, "RequestVerifyAddOnContentsRights"},
@@ -201,6 +203,8 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
201 {1310, nullptr, "RequestMoveApplicationEntity"}, 203 {1310, nullptr, "RequestMoveApplicationEntity"},
202 {1311, nullptr, "EstimateSizeToMove"}, 204 {1311, nullptr, "EstimateSizeToMove"},
203 {1312, nullptr, "HasMovableEntity"}, 205 {1312, nullptr, "HasMovableEntity"},
206 {1313, nullptr, "CleanupOrphanContents"},
207 {1314, nullptr, "CheckPreconditionSatisfiedToMove"},
204 {1400, nullptr, "PrepareShutdown"}, 208 {1400, nullptr, "PrepareShutdown"},
205 {1500, nullptr, "FormatSdCard"}, 209 {1500, nullptr, "FormatSdCard"},
206 {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, 210 {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"},
@@ -215,6 +219,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
215 {1702, nullptr, "GetApplicationDownloadTaskStatus"}, 219 {1702, nullptr, "GetApplicationDownloadTaskStatus"},
216 {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, 220 {1703, nullptr, "GetApplicationViewDownloadErrorContext"},
217 {1704, nullptr, "GetApplicationViewWithPromotionInfo"}, 221 {1704, nullptr, "GetApplicationViewWithPromotionInfo"},
222 {1705, nullptr, "IsPatchAutoDeletableApplication"},
218 {1800, nullptr, "IsNotificationSetupCompleted"}, 223 {1800, nullptr, "IsNotificationSetupCompleted"},
219 {1801, nullptr, "GetLastNotificationInfoCount"}, 224 {1801, nullptr, "GetLastNotificationInfoCount"},
220 {1802, nullptr, "ListLastNotificationInfo"}, 225 {1802, nullptr, "ListLastNotificationInfo"},
@@ -269,6 +274,9 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
269 {2351, nullptr, "RequestNoDownloadRightsErrorResolution"}, 274 {2351, nullptr, "RequestNoDownloadRightsErrorResolution"},
270 {2352, nullptr, "RequestResolveNoDownloadRightsError"}, 275 {2352, nullptr, "RequestResolveNoDownloadRightsError"},
271 {2353, nullptr, "GetApplicationDownloadTaskInfo"}, 276 {2353, nullptr, "GetApplicationDownloadTaskInfo"},
277 {2354, nullptr, "PrioritizeApplicationBackgroundTask"},
278 {2355, nullptr, "Unknown2355"},
279 {2356, nullptr, "Unknown2356"},
272 {2400, nullptr, "GetPromotionInfo"}, 280 {2400, nullptr, "GetPromotionInfo"},
273 {2401, nullptr, "CountPromotionInfo"}, 281 {2401, nullptr, "CountPromotionInfo"},
274 {2402, nullptr, "ListPromotionInfo"}, 282 {2402, nullptr, "ListPromotionInfo"},
@@ -282,6 +290,21 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
282 {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"}, 290 {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"},
283 {2516, nullptr, "EnsureApplicationCertificate"}, 291 {2516, nullptr, "EnsureApplicationCertificate"},
284 {2800, nullptr, "GetApplicationIdOfPreomia"}, 292 {2800, nullptr, "GetApplicationIdOfPreomia"},
293 {3000, nullptr, "RegisterDeviceLockKey"},
294 {3001, nullptr, "UnregisterDeviceLockKey"},
295 {3002, nullptr, "VerifyDeviceLockKey"},
296 {3003, nullptr, "HideApplicationIcon"},
297 {3004, nullptr, "ShowApplicationIcon"},
298 {3005, nullptr, "HideApplicationTitle"},
299 {3006, nullptr, "ShowApplicationTitle"},
300 {3007, nullptr, "EnableGameCard"},
301 {3008, nullptr, "DisableGameCard"},
302 {3009, nullptr, "EnableLocalContentShare"},
303 {3010, nullptr, "DisableLocalContentShare"},
304 {3011, nullptr, "IsApplicationIconHidden"},
305 {3012, nullptr, "IsApplicationTitleHidden"},
306 {3013, nullptr, "IsGameCardEnabled"},
307 {3014, nullptr, "IsLocalContentShareEnabled"},
285 {9999, nullptr, "GetApplicationCertificate"}, 308 {9999, nullptr, "GetApplicationCertificate"},
286 }; 309 };
287 // clang-format on 310 // clang-format on
@@ -441,7 +464,11 @@ IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_
441 {800, nullptr, "RequestVersionList"}, 464 {800, nullptr, "RequestVersionList"},
442 {801, nullptr, "ListVersionList"}, 465 {801, nullptr, "ListVersionList"},
443 {802, nullptr, "RequestVersionListData"}, 466 {802, nullptr, "RequestVersionListData"},
467 {900, nullptr, "ImportAutoUpdatePolicyJsonForDebug"},
468 {901, nullptr, "ListDefaultAutoUpdatePolicy"},
469 {902, nullptr, "ListAutoUpdatePolicyForSpecificApplication"},
444 {1000, nullptr, "PerformAutoUpdate"}, 470 {1000, nullptr, "PerformAutoUpdate"},
471 {1001, nullptr, "ListAutoUpdateSchedule"},
445 }; 472 };
446 // clang-format on 473 // clang-format on
447 474
@@ -547,6 +574,9 @@ IFactoryResetInterface::~IFactoryResetInterface() = default;
547NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} { 574NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} {
548 // clang-format off 575 // clang-format off
549 static const FunctionInfo functions[] = { 576 static const FunctionInfo functions[] = {
577 {7988, nullptr, "GetDynamicRightsInterface"},
578 {7989, nullptr, "GetReadOnlyApplicationControlDataInterface"},
579 {7991, nullptr, "GetReadOnlyApplicationRecordInterface"},
550 {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, 580 {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"},
551 {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, 581 {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"},
552 {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, 582 {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"},
@@ -575,18 +605,22 @@ public:
575 {0, nullptr, "LaunchProgram"}, 605 {0, nullptr, "LaunchProgram"},
576 {1, nullptr, "TerminateProcess"}, 606 {1, nullptr, "TerminateProcess"},
577 {2, nullptr, "TerminateProgram"}, 607 {2, nullptr, "TerminateProgram"},
578 {4, nullptr, "GetShellEventHandle"}, 608 {4, nullptr, "GetShellEvent"},
579 {5, nullptr, "GetShellEventInfo"}, 609 {5, nullptr, "GetShellEventInfo"},
580 {6, nullptr, "TerminateApplication"}, 610 {6, nullptr, "TerminateApplication"},
581 {7, nullptr, "PrepareLaunchProgramFromHost"}, 611 {7, nullptr, "PrepareLaunchProgramFromHost"},
582 {8, nullptr, "LaunchApplication"}, 612 {8, nullptr, "LaunchApplicationFromHost"},
583 {9, nullptr, "LaunchApplicationWithStorageIdForDevelop"}, 613 {9, nullptr, "LaunchApplicationWithStorageIdForDevelop"},
584 {10, nullptr, "IsSystemMemoryResourceLimitBoosted"}, 614 {10, nullptr, "IsSystemMemoryResourceLimitBoosted"},
585 {11, nullptr, "GetRunningApplicationProcessIdForDevelop"}, 615 {11, nullptr, "GetRunningApplicationProcessIdForDevelop"},
586 {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActive"}, 616 {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop"},
587 {13, nullptr, "CreateApplicationResourceForDevelop"}, 617 {13, nullptr, "CreateApplicationResourceForDevelop"},
588 {14, nullptr, "IsPreomiaForDevelop"}, 618 {14, nullptr, "IsPreomiaForDevelop"},
589 {15, nullptr, "GetApplicationProgramIdFromHost"}, 619 {15, nullptr, "GetApplicationProgramIdFromHost"},
620 {16, nullptr, "RefreshCachedDebugValues"},
621 {17, nullptr, "PrepareLaunchApplicationFromHost"},
622 {18, nullptr, "GetLaunchEvent"},
623 {19, nullptr, "GetLaunchResult"},
590 }; 624 };
591 // clang-format on 625 // clang-format on
592 626
@@ -699,6 +733,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
699 std::make_shared<NS>("ns:rid", system)->InstallAsService(service_manager); 733 std::make_shared<NS>("ns:rid", system)->InstallAsService(service_manager);
700 std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager); 734 std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager);
701 std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager); 735 std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager);
736 std::make_shared<NS>("ns:ro", system)->InstallAsService(service_manager);
702 737
703 std::make_shared<NS_DEV>(system)->InstallAsService(service_manager); 738 std::make_shared<NS_DEV>(system)->InstallAsService(service_manager);
704 std::make_shared<NS_SU>(system)->InstallAsService(service_manager); 739 std::make_shared<NS_SU>(system)->InstallAsService(service_manager);
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 7423287ea..a1a7ac987 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -695,6 +695,7 @@ public:
695 {2205, &ISystemDisplayService::SetLayerZ, "SetLayerZ"}, 695 {2205, &ISystemDisplayService::SetLayerZ, "SetLayerZ"},
696 {2207, &ISystemDisplayService::SetLayerVisibility, "SetLayerVisibility"}, 696 {2207, &ISystemDisplayService::SetLayerVisibility, "SetLayerVisibility"},
697 {2209, nullptr, "SetLayerAlpha"}, 697 {2209, nullptr, "SetLayerAlpha"},
698 {2210, nullptr, "SetLayerPositionAndSize"},
698 {2312, nullptr, "CreateStrayLayer"}, 699 {2312, nullptr, "CreateStrayLayer"},
699 {2400, nullptr, "OpenIndirectLayer"}, 700 {2400, nullptr, "OpenIndirectLayer"},
700 {2401, nullptr, "CloseIndirectLayer"}, 701 {2401, nullptr, "CloseIndirectLayer"},
@@ -718,6 +719,7 @@ public:
718 {3215, nullptr, "SetDisplayGamma"}, 719 {3215, nullptr, "SetDisplayGamma"},
719 {3216, nullptr, "GetDisplayCmuLuma"}, 720 {3216, nullptr, "GetDisplayCmuLuma"},
720 {3217, nullptr, "SetDisplayCmuLuma"}, 721 {3217, nullptr, "SetDisplayCmuLuma"},
722 {3218, nullptr, "SetDisplayCrcMode"},
721 {6013, nullptr, "GetLayerPresentationSubmissionTimestamps"}, 723 {6013, nullptr, "GetLayerPresentationSubmissionTimestamps"},
722 {8225, nullptr, "GetSharedBufferMemoryHandleId"}, 724 {8225, nullptr, "GetSharedBufferMemoryHandleId"},
723 {8250, nullptr, "OpenSharedLayer"}, 725 {8250, nullptr, "OpenSharedLayer"},
@@ -729,6 +731,7 @@ public:
729 {8256, nullptr, "GetSharedFrameBufferAcquirableEvent"}, 731 {8256, nullptr, "GetSharedFrameBufferAcquirableEvent"},
730 {8257, nullptr, "FillSharedFrameBufferColor"}, 732 {8257, nullptr, "FillSharedFrameBufferColor"},
731 {8258, nullptr, "CancelSharedFrameBuffer"}, 733 {8258, nullptr, "CancelSharedFrameBuffer"},
734 {9000, nullptr, "GetDp2hdmiController"},
732 }; 735 };
733 RegisterHandlers(functions); 736 RegisterHandlers(functions);
734 } 737 }
@@ -808,10 +811,15 @@ public:
808 {2402, nullptr, "GetDisplayHotplugState"}, 811 {2402, nullptr, "GetDisplayHotplugState"},
809 {2501, nullptr, "GetCompositorErrorInfo"}, 812 {2501, nullptr, "GetCompositorErrorInfo"},
810 {2601, nullptr, "GetDisplayErrorEvent"}, 813 {2601, nullptr, "GetDisplayErrorEvent"},
814 {2701, nullptr, "GetDisplayFatalErrorEvent"},
811 {4201, nullptr, "SetDisplayAlpha"}, 815 {4201, nullptr, "SetDisplayAlpha"},
812 {4203, nullptr, "SetDisplayLayerStack"}, 816 {4203, nullptr, "SetDisplayLayerStack"},
813 {4205, nullptr, "SetDisplayPowerState"}, 817 {4205, nullptr, "SetDisplayPowerState"},
814 {4206, nullptr, "SetDefaultDisplay"}, 818 {4206, nullptr, "SetDefaultDisplay"},
819 {4207, nullptr, "ResetDisplayPanel"},
820 {4208, nullptr, "SetDisplayFatalErrorEnabled"},
821 {4209, nullptr, "IsDisplayPanelOn"},
822 {4300, nullptr, "GetInternalPanelId"},
815 {6000, &IManagerDisplayService::AddToLayerStack, "AddToLayerStack"}, 823 {6000, &IManagerDisplayService::AddToLayerStack, "AddToLayerStack"},
816 {6001, nullptr, "RemoveFromLayerStack"}, 824 {6001, nullptr, "RemoveFromLayerStack"},
817 {6002, &IManagerDisplayService::SetLayerVisibility, "SetLayerVisibility"}, 825 {6002, &IManagerDisplayService::SetLayerVisibility, "SetLayerVisibility"},
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index c61f44619..009c6f574 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -517,8 +517,8 @@ void GPU::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const {
517 interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value); 517 interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value);
518} 518}
519 519
520void GPU::WaitIdle() const { 520void GPU::ShutDown() {
521 gpu_thread.WaitIdle(); 521 gpu_thread.ShutDown();
522} 522}
523 523
524void GPU::OnCommandListEnd() { 524void GPU::OnCommandListEnd() {
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index b2ee45496..ecab35d3b 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -219,8 +219,8 @@ public:
219 return *shader_notify; 219 return *shader_notify;
220 } 220 }
221 221
222 // Waits for the GPU to finish working 222 // Stops the GPU execution and waits for the GPU to finish working
223 void WaitIdle() const; 223 void ShutDown();
224 224
225 /// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame. 225 /// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame.
226 void WaitFence(u32 syncpoint_id, u32 value); 226 void WaitFence(u32 syncpoint_id, u32 value);
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index 99353f15f..7addfbc7b 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -29,8 +29,7 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,
29 system.RegisterHostThread(); 29 system.RegisterHostThread();
30 30
31 // Wait for first GPU command before acquiring the window context 31 // Wait for first GPU command before acquiring the window context
32 while (state.queue.Empty()) 32 state.queue.Wait();
33 ;
34 33
35 // If emulation was stopped during disk shader loading, abort before trying to acquire context 34 // If emulation was stopped during disk shader loading, abort before trying to acquire context
36 if (!state.is_running) { 35 if (!state.is_running) {
@@ -57,11 +56,17 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,
57 } else if (const auto* invalidate = std::get_if<InvalidateRegionCommand>(&next.data)) { 56 } else if (const auto* invalidate = std::get_if<InvalidateRegionCommand>(&next.data)) {
58 rasterizer->OnCPUWrite(invalidate->addr, invalidate->size); 57 rasterizer->OnCPUWrite(invalidate->addr, invalidate->size);
59 } else if (std::holds_alternative<EndProcessingCommand>(next.data)) { 58 } else if (std::holds_alternative<EndProcessingCommand>(next.data)) {
60 return; 59 ASSERT(state.is_running == false);
61 } else { 60 } else {
62 UNREACHABLE(); 61 UNREACHABLE();
63 } 62 }
64 state.signaled_fence.store(next.fence); 63 state.signaled_fence.store(next.fence);
64 if (next.block) {
65 // We have to lock the write_lock to ensure that the condition_variable wait not get a
66 // race between the check and the lock itself.
67 std::lock_guard lk(state.write_lock);
68 state.cv.notify_all();
69 }
65 } 70 }
66} 71}
67 72
@@ -69,13 +74,7 @@ ThreadManager::ThreadManager(Core::System& system_, bool is_async_)
69 : system{system_}, is_async{is_async_} {} 74 : system{system_}, is_async{is_async_} {}
70 75
71ThreadManager::~ThreadManager() { 76ThreadManager::~ThreadManager() {
72 if (!thread.joinable()) { 77 ShutDown();
73 return;
74 }
75
76 // Notify GPU thread that a shutdown is pending
77 PushCommand(EndProcessingCommand());
78 thread.join();
79} 78}
80 79
81void ThreadManager::StartThread(VideoCore::RendererBase& renderer, 80void ThreadManager::StartThread(VideoCore::RendererBase& renderer,
@@ -112,9 +111,8 @@ void ThreadManager::FlushRegion(VAddr addr, u64 size) {
112 case Settings::GPUAccuracy::Extreme: { 111 case Settings::GPUAccuracy::Extreme: {
113 auto& gpu = system.GPU(); 112 auto& gpu = system.GPU();
114 u64 fence = gpu.RequestFlush(addr, size); 113 u64 fence = gpu.RequestFlush(addr, size);
115 PushCommand(GPUTickCommand()); 114 PushCommand(GPUTickCommand(), true);
116 while (fence > gpu.CurrentFlushRequestFence()) { 115 ASSERT(fence <= gpu.CurrentFlushRequestFence());
117 }
118 break; 116 break;
119 } 117 }
120 default: 118 default:
@@ -131,23 +129,45 @@ void ThreadManager::FlushAndInvalidateRegion(VAddr addr, u64 size) {
131 rasterizer->OnCPUWrite(addr, size); 129 rasterizer->OnCPUWrite(addr, size);
132} 130}
133 131
134void ThreadManager::WaitIdle() const { 132void ThreadManager::ShutDown() {
135 while (state.last_fence > state.signaled_fence.load(std::memory_order_relaxed) && 133 if (!state.is_running) {
136 system.IsPoweredOn()) { 134 return;
137 } 135 }
136
137 {
138 std::lock_guard lk(state.write_lock);
139 state.is_running = false;
140 state.cv.notify_all();
141 }
142
143 if (!thread.joinable()) {
144 return;
145 }
146
147 // Notify GPU thread that a shutdown is pending
148 PushCommand(EndProcessingCommand());
149 thread.join();
138} 150}
139 151
140void ThreadManager::OnCommandListEnd() { 152void ThreadManager::OnCommandListEnd() {
141 PushCommand(OnCommandListEndCommand()); 153 PushCommand(OnCommandListEndCommand());
142} 154}
143 155
144u64 ThreadManager::PushCommand(CommandData&& command_data) { 156u64 ThreadManager::PushCommand(CommandData&& command_data, bool block) {
145 const u64 fence{++state.last_fence};
146 state.queue.Push(CommandDataContainer(std::move(command_data), fence));
147
148 if (!is_async) { 157 if (!is_async) {
149 // In synchronous GPU mode, block the caller until the command has executed 158 // In synchronous GPU mode, block the caller until the command has executed
150 WaitIdle(); 159 block = true;
160 }
161
162 std::unique_lock lk(state.write_lock);
163 const u64 fence{++state.last_fence};
164 state.queue.Push(CommandDataContainer(std::move(command_data), fence, block));
165
166 if (block) {
167 state.cv.wait(lk, [this, fence] {
168 return fence <= state.signaled_fence.load(std::memory_order_relaxed) ||
169 !state.is_running;
170 });
151 } 171 }
152 172
153 return fence; 173 return fence;
diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h
index 18269e51c..11a648f38 100644
--- a/src/video_core/gpu_thread.h
+++ b/src/video_core/gpu_thread.h
@@ -90,21 +90,24 @@ using CommandData =
90struct CommandDataContainer { 90struct CommandDataContainer {
91 CommandDataContainer() = default; 91 CommandDataContainer() = default;
92 92
93 explicit CommandDataContainer(CommandData&& data_, u64 next_fence_) 93 explicit CommandDataContainer(CommandData&& data_, u64 next_fence_, bool block_)
94 : data{std::move(data_)}, fence{next_fence_} {} 94 : data{std::move(data_)}, fence{next_fence_}, block(block_) {}
95 95
96 CommandData data; 96 CommandData data;
97 u64 fence{}; 97 u64 fence{};
98 bool block{};
98}; 99};
99 100
100/// Struct used to synchronize the GPU thread 101/// Struct used to synchronize the GPU thread
101struct SynchState final { 102struct SynchState final {
102 std::atomic_bool is_running{true}; 103 std::atomic_bool is_running{true};
103 104
104 using CommandQueue = Common::MPSCQueue<CommandDataContainer>; 105 using CommandQueue = Common::SPSCQueue<CommandDataContainer>;
106 std::mutex write_lock;
105 CommandQueue queue; 107 CommandQueue queue;
106 u64 last_fence{}; 108 u64 last_fence{};
107 std::atomic<u64> signaled_fence{}; 109 std::atomic<u64> signaled_fence{};
110 std::condition_variable cv;
108}; 111};
109 112
110/// Class used to manage the GPU thread 113/// Class used to manage the GPU thread
@@ -132,14 +135,14 @@ public:
132 /// Notify rasterizer that any caches of the specified region should be flushed and invalidated 135 /// Notify rasterizer that any caches of the specified region should be flushed and invalidated
133 void FlushAndInvalidateRegion(VAddr addr, u64 size); 136 void FlushAndInvalidateRegion(VAddr addr, u64 size);
134 137
135 // Wait until the gpu thread is idle. 138 // Stops the GPU execution and waits for the GPU to finish working
136 void WaitIdle() const; 139 void ShutDown();
137 140
138 void OnCommandListEnd(); 141 void OnCommandListEnd();
139 142
140private: 143private:
141 /// Pushes a command to be executed by the GPU thread 144 /// Pushes a command to be executed by the GPU thread
142 u64 PushCommand(CommandData&& command_data); 145 u64 PushCommand(CommandData&& command_data, bool block = false);
143 146
144 Core::System& system; 147 Core::System& system;
145 const bool is_async; 148 const bool is_async;