mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-08-09 08:59:32 +02:00
ams: use bitpack for api version
This commit is contained in:
parent
1d3b4f1276
commit
ab8dfe40a0
@ -38,27 +38,41 @@ namespace ams::exosphere {
|
|||||||
};
|
};
|
||||||
#undef AMS_DEFINE_TARGET_FIRMWARE_ENUM
|
#undef AMS_DEFINE_TARGET_FIRMWARE_ENUM
|
||||||
|
|
||||||
constexpr inline u32 GetVersion(u32 major, u32 minor, u32 micro) {
|
constexpr ALWAYS_INLINE u32 GetVersion(u32 major, u32 minor, u32 micro) {
|
||||||
return (major << 16) | (minor << 8) | (micro);
|
return (major << 16) | (minor << 8) | (micro);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ApiInfo {
|
struct ApiInfo {
|
||||||
u32 major_version;
|
using MasterKeyRevision = util::BitPack64::Field<0, 8, u32>;
|
||||||
u32 minor_version;
|
using TargetFirmwareVersion = util::BitPack64::Field<MasterKeyRevision::Next, 8, TargetFirmware>;
|
||||||
u32 micro_version;
|
using MicroVersion = util::BitPack64::Field<TargetFirmwareVersion::Next, 8, u32>;
|
||||||
TargetFirmware target_firmware;
|
using MinorVersion = util::BitPack64::Field<MicroVersion::Next, 8, u32>;
|
||||||
u32 master_key_revision;
|
using MajorVersion = util::BitPack64::Field<MinorVersion::Next, 8, u32>;
|
||||||
|
|
||||||
constexpr u32 GetVersion() const {
|
util::BitPack64 value;
|
||||||
return ::ams::exosphere::GetVersion(this->major_version, this->minor_version, this->micro_version);
|
|
||||||
|
constexpr ALWAYS_INLINE u32 GetVersion() const {
|
||||||
|
return ::ams::exosphere::GetVersion(this->GetMajorVersion(), this->GetMinorVersion(), this->GetMicroVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr TargetFirmware GetTargetFirmware() const {
|
constexpr ALWAYS_INLINE u32 GetMajorVersion() const {
|
||||||
return this->target_firmware;
|
return this->value.Get<MajorVersion>();
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr u32 GetMasterKeyRevision() const {
|
constexpr ALWAYS_INLINE u32 GetMinorVersion() const {
|
||||||
return this->master_key_revision;
|
return this->value.Get<MinorVersion>();
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr ALWAYS_INLINE u32 GetMicroVersion() const {
|
||||||
|
return this->value.Get<MicroVersion>();
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr ALWAYS_INLINE TargetFirmware GetTargetFirmware() const {
|
||||||
|
return this->value.Get<TargetFirmwareVersion>();
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr ALWAYS_INLINE u32 GetMasterKeyRevision() const {
|
||||||
|
return this->value.Get<MasterKeyRevision>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,13 +26,7 @@ namespace ams::exosphere {
|
|||||||
R_ASSERT(ResultNotPresent());
|
R_ASSERT(ResultNotPresent());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiInfo{
|
return ApiInfo{ util::BitPack64(exosphere_cfg) };
|
||||||
.major_version = static_cast<u32>((exosphere_cfg >> 0x20) & 0xFF),
|
|
||||||
.minor_version = static_cast<u32>((exosphere_cfg >> 0x18) & 0xFF),
|
|
||||||
.micro_version = static_cast<u32>((exosphere_cfg >> 0x10) & 0xFF),
|
|
||||||
.target_firmware = static_cast<TargetFirmware>((exosphere_cfg >> 0x08) & 0xFF),
|
|
||||||
.master_key_revision = static_cast<u32>((exosphere_cfg >> 0x00) & 0xFF),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForceRebootToRcm() {
|
void ForceRebootToRcm() {
|
||||||
|
Loading…
Reference in New Issue
Block a user