diff options
| author | 2015-01-20 12:55:28 -0500 | |
|---|---|---|
| committer | 2015-01-20 12:55:28 -0500 | |
| commit | 205170fa623efdd5eafb0c957d728babe4836f45 (patch) | |
| tree | 26dd9e4c7ae9cc7a3bb09f42c942c4e47c9cc06f /src/core/loader/loader.h | |
| parent | Merge pull request #496 from lioncash/warn (diff) | |
| parent | Loader: Clean up the ELF AppLoader. (diff) | |
| download | yuzu-205170fa623efdd5eafb0c957d728babe4836f45.tar.gz yuzu-205170fa623efdd5eafb0c957d728babe4836f45.tar.xz yuzu-205170fa623efdd5eafb0c957d728babe4836f45.zip | |
Merge pull request #241 from linkmauve/better-loader
Improve the loader a bit
Diffstat (limited to 'src/core/loader/loader.h')
| -rw-r--r-- | src/core/loader/loader.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index ec5534d41..7456b019b 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <vector> | 7 | #include <vector> |
| 8 | 8 | ||
| 9 | #include "common/common.h" | 9 | #include "common/common.h" |
| 10 | #include "common/file_util.h" | ||
| 10 | 11 | ||
| 11 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 12 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 12 | // Loader namespace | 13 | // Loader namespace |
| @@ -37,10 +38,14 @@ enum class ResultStatus { | |||
| 37 | ErrorMemoryAllocationFailed, | 38 | ErrorMemoryAllocationFailed, |
| 38 | }; | 39 | }; |
| 39 | 40 | ||
| 41 | static u32 MakeMagic(char a, char b, char c, char d) { | ||
| 42 | return a | b << 8 | c << 16 | d << 24; | ||
| 43 | } | ||
| 44 | |||
| 40 | /// Interface for loading an application | 45 | /// Interface for loading an application |
| 41 | class AppLoader : NonCopyable { | 46 | class AppLoader : NonCopyable { |
| 42 | public: | 47 | public: |
| 43 | AppLoader() { } | 48 | AppLoader(std::unique_ptr<FileUtil::IOFile>&& file) : file(std::move(file)) { } |
| 44 | virtual ~AppLoader() { } | 49 | virtual ~AppLoader() { } |
| 45 | 50 | ||
| 46 | /** | 51 | /** |
| @@ -93,14 +98,11 @@ public: | |||
| 93 | virtual ResultStatus ReadRomFS(std::vector<u8>& buffer) const { | 98 | virtual ResultStatus ReadRomFS(std::vector<u8>& buffer) const { |
| 94 | return ResultStatus::ErrorNotImplemented; | 99 | return ResultStatus::ErrorNotImplemented; |
| 95 | } | 100 | } |
| 96 | }; | ||
| 97 | 101 | ||
| 98 | /** | 102 | protected: |
| 99 | * Identifies the type of a bootable file | 103 | std::unique_ptr<FileUtil::IOFile> file; |
| 100 | * @param filename String filename of bootable file | 104 | bool is_loaded = false; |
| 101 | * @return FileType of file | 105 | }; |
| 102 | */ | ||
| 103 | FileType IdentifyFile(const std::string &filename); | ||
| 104 | 106 | ||
| 105 | /** | 107 | /** |
| 106 | * Identifies and loads a bootable file | 108 | * Identifies and loads a bootable file |