diff options
| author | 2019-09-23 00:37:12 +1000 | |
|---|---|---|
| committer | 2019-09-23 00:37:12 +1000 | |
| commit | aaec1562f8631303d1a5abb6c75f2422d6d7cf71 (patch) | |
| tree | 283ac1330252c06b3a1741730ce49f4182330150 /src/core/hle | |
| parent | Merge pull request #2889 from FearlessTobi/adwsawdawd (diff) | |
| parent | main: Use const on all variable initializations (diff) | |
| download | yuzu-aaec1562f8631303d1a5abb6c75f2422d6d7cf71.tar.gz yuzu-aaec1562f8631303d1a5abb6c75f2422d6d7cf71.tar.xz yuzu-aaec1562f8631303d1a5abb6c75f2422d6d7cf71.zip | |
Merge pull request #2683 from DarkLordZach/lock-exit
am: Implement exit locking and self exit commands
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 31 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 5 | ||||
| -rw-r--r-- | src/core/hle/service/am/applet_ae.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/applet_oe.h | 2 |
4 files changed, 33 insertions, 7 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 3366fd8ce..797c9a06f 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -232,12 +232,12 @@ IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} { | |||
| 232 | 232 | ||
| 233 | IDebugFunctions::~IDebugFunctions() = default; | 233 | IDebugFunctions::~IDebugFunctions() = default; |
| 234 | 234 | ||
| 235 | ISelfController::ISelfController(Core::System& system_, | 235 | ISelfController::ISelfController(Core::System& system, |
| 236 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger_) | 236 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger) |
| 237 | : ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger_)) { | 237 | : ServiceFramework("ISelfController"), system(system), nvflinger(std::move(nvflinger)) { |
| 238 | // clang-format off | 238 | // clang-format off |
| 239 | static const FunctionInfo functions[] = { | 239 | static const FunctionInfo functions[] = { |
| 240 | {0, nullptr, "Exit"}, | 240 | {0, &ISelfController::Exit, "Exit"}, |
| 241 | {1, &ISelfController::LockExit, "LockExit"}, | 241 | {1, &ISelfController::LockExit, "LockExit"}, |
| 242 | {2, &ISelfController::UnlockExit, "UnlockExit"}, | 242 | {2, &ISelfController::UnlockExit, "UnlockExit"}, |
| 243 | {3, &ISelfController::EnterFatalSection, "EnterFatalSection"}, | 243 | {3, &ISelfController::EnterFatalSection, "EnterFatalSection"}, |
| @@ -282,7 +282,7 @@ ISelfController::ISelfController(Core::System& system_, | |||
| 282 | 282 | ||
| 283 | RegisterHandlers(functions); | 283 | RegisterHandlers(functions); |
| 284 | 284 | ||
| 285 | auto& kernel = system_.Kernel(); | 285 | auto& kernel = system.Kernel(); |
| 286 | launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, | 286 | launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, |
| 287 | "ISelfController:LaunchableEvent"); | 287 | "ISelfController:LaunchableEvent"); |
| 288 | 288 | ||
| @@ -298,15 +298,28 @@ ISelfController::ISelfController(Core::System& system_, | |||
| 298 | 298 | ||
| 299 | ISelfController::~ISelfController() = default; | 299 | ISelfController::~ISelfController() = default; |
| 300 | 300 | ||
| 301 | void ISelfController::Exit(Kernel::HLERequestContext& ctx) { | ||
| 302 | LOG_DEBUG(Service_AM, "called"); | ||
| 303 | |||
| 304 | system.Shutdown(); | ||
| 305 | |||
| 306 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 307 | rb.Push(RESULT_SUCCESS); | ||
| 308 | } | ||
| 309 | |||
| 301 | void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { | 310 | void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { |
| 302 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 311 | LOG_DEBUG(Service_AM, "called"); |
| 312 | |||
| 313 | system.SetExitLock(true); | ||
| 303 | 314 | ||
| 304 | IPC::ResponseBuilder rb{ctx, 2}; | 315 | IPC::ResponseBuilder rb{ctx, 2}; |
| 305 | rb.Push(RESULT_SUCCESS); | 316 | rb.Push(RESULT_SUCCESS); |
| 306 | } | 317 | } |
| 307 | 318 | ||
| 308 | void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { | 319 | void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { |
| 309 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 320 | LOG_DEBUG(Service_AM, "called"); |
| 321 | |||
| 322 | system.SetExitLock(false); | ||
| 310 | 323 | ||
| 311 | IPC::ResponseBuilder rb{ctx, 2}; | 324 | IPC::ResponseBuilder rb{ctx, 2}; |
| 312 | rb.Push(RESULT_SUCCESS); | 325 | rb.Push(RESULT_SUCCESS); |
| @@ -550,6 +563,10 @@ void AppletMessageQueue::OperationModeChanged() { | |||
| 550 | on_operation_mode_changed.writable->Signal(); | 563 | on_operation_mode_changed.writable->Signal(); |
| 551 | } | 564 | } |
| 552 | 565 | ||
| 566 | void AppletMessageQueue::RequestExit() { | ||
| 567 | PushMessage(AppletMessage::ExitRequested); | ||
| 568 | } | ||
| 569 | |||
| 553 | ICommonStateGetter::ICommonStateGetter(Core::System& system, | 570 | ICommonStateGetter::ICommonStateGetter(Core::System& system, |
| 554 | std::shared_ptr<AppletMessageQueue> msg_queue) | 571 | std::shared_ptr<AppletMessageQueue> msg_queue) |
| 555 | : ServiceFramework("ICommonStateGetter"), system(system), msg_queue(std::move(msg_queue)) { | 572 | : ServiceFramework("ICommonStateGetter"), system(system), msg_queue(std::move(msg_queue)) { |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 28f870302..a3baeb673 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -45,6 +45,7 @@ class AppletMessageQueue { | |||
| 45 | public: | 45 | public: |
| 46 | enum class AppletMessage : u32 { | 46 | enum class AppletMessage : u32 { |
| 47 | NoMessage = 0, | 47 | NoMessage = 0, |
| 48 | ExitRequested = 4, | ||
| 48 | FocusStateChanged = 15, | 49 | FocusStateChanged = 15, |
| 49 | OperationModeChanged = 30, | 50 | OperationModeChanged = 30, |
| 50 | PerformanceModeChanged = 31, | 51 | PerformanceModeChanged = 31, |
| @@ -59,6 +60,7 @@ public: | |||
| 59 | AppletMessage PopMessage(); | 60 | AppletMessage PopMessage(); |
| 60 | std::size_t GetMessageCount() const; | 61 | std::size_t GetMessageCount() const; |
| 61 | void OperationModeChanged(); | 62 | void OperationModeChanged(); |
| 63 | void RequestExit(); | ||
| 62 | 64 | ||
| 63 | private: | 65 | private: |
| 64 | std::queue<AppletMessage> messages; | 66 | std::queue<AppletMessage> messages; |
| @@ -123,6 +125,7 @@ public: | |||
| 123 | ~ISelfController() override; | 125 | ~ISelfController() override; |
| 124 | 126 | ||
| 125 | private: | 127 | private: |
| 128 | void Exit(Kernel::HLERequestContext& ctx); | ||
| 126 | void LockExit(Kernel::HLERequestContext& ctx); | 129 | void LockExit(Kernel::HLERequestContext& ctx); |
| 127 | void UnlockExit(Kernel::HLERequestContext& ctx); | 130 | void UnlockExit(Kernel::HLERequestContext& ctx); |
| 128 | void EnterFatalSection(Kernel::HLERequestContext& ctx); | 131 | void EnterFatalSection(Kernel::HLERequestContext& ctx); |
| @@ -151,6 +154,8 @@ private: | |||
| 151 | u32 idle_time_detection_extension = 0; | 154 | u32 idle_time_detection_extension = 0; |
| 152 | u64 num_fatal_sections_entered = 0; | 155 | u64 num_fatal_sections_entered = 0; |
| 153 | bool is_auto_sleep_disabled = false; | 156 | bool is_auto_sleep_disabled = false; |
| 157 | |||
| 158 | Core::System& system; | ||
| 154 | }; | 159 | }; |
| 155 | 160 | ||
| 156 | class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { | 161 | class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { |
diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h index 0e0d10858..2e3e45915 100644 --- a/src/core/hle/service/am/applet_ae.h +++ b/src/core/hle/service/am/applet_ae.h | |||
| @@ -19,6 +19,8 @@ class NVFlinger; | |||
| 19 | 19 | ||
| 20 | namespace AM { | 20 | namespace AM { |
| 21 | 21 | ||
| 22 | class AppletMessageQueue; | ||
| 23 | |||
| 22 | class AppletAE final : public ServiceFramework<AppletAE> { | 24 | class AppletAE final : public ServiceFramework<AppletAE> { |
| 23 | public: | 25 | public: |
| 24 | explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, | 26 | explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, |
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h index 99a65e7b5..758da792d 100644 --- a/src/core/hle/service/am/applet_oe.h +++ b/src/core/hle/service/am/applet_oe.h | |||
| @@ -19,6 +19,8 @@ class NVFlinger; | |||
| 19 | 19 | ||
| 20 | namespace AM { | 20 | namespace AM { |
| 21 | 21 | ||
| 22 | class AppletMessageQueue; | ||
| 23 | |||
| 22 | class AppletOE final : public ServiceFramework<AppletOE> { | 24 | class AppletOE final : public ServiceFramework<AppletOE> { |
| 23 | public: | 25 | public: |
| 24 | explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, | 26 | explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, |