diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp
index cf693e3b0..2ff50db25 100644
--- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp
+++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp
@@ -112,10 +112,25 @@ namespace ams::mitm::bpc {
fsFileRead(&payload_file, 0, g_reboot_payload, sizeof(g_reboot_payload), FsReadOption_None, &actual_size);
}
- /* TODO: Parse reboot type from settings. */
+ /* NOTE: Preferred reboot type will be parsed from settings later on. */
g_reboot_type = RebootType::ToPayload;
return ResultSuccess();
}
+ Result DetectPreferredRebootFunctionality() {
+ char reboot_type[0x40] = {};
+ settings::fwdbg::GetSettingsItemValue(reboot_type, sizeof(reboot_type) - 1, "atmosphere", "power_menu_reboot_function");
+
+ if (strcasecmp(reboot_type, "stock") == 0 || strcasecmp(reboot_type, "normal") == 0 || strcasecmp(reboot_type, "standard") == 0) {
+ g_reboot_type = RebootType::Standard;
+ } else if (strcasecmp(reboot_type, "rcm") == 0) {
+ g_reboot_type = RebootType::ToRcm;
+ } else if (strcasecmp(reboot_type, "payload") == 0) {
+ g_reboot_type = RebootType::ToPayload;
+ }
+
+ return ResultSuccess();
+ }
+
}
diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.hpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.hpp
index 841678ab6..1f15d266f 100644
--- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.hpp
+++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.hpp
@@ -25,6 +25,7 @@ namespace ams::mitm::bpc {
/* Atmosphere power utilities. */
Result LoadRebootPayload();
+ Result DetectPreferredRebootFunctionality();
void RebootForFatalError(const ams::FatalErrorContext *ctx);
}
diff --git a/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp b/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp
index 801561e48..b77f1a7c6 100644
--- a/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp
+++ b/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp
@@ -14,6 +14,7 @@
* along with this program. If not, see .
*/
#include "../amsmitm_initialization.hpp"
+#include "../bpc_mitm/bpc_ams_power_utils.hpp"
#include "setmitm_module.hpp"
#include "set_mitm_service.hpp"
#include "setsys_mitm_service.hpp"
@@ -45,6 +46,9 @@ namespace ams::mitm::settings {
/* Load settings off the SD card. */
ams::settings::fwdbg::InitializeSdCardKeyValueStore();
+ /* Ensure that we reboot using the user's preferred method. */
+ R_ASSERT(ams::mitm::bpc::DetectPreferredRebootFunctionality());
+
/* Create mitm servers. */
R_ASSERT(g_server_manager.RegisterMitmServer(SetMitmServiceName));
R_ASSERT(g_server_manager.RegisterMitmServer(SetSysMitmServiceName));