summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <ericbunnie@gmail.com>2014-06-19 23:46:05 +0200
committerbunnei <ericbunnie@gmail.com>2014-06-25 01:30:06 +0200
commit62b444cd17c17e6f8009d87609b620bcb51b43bd (patch)
treec99a07441b97232f8f90f9ec06a0291a1ce5c396
parentNCCH: Added RomFS loading. (diff)
downloadyuzu-62b444cd17c17e6f8009d87609b620bcb51b43bd.tar
yuzu-62b444cd17c17e6f8009d87609b620bcb51b43bd.tar.gz
yuzu-62b444cd17c17e6f8009d87609b620bcb51b43bd.tar.bz2
yuzu-62b444cd17c17e6f8009d87609b620bcb51b43bd.tar.lz
yuzu-62b444cd17c17e6f8009d87609b620bcb51b43bd.tar.xz
yuzu-62b444cd17c17e6f8009d87609b620bcb51b43bd.tar.zst
yuzu-62b444cd17c17e6f8009d87609b620bcb51b43bd.zip
-rw-r--r--src/core/loader/elf.cpp4
-rw-r--r--src/core/loader/elf.h4
-rw-r--r--src/core/loader/loader.cpp4
-rw-r--r--src/core/loader/loader.h6
-rw-r--r--src/core/loader/ncch.cpp10
-rw-r--r--src/core/loader/ncch.h11
6 files changed, 19 insertions, 20 deletions
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index 065601546..d9e5e130f 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -342,7 +342,7 @@ bool ElfReader::LoadSymbols() {
namespace Loader {
/// AppLoader_ELF constructor
-AppLoader_ELF::AppLoader_ELF(std::string& filename) : is_loaded(false) {
+AppLoader_ELF::AppLoader_ELF(const std::string& filename) : is_loaded(false) {
this->filename = filename;
}
@@ -356,7 +356,7 @@ AppLoader_ELF::~AppLoader_ELF() {
* @todo Move NCSD parsing out of here and create a separate function for loading these
* @return True on success, otherwise false
*/
-const ResultStatus AppLoader_ELF::Load() {
+ResultStatus AppLoader_ELF::Load() {
INFO_LOG(LOADER, "Loading ELF file %s...", filename.c_str());
if (is_loaded)
diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h
index 3fb010113..d3cbf414d 100644
--- a/src/core/loader/elf.h
+++ b/src/core/loader/elf.h
@@ -15,14 +15,14 @@ namespace Loader {
/// Loads an ELF/AXF file
class AppLoader_ELF : public AppLoader {
public:
- AppLoader_ELF(std::string& filename);
+ AppLoader_ELF(const std::string& filename);
~AppLoader_ELF();
/**
* Load the bootable file
* @return ResultStatus result of function
*/
- const ResultStatus Load();
+ ResultStatus Load();
private:
std::string filename;
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index dd0863ff3..96cb81de0 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -18,7 +18,7 @@ namespace Loader {
* @todo (ShizZy) this function sucks... make it actually check file contents etc.
* @return FileType of file
*/
-const FileType IdentifyFile(const std::string &filename) {
+FileType IdentifyFile(const std::string &filename) {
if (filename.size() == 0) {
ERROR_LOG(LOADER, "invalid filename %s", filename.c_str());
return FileType::Error;
@@ -45,7 +45,7 @@ const FileType IdentifyFile(const std::string &filename) {
* @param filename String filename of bootable file
* @return ResultStatus result of function
*/
-const ResultStatus LoadFile(std::string& filename) {
+ResultStatus LoadFile(const std::string& filename) {
INFO_LOG(LOADER, "Loading file %s...", filename.c_str());
switch (IdentifyFile(filename)) {
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 38b3d4c99..002af1f60 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -44,7 +44,7 @@ public:
* Load the application
* @return ResultStatus result of function
*/
- virtual const ResultStatus Load() = 0;
+ virtual ResultStatus Load() = 0;
/**
* Get the code (typically .code section) of the application
@@ -109,13 +109,13 @@ protected:
* @param filename String filename of bootable file
* @return FileType of file
*/
-const FileType IdentifyFile(const std::string &filename);
+FileType IdentifyFile(const std::string &filename);
/**
* Identifies and loads a bootable file
* @param filename String filename of bootable file
* @return ResultStatus result of function
*/
-const ResultStatus LoadFile(std::string& filename);
+ResultStatus LoadFile(const std::string& filename);
} // namespace
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index 6423da8f9..a4922c2c0 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -102,7 +102,7 @@ bool LZSS_Decompress(u8* compressed, u32 compressed_size, u8* decompressed, u32
// AppLoader_NCCH class
/// AppLoader_NCCH constructor
-AppLoader_NCCH::AppLoader_NCCH(std::string& filename) {
+AppLoader_NCCH::AppLoader_NCCH(const std::string& filename) {
this->filename = filename;
is_loaded = false;
is_compressed = false;
@@ -119,7 +119,7 @@ AppLoader_NCCH::~AppLoader_NCCH() {
* Loads .code section into memory for booting
* @return ResultStatus result of function
*/
-const ResultStatus AppLoader_NCCH::LoadExec() const {
+ResultStatus AppLoader_NCCH::LoadExec() const {
if (!is_loaded)
return ResultStatus::ErrorNotLoaded;
@@ -137,7 +137,7 @@ const ResultStatus AppLoader_NCCH::LoadExec() const {
* @param name Name of section to read out of NCCH file
* @param buffer Buffer to read section into.
*/
-const ResultStatus AppLoader_NCCH::LoadSectionExeFS(File::IOFile& file, const char* name,
+ResultStatus AppLoader_NCCH::LoadSectionExeFS(File::IOFile& file, const char* name,
std::vector<u8>& buffer) {
// Iterate through the ExeFs archive until we find the .code file...
@@ -183,7 +183,7 @@ const ResultStatus AppLoader_NCCH::LoadSectionExeFS(File::IOFile& file, const ch
* @param file Handle to file to read from
* @return ResultStatus result of function
*/
-const ResultStatus AppLoader_NCCH::LoadRomFS(File::IOFile& file) {
+ResultStatus AppLoader_NCCH::LoadRomFS(File::IOFile& file) {
// Check if the NCCH has a RomFS...
if (ncch_header.romfs_offset != 0 && ncch_header.romfs_size != 0) {
u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000;
@@ -210,7 +210,7 @@ const ResultStatus AppLoader_NCCH::LoadRomFS(File::IOFile& file) {
* @todo Move NCSD parsing out of here and create a separate function for loading these
* @return True on success, otherwise false
*/
-const ResultStatus AppLoader_NCCH::Load() {
+ResultStatus AppLoader_NCCH::Load() {
INFO_LOG(LOADER, "Loading NCCH file %s...", filename.c_str());
if (is_loaded)
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index 939b144a6..126eb4c80 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -147,14 +147,14 @@ namespace Loader {
/// Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI)
class AppLoader_NCCH : public AppLoader {
public:
- AppLoader_NCCH(std::string& filename);
+ AppLoader_NCCH(const std::string& filename);
~AppLoader_NCCH();
/**
* Load the application
* @return ResultStatus result of function
*/
- const ResultStatus Load();
+ ResultStatus Load();
private:
@@ -165,21 +165,20 @@ private:
* @param buffer Buffer to read section into.
* @return ResultStatus result of function
*/
- const ResultStatus LoadSectionExeFS(File::IOFile& file, const char* name,
- std::vector<u8>& buffer);
+ ResultStatus LoadSectionExeFS(File::IOFile& file, const char* name, std::vector<u8>& buffer);
/**
* Reads RomFS of an NCCH file into AppLoader
* @param file Handle to file to read from
* @return ResultStatus result of function
*/
- const ResultStatus LoadRomFS(File::IOFile& file);
+ ResultStatus LoadRomFS(File::IOFile& file);
/**
* Loads .code section into memory for booting
* @return ResultStatus result of function
*/
- const ResultStatus LoadExec() const;
+ ResultStatus LoadExec() const;
std::string filename;
bool is_loaded;