From 46b3624c5256da483222e04ec0231e61a70ac10d Mon Sep 17 00:00:00 2001 From: Andrew Hawes <117602754+Andrew1Hawes@users.noreply.github.com> Date: Tue, 21 May 2024 23:14:41 +0100 Subject: [PATCH] Add Shutdown option --- src/config.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/config.cpp b/src/config.cpp index 26e507e..992581d 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include WUPS_USE_STORAGE("CloseRestartGamePlugin"); @@ -43,6 +44,7 @@ static bool sCloseNow = false; static bool sRestartNow = false; static bool sSwitchUsers = false; static bool sManageData = false; +static bool sShutdownNow = false; void checkboxItemChanged(ConfigItemCheckbox *item, bool newValue) { @@ -55,6 +57,8 @@ void checkboxItemChanged(ConfigItemCheckbox *item, bool newValue) sSwitchUsers = newValue; } else if (std::string_view("sManageData") == item->identifier) { sManageData = newValue; + } else if (std::string_view("sShutdownNow") == item->identifier) { + sShutdownNow = newValue; } } } @@ -122,6 +126,12 @@ WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHandle ro root.add(WUPSConfigItemStub::Create("\uE06B Game options will appear here when in-game")); } + root.add(WUPSConfigItemCheckbox::Create("sShutdownNow", + "Shutdown \uE040", + false, + sShutdownNow, + &checkboxItemChanged)); + // Category: HOME Menu settings auto homeMenuSettings = WUPSConfigCategory::Create("\ue073 Menu settings"); @@ -195,11 +205,14 @@ void ConfigMenuClosedCallback() } else { _SYSLaunchSettings(&settingsArgs); } + } else if (sShutdownNow) { + OSShutdown(); } sCloseNow = false; sRestartNow = false; sSwitchUsers = false; sManageData = false; + sShutdownNow = false; } void initConfig()