diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2015-01-06 22:30:40 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2015-01-15 22:21:26 +0100 |
commit | b5237e885df72f6c37532fc8af9573966e7b07e5 (patch) | |
tree | fdfd4da299cc2779f35fcc30e770b85b9e710166 /src/core/loader/elf.cpp | |
parent | Loader: Initialize the default NCCH values in the class declaration, not in the constructor. (diff) | |
download | yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.tar yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.tar.gz yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.tar.bz2 yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.tar.lz yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.tar.xz yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.tar.zst yuzu-b5237e885df72f6c37532fc8af9573966e7b07e5.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/loader/elf.cpp | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index ee711d8b2..d1a1ef595 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp @@ -330,34 +330,20 @@ bool ElfReader::LoadSymbols() { namespace Loader { -/// AppLoader_ELF constructor -AppLoader_ELF::AppLoader_ELF(const std::string& filename) { - this->filename = filename; -} - -/// AppLoader_NCCH destructor -AppLoader_ELF::~AppLoader_ELF() { -} - ResultStatus AppLoader_ELF::Load() { - LOG_INFO(Loader, "Loading ELF file %s...", filename.c_str()); - if (is_loaded) return ResultStatus::ErrorAlreadyLoaded; - FileUtil::IOFile file(filename, "rb"); + if (!file->IsOpen()) + return ResultStatus::Error; - if (file.IsOpen()) { - u32 size = (u32)file.GetSize(); - std::unique_ptr<u8[]> buffer(new u8[size]); - file.ReadBytes(&buffer[0], size); + u32 size = static_cast<u32>(file->GetSize()); + std::unique_ptr<u8[]> buffer(new u8[size]); + file->ReadBytes(&buffer[0], size); - ElfReader elf_reader(&buffer[0]); - elf_reader.LoadInto(0x00100000); - Kernel::LoadExec(elf_reader.GetEntryPoint()); - } else { - return ResultStatus::Error; - } + ElfReader elf_reader(&buffer[0]); + elf_reader.LoadInto(0x00100000); + Kernel::LoadExec(elf_reader.GetEntryPoint()); is_loaded = true; return ResultStatus::Success; |