diff options
Diffstat (limited to 'src/core/loader')
| -rw-r--r-- | src/core/loader/elf.cpp | 4 | ||||
| -rw-r--r-- | src/core/loader/elf.h | 4 | ||||
| -rw-r--r-- | src/core/loader/loader.cpp | 4 | ||||
| -rw-r--r-- | src/core/loader/loader.h | 6 | ||||
| -rw-r--r-- | src/core/loader/ncch.cpp | 10 | ||||
| -rw-r--r-- | src/core/loader/ncch.h | 11 |
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() { | |||
| 342 | namespace Loader { | 342 | namespace Loader { |
| 343 | 343 | ||
| 344 | /// AppLoader_ELF constructor | 344 | /// AppLoader_ELF constructor |
| 345 | AppLoader_ELF::AppLoader_ELF(std::string& filename) : is_loaded(false) { | 345 | AppLoader_ELF::AppLoader_ELF(const std::string& filename) : is_loaded(false) { |
| 346 | this->filename = filename; | 346 | this->filename = filename; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| @@ -356,7 +356,7 @@ AppLoader_ELF::~AppLoader_ELF() { | |||
| 356 | * @todo Move NCSD parsing out of here and create a separate function for loading these | 356 | * @todo Move NCSD parsing out of here and create a separate function for loading these |
| 357 | * @return True on success, otherwise false | 357 | * @return True on success, otherwise false |
| 358 | */ | 358 | */ |
| 359 | const ResultStatus AppLoader_ELF::Load() { | 359 | ResultStatus AppLoader_ELF::Load() { |
| 360 | INFO_LOG(LOADER, "Loading ELF file %s...", filename.c_str()); | 360 | INFO_LOG(LOADER, "Loading ELF file %s...", filename.c_str()); |
| 361 | 361 | ||
| 362 | if (is_loaded) | 362 | 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 { | |||
| 15 | /// Loads an ELF/AXF file | 15 | /// Loads an ELF/AXF file |
| 16 | class AppLoader_ELF : public AppLoader { | 16 | class AppLoader_ELF : public AppLoader { |
| 17 | public: | 17 | public: |
| 18 | AppLoader_ELF(std::string& filename); | 18 | AppLoader_ELF(const std::string& filename); |
| 19 | ~AppLoader_ELF(); | 19 | ~AppLoader_ELF(); |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| 22 | * Load the bootable file | 22 | * Load the bootable file |
| 23 | * @return ResultStatus result of function | 23 | * @return ResultStatus result of function |
| 24 | */ | 24 | */ |
| 25 | const ResultStatus Load(); | 25 | ResultStatus Load(); |
| 26 | 26 | ||
| 27 | private: | 27 | private: |
| 28 | std::string filename; | 28 | 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 { | |||
| 18 | * @todo (ShizZy) this function sucks... make it actually check file contents etc. | 18 | * @todo (ShizZy) this function sucks... make it actually check file contents etc. |
| 19 | * @return FileType of file | 19 | * @return FileType of file |
| 20 | */ | 20 | */ |
| 21 | const FileType IdentifyFile(const std::string &filename) { | 21 | FileType IdentifyFile(const std::string &filename) { |
| 22 | if (filename.size() == 0) { | 22 | if (filename.size() == 0) { |
| 23 | ERROR_LOG(LOADER, "invalid filename %s", filename.c_str()); | 23 | ERROR_LOG(LOADER, "invalid filename %s", filename.c_str()); |
| 24 | return FileType::Error; | 24 | return FileType::Error; |
| @@ -45,7 +45,7 @@ const FileType IdentifyFile(const std::string &filename) { | |||
| 45 | * @param filename String filename of bootable file | 45 | * @param filename String filename of bootable file |
| 46 | * @return ResultStatus result of function | 46 | * @return ResultStatus result of function |
| 47 | */ | 47 | */ |
| 48 | const ResultStatus LoadFile(std::string& filename) { | 48 | ResultStatus LoadFile(const std::string& filename) { |
| 49 | INFO_LOG(LOADER, "Loading file %s...", filename.c_str()); | 49 | INFO_LOG(LOADER, "Loading file %s...", filename.c_str()); |
| 50 | 50 | ||
| 51 | switch (IdentifyFile(filename)) { | 51 | 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: | |||
| 44 | * Load the application | 44 | * Load the application |
| 45 | * @return ResultStatus result of function | 45 | * @return ResultStatus result of function |
| 46 | */ | 46 | */ |
| 47 | virtual const ResultStatus Load() = 0; | 47 | virtual ResultStatus Load() = 0; |
| 48 | 48 | ||
| 49 | /** | 49 | /** |
| 50 | * Get the code (typically .code section) of the application | 50 | * Get the code (typically .code section) of the application |
| @@ -109,13 +109,13 @@ protected: | |||
| 109 | * @param filename String filename of bootable file | 109 | * @param filename String filename of bootable file |
| 110 | * @return FileType of file | 110 | * @return FileType of file |
| 111 | */ | 111 | */ |
| 112 | const FileType IdentifyFile(const std::string &filename); | 112 | FileType IdentifyFile(const std::string &filename); |
| 113 | 113 | ||
| 114 | /** | 114 | /** |
| 115 | * Identifies and loads a bootable file | 115 | * Identifies and loads a bootable file |
| 116 | * @param filename String filename of bootable file | 116 | * @param filename String filename of bootable file |
| 117 | * @return ResultStatus result of function | 117 | * @return ResultStatus result of function |
| 118 | */ | 118 | */ |
| 119 | const ResultStatus LoadFile(std::string& filename); | 119 | ResultStatus LoadFile(const std::string& filename); |
| 120 | 120 | ||
| 121 | } // namespace | 121 | } // 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 | |||
| 102 | // AppLoader_NCCH class | 102 | // AppLoader_NCCH class |
| 103 | 103 | ||
| 104 | /// AppLoader_NCCH constructor | 104 | /// AppLoader_NCCH constructor |
| 105 | AppLoader_NCCH::AppLoader_NCCH(std::string& filename) { | 105 | AppLoader_NCCH::AppLoader_NCCH(const std::string& filename) { |
| 106 | this->filename = filename; | 106 | this->filename = filename; |
| 107 | is_loaded = false; | 107 | is_loaded = false; |
| 108 | is_compressed = false; | 108 | is_compressed = false; |
| @@ -119,7 +119,7 @@ AppLoader_NCCH::~AppLoader_NCCH() { | |||
| 119 | * Loads .code section into memory for booting | 119 | * Loads .code section into memory for booting |
| 120 | * @return ResultStatus result of function | 120 | * @return ResultStatus result of function |
| 121 | */ | 121 | */ |
| 122 | const ResultStatus AppLoader_NCCH::LoadExec() const { | 122 | ResultStatus AppLoader_NCCH::LoadExec() const { |
| 123 | if (!is_loaded) | 123 | if (!is_loaded) |
| 124 | return ResultStatus::ErrorNotLoaded; | 124 | return ResultStatus::ErrorNotLoaded; |
| 125 | 125 | ||
| @@ -137,7 +137,7 @@ const ResultStatus AppLoader_NCCH::LoadExec() const { | |||
| 137 | * @param name Name of section to read out of NCCH file | 137 | * @param name Name of section to read out of NCCH file |
| 138 | * @param buffer Buffer to read section into. | 138 | * @param buffer Buffer to read section into. |
| 139 | */ | 139 | */ |
| 140 | const ResultStatus AppLoader_NCCH::LoadSectionExeFS(File::IOFile& file, const char* name, | 140 | ResultStatus AppLoader_NCCH::LoadSectionExeFS(File::IOFile& file, const char* name, |
| 141 | std::vector<u8>& buffer) { | 141 | std::vector<u8>& buffer) { |
| 142 | 142 | ||
| 143 | // Iterate through the ExeFs archive until we find the .code file... | 143 | // 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 | |||
| 183 | * @param file Handle to file to read from | 183 | * @param file Handle to file to read from |
| 184 | * @return ResultStatus result of function | 184 | * @return ResultStatus result of function |
| 185 | */ | 185 | */ |
| 186 | const ResultStatus AppLoader_NCCH::LoadRomFS(File::IOFile& file) { | 186 | ResultStatus AppLoader_NCCH::LoadRomFS(File::IOFile& file) { |
| 187 | // Check if the NCCH has a RomFS... | 187 | // Check if the NCCH has a RomFS... |
| 188 | if (ncch_header.romfs_offset != 0 && ncch_header.romfs_size != 0) { | 188 | if (ncch_header.romfs_offset != 0 && ncch_header.romfs_size != 0) { |
| 189 | u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000; | 189 | u32 romfs_offset = ncch_offset + (ncch_header.romfs_offset * kBlockSize) + 0x1000; |
| @@ -210,7 +210,7 @@ const ResultStatus AppLoader_NCCH::LoadRomFS(File::IOFile& file) { | |||
| 210 | * @todo Move NCSD parsing out of here and create a separate function for loading these | 210 | * @todo Move NCSD parsing out of here and create a separate function for loading these |
| 211 | * @return True on success, otherwise false | 211 | * @return True on success, otherwise false |
| 212 | */ | 212 | */ |
| 213 | const ResultStatus AppLoader_NCCH::Load() { | 213 | ResultStatus AppLoader_NCCH::Load() { |
| 214 | INFO_LOG(LOADER, "Loading NCCH file %s...", filename.c_str()); | 214 | INFO_LOG(LOADER, "Loading NCCH file %s...", filename.c_str()); |
| 215 | 215 | ||
| 216 | if (is_loaded) | 216 | 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 { | |||
| 147 | /// Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI) | 147 | /// Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI) |
| 148 | class AppLoader_NCCH : public AppLoader { | 148 | class AppLoader_NCCH : public AppLoader { |
| 149 | public: | 149 | public: |
| 150 | AppLoader_NCCH(std::string& filename); | 150 | AppLoader_NCCH(const std::string& filename); |
| 151 | ~AppLoader_NCCH(); | 151 | ~AppLoader_NCCH(); |
| 152 | 152 | ||
| 153 | /** | 153 | /** |
| 154 | * Load the application | 154 | * Load the application |
| 155 | * @return ResultStatus result of function | 155 | * @return ResultStatus result of function |
| 156 | */ | 156 | */ |
| 157 | const ResultStatus Load(); | 157 | ResultStatus Load(); |
| 158 | 158 | ||
| 159 | private: | 159 | private: |
| 160 | 160 | ||
| @@ -165,21 +165,20 @@ private: | |||
| 165 | * @param buffer Buffer to read section into. | 165 | * @param buffer Buffer to read section into. |
| 166 | * @return ResultStatus result of function | 166 | * @return ResultStatus result of function |
| 167 | */ | 167 | */ |
| 168 | const ResultStatus LoadSectionExeFS(File::IOFile& file, const char* name, | 168 | ResultStatus LoadSectionExeFS(File::IOFile& file, const char* name, std::vector<u8>& buffer); |
| 169 | std::vector<u8>& buffer); | ||
| 170 | 169 | ||
| 171 | /** | 170 | /** |
| 172 | * Reads RomFS of an NCCH file into AppLoader | 171 | * Reads RomFS of an NCCH file into AppLoader |
| 173 | * @param file Handle to file to read from | 172 | * @param file Handle to file to read from |
| 174 | * @return ResultStatus result of function | 173 | * @return ResultStatus result of function |
| 175 | */ | 174 | */ |
| 176 | const ResultStatus LoadRomFS(File::IOFile& file); | 175 | ResultStatus LoadRomFS(File::IOFile& file); |
| 177 | 176 | ||
| 178 | /** | 177 | /** |
| 179 | * Loads .code section into memory for booting | 178 | * Loads .code section into memory for booting |
| 180 | * @return ResultStatus result of function | 179 | * @return ResultStatus result of function |
| 181 | */ | 180 | */ |
| 182 | const ResultStatus LoadExec() const; | 181 | ResultStatus LoadExec() const; |
| 183 | 182 | ||
| 184 | std::string filename; | 183 | std::string filename; |
| 185 | bool is_loaded; | 184 | bool is_loaded; |