diff options
| author | 2019-07-05 18:51:41 -0400 | |
|---|---|---|
| committer | 2019-10-13 13:46:10 -0400 | |
| commit | 920742d41817688b1c15fb54f87c337ec7a7c91f (patch) | |
| tree | 6dcc0dd84fd60b060ccd47bda2578f45f9960155 /src | |
| parent | externals: Move OSS font data to file_sys in core (diff) | |
| download | yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.tar.gz yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.tar.xz yuzu-920742d41817688b1c15fb54f87c337ec7a7c91f.zip | |
system_archive: Synthesize shared fonts system archives
Diffstat (limited to '')
| -rw-r--r-- | src/core/file_sys/system_archive/shared_font.cpp | 78 | ||||
| -rw-r--r-- | src/core/file_sys/system_archive/shared_font.h | 17 | ||||
| -rw-r--r-- | src/core/file_sys/system_archive/system_archive.cpp | 11 |
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 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/file_sys/system_archive/data/font_chinese_simplified.h" | ||
| 6 | #include "core/file_sys/system_archive/data/font_chinese_traditional.h" | ||
| 7 | #include "core/file_sys/system_archive/data/font_extended_chinese_simplified.h" | ||
| 8 | #include "core/file_sys/system_archive/data/font_korean.h" | ||
| 9 | #include "core/file_sys/system_archive/data/font_nintendo_extended.h" | ||
| 10 | #include "core/file_sys/system_archive/data/font_standard.h" | ||
| 11 | #include "core/file_sys/system_archive/shared_font.h" | ||
| 12 | #include "core/file_sys/vfs_vector.h" | ||
| 13 | #include "core/hle/service/ns/pl_u.h" | ||
| 14 | |||
| 15 | namespace FileSys::SystemArchive { | ||
| 16 | |||
| 17 | namespace { | ||
| 18 | |||
| 19 | template <std::size_t Size> | ||
| 20 | VirtualFile PackBFTTF(const std::array<u8, Size>& data, const std::string& name) { | ||
| 21 | std::vector<u32> vec(Size / sizeof(u32)); | ||
| 22 | std::memcpy(vec.data(), data.data(), vec.size() * sizeof(u32)); | ||
| 23 | |||
| 24 | std::vector<u8> bfttf(Size + sizeof(u64)); | ||
| 25 | |||
| 26 | u64 offset = 0; | ||
| 27 | Service::NS::EncryptSharedFont(vec, bfttf, offset); | ||
| 28 | return std::make_shared<VectorVfsFile>(std::move(bfttf), name); | ||
| 29 | } | ||
| 30 | |||
| 31 | } // Anonymous namespace | ||
| 32 | |||
| 33 | VirtualDir FontNintendoExtension() { | ||
| 34 | return std::make_shared<VectorVfsDirectory>( | ||
| 35 | std::vector<VirtualFile>{ | ||
| 36 | PackBFTTF(SharedFontData::FONT_NINTENDO_EXTENDED, "nintendo_ext_003.bfttf"), | ||
| 37 | PackBFTTF(SharedFontData::FONT_NINTENDO_EXTENDED, "nintendo_ext2_003.bfttf"), | ||
| 38 | }, | ||
| 39 | std::vector<VirtualDir>{}); | ||
| 40 | } | ||
| 41 | |||
| 42 | VirtualDir FontStandard() { | ||
| 43 | return std::make_shared<VectorVfsDirectory>( | ||
| 44 | std::vector<VirtualFile>{ | ||
| 45 | PackBFTTF(SharedFontData::FONT_STANDARD, "nintendo_udsg-r_std_003.bfttf"), | ||
| 46 | }, | ||
| 47 | std::vector<VirtualDir>{}); | ||
| 48 | } | ||
| 49 | |||
| 50 | VirtualDir FontKorean() { | ||
| 51 | return std::make_shared<VectorVfsDirectory>( | ||
| 52 | std::vector<VirtualFile>{ | ||
| 53 | PackBFTTF(SharedFontData::FONT_KOREAN, "nintendo_udsg-r_ko_003.bfttf"), | ||
| 54 | }, | ||
| 55 | std::vector<VirtualDir>{}); | ||
| 56 | } | ||
| 57 | |||
| 58 | VirtualDir FontChineseTraditional() { | ||
| 59 | return std::make_shared<VectorVfsDirectory>( | ||
| 60 | std::vector<VirtualFile>{ | ||
| 61 | PackBFTTF(SharedFontData::FONT_CHINESE_TRADITIONAL, | ||
| 62 | "nintendo_udjxh-db_zh-tw_003.bfttf"), | ||
| 63 | }, | ||
| 64 | std::vector<VirtualDir>{}); | ||
| 65 | } | ||
| 66 | |||
| 67 | VirtualDir FontChineseSimple() { | ||
| 68 | return std::make_shared<VectorVfsDirectory>( | ||
| 69 | std::vector<VirtualFile>{ | ||
| 70 | PackBFTTF(SharedFontData::FONT_CHINESE_SIMPLIFIED, | ||
| 71 | "nintendo_udsg-r_org_zh-cn_003.bfttf"), | ||
| 72 | PackBFTTF(SharedFontData::FONT_EXTENDED_CHINESE_SIMPLIFIED, | ||
| 73 | "nintendo_udsg-r_ext_zh-cn_003.bfttf"), | ||
| 74 | }, | ||
| 75 | std::vector<VirtualDir>{}); | ||
| 76 | } | ||
| 77 | |||
| 78 | } // 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 @@ | |||
| 1 | // Copyright 2019 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 "core/file_sys/vfs_types.h" | ||
| 8 | |||
| 9 | namespace FileSys::SystemArchive { | ||
| 10 | |||
| 11 | VirtualDir FontNintendoExtension(); | ||
| 12 | VirtualDir FontStandard(); | ||
| 13 | VirtualDir FontKorean(); | ||
| 14 | VirtualDir FontChineseTraditional(); | ||
| 15 | VirtualDir FontChineseSimple(); | ||
| 16 | |||
| 17 | } // 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 @@ | |||
| 6 | #include "core/file_sys/romfs.h" | 6 | #include "core/file_sys/romfs.h" |
| 7 | #include "core/file_sys/system_archive/mii_model.h" | 7 | #include "core/file_sys/system_archive/mii_model.h" |
| 8 | #include "core/file_sys/system_archive/ng_word.h" | 8 | #include "core/file_sys/system_archive/ng_word.h" |
| 9 | #include "core/file_sys/system_archive/shared_font.h" | ||
| 9 | #include "core/file_sys/system_archive/system_archive.h" | 10 | #include "core/file_sys/system_archive/system_archive.h" |
| 10 | #include "core/file_sys/system_archive/system_version.h" | 11 | #include "core/file_sys/system_archive/system_version.h" |
| 11 | 12 | ||
| @@ -39,11 +40,11 @@ constexpr std::array<SystemArchiveDescriptor, SYSTEM_ARCHIVE_COUNT> SYSTEM_ARCHI | |||
| 39 | {0x010000000000080D, "UrlBlackList", nullptr}, | 40 | {0x010000000000080D, "UrlBlackList", nullptr}, |
| 40 | {0x010000000000080E, "TimeZoneBinary", nullptr}, | 41 | {0x010000000000080E, "TimeZoneBinary", nullptr}, |
| 41 | {0x010000000000080F, "CertStoreCruiser", nullptr}, | 42 | {0x010000000000080F, "CertStoreCruiser", nullptr}, |
| 42 | {0x0100000000000810, "FontNintendoExtension", nullptr}, | 43 | {0x0100000000000810, "FontNintendoExtension", &FontNintendoExtension}, |
| 43 | {0x0100000000000811, "FontStandard", nullptr}, | 44 | {0x0100000000000811, "FontStandard", &FontStandard}, |
| 44 | {0x0100000000000812, "FontKorean", nullptr}, | 45 | {0x0100000000000812, "FontKorean", &FontKorean}, |
| 45 | {0x0100000000000813, "FontChineseTraditional", nullptr}, | 46 | {0x0100000000000813, "FontChineseTraditional", &FontChineseTraditional}, |
| 46 | {0x0100000000000814, "FontChineseSimple", nullptr}, | 47 | {0x0100000000000814, "FontChineseSimple", &FontChineseSimple}, |
| 47 | {0x0100000000000815, "FontBfcpx", nullptr}, | 48 | {0x0100000000000815, "FontBfcpx", nullptr}, |
| 48 | {0x0100000000000816, "SystemUpdate", nullptr}, | 49 | {0x0100000000000816, "SystemUpdate", nullptr}, |
| 49 | {0x0100000000000817, "0100000000000817", nullptr}, | 50 | {0x0100000000000817, "0100000000000817", nullptr}, |