2019-12-09 11:57:37 +00:00
|
|
|
/*
|
2021-10-04 20:59:10 +01:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2019-12-09 11:57:37 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include <stratosphere.hpp>
|
2022-03-06 20:08:20 +00:00
|
|
|
#include "ldr_ams.os.horizon.h"
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
namespace ams::ldr::pm {
|
|
|
|
|
|
|
|
/* Information API. */
|
2021-10-05 01:12:32 +01:00
|
|
|
Result CreateProcess(os::NativeHandle *out, PinId pin_id, u32 flags, Handle reslimit) {
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(ldrPmCreateProcess(pin_id.value, flags, reslimit, out));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result GetProgramInfo(ProgramInfo *out, const ncm::ProgramLocation &loc) {
|
2024-10-10 11:45:09 +01:00
|
|
|
static_assert(sizeof(*out) == sizeof(LoaderProgramInfo));
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(ldrPmGetProgramInfo(reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<LoaderProgramInfo *>(out)));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result PinProgram(PinId *out, const ncm::ProgramLocation &loc) {
|
|
|
|
static_assert(sizeof(*out) == sizeof(u64), "PinId definition!");
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(ldrPmPinProgram(reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<u64 *>(out)));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result UnpinProgram(PinId pin_id) {
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(ldrPmUnpinProgram(pin_id.value));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
2021-01-18 06:03:26 +00:00
|
|
|
Result HasLaunchedBootProgram(bool *out, ncm::ProgramId program_id) {
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(ldrPmAtmosphereHasLaunchedBootProgram(out, static_cast<u64>(program_id)));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result AtmosphereGetProgramInfo(ProgramInfo *out, cfg::OverrideStatus *out_status, const ncm::ProgramLocation &loc) {
|
|
|
|
static_assert(sizeof(*out_status) == sizeof(CfgOverrideStatus), "CfgOverrideStatus definition!");
|
2024-10-10 11:45:09 +01:00
|
|
|
static_assert(sizeof(*out) == sizeof(LoaderProgramInfo));
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(ldrPmAtmosphereGetProgramInfo(reinterpret_cast<LoaderProgramInfo *>(out), reinterpret_cast<CfgOverrideStatus *>(out_status), reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc))));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
2020-04-14 10:45:28 +01:00
|
|
|
Result SetEnabledProgramVerification(bool enabled) {
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(ldrPmSetEnabledProgramVerification(enabled));
|
2020-04-14 10:45:28 +01:00
|
|
|
}
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
Result AtmospherePinProgram(PinId *out, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &status) {
|
|
|
|
static_assert(sizeof(*out) == sizeof(u64), "PinId definition!");
|
|
|
|
static_assert(sizeof(status) == sizeof(CfgOverrideStatus), "CfgOverrideStatus definition!");
|
2022-03-26 21:48:33 +00:00
|
|
|
R_RETURN(ldrPmAtmospherePinProgram(reinterpret_cast<u64 *>(out), reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<const CfgOverrideStatus *>(std::addressof(status))));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|