pm/mitm: okay, that api won't work, try a different one

This commit is contained in:
Michael Scire
2023-05-09 22:12:00 -07:00
parent 9b480e4757
commit efe7b63576
27 changed files with 376 additions and 32 deletions

View File

@@ -244,6 +244,22 @@ namespace ams::pm::impl {
/* If we fail after now, unpin. */
ON_RESULT_FAILURE { ldr::pm::UnpinProgram(pin_id); };
/* Ensure we can talk to mitm services. */
{
AMS_FUNCTION_LOCAL_STATIC_CONSTINIT(bool, s_initialized_mitm, false);
if (!s_initialized_mitm) {
mitm::pm::Initialize();
s_initialized_mitm = true;
}
}
/* Determine boost size for mitm. */
u64 mitm_boost_size = 0;
R_TRY(mitm::pm::PrepareLaunchProgram(std::addressof(mitm_boost_size), program_info.program_id, override_status, is_application));
R_ABORT_UNLESS(BoostSystemMemoryResourceLimitForMitm(mitm_boost_size));
ON_RESULT_FAILURE_2 { R_ABORT_UNLESS(BoostSystemMemoryResourceLimitForMitm(0)); };
/* Ensure resources are available. */
resource::WaitResourceAvailable(std::addressof(program_info));