Loader: Never forget to change is_loaded.
This commit is contained in:
parent
43e699d849
commit
85030c6e6b
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
private:
|
||||
std::string filename;
|
||||
bool is_loaded;
|
||||
bool is_loaded = false;
|
||||
};
|
||||
|
||||
} // namespace Loader
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
private:
|
||||
std::string filename;
|
||||
bool is_loaded;
|
||||
bool is_loaded = false;
|
||||
};
|
||||
|
||||
} // namespace Loader
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -215,7 +215,7 @@ private:
|
|||
|
||||
std::string filename;
|
||||
|
||||
bool is_loaded;
|
||||
bool is_loaded = false;
|
||||
bool is_compressed;
|
||||
|
||||
u32 entry_point;
|
||||
|
|
Loading…
Reference in New Issue