mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-30 15:02:42 +02:00
exo2: cache soc type/hardware type for quick lookup
This commit is contained in:
parent
60416d1439
commit
68398407e0
@ -100,4 +100,20 @@ namespace ams::secmon {
|
|||||||
return GetSecmonConfiguration().GetKeyGeneration();
|
return GetSecmonConfiguration().GetKeyGeneration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ALWAYS_INLINE fuse::HardwareType GetHardwareType() {
|
||||||
|
return GetSecmonConfiguration().GetHardwareType();
|
||||||
|
}
|
||||||
|
|
||||||
|
ALWAYS_INLINE fuse::SocType GetSocType() {
|
||||||
|
return GetSecmonConfiguration().GetSocType();
|
||||||
|
}
|
||||||
|
|
||||||
|
ALWAYS_INLINE fuse::HardwareState GetHardwareState() {
|
||||||
|
return GetSecmonConfiguration().GetHardwareState();
|
||||||
|
}
|
||||||
|
|
||||||
|
ALWAYS_INLINE bool IsProduction() {
|
||||||
|
return GetSecmonConfiguration().IsProduction();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <vapours.hpp>
|
#include <vapours.hpp>
|
||||||
|
#include <exosphere/fuse.hpp>
|
||||||
#include <exosphere/secmon/secmon_emummc_context.hpp>
|
#include <exosphere/secmon/secmon_emummc_context.hpp>
|
||||||
|
|
||||||
namespace ams::secmon {
|
namespace ams::secmon {
|
||||||
@ -48,16 +49,31 @@ namespace ams::secmon {
|
|||||||
struct SecureMonitorConfiguration {
|
struct SecureMonitorConfiguration {
|
||||||
ams::TargetFirmware target_firmware;
|
ams::TargetFirmware target_firmware;
|
||||||
s32 key_generation;
|
s32 key_generation;
|
||||||
|
u8 hardware_type;
|
||||||
|
u8 soc_type;
|
||||||
|
u8 hardware_state;
|
||||||
|
u8 pad_0B[1];
|
||||||
u32 flags;
|
u32 flags;
|
||||||
u32 reserved[(0x80 - 0x0C) / sizeof(u32)];
|
u32 reserved[(0x80 - 0x10) / sizeof(u32)];
|
||||||
|
|
||||||
constexpr void CopyFrom(const SecureMonitorStorageConfiguration &storage) {
|
constexpr void CopyFrom(const SecureMonitorStorageConfiguration &storage) {
|
||||||
this->target_firmware = storage.target_firmware;
|
this->target_firmware = storage.target_firmware;
|
||||||
this->flags = storage.flags;
|
this->flags = storage.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetFuseInfo() {
|
||||||
|
this->hardware_type = fuse::GetHardwareType();
|
||||||
|
this->soc_type = fuse::GetSocType();
|
||||||
|
this->hardware_state = fuse::GetHardwareState();
|
||||||
|
}
|
||||||
|
|
||||||
constexpr ams::TargetFirmware GetTargetFirmware() const { return this->target_firmware; }
|
constexpr ams::TargetFirmware GetTargetFirmware() const { return this->target_firmware; }
|
||||||
constexpr int GetKeyGeneration() const { return this->key_generation; }
|
constexpr int GetKeyGeneration() const { return this->key_generation; }
|
||||||
|
constexpr fuse::HardwareType GetHardwareType() const { return static_cast<fuse::HardwareType>(this->hardware_type); }
|
||||||
|
constexpr fuse::SocType GetSocType() const { return static_cast<fuse::SocType>(this->soc_type); }
|
||||||
|
constexpr fuse::HardwareState GetHardwareState() const { return static_cast<fuse::HardwareState>(this->hardware_state); }
|
||||||
|
|
||||||
|
constexpr bool IsProduction() const { return this->GetHardwareState() != fuse::HardwareState_Development; }
|
||||||
|
|
||||||
constexpr bool IsDevelopmentFunctionEnabledForKernel() const { return (this->flags & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForKernel) != 0; }
|
constexpr bool IsDevelopmentFunctionEnabledForKernel() const { return (this->flags & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForKernel) != 0; }
|
||||||
constexpr bool IsDevelopmentFunctionEnabledForUser() const { return (this->flags & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForUser) != 0; }
|
constexpr bool IsDevelopmentFunctionEnabledForUser() const { return (this->flags & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForUser) != 0; }
|
||||||
|
Loading…
Reference in New Issue
Block a user