mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
fatal: Reboot to RCM if VOL is pressed instead of PWR.
This commit is contained in:
parent
8d3b8354c3
commit
be5b58d033
8 changed files with 48 additions and 15 deletions
|
@ -36,8 +36,8 @@ uint32_t configitem_set(bool privileged, ConfigItem item, uint64_t value) {
|
||||||
g_battery_profile = (value != 0);
|
g_battery_profile = (value != 0);
|
||||||
break;
|
break;
|
||||||
case CONFIGITEM_NEEDS_REBOOT_TO_RCM:
|
case CONFIGITEM_NEEDS_REBOOT_TO_RCM:
|
||||||
/* Force a reboot to RCM. */
|
/* Force a reboot to RCM, if requested. */
|
||||||
{
|
if (value != 0) {
|
||||||
MAKE_REG32(0x7000E450) = 0x2;
|
MAKE_REG32(0x7000E450) = 0x2;
|
||||||
MAKE_REG32(0x7000E400) = 0x10;
|
MAKE_REG32(0x7000E400) = 0x10;
|
||||||
while (1) { }
|
while (1) { }
|
||||||
|
|
|
@ -83,7 +83,8 @@
|
||||||
"svcGetDebugThreadContext": "0x67",
|
"svcGetDebugThreadContext": "0x67",
|
||||||
"svcQueryDebugProcessMemory": "0x69",
|
"svcQueryDebugProcessMemory": "0x69",
|
||||||
"svcReadDebugProcessMemory": "0x6a",
|
"svcReadDebugProcessMemory": "0x6a",
|
||||||
"svcGetDebugThreadParam": "0x6d"
|
"svcGetDebugThreadParam": "0x6d",
|
||||||
|
"svcCallSecureMonitor": "0x7f"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"type": "min_kernel_version",
|
"type": "min_kernel_version",
|
||||||
|
|
|
@ -58,9 +58,9 @@ static void SetupConfigLanguages() {
|
||||||
config->error_desc = u8"Please call 1-800-875-1852 for service.\n";
|
config->error_desc = u8"Please call 1-800-875-1852 for service.\n";
|
||||||
} else {
|
} else {
|
||||||
config->error_desc = u8"An error has occured.\n\n"
|
config->error_desc = u8"An error has occured.\n\n"
|
||||||
u8"Please press the POWER Button to restart the console. If you are\n"
|
u8"Please press the POWER Button to restart the console, or a VOL button\n"
|
||||||
u8"unable to restart the console, hold the POWER Button for 12 seconds\n"
|
u8"to restart the console in RCM mode. If you are unable to restart the\n"
|
||||||
u8"to turn the console off.\n\n"
|
u8"console, hold the POWER Button for 12 seconds to turn the console off.\n\n"
|
||||||
u8"If the problem persists, refer to the Nintendo Support Website.\n"
|
u8"If the problem persists, refer to the Nintendo Support Website.\n"
|
||||||
u8"support.nintendo.com/switch/error\n";
|
u8"support.nintendo.com/switch/error\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ void __appInit(void) {
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = fsInitialize();
|
rc = gpioInitialize();
|
||||||
if (R_FAILED(rc)) {
|
if (R_FAILED(rc)) {
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,7 @@ void __appExit(void) {
|
||||||
fsdevUnmountAll();
|
fsdevUnmountAll();
|
||||||
fsExit();
|
fsExit();
|
||||||
plExit();
|
plExit();
|
||||||
|
gpioExit();
|
||||||
spsmExit();
|
spsmExit();
|
||||||
psmExit();
|
psmExit();
|
||||||
lblExit();
|
lblExit();
|
||||||
|
|
|
@ -96,12 +96,43 @@ void PowerButtonObserveTask::WaitForPowerButton() {
|
||||||
const FatalConfig *config = GetFatalConfig();
|
const FatalConfig *config = GetFatalConfig();
|
||||||
TimeoutHelper reboot_helper(config->quest_reboot_interval_second * 1000000000UL);
|
TimeoutHelper reboot_helper(config->quest_reboot_interval_second * 1000000000UL);
|
||||||
|
|
||||||
|
bool check_vol_up = true, check_vol_down = true;
|
||||||
|
GpioPadSession vol_up_btn, vol_down_btn;
|
||||||
|
if (R_FAILED(gpioOpenSession(&vol_up_btn, GpioPadName_ButtonVolUp))) {
|
||||||
|
check_vol_up = false;
|
||||||
|
}
|
||||||
|
if (R_FAILED(gpioOpenSession(&vol_down_btn, GpioPadName_ButtonVolDown))) {
|
||||||
|
check_vol_down = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ensure we close on early return. */
|
||||||
|
ON_SCOPE_EXIT { if (check_vol_up) { gpioPadClose(&vol_up_btn); } };
|
||||||
|
ON_SCOPE_EXIT { if (check_vol_down) { gpioPadClose(&vol_down_btn); } };
|
||||||
|
|
||||||
|
/* Set direction input. */
|
||||||
|
if (check_vol_up) {
|
||||||
|
gpioPadSetDirection(&vol_up_btn, GpioDirection_Input);
|
||||||
|
}
|
||||||
|
if (check_vol_down) {
|
||||||
|
gpioPadSetDirection(&vol_down_btn, GpioDirection_Input);
|
||||||
|
}
|
||||||
|
|
||||||
BpcSleepButtonState state;
|
BpcSleepButtonState state;
|
||||||
|
GpioValue val;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Result rc = 0;
|
||||||
|
|
||||||
|
if (check_vol_up && R_SUCCEEDED((rc = gpioPadGetValue(&vol_up_btn, &val))) && val == GpioValue_Low) {
|
||||||
|
/* Tell exosphere to reboot to RCM. */
|
||||||
|
RebootToRcm();
|
||||||
|
}
|
||||||
|
|
||||||
Result rc = bpcGetSleepButtonState(&state);
|
if (check_vol_down && R_SUCCEEDED((rc = gpioPadGetValue(&vol_down_btn, &val))) && val == GpioValue_Low) {
|
||||||
if ((R_SUCCEEDED(rc) && state == BpcSleepButtonState_Held) || (config->quest_flag && reboot_helper.TimedOut())) {
|
/* Tell exosphere to reboot to RCM. */
|
||||||
|
RebootToRcm();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((R_SUCCEEDED(rc = bpcGetSleepButtonState(&state)) && state == BpcSleepButtonState_Held) || (config->quest_flag && reboot_helper.TimedOut())) {
|
||||||
bpcRebootSystem();
|
bpcRebootSystem();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,9 +215,9 @@ Result ShowFatalTask::ShowFatal() {
|
||||||
} else {
|
} else {
|
||||||
/* Print a special message for atmosphere version mismatch. */
|
/* Print a special message for atmosphere version mismatch. */
|
||||||
FontManager::Print(u8"Atmosphère version mismatch detected.\n\n"
|
FontManager::Print(u8"Atmosphère version mismatch detected.\n\n"
|
||||||
u8"Please press the POWER Button to restart the console. If you are\n"
|
u8"Please press the POWER Button to restart the console, or a VOL button\n"
|
||||||
u8"unable to restart the console, hold the POWER Button for 12 seconds\n"
|
u8"to restart the console in RCM mode. If you are unable to restart the\n"
|
||||||
u8"to turn the console off.\n\n"
|
u8"console, hold the POWER Button for 12 seconds to turn the console off.\n\n"
|
||||||
u8"Please ensure that all Atmosphère components are updated.\n"
|
u8"Please ensure that all Atmosphère components are updated.\n"
|
||||||
u8"github.com/Atmosphere-NX/Atmosphere/releases\n");
|
u8"github.com/Atmosphere-NX/Atmosphere/releases\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit dd31b3d2e2450a458ef9c0d6268f3780fe70e083
|
Subproject commit 05015b9354d3df80e0836aa95d1d4dcfc2aef4b7
|
Loading…
Reference in a new issue