diff options
Diffstat (limited to 'src/core/loader/nro.cpp')
-rw-r--r-- | src/core/loader/nro.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 73d04d7ee..7be6cf5f3 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp @@ -33,7 +33,8 @@ static_assert(sizeof(NroSegmentHeader) == 0x8, "NroSegmentHeader has incorrect s struct NroHeader { INSERT_PADDING_BYTES(0x4); u32_le module_header_offset; - INSERT_PADDING_BYTES(0x8); + u32 magic_ext1; + u32 magic_ext2; u32_le magic; INSERT_PADDING_BYTES(0x4); u32_le file_size; @@ -124,6 +125,16 @@ FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& nro_file) { return FileType::Error; } +bool AppLoader_NRO::IsHomebrew() { + // Read NSO header + NroHeader nro_header{}; + if (sizeof(NroHeader) != file->ReadObject(&nro_header)) { + return false; + } + return nro_header.magic_ext1 == Common::MakeMagic('H', 'O', 'M', 'E') && + nro_header.magic_ext2 == Common::MakeMagic('B', 'R', 'E', 'W'); +} + static constexpr u32 PageAlignSize(u32 size) { return static_cast<u32>((size + Core::Memory::YUZU_PAGEMASK) & ~Core::Memory::YUZU_PAGEMASK); } |