mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-05 19:51:45 +00:00
strat: use atmosphere results instead of magics
This commit is contained in:
parent
84c4cd7c53
commit
0001e93810
7 changed files with 39 additions and 33 deletions
|
@ -89,7 +89,7 @@ static void DoRebootToPayload() {
|
|||
Result BpcRebootManager::PerformReboot() {
|
||||
switch (g_reboot_type) {
|
||||
case BpcRebootType::Standard:
|
||||
return RESULT_FORWARD_TO_SESSION;
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
case BpcRebootType::ToRcm:
|
||||
RebootToRcm();
|
||||
return 0;
|
||||
|
|
|
@ -116,7 +116,7 @@ Result FsMitmService::OpenFileSystemWithPatch(Out<std::shared_ptr<IFileSystemInt
|
|||
FsDir d;
|
||||
if (!Utils::IsWebAppletTid(this->title_id) || filesystem_type != FsFileSystemType_ContentManual || !Utils::IsHblTid(title_id) ||
|
||||
R_FAILED(Utils::OpenSdDir(AtmosphereHblWebContentDir, &d))) {
|
||||
return RESULT_FORWARD_TO_SESSION;
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
fsDirClose(&d);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ Result FsMitmService::OpenFileSystemWithPatch(Out<std::shared_ptr<IFileSystemInt
|
|||
FsFileSystem fs;
|
||||
if (R_SUCCEEDED(fsOpenFileSystemWithPatchFwd(this->forward_service.get(), &fs, title_id, static_cast<FsFileSystemType>(filesystem_type)))) {
|
||||
fsFsClose(&fs);
|
||||
return RESULT_FORWARD_TO_SESSION;
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ Result FsMitmService::OpenFileSystemWithId(Out<std::shared_ptr<IFileSystemInterf
|
|||
FsDir d;
|
||||
if (!Utils::IsWebAppletTid(this->title_id) || filesystem_type != FsFileSystemType_ContentManual || !Utils::IsHblTid(title_id) ||
|
||||
R_FAILED(Utils::OpenSdDir(AtmosphereHblWebContentDir, &d))) {
|
||||
return RESULT_FORWARD_TO_SESSION;
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
fsDirClose(&d);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ Result FsMitmService::OpenFileSystemWithId(Out<std::shared_ptr<IFileSystemInterf
|
|||
FsFileSystem fs;
|
||||
if (R_SUCCEEDED(fsOpenFileSystemWithIdFwd(this->forward_service.get(), &fs, title_id, static_cast<FsFileSystemType>(filesystem_type), path.pointer))) {
|
||||
fsFsClose(&fs);
|
||||
return RESULT_FORWARD_TO_SESSION;
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ Result FsMitmService::OpenDataStorageByCurrentProcess(Out<std::shared_ptr<IStora
|
|||
Result rc = 0;
|
||||
|
||||
if (!this->should_override_contents) {
|
||||
return RESULT_FORWARD_TO_SESSION;
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
|
||||
bool has_cache = StorageCacheGetEntry(this->title_id, &storage);
|
||||
|
@ -275,7 +275,7 @@ Result FsMitmService::OpenDataStorageByCurrentProcess(Out<std::shared_ptr<IStora
|
|||
} else {
|
||||
/* If we don't have anything to modify, there's no sense in maintaining a copy of the metadata tables. */
|
||||
fsStorageClose(&data_storage);
|
||||
rc = RESULT_FORWARD_TO_SESSION;
|
||||
rc = ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ Result FsMitmService::OpenDataStorageByDataId(Out<std::shared_ptr<IStorageInterf
|
|||
FsFile data_file;
|
||||
|
||||
if (!this->should_override_contents) {
|
||||
return RESULT_FORWARD_TO_SESSION;
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
|
||||
std::shared_ptr<IStorageInterface> storage = nullptr;
|
||||
|
@ -342,7 +342,7 @@ Result FsMitmService::OpenDataStorageByDataId(Out<std::shared_ptr<IStorageInterf
|
|||
} else {
|
||||
/* If we don't have anything to modify, there's no sense in maintaining a copy of the metadata tables. */
|
||||
fsStorageClose(&data_storage);
|
||||
rc = RESULT_FORWARD_TO_SESSION;
|
||||
rc = ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,22 +70,29 @@ void __appInit(void) {
|
|||
|
||||
/* Initialize services we need (TODO: NCM) */
|
||||
rc = smInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM));
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = fsInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_FS));
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = splInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(0xCAFE << 4 | 1);
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = pmshellInitialize();
|
||||
if (R_FAILED(rc))
|
||||
fatalSimple(0xCAFE << 4 | 2);
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
fsdevMountSdmc();
|
||||
rc = fsdevMountSdmc();
|
||||
if (R_FAILED(rc)) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ Result ShowFatalTask::ShowFatal() {
|
|||
FontManager::AddSpacingLines(0.5f);
|
||||
FontManager::PrintFormatLine(u8"Firmware: %s (Atmosphère %u.%u.%u-%s)", GetFatalConfig()->firmware_version.display_version, CURRENT_ATMOSPHERE_VERSION, GetAtmosphereGitRevision());
|
||||
FontManager::AddSpacingLines(1.5f);
|
||||
if (this->ctx->error_code != 0xCAFEF) {
|
||||
if (this->ctx->error_code != ResultAtmosphereVersionMismatch) {
|
||||
FontManager::Print(config->error_desc);
|
||||
} else {
|
||||
/* Print a special message for atmosphere version mismatch. */
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 27164564a193e0a91aced93194c5e646585594e7
|
||||
Subproject commit 8d15f82a9bf8a61e45856ae764f936a2d82e8a90
|
|
@ -64,23 +64,22 @@ void __appInit(void) {
|
|||
/* Initialize services we need (TODO: SPL) */
|
||||
rc = smInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM));
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = fsInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_FS));
|
||||
std::abort();
|
||||
}
|
||||
|
||||
|
||||
rc = lrInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(0xCAFE << 4 | 1);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = fsldrInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(0xCAFE << 4 | 2);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION);
|
||||
|
|
|
@ -90,12 +90,12 @@ void __appInit(void) {
|
|||
|
||||
rc = smInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM));
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = fsprInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(0xCAFE << 4 | 1);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
/* This works around a bug with process permissions on < 4.0.0. */
|
||||
|
@ -105,32 +105,32 @@ void __appInit(void) {
|
|||
if (R_SUCCEEDED(rc)) {
|
||||
smManagerAmsEndInitialDefers();
|
||||
} else {
|
||||
fatalSimple(0xCAFE << 4 | 2);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = smManagerInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(0xCAFE << 4 | 3);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = lrInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(0xCAFE << 4 | 4);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = ldrPmInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(0xCAFE << 4 | 5);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = splInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(0xCAFE << 4 | 6);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
rc = fsInitialize();
|
||||
if (R_FAILED(rc)) {
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_FS));
|
||||
std::abort();
|
||||
}
|
||||
|
||||
CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION);
|
||||
|
|
Loading…
Reference in a new issue