Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e9ad5f57b | ||
|
|
ca62ad8d2b | ||
|
|
199c91cf36 | ||
|
|
13c41f1ab5 | ||
|
|
6c2d6f33c3 | ||
|
|
a246c178f5 | ||
|
|
75f2afacf8 | ||
|
|
aa94394adc | ||
|
|
1cc7c15163 | ||
|
|
43c8cf2d92 |
No files matched your search
@@ -1374,3 +1374,16 @@ if(BUILD_TESTING)
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibcInternal>")
|
||||
endif()
|
||||
endif()
|
||||
target_sources(libSceLibcInternal PRIVATE Multibyte.cpp)
|
||||
if(BUILD_TESTING)
|
||||
add_test_executable(guest_libc_internal_multibyte_tests ${LIBS_INCLUDE_DIR}/tests/GuestLibcInternalMultibyte.cpp)
|
||||
target_include_directories(guest_libc_internal_multibyte_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_libc_internal_multibyte_tests PRIVATE libSceLibcInternal libkernel libc)
|
||||
configure_windows_unwind(guest_libc_internal_multibyte_tests)
|
||||
add_test(NAME guest_libc_internal_multibyte COMMAND guest_libc_internal_multibyte_tests)
|
||||
set_tests_properties(guest_libc_internal_multibyte PROPERTIES TIMEOUT 20)
|
||||
if(WIN32)
|
||||
set_tests_properties(guest_libc_internal_multibyte PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibcInternal>")
|
||||
endif()
|
||||
endif()
|
||||
@@ -1150,11 +1150,6 @@ int APS5_VABI _Makewct_nid_postfix() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI _Mbtowc_nid_postfix() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI _Nnl_nid_postfix() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
|
||||
@@ -170,11 +170,6 @@ int APS5_VABI _Wcsftime_nid_postfix() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI _Wctomb_nid_postfix() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceLibcInternalUnknown_yc_vi84_2aE_nid_no_patch() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
#include "prx/libSceLibcInternal/include/InventoryExports2.hpp"
|
||||
#include "prx/libSceLibcInternal/include/RuntimeInternals.hpp"
|
||||
#include "prx/libc/include/Api.hpp"
|
||||
#include "prx/libc/include/General.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr std::size_t StateSize = 16;
|
||||
constexpr auto Invalid = static_cast<std::size_t>(-1);
|
||||
constexpr auto Incomplete = static_cast<std::size_t>(-2);
|
||||
|
||||
void CopyInChecked(void* destination, const void* source, std::size_t size, const char* function) {
|
||||
const int savedErrno = errno;
|
||||
const bool copied = GuestCopyIn_nid_no_patch(destination, source, size);
|
||||
errno = savedErrno;
|
||||
if (!copied) NotImplementedAt_nid_no_patch(function, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CopyOutChecked(void* destination, const void* source, std::size_t size, const char* function) {
|
||||
const int savedErrno = errno;
|
||||
const bool copied = GuestCopyOut_nid_no_patch(destination, source, size);
|
||||
errno = savedErrno;
|
||||
if (!copied) NotImplementedAt_nid_no_patch(function, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C" {
|
||||
|
||||
int APS5_VABI _Mbtowc_nid_postfix(std::uint16_t* destination, const char* source, std::size_t count, void* state) {
|
||||
thread_local std::array<unsigned char, StateSize> fallbackState{};
|
||||
if (source == nullptr) {
|
||||
std::array<unsigned char, StateSize> zero{};
|
||||
if (state != nullptr) {
|
||||
CopyOutChecked(state, zero.data(), zero.size(), __func__);
|
||||
} else {
|
||||
fallbackState = zero;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::array<unsigned char, StateSize> localState{};
|
||||
if (state != nullptr) {
|
||||
CopyInChecked(localState.data(), state, localState.size(), __func__);
|
||||
} else {
|
||||
localState = fallbackState;
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
for (std::size_t consumed = 0; consumed < count;) {
|
||||
char byte = 0;
|
||||
CopyInChecked(&byte, source + consumed, 1, __func__);
|
||||
++consumed;
|
||||
std::uint16_t decoded = 0;
|
||||
const std::size_t step = mbrtowc_nid_postfix(&decoded, &byte, 1, localState.data());
|
||||
if (step == Invalid) {
|
||||
return -1;
|
||||
}
|
||||
if (step != Incomplete) {
|
||||
if (destination != nullptr) {
|
||||
CopyOutChecked(destination, &decoded, sizeof(decoded), __func__);
|
||||
}
|
||||
if (state != nullptr) {
|
||||
CopyOutChecked(state, localState.data(), localState.size(), __func__);
|
||||
} else {
|
||||
fallbackState = localState;
|
||||
}
|
||||
return decoded == 0 ? 0 : static_cast<int>(consumed);
|
||||
}
|
||||
}
|
||||
|
||||
if (state != nullptr) {
|
||||
CopyOutChecked(state, localState.data(), localState.size(), __func__);
|
||||
} else {
|
||||
fallbackState = localState;
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
|
||||
int APS5_VABI _Wctomb_nid_postfix(char* destination, std::uint16_t value, void* state) {
|
||||
std::array<unsigned char, StateSize> localState{};
|
||||
if (state != nullptr) {
|
||||
CopyInChecked(localState.data(), state, localState.size(), __func__);
|
||||
}
|
||||
if (destination == nullptr) {
|
||||
if (state != nullptr) {
|
||||
std::array<unsigned char, StateSize> zero{};
|
||||
CopyOutChecked(state, zero.data(), zero.size(), __func__);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
char encoded[4]{};
|
||||
const std::size_t length = wcrtomb_nid_postfix(encoded, value, nullptr);
|
||||
CopyOutChecked(destination, encoded, length, __func__);
|
||||
return static_cast<int>(length);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@ int APS5_VABI _WGetfld_nid_postfix();
|
||||
void APS5_VABI _Unlock_spin_lock_nid_postfix(volatile char* lock, int mode = 0);
|
||||
int APS5_VABI _ZNKSt7_MpunctIcE11do_groupingEv_nid_postfix();
|
||||
void APS5_VABI _Setgloballocale_nid_postfix(void* pointer);
|
||||
int APS5_VABI _Wctomb_nid_postfix();
|
||||
int APS5_VABI _Wctomb_nid_postfix(char* destination, std::uint16_t value, void* state);
|
||||
int APS5_VABI _WGetint_nid_postfix();
|
||||
int APS5_VABI _WScanf_nid_postfix();
|
||||
int APS5_VABI _WFwprep_nid_postfix();
|
||||
|
||||
@@ -62,7 +62,7 @@ int APS5_VABI _Locvar_nid_postfix();
|
||||
int APS5_VABI _Makeloc_nid_postfix();
|
||||
int APS5_VABI _Makestab_nid_postfix();
|
||||
int APS5_VABI _Makewct_nid_postfix();
|
||||
int APS5_VABI _Mbtowc_nid_postfix();
|
||||
int APS5_VABI _Mbtowc_nid_postfix(std::uint16_t* destination, const char* source, std::size_t count, void* state);
|
||||
int APS5_VABI _Printf_nid_postfix();
|
||||
int APS5_VABI _Putfld_nid_postfix();
|
||||
int APS5_VABI _Putstr_nid_postfix();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
add_library(libScePosixForWebKit SHARED EXCLUDE_FROM_ALL Export.cpp Resolver.cpp Filesystem.cpp TemporaryFile.cpp Wrap.cpp)
|
||||
add_library(libScePosixForWebKit SHARED EXCLUDE_FROM_ALL Export.cpp Resolver.cpp Filesystem.cpp TemporaryFile.cpp Wrap.cpp FileTree.cpp)
|
||||
target_include_directories(libScePosixForWebKit PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(libScePosixForWebKit PRIVATE libSceNet libkernel_sys libSceLibcInternal)
|
||||
target_sources(libScePosixForWebKit PRIVATE Times.cpp)
|
||||
@@ -16,6 +16,16 @@ if(BUILD_TESTING)
|
||||
set_tests_properties(guest_posix_getpwuid PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libScePosixForWebKit>")
|
||||
endif()
|
||||
add_test_executable(guest_posix_nftw_tests ${LIBS_INCLUDE_DIR}/tests/GuestPosixNftw.cpp)
|
||||
target_include_directories(guest_posix_nftw_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_posix_nftw_tests PRIVATE libScePosixForWebKit libkernel libc)
|
||||
configure_windows_unwind(guest_posix_nftw_tests)
|
||||
add_test(NAME guest_posix_nftw COMMAND guest_posix_nftw_tests)
|
||||
set_tests_properties(guest_posix_nftw PROPERTIES TIMEOUT 20)
|
||||
if(WIN32)
|
||||
set_tests_properties(guest_posix_nftw PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libScePosixForWebKit>")
|
||||
endif()
|
||||
add_test_executable(guest_posix_getpwent_tests ${LIBS_INCLUDE_DIR}/tests/GuestPosixGetpwent.cpp)
|
||||
target_include_directories(guest_posix_getpwent_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_posix_getpwent_tests PRIVATE libScePosixForWebKit libc)
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
#include "prx/libkernel/include/Api.hpp"
|
||||
#include "prx/libc/include/Api.hpp"
|
||||
#include "prx/libc/include/GuestDirectory.hpp"
|
||||
#include "prx/libScePosixForWebKit/include/Api.hpp"
|
||||
#include "prx/libc/include/General.hpp"
|
||||
#include "prx/libc/include/general/VabiMacros.hpp"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int FtwPhys = 0x01;
|
||||
constexpr int FtwDepth = 0x04;
|
||||
constexpr int FtwF = 0;
|
||||
constexpr int FtwD = 1;
|
||||
constexpr int FtwDnr = 2;
|
||||
constexpr int FtwDp = 3;
|
||||
constexpr int FtwNs = 4;
|
||||
constexpr int FtwSl = 5;
|
||||
constexpr int FtwSln = 6;
|
||||
constexpr int GuestEinval = 22;
|
||||
constexpr std::uint16_t TypeMask = 0170000;
|
||||
constexpr std::uint16_t TypeDirectory = 0040000;
|
||||
constexpr std::uint16_t TypeLink = 0120000;
|
||||
|
||||
struct GuestFtw {
|
||||
int base;
|
||||
int level;
|
||||
};
|
||||
|
||||
using Callback = int (APS5_VABI *)(const char*, const void*, int, void*);
|
||||
|
||||
struct Identity {
|
||||
std::uint32_t device;
|
||||
std::uint32_t inode;
|
||||
};
|
||||
|
||||
struct Walk {
|
||||
Callback callback;
|
||||
bool physical;
|
||||
bool depth;
|
||||
std::vector<Identity> ancestors;
|
||||
};
|
||||
|
||||
bool IsLink(const FileStat& status) {
|
||||
return (status.st_mode & TypeMask) == TypeLink;
|
||||
}
|
||||
|
||||
bool IsDirectory(const FileStat& status) {
|
||||
return (status.st_mode & TypeMask) == TypeDirectory;
|
||||
}
|
||||
|
||||
int Invoke(Walk& walk, const std::string& path, const FileStat& status, int type, int base, int level) {
|
||||
GuestFtw info{base, level};
|
||||
return walk.callback(path.c_str(), &status, type, &info);
|
||||
}
|
||||
|
||||
std::string Join(const std::string& path, const std::string& name) {
|
||||
if (path.empty()) return name;
|
||||
if (path.back() == '/') return path + name;
|
||||
return path + "/" + name;
|
||||
}
|
||||
|
||||
int BasenameOffset(const std::string& path) {
|
||||
const auto slash = path.rfind('/');
|
||||
return slash == std::string::npos ? 0 : static_cast<int>(slash + 1);
|
||||
}
|
||||
|
||||
int Visit(Walk& walk, const std::string& path, int base, int level) {
|
||||
FileStat status{};
|
||||
const bool found = walk.physical ? lstat_nid_postfix(path.c_str(), &status) == 0 : stat_nid_postfix(path.c_str(), &status) == 0;
|
||||
if (!found) {
|
||||
FileStat link{};
|
||||
if (!walk.physical && lstat_nid_postfix(path.c_str(), &link) == 0 && IsLink(link))
|
||||
return Invoke(walk, path, link, FtwSln, base, level);
|
||||
return Invoke(walk, path, FileStat{}, FtwNs, base, level);
|
||||
}
|
||||
if (IsLink(status)) return Invoke(walk, path, status, FtwSl, base, level);
|
||||
if (!IsDirectory(status)) return Invoke(walk, path, status, FtwF, base, level);
|
||||
for (const Identity& ancestor : walk.ancestors)
|
||||
if (ancestor.device == status.st_dev && ancestor.inode == status.st_ino) return 0;
|
||||
if (!walk.depth) {
|
||||
const int before = Invoke(walk, path, status, FtwD, base, level);
|
||||
if (before != 0) return before;
|
||||
}
|
||||
void* handle = opendir_nid_postfix(path.c_str());
|
||||
if (handle == nullptr) return Invoke(walk, path, status, FtwDnr, base, level);
|
||||
std::vector<std::string> names;
|
||||
while (GuestDirectoryEntry* entry = readdir_nid_postfix(handle)) names.emplace_back(entry->name, entry->nameLength);
|
||||
closedir_nid_postfix(handle);
|
||||
walk.ancestors.push_back(Identity{status.st_dev, status.st_ino});
|
||||
int result = 0;
|
||||
for (const std::string& name : names) {
|
||||
if (name == "." || name == "..") continue;
|
||||
const std::string child = Join(path, name);
|
||||
result = Visit(walk, child, static_cast<int>(child.size() - name.size()), level + 1);
|
||||
if (result != 0) break;
|
||||
}
|
||||
walk.ancestors.pop_back();
|
||||
if (result == 0 && walk.depth) result = Invoke(walk, path, status, FtwDp, base, level);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern "C" int APS5_VABI nftw_nid_postfix(const char* path, int (APS5_VABI *fn)(const char*, const void*, int, void*), int nopenfd, int flags) {
|
||||
if (path == nullptr || fn == nullptr) throw std::invalid_argument("nftw: null path or function");
|
||||
if (nopenfd < 1) {
|
||||
*__error_nid_postfix() = GuestEinval;
|
||||
return -1;
|
||||
}
|
||||
if (flags & ~(FtwPhys | FtwDepth)) NotImplemented_nid_no_patch(__func__);
|
||||
std::string copy;
|
||||
if (const int error = CopyGuestPath_nid_no_patch(path, copy)) {
|
||||
*__error_nid_postfix() = error;
|
||||
return -1;
|
||||
}
|
||||
Walk walk{fn, (flags & FtwPhys) != 0, (flags & FtwDepth) != 0, {}};
|
||||
return Visit(walk, copy, BasenameOffset(copy), 0);
|
||||
}
|
||||
@@ -43,6 +43,7 @@ int APS5_VABI closedir_nid_disambig1_nid_postfix(void* handle);
|
||||
GuestDirectoryEntry* APS5_VABI readdir_nid_disambig1_nid_postfix(void* handle);
|
||||
int APS5_VABI readdir_r_nid_disambig1_nid_postfix(void* handle, GuestDirectoryEntry* entry, GuestDirectoryEntry** result);
|
||||
int APS5_VABI fnmatch_nid_postfix(const char* pattern, const char* string, int flags);
|
||||
int APS5_VABI nftw_nid_postfix(const char* path, int (APS5_VABI *fn)(const char*, const void*, int, void*), int nopenfd, int flags);
|
||||
char* APS5_VABI strcasestr_nid_postfix(const char* text, const char* needle);
|
||||
void APS5_VABI arc4random_buf_nid_postfix(void* buffer, std::size_t size);
|
||||
std::uint32_t APS5_VABI arc4random_nid_postfix();
|
||||
|
||||
@@ -38,6 +38,17 @@ static bool IsSubset(const FcCharSet& subset, const FcCharSet& superset) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ReadCharmapEncoding(FreeType::GuestFaceRec* face, std::int32_t& encoding, bool& hasCharmap) {
|
||||
FreeType::GuestCharMapRec* charmap = nullptr;
|
||||
if (!CopyGuestIn(&charmap, &face->charmap, sizeof(charmap))) return false;
|
||||
hasCharmap = (charmap != nullptr);
|
||||
if (!hasCharmap) {
|
||||
encoding = 0;
|
||||
return true;
|
||||
}
|
||||
return CopyGuestIn(&encoding, &charmap->encoding, sizeof(encoding));
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
FcConfig* APS5_VABI FcConfigGetCurrent() {
|
||||
@@ -133,12 +144,15 @@ FcCharSet* APS5_VABI FcCharSetCreate() {
|
||||
|
||||
std::uint32_t APS5_VABI FcFreeTypeCharIndex(FreeType::GuestFaceRec* face, std::uint32_t character) {
|
||||
if (!face) return 0;
|
||||
std::int32_t current = 0;
|
||||
bool hasCharmap = false;
|
||||
if (!ReadCharmapEncoding(face, current, hasCharmap)) return 0;
|
||||
constexpr std::array encodings{FT_ENCODING_UNICODE, FT_ENCODING_MS_SYMBOL};
|
||||
const auto current = face->charmap ? face->charmap->encoding : 0;
|
||||
const std::size_t initial = current == encodings[1] ? 1 : 0;
|
||||
const std::size_t initial = (hasCharmap && current == encodings[1]) ? 1 : 0;
|
||||
for (std::size_t offset = 0; offset < encodings.size(); ++offset) {
|
||||
const auto encoding = encodings[(initial + offset) % encodings.size()];
|
||||
if ((!face->charmap || face->charmap->encoding != encoding) &&
|
||||
if (!ReadCharmapEncoding(face, current, hasCharmap)) return 0;
|
||||
if ((!hasCharmap || current != encoding) &&
|
||||
FT_Select_Charmap_nid_postfix(face, encoding) != 0) continue;
|
||||
if (const auto glyph = FT_Get_Char_Index_nid_postfix(face, character)) return glyph;
|
||||
if (character < 0x100 && encoding == FT_ENCODING_MS_SYMBOL) {
|
||||
|
||||
@@ -571,6 +571,34 @@ static void CheckCp864Profile() {
|
||||
Require(arabic != nullptr && arabic == sceCesRefersUcsProfileCp864());
|
||||
Require(arabic != sceCesRefersUcsProfileCp850() && arabic != sceCesRefersUcsProfileCp1256());
|
||||
RequireSbcRoundTrip(arabic, {0x9B, 0x9C, 0x9F, 0xA6, 0xA7, 0xFF});
|
||||
constexpr std::uint16_t highCodePoints[128] = {
|
||||
0x00B0, 0x00B7, 0x2219, 0x221A, 0x2592, 0x2500, 0x2502, 0x253C,
|
||||
0x2524, 0x252C, 0x251C, 0x2534, 0x2510, 0x250C, 0x2514, 0x2518,
|
||||
0x03B2, 0x221E, 0x03C6, 0x00B1, 0x00BD, 0x00BC, 0x2248, 0x00AB,
|
||||
0x00BB, 0xFEF7, 0xFEF8, 0x0000, 0x0000, 0xFEFB, 0xFEFC, 0x0000,
|
||||
0x00A0, 0x00AD, 0xFE82, 0x00A3, 0x00A4, 0xFE84, 0x0000, 0x0000,
|
||||
0xFE8E, 0xFE8F, 0xFE95, 0xFE99, 0x060C, 0xFE9D, 0xFEA1, 0xFEA5,
|
||||
0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667,
|
||||
0x0668, 0x0669, 0xFED1, 0x061B, 0xFEB1, 0xFEB5, 0xFEB9, 0x061F,
|
||||
0x00A2, 0xFE80, 0xFE81, 0xFE83, 0xFE85, 0xFECA, 0xFE8B, 0xFE8D,
|
||||
0xFE91, 0xFE93, 0xFE97, 0xFE9B, 0xFE9F, 0xFEA3, 0xFEA7, 0xFEA9,
|
||||
0xFEAB, 0xFEAD, 0xFEAF, 0xFEB3, 0xFEB7, 0xFEBB, 0xFEBF, 0xFEC1,
|
||||
0xFEC5, 0xFECB, 0xFECF, 0x00A6, 0x00AC, 0x00F7, 0x00D7, 0xFEC9,
|
||||
0x0640, 0xFED3, 0xFED7, 0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, 0xFEEB,
|
||||
0xFEED, 0xFEEF, 0xFEF3, 0xFEBD, 0xFECC, 0xFECE, 0xFECD, 0xFEE1,
|
||||
0xFE7D, 0x0651, 0xFEE5, 0xFEE9, 0xFEEC, 0xFEF0, 0xFEF2, 0xFED0,
|
||||
0xFED5, 0xFEF5, 0xFEF6, 0xFEDD, 0xFED9, 0xFEF1, 0x25A0, 0x0000,
|
||||
};
|
||||
for (std::uint32_t byte = 0; byte < 256; ++byte) {
|
||||
const auto sbc = static_cast<std::uint8_t>(byte);
|
||||
const std::uint32_t expected = byte < 0x80 ? (byte == 0x25 ? 0x066A : byte) : highCodePoints[byte - 0x80];
|
||||
const int expectedStatus = byte >= 0x80 && expected == 0 ? unassignedCode : 0;
|
||||
std::uint32_t code = 0xA5A5A5A5;
|
||||
Require(sceCesSbcToUtf32(arabic, sbc, &code) == expectedStatus && code == expected);
|
||||
}
|
||||
std::uint8_t encodedByte = 0xA5;
|
||||
Require(sceCesUtf32ToSbc(0x0025, arabic, &encodedByte) == unassignedCode && encodedByte == 0);
|
||||
Require(sceCesUtf32ToSbc(0x066A, arabic, &encodedByte) == 0 && encodedByte == 0x25);
|
||||
for (int sbc = 1; sbc < 0x80; ++sbc) {
|
||||
if (sbc != 0x25) RequireSbcCode(arabic, static_cast<std::uint8_t>(sbc), static_cast<std::uint32_t>(sbc));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <initializer_list>
|
||||
|
||||
static void Require(bool value) { if (!value) std::abort(); }
|
||||
|
||||
@@ -355,6 +356,31 @@ int main() {
|
||||
Require(sceCesMbcsStrToUtf16Str(context, Bytes("\x80\xE9"), 2, &length, utf16Out, 4, &outLength) == 0);
|
||||
Require(outLength == 2 && utf16Out[0] == 0x20AC && utf16Out[1] == 0x00E9);
|
||||
|
||||
for (const void* profile : {sceCesRefersUcsProfileCp1254(), sceCesRefersUcsProfileCp1258()}) {
|
||||
Require(sceCesMbcsUcsContextInit(context, profile) == 0);
|
||||
const auto checkDecode = [&](const std::uint8_t* source, std::uint32_t size, int status,
|
||||
std::uint32_t count, std::uint16_t unit) {
|
||||
length = outLength = 42;
|
||||
Require(sceCesMbcsStrToUtf16Str(context, source, size, &length, utf16Out, 4, &outLength) == status);
|
||||
Require(length == count && outLength == count);
|
||||
if (count != 0) Require(utf16Out[0] == unit);
|
||||
length = outLength = 42;
|
||||
Require(sceCesMbcsStrGetUtf16Len(context, source, size, &length, &outLength) == status);
|
||||
Require(length == count && outLength == count);
|
||||
};
|
||||
checkDecode(Bytes("\x80"), 1, 0, 1, 0x20AC);
|
||||
checkDecode(Bytes("\x82"), 1, 0, 1, 0x201A);
|
||||
checkDecode(Bytes("\x9F"), 1, 0, 1, 0x0178);
|
||||
for (const std::uint8_t byte : {0x81, 0x8D, 0x8E, 0x8F, 0x90, 0x9D, 0x9E}) {
|
||||
checkDecode(&byte, 1, unassignedCode, 0, 0);
|
||||
}
|
||||
if (profile == sceCesRefersUcsProfileCp1258()) {
|
||||
checkDecode(Bytes("\x8A"), 1, unassignedCode, 0, 0);
|
||||
checkDecode(Bytes("\x9A"), 1, unassignedCode, 0, 0);
|
||||
}
|
||||
checkDecode(Bytes("A\x81" "B"), 3, unassignedCode, 1, 'A');
|
||||
}
|
||||
|
||||
alignas(8) std::uint8_t eucJpSheet[64] = {};
|
||||
alignas(8) std::uint8_t eucCnSheet[64] = {};
|
||||
alignas(8) std::uint8_t gbkSheet[64] = {};
|
||||
|
||||
@@ -68,6 +68,10 @@ std::vector<unsigned char> SymbolOnlyFont(std::uint32_t codepoint, int width) {
|
||||
|
||||
int main() {
|
||||
Require(FcFreeTypeCharIndex(nullptr, 'A') == 0);
|
||||
Require(FcFreeTypeCharIndex(reinterpret_cast<FreeType::GuestFaceRec*>(std::uintptr_t{0x10}), 'A') == 0);
|
||||
FreeType::GuestFaceRec unreadableCharmapFace{};
|
||||
unreadableCharmapFace.charmap = reinterpret_cast<FreeType::GuestCharMapRec*>(std::uintptr_t{0x10});
|
||||
Require(FcFreeTypeCharIndex(&unreadableCharmapFace, 'A') == 0);
|
||||
const auto font = SquareGlyphFont('A', 700, true);
|
||||
FreeType::GuestLibrary* library = nullptr;
|
||||
Require(FT_Init_FreeType_nid_postfix(&library) == 0);
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
#include "prx/libSceLibcInternal/include/InventoryExports2.hpp"
|
||||
#include "prx/libSceLibcInternal/include/RuntimeInternals.hpp"
|
||||
#include "prx/libc/include/Api.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cerrno>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <exception>
|
||||
#include <source_location>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int GuestEilseq = 86;
|
||||
|
||||
void Require(bool condition, std::source_location location = std::source_location::current()) {
|
||||
if (condition) return;
|
||||
std::fprintf(stderr, "libc internal multibyte check failed at line %u\n", location.line());
|
||||
std::abort();
|
||||
}
|
||||
|
||||
template <typename TCall>
|
||||
void RejectsPreservingErrno(TCall call, std::source_location location = std::source_location::current()) {
|
||||
errno = 71;
|
||||
bool rejected = false;
|
||||
try {
|
||||
call();
|
||||
} catch (const std::exception&) {
|
||||
rejected = errno == 71;
|
||||
}
|
||||
Require(rejected, location);
|
||||
}
|
||||
|
||||
void CheckMbtowc() {
|
||||
std::array<unsigned char, 16> state{};
|
||||
std::uint16_t wide = 0xffff;
|
||||
|
||||
Require(_Mbtowc_nid_postfix(&wide, "A", 1, state.data()) == 1);
|
||||
Require(wide == 0x0041);
|
||||
Require(mbsinit_nid_postfix(state.data()) != 0);
|
||||
|
||||
wide = 0x1234;
|
||||
Require(_Mbtowc_nid_postfix(&wide, "", 1, state.data()) == 0);
|
||||
Require(wide == 0);
|
||||
|
||||
const char twoByte[] = "\xC3\xA9";
|
||||
wide = 0;
|
||||
Require(_Mbtowc_nid_postfix(&wide, twoByte, 2, state.data()) == 2);
|
||||
Require(wide == 0x00E9);
|
||||
|
||||
const char threeByte[] = "\xE3\x81\x82";
|
||||
wide = 0;
|
||||
Require(_Mbtowc_nid_postfix(&wide, threeByte, 1, state.data()) == -2);
|
||||
Require(wide == 0);
|
||||
Require(mbsinit_nid_postfix(state.data()) == 0);
|
||||
Require(_Mbtowc_nid_postfix(&wide, threeByte + 1, 2, state.data()) == 2);
|
||||
Require(wide == 0x3042);
|
||||
Require(mbsinit_nid_postfix(state.data()) != 0);
|
||||
|
||||
Require(_Mbtowc_nid_postfix(nullptr, threeByte, 3, state.data()) == 3);
|
||||
Require(_Mbtowc_nid_postfix(&wide, "Z", 0, state.data()) == -2);
|
||||
|
||||
Require(_Mbtowc_nid_postfix(&wide, threeByte, 1, state.data()) == -2);
|
||||
Require(mbsinit_nid_postfix(state.data()) == 0);
|
||||
Require(_Mbtowc_nid_postfix(nullptr, nullptr, 0, state.data()) == 0);
|
||||
Require(mbsinit_nid_postfix(state.data()) != 0);
|
||||
|
||||
wide = 0xBEEF;
|
||||
errno = 0;
|
||||
const char invalid[] = "\xF0\x9F\x98\x80";
|
||||
Require(_Mbtowc_nid_postfix(&wide, invalid, 4, state.data()) == -1);
|
||||
Require(errno == GuestEilseq);
|
||||
Require(wide == 0xBEEF);
|
||||
|
||||
wide = 0;
|
||||
Require(_Mbtowc_nid_postfix(&wide, "B", 1, nullptr) == 1);
|
||||
Require(wide == 0x0042);
|
||||
Require(_Mbtowc_nid_postfix(nullptr, nullptr, 0, nullptr) == 0);
|
||||
}
|
||||
|
||||
void CheckWctombAndRoundTrip() {
|
||||
std::array<unsigned char, 16> state{};
|
||||
state.fill(0x5a);
|
||||
Require(_Wctomb_nid_postfix(nullptr, 0, state.data()) == 0);
|
||||
for (unsigned char byte : state) Require(byte == 0);
|
||||
Require(_Wctomb_nid_postfix(nullptr, 0, nullptr) == 0);
|
||||
|
||||
char out[4]{};
|
||||
Require(_Wctomb_nid_postfix(out, 0x0041, state.data()) == 1);
|
||||
Require(out[0] == 'A');
|
||||
|
||||
Require(_Wctomb_nid_postfix(out, 0x0000, state.data()) == 1);
|
||||
Require(out[0] == '\0');
|
||||
|
||||
Require(_Wctomb_nid_postfix(out, 0x00E9, state.data()) == 2);
|
||||
Require(static_cast<unsigned char>(out[0]) == 0xC3 && static_cast<unsigned char>(out[1]) == 0xA9);
|
||||
|
||||
Require(_Wctomb_nid_postfix(out, 0x3042, state.data()) == 3);
|
||||
Require(static_cast<unsigned char>(out[0]) == 0xE3 && static_cast<unsigned char>(out[1]) == 0x81 &&
|
||||
static_cast<unsigned char>(out[2]) == 0x82);
|
||||
|
||||
const std::uint16_t samples[] = {0x0001, 0x007F, 0x0080, 0x07FF, 0x0800, 0x3042, 0xFFFF};
|
||||
for (std::uint16_t value : samples) {
|
||||
std::array<unsigned char, 16> roundState{};
|
||||
char encoded[4]{};
|
||||
const int length = _Wctomb_nid_postfix(encoded, value, roundState.data());
|
||||
Require(length >= 1 && length <= 3);
|
||||
std::uint16_t decoded = 0;
|
||||
Require(_Mbtowc_nid_postfix(&decoded, encoded, static_cast<std::size_t>(length), roundState.data()) == length);
|
||||
Require(decoded == value);
|
||||
}
|
||||
}
|
||||
|
||||
void CheckGuestPointers() {
|
||||
std::array<unsigned char, 16> state{};
|
||||
std::uint16_t wide = 0;
|
||||
auto* unmappedChar = reinterpret_cast<char*>(std::uintptr_t{0x10});
|
||||
auto* unmappedWide = reinterpret_cast<std::uint16_t*>(std::uintptr_t{0x10});
|
||||
auto* unmappedState = reinterpret_cast<void*>(std::uintptr_t{0x10});
|
||||
|
||||
RejectsPreservingErrno([&] { _Mbtowc_nid_postfix(&wide, unmappedChar, 1, state.data()); });
|
||||
RejectsPreservingErrno([&] { _Mbtowc_nid_postfix(unmappedWide, "A", 1, state.data()); });
|
||||
RejectsPreservingErrno([&] { _Mbtowc_nid_postfix(&wide, "A", 1, unmappedState); });
|
||||
RejectsPreservingErrno([&] { _Mbtowc_nid_postfix(nullptr, nullptr, 0, unmappedState); });
|
||||
RejectsPreservingErrno([&] { _Wctomb_nid_postfix(unmappedChar, 0x0041, state.data()); });
|
||||
RejectsPreservingErrno([&] { _Wctomb_nid_postfix(nullptr, 0, unmappedState); });
|
||||
char out[4]{};
|
||||
RejectsPreservingErrno([&] { _Wctomb_nid_postfix(out, 0x0041, unmappedState); });
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
CheckMbtowc();
|
||||
CheckWctombAndRoundTrip();
|
||||
CheckGuestPointers();
|
||||
|
||||
std::puts("libSceLibcInternal _Mbtowc and _Wctomb tests passed");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
#include "prx/libkernel/include/Api.hpp"
|
||||
#include "prx/libc/include/Api.hpp"
|
||||
#include "prx/libScePosixForWebKit/include/Api.hpp"
|
||||
#include "prx/libc/include/General.hpp"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <random>
|
||||
#include <source_location>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int FtwF = 0;
|
||||
constexpr int FtwD = 1;
|
||||
constexpr int FtwNs = 4;
|
||||
constexpr int FtwSl = 5;
|
||||
constexpr int FtwSln = 6;
|
||||
constexpr int FtwDp = 3;
|
||||
constexpr int FtwPhys = 0x01;
|
||||
constexpr int FtwDepth = 0x04;
|
||||
constexpr int FtwChdir = 0x08;
|
||||
constexpr int GuestEinval = 22;
|
||||
|
||||
struct GuestFtw {
|
||||
int base;
|
||||
int level;
|
||||
};
|
||||
|
||||
struct Record {
|
||||
std::string path;
|
||||
int type;
|
||||
int base;
|
||||
int level;
|
||||
};
|
||||
|
||||
std::vector<Record> g_records;
|
||||
int g_stopAt = 0;
|
||||
int g_stopReturn = 0;
|
||||
|
||||
void Require(bool condition, std::source_location location = std::source_location::current()) {
|
||||
if (!condition) {
|
||||
std::fprintf(stderr, "nftw check failed at line %u (guest errno %d)\n", location.line(), *__error_nid_postfix());
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
|
||||
int APS5_VABI Recorder(const char* path, const void*, int type, void* info) {
|
||||
const auto* ftw = static_cast<const GuestFtw*>(info);
|
||||
g_records.push_back(Record{path, type, ftw->base, ftw->level});
|
||||
if (g_stopAt != 0 && static_cast<int>(g_records.size()) == g_stopAt) return g_stopReturn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::map<std::string, std::pair<int, int>> ByPath(const std::vector<Record>& records) {
|
||||
std::map<std::string, std::pair<int, int>> result;
|
||||
for (const Record& record : records) result[record.path] = {record.type, record.level};
|
||||
return result;
|
||||
}
|
||||
|
||||
std::size_t IndexOf(const std::vector<Record>& records, const std::string& path) {
|
||||
for (std::size_t index = 0; index < records.size(); ++index)
|
||||
if (records[index].path == path) return index;
|
||||
Require(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TestPreorderLogical() {
|
||||
g_records.clear();
|
||||
g_stopAt = 0;
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test", Recorder, 4, 0) == 0);
|
||||
const std::map<std::string, std::pair<int, int>> expected = {
|
||||
{"/anyps5-nftw-test", {FtwD, 0}},
|
||||
{"/anyps5-nftw-test/a.txt", {FtwF, 1}},
|
||||
{"/anyps5-nftw-test/d", {FtwD, 1}},
|
||||
{"/anyps5-nftw-test/d/b.txt", {FtwF, 2}},
|
||||
{"/anyps5-nftw-test/d/e", {FtwD, 2}},
|
||||
{"/anyps5-nftw-test/d/e/c.txt", {FtwF, 3}},
|
||||
{"/anyps5-nftw-test/f", {FtwD, 1}},
|
||||
};
|
||||
Require(g_records.size() == expected.size());
|
||||
Require(ByPath(g_records) == expected);
|
||||
for (const Record& record : g_records) Require(record.base == static_cast<int>(record.path.rfind('/') + 1));
|
||||
}
|
||||
|
||||
void TestPostorderDepth() {
|
||||
g_records.clear();
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test", Recorder, 4, FtwDepth) == 0);
|
||||
Require(g_records.size() == 7);
|
||||
for (const Record& record : g_records) Require(record.type != FtwD);
|
||||
Require(IndexOf(g_records, "/anyps5-nftw-test/d/b.txt") < IndexOf(g_records, "/anyps5-nftw-test/d"));
|
||||
Require(IndexOf(g_records, "/anyps5-nftw-test/d/e/c.txt") < IndexOf(g_records, "/anyps5-nftw-test/d/e"));
|
||||
Require(IndexOf(g_records, "/anyps5-nftw-test/d/e") < IndexOf(g_records, "/anyps5-nftw-test/d"));
|
||||
Require(g_records.back().path == "/anyps5-nftw-test");
|
||||
Require(g_records.back().type == FtwDp);
|
||||
}
|
||||
|
||||
void TestCallbackStopsWalk() {
|
||||
g_records.clear();
|
||||
g_stopAt = 1;
|
||||
g_stopReturn = 7;
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test", Recorder, 4, 0) == 7);
|
||||
Require(g_records.size() == 1);
|
||||
g_stopAt = 0;
|
||||
g_stopReturn = 0;
|
||||
}
|
||||
|
||||
void TestMissingRootReportsNs() {
|
||||
g_records.clear();
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test/missing", Recorder, 4, 0) == 0);
|
||||
Require(g_records.size() == 1);
|
||||
Require(g_records[0].type == FtwNs && g_records[0].level == 0);
|
||||
}
|
||||
|
||||
void TestRejectsBadArguments() {
|
||||
g_records.clear();
|
||||
*__error_nid_postfix() = 0;
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test", Recorder, 0, 0) == -1);
|
||||
Require(*__error_nid_postfix() == GuestEinval);
|
||||
Require(g_records.empty());
|
||||
|
||||
bool thrown = false;
|
||||
try {
|
||||
nftw_nid_postfix("/anyps5-nftw-test", Recorder, 4, FtwChdir);
|
||||
} catch (const std::exception&) {
|
||||
thrown = true;
|
||||
}
|
||||
Require(thrown);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
void TestSymlinks(const std::filesystem::path& root) {
|
||||
std::filesystem::create_symlink(root / "a.txt", root / "link");
|
||||
std::filesystem::create_symlink(root / "missing.txt", root / "dangling");
|
||||
|
||||
g_records.clear();
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test", Recorder, 4, 0) == 0);
|
||||
const auto logical = ByPath(g_records);
|
||||
Require(logical.at("/anyps5-nftw-test/link").first == FtwF);
|
||||
Require(logical.at("/anyps5-nftw-test/dangling").first == FtwSln);
|
||||
|
||||
g_records.clear();
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test", Recorder, 4, FtwPhys) == 0);
|
||||
const auto physical = ByPath(g_records);
|
||||
Require(physical.at("/anyps5-nftw-test/link").first == FtwSl);
|
||||
Require(physical.at("/anyps5-nftw-test/dangling").first == FtwSl);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void TestStopBelowRoot() {
|
||||
g_records.clear();
|
||||
g_stopAt = 3;
|
||||
g_stopReturn = 7;
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test", Recorder, 4, 0) == 7);
|
||||
Require(g_records.size() == 3);
|
||||
g_stopAt = 0;
|
||||
g_stopReturn = 0;
|
||||
}
|
||||
|
||||
void TestTrailingSlashBase() {
|
||||
g_records.clear();
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test/", Recorder, 4, 0) == 0);
|
||||
Require(!g_records.empty());
|
||||
Require(g_records[0].base == static_cast<int>(g_records[0].path.size()));
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::random_device random;
|
||||
const auto root = std::filesystem::temp_directory_path() /
|
||||
("anyps5-nftw-test-" + std::to_string(random()) + "-" + std::to_string(random()));
|
||||
Require(std::filesystem::create_directory(root));
|
||||
std::ofstream(root / "a.txt") << "x";
|
||||
Require(std::filesystem::create_directory(root / "d"));
|
||||
std::ofstream(root / "d" / "b.txt") << "x";
|
||||
Require(std::filesystem::create_directory(root / "d" / "e"));
|
||||
std::ofstream(root / "d" / "e" / "c.txt") << "x";
|
||||
Require(std::filesystem::create_directory(root / "f"));
|
||||
AddPathAlias_nid_no_patch("/anyps5-nftw-test", root.string().c_str());
|
||||
|
||||
TestPreorderLogical();
|
||||
TestPostorderDepth();
|
||||
TestCallbackStopsWalk();
|
||||
TestMissingRootReportsNs();
|
||||
TestRejectsBadArguments();
|
||||
TestStopBelowRoot();
|
||||
TestTrailingSlashBase();
|
||||
#ifndef _WIN32
|
||||
TestSymlinks(root);
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
std::filesystem::create_symlink(root, root / "d" / "loop");
|
||||
g_records.clear();
|
||||
Require(nftw_nid_postfix("/anyps5-nftw-test", Recorder, 4, 0) == 0);
|
||||
for (const Record& record : g_records) Require(record.path.find("/loop") == std::string::npos);
|
||||
#endif
|
||||
|
||||
RemovePathAlias_nid_no_patch("/anyps5-nftw-test");
|
||||
Require(std::filesystem::remove_all(root) > 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
# libSceCesCs
|
||||
## change [sceCesRefersUcsProfileCp864]
|
||||
- [sceCesRefersUcsProfileCp864](../../../core/libs/prx/libSceCesCs/SingleByte.hpp) (libSceCesCs) - it follows Microsoft's [CP864.TXT](https://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP864.TXT): 0x25 is the Arabic percent sign U+066A and U+0025 has no byte, and the undefined bytes 0x9B, 0x9C, 0x9F, 0xA6, 0xA7 and 0xFF answer `UNASSIGNED_CODE`. A PS5 (firmware 11.60, payload process; a title process may differ) gave the same table: `sceCesSbcToUtf32` returned 0 for 250 of the 256 bytes with the CRC32 0xca172948 over the (return value, scalar) pairs, and it kept 0x25 as U+066A: U+0025 had no byte (`0x805C0020`) and U+066A gave 0x25. The six undefined bytes returned an error whose low 16 bits are 0x0020 (`0x805C0020` read in full for 0x9B), with 0 written as the scalar, where this leaves the output unchanged; counting that value as 0, the two CRC32 values are equal. The same difference is in the byte output of `sceCesUtf32ToSbc` and `sceCesUcs2ToSbc` and in the value output of `sceCesSbcToUcs2` on an error return; the console left the `sceCesSbcToUtf8` output unchanged for 0x9B, as this does.
|
||||
- [sceCesRefersUcsProfileCp864](../../../core/libs/prx/libSceCesCs/SingleByte.hpp) (libSceCesCs) - title-process behavior is unverified. A PS5 (firmware 11.60, payload process) matched Microsoft's [CP864.TXT](https://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP864.TXT) through `sceCesSbcToUtf32` for all 256 bytes (250 successes, CRC32 0xca172948 over the return-code and scalar pairs), as this does. Byte 0x25 maps to U+066A, and U+0025 has no byte. The six undefined bytes (0x9B, 0x9C, 0x9F, 0xA6, 0xA7 and 0xFF) return `UNASSIGNED_CODE` and write scalar 0. On measured conversion errors `sceCesUtf32ToSbc`, `sceCesUcs2ToSbc` and `sceCesSbcToUcs2` also write 0. `sceCesSbcToUtf8` leaves the output bytes unchanged and writes length 0 for 0x9B and 0xFF.
|
||||
@@ -0,0 +1,5 @@
|
||||
# libScePosixForWebKit
|
||||
|
||||
## add Unknown function info
|
||||
|
||||
- [nftw](../../../core/libs/prx/libScePosixForWebKit/FileTree.cpp) (libScePosixForWebKit) - the type flags (FTW_F, FTW_D, FTW_DNR, FTW_DP, FTW_NS, FTW_SL, FTW_SLN), the `struct FTW` fields and the FTW_PHYS and FTW_DEPTH behaviour follow the FreeBSD 11.4 [`ftw.h`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/include/ftw.h) and nftw.c at the pinned commit. The walk uses this library's guest `opendir`, `readdir`, `stat` and `lstat`, not fts(3); a directory already on the walk path is skipped without a callback, as FreeBSD skips FTS_DC. Only one directory handle is open at a time, so `nopenfd` is checked for at least 1 and not otherwise used. FTW_CHDIR and FTW_MOUNT, and unknown flag bits, throw. The export is placed in libScePosixForWebKit beside `fnmatch` and `glob`; which console module imports it is not verified.
|
||||
@@ -0,0 +1,5 @@
|
||||
# libSceLibcInternal
|
||||
|
||||
## add Unknown function info
|
||||
|
||||
- [_Mbtowc and _Wctomb](../../../core/libs/prx/libSceLibcInternal/Multibyte.cpp) (libSceLibcInternal) - the console module was not read. The `int(uint16_t*, const char*, size_t, void*)` and `int(char*, uint16_t, void*)` prototypes follow Dinkumware `_Mbtowc` and `_Wctomb` over PS5's 16-bit `wchar_t` and 16-byte `mbstate_t`, delegating UTF-8 decoding and encoding to `libc`'s `mbrtowc` and `wcrtomb` (`MB_CUR_MAX = 3`, BMP only, `EILSEQ = 86`). Unreadable or unwritable non-null guest pointers throw via `GuestCopyIn_nid_no_patch`/`GuestCopyOut_nid_no_patch` while preserving `errno`. Non-UTF-8 locale encodings and `_Cvtvec` parameter variants are not modelled. Closes when: compared with the console module.
|
||||
@@ -0,0 +1,5 @@
|
||||
# libfontconfig
|
||||
|
||||
## change [FreeType character lookup]
|
||||
|
||||
- [FreeType character lookup](../../../core/libs/prx/libfontconfig/Export.cpp): `FcFreeTypeCharIndex` follows the pinned Fontconfig `fcfreetype.c` search order: current Unicode or Microsoft Symbol charmap first, then the other; symbol characters below U+0100 also try U+F000 offset. It calls libSceFreeType's guest face exports, so only faces created by that adapter are supported. The console's Fontconfig version, call signature and behavior are unmeasured. Returning 0 for an unreadable guest face or charmap pointer through `GuestCopyIn_nid_no_patch` is a host-safety fallback.
|
||||
Reference in new issue
Block a user