diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2015-01-07 00:10:13 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2015-01-15 22:23:08 +0100 |
commit | 82ec17db7df53ed1c376d1cdaa9a6587719a546d (patch) | |
tree | 3c2236849146037fbba2fb75ea8a50f53b847a17 /src/core/loader/elf.cpp | |
parent | Loader: Don’t assume the file hasn’t been read before. (diff) | |
download | yuzu-82ec17db7df53ed1c376d1cdaa9a6587719a546d.tar yuzu-82ec17db7df53ed1c376d1cdaa9a6587719a546d.tar.gz yuzu-82ec17db7df53ed1c376d1cdaa9a6587719a546d.tar.bz2 yuzu-82ec17db7df53ed1c376d1cdaa9a6587719a546d.tar.lz yuzu-82ec17db7df53ed1c376d1cdaa9a6587719a546d.tar.xz yuzu-82ec17db7df53ed1c376d1cdaa9a6587719a546d.tar.zst yuzu-82ec17db7df53ed1c376d1cdaa9a6587719a546d.zip |
Diffstat (limited to 'src/core/loader/elf.cpp')
-rw-r--r-- | src/core/loader/elf.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 712d564d1..d1c3aea72 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp @@ -330,6 +330,18 @@ bool ElfReader::LoadSymbols() { namespace Loader { +FileType AppLoader_ELF::IdentifyType(FileUtil::IOFile& file) { + u32 magic; + file.Seek(0, SEEK_SET); + if (1 != file.ReadArray<u32>(&magic, 1)) + return FileType::Error; + + if (MakeMagic('\x7f', 'E', 'L', 'F') == magic) + return FileType::ELF; + + return FileType::Error; +} + ResultStatus AppLoader_ELF::Load() { if (is_loaded) return ResultStatus::ErrorAlreadyLoaded; |