strat: use TitleId defs instead of magics.
This commit is contained in:
@@ -37,7 +37,7 @@ class BpcMitmService : public IMitmServiceObject {
|
||||
* - fatal, to simplify payload reboot logic significantly
|
||||
* - applications, to allow homebrew to take advantage of the feature.
|
||||
*/
|
||||
return tid == 0x0100000000000023ull || tid == 0x0100000000000034ull || Utils::IsHblTid(tid);
|
||||
return tid == TitleId_Am || tid == TitleId_Fatal || TitleIdIsApplication(tid) || Utils::IsHblTid(tid);
|
||||
}
|
||||
|
||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||
|
||||
@@ -24,7 +24,7 @@ static HosMutex g_boot0_mutex;
|
||||
static u8 g_boot0_bct_buffer[Boot0Storage::BctEndOffset];
|
||||
|
||||
bool Boot0Storage::CanModifyBctPubks() {
|
||||
return this->title_id != 0x010000000000001FULL;
|
||||
return this->title_id != TitleId_Ns;
|
||||
}
|
||||
|
||||
Result Boot0Storage::Read(void *_buffer, size_t size, u64 offset) {
|
||||
|
||||
@@ -177,7 +177,7 @@ Result FsMitmService::OpenBisStorage(Out<std::shared_ptr<IStorageInterface>> out
|
||||
FsStorage bis_storage;
|
||||
rc = fsOpenBisStorageFwd(this->forward_service.get(), &bis_storage, bis_partition_id);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
const bool is_sysmodule = this->title_id < 0x0100000000001000ul;
|
||||
const bool is_sysmodule = TitleIdIsSystem(this->title_id);
|
||||
const bool has_bis_write_flag = Utils::HasFlag(this->title_id, "bis_write");
|
||||
const bool has_cal0_read_flag = Utils::HasFlag(this->title_id, "cal_read");
|
||||
if (bis_partition_id == BisStorageId_Boot0) {
|
||||
|
||||
@@ -45,7 +45,7 @@ class FsMitmService : public IMitmServiceObject {
|
||||
if (Utils::HasSdDisableMitMFlag(this->title_id)) {
|
||||
this->should_override_contents = false;
|
||||
} else {
|
||||
this->should_override_contents = (this->title_id >= 0x0100000000010000ULL || Utils::HasSdMitMFlag(this->title_id)) && Utils::HasOverrideButton(this->title_id);
|
||||
this->should_override_contents = (this->title_id >= TitleId_ApplicationStart || Utils::HasSdMitMFlag(this->title_id)) && Utils::HasOverrideButton(this->title_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,11 +59,11 @@ class FsMitmService : public IMitmServiceObject {
|
||||
|
||||
/* TODO: intercepting everything seems to cause issues with sleep mode, for some reason. */
|
||||
/* Figure out why, and address it. */
|
||||
if (tid == 0x0100000000001000ULL) {
|
||||
if (tid == TitleId_AppletQlaunch) {
|
||||
has_launched_qlaunch = true;
|
||||
}
|
||||
|
||||
return has_launched_qlaunch || tid == 0x010000000000001FULL || tid >= 0x0100000000010000ULL || Utils::HasSdMitMFlag(tid);
|
||||
return has_launched_qlaunch || tid == TitleId_Ns || tid >= TitleId_ApplicationStart || Utils::HasSdMitMFlag(tid);
|
||||
}
|
||||
|
||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||
|
||||
@@ -32,13 +32,13 @@ void VersionManager::Initialize() {
|
||||
}
|
||||
|
||||
/* Mount firmware version data archive. */
|
||||
if (R_SUCCEEDED(romfsMountFromDataArchive(0x0100000000000809ul, FsStorageId_NandSystem, "809"))) {
|
||||
ON_SCOPE_EXIT { romfsUnmount("809"); };
|
||||
if (R_SUCCEEDED(romfsMountFromDataArchive(TitleId_ArchiveSystemVersion, FsStorageId_NandSystem, "sysver"))) {
|
||||
ON_SCOPE_EXIT { romfsUnmount("sysver"); };
|
||||
|
||||
SetSysFirmwareVersion fw_ver;
|
||||
|
||||
/* Firmware version file must exist. */
|
||||
FILE *f = fopen("809:/file", "rb");
|
||||
FILE *f = fopen("sysver:/file", "rb");
|
||||
if (f == NULL) {
|
||||
std::abort();
|
||||
}
|
||||
@@ -75,7 +75,7 @@ Result VersionManager::GetFirmwareVersion(u64 title_id, SetSysFirmwareVersion *o
|
||||
VersionManager::Initialize();
|
||||
|
||||
/* Report atmosphere string to qlaunch, maintenance and nothing else. */
|
||||
if (title_id == 0x0100000000001000ULL || title_id == 0x0100000000001015ULL) {
|
||||
if (title_id == TitleId_AppletQlaunch || title_id == TitleId_AppletMaintenanceMenu) {
|
||||
*out = g_ams_fw_version;
|
||||
} else {
|
||||
*out = g_fw_version;
|
||||
|
||||
@@ -52,7 +52,7 @@ static HblOverrideConfig g_hbl_override_config = {
|
||||
.key_combination = KEY_L,
|
||||
.override_by_default = true
|
||||
},
|
||||
.title_id = 0x010000000000100D,
|
||||
.title_id = TitleId_AppletPhotoViewer,
|
||||
.override_any_app = false
|
||||
};
|
||||
|
||||
@@ -380,11 +380,11 @@ Result Utils::SaveSdFileForAtmosphere(u64 title_id, const char *fn, void *data,
|
||||
}
|
||||
|
||||
bool Utils::IsHblTid(u64 tid) {
|
||||
return (g_hbl_override_config.override_any_app && IsApplicationTid(tid)) || (tid == g_hbl_override_config.title_id);
|
||||
return (g_hbl_override_config.override_any_app && TitleIdIsApplication(tid)) || (tid == g_hbl_override_config.title_id);
|
||||
}
|
||||
|
||||
bool Utils::IsWebAppletTid(u64 tid) {
|
||||
return tid == 0x010000000000100Aul || tid == 0x010000000000100Ful || tid == 0x0100000000001010ul || tid == 0x0100000000001011ul;
|
||||
return tid == TitleId_AppletWeb || tid == TitleId_AppletOfflineWeb || tid == TitleId_AppletLoginShare || tid == TitleId_AppletWifiWebAuth;
|
||||
}
|
||||
|
||||
bool Utils::HasTitleFlag(u64 tid, const char *flag) {
|
||||
@@ -469,7 +469,7 @@ static bool HasOverrideKey(OverrideKey *cfg) {
|
||||
|
||||
|
||||
bool Utils::HasOverrideButton(u64 tid) {
|
||||
if ((!IsApplicationTid(tid)) || (!IsSdInitialized())) {
|
||||
if ((!TitleIdIsApplication(tid)) || (!IsSdInitialized())) {
|
||||
/* Disable button override disable for non-applications. */
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user