Split the atlas into three, well two, but two different cases for the fonts.

Platforms that can use OS fonts don't need font_atlas.zim but they do
need ascii font for debug, so does use asciifont_atlas.zim.
This commit is contained in:
Henrik Rydgård 2021-12-10 22:43:04 +01:00
parent 204b2a48e4
commit d4237fd542
19 changed files with 54 additions and 3277 deletions

2
.gitignore vendored
View File

@ -90,6 +90,8 @@ screenshots
android/assets/lang android/assets/lang
android/assets/flash0 android/assets/flash0
ui_atlas.zim.png ui_atlas.zim.png
font_atlas.zim.png
asciifont_atlas.zim.png
ppge_atlas.zim.png ppge_atlas.zim.png
local.properties local.properties
r.sh r.sh

View File

@ -2243,9 +2243,16 @@ if(WIN32)
list(APPEND NativeAppSource ${WindowsFiles}) list(APPEND NativeAppSource ${WindowsFiles})
endif() endif()
set(BigFontAssets
assets/font_atlas.zim
assets/font_atlas.meta
)
set(NativeAssets set(NativeAssets
android/assets/ui_atlas.zim android/assets/ui_atlas.zim # Why are we getting these from the Android folder?
android/assets/ui_atlas.meta android/assets/ui_atlas.meta
android/assets/asciifont_atlas.zim
android/assets/asciifont_atlas.meta
assets/debugger assets/debugger
assets/lang assets/lang
assets/shaders assets/shaders
@ -2357,6 +2364,7 @@ if(TargetBin)
file(GLOB_RECURSE DEBUGGER_FILES assets/debugger/*) file(GLOB_RECURSE DEBUGGER_FILES assets/debugger/*)
if(NOT IOS) if(NOT IOS)
set_source_files_properties(${BigFontAssets} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets")
set_source_files_properties(${NativeAssets} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets") set_source_files_properties(${NativeAssets} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets")
set_source_files_properties(${FLASH0_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/flash0/font") set_source_files_properties(${FLASH0_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/flash0/font")
set_source_files_properties(${LANG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/lang") set_source_files_properties(${LANG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/lang")
@ -2365,10 +2373,10 @@ if(TargetBin)
endif() endif()
if(IOS) if(IOS)
add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${DEBUGGER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource} "ios/Settings.bundle" "ios/Launch Screen.storyboard") add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${BigFontAssets} {SHADER_FILES} ${DEBUGGER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource} "ios/Settings.bundle" "ios/Launch Screen.storyboard")
file(INSTALL "${CMAKE_SOURCE_DIR}/ext/vulkan/iOS/Frameworks/libMoltenVK.dylib" DESTINATION "${CMAKE_BINARY_DIR}/PPSSPP.app/Frameworks/") file(INSTALL "${CMAKE_SOURCE_DIR}/ext/vulkan/iOS/Frameworks/libMoltenVK.dylib" DESTINATION "${CMAKE_BINARY_DIR}/PPSSPP.app/Frameworks/")
else() else()
add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${DEBUGGER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource}) add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${BigFontAssets} ${SHADER_FILES} ${DEBUGGER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource})
file(INSTALL "${CMAKE_SOURCE_DIR}/ext/vulkan/macOS/Frameworks/libMoltenVK.dylib" DESTINATION "${CMAKE_BINARY_DIR}/PPSSPPSDL.app/Contents/Frameworks/") file(INSTALL "${CMAKE_SOURCE_DIR}/ext/vulkan/macOS/Frameworks/libMoltenVK.dylib" DESTINATION "${CMAKE_BINARY_DIR}/PPSSPPSDL.app/Contents/Frameworks/")
if(TARGET SDL2::SDL2 AND NOT USING_QT_UI) if(TARGET SDL2::SDL2 AND NOT USING_QT_UI)
add_custom_command(TARGET ${TargetBin} POST_BUILD COMMAND /bin/bash "${CMAKE_SOURCE_DIR}/SDL/macbundle.sh" "${CMAKE_BINARY_DIR}/PPSSPPSDL.app") add_custom_command(TARGET ${TargetBin} POST_BUILD COMMAND /bin/bash "${CMAKE_SOURCE_DIR}/SDL/macbundle.sh" "${CMAKE_BINARY_DIR}/PPSSPPSDL.app")
@ -2392,6 +2400,7 @@ endif()
# installs # installs
if(NOT ANDROID) if(NOT ANDROID)
file(INSTALL ${BigFontAssets} DESTINATION assets)
file(INSTALL ${NativeAssets} DESTINATION assets) file(INSTALL ${NativeAssets} DESTINATION assets)
file(INSTALL assets/flash0 DESTINATION assets) file(INSTALL assets/flash0 DESTINATION assets)
endif() endif()

View File

@ -40,11 +40,20 @@ void UIContext::BeginFrame() {
uitexture_ = CreateTextureFromFile(draw_, "ui_atlas.zim", ImageFileType::ZIM, false); uitexture_ = CreateTextureFromFile(draw_, "ui_atlas.zim", ImageFileType::ZIM, false);
_dbg_assert_msg_(uitexture_, "Failed to load ui_atlas.zim.\n\nPlace it in the directory \"assets\" under your PPSSPP directory."); _dbg_assert_msg_(uitexture_, "Failed to load ui_atlas.zim.\n\nPlace it in the directory \"assets\" under your PPSSPP directory.");
if (!fontTexture_) { if (!fontTexture_) {
#if PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID)
// Don't bother with loading font_atlas.zim
#else
fontTexture_ = CreateTextureFromFile(draw_, "font_atlas.zim", ImageFileType::ZIM, false); fontTexture_ = CreateTextureFromFile(draw_, "font_atlas.zim", ImageFileType::ZIM, false);
if (!fontTexture_) #endif
if (!fontTexture_) {
// Load the smaller ascii font only, like on Android. For debug ui etc.
fontTexture_ = CreateTextureFromFile(draw_, "asciifont_atlas.zim", ImageFileType::ZIM, false);
if (!fontTexture_) {
WARN_LOG(SYSTEM, "Failed to load font_atlas.zim"); WARN_LOG(SYSTEM, "Failed to load font_atlas.zim");
} }
} }
}
}
uidrawbufferTop_->SetCurZ(0.0f); uidrawbufferTop_->SetCurZ(0.0f);
uidrawbuffer_->SetCurZ(0.0f); uidrawbuffer_->SetCurZ(0.0f);
ActivateTopScissor(); ActivateTopScissor();

View File

@ -949,9 +949,13 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
return false; return false;
} }
// Load any missing atlas. // Load any missing atlas metadata (the images are loaded from UIContext).
LoadAtlasMetadata(g_ui_atlas, "ui_atlas.meta", true); LoadAtlasMetadata(g_ui_atlas, "ui_atlas.meta", true);
#if !(PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID))
LoadAtlasMetadata(g_font_atlas, "font_atlas.meta", g_ui_atlas.num_fonts == 0); LoadAtlasMetadata(g_font_atlas, "font_atlas.meta", g_ui_atlas.num_fonts == 0);
#else
LoadAtlasMetadata(g_font_atlas, "asciifont_atlas.meta", g_ui_atlas.num_fonts == 0);
#endif
ui_draw2d.SetAtlas(&g_ui_atlas); ui_draw2d.SetAtlas(&g_ui_atlas);
ui_draw2d.SetFontAtlas(&g_font_atlas); ui_draw2d.SetFontAtlas(&g_font_atlas);
@ -1213,13 +1217,11 @@ void NativeRender(GraphicsContext *graphicsContext) {
// Modifying the bounds here can be used to "inset" the whole image to gain borders for TV overscan etc. // Modifying the bounds here can be used to "inset" the whole image to gain borders for TV overscan etc.
// The UI now supports any offset but not the EmuScreen yet. // The UI now supports any offset but not the EmuScreen yet.
uiContext->SetBounds(Bounds(0, 0, dp_xres, dp_yres)); uiContext->SetBounds(Bounds(0, 0, dp_xres, dp_yres));
// uiContext->SetBounds(Bounds(dp_xres/2, 0, dp_xres / 2, dp_yres / 2));
// OSX 10.6 and SDL 1.2 bug. // OSX 10.6 and SDL 1.2 bug.
#if defined(__APPLE__) && !defined(USING_QT_UI) #if defined(__APPLE__) && !defined(USING_QT_UI)
static int dp_xres_old = dp_xres; static int dp_xres_old = dp_xres;
if (dp_xres != dp_xres_old) { if (dp_xres != dp_xres_old) {
// uiTexture->Load("ui_atlas.zim");
dp_xres_old = dp_xres; dp_xres_old = dp_xres;
} }
#endif #endif

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
2048
font UBUNTU24 assets/Roboto-Condensed.ttf UWER 34 -2

BIN
assets/asciifont_atlas.meta Normal file

Binary file not shown.

BIN
assets/asciifont_atlas.zim Normal file

Binary file not shown.

BIN
assets/font_atlas.meta Normal file

Binary file not shown.

BIN
assets/font_atlas.zim Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,9 @@
./ext/native/tools/build/atlastool atlasscript.txt ui 8888 && cp ui_atlas.zim ui_atlas.meta assets && cp ui_atlas.zim ui_atlas.meta android/assets && rm ui_atlas.cpp ui_atlas.h # Note that we do not copy the big font atlas to Android assets. No longer needed!
./ext/native/tools/build/atlastool ui_atlasscript.txt ui 8888 && cp ui_atlas.zim ui_atlas.meta assets && cp ui_atlas.zim ui_atlas.meta android/assets && rm ui_atlas.cpp ui_atlas.h
./ext/native/tools/build/atlastool font_atlasscript.txt font 8888 && cp font_atlas.zim font_atlas.meta assets && rm font_atlas.cpp font_atlas.h
./ext/native/tools/build/atlastool asciifont_atlasscript.txt asciifont 8888 && cp asciifont_atlas.zim asciifont_atlas.meta assets && cp asciifont_atlas.zim asciifont_atlas.meta android/assets && rm asciifont_atlas.cpp asciifont_atlas.h
rm ui_atlas.zim ui_atlas.meta rm ui_atlas.zim ui_atlas.meta
rm font_atlas.zim font_atlas.meta
rm asciifont_atlas.zim asciifont_atlas.meta

File diff suppressed because it is too large Load Diff

View File

@ -772,9 +772,8 @@ void LearnFile(const char *filename, const char *desc, std::set<u16> &chars, uin
} }
} }
delete[] data; delete[] data;
printf("%i %s characters learned.\n", learnCount, desc); printf("%d %s characters learned.\n", learnCount, desc);
} }
} }
void GetLocales(const char *locales, std::vector<CharRange> &ranges) void GetLocales(const char *locales, std::vector<CharRange> &ranges)
@ -789,12 +788,15 @@ void GetLocales(const char *locales, std::vector<CharRange> &ranges)
} }
} }
// Also, load chinese.txt if available. LearnFile("assets/lang/zh_CN.ini", "Chinese", kanji, 0x3400, 0xFFFF);
LearnFile("chinese.txt", "Chinese", kanji, 0x3400, 0xFFFF); LearnFile("assets/lang/zh_TW.ini", "Chinese", kanji, 0x3400, 0xFFFF);
LearnFile("korean.txt", "Korean", hangul1, 0x1100, 0x11FF); LearnFile("assets/langregion.ini", "Chinese", kanji, 0x3400, 0xFFFF);
LearnFile("korean.txt", "Korean", hangul2, 0x3130, 0x318F); LearnFile("assets/lang/ko_KR.ini", "Korean", hangul1, 0x1100, 0x11FF);
LearnFile("korean.txt", "Korean", hangul3, 0xAC00, 0xD7A3); LearnFile("assets/lang/ko_KR.ini", "Korean", hangul2, 0x3130, 0x318F);
LearnFile("assets/lang/ko_KR.ini", "Korean", hangul3, 0xAC00, 0xD7A3);
LearnFile("assets/langregion.ini", "Korean", hangul1, 0x1100, 0x11FF);
LearnFile("assets/langregion.ini", "Korean", hangul2, 0x3130, 0x318F);
LearnFile("assets/langregion.ini", "Korean", hangul3, 0xAC00, 0xD7A3);
// The end point of a range is now inclusive! // The end point of a range is now inclusive!
for (size_t i = 0; i < strlen(locales); i++) { for (size_t i = 0; i < strlen(locales); i++) {

3
font_atlasscript.txt Normal file
View File

@ -0,0 +1,3 @@
2048
font UBUNTU24 assets/Roboto-Condensed.ttf UWER 34 -2
font UBUNTU24 C:/Windows/Fonts/ARIALUNI.ttf UWEhkcRGHKVTe 30 0

1815
korean.txt

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,4 @@
2048 512
font UBUNTU24 assets/Roboto-Condensed.ttf UWER 34 -2
font UBUNTU24 C:/Windows/Fonts/ARIALUNI.ttf UWEhkcRGHKVTe 30 0
image I_SOLIDWHITE white.png copy image I_SOLIDWHITE white.png copy
image I_CROSS source_assets/image/cross.png copy image I_CROSS source_assets/image/cross.png copy
image I_CIRCLE source_assets/image/circle.png copy image I_CIRCLE source_assets/image/circle.png copy