summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2015-01-06 20:49:25 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2015-01-15 22:21:26 +0100
commit85030c6e6bfe83b6671de45b25535fe3ef713319 (patch)
tree03a9735f1c306c4679359b64b29013a9d350bfde
parentLoader: Don’t duplicate the docstring into the cpp file. (diff)
downloadyuzu-85030c6e6bfe83b6671de45b25535fe3ef713319.tar
yuzu-85030c6e6bfe83b6671de45b25535fe3ef713319.tar.gz
yuzu-85030c6e6bfe83b6671de45b25535fe3ef713319.tar.bz2
yuzu-85030c6e6bfe83b6671de45b25535fe3ef713319.tar.lz
yuzu-85030c6e6bfe83b6671de45b25535fe3ef713319.tar.xz
yuzu-85030c6e6bfe83b6671de45b25535fe3ef713319.tar.zst
yuzu-85030c6e6bfe83b6671de45b25535fe3ef713319.zip
-rw-r--r--src/core/loader/3dsx.cpp7
-rw-r--r--src/core/loader/3dsx.h2
-rw-r--r--src/core/loader/elf.cpp4
-rw-r--r--src/core/loader/elf.h2
-rw-r--r--src/core/loader/ncch.cpp5
-rw-r--r--src/core/loader/ncch.h2
6 files changed, 15 insertions, 7 deletions
diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp
index 06827668f..15032e0ae 100644
--- a/src/core/loader/3dsx.cpp
+++ b/src/core/loader/3dsx.cpp
@@ -215,13 +215,20 @@ AppLoader_THREEDSX::~AppLoader_THREEDSX() {
ResultStatus AppLoader_THREEDSX::Load() {
LOG_INFO(Loader, "Loading 3DSX file %s...", filename.c_str());
+
+ if (is_loaded)
+ return ResultStatus::ErrorAlreadyLoaded;
+
FileUtil::IOFile file(filename, "rb");
+
if (file.IsOpen()) {
THREEDSXReader::Load3DSXFile(filename, 0x00100000);
Kernel::LoadExec(0x00100000);
} else {
return ResultStatus::Error;
}
+
+ is_loaded = true;
return ResultStatus::Success;
}
diff --git a/src/core/loader/3dsx.h b/src/core/loader/3dsx.h
index da8836662..f28224628 100644
--- a/src/core/loader/3dsx.h
+++ b/src/core/loader/3dsx.h
@@ -26,7 +26,7 @@ public:
private:
std::string filename;
- bool is_loaded;
+ bool is_loaded = false;
};
} // namespace Loader
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index 89664229a..ee711d8b2 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -331,7 +331,7 @@ bool ElfReader::LoadSymbols() {
namespace Loader {
/// AppLoader_ELF constructor
-AppLoader_ELF::AppLoader_ELF(const std::string& filename) : is_loaded(false) {
+AppLoader_ELF::AppLoader_ELF(const std::string& filename) {
this->filename = filename;
}
@@ -358,6 +358,8 @@ ResultStatus AppLoader_ELF::Load() {
} else {
return ResultStatus::Error;
}
+
+ is_loaded = true;
return ResultStatus::Success;
}
diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h
index c221cce6d..856722f1e 100644
--- a/src/core/loader/elf.h
+++ b/src/core/loader/elf.h
@@ -26,7 +26,7 @@ public:
private:
std::string filename;
- bool is_loaded;
+ bool is_loaded = false;
};
} // namespace Loader
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index f1d01252e..0793cc7cd 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -102,7 +102,6 @@ static bool LZSS_Decompress(u8* compressed, u32 compressed_size, u8* decompresse
/// AppLoader_NCCH constructor
AppLoader_NCCH::AppLoader_NCCH(const std::string& filename) {
this->filename = filename;
- is_loaded = false;
is_compressed = false;
entry_point = 0;
ncch_offset = 0;
@@ -221,10 +220,10 @@ ResultStatus AppLoader_NCCH::Load() {
file.Seek(exefs_offset + ncch_offset, 0);
file.ReadBytes(&exefs_header, sizeof(ExeFs_Header));
- is_loaded = true; // Set state to loaded
-
LoadExec(); // Load the executable into memory for booting
+ is_loaded = true; // Set state to loaded
+
return ResultStatus::Success;
} else {
LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str());
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index fd9258970..184a20d98 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -215,7 +215,7 @@ private:
std::string filename;
- bool is_loaded;
+ bool is_loaded = false;
bool is_compressed;
u32 entry_point;