summaryrefslogtreecommitdiff
path: root/src/core/loader/nro.h
diff options
context:
space:
mode:
authorGravatar bunnei2017-10-05 23:30:08 -0400
committerGravatar bunnei2017-10-05 23:30:08 -0400
commit33ea53094cc1f34c27ca295472f01f8dd09a300b (patch)
treec45a8eefd68222c390b28ab2dfba3d787c4634ac /src/core/loader/nro.h
parentnso: Fixes to support homebrew NSOs without a MOD header. (diff)
downloadyuzu-33ea53094cc1f34c27ca295472f01f8dd09a300b.tar.gz
yuzu-33ea53094cc1f34c27ca295472f01f8dd09a300b.tar.xz
yuzu-33ea53094cc1f34c27ca295472f01f8dd09a300b.zip
loader: Add support for NRO, as well as various fixes and shared linker.
Diffstat (limited to 'src/core/loader/nro.h')
-rw-r--r--src/core/loader/nro.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/core/loader/nro.h b/src/core/loader/nro.h
new file mode 100644
index 000000000..d145b68d5
--- /dev/null
+++ b/src/core/loader/nro.h
@@ -0,0 +1,45 @@
1// Copyright 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <map>
8#include <string>
9#include "common/common_types.h"
10#include "common/file_util.h"
11#include "core/hle/kernel/kernel.h"
12#include "core/loader/linker.h"
13#include "core/loader/loader.h"
14
15namespace Loader {
16
17/// Loads an NRO file
18class AppLoader_NRO final : public AppLoader, Linker {
19public:
20 AppLoader_NRO(FileUtil::IOFile&& file, std::string filename, std::string filepath)
21 : AppLoader(std::move(file)), filename(std::move(filename)), filepath(std::move(filepath)) {
22 }
23
24 /**
25 * Returns the type of the file
26 * @param file FileUtil::IOFile open file
27 * @return FileType found, or FileType::Error if this loader doesn't know it
28 */
29 static FileType IdentifyType(FileUtil::IOFile& file);
30
31 FileType GetFileType() override {
32 return IdentifyType(file);
33 }
34
35 ResultStatus Load() override;
36
37private:
38 VAddr GetEntryPoint(VAddr load_base) const;
39 bool LoadNro(const std::string& path, VAddr load_base);
40
41 std::string filename;
42 std::string filepath;
43};
44
45} // namespace Loader