mirror of
https://notabug.org/litucks/torzu.git
synced 2024-11-27 02:30:23 +00:00
Use open-source shared fonts if no dumped file is available (#1269)
* Add open-source shared fonts * Address review comments
This commit is contained in:
parent
804115b2a4
commit
3bac3051fc
3
externals/CMakeLists.txt
vendored
3
externals/CMakeLists.txt
vendored
@ -43,6 +43,9 @@ target_include_directories(mbedtls PUBLIC ./mbedtls/include)
|
||||
add_library(microprofile INTERFACE)
|
||||
target_include_directories(microprofile INTERFACE ./microprofile)
|
||||
|
||||
# Open Source Archives
|
||||
add_subdirectory(open_source_archives EXCLUDE_FROM_ALL)
|
||||
|
||||
# Unicorn
|
||||
add_library(unicorn-headers INTERFACE)
|
||||
target_include_directories(unicorn-headers INTERFACE ./unicorn/include)
|
||||
|
3
externals/open_source_archives/CMakeLists.txt
vendored
Normal file
3
externals/open_source_archives/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
add_library(open_source_archives INTERFACE)
|
||||
|
||||
target_include_directories(open_source_archives INTERFACE "include/")
|
4
externals/open_source_archives/Readme.md
vendored
Normal file
4
externals/open_source_archives/Readme.md
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
These files were generated by https://github.com/FearlessTobi/yuzu_system_archives at git commit 0a24b0c9f38d71fb2c4bba5645a39029e539a5ec. To generate the files use the run.sh inside that repository.
|
||||
|
||||
The follwing system archives are currently included:
|
||||
- JPN/EUR/USA System Font
|
18111
externals/open_source_archives/include/FontChineseSimplified.ttf.h
vendored
Normal file
18111
externals/open_source_archives/include/FontChineseSimplified.ttf.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
18523
externals/open_source_archives/include/FontChineseTraditional.ttf.h
vendored
Normal file
18523
externals/open_source_archives/include/FontChineseTraditional.ttf.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
24463
externals/open_source_archives/include/FontExtendedChineseSimplified.ttf.h
vendored
Normal file
24463
externals/open_source_archives/include/FontExtendedChineseSimplified.ttf.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
18110
externals/open_source_archives/include/FontKorean.ttf.h
vendored
Normal file
18110
externals/open_source_archives/include/FontKorean.ttf.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14342
externals/open_source_archives/include/FontNintendoExtended.ttf.h
vendored
Normal file
14342
externals/open_source_archives/include/FontNintendoExtended.ttf.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
18110
externals/open_source_archives/include/FontStandard.ttf.h
vendored
Normal file
18110
externals/open_source_archives/include/FontStandard.ttf.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -388,7 +388,7 @@ add_library(core STATIC
|
||||
create_target_directory_groups(core)
|
||||
|
||||
target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
|
||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt lz4_static mbedtls opus unicorn)
|
||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt lz4_static mbedtls opus unicorn open_source_archives)
|
||||
|
||||
if (ARCHITECTURE_x86_64)
|
||||
target_sources(core PRIVATE
|
||||
|
@ -2,6 +2,13 @@
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <FontChineseSimplified.ttf.h>
|
||||
#include <FontChineseTraditional.ttf.h>
|
||||
#include <FontExtendedChineseSimplified.ttf.h>
|
||||
#include <FontKorean.ttf.h>
|
||||
#include <FontNintendoExtended.ttf.h>
|
||||
#include <FontStandard.ttf.h>
|
||||
|
||||
#include "common/common_paths.h"
|
||||
#include "common/file_util.h"
|
||||
#include "core/core.h"
|
||||
@ -218,7 +225,24 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
|
||||
file.ReadBytes(shared_font->data(), shared_font->size());
|
||||
BuildSharedFontsRawRegions(*shared_font);
|
||||
} else {
|
||||
LOG_WARNING(Service_NS, "Unable to load shared font: {}", filepath);
|
||||
LOG_WARNING(Service_NS,
|
||||
"Shared Font file missing. Loading open source replacement from memory");
|
||||
|
||||
const std::vector<std::vector<u8>> open_source_shared_fonts_ttf = {
|
||||
{std::begin(FontChineseSimplified), std::end(FontChineseSimplified)},
|
||||
{std::begin(FontChineseTraditional), std::end(FontChineseTraditional)},
|
||||
{std::begin(FontExtendedChineseSimplified),
|
||||
std::end(FontExtendedChineseSimplified)},
|
||||
{std::begin(FontNintendoExtended), std::end(FontNintendoExtended)},
|
||||
{std::begin(FontStandard), std::end(FontStandard)},
|
||||
};
|
||||
|
||||
for (const std::vector<u8>& font_ttf : open_source_shared_fonts_ttf) {
|
||||
const FontRegion region{static_cast<u32>(offset + 8),
|
||||
static_cast<u32>(font_ttf.size())};
|
||||
EncryptSharedFont(font_ttf, *shared_font, offset);
|
||||
SHARED_FONT_REGIONS.push_back(region);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user