diff options
author | bunnei <bunneidev@gmail.com> | 2017-08-04 02:27:13 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2017-09-30 20:28:53 +0200 |
commit | 1c4f9e822c3885afaee53714bd28d620d4f4851d (patch) | |
tree | 8ffb0f7aa0123b48f84937aaf84e3de7e88eeda1 /src | |
parent | Merge pull request #2844 from jroweboy/nightlyfix (diff) | |
download | yuzu-1c4f9e822c3885afaee53714bd28d620d4f4851d.tar yuzu-1c4f9e822c3885afaee53714bd28d620d4f4851d.tar.gz yuzu-1c4f9e822c3885afaee53714bd28d620d4f4851d.tar.bz2 yuzu-1c4f9e822c3885afaee53714bd28d620d4f4851d.tar.lz yuzu-1c4f9e822c3885afaee53714bd28d620d4f4851d.tar.xz yuzu-1c4f9e822c3885afaee53714bd28d620d4f4851d.tar.zst yuzu-1c4f9e822c3885afaee53714bd28d620d4f4851d.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/loader/elf.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index cfcde9167..055bc39de 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp @@ -364,12 +364,19 @@ SectionID ElfReader::GetSectionByName(const char* name, int firstSection) const namespace Loader { FileType AppLoader_ELF::IdentifyType(FileUtil::IOFile& file) { - u32 magic; + static constexpr u16 ELF_MACHINE_ARM{0x28}; + + u32 magic = 0; file.Seek(0, SEEK_SET); if (1 != file.ReadArray<u32>(&magic, 1)) return FileType::Error; - if (MakeMagic('\x7f', 'E', 'L', 'F') == magic) + u16 machine = 0; + file.Seek(18, SEEK_SET); + if (1 != file.ReadArray<u16>(&machine, 1)) + return FileType::Error; + + if (MakeMagic('\x7f', 'E', 'L', 'F') == magic && ELF_MACHINE_ARM == machine) return FileType::ELF; return FileType::Error; |