summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/file_sys/system_archive/system_archive.cpp91
-rw-r--r--src/core/file_sys/system_archive/system_archive.h14
3 files changed, 109 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 64fdf38cd..2d61e2f2c 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -61,6 +61,10 @@ add_library(core STATIC
61 file_sys/sdmc_factory.h 61 file_sys/sdmc_factory.h
62 file_sys/submission_package.cpp 62 file_sys/submission_package.cpp
63 file_sys/submission_package.h 63 file_sys/submission_package.h
64 file_sys/system_archive/ng_word.cpp
65 file_sys/system_archive/ng_word.h
66 file_sys/system_archive/system_archive.cpp
67 file_sys/system_archive/system_archive.h
64 file_sys/vfs.cpp 68 file_sys/vfs.cpp
65 file_sys/vfs.h 69 file_sys/vfs.h
66 file_sys/vfs_concat.cpp 70 file_sys/vfs_concat.cpp
diff --git a/src/core/file_sys/system_archive/system_archive.cpp b/src/core/file_sys/system_archive/system_archive.cpp
new file mode 100644
index 000000000..8451310a3
--- /dev/null
+++ b/src/core/file_sys/system_archive/system_archive.cpp
@@ -0,0 +1,91 @@
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 <functional>
6#include "common/logging/log.h"
7#include "core/file_sys/romfs.h"
8#include "core/file_sys/system_archive/ng_word.h"
9#include "core/file_sys/system_archive/system_archive.h"
10
11namespace FileSys::SystemArchive {
12
13constexpr u64 SYSTEM_ARCHIVE_BASE_TITLE_ID = 0x0100000000000800;
14constexpr std::size_t SYSTEM_ARCHIVE_COUNT = 0x28;
15
16using SystemArchiveSupplier = std::function<VirtualDir()>;
17
18struct SystemArchiveDescriptor {
19 u64 title_id;
20 const char* name;
21 SystemArchiveSupplier supplier;
22};
23
24const static std::array<SystemArchiveDescriptor, SYSTEM_ARCHIVE_COUNT> SYSTEM_ARCHIVES = {{
25 {0x0100000000000800, "CertStore", nullptr},
26 {0x0100000000000801, "ErrorMessage", nullptr},
27 {0x0100000000000802, "MiiModel", nullptr},
28 {0x0100000000000803, "BrowserDll", nullptr},
29 {0x0100000000000804, "Help", nullptr},
30 {0x0100000000000805, "SharedFont", nullptr},
31 {0x0100000000000806, "NgWord", &NgWord1},
32 {0x0100000000000807, "SsidList", nullptr},
33 {0x0100000000000808, "Dictionary", nullptr},
34 {0x0100000000000809, "SystemVersion", nullptr},
35 {0x010000000000080A, "AvatarImage", nullptr},
36 {0x010000000000080B, "LocalNews", nullptr},
37 {0x010000000000080C, "Eula", nullptr},
38 {0x010000000000080D, "UrlBlackList", nullptr},
39 {0x010000000000080E, "TimeZoneBinary", nullptr},
40 {0x010000000000080F, "CertStoreCruiser", nullptr},
41 {0x0100000000000810, "FontNintendoExtension", nullptr},
42 {0x0100000000000811, "FontStandard", nullptr},
43 {0x0100000000000812, "FontKorean", nullptr},
44 {0x0100000000000813, "FontChineseTraditional", nullptr},
45 {0x0100000000000814, "FontChineseSimple", nullptr},
46 {0x0100000000000815, "FontBfcpx", nullptr},
47 {0x0100000000000816, "SystemUpdate", nullptr},
48 {0x0100000000000817, "0100000000000817", nullptr},
49 {0x0100000000000818, "FirmwareDebugSettings", nullptr},
50 {0x0100000000000819, "BootImagePackage", nullptr},
51 {0x010000000000081A, "BootImagePackageSafe", nullptr},
52 {0x010000000000081B, "BootImagePackageExFat", nullptr},
53 {0x010000000000081C, "BottImagePackageExFatSafe", nullptr},
54 {0x010000000000081D, "FatalMessage", nullptr},
55 {0x010000000000081E, "ControllerIcon", nullptr},
56 {0x010000000000081F, "PlatformConfigIcosa", nullptr},
57 {0x0100000000000820, "PlatformConfigCopper", nullptr},
58 {0x0100000000000821, "PlatformConfigHoag", nullptr},
59 {0x0100000000000822, "ControllerFirmware", nullptr},
60 {0x0100000000000823, "NgWord2", nullptr},
61 {0x0100000000000824, "PlatformConfigIcosaMariko", nullptr},
62 {0x0100000000000825, "ApplicationBlackList", nullptr},
63 {0x0100000000000826, "RebootlessSystemUpdateVersion", nullptr},
64 {0x0100000000000827, "ContentActionTable", nullptr},
65}};
66
67VirtualFile SynthesizeSystemArchive(u64 title_id) {
68 if (title_id < SYSTEM_ARCHIVES.front().title_id || title_id > SYSTEM_ARCHIVES.back().title_id)
69 return nullptr;
70
71 const auto desc = SYSTEM_ARCHIVES[title_id - SYSTEM_ARCHIVE_BASE_TITLE_ID];
72
73 LOG_INFO(Service_FS, "Synthesizing system archive '{}' (0x{:016X}).", desc.name, desc.title_id);
74
75 if (desc.supplier == nullptr)
76 return nullptr;
77
78 const auto dir = desc.supplier();
79
80 if (dir == nullptr)
81 return nullptr;
82
83 const auto romfs = CreateRomFS(dir);
84
85 if (romfs == nullptr)
86 return nullptr;
87
88 LOG_INFO(Service_FS, " - System archive generation successful!");
89 return romfs;
90}
91} // namespace FileSys::SystemArchive
diff --git a/src/core/file_sys/system_archive/system_archive.h b/src/core/file_sys/system_archive/system_archive.h
new file mode 100644
index 000000000..724a8eb17
--- /dev/null
+++ b/src/core/file_sys/system_archive/system_archive.h
@@ -0,0 +1,14 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8#include "core/file_sys/vfs_types.h"
9
10namespace FileSys::SystemArchive {
11
12VirtualFile SynthesizeSystemArchive(u64 title_id);
13
14} // namespace FileSys::SystemArchive