summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-06-09 22:11:30 +0200
committerCharles Lombardo <clombardo169@gmail.com>2023-06-10 02:17:51 +0200
commit72d9dc9a3f63b314cea7b166b6f81000e20a14c3 (patch)
tree476bf4480df3a9f650dfe939356d51f12a7e6203 /src/core/loader
parentMerge pull request #10614 from xcfrg/shader-backend-status-bar (diff)
downloadyuzu-72d9dc9a3f63b314cea7b166b6f81000e20a14c3.tar
yuzu-72d9dc9a3f63b314cea7b166b6f81000e20a14c3.tar.gz
yuzu-72d9dc9a3f63b314cea7b166b6f81000e20a14c3.tar.bz2
yuzu-72d9dc9a3f63b314cea7b166b6f81000e20a14c3.tar.lz
yuzu-72d9dc9a3f63b314cea7b166b6f81000e20a14c3.tar.xz
yuzu-72d9dc9a3f63b314cea7b166b6f81000e20a14c3.tar.zst
yuzu-72d9dc9a3f63b314cea7b166b6f81000e20a14c3.zip
Diffstat (limited to 'src/core/loader')
-rw-r--r--src/core/loader/nro.cpp13
-rw-r--r--src/core/loader/nro.h2
2 files changed, 14 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);
}
diff --git a/src/core/loader/nro.h b/src/core/loader/nro.h
index ccb77b581..8de6eebc6 100644
--- a/src/core/loader/nro.h
+++ b/src/core/loader/nro.h
@@ -38,6 +38,8 @@ public:
*/
static FileType IdentifyType(const FileSys::VirtualFile& nro_file);
+ bool IsHomebrew();
+
FileType GetFileType() const override {
return IdentifyType(file);
}