forked from eden-emu/eden
Loader: Guess filetype from the magic, or fallback to the extension.
This commit is contained in:
parent
04622a859c
commit
82ec17db7d
8 changed files with 113 additions and 27 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue