mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-13 09:07:56 -05:00
Loader: Guess filetype from the magic, or fallback to the extension.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user