mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-23 12:22:08 +00:00
PM: Use enum in EmbeddedBoot2
This commit is contained in:
parent
9f16062767
commit
c079803189
2 changed files with 109 additions and 51 deletions
|
@ -8,10 +8,10 @@
|
||||||
#include "pm_boot2.hpp"
|
#include "pm_boot2.hpp"
|
||||||
#include "pm_registration.hpp"
|
#include "pm_registration.hpp"
|
||||||
|
|
||||||
static void LaunchTitle(u64 title_id, FsStorageId storage_id, u32 launch_flags, u64 *pid) {
|
static void LaunchTitle(Boot2KnownTitleId title_id, FsStorageId storage_id, u32 launch_flags, u64 *pid) {
|
||||||
u64 local_pid;
|
u64 local_pid;
|
||||||
|
|
||||||
Result rc = Registration::LaunchProcessByTidSid(Registration::TidSid{title_id, storage_id}, launch_flags, &local_pid);
|
Result rc = Registration::LaunchProcessByTidSid(Registration::TidSid{(u64)title_id, storage_id}, launch_flags, &local_pid);
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case 0xCE01:
|
case 0xCE01:
|
||||||
/* Out of resource! */
|
/* Out of resource! */
|
||||||
|
@ -39,69 +39,69 @@ static bool ShouldForceMaintenanceMode() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::tuple<u64, bool> g_additional_launch_programs[] = {
|
static const std::tuple<Boot2KnownTitleId, bool> g_additional_launch_programs[] = {
|
||||||
{0x0100000000000023, true}, /* am */
|
{Boot2KnownTitleId::am, true}, /* am */
|
||||||
{0x0100000000000019, true}, /* nvservices */
|
{Boot2KnownTitleId::nvservices, true}, /* nvservices */
|
||||||
{0x010000000000001C, true}, /* nvnflinger */
|
{Boot2KnownTitleId::nvnflinger, true}, /* nvnflinger */
|
||||||
{0x010000000000002D, true}, /* vi */
|
{Boot2KnownTitleId::vi, true}, /* vi */
|
||||||
{0x010000000000001F, true}, /* ns */
|
{Boot2KnownTitleId::ns, true}, /* ns */
|
||||||
{0x0100000000000015, true}, /* lm */
|
{Boot2KnownTitleId::lm, true}, /* lm */
|
||||||
{0x010000000000001B, true}, /* ppc */
|
{Boot2KnownTitleId::ppc, true}, /* ppc */
|
||||||
{0x0100000000000010, true}, /* ptm */
|
{Boot2KnownTitleId::ptm, true}, /* ptm */
|
||||||
{0x0100000000000013, true}, /* hid */
|
{Boot2KnownTitleId::hid, true}, /* hid */
|
||||||
{0x0100000000000014, true}, /* audio */
|
{Boot2KnownTitleId::audio, true}, /* audio */
|
||||||
{0x0100000000000029, true}, /* lbl */
|
{Boot2KnownTitleId::lbl, true}, /* lbl */
|
||||||
{0x0100000000000016, true}, /* wlan */
|
{Boot2KnownTitleId::wlan, true}, /* wlan */
|
||||||
{0x010000000000000B, true}, /* bluetooth */
|
{Boot2KnownTitleId::bluetooth, true}, /* bluetooth */
|
||||||
{0x0100000000000012, true}, /* bsdsockets */
|
{Boot2KnownTitleId::bsdsockets, true}, /* bsdsockets */
|
||||||
{0x010000000000000F, true}, /* nifm */
|
{Boot2KnownTitleId::nifm, true}, /* nifm */
|
||||||
{0x0100000000000018, true}, /* ldn */
|
{Boot2KnownTitleId::ldn, true}, /* ldn */
|
||||||
{0x010000000000001E, true}, /* account */
|
{Boot2KnownTitleId::account, true}, /* account */
|
||||||
{0x010000000000000E, false}, /* friends */
|
{Boot2KnownTitleId::friends, false}, /* friends */
|
||||||
{0x0100000000000020, true}, /* nfc */
|
{Boot2KnownTitleId::nfc, true}, /* nfc */
|
||||||
{0x010000000000003C, true}, /* jpegdec */
|
{Boot2KnownTitleId::jpegdec, true}, /* jpegdec */
|
||||||
{0x0100000000000022, true}, /* capsrv */
|
{Boot2KnownTitleId::capsrv, true}, /* capsrv */
|
||||||
{0x0100000000000024, true}, /* ssl */
|
{Boot2KnownTitleId::ssl, true}, /* ssl */
|
||||||
{0x0100000000000025, true}, /* nim */
|
{Boot2KnownTitleId::nim, true}, /* nim */
|
||||||
{0x010000000000000C, false}, /* bcat */
|
{Boot2KnownTitleId::bcat, false}, /* bcat */
|
||||||
{0x010000000000002B, true}, /* erpt */
|
{Boot2KnownTitleId::erpt, true}, /* erpt */
|
||||||
{0x0100000000000033, true}, /* es */
|
{Boot2KnownTitleId::es, true}, /* es */
|
||||||
{0x010000000000002E, true}, /* pctl */
|
{Boot2KnownTitleId::pctl, true}, /* pctl */
|
||||||
{0x010000000000002A, true}, /* btm */
|
{Boot2KnownTitleId::btm, true}, /* btm */
|
||||||
{0x0100000000000030, false}, /* eupld */
|
{Boot2KnownTitleId::eupld, false}, /* eupld */
|
||||||
{0x0100000000000031, true}, /* glue */
|
{Boot2KnownTitleId::glue, true}, /* glue */
|
||||||
{0x0100000000000032, true}, /* eclct */
|
{Boot2KnownTitleId::eclct, true}, /* eclct */
|
||||||
{0x010000000000002F, false}, /* npns */
|
{Boot2KnownTitleId::npns, false}, /* npns */
|
||||||
{0x0100000000000034, true}, /* fatal */
|
{Boot2KnownTitleId::fatal, true}, /* fatal */
|
||||||
{0x0100000000000037, true}, /* ro */
|
{Boot2KnownTitleId::ro, true}, /* ro */
|
||||||
{0x0100000000000038, true}, /* doesn't exist on retail systems */
|
{Boot2KnownTitleId::profiler, true}, /* profiler */
|
||||||
{0x0100000000000039, true}, /* sdb */
|
{Boot2KnownTitleId::sdb, true}, /* sdb */
|
||||||
{0x010000000000003A, true}, /* migration */
|
{Boot2KnownTitleId::migration, true}, /* migration */
|
||||||
{0x0100000000000035, true}, /* grc */
|
{Boot2KnownTitleId::grc, true}, /* grc */
|
||||||
};
|
};
|
||||||
|
|
||||||
void EmbeddedBoot2::Main() {
|
void EmbeddedBoot2::Main() {
|
||||||
/* TODO: Modify initial program launch order, to get SD card mounted faster. */
|
/* TODO: Modify initial program launch order, to get SD card mounted faster. */
|
||||||
|
|
||||||
/* Launch psc. */
|
/* Launch psc. */
|
||||||
LaunchTitle(0x0100000000000021, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(Boot2KnownTitleId::psc, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch settings. */
|
/* Launch settings. */
|
||||||
LaunchTitle(0x0100000000000009, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(Boot2KnownTitleId::settings, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch usb. */
|
/* Launch usb. */
|
||||||
LaunchTitle(0x0100000000000006, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(Boot2KnownTitleId::usb, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch pcie. */
|
/* Launch pcie. */
|
||||||
LaunchTitle(0x010000000000001D, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(Boot2KnownTitleId::pcie, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch bus. */
|
/* Launch bus. */
|
||||||
LaunchTitle(0x010000000000000A, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(Boot2KnownTitleId::bus, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch tma. */
|
/* Launch tma. */
|
||||||
LaunchTitle(0x0100000000000007, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(Boot2KnownTitleId::tma, FsStorageId_NandSystem, 0, NULL);
|
||||||
/* Launch pcv. */
|
/* Launch pcv. */
|
||||||
LaunchTitle(0x010000000000001A, FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(Boot2KnownTitleId::pcv, FsStorageId_NandSystem, 0, NULL);
|
||||||
|
|
||||||
bool maintenance = ShouldForceMaintenanceMode();
|
bool maintenance = ShouldForceMaintenanceMode();
|
||||||
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<u64>(launch_program), FsStorageId_NandSystem, 0, NULL);
|
LaunchTitle(std::get<Boot2KnownTitleId>(launch_program), FsStorageId_NandSystem, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,65 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
enum class TitleId : u64 {
|
enum class Boot2KnownTitleId : u64 {
|
||||||
x = 0UL,
|
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,
|
||||||
};
|
};
|
||||||
|
|
||||||
class EmbeddedBoot2 {
|
class EmbeddedBoot2 {
|
||||||
|
|
Loading…
Reference in a new issue