mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Loader: Implement encryption check
This commit is contained in:
parent
d36eeaa3ca
commit
2706394384
3 changed files with 8 additions and 2 deletions
|
@ -71,6 +71,7 @@ enum class ResultStatus {
|
||||||
ErrorNotUsed,
|
ErrorNotUsed,
|
||||||
ErrorAlreadyLoaded,
|
ErrorAlreadyLoaded,
|
||||||
ErrorMemoryAllocationFailed,
|
ErrorMemoryAllocationFailed,
|
||||||
|
ErrorEncrypted,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline u32 MakeMagic(char a, char b, char c, char d) {
|
static inline u32 MakeMagic(char a, char b, char c, char d) {
|
||||||
|
|
|
@ -266,6 +266,11 @@ ResultStatus AppLoader_NCCH::Load() {
|
||||||
LOG_DEBUG(Loader, "Thread priority: 0x%X" , priority);
|
LOG_DEBUG(Loader, "Thread priority: 0x%X" , priority);
|
||||||
LOG_DEBUG(Loader, "Resource limit category: %d" , resource_limit_category);
|
LOG_DEBUG(Loader, "Resource limit category: %d" , resource_limit_category);
|
||||||
|
|
||||||
|
if (exheader_header.arm11_system_local_caps.program_id != ncch_header.program_id) {
|
||||||
|
LOG_ERROR(Loader, "ExHeader Program ID mismatch: the ROM is probably encrypted.");
|
||||||
|
return ResultStatus::ErrorEncrypted;
|
||||||
|
}
|
||||||
|
|
||||||
// Read ExeFS...
|
// Read ExeFS...
|
||||||
|
|
||||||
exefs_offset = ncch_header.exefs_offset * kBlockSize;
|
exefs_offset = ncch_header.exefs_offset * kBlockSize;
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct NCCH_Header {
|
||||||
u16 maker_code;
|
u16 maker_code;
|
||||||
u16 version;
|
u16 version;
|
||||||
u8 reserved_0[4];
|
u8 reserved_0[4];
|
||||||
u8 program_id[8];
|
u64_le program_id;
|
||||||
u8 reserved_1[0x10];
|
u8 reserved_1[0x10];
|
||||||
u8 logo_region_hash[0x20];
|
u8 logo_region_hash[0x20];
|
||||||
u8 product_code[0x10];
|
u8 product_code[0x10];
|
||||||
|
@ -109,7 +109,7 @@ struct ExHeader_StorageInfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExHeader_ARM11_SystemLocalCaps {
|
struct ExHeader_ARM11_SystemLocalCaps {
|
||||||
u8 program_id[8];
|
u64_le program_id;
|
||||||
u32 core_version;
|
u32 core_version;
|
||||||
u8 reserved_flags[2];
|
u8 reserved_flags[2];
|
||||||
union {
|
union {
|
||||||
|
|
Loading…
Reference in a new issue