summaryrefslogtreecommitdiff
path: root/src/core/loader/loader.h
diff options
context:
space:
mode:
authorGravatar bunnei2015-01-20 12:55:28 -0500
committerGravatar bunnei2015-01-20 12:55:28 -0500
commit205170fa623efdd5eafb0c957d728babe4836f45 (patch)
tree26dd9e4c7ae9cc7a3bb09f42c942c4e47c9cc06f /src/core/loader/loader.h
parentMerge pull request #496 from lioncash/warn (diff)
parentLoader: Clean up the ELF AppLoader. (diff)
downloadyuzu-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.h18
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
41static 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
41class AppLoader : NonCopyable { 46class AppLoader : NonCopyable {
42public: 47public:
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/** 102protected:
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 */
103FileType IdentifyFile(const std::string &filename);
104 106
105/** 107/**
106 * Identifies and loads a bootable file 108 * Identifies and loads a bootable file