file_system: Add some functions

This commit is contained in:
raphaelthegreat 2024-06-10 20:57:54 +03:00
parent d293fb9134
commit 770b577a4f

View file

@ -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<Core::FileSys::MntPoints>::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,