strat: go all in on ncm::TitleId
This commit is contained in:
@@ -43,10 +43,11 @@ extern "C" {
|
||||
alignas(16) u8 __nx_exception_stack[0x1000];
|
||||
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
|
||||
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
||||
u64 __stratosphere_title_id = 0x010041544D530000ul;
|
||||
void __libstratosphere_exception_handler(AtmosphereFatalErrorContext *ctx);
|
||||
}
|
||||
|
||||
sts::ncm::TitleId __stratosphere_title_id = sts::ncm::TitleId::AtmosphereMitm;
|
||||
|
||||
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
||||
StratosphereCrashHandler(ctx);
|
||||
}
|
||||
|
||||
@@ -31,13 +31,13 @@ class BpcMitmService : public IMitmServiceObject {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static bool ShouldMitm(u64 pid, u64 tid) {
|
||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
||||
/* We will mitm:
|
||||
* - am, to intercept the Reboot/Power buttons in the overlay menu.
|
||||
* - fatal, to simplify payload reboot logic significantly
|
||||
* - applications, to allow homebrew to take advantage of the feature.
|
||||
*/
|
||||
return tid == TitleId_Am || tid == TitleId_Fatal || TitleIdIsApplication(tid) || Utils::IsHblTid(tid);
|
||||
return tid == sts::ncm::TitleId::Am || tid == sts::ncm::TitleId::Fatal || sts::ncm::IsApplicationTitleId(tid) || Utils::IsHblTid(static_cast<u64>(tid));
|
||||
}
|
||||
|
||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||
|
||||
@@ -28,11 +28,11 @@ bool Boot0Storage::CanModifyBctPubks() {
|
||||
/* RCM bug patched. */
|
||||
/* Only allow NS to update the BCT pubks. */
|
||||
/* AutoRCM on a patched unit will cause a brick, so homebrew should NOT be allowed to write. */
|
||||
return this->title_id == TitleId_Ns;
|
||||
return this->title_id == sts::ncm::TitleId::Ns;
|
||||
} else {
|
||||
/* RCM bug unpatched. */
|
||||
/* Allow homebrew but not NS to update the BCT pubks. */
|
||||
return this->title_id != TitleId_Ns;
|
||||
return this->title_id != sts::ncm::TitleId::Ns;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,12 +131,12 @@ class Boot0Storage : public SectoredProxyStorage<0x200> {
|
||||
static constexpr u64 EksSize = 0x4000;
|
||||
static constexpr u64 EksEnd = EksStart + EksSize;
|
||||
private:
|
||||
u64 title_id;
|
||||
sts::ncm::TitleId title_id;
|
||||
private:
|
||||
bool CanModifyBctPubks();
|
||||
public:
|
||||
Boot0Storage(FsStorage *s, u64 t) : Base(s), title_id(t) { }
|
||||
Boot0Storage(FsStorage s, u64 t) : Base(s), title_id(t) { }
|
||||
Boot0Storage(FsStorage *s, sts::ncm::TitleId t) : Base(s), title_id(t) { }
|
||||
Boot0Storage(FsStorage s, sts::ncm::TitleId t) : Base(s), title_id(t) { }
|
||||
public:
|
||||
virtual Result Read(void *_buffer, size_t size, u64 offset) override;
|
||||
virtual Result Write(void *_buffer, size_t size, u64 offset) override;
|
||||
|
||||
@@ -39,13 +39,13 @@
|
||||
static HosMutex g_StorageCacheLock;
|
||||
static std::unordered_map<u64, std::weak_ptr<IStorageInterface>> g_StorageCache;
|
||||
|
||||
static bool StorageCacheGetEntry(u64 title_id, std::shared_ptr<IStorageInterface> *out) {
|
||||
static bool StorageCacheGetEntry(sts::ncm::TitleId title_id, std::shared_ptr<IStorageInterface> *out) {
|
||||
std::scoped_lock<HosMutex> lock(g_StorageCacheLock);
|
||||
if (g_StorageCache.find(title_id) == g_StorageCache.end()) {
|
||||
if (g_StorageCache.find(static_cast<u64>(title_id)) == g_StorageCache.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto intf = g_StorageCache[title_id].lock();
|
||||
auto intf = g_StorageCache[static_cast<u64>(title_id)].lock();
|
||||
if (intf != nullptr) {
|
||||
*out = intf;
|
||||
return true;
|
||||
@@ -53,18 +53,18 @@ static bool StorageCacheGetEntry(u64 title_id, std::shared_ptr<IStorageInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
static void StorageCacheSetEntry(u64 title_id, std::shared_ptr<IStorageInterface> *ptr) {
|
||||
static void StorageCacheSetEntry(sts::ncm::TitleId title_id, std::shared_ptr<IStorageInterface> *ptr) {
|
||||
std::scoped_lock<HosMutex> lock(g_StorageCacheLock);
|
||||
|
||||
/* Ensure we always use the cached copy if present. */
|
||||
if (g_StorageCache.find(title_id) != g_StorageCache.end()) {
|
||||
auto intf = g_StorageCache[title_id].lock();
|
||||
if (g_StorageCache.find(static_cast<u64>(title_id)) != g_StorageCache.end()) {
|
||||
auto intf = g_StorageCache[static_cast<u64>(title_id)].lock();
|
||||
if (intf != nullptr) {
|
||||
*ptr = intf;
|
||||
}
|
||||
}
|
||||
|
||||
g_StorageCache[title_id] = *ptr;
|
||||
g_StorageCache[static_cast<u64>(title_id)] = *ptr;
|
||||
}
|
||||
|
||||
void FsMitmService::PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx) {
|
||||
@@ -74,7 +74,7 @@ void FsMitmService::PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx
|
||||
if (R_SUCCEEDED(ctx->rc)) {
|
||||
this_ptr->has_initialized = true;
|
||||
this_ptr->process_id = ctx->request.Pid;
|
||||
this_ptr->title_id = this_ptr->process_id;
|
||||
this_ptr->title_id = sts::ncm::TitleId{this_ptr->process_id};
|
||||
if (R_FAILED(MitmQueryUtils::GetAssociatedTidForPid(this_ptr->process_id, &this_ptr->title_id))) {
|
||||
/* Log here, if desired. */
|
||||
}
|
||||
@@ -105,7 +105,7 @@ Result FsMitmService::OpenFileSystemWithPatch(Out<std::shared_ptr<IFileSystemInt
|
||||
/* Check for eligibility. */
|
||||
{
|
||||
FsDir d;
|
||||
if (!Utils::IsWebAppletTid(this->title_id) || filesystem_type != FsFileSystemType_ContentManual || !Utils::IsHblTid(title_id) ||
|
||||
if (!Utils::IsWebAppletTid(static_cast<u64>(this->title_id)) || filesystem_type != FsFileSystemType_ContentManual || !Utils::IsHblTid(title_id) ||
|
||||
R_FAILED(Utils::OpenSdDir(AtmosphereHblWebContentDir, &d))) {
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ Result FsMitmService::OpenFileSystemWithId(Out<std::shared_ptr<IFileSystemInterf
|
||||
/* Check for eligibility. */
|
||||
{
|
||||
FsDir d;
|
||||
if (!Utils::IsWebAppletTid(this->title_id) || filesystem_type != FsFileSystemType_ContentManual || !Utils::IsHblTid(title_id) ||
|
||||
if (!Utils::IsWebAppletTid(static_cast<u64>(this->title_id)) || filesystem_type != FsFileSystemType_ContentManual || !Utils::IsHblTid(title_id) ||
|
||||
R_FAILED(Utils::OpenSdDir(AtmosphereHblWebContentDir, &d))) {
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ Result FsMitmService::OpenFileSystemWithId(Out<std::shared_ptr<IFileSystemInterf
|
||||
|
||||
Result FsMitmService::OpenSdCardFileSystem(Out<std::shared_ptr<IFileSystemInterface>> out_fs) {
|
||||
/* We only care about redirecting this for NS/Emummc. */
|
||||
if (this->title_id != TitleId_Ns) {
|
||||
if (this->title_id != sts::ncm::TitleId::Ns) {
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
if (!IsEmummc()) {
|
||||
@@ -174,7 +174,7 @@ Result FsMitmService::OpenSdCardFileSystem(Out<std::shared_ptr<IFileSystemInterf
|
||||
|
||||
Result FsMitmService::OpenSaveDataFileSystem(Out<std::shared_ptr<IFileSystemInterface>> out_fs, u8 space_id, FsSave save_struct) {
|
||||
bool should_redirect_saves = false;
|
||||
const bool has_redirect_save_flags = Utils::HasFlag(this->title_id, "redirect_save");
|
||||
const bool has_redirect_save_flags = Utils::HasFlag(static_cast<u64>(this->title_id), "redirect_save");
|
||||
if (R_FAILED(Utils::GetSettingsItemBooleanValue("atmosphere", "fsmitm_redirect_saves_to_sd", &should_redirect_saves))) {
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ Result FsMitmService::OpenSaveDataFileSystem(Out<std::shared_ptr<IFileSystemInte
|
||||
|
||||
|
||||
/* Verify that we can open the save directory, and that it exists. */
|
||||
const u64 target_tid = save_struct.titleID == 0 ? this->title_id : save_struct.titleID;
|
||||
const u64 target_tid = save_struct.titleID == 0 ? static_cast<u64>(this->title_id) : save_struct.titleID;
|
||||
FsPath save_dir_path;
|
||||
R_TRY(FsSaveUtils::GetSaveDataDirectoryPath(save_dir_path, space_id, save_struct.saveDataType, target_tid, save_struct.userID, save_struct.saveID));
|
||||
|
||||
@@ -240,9 +240,9 @@ Result FsMitmService::OpenBisStorage(Out<std::shared_ptr<IStorageInterface>> out
|
||||
FsStorage bis_storage;
|
||||
R_TRY(fsOpenBisStorageFwd(this->forward_service.get(), &bis_storage, bis_partition_id));
|
||||
|
||||
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");
|
||||
const bool is_sysmodule = sts::ncm::IsSystemTitleId(this->title_id);
|
||||
const bool has_bis_write_flag = Utils::HasFlag(static_cast<u64>(this->title_id), "bis_write");
|
||||
const bool has_cal0_read_flag = Utils::HasFlag(static_cast<u64>(this->title_id), "cal_read");
|
||||
|
||||
/* Set output storage. */
|
||||
if (bis_partition_id == FsBisStorageId_Boot0) {
|
||||
@@ -260,7 +260,7 @@ Result FsMitmService::OpenBisStorage(Out<std::shared_ptr<IStorageInterface>> out
|
||||
if (is_sysmodule || has_bis_write_flag) {
|
||||
/* Sysmodules should still be allowed to read and write. */
|
||||
out_storage.SetValue(std::make_shared<IStorageInterface>(new ProxyStorage(bis_storage)));
|
||||
} else if (Utils::IsHblTid(this->title_id) &&
|
||||
} else if (Utils::IsHblTid(static_cast<u64>(this->title_id)) &&
|
||||
((FsBisStorageId_BootConfigAndPackage2NormalMain <= bis_partition_id && bis_partition_id <= FsBisStorageId_BootConfigAndPackage2RepairSub) ||
|
||||
bis_partition_id == FsBisStorageId_Boot1)) {
|
||||
/* Allow HBL to write to boot1 (safe firm) + package2. */
|
||||
@@ -288,7 +288,7 @@ Result FsMitmService::OpenDataStorageByCurrentProcess(Out<std::shared_ptr<IStora
|
||||
}
|
||||
|
||||
/* If we don't have anything to modify, there's no sense in maintaining a copy of the metadata tables. */
|
||||
if (!Utils::HasSdRomfsContent(this->title_id)) {
|
||||
if (!Utils::HasSdRomfsContent(static_cast<u64>(this->title_id))) {
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
|
||||
@@ -318,10 +318,10 @@ Result FsMitmService::OpenDataStorageByCurrentProcess(Out<std::shared_ptr<IStora
|
||||
std::shared_ptr<IStorageInterface> storage_to_cache = nullptr;
|
||||
/* TODO: Is there a sensible path that ends in ".romfs" we can use?" */
|
||||
FsFile data_file;
|
||||
if (R_SUCCEEDED(Utils::OpenSdFileForAtmosphere(this->title_id, "romfs.bin", FS_OPEN_READ, &data_file))) {
|
||||
storage_to_cache = std::make_shared<IStorageInterface>(new LayeredRomFS(std::make_shared<ReadOnlyStorageAdapter>(new ProxyStorage(data_storage)), std::make_shared<ReadOnlyStorageAdapter>(new FileStorage(new ProxyFile(data_file))), this->title_id));
|
||||
if (R_SUCCEEDED(Utils::OpenSdFileForAtmosphere(static_cast<u64>(this->title_id), "romfs.bin", FS_OPEN_READ, &data_file))) {
|
||||
storage_to_cache = std::make_shared<IStorageInterface>(new LayeredRomFS(std::make_shared<ReadOnlyStorageAdapter>(new ProxyStorage(data_storage)), std::make_shared<ReadOnlyStorageAdapter>(new FileStorage(new ProxyFile(data_file))), static_cast<u64>(this->title_id)));
|
||||
} else {
|
||||
storage_to_cache = std::make_shared<IStorageInterface>(new LayeredRomFS(std::make_shared<ReadOnlyStorageAdapter>(new ProxyStorage(data_storage)), nullptr, this->title_id));
|
||||
storage_to_cache = std::make_shared<IStorageInterface>(new LayeredRomFS(std::make_shared<ReadOnlyStorageAdapter>(new ProxyStorage(data_storage)), nullptr, static_cast<u64>(this->title_id)));
|
||||
}
|
||||
|
||||
StorageCacheSetEntry(this->title_id, &storage_to_cache);
|
||||
@@ -351,7 +351,7 @@ Result FsMitmService::OpenDataStorageByDataId(Out<std::shared_ptr<IStorageInterf
|
||||
/* Try to get from the cache. */
|
||||
{
|
||||
std::shared_ptr<IStorageInterface> cached_storage = nullptr;
|
||||
bool has_cache = StorageCacheGetEntry(data_id, &cached_storage);
|
||||
bool has_cache = StorageCacheGetEntry(sts::ncm::TitleId{data_id}, &cached_storage);
|
||||
|
||||
if (has_cache) {
|
||||
if (out_storage.IsDomain()) {
|
||||
@@ -380,7 +380,7 @@ Result FsMitmService::OpenDataStorageByDataId(Out<std::shared_ptr<IStorageInterf
|
||||
storage_to_cache = std::make_shared<IStorageInterface>(new LayeredRomFS(std::make_shared<ReadOnlyStorageAdapter>(new ProxyStorage(data_storage)), nullptr, data_id));
|
||||
}
|
||||
|
||||
StorageCacheSetEntry(data_id, &storage_to_cache);
|
||||
StorageCacheSetEntry(sts::ncm::TitleId{data_id}, &storage_to_cache);
|
||||
|
||||
out_storage.SetValue(std::move(storage_to_cache));
|
||||
if (out_storage.IsDomain()) {
|
||||
|
||||
@@ -45,14 +45,14 @@ class FsMitmService : public IMitmServiceObject {
|
||||
bool should_override_contents;
|
||||
public:
|
||||
FsMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
|
||||
if (Utils::HasSdDisableMitMFlag(this->title_id)) {
|
||||
if (Utils::HasSdDisableMitMFlag(static_cast<u64>(this->title_id))) {
|
||||
this->should_override_contents = false;
|
||||
} else {
|
||||
this->should_override_contents = (this->title_id >= TitleId_ApplicationStart || Utils::HasSdMitMFlag(this->title_id)) && Utils::HasOverrideButton(this->title_id);
|
||||
this->should_override_contents = (this->title_id >= sts::ncm::TitleId::ApplicationStart || Utils::HasSdMitMFlag(static_cast<u64>(this->title_id))) && Utils::HasOverrideButton(static_cast<u64>(this->title_id));
|
||||
}
|
||||
}
|
||||
|
||||
static bool ShouldMitm(u64 pid, u64 tid) {
|
||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
||||
/* Don't Mitm KIPs */
|
||||
if (pid < 0x50) {
|
||||
return false;
|
||||
@@ -62,11 +62,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 == TitleId_AppletQlaunch || tid == TitleId_AppletMaintenanceMenu) {
|
||||
if (tid == sts::ncm::TitleId::AppletQlaunch || tid == sts::ncm::TitleId::AppletMaintenanceMenu) {
|
||||
has_launched_qlaunch = true;
|
||||
}
|
||||
|
||||
return has_launched_qlaunch || tid == TitleId_Ns || tid >= TitleId_ApplicationStart || Utils::HasSdMitMFlag(tid);
|
||||
return has_launched_qlaunch || tid == sts::ncm::TitleId::Ns || tid >= sts::ncm::TitleId::ApplicationStart || Utils::HasSdMitMFlag(static_cast<u64>(tid));
|
||||
}
|
||||
|
||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||
|
||||
@@ -30,7 +30,7 @@ Result NsAmMitmService::GetApplicationContentPath(OutBuffer<u8> out_path, u64 ap
|
||||
|
||||
Result NsAmMitmService::ResolveApplicationContentPath(u64 title_id, u8 storage_type) {
|
||||
/* Always succeed for web applet asking about HBL. */
|
||||
if (Utils::IsWebAppletTid(this->title_id) && Utils::IsHblTid(title_id)) {
|
||||
if (Utils::IsWebAppletTid(static_cast<u64>(this->title_id)) && Utils::IsHblTid(title_id)) {
|
||||
nsamResolveApplicationContentPathFwd(this->forward_service.get(), title_id, static_cast<FsStorageId>(storage_type));
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ class NsAmMitmService : public IMitmServiceObject {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static bool ShouldMitm(u64 pid, u64 tid) {
|
||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
||||
/* We will mitm:
|
||||
* - web applets, to facilitate hbl web browser launching.
|
||||
*/
|
||||
return Utils::IsWebAppletTid(tid);
|
||||
return Utils::IsWebAppletTid(static_cast<u64>(tid));
|
||||
}
|
||||
|
||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||
|
||||
@@ -29,7 +29,7 @@ Result NsWebMitmService::GetDocumentInterface(Out<std::shared_ptr<NsDocumentServ
|
||||
R_TRY(nsGetDocumentInterfaceFwd(this->forward_service.get(), &doc));
|
||||
|
||||
/* Set output interface. */
|
||||
out_intf.SetValue(std::move(std::make_shared<NsDocumentService>(this->title_id, doc)));
|
||||
out_intf.SetValue(std::move(std::make_shared<NsDocumentService>(static_cast<u64>(this->title_id), doc)));
|
||||
if (out_intf.IsDomain()) {
|
||||
out_intf.ChangeObjectId(doc.s.object_id);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ Result NsDocumentService::GetApplicationContentPath(OutBuffer<u8> out_path, u64
|
||||
|
||||
Result NsDocumentService::ResolveApplicationContentPath(u64 title_id, u8 storage_type) {
|
||||
/* Always succeed for web applet asking about HBL. */
|
||||
if (Utils::IsWebAppletTid(this->title_id) && Utils::IsHblTid(title_id)) {
|
||||
if (Utils::IsWebAppletTid(static_cast<u64>(this->title_id)) && Utils::IsHblTid(title_id)) {
|
||||
nswebResolveApplicationContentPath(this->srv.get(), title_id, static_cast<FsStorageId>(storage_type));
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
@@ -71,11 +71,11 @@ class NsWebMitmService : public IMitmServiceObject {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static bool ShouldMitm(u64 pid, u64 tid) {
|
||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
||||
/* We will mitm:
|
||||
* - web applets, to facilitate hbl web browser launching.
|
||||
*/
|
||||
return Utils::IsWebAppletTid(tid);
|
||||
return Utils::IsWebAppletTid(static_cast<u64>(tid));
|
||||
}
|
||||
|
||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||
|
||||
@@ -68,14 +68,14 @@ Result SetMitmService::EnsureLocale() {
|
||||
|
||||
if (!this->got_locale) {
|
||||
std::memset(&this->locale, 0xCC, sizeof(this->locale));
|
||||
if (this->title_id == TitleId_Ns) {
|
||||
if (this->title_id == sts::ncm::TitleId::Ns) {
|
||||
u64 app_pid = 0;
|
||||
u64 app_tid = 0;
|
||||
R_TRY(pmdmntGetApplicationPid(&app_pid));
|
||||
R_TRY(pminfoGetTitleId(&app_tid, app_pid));
|
||||
this->locale = Utils::GetTitleOverrideLocale(app_tid);
|
||||
} else {
|
||||
this->locale = Utils::GetTitleOverrideLocale(this->title_id);
|
||||
this->locale = Utils::GetTitleOverrideLocale(static_cast<u64>(this->title_id));
|
||||
this->got_locale = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ class SetMitmService : public IMitmServiceObject {
|
||||
this->got_locale = false;
|
||||
}
|
||||
|
||||
static bool ShouldMitm(u64 pid, u64 tid) {
|
||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
||||
/* Mitm all applications. */
|
||||
return tid == TitleId_Ns || TitleIdIsApplication(tid);
|
||||
return tid == sts::ncm::TitleId::Ns || sts::ncm::IsApplicationTitleId(tid);
|
||||
}
|
||||
|
||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||
|
||||
@@ -32,7 +32,7 @@ void VersionManager::Initialize() {
|
||||
}
|
||||
|
||||
/* Mount firmware version data archive. */
|
||||
R_ASSERT(romfsMountFromDataArchive(TitleId_ArchiveSystemVersion, FsStorageId_NandSystem, "sysver"));
|
||||
R_ASSERT(romfsMountFromDataArchive(static_cast<u64>(sts::ncm::TitleId::ArchiveSystemVersion), FsStorageId_NandSystem, "sysver"));
|
||||
{
|
||||
ON_SCOPE_EXIT { romfsUnmount("sysver"); };
|
||||
|
||||
@@ -70,11 +70,11 @@ void VersionManager::Initialize() {
|
||||
g_got_version = true;
|
||||
}
|
||||
|
||||
Result VersionManager::GetFirmwareVersion(u64 title_id, SetSysFirmwareVersion *out) {
|
||||
Result VersionManager::GetFirmwareVersion(sts::ncm::TitleId title_id, SetSysFirmwareVersion *out) {
|
||||
VersionManager::Initialize();
|
||||
|
||||
/* Report atmosphere string to qlaunch, maintenance and nothing else. */
|
||||
if (title_id == TitleId_AppletQlaunch || title_id == TitleId_AppletMaintenanceMenu) {
|
||||
if (title_id == sts::ncm::TitleId::AppletQlaunch || title_id == sts::ncm::TitleId::AppletMaintenanceMenu) {
|
||||
*out = g_ams_fw_version;
|
||||
} else {
|
||||
*out = g_fw_version;
|
||||
|
||||
@@ -21,5 +21,5 @@
|
||||
class VersionManager {
|
||||
public:
|
||||
static void Initialize();
|
||||
static Result GetFirmwareVersion(u64 title_id, SetSysFirmwareVersion *out);
|
||||
static Result GetFirmwareVersion(sts::ncm::TitleId title_id, SetSysFirmwareVersion *out);
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ class SetSysMitmService : public IMitmServiceObject {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
static bool ShouldMitm(u64 pid, u64 tid) {
|
||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
||||
/* Mitm everything. */
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ static HblOverrideConfig g_hbl_override_config = {
|
||||
.key_combination = KEY_R,
|
||||
.override_by_default = false
|
||||
},
|
||||
.title_id = TitleId_AppletPhotoViewer,
|
||||
.title_id = static_cast<u64>(sts::ncm::TitleId::AppletPhotoViewer),
|
||||
.override_any_app = true
|
||||
};
|
||||
|
||||
@@ -378,12 +378,14 @@ Result Utils::SaveSdFileForAtmosphere(u64 title_id, const char *fn, void *data,
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
bool Utils::IsHblTid(u64 tid) {
|
||||
return (g_hbl_override_config.override_any_app && TitleIdIsApplication(tid)) || (tid == g_hbl_override_config.title_id);
|
||||
bool Utils::IsHblTid(u64 _tid) {
|
||||
const sts::ncm::TitleId tid{_tid};
|
||||
return (g_hbl_override_config.override_any_app && sts::ncm::IsApplicationTitleId(tid)) || (_tid == g_hbl_override_config.title_id);
|
||||
}
|
||||
|
||||
bool Utils::IsWebAppletTid(u64 tid) {
|
||||
return tid == TitleId_AppletWeb || tid == TitleId_AppletOfflineWeb || tid == TitleId_AppletLoginShare || tid == TitleId_AppletWifiWebAuth;
|
||||
bool Utils::IsWebAppletTid(u64 _tid) {
|
||||
const sts::ncm::TitleId tid{_tid};
|
||||
return tid == sts::ncm::TitleId::AppletWeb || tid == sts::ncm::TitleId::AppletOfflineWeb || tid == sts::ncm::TitleId::AppletLoginShare || tid == sts::ncm::TitleId::AppletWifiWebAuth;
|
||||
}
|
||||
|
||||
bool Utils::HasTitleFlag(u64 tid, const char *flag) {
|
||||
@@ -472,7 +474,7 @@ static bool HasOverrideKey(OverrideKey *cfg) {
|
||||
|
||||
|
||||
bool Utils::HasOverrideButton(u64 tid) {
|
||||
if ((!TitleIdIsApplication(tid)) || (!IsSdInitialized())) {
|
||||
if ((!sts::ncm::IsApplicationTitleId(sts::ncm::TitleId{tid})) || (!IsSdInitialized())) {
|
||||
/* Disable button override disable for non-applications. */
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user