mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-26 04:52:47 +02:00
ams_mitm: implement ns.mitm
This commit is contained in:
parent
5f75944505
commit
c9396a6462
@ -421,6 +421,14 @@ namespace ams::ncm {
|
|||||||
return ProgramId::ApplicationStart <= program_id && program_id <= ProgramId::ApplicationEnd;
|
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<ProgramId>::value, "ProgramId definition!");
|
static_assert(sizeof(ProgramId) == sizeof(u64) && std::is_pod<ProgramId>::value, "ProgramId definition!");
|
||||||
|
|
||||||
/* Program Location. */
|
/* Program Location. */
|
||||||
|
@ -31,4 +31,7 @@ namespace ams::pm::info {
|
|||||||
/* Information convenience API. */
|
/* Information convenience API. */
|
||||||
bool HasLaunchedProgram(ncm::ProgramId program_id);
|
bool HasLaunchedProgram(ncm::ProgramId program_id);
|
||||||
|
|
||||||
|
Result IsHblProcessId(bool *out, os::ProcessId process_id);
|
||||||
|
Result IsHblProgramId(bool *out, ncm::ProgramId program_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,10 @@
|
|||||||
|
|
||||||
namespace ams::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
class IServiceObject{};
|
class IServiceObject {
|
||||||
|
public:
|
||||||
|
virtual ~IServiceObject() { /* ... */ }
|
||||||
|
};
|
||||||
|
|
||||||
class IMitmServiceObject : public IServiceObject {
|
class IMitmServiceObject : public IServiceObject {
|
||||||
protected:
|
protected:
|
||||||
@ -29,6 +32,8 @@ namespace ams::sf {
|
|||||||
public:
|
public:
|
||||||
IMitmServiceObject(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) : forward_service(std::move(s)), client_info(c) { /* ... */ }
|
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);
|
static bool ShouldMitm(os::ProcessId process_id, ncm::ProgramId program_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,4 +73,21 @@ namespace ams::pm::info {
|
|||||||
return has_launched;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user