mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-14 00:56:35 +00:00
strat: use TitleId defs instead of magics.
This commit is contained in:
parent
4167dfea14
commit
9427a5cf46
13 changed files with 77 additions and 146 deletions
|
@ -37,7 +37,7 @@ class BpcMitmService : public IMitmServiceObject {
|
||||||
* - fatal, to simplify payload reboot logic significantly
|
* - fatal, to simplify payload reboot logic significantly
|
||||||
* - applications, to allow homebrew to take advantage of the feature.
|
* - 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);
|
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||||
|
|
|
@ -24,7 +24,7 @@ static HosMutex g_boot0_mutex;
|
||||||
static u8 g_boot0_bct_buffer[Boot0Storage::BctEndOffset];
|
static u8 g_boot0_bct_buffer[Boot0Storage::BctEndOffset];
|
||||||
|
|
||||||
bool Boot0Storage::CanModifyBctPubks() {
|
bool Boot0Storage::CanModifyBctPubks() {
|
||||||
return this->title_id != 0x010000000000001FULL;
|
return this->title_id != TitleId_Ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Boot0Storage::Read(void *_buffer, size_t size, u64 offset) {
|
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;
|
FsStorage bis_storage;
|
||||||
rc = fsOpenBisStorageFwd(this->forward_service.get(), &bis_storage, bis_partition_id);
|
rc = fsOpenBisStorageFwd(this->forward_service.get(), &bis_storage, bis_partition_id);
|
||||||
if (R_SUCCEEDED(rc)) {
|
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_bis_write_flag = Utils::HasFlag(this->title_id, "bis_write");
|
||||||
const bool has_cal0_read_flag = Utils::HasFlag(this->title_id, "cal_read");
|
const bool has_cal0_read_flag = Utils::HasFlag(this->title_id, "cal_read");
|
||||||
if (bis_partition_id == BisStorageId_Boot0) {
|
if (bis_partition_id == BisStorageId_Boot0) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ class FsMitmService : public IMitmServiceObject {
|
||||||
if (Utils::HasSdDisableMitMFlag(this->title_id)) {
|
if (Utils::HasSdDisableMitMFlag(this->title_id)) {
|
||||||
this->should_override_contents = false;
|
this->should_override_contents = false;
|
||||||
} else {
|
} 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. */
|
/* TODO: intercepting everything seems to cause issues with sleep mode, for some reason. */
|
||||||
/* Figure out why, and address it. */
|
/* Figure out why, and address it. */
|
||||||
if (tid == 0x0100000000001000ULL) {
|
if (tid == TitleId_AppletQlaunch) {
|
||||||
has_launched_qlaunch = true;
|
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);
|
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||||
|
|
|
@ -32,13 +32,13 @@ void VersionManager::Initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mount firmware version data archive. */
|
/* Mount firmware version data archive. */
|
||||||
if (R_SUCCEEDED(romfsMountFromDataArchive(0x0100000000000809ul, FsStorageId_NandSystem, "809"))) {
|
if (R_SUCCEEDED(romfsMountFromDataArchive(TitleId_ArchiveSystemVersion, FsStorageId_NandSystem, "sysver"))) {
|
||||||
ON_SCOPE_EXIT { romfsUnmount("809"); };
|
ON_SCOPE_EXIT { romfsUnmount("sysver"); };
|
||||||
|
|
||||||
SetSysFirmwareVersion fw_ver;
|
SetSysFirmwareVersion fw_ver;
|
||||||
|
|
||||||
/* Firmware version file must exist. */
|
/* Firmware version file must exist. */
|
||||||
FILE *f = fopen("809:/file", "rb");
|
FILE *f = fopen("sysver:/file", "rb");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ Result VersionManager::GetFirmwareVersion(u64 title_id, SetSysFirmwareVersion *o
|
||||||
VersionManager::Initialize();
|
VersionManager::Initialize();
|
||||||
|
|
||||||
/* Report atmosphere string to qlaunch, maintenance and nothing else. */
|
/* 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;
|
*out = g_ams_fw_version;
|
||||||
} else {
|
} else {
|
||||||
*out = g_fw_version;
|
*out = g_fw_version;
|
||||||
|
|
|
@ -52,7 +52,7 @@ static HblOverrideConfig g_hbl_override_config = {
|
||||||
.key_combination = KEY_L,
|
.key_combination = KEY_L,
|
||||||
.override_by_default = true
|
.override_by_default = true
|
||||||
},
|
},
|
||||||
.title_id = 0x010000000000100D,
|
.title_id = TitleId_AppletPhotoViewer,
|
||||||
.override_any_app = false
|
.override_any_app = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -380,11 +380,11 @@ Result Utils::SaveSdFileForAtmosphere(u64 title_id, const char *fn, void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::IsHblTid(u64 tid) {
|
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) {
|
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) {
|
bool Utils::HasTitleFlag(u64 tid, const char *flag) {
|
||||||
|
@ -469,7 +469,7 @@ static bool HasOverrideKey(OverrideKey *cfg) {
|
||||||
|
|
||||||
|
|
||||||
bool Utils::HasOverrideButton(u64 tid) {
|
bool Utils::HasOverrideButton(u64 tid) {
|
||||||
if ((!IsApplicationTid(tid)) || (!IsSdInitialized())) {
|
if ((!TitleIdIsApplication(tid)) || (!IsSdInitialized())) {
|
||||||
/* Disable button override disable for non-applications. */
|
/* Disable button override disable for non-applications. */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ Result ThrowFatalImpl(u32 error, u64 pid, FatalType policy, FatalCpuContext *cpu
|
||||||
/* Get title id. On failure, it'll be zero. */
|
/* Get title id. On failure, it'll be zero. */
|
||||||
u64 title_id = 0;
|
u64 title_id = 0;
|
||||||
pminfoGetTitleId(&title_id, pid);
|
pminfoGetTitleId(&title_id, pid);
|
||||||
ctx.is_creport = title_id == 0x0100000000000036;
|
ctx.is_creport = title_id == TitleId_Creport;
|
||||||
|
|
||||||
/* Support for ams creport. TODO: Make this its own command? */
|
/* Support for ams creport. TODO: Make this its own command? */
|
||||||
if (ctx.is_creport && !cpu_ctx->is_aarch32 && cpu_ctx->aarch64_ctx.afsr0 != 0) {
|
if (ctx.is_creport && !cpu_ctx->is_aarch32 && cpu_ctx->aarch64_ctx.afsr0 != 0) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4c51a406173066bbc139c41ea39b8886ce299ebb
|
Subproject commit 5fcc1469c7c514ed4b2e40a4f8128a19b26df9ae
|
|
@ -55,7 +55,7 @@ static HblOverrideConfig g_hbl_override_config = {
|
||||||
.key_combination = KEY_R,
|
.key_combination = KEY_R,
|
||||||
.override_by_default = true
|
.override_by_default = true
|
||||||
},
|
},
|
||||||
.title_id = 0x010000000000100D,
|
.title_id = TitleId_AppletPhotoViewer,
|
||||||
.override_any_app = false
|
.override_any_app = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ void ContentManagement::RefreshConfigurationData() {
|
||||||
|
|
||||||
void ContentManagement::TryMountSdCard() {
|
void ContentManagement::TryMountSdCard() {
|
||||||
/* Mount SD card, if psc, bus, and pcv have been created. */
|
/* Mount SD card, if psc, bus, and pcv have been created. */
|
||||||
if (!g_has_initialized_fs_dev && HasCreatedTitle(0x0100000000000021) && HasCreatedTitle(0x010000000000000A) && HasCreatedTitle(0x010000000000001A)) {
|
if (!g_has_initialized_fs_dev && HasCreatedTitle(TitleId_Psc) && HasCreatedTitle(TitleId_Bus) && HasCreatedTitle(TitleId_Pcv)) {
|
||||||
Handle tmp_hnd = 0;
|
Handle tmp_hnd = 0;
|
||||||
static const char * const required_active_services[] = {"pcv", "gpio", "pinmux", "psc:c"};
|
static const char * const required_active_services[] = {"pcv", "gpio", "pinmux", "psc:c"};
|
||||||
for (unsigned int i = 0; i < sizeof(required_active_services) / sizeof(required_active_services[0]); i++) {
|
for (unsigned int i = 0; i < sizeof(required_active_services) / sizeof(required_active_services[0]); i++) {
|
||||||
|
@ -389,7 +389,7 @@ void ContentManagement::TryMountSdCard() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsHBLTitleId(u64 tid) {
|
static bool IsHBLTitleId(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));
|
||||||
}
|
}
|
||||||
|
|
||||||
OverrideKey ContentManagement::GetTitleOverrideKey(u64 tid) {
|
OverrideKey ContentManagement::GetTitleOverrideKey(u64 tid) {
|
||||||
|
@ -416,7 +416,7 @@ static bool ShouldOverrideContents(OverrideKey *cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) {
|
bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) {
|
||||||
if (g_mounted_hbl_nsp && tid >= 0x0100000000001000 && HasCreatedTitle(0x0100000000001000)) {
|
if (g_mounted_hbl_nsp && tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) {
|
||||||
/* Return whether we should override contents with HBL. */
|
/* Return whether we should override contents with HBL. */
|
||||||
return IsHBLTitleId(tid) && ShouldOverrideContents(&g_hbl_override_config.override_key);
|
return IsHBLTitleId(tid) && ShouldOverrideContents(&g_hbl_override_config.override_key);
|
||||||
} else {
|
} else {
|
||||||
|
@ -427,7 +427,7 @@ bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) {
|
||||||
|
|
||||||
bool ContentManagement::ShouldOverrideContentsWithSD(u64 tid) {
|
bool ContentManagement::ShouldOverrideContentsWithSD(u64 tid) {
|
||||||
if (g_has_initialized_fs_dev) {
|
if (g_has_initialized_fs_dev) {
|
||||||
if (tid >= 0x0100000000001000 && HasCreatedTitle(0x0100000000001000)) {
|
if (tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) {
|
||||||
/* Check whether we should override with non-HBL. */
|
/* Check whether we should override with non-HBL. */
|
||||||
OverrideKey title_cfg = GetTitleOverrideKey(tid);
|
OverrideKey title_cfg = GetTitleOverrideKey(tid);
|
||||||
return ShouldOverrideContents(&title_cfg);
|
return ShouldOverrideContents(&title_cfg);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "ldr_hid.hpp"
|
#include "ldr_hid.hpp"
|
||||||
|
|
||||||
Result HidManagement::GetKeysHeld(u64 *keys) {
|
Result HidManagement::GetKeysHeld(u64 *keys) {
|
||||||
if (!ContentManagement::HasCreatedTitle(0x0100000000000013)) {
|
if (!ContentManagement::HasCreatedTitle(TitleId_Hid)) {
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID);
|
return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "pm_registration.hpp"
|
#include "pm_registration.hpp"
|
||||||
#include "pm_boot_mode.hpp"
|
#include "pm_boot_mode.hpp"
|
||||||
|
|
||||||
static std::vector<Boot2KnownTitleId> g_launched_titles;
|
static std::vector<u64> g_launched_titles;
|
||||||
|
|
||||||
static bool IsHexadecimal(const char *str) {
|
static bool IsHexadecimal(const char *str) {
|
||||||
while (*str) {
|
while (*str) {
|
||||||
|
@ -40,11 +40,11 @@ static bool IsHexadecimal(const char *str) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HasLaunchedTitle(Boot2KnownTitleId title_id) {
|
static bool HasLaunchedTitle(u64 title_id) {
|
||||||
return std::find(g_launched_titles.begin(), g_launched_titles.end(), title_id) != g_launched_titles.end();
|
return std::find(g_launched_titles.begin(), g_launched_titles.end(), title_id) != g_launched_titles.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetLaunchedTitle(Boot2KnownTitleId title_id) {
|
static void SetLaunchedTitle(u64 title_id) {
|
||||||
g_launched_titles.push_back(title_id);
|
g_launched_titles.push_back(title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ static void ClearLaunchedTitles() {
|
||||||
g_launched_titles.clear();
|
g_launched_titles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LaunchTitle(Boot2KnownTitleId title_id, FsStorageId storage_id, u32 launch_flags, u64 *pid) {
|
static void LaunchTitle(u64 title_id, FsStorageId storage_id, u32 launch_flags, u64 *pid) {
|
||||||
u64 local_pid = 0;
|
u64 local_pid = 0;
|
||||||
|
|
||||||
/* Don't launch a title twice during boot2. */
|
/* Don't launch a title twice during boot2. */
|
||||||
|
@ -60,7 +60,7 @@ static void LaunchTitle(Boot2KnownTitleId title_id, FsStorageId storage_id, u32
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result rc = Registration::LaunchProcessByTidSid(Registration::TidSid{(u64)title_id, storage_id}, launch_flags, &local_pid);
|
Result rc = Registration::LaunchProcessByTidSid(Registration::TidSid{title_id, storage_id}, launch_flags, &local_pid);
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case ResultKernelResourceExhausted:
|
case ResultKernelResourceExhausted:
|
||||||
/* Out of resource! */
|
/* Out of resource! */
|
||||||
|
@ -125,46 +125,46 @@ static bool IsMaintenanceMode() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::tuple<Boot2KnownTitleId, bool> g_additional_launch_programs[] = {
|
static const std::tuple<u64, bool> g_additional_launch_programs[] = {
|
||||||
{Boot2KnownTitleId::am, true}, /* am */
|
{TitleId_Am, true}, /* am */
|
||||||
{Boot2KnownTitleId::nvservices, true}, /* nvservices */
|
{TitleId_NvServices, true}, /* nvservices */
|
||||||
{Boot2KnownTitleId::nvnflinger, true}, /* nvnflinger */
|
{TitleId_NvnFlinger, true}, /* nvnflinger */
|
||||||
{Boot2KnownTitleId::vi, true}, /* vi */
|
{TitleId_Vi, true}, /* vi */
|
||||||
{Boot2KnownTitleId::ns, true}, /* ns */
|
{TitleId_Ns, true}, /* ns */
|
||||||
{Boot2KnownTitleId::lm, true}, /* lm */
|
{TitleId_LogManager, true}, /* lm */
|
||||||
{Boot2KnownTitleId::ppc, true}, /* ppc */
|
{TitleId_Ppc, true}, /* ppc */
|
||||||
{Boot2KnownTitleId::ptm, true}, /* ptm */
|
{TitleId_Ptm, true}, /* ptm */
|
||||||
{Boot2KnownTitleId::hid, true}, /* hid */
|
{TitleId_Hid, true}, /* hid */
|
||||||
{Boot2KnownTitleId::audio, true}, /* audio */
|
{TitleId_Audio, true}, /* audio */
|
||||||
{Boot2KnownTitleId::lbl, true}, /* lbl */
|
{TitleId_Lbl, true}, /* lbl */
|
||||||
{Boot2KnownTitleId::wlan, true}, /* wlan */
|
{TitleId_Wlan, true}, /* wlan */
|
||||||
{Boot2KnownTitleId::bluetooth, true}, /* bluetooth */
|
{TitleId_Bluetooth, true}, /* bluetooth */
|
||||||
{Boot2KnownTitleId::bsdsockets, true}, /* bsdsockets */
|
{TitleId_BsdSockets, true}, /* bsdsockets */
|
||||||
{Boot2KnownTitleId::nifm, true}, /* nifm */
|
{TitleId_Nifm, true}, /* nifm */
|
||||||
{Boot2KnownTitleId::ldn, true}, /* ldn */
|
{TitleId_Ldn, true}, /* ldn */
|
||||||
{Boot2KnownTitleId::account, true}, /* account */
|
{TitleId_Account, true}, /* account */
|
||||||
{Boot2KnownTitleId::friends, false}, /* friends */
|
{TitleId_Friends, false}, /* friends */
|
||||||
{Boot2KnownTitleId::nfc, true}, /* nfc */
|
{TitleId_Nfc, true}, /* nfc */
|
||||||
{Boot2KnownTitleId::jpegdec, true}, /* jpegdec */
|
{TitleId_JpegDec, true}, /* jpegdec */
|
||||||
{Boot2KnownTitleId::capsrv, true}, /* capsrv */
|
{TitleId_CapSrv, true}, /* capsrv */
|
||||||
{Boot2KnownTitleId::ssl, true}, /* ssl */
|
{TitleId_Ssl, true}, /* ssl */
|
||||||
{Boot2KnownTitleId::nim, true}, /* nim */
|
{TitleId_Nim, true}, /* nim */
|
||||||
{Boot2KnownTitleId::bcat, false}, /* bcat */
|
{TitleId_Bcat, false}, /* bcat */
|
||||||
{Boot2KnownTitleId::erpt, true}, /* erpt */
|
{TitleId_Erpt, true}, /* erpt */
|
||||||
{Boot2KnownTitleId::es, true}, /* es */
|
{TitleId_Es, true}, /* es */
|
||||||
{Boot2KnownTitleId::pctl, true}, /* pctl */
|
{TitleId_Pctl, true}, /* pctl */
|
||||||
{Boot2KnownTitleId::btm, true}, /* btm */
|
{TitleId_Btm, true}, /* btm */
|
||||||
{Boot2KnownTitleId::eupld, false}, /* eupld */
|
{TitleId_Eupld, false}, /* eupld */
|
||||||
{Boot2KnownTitleId::glue, true}, /* glue */
|
{TitleId_Glue, true}, /* glue */
|
||||||
/* {Boot2KnownTitleId::eclct, true}, */ /* eclct */ /* Skip launching error collection in Atmosphere to lessen telemetry. */
|
/* {TitleId_Eclct, true}, */ /* eclct */ /* Skip launching error collection in Atmosphere to lessen telemetry. */
|
||||||
{Boot2KnownTitleId::npns, false}, /* npns */
|
{TitleId_Npns, false}, /* npns */
|
||||||
{Boot2KnownTitleId::fatal, true}, /* fatal */
|
{TitleId_Fatal, true}, /* fatal */
|
||||||
{Boot2KnownTitleId::ro, true}, /* ro */
|
{TitleId_Ro, true}, /* ro */
|
||||||
{Boot2KnownTitleId::profiler, true}, /* profiler */
|
{TitleId_Profiler, true}, /* profiler */
|
||||||
{Boot2KnownTitleId::sdb, true}, /* sdb */
|
{TitleId_Sdb, true}, /* sdb */
|
||||||
{Boot2KnownTitleId::migration, true}, /* migration */
|
{TitleId_Migration, true}, /* migration */
|
||||||
{Boot2KnownTitleId::grc, true}, /* grc */
|
{TitleId_Grc, true}, /* grc */
|
||||||
{Boot2KnownTitleId::olsc, true}, /* olsc */
|
{TitleId_Olsc, true}, /* olsc */
|
||||||
};
|
};
|
||||||
|
|
||||||
static void MountSdCard() {
|
static void MountSdCard() {
|
||||||
|
@ -206,15 +206,15 @@ void EmbeddedBoot2::Main() {
|
||||||
/* psc, bus, pcv is the minimal set of required titles to get SD card. */
|
/* psc, bus, pcv is the minimal set of required titles to get SD card. */
|
||||||
/* bus depends on pcie, and pcv depends on settings. */
|
/* bus depends on pcie, and pcv depends on settings. */
|
||||||
/* Launch psc. */
|
/* Launch psc. */
|
||||||
LaunchTitle(Boot2KnownTitleId::psc, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(TitleId_Psc, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch pcie. */
|
/* Launch pcie. */
|
||||||
LaunchTitle(Boot2KnownTitleId::pcie, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(TitleId_Pcie, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch bus. */
|
/* Launch bus. */
|
||||||
LaunchTitle(Boot2KnownTitleId::bus, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(TitleId_Bus, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch settings. */
|
/* Launch settings. */
|
||||||
LaunchTitle(Boot2KnownTitleId::settings, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(TitleId_Settings, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch pcv. */
|
/* Launch pcv. */
|
||||||
LaunchTitle(Boot2KnownTitleId::pcv, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(TitleId_Pcv, FsStorageId_NandSystem, 0, NULL);
|
||||||
|
|
||||||
/* At this point, the SD card can be mounted. */
|
/* At this point, the SD card can be mounted. */
|
||||||
MountSdCard();
|
MountSdCard();
|
||||||
|
@ -234,18 +234,18 @@ void EmbeddedBoot2::Main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Launch usb. */
|
/* Launch usb. */
|
||||||
LaunchTitle(Boot2KnownTitleId::usb, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(TitleId_Usb, FsStorageId_NandSystem, 0, NULL);
|
||||||
|
|
||||||
/* Launch tma. */
|
/* Launch tma. */
|
||||||
LaunchTitle(Boot2KnownTitleId::tma, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(TitleId_Tma, FsStorageId_NandSystem, 0, NULL);
|
||||||
|
|
||||||
/* Launch Atmosphere dmnt, using FsStorageId_None to force SD card boot. */
|
/* Launch Atmosphere dmnt, using FsStorageId_None to force SD card boot. */
|
||||||
LaunchTitle(Boot2KnownTitleId::dmnt, FsStorageId_None, 0, NULL);
|
LaunchTitle(TitleId_Dmnt, FsStorageId_None, 0, NULL);
|
||||||
|
|
||||||
/* Launch default programs. */
|
/* Launch default programs. */
|
||||||
for (auto &launch_program : g_additional_launch_programs) {
|
for (auto &launch_program : g_additional_launch_programs) {
|
||||||
if (!maintenance || std::get<bool>(launch_program)) {
|
if (!maintenance || std::get<bool>(launch_program)) {
|
||||||
LaunchTitle(std::get<Boot2KnownTitleId>(launch_program), FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(std::get<u64>(launch_program), FsStorageId_NandSystem, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ void EmbeddedBoot2::Main() {
|
||||||
if (titles_dir != NULL) {
|
if (titles_dir != NULL) {
|
||||||
while ((ent = readdir(titles_dir)) != NULL) {
|
while ((ent = readdir(titles_dir)) != NULL) {
|
||||||
if (strlen(ent->d_name) == 0x10 && IsHexadecimal(ent->d_name)) {
|
if (strlen(ent->d_name) == 0x10 && IsHexadecimal(ent->d_name)) {
|
||||||
Boot2KnownTitleId title_id = (Boot2KnownTitleId)strtoul(ent->d_name, NULL, 16);
|
u64 title_id = (u64)strtoul(ent->d_name, NULL, 16);
|
||||||
if (HasLaunchedTitle(title_id)) {
|
if (HasLaunchedTitle(title_id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,73 +16,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
enum class Boot2KnownTitleId : u64 {
|
|
||||||
fs = 0x0100000000000000UL,
|
|
||||||
loader = 0x0100000000000001UL,
|
|
||||||
ncm = 0x0100000000000002UL,
|
|
||||||
pm = 0x0100000000000003UL,
|
|
||||||
sm = 0x0100000000000004UL,
|
|
||||||
boot = 0x0100000000000005UL,
|
|
||||||
usb = 0x0100000000000006UL,
|
|
||||||
tma = 0x0100000000000007UL,
|
|
||||||
boot2 = 0x0100000000000008UL,
|
|
||||||
settings = 0x0100000000000009UL,
|
|
||||||
bus = 0x010000000000000AUL,
|
|
||||||
bluetooth = 0x010000000000000BUL,
|
|
||||||
bcat = 0x010000000000000CUL,
|
|
||||||
dmnt = 0x010000000000000DUL,
|
|
||||||
friends = 0x010000000000000EUL,
|
|
||||||
nifm = 0x010000000000000FUL,
|
|
||||||
ptm = 0x0100000000000010UL,
|
|
||||||
shell = 0x0100000000000011UL,
|
|
||||||
bsdsockets = 0x0100000000000012UL,
|
|
||||||
hid = 0x0100000000000013UL,
|
|
||||||
audio = 0x0100000000000014UL,
|
|
||||||
lm = 0x0100000000000015UL,
|
|
||||||
wlan = 0x0100000000000016UL,
|
|
||||||
cs = 0x0100000000000017UL,
|
|
||||||
ldn = 0x0100000000000018UL,
|
|
||||||
nvservices = 0x0100000000000019UL,
|
|
||||||
pcv = 0x010000000000001AUL,
|
|
||||||
ppc = 0x010000000000001BUL,
|
|
||||||
nvnflinger = 0x010000000000001CUL,
|
|
||||||
pcie = 0x010000000000001DUL,
|
|
||||||
account = 0x010000000000001EUL,
|
|
||||||
ns = 0x010000000000001FUL,
|
|
||||||
nfc = 0x0100000000000020UL,
|
|
||||||
psc = 0x0100000000000021UL,
|
|
||||||
capsrv = 0x0100000000000022UL,
|
|
||||||
am = 0x0100000000000023UL,
|
|
||||||
ssl = 0x0100000000000024UL,
|
|
||||||
nim = 0x0100000000000025UL,
|
|
||||||
spl = 0x0100000000000028UL,
|
|
||||||
lbl = 0x0100000000000029UL,
|
|
||||||
btm = 0x010000000000002AUL,
|
|
||||||
erpt = 0x010000000000002BUL,
|
|
||||||
vi = 0x010000000000002DUL,
|
|
||||||
pctl = 0x010000000000002EUL,
|
|
||||||
npns = 0x010000000000002FUL,
|
|
||||||
eupld = 0x0100000000000030UL,
|
|
||||||
glue = 0x0100000000000031UL,
|
|
||||||
eclct = 0x0100000000000032UL,
|
|
||||||
es = 0x0100000000000033UL,
|
|
||||||
fatal = 0x0100000000000034UL,
|
|
||||||
grc = 0x0100000000000035UL,
|
|
||||||
creport = 0x0100000000000036UL,
|
|
||||||
ro = 0x0100000000000037UL,
|
|
||||||
profiler = 0x0100000000000038UL,
|
|
||||||
sdb = 0x0100000000000039UL,
|
|
||||||
migration = 0x010000000000003AUL,
|
|
||||||
jit = 0x010000000000003BUL,
|
|
||||||
jpegdec = 0x010000000000003CUL,
|
|
||||||
safemode = 0x010000000000003DUL,
|
|
||||||
olsc = 0x010000000000003EUL,
|
|
||||||
|
|
||||||
|
|
||||||
/* atmosphere extensions */
|
|
||||||
ams_set_mitm = 0x0100000000000032UL,
|
|
||||||
};
|
|
||||||
|
|
||||||
class EmbeddedBoot2 {
|
class EmbeddedBoot2 {
|
||||||
public:
|
public:
|
||||||
static void Main();
|
static void Main();
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
|
|
||||||
#include "pm_registration.hpp"
|
#include "pm_registration.hpp"
|
||||||
|
|
||||||
#define BOOT2_TITLE_ID (0x0100000000000008ULL)
|
|
||||||
|
|
||||||
enum ShellCmd {
|
enum ShellCmd {
|
||||||
Shell_Cmd_LaunchProcess = 0,
|
Shell_Cmd_LaunchProcess = 0,
|
||||||
Shell_Cmd_TerminateProcessId = 1,
|
Shell_Cmd_TerminateProcessId = 1,
|
||||||
|
|
Loading…
Reference in a new issue