VERY experimental Nintendo Switch 2 emulator
C++
am: Implement ISelfController Exit Closes the current application.
Zach Hilman0182812fa43d
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cppindex c98fefdeb5..7d86496428 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"} {IDebugFunctions::~IDebugFunctions() = default;-ISelfController::ISelfController(Core::System& system_,- std::shared_ptr<NVFlinger::NVFlinger> nvflinger_)- : ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger_)) {+ISelfController::ISelfController(Core::System& system,+ std::shared_ptr<NVFlinger::NVFlinger> nvflinger)+ : ServiceFramework("ISelfController"), system(system), nvflinger(std::move(nvflinger)) {// clang-format offstatic const FunctionInfo functions[] = {- {0, nullptr, "Exit"},+ {0, &ISelfController::Exit, "Exit"},{1, &ISelfController::LockExit, "LockExit"},{2, &ISelfController::UnlockExit, "UnlockExit"},{3, &ISelfController::EnterFatalSection, "EnterFatalSection"},@@ -298,6 +298,15 @@ ISelfController::ISelfController(Core::System& system_,ISelfController::~ISelfController() = default;+void ISelfController::Exit(Kernel::HLERequestContext& ctx) {+ LOG_DEBUG(Service_AM, "called");++ system.Shutdown();++ IPC::ResponseBuilder rb{ctx, 2};+ rb.Push(RESULT_SUCCESS);+}+void ISelfController::LockExit(Kernel::HLERequestContext& ctx) {LOG_WARNING(Service_AM, "(STUBBED) called");diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.hindex 9d2c8b2cad..a3baeb6730 100644--- a/src/core/hle/service/am/am.h+++ b/src/core/hle/service/am/am.h@@ -125,6 +125,7 @@ public:~ISelfController() override;private:+ void Exit(Kernel::HLERequestContext& ctx);void LockExit(Kernel::HLERequestContext& ctx);void UnlockExit(Kernel::HLERequestContext& ctx);void EnterFatalSection(Kernel::HLERequestContext& ctx);@@ -153,6 +154,8 @@ private:u32 idle_time_detection_extension = 0;u64 num_fatal_sections_entered = 0;bool is_auto_sleep_disabled = false;++ Core::System& system;};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.hindex 0e0d108586..2e3e45915b 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;namespace AM {+class AppletMessageQueue;+class AppletAE final : public ServiceFramework<AppletAE> {public: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.hindex 99a65e7b50..758da792d9 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;namespace AM {+class AppletMessageQueue;+class AppletOE final : public ServiceFramework<AppletOE> {public:explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,