mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-05 19:51:45 +00:00
Loader: fix automatic apptype patching.
This commit is contained in:
parent
2d6aba7a70
commit
20faa7f00b
2 changed files with 13 additions and 1 deletions
|
@ -190,7 +190,7 @@ Result NpdmUtils::LoadNpdm(u64 tid, NpdmInfo *out) {
|
||||||
info->acid->flags = (info->acid->flags & 0xFFFFFFC3) | (original_info->acid->flags & 0x0000003C);
|
info->acid->flags = (info->acid->flags & 0xFFFFFFC3) | (original_info->acid->flags & 0x0000003C);
|
||||||
}
|
}
|
||||||
/* Fix application type. */
|
/* Fix application type. */
|
||||||
const u32 original_application_type = GetApplicationType((u32 *)original_info->aci0_kac, original_info->aci0->kac_size/sizeof(u32)) & 7;
|
const u32 original_application_type = GetApplicationTypeRaw((u32 *)original_info->aci0_kac, original_info->aci0->kac_size/sizeof(u32)) & 7;
|
||||||
u32 *caps = (u32 *)info->aci0_kac;
|
u32 *caps = (u32 *)info->aci0_kac;
|
||||||
for (unsigned int i = 0; i < info->aci0->kac_size/sizeof(u32); i++) {
|
for (unsigned int i = 0; i < info->aci0->kac_size/sizeof(u32); i++) {
|
||||||
if ((caps[i] & 0x3FFF) == 0x1FFF) {
|
if ((caps[i] & 0x3FFF) == 0x1FFF) {
|
||||||
|
@ -490,3 +490,14 @@ u32 NpdmUtils::GetApplicationType(u32 *caps, size_t num_caps) {
|
||||||
}
|
}
|
||||||
return application_type;
|
return application_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Like GetApplicationType, except this returns the raw kac descriptor value. */
|
||||||
|
u32 NpdmUtils::GetApplicationTypeRaw(u32 *caps, size_t num_caps) {
|
||||||
|
u32 application_type = 0;
|
||||||
|
for (unsigned int i = 0; i < num_caps; i++) {
|
||||||
|
if ((caps[i] & 0x3FFF) == 0x1FFF) {
|
||||||
|
return (caps[i] >> 14) & 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return application_type;
|
||||||
|
}
|
|
@ -96,6 +96,7 @@ class NpdmUtils {
|
||||||
static_assert(sizeof(NpdmAci0) == 0x40, "Incorrectly defined NpdmAci0!");
|
static_assert(sizeof(NpdmAci0) == 0x40, "Incorrectly defined NpdmAci0!");
|
||||||
|
|
||||||
static u32 GetApplicationType(u32 *caps, size_t num_caps);
|
static u32 GetApplicationType(u32 *caps, size_t num_caps);
|
||||||
|
static u32 GetApplicationTypeRaw(u32 *caps, size_t num_caps);
|
||||||
|
|
||||||
static Result ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size_t num_restrict_caps, u32 *&cur_cap, size_t &caps_remaining);
|
static Result ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size_t num_restrict_caps, u32 *&cur_cap, size_t &caps_remaining);
|
||||||
static Result ValidateCapabilities(u32 *acid_caps, size_t num_acid_caps, u32 *aci0_caps, size_t num_aci0_caps);
|
static Result ValidateCapabilities(u32 *acid_caps, size_t num_acid_caps, u32 *aci0_caps, size_t num_aci0_caps);
|
||||||
|
|
Loading…
Reference in a new issue