summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/am/am.cpp28
-rw-r--r--src/core/hle/service/am/am.h3
2 files changed, 29 insertions, 2 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 336593108..d31ab7970 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -239,8 +239,8 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger
239 {0, nullptr, "Exit"}, 239 {0, nullptr, "Exit"},
240 {1, &ISelfController::LockExit, "LockExit"}, 240 {1, &ISelfController::LockExit, "LockExit"},
241 {2, &ISelfController::UnlockExit, "UnlockExit"}, 241 {2, &ISelfController::UnlockExit, "UnlockExit"},
242 {3, nullptr, "EnterFatalSection"}, 242 {3, &ISelfController::EnterFatalSection, "EnterFatalSection"},
243 {4, nullptr, "LeaveFatalSection"}, 243 {4, &ISelfController::LeaveFatalSection, "LeaveFatalSection"},
244 {9, &ISelfController::GetLibraryAppletLaunchableEvent, "GetLibraryAppletLaunchableEvent"}, 244 {9, &ISelfController::GetLibraryAppletLaunchableEvent, "GetLibraryAppletLaunchableEvent"},
245 {10, &ISelfController::SetScreenShotPermission, "SetScreenShotPermission"}, 245 {10, &ISelfController::SetScreenShotPermission, "SetScreenShotPermission"},
246 {11, &ISelfController::SetOperationModeChangedNotification, "SetOperationModeChangedNotification"}, 246 {11, &ISelfController::SetOperationModeChangedNotification, "SetOperationModeChangedNotification"},
@@ -299,6 +299,30 @@ void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) {
299 rb.Push(RESULT_SUCCESS); 299 rb.Push(RESULT_SUCCESS);
300} 300}
301 301
302void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) {
303 ++num_fatal_sections_entered;
304 LOG_DEBUG(Service_AM, "called. Num fatal sections entered: {}", num_fatal_sections_entered);
305
306 IPC::ResponseBuilder rb{ctx, 2};
307 rb.Push(RESULT_SUCCESS);
308}
309
310void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) {
311 LOG_DEBUG(Service_AM, "called.");
312
313 // Entry and exit of fatal sections must be balanced.
314 if (num_fatal_sections_entered == 0) {
315 IPC::ResponseBuilder rb{ctx, 2};
316 rb.Push(ResultCode{ErrorModule::AM, 512});
317 return;
318 }
319
320 --num_fatal_sections_entered;
321
322 IPC::ResponseBuilder rb{ctx, 2};
323 rb.Push(RESULT_SUCCESS);
324}
325
302void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { 326void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) {
303 LOG_WARNING(Service_AM, "(STUBBED) called"); 327 LOG_WARNING(Service_AM, "(STUBBED) called");
304 328
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 222e6bcde..991b7d47c 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -119,6 +119,8 @@ public:
119private: 119private:
120 void LockExit(Kernel::HLERequestContext& ctx); 120 void LockExit(Kernel::HLERequestContext& ctx);
121 void UnlockExit(Kernel::HLERequestContext& ctx); 121 void UnlockExit(Kernel::HLERequestContext& ctx);
122 void EnterFatalSection(Kernel::HLERequestContext& ctx);
123 void LeaveFatalSection(Kernel::HLERequestContext& ctx);
122 void GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx); 124 void GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx);
123 void SetScreenShotPermission(Kernel::HLERequestContext& ctx); 125 void SetScreenShotPermission(Kernel::HLERequestContext& ctx);
124 void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx); 126 void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx);
@@ -135,6 +137,7 @@ private:
135 std::shared_ptr<NVFlinger::NVFlinger> nvflinger; 137 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
136 Kernel::EventPair launchable_event; 138 Kernel::EventPair launchable_event;
137 u32 idle_time_detection_extension = 0; 139 u32 idle_time_detection_extension = 0;
140 u64 num_fatal_sections_entered = 0;
138}; 141};
139 142
140class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { 143class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {