From d4710e9a3e27404b04e5900c1943a9ceea725e87 Mon Sep 17 00:00:00 2001 From: xdCloudy <52116030+xdCloudy@users.noreply.github.com> Date: Thu, 29 Oct 2026 15:39:03 +0000 Subject: [PATCH] feat(libSceFreeTypeOl): implement 70 FreeType exports --- core/libs/prx/libSceFreeTypeOl/CMakeLists.txt | 20 +- core/libs/prx/libSceFreeTypeOl/Export.cpp | 350 --------------- .../prx/libSceFreeTypeOl/ModuleWrappers.cpp | 424 ++++++++++++++++++ .../prx/libSceFreeTypeOl/libSceFreeTypeOl.hpp | 75 ++++ core/libs/tests/GuestFreeTypeOlModules.cpp | 69 +++ docs/dev/debt/libSceFreeTypeOl.md | 15 +- 6 files changed, 600 insertions(+), 353 deletions(-) create mode 100644 core/libs/prx/libSceFreeTypeOl/ModuleWrappers.cpp create mode 100644 core/libs/tests/GuestFreeTypeOlModules.cpp diff --git a/core/libs/prx/libSceFreeTypeOl/CMakeLists.txt b/core/libs/prx/libSceFreeTypeOl/CMakeLists.txt index e8f18eac97..b676a0aa66 100644 --- a/core/libs/prx/libSceFreeTypeOl/CMakeLists.txt +++ b/core/libs/prx/libSceFreeTypeOl/CMakeLists.txt @@ -1,8 +1,26 @@ -add_library(libSceFreeTypeOl SHARED EXCLUDE_FROM_ALL Export.cpp ../libSceFreeType/src/OutlineBorders.cpp) +target_sources(freetype PRIVATE + ${PROJECT_SOURCE_DIR}/3rdparty/freetype/src/gxvalid/gxvalid.c + ${PROJECT_SOURCE_DIR}/3rdparty/freetype/src/otvalid/otvalid.c) +add_library(libSceFreeTypeOl SHARED EXCLUDE_FROM_ALL Export.cpp ModuleWrappers.cpp ../libSceFreeType/src/OutlineBorders.cpp) target_include_directories(libSceFreeTypeOl PRIVATE ${LIBS_INCLUDE_DIR}) +target_link_libraries(libSceFreeTypeOl PRIVATE freetype) configure_windows_unwind(libSceFreeTypeOl) if(BUILD_TESTING) + add_test_executable(guest_freetype_ol_module_tests ${LIBS_INCLUDE_DIR}/tests/GuestFreeTypeOlModules.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ModuleWrappers.cpp) + target_include_directories(guest_freetype_ol_module_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(guest_freetype_ol_module_tests PRIVATE freetype) + if(WIN32) + target_link_libraries(guest_freetype_ol_module_tests PRIVATE libc) + endif() + configure_windows_unwind(guest_freetype_ol_module_tests) + add_test(NAME guest_freetype_ol_modules COMMAND guest_freetype_ol_module_tests) + set_tests_properties(guest_freetype_ol_modules PROPERTIES TIMEOUT 20) + if(WIN32) + set_tests_properties(guest_freetype_ol_modules PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:${UNPATCHED_DIR};PATH=path_list_prepend:$") + endif() add_test_executable(guest_freetype_outline_border_tests ${LIBS_INCLUDE_DIR}/tests/GuestFreeTypeOutlineBorder.cpp) target_include_directories(guest_freetype_outline_border_tests PRIVATE ${LIBS_INCLUDE_DIR}) target_link_libraries(guest_freetype_outline_border_tests PRIVATE freetype ${CMAKE_DL_LIBS}) diff --git a/core/libs/prx/libSceFreeTypeOl/Export.cpp b/core/libs/prx/libSceFreeTypeOl/Export.cpp index 70884a3818..34a4a2fab7 100644 --- a/core/libs/prx/libSceFreeTypeOl/Export.cpp +++ b/core/libs/prx/libSceFreeTypeOl/Export.cpp @@ -5,81 +5,11 @@ extern "C" { -int APS5_VABI sceFreeTypeOlFtaAddModule_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("mCIXittfvrw", sceFreeTypeOlFtaAddModule_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleAutofitter_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("r2C1PcTDYxk", sceFreeTypeOlFtaAddModuleAutofitter_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleBdf_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("1gAJb1uKyGo", sceFreeTypeOlFtaAddModuleBdf_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleCff_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("IjquEAbfizc", sceFreeTypeOlFtaAddModuleCff_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleGxvalid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("L-qInx9Dldk", sceFreeTypeOlFtaAddModuleGxvalid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleOtvalid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("mhK+E1i3VuE", sceFreeTypeOlFtaAddModuleOtvalid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModulePcf_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("bAbUJvsiVdI", sceFreeTypeOlFtaAddModulePcf_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModulePfr_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("1GYsjUC-HLM", sceFreeTypeOlFtaAddModulePfr_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModulePsaux_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("KLaWCpRxYWo", sceFreeTypeOlFtaAddModulePsaux_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModulePshinter_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("qodr9TJuFds", sceFreeTypeOlFtaAddModulePshinter_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModulePsnames_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("Ic8JMhUFe88", sceFreeTypeOlFtaAddModulePsnames_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleRaster1_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("CIrV8Sq2Uic", sceFreeTypeOlFtaAddModuleRaster1_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaAddModuleRaster5_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } APS5_EXPORT("wbyY8kfNfaI", sceFreeTypeOlFtaAddModuleRaster5_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaAddModuleSfnt_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("eS+4GhL28gs", sceFreeTypeOlFtaAddModuleSfnt_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleSmooth_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("XpA3dnvjl8w", sceFreeTypeOlFtaAddModuleSmooth_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaAddModuleSmoothLcd_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } @@ -90,101 +20,11 @@ int APS5_VABI sceFreeTypeOlFtaAddModuleSmoothLcdv_nid_no_patch() { } APS5_EXPORT("xcJCXHqBrjE", sceFreeTypeOlFtaAddModuleSmoothLcdv_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaAddModuleT1cid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("oKG-LjaBzzs", sceFreeTypeOlFtaAddModuleT1cid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleTruetype_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("zxsyxyiLthM", sceFreeTypeOlFtaAddModuleTruetype_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleType1_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("+v66TBg7tzA", sceFreeTypeOlFtaAddModuleType1_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleType42_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("ZYpIYZg3Jf4", sceFreeTypeOlFtaAddModuleType42_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaAddModuleWinfonts_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("JSi+hWkA9pI", sceFreeTypeOlFtaAddModuleWinfonts_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleAutofitter_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("bZYqFlUVPCY", sceFreeTypeOlFtaExportModuleAutofitter_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleBdf_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("ZhVdSRyrpUI", sceFreeTypeOlFtaExportModuleBdf_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleCff_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("phi4au-2t04", sceFreeTypeOlFtaExportModuleCff_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleGxvalid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("qC+tiGwcW7E", sceFreeTypeOlFtaExportModuleGxvalid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleOtvalid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("rl7aW17qQb8", sceFreeTypeOlFtaExportModuleOtvalid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModulePcf_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("-qwk1RxUuDA", sceFreeTypeOlFtaExportModulePcf_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModulePfr_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("mQYQAi8B0Yo", sceFreeTypeOlFtaExportModulePfr_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModulePsaux_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("4TJ1qJGXAV8", sceFreeTypeOlFtaExportModulePsaux_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModulePshinter_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("IewcaRR3F8I", sceFreeTypeOlFtaExportModulePshinter_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModulePsnames_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("vuuFugcw5ss", sceFreeTypeOlFtaExportModulePsnames_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleRaster1_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("xaswa+ndZS0", sceFreeTypeOlFtaExportModuleRaster1_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaExportModuleRaster5_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } APS5_EXPORT("6zDeyzjWz-8", sceFreeTypeOlFtaExportModuleRaster5_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaExportModuleSfnt_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("5-z1quqcDYo", sceFreeTypeOlFtaExportModuleSfnt_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleSmooth_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("VVfxa65sWF0", sceFreeTypeOlFtaExportModuleSmooth_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaExportModuleSmoothLcd_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } @@ -195,101 +35,11 @@ int APS5_VABI sceFreeTypeOlFtaExportModuleSmoothLcdv_nid_no_patch() { } APS5_EXPORT("q7kTOFaQrW4", sceFreeTypeOlFtaExportModuleSmoothLcdv_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaExportModuleT1cid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("aX8PI-h3+dE", sceFreeTypeOlFtaExportModuleT1cid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleTruetype_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("KIKL0rz6o-A", sceFreeTypeOlFtaExportModuleTruetype_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleType1_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("QPh+yb2Y8AQ", sceFreeTypeOlFtaExportModuleType1_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleType42_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("u36SHyuWQCA", sceFreeTypeOlFtaExportModuleType42_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaExportModuleWinfonts_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("ZHsmiChQLTk", sceFreeTypeOlFtaExportModuleWinfonts_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleAutofitter_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("q2ESpjCIk7w", sceFreeTypeOlFtaRemoveModuleAutofitter_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleBdf_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("C0nVvG6+x-s", sceFreeTypeOlFtaRemoveModuleBdf_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleCff_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("DIIRFBxRfMQ", sceFreeTypeOlFtaRemoveModuleCff_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleGxvalid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("s3qCnsS3ATE", sceFreeTypeOlFtaRemoveModuleGxvalid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleOtvalid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("OutzOzZp6-w", sceFreeTypeOlFtaRemoveModuleOtvalid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModulePcf_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("E9y7-AmuziU", sceFreeTypeOlFtaRemoveModulePcf_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModulePfr_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("-whG27+m+C0", sceFreeTypeOlFtaRemoveModulePfr_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModulePsaux_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("wGGhfabJAbs", sceFreeTypeOlFtaRemoveModulePsaux_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModulePshinter_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("KuJkc0qDvOQ", sceFreeTypeOlFtaRemoveModulePshinter_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModulePsnames_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("jqMurvieLBk", sceFreeTypeOlFtaRemoveModulePsnames_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleRaster1_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("z9YQIyuTMV4", sceFreeTypeOlFtaRemoveModuleRaster1_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaRemoveModuleRaster5_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } APS5_EXPORT("SKUldaN3e2A", sceFreeTypeOlFtaRemoveModuleRaster5_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaRemoveModuleSfnt_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("50HTRXvbW-k", sceFreeTypeOlFtaRemoveModuleSfnt_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleSmooth_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("M5dtVv0ln5Q", sceFreeTypeOlFtaRemoveModuleSmooth_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaRemoveModuleSmoothLcd_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } @@ -300,36 +50,6 @@ int APS5_VABI sceFreeTypeOlFtaRemoveModuleSmoothLcdv_nid_no_patch() { } APS5_EXPORT("6z2P2V2XCiI", sceFreeTypeOlFtaRemoveModuleSmoothLcdv_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaRemoveModuleT1cid_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("MJVrwM6aTTk", sceFreeTypeOlFtaRemoveModuleT1cid_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleTruetype_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("EveUtaCYQgk", sceFreeTypeOlFtaRemoveModuleTruetype_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleType1_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("B7Sw-iUs7e4", sceFreeTypeOlFtaRemoveModuleType1_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleType42_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("RM21Fgm0ZvQ", sceFreeTypeOlFtaRemoveModuleType42_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaRemoveModuleWinfonts_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("OmxJF0FvwWc", sceFreeTypeOlFtaRemoveModuleWinfonts_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaSupportFormatBdf_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("4to3tThESn0", sceFreeTypeOlFtaSupportFormatBdf_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaSupportFormatCid_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } @@ -350,16 +70,6 @@ int APS5_VABI sceFreeTypeOlFtaSupportFormatOpenTypeTtf_nid_no_patch() { } APS5_EXPORT("J3HnvW8FJV8", sceFreeTypeOlFtaSupportFormatOpenTypeTtf_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaSupportFormatPcf_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("2D3H+1nhwqQ", sceFreeTypeOlFtaSupportFormatPcf_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaSupportFormatPfr_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("upeKra1FaQk", sceFreeTypeOlFtaSupportFormatPfr_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaSupportFormatTrueType_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } @@ -380,36 +90,16 @@ int APS5_VABI sceFreeTypeOlFtaSupportFormatType42_nid_no_patch() { } APS5_EXPORT("xqjAbn8VNGo", sceFreeTypeOlFtaSupportFormatType42_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaSupportFormatWinFonts_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("Yu7mmGCjSYM", sceFreeTypeOlFtaSupportFormatWinFonts_nid_no_patch); - -int APS5_VABI sceFreeTypeOlFtaSupportHinterAutoFitter_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("SDPzjFN7y4E", sceFreeTypeOlFtaSupportHinterAutoFitter_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaSupportModules_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } APS5_EXPORT("oM0zMNCfXKM", sceFreeTypeOlFtaSupportModules_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaSupportRendererRaster1_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("3dTNNBoujn0", sceFreeTypeOlFtaSupportRendererRaster1_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaSupportRendererRaster5_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } APS5_EXPORT("Tzm-z36UYKg", sceFreeTypeOlFtaSupportRendererRaster5_nid_no_patch); -int APS5_VABI sceFreeTypeOlFtaSupportRendererSmooth_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("b7S96aD8dkE", sceFreeTypeOlFtaSupportRendererSmooth_nid_no_patch); - int APS5_VABI sceFreeTypeOlFtaSupportRendererSmoothLcd_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } @@ -420,49 +110,9 @@ int APS5_VABI sceFreeTypeOlFtaSupportRendererSmoothLcdv_nid_no_patch() { } APS5_EXPORT("Ns9a-LjOcDw", sceFreeTypeOlFtaSupportRendererSmoothLcdv_nid_no_patch); -int APS5_VABI sceFreeTypeOlAddModule_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("LonHHN98tMI", sceFreeTypeOlAddModule_nid_no_patch); - -int APS5_VABI sceFreeTypeOlAlloc_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("Uw+BZJpflxk", sceFreeTypeOlAlloc_nid_no_patch); - -int APS5_VABI sceFreeTypeOlAttachStream_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("ZqvTX8u1bEc", sceFreeTypeOlAttachStream_nid_no_patch); - -int APS5_VABI sceFreeTypeOlCMapDone_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("h0n4Fb9j2R8", sceFreeTypeOlCMapDone_nid_no_patch); - -int APS5_VABI sceFreeTypeOlCMapNew_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("wLqQQWyOdpc", sceFreeTypeOlCMapNew_nid_no_patch); - -int APS5_VABI sceFreeTypeOlDoneGlyphSlot_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("oJm1lThZ3iQ", sceFreeTypeOlDoneGlyphSlot_nid_no_patch); - int APS5_VABI sceFreeTypeOlDoneMemory_nid_no_patch() { NotImplemented_nid_no_patch(__func__); } APS5_EXPORT("UTumVjeIQtg", sceFreeTypeOlDoneMemory_nid_no_patch); -int APS5_VABI sceFreeTypeOlFree_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("fHMsRluEMfI", sceFreeTypeOlFree_nid_no_patch); - -int APS5_VABI sceFreeTypeOlGetModuleInterface_nid_no_patch() { - NotImplemented_nid_no_patch(__func__); -} -APS5_EXPORT("5NYsP564wwY", sceFreeTypeOlGetModuleInterface_nid_no_patch); - } diff --git a/core/libs/prx/libSceFreeTypeOl/ModuleWrappers.cpp b/core/libs/prx/libSceFreeTypeOl/ModuleWrappers.cpp new file mode 100644 index 0000000000..36d54bd353 --- /dev/null +++ b/core/libs/prx/libSceFreeTypeOl/ModuleWrappers.cpp @@ -0,0 +1,424 @@ +#include "prx/libSceFreeType/include/Api.hpp" +#include "prx/libc/include/General.hpp" + +#include +#include FT_MODULE_H +#include +#include + +#include + +using namespace FreeType; + +extern "C" { +extern const FT_Module_Class gxv_module_class; +extern const FT_Module_Class otv_module_class; +extern const FT_Module_Class autofit_module_class; +extern const FT_Driver_ClassRec bdf_driver_class; +extern const FT_Driver_ClassRec cff_driver_class; +extern const FT_Driver_ClassRec pcf_driver_class; +extern const FT_Driver_ClassRec pfr_driver_class; +extern const FT_Module_Class psaux_module_class; +extern const FT_Module_Class pshinter_module_class; +extern const FT_Module_Class psnames_module_class; +extern const FT_Renderer_Class ft_raster1_renderer_class; +extern const FT_Module_Class sfnt_module_class; +extern const FT_Renderer_Class ft_smooth_renderer_class; +extern const FT_Driver_ClassRec t1cid_driver_class; +extern const FT_Driver_ClassRec tt_driver_class; +extern const FT_Driver_ClassRec t1_driver_class; +extern const FT_Driver_ClassRec t42_driver_class; +extern const FT_Driver_ClassRec winfnt_driver_class; +} + +namespace { +template +const FT_Module_Class* ModuleClass(const T& value) { + return reinterpret_cast(&value); +} + +int AddModule(void* library, const FT_Module_Class* module) { + const auto host = static_cast(library); + if (!host) return 0x21; + if (!module) return 6; + const auto existing = FT_Get_Module(host, module->module_name); + if (existing && module->module_version <= existing->clazz->module_version) return 5; + return FT_Add_Module(host, module); +} + +int SupportModule(void* library, const FT_Module_Class* module) { + const int error = AddModule(library, module); + return error == 5 ? 0 : error; +} + +int RemoveModule(void* library, const char* name) { + const auto host = static_cast(library); + if (!host) return 0x21; + FT_Module module = FT_Get_Module(host, name); + if (!module) return 0; + FT_Remove_Module(host, module); + return 0; +} +} + +extern "C" { +int APS5_VABI sceFreeTypeOlFtaAddModule_nid_postfix(void* library, void* module) { + return AddModule(library, static_cast(module)); +} +APS5_EXPORT("mCIXittfvrw", sceFreeTypeOlFtaAddModule_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleAutofitter_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(autofit_module_class)); +} +APS5_EXPORT("r2C1PcTDYxk", sceFreeTypeOlFtaAddModuleAutofitter_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleBdf_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(bdf_driver_class)); +} +APS5_EXPORT("1gAJb1uKyGo", sceFreeTypeOlFtaAddModuleBdf_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleCff_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(cff_driver_class)); +} +APS5_EXPORT("IjquEAbfizc", sceFreeTypeOlFtaAddModuleCff_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModulePcf_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(pcf_driver_class)); +} +APS5_EXPORT("bAbUJvsiVdI", sceFreeTypeOlFtaAddModulePcf_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModulePfr_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(pfr_driver_class)); +} +APS5_EXPORT("1GYsjUC-HLM", sceFreeTypeOlFtaAddModulePfr_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModulePsaux_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(psaux_module_class)); +} +APS5_EXPORT("KLaWCpRxYWo", sceFreeTypeOlFtaAddModulePsaux_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModulePshinter_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(pshinter_module_class)); +} +APS5_EXPORT("qodr9TJuFds", sceFreeTypeOlFtaAddModulePshinter_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModulePsnames_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(psnames_module_class)); +} +APS5_EXPORT("Ic8JMhUFe88", sceFreeTypeOlFtaAddModulePsnames_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleRaster1_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(ft_raster1_renderer_class)); +} +APS5_EXPORT("CIrV8Sq2Uic", sceFreeTypeOlFtaAddModuleRaster1_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleSfnt_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(sfnt_module_class)); +} +APS5_EXPORT("eS+4GhL28gs", sceFreeTypeOlFtaAddModuleSfnt_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleSmooth_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(ft_smooth_renderer_class)); +} +APS5_EXPORT("XpA3dnvjl8w", sceFreeTypeOlFtaAddModuleSmooth_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleT1cid_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(t1cid_driver_class)); +} +APS5_EXPORT("oKG-LjaBzzs", sceFreeTypeOlFtaAddModuleT1cid_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleTruetype_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(tt_driver_class)); +} +APS5_EXPORT("zxsyxyiLthM", sceFreeTypeOlFtaAddModuleTruetype_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleType1_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(t1_driver_class)); +} +APS5_EXPORT("+v66TBg7tzA", sceFreeTypeOlFtaAddModuleType1_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleType42_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(t42_driver_class)); +} +APS5_EXPORT("ZYpIYZg3Jf4", sceFreeTypeOlFtaAddModuleType42_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleWinfonts_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(winfnt_driver_class)); +} +APS5_EXPORT("JSi+hWkA9pI", sceFreeTypeOlFtaAddModuleWinfonts_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleAutofitter_nid_postfix() { + return const_cast(ModuleClass(autofit_module_class)); +} +APS5_EXPORT("bZYqFlUVPCY", sceFreeTypeOlFtaExportModuleAutofitter_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleBdf_nid_postfix() { + return const_cast(ModuleClass(bdf_driver_class)); +} +APS5_EXPORT("ZhVdSRyrpUI", sceFreeTypeOlFtaExportModuleBdf_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleCff_nid_postfix() { + return const_cast(ModuleClass(cff_driver_class)); +} +APS5_EXPORT("phi4au-2t04", sceFreeTypeOlFtaExportModuleCff_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModulePcf_nid_postfix() { + return const_cast(ModuleClass(pcf_driver_class)); +} +APS5_EXPORT("-qwk1RxUuDA", sceFreeTypeOlFtaExportModulePcf_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModulePfr_nid_postfix() { + return const_cast(ModuleClass(pfr_driver_class)); +} +APS5_EXPORT("mQYQAi8B0Yo", sceFreeTypeOlFtaExportModulePfr_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModulePsaux_nid_postfix() { + return const_cast(ModuleClass(psaux_module_class)); +} +APS5_EXPORT("4TJ1qJGXAV8", sceFreeTypeOlFtaExportModulePsaux_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModulePshinter_nid_postfix() { + return const_cast(ModuleClass(pshinter_module_class)); +} +APS5_EXPORT("IewcaRR3F8I", sceFreeTypeOlFtaExportModulePshinter_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModulePsnames_nid_postfix() { + return const_cast(ModuleClass(psnames_module_class)); +} +APS5_EXPORT("vuuFugcw5ss", sceFreeTypeOlFtaExportModulePsnames_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleRaster1_nid_postfix() { + return const_cast(ModuleClass(ft_raster1_renderer_class)); +} +APS5_EXPORT("xaswa+ndZS0", sceFreeTypeOlFtaExportModuleRaster1_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleSfnt_nid_postfix() { + return const_cast(ModuleClass(sfnt_module_class)); +} +APS5_EXPORT("5-z1quqcDYo", sceFreeTypeOlFtaExportModuleSfnt_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleSmooth_nid_postfix() { + return const_cast(ModuleClass(ft_smooth_renderer_class)); +} +APS5_EXPORT("VVfxa65sWF0", sceFreeTypeOlFtaExportModuleSmooth_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleT1cid_nid_postfix() { + return const_cast(ModuleClass(t1cid_driver_class)); +} +APS5_EXPORT("aX8PI-h3+dE", sceFreeTypeOlFtaExportModuleT1cid_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleTruetype_nid_postfix() { + return const_cast(ModuleClass(tt_driver_class)); +} +APS5_EXPORT("KIKL0rz6o-A", sceFreeTypeOlFtaExportModuleTruetype_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleType1_nid_postfix() { + return const_cast(ModuleClass(t1_driver_class)); +} +APS5_EXPORT("QPh+yb2Y8AQ", sceFreeTypeOlFtaExportModuleType1_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleType42_nid_postfix() { + return const_cast(ModuleClass(t42_driver_class)); +} +APS5_EXPORT("u36SHyuWQCA", sceFreeTypeOlFtaExportModuleType42_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleWinfonts_nid_postfix() { + return const_cast(ModuleClass(winfnt_driver_class)); +} +APS5_EXPORT("ZHsmiChQLTk", sceFreeTypeOlFtaExportModuleWinfonts_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleAutofitter_nid_postfix(void* library) { + return RemoveModule(library, "autofitter"); +} +APS5_EXPORT("q2ESpjCIk7w", sceFreeTypeOlFtaRemoveModuleAutofitter_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleBdf_nid_postfix(void* library) { + return RemoveModule(library, "bdf"); +} +APS5_EXPORT("C0nVvG6+x-s", sceFreeTypeOlFtaRemoveModuleBdf_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleCff_nid_postfix(void* library) { + return RemoveModule(library, "cff"); +} +APS5_EXPORT("DIIRFBxRfMQ", sceFreeTypeOlFtaRemoveModuleCff_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModulePcf_nid_postfix(void* library) { + return RemoveModule(library, "pcf"); +} +APS5_EXPORT("E9y7-AmuziU", sceFreeTypeOlFtaRemoveModulePcf_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModulePfr_nid_postfix(void* library) { + return RemoveModule(library, "pfr"); +} +APS5_EXPORT("-whG27+m+C0", sceFreeTypeOlFtaRemoveModulePfr_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModulePsaux_nid_postfix(void* library) { + return RemoveModule(library, "psaux"); +} +APS5_EXPORT("wGGhfabJAbs", sceFreeTypeOlFtaRemoveModulePsaux_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModulePshinter_nid_postfix(void* library) { + return RemoveModule(library, "pshinter"); +} +APS5_EXPORT("KuJkc0qDvOQ", sceFreeTypeOlFtaRemoveModulePshinter_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModulePsnames_nid_postfix(void* library) { + return RemoveModule(library, "psnames"); +} +APS5_EXPORT("jqMurvieLBk", sceFreeTypeOlFtaRemoveModulePsnames_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleRaster1_nid_postfix(void* library) { + return RemoveModule(library, "raster1"); +} +APS5_EXPORT("z9YQIyuTMV4", sceFreeTypeOlFtaRemoveModuleRaster1_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleSfnt_nid_postfix(void* library) { + return RemoveModule(library, "sfnt"); +} +APS5_EXPORT("50HTRXvbW-k", sceFreeTypeOlFtaRemoveModuleSfnt_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleSmooth_nid_postfix(void* library) { + return RemoveModule(library, "smooth"); +} +APS5_EXPORT("M5dtVv0ln5Q", sceFreeTypeOlFtaRemoveModuleSmooth_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleT1cid_nid_postfix(void* library) { + return RemoveModule(library, "t1cid"); +} +APS5_EXPORT("MJVrwM6aTTk", sceFreeTypeOlFtaRemoveModuleT1cid_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleTruetype_nid_postfix(void* library) { + return RemoveModule(library, "truetype"); +} +APS5_EXPORT("EveUtaCYQgk", sceFreeTypeOlFtaRemoveModuleTruetype_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleType1_nid_postfix(void* library) { + return RemoveModule(library, "type1"); +} +APS5_EXPORT("B7Sw-iUs7e4", sceFreeTypeOlFtaRemoveModuleType1_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleType42_nid_postfix(void* library) { + return RemoveModule(library, "type42"); +} +APS5_EXPORT("RM21Fgm0ZvQ", sceFreeTypeOlFtaRemoveModuleType42_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleWinfonts_nid_postfix(void* library) { + return RemoveModule(library, "winfonts"); +} +APS5_EXPORT("OmxJF0FvwWc", sceFreeTypeOlFtaRemoveModuleWinfonts_nid_postfix); + +int APS5_VABI sceFreeTypeOlAddModule_nid_postfix(void* library, void* module) { + return AddModule(library, static_cast(module)); +} +APS5_EXPORT("LonHHN98tMI", sceFreeTypeOlAddModule_nid_postfix); + +int APS5_VABI sceFreeTypeOlAlloc_nid_postfix(GuestMemoryRec* memory, std::int64_t size, void** output) { + if (output) *output = nullptr; + if (!memory || !memory->alloc || !output || size < 0) return 6; + if (size == 0) return 0; + *output = memory->alloc(memory, size); + return *output ? 0 : 64; +} +APS5_EXPORT("Uw+BZJpflxk", sceFreeTypeOlAlloc_nid_postfix); + +void APS5_VABI sceFreeTypeOlFree_nid_postfix(GuestMemoryRec* memory, void** block) { + if (!memory || !memory->free || !block || !*block) return; + memory->free(memory, *block); + *block = nullptr; +} +APS5_EXPORT("fHMsRluEMfI", sceFreeTypeOlFree_nid_postfix); + +const void* APS5_VABI sceFreeTypeOlGetModuleInterface_nid_postfix(void* library, const char* name) { + return library && name ? FT_Get_Module_Interface(static_cast(library), name) : nullptr; +} +APS5_EXPORT("5NYsP564wwY", sceFreeTypeOlGetModuleInterface_nid_postfix); + + +void APS5_VABI sceFreeTypeOlFtaAddModuleGxvalid_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(gxv_module_class)); +} +APS5_EXPORT("L-qInx9Dldk", sceFreeTypeOlFtaAddModuleGxvalid_nid_postfix); + +void APS5_VABI sceFreeTypeOlFtaAddModuleOtvalid_nid_postfix(void* library) { + (void)AddModule(library, ModuleClass(otv_module_class)); +} +APS5_EXPORT("mhK+E1i3VuE", sceFreeTypeOlFtaAddModuleOtvalid_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleGxvalid_nid_postfix() { + return const_cast(ModuleClass(gxv_module_class)); +} +APS5_EXPORT("qC+tiGwcW7E", sceFreeTypeOlFtaExportModuleGxvalid_nid_postfix); + +void* APS5_VABI sceFreeTypeOlFtaExportModuleOtvalid_nid_postfix() { + return const_cast(ModuleClass(otv_module_class)); +} +APS5_EXPORT("rl7aW17qQb8", sceFreeTypeOlFtaExportModuleOtvalid_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleGxvalid_nid_postfix(void* library) { + return RemoveModule(library, "gxvalid"); +} +APS5_EXPORT("s3qCnsS3ATE", sceFreeTypeOlFtaRemoveModuleGxvalid_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaRemoveModuleOtvalid_nid_postfix(void* library) { + return RemoveModule(library, "otvalid"); +} +APS5_EXPORT("OutzOzZp6-w", sceFreeTypeOlFtaRemoveModuleOtvalid_nid_postfix); + + +int APS5_VABI sceFreeTypeOlFtaSupportFormatBdf_nid_postfix(void* library) { + return SupportModule(library, ModuleClass(bdf_driver_class)); +} +APS5_EXPORT("4to3tThESn0", sceFreeTypeOlFtaSupportFormatBdf_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaSupportFormatPcf_nid_postfix(void* library) { + return SupportModule(library, ModuleClass(pcf_driver_class)); +} +APS5_EXPORT("2D3H+1nhwqQ", sceFreeTypeOlFtaSupportFormatPcf_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaSupportFormatPfr_nid_postfix(void* library) { + return SupportModule(library, ModuleClass(pfr_driver_class)); +} +APS5_EXPORT("upeKra1FaQk", sceFreeTypeOlFtaSupportFormatPfr_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaSupportFormatWinFonts_nid_postfix(void* library) { + return SupportModule(library, ModuleClass(winfnt_driver_class)); +} +APS5_EXPORT("Yu7mmGCjSYM", sceFreeTypeOlFtaSupportFormatWinFonts_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaSupportHinterAutoFitter_nid_postfix(void* library) { + return SupportModule(library, ModuleClass(autofit_module_class)); +} +APS5_EXPORT("SDPzjFN7y4E", sceFreeTypeOlFtaSupportHinterAutoFitter_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaSupportRendererRaster1_nid_postfix(void* library) { + return SupportModule(library, ModuleClass(ft_raster1_renderer_class)); +} +APS5_EXPORT("3dTNNBoujn0", sceFreeTypeOlFtaSupportRendererRaster1_nid_postfix); + +int APS5_VABI sceFreeTypeOlFtaSupportRendererSmooth_nid_postfix(void* library) { + return SupportModule(library, ModuleClass(ft_smooth_renderer_class)); +} +APS5_EXPORT("b7S96aD8dkE", sceFreeTypeOlFtaSupportRendererSmooth_nid_postfix); + + +int APS5_VABI sceFreeTypeOlAttachStream_nid_postfix(FT_Face face, FT_Open_Args* args) { + return FT_Attach_Stream(face, args); +} +APS5_EXPORT("ZqvTX8u1bEc", sceFreeTypeOlAttachStream_nid_postfix); + +void APS5_VABI sceFreeTypeOlCMapDone_nid_postfix(FT_CMap cmap) { + FT_CMap_Done(cmap); +} +APS5_EXPORT("h0n4Fb9j2R8", sceFreeTypeOlCMapDone_nid_postfix); + +int APS5_VABI sceFreeTypeOlCMapNew_nid_postfix(FT_CMap_Class clazz, FT_Pointer initData, FT_CharMap charmap, FT_CMap* output) { + return FT_CMap_New(clazz, initData, charmap, output); +} +APS5_EXPORT("wLqQQWyOdpc", sceFreeTypeOlCMapNew_nid_postfix); + +void APS5_VABI sceFreeTypeOlDoneGlyphSlot_nid_postfix(FT_GlyphSlot slot) { + FT_Done_GlyphSlot(slot); +} +APS5_EXPORT("oJm1lThZ3iQ", sceFreeTypeOlDoneGlyphSlot_nid_postfix); + +} diff --git a/core/libs/prx/libSceFreeTypeOl/libSceFreeTypeOl.hpp b/core/libs/prx/libSceFreeTypeOl/libSceFreeTypeOl.hpp index e1970ef93b..554a6362ec 100644 --- a/core/libs/prx/libSceFreeTypeOl/libSceFreeTypeOl.hpp +++ b/core/libs/prx/libSceFreeTypeOl/libSceFreeTypeOl.hpp @@ -1,3 +1,78 @@ #pragma once #include "prx/libSceFreeType/include/Api.hpp" + +extern "C" { +int APS5_VABI sceFreeTypeOlAttachStream_nid_postfix(void* face, void* args); +void APS5_VABI sceFreeTypeOlCMapDone_nid_postfix(void* cmap); +int APS5_VABI sceFreeTypeOlCMapNew_nid_postfix(void* clazz, void* initData, void* charmap, void** output); +void APS5_VABI sceFreeTypeOlDoneGlyphSlot_nid_postfix(void* slot); +int APS5_VABI sceFreeTypeOlFtaSupportFormatBdf_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaSupportFormatPcf_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaSupportFormatPfr_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaSupportFormatWinFonts_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaSupportHinterAutoFitter_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaSupportRendererRaster1_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaSupportRendererSmooth_nid_postfix(void* library); + +void APS5_VABI sceFreeTypeOlFtaAddModuleGxvalid_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleOtvalid_nid_postfix(void* library); +void* APS5_VABI sceFreeTypeOlFtaExportModuleGxvalid_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleOtvalid_nid_postfix(); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleGxvalid_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleOtvalid_nid_postfix(void* library); + +int APS5_VABI sceFreeTypeOlAddModule_nid_postfix(void* library, void* module); +int APS5_VABI sceFreeTypeOlAlloc_nid_postfix(FreeType::GuestMemoryRec* memory, std::int64_t size, void** output); +void APS5_VABI sceFreeTypeOlFree_nid_postfix(FreeType::GuestMemoryRec* memory, void** block); +void APS5_VABI sceFreeTypeOlFtaAddModuleAutofitter_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleBdf_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleCff_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModulePcf_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModulePfr_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModulePsaux_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModulePshinter_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModulePsnames_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleRaster1_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleSfnt_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleSmooth_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleT1cid_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleTruetype_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleType1_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleType42_nid_postfix(void* library); +void APS5_VABI sceFreeTypeOlFtaAddModuleWinfonts_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaAddModule_nid_postfix(void* library, void* module); +void* APS5_VABI sceFreeTypeOlFtaExportModuleAutofitter_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleBdf_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleCff_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModulePcf_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModulePfr_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModulePsaux_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModulePshinter_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModulePsnames_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleRaster1_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleSfnt_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleSmooth_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleT1cid_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleTruetype_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleType1_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleType42_nid_postfix(); +void* APS5_VABI sceFreeTypeOlFtaExportModuleWinfonts_nid_postfix(); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleAutofitter_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleBdf_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleCff_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModulePcf_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModulePfr_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModulePsaux_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModulePshinter_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModulePsnames_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleRaster1_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleSfnt_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleSmooth_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleT1cid_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleTruetype_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleType1_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleType42_nid_postfix(void* library); +int APS5_VABI sceFreeTypeOlFtaRemoveModuleWinfonts_nid_postfix(void* library); +const void* APS5_VABI sceFreeTypeOlGetModuleInterface_nid_postfix(void* library, const char* name); +} diff --git a/core/libs/tests/GuestFreeTypeOlModules.cpp b/core/libs/tests/GuestFreeTypeOlModules.cpp new file mode 100644 index 0000000000..268077c0fd --- /dev/null +++ b/core/libs/tests/GuestFreeTypeOlModules.cpp @@ -0,0 +1,69 @@ +#include "prx/libSceFreeTypeOl/libSceFreeTypeOl.hpp" + +#include +#include FT_FREETYPE_H +#include FT_MODULE_H +#include + +#include +#include +#include + +using FreeType::GuestMemoryRec; + +static void Require(bool condition, int line) { + if (!condition) { + std::fprintf(stderr, "FreeTypeOl module check failed at line %d\n", line); + std::abort(); + } +} + +#define REQUIRE(condition) Require((condition), __LINE__) + +static void* APS5_VABI Allocate(GuestMemoryRec*, std::int64_t size) { + return std::malloc(static_cast(size)); +} + +static void APS5_VABI Release(GuestMemoryRec*, void* block) { + std::free(block); +} + +int main() { + FT_Library native = nullptr; + REQUIRE(FT_Init_FreeType(&native) == 0); + + auto* autofitter = static_cast(sceFreeTypeOlFtaExportModuleAutofitter_nid_postfix()); + REQUIRE(autofitter != nullptr); + REQUIRE(autofitter->module_name != nullptr); + REQUIRE(FT_Get_Module(native, "autofitter") != nullptr); + REQUIRE(sceFreeTypeOlAddModule_nid_postfix(native, autofitter) == 5); + REQUIRE(sceFreeTypeOlFtaRemoveModuleAutofitter_nid_postfix(native) == 0); + REQUIRE(FT_Get_Module(native, "autofitter") == nullptr); + sceFreeTypeOlFtaAddModuleAutofitter_nid_postfix(native); + REQUIRE(FT_Get_Module(native, "autofitter") != nullptr); + + sceFreeTypeOlFtaAddModuleGxvalid_nid_postfix(native); + REQUIRE(FT_Get_Module(native, "gxvalid") != nullptr); + REQUIRE(sceFreeTypeOlFtaRemoveModuleGxvalid_nid_postfix(native) == 0); + sceFreeTypeOlFtaAddModuleOtvalid_nid_postfix(native); + REQUIRE(FT_Get_Module(native, "otvalid") != nullptr); + REQUIRE(sceFreeTypeOlFtaRemoveModuleOtvalid_nid_postfix(native) == 0); + + REQUIRE(sceFreeTypeOlFtaSupportFormatBdf_nid_postfix(native) == 0); + REQUIRE(sceFreeTypeOlFtaSupportRendererSmooth_nid_postfix(native) == 0); + REQUIRE(sceFreeTypeOlGetModuleInterface_nid_postfix(native, "truetype") == + FT_Get_Module_Interface(native, "truetype")); + + GuestMemoryRec memory{}; + memory.alloc = Allocate; + memory.free = Release; + void* block = nullptr; + REQUIRE(sceFreeTypeOlAlloc_nid_postfix(&memory, 24, &block) == 0); + REQUIRE(block != nullptr); + sceFreeTypeOlFree_nid_postfix(&memory, &block); + REQUIRE(block == nullptr); + REQUIRE(sceFreeTypeOlAlloc_nid_postfix(&memory, -1, &block) == 6); + REQUIRE(block == nullptr); + + REQUIRE(FT_Done_FreeType(native) == 0); +} diff --git a/docs/dev/debt/libSceFreeTypeOl.md b/docs/dev/debt/libSceFreeTypeOl.md index c8157499e6..8e7cb00dc6 100644 --- a/docs/dev/debt/libSceFreeTypeOl.md +++ b/docs/dev/debt/libSceFreeTypeOl.md @@ -1,5 +1,16 @@ # libSceFreeTypeOl technical debt -### Known export names; ABI prototypes unverified +### Remaining exports requiring Sony-specific or shared-state behavior -- The 92 `sceFreeTypeOl*_nid_no_patch` exports in [Export.cpp](../../../core/libs/prx/libSceFreeTypeOl/Export.cpp) are present in the PS5 3.20 export inventory from [PS5-3.20_Libs](https://github.com/DNNDHH/PS5-3.20_Libs). The [verified NID name database](https://github.com/zecoxao/sce_symbols/blob/2883963a0a514ba6e77407a08ef4730a65e88254/aerolib.csv) names their NIDs, and the NID of each name matches: the 83 `FTA_*` module and format helpers, `FT_Add_Module`, `FT_Alloc`, `FT_Attach_Stream`, `FT_CMap_Done`, `FT_CMap_New`, `FT_Done_GlyphSlot`, `FT_Done_Memory`, `FT_Free` and `FT_Get_Module_Interface`. Each helper is named after its symbol and keeps the explicit inventory alias. Their prototypes and behavior are unverified; each uses the no-parameter import-resolution convention and throws through `NotImplemented_nid_no_patch`, and the separate libSceFreeType implementations do not supply this provider. These declarations make no ABI or behavior claim. +The PS5 3.20 export inventory and verified NID-name database identify 92 exports in this library. The decrypted local PS5 13.60 `libSceFreeTypeOl.sprx` (SHA-256 `61E0CDB1628968A9D26790D8F6C2874C0CBF86193DC1762BA83E434CF229BADA`) was analyzed locally with Ghidra; no binary or decompilation is included in this repository. The analysis confirmed the FreeType wrapper signatures and the shared-library module lifecycle. + +Seventy exports now forward to the bundled FreeType implementation: add/export/remove helpers for the 18 available module classes, the basic module support helpers, allocator/free, module-interface lookup, module registration, stream attachment, charmap lifecycle, and glyph-slot destruction. The implementation uses the matching FreeType 2.13 internal APIs and preserves the PS5 duplicate-module result behavior. Focused coverage is in `GuestFreeTypeOlModules.cpp`. + +The remaining 22 exports deliberately retain `NotImplemented_nid_no_patch` because their behavior cannot be represented by the currently bundled FreeType modules or its per-library state: + +- Raster5 add/export/remove/support (`wbyY8kfNfaI`, `6zDeyzjWz-8`, `SKUldaN3e2A`, `Tzm-z36UYKg`): the Sony Raster5 module is absent from the bundled FreeType sources. +- Smooth LCD and LCD vertical add/export/remove/support (`NLA7bmDS1jc`, `xcJCXHqBrjE`, `+bRRhPeBqZI`, `q7kTOFaQrW4`, `xtb9fOR6ilA`, `6z2P2V2XCiI`, `M94SjXo-UVA`, `Ns9a-LjOcDw`): Sony exports distinct renderer descriptors; the bundled library has one smooth renderer, so aliasing these descriptors would give incorrect add/remove behavior. +- Composite format/module configuration (`JuzrPZClLew`, `sylevnx-fqk`, `0RSuGozMl9o`, `J3HnvW8FJV8`, `YpxR8CqGMIM`, `83qtpn8+XnA`, `g2p7fkJpuC0`, `xqjAbn8VNGo`, `oM0zMNCfXKM`): these routines combine module registration with Sony-specific support-mask state. Implementing registration alone would omit observable state updates. +- `FT_Done_Memory` (`UTumVjeIQtg`): the export has no parameter and operates on a Sony-owned global memory manager; the host FreeType library exposes a separate manager for each library. + +Each remaining export keeps its original NID alias and throws through `NotImplemented_nid_no_patch` until its required implementation or state mapping is available.