summaryrefslogtreecommitdiff
path: root/src/core/loader/xci.cpp
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-07-27 23:55:23 -0400
committerGravatar Zach Hilman2018-08-01 00:16:54 -0400
commitdf5b75694f5abde94ccf05fa6c7a557b1ba9079b (patch)
tree70f0cf96b1a9834360fb1c5d5547939693ecd577 /src/core/loader/xci.cpp
parentMerge pull request #871 from bunnei/audio-config (diff)
downloadyuzu-df5b75694f5abde94ccf05fa6c7a557b1ba9079b.tar.gz
yuzu-df5b75694f5abde94ccf05fa6c7a557b1ba9079b.tar.xz
yuzu-df5b75694f5abde94ccf05fa6c7a557b1ba9079b.zip
Remove files that are not used
Diffstat (limited to 'src/core/loader/xci.cpp')
-rw-r--r--src/core/loader/xci.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
new file mode 100644
index 000000000..9759e33d1
--- /dev/null
+++ b/src/core/loader/xci.cpp
@@ -0,0 +1,67 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <vector>
6
7#include "common/file_util.h"
8#include "common/logging/log.h"
9#include "common/string_util.h"
10#include "common/swap.h"
11#include "core/core.h"
12#include "core/file_sys/content_archive.h"
13#include "core/file_sys/control_metadata.h"
14#include "core/file_sys/program_metadata.h"
15#include "core/file_sys/romfs.h"
16#include "core/gdbstub/gdbstub.h"
17#include "core/hle/kernel/process.h"
18#include "core/hle/kernel/resource_limit.h"
19#include "core/hle/service/filesystem/filesystem.h"
20#include "core/loader/nso.h"
21#include "core/loader/xci.h"
22#include "core/memory.h"
23
24namespace Loader {
25
26AppLoader_XCI::AppLoader_XCI(FileSys::VirtualFile file)
27 : AppLoader(file), xci(std::make_unique<FileSys::XCI>(file)),
28 nca_loader(std::make_unique<AppLoader_NCA>(
29 xci->GetNCAFileByType(FileSys::NCAContentType::Program))) {}
30
31FileType AppLoader_XCI::IdentifyType(const FileSys::VirtualFile& file) {
32 FileSys::XCI xci(file);
33
34 if (xci.GetStatus() == ResultStatus::Success &&
35 xci.GetNCAByType(FileSys::NCAContentType::Program) != nullptr &&
36 AppLoader_NCA::IdentifyType(xci.GetNCAFileByType(FileSys::NCAContentType::Program)) ==
37 FileType::NCA)
38 return FileType::XCI;
39
40 return FileType::Error;
41}
42
43ResultStatus AppLoader_XCI::Load(Kernel::SharedPtr<Kernel::Process>& process) {
44 if (is_loaded) {
45 return ResultStatus::ErrorAlreadyLoaded;
46 }
47
48 auto result = nca_loader->Load(process);
49 if (result != ResultStatus::Success)
50 return result;
51
52 is_loaded = true;
53
54 return ResultStatus::Success;
55}
56
57ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& dir) {
58 return nca_loader->ReadRomFS(dir);
59}
60
61ResultStatus AppLoader_XCI::ReadProgramId(u64& out_program_id) {
62 return nca_loader->ReadProgramId(out_program_id);
63}
64
65AppLoader_XCI::~AppLoader_XCI() = default;
66
67} // namespace Loader