system_archive: Synthesize shared fonts system archives
This commit is contained in:
parent
ae9604faba
commit
8b857fc7c2
78
src/core/file_sys/system_archive/shared_font.cpp
Normal file
78
src/core/file_sys/system_archive/shared_font.cpp
Normal file
|
@ -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
|
17
src/core/file_sys/system_archive/shared_font.h
Normal file
17
src/core/file_sys/system_archive/shared_font.h
Normal file
|
@ -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
|
|
@ -6,6 +6,7 @@
|
||||||
#include "core/file_sys/romfs.h"
|
#include "core/file_sys/romfs.h"
|
||||||
#include "core/file_sys/system_archive/mii_model.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/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_archive.h"
|
||||||
#include "core/file_sys/system_archive/system_version.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},
|
{0x010000000000080D, "UrlBlackList", nullptr},
|
||||||
{0x010000000000080E, "TimeZoneBinary", nullptr},
|
{0x010000000000080E, "TimeZoneBinary", nullptr},
|
||||||
{0x010000000000080F, "CertStoreCruiser", nullptr},
|
{0x010000000000080F, "CertStoreCruiser", nullptr},
|
||||||
{0x0100000000000810, "FontNintendoExtension", nullptr},
|
{0x0100000000000810, "FontNintendoExtension", &FontNintendoExtension},
|
||||||
{0x0100000000000811, "FontStandard", nullptr},
|
{0x0100000000000811, "FontStandard", &FontStandard},
|
||||||
{0x0100000000000812, "FontKorean", nullptr},
|
{0x0100000000000812, "FontKorean", &FontKorean},
|
||||||
{0x0100000000000813, "FontChineseTraditional", nullptr},
|
{0x0100000000000813, "FontChineseTraditional", &FontChineseTraditional},
|
||||||
{0x0100000000000814, "FontChineseSimple", nullptr},
|
{0x0100000000000814, "FontChineseSimple", &FontChineseSimple},
|
||||||
{0x0100000000000815, "FontBfcpx", nullptr},
|
{0x0100000000000815, "FontBfcpx", nullptr},
|
||||||
{0x0100000000000816, "SystemUpdate", nullptr},
|
{0x0100000000000816, "SystemUpdate", nullptr},
|
||||||
{0x0100000000000817, "0100000000000817", nullptr},
|
{0x0100000000000817, "0100000000000817", nullptr},
|
||||||
|
|
Loading…
Reference in a new issue