am: Implement ISelfController Exit

Closes the current application.
This commit is contained in:
Zach Hilman 2019-07-06 13:41:38 -04:00
parent 4c1c8801a5
commit a7fda84902
4 changed files with 20 additions and 4 deletions

View file

@ -232,12 +232,12 @@ IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} {
IDebugFunctions::~IDebugFunctions() = default; IDebugFunctions::~IDebugFunctions() = default;
ISelfController::ISelfController(Core::System& system_, ISelfController::ISelfController(Core::System& system,
std::shared_ptr<NVFlinger::NVFlinger> nvflinger_) std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
: ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger_)) { : ServiceFramework("ISelfController"), system(system), nvflinger(std::move(nvflinger)) {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "Exit"}, {0, &ISelfController::Exit, "Exit"},
{1, &ISelfController::LockExit, "LockExit"}, {1, &ISelfController::LockExit, "LockExit"},
{2, &ISelfController::UnlockExit, "UnlockExit"}, {2, &ISelfController::UnlockExit, "UnlockExit"},
{3, &ISelfController::EnterFatalSection, "EnterFatalSection"}, {3, &ISelfController::EnterFatalSection, "EnterFatalSection"},
@ -298,6 +298,15 @@ ISelfController::ISelfController(Core::System& system_,
ISelfController::~ISelfController() = default; 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) { void ISelfController::LockExit(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");

View file

@ -125,6 +125,7 @@ public:
~ISelfController() override; ~ISelfController() override;
private: private:
void Exit(Kernel::HLERequestContext& ctx);
void LockExit(Kernel::HLERequestContext& ctx); void LockExit(Kernel::HLERequestContext& ctx);
void UnlockExit(Kernel::HLERequestContext& ctx); void UnlockExit(Kernel::HLERequestContext& ctx);
void EnterFatalSection(Kernel::HLERequestContext& ctx); void EnterFatalSection(Kernel::HLERequestContext& ctx);
@ -153,6 +154,8 @@ private:
u32 idle_time_detection_extension = 0; u32 idle_time_detection_extension = 0;
u64 num_fatal_sections_entered = 0; u64 num_fatal_sections_entered = 0;
bool is_auto_sleep_disabled = false; bool is_auto_sleep_disabled = false;
Core::System& system;
}; };
class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {

View file

@ -19,6 +19,8 @@ class NVFlinger;
namespace AM { namespace AM {
class AppletMessageQueue;
class AppletAE final : public ServiceFramework<AppletAE> { class AppletAE final : public ServiceFramework<AppletAE> {
public: public:
explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,

View file

@ -19,6 +19,8 @@ class NVFlinger;
namespace AM { namespace AM {
class AppletMessageQueue;
class AppletOE final : public ServiceFramework<AppletOE> { class AppletOE final : public ServiceFramework<AppletOE> {
public: public:
explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger, explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger,