mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-15 09:36:35 +00:00
ldr: ProgramInfo is 0x410 now, and fix debug flags for hbl
This commit is contained in:
parent
49763aee92
commit
0c4ae55731
6 changed files with 25 additions and 2 deletions
|
@ -34,9 +34,10 @@ namespace ams::ldr {
|
|||
u32 aci_sac_size;
|
||||
u32 acid_fac_size;
|
||||
u32 aci_fah_size;
|
||||
u8 unused_20[0x10];
|
||||
u8 ac_buffer[0x3E0];
|
||||
};
|
||||
static_assert(util::is_pod<ProgramInfo>::value && sizeof(ProgramInfo) == 0x400, "ProgramInfo definition!");
|
||||
static_assert(util::is_pod<ProgramInfo>::value && sizeof(ProgramInfo) == 0x410, "ProgramInfo definition!");
|
||||
|
||||
enum ProgramInfoFlag {
|
||||
ProgramInfoFlag_SystemModule = (0 << 0),
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace ams::ldr::pm {
|
|||
}
|
||||
|
||||
Result GetProgramInfo(ProgramInfo *out, const ncm::ProgramLocation &loc) {
|
||||
static_assert(sizeof(*out) == sizeof(LoaderProgramInfo));
|
||||
R_RETURN(ldrPmGetProgramInfo(reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<LoaderProgramInfo *>(out)));
|
||||
}
|
||||
|
||||
|
@ -42,6 +43,7 @@ namespace ams::ldr::pm {
|
|||
|
||||
Result AtmosphereGetProgramInfo(ProgramInfo *out, cfg::OverrideStatus *out_status, const ncm::ProgramLocation &loc) {
|
||||
static_assert(sizeof(*out_status) == sizeof(CfgOverrideStatus), "CfgOverrideStatus definition!");
|
||||
static_assert(sizeof(*out) == sizeof(LoaderProgramInfo));
|
||||
R_RETURN(ldrPmAtmosphereGetProgramInfo(reinterpret_cast<LoaderProgramInfo *>(out), reinterpret_cast<CfgOverrideStatus *>(out_status), reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc))));
|
||||
}
|
||||
|
||||
|
|
|
@ -425,6 +425,20 @@ namespace ams::ldr {
|
|||
}
|
||||
}
|
||||
|
||||
void FixDebugCapabilityForHbl(util::BitPack32 *kac, size_t count) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
const auto cap = kac[i];
|
||||
switch (GetCapabilityId(cap)) {
|
||||
case CapabilityId::DebugFlags:
|
||||
/* 19.0.0+ disallows more than one flag set; we are always DebugMode for kernel, so ForceDebug is the most powerful/flexible flag to set. */
|
||||
kac[i] = CapabilityDebugFlags::Encode(false, false, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreProcessCapability(util::BitPack32 *kac, size_t count) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
const auto cap = kac[i];
|
||||
|
|
|
@ -23,6 +23,8 @@ namespace ams::ldr {
|
|||
u16 MakeProgramInfoFlag(const util::BitPack32 *kac, size_t count);
|
||||
void UpdateProgramInfoFlag(u16 flags, util::BitPack32 *kac, size_t count);
|
||||
|
||||
void FixDebugCapabilityForHbl(util::BitPack32 *kac, size_t count);
|
||||
|
||||
void PreProcessCapability(util::BitPack32 *kac, size_t count);
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace ams {
|
|||
namespace {
|
||||
|
||||
struct ServerOptions {
|
||||
static constexpr size_t PointerBufferSize = 0x400;
|
||||
static constexpr size_t PointerBufferSize = 0x420;
|
||||
static constexpr size_t MaxDomains = 0;
|
||||
static constexpr size_t MaxDomainObjects = 0;
|
||||
static constexpr bool CanDeferInvokeRequest = false;
|
||||
|
|
|
@ -252,6 +252,10 @@ namespace ams::ldr {
|
|||
meta->npdm->main_thread_priority = HblMainThreadPriorityApplet;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix the debug capabilities, to prevent needing a hbl recompilation. */
|
||||
FixDebugCapabilityForHbl(static_cast<util::BitPack32 *>(meta->acid_kac), meta->acid->kac_size / sizeof(util::BitPack32));
|
||||
FixDebugCapabilityForHbl(static_cast<util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32));
|
||||
} else if (hos::GetVersion() >= hos::Version_10_0_0) {
|
||||
/* If storage id is none, there is no base code filesystem, and thus it is impossible for us to validate. */
|
||||
/* However, if we're an application, we are guaranteed a base code filesystem. */
|
||||
|
|
Loading…
Reference in a new issue