summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2019-07-06 00:51:41 +0200
committerZach Hilman <zachhilman@gmail.com>2019-10-13 19:46:10 +0200
commit920742d41817688b1c15fb54f87c337ec7a7c91f (patch)
tree6dcc0dd84fd60b060ccd47bda2578f45f9960155 /src/core/file_sys
parentexternals: Move OSS font data to file_sys in core (diff)
downloadyuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.tar
yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.tar.gz
yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.tar.bz2
yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.tar.lz
yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.tar.xz
yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.tar.zst
yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.zip
Diffstat (limited to 'src/core/file_sys')
-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},