diff --git a/include/stratosphere/ncm/ncm_types.hpp b/include/stratosphere/ncm/ncm_types.hpp index 0c13966b..b21adb94 100644 --- a/include/stratosphere/ncm/ncm_types.hpp +++ b/include/stratosphere/ncm/ncm_types.hpp @@ -421,6 +421,14 @@ namespace ams::ncm { return ProgramId::ApplicationStart <= program_id && program_id <= ProgramId::ApplicationEnd; } + inline constexpr bool IsWebAppletProgramId(const ProgramId &program_id) { + return program_id == ProgramId::AppletWeb || + program_id == ProgramId::AppletShop || + program_id == ProgramId::AppletOfflineWeb || + program_id == ProgramId::AppletLoginShare || + program_id == ProgramId::AppletWifiWebAuth; + } + static_assert(sizeof(ProgramId) == sizeof(u64) && std::is_pod::value, "ProgramId definition!"); /* Program Location. */ diff --git a/include/stratosphere/pm/pm_info_api.hpp b/include/stratosphere/pm/pm_info_api.hpp index 0b5e6dce..6a56b13d 100644 --- a/include/stratosphere/pm/pm_info_api.hpp +++ b/include/stratosphere/pm/pm_info_api.hpp @@ -31,4 +31,7 @@ namespace ams::pm::info { /* Information convenience API. */ bool HasLaunchedProgram(ncm::ProgramId program_id); + Result IsHblProcessId(bool *out, os::ProcessId process_id); + Result IsHblProgramId(bool *out, ncm::ProgramId program_id); + } diff --git a/include/stratosphere/sf/sf_service_object.hpp b/include/stratosphere/sf/sf_service_object.hpp index fd87ddb2..f0c32f1b 100644 --- a/include/stratosphere/sf/sf_service_object.hpp +++ b/include/stratosphere/sf/sf_service_object.hpp @@ -20,7 +20,10 @@ namespace ams::sf { - class IServiceObject{}; + class IServiceObject { + public: + virtual ~IServiceObject() { /* ... */ } + }; class IMitmServiceObject : public IServiceObject { protected: @@ -29,6 +32,8 @@ namespace ams::sf { public: IMitmServiceObject(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) : forward_service(std::move(s)), client_info(c) { /* ... */ } + virtual ~IMitmServiceObject() { /* ... */ } + static bool ShouldMitm(os::ProcessId process_id, ncm::ProgramId program_id); }; diff --git a/source/pm/pm_info_api.cpp b/source/pm/pm_info_api.cpp index e07a1531..e0028004 100644 --- a/source/pm/pm_info_api.cpp +++ b/source/pm/pm_info_api.cpp @@ -73,4 +73,21 @@ namespace ams::pm::info { return has_launched; } + + Result IsHblProcessId(bool *out, os::ProcessId process_id) { + ncm::ProgramLocation loc; + cfg::OverrideStatus override_status; + R_TRY(GetProcessInfo(&loc, &override_status, process_id)); + + *out = override_status.IsHbl(); + return ResultSuccess(); + } + + Result IsHblProgramId(bool *out, ncm::ProgramId program_id) { + os::ProcessId process_id; + R_TRY(GetProcessId(&process_id, program_id)); + + return IsHblProcessId(out, process_id); + } + }