mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-30 14:35:17 -04:00
stratosphere: more result cleanup
This commit is contained in:
parent
7b6050a0cb
commit
cead8a36ea
38 changed files with 158 additions and 448 deletions
|
@ -72,83 +72,30 @@ void __libnx_initheap(void) {
|
|||
}
|
||||
|
||||
void __appInit(void) {
|
||||
Result rc;
|
||||
|
||||
SetFirmwareVersionForLibnx();
|
||||
|
||||
DoWithSmSession([&]() {
|
||||
rc = setInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = setsysInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = pminfoInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = i2cInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = bpcInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
R_ASSERT(setInitialize());
|
||||
R_ASSERT(setsysInitialize());
|
||||
R_ASSERT(pminfoInitialize());
|
||||
R_ASSERT(i2cInitialize());
|
||||
R_ASSERT(bpcInitialize());
|
||||
|
||||
if (GetRuntimeFirmwareVersion() >= FirmwareVersion_800) {
|
||||
rc = clkrstInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
R_ASSERT(clkrstInitialize());
|
||||
} else {
|
||||
rc = pcvInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
R_ASSERT(pcvInitialize());
|
||||
}
|
||||
|
||||
rc = lblInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = psmInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = spsmInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = plInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = gpioInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = fsInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
R_ASSERT(lblInitialize());
|
||||
R_ASSERT(psmInitialize());
|
||||
R_ASSERT(spsmInitialize());
|
||||
R_ASSERT(plInitialize());
|
||||
R_ASSERT(gpioInitialize());
|
||||
R_ASSERT(fsInitialize());
|
||||
});
|
||||
|
||||
rc = fsdevMountSdmc();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
R_ASSERT(fsdevMountSdmc());
|
||||
|
||||
/* fatal cannot throw fatal, so don't do: CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION); */
|
||||
}
|
||||
|
|
|
@ -33,8 +33,7 @@ static size_t g_num_threads = 0;
|
|||
static void RunTaskThreadFunc(void *arg) {
|
||||
IFatalTask *task = reinterpret_cast<IFatalTask *>(arg);
|
||||
|
||||
Result rc = task->Run();
|
||||
if (R_FAILED(rc)) {
|
||||
if (R_FAILED(task->Run())) {
|
||||
/* TODO: Log task failure, somehow? */
|
||||
}
|
||||
|
||||
|
|
|
@ -122,22 +122,20 @@ void PowerButtonObserveTask::WaitForPowerButton() {
|
|||
BpcSleepButtonState state;
|
||||
GpioValue val;
|
||||
while (true) {
|
||||
Result rc = ResultSuccess;
|
||||
|
||||
if (config->is_auto_reboot_enabled && auto_reboot_helper.TimedOut() ) {
|
||||
bpcRebootSystem();
|
||||
return;
|
||||
}
|
||||
|
||||
if (check_vol_up && R_SUCCEEDED((rc = gpioPadGetValue(&vol_up_btn, &val))) && val == GpioValue_Low) {
|
||||
if (check_vol_up && R_SUCCEEDED(gpioPadGetValue(&vol_up_btn, &val)) && val == GpioValue_Low) {
|
||||
bpcRebootSystem();
|
||||
}
|
||||
|
||||
if (check_vol_down && R_SUCCEEDED((rc = gpioPadGetValue(&vol_down_btn, &val))) && val == GpioValue_Low) {
|
||||
if (check_vol_down && R_SUCCEEDED(gpioPadGetValue(&vol_down_btn, &val)) && val == GpioValue_Low) {
|
||||
bpcRebootSystem();
|
||||
}
|
||||
|
||||
if ((R_SUCCEEDED(rc = bpcGetSleepButtonState(&state)) && state == BpcSleepButtonState_Held) || (config->quest_flag && reboot_helper.TimedOut())) {
|
||||
if ((R_SUCCEEDED(bpcGetSleepButtonState(&state)) && state == BpcSleepButtonState_Held) || (config->quest_flag && reboot_helper.TimedOut())) {
|
||||
bpcRebootSystem();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -145,9 +145,7 @@ Result ShowFatalTask::ShowFatal() {
|
|||
|
||||
/* Prepare screen for drawing. */
|
||||
DoWithSmSession([&]() {
|
||||
Result rc = PrepareScreenForDrawing();
|
||||
if (R_FAILED(rc)) {
|
||||
*(volatile u32 *)(0xCAFEBABE) = rc;
|
||||
if (R_FAILED(PrepareScreenForDrawing())) {
|
||||
std::abort();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue