From 770b577a4fa23b35d84a5b491872ba9439437167 Mon Sep 17 00:00:00 2001 From: raphaelthegreat <47210458+raphaelthegreat@users.noreply.github.com> Date: Mon, 10 Jun 2024 20:57:54 +0300 Subject: [PATCH] file_system: Add some functions --- src/core/libraries/kernel/file_system.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index 336a541ad..9ec25b138 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -32,7 +32,8 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) { bool directory = (flags & ORBIS_KERNEL_O_DIRECTORY) != 0; if (directory) { - UNREACHABLE(); // not supported yet + const std::string host_dir = mnt->GetHostFile(path); + std::filesystem::create_directories(host_dir); } else { u32 handle = h->CreateHandle(); auto* file = h->GetFile(handle); @@ -223,6 +224,15 @@ int PS4_SYSV_ABI posix_stat(const char* path, OrbisKernelStat* sb) { return result; } +int PS4_SYSV_ABI sceKernelCheckReachability(const char* path) { + auto* mnt = Common::Singleton::Instance(); + std::string path_name = mnt->GetHostFile(path); + if (!std::filesystem::exists(path_name)) { + return SCE_KERNEL_ERROR_ENOENT; + } + return ORBIS_OK; +} + s64 PS4_SYSV_ABI sceKernelPread(int d, void* buf, size_t nbytes, s64 offset) { if (d < 3) { return ORBIS_KERNEL_ERROR_EPERM; @@ -289,6 +299,7 @@ void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("E6ao34wPw+U", "libScePosix", 1, "libkernel", 1, 1, posix_stat); LIB_FUNCTION("+r3rMFwItV4", "libkernel", 1, "libkernel", 1, 1, sceKernelPread); + LIB_FUNCTION("uWyW3v98sU4", "libkernel", 1, "libkernel", 1, 1, sceKernelCheckReachability); // openOrbis (to check if it is valid out of OpenOrbis LIB_FUNCTION("6c3rCVE-fTU", "libkernel", 1, "libkernel", 1, 1,