summaryrefslogtreecommitdiffstats
path: root/src/core/loader/elf.cpp
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2015-01-06 22:30:40 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2015-01-15 22:21:26 +0100
commitb5237e885df72f6c37532fc8af9573966e7b07e5 (patch)
treefdfd4da299cc2779f35fcc30e770b85b9e710166 /src/core/loader/elf.cpp
parentLoader: Initialize the default NCCH values in the class declaration, not in the constructor. (diff)
downloadyuzu-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.cpp30
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;