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() {
|
ResultStatus AppLoader_THREEDSX::Load() {
|
||||||
LOG_INFO(Loader, "Loading 3DSX file %s...", filename.c_str());
|
LOG_INFO(Loader, "Loading 3DSX file %s...", filename.c_str());
|
||||||
|
|
||||||
|
if (is_loaded)
|
||||||
|
return ResultStatus::ErrorAlreadyLoaded;
|
||||||
|
|
||||||
FileUtil::IOFile file(filename, "rb");
|
FileUtil::IOFile file(filename, "rb");
|
||||||
|
|
||||||
if (file.IsOpen()) {
|
if (file.IsOpen()) {
|
||||||
THREEDSXReader::Load3DSXFile(filename, 0x00100000);
|
THREEDSXReader::Load3DSXFile(filename, 0x00100000);
|
||||||
Kernel::LoadExec(0x00100000);
|
Kernel::LoadExec(0x00100000);
|
||||||
} else {
|
} else {
|
||||||
return ResultStatus::Error;
|
return ResultStatus::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_loaded = true;
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string filename;
|
std::string filename;
|
||||||
bool is_loaded;
|
bool is_loaded = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Loader
|
} // namespace Loader
|
||||||
|
|
|
@ -331,7 +331,7 @@ bool ElfReader::LoadSymbols() {
|
||||||
namespace Loader {
|
namespace Loader {
|
||||||
|
|
||||||
/// AppLoader_ELF constructor
|
/// 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;
|
this->filename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,6 +358,8 @@ ResultStatus AppLoader_ELF::Load() {
|
||||||
} else {
|
} else {
|
||||||
return ResultStatus::Error;
|
return ResultStatus::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_loaded = true;
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string filename;
|
std::string filename;
|
||||||
bool is_loaded;
|
bool is_loaded = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Loader
|
} // namespace Loader
|
||||||
|
|
|
@ -102,7 +102,6 @@ static bool LZSS_Decompress(u8* compressed, u32 compressed_size, u8* decompresse
|
||||||
/// AppLoader_NCCH constructor
|
/// AppLoader_NCCH constructor
|
||||||
AppLoader_NCCH::AppLoader_NCCH(const std::string& filename) {
|
AppLoader_NCCH::AppLoader_NCCH(const std::string& filename) {
|
||||||
this->filename = filename;
|
this->filename = filename;
|
||||||
is_loaded = false;
|
|
||||||
is_compressed = false;
|
is_compressed = false;
|
||||||
entry_point = 0;
|
entry_point = 0;
|
||||||
ncch_offset = 0;
|
ncch_offset = 0;
|
||||||
|
@ -221,10 +220,10 @@ ResultStatus AppLoader_NCCH::Load() {
|
||||||
file.Seek(exefs_offset + ncch_offset, 0);
|
file.Seek(exefs_offset + ncch_offset, 0);
|
||||||
file.ReadBytes(&exefs_header, sizeof(ExeFs_Header));
|
file.ReadBytes(&exefs_header, sizeof(ExeFs_Header));
|
||||||
|
|
||||||
is_loaded = true; // Set state to loaded
|
|
||||||
|
|
||||||
LoadExec(); // Load the executable into memory for booting
|
LoadExec(); // Load the executable into memory for booting
|
||||||
|
|
||||||
|
is_loaded = true; // Set state to loaded
|
||||||
|
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str());
|
LOG_ERROR(Loader, "Unable to read file %s!", filename.c_str());
|
||||||
|
|
|
@ -215,7 +215,7 @@ private:
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
|
|
||||||
bool is_loaded;
|
bool is_loaded = false;
|
||||||
bool is_compressed;
|
bool is_compressed;
|
||||||
|
|
||||||
u32 entry_point;
|
u32 entry_point;
|
||||||
|
|
Loading…
Reference in New Issue