summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/system_archive/shared_font.cpp78
-rw-r--r--src/core/file_sys/system_archive/shared_font.h17
-rw-r--r--src/core/file_sys/system_archive/system_archive.cpp11
3 files changed, 101 insertions, 5 deletions
diff --git a/src/core/file_sys/system_archive/shared_font.cpp b/src/core/file_sys/system_archive/shared_font.cpp
new file mode 100644
index 000000000..2c05eb42e
--- /dev/null
+++ b/src/core/file_sys/system_archive/shared_font.cpp
@@ -0,0 +1,78 @@
+// Copyright 2019 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "core/file_sys/system_archive/data/font_chinese_simplified.h"
+#include "core/file_sys/system_archive/data/font_chinese_traditional.h"
+#include "core/file_sys/system_archive/data/font_extended_chinese_simplified.h"
+#include "core/file_sys/system_archive/data/font_korean.h"
+#include "core/file_sys/system_archive/data/font_nintendo_extended.h"
+#include "core/file_sys/system_archive/data/font_standard.h"
+#include "core/file_sys/system_archive/shared_font.h"
+#include "core/file_sys/vfs_vector.h"
+#include "core/hle/service/ns/pl_u.h"
+
+namespace FileSys::SystemArchive {
+
+namespace {
+
+template <std::size_t Size>
+VirtualFile PackBFTTF(const std::array<u8, Size>& data, const std::string& name) {
+ std::vector<u32> vec(Size / sizeof(u32));
+ std::memcpy(vec.data(), data.data(), vec.size() * sizeof(u32));
+
+ std::vector<u8> bfttf(Size + sizeof(u64));
+
+ u64 offset = 0;
+ Service::NS::EncryptSharedFont(vec, bfttf, offset);
+ return std::make_shared<VectorVfsFile>(std::move(bfttf), name);
+}
+
+} // Anonymous namespace
+
+VirtualDir FontNintendoExtension() {
+ return std::make_shared<VectorVfsDirectory>(
+ std::vector<VirtualFile>{
+ PackBFTTF(SharedFontData::FONT_NINTENDO_EXTENDED, "nintendo_ext_003.bfttf"),
+ PackBFTTF(SharedFontData::FONT_NINTENDO_EXTENDED, "nintendo_ext2_003.bfttf"),
+ },
+ std::vector<VirtualDir>{});
+}
+
+VirtualDir FontStandard() {
+ return std::make_shared<VectorVfsDirectory>(
+ std::vector<VirtualFile>{
+ PackBFTTF(SharedFontData::FONT_STANDARD, "nintendo_udsg-r_std_003.bfttf"),
+ },
+ std::vector<VirtualDir>{});
+}
+
+VirtualDir FontKorean() {
+ return std::make_shared<VectorVfsDirectory>(
+ std::vector<VirtualFile>{
+ PackBFTTF(SharedFontData::FONT_KOREAN, "nintendo_udsg-r_ko_003.bfttf"),
+ },
+ std::vector<VirtualDir>{});
+}
+
+VirtualDir FontChineseTraditional() {
+ return std::make_shared<VectorVfsDirectory>(
+ std::vector<VirtualFile>{
+ PackBFTTF(SharedFontData::FONT_CHINESE_TRADITIONAL,
+ "nintendo_udjxh-db_zh-tw_003.bfttf"),
+ },
+ std::vector<VirtualDir>{});
+}
+
+VirtualDir FontChineseSimple() {
+ return std::make_shared<VectorVfsDirectory>(
+ std::vector<VirtualFile>{
+ PackBFTTF(SharedFontData::FONT_CHINESE_SIMPLIFIED,
+ "nintendo_udsg-r_org_zh-cn_003.bfttf"),
+ PackBFTTF(SharedFontData::FONT_EXTENDED_CHINESE_SIMPLIFIED,
+ "nintendo_udsg-r_ext_zh-cn_003.bfttf"),
+ },
+ std::vector<VirtualDir>{});
+}
+
+} // namespace FileSys::SystemArchive
diff --git a/src/core/file_sys/system_archive/shared_font.h b/src/core/file_sys/system_archive/shared_font.h
new file mode 100644
index 000000000..6d8de565b
--- /dev/null
+++ b/src/core/file_sys/system_archive/shared_font.h
@@ -0,0 +1,17 @@
+// Copyright 2019 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "core/file_sys/vfs_types.h"
+
+namespace FileSys::SystemArchive {
+
+VirtualDir FontNintendoExtension();
+VirtualDir FontStandard();
+VirtualDir FontKorean();
+VirtualDir FontChineseTraditional();
+VirtualDir FontChineseSimple();
+
+} // namespace FileSys::SystemArchive
diff --git a/src/core/file_sys/system_archive/system_archive.cpp b/src/core/file_sys/system_archive/system_archive.cpp
index 6d8445383..e93d100a5 100644
--- a/src/core/file_sys/system_archive/system_archive.cpp
+++ b/src/core/file_sys/system_archive/system_archive.cpp
@@ -6,6 +6,7 @@
#include "core/file_sys/romfs.h"
#include "core/file_sys/system_archive/mii_model.h"
#include "core/file_sys/system_archive/ng_word.h"
+#include "core/file_sys/system_archive/shared_font.h"
#include "core/file_sys/system_archive/system_archive.h"
#include "core/file_sys/system_archive/system_version.h"
@@ -39,11 +40,11 @@ constexpr std::array<SystemArchiveDescriptor, SYSTEM_ARCHIVE_COUNT> SYSTEM_ARCHI
{0x010000000000080D, "UrlBlackList", nullptr},
{0x010000000000080E, "TimeZoneBinary", nullptr},
{0x010000000000080F, "CertStoreCruiser", nullptr},
- {0x0100000000000810, "FontNintendoExtension", nullptr},
- {0x0100000000000811, "FontStandard", nullptr},
- {0x0100000000000812, "FontKorean", nullptr},
- {0x0100000000000813, "FontChineseTraditional", nullptr},
- {0x0100000000000814, "FontChineseSimple", nullptr},
+ {0x0100000000000810, "FontNintendoExtension", &FontNintendoExtension},
+ {0x0100000000000811, "FontStandard", &FontStandard},
+ {0x0100000000000812, "FontKorean", &FontKorean},
+ {0x0100000000000813, "FontChineseTraditional", &FontChineseTraditional},
+ {0x0100000000000814, "FontChineseSimple", &FontChineseSimple},
{0x0100000000000815, "FontBfcpx", nullptr},
{0x0100000000000816, "SystemUpdate", nullptr},
{0x0100000000000817, "0100000000000817", nullptr},