summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/am/am.cpp84
-rw-r--r--src/core/hle/service/am/am.h19
-rw-r--r--src/core/hle/service/am/applet_ae.cpp20
-rw-r--r--src/core/hle/service/am/applets/applet_error.cpp5
-rw-r--r--src/core/hle/service/nifm/nifm.cpp12
-rw-r--r--src/core/hle/service/nifm/nifm.h1
-rw-r--r--src/core/hle/service/pctl/pctl_module.cpp9
7 files changed, 144 insertions, 6 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index a92243fc7..3bb080883 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -764,6 +764,66 @@ void AppletMessageQueue::OperationModeChanged() {
764 on_operation_mode_changed->Signal(); 764 on_operation_mode_changed->Signal();
765} 765}
766 766
767ILockAccessor::ILockAccessor(Core::System& system_)
768 : ServiceFramework{system_, "ILockAccessor"}, service_context{system_, "ILockAccessor"} {
769 // clang-format off
770 static const FunctionInfo functions[] = {
771 {1, &ILockAccessor::TryLock, "TryLock"},
772 {2, &ILockAccessor::Unlock, "Unlock"},
773 {3, &ILockAccessor::GetEvent, "GetEvent"},
774 {4,&ILockAccessor::IsLocked, "IsLocked"},
775 };
776 // clang-format on
777
778 RegisterHandlers(functions);
779
780 lock_event = service_context.CreateEvent("ILockAccessor::LockEvent");
781}
782
783ILockAccessor::~ILockAccessor() = default;
784
785void ILockAccessor::TryLock(HLERequestContext& ctx) {
786 IPC::RequestParser rp{ctx};
787 const auto return_handle = rp.Pop<bool>();
788
789 LOG_WARNING(Service_AM, "(STUBBED) called, return_handle={}", return_handle);
790
791 // TODO: When return_handle is true this function should return the lock handle
792
793 is_locked = true;
794
795 IPC::ResponseBuilder rb{ctx, 3};
796 rb.Push(ResultSuccess);
797 rb.Push<u8>(is_locked);
798}
799
800void ILockAccessor::Unlock(HLERequestContext& ctx) {
801 LOG_INFO(Service_AM, "called");
802
803 is_locked = false;
804
805 IPC::ResponseBuilder rb{ctx, 2};
806 rb.Push(ResultSuccess);
807}
808
809void ILockAccessor::GetEvent(HLERequestContext& ctx) {
810 LOG_INFO(Service_AM, "called");
811
812 lock_event->Signal();
813
814 IPC::ResponseBuilder rb{ctx, 2, 1};
815 rb.Push(ResultSuccess);
816 rb.PushCopyObjects(lock_event->GetReadableEvent());
817}
818
819void ILockAccessor::IsLocked(HLERequestContext& ctx) {
820 LOG_INFO(Service_AM, "called");
821
822 IPC::ResponseBuilder rb{ctx, 2};
823 rb.Push(ResultSuccess);
824 rb.Push<u8>(is_locked);
825}
826
767ICommonStateGetter::ICommonStateGetter(Core::System& system_, 827ICommonStateGetter::ICommonStateGetter(Core::System& system_,
768 std::shared_ptr<AppletMessageQueue> msg_queue_) 828 std::shared_ptr<AppletMessageQueue> msg_queue_)
769 : ServiceFramework{system_, "ICommonStateGetter"}, msg_queue{std::move(msg_queue_)}, 829 : ServiceFramework{system_, "ICommonStateGetter"}, msg_queue{std::move(msg_queue_)},
@@ -787,7 +847,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_,
787 {14, nullptr, "GetWakeupCount"}, 847 {14, nullptr, "GetWakeupCount"},
788 {20, nullptr, "PushToGeneralChannel"}, 848 {20, nullptr, "PushToGeneralChannel"},
789 {30, nullptr, "GetHomeButtonReaderLockAccessor"}, 849 {30, nullptr, "GetHomeButtonReaderLockAccessor"},
790 {31, nullptr, "GetReaderLockAccessorEx"}, 850 {31, &ICommonStateGetter::GetReaderLockAccessorEx, "GetReaderLockAccessorEx"},
791 {32, nullptr, "GetWriterLockAccessorEx"}, 851 {32, nullptr, "GetWriterLockAccessorEx"},
792 {40, nullptr, "GetCradleFwVersion"}, 852 {40, nullptr, "GetCradleFwVersion"},
793 {50, &ICommonStateGetter::IsVrModeEnabled, "IsVrModeEnabled"}, 853 {50, &ICommonStateGetter::IsVrModeEnabled, "IsVrModeEnabled"},
@@ -805,7 +865,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_,
805 {65, nullptr, "GetApplicationIdByContentActionName"}, 865 {65, nullptr, "GetApplicationIdByContentActionName"},
806 {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, 866 {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"},
807 {67, nullptr, "CancelCpuBoostMode"}, 867 {67, nullptr, "CancelCpuBoostMode"},
808 {68, nullptr, "GetBuiltInDisplayType"}, 868 {68, &ICommonStateGetter::GetBuiltInDisplayType, "GetBuiltInDisplayType"},
809 {80, &ICommonStateGetter::PerformSystemButtonPressingIfInFocus, "PerformSystemButtonPressingIfInFocus"}, 869 {80, &ICommonStateGetter::PerformSystemButtonPressingIfInFocus, "PerformSystemButtonPressingIfInFocus"},
810 {90, nullptr, "SetPerformanceConfigurationChangedNotification"}, 870 {90, nullptr, "SetPerformanceConfigurationChangedNotification"},
811 {91, nullptr, "GetCurrentPerformanceConfiguration"}, 871 {91, nullptr, "GetCurrentPerformanceConfiguration"},
@@ -886,6 +946,18 @@ void ICommonStateGetter::RequestToAcquireSleepLock(HLERequestContext& ctx) {
886 rb.Push(ResultSuccess); 946 rb.Push(ResultSuccess);
887} 947}
888 948
949void ICommonStateGetter::GetReaderLockAccessorEx(HLERequestContext& ctx) {
950 IPC::RequestParser rp{ctx};
951 const auto unknown = rp.Pop<u32>();
952
953 LOG_INFO(Service_AM, "called, unknown={}", unknown);
954
955 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
956
957 rb.Push(ResultSuccess);
958 rb.PushIpcInterface<ILockAccessor>(system);
959}
960
889void ICommonStateGetter::GetAcquiredSleepLockEvent(HLERequestContext& ctx) { 961void ICommonStateGetter::GetAcquiredSleepLockEvent(HLERequestContext& ctx) {
890 LOG_WARNING(Service_AM, "called"); 962 LOG_WARNING(Service_AM, "called");
891 963
@@ -970,6 +1042,14 @@ void ICommonStateGetter::SetCpuBoostMode(HLERequestContext& ctx) {
970 apm_sys->SetCpuBoostMode(ctx); 1042 apm_sys->SetCpuBoostMode(ctx);
971} 1043}
972 1044
1045void ICommonStateGetter::GetBuiltInDisplayType(HLERequestContext& ctx) {
1046 LOG_WARNING(Service_AM, "(STUBBED) called");
1047
1048 IPC::ResponseBuilder rb{ctx, 3};
1049 rb.Push(ResultSuccess);
1050 rb.Push(0);
1051}
1052
973void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx) { 1053void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx) {
974 IPC::RequestParser rp{ctx}; 1054 IPC::RequestParser rp{ctx};
975 const auto system_button{rp.PopEnum<SystemButtonType>()}; 1055 const auto system_button{rp.PopEnum<SystemButtonType>()};
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 62994a13f..4a045cfd4 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -195,6 +195,23 @@ private:
195 ScreenshotPermission screenshot_permission = ScreenshotPermission::Inherit; 195 ScreenshotPermission screenshot_permission = ScreenshotPermission::Inherit;
196}; 196};
197 197
198class ILockAccessor final : public ServiceFramework<ILockAccessor> {
199public:
200 explicit ILockAccessor(Core::System& system_);
201 ~ILockAccessor() override;
202
203private:
204 void TryLock(HLERequestContext& ctx);
205 void Unlock(HLERequestContext& ctx);
206 void GetEvent(HLERequestContext& ctx);
207 void IsLocked(HLERequestContext& ctx);
208
209 bool is_locked{};
210
211 Kernel::KEvent* lock_event;
212 KernelHelpers::ServiceContext service_context;
213};
214
198class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { 215class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {
199public: 216public:
200 explicit ICommonStateGetter(Core::System& system_, 217 explicit ICommonStateGetter(Core::System& system_,
@@ -237,6 +254,7 @@ private:
237 void GetCurrentFocusState(HLERequestContext& ctx); 254 void GetCurrentFocusState(HLERequestContext& ctx);
238 void RequestToAcquireSleepLock(HLERequestContext& ctx); 255 void RequestToAcquireSleepLock(HLERequestContext& ctx);
239 void GetAcquiredSleepLockEvent(HLERequestContext& ctx); 256 void GetAcquiredSleepLockEvent(HLERequestContext& ctx);
257 void GetReaderLockAccessorEx(HLERequestContext& ctx);
240 void GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx); 258 void GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx);
241 void GetOperationMode(HLERequestContext& ctx); 259 void GetOperationMode(HLERequestContext& ctx);
242 void GetPerformanceMode(HLERequestContext& ctx); 260 void GetPerformanceMode(HLERequestContext& ctx);
@@ -248,6 +266,7 @@ private:
248 void EndVrModeEx(HLERequestContext& ctx); 266 void EndVrModeEx(HLERequestContext& ctx);
249 void GetDefaultDisplayResolution(HLERequestContext& ctx); 267 void GetDefaultDisplayResolution(HLERequestContext& ctx);
250 void SetCpuBoostMode(HLERequestContext& ctx); 268 void SetCpuBoostMode(HLERequestContext& ctx);
269 void GetBuiltInDisplayType(HLERequestContext& ctx);
251 void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx); 270 void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx);
252 void GetSettingsPlatformRegion(HLERequestContext& ctx); 271 void GetSettingsPlatformRegion(HLERequestContext& ctx);
253 void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx); 272 void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx);
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp
index eb12312cc..e30e6478a 100644
--- a/src/core/hle/service/am/applet_ae.cpp
+++ b/src/core/hle/service/am/applet_ae.cpp
@@ -28,8 +28,8 @@ public:
28 {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"}, 28 {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
29 {20, &ILibraryAppletProxy::OpenLibraryAppletSelfAccessor, "OpenLibraryAppletSelfAccessor"}, 29 {20, &ILibraryAppletProxy::OpenLibraryAppletSelfAccessor, "OpenLibraryAppletSelfAccessor"},
30 {21, &ILibraryAppletProxy::GetAppletCommonFunctions, "GetAppletCommonFunctions"}, 30 {21, &ILibraryAppletProxy::GetAppletCommonFunctions, "GetAppletCommonFunctions"},
31 {22, nullptr, "GetHomeMenuFunctions"}, 31 {22, &ILibraryAppletProxy::GetHomeMenuFunctions, "GetHomeMenuFunctions"},
32 {23, nullptr, "GetGlobalStateController"}, 32 {23, &ILibraryAppletProxy::GetGlobalStateController, "GetGlobalStateController"},
33 {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"}, 33 {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
34 }; 34 };
35 // clang-format on 35 // clang-format on
@@ -110,6 +110,22 @@ private:
110 rb.PushIpcInterface<IAppletCommonFunctions>(system); 110 rb.PushIpcInterface<IAppletCommonFunctions>(system);
111 } 111 }
112 112
113 void GetHomeMenuFunctions(HLERequestContext& ctx) {
114 LOG_DEBUG(Service_AM, "called");
115
116 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
117 rb.Push(ResultSuccess);
118 rb.PushIpcInterface<IHomeMenuFunctions>(system);
119 }
120
121 void GetGlobalStateController(HLERequestContext& ctx) {
122 LOG_DEBUG(Service_AM, "called");
123
124 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
125 rb.Push(ResultSuccess);
126 rb.PushIpcInterface<IGlobalStateController>(system);
127 }
128
113 void GetDebugFunctions(HLERequestContext& ctx) { 129 void GetDebugFunctions(HLERequestContext& ctx) {
114 LOG_DEBUG(Service_AM, "called"); 130 LOG_DEBUG(Service_AM, "called");
115 131
diff --git a/src/core/hle/service/am/applets/applet_error.cpp b/src/core/hle/service/am/applets/applet_error.cpp
index b46ea840c..5d17c353f 100644
--- a/src/core/hle/service/am/applets/applet_error.cpp
+++ b/src/core/hle/service/am/applets/applet_error.cpp
@@ -138,6 +138,10 @@ void Error::Initialize() {
138 CopyArgumentData(data, args->application_error); 138 CopyArgumentData(data, args->application_error);
139 error_code = Result(args->application_error.error_code); 139 error_code = Result(args->application_error.error_code);
140 break; 140 break;
141 case ErrorAppletMode::ShowErrorPctl:
142 CopyArgumentData(data, args->error_record);
143 error_code = Decode64BitError(args->error_record.error_code_64);
144 break;
141 case ErrorAppletMode::ShowErrorRecord: 145 case ErrorAppletMode::ShowErrorRecord:
142 CopyArgumentData(data, args->error_record); 146 CopyArgumentData(data, args->error_record);
143 error_code = Decode64BitError(args->error_record.error_code_64); 147 error_code = Decode64BitError(args->error_record.error_code_64);
@@ -191,6 +195,7 @@ void Error::Execute() {
191 frontend.ShowCustomErrorText(error_code, main_text_string, detail_text_string, callback); 195 frontend.ShowCustomErrorText(error_code, main_text_string, detail_text_string, callback);
192 break; 196 break;
193 } 197 }
198 case ErrorAppletMode::ShowErrorPctl:
194 case ErrorAppletMode::ShowErrorRecord: 199 case ErrorAppletMode::ShowErrorRecord:
195 reporter.SaveErrorReport(title_id, error_code, 200 reporter.SaveErrorReport(title_id, error_code,
196 fmt::format("{:016X}", args->error_record.posix_time)); 201 fmt::format("{:016X}", args->error_record.posix_time));
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index 21b06d10b..22dc55a6d 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -545,6 +545,16 @@ void IGeneralService::IsAnyInternetRequestAccepted(HLERequestContext& ctx) {
545 } 545 }
546} 546}
547 547
548void IGeneralService::IsAnyForegroundRequestAccepted(HLERequestContext& ctx) {
549 const bool is_accepted{};
550
551 LOG_WARNING(Service_NIFM, "(STUBBED) called, is_accepted={}", is_accepted);
552
553 IPC::ResponseBuilder rb{ctx, 3};
554 rb.Push(ResultSuccess);
555 rb.Push<u8>(is_accepted);
556}
557
548IGeneralService::IGeneralService(Core::System& system_) 558IGeneralService::IGeneralService(Core::System& system_)
549 : ServiceFramework{system_, "IGeneralService"}, network{system_.GetRoomNetwork()} { 559 : ServiceFramework{system_, "IGeneralService"}, network{system_.GetRoomNetwork()} {
550 // clang-format off 560 // clang-format off
@@ -569,7 +579,7 @@ IGeneralService::IGeneralService(Core::System& system_)
569 {19, nullptr, "SetEthernetCommunicationEnabled"}, 579 {19, nullptr, "SetEthernetCommunicationEnabled"},
570 {20, &IGeneralService::IsEthernetCommunicationEnabled, "IsEthernetCommunicationEnabled"}, 580 {20, &IGeneralService::IsEthernetCommunicationEnabled, "IsEthernetCommunicationEnabled"},
571 {21, &IGeneralService::IsAnyInternetRequestAccepted, "IsAnyInternetRequestAccepted"}, 581 {21, &IGeneralService::IsAnyInternetRequestAccepted, "IsAnyInternetRequestAccepted"},
572 {22, nullptr, "IsAnyForegroundRequestAccepted"}, 582 {22, &IGeneralService::IsAnyForegroundRequestAccepted, "IsAnyForegroundRequestAccepted"},
573 {23, nullptr, "PutToSleep"}, 583 {23, nullptr, "PutToSleep"},
574 {24, nullptr, "WakeUp"}, 584 {24, nullptr, "WakeUp"},
575 {25, nullptr, "GetSsidListVersion"}, 585 {25, nullptr, "GetSsidListVersion"},
diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h
index ae99c4695..b74b66438 100644
--- a/src/core/hle/service/nifm/nifm.h
+++ b/src/core/hle/service/nifm/nifm.h
@@ -35,6 +35,7 @@ private:
35 void GetInternetConnectionStatus(HLERequestContext& ctx); 35 void GetInternetConnectionStatus(HLERequestContext& ctx);
36 void IsEthernetCommunicationEnabled(HLERequestContext& ctx); 36 void IsEthernetCommunicationEnabled(HLERequestContext& ctx);
37 void IsAnyInternetRequestAccepted(HLERequestContext& ctx); 37 void IsAnyInternetRequestAccepted(HLERequestContext& ctx);
38 void IsAnyForegroundRequestAccepted(HLERequestContext& ctx);
38 39
39 Network::RoomNetwork& network; 40 Network::RoomNetwork& network;
40}; 41};
diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp
index 5db1703d1..938330dd0 100644
--- a/src/core/hle/service/pctl/pctl_module.cpp
+++ b/src/core/hle/service/pctl/pctl_module.cpp
@@ -33,7 +33,7 @@ public:
33 {1001, &IParentalControlService::CheckFreeCommunicationPermission, "CheckFreeCommunicationPermission"}, 33 {1001, &IParentalControlService::CheckFreeCommunicationPermission, "CheckFreeCommunicationPermission"},
34 {1002, nullptr, "ConfirmLaunchApplicationPermission"}, 34 {1002, nullptr, "ConfirmLaunchApplicationPermission"},
35 {1003, nullptr, "ConfirmResumeApplicationPermission"}, 35 {1003, nullptr, "ConfirmResumeApplicationPermission"},
36 {1004, nullptr, "ConfirmSnsPostPermission"}, 36 {1004, &IParentalControlService::ConfirmSnsPostPermission, "ConfirmSnsPostPermission"},
37 {1005, nullptr, "ConfirmSystemSettingsPermission"}, 37 {1005, nullptr, "ConfirmSystemSettingsPermission"},
38 {1006, &IParentalControlService::IsRestrictionTemporaryUnlocked, "IsRestrictionTemporaryUnlocked"}, 38 {1006, &IParentalControlService::IsRestrictionTemporaryUnlocked, "IsRestrictionTemporaryUnlocked"},
39 {1007, nullptr, "RevertRestrictionTemporaryUnlocked"}, 39 {1007, nullptr, "RevertRestrictionTemporaryUnlocked"},
@@ -236,6 +236,13 @@ private:
236 states.free_communication = true; 236 states.free_communication = true;
237 } 237 }
238 238
239 void ConfirmSnsPostPermission(HLERequestContext& ctx) {
240 LOG_WARNING(Service_PCTL, "(STUBBED) called");
241
242 IPC::ResponseBuilder rb{ctx, 2};
243 rb.Push(Error::ResultNoFreeCommunication);
244 }
245
239 void IsRestrictionTemporaryUnlocked(HLERequestContext& ctx) { 246 void IsRestrictionTemporaryUnlocked(HLERequestContext& ctx) {
240 const bool is_temporary_unlocked = false; 247 const bool is_temporary_unlocked = false;
241 248